import * as _tanstack_angular_table from '@tanstack/angular-table';
import { RowData, RowSelectionState, HeaderContext, CellContext, FlexRenderComponent, Row, SortingState, ColumnFiltersState, PaginationState, ExpandedState, ColumnPinningState, RowPinningState, VisibilityState, ColumnOrderState, Column, createAngularTable, Table, ColumnDef } from '@tanstack/angular-table';
import * as _shival99_angular_virtual from '@shival99/angular-virtual';
import * as _shival99_z_ui_components_z_input from '@shival99/z-ui/components/z-input';
import { ZInputSize } from '@shival99/z-ui/components/z-input';
import * as _angular_core from '@angular/core';
import { TemplateRef, Type, AfterViewInit, ElementRef, OnInit } from '@angular/core';
import { CdkDragDrop, CdkDragEnd } from '@angular/cdk/drag-drop';
import { ConnectedPosition } from '@angular/cdk/overlay';
import { ZPopoverDirective } from '@shival99/z-ui/components/z-popover';
import { ClassValue } from 'clsx';
import { NgScrollbar } from 'ngx-scrollbar';
import { ZAutocompleteType, ZAutocompleteOption } from '@shival99/z-ui/components/z-autocomplete';
import { ZButtonVariants } from '@shival99/z-ui/components/z-button';
import { ZIcon, ZIconVariants } from '@shival99/z-ui/components/z-icon';
import { ZSelectOption, ZSelectConfig } from '@shival99/z-ui/components/z-select';
import * as _shival99_z_ui_components_z_tooltip from '@shival99/z-ui/components/z-tooltip';
import { ZTooltipConfig, ZTooltipContent } from '@shival99/z-ui/components/z-tooltip';
import { ZExcelColumnConfig, ZExcelExportOptions } from '@shival99/z-ui/services';
import { ZDateRange } from '@shival99/z-ui/components/z-calendar';
import { ZDropdownMenuItem } from '@shival99/z-ui/components/z-dropdown-menu';

/**
 * Z-Table Type Definitions
 *
 * Central type file for the z-table component. Contains:
 * - Default constants (row heights, sizing, debounce timers)
 * - Column configuration types (header, body, footer)
 * - Sort/filter/edit configuration interfaces
 * - Event contracts for parent-component communication
 * - Unified change event discriminated union
 * - Virtual scrolling configuration
 * - Settings persistence types
 * - TanStack Table module augmentation for custom table meta
 */

/**
 * A virtual group represents one or more consecutive rows that must be
 * rendered together (e.g. rows sharing a rowSpan). The virtualizer operates
 * on groups rather than individual rows to keep merged cells intact.
 */
interface ZVirtualGroup {
    startIndex: number;
    endIndex: number;
    rowCount: number;
    /** null when dynamicSize is enabled — height is measured after render */
    height: number | null;
}
/** Parsed segment from the `[icon:name|size:16|class:text-red]` inline icon syntax */
interface ZTableIconPart {
    type: 'text' | 'icon';
    value: string;
    size?: number;
    class?: string;
    strokeWidth?: number;
}
type ZTableAlign = 'left' | 'center' | 'right';
/**
 * Body cell content — supports static values, Angular templates/components,
 * or a function that receives the cell context and returns dynamic content.
 */
type ZTableCellContent<T> = string | number | TemplateRef<{
    $implicit: CellContext<T, unknown>;
}> | Type<unknown> | FlexRenderComponent<unknown> | ((info: CellContext<T, unknown>) => string | number | TemplateRef<unknown> | FlexRenderComponent<unknown>);
/** Header/footer cell content — similar to body but uses HeaderContext */
type ZTableHeaderContent<T> = string | TemplateRef<unknown> | Type<unknown> | (() => string) | ((info: HeaderContext<T, unknown>) => string);
/** Alias for ZTableColumnConfig — kept for backward compatibility */
type ZTableColumn<T = unknown> = ZTableColumnConfig<T>;
/** Available column filter value input hints */
type ZTableFilterValueType = 'text' | 'number';
type ZTableFilterUi = 'basic' | 'advanced' | 'custom';
type ZTableAdvancedFilterType = 'text' | 'number' | 'range' | 'date' | 'date-range' | 'time' | 'select' | 'multi-select' | 'tags';
type ZTableFilterOptionSource = 'faceted' | 'table';
/** Available column filter operators */
type ZTableFilterOperator = 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'equals' | 'notEquals' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'empty' | 'notEmpty';
type ZTableFilterJoinOperator = 'and' | 'or';
interface ZTableFilterCondition {
    joinWithPrev?: ZTableFilterJoinOperator;
    operator: ZTableFilterOperator;
    value?: unknown;
}
interface ZTableDraftFilterCondition {
    readonly id: string;
    readonly joinWithPrev?: ZTableFilterJoinOperator;
    operator: ZTableFilterOperator | null;
    value?: unknown;
}
interface ZTableFilterConditionView extends ZTableDraftFilterCondition {
    readonly inputType: 'text' | 'number';
    readonly isJoinGroupStart: boolean;
    readonly isValueLess: boolean;
    readonly joinLabelKey: string;
    readonly joinTone: 'and' | 'or';
    readonly operatorOptions: ZSelectOption<ZTableFilterOperator>[];
}
type ZTableLegacyAdvancedFilterType = Exclude<ZTableAdvancedFilterType, 'text' | 'number'>;
/** Available inline cell edit input types */
type ZTableEditType = 'text' | 'number' | 'select' | 'date' | 'checkbox' | 'textarea' | 'toggle' | 'autocomplete';
/**
 * Table operation mode:
 * - 'local': data is fully client-side (sort/filter/paginate handled by TanStack)
 * - 'server': parent handles data fetching; table emits change events for server calls
 */
type ZTableMode = 'local' | 'server';
/** Per-column sort configuration; mode controls local vs server-side sorting */
interface ZTableSortConfig<T> {
    enabled?: boolean;
    /** 'local' = TanStack sorts in-memory; 'server' = emits event for API call */
    mode?: ZTableMode;
    /** Custom key sent with server-side sort events (defaults to column id) */
    sortKey?: string;
    /** Custom comparator for local sorting */
    sortFn?: (rowA: Row<T>, rowB: Row<T>, columnId: string) => number;
}
type ZTableBuiltInFilterFn = 'equalsString' | 'includesString' | 'includesStringSensitive' | 'arrIncludes' | 'arrIncludesAll' | 'arrIncludesSome' | 'equals' | 'weakEquals' | 'inNumberRange';
type ZTableCustomFilterFn<T> = (row: Row<T>, columnId: string, filterValue: unknown, addMeta: (meta: unknown) => void) => boolean;
interface ZTableFilterConfig<T = unknown> {
    enabled?: boolean;
    mode?: ZTableMode;
    valueType?: ZTableFilterValueType;
    ui?: ZTableFilterUi;
    advancedType?: ZTableAdvancedFilterType;
    options?: ZSelectOption[];
    selectConfig?: Partial<ZSelectConfig<unknown>>;
    optionSource?: ZTableFilterOptionSource;
    allowClear?: boolean;
    label?: string;
    placeholder?: string;
    filterFn?: ZTableBuiltInFilterFn | ZTableCustomFilterFn<T>;
    /**
     * @deprecated Dùng `advancedType` thay thế.
     */
    type?: ZTableAdvancedFilterType;
    /**
     * @deprecated Dùng `advancedType` thay thế.
     */
    filterType?: ZTableAdvancedFilterType;
    /**
     * @deprecated Dùng `options` thay thế.
     */
    filterOptions?: ZSelectOption[];
}
type ZTableEditSize = 'sm' | 'default' | 'lg';
interface ZTableEditConfig<T = unknown> {
    enabled?: boolean;
    /** Edit type - can be static or dynamic per row */
    type?: ZTableEditType | ((row: T) => ZTableEditType);
    /** Select options - can be static or dynamic per row */
    options?: ZSelectOption[] | ((row: T) => ZSelectOption[]);
    /** Placeholder - can be static or dynamic per row */
    placeholder?: string | ((row: T) => string);
    /** Allow clear for select input. Default: false */
    allowClear?: boolean;
    /**
     * Custom option label key when using raw objects as options.
     * Use this when your options don't have 'label' property.
     * Example: optionLabelKey: 'tagName' for { tagName: 'Value', tagId: 1 }
     */
    optionLabelKey?: string;
    /**
     * Custom option value key when using raw objects as options.
     * Use this when your options don't have 'value' property.
     * Example: optionValueKey: 'tagName' for { tagName: 'Value', tagId: 1 }
     */
    optionValueKey?: string;
    /**
     * CSS class to apply to the edit cell input/select/etc component
     */
    class?: string | ((row: T) => string);
    style?: Record<string, string> | ((row: T) => Record<string, string>);
    min?: number;
    max?: number;
    step?: number;
    rows?: number;
    thousandSeparator?: string;
    disabled?: boolean | ((row: T) => boolean);
    /** Readonly mode - input is visible but not editable */
    readonly?: boolean | ((row: T) => boolean);
    debounceTime?: number;
    /** Only emit change on blur (when user leaves the input). Default: false */
    blurEdit?: boolean;
    /** Size of the edit input. Default: 'sm' */
    size?: ZTableEditSize;
    /** Autocomplete type - default or addressbar */
    autocompleteType?: ZAutocompleteType;
    /** Autocomplete options - for autocomplete type */
    autocompleteOptions?: ZAutocompleteOption[] | ((row: T) => ZAutocompleteOption[]);
    /** Reset input after selecting an option in autocomplete. Default: false */
    autocompleteResetOnSelect?: boolean;
    /** Height of autocomplete dropdown in pixels. Default: 280 */
    autocompleteHeight?: number;
    /** Allow typing custom values when no options match. Default: false */
    autocompleteAllowCustomValue?: boolean;
}
/**
 * Imperative control handle emitted via `zControl` output.
 * Allows parent components to programmatically manipulate table state
 * (add/update/delete items, reset filters, toggle settings, etc.).
 */
interface ZTableControl<T> {
    updateConfig: (config: Partial<ZTableConfig<T>>) => void;
    toggleSettings: () => void;
    resetFilters: () => void;
    resetSorting: () => void;
    clearSelection: () => void;
    addItem: (item: T) => void;
    updateItem: (id: string | number, updates: Partial<T>, fieldKey?: keyof T) => void;
    deleteItem: (id: string | number, fieldKey?: keyof T) => void;
    getItems: () => T[];
    setColumnVisibility: (columnIds: string | string[], visible: boolean) => void;
}
/** Header cell configuration — applied to the <th> in the table header row */
interface ZTableHeaderColumnConfig<T> {
    content?: ZTableHeaderContent<T>;
    class?: string;
    style?: Record<string, string>;
    align?: ZTableAlign;
    rowSpan?: number;
    colSpan?: number;
    /** Class applied to the inner content wrapper, not the <th> itself */
    contentClass?: string | ((info: HeaderContext<T, unknown>) => string);
    contentStyle?: Record<string, string> | ((info: HeaderContext<T, unknown>) => Record<string, string>);
    tooltip?: string | ZTooltipConfig;
}
/**
 * Body cell configuration — most properties accept a static value or
 * a function receiving CellContext for per-row dynamic behavior.
 */
interface ZTableBodyColumnConfig<T> {
    content?: ZTableCellContent<T>;
    class?: string | ((info: CellContext<T, unknown>) => string);
    style?: Record<string, string> | ((info: CellContext<T, unknown>) => Record<string, string>);
    align?: ZTableAlign;
    /** Static rowSpan or function returning 0 to hide the cell (merged into neighbor) */
    rowSpan?: number | ((info: CellContext<T, unknown>) => number);
    colSpan?: number | ((info: CellContext<T, unknown>) => number);
    contentClass?: string | ((info: CellContext<T, unknown>) => string);
    contentStyle?: Record<string, string> | ((info: CellContext<T, unknown>) => Record<string, string>);
    tooltip?: string | ZTooltipConfig | ((info: CellContext<T, unknown>) => string | ZTooltipConfig);
    /**
     * Action buttons rendered inside this cell.
     *
     * Preferred: pass an action array or `(row) => action[]` directly.
     * Deprecated compatibility: `{ actions, maxVisible }` is still supported.
     */
    actions?: ZTableActionBodyConfig<T>;
    /** Maximum visible action buttons before rendering the overflow menu. */
    actionMaxVisible?: number;
    /** When true, clicking the cell emits a cellClick event */
    enabledClick?: boolean;
    /** Enable inline editing — true uses defaults, or pass full config */
    edit?: ZTableEditConfig<T> | boolean;
    /** Control cell content visibility. When false, the cell is rendered but content is hidden. */
    visible?: boolean | ((info: CellContext<T, unknown>) => boolean);
}
interface ZTableFooterColumnConfig<T> {
    content?: ZTableHeaderContent<T>;
    class?: string;
    style?: Record<string, string>;
    align?: ZTableAlign;
    rowSpan?: number;
    colSpan?: number;
    contentClass?: string | ((info: HeaderContext<T, unknown>) => string);
    contentStyle?: Record<string, string> | ((info: HeaderContext<T, unknown>) => Record<string, string>);
    tooltip?: string | ZTooltipConfig;
}
/**
 * Primary column definition — the consumer-facing API.
 * Converted to TanStack ColumnDef internally via `columnConfigToColumnDef()`.
 *
 * Shorthand: header/body/footer accept either a full config object or
 * just the content directly (string/template/function).
 *
 * Nested columns: use `columns` for multi-level header groups.
 */
interface ZTableColumnConfig<T> {
    /** Unique column identifier — must be stable across re-renders */
    id: string;
    /** Pre-filter visibility — unlike columnVisibility, this removes the column entirely */
    visible?: boolean | (() => boolean);
    /** Object property key for simple accessor — mutually exclusive with accessorFn */
    accessorKey?: keyof T & string;
    /** Custom accessor function for derived/computed cell values */
    accessorFn?: (row: T) => unknown;
    header?: ZTableHeaderColumnConfig<T> | ZTableHeaderContent<T>;
    body?: ZTableBodyColumnConfig<T> | ZTableCellContent<T>;
    footer?: ZTableFooterColumnConfig<T> | ZTableHeaderContent<T>;
    size?: number;
    minSize?: number;
    maxSize?: number;
    width?: string;
    /** true = local sort with defaults; object = full config */
    sort?: ZTableSortConfig<T> | boolean;
    /** true = local filter with defaults; object = full config */
    filter?: ZTableFilterConfig<T> | boolean;
    enableResizing?: boolean;
    enablePinning?: boolean;
    enableHiding?: boolean;
    enableOrdering?: boolean;
    /** Initial pin position — applied on first render */
    pinned?: 'left' | 'right' | false;
    /** Child columns for multi-level header grouping */
    columns?: ZTableColumnConfig<T>[];
}
interface ZTablePaginationConfig {
    enabled?: boolean;
    pageSize?: number;
    pageIndex?: number;
    pageSizeOptions?: number[];
    showSizeChanger?: boolean;
    showQuickJumper?: boolean;
    showTotal?: boolean;
    totalLabel?: string;
    disabled?: boolean;
}
/** Distinguishes user-triggered vs programmatic pagination changes */
type ZTableEmitType = 'user' | 'auto';
interface ZTablePageChangeEvent {
    pageIndex: number;
    pageSize: number;
    emitType: ZTableEmitType;
}
interface ZTableRowSelectEvent<T> {
    row: T;
    rowId: string;
    selected: boolean;
    selectedRows: T[];
    selectedRowIds: string[];
}
interface ZTableRowSelectAllEvent<T> {
    selected: boolean;
    selectedRows: T[];
    selectedRowIds: string[];
}
interface ZTableRowExpandEvent<T> {
    row: T;
    rowId: string;
    expanded: boolean;
}
interface ZTableCellClickEvent<T> {
    row: T;
    rowId: string;
    columnId: string;
    value: unknown;
}
interface ZTableCellEditEvent<T> {
    row: T;
    rowId: string;
    rowIndex: number;
    columnId: string;
    oldValue: unknown;
    newValue: unknown;
}
interface ZTableRowDragEvent<T> {
    row: T;
    rowId: string;
    previousIndex: number;
    currentIndex: number;
    data: T[];
}
interface ZTableSortChangeEvent {
    sorting: SortingState;
}
interface ZTableFilterChangeEvent {
    filters: ColumnFiltersState;
    search: string;
}
interface ZTableSearchChangeEvent {
    search: string;
    filters: ColumnFiltersState;
    sorting: SortingState;
    pagination: PaginationState;
}
interface ZActionTooltipState {
    content: ZTooltipContent;
    alwaysShow: boolean;
    position?: string;
    arrow?: boolean;
    offset?: number;
    maxWidth?: string;
}
interface ZTableActionItem<T = unknown> {
    key: string;
    label?: string;
    icon?: ZIcon;
    iconSize?: ZIconVariants['zSize'];
    tooltip?: string | ZTooltipConfig;
    type?: ZButtonVariants['zType'];
    size?: ZButtonVariants['zSize'];
    class?: string;
    disabled?: boolean | ((row: T) => boolean);
    hidden?: boolean | ((row: T) => boolean);
    divide?: 'before' | 'after';
}
type ZTableActionList<T = unknown> = ZTableActionItem<T>[] | ((row: T) => ZTableActionItem<T>[]);
interface ZTableActionClickEvent<T = unknown> {
    key: string;
    row: T;
    rowId: string;
    action: ZTableActionItem<T>;
}
interface ZTableBulkActionContext<T = unknown> {
    selectedRows: T[];
    selectedRowIds: string[];
    selection: RowSelectionState;
}
interface ZTableBulkActionHandlerContext<T = unknown> extends ZTableBulkActionContext<T> {
    exportExcel: (config: ZTableExcelExportConfig<T>) => Promise<void>;
}
interface ZTableBulkActionItem<T = unknown> extends Omit<ZTableActionItem<ZTableBulkActionContext<T>>, 'disabled' | 'hidden'> {
    disabled?: boolean | ((context: ZTableBulkActionContext<T>) => boolean);
    hidden?: boolean | ((context: ZTableBulkActionContext<T>) => boolean);
    handler?: (context: ZTableBulkActionHandlerContext<T>) => void | false | Promise<void | false>;
}
interface ZTableBulkActionViewItem<T = unknown> {
    action: ZTableBulkActionItem<T>;
    disabled: boolean;
}
type ZTableBulkActionList<T = unknown> = ZTableBulkActionItem<T>[] | ((context: ZTableBulkActionContext<T>) => ZTableBulkActionItem<T>[]);
interface ZTableBulkActionOptions<T = unknown> {
    enabled?: boolean;
    /** Custom actions rendered when rows are selected. */
    actions?: ZTableBulkActionList<T>;
    maxVisible?: number;
    selectedLabel?: string;
    clearLabel?: string;
}
type ZTableBulkActionConfig<T = unknown> = ZTableBulkActionOptions<T> | ZTableBulkActionList<T>;
interface ZTableBulkActionClickEvent<T = unknown> extends ZTableBulkActionContext<T> {
    key: string;
    action: ZTableBulkActionItem<T>;
}
type ZTableExcelExportScope = 'selected' | 'filtered' | 'all';
interface ZTableExcelExportContext<T = unknown> extends ZTableBulkActionContext<T> {
    data: T[];
    columns: ZTableColumnConfig<T>[];
}
interface ZTableExcelExportConfig<T = unknown> {
    enabled?: boolean;
    /** Built-in action key. Use the same key in bulkAction to override the button. */
    actionKey?: string;
    actionLabel?: string;
    actionIcon?: ZIcon;
    actionIconSize?: string;
    fileName?: string | ((context: ZTableExcelExportContext<T>) => string);
    sheetName?: string;
    /** Shortcut for `scope: 'all'`. */
    exportAll?: boolean;
    scope?: ZTableExcelExportScope;
    excludeColumns?: string[];
    excelOverrides?: Partial<Record<string, Partial<ZExcelColumnConfig<T>>>>;
    headerResolver?: (col: ZTableColumnConfig<T>) => string;
    options?: ZExcelExportOptions;
}
/**
 * @deprecated Use `ZTableBodyColumnConfig.actions` directly with an action array
 * or `(row) => action[]`, and set `actionMaxVisible` on the body config when needed.
 */
interface ZTableActionColumnConfig<T = unknown> {
    /**
     * @deprecated Put the action array/function directly in `body.actions` instead.
     */
    actions: ZTableActionList<T>;
    maxVisible?: number;
}
type ZTableActionBodyConfig<T = unknown> = ZTableActionColumnConfig<T> | (ZTableActionList<T> & Partial<ZTableActionColumnConfig<T>>);
/** All possible change event types — used as discriminant in ZTableChangeEvent */
type ZTableChangeType = 'page' | 'sort' | 'filter' | 'search' | 'select' | 'expand' | 'rowSelect' | 'rowSelectAll' | 'rowExpand' | 'rowDrag' | 'cellClick' | 'cellEdit' | 'action' | 'bulkAction';
interface ZTableChangeEventBase {
    type: ZTableChangeType;
}
interface ZTablePageChange extends ZTableChangeEventBase {
    type: 'page';
    data: ZTablePageChangeEvent;
}
interface ZTableSortChange extends ZTableChangeEventBase {
    type: 'sort';
    data: ZTableSortChangeEvent;
}
interface ZTableFilterChange extends ZTableChangeEventBase {
    type: 'filter';
    data: ZTableFilterChangeEvent;
}
interface ZTableRowSelectChange<T> extends ZTableChangeEventBase {
    type: 'rowSelect';
    data: ZTableRowSelectEvent<T>;
}
interface ZTableRowSelectAllChange<T> extends ZTableChangeEventBase {
    type: 'rowSelectAll';
    data: ZTableRowSelectAllEvent<T>;
}
interface ZTableRowExpandChange<T> extends ZTableChangeEventBase {
    type: 'rowExpand';
    data: ZTableRowExpandEvent<T>;
}
interface ZTableRowDragChange<T> extends ZTableChangeEventBase {
    type: 'rowDrag';
    data: ZTableRowDragEvent<T>;
}
interface ZTableCellClickChange<T> extends ZTableChangeEventBase {
    type: 'cellClick';
    data: ZTableCellClickEvent<T>;
}
interface ZTableSearchChange extends ZTableChangeEventBase {
    type: 'search';
    data: ZTableSearchChangeEvent;
}
interface ZTableSelectChange extends ZTableChangeEventBase {
    type: 'select';
    data: {
        selection: RowSelectionState;
    };
}
interface ZTableExpandChange extends ZTableChangeEventBase {
    type: 'expand';
    data: {
        expanded: ExpandedState;
    };
}
interface ZTableActionChange<T> extends ZTableChangeEventBase {
    type: 'action';
    data: ZTableActionClickEvent<T>;
}
interface ZTableBulkActionChange<T> extends ZTableChangeEventBase {
    type: 'bulkAction';
    data: ZTableBulkActionClickEvent<T>;
}
interface ZTableCellEditChange<T> extends ZTableChangeEventBase {
    type: 'cellEdit';
    data: ZTableCellEditEvent<T>;
}
/**
 * Unified change event emitted via `zChange` output.
 * Parent components can use `event.type` to narrow the discriminated union.
 *
 * Example:
 * ```ts
 * onTableChange(event: ZTableChangeEvent<MyRow>) {
 *   if (event.type === 'page') {
 *     // event.data is ZTablePageChangeEvent
 *   }
 * }
 * ```
 */
type ZTableChangeEvent<T> = ZTablePageChange | ZTableSortChange | ZTableFilterChange | ZTableSearchChange | ZTableSelectChange | ZTableExpandChange | ZTableRowSelectChange<T> | ZTableRowSelectAllChange<T> | ZTableRowExpandChange<T> | ZTableRowDragChange<T> | ZTableCellClickChange<T> | ZTableCellEditChange<T> | ZTableActionChange<T> | ZTableBulkActionChange<T>;
/** Initial table state — applied on first render, before any cached config is loaded */
interface ZTableInitialState {
    columnPinning?: ColumnPinningState;
    rowPinning?: RowPinningState;
    sorting?: SortingState;
    columnFilters?: ColumnFiltersState;
    globalFilter?: string;
    expanded?: ExpandedState;
    rowSelection?: RowSelectionState;
    columnVisibility?: VisibilityState;
    pagination?: PaginationState;
}
interface ZTableVirtualConfig {
    /** Enable virtual scrolling */
    enabled: boolean;
    /** Row height in pixels (default: 40). Used as estimate for dynamic sizing. */
    size?: number;
    /** Number of items to render outside visible area (default: 5) */
    overscan?: number;
    /** Number of rows per virtual group (default: 1) */
    groupSize?: number;
    /**
     * Enable dynamic row height measurement.
     * When true, each row's height is measured dynamically after render.
     * The virtualizer uses `height: auto` for all rows, allowing content
     * to determine the actual height, which is then captured via measureElement().
     * The `size` property is used as an initial estimate before measurement.
     */
    dynamicSize?: boolean;
    /**
     * Initial scroll offset in pixels.
     * Useful for restoring scroll position or starting at a specific offset.
     * @default 0
     */
    initialOffset?: number | (() => number);
    /**
     * The margin (in pixels) to apply to the start of the virtualizer.
     * Useful when the virtualizer is not at the top of the scroll container.
     * @default 0
     */
    scrollMargin?: number;
    /**
     * Gap between items in pixels.
     * Use this instead of CSS gap for proper virtual scroll calculations.
     * @default 0
     */
    gap?: number;
    /**
     * Delay in milliseconds before resetting isScrolling state.
     * @default 150
     */
    isScrollingResetDelay?: number;
    /**
     * Use native scrollend event instead of debounced scroll detection.
     * Better performance on browsers that support it.
     * @default true (if browser supports it)
     */
    useScrollendEvent?: boolean;
    /**
     * Custom function to generate unique keys for each item.
     * Useful for stable item identity across data updates.
     */
    getItemKey?: (index: number) => string | number;
    /**
     * Custom range extractor function.
     * Use to customize which items are rendered (e.g., for sticky headers).
     */
    rangeExtractor?: (range: {
        startIndex: number;
        endIndex: number;
    }) => number[];
}
interface ZTableSearchConfig {
    enabled?: boolean;
    placeholder?: string;
    debounceTime?: number;
    width?: string;
    size?: ZInputSize;
}
interface ZTableVirtualColumnConfig {
    /** Enable horizontal column virtualization for center columns only */
    enabled: boolean;
    /** Number of columns to render outside the visible range */
    overscan?: number;
}
/**
 * Top-level configuration passed via `[zConfig]` input.
 * This is the primary API surface for consumers of z-table.
 */
interface ZTableConfig<T> {
    /** 'local' = client-side operations; 'server' = parent handles data fetching */
    mode?: ZTableMode;
    /** Row data array — for server mode, this is the current page's data */
    data: T[];
    /** Enables drag-and-drop row reordering for compatible local-table states */
    enableRowDragging?: boolean;
    /** Total row count for server-side pagination (aliased as totalRows) */
    totalCount?: number;
    /** Column definitions */
    columns: ZTableColumnConfig<T>[];
    /** Custom row ID generator — critical for selection/expansion state stability */
    getRowId?: (row: T, index: number, parent: T | undefined, data: T[]) => string;
    /** Sub-row accessor for tree/hierarchical data */
    getSubRows?: (row: T, index: number, parent: T | undefined, data: T[]) => T[] | undefined;
    /** @deprecated Use totalCount instead */
    totalRows?: number;
    /** true = enable with defaults; object = full virtual scroll config */
    virtual?: ZTableVirtualConfig | boolean;
    /** true = enable with defaults; object = full horizontal column virtualization config */
    virtualColumns?: ZTableVirtualColumnConfig | boolean;
    showHorizontalBorder?: boolean;
    showVerticalBorder?: boolean;
    showHeaderShadow?: boolean;
    showFooterShadow?: boolean;
    /** Show the settings drawer toggle button */
    enableSettings?: boolean;
    enableColumnResizing?: boolean;
    /** When true, shift-click sorting is simulated automatically */
    enableMultiSort?: boolean;
    /** true = enable with defaults; object = full search bar config */
    search?: ZTableSearchConfig | boolean;
    /** Floating bulk action bar shown when rows are selected */
    bulkAction?: ZTableBulkActionConfig<T> | boolean;
    enableRowPinning?: boolean;
    enableColumnPinning?: boolean;
    enableColumnOrdering?: boolean;
    enableColumnSorting?: boolean;
    pagination?: ZTablePaginationConfig;
    initialState?: ZTableInitialState;
    loading?: boolean;
    /** Template rendered when a row is expanded */
    expandedRowTemplate?: TemplateRef<{
        $implicit: Row<T>;
    }>;
    /** Template rendered when no data matches */
    emptyTemplate?: TemplateRef<void>;
    /** Template rendered during loading state */
    loadingTemplate?: TemplateRef<void>;
    getRowCanExpand?: (row: Row<T>) => boolean;
    /** Fixed table width. Defaults to the available width of the parent container. */
    width?: string;
    /** Fixed table height. Keeps the horizontal scrollbar at the bottom when the table has few rows. */
    height?: string;
    maxHeight?: string;
    minHeight?: string;
    /** Debounce time (ms) for async state updates; defaults to Z_DEFAULT_DEBOUNCE_TIME */
    debounceTime?: number;
    /** Use skeleton rows instead of loading spinner */
    useSkeleton?: boolean;
}
interface ZTableEditCellChangeEvent<T = unknown> {
    row: T;
    rowId: string;
    rowIndex: number;
    columnId: string;
    oldValue: unknown;
    newValue: unknown;
}
interface ZResolvedEditConfig {
    type: ZTableEditType;
    size: ZTableEditSize;
    placeholder: string;
    allowClear: boolean;
    class: string;
    style: Record<string, string>;
    disabled: boolean;
    readonly: boolean;
}
/**
 * Extends TanStack's TableMeta to add a custom `updateData` callback.
 * This is used by inline edit cells to notify the table of value changes.
 */
declare module '@tanstack/angular-table' {
    interface TableMeta<TData extends RowData> {
        updateData?: (rowIndex: number, columnId: string, value: unknown) => void;
    }
}

declare class ZTableComponent<T> implements AfterViewInit {
    /** Unified change event — parent listens to this for all table interactions */
    readonly zChange: _angular_core.OutputEmitterRef<ZTableChangeEvent<T>>;
    /** Emits an imperative control handle for programmatic table manipulation */
    readonly zControl: _angular_core.OutputEmitterRef<ZTableControl<T>>;
    /** Extra CSS classes merged onto the table container */
    readonly zClass: _angular_core.InputSignal<ClassValue>;
    /** Main configuration — data, columns, mode, features */
    readonly zConfig: _angular_core.InputSignal<ZTableConfig<T>>;
    /** External loading state (complementary to config.loading) */
    readonly zLoading: _angular_core.InputSignal<boolean>;
    /** Cache key for persisting column settings; no persistence when empty */
    readonly zKey: _angular_core.InputSignal<string>;
    /** Visual variant: 'default' has card shadow, 'borderless' has no container border */
    readonly zVariant: _angular_core.InputSignal<"default" | "borderless">;
    private readonly _destroy$;
    private readonly _zExcel;
    private readonly _zTranslate;
    /** Prevents recursive scroll sync between thead/tbody/tfoot */
    private readonly _isSyncingScroll;
    /** Preserves horizontal scroll position across loading states */
    private readonly _savedScrollLeft;
    /** Observes tbody container height changes for skeleton row count calculation */
    private _resizeObserver;
    /** Debounces rapid settings changes (visibility/pin toggles) */
    private _settingsDebounceTimeout;
    /** Debounces filter change emissions to server */
    private _filterEmitDebounceTimeout;
    /** Keeps the bulk bar mounted long enough for its exit animation */
    private _bulkBarTimer;
    private readonly _activeColumnVisibilityPopover;
    /** Merged loading state from both zLoading input and config.loading */
    protected readonly isLoading: _angular_core.Signal<boolean>;
    /** True during debounced async state transitions (sort/filter processing) */
    protected readonly isProcessing: _angular_core.WritableSignal<boolean>;
    protected readonly isDraggingRow: _angular_core.WritableSignal<boolean>;
    protected readonly theadWrapper: _angular_core.Signal<ElementRef<HTMLDivElement> | undefined>;
    protected readonly tbodyContainer: _angular_core.Signal<ElementRef<HTMLDivElement> | undefined>;
    protected readonly tbodyWrapper: _angular_core.Signal<ElementRef<HTMLDivElement> | undefined>;
    protected readonly tbodyScrollbar: _angular_core.Signal<NgScrollbar | undefined>;
    protected readonly tfootWrapper: _angular_core.Signal<ElementRef<HTMLDivElement> | undefined>;
    protected readonly expandedRowTemplate: _angular_core.Signal<TemplateRef<unknown> | undefined>;
    protected readonly virtualRowElements: _angular_core.Signal<readonly ElementRef<HTMLDivElement>[]>;
    protected readonly columnPinning: _angular_core.WritableSignal<ColumnPinningState>;
    protected readonly columnVisibility: _angular_core.WritableSignal<VisibilityState>;
    protected readonly columnOrder: _angular_core.WritableSignal<ColumnOrderState>;
    protected readonly expanded: _angular_core.WritableSignal<ExpandedState>;
    protected readonly rowSelection: _angular_core.WritableSignal<RowSelectionState>;
    protected readonly rowPinning: _angular_core.WritableSignal<RowPinningState>;
    protected readonly columnFilters: _angular_core.WritableSignal<ColumnFiltersState>;
    protected readonly globalFilter: _angular_core.WritableSignal<string>;
    /** Note: pageIndex is 1-based here; converted to 0-based for TanStack via _tanstackPagination */
    protected readonly pagination: _angular_core.WritableSignal<PaginationState>;
    protected readonly sorting: _angular_core.WritableSignal<SortingState>;
    /**
     * Caches the last server-provided total to avoid flickering to 0
     * during loading transitions in server-side pagination mode.
     */
    private readonly _serverPaginationTotal;
    /** Container CSS classes combining variant + user-provided classes */
    protected readonly classTable: _angular_core.Signal<string>;
    /** Convert 1-based pagination to TanStack's 0-based pageIndex */
    private readonly _tanstackPagination;
    private readonly _configPagination;
    protected readonly paginationTotal: _angular_core.Signal<number>;
    protected readonly hasVerticalScroll: _angular_core.WritableSignal<boolean>;
    protected readonly hasHorizontalScroll: _angular_core.WritableSignal<boolean>;
    /** True when the last row touches or extends past the container bottom (no gap) */
    protected readonly lastRowTouchesBottom: _angular_core.WritableSignal<boolean>;
    protected readonly showSettingsDrawer: _angular_core.WritableSignal<boolean>;
    protected readonly showHorizontalBorder: _angular_core.WritableSignal<boolean>;
    protected readonly showVerticalBorder: _angular_core.WritableSignal<boolean>;
    protected readonly showHeaderFooterShadow: _angular_core.WritableSignal<boolean>;
    protected readonly bulkBarMounted: _angular_core.WritableSignal<boolean>;
    protected readonly bulkBarClosing: _angular_core.WritableSignal<boolean>;
    protected readonly bulkBarConfig: _angular_core.WritableSignal<ZTableBulkActionOptions<T> | null>;
    protected readonly bulkBarContext: _angular_core.WritableSignal<ZTableBulkActionContext<T> | null>;
    protected readonly bulkBarItems: _angular_core.WritableSignal<ZTableBulkActionViewItem<T>[]>;
    /** True when table body is scrolled away from left edge (shows left pin shadow) */
    protected readonly hasScrollLeft: _angular_core.WritableSignal<boolean>;
    /** True when table has right-pinned columns and body isn't scrolled to the end */
    protected readonly hasScrollRight: _angular_core.WritableSignal<boolean>;
    /** Maps row IDs to measured DOM heights for pinned row offset calculations */
    protected readonly pinnedRowHeights: _angular_core.WritableSignal<Record<string, number>>;
    protected readonly defaultBulkActions: _angular_core.Signal<ZTableBulkActionItem<T>[]>;
    /** Bumped to force recomputation of pinned column IDs after programmatic pin changes */
    private readonly _columnPinVersion;
    /** Bumped to trigger data refresh (e.g., after addItem/deleteItem via control API) */
    private readonly _dataForceUpdate;
    /** Stores a temporary locally reordered dataset until parent pushes a new data reference */
    private readonly _rowDragDataOverride;
    /** Tracks the latest external data array reference to detect parent-driven refreshes */
    private _lastExternalDataRef;
    /** Set when a single row is updated via control API (for targeted re-render) */
    protected readonly _rowUpdate: _angular_core.WritableSignal<{
        rowId: string;
        updates: Record<string, unknown>;
    } | null>;
    /**
     * Column config lookup cache — cleared when column reference changes.
     * Avoids repeated recursive searches during render cycles.
     */
    private _columnConfigCache;
    private _lastColumnsRef;
    protected readonly pinnedColumnIds: _angular_core.Signal<string[]>;
    protected readonly pendingVisibleColumns: _angular_core.WritableSignal<string[]>;
    protected readonly pendingColumnOrder: _angular_core.WritableSignal<string[]>;
    protected readonly pendingShowHeaderFooterShadow: _angular_core.WritableSignal<boolean>;
    /** True if ANY body column uses rowSpan — affects virtual grouping and expand column behavior */
    protected readonly hasBodyRowSpan: _angular_core.Signal<boolean>;
    protected readonly hasSelectColumn: _angular_core.Signal<boolean>;
    protected readonly hasExpandColumn: _angular_core.Signal<boolean>;
    protected readonly hasRowDragColumn: _angular_core.Signal<boolean>;
    protected readonly canUseRowDrag: _angular_core.Signal<boolean>;
    protected readonly isVirtualRowDragEnabled: _angular_core.Signal<boolean>;
    protected readonly isRowDragEnabled: _angular_core.Signal<boolean>;
    protected readonly actionColumnInfo: _angular_core.Signal<{
        columnId: string;
        config: ZTableActionColumnConfig<T>;
        width: number;
    } | null>;
    protected readonly hasActionColumn: _angular_core.Signal<boolean>;
    protected readonly hasFiltering: _angular_core.Signal<boolean>;
    protected readonly hasLocalFiltering: _angular_core.Signal<boolean>;
    protected readonly hasSorting: _angular_core.Signal<boolean>;
    protected readonly hasLocalSorting: _angular_core.Signal<boolean>;
    protected readonly hasServerFiltering: _angular_core.Signal<boolean>;
    protected readonly hasServerSorting: _angular_core.Signal<boolean>;
    protected readonly searchConfig: _angular_core.Signal<{
        enabled: boolean;
        placeholder: string;
        debounceTime: number;
        width: string;
        size: _shival99_z_ui_components_z_input.ZInputSize;
    } | null>;
    protected readonly isSearchEnabled: _angular_core.Signal<boolean>;
    /** Data signal with force-update support for control API mutations */
    private readonly _data;
    /**
     * Converts ZTableColumnConfig[] into TanStack ColumnDef[].
     * Handles special columns (select, expand, actionRowPin), action column sizing,
     * and rowSpan/expand compatibility (expand column is removed when rowSpan is used).
     */
    private readonly _columns;
    protected readonly isVirtual: _angular_core.Signal<boolean>;
    /** Normalized virtual config with defaults applied */
    private readonly _virtualConfig;
    protected readonly virtualRowHeight: _angular_core.Signal<number>;
    protected readonly dynamicSize: _angular_core.Signal<boolean>;
    private readonly _virtualColumnsConfig;
    protected readonly groupSize: _angular_core.Signal<number>;
    protected readonly groupHeight: _angular_core.Signal<number>;
    private readonly _dynamicGroupsVersion;
    /**
     * Groups rows for virtual scrolling. When rowSpan is used, rows that share
     * a merged cell are grouped together so the virtualizer treats them as
     * a single unit, preserving the visual merge across scroll boundaries.
     */
    protected readonly dynamicGroups: _angular_core.Signal<ZVirtualGroup[]>;
    protected readonly hasFooter: _angular_core.Signal<boolean>;
    protected readonly isEmpty: _angular_core.Signal<boolean>;
    protected readonly isEmptyData: _angular_core.Signal<boolean>;
    protected readonly isNoSearchResults: _angular_core.Signal<boolean>;
    protected readonly leftLeafColumns: _angular_core.Signal<Column<T, unknown>[]>;
    protected readonly centerLeafColumns: _angular_core.Signal<Column<T, unknown>[]>;
    protected readonly rightLeafColumns: _angular_core.Signal<Column<T, unknown>[]>;
    protected readonly hasComplexColumnLayout: _angular_core.Signal<boolean>;
    protected readonly canUseVirtualColumns: _angular_core.Signal<boolean>;
    protected readonly columnVirtualizer: _shival99_angular_virtual.AngularVirtualizer<HTMLDivElement, Element>;
    protected readonly virtualCenterColumnItems: _angular_core.Signal<_shival99_angular_virtual.VirtualItem[]>;
    protected readonly virtualCenterColumns: _angular_core.Signal<Column<T, unknown>[]>;
    protected readonly virtualCenterColumnVisibilityMap: _angular_core.Signal<Record<string, boolean>>;
    protected readonly firstVirtualCenterColumnId: _angular_core.Signal<string>;
    protected readonly lastVirtualCenterColumnId: _angular_core.Signal<string>;
    protected readonly virtualLeftSpacerWidth: _angular_core.Signal<number>;
    protected readonly virtualCenterTotalWidth: _angular_core.Signal<number>;
    protected readonly virtualRightSpacerWidth: _angular_core.Signal<number>;
    protected readonly renderedColumnCount: _angular_core.Signal<number>;
    protected readonly orderedLeafColumns: _angular_core.Signal<Column<T, unknown>[]>;
    protected readonly hideableColumns: _angular_core.Signal<Column<T, unknown>[]>;
    protected readonly orderedHeaderGroups: _angular_core.Signal<{
        id: string;
        headers: _tanstack_angular_table.Header<T, unknown>[];
    }[]>;
    protected readonly orderedFooterGroups: _angular_core.Signal<{
        id: string;
        depth: number;
        headers: _tanstack_angular_table.Header<T, unknown>[];
    }[]>;
    protected readonly bottomRowsReversed: _angular_core.Signal<Row<T>[]>;
    protected readonly leftHeaderRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly centerHeaderRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly rightHeaderRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly leftFooterRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly centerFooterRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly rightFooterRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly virtualCenterHeaderRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly virtualCenterFooterRow: _angular_core.Signal<_tanstack_angular_table.Header<T, unknown>[]>;
    protected readonly totalWidth: _angular_core.Signal<number>;
    protected readonly shouldHeaderShowShadow: _angular_core.Signal<boolean>;
    protected readonly shouldFooterShowShadow: _angular_core.Signal<boolean>;
    protected readonly tbodyContainerHeight: _angular_core.WritableSignal<number>;
    protected readonly skeletonRowHeight: _angular_core.WritableSignal<number>;
    protected readonly skeletonRowCount: _angular_core.Signal<number>;
    protected readonly actualSkeletonRowHeight: _angular_core.Signal<number>;
    protected readonly skeletonRows: _angular_core.Signal<number[]>;
    protected readonly dynamicGroupRows: _angular_core.Signal<Row<T>[][]>;
    protected readonly dynamicGroupHeights: _angular_core.Signal<any[]>;
    protected readonly columnSizing: _angular_core.Signal<_tanstack_angular_table.ColumnSizingState>;
    protected readonly columnSizingInfo: _angular_core.Signal<_tanstack_angular_table.ColumnSizingInfoState>;
    protected readonly columnSizeVars: _angular_core.Signal<Record<string, number>>;
    protected readonly table: ReturnType<typeof createAngularTable<T>>;
    private readonly _virtualGroupCount;
    protected readonly selectedRowIds: _angular_core.Signal<string[]>;
    protected readonly selectedRows: _angular_core.Signal<T[]>;
    protected readonly bulkActionContext: _angular_core.Signal<ZTableBulkActionContext<T>>;
    protected readonly bulkActionConfig: _angular_core.Signal<ZTableBulkActionOptions<T> | null>;
    protected readonly bulkActionItems: _angular_core.Signal<{
        action: ZTableBulkActionItem<T>;
        disabled: boolean;
    }[]>;
    protected readonly showBulkBar: _angular_core.Signal<boolean>;
    protected readonly bulkBarPositions: ConnectedPosition[];
    private readonly _bulkBarExitDuration;
    /** Virtualizer instance — operates on groups rather than individual rows */
    protected readonly virtualizer: _shival99_angular_virtual.AngularVirtualizer<HTMLDivElement, Element>;
    private readonly _measureVirtualItems;
    constructor();
    ngAfterViewInit(): void;
    /**
     * Syncs parent row selection state based on children.
     * If all children are selected, the parent is auto-selected;
     * if no children are selected, the parent is deselected.
     */
    private _handleRowSelectionWithParents;
    protected clearSelection(): void;
    protected onBulkActionClick(item: ZTableBulkActionItem<T>): Promise<void>;
    private _resolveBulkActionList;
    private _createBulkActionHandlerContext;
    private _exportSelectionToExcel;
    private _createExcelExportContext;
    private _getExcelExportData;
    private _getExcelExportFileName;
    private _toExcelTableColumns;
    private _getExcelColumnHeader;
    private _getExcelColumnHeaderAlign;
    private _clearBulkBarTimer;
    /**
     * Wraps state mutations with a debounced processing indicator.
     * Shows a brief loading state to prevent UI flicker during
     * filter/sort recomputation on large datasets.
     */
    private _runAsyncStateUpdate;
    private _emitFilterChangeDebounced;
    private _checkScrollState;
    private _refreshPinnedRowHeights;
    private _checkVerticalScroll;
    private _checkLastRowTouchesBottom;
    private _checkHorizontalScroll;
    private _updateScrollShadowState;
    hasRightPinnedColumns(): boolean;
    onTbodyScroll(event: Event): void;
    private _syncScrollLeft;
    /**
     * @deprecated Header sort now lives in the column filter popover.
     * Giữ tạm để các consumer/template cũ còn compile trong giai đoạn chuyển đổi.
     */
    handleSort(event: Event, handler?: (event: unknown) => void): void;
    onColumnDrop(event: CdkDragDrop<string[]>): void;
    onRowDragStarted(): void;
    onRowDragEnded(_event: CdkDragEnd<Row<T>>): void;
    onRowDrop(event: CdkDragDrop<Row<T>[]>): void;
    private _resolveRowDragDropIndex;
    onToggleAllColumns(): void;
    onPageChange(event: {
        pageIndex: number;
        pageSize: number;
    }, emitType?: 'user' | 'auto'): void;
    onSearchChange(value: string | number | null): void;
    toggleHeaderFooterShadow(): void;
    onActionClick(event: ZTableActionClickEvent<T>): void;
    onCellClick(row: Row<T>, columnId: string, value: unknown): void;
    onCellEdit(event: ZTableEditCellChangeEvent<T>): void;
    openSettingsDrawer(): void;
    onPendingColumnDrop(event: CdkDragDrop<string[]>): void;
    onVisibleColumnsChange(values: (string | number)[]): void;
    onToggleColumnVisibility(columnId: string): void;
    onToggleColumnPin(columnId: string, position: 'left' | 'right'): void;
    handleColumnPin(columnId: string, position: 'left' | 'right' | false): void;
    toggleColumnVisibility(columnId: string): void;
    refreshColumnPopoverPositions(...popovers: ZPopoverDirective[]): void;
    setActiveColumnVisibilityPopover(popover: ZPopoverDirective): void;
    clearActiveColumnVisibilityPopover(popover: ZPopoverDirective): void;
    hideActiveColumnVisibilityPopover(): void;
    hideColumnPopoversOnOutsideClick(optionsPopover: ZPopoverDirective): void;
    openSettingsDrawerFromColumnMenu(...popovers: ZPopoverDirective[]): void;
    private _isColumnHiddenFromVisibilityMenu;
    moveColumnLeft(columnId: string): void;
    moveColumnRight(columnId: string): void;
    isFirstMovableColumn(columnId: string): boolean;
    isLastMovableColumn(columnId: string): boolean;
    /** Saves current column layout, sizing, pinning, and visibility to ZCacheService */
    private _saveConfig;
    private _collectColumnInfo;
    /** Loads cached config from ZCacheService; validates schema compatibility first */
    private _loadConfigCache;
    /**
     * Validates cached column info against current config.
     * Returns false if columns have been added/removed/renamed since cache was saved,
     * which triggers cache invalidation.
     */
    private _isColumnConfigValid;
    private _getChangedFilterColumnIds;
    private _getChangedSortColumnIds;
    private _isColumnFilterModeLocal;
    private _isColumnSortModeLocal;
    private _filterServerModeColumnFilters;
    private _filterServerModeSorting;
    private _getActionColumnConfig;
    /**
     * Recursively finds a column config by ID with caching.
     * Cache is invalidated when the column array reference changes.
     */
    private _findColumnConfig;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZTableComponent<any>, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZTableComponent<any>, "z-table", ["zTable"], { "zClass": { "alias": "zClass"; "required": false; "isSignal": true; }; "zConfig": { "alias": "zConfig"; "required": false; "isSignal": true; }; "zLoading": { "alias": "zLoading"; "required": false; "isSignal": true; }; "zKey": { "alias": "zKey"; "required": false; "isSignal": true; }; "zVariant": { "alias": "zVariant"; "required": false; "isSignal": true; }; }, { "zChange": "zChange"; "zControl": "zControl"; }, never, never, true, never>;
}

declare class ZTableFilterComponent<T> {
    readonly zColumn: _angular_core.InputSignal<Column<unknown, unknown>>;
    readonly zTable: _angular_core.InputSignal<Table<T>>;
    private readonly _columnDef;
    private readonly _appliedFilterConditions;
    private readonly _appliedLegacyFilterValue;
    private readonly _appliedSortState;
    protected readonly sortOptions: _angular_core.Signal<ZSelectOption<string>[]>;
    protected readonly draftFilters: _angular_core.WritableSignal<ZTableDraftFilterCondition[]>;
    protected readonly draftLegacyFilterValue: _angular_core.WritableSignal<unknown>;
    protected readonly draftSortState: _angular_core.WritableSignal<false | "asc" | "desc">;
    protected readonly columnFilterValue: _angular_core.Signal<unknown>;
    protected readonly effectiveFilterValue: _angular_core.Signal<unknown>;
    protected readonly sortState: _angular_core.Signal<false | _tanstack_angular_table.SortDirection>;
    protected readonly effectiveSortState: _angular_core.Signal<false | _tanstack_angular_table.SortDirection>;
    protected readonly canSort: _angular_core.Signal<boolean>;
    protected readonly canFilter: _angular_core.Signal<boolean>;
    protected readonly filterUi: _angular_core.Signal<ZTableFilterUi>;
    protected readonly advancedType: _angular_core.Signal<ZTableAdvancedFilterType>;
    protected readonly isAdvancedUi: _angular_core.Signal<boolean>;
    protected readonly isBuilderMode: _angular_core.Signal<boolean>;
    protected readonly legacyAdvancedType: _angular_core.Signal<ZTableLegacyAdvancedFilterType>;
    protected readonly popoverContentClass: _angular_core.Signal<string>;
    protected readonly popoverWidth: _angular_core.Signal<number>;
    protected readonly sortLabelKey: _angular_core.Signal<string>;
    protected readonly legacyFilterLabelKey: _angular_core.Signal<string>;
    protected readonly filterConditions: _angular_core.Signal<ZTableFilterCondition[]>;
    protected readonly filterConditionViews: _angular_core.Signal<ZTableFilterConditionView[]>;
    protected readonly canAddFilterCondition: _angular_core.Signal<boolean>;
    protected readonly filterBadgeCount: _angular_core.Signal<number>;
    protected readonly hasFilterValue: _angular_core.Signal<boolean>;
    protected readonly isActive: _angular_core.Signal<boolean>;
    protected readonly draftSortValue: _angular_core.Signal<"asc" | "desc" | "none">;
    protected readonly rangeMinValue: _angular_core.Signal<any>;
    protected readonly rangeMaxValue: _angular_core.Signal<any>;
    protected readonly dateValue: _angular_core.Signal<Date | null>;
    protected readonly timeValue: _angular_core.Signal<Date | null>;
    protected readonly dateRangeValue: _angular_core.Signal<ZDateRange | null>;
    protected readonly selectValue: _angular_core.Signal<{} | null>;
    protected readonly multiSelectValue: _angular_core.Signal<any[]>;
    protected readonly selectOptions: _angular_core.Signal<{
        label: string;
        value: any;
    }[]>;
    protected readonly selectConfig: _angular_core.Signal<Partial<ZSelectConfig<unknown>>>;
    syncDraft(): void;
    toggleBasicSort(): void;
    addDraftFilter(joinWithPrev: ZTableFilterJoinOperator): void;
    removeDraftFilter(id: string): void;
    updateFilterOperator(id: string, operator: ZTableFilterOperator | null): void;
    updateFilterValue(id: string, value: unknown): void;
    updateDraftSort(value: string | null): void;
    resetFilters(): void;
    applyFilters(): void;
    onMinChangeDebounced(value: string | number | null): void;
    onMaxChangeDebounced(value: string | number | null): void;
    onDateChange(value: Date | null): void;
    onTimeChange(value: Date | null): void;
    onDateRangeChange(value: ZDateRange | null): void;
    onSelectChange(value: unknown): void;
    onMultiSelectChange(value: unknown[]): void;
    private _normalizeFilterUi;
    private _normalizeAdvancedType;
    private _defaultLegacyFilterLabelKey;
    private _normalizeFilterConditions;
    private _isFilterCondition;
    private _operatorDefinitions;
    private _operatorOptions;
    private _operatorOptionsForDraft;
    private _conditionJoinTone;
    private _withDraftId;
    private _createDraftId;
    private _isApplicableCondition;
    private _isValueLessOperator;
    private _applySortState;
    private _normalizeSortState;
    private _hasLegacyFilterValue;
    private _normalizeLegacyFilterValue;
    private _syncAppliedStateFromColumn;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZTableFilterComponent<any>, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZTableFilterComponent<any>, "z-table-filter", never, { "zColumn": { "alias": "zColumn"; "required": true; "isSignal": true; }; "zTable": { "alias": "zTable"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
}

declare class ZTableIconTextComponent {
    readonly zText: _angular_core.InputSignal<string>;
    readonly zTooltip: _angular_core.InputSignal<string | ZTooltipConfig>;
    readonly zTriggerElement: _angular_core.InputSignal<HTMLElement | null>;
    private readonly _hostEl;
    private readonly _zTranslate;
    protected readonly triggerEl: _angular_core.Signal<any>;
    protected readonly translatedParts: _angular_core.Signal<ZTableIconPart[]>;
    protected readonly tooltipContent: _angular_core.Signal<string>;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZTableIconTextComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZTableIconTextComponent, "z-table-icon-text", never, { "zText": { "alias": "zText"; "required": false; "isSignal": true; }; "zTooltip": { "alias": "zTooltip"; "required": false; "isSignal": true; }; "zTriggerElement": { "alias": "zTriggerElement"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}

declare class ZTableActionsComponent<T = unknown> {
    readonly zConfig: _angular_core.InputSignal<ZTableActionColumnConfig<T>>;
    readonly zRow: _angular_core.InputSignal<T>;
    readonly zRowId: _angular_core.InputSignal<string>;
    readonly zDropdownButtonSize: _angular_core.InputSignal<"sm" | "default" | "lg" | "xs" | "xl" | null | undefined>;
    readonly zActionClick: _angular_core.OutputEmitterRef<ZTableActionClickEvent<T>>;
    protected readonly allActions: _angular_core.Signal<ZTableActionItem<T>[]>;
    protected readonly shouldShowAsButtons: _angular_core.Signal<boolean>;
    protected readonly actionStates: _angular_core.Signal<Record<string, {
        visible: boolean;
        disabled: boolean;
        tooltipState: ZActionTooltipState;
    }>>;
    protected readonly dropdownItems: _angular_core.Signal<ZDropdownMenuItem[]>;
    private _getTooltipState;
    protected _onActionClick(action: ZTableActionItem<T>, event: Event): void;
    protected _onDropdownItemClick(item: ZDropdownMenuItem): void;
    private _emitActionClick;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZTableActionsComponent<any>, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZTableActionsComponent<any>, "z-table-actions", never, { "zConfig": { "alias": "zConfig"; "required": true; "isSignal": true; }; "zRow": { "alias": "zRow"; "required": true; "isSignal": true; }; "zRowId": { "alias": "zRowId"; "required": true; "isSignal": true; }; "zDropdownButtonSize": { "alias": "zDropdownButtonSize"; "required": false; "isSignal": true; }; }, { "zActionClick": "zActionClick"; }, never, never, true, never>;
}

declare class ZTableEditCellComponent<T = unknown> implements OnInit {
    private readonly _destroyRef;
    readonly zRow: _angular_core.InputSignal<T>;
    readonly zRowId: _angular_core.InputSignal<string>;
    readonly zRowIndex: _angular_core.InputSignal<number>;
    readonly zColumnId: _angular_core.InputSignal<string>;
    readonly zValue: _angular_core.InputSignal<unknown>;
    readonly zEditConfig: _angular_core.InputSignal<ZTableEditConfig<T> | undefined>;
    readonly zRowUpdate: _angular_core.InputSignal<{
        rowId: string;
        updates: Record<string, unknown>;
    } | null>;
    readonly zChange: _angular_core.OutputEmitterRef<ZTableEditCellChangeEvent<T>>;
    private readonly _currentValue;
    private readonly _valueChange$;
    private _pendingBlurValue;
    private _hasPendingBlur;
    constructor();
    protected readonly editConfig: _angular_core.Signal<ZTableEditConfig<T>>;
    protected readonly cfg: _angular_core.Signal<ZResolvedEditConfig>;
    protected readonly selectOptions: _angular_core.Signal<ZSelectOption<unknown>[]>;
    protected readonly autocompleteOptions: _angular_core.Signal<ZAutocompleteOption<unknown>[]>;
    protected readonly value: _angular_core.Signal<unknown>;
    protected readonly stringValue: _angular_core.Signal<string>;
    protected readonly numericValue: _angular_core.Signal<number | null>;
    protected readonly booleanValue: _angular_core.Signal<boolean>;
    protected readonly dateValue: _angular_core.Signal<Date | null>;
    protected onValueChange(newValue: unknown): void;
    protected onInputBlur(): void;
    protected onImmediateChange(newValue: unknown): void;
    protected onSelectChange(newValue: unknown): void;
    protected onAutocompleteCommit(event: {
        value: string;
        source: 'enter' | 'blur';
    }): void;
    protected onAutocompleteSelect(option: ZAutocompleteOption): void;
    private _emitChange;
    ngOnInit(): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZTableEditCellComponent<any>, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZTableEditCellComponent<any>, "z-table-edit-cell", never, { "zRow": { "alias": "zRow"; "required": true; "isSignal": true; }; "zRowId": { "alias": "zRowId"; "required": true; "isSignal": true; }; "zRowIndex": { "alias": "zRowIndex"; "required": true; "isSignal": true; }; "zColumnId": { "alias": "zColumnId"; "required": true; "isSignal": true; }; "zValue": { "alias": "zValue"; "required": false; "isSignal": true; }; "zEditConfig": { "alias": "zEditConfig"; "required": false; "isSignal": true; }; "zRowUpdate": { "alias": "zRowUpdate"; "required": false; "isSignal": true; }; }, { "zChange": "zChange"; }, never, never, true, never>;
}

/** Type guard: is this a full header config object (not just content shorthand)? */
declare const isHeaderConfig: <T>(config: ZTableHeaderColumnConfig<T> | ZTableHeaderContent<T> | undefined) => config is ZTableHeaderColumnConfig<T>;
/** Type guard: is this a full body config object (not just content shorthand)? */
declare const isBodyConfig: <T>(config: ZTableBodyColumnConfig<T> | ZTableCellContent<T> | undefined) => config is ZTableBodyColumnConfig<T>;
/** Type guard: is this a full footer config object (not just content shorthand)? */
declare const isFooterConfig: <T>(config: ZTableFooterColumnConfig<T> | ZTableHeaderContent<T> | undefined) => config is ZTableFooterColumnConfig<T>;
/** Extract and normalize header config from a column definition */
declare const getHeaderConfig: <T>(col: ZTableColumnConfig<T> | undefined) => {
    content: ZTableHeaderContent<T> | undefined;
    class: string | undefined;
    style: Record<string, string> | undefined;
    align: string | undefined;
    tooltip: string | object | undefined;
    rowSpan: number | undefined;
    colSpan: number | undefined;
    contentClass: string | ((info: unknown) => string) | undefined;
    contentStyle: Record<string, string> | ((info: unknown) => Record<string, string>) | undefined;
} | {
    content: ZTableHeaderContent<T> | undefined;
    class: string | undefined;
    style: Record<string, string> | undefined;
    align: ZTableAlign | undefined;
    tooltip: string | _shival99_z_ui_components_z_tooltip.ZTooltipConfig | undefined;
    rowSpan: number | undefined;
    colSpan: number | undefined;
    contentClass: string | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => string) | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => string) | undefined;
    contentStyle: Record<string, string> | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => Record<string, string>) | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => Record<string, string>) | undefined;
};
/**
 * Extract and normalize body config from a column definition.
 * Resolves dynamic properties (class, style, rowSpan, etc.) when CellContext is provided.
 */
declare const getBodyConfig: <T>(col: ZTableColumnConfig<T> | undefined, ctx?: CellContext<T, unknown>) => {
    content: ZTableCellContent<T> | undefined;
    class: string | undefined;
    style: Record<string, string> | undefined;
    align: string | undefined;
    rowSpan: number | undefined;
    colSpan: number | undefined;
    contentClass: string | undefined;
    contentStyle: Record<string, string> | undefined;
    tooltip: string | object | undefined;
} | {
    content: ZTableCellContent<T> | undefined;
    class: string | ((info: CellContext<T, unknown>) => string) | undefined;
    style: Record<string, string> | undefined;
    align: ZTableAlign | undefined;
    rowSpan: number | undefined;
    colSpan: number | undefined;
    contentClass: string | ((info: CellContext<T, unknown>) => string) | undefined;
    contentStyle: Record<string, string> | undefined;
    tooltip: string | _shival99_z_ui_components_z_tooltip.ZTooltipConfig | ((info: CellContext<T, unknown>) => string | _shival99_z_ui_components_z_tooltip.ZTooltipConfig) | undefined;
};
declare const getFooterConfig: <T>(col: ZTableColumnConfig<T> | undefined) => {
    content: ZTableHeaderContent<T> | undefined;
    class: string | undefined;
    style: Record<string, string> | undefined;
    align: string | undefined;
    tooltip: string | object | undefined;
    rowSpan: number | undefined;
    colSpan: number | undefined;
    contentClass: string | ((info: unknown) => string) | undefined;
    contentStyle: Record<string, string> | ((info: unknown) => Record<string, string>) | undefined;
} | {
    content: ZTableHeaderContent<T> | undefined;
    class: string | undefined;
    style: Record<string, string> | undefined;
    align: ZTableAlign | undefined;
    tooltip: string | _shival99_z_ui_components_z_tooltip.ZTooltipConfig | undefined;
    rowSpan: number | undefined;
    colSpan: number | undefined;
    contentClass: string | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => string) | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => string) | undefined;
    contentStyle: Record<string, string> | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => Record<string, string>) | ((info: _tanstack_angular_table.HeaderContext<T, unknown>) => Record<string, string>) | undefined;
};
/** Recursively search for a column config by ID within a (possibly nested) column array */
declare const findColumnConfig: <T>(columnId: string, columns: ZTableColumnConfig<T>[]) => ZTableColumnConfig<T> | undefined;
/**
 * Converts the consumer-facing ZTableColumnConfig into a TanStack ColumnDef.
 * This is the bridge between the z-table API and TanStack Table internals.
 *
 * Handles:
 * - Accessor mapping (accessorKey / accessorFn)
 * - Header/body/footer content resolution
 * - Sort and filter function wiring (local vs server mode)
 * - Built-in filter functions for each filter type
 * - Recursive nested column conversion
 */
declare function columnConfigToColumnDef<T>(config: ZTableColumnConfig<T>): ColumnDef<T>;

export { ZTableActionsComponent, ZTableComponent, ZTableEditCellComponent, ZTableFilterComponent, ZTableIconTextComponent, columnConfigToColumnDef, findColumnConfig, getBodyConfig, getFooterConfig, getHeaderConfig, isBodyConfig, isFooterConfig, isHeaderConfig };
export type { ZTableActionBodyConfig, ZTableActionClickEvent, ZTableActionColumnConfig, ZTableActionItem, ZTableActionList, ZTableAdvancedFilterType, ZTableBulkActionClickEvent, ZTableBulkActionConfig, ZTableBulkActionContext, ZTableBulkActionHandlerContext, ZTableBulkActionItem, ZTableBulkActionList, ZTableBulkActionOptions, ZTableBulkActionViewItem, ZTableCellEditChange, ZTableCellEditEvent, ZTableChangeEvent, ZTableColumn, ZTableColumnConfig, ZTableConfig, ZTableControl, ZTableEditCellChangeEvent, ZTableEditConfig, ZTableEditSize, ZTableEditType, ZTableExcelExportConfig, ZTableExcelExportContext, ZTableExcelExportScope, ZTableFilterChangeEvent, ZTableFilterCondition, ZTableFilterConfig, ZTableFilterJoinOperator, ZTableFilterOperator, ZTableFilterOptionSource, ZTableFilterUi, ZTableFilterValueType, ZTablePageChangeEvent, ZTablePaginationConfig, ZTableRowExpandEvent, ZTableRowSelectEvent, ZTableSearchChangeEvent, ZTableSearchConfig, ZTableSortChangeEvent, ZTableSortConfig };
