forty-cdk 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"forty-cdk-table.mjs","names":[],"sources":["../../../projects/forty-cdk/table/src/flat-hierarchy.ts","../../../projects/forty-cdk/table/src/table-context.ts","../../../projects/forty-cdk/table/src/table-registry.ts","../../../projects/forty-cdk/table/src/selection-model.ts","../../../projects/forty-cdk/table/src/table-row-selection.ts","../../../projects/forty-cdk/table/src/table-expansion.ts","../../../projects/forty-cdk/table/src/table.ts","../../../projects/forty-cdk/table/src/table-header-cell.ts","../../../projects/forty-cdk/table/src/cell-tab-index.ts","../../../projects/forty-cdk/table/src/interactive-descendant.ts","../../../projects/forty-cdk/table/src/def-registry.ts","../../../projects/forty-cdk/table/src/column-def.ts","../../../projects/forty-cdk/table/src/row-def.ts","../../../projects/forty-cdk/table/src/table-cell.ts","../../../projects/forty-cdk/table/src/table-column-reorder.ts","../../../projects/forty-cdk/table/src/table-column-resizer.ts","../../../projects/forty-cdk/table/src/table-header-row.ts","../../../projects/forty-cdk/table/src/table-row.ts","../../../projects/forty-cdk/table/src/table-row-attrs.ts","../../../projects/forty-cdk/table/src/table-sort-header.ts","../../../projects/forty-cdk/table/src/table-body.ts","../../../projects/forty-cdk/table/src/table-variant-cell.ts","../../../projects/forty-cdk/table/src/table-row-selector.ts","../../../projects/forty-cdk/table/src/table-select-all.ts","../../../projects/forty-cdk/table/src/table-column-label.ts","../../../projects/forty-cdk/table/src/table-row-reorder.ts"],"sourcesContent":["/**\n * Computes `aria-posinset` / `aria-setsize` for every node in a **flat** list of\n * hierarchical rows, where depth is given only by each node's 1-based `level`\n * (as in an ARIA treegrid: rows are DOM siblings, hierarchy lives in `aria-level`).\n *\n * For a node at level `L`, its siblings are the nodes at the same level under the\n * same parent: contiguous `level === L` entries, skipping any deeper descendants\n * between them and bounded by the first shallower (`level < L`) entry on each side.\n *\n * Returns one `{ posinset, setsize }` entry per input level, in the same order.\n * Both are 1-based. An empty input returns an empty array.\n */\nexport function computeFlatHierarchy(\n levels: readonly number[],\n): { posinset: number; setsize: number }[] {\n const result: { posinset: number; setsize: number }[] = new Array(levels.length);\n const stack: { level: number; members: number[] }[] = [];\n\n const close = (group: { level: number; members: number[] }): void => {\n const setsize = group.members.length;\n for (const i of group.members) {\n result[i]!.setsize = setsize;\n }\n };\n\n for (let index = 0; index < levels.length; index++) {\n const level = levels[index]!;\n while (stack.length > 0 && stack[stack.length - 1]!.level > level) {\n close(stack.pop()!);\n }\n const top = stack[stack.length - 1];\n if (top && top.level === level) {\n top.members.push(index);\n result[index] = { posinset: top.members.length, setsize: 0 };\n } else {\n stack.push({ level, members: [index] });\n result[index] = { posinset: 1, setsize: 0 };\n }\n }\n\n while (stack.length > 0) {\n close(stack.pop()!);\n }\n\n return result;\n}\n","import { booleanAttribute, inject, InjectionToken, type Signal } from '@angular/core';\n\nimport {\n assertRootContext,\n fortyError,\n orphanContextError,\n TABLE_REGISTRATION_CONTEXT,\n TABLE_ROW_REGISTRATION_CONTEXT,\n type TableRegistrationContext,\n type TableRowRegistrationContext,\n type WritingDirection,\n} from 'forty-cdk/core';\n\n/** ARIA pattern the table renders as. `'table'` is the static structure; `'grid'` / `'treegrid'` add roving + 2D keyboard navigation. */\nexport type TableMode = 'table' | 'grid' | 'treegrid';\n\n/** Row-selection mode for `ForTable`. `'none'` disables selection. */\nexport type TableSelectionMode = 'none' | 'single' | 'multiple';\n\n/**\n * How a row click mutates selection. `'toggle'` flips it; `'replace'` replaces\n * (modifier-aware); `'none'` leaves it untouched, so only `[forTableRowSelector]`,\n * `[forTableSelectAll]` and `Space` on a focused grid cell mutate the selection.\n */\nexport type TableSelectionBehavior = 'toggle' | 'replace' | 'none';\n\n/** Aggregate selection state across the table's selectable rows, for the select-all tri-state. */\nexport type TableSelectAllState = 'none' | 'some' | 'all';\n\n/** Sticky placement for a cell: pinned to the start edge (`true`), the end edge (`'end'`), or not sticky (`false`). */\nexport type TableStickyValue = boolean | 'end';\n\n/**\n * Consumer-facing coordination surface owned by `ForTable`: the resolved ARIA\n * mode / direction / selection mode, the row counts, and the selection /\n * expansion commands.\n *\n * It carries neither the piece-registration protocol nor the\n * roving-grid model: how header rows, header cells, data rows, the declarative\n * body's row count, the virtualization seams and the resized column widths wire\n * themselves into the root, and where the grid's single tab stop currently\n * sits, are the library's own business and change without notice.\n */\nexport interface ForTableContext {\n /** The resolved ARIA mode; cells derive `role` (`cell` vs `gridcell`) from it, and navigation engages when it is not `'table'`. */\n readonly mode: Signal<TableMode>;\n /** The resolved writing direction (flips ArrowLeft / ArrowRight in `rtl`). */\n readonly dir: Signal<WritingDirection>;\n /** The active row-selection mode. `'none'` means selection is disabled. */\n readonly selectionMode: Signal<TableSelectionMode>;\n /** Returns whether `value` is currently in the selection. */\n isRowSelected(value: unknown): boolean;\n /** Toggles `value` in or out of the selection, respecting `selectionMode`. No-op in `'none'` mode. */\n toggleRowSelection(value: unknown): void;\n /**\n * Applies a row selection click with optional modifier keys, honoring `selectionBehavior`:\n * `'toggle'` always flips; `'replace'` replaces (Ctrl/Cmd toggles a single item,\n * Shift extends a range in multiple mode); `'none'` is a no-op that also leaves the\n * range anchor where it was.\n */\n selectRow(\n value: unknown,\n modifiers?: { ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean },\n ): void;\n /** Aggregate selection state across all selectable rows (`'none'` / `'some'` / `'all'`). */\n readonly selectAllState: Signal<TableSelectAllState>;\n /**\n * Selects all selectable rows when not all are selected; deselects them when all are, keeping\n * selected values outside the selectable rows. No-op outside `'multiple'` mode.\n */\n toggleSelectAll(): void;\n /**\n * The resolved true total data-row count for `aria-rowcount`, and the virtualized\n * scroll range unless `[forTableVirtualized]` narrows it with its own\n * `[virtualRowCount]`. Resolution order: the explicit `[rowCount]` input when set,\n * else the declarative `<for-table-body>`'s dataset length when a body has\n * registered one, else `undefined` (readers fall back to the rendered row count).\n */\n readonly rowCount: Signal<number | undefined>;\n /**\n * The count of currently loaded data rows (the declarative `<for-table-body>`\n * dataset length), or `undefined` when no body has registered one (raw-primitive\n * rendering). Distinct from `rowCount`, which an explicit `[rowCount]` raises to a\n * server-known total larger than the loaded rows; cross-window navigation clamps\n * unmounted targets to this so a target beyond the loaded prefix cannot stash a\n * pending focus move that resolves only when a far page later loads.\n */\n readonly loadedRowCount: Signal<number | undefined>;\n /**\n * Absolute index of the row that owns the currently roving-focused cell, or `null`\n * when no cell is focused (or the focused row carries no `virtualIndex`). Read by\n * `[forTableVirtualized]` to keep the focused row mounted across recycling.\n */\n readonly focusedRowIndex: Signal<number | null>;\n /** Whether `value` is in the open-rows set (`treegrid` expansion). */\n isRowExpanded(value: unknown): boolean;\n /** Toggles a parent row's expansion in/out of `[(expanded)]`. No-op when value is undefined. */\n toggleRowExpansion(value: unknown): void;\n}\n\n/**\n * The table's piece-coordination surface: the 2D roving grid model the rows,\n * cells and header cells resolve their `tabindex` / `data-highlighted` /\n * keydown through, and the ARIA index arithmetic derived from it.\n *\n * **Not** part of {@link ForTableContext} and never exported from\n * `public-api.ts`. A consumer reads the selection and expansion state off the\n * token; where the grid's single tab stop currently sits is the library's own\n * navigation model, refactored without notice.\n */\nexport interface TablePieceContext {\n /**\n * 1-based `aria-rowindex` for the header row in `grid` / `treegrid` mode (always\n * `1`, since ARIA counts the header row as the grid's first row), or `null` in\n * `mode=\"table\"` where no row index space exists.\n */\n readonly headerRowIndex: Signal<number | null>;\n /**\n * Offset ARIA adds to every data row's 1-based `aria-rowindex` so the numbering\n * counts the header row: `1` when a header row participates in the row-index\n * space (`grid` / `treegrid` mode with a registered header row), else `0`.\n */\n readonly dataRowIndexOffset: Signal<number>;\n /** Roving `tabindex` (`0` for the single tab stop, `-1` otherwise) for a header cell in grid mode. */\n headerCellTabIndex(host: HTMLElement): 0 | -1;\n /** 0-based index of a header cell host among registered header cells in DOM order, or -1 if not registered. */\n headerCellIndexOf(host: HTMLElement): number;\n /**\n * Whether the registered header cells form a complete row that joins the body's\n * roving composite grid (`grid` / `treegrid` mode, header cell count matches the\n * data column count). Draggable header cells (`[forTableColumnReorder]`) participate\n * too, so a column-reorderable grid stays a single composite tab stop. `false` in\n * `table` mode or when no header cells registered.\n */\n readonly headerParticipatesInRoving: Signal<boolean>;\n /**\n * The grid's rendered column count: the cell count of the first data row that has\n * any, else the registered header cell count. `0` while no cell has registered.\n * Read by `[forTableVariantCell]` for the `aria-colspan` of a full-span row, which\n * is the same count the declarative body spans with.\n */\n readonly columnCount: Signal<number>;\n /** 0-based index of a data row host in DOM order, or -1 if not registered. */\n rowIndexOf(host: HTMLElement): number;\n /** Roving `tabindex` (`0` for the single tab stop, `-1` otherwise) for a data cell in grid mode. */\n cellTabIndex(host: HTMLElement): 0 | -1;\n /** Whether a data cell is the currently roving-focused cell (drives `data-highlighted`). */\n isCellHighlighted(host: HTMLElement): boolean;\n /** Promotes a data cell to the active roving cell (called on the cell's `(focus)`). */\n activateCell(host: HTMLElement): void;\n highlightFromPointer(host: HTMLElement): void;\n /**\n * Resolves and applies a keydown originating on a grid cell: cell entry, the row keys,\n * and 2D move + focus. A data cell passes its `column`, which makes an `Enter` with no\n * widget to enter emit the root's `cellActivate`.\n */\n handleCellKeydown(event: KeyboardEvent, host: HTMLElement, column?: string): void;\n /** Whether `event` is an `Enter` keydown the root already resolved as a `cellActivate`. */\n isCellActivation(event: Event): boolean;\n /**\n * Resolves grid navigation and APG cell entry for a header cell that yields its host\n * interaction to a co-located `[forDraggable]`. `[forTableColumnReorder]` calls this\n * from a capture-phase listener for idle header cells so Arrow / Home / End / Page keys\n * move roving focus across the composite header + body grid and `F2` enters the cell;\n * the header cell itself calls it for the two keys targeted at an entered widget, which\n * that listener never sees — the `Tab` that cycles between the cell's widgets and the\n * `Escape` that returns focus from one — while Space / Enter fall through to the\n * draggable's lift. Returns `true` when the key was consumed,\n * `false` otherwise (including outside a participating `grid` / `treegrid`).\n */\n handleHeaderCellKeydown(event: KeyboardEvent, host: HTMLElement): boolean;\n /** 1-based `aria-posinset` for a row host among its same-level siblings (treegrid). */\n rowPosinset(host: HTMLElement): number;\n /** Total `aria-setsize` of a row host's same-level sibling set (treegrid). */\n rowSetsize(host: HTMLElement): number;\n}\n\n/**\n * The table's internal coordination surface: everything {@link ForTableContext}\n * publishes plus the {@link TablePieceContext} grid model.\n *\n * Never exported from `public-api.ts`. It is the type the pieces read\n * {@link FOR_TABLE_CONTEXT} at, so a consumer who injects that token gets the\n * read surface while the pieces get the navigation model. `ForTable` declares\n * those members TS-`private`, which keeps them out of the emitted `.d.ts` while\n * `useExisting` still satisfies this contract at runtime.\n *\n * Distinct from the **piece-registration** protocol, which is the one surface\n * that genuinely needs a second token: it lives in `forty-cdk/core` because\n * `forty-cdk/table-virtualization` registers through it.\n */\nexport interface TableContext extends ForTableContext, TablePieceContext {}\n\n/**\n * DI token for the table's coordination surface, provided by `[forTable]`.\n *\n * Publicly typed as the read surface {@link ForTableContext}, which is the whole of what\n * the token promises a consumer. The pieces read the same token at an internal type that\n * adds the roving grid model, so a wrapper re-providing it must alias it to the root:\n * `{ provide: FOR_TABLE_CONTEXT, useExisting: MyTable }`, where `MyTable` extends\n * `ForTable`. A value that merely satisfies the declared type resolves too, and is\n * rejected in dev mode by the first piece to reach the model.\n */\nexport const FOR_TABLE_CONTEXT = new InjectionToken<ForTableContext>('FOR_TABLE_CONTEXT');\n\n/**\n * Per-row read surface owned by `ForTableRow`, injected by its data cells. The\n * cell-registration half lives on {@link TableRowRegistrationContext}, so no `register*`\n * member reaches `ForTableRow`'s emitted public type.\n */\nexport interface ForTableRowContext {\n /** 0-based index of a cell host within this row in DOM order, or -1 if not registered. */\n cellIndexOf(host: HTMLElement): number;\n /** The active row-selection mode from the root table. */\n readonly selectionMode: Signal<TableSelectionMode>;\n /** Whether this row is currently selected. */\n readonly selected: Signal<boolean>;\n /** Toggles this row's selection. No-op when the row has no `[value]` or mode is `'none'`. */\n toggleSelected(): void;\n}\n\nexport const FOR_TABLE_ROW_CONTEXT = new InjectionToken<ForTableRowContext>(\n 'FOR_TABLE_ROW_CONTEXT',\n);\n\n/**\n * Coerces the `sticky` input value for header and data cells.\n * The string `'end'` pins the cell to the end edge; any other truthy value\n * (including the empty string from a bare `sticky` attribute) pins it to the\n * start edge; a falsy value means not sticky.\n */\nexport function coerceSticky(value: boolean | string): TableStickyValue {\n return value === 'end' ? 'end' : booleanAttribute(value);\n}\n\nconst COLUMN_NAME_PATTERN = /^[-_A-Za-z0-9]+$/;\n\n/**\n * Dev-mode guard for a column name before it is interpolated into CSS. Column\n * names flow into the `--for-table-col-<name>-width` custom property and the\n * `grid-template-columns` track string, where a space, `)`, `;`, or quote would\n * silently produce an invalid declaration and collapse the layout with no error.\n * Rejects any name outside letters, digits, hyphens, and underscores. No-op in\n * production builds.\n */\nexport function assertColumnName(name: string, piece: string): void {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !COLUMN_NAME_PATTERN.test(name)) {\n throw fortyError({\n code: 'FORCDK-TABLE-007',\n message: `Invalid column name ${JSON.stringify(name)} declared on ${piece}.`,\n cause:\n 'Column names are interpolated into the --for-table-col-<name>-width custom property and ' +\n 'into grid-template-columns, where anything else silently produces an invalid ' +\n 'declaration and collapses the layout.',\n fix: 'Use only letters, digits, hyphens, and underscores.',\n });\n }\n}\n\nconst TRACK_BREAKOUT_PATTERN = /[;{}\"']|\\/\\*/;\n\n/**\n * Dev-mode guard for a `grid-template-columns` track fragment before it is\n * interpolated into the derived track string. Unlike a column name a track\n * fragment has an open vocabulary (`minmax()`, `fit-content()`, `calc()`,\n * `clamp()`, `var()`), so this rejects only the shapes that **escape** the value\n * they are written into and collapse the whole track with no error: an empty\n * fragment (which contributes a missing entry and shifts every later column —\n * omit the input, or pass `null`, to mean \"unset\"), a `;` / `{` / `}` / quote /\n * `/*` that terminates the declaration, and unbalanced parentheses (a stray `)`\n * in a `fallbackWidth` closes its enclosing `var(` early and swallows the rest\n * of the track). No-op in production builds.\n */\nexport function assertColumnTrack(track: string, input: string, piece: string): void {\n if (typeof ngDevMode !== 'undefined' && !ngDevMode) {\n return;\n }\n const reason = columnTrackDefect(track);\n if (reason) {\n throw fortyError({\n code: 'FORCDK-TABLE-008',\n message: `Invalid ${input} ${JSON.stringify(track)} declared on ${piece}: ${reason}.`,\n cause:\n 'A track fragment is interpolated into the grid-template-columns string ForTableBody ' +\n 'derives, where a fragment that escapes its slot collapses the whole track with no error.',\n fix: 'Use a self-contained track value, or omit the input (or pass null) to leave it unset.',\n });\n }\n}\n\nfunction columnTrackDefect(track: string): string | null {\n if (track.trim() === '') {\n return 'the fragment is empty — omit the input (or pass null) to leave the track unset';\n }\n if (TRACK_BREAKOUT_PATTERN.test(track)) {\n return 'it contains a \";\", \"{\", \"}\", quote, or \"/*\" that terminates the declaration';\n }\n let depth = 0;\n for (const char of track) {\n if (char === '(') {\n depth++;\n } else if (char === ')' && --depth < 0) {\n return 'its parentheses are unbalanced';\n }\n }\n return depth === 0 ? null : 'its parentheses are unbalanced';\n}\n\n/**\n * Whether a header-cell host carries an active sort affordance — a\n * `[forTableSortHeader]` with `sortable` currently `true`, reflected as the\n * `data-sortable` marker. Detected by DOM marker rather than a value-import of\n * the sort header, so the grid cell-entry handler can defer `Enter` to the sort\n * activation (keeping focus on the cell) without a cross-piece value dependency.\n * A non-sortable header (no marker) keeps `Enter` as its cell-entry key.\n */\nexport function hostHasSortActivation(el: HTMLElement): boolean {\n return el.hasAttribute('data-sortable');\n}\n\nexport function injectTableContext(piece: string): TableContext {\n const ctx = inject(FOR_TABLE_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-009',\n piece,\n root: '[forTable]',\n token: 'FOR_TABLE_CONTEXT',\n });\n }\n const widened = ctx as TableContext;\n assertRootContext({\n entryPoint: 'table',\n token: 'FOR_TABLE_CONTEXT',\n root: '[forTable]',\n piece,\n probe: () => widened.cellTabIndex,\n });\n return widened;\n}\n\nexport function injectTableRegistration(piece: string): TableRegistrationContext {\n const ctx = inject(TABLE_REGISTRATION_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-010',\n piece,\n root: '[forTable]',\n token: 'TABLE_REGISTRATION_CONTEXT',\n });\n }\n return ctx;\n}\n\nexport function injectTableRowRegistration(piece: string): TableRowRegistrationContext {\n const ctx = inject(TABLE_ROW_REGISTRATION_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-011',\n piece,\n root: '[forTableRow]',\n token: 'TABLE_ROW_REGISTRATION_CONTEXT',\n });\n }\n return ctx;\n}\n\nexport function injectTableRowContext(piece: string): ForTableRowContext {\n const ctx = inject(FOR_TABLE_ROW_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-012',\n piece,\n root: '[forTableRow]',\n token: 'FOR_TABLE_ROW_CONTEXT',\n });\n }\n return ctx;\n}\n","import { ElementRef, inject, Injectable, signal, type Signal } from '@angular/core';\nimport { CssVarNamespacer } from '@angular/platform-browser';\n\nimport {\n Collection,\n type ForTableCellHandle,\n type ForTableRowHandle,\n type TableRegistrationContext,\n type TableVirtualRowNavigation,\n type TableVirtualWindow,\n} from 'forty-cdk/core';\n\n/**\n * Owns the table's piece-registration state — the header row element, the header\n * cell and data row collections, the declarative body's row count, the two\n * virtualization seams, the root's header-crossing focus resolver, the\n * pointer-reordered row index, and the published column-width custom properties.\n *\n * It exists as its own provider rather than as methods on `ForTable` so the\n * wiring protocol never reaches the public API: `ForTable` is exported, and any\n * `register*` / `set*` method on it would be callable (and therefore\n * semver-frozen) for consumers wrapping the root with `hostDirectives` or\n * subclassing it. Pieces reach it through `TABLE_REGISTRATION_CONTEXT`, which no\n * entry point exports; `ForTable` injects the class directly for the extra\n * lookup helpers it needs to derive its own read surface.\n */\n@Injectable()\nexport class TableRegistry implements TableRegistrationContext {\n readonly #rootEl = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #namespacer = inject(CssVarNamespacer);\n\n readonly #headerRowEl = signal<HTMLElement | null>(null);\n readonly #headerCells = new Collection<ForTableCellHandle>();\n readonly #rows = new Collection<ForTableRowHandle>();\n readonly #bodyRowCount = signal<Signal<number> | null>(null);\n readonly #virtualNav = signal<TableVirtualRowNavigation | null>(null);\n readonly #virtualWindow = signal<TableVirtualWindow | null>(null);\n readonly #reorderingRow = signal<number | null>(null);\n #headerCellFocus: ((column: number) => boolean) | null = null;\n\n /** The registered header row host, or `null` when no header row is mounted. */\n readonly headerRowEl = this.#headerRowEl.asReadonly();\n\n /** Registered header cells in DOM order. */\n readonly headerCells = this.#headerCells.items;\n\n /** Registered data rows in DOM order. */\n readonly rows = this.#rows.items;\n\n /** The declarative `<for-table-body>`'s dataset length, or `null` when none registered. */\n readonly bodyRowCount = this.#bodyRowCount.asReadonly();\n\n /** The registered cross-window row-navigation delegate, or `null` when not virtualized. */\n readonly virtualRowNavigation = this.#virtualNav.asReadonly();\n\n /** The registered rendered virtual window, or `null` when not virtualized. */\n readonly virtualWindow = this.#virtualWindow.asReadonly();\n\n /** Absolute index of the row currently being pointer-reordered, or `null`. */\n readonly reorderingRowIndex = this.#reorderingRow.asReadonly();\n\n /** Registers the header row's host so the root can measure its height. */\n registerHeaderRow(el: HTMLElement): void {\n this.#headerRowEl.set(el);\n }\n\n /** Unregisters the header row's host. Reference-based; safe to call if never registered. */\n unregisterHeaderRow(el: HTMLElement): void {\n if (this.#headerRowEl() === el) {\n this.#headerRowEl.set(null);\n }\n }\n\n /** Registers a header cell so it can join the composite roving-navigation grid. */\n registerHeaderCell(handle: ForTableCellHandle): void {\n this.#headerCells.register(handle);\n }\n\n /** Unregisters a header cell. Reference-based. */\n unregisterHeaderCell(handle: ForTableCellHandle): void {\n this.#headerCells.unregister(handle);\n }\n\n /** 0-based index of a header cell host among registered header cells, or -1. */\n headerCellIndexOf(host: HTMLElement): number {\n return this.#headerCells.indexOfHost(host);\n }\n\n /**\n * Installs the root's header-crossing focus resolver. `ForTable` installs it at\n * construction: the registry owns the header cell collection, but whether that row\n * joins the composite roving grid — and moving the grid's tab stop onto it — is the\n * root's navigation model. Root-only, so it stays off\n * {@link TableRegistrationContext} where the pieces read the protocol.\n *\n * Takes no `null`, unlike the virtualization seams: registry and root share a\n * lifetime, so there is no teardown to clear it from.\n */\n registerHeaderCellFocus(focus: (column: number) => boolean): void {\n this.#headerCellFocus = focus;\n }\n\n /** Moves roving focus onto the header cell in `column`; `false` when no header row joins the roving grid. */\n focusHeaderCell(column: number): boolean {\n return this.#headerCellFocus?.(column) ?? false;\n }\n\n /** Registers a data row so it joins the row index space and the navigation grid. */\n registerRow(handle: ForTableRowHandle): void {\n this.#rows.register(handle);\n }\n\n /** Unregisters a data row. Reference-based. */\n unregisterRow(handle: ForTableRowHandle): void {\n this.#rows.unregister(handle);\n }\n\n /** 0-based index of a data row host in DOM order, or -1 if not registered. */\n rowIndexOf(host: HTMLElement): number {\n return this.#rows.indexOfHost(host);\n }\n\n /** Registers (or clears, with `null`) the declarative body's dataset length. */\n registerBodyRowCount(count: Signal<number> | null): void {\n this.#bodyRowCount.set(count);\n }\n\n /** Registers (or clears, with `null`) the cross-window row-navigation delegate. */\n registerVirtualNavigation(navigation: TableVirtualRowNavigation | null): void {\n this.#virtualNav.set(navigation);\n }\n\n /** Registers (or clears, with `null`) the rendered virtual window. */\n registerVirtualWindow(window: TableVirtualWindow | null): void {\n this.#virtualWindow.set(window);\n }\n\n /** Sets (or clears, with `null`) the absolute index of the row being pointer-reordered. */\n setReorderingRow(index: number | null): void {\n this.#reorderingRow.set(index);\n }\n\n /** Publishes a column's resolved width as `--for-table-col-<column>-width` on the root. */\n setColumnWidth(column: string, width: number): void {\n this.#rootEl.style.setProperty(\n this.#namespacer.namespace(`--for-table-col-${column}-width`),\n `${width}px`,\n );\n }\n\n /** Removes a column's published `--for-table-col-<column>-width` custom property. */\n removeColumnWidth(column: string): void {\n this.#rootEl.style.removeProperty(\n this.#namespacer.namespace(`--for-table-col-${column}-width`),\n );\n }\n}\n","import { isSignal, type Signal, signal, type WritableSignal } from '@angular/core';\n\nimport {\n appendMissing,\n dedupeValues,\n defaultCompareWith,\n membership,\n selectionMembership,\n} from 'forty-cdk/core';\n\n/** Options for {@link SelectionModel}. */\nexport interface SelectionModelOptions<T> {\n /**\n * Allow more than one selected value. `false` (default) is single-select:\n * `select` / `setSelection` replace the prior value. Accepts a `Signal` so a\n * consumer whose mode is reactive (e.g. a table's `selectionMode`) can drive\n * it without reconstructing the model.\n */\n readonly multiple?: boolean | Signal<boolean>;\n /**\n * Equality comparator used for membership and de-duplication. Defaults to\n * `===` (correct for primitive values); supply an id-based comparator for\n * object values: `(a, b) => a.id === b.id`.\n */\n readonly compareWith?: ((a: T, b: T) => boolean) | Signal<(a: T, b: T) => boolean>;\n}\n\n/**\n * The table's internal signal-first selection-state helper. Single- or\n * multi-select with equality-aware membership; every mutating method returns\n * whether the selection actually changed.\n *\n * The model does **not** own its backing store: callers pass a\n * `WritableSignal<readonly T[]>` (typically their own `model()`), so there is a\n * single source of truth and no `effect()`-based sync. `selected` is a readonly\n * view of that source; mutators write through it.\n */\nexport class SelectionModel<T> {\n readonly #source: WritableSignal<readonly T[]>;\n readonly #multiple: Signal<boolean>;\n readonly #compareWith: Signal<(a: T, b: T) => boolean>;\n\n /** The current selection, in insertion order. Readonly view of the backing source. */\n readonly selected: Signal<readonly T[]>;\n\n readonly membership: Signal<(value: T) => boolean>;\n\n constructor(source: WritableSignal<readonly T[]>, options?: SelectionModelOptions<T>) {\n this.#source = source;\n this.selected = source.asReadonly();\n const multiple = options?.multiple ?? false;\n this.#multiple = isSignal(multiple) ? multiple : signal(multiple);\n const compareWith = options?.compareWith ?? defaultCompareWith;\n this.#compareWith = isSignal(compareWith) ? compareWith : signal(compareWith);\n this.membership = selectionMembership(this.#source, this.#compareWith);\n }\n\n /** Whether `value` is currently selected (under the comparator). */\n isSelected(value: T): boolean {\n return this.membership()(value);\n }\n\n /**\n * Select `values`. In single mode keeps only the last given value; in multi\n * mode appends those not already present. Returns whether anything changed.\n */\n select(values: readonly T[]): boolean {\n if (values.length === 0) {\n return false;\n }\n if (!this.#multiple()) {\n return this.#commit([values[values.length - 1]!]);\n }\n return this.#commit(appendMissing(this.#source(), values, this.#compareWith()));\n }\n\n /** Deselect `values`. Returns whether anything changed. */\n deselect(values: readonly T[]): boolean {\n if (values.length === 0) {\n return false;\n }\n const removed = membership(values, this.#compareWith());\n return this.#commit(this.#source().filter((v) => !removed(v)));\n }\n\n /** Toggle a single value. Returns whether anything changed (always `true`). */\n toggle(value: T): boolean {\n return this.isSelected(value) ? this.deselect([value]) : this.select([value]);\n }\n\n /**\n * Replace the entire selection with `values` (de-duplicated). In single mode\n * keeps only the last. Returns whether anything changed.\n */\n setSelection(values: readonly T[]): boolean {\n if (!this.#multiple() && values.length > 1) {\n return this.#commit([values[values.length - 1]!]);\n }\n return this.#commit(dedupeValues(values, this.#compareWith()));\n }\n\n /** Clear the selection. Returns whether anything changed. */\n clear(): boolean {\n return this.#commit([]);\n }\n\n #commit(next: readonly T[]): boolean {\n const current = this.#source();\n if (current.length === next.length) {\n const inNext = membership(next, this.#compareWith());\n if (next.every(this.membership()) && current.every(inNext)) {\n return false;\n }\n }\n this.#source.set(next);\n return true;\n }\n}\n","import { computed, type Signal, signal, type WritableSignal } from '@angular/core';\n\nimport { SelectionModel } from './selection-model';\nimport type {\n TableSelectAllState,\n TableSelectionBehavior,\n TableSelectionMode,\n} from './table-context';\n\n/** Modifier keys that alter a `'replace'`-behavior row click. */\nexport interface TableSelectionModifiers {\n readonly ctrlKey?: boolean;\n readonly metaKey?: boolean;\n readonly shiftKey?: boolean;\n}\n\n/**\n * Dependencies for {@link TableRowSelection}. Wires the helper to `ForTable`'s\n * `[(value)]` model, its selection inputs, and the aggregate value universe.\n */\nexport interface TableRowSelectionDeps<T> {\n /** Two-way bindable selected row values (each row's `[value]`). */\n readonly selection: WritableSignal<readonly T[]>;\n /** The active row-selection mode. `'none'` disables selection. */\n readonly selectionMode: Signal<TableSelectionMode>;\n /** How a row click mutates the selection (`'toggle'` / `'replace'` / `'none'`). */\n readonly selectionBehavior: Signal<TableSelectionBehavior>;\n /** Equality comparator for row values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n /**\n * Ordered universe of selectable row values for aggregate operations\n * (range extension, select-all tri-state). Spans rows beyond the rendered\n * window when the table is virtualized or server-paged.\n */\n readonly aggregateValues: Signal<readonly T[]>;\n}\n\n/**\n * Row-selection sub-model for `ForTable`. Owns the `SelectionModel`, the range\n * anchor, and the toggle / replace / range / select-all algorithms, decoupled\n * from the table root.\n *\n * Internal — not re-exported from `table/index.ts` or `public-api.ts`.\n */\nexport class TableRowSelection<T> {\n readonly #selectionMode: Signal<TableSelectionMode>;\n readonly #selectionBehavior: Signal<TableSelectionBehavior>;\n readonly #compareWith: Signal<(a: T, b: T) => boolean>;\n readonly #aggregateValues: Signal<readonly T[]>;\n\n readonly #model: SelectionModel<T>;\n readonly #anchor = signal<T | undefined>(undefined);\n\n /** Aggregate selection state across all selectable rows (`'none'` / `'some'` / `'all'`). */\n readonly selectAllState = computed<TableSelectAllState>(() => {\n const values = this.#aggregateValues();\n if (values.length === 0) {\n return 'none';\n }\n const isSelected = this.#model.membership();\n let count = 0;\n for (const v of values) {\n if (isSelected(v)) {\n count += 1;\n }\n }\n if (count === 0) {\n return 'none';\n }\n return count === values.length ? 'all' : 'some';\n });\n\n constructor(deps: TableRowSelectionDeps<T>) {\n this.#selectionMode = deps.selectionMode;\n this.#selectionBehavior = deps.selectionBehavior;\n this.#compareWith = deps.compareWith;\n this.#aggregateValues = deps.aggregateValues;\n this.#model = new SelectionModel<T>(deps.selection, {\n multiple: computed(() => deps.selectionMode() === 'multiple'),\n compareWith: deps.compareWith,\n });\n }\n\n /** Whether `value` is currently in the selection. */\n isSelected(value: T): boolean {\n return this.#model.isSelected(value);\n }\n\n /** Toggles `value` in or out of the selection and re-anchors. No-op in `'none'` mode. */\n toggle(value: T): void {\n if (this.#selectionMode() === 'none') {\n return;\n }\n this.#model.toggle(value);\n this.#anchor.set(value);\n }\n\n /**\n * Applies a row selection click with optional modifier keys, honoring\n * `selectionBehavior`: `'toggle'` always flips; `'replace'` replaces (Ctrl/Cmd\n * toggles a single item, Shift extends a range in multiple mode); `'none'` is a\n * no-op that also leaves the range anchor where it was, so a later\n * selector-driven range still extends from it.\n */\n select(value: T, modifiers?: TableSelectionModifiers): void {\n const mode = this.#selectionMode();\n const behavior = this.#selectionBehavior();\n if (mode === 'none' || behavior === 'none') {\n return;\n }\n if (behavior === 'toggle') {\n this.#model.toggle(value);\n this.#anchor.set(value);\n return;\n }\n const multiple = mode === 'multiple';\n if (multiple && modifiers?.shiftKey) {\n this.#selectRange(value);\n return;\n }\n if (multiple && (modifiers?.ctrlKey || modifiers?.metaKey)) {\n this.#model.toggle(value);\n this.#anchor.set(value);\n return;\n }\n this.#model.setSelection([value]);\n this.#anchor.set(value);\n }\n\n /** Selects all selectable rows when not all are selected; deselects them when all are. No-op outside `'multiple'` mode. */\n toggleSelectAll(): void {\n if (this.#selectionMode() !== 'multiple') {\n return;\n }\n if (this.selectAllState() === 'all') {\n this.#model.deselect(this.#aggregateValues());\n } else {\n this.#model.select(this.#aggregateValues());\n }\n }\n\n #selectRange(toValue: T): void {\n const values = this.#aggregateValues();\n const equals = this.#compareWith();\n const toIdx = values.findIndex((v) => equals(v, toValue));\n if (toIdx < 0) {\n return;\n }\n const anchor = this.#anchor();\n const anchorIdx = anchor === undefined ? -1 : values.findIndex((v) => equals(v, anchor));\n const start = anchorIdx < 0 ? toIdx : anchorIdx;\n const [lo, hi] = start <= toIdx ? [start, toIdx] : [toIdx, start];\n this.#model.setSelection(values.slice(lo, hi + 1));\n }\n}\n","import { type Signal, type WritableSignal } from '@angular/core';\n\nimport { selectionMembership } from 'forty-cdk/core';\n\n/**\n * Dependencies for {@link TableExpansion}. Wires the helper to `ForTable`'s\n * `[(expanded)]` model and the row-value comparator.\n */\nexport interface TableExpansionDeps<T> {\n /** Two-way bindable open parent-row values (each row's `[value]`). */\n readonly expanded: WritableSignal<readonly T[]>;\n /** Equality comparator for row values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n}\n\n/**\n * Treegrid expansion sub-model for `ForTable`. Owns the membership and mutation\n * algorithm for the `[(expanded)]` open-rows set, decoupled from the table root.\n *\n * Internal — not re-exported from `table/index.ts` or `public-api.ts`.\n */\nexport class TableExpansion<T> {\n readonly #expanded: WritableSignal<readonly T[]>;\n readonly #compareWith: Signal<(a: T, b: T) => boolean>;\n readonly #isExpanded: Signal<(value: T) => boolean>;\n\n constructor(deps: TableExpansionDeps<T>) {\n this.#expanded = deps.expanded;\n this.#compareWith = deps.compareWith;\n this.#isExpanded = selectionMembership(deps.expanded, deps.compareWith);\n }\n\n /** Whether `value` is currently in the open-rows set. */\n isExpanded(value: T): boolean {\n return this.#isExpanded()(value);\n }\n\n /**\n * Sets a parent row's expansion in or out of the open-rows set. No-op when\n * `value` is undefined or already in the requested state.\n */\n setExpanded(value: T, open: boolean): void {\n if (value === undefined) {\n return;\n }\n const current = this.#expanded();\n const has = this.isExpanded(value);\n if (open && !has) {\n this.#expanded.set([...current, value]);\n } else if (!open && has) {\n this.#expanded.set(current.filter((v) => !this.#compareWith()(v, value)));\n }\n }\n\n /** Toggles a parent row's expansion. No-op when `value` is undefined. */\n toggle(value: T): void {\n if (value === undefined) {\n return;\n }\n this.setExpanded(value, !this.isExpanded(value));\n }\n}\n","import {\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n output,\n type Provider,\n type Signal,\n signal,\n type Type,\n} from '@angular/core';\n\nimport {\n injectElementSize,\n composedContains,\n createPointerHighlight,\n defaultCompareWith,\n EscapeArbiter,\n findFirstFocusable,\n stepFocusableCycle,\n firstEnabledHost,\n type ForTableCellHandle,\n isImeComposing,\n type ForTableRowHandle,\n type GridNavigationAction,\n moveGridIndex,\n resolveGridNavigation,\n resolveTreegridExpandCollapse,\n TABLE_REGISTRATION_CONTEXT,\n type WritingDirection,\n injectReflectedDirection,\n injectTextDirection,\n RovingTabindex,\n hostAriaLabel,\n} from 'forty-cdk/core';\nimport { computeFlatHierarchy } from './flat-hierarchy';\nimport {\n FOR_TABLE_CONTEXT,\n hostHasSortActivation,\n type ForTableContext,\n type TableMode,\n type TableSelectionMode,\n type TableSelectionBehavior,\n type TableSelectAllState,\n} from './table-context';\nimport { TableRegistry } from './table-registry';\nimport { TableRowSelection } from './table-row-selection';\nimport { TableExpansion } from './table-expansion';\n\n/**\n * The value [ARIA reserves](https://www.w3.org/TR/wai-aria-1.2/#aria-rowcount) on\n * `aria-rowcount` / `aria-colcount` for a total the author cannot determine. It is\n * what a `grid` / `treegrid` reports when the count is genuinely unknowable rather\n * than merely zero: a `0` there would state that a grid claiming rows has no columns\n * at all (or that a windowed grid has no rows), a contradiction a screen reader\n * cannot reconcile — and `0` is itself in range, so it reads as a real answer rather\n * than as a missing one.\n *\n * The two channels qualify \"unknowable\" differently, and the asymmetry is deliberate: the row\n * channel gates on the grid being windowed, because a non-windowed grid's rendered rows *are* all\n * its rows; the column channel does not, because zero registered cells is degenerate markup rather\n * than a resolvable state. See `colCount`.\n */\nconst UNKNOWN_COUNT = -1;\n\n/**\n * Payload emitted by {@link ForTable.cellActivate} when `Enter` lands on a grid data\n * cell that holds no widget to enter.\n */\nexport interface TableCellActivateEvent<T> {\n /** The owning row's `[value]`, or `undefined` when the row carries none. */\n readonly row: T | undefined;\n /** The cell's column `name`. */\n readonly column: string;\n /** The originating `Enter` keydown, already `preventDefault`ed. */\n readonly event: KeyboardEvent;\n}\n\n/** Grid actions whose target may lie on a row outside the rendered virtualized window. */\nconst ROW_CROSSING_ACTIONS: ReadonlySet<GridNavigationAction> = new Set([\n 'next-row',\n 'prev-row',\n 'first',\n 'last',\n 'page-up',\n 'page-down',\n]);\n\n/**\n * Root of the Table primitive. Sets the ARIA `role` from `mode`, reflects\n * writing direction, and publishes the `--for-table-header-height` CSS custom\n * property (driven by a `ResizeObserver` on the first registered header row)\n * so consumers can `position: sticky` header cells without hard-coding offsets.\n *\n * Implements the [WAI-ARIA Table pattern](https://www.w3.org/WAI/ARIA/apg/patterns/table/)\n * and the [WAI-ARIA Grid pattern](https://www.w3.org/WAI/ARIA/apg/patterns/grid/).\n *\n * Use `mode=\"grid\"` or `mode=\"treegrid\"` for interactive grid semantics: a\n * single-tab-stop roving group with 2D arrow navigation over data cells.\n * The default `mode=\"table\"` is the static read-only structure.\n */\n@Directive({\n selector: '[forTable]',\n exportAs: 'forTable',\n host: {\n '[attr.role]': 'mode()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.dir]': 'reflectedDir()',\n '[attr.data-mode]': 'mode()',\n '[style.--for-table-header-height.px]': 'headerSize()?.height ?? null',\n '[attr.aria-rowcount]': 'rowCountAttr()',\n '[attr.aria-colcount]': 'colCountAttr()',\n '[attr.aria-multiselectable]':\n 'mode() !== \"table\" && selectionMode() === \"multiple\" ? \"true\" : null',\n '(focusout)': 'onFocusOut($event)',\n '(focusin)': 'onFocusIn($event)',\n '(pointerleave)': 'onPointerLeave()',\n },\n providers: provideForTable(ForTable),\n})\nexport class ForTable<T = unknown> implements ForTableContext {\n /**\n * ARIA role emitted on the host. `'table'` is the default static read-only\n * structure. `'grid'` and `'treegrid'` provide single-tab-stop roving + 2D\n * arrow navigation over data cells.\n */\n readonly mode = input<TableMode>('table');\n\n /**\n * Accessible label for the table. When set, reflected as `aria-label`.\n * Consumers with a visible caption should prefer pointing native\n * `aria-labelledby` at it instead; this input is the reactive convenience\n * hook for cases where no visible label element exists.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ariaLabel() || null);\n\n /**\n * Writing direction. When unset (default `null`), the inherited ambient direction is resolved\n * from the nearest ancestor carrying a `dir` attribute (or `<html dir>`), defaulting to `'ltr'`.\n * An explicit `[dir]` always wins. The resolved value is reflected to the host `dir` attribute\n * when a direction is set or declared.\n */\n readonly _dirInput = input<WritingDirection | null>(null, { alias: 'dir' });\n readonly dir = injectTextDirection(this._dirInput);\n private readonly reflectedDir = injectReflectedDirection(this._dirInput);\n\n /**\n * Explicit override for the true total data-row count (`aria-rowcount`, and the\n * virtualized scroll range unless `[forTableVirtualized]` narrows it with its own\n * `[virtualRowCount]`). A declarative `<for-table-body>` supplies this\n * automatically from its `rows` dataset length, so bind `[rowCount]` only for a\n * server-known total larger than the loaded rows; when set it wins over the\n * body-derived count. Defaults to the body count, else the rendered data-row\n * count plus the header offset — so an empty non-virtualized grid with a header\n * row reports `aria-rowcount=\"1\"`, because its rendered rows are all the rows it\n * has. A **windowed** grid with neither is the one shape whose total is\n * unknowable — its mounted rows are a slice of an uncounted dataset — so there\n * `aria-rowcount` reports `-1`, the value ARIA reserves for an unknown total,\n * whether or not rows are mounted. An explicit value is emitted verbatim,\n * including `0`. Ignored in `mode=\"table\"`.\n */\n readonly _rowCountInput = input<number | undefined>(undefined, { alias: 'rowCount' });\n\n readonly #registry = inject(TableRegistry);\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /**\n * Resolved true total data-row count: the explicit `[rowCount]` input when set,\n * else the declarative `<for-table-body>`'s dataset length, else `undefined`\n * (readers fall back to the rendered count). Feeds `aria-rowcount` and, unless\n * `[forTableVirtualized]` narrows it with its own `[virtualRowCount]`, the\n * virtualizer's count and the cross-window navigation bound.\n */\n readonly rowCount = computed<number | undefined>(\n () => this._rowCountInput() ?? this.#registry.bodyRowCount()?.(),\n );\n\n /**\n * The count of currently loaded data rows (the declarative `<for-table-body>`\n * dataset length), or `undefined` when no body has registered one (raw-primitive\n * rendering). Distinct from `rowCount`, which an explicit `[rowCount]` raises to a\n * server-known total larger than the loaded rows; cross-window navigation clamps\n * unmounted targets to this so a target beyond the loaded prefix cannot stash a\n * pending focus move that resolves — and steals focus — only when a far page later\n * loads.\n */\n readonly loadedRowCount = computed<number | undefined>(() => this.#registry.bodyRowCount()?.());\n\n /**\n * True total number of columns for `aria-colcount`. Defaults to the rendered\n * column count (the cells of the first data row that has any, else the registered\n * header cells) — and when no channel knows the count, `aria-colcount` reports\n * `-1`, the value ARIA reserves for an unknown total. That is the shape a\n * virtualized grid with no header row has until its first window resolves: no row\n * is rendered, so no cell has registered.\n *\n * Unlike `aria-rowcount`, that sentinel is **unconditional** — it is not gated on\n * the grid being windowed.\n * A non-windowed grid with no registered cell has rows without cells, or no markup\n * at all: degenerate either way, so there is no state where `0` is the resolved\n * answer rather than the missing one, and emitting it would re-open exactly the\n * \"`0` reads as a real answer\" defect the sentinel exists for.\n *\n * An explicit value is emitted verbatim, including `0`. Ignored in `mode=\"table\"`.\n */\n readonly colCount = input<number>();\n\n /** Row selection mode. `'none'` (default) disables selection entirely. */\n readonly selectionMode = input<TableSelectionMode>('none');\n\n /**\n * How a row click changes the selection. `'toggle'` (default) flips the clicked\n * row. `'replace'` replaces the selection with the clicked row; Ctrl/Cmd-click\n * toggles a single row and Shift-click extends a range (multiple mode only).\n * `'none'` leaves the selection untouched on a row click, so the row click is\n * free for whole-row activation while `[forTableRowSelector]`,\n * `[forTableSelectAll]` and `Space` on a focused grid cell keep driving the\n * selection — `aria-selected` and `aria-multiselectable` are unaffected.\n */\n readonly selectionBehavior = input<TableSelectionBehavior>('toggle');\n\n /**\n * Two-way bindable selected row values (each row's `[value]`). Single mode keeps\n * 0–1 entries. The implicit `valueChange` fires only on internal mutations\n * (selector / row click / Space / select-all), never on consumer writes. The\n * directive infers the row-value type `T` from this binding.\n */\n readonly value = model<readonly T[]>([]);\n\n /** Equality comparator for row values. Defaults to `===`; supply id-based for objects. */\n readonly compareWith = input<(a: T, b: T) => boolean>(defaultCompareWith);\n\n /**\n * Full ordered set of selectable row values (each row's `[value]`), for a\n * virtualized or server-paged table whose aggregate selection operations must\n * span rows beyond the rendered window. When `null` (default), the select-all\n * tri-state, `toggleSelectAll`, and Shift-click range selection compute against\n * the registered (rendered) rows only. When supplied, they use this set as the\n * universe of selectable values, so a range can span unmounted rows and the\n * tri-state reflects the true dataset. Per-row selection is unaffected.\n */\n readonly selectableValues = input<readonly T[] | null>(null);\n\n /**\n * Two-way bindable open parent-row values (each row's `[value]`), for\n * `mode=\"treegrid\"`. The implicit `expandedChange` fires only on internal\n * expand/collapse (ArrowRight/ArrowLeft, `toggleRowExpansion`), never on\n * consumer writes through `[(expanded)]`. Ignored outside `treegrid` mode.\n */\n readonly expanded = model<readonly T[]>([]);\n\n /**\n * Fires in `grid` / `treegrid` mode when `Enter` lands on a focused data cell that\n * holds no widget to enter, carrying the row's `[value]`, the cell's column `name` and\n * the event. A cell holding a widget still enters it on `Enter` and emits nothing; `F2`,\n * header cells, disabled cells and `mode=\"table\"` never emit.\n */\n readonly cellActivate = output<TableCellActivateEvent<T>>();\n\n private readonly headerSize = injectElementSize(this.#registry.headerRowEl);\n\n readonly #roving = new RovingTabindex(() => this.#flatCells());\n readonly #pointer = createPointerHighlight({ items: () => this.#flatCells() });\n readonly #enteredCell = signal<HTMLElement | null>(null);\n readonly #escapeArbiter = inject(EscapeArbiter);\n readonly #activations = new WeakSet<Event>();\n\n /**\n * The cell interaction mode was last suspended from, held only between the focusout that left\n * it and the next focusin. Plain state, not a signal: nothing derives from it, and the focus\n * pair that owns it reads and clears it in the same turn.\n */\n #restoreCell: HTMLElement | null = null;\n\n readonly #headerCellHosts = this.#registry.headerCells;\n readonly #dataCells = computed(() => this.#registry.rows().flatMap((row) => row.cells()));\n readonly #dataCols = computed(\n () =>\n this.#registry\n .rows()\n .find((row) => row.cells().length > 0)\n ?.cells().length ?? 0,\n );\n\n /**\n * Whether the registered header cells form a complete grid row that joins the body's\n * roving grid as its first row. True in `grid` / `treegrid` mode when at least one\n * header cell registered and the count matches the data column count (or there are no\n * data rows yet). Draggable header cells (a `[forTableColumnReorder]` row) register the\n * same way, so a column-reorderable grid still forms one composite tab stop across\n * header and body — the reorder wrapper hands its drop-list roving over to this grid via\n * `FOR_DROP_LIST_ROVING_DELEGATE` and routes idle header navigation through\n * `handleHeaderCellKeydown`.\n */\n readonly #headerParticipates = computed(() => {\n if (this.mode() === 'table') {\n return false;\n }\n const headerCount = this.#headerCellHosts().length;\n if (headerCount === 0) {\n return false;\n }\n const dataCols = this.#dataCols();\n return dataCols === 0 || headerCount === dataCols;\n });\n\n private readonly headerParticipatesInRoving = this.#headerParticipates;\n\n /**\n * The composite roving grid: the header cells (as grid row 0, when they form a\n * complete row) followed by the data cells in row-major order, so the table exposes\n * a single tab stop and arrow navigation crosses between the header and the body.\n */\n readonly #flatCells = computed<readonly ForTableCellHandle[]>(() =>\n this.#headerParticipates()\n ? [...this.#headerCellHosts(), ...this.#dataCells()]\n : this.#dataCells(),\n );\n readonly #cols = computed(() => {\n const dataCols = this.#dataCols();\n return dataCols > 0 ? dataCols : this.#headerCellHosts().length;\n });\n\n private readonly columnCount = this.#cols;\n\n /**\n * The cell that owns the tab stop while nothing is roving-active — the first\n * enabled cell of the composite grid.\n *\n * It walks the header row and then the data rows one at a time instead of\n * reading the materialized `#flatCells`, so it stops depending on a row's\n * `cells()` as soon as an earlier row has answered. Every cell's `tabindex`\n * binding is a live consumer of this signal and each row registers its cells\n * during that row's own update pass, so a dependency on the whole grid would make each\n * registration notify every cell mounted so far, which is quadratic in grid size.\n *\n * The header branch's fall-through is unreachable: header cells hardcode a\n * `false` `disabled`, and `#headerParticipates()` already rules out an empty\n * header row. It is kept so the walk stays equivalent to the `#flatCells`\n * concatenation if header cells ever gain a real disabled state.\n */\n readonly #firstEnabledCell = computed<HTMLElement | null>(() => {\n if (this.#headerParticipates()) {\n const fromHeader = firstEnabledHost(this.#headerCellHosts());\n if (fromHeader !== null) {\n return fromHeader;\n }\n }\n for (const row of this.#registry.rows()) {\n const fromRow = firstEnabledHost(row.cells());\n if (fromRow !== null) {\n return fromRow;\n }\n }\n return null;\n });\n\n /** Whether the header row participates in the row-index space (a header row is registered, non-table mode). */\n readonly #hasHeaderRowIndex = computed(\n () => this.mode() !== 'table' && this.#registry.headerRowEl() !== null,\n );\n\n /** 1-based row offset ARIA applies to data rows because the header row occupies index 1. */\n private readonly dataRowIndexOffset = computed(() => (this.#hasHeaderRowIndex() ? 1 : 0));\n\n private readonly headerRowIndex = computed<number | null>(() =>\n this.#hasHeaderRowIndex() ? 1 : null,\n );\n\n readonly #registeredValues = computed<readonly T[]>(() =>\n this.#registry\n .rows()\n .map((row) => row.value() as T)\n .filter((v) => v !== undefined),\n );\n readonly #aggregateValues = computed<readonly T[]>(\n () => this.selectableValues() ?? this.#registeredValues(),\n );\n\n readonly #selection = new TableRowSelection<T>({\n selection: this.value,\n selectionMode: this.selectionMode,\n selectionBehavior: this.selectionBehavior,\n compareWith: this.compareWith,\n aggregateValues: this.#aggregateValues,\n });\n\n readonly selectAllState: Signal<TableSelectAllState> = this.#selection.selectAllState;\n\n readonly #expansion = new TableExpansion<T>({\n expanded: this.expanded,\n compareWith: this.compareWith,\n });\n\n readonly #rowHierarchy = computed(() =>\n computeFlatHierarchy(this.#registry.rows().map((row) => row.level())),\n );\n\n #rowOfCell(cellHost: HTMLElement): ForTableRowHandle | undefined {\n return this.#registry.rows().find((row) => row.cells().some((cell) => cell.host === cellHost));\n }\n\n /**\n * Absolute index of the row that owns the currently roving-focused cell, or `null`\n * when no cell is focused (or the focused row carries no `virtualIndex`). Used by\n * `[forTableVirtualized]` to keep the focused row mounted across recycling.\n */\n readonly focusedRowIndex = computed<number | null>(() => {\n const active = this.#roving.active();\n if (active === null) {\n return null;\n }\n return this.#rowOfCell(active)?.virtualIndex() ?? null;\n });\n\n /**\n * Whether the grid is windowed — a `[forTableVirtualized]` companion has published\n * a rendered window, so the registered rows are a slice of the dataset rather than\n * all of it. That companion registers the window from its **constructor**, so this\n * already answers `true` server-side and on the first frame, for the raw-primitive\n * path as much as for `<for-table-body>`; being a signal read inside a `computed`\n * also makes the two directives' construction order on the shared host irrelevant.\n */\n readonly #windowed = computed(() => this.#registry.virtualWindow() !== null);\n\n private readonly rowCountAttr = computed<number | null>(() => {\n if (this.mode() === 'table') {\n return null;\n }\n const total = this.rowCount();\n if (total !== undefined) {\n return total + this.dataRowIndexOffset();\n }\n if (this.#windowed()) {\n return UNKNOWN_COUNT;\n }\n return this.#registry.rows().length + this.dataRowIndexOffset();\n });\n private readonly colCountAttr = computed<number | null>(() => {\n if (this.mode() === 'table') {\n return null;\n }\n const total = this.colCount();\n if (total !== undefined) {\n return total;\n }\n const rendered = this.#cols();\n return rendered === 0 ? UNKNOWN_COUNT : rendered;\n });\n\n constructor() {\n this.#registry.registerHeaderCellFocus((column) => this.#focusHeaderCell(column));\n }\n\n isRowExpanded(value: T): boolean {\n return this.#expansion.isExpanded(value);\n }\n\n toggleRowExpansion(value: T): void {\n this.#expansion.toggle(value);\n }\n\n private rowPosinset(host: HTMLElement): number {\n const index = this.#registry.rowIndexOf(host);\n return index < 0 ? 1 : (this.#rowHierarchy()[index]?.posinset ?? 1);\n }\n\n private rowSetsize(host: HTMLElement): number {\n const index = this.#registry.rowIndexOf(host);\n return index < 0 ? 1 : (this.#rowHierarchy()[index]?.setsize ?? 1);\n }\n\n private rowIndexOf(host: HTMLElement): number {\n return this.#registry.rowIndexOf(host);\n }\n\n /**\n * Roving tab-stop value for a cell: the active cell owns `0`, and before anything is\n * active the first enabled cell does.\n *\n * The gate is `holdsActive()` rather than `hasActive()` on purpose. `#roving` is built over\n * `#flatCells()`, so it already reconciles an active host away from a cell whose\n * **handle** reports disabled; `hasActive()` additionally discounts a host carrying\n * `aria-disabled`, which on a `[forTableColumnReorder]` header cell is owned by the\n * co-located `[forDraggable]` and means \"cannot be lifted\", not \"not a grid cell\". Going\n * through `hasActive()` therefore left a pinned column that is not `#firstEnabledCell()`\n * highlighted but with `tabindex=\"-1\"`, and the tab stop stranded on column 1\n * ([#1840](https://github.com/tutkli/forty-cdk/issues/1840)).\n */\n private cellTabIndex(host: HTMLElement): 0 | -1 {\n if (this.#roving.holdsActive()) {\n return this.#roving.isActive(host) ? 0 : -1;\n }\n return this.#firstEnabledCell() === host ? 0 : -1;\n }\n\n private headerCellTabIndex(host: HTMLElement): 0 | -1 {\n if (!this.#headerParticipates()) {\n return -1;\n }\n return this.cellTabIndex(host);\n }\n\n private headerCellIndexOf(host: HTMLElement): number {\n return this.#registry.headerCellIndexOf(host);\n }\n\n private isCellHighlighted(host: HTMLElement): boolean {\n if (this.#pointer.hasPointed()) {\n return this.#pointer.isPointed(host);\n }\n return this.#roving.isActive(host);\n }\n\n private activateCell(host: HTMLElement): void {\n if (this.mode() !== 'table') {\n this.#pointer.release();\n this.#roving.setActive(host);\n }\n }\n\n private highlightFromPointer(host: HTMLElement): void {\n if (this.mode() !== 'table') {\n this.#pointer.claim(host);\n }\n }\n\n private onPointerLeave(): void {\n this.#pointer.release();\n }\n\n /**\n * Moves roving focus onto the header cell in the 0-based `column`, answering `false`\n * when the header row does not join the composite grid, carries no such column, or\n * holds a disabled cell there — the same cells {@link moveGridIndex} refuses to land\n * on, so the two crossings stay equivalent.\n *\n * Registered with the registry rather than resolved by it: the registry owns the\n * header cell collection, but the header row's participation and the roving tab stop\n * are the root's model. `[forTableVirtualized]` calls it when an upward cross-window\n * walk steps over the last variant row above the dataset — the crossing this root\n * resolves through {@link moveGridIndex} when no virtualizer is involved\n * ([#1841](https://github.com/tutkli/forty-cdk/issues/1841)).\n */\n #focusHeaderCell(column: number): boolean {\n if (!this.#headerParticipates()) {\n return false;\n }\n const cell = this.#headerCellHosts()[column];\n if (cell === undefined || cell.disabled()) {\n return false;\n }\n this.#roving.focusActive(cell.host);\n return true;\n }\n\n isRowSelected(value: T): boolean {\n return this.#selection.isSelected(value);\n }\n\n toggleRowSelection(value: T): void {\n this.#selection.toggle(value);\n }\n\n selectRow(\n value: T,\n modifiers?: { ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean },\n ): void {\n this.#selection.select(value, modifiers);\n }\n\n toggleSelectAll(): void {\n this.#selection.toggleSelectAll();\n }\n\n #rowValueOfCell(cellHost: HTMLElement): T | undefined {\n for (const row of this.#registry.rows()) {\n if (row.cells().some((cell) => cell.host === cellHost)) {\n return row.value() as T;\n }\n }\n return undefined;\n }\n\n /**\n * Drops the entered-cell state as soon as focus leaves the cell it points at, by whatever\n * route — a pointer press elsewhere, a widget handing focus to an overlay of its own, or\n * focus leaving the table. The Tab cycle and the `Escape` return then only ever answer for\n * a cell that really holds the focus.\n *\n * Two hops that look like departures are not. A `relatedTarget` the browser retargeted to a\n * shadow host *above* the cell hides a destination that may well be inside it, so an ambiguous\n * hop keeps the state ({@link #retargeted}) — otherwise a cell rendered inside an open shadow\n * root would lose interaction mode on the very focus move that enters it.\n * And a `null` `relatedTarget` while the document itself has lost focus is a window blur rather\n * than a departure: the widget gets its focus back when the user returns, so interaction mode\n * has to survive with it.\n *\n * A real departure parks the cell instead of forgetting it, so {@link onFocusIn} can hand\n * interaction mode back when focus returns to one of its widgets.\n */\n private onFocusOut(event: FocusEvent): void {\n const entered = this.#enteredCell();\n if (!entered) {\n return;\n }\n const next = event.relatedTarget;\n if (\n next instanceof Node &&\n (composedContains(entered, next) || this.#retargeted(next, entered))\n ) {\n return;\n }\n if (next === null && !entered.ownerDocument.hasFocus()) {\n return;\n }\n this.#enteredCell.set(null);\n this.#restoreCell = entered;\n }\n\n /**\n * Whether `next` is a shadow host the browser retargeted a destination inside `entered` to: an\n * element strictly between this table's root and the entered cell, which a focus move can only\n * be reported as when the real target sits in a shadow tree below it. Bounding it to the table's\n * own subtree is what keeps focus moving to `<body>` — or to any tabbable ancestor of the table —\n * a departure rather than an ambiguous hop.\n */\n #retargeted(next: Node, entered: HTMLElement): boolean {\n return (\n next !== this.#host && composedContains(this.#host, next) && composedContains(next, entered)\n );\n }\n\n /**\n * Restores interaction mode when focus returns to a widget of the cell {@link onFocusOut} last\n * parked — the round trip a widget makes around an overlay of its own, such as a column-menu\n * button whose menu returns focus to it on close. Without it the widget comes back focused\n * inside a cell the grid no longer counts as entered, which is the state this whole keymap\n * exists to prevent.\n *\n * Focus landing anywhere else retires the parked cell, the cell host itself included: entry\n * resumes only where it left off, and Tab reaching a widget from outside the grid stays a plain\n * tab stop rather than silently becoming interaction mode.\n *\n * Focus reaching a widget inside a cell by any route also moves the roving tab stop onto that\n * cell, without entering interaction mode, so the tab stop and the row a virtualized grid keeps\n * mounted are always the ones holding focus.\n */\n private onFocusIn(event: FocusEvent): void {\n const target = event.target;\n if (target instanceof Node) {\n this.#followFocusIntoCell(target);\n }\n const restore = this.#restoreCell;\n if (!restore) {\n return;\n }\n this.#restoreCell = null;\n if (target instanceof Node && target !== restore && composedContains(restore, target)) {\n this.#enteredCell.set(restore);\n }\n }\n\n #followFocusIntoCell(target: Node): void {\n if (this.mode() === 'table') {\n return;\n }\n const cell = this.#flatCells().find(\n (handle) => handle.host !== target && composedContains(handle.host, target),\n );\n if (cell !== undefined && !cell.disabled() && this.#roving.active() !== cell.host) {\n this.#pointer.release();\n this.#roving.setActive(cell.host);\n }\n }\n\n private handleCellKeydown(event: KeyboardEvent, host: HTMLElement, column?: string): void {\n if (this.mode() === 'table' || (event.defaultPrevented && event.target === host)) {\n return;\n }\n this.#resolveCellKeydown(event, host, { rowActions: true, enterEntersCell: true, column });\n }\n\n private isCellActivation(event: Event): boolean {\n return this.#activations.has(event);\n }\n\n /**\n * Resolves grid navigation and APG cell entry for a header cell that yields its host\n * interaction to a co-located `[forDraggable]` (a `[forTableColumnReorder]` row).\n * `[forTableColumnReorder]` calls this from a capture-phase listener for idle (not-lifted)\n * header cells, so Arrow / Home / End / Page keys move roving focus across the composite\n * header + body grid and `F2` moves focus into the cell's first widget. `ForTableHeaderCell`\n * calls it from its own bubbling keydown for the two keys that listener cannot see, both\n * targeted at an entered widget rather than at a header cell — the `Tab` that cycles between\n * the cell's widgets and the `Escape` that returns focus from one. Space / Enter still fall\n * through to the draggable's lift and the sort activation. Returns `true` when the key was\n * consumed, `false` otherwise. No-op (returns `false`) outside `grid` / `treegrid` mode or\n * when the header row does not join the composite grid.\n */\n private handleHeaderCellKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if (this.mode() === 'table' || !this.#headerParticipates()) {\n return false;\n }\n return this.#resolveCellKeydown(event, host, { rowActions: false, enterEntersCell: false });\n }\n\n /**\n * The grid keymap both cell entries resolve against, so a key added to one reaches the\n * other: cell entry, then — for a key targeted at the cell host itself — the row actions\n * a data cell owns, then 2D grid navigation. Returns `true` when the key was consumed.\n *\n * `rowActions` adds the selection / expansion keys a data cell owns and a header cell has\n * no row for, plus the `Enter` activation when the data cell passes its `column`.\n * `enterEntersCell` is `false` where a co-located `[forDraggable]` owns `Enter` for the\n * lift and the sort activation.\n */\n #resolveCellKeydown(\n event: KeyboardEvent,\n host: HTMLElement,\n options: { rowActions: boolean; enterEntersCell: boolean; column?: string },\n ): boolean {\n this.#registry.virtualRowNavigation()?.clearPending();\n if (\n (options.enterEntersCell || event.key !== 'Enter') &&\n this.#handleCellEntryKeydown(event, host)\n ) {\n return true;\n }\n if (event.target !== host) {\n return false;\n }\n if (options.rowActions) {\n if (this.#handleSelectionKeydown(event, host)) {\n return true;\n }\n if (this.#handleExpansionKeydown(event, host)) {\n return true;\n }\n if (\n options.column !== undefined &&\n this.#handleActivationKeydown(event, host, options.column)\n ) {\n return true;\n }\n }\n return this.#handleGridNavigationKeydown(event, host);\n }\n\n /**\n * APG grid cell-entry mode: Enter or F2 on a focused cell moves focus into the\n * cell's first interactive widget; Tab / Shift+Tab then move between that cell's\n * widgets, and Escape returns focus to the owning cell. Returns `true` when the\n * event was consumed.\n *\n * A cell whose host carries an active sort affordance (`[forTableSortHeader]`\n * with `sortable`, marked by `data-sortable`) defers `Enter` to the sort\n * activation — `Enter` toggles the sort and focus stays on the cell — while\n * `F2` remains the cell-entry key, so a sortable + resizable header does not\n * both sort and drop focus onto the resize handle.\n *\n * The Tab cycle wraps at both ends and is `preventDefault`ed, so focus cannot leave the\n * entered cell for another cell's widget or the next document tab stop while the cell is\n * in interaction mode — Escape is the way out. It cycles the same *focusable* set `F2`\n * enters, so a widget the grid gives `tabindex=\"-1\"` (`[forTableColumnResizer]`,\n * `[forTableSelectAll]`) is reached rather than skipped. A cell holding a single widget\n * cycles back to it. Tab targeted at the cell host itself keeps its document-wide meaning.\n *\n * Escape is left to the dismissible-layer stack while an active layer sits above every\n * layer containing the cell (a tooltip on the cell's widget), so that overlay closes and\n * interaction mode is kept; a layer around the grid (a dialog) never takes it from here.\n */\n #handleCellEntryKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if ((event.key === 'Enter' || event.key === 'F2') && event.target === host) {\n if (event.key === 'Enter' && hostHasSortActivation(host)) {\n return false;\n }\n const target = findFirstFocusable(host);\n if (!target) {\n return false;\n }\n event.preventDefault();\n this.#enteredCell.set(host);\n target.focus();\n return true;\n }\n if (event.key === 'Tab' && this.#enteredCell() === host && event.target !== host) {\n const from = event.target instanceof Element ? event.target : null;\n const next = stepFocusableCycle(host, from, event.shiftKey ? 'backward' : 'forward');\n if (!next) {\n return false;\n }\n event.preventDefault();\n next.focus();\n return true;\n }\n if (\n event.key === 'Escape' &&\n !isImeComposing(event) &&\n this.#enteredCell() === host &&\n event.target !== host &&\n !this.#escapeArbiter.hasEscapeLayerAbove(host)\n ) {\n event.preventDefault();\n this.#enteredCell.set(null);\n host.focus();\n return true;\n }\n return false;\n }\n\n #handleActivationKeydown(event: KeyboardEvent, host: HTMLElement, column: string): boolean {\n if (event.key !== 'Enter') {\n return false;\n }\n const row = this.#rowOfCell(host);\n if (\n !row ||\n row\n .cells()\n .find((cell) => cell.host === host)\n ?.disabled()\n ) {\n return false;\n }\n event.preventDefault();\n this.#activations.add(event);\n this.cellActivate.emit({ row: row.value() as T | undefined, column, event });\n return true;\n }\n\n #handleSelectionKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if (event.key !== ' ' || event.target !== host || this.selectionMode() === 'none') {\n return false;\n }\n const value = this.#rowValueOfCell(host);\n if (value === undefined) {\n return false;\n }\n event.preventDefault();\n this.#selection.toggle(value);\n return true;\n }\n\n /**\n * Treegrid expand / collapse, answered only on the first cell of an expandable row: on every\n * other cell the arrows navigate, so moving across a parent row's columns never changes its\n * state.\n */\n #handleExpansionKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if (this.mode() !== 'treegrid') {\n return false;\n }\n const intent = resolveTreegridExpandCollapse(event, this.dir());\n if (intent === null) {\n return false;\n }\n const row = this.#rowOfCell(host);\n if (!row?.expandable() || row.value() === undefined || row.cells()[0]?.host !== host) {\n return false;\n }\n const value = row.value() as T;\n const open = this.#expansion.isExpanded(value);\n if (intent === 'expand' && !open) {\n event.preventDefault();\n this.#expansion.setExpanded(value, true);\n return true;\n }\n if (intent === 'collapse' && open) {\n event.preventDefault();\n this.#expansion.setExpanded(value, false);\n return true;\n }\n return false;\n }\n\n #handleGridNavigationKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n const cols = this.#cols();\n const cells = this.#flatCells();\n if (cols === 0 || cells.length === 0) {\n return false;\n }\n const action: GridNavigationAction | null = resolveGridNavigation(event, {\n cols,\n dir: this.dir(),\n pageKeys: true,\n });\n if (action === null) {\n return false;\n }\n event.preventDefault();\n this.#pointer.suppress();\n const currentIndex = Math.max(\n 0,\n cells.findIndex((cell) => cell.host === host),\n );\n\n const navigation = this.#registry.virtualRowNavigation();\n const dataRow = this.focusedRowIndex();\n const fromRow = dataRow ?? (this.#isParticipatingHeaderCell(host) ? -1 : null);\n const total = navigation?.placeableRowCount() ?? 0;\n const pageSize = this.#pageSize();\n const headerIsRowTarget =\n this.#headerParticipates() && targetsHeaderRow(action, dataRow, pageSize);\n if (headerIsRowTarget) {\n navigation?.scrollToRow(0);\n }\n if (\n navigation !== null &&\n total > 0 &&\n fromRow !== null &&\n ROW_CROSSING_ACTIONS.has(action) &&\n !headerIsRowTarget\n ) {\n const col = currentIndex % cols;\n const target = resolveCrossWindowRowTarget(action, fromRow, col, total, cols, pageSize);\n if (target !== null) {\n navigation.navigateTo(target.row, target.col, target.direction);\n }\n return true;\n }\n\n const next = moveGridIndex(currentIndex, cells.length, action, {\n cols,\n pageSize,\n isDisabled: (i) => cells[i]!.disabled(),\n });\n if (next === null) {\n return true;\n }\n this.#roving.focusActive(cells[next]!.host);\n return true;\n }\n\n #isParticipatingHeaderCell(host: HTMLElement): boolean {\n return this.#headerParticipates() && this.#headerCellHosts().some((cell) => cell.host === host);\n }\n\n /**\n * Rows a PageUp / PageDown moves. One page is the number of rendered data rows\n * — in a virtualized grid that is the visible window (plus overscan), so paging\n * a 100k-row grid advances by a screenful rather than teleporting to an end. A\n * lone-row window still advances by at least one row.\n */\n #pageSize(): number {\n return Math.max(1, this.#registry.rows().length);\n }\n}\n\n/**\n * Resolves the absolute `(row, 0-based column)` target and travel `direction`\n * for a row-crossing grid action against the `total` count of rows the\n * virtualizer can place. `fromRow` is `-1` for a move starting on the header\n * row, so it lands on the dataset's rows rather than the rendered window's.\n * Arrow row-moves preserve the current column;\n * `page-up` / `page-down` move by\n * `pageSize` rows (the caller's `#pageSize()` is already at least 1, and the\n * move is clamped to the dataset bounds) preserving the column;\n * `last` jumps to the last cell of the whole grid. The `direction` (`+1` for\n * down / first, `-1` for up / last) is threaded to the virtualization bridge so\n * it can step over full-span variant rows onto the adjacent data row. Returns\n * `null` when the move would not change the focused row. The actions\n * {@link targetsHeaderRow} claims for a participating header row — `first`,\n * plus `prev-row` / `page-up` from within the first page of data rows — are\n * routed through the non-virtualized `moveGridIndex` path instead, so this\n * resolver's `first` case applies only to a header-less grid and its `prev-row`\n * / `page-up` cases clamp at data row 0 only when the header does not\n * participate.\n */\nfunction resolveCrossWindowRowTarget(\n action: GridNavigationAction,\n fromRow: number,\n col: number,\n total: number,\n cols: number,\n pageSize: number,\n): { row: number; col: number; direction: 1 | -1 } | null {\n switch (action) {\n case 'next-row':\n return fromRow + 1 < total ? { row: fromRow + 1, col, direction: 1 } : null;\n case 'prev-row':\n return fromRow - 1 >= 0 ? { row: fromRow - 1, col, direction: -1 } : null;\n case 'page-down': {\n const row = Math.min(total - 1, fromRow + pageSize);\n return row > fromRow ? { row, col, direction: 1 } : null;\n }\n case 'page-up': {\n const row = Math.max(0, fromRow - pageSize);\n return row < fromRow ? { row, col, direction: -1 } : null;\n }\n case 'first':\n return { row: 0, col: 0, direction: 1 };\n case 'last':\n return { row: total - 1, col: cols - 1, direction: -1 };\n default:\n return null;\n }\n}\n\n/**\n * Whether a row-crossing action lands on the header row of the composite grid,\n * given the absolute data row the move starts from (`null` when the focused cell\n * is not in a data row — a header cell, typically). Only meaningful when the\n * header participates in roving, in which case it is the grid's row 0 and the\n * data rows start at grid row 1:\n *\n * - `first` (`Ctrl+Home`) targets the first cell of the grid, i.e. the header.\n * - `prev-row` (`ArrowUp`) from data row 0 steps above the data, into the header.\n * - `page-up` from within the first page of data rows (`fromRow < pageSize`)\n * clamps to grid row 0, which is the header — mirroring `moveGridIndex`'s\n * clamp exactly.\n *\n * A header target is rendered whether or not the virtual window contains data\n * row 0, so `[forTable]` resolves these through the non-virtualized\n * `moveGridIndex` path rather than through the cross-window bridge; the caller\n * still asks the virtualizer to scroll back to row 0 first, so the grid is never\n * left focused on its header while the window sits at the bottom of the dataset.\n */\nfunction targetsHeaderRow(\n action: GridNavigationAction,\n fromRow: number | null,\n pageSize: number,\n): boolean {\n if (action === 'first') {\n return true;\n }\n if (fromRow === null) {\n return false;\n }\n if (action === 'prev-row') {\n return fromRow === 0;\n }\n return action === 'page-up' && fromRow < pageSize;\n}\n\n/**\n * The providers a `[forTable]` root installs: the public\n * {@link FOR_TABLE_CONTEXT}, aliased to `root`, plus the internal\n * piece-registration wiring the table's pieces resolve.\n *\n * `ForTable` declares its own providers through this helper, so a wrapper that\n * **subclasses** the root has a single call to keep in step with it. That\n * matters because Angular does not inherit a directive's `providers`: a subclass\n * carrying its own `@Directive` metadata replaces the array wholesale, so\n * re-providing `FOR_TABLE_CONTEXT` alone leaves the registration wiring absent\n * and every piece — down to the root's own constructor — fails to resolve it.\n * The internal providers are unnameable outside the library, which is why the\n * wrapper cannot list them by hand.\n *\n * ```ts\n * providers: provideForTable(MyTable),\n * ```\n *\n * Wrapping through `hostDirectives: [ForTable]` needs none of this — a host\n * directive brings its own providers to the element.\n */\nexport function provideForTable<T = unknown>(root: Type<ForTable<T>>): Provider[] {\n return [\n TableRegistry,\n { provide: FOR_TABLE_CONTEXT, useExisting: root },\n { provide: TABLE_REGISTRATION_CONTEXT, useExisting: TableRegistry },\n ];\n}\n","import {\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n type Signal,\n signal,\n} from '@angular/core';\n\nimport {\n type ForTableCellHandle,\n injectHostCarriesDragItem,\n injectPointerMove,\n isImeComposing,\n registerHandle,\n} from 'forty-cdk/core';\nimport {\n coerceSticky,\n injectTableContext,\n injectTableRegistration,\n type TableStickyValue,\n} from './table-context';\n\n/**\n * Marks a header cell (`role=\"columnheader\"`). Requires a `name` input that\n * identifies the column — reflected as `data-column` for later phases (sort,\n * resize, reorder) to key off. Optionally sticky via the `sticky` input.\n *\n * In `grid` / `treegrid` mode the header cell joins the roving-navigation grid\n * as a cell of the grid's first row, so the header and body share a single\n * composite tab stop and Arrow keys navigate between them. The active header\n * cell carries `tabindex=\"0\"` (others `-1`), reflects `data-highlighted` when\n * focused, and carries a 1-based `aria-colindex`.\n *\n * When a `[forDraggable]` shares the cell (a `[forTableColumnReorder]` row) the\n * cell still participates in that composite grid — `aria-colindex` and focus\n * activation stay on the cell — but it yields the host `tabindex`, the lift keys\n * and `data-highlighted` to the draggable, so the grid keeps a single tab stop\n * and `[forTableColumnReorder]` routes idle Arrow navigation and `F2` cell entry\n * across it. The cell keeps the two keys targeted at an entered widget: the `Tab` that\n * cycles between the cell's widgets and the `Escape` that returns focus from one.\n */\n@Directive({\n selector: '[forTableHeaderCell]',\n exportAs: 'forTableHeaderCell',\n host: {\n role: 'columnheader',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-colindex]': 'colIndex()',\n '[attr.data-column]': 'name()',\n '[attr.data-sticky]': \"sticky() ? (sticky() === 'end' ? 'end' : '') : null\",\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '(focus)': 'onFocus()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableHeaderCell {\n private readonly ctx = injectTableContext('ForTableHeaderCell');\n readonly #registration = injectTableRegistration('ForTableHeaderCell');\n\n /**\n * The header cell's host element (`role=\"columnheader\"`). Exposed so a descendant\n * `[forTableColumnResizer]` can resolve the enclosing cell through DI to measure its\n * base width — robust to `hostDirectives` composition, where the `[forTableHeaderCell]`\n * selector attribute is not reflected onto the wrapper's host element.\n */\n readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n readonly #host = this.el.nativeElement;\n\n /**\n * This header cell's element injector. Exposed so a declarative renderer stamping\n * header content from a projected `<ng-template>` (e.g. `ForTableBody`) can pass it\n * as `[ngTemplateOutletInjector]`, letting context-dependent primitives inside that\n * content resolve this cell and the table.\n */\n readonly injector = inject(Injector);\n\n /** Column identifier, reflected as `data-column`. Required by later phases (sort, resize, reorder). */\n readonly name = input.required<string>();\n\n readonly #labelEl = signal<HTMLElement | null>(null);\n\n /** Header cells are never disabled; exposed so the roving grid can treat them uniformly with data cells. */\n readonly #disabled = signal(false);\n\n /**\n * A co-located affordance (e.g. `[forTableSortHeader]`) that needs the header\n * cell to be a standalone `tabindex=\"0\"` tab stop whenever it is not part of the\n * body's roving composite grid — that is, in `mode=\"table\"`, or in a\n * column-reorder header row where the header does not join the roving grid. The\n * header cell is the single owner of the host `tabindex` — sibling directives\n * never bind it — so it reflects this intent instead of letting a second\n * `[tabindex]` binding fight it on the same element.\n */\n readonly #standaloneTabStop = signal<Signal<boolean> | null>(null);\n\n /**\n * Registers an intent that makes this header cell a `tabindex=\"0\"` tab stop when\n * it is not participating in the roving composite grid. Called by\n * `[forTableSortHeader]` so the two never bind `[tabindex]` on the same host.\n */\n registerStandaloneTabStop(active: Signal<boolean>): void {\n this.#standaloneTabStop.set(active);\n }\n\n /** Clears a previously registered standalone tab-stop intent. Reference-based. */\n unregisterStandaloneTabStop(active: Signal<boolean>): void {\n if (this.#standaloneTabStop() === active) {\n this.#standaloneTabStop.set(null);\n }\n }\n\n /**\n * The element a descendant `[forTableColumnLabel]` marks as this column's label\n * text, or `null` when no marker is present. A sibling `[forTableColumnResizer]`\n * reads it to measure the header label for header-inclusive auto-fit, isolating\n * the label from the resize handle / sort affordance without DOM assumptions.\n */\n readonly labelEl = this.#labelEl.asReadonly();\n\n /** Registers a descendant `[forTableColumnLabel]` as this header cell's label element. */\n registerLabel(el: HTMLElement): void {\n this.#labelEl.set(el);\n }\n\n /** Unregisters the label element. Reference-based; safe to call if never registered. */\n unregisterLabel(el: HTMLElement): void {\n if (this.#labelEl() === el) {\n this.#labelEl.set(null);\n }\n }\n\n /**\n * Sticky placement for this header cell. `true` (or the bare `sticky`\n * attribute) pins to the start edge; `'end'` pins to the end edge; `false`\n * (default) is not sticky. The consumer applies `position: sticky` and the\n * appropriate `top` / `left` / `right` offset in CSS — this input only\n * provides the `data-sticky` hook.\n */\n readonly sticky = input(false as TableStickyValue, { transform: coerceSticky });\n\n /** `true` when a `[forDraggable]` shares this cell and owns its host `tabindex` / lift keys instead. */\n readonly #yieldsToDraggable = injectHostCarriesDragItem(this.#host);\n\n /**\n * `true` when this header row joins the body's composite roving grid (`grid` /\n * `treegrid` mode with a complete header row). A draggable header cell\n * (`[forTableColumnReorder]`) still participates — it carries `aria-colindex`\n * and activates the roving cell on focus — even though it yields the host\n * `tabindex`, keydown, and `data-highlighted` to its co-located `[forDraggable]`.\n */\n readonly #participates = computed(() => this.ctx.headerParticipatesInRoving());\n\n /** `true` when this cell owns its host `tabindex` / keydown as a plain roving grid cell (no draggable). */\n readonly #inRovingGrid = computed(() => !this.#yieldsToDraggable() && this.#participates());\n\n private readonly tabindex = computed<0 | -1 | null>(() => {\n if (this.#yieldsToDraggable()) {\n return null;\n }\n if (this.#inRovingGrid()) {\n return this.ctx.headerCellTabIndex(this.#host);\n }\n return this.#standaloneTabStop()?.() ? 0 : null;\n });\n\n private readonly colIndex = computed<number | null>(() =>\n this.#participates() ? this.ctx.headerCellIndexOf(this.#host) + 1 : null,\n );\n\n private readonly highlighted = computed(\n () =>\n !this.#yieldsToDraggable() && this.#participates() && this.ctx.isCellHighlighted(this.#host),\n );\n\n constructor() {\n const handle: ForTableCellHandle = { host: this.#host, disabled: this.#disabled };\n registerHandle(\n handle,\n (h) => this.#registration.registerHeaderCell(h),\n (h) => this.#registration.unregisterHeaderCell(h),\n );\n injectPointerMove(() => this.#onPointerMove());\n }\n\n #onPointerMove(): void {\n if (this.#participates()) {\n this.ctx.highlightFromPointer(this.#host);\n }\n }\n\n private onFocus(): void {\n if (this.#participates()) {\n this.ctx.activateCell(this.#host);\n }\n }\n\n /**\n * A plain roving grid cell resolves the whole grid keymap. A cell that yields to a\n * co-located `[forDraggable]` gets every key targeted at the cell itself — Arrow / Home /\n * End / Page and the `F2` that enters the cell — from `[forTableColumnReorder]`'s capture\n * listener, and its `Space` / `Enter` from the draggable's lift and the sort activation.\n * What is left are the two keys that listener cannot see, both targeted at an entered\n * widget rather than at a header cell: the `Tab` that cycles between the cell's widgets\n * and the `Escape` that returns focus from one. A lift in progress (`data-dragging`) owns\n * every key.\n *\n * `Tab` is therefore routed only while it is targeted at a widget, never at the cell host,\n * where it is the ordinary tab stop out of the grid and routing it would put a whole grid\n * keymap resolution — `clearPending()` on the virtual row navigation included — behind a key\n * this cell has nothing to do with. It is also the one key exempt from the `defaultPrevented`\n * bail: an ancestor `FocusTrap` handles `Tab` from a `document` capture listener, so it runs\n * *before* this one and has already prevented the default whenever the entered widget sits on\n * one of the trap's edges. Bailing there would leave the cycle silently absent inside every\n * dialog, and the cell's own `preventDefault` + focus move is what settles where focus lands.\n */\n private onKeyDown(event: KeyboardEvent): void {\n if (this.#inRovingGrid()) {\n this.ctx.handleCellKeydown(event, this.#host);\n return;\n }\n const escape = event.key === 'Escape' && !isImeComposing(event);\n if (!escape && !(event.key === 'Tab' && event.target !== this.#host)) {\n return;\n }\n if (\n !this.#yieldsToDraggable() ||\n !this.#participates() ||\n (escape && event.defaultPrevented) ||\n this.#host.hasAttribute('data-dragging')\n ) {\n return;\n }\n this.ctx.handleHeaderCellKeydown(event, this.#host);\n }\n}\n","import { computed, inject, type Signal } from '@angular/core';\n\nimport { FOR_TABLE_CONTEXT, injectTableContext } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/**\n * The `tabindex` an interactive control placed inside a table cell carries: `0` in\n * `mode=\"table\"`, where each control is its own tab stop, and `-1` in `grid` /\n * `treegrid`, where the control yields to the grid's single tab stop and is reached\n * through cell entry (`Enter` / `F2`). A control in a header cell answers `0` in a grid\n * too while the header row does not join it (an incomplete header row), since no cell\n * entry can reach it there. Outside a `[forTable]` it answers `0`, so a control that\n * also renders outside tables can bind it unconditionally.\n *\n * Must be called in an injection context. Bind the result as `[attr.tabindex]` on\n * a natively focusable element.\n */\nexport function injectTableCellTabIndex(): Signal<0 | -1> {\n const table = inject(FOR_TABLE_CONTEXT, { optional: true });\n const header = inject(ForTableHeaderCell, { optional: true })\n ? injectTableContext('injectTableCellTabIndex')\n : null;\n return computed(() => {\n if (!table || table.mode() === 'table') {\n return 0;\n }\n return header && !header.headerParticipatesInRoving() ? 0 : -1;\n });\n}\n","const INTERACTIVE_ROLES = [\n 'button',\n 'link',\n 'checkbox',\n 'radio',\n 'switch',\n 'tab',\n 'menuitem',\n 'menuitemcheckbox',\n 'menuitemradio',\n 'option',\n 'textbox',\n 'searchbox',\n 'combobox',\n 'slider',\n 'spinbutton',\n 'treeitem',\n];\n\nconst INTERACTIVE_DESCENDANT_SELECTOR = /* @__PURE__ */ [\n 'button',\n 'a[href]',\n 'input',\n 'select',\n 'textarea',\n 'summary',\n 'label',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable=\"true\"]',\n '[contenteditable=\"\"]',\n '[contenteditable=\"plaintext-only\"]',\n ...INTERACTIVE_ROLES.map((role) => `[role=\"${role}\"]`),\n].join(', ');\n\n/**\n * Whether `event` originated from an interactive element nested inside the element\n * whose listener received it (`event.currentTarget`, typically a row): a `button`,\n * `a[href]`, `input`, `select`, `textarea`, `summary`, `label`,\n * `audio`/`video[controls]`, an editable `contenteditable` region (`\"\"` / `\"true\"` /\n * `\"plaintext-only\"`, but not `\"false\"`), or an element carrying an interactive ARIA\n * `role`. A click on cell text, the gaps between cells, or the listening element\n * itself reports `false`.\n *\n * The table's own row activation, row-click selection and sort headers use this definition\n * to leave a click or `Enter` to the inner control that owns it; call it from a row listener\n * of your own to skip the same events.\n */\nexport function eventFromInteractiveDescendant(event: Event): boolean {\n const rowEl = event.currentTarget;\n return rowEl instanceof HTMLElement && isInteractiveDescendant(event.target, rowEl);\n}\n\nexport function isInteractiveDescendant(target: EventTarget | null, container: Element): boolean {\n if (!(target instanceof Element)) {\n return false;\n }\n const interactive = target.closest(INTERACTIVE_DESCENDANT_SELECTOR);\n return interactive !== null && interactive !== container && container.contains(interactive);\n}\n","import {\n computed,\n DestroyRef,\n ElementRef,\n inject,\n Injectable,\n InjectionToken,\n type Provider,\n type Signal,\n} from '@angular/core';\n\nimport { boundEntries, Collection, fortyError } from 'forty-cdk/core';\n\nimport type {\n ForTableColumnDef,\n ForTableColumnDragPlaceholder,\n ForTablePlaceholderCellDefault,\n} from './column-def';\nimport type { ForTableRowDef } from './row-def';\n\n/**\n * The def registry a `<for-table-body>` renders from — the seam that lets a\n * **scaffold wrapper** own the table shell while its consumers keep declaring\n * plain `[forTableColumnDef]` / `[forTableRowDef]` blocks.\n *\n * Defs discover their registry through DI at construction, and element DI follows\n * the **declaration** tree: a def projected through a wrapper's `<ng-content>` is\n * a child of the wrapper's host, not of the `<for-table-body>` inside the\n * wrapper's template, so it never sees the body's own registry. A wrapper\n * therefore provides its own registry with `provideForTableDefRegistry()` and\n * hands it to its inner body through `[defs]`; projected defs register with it,\n * and the body renders them exactly as if they had been declared inside its own\n * tags. See the table README for the full recipe.\n *\n * A **preset column component** (`<my-text-column name=\"code\" …>` collapsing a\n * column's header / data templates into one line) needs none of this: the preset\n * host is declared inside the body's tags, so the def in the preset's view\n * resolves the body's registry through the element-injector chain.\n *\n * The read members here are the whole public surface. How defs wire themselves\n * into a registry is a separate, unexported protocol, so the library keeps\n * refactoring it; the only supported implementation is the one\n * `provideForTableDefRegistry()` installs, and `<for-table-body>` rejects any\n * other value bound to `[defs]`.\n */\nexport interface ForTableDefRegistry {\n /**\n * The `name` of every registered `[forTableColumnDef]`, in document order — the\n * default column order a bound `<for-table-body>` renders. A wrapper can seed\n * its own `[displayedColumns]` from it (say, to move a fixed action column to\n * the end) without knowing which defs its consumer projected.\n *\n * Reading it resolves each def's `name` input, and a def whose binding is not\n * written yet is left out, so read it from a template, a `computed`, or an\n * `afterNextRender` — not from a constructor, where the projected defs' inputs\n * are not bound yet and the list would come back short.\n */\n readonly columnNames: Signal<readonly string[]>;\n}\n\nexport const FOR_TABLE_DEF_REGISTRY = new InjectionToken<ForTableDefRegistry>(\n 'FOR_TABLE_DEF_REGISTRY',\n);\n\n/**\n * One registered def paired with the DOM node that positions it — the comment\n * anchor of its `<ng-container>`, or the element it sits on. The node orders the\n * registry in document position, so a def declared inside a preset component's\n * view (which constructs after every directly declared def) still renders in its\n * authored place.\n */\nexport interface TableDefHandle<D> {\n /**\n * The def's host node — the comment anchor of its `<ng-container>` /\n * `<ng-template>`, or the element it sits on.\n */\n readonly host: Node;\n /** The registered def instance. */\n readonly def: D;\n}\n\n/**\n * The def-registration protocol: how the four declarative pieces wire themselves\n * into the registry a `<for-table-body>` reads. Kept off\n * {@link ForTableDefRegistry} — this is the surface the library refactors, and\n * nothing outside `forty-cdk/table` needs to call it.\n */\nexport interface TableDefRegistration {\n /** Whether nothing at all has registered — the body's guard against defs registered on the wrong registry. */\n readonly isEmpty: Signal<boolean>;\n /** Registers a column def. */\n registerColumnDef(handle: TableDefHandle<ForTableColumnDef>): void;\n /** Unregisters a column def. Reference-based. */\n unregisterColumnDef(handle: TableDefHandle<ForTableColumnDef>): void;\n /** Registers a row variant def. */\n registerRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void;\n /** Unregisters a row variant def. Reference-based. */\n unregisterRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void;\n /** Registers the shared column drag placeholder template. */\n registerColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void;\n /** Unregisters the shared column drag placeholder template. Reference-based. */\n unregisterColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void;\n /** Registers the body-level default placeholder-cell template. */\n registerPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void;\n /** Unregisters the body-level default placeholder-cell template. Reference-based. */\n unregisterPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void;\n}\n\n/** A registered column def whose `name` binding is written, with the name it was read with. */\nexport interface BoundColumnDef {\n readonly def: ForTableColumnDef;\n readonly name: string;\n}\n\n/** A registered row variant def whose `when` binding is written, with the predicate it was read with. */\nexport interface BoundRowDef {\n readonly def: ForTableRowDef<unknown>;\n readonly when: (row: unknown, index: number) => boolean;\n}\n\nexport const TABLE_DEF_REGISTRATION = new InjectionToken<TableDefRegistration>(\n 'TABLE_DEF_REGISTRATION',\n);\n\n/**\n * Owns the registered declarative defs of one `<for-table-body>`, exposing them\n * in document order.\n *\n * Document order (rather than construction order) is what keeps the seam a\n * drop-in replacement for the content queries it replaces: a def inside a preset\n * component's view constructs after every directly declared def, an `@if`-mounted\n * def constructs whenever it mounts, and a `@for`-reordered set of defs moves its\n * nodes without re-running constructors. `Collection` resolves all three from the\n * handles' host nodes.\n */\n@Injectable()\nexport class TableDefRegistry implements ForTableDefRegistry, TableDefRegistration {\n readonly #columns = new Collection<TableDefHandle<ForTableColumnDef>>();\n readonly #rowDefs = new Collection<TableDefHandle<ForTableRowDef<unknown>>>();\n readonly #dragPlaceholders = new Collection<TableDefHandle<ForTableColumnDragPlaceholder>>();\n readonly #placeholderDefaults = new Collection<TableDefHandle<ForTablePlaceholderCellDefault>>();\n\n /**\n * Registered column defs, in document order.\n *\n * A def registers in its view's **creation** pass but has its `name` bound in\n * that view's **update** pass, and for a def declared in a preset component's\n * view those two passes straddle the body's own render — so a def is held back\n * until its name can be read. Reading the unwritten input tracks it, so the\n * binding's write folds the def in. See `unsetInput`.\n */\n readonly columnDefs: Signal<readonly BoundColumnDef[]> = computed(() =>\n boundEntries(\n this.#columns.items().map((handle) => handle.def),\n (def) => def.name(),\n ).map(({ handle: def, value: name }) => ({ def, name })),\n );\n\n /**\n * Registered row variant defs, in document order (first match wins per datum).\n * Held back until the def's `when` predicate can be read, exactly like\n * {@link columnDefs}.\n */\n readonly rowDefs: Signal<readonly BoundRowDef[]> = computed(() =>\n boundEntries(\n this.#rowDefs.items().map((handle) => handle.def),\n (def) => def.when(),\n ).map(({ handle: def, value: when }) => ({ def, when })),\n );\n\n /** The shared column drag placeholder (the first in document order), or `null`. */\n readonly columnDragPlaceholder: Signal<ForTableColumnDragPlaceholder | null> = computed(\n () => this.#dragPlaceholders.items()[0]?.def ?? null,\n );\n\n /** The body-level default placeholder-cell template (the first in document order), or `null`. */\n readonly placeholderCellDefault: Signal<ForTablePlaceholderCellDefault | null> = computed(\n () => this.#placeholderDefaults.items()[0]?.def ?? null,\n );\n\n /** The `name` of every registered column def, in document order. */\n readonly columnNames: Signal<readonly string[]> = computed(() =>\n this.columnDefs().map((column) => column.name),\n );\n\n /** Whether no def of any kind is registered. */\n readonly isEmpty: Signal<boolean> = computed(\n () =>\n this.#columns.items().length === 0 &&\n this.#rowDefs.items().length === 0 &&\n this.#dragPlaceholders.items().length === 0 &&\n this.#placeholderDefaults.items().length === 0,\n );\n\n /** Registers a column def so it joins the rendered columns at its document position. */\n registerColumnDef(handle: TableDefHandle<ForTableColumnDef>): void {\n this.#columns.register(handle);\n }\n\n /** Unregisters a column def. Reference-based. */\n unregisterColumnDef(handle: TableDefHandle<ForTableColumnDef>): void {\n this.#columns.unregister(handle);\n }\n\n /** Registers a row variant def so its matched data rows render the variant. */\n registerRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void {\n this.#rowDefs.register(handle);\n }\n\n /** Unregisters a row variant def. Reference-based. */\n unregisterRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void {\n this.#rowDefs.unregister(handle);\n }\n\n /** Registers the shared drag placeholder stamped into every reorderable header cell. */\n registerColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void {\n this.#dragPlaceholders.register(handle);\n }\n\n /** Unregisters the shared column drag placeholder. Reference-based. */\n unregisterColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void {\n this.#dragPlaceholders.unregister(handle);\n }\n\n /** Registers the default placeholder-cell template columns fall back to. */\n registerPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void {\n this.#placeholderDefaults.register(handle);\n }\n\n /** Unregisters the default placeholder-cell template. Reference-based. */\n unregisterPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void {\n this.#placeholderDefaults.unregister(handle);\n }\n}\n\n/**\n * The provider set installing a def registry on a host: the registry itself, the\n * public {@link FOR_TABLE_DEF_REGISTRY} read token, and the internal\n * registration protocol the declarative defs resolve.\n *\n * `<for-table-body>` declares it so defs declared inside its own tags register\n * with it. A **scaffold wrapper** declares it too, so defs its consumers project\n * through `<ng-content>` reach a registry at all, and binds\n * `inject(FOR_TABLE_DEF_REGISTRY)` to its inner body's `[defs]`.\n */\nexport function provideForTableDefRegistry(): Provider[] {\n return [\n TableDefRegistry,\n { provide: FOR_TABLE_DEF_REGISTRY, useExisting: TableDefRegistry },\n { provide: TABLE_DEF_REGISTRATION, useExisting: TableDefRegistry },\n ];\n}\n\n/**\n * Resolves the registry `<for-table-body>`'s own `providers` install.\n *\n * The lookup is optional only so the failure can be reported in the library's own\n * vocabulary: {@link TableDefRegistry} is absent from every barrel, so\n * a bare `NG0201: No provider found for _TableDefRegistry` names a symbol the\n * consumer cannot import and suggests no repair. The only shape that reaches it is\n * a subclass declaring its own `@Component` — Angular replaces the inherited\n * `providers` array wholesale — which is not a supported way to wrap the body.\n */\nexport function injectOwnTableDefRegistry(): TableDefRegistry {\n const registry = inject(TableDefRegistry, { optional: true });\n if (!registry) {\n throw fortyError({\n code: 'FORCDK-TABLE-001',\n message: '<for-table-body> found no def registry of its own.',\n cause:\n 'A subclass declaring its own @Component replaces the providers it would have inherited. ' +\n 'Subclassing the body is not a supported wrapping shape anyway, because a subclass ' +\n 'inherits no template either.',\n fix:\n \"Compose <for-table-body> inside a wrapper's template, and give the wrapper its own \" +\n \"provideForTableDefRegistry() bound to the body's [defs].\",\n });\n }\n return registry;\n}\n\nfunction injectTableDefRegistration(piece: string): TableDefRegistration {\n const registration = inject(TABLE_DEF_REGISTRATION, { optional: true });\n if (!registration) {\n throw fortyError({\n code: 'FORCDK-TABLE-002',\n message: `${piece} must be used inside a <for-table-body>.`,\n cause: `No TABLE_DEF_REGISTRATION provider is visible from ${piece}.`,\n fix:\n `Move ${piece} inside a <for-table-body>, or into a component that provides ` +\n \"provideForTableDefRegistry() and binds that registry to a body's [defs].\",\n });\n }\n return registration;\n}\n\nfunction injectDefHost(): Node {\n return inject<ElementRef<Node>>(ElementRef).nativeElement;\n}\n\n/**\n * Registers a `[forTableColumnDef]` with the surrounding registry for the def's\n * lifetime. Call it from the def's constructor — it resolves the registry, the\n * host node, and the `DestroyRef` from the ambient injection context.\n */\nexport function registerTableColumnDef(def: ForTableColumnDef): void {\n const registration = injectTableDefRegistration('ForTableColumnDef');\n const handle: TableDefHandle<ForTableColumnDef> = { host: injectDefHost(), def };\n registration.registerColumnDef(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterColumnDef(handle));\n}\n\n/**\n * Registers a `[forTableRowDef]` with the surrounding registry for the def's\n * lifetime, type-erased over the def's row type — the same erasure the\n * `contentChildren(ForTableRowDef)` query performed implicitly before defs registered\n * themselves. The body only ever matches a def against data from the same `rows`\n * input, so the erasure is sound.\n */\nexport function registerTableRowDef<T>(def: ForTableRowDef<T>): void {\n const registration = injectTableDefRegistration('ForTableRowDef');\n const handle: TableDefHandle<ForTableRowDef<unknown>> = {\n host: injectDefHost(),\n def: def as unknown as ForTableRowDef<unknown>,\n };\n registration.registerRowDef(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterRowDef(handle));\n}\n\n/**\n * Registers a `[forTableColumnDragPlaceholder]` with the surrounding registry for the\n * template's lifetime.\n */\nexport function registerTableColumnDragPlaceholder(def: ForTableColumnDragPlaceholder): void {\n const registration = injectTableDefRegistration('ForTableColumnDragPlaceholder');\n const handle: TableDefHandle<ForTableColumnDragPlaceholder> = { host: injectDefHost(), def };\n registration.registerColumnDragPlaceholder(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterColumnDragPlaceholder(handle));\n}\n\n/**\n * Registers a `[forTablePlaceholderCellDefault]` with the surrounding registry for the\n * template's lifetime.\n */\nexport function registerTablePlaceholderCellDefault(def: ForTablePlaceholderCellDefault): void {\n const registration = injectTableDefRegistration('ForTablePlaceholderCellDefault');\n const handle: TableDefHandle<ForTablePlaceholderCellDefault> = { host: injectDefHost(), def };\n registration.registerPlaceholderCellDefault(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterPlaceholderCellDefault(handle));\n}\n\n/**\n * Narrows a `[defs]`-bound registry to the library's own implementation. The\n * registration protocol is not public, so a hand-rolled `ForTableDefRegistry` has\n * no way to receive registrations — binding one is an authoring error, not a\n * supported extension point.\n */\nexport function assertTableDefRegistry(registry: ForTableDefRegistry): TableDefRegistry {\n if (!(registry instanceof TableDefRegistry)) {\n throw fortyError({\n code: 'FORCDK-TABLE-003',\n message: '<for-table-body> [defs] was bound to a value that is not a library def registry.',\n cause:\n 'The registration protocol is not public, so a hand-rolled ForTableDefRegistry has no way ' +\n 'to receive registrations.',\n fix: 'Bind [defs] to the registry provideForTableDefRegistry() installs.',\n });\n }\n return registry;\n}\n","import {\n booleanAttribute,\n contentChild,\n Directive,\n inject,\n input,\n TemplateRef,\n type InputSignal,\n} from '@angular/core';\n\nimport { assertInputBound, fortyError, unsetInput, type Unset } from 'forty-cdk/core';\n\nimport {\n registerTableColumnDef,\n registerTableColumnDragPlaceholder,\n registerTablePlaceholderCellDefault,\n} from './def-registry';\nimport {\n assertColumnName,\n assertColumnTrack,\n coerceSticky,\n type TableStickyValue,\n} from './table-context';\n\n/**\n * Template context handed to each `[forTableCellDef]` stamped by `ForTableBody`:\n * the row datum (`let-row`) and its 0-based dataset index (`let-i=\"index\"`).\n */\nexport interface ForTableCellDefContext<T> {\n /** The row datum for this cell (`let-row`). */\n $implicit: T;\n /**\n * 0-based dataset index of the row (`let-i=\"index\"`). In a non-virtualized\n * table this equals the row's rendered position; under `[forTableVirtualized]`\n * it is the **absolute** index into the full dataset, not the position within\n * the rendered window.\n */\n index: number;\n}\n\n/**\n * Marks the header-cell template of a column definition. Place on an\n * `<ng-template forTableHeaderCellDef>` inside a `[forTableColumnDef]`; its content is\n * stamped into the column's `[forTableHeaderCell]` by `ForTableBody`.\n */\n@Directive({ selector: 'ng-template[forTableHeaderCellDef]' })\nexport class ForTableHeaderCellDef {\n /** The captured header-cell template. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n}\n\n/**\n * Marks the data-cell template of a column definition. Place on an\n * `<ng-template forTableCellDef>` inside a `[forTableColumnDef]`; its content is stamped\n * into the column's `[forTableCell]` for every rendered row, with the row datum\n * and index exposed through `ForTableCellDefContext`.\n *\n * Bind `[forTableCellDefRow]` to the same array passed to `ForTableBody`'s `rows`\n * to type `let-row` — the input is read only for type inference, never at\n * runtime.\n *\n * When the row type is a discriminated union whose variant members render\n * through a `[forTableRowDef]` instead of the per-column cells, bind\n * `[forTableCellDefUnless]` to the same type guard(s) used on those defs' `[when]`\n * so `let-row` is narrowed to the variant-excluded members (`Exclude<T, V>`).\n */\n@Directive({ selector: 'ng-template[forTableCellDef]' })\nexport class ForTableCellDef<T, V extends T = never> {\n /** The captured data-cell template, typed with `ForTableCellDefContext<T>`. */\n readonly template = inject<TemplateRef<ForTableCellDefContext<T>>>(TemplateRef);\n\n /**\n * Type-inference hint: bind to the same collection as `ForTableBody`'s `rows`\n * so `let-row` is typed as the row type. Read only by the compiler; the\n * directive never touches its value.\n */\n readonly rowType = input<readonly T[]>([], { alias: 'forTableCellDefRow' });\n\n /**\n * Type-inference hint: bind the type guard(s) that match the variant rows\n * rendered by `[forTableRowDef]` (the same predicate used on their `[when]`) so\n * `let-row` is narrowed to `Exclude<T, V>` — the members this per-column\n * template actually receives. Compose several variants into one union guard\n * (`(r): r is A | B => …`). Read only by the compiler; the directive never\n * touches its value. Omitting it leaves `let-row` typed as the full `T`.\n */\n readonly excludeType = input<((row: T, index: number) => row is V) | null>(null, {\n alias: 'forTableCellDefUnless',\n });\n\n /** Narrows the template context type for `let-row` under strict template checking. */\n static ngTemplateContextGuard<T, V extends T>(\n _directive: ForTableCellDef<T, V>,\n _context: unknown,\n ): _context is ForTableCellDefContext<Exclude<T, V>> {\n return true;\n }\n}\n\n/**\n * Marks the placeholder/skeleton template of a column definition. Optional;\n * place on an `<ng-template forTablePlaceholderCellDef>` inside a `[forTableColumnDef]`. When\n * `ForTableBody` is in its `loading` state it stamps this into the column's\n * `[forTableCell]` for each placeholder row.\n *\n * It is the first step of a three-step resolution: a column's own\n * `[forTablePlaceholderCellDef]` wins, else the body-level\n * `[forTablePlaceholderCellDefault]`, else the cell stays empty.\n */\n@Directive({ selector: 'ng-template[forTablePlaceholderCellDef]' })\nexport class ForTablePlaceholderCellDef {\n /** The captured placeholder-cell template. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n}\n\n/**\n * Marks the **body-level default** placeholder/skeleton template. Optional and\n * declared **once per body** (not per column); place on an\n * `<ng-template forTablePlaceholderCellDefault>` among the `[forTableColumnDef]`s.\n * `ForTableBody` stamps it into every displayed column that declares no\n * `[forTablePlaceholderCellDef]` of its own — most columns of a table share one skeleton\n * shape, so it is declared once rather than repeated per def.\n *\n * Resolution order per column, in both stamping paths (`[loading]` placeholder\n * rows and `placeholderCells` row variants): the column's own\n * `[forTablePlaceholderCellDef]` → this default → an empty cell when neither exists.\n * The template receives no context, exactly like `[forTablePlaceholderCellDef]`.\n *\n * It registers itself with the surrounding body's def registry at construction,\n * so a wrapping component can declare it (or project it) — see\n * {@link ForTableDefRegistry}. Declared outside any registry it throws.\n */\n@Directive({ selector: 'ng-template[forTablePlaceholderCellDefault]' })\nexport class ForTablePlaceholderCellDefault {\n /** The captured default placeholder-cell template. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n\n constructor() {\n registerTablePlaceholderCellDefault(this);\n }\n}\n\n/**\n * Marks the shared drag placeholder for the reorderable columns of a\n * `<for-table-body>`. Optional and declared **once per body** (not per column);\n * place on an `<ng-template forTableColumnDragPlaceholder>` among the `[forTableColumnDef]`s.\n * `ForTableBody` stamps it as every reorderable header cell's\n * `[forDragPlaceholder]`, so during a pointer reorder the dragged column's slot\n * shows this template. Omit it to keep drag-drop's default placeholder behaviour.\n *\n * It registers itself with the surrounding body's def registry at construction,\n * so a wrapping component can declare it (or project it) — see\n * {@link ForTableDefRegistry}. Declared outside any registry it throws.\n */\n@Directive({ selector: 'ng-template[forTableColumnDragPlaceholder]' })\nexport class ForTableColumnDragPlaceholder {\n /** The captured placeholder template rendered in a reordered column's slot. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n\n constructor() {\n registerTableColumnDragPlaceholder(this);\n }\n}\n\n/**\n * Declarative definition of a single table column, co-locating its header,\n * data, and (optional) placeholder templates plus its per-column config in one\n * place. Place `[forTableColumnDef]` on an `<ng-container>` inside a `<for-table-body>`;\n * the container renders nothing itself — `ForTableBody` harvests the defs and\n * stamps the header row and data rows from them.\n *\n * The def **registers itself** with the surrounding body through DI at\n * construction (and unregisters when destroyed), so it does not have to be\n * declared content of the `<for-table-body>` element: a preset column component\n * may declare it in its own view, and a scaffold wrapper may project it into a\n * body it owns. See {@link ForTableDefRegistry} for both recipes. A def with no\n * reachable registry throws.\n *\n * @example\n * ```html\n * <ng-container forTableColumnDef=\"name\" sticky sortable resizable resizeAriaLabel=\"Resize name\">\n * <ng-template forTableHeaderCellDef>Name</ng-template>\n * <ng-template forTableCellDef [forTableCellDefRow]=\"rows()\" let-row>{{ row.name }}</ng-template>\n * </ng-container>\n * ```\n */\n@Directive({ selector: '[forTableColumnDef]' })\nexport class ForTableColumnDef {\n /**\n * Column identifier — reflected as `data-column` on the stamped cells and used to key the resize\n * width var. Mandatory — an unbound def throws in dev mode.\n */\n readonly name: InputSignal<string | Unset> = input(unsetInput<string>(), {\n alias: 'forTableColumnDef',\n });\n\n /**\n * Sticky placement forwarded to both the header cell and every data cell:\n * `true` (or the bare `sticky` attribute) pins to the start edge, `'end'` to\n * the end edge, `false` (default) is not sticky. The consumer applies\n * `position: sticky` + offsets in CSS off the emitted `data-sticky` hook.\n */\n readonly sticky = input(false as TableStickyValue, { transform: coerceSticky });\n\n /**\n * When set, the column's header cell becomes a sortable affordance: `ForTableBody`\n * applies `[forTableSortHeader]`, derives its direction from the body's `sort`\n * input, and re-emits activation through the body's `sortChange` output.\n */\n readonly sortable = input(false, { transform: booleanAttribute });\n\n /**\n * When set, `ForTableBody` renders a `[forTableColumnResizer]` inside the column's\n * header cell and re-emits its commits through the body's `resizeCommit` output.\n * Provide `resizeAriaLabel` so the handle is named. Tune the handle per column with\n * `resizeMin` / `resizeMax` / `resizeStep` / `resizeLargeStep` / `resizeDisabled` /\n * `autoFit` / `fitIncludesHeader`, and seed / track its width through the body's\n * `[(columnWidths)]`.\n */\n readonly resizable = input(false, { transform: booleanAttribute });\n\n /**\n * When set, the column's header cell becomes a drag-reorder handle: with at least\n * one `reorderable` column, `ForTableBody` applies `[forTableColumnReorder]` to the\n * stamped header row and `[forDraggable]` (with `[dragData]` set to this column's\n * `name`) to this header cell, and re-emits committed reorders through the body's\n * `columnReorder` output. Non-reorderable columns stay static (not draggable).\n * The body bundles `forty-cdk/drag-drop` whether or not a column is `reorderable`\n * (a measured 18.0 kB raw / 5.1 kB gzip — see the table README's bundle note).\n */\n readonly reorderable = input(false, { transform: booleanAttribute });\n\n /**\n * Accessible name for the auto-wired resize handle (only meaningful with\n * `resizable`). Supplied by the consumer so it is localizable; `null` (default)\n * ships no `aria-label`.\n */\n readonly resizeAriaLabel = input<string | null>(null);\n\n /**\n * Minimum width (px) the auto-wired resize handle clamps to (only meaningful with\n * `resizable`). Forwarded to the stamped `[forTableColumnResizer]`'s `min`; drives\n * its `aria-valuemin`. Default `0`.\n */\n readonly resizeMin = input<number>(0);\n\n /**\n * Maximum width (px) the auto-wired resize handle clamps to (only meaningful with\n * `resizable`). Forwarded to the stamped `[forTableColumnResizer]`'s `max`; drives\n * its `aria-valuemax` (omitted when non-finite). Default `Infinity` (no upper bound).\n */\n readonly resizeMax = input<number>(Infinity);\n\n /**\n * Pixels applied per `ArrowLeft` / `ArrowRight` press on the auto-wired resize\n * handle (only meaningful with `resizable`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `step`. Default `10`.\n */\n readonly resizeStep = input<number>(10);\n\n /**\n * Pixels applied per `Page Up` (shrink) / `Page Down` (grow) press on the auto-wired\n * resize handle (only meaningful with `resizable`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `largeStep`. Default `100`.\n */\n readonly resizeLargeStep = input<number>(100);\n\n /**\n * Freezes the auto-wired resize handle while keeping it rendered (only meaningful with\n * `resizable`). Forwarded to the stamped `[forTableColumnResizer]`'s `disabled`: the\n * handle leaves the tab order and ignores keyboard, pointer and double-click input, and\n * reflects `aria-disabled` / `data-disabled`. Default `false`.\n */\n readonly resizeDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * Whether double-clicking the auto-wired resize handle fits the column to its\n * widest content (only meaningful with `resizable`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `autoFit`. Default `true` — the historical\n * hardcoded behaviour; set `false` to make the double-click a no-op.\n */\n readonly autoFit = input(true, { transform: booleanAttribute });\n\n /**\n * Whether header-inclusive auto-fit also accounts for the column header's label\n * (only meaningful with `resizable` + `autoFit`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `fitIncludesHeader`; isolate the header text with a\n * `[forTableColumnLabel]` inside the `[forTableHeaderCellDef]` template. Default `false`.\n */\n readonly fitIncludesHeader = input(false, { transform: booleanAttribute });\n\n /**\n * `grid-template-columns` track fragment for this column (e.g. `'160px'`,\n * `'minmax(160px, 1fr)'`). When unset, `ForTableBody` falls back to the\n * published `--for-table-col-<name>-width` resize var with `fallbackWidth`\n * (or `minmax(0, 1fr)`) as the var's default, so a resized column drives its\n * own track. A static `width` **takes precedence** over that resize var — so\n * leave it unset on a `resizable` column whose width you drive through\n * `resizeCommit` or the body's `[(columnWidths)]`, otherwise the pinned track\n * ignores the resized width (the handle still reports `aria-valuenow` but the\n * column won't move). Dev-mode-guarded against fragments that would escape the\n * derived track string (see `fallbackWidth`).\n */\n readonly width = input<string | null>(null);\n\n /**\n * `grid-template-columns` track fragment used as the resize-var **fallback**\n * for a column with no explicit `width` — the track the column renders before\n * a width is committed or seeded (e.g. `'minmax(120px, 2.5fr)'` for a\n * weighted, floor-bounded fluid column). Unlike `width` it does not pin the\n * column, so the resizer (and the body's `[(columnWidths)]`) still drives it\n * and the first published width snaps the column to px. Ignored when `width`\n * is set. Defaults to `minmax(0, 1fr)`.\n *\n * Any open track vocabulary is accepted (`minmax()`, `fit-content()`,\n * `calc()`, `clamp()`, `var()`), but in dev mode a fragment that would escape\n * the derived `grid-template-columns` string throws instead of silently\n * collapsing the layout: an empty fragment (pass `null` to leave the track\n * unset), a `;` / `{` / `}` / quote / comment opener, or unbalanced\n * parentheses — a stray `)` here would close the enclosing `var(` early and\n * swallow the rest of the track.\n */\n readonly fallbackWidth = input<string | null>(null);\n\n /**\n * Static class(es) applied to this column's stamped `[forTableHeaderCell]`.\n * `ForTableBody` owns the header cell element, so this is the styling seam a\n * consumer (or wrapping design system) uses to reach it without scoping CSS to\n * the body's template internals. `null` (default) adds no class attribute.\n */\n readonly headerClass = input<string | null>(null);\n\n /**\n * Static class(es) applied to this column's stamped `[forTableCell]` on every\n * data **and** placeholder row. The styling seam for the cell box itself\n * (padding, truncation, alignment, sticky backgrounds) that `ForTableBody`\n * owns. Per-datum row styling is out of scope. `null` (default) adds no class\n * attribute.\n */\n readonly cellClass = input<string | null>(null);\n\n /**\n * The column's header-cell template. Mandatory — a displayed def without one throws in\n * dev mode.\n */\n readonly header = contentChild(ForTableHeaderCellDef);\n /**\n * The column's data-cell template. Mandatory — a displayed def without one throws in\n * dev mode.\n */\n readonly dataCell = contentChild(ForTableCellDef);\n /**\n * The column's optional placeholder-cell template. When absent, `ForTableBody`\n * falls back to its `[forTablePlaceholderCellDefault]`, then to an empty cell.\n */\n readonly placeholderCell = contentChild(ForTablePlaceholderCellDef);\n\n constructor() {\n assertInputBound(this.name, 'table', '[forTableColumnDef]', 'forTableColumnDef');\n registerTableColumnDef(this);\n }\n}\n\n/**\n * Dev-mode guard for one column definition: its header and data-cell templates,\n * its `name` (interpolated into the `--for-table-col-<name>-width` custom\n * property) and its `width` / `fallbackWidth` track fragments.\n *\n * Called from `ForTableBody`'s track builder — the point at which the values are\n * interpolated — rather than from an `effect` on the def, so the throw carries a\n * stack naming the render that would have produced the broken declaration and\n * no reactive node is created per def in a production build. It follows that\n * only a *displayed* column is checked, which is exactly the set whose values\n * reach CSS and whose templates are stamped.\n *\n * @param def The column definition to check.\n * @param name The def's bound name, as the registry resolved it.\n */\nexport function assertColumnDefConfig(def: ForTableColumnDef, name: string): void {\n if (typeof ngDevMode !== 'undefined' && !ngDevMode) {\n return;\n }\n const piece = `forTableColumnDef=\"${name}\"`;\n const missing = [\n def.header() ? null : '<ng-template forTableHeaderCellDef>',\n def.dataCell() ? null : '<ng-template forTableCellDef>',\n ].filter((template) => template !== null);\n if (missing.length > 0) {\n throw fortyError({\n code: 'FORCDK-TABLE-013',\n message: `${piece} declares no ${missing.join(' and no ')}.`,\n fix:\n 'Declare an <ng-template forTableHeaderCellDef> and an <ng-template forTableCellDef> ' +\n 'inside every [forTableColumnDef].',\n });\n }\n assertColumnName(name, 'ForTableColumnDef');\n const width = def.width();\n if (width !== null) {\n assertColumnTrack(width, 'width', piece);\n }\n const fallbackWidth = def.fallbackWidth();\n if (fallbackWidth !== null) {\n assertColumnTrack(fallbackWidth, 'fallbackWidth', piece);\n }\n}\n","import {\n booleanAttribute,\n contentChild,\n Directive,\n inject,\n input,\n TemplateRef,\n type InputSignal,\n} from '@angular/core';\n\nimport { assertInputBound, fortyError, unsetInput, type Unset } from 'forty-cdk/core';\n\nimport { type ForTableCellDefContext } from './column-def';\nimport { registerTableRowDef } from './def-registry';\n\n/**\n * Marks the content template of a full-span row variant. Place on an\n * `<ng-template forTableRowCellDef>` inside a `[forTableRowDef]`; its content is\n * stamped into a single cell that spans every column of the matched row, with the\n * row datum and its index exposed through `ForTableCellDefContext`.\n *\n * The spanning cell is presentational, so its template must **not** contain\n * interactive content (buttons, links, form controls) — the variant row stays\n * out of the grid's single-tab-stop roving order, so nested tabbables become\n * unreachable — nor a `[forTableCell]`, which would register a cell handle on\n * the variant row and make the roving grid ragged.\n *\n * Bind `[forTableRowCellDefRow]` to the same array passed to `ForTableBody`'s\n * `rows` to type `let-row` — the input is read only for type inference, never at\n * runtime.\n *\n * When the row type is a discriminated union, also bind `[forTableRowCellDefWhen]`\n * to the same type guard used on the def's `[when]` so `let-row` is narrowed to\n * the matched variant member (`V`) instead of staying the full union.\n */\n@Directive({ selector: 'ng-template[forTableRowCellDef]' })\nexport class ForTableRowCellDef<T, V extends T = T> {\n /** The captured row-variant template, typed with `ForTableCellDefContext<T>`. */\n readonly template = inject<TemplateRef<ForTableCellDefContext<T>>>(TemplateRef);\n\n /**\n * Type-inference hint: bind to the same collection as `ForTableBody`'s `rows`\n * so `let-row` is typed as the row type. Read only by the compiler; the\n * directive never touches its value.\n */\n readonly rowType = input<readonly T[]>([], { alias: 'forTableRowCellDefRow' });\n\n /**\n * Type-inference hint: bind the same type guard used on this def's `[when]`\n * so `let-row` is narrowed to the matched variant member (`V`). Read only by\n * the compiler; the directive never touches its value. Omitting it leaves\n * `let-row` typed as the full `T`.\n */\n readonly narrowType = input<((row: T, index: number) => row is V) | null>(null, {\n alias: 'forTableRowCellDefWhen',\n });\n\n /** Narrows the template context type for `let-row` under strict template checking. */\n static ngTemplateContextGuard<T, V extends T>(\n _directive: ForTableRowCellDef<T, V>,\n _context: unknown,\n ): _context is ForTableCellDefContext<V> {\n return true;\n }\n}\n\n/**\n * Declarative definition of a row variant for `<for-table-body>`. Place\n * `[forTableRowDef]` on an `<ng-container>` alongside the `[forTableColumnDef]`s and\n * bind a `[when]` predicate; for every datum the predicate matches, `ForTableBody`\n * renders this variant instead of the per-column data cells. A def comes in one of\n * two shapes, and must declare **exactly one** of them:\n *\n * - **Full-span** (a `[forTableRowCellDef]` template): the row's single cell spans every\n * column — group headers, section separators, summary or empty-state rows. It carries\n * the row's `role` plus `aria-colindex=\"1\"` and an `aria-colspan` equal to the column\n * count, but registers no cell handle, so roving arrow navigation steps over the row.\n * - **Placeholder cells** (the `placeholderCells` flag, no `[forTableRowCellDef]`): the row\n * stamps one cell per displayed column from each column's `[forTablePlaceholderCellDef]`\n * — skeleton rows for infinite-scroll or paginated tables. These keep the roving grid\n * rectangular, and are stamped disabled so arrow navigation steps over them.\n *\n * Either way the variant row is presentational and non-selectable — its `value` stays `undefined` —\n * while still occupying a row slot and counting towards `aria-rowindex` / `aria-rowcount`.\n *\n * When several defs match a datum the first in DOM order wins; a datum matched by none renders the\n * standard per-column row.\n *\n * Like `[forTableColumnDef]`, the def registers itself with the surrounding body through DI at\n * construction, so a preset component may declare it in its own view and a scaffold wrapper may\n * project it into a body it owns — see {@link ForTableDefRegistry}. A def with no reachable\n * registry throws.\n *\n * @example\n * ```html\n * <for-table-body [rows]=\"rows()\">\n * <ng-container forTableColumnDef=\"name\">\n * <ng-template forTableHeaderCellDef>Name</ng-template>\n * <ng-template forTableCellDef [forTableCellDefRow]=\"rows()\" let-row>{{ row.name }}</ng-template>\n * <ng-template forTablePlaceholderCellDef><span class=\"skeleton\"></span></ng-template>\n * </ng-container>\n *\n * <!-- full-span group header -->\n * <ng-container forTableRowDef [when]=\"isGroupHeader\">\n * <ng-template forTableRowCellDef [forTableRowCellDefRow]=\"rows()\" let-row>{{ row.group }}</ng-template>\n * </ng-container>\n *\n * <!-- per-column skeleton rows while the next page loads -->\n * <ng-container forTableRowDef [when]=\"isPlaceholder\" placeholderCells />\n * </for-table-body>\n * ```\n */\n@Directive({ selector: '[forTableRowDef]' })\nexport class ForTableRowDef<T> {\n /**\n * Predicate selecting which data rows render this variant instead of the\n * per-column row. Receives the datum and its 0-based dataset index and returns\n * `true` to render the variant. In a non-virtualized table the index equals\n * the row's rendered position; under `[forTableVirtualized]` it is the\n * **absolute** index into the full dataset. Evaluated for every datum on each\n * change-detection pass, so keep it cheap and free of side effects.\n *\n * Mandatory — an unbound def throws in dev mode.\n */\n readonly when: InputSignal<((row: T, index: number) => boolean) | Unset> =\n input(unsetInput<(row: T, index: number) => boolean>());\n\n /**\n * The variant's full-span content template. Present for a full-span def; absent\n * (and unused) when `placeholderCells` is set. A def must declare exactly one of\n * a `[forTableRowCellDef]` template or `placeholderCells` — the body validates this and\n * throws a `[forty-cdk/table]` error otherwise.\n */\n readonly cell = contentChild(ForTableRowCellDef);\n\n /**\n * Render this variant's matched rows as **per-column placeholder cells** instead\n * of a full-span `[forTableRowCellDef]`. Set it (the bare `placeholderCells` attribute)\n * for interleaved / trailing skeleton rows — infinite-scroll or paginated tables\n * that keep their loaded rows and append placeholder rows while the next page\n * loads. The body stamps one `[forTableCell]` per displayed column from that\n * column's `[forTablePlaceholderCellDef]` template (an empty cell when the column omits\n * it), exactly like the `loading` state, but stamps the cells disabled so\n * grid-mode arrow navigation steps over them and the roving grid stays\n * rectangular.\n *\n * A def must declare **exactly one** of a `[forTableRowCellDef]` template or\n * `placeholderCells`; declaring both or neither throws a `[forty-cdk/table]`\n * error in dev mode.\n */\n readonly placeholderCells = input(false, { transform: booleanAttribute });\n\n constructor() {\n assertInputBound(this.when, 'table', '[forTableRowDef]', 'when');\n registerTableRowDef(this);\n }\n}\n\n/**\n * Dev-mode guard for one row variant's config: a `[forTableRowDef]` declares\n * exactly one of a `[forTableRowCellDef]` template or `placeholderCells`.\n *\n * Called from `ForTableBody`'s row derivation, the point at which a variant is\n * matched against the data, so no reactive node is created per def in a\n * production build. A production build skips it: the variant row then renders\n * its placeholder cells when the flag is set, and an empty spanning cell when\n * neither is declared.\n *\n * @param def The row definition to check.\n */\nexport function assertRowDefConfig(def: ForTableRowDef<unknown>): void {\n if (typeof ngDevMode !== 'undefined' && !ngDevMode) {\n return;\n }\n const hasCell = def.cell() != null;\n const hasPlaceholder = def.placeholderCells();\n if (hasCell === hasPlaceholder) {\n throw fortyError({\n code: 'FORCDK-TABLE-005',\n message: `A [forTableRowDef] declares ${hasCell ? 'both' : 'neither'} of a [forTableRowCellDef] template and the placeholderCells flag.`,\n fix: 'Declare exactly one of the two on every [forTableRowDef].',\n });\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n} from '@angular/core';\n\nimport { type ForTableCellHandle, injectPointerMove, registerHandle } from 'forty-cdk/core';\nimport {\n coerceSticky,\n injectTableContext,\n injectTableRowRegistration,\n injectTableRowContext,\n type TableStickyValue,\n} from './table-context';\n\n/**\n * Marks a data cell. The `role` is derived from the root's `mode`: `'cell'` in\n * `table` mode and `'gridcell'` in `grid` / `treegrid` mode. In grid / treegrid\n * mode the cell is a roving-tabindex target — the single active cell carries\n * `tabindex=\"0\"` (others `-1`), reflects `data-highlighted` when focused, and\n * carries a 1-based `aria-colindex`. Arrow / Home / End / Ctrl+Home / Ctrl+End /\n * PageUp / PageDown move focus between cells, and `Enter` on a cell holding no widget\n * emits the root's `cellActivate`. Requires a `name` input that\n * identifies the column — reflected as `data-column`. Optionally sticky and\n * optionally disabled (disabled cells are skipped during navigation).\n */\n@Directive({\n selector: '[forTableCell]',\n exportAs: 'forTableCell',\n host: {\n '[attr.role]': 'role()',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-colindex]': 'colIndex()',\n '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n '[attr.data-column]': 'name()',\n '[attr.data-sticky]': \"sticky() ? (sticky() === 'end' ? 'end' : '') : null\",\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '(focus)': 'onFocus()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableCell {\n private readonly ctx = injectTableContext('ForTableCell');\n private readonly rowCtx = injectTableRowContext('ForTableCell');\n readonly #rowRegistration = injectTableRowRegistration('ForTableCell');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /**\n * This cell's element injector. Exposed so a declarative renderer stamping cell\n * content from a projected `<ng-template>` (e.g. `ForTableBody`) can pass it as\n * `[ngTemplateOutletInjector]`, letting row-context-dependent primitives inside\n * that content (`[forTableRowSelector]`, …) resolve their `[forTableRow]`.\n */\n readonly injector = inject(Injector);\n\n private readonly role = computed(() => (this.ctx.mode() === 'table' ? 'cell' : 'gridcell'));\n\n /** Column identifier, reflected as `data-column`. Required by later phases (sort, resize, reorder). */\n readonly name = input.required<string>();\n\n /**\n * Sticky placement for this data cell. `true` (or the bare `sticky` attribute)\n * pins to the start edge; `'end'` pins to the end edge; `false` (default) is not\n * sticky. The consumer applies `position: sticky` and the offsets in CSS — this\n * input only provides the `data-sticky` hook.\n */\n readonly sticky = input(false as TableStickyValue, { transform: coerceSticky });\n\n /**\n * Whether this data cell is disabled. Disabled cells are skipped during arrow-key\n * navigation, drop out of the tab order, and reflect `aria-disabled` / `data-disabled`.\n * Only meaningful in `grid` / `treegrid` mode.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n private readonly tabindex = computed<number | null>(() => {\n if (this.ctx.mode() === 'table') {\n return null;\n }\n if (this.disabled()) {\n return -1;\n }\n return this.ctx.cellTabIndex(this.#host);\n });\n\n private readonly colIndex = computed<number | null>(() =>\n this.ctx.mode() === 'table' ? null : this.rowCtx.cellIndexOf(this.#host) + 1,\n );\n\n private readonly highlighted = computed(\n () => this.ctx.mode() !== 'table' && this.ctx.isCellHighlighted(this.#host),\n );\n\n constructor() {\n const handle: ForTableCellHandle = { host: this.#host, disabled: this.disabled };\n registerHandle(\n handle,\n (h) => this.#rowRegistration.registerCell(h),\n (h) => this.#rowRegistration.unregisterCell(h),\n );\n injectPointerMove(() => this.#onPointerMove());\n }\n\n #onPointerMove(): void {\n if (!this.disabled()) {\n this.ctx.highlightFromPointer(this.#host);\n }\n }\n\n private onFocus(): void {\n this.ctx.activateCell(this.#host);\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n this.ctx.handleCellKeydown(event, this.#host, this.name());\n }\n}\n","import { DestroyRef, Directive, ElementRef, inject, output, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\nimport {\n FOR_DRAGGABLE_LIFT_GUARD,\n FOR_DROP_LIST_DEFAULT_ORIENTATION,\n FOR_DROP_LIST_ROVING_DELEGATE,\n ForDropList,\n type ForDragDropEvent,\n type ForDraggableLiftGuard,\n type ForDropListRovingDelegate,\n moveItemInArray,\n provideForDragDropDefaults,\n} from 'forty-cdk/drag-drop';\nimport { translateWindowReorder } from 'forty-cdk/core';\nimport { hostHasSortActivation, injectTableContext } from './table-context';\n\n/** Payload of `columnReorder`: the move's indices and the resulting column-name order. */\nexport interface TableColumnReorderDescriptor {\n /**\n * Previous 0-based index into the **full displayed column order**, counting\n * non-reorderable columns; feed it (with `to`) to `moveItemInArray` over the\n * full displayed-columns array.\n */\n from: number;\n /**\n * New 0-based index into the **full displayed column order**, counting\n * non-reorderable columns; feed it (with `from`) to `moveItemInArray` over the\n * full displayed-columns array.\n */\n to: number;\n /**\n * The reorderable columns in their new order, read from each draggable header\n * cell's `dragData`. Equal to the full displayed order only when every displayed\n * column is reorderable; otherwise it omits the non-reorderable columns.\n */\n columns: readonly string[];\n}\n\n/**\n * Opt-in **column reordering** for `ForTable`, composed over the drag-drop primitive.\n *\n * Apply on the `[forTableHeaderRow]` element. It wraps `[forDropList]` (via\n * `hostDirectives`) so the header cells become a reorderable list, then translates\n * drag-drop's generic drop into the table-friendly `columnReorder` output. Mark each\n * `[forTableHeaderCell]` as `[forDraggable]` with `[dragData]` set to the column name.\n * On a committed drop (pointer or keyboard) it emits the previous / new index (into the\n * full displayed column order) and the reorderable columns' new order; the consumer\n * applies it to their own column array. **It never reorders columns itself** (BYO-data).\n *\n * The wrapped list defaults to `orientation=\"horizontal\"` (a column reorder is always along\n * the row axis), so no `orientation` binding is needed. Bind `orientation=\"vertical\"` to\n * override for the rare case.\n *\n * In `mode=\"grid\"` / `mode=\"treegrid\"` the draggable header cells join the table's composite\n * roving grid as its first row, so a sortable + column-reorderable grid keeps the **single\n * tab stop** the WAI-ARIA Data Grid pattern calls for: `Tab` enters the grid once, Arrow keys\n * cross between header and body, and `Space` on a header cell lifts it for keyboard reordering.\n * It hands its drop-list roving to the grid via `FOR_DROP_LIST_ROVING_DELEGATE` and routes idle\n * header navigation through the table's grid keyboard handler.\n *\n * When a header cell is both sortable (`[forTableSortHeader]`) and reorderable, the two\n * keyboard activations split along WAI-ARIA lines so a single key never both sorts and lifts:\n * `Space` lifts the column, `Enter` toggles the sort. The split is enforced via a\n * `FOR_DRAGGABLE_LIFT_GUARD` that defers `Enter` to the sort header on cells carrying the\n * `data-sortable` marker — detected by DOM marker, so `forty-cdk/drag-drop` needs no table\n * import. A reorder-only header (no sort header) still lifts on both `Enter` and `Space`.\n *\n * @example\n * ```html\n * <div forTableHeaderRow forTableColumnReorder (columnReorder)=\"columns.set($event.columns)\">\n * @for (col of columns(); track col) {\n * <div forTableHeaderCell [name]=\"col\" forDraggable [dragData]=\"col\">{{ col }}</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forTableColumnReorder]',\n exportAs: 'forTableColumnReorder',\n providers: [\n { provide: FOR_DROP_LIST_DEFAULT_ORIENTATION, useValue: 'horizontal' },\n provideForDragDropDefaults({ itemRoleDescription: '' }),\n {\n provide: FOR_DROP_LIST_ROVING_DELEGATE,\n useFactory: (): ForDropListRovingDelegate => {\n const ctx = injectTableContext('ForTableColumnReorder');\n return {\n itemTabindex: (el) =>\n ctx.headerParticipatesInRoving() ? ctx.headerCellTabIndex(el) : null,\n isItemHighlighted: (el) =>\n ctx.headerParticipatesInRoving() ? ctx.isCellHighlighted(el) : null,\n };\n },\n },\n {\n provide: FOR_DRAGGABLE_LIFT_GUARD,\n useValue: {\n canLiftOnKey: (event, host) => !(event.key === 'Enter' && hostHasSortActivation(host)),\n } satisfies ForDraggableLiftGuard,\n },\n ],\n hostDirectives: [\n {\n directive: ForDropList,\n inputs: [\n 'orientation',\n 'dir',\n 'disabled',\n 'autoScroll',\n 'animateReorder',\n 'liveSort',\n 'boundary',\n 'lockAxis',\n ],\n },\n ],\n})\nexport class ForTableColumnReorder {\n private readonly ctx = injectTableContext('ForTableColumnReorder');\n readonly #list = inject(ForDropList);\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /**\n * Fires once per committed reorder gesture (pointer drop or keyboard drop) with the\n * previous / new column index (into the full displayed column order, counting\n * non-reorderable columns) and the reorderable columns' new order after the move.\n */\n readonly columnReorder = output<TableColumnReorderDescriptor>();\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n const sub = this.#list.dragDrop.subscribe((event: ForDragDropEvent) => this.#emit(event));\n destroyRef.onDestroy(() => sub.unsubscribe());\n\n if (this.#isBrowser) {\n const onCaptureKeydown = (event: KeyboardEvent): void => this.#onCaptureKeydown(event);\n const controller = new AbortController();\n this.#host.addEventListener('keydown', onCaptureKeydown, {\n capture: true,\n signal: controller.signal,\n });\n destroyRef.onDestroy(() => controller.abort());\n }\n }\n\n /**\n * When the header row joins the composite grid, intercepts idle (not-lifted) Arrow /\n * Home / End / Page keys on a draggable header cell in the capture phase and routes them\n * through the table's grid navigation, then stops propagation so the draggable's own\n * keydown does not also navigate. Space / Enter (and every key while a keyboard drag is in\n * progress) fall through untouched, so the draggable still owns the lift / move / drop /\n * cancel gesture — keeping the header one navigation continuum with the body while\n * preserving column reordering.\n */\n #onCaptureKeydown(event: KeyboardEvent): void {\n if (!this.ctx.headerParticipatesInRoving()) {\n return;\n }\n const target = event.target;\n if (!(target instanceof HTMLElement)) {\n return;\n }\n if (\n !this.#list.items().some((handle) => handle.host === target) ||\n this.#list.isLifted(target)\n ) {\n return;\n }\n if (this.ctx.handleHeaderCellKeydown(event, target)) {\n event.stopPropagation();\n }\n }\n\n #emit(event: ForDragDropEvent): void {\n const items = this.#list.items();\n const names = items.map((handle) => String(handle.data()));\n const columns = moveItemInArray(names, event.previousIndex, event.currentIndex);\n const displayedIndices = items.map((handle) => this.ctx.headerCellIndexOf(handle.host));\n const { from, to } = displayedIndices.some((index) => index < 0)\n ? { from: event.previousIndex, to: event.currentIndex }\n : translateWindowReorder(displayedIndices, event.previousIndex, event.currentIndex);\n this.columnReorder.emit({ from, to, columns });\n }\n}\n","import {\n afterNextRender,\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n DOCUMENT,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n PLATFORM_ID,\n signal,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\nimport {\n clamp,\n createPointerDragSession,\n type PointerDragSession,\n DRAG_DEAD_ZONE_PX,\n hostButtonType,\n isHistoryChord,\n} from 'forty-cdk/core';\nimport { injectTableCellTabIndex } from './cell-tab-index';\nimport { FOR_TABLE_DEF_REGISTRY } from './def-registry';\nimport { assertColumnName, injectTableContext, injectTableRegistration } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/** Payload of `resizeCommit`: which column was resized and its committed width (px). */\nexport interface TableResizeDescriptor {\n column: string;\n width: number;\n}\n\n/**\n * Payload of `[widthRevert]`: which column was reverted and the width (px) it had before the\n * gesture, `undefined` when the column had no width yet.\n */\nexport interface TableResizeRevertDescriptor {\n column: string;\n width: number | undefined;\n}\n\n/**\n * Turns a focusable element inside a `[forTableHeaderCell]` into a column-resize\n * handle. Supports pointer drag (with a dead-zone so a plain click is a no-op) and\n * keyboard resize, both constrained to `[min, max]`: `ArrowLeft` / `ArrowRight` step by\n * `step` (RTL-mirrored), `Page Up` / `Page Down` shrink / grow by `largeStep`, `Home`\n * snaps to `min` and `End` to a finite `max`, the same keymap as `[forPaneResizer]`.\n * Pressing `Escape` (or a `pointercancel`) during a drag reverts the width to where\n * the gesture started and emits no `resizeCommit`; a column that had no width goes back\n * to `undefined`, so no width var stays published. Being destroyed mid-drag reverts\n * too, reporting the pre-drag width through the `[widthRevert]` callback because the\n * `[(width)]` model can no longer emit during teardown.\n *\n * On every change it publishes the resolved width as the CSS custom property\n * `--for-table-col-<column>-width` on the table root, so the consumer can apply it\n * to their layout (`grid-template-columns` in `<div>` mode, a `<col>` / cell width\n * in native `<table>` mode). **It never lays out columns itself and never resizes\n * data** — it owns the affordance, accessibility, and the published width only.\n * For a column a `<for-table-body>` declares, the body publishes that var from its\n * `[(columnWidths)]` map instead, and the handle only reports width changes.\n *\n * Reflects `data-resizing` (empty string) while a pointer drag is active. Carries\n * `role=\"separator\"` with `aria-orientation=\"vertical\"` and live `aria-value*`,\n * mirroring `[forPaneResizer]`. The consumer supplies `aria-label`. Before the first\n * gesture, `aria-valuenow` falls back to the header-cell width measured once on mount\n * (browser-only), so a separator with no `[width]` is never announced without a\n * current value; an explicit `[width]` always takes precedence. The reflected value is\n * clamped to `[min, max]` and a `max` below `min` reflects as `min`, while `[(width)]`\n * keeps the raw value.\n *\n * In `mode=\"grid\"` / `\"treegrid\"` it yields its tab stop to the composite roving grid\n * (`tabindex=\"-1\"`) and is reached via cell-entry: Enter / F2 focuses the first focusable\n * inside the header cell, and `Tab` cycles on to the rest, so it stays reachable behind a\n * column-menu button. It must sit on a natively-focusable element (a `<button>`) for either\n * to find it. In `mode=\"table\"` it is a standalone tab stop (`tabindex=\"0\"`), and so it is\n * in a grid whose header row does not join the grid, where no cell entry reaches it. A\n * `<button>` host is forced to `type=\"button\"`, so a click or `Enter` / `Space` on\n * the handle never submits a surrounding `<form>`.\n *\n * Opt in to size-to-content with `[autoFit]`: double-clicking the handle then fits the\n * column to its widest data-cell content via `fitToContent()` (also callable imperatively\n * through `exportAs=\"forTableColumnResizer\"`, e.g. from a column menu). Unset (default),\n * `dblclick` is a no-op and the resize behaviour is unchanged. Add `[fitIncludesHeader]`\n * to also account for the column header's label (marked with a sibling\n * `[forTableColumnLabel]`), fitting to `max(header label, …data cells)`.\n *\n * @example\n * ```html\n * <th forTableHeaderCell name=\"name\">\n * Name\n * <button forTableColumnResizer column=\"name\" [(width)]=\"nameWidth\"\n * aria-label=\"Resize Name column\"></button>\n * </th>\n * ```\n */\n@Directive({\n selector: '[forTableColumnResizer]',\n exportAs: 'forTableColumnResizer',\n host: {\n role: 'separator',\n 'aria-orientation': 'vertical',\n '[attr.type]': 'buttonType()',\n '[attr.tabindex]': 'disabled() ? \"-1\" : tabindex()',\n '[attr.aria-valuenow]': 'ariaValueNow()',\n '[attr.aria-valuemin]': 'min()',\n '[attr.aria-valuemax]': 'ariaValueMax()',\n '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-resizing]': 'resizing() ? \"\" : null',\n '(keydown)': 'onKeyDown($event)',\n '(click)': 'onClick($event)',\n '(dblclick)': 'autoFit() && !disabled() && fitToContent()',\n },\n})\nexport class ForTableColumnResizer {\n private readonly ctx = injectTableContext('ForTableColumnResizer');\n readonly #registration = injectTableRegistration('ForTableColumnResizer');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #document = inject(DOCUMENT);\n readonly #headerCell = inject(ForTableHeaderCell, { optional: true });\n\n private readonly buttonType = hostButtonType();\n\n /** Column identity; included in the `resizeCommit` payload and the published CSS var name. */\n readonly column = input.required<string>();\n\n /**\n * Current column width in pixels. Two-way bindable via `[(width)]`. Acts as both\n * the controlled value and the base a pointer drag / arrow step is applied to.\n * When unset, the base for the first gesture is measured from the header cell.\n * Its implicit `widthChange` fires on every live update (drag tick, arrow press);\n * `resizeCommit` is the distinct column-aware gesture-end event.\n */\n readonly width = model<number>();\n\n /** Minimum width in pixels. Default `0`. */\n readonly min = input<number>(0);\n\n /** Maximum width in pixels. Default `Infinity` (no upper bound). */\n readonly max = input<number>(Infinity);\n\n /** Pixels applied per `ArrowLeft` / `ArrowRight` press. Default `10`. */\n readonly step = input<number>(10);\n\n /**\n * Pixels applied per `Page Up` (shrink) / `Page Down` (grow) press, matching\n * `[forPaneResizer]`'s direction. Default `100`.\n */\n readonly largeStep = input<number>(100);\n\n /**\n * Disables the handle: it leaves the tab order (`tabindex=\"-1\"`), keyboard, pointer drag\n * and the `[autoFit]` double-click do nothing, and `aria-disabled` / `data-disabled` are\n * reflected. An imperative `fitToContent()` call still applies.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /**\n * Opt-in size-to-content. When set, double-clicking the handle fits the column to\n * its widest data-cell content via `fitToContent()`. Unset (default), `dblclick` is\n * a no-op and the resize behaviour is unchanged.\n */\n readonly autoFit = input(false, { transform: booleanAttribute });\n\n /**\n * Opt-in: also account for the column header's label width when fitting to content,\n * so `fitToContent()` sizes to `max(header label, …data cells)` instead of data cells\n * only. The header label is isolated through a sibling `[forTableColumnLabel]` marker\n * (the resize handle / sort affordance are excluded). When set without a marker present,\n * it degrades to data-cells-only. Unset (default), the header is ignored.\n */\n readonly fitIncludesHeader = input(false, { transform: booleanAttribute });\n\n /**\n * Fires once per resize gesture — at pointer-up after a drag, and on every arrow\n * press — with the column identity and its committed width. Bind it to persist\n * the width; live updates during a drag come through `[(width)]` / `widthChange`.\n */\n readonly resizeCommit = output<TableResizeDescriptor>();\n\n /**\n * Teardown-only revert channel. Called with the pre-drag width when the handle is\n * destroyed mid-drag — the column is removed, or `resizable` is toggled off — so the\n * transient drag width never survives as the consumer's persisted value. The width is\n * `undefined` when the column had none before the gesture. On every other revert path\n * (`Escape`, `pointercancel`) the pre-drag width arrives through `[(width)]` /\n * `widthChange` as usual and this callback does not fire.\n *\n * Bound as a function reference (`[widthRevert]=\"onRevert\"`), not as an event binding:\n * the `[(width)]` model — like any `output()` on this directive — is already destroyed\n * when the unmount revert happens, so an emitter-based channel cannot deliver it.\n */\n readonly widthRevert = input<((descriptor: TableResizeRevertDescriptor) => void) | undefined>(\n undefined,\n );\n\n readonly #upperBound = computed(() => Math.max(this.max(), this.min()));\n\n /** `aria-valuemax`, omitted when `max` is non-finite (the default unbounded case). */\n private readonly ariaValueMax = computed<number | null>(() =>\n Number.isFinite(this.#upperBound()) ? this.#upperBound() : null,\n );\n\n /** `aria-valuenow`: the explicit or measured width, clamped to the reflected range. */\n private readonly ariaValueNow = computed<number | null>(() => {\n const current = this.width() ?? this.measuredWidth();\n return current == null ? null : clamp(current, this.min(), this.#upperBound());\n });\n\n private readonly tabindex = injectTableCellTabIndex();\n\n readonly #resizing = signal(false);\n\n /** Whether a pointer drag is currently active (drives `data-resizing`). */\n private readonly resizing = this.#resizing.asReadonly();\n\n readonly #measuredWidth = signal<number | null>(null);\n\n /**\n * Header-cell width measured once on mount (browser-only). Backs `aria-valuenow`\n * before any explicit `[width]` so the focusable separator never ships without a\n * current value on the measured-fallback path; an explicit `[width]` still wins.\n */\n private readonly measuredWidth = this.#measuredWidth.asReadonly();\n\n #pointerSession: PointerDragSession | null = null;\n\n #dragStartCoord = 0;\n #dragStartWidth: number | undefined = undefined;\n #dragStartValue = 0;\n #dragInvert = false;\n #dragCurrent = 0;\n\n #publishedColumn: string | null = null;\n\n #destroying = false;\n\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n const defs = inject(FOR_TABLE_DEF_REGISTRY, { optional: true });\n const bodyOwnsWidth = (column: string): boolean =>\n defs?.columnNames().includes(column) ?? false;\n effect(() => {\n const column = this.column();\n assertColumnName(column, 'ForTableColumnResizer');\n const w = this.width();\n if (this.#publishedColumn !== null && this.#publishedColumn !== column) {\n this.#registration.removeColumnWidth(this.#publishedColumn);\n }\n if (bodyOwnsWidth(column)) {\n this.#publishedColumn = null;\n } else if (w != null) {\n this.#registration.setColumnWidth(column, w);\n this.#publishedColumn = column;\n } else {\n this.#registration.removeColumnWidth(column);\n this.#publishedColumn = null;\n }\n });\n destroyRef.onDestroy(() => {\n const column = this.column();\n if (!bodyOwnsWidth(column)) {\n this.#registration.removeColumnWidth(column);\n }\n });\n if (this.#isBrowser) {\n afterNextRender(() => this.#measuredWidth.set(this.#measureBaseWidth()));\n this.#pointerSession = createPointerDragSession({\n host: this.#host,\n document: this.#document,\n armThreshold: DRAG_DEAD_ZONE_PX,\n capturePointer: true,\n cancelOnEscape: true,\n cancelOnDestroy: true,\n canStart: (event) => this.#onDragStart(event),\n onLift: () => true,\n onMove: (event) => this.#onDragMove(event),\n onCommit: () => this.#onDragCommit(),\n onCancel: () => this.#onDragCancel(),\n });\n destroyRef.onDestroy(() => {\n this.#destroying = true;\n this.#pointerSession?.destroy();\n });\n }\n }\n\n /**\n * Sizes the column to its content: measures the widest natural width across the\n * column's data cells (resolved through the table context, browser-only) — and, when\n * `[fitIncludesHeader]` is set with a sibling `[forTableColumnLabel]` present, the\n * header label too, so the fit becomes `max(header label, …data cells)`. Clamps the\n * result to `[min, max]`, applies it as the new `[(width)]`, and emits `resizeCommit`.\n * Wired to a `dblclick` on the handle when `[autoFit]` is set, and callable\n * imperatively (e.g. from a column menu) via `exportAs=\"forTableColumnResizer\"`.\n * Returns the applied width; a no-op returning the current width off the browser.\n */\n fitToContent(): number {\n if (!this.#isBrowser) {\n return this.width() ?? this.min();\n }\n const next = clamp(this.#measureContentWidth(), this.min(), this.max());\n this.width.set(next);\n this.resizeCommit.emit({ column: this.column(), width: next });\n return next;\n }\n\n #onDragStart(event: PointerEvent): boolean {\n if (this.disabled()) {\n return false;\n }\n if (event.pointerType === 'mouse' && event.button !== 0) {\n return false;\n }\n event.preventDefault();\n event.stopPropagation();\n const ltr = this.ctx.dir() !== 'rtl';\n this.#dragInvert = !ltr;\n this.#dragStartCoord = event.clientX;\n this.#dragStartWidth = this.width();\n this.#dragStartValue = this.#dragStartWidth ?? this.#measureBaseWidth();\n this.#dragCurrent = this.#dragStartValue;\n return true;\n }\n\n #onDragMove(event: PointerEvent): void {\n let delta = event.clientX - this.#dragStartCoord;\n if (this.#dragInvert) {\n delta = -delta;\n }\n const next = clamp(this.#dragStartValue + delta, this.min(), this.max());\n if (next === this.#dragCurrent) {\n return;\n }\n this.#dragCurrent = next;\n this.#resizing.set(true);\n this.width.set(next);\n }\n\n #onDragCommit(): void {\n this.#resizing.set(false);\n this.resizeCommit.emit({ column: this.column(), width: this.#dragCurrent });\n }\n\n #onDragCancel(): void {\n this.#resizing.set(false);\n this.#dragCurrent = this.#dragStartValue;\n if (this.width() === this.#dragStartWidth) {\n return;\n }\n if (this.#destroying) {\n this.widthRevert()?.({ column: this.column(), width: this.#dragStartWidth });\n return;\n }\n this.width.set(this.#dragStartWidth);\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n const delta = isHistoryChord(event) ? null : this.#keyDelta(event.key);\n if (delta === null) {\n return;\n }\n const base = this.width() ?? this.#measureBaseWidth();\n const next = clamp(base + delta, this.min(), this.#upperBound());\n event.preventDefault();\n if (next === this.width()) {\n return;\n }\n this.width.set(next);\n this.resizeCommit.emit({ column: this.column(), width: next });\n }\n\n #keyDelta(key: string): number | null {\n const ltr = this.ctx.dir() !== 'rtl';\n switch (key) {\n case 'ArrowRight':\n return ltr ? this.step() : -this.step();\n case 'ArrowLeft':\n return ltr ? -this.step() : this.step();\n case 'PageUp':\n return -this.largeStep();\n case 'PageDown':\n return this.largeStep();\n case 'Home':\n return -Infinity;\n case 'End':\n return Number.isFinite(this.#upperBound()) ? Infinity : null;\n default:\n return null;\n }\n }\n\n private onClick(event: MouseEvent): void {\n event.stopPropagation();\n }\n\n #measureBaseWidth(): number {\n const cell = this.#headerCell?.el.nativeElement ?? this.#host;\n return cell.getBoundingClientRect().width;\n }\n\n #measureContentWidth(): number {\n const column = this.column();\n const cells = this.#registration\n .rows()\n .flatMap((row) => row.cells())\n .map((cell) => cell.host)\n .filter((host) => host.getAttribute('data-column') === column);\n const headerCell = this.#headerCell?.el.nativeElement ?? null;\n const labelEl = this.fitIncludesHeader() ? (this.#headerCell?.labelEl() ?? null) : null;\n if (cells.length === 0 && !labelEl) {\n return this.#measureBaseWidth();\n }\n const doc = this.#host.ownerDocument;\n const root =\n this.#host.closest<HTMLElement>('[role=\"table\"], [role=\"grid\"], [role=\"treegrid\"]') ??\n doc.body;\n const probe = doc.createElement('div');\n probe.setAttribute('aria-hidden', 'true');\n probe.style.cssText =\n 'position:absolute;top:0;left:-9999px;visibility:hidden;pointer-events:none;';\n root.appendChild(probe);\n try {\n let widest = 0;\n for (const cell of cells) {\n widest = Math.max(widest, this.#measureClone(probe, cell));\n }\n if (labelEl && headerCell) {\n widest = Math.max(\n widest,\n this.#measureClone(probe, labelEl) + this.#horizontalBox(headerCell),\n );\n }\n return widest;\n } finally {\n root.removeChild(probe);\n }\n }\n\n #measureClone(probe: HTMLElement, source: HTMLElement): number {\n const clone = source.cloneNode(true) as HTMLElement;\n const style = source.ownerDocument.defaultView?.getComputedStyle(source);\n if (style) {\n clone.style.fontFamily = style.fontFamily;\n clone.style.fontSize = style.fontSize;\n clone.style.fontWeight = style.fontWeight;\n clone.style.fontStyle = style.fontStyle;\n clone.style.letterSpacing = style.letterSpacing;\n clone.style.textTransform = style.textTransform;\n }\n clone.style.display = 'inline-block';\n clone.style.width = 'auto';\n clone.style.minWidth = '0';\n clone.style.maxWidth = 'none';\n clone.style.whiteSpace = 'nowrap';\n probe.appendChild(clone);\n return clone.getBoundingClientRect().width;\n }\n\n #horizontalBox(el: HTMLElement): number {\n const style = el.ownerDocument.defaultView?.getComputedStyle(el);\n if (!style) {\n return 0;\n }\n const px = (value: string): number => parseFloat(value) || 0;\n return (\n px(style.paddingLeft) +\n px(style.paddingRight) +\n px(style.borderLeftWidth) +\n px(style.borderRightWidth)\n );\n }\n}\n","import { Directive, ElementRef, inject, DestroyRef } from '@angular/core';\n\nimport { injectTableContext, injectTableRegistration } from './table-context';\n\n/**\n * Marks the header row of the table (`role=\"row\"`). Registers its host\n * element with the root so `ForTable` can measure the header's height and\n * publish `--for-table-header-height` for sticky-cell CSS.\n *\n * In `grid` / `treegrid` mode the header row is the grid's first row for ARIA\n * numbering, so it emits `aria-rowindex=\"1\"` and every data row's index shifts\n * up by one (matching the APG Data Grid example, where `aria-rowcount` counts\n * the header row too).\n */\n@Directive({\n selector: '[forTableHeaderRow]',\n exportAs: 'forTableHeaderRow',\n host: {\n role: 'row',\n '[attr.aria-rowindex]': 'rowIndex()',\n },\n})\nexport class ForTableHeaderRow {\n private readonly ctx = injectTableContext('ForTableHeaderRow');\n readonly #registration = injectTableRegistration('ForTableHeaderRow');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** 1-based `aria-rowindex` for the header row (`1` in grid / treegrid mode, else absent). */\n private readonly rowIndex = this.ctx.headerRowIndex;\n\n constructor() {\n const el = this.#host.nativeElement;\n this.#registration.registerHeaderRow(el);\n inject(DestroyRef).onDestroy(() => this.#registration.unregisterHeaderRow(el));\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n numberAttribute,\n output,\n type Provider,\n type Signal,\n type Type,\n} from '@angular/core';\n\nimport {\n Collection,\n type ForTableCellHandle,\n registerHandle,\n TABLE_ROW_REGISTRATION_CONTEXT,\n} from 'forty-cdk/core';\nimport { eventFromInteractiveDescendant } from './interactive-descendant';\nimport {\n FOR_TABLE_ROW_CONTEXT,\n type ForTableRowContext,\n type TableSelectionMode,\n injectTableContext,\n injectTableRegistration,\n} from './table-context';\n\n/**\n * Payload emitted by {@link ForTableRow.activate} when a row you render yourself is activated in\n * `grid` / `treegrid` mode.\n */\nexport interface TableRawRowActivateEvent {\n /** The row's `[value]`, or `undefined` when the row carries none. */\n readonly value: unknown;\n /**\n * The originating event: the `MouseEvent` of a click, or the `Enter` `KeyboardEvent` the root\n * reported as `cellActivate`, already `preventDefault`ed.\n */\n readonly event: MouseEvent | KeyboardEvent;\n}\n\n/**\n * Marks a data row (`role=\"row\"`). Owns the registry of its data cells (for\n * `aria-colindex`) and registers itself with the root so it joins the row index\n * space and the 2D navigation grid. In `grid`/`treegrid` mode `aria-rowindex` is\n * 1-based and counts the header row as row 1, so the first data row is row 2 when\n * a header row is present (matching the APG Data Grid numbering).\n */\n@Directive({\n selector: '[forTableRow]',\n exportAs: 'forTableRow',\n host: {\n role: 'row',\n '[attr.aria-rowindex]': 'rowIndex()',\n '[attr.data-index]': 'virtualIndex()',\n '[attr.aria-selected]': 'ariaSelected()',\n '[attr.data-selected]': 'selected() ? \"\" : null',\n '[attr.aria-level]': 'ariaLevel()',\n '[attr.aria-posinset]': 'posinset()',\n '[attr.aria-setsize]': 'setsize()',\n '[attr.aria-expanded]': 'ariaExpanded()',\n '[attr.data-state]': 'expandState()',\n '(click)': 'onClick($event)',\n '(keydown)': 'onKeydown($event)',\n },\n providers: provideForTableRow(ForTableRow),\n})\nexport class ForTableRow implements ForTableRowContext {\n private readonly ctx = injectTableContext('ForTableRow');\n readonly #registration = injectTableRegistration('ForTableRow');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #cells = new Collection<ForTableCellHandle>();\n\n /**\n * This row's element injector. Exposed so a declarative renderer stamping\n * full-span variant content from a projected `<ng-template>` (e.g.\n * `ForTableBody`) can pass it as `[ngTemplateOutletInjector]`, letting\n * row-context-dependent primitives inside that content resolve this row.\n */\n readonly injector = inject(Injector);\n\n /** This row's selection identity, written into the table's `[(value)]`. Leave unset for non-selectable rows. */\n readonly value = input<unknown>();\n\n /** 1-based tree depth for `aria-level` in `mode=\"treegrid\"`. Ignored in other modes. */\n readonly level = input(1, { transform: numberAttribute });\n\n /** Marks this row as an expandable parent — emits `aria-expanded` + `data-state`. */\n readonly expandable = input(false, { transform: booleanAttribute });\n\n /**\n * Absolute 0-based index of this row in the full virtualized dataset. Set by the\n * consumer when rendering a window via `[forTableVirtualized]`; drives the absolute\n * `aria-rowindex` (except in `mode=\"table\"`) and keeps the focused row mounted\n * across recycling. Reflected as `data-index`, the attribute\n * `ForTableVirtualized.measureRow` reads the row's index from. Leave unset\n * (default `null`) for non-virtualized tables, which then emit no `data-index`.\n */\n readonly virtualIndex = input<number | null, unknown>(null, {\n transform: (v) => (v == null ? null : numberAttribute(v)),\n });\n\n /**\n * Fires in `grid` / `treegrid` mode when the row is activated, carrying its `[value]` and the\n * event: a click anywhere on the row except on an interactive descendant (the definition\n * `eventFromInteractiveDescendant` exports), or `Enter` on one of its data cells that holds no\n * widget, the same press the root emits as `cellActivate`. One binding therefore covers the\n * pointer and the keyboard, so the row needs no `(click)` of its own.\n *\n * `Enter` that enters a cell's widget, `Enter` or a click originating from an inner control,\n * and every event in `mode=\"table\"`, where the row has no keyboard path, never emit. In a\n * selectable grid a click also mutates the selection unless the root sets\n * `selectionBehavior=\"none\"`.\n */\n readonly activate = output<TableRawRowActivateEvent>();\n\n private readonly rowIndex = computed<number | null>(() => {\n if (this.ctx.mode() === 'table') {\n return null;\n }\n const offset = this.ctx.dataRowIndexOffset();\n const vi = this.virtualIndex();\n return vi !== null ? vi + 1 + offset : this.ctx.rowIndexOf(this.#host) + 1 + offset;\n });\n\n readonly selectionMode: Signal<TableSelectionMode> = this.ctx.selectionMode;\n\n readonly selected = computed(() => {\n const v = this.value();\n return v !== undefined && this.ctx.isRowSelected(v);\n });\n\n private readonly ariaSelected = computed<'true' | 'false' | null>(() => {\n if (\n this.ctx.mode() === 'table' ||\n this.ctx.selectionMode() === 'none' ||\n this.value() === undefined\n ) {\n return null;\n }\n return this.selected() ? 'true' : 'false';\n });\n\n /** Whether this expandable row is currently open. False for non-expandable rows. */\n readonly expanded = computed(() => {\n const v = this.value();\n return v !== undefined && this.ctx.isRowExpanded(v);\n });\n\n /** Toggles this row's expansion. No-op when the row is not expandable or has no `[value]`. */\n toggleExpanded(): void {\n if (this.expandable()) {\n this.ctx.toggleRowExpansion(this.value());\n }\n }\n\n private readonly ariaLevel = computed<number | null>(() =>\n this.ctx.mode() === 'treegrid' ? this.level() : null,\n );\n private readonly posinset = computed<number | null>(() =>\n this.ctx.mode() === 'treegrid' ? this.ctx.rowPosinset(this.#host) : null,\n );\n private readonly setsize = computed<number | null>(() =>\n this.ctx.mode() === 'treegrid' ? this.ctx.rowSetsize(this.#host) : null,\n );\n private readonly ariaExpanded = computed<'true' | 'false' | null>(() =>\n this.ctx.mode() === 'treegrid' && this.expandable()\n ? this.expanded()\n ? 'true'\n : 'false'\n : null,\n );\n private readonly expandState = computed<'open' | 'closed' | null>(() =>\n this.ctx.mode() === 'treegrid' && this.expandable()\n ? this.expanded()\n ? 'open'\n : 'closed'\n : null,\n );\n\n constructor() {\n const handle = {\n host: this.#host,\n cells: this.#cells.items,\n value: this.value,\n level: this.level,\n expandable: this.expandable,\n virtualIndex: this.virtualIndex,\n };\n registerHandle(\n handle,\n (h) => this.#registration.registerRow(h),\n (h) => this.#registration.unregisterRow(h),\n );\n }\n\n private registerCell(handle: ForTableCellHandle): void {\n this.#cells.register(handle);\n }\n\n private unregisterCell(handle: ForTableCellHandle): void {\n this.#cells.unregister(handle);\n }\n\n cellIndexOf(host: HTMLElement): number {\n return this.#cells.indexOfHost(host);\n }\n\n toggleSelected(): void {\n const v = this.value();\n if (v !== undefined) {\n this.ctx.toggleRowSelection(v);\n }\n }\n\n private onClick(event: MouseEvent): void {\n this.#select(event);\n if (this.ctx.mode() !== 'table' && !eventFromInteractiveDescendant(event)) {\n this.activate.emit({ value: this.value(), event });\n }\n }\n\n private onKeydown(event: KeyboardEvent): void {\n if (this.ctx.isCellActivation(event)) {\n this.activate.emit({ value: this.value(), event });\n }\n }\n\n #select(event: MouseEvent): void {\n const v = this.value();\n if (\n this.ctx.selectionMode() === 'none' ||\n v === undefined ||\n eventFromInteractiveDescendant(event)\n ) {\n return;\n }\n this.ctx.selectRow(v, {\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n shiftKey: event.shiftKey,\n });\n }\n}\n\n/**\n * The providers a `[forTableRow]` installs: the row context and the cell-registration wiring every\n * `[forTableCell]` inside it resolves, both aliased to `row`. Neither token is public, so a wrapper\n * that **subclasses** the row spreads this helper as its own `providers`:\n *\n * ```ts\n * providers: provideForTableRow(MyRow),\n * ```\n *\n * Wrapping through `hostDirectives: [ForTableRow]` needs none of this, because a host directive\n * brings its own providers to the element.\n */\nexport function provideForTableRow(row: Type<ForTableRow>): Provider[] {\n return [\n { provide: FOR_TABLE_ROW_CONTEXT, useExisting: row },\n { provide: TABLE_ROW_REGISTRATION_CONTEXT, useExisting: row },\n ];\n}\n","import { Directive, effect, ElementRef, inject, input } from '@angular/core';\n\n/**\n * Applies a per-row attribute map to a `<for-table-body>` stamped row. The body\n * places it on every stamped row so its `rowAttrs` hook can set or remove\n * arbitrary attributes derived from the row datum, without the body owning a\n * static list of attribute names. A key mapped to `null` (or dropped from a\n * later map) removes that attribute. Internal to `forty-cdk/table`.\n */\n@Directive({ selector: '[forTableRowAttrs]' })\nexport class ForTableRowAttrs {\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /** The attribute map to reflect on the row host, or `undefined` for none. */\n readonly attrs = input<Record<string, string | null> | undefined>(undefined, {\n alias: 'forTableRowAttrs',\n });\n\n constructor() {\n let applied: readonly string[] = [];\n effect(() => {\n const next = this.attrs() ?? {};\n for (const key of applied) {\n if (!(key in next)) {\n this.#host.removeAttribute(key);\n }\n }\n const keys: string[] = [];\n for (const [key, value] of Object.entries(next)) {\n if (value == null) {\n this.#host.removeAttribute(key);\n } else {\n this.#host.setAttribute(key, value);\n }\n keys.push(key);\n }\n applied = keys;\n });\n }\n}\n","import {\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\n\nimport { injectHostCarriesDragItem } from 'forty-cdk/core';\nimport { eventFromInteractiveDescendant } from './interactive-descendant';\nimport { injectTableContext } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/** Sort direction for a column header. `'none'` means unsorted (no aria-sort emitted). */\nexport type TableSortDirection = 'ascending' | 'descending' | 'none';\n\n/** Payload of `sortChange`: which column changed and its new direction. */\nexport interface TableSortDescriptor {\n column: string;\n direction: TableSortDirection;\n}\n\n/**\n * Turns a `[forTableHeaderCell]` into a sortable affordance that emits `aria-sort`\n * and fires `sortChange` on activation (click, Enter, Space). The directive is\n * **self-contained**: it owns only its own `direction` state and does NOT register\n * with the table context or auto-reset sibling headers. The \"one sorted column at a\n * time\" guarantee is the consumer's responsibility — hold a single sort descriptor\n * signal and derive each header's `direction` from it. Apply this directive on the\n * same element as `[forTableHeaderCell]`.\n *\n * The directive emits its own `tabindex=\"0\"` only in `mode=\"table\"`. In `grid` /\n * `treegrid` mode the header cell owns the roving composite tab stop, so this directive\n * emits no `tabindex`; `aria-sort` / `data-sorted` and click / keyboard activation stay\n * on the cell. When a `[forDraggable]` (column reorder) shares the same host cell — in\n * either mode — this directive also yields its `tabindex` to the draggable's roving tab\n * stop so the two never collide on the host attribute, and the keyboard activation splits\n * along WAI-ARIA lines: `Space` lifts the column for reordering while `Enter` toggles the\n * sort, so a single key press never both sorts and starts a drag-lift. A column pinned with\n * `[dragDisabled]` has no lift for `Space` to collide with, so it sorts on both keys like a\n * sort-only header. The draggable is detected however it is applied (in the template,\n * through `hostDirectives` or through a subclass), with no drag-drop value-import.\n *\n * While `sortable`, the directive reflects the `data-sortable` marker (a CSS styling\n * hook, absent when `sortable` is `false`). In `grid` / `treegrid` mode the header cell\n * reads that marker to defer APG cell entry on `Enter`: `Enter` toggles the sort and\n * keeps focus on the cell, while `F2` remains the cell-entry key — so a sortable +\n * resizable header does not both sort and drop focus onto the resize handle.\n *\n * Cycle (default `firstClickDirection='ascending'`): `none → ascending → descending → none`.\n * With `disableClear`: `none → ascending → descending → ascending`.\n *\n * `firstClickDirection='descending'` flips the entry pole, so a freshly activated\n * column starts descending: `none → descending → ascending → none` (and with\n * `disableClear`: `none → descending → ascending → descending`) — the descending-first\n * behavior used by single-always-active sort descriptors.\n *\n * A `click`, `Space`, or `Enter` originating from an interactive descendant of the\n * header cell — a stamped `[forTableColumnResizer]` handle, or a consumer-placed\n * `button` / `a[href]` / `input` / `select` / `textarea` / `summary` / editable\n * `contenteditable` / role-based control — does not toggle the sort and leaves the\n * descendant's own activation intact. (A non-native custom handle carrying only\n * `role=\"separator\"` / `tabindex` is not matched by the shared interactive-descendant\n * selector, so it would still bubble to sort; the stamped resize handle and the\n * documented example are native `<button>`s, so this is not a real path today.)\n */\n@Directive({\n selector: '[forTableSortHeader]',\n exportAs: 'forTableSortHeader',\n host: {\n '[attr.aria-sort]': 'activeDirection()',\n '[attr.data-sorted]': 'activeDirection()',\n '[attr.data-sortable]': \"sortable() ? '' : null\",\n '(click)': 'onClick($event)',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableSortHeader {\n private readonly ctx = injectTableContext('ForTableSortHeader');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #headerCell = inject(ForTableHeaderCell, { self: true, optional: true });\n readonly #hasDraggable = injectHostCarriesDragItem(this.#host);\n\n /** Column identity included in the `sortChange` payload. */\n readonly column = input.required<string>();\n\n /**\n * Current sort direction. Acts as both the controlled value and the initial value.\n * Its implicit `directionChange` output fires on every internal update (via\n * `[(direction)]`). `sortChange` is the primary column-aware event consumers bind:\n * it carries a `{ column, direction }` descriptor and fires on every activation,\n * regardless of whether the consumer uses two-way binding.\n */\n readonly direction = model<TableSortDirection>('none');\n\n /**\n * When `true`, the cycle skips the `'none'` step: `ascending → descending → ascending`.\n * Useful when clearing the sort is not allowed.\n */\n readonly disableClear = input(false, { transform: booleanAttribute });\n\n /**\n * Direction a previously-unsorted column enters on its first activation (the\n * `'none' → ?` step of the cycle). Defaults to `'ascending'`. Set to `'descending'`\n * for descending-first columns. The toggle between the two sorted directions and the\n * optional `'none'` step (`disableClear`) are unchanged.\n */\n readonly firstClickDirection = input<'ascending' | 'descending'>('ascending');\n\n /**\n * When `false`, the header is fully inert: no `tabindex`, no `aria-sort`, and click /\n * keyboard handlers are no-ops. Defaults to `true`.\n */\n readonly sortable = input(true, { transform: booleanAttribute });\n\n /**\n * Fires on every activation with the column identity and the new direction.\n * Consumers bind this to update their own sort descriptor and reorder rows.\n */\n readonly sortChange = output<TableSortDescriptor>();\n\n /**\n * Truthy-only `aria-sort` / `data-sorted` value: `'ascending'` or `'descending'`\n * while sorted, `null` (absent) when `direction` is `'none'` or `sortable` is `false`.\n */\n private readonly activeDirection = computed<TableSortDirection | null>(() =>\n this.sortable() && this.direction() !== 'none' ? this.direction() : null,\n );\n\n /**\n * Whether this sort header needs the host to be a standalone `tabindex=\"0\"` tab\n * stop: a sortable, non-draggable header. The header cell honors this only when it\n * is not part of the body's roving composite grid (`mode=\"table\"`, or a\n * column-reorder header row); in a plain grid / treegrid header the roving grid\n * owns the tab stop and this intent is superseded.\n */\n readonly #standaloneTabStop = computed(() => this.sortable() && !this.#hasDraggable());\n\n constructor() {\n this.#headerCell?.registerStandaloneTabStop(this.#standaloneTabStop);\n inject(DestroyRef).onDestroy(() =>\n this.#headerCell?.unregisterStandaloneTabStop(this.#standaloneTabStop),\n );\n }\n\n /**\n * Handles pointer activation, forwarding to `activate()` unless the click\n * originated from an interactive descendant of the header cell (which owns its\n * own activation).\n */\n private onClick(event: MouseEvent): void {\n if (eventFromInteractiveDescendant(event)) {\n return;\n }\n this.activate();\n }\n\n /** Activates the sort: computes the next direction, updates the model, and emits `sortChange`. */\n private activate(): void {\n if (!this.sortable()) return;\n const next = this.#next(this.direction());\n this.direction.set(next);\n this.sortChange.emit({ column: this.column(), direction: next });\n }\n\n /**\n * Handles Enter and Space keyboard activation, forwarding to `activate()`.\n * When a `[forDraggable]` (column reorder) shares the host cell, the two\n * activations split along WAI-ARIA lines: `Space` is reserved for the reorder\n * lift, and `Enter` while a keyboard drag is in progress (`data-dragging`)\n * for its drop, so this header only sorts on an idle `Enter`. A sort-only\n * header (no draggable) still sorts on both keys — and so does a header whose\n * draggable cannot lift (`data-disabled`, a column pinned with `[dragDisabled]`),\n * since there is no lift for `Space` to collide with\n * ([#1840](https://github.com/tutkli/forty-cdk/issues/1840)).\n */\n private onKeyDown(event: KeyboardEvent): void {\n const isEnter = event.key === 'Enter';\n const isSpace = event.key === ' ';\n if (!isEnter && !isSpace) {\n return;\n }\n if (eventFromInteractiveDescendant(event)) {\n return;\n }\n const draggableCanLift = this.#hasDraggable() && !this.#host.hasAttribute('data-disabled');\n if (draggableCanLift && (isSpace || this.#host.hasAttribute('data-dragging'))) {\n return;\n }\n event.preventDefault();\n this.activate();\n }\n\n #next(current: TableSortDirection): TableSortDirection {\n const first = this.firstClickDirection();\n const second = first === 'ascending' ? 'descending' : 'ascending';\n if (current === 'none') return first;\n if (current === first) return second;\n return this.disableClear() ? first : 'none';\n }\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n afterEveryRender,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n type ElementRef,\n inject,\n input,\n model,\n output,\n type Signal,\n type TemplateRef,\n viewChildren,\n type InputSignal,\n} from '@angular/core';\nimport { CssVarNamespacer } from '@angular/platform-browser';\n\nimport { assertInputBound, fortyError, isUnset, unsetInput, type Unset } from 'forty-cdk/core';\n\nimport { ForDraggable, ForDragPlaceholder } from 'forty-cdk/drag-drop';\n\nimport { assertColumnDefConfig, type ForTableColumnDef } from './column-def';\nimport {\n assertTableDefRegistry,\n type BoundColumnDef,\n type ForTableDefRegistry,\n injectOwnTableDefRegistry,\n provideForTableDefRegistry,\n type TableDefRegistry,\n} from './def-registry';\nimport { eventFromInteractiveDescendant } from './interactive-descendant';\nimport { assertRowDefConfig, type ForTableRowDef } from './row-def';\nimport { ForTableCell } from './table-cell';\nimport { ForTableColumnReorder, type TableColumnReorderDescriptor } from './table-column-reorder';\nimport {\n ForTableColumnResizer,\n type TableResizeDescriptor,\n type TableResizeRevertDescriptor,\n} from './table-column-resizer';\nimport { injectTableContext, injectTableRegistration } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\nimport { ForTableHeaderRow } from './table-header-row';\nimport { ForTableRow } from './table-row';\nimport { ForTableRowAttrs } from './table-row-attrs';\nimport {\n ForTableSortHeader,\n type TableSortDescriptor,\n type TableSortDirection,\n} from './table-sort-header';\n\n/**\n * Payload emitted by {@link ForTableBody.rowActivate} when a data row is\n * activated by a pointer click or the `Enter` key (whole-row navigation lists).\n */\nexport interface TableRowActivateEvent<T> {\n /** The activated row's datum. */\n readonly row: T;\n /** The activated row's 0-based dataset index (absolute when virtualized). */\n readonly index: number;\n /** The originating DOM event — a `MouseEvent` for a click, a `KeyboardEvent` for `Enter`. */\n readonly event: Event;\n}\n\n/**\n * Payload emitted by {@link ForTableBody.rowContextMenu} when a data row receives\n * a `contextmenu` event (right-click or the context-menu key).\n */\nexport interface TableRowContextMenuEvent<T> {\n /** The row's datum. */\n readonly row: T;\n /** The row's 0-based dataset index (absolute when virtualized). */\n readonly index: number;\n /** The originating `contextmenu` event; call `preventDefault()` to suppress the native menu. */\n readonly event: MouseEvent;\n}\n\n/** One row `<for-table-body>` renders, resolved from the static or virtualized path. */\ninterface RenderRow<T> {\n /** The row datum, passed to the data-cell template as `$implicit`. */\n readonly datum: T;\n /** Dataset index exposed to the data-cell template as `index` (absolute when virtualized). */\n readonly index: number;\n /** Absolute dataset index when virtualized (drives `[virtualIndex]`), else `null`. */\n readonly virtualIndex: number | null;\n /** Pixel offset for `translateY` when virtualized, else `null` (static flow layout). */\n readonly start: number | null;\n /** Selection identity from `rowKey`, or `undefined` when the row is not selectable (or a variant). */\n readonly value: unknown;\n /** `@for` tracking key: the selection identity, falling back to the dataset index. */\n readonly key: unknown;\n /** The matched full-span row variant, or `null` for a standard per-column row. */\n readonly variant: ForTableRowDef<unknown> | null;\n}\n\n/**\n * Ergonomic declarative renderer for the columns of a `[forTable]`.\n * Place `<for-table-body>` inside a `[forTable]` element and declare one\n * `[forTableColumnDef]` per column; the body harvests the defs and stamps the header\n * row and one data row per item out of the raw cell primitives, so a column is\n * authored in a single block instead of being smeared across header, data, and\n * placeholder rows.\n *\n * **Supported modes: `table` and `grid`.** Each stamped cell's role follows the table `mode`\n * (`cell` or `gridcell`). Choose `mode=\"grid\"` for interactive cells with roving 2D navigation, and\n * the default `mode=\"table\"` for read-only or whole-row navigation lists. `mode=\"treegrid\"` is out\n * of scope — the body stamps no expansion affordances.\n *\n * It owns only the grid **structure**: `display: grid` plus the `grid-template-columns` track\n * derived from each def's `width` and the published `--for-table-col-<name>-width` resize var. All\n * visual styling stays the consumer's, off the `data-*` and role hooks. The host is\n * `display: contents`, so it introduces no box between `[forTable]` and its rows; consumers wanting\n * full DOM control keep using the raw cell primitives.\n *\n * **Defs register themselves through DI rather than being content-queried**, so a preset column\n * component can declare a def in its own view and a scaffold wrapper can project consumer defs into\n * a body it owns (see `defs`). Registrations are exposed in document order, including defs mounted\n * later by `@if` or reordered by `@for`; `displayedColumns` pins an explicit render order on top.\n *\n * **Subclassing is not a supported wrapping shape.** Angular inherits neither `template` nor\n * `imports`, so a subclass renders nothing of the body, and its own `providers` array replaces the\n * one installing the def registry — a subclass missing `provideForTableDefRegistry()` throws a\n * `[forty-cdk/table]` error naming it. Compose the body in a wrapper's template instead.\n *\n * Sort and resize affordances are auto-wired from the per-column `sortable` / `resizable` flags.\n * Sorting stays consumer-applied: the body derives each header's `aria-sort` from `sort` and\n * re-emits activation through `sortChange`. Resize width state can be owned by the body through\n * `[(columnWidths)]`, keyed by column name, with per-def `resizeMin` / `resizeMax` / `resizeStep` /\n * `resizeLargeStep` / `resizeDisabled` / `autoFit` / `fitIncludesHeader` tuning; gesture-end\n * commits still surface through `resizeCommit`.\n * Selection stays consumer-placed — drop `[forTableRowSelector]` / `[forTableSelectAll]` into the\n * cell templates and set `rowKey` to give each row a selection identity.\n *\n * **Virtualization is transparent.** Adding `[forTableVirtualized]` to the same `[forTable]`\n * switches the body to windowed rendering: it renders only the visible slice of `rows`, sizes the\n * rowgroup to the full scroll height and positions each row at its offset. Pass the whole dataset\n * to `rows` — the total is derived from its length, so `[rowCount]` is needed only for a\n * server-known total larger than the loaded rows. Rows are fixed-size by default; set\n * `measureRows` for variable heights, which feeds each rendered row's real height back to the\n * virtualizer.\n *\n * **Row variants.** Declare one or more `[forTableRowDef]` alongside the columns; for each datum\n * the body picks the first whose `[when]` predicate returns `true`, and unmatched data renders the\n * standard per-column row. A `[forTableRowCellDef]` template stamps a full-span row whose single\n * cell spans every column, while the `placeholderCells` flag stamps per-column skeleton cells from\n * each column's `[forTablePlaceholderCellDef]`, falling back to `[forTablePlaceholderCellDefault]`.\n * Variant rows are presentational and non-selectable but still count towards `aria-rowindex` /\n * `aria-rowcount`. A full-span cell registers no cell handle, so arrow keys step over the row;\n * placeholder cells keep the grid rectangular but are stamped disabled, so navigation steps over\n * them too.\n */\n@Component({\n selector: 'for-table-body',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { style: 'display: contents' },\n providers: provideForTableDefRegistry(),\n imports: [\n NgTemplateOutlet,\n ForTableHeaderRow,\n ForTableHeaderCell,\n ForTableCell,\n ForTableRow,\n ForTableRowAttrs,\n ForTableSortHeader,\n ForTableColumnResizer,\n ForTableColumnReorder,\n ForDraggable,\n ForDragPlaceholder,\n ],\n template: `\n <ng-template #headerCellContent let-column let-cell=\"cell\">\n @let col = column.def;\n <ng-container\n [ngTemplateOutlet]=\"col.header()?.template ?? null\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n />\n @if (col.resizable()) {\n <button\n forTableColumnResizer\n [column]=\"column.name\"\n [width]=\"columnWidths()[column.name]\"\n [min]=\"col.resizeMin()\"\n [max]=\"col.resizeMax()\"\n [step]=\"col.resizeStep()\"\n [largeStep]=\"col.resizeLargeStep()\"\n [disabled]=\"col.resizeDisabled()\"\n [autoFit]=\"col.autoFit()\"\n [fitIncludesHeader]=\"col.fitIncludesHeader()\"\n [widthRevert]=\"onColumnWidthRevert\"\n [attr.aria-label]=\"col.resizeAriaLabel()\"\n (widthChange)=\"onColumnWidthChange(column.name, $event)\"\n (resizeCommit)=\"resizeCommit.emit($event)\"\n ></button>\n }\n </ng-template>\n\n @if (hasReorderable()) {\n <div\n forTableHeaderRow\n forTableColumnReorder\n [style.display]=\"'grid'\"\n [style.grid-template-columns]=\"track()\"\n (columnReorder)=\"columnReorder.emit($event)\"\n >\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n @if (col.reorderable()) {\n <div\n #headerCell=\"forTableHeaderCell\"\n forTableHeaderCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.headerClass()\"\n forTableSortHeader\n #sortHeader=\"forTableSortHeader\"\n [column]=\"column.name\"\n [sortable]=\"col.sortable()\"\n [direction]=\"directionFor(column.name)\"\n (sortChange)=\"onSortChange(sortHeader, $event)\"\n forDraggable\n [dragData]=\"column.name\"\n >\n <ng-container\n [ngTemplateOutlet]=\"headerCellContent\"\n [ngTemplateOutletInjector]=\"headerCell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: column, cell: headerCell }\"\n />\n @if (columnDragPlaceholder(); as placeholder) {\n <ng-template forDragPlaceholder>\n <ng-container [ngTemplateOutlet]=\"placeholder.template\" />\n </ng-template>\n }\n </div>\n } @else {\n <div\n #headerCell=\"forTableHeaderCell\"\n forTableHeaderCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.headerClass()\"\n forTableSortHeader\n #sortHeader=\"forTableSortHeader\"\n [column]=\"column.name\"\n [sortable]=\"col.sortable()\"\n [direction]=\"directionFor(column.name)\"\n (sortChange)=\"onSortChange(sortHeader, $event)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"headerCellContent\"\n [ngTemplateOutletInjector]=\"headerCell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: column, cell: headerCell }\"\n />\n </div>\n }\n }\n </div>\n } @else {\n <div forTableHeaderRow [style.display]=\"'grid'\" [style.grid-template-columns]=\"track()\">\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #headerCell=\"forTableHeaderCell\"\n forTableHeaderCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.headerClass()\"\n forTableSortHeader\n #sortHeader=\"forTableSortHeader\"\n [column]=\"column.name\"\n [sortable]=\"col.sortable()\"\n [direction]=\"directionFor(column.name)\"\n (sortChange)=\"onSortChange(sortHeader, $event)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"headerCellContent\"\n [ngTemplateOutletInjector]=\"headerCell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: column, cell: headerCell }\"\n />\n </div>\n }\n </div>\n }\n <div\n role=\"rowgroup\"\n [style.position]=\"sizerHeight() !== null ? 'relative' : null\"\n [style.height.px]=\"sizerHeight()\"\n >\n @if (loading()) {\n @for (placeholder of placeholderRange(); track placeholder) {\n <div forTableRow [style.display]=\"'grid'\" [style.grid-template-columns]=\"track()\">\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #cell=\"forTableCell\"\n forTableCell\n disabled\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.cellClass()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"placeholderTemplateFor(col)\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n />\n </div>\n }\n </div>\n }\n } @else {\n @for (r of renderRows(); track r.key) {\n <div\n #rowRef=\"forTableRow\"\n #rowEl\n forTableRow\n [value]=\"r.value\"\n [virtualIndex]=\"r.virtualIndex\"\n [attr.tabindex]=\"rowTabIndex(r)\"\n [class]=\"rowClassFor(r)\"\n [forTableRowAttrs]=\"rowAttrsFor(r)\"\n [style.display]=\"'grid'\"\n [style.grid-template-columns]=\"track()\"\n [style.position]=\"r.start !== null ? 'absolute' : null\"\n [style.left]=\"r.start !== null ? '0' : null\"\n [style.right]=\"r.start !== null ? '0' : null\"\n [style.transform]=\"r.start !== null ? 'translateY(' + r.start + 'px)' : null\"\n (click)=\"onRowClick(r, $event)\"\n (keydown.enter)=\"onRowEnter(r, $event)\"\n (contextmenu)=\"onRowContextMenu(r, $event)\"\n >\n @if (r.variant; as variant) {\n @if (variant.placeholderCells()) {\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #cell=\"forTableCell\"\n forTableCell\n disabled\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.cellClass()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"placeholderTemplateFor(col)\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n />\n </div>\n }\n } @else {\n <div\n [attr.role]=\"cellRole()\"\n [attr.aria-colindex]=\"1\"\n [attr.aria-colspan]=\"orderedColumns().length\"\n [attr.data-row-variant]=\"''\"\n [style.grid-column]=\"'1 / -1'\"\n >\n <ng-container\n [ngTemplateOutlet]=\"variant.cell()?.template ?? null\"\n [ngTemplateOutletInjector]=\"rowRef.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: r.datum, index: r.index }\"\n />\n </div>\n }\n } @else {\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #cell=\"forTableCell\"\n forTableCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.cellClass()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"col.dataCell()?.template ?? null\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: r.datum, index: r.index }\"\n />\n </div>\n }\n }\n </div>\n }\n }\n </div>\n <ng-content />\n `,\n})\nexport class ForTableBody<T = unknown> {\n readonly #ctx = injectTableContext('ForTableBody');\n readonly #registration = injectTableRegistration('ForTableBody');\n readonly #namespacer = inject(CssVarNamespacer);\n\n private readonly rowEls = viewChildren<ElementRef<HTMLElement>>('rowEl');\n readonly #measuredAt = new WeakMap<HTMLElement, string>();\n\n constructor() {\n const bodyRowCount = computed(() =>\n this.loading() ? Math.max(0, this.placeholderRows()) : this.#data().length,\n );\n assertInputBound(this.rows, 'table', '<for-table-body>', 'rows');\n this.#registration.registerBodyRowCount(bodyRowCount);\n inject(DestroyRef).onDestroy(() => this.#registration.registerBodyRowCount(null));\n this.#publishColumnWidths();\n\n afterEveryRender(() => {\n const window = this.#registration.virtualWindow();\n if (!window || !this.measureRows()) {\n return;\n }\n for (const ref of this.rowEls()) {\n const el = ref.nativeElement;\n const index = el.getAttribute('data-index');\n if (index === null || this.#measuredAt.get(el) === index) {\n continue;\n }\n this.#measuredAt.set(el, index);\n window.measureRow(el);\n }\n window.measureRow(null);\n });\n }\n\n /**\n * The rows to render — already sorted / filtered / paged by the consumer (BYO-data). Mandatory —\n * a body with no binding throws in dev mode.\n */\n readonly rows: InputSignal<readonly T[] | Unset> = input(unsetInput<readonly T[]>());\n\n readonly #data = computed<readonly T[]>(() => {\n const rows = this.rows();\n return isUnset(rows) ? [] : rows;\n });\n\n /**\n * Row identity used both for `@for` tracking and each row's selection `[value]`.\n * Omit it for non-selectable, index-tracked tables.\n */\n readonly rowKey = input<(row: T, index: number) => unknown>();\n\n /**\n * Which columns render, in order. Defaults to every registered `[forTableColumnDef]`\n * in document order. Names not matching a registered column are skipped.\n */\n readonly displayedColumns = input<readonly string[] | null>(null);\n\n /**\n * The single active sort descriptor. Each `sortable` column derives its\n * `aria-sort` from it (the \"one sorted column\" rule); the consumer updates it\n * from `sortChange` and re-sorts `rows`. An activation the consumer does not\n * adopt leaves every header's `aria-sort` where `sort` puts it.\n */\n readonly sort = input<TableSortDescriptor | null>(null);\n\n /**\n * When set, render `placeholderRows` skeleton rows instead of data. Each cell\n * stamps the column's own `[forTablePlaceholderCellDef]`, else the body-level\n * `[forTablePlaceholderCellDefault]`, else nothing.\n */\n readonly loading = input(false, { transform: booleanAttribute });\n\n /** Number of placeholder rows rendered while `loading`. Default `3`. */\n readonly placeholderRows = input(3);\n\n /**\n * Opt in to **measured (variable) row heights** under `[forTableVirtualized]`.\n * When set, the body measures each stamped row after render and feeds its real\n * height back to the virtualizer, which replaces the `estimateRowSize` estimate\n * and re-aligns the offsets of the rows below — so a window mixing row shapes\n * (denser variant rows, group separators) stays contiguous after scroll.\n *\n * Off by default: a uniform-height table keeps the pure `estimateRowSize` fast\n * path with no per-row measurement work. Has no effect without\n * `[forTableVirtualized]` (there is no window to measure against).\n *\n * Measurement is not one-shot. The body's per-render measure is throttled per\n * `data-index`, so it covers only a row's initial post-render measurement and any\n * row recycled to a new index. Subsequent size changes of the **same mounted row**\n * (async content, image load, cell reflow) are re-measured automatically by the\n * virtualizer's own `ResizeObserver` — which re-aligns the offsets of the rows below\n * without any consumer action — so a row whose content loads asynchronously needs no\n * manual re-measure trigger.\n */\n readonly measureRows = input(false, { transform: booleanAttribute });\n\n /** Fires when a `sortable` header is activated; forwarded from the internal `[forTableSortHeader]`. */\n readonly sortChange = output<TableSortDescriptor>();\n\n /** Fires when a `resizable` column commits a width; forwarded from the internal `[forTableColumnResizer]`. */\n readonly resizeCommit = output<TableResizeDescriptor>();\n\n /**\n * Fires once per committed column reorder gesture (pointer drop or keyboard drop),\n * forwarded unchanged from the internal `[forTableColumnReorder]`. Its `from` / `to`\n * are indices into the **full displayed column order** (counting non-reorderable\n * columns), so a table with fixed columns applies `moveItemInArray(displayedColumns,\n * from, to)` over the whole `displayedColumns` array. Its `columns` lists the\n * reorderable columns in their new order (equal to the full displayed order only when\n * every displayed column is `reorderable`) — setting `displayedColumns` directly to\n * `columns` is valid only in that all-reorderable case, otherwise the fixed columns\n * are dropped. Only present when at least one `[forTableColumnDef]` is `reorderable`.\n */\n readonly columnReorder = output<TableColumnReorderDescriptor>();\n\n /**\n * Two-way map of column widths (px), keyed by column `name`. A width in the map\n * sizes its displayed column's grid track whether or not the column is\n * `resizable`, and a column whose `resizable` turns off keeps it. It also seeds\n * each `resizable` column's stamped handle `[width]`, so the `role=\"separator\"`\n * handle exposes `aria-valuenow` from the first render, and is updated immutably\n * on every live width change the handle reports (pointer drag, keyboard resize,\n * auto-fit), including the pre-drag revert of a handle destroyed mid-drag. A\n * cancelled gesture on a column the map held no width for removes the key again.\n * Names that match no displayed column are ignored.\n *\n * The map is JSON-serializable, so persisting a user's column layout is\n * `[(columnWidths)]` plus one storage write. Together with `[displayedColumns]`\n * and `[sort]` it makes the full user-configurable table state three bindings.\n * Its implicit `columnWidthsChange` fires only on handle-driven updates, not on\n * consumer writes through `[(columnWidths)]`.\n */\n readonly columnWidths = model<Readonly<Record<string, number>>>({});\n\n /**\n * Opt-in whole-row interaction for **navigation lists**. When set, a pointer click\n * on a data row emits `rowActivate` and a `contextmenu` (right-click or the\n * context-menu key) emits `rowContextMenu`, in every `mode`. Full-span\n * `[forTableRowDef]` variant rows stay non-interactive.\n *\n * The **keyboard** half depends on `mode`. In the default `mode=\"table\"` each data row\n * also becomes a focusable tab stop (`tabindex=\"0\"`) and `Enter` emits `rowActivate`.\n * In `grid` / `treegrid` mode the row takes no tab stop, so the roving 2D navigation\n * stays intact: `Enter` on a focused data cell emits `rowActivate` when the cell holds\n * no widget to enter (the root's `cellActivate`), and enters the widget otherwise.\n *\n * Pair it with `selectionBehavior=\"none\"` on the root to get the \"checkbox selects,\n * row opens the record\" shape: with any other behavior a row click in a selectable\n * grid both activates the row and mutates the selection.\n *\n * Interactive content inside a data cell owns its own events: a click or `Enter` originating from\n * a `button`, `a[href]`, `input`, `select`, `textarea`, `summary`, `label`,\n * `audio` / `video[controls]`, an editable `contenteditable` region, or an element carrying an\n * interactive ARIA role does **not** emit `rowActivate`, and its native default action is left\n * intact. The row still activates from anywhere else — cell text, the gaps between cells, or the\n * focused row host.\n *\n * `rowContextMenu` is unguarded, so a right-click over an inner control still offers\n * the row's context menu, matching native lists.\n */\n readonly interactiveRows = input(false, { transform: booleanAttribute });\n\n /**\n * Fires when a data row is activated by a pointer click, by `Enter` on the row in\n * `mode=\"table\"`, or by `Enter` on a widget-free data cell in `grid` / `treegrid`,\n * carrying the row datum, its dataset index, and the originating event. Requires\n * `interactiveRows`.\n */\n readonly rowActivate = output<TableRowActivateEvent<T>>();\n\n /**\n * Fires when a data row receives a `contextmenu` event (right-click or the\n * context-menu key), carrying the row datum, its dataset index, and the event —\n * position your own overlay from it. Requires `interactiveRows`.\n */\n readonly rowContextMenu = output<TableRowContextMenuEvent<T>>();\n\n /**\n * Per-row class hook, applied to data **and** variant rows in **every** mode.\n * Receives the row datum and its 0-based dataset index and returns the class(es)\n * to apply — a string, a `{ className: boolean }` map, or `undefined` for none.\n * This is the only seam for styling a body-owned row from its datum (an\n * \"active\" / \"menu-open\" highlight, error or dimmed rows). Evaluated on every\n * change-detection pass, so keep it cheap and free of side effects.\n */\n readonly rowClass =\n input<(row: T, index: number) => string | Record<string, boolean> | undefined>();\n\n /**\n * Per-row attribute hook, applied to data **and** variant rows in **every**\n * mode. Receives the row datum and its 0-based dataset index and returns an\n * attribute map to reflect on the row host; a key mapped to `null` (or dropped\n * from a later map) removes that attribute. Evaluated on every change-detection\n * pass, so keep it cheap and free of side effects.\n */\n readonly rowAttrs = input<(row: T, index: number) => Record<string, string | null> | undefined>();\n\n /**\n * An external def registry to render from, for a **scaffold wrapper**: a\n * component whose template owns the `[forTable]` shell and this body, and whose\n * consumers declare their `[forTableColumnDef]` / `[forTableRowDef]` blocks as projected\n * content. Those defs are content of the wrapper, not of this body, so they\n * register with the wrapper's own registry — provide one with\n * `provideForTableDefRegistry()` and bind `inject(FOR_TABLE_DEF_REGISTRY)` here.\n *\n * When set, this registry **replaces** the body's own: defs the wrapper declares\n * inside the `<for-table-body>` tags would register with the body instead and be\n * ignored, so the body throws rather than dropping them — declare a wrapper's\n * own defs next to the projected ones (outside the body element), where they\n * reach the same registry. Defaults to `null` (the body renders the defs\n * declared in its own content).\n */\n readonly defs = input<ForTableDefRegistry | null>(null);\n\n readonly #ownDefs = injectOwnTableDefRegistry();\n\n readonly #defs = computed<TableDefRegistry>(() => {\n const external = this.defs();\n if (!external) {\n return this.#ownDefs;\n }\n const registry = assertTableDefRegistry(external);\n if (!this.#ownDefs.isEmpty()) {\n throw fortyError({\n code: 'FORCDK-TABLE-004',\n message:\n '<for-table-body> was given a [defs] registry and also has def(s) declared inside its ' +\n 'own tags, which are ignored.',\n cause: 'The body renders exactly one registry: the one bound to [defs].',\n fix:\n 'Declare those defs alongside the projected ones, outside the <for-table-body> element, ' +\n 'so they register with the same registry.',\n });\n }\n return registry;\n });\n\n /** The registered column definitions, in document order. */\n private readonly columns = computed(() => this.#defs().columnDefs());\n\n /** The registered full-span row variants, in document order (first match wins per datum). */\n private readonly rowDefs = computed(() => this.#defs().rowDefs());\n\n /** The optional shared drag placeholder for reorderable columns, or `null`. */\n private readonly columnDragPlaceholder = computed(() => this.#defs().columnDragPlaceholder());\n\n /** The optional body-level default placeholder-cell template, or `null`. */\n private readonly placeholderCellDefault = computed(() => this.#defs().placeholderCellDefault());\n\n /**\n * Resolves the placeholder template a column stamps into its cell, in both\n * stamping paths: the column's own `[forTablePlaceholderCellDef]`, else the body-level\n * `[forTablePlaceholderCellDefault]`, else `null` for an empty cell.\n */\n private placeholderTemplateFor(col: ForTableColumnDef): TemplateRef<unknown> | null {\n return col.placeholderCell()?.template ?? this.placeholderCellDefault()?.template ?? null;\n }\n\n /** The role a stamped cell carries: `'cell'` in `table` mode, `'gridcell'` otherwise. */\n private readonly cellRole = computed(() => (this.#ctx.mode() === 'table' ? 'cell' : 'gridcell'));\n\n /** The columns to render, resolved from `displayedColumns` (or all defs, in order). */\n private readonly orderedColumns = computed<readonly BoundColumnDef[]>(() => {\n const columns = this.columns();\n const order = this.displayedColumns();\n if (!order) {\n return columns;\n }\n const byName = new Map(columns.map((column) => [column.name, column]));\n return order\n .map((name) => byName.get(name))\n .filter((column): column is BoundColumnDef => column != null);\n });\n\n /**\n * `true` when at least one displayed column is `reorderable`, switching the stamped\n * header row to the drag-reorder path (`[forTableColumnReorder]` + per-cell\n * `[forDraggable]`). A body with no reorderable column keeps the plain header row.\n */\n private readonly hasReorderable = computed(() =>\n this.orderedColumns().some((column) => column.def.reorderable()),\n );\n\n /**\n * The derived `grid-template-columns` track, applied to the header row and every\n * data row and exposed for consumers who want to bind it elsewhere. Each column\n * contributes its `width`, or the published resize var falling back to the column's\n * `fallbackWidth` (`minmax(0, 1fr)` when that is unset too).\n */\n readonly track: Signal<string> = computed(() =>\n this.orderedColumns()\n .map(({ def, name }) => {\n assertColumnDefConfig(def, name);\n return (\n def.width() ??\n `var(${this.#namespacer.namespace(`--for-table-col-${name}-width`)}, ${def.fallbackWidth() ?? 'minmax(0, 1fr)'})`\n );\n })\n .join(' '),\n );\n\n /**\n * The rows to render this change-detection pass. When `[forTableVirtualized]`\n * has published a window it maps the window's slice into `rows` (absolute\n * index + pixel offset per row); otherwise it maps every row in flow order.\n */\n private readonly renderRows = computed<readonly RenderRow<T>[]>(() => {\n const window = this.#registration.virtualWindow();\n const data = this.#data();\n const key = this.rowKey();\n const variants = this.rowDefs();\n for (const { def } of variants) {\n assertRowDefConfig(def);\n }\n const matchVariant = (datum: T, index: number): ForTableRowDef<unknown> | null =>\n variants.find(({ when }) => when(datum, index))?.def ?? null;\n if (window) {\n const out: RenderRow<T>[] = [];\n for (const vrow of window.rows()) {\n const datum = data[vrow.index];\n if (datum === undefined) {\n continue;\n }\n const identity = key?.(datum, vrow.index);\n const variant = matchVariant(datum, vrow.index);\n out.push({\n datum,\n index: vrow.index,\n virtualIndex: vrow.index,\n start: vrow.start,\n value: variant ? undefined : identity,\n key: identity ?? vrow.index,\n variant,\n });\n }\n return out;\n }\n return data.map((datum, i) => {\n const identity = key?.(datum, i);\n const variant = matchVariant(datum, i);\n return {\n datum,\n index: i,\n virtualIndex: null,\n start: null,\n value: variant ? undefined : identity,\n key: identity ?? i,\n variant,\n };\n });\n });\n\n /** Full scroll height (px) applied to the rowgroup when virtualized, else `null` (natural height). */\n private readonly sizerHeight = computed<number | null>(() => {\n const window = this.#registration.virtualWindow();\n return window && !this.loading() ? window.totalSize() : null;\n });\n\n private readonly placeholderRange = computed(() =>\n Array.from({ length: Math.max(0, this.placeholderRows()) }, (_, i) => i),\n );\n\n /** Resolves a `sortable` column's current direction from the single `sort` descriptor. */\n private directionFor(column: string): TableSortDirection {\n const descriptor = this.sort();\n return descriptor && descriptor.column === column ? descriptor.direction : 'none';\n }\n\n /**\n * Whether the keyboard half of whole-row interaction is active: opted in via\n * `interactiveRows` and in `table` mode, the only mode where a row may own a tab\n * stop and `Enter` without colliding with the roving grid's cell-entry.\n */\n private readonly rowsKeyboardInteractive = computed(\n () => this.interactiveRows() && this.#ctx.mode() === 'table',\n );\n\n /** The `tabindex` for a stamped row: `0` for a keyboard-interactive data row, `null` otherwise. */\n private rowTabIndex(row: RenderRow<T>): 0 | null {\n return this.rowsKeyboardInteractive() && !row.variant ? 0 : null;\n }\n\n /** Resolves the `rowClass` hook for a stamped row, or `undefined` when unset. */\n private rowClassFor(row: RenderRow<T>): string | Record<string, boolean> | undefined {\n return this.rowClass()?.(row.datum, row.index);\n }\n\n /** Resolves the `rowAttrs` hook for a stamped row, or `undefined` when unset. */\n private rowAttrsFor(row: RenderRow<T>): Record<string, string | null> | undefined {\n return this.rowAttrs()?.(row.datum, row.index);\n }\n\n /**\n * Publishes `--for-table-col-<name>-width` for every displayed column the `[(columnWidths)]` map\n * holds a width for, whether or not the column is `resizable`, and removes the var of a column\n * that leaves the map or the displayed set, or when the body unmounts. The map owns the width:\n * a stamped handle only reports changes into it, so turning `resizable` off keeps the track.\n */\n #publishColumnWidths(): void {\n let published = new Set<string>();\n effect(() => {\n const widths = this.columnWidths();\n const next = new Set<string>();\n for (const { name } of this.orderedColumns()) {\n const width = widths[name];\n if (width != null) {\n this.#registration.setColumnWidth(name, width);\n next.add(name);\n }\n }\n for (const name of published) {\n if (!next.has(name)) {\n this.#registration.removeColumnWidth(name);\n }\n }\n published = next;\n });\n inject(DestroyRef).onDestroy(() => {\n for (const name of published) {\n this.#registration.removeColumnWidth(name);\n }\n });\n }\n\n /**\n * Folds a stamped resizer's live width update into the `[(columnWidths)]` map\n * immutably, keyed by the column name. An `undefined` width — a cancelled gesture on a\n * column that had no width — removes the key, so the column keeps following its\n * `fallbackWidth`. No-ops when the map already holds the value, so seeding the handle\n * from `columnWidths` never loops back into a redundant model write.\n */\n private onColumnWidthChange(column: string, width: number | undefined): void {\n const current = this.columnWidths();\n if (width === undefined) {\n if (!Object.hasOwn(current, column)) {\n return;\n }\n const next = { ...current };\n delete next[column];\n this.columnWidths.set(next);\n return;\n }\n if (current[column] === width) {\n return;\n }\n this.columnWidths.set({ ...current, [column]: width });\n }\n\n /**\n * Folds a stamped resizer's teardown revert into `[(columnWidths)]`, so a handle destroyed\n * mid-drag — its column dropped from `displayedColumns`, or `resizable` toggled off — does not\n * leave the transient drag width in the map.\n *\n * A function reference rather than an output, because the revert happens during the handle's\n * teardown. The body outlives it, so its own `columnWidthsChange` still reaches the consumer.\n */\n private readonly onColumnWidthRevert = (descriptor: TableResizeRevertDescriptor): void => {\n this.onColumnWidthChange(descriptor.column, descriptor.width);\n };\n\n /**\n * Re-emits a stamped header's activation through `sortChange`, then puts the header's\n * direction back on `sort`. The header writes the direction it computed into its own model,\n * and the `[direction]` binding is pushed again only when `sort` changes, so a consumer that\n * ignores the event would otherwise leave the header announcing a sort `sort` does not hold.\n */\n private onSortChange(header: ForTableSortHeader, descriptor: TableSortDescriptor): void {\n header.direction.set(this.directionFor(descriptor.column));\n this.sortChange.emit(descriptor);\n }\n\n private onRowClick(row: RenderRow<T>, event: MouseEvent): void {\n if (this.interactiveRows()) {\n this.#activateRow(row, event);\n }\n }\n\n private onRowEnter(row: RenderRow<T>, event: Event): void {\n if (this.rowsKeyboardInteractive()) {\n if (this.#activateRow(row, event)) {\n event.preventDefault();\n }\n return;\n }\n if (this.interactiveRows() && this.#ctx.isCellActivation(event)) {\n this.#activateRow(row, event);\n }\n }\n\n private onRowContextMenu(row: RenderRow<T>, event: MouseEvent): void {\n if (!this.interactiveRows() || row.variant) {\n return;\n }\n this.rowContextMenu.emit({ row: row.datum, index: row.index, event });\n }\n\n #activateRow(row: RenderRow<T>, event: Event): boolean {\n if (row.variant || eventFromInteractiveDescendant(event)) {\n return false;\n }\n this.rowActivate.emit({ row: row.datum, index: row.index, event });\n return true;\n }\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectTableContext } from './table-context';\n\n/**\n * Marks the single full-span cell of a presentational row — a group separator, a\n * section header, a summary line — authored with the raw primitives. Emits the\n * markup `<for-table-body>` stamps for a `[forTableRowCellDef]` variant row: the\n * `role` derived from the root's `mode` (`'cell'` in `table` mode, `'gridcell'`\n * otherwise), `aria-colindex=\"1\"`, an `aria-colspan` covering the grid's rendered\n * columns, and the `data-row-variant` styling hook.\n *\n * Unlike `[forTableCell]` it registers **no** cell handle, which is the whole point:\n * in `grid` / `treegrid` mode the row contributes nothing to the roving grid, so\n * arrow navigation steps over it, the column count keeps coming from the data rows\n * around it, and the header row still joins the composite tab stop. Spanning the row\n * visually stays the consumer's CSS (`grid-column: 1 / -1`, or a `colspan` attribute\n * in a native `<table>`).\n */\n@Directive({\n selector: '[forTableVariantCell]',\n exportAs: 'forTableVariantCell',\n host: {\n 'data-row-variant': '',\n '[attr.role]': 'role()',\n '[attr.aria-colindex]': '1',\n '[attr.aria-colspan]': 'colSpan()',\n },\n})\nexport class ForTableVariantCell {\n readonly #ctx = injectTableContext('ForTableVariantCell');\n\n private readonly role = computed(() => (this.#ctx.mode() === 'table' ? 'cell' : 'gridcell'));\n\n private readonly colSpan = computed<number | null>(() => {\n const cols = this.#ctx.columnCount();\n return cols > 0 ? cols : null;\n });\n}\n","import { computed, Directive, input } from '@angular/core';\n\nimport { hostAriaLabel, hostButtonType } from 'forty-cdk/core';\n\nimport { injectTableCellTabIndex } from './cell-tab-index';\nimport { injectTableContext, injectTableRowContext } from './table-context';\n\n/**\n * Accessible per-row selection checkbox inside a `[forTableRow]`. Renders\n * `role=\"checkbox\"` reflecting the row's selection via `aria-checked=\"true\" | \"false\"`\n * and `data-state=\"checked\" | \"unchecked\"` for styling. Clicking (or Space / Enter\n * while focused) toggles the row's selection.\n *\n * In `mode=\"table\"` it is the focusable keyboard selection path: it is a standalone\n * tab stop (`tabindex=\"0\"`), reached with `Tab` and toggled with `Space` / `Enter`.\n * In `grid` / `treegrid` mode it yields its tab stop to the composite roving grid\n * (`tabindex=\"-1\"`) — selection is driven from the cell (`Space`) — but it stays a\n * named, non-hidden checkbox in the accessibility tree.\n *\n * Give it an accessible name via `ariaLabel` (or an external label). The enclosing\n * row still owns the row-level `aria-selected`.\n */\n@Directive({\n selector: '[forTableRowSelector]',\n exportAs: 'forTableRowSelector',\n host: {\n role: 'checkbox',\n '[attr.type]': 'buttonType()',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-checked]': 'ariaChecked()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.data-state]': 'dataState()',\n '(click)': 'onClick($event)',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableRowSelector {\n private readonly ctx = injectTableContext('ForTableRowSelector');\n private readonly row = injectTableRowContext('ForTableRowSelector');\n\n /** Accessible label for the selection checkbox (e.g. \"Select row\"). Truthy-only. */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ariaLabel() || null);\n\n private readonly tabindex = injectTableCellTabIndex();\n\n private readonly buttonType = hostButtonType();\n\n private readonly ariaChecked = computed<'true' | 'false'>(() =>\n this.row.selected() ? 'true' : 'false',\n );\n\n private readonly dataState = computed(() => (this.row.selected() ? 'checked' : 'unchecked'));\n\n private onClick(event: MouseEvent): void {\n event.stopPropagation();\n this.row.toggleSelected();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.row.toggleSelected();\n }\n }\n}\n","import { computed, Directive, input, output } from '@angular/core';\n\nimport { hostAriaLabel, hostButtonType } from 'forty-cdk/core';\n\nimport { injectTableCellTabIndex } from './cell-tab-index';\nimport { injectTableContext, type TableSelectAllState } from './table-context';\n\n/**\n * Header \"select all\" checkbox for a `[forTable]` in `selectionMode=\"multiple\"`.\n * Reflects `aria-checked=\"true\" | \"false\" | \"mixed\"` and\n * `data-state=\"checked\" | \"unchecked\" | \"indeterminate\"` derived from how many\n * selectable rows are selected. Clicking (or Space / Enter) selects all rows\n * when none/some are selected, and deselects them when all are, keeping selected\n * values outside the selectable rows. No-op outside multiple mode.\n *\n * Bind `[state]` to drive it from a selection the table cannot enumerate (a\n * server-side \"every row matching the filter\" predicate): the checkbox then\n * reflects that state and emits `toggleAll` instead of writing the table's\n * `[(value)]`.\n *\n * In `mode=\"table\"` it is a standalone tab stop (`tabindex=\"0\"`) and can sit on any\n * focusable element (a `<span>` you make tabbable, or a `<button>`, which it forces to\n * `type=\"button\"` so toggling never submits a surrounding `<form>`).\n * In `mode=\"grid\"` / `\"treegrid\"` it yields its tab stop to the composite roving grid\n * (`tabindex=\"-1\"`) and is reached via cell-entry (Enter / F2, then `Tab` when it is not\n * the cell's first widget), so it must sit on a natively-focusable element (a\n * `<button>`) — a `tabindex`-only `<span>` is cell-entry-reachable only in\n * `mode=\"table\"`. A grid whose header row does not join the grid leaves it a standalone\n * tab stop (`tabindex=\"0\"`), since no cell entry reaches it there.\n */\n@Directive({\n selector: '[forTableSelectAll]',\n exportAs: 'forTableSelectAll',\n host: {\n role: 'checkbox',\n '[attr.type]': 'buttonType()',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-checked]': 'ariaChecked()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.data-state]': 'dataState()',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableSelectAll {\n private readonly ctx = injectTableContext('ForTableSelectAll');\n\n /** Accessible label for the control (e.g. \"Select all rows\"). Truthy-only. */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Externally owned tri-state. When `null` (default) the checkbox reflects the table's\n * own aggregate over `[selectableValues]` or the rendered rows, and an activation\n * toggles the table's `[(value)]`. When bound, `aria-checked` / `data-state` follow it\n * and an activation emits `toggleAll` instead, leaving the table's `value` untouched.\n */\n readonly state = input<TableSelectAllState | null>(null);\n\n /**\n * Fires on a click, `Space` or `Enter` while `[state]` is bound. The consumer updates\n * the selection it owns; never fires while `[state]` is `null`.\n */\n readonly toggleAll = output<void>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ariaLabel() || null);\n\n private readonly tabindex = injectTableCellTabIndex();\n\n private readonly buttonType = hostButtonType();\n\n readonly #resolvedState = computed(() => this.state() ?? this.ctx.selectAllState());\n\n private readonly ariaChecked = computed<'true' | 'false' | 'mixed'>(() => {\n const state = this.#resolvedState();\n return state === 'all' ? 'true' : state === 'some' ? 'mixed' : 'false';\n });\n\n private readonly dataState = computed(() => {\n const state = this.#resolvedState();\n return state === 'all' ? 'checked' : state === 'some' ? 'indeterminate' : 'unchecked';\n });\n\n private onClick(): void {\n this.#toggle();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.#toggle();\n }\n }\n\n #toggle(): void {\n if (this.state() === null) {\n this.ctx.toggleSelectAll();\n } else {\n this.toggleAll.emit();\n }\n }\n}\n","import { DestroyRef, Directive, ElementRef, inject } from '@angular/core';\n\nimport { orphanContextError } from 'forty-cdk/core';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/**\n * Marks the element inside a `[forTableHeaderCell]` that carries the column's\n * label text. It owns no role, ARIA, or DOM of its own — it is a structure-agnostic\n * hook so a sibling `[forTableColumnResizer]` with `[fitIncludesHeader]` can measure\n * the header label in isolation, ignoring the resize handle, sort affordance, and any\n * other header chrome. Wrap only the text you want the header-inclusive auto-fit to\n * account for.\n *\n * @example\n * ```html\n * <th forTableHeaderCell name=\"dept\">\n * <span forTableColumnLabel>Department</span>\n * <button forTableColumnResizer column=\"dept\" fitIncludesHeader [(width)]=\"deptWidth\"\n * aria-label=\"Resize Department column\"></button>\n * </th>\n * ```\n */\n@Directive({\n selector: '[forTableColumnLabel]',\n exportAs: 'forTableColumnLabel',\n})\nexport class ForTableColumnLabel {\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #headerCell = inject(ForTableHeaderCell, { optional: true });\n\n constructor() {\n if (!this.#headerCell) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-006',\n piece: 'ForTableColumnLabel',\n root: '[forTableHeaderCell]',\n token: 'ForTableHeaderCell',\n });\n }\n this.#headerCell.registerLabel(this.#host);\n inject(DestroyRef).onDestroy(() => this.#headerCell?.unregisterLabel(this.#host));\n }\n}\n","import {\n DestroyRef,\n Directive,\n DOCUMENT,\n effect,\n ElementRef,\n inject,\n Injector,\n output,\n PLATFORM_ID,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\nimport {\n FOR_DRAG_DROP_DEFAULTS,\n FOR_DROP_LIST_COORDINATOR,\n FOR_DROP_LIST_ROVING_DELEGATE,\n ForDropList,\n type ForDragDropEvent,\n type ForDropListRovingDelegate,\n} from 'forty-cdk/drag-drop';\nimport {\n arbitrateLiftPress,\n consumeUnmappedLiftedKey,\n createKeyboardDragMediator,\n createPointerDragSession,\n type DragAnnouncedItem,\n type DragAnnouncedPosition,\n DragAnnouncer,\n findPressedDragItem,\n focusWhenMounted,\n type FocusWhenMountedRef,\n isDragLiftKey,\n layoutPlaceholderInSlot,\n LiveAnnouncer,\n type PointerDragSession,\n resolveLiftedDragControl,\n resolvePressedDragItem,\n resolveWindowedReorder,\n stepDragTarget,\n isHistoryChord,\n} from 'forty-cdk/core';\nimport { isInteractiveDescendant } from './interactive-descendant';\nimport { injectTableContext, injectTableRegistration } from './table-context';\n\nconst POINTER_ARM_THRESHOLD_PX = 5;\n\ntype ReorderMode = 'idle' | 'keyboard' | 'pointer';\n\nconst LIFTED_NAV_KEYS: ReadonlySet<string> = new Set([\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n 'PageDown',\n 'PageUp',\n]);\n\n/** Payload of `rowReorder`: the previous and new row index. */\nexport interface TableRowReorderDescriptor {\n /** Previous row index (0-based). Absolute (dataset) index under virtualization, else rendered order. */\n from: number;\n /** New row index (0-based). Absolute (dataset) index under virtualization, else rendered order. */\n to: number;\n}\n\n/**\n * Opt-in **row reordering** for `ForTable`, composed over the drag-drop primitive.\n *\n * Apply on the rowgroup element that wraps the data rows (`<div role=\"rowgroup\">` in\n * `<div>` mode, `<tbody>` in native `<table>` mode). It wraps `[forDropList]` (via\n * `hostDirectives`, vertical by default) so the rows become a reorderable list, then\n * translates drag-drop's generic drop into the table-friendly `rowReorder` output. Mark\n * each `[forTableRow]` as `[forDraggable]` with a `[dragData]`. On a committed drop it\n * emits the previous / new index; the consumer applies the move to their own row array\n * (e.g. `moveItemInArray`). **It never reorders rows itself** (BYO-data).\n *\n * In `mode=\"grid\"` / `mode=\"treegrid\"` the draggable rows **yield their tab stop** to the\n * table's composite roving grid, keeping the **single tab stop** the WAI-ARIA Data Grid\n * pattern calls for. Keyboard reordering is therefore initiated from a focused **cell**:\n * press `Ctrl`/`Cmd`+`Space` on any cell to lift the enclosing row, then `ArrowUp` /\n * `ArrowDown` (`Home` / `End`, `PageUp` / `PageDown`) move the target, `Space` / `Enter`\n * drop, and `Escape` / `Tab` cancel. Idle Arrow keys stay grid navigation, and `Space` still\n * selects the row when a selection mode is set. In the static `mode=\"table\"` the rowgroup\n * keeps its own draggable-owned tab stop and the plain `Space` / `Enter` lift on a focused\n * row. A lift key pressed on an interactive control inside a row (a button, an input, a\n * `[forTableRowSelector]`, the set `eventFromInteractiveDescendant` defines) stays that\n * control's own key.\n *\n * Under `[forTableVirtualized]`, `rowReorder` emits **absolute** dataset indices so\n * `moveItemInArray` over the full array moves the right row; a non-virtualized table emits\n * rendered-order indices. Pointer drag works within the rendered window and reaches rows\n * beyond it via auto-scroll; keyboard reorder steps the target across every row the\n * virtualizer can place (`[virtualRowCount]`, else `[rowCount]`), scrolling unmounted rows into\n * view. Holding **Shift** during a pointer drag engages **windowed scrub** — the scroll viewport\n * maps onto the same rows (top edge → row 0, bottom edge → the last placeable row) so a single\n * gesture can drop the lifted row at an arbitrary far row.\n *\n * Under `[forTableVirtualized]` a `[forDragPlaceholder]` takes the lifted row's inline position,\n * insets, size and transform, so it stands in the row's slot. `[liveSort]` parts no rows there:\n * the rows are positioned by transform, and the placeholder keeps marking the source slot.\n *\n * Every lift, move and drop announcement counts the positions `rowReorder` reports, out of the\n * placeable rows under virtualization, pointer and keyboard alike, and each row's `[forDraggable]`\n * emits `dragStart` / `dragEnd` for a keyboard gesture as it does for a pointer one. The rowgroup\n * is a **closed** list: it joins no `[forDropListGroup]` and connects to no other `[forDropList]`,\n * so no row is transferred into or out of it.\n *\n * Focus leaving the rowgroup cancels a keyboard lift. A window recycle that briefly blurs\n * the retained lifted row does not: focus returns to it once the window settles.\n *\n * **One gesture at a time.** Pointer and keyboard reorder are mutually exclusive: while a\n * keyboard lift is live, a press on the lifted row arms nothing and a press on any other row\n * cancels the lift, so a drag that follows is an ordinary pointer gesture. A lift key pressed\n * during a pointer drag is ignored.\n *\n * A pointer press is refused outright when the rowgroup is `disabled`, when a **mouse** press\n * uses a non-primary button (touch and pen presses keep whatever `button` their engine\n * reports), when the pressed row carries no registered `[forDraggable]` or its draggable\n * is `[dragDisabled]`, or when the row's own guard refuses the press (it lands outside the row's\n * `[forDragHandle]`, or inside a draggable nested in it). Rows are resolved through the table's\n * registered rows, so a row whose `[forTableRow]` or `[forDraggable]` arrives through\n * `hostDirectives` or a subclass is found like a template-applied one.\n *\n * @example\n * ```html\n * <div role=\"rowgroup\" forTableRowReorder (rowReorder)=\"onReorder($event)\">\n * @for (row of rows(); track row.id) {\n * <div forTableRow [value]=\"row.id\" forDraggable [dragData]=\"row.id\">…</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forTableRowReorder]',\n exportAs: 'forTableRowReorder',\n providers: [\n { provide: FOR_DROP_LIST_COORDINATOR, useExisting: ForTableRowReorder },\n {\n provide: FOR_DROP_LIST_ROVING_DELEGATE,\n useFactory: (): ForDropListRovingDelegate => {\n const ctx = injectTableContext('ForTableRowReorder');\n return {\n itemTabindex: () => (ctx.mode() !== 'table' ? -1 : null),\n isItemHighlighted: () => (ctx.mode() !== 'table' ? false : null),\n };\n },\n },\n ],\n hostDirectives: [\n {\n directive: ForDropList,\n inputs: [\n 'dir',\n 'disabled',\n 'autoScroll',\n 'animateReorder',\n 'liveSort',\n 'boundary',\n 'lockAxis',\n ],\n },\n ],\n})\nexport class ForTableRowReorder {\n private readonly ctx = injectTableContext('ForTableRowReorder');\n readonly #registration = injectTableRegistration('ForTableRowReorder');\n readonly #list = inject(ForDropList);\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #document = inject(DOCUMENT);\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n readonly #dragDefaults = inject(FOR_DRAG_DROP_DEFAULTS);\n readonly #announce = new DragAnnouncer(inject(LiveAnnouncer), () => ({\n lift: this.#dragDefaults.announceLift,\n move: this.#dragDefaults.announceMove,\n drop: this.#dragDefaults.announceDrop,\n cancel: this.#dragDefaults.announceCancel,\n }));\n readonly #injector = inject(Injector);\n\n #mode: ReorderMode = 'idle';\n #kbLiftedHost: HTMLElement | null = null;\n #kbFocusEl: HTMLElement | SVGElement | null = null;\n #kbPath: 'virtual' | 'list' | null = null;\n #kbFrom = 0;\n #kbTarget = 0;\n #pointerGrab: HTMLElement | null = null;\n #pointerMain: number | null = null;\n #scrubEngaged = false;\n #pointerSession: PointerDragSession | null = null;\n #pendingFocus: FocusWhenMountedRef | null = null;\n\n /**\n * Fires once per committed reorder gesture with the previous / new row index.\n *\n * After a **keyboard** drop made while focus was in the lifted row, focus follows the row to\n * its new place once the next render settles, back onto the cell it was lifted from (or the\n * row itself in `mode=\"table\"`). Focus something else inside this handler to keep it;\n * pointer drops never move focus.\n */\n readonly rowReorder = output<TableRowReorderDescriptor>();\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n const sub = this.#list.dragDrop.subscribe((event: ForDragDropEvent) =>\n this.rowReorder.emit(this.resolveReorder(event.previousIndex, event.currentIndex)),\n );\n destroyRef.onDestroy(() => sub.unsubscribe());\n\n if (this.#isBrowser) {\n this.#pointerSession = createPointerDragSession({\n host: this.#host,\n document: this.#document,\n armThreshold: POINTER_ARM_THRESHOLD_PX,\n cancelOnEscape: true,\n canStart: (event) => this.#trackPointerPress(event),\n onLift: () => this.#pinOnPointerLift(),\n onMove: (event) => this.#trackScrub(event),\n onCommit: () => this.#endPointerSession(),\n onCancel: () => this.#endPointerSession(),\n });\n\n createKeyboardDragMediator({\n host: this.#host,\n document: this.#document,\n isBrowser: this.#isBrowser,\n destroyRef,\n isLifted: () => this.#mode === 'keyboard',\n onIdleKeydown: (event) => this.#onIdleKeydown(event),\n onLiftedKeydown: (event) => this.#onLiftedKeydown(event),\n onFocusLeave: () => this.#cancelActive(),\n });\n\n effect(() => {\n this.#registration.rows();\n this.#restoreLiftedFocus();\n });\n\n destroyRef.onDestroy(() => {\n this.#pointerSession?.destroy();\n if (this.#kbLiftedHost !== null) {\n this.#cancelActive(false);\n }\n this.#registration.setReorderingRow(null);\n });\n }\n }\n\n #gridMode(): boolean {\n return this.ctx.mode() !== 'table';\n }\n\n #virtualized(): boolean {\n return this.#registration.virtualRowNavigation() !== null;\n }\n\n #onIdleKeydown(event: KeyboardEvent): void {\n if (this.#mode !== 'idle') {\n return;\n }\n const lift = this.#gridMode()\n ? isDragLiftKey(event, this.#dragDefaults.liftKey)\n : this.#virtualized() && (event.key === ' ' || event.key === 'Enter');\n if (!lift) {\n return;\n }\n const resolved = this.#resolveRow(event.target);\n if (resolved === null || (!resolved.liftable && !this.#gridMode())) {\n return;\n }\n event.preventDefault();\n if (!resolved.liftable) {\n return;\n }\n event.stopPropagation();\n this.#lift(resolved.host);\n }\n\n #onLiftedKeydown(event: KeyboardEvent): void {\n const control = resolveLiftedDragControl(event);\n if (control === 'commit') {\n event.preventDefault();\n event.stopPropagation();\n this.#commitActive();\n return;\n }\n if (control === 'cancel') {\n event.preventDefault();\n event.stopPropagation();\n this.#cancelActive();\n return;\n }\n if (!LIFTED_NAV_KEYS.has(event.key) || isHistoryChord(event)) {\n consumeUnmappedLiftedKey(event);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.#moveActive(event.key);\n }\n\n /**\n * The registered row a lift key targets, or `null` when it targets no row or an interactive\n * descendant of one, which keeps the key. `liftable` is `false` for a row with no draggable or\n * a disabled one: the grid then consumes the chord without lifting, so it never falls through\n * to the cell's activation or selection.\n */\n #resolveRow(target: EventTarget | null): { host: HTMLElement; liftable: boolean } | null {\n if (!(target instanceof Node)) {\n return null;\n }\n const row = this.#registration.rows().find((r) => r.host === target || r.host.contains(target));\n if (row === undefined || isInteractiveDescendant(target, row.host)) {\n return null;\n }\n const draggable = this.#list.items().find((h) => h.host === row.host);\n return { host: row.host, liftable: draggable !== undefined && !draggable.disabled() };\n }\n\n #lift(rowHost: HTMLElement): void {\n const handle = this.#registration.rows().find((r) => r.host === rowHost);\n if (handle === undefined) {\n return;\n }\n if (this.#virtualized()) {\n const vi = handle.virtualIndex();\n if (vi === null) {\n return;\n }\n this.#kbPath = 'virtual';\n this.#kbLift(rowHost, vi);\n return;\n }\n const from = this.#list.lift(rowHost);\n if (from < 0) {\n return;\n }\n this.#mode = 'keyboard';\n this.#kbPath = 'list';\n this.#kbLiftedHost = rowHost;\n }\n\n #moveActive(key: string): void {\n if (this.#kbPath === 'virtual') {\n const requested = this.#requestedTarget(key);\n if (requested !== null) {\n this.#stepTarget(requested);\n }\n return;\n }\n if (this.#kbPath === 'list') {\n switch (key) {\n case 'ArrowDown':\n this.#list.moveLifted('next');\n break;\n case 'ArrowUp':\n this.#list.moveLifted('prev');\n break;\n case 'Home':\n case 'PageUp':\n this.#list.moveLifted('first');\n break;\n case 'End':\n case 'PageDown':\n this.#list.moveLifted('last');\n break;\n default:\n return;\n }\n }\n }\n\n #commitActive(): void {\n if (this.#kbPath === 'virtual') {\n this.#kbCommit();\n } else if (this.#kbPath === 'list') {\n this.#list.drop();\n this.#kbTeardown(true);\n }\n }\n\n #cancelActive(restoreFocus = true): void {\n if (this.#kbPath === 'virtual') {\n this.#kbCancel(restoreFocus);\n } else if (this.#kbPath === 'list') {\n this.#list.cancel();\n this.#kbTeardown(false);\n }\n }\n\n #restoreLiftedFocus(): void {\n if (this.#kbPath !== 'virtual' || this.#kbLiftedHost === null) {\n return;\n }\n const target = this.#kbFocusEl;\n if (target === null || !this.#host.contains(target)) {\n return;\n }\n const active = this.#document.activeElement;\n if (active !== null && this.#host.contains(active)) {\n return;\n }\n target.focus({ preventScroll: true });\n }\n\n #kbLift(host: HTMLElement, vi: number): void {\n this.#pendingFocus?.cancel();\n this.#pendingFocus = null;\n this.#mode = 'keyboard';\n this.#kbLiftedHost = host;\n this.#kbFocusEl = this.#resolveFocusTarget(host);\n this.#kbFrom = vi;\n this.#kbTarget = vi;\n this.#registration.setReorderingRow(vi);\n this.#list.beginCoordinatorLift(host, vi);\n this.#announce.lift(this.#item(), this.#position(vi));\n }\n\n #kbApplyTarget(): void {\n this.#registration.virtualRowNavigation()?.scrollToRow(this.#kbTarget);\n this.#announce.move(this.#item(), this.#position(this.#kbTarget));\n }\n\n #kbCommit(): void {\n const lifted = this.#kbLiftedHost;\n const to = this.#kbTarget;\n const column = lifted === null ? -1 : this.#columnOf(lifted, this.#kbFocusEl);\n this.rowReorder.emit({ from: this.#kbFrom, to });\n this.#announce.drop(this.#item(), this.#position(to));\n this.#kbTeardown(true);\n if (lifted !== null) {\n this.#followRow(lifted, to, column, { scroll: false });\n }\n }\n\n /**\n * Pin the row at `index` and move focus onto the same column of it once it mounts.\n * With `scroll`, the container is also scrolled to the row and focus waits for the\n * window to cover it; without, the pinned row is the target wherever the window is.\n */\n #followRow(\n lifted: HTMLElement,\n index: number,\n column: number,\n { scroll }: { scroll: boolean },\n ): void {\n this.#pendingFocus = focusWhenMounted({\n injector: this.#injector,\n document: this.#document,\n from: lifted,\n reveal: () => {\n this.#registration.setReorderingRow(index);\n if (scroll) {\n this.#registration.virtualRowNavigation()?.scrollToRow(index);\n }\n },\n target: () =>\n scroll && this.#registration.virtualRowNavigation()?.isRowInWindow(index) === false\n ? null\n : this.#focusTargetIn(index, column),\n release: () => {\n this.#pendingFocus = null;\n this.#registration.setReorderingRow(null);\n },\n });\n }\n\n #columnOf(rowHost: HTMLElement, focused: Element | null): number {\n if (focused === null || focused === rowHost) {\n return -1;\n }\n const row = this.#registration.rows().find((r) => r.host === rowHost);\n return row?.cells().findIndex((c) => c.host === focused || c.host.contains(focused)) ?? -1;\n }\n\n #focusTargetIn(index: number, column: number): HTMLElement | null {\n const row = this.#registration.rows().find((r) => r.virtualIndex() === index);\n if (row === undefined) {\n return null;\n }\n if (column < 0) {\n return row.host;\n }\n const cells = row.cells();\n return (cells[column] ?? cells[cells.length - 1])?.host ?? row.host;\n }\n\n #kbCancel(restoreFocus: boolean): void {\n const lifted = this.#kbLiftedHost;\n const from = this.#kbFrom;\n const column = lifted === null ? -1 : this.#columnOf(lifted, this.#kbFocusEl);\n this.#announce.cancel(this.#item());\n this.#kbTeardown(false);\n if (restoreFocus && lifted !== null) {\n this.#followRow(lifted, from, column, { scroll: true });\n }\n }\n\n #resolveFocusTarget(host: HTMLElement): HTMLElement | SVGElement {\n const active = this.#document.activeElement;\n const focusable = active instanceof HTMLElement || active instanceof SVGElement;\n return focusable && host.contains(active) ? active : host;\n }\n\n #kbTeardown(dropped: boolean): void {\n this.#mode = 'idle';\n this.#kbLiftedHost = null;\n this.#kbFocusEl = null;\n this.#kbPath = null;\n this.#kbFrom = 0;\n this.#kbTarget = 0;\n this.#registration.setReorderingRow(null);\n this.#list.endCoordinatorLift(dropped);\n }\n\n private count(): number {\n return (\n this.#registration.virtualRowNavigation()?.placeableRowCount() ?? this.#list.items().length\n );\n }\n\n private layoutPlaceholder(nodes: readonly Node[], lifted: HTMLElement): void {\n if (this.#virtualized()) {\n layoutPlaceholderInSlot(nodes, lifted);\n }\n }\n\n #page(): number {\n return Math.max(1, this.#list.items().length);\n }\n\n #item(): DragAnnouncedItem {\n const host = this.#kbLiftedHost;\n return {\n host,\n textValue: this.#list\n .items()\n .find((h) => h.host === host)\n ?.textValue(),\n };\n }\n\n #position(index: number): DragAnnouncedPosition {\n return { index, total: this.count(), list: this.#host, source: this.#host };\n }\n\n #requestedTarget(key: string): number | null {\n switch (key) {\n case 'ArrowDown':\n return this.#kbTarget + 1;\n case 'ArrowUp':\n return this.#kbTarget - 1;\n case 'Home':\n return 0;\n case 'End':\n return this.count() - 1;\n case 'PageDown':\n return this.#kbTarget + this.#page();\n case 'PageUp':\n return this.#kbTarget - this.#page();\n default:\n return null;\n }\n }\n\n #stepTarget(requested: number): void {\n const next = stepDragTarget(this.#kbTarget, requested, this.count());\n if (next === null) {\n return;\n }\n this.#kbTarget = next;\n this.#kbApplyTarget();\n }\n\n #trackPointerPress(event: PointerEvent): boolean {\n const row = findPressedDragItem(this.#registration.rows(), event.target);\n arbitrateLiftPress({\n keyboardLifted: this.#mode === 'keyboard',\n liftedHost: this.#kbLiftedHost,\n pressedHost: row?.host ?? null,\n cancelKeyboardLift: () => this.#cancelActive(false),\n });\n if (this.#list.effectiveDisabled() || (event.pointerType === 'mouse' && event.button !== 0)) {\n return false;\n }\n const draggable = resolvePressedDragItem(this.#list.items(), event.target);\n if (draggable === null || draggable.host !== row?.host) {\n return false;\n }\n this.#pointerMain = event.clientY;\n this.#scrubEngaged = event.shiftKey;\n if (this.#mode !== 'idle') {\n this.#pointerGrab = null;\n return false;\n }\n this.#pointerGrab = draggable.host;\n return true;\n }\n\n #pinOnPointerLift(): boolean {\n const rowHost = this.#pointerGrab;\n this.#pointerGrab = null;\n if (rowHost === null || this.#mode !== 'idle') {\n return false;\n }\n this.#pendingFocus?.cancel();\n this.#pendingFocus = null;\n this.#registration.virtualRowNavigation()?.cancelScroll();\n this.#mode = 'pointer';\n const handle = this.#registration.rows().find((r) => r.host === rowHost);\n this.#registration.setReorderingRow(handle?.virtualIndex() ?? null);\n return true;\n }\n\n #endPointerSession(): void {\n this.#pointerGrab = null;\n if (this.#mode !== 'pointer') {\n return;\n }\n this.#mode = 'idle';\n this.#registration.setReorderingRow(null);\n }\n\n #trackScrub(event: PointerEvent): void {\n if (!this.#list.isDragging()) {\n return;\n }\n this.#pointerMain = event.clientY;\n this.#scrubEngaged = event.shiftKey;\n }\n\n #windowIndices(): number[] | null {\n const rowByHost = new Map(this.#registration.rows().map((r) => [r.host, r] as const));\n const indices: number[] = [];\n for (const item of this.#list.items()) {\n const index = rowByHost.get(item.host)?.virtualIndex() ?? null;\n if (index === null) {\n return null;\n }\n indices.push(index);\n }\n return indices;\n }\n\n private resolveReorder(previousIndex: number, currentIndex: number): TableRowReorderDescriptor {\n const rect = this.#registration.virtualRowNavigation()?.scrollViewportRect() ?? null;\n return resolveWindowedReorder({\n windowIndices: this.#windowIndices(),\n previousIndex,\n currentIndex,\n scrub:\n rect === null\n ? null\n : {\n engaged: this.#scrubEngaged,\n pointer: this.#pointerMain ?? rect.top,\n viewportStart: rect.top,\n viewportEnd: rect.bottom,\n count: this.count(),\n },\n });\n }\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,qBACd,QAAyB;CAEzB,MAAM,SAAkD,IAAI,MAAM,OAAO,MAAM;CAC/E,MAAM,QAAgD,CAAA;CAEtD,MAAM,SAAS,UAAqD;EAClE,MAAM,UAAU,MAAM,QAAQ;EAC9B,KAAK,MAAM,KAAK,MAAM,SACpB,OAAO,EAAG,CAAC,UAAU;CA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M,mBAAmB,oBAAoB;KACnD,OAAO;MACL,oBAAqB,IAAI,KAAI,MAAO,UAAU,KAAK;MACnD,yBAA0B,IAAI,KAAI,MAAO,UAAU,QAAQ;KAC5D;IACH;GACD,CACF;GACD,gBAAgB,CACd;IACE,WAAW;IACX,QAAQ;KACN;KACA;KACA;KACA;KACA;KACA;KACA;IACD;GACF,CACF;EACF,CAAA"}
1
+ {"version":3,"file":"forty-cdk-table.mjs","names":[],"sources":["../../../projects/forty-cdk/table/src/flat-hierarchy.ts","../../../projects/forty-cdk/table/src/table-context.ts","../../../projects/forty-cdk/table/src/table-registry.ts","../../../projects/forty-cdk/table/src/selection-model.ts","../../../projects/forty-cdk/table/src/table-row-selection.ts","../../../projects/forty-cdk/table/src/table-expansion.ts","../../../projects/forty-cdk/table/src/table.ts","../../../projects/forty-cdk/table/src/table-header-cell.ts","../../../projects/forty-cdk/table/src/cell-tab-index.ts","../../../projects/forty-cdk/table/src/interactive-descendant.ts","../../../projects/forty-cdk/table/src/def-registry.ts","../../../projects/forty-cdk/table/src/column-def.ts","../../../projects/forty-cdk/table/src/row-def.ts","../../../projects/forty-cdk/table/src/table-cell.ts","../../../projects/forty-cdk/table/src/table-column-reorder.ts","../../../projects/forty-cdk/table/src/table-column-resizer.ts","../../../projects/forty-cdk/table/src/table-header-row.ts","../../../projects/forty-cdk/table/src/table-row.ts","../../../projects/forty-cdk/table/src/table-row-attrs.ts","../../../projects/forty-cdk/table/src/table-sort-header.ts","../../../projects/forty-cdk/table/src/table-body.ts","../../../projects/forty-cdk/table/src/table-variant-cell.ts","../../../projects/forty-cdk/table/src/table-row-selector.ts","../../../projects/forty-cdk/table/src/table-select-all.ts","../../../projects/forty-cdk/table/src/table-column-label.ts","../../../projects/forty-cdk/table/src/table-row-reorder.ts"],"sourcesContent":["/**\n * Computes `aria-posinset` / `aria-setsize` for every node in a **flat** list of\n * hierarchical rows, where depth is given only by each node's 1-based `level`\n * (as in an ARIA treegrid: rows are DOM siblings, hierarchy lives in `aria-level`).\n *\n * For a node at level `L`, its siblings are the nodes at the same level under the\n * same parent: contiguous `level === L` entries, skipping any deeper descendants\n * between them and bounded by the first shallower (`level < L`) entry on each side.\n *\n * Returns one `{ posinset, setsize }` entry per input level, in the same order.\n * Both are 1-based. An empty input returns an empty array.\n */\nexport function computeFlatHierarchy(\n levels: readonly number[],\n): { posinset: number; setsize: number }[] {\n const result: { posinset: number; setsize: number }[] = new Array(levels.length);\n const stack: { level: number; members: number[] }[] = [];\n\n const close = (group: { level: number; members: number[] }): void => {\n const setsize = group.members.length;\n for (const i of group.members) {\n result[i]!.setsize = setsize;\n }\n };\n\n for (let index = 0; index < levels.length; index++) {\n const level = levels[index]!;\n while (stack.length > 0 && stack[stack.length - 1]!.level > level) {\n close(stack.pop()!);\n }\n const top = stack[stack.length - 1];\n if (top && top.level === level) {\n top.members.push(index);\n result[index] = { posinset: top.members.length, setsize: 0 };\n } else {\n stack.push({ level, members: [index] });\n result[index] = { posinset: 1, setsize: 0 };\n }\n }\n\n while (stack.length > 0) {\n close(stack.pop()!);\n }\n\n return result;\n}\n","import { booleanAttribute, inject, InjectionToken, type Signal } from '@angular/core';\n\nimport {\n assertRootContext,\n fortyError,\n orphanContextError,\n TABLE_REGISTRATION_CONTEXT,\n TABLE_ROW_REGISTRATION_CONTEXT,\n type TableRegistrationContext,\n type TableRowRegistrationContext,\n type WritingDirection,\n} from 'forty-cdk/core';\n\n/** ARIA pattern the table renders as. `'table'` is the static structure; `'grid'` / `'treegrid'` add roving + 2D keyboard navigation. */\nexport type TableMode = 'table' | 'grid' | 'treegrid';\n\n/** Row-selection mode for `ForTable`. `'none'` disables selection. */\nexport type TableSelectionMode = 'none' | 'single' | 'multiple';\n\n/**\n * How a row click mutates selection. `'toggle'` flips it; `'replace'` replaces\n * (modifier-aware); `'none'` leaves it untouched, so only `[forTableRowSelector]`,\n * `[forTableSelectAll]` and `Space` on a focused grid cell mutate the selection.\n */\nexport type TableSelectionBehavior = 'toggle' | 'replace' | 'none';\n\n/** Aggregate selection state across the table's selectable rows, for the select-all tri-state. */\nexport type TableSelectAllState = 'none' | 'some' | 'all';\n\n/** Sticky placement for a cell: pinned to the start edge (`true`), the end edge (`'end'`), or not sticky (`false`). */\nexport type TableStickyValue = boolean | 'end';\n\n/**\n * Consumer-facing coordination surface owned by `ForTable`: the resolved ARIA\n * mode / direction / selection mode, the row counts, and the selection /\n * expansion commands.\n *\n * It carries neither the piece-registration protocol nor the\n * roving-grid model: how header rows, header cells, data rows, the declarative\n * body's row count, the virtualization seams and the resized column widths wire\n * themselves into the root, and where the grid's single tab stop currently\n * sits, are the library's own business and change without notice.\n */\nexport interface ForTableContext {\n /** The resolved ARIA mode; cells derive `role` (`cell` vs `gridcell`) from it, and navigation engages when it is not `'table'`. */\n readonly mode: Signal<TableMode>;\n /** The resolved writing direction (flips ArrowLeft / ArrowRight in `rtl`). */\n readonly dir: Signal<WritingDirection>;\n /** The active row-selection mode. `'none'` means selection is disabled. */\n readonly selectionMode: Signal<TableSelectionMode>;\n /** Returns whether `value` is currently in the selection. */\n isRowSelected(value: unknown): boolean;\n /** Toggles `value` in or out of the selection, respecting `selectionMode`. No-op in `'none'` mode. */\n toggleRowSelection(value: unknown): void;\n /**\n * Applies a row selection click with optional modifier keys, honoring `selectionBehavior`:\n * `'toggle'` always flips; `'replace'` replaces (Ctrl/Cmd toggles a single item,\n * Shift extends a range in multiple mode); `'none'` is a no-op that also leaves the\n * range anchor where it was.\n */\n selectRow(\n value: unknown,\n modifiers?: { ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean },\n ): void;\n /** Aggregate selection state across all selectable rows (`'none'` / `'some'` / `'all'`). */\n readonly selectAllState: Signal<TableSelectAllState>;\n /**\n * Selects all selectable rows when not all are selected; deselects them when all are, keeping\n * selected values outside the selectable rows. No-op outside `'multiple'` mode.\n */\n toggleSelectAll(): void;\n /**\n * The resolved true total data-row count for `aria-rowcount`, and the virtualized\n * scroll range unless `[forTableVirtualized]` narrows it with its own\n * `[virtualRowCount]`. Resolution order: the explicit `[rowCount]` input when set,\n * else the declarative `<for-table-body>`'s dataset length when a body has\n * registered one, else `undefined` (readers fall back to the rendered row count).\n */\n readonly rowCount: Signal<number | undefined>;\n /**\n * The count of currently loaded data rows (the declarative `<for-table-body>`\n * dataset length), or `undefined` when no body has registered one (raw-primitive\n * rendering). Distinct from `rowCount`, which an explicit `[rowCount]` raises to a\n * server-known total larger than the loaded rows; cross-window navigation clamps\n * unmounted targets to this so a target beyond the loaded prefix cannot stash a\n * pending focus move that resolves only when a far page later loads.\n */\n readonly loadedRowCount: Signal<number | undefined>;\n /**\n * Absolute index of the row that owns the currently roving-focused cell, or `null`\n * when no cell is focused (or the focused row carries no `virtualIndex`). Read by\n * `[forTableVirtualized]` to keep the focused row mounted across recycling.\n */\n readonly focusedRowIndex: Signal<number | null>;\n /** Whether `value` is in the open-rows set (`treegrid` expansion). */\n isRowExpanded(value: unknown): boolean;\n /** Toggles a parent row's expansion in/out of `[(expanded)]`. No-op when value is undefined. */\n toggleRowExpansion(value: unknown): void;\n}\n\n/**\n * The table's piece-coordination surface: the 2D roving grid model the rows,\n * cells and header cells resolve their `tabindex` / `data-highlighted` /\n * keydown through, and the ARIA index arithmetic derived from it.\n *\n * **Not** part of {@link ForTableContext} and never exported from\n * `public-api.ts`. A consumer reads the selection and expansion state off the\n * token; where the grid's single tab stop currently sits is the library's own\n * navigation model, refactored without notice.\n */\nexport interface TablePieceContext {\n /**\n * 1-based `aria-rowindex` for the header row in `grid` / `treegrid` mode (always\n * `1`, since ARIA counts the header row as the grid's first row), or `null` in\n * `mode=\"table\"` where no row index space exists.\n */\n readonly headerRowIndex: Signal<number | null>;\n /**\n * Offset ARIA adds to every data row's 1-based `aria-rowindex` so the numbering\n * counts the header row: `1` when a header row participates in the row-index\n * space (`grid` / `treegrid` mode with a registered header row), else `0`.\n */\n readonly dataRowIndexOffset: Signal<number>;\n /** Roving `tabindex` (`0` for the single tab stop, `-1` otherwise) for a header cell in grid mode. */\n headerCellTabIndex(host: HTMLElement): 0 | -1;\n /** 0-based index of a header cell host among registered header cells in DOM order, or -1 if not registered. */\n headerCellIndexOf(host: HTMLElement): number;\n /**\n * Whether the registered header cells form a complete row that joins the body's\n * roving composite grid (`grid` / `treegrid` mode, header cell count matches the\n * data column count). Draggable header cells (`[forTableColumnReorder]`) participate\n * too, so a column-reorderable grid stays a single composite tab stop. `false` in\n * `table` mode or when no header cells registered.\n */\n readonly headerParticipatesInRoving: Signal<boolean>;\n /**\n * The grid's rendered column count: the cell count of the first data row that has\n * any, else the registered header cell count. `0` while no cell has registered.\n * Read by `[forTableVariantCell]` for the `aria-colspan` of a full-span row, which\n * is the same count the declarative body spans with.\n */\n readonly columnCount: Signal<number>;\n /** 0-based index of a data row host in DOM order, or -1 if not registered. */\n rowIndexOf(host: HTMLElement): number;\n /** Roving `tabindex` (`0` for the single tab stop, `-1` otherwise) for a data cell in grid mode. */\n cellTabIndex(host: HTMLElement): 0 | -1;\n /** Whether a data cell is the currently roving-focused cell (drives `data-highlighted`). */\n isCellHighlighted(host: HTMLElement): boolean;\n /** Promotes a data cell to the active roving cell (called on the cell's `(focus)`). */\n activateCell(host: HTMLElement): void;\n highlightFromPointer(host: HTMLElement): void;\n /**\n * Resolves and applies a keydown originating on a grid cell: cell entry, the row keys,\n * and 2D move + focus. A data cell passes its `column`, which makes an `Enter` with no\n * widget to enter emit the root's `cellActivate`.\n */\n handleCellKeydown(event: KeyboardEvent, host: HTMLElement, column?: string): void;\n /** Whether `event` is an `Enter` keydown the root already resolved as a `cellActivate`. */\n isCellActivation(event: Event): boolean;\n /**\n * Resolves grid navigation and APG cell entry for a header cell that yields its host\n * interaction to a co-located `[forDraggable]`. `[forTableColumnReorder]` calls this\n * from a capture-phase listener for idle header cells so Arrow / Home / End / Page keys\n * move roving focus across the composite header + body grid and `F2` enters the cell;\n * the header cell itself calls it for the two keys targeted at an entered widget, which\n * that listener never sees — the `Tab` that cycles between the cell's widgets and the\n * `Escape` that returns focus from one — while Space / Enter fall through to the\n * draggable's lift. Returns `true` when the key was consumed,\n * `false` otherwise (including outside a participating `grid` / `treegrid`).\n */\n handleHeaderCellKeydown(event: KeyboardEvent, host: HTMLElement): boolean;\n /** 1-based `aria-posinset` for a row host among its same-level siblings (treegrid). */\n rowPosinset(host: HTMLElement): number;\n /** Total `aria-setsize` of a row host's same-level sibling set (treegrid). */\n rowSetsize(host: HTMLElement): number;\n}\n\n/**\n * The table's internal coordination surface: everything {@link ForTableContext}\n * publishes plus the {@link TablePieceContext} grid model.\n *\n * Never exported from `public-api.ts`. It is the type the pieces read\n * {@link FOR_TABLE_CONTEXT} at, so a consumer who injects that token gets the\n * read surface while the pieces get the navigation model. `ForTable` declares\n * those members TS-`private`, which keeps them out of the emitted `.d.ts` while\n * `useExisting` still satisfies this contract at runtime.\n *\n * Distinct from the **piece-registration** protocol, which is the one surface\n * that genuinely needs a second token: it lives in `forty-cdk/core` because\n * `forty-cdk/table-virtualization` registers through it.\n */\nexport interface TableContext extends ForTableContext, TablePieceContext {}\n\n/**\n * DI token for the table's coordination surface, provided by `[forTable]`.\n *\n * Publicly typed as the read surface {@link ForTableContext}, which is the whole of what\n * the token promises a consumer. The pieces read the same token at an internal type that\n * adds the roving grid model, so a wrapper re-providing it must alias it to the root:\n * `{ provide: FOR_TABLE_CONTEXT, useExisting: MyTable }`, where `MyTable` extends\n * `ForTable`. A value that merely satisfies the declared type resolves too, and is\n * rejected in dev mode by the first piece to reach the model.\n */\nexport const FOR_TABLE_CONTEXT = new InjectionToken<ForTableContext>('FOR_TABLE_CONTEXT');\n\n/**\n * Per-row read surface owned by `ForTableRow`, injected by its data cells. The\n * cell-registration half lives on {@link TableRowRegistrationContext}, so no `register*`\n * member reaches `ForTableRow`'s emitted public type.\n */\nexport interface ForTableRowContext {\n /** 0-based index of a cell host within this row in DOM order, or -1 if not registered. */\n cellIndexOf(host: HTMLElement): number;\n /** The active row-selection mode from the root table. */\n readonly selectionMode: Signal<TableSelectionMode>;\n /** Whether this row is currently selected. */\n readonly selected: Signal<boolean>;\n /** Toggles this row's selection. No-op when the row has no `[value]` or mode is `'none'`. */\n toggleSelected(): void;\n}\n\nexport const FOR_TABLE_ROW_CONTEXT = new InjectionToken<ForTableRowContext>(\n 'FOR_TABLE_ROW_CONTEXT',\n);\n\n/**\n * Coerces the `sticky` input value for header and data cells.\n * The string `'end'` pins the cell to the end edge; any other truthy value\n * (including the empty string from a bare `sticky` attribute) pins it to the\n * start edge; a falsy value means not sticky.\n */\nexport function coerceSticky(value: boolean | string): TableStickyValue {\n return value === 'end' ? 'end' : booleanAttribute(value);\n}\n\nconst COLUMN_NAME_PATTERN = /^[-_A-Za-z0-9]+$/;\n\n/**\n * Dev-mode guard for a column name before it is interpolated into CSS. Column\n * names flow into the `--for-table-col-<name>-width` custom property and the\n * `grid-template-columns` track string, where a space, `)`, `;`, or quote would\n * silently produce an invalid declaration and collapse the layout with no error.\n * Rejects any name outside letters, digits, hyphens, and underscores. No-op in\n * production builds.\n */\nexport function assertColumnName(name: string, piece: string): void {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !COLUMN_NAME_PATTERN.test(name)) {\n throw fortyError({\n code: 'FORCDK-TABLE-007',\n message: `Invalid column name ${JSON.stringify(name)} declared on ${piece}.`,\n cause:\n 'Column names are interpolated into the --for-table-col-<name>-width custom property and ' +\n 'into grid-template-columns, where anything else silently produces an invalid ' +\n 'declaration and collapses the layout.',\n fix: 'Use only letters, digits, hyphens, and underscores.',\n });\n }\n}\n\nconst TRACK_BREAKOUT_PATTERN = /[;{}\"']|\\/\\*/;\n\n/**\n * Dev-mode guard for a `grid-template-columns` track fragment before it is\n * interpolated into the derived track string. Unlike a column name a track\n * fragment has an open vocabulary (`minmax()`, `fit-content()`, `calc()`,\n * `clamp()`, `var()`), so this rejects only the shapes that **escape** the value\n * they are written into and collapse the whole track with no error: an empty\n * fragment (which contributes a missing entry and shifts every later column —\n * omit the input, or pass `null`, to mean \"unset\"), a `;` / `{` / `}` / quote /\n * `/*` that terminates the declaration, and unbalanced parentheses (a stray `)`\n * in a `fallbackWidth` closes its enclosing `var(` early and swallows the rest\n * of the track). No-op in production builds.\n */\nexport function assertColumnTrack(track: string, input: string, piece: string): void {\n if (typeof ngDevMode !== 'undefined' && !ngDevMode) {\n return;\n }\n const reason = columnTrackDefect(track);\n if (reason) {\n throw fortyError({\n code: 'FORCDK-TABLE-008',\n message: `Invalid ${input} ${JSON.stringify(track)} declared on ${piece}: ${reason}.`,\n cause:\n 'A track fragment is interpolated into the grid-template-columns string ForTableBody ' +\n 'derives, where a fragment that escapes its slot collapses the whole track with no error.',\n fix: 'Use a self-contained track value, or omit the input (or pass null) to leave it unset.',\n });\n }\n}\n\nfunction columnTrackDefect(track: string): string | null {\n if (track.trim() === '') {\n return 'the fragment is empty — omit the input (or pass null) to leave the track unset';\n }\n if (TRACK_BREAKOUT_PATTERN.test(track)) {\n return 'it contains a \";\", \"{\", \"}\", quote, or \"/*\" that terminates the declaration';\n }\n let depth = 0;\n for (const char of track) {\n if (char === '(') {\n depth++;\n } else if (char === ')' && --depth < 0) {\n return 'its parentheses are unbalanced';\n }\n }\n return depth === 0 ? null : 'its parentheses are unbalanced';\n}\n\n/**\n * Whether a header-cell host carries an active sort affordance — a\n * `[forTableSortHeader]` with `sortable` currently `true`, reflected as the\n * `data-sortable` marker. Detected by DOM marker rather than a value-import of\n * the sort header, so the grid cell-entry handler can defer `Enter` to the sort\n * activation (keeping focus on the cell) without a cross-piece value dependency.\n * A non-sortable header (no marker) keeps `Enter` as its cell-entry key.\n */\nexport function hostHasSortActivation(el: HTMLElement): boolean {\n return el.hasAttribute('data-sortable');\n}\n\nexport function injectTableContext(piece: string): TableContext {\n const ctx = inject(FOR_TABLE_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-009',\n piece,\n root: '[forTable]',\n token: 'FOR_TABLE_CONTEXT',\n });\n }\n const widened = ctx as TableContext;\n assertRootContext({\n entryPoint: 'table',\n token: 'FOR_TABLE_CONTEXT',\n root: '[forTable]',\n piece,\n probe: () => widened.cellTabIndex,\n });\n return widened;\n}\n\nexport function injectTableRegistration(piece: string): TableRegistrationContext {\n const ctx = inject(TABLE_REGISTRATION_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-010',\n piece,\n root: '[forTable]',\n token: 'TABLE_REGISTRATION_CONTEXT',\n });\n }\n return ctx;\n}\n\nexport function injectTableRowRegistration(piece: string): TableRowRegistrationContext {\n const ctx = inject(TABLE_ROW_REGISTRATION_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-011',\n piece,\n root: '[forTableRow]',\n token: 'TABLE_ROW_REGISTRATION_CONTEXT',\n });\n }\n return ctx;\n}\n\nexport function injectTableRowContext(piece: string): ForTableRowContext {\n const ctx = inject(FOR_TABLE_ROW_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-012',\n piece,\n root: '[forTableRow]',\n token: 'FOR_TABLE_ROW_CONTEXT',\n });\n }\n return ctx;\n}\n","import { ElementRef, inject, Injectable, signal, type Signal } from '@angular/core';\nimport { CssVarNamespacer } from '@angular/platform-browser';\n\nimport {\n Collection,\n type ForTableCellHandle,\n type ForTableRowHandle,\n type TableRegistrationContext,\n type TableVirtualRowNavigation,\n type TableVirtualWindow,\n} from 'forty-cdk/core';\n\n/**\n * Owns the table's piece-registration state — the header row element, the header\n * cell and data row collections, the declarative body's row count, the two\n * virtualization seams, the root's header-crossing focus resolver, the\n * pointer-reordered row index, and the published column-width custom properties.\n *\n * It exists as its own provider rather than as methods on `ForTable` so the\n * wiring protocol never reaches the public API: `ForTable` is exported, and any\n * `register*` / `set*` method on it would be callable (and therefore\n * semver-frozen) for consumers wrapping the root with `hostDirectives` or\n * subclassing it. Pieces reach it through `TABLE_REGISTRATION_CONTEXT`, which no\n * entry point exports; `ForTable` injects the class directly for the extra\n * lookup helpers it needs to derive its own read surface.\n */\n@Injectable()\nexport class TableRegistry implements TableRegistrationContext {\n readonly #rootEl = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #namespacer = inject(CssVarNamespacer);\n\n readonly #headerRowEl = signal<HTMLElement | null>(null);\n readonly #headerCells = new Collection<ForTableCellHandle>();\n readonly #rows = new Collection<ForTableRowHandle>();\n readonly #bodyRowCount = signal<Signal<number> | null>(null);\n readonly #virtualNav = signal<TableVirtualRowNavigation | null>(null);\n readonly #virtualWindow = signal<TableVirtualWindow | null>(null);\n readonly #reorderingRow = signal<number | null>(null);\n #headerCellFocus: ((column: number) => boolean) | null = null;\n\n /** The registered header row host, or `null` when no header row is mounted. */\n readonly headerRowEl = this.#headerRowEl.asReadonly();\n\n /** Registered header cells in DOM order. */\n readonly headerCells = this.#headerCells.items;\n\n /** Registered data rows in DOM order. */\n readonly rows = this.#rows.items;\n\n /** The declarative `<for-table-body>`'s dataset length, or `null` when none registered. */\n readonly bodyRowCount = this.#bodyRowCount.asReadonly();\n\n /** The registered cross-window row-navigation delegate, or `null` when not virtualized. */\n readonly virtualRowNavigation = this.#virtualNav.asReadonly();\n\n /** The registered rendered virtual window, or `null` when not virtualized. */\n readonly virtualWindow = this.#virtualWindow.asReadonly();\n\n /** Absolute index of the row currently being pointer-reordered, or `null`. */\n readonly reorderingRowIndex = this.#reorderingRow.asReadonly();\n\n /** Registers the header row's host so the root can measure its height. */\n registerHeaderRow(el: HTMLElement): void {\n this.#headerRowEl.set(el);\n }\n\n /** Unregisters the header row's host. Reference-based; safe to call if never registered. */\n unregisterHeaderRow(el: HTMLElement): void {\n if (this.#headerRowEl() === el) {\n this.#headerRowEl.set(null);\n }\n }\n\n /** Registers a header cell so it can join the composite roving-navigation grid. */\n registerHeaderCell(handle: ForTableCellHandle): void {\n this.#headerCells.register(handle);\n }\n\n /** Unregisters a header cell. Reference-based. */\n unregisterHeaderCell(handle: ForTableCellHandle): void {\n this.#headerCells.unregister(handle);\n }\n\n /** 0-based index of a header cell host among registered header cells, or -1. */\n headerCellIndexOf(host: HTMLElement): number {\n return this.#headerCells.indexOfHost(host);\n }\n\n /**\n * Installs the root's header-crossing focus resolver. `ForTable` installs it at\n * construction: the registry owns the header cell collection, but whether that row\n * joins the composite roving grid — and moving the grid's tab stop onto it — is the\n * root's navigation model. Root-only, so it stays off\n * {@link TableRegistrationContext} where the pieces read the protocol.\n *\n * Takes no `null`, unlike the virtualization seams: registry and root share a\n * lifetime, so there is no teardown to clear it from.\n */\n registerHeaderCellFocus(focus: (column: number) => boolean): void {\n this.#headerCellFocus = focus;\n }\n\n /** Moves roving focus onto the header cell in `column`; `false` when no header row joins the roving grid. */\n focusHeaderCell(column: number): boolean {\n return this.#headerCellFocus?.(column) ?? false;\n }\n\n /** Registers a data row so it joins the row index space and the navigation grid. */\n registerRow(handle: ForTableRowHandle): void {\n this.#rows.register(handle);\n }\n\n /** Unregisters a data row. Reference-based. */\n unregisterRow(handle: ForTableRowHandle): void {\n this.#rows.unregister(handle);\n }\n\n /** 0-based index of a data row host in DOM order, or -1 if not registered. */\n rowIndexOf(host: HTMLElement): number {\n return this.#rows.indexOfHost(host);\n }\n\n /** Registers (or clears, with `null`) the declarative body's dataset length. */\n registerBodyRowCount(count: Signal<number> | null): void {\n this.#bodyRowCount.set(count);\n }\n\n /** Registers (or clears, with `null`) the cross-window row-navigation delegate. */\n registerVirtualNavigation(navigation: TableVirtualRowNavigation | null): void {\n this.#virtualNav.set(navigation);\n }\n\n /** Registers (or clears, with `null`) the rendered virtual window. */\n registerVirtualWindow(window: TableVirtualWindow | null): void {\n this.#virtualWindow.set(window);\n }\n\n /** Sets (or clears, with `null`) the absolute index of the row being pointer-reordered. */\n setReorderingRow(index: number | null): void {\n this.#reorderingRow.set(index);\n }\n\n /** Publishes a column's resolved width as `--for-table-col-<column>-width` on the root. */\n setColumnWidth(column: string, width: number): void {\n this.#rootEl.style.setProperty(\n this.#namespacer.namespace(`--for-table-col-${column}-width`),\n `${width}px`,\n );\n }\n\n /** Removes a column's published `--for-table-col-<column>-width` custom property. */\n removeColumnWidth(column: string): void {\n this.#rootEl.style.removeProperty(\n this.#namespacer.namespace(`--for-table-col-${column}-width`),\n );\n }\n}\n","import { isSignal, type Signal, signal, type WritableSignal } from '@angular/core';\n\nimport {\n appendMissing,\n dedupeValues,\n defaultCompareWith,\n membership,\n selectionMembership,\n} from 'forty-cdk/core';\n\n/** Options for {@link SelectionModel}. */\nexport interface SelectionModelOptions<T> {\n /**\n * Allow more than one selected value. `false` (default) is single-select:\n * `select` / `setSelection` replace the prior value. Accepts a `Signal` so a\n * consumer whose mode is reactive (e.g. a table's `selectionMode`) can drive\n * it without reconstructing the model.\n */\n readonly multiple?: boolean | Signal<boolean>;\n /**\n * Equality comparator used for membership and de-duplication. Defaults to\n * `===` (correct for primitive values); supply an id-based comparator for\n * object values: `(a, b) => a.id === b.id`.\n */\n readonly compareWith?: ((a: T, b: T) => boolean) | Signal<(a: T, b: T) => boolean>;\n}\n\n/**\n * The table's internal signal-first selection-state helper. Single- or\n * multi-select with equality-aware membership; every mutating method returns\n * whether the selection actually changed.\n *\n * The model does **not** own its backing store: callers pass a\n * `WritableSignal<readonly T[]>` (typically their own `model()`), so there is a\n * single source of truth and no `effect()`-based sync. `selected` is a readonly\n * view of that source; mutators write through it.\n */\nexport class SelectionModel<T> {\n readonly #source: WritableSignal<readonly T[]>;\n readonly #multiple: Signal<boolean>;\n readonly #compareWith: Signal<(a: T, b: T) => boolean>;\n\n /** The current selection, in insertion order. Readonly view of the backing source. */\n readonly selected: Signal<readonly T[]>;\n\n readonly membership: Signal<(value: T) => boolean>;\n\n constructor(source: WritableSignal<readonly T[]>, options?: SelectionModelOptions<T>) {\n this.#source = source;\n this.selected = source.asReadonly();\n const multiple = options?.multiple ?? false;\n this.#multiple = isSignal(multiple) ? multiple : signal(multiple);\n const compareWith = options?.compareWith ?? defaultCompareWith;\n this.#compareWith = isSignal(compareWith) ? compareWith : signal(compareWith);\n this.membership = selectionMembership(this.#source, this.#compareWith);\n }\n\n /** Whether `value` is currently selected (under the comparator). */\n isSelected(value: T): boolean {\n return this.membership()(value);\n }\n\n /**\n * Select `values`. In single mode keeps only the last given value; in multi\n * mode appends those not already present. Returns whether anything changed.\n */\n select(values: readonly T[]): boolean {\n if (values.length === 0) {\n return false;\n }\n if (!this.#multiple()) {\n return this.#commit([values[values.length - 1]!]);\n }\n return this.#commit(appendMissing(this.#source(), values, this.#compareWith()));\n }\n\n /** Deselect `values`. Returns whether anything changed. */\n deselect(values: readonly T[]): boolean {\n if (values.length === 0) {\n return false;\n }\n const removed = membership(values, this.#compareWith());\n return this.#commit(this.#source().filter((v) => !removed(v)));\n }\n\n /** Toggle a single value. Returns whether anything changed (always `true`). */\n toggle(value: T): boolean {\n return this.isSelected(value) ? this.deselect([value]) : this.select([value]);\n }\n\n /**\n * Replace the entire selection with `values` (de-duplicated). In single mode\n * keeps only the last. Returns whether anything changed.\n */\n setSelection(values: readonly T[]): boolean {\n if (!this.#multiple() && values.length > 1) {\n return this.#commit([values[values.length - 1]!]);\n }\n return this.#commit(dedupeValues(values, this.#compareWith()));\n }\n\n /** Clear the selection. Returns whether anything changed. */\n clear(): boolean {\n return this.#commit([]);\n }\n\n #commit(next: readonly T[]): boolean {\n const current = this.#source();\n if (current.length === next.length) {\n const inNext = membership(next, this.#compareWith());\n if (next.every(this.membership()) && current.every(inNext)) {\n return false;\n }\n }\n this.#source.set(next);\n return true;\n }\n}\n","import { computed, type Signal, signal, type WritableSignal } from '@angular/core';\n\nimport { SelectionModel } from './selection-model';\nimport type {\n TableSelectAllState,\n TableSelectionBehavior,\n TableSelectionMode,\n} from './table-context';\n\n/** Modifier keys that alter a `'replace'`-behavior row click. */\nexport interface TableSelectionModifiers {\n readonly ctrlKey?: boolean;\n readonly metaKey?: boolean;\n readonly shiftKey?: boolean;\n}\n\n/**\n * Dependencies for {@link TableRowSelection}. Wires the helper to `ForTable`'s\n * `[(value)]` model, its selection inputs, and the aggregate value universe.\n */\nexport interface TableRowSelectionDeps<T> {\n /** Two-way bindable selected row values (each row's `[value]`). */\n readonly selection: WritableSignal<readonly T[]>;\n /** The active row-selection mode. `'none'` disables selection. */\n readonly selectionMode: Signal<TableSelectionMode>;\n /** How a row click mutates the selection (`'toggle'` / `'replace'` / `'none'`). */\n readonly selectionBehavior: Signal<TableSelectionBehavior>;\n /** Equality comparator for row values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n /**\n * Ordered universe of selectable row values for aggregate operations\n * (range extension, select-all tri-state). Spans rows beyond the rendered\n * window when the table is virtualized or server-paged.\n */\n readonly aggregateValues: Signal<readonly T[]>;\n}\n\n/**\n * Row-selection sub-model for `ForTable`. Owns the `SelectionModel`, the range\n * anchor, and the toggle / replace / range / select-all algorithms, decoupled\n * from the table root.\n *\n * Internal — not re-exported from `table/index.ts` or `public-api.ts`.\n */\nexport class TableRowSelection<T> {\n readonly #selectionMode: Signal<TableSelectionMode>;\n readonly #selectionBehavior: Signal<TableSelectionBehavior>;\n readonly #compareWith: Signal<(a: T, b: T) => boolean>;\n readonly #aggregateValues: Signal<readonly T[]>;\n\n readonly #model: SelectionModel<T>;\n readonly #anchor = signal<T | undefined>(undefined);\n\n /** Aggregate selection state across all selectable rows (`'none'` / `'some'` / `'all'`). */\n readonly selectAllState = computed<TableSelectAllState>(() => {\n const values = this.#aggregateValues();\n if (values.length === 0) {\n return 'none';\n }\n const isSelected = this.#model.membership();\n let count = 0;\n for (const v of values) {\n if (isSelected(v)) {\n count += 1;\n }\n }\n if (count === 0) {\n return 'none';\n }\n return count === values.length ? 'all' : 'some';\n });\n\n constructor(deps: TableRowSelectionDeps<T>) {\n this.#selectionMode = deps.selectionMode;\n this.#selectionBehavior = deps.selectionBehavior;\n this.#compareWith = deps.compareWith;\n this.#aggregateValues = deps.aggregateValues;\n this.#model = new SelectionModel<T>(deps.selection, {\n multiple: computed(() => deps.selectionMode() === 'multiple'),\n compareWith: deps.compareWith,\n });\n }\n\n /** Whether `value` is currently in the selection. */\n isSelected(value: T): boolean {\n return this.#model.isSelected(value);\n }\n\n /** Toggles `value` in or out of the selection and re-anchors. No-op in `'none'` mode. */\n toggle(value: T): void {\n if (this.#selectionMode() === 'none') {\n return;\n }\n this.#model.toggle(value);\n this.#anchor.set(value);\n }\n\n /**\n * Applies a row selection click with optional modifier keys, honoring\n * `selectionBehavior`: `'toggle'` always flips; `'replace'` replaces (Ctrl/Cmd\n * toggles a single item, Shift extends a range in multiple mode); `'none'` is a\n * no-op that also leaves the range anchor where it was, so a later\n * selector-driven range still extends from it.\n */\n select(value: T, modifiers?: TableSelectionModifiers): void {\n const mode = this.#selectionMode();\n const behavior = this.#selectionBehavior();\n if (mode === 'none' || behavior === 'none') {\n return;\n }\n if (behavior === 'toggle') {\n this.#model.toggle(value);\n this.#anchor.set(value);\n return;\n }\n const multiple = mode === 'multiple';\n if (multiple && modifiers?.shiftKey) {\n this.#selectRange(value);\n return;\n }\n if (multiple && (modifiers?.ctrlKey || modifiers?.metaKey)) {\n this.#model.toggle(value);\n this.#anchor.set(value);\n return;\n }\n this.#model.setSelection([value]);\n this.#anchor.set(value);\n }\n\n /** Selects all selectable rows when not all are selected; deselects them when all are. No-op outside `'multiple'` mode. */\n toggleSelectAll(): void {\n if (this.#selectionMode() !== 'multiple') {\n return;\n }\n if (this.selectAllState() === 'all') {\n this.#model.deselect(this.#aggregateValues());\n } else {\n this.#model.select(this.#aggregateValues());\n }\n }\n\n #selectRange(toValue: T): void {\n const values = this.#aggregateValues();\n const equals = this.#compareWith();\n const toIdx = values.findIndex((v) => equals(v, toValue));\n if (toIdx < 0) {\n return;\n }\n const anchor = this.#anchor();\n const anchorIdx = anchor === undefined ? -1 : values.findIndex((v) => equals(v, anchor));\n const start = anchorIdx < 0 ? toIdx : anchorIdx;\n const [lo, hi] = start <= toIdx ? [start, toIdx] : [toIdx, start];\n this.#model.setSelection(values.slice(lo, hi + 1));\n }\n}\n","import { type Signal, type WritableSignal } from '@angular/core';\n\nimport { selectionMembership } from 'forty-cdk/core';\n\n/**\n * Dependencies for {@link TableExpansion}. Wires the helper to `ForTable`'s\n * `[(expanded)]` model and the row-value comparator.\n */\nexport interface TableExpansionDeps<T> {\n /** Two-way bindable open parent-row values (each row's `[value]`). */\n readonly expanded: WritableSignal<readonly T[]>;\n /** Equality comparator for row values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n}\n\n/**\n * Treegrid expansion sub-model for `ForTable`. Owns the membership and mutation\n * algorithm for the `[(expanded)]` open-rows set, decoupled from the table root.\n *\n * Internal — not re-exported from `table/index.ts` or `public-api.ts`.\n */\nexport class TableExpansion<T> {\n readonly #expanded: WritableSignal<readonly T[]>;\n readonly #compareWith: Signal<(a: T, b: T) => boolean>;\n readonly #isExpanded: Signal<(value: T) => boolean>;\n\n constructor(deps: TableExpansionDeps<T>) {\n this.#expanded = deps.expanded;\n this.#compareWith = deps.compareWith;\n this.#isExpanded = selectionMembership(deps.expanded, deps.compareWith);\n }\n\n /** Whether `value` is currently in the open-rows set. */\n isExpanded(value: T): boolean {\n return this.#isExpanded()(value);\n }\n\n /**\n * Sets a parent row's expansion in or out of the open-rows set. No-op when\n * `value` is undefined or already in the requested state.\n */\n setExpanded(value: T, open: boolean): void {\n if (value === undefined) {\n return;\n }\n const current = this.#expanded();\n const has = this.isExpanded(value);\n if (open && !has) {\n this.#expanded.set([...current, value]);\n } else if (!open && has) {\n this.#expanded.set(current.filter((v) => !this.#compareWith()(v, value)));\n }\n }\n\n /** Toggles a parent row's expansion. No-op when `value` is undefined. */\n toggle(value: T): void {\n if (value === undefined) {\n return;\n }\n this.setExpanded(value, !this.isExpanded(value));\n }\n}\n","import {\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n output,\n type Provider,\n type Signal,\n signal,\n type Type,\n} from '@angular/core';\n\nimport {\n injectElementSize,\n composedContains,\n createPointerHighlight,\n defaultCompareWith,\n EscapeArbiter,\n findFirstFocusable,\n stepFocusableCycle,\n firstEnabledHost,\n type ForTableCellHandle,\n isImeComposing,\n type ForTableRowHandle,\n type GridNavigationAction,\n moveGridIndex,\n resolveGridNavigation,\n resolveTreegridExpandCollapse,\n TABLE_REGISTRATION_CONTEXT,\n type WritingDirection,\n injectReflectedDirection,\n injectTextDirection,\n RovingTabindex,\n hostAriaLabel,\n injectRovingFocusRestore,\n} from 'forty-cdk/core';\nimport { computeFlatHierarchy } from './flat-hierarchy';\nimport {\n FOR_TABLE_CONTEXT,\n hostHasSortActivation,\n type ForTableContext,\n type TableMode,\n type TableSelectionMode,\n type TableSelectionBehavior,\n type TableSelectAllState,\n} from './table-context';\nimport { TableRegistry } from './table-registry';\nimport { TableRowSelection } from './table-row-selection';\nimport { TableExpansion } from './table-expansion';\n\n/**\n * The value [ARIA reserves](https://www.w3.org/TR/wai-aria-1.2/#aria-rowcount) on\n * `aria-rowcount` / `aria-colcount` for a total the author cannot determine. It is\n * what a `grid` / `treegrid` reports when the count is genuinely unknowable rather\n * than merely zero: a `0` there would state that a grid claiming rows has no columns\n * at all (or that a windowed grid has no rows), a contradiction a screen reader\n * cannot reconcile — and `0` is itself in range, so it reads as a real answer rather\n * than as a missing one.\n *\n * The two channels qualify \"unknowable\" differently, and the asymmetry is deliberate: the row\n * channel gates on the grid being windowed, because a non-windowed grid's rendered rows *are* all\n * its rows; the column channel does not, because zero registered cells is degenerate markup rather\n * than a resolvable state. See `colCount`.\n */\nconst UNKNOWN_COUNT = -1;\n\n/**\n * Payload emitted by {@link ForTable.cellActivate} when `Enter` lands on a grid data\n * cell that holds no widget to enter.\n */\nexport interface TableCellActivateEvent<T> {\n /** The owning row's `[value]`, or `undefined` when the row carries none. */\n readonly row: T | undefined;\n /** The cell's column `name`. */\n readonly column: string;\n /** The originating `Enter` keydown, already `preventDefault`ed. */\n readonly event: KeyboardEvent;\n}\n\n/** A cell position in the composite grid: its row, the header row first when it joins, and its column. */\ninterface GridPosition {\n readonly row: number;\n readonly column: number;\n}\n\n/** Grid actions whose target may lie on a row outside the rendered virtualized window. */\nconst ROW_CROSSING_ACTIONS: ReadonlySet<GridNavigationAction> = new Set([\n 'next-row',\n 'prev-row',\n 'first',\n 'last',\n 'page-up',\n 'page-down',\n]);\n\n/**\n * Root of the Table primitive. Sets the ARIA `role` from `mode`, reflects\n * writing direction, and publishes the `--for-table-header-height` CSS custom\n * property (driven by a `ResizeObserver` on the first registered header row)\n * so consumers can `position: sticky` header cells without hard-coding offsets.\n *\n * Implements the [WAI-ARIA Table pattern](https://www.w3.org/WAI/ARIA/apg/patterns/table/)\n * and the [WAI-ARIA Grid pattern](https://www.w3.org/WAI/ARIA/apg/patterns/grid/).\n *\n * Use `mode=\"grid\"` or `mode=\"treegrid\"` for interactive grid semantics: a\n * single-tab-stop roving group with 2D arrow navigation over data cells.\n * The default `mode=\"table\"` is the static read-only structure.\n */\n@Directive({\n selector: '[forTable]',\n exportAs: 'forTable',\n host: {\n '[attr.role]': 'mode()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.dir]': 'reflectedDir()',\n '[attr.data-mode]': 'mode()',\n '[style.--for-table-header-height.px]': 'headerSize()?.height ?? null',\n '[attr.aria-rowcount]': 'rowCountAttr()',\n '[attr.aria-colcount]': 'colCountAttr()',\n '[attr.aria-multiselectable]':\n 'mode() !== \"table\" && selectionMode() === \"multiple\" ? \"true\" : null',\n '(focusout)': 'onFocusOut($event)',\n '(focusin)': 'onFocusIn($event)',\n '(pointerleave)': 'onPointerLeave()',\n },\n providers: provideForTable(ForTable),\n})\nexport class ForTable<T = unknown> implements ForTableContext {\n /**\n * ARIA role emitted on the host. `'table'` is the default static read-only\n * structure. `'grid'` and `'treegrid'` provide single-tab-stop roving + 2D\n * arrow navigation over data cells.\n */\n readonly mode = input<TableMode>('table');\n\n /**\n * Accessible label for the table. When set, reflected as `aria-label`.\n * Consumers with a visible caption should prefer pointing native\n * `aria-labelledby` at it instead; this input is the reactive convenience\n * hook for cases where no visible label element exists.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ariaLabel() || null);\n\n /**\n * Writing direction. When unset (default `null`), the inherited ambient direction is resolved\n * from the nearest ancestor carrying a `dir` attribute (or `<html dir>`), defaulting to `'ltr'`.\n * An explicit `[dir]` always wins. The resolved value is reflected to the host `dir` attribute\n * when a direction is set or declared.\n */\n readonly _dirInput = input<WritingDirection | null>(null, { alias: 'dir' });\n readonly dir = injectTextDirection(this._dirInput);\n private readonly reflectedDir = injectReflectedDirection(this._dirInput);\n\n /**\n * Explicit override for the true total data-row count (`aria-rowcount`, and the\n * virtualized scroll range unless `[forTableVirtualized]` narrows it with its own\n * `[virtualRowCount]`). A declarative `<for-table-body>` supplies this\n * automatically from its `rows` dataset length, so bind `[rowCount]` only for a\n * server-known total larger than the loaded rows; when set it wins over the\n * body-derived count. Defaults to the body count, else the rendered data-row\n * count plus the header offset — so an empty non-virtualized grid with a header\n * row reports `aria-rowcount=\"1\"`, because its rendered rows are all the rows it\n * has. A **windowed** grid with neither is the one shape whose total is\n * unknowable — its mounted rows are a slice of an uncounted dataset — so there\n * `aria-rowcount` reports `-1`, the value ARIA reserves for an unknown total,\n * whether or not rows are mounted. An explicit value is emitted verbatim,\n * including `0`. Ignored in `mode=\"table\"`.\n */\n readonly _rowCountInput = input<number | undefined>(undefined, { alias: 'rowCount' });\n\n readonly #registry = inject(TableRegistry);\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /**\n * Resolved true total data-row count: the explicit `[rowCount]` input when set,\n * else the declarative `<for-table-body>`'s dataset length, else `undefined`\n * (readers fall back to the rendered count). Feeds `aria-rowcount` and, unless\n * `[forTableVirtualized]` narrows it with its own `[virtualRowCount]`, the\n * virtualizer's count and the cross-window navigation bound.\n */\n readonly rowCount = computed<number | undefined>(\n () => this._rowCountInput() ?? this.#registry.bodyRowCount()?.(),\n );\n\n /**\n * The count of currently loaded data rows (the declarative `<for-table-body>`\n * dataset length), or `undefined` when no body has registered one (raw-primitive\n * rendering). Distinct from `rowCount`, which an explicit `[rowCount]` raises to a\n * server-known total larger than the loaded rows; cross-window navigation clamps\n * unmounted targets to this so a target beyond the loaded prefix cannot stash a\n * pending focus move that resolves — and steals focus — only when a far page later\n * loads.\n */\n readonly loadedRowCount = computed<number | undefined>(() => this.#registry.bodyRowCount()?.());\n\n /**\n * True total number of columns for `aria-colcount`. Defaults to the rendered\n * column count (the cells of the first data row that has any, else the registered\n * header cells) — and when no channel knows the count, `aria-colcount` reports\n * `-1`, the value ARIA reserves for an unknown total. That is the shape a\n * virtualized grid with no header row has until its first window resolves: no row\n * is rendered, so no cell has registered.\n *\n * Unlike `aria-rowcount`, that sentinel is **unconditional** — it is not gated on\n * the grid being windowed.\n * A non-windowed grid with no registered cell has rows without cells, or no markup\n * at all: degenerate either way, so there is no state where `0` is the resolved\n * answer rather than the missing one, and emitting it would re-open exactly the\n * \"`0` reads as a real answer\" defect the sentinel exists for.\n *\n * An explicit value is emitted verbatim, including `0`. Ignored in `mode=\"table\"`.\n */\n readonly colCount = input<number>();\n\n /** Row selection mode. `'none'` (default) disables selection entirely. */\n readonly selectionMode = input<TableSelectionMode>('none');\n\n /**\n * How a row click changes the selection. `'toggle'` (default) flips the clicked\n * row. `'replace'` replaces the selection with the clicked row; Ctrl/Cmd-click\n * toggles a single row and Shift-click extends a range (multiple mode only).\n * `'none'` leaves the selection untouched on a row click, so the row click is\n * free for whole-row activation while `[forTableRowSelector]`,\n * `[forTableSelectAll]` and `Space` on a focused grid cell keep driving the\n * selection — `aria-selected` and `aria-multiselectable` are unaffected.\n */\n readonly selectionBehavior = input<TableSelectionBehavior>('toggle');\n\n /**\n * Two-way bindable selected row values (each row's `[value]`). Single mode keeps\n * 0–1 entries. The implicit `valueChange` fires only on internal mutations\n * (selector / row click / Space / select-all), never on consumer writes. The\n * directive infers the row-value type `T` from this binding.\n */\n readonly value = model<readonly T[]>([]);\n\n /** Equality comparator for row values. Defaults to `===`; supply id-based for objects. */\n readonly compareWith = input<(a: T, b: T) => boolean>(defaultCompareWith);\n\n /**\n * Full ordered set of selectable row values (each row's `[value]`), for a\n * virtualized or server-paged table whose aggregate selection operations must\n * span rows beyond the rendered window. When `null` (default), the select-all\n * tri-state, `toggleSelectAll`, and Shift-click range selection compute against\n * the registered (rendered) rows only. When supplied, they use this set as the\n * universe of selectable values, so a range can span unmounted rows and the\n * tri-state reflects the true dataset. Per-row selection is unaffected.\n */\n readonly selectableValues = input<readonly T[] | null>(null);\n\n /**\n * Two-way bindable open parent-row values (each row's `[value]`), for\n * `mode=\"treegrid\"`. The implicit `expandedChange` fires only on internal\n * expand/collapse (ArrowRight/ArrowLeft, `toggleRowExpansion`), never on\n * consumer writes through `[(expanded)]`. Ignored outside `treegrid` mode.\n */\n readonly expanded = model<readonly T[]>([]);\n\n /**\n * Fires in `grid` / `treegrid` mode when `Enter` lands on a focused data cell that\n * holds no widget to enter, carrying the row's `[value]`, the cell's column `name` and\n * the event. A cell holding a widget still enters it on `Enter` and emits nothing; `F2`,\n * header cells, disabled cells and `mode=\"table\"` never emit.\n */\n readonly cellActivate = output<TableCellActivateEvent<T>>();\n\n private readonly headerSize = injectElementSize(this.#registry.headerRowEl);\n\n readonly #roving = new RovingTabindex(() => this.#flatCells());\n readonly #pointer = createPointerHighlight({ items: () => this.#flatCells() });\n readonly #enteredCell = signal<HTMLElement | null>(null);\n readonly #escapeArbiter = inject(EscapeArbiter);\n readonly #activations = new WeakSet<Event>();\n\n /**\n * The cell interaction mode was last suspended from, held only between the focusout that left\n * it and the next focusin. Plain state, not a signal: nothing derives from it, and the focus\n * pair that owns it reads and clears it in the same turn.\n */\n #restoreCell: HTMLElement | null = null;\n\n readonly #headerCellHosts = this.#registry.headerCells;\n readonly #dataCells = computed(() => this.#registry.rows().flatMap((row) => row.cells()));\n readonly #dataCols = computed(\n () =>\n this.#registry\n .rows()\n .find((row) => row.cells().length > 0)\n ?.cells().length ?? 0,\n );\n\n /**\n * Whether the registered header cells form a complete grid row that joins the body's\n * roving grid as its first row. True in `grid` / `treegrid` mode when at least one\n * header cell registered and the count matches the data column count (or there are no\n * data rows yet). Draggable header cells (a `[forTableColumnReorder]` row) register the\n * same way, so a column-reorderable grid still forms one composite tab stop across\n * header and body — the reorder wrapper hands its drop-list roving over to this grid via\n * `FOR_DROP_LIST_ROVING_DELEGATE` and routes idle header navigation through\n * `handleHeaderCellKeydown`.\n */\n readonly #headerParticipates = computed(() => {\n if (this.mode() === 'table') {\n return false;\n }\n const headerCount = this.#headerCellHosts().length;\n if (headerCount === 0) {\n return false;\n }\n const dataCols = this.#dataCols();\n return dataCols === 0 || headerCount === dataCols;\n });\n\n private readonly headerParticipatesInRoving = this.#headerParticipates;\n\n /**\n * The composite roving grid: the header cells (as grid row 0, when they form a\n * complete row) followed by the data cells in row-major order, so the table exposes\n * a single tab stop and arrow navigation crosses between the header and the body.\n */\n readonly #flatCells = computed<readonly ForTableCellHandle[]>(() =>\n this.#headerParticipates()\n ? [...this.#headerCellHosts(), ...this.#dataCells()]\n : this.#dataCells(),\n );\n readonly #cols = computed(() => {\n const dataCols = this.#dataCols();\n return dataCols > 0 ? dataCols : this.#headerCellHosts().length;\n });\n\n private readonly columnCount = this.#cols;\n\n /**\n * The cell that owns the tab stop while nothing is roving-active — the first\n * enabled cell of the composite grid.\n *\n * It walks the header row and then the data rows one at a time instead of\n * reading the materialized `#flatCells`, so it stops depending on a row's\n * `cells()` as soon as an earlier row has answered. Every cell's `tabindex`\n * binding is a live consumer of this signal and each row registers its cells\n * during that row's own update pass, so a dependency on the whole grid would make each\n * registration notify every cell mounted so far, which is quadratic in grid size.\n *\n * The header branch's fall-through is unreachable: header cells hardcode a\n * `false` `disabled`, and `#headerParticipates()` already rules out an empty\n * header row. It is kept so the walk stays equivalent to the `#flatCells`\n * concatenation if header cells ever gain a real disabled state.\n */\n readonly #firstEnabledCell = computed<HTMLElement | null>(() => {\n if (this.#headerParticipates()) {\n const fromHeader = firstEnabledHost(this.#headerCellHosts());\n if (fromHeader !== null) {\n return fromHeader;\n }\n }\n for (const row of this.#registry.rows()) {\n const fromRow = firstEnabledHost(row.cells());\n if (fromRow !== null) {\n return fromRow;\n }\n }\n return null;\n });\n\n /** Whether the header row participates in the row-index space (a header row is registered, non-table mode). */\n readonly #hasHeaderRowIndex = computed(\n () => this.mode() !== 'table' && this.#registry.headerRowEl() !== null,\n );\n\n /** 1-based row offset ARIA applies to data rows because the header row occupies index 1. */\n private readonly dataRowIndexOffset = computed(() => (this.#hasHeaderRowIndex() ? 1 : 0));\n\n private readonly headerRowIndex = computed<number | null>(() =>\n this.#hasHeaderRowIndex() ? 1 : null,\n );\n\n readonly #registeredValues = computed<readonly T[]>(() =>\n this.#registry\n .rows()\n .map((row) => row.value() as T)\n .filter((v) => v !== undefined),\n );\n readonly #aggregateValues = computed<readonly T[]>(\n () => this.selectableValues() ?? this.#registeredValues(),\n );\n\n readonly #selection = new TableRowSelection<T>({\n selection: this.value,\n selectionMode: this.selectionMode,\n selectionBehavior: this.selectionBehavior,\n compareWith: this.compareWith,\n aggregateValues: this.#aggregateValues,\n });\n\n readonly selectAllState: Signal<TableSelectAllState> = this.#selection.selectAllState;\n\n readonly #expansion = new TableExpansion<T>({\n expanded: this.expanded,\n compareWith: this.compareWith,\n });\n\n readonly #rowHierarchy = computed(() =>\n computeFlatHierarchy(this.#registry.rows().map((row) => row.level())),\n );\n\n #rowOfCell(cellHost: HTMLElement): ForTableRowHandle | undefined {\n return this.#registry.rows().find((row) => row.cells().some((cell) => cell.host === cellHost));\n }\n\n /**\n * Absolute index of the row that owns the currently roving-focused cell, or `null`\n * when no cell is focused (or the focused row carries no `virtualIndex`). Used by\n * `[forTableVirtualized]` to keep the focused row mounted across recycling.\n */\n readonly focusedRowIndex = computed<number | null>(() => {\n const active = this.#roving.active();\n if (active === null) {\n return null;\n }\n return this.#rowOfCell(active)?.virtualIndex() ?? null;\n });\n\n /**\n * Whether the grid is windowed — a `[forTableVirtualized]` companion has published\n * a rendered window, so the registered rows are a slice of the dataset rather than\n * all of it. That companion registers the window from its **constructor**, so this\n * already answers `true` server-side and on the first frame, for the raw-primitive\n * path as much as for `<for-table-body>`; being a signal read inside a `computed`\n * also makes the two directives' construction order on the shared host irrelevant.\n */\n readonly #windowed = computed(() => this.#registry.virtualWindow() !== null);\n\n private readonly rowCountAttr = computed<number | null>(() => {\n if (this.mode() === 'table') {\n return null;\n }\n const total = this.rowCount();\n if (total !== undefined) {\n return total + this.dataRowIndexOffset();\n }\n if (this.#windowed()) {\n return UNKNOWN_COUNT;\n }\n return this.#registry.rows().length + this.dataRowIndexOffset();\n });\n private readonly colCountAttr = computed<number | null>(() => {\n if (this.mode() === 'table') {\n return null;\n }\n const total = this.colCount();\n if (total !== undefined) {\n return total;\n }\n const rendered = this.#cols();\n return rendered === 0 ? UNKNOWN_COUNT : rendered;\n });\n\n /**\n * The position of the cell that last took DOM focus, or of the cell holding the element that\n * did, recorded when focus arrives so {@link #focusRestoreTarget} can place a cell that has\n * already left the grid. Plain state: nothing derives from it.\n */\n #focusedPosition: GridPosition | null = null;\n\n constructor() {\n this.#registry.registerHeaderCellFocus((column) => this.#focusHeaderCell(column));\n injectRovingFocusRestore(\n {\n active: () => this.#focusRestoreTarget(),\n noteFocus: (el) => this.#noteFocusedPosition(el),\n },\n { skip: () => this.#windowed() },\n );\n }\n\n /** The rows of the composite grid: the header cells when they join it, then each data row. */\n #gridRows(): readonly (readonly ForTableCellHandle[])[] {\n const body = this.#registry.rows().map((row) => row.cells());\n return this.#headerParticipates() ? [this.#headerCellHosts(), ...body] : body;\n }\n\n #noteFocusedPosition(el: Element | null): void {\n if (el === null) {\n return;\n }\n this.#focusedPosition = null;\n if (this.mode() === 'table') {\n return;\n }\n const rows = this.#gridRows();\n for (let row = 0; row < rows.length; row++) {\n const column = rows[row]!.findIndex(\n (cell) => cell.host === el || composedContains(cell.host, el),\n );\n if (column >= 0) {\n this.#focusedPosition = { row, column };\n return;\n }\n }\n }\n\n /**\n * The cell that owns the tab stop once the focused cell has left the grid, made the roving\n * owner so focus and the tab stop land together: the enabled cell nearest the departed one's\n * position, in the same row for a removed column and in the same column for a removed row,\n * else the first enabled cell.\n */\n #focusRestoreTarget(): HTMLElement | null {\n if (this.mode() === 'table') {\n return null;\n }\n const current = this.#roving.active();\n if (current !== null && current.isConnected) {\n return current;\n }\n const target = this.#cellNear(this.#focusedPosition) ?? this.#firstEnabledCell();\n if (target !== null) {\n this.#roving.setActive(target);\n }\n return target;\n }\n\n /** The enabled cell nearest `position`, clamped into the grid, scanning outwards along its row. */\n #cellNear(position: GridPosition | null): HTMLElement | null {\n if (position === null) {\n return null;\n }\n const rows = this.#gridRows();\n const cells = rows[Math.min(position.row, rows.length - 1)] ?? [];\n const column = Math.min(position.column, cells.length - 1);\n for (let distance = 0; distance < cells.length; distance++) {\n for (const index of [column - distance, column + distance]) {\n const cell = cells[index];\n if (cell !== undefined && !cell.disabled()) {\n return cell.host;\n }\n }\n }\n return null;\n }\n\n isRowExpanded(value: T): boolean {\n return this.#expansion.isExpanded(value);\n }\n\n toggleRowExpansion(value: T): void {\n this.#expansion.toggle(value);\n }\n\n private rowPosinset(host: HTMLElement): number {\n const index = this.#registry.rowIndexOf(host);\n return index < 0 ? 1 : (this.#rowHierarchy()[index]?.posinset ?? 1);\n }\n\n private rowSetsize(host: HTMLElement): number {\n const index = this.#registry.rowIndexOf(host);\n return index < 0 ? 1 : (this.#rowHierarchy()[index]?.setsize ?? 1);\n }\n\n private rowIndexOf(host: HTMLElement): number {\n return this.#registry.rowIndexOf(host);\n }\n\n /**\n * Roving tab-stop value for a cell: the active cell owns `0`, and before anything is\n * active the first enabled cell does.\n *\n * The gate is `holdsActive()` rather than `hasActive()` on purpose. `#roving` is built over\n * `#flatCells()`, so it already reconciles an active host away from a cell whose\n * **handle** reports disabled; `hasActive()` additionally discounts a host carrying\n * `aria-disabled`, which on a `[forTableColumnReorder]` header cell is owned by the\n * co-located `[forDraggable]` and means \"cannot be lifted\", not \"not a grid cell\". Going\n * through `hasActive()` therefore left a pinned column that is not `#firstEnabledCell()`\n * highlighted but with `tabindex=\"-1\"`, and the tab stop stranded on column 1\n * ([#1840](https://github.com/tutkli/forty-cdk/issues/1840)).\n */\n private cellTabIndex(host: HTMLElement): 0 | -1 {\n if (this.#roving.holdsActive()) {\n return this.#roving.isActive(host) ? 0 : -1;\n }\n return this.#firstEnabledCell() === host ? 0 : -1;\n }\n\n private headerCellTabIndex(host: HTMLElement): 0 | -1 {\n if (!this.#headerParticipates()) {\n return -1;\n }\n return this.cellTabIndex(host);\n }\n\n private headerCellIndexOf(host: HTMLElement): number {\n return this.#registry.headerCellIndexOf(host);\n }\n\n private isCellHighlighted(host: HTMLElement): boolean {\n if (this.#pointer.hasPointed()) {\n return this.#pointer.isPointed(host);\n }\n return this.#roving.isActive(host);\n }\n\n private activateCell(host: HTMLElement): void {\n if (this.mode() !== 'table') {\n this.#pointer.release();\n this.#roving.setActive(host);\n }\n }\n\n private highlightFromPointer(host: HTMLElement): void {\n if (this.mode() !== 'table') {\n this.#pointer.claim(host);\n }\n }\n\n private onPointerLeave(): void {\n this.#pointer.release();\n }\n\n /**\n * Moves roving focus onto the header cell in the 0-based `column`, answering `false`\n * when the header row does not join the composite grid, carries no such column, or\n * holds a disabled cell there — the same cells {@link moveGridIndex} refuses to land\n * on, so the two crossings stay equivalent.\n *\n * Registered with the registry rather than resolved by it: the registry owns the\n * header cell collection, but the header row's participation and the roving tab stop\n * are the root's model. `[forTableVirtualized]` calls it when an upward cross-window\n * walk steps over the last variant row above the dataset — the crossing this root\n * resolves through {@link moveGridIndex} when no virtualizer is involved\n * ([#1841](https://github.com/tutkli/forty-cdk/issues/1841)).\n */\n #focusHeaderCell(column: number): boolean {\n if (!this.#headerParticipates()) {\n return false;\n }\n const cell = this.#headerCellHosts()[column];\n if (cell === undefined || cell.disabled()) {\n return false;\n }\n this.#roving.focusActive(cell.host);\n return true;\n }\n\n isRowSelected(value: T): boolean {\n return this.#selection.isSelected(value);\n }\n\n toggleRowSelection(value: T): void {\n this.#selection.toggle(value);\n }\n\n selectRow(\n value: T,\n modifiers?: { ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean },\n ): void {\n this.#selection.select(value, modifiers);\n }\n\n toggleSelectAll(): void {\n this.#selection.toggleSelectAll();\n }\n\n #rowValueOfCell(cellHost: HTMLElement): T | undefined {\n for (const row of this.#registry.rows()) {\n if (row.cells().some((cell) => cell.host === cellHost)) {\n return row.value() as T;\n }\n }\n return undefined;\n }\n\n /**\n * Drops the entered-cell state as soon as focus leaves the cell it points at, by whatever\n * route — a pointer press elsewhere, a widget handing focus to an overlay of its own, or\n * focus leaving the table. The Tab cycle and the `Escape` return then only ever answer for\n * a cell that really holds the focus.\n *\n * Two hops that look like departures are not. A `relatedTarget` the browser retargeted to a\n * shadow host *above* the cell hides a destination that may well be inside it, so an ambiguous\n * hop keeps the state ({@link #retargeted}) — otherwise a cell rendered inside an open shadow\n * root would lose interaction mode on the very focus move that enters it.\n * And a `null` `relatedTarget` while the document itself has lost focus is a window blur rather\n * than a departure: the widget gets its focus back when the user returns, so interaction mode\n * has to survive with it.\n *\n * A real departure parks the cell instead of forgetting it, so {@link onFocusIn} can hand\n * interaction mode back when focus returns to one of its widgets.\n */\n private onFocusOut(event: FocusEvent): void {\n const entered = this.#enteredCell();\n if (!entered) {\n return;\n }\n const next = event.relatedTarget;\n if (\n next instanceof Node &&\n (composedContains(entered, next) || this.#retargeted(next, entered))\n ) {\n return;\n }\n if (next === null && !entered.ownerDocument.hasFocus()) {\n return;\n }\n this.#enteredCell.set(null);\n this.#restoreCell = entered;\n }\n\n /**\n * Whether `next` is a shadow host the browser retargeted a destination inside `entered` to: an\n * element strictly between this table's root and the entered cell, which a focus move can only\n * be reported as when the real target sits in a shadow tree below it. Bounding it to the table's\n * own subtree is what keeps focus moving to `<body>` — or to any tabbable ancestor of the table —\n * a departure rather than an ambiguous hop.\n */\n #retargeted(next: Node, entered: HTMLElement): boolean {\n return (\n next !== this.#host && composedContains(this.#host, next) && composedContains(next, entered)\n );\n }\n\n /**\n * Restores interaction mode when focus returns to a widget of the cell {@link onFocusOut} last\n * parked — the round trip a widget makes around an overlay of its own, such as a column-menu\n * button whose menu returns focus to it on close. Without it the widget comes back focused\n * inside a cell the grid no longer counts as entered, which is the state this whole keymap\n * exists to prevent.\n *\n * Focus landing anywhere else retires the parked cell, the cell host itself included: entry\n * resumes only where it left off, and Tab reaching a widget from outside the grid stays a plain\n * tab stop rather than silently becoming interaction mode.\n *\n * Focus reaching a widget inside a cell by any route also moves the roving tab stop onto that\n * cell, without entering interaction mode, so the tab stop and the row a virtualized grid keeps\n * mounted are always the ones holding focus.\n */\n private onFocusIn(event: FocusEvent): void {\n const target = event.target;\n if (target instanceof Node) {\n this.#followFocusIntoCell(target);\n }\n const restore = this.#restoreCell;\n if (!restore) {\n return;\n }\n this.#restoreCell = null;\n if (target instanceof Node && target !== restore && composedContains(restore, target)) {\n this.#enteredCell.set(restore);\n }\n }\n\n #followFocusIntoCell(target: Node): void {\n if (this.mode() === 'table') {\n return;\n }\n const cell = this.#flatCells().find(\n (handle) => handle.host !== target && composedContains(handle.host, target),\n );\n if (cell !== undefined && !cell.disabled() && this.#roving.active() !== cell.host) {\n this.#pointer.release();\n this.#roving.setActive(cell.host);\n }\n }\n\n private handleCellKeydown(event: KeyboardEvent, host: HTMLElement, column?: string): void {\n if (this.mode() === 'table' || (event.defaultPrevented && event.target === host)) {\n return;\n }\n this.#resolveCellKeydown(event, host, { rowActions: true, enterEntersCell: true, column });\n }\n\n private isCellActivation(event: Event): boolean {\n return this.#activations.has(event);\n }\n\n /**\n * Resolves grid navigation and APG cell entry for a header cell that yields its host\n * interaction to a co-located `[forDraggable]` (a `[forTableColumnReorder]` row).\n * `[forTableColumnReorder]` calls this from a capture-phase listener for idle (not-lifted)\n * header cells, so Arrow / Home / End / Page keys move roving focus across the composite\n * header + body grid and `F2` moves focus into the cell's first widget. `ForTableHeaderCell`\n * calls it from its own bubbling keydown for the two keys that listener cannot see, both\n * targeted at an entered widget rather than at a header cell — the `Tab` that cycles between\n * the cell's widgets and the `Escape` that returns focus from one. Space / Enter still fall\n * through to the draggable's lift and the sort activation. Returns `true` when the key was\n * consumed, `false` otherwise. No-op (returns `false`) outside `grid` / `treegrid` mode or\n * when the header row does not join the composite grid.\n */\n private handleHeaderCellKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if (this.mode() === 'table' || !this.#headerParticipates()) {\n return false;\n }\n return this.#resolveCellKeydown(event, host, { rowActions: false, enterEntersCell: false });\n }\n\n /**\n * The grid keymap both cell entries resolve against, so a key added to one reaches the\n * other: cell entry, then — for a key targeted at the cell host itself — the row actions\n * a data cell owns, then 2D grid navigation. Returns `true` when the key was consumed.\n *\n * `rowActions` adds the selection / expansion keys a data cell owns and a header cell has\n * no row for, plus the `Enter` activation when the data cell passes its `column`.\n * `enterEntersCell` is `false` where a co-located `[forDraggable]` owns `Enter` for the\n * lift and the sort activation.\n */\n #resolveCellKeydown(\n event: KeyboardEvent,\n host: HTMLElement,\n options: { rowActions: boolean; enterEntersCell: boolean; column?: string },\n ): boolean {\n this.#registry.virtualRowNavigation()?.clearPending();\n if (\n (options.enterEntersCell || event.key !== 'Enter') &&\n this.#handleCellEntryKeydown(event, host)\n ) {\n return true;\n }\n if (event.target !== host) {\n return false;\n }\n if (options.rowActions) {\n if (this.#handleSelectionKeydown(event, host)) {\n return true;\n }\n if (this.#handleExpansionKeydown(event, host)) {\n return true;\n }\n if (\n options.column !== undefined &&\n this.#handleActivationKeydown(event, host, options.column)\n ) {\n return true;\n }\n }\n return this.#handleGridNavigationKeydown(event, host);\n }\n\n /**\n * APG grid cell-entry mode: Enter or F2 on a focused cell moves focus into the\n * cell's first interactive widget; Tab / Shift+Tab then move between that cell's\n * widgets, and Escape returns focus to the owning cell. Returns `true` when the\n * event was consumed.\n *\n * A cell whose host carries an active sort affordance (`[forTableSortHeader]`\n * with `sortable`, marked by `data-sortable`) defers `Enter` to the sort\n * activation — `Enter` toggles the sort and focus stays on the cell — while\n * `F2` remains the cell-entry key, so a sortable + resizable header does not\n * both sort and drop focus onto the resize handle.\n *\n * The Tab cycle wraps at both ends and is `preventDefault`ed, so focus cannot leave the\n * entered cell for another cell's widget or the next document tab stop while the cell is\n * in interaction mode — Escape is the way out. It cycles the same *focusable* set `F2`\n * enters, so a widget the grid gives `tabindex=\"-1\"` (`[forTableColumnResizer]`,\n * `[forTableSelectAll]`) is reached rather than skipped. A cell holding a single widget\n * cycles back to it. Tab targeted at the cell host itself keeps its document-wide meaning.\n *\n * Escape is left to the dismissible-layer stack while an active layer sits above every\n * layer containing the cell (a tooltip on the cell's widget), so that overlay closes and\n * interaction mode is kept; a layer around the grid (a dialog) never takes it from here.\n */\n #handleCellEntryKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if ((event.key === 'Enter' || event.key === 'F2') && event.target === host) {\n if (event.key === 'Enter' && hostHasSortActivation(host)) {\n return false;\n }\n const target = findFirstFocusable(host);\n if (!target) {\n return false;\n }\n event.preventDefault();\n this.#enteredCell.set(host);\n target.focus();\n return true;\n }\n if (event.key === 'Tab' && this.#enteredCell() === host && event.target !== host) {\n const from = event.target instanceof Element ? event.target : null;\n const next = stepFocusableCycle(host, from, event.shiftKey ? 'backward' : 'forward');\n if (!next) {\n return false;\n }\n event.preventDefault();\n next.focus();\n return true;\n }\n if (\n event.key === 'Escape' &&\n !isImeComposing(event) &&\n this.#enteredCell() === host &&\n event.target !== host &&\n !this.#escapeArbiter.hasEscapeLayerAbove(host)\n ) {\n event.preventDefault();\n this.#enteredCell.set(null);\n host.focus();\n return true;\n }\n return false;\n }\n\n #handleActivationKeydown(event: KeyboardEvent, host: HTMLElement, column: string): boolean {\n if (event.key !== 'Enter') {\n return false;\n }\n const row = this.#rowOfCell(host);\n if (\n !row ||\n row\n .cells()\n .find((cell) => cell.host === host)\n ?.disabled()\n ) {\n return false;\n }\n event.preventDefault();\n this.#activations.add(event);\n this.cellActivate.emit({ row: row.value() as T | undefined, column, event });\n return true;\n }\n\n #handleSelectionKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if (event.key !== ' ' || event.target !== host || this.selectionMode() === 'none') {\n return false;\n }\n const value = this.#rowValueOfCell(host);\n if (value === undefined) {\n return false;\n }\n event.preventDefault();\n this.#selection.toggle(value);\n return true;\n }\n\n /**\n * Treegrid expand / collapse, answered only on the first cell of an expandable row: on every\n * other cell the arrows navigate, so moving across a parent row's columns never changes its\n * state.\n */\n #handleExpansionKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n if (this.mode() !== 'treegrid') {\n return false;\n }\n const intent = resolveTreegridExpandCollapse(event, this.dir());\n if (intent === null) {\n return false;\n }\n const row = this.#rowOfCell(host);\n if (!row?.expandable() || row.value() === undefined || row.cells()[0]?.host !== host) {\n return false;\n }\n const value = row.value() as T;\n const open = this.#expansion.isExpanded(value);\n if (intent === 'expand' && !open) {\n event.preventDefault();\n this.#expansion.setExpanded(value, true);\n return true;\n }\n if (intent === 'collapse' && open) {\n event.preventDefault();\n this.#expansion.setExpanded(value, false);\n return true;\n }\n return false;\n }\n\n #handleGridNavigationKeydown(event: KeyboardEvent, host: HTMLElement): boolean {\n const cols = this.#cols();\n const cells = this.#flatCells();\n if (cols === 0 || cells.length === 0) {\n return false;\n }\n const action: GridNavigationAction | null = resolveGridNavigation(event, {\n cols,\n dir: this.dir(),\n pageKeys: true,\n });\n if (action === null) {\n return false;\n }\n event.preventDefault();\n this.#pointer.suppress();\n const currentIndex = Math.max(\n 0,\n cells.findIndex((cell) => cell.host === host),\n );\n\n const navigation = this.#registry.virtualRowNavigation();\n const dataRow = this.focusedRowIndex();\n const fromRow = dataRow ?? (this.#isParticipatingHeaderCell(host) ? -1 : null);\n const total = navigation?.placeableRowCount() ?? 0;\n const pageSize = this.#pageSize();\n const headerIsRowTarget =\n this.#headerParticipates() && targetsHeaderRow(action, dataRow, pageSize);\n if (headerIsRowTarget) {\n navigation?.scrollToRow(0);\n }\n if (\n navigation !== null &&\n total > 0 &&\n fromRow !== null &&\n ROW_CROSSING_ACTIONS.has(action) &&\n !headerIsRowTarget\n ) {\n const col = currentIndex % cols;\n const target = resolveCrossWindowRowTarget(action, fromRow, col, total, cols, pageSize);\n if (target !== null) {\n navigation.navigateTo(target.row, target.col, target.direction);\n }\n return true;\n }\n\n const next = moveGridIndex(currentIndex, cells.length, action, {\n cols,\n pageSize,\n isDisabled: (i) => cells[i]!.disabled(),\n });\n if (next === null) {\n return true;\n }\n this.#roving.focusActive(cells[next]!.host);\n return true;\n }\n\n #isParticipatingHeaderCell(host: HTMLElement): boolean {\n return this.#headerParticipates() && this.#headerCellHosts().some((cell) => cell.host === host);\n }\n\n /**\n * Rows a PageUp / PageDown moves. One page is the number of rendered data rows\n * — in a virtualized grid that is the visible window (plus overscan), so paging\n * a 100k-row grid advances by a screenful rather than teleporting to an end. A\n * lone-row window still advances by at least one row.\n */\n #pageSize(): number {\n return Math.max(1, this.#registry.rows().length);\n }\n}\n\n/**\n * Resolves the absolute `(row, 0-based column)` target and travel `direction`\n * for a row-crossing grid action against the `total` count of rows the\n * virtualizer can place. `fromRow` is `-1` for a move starting on the header\n * row, so it lands on the dataset's rows rather than the rendered window's.\n * Arrow row-moves preserve the current column;\n * `page-up` / `page-down` move by\n * `pageSize` rows (the caller's `#pageSize()` is already at least 1, and the\n * move is clamped to the dataset bounds) preserving the column;\n * `last` jumps to the last cell of the whole grid. The `direction` (`+1` for\n * down / first, `-1` for up / last) is threaded to the virtualization bridge so\n * it can step over full-span variant rows onto the adjacent data row. Returns\n * `null` when the move would not change the focused row. The actions\n * {@link targetsHeaderRow} claims for a participating header row — `first`,\n * plus `prev-row` / `page-up` from within the first page of data rows — are\n * routed through the non-virtualized `moveGridIndex` path instead, so this\n * resolver's `first` case applies only to a header-less grid and its `prev-row`\n * / `page-up` cases clamp at data row 0 only when the header does not\n * participate.\n */\nfunction resolveCrossWindowRowTarget(\n action: GridNavigationAction,\n fromRow: number,\n col: number,\n total: number,\n cols: number,\n pageSize: number,\n): { row: number; col: number; direction: 1 | -1 } | null {\n switch (action) {\n case 'next-row':\n return fromRow + 1 < total ? { row: fromRow + 1, col, direction: 1 } : null;\n case 'prev-row':\n return fromRow - 1 >= 0 ? { row: fromRow - 1, col, direction: -1 } : null;\n case 'page-down': {\n const row = Math.min(total - 1, fromRow + pageSize);\n return row > fromRow ? { row, col, direction: 1 } : null;\n }\n case 'page-up': {\n const row = Math.max(0, fromRow - pageSize);\n return row < fromRow ? { row, col, direction: -1 } : null;\n }\n case 'first':\n return { row: 0, col: 0, direction: 1 };\n case 'last':\n return { row: total - 1, col: cols - 1, direction: -1 };\n default:\n return null;\n }\n}\n\n/**\n * Whether a row-crossing action lands on the header row of the composite grid,\n * given the absolute data row the move starts from (`null` when the focused cell\n * is not in a data row — a header cell, typically). Only meaningful when the\n * header participates in roving, in which case it is the grid's row 0 and the\n * data rows start at grid row 1:\n *\n * - `first` (`Ctrl+Home`) targets the first cell of the grid, i.e. the header.\n * - `prev-row` (`ArrowUp`) from data row 0 steps above the data, into the header.\n * - `page-up` from within the first page of data rows (`fromRow < pageSize`)\n * clamps to grid row 0, which is the header — mirroring `moveGridIndex`'s\n * clamp exactly.\n *\n * A header target is rendered whether or not the virtual window contains data\n * row 0, so `[forTable]` resolves these through the non-virtualized\n * `moveGridIndex` path rather than through the cross-window bridge; the caller\n * still asks the virtualizer to scroll back to row 0 first, so the grid is never\n * left focused on its header while the window sits at the bottom of the dataset.\n */\nfunction targetsHeaderRow(\n action: GridNavigationAction,\n fromRow: number | null,\n pageSize: number,\n): boolean {\n if (action === 'first') {\n return true;\n }\n if (fromRow === null) {\n return false;\n }\n if (action === 'prev-row') {\n return fromRow === 0;\n }\n return action === 'page-up' && fromRow < pageSize;\n}\n\n/**\n * The providers a `[forTable]` root installs: the public\n * {@link FOR_TABLE_CONTEXT}, aliased to `root`, plus the internal\n * piece-registration wiring the table's pieces resolve.\n *\n * `ForTable` declares its own providers through this helper, so a wrapper that\n * **subclasses** the root has a single call to keep in step with it. That\n * matters because Angular does not inherit a directive's `providers`: a subclass\n * carrying its own `@Directive` metadata replaces the array wholesale, so\n * re-providing `FOR_TABLE_CONTEXT` alone leaves the registration wiring absent\n * and every piece — down to the root's own constructor — fails to resolve it.\n * The internal providers are unnameable outside the library, which is why the\n * wrapper cannot list them by hand.\n *\n * ```ts\n * providers: provideForTable(MyTable),\n * ```\n *\n * Wrapping through `hostDirectives: [ForTable]` needs none of this — a host\n * directive brings its own providers to the element.\n */\nexport function provideForTable<T = unknown>(root: Type<ForTable<T>>): Provider[] {\n return [\n TableRegistry,\n { provide: FOR_TABLE_CONTEXT, useExisting: root },\n { provide: TABLE_REGISTRATION_CONTEXT, useExisting: TableRegistry },\n ];\n}\n","import {\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n type Signal,\n signal,\n} from '@angular/core';\n\nimport {\n type ForTableCellHandle,\n injectHostCarriesDragItem,\n injectPointerMove,\n isImeComposing,\n registerHandle,\n} from 'forty-cdk/core';\nimport {\n coerceSticky,\n injectTableContext,\n injectTableRegistration,\n type TableStickyValue,\n} from './table-context';\n\n/**\n * Marks a header cell (`role=\"columnheader\"`). Requires a `name` input that\n * identifies the column — reflected as `data-column` for later phases (sort,\n * resize, reorder) to key off. Optionally sticky via the `sticky` input.\n *\n * In `grid` / `treegrid` mode the header cell joins the roving-navigation grid\n * as a cell of the grid's first row, so the header and body share a single\n * composite tab stop and Arrow keys navigate between them. The active header\n * cell carries `tabindex=\"0\"` (others `-1`), reflects `data-highlighted` when\n * focused, and carries a 1-based `aria-colindex`.\n *\n * When a `[forDraggable]` shares the cell (a `[forTableColumnReorder]` row) the\n * cell still participates in that composite grid — `aria-colindex` and focus\n * activation stay on the cell — but it yields the host `tabindex`, the lift keys\n * and `data-highlighted` to the draggable, so the grid keeps a single tab stop\n * and `[forTableColumnReorder]` routes idle Arrow navigation and `F2` cell entry\n * across it. The cell keeps the two keys targeted at an entered widget: the `Tab` that\n * cycles between the cell's widgets and the `Escape` that returns focus from one.\n */\n@Directive({\n selector: '[forTableHeaderCell]',\n exportAs: 'forTableHeaderCell',\n host: {\n role: 'columnheader',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-colindex]': 'colIndex()',\n '[attr.data-column]': 'name()',\n '[attr.data-sticky]': \"sticky() ? (sticky() === 'end' ? 'end' : '') : null\",\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '(focus)': 'onFocus()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableHeaderCell {\n private readonly ctx = injectTableContext('ForTableHeaderCell');\n readonly #registration = injectTableRegistration('ForTableHeaderCell');\n\n /**\n * The header cell's host element (`role=\"columnheader\"`). Exposed so a descendant\n * `[forTableColumnResizer]` can resolve the enclosing cell through DI to measure its\n * base width — robust to `hostDirectives` composition, where the `[forTableHeaderCell]`\n * selector attribute is not reflected onto the wrapper's host element.\n */\n readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n readonly #host = this.el.nativeElement;\n\n /**\n * This header cell's element injector. Exposed so a declarative renderer stamping\n * header content from a projected `<ng-template>` (e.g. `ForTableBody`) can pass it\n * as `[ngTemplateOutletInjector]`, letting context-dependent primitives inside that\n * content resolve this cell and the table.\n */\n readonly injector = inject(Injector);\n\n /** Column identifier, reflected as `data-column`. Required by later phases (sort, resize, reorder). */\n readonly name = input.required<string>();\n\n readonly #labelEl = signal<HTMLElement | null>(null);\n\n /** Header cells are never disabled; exposed so the roving grid can treat them uniformly with data cells. */\n readonly #disabled = signal(false);\n\n /**\n * A co-located affordance (e.g. `[forTableSortHeader]`) that needs the header\n * cell to be a standalone `tabindex=\"0\"` tab stop whenever it is not part of the\n * body's roving composite grid — that is, in `mode=\"table\"`, or in a\n * column-reorder header row where the header does not join the roving grid. The\n * header cell is the single owner of the host `tabindex` — sibling directives\n * never bind it — so it reflects this intent instead of letting a second\n * `[tabindex]` binding fight it on the same element.\n */\n readonly #standaloneTabStop = signal<Signal<boolean> | null>(null);\n\n /**\n * Registers an intent that makes this header cell a `tabindex=\"0\"` tab stop when\n * it is not participating in the roving composite grid. Called by\n * `[forTableSortHeader]` so the two never bind `[tabindex]` on the same host.\n */\n registerStandaloneTabStop(active: Signal<boolean>): void {\n this.#standaloneTabStop.set(active);\n }\n\n /** Clears a previously registered standalone tab-stop intent. Reference-based. */\n unregisterStandaloneTabStop(active: Signal<boolean>): void {\n if (this.#standaloneTabStop() === active) {\n this.#standaloneTabStop.set(null);\n }\n }\n\n /**\n * The element a descendant `[forTableColumnLabel]` marks as this column's label\n * text, or `null` when no marker is present. A sibling `[forTableColumnResizer]`\n * reads it to measure the header label for header-inclusive auto-fit, isolating\n * the label from the resize handle / sort affordance without DOM assumptions.\n */\n readonly labelEl = this.#labelEl.asReadonly();\n\n /** Registers a descendant `[forTableColumnLabel]` as this header cell's label element. */\n registerLabel(el: HTMLElement): void {\n this.#labelEl.set(el);\n }\n\n /** Unregisters the label element. Reference-based; safe to call if never registered. */\n unregisterLabel(el: HTMLElement): void {\n if (this.#labelEl() === el) {\n this.#labelEl.set(null);\n }\n }\n\n /**\n * Sticky placement for this header cell. `true` (or the bare `sticky`\n * attribute) pins to the start edge; `'end'` pins to the end edge; `false`\n * (default) is not sticky. The consumer applies `position: sticky` and the\n * appropriate `top` / `left` / `right` offset in CSS — this input only\n * provides the `data-sticky` hook.\n */\n readonly sticky = input(false as TableStickyValue, { transform: coerceSticky });\n\n /** `true` when a `[forDraggable]` shares this cell and owns its host `tabindex` / lift keys instead. */\n readonly #yieldsToDraggable = injectHostCarriesDragItem(this.#host);\n\n /**\n * `true` when this header row joins the body's composite roving grid (`grid` /\n * `treegrid` mode with a complete header row). A draggable header cell\n * (`[forTableColumnReorder]`) still participates — it carries `aria-colindex`\n * and activates the roving cell on focus — even though it yields the host\n * `tabindex`, keydown, and `data-highlighted` to its co-located `[forDraggable]`.\n */\n readonly #participates = computed(() => this.ctx.headerParticipatesInRoving());\n\n /** `true` when this cell owns its host `tabindex` / keydown as a plain roving grid cell (no draggable). */\n readonly #inRovingGrid = computed(() => !this.#yieldsToDraggable() && this.#participates());\n\n private readonly tabindex = computed<0 | -1 | null>(() => {\n if (this.#yieldsToDraggable()) {\n return null;\n }\n if (this.#inRovingGrid()) {\n return this.ctx.headerCellTabIndex(this.#host);\n }\n return this.#standaloneTabStop()?.() ? 0 : null;\n });\n\n private readonly colIndex = computed<number | null>(() =>\n this.#participates() ? this.ctx.headerCellIndexOf(this.#host) + 1 : null,\n );\n\n private readonly highlighted = computed(\n () =>\n !this.#yieldsToDraggable() && this.#participates() && this.ctx.isCellHighlighted(this.#host),\n );\n\n constructor() {\n const handle: ForTableCellHandle = { host: this.#host, disabled: this.#disabled };\n registerHandle(\n handle,\n (h) => this.#registration.registerHeaderCell(h),\n (h) => this.#registration.unregisterHeaderCell(h),\n );\n injectPointerMove(() => this.#onPointerMove());\n }\n\n #onPointerMove(): void {\n if (this.#participates()) {\n this.ctx.highlightFromPointer(this.#host);\n }\n }\n\n private onFocus(): void {\n if (this.#participates()) {\n this.ctx.activateCell(this.#host);\n }\n }\n\n /**\n * A plain roving grid cell resolves the whole grid keymap. A cell that yields to a\n * co-located `[forDraggable]` gets every key targeted at the cell itself — Arrow / Home /\n * End / Page and the `F2` that enters the cell — from `[forTableColumnReorder]`'s capture\n * listener, and its `Space` / `Enter` from the draggable's lift and the sort activation.\n * What is left are the two keys that listener cannot see, both targeted at an entered\n * widget rather than at a header cell: the `Tab` that cycles between the cell's widgets\n * and the `Escape` that returns focus from one. A lift in progress (`data-dragging`) owns\n * every key.\n *\n * `Tab` is therefore routed only while it is targeted at a widget, never at the cell host,\n * where it is the ordinary tab stop out of the grid and routing it would put a whole grid\n * keymap resolution — `clearPending()` on the virtual row navigation included — behind a key\n * this cell has nothing to do with. It is also the one key exempt from the `defaultPrevented`\n * bail: an ancestor `FocusTrap` handles `Tab` from a `document` capture listener, so it runs\n * *before* this one and has already prevented the default whenever the entered widget sits on\n * one of the trap's edges. Bailing there would leave the cycle silently absent inside every\n * dialog, and the cell's own `preventDefault` + focus move is what settles where focus lands.\n */\n private onKeyDown(event: KeyboardEvent): void {\n if (this.#inRovingGrid()) {\n this.ctx.handleCellKeydown(event, this.#host);\n return;\n }\n const escape = event.key === 'Escape' && !isImeComposing(event);\n if (!escape && !(event.key === 'Tab' && event.target !== this.#host)) {\n return;\n }\n if (\n !this.#yieldsToDraggable() ||\n !this.#participates() ||\n (escape && event.defaultPrevented) ||\n this.#host.hasAttribute('data-dragging')\n ) {\n return;\n }\n this.ctx.handleHeaderCellKeydown(event, this.#host);\n }\n}\n","import { computed, inject, type Signal } from '@angular/core';\n\nimport { FOR_TABLE_CONTEXT, injectTableContext } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/**\n * The `tabindex` an interactive control placed inside a table cell carries: `0` in\n * `mode=\"table\"`, where each control is its own tab stop, and `-1` in `grid` /\n * `treegrid`, where the control yields to the grid's single tab stop and is reached\n * through cell entry (`Enter` / `F2`). A control in a header cell answers `0` in a grid\n * too while the header row does not join it (an incomplete header row), since no cell\n * entry can reach it there. Outside a `[forTable]` it answers `0`, so a control that\n * also renders outside tables can bind it unconditionally.\n *\n * Must be called in an injection context. Bind the result as `[attr.tabindex]` on\n * a natively focusable element.\n */\nexport function injectTableCellTabIndex(): Signal<0 | -1> {\n const table = inject(FOR_TABLE_CONTEXT, { optional: true });\n const header = inject(ForTableHeaderCell, { optional: true })\n ? injectTableContext('injectTableCellTabIndex')\n : null;\n return computed(() => {\n if (!table || table.mode() === 'table') {\n return 0;\n }\n return header && !header.headerParticipatesInRoving() ? 0 : -1;\n });\n}\n","const INTERACTIVE_ROLES = [\n 'button',\n 'link',\n 'checkbox',\n 'radio',\n 'switch',\n 'tab',\n 'menuitem',\n 'menuitemcheckbox',\n 'menuitemradio',\n 'option',\n 'textbox',\n 'searchbox',\n 'combobox',\n 'slider',\n 'spinbutton',\n 'treeitem',\n];\n\nconst INTERACTIVE_DESCENDANT_SELECTOR = /* @__PURE__ */ [\n 'button',\n 'a[href]',\n 'input',\n 'select',\n 'textarea',\n 'summary',\n 'label',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable=\"true\"]',\n '[contenteditable=\"\"]',\n '[contenteditable=\"plaintext-only\"]',\n ...INTERACTIVE_ROLES.map((role) => `[role=\"${role}\"]`),\n].join(', ');\n\n/**\n * Whether `event` originated from an interactive element nested inside the element\n * whose listener received it (`event.currentTarget`, typically a row): a `button`,\n * `a[href]`, `input`, `select`, `textarea`, `summary`, `label`,\n * `audio`/`video[controls]`, an editable `contenteditable` region (`\"\"` / `\"true\"` /\n * `\"plaintext-only\"`, but not `\"false\"`), or an element carrying an interactive ARIA\n * `role`. A click on cell text, the gaps between cells, or the listening element\n * itself reports `false`.\n *\n * The table's own row activation, row-click selection and sort headers use this definition\n * to leave a click or `Enter` to the inner control that owns it; call it from a row listener\n * of your own to skip the same events.\n */\nexport function eventFromInteractiveDescendant(event: Event): boolean {\n const rowEl = event.currentTarget;\n return rowEl instanceof HTMLElement && isInteractiveDescendant(event.target, rowEl);\n}\n\nexport function isInteractiveDescendant(target: EventTarget | null, container: Element): boolean {\n if (!(target instanceof Element)) {\n return false;\n }\n const interactive = target.closest(INTERACTIVE_DESCENDANT_SELECTOR);\n return interactive !== null && interactive !== container && container.contains(interactive);\n}\n","import {\n computed,\n DestroyRef,\n ElementRef,\n inject,\n Injectable,\n InjectionToken,\n type Provider,\n type Signal,\n} from '@angular/core';\n\nimport { boundEntries, Collection, fortyError } from 'forty-cdk/core';\n\nimport type {\n ForTableColumnDef,\n ForTableColumnDragPlaceholder,\n ForTablePlaceholderCellDefault,\n} from './column-def';\nimport type { ForTableRowDef } from './row-def';\n\n/**\n * The def registry a `<for-table-body>` renders from — the seam that lets a\n * **scaffold wrapper** own the table shell while its consumers keep declaring\n * plain `[forTableColumnDef]` / `[forTableRowDef]` blocks.\n *\n * Defs discover their registry through DI at construction, and element DI follows\n * the **declaration** tree: a def projected through a wrapper's `<ng-content>` is\n * a child of the wrapper's host, not of the `<for-table-body>` inside the\n * wrapper's template, so it never sees the body's own registry. A wrapper\n * therefore provides its own registry with `provideForTableDefRegistry()` and\n * hands it to its inner body through `[defs]`; projected defs register with it,\n * and the body renders them exactly as if they had been declared inside its own\n * tags. See the table README for the full recipe.\n *\n * A **preset column component** (`<my-text-column name=\"code\" …>` collapsing a\n * column's header / data templates into one line) needs none of this: the preset\n * host is declared inside the body's tags, so the def in the preset's view\n * resolves the body's registry through the element-injector chain.\n *\n * The read members here are the whole public surface. How defs wire themselves\n * into a registry is a separate, unexported protocol, so the library keeps\n * refactoring it; the only supported implementation is the one\n * `provideForTableDefRegistry()` installs, and `<for-table-body>` rejects any\n * other value bound to `[defs]`.\n */\nexport interface ForTableDefRegistry {\n /**\n * The `name` of every registered `[forTableColumnDef]`, in document order — the\n * default column order a bound `<for-table-body>` renders. A wrapper can seed\n * its own `[displayedColumns]` from it (say, to move a fixed action column to\n * the end) without knowing which defs its consumer projected.\n *\n * Reading it resolves each def's `name` input, and a def whose binding is not\n * written yet is left out, so read it from a template, a `computed`, or an\n * `afterNextRender` — not from a constructor, where the projected defs' inputs\n * are not bound yet and the list would come back short.\n */\n readonly columnNames: Signal<readonly string[]>;\n}\n\nexport const FOR_TABLE_DEF_REGISTRY = new InjectionToken<ForTableDefRegistry>(\n 'FOR_TABLE_DEF_REGISTRY',\n);\n\n/**\n * One registered def paired with the DOM node that positions it — the comment\n * anchor of its `<ng-container>`, or the element it sits on. The node orders the\n * registry in document position, so a def declared inside a preset component's\n * view (which constructs after every directly declared def) still renders in its\n * authored place.\n */\nexport interface TableDefHandle<D> {\n /**\n * The def's host node — the comment anchor of its `<ng-container>` /\n * `<ng-template>`, or the element it sits on.\n */\n readonly host: Node;\n /** The registered def instance. */\n readonly def: D;\n}\n\n/**\n * The def-registration protocol: how the four declarative pieces wire themselves\n * into the registry a `<for-table-body>` reads. Kept off\n * {@link ForTableDefRegistry} — this is the surface the library refactors, and\n * nothing outside `forty-cdk/table` needs to call it.\n */\nexport interface TableDefRegistration {\n /** Whether nothing at all has registered — the body's guard against defs registered on the wrong registry. */\n readonly isEmpty: Signal<boolean>;\n /** Registers a column def. */\n registerColumnDef(handle: TableDefHandle<ForTableColumnDef>): void;\n /** Unregisters a column def. Reference-based. */\n unregisterColumnDef(handle: TableDefHandle<ForTableColumnDef>): void;\n /** Registers a row variant def. */\n registerRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void;\n /** Unregisters a row variant def. Reference-based. */\n unregisterRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void;\n /** Registers the shared column drag placeholder template. */\n registerColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void;\n /** Unregisters the shared column drag placeholder template. Reference-based. */\n unregisterColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void;\n /** Registers the body-level default placeholder-cell template. */\n registerPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void;\n /** Unregisters the body-level default placeholder-cell template. Reference-based. */\n unregisterPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void;\n}\n\n/** A registered column def whose `name` binding is written, with the name it was read with. */\nexport interface BoundColumnDef {\n readonly def: ForTableColumnDef;\n readonly name: string;\n}\n\n/** A registered row variant def whose `when` binding is written, with the predicate it was read with. */\nexport interface BoundRowDef {\n readonly def: ForTableRowDef<unknown>;\n readonly when: (row: unknown, index: number) => boolean;\n}\n\nexport const TABLE_DEF_REGISTRATION = new InjectionToken<TableDefRegistration>(\n 'TABLE_DEF_REGISTRATION',\n);\n\n/**\n * Owns the registered declarative defs of one `<for-table-body>`, exposing them\n * in document order.\n *\n * Document order (rather than construction order) is what keeps the seam a\n * drop-in replacement for the content queries it replaces: a def inside a preset\n * component's view constructs after every directly declared def, an `@if`-mounted\n * def constructs whenever it mounts, and a `@for`-reordered set of defs moves its\n * nodes without re-running constructors. `Collection` resolves all three from the\n * handles' host nodes.\n */\n@Injectable()\nexport class TableDefRegistry implements ForTableDefRegistry, TableDefRegistration {\n readonly #columns = new Collection<TableDefHandle<ForTableColumnDef>>();\n readonly #rowDefs = new Collection<TableDefHandle<ForTableRowDef<unknown>>>();\n readonly #dragPlaceholders = new Collection<TableDefHandle<ForTableColumnDragPlaceholder>>();\n readonly #placeholderDefaults = new Collection<TableDefHandle<ForTablePlaceholderCellDefault>>();\n\n /**\n * Registered column defs, in document order.\n *\n * A def registers in its view's **creation** pass but has its `name` bound in\n * that view's **update** pass, and for a def declared in a preset component's\n * view those two passes straddle the body's own render — so a def is held back\n * until its name can be read. Reading the unwritten input tracks it, so the\n * binding's write folds the def in. See `unsetInput`.\n */\n readonly columnDefs: Signal<readonly BoundColumnDef[]> = computed(() =>\n boundEntries(\n this.#columns.items().map((handle) => handle.def),\n (def) => def.name(),\n ).map(({ handle: def, value: name }) => ({ def, name })),\n );\n\n /**\n * Registered row variant defs, in document order (first match wins per datum).\n * Held back until the def's `when` predicate can be read, exactly like\n * {@link columnDefs}.\n */\n readonly rowDefs: Signal<readonly BoundRowDef[]> = computed(() =>\n boundEntries(\n this.#rowDefs.items().map((handle) => handle.def),\n (def) => def.when(),\n ).map(({ handle: def, value: when }) => ({ def, when })),\n );\n\n /** The shared column drag placeholder (the first in document order), or `null`. */\n readonly columnDragPlaceholder: Signal<ForTableColumnDragPlaceholder | null> = computed(\n () => this.#dragPlaceholders.items()[0]?.def ?? null,\n );\n\n /** The body-level default placeholder-cell template (the first in document order), or `null`. */\n readonly placeholderCellDefault: Signal<ForTablePlaceholderCellDefault | null> = computed(\n () => this.#placeholderDefaults.items()[0]?.def ?? null,\n );\n\n /** The `name` of every registered column def, in document order. */\n readonly columnNames: Signal<readonly string[]> = computed(() =>\n this.columnDefs().map((column) => column.name),\n );\n\n /** Whether no def of any kind is registered. */\n readonly isEmpty: Signal<boolean> = computed(\n () =>\n this.#columns.items().length === 0 &&\n this.#rowDefs.items().length === 0 &&\n this.#dragPlaceholders.items().length === 0 &&\n this.#placeholderDefaults.items().length === 0,\n );\n\n /** Registers a column def so it joins the rendered columns at its document position. */\n registerColumnDef(handle: TableDefHandle<ForTableColumnDef>): void {\n this.#columns.register(handle);\n }\n\n /** Unregisters a column def. Reference-based. */\n unregisterColumnDef(handle: TableDefHandle<ForTableColumnDef>): void {\n this.#columns.unregister(handle);\n }\n\n /** Registers a row variant def so its matched data rows render the variant. */\n registerRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void {\n this.#rowDefs.register(handle);\n }\n\n /** Unregisters a row variant def. Reference-based. */\n unregisterRowDef(handle: TableDefHandle<ForTableRowDef<unknown>>): void {\n this.#rowDefs.unregister(handle);\n }\n\n /** Registers the shared drag placeholder stamped into every reorderable header cell. */\n registerColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void {\n this.#dragPlaceholders.register(handle);\n }\n\n /** Unregisters the shared column drag placeholder. Reference-based. */\n unregisterColumnDragPlaceholder(handle: TableDefHandle<ForTableColumnDragPlaceholder>): void {\n this.#dragPlaceholders.unregister(handle);\n }\n\n /** Registers the default placeholder-cell template columns fall back to. */\n registerPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void {\n this.#placeholderDefaults.register(handle);\n }\n\n /** Unregisters the default placeholder-cell template. Reference-based. */\n unregisterPlaceholderCellDefault(handle: TableDefHandle<ForTablePlaceholderCellDefault>): void {\n this.#placeholderDefaults.unregister(handle);\n }\n}\n\n/**\n * The provider set installing a def registry on a host: the registry itself, the\n * public {@link FOR_TABLE_DEF_REGISTRY} read token, and the internal\n * registration protocol the declarative defs resolve.\n *\n * `<for-table-body>` declares it so defs declared inside its own tags register\n * with it. A **scaffold wrapper** declares it too, so defs its consumers project\n * through `<ng-content>` reach a registry at all, and binds\n * `inject(FOR_TABLE_DEF_REGISTRY)` to its inner body's `[defs]`.\n */\nexport function provideForTableDefRegistry(): Provider[] {\n return [\n TableDefRegistry,\n { provide: FOR_TABLE_DEF_REGISTRY, useExisting: TableDefRegistry },\n { provide: TABLE_DEF_REGISTRATION, useExisting: TableDefRegistry },\n ];\n}\n\n/**\n * Resolves the registry `<for-table-body>`'s own `providers` install.\n *\n * The lookup is optional only so the failure can be reported in the library's own\n * vocabulary: {@link TableDefRegistry} is absent from every barrel, so\n * a bare `NG0201: No provider found for _TableDefRegistry` names a symbol the\n * consumer cannot import and suggests no repair. The only shape that reaches it is\n * a subclass declaring its own `@Component` — Angular replaces the inherited\n * `providers` array wholesale — which is not a supported way to wrap the body.\n */\nexport function injectOwnTableDefRegistry(): TableDefRegistry {\n const registry = inject(TableDefRegistry, { optional: true });\n if (!registry) {\n throw fortyError({\n code: 'FORCDK-TABLE-001',\n message: '<for-table-body> found no def registry of its own.',\n cause:\n 'A subclass declaring its own @Component replaces the providers it would have inherited. ' +\n 'Subclassing the body is not a supported wrapping shape anyway, because a subclass ' +\n 'inherits no template either.',\n fix:\n \"Compose <for-table-body> inside a wrapper's template, and give the wrapper its own \" +\n \"provideForTableDefRegistry() bound to the body's [defs].\",\n });\n }\n return registry;\n}\n\nfunction injectTableDefRegistration(piece: string): TableDefRegistration {\n const registration = inject(TABLE_DEF_REGISTRATION, { optional: true });\n if (!registration) {\n throw fortyError({\n code: 'FORCDK-TABLE-002',\n message: `${piece} must be used inside a <for-table-body>.`,\n cause: `No TABLE_DEF_REGISTRATION provider is visible from ${piece}.`,\n fix:\n `Move ${piece} inside a <for-table-body>, or into a component that provides ` +\n \"provideForTableDefRegistry() and binds that registry to a body's [defs].\",\n });\n }\n return registration;\n}\n\nfunction injectDefHost(): Node {\n return inject<ElementRef<Node>>(ElementRef).nativeElement;\n}\n\n/**\n * Registers a `[forTableColumnDef]` with the surrounding registry for the def's\n * lifetime. Call it from the def's constructor — it resolves the registry, the\n * host node, and the `DestroyRef` from the ambient injection context.\n */\nexport function registerTableColumnDef(def: ForTableColumnDef): void {\n const registration = injectTableDefRegistration('ForTableColumnDef');\n const handle: TableDefHandle<ForTableColumnDef> = { host: injectDefHost(), def };\n registration.registerColumnDef(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterColumnDef(handle));\n}\n\n/**\n * Registers a `[forTableRowDef]` with the surrounding registry for the def's\n * lifetime, type-erased over the def's row type — the same erasure the\n * `contentChildren(ForTableRowDef)` query performed implicitly before defs registered\n * themselves. The body only ever matches a def against data from the same `rows`\n * input, so the erasure is sound.\n */\nexport function registerTableRowDef<T>(def: ForTableRowDef<T>): void {\n const registration = injectTableDefRegistration('ForTableRowDef');\n const handle: TableDefHandle<ForTableRowDef<unknown>> = {\n host: injectDefHost(),\n def: def as unknown as ForTableRowDef<unknown>,\n };\n registration.registerRowDef(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterRowDef(handle));\n}\n\n/**\n * Registers a `[forTableColumnDragPlaceholder]` with the surrounding registry for the\n * template's lifetime.\n */\nexport function registerTableColumnDragPlaceholder(def: ForTableColumnDragPlaceholder): void {\n const registration = injectTableDefRegistration('ForTableColumnDragPlaceholder');\n const handle: TableDefHandle<ForTableColumnDragPlaceholder> = { host: injectDefHost(), def };\n registration.registerColumnDragPlaceholder(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterColumnDragPlaceholder(handle));\n}\n\n/**\n * Registers a `[forTablePlaceholderCellDefault]` with the surrounding registry for the\n * template's lifetime.\n */\nexport function registerTablePlaceholderCellDefault(def: ForTablePlaceholderCellDefault): void {\n const registration = injectTableDefRegistration('ForTablePlaceholderCellDefault');\n const handle: TableDefHandle<ForTablePlaceholderCellDefault> = { host: injectDefHost(), def };\n registration.registerPlaceholderCellDefault(handle);\n inject(DestroyRef).onDestroy(() => registration.unregisterPlaceholderCellDefault(handle));\n}\n\n/**\n * Narrows a `[defs]`-bound registry to the library's own implementation. The\n * registration protocol is not public, so a hand-rolled `ForTableDefRegistry` has\n * no way to receive registrations — binding one is an authoring error, not a\n * supported extension point.\n */\nexport function assertTableDefRegistry(registry: ForTableDefRegistry): TableDefRegistry {\n if (!(registry instanceof TableDefRegistry)) {\n throw fortyError({\n code: 'FORCDK-TABLE-003',\n message: '<for-table-body> [defs] was bound to a value that is not a library def registry.',\n cause:\n 'The registration protocol is not public, so a hand-rolled ForTableDefRegistry has no way ' +\n 'to receive registrations.',\n fix: 'Bind [defs] to the registry provideForTableDefRegistry() installs.',\n });\n }\n return registry;\n}\n","import {\n booleanAttribute,\n contentChild,\n Directive,\n inject,\n input,\n TemplateRef,\n type InputSignal,\n} from '@angular/core';\n\nimport { assertInputBound, fortyError, unsetInput, type Unset } from 'forty-cdk/core';\n\nimport {\n registerTableColumnDef,\n registerTableColumnDragPlaceholder,\n registerTablePlaceholderCellDefault,\n} from './def-registry';\nimport {\n assertColumnName,\n assertColumnTrack,\n coerceSticky,\n type TableStickyValue,\n} from './table-context';\n\n/**\n * Template context handed to each `[forTableCellDef]` stamped by `ForTableBody`:\n * the row datum (`let-row`) and its 0-based dataset index (`let-i=\"index\"`).\n */\nexport interface ForTableCellDefContext<T> {\n /** The row datum for this cell (`let-row`). */\n $implicit: T;\n /**\n * 0-based dataset index of the row (`let-i=\"index\"`). In a non-virtualized\n * table this equals the row's rendered position; under `[forTableVirtualized]`\n * it is the **absolute** index into the full dataset, not the position within\n * the rendered window.\n */\n index: number;\n}\n\n/**\n * Marks the header-cell template of a column definition. Place on an\n * `<ng-template forTableHeaderCellDef>` inside a `[forTableColumnDef]`; its content is\n * stamped into the column's `[forTableHeaderCell]` by `ForTableBody`.\n */\n@Directive({ selector: 'ng-template[forTableHeaderCellDef]' })\nexport class ForTableHeaderCellDef {\n /** The captured header-cell template. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n}\n\n/**\n * Marks the data-cell template of a column definition. Place on an\n * `<ng-template forTableCellDef>` inside a `[forTableColumnDef]`; its content is stamped\n * into the column's `[forTableCell]` for every rendered row, with the row datum\n * and index exposed through `ForTableCellDefContext`.\n *\n * Bind `[forTableCellDefRow]` to the same array passed to `ForTableBody`'s `rows`\n * to type `let-row` — the input is read only for type inference, never at\n * runtime.\n *\n * When the row type is a discriminated union whose variant members render\n * through a `[forTableRowDef]` instead of the per-column cells, bind\n * `[forTableCellDefUnless]` to the same type guard(s) used on those defs' `[when]`\n * so `let-row` is narrowed to the variant-excluded members (`Exclude<T, V>`).\n */\n@Directive({ selector: 'ng-template[forTableCellDef]' })\nexport class ForTableCellDef<T, V extends T = never> {\n /** The captured data-cell template, typed with `ForTableCellDefContext<T>`. */\n readonly template = inject<TemplateRef<ForTableCellDefContext<T>>>(TemplateRef);\n\n /**\n * Type-inference hint: bind to the same collection as `ForTableBody`'s `rows`\n * so `let-row` is typed as the row type. Read only by the compiler; the\n * directive never touches its value.\n */\n readonly rowType = input<readonly T[]>([], { alias: 'forTableCellDefRow' });\n\n /**\n * Type-inference hint: bind the type guard(s) that match the variant rows\n * rendered by `[forTableRowDef]` (the same predicate used on their `[when]`) so\n * `let-row` is narrowed to `Exclude<T, V>` — the members this per-column\n * template actually receives. Compose several variants into one union guard\n * (`(r): r is A | B => …`). Read only by the compiler; the directive never\n * touches its value. Omitting it leaves `let-row` typed as the full `T`.\n */\n readonly excludeType = input<((row: T, index: number) => row is V) | null>(null, {\n alias: 'forTableCellDefUnless',\n });\n\n /** Narrows the template context type for `let-row` under strict template checking. */\n static ngTemplateContextGuard<T, V extends T>(\n _directive: ForTableCellDef<T, V>,\n _context: unknown,\n ): _context is ForTableCellDefContext<Exclude<T, V>> {\n return true;\n }\n}\n\n/**\n * Marks the placeholder/skeleton template of a column definition. Optional;\n * place on an `<ng-template forTablePlaceholderCellDef>` inside a `[forTableColumnDef]`. When\n * `ForTableBody` is in its `loading` state it stamps this into the column's\n * `[forTableCell]` for each placeholder row.\n *\n * It is the first step of a three-step resolution: a column's own\n * `[forTablePlaceholderCellDef]` wins, else the body-level\n * `[forTablePlaceholderCellDefault]`, else the cell stays empty.\n */\n@Directive({ selector: 'ng-template[forTablePlaceholderCellDef]' })\nexport class ForTablePlaceholderCellDef {\n /** The captured placeholder-cell template. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n}\n\n/**\n * Marks the **body-level default** placeholder/skeleton template. Optional and\n * declared **once per body** (not per column); place on an\n * `<ng-template forTablePlaceholderCellDefault>` among the `[forTableColumnDef]`s.\n * `ForTableBody` stamps it into every displayed column that declares no\n * `[forTablePlaceholderCellDef]` of its own — most columns of a table share one skeleton\n * shape, so it is declared once rather than repeated per def.\n *\n * Resolution order per column, in both stamping paths (`[loading]` placeholder\n * rows and `placeholderCells` row variants): the column's own\n * `[forTablePlaceholderCellDef]` → this default → an empty cell when neither exists.\n * The template receives no context, exactly like `[forTablePlaceholderCellDef]`.\n *\n * It registers itself with the surrounding body's def registry at construction,\n * so a wrapping component can declare it (or project it) — see\n * {@link ForTableDefRegistry}. Declared outside any registry it throws.\n */\n@Directive({ selector: 'ng-template[forTablePlaceholderCellDefault]' })\nexport class ForTablePlaceholderCellDefault {\n /** The captured default placeholder-cell template. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n\n constructor() {\n registerTablePlaceholderCellDefault(this);\n }\n}\n\n/**\n * Marks the shared drag placeholder for the reorderable columns of a\n * `<for-table-body>`. Optional and declared **once per body** (not per column);\n * place on an `<ng-template forTableColumnDragPlaceholder>` among the `[forTableColumnDef]`s.\n * `ForTableBody` stamps it as every reorderable header cell's\n * `[forDragPlaceholder]`, so during a pointer reorder the dragged column's slot\n * shows this template. Omit it to keep drag-drop's default placeholder behaviour.\n *\n * It registers itself with the surrounding body's def registry at construction,\n * so a wrapping component can declare it (or project it) — see\n * {@link ForTableDefRegistry}. Declared outside any registry it throws.\n */\n@Directive({ selector: 'ng-template[forTableColumnDragPlaceholder]' })\nexport class ForTableColumnDragPlaceholder {\n /** The captured placeholder template rendered in a reordered column's slot. */\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n\n constructor() {\n registerTableColumnDragPlaceholder(this);\n }\n}\n\n/**\n * Declarative definition of a single table column, co-locating its header,\n * data, and (optional) placeholder templates plus its per-column config in one\n * place. Place `[forTableColumnDef]` on an `<ng-container>` inside a `<for-table-body>`;\n * the container renders nothing itself — `ForTableBody` harvests the defs and\n * stamps the header row and data rows from them.\n *\n * The def **registers itself** with the surrounding body through DI at\n * construction (and unregisters when destroyed), so it does not have to be\n * declared content of the `<for-table-body>` element: a preset column component\n * may declare it in its own view, and a scaffold wrapper may project it into a\n * body it owns. See {@link ForTableDefRegistry} for both recipes. A def with no\n * reachable registry throws.\n *\n * @example\n * ```html\n * <ng-container forTableColumnDef=\"name\" sticky sortable resizable resizeAriaLabel=\"Resize name\">\n * <ng-template forTableHeaderCellDef>Name</ng-template>\n * <ng-template forTableCellDef [forTableCellDefRow]=\"rows()\" let-row>{{ row.name }}</ng-template>\n * </ng-container>\n * ```\n */\n@Directive({ selector: '[forTableColumnDef]' })\nexport class ForTableColumnDef {\n /**\n * Column identifier — reflected as `data-column` on the stamped cells and used to key the resize\n * width var. Mandatory — an unbound def throws in dev mode.\n */\n readonly name: InputSignal<string | Unset> = input(unsetInput<string>(), {\n alias: 'forTableColumnDef',\n });\n\n /**\n * Sticky placement forwarded to both the header cell and every data cell:\n * `true` (or the bare `sticky` attribute) pins to the start edge, `'end'` to\n * the end edge, `false` (default) is not sticky. The consumer applies\n * `position: sticky` + offsets in CSS off the emitted `data-sticky` hook.\n */\n readonly sticky = input(false as TableStickyValue, { transform: coerceSticky });\n\n /**\n * When set, the column's header cell becomes a sortable affordance: `ForTableBody`\n * applies `[forTableSortHeader]`, derives its direction from the body's `sort`\n * input, and re-emits activation through the body's `sortChange` output.\n */\n readonly sortable = input(false, { transform: booleanAttribute });\n\n /**\n * When set, `ForTableBody` renders a `[forTableColumnResizer]` inside the column's\n * header cell and re-emits its commits through the body's `resizeCommit` output.\n * Provide `resizeAriaLabel` so the handle is named. Tune the handle per column with\n * `resizeMin` / `resizeMax` / `resizeStep` / `resizeLargeStep` / `resizeDisabled` /\n * `autoFit` / `fitIncludesHeader`, and seed / track its width through the body's\n * `[(columnWidths)]`.\n */\n readonly resizable = input(false, { transform: booleanAttribute });\n\n /**\n * When set, the column's header cell becomes a drag-reorder handle: with at least\n * one `reorderable` column, `ForTableBody` applies `[forTableColumnReorder]` to the\n * stamped header row and `[forDraggable]` (with `[dragData]` set to this column's\n * `name`) to this header cell, and re-emits committed reorders through the body's\n * `columnReorder` output. Non-reorderable columns stay static (not draggable).\n * The body bundles `forty-cdk/drag-drop` whether or not a column is `reorderable`\n * (a measured 18.0 kB raw / 5.1 kB gzip — see the table README's bundle note).\n */\n readonly reorderable = input(false, { transform: booleanAttribute });\n\n /**\n * Accessible name for the auto-wired resize handle (only meaningful with\n * `resizable`). Supplied by the consumer so it is localizable; `null` (default)\n * ships no `aria-label`.\n */\n readonly resizeAriaLabel = input<string | null>(null);\n\n /**\n * Minimum width (px) the auto-wired resize handle clamps to (only meaningful with\n * `resizable`). Forwarded to the stamped `[forTableColumnResizer]`'s `min`; drives\n * its `aria-valuemin`. Default `0`.\n */\n readonly resizeMin = input<number>(0);\n\n /**\n * Maximum width (px) the auto-wired resize handle clamps to (only meaningful with\n * `resizable`). Forwarded to the stamped `[forTableColumnResizer]`'s `max`; drives\n * its `aria-valuemax` (omitted when non-finite). Default `Infinity` (no upper bound).\n */\n readonly resizeMax = input<number>(Infinity);\n\n /**\n * Pixels applied per `ArrowLeft` / `ArrowRight` press on the auto-wired resize\n * handle (only meaningful with `resizable`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `step`. Default `10`.\n */\n readonly resizeStep = input<number>(10);\n\n /**\n * Pixels applied per `Page Up` (shrink) / `Page Down` (grow) press on the auto-wired\n * resize handle (only meaningful with `resizable`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `largeStep`. Default `100`.\n */\n readonly resizeLargeStep = input<number>(100);\n\n /**\n * Freezes the auto-wired resize handle while keeping it rendered (only meaningful with\n * `resizable`). Forwarded to the stamped `[forTableColumnResizer]`'s `disabled`: the\n * handle leaves the tab order and ignores keyboard, pointer and double-click input, and\n * reflects `aria-disabled` / `data-disabled`. Default `false`.\n */\n readonly resizeDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * Whether double-clicking the auto-wired resize handle fits the column to its\n * widest content (only meaningful with `resizable`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `autoFit`. Default `true` — the historical\n * hardcoded behaviour; set `false` to make the double-click a no-op.\n */\n readonly autoFit = input(true, { transform: booleanAttribute });\n\n /**\n * Whether header-inclusive auto-fit also accounts for the column header's label\n * (only meaningful with `resizable` + `autoFit`). Forwarded to the stamped\n * `[forTableColumnResizer]`'s `fitIncludesHeader`; isolate the header text with a\n * `[forTableColumnLabel]` inside the `[forTableHeaderCellDef]` template. Default `false`.\n */\n readonly fitIncludesHeader = input(false, { transform: booleanAttribute });\n\n /**\n * `grid-template-columns` track fragment for this column (e.g. `'160px'`,\n * `'minmax(160px, 1fr)'`). When unset, `ForTableBody` falls back to the\n * published `--for-table-col-<name>-width` resize var with `fallbackWidth`\n * (or `minmax(0, 1fr)`) as the var's default, so a resized column drives its\n * own track. A static `width` **takes precedence** over that resize var — so\n * leave it unset on a `resizable` column whose width you drive through\n * `resizeCommit` or the body's `[(columnWidths)]`, otherwise the pinned track\n * ignores the resized width (the handle still reports `aria-valuenow` but the\n * column won't move). Dev-mode-guarded against fragments that would escape the\n * derived track string (see `fallbackWidth`).\n */\n readonly width = input<string | null>(null);\n\n /**\n * `grid-template-columns` track fragment used as the resize-var **fallback**\n * for a column with no explicit `width` — the track the column renders before\n * a width is committed or seeded (e.g. `'minmax(120px, 2.5fr)'` for a\n * weighted, floor-bounded fluid column). Unlike `width` it does not pin the\n * column, so the resizer (and the body's `[(columnWidths)]`) still drives it\n * and the first published width snaps the column to px. Ignored when `width`\n * is set. Defaults to `minmax(0, 1fr)`.\n *\n * Any open track vocabulary is accepted (`minmax()`, `fit-content()`,\n * `calc()`, `clamp()`, `var()`), but in dev mode a fragment that would escape\n * the derived `grid-template-columns` string throws instead of silently\n * collapsing the layout: an empty fragment (pass `null` to leave the track\n * unset), a `;` / `{` / `}` / quote / comment opener, or unbalanced\n * parentheses — a stray `)` here would close the enclosing `var(` early and\n * swallow the rest of the track.\n */\n readonly fallbackWidth = input<string | null>(null);\n\n /**\n * Static class(es) applied to this column's stamped `[forTableHeaderCell]`.\n * `ForTableBody` owns the header cell element, so this is the styling seam a\n * consumer (or wrapping design system) uses to reach it without scoping CSS to\n * the body's template internals. `null` (default) adds no class attribute.\n */\n readonly headerClass = input<string | null>(null);\n\n /**\n * Static class(es) applied to this column's stamped `[forTableCell]` on every\n * data **and** placeholder row. The styling seam for the cell box itself\n * (padding, truncation, alignment, sticky backgrounds) that `ForTableBody`\n * owns. Per-datum row styling is out of scope. `null` (default) adds no class\n * attribute.\n */\n readonly cellClass = input<string | null>(null);\n\n /**\n * The column's header-cell template. Mandatory — a displayed def without one throws in\n * dev mode.\n */\n readonly header = contentChild(ForTableHeaderCellDef);\n /**\n * The column's data-cell template. Mandatory — a displayed def without one throws in\n * dev mode.\n */\n readonly dataCell = contentChild(ForTableCellDef);\n /**\n * The column's optional placeholder-cell template. When absent, `ForTableBody`\n * falls back to its `[forTablePlaceholderCellDefault]`, then to an empty cell.\n */\n readonly placeholderCell = contentChild(ForTablePlaceholderCellDef);\n\n constructor() {\n assertInputBound(this.name, 'table', '[forTableColumnDef]', 'forTableColumnDef');\n registerTableColumnDef(this);\n }\n}\n\n/**\n * Dev-mode guard for one column definition: its header and data-cell templates,\n * its `name` (interpolated into the `--for-table-col-<name>-width` custom\n * property) and its `width` / `fallbackWidth` track fragments.\n *\n * Called from `ForTableBody`'s track builder — the point at which the values are\n * interpolated — rather than from an `effect` on the def, so the throw carries a\n * stack naming the render that would have produced the broken declaration and\n * no reactive node is created per def in a production build. It follows that\n * only a *displayed* column is checked, which is exactly the set whose values\n * reach CSS and whose templates are stamped.\n *\n * @param def The column definition to check.\n * @param name The def's bound name, as the registry resolved it.\n */\nexport function assertColumnDefConfig(def: ForTableColumnDef, name: string): void {\n if (typeof ngDevMode !== 'undefined' && !ngDevMode) {\n return;\n }\n const piece = `forTableColumnDef=\"${name}\"`;\n const missing = [\n def.header() ? null : '<ng-template forTableHeaderCellDef>',\n def.dataCell() ? null : '<ng-template forTableCellDef>',\n ].filter((template) => template !== null);\n if (missing.length > 0) {\n throw fortyError({\n code: 'FORCDK-TABLE-013',\n message: `${piece} declares no ${missing.join(' and no ')}.`,\n fix:\n 'Declare an <ng-template forTableHeaderCellDef> and an <ng-template forTableCellDef> ' +\n 'inside every [forTableColumnDef].',\n });\n }\n assertColumnName(name, 'ForTableColumnDef');\n const width = def.width();\n if (width !== null) {\n assertColumnTrack(width, 'width', piece);\n }\n const fallbackWidth = def.fallbackWidth();\n if (fallbackWidth !== null) {\n assertColumnTrack(fallbackWidth, 'fallbackWidth', piece);\n }\n}\n","import {\n booleanAttribute,\n contentChild,\n Directive,\n inject,\n input,\n TemplateRef,\n type InputSignal,\n} from '@angular/core';\n\nimport { assertInputBound, fortyError, unsetInput, type Unset } from 'forty-cdk/core';\n\nimport { type ForTableCellDefContext } from './column-def';\nimport { registerTableRowDef } from './def-registry';\n\n/**\n * Marks the content template of a full-span row variant. Place on an\n * `<ng-template forTableRowCellDef>` inside a `[forTableRowDef]`; its content is\n * stamped into a single cell that spans every column of the matched row, with the\n * row datum and its index exposed through `ForTableCellDefContext`.\n *\n * The spanning cell is presentational, so its template must **not** contain\n * interactive content (buttons, links, form controls) — the variant row stays\n * out of the grid's single-tab-stop roving order, so nested tabbables become\n * unreachable — nor a `[forTableCell]`, which would register a cell handle on\n * the variant row and make the roving grid ragged.\n *\n * Bind `[forTableRowCellDefRow]` to the same array passed to `ForTableBody`'s\n * `rows` to type `let-row` — the input is read only for type inference, never at\n * runtime.\n *\n * When the row type is a discriminated union, also bind `[forTableRowCellDefWhen]`\n * to the same type guard used on the def's `[when]` so `let-row` is narrowed to\n * the matched variant member (`V`) instead of staying the full union.\n */\n@Directive({ selector: 'ng-template[forTableRowCellDef]' })\nexport class ForTableRowCellDef<T, V extends T = T> {\n /** The captured row-variant template, typed with `ForTableCellDefContext<T>`. */\n readonly template = inject<TemplateRef<ForTableCellDefContext<T>>>(TemplateRef);\n\n /**\n * Type-inference hint: bind to the same collection as `ForTableBody`'s `rows`\n * so `let-row` is typed as the row type. Read only by the compiler; the\n * directive never touches its value.\n */\n readonly rowType = input<readonly T[]>([], { alias: 'forTableRowCellDefRow' });\n\n /**\n * Type-inference hint: bind the same type guard used on this def's `[when]`\n * so `let-row` is narrowed to the matched variant member (`V`). Read only by\n * the compiler; the directive never touches its value. Omitting it leaves\n * `let-row` typed as the full `T`.\n */\n readonly narrowType = input<((row: T, index: number) => row is V) | null>(null, {\n alias: 'forTableRowCellDefWhen',\n });\n\n /** Narrows the template context type for `let-row` under strict template checking. */\n static ngTemplateContextGuard<T, V extends T>(\n _directive: ForTableRowCellDef<T, V>,\n _context: unknown,\n ): _context is ForTableCellDefContext<V> {\n return true;\n }\n}\n\n/**\n * Declarative definition of a row variant for `<for-table-body>`. Place\n * `[forTableRowDef]` on an `<ng-container>` alongside the `[forTableColumnDef]`s and\n * bind a `[when]` predicate; for every datum the predicate matches, `ForTableBody`\n * renders this variant instead of the per-column data cells. A def comes in one of\n * two shapes, and must declare **exactly one** of them:\n *\n * - **Full-span** (a `[forTableRowCellDef]` template): the row's single cell spans every\n * column — group headers, section separators, summary or empty-state rows. It carries\n * the row's `role` plus `aria-colindex=\"1\"` and an `aria-colspan` equal to the column\n * count, but registers no cell handle, so roving arrow navigation steps over the row.\n * - **Placeholder cells** (the `placeholderCells` flag, no `[forTableRowCellDef]`): the row\n * stamps one cell per displayed column from each column's `[forTablePlaceholderCellDef]`\n * — skeleton rows for infinite-scroll or paginated tables. These keep the roving grid\n * rectangular, and are stamped disabled so arrow navigation steps over them.\n *\n * Either way the variant row is presentational and non-selectable — its `value` stays `undefined` —\n * while still occupying a row slot and counting towards `aria-rowindex` / `aria-rowcount`.\n *\n * When several defs match a datum the first in DOM order wins; a datum matched by none renders the\n * standard per-column row.\n *\n * Like `[forTableColumnDef]`, the def registers itself with the surrounding body through DI at\n * construction, so a preset component may declare it in its own view and a scaffold wrapper may\n * project it into a body it owns — see {@link ForTableDefRegistry}. A def with no reachable\n * registry throws.\n *\n * @example\n * ```html\n * <for-table-body [rows]=\"rows()\">\n * <ng-container forTableColumnDef=\"name\">\n * <ng-template forTableHeaderCellDef>Name</ng-template>\n * <ng-template forTableCellDef [forTableCellDefRow]=\"rows()\" let-row>{{ row.name }}</ng-template>\n * <ng-template forTablePlaceholderCellDef><span class=\"skeleton\"></span></ng-template>\n * </ng-container>\n *\n * <!-- full-span group header -->\n * <ng-container forTableRowDef [when]=\"isGroupHeader\">\n * <ng-template forTableRowCellDef [forTableRowCellDefRow]=\"rows()\" let-row>{{ row.group }}</ng-template>\n * </ng-container>\n *\n * <!-- per-column skeleton rows while the next page loads -->\n * <ng-container forTableRowDef [when]=\"isPlaceholder\" placeholderCells />\n * </for-table-body>\n * ```\n */\n@Directive({ selector: '[forTableRowDef]' })\nexport class ForTableRowDef<T> {\n /**\n * Predicate selecting which data rows render this variant instead of the\n * per-column row. Receives the datum and its 0-based dataset index and returns\n * `true` to render the variant. In a non-virtualized table the index equals\n * the row's rendered position; under `[forTableVirtualized]` it is the\n * **absolute** index into the full dataset. Evaluated for every datum on each\n * change-detection pass, so keep it cheap and free of side effects.\n *\n * Mandatory — an unbound def throws in dev mode.\n */\n readonly when: InputSignal<((row: T, index: number) => boolean) | Unset> =\n input(unsetInput<(row: T, index: number) => boolean>());\n\n /**\n * The variant's full-span content template. Present for a full-span def; absent\n * (and unused) when `placeholderCells` is set. A def must declare exactly one of\n * a `[forTableRowCellDef]` template or `placeholderCells` — the body validates this and\n * throws a `[forty-cdk/table]` error otherwise.\n */\n readonly cell = contentChild(ForTableRowCellDef);\n\n /**\n * Render this variant's matched rows as **per-column placeholder cells** instead\n * of a full-span `[forTableRowCellDef]`. Set it (the bare `placeholderCells` attribute)\n * for interleaved / trailing skeleton rows — infinite-scroll or paginated tables\n * that keep their loaded rows and append placeholder rows while the next page\n * loads. The body stamps one `[forTableCell]` per displayed column from that\n * column's `[forTablePlaceholderCellDef]` template (an empty cell when the column omits\n * it), exactly like the `loading` state, but stamps the cells disabled so\n * grid-mode arrow navigation steps over them and the roving grid stays\n * rectangular.\n *\n * A def must declare **exactly one** of a `[forTableRowCellDef]` template or\n * `placeholderCells`; declaring both or neither throws a `[forty-cdk/table]`\n * error in dev mode.\n */\n readonly placeholderCells = input(false, { transform: booleanAttribute });\n\n constructor() {\n assertInputBound(this.when, 'table', '[forTableRowDef]', 'when');\n registerTableRowDef(this);\n }\n}\n\n/**\n * Dev-mode guard for one row variant's config: a `[forTableRowDef]` declares\n * exactly one of a `[forTableRowCellDef]` template or `placeholderCells`.\n *\n * Called from `ForTableBody`'s row derivation, the point at which a variant is\n * matched against the data, so no reactive node is created per def in a\n * production build. A production build skips it: the variant row then renders\n * its placeholder cells when the flag is set, and an empty spanning cell when\n * neither is declared.\n *\n * @param def The row definition to check.\n */\nexport function assertRowDefConfig(def: ForTableRowDef<unknown>): void {\n if (typeof ngDevMode !== 'undefined' && !ngDevMode) {\n return;\n }\n const hasCell = def.cell() != null;\n const hasPlaceholder = def.placeholderCells();\n if (hasCell === hasPlaceholder) {\n throw fortyError({\n code: 'FORCDK-TABLE-005',\n message: `A [forTableRowDef] declares ${hasCell ? 'both' : 'neither'} of a [forTableRowCellDef] template and the placeholderCells flag.`,\n fix: 'Declare exactly one of the two on every [forTableRowDef].',\n });\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n} from '@angular/core';\n\nimport { type ForTableCellHandle, injectPointerMove, registerHandle } from 'forty-cdk/core';\nimport {\n coerceSticky,\n injectTableContext,\n injectTableRowRegistration,\n injectTableRowContext,\n type TableStickyValue,\n} from './table-context';\n\n/**\n * Marks a data cell. The `role` is derived from the root's `mode`: `'cell'` in\n * `table` mode and `'gridcell'` in `grid` / `treegrid` mode. In grid / treegrid\n * mode the cell is a roving-tabindex target — the single active cell carries\n * `tabindex=\"0\"` (others `-1`), reflects `data-highlighted` when focused, and\n * carries a 1-based `aria-colindex`. Arrow / Home / End / Ctrl+Home / Ctrl+End /\n * PageUp / PageDown move focus between cells, and `Enter` on a cell holding no widget\n * emits the root's `cellActivate`. Requires a `name` input that\n * identifies the column — reflected as `data-column`. Optionally sticky and\n * optionally disabled (disabled cells are skipped during navigation).\n */\n@Directive({\n selector: '[forTableCell]',\n exportAs: 'forTableCell',\n host: {\n '[attr.role]': 'role()',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-colindex]': 'colIndex()',\n '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n '[attr.data-column]': 'name()',\n '[attr.data-sticky]': \"sticky() ? (sticky() === 'end' ? 'end' : '') : null\",\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '(focus)': 'onFocus()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableCell {\n private readonly ctx = injectTableContext('ForTableCell');\n private readonly rowCtx = injectTableRowContext('ForTableCell');\n readonly #rowRegistration = injectTableRowRegistration('ForTableCell');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /**\n * This cell's element injector. Exposed so a declarative renderer stamping cell\n * content from a projected `<ng-template>` (e.g. `ForTableBody`) can pass it as\n * `[ngTemplateOutletInjector]`, letting row-context-dependent primitives inside\n * that content (`[forTableRowSelector]`, …) resolve their `[forTableRow]`.\n */\n readonly injector = inject(Injector);\n\n private readonly role = computed(() => (this.ctx.mode() === 'table' ? 'cell' : 'gridcell'));\n\n /** Column identifier, reflected as `data-column`. Required by later phases (sort, resize, reorder). */\n readonly name = input.required<string>();\n\n /**\n * Sticky placement for this data cell. `true` (or the bare `sticky` attribute)\n * pins to the start edge; `'end'` pins to the end edge; `false` (default) is not\n * sticky. The consumer applies `position: sticky` and the offsets in CSS — this\n * input only provides the `data-sticky` hook.\n */\n readonly sticky = input(false as TableStickyValue, { transform: coerceSticky });\n\n /**\n * Whether this data cell is disabled. Disabled cells are skipped during arrow-key\n * navigation, drop out of the tab order, and reflect `aria-disabled` / `data-disabled`.\n * Only meaningful in `grid` / `treegrid` mode.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n private readonly tabindex = computed<number | null>(() => {\n if (this.ctx.mode() === 'table') {\n return null;\n }\n if (this.disabled()) {\n return -1;\n }\n return this.ctx.cellTabIndex(this.#host);\n });\n\n private readonly colIndex = computed<number | null>(() =>\n this.ctx.mode() === 'table' ? null : this.rowCtx.cellIndexOf(this.#host) + 1,\n );\n\n private readonly highlighted = computed(\n () => this.ctx.mode() !== 'table' && this.ctx.isCellHighlighted(this.#host),\n );\n\n constructor() {\n const handle: ForTableCellHandle = { host: this.#host, disabled: this.disabled };\n registerHandle(\n handle,\n (h) => this.#rowRegistration.registerCell(h),\n (h) => this.#rowRegistration.unregisterCell(h),\n );\n injectPointerMove(() => this.#onPointerMove());\n }\n\n #onPointerMove(): void {\n if (!this.disabled()) {\n this.ctx.highlightFromPointer(this.#host);\n }\n }\n\n private onFocus(): void {\n this.ctx.activateCell(this.#host);\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n this.ctx.handleCellKeydown(event, this.#host, this.name());\n }\n}\n","import { DestroyRef, Directive, ElementRef, inject, output, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\nimport {\n FOR_DRAGGABLE_LIFT_GUARD,\n FOR_DROP_LIST_DEFAULT_ORIENTATION,\n FOR_DROP_LIST_ROVING_DELEGATE,\n ForDropList,\n type ForDragDropEvent,\n type ForDraggableLiftGuard,\n type ForDropListRovingDelegate,\n moveItemInArray,\n provideForDragDropDefaults,\n} from 'forty-cdk/drag-drop';\nimport { translateWindowReorder } from 'forty-cdk/core';\nimport { hostHasSortActivation, injectTableContext } from './table-context';\n\n/** Payload of `columnReorder`: the move's indices and the resulting column-name order. */\nexport interface TableColumnReorderDescriptor {\n /**\n * Previous 0-based index into the **full displayed column order**, counting\n * non-reorderable columns; feed it (with `to`) to `moveItemInArray` over the\n * full displayed-columns array.\n */\n from: number;\n /**\n * New 0-based index into the **full displayed column order**, counting\n * non-reorderable columns; feed it (with `from`) to `moveItemInArray` over the\n * full displayed-columns array.\n */\n to: number;\n /**\n * The reorderable columns in their new order, read from each draggable header\n * cell's `dragData`. Equal to the full displayed order only when every displayed\n * column is reorderable; otherwise it omits the non-reorderable columns.\n */\n columns: readonly string[];\n}\n\n/**\n * Opt-in **column reordering** for `ForTable`, composed over the drag-drop primitive.\n *\n * Apply on the `[forTableHeaderRow]` element. It wraps `[forDropList]` (via\n * `hostDirectives`) so the header cells become a reorderable list, then translates\n * drag-drop's generic drop into the table-friendly `columnReorder` output. Mark each\n * `[forTableHeaderCell]` as `[forDraggable]` with `[dragData]` set to the column name.\n * On a committed drop (pointer or keyboard) it emits the previous / new index (into the\n * full displayed column order) and the reorderable columns' new order; the consumer\n * applies it to their own column array. **It never reorders columns itself** (BYO-data).\n *\n * The wrapped list defaults to `orientation=\"horizontal\"` (a column reorder is always along\n * the row axis), so no `orientation` binding is needed. Bind `orientation=\"vertical\"` to\n * override for the rare case.\n *\n * In `mode=\"grid\"` / `mode=\"treegrid\"` the draggable header cells join the table's composite\n * roving grid as its first row, so a sortable + column-reorderable grid keeps the **single\n * tab stop** the WAI-ARIA Data Grid pattern calls for: `Tab` enters the grid once, Arrow keys\n * cross between header and body, and `Space` on a header cell lifts it for keyboard reordering.\n * It hands its drop-list roving to the grid via `FOR_DROP_LIST_ROVING_DELEGATE` and routes idle\n * header navigation through the table's grid keyboard handler.\n *\n * When a header cell is both sortable (`[forTableSortHeader]`) and reorderable, the two\n * keyboard activations split along WAI-ARIA lines so a single key never both sorts and lifts:\n * `Space` lifts the column, `Enter` toggles the sort. The split is enforced via a\n * `FOR_DRAGGABLE_LIFT_GUARD` that defers `Enter` to the sort header on cells carrying the\n * `data-sortable` marker — detected by DOM marker, so `forty-cdk/drag-drop` needs no table\n * import. A reorder-only header (no sort header) still lifts on both `Enter` and `Space`.\n *\n * @example\n * ```html\n * <div forTableHeaderRow forTableColumnReorder (columnReorder)=\"columns.set($event.columns)\">\n * @for (col of columns(); track col) {\n * <div forTableHeaderCell [name]=\"col\" forDraggable [dragData]=\"col\">{{ col }}</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forTableColumnReorder]',\n exportAs: 'forTableColumnReorder',\n providers: [\n { provide: FOR_DROP_LIST_DEFAULT_ORIENTATION, useValue: 'horizontal' },\n provideForDragDropDefaults({ itemRoleDescription: '' }),\n {\n provide: FOR_DROP_LIST_ROVING_DELEGATE,\n useFactory: (): ForDropListRovingDelegate => {\n const ctx = injectTableContext('ForTableColumnReorder');\n return {\n itemTabindex: (el) =>\n ctx.headerParticipatesInRoving() ? ctx.headerCellTabIndex(el) : null,\n isItemHighlighted: (el) =>\n ctx.headerParticipatesInRoving() ? ctx.isCellHighlighted(el) : null,\n };\n },\n },\n {\n provide: FOR_DRAGGABLE_LIFT_GUARD,\n useValue: {\n canLiftOnKey: (event, host) => !(event.key === 'Enter' && hostHasSortActivation(host)),\n } satisfies ForDraggableLiftGuard,\n },\n ],\n hostDirectives: [\n {\n directive: ForDropList,\n inputs: [\n 'orientation',\n 'dir',\n 'disabled',\n 'autoScroll',\n 'animateReorder',\n 'liveSort',\n 'boundary',\n 'lockAxis',\n ],\n },\n ],\n})\nexport class ForTableColumnReorder {\n private readonly ctx = injectTableContext('ForTableColumnReorder');\n readonly #list = inject(ForDropList);\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /**\n * Fires once per committed reorder gesture (pointer drop or keyboard drop) with the\n * previous / new column index (into the full displayed column order, counting\n * non-reorderable columns) and the reorderable columns' new order after the move.\n */\n readonly columnReorder = output<TableColumnReorderDescriptor>();\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n const sub = this.#list.dragDrop.subscribe((event: ForDragDropEvent) => this.#emit(event));\n destroyRef.onDestroy(() => sub.unsubscribe());\n\n if (this.#isBrowser) {\n const onCaptureKeydown = (event: KeyboardEvent): void => this.#onCaptureKeydown(event);\n const controller = new AbortController();\n this.#host.addEventListener('keydown', onCaptureKeydown, {\n capture: true,\n signal: controller.signal,\n });\n destroyRef.onDestroy(() => controller.abort());\n }\n }\n\n /**\n * When the header row joins the composite grid, intercepts idle (not-lifted) Arrow /\n * Home / End / Page keys on a draggable header cell in the capture phase and routes them\n * through the table's grid navigation, then stops propagation so the draggable's own\n * keydown does not also navigate. Space / Enter (and every key while a keyboard drag is in\n * progress) fall through untouched, so the draggable still owns the lift / move / drop /\n * cancel gesture — keeping the header one navigation continuum with the body while\n * preserving column reordering.\n */\n #onCaptureKeydown(event: KeyboardEvent): void {\n if (!this.ctx.headerParticipatesInRoving()) {\n return;\n }\n const target = event.target;\n if (!(target instanceof HTMLElement)) {\n return;\n }\n if (\n !this.#list.items().some((handle) => handle.host === target) ||\n this.#list.isLifted(target)\n ) {\n return;\n }\n if (this.ctx.handleHeaderCellKeydown(event, target)) {\n event.stopPropagation();\n }\n }\n\n #emit(event: ForDragDropEvent): void {\n const items = this.#list.items();\n const names = items.map((handle) => String(handle.data()));\n const columns = moveItemInArray(names, event.previousIndex, event.currentIndex);\n const displayedIndices = items.map((handle) => this.ctx.headerCellIndexOf(handle.host));\n const { from, to } = displayedIndices.some((index) => index < 0)\n ? { from: event.previousIndex, to: event.currentIndex }\n : translateWindowReorder(displayedIndices, event.previousIndex, event.currentIndex);\n this.columnReorder.emit({ from, to, columns });\n }\n}\n","import {\n afterNextRender,\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n DOCUMENT,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n PLATFORM_ID,\n signal,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\nimport {\n clamp,\n createPointerDragSession,\n type PointerDragSession,\n DRAG_DEAD_ZONE_PX,\n hostButtonType,\n isHistoryChord,\n} from 'forty-cdk/core';\nimport { injectTableCellTabIndex } from './cell-tab-index';\nimport { FOR_TABLE_DEF_REGISTRY } from './def-registry';\nimport { assertColumnName, injectTableContext, injectTableRegistration } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/** Payload of `resizeCommit`: which column was resized and its committed width (px). */\nexport interface TableResizeDescriptor {\n column: string;\n width: number;\n}\n\n/**\n * Payload of `[widthRevert]`: which column was reverted and the width (px) it had before the\n * gesture, `undefined` when the column had no width yet.\n */\nexport interface TableResizeRevertDescriptor {\n column: string;\n width: number | undefined;\n}\n\n/**\n * Turns a focusable element inside a `[forTableHeaderCell]` into a column-resize\n * handle. Supports pointer drag (with a dead-zone so a plain click is a no-op) and\n * keyboard resize, both constrained to `[min, max]`: `ArrowLeft` / `ArrowRight` step by\n * `step` (RTL-mirrored), `Page Up` / `Page Down` shrink / grow by `largeStep`, `Home`\n * snaps to `min` and `End` to a finite `max`, the same keymap as `[forPaneResizer]`.\n * Pressing `Escape` (or a `pointercancel`) during a drag reverts the width to where\n * the gesture started and emits no `resizeCommit`; a column that had no width goes back\n * to `undefined`, so no width var stays published. Being destroyed mid-drag reverts\n * too, reporting the pre-drag width through the `[widthRevert]` callback because the\n * `[(width)]` model can no longer emit during teardown.\n *\n * On every change it publishes the resolved width as the CSS custom property\n * `--for-table-col-<column>-width` on the table root, so the consumer can apply it\n * to their layout (`grid-template-columns` in `<div>` mode, a `<col>` / cell width\n * in native `<table>` mode). **It never lays out columns itself and never resizes\n * data** — it owns the affordance, accessibility, and the published width only.\n * For a column a `<for-table-body>` declares, the body publishes that var from its\n * `[(columnWidths)]` map instead, and the handle only reports width changes.\n *\n * Reflects `data-resizing` (empty string) while a pointer drag is active. Carries\n * `role=\"separator\"` with `aria-orientation=\"vertical\"` and live `aria-value*`,\n * mirroring `[forPaneResizer]`. The consumer supplies `aria-label`. Before the first\n * gesture, `aria-valuenow` falls back to the header-cell width measured once on mount\n * (browser-only), so a separator with no `[width]` is never announced without a\n * current value; an explicit `[width]` always takes precedence. The reflected value is\n * clamped to `[min, max]` and a `max` below `min` reflects as `min`, while `[(width)]`\n * keeps the raw value.\n *\n * In `mode=\"grid\"` / `\"treegrid\"` it yields its tab stop to the composite roving grid\n * (`tabindex=\"-1\"`) and is reached via cell-entry: Enter / F2 focuses the first focusable\n * inside the header cell, and `Tab` cycles on to the rest, so it stays reachable behind a\n * column-menu button. It must sit on a natively-focusable element (a `<button>`) for either\n * to find it. In `mode=\"table\"` it is a standalone tab stop (`tabindex=\"0\"`), and so it is\n * in a grid whose header row does not join the grid, where no cell entry reaches it. A\n * `<button>` host is forced to `type=\"button\"`, so a click or `Enter` / `Space` on\n * the handle never submits a surrounding `<form>`.\n *\n * Opt in to size-to-content with `[autoFit]`: double-clicking the handle then fits the\n * column to its widest data-cell content via `fitToContent()` (also callable imperatively\n * through `exportAs=\"forTableColumnResizer\"`, e.g. from a column menu). Unset (default),\n * `dblclick` is a no-op and the resize behaviour is unchanged. Add `[fitIncludesHeader]`\n * to also account for the column header's label (marked with a sibling\n * `[forTableColumnLabel]`), fitting to `max(header label, …data cells)`.\n *\n * @example\n * ```html\n * <th forTableHeaderCell name=\"name\">\n * Name\n * <button forTableColumnResizer column=\"name\" [(width)]=\"nameWidth\"\n * aria-label=\"Resize Name column\"></button>\n * </th>\n * ```\n */\n@Directive({\n selector: '[forTableColumnResizer]',\n exportAs: 'forTableColumnResizer',\n host: {\n role: 'separator',\n 'aria-orientation': 'vertical',\n '[attr.type]': 'buttonType()',\n '[attr.tabindex]': 'disabled() ? \"-1\" : tabindex()',\n '[attr.aria-valuenow]': 'ariaValueNow()',\n '[attr.aria-valuemin]': 'min()',\n '[attr.aria-valuemax]': 'ariaValueMax()',\n '[attr.aria-disabled]': 'disabled() ? \"true\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-resizing]': 'resizing() ? \"\" : null',\n '(keydown)': 'onKeyDown($event)',\n '(click)': 'onClick($event)',\n '(dblclick)': 'autoFit() && !disabled() && fitToContent()',\n },\n})\nexport class ForTableColumnResizer {\n private readonly ctx = injectTableContext('ForTableColumnResizer');\n readonly #registration = injectTableRegistration('ForTableColumnResizer');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #document = inject(DOCUMENT);\n readonly #headerCell = inject(ForTableHeaderCell, { optional: true });\n\n private readonly buttonType = hostButtonType();\n\n /** Column identity; included in the `resizeCommit` payload and the published CSS var name. */\n readonly column = input.required<string>();\n\n /**\n * Current column width in pixels. Two-way bindable via `[(width)]`. Acts as both\n * the controlled value and the base a pointer drag / arrow step is applied to.\n * When unset, the base for the first gesture is measured from the header cell.\n * Its implicit `widthChange` fires on every live update (drag tick, arrow press);\n * `resizeCommit` is the distinct column-aware gesture-end event.\n */\n readonly width = model<number>();\n\n /** Minimum width in pixels. Default `0`. */\n readonly min = input<number>(0);\n\n /** Maximum width in pixels. Default `Infinity` (no upper bound). */\n readonly max = input<number>(Infinity);\n\n /** Pixels applied per `ArrowLeft` / `ArrowRight` press. Default `10`. */\n readonly step = input<number>(10);\n\n /**\n * Pixels applied per `Page Up` (shrink) / `Page Down` (grow) press, matching\n * `[forPaneResizer]`'s direction. Default `100`.\n */\n readonly largeStep = input<number>(100);\n\n /**\n * Disables the handle: it leaves the tab order (`tabindex=\"-1\"`), keyboard, pointer drag\n * and the `[autoFit]` double-click do nothing, and `aria-disabled` / `data-disabled` are\n * reflected. An imperative `fitToContent()` call still applies.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /**\n * Opt-in size-to-content. When set, double-clicking the handle fits the column to\n * its widest data-cell content via `fitToContent()`. Unset (default), `dblclick` is\n * a no-op and the resize behaviour is unchanged.\n */\n readonly autoFit = input(false, { transform: booleanAttribute });\n\n /**\n * Opt-in: also account for the column header's label width when fitting to content,\n * so `fitToContent()` sizes to `max(header label, …data cells)` instead of data cells\n * only. The header label is isolated through a sibling `[forTableColumnLabel]` marker\n * (the resize handle / sort affordance are excluded). When set without a marker present,\n * it degrades to data-cells-only. Unset (default), the header is ignored.\n */\n readonly fitIncludesHeader = input(false, { transform: booleanAttribute });\n\n /**\n * Fires once per resize gesture — at pointer-up after a drag, and on every arrow\n * press — with the column identity and its committed width. Bind it to persist\n * the width; live updates during a drag come through `[(width)]` / `widthChange`.\n */\n readonly resizeCommit = output<TableResizeDescriptor>();\n\n /**\n * Teardown-only revert channel. Called with the pre-drag width when the handle is\n * destroyed mid-drag — the column is removed, or `resizable` is toggled off — so the\n * transient drag width never survives as the consumer's persisted value. The width is\n * `undefined` when the column had none before the gesture. On every other revert path\n * (`Escape`, `pointercancel`) the pre-drag width arrives through `[(width)]` /\n * `widthChange` as usual and this callback does not fire.\n *\n * Bound as a function reference (`[widthRevert]=\"onRevert\"`), not as an event binding:\n * the `[(width)]` model — like any `output()` on this directive — is already destroyed\n * when the unmount revert happens, so an emitter-based channel cannot deliver it.\n */\n readonly widthRevert = input<((descriptor: TableResizeRevertDescriptor) => void) | undefined>(\n undefined,\n );\n\n readonly #upperBound = computed(() => Math.max(this.max(), this.min()));\n\n /** `aria-valuemax`, omitted when `max` is non-finite (the default unbounded case). */\n private readonly ariaValueMax = computed<number | null>(() =>\n Number.isFinite(this.#upperBound()) ? this.#upperBound() : null,\n );\n\n /** `aria-valuenow`: the explicit or measured width, clamped to the reflected range. */\n private readonly ariaValueNow = computed<number | null>(() => {\n const current = this.width() ?? this.measuredWidth();\n return current == null ? null : clamp(current, this.min(), this.#upperBound());\n });\n\n private readonly tabindex = injectTableCellTabIndex();\n\n readonly #resizing = signal(false);\n\n /** Whether a pointer drag is currently active (drives `data-resizing`). */\n private readonly resizing = this.#resizing.asReadonly();\n\n readonly #measuredWidth = signal<number | null>(null);\n\n /**\n * Header-cell width measured once on mount (browser-only). Backs `aria-valuenow`\n * before any explicit `[width]` so the focusable separator never ships without a\n * current value on the measured-fallback path; an explicit `[width]` still wins.\n */\n private readonly measuredWidth = this.#measuredWidth.asReadonly();\n\n #pointerSession: PointerDragSession | null = null;\n\n #dragStartCoord = 0;\n #dragStartWidth: number | undefined = undefined;\n #dragStartValue = 0;\n #dragInvert = false;\n #dragCurrent = 0;\n\n #publishedColumn: string | null = null;\n\n #destroying = false;\n\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n const defs = inject(FOR_TABLE_DEF_REGISTRY, { optional: true });\n const bodyOwnsWidth = (column: string): boolean =>\n defs?.columnNames().includes(column) ?? false;\n effect(() => {\n const column = this.column();\n assertColumnName(column, 'ForTableColumnResizer');\n const w = this.width();\n if (this.#publishedColumn !== null && this.#publishedColumn !== column) {\n this.#registration.removeColumnWidth(this.#publishedColumn);\n }\n if (bodyOwnsWidth(column)) {\n this.#publishedColumn = null;\n } else if (w != null) {\n this.#registration.setColumnWidth(column, w);\n this.#publishedColumn = column;\n } else {\n this.#registration.removeColumnWidth(column);\n this.#publishedColumn = null;\n }\n });\n destroyRef.onDestroy(() => {\n const column = this.column();\n if (!bodyOwnsWidth(column)) {\n this.#registration.removeColumnWidth(column);\n }\n });\n if (this.#isBrowser) {\n afterNextRender(() => this.#measuredWidth.set(this.#measureBaseWidth()));\n this.#pointerSession = createPointerDragSession({\n host: this.#host,\n document: this.#document,\n armThreshold: DRAG_DEAD_ZONE_PX,\n capturePointer: true,\n cancelOnEscape: true,\n cancelOnDestroy: true,\n canStart: (event) => this.#onDragStart(event),\n onLift: () => true,\n onMove: (event) => this.#onDragMove(event),\n onCommit: () => this.#onDragCommit(),\n onCancel: () => this.#onDragCancel(),\n });\n destroyRef.onDestroy(() => {\n this.#destroying = true;\n this.#pointerSession?.destroy();\n });\n }\n }\n\n /**\n * Sizes the column to its content: measures the widest natural width across the\n * column's data cells (resolved through the table context, browser-only) — and, when\n * `[fitIncludesHeader]` is set with a sibling `[forTableColumnLabel]` present, the\n * header label too, so the fit becomes `max(header label, …data cells)`. Clamps the\n * result to `[min, max]`, applies it as the new `[(width)]`, and emits `resizeCommit`.\n * Wired to a `dblclick` on the handle when `[autoFit]` is set, and callable\n * imperatively (e.g. from a column menu) via `exportAs=\"forTableColumnResizer\"`.\n * Returns the applied width; a no-op returning the current width off the browser.\n */\n fitToContent(): number {\n if (!this.#isBrowser) {\n return this.width() ?? this.min();\n }\n const next = clamp(this.#measureContentWidth(), this.min(), this.max());\n this.width.set(next);\n this.resizeCommit.emit({ column: this.column(), width: next });\n return next;\n }\n\n #onDragStart(event: PointerEvent): boolean {\n if (this.disabled()) {\n return false;\n }\n if (event.pointerType === 'mouse' && event.button !== 0) {\n return false;\n }\n event.preventDefault();\n event.stopPropagation();\n const ltr = this.ctx.dir() !== 'rtl';\n this.#dragInvert = !ltr;\n this.#dragStartCoord = event.clientX;\n this.#dragStartWidth = this.width();\n this.#dragStartValue = this.#dragStartWidth ?? this.#measureBaseWidth();\n this.#dragCurrent = this.#dragStartValue;\n return true;\n }\n\n #onDragMove(event: PointerEvent): void {\n let delta = event.clientX - this.#dragStartCoord;\n if (this.#dragInvert) {\n delta = -delta;\n }\n const next = clamp(this.#dragStartValue + delta, this.min(), this.max());\n if (next === this.#dragCurrent) {\n return;\n }\n this.#dragCurrent = next;\n this.#resizing.set(true);\n this.width.set(next);\n }\n\n #onDragCommit(): void {\n this.#resizing.set(false);\n this.resizeCommit.emit({ column: this.column(), width: this.#dragCurrent });\n }\n\n #onDragCancel(): void {\n this.#resizing.set(false);\n this.#dragCurrent = this.#dragStartValue;\n if (this.width() === this.#dragStartWidth) {\n return;\n }\n if (this.#destroying) {\n this.widthRevert()?.({ column: this.column(), width: this.#dragStartWidth });\n return;\n }\n this.width.set(this.#dragStartWidth);\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n const delta = isHistoryChord(event) ? null : this.#keyDelta(event.key);\n if (delta === null) {\n return;\n }\n const base = this.width() ?? this.#measureBaseWidth();\n const next = clamp(base + delta, this.min(), this.#upperBound());\n event.preventDefault();\n if (next === this.width()) {\n return;\n }\n this.width.set(next);\n this.resizeCommit.emit({ column: this.column(), width: next });\n }\n\n #keyDelta(key: string): number | null {\n const ltr = this.ctx.dir() !== 'rtl';\n switch (key) {\n case 'ArrowRight':\n return ltr ? this.step() : -this.step();\n case 'ArrowLeft':\n return ltr ? -this.step() : this.step();\n case 'PageUp':\n return -this.largeStep();\n case 'PageDown':\n return this.largeStep();\n case 'Home':\n return -Infinity;\n case 'End':\n return Number.isFinite(this.#upperBound()) ? Infinity : null;\n default:\n return null;\n }\n }\n\n private onClick(event: MouseEvent): void {\n event.stopPropagation();\n }\n\n #measureBaseWidth(): number {\n const cell = this.#headerCell?.el.nativeElement ?? this.#host;\n return cell.getBoundingClientRect().width;\n }\n\n #measureContentWidth(): number {\n const column = this.column();\n const cells = this.#registration\n .rows()\n .flatMap((row) => row.cells())\n .map((cell) => cell.host)\n .filter((host) => host.getAttribute('data-column') === column);\n const headerCell = this.#headerCell?.el.nativeElement ?? null;\n const labelEl = this.fitIncludesHeader() ? (this.#headerCell?.labelEl() ?? null) : null;\n if (cells.length === 0 && !labelEl) {\n return this.#measureBaseWidth();\n }\n const doc = this.#host.ownerDocument;\n const root =\n this.#host.closest<HTMLElement>('[role=\"table\"], [role=\"grid\"], [role=\"treegrid\"]') ??\n doc.body;\n const probe = doc.createElement('div');\n probe.setAttribute('aria-hidden', 'true');\n probe.style.cssText =\n 'position:absolute;top:0;left:-9999px;visibility:hidden;pointer-events:none;';\n root.appendChild(probe);\n try {\n let widest = 0;\n for (const cell of cells) {\n widest = Math.max(widest, this.#measureClone(probe, cell));\n }\n if (labelEl && headerCell) {\n widest = Math.max(\n widest,\n this.#measureClone(probe, labelEl) + this.#horizontalBox(headerCell),\n );\n }\n return widest;\n } finally {\n root.removeChild(probe);\n }\n }\n\n #measureClone(probe: HTMLElement, source: HTMLElement): number {\n const clone = source.cloneNode(true) as HTMLElement;\n const style = source.ownerDocument.defaultView?.getComputedStyle(source);\n if (style) {\n clone.style.fontFamily = style.fontFamily;\n clone.style.fontSize = style.fontSize;\n clone.style.fontWeight = style.fontWeight;\n clone.style.fontStyle = style.fontStyle;\n clone.style.letterSpacing = style.letterSpacing;\n clone.style.textTransform = style.textTransform;\n }\n clone.style.display = 'inline-block';\n clone.style.width = 'auto';\n clone.style.minWidth = '0';\n clone.style.maxWidth = 'none';\n clone.style.whiteSpace = 'nowrap';\n probe.appendChild(clone);\n return clone.getBoundingClientRect().width;\n }\n\n #horizontalBox(el: HTMLElement): number {\n const style = el.ownerDocument.defaultView?.getComputedStyle(el);\n if (!style) {\n return 0;\n }\n const px = (value: string): number => parseFloat(value) || 0;\n return (\n px(style.paddingLeft) +\n px(style.paddingRight) +\n px(style.borderLeftWidth) +\n px(style.borderRightWidth)\n );\n }\n}\n","import { Directive, ElementRef, inject, DestroyRef } from '@angular/core';\n\nimport { injectTableContext, injectTableRegistration } from './table-context';\n\n/**\n * Marks the header row of the table (`role=\"row\"`). Registers its host\n * element with the root so `ForTable` can measure the header's height and\n * publish `--for-table-header-height` for sticky-cell CSS.\n *\n * In `grid` / `treegrid` mode the header row is the grid's first row for ARIA\n * numbering, so it emits `aria-rowindex=\"1\"` and every data row's index shifts\n * up by one (matching the APG Data Grid example, where `aria-rowcount` counts\n * the header row too).\n */\n@Directive({\n selector: '[forTableHeaderRow]',\n exportAs: 'forTableHeaderRow',\n host: {\n role: 'row',\n '[attr.aria-rowindex]': 'rowIndex()',\n },\n})\nexport class ForTableHeaderRow {\n private readonly ctx = injectTableContext('ForTableHeaderRow');\n readonly #registration = injectTableRegistration('ForTableHeaderRow');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** 1-based `aria-rowindex` for the header row (`1` in grid / treegrid mode, else absent). */\n private readonly rowIndex = this.ctx.headerRowIndex;\n\n constructor() {\n const el = this.#host.nativeElement;\n this.#registration.registerHeaderRow(el);\n inject(DestroyRef).onDestroy(() => this.#registration.unregisterHeaderRow(el));\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n numberAttribute,\n output,\n type Provider,\n type Signal,\n type Type,\n} from '@angular/core';\n\nimport {\n Collection,\n type ForTableCellHandle,\n registerHandle,\n TABLE_ROW_REGISTRATION_CONTEXT,\n} from 'forty-cdk/core';\nimport { eventFromInteractiveDescendant } from './interactive-descendant';\nimport {\n FOR_TABLE_ROW_CONTEXT,\n type ForTableRowContext,\n type TableSelectionMode,\n injectTableContext,\n injectTableRegistration,\n} from './table-context';\n\n/**\n * Payload emitted by {@link ForTableRow.activate} when a row you render yourself is activated in\n * `grid` / `treegrid` mode.\n */\nexport interface TableRawRowActivateEvent {\n /** The row's `[value]`, or `undefined` when the row carries none. */\n readonly value: unknown;\n /**\n * The originating event: the `MouseEvent` of a click, or the `Enter` `KeyboardEvent` the root\n * reported as `cellActivate`, already `preventDefault`ed.\n */\n readonly event: MouseEvent | KeyboardEvent;\n}\n\n/**\n * Marks a data row (`role=\"row\"`). Owns the registry of its data cells (for\n * `aria-colindex`) and registers itself with the root so it joins the row index\n * space and the 2D navigation grid. In `grid`/`treegrid` mode `aria-rowindex` is\n * 1-based and counts the header row as row 1, so the first data row is row 2 when\n * a header row is present (matching the APG Data Grid numbering).\n */\n@Directive({\n selector: '[forTableRow]',\n exportAs: 'forTableRow',\n host: {\n role: 'row',\n '[attr.aria-rowindex]': 'rowIndex()',\n '[attr.data-index]': 'virtualIndex()',\n '[attr.aria-selected]': 'ariaSelected()',\n '[attr.data-selected]': 'selected() ? \"\" : null',\n '[attr.aria-level]': 'ariaLevel()',\n '[attr.aria-posinset]': 'posinset()',\n '[attr.aria-setsize]': 'setsize()',\n '[attr.aria-expanded]': 'ariaExpanded()',\n '[attr.data-state]': 'expandState()',\n '(click)': 'onClick($event)',\n '(keydown)': 'onKeydown($event)',\n },\n providers: provideForTableRow(ForTableRow),\n})\nexport class ForTableRow implements ForTableRowContext {\n private readonly ctx = injectTableContext('ForTableRow');\n readonly #registration = injectTableRegistration('ForTableRow');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #cells = new Collection<ForTableCellHandle>();\n\n /**\n * This row's element injector. Exposed so a declarative renderer stamping\n * full-span variant content from a projected `<ng-template>` (e.g.\n * `ForTableBody`) can pass it as `[ngTemplateOutletInjector]`, letting\n * row-context-dependent primitives inside that content resolve this row.\n */\n readonly injector = inject(Injector);\n\n /** This row's selection identity, written into the table's `[(value)]`. Leave unset for non-selectable rows. */\n readonly value = input<unknown>();\n\n /** 1-based tree depth for `aria-level` in `mode=\"treegrid\"`. Ignored in other modes. */\n readonly level = input(1, { transform: numberAttribute });\n\n /** Marks this row as an expandable parent — emits `aria-expanded` + `data-state`. */\n readonly expandable = input(false, { transform: booleanAttribute });\n\n /**\n * Absolute 0-based index of this row in the full virtualized dataset. Set by the\n * consumer when rendering a window via `[forTableVirtualized]`; drives the absolute\n * `aria-rowindex` (except in `mode=\"table\"`) and keeps the focused row mounted\n * across recycling. Reflected as `data-index`, the attribute\n * `ForTableVirtualized.measureRow` reads the row's index from. Leave unset\n * (default `null`) for non-virtualized tables, which then emit no `data-index`.\n */\n readonly virtualIndex = input<number | null, unknown>(null, {\n transform: (v) => (v == null ? null : numberAttribute(v)),\n });\n\n /**\n * Fires in `grid` / `treegrid` mode when the row is activated, carrying its `[value]` and the\n * event: a click anywhere on the row except on an interactive descendant (the definition\n * `eventFromInteractiveDescendant` exports), or `Enter` on one of its data cells that holds no\n * widget, the same press the root emits as `cellActivate`. One binding therefore covers the\n * pointer and the keyboard, so the row needs no `(click)` of its own.\n *\n * `Enter` that enters a cell's widget, `Enter` or a click originating from an inner control,\n * and every event in `mode=\"table\"`, where the row has no keyboard path, never emit. In a\n * selectable grid a click also mutates the selection unless the root sets\n * `selectionBehavior=\"none\"`.\n */\n readonly activate = output<TableRawRowActivateEvent>();\n\n private readonly rowIndex = computed<number | null>(() => {\n if (this.ctx.mode() === 'table') {\n return null;\n }\n const offset = this.ctx.dataRowIndexOffset();\n const vi = this.virtualIndex();\n return vi !== null ? vi + 1 + offset : this.ctx.rowIndexOf(this.#host) + 1 + offset;\n });\n\n readonly selectionMode: Signal<TableSelectionMode> = this.ctx.selectionMode;\n\n readonly selected = computed(() => {\n const v = this.value();\n return v !== undefined && this.ctx.isRowSelected(v);\n });\n\n private readonly ariaSelected = computed<'true' | 'false' | null>(() => {\n if (\n this.ctx.mode() === 'table' ||\n this.ctx.selectionMode() === 'none' ||\n this.value() === undefined\n ) {\n return null;\n }\n return this.selected() ? 'true' : 'false';\n });\n\n /** Whether this expandable row is currently open. False for non-expandable rows. */\n readonly expanded = computed(() => {\n const v = this.value();\n return v !== undefined && this.ctx.isRowExpanded(v);\n });\n\n /** Toggles this row's expansion. No-op when the row is not expandable or has no `[value]`. */\n toggleExpanded(): void {\n if (this.expandable()) {\n this.ctx.toggleRowExpansion(this.value());\n }\n }\n\n private readonly ariaLevel = computed<number | null>(() =>\n this.ctx.mode() === 'treegrid' ? this.level() : null,\n );\n private readonly posinset = computed<number | null>(() =>\n this.ctx.mode() === 'treegrid' ? this.ctx.rowPosinset(this.#host) : null,\n );\n private readonly setsize = computed<number | null>(() =>\n this.ctx.mode() === 'treegrid' ? this.ctx.rowSetsize(this.#host) : null,\n );\n private readonly ariaExpanded = computed<'true' | 'false' | null>(() =>\n this.ctx.mode() === 'treegrid' && this.expandable()\n ? this.expanded()\n ? 'true'\n : 'false'\n : null,\n );\n private readonly expandState = computed<'open' | 'closed' | null>(() =>\n this.ctx.mode() === 'treegrid' && this.expandable()\n ? this.expanded()\n ? 'open'\n : 'closed'\n : null,\n );\n\n constructor() {\n const handle = {\n host: this.#host,\n cells: this.#cells.items,\n value: this.value,\n level: this.level,\n expandable: this.expandable,\n virtualIndex: this.virtualIndex,\n };\n registerHandle(\n handle,\n (h) => this.#registration.registerRow(h),\n (h) => this.#registration.unregisterRow(h),\n );\n }\n\n private registerCell(handle: ForTableCellHandle): void {\n this.#cells.register(handle);\n }\n\n private unregisterCell(handle: ForTableCellHandle): void {\n this.#cells.unregister(handle);\n }\n\n cellIndexOf(host: HTMLElement): number {\n return this.#cells.indexOfHost(host);\n }\n\n toggleSelected(): void {\n const v = this.value();\n if (v !== undefined) {\n this.ctx.toggleRowSelection(v);\n }\n }\n\n private onClick(event: MouseEvent): void {\n this.#select(event);\n if (this.ctx.mode() !== 'table' && !eventFromInteractiveDescendant(event)) {\n this.activate.emit({ value: this.value(), event });\n }\n }\n\n private onKeydown(event: KeyboardEvent): void {\n if (this.ctx.isCellActivation(event)) {\n this.activate.emit({ value: this.value(), event });\n }\n }\n\n #select(event: MouseEvent): void {\n const v = this.value();\n if (\n this.ctx.selectionMode() === 'none' ||\n v === undefined ||\n eventFromInteractiveDescendant(event)\n ) {\n return;\n }\n this.ctx.selectRow(v, {\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n shiftKey: event.shiftKey,\n });\n }\n}\n\n/**\n * The providers a `[forTableRow]` installs: the row context and the cell-registration wiring every\n * `[forTableCell]` inside it resolves, both aliased to `row`. Neither token is public, so a wrapper\n * that **subclasses** the row spreads this helper as its own `providers`:\n *\n * ```ts\n * providers: provideForTableRow(MyRow),\n * ```\n *\n * Wrapping through `hostDirectives: [ForTableRow]` needs none of this, because a host directive\n * brings its own providers to the element.\n */\nexport function provideForTableRow(row: Type<ForTableRow>): Provider[] {\n return [\n { provide: FOR_TABLE_ROW_CONTEXT, useExisting: row },\n { provide: TABLE_ROW_REGISTRATION_CONTEXT, useExisting: row },\n ];\n}\n","import { Directive, effect, ElementRef, inject, input } from '@angular/core';\n\n/**\n * Applies a per-row attribute map to a `<for-table-body>` stamped row. The body\n * places it on every stamped row so its `rowAttrs` hook can set or remove\n * arbitrary attributes derived from the row datum, without the body owning a\n * static list of attribute names. A key mapped to `null` (or dropped from a\n * later map) removes that attribute. Internal to `forty-cdk/table`.\n */\n@Directive({ selector: '[forTableRowAttrs]' })\nexport class ForTableRowAttrs {\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /** The attribute map to reflect on the row host, or `undefined` for none. */\n readonly attrs = input<Record<string, string | null> | undefined>(undefined, {\n alias: 'forTableRowAttrs',\n });\n\n constructor() {\n let applied: readonly string[] = [];\n effect(() => {\n const next = this.attrs() ?? {};\n for (const key of applied) {\n if (!(key in next)) {\n this.#host.removeAttribute(key);\n }\n }\n const keys: string[] = [];\n for (const [key, value] of Object.entries(next)) {\n if (value == null) {\n this.#host.removeAttribute(key);\n } else {\n this.#host.setAttribute(key, value);\n }\n keys.push(key);\n }\n applied = keys;\n });\n }\n}\n","import {\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\n\nimport { injectHostCarriesDragItem } from 'forty-cdk/core';\nimport { eventFromInteractiveDescendant } from './interactive-descendant';\nimport { injectTableContext } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/** Sort direction for a column header. `'none'` means unsorted (no aria-sort emitted). */\nexport type TableSortDirection = 'ascending' | 'descending' | 'none';\n\n/** Payload of `sortChange`: which column changed and its new direction. */\nexport interface TableSortDescriptor {\n column: string;\n direction: TableSortDirection;\n}\n\n/**\n * Turns a `[forTableHeaderCell]` into a sortable affordance that emits `aria-sort`\n * and fires `sortChange` on activation (click, Enter, Space). The directive is\n * **self-contained**: it owns only its own `direction` state and does NOT register\n * with the table context or auto-reset sibling headers. The \"one sorted column at a\n * time\" guarantee is the consumer's responsibility — hold a single sort descriptor\n * signal and derive each header's `direction` from it. Apply this directive on the\n * same element as `[forTableHeaderCell]`.\n *\n * The directive emits its own `tabindex=\"0\"` only in `mode=\"table\"`. In `grid` /\n * `treegrid` mode the header cell owns the roving composite tab stop, so this directive\n * emits no `tabindex`; `aria-sort` / `data-sorted` and click / keyboard activation stay\n * on the cell. When a `[forDraggable]` (column reorder) shares the same host cell — in\n * either mode — this directive also yields its `tabindex` to the draggable's roving tab\n * stop so the two never collide on the host attribute, and the keyboard activation splits\n * along WAI-ARIA lines: `Space` lifts the column for reordering while `Enter` toggles the\n * sort, so a single key press never both sorts and starts a drag-lift. A column pinned with\n * `[dragDisabled]` has no lift for `Space` to collide with, so it sorts on both keys like a\n * sort-only header. The draggable is detected however it is applied (in the template,\n * through `hostDirectives` or through a subclass), with no drag-drop value-import.\n *\n * While `sortable`, the directive reflects the `data-sortable` marker (a CSS styling\n * hook, absent when `sortable` is `false`). In `grid` / `treegrid` mode the header cell\n * reads that marker to defer APG cell entry on `Enter`: `Enter` toggles the sort and\n * keeps focus on the cell, while `F2` remains the cell-entry key — so a sortable +\n * resizable header does not both sort and drop focus onto the resize handle.\n *\n * Cycle (default `firstClickDirection='ascending'`): `none → ascending → descending → none`.\n * With `disableClear`: `none → ascending → descending → ascending`.\n *\n * `firstClickDirection='descending'` flips the entry pole, so a freshly activated\n * column starts descending: `none → descending → ascending → none` (and with\n * `disableClear`: `none → descending → ascending → descending`) — the descending-first\n * behavior used by single-always-active sort descriptors.\n *\n * A `click`, `Space`, or `Enter` originating from an interactive descendant of the\n * header cell — a stamped `[forTableColumnResizer]` handle, or a consumer-placed\n * `button` / `a[href]` / `input` / `select` / `textarea` / `summary` / editable\n * `contenteditable` / role-based control — does not toggle the sort and leaves the\n * descendant's own activation intact. (A non-native custom handle carrying only\n * `role=\"separator\"` / `tabindex` is not matched by the shared interactive-descendant\n * selector, so it would still bubble to sort; the stamped resize handle and the\n * documented example are native `<button>`s, so this is not a real path today.)\n */\n@Directive({\n selector: '[forTableSortHeader]',\n exportAs: 'forTableSortHeader',\n host: {\n '[attr.aria-sort]': 'activeDirection()',\n '[attr.data-sorted]': 'activeDirection()',\n '[attr.data-sortable]': \"sortable() ? '' : null\",\n '(click)': 'onClick($event)',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableSortHeader {\n private readonly ctx = injectTableContext('ForTableSortHeader');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #headerCell = inject(ForTableHeaderCell, { self: true, optional: true });\n readonly #hasDraggable = injectHostCarriesDragItem(this.#host);\n\n /** Column identity included in the `sortChange` payload. */\n readonly column = input.required<string>();\n\n /**\n * Current sort direction. Acts as both the controlled value and the initial value.\n * Its implicit `directionChange` output fires on every internal update (via\n * `[(direction)]`). `sortChange` is the primary column-aware event consumers bind:\n * it carries a `{ column, direction }` descriptor and fires on every activation,\n * regardless of whether the consumer uses two-way binding.\n */\n readonly direction = model<TableSortDirection>('none');\n\n /**\n * When `true`, the cycle skips the `'none'` step: `ascending → descending → ascending`.\n * Useful when clearing the sort is not allowed.\n */\n readonly disableClear = input(false, { transform: booleanAttribute });\n\n /**\n * Direction a previously-unsorted column enters on its first activation (the\n * `'none' → ?` step of the cycle). Defaults to `'ascending'`. Set to `'descending'`\n * for descending-first columns. The toggle between the two sorted directions and the\n * optional `'none'` step (`disableClear`) are unchanged.\n */\n readonly firstClickDirection = input<'ascending' | 'descending'>('ascending');\n\n /**\n * When `false`, the header is fully inert: no `tabindex`, no `aria-sort`, and click /\n * keyboard handlers are no-ops. Defaults to `true`.\n */\n readonly sortable = input(true, { transform: booleanAttribute });\n\n /**\n * Fires on every activation with the column identity and the new direction.\n * Consumers bind this to update their own sort descriptor and reorder rows.\n */\n readonly sortChange = output<TableSortDescriptor>();\n\n /**\n * Truthy-only `aria-sort` / `data-sorted` value: `'ascending'` or `'descending'`\n * while sorted, `null` (absent) when `direction` is `'none'` or `sortable` is `false`.\n */\n private readonly activeDirection = computed<TableSortDirection | null>(() =>\n this.sortable() && this.direction() !== 'none' ? this.direction() : null,\n );\n\n /**\n * Whether this sort header needs the host to be a standalone `tabindex=\"0\"` tab\n * stop: a sortable, non-draggable header. The header cell honors this only when it\n * is not part of the body's roving composite grid (`mode=\"table\"`, or a\n * column-reorder header row); in a plain grid / treegrid header the roving grid\n * owns the tab stop and this intent is superseded.\n */\n readonly #standaloneTabStop = computed(() => this.sortable() && !this.#hasDraggable());\n\n constructor() {\n this.#headerCell?.registerStandaloneTabStop(this.#standaloneTabStop);\n inject(DestroyRef).onDestroy(() =>\n this.#headerCell?.unregisterStandaloneTabStop(this.#standaloneTabStop),\n );\n }\n\n /**\n * Handles pointer activation, forwarding to `activate()` unless the click\n * originated from an interactive descendant of the header cell (which owns its\n * own activation).\n */\n private onClick(event: MouseEvent): void {\n if (eventFromInteractiveDescendant(event)) {\n return;\n }\n this.activate();\n }\n\n /** Activates the sort: computes the next direction, updates the model, and emits `sortChange`. */\n private activate(): void {\n if (!this.sortable()) return;\n const next = this.#next(this.direction());\n this.direction.set(next);\n this.sortChange.emit({ column: this.column(), direction: next });\n }\n\n /**\n * Handles Enter and Space keyboard activation, forwarding to `activate()`.\n * When a `[forDraggable]` (column reorder) shares the host cell, the two\n * activations split along WAI-ARIA lines: `Space` is reserved for the reorder\n * lift, and `Enter` while a keyboard drag is in progress (`data-dragging`)\n * for its drop, so this header only sorts on an idle `Enter`. A sort-only\n * header (no draggable) still sorts on both keys — and so does a header whose\n * draggable cannot lift (`data-disabled`, a column pinned with `[dragDisabled]`),\n * since there is no lift for `Space` to collide with\n * ([#1840](https://github.com/tutkli/forty-cdk/issues/1840)).\n */\n private onKeyDown(event: KeyboardEvent): void {\n const isEnter = event.key === 'Enter';\n const isSpace = event.key === ' ';\n if (!isEnter && !isSpace) {\n return;\n }\n if (eventFromInteractiveDescendant(event)) {\n return;\n }\n const draggableCanLift = this.#hasDraggable() && !this.#host.hasAttribute('data-disabled');\n if (draggableCanLift && (isSpace || this.#host.hasAttribute('data-dragging'))) {\n return;\n }\n event.preventDefault();\n this.activate();\n }\n\n #next(current: TableSortDirection): TableSortDirection {\n const first = this.firstClickDirection();\n const second = first === 'ascending' ? 'descending' : 'ascending';\n if (current === 'none') return first;\n if (current === first) return second;\n return this.disableClear() ? first : 'none';\n }\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n afterEveryRender,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n type ElementRef,\n inject,\n input,\n model,\n output,\n type Signal,\n type TemplateRef,\n viewChildren,\n type InputSignal,\n} from '@angular/core';\nimport { CssVarNamespacer } from '@angular/platform-browser';\n\nimport { assertInputBound, fortyError, isUnset, unsetInput, type Unset } from 'forty-cdk/core';\n\nimport { ForDraggable, ForDragPlaceholder } from 'forty-cdk/drag-drop';\n\nimport { assertColumnDefConfig, type ForTableColumnDef } from './column-def';\nimport {\n assertTableDefRegistry,\n type BoundColumnDef,\n type ForTableDefRegistry,\n injectOwnTableDefRegistry,\n provideForTableDefRegistry,\n type TableDefRegistry,\n} from './def-registry';\nimport { eventFromInteractiveDescendant } from './interactive-descendant';\nimport { assertRowDefConfig, type ForTableRowDef } from './row-def';\nimport { ForTableCell } from './table-cell';\nimport { ForTableColumnReorder, type TableColumnReorderDescriptor } from './table-column-reorder';\nimport {\n ForTableColumnResizer,\n type TableResizeDescriptor,\n type TableResizeRevertDescriptor,\n} from './table-column-resizer';\nimport { injectTableContext, injectTableRegistration } from './table-context';\nimport { ForTableHeaderCell } from './table-header-cell';\nimport { ForTableHeaderRow } from './table-header-row';\nimport { ForTableRow } from './table-row';\nimport { ForTableRowAttrs } from './table-row-attrs';\nimport {\n ForTableSortHeader,\n type TableSortDescriptor,\n type TableSortDirection,\n} from './table-sort-header';\n\n/**\n * Payload emitted by {@link ForTableBody.rowActivate} when a data row is\n * activated by a pointer click or the `Enter` key (whole-row navigation lists).\n */\nexport interface TableRowActivateEvent<T> {\n /** The activated row's datum. */\n readonly row: T;\n /** The activated row's 0-based dataset index (absolute when virtualized). */\n readonly index: number;\n /** The originating DOM event — a `MouseEvent` for a click, a `KeyboardEvent` for `Enter`. */\n readonly event: Event;\n}\n\n/**\n * Payload emitted by {@link ForTableBody.rowContextMenu} when a data row receives\n * a `contextmenu` event (right-click or the context-menu key).\n */\nexport interface TableRowContextMenuEvent<T> {\n /** The row's datum. */\n readonly row: T;\n /** The row's 0-based dataset index (absolute when virtualized). */\n readonly index: number;\n /** The originating `contextmenu` event; call `preventDefault()` to suppress the native menu. */\n readonly event: MouseEvent;\n}\n\n/** One row `<for-table-body>` renders, resolved from the static or virtualized path. */\ninterface RenderRow<T> {\n /** The row datum, passed to the data-cell template as `$implicit`. */\n readonly datum: T;\n /** Dataset index exposed to the data-cell template as `index` (absolute when virtualized). */\n readonly index: number;\n /** Absolute dataset index when virtualized (drives `[virtualIndex]`), else `null`. */\n readonly virtualIndex: number | null;\n /** Pixel offset for `translateY` when virtualized, else `null` (static flow layout). */\n readonly start: number | null;\n /** Selection identity from `rowKey`, or `undefined` when the row is not selectable (or a variant). */\n readonly value: unknown;\n /** `@for` tracking key: the selection identity, falling back to the dataset index. */\n readonly key: unknown;\n /** The matched full-span row variant, or `null` for a standard per-column row. */\n readonly variant: ForTableRowDef<unknown> | null;\n}\n\n/**\n * Ergonomic declarative renderer for the columns of a `[forTable]`.\n * Place `<for-table-body>` inside a `[forTable]` element and declare one\n * `[forTableColumnDef]` per column; the body harvests the defs and stamps the header\n * row and one data row per item out of the raw cell primitives, so a column is\n * authored in a single block instead of being smeared across header, data, and\n * placeholder rows.\n *\n * **Supported modes: `table` and `grid`.** Each stamped cell's role follows the table `mode`\n * (`cell` or `gridcell`). Choose `mode=\"grid\"` for interactive cells with roving 2D navigation, and\n * the default `mode=\"table\"` for read-only or whole-row navigation lists. `mode=\"treegrid\"` is out\n * of scope — the body stamps no expansion affordances.\n *\n * It owns only the grid **structure**: `display: grid` plus the `grid-template-columns` track\n * derived from each def's `width` and the published `--for-table-col-<name>-width` resize var. All\n * visual styling stays the consumer's, off the `data-*` and role hooks. The host is\n * `display: contents`, so it introduces no box between `[forTable]` and its rows; consumers wanting\n * full DOM control keep using the raw cell primitives.\n *\n * **Defs register themselves through DI rather than being content-queried**, so a preset column\n * component can declare a def in its own view and a scaffold wrapper can project consumer defs into\n * a body it owns (see `defs`). Registrations are exposed in document order, including defs mounted\n * later by `@if` or reordered by `@for`; `displayedColumns` pins an explicit render order on top.\n *\n * **Subclassing is not a supported wrapping shape.** Angular inherits neither `template` nor\n * `imports`, so a subclass renders nothing of the body, and its own `providers` array replaces the\n * one installing the def registry — a subclass missing `provideForTableDefRegistry()` throws a\n * `[forty-cdk/table]` error naming it. Compose the body in a wrapper's template instead.\n *\n * Sort and resize affordances are auto-wired from the per-column `sortable` / `resizable` flags.\n * Sorting stays consumer-applied: the body derives each header's `aria-sort` from `sort` and\n * re-emits activation through `sortChange`. Resize width state can be owned by the body through\n * `[(columnWidths)]`, keyed by column name, with per-def `resizeMin` / `resizeMax` / `resizeStep` /\n * `resizeLargeStep` / `resizeDisabled` / `autoFit` / `fitIncludesHeader` tuning; gesture-end\n * commits still surface through `resizeCommit`.\n * Selection stays consumer-placed — drop `[forTableRowSelector]` / `[forTableSelectAll]` into the\n * cell templates and set `rowKey` to give each row a selection identity.\n *\n * **Virtualization is transparent.** Adding `[forTableVirtualized]` to the same `[forTable]`\n * switches the body to windowed rendering: it renders only the visible slice of `rows`, sizes the\n * rowgroup to the full scroll height and positions each row at its offset. Pass the whole dataset\n * to `rows` — the total is derived from its length, so `[rowCount]` is needed only for a\n * server-known total larger than the loaded rows. Rows are fixed-size by default; set\n * `measureRows` for variable heights, which feeds each rendered row's real height back to the\n * virtualizer.\n *\n * **Row variants.** Declare one or more `[forTableRowDef]` alongside the columns; for each datum\n * the body picks the first whose `[when]` predicate returns `true`, and unmatched data renders the\n * standard per-column row. A `[forTableRowCellDef]` template stamps a full-span row whose single\n * cell spans every column, while the `placeholderCells` flag stamps per-column skeleton cells from\n * each column's `[forTablePlaceholderCellDef]`, falling back to `[forTablePlaceholderCellDefault]`.\n * Variant rows are presentational and non-selectable but still count towards `aria-rowindex` /\n * `aria-rowcount`. A full-span cell registers no cell handle, so arrow keys step over the row;\n * placeholder cells keep the grid rectangular but are stamped disabled, so navigation steps over\n * them too.\n */\n@Component({\n selector: 'for-table-body',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { style: 'display: contents' },\n providers: provideForTableDefRegistry(),\n imports: [\n NgTemplateOutlet,\n ForTableHeaderRow,\n ForTableHeaderCell,\n ForTableCell,\n ForTableRow,\n ForTableRowAttrs,\n ForTableSortHeader,\n ForTableColumnResizer,\n ForTableColumnReorder,\n ForDraggable,\n ForDragPlaceholder,\n ],\n template: `\n <ng-template #headerCellContent let-column let-cell=\"cell\">\n @let col = column.def;\n <ng-container\n [ngTemplateOutlet]=\"col.header()?.template ?? null\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n />\n @if (col.resizable()) {\n <button\n forTableColumnResizer\n [column]=\"column.name\"\n [width]=\"columnWidths()[column.name]\"\n [min]=\"col.resizeMin()\"\n [max]=\"col.resizeMax()\"\n [step]=\"col.resizeStep()\"\n [largeStep]=\"col.resizeLargeStep()\"\n [disabled]=\"col.resizeDisabled()\"\n [autoFit]=\"col.autoFit()\"\n [fitIncludesHeader]=\"col.fitIncludesHeader()\"\n [widthRevert]=\"onColumnWidthRevert\"\n [attr.aria-label]=\"col.resizeAriaLabel()\"\n (widthChange)=\"onColumnWidthChange(column.name, $event)\"\n (resizeCommit)=\"resizeCommit.emit($event)\"\n ></button>\n }\n </ng-template>\n\n @if (hasReorderable()) {\n <div\n forTableHeaderRow\n forTableColumnReorder\n [style.display]=\"'grid'\"\n [style.grid-template-columns]=\"track()\"\n (columnReorder)=\"columnReorder.emit($event)\"\n >\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n @if (col.reorderable()) {\n <div\n #headerCell=\"forTableHeaderCell\"\n forTableHeaderCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.headerClass()\"\n forTableSortHeader\n #sortHeader=\"forTableSortHeader\"\n [column]=\"column.name\"\n [sortable]=\"col.sortable()\"\n [direction]=\"directionFor(column.name)\"\n (sortChange)=\"onSortChange(sortHeader, $event)\"\n forDraggable\n [dragData]=\"column.name\"\n >\n <ng-container\n [ngTemplateOutlet]=\"headerCellContent\"\n [ngTemplateOutletInjector]=\"headerCell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: column, cell: headerCell }\"\n />\n @if (columnDragPlaceholder(); as placeholder) {\n <ng-template forDragPlaceholder>\n <ng-container [ngTemplateOutlet]=\"placeholder.template\" />\n </ng-template>\n }\n </div>\n } @else {\n <div\n #headerCell=\"forTableHeaderCell\"\n forTableHeaderCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.headerClass()\"\n forTableSortHeader\n #sortHeader=\"forTableSortHeader\"\n [column]=\"column.name\"\n [sortable]=\"col.sortable()\"\n [direction]=\"directionFor(column.name)\"\n (sortChange)=\"onSortChange(sortHeader, $event)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"headerCellContent\"\n [ngTemplateOutletInjector]=\"headerCell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: column, cell: headerCell }\"\n />\n </div>\n }\n }\n </div>\n } @else {\n <div forTableHeaderRow [style.display]=\"'grid'\" [style.grid-template-columns]=\"track()\">\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #headerCell=\"forTableHeaderCell\"\n forTableHeaderCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.headerClass()\"\n forTableSortHeader\n #sortHeader=\"forTableSortHeader\"\n [column]=\"column.name\"\n [sortable]=\"col.sortable()\"\n [direction]=\"directionFor(column.name)\"\n (sortChange)=\"onSortChange(sortHeader, $event)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"headerCellContent\"\n [ngTemplateOutletInjector]=\"headerCell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: column, cell: headerCell }\"\n />\n </div>\n }\n </div>\n }\n <div\n role=\"rowgroup\"\n [style.position]=\"sizerHeight() !== null ? 'relative' : null\"\n [style.height.px]=\"sizerHeight()\"\n >\n @if (loading()) {\n @for (placeholder of placeholderRange(); track placeholder) {\n <div forTableRow [style.display]=\"'grid'\" [style.grid-template-columns]=\"track()\">\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #cell=\"forTableCell\"\n forTableCell\n disabled\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.cellClass()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"placeholderTemplateFor(col)\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n />\n </div>\n }\n </div>\n }\n } @else {\n @for (r of renderRows(); track r.key) {\n <div\n #rowRef=\"forTableRow\"\n #rowEl\n forTableRow\n [value]=\"r.value\"\n [virtualIndex]=\"r.virtualIndex\"\n [attr.tabindex]=\"rowTabIndex(r)\"\n [class]=\"rowClassFor(r)\"\n [forTableRowAttrs]=\"rowAttrsFor(r)\"\n [style.display]=\"'grid'\"\n [style.grid-template-columns]=\"track()\"\n [style.position]=\"r.start !== null ? 'absolute' : null\"\n [style.left]=\"r.start !== null ? '0' : null\"\n [style.right]=\"r.start !== null ? '0' : null\"\n [style.transform]=\"r.start !== null ? 'translateY(' + r.start + 'px)' : null\"\n (click)=\"onRowClick(r, $event)\"\n (keydown.enter)=\"onRowEnter(r, $event)\"\n (contextmenu)=\"onRowContextMenu(r, $event)\"\n >\n @if (r.variant; as variant) {\n @if (variant.placeholderCells()) {\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #cell=\"forTableCell\"\n forTableCell\n disabled\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.cellClass()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"placeholderTemplateFor(col)\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n />\n </div>\n }\n } @else {\n <div\n [attr.role]=\"cellRole()\"\n [attr.aria-colindex]=\"1\"\n [attr.aria-colspan]=\"orderedColumns().length\"\n [attr.data-row-variant]=\"''\"\n [style.grid-column]=\"'1 / -1'\"\n >\n <ng-container\n [ngTemplateOutlet]=\"variant.cell()?.template ?? null\"\n [ngTemplateOutletInjector]=\"rowRef.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: r.datum, index: r.index }\"\n />\n </div>\n }\n } @else {\n @for (column of orderedColumns(); track column.name) {\n @let col = column.def;\n <div\n #cell=\"forTableCell\"\n forTableCell\n [name]=\"column.name\"\n [sticky]=\"col.sticky()\"\n [class]=\"col.cellClass()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"col.dataCell()?.template ?? null\"\n [ngTemplateOutletInjector]=\"cell.injector\"\n [ngTemplateOutletContext]=\"{ $implicit: r.datum, index: r.index }\"\n />\n </div>\n }\n }\n </div>\n }\n }\n </div>\n <ng-content />\n `,\n})\nexport class ForTableBody<T = unknown> {\n readonly #ctx = injectTableContext('ForTableBody');\n readonly #registration = injectTableRegistration('ForTableBody');\n readonly #namespacer = inject(CssVarNamespacer);\n\n private readonly rowEls = viewChildren<ElementRef<HTMLElement>>('rowEl');\n readonly #measuredAt = new WeakMap<HTMLElement, string>();\n\n constructor() {\n const bodyRowCount = computed(() =>\n this.loading() ? Math.max(0, this.placeholderRows()) : this.#data().length,\n );\n assertInputBound(this.rows, 'table', '<for-table-body>', 'rows');\n this.#registration.registerBodyRowCount(bodyRowCount);\n inject(DestroyRef).onDestroy(() => this.#registration.registerBodyRowCount(null));\n this.#publishColumnWidths();\n\n afterEveryRender(() => {\n const window = this.#registration.virtualWindow();\n if (!window || !this.measureRows()) {\n return;\n }\n for (const ref of this.rowEls()) {\n const el = ref.nativeElement;\n const index = el.getAttribute('data-index');\n if (index === null || this.#measuredAt.get(el) === index) {\n continue;\n }\n this.#measuredAt.set(el, index);\n window.measureRow(el);\n }\n window.measureRow(null);\n });\n }\n\n /**\n * The rows to render — already sorted / filtered / paged by the consumer (BYO-data). Mandatory —\n * a body with no binding throws in dev mode.\n */\n readonly rows: InputSignal<readonly T[] | Unset> = input(unsetInput<readonly T[]>());\n\n readonly #data = computed<readonly T[]>(() => {\n const rows = this.rows();\n return isUnset(rows) ? [] : rows;\n });\n\n /**\n * Row identity used both for `@for` tracking and each row's selection `[value]`.\n * Omit it for non-selectable, index-tracked tables.\n */\n readonly rowKey = input<(row: T, index: number) => unknown>();\n\n /**\n * Which columns render, in order. Defaults to every registered `[forTableColumnDef]`\n * in document order. Names not matching a registered column are skipped.\n */\n readonly displayedColumns = input<readonly string[] | null>(null);\n\n /**\n * The single active sort descriptor. Each `sortable` column derives its\n * `aria-sort` from it (the \"one sorted column\" rule); the consumer updates it\n * from `sortChange` and re-sorts `rows`. An activation the consumer does not\n * adopt leaves every header's `aria-sort` where `sort` puts it.\n */\n readonly sort = input<TableSortDescriptor | null>(null);\n\n /**\n * When set, render `placeholderRows` skeleton rows instead of data. Each cell\n * stamps the column's own `[forTablePlaceholderCellDef]`, else the body-level\n * `[forTablePlaceholderCellDefault]`, else nothing.\n */\n readonly loading = input(false, { transform: booleanAttribute });\n\n /** Number of placeholder rows rendered while `loading`. Default `3`. */\n readonly placeholderRows = input(3);\n\n /**\n * Opt in to **measured (variable) row heights** under `[forTableVirtualized]`.\n * When set, the body measures each stamped row after render and feeds its real\n * height back to the virtualizer, which replaces the `estimateRowSize` estimate\n * and re-aligns the offsets of the rows below — so a window mixing row shapes\n * (denser variant rows, group separators) stays contiguous after scroll.\n *\n * Off by default: a uniform-height table keeps the pure `estimateRowSize` fast\n * path with no per-row measurement work. Has no effect without\n * `[forTableVirtualized]` (there is no window to measure against).\n *\n * Measurement is not one-shot. The body's per-render measure is throttled per\n * `data-index`, so it covers only a row's initial post-render measurement and any\n * row recycled to a new index. Subsequent size changes of the **same mounted row**\n * (async content, image load, cell reflow) are re-measured automatically by the\n * virtualizer's own `ResizeObserver` — which re-aligns the offsets of the rows below\n * without any consumer action — so a row whose content loads asynchronously needs no\n * manual re-measure trigger.\n */\n readonly measureRows = input(false, { transform: booleanAttribute });\n\n /** Fires when a `sortable` header is activated; forwarded from the internal `[forTableSortHeader]`. */\n readonly sortChange = output<TableSortDescriptor>();\n\n /** Fires when a `resizable` column commits a width; forwarded from the internal `[forTableColumnResizer]`. */\n readonly resizeCommit = output<TableResizeDescriptor>();\n\n /**\n * Fires once per committed column reorder gesture (pointer drop or keyboard drop),\n * forwarded unchanged from the internal `[forTableColumnReorder]`. Its `from` / `to`\n * are indices into the **full displayed column order** (counting non-reorderable\n * columns), so a table with fixed columns applies `moveItemInArray(displayedColumns,\n * from, to)` over the whole `displayedColumns` array. Its `columns` lists the\n * reorderable columns in their new order (equal to the full displayed order only when\n * every displayed column is `reorderable`) — setting `displayedColumns` directly to\n * `columns` is valid only in that all-reorderable case, otherwise the fixed columns\n * are dropped. Only present when at least one `[forTableColumnDef]` is `reorderable`.\n */\n readonly columnReorder = output<TableColumnReorderDescriptor>();\n\n /**\n * Two-way map of column widths (px), keyed by column `name`. A width in the map\n * sizes its displayed column's grid track whether or not the column is\n * `resizable`, and a column whose `resizable` turns off keeps it. It also seeds\n * each `resizable` column's stamped handle `[width]`, so the `role=\"separator\"`\n * handle exposes `aria-valuenow` from the first render, and is updated immutably\n * on every live width change the handle reports (pointer drag, keyboard resize,\n * auto-fit), including the pre-drag revert of a handle destroyed mid-drag. A\n * cancelled gesture on a column the map held no width for removes the key again.\n * Names that match no displayed column are ignored.\n *\n * The map is JSON-serializable, so persisting a user's column layout is\n * `[(columnWidths)]` plus one storage write. Together with `[displayedColumns]`\n * and `[sort]` it makes the full user-configurable table state three bindings.\n * Its implicit `columnWidthsChange` fires only on handle-driven updates, not on\n * consumer writes through `[(columnWidths)]`.\n */\n readonly columnWidths = model<Readonly<Record<string, number>>>({});\n\n /**\n * Opt-in whole-row interaction for **navigation lists**. When set, a pointer click\n * on a data row emits `rowActivate` and a `contextmenu` (right-click or the\n * context-menu key) emits `rowContextMenu`, in every `mode`. Full-span\n * `[forTableRowDef]` variant rows stay non-interactive.\n *\n * The **keyboard** half depends on `mode`. In the default `mode=\"table\"` each data row\n * also becomes a focusable tab stop (`tabindex=\"0\"`) and `Enter` emits `rowActivate`.\n * In `grid` / `treegrid` mode the row takes no tab stop, so the roving 2D navigation\n * stays intact: `Enter` on a focused data cell emits `rowActivate` when the cell holds\n * no widget to enter (the root's `cellActivate`), and enters the widget otherwise.\n *\n * Pair it with `selectionBehavior=\"none\"` on the root to get the \"checkbox selects,\n * row opens the record\" shape: with any other behavior a row click in a selectable\n * grid both activates the row and mutates the selection.\n *\n * Interactive content inside a data cell owns its own events: a click or `Enter` originating from\n * a `button`, `a[href]`, `input`, `select`, `textarea`, `summary`, `label`,\n * `audio` / `video[controls]`, an editable `contenteditable` region, or an element carrying an\n * interactive ARIA role does **not** emit `rowActivate`, and its native default action is left\n * intact. The row still activates from anywhere else — cell text, the gaps between cells, or the\n * focused row host.\n *\n * `rowContextMenu` is unguarded, so a right-click over an inner control still offers\n * the row's context menu, matching native lists.\n */\n readonly interactiveRows = input(false, { transform: booleanAttribute });\n\n /**\n * Fires when a data row is activated by a pointer click, by `Enter` on the row in\n * `mode=\"table\"`, or by `Enter` on a widget-free data cell in `grid` / `treegrid`,\n * carrying the row datum, its dataset index, and the originating event. Requires\n * `interactiveRows`.\n */\n readonly rowActivate = output<TableRowActivateEvent<T>>();\n\n /**\n * Fires when a data row receives a `contextmenu` event (right-click or the\n * context-menu key), carrying the row datum, its dataset index, and the event —\n * position your own overlay from it. Requires `interactiveRows`.\n */\n readonly rowContextMenu = output<TableRowContextMenuEvent<T>>();\n\n /**\n * Per-row class hook, applied to data **and** variant rows in **every** mode.\n * Receives the row datum and its 0-based dataset index and returns the class(es)\n * to apply — a string, a `{ className: boolean }` map, or `undefined` for none.\n * This is the only seam for styling a body-owned row from its datum (an\n * \"active\" / \"menu-open\" highlight, error or dimmed rows). Evaluated on every\n * change-detection pass, so keep it cheap and free of side effects.\n */\n readonly rowClass =\n input<(row: T, index: number) => string | Record<string, boolean> | undefined>();\n\n /**\n * Per-row attribute hook, applied to data **and** variant rows in **every**\n * mode. Receives the row datum and its 0-based dataset index and returns an\n * attribute map to reflect on the row host; a key mapped to `null` (or dropped\n * from a later map) removes that attribute. Evaluated on every change-detection\n * pass, so keep it cheap and free of side effects.\n */\n readonly rowAttrs = input<(row: T, index: number) => Record<string, string | null> | undefined>();\n\n /**\n * An external def registry to render from, for a **scaffold wrapper**: a\n * component whose template owns the `[forTable]` shell and this body, and whose\n * consumers declare their `[forTableColumnDef]` / `[forTableRowDef]` blocks as projected\n * content. Those defs are content of the wrapper, not of this body, so they\n * register with the wrapper's own registry — provide one with\n * `provideForTableDefRegistry()` and bind `inject(FOR_TABLE_DEF_REGISTRY)` here.\n *\n * When set, this registry **replaces** the body's own: defs the wrapper declares\n * inside the `<for-table-body>` tags would register with the body instead and be\n * ignored, so the body throws rather than dropping them — declare a wrapper's\n * own defs next to the projected ones (outside the body element), where they\n * reach the same registry. Defaults to `null` (the body renders the defs\n * declared in its own content).\n */\n readonly defs = input<ForTableDefRegistry | null>(null);\n\n readonly #ownDefs = injectOwnTableDefRegistry();\n\n readonly #defs = computed<TableDefRegistry>(() => {\n const external = this.defs();\n if (!external) {\n return this.#ownDefs;\n }\n const registry = assertTableDefRegistry(external);\n if (!this.#ownDefs.isEmpty()) {\n throw fortyError({\n code: 'FORCDK-TABLE-004',\n message:\n '<for-table-body> was given a [defs] registry and also has def(s) declared inside its ' +\n 'own tags, which are ignored.',\n cause: 'The body renders exactly one registry: the one bound to [defs].',\n fix:\n 'Declare those defs alongside the projected ones, outside the <for-table-body> element, ' +\n 'so they register with the same registry.',\n });\n }\n return registry;\n });\n\n /** The registered column definitions, in document order. */\n private readonly columns = computed(() => this.#defs().columnDefs());\n\n /** The registered full-span row variants, in document order (first match wins per datum). */\n private readonly rowDefs = computed(() => this.#defs().rowDefs());\n\n /** The optional shared drag placeholder for reorderable columns, or `null`. */\n private readonly columnDragPlaceholder = computed(() => this.#defs().columnDragPlaceholder());\n\n /** The optional body-level default placeholder-cell template, or `null`. */\n private readonly placeholderCellDefault = computed(() => this.#defs().placeholderCellDefault());\n\n /**\n * Resolves the placeholder template a column stamps into its cell, in both\n * stamping paths: the column's own `[forTablePlaceholderCellDef]`, else the body-level\n * `[forTablePlaceholderCellDefault]`, else `null` for an empty cell.\n */\n private placeholderTemplateFor(col: ForTableColumnDef): TemplateRef<unknown> | null {\n return col.placeholderCell()?.template ?? this.placeholderCellDefault()?.template ?? null;\n }\n\n /** The role a stamped cell carries: `'cell'` in `table` mode, `'gridcell'` otherwise. */\n private readonly cellRole = computed(() => (this.#ctx.mode() === 'table' ? 'cell' : 'gridcell'));\n\n /** The columns to render, resolved from `displayedColumns` (or all defs, in order). */\n private readonly orderedColumns = computed<readonly BoundColumnDef[]>(() => {\n const columns = this.columns();\n const order = this.displayedColumns();\n if (!order) {\n return columns;\n }\n const byName = new Map(columns.map((column) => [column.name, column]));\n return order\n .map((name) => byName.get(name))\n .filter((column): column is BoundColumnDef => column != null);\n });\n\n /**\n * `true` when at least one displayed column is `reorderable`, switching the stamped\n * header row to the drag-reorder path (`[forTableColumnReorder]` + per-cell\n * `[forDraggable]`). A body with no reorderable column keeps the plain header row.\n */\n private readonly hasReorderable = computed(() =>\n this.orderedColumns().some((column) => column.def.reorderable()),\n );\n\n /**\n * The derived `grid-template-columns` track, applied to the header row and every\n * data row and exposed for consumers who want to bind it elsewhere. Each column\n * contributes its `width`, or the published resize var falling back to the column's\n * `fallbackWidth` (`minmax(0, 1fr)` when that is unset too).\n */\n readonly track: Signal<string> = computed(() =>\n this.orderedColumns()\n .map(({ def, name }) => {\n assertColumnDefConfig(def, name);\n return (\n def.width() ??\n `var(${this.#namespacer.namespace(`--for-table-col-${name}-width`)}, ${def.fallbackWidth() ?? 'minmax(0, 1fr)'})`\n );\n })\n .join(' '),\n );\n\n /**\n * The rows to render this change-detection pass. When `[forTableVirtualized]`\n * has published a window it maps the window's slice into `rows` (absolute\n * index + pixel offset per row); otherwise it maps every row in flow order.\n */\n private readonly renderRows = computed<readonly RenderRow<T>[]>(() => {\n const window = this.#registration.virtualWindow();\n const data = this.#data();\n const key = this.rowKey();\n const variants = this.rowDefs();\n for (const { def } of variants) {\n assertRowDefConfig(def);\n }\n const matchVariant = (datum: T, index: number): ForTableRowDef<unknown> | null =>\n variants.find(({ when }) => when(datum, index))?.def ?? null;\n if (window) {\n const out: RenderRow<T>[] = [];\n for (const vrow of window.rows()) {\n const datum = data[vrow.index];\n if (datum === undefined) {\n continue;\n }\n const identity = key?.(datum, vrow.index);\n const variant = matchVariant(datum, vrow.index);\n out.push({\n datum,\n index: vrow.index,\n virtualIndex: vrow.index,\n start: vrow.start,\n value: variant ? undefined : identity,\n key: identity ?? vrow.index,\n variant,\n });\n }\n return out;\n }\n return data.map((datum, i) => {\n const identity = key?.(datum, i);\n const variant = matchVariant(datum, i);\n return {\n datum,\n index: i,\n virtualIndex: null,\n start: null,\n value: variant ? undefined : identity,\n key: identity ?? i,\n variant,\n };\n });\n });\n\n /** Full scroll height (px) applied to the rowgroup when virtualized, else `null` (natural height). */\n private readonly sizerHeight = computed<number | null>(() => {\n const window = this.#registration.virtualWindow();\n return window && !this.loading() ? window.totalSize() : null;\n });\n\n private readonly placeholderRange = computed(() =>\n Array.from({ length: Math.max(0, this.placeholderRows()) }, (_, i) => i),\n );\n\n /** Resolves a `sortable` column's current direction from the single `sort` descriptor. */\n private directionFor(column: string): TableSortDirection {\n const descriptor = this.sort();\n return descriptor && descriptor.column === column ? descriptor.direction : 'none';\n }\n\n /**\n * Whether the keyboard half of whole-row interaction is active: opted in via\n * `interactiveRows` and in `table` mode, the only mode where a row may own a tab\n * stop and `Enter` without colliding with the roving grid's cell-entry.\n */\n private readonly rowsKeyboardInteractive = computed(\n () => this.interactiveRows() && this.#ctx.mode() === 'table',\n );\n\n /** The `tabindex` for a stamped row: `0` for a keyboard-interactive data row, `null` otherwise. */\n private rowTabIndex(row: RenderRow<T>): 0 | null {\n return this.rowsKeyboardInteractive() && !row.variant ? 0 : null;\n }\n\n /** Resolves the `rowClass` hook for a stamped row, or `undefined` when unset. */\n private rowClassFor(row: RenderRow<T>): string | Record<string, boolean> | undefined {\n return this.rowClass()?.(row.datum, row.index);\n }\n\n /** Resolves the `rowAttrs` hook for a stamped row, or `undefined` when unset. */\n private rowAttrsFor(row: RenderRow<T>): Record<string, string | null> | undefined {\n return this.rowAttrs()?.(row.datum, row.index);\n }\n\n /**\n * Publishes `--for-table-col-<name>-width` for every displayed column the `[(columnWidths)]` map\n * holds a width for, whether or not the column is `resizable`, and removes the var of a column\n * that leaves the map or the displayed set, or when the body unmounts. The map owns the width:\n * a stamped handle only reports changes into it, so turning `resizable` off keeps the track.\n */\n #publishColumnWidths(): void {\n let published = new Set<string>();\n effect(() => {\n const widths = this.columnWidths();\n const next = new Set<string>();\n for (const { name } of this.orderedColumns()) {\n const width = widths[name];\n if (width != null) {\n this.#registration.setColumnWidth(name, width);\n next.add(name);\n }\n }\n for (const name of published) {\n if (!next.has(name)) {\n this.#registration.removeColumnWidth(name);\n }\n }\n published = next;\n });\n inject(DestroyRef).onDestroy(() => {\n for (const name of published) {\n this.#registration.removeColumnWidth(name);\n }\n });\n }\n\n /**\n * Folds a stamped resizer's live width update into the `[(columnWidths)]` map\n * immutably, keyed by the column name. An `undefined` width — a cancelled gesture on a\n * column that had no width — removes the key, so the column keeps following its\n * `fallbackWidth`. No-ops when the map already holds the value, so seeding the handle\n * from `columnWidths` never loops back into a redundant model write.\n */\n private onColumnWidthChange(column: string, width: number | undefined): void {\n const current = this.columnWidths();\n if (width === undefined) {\n if (!Object.hasOwn(current, column)) {\n return;\n }\n const next = { ...current };\n delete next[column];\n this.columnWidths.set(next);\n return;\n }\n if (current[column] === width) {\n return;\n }\n this.columnWidths.set({ ...current, [column]: width });\n }\n\n /**\n * Folds a stamped resizer's teardown revert into `[(columnWidths)]`, so a handle destroyed\n * mid-drag — its column dropped from `displayedColumns`, or `resizable` toggled off — does not\n * leave the transient drag width in the map.\n *\n * A function reference rather than an output, because the revert happens during the handle's\n * teardown. The body outlives it, so its own `columnWidthsChange` still reaches the consumer.\n */\n private readonly onColumnWidthRevert = (descriptor: TableResizeRevertDescriptor): void => {\n this.onColumnWidthChange(descriptor.column, descriptor.width);\n };\n\n /**\n * Re-emits a stamped header's activation through `sortChange`, then puts the header's\n * direction back on `sort`. The header writes the direction it computed into its own model,\n * and the `[direction]` binding is pushed again only when `sort` changes, so a consumer that\n * ignores the event would otherwise leave the header announcing a sort `sort` does not hold.\n */\n private onSortChange(header: ForTableSortHeader, descriptor: TableSortDescriptor): void {\n header.direction.set(this.directionFor(descriptor.column));\n this.sortChange.emit(descriptor);\n }\n\n private onRowClick(row: RenderRow<T>, event: MouseEvent): void {\n if (this.interactiveRows()) {\n this.#activateRow(row, event);\n }\n }\n\n private onRowEnter(row: RenderRow<T>, event: Event): void {\n if (this.rowsKeyboardInteractive()) {\n if (this.#activateRow(row, event)) {\n event.preventDefault();\n }\n return;\n }\n if (this.interactiveRows() && this.#ctx.isCellActivation(event)) {\n this.#activateRow(row, event);\n }\n }\n\n private onRowContextMenu(row: RenderRow<T>, event: MouseEvent): void {\n if (!this.interactiveRows() || row.variant) {\n return;\n }\n this.rowContextMenu.emit({ row: row.datum, index: row.index, event });\n }\n\n #activateRow(row: RenderRow<T>, event: Event): boolean {\n if (row.variant || eventFromInteractiveDescendant(event)) {\n return false;\n }\n this.rowActivate.emit({ row: row.datum, index: row.index, event });\n return true;\n }\n}\n","import { computed, Directive } from '@angular/core';\n\nimport { injectTableContext } from './table-context';\n\n/**\n * Marks the single full-span cell of a presentational row — a group separator, a\n * section header, a summary line — authored with the raw primitives. Emits the\n * markup `<for-table-body>` stamps for a `[forTableRowCellDef]` variant row: the\n * `role` derived from the root's `mode` (`'cell'` in `table` mode, `'gridcell'`\n * otherwise), `aria-colindex=\"1\"`, an `aria-colspan` covering the grid's rendered\n * columns, and the `data-row-variant` styling hook.\n *\n * Unlike `[forTableCell]` it registers **no** cell handle, which is the whole point:\n * in `grid` / `treegrid` mode the row contributes nothing to the roving grid, so\n * arrow navigation steps over it, the column count keeps coming from the data rows\n * around it, and the header row still joins the composite tab stop. Spanning the row\n * visually stays the consumer's CSS (`grid-column: 1 / -1`, or a `colspan` attribute\n * in a native `<table>`).\n */\n@Directive({\n selector: '[forTableVariantCell]',\n exportAs: 'forTableVariantCell',\n host: {\n 'data-row-variant': '',\n '[attr.role]': 'role()',\n '[attr.aria-colindex]': '1',\n '[attr.aria-colspan]': 'colSpan()',\n },\n})\nexport class ForTableVariantCell {\n readonly #ctx = injectTableContext('ForTableVariantCell');\n\n private readonly role = computed(() => (this.#ctx.mode() === 'table' ? 'cell' : 'gridcell'));\n\n private readonly colSpan = computed<number | null>(() => {\n const cols = this.#ctx.columnCount();\n return cols > 0 ? cols : null;\n });\n}\n","import { computed, Directive, input } from '@angular/core';\n\nimport { hostAriaLabel, hostButtonType } from 'forty-cdk/core';\n\nimport { injectTableCellTabIndex } from './cell-tab-index';\nimport { injectTableContext, injectTableRowContext } from './table-context';\n\n/**\n * Accessible per-row selection checkbox inside a `[forTableRow]`. Renders\n * `role=\"checkbox\"` reflecting the row's selection via `aria-checked=\"true\" | \"false\"`\n * and `data-state=\"checked\" | \"unchecked\"` for styling. Clicking (or Space / Enter\n * while focused) toggles the row's selection.\n *\n * In `mode=\"table\"` it is the focusable keyboard selection path: it is a standalone\n * tab stop (`tabindex=\"0\"`), reached with `Tab` and toggled with `Space` / `Enter`.\n * In `grid` / `treegrid` mode it yields its tab stop to the composite roving grid\n * (`tabindex=\"-1\"`) — selection is driven from the cell (`Space`) — but it stays a\n * named, non-hidden checkbox in the accessibility tree.\n *\n * Give it an accessible name via `ariaLabel` (or an external label). The enclosing\n * row still owns the row-level `aria-selected`.\n */\n@Directive({\n selector: '[forTableRowSelector]',\n exportAs: 'forTableRowSelector',\n host: {\n role: 'checkbox',\n '[attr.type]': 'buttonType()',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-checked]': 'ariaChecked()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.data-state]': 'dataState()',\n '(click)': 'onClick($event)',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableRowSelector {\n private readonly ctx = injectTableContext('ForTableRowSelector');\n private readonly row = injectTableRowContext('ForTableRowSelector');\n\n /** Accessible label for the selection checkbox (e.g. \"Select row\"). Truthy-only. */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ariaLabel() || null);\n\n private readonly tabindex = injectTableCellTabIndex();\n\n private readonly buttonType = hostButtonType();\n\n private readonly ariaChecked = computed<'true' | 'false'>(() =>\n this.row.selected() ? 'true' : 'false',\n );\n\n private readonly dataState = computed(() => (this.row.selected() ? 'checked' : 'unchecked'));\n\n private onClick(event: MouseEvent): void {\n event.stopPropagation();\n this.row.toggleSelected();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.row.toggleSelected();\n }\n }\n}\n","import { computed, Directive, input, output } from '@angular/core';\n\nimport { hostAriaLabel, hostButtonType } from 'forty-cdk/core';\n\nimport { injectTableCellTabIndex } from './cell-tab-index';\nimport { injectTableContext, type TableSelectAllState } from './table-context';\n\n/**\n * Header \"select all\" checkbox for a `[forTable]` in `selectionMode=\"multiple\"`.\n * Reflects `aria-checked=\"true\" | \"false\" | \"mixed\"` and\n * `data-state=\"checked\" | \"unchecked\" | \"indeterminate\"` derived from how many\n * selectable rows are selected. Clicking (or Space / Enter) selects all rows\n * when none/some are selected, and deselects them when all are, keeping selected\n * values outside the selectable rows. No-op outside multiple mode.\n *\n * Bind `[state]` to drive it from a selection the table cannot enumerate (a\n * server-side \"every row matching the filter\" predicate): the checkbox then\n * reflects that state and emits `toggleAll` instead of writing the table's\n * `[(value)]`.\n *\n * In `mode=\"table\"` it is a standalone tab stop (`tabindex=\"0\"`) and can sit on any\n * focusable element (a `<span>` you make tabbable, or a `<button>`, which it forces to\n * `type=\"button\"` so toggling never submits a surrounding `<form>`).\n * In `mode=\"grid\"` / `\"treegrid\"` it yields its tab stop to the composite roving grid\n * (`tabindex=\"-1\"`) and is reached via cell-entry (Enter / F2, then `Tab` when it is not\n * the cell's first widget), so it must sit on a natively-focusable element (a\n * `<button>`) — a `tabindex`-only `<span>` is cell-entry-reachable only in\n * `mode=\"table\"`. A grid whose header row does not join the grid leaves it a standalone\n * tab stop (`tabindex=\"0\"`), since no cell entry reaches it there.\n */\n@Directive({\n selector: '[forTableSelectAll]',\n exportAs: 'forTableSelectAll',\n host: {\n role: 'checkbox',\n '[attr.type]': 'buttonType()',\n '[attr.tabindex]': 'tabindex()',\n '[attr.aria-checked]': 'ariaChecked()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.data-state]': 'dataState()',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n },\n})\nexport class ForTableSelectAll {\n private readonly ctx = injectTableContext('ForTableSelectAll');\n\n /** Accessible label for the control (e.g. \"Select all rows\"). Truthy-only. */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Externally owned tri-state. When `null` (default) the checkbox reflects the table's\n * own aggregate over `[selectableValues]` or the rendered rows, and an activation\n * toggles the table's `[(value)]`. When bound, `aria-checked` / `data-state` follow it\n * and an activation emits `toggleAll` instead, leaving the table's `value` untouched.\n */\n readonly state = input<TableSelectAllState | null>(null);\n\n /**\n * Fires on a click, `Space` or `Enter` while `[state]` is bound. The consumer updates\n * the selection it owns; never fires while `[state]` is `null`.\n */\n readonly toggleAll = output<void>();\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ariaLabel() || null);\n\n private readonly tabindex = injectTableCellTabIndex();\n\n private readonly buttonType = hostButtonType();\n\n readonly #resolvedState = computed(() => this.state() ?? this.ctx.selectAllState());\n\n private readonly ariaChecked = computed<'true' | 'false' | 'mixed'>(() => {\n const state = this.#resolvedState();\n return state === 'all' ? 'true' : state === 'some' ? 'mixed' : 'false';\n });\n\n private readonly dataState = computed(() => {\n const state = this.#resolvedState();\n return state === 'all' ? 'checked' : state === 'some' ? 'indeterminate' : 'unchecked';\n });\n\n private onClick(): void {\n this.#toggle();\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.#toggle();\n }\n }\n\n #toggle(): void {\n if (this.state() === null) {\n this.ctx.toggleSelectAll();\n } else {\n this.toggleAll.emit();\n }\n }\n}\n","import { DestroyRef, Directive, ElementRef, inject } from '@angular/core';\n\nimport { orphanContextError } from 'forty-cdk/core';\nimport { ForTableHeaderCell } from './table-header-cell';\n\n/**\n * Marks the element inside a `[forTableHeaderCell]` that carries the column's\n * label text. It owns no role, ARIA, or DOM of its own — it is a structure-agnostic\n * hook so a sibling `[forTableColumnResizer]` with `[fitIncludesHeader]` can measure\n * the header label in isolation, ignoring the resize handle, sort affordance, and any\n * other header chrome. Wrap only the text you want the header-inclusive auto-fit to\n * account for.\n *\n * @example\n * ```html\n * <th forTableHeaderCell name=\"dept\">\n * <span forTableColumnLabel>Department</span>\n * <button forTableColumnResizer column=\"dept\" fitIncludesHeader [(width)]=\"deptWidth\"\n * aria-label=\"Resize Department column\"></button>\n * </th>\n * ```\n */\n@Directive({\n selector: '[forTableColumnLabel]',\n exportAs: 'forTableColumnLabel',\n})\nexport class ForTableColumnLabel {\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #headerCell = inject(ForTableHeaderCell, { optional: true });\n\n constructor() {\n if (!this.#headerCell) {\n throw orphanContextError({\n code: 'FORCDK-TABLE-006',\n piece: 'ForTableColumnLabel',\n root: '[forTableHeaderCell]',\n token: 'ForTableHeaderCell',\n });\n }\n this.#headerCell.registerLabel(this.#host);\n inject(DestroyRef).onDestroy(() => this.#headerCell?.unregisterLabel(this.#host));\n }\n}\n","import {\n DestroyRef,\n Directive,\n DOCUMENT,\n effect,\n ElementRef,\n inject,\n Injector,\n output,\n PLATFORM_ID,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\nimport {\n FOR_DRAG_DROP_DEFAULTS,\n FOR_DROP_LIST_COORDINATOR,\n FOR_DROP_LIST_ROVING_DELEGATE,\n ForDropList,\n type ForDragDropEvent,\n type ForDropListRovingDelegate,\n} from 'forty-cdk/drag-drop';\nimport {\n arbitrateLiftPress,\n consumeUnmappedLiftedKey,\n createKeyboardDragMediator,\n createPointerDragSession,\n type DragAnnouncedItem,\n type DragAnnouncedPosition,\n DragAnnouncer,\n findPressedDragItem,\n focusWhenMounted,\n type FocusWhenMountedRef,\n isDragLiftKey,\n layoutPlaceholderInSlot,\n LiveAnnouncer,\n type PointerDragSession,\n resolveLiftedDragControl,\n resolvePressedDragItem,\n resolveWindowedReorder,\n stepDragTarget,\n isHistoryChord,\n} from 'forty-cdk/core';\nimport { isInteractiveDescendant } from './interactive-descendant';\nimport { injectTableContext, injectTableRegistration } from './table-context';\n\nconst POINTER_ARM_THRESHOLD_PX = 5;\n\ntype ReorderMode = 'idle' | 'keyboard' | 'pointer';\n\nconst LIFTED_NAV_KEYS: ReadonlySet<string> = new Set([\n 'ArrowDown',\n 'ArrowUp',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n 'PageDown',\n 'PageUp',\n]);\n\n/** Payload of `rowReorder`: the previous and new row index. */\nexport interface TableRowReorderDescriptor {\n /** Previous row index (0-based). Absolute (dataset) index under virtualization, else rendered order. */\n from: number;\n /** New row index (0-based). Absolute (dataset) index under virtualization, else rendered order. */\n to: number;\n}\n\n/**\n * Opt-in **row reordering** for `ForTable`, composed over the drag-drop primitive.\n *\n * Apply on the rowgroup element that wraps the data rows (`<div role=\"rowgroup\">` in\n * `<div>` mode, `<tbody>` in native `<table>` mode). It wraps `[forDropList]` (via\n * `hostDirectives`, vertical by default) so the rows become a reorderable list, then\n * translates drag-drop's generic drop into the table-friendly `rowReorder` output. Mark\n * each `[forTableRow]` as `[forDraggable]` with a `[dragData]`. On a committed drop it\n * emits the previous / new index; the consumer applies the move to their own row array\n * (e.g. `moveItemInArray`). **It never reorders rows itself** (BYO-data).\n *\n * In `mode=\"grid\"` / `mode=\"treegrid\"` the draggable rows **yield their tab stop** to the\n * table's composite roving grid, keeping the **single tab stop** the WAI-ARIA Data Grid\n * pattern calls for. Keyboard reordering is therefore initiated from a focused **cell**:\n * press `Ctrl`/`Cmd`+`Space` on any cell to lift the enclosing row, then `ArrowUp` /\n * `ArrowDown` (`Home` / `End`, `PageUp` / `PageDown`) move the target, `Space` / `Enter`\n * drop, and `Escape` / `Tab` cancel. Idle Arrow keys stay grid navigation, and `Space` still\n * selects the row when a selection mode is set. In the static `mode=\"table\"` the rowgroup\n * keeps its own draggable-owned tab stop and the plain `Space` / `Enter` lift on a focused\n * row. A lift key pressed on an interactive control inside a row (a button, an input, a\n * `[forTableRowSelector]`, the set `eventFromInteractiveDescendant` defines) stays that\n * control's own key.\n *\n * Under `[forTableVirtualized]`, `rowReorder` emits **absolute** dataset indices so\n * `moveItemInArray` over the full array moves the right row; a non-virtualized table emits\n * rendered-order indices. Pointer drag works within the rendered window and reaches rows\n * beyond it via auto-scroll; keyboard reorder steps the target across every row the\n * virtualizer can place (`[virtualRowCount]`, else `[rowCount]`), scrolling unmounted rows into\n * view. Holding **Shift** during a pointer drag engages **windowed scrub** — the scroll viewport\n * maps onto the same rows (top edge → row 0, bottom edge → the last placeable row) so a single\n * gesture can drop the lifted row at an arbitrary far row.\n *\n * Under `[forTableVirtualized]` a `[forDragPlaceholder]` takes the lifted row's inline position,\n * insets, size and transform, so it stands in the row's slot. `[liveSort]` parts no rows there:\n * the rows are positioned by transform, and the placeholder keeps marking the source slot.\n *\n * Every lift, move and drop announcement counts the positions `rowReorder` reports, out of the\n * placeable rows under virtualization, pointer and keyboard alike, and each row's `[forDraggable]`\n * emits `dragStart` / `dragEnd` for a keyboard gesture as it does for a pointer one. The rowgroup\n * is a **closed** list: it joins no `[forDropListGroup]` and connects to no other `[forDropList]`,\n * so no row is transferred into or out of it.\n *\n * Focus leaving the rowgroup cancels a keyboard lift. A window recycle that briefly blurs\n * the retained lifted row does not: focus returns to it once the window settles.\n *\n * **One gesture at a time.** Pointer and keyboard reorder are mutually exclusive: while a\n * keyboard lift is live, a press on the lifted row arms nothing and a press on any other row\n * cancels the lift, so a drag that follows is an ordinary pointer gesture. A lift key pressed\n * during a pointer drag is ignored.\n *\n * A pointer press is refused outright when the rowgroup is `disabled`, when a **mouse** press\n * uses a non-primary button (touch and pen presses keep whatever `button` their engine\n * reports), when the pressed row carries no registered `[forDraggable]` or its draggable\n * is `[dragDisabled]`, or when the row's own guard refuses the press (it lands outside the row's\n * `[forDragHandle]`, or inside a draggable nested in it). Rows are resolved through the table's\n * registered rows, so a row whose `[forTableRow]` or `[forDraggable]` arrives through\n * `hostDirectives` or a subclass is found like a template-applied one.\n *\n * @example\n * ```html\n * <div role=\"rowgroup\" forTableRowReorder (rowReorder)=\"onReorder($event)\">\n * @for (row of rows(); track row.id) {\n * <div forTableRow [value]=\"row.id\" forDraggable [dragData]=\"row.id\">…</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forTableRowReorder]',\n exportAs: 'forTableRowReorder',\n providers: [\n { provide: FOR_DROP_LIST_COORDINATOR, useExisting: ForTableRowReorder },\n {\n provide: FOR_DROP_LIST_ROVING_DELEGATE,\n useFactory: (): ForDropListRovingDelegate => {\n const ctx = injectTableContext('ForTableRowReorder');\n return {\n itemTabindex: () => (ctx.mode() !== 'table' ? -1 : null),\n isItemHighlighted: () => (ctx.mode() !== 'table' ? false : null),\n };\n },\n },\n ],\n hostDirectives: [\n {\n directive: ForDropList,\n inputs: [\n 'dir',\n 'disabled',\n 'autoScroll',\n 'animateReorder',\n 'liveSort',\n 'boundary',\n 'lockAxis',\n ],\n },\n ],\n})\nexport class ForTableRowReorder {\n private readonly ctx = injectTableContext('ForTableRowReorder');\n readonly #registration = injectTableRegistration('ForTableRowReorder');\n readonly #list = inject(ForDropList);\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #document = inject(DOCUMENT);\n readonly #isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n readonly #dragDefaults = inject(FOR_DRAG_DROP_DEFAULTS);\n readonly #announce = new DragAnnouncer(inject(LiveAnnouncer), () => ({\n lift: this.#dragDefaults.announceLift,\n move: this.#dragDefaults.announceMove,\n drop: this.#dragDefaults.announceDrop,\n cancel: this.#dragDefaults.announceCancel,\n }));\n readonly #injector = inject(Injector);\n\n #mode: ReorderMode = 'idle';\n #kbLiftedHost: HTMLElement | null = null;\n #kbFocusEl: HTMLElement | SVGElement | null = null;\n #kbPath: 'virtual' | 'list' | null = null;\n #kbFrom = 0;\n #kbTarget = 0;\n #pointerGrab: HTMLElement | null = null;\n #pointerMain: number | null = null;\n #scrubEngaged = false;\n #pointerSession: PointerDragSession | null = null;\n #pendingFocus: FocusWhenMountedRef | null = null;\n\n /**\n * Fires once per committed reorder gesture with the previous / new row index.\n *\n * After a **keyboard** drop made while focus was in the lifted row, focus follows the row to\n * its new place once the next render settles, back onto the cell it was lifted from (or the\n * row itself in `mode=\"table\"`). Focus something else inside this handler to keep it;\n * pointer drops never move focus.\n */\n readonly rowReorder = output<TableRowReorderDescriptor>();\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n const sub = this.#list.dragDrop.subscribe((event: ForDragDropEvent) =>\n this.rowReorder.emit(this.resolveReorder(event.previousIndex, event.currentIndex)),\n );\n destroyRef.onDestroy(() => sub.unsubscribe());\n\n if (this.#isBrowser) {\n this.#pointerSession = createPointerDragSession({\n host: this.#host,\n document: this.#document,\n armThreshold: POINTER_ARM_THRESHOLD_PX,\n cancelOnEscape: true,\n canStart: (event) => this.#trackPointerPress(event),\n onLift: () => this.#pinOnPointerLift(),\n onMove: (event) => this.#trackScrub(event),\n onCommit: () => this.#endPointerSession(),\n onCancel: () => this.#endPointerSession(),\n });\n\n createKeyboardDragMediator({\n host: this.#host,\n document: this.#document,\n isBrowser: this.#isBrowser,\n destroyRef,\n isLifted: () => this.#mode === 'keyboard',\n onIdleKeydown: (event) => this.#onIdleKeydown(event),\n onLiftedKeydown: (event) => this.#onLiftedKeydown(event),\n onFocusLeave: () => this.#cancelActive(),\n });\n\n effect(() => {\n this.#registration.rows();\n this.#restoreLiftedFocus();\n });\n\n destroyRef.onDestroy(() => {\n this.#pointerSession?.destroy();\n if (this.#kbLiftedHost !== null) {\n this.#cancelActive(false);\n }\n this.#registration.setReorderingRow(null);\n });\n }\n }\n\n #gridMode(): boolean {\n return this.ctx.mode() !== 'table';\n }\n\n #virtualized(): boolean {\n return this.#registration.virtualRowNavigation() !== null;\n }\n\n #onIdleKeydown(event: KeyboardEvent): void {\n if (this.#mode !== 'idle') {\n return;\n }\n const lift = this.#gridMode()\n ? isDragLiftKey(event, this.#dragDefaults.liftKey)\n : this.#virtualized() && (event.key === ' ' || event.key === 'Enter');\n if (!lift) {\n return;\n }\n const resolved = this.#resolveRow(event.target);\n if (resolved === null || (!resolved.liftable && !this.#gridMode())) {\n return;\n }\n event.preventDefault();\n if (!resolved.liftable) {\n return;\n }\n event.stopPropagation();\n this.#lift(resolved.host);\n }\n\n #onLiftedKeydown(event: KeyboardEvent): void {\n const control = resolveLiftedDragControl(event);\n if (control === 'commit') {\n event.preventDefault();\n event.stopPropagation();\n this.#commitActive();\n return;\n }\n if (control === 'cancel') {\n event.preventDefault();\n event.stopPropagation();\n this.#cancelActive();\n return;\n }\n if (!LIFTED_NAV_KEYS.has(event.key) || isHistoryChord(event)) {\n consumeUnmappedLiftedKey(event);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.#moveActive(event.key);\n }\n\n /**\n * The registered row a lift key targets, or `null` when it targets no row or an interactive\n * descendant of one, which keeps the key. `liftable` is `false` for a row with no draggable or\n * a disabled one: the grid then consumes the chord without lifting, so it never falls through\n * to the cell's activation or selection.\n */\n #resolveRow(target: EventTarget | null): { host: HTMLElement; liftable: boolean } | null {\n if (!(target instanceof Node)) {\n return null;\n }\n const row = this.#registration.rows().find((r) => r.host === target || r.host.contains(target));\n if (row === undefined || isInteractiveDescendant(target, row.host)) {\n return null;\n }\n const draggable = this.#list.items().find((h) => h.host === row.host);\n return { host: row.host, liftable: draggable !== undefined && !draggable.disabled() };\n }\n\n #lift(rowHost: HTMLElement): void {\n const handle = this.#registration.rows().find((r) => r.host === rowHost);\n if (handle === undefined) {\n return;\n }\n if (this.#virtualized()) {\n const vi = handle.virtualIndex();\n if (vi === null) {\n return;\n }\n this.#kbPath = 'virtual';\n this.#kbLift(rowHost, vi);\n return;\n }\n const from = this.#list.lift(rowHost);\n if (from < 0) {\n return;\n }\n this.#mode = 'keyboard';\n this.#kbPath = 'list';\n this.#kbLiftedHost = rowHost;\n }\n\n #moveActive(key: string): void {\n if (this.#kbPath === 'virtual') {\n const requested = this.#requestedTarget(key);\n if (requested !== null) {\n this.#stepTarget(requested);\n }\n return;\n }\n if (this.#kbPath === 'list') {\n switch (key) {\n case 'ArrowDown':\n this.#list.moveLifted('next');\n break;\n case 'ArrowUp':\n this.#list.moveLifted('prev');\n break;\n case 'Home':\n case 'PageUp':\n this.#list.moveLifted('first');\n break;\n case 'End':\n case 'PageDown':\n this.#list.moveLifted('last');\n break;\n default:\n return;\n }\n }\n }\n\n #commitActive(): void {\n if (this.#kbPath === 'virtual') {\n this.#kbCommit();\n } else if (this.#kbPath === 'list') {\n this.#list.drop();\n this.#kbTeardown(true);\n }\n }\n\n #cancelActive(restoreFocus = true): void {\n if (this.#kbPath === 'virtual') {\n this.#kbCancel(restoreFocus);\n } else if (this.#kbPath === 'list') {\n this.#list.cancel();\n this.#kbTeardown(false);\n }\n }\n\n #restoreLiftedFocus(): void {\n if (this.#kbPath !== 'virtual' || this.#kbLiftedHost === null) {\n return;\n }\n const target = this.#kbFocusEl;\n if (target === null || !this.#host.contains(target)) {\n return;\n }\n const active = this.#document.activeElement;\n if (active !== null && this.#host.contains(active)) {\n return;\n }\n target.focus({ preventScroll: true });\n }\n\n #kbLift(host: HTMLElement, vi: number): void {\n this.#pendingFocus?.cancel();\n this.#pendingFocus = null;\n this.#mode = 'keyboard';\n this.#kbLiftedHost = host;\n this.#kbFocusEl = this.#resolveFocusTarget(host);\n this.#kbFrom = vi;\n this.#kbTarget = vi;\n this.#registration.setReorderingRow(vi);\n this.#list.beginCoordinatorLift(host, vi);\n this.#announce.lift(this.#item(), this.#position(vi));\n }\n\n #kbApplyTarget(): void {\n this.#registration.virtualRowNavigation()?.scrollToRow(this.#kbTarget);\n this.#announce.move(this.#item(), this.#position(this.#kbTarget));\n }\n\n #kbCommit(): void {\n const lifted = this.#kbLiftedHost;\n const to = this.#kbTarget;\n const column = lifted === null ? -1 : this.#columnOf(lifted, this.#kbFocusEl);\n this.rowReorder.emit({ from: this.#kbFrom, to });\n this.#announce.drop(this.#item(), this.#position(to));\n this.#kbTeardown(true);\n if (lifted !== null) {\n this.#followRow(lifted, to, column, { scroll: false });\n }\n }\n\n /**\n * Pin the row at `index` and move focus onto the same column of it once it mounts.\n * With `scroll`, the container is also scrolled to the row and focus waits for the\n * window to cover it; without, the pinned row is the target wherever the window is.\n */\n #followRow(\n lifted: HTMLElement,\n index: number,\n column: number,\n { scroll }: { scroll: boolean },\n ): void {\n this.#pendingFocus = focusWhenMounted({\n injector: this.#injector,\n document: this.#document,\n from: lifted,\n reveal: () => {\n this.#registration.setReorderingRow(index);\n if (scroll) {\n this.#registration.virtualRowNavigation()?.scrollToRow(index);\n }\n },\n target: () =>\n scroll && this.#registration.virtualRowNavigation()?.isRowInWindow(index) === false\n ? null\n : this.#focusTargetIn(index, column),\n release: () => {\n this.#pendingFocus = null;\n this.#registration.setReorderingRow(null);\n },\n });\n }\n\n #columnOf(rowHost: HTMLElement, focused: Element | null): number {\n if (focused === null || focused === rowHost) {\n return -1;\n }\n const row = this.#registration.rows().find((r) => r.host === rowHost);\n return row?.cells().findIndex((c) => c.host === focused || c.host.contains(focused)) ?? -1;\n }\n\n #focusTargetIn(index: number, column: number): HTMLElement | null {\n const row = this.#registration.rows().find((r) => r.virtualIndex() === index);\n if (row === undefined) {\n return null;\n }\n if (column < 0) {\n return row.host;\n }\n const cells = row.cells();\n return (cells[column] ?? cells[cells.length - 1])?.host ?? row.host;\n }\n\n #kbCancel(restoreFocus: boolean): void {\n const lifted = this.#kbLiftedHost;\n const from = this.#kbFrom;\n const column = lifted === null ? -1 : this.#columnOf(lifted, this.#kbFocusEl);\n this.#announce.cancel(this.#item());\n this.#kbTeardown(false);\n if (restoreFocus && lifted !== null) {\n this.#followRow(lifted, from, column, { scroll: true });\n }\n }\n\n #resolveFocusTarget(host: HTMLElement): HTMLElement | SVGElement {\n const active = this.#document.activeElement;\n const focusable = active instanceof HTMLElement || active instanceof SVGElement;\n return focusable && host.contains(active) ? active : host;\n }\n\n #kbTeardown(dropped: boolean): void {\n this.#mode = 'idle';\n this.#kbLiftedHost = null;\n this.#kbFocusEl = null;\n this.#kbPath = null;\n this.#kbFrom = 0;\n this.#kbTarget = 0;\n this.#registration.setReorderingRow(null);\n this.#list.endCoordinatorLift(dropped);\n }\n\n private count(): number {\n return (\n this.#registration.virtualRowNavigation()?.placeableRowCount() ?? this.#list.items().length\n );\n }\n\n private layoutPlaceholder(nodes: readonly Node[], lifted: HTMLElement): void {\n if (this.#virtualized()) {\n layoutPlaceholderInSlot(nodes, lifted);\n }\n }\n\n #page(): number {\n return Math.max(1, this.#list.items().length);\n }\n\n #item(): DragAnnouncedItem {\n const host = this.#kbLiftedHost;\n return {\n host,\n textValue: this.#list\n .items()\n .find((h) => h.host === host)\n ?.textValue(),\n };\n }\n\n #position(index: number): DragAnnouncedPosition {\n return { index, total: this.count(), list: this.#host, source: this.#host };\n }\n\n #requestedTarget(key: string): number | null {\n switch (key) {\n case 'ArrowDown':\n return this.#kbTarget + 1;\n case 'ArrowUp':\n return this.#kbTarget - 1;\n case 'Home':\n return 0;\n case 'End':\n return this.count() - 1;\n case 'PageDown':\n return this.#kbTarget + this.#page();\n case 'PageUp':\n return this.#kbTarget - this.#page();\n default:\n return null;\n }\n }\n\n #stepTarget(requested: number): void {\n const next = stepDragTarget(this.#kbTarget, requested, this.count());\n if (next === null) {\n return;\n }\n this.#kbTarget = next;\n this.#kbApplyTarget();\n }\n\n #trackPointerPress(event: PointerEvent): boolean {\n const row = findPressedDragItem(this.#registration.rows(), event.target);\n arbitrateLiftPress({\n keyboardLifted: this.#mode === 'keyboard',\n liftedHost: this.#kbLiftedHost,\n pressedHost: row?.host ?? null,\n cancelKeyboardLift: () => this.#cancelActive(false),\n });\n if (this.#list.effectiveDisabled() || (event.pointerType === 'mouse' && event.button !== 0)) {\n return false;\n }\n const draggable = resolvePressedDragItem(this.#list.items(), event.target);\n if (draggable === null || draggable.host !== row?.host) {\n return false;\n }\n this.#pointerMain = event.clientY;\n this.#scrubEngaged = event.shiftKey;\n if (this.#mode !== 'idle') {\n this.#pointerGrab = null;\n return false;\n }\n this.#pointerGrab = draggable.host;\n return true;\n }\n\n #pinOnPointerLift(): boolean {\n const rowHost = this.#pointerGrab;\n this.#pointerGrab = null;\n if (rowHost === null || this.#mode !== 'idle') {\n return false;\n }\n this.#pendingFocus?.cancel();\n this.#pendingFocus = null;\n this.#registration.virtualRowNavigation()?.cancelScroll();\n this.#mode = 'pointer';\n const handle = this.#registration.rows().find((r) => r.host === rowHost);\n this.#registration.setReorderingRow(handle?.virtualIndex() ?? null);\n return true;\n }\n\n #endPointerSession(): void {\n this.#pointerGrab = null;\n if (this.#mode !== 'pointer') {\n return;\n }\n this.#mode = 'idle';\n this.#registration.setReorderingRow(null);\n }\n\n #trackScrub(event: PointerEvent): void {\n if (!this.#list.isDragging()) {\n return;\n }\n this.#pointerMain = event.clientY;\n this.#scrubEngaged = event.shiftKey;\n }\n\n #windowIndices(): number[] | null {\n const rowByHost = new Map(this.#registration.rows().map((r) => [r.host, r] as const));\n const indices: number[] = [];\n for (const item of this.#list.items()) {\n const index = rowByHost.get(item.host)?.virtualIndex() ?? null;\n if (index === null) {\n return null;\n }\n indices.push(index);\n }\n return indices;\n }\n\n private resolveReorder(previousIndex: number, currentIndex: number): TableRowReorderDescriptor {\n const rect = this.#registration.virtualRowNavigation()?.scrollViewportRect() ?? null;\n return resolveWindowedReorder({\n windowIndices: this.#windowIndices(),\n previousIndex,\n currentIndex,\n scrub:\n rect === null\n ? null\n : {\n engaged: this.#scrubEngaged,\n pointer: this.#pointerMain ?? rect.top,\n viewportStart: rect.top,\n viewportEnd: rect.bottom,\n count: this.count(),\n },\n });\n }\n}\n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