import { QueryList, TemplateRef, EventEmitter, ViewContainerRef, Type, OnDestroy, ChangeDetectorRef, OnChanges, SimpleChanges } from "@angular/core"; import { DomSanitizer, SafeHtml } from "@angular/platform-browser"; import { DndDropEvent } from "ngx-drag-drop"; import { DynamicCellTemplateDirective, DynamicHeaderTemplateDirective } from "./dynamic-cell.directive"; import { ComponentRenderConfig } from "./component-render-config.interface"; import * as i0 from "@angular/core"; export { ComponentRenderConfig } from "./component-render-config.interface"; export interface DynamicTableColumn { fieldId: string; fieldName?: string; fieldValue?: string; /** * Optional custom renderer invoked when no projected cell template is provided. * Returns the string/number/HTML string/Component class/ComponentRenderConfig to display for the given row. * HTML strings will be sanitized and rendered safely. * Component classes will be dynamically instantiated. */ render?: (row: any, column: DynamicTableColumn) => string | number | SafeHtml | Type | ComponentRenderConfig; isDefault?: boolean; sortable?: boolean; isShow?: boolean; weight?: number; fixedPx?: number; /** Minimum width in px — applied to both the header cell and every body cell of this column. */ minWidth?: number; responsive?: { xs?: boolean; sm?: boolean; md?: boolean; }; align?: 'left' | 'center' | 'right'; } export declare class DynamicTableComponent implements OnDestroy, OnChanges { private sanitizer; private cdr; data: any[]; columns: DynamicTableColumn[]; /** * Optional configuration object used when no custom empty template is provided. */ emptyState?: { title?: string; description?: string; imageUrl?: string; actions?: any[]; }; gridTemplateColumns?: string; screenWidth?: number; enableSelectAll: boolean; rowSelectable?: (row: any) => boolean; enableLocalSort: boolean; isTableLoading?: boolean; isTableDataLoading?: boolean; sortChange: EventEmitter<{ fieldId: string; fieldValue?: string; direction: 'asc' | 'desc' | null; }>; cellJsonPathGetter?: (rowIndex: number, colId: string, row: any) => string; onJsonPathCopiedHandler?: (event: { path: string; source: string; }) => void; /** * When true, renders a drag-handle column as the leftmost cell and enables * row drag-and-drop reordering via ngx-drag-drop. Off by default so existing * consumers are unaffected. */ enableRowReorder: boolean; /** Tooltip for the drag handle icon. */ reorderHandleTooltip: string; /** * Emitted after a successful row drop. `orderedData` is a freshly allocated * array reflecting the new order — parents should assign it back to `[data]` * rather than relying on in-place mutation. */ rowReorder: EventEmitter<{ previousIndex: number; currentIndex: number; orderedData: any[]; }>; /** Index of the row the cursor is currently hovering during a reorder drag. */ dropHoverIndex: number | null; /** Whether the cursor is in the top or bottom half of the hovered row. */ dropPosition: 'above' | 'below' | null; /** The row currently being dragged — used to suppress the indicator on the source row. */ private draggedRow; cellTemplates: QueryList; headerTemplates: QueryList; emptyTableTpl?: TemplateRef; private componentRefs; visibleColumns: DynamicTableColumn[]; computedData: any[]; computedGridTemplate: string; computedColumnWidths: string[]; /** * Hard floor on the `` width = sum of every visible column's minimum (fixed * widths + dynamic columns' `minWidth`). With `table-layout: fixed; width: 100%;` set * by consumers, `` widths become advisory once the container is narrower than * the column-width sum — the browser silently shrinks them. Pinning `min-width` on * the table itself prevents that compaction; the consumer's `overflow-x: auto` * wrapper then scrolls horizontally instead of squishing columns to zero width. */ computedTableMinWidth: number; private htmlCache; constructor(sanitizer: DomSanitizer, cdr: ChangeDetectorRef); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; private get isXs(); private get isSm(); private get isMd(); private updateVisibleColumns; getHeaderTemplate(colId: string): TemplateRef | null; getCellTemplate(colId: string): TemplateRef | null; getRenderedValue(row: any, column: DynamicTableColumn): any; /** * Checks if the rendered value is a component class or component config */ isComponent(value: any): boolean; /** * Gets the component class from a render value (could be class or config) */ getComponentClass(value: Type | ComponentRenderConfig): Type; /** * Gets component inputs from a render value */ getComponentInputs(value: Type | ComponentRenderConfig): { [key: string]: any; }; /** * Gets component outputs from a render value */ getComponentOutputs(value: Type | ComponentRenderConfig): { [key: string]: (event: any) => void; }; /** * Initializes a component in a ViewContainerRef (called from template) */ initComponent(vcr: ViewContainerRef, renderedValue: Type | ComponentRenderConfig, row: any, column: DynamicTableColumn, rowIndex: number, colId: string): boolean; /** * Checks if the rendered value is an HTML string that should be rendered with innerHTML */ isHtmlString(value: any): boolean; /** * Sanitizes HTML string for safe rendering with caching */ getSanitizedHtml(value: string): SafeHtml; getCellValue(row: any, path?: string): any; trackByIndex(index: number): number; onRowDragStart(row: any): void; onRowDragEnd(): void; /** * Fires continuously while a drag is over a row. Computes whether the cursor * is in the top or bottom half of the row and updates the indicator state. * Suppresses the indicator on the dragged row itself. */ onRowDragOver(event: Event, rowIndex: number): void; /** Clears the indicator when the cursor leaves the tbody entirely. */ onTbodyDragLeave(event: Event): void; private clearDropIndicator; /** * Handles a row drop from ngx-drag-drop. Prefers the tracked dragover position * (which the user can see live via the insertion line) over `event.index` when * computing the final insert slot. Emits a fresh array — does not mutate `data`. */ onRowDndDrop(event: DndDropEvent): void; copyCellJsonPath(path: string, event: Event, source?: string): void; private updateGridTemplate; isRowSelectable(row: any): boolean; get allSelected(): boolean; get someSelected(): boolean; onSelectAllChange(event: Event): void; onRowSelectChange(event: Event, row: any): void; toggleSelectAll(checked: boolean): void; private _sortActive?; private _sortDirection; private updateComputedData; get showTableLoading(): boolean; get showTableDataLoading(): boolean; get isEmpty(): boolean; isSortedAsc(colId: string): boolean; isSortedDesc(colId: string): boolean; toggleSort(col: DynamicTableColumn): void; private compareValues; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }