import { AfterViewInit, ChangeDetectorRef, ComponentRef, EventEmitter, Injector, OnChanges, OnDestroy, QueryList, SimpleChanges, ViewContainerRef } from '@angular/core'; import { DynamicComponentService, getValueFromPath } from '../../../../dynamic-component.service'; import { FormConfig } from '../dynamic-form/dynamic-form.component'; import { HttpClient } from '@angular/common/http'; import { DynamicFilterConfig, SavedFilter } from '../../components/dynamic-filter/dynamic-filter.component'; import * as i0 from "@angular/core"; declare global { interface EventTarget { value?: string; selectedIndex?: number; } } export declare enum tableActionTypes { EDIT = "edit", ADD_CHILD = "addChild", DELETE = "delete", CUSTOM = "custom" } /** Column configuration for a table cell */ export interface TableColumnConfig { key: string; header: string; type?: 'text' | 'number' | 'date' | 'image' | 'link' | 'html' | 'component' | 'array' | 'componentVisual' | 'actions' | 'select' | 'icons'; width?: string; component?: any; editable?: boolean; sortable?: { enabled?: boolean; external?: boolean; api?: string; path?: string; onSort?: (data: any) => void; }; dataInputs?: { [input: string]: any | ((row: any) => any); }; externalInputs?: { [input: string]: any; }; bindedEvents?: { [eventName: string]: (data: any) => void; }; options?: any[]; optionLabel?: string; optionValue?: string; actions?: { icon: string; tooltip: string; type?: tableActionTypes; disabled?: boolean; action: (data: any) => void; emptyDataStructure?: any; }[]; arrayConfig?: TableColumnArray; iconsOptions?: { value: any; icon: string; tooltip: string; }[]; baseUrl?: string; cursor?: string; pointerEvents?: string; onClick?: (event: { row: any; value: any; column: TableColumnConfig; }) => void; onHover?: (event: { row: any; value: any; column: TableColumnConfig; }) => void; onLeave?: (event: { row: any; value: any; column: TableColumnConfig; }) => void; onChange?: (event: { row: any; value: any; column: TableColumnConfig; }) => void; } /** Additional configuration for array type columns */ export interface TableColumnArray { arrayType: 'list' | 'dropdown' | 'checkbox' | 'radio'; arrayData?: any[]; component?: any; dataInputs?: { [input: string]: any | ((item: any) => any); }; bindedEvents?: { [eventName: string]: (data: any) => void; }; flexContainer?: boolean; containerClass?: string; } /** Overall table configuration */ export interface TableConfig { columns?: TableColumnConfig[]; expandable?: { component?: any; dataInputs?: { [input: string]: any | ((row: any) => any); }; externalInputs?: { [input: string]: any; }; bindedEvents?: { [eventName: string]: (data: any) => void; }; initiallyExpanded?: boolean; position?: 'first' | 'last'; enabledByData?: string; }; headless?: boolean; addItembutton?: { label: string; icon?: string; action: (data: any) => void; emptyDataStructure?: any; disabled?: boolean; hidden?: boolean; }; identifierKey?: string; filter?: { label?: string; icon?: string; action?: (data: any) => void; position?: 'top' | 'right'; config?: FormConfig; data: {}; disabled?: boolean; opened: boolean; hidden?: boolean; autoGenerate?: boolean; apiEndpoint?: string; onFilterChange?: (filterData: any) => void; onFilterSubmit?: (filterData: any) => void; dynamicConfig?: DynamicFilterConfig; useDynamicFilter?: boolean; }; search?: { enabled?: boolean; url: string; path?: string; replacableKey?: string; action?: (data: any) => void; localDataType: 'tree' | 'standart'; autoExpand: boolean; keyword?: string; onKeywordChange?: (keyword: string) => void; }; pagination?: { page: number; pageSize: number; pageCount: number; total: number; onPage: (data: any) => void; hidden?: boolean; url?: string; path?: string; }; headers?: import('@angular/common/http').HttpHeaders | { [header: string]: string | string[]; }; } export declare class DynamicTableComponent implements AfterViewInit, OnChanges, OnDestroy { private injector; private dynamicComponentService; private cdr; private http; config: TableConfig; data: any[]; activeFilter: any; activeFilterChange: EventEmitter; activeFastFilter: SavedFilter | null; activeFastFilterChange: EventEmitter; cellAction: EventEmitter<{ row: any; column: TableColumnConfig; action: "click" | "change"; newValue?: any; oldValue?: any; result?: { [key: string]: any; }; }>; cellEdited: EventEmitter<{ row: any; column: TableColumnConfig; newValue: any; oldValue: any; result: { [key: string]: any; }; }>; editingCells: { [rowIndex: number]: { [columnKey: string]: boolean; }; }; editValues: { [rowIndex: number]: { [columnKey: string]: any; }; }; currentComponentRef: ComponentRef | null; getValueFromPath: typeof getValueFromPath; tableActionTypes: typeof tableActionTypes; expandedRows: { [rowIndex: number]: boolean; }; expandableRows: { [rowIndex: number]: boolean; }; expandedRowsComponents: { [rowIndex: number]: any; }; filter: { keyword: string; }; private searchTimeout; private readonly searchDebounceTime; componentReady: EventEmitter; onFilterSearch: EventEmitter<{ keyword: string; results: any[]; response: any; }>; private containerMap; set containers(containers: QueryList); filterChange: EventEmitter; filterSubmit: EventEmitter; filterSave: EventEmitter; filterLoad: EventEmitter; filterApiResponse: EventEmitter; constructor(injector: Injector, dynamicComponentService: DynamicComponentService, cdr: ChangeDetectorRef, http: HttpClient); ngOnDestroy(): void; toogleFilter(event: any): void; getContainer(rowId: string): ViewContainerRef | undefined; ngAfterViewInit(): void; ngOnChanges(changes: SimpleChanges): void; formatData(data: any[]): void; /** * Debounced search method - triggers search after user stops typing */ filterSearch(): void; /** * Performs the actual search operation (original logic) */ private performActualSearch; paginationFetch(event: any): void; syncData(target: any[], source: any[]): void; updateItem(targetItem: any, sourceItem: any): void; deepClone(obj: any): any; ngOnInit(): void; /** * For "component" type cells, opens the dynamic component in (for example) a modal. */ onCellClick(row: any, col: TableColumnConfig): void; /** * For array type columns, opens the dynamic component on item click. */ onArrayItemClick(row: any, col: TableColumnConfig, item?: any, index?: number): void; /** * Prepares inputs for a component by combining data inputs and external inputs */ prepareComponentInputs(row: any, col: TableColumnConfig): { [key: string]: any; }; /** * Prepares inputs for an array item component */ prepareArrayItemInputs(item: any, arrayCfg: TableColumnArray, index?: number): { [key: string]: any; }; /** * Binds event handlers to a component instance */ bindComponentEvents(componentOrInstance: ComponentRef | any, eventBindings?: { [eventName: string]: (data: any) => void; }, context?: any): void; /** * Handler for when a component outlet is initialized (for inline/visual components) * This allows us to bind events to the component instance */ handleComponentOutletInitialized(componentInstance: any, eventBindings?: { [eventName: string]: (data: any) => void; }, context?: any): void; /** * Handler for when an expanded component is initialized * This allows us to bind events to the expanded component */ handleExpandedComponentInitialized(componentRef: any, row: any): void; /** * Helper method to compute and return the inputs for visual components. * This is used with *ngComponentOutlet for the 'componentVisual' type. */ getComponentInputs(row: any, col: TableColumnConfig): { [key: string]: any; }; /** * Helper method to compute and return the inputs for the expanded row component. */ getExpandedComponentInputs(row: any): { [key: string]: any; }; /** * Returns the display value for an array item. * If arrayConfig.dataInputs has a "display" key, that mapping is used. * Otherwise, if the item is an object with a "title" property, that is used. * Else, the raw item is returned. */ getDisplayValue(item: any, col: TableColumnConfig): string; private resolveMapping; /** * Starts editing a cell */ startEditing(rowIndex: number, columnKey: string, row: any, col: TableColumnConfig): void; /** * Saves edited cell value */ saveEdit(rowIndex: number, columnKey: string, row: any, col: TableColumnConfig): void; /** * Cancels editing and reverts to the original value */ cancelEdit(rowIndex: number, columnKey: string): void; /** * Checks if a cell is currently being edited */ isEditing(rowIndex: number, columnKey: string): boolean; /** * Updates the temporary edit value as the user types */ updateEditValue(rowIndex: number, columnKey: string, value: any): void; /** * Toggles the expanded state of a row */ toggleRow(rowIndex: number, row: any): void; /** * Checks if a row is expanded */ isRowExpanded(row: any): boolean; /** * Checks if a row is expandable based on the enabledByData property */ isRowExpandable(row: any): boolean; actionEdit(action: any, i: number, list: any[], row: any): void; private getCellValue; /** * Returns the display value for a cell. * If dataInputs has a "display" function, that is used to transform the value. * Otherwise, returns the raw cell value. */ getCellDisplayValue(row: any, col: TableColumnConfig): any; handleCellClick(row: any, col: TableColumnConfig): void; handleCellHover(row: any, col: TableColumnConfig): void; handleCellLeave(row: any, col: TableColumnConfig): void; handleCellChange(row: any, col: TableColumnConfig, value: any): void; onSort(col: { [key: string]: any; }, data: any[]): void; /** * Handle external API-based sorting * @param col Column configuration with sortable.api and sortable.path */ externalSort(col: { [key: string]: any; }): void; customSort(a: any, b: any, field: string, order: number): number; updateExpandedComponentsAfterDataChange(): void; /** * Initialize filter configuration - auto-generate if needed */ private initializeFilterConfig; /** * Auto-generate filter form configuration from table columns */ private generateFilterConfigFromColumns; /** * Check if a column should be included in the filter form */ private isFilterableColumn; /** * Create a filter field configuration from a table column */ private createFilterField; /** * Handle filter form changes */ onFilterChange(filterData: any): void; /** * Handle filter form submission */ onFilterSubmit(filterData: any): void; /** * Call filter API endpoint */ private callFilterApi; /** * Clean filter data by removing empty/null values */ private cleanFilterData; /** * Reset filter form */ onFilterReset(): void; /** * Open the filter dialog */ openFilterDialog(): void; /** * Handle filter dialog hide event */ onFilterDialogHide(): void; /** * Get dynamic filter configuration */ getDynamicFilterConfig(): DynamicFilterConfig; /** * Map column type to filter type */ private mapColumnTypeToFilterType; /** * Handle dynamic filter apply */ onDynamicFilterApply(filterData: any): void; /** * Handle dynamic filter change */ onDynamicFilterChange(filterData: any): void; /** * Handle dynamic filter reset */ onDynamicFilterReset(): void; /** * Handle dynamic filter save */ onDynamicFilterSave(savedFilter: SavedFilter): void; /** * Handle dynamic filter load */ onDynamicFilterLoad(savedFilter: SavedFilter): void; private savedFiltersCache; private selectedSavedFilterId; /** * Get saved filters for the fast filter selector */ getSavedFilters(): SavedFilter[]; /** * Get the currently selected saved filter ID */ getSelectedSavedFilterId(): string | null; /** * Handle quick filter selection from the fast filter selector */ onQuickFilterSelect(filterId: string): void; /** * Update the last used timestamp for a saved filter */ private updateFilterLastUsed; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }