@mk-kit/ui 0.36.0 → 0.38.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":"mk-kit-ui-table.mjs","sources":["../../../projects/mk-kit/table/table/table-row-detail.ts","../../../projects/mk-kit/table/table/table-cell.ts","../../../projects/mk-kit/table/export.ts","../../../projects/mk-kit/table/table/table.ts","../../../projects/mk-kit/table/table/table.html","../../../projects/mk-kit/table/sort/sort.ts","../../../projects/mk-kit/table/sort/sort-header.ts","../../../projects/mk-kit/table/sort/sort-header.html","../../../projects/mk-kit/table/data-source.ts","../../../projects/mk-kit/table/index.ts","../../../projects/mk-kit/table/mk-kit-ui-table.ts"],"sourcesContent":["import { Directive, TemplateRef, inject } from '@angular/core';\n\n/**\n * Marks an `<ng-template>` as the expandable detail content for {@link MkTable}\n * rows. The template's implicit context is the row object, so consumers can\n * destructure it with `let-row`:\n *\n * ```html\n * <mk-table [columns]=\"cols\" [data]=\"rows()\" expandable>\n * <ng-template mkTableRowDetail let-row>\n * <dl>… {{ row.notes }} …</dl>\n * </ng-template>\n * </mk-table>\n * ```\n */\n@Directive({\n selector: '[mkTableRowDetail]',\n})\nexport class MkTableRowDetail<T = unknown> {\n /** The projected detail template, rendered once per expanded row. */\n readonly template = inject<TemplateRef<{ $implicit: T }>>(TemplateRef);\n}\n","import { Directive, TemplateRef, inject, input } from '@angular/core';\n\n/** Context handed to an `[mkTableCell]` template. */\nexport interface MkTableCellContext<T = unknown> {\n /** The cell's raw value (the row's property named by the column key). */\n $implicit: unknown;\n /** The whole row, for cells that need more than one field. */\n row: T;\n}\n\n/**\n * Marks an `<ng-template>` as the renderer for one column's cells, named by the\n * column `key`. Without it a cell can only be text — `MkTableColumn.format`\n * returns a string — so anything richer (a status tag, an avatar, a progress\n * bar, an action button) meant abandoning `mk-table` for a hand-rolled\n * `<table>`.\n *\n * The value is the template's implicit context and the row is available as\n * `let-row`:\n *\n * ```html\n * <mk-table [columns]=\"cols\" [data]=\"rows()\">\n * <ng-template mkTableCell=\"status\" let-value let-row=\"row\">\n * <mk-tag [tone]=\"toneFor(value)\">{{ label(value) }}</mk-tag>\n * </ng-template>\n * </mk-table>\n * ```\n *\n * A column with both a template and a `format` uses the template; `format`\n * still applies to sorting/export paths that need a string.\n */\n@Directive({\n selector: '[mkTableCell]',\n})\nexport class MkTableCell<T = unknown> {\n /** Column key whose cells this template renders. */\n readonly mkTableCell = input.required<string>();\n\n /** The projected template, rendered once per cell in that column. */\n readonly template =\n inject<TemplateRef<MkTableCellContext<T>>>(TemplateRef);\n}\n","/**\n * CSV export — turn rows into RFC 4180 text and hand it to the browser as a\n * download. Framework-free so it also serves data that never touched a table.\n */\n\n/** A column to export: the row property, its header, and an optional formatter. */\nexport interface MkCsvColumn<T = Record<string, unknown>> {\n /** Property key on each row object supplying the cell value. */\n key: string;\n /** Header text; defaults to `key`. */\n header?: string;\n /** Formatter turning the raw value into cell text (same shape as `MkTableColumn.format`). */\n format?: (value: unknown, row: T) => string;\n}\n\nexport interface MkCsvOptions {\n /** Field separator (default `,`; use `;` for locales whose Excel expects it). */\n delimiter?: string;\n /** Emit the header row first (default `true`). */\n header?: boolean;\n /** Line terminator (default `\\r\\n`, per RFC 4180). */\n newline?: string;\n /**\n * Prefix a UTF-8 byte-order mark (default `true`) so Excel reads accented\n * characters correctly. Only affects the downloaded file / returned text.\n */\n bom?: boolean;\n /**\n * Neutralise spreadsheet formula injection (default `true`): a text cell\n * starting with `=`, `+`, `-`, `@`, tab or CR is prefixed with `'` so a\n * malicious value cannot execute when opened in Excel / Sheets. Numbers\n * are never touched, so `-5` stays `-5`.\n */\n sanitize?: boolean;\n /** Property holding child rows; when set, trees are flattened depth-first. */\n childrenKey?: string;\n}\n\n/** Options for {@link mkExportCsv}. */\nexport interface MkCsvExportOptions extends MkCsvOptions {\n /** File name for the download (default `export.csv`; `.csv` is appended if missing). */\n filename?: string;\n}\n\nconst NEEDS_QUOTES = /[\"\\r\\n]/;\nconst FORMULA_LEAD = /^[=+\\-@\\t\\r]/;\n\n/** Escape one cell for CSV. */\nfunction csvCell(value: unknown, delimiter: string, sanitize: boolean): string {\n if (value == null) return '';\n let text: string;\n if (typeof value === 'string') {\n text = sanitize && FORMULA_LEAD.test(value) ? `'${value}` : value;\n } else if (value instanceof Date) {\n text = value.toISOString();\n } else if (typeof value === 'object') {\n text = JSON.stringify(value);\n } else {\n text = String(value);\n }\n return NEEDS_QUOTES.test(text) || text.includes(delimiter) || /^\\s|\\s$/.test(text)\n ? `\"${text.replace(/\"/g, '\"\"')}\"`\n : text;\n}\n\n/**\n * Serialise `rows` as CSV text.\n *\n * Without `columns` every key of the first row is exported in its own order.\n * Column formatters are applied, so what the user saw in the table is what\n * lands in the file.\n */\nexport function mkToCsv<T>(\n rows: readonly T[],\n columns?: readonly MkCsvColumn<T>[],\n options: MkCsvOptions = {},\n): string {\n const delimiter = options.delimiter ?? ',';\n const newline = options.newline ?? '\\r\\n';\n const sanitize = options.sanitize ?? true;\n const cols: readonly MkCsvColumn<T>[] =\n columns ??\n Object.keys((rows[0] ?? {}) as object)\n .filter((key) => key !== options.childrenKey)\n .map((key) => ({ key }));\n\n const flat: T[] = [];\n const walk = (list: readonly T[]): void => {\n for (const row of list) {\n flat.push(row);\n const children = options.childrenKey\n ? (row as Record<string, unknown>)[options.childrenKey]\n : null;\n if (Array.isArray(children)) walk(children as T[]);\n }\n };\n walk(rows);\n\n const lines: string[] = [];\n if (options.header ?? true) {\n lines.push(cols.map((c) => csvCell(c.header ?? c.key, delimiter, sanitize)).join(delimiter));\n }\n for (const row of flat) {\n lines.push(\n cols\n .map((c) => {\n const raw = (row as Record<string, unknown>)[c.key];\n const value = c.format ? c.format(raw, row) : raw;\n return csvCell(value, delimiter, sanitize);\n })\n .join(delimiter),\n );\n }\n return (options.bom ?? true ? '' : '') + lines.join(newline) + newline;\n}\n\n/**\n * Trigger a browser download of `text` as a file. No-op outside a DOM\n * (server-side rendering); returns whether a download was started.\n */\nexport function mkDownloadText(\n text: string,\n filename: string,\n type = 'text/csv;charset=utf-8',\n): boolean {\n if (typeof document === 'undefined' || typeof URL?.createObjectURL !== 'function') return false;\n const url = URL.createObjectURL(new Blob([text], { type }));\n const a = document.createElement('a');\n a.href = url;\n a.download = filename;\n a.rel = 'noopener';\n a.style.display = 'none';\n document.body.appendChild(a);\n a.click();\n a.remove();\n // Give the click a tick to grab the blob before the URL is released.\n setTimeout(() => URL.revokeObjectURL(url), 0);\n return true;\n}\n\n/**\n * Serialise `rows` as CSV and download it. Returns the CSV text so callers\n * can also keep it (tests, previews, uploads).\n */\nexport function mkExportCsv<T>(\n rows: readonly T[],\n columns?: readonly MkCsvColumn<T>[],\n options: MkCsvExportOptions = {},\n): string {\n const csv = mkToCsv(rows, columns, options);\n let filename = options.filename ?? 'export.csv';\n if (!/\\.csv$/i.test(filename)) filename += '.csv';\n mkDownloadText(csv, filename);\n return csv;\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n PLATFORM_ID,\n afterNextRender,\n booleanAttribute,\n computed,\n contentChild,\n contentChildren,\n effect,\n inject,\n input,\n model,\n numberAttribute,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from '@angular/common';\nimport { MkLiveAnnouncer } from '@mk-kit/ui/core';\nimport { MK_I18N } from '@mk-kit/ui/core';\nimport { mkUniqueId } from '@mk-kit/ui/core';\nimport { MkCheckbox } from '@mk-kit/ui/checkbox';\nimport { MkTableRowDetail } from './table-row-detail';\nimport { MkTableCell } from './table-cell';\nimport { mkDownloadText, mkToCsv, type MkCsvExportOptions } from '../export';\n\n/** Horizontal text alignment for a table column. */\nexport type MkTableAlign = 'start' | 'center' | 'end';\n/** Sort direction; `none` means unsorted. */\nexport type MkSortDirection = 'asc' | 'desc' | 'none';\n/** Row vertical density. */\nexport type MkTableDensity = 'comfortable' | 'compact';\n\n/** Column definition for {@link MkTable}. */\nexport interface MkTableColumn<T = Record<string, unknown>> {\n /** Property key on each row object supplying the cell value. */\n key: string;\n /** Visible column header text. */\n header: string;\n /** Allow sorting by this column. */\n sortable?: boolean;\n /** Cell/header alignment (default `start`). */\n align?: MkTableAlign;\n /** Fixed column width (any CSS length). */\n width?: string;\n /** Optional formatter turning the raw value into display text. */\n format?: (value: unknown, row: T) => string;\n /** Allow the user to drag-resize this column (needs `resizableColumns`). */\n resizable?: boolean;\n /** Make this column's cells inline-editable (double-click / Enter). */\n editable?: boolean;\n /** Pin (freeze) this column to a side while the body scrolls horizontally. */\n pinned?: 'left' | 'right';\n /** Minimum width in px when resizing (default 60). */\n minWidth?: number;\n /**\n * What becomes of this column when the table stacks into cards\n * (see {@link MkTable.stackAt}). Omitted, the column renders as a labelled\n * field: its `header` on one side, its value on the other.\n *\n * - `'title'` — the card's heading. No label; the value identifies the\n * record at a glance (an order number, a product name). Mark one, or two\n * if something short belongs beside it such as a status or a total.\n * - `'footer'` — pinned to the bottom of the card, full width and unlabelled.\n * Where an actions cell belongs: buttons read as buttons, rather than as\n * the answer to a label.\n * - `'hide'` — not rendered at all. Not merely invisible: the cell is never\n * created, so a screen reader does not read it either. For columns that\n * only earn their place while scanning a grid, and especially for anything\n * an expandable row detail already repeats.\n */\n stack?: 'title' | 'footer' | 'hide';\n}\n\n/** Payload emitted by {@link MkTable.sortChange}. */\nexport interface MkSortChange {\n /** Column key sorted by. */\n key: string;\n /** Resulting direction (`none` when sorting was cleared). */\n direction: MkSortDirection;\n}\n\n/** Payload emitted by {@link MkTable.columnResize} after a column resize. */\nexport interface MkColumnResize {\n /** The resized column's key. */\n key: string;\n /** The new width in pixels. */\n width: number;\n}\n\n/** Payload emitted by {@link MkTable.cellEdit} when an editable cell is saved. */\nexport interface MkCellEdit<T = Record<string, unknown>> {\n /** The edited row. */\n row: T;\n /** The column key that was edited. */\n key: string;\n /** The new (string) value the user entered. */\n value: string;\n}\n\n/** A group of rows produced by {@link MkTable.groupBy}. */\nexport interface MkTableGroup<T = Record<string, unknown>> {\n /** The shared group value. */\n key: unknown;\n /** Display label for the group header. */\n label: string;\n /** The rows in this group, in display (sorted) order. */\n rows: T[];\n}\n\n/** Payload emitted by {@link MkTable.groupToggle}. */\n/** Payload of `(treeToggle)`: a parent row was expanded or collapsed. */\nexport interface MkTreeToggle<T = Record<string, unknown>> {\n /** The parent row. */\n row: T;\n /** Whether its child rows are now shown. */\n expanded: boolean;\n}\n\nexport interface MkGroupToggle {\n /** The toggled group's value. */\n key: unknown;\n /** Whether the group is now collapsed. */\n collapsed: boolean;\n}\n\n/** Options for {@link MkTable.exportCsv}. */\nexport interface MkTableExportOptions extends MkCsvExportOptions {\n /** Export only the selected rows (default: every row). */\n selectedOnly?: boolean;\n /** Restrict to these column keys, in table order (default: every column). */\n columns?: readonly string[];\n /** Start the browser download (default `true`); `false` just returns the text. */\n download?: boolean;\n}\n\n/** Hard floor (px) for column resize when a column sets no `minWidth`. */\nconst MIN_COL_WIDTH = 60;\n/** Upper bound advertised on resize separators (`aria-valuemax`). */\nconst MAX_COL_WIDTH = 2000;\n\n/** One rendered tbody entry: either a group header or a data row. */\ntype MkTableItem<T> =\n | { kind: 'group'; group: MkTableGroup<T> }\n | {\n kind: 'row';\n row: T;\n /** Nesting depth in tree mode (0 for roots and for flat tables). */\n depth: number;\n /** Whether the row has child rows (tree mode). */\n hasChildren: boolean;\n /** Whether its children are currently shown (tree mode). */\n expanded: boolean;\n };\n\n/**\n * Table — a themed data table built on a native `<table>` for accessibility.\n * Supply `columns` and `data`; opt into sortable columns, sticky header,\n * zebra striping, hover and density. Sorting is fully keyboard operable\n * (Enter/Space on a header) and announces changes via {@link MkLiveAnnouncer}.\n *\n * ```html\n * <mk-table\n * [columns]=\"columns\"\n * [data]=\"rows()\"\n * stickyHeader\n * zebra\n * (sortChange)=\"onSort($event)\"\n * (rowClick)=\"open($event)\" />\n * ```\n */\n@Component({\n selector: 'mk-table',\n templateUrl: './table.html',\n styleUrl: './table.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [MkCheckbox, NgTemplateOutlet],\n host: {\n class: 'mk-table',\n '[class.mk-table--sticky]': 'stickyHeader()',\n '[class.mk-table--zebra]': 'zebra()',\n '[class.mk-table--hover]': 'hover()',\n '[class.mk-table--compact]': \"density() === 'compact'\",\n '[class.mk-table--clickable]': 'clickableRows()',\n '[class.mk-table--selectable]': 'selectable()',\n '[class.mk-table--expandable]': 'expandable()',\n '[class.mk-table--grouped]': 'groupBy() !== null',\n '[class.mk-table--stacked]': 'stacked()',\n },\n})\nexport class MkTable<T = Record<string, unknown>> {\n private readonly announcer = inject(MkLiveAnnouncer);\n protected readonly i18n = inject(MK_I18N);\n private readonly document = inject(DOCUMENT);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * True while the table is narrower than {@link stackAt} and rendering cards.\n *\n * Driven by the element's own width rather than the viewport's: the question\n * \"do these columns fit\" is about the space the table HAS, not the size of\n * the screen. A table in a sidebar or a dialog should stack while the window\n * around it is enormous.\n */\n protected readonly stacked = signal(false);\n\n constructor() {\n // Keep the sticky group-header offset in sync with the rendered thead\n // height (it shifts with density, sticky mode and grouping itself).\n effect(() => {\n this.stickyHeader();\n this.density();\n this.groupBy();\n afterNextRender(\n { read: () => this.applyGroupTop() },\n { injector: this.injector },\n );\n });\n\n // Watch the host's width against `stackAt`. ResizeObserver rather than\n // matchMedia because the trigger is the element's width, not the window's.\n // Skipped entirely on the server and wherever the API is missing, leaving\n // `stacked` false — the grid is the safe fallback, since it renders the\n // same data with nothing dropped.\n afterNextRender(\n {\n read: () => {\n if (!this.isBrowser || typeof ResizeObserver === 'undefined') return;\n const el = this.host.nativeElement;\n const observer = new ResizeObserver(([entry]) => {\n const limit = this.stackAt();\n this.stacked.set(limit > 0 && entry.contentRect.width < limit);\n });\n observer.observe(el);\n this.destroyRef.onDestroy(() => observer.disconnect());\n },\n },\n { injector: this.injector },\n );\n }\n\n /** Measures the thead and exposes it as the group rows' sticky offset. */\n private applyGroupTop(): void {\n if (this.groupBy() == null) return;\n const thead = this.host.nativeElement.querySelector('thead');\n const h =\n this.stickyHeader() && thead ? thead.getBoundingClientRect().height : 0;\n this.host.nativeElement.style.setProperty(\n '--_group-top',\n `${Math.round(h)}px`,\n );\n }\n\n /** Column definitions (order = display order). */\n readonly columns = input.required<MkTableColumn<T>[]>();\n /** Row objects to render. */\n readonly data = input<T[]>([]);\n /** Pin the header to the top of the scroll container. */\n readonly stickyHeader = input(false, { transform: booleanAttribute });\n /** Alternate row background for readability. */\n readonly zebra = input(false, { transform: booleanAttribute });\n /** Highlight rows on hover. */\n readonly hover = input(true, { transform: booleanAttribute });\n /** Row density. */\n readonly density = input<MkTableDensity>('comfortable');\n /**\n * Width in px below which each row renders as a CARD instead of a table row.\n * `0` (default) never stacks.\n *\n * Measured on the table's own container, not the viewport — a table in a\n * narrow sidebar should stack on a desktop, and a table on a tablet in\n * landscape should not. Per-column behaviour is set with\n * {@link MkTableColumn.stack}.\n *\n * A grid cannot survive a phone: eight columns become eight unreadable\n * slivers, and horizontal scrolling loses the row you were reading. Cards\n * keep one record together and put its header beside each value.\n */\n readonly stackAt = input(0, { transform: numberAttribute });\n /** Style rows as clickable and emit `rowClick`. */\n readonly clickableRows = input(false, { transform: booleanAttribute });\n /** Message shown when there are no rows. */\n readonly emptyMessage = input(this.i18n.noData);\n /** Render a leading checkbox column for row selection. */\n readonly selectable = input(false, { transform: booleanAttribute });\n /**\n * Two-way bound array of selected rows. Use `[(selected)]` to bind, or read\n * `selectionChange`. Rows are compared by {@link trackKey} when set, else by\n * referential identity.\n */\n readonly selected = model<T[]>([]);\n /**\n * Property name identifying a row for selection equality. When omitted rows\n * are matched by reference.\n */\n readonly trackKey = input<string>();\n\n /**\n * Optional per-row CSS class: called with each row, the returned string is\n * appended to the row's class list (falsy → none). For state the consumer\n * owns — an \"active in the side panel\" highlight, an unread accent — that\n * `selectable`'s own selected style doesn't cover.\n */\n readonly rowClass = input<((row: T) => string | null | undefined) | null>(\n null,\n );\n\n /** Resolved class for a row (empty string when no `rowClass` is set). */\n protected rowClassFor(row: T): string {\n return this.rowClass()?.(row) ?? '';\n }\n /**\n * Render a leading expander column. Each row can reveal a detail panel\n * supplied via an `<ng-template mkTableRowDetail let-row>`.\n */\n readonly expandable = input(false, { transform: booleanAttribute });\n /** Allow only one row expanded at a time (accordion). */\n readonly singleExpand = input(false, { transform: booleanAttribute });\n /** Enable drag-to-resize on columns marked `resizable` (data-grid pro). */\n readonly resizableColumns = input(false, { transform: booleanAttribute });\n /** Enable drag-to-reorder of column headers (data-grid pro). */\n readonly reorderableColumns = input(false, { transform: booleanAttribute });\n /**\n * Group rows by a column key or an accessor. Renders a collapsible group\n * header row (sticky, with a row count) above each group. Sorting still\n * applies within groups; groups follow their first row's sorted position.\n */\n readonly groupBy = input<string | ((row: T) => unknown) | null>(null);\n /** Formats a group header label; defaults to `String(value)`. */\n readonly groupLabel = input<\n ((value: unknown, rows: T[]) => string) | null\n >(null);\n\n /** Emitted when the sort column/direction changes. */\n readonly sortChange = output<MkSortChange>();\n /** Emitted when a row is clicked (enable via `clickableRows`). */\n readonly rowClick = output<T>();\n /** Emitted with the new selection whenever it changes (enable via `selectable`). */\n readonly selectionChange = output<T[]>();\n /** Emitted with the currently expanded rows whenever they change. */\n readonly expandedChange = output<T[]>();\n /** Emitted when a column is resized (px). */\n readonly columnResize = output<MkColumnResize>();\n /** Emitted with the new column key order after a reorder. */\n readonly columnReorder = output<string[]>();\n /** Emitted when an inline-editable cell is saved. */\n readonly cellEdit = output<MkCellEdit<T>>();\n /** Emitted when a group header is expanded or collapsed. */\n readonly groupToggle = output<MkGroupToggle>();\n /**\n * Tree rows: the property on each row holding its child rows (`T[]`). When\n * set, the table renders a tree grid — child rows are indented under their\n * parent behind an expand toggle in the first column, sorting applies per\n * sibling group, and ArrowRight / ArrowLeft on a row open / close it.\n */\n readonly childrenKey = input<string | null>(null);\n /** Emitted when a parent row is expanded or collapsed (tree mode). */\n readonly treeToggle = output<MkTreeToggle<T>>();\n\n /** User-set column widths (px), keyed by column key. */\n private readonly colWidths = signal<Record<string, number>>({});\n /** User-set column order (keys); `null` = the input order. */\n private readonly colOrder = signal<string[] | null>(null);\n /** The cell currently being inline-edited. */\n protected readonly editing = signal<{ index: number; key: string } | null>(\n null,\n );\n\n /** Columns in display order, honouring any user reordering. */\n protected readonly orderedColumns = computed<MkTableColumn<T>[]>(() => {\n const cols = this.columns();\n const order = this.colOrder();\n if (!order) return cols;\n const byKey = new Map(cols.map((c) => [c.key, c]));\n const ordered = order.map((k) => byKey.get(k)).filter((c): c is MkTableColumn<T> => !!c);\n // Append any columns not present in the saved order (e.g. newly added).\n const seen = new Set(order);\n for (const c of cols) if (!seen.has(c.key)) ordered.push(c);\n return ordered;\n });\n\n // ── Stacked (card) layout ────────────────────────────────────────────────\n // Three slots, so a card reads as a record rather than as a form: a heading\n // line, labelled fields, and actions along the bottom. Columns keep their\n // configured order within each slot.\n\n /** Columns forming the card's heading line. */\n protected readonly stackTitleColumns = computed(() =>\n this.orderedColumns().filter((c) => c.stack === 'title'),\n );\n /** Columns rendered as `label / value` rows in the card body. */\n protected readonly stackFieldColumns = computed(() =>\n this.orderedColumns().filter((c) => !c.stack),\n );\n /** Columns pinned to the bottom of the card, unlabelled. */\n protected readonly stackFooterColumns = computed(() =>\n this.orderedColumns().filter((c) => c.stack === 'footer'),\n );\n\n /**\n * Whether a stacked cell should show its column header as a label.\n *\n * An empty header means the column never had a name to show — an actions or\n * chevron column — and an empty label box would just be a gap the reader has\n * to account for.\n */\n protected hasStackLabel(col: MkTableColumn<T>): boolean {\n return !!col.header?.trim();\n }\n\n /** The rendered width for a column, if the user resized it. */\n protected colStyleWidth(col: MkTableColumn<T>): string | null {\n // A card has one column, so a per-column width — configured or dragged —\n // would pin the value box to a grid width that no longer exists.\n if (this.stacked()) return null;\n const w = this.colWidths()[col.key];\n if (w != null) return `${w}px`;\n return col.width ?? null;\n }\n\n /** Sticky offsets for every pinned column, computed once per layout change. */\n private readonly pinnedOffsets = computed<Map<string, number>>(() => {\n const map = new Map<string, number>();\n const cols = this.orderedColumns();\n const widths = this.colWidths();\n // Account for the leading select / expander columns at the inline start.\n let left = (this.selectable() ? 44 : 0) + (this.expandable() ? 44 : 0);\n for (const c of cols) {\n if (c.pinned !== 'left') continue;\n map.set(c.key, left);\n left += widths[c.key] ?? this.numericWidth(c);\n }\n let right = 0;\n for (let i = cols.length - 1; i >= 0; i--) {\n const c = cols[i];\n if (c.pinned !== 'right') continue;\n map.set(c.key, right);\n right += widths[c.key] ?? this.numericWidth(c);\n }\n return map;\n });\n\n /** Sticky offset (px) for a pinned column. */\n protected pinnedOffset(col: MkTableColumn<T>): number {\n return this.pinnedOffsets().get(col.key) ?? 0;\n }\n\n /** Pinning freezes a column against horizontal scroll. Cards do not scroll\n * sideways, so both the class and its inline offset are suppressed. */\n protected isPinned(col: MkTableColumn<T>, side: 'left' | 'right'): boolean {\n return !this.stacked() && col.pinned === side;\n }\n\n private numericWidth(col: MkTableColumn<T>): number {\n const w = col.width ? parseInt(col.width, 10) : NaN;\n return Number.isFinite(w) ? w : 150;\n }\n\n // --- Column resize --------------------------------------------------------\n private resizeKey: string | null = null;\n private resizeStartX = 0;\n private resizeStartW = 0;\n private resizeMin = MIN_COL_WIDTH;\n /** +1 in LTR, -1 in RTL — dragging toward the inline-end always widens. */\n private resizeSign: 1 | -1 = 1;\n\n /** Whether the table currently renders right-to-left (SSR-safe). */\n private isRtl(): boolean {\n const view = this.document.defaultView;\n if (!view) return false;\n return view.getComputedStyle(this.host.nativeElement).direction === 'rtl';\n }\n\n private resizeRaf: number | null = null;\n private pendingResizeX = 0;\n\n /** Begin a drag-resize from a header handle. */\n protected startResize(event: PointerEvent, col: MkTableColumn<T>): void {\n if (!this.resizableColumns() || !col.resizable) return;\n event.preventDefault();\n event.stopPropagation();\n const th = (event.target as HTMLElement).closest('th') as HTMLElement | null;\n this.resizeKey = col.key;\n this.resizeStartX = event.clientX;\n this.resizeSign = this.isRtl() ? -1 : 1;\n this.resizeStartW =\n this.colWidths()[col.key] ?? th?.getBoundingClientRect().width ?? this.numericWidth(col);\n this.resizeMin = col.minWidth ?? MIN_COL_WIDTH;\n this.document.addEventListener('pointermove', this.onResizeMove);\n this.document.addEventListener('pointerup', this.onResizeEnd);\n this.document.addEventListener('pointercancel', this.onResizeEnd);\n }\n\n /** rAF-coalesced: at most one width write (and CD pass) per frame. */\n private readonly onResizeMove = (event: PointerEvent): void => {\n if (!this.resizeKey) return;\n this.pendingResizeX = event.clientX;\n if (this.resizeRaf != null) return;\n this.resizeRaf = this.document.defaultView?.requestAnimationFrame(() => {\n this.resizeRaf = null;\n this.applyPendingResize();\n }) ?? null;\n };\n\n private applyPendingResize(): void {\n if (!this.resizeKey) return;\n const width = Math.max(\n this.resizeMin,\n Math.round(\n this.resizeStartW +\n this.resizeSign * (this.pendingResizeX - this.resizeStartX),\n ),\n );\n this.colWidths.update((w) => ({ ...w, [this.resizeKey as string]: width }));\n }\n\n private readonly onResizeEnd = (): void => {\n if (this.resizeRaf != null) {\n // Flush (don't drop) the last pending move so a fast drag lands exactly.\n this.document.defaultView?.cancelAnimationFrame(this.resizeRaf);\n this.resizeRaf = null;\n this.applyPendingResize();\n }\n if (this.resizeKey) {\n const col = this.columns().find((c) => c.key === this.resizeKey);\n const width =\n this.colWidths()[this.resizeKey] ?? Math.round(this.resizeStartW);\n this.columnResize.emit({ key: this.resizeKey, width });\n if (col) this.announcer.announce(this.i18n.columnWidth(col.header, width));\n }\n this.resizeKey = null;\n this.document.removeEventListener('pointermove', this.onResizeMove);\n this.document.removeEventListener('pointerup', this.onResizeEnd);\n this.document.removeEventListener('pointercancel', this.onResizeEnd);\n };\n\n /** Keyboard column resize on the focused separator (APG window splitter). */\n protected onResizeKeydown(event: KeyboardEvent, col: MkTableColumn<T>): void {\n if (!this.resizableColumns() || !col.resizable) return;\n const step = event.shiftKey ? 1 : 10;\n let delta = 0;\n if (event.key === 'ArrowLeft') delta = -step;\n else if (event.key === 'ArrowRight') delta = step;\n else return;\n // Mirror in RTL so pressing toward the inline-end always grows the column.\n if (this.isRtl()) delta = -delta;\n event.preventDefault();\n event.stopPropagation();\n const min = col.minWidth ?? MIN_COL_WIDTH;\n const th = (event.target as HTMLElement).closest('th');\n const current =\n this.colWidths()[col.key] ??\n th?.getBoundingClientRect().width ??\n this.numericWidth(col);\n const width = Math.max(min, Math.round(current + delta));\n this.colWidths.update((w) => ({ ...w, [col.key]: width }));\n this.columnResize.emit({ key: col.key, width });\n this.announcer.announce(this.i18n.columnWidth(col.header, width));\n }\n\n /** The current width of a column, for the separator's aria-valuenow. */\n protected resizeValueNow(col: MkTableColumn<T>): number {\n return Math.round(this.colWidths()[col.key] ?? this.numericWidth(col));\n }\n\n /** The resize floor for a column, for the separator's aria-valuemin. */\n protected resizeValueMin(col: MkTableColumn<T>): number {\n return col.minWidth ?? MIN_COL_WIDTH;\n }\n\n /** Advertised resize ceiling (aria-valuemax) — a sane constant bound. */\n protected readonly resizeValueMax = MAX_COL_WIDTH;\n\n ngOnDestroy(): void {\n if (this.resizeRaf != null) {\n this.document.defaultView?.cancelAnimationFrame(this.resizeRaf);\n this.resizeRaf = null;\n }\n this.document.removeEventListener('pointermove', this.onResizeMove);\n this.document.removeEventListener('pointerup', this.onResizeEnd);\n this.document.removeEventListener('pointercancel', this.onResizeEnd);\n }\n\n // --- Column reorder (native drag) -----------------------------------------\n protected readonly dragKey = signal<string | null>(null);\n\n protected onColDragStart(event: DragEvent, col: MkTableColumn<T>): void {\n if (!this.reorderableColumns()) return;\n this.dragKey.set(col.key);\n event.dataTransfer?.setData('text/plain', col.key);\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move';\n }\n\n protected onColDragOver(event: DragEvent): void {\n if (this.reorderableColumns() && this.dragKey()) event.preventDefault();\n }\n\n protected onColDrop(event: DragEvent, target: MkTableColumn<T>): void {\n const from = this.dragKey();\n this.dragKey.set(null);\n if (!from || from === target.key) return;\n event.preventDefault();\n const order = this.orderedColumns().map((c) => c.key);\n const toIdx = order.indexOf(target.key);\n this.moveColumn(from, toIdx);\n }\n\n protected onColDragEnd(): void {\n this.dragKey.set(null);\n }\n\n /** Move a column to `toIdx` in the display order and announce it. */\n private moveColumn(key: string, toIdx: number): void {\n const order = this.orderedColumns().map((c) => c.key);\n const fromIdx = order.indexOf(key);\n if (fromIdx < 0 || toIdx < 0 || toIdx >= order.length || fromIdx === toIdx) {\n return;\n }\n order.splice(toIdx, 0, order.splice(fromIdx, 1)[0]);\n this.colOrder.set(order);\n this.columnReorder.emit(order);\n const col = this.columns().find((c) => c.key === key);\n if (col) {\n this.announcer.announce(\n this.i18n.columnMoved(col.header, toIdx + 1, order.length),\n );\n }\n }\n\n /** Keyboard column reorder: Alt+Arrow moves the focused header. */\n protected onReorderKeydown(event: KeyboardEvent, col: MkTableColumn<T>): void {\n if (!this.reorderableColumns() || col.pinned || !event.altKey) return;\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return;\n // Swallow the combo even when the move is a no-op (first column moved\n // further left, last moved right) — otherwise Alt+Arrow falls through to\n // the browser's history Back/Forward and navigates away from the grid.\n event.preventDefault();\n const order = this.orderedColumns().map((c) => c.key);\n const idx = order.indexOf(col.key);\n if (event.key === 'ArrowLeft' && idx > 0) {\n this.moveColumn(col.key, idx - 1);\n } else if (event.key === 'ArrowRight' && idx < order.length - 1) {\n this.moveColumn(col.key, idx + 1);\n }\n }\n\n // --- Inline cell edit -----------------------------------------------------\n protected isEditing(index: number, col: MkTableColumn<T>): boolean {\n const e = this.editing();\n return !!e && e.index === index && e.key === col.key;\n }\n\n /** The cell element being edited, so focus can be restored after. */\n private editingCell: HTMLElement | null = null;\n\n /** The inline-edit input, focused once it renders. */\n private readonly editInput =\n viewChild<ElementRef<HTMLInputElement>>('editInput');\n\n protected startEdit(index: number, col: MkTableColumn<T>, event?: Event): void {\n if (!col.editable) return;\n event?.stopPropagation();\n this.editingCell =\n ((event?.target as HTMLElement | null)?.closest('td') as HTMLElement | null) ??\n null;\n this.editing.set({ index, key: col.key });\n // Explicit focus once the input exists — a dynamically inserted\n // `autofocus` attribute is not honoured after initial page load.\n afterNextRender(() => this.editInput()?.nativeElement.focus(), {\n injector: this.injector,\n });\n }\n\n /** Keyboard path into edit mode (Enter / F2 on a focused editable cell). */\n protected onCellKeydown(\n event: KeyboardEvent,\n index: number,\n col: MkTableColumn<T>,\n ): void {\n if (!col.editable || this.isEditing(index, col)) return;\n if (event.key === 'Enter' || event.key === 'F2') {\n event.preventDefault();\n event.stopPropagation();\n this.startEdit(index, col, event);\n }\n }\n\n protected commitEdit(\n row: T,\n col: MkTableColumn<T>,\n value: string,\n restoreFocus = false,\n ): void {\n this.editing.set(null);\n this.cellEdit.emit({ row, key: col.key, value });\n this.announcer.announce(this.i18n.cellSaved(value));\n if (restoreFocus) this.editingCell?.focus();\n this.editingCell = null;\n }\n\n protected cancelEdit(restoreFocus = false): void {\n this.editing.set(null);\n if (restoreFocus) this.editingCell?.focus();\n this.editingCell = null;\n }\n\n protected onEditKeydown(\n event: KeyboardEvent,\n row: T,\n col: MkTableColumn<T>,\n ): void {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.commitEdit(row, col, (event.target as HTMLInputElement).value, true);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.cancelEdit(true);\n }\n }\n\n /** The projected row-detail template (enable via `expandable`). */\n protected readonly rowDetail = contentChild(MkTableRowDetail);\n\n /** Per-column cell templates, projected as `<ng-template mkTableCell=\"key\">`. */\n private readonly cellTemplates = contentChildren(MkTableCell);\n private readonly cellTemplateByKey = computed(() => {\n const map = new Map<string, MkTableCell>();\n for (const t of this.cellTemplates()) map.set(t.mkTableCell(), t);\n return map;\n });\n\n /** The template registered for a column, or null to fall back to text. */\n protected cellTemplateFor(key: string) {\n return this.cellTemplateByKey().get(key)?.template ?? null;\n }\n\n private readonly sortKey = signal<string | null>(null);\n private readonly sortDir = signal<Exclude<MkSortDirection, 'none'> | null>(\n null,\n );\n /** Stable id prefix so each detail row can be referenced by aria-controls. */\n private readonly detailIdBase = mkUniqueId('mk-table-detail');\n\n /** Total rendered columns, including the select and expander columns. */\n protected readonly totalColumns = computed(\n () =>\n this.columns().length +\n (this.selectable() ? 1 : 0) +\n (this.expandable() ? 1 : 0),\n );\n\n /**\n * Shared locale-sensitive collator for string sorting. `localeCompare`\n * re-resolves locale data on every call; one cached `Intl.Collator` makes\n * large-table sorts several-fold faster with the same default-locale order.\n */\n private static readonly sortCollator = new Intl.Collator();\n\n /** Data sorted by the active column, or the input order when unsorted. */\n protected readonly sortedData = computed<T[]>(() => this.sortRows(this.data()));\n\n /** Sort one sibling group by the active column (input order when unsorted). */\n private sortRows(rows: T[]): T[] {\n const key = this.sortKey();\n const dir = this.sortDir();\n if (!key || !dir) return rows;\n const compare = (a: T, b: T): number => {\n const av = (a as Record<string, unknown>)[key];\n const bv = (b as Record<string, unknown>)[key];\n if (av == null && bv == null) return 0;\n if (av == null) return -1;\n if (bv == null) return 1;\n if (typeof av === 'number' && typeof bv === 'number') return av - bv;\n return MkTable.sortCollator.compare(String(av), String(bv));\n };\n // Negate the comparator for desc (instead of reversing) so the sort stays\n // stable and null ordering is consistent in both directions.\n return [...rows].sort(dir === 'desc' ? (a, b) => -compare(a, b) : compare);\n }\n\n /** `aria-sort` value for a header cell. */\n protected ariaSort(col: MkTableColumn<T>): string | null {\n if (!col.sortable) return null;\n if (this.sortKey() !== col.key) return 'none';\n return this.sortDir() === 'asc' ? 'ascending' : 'descending';\n }\n\n /** Glyph indicating a column's sort state. */\n protected sortGlyph(col: MkTableColumn<T>): string {\n if (this.sortKey() !== col.key) return '↕';\n return this.sortDir() === 'asc' ? '↑' : '↓';\n }\n\n /** Raw cell value, handed to an `[mkTableCell]` template unformatted. */\n protected cellValue(row: T, col: MkTableColumn<T>): unknown {\n return (row as Record<string, unknown>)[col.key];\n }\n\n /** Rendered text for a cell, applying the column formatter if present. */\n protected cellText(row: T, col: MkTableColumn<T>): string {\n const raw = (row as Record<string, unknown>)[col.key];\n if (col.format) return col.format(raw, row);\n return raw == null ? '' : String(raw);\n }\n\n protected onSort(col: MkTableColumn<T>): void {\n if (!col.sortable) return;\n let direction: MkSortDirection;\n if (this.sortKey() !== col.key) {\n this.sortKey.set(col.key);\n this.sortDir.set('asc');\n direction = 'asc';\n } else if (this.sortDir() === 'asc') {\n this.sortDir.set('desc');\n direction = 'desc';\n } else {\n // desc -> cleared\n this.sortKey.set(null);\n this.sortDir.set(null);\n direction = 'none';\n }\n this.sortChange.emit({ key: col.key, direction });\n this.announcer.announce(\n direction === 'none'\n ? this.i18n.sortingCleared(col.header)\n : this.i18n.sortedBy(col.header, direction),\n );\n }\n\n protected onRowClick(row: T): void {\n if (this.clickableRows()) this.rowClick.emit(row);\n }\n\n /** Keyboard activation for clickable rows (Enter / Space) and tree keys. */\n protected onRowKeydown(event: KeyboardEvent, row: T): void {\n if (this.onTreeKeydown(event, row)) return;\n if (!this.clickableRows()) return;\n if (event.target !== event.currentTarget) return; // ignore inner controls\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.rowClick.emit(row);\n }\n }\n\n /** Stable row identity for `@for` tracking (trackKey when set, else the row). */\n protected trackRow = (row: T): unknown => this.rowKey(row);\n\n /** Leading cell text used to label per-row controls for screen readers. */\n protected rowLabel(row: T): string {\n const first = this.orderedColumns()[0];\n return first ? this.cellText(row, first) : '';\n }\n\n // --- Selection ------------------------------------------------------------\n private rowKey(row: T): unknown {\n const key = this.trackKey();\n return key ? (row as Record<string, unknown>)[key] : row;\n }\n\n /** Selected row keys as a Set — O(1) membership per cell per CD pass. */\n private readonly selectedKeys = computed<Set<unknown>>(\n () => new Set(this.selected().map((r) => this.rowKey(r))),\n );\n\n /** Whether `row` is currently selected. */\n protected isSelected(row: T): boolean {\n return this.selectedKeys().has(this.rowKey(row));\n }\n\n /**\n * Every data row, in display order, ignoring tree expansion — what\n * \"select all\" and the header checkbox reason about. Equals `sortedData`\n * for flat tables.\n */\n private readonly allRows = computed<T[]>(() => {\n if (!this.childrenKey()) return this.sortedData();\n const out: T[] = [];\n const walk = (rows: T[]): void => {\n for (const row of this.sortRows(rows)) {\n out.push(row);\n walk(this.childrenOf(row));\n }\n };\n walk(this.data());\n return out;\n });\n\n /** True when every visible row is selected. */\n protected readonly allSelected = computed<boolean>(() => {\n const rows = this.allRows();\n const keys = this.selectedKeys();\n return rows.length > 0 && rows.every((row) => keys.has(this.rowKey(row)));\n });\n\n /** True when some — but not all — visible rows are selected. */\n protected readonly someSelected = computed<boolean>(() => {\n const keys = this.selectedKeys();\n return (\n this.allRows().some((row) => keys.has(this.rowKey(row))) &&\n !this.allSelected()\n );\n });\n\n private commitSelection(next: T[]): void {\n this.selected.set(next);\n this.selectionChange.emit(next);\n }\n\n /** Toggle a single row's selection without triggering `rowClick`. */\n protected toggleRow(row: T): void {\n const rk = this.rowKey(row);\n const current = this.selected();\n const next = this.selectedKeys().has(rk)\n ? current.filter((r) => this.rowKey(r) !== rk)\n : [...current, row];\n this.commitSelection(next);\n }\n\n /** Select or deselect all rows (every tree row, expanded or not). */\n protected toggleAll(): void {\n const rows = this.allRows();\n const current = this.selected();\n if (this.allSelected()) {\n const visible = new Set(rows.map((r) => this.rowKey(r)));\n this.commitSelection(current.filter((r) => !visible.has(this.rowKey(r))));\n } else {\n const has = new Set(current.map((r) => this.rowKey(r)));\n this.commitSelection([\n ...current,\n ...rows.filter((r) => !has.has(this.rowKey(r))),\n ]);\n }\n }\n\n // --- Grouping ---------------------------------------------------------------\n /** Group values currently collapsed. */\n private readonly collapsedGroups = signal<Set<unknown>>(new Set());\n\n /** Rows grouped by {@link groupBy}, or `null` when grouping is off. */\n protected readonly groups = computed<MkTableGroup<T>[] | null>(() => {\n const by = this.groupBy();\n if (by == null) return null;\n const accessor =\n typeof by === 'function'\n ? by\n : (row: T) => (row as Record<string, unknown>)[by];\n const map = new Map<unknown, T[]>();\n for (const row of this.sortedData()) {\n const key = accessor(row);\n const bucket = map.get(key);\n if (bucket) bucket.push(row);\n else map.set(key, [row]);\n }\n const label = this.groupLabel();\n return [...map.entries()].map(([key, rows]) => ({\n key,\n label: label ? label(key, rows) : String(key),\n rows,\n }));\n });\n\n /**\n * The tbody render list: group headers interleaved with their (expanded)\n * rows when grouping is on, else just the sorted rows.\n */\n protected readonly displayItems = computed<MkTableItem<T>[]>(() => {\n const groups = this.groups();\n const items: MkTableItem<T>[] = [];\n if (!groups) {\n this.pushRows(items, this.sortedData(), 0);\n return items;\n }\n const collapsed = this.collapsedGroups();\n for (const group of groups) {\n items.push({ kind: 'group', group });\n if (!collapsed.has(group.key)) this.pushRows(items, group.rows, 0);\n }\n return items;\n });\n\n /**\n * Append `rows` as render items. In tree mode each row is followed by its\n * (sorted) children while it is expanded, one level deeper.\n */\n private pushRows(items: MkTableItem<T>[], rows: T[], depth: number): void {\n const tree = !!this.childrenKey();\n const expandedKeys = this.treeExpanded();\n for (const row of rows) {\n const children = tree ? this.childrenOf(row) : [];\n const hasChildren = children.length > 0;\n const expanded = hasChildren && expandedKeys.has(this.rowKey(row));\n items.push({ kind: 'row', row, depth, hasChildren, expanded });\n if (expanded) this.pushRows(items, this.sortRows(children), depth + 1);\n }\n }\n\n /** The child rows of `row` (tree mode), or an empty list. */\n private childrenOf(row: T): T[] {\n const key = this.childrenKey();\n if (!key) return [];\n const value = (row as Record<string, unknown>)[key];\n return Array.isArray(value) ? (value as T[]) : [];\n }\n\n // --- Tree rows ------------------------------------------------------------\n /** Keys of parent rows whose children are shown. */\n private readonly treeExpanded = signal<Set<unknown>>(new Set());\n\n /** Whether a parent row's children are currently shown (tree mode). */\n isTreeExpanded(row: T): boolean {\n return this.treeExpanded().has(this.rowKey(row));\n }\n\n /** Show or hide a parent row's children (tree mode). */\n toggleTreeRow(row: T, event?: Event): void {\n event?.stopPropagation();\n if (this.childrenOf(row).length === 0) return;\n this.setTreeExpanded(row, !this.isTreeExpanded(row));\n }\n\n /** Expand every parent row (tree mode). */\n expandAllRows(): void {\n const keys = new Set<unknown>();\n const walk = (rows: T[]): void => {\n for (const row of rows) {\n const children = this.childrenOf(row);\n if (children.length) {\n keys.add(this.rowKey(row));\n walk(children);\n }\n }\n };\n walk(this.data());\n this.treeExpanded.set(keys);\n }\n\n /** Collapse every parent row (tree mode). */\n collapseAllRows(): void {\n this.treeExpanded.set(new Set());\n }\n\n // --- Export -----------------------------------------------------------------\n /**\n * The table's rows as CSV: current column order, column formatters applied,\n * sorted the way they are shown, tree children flattened under their parent\n * whether or not they are expanded. Downloads the file (default name\n * `table.csv`) and returns the text.\n */\n exportCsv(options: MkTableExportOptions = {}): string {\n let rows = this.allRows();\n if (options.selectedOnly) {\n const keys = this.selectedKeys();\n rows = rows.filter((r) => keys.has(this.rowKey(r)));\n }\n const only = options.columns ? new Set(options.columns) : null;\n const columns = this.orderedColumns()\n .filter((c) => !only || only.has(c.key))\n .map((c) => ({ key: c.key, header: c.header, format: c.format }));\n // `allRows` is already flat, so no childrenKey is passed through.\n const csv = mkToCsv(rows, columns, { ...options, childrenKey: undefined });\n if (options.download !== false) {\n let filename = options.filename ?? 'table.csv';\n if (!/\\.csv$/i.test(filename)) filename += '.csv';\n mkDownloadText(csv, filename);\n }\n return csv;\n }\n\n private setTreeExpanded(row: T, expanded: boolean): void {\n const rk = this.rowKey(row);\n if (this.treeExpanded().has(rk) === expanded) return;\n const next = new Set(this.treeExpanded());\n if (expanded) next.add(rk);\n else next.delete(rk);\n this.treeExpanded.set(next);\n this.treeToggle.emit({ row, expanded });\n }\n\n /**\n * ArrowRight opens and ArrowLeft closes a parent row's children (swapped in\n * RTL). Handled for keys pressed on the row itself or on its tree toggle.\n */\n protected onTreeKeydown(event: KeyboardEvent, row: T): boolean {\n if (!this.childrenKey() || this.childrenOf(row).length === 0) return false;\n const rtl = this.document.defaultView?.getComputedStyle(this.host.nativeElement).direction === 'rtl';\n const openKey = rtl ? 'ArrowLeft' : 'ArrowRight';\n const closeKey = rtl ? 'ArrowRight' : 'ArrowLeft';\n if (event.key === openKey && !this.isTreeExpanded(row)) {\n event.preventDefault();\n this.setTreeExpanded(row, true);\n return true;\n }\n if (event.key === closeKey && this.isTreeExpanded(row)) {\n event.preventDefault();\n this.setTreeExpanded(row, false);\n return true;\n }\n return false;\n }\n\n /** `@for` identity: group headers by value, rows by {@link trackRow}. */\n protected trackItem = (item: MkTableItem<T>): unknown =>\n item.kind === 'group' ? `mk-group:${String(item.group.key)}` : this.rowKey(item.row);\n\n /** Whether a group is currently collapsed. */\n protected isGroupCollapsed(key: unknown): boolean {\n return this.collapsedGroups().has(key);\n }\n\n /** Collapse or expand a group header. */\n protected onGroupToggle(group: MkTableGroup<T>): void {\n const next = new Set(this.collapsedGroups());\n const collapsed = !next.has(group.key);\n if (collapsed) next.add(group.key);\n else next.delete(group.key);\n this.collapsedGroups.set(next);\n this.groupToggle.emit({ key: group.key, collapsed });\n }\n\n /** Collapse every group. */\n collapseAllGroups(): void {\n const groups = this.groups();\n if (groups) this.collapsedGroups.set(new Set(groups.map((g) => g.key)));\n }\n\n /** Expand every group. */\n expandAllGroups(): void {\n this.collapsedGroups.set(new Set());\n }\n\n // --- Expansion ------------------------------------------------------------\n private readonly expandedKeys = signal<Set<unknown>>(new Set());\n\n /** Whether `row`'s detail panel is currently expanded. */\n protected isExpanded(row: T): boolean {\n return this.expandedKeys().has(this.rowKey(row));\n }\n\n /** The DOM id of a row's detail panel (for `aria-controls`). */\n protected detailId(index: number): string {\n return `${this.detailIdBase}-${index}`;\n }\n\n /** Toggle a row's detail panel, honouring `singleExpand`. */\n protected toggleExpand(row: T, event?: Event): void {\n event?.stopPropagation();\n const rk = this.rowKey(row);\n const open = this.expandedKeys().has(rk);\n const next = this.singleExpand() ? new Set<unknown>() : new Set(this.expandedKeys());\n if (open) next.delete(rk);\n else next.add(rk);\n this.expandedKeys.set(next);\n this.expandedChange.emit(\n this.data().filter((r) => next.has(this.rowKey(r))),\n );\n }\n}\n","<div class=\"mk-table__scroll\">\n <!-- Explicit roles ONLY while stacked: `display: block` strips a table\n element of its implicit role, so without these a card layout stops\n being announced as tabular data at all. Redundant in the grid, so\n they are left off there rather than duplicating what the element\n already says. -->\n <table\n class=\"mk-table__table\"\n [attr.role]=\"childrenKey() ? 'treegrid' : stacked() ? 'table' : null\"\n >\n <thead class=\"mk-table__head\" [attr.role]=\"stacked() ? 'rowgroup' : null\">\n <tr>\n @if (expandable()) {\n <th scope=\"col\" class=\"mk-table__th mk-table__th--expand\">\n <span class=\"mk-visually-hidden\">{{ i18n.expandHeader }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"mk-table__th mk-table__th--select\">\n <mk-checkbox\n [aria-label]=\"i18n.selectAllRows\"\n [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\"\n (checkedChange)=\"toggleAll()\"\n />\n </th>\n }\n @for (col of orderedColumns(); track col.key) {\n <th\n scope=\"col\"\n class=\"mk-table__th\"\n [class.mk-table__th--sortable]=\"col.sortable\"\n [class.mk-table__th--pinned]=\"col.pinned\"\n [class.mk-table__th--pinned-right]=\"col.pinned === 'right'\"\n [class.mk-table__th--dragging]=\"dragKey() === col.key\"\n [style.width]=\"colStyleWidth(col)\"\n [style.inset-inline-start.px]=\"col.pinned === 'left' ? pinnedOffset(col) : null\"\n [style.inset-inline-end.px]=\"col.pinned === 'right' ? pinnedOffset(col) : null\"\n [attr.data-align]=\"col.align ?? 'start'\"\n [attr.aria-sort]=\"ariaSort(col)\"\n [attr.draggable]=\"reorderableColumns() && !col.pinned ? true : null\"\n (dragstart)=\"onColDragStart($event, col)\"\n (dragover)=\"onColDragOver($event)\"\n (drop)=\"onColDrop($event, col)\"\n (dragend)=\"onColDragEnd()\"\n >\n @if (col.sortable || (reorderableColumns() && !col.pinned)) {\n <button\n type=\"button\"\n class=\"mk-table__th-button\"\n [class.mk-table__th-button--static]=\"!col.sortable\"\n (click)=\"onSort(col)\"\n (keydown)=\"onReorderKeydown($event, col)\"\n >\n <span class=\"mk-table__th-label\">{{ col.header }}</span>\n @if (col.sortable) {\n <span class=\"mk-table__sort\" aria-hidden=\"true\">{{ sortGlyph(col) }}</span>\n }\n </button>\n } @else {\n <span class=\"mk-table__th-inner\">\n <span class=\"mk-table__th-label\">{{ col.header }}</span>\n </span>\n }\n @if (resizableColumns() && col.resizable) {\n <span\n class=\"mk-table__resize\"\n role=\"separator\"\n tabindex=\"0\"\n aria-orientation=\"vertical\"\n [attr.aria-label]=\"i18n.resizeColumn\"\n [attr.aria-valuemin]=\"resizeValueMin(col)\"\n [attr.aria-valuenow]=\"resizeValueNow(col)\"\n [attr.aria-valuemax]=\"resizeValueMax\"\n (pointerdown)=\"startResize($event, col)\"\n (keydown)=\"onResizeKeydown($event, col)\"\n (click)=\"$event.stopPropagation()\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody class=\"mk-table__body\" [attr.role]=\"stacked() ? 'rowgroup' : null\">\n @for (item of displayItems(); track trackItem(item); let i = $index) {\n @if (item.kind === 'group') {\n <tr class=\"mk-table__group-row\" [attr.role]=\"stacked() ? 'row' : null\">\n <th\n class=\"mk-table__group\"\n scope=\"colgroup\"\n [attr.role]=\"stacked() ? 'rowheader' : null\"\n [attr.colspan]=\"totalColumns()\"\n >\n <button\n type=\"button\"\n class=\"mk-table__group-toggle\"\n [attr.aria-expanded]=\"!isGroupCollapsed(item.group.key)\"\n (click)=\"onGroupToggle(item.group)\"\n >\n <span\n class=\"mk-table__expander-icon\"\n [class.mk-table__expander-icon--open]=\"!isGroupCollapsed(item.group.key)\"\n aria-hidden=\"true\"\n >›</span\n >\n <span class=\"mk-visually-hidden\">{{\n isGroupCollapsed(item.group.key) ? i18n.expandGroup : i18n.collapseGroup\n }}</span>\n <span class=\"mk-table__group-label\">{{ item.group.label }}</span>\n <span class=\"mk-table__group-count\">{{\n i18n.groupCount(item.group.rows.length)\n }}</span>\n </button>\n </th>\n </tr>\n } @else {\n <ng-container>\n <tr\n class=\"mk-table__row\"\n [attr.role]=\"stacked() || childrenKey() ? 'row' : null\"\n [class]=\"rowClassFor(item.row)\"\n [class.mk-table__row--selected]=\"selectable() && isSelected(item.row)\"\n [class.mk-table__row--expanded]=\"expandable() && isExpanded(item.row)\"\n [class.mk-table__row--parent]=\"item.hasChildren\"\n [style.--mk-tree-depth]=\"childrenKey() ? item.depth : null\"\n [style.margin-inline-start.px]=\"stacked() && item.depth ? item.depth * 16 : null\"\n [attr.aria-level]=\"childrenKey() ? item.depth + 1 : null\"\n [attr.aria-expanded]=\"item.hasChildren ? item.expanded : null\"\n [attr.tabindex]=\"clickableRows() ? 0 : null\"\n (click)=\"onRowClick(item.row)\"\n (keydown)=\"onRowKeydown($event, item.row)\"\n >\n @if (expandable()) {\n <td\n class=\"mk-table__td mk-table__td--expand\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n (click)=\"$event.stopPropagation()\"\n >\n <button\n type=\"button\"\n class=\"mk-table__expander\"\n [class.mk-table__expander--open]=\"isExpanded(item.row)\"\n [attr.aria-expanded]=\"isExpanded(item.row)\"\n [attr.aria-controls]=\"detailId(i)\"\n [attr.aria-label]=\"isExpanded(item.row) ? i18n.collapseRow : i18n.expandRow\"\n (click)=\"toggleExpand(item.row, $event)\"\n >\n <span class=\"mk-table__expander-icon\" aria-hidden=\"true\">›</span>\n </button>\n </td>\n }\n @if (selectable()) {\n <td\n class=\"mk-table__td mk-table__td--select\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n (click)=\"$event.stopPropagation()\"\n >\n <mk-checkbox\n [aria-label]=\"i18n.selectRow(rowLabel(item.row))\"\n [checked]=\"isSelected(item.row)\"\n (checkedChange)=\"toggleRow(item.row)\"\n />\n </td>\n }\n @if (!stacked()) {\n @for (col of orderedColumns(); track col.key; let first = $first) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: null, tree: first ? item : null }\"\n />\n }\n } @else {\n <!-- Card layout. Same <td> elements, restyled — keeping the table\n DOM means selection, expansion, inline edit and every cell\n template keep working, since all of them reach for a `td`. -->\n @for (col of stackTitleColumns(); track col.key; let first = $first) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: 'title', tree: first ? item : null }\"\n />\n }\n @for (col of stackFieldColumns(); track col.key) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: 'field' }\"\n />\n }\n @for (col of stackFooterColumns(); track col.key) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: 'footer' }\"\n />\n }\n }\n </tr>\n @if (expandable() && isExpanded(item.row) && rowDetail()) {\n <tr class=\"mk-table__detail-row\" [attr.role]=\"stacked() ? 'row' : null\">\n <td\n class=\"mk-table__detail\"\n [id]=\"detailId(i)\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n [attr.colspan]=\"totalColumns()\"\n >\n <div class=\"mk-table__detail-inner\">\n <ng-container\n [ngTemplateOutlet]=\"rowDetail()!.template\"\n [ngTemplateOutletContext]=\"{ $implicit: item.row }\"\n />\n </div>\n </td>\n </tr>\n }\n </ng-container>\n }\n } @empty {\n <tr class=\"mk-table__row mk-table__row--empty\" [attr.role]=\"stacked() ? 'row' : null\">\n <td\n class=\"mk-table__empty\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n [attr.colspan]=\"totalColumns()\"\n >\n <ng-content select=\"[mkTableEmpty]\">{{ emptyMessage() }}</ng-content>\n </td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n<!-- One cell, rendered by both layouts. `slot` is null in the grid and\n 'title' | 'field' | 'footer' in a card; everything else — the editor, the\n consumer's mkTableCell template, the formatted fallback — is identical, so\n a card can never drift from the grid it replaces. -->\n<ng-template #cellTpl let-col=\"col\" let-row=\"row\" let-i=\"i\" let-slot=\"slot\" let-tree=\"tree\">\n <td\n class=\"mk-table__td\"\n [class.mk-table__td--tree]=\"!!tree && !!childrenKey()\"\n [class.mk-table__td--pinned]=\"isPinned(col, 'left') || isPinned(col, 'right')\"\n [class.mk-table__td--pinned-right]=\"isPinned(col, 'right')\"\n [class.mk-table__td--editable]=\"col.editable\"\n [class.mk-table__td--stack-title]=\"slot === 'title'\"\n [class.mk-table__td--stack-field]=\"slot === 'field'\"\n [class.mk-table__td--stack-footer]=\"slot === 'footer'\"\n [style.width]=\"colStyleWidth(col)\"\n [style.inset-inline-start.px]=\"isPinned(col, 'left') ? pinnedOffset(col) : null\"\n [style.inset-inline-end.px]=\"isPinned(col, 'right') ? pinnedOffset(col) : null\"\n [attr.data-align]=\"col.align ?? 'start'\"\n [attr.tabindex]=\"col.editable ? 0 : null\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n (dblclick)=\"startEdit(i, col, $event)\"\n (keydown)=\"onCellKeydown($event, i, col)\"\n >\n @if (slot === 'field' && hasStackLabel(col)) {\n <!-- The column header, moved beside the value. Not aria-hidden: the\n <thead> is display:none while stacked, so this label is the only\n thing naming the value for a screen reader. -->\n <span class=\"mk-table__cell-label\">{{ col.header }}</span>\n }\n @if (tree && childrenKey()) {\n <!-- Tree toggle (or a spacer on leaves) ahead of the first cell's value,\n so the indent and the caret read as one column. -->\n @if (tree.hasChildren) {\n <button\n type=\"button\"\n class=\"mk-table__tree-toggle\"\n [class.mk-table__tree-toggle--open]=\"tree.expanded\"\n [attr.aria-expanded]=\"tree.expanded\"\n [attr.aria-label]=\"tree.expanded ? i18n.collapseTreeRow : i18n.expandTreeRow\"\n (click)=\"toggleTreeRow(row, $event)\"\n >\n <span class=\"mk-table__expander-icon\" [class.mk-table__expander-icon--open]=\"tree.expanded\" aria-hidden=\"true\">›</span>\n </button>\n } @else {\n <span class=\"mk-table__tree-spacer\" aria-hidden=\"true\"></span>\n }\n }\n <span class=\"mk-table__cell-value\">\n @if (isEditing(i, col)) {\n <input\n #editInput\n class=\"mk-table__cell-input\"\n [value]=\"cellText(row, col)\"\n [attr.aria-label]=\"col.header\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onEditKeydown($event, row, col)\"\n (blur)=\"commitEdit(row, col, $any($event.target).value)\"\n />\n } @else if (cellTemplateFor(col.key); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: cellValue(row, col), row }\"\n />\n } @else {\n {{ cellText(row, col) }}\n @if (col.editable) {\n <span class=\"mk-visually-hidden\">{{ i18n.editCell }}</span>\n }\n }\n </span>\n </td>\n</ng-template>\n","import {\n Directive,\n booleanAttribute,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport { MkLiveAnnouncer } from '@mk-kit/ui/core';\nimport { MK_I18N } from '@mk-kit/ui/core';\nimport type { MkSortDirection } from '../table/table';\n\n/** Current sort state emitted by {@link MkSort.mkSortChange}. */\nexport interface MkSortState {\n /** Id of the column being sorted by (empty when cleared). */\n active: string;\n /** Sort direction (`none` when cleared). */\n direction: MkSortDirection;\n}\n\n/**\n * The minimal shape {@link MkSort} needs from a header. Implemented by\n * {@link MkSortHeader}; declared separately so the coordinator does not depend\n * on the header's concrete type (avoids a circular import).\n */\nexport interface MkSortable {\n id(): string;\n start(): 'asc' | 'desc' | undefined;\n disabled(): boolean;\n sortLabel(): string;\n}\n\n/**\n * Sort coordinator — apply `mkSort` to a table (or any container) to track\n * which column is sorted and in which direction. It holds no data: register\n * headers with `mkSortHeader`, then re-sort your rows in the\n * `(mkSortChange)` handler. Mirrors the Angular Material `matSort` model but\n * signal-based.\n *\n * Clicking a header cycles asc → desc → unsorted (set `mkSortDisableClear` to\n * cycle asc ↔ desc only). `mkSortStart` flips the initial direction.\n *\n * ```html\n * <table mkSort mkSortActive=\"name\" mkSortDirection=\"asc\"\n * (mkSortChange)=\"sortData($event)\">\n * <thead><tr>\n * <th mkSortHeader=\"name\">Name</th>\n * <th mkSortHeader=\"size\" mkSortHeaderStart=\"desc\">Size</th>\n * </tr></thead>\n * …\n * </table>\n * ```\n */\n@Directive({\n selector: '[mkSort]',\n exportAs: 'mkSort',\n})\nexport class MkSort {\n private readonly announcer = inject(MkLiveAnnouncer);\n private readonly i18n = inject(MK_I18N);\n\n /** Id of the currently sorted column (two-way; empty when unsorted). */\n readonly active = model<string>('', { alias: 'mkSortActive' });\n /** Current sort direction (two-way). */\n readonly direction = model<MkSortDirection>('none', {\n alias: 'mkSortDirection',\n });\n /** Direction the first click on a header applies. Default `asc`. */\n readonly start = input<'asc' | 'desc'>('asc', { alias: 'mkSortStart' });\n /** Disable sorting for every header. */\n readonly disabled = input(false, {\n transform: booleanAttribute,\n alias: 'mkSortDisabled',\n });\n /** Remove the \"unsorted\" step so headers cycle asc ↔ desc only. */\n readonly disableClear = input(false, {\n transform: booleanAttribute,\n alias: 'mkSortDisableClear',\n });\n\n /** Emits the new sort state whenever a header is activated. */\n readonly sortChange = output<MkSortState>({ alias: 'mkSortChange' });\n\n /** Advance the sort state for the given header (called on click/keyboard). */\n sort(header: MkSortable): void {\n if (this.disabled() || header.disabled()) return;\n const id = header.id();\n if (this.active() !== id) {\n this.active.set(id);\n this.direction.set(this.startFor(header));\n } else {\n const next = this.nextDirection(header, this.direction());\n this.direction.set(next);\n if (next === 'none') this.active.set('');\n }\n const state: MkSortState = {\n active: this.active(),\n direction: this.direction(),\n };\n this.sortChange.emit(state);\n this.announce(header, state.direction);\n }\n\n /** Whether the given column id is the active, non-cleared sort. */\n isActive(id: string): boolean {\n return this.active() === id && this.direction() !== 'none';\n }\n\n private startFor(header: MkSortable): MkSortDirection {\n return header.start() ?? this.start();\n }\n\n private nextDirection(\n header: MkSortable,\n current: MkSortDirection,\n ): MkSortDirection {\n const order: MkSortDirection[] =\n this.startFor(header) === 'desc' ? ['desc', 'asc'] : ['asc', 'desc'];\n if (!this.disableClear()) order.push('none');\n const index = order.indexOf(current);\n return order[(index + 1) % order.length];\n }\n\n private announce(header: MkSortable, direction: MkSortDirection): void {\n const label = header.sortLabel() || header.id();\n const message =\n direction === 'none'\n ? this.i18n.sortingCleared(label)\n : this.i18n.sortedBy(label, direction === 'asc' ? 'asc' : 'desc');\n this.announcer.announce(message, 'polite');\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport type { MkSortDirection } from '../table/table';\nimport { MkSort, MkSortable } from './sort';\n\n/**\n * Sort header — attach `mkSortHeader` to a header cell (`<th>`) inside an\n * element carrying `mkSort`. It wraps the projected header text in a real\n * `<button>` (so assistive tech hears an operable control), adds a directional\n * arrow (faint on hover, solid when active), reflects `aria-sort` on the cell,\n * and toggles the sort on click or Enter/Space.\n *\n * ```html\n * <th mkSortHeader=\"email\" mkSortHeaderLabel=\"Email address\">Email</th>\n * ```\n */\n@Component({\n selector: '[mkSortHeader]',\n templateUrl: './sort-header.html',\n styleUrl: './sort-header.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mk-sort-header',\n '[class.mk-sort-header--active]': 'isActive()',\n '[class.mk-sort-header--disabled]': 'isDisabled()',\n '[attr.aria-sort]': 'ariaSort()',\n },\n})\nexport class MkSortHeader implements MkSortable {\n private readonly sort = inject(MkSort);\n\n /** Column id this header sorts by (the `mkSortHeader` value). */\n readonly id = input('', { alias: 'mkSortHeader' });\n /** Per-header override for the initial sort direction. */\n readonly start = input<'asc' | 'desc' | undefined>(undefined, {\n alias: 'mkSortHeaderStart',\n });\n /** Disable sorting for just this header. */\n readonly disabled = input(false, {\n transform: booleanAttribute,\n alias: 'mkSortHeaderDisabled',\n });\n /** Accessible label used in sort announcements (defaults to the id). */\n readonly sortLabel = input('', { alias: 'mkSortHeaderLabel' });\n\n /** Disabled if this header or the whole `mkSort` is disabled. */\n readonly isDisabled = computed(() => this.disabled() || this.sort.disabled());\n /** Whether this header is the active, non-cleared sort. */\n readonly isActive = computed(() => this.sort.isActive(this.id()));\n /** Active direction, or `none` when this header is not the active sort. */\n readonly direction = computed<MkSortDirection>(() =>\n this.isActive() ? this.sort.direction() : 'none',\n );\n /** `aria-sort` value for the header cell. */\n protected readonly ariaSort = computed(() => {\n if (!this.isActive()) return 'none';\n return this.sort.direction() === 'asc' ? 'ascending' : 'descending';\n });\n\n protected toggle(): void {\n if (!this.isDisabled()) this.sort.sort(this);\n }\n}\n","<!-- A real <button> rather than a clickable th: the cell keeps aria-sort,\n the button provides the operable-control semantics (and native\n Enter/Space activation) a screen-reader user expects. -->\n<button\n type=\"button\"\n class=\"mk-sort-header__button\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"mk-sort-header__label\"><ng-content /></span>\n @if (!isDisabled()) {\n <span\n class=\"mk-sort-header__arrow\"\n [class.mk-sort-header__arrow--active]=\"isActive()\"\n [class.mk-sort-header__arrow--desc]=\"direction() === 'desc'\"\n aria-hidden=\"true\"\n ></span>\n }\n</button>\n","import { DestroyRef, Signal, computed, inject, signal } from '@angular/core';\nimport type { Observable, Unsubscribable } from 'rxjs';\nimport type { MkSortChange } from './table/table';\nimport type { MkSort, MkSortState } from './sort/sort';\n\n/** The request handed to a {@link MkDataFetcher} on every load. */\nexport interface MkDataRequest {\n /** 1-based page index, matching `mk-pagination`. */\n page: number;\n /** Number of rows per page. */\n pageSize: number;\n /** Active sort, or `null` when unsorted (cleared sorts normalise to `null`). */\n sort: MkSortState | null;\n /** Free-text filter query (`''` = none). */\n filter: string;\n}\n\n/** One page of server data returned by a {@link MkDataFetcher}. */\nexport interface MkDataPage<T> {\n /** The rows for the requested page. */\n rows: T[];\n /** Total number of rows across ALL pages (drives the pager). */\n total: number;\n}\n\n/**\n * Loads one page of data for a {@link MkDataRequest}. May return a `Promise`\n * (e.g. `fetch`) or an `Observable` (e.g. `HttpClient`); an Observable is\n * treated as single-shot — the first emission wins and the subscription is\n * released.\n */\nexport type MkDataFetcher<T> = (\n req: MkDataRequest,\n) => Promise<MkDataPage<T>> | Observable<MkDataPage<T>>;\n\n/** Construction options for {@link MkTableDataSource}. */\nexport interface MkTableDataSourceOptions {\n /** Initial rows per page (default 10, matching `mk-pagination`). */\n pageSize?: number;\n /** Debounce for {@link MkTableDataSource.setFilter} in ms (default 300). */\n filterDebounce?: number;\n}\n\n/** Default debounce applied to {@link MkTableDataSource.setFilter}. */\nconst DEFAULT_FILTER_DEBOUNCE = 300;\n/** Default page size, matching `mk-pagination`. */\nconst DEFAULT_PAGE_SIZE = 10;\n\n/** Normalise any of the kit's sort payload shapes to `MkSortState | null`. */\nfunction normalizeSort(\n sort: MkSortState | MkSortChange | null | undefined,\n): MkSortState | null {\n if (!sort) return null;\n const active = 'active' in sort ? sort.active : sort.key;\n if (!active || sort.direction === 'none') return null;\n return { active, direction: sort.direction };\n}\n\n/** Whether two normalised sort states describe the same ordering. */\nfunction sameSort(a: MkSortState | null, b: MkSortState | null): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.active === b.active && a.direction === b.direction;\n}\n\n/** Duck-typed Observable check, so rxjs is a type-only dependency here. */\nfunction isSubscribable<T>(\n value: Promise<T> | Observable<T>,\n): value is Observable<T> {\n return typeof (value as Observable<T>).subscribe === 'function';\n}\n\n/**\n * Server-side data adapter for `mk-table` — the page/sort/filter plumbing every\n * admin screen otherwise hand-rolls. A plain class (no component, no injection\n * required): give it a fetcher and bind its signals; every setter re-queries\n * the server and **stale responses never overwrite newer state** (latest-wins).\n *\n * - `setFilter` is debounced (default 300 ms); page, sort and page size load\n * immediately. Sort, filter and page-size changes reset to page 1.\n * - `rows` keeps its previous value while loading and on error, so the table\n * never blanks mid-transition; `error` is cleared by the next successful\n * load.\n * - Created in an injection context (a component field initialiser) it hooks\n * `DestroyRef` and cleans up automatically; anywhere else, call\n * {@link destroy} yourself.\n *\n * ```ts\n * interface User { id: number; name: string; email: string; }\n *\n * @Component({\n * imports: [MkTable, MkPagination, MkInput],\n * template: `\n * <input\n * mkInput\n * type=\"search\"\n * placeholder=\"Search users…\"\n * (input)=\"ds.setFilter($any($event.target).value)\"\n * />\n *\n * <mk-table\n * [columns]=\"columns\"\n * [data]=\"ds.rows()\"\n * (sortChange)=\"ds.setSort($event)\"\n * />\n * @if (ds.error()) { <p role=\"alert\">Failed to load.</p> }\n * @if (ds.empty()) { <p>No users match.</p> }\n *\n * <mk-pagination\n * [total]=\"ds.total()\"\n * [pageSize]=\"ds.pageSize()\"\n * [page]=\"ds.page()\"\n * (pageChange)=\"ds.setPage($event)\"\n * />\n * `,\n * })\n * export class UsersPage {\n * private readonly http = inject(HttpClient);\n *\n * readonly columns: MkTableColumn<User>[] = [\n * { key: 'name', header: 'Name', sortable: true },\n * { key: 'email', header: 'Email', sortable: true },\n * ];\n *\n * // Field initialiser = injection context, so cleanup is automatic.\n * readonly ds = new MkTableDataSource<User>(\n * (req) =>\n * this.http.get<MkDataPage<User>>('/api/users', {\n * params: {\n * page: req.page,\n * size: req.pageSize,\n * q: req.filter,\n * ...(req.sort && {\n * sort: `${req.sort.active},${req.sort.direction}`,\n * }),\n * },\n * }),\n * { pageSize: 20 },\n * );\n * }\n * ```\n *\n * With a custom `mkSort` table, forward the directive instead of binding:\n *\n * ```ts\n * private readonly sort = viewChild.required(MkSort);\n * constructor() {\n * afterNextRender(() => this.ds.connectSort(this.sort()));\n * }\n * ```\n */\nexport class MkTableDataSource<T> {\n private readonly fetcher: MkDataFetcher<T>;\n private readonly debounceMs: number;\n\n private readonly _rows = signal<T[]>([]);\n private readonly _total = signal(0);\n private readonly _loading = signal(false);\n private readonly _error = signal<unknown | null>(null);\n private readonly _page = signal(1);\n private readonly _pageSize = signal(DEFAULT_PAGE_SIZE);\n private readonly _sort = signal<MkSortState | null>(null);\n private readonly _filter = signal('');\n\n /** Rows of the current page (`[]` until the first load lands). */\n readonly rows = this._rows.asReadonly();\n /** Total row count across all pages (feed to `mk-pagination`'s `total`). */\n readonly total = this._total.asReadonly();\n /** True while the LATEST request is in flight. */\n readonly loading = this._loading.asReadonly();\n /** The last load's error, or `null`; cleared by the next successful load. */\n readonly error = this._error.asReadonly();\n /** Current 1-based page. */\n readonly page = this._page.asReadonly();\n /** Current page size. */\n readonly pageSize = this._pageSize.asReadonly();\n /** Current sort, or `null` when unsorted. */\n readonly sort = this._sort.asReadonly();\n /** Current filter query (updates immediately, even while debouncing). */\n readonly filter = this._filter.asReadonly();\n /** True when a settled load reported no rows at all. */\n readonly empty: Signal<boolean> = computed(\n () => !this._loading() && this._total() === 0,\n );\n\n /** Monotonic request id — settles from older epochs are discarded. */\n private epoch = 0;\n /** Subscription to an in-flight Observable fetch, if any. */\n private activeSub: Unsubscribable | null = null;\n /** Pending filter-debounce timer. */\n private filterTimer: ReturnType<typeof setTimeout> | null = null;\n /** Subscriptions created by {@link connectSort}, keyed for idempotence. */\n private readonly sortSubs = new Map<MkSort, Unsubscribable>();\n private destroyed = false;\n\n constructor(fetcher: MkDataFetcher<T>, opts?: MkTableDataSourceOptions) {\n this.fetcher = fetcher;\n this.debounceMs = opts?.filterDebounce ?? DEFAULT_FILTER_DEBOUNCE;\n if (opts?.pageSize != null) this._pageSize.set(opts.pageSize);\n\n // Auto-cleanup when constructed in an injection context (a component\n // field initialiser). Outside one, inject() throws and the consumer owns\n // calling destroy().\n try {\n inject(DestroyRef).onDestroy(() => this.destroy());\n } catch {\n // Not in an injection context — manual destroy().\n }\n\n this.load();\n }\n\n /** Jump to a 1-based page and load it immediately. */\n setPage(page: number): void {\n const next = Math.max(1, Math.floor(page));\n if (next === this._page()) return;\n this._page.set(next);\n this.load();\n }\n\n /** Change the page size; resets to page 1 and loads immediately. */\n setPageSize(size: number): void {\n const next = Math.max(1, Math.floor(size));\n if (next === this._pageSize()) return;\n this._pageSize.set(next);\n this._page.set(1);\n this.load();\n }\n\n /**\n * Change the sort; resets to page 1 and loads immediately. Accepts either\n * the `mkSort` directive's {@link MkSortState} or `mk-table`'s\n * {@link MkSortChange} payload; a cleared sort (`direction: 'none'` or an\n * empty column id) normalises to `null`. A no-op when the sort is unchanged.\n */\n setSort(sort: MkSortState | MkSortChange | null): void {\n const next = normalizeSort(sort);\n if (sameSort(next, this._sort())) return;\n this._sort.set(next);\n this._page.set(1);\n this.load();\n }\n\n /**\n * Change the free-text filter. The `filter` signal updates (and the page\n * resets to 1) immediately, but the request is debounced — `refresh()`\n * flushes it early. A no-op when the query is unchanged.\n */\n setFilter(query: string): void {\n if (query === this._filter()) return;\n this._filter.set(query);\n this._page.set(1);\n this.cancelDebounce();\n if (this.destroyed) return;\n this.filterTimer = setTimeout(() => {\n this.filterTimer = null;\n this.load();\n }, this.debounceMs);\n }\n\n /**\n * Re-run the current request immediately (e.g. after a mutation). Flushes a\n * pending debounced filter, since the request reads the live filter value.\n */\n refresh(): void {\n this.load();\n }\n\n /**\n * Pipe an `mkSort` directive's changes into {@link setSort}. Idempotent per\n * directive instance; all subscriptions are released by {@link destroy}.\n */\n connectSort(sort: MkSort): void {\n if (this.destroyed || this.sortSubs.has(sort)) return;\n this.sortSubs.set(\n sort,\n sort.sortChange.subscribe((state) => this.setSort(state)),\n );\n }\n\n /**\n * Cancel pending work: the debounce timer, any in-flight Observable fetch,\n * and `connectSort` subscriptions. In-flight Promise settles are discarded.\n * Called automatically on host destroy when created in an injection context.\n */\n destroy(): void {\n if (this.destroyed) return;\n this.destroyed = true;\n this.epoch++; // Anything still in flight settles stale.\n this.cancelDebounce();\n this.unsubscribeActive();\n for (const sub of this.sortSubs.values()) sub.unsubscribe();\n this.sortSubs.clear();\n this._loading.set(false);\n }\n\n /** Start a load for the current request state; supersedes any in flight. */\n private load(): void {\n if (this.destroyed) return;\n this.cancelDebounce();\n this.unsubscribeActive();\n const epoch = ++this.epoch;\n this._loading.set(true);\n const req: MkDataRequest = {\n page: this._page(),\n pageSize: this._pageSize(),\n sort: this._sort(),\n filter: this._filter(),\n };\n let result: Promise<MkDataPage<T>> | Observable<MkDataPage<T>>;\n try {\n result = this.fetcher(req);\n } catch (err) {\n this.settleError(epoch, err);\n return;\n }\n if (isSubscribable(result)) {\n this.runObservable(result, epoch);\n } else {\n result.then(\n (page) => this.settleSuccess(epoch, page),\n (err) => this.settleError(epoch, err),\n );\n }\n }\n\n /** Subscribe single-shot: first emission (or error) settles, then release. */\n private runObservable(source: Observable<MkDataPage<T>>, epoch: number): void {\n let done = false;\n let sync = true;\n const sub = source.subscribe({\n next: (page) => {\n if (done) return;\n done = true;\n this.settleSuccess(epoch, page);\n if (!sync) this.clearSub(sub);\n },\n error: (err) => {\n if (done) return;\n done = true;\n this.settleError(epoch, err);\n if (!sync) this.clearSub(sub);\n },\n });\n sync = false;\n if (done) sub.unsubscribe();\n else this.activeSub = sub;\n }\n\n /** Apply a successful settle, unless a newer request superseded it. */\n private settleSuccess(epoch: number, page: MkDataPage<T>): void {\n if (epoch !== this.epoch || this.destroyed) return;\n this._rows.set(page.rows);\n this._total.set(page.total);\n this._error.set(null);\n this._loading.set(false);\n }\n\n /** Record a failed settle (rows/total untouched), unless superseded. */\n private settleError(epoch: number, err: unknown): void {\n if (epoch !== this.epoch || this.destroyed) return;\n this._error.set(err);\n this._loading.set(false);\n }\n\n private cancelDebounce(): void {\n if (this.filterTimer != null) {\n clearTimeout(this.filterTimer);\n this.filterTimer = null;\n }\n }\n\n private unsubscribeActive(): void {\n if (this.activeSub) {\n this.activeSub.unsubscribe();\n this.activeSub = null;\n }\n }\n\n private clearSub(sub: Unsubscribable): void {\n if (this.activeSub === sub) this.activeSub = null;\n sub.unsubscribe();\n }\n}\n","/**\n * @mk-kit/ui/table — the data table, grid features and sort directives.\n */\nexport * from './table';\nexport * from './sort';\nexport * from './data-source';\nexport * from './export';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAEA;;;;;;;;;;;;AAYG;MAIU,gBAAgB,CAAA;;AAElB,IAAA,QAAQ,GAAG,MAAM,CAAgC,WAAW,CAAC;uGAF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a,EAAE,GAAY,EAAA;QAC7C,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS;YAAE;AAC5C,QAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;AACpB,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;IAC1B;IAEQ,cAAc,GAAA;AACpB,QAAA,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE;AAC5B,YAAA,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;AAC9B,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI;QACzB;IACF;IAEQ,iBAAiB,GAAA;AACvB,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;AAC5B,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI;QACvB;IACF;AAEQ,IAAA,QAAQ,CAAC,GAAmB,EAAA;AAClC,QAAA,IAAI,IAAI,CAAC,SAAS,KAAK,GAAG;AAAE,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI;QACjD,GAAG,CAAC,WAAW,EAAE;IACnB;AACD;;AC/XD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"mk-kit-ui-table.mjs","sources":["../../../projects/mk-kit/table/table/table-row-detail.ts","../../../projects/mk-kit/table/table/table-cell.ts","../../../projects/mk-kit/table/export.ts","../../../projects/mk-kit/table/table/table.ts","../../../projects/mk-kit/table/table/table.html","../../../projects/mk-kit/table/sort/sort.ts","../../../projects/mk-kit/table/sort/sort-header.ts","../../../projects/mk-kit/table/sort/sort-header.html","../../../projects/mk-kit/table/data-source.ts","../../../projects/mk-kit/table/index.ts","../../../projects/mk-kit/table/mk-kit-ui-table.ts"],"sourcesContent":["import { Directive, TemplateRef, inject } from '@angular/core';\n\n/**\n * Marks an `<ng-template>` as the expandable detail content for {@link MkTable}\n * rows. The template's implicit context is the row object, so consumers can\n * destructure it with `let-row`:\n *\n * ```html\n * <mk-table [columns]=\"cols\" [data]=\"rows()\" expandable>\n * <ng-template mkTableRowDetail let-row>\n * <dl>… {{ row.notes }} …</dl>\n * </ng-template>\n * </mk-table>\n * ```\n */\n@Directive({\n selector: '[mkTableRowDetail]',\n})\nexport class MkTableRowDetail<T = unknown> {\n /** The projected detail template, rendered once per expanded row. */\n readonly template = inject<TemplateRef<{ $implicit: T }>>(TemplateRef);\n}\n","import { Directive, TemplateRef, inject, input } from '@angular/core';\n\n/** Context handed to an `[mkTableCell]` template. */\nexport interface MkTableCellContext<T = unknown> {\n /** The cell's raw value (the row's property named by the column key). */\n $implicit: unknown;\n /** The whole row, for cells that need more than one field. */\n row: T;\n}\n\n/**\n * Marks an `<ng-template>` as the renderer for one column's cells, named by the\n * column `key`. Without it a cell can only be text — `MkTableColumn.format`\n * returns a string — so anything richer (a status tag, an avatar, a progress\n * bar, an action button) meant abandoning `mk-table` for a hand-rolled\n * `<table>`.\n *\n * The value is the template's implicit context and the row is available as\n * `let-row`:\n *\n * ```html\n * <mk-table [columns]=\"cols\" [data]=\"rows()\">\n * <ng-template mkTableCell=\"status\" let-value let-row=\"row\">\n * <mk-tag [tone]=\"toneFor(value)\">{{ label(value) }}</mk-tag>\n * </ng-template>\n * </mk-table>\n * ```\n *\n * A column with both a template and a `format` uses the template; `format`\n * still applies to sorting/export paths that need a string.\n */\n@Directive({\n selector: '[mkTableCell]',\n})\nexport class MkTableCell<T = unknown> {\n /** Column key whose cells this template renders. */\n readonly mkTableCell = input.required<string>();\n\n /** The projected template, rendered once per cell in that column. */\n readonly template =\n inject<TemplateRef<MkTableCellContext<T>>>(TemplateRef);\n}\n","/**\n * CSV export — turn rows into RFC 4180 text and hand it to the browser as a\n * download. Framework-free so it also serves data that never touched a table.\n */\n\n/** A column to export: the row property, its header, and an optional formatter. */\nexport interface MkCsvColumn<T = Record<string, unknown>> {\n /** Property key on each row object supplying the cell value. */\n key: string;\n /** Header text; defaults to `key`. */\n header?: string;\n /** Formatter turning the raw value into cell text (same shape as `MkTableColumn.format`). */\n format?: (value: unknown, row: T) => string;\n}\n\nexport interface MkCsvOptions {\n /** Field separator (default `,`; use `;` for locales whose Excel expects it). */\n delimiter?: string;\n /** Emit the header row first (default `true`). */\n header?: boolean;\n /** Line terminator (default `\\r\\n`, per RFC 4180). */\n newline?: string;\n /**\n * Prefix a UTF-8 byte-order mark (default `true`) so Excel reads accented\n * characters correctly. Only affects the downloaded file / returned text.\n */\n bom?: boolean;\n /**\n * Neutralise spreadsheet formula injection (default `true`): a text cell\n * starting with `=`, `+`, `-`, `@`, tab or CR is prefixed with `'` so a\n * malicious value cannot execute when opened in Excel / Sheets. Numbers\n * are never touched, so `-5` stays `-5`.\n */\n sanitize?: boolean;\n /** Property holding child rows; when set, trees are flattened depth-first. */\n childrenKey?: string;\n}\n\n/** Options for {@link mkExportCsv}. */\nexport interface MkCsvExportOptions extends MkCsvOptions {\n /** File name for the download (default `export.csv`; `.csv` is appended if missing). */\n filename?: string;\n}\n\nconst NEEDS_QUOTES = /[\"\\r\\n]/;\nconst FORMULA_LEAD = /^[=+\\-@\\t\\r]/;\n\n/** Escape one cell for CSV. */\nfunction csvCell(value: unknown, delimiter: string, sanitize: boolean): string {\n if (value == null) return '';\n let text: string;\n if (typeof value === 'string') {\n text = sanitize && FORMULA_LEAD.test(value) ? `'${value}` : value;\n } else if (value instanceof Date) {\n text = value.toISOString();\n } else if (typeof value === 'object') {\n text = JSON.stringify(value);\n } else {\n text = String(value);\n }\n return NEEDS_QUOTES.test(text) || text.includes(delimiter) || /^\\s|\\s$/.test(text)\n ? `\"${text.replace(/\"/g, '\"\"')}\"`\n : text;\n}\n\n/**\n * Serialise `rows` as CSV text.\n *\n * Without `columns` every key of the first row is exported in its own order.\n * Column formatters are applied, so what the user saw in the table is what\n * lands in the file.\n */\nexport function mkToCsv<T>(\n rows: readonly T[],\n columns?: readonly MkCsvColumn<T>[],\n options: MkCsvOptions = {},\n): string {\n const delimiter = options.delimiter ?? ',';\n const newline = options.newline ?? '\\r\\n';\n const sanitize = options.sanitize ?? true;\n const cols: readonly MkCsvColumn<T>[] =\n columns ??\n Object.keys((rows[0] ?? {}) as object)\n .filter((key) => key !== options.childrenKey)\n .map((key) => ({ key }));\n\n const flat: T[] = [];\n const walk = (list: readonly T[]): void => {\n for (const row of list) {\n flat.push(row);\n const children = options.childrenKey\n ? (row as Record<string, unknown>)[options.childrenKey]\n : null;\n if (Array.isArray(children)) walk(children as T[]);\n }\n };\n walk(rows);\n\n const lines: string[] = [];\n if (options.header ?? true) {\n lines.push(cols.map((c) => csvCell(c.header ?? c.key, delimiter, sanitize)).join(delimiter));\n }\n for (const row of flat) {\n lines.push(\n cols\n .map((c) => {\n const raw = (row as Record<string, unknown>)[c.key];\n const value = c.format ? c.format(raw, row) : raw;\n return csvCell(value, delimiter, sanitize);\n })\n .join(delimiter),\n );\n }\n return (options.bom ?? true ? '' : '') + lines.join(newline) + newline;\n}\n\n/**\n * Trigger a browser download of `text` as a file. No-op outside a DOM\n * (server-side rendering); returns whether a download was started.\n */\nexport function mkDownloadText(\n text: string,\n filename: string,\n type = 'text/csv;charset=utf-8',\n): boolean {\n if (typeof document === 'undefined' || typeof URL?.createObjectURL !== 'function') return false;\n const url = URL.createObjectURL(new Blob([text], { type }));\n const a = document.createElement('a');\n a.href = url;\n a.download = filename;\n a.rel = 'noopener';\n a.style.display = 'none';\n document.body.appendChild(a);\n a.click();\n a.remove();\n // Give the click a tick to grab the blob before the URL is released.\n setTimeout(() => URL.revokeObjectURL(url), 0);\n return true;\n}\n\n/**\n * Serialise `rows` as CSV and download it. Returns the CSV text so callers\n * can also keep it (tests, previews, uploads).\n */\nexport function mkExportCsv<T>(\n rows: readonly T[],\n columns?: readonly MkCsvColumn<T>[],\n options: MkCsvExportOptions = {},\n): string {\n const csv = mkToCsv(rows, columns, options);\n let filename = options.filename ?? 'export.csv';\n if (!/\\.csv$/i.test(filename)) filename += '.csv';\n mkDownloadText(csv, filename);\n return csv;\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n PLATFORM_ID,\n afterNextRender,\n booleanAttribute,\n computed,\n contentChild,\n contentChildren,\n effect,\n inject,\n input,\n model,\n numberAttribute,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from '@angular/common';\nimport { MkLiveAnnouncer } from '@mk-kit/ui/core';\nimport { MK_I18N } from '@mk-kit/ui/core';\nimport { mkUniqueId } from '@mk-kit/ui/core';\nimport { MkCheckbox } from '@mk-kit/ui/checkbox';\nimport { MkTableRowDetail } from './table-row-detail';\nimport { MkTableCell } from './table-cell';\nimport { mkDownloadText, mkToCsv, type MkCsvExportOptions } from '../export';\n\n/** Horizontal text alignment for a table column. */\nexport type MkTableAlign = 'start' | 'center' | 'end';\n/** Sort direction; `none` means unsorted. */\nexport type MkSortDirection = 'asc' | 'desc' | 'none';\n/** Row vertical density. */\nexport type MkTableDensity = 'comfortable' | 'compact';\n\n/** Column definition for {@link MkTable}. */\nexport interface MkTableColumn<T = Record<string, unknown>> {\n /** Property key on each row object supplying the cell value. */\n key: string;\n /** Visible column header text. */\n header: string;\n /** Allow sorting by this column. */\n sortable?: boolean;\n /** Cell/header alignment (default `start`). */\n align?: MkTableAlign;\n /** Fixed column width (any CSS length). */\n width?: string;\n /** Optional formatter turning the raw value into display text. */\n format?: (value: unknown, row: T) => string;\n /** Allow the user to drag-resize this column (needs `resizableColumns`). */\n resizable?: boolean;\n /** Make this column's cells inline-editable (double-click / Enter). */\n editable?: boolean;\n /** Pin (freeze) this column to a side while the body scrolls horizontally. */\n pinned?: 'left' | 'right';\n /** Minimum width in px when resizing (default 60). */\n minWidth?: number;\n /**\n * What becomes of this column when the table stacks into cards\n * (see {@link MkTable.stackAt}). Omitted, the column renders as a labelled\n * field: its `header` on one side, its value on the other.\n *\n * - `'title'` — the card's heading. No label; the value identifies the\n * record at a glance (an order number, a product name). Mark one, or two\n * if something short belongs beside it such as a status or a total.\n * - `'footer'` — pinned to the bottom of the card, full width and unlabelled.\n * Where an actions cell belongs: buttons read as buttons, rather than as\n * the answer to a label.\n * - `'hide'` — not rendered at all. Not merely invisible: the cell is never\n * created, so a screen reader does not read it either. For columns that\n * only earn their place while scanning a grid, and especially for anything\n * an expandable row detail already repeats.\n */\n stack?: 'title' | 'footer' | 'hide';\n}\n\n/** Payload emitted by {@link MkTable.sortChange}. */\nexport interface MkSortChange {\n /** Column key sorted by. */\n key: string;\n /** Resulting direction (`none` when sorting was cleared). */\n direction: MkSortDirection;\n}\n\n/** Payload emitted by {@link MkTable.columnResize} after a column resize. */\nexport interface MkColumnResize {\n /** The resized column's key. */\n key: string;\n /** The new width in pixels. */\n width: number;\n}\n\n/** Payload emitted by {@link MkTable.cellEdit} when an editable cell is saved. */\nexport interface MkCellEdit<T = Record<string, unknown>> {\n /** The edited row. */\n row: T;\n /** The column key that was edited. */\n key: string;\n /** The new (string) value the user entered. */\n value: string;\n}\n\n/** A group of rows produced by {@link MkTable.groupBy}. */\nexport interface MkTableGroup<T = Record<string, unknown>> {\n /** The shared group value. */\n key: unknown;\n /** Display label for the group header. */\n label: string;\n /** The rows in this group, in display (sorted) order. */\n rows: T[];\n}\n\n/** Payload emitted by {@link MkTable.groupToggle}. */\n/** Payload of `(treeToggle)`: a parent row was expanded or collapsed. */\nexport interface MkTreeToggle<T = Record<string, unknown>> {\n /** The parent row. */\n row: T;\n /** Whether its child rows are now shown. */\n expanded: boolean;\n}\n\nexport interface MkGroupToggle {\n /** The toggled group's value. */\n key: unknown;\n /** Whether the group is now collapsed. */\n collapsed: boolean;\n}\n\n/** Options for {@link MkTable.exportCsv}. */\nexport interface MkTableExportOptions extends MkCsvExportOptions {\n /** Export only the selected rows (default: every row). */\n selectedOnly?: boolean;\n /** Restrict to these column keys, in table order (default: every column). */\n columns?: readonly string[];\n /** Start the browser download (default `true`); `false` just returns the text. */\n download?: boolean;\n}\n\n/** Hard floor (px) for column resize when a column sets no `minWidth`. */\nconst MIN_COL_WIDTH = 60;\n/** Upper bound advertised on resize separators (`aria-valuemax`). */\nconst MAX_COL_WIDTH = 2000;\n\n/** One rendered tbody entry: either a group header or a data row. */\ntype MkTableItem<T> =\n | { kind: 'group'; group: MkTableGroup<T> }\n | {\n kind: 'row';\n row: T;\n /** Nesting depth in tree mode (0 for roots and for flat tables). */\n depth: number;\n /** Whether the row has child rows (tree mode). */\n hasChildren: boolean;\n /** Whether its children are currently shown (tree mode). */\n expanded: boolean;\n };\n\n/**\n * Table — a themed data table built on a native `<table>` for accessibility.\n * Supply `columns` and `data`; opt into sortable columns, sticky header,\n * zebra striping, hover and density. Sorting is fully keyboard operable\n * (Enter/Space on a header) and announces changes via {@link MkLiveAnnouncer}.\n *\n * ```html\n * <mk-table\n * [columns]=\"columns\"\n * [data]=\"rows()\"\n * stickyHeader\n * zebra\n * (sortChange)=\"onSort($event)\"\n * (rowClick)=\"open($event)\" />\n * ```\n */\n@Component({\n selector: 'mk-table',\n templateUrl: './table.html',\n styleUrl: './table.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [MkCheckbox, NgTemplateOutlet],\n host: {\n class: 'mk-table',\n '[class.mk-table--sticky]': 'stickyHeader()',\n '[class.mk-table--zebra]': 'zebra()',\n '[class.mk-table--hover]': 'hover()',\n '[class.mk-table--compact]': \"density() === 'compact'\",\n '[class.mk-table--clickable]': 'clickableRows()',\n '[class.mk-table--selectable]': 'selectable()',\n '[class.mk-table--expandable]': 'expandable()',\n '[class.mk-table--grouped]': 'groupBy() !== null',\n '[class.mk-table--stacked]': 'stacked()',\n },\n})\nexport class MkTable<T = Record<string, unknown>> {\n private readonly announcer = inject(MkLiveAnnouncer);\n protected readonly i18n = inject(MK_I18N);\n private readonly document = inject(DOCUMENT);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * True while the table is narrower than {@link stackAt} and rendering cards.\n *\n * Driven by the element's own width rather than the viewport's: the question\n * \"do these columns fit\" is about the space the table HAS, not the size of\n * the screen. A table in a sidebar or a dialog should stack while the window\n * around it is enormous.\n */\n protected readonly stacked = signal(false);\n\n constructor() {\n // Keep the sticky group-header offset in sync with the rendered thead\n // height (it shifts with density, sticky mode and grouping itself).\n effect(() => {\n this.stickyHeader();\n this.density();\n this.groupBy();\n afterNextRender(\n { read: () => this.applyGroupTop() },\n { injector: this.injector },\n );\n });\n\n // Watch the host's width against `stackAt`. ResizeObserver rather than\n // matchMedia because the trigger is the element's width, not the window's.\n // Skipped entirely on the server and wherever the API is missing, leaving\n // `stacked` false — the grid is the safe fallback, since it renders the\n // same data with nothing dropped.\n afterNextRender(\n {\n read: () => {\n if (!this.isBrowser || typeof ResizeObserver === 'undefined') return;\n const el = this.host.nativeElement;\n const observer = new ResizeObserver(([entry]) => {\n const limit = this.stackAt();\n this.stacked.set(limit > 0 && entry.contentRect.width < limit);\n });\n observer.observe(el);\n this.destroyRef.onDestroy(() => observer.disconnect());\n },\n },\n { injector: this.injector },\n );\n }\n\n /** Measures the thead and exposes it as the group rows' sticky offset. */\n private applyGroupTop(): void {\n if (this.groupBy() == null) return;\n const thead = this.host.nativeElement.querySelector('thead');\n const h =\n this.stickyHeader() && thead ? thead.getBoundingClientRect().height : 0;\n this.host.nativeElement.style.setProperty(\n '--_group-top',\n `${Math.round(h)}px`,\n );\n }\n\n /** Column definitions (order = display order). */\n readonly columns = input.required<MkTableColumn<T>[]>();\n /** Row objects to render. */\n readonly data = input<T[]>([]);\n /** Pin the header to the top of the scroll container. */\n readonly stickyHeader = input(false, { transform: booleanAttribute });\n /** Alternate row background for readability. */\n readonly zebra = input(false, { transform: booleanAttribute });\n /** Highlight rows on hover. */\n readonly hover = input(true, { transform: booleanAttribute });\n /** Row density. */\n readonly density = input<MkTableDensity>('comfortable');\n /**\n * Width in px below which each row renders as a CARD instead of a table row.\n * `0` (default) never stacks.\n *\n * Measured on the table's own container, not the viewport — a table in a\n * narrow sidebar should stack on a desktop, and a table on a tablet in\n * landscape should not. Per-column behaviour is set with\n * {@link MkTableColumn.stack}.\n *\n * A grid cannot survive a phone: eight columns become eight unreadable\n * slivers, and horizontal scrolling loses the row you were reading. Cards\n * keep one record together and put its header beside each value.\n */\n readonly stackAt = input(0, { transform: numberAttribute });\n /** Style rows as clickable and emit `rowClick`. */\n readonly clickableRows = input(false, { transform: booleanAttribute });\n /** Message shown when there are no rows. */\n readonly emptyMessage = input(this.i18n.noData);\n /** Render a leading checkbox column for row selection. */\n readonly selectable = input(false, { transform: booleanAttribute });\n /**\n * Two-way bound array of selected rows. Use `[(selected)]` to bind, or read\n * `selectionChange`. Rows are compared by {@link trackKey} when set, else by\n * referential identity.\n */\n readonly selected = model<T[]>([]);\n /**\n * Property name identifying a row for selection equality. When omitted rows\n * are matched by reference.\n */\n readonly trackKey = input<string>();\n\n /**\n * Optional per-row CSS class: called with each row, the returned string is\n * appended to the row's class list (falsy → none). For state the consumer\n * owns — an \"active in the side panel\" highlight, an unread accent — that\n * `selectable`'s own selected style doesn't cover.\n */\n readonly rowClass = input<((row: T) => string | null | undefined) | null>(\n null,\n );\n\n /** Resolved class for a row (empty string when no `rowClass` is set). */\n protected rowClassFor(row: T): string {\n return this.rowClass()?.(row) ?? '';\n }\n /**\n * Render a leading expander column. Each row can reveal a detail panel\n * supplied via an `<ng-template mkTableRowDetail let-row>`.\n */\n readonly expandable = input(false, { transform: booleanAttribute });\n /** Allow only one row expanded at a time (accordion). */\n readonly singleExpand = input(false, { transform: booleanAttribute });\n /** Enable drag-to-resize on columns marked `resizable` (data-grid pro). */\n readonly resizableColumns = input(false, { transform: booleanAttribute });\n /** Enable drag-to-reorder of column headers (data-grid pro). */\n readonly reorderableColumns = input(false, { transform: booleanAttribute });\n /**\n * Group rows by a column key or an accessor. Renders a collapsible group\n * header row (sticky, with a row count) above each group. Sorting still\n * applies within groups; groups follow their first row's sorted position.\n */\n readonly groupBy = input<string | ((row: T) => unknown) | null>(null);\n /** Formats a group header label; defaults to `String(value)`. */\n readonly groupLabel = input<\n ((value: unknown, rows: T[]) => string) | null\n >(null);\n\n /** Emitted when the sort column/direction changes. */\n readonly sortChange = output<MkSortChange>();\n /** Emitted when a row is clicked (enable via `clickableRows`). */\n readonly rowClick = output<T>();\n /** Emitted with the new selection whenever it changes (enable via `selectable`). */\n readonly selectionChange = output<T[]>();\n /** Emitted with the currently expanded rows whenever they change. */\n readonly expandedChange = output<T[]>();\n /** Emitted when a column is resized (px). */\n readonly columnResize = output<MkColumnResize>();\n /** Emitted with the new column key order after a reorder. */\n readonly columnReorder = output<string[]>();\n /** Emitted when an inline-editable cell is saved. */\n readonly cellEdit = output<MkCellEdit<T>>();\n /** Emitted when a group header is expanded or collapsed. */\n readonly groupToggle = output<MkGroupToggle>();\n /**\n * Tree rows: the property on each row holding its child rows (`T[]`). When\n * set, the table renders a tree grid — child rows are indented under their\n * parent behind an expand toggle in the first column, sorting applies per\n * sibling group, and ArrowRight / ArrowLeft on a row open / close it.\n */\n readonly childrenKey = input<string | null>(null);\n /** Emitted when a parent row is expanded or collapsed (tree mode). */\n readonly treeToggle = output<MkTreeToggle<T>>();\n\n /** User-set column widths (px), keyed by column key. */\n private readonly colWidths = signal<Record<string, number>>({});\n /** User-set column order (keys); `null` = the input order. */\n private readonly colOrder = signal<string[] | null>(null);\n /** The cell currently being inline-edited. */\n protected readonly editing = signal<{ index: number; key: string } | null>(\n null,\n );\n\n /** Columns in display order, honouring any user reordering. */\n protected readonly orderedColumns = computed<MkTableColumn<T>[]>(() => {\n const cols = this.columns();\n const order = this.colOrder();\n if (!order) return cols;\n const byKey = new Map(cols.map((c) => [c.key, c]));\n const ordered = order.map((k) => byKey.get(k)).filter((c): c is MkTableColumn<T> => !!c);\n // Append any columns not present in the saved order (e.g. newly added).\n const seen = new Set(order);\n for (const c of cols) if (!seen.has(c.key)) ordered.push(c);\n return ordered;\n });\n\n // ── Stacked (card) layout ────────────────────────────────────────────────\n // Three slots, so a card reads as a record rather than as a form: a heading\n // line, labelled fields, and actions along the bottom. Columns keep their\n // configured order within each slot.\n\n /** Columns forming the card's heading line. */\n protected readonly stackTitleColumns = computed(() =>\n this.orderedColumns().filter((c) => c.stack === 'title'),\n );\n /** Columns rendered as `label / value` rows in the card body. */\n protected readonly stackFieldColumns = computed(() =>\n this.orderedColumns().filter((c) => !c.stack),\n );\n /** Columns pinned to the bottom of the card, unlabelled. */\n protected readonly stackFooterColumns = computed(() =>\n this.orderedColumns().filter((c) => c.stack === 'footer'),\n );\n\n /**\n * Whether a stacked cell should show its column header as a label.\n *\n * An empty header means the column never had a name to show — an actions or\n * chevron column — and an empty label box would just be a gap the reader has\n * to account for.\n */\n protected hasStackLabel(col: MkTableColumn<T>): boolean {\n return !!col.header?.trim();\n }\n\n /** The rendered width for a column, if the user resized it. */\n protected colStyleWidth(col: MkTableColumn<T>): string | null {\n // A card has one column, so a per-column width — configured or dragged —\n // would pin the value box to a grid width that no longer exists.\n if (this.stacked()) return null;\n const w = this.colWidths()[col.key];\n if (w != null) return `${w}px`;\n return col.width ?? null;\n }\n\n /** Sticky offsets for every pinned column, computed once per layout change. */\n private readonly pinnedOffsets = computed<Map<string, number>>(() => {\n const map = new Map<string, number>();\n const cols = this.orderedColumns();\n const widths = this.colWidths();\n // Account for the leading select / expander columns at the inline start.\n let left = (this.selectable() ? 44 : 0) + (this.expandable() ? 44 : 0);\n for (const c of cols) {\n if (c.pinned !== 'left') continue;\n map.set(c.key, left);\n left += widths[c.key] ?? this.numericWidth(c);\n }\n let right = 0;\n for (let i = cols.length - 1; i >= 0; i--) {\n const c = cols[i];\n if (c.pinned !== 'right') continue;\n map.set(c.key, right);\n right += widths[c.key] ?? this.numericWidth(c);\n }\n return map;\n });\n\n /** Sticky offset (px) for a pinned column. */\n protected pinnedOffset(col: MkTableColumn<T>): number {\n return this.pinnedOffsets().get(col.key) ?? 0;\n }\n\n /** Pinning freezes a column against horizontal scroll. Cards do not scroll\n * sideways, so both the class and its inline offset are suppressed. */\n protected isPinned(col: MkTableColumn<T>, side: 'left' | 'right'): boolean {\n return !this.stacked() && col.pinned === side;\n }\n\n private numericWidth(col: MkTableColumn<T>): number {\n const w = col.width ? parseInt(col.width, 10) : NaN;\n return Number.isFinite(w) ? w : 150;\n }\n\n // --- Column resize --------------------------------------------------------\n private resizeKey: string | null = null;\n private resizeStartX = 0;\n private resizeStartW = 0;\n private resizeMin = MIN_COL_WIDTH;\n /** +1 in LTR, -1 in RTL — dragging toward the inline-end always widens. */\n private resizeSign: 1 | -1 = 1;\n\n /** Whether the table currently renders right-to-left (SSR-safe). */\n private isRtl(): boolean {\n const view = this.document.defaultView;\n if (!view) return false;\n return view.getComputedStyle(this.host.nativeElement).direction === 'rtl';\n }\n\n private resizeRaf: number | null = null;\n private pendingResizeX = 0;\n\n /** Begin a drag-resize from a header handle. */\n protected startResize(event: PointerEvent, col: MkTableColumn<T>): void {\n if (!this.resizableColumns() || !col.resizable) return;\n event.preventDefault();\n event.stopPropagation();\n const th = (event.target as HTMLElement).closest('th') as HTMLElement | null;\n this.resizeKey = col.key;\n this.resizeStartX = event.clientX;\n this.resizeSign = this.isRtl() ? -1 : 1;\n this.resizeStartW =\n this.colWidths()[col.key] ?? th?.getBoundingClientRect().width ?? this.numericWidth(col);\n this.resizeMin = col.minWidth ?? MIN_COL_WIDTH;\n this.document.addEventListener('pointermove', this.onResizeMove);\n this.document.addEventListener('pointerup', this.onResizeEnd);\n this.document.addEventListener('pointercancel', this.onResizeEnd);\n }\n\n /** rAF-coalesced: at most one width write (and CD pass) per frame. */\n private readonly onResizeMove = (event: PointerEvent): void => {\n if (!this.resizeKey) return;\n this.pendingResizeX = event.clientX;\n if (this.resizeRaf != null) return;\n this.resizeRaf = this.document.defaultView?.requestAnimationFrame(() => {\n this.resizeRaf = null;\n this.applyPendingResize();\n }) ?? null;\n };\n\n private applyPendingResize(): void {\n if (!this.resizeKey) return;\n const width = Math.max(\n this.resizeMin,\n Math.round(\n this.resizeStartW +\n this.resizeSign * (this.pendingResizeX - this.resizeStartX),\n ),\n );\n this.colWidths.update((w) => ({ ...w, [this.resizeKey as string]: width }));\n }\n\n private readonly onResizeEnd = (): void => {\n if (this.resizeRaf != null) {\n // Flush (don't drop) the last pending move so a fast drag lands exactly.\n this.document.defaultView?.cancelAnimationFrame(this.resizeRaf);\n this.resizeRaf = null;\n this.applyPendingResize();\n }\n if (this.resizeKey) {\n const col = this.columns().find((c) => c.key === this.resizeKey);\n const width =\n this.colWidths()[this.resizeKey] ?? Math.round(this.resizeStartW);\n this.columnResize.emit({ key: this.resizeKey, width });\n if (col) this.announcer.announce(this.i18n.columnWidth(col.header, width));\n }\n this.resizeKey = null;\n this.document.removeEventListener('pointermove', this.onResizeMove);\n this.document.removeEventListener('pointerup', this.onResizeEnd);\n this.document.removeEventListener('pointercancel', this.onResizeEnd);\n };\n\n /** Keyboard column resize on the focused separator (APG window splitter). */\n protected onResizeKeydown(event: KeyboardEvent, col: MkTableColumn<T>): void {\n if (!this.resizableColumns() || !col.resizable) return;\n const step = event.shiftKey ? 1 : 10;\n let delta = 0;\n if (event.key === 'ArrowLeft') delta = -step;\n else if (event.key === 'ArrowRight') delta = step;\n else return;\n // Mirror in RTL so pressing toward the inline-end always grows the column.\n if (this.isRtl()) delta = -delta;\n event.preventDefault();\n event.stopPropagation();\n const min = col.minWidth ?? MIN_COL_WIDTH;\n const th = (event.target as HTMLElement).closest('th');\n const current =\n this.colWidths()[col.key] ??\n th?.getBoundingClientRect().width ??\n this.numericWidth(col);\n const width = Math.max(min, Math.round(current + delta));\n this.colWidths.update((w) => ({ ...w, [col.key]: width }));\n this.columnResize.emit({ key: col.key, width });\n this.announcer.announce(this.i18n.columnWidth(col.header, width));\n }\n\n /** The current width of a column, for the separator's aria-valuenow. */\n protected resizeValueNow(col: MkTableColumn<T>): number {\n return Math.round(this.colWidths()[col.key] ?? this.numericWidth(col));\n }\n\n /** The resize floor for a column, for the separator's aria-valuemin. */\n protected resizeValueMin(col: MkTableColumn<T>): number {\n return col.minWidth ?? MIN_COL_WIDTH;\n }\n\n /** Advertised resize ceiling (aria-valuemax) — a sane constant bound. */\n protected readonly resizeValueMax = MAX_COL_WIDTH;\n\n ngOnDestroy(): void {\n if (this.resizeRaf != null) {\n this.document.defaultView?.cancelAnimationFrame(this.resizeRaf);\n this.resizeRaf = null;\n }\n this.document.removeEventListener('pointermove', this.onResizeMove);\n this.document.removeEventListener('pointerup', this.onResizeEnd);\n this.document.removeEventListener('pointercancel', this.onResizeEnd);\n }\n\n // --- Column reorder (native drag) -----------------------------------------\n protected readonly dragKey = signal<string | null>(null);\n\n protected onColDragStart(event: DragEvent, col: MkTableColumn<T>): void {\n if (!this.reorderableColumns()) return;\n this.dragKey.set(col.key);\n event.dataTransfer?.setData('text/plain', col.key);\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move';\n }\n\n protected onColDragOver(event: DragEvent): void {\n if (this.reorderableColumns() && this.dragKey()) event.preventDefault();\n }\n\n protected onColDrop(event: DragEvent, target: MkTableColumn<T>): void {\n const from = this.dragKey();\n this.dragKey.set(null);\n if (!from || from === target.key) return;\n event.preventDefault();\n const order = this.orderedColumns().map((c) => c.key);\n const toIdx = order.indexOf(target.key);\n this.moveColumn(from, toIdx);\n }\n\n protected onColDragEnd(): void {\n this.dragKey.set(null);\n }\n\n /** Move a column to `toIdx` in the display order and announce it. */\n private moveColumn(key: string, toIdx: number): void {\n const order = this.orderedColumns().map((c) => c.key);\n const fromIdx = order.indexOf(key);\n if (fromIdx < 0 || toIdx < 0 || toIdx >= order.length || fromIdx === toIdx) {\n return;\n }\n order.splice(toIdx, 0, order.splice(fromIdx, 1)[0]);\n this.colOrder.set(order);\n this.columnReorder.emit(order);\n const col = this.columns().find((c) => c.key === key);\n if (col) {\n this.announcer.announce(\n this.i18n.columnMoved(col.header, toIdx + 1, order.length),\n );\n }\n }\n\n /** Keyboard column reorder: Alt+Arrow moves the focused header. */\n protected onReorderKeydown(event: KeyboardEvent, col: MkTableColumn<T>): void {\n if (!this.reorderableColumns() || col.pinned || !event.altKey) return;\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return;\n // Swallow the combo even when the move is a no-op (first column moved\n // further left, last moved right) — otherwise Alt+Arrow falls through to\n // the browser's history Back/Forward and navigates away from the grid.\n event.preventDefault();\n const order = this.orderedColumns().map((c) => c.key);\n const idx = order.indexOf(col.key);\n if (event.key === 'ArrowLeft' && idx > 0) {\n this.moveColumn(col.key, idx - 1);\n } else if (event.key === 'ArrowRight' && idx < order.length - 1) {\n this.moveColumn(col.key, idx + 1);\n }\n }\n\n // --- Inline cell edit -----------------------------------------------------\n protected isEditing(index: number, col: MkTableColumn<T>): boolean {\n const e = this.editing();\n return !!e && e.index === index && e.key === col.key;\n }\n\n /** The cell element being edited, so focus can be restored after. */\n private editingCell: HTMLElement | null = null;\n\n /** The inline-edit input, focused once it renders. */\n private readonly editInput =\n viewChild<ElementRef<HTMLInputElement>>('editInput');\n\n protected startEdit(index: number, col: MkTableColumn<T>, event?: Event): void {\n if (!col.editable) return;\n event?.stopPropagation();\n this.editingCell =\n ((event?.target as HTMLElement | null)?.closest('td') as HTMLElement | null) ??\n null;\n this.editing.set({ index, key: col.key });\n // Explicit focus once the input exists — a dynamically inserted\n // `autofocus` attribute is not honoured after initial page load.\n afterNextRender(() => this.editInput()?.nativeElement.focus(), {\n injector: this.injector,\n });\n }\n\n /** Keyboard path into edit mode (Enter / F2 on a focused editable cell). */\n protected onCellKeydown(\n event: KeyboardEvent,\n index: number,\n col: MkTableColumn<T>,\n ): void {\n if (!col.editable || this.isEditing(index, col)) return;\n if (event.key === 'Enter' || event.key === 'F2') {\n event.preventDefault();\n event.stopPropagation();\n this.startEdit(index, col, event);\n }\n }\n\n protected commitEdit(\n row: T,\n col: MkTableColumn<T>,\n value: string,\n restoreFocus = false,\n ): void {\n this.editing.set(null);\n this.cellEdit.emit({ row, key: col.key, value });\n this.announcer.announce(this.i18n.cellSaved(value));\n if (restoreFocus) this.editingCell?.focus();\n this.editingCell = null;\n }\n\n protected cancelEdit(restoreFocus = false): void {\n this.editing.set(null);\n if (restoreFocus) this.editingCell?.focus();\n this.editingCell = null;\n }\n\n protected onEditKeydown(\n event: KeyboardEvent,\n row: T,\n col: MkTableColumn<T>,\n ): void {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.commitEdit(row, col, (event.target as HTMLInputElement).value, true);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.cancelEdit(true);\n }\n }\n\n /** The projected row-detail template (enable via `expandable`). */\n protected readonly rowDetail = contentChild(MkTableRowDetail);\n\n /** Per-column cell templates, projected as `<ng-template mkTableCell=\"key\">`. */\n private readonly cellTemplates = contentChildren(MkTableCell);\n private readonly cellTemplateByKey = computed(() => {\n const map = new Map<string, MkTableCell>();\n for (const t of this.cellTemplates()) map.set(t.mkTableCell(), t);\n return map;\n });\n\n /** The template registered for a column, or null to fall back to text. */\n protected cellTemplateFor(key: string) {\n return this.cellTemplateByKey().get(key)?.template ?? null;\n }\n\n private readonly sortKey = signal<string | null>(null);\n private readonly sortDir = signal<Exclude<MkSortDirection, 'none'> | null>(\n null,\n );\n /** Stable id prefix so each detail row can be referenced by aria-controls. */\n private readonly detailIdBase = mkUniqueId('mk-table-detail');\n\n /** Total rendered columns, including the select and expander columns. */\n protected readonly totalColumns = computed(\n () =>\n this.columns().length +\n (this.selectable() ? 1 : 0) +\n (this.expandable() ? 1 : 0),\n );\n\n /**\n * Shared locale-sensitive collator for string sorting. `localeCompare`\n * re-resolves locale data on every call; one cached `Intl.Collator` makes\n * large-table sorts several-fold faster with the same default-locale order.\n */\n private static readonly sortCollator = new Intl.Collator();\n\n /** Data sorted by the active column, or the input order when unsorted. */\n protected readonly sortedData = computed<T[]>(() => this.sortRows(this.data()));\n\n /** Sort one sibling group by the active column (input order when unsorted). */\n private sortRows(rows: T[]): T[] {\n const key = this.sortKey();\n const dir = this.sortDir();\n if (!key || !dir) return rows;\n const compare = (a: T, b: T): number => {\n const av = (a as Record<string, unknown>)[key];\n const bv = (b as Record<string, unknown>)[key];\n if (av == null && bv == null) return 0;\n if (av == null) return -1;\n if (bv == null) return 1;\n if (typeof av === 'number' && typeof bv === 'number') return av - bv;\n return MkTable.sortCollator.compare(String(av), String(bv));\n };\n // Negate the comparator for desc (instead of reversing) so the sort stays\n // stable and null ordering is consistent in both directions.\n return [...rows].sort(dir === 'desc' ? (a, b) => -compare(a, b) : compare);\n }\n\n /** `aria-sort` value for a header cell. */\n protected ariaSort(col: MkTableColumn<T>): string | null {\n if (!col.sortable) return null;\n if (this.sortKey() !== col.key) return 'none';\n return this.sortDir() === 'asc' ? 'ascending' : 'descending';\n }\n\n /** Glyph indicating a column's sort state. */\n protected sortGlyph(col: MkTableColumn<T>): string {\n if (this.sortKey() !== col.key) return '↕';\n return this.sortDir() === 'asc' ? '↑' : '↓';\n }\n\n /** Raw cell value, handed to an `[mkTableCell]` template unformatted. */\n protected cellValue(row: T, col: MkTableColumn<T>): unknown {\n return (row as Record<string, unknown>)[col.key];\n }\n\n /** Rendered text for a cell, applying the column formatter if present. */\n protected cellText(row: T, col: MkTableColumn<T>): string {\n const raw = (row as Record<string, unknown>)[col.key];\n if (col.format) return col.format(raw, row);\n return raw == null ? '' : String(raw);\n }\n\n protected onSort(col: MkTableColumn<T>): void {\n if (!col.sortable) return;\n let direction: MkSortDirection;\n if (this.sortKey() !== col.key) {\n this.sortKey.set(col.key);\n this.sortDir.set('asc');\n direction = 'asc';\n } else if (this.sortDir() === 'asc') {\n this.sortDir.set('desc');\n direction = 'desc';\n } else {\n // desc -> cleared\n this.sortKey.set(null);\n this.sortDir.set(null);\n direction = 'none';\n }\n this.sortChange.emit({ key: col.key, direction });\n this.announcer.announce(\n direction === 'none'\n ? this.i18n.sortingCleared(col.header)\n : this.i18n.sortedBy(col.header, direction),\n );\n }\n\n protected onRowClick(row: T): void {\n if (this.clickableRows()) this.rowClick.emit(row);\n }\n\n /** Keyboard activation for clickable rows (Enter / Space) and tree keys. */\n protected onRowKeydown(event: KeyboardEvent, row: T): void {\n if (this.onTreeKeydown(event, row)) return;\n if (!this.clickableRows()) return;\n if (event.target !== event.currentTarget) return; // ignore inner controls\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.rowClick.emit(row);\n }\n }\n\n /** Stable row identity for `@for` tracking (trackKey when set, else the row). */\n protected trackRow = (row: T): unknown => this.rowKey(row);\n\n /** Leading cell text used to label per-row controls for screen readers. */\n protected rowLabel(row: T): string {\n const first = this.orderedColumns()[0];\n return first ? this.cellText(row, first) : '';\n }\n\n // --- Selection ------------------------------------------------------------\n private rowKey(row: T): unknown {\n const key = this.trackKey();\n return key ? (row as Record<string, unknown>)[key] : row;\n }\n\n /** Selected row keys as a Set — O(1) membership per cell per CD pass. */\n private readonly selectedKeys = computed<Set<unknown>>(\n () => new Set(this.selected().map((r) => this.rowKey(r))),\n );\n\n /** Whether `row` is currently selected. */\n protected isSelected(row: T): boolean {\n return this.selectedKeys().has(this.rowKey(row));\n }\n\n /**\n * Every data row, in display order, ignoring tree expansion — what\n * \"select all\" and the header checkbox reason about. Equals `sortedData`\n * for flat tables.\n */\n private readonly allRows = computed<T[]>(() => {\n if (!this.childrenKey()) return this.sortedData();\n const out: T[] = [];\n const walk = (rows: T[]): void => {\n for (const row of this.sortRows(rows)) {\n out.push(row);\n walk(this.childrenOf(row));\n }\n };\n walk(this.data());\n return out;\n });\n\n /** True when every visible row is selected. */\n protected readonly allSelected = computed<boolean>(() => {\n const rows = this.allRows();\n const keys = this.selectedKeys();\n return rows.length > 0 && rows.every((row) => keys.has(this.rowKey(row)));\n });\n\n /** True when some — but not all — visible rows are selected. */\n protected readonly someSelected = computed<boolean>(() => {\n const keys = this.selectedKeys();\n return (\n this.allRows().some((row) => keys.has(this.rowKey(row))) &&\n !this.allSelected()\n );\n });\n\n private commitSelection(next: T[]): void {\n this.selected.set(next);\n this.selectionChange.emit(next);\n }\n\n /** Toggle a single row's selection without triggering `rowClick`. */\n protected toggleRow(row: T): void {\n const rk = this.rowKey(row);\n const current = this.selected();\n const next = this.selectedKeys().has(rk)\n ? current.filter((r) => this.rowKey(r) !== rk)\n : [...current, row];\n this.commitSelection(next);\n }\n\n /** Select or deselect all rows (every tree row, expanded or not). */\n protected toggleAll(): void {\n const rows = this.allRows();\n const current = this.selected();\n if (this.allSelected()) {\n const visible = new Set(rows.map((r) => this.rowKey(r)));\n this.commitSelection(current.filter((r) => !visible.has(this.rowKey(r))));\n } else {\n const has = new Set(current.map((r) => this.rowKey(r)));\n this.commitSelection([\n ...current,\n ...rows.filter((r) => !has.has(this.rowKey(r))),\n ]);\n }\n }\n\n // --- Grouping ---------------------------------------------------------------\n /** Group values currently collapsed. */\n private readonly collapsedGroups = signal<Set<unknown>>(new Set());\n\n /** Rows grouped by {@link groupBy}, or `null` when grouping is off. */\n protected readonly groups = computed<MkTableGroup<T>[] | null>(() => {\n const by = this.groupBy();\n if (by == null) return null;\n const accessor =\n typeof by === 'function'\n ? by\n : (row: T) => (row as Record<string, unknown>)[by];\n const map = new Map<unknown, T[]>();\n for (const row of this.sortedData()) {\n const key = accessor(row);\n const bucket = map.get(key);\n if (bucket) bucket.push(row);\n else map.set(key, [row]);\n }\n const label = this.groupLabel();\n return [...map.entries()].map(([key, rows]) => ({\n key,\n label: label ? label(key, rows) : String(key),\n rows,\n }));\n });\n\n /**\n * The tbody render list: group headers interleaved with their (expanded)\n * rows when grouping is on, else just the sorted rows.\n */\n protected readonly displayItems = computed<MkTableItem<T>[]>(() => {\n const groups = this.groups();\n const items: MkTableItem<T>[] = [];\n if (!groups) {\n this.pushRows(items, this.sortedData(), 0);\n return items;\n }\n const collapsed = this.collapsedGroups();\n for (const group of groups) {\n items.push({ kind: 'group', group });\n if (!collapsed.has(group.key)) this.pushRows(items, group.rows, 0);\n }\n return items;\n });\n\n /**\n * Append `rows` as render items. In tree mode each row is followed by its\n * (sorted) children while it is expanded, one level deeper.\n */\n private pushRows(items: MkTableItem<T>[], rows: T[], depth: number): void {\n const tree = !!this.childrenKey();\n const expandedKeys = this.treeExpanded();\n for (const row of rows) {\n const children = tree ? this.childrenOf(row) : [];\n const hasChildren = children.length > 0;\n const expanded = hasChildren && expandedKeys.has(this.rowKey(row));\n items.push({ kind: 'row', row, depth, hasChildren, expanded });\n if (expanded) this.pushRows(items, this.sortRows(children), depth + 1);\n }\n }\n\n /** The child rows of `row` (tree mode), or an empty list. */\n private childrenOf(row: T): T[] {\n const key = this.childrenKey();\n if (!key) return [];\n const value = (row as Record<string, unknown>)[key];\n return Array.isArray(value) ? (value as T[]) : [];\n }\n\n // --- Tree rows ------------------------------------------------------------\n /** Keys of parent rows whose children are shown. */\n private readonly treeExpanded = signal<Set<unknown>>(new Set());\n\n /** Whether a parent row's children are currently shown (tree mode). */\n isTreeExpanded(row: T): boolean {\n return this.treeExpanded().has(this.rowKey(row));\n }\n\n /** Show or hide a parent row's children (tree mode). */\n toggleTreeRow(row: T, event?: Event): void {\n event?.stopPropagation();\n if (this.childrenOf(row).length === 0) return;\n this.setTreeExpanded(row, !this.isTreeExpanded(row));\n }\n\n /** Expand every parent row (tree mode). */\n expandAllRows(): void {\n const keys = new Set<unknown>();\n const walk = (rows: T[]): void => {\n for (const row of rows) {\n const children = this.childrenOf(row);\n if (children.length) {\n keys.add(this.rowKey(row));\n walk(children);\n }\n }\n };\n walk(this.data());\n this.treeExpanded.set(keys);\n }\n\n /** Collapse every parent row (tree mode). */\n collapseAllRows(): void {\n this.treeExpanded.set(new Set());\n }\n\n // --- Export -----------------------------------------------------------------\n /**\n * The table's rows as CSV: current column order, column formatters applied,\n * sorted the way they are shown, tree children flattened under their parent\n * whether or not they are expanded. Downloads the file (default name\n * `table.csv`) and returns the text.\n */\n exportCsv(options: MkTableExportOptions = {}): string {\n let rows = this.allRows();\n if (options.selectedOnly) {\n const keys = this.selectedKeys();\n rows = rows.filter((r) => keys.has(this.rowKey(r)));\n }\n const only = options.columns ? new Set(options.columns) : null;\n const columns = this.orderedColumns()\n .filter((c) => !only || only.has(c.key))\n .map((c) => ({ key: c.key, header: c.header, format: c.format }));\n // `allRows` is already flat, so no childrenKey is passed through.\n const csv = mkToCsv(rows, columns, { ...options, childrenKey: undefined });\n if (options.download !== false) {\n let filename = options.filename ?? 'table.csv';\n if (!/\\.csv$/i.test(filename)) filename += '.csv';\n mkDownloadText(csv, filename);\n }\n return csv;\n }\n\n private setTreeExpanded(row: T, expanded: boolean): void {\n const rk = this.rowKey(row);\n if (this.treeExpanded().has(rk) === expanded) return;\n const next = new Set(this.treeExpanded());\n if (expanded) next.add(rk);\n else next.delete(rk);\n this.treeExpanded.set(next);\n this.treeToggle.emit({ row, expanded });\n }\n\n /**\n * ArrowRight opens and ArrowLeft closes a parent row's children (swapped in\n * RTL). Handled for keys pressed on the row itself or on its tree toggle.\n */\n protected onTreeKeydown(event: KeyboardEvent, row: T): boolean {\n if (!this.childrenKey() || this.childrenOf(row).length === 0) return false;\n const rtl = this.document.defaultView?.getComputedStyle(this.host.nativeElement).direction === 'rtl';\n const openKey = rtl ? 'ArrowLeft' : 'ArrowRight';\n const closeKey = rtl ? 'ArrowRight' : 'ArrowLeft';\n if (event.key === openKey && !this.isTreeExpanded(row)) {\n event.preventDefault();\n this.setTreeExpanded(row, true);\n return true;\n }\n if (event.key === closeKey && this.isTreeExpanded(row)) {\n event.preventDefault();\n this.setTreeExpanded(row, false);\n return true;\n }\n return false;\n }\n\n /** `@for` identity: group headers by value, rows by {@link trackRow}. */\n protected trackItem = (item: MkTableItem<T>): unknown =>\n item.kind === 'group' ? `mk-group:${String(item.group.key)}` : this.rowKey(item.row);\n\n /** Whether a group is currently collapsed. */\n protected isGroupCollapsed(key: unknown): boolean {\n return this.collapsedGroups().has(key);\n }\n\n /** Collapse or expand a group header. */\n protected onGroupToggle(group: MkTableGroup<T>): void {\n const next = new Set(this.collapsedGroups());\n const collapsed = !next.has(group.key);\n if (collapsed) next.add(group.key);\n else next.delete(group.key);\n this.collapsedGroups.set(next);\n this.groupToggle.emit({ key: group.key, collapsed });\n }\n\n /** Collapse every group. */\n collapseAllGroups(): void {\n const groups = this.groups();\n if (groups) this.collapsedGroups.set(new Set(groups.map((g) => g.key)));\n }\n\n /** Expand every group. */\n expandAllGroups(): void {\n this.collapsedGroups.set(new Set());\n }\n\n // --- Expansion ------------------------------------------------------------\n private readonly expandedKeys = signal<Set<unknown>>(new Set());\n\n /** Whether `row`'s detail panel is currently expanded. */\n protected isExpanded(row: T): boolean {\n return this.expandedKeys().has(this.rowKey(row));\n }\n\n /** The DOM id of a row's detail panel (for `aria-controls`). */\n protected detailId(index: number): string {\n return `${this.detailIdBase}-${index}`;\n }\n\n /** Toggle a row's detail panel, honouring `singleExpand`. */\n protected toggleExpand(row: T, event?: Event): void {\n event?.stopPropagation();\n const rk = this.rowKey(row);\n const open = this.expandedKeys().has(rk);\n const next = this.singleExpand() ? new Set<unknown>() : new Set(this.expandedKeys());\n if (open) next.delete(rk);\n else next.add(rk);\n this.expandedKeys.set(next);\n this.expandedChange.emit(\n this.data().filter((r) => next.has(this.rowKey(r))),\n );\n }\n}\n","<div class=\"mk-table__scroll\">\n <!-- Explicit roles ONLY while stacked: `display: block` strips a table\n element of its implicit role, so without these a card layout stops\n being announced as tabular data at all. Redundant in the grid, so\n they are left off there rather than duplicating what the element\n already says. -->\n <table\n class=\"mk-table__table\"\n [attr.role]=\"childrenKey() ? 'treegrid' : stacked() ? 'table' : null\"\n >\n <thead class=\"mk-table__head\" [attr.role]=\"stacked() ? 'rowgroup' : null\">\n <tr>\n @if (expandable()) {\n <th scope=\"col\" class=\"mk-table__th mk-table__th--expand\">\n <span class=\"mk-visually-hidden\">{{ i18n.expandHeader }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"mk-table__th mk-table__th--select\">\n <mk-checkbox\n [aria-label]=\"i18n.selectAllRows\"\n [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\"\n (checkedChange)=\"toggleAll()\"\n />\n </th>\n }\n @for (col of orderedColumns(); track col.key) {\n <th\n scope=\"col\"\n class=\"mk-table__th\"\n [class.mk-table__th--sortable]=\"col.sortable\"\n [class.mk-table__th--pinned]=\"col.pinned\"\n [class.mk-table__th--pinned-right]=\"col.pinned === 'right'\"\n [class.mk-table__th--dragging]=\"dragKey() === col.key\"\n [style.width]=\"colStyleWidth(col)\"\n [style.inset-inline-start.px]=\"col.pinned === 'left' ? pinnedOffset(col) : null\"\n [style.inset-inline-end.px]=\"col.pinned === 'right' ? pinnedOffset(col) : null\"\n [attr.data-align]=\"col.align ?? 'start'\"\n [attr.aria-sort]=\"ariaSort(col)\"\n [attr.draggable]=\"reorderableColumns() && !col.pinned ? true : null\"\n (dragstart)=\"onColDragStart($event, col)\"\n (dragover)=\"onColDragOver($event)\"\n (drop)=\"onColDrop($event, col)\"\n (dragend)=\"onColDragEnd()\"\n >\n @if (col.sortable || (reorderableColumns() && !col.pinned)) {\n <button\n type=\"button\"\n class=\"mk-table__th-button\"\n [class.mk-table__th-button--static]=\"!col.sortable\"\n (click)=\"onSort(col)\"\n (keydown)=\"onReorderKeydown($event, col)\"\n >\n <span class=\"mk-table__th-label\">{{ col.header }}</span>\n @if (col.sortable) {\n <span class=\"mk-table__sort\" aria-hidden=\"true\">{{ sortGlyph(col) }}</span>\n }\n </button>\n } @else {\n <span class=\"mk-table__th-inner\">\n <span class=\"mk-table__th-label\">{{ col.header }}</span>\n </span>\n }\n @if (resizableColumns() && col.resizable) {\n <span\n class=\"mk-table__resize\"\n role=\"separator\"\n tabindex=\"0\"\n aria-orientation=\"vertical\"\n [attr.aria-label]=\"i18n.resizeColumn\"\n [attr.aria-valuemin]=\"resizeValueMin(col)\"\n [attr.aria-valuenow]=\"resizeValueNow(col)\"\n [attr.aria-valuemax]=\"resizeValueMax\"\n (pointerdown)=\"startResize($event, col)\"\n (keydown)=\"onResizeKeydown($event, col)\"\n (click)=\"$event.stopPropagation()\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody class=\"mk-table__body\" [attr.role]=\"stacked() ? 'rowgroup' : null\">\n @for (item of displayItems(); track trackItem(item); let i = $index) {\n @if (item.kind === 'group') {\n <tr class=\"mk-table__group-row\" [attr.role]=\"stacked() ? 'row' : null\">\n <th\n class=\"mk-table__group\"\n scope=\"colgroup\"\n [attr.role]=\"stacked() ? 'rowheader' : null\"\n [attr.colspan]=\"totalColumns()\"\n >\n <button\n type=\"button\"\n class=\"mk-table__group-toggle\"\n [attr.aria-expanded]=\"!isGroupCollapsed(item.group.key)\"\n (click)=\"onGroupToggle(item.group)\"\n >\n <span\n class=\"mk-table__expander-icon\"\n [class.mk-table__expander-icon--open]=\"!isGroupCollapsed(item.group.key)\"\n aria-hidden=\"true\"\n >›</span\n >\n <span class=\"mk-visually-hidden\">{{\n isGroupCollapsed(item.group.key) ? i18n.expandGroup : i18n.collapseGroup\n }}</span>\n <span class=\"mk-table__group-label\">{{ item.group.label }}</span>\n <span class=\"mk-table__group-count\">{{\n i18n.groupCount(item.group.rows.length)\n }}</span>\n </button>\n </th>\n </tr>\n } @else {\n <ng-container>\n <tr\n class=\"mk-table__row\"\n [attr.role]=\"stacked() || childrenKey() ? 'row' : null\"\n [class]=\"rowClassFor(item.row)\"\n [class.mk-table__row--selected]=\"selectable() && isSelected(item.row)\"\n [class.mk-table__row--expanded]=\"expandable() && isExpanded(item.row)\"\n [class.mk-table__row--parent]=\"item.hasChildren\"\n [style.--mk-tree-depth]=\"childrenKey() ? item.depth : null\"\n [style.margin-inline-start.px]=\"stacked() && item.depth ? item.depth * 16 : null\"\n [attr.aria-level]=\"childrenKey() ? item.depth + 1 : null\"\n [attr.aria-expanded]=\"item.hasChildren ? item.expanded : null\"\n [attr.tabindex]=\"clickableRows() ? 0 : null\"\n (click)=\"onRowClick(item.row)\"\n (keydown)=\"onRowKeydown($event, item.row)\"\n >\n @if (expandable()) {\n <td\n class=\"mk-table__td mk-table__td--expand\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n (click)=\"$event.stopPropagation()\"\n >\n <button\n type=\"button\"\n class=\"mk-table__expander\"\n [class.mk-table__expander--open]=\"isExpanded(item.row)\"\n [attr.aria-expanded]=\"isExpanded(item.row)\"\n [attr.aria-controls]=\"detailId(i)\"\n [attr.aria-label]=\"isExpanded(item.row) ? i18n.collapseRow : i18n.expandRow\"\n (click)=\"toggleExpand(item.row, $event)\"\n >\n <span class=\"mk-table__expander-icon\" aria-hidden=\"true\">›</span>\n </button>\n </td>\n }\n @if (selectable()) {\n <td\n class=\"mk-table__td mk-table__td--select\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n (click)=\"$event.stopPropagation()\"\n >\n <mk-checkbox\n [aria-label]=\"i18n.selectRow(rowLabel(item.row))\"\n [checked]=\"isSelected(item.row)\"\n (checkedChange)=\"toggleRow(item.row)\"\n />\n </td>\n }\n @if (!stacked()) {\n @for (col of orderedColumns(); track col.key; let first = $first) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: null, tree: first ? item : null }\"\n />\n }\n } @else {\n <!-- Card layout. Same <td> elements, restyled — keeping the table\n DOM means selection, expansion, inline edit and every cell\n template keep working, since all of them reach for a `td`. -->\n @for (col of stackTitleColumns(); track col.key; let first = $first) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: 'title', tree: first ? item : null }\"\n />\n }\n @for (col of stackFieldColumns(); track col.key) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: 'field' }\"\n />\n }\n @for (col of stackFooterColumns(); track col.key) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ col, row: item.row, i, slot: 'footer' }\"\n />\n }\n }\n </tr>\n @if (expandable() && isExpanded(item.row) && rowDetail()) {\n <tr class=\"mk-table__detail-row\" [attr.role]=\"stacked() ? 'row' : null\">\n <td\n class=\"mk-table__detail\"\n [id]=\"detailId(i)\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n [attr.colspan]=\"totalColumns()\"\n >\n <div class=\"mk-table__detail-inner\">\n <ng-container\n [ngTemplateOutlet]=\"rowDetail()!.template\"\n [ngTemplateOutletContext]=\"{ $implicit: item.row }\"\n />\n </div>\n </td>\n </tr>\n }\n </ng-container>\n }\n } @empty {\n <tr class=\"mk-table__row mk-table__row--empty\" [attr.role]=\"stacked() ? 'row' : null\">\n <td\n class=\"mk-table__empty\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n [attr.colspan]=\"totalColumns()\"\n >\n <ng-content select=\"[mkTableEmpty]\">{{ emptyMessage() }}</ng-content>\n </td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n<!-- One cell, rendered by both layouts. `slot` is null in the grid and\n 'title' | 'field' | 'footer' in a card; everything else — the editor, the\n consumer's mkTableCell template, the formatted fallback — is identical, so\n a card can never drift from the grid it replaces. -->\n<ng-template #cellTpl let-col=\"col\" let-row=\"row\" let-i=\"i\" let-slot=\"slot\" let-tree=\"tree\">\n <td\n class=\"mk-table__td\"\n [class.mk-table__td--tree]=\"!!tree && !!childrenKey()\"\n [class.mk-table__td--pinned]=\"isPinned(col, 'left') || isPinned(col, 'right')\"\n [class.mk-table__td--pinned-right]=\"isPinned(col, 'right')\"\n [class.mk-table__td--editable]=\"col.editable\"\n [class.mk-table__td--stack-title]=\"slot === 'title'\"\n [class.mk-table__td--stack-field]=\"slot === 'field'\"\n [class.mk-table__td--stack-footer]=\"slot === 'footer'\"\n [style.width]=\"colStyleWidth(col)\"\n [style.inset-inline-start.px]=\"isPinned(col, 'left') ? pinnedOffset(col) : null\"\n [style.inset-inline-end.px]=\"isPinned(col, 'right') ? pinnedOffset(col) : null\"\n [attr.data-align]=\"col.align ?? 'start'\"\n [attr.tabindex]=\"col.editable ? 0 : null\"\n [attr.role]=\"stacked() ? 'cell' : null\"\n (dblclick)=\"startEdit(i, col, $event)\"\n (keydown)=\"onCellKeydown($event, i, col)\"\n >\n @if (slot === 'field' && hasStackLabel(col)) {\n <!-- The column header, moved beside the value. Not aria-hidden: the\n <thead> is display:none while stacked, so this label is the only\n thing naming the value for a screen reader. -->\n <span class=\"mk-table__cell-label\">{{ col.header }}</span>\n }\n @if (tree && childrenKey()) {\n <!-- Tree toggle (or a spacer on leaves) ahead of the first cell's value,\n so the indent and the caret read as one column. -->\n @if (tree.hasChildren) {\n <button\n type=\"button\"\n class=\"mk-table__tree-toggle\"\n [class.mk-table__tree-toggle--open]=\"tree.expanded\"\n [attr.aria-expanded]=\"tree.expanded\"\n [attr.aria-label]=\"tree.expanded ? i18n.collapseTreeRow : i18n.expandTreeRow\"\n (click)=\"toggleTreeRow(row, $event)\"\n >\n <span class=\"mk-table__expander-icon\" [class.mk-table__expander-icon--open]=\"tree.expanded\" aria-hidden=\"true\">›</span>\n </button>\n } @else {\n <span class=\"mk-table__tree-spacer\" aria-hidden=\"true\"></span>\n }\n }\n <span class=\"mk-table__cell-value\">\n @if (isEditing(i, col)) {\n <input\n #editInput\n class=\"mk-table__cell-input\"\n [value]=\"cellText(row, col)\"\n [attr.aria-label]=\"col.header\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onEditKeydown($event, row, col)\"\n (blur)=\"commitEdit(row, col, $any($event.target).value)\"\n />\n } @else if (cellTemplateFor(col.key); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: cellValue(row, col), row }\"\n />\n } @else {\n {{ cellText(row, col) }}\n @if (col.editable) {\n <span class=\"mk-visually-hidden\">{{ i18n.editCell }}</span>\n }\n }\n </span>\n </td>\n</ng-template>\n","import {\n Directive,\n booleanAttribute,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport { MkLiveAnnouncer } from '@mk-kit/ui/core';\nimport { MK_I18N } from '@mk-kit/ui/core';\nimport type { MkSortDirection } from '../table/table';\n\n/** Current sort state emitted by {@link MkSort.mkSortChange}. */\nexport interface MkSortState {\n /** Id of the column being sorted by (empty when cleared). */\n active: string;\n /** Sort direction (`none` when cleared). */\n direction: MkSortDirection;\n}\n\n/**\n * The minimal shape {@link MkSort} needs from a header. Implemented by\n * {@link MkSortHeader}; declared separately so the coordinator does not depend\n * on the header's concrete type (avoids a circular import).\n */\nexport interface MkSortable {\n id(): string;\n start(): 'asc' | 'desc' | undefined;\n disabled(): boolean;\n sortLabel(): string;\n}\n\n/**\n * Sort coordinator — apply `mkSort` to a table (or any container) to track\n * which column is sorted and in which direction. It holds no data: register\n * headers with `mkSortHeader`, then re-sort your rows in the\n * `(mkSortChange)` handler. Mirrors the Angular Material `matSort` model but\n * signal-based.\n *\n * Clicking a header cycles asc → desc → unsorted (set `mkSortDisableClear` to\n * cycle asc ↔ desc only). `mkSortStart` flips the initial direction.\n *\n * ```html\n * <table mkSort mkSortActive=\"name\" mkSortDirection=\"asc\"\n * (mkSortChange)=\"sortData($event)\">\n * <thead><tr>\n * <th mkSortHeader=\"name\">Name</th>\n * <th mkSortHeader=\"size\" mkSortHeaderStart=\"desc\">Size</th>\n * </tr></thead>\n * …\n * </table>\n * ```\n */\n@Directive({\n selector: '[mkSort]',\n exportAs: 'mkSort',\n})\nexport class MkSort {\n private readonly announcer = inject(MkLiveAnnouncer);\n private readonly i18n = inject(MK_I18N);\n\n /** Id of the currently sorted column (two-way; empty when unsorted). */\n readonly active = model<string>('', { alias: 'mkSortActive' });\n /** Current sort direction (two-way). */\n readonly direction = model<MkSortDirection>('none', {\n alias: 'mkSortDirection',\n });\n /** Direction the first click on a header applies. Default `asc`. */\n readonly start = input<'asc' | 'desc'>('asc', { alias: 'mkSortStart' });\n /** Disable sorting for every header. */\n readonly disabled = input(false, {\n transform: booleanAttribute,\n alias: 'mkSortDisabled',\n });\n /** Remove the \"unsorted\" step so headers cycle asc ↔ desc only. */\n readonly disableClear = input(false, {\n transform: booleanAttribute,\n alias: 'mkSortDisableClear',\n });\n\n /** Emits the new sort state whenever a header is activated. */\n readonly sortChange = output<MkSortState>({ alias: 'mkSortChange' });\n\n /** Advance the sort state for the given header (called on click/keyboard). */\n sort(header: MkSortable): void {\n if (this.disabled() || header.disabled()) return;\n const id = header.id();\n if (this.active() !== id) {\n this.active.set(id);\n this.direction.set(this.startFor(header));\n } else {\n const next = this.nextDirection(header, this.direction());\n this.direction.set(next);\n if (next === 'none') this.active.set('');\n }\n const state: MkSortState = {\n active: this.active(),\n direction: this.direction(),\n };\n this.sortChange.emit(state);\n this.announce(header, state.direction);\n }\n\n /** Whether the given column id is the active, non-cleared sort. */\n isActive(id: string): boolean {\n return this.active() === id && this.direction() !== 'none';\n }\n\n private startFor(header: MkSortable): MkSortDirection {\n return header.start() ?? this.start();\n }\n\n private nextDirection(\n header: MkSortable,\n current: MkSortDirection,\n ): MkSortDirection {\n const order: MkSortDirection[] =\n this.startFor(header) === 'desc' ? ['desc', 'asc'] : ['asc', 'desc'];\n if (!this.disableClear()) order.push('none');\n const index = order.indexOf(current);\n return order[(index + 1) % order.length];\n }\n\n private announce(header: MkSortable, direction: MkSortDirection): void {\n const label = header.sortLabel() || header.id();\n const message =\n direction === 'none'\n ? this.i18n.sortingCleared(label)\n : this.i18n.sortedBy(label, direction === 'asc' ? 'asc' : 'desc');\n this.announcer.announce(message, 'polite');\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport type { MkSortDirection } from '../table/table';\nimport { MkSort, MkSortable } from './sort';\n\n/**\n * Sort header — attach `mkSortHeader` to a header cell (`<th>`) inside an\n * element carrying `mkSort`. It wraps the projected header text in a real\n * `<button>` (so assistive tech hears an operable control), adds a directional\n * arrow (faint on hover, solid when active), reflects `aria-sort` on the cell,\n * and toggles the sort on click or Enter/Space.\n *\n * ```html\n * <th mkSortHeader=\"email\" mkSortHeaderLabel=\"Email address\">Email</th>\n * ```\n */\n@Component({\n selector: '[mkSortHeader]',\n templateUrl: './sort-header.html',\n styleUrl: './sort-header.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mk-sort-header',\n '[class.mk-sort-header--active]': 'isActive()',\n '[class.mk-sort-header--disabled]': 'isDisabled()',\n '[attr.aria-sort]': 'ariaSort()',\n },\n})\nexport class MkSortHeader implements MkSortable {\n private readonly sort = inject(MkSort);\n\n /** Column id this header sorts by (the `mkSortHeader` value). */\n readonly id = input('', { alias: 'mkSortHeader' });\n /** Per-header override for the initial sort direction. */\n readonly start = input<'asc' | 'desc' | undefined>(undefined, {\n alias: 'mkSortHeaderStart',\n });\n /** Disable sorting for just this header. */\n readonly disabled = input(false, {\n transform: booleanAttribute,\n alias: 'mkSortHeaderDisabled',\n });\n /** Accessible label used in sort announcements (defaults to the id). */\n readonly sortLabel = input('', { alias: 'mkSortHeaderLabel' });\n\n /** Disabled if this header or the whole `mkSort` is disabled. */\n readonly isDisabled = computed(() => this.disabled() || this.sort.disabled());\n /** Whether this header is the active, non-cleared sort. */\n readonly isActive = computed(() => this.sort.isActive(this.id()));\n /** Active direction, or `none` when this header is not the active sort. */\n readonly direction = computed<MkSortDirection>(() =>\n this.isActive() ? this.sort.direction() : 'none',\n );\n /** `aria-sort` value for the header cell. */\n protected readonly ariaSort = computed(() => {\n if (!this.isActive()) return 'none';\n return this.sort.direction() === 'asc' ? 'ascending' : 'descending';\n });\n\n protected toggle(): void {\n if (!this.isDisabled()) this.sort.sort(this);\n }\n}\n","<!-- A real <button> rather than a clickable th: the cell keeps aria-sort,\n the button provides the operable-control semantics (and native\n Enter/Space activation) a screen-reader user expects. -->\n<button\n type=\"button\"\n class=\"mk-sort-header__button\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"mk-sort-header__label\"><ng-content /></span>\n @if (!isDisabled()) {\n <span\n class=\"mk-sort-header__arrow\"\n [class.mk-sort-header__arrow--active]=\"isActive()\"\n [class.mk-sort-header__arrow--desc]=\"direction() === 'desc'\"\n aria-hidden=\"true\"\n ></span>\n }\n</button>\n","import { DestroyRef, Signal, computed, inject, signal } from '@angular/core';\nimport type { Observable, Unsubscribable } from 'rxjs';\nimport { mkQueryCompact, type MkQueryGroup } from '@mk-kit/ui/core';\nimport type { MkSortChange } from './table/table';\nimport type { MkSort, MkSortState } from './sort/sort';\n\n/** The request handed to a {@link MkDataFetcher} on every load. */\nexport interface MkDataRequest {\n /** 1-based page index, matching `mk-pagination`. */\n page: number;\n /** Number of rows per page. */\n pageSize: number;\n /** Active sort, or `null` when unsorted (cleared sorts normalise to `null`). */\n sort: MkSortState | null;\n /** Free-text filter query (`''` = none). */\n filter: string;\n /** Structured filter from `mk-query-builder` (`null` = none). Compacted: no empty groups or unfinished rules. */\n query: MkQueryGroup | null;\n}\n\n/** One page of server data returned by a {@link MkDataFetcher}. */\nexport interface MkDataPage<T> {\n /** The rows for the requested page. */\n rows: T[];\n /** Total number of rows across ALL pages (drives the pager). */\n total: number;\n}\n\n/**\n * Loads one page of data for a {@link MkDataRequest}. May return a `Promise`\n * (e.g. `fetch`) or an `Observable` (e.g. `HttpClient`); an Observable is\n * treated as single-shot — the first emission wins and the subscription is\n * released.\n */\nexport type MkDataFetcher<T> = (\n req: MkDataRequest,\n) => Promise<MkDataPage<T>> | Observable<MkDataPage<T>>;\n\n/** Construction options for {@link MkTableDataSource}. */\nexport interface MkTableDataSourceOptions {\n /** Initial rows per page (default 10, matching `mk-pagination`). */\n pageSize?: number;\n /** Debounce for {@link MkTableDataSource.setFilter} in ms (default 300). */\n filterDebounce?: number;\n}\n\n/** Default debounce applied to {@link MkTableDataSource.setFilter}. */\nconst DEFAULT_FILTER_DEBOUNCE = 300;\n/** Default page size, matching `mk-pagination`. */\nconst DEFAULT_PAGE_SIZE = 10;\n\n/** Normalise any of the kit's sort payload shapes to `MkSortState | null`. */\nfunction normalizeSort(\n sort: MkSortState | MkSortChange | null | undefined,\n): MkSortState | null {\n if (!sort) return null;\n const active = 'active' in sort ? sort.active : sort.key;\n if (!active || sort.direction === 'none') return null;\n return { active, direction: sort.direction };\n}\n\n/** Whether two normalised sort states describe the same ordering. */\nfunction sameSort(a: MkSortState | null, b: MkSortState | null): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.active === b.active && a.direction === b.direction;\n}\n\n/** Duck-typed Observable check, so rxjs is a type-only dependency here. */\nfunction isSubscribable<T>(\n value: Promise<T> | Observable<T>,\n): value is Observable<T> {\n return typeof (value as Observable<T>).subscribe === 'function';\n}\n\n/**\n * Server-side data adapter for `mk-table` — the page/sort/filter plumbing every\n * admin screen otherwise hand-rolls. A plain class (no component, no injection\n * required): give it a fetcher and bind its signals; every setter re-queries\n * the server and **stale responses never overwrite newer state** (latest-wins).\n *\n * - `setFilter` is debounced (default 300 ms); page, sort and page size load\n * immediately. Sort, filter and page-size changes reset to page 1.\n * - `rows` keeps its previous value while loading and on error, so the table\n * never blanks mid-transition; `error` is cleared by the next successful\n * load.\n * - Created in an injection context (a component field initialiser) it hooks\n * `DestroyRef` and cleans up automatically; anywhere else, call\n * {@link destroy} yourself.\n *\n * ```ts\n * interface User { id: number; name: string; email: string; }\n *\n * @Component({\n * imports: [MkTable, MkPagination, MkInput],\n * template: `\n * <input\n * mkInput\n * type=\"search\"\n * placeholder=\"Search users…\"\n * (input)=\"ds.setFilter($any($event.target).value)\"\n * />\n *\n * <mk-table\n * [columns]=\"columns\"\n * [data]=\"ds.rows()\"\n * (sortChange)=\"ds.setSort($event)\"\n * />\n * @if (ds.error()) { <p role=\"alert\">Failed to load.</p> }\n * @if (ds.empty()) { <p>No users match.</p> }\n *\n * <mk-pagination\n * [total]=\"ds.total()\"\n * [pageSize]=\"ds.pageSize()\"\n * [page]=\"ds.page()\"\n * (pageChange)=\"ds.setPage($event)\"\n * />\n * `,\n * })\n * export class UsersPage {\n * private readonly http = inject(HttpClient);\n *\n * readonly columns: MkTableColumn<User>[] = [\n * { key: 'name', header: 'Name', sortable: true },\n * { key: 'email', header: 'Email', sortable: true },\n * ];\n *\n * // Field initialiser = injection context, so cleanup is automatic.\n * readonly ds = new MkTableDataSource<User>(\n * (req) =>\n * this.http.get<MkDataPage<User>>('/api/users', {\n * params: {\n * page: req.page,\n * size: req.pageSize,\n * q: req.filter,\n * ...(req.sort && {\n * sort: `${req.sort.active},${req.sort.direction}`,\n * }),\n * },\n * }),\n * { pageSize: 20 },\n * );\n * }\n * ```\n *\n * With a custom `mkSort` table, forward the directive instead of binding:\n *\n * ```ts\n * private readonly sort = viewChild.required(MkSort);\n * constructor() {\n * afterNextRender(() => this.ds.connectSort(this.sort()));\n * }\n * ```\n */\nexport class MkTableDataSource<T> {\n private readonly fetcher: MkDataFetcher<T>;\n private readonly debounceMs: number;\n\n private readonly _rows = signal<T[]>([]);\n private readonly _total = signal(0);\n private readonly _loading = signal(false);\n private readonly _error = signal<unknown | null>(null);\n private readonly _page = signal(1);\n private readonly _pageSize = signal(DEFAULT_PAGE_SIZE);\n private readonly _sort = signal<MkSortState | null>(null);\n private readonly _filter = signal('');\n private readonly _query = signal<MkQueryGroup | null>(null);\n\n /** Rows of the current page (`[]` until the first load lands). */\n readonly rows = this._rows.asReadonly();\n /** Total row count across all pages (feed to `mk-pagination`'s `total`). */\n readonly total = this._total.asReadonly();\n /** True while the LATEST request is in flight. */\n readonly loading = this._loading.asReadonly();\n /** The last load's error, or `null`; cleared by the next successful load. */\n readonly error = this._error.asReadonly();\n /** Current 1-based page. */\n readonly page = this._page.asReadonly();\n /** Current page size. */\n readonly pageSize = this._pageSize.asReadonly();\n /** Current sort, or `null` when unsorted. */\n readonly sort = this._sort.asReadonly();\n /** Current filter query (updates immediately, even while debouncing). */\n readonly filter = this._filter.asReadonly();\n /** Current structured query, or `null`. */\n readonly query = this._query.asReadonly();\n /** True when a settled load reported no rows at all. */\n readonly empty: Signal<boolean> = computed(\n () => !this._loading() && this._total() === 0,\n );\n\n /** Monotonic request id — settles from older epochs are discarded. */\n private epoch = 0;\n /** Subscription to an in-flight Observable fetch, if any. */\n private activeSub: Unsubscribable | null = null;\n /** Pending filter-debounce timer. */\n private filterTimer: ReturnType<typeof setTimeout> | null = null;\n /** Subscriptions created by {@link connectSort}, keyed for idempotence. */\n private readonly sortSubs = new Map<MkSort, Unsubscribable>();\n private destroyed = false;\n\n constructor(fetcher: MkDataFetcher<T>, opts?: MkTableDataSourceOptions) {\n this.fetcher = fetcher;\n this.debounceMs = opts?.filterDebounce ?? DEFAULT_FILTER_DEBOUNCE;\n if (opts?.pageSize != null) this._pageSize.set(opts.pageSize);\n\n // Auto-cleanup when constructed in an injection context (a component\n // field initialiser). Outside one, inject() throws and the consumer owns\n // calling destroy().\n try {\n inject(DestroyRef).onDestroy(() => this.destroy());\n } catch {\n // Not in an injection context — manual destroy().\n }\n\n this.load();\n }\n\n /** Jump to a 1-based page and load it immediately. */\n setPage(page: number): void {\n const next = Math.max(1, Math.floor(page));\n if (next === this._page()) return;\n this._page.set(next);\n this.load();\n }\n\n /** Change the page size; resets to page 1 and loads immediately. */\n setPageSize(size: number): void {\n const next = Math.max(1, Math.floor(size));\n if (next === this._pageSize()) return;\n this._pageSize.set(next);\n this._page.set(1);\n this.load();\n }\n\n /**\n * Change the sort; resets to page 1 and loads immediately. Accepts either\n * the `mkSort` directive's {@link MkSortState} or `mk-table`'s\n * {@link MkSortChange} payload; a cleared sort (`direction: 'none'` or an\n * empty column id) normalises to `null`. A no-op when the sort is unchanged.\n */\n setSort(sort: MkSortState | MkSortChange | null): void {\n const next = normalizeSort(sort);\n if (sameSort(next, this._sort())) return;\n this._sort.set(next);\n this._page.set(1);\n this.load();\n }\n\n /**\n * Change the free-text filter. The `filter` signal updates (and the page\n * resets to 1) immediately, but the request is debounced — `refresh()`\n * flushes it early. A no-op when the query is unchanged.\n */\n setFilter(query: string): void {\n if (query === this._filter()) return;\n this._filter.set(query);\n this._page.set(1);\n this.cancelDebounce();\n if (this.destroyed) return;\n this.filterTimer = setTimeout(() => {\n this.filterTimer = null;\n this.load();\n }, this.debounceMs);\n }\n\n /**\n * Set (or clear with `null`) the structured query from `mk-query-builder`.\n * Empty groups and unfinished rules are dropped before the request; a query\n * with nothing left is sent as `null`. Resets to page 1 and loads at once.\n */\n setQuery(query: MkQueryGroup | null): void {\n const compact = query ? mkQueryCompact(query) : null;\n const next = compact && compact.rules.length ? compact : null;\n if (JSON.stringify(next) === JSON.stringify(this._query())) return;\n this._query.set(next);\n this._page.set(1);\n this.load();\n }\n\n /**\n * Re-run the current request immediately (e.g. after a mutation). Flushes a\n * pending debounced filter, since the request reads the live filter value.\n */\n refresh(): void {\n this.load();\n }\n\n /**\n * Pipe an `mkSort` directive's changes into {@link setSort}. Idempotent per\n * directive instance; all subscriptions are released by {@link destroy}.\n */\n connectSort(sort: MkSort): void {\n if (this.destroyed || this.sortSubs.has(sort)) return;\n this.sortSubs.set(\n sort,\n sort.sortChange.subscribe((state) => this.setSort(state)),\n );\n }\n\n /**\n * Cancel pending work: the debounce timer, any in-flight Observable fetch,\n * and `connectSort` subscriptions. In-flight Promise settles are discarded.\n * Called automatically on host destroy when created in an injection context.\n */\n destroy(): void {\n if (this.destroyed) return;\n this.destroyed = true;\n this.epoch++; // Anything still in flight settles stale.\n this.cancelDebounce();\n this.unsubscribeActive();\n for (const sub of this.sortSubs.values()) sub.unsubscribe();\n this.sortSubs.clear();\n this._loading.set(false);\n }\n\n /** Start a load for the current request state; supersedes any in flight. */\n private load(): void {\n if (this.destroyed) return;\n this.cancelDebounce();\n this.unsubscribeActive();\n const epoch = ++this.epoch;\n this._loading.set(true);\n const req: MkDataRequest = {\n page: this._page(),\n pageSize: this._pageSize(),\n sort: this._sort(),\n filter: this._filter(),\n query: this._query(),\n };\n let result: Promise<MkDataPage<T>> | Observable<MkDataPage<T>>;\n try {\n result = this.fetcher(req);\n } catch (err) {\n this.settleError(epoch, err);\n return;\n }\n if (isSubscribable(result)) {\n this.runObservable(result, epoch);\n } else {\n result.then(\n (page) => this.settleSuccess(epoch, page),\n (err) => this.settleError(epoch, err),\n );\n }\n }\n\n /** Subscribe single-shot: first emission (or error) settles, then release. */\n private runObservable(source: Observable<MkDataPage<T>>, epoch: number): void {\n let done = false;\n let sync = true;\n const sub = source.subscribe({\n next: (page) => {\n if (done) return;\n done = true;\n this.settleSuccess(epoch, page);\n if (!sync) this.clearSub(sub);\n },\n error: (err) => {\n if (done) return;\n done = true;\n this.settleError(epoch, err);\n if (!sync) this.clearSub(sub);\n },\n });\n sync = false;\n if (done) sub.unsubscribe();\n else this.activeSub = sub;\n }\n\n /** Apply a successful settle, unless a newer request superseded it. */\n private settleSuccess(epoch: number, page: MkDataPage<T>): void {\n if (epoch !== this.epoch || this.destroyed) return;\n this._rows.set(page.rows);\n this._total.set(page.total);\n this._error.set(null);\n this._loading.set(false);\n }\n\n /** Record a failed settle (rows/total untouched), unless superseded. */\n private settleError(epoch: number, err: unknown): void {\n if (epoch !== this.epoch || this.destroyed) return;\n this._error.set(err);\n this._loading.set(false);\n }\n\n private cancelDebounce(): void {\n if (this.filterTimer != null) {\n clearTimeout(this.filterTimer);\n this.filterTimer = null;\n }\n }\n\n private unsubscribeActive(): void {\n if (this.activeSub) {\n this.activeSub.unsubscribe();\n this.activeSub = null;\n }\n }\n\n private clearSub(sub: Unsubscribable): void {\n if (this.activeSub === sub) this.activeSub = null;\n sub.unsubscribe();\n }\n}\n","/**\n * @mk-kit/ui/table — the data table, grid features and sort directives.\n */\nexport * from './table';\nexport * from './sort';\nexport * from './data-source';\nexport * from './export';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAEA;;;;;;;;;;;;AAYG;MAIU,gBAAgB,CAAA;;AAElB,IAAA,QAAQ,GAAG,MAAM,CAAgC,WAAW,CAAC;uGAF3D,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAhB,gBAAgB,EAAA,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