import * as _angular_core from '@angular/core'; import { TemplateRef, Signal, WritableSignal } from '@angular/core'; import { MTIcon } from '@masterteam/icons'; import { ConfirmationConfig, ConfirmationService } from '@masterteam/components/confirmation'; import * as primeng_api from 'primeng/api'; import { TreeNode, MenuItem } from 'primeng/api'; import { TranslocoService } from '@jsverse/transloco'; import { TablePageEvent } from 'primeng/table'; import { EntityData, EntityViewType } from '@masterteam/components/entities'; import { ControlValueAccessor } from '@angular/forms'; import { Popover } from 'primeng/popover'; import { ButtonSeverity } from 'primeng/button'; import { TieredMenu } from 'primeng/tieredmenu'; /** * Table action confirmation config with optional event */ type TableActionConfirmationConfig = Omit & { event?: Event; confirmationType?: 'delete'; }; /** * Defines the options for a select filter. */ interface FilterOption { label: string; value: any; } /** * Configuration for filtering on a specific column. */ interface FilterConfig { type: 'text' | 'select' | 'userSelect' | 'treeSelect' | 'date' | 'boolean' | 'user' | 'numberRange'; label?: string; options?: FilterOption[]; treeOptions?: TreeNode[]; /** * Controls multi-select behaviour for `select` / `userSelect` filters. * Defaults to `true` — opt out with `multiple: false` for a single-select. * The stored filter value is an array; rows match if the cell value matches * *any* selected entry. */ multiple?: boolean; [key: string]: unknown; } /** * Filter value for date range, numeric range, or simple value */ interface FilterValue { value?: any; from?: Date | number | null; to?: Date | number | null; } interface TableStatusMapValue { display?: string; color?: string; description?: string; } /** * Table filters map */ type TableFilters = Record; /** * Column type definition */ type ColumnType = 'text' | 'number' | 'boolean' | 'date' | 'dateTime' | 'user' | 'status' | 'entity' | 'custom'; /** * Event emitted when a cell value changes */ interface CellChangeEvent { row: any; column: string; value: any; type: ColumnTypeForActionCell; } type ColumnTypeForActionCell = 'boolean'; type TableActionShape = 'flat' | 'popover'; type TableActionPlacement = 'menu' | 'inline'; /** * Filter UX mode for a table. * * - `popover`: single top-right funnel button opening a form with every filter. * - `column`: per-column funnel icon next to each filterable header. * * Add new modes here + a matching branch in the table header template. */ type TableFilterMode = 'popover' | 'column'; /** * Keys that can be excluded from mt-table storage persistence. * * - `pageSize`: selected rows-per-page value. * - `pagePosition`: current page / first row offset. * - `sort`: sort field and direction. * - `selection`: selected row keys. * - `groupBy`: active grouped column. */ type TablePersistStateKey = 'pageSize' | 'pagePosition' | 'sort' | 'selection' | 'groupBy'; /** * Injected value resolver for export/print — caller decides how a cell value * becomes a scalar for Excel/PDF output. Keeps TableExportService * schema-agnostic (open/closed for new column types). */ type TableExportValueResolver = (row: unknown, column: ColumnDef) => string | number | boolean | null; interface TableExportConfig { rows: any[]; columns: ColumnDef[]; filename: string; resolveValue: TableExportValueResolver; } interface TablePrintConfig extends TableExportConfig { title?: string; } interface ColumnDef { key: string; label: string; type?: ColumnType; customCellTpl?: TemplateRef; filterConfig?: FilterConfig; statusMap?: Record; sortable?: boolean; /** * Overrides whether the column is offered in the row-group picker. By default * only low-cardinality columns (select / boolean / user filters) are offered, * because unique-valued columns would produce one group per row. Set `true` * to opt a column in anyway — use it when the backend orders the result set * so equal values arrive contiguously (e.g. a Work Center "Level Name" * column sorted server-side). Set `false` to opt a column out entirely. */ groupable?: boolean; /** * Dotted path to the row field holding this column's *group identity*, used * instead of the rendered label when bucketing rows. Set it when the visible * label is ambiguous — two records may share a display name but must stay * separate groups (the backend's stable id), or several distinct ids must * collapse into one group. An empty / missing value at that path puts the row * in the shared "no value" group. */ groupKey?: string; /** * Whether the group header prefixes the value with this column's label * ("Status · Active"). Defaults to `true`. Turn it off when the value already * names itself — a project or person reads fine on its own, and the prefix is * just noise repeated down the page. */ showGroupColumnLabel?: boolean; readonly?: boolean; width?: string; /** * Horizontal alignment of the header and its cells. Defaults to `end` for * `number` columns and `start` for everything else. * * Left-aligned numbers cannot be compared by scanning, because the digits do * not line up (finding M-05) — set `align: 'end'` on any column that renders * a figure through a `custom` or `entity` cell, where the table cannot infer * it from the type. */ align?: 'start' | 'center' | 'end'; /** * Whether the column shrinks to its content instead of taking a share of the * leftover width. Defaults to `true` for the fixed-shape types (`date`, * `dateTime`, `boolean`, `number`, `user`, `status`) so a ten-character date * stops being handed 440px while the title column is squeezed. Set `false` to * opt a fixed-shape column back into absorbing width. */ shrink?: boolean; filterOnly?: boolean; /** * Opts the column out of the filter UI entirely, whatever its type would * otherwise allow. Use it on lazy tables whose backend has no query * parameter for the column: lazy mode never filters locally, so a filter the * host cannot translate into a backend parameter renders a control that * silently does nothing. Defaults to filterable. */ filterable?: boolean; /** * Opts a `custom` column into export/print. Custom columns are excluded by * default because their template may render purely visual content with no * scalar value. Set this when the underlying cell value is still meaningful * (e.g. an entity/count rendered as a styled badge) so it appears in Excel/PDF. * No effect on non-custom columns (those export unless `filterOnly`). */ exportable?: boolean; /** * Overrides the exported/printed scalar for this column. When provided it wins * over the default type-based resolution — use it for `custom` columns whose * cell value isn't trivially resolvable, or to format any column's export value. */ exportValue?: (row: any) => string | number | boolean | null; } interface TableAction { icon?: MTIcon | undefined; color?: 'info' | 'success' | 'warn' | 'danger' | 'secondary' | 'contrast' | 'help' | 'primary'; variant?: 'text' | 'outlined' | undefined; size?: 'small' | 'large' | undefined; /** * In popover action mode, `inline` actions render as direct icon buttons * before the three-dot menu. Defaults to `menu`. */ placement?: TableActionPlacement; label?: string; tooltip?: string; hidden?: (row: any) => boolean; action: (row: any) => void; loading?: boolean | ((row: any) => boolean); confirmation?: TableActionConfirmationConfig; } /** Bucket every row whose grouped value is missing/empty falls into. */ declare const EMPTY_GROUP_KEY = "__mt_group_empty__"; /** * Pure controller owning all row-grouping concerns. Table instantiates one and * binds its signals — keeps grouping logic out of table.ts. * * PrimeNG's subheader grouping renders only when `sortField === groupRowsBy`. * `setGroup` therefore also pins the sort to the grouped column; clearing the * group leaves the user's sort untouched. */ declare class TableGroupingController { private readonly columns; private readonly rows; private readonly groupBy; private readonly sortField; private readonly sortDirection; private readonly transloco?; constructor(columns: Signal, rows: Signal, groupBy: WritableSignal, sortField: WritableSignal, sortDirection: WritableSignal<'asc' | 'desc' | null>, transloco?: TranslocoService | undefined); private translate; readonly groupableColumns: Signal; /** * Row counts per group key — consumed by the group header template so each * subheader can show "Status: Active (12)". */ readonly groupCounts: Signal>; getGroupCount(row: unknown): number; readonly activeGroupColumn: Signal; readonly groupingActive: Signal; /** * Whether the group header repeats the grouped column's name before the * value. Opt-out per column via `ColumnDef.showGroupColumnLabel`. */ readonly showsGroupColumnLabel: Signal; /** * Returns true when the given column is the active group column and * therefore cannot have its sort cleared (PrimeNG requirement). */ isGroupLockedSort(columnKey: string): boolean; setGroup(key: string | null): void; /** * Display label for a row's grouped value — used by the `#groupheader` * template. Leverages the same resolver pipeline the cells use, so status * maps / user display names render consistently. */ getGroupLabel(row: unknown): string; /** * Accent color for status/entity-Status group headers. Reused from the * cell renderer's status-map pipeline so tint is consistent with the cell. */ getGroupAccentColor(row: unknown): string | null; /** * Returns the stable string key for the active group column on this row. * Used to add a synthetic `__mt_group__` field so PrimeNG compares a plain * string rather than a complex entity object (whose JSON representation is * not stable across rows). */ getGroupSortKey(row: unknown): string; /** Stable key used to bucket rows into groups — normalised to string. */ private getGroupKey; } declare class Table { private static readonly LOADING_COLUMN_COUNT; selectionChange: _angular_core.OutputEmitterRef; cellChange: _angular_core.OutputEmitterRef; lazyLoad: _angular_core.OutputEmitterRef; columnReorder: _angular_core.OutputEmitterRef; rowReorder: _angular_core.OutputEmitterRef; rowClick: _angular_core.OutputEmitterRef; /** Fired when the empty state's action button is pressed. */ emptyAction: _angular_core.OutputEmitterRef; /** * Fired when the default "Clear filters" action resets the table's search * term and filters. A host that also filters outside the table (see * `externalFiltersActive`) clears its own filters here. */ filtersCleared: _angular_core.OutputEmitterRef; /** * Fires when the per-row actions popover is opened (3-dots click) so the * parent can lazy-load row-specific actions instead of fetching for every * visible row up front. Only emitted when `actionShape` is `popover`. */ rowActionsRequested: _angular_core.OutputEmitterRef; filters: _angular_core.ModelSignal; data: _angular_core.InputSignal; columns: _angular_core.InputSignal; rowActions: _angular_core.InputSignal; size: _angular_core.InputSignal<"small" | "large" | undefined>; showGridlines: _angular_core.InputSignalWithTransform; stripedRows: _angular_core.InputSignalWithTransform; selectableRows: _angular_core.InputSignalWithTransform; clickableRows: _angular_core.InputSignalWithTransform; generalSearch: _angular_core.InputSignalWithTransform; lazyLocalSearch: _angular_core.InputSignalWithTransform; showFilters: _angular_core.InputSignalWithTransform; filterMode: _angular_core.InputSignal; /** `filterMode: 'popover'` only — close the filter drawer on an outside click. */ filterCloseOnOutsideClick: _angular_core.InputSignalWithTransform; loading: _angular_core.InputSignalWithTransform; updating: _angular_core.InputSignalWithTransform; lazy: _angular_core.InputSignalWithTransform; lazyLocalSort: _angular_core.InputSignalWithTransform; lazyTotalRecords: _angular_core.InputSignal; reorderableColumns: _angular_core.InputSignalWithTransform; reorderableRows: _angular_core.InputSignalWithTransform; dataKey: _angular_core.InputSignal; storageKey: _angular_core.InputSignal; storageMode: _angular_core.InputSignal<"local" | "session">; persistStateExclude: _angular_core.InputSignal; exportable: _angular_core.InputSignalWithTransform; printable: _angular_core.InputSignalWithTransform; groupable: _angular_core.InputSignalWithTransform; /** * Optional external group-count map keyed by the group display label * (e.g. `"Approved" → 42`). When provided, the group header shows these * totals instead of the local page row count. Use this in lazy tables where * the backend provides total-count-per-group via KPI/stats data. */ groupCountMap: _angular_core.InputSignal | null>; cellClickFilter: _angular_core.InputSignalWithTransform; /** * When true and `rowActions` is non-empty, the trailing actions column is * pinned to the right via PrimeNG's frozen-column support. The table also * switches to scrollable mode so horizontal scrolling reveals the rest of * the columns while the actions stay visible. Off by default to preserve * existing layout for tables that don't opt in. */ freezeActions: _angular_core.InputSignalWithTransform; virtualScroll: _angular_core.InputSignalWithTransform; virtualScrollItemSize: _angular_core.InputSignal; scrollHeight: _angular_core.InputSignal; printTitle: _angular_core.InputSignal; exportFilename: _angular_core.InputSignal; actionShape: _angular_core.InputSignal; /** * Optional per-row predicate. When it returns true for a given row, the * row-actions popover renders a small skeleton block instead of the action * list — used while a parent is fetching that row's actions on demand. */ rowActionsLoadingFn: _angular_core.InputSignal<((row: any) => boolean) | null>; tableLayout: _angular_core.InputSignal<"fixed" | "auto">; noCard: _angular_core.InputSignalWithTransform; private readonly dateFormat; tabs: _angular_core.InputSignal; tabsOptionLabel: _angular_core.InputSignal; tabsOptionValue: _angular_core.InputSignal; activeTab: _angular_core.ModelSignal; onTabChange: _angular_core.OutputEmitterRef; actions: _angular_core.InputSignal; captionStartContent: _angular_core.Signal | undefined>; captionEndContent: _angular_core.Signal | undefined>; /** * Programmatic equivalents of the `#captionStart` / `#captionEnd` content * children. Content projection only reaches one component deep, so a wrapper * that renders the table on a caller's behalf (client-list, work-center) * cannot forward a template the caller declared. These inputs give it a way * to pass that template down instead, and win over the projected ones. */ captionStartTemplate: _angular_core.InputSignal | null>; captionEndTemplate: _angular_core.InputSignal | null>; emptyContent: _angular_core.Signal | undefined>; /** * Copy for the empty state. Left unset, the table falls back to the generic * "Nothing here yet" / "No results match your filters" pair — but a list that * knows what it holds should say so, which is the whole point of finding * H-12: `emptyDescription="Deliverables you own appear here."` */ emptyTitle: _angular_core.InputSignal; emptyDescription: _angular_core.InputSignal; /** * Call to action on the empty state. Supplying a label takes ownership of the * behaviour: `emptyAction` fires and the table does nothing else. Without * one, a filtered-empty table offers "Clear filters" and handles it itself. */ emptyActionLabel: _angular_core.InputSignal; emptyActionIcon: _angular_core.InputSignal; /** * Whether the host narrowed the rows with filters the table cannot see — a * header filter builder, a server-side query. The empty state then reads * "No results match your filters" and offers "Clear filters" instead of the * empty-list copy. The host owns the reload: on `filtersCleared` the table * resets its own state without emitting `lazyLoad`, so the host's clear is * the only request in flight. A host with server-side search * (`lazyLocalSearch` off) must read the cleared `filterTerm` for that reload. */ externalFiltersActive: _angular_core.InputSignalWithTransform; paginatorPosition: _angular_core.InputSignal<"start" | "center" | "end">; /** * Pagination for a single page of rows is noise that implies more data * exists, so it is off by default now (finding M-05). Set it when the row * count is genuinely unknown to the user and the "1 of 1" is reassuring. */ alwaysShowPaginator: _angular_core.InputSignalWithTransform; rowsPerPageOptions: _angular_core.InputSignal; pageSize: _angular_core.ModelSignal; currentPage: _angular_core.ModelSignal; first: _angular_core.ModelSignal; filterTerm: _angular_core.ModelSignal; groupBy: _angular_core.ModelSignal; /** * Sort state is a `model` so a lazy host that owns sort itself (URL / store) * can push its value in instead of letting the table drift out of sync with * the query it actually sent. */ sortField: _angular_core.ModelSignal; sortDirection: _angular_core.ModelSignal<"desc" | "asc" | null>; confirmationService: ConfirmationService; private readonly exportService; private readonly transloco; protected readonly grouping: TableGroupingController; protected selectedRowKeys: _angular_core.WritableSignal>; protected transientSelectedRows: _angular_core.WritableSignal>; private readonly hydratedStorageKey; private readonly storageHydrated; protected readonly isColumnFilterMode: _angular_core.Signal; protected filterableColumnMap: _angular_core.Signal>; protected getFilterableColumn(key: string): ColumnDef | undefined; onColumnFilterChange(key: string, value: any): void; protected activeFilterCount: _angular_core.Signal; /** * Whether the user narrowed the list themselves. Drives which empty state the * table shows: "nothing matched what you asked for, clear it" reads very * differently from "this list has nothing in it yet" (finding H-12). */ protected hasActiveFilters: _angular_core.Signal; /** Action offered on the empty state. Defaults to clearing an active filter. */ protected resolvedEmptyActionLabel: _angular_core.Signal; protected resolvedEmptyActionIcon: _angular_core.Signal; /** * The empty-state action. A caller that supplied its own label owns the * behaviour and just gets the event; otherwise the default action is the one * the default label promises — clear the filters and the search term. * With external filters active the host reloads once it has cleared its own, * so the table skips its `lazyLoad`: two un-cancelled requests would race, * and the stale filtered response could land last. */ protected onEmptyAction(): void; protected filteredData: _angular_core.Signal; protected renderedColumns: _angular_core.Signal; /** * Synthetic field name added to each row so PrimeNG's `groupRowsBy` * compares a stable primitive string instead of a complex entity object. */ static readonly GROUP_KEY_FIELD = "__mt_group__"; protected readonly groupKeyField = "__mt_group__"; protected displayData: _angular_core.Signal; /** * Display data enriched with a stable group key field so PrimeNG groups * rows correctly. Without this, PrimeNG JSON-stringifies the full entity * object (spread of column + backend value), which may differ between rows * even when they share the same status display. */ protected groupKeyedData: _angular_core.Signal; protected totalRecords: _angular_core.Signal; protected usesVirtualScroll: _angular_core.Signal; protected showPaginator: _angular_core.Signal; protected paginatedData: _angular_core.Signal; protected allSelectedOnPage: _angular_core.Signal; protected totalColumnSpan: _angular_core.Signal; constructor(); /** * Returns the count for a group row — uses `groupCountMap` when provided * (e.g. backend KPI totals) so lazy tables show the real total instead of * the current-page row count. */ getDisplayGroupCount(row: unknown): number; /** * Called when the user picks a group column from the caption's actions menu. * Syncs PrimeNG grouping sort state and asks lazy tables to reload grouped * rows consecutively from the backend. */ onGroupByChange(key: string | null): void; onFilterApplied(filters: TableFilters): void; onFilterReset(): void; protected matchesFilter(item: any, key: string, filterValue: FilterValue | any): boolean; toggleRow(row: any): void; toggleAllRowsOnPage(): void; getProperty(obj: any, key: string): any; protected getDateProperty(obj: any, key: string): string | number | Date | null; getEntityPreviewData(row: any, col: ColumnDef): EntityData | null; /** * Entity data resolver that abstracts over the `user` / `status` vs `entity` * distinction — used by the shared filterable-cell template so the three * cases don't duplicate markup. */ resolveCellEntityData(row: any, col: ColumnDef): EntityData | null; tabChanged(tab: any): void; onTablePage(event: TablePageEvent): void; handleLazyLoad(event: any): void; onPaginatorPage(event: any): void; onSearchChange(searchTerm: string): void; toggleSort(column: ColumnDef): void; isColumnSortable(column: ColumnDef): boolean; getSortIcon(column: ColumnDef): MTIcon; onCellChange(row: any, columnKey: string, newValue: any, type?: ColumnTypeForActionCell): void; resolveActionLoading(action: TableAction, row: any): boolean | undefined; getVisibleRowActions(row: any): TableAction[]; getInlineRowActions(row: any): TableAction[]; /** * Menu actions with the destructive ones moved to the bottom. * * The Risks row menu read Preview, Update Risk, **Delete Risk**, Close Risk, * Transfer to Issue, Escalate — the irreversible action third of six, between * the two most common ones, separated from them by nothing but its colour * (finding M-07). Colour alone is not separation, and it is no separation at * all for a user with a colour-vision deficiency. Order within each group is * preserved, so a caller's deliberate sequence still holds. */ getMenuRowActions(row: any): TableAction[]; /** * True for the first destructive item, which is where the divider goes. The * divider is rendered above it rather than below the last routine item so a * menu that is *only* destructive does not open with a stray rule. */ protected isFirstDestructiveAction(row: any, index: number): boolean; /** Deleting, or anything the caller flagged `danger`. */ private static isDestructiveAction; shouldShowRowActionsPopover(row: any): boolean; isRowActionsLoading(row: any): boolean; onRowActionsToggle(event: Event, popover: { toggle: (e: Event) => void; }, row: any): void; onColumnReorder(event: any): void; onRowReorder(event: any): void; onRowClick(event: MouseEvent, row: any): void; protected updatePagingFromEvent(event: any): void; protected emitLazyLoad(event: any): void; private lazyLoadFilters; /** * Removes date-range filters whose end falls before their start. Returns the * same object when there is nothing to remove, so callers can compare by * reference. */ private withoutReversedDateRanges; private withoutGeneralSearch; exportExcel(): void; printPdf(): void; onCellFilterClick(event: Event, row: any, column: ColumnDef): void; isCellFilterActive(row: any, column: ColumnDef): boolean; isCellClickFilterable(column: ColumnDef, row: unknown): boolean; rowAction(event: Event, action: TableAction, row: any): void; private buildUserEntityData; private buildStatusEntityData; private resolveStatusValue; private unwrapStatusValue; private isEntityStatusCompatibilityColumn; private isStatusColumnKey; private resolveStatusMapValue; private resolveDefaultStatusColor; private normalizeStatusToken; private readStringProperty; /** * Gets the entity data for an 'entity' type column. * The row data is expected to already be in EntityData format. * Automatically hides entity name and configures User entities * to show only avatar + displayName. */ getEntityColumnData(row: any, col: ColumnDef): EntityData | null; protected getStatusEntityAccentColor(row: Record): string | null; private resolveStatusEntityAccentColor; protected getBooleanProperty(obj: any, key: string): boolean; private setProperty; private sortData; private getSortValue; /** * Export/print value resolver — same pipeline as `getColumnResolvedValue` * except date / dateTime columns (and their entity counterparts) are * formatted via the MT date pipe so Excel and PDF show locale-aware dates * instead of raw ISO strings. Sort path keeps the ISO form for ordering. */ private getColumnExportValue; /** * Detects whether a column should be treated as a date for export purposes: * native `date` / `dateTime` types, or entity columns whose viewType is * `Date` / `DateTime` / `Time`. */ private resolveDateColumnType; private getColumnResolvedValue; protected isRowSelected(row: Record): boolean; /** * Types whose rendered width is bounded by their own shape — a date, a * yes/no, an avatar, a status chip. They get sized to content so the columns * that hold real text absorb the leftover width instead (finding M-05). */ private static readonly SHRINK_TO_CONTENT_TYPES; /** * Alignment class for a column's header and cells. Numbers align to the end * with tabular figures so the digits line up down the column; everything else * keeps the reading direction. */ protected getColumnAlignClass(column: ColumnDef): string; /** * `width: 1%` is the shrink-to-content idiom for an auto-layout table: the * browser treats it as a floor, gives the column exactly what its content * needs, and hands the remainder to the columns that asked for nothing. An * explicit `width` on the column always wins. */ protected getColumnWidth(column: ColumnDef): string | null; protected getColumnMinWidth(column: ColumnDef): string | null; private emitSelectionChange; private getSelectedRows; private getRowSelectionKey; private getNormalizedStorageKey; private getStorage; private buildPersistedState; private applyPersistedState; private shouldEmitLazyLoadAfterRestore; private shouldPersistStateKey; private readPersistedState; private getRestorablePersistedState; private writePersistedState; private toPositiveInteger; private normalizePersistedPageSize; private resolveScrollHeightPixels; private toNonNegativeInteger; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } type TableEntityUsage = 'sort' | 'export' | 'filter'; declare class TableValueResolver { /** * View types the table knows how to filter/sort/export. Deliberately a * subset of `EntityViewType` — the richer ones (`Location`, `Connection`, * `LookupModuleCheckList`, `LeafDetails`) have no scalar the table could * compare, so they stay out and simply render. Anything listed here also * needs a branch in `getColumnFilterType` and `getEntityValueByType`. */ private static readonly ALL_ENTITY_VIEW_TYPES; private static readonly UNSORTABLE_ENTITY_VIEW_TYPES; private static readonly EXPORTABLE_ENTITY_VIEW_TYPES; /** * `Time` is sortable and exportable but not filterable: a time-of-day has no * meaningful date-range filter, and a date picker cannot express one — it * would silently filter by day instead of by clock time. */ private static readonly FILTERABLE_ENTITY_VIEW_TYPES; /** * Sentinel `key` value that resolves to the whole row instead of a property * path. Use it when a cell renderer (e.g. `type: 'user'`) needs the full * record, not a single field — `key: '{{record}}'` in the column def. */ static readonly RECORD_KEY = "{{record}}"; static getProperty(obj: unknown, key: string): unknown; /** * Recursively scans `value` for any string field that contains `searchTerm`. * Used by the general-search box so nested displays (e.g. `name.display` on a * lookup row, where the row's top-level `name` is an object) are still * matched. `searchTerm` is expected to be lowercase. */ static matchesSearchTerm(value: unknown, searchTerm: string, depth?: number): boolean; static getColumnFilterType(column: ColumnDef, row?: Record): FilterConfig['type'] | null; /** * Whether the filter UI should offer a control for this column. * * Deliberately separate from {@link getColumnFilterType}, which also drives * export, sort and grouping resolution — opting a column out of the filter * panel must not change how its value is exported. Hosts opt out with * `filterable: false`, most usefully on lazy tables: those never filter * locally, so a filter the host cannot map onto a backend query parameter * would render a control that does nothing at all. */ static isColumnFilterable(column: ColumnDef, row?: Record): boolean; /** * Returns a column with its filterConfig normalized for rendering: * - `type` is resolved via `getColumnFilterType` * - `options` for `select` filters are auto-generated from `data` when not provided * * Used by both popover and per-column filter modes so option-building stays in one place. */ static buildFilterableColumn(column: ColumnDef, data: any[]): ColumnDef; /** * Returns true when `item` passes the filter for `key`. Pure function — callers * pass `column` so the resolver can apply type-aware normalisation (entity, * status, user, date, boolean). Shared by `mt-table` row-filtering and * `client-list-cards-view` card-filtering. */ static matchesFilter(item: unknown, key: string, filterValue: FilterValue | unknown, column: ColumnDef | undefined): boolean; /** * Applies every entry of `filters` against `item` — used by cards view and * anywhere else that consumes the same filter shape as mt-table. */ static matchesAllFilters(item: unknown, filters: Record, columns: ColumnDef[]): boolean; /** * True when a filter slot holds a meaningful value (scalar, text, date-range bounds, * or user lookup). Shared by popover and per-column modes to compute active counts. */ static hasFilterValue(value: unknown): boolean; /** * True when a date-range filter ends on an earlier calendar day than it * starts. Compared by local calendar day, not instant: the filter picks whole * days (`to` is widened to 23:59:59.999 when matching), so `from` and `to` on * the same day is a valid one-day range. A range with only one bound, or a * bound that does not parse as a date, is not reversed. * * Callers pass only values of columns whose filter type is `date` — a * `numberRange` value has the same `{ from, to }` shape and is not checked. */ static isReversedDateRange(value: unknown): boolean; /** * Keys in `filters` holding a reversed date range, resolved against * `columns`. A key with no matching column, or whose column does not filter * as `date`, is never reported. */ static getReversedDateRangeKeys(filters: TableFilters, columns: ColumnDef[], row?: Record): string[]; private static toLocalDayStart; /** * Produces the filter payload a cell-click should apply for `column`. * Returns null when the cell type is not click-filterable. * * Shapes match `Table.matchesFilter` branches: * - user / entity(User) → `{ id, userName, displayName }` * - status / entity(Status|Lookup) → scalar display string * - boolean → boolean */ static buildClickFilterValue(row: unknown, column: ColumnDef): unknown | null; /** * True when two filter values refer to the same thing. Mirrors the branches * in `Table.matchesFilter`: scalar equality, boolean equality, or user-object * identity on id / userName / displayName. */ static isFilterValueEqual(a: unknown, b: unknown): boolean; private static extractUserFilterValue; static getColumnFilterValue(row: Record, column: ColumnDef): string | number | boolean | null; static resolveDateValue(value: unknown): string | number | Date | null; static getEntityValueByType(value: unknown, usage: TableEntityUsage): string | number | boolean | null; static stripHtml(value: string | number | boolean | null): string | number | boolean | null; static resolveDisplayValue(value: unknown): string | number | boolean | null; static resolveBooleanValue(value: unknown): boolean | null; static normalizeTextSortValue(value: unknown): string | null; static normalizeNumericSortValue(value: unknown): number | null; static normalizeDateSortValue(value: unknown): number | null; /** * Order a `Time` cell by seconds since midnight. The stored shape is a * wall-clock `HH:mm:ss`, which `Date` cannot parse at all; values still held * as a full instant contribute their local clock, so a column holding both * shapes still sorts by time of day rather than by the date part. */ static normalizeClockSortValue(value: unknown): number | null; /** * Resolves an entity column's view type from the column def, falling back to * a sample row's cell. Public because grouping decides what it can bucket * from the entity view type, which is finer-grained than the filter type * (`Lookup` and `LookupMatrix` both filter as `select`-ish but only the view * type says whether the values are categorical). */ static getEntityViewType(column: ColumnDef, row?: Record): EntityViewType | null; private static isEntityViewType; private static resolveTreeFilterLabel; } declare class TableFilter implements ControlValueAccessor { readonly columns: _angular_core.InputSignal; readonly data: _angular_core.InputSignal; /** Close the drawer on a click outside it. Off by default. */ readonly closeOnOutsideClick: _angular_core.InputSignalWithTransform; readonly filterApplied: _angular_core.OutputEmitterRef; readonly filterReset: _angular_core.OutputEmitterRef; private readonly transloco; protected readonly panelOpen: _angular_core.WritableSignal; protected pendingFilters: _angular_core.WritableSignal; protected appliedFilters: _angular_core.WritableSignal; private onChange; private onTouched; protected open(): void; /** "3 filters applied" under the drawer title, or empty when there are none. */ protected readonly filterSummary: _angular_core.Signal; protected filterableColumns: _angular_core.Signal; protected activeFilterCount: _angular_core.Signal; protected updateFilter(key: string, value: any): void; /** * A reversed date range can only ever match nothing, so it is never applied: * Apply is disabled while one is pending and the field explains why. */ protected readonly hasReversedDateRange: _angular_core.Signal; protected apply(): void; protected reset(): void; writeValue(value: TableFilters | null): void; registerOnChange(fn: (value: TableFilters) => void): void; registerOnTouched(fn: () => void): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare class TableFilterField { readonly column: _angular_core.InputSignal; readonly value: _angular_core.ModelSignal; private readonly transloco; protected readonly booleanOptions: _angular_core.Signal<{ label: string; value: boolean; }[]>; protected readonly multiValue: _angular_core.Signal; protected readonly filterOptions: _angular_core.Signal; protected readonly treeOptions: _angular_core.Signal[]>; protected readonly dateFrom: _angular_core.Signal; protected readonly dateTo: _angular_core.Signal; /** * The pickers already grey out days on the wrong side of the other bound, * but a typed date or a value set from outside can still arrive reversed — * this drives the message that explains why Apply is unavailable. */ protected readonly isDateRangeReversed: _angular_core.Signal; protected getFilterType(): string; /** * `select` / `userSelect` filters default to multi-select unless the caller * opts out with `filterConfig.multiple: false`. */ protected isMultiple(): boolean; protected getScalarValue(): any; protected getDateRangeValue(part: 'from' | 'to'): Date | null; protected getNumberRangeValue(part: 'from' | 'to'): number | null; protected getNumberRangeMin(): number; protected getNumberRangeMax(): number; protected updateScalar(next: any): void; protected getTreePlaceholder(): string; protected getTreeFilterBy(): string; protected getTreeFilterPlaceholder(): string; protected getTreeScrollHeight(): string; protected getTreePanelStyleClass(): string | undefined; protected updateDate(part: 'from' | 'to', next: Date | null): void; protected updateNumber(part: 'from' | 'to', next: number | null): void; private isPercentageColumn; private resolveConfiguredNumber; private clampNumberRangeValue; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Per-column filter affordance: a small funnel icon in the column header that * opens a popover with a single `TableFilterField`. * * Buffers edits in `pendingValue` until the user hits Apply — matches the * popover-mode UX so behavior is predictable between modes. Emits `filterChange` * with either the new value or `null` to clear. */ declare class TableColumnFilter { readonly column: _angular_core.InputSignal; readonly value: _angular_core.InputSignal; readonly filterChange: _angular_core.OutputEmitterRef; protected readonly pendingValue: _angular_core.WritableSignal; protected readonly hasActiveValue: _angular_core.Signal; private readonly popoverRef; constructor(); protected open(popover: Popover, event: Event): void; /** * Same rule as the filter drawer: a reversed date range is never applied. * Checked in `apply` too, because Enter in the popover calls it directly * and bypasses the disabled button. */ protected readonly hasReversedDateRange: _angular_core.Signal; protected apply(popover: Popover): void; protected clear(popover: Popover): void; private cloneValue; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** Visual variants for menu-item icon chips. */ type ActionMenuTone = 'excel' | 'pdf' | 'indigo' | 'secondary'; interface TableMenuItem extends MenuItem { /** Transloco key resolved in the template so translations stay reactive. */ labelKey?: string; /** Plain, already-translated or dynamic label — used when labelKey isn't set. */ rawLabel?: string; iconKey?: MTIcon; iconTone?: ActionMenuTone; /** When true, the item renders via `mt-avatar` instead of a flat tinted chip. */ useAvatar?: boolean; /** Small trailing chip (e.g. the group-by item's active column name). */ badge?: string; /** Used to mark the current selection in the group submenu. */ selected?: boolean; } /** * Top-right `⋯` menu. Uses PrimeNG TieredMenu (popup mode) so submenu * cascading, keyboard navigation, and outside-click-to-close come for free. * Item rendering is overridden via the `#item` template so each row shows * either a flat tone chip (main actions) or an `mt-avatar` (column picker). */ declare class TableActionsMenu { readonly exportable: _angular_core.InputSignalWithTransform; readonly printable: _angular_core.InputSignalWithTransform; readonly groupable: _angular_core.InputSignalWithTransform; readonly groupColumns: _angular_core.InputSignal; readonly activeGroup: _angular_core.InputSignal; readonly exportRequested: _angular_core.OutputEmitterRef; readonly printRequested: _angular_core.OutputEmitterRef; readonly groupChange: _angular_core.OutputEmitterRef; protected readonly menu: _angular_core.Signal; /** Tailwind classes for flat tone chips, keyed by `iconTone`. */ protected readonly toneClass: Record; /** Brand-coloured chips, which Tailwind's palette cannot name. */ protected readonly toneChipStyle: Partial>>; /** * The same hues for flat mode, as button severities. Rendered as their own * buttons the actions were all `secondary` grey, so export, print and * group-by looked identical until hovered. The brand tones keep a fitting * severity as the fallback and re-point its tokens (`toneButtonStyle`). */ protected readonly toneSeverity: Record; protected readonly toneButtonStyle: Partial>>; protected readonly items: _angular_core.Signal; /** True while the actions render as individual buttons. */ protected readonly isFlat: _angular_core.Signal; /** * What the popup renders. In `⋯` mode that's the whole action list; in flat * mode the buttons *are* the top level, so the popup only ever shows the * children of the button that opened it (the group-by column list). */ private readonly openSubmenu; protected readonly menuModel: _angular_core.Signal; protected toggle(event: MouseEvent): void; /** Flat-mode click: run a leaf action, or open a parent's submenu. */ protected activate(event: MouseEvent, item: TableMenuItem): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Stateless, controlled toolbar used by `mt-table` and by list-style consumers * (e.g. `client-list-cards-view`) so the two share one caption UI without * duplicating the search/filter/actions markup. * * The caption only renders the popover-mode filter button — per-column filter * icons live in the table header itself (cards have no columns). */ declare class TableCaption { readonly generalSearch: _angular_core.InputSignalWithTransform; readonly showFilters: _angular_core.InputSignalWithTransform; readonly filterMode: _angular_core.InputSignal; /** `filterMode: 'popover'` only — close the filter drawer on an outside click. */ readonly filterCloseOnOutsideClick: _angular_core.InputSignalWithTransform; readonly exportable: _angular_core.InputSignalWithTransform; readonly printable: _angular_core.InputSignalWithTransform; readonly groupable: _angular_core.InputSignalWithTransform; readonly columns: _angular_core.InputSignal; readonly data: _angular_core.InputSignal; readonly groupColumns: _angular_core.InputSignal; readonly tabs: _angular_core.InputSignal; readonly tabsOptionLabel: _angular_core.InputSignal; readonly tabsOptionValue: _angular_core.InputSignal; readonly actions: _angular_core.InputSignal; readonly captionStart: _angular_core.InputSignal | null>; readonly captionEnd: _angular_core.InputSignal | null>; readonly activeTab: _angular_core.ModelSignal; readonly filters: _angular_core.ModelSignal; readonly filterTerm: _angular_core.ModelSignal; readonly groupBy: _angular_core.ModelSignal; readonly exportRequested: _angular_core.OutputEmitterRef; readonly printRequested: _angular_core.OutputEmitterRef; readonly onTabChange: _angular_core.OutputEmitterRef; readonly searchChange: _angular_core.OutputEmitterRef; readonly filterApplied: _angular_core.OutputEmitterRef; readonly filterReset: _angular_core.OutputEmitterRef; protected readonly showsAnything: _angular_core.Signal; protected onSearch(term: string): void; protected onFilterApplied(next: TableFilters): void; protected onFilterReset(): void; /** * The filters currently narrowing the list, as removable chips. * * The filter panel used to be the only place a filter existed: close it and * nothing on screen said the list was narrowed, so a user could stare at an * unexpectedly short result set with no way to see why (finding H-11). A chip * row states it in the results' own space and clears one filter per click. */ protected readonly appliedFilterChips: _angular_core.Signal<{ key: string; label: string; value: string; }[]>; protected removeFilter(key: string): void; protected clearAllFilters(): void; protected onGroupChange(key: string | null): void; protected tabChanged(tab: any): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Centralises table export/print so any `mt-table` (and future tables) can * drop in the behaviour without reimplementing XLSX serialisation or print * DOM cloning. Injected schema-agnostically via `resolveValue` on the config. */ declare class TableExportService { private static readonly PRINT_ROOT_CLASS; private static readonly PRINT_REGION_CLASS; private static readonly PRINT_STYLE_ID; private static readonly MAX_PRINT_COLUMNS_PER_TABLE; private static readonly RTL_LANGUAGES; private readonly transloco; private static readonly PRINT_CSS; exportToExcel(config: TableExportConfig): void; private buildExcelWorkbook; printPdf(config: TablePrintConfig): void; private ensurePrintStyles; private getExportableColumns; private getExcelExportableColumns; /** * Resolves a single cell's exported/printed scalar. A column-level * `exportValue` always wins; everything else defers to the caller-supplied * resolver. The caller owns entity formatting too so Date/DateTime/Time can * use the configured MT formats instead of leaking raw ISO strings. */ private resolveCellValue; /** * Produces rows keyed by column label (Excel header row). * Values already passed through the caller's type-aware resolver. */ private buildLabeledRows; private buildPrintRegion; private buildPrintTable; /** * A browser cannot paginate a table horizontally. Keep wide exports inside * the printable page by splitting them into readable tables and repeating * the first (normally identifying) column in every continuation group. */ private getPrintColumnGroups; /** * Normalises a resolved cell value for export. Rich-text columns surface their * value as an HTML string, so string cells are stripped to plain text (tags * removed, entities decoded) before they reach an Excel cell or a PDF table * cell. Non-string values (numbers, booleans, dates) pass through untouched. */ private toPlainExportValue; private configureWorksheet; private isArabicExport; private isRtlExport; private normalizeFilename; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } export { EMPTY_GROUP_KEY, Table, TableActionsMenu, TableCaption, TableColumnFilter, TableExportService, TableFilter, TableFilterField, TableGroupingController, TableValueResolver }; export type { CellChangeEvent, ColumnDef, ColumnType, ColumnTypeForActionCell, FilterConfig, FilterOption, FilterValue, TableAction, TableActionConfirmationConfig, TableActionPlacement, TableActionShape, TableEntityUsage, TableExportConfig, TableExportValueResolver, TableFilterMode, TableFilters, TablePersistStateKey, TablePrintConfig, TableStatusMapValue };