import * as _angular_core from '@angular/core'; import { TemplateRef } from '@angular/core'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Sort direction for a sortable column. * * - `'asc'` — ascending * - `'desc'` — descending * - `null` — unsorted */ type WrTableSortDirection = 'asc' | 'desc' | null; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Per-column sort state. The full sort emitted by `` is an * array of these — the order in the array is the application order. */ interface WrTableSortState { readonly key: string; readonly direction: WrTableSortDirection; } /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Single picker entry inside a column's filter dropdown. */ interface WrTableFilterItem { readonly title: string; readonly value: T; selected?: boolean; } /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** Payload emitted by `` when a column's filter selection changes. */ interface WrTableFilterChange { readonly key: string; readonly items: readonly WrTableFilterItem[]; } /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** A single column definition. */ interface WrTableColumn { /** Heading shown in the column's header. */ readonly title: string; /** Show a clickable sort indicator in the header. */ readonly sortable?: boolean; /** When non-empty, shows a filter dropdown in the header. */ readonly filterItems?: readonly WrTableFilterItem[]; } /** * Column map — keys are the row's property names; values are column defs. * * @example * ```ts * const columns: WrTableColumns = { * name: { title: 'Name', sortable: true }, * email: { title: 'Email' }, * role: { title: 'Role', filterItems: [{ title: 'Admin', value: 'admin' }] }, * }; * ``` */ type WrTableColumns = Record; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Implicit context passed to a `[wrTableCell]` template. */ interface WrTableCellContext { /** Cell value (alias for `item[columnKey]`). Use as `let-value`. */ readonly $implicit: unknown; /** The full row item. */ readonly item: Record; /** The column definition. */ readonly column: WrTableColumn; } /** * Data table with sortable / filterable headers and custom cell templates. * * Columns are defined via the `columns` input (a `Record`). * Rows are objects whose property names match the column keys. Cells can * be customised by projecting an `[wrTableCell]="key"` template. * * @example * ```html * * * {{ value }} * * * ``` * * @see https://ngwr.dev/components/table */ declare class WrTable { /** Column definitions, keyed by row property name. */ readonly columns: _angular_core.InputSignal; /** Row items. `null`/`undefined` → loading skeleton. */ readonly items: _angular_core.InputSignal[] | null | undefined>; /** Show the loading spinner overlay. @default false */ readonly loading: _angular_core.InputSignalWithTransform; /** * Collapse each row to a labelled card when the table's own box is too narrow * for columns (a container query on its own width, not the viewport). Every * cell shows its column title as a label. @default false */ readonly responsive: _angular_core.InputSignalWithTransform; /** Two-way bindable sort array. Order in array = application order. */ readonly sort: _angular_core.ModelSignal; /** Fires whenever a column's filter selection changes. */ readonly filterChange: _angular_core.OutputEmitterRef; /** * Rows per page. Set to `0` (default) to disable client-side pagination * and render every row at once. */ readonly pageSize: _angular_core.InputSignalWithTransform; /** Two-way bindable 1-based current page. */ readonly page: _angular_core.ModelSignal; /** * Total row count for server-side pagination — when set, the table * shows the pager but does NOT slice `items` (you provide the current * page's slice yourself and react to `(page)` changes). */ readonly totalItems: _angular_core.InputSignal; /** Total row count derived for the pager (server-mode wins). */ protected readonly resolvedTotal: _angular_core.Signal; /** Items visible on the current page (client mode slices; server mode passes through). */ protected readonly visibleItems: _angular_core.Signal[] | null | undefined>; /** Show the pager footer only when paging is enabled and rows overflow. */ protected readonly showPager: _angular_core.Signal; private readonly cellTemplates; /** Map of column key → custom template (if provided via `[wrTableCell]`). */ protected readonly cellMap: _angular_core.Signal>>; /** Keep KeyValuePipe in declaration order (comparator that treats all keys as equal). */ protected readonly keepOrder: () => number; protected directionFor(key: string): WrTableSortDirection; protected cycleSort(key: string): void; protected onFilter(key: string, items: readonly WrTableFilterItem[]): void; protected cellContext(item: Record, key: string, column: unknown): WrTableCellContext; protected getValue(item: Record, key: unknown): unknown; protected templateFor(key: unknown): TemplateRef | undefined; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Provide a custom template for a specific column's cells. * * @example * ```html * * * {{ value }} * * * ``` */ declare class WrTableCell { /** Column key the template applies to. */ readonly columnKey: _angular_core.InputSignal; readonly template: TemplateRef; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Sort indicator rendered in a sortable column's header. * * @internal — used internally by ``. Parent listens for clicks * on the indicator to cycle direction. */ declare class WrTableSort { readonly direction: _angular_core.InputSignal; protected readonly classes: _angular_core.Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Filter dropdown rendered in a filterable column's header. * * @internal — used internally by ``. */ declare class WrTableFilter { /** Available filter options. */ readonly items: _angular_core.InputSignal[]>; /** Fires whenever the selection changes. */ readonly selectionChange: _angular_core.OutputEmitterRef[]>; protected readonly query: _angular_core.WritableSignal; /** Filtered + selection-tracked view of items. */ protected readonly visible: _angular_core.Signal[]>; protected readonly selectedCount: _angular_core.Signal; protected readonly classes: _angular_core.Signal; protected onSearchInput(event: Event): void; protected onToggle(item: WrTableFilterItem): void; protected onReset(): void; private emitSelected; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } export { WrTable, WrTableCell, WrTableFilter, WrTableSort }; export type { WrTableCellContext, WrTableColumn, WrTableColumns, WrTableFilterChange, WrTableFilterItem, WrTableSortDirection, WrTableSortState };