import { OnDestroy, WritableSignal } from '@angular/core'; import { Observable } from 'rxjs'; import { BaseModel } from 'verben-workflow-ui/src/lib/models'; import { UtilService } from 'verben-workflow-ui/src/lib/services'; import { CardData, ColumnDefinition, FilterCondition, SortCondition } from 'verben-ng-ui'; import { SearchHandlerService } from '../handlers/search-handler.service'; import { BasePageConfig } from '../models/page-config.interface'; import { BaseDataPageService } from './base-data-page.service'; import { BaseDataPageState } from './base-data-page.state'; import * as i0 from "@angular/core"; /** * Abstract facade for base data pages. * Orchestrates state, service, and search handler, and surfaces the host app's * busy indicator / toasts through UtilService. */ export declare abstract class BaseDataPageFacade implements OnDestroy { protected state: BaseDataPageState; protected service: BaseDataPageService; protected searchHandler: SearchHandlerService; protected utilService: UtilService; protected config: BasePageConfig; private destroy$; private cardSelectionCleared; /** * The saved config record for this page (once loaded/created), retained so * successive saves in a session update the same record instead of duplicating. */ private savedOption?; constructor(state: BaseDataPageState, service: BaseDataPageService, searchHandler: SearchHandlerService, utilService: UtilService, config: BasePageConfig); getConfig(): BasePageConfig; getColumns(): ColumnDefinition[]; get items$(): Observable; get isLoading$(): Observable; get totalCount$(): Observable; get filters$(): Observable; get sorts$(): Observable; get searchTerm$(): Observable; get visibleColumns$(): Observable[]>; /** Last table/card view (true = table). Restored on load, persisted on change. */ get isTableView$(): Observable; getIsTableViewValue(): boolean; get cardData(): WritableSignal; get currentCardData(): WritableSignal; /** * Emits when a refetch invalidates the current card selection. * Card views listen to this to clear their own selection state. */ get cardSelectionCleared$(): Observable; loadData(): Promise; addItem(item: T): void; loadMore(): Promise; /** * Fetch an arbitrary window without touching page state, honouring the active * search, filters and sorts. Backs the export component's dataQueryFunction. */ loadRange(skip: number, limit: number): Promise; refresh(): Promise; onSearch(term: string): void; private initializeSearchHandler; applyFilters(filters: FilterCondition[]): Promise; clearFilters(): Promise; applySorts(sorts: SortCondition[]): Promise; clearSorts(): Promise; updateVisibleColumns(columns: ColumnDefinition[]): void; /** * Update the table/card view flag WITHOUT persisting. Use for transient or * internal switches (e.g. dropping to card view to open a create form). */ setViewState(isTableView: boolean): void; /** Record the user's table/card choice and persist it (non-blocking). */ setView(isTableView: boolean): void; /** * Restore this page's saved config (via the host UTIL_SERVICE), then load data. * Safe to call in place of loadData() from the page's ngOnInit. When the page * has no `ui` (opt-out) or nothing is saved / the host doesn't support it, it * just loads data. */ restoreSavedConfig(): Promise; /** * Assemble the current page config and persist it through the host. Fire-and- * forget: never awaited, so the triggering UI action is not blocked. No-op when * the page opts out of persistence (`ui` unset). */ private persistConfig; /** Map ordered saved column ids back onto the config's ColumnDefinitions. */ private rebuildColumns; /** A fresh, unsaved PageFilterTabOption for this page. */ private newOption; selectCard(cardData: CardData | null): void; /** * Close the detail form. * * Goes through clearCardSelection rather than `selectCard(null)`: nulling the * signal alone only empties the form's fields, because CardDataViewComponent * holds its own `currentItem` that keeps the right-hand panel on screen. The * cardSelectionCleared$ notification is what lets the component tear that down. */ closeForm(): void; /** * Open the detail form for a record. Routed through selectCard so table-row * edit and card click share one source of truth for the open record — the * form template binds the current card, not a separate "selected item". * Reuses the matching existing card when there is one. */ openForm(item?: T): void; /** * Prepend a blank record and open it. Replaces the old approach of inferring * "this must be the new one" from a falsy Name, which re-opened the form * whenever a refetch happened to contain a blank-named record. */ createItem(blank: T): T; /** * Stable identity, matching BaseDataPageState.getItemKey. Kept here so the * facade can match cards without widening the state's protected seam. */ protected itemKey(item: T): string; /** * Drop the current card selection because the data it referred to is being * replaced. Called by loadData(); deliberately not by loadMore(), which only * appends and leaves an existing selection valid. */ protected clearCardSelection(): void; /** * Stamp the write state a record should be saved with. * * A record is new only when it has no Code yet (the backend always assigns * Code on persisted records). Don't trust the loaded DataState here: records * returned from the backend come through unchanged and report DataState * 'New', which would force an insert (and thus duplicate) on every edit. */ protected withDataState(item: T): T; saveItems(items: T[]): Promise; deleteItems(itemIds: string[]): Promise; exportData(): Promise; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; }