@dolusoft/query-table 3.11.1 → 3.13.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.
- package/dist/query-table.js +319 -54
- package/dist/query-table.js.map +1 -1
- package/dist/types/body/use-row-navigation.d.ts +35 -0
- package/dist/types/contract.d.ts +78 -3
- package/dist/types/core/labels.d.ts +3 -1
- package/dist/types/core/table-context.d.ts +2 -2
- package/dist/types/filter/use-filter-trigger.d.ts +3 -2
- package/dist/types/query-table.vue.d.ts +2 -1
- package/dist/types/use-query-table.d.ts +6 -3
- package/dist/types/virtual/use-row-window.d.ts +3 -0
- package/package.json +3 -3
package/dist/query-table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-table.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_useSlots","columnTypeOf","_openBlock","_createElementBlock","_unref","_Fragment","_renderList","_normalizeStyle","_createElementVNode","_mergeProps","_renderSlot","_createTextVNode","_toDisplayString","_createBlock","_createCommentVNode","_normalizeProps","_guardReactiveProps","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_unref","_createCommentVNode","columnTypeOf","_toDisplayString","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_createElementVNode","_sfc_main","IconFilter","$slots","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_openBlock","_createElementBlock","_unref","_withKeys","_createElementVNode","_toDisplayString","_Fragment","_renderSlot","_normalizeProps","_guardReactiveProps","_createCommentVNode","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_mergeProps","_unref","_toHandlers","_createStaticVNode","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_mergeProps","_unref","_toHandlers","_sfc_main","$emit","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_createTextVNode","_toDisplayString","_createElementVNode","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_createElementVNode","_unref","_withModifiers","columnTypeOf","_createBlock","ReorderHandle","_createCommentVNode","_renderSlot","SortButton","_toDisplayString","FilterCell","_createSlots","_withCtx","ResizeHandle","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_sfc_main","isDevelopment","_useSlots","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_Fragment","_unref","_createVNode","TableHeader","_withCtx","_renderList","_normalizeStyle","TableBody","_createSlots","TableFooter","_createCommentVNode","_createBlock","TablePagination","_sfc_main","parse","QueryTable"],"sources":["../src/columns/column-layout.ts","../src/core/labels.ts","../src/core/table-context.ts","../src/filter/focus-filter.ts","../src/flash/marks.ts","../src/flash/read-duration.ts","../src/flash/use-change-flash.ts","../src/header/use-header-context-menu.ts","../src/core/column.ts","../src/body/use-cell-view.ts","../src/parts/table-row.ts","../src/pin/pin.ts","../src/parts/table-body.vue","../src/parts/table-body.vue","../src/parts/table-footer.vue","../src/parts/table-footer.vue","../src/parts/filter-icon.vue","../src/parts/filter-icon.vue","../src/filter/use-filter-trigger.ts","../src/parts/filter-cell.vue","../src/parts/filter-cell.vue","../src/parts/reorder-handle.vue","../src/parts/reorder-handle.vue","../src/resize/measure-widths.ts","../src/resize/width-scale.ts","../src/resize/use-column-resize.ts","../src/parts/resize-handle.vue","../src/parts/resize-handle.vue","../src/parts/sort-button.vue","../src/parts/sort-button.vue","../src/sort/sort.ts","../src/parts/table-header.vue","../src/parts/table-header.vue","../src/parts/table-pagination.vue","../src/parts/table-pagination.vue","../src/pin/use-header-geometry.ts","../src/reorder/use-column-reorder.ts","../src/resize/use-auto-width.ts","../src/scroll/use-scroll-body.ts","../src/use-query-table.ts","../src/virtual/use-load-more.ts","../src/body/group-runs.ts","../src/virtual/compute-window.ts","../src/virtual/use-row-window.ts","../src/query-table.vue","../src/query-table.vue","../src/filter/parse-filter-input.ts","../src/index.ts"],"sourcesContent":["// The column layout as data (ADR 0007, C-67 to C-70): the consumer's\n// `columns` owns visibility (`hide`), order (the array) and pinning\n// (`pinned`). TanStack's slices are projected from it, and its updates come\n// back here to become a new `columns` array: changed columns are new\n// objects, the others stay the consumer's.\nimport type { Column } from '../contract'\n\n/** Side a column is pinned to; `false` when it is not pinned. */\nexport type PinSide = 'left' | 'right' | false\n\nexport const sideOf = (column: Column): PinSide =>\n column.pinned === 'left'\n ? 'left'\n : column.pinned === 'right'\n ? 'right'\n : false\n\n/** A copy of `column` without `key`: a default is removed, never set (C-68). */\nconst without = (column: Column, key: 'hide' | 'pinned'): Column => {\n const copy = { ...column }\n delete copy[key]\n return copy\n}\n\n/** The columns with the visibility of `visibility`; `null` when nothing changes. */\nexport const applyVisibility = (\n columns: Column[],\n visibility: Record<string, boolean>\n): Column[] | null => {\n let changed = false\n const next = columns.map(column => {\n const visible = visibility[column.field] ?? true\n if (visible === !column.hide) {\n return column\n }\n changed = true\n return visible ? without(column, 'hide') : { ...column, hide: true }\n })\n return changed ? next : null\n}\n\n/** The columns in `order` (unknown fields skipped, missing ones kept last); `null` when unchanged. */\nexport const applyOrder = (\n columns: Column[],\n order: string[]\n): Column[] | null => {\n const byField = new Map(columns.map(column => [column.field, column]))\n const placed = new Set<string>()\n const next: Column[] = []\n for (const field of order) {\n const column = byField.get(field)\n if (column && !placed.has(field)) {\n placed.add(field)\n next.push(column)\n }\n }\n next.push(...columns.filter(column => !placed.has(column.field)))\n return next.every((column, index) => column === columns[index]) ? null : next\n}\n\n/** The columns with the sides of `pinning` (start = left, end = right); `null` when unchanged. */\nexport const applyPinning = (\n columns: Column[],\n pinning: { start?: string[]; end?: string[] }\n): Column[] | null => {\n const left = new Set(pinning.start ?? [])\n const right = new Set(pinning.end ?? [])\n let changed = false\n const next = columns.map(column => {\n const side: PinSide = left.has(column.field)\n ? 'left'\n : right.has(column.field)\n ? 'right'\n : false\n if (side === sideOf(column)) {\n return column\n }\n changed = true\n return side ? { ...column, pinned: side } : without(column, 'pinned')\n })\n return changed ? next : null\n}\n\n/** The columns with `field` at `width`; `null` when it already has it. */\nexport const applyWidth = (\n columns: Column[],\n field: string,\n width: string\n): Column[] | null => {\n const at = columns.findIndex(column => column.field === field)\n if (at < 0 || columns[at].width === width) {\n return null\n }\n const next = [...columns]\n next[at] = { ...columns[at], width }\n return next\n}\n\n/**\n * `field` taken out and put right before or after `target` (C-69): the\n * columns between keep their place, hidden ones included.\n */\nexport const moveField = (\n fields: string[],\n field: string,\n target: string,\n place: 'before' | 'after'\n): string[] => {\n if (field === target || !fields.includes(field)) {\n return fields\n }\n const rest = fields.filter(name => name !== field)\n const at = rest.indexOf(target)\n if (at < 0) {\n return fields\n }\n rest.splice(place === 'before' ? at : at + 1, 0, field)\n return rest\n}\n","import { conditionLabel } from '@dolusoft/query-protocol'\n\nimport type { Column, TableLabels } from '../contract'\n\n/** English defaults of the `labels` prop (C-44). */\nconst defaultLabels: TableLabels = {\n clearAllFilters: 'Clear all filters',\n expandRow: 'Expand row',\n openRightPanel: 'Open right panel',\n filterInput: column => `Filter ${column}`,\n filterOptions: column => `Filter options for ${column}`,\n resizeColumn: column => `Resize ${column}`,\n moveColumn: column => `Move ${column}`,\n filterCondition: (condition, type) => conditionLabel(type, condition),\n boolAll: 'All',\n boolTrue: 'True',\n boolFalse: 'False',\n selectRow: 'Select row',\n selectAllRows: 'Select all rows'\n}\n\nexport const resolveLabels = (\n labels: Partial<TableLabels> | undefined\n): TableLabels => ({ ...defaultLabels, ...labels })\n\n/** The name of a column in a label: its `title`, else its `field`. */\nexport const columnName = (column: Column) => column.title || column.field\n","import { inject, provide, type InjectionKey } from 'vue'\n\nimport type { TableLabels } from '../contract'\nimport type { ColumnReorder } from '../reorder/use-column-reorder'\nimport type { ColumnResize } from '../resize/use-column-resize'\nimport type {\n QueryTableFilters,\n QueryTableLayout,\n QueryTableSelection,\n QueryTableSort\n} from '../use-query-table'\n\n/**\n * What the header parts call: the filter inputs, the sort gate and the\n * layout actions of the composable, the resize and reorder actions and the\n * labels. Only actions and getters travel here; data (`columns`, `query`)\n * comes down as props.\n */\nexport interface TableContext {\n filters: QueryTableFilters\n sort: QueryTableSort\n /** The `control` of the header and filter-menu slots (C-70). */\n layout: QueryTableLayout\n resize: ColumnResize\n /** The reorder handles: drag, keys and the drag preview (C-73). */\n reorder: ColumnReorder\n /** The select-all checkbox of the selection column (C-59). */\n selection: Pick<\n QueryTableSelection<object>,\n 'allSelected' | 'someSelected' | 'toggleAll'\n >\n labels: () => TableLabels\n}\n\nconst tableContextKey: InjectionKey<TableContext> = Symbol('query-table')\n\nexport const provideTableContext = (context: TableContext) => {\n provide(tableContextKey, context)\n}\n\nexport const useTableContext = (): TableContext => {\n const context = inject(tableContextKey)\n if (!context) {\n throw new Error('Header parts must be rendered inside a QueryTable')\n }\n return context\n}\n","// Elements of a filter row that can take focus, in the order they are drawn:\n// the table's own input or select, or what the `filter-datetime` slot draws.\n// The `filter-menu` trigger is a menu button, not the filter itself.\nconst focusable =\n 'input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\n/**\n * Focuses the filter of `field` in this table's own header (C-54). Header\n * cells are walked directly, so a table nested in a slot is never searched.\n * Returns whether the element took focus.\n */\nexport const focusFilterOf = (\n table: HTMLTableElement | null,\n field: string\n): boolean => {\n const head = [...(table?.children ?? [])].find(\n child => child.tagName === 'THEAD'\n )\n for (const row of head?.children ?? []) {\n for (const cell of row.children) {\n if (cell.getAttribute('data-field') !== field) {\n continue\n }\n const filter = [...cell.children].find(child =>\n child.classList.contains('qt-filter')\n )\n const target = [\n ...(filter?.querySelectorAll<HTMLElement>(focusable) ?? [])\n ].find(element => !element.classList.contains('qt-filter-button'))\n if (!target) {\n return false\n }\n target.focus()\n return target.ownerDocument.activeElement === target\n }\n }\n return false\n}\n\n/**\n * Focuses the first filter of this table's header that takes the focus, in\n * column order (C-22). Returns whether one did.\n */\nexport const focusFirstFilter = (table: HTMLTableElement | null): boolean => {\n const head = [...(table?.children ?? [])].find(\n child => child.tagName === 'THEAD'\n )\n for (const row of head?.children ?? []) {\n for (const cell of row.children) {\n const field = cell.getAttribute('data-field')\n if (field !== null && focusFilterOf(table, field)) {\n return true\n }\n }\n }\n return false\n}\n","import type { RowChangeKey } from '@dolusoft/query-table-core/row-changes'\n\n/** The value of `data-flash`: a new value restarts the CSS animation. */\nexport type FlashPhase = 'a' | 'b'\n\n/**\n * One running flash. Updated in place when it restarts, so a stream of\n * changes allocates nothing per change (C-94).\n */\nexport interface Mark {\n /** `performance.now()` when the flash began. */\n start: number\n /** `start` plus the duration: from then on the mark is not drawn. */\n end: number\n /** Bumped on every start or restart: the identity of this flash. */\n gen: number\n phase: FlashPhase\n /** The frame the phase last changed in: one change per frame. */\n flipFrame: number\n}\n\n/** The marks of one row key: the row flash and the cell flashes by field. */\nexport interface RowMarks {\n row: Mark | null\n cells: Map<string, Mark> | null\n}\n\n/** A mark that is still running at `now`, else `null`. */\nexport const live = (mark: Mark | null | undefined, now: number) =>\n mark && mark.end > now ? mark : null\n\n/**\n * The marks of one table (C-94): row and cell flashes by row key. Starting\n * a flash that runs already restarts it, and the phase changes at most once\n * a frame, so changes within one frame are one visual restart (K33-4).\n */\nexport const createMarks = () => {\n const byKey = new Map<RowChangeKey, RowMarks>()\n let gen = 0\n\n const restart = (\n mark: Mark | null | undefined,\n now: number,\n duration: number,\n frame: number\n ): Mark => {\n gen++\n if (!mark) {\n return {\n start: now,\n end: now + duration,\n gen,\n phase: 'a',\n flipFrame: frame\n }\n }\n mark.start = now\n mark.end = now + duration\n mark.gen = gen\n if (mark.flipFrame !== frame) {\n mark.phase = mark.phase === 'a' ? 'b' : 'a'\n mark.flipFrame = frame\n }\n return mark\n }\n\n const entry = (key: RowChangeKey): RowMarks => {\n let marks = byKey.get(key)\n if (!marks) {\n marks = { row: null, cells: null }\n byKey.set(key, marks)\n }\n return marks\n }\n\n /** Flash the row of `key`; its cell flashes go (a new row is new as a whole). */\n const flashRow = (\n key: RowChangeKey,\n now: number,\n duration: number,\n frame: number\n ) => {\n const marks = entry(key)\n marks.row = restart(marks.row, now, duration, frame)\n marks.cells?.clear()\n }\n\n const flashCell = (\n key: RowChangeKey,\n field: string,\n now: number,\n duration: number,\n frame: number\n ) => {\n const marks = entry(key)\n const cells = (marks.cells ??= new Map<string, Mark>())\n cells.set(field, restart(cells.get(field), now, duration, frame))\n }\n\n const isEmpty = (marks: RowMarks) =>\n marks.row === null && (marks.cells === null || marks.cells.size === 0)\n\n /** Drop every row flash (`flash.rows` turned off). True when one went. */\n const clearRows = (): boolean => {\n let dropped = false\n for (const [key, marks] of byKey) {\n if (marks.row) {\n marks.row = null\n dropped = true\n }\n if (isEmpty(marks)) {\n byKey.delete(key)\n }\n }\n return dropped\n }\n\n /** Drop the cell flashes of `fields`, or of every field. True when one went. */\n const clearCells = (fields?: readonly string[]): boolean => {\n let dropped = false\n for (const [key, marks] of byKey) {\n const cells = marks.cells\n if (cells && cells.size > 0) {\n if (fields) {\n for (const field of fields) {\n dropped = cells.delete(field) || dropped\n }\n } else {\n cells.clear()\n dropped = true\n }\n }\n if (isEmpty(marks)) {\n byKey.delete(key)\n }\n }\n return dropped\n }\n\n /** Drop everything. True when something went. */\n const clear = (): boolean => {\n const had = byKey.size > 0\n byKey.clear()\n return had\n }\n\n /**\n * Drop the marks that end by `until`; the nearest end of the ones left,\n * or `Infinity`. True in `dropped` when one went.\n */\n const prune = (until: number) => {\n let nearest = Infinity\n let dropped = false\n for (const [key, marks] of byKey) {\n if (marks.row) {\n if (marks.row.end <= until) {\n marks.row = null\n dropped = true\n } else {\n nearest = Math.min(nearest, marks.row.end)\n }\n }\n if (marks.cells) {\n for (const [field, mark] of marks.cells) {\n if (mark.end <= until) {\n marks.cells.delete(field)\n dropped = true\n } else {\n nearest = Math.min(nearest, mark.end)\n }\n }\n }\n if (isEmpty(marks)) {\n byKey.delete(key)\n }\n }\n return { nearest, dropped }\n }\n\n return {\n get: (key: RowChangeKey) => byKey.get(key),\n get size() {\n return byKey.size\n },\n /** The generation of the last start. */\n get gen() {\n return gen\n },\n flashRow,\n flashCell,\n clearRows,\n clearCells,\n clear,\n prune\n }\n}\n","/** The custom property a skin sets the flash duration with (C-94). */\nconst durationProperty = '--qt-flash-duration'\n\n/**\n * A CSS time in milliseconds: `250ms`, `2s`, `.5s`. Anything else (a\n * missing value, `calc()`, a negative or a zero time, a number without a\n * unit) is `0`: no flash.\n */\nexport const parseDuration = (text: string): number => {\n const match = /^\\s*(\\d*\\.?\\d+(?:e[+-]?\\d+)?)(ms|s)\\s*$/i.exec(text)\n if (!match) {\n return 0\n }\n const value = Number(match[1]) * (match[2].toLowerCase() === 's' ? 1000 : 1)\n return Number.isFinite(value) && value > 0 ? value : 0\n}\n\n/**\n * The flash duration the skin set on the table root (`.qt-datatable`) or\n * above it, in milliseconds; `0` without one. One style read: the caller\n * reads it at most once a frame, and only for an update that marks\n * something (C-94).\n */\nexport const readDuration = (table: Element | null): number => {\n const root = table?.closest('.qt-datatable')\n if (!root) {\n return 0\n }\n return parseDuration(\n getComputedStyle(root).getPropertyValue(durationProperty)\n )\n}\n","import {\n createRowChangeTracker,\n type RowChangeKey,\n type RowsUpdate\n} from '@dolusoft/query-table-core/row-changes'\nimport {\n effectScope,\n getCurrentInstance,\n getCurrentScope,\n nextTick,\n onActivated,\n onDeactivated,\n onMounted,\n onScopeDispose,\n shallowRef,\n watch,\n type ComponentInternalInstance,\n type EffectScope,\n type Ref,\n type ShallowRef\n} from 'vue'\n\nimport type { FlashOptions, Query } from '../contract'\nimport type { RowKey } from '../use-query-table'\nimport { createMarks, live, type FlashPhase, type Mark } from './marks'\nimport { readDuration } from './read-duration'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nconst warn = (message: string) => {\n try {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n } catch {\n // No `process`: a development build.\n }\n console.warn(`[QueryTable] ${message}`)\n}\n\n/** The inline custom property of an element bound after its flash began. */\nconst elapsedProperty = '--qt-flash-elapsed'\n\nexport interface ChangeFlashOptions<T extends object> {\n flash: () => boolean | FlashOptions | undefined\n rowsUpdate: () => RowsUpdate | undefined\n rows: () => readonly T[]\n query: () => Query\n loading: () => boolean\n /** The fields of the drawn columns. */\n fields: () => readonly string[]\n rowKey: () => RowKey<T>\n table: Readonly<Ref<HTMLTableElement | null>>\n}\n\n/**\n * The live marks of one row (K311-6): the `data-flash` value of the row and\n * of each cell with a mark of its own.\n */\nexport interface RowFlash {\n row?: FlashPhase\n cells?: Readonly<Record<string, FlashPhase>>\n}\n\n/** What the body draws with: the marks and the binding hook (C-94). */\nexport interface FlashView {\n /**\n * The live marks of the row of `key`, or `undefined`. Read in the body's\n * render: a change of the marks draws the body again. Equal marks give the\n * same object, so a row whose marks did not change is not drawn again.\n */\n of: (key: RowChangeKey) => RowFlash | undefined\n /**\n * Called with a data row's `tr` after it is mounted or patched: writes\n * `--qt-flash-elapsed` on the row and on its cells that were bound after\n * their flash began, or whose flash changed. Reads nothing reactive: it\n * runs while the row's render effect is active.\n */\n bind: (el: HTMLElement, key: RowChangeKey) => void\n}\n\ninterface Controller {\n view: FlashView\n /** Remove the elapsed times written on the body (`flash` turned off). */\n unbind: () => void\n update: () => void\n deactivate: () => void\n activate: () => void\n}\n\ninterface Kinds {\n rows: boolean\n cells: boolean\n}\n\nconst kindsOf = (value: boolean | FlashOptions | undefined): Kinds =>\n typeof value === 'object'\n ? { rows: value.rows !== false, cells: value.cells !== false }\n : { rows: true, cells: true }\n\nconst keyReader =\n <T extends object>(rowKey: NonNullable<RowKey<T>>) =>\n (row: T, index: number): RowChangeKey =>\n typeof rowKey === 'function'\n ? rowKey(row, index)\n : (row as Record<string, RowChangeKey>)[rowKey]\n\n/**\n * The flash of one table while `flash` is on: feeds the tracker, keeps the\n * marks, reads the duration, runs the one timer and binds the elapsed time.\n * It lives in the effect scope it is created in and goes with it.\n */\nconst startFlash = <T extends object>(o: ChangeFlashOptions<T>): Controller => {\n let rowKey = o.rowKey()\n let keyOf = rowKey === undefined ? null : keyReader(rowKey)\n const newTracker = () =>\n createRowChangeTracker<T>((row, index) => keyOf!(row, index))\n let tracker = newTracker()\n const marks = createMarks()\n /** Bumped when the drawn marks change: the body reads it. */\n const version = shallowRef(0)\n let kinds = kindsOf(o.flash())\n\n let active = true\n let warnedKey = false\n let warnedBadKeys = false\n\n // ---- clock: the frame and the one timer (C-94) ---------------------------\n\n let frame = 0\n let frameRequest: number | undefined\n /** The duration read in this frame (valid while a frame is requested). */\n let duration = 0\n let timer: ReturnType<typeof setTimeout> | undefined\n /** The end the timer wakes at. */\n let timerAt = Infinity\n /**\n * The first generation started in the update being drawn: an element\n * bound to it in the same render gets no elapsed time.\n */\n let freshFrom = Infinity\n\n /** A frame went by: the next change flips the phase, the duration is read again. */\n const requestFrame = () => {\n frameRequest ??= requestAnimationFrame(() => {\n frameRequest = undefined\n frame++\n })\n }\n const durationNow = () => {\n if (frameRequest === undefined) {\n duration = readDuration(o.table.value)\n // Read once a frame, a zero length (reduced motion) included.\n requestFrame()\n }\n return duration\n }\n\n const stopClock = () => {\n if (timer !== undefined) {\n clearTimeout(timer)\n timer = undefined\n timerAt = Infinity\n }\n if (frameRequest !== undefined) {\n cancelAnimationFrame(frameRequest)\n frameRequest = undefined\n }\n }\n\n /** Wake at `end`: drop what ended, then wake at the next end. */\n const wakeAt = (end: number) => {\n if (timer !== undefined) {\n clearTimeout(timer)\n }\n timerAt = end\n timer = setTimeout(\n () => {\n timer = undefined\n timerAt = Infinity\n // Only what has ended goes; the next wake takes the rest.\n const { nearest, dropped } = marks.prune(performance.now())\n if (dropped) {\n pruneDrawn()\n version.value++\n }\n if (nearest !== Infinity) {\n wakeAt(nearest)\n }\n },\n Math.max(0, end - performance.now())\n )\n }\n\n /** Everything goes: marks, timer, frame and the rows compared against. */\n const resetAll = () => {\n tracker.clear()\n stopClock()\n drawn.clear()\n if (marks.clear()) {\n version.value++\n }\n }\n\n // ---- the marks each row is drawn with (K311-6) ----------------------------\n\n /**\n * The last `RowFlash` of each row key, with the live marks it was made\n * from as a text of copied numbers (field, phase, generation): never the\n * `Mark` objects, which a restart updates in place. Pruned with the marks.\n */\n const drawn = new Map<RowChangeKey, { live: string; flash: RowFlash }>()\n const pruneDrawn = () => {\n for (const key of drawn.keys()) {\n if (!marks.get(key)) {\n drawn.delete(key)\n }\n }\n }\n\n // ---- marks from the tracker (C-93) ---------------------------------------\n\n const update = () => {\n if (!active) {\n return\n }\n // A new `rowKey` starts over: the keys mean something else now (K33-3).\n if (o.rowKey() !== rowKey) {\n rowKey = o.rowKey()\n keyOf = rowKey === undefined ? null : keyReader(rowKey)\n resetAll()\n tracker = newTracker()\n }\n if (keyOf === null) {\n if (!warnedKey) {\n warnedKey = true\n warn('`flash` needs `rowKey`; it is ignored without one (C-93).')\n }\n return\n }\n let changed = false\n // A kind turned off: its marks go now (K33-8).\n const next = kindsOf(o.flash())\n if (!next.rows && kinds.rows) {\n changed = marks.clearRows() || changed\n }\n if (!next.cells && kinds.cells) {\n changed = marks.clearCells() || changed\n }\n kinds = next\n const result = tracker.update({\n rows: o.rows(),\n query: o.query(),\n loading: o.loading(),\n fields: kinds.cells ? o.fields() : [],\n hint: o.rowsUpdate(),\n // A hidden document flashes nothing and replays nothing (K33-8).\n quiet: document.hidden\n })\n if (result.badKeys && !warnedBadKeys) {\n warnedBadKeys = true\n warn(\n '`flash` found a row without a `rowKey` value, or a key two rows share; the index is never used instead (C-93).'\n )\n }\n if (result.reset) {\n stopClock()\n changed = marks.clear() || changed\n }\n if (result.droppedFields.length > 0) {\n changed = marks.clearCells(result.droppedFields) || changed\n }\n const added = kinds.rows ? result.added : []\n const cells = kinds.cells ? result.changed : null\n if (added.length > 0 || (cells !== null && cells.size > 0)) {\n const length = durationNow()\n // No duration (a reduced-motion skin): no mark; the rows compared\n // against moved all the same (K33-5).\n if (length > 0) {\n const at = performance.now()\n const firstGen = marks.gen + 1\n for (const key of added) {\n marks.flashRow(key, at, length, frame)\n }\n cells?.forEach((fields, key) => {\n for (const field of fields) {\n marks.flashCell(key, field, at, length, frame)\n }\n })\n changed = true\n // Flashes started now are bound in this update's render: no time\n // has gone for them yet.\n if (freshFrom === Infinity) {\n freshFrom = firstGen\n void nextTick(() => {\n freshFrom = Infinity\n })\n }\n requestFrame()\n // A timer set for a later end (the skin shortened the duration)\n // is set again; one set for an earlier end wakes first.\n if (at + length < timerAt) {\n wakeAt(at + length)\n }\n }\n }\n if (changed) {\n pruneDrawn()\n version.value++\n }\n }\n\n // The rows at the start are the baseline.\n update()\n\n // ---- drawing (C-94) ------------------------------------------------------\n\n /** The generation bound to an element, and the elapsed value written on it. */\n const bound = new WeakMap<Element, number>()\n const written = new WeakMap<Element, string>()\n /** Rows with something bound on them or on one of their cells. */\n const boundRows = new WeakSet<Element>()\n /** The row flash a cell was last seen under. */\n const seenUnder = new WeakMap<Element, number>()\n\n const bindTo = (\n el: HTMLElement,\n mark: Mark | null,\n now: number,\n blockInherited: boolean\n ) => {\n const gen = bound.get(el)\n if (!mark) {\n if (gen !== undefined) {\n bound.delete(el)\n written.delete(el)\n el.style.removeProperty(elapsedProperty)\n }\n return\n }\n if (gen === mark.gen) {\n // Vue drops the whole `style` attribute when a cell's style binding\n // goes away: put the value back, unchanged.\n const value = written.get(el) ?? ''\n if (value !== '' && el.style.getPropertyValue(elapsedProperty) === '') {\n el.style.setProperty(elapsedProperty, value)\n }\n return\n }\n const elapsed = mark.gen >= freshFrom ? 0 : now - mark.start\n // A cell's own fresh flash must not inherit the row's elapsed time.\n const value =\n elapsed >= 1 ? `${Math.round(elapsed)}ms` : blockInherited ? '0ms' : ''\n if (value === '') {\n el.style.removeProperty(elapsedProperty)\n } else {\n el.style.setProperty(elapsedProperty, value)\n }\n bound.set(el, mark.gen)\n written.set(el, value)\n }\n\n const view: FlashView = {\n of: key => {\n // Read by the body's render: a change of the marks draws it again.\n void version.value\n const rowMarks = keyOf === null ? undefined : marks.get(key)\n if (!rowMarks) {\n drawn.delete(key)\n return undefined\n }\n // The clock is read only for a row that has a mark.\n const now = performance.now()\n const rowMark = live(rowMarks.row, now)\n let text = rowMark ? `${rowMark.phase}${rowMark.gen}` : ''\n rowMarks.cells?.forEach((mark, field) => {\n if (live(mark, now)) {\n text += `|${field}:${mark.phase}${mark.gen}`\n }\n })\n if (text === '') {\n drawn.delete(key)\n return undefined\n }\n const last = drawn.get(key)\n if (last?.live === text) {\n return last.flash\n }\n const flash: RowFlash = {}\n if (rowMark) {\n flash.row = rowMark.phase\n }\n let cells: Record<string, FlashPhase> | undefined\n rowMarks.cells?.forEach((mark, field) => {\n if (live(mark, now)) {\n ;(cells ??= {})[field] = mark.phase\n }\n })\n if (cells) {\n flash.cells = cells\n }\n drawn.set(key, { live: text, flash })\n return flash\n },\n bind: (tr, key) => {\n if (keyOf === null) {\n return\n }\n const rowMarks = marks.get(key)\n // Most rows have no flash and nothing bound: nothing to do.\n if (!rowMarks && !boundRows.has(tr)) {\n return\n }\n const now = performance.now()\n const rowMark = live(rowMarks?.row, now)\n // The row was bound to this flash in an earlier render: a cell seen\n // only now was mounted since (a column shown), and the row's value,\n // written when the row was bound, is not its time.\n const rowWasBound = rowMark !== null && bound.get(tr) === rowMark.gen\n bindTo(tr, rowMark, now, false)\n const rowValue = written.get(tr) ?? ''\n let any = bound.has(tr)\n const cells = tr.children\n for (let i = 0; i < cells.length; i++) {\n const td = cells[i] as HTMLElement\n const field = td.getAttribute('data-field')\n const own =\n field === null ? null : live(rowMarks?.cells?.get(field), now)\n if (own) {\n bindTo(td, own, now, rowValue !== '')\n } else if (\n rowMark &&\n (bound.get(td) === rowMark.gen ||\n (rowWasBound && seenUnder.get(td) !== rowMark.gen))\n ) {\n // A cell mounted after its row was bound takes the row's flash\n // with its own elapsed time.\n bindTo(td, rowMark, now, false)\n } else {\n // A cell without a flash of its own inherits the row's value.\n bindTo(td, null, now, false)\n }\n if (rowMark) {\n seenUnder.set(td, rowMark.gen)\n }\n any ||= bound.has(td)\n }\n if (any) {\n boundRows.add(tr)\n } else {\n boundRows.delete(tr)\n }\n }\n }\n\n /** Remove the elapsed times written on the body. */\n const unbindAll = () => {\n const body = o.table.value?.tBodies[0]\n if (!body) {\n return\n }\n const rows = body.children\n for (let i = 0; i < rows.length; i++) {\n const tr = rows[i] as HTMLElement\n tr.style.removeProperty(elapsedProperty)\n const cells = tr.children\n for (let j = 0; j < cells.length; j++) {\n ;(cells[j] as HTMLElement).style.removeProperty(elapsedProperty)\n }\n }\n }\n\n // On unmount the elements go with the table: only the clock is stopped.\n onScopeDispose(stopClock)\n\n return {\n view,\n unbind: unbindAll,\n update,\n // KeepAlive: nothing runs while away; back, the rows are a baseline.\n deactivate: () => {\n active = false\n resetAll()\n unbindAll()\n },\n activate: () => {\n active = true\n update()\n }\n }\n}\n\n/**\n * The change flash of `QueryTable` (C-93 to C-95). Off, it sets up one\n * watcher that reads `flash` and nothing else: no comparison, timer, frame\n * callback, listener, style read or memory per row. On, the same watcher\n * also reads what the tracker compares, and the flash runs in an effect\n * scope of its own; stopping that scope undoes everything. Nothing runs on\n * the server: the flash starts once the table is mounted.\n */\nexport const useChangeFlash = <T extends object>(\n o: ChangeFlashOptions<T>\n): ShallowRef<FlashView | null> => {\n const view = shallowRef<FlashView | null>(null)\n const instance = getCurrentInstance() as ComponentInternalInstance\n const owner = getCurrentScope() as EffectScope\n let scope: EffectScope | null = null\n let controller: Controller | null = null\n let hooked = false\n let mounted = false\n\n const start = () => {\n scope = owner.run(() => effectScope())!\n controller = scope.run(() => startFlash(o))!\n view.value = controller.view\n if (!hooked) {\n hooked = true\n onDeactivated(() => controller?.deactivate(), instance)\n onActivated(() => controller?.activate(), instance)\n }\n }\n const stop = () => {\n controller?.unbind()\n scope?.stop()\n scope = null\n controller = null\n view.value = null\n }\n\n // One watcher, run before the table renders. Off it reads `flash` only.\n watch(\n () =>\n o.flash()\n ? [\n o.flash(),\n o.rows(),\n o.query(),\n o.loading(),\n o.rowsUpdate(),\n o.rowKey(),\n o.fields()\n ]\n : null,\n on => {\n if (!mounted) {\n return\n }\n if (!on) {\n stop()\n } else if (controller) {\n controller.update()\n } else {\n start()\n }\n }\n )\n onMounted(() => {\n mounted = true\n if (o.flash()) {\n start()\n }\n })\n return view\n}\n","import type { Column, HeaderContextMenuPayload } from '../contract'\n\nexport interface HeaderContextMenuOptions {\n /** The drawn columns (hidden already dropped), in drawing order. */\n columns: () => Column[]\n /**\n * Original index of a drawn column in the consumer's `columns` (hidden\n * included), as C-28's `columnIndex`.\n */\n indexOf: (field: string) => number | undefined\n /** Someone listens to `headerContextMenu`; without one the menu is left alone. */\n listening: () => boolean\n onContextMenu: (payload: HeaderContextMenuPayload) => void\n}\n\n/**\n * One listener on the `thead` serves every header cell (C-96): a listener per\n * cell would be a new closure per cell on every render. Only a data column\n * header emits (`data-field`); utility cells keep the browser menu. A right\n * click inside the filter row (`.qt-filter`) keeps the browser menu too, so\n * paste and spell-check stay (issue #102 S1(a)).\n */\nexport const useHeaderContextMenu = (options: HeaderContextMenuOptions) => {\n const onContextMenu = (event: MouseEvent) => {\n if (!options.listening()) {\n return\n }\n const head = event.currentTarget as Element\n let cell = (event.target as Element | null)?.closest('th') ?? null\n while (cell && cell.parentElement?.parentElement !== head) {\n cell = cell.parentElement?.closest('th') ?? null\n }\n const field = cell?.getAttribute('data-field') ?? null\n if (field === null || !cell) {\n return\n }\n // Filter inputs keep the native menu (paste, spell check).\n const target = event.target as Element | null\n if (\n target?.closest('.qt-filter') &&\n cell.contains(target.closest('.qt-filter'))\n ) {\n return\n }\n const column = options.columns().find(c => c.field === field)\n const columnIndex = options.indexOf(field)\n if (!column || columnIndex === undefined) {\n return\n }\n event.preventDefault()\n options.onContextMenu({\n event,\n column,\n columnIndex\n })\n }\n\n return { onContextMenu }\n}\n","// The type of a column, read case-insensitively (C-39), is the protocol's.\nexport { columnTypeOf } from '@dolusoft/query-protocol'\n\n/** Reads a dotted path (`'a.b'`) from a row. */\nexport const valueAt = (row: object, path: string): unknown =>\n path\n .split('.')\n .reduce<unknown>(\n (value, key) =>\n value === null || value === undefined\n ? undefined\n : (value as Record<string, unknown>)[key],\n row\n )\n","import type { CellContextMenuPayload } from '../contract'\nimport { valueAt } from '../core/column'\nimport type { ColumnEntry } from '../use-query-table'\n\nexport interface CellViewOptions<T extends object> {\n /** The rows of the body, to find the one a context menu event belongs to. */\n rows: () => T[]\n /** The drawn columns, to find the one a context menu event belongs to. */\n entries: () => ColumnEntry[]\n /** Someone listens to `cellContextMenu`; without one the menu is left alone. */\n listening: () => boolean\n onContextMenu: (payload: CellContextMenuPayload<T>) => void\n}\n\n/**\n * The context menu event of the body cells (C-28). What a cell shows is\n * drawn by its row (`parts/table-row.ts`).\n */\nexport const useCellView = <T extends object>(options: CellViewOptions<T>) => {\n /**\n * One listener on the `tbody` serves every cell (C-28): a listener per cell\n * would be a new closure per cell on every render. The cell is the nearest\n * `td` whose row is a direct child of this body. A table nested in a\n * subtable row: the walk ends on the subtable `td`, which has no\n * `data-field`, so this body stays quiet and the inner table answers for its\n * own cells. A table nested in a `cell-<field>` slot: the inner table emits\n * for its cell, then this body emits for the outer cell that holds it (the\n * same as a listener on every cell did). Only a data cell counts: it carries\n * `data-field`, and its row carries `data-row-index`.\n */\n const onContextMenu = (event: MouseEvent) => {\n // Without a listener the event has no use: keep the browser menu (C-28).\n if (!options.listening()) {\n return\n }\n const body = event.currentTarget as Element\n let cell = (event.target as Element | null)?.closest('td') ?? null\n while (cell && cell.parentElement?.parentElement !== body) {\n cell = cell.parentElement?.closest('td') ?? null\n }\n const field = cell?.getAttribute('data-field') ?? null\n const index = cell?.parentElement?.getAttribute('data-row-index') ?? null\n if (field === null || index === null) {\n return\n }\n const rowIndex = Number(index)\n const row = options.rows()[rowIndex]\n const entry = options.entries().find(e => e.column.field === field)\n if (row === undefined || !entry) {\n return\n }\n event.preventDefault()\n options.onContextMenu({\n event,\n row,\n column: entry.column,\n cellValue: valueAt(row, field),\n rowIndex,\n columnIndex: entry.index\n })\n }\n\n return { onContextMenu }\n}\n","import {\n createCommentVNode,\n createElementBlock,\n createElementVNode,\n defineComponent,\n Fragment,\n mergeProps,\n openBlock,\n renderList,\n renderSlot,\n toDisplayString,\n withModifiers,\n type PropType,\n type Slots,\n type VNode\n} from 'vue'\n\nimport type { PinSide } from '../columns/column-layout'\nimport type { CellSlotProps, Column } from '../contract'\nimport { valueAt } from '../core/column'\nimport type { RowFlash } from '../flash/use-change-flash'\n\n/**\n * One drawn column of a data row, kept by value by the body (K311-2): the\n * same object while its column, place, type, pinning, slot and role stay.\n */\nexport interface RowCell {\n field: string\n column: Column\n type: string\n side: PinSide\n offset: number | undefined\n role: string | undefined\n /** `cell-<field>` when the consumer gives that slot, else `null`. */\n slot: string | null\n /** The `td` attributes before `data-flash`, in the order 3.10 wrote them. */\n attrs: Record<string, unknown>\n}\n\n/**\n * The utility cells of a data row (C-46, C-59, C-98): the attributes of\n * each one drawn, `null` for one that is not. Kept by value by the body.\n */\nexport interface RowUtilities {\n panel: Record<string, unknown> | null\n expand: Record<string, unknown> | null\n select: Record<string, unknown> | null\n /** What the attributes were made from: equal keys, equal cells. */\n signature: string\n}\n\ntype RowPinned = CellSlotProps<object>['rowPinned']\ntype PinRow = (\n row: object,\n index: number,\n position: 'top' | 'bottom' | false\n) => void\n\n// Any value, no runtime type check: the body is the only caller.\nconst value = <V>() => ({ type: null as unknown as PropType<V> })\nconst needed = <V>() => ({\n type: null as unknown as PropType<V>,\n required: true as const\n})\n\n// The empty comment of a branch that is off, as the library build writes\n// it (a development build of a template writes `v-if`, C-108).\nconst off = () => createCommentVNode('', true)\n\nconst panelIcon = () =>\n createElementVNode(\n 'svg',\n {\n width: '14',\n height: '14',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': '2',\n 'stroke-linecap': 'round',\n 'aria-hidden': 'true'\n },\n [\n createElementVNode('line', { x1: '12', y1: '5', x2: '12', y2: '19' }),\n createElementVNode('line', { x1: '5', y1: '12', x2: '19', y2: '12' })\n ],\n -1 /* CACHED */\n )\n\nconst expandIcon = {\n width: '14',\n height: '14',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': '2',\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n 'aria-hidden': 'true'\n}\nconst chevronDown = { key: 0, points: '6 9 12 15 18 9' }\nconst chevronRight = { key: 1, points: '9 6 15 12 9 18' }\n\nconst rowDynamic = [\n 'role',\n 'data-row-index',\n 'aria-rowindex',\n 'data-pinned-row',\n 'data-row-kind',\n 'data-expanded',\n 'data-selected',\n 'data-flash'\n]\nconst panelDynamic = ['aria-label', 'onClick']\nconst expandDynamic = ['aria-expanded', 'aria-label', 'onClick']\nconst selectDynamic = ['aria-label', 'checked', 'onChange']\n\n/** Text of a cell, whole: the table never cuts it. */\nconst cellText = (row: object, column: Column) =>\n // A cell value may be any type; its string form is what the table shows.\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n String(valueAt(row, column.field) ?? '')\n\n/**\n * One data row of the body (ADR 0017, C-106 to C-108): its `tr`, the\n * utility cells and the column cells with their `cell-<field>` slots.\n * Internal: not exported from the package.\n *\n * Every prop is a value the body computed for this row (K311-2), so Vue\n * skips a row whose props did not change; the row's render calls no\n * function that reads shared state. Its cell slots are called here, so what\n * a slot reads reactively belongs to this row (K311-4). The render is\n * written with the helpers compiled templates use, and draws the vnodes the\n * `tr` branch of the body's template drew in 3.10 (C-108).\n */\nexport const tableRow = defineComponent({\n name: 'TableRow',\n inheritAttrs: false,\n props: {\n row: needed<object>(),\n /** The row's key, as the body keys it (C-26). */\n rowKey: needed<string | number>(),\n /** `data-row-index`: the row's index in `rows`. */\n index: needed<number>(),\n /** `aria-rowindex`, with `virtual` only (C-86). */\n aria: value<number | undefined>(),\n pinned: needed<RowPinned>(),\n /** `data-row-kind` (C-97); `undefined` for none. */\n kind: value<string | undefined>(),\n selected: needed<boolean>(),\n expanded: needed<boolean>(),\n /** An expand button is drawn (C-98). */\n expandable: needed<boolean>(),\n /** The row's flash marks (C-94), or `undefined`. */\n flash: value<RowFlash | undefined>(),\n cells: needed<readonly RowCell[]>(),\n utilities: needed<RowUtilities>(),\n labelPanel: needed<string>(),\n labelExpand: needed<string>(),\n labelSelect: needed<string>(),\n /** `scrollBody`: the ARIA roles of C-102. */\n roles: value<boolean | undefined>(),\n /** The body's slots object: the same object for the body's life (K311-3). */\n slots: needed<Slots>(),\n /** With `flash`: binds the elapsed time after a render (K311-6). */\n flashBind: value<\n ((el: HTMLElement, key: string | number) => void) | undefined\n >(),\n pinRow: needed<PinRow>()\n },\n emits: ['toggle', 'toggleSelected', 'rightPanel'],\n setup(props, { emit }) {\n // Stable for the row's life, so a render patches nothing for them.\n const onPanel = withModifiers(() => emit('rightPanel'), ['stop'])\n const onToggle = () => emit('toggle')\n const onSelect = () => emit('toggleSelected')\n // Called by Vue right after the row's `tr` is mounted or patched, while\n // the row's render effect is active: it reads only this row's props.\n const bind = (vnode: VNode) => {\n props.flashBind?.(vnode.el as HTMLElement, props.rowKey)\n }\n // The compiler's per-instance cache of static content (`_cache`).\n let panelCache: VNode[] | null = null\n\n return () => {\n const { row, index, pinned, cells, utilities, flash, slots } = props\n const cellFlash = flash?.cells\n return (\n openBlock(),\n createElementBlock(\n 'tr',\n {\n role: props.roles ? 'row' : undefined,\n 'data-row-index': index,\n 'aria-rowindex': props.aria,\n 'data-pinned-row': pinned || undefined,\n 'data-row-kind': props.kind,\n 'data-expanded': props.expanded ? '' : undefined,\n 'data-selected': props.selected ? '' : undefined,\n 'data-flash': flash?.row,\n // Read from the vnode by Vue, never patched as attributes: they\n // stay out of the dynamic props below, so no DOM listener is\n // made of them (C-108).\n onVnodeBeforeMount: props.flashBind ? bind : undefined,\n onVnodeUpdated: props.flashBind ? bind : undefined\n },\n [\n utilities.panel\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 0 }, utilities.panel),\n [\n createElementVNode(\n 'button',\n {\n type: 'button',\n class: 'qt-right-panel-button',\n 'aria-label': props.labelPanel,\n onClick: onPanel\n },\n [...(panelCache ??= [panelIcon()])],\n 8 /* PROPS */,\n panelDynamic\n )\n ],\n 16 /* FULL_PROPS */\n ))\n : off(),\n utilities.expand\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 1 }, utilities.expand),\n [\n props.expandable\n ? (openBlock(),\n createElementBlock(\n 'button',\n {\n key: 0,\n type: 'button',\n class: 'qt-expand',\n 'aria-expanded': props.expanded,\n 'aria-label': props.labelExpand,\n onClick: onToggle\n },\n [\n (openBlock(),\n createElementBlock('svg', expandIcon, [\n props.expanded\n ? (openBlock(),\n createElementBlock('polyline', chevronDown))\n : (openBlock(),\n createElementBlock('polyline', chevronRight))\n ]))\n ],\n 8 /* PROPS */,\n expandDynamic\n ))\n : off()\n ],\n 16 /* FULL_PROPS */\n ))\n : off(),\n utilities.select\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 2 }, utilities.select),\n [\n createElementVNode(\n 'input',\n {\n type: 'checkbox',\n class: 'qt-select-row',\n 'aria-label': props.labelSelect,\n checked: props.selected,\n onChange: onSelect\n },\n null,\n 40 /* PROPS, NEED_HYDRATION */,\n selectDynamic\n )\n ],\n 16 /* FULL_PROPS */\n ))\n : off(),\n (openBlock(true),\n createElementBlock(\n Fragment,\n null,\n renderList(\n cells,\n cell => (\n openBlock(),\n createElementBlock(\n Fragment,\n { key: cell.field },\n [\n cell.slot\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 0 }, cell.attrs, {\n 'data-flash': cellFlash?.[cell.field]\n }),\n [\n renderSlot(slots, cell.slot, {\n row,\n rowIndex: index,\n column: cell.column,\n cellValue: valueAt(row, cell.field),\n rowPinned: pinned,\n pinRow: position =>\n props.pinRow(row, index, position)\n } satisfies CellSlotProps<object>)\n ],\n 16 /* FULL_PROPS */\n ))\n : (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 1 }, cell.attrs, {\n 'data-flash': cellFlash?.[cell.field]\n }),\n toDisplayString(cellText(row, cell.column)),\n 17 /* TEXT, FULL_PROPS */\n ))\n ],\n 64 /* STABLE_FRAGMENT */\n )\n )\n ),\n 128 /* KEYED_FRAGMENT */\n ))\n ],\n 8 /* PROPS */,\n rowDynamic\n )\n )\n }\n }\n})\n","import type { PinSide } from '../columns/column-layout'\n\n/**\n * Cells before the first column, in drawing order: the right panel, the\n * expand button, the selection checkbox.\n */\nexport type Utility = 'right-panel' | 'subtable' | 'select'\n\n/** Geometry key of a utility cell; a column's key is its `field`. */\nexport const utilityKey = (utility: string) => `utility:${utility}`\n\n/**\n * Attributes of a pinned cell (C-47, C-71): `data-pinned` (`''` on the left,\n * `'right'` on the right) and, once measured, the `--qt-pin-left` or\n * `--qt-pin-right` offset in pixels, next to an optional `width`. Nothing but\n * the width for a cell that is not pinned; no `style` when both are absent.\n */\nexport const pinAttrs = (\n side: PinSide,\n offset: number | undefined,\n width?: string\n): Record<string, unknown> => {\n const style: Record<string, string> = {}\n if (width) {\n style.width = width\n }\n if (side && offset !== undefined) {\n style[side === 'left' ? '--qt-pin-left' : '--qt-pin-right'] = `${offset}px`\n }\n return {\n 'data-pinned':\n side === 'left' ? '' : side === 'right' ? 'right' : undefined,\n style: Object.keys(style).length > 0 ? style : undefined\n }\n}\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { computed, onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport { sideOf } from '../columns/column-layout'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { tableRow, type RowCell, type RowUtilities } from './table-row'\nimport { columnTypeOf } from '../core/column'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type {\n BodyItem,\n DrawnRow,\n GroupRow,\n SpacerRow\n} from '../virtual/use-row-window'\n\nconst props = defineProps<{\n rows: T[]\n /**\n * The rows in drawing order: pinned top, the others, pinned bottom (C-74);\n * with `virtual` only the drawn ones, between spacers (C-83); with\n * `groupBy` a group row above the first row of each group (C-103).\n */\n bodyRows: Array<BodyItem<T>>\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n /** The consumer is fetching: no empty row, the `loading` row instead (C-52). */\n loading: boolean\n /** The columns to draw, hidden ones already dropped. */\n entries: ColumnEntry[]\n /**\n * The `cell-<field>` slots the consumer gives, one per line (a field name\n * may hold a space, never a line break). Slots are not reactive; a slot\n * that comes or goes changes this text (K311-3).\n */\n slotNames: string\n /** Cells a full-width row (subtable, empty) spans. */\n columnCount: number\n hasSubtable: boolean\n hasRightPanel: boolean\n /** Draw the selection checkbox column (C-59). */\n hasSelection: boolean\n isSelected: (row: T, index: number) => boolean\n toggleSelected: (row: T, index: number) => void\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n keyOf: (row: T, index: number) => string | number\n /** The row can expand: no expand button otherwise (C-98). */\n canExpand: (row: T, index: number) => boolean\n isExpanded: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\n /** `data-row-kind` of a row (C-97); absent, no row carries it. */\n rowKind?: (row: T, index: number) => string | null | undefined\n labels: TableLabels\n /** The consumer listens to `cellContextMenu` (C-28); read at event time. */\n hasContextMenuListener: () => boolean\n /** With `infinite`: what the `load-more` slot receives, else `null` (C-89). */\n loadMore: LoadMoreSlotProps | null\n /**\n * With `flash`: the marks and the binding hook (C-94), else `null`; off,\n * the body draws what it drew in 3.2 and calls nothing per row (C-95).\n */\n flash: FlashView | null\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\n/**\n * The body's slots object: the same object for the life of the body, whose\n * functions Vue replaces before each render. Every row gets it as a prop and\n * calls the latest `cell-<field>` function when it renders (K311-3).\n */\nconst rawSlots = useSlots()\n\nconst { onContextMenu } = useCellView<T>({\n rows: () => props.rows,\n entries: () => props.entries,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload)\n})\n\n/** `role` of a row and of a cell with `scrollBody` (C-102). */\nconst rowRole = () => (props.roles ? 'row' : undefined)\nconst cellRole = () => (props.roles ? 'cell' : undefined)\n/** A cell over every column; with `scrollBody` also its `aria-colspan`. */\nconst spanAttrs = () => ({\n colspan: props.columnCount,\n role: cellRole(),\n 'aria-colspan': props.roles ? props.columnCount : undefined\n})\n\n/*\n The cells every row draws, kept by value (K311-2): `entries` is a new\n array of new entries after a change of `rows` (TanStack's column getters\n read its options), so a cell keeps its object while its column (by\n identity), place, type, pinning, slot and role are the same, and the\n array is the previous one when every cell is. A row compares this array\n by identity.\n*/\nconst cells = computed<readonly RowCell[]>(previous => {\n const names = new Set(props.slotNames.split('\\n'))\n const role = cellRole()\n let same = previous?.length === props.entries.length\n const next = props.entries.map((entry, i): RowCell => {\n const { column } = entry\n const field = column.field\n // The type of a column, read once per change of the columns (C-82).\n const type = columnTypeOf(column)\n const side = sideOf(column)\n const offset = props.offsets[field]\n const slot = names.has(`cell-${field}`) ? `cell-${field}` : null\n const old = previous?.[i]\n if (\n old &&\n old.column === column &&\n old.type === type &&\n old.side === side &&\n old.offset === offset &&\n old.slot === slot &&\n old.role === role\n ) {\n return old\n }\n same = false\n return {\n field,\n column,\n type,\n side,\n offset,\n role,\n slot,\n attrs: {\n role,\n 'data-field': field,\n 'data-type': type,\n ...pinAttrs(side, offset)\n }\n }\n })\n return same && previous ? previous : next\n})\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71); kept by\n// value like the cells.\nconst utilities = computed<RowUtilities>(previous => {\n const role = cellRole()\n const side = props.hasPinned ? 'left' : false\n const offsetOf = (utility: string) => props.offsets[utilityKey(utility)]\n const signature = [\n role,\n side,\n props.hasRightPanel && `p${offsetOf('right-panel')}`,\n props.hasSubtable && `e${offsetOf('subtable')}`,\n props.hasSelection && `s${offsetOf('select')}`\n ].join('|')\n if (previous?.signature === signature) {\n return previous\n }\n const attrs = (on: boolean, utility: string) =>\n on ? { role, ...pinAttrs(side, offsetOf(utility)) } : null\n return {\n panel: attrs(props.hasRightPanel, 'right-panel'),\n expand: attrs(props.hasSubtable, 'subtable'),\n select: attrs(props.hasSelection, 'select'),\n signature\n }\n})\n\nconst isSpacer = (item: BodyItem<T>): item is SpacerRow => 'spacer' in item\nconst isGroup = (item: BodyItem<T>): item is GroupRow<T> => 'group' in item\n/** A data row: neither a spacer nor a group row. */\nconst isRow = (item: BodyItem<T>): item is DrawnRow<T> =>\n !isSpacer(item) && !isGroup(item)\n/** The identity of a body item in the `v-for`. */\nconst itemKey = (item: BodyItem<T>) =>\n isRow(item) ? props.keyOf(item.row, item.index) : item.key\n/** `data-row-kind` of a drawn row (C-97): no attribute for an empty kind. */\nconst kindOf = (item: DrawnRow<T>) =>\n props.rowKind ? props.rowKind(item.row, item.index) || undefined : undefined\n/** `aria-rowindex` of the subtable row under a drawn row (C-86). */\nconst nextIndex = (aria: number | undefined) =>\n aria === undefined ? undefined : aria + 1\n\n/*\n Snapshot expansion once per body render (not a live computed). A row's\n `expanded` prop is computed before the subtable `v-if`, and the `group`\n and `subtable` slots run in this render: a consumer slot that writes\n reactive state mid-render can clear TanStack's `expanded` atom before the\n subtable `v-if` runs — chevron flips, detail row never mounts. A computed\n would re-read the cleared atom; this map is filled on first use in the\n render and kept until the next update (K311-7).\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: BodyItem<T>) => {\n if (!isRow(item)) {\n return false\n }\n if (!expandedSnapshot) {\n const open = new Map<string, boolean>()\n if (props.hasSubtable) {\n for (const row of props.bodyRows) {\n if (isRow(row)) {\n open.set(\n String(props.keyOf(row.row, row.index)),\n props.isExpanded(row.row, row.index)\n )\n }\n }\n }\n expandedSnapshot = open\n }\n return (\n expandedSnapshot.get(String(props.keyOf(item.row, item.index))) === true\n )\n}\n</script>\n\n<template>\n <tbody :role=\"roles ? 'rowgroup' : undefined\" @contextmenu=\"onContextMenu\">\n <!--\n Flat `template v-for` children (no nested `<template v-else>` Fragment).\n A nested Fragment left the subtable `tr` vnode created but not inserted\n into `tbody` — chevron flipped, detail row never appeared in the DOM.\n A data row is one `TableRow` (ADR 0017): every prop is a value, so Vue\n skips a row whose values did not change (C-106). No children and no\n directive on it: either would update every row on every render.\n -->\n <template v-for=\"item in bodyRows\" :key=\"itemKey(item)\">\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :role=\"rowRole()\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td v-bind=\"spanAttrs()\" />\n </tr>\n <tr\n v-else-if=\"isGroup(item)\"\n class=\"qt-group-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"item.aria\"\n >\n <th\n scope=\"row\"\n :colspan=\"columnCount\"\n :role=\"roles ? 'rowheader' : undefined\"\n :aria-colspan=\"roles ? columnCount : undefined\"\n >\n <slot\n name=\"group\"\n :group-key=\"item.group.key\"\n :count=\"item.group.count\"\n :row=\"item.group.row\"\n :row-index=\"item.group.index\"\n >{{ item.group.key }}</slot\n >\n </th>\n </tr>\n <table-row\n v-else\n :row=\"item.row\"\n :row-key=\"keyOf(item.row, item.index)\"\n :index=\"item.index\"\n :aria=\"item.aria\"\n :pinned=\"item.pinned\"\n :kind=\"kindOf(item)\"\n :selected=\"hasSelection && isSelected(item.row, item.index)\"\n :expanded=\"isRowExpanded(item)\"\n :expandable=\"hasSubtable && canExpand(item.row, item.index)\"\n :flash=\"flash ? flash.of(keyOf(item.row, item.index)) : undefined\"\n :cells=\"cells\"\n :utilities=\"utilities\"\n :label-panel=\"labels.openRightPanel\"\n :label-expand=\"labels.expandRow\"\n :label-select=\"labels.selectRow\"\n :roles=\"roles\"\n :slots=\"rawSlots\"\n :flash-bind=\"flash ? flash.bind : undefined\"\n :pin-row=\"\n pinRow as (\n row: object,\n index: number,\n position: 'top' | 'bottom' | false\n ) => void\n \"\n @toggle=\"toggle(item.row, item.index)\"\n @toggle-selected=\"toggleSelected(item.row, item.index)\"\n @right-panel=\"emit('rowRightPanelClick', item.row)\"\n />\n <tr\n v-if=\"isRow(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr\n v-if=\"loading && slots.loading\"\n class=\"qt-loading-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"empty\" /></td>\n </tr>\n <tr\n v-if=\"!loading && rows.length > 0 && loadMore && slots['load-more']\"\n class=\"qt-load-more-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"load-more\" v-bind=\"loadMore\" />\n </td>\n </tr>\n </tbody>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { computed, onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport { sideOf } from '../columns/column-layout'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { tableRow, type RowCell, type RowUtilities } from './table-row'\nimport { columnTypeOf } from '../core/column'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type {\n BodyItem,\n DrawnRow,\n GroupRow,\n SpacerRow\n} from '../virtual/use-row-window'\n\nconst props = defineProps<{\n rows: T[]\n /**\n * The rows in drawing order: pinned top, the others, pinned bottom (C-74);\n * with `virtual` only the drawn ones, between spacers (C-83); with\n * `groupBy` a group row above the first row of each group (C-103).\n */\n bodyRows: Array<BodyItem<T>>\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n /** The consumer is fetching: no empty row, the `loading` row instead (C-52). */\n loading: boolean\n /** The columns to draw, hidden ones already dropped. */\n entries: ColumnEntry[]\n /**\n * The `cell-<field>` slots the consumer gives, one per line (a field name\n * may hold a space, never a line break). Slots are not reactive; a slot\n * that comes or goes changes this text (K311-3).\n */\n slotNames: string\n /** Cells a full-width row (subtable, empty) spans. */\n columnCount: number\n hasSubtable: boolean\n hasRightPanel: boolean\n /** Draw the selection checkbox column (C-59). */\n hasSelection: boolean\n isSelected: (row: T, index: number) => boolean\n toggleSelected: (row: T, index: number) => void\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n keyOf: (row: T, index: number) => string | number\n /** The row can expand: no expand button otherwise (C-98). */\n canExpand: (row: T, index: number) => boolean\n isExpanded: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\n /** `data-row-kind` of a row (C-97); absent, no row carries it. */\n rowKind?: (row: T, index: number) => string | null | undefined\n labels: TableLabels\n /** The consumer listens to `cellContextMenu` (C-28); read at event time. */\n hasContextMenuListener: () => boolean\n /** With `infinite`: what the `load-more` slot receives, else `null` (C-89). */\n loadMore: LoadMoreSlotProps | null\n /**\n * With `flash`: the marks and the binding hook (C-94), else `null`; off,\n * the body draws what it drew in 3.2 and calls nothing per row (C-95).\n */\n flash: FlashView | null\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\n/**\n * The body's slots object: the same object for the life of the body, whose\n * functions Vue replaces before each render. Every row gets it as a prop and\n * calls the latest `cell-<field>` function when it renders (K311-3).\n */\nconst rawSlots = useSlots()\n\nconst { onContextMenu } = useCellView<T>({\n rows: () => props.rows,\n entries: () => props.entries,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload)\n})\n\n/** `role` of a row and of a cell with `scrollBody` (C-102). */\nconst rowRole = () => (props.roles ? 'row' : undefined)\nconst cellRole = () => (props.roles ? 'cell' : undefined)\n/** A cell over every column; with `scrollBody` also its `aria-colspan`. */\nconst spanAttrs = () => ({\n colspan: props.columnCount,\n role: cellRole(),\n 'aria-colspan': props.roles ? props.columnCount : undefined\n})\n\n/*\n The cells every row draws, kept by value (K311-2): `entries` is a new\n array of new entries after a change of `rows` (TanStack's column getters\n read its options), so a cell keeps its object while its column (by\n identity), place, type, pinning, slot and role are the same, and the\n array is the previous one when every cell is. A row compares this array\n by identity.\n*/\nconst cells = computed<readonly RowCell[]>(previous => {\n const names = new Set(props.slotNames.split('\\n'))\n const role = cellRole()\n let same = previous?.length === props.entries.length\n const next = props.entries.map((entry, i): RowCell => {\n const { column } = entry\n const field = column.field\n // The type of a column, read once per change of the columns (C-82).\n const type = columnTypeOf(column)\n const side = sideOf(column)\n const offset = props.offsets[field]\n const slot = names.has(`cell-${field}`) ? `cell-${field}` : null\n const old = previous?.[i]\n if (\n old &&\n old.column === column &&\n old.type === type &&\n old.side === side &&\n old.offset === offset &&\n old.slot === slot &&\n old.role === role\n ) {\n return old\n }\n same = false\n return {\n field,\n column,\n type,\n side,\n offset,\n role,\n slot,\n attrs: {\n role,\n 'data-field': field,\n 'data-type': type,\n ...pinAttrs(side, offset)\n }\n }\n })\n return same && previous ? previous : next\n})\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71); kept by\n// value like the cells.\nconst utilities = computed<RowUtilities>(previous => {\n const role = cellRole()\n const side = props.hasPinned ? 'left' : false\n const offsetOf = (utility: string) => props.offsets[utilityKey(utility)]\n const signature = [\n role,\n side,\n props.hasRightPanel && `p${offsetOf('right-panel')}`,\n props.hasSubtable && `e${offsetOf('subtable')}`,\n props.hasSelection && `s${offsetOf('select')}`\n ].join('|')\n if (previous?.signature === signature) {\n return previous\n }\n const attrs = (on: boolean, utility: string) =>\n on ? { role, ...pinAttrs(side, offsetOf(utility)) } : null\n return {\n panel: attrs(props.hasRightPanel, 'right-panel'),\n expand: attrs(props.hasSubtable, 'subtable'),\n select: attrs(props.hasSelection, 'select'),\n signature\n }\n})\n\nconst isSpacer = (item: BodyItem<T>): item is SpacerRow => 'spacer' in item\nconst isGroup = (item: BodyItem<T>): item is GroupRow<T> => 'group' in item\n/** A data row: neither a spacer nor a group row. */\nconst isRow = (item: BodyItem<T>): item is DrawnRow<T> =>\n !isSpacer(item) && !isGroup(item)\n/** The identity of a body item in the `v-for`. */\nconst itemKey = (item: BodyItem<T>) =>\n isRow(item) ? props.keyOf(item.row, item.index) : item.key\n/** `data-row-kind` of a drawn row (C-97): no attribute for an empty kind. */\nconst kindOf = (item: DrawnRow<T>) =>\n props.rowKind ? props.rowKind(item.row, item.index) || undefined : undefined\n/** `aria-rowindex` of the subtable row under a drawn row (C-86). */\nconst nextIndex = (aria: number | undefined) =>\n aria === undefined ? undefined : aria + 1\n\n/*\n Snapshot expansion once per body render (not a live computed). A row's\n `expanded` prop is computed before the subtable `v-if`, and the `group`\n and `subtable` slots run in this render: a consumer slot that writes\n reactive state mid-render can clear TanStack's `expanded` atom before the\n subtable `v-if` runs — chevron flips, detail row never mounts. A computed\n would re-read the cleared atom; this map is filled on first use in the\n render and kept until the next update (K311-7).\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: BodyItem<T>) => {\n if (!isRow(item)) {\n return false\n }\n if (!expandedSnapshot) {\n const open = new Map<string, boolean>()\n if (props.hasSubtable) {\n for (const row of props.bodyRows) {\n if (isRow(row)) {\n open.set(\n String(props.keyOf(row.row, row.index)),\n props.isExpanded(row.row, row.index)\n )\n }\n }\n }\n expandedSnapshot = open\n }\n return (\n expandedSnapshot.get(String(props.keyOf(item.row, item.index))) === true\n )\n}\n</script>\n\n<template>\n <tbody :role=\"roles ? 'rowgroup' : undefined\" @contextmenu=\"onContextMenu\">\n <!--\n Flat `template v-for` children (no nested `<template v-else>` Fragment).\n A nested Fragment left the subtable `tr` vnode created but not inserted\n into `tbody` — chevron flipped, detail row never appeared in the DOM.\n A data row is one `TableRow` (ADR 0017): every prop is a value, so Vue\n skips a row whose values did not change (C-106). No children and no\n directive on it: either would update every row on every render.\n -->\n <template v-for=\"item in bodyRows\" :key=\"itemKey(item)\">\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :role=\"rowRole()\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td v-bind=\"spanAttrs()\" />\n </tr>\n <tr\n v-else-if=\"isGroup(item)\"\n class=\"qt-group-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"item.aria\"\n >\n <th\n scope=\"row\"\n :colspan=\"columnCount\"\n :role=\"roles ? 'rowheader' : undefined\"\n :aria-colspan=\"roles ? columnCount : undefined\"\n >\n <slot\n name=\"group\"\n :group-key=\"item.group.key\"\n :count=\"item.group.count\"\n :row=\"item.group.row\"\n :row-index=\"item.group.index\"\n >{{ item.group.key }}</slot\n >\n </th>\n </tr>\n <table-row\n v-else\n :row=\"item.row\"\n :row-key=\"keyOf(item.row, item.index)\"\n :index=\"item.index\"\n :aria=\"item.aria\"\n :pinned=\"item.pinned\"\n :kind=\"kindOf(item)\"\n :selected=\"hasSelection && isSelected(item.row, item.index)\"\n :expanded=\"isRowExpanded(item)\"\n :expandable=\"hasSubtable && canExpand(item.row, item.index)\"\n :flash=\"flash ? flash.of(keyOf(item.row, item.index)) : undefined\"\n :cells=\"cells\"\n :utilities=\"utilities\"\n :label-panel=\"labels.openRightPanel\"\n :label-expand=\"labels.expandRow\"\n :label-select=\"labels.selectRow\"\n :roles=\"roles\"\n :slots=\"rawSlots\"\n :flash-bind=\"flash ? flash.bind : undefined\"\n :pin-row=\"\n pinRow as (\n row: object,\n index: number,\n position: 'top' | 'bottom' | false\n ) => void\n \"\n @toggle=\"toggle(item.row, item.index)\"\n @toggle-selected=\"toggleSelected(item.row, item.index)\"\n @right-panel=\"emit('rowRightPanelClick', item.row)\"\n />\n <tr\n v-if=\"isRow(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr\n v-if=\"loading && slots.loading\"\n class=\"qt-loading-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"empty\" /></td>\n </tr>\n <tr\n v-if=\"!loading && rows.length > 0 && loadMore && slots['load-more']\"\n class=\"qt-load-more-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"load-more\" v-bind=\"loadMore\" />\n </td>\n </tr>\n </tbody>\n</template>\n","<script setup lang=\"ts\">\nimport { sideOf } from '../columns/column-layout'\nimport type { Column, FooterRow } from '../contract'\nimport { columnTypeOf } from '../core/column'\nimport { pinAttrs } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\ndefineProps<{\n footerRows: FooterRow[]\n entries: ColumnEntry[]\n /** Cells before the first column (right panel, expand button). */\n utilityCount: number\n /** Some column is pinned to the left: the utility cell gets `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** With `virtual`: `aria-rowindex` of the first footer row (C-86). */\n firstRowIndex?: number\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst footerText = (row: FooterRow, column: Column) =>\n row.cells.find(cell => cell.field === column.field)?.text\n</script>\n\n<template>\n <tfoot class=\"qt-footer\" :role=\"roles ? 'rowgroup' : undefined\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\n :role=\"roles ? 'row' : undefined\"\n :aria-rowindex=\"\n firstRowIndex === undefined ? undefined : firstRowIndex + i\n \"\n >\n <!-- One cell spans the utilities; pinned, it starts at offset 0. -->\n <td\n v-if=\"utilityCount > 0\"\n :colspan=\"utilityCount\"\n :role=\"roles ? 'cell' : undefined\"\n :aria-colspan=\"roles ? utilityCount : undefined\"\n v-bind=\"pinAttrs(hasPinned ? 'left' : false, 0)\"\n />\n <td\n v-for=\"entry in entries\"\n :key=\"entry.column.field\"\n :data-field=\"entry.column.field\"\n :data-type=\"columnTypeOf(entry.column)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"pinAttrs(sideOf(entry.column), offsets[entry.column.field])\"\n >\n {{ footerText(footerRow, entry.column) }}\n </td>\n </tr>\n </tfoot>\n</template>\n","<script setup lang=\"ts\">\nimport { sideOf } from '../columns/column-layout'\nimport type { Column, FooterRow } from '../contract'\nimport { columnTypeOf } from '../core/column'\nimport { pinAttrs } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\ndefineProps<{\n footerRows: FooterRow[]\n entries: ColumnEntry[]\n /** Cells before the first column (right panel, expand button). */\n utilityCount: number\n /** Some column is pinned to the left: the utility cell gets `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** With `virtual`: `aria-rowindex` of the first footer row (C-86). */\n firstRowIndex?: number\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst footerText = (row: FooterRow, column: Column) =>\n row.cells.find(cell => cell.field === column.field)?.text\n</script>\n\n<template>\n <tfoot class=\"qt-footer\" :role=\"roles ? 'rowgroup' : undefined\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\n :role=\"roles ? 'row' : undefined\"\n :aria-rowindex=\"\n firstRowIndex === undefined ? undefined : firstRowIndex + i\n \"\n >\n <!-- One cell spans the utilities; pinned, it starts at offset 0. -->\n <td\n v-if=\"utilityCount > 0\"\n :colspan=\"utilityCount\"\n :role=\"roles ? 'cell' : undefined\"\n :aria-colspan=\"roles ? utilityCount : undefined\"\n v-bind=\"pinAttrs(hasPinned ? 'left' : false, 0)\"\n />\n <td\n v-for=\"entry in entries\"\n :key=\"entry.column.field\"\n :data-field=\"entry.column.field\"\n :data-type=\"columnTypeOf(entry.column)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"pinAttrs(sideOf(entry.column), offsets[entry.column.field])\"\n >\n {{ footerText(footerRow, entry.column) }}\n </td>\n </tr>\n </tfoot>\n</template>\n","<script setup lang=\"ts\">\n// `filled` marks an applied filter: the funnel is painted instead of outlined.\ndefineProps<{ filled?: boolean }>()\n</script>\n\n<template>\n <svg\n viewBox=\"0 0 24 24\"\n width=\"14\"\n height=\"14\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n :fill=\"filled ? 'currentColor' : 'none'\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\" />\n </svg>\n</template>\n","<script setup lang=\"ts\">\n// `filled` marks an applied filter: the funnel is painted instead of outlined.\ndefineProps<{ filled?: boolean }>()\n</script>\n\n<template>\n <svg\n viewBox=\"0 0 24 24\"\n width=\"14\"\n height=\"14\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n :fill=\"filled ? 'currentColor' : 'none'\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\" />\n </svg>\n</template>\n","import { type Component, defineComponent, h } from 'vue'\n\nimport type { Column, TableLabels } from '../contract'\nimport { columnName } from '../core/labels'\nimport IconFilter from '../parts/filter-icon.vue'\n\nexport interface FilterTriggerOptions {\n /** The column of this header cell, as the table has it now. */\n column: () => Column\n labels: () => TableLabels\n isFiltered: () => boolean\n}\n\n/**\n * The filter button a `filter-menu` slot receives as `trigger` (C-34). It is\n * created once, so a popover wrapped around it does not remount the button on\n * every render. It reads reactive state when it renders, so it still updates:\n * the column and the labels come from getters on each render, not from a\n * capture, so a new title or label shows at once.\n */\nexport const useFilterTrigger = (options: FilterTriggerOptions): Component =>\n defineComponent({\n name: 'FilterTrigger',\n setup: () => () => {\n const name = options.labels().filterOptions(columnName(options.column()))\n const filtered = options.isFiltered()\n return h(\n 'button',\n {\n type: 'button',\n class: 'qt-filter-button',\n title: name,\n 'aria-label': name,\n 'data-filtered': filtered ? '' : undefined\n },\n [h(IconFilter, { filled: filtered })]\n )\n }\n })\n","<script setup lang=\"ts\">\nimport { conditionOptions, rulesOf } from '@dolusoft/query-protocol'\n\nimport type {\n Column,\n ColumnType,\n FilterCondition,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n Query\n} from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { useFilterTrigger } from '../filter/use-filter-trigger'\n\nconst props = defineProps<{\n column: Column\n type: ColumnType\n query: Query\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n}>()\n\nconst { filters, sort, layout, labels } = useTableContext()\n\nconst inputName = () => labels().filterInput(columnName(props.column))\n\nconst isFiltered = () =>\n rulesOf(props.query.filters, props.column.field).length > 0\n\nconst trigger = useFilterTrigger({\n column: () => props.column,\n labels,\n isFiltered\n})\n\nconst labelOf = () => {\n const label = filters.labelOf(props.column.field)\n if (!label) {\n return ''\n }\n const text = labels().filterCondition(label.condition, props.type)\n return label.count > 1 ? `${text} (${label.count})` : text\n}\n\n// A column with several rules shows their count where the value would be.\nconst inputText = () => {\n const count = filters.multiOf(props.column.field)\n return count > 0 ? `(${count})` : filters.draftOf(props.column.field).text\n}\n\nconst currentCondition = (): FilterCondition | null =>\n rulesOf(props.query.filters, props.column.field)[0]?.condition ??\n filters.draftOf(props.column.field).condition\n\nconst menuProps = (): FilterMenuSlotProps => {\n const { column } = props\n return {\n column,\n rules: rulesOf(props.query.filters, column.field),\n condition: currentCondition(),\n conditions: conditionOptions[props.type].map(({ value }) => ({\n value,\n label: labels().filterCondition(value, props.type)\n })),\n setCondition: condition => filters.setCondition(column.field, condition),\n clear: () => filters.clear(column.field),\n sortable: sort.isSortable(column),\n sortDirection: sort.sortOf(column),\n // `sortBy` does nothing where sorting is off, like a header click (C-07).\n setSort: direction => sort.sortBy(column, direction),\n trigger,\n control: layout.controlOf(column.field)\n }\n}\n\nconst datetimeProps = (): FilterDatetimeSlotProps => ({\n column: props.column,\n value: filters.draftOf(props.column.field).text,\n updateValue: value => filters.setInput(props.column.field, value)\n})\n\nconst inputValue = (event: Event) =>\n (event.target as HTMLInputElement | HTMLSelectElement).value\n\n// A select has no typing: a pick applies at once.\nconst pick = (event: Event) => {\n filters.setInput(props.column.field, inputValue(event))\n filters.apply(props.column.field)\n}\n</script>\n\n<template>\n <div class=\"qt-filter\">\n <input\n v-if=\"type === 'string'\"\n type=\"text\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"filters.draftOf(column.field).text\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <input\n v-else-if=\"type === 'number' || type === 'integer'\"\n :type=\"filters.multiOf(column.field) ? 'text' : 'number'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <template v-else-if=\"type === 'bool'\">\n <select\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"filters.draftOf(column.field).text\"\n :disabled=\"filters.multiOf(column.field) > 0\"\n @change=\"pick($event)\"\n >\n <option value=\"\">{{ labels().boolAll }}</option>\n <option value=\"true\">{{ labels().boolTrue }}</option>\n <option value=\"false\">{{ labels().boolFalse }}</option>\n </select>\n </template>\n <template v-else>\n <slot\n v-if=\"$slots['filter-datetime']\"\n name=\"filter-datetime\"\n v-bind=\"datetimeProps()\"\n />\n <input\n v-else\n :type=\"filters.multiOf(column.field) ? 'text' : 'date'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n </template>\n <slot v-if=\"type !== 'bool'\" name=\"filter-menu\" v-bind=\"menuProps()\" />\n <small v-if=\"labelOf()\" class=\"qt-filter-condition\">\n {{ labelOf() }}\n </small>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { conditionOptions, rulesOf } from '@dolusoft/query-protocol'\n\nimport type {\n Column,\n ColumnType,\n FilterCondition,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n Query\n} from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { useFilterTrigger } from '../filter/use-filter-trigger'\n\nconst props = defineProps<{\n column: Column\n type: ColumnType\n query: Query\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n}>()\n\nconst { filters, sort, layout, labels } = useTableContext()\n\nconst inputName = () => labels().filterInput(columnName(props.column))\n\nconst isFiltered = () =>\n rulesOf(props.query.filters, props.column.field).length > 0\n\nconst trigger = useFilterTrigger({\n column: () => props.column,\n labels,\n isFiltered\n})\n\nconst labelOf = () => {\n const label = filters.labelOf(props.column.field)\n if (!label) {\n return ''\n }\n const text = labels().filterCondition(label.condition, props.type)\n return label.count > 1 ? `${text} (${label.count})` : text\n}\n\n// A column with several rules shows their count where the value would be.\nconst inputText = () => {\n const count = filters.multiOf(props.column.field)\n return count > 0 ? `(${count})` : filters.draftOf(props.column.field).text\n}\n\nconst currentCondition = (): FilterCondition | null =>\n rulesOf(props.query.filters, props.column.field)[0]?.condition ??\n filters.draftOf(props.column.field).condition\n\nconst menuProps = (): FilterMenuSlotProps => {\n const { column } = props\n return {\n column,\n rules: rulesOf(props.query.filters, column.field),\n condition: currentCondition(),\n conditions: conditionOptions[props.type].map(({ value }) => ({\n value,\n label: labels().filterCondition(value, props.type)\n })),\n setCondition: condition => filters.setCondition(column.field, condition),\n clear: () => filters.clear(column.field),\n sortable: sort.isSortable(column),\n sortDirection: sort.sortOf(column),\n // `sortBy` does nothing where sorting is off, like a header click (C-07).\n setSort: direction => sort.sortBy(column, direction),\n trigger,\n control: layout.controlOf(column.field)\n }\n}\n\nconst datetimeProps = (): FilterDatetimeSlotProps => ({\n column: props.column,\n value: filters.draftOf(props.column.field).text,\n updateValue: value => filters.setInput(props.column.field, value)\n})\n\nconst inputValue = (event: Event) =>\n (event.target as HTMLInputElement | HTMLSelectElement).value\n\n// A select has no typing: a pick applies at once.\nconst pick = (event: Event) => {\n filters.setInput(props.column.field, inputValue(event))\n filters.apply(props.column.field)\n}\n</script>\n\n<template>\n <div class=\"qt-filter\">\n <input\n v-if=\"type === 'string'\"\n type=\"text\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"filters.draftOf(column.field).text\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <input\n v-else-if=\"type === 'number' || type === 'integer'\"\n :type=\"filters.multiOf(column.field) ? 'text' : 'number'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <template v-else-if=\"type === 'bool'\">\n <select\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"filters.draftOf(column.field).text\"\n :disabled=\"filters.multiOf(column.field) > 0\"\n @change=\"pick($event)\"\n >\n <option value=\"\">{{ labels().boolAll }}</option>\n <option value=\"true\">{{ labels().boolTrue }}</option>\n <option value=\"false\">{{ labels().boolFalse }}</option>\n </select>\n </template>\n <template v-else>\n <slot\n v-if=\"$slots['filter-datetime']\"\n name=\"filter-datetime\"\n v-bind=\"datetimeProps()\"\n />\n <input\n v-else\n :type=\"filters.multiOf(column.field) ? 'text' : 'date'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n </template>\n <slot v-if=\"type !== 'bool'\" name=\"filter-menu\" v-bind=\"menuProps()\" />\n <small v-if=\"labelOf()\" class=\"qt-filter-condition\">\n {{ labelOf() }}\n </small>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { reorder, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = reorder.listeners(() => props.column)\n</script>\n\n<template>\n <!-- C-73: a button that moves the column within its region, by drag or by\n key. The table draws no live region: the consumer announces. -->\n <button\n type=\"button\"\n class=\"qt-reorder-handle\"\n :aria-label=\"labels().moveColumn(columnName(column))\"\n aria-keyshortcuts=\"ArrowLeft ArrowRight Home End\"\n v-on=\"on\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <circle cx=\"9\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"18\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"18\" r=\"1.5\" />\n </svg>\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { reorder, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = reorder.listeners(() => props.column)\n</script>\n\n<template>\n <!-- C-73: a button that moves the column within its region, by drag or by\n key. The table draws no live region: the consumer announces. -->\n <button\n type=\"button\"\n class=\"qt-reorder-handle\"\n :aria-label=\"labels().moveColumn(columnName(column))\"\n aria-keyshortcuts=\"ArrowLeft ArrowRight Home End\"\n v-on=\"on\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <circle cx=\"9\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"18\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"18\" r=\"1.5\" />\n </svg>\n </button>\n</template>\n","// The width each drawn column needs for its content (C-99, ADR 0013).\n\n/**\n * What must not count, inside the table: the filter row and the resize handle\n * of a header cell (C-50 counts the label only), the footer, and every body\n * row that is not a data row (subtable, virtual spacer, loading, empty,\n * load-more). A subtable or a spanning cell would otherwise widen the\n * columns it spans with content that is not theirs.\n */\nconst notCountedParts = [\n ':scope > thead > tr > th[data-field] > .qt-resize-handle',\n ':scope > tbody > tr:not([data-row-index])',\n ':scope > tfoot'\n]\nconst filterRow = ':scope > thead > tr > th[data-field] > .qt-filter'\nconst notCounted = [filterRow, ...notCountedParts].join(', ')\nconst notCountedWithFilters = notCountedParts.join(', ')\n\n/**\n * The room a text, number or date filter input keeps for its text when the\n * filter row counts (C-100): six characters of the input's own font.\n */\nconst filterText = '6ch'\n\ninterface MeasureOptions {\n /**\n * The filter row counts as a floor (C-100): laid out at the width it\n * needs, its controls side by side and six characters of text in each\n * input, so a column is never drawn narrower than its filter.\n */\n filters?: boolean\n}\n\n/**\n * Sets inline declarations for one read and puts every `style` attribute\n * back exactly as it was, absent included, so the markup after the call is\n * the markup before it (C-31). `!important` so a consumer's `!important`\n * rule cannot keep the fixed layout during the read.\n */\nexport const styleSwap = () => {\n const saved = new Map<HTMLElement, string | null>()\n return {\n set(element: HTMLElement, property: string, value: string) {\n if (!saved.has(element)) {\n saved.set(element, element.getAttribute('style'))\n }\n element.style.setProperty(property, value, 'important')\n },\n restore() {\n for (const [element, style] of saved) {\n if (style === null) {\n // Chrome writes a CSSOM change to the attribute lazily: removed\n // before that write, the attribute comes back as `style=\"\"`. The\n // read flushes it first.\n element.getAttribute('style')\n element.removeAttribute('style')\n } else {\n element.setAttribute('style', style)\n }\n }\n saved.clear()\n }\n }\n}\n\n/**\n * The max-content width of each drawn column, by `field`: header label and\n * the cells of the drawn data rows, padding and border included, in whole\n * pixels rounded up. The browser lays the table out once with its automatic\n * layout and no widths, the parts that do not count taken out, and every\n * style is put back before the function returns: nothing is painted in\n * between, and slot content that draws a block or a flex box counts with the\n * width its content needs, not the width its cell gives it. Only `fields`\n * when given; a column with no box (the table not displayed) is left out.\n * With `scrollBody` the data rows are in a table of their own, `body`\n * (C-101): it is laid out the same way, its `col` widths left out, and a\n * column takes the wider of its header cell and its body cells.\n */\nexport const measureColumnWidths = (\n table: HTMLTableElement | null | undefined,\n fields?: readonly string[],\n body?: HTMLTableElement | null,\n options: MeasureOptions = {}\n): Record<string, number> => {\n const widths: Record<string, number> = {}\n if (!table?.tHead) {\n return widths\n }\n const wanted = fields ? new Set(fields) : null\n const headers = Array.from(\n table.querySelectorAll<HTMLTableCellElement>(\n ':scope > thead > tr > th[data-field]'\n )\n )\n const swap = styleSwap()\n try {\n swap.set(table, 'table-layout', 'auto')\n swap.set(table, 'width', 'max-content')\n swap.set(table, 'min-width', '0')\n for (const th of headers) {\n swap.set(th, 'width', 'auto')\n }\n for (const part of Array.from(\n table.querySelectorAll<HTMLElement>(\n options.filters ? notCountedWithFilters : notCounted\n )\n )) {\n swap.set(part, 'display', 'none')\n }\n if (options.filters) {\n countFilters(table, swap)\n }\n const split = body && body !== table ? body : null\n if (split) {\n swap.set(split, 'table-layout', 'auto')\n swap.set(split, 'width', 'max-content')\n swap.set(split, 'min-width', '0')\n for (const col of Array.from(\n split.querySelectorAll<HTMLElement>(':scope > colgroup > col')\n )) {\n swap.set(col, 'width', 'auto')\n }\n for (const part of Array.from(\n split.querySelectorAll<HTMLElement>(\n ':scope > tbody > tr:not([data-row-index])'\n )\n )) {\n swap.set(part, 'display', 'none')\n }\n }\n // One data row is enough: the cells of a column share its width.\n const firstRow = split?.querySelector(':scope > tbody > tr[data-row-index]')\n const measured: [string, HTMLTableCellElement, number][] = []\n for (const th of headers) {\n const field = th.dataset.field\n if (field === undefined || (wanted && !wanted.has(field))) {\n continue\n }\n const own = th.getBoundingClientRect().width\n if (own === 0) {\n // No box: the table is not displayed.\n continue\n }\n const cell = firstRow?.querySelector(\n `:scope > td[data-field=\"${CSS.escape(field)}\"]`\n )\n measured.push([\n field,\n th,\n Math.max(own, cell?.getBoundingClientRect().width ?? 0)\n ])\n }\n const floors = options.filters\n ? filterFloors(\n measured.map(([, th]) => th),\n swap\n )\n : null\n for (const [field, th, width] of measured) {\n widths[field] = Math.ceil(Math.max(width, floors?.get(th) ?? 0))\n }\n } finally {\n swap.restore()\n }\n return widths\n}\n\n/**\n * Takes the filter rows out of the read (C-100): out of the cell's flow\n * (`position: absolute`), so nothing in them widens the column by being\n * there, and no size container, which would switch the row to its narrow\n * form. Each control of the table stops growing and shrinking: a text or\n * number input six characters wide (padding and border on top), a select\n * and a date or time input as wide as they draw themselves, a filter button\n * at its own width, back in the row's flow when a skin's narrow form laid it\n * `absolute` over the input. A control `fixed` over the page (a panel)\n * stays out.\n */\nconst countFilters = (\n table: HTMLTableElement,\n swap: ReturnType<typeof styleSwap>\n) => {\n const rows = Array.from(table.querySelectorAll<HTMLElement>(filterRow))\n for (const row of rows) {\n swap.set(row, 'position', 'absolute')\n swap.set(row, 'container-type', 'normal')\n swap.set(row, 'contain', 'none')\n swap.set(row, 'box-sizing', 'content-box')\n for (const input of Array.from(\n row.querySelectorAll<HTMLElement>(':scope > .qt-filter-input')\n )) {\n swap.set(input, 'flex', 'none')\n swap.set(input, 'min-width', '0')\n if (input instanceof HTMLInputElement && textTypes.has(input.type)) {\n swap.set(input, 'box-sizing', 'content-box')\n swap.set(input, 'width', filterText)\n } else {\n swap.set(input, 'width', 'auto')\n }\n }\n for (const button of Array.from(\n row.querySelectorAll<HTMLElement>(':scope > .qt-filter-button')\n )) {\n swap.set(button, 'flex', 'none')\n }\n }\n // Read once the rows are no containers: a skin's narrow form is gone.\n for (const row of rows) {\n for (const button of Array.from(\n row.querySelectorAll<HTMLElement>(':scope > .qt-filter-button')\n )) {\n if (getComputedStyle(button).position === 'absolute') {\n swap.set(button, 'position', 'static')\n }\n }\n }\n}\n\n/** The inputs that keep six characters of text; the others draw their own. */\nconst textTypes = new Set(['text', 'number', 'search'])\n\nconst horizontal = (style: CSSStyleDeclaration) =>\n (parseFloat(style.paddingLeft) || 0) +\n (parseFloat(style.paddingRight) || 0) +\n (parseFloat(style.borderLeftWidth) || 0) +\n (parseFloat(style.borderRightWidth) || 0)\n\n/** The table's own filter controls, the row's children, that take room. */\nconst controlsOf = (row: HTMLElement) =>\n Array.from(\n row.querySelectorAll<HTMLElement>(\n ':scope > :is(.qt-filter-input, .qt-filter-button)'\n )\n ).filter(control => {\n // A control laid out of the row's flow (a panel over the page) takes\n // no room in the column.\n const { position } = getComputedStyle(control)\n return position !== 'fixed' && position !== 'absolute'\n })\n\n/** The row's content width the probes draw it at: `0` and this. */\nconst probe = 1000\n\n/**\n * The width each header cell needs for its filter controls, from the\n * controls alone: the row's width is never read, so slot content in it\n * cannot count, by its own width or by a width it took from the column. The\n * controls are drawn side by side in rows `0` and `probe` pixels wide, and\n * each width (a control, the gap) is taken as a fixed part plus a share of\n * the row, which is what a percentage padding is. The row then needs `R`\n * with `R = fixed + share * R`, the cell `R` plus the row's and the cell's\n * padding and border.\n */\nconst filterFloors = (\n headers: HTMLTableCellElement[],\n swap: ReturnType<typeof styleSwap>\n) => {\n const rows = headers.flatMap(th => {\n const row = th.querySelector<HTMLElement>(':scope > .qt-filter')\n const controls = row ? controlsOf(row) : []\n return row && controls.length > 0 ? [{ th, row, controls }] : []\n })\n const read = (width: number) => {\n for (const { row } of rows) {\n swap.set(row, 'width', `${width}px`)\n }\n return rows.map(({ row, controls }) => {\n const drawn = controls\n .map(control => control.getBoundingClientRect().width)\n .filter(each => each > 0)\n const gap = parseFloat(getComputedStyle(row).columnGap) || 0\n return drawn.length === 0\n ? 0\n : drawn.reduce((sum, each) => sum + each, 0) + gap * (drawn.length - 1)\n })\n }\n const atZero = read(0)\n const atProbe = read(probe)\n const floors = new Map<HTMLTableCellElement, number>()\n rows.forEach(({ th, row }, index) => {\n const fixed = atZero[index]\n if (fixed === 0) {\n return\n }\n // At most 90% of the row can be a share: past that no width holds.\n const share = Math.min(0.9, Math.max(0, (atProbe[index] - fixed) / probe))\n floors.set(\n th,\n fixed / (1 - share) +\n horizontal(getComputedStyle(row)) +\n horizontal(getComputedStyle(th))\n )\n })\n return floors\n}\n","// Between the width a column is declared with and the width it is drawn at\n// (C-49, C-50).\n\nimport { styleSwap } from './measure-widths'\n\n/** How a column's declared width maps to the width it is drawn at. */\nexport interface WidthScale {\n /** The declared width that draws the column `rendered` pixels wide. */\n declared: (rendered: number) => number\n /** The width the column is drawn at with the `declared` width. */\n rendered: (declared: number) => number\n}\n\nconst same = (width: number) => width\n\nconst sum = (widths: number[]) => widths.reduce((a, b) => a + b, 0)\n\n/** The declared width is the drawn one. */\nexport const identityScale: WidthScale = { declared: same, rendered: same }\n\n/**\n * A table whose cells take `space` (a container's width, with\n * `min-width: 100%`) and whose columns are declared narrower: the fixed\n * layout spreads the rest over the columns by their declared widths, so a\n * column declared `w` next to `others` is drawn `w * space / (w + others)`\n * wide until the columns fill the space, and `w` from there on. With no other\n * column the one column takes the space whatever its width: the identity.\n */\nexport const stretchedScale = (space: number, others: number): WidthScale =>\n others > 0 && space > others\n ? {\n declared: rendered =>\n rendered >= space - others\n ? rendered\n : (rendered * others) / (space - rendered),\n rendered: declared =>\n declared + others >= space\n ? declared\n : (declared * space) / (declared + others)\n }\n : identityScale\n\n/**\n * How the declared width of the column of `th` maps to its drawn width, read\n * from the layout. The column is drawn once at the width it is drawn at now.\n * Wider there, the table stretches it: its row's cells take the whole space,\n * and the other columns' declared widths follow from the stretch; the fit\n * must then give back the width the column is drawn at now. Not wider, the\n * column is drawn once more at `low`, the narrowest width a resize writes. A\n * table that stretches it there widens every cell of the row by one factor,\n * the column at least as much (content the fixed layout keeps wider than\n * `low` only adds to it), and its cells then take the space the columns can\n * shrink into before the table stretches them. Any other layout gets the\n * identity: one that never stretches, a column without a width that takes\n * what is left, one that spreads the space otherwise. Every style is put back before the\n * function returns (C-31), so nothing is painted in between.\n */\nexport const measureWidthScale = (th: HTMLElement, low: number): WidthScale => {\n const now = th.getBoundingClientRect().width\n const others = Array.from(th.parentElement?.children ?? []).filter(\n cell => cell !== th\n )\n const widths = () => others.map(cell => cell.getBoundingClientRect().width)\n const swap = styleSwap()\n /** Draws the column `width` wide; the width it takes. */\n const draw = (width: number) => {\n swap.set(th, 'width', `${width}px`)\n return th.getBoundingClientRect().width\n }\n try {\n const drawn = draw(now)\n const before = widths()\n const rest = sum(before)\n if (drawn > now + 0.5) {\n const space = drawn + rest\n const scale = stretchedScale(space, (now * rest) / drawn)\n return Math.abs(draw(scale.declared(now)) - now) <= 1\n ? scale\n : identityScale\n }\n const narrow = draw(low)\n const after = widths()\n const factor = sum(after) / rest\n const stretched =\n factor > 1 &&\n narrow >= low * factor - 1 &&\n after.every((width, i) => Math.abs(width - before[i] * factor) <= 1)\n return stretched ? stretchedScale(narrow + sum(after), rest) : identityScale\n } finally {\n swap.restore()\n }\n}\n","import { onBeforeUnmount, shallowRef } from 'vue'\n\nimport type { Column, ColumnResizePayload } from '../contract'\nimport { measureColumnWidths } from './measure-widths'\nimport { measureWidthScale, type WidthScale } from './width-scale'\n\n/** Default `Column.minWidth`, in pixels. */\nconst defaultMinWidth = 40\n\nexport interface ColumnResizeOptions {\n /** The `resizable` prop: whether the table draws resize handles. */\n resizable: () => boolean\n /** Measured width of a header cell, by `field`. */\n measuredWidth: (field: string) => number | undefined\n /** Measured width of the table. */\n tableWidth: () => number\n /** With `scrollBody`: the table of the body rows (C-101), else `null`. */\n body: () => HTMLTableElement | null\n emit: (payload: ColumnResizePayload) => void\n}\n\n/**\n * A width limit a consumer gave, or `undefined` when it cannot be one. The\n * types say `number`, but a loosely typed consumer can pass `''`, `NaN`,\n * `0` or a negative: those count as unset instead of clamping to 0.\n */\nexport const limitOf = (value: unknown) =>\n typeof value === 'number' && Number.isFinite(value) && value > 0\n ? value\n : undefined\n\n/**\n * The smallest width: `Column.minWidth`, else the default 40 (which gives way\n * to a smaller `Column.maxWidth`, so a maximum alone keeps working).\n */\nexport const minWidthOf = (column: Column) =>\n limitOf(column.minWidth) ??\n Math.min(defaultMinWidth, limitOf(column.maxWidth) ?? defaultMinWidth)\n\n/** The largest width, or `undefined` for none. A `minWidth` above it wins. */\nconst maxWidthOf = (column: Column) => {\n const max = limitOf(column.maxWidth)\n return max === undefined ? undefined : Math.max(max, minWidthOf(column))\n}\n\nexport const clampWidth = (column: Column, width: number) =>\n Math.round(\n Math.min(\n maxWidthOf(column) ?? Infinity,\n Math.max(minWidthOf(column), width)\n )\n )\n\ninterface Drag {\n column: Column\n pointerId: number\n startX: number\n /** The width the column is drawn at when the drag starts. */\n startWidth: number\n scale: WidthScale\n lastX: number\n frame: number\n}\n\nconst cellOf = (event: Event) =>\n (event.currentTarget as HTMLElement).closest('th')\n\n/**\n * Which edge of the column the handle stands for: `1` for the right edge,\n * `-1` for the left one. A right-pinned column stays at the right edge of the\n * scroll container, so it grows to the left: its handle stands for its left\n * edge, and moving that edge to the left widens it (C-71).\n */\nconst edgeOf = (column: Column) => (column.pinned === 'right' ? -1 : 1)\n\n/**\n * The scale of a column's widths, read from the layout once per drag or key:\n * a table stretched to its container draws a column wider than declared.\n */\nconst scaleOf = (th: HTMLElement, column: Column) =>\n measureWidthScale(th, clampWidth(column, 0))\n\n/**\n * Resizing a column (C-48 to C-50). The table holds a width only while a\n * drag is under way (the preview, P2); every committed width goes out as a\n * `columnResize` event and comes back, if the consumer wants it, as\n * `Column.width`. The handle captures the pointer, so all drag events arrive\n * at the handle itself, and it has the focus, so Escape does too. The pointer\n * and the arrow keys move the drawn width; what the table writes and emits is\n * the declared width that draws it (`measureWidthScale`).\n */\nexport const useColumnResize = (options: ColumnResizeOptions) => {\n /** `width` is declared (the inline style), `rendered` drawn. */\n const preview = shallowRef<{\n field: string\n width: number\n rendered: number\n } | null>(null)\n let drag: Drag | null = null\n\n const isResizable = (column: Column) =>\n options.resizable() && column.resizable !== false\n\n /** The width the header shows: the preview while dragging, else measured. */\n const widthOf = (column: Column) =>\n preview.value?.field === column.field\n ? preview.value.rendered\n : Math.round(options.measuredWidth(column.field) ?? 0)\n\n /** Emits the declared width `width`, unless it is the declared `from`. */\n const commit = (column: Column, from: number, width: number) => {\n const next = clampWidth(column, width)\n if (next !== Math.round(from)) {\n options.emit({ field: column.field, width: next })\n }\n }\n\n /** The declared width that draws the column where the pointer is. */\n const dragged = (current: Drag) =>\n current.scale.declared(\n current.startWidth +\n edgeOf(current.column) * (current.lastX - current.startX)\n )\n\n const end = (apply: boolean) => {\n const current = drag\n if (current) {\n drag = null\n cancelAnimationFrame(current.frame)\n preview.value = null\n if (apply) {\n commit(\n current.column,\n current.scale.declared(current.startWidth),\n dragged(current)\n )\n }\n }\n }\n\n /** Every pointer event of a handle; one listener for the whole drag. */\n const onPointer = (event: PointerEvent, column: Column) => {\n if (event.type === 'pointerdown') {\n const th = cellOf(event)\n if (event.button !== 0 || drag || !th) {\n return\n }\n const handle = event.currentTarget as HTMLElement\n // No text selection and no focus ring flicker while dragging.\n event.preventDefault()\n handle.focus({ preventScroll: true })\n handle.setPointerCapture(event.pointerId)\n drag = {\n column,\n pointerId: event.pointerId,\n startX: event.clientX,\n startWidth: th.getBoundingClientRect().width,\n scale: scaleOf(th, column),\n lastX: event.clientX,\n frame: 0\n }\n return\n }\n if (!drag || event.pointerId !== drag.pointerId) {\n return\n }\n drag.lastX = event.clientX\n if (event.type === 'pointermove') {\n // One preview per frame, whatever the pointer rate (no layout thrash).\n drag.frame ||= requestAnimationFrame(() => {\n if (drag) {\n drag.frame = 0\n const width = clampWidth(drag.column, dragged(drag))\n preview.value = {\n field: drag.column.field,\n width,\n rendered: Math.round(drag.scale.rendered(width))\n }\n }\n })\n } else {\n // pointerup commits; pointercancel and a lost capture cancel.\n end(event.type === 'pointerup')\n }\n }\n\n /**\n * Arrow keys step the drawn width, Enter fits it to the content (the\n * declared width `measureColumnWidths` gives, as it is).\n */\n const onKey = (event: KeyboardEvent, column: Column) => {\n const { key } = event\n if (drag) {\n if (key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n end(false)\n }\n return\n }\n const sign =\n (key === 'ArrowRight' ? 1 : key === 'ArrowLeft' ? -1 : 0) * edgeOf(column)\n const th = cellOf(event)\n if (th && (sign || key === 'Enter' || event.type === 'dblclick')) {\n event.preventDefault()\n const drawn = th.getBoundingClientRect().width\n const scale = scaleOf(th, column)\n const from = scale.declared(drawn)\n const step = scale.declared(\n Math.round(drawn) + sign * (event.shiftKey ? 50 : 10)\n )\n // A step moves at least one declared pixel, however stretched the\n // table. Autofit is the width `measureColumnWidths` gives (C-50, C-99),\n // with the filter row as a floor as for `autoWidth` (C-100); a column\n // that measures nothing (the table not displayed) stays.\n const to = sign\n ? from + sign * Math.max(1, Math.abs(step - from))\n : measureColumnWidths(\n th.closest('table'),\n [column.field],\n options.body(),\n { filters: true }\n )[column.field]\n if (to !== undefined) {\n commit(column, from, to)\n }\n }\n }\n\n /**\n * The listeners of one handle, as one `v-on` object made once per handle.\n * Pointer capture sends every drag event to the handle itself.\n */\n const listeners = (column: () => Column) => {\n const pointer = (event: PointerEvent) => {\n onPointer(event, column())\n }\n const key = (event: Event) => {\n onKey(event as KeyboardEvent, column())\n }\n return {\n pointerdown: pointer,\n pointermove: pointer,\n pointerup: pointer,\n pointercancel: pointer,\n lostpointercapture: pointer,\n keydown: key,\n dblclick: key,\n // The handle sits inside the header cell: a click never sorts.\n click: (event: Event) => {\n event.stopPropagation()\n }\n }\n }\n\n /** `aria-valuemax`: `maxWidth`, or else the table width (what can show). */\n const maxOf = (column: Column) =>\n maxWidthOf(column) ??\n Math.max(widthOf(column), Math.round(options.tableWidth()))\n\n onBeforeUnmount(() => {\n if (drag) {\n cancelAnimationFrame(drag.frame)\n drag = null\n }\n })\n\n return { preview, isResizable, widthOf, maxOf, listeners }\n}\n\nexport type ColumnResize = ReturnType<typeof useColumnResize>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { minWidthOf } from '../resize/use-column-resize'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { resize, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = resize.listeners(() => props.column)\n</script>\n\n<template>\n <!-- A focusable vertical separator (C-48): the value is the column width in\n pixels, from `minWidth` to `maxWidth` (or the table width). -->\n <div\n class=\"qt-resize-handle\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n :aria-label=\"labels().resizeColumn(columnName(column))\"\n :aria-valuenow=\"resize.widthOf(column)\"\n :aria-valuemin=\"minWidthOf(column)\"\n :aria-valuemax=\"resize.maxOf(column)\"\n v-on=\"on\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { minWidthOf } from '../resize/use-column-resize'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { resize, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = resize.listeners(() => props.column)\n</script>\n\n<template>\n <!-- A focusable vertical separator (C-48): the value is the column width in\n pixels, from `minWidth` to `maxWidth` (or the table width). -->\n <div\n class=\"qt-resize-handle\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n :aria-label=\"labels().resizeColumn(columnName(column))\"\n :aria-valuenow=\"resize.widthOf(column)\"\n :aria-valuemin=\"minWidthOf(column)\"\n :aria-valuemax=\"resize.maxOf(column)\"\n v-on=\"on\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport type { Column, SortDirection } from '../contract'\n\ndefineProps<{\n column: Column\n /** The direction the table is sorted in on this column, if any. */\n direction: SortDirection | null\n}>()\n\ndefineEmits<{ click: [] }>()\n</script>\n\n<template>\n <button\n type=\"button\"\n class=\"qt-sort\"\n :aria-label=\"column.title ? undefined : column.field\"\n @click=\"$emit('click')\"\n >\n {{ column.title }}\n <svg\n v-if=\"direction === 'asc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3.5L12.5 9.5H3.5L8 3.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else-if=\"direction === 'desc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 12.5L3.5 6.5H12.5L8 12.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3L11.5 7H4.5L8 3Z\" fill=\"currentColor\" />\n <path d=\"M8 13L4.5 9H11.5L8 13Z\" fill=\"currentColor\" />\n </svg>\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column, SortDirection } from '../contract'\n\ndefineProps<{\n column: Column\n /** The direction the table is sorted in on this column, if any. */\n direction: SortDirection | null\n}>()\n\ndefineEmits<{ click: [] }>()\n</script>\n\n<template>\n <button\n type=\"button\"\n class=\"qt-sort\"\n :aria-label=\"column.title ? undefined : column.field\"\n @click=\"$emit('click')\"\n >\n {{ column.title }}\n <svg\n v-if=\"direction === 'asc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3.5L12.5 9.5H3.5L8 3.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else-if=\"direction === 'desc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 12.5L3.5 6.5H12.5L8 12.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3L11.5 7H4.5L8 3Z\" fill=\"currentColor\" />\n <path d=\"M8 13L4.5 9H11.5L8 13Z\" fill=\"currentColor\" />\n </svg>\n </button>\n</template>\n","import type { SortDirection } from '../contract'\n\n/** Value of the `aria-sort` attribute for a direction. */\nexport const ariaSort = (direction: SortDirection | null) =>\n direction === 'asc'\n ? 'ascending'\n : direction === 'desc'\n ? 'descending'\n : undefined\n","<script setup lang=\"ts\">\nimport { rulesOf } from '@dolusoft/query-protocol'\nimport { computed, nextTick } from 'vue'\n\nimport type {\n Column,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n HeaderSlotProps,\n Query\n} from '../contract'\nimport FilterCell from './filter-cell.vue'\nimport ReorderHandle from './reorder-handle.vue'\nimport ResizeHandle from './resize-handle.vue'\nimport SortButton from './sort-button.vue'\nimport { sideOf } from '../columns/column-layout'\nimport { columnTypeOf } from '../core/column'\nimport { useTableContext } from '../core/table-context'\nimport { focusFirstFilter } from '../filter/focus-filter'\nimport { pinAttrs, utilityKey, type Utility } from '../pin/pin'\nimport { ariaSort } from '../sort/sort'\n\nconst props = defineProps<{\n /** Columns to draw: hidden ones dropped, pinned left first, pinned right last. */\n columns: Column[]\n query: Query\n filterable: boolean\n /** Utility cells before the columns, in order. */\n utilities: Utility[]\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** Automatic width of each column without a width, by `field` (C-100). */\n autoWidths: Readonly<Record<string, number>>\n /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), one per line: a field name may hold a space, never a\n * line break. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n /** Draws the consumer's `header-<field>` slot for `column`. */\n header?(props: HeaderSlotProps): unknown\n}>()\n\nconst given = (name: string) => props.slotNames.split('\\n').includes(name)\n\nconst { filters, sort, layout, resize, reorder, selection, labels } =\n useTableContext()\n\n// C-73: the drag preview is attributes only; nothing moves until release.\nconst dragAttrs = (column: Column) => {\n const drag = reorder.dragging.value\n return {\n 'data-dragging': drag?.field === column.field ? '' : undefined,\n 'data-drop': drag?.target === column.field ? drag.place : undefined\n }\n}\n\n// A computed: the header re-renders when the answer changes, not with every\n// pending filter draft.\nconst canClearAll = computed(() => filters.canClearAll())\n\n// C-22: a disabled button drops the focus to the page. When the button holds\n// the focus, a click with `detail` 0 (a key, `element.click()`, some\n// assistive technologies) activates it and the update that clear causes\n// disables it, the focus goes to the first filter instead. A pointer click\n// is left alone, so a touch screen opens no keyboard; nothing else (the\n// `toolbar` slot's `clearFilters()`, a later query) moves the focus.\nconst onClearAll = async (event: MouseEvent) => {\n const button = event.currentTarget as HTMLButtonElement\n const doc = button.ownerDocument\n const keyed = event.detail === 0 && doc.activeElement === button\n filters.clearAll()\n if (!keyed) {\n return\n }\n // The clear queued the re-render that disables the button, or keeps it\n // enabled when the consumer's query keeps a filter.\n await nextTick()\n const active = doc.activeElement\n if (\n button.disabled &&\n (active === button || active === doc.body || active === null)\n ) {\n focusFirstFilter(button.closest('table'))\n }\n}\n\nconst isFiltered = (column: Column) =>\n rulesOf(props.query.filters, column.field).length > 0\n\nconst hasFilter = (column: Column) =>\n props.filterable && column.filterable !== false\n\n// The first utility hosts the clear-all button (C-22); the selection column\n// holds its select-all checkbox instead.\nconst hostsClearAll = (utility: Utility) =>\n props.filterable &&\n utility === props.utilities.find(candidate => candidate !== 'select')\n\nconst utilityAttrs = (utility: Utility) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\n\n// The only inline styles of a header cell: the column width (or the drag\n// preview, C-49, or the automatic width, C-100) and the pin offset (C-47,\n// C-71), with `data-pinned`.\nconst widthOf = (column: Column) => {\n if (column.width) {\n return column.width\n }\n const auto = props.autoWidths[column.field]\n return auto === undefined ? undefined : `${auto}px`\n}\n\nconst cellAttrs = (column: Column) => {\n const preview = resize.preview.value\n return pinAttrs(\n sideOf(column),\n props.offsets[column.field],\n preview?.field === column.field ? `${preview.width}px` : widthOf(column)\n )\n}\n\nconst headerSlotProps = (column: Column): HeaderSlotProps => ({\n column,\n sortDirection: sort.sortOf(column),\n sortable: sort.isSortable(column),\n toggleSort: () => {\n sort.sortBy(column)\n },\n control: layout.controlOf(column.field)\n})\n</script>\n\n<template>\n <tr :role=\"roles ? 'row' : undefined\">\n <!-- A utility header cell labels nothing; it is a `th` only when it holds\n the clear-all button, and an empty `td` otherwise (C-45). -->\n <template v-for=\"utility in utilities\" :key=\"utility\">\n <th\n v-if=\"utility === 'select'\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <input\n type=\"checkbox\"\n class=\"qt-select-all\"\n :aria-label=\"labels().selectAllRows\"\n :checked=\"selection.allSelected.value\"\n :indeterminate=\"selection.someSelected.value\"\n @change=\"\n selection.toggleAll(($event.target as HTMLInputElement).checked)\n \"\n />\n </th>\n <td\n v-else-if=\"!hostsClearAll(utility)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n />\n <th\n v-else\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <button\n type=\"button\"\n class=\"qt-clear-all-button\"\n :title=\"labels().clearAllFilters\"\n :aria-label=\"labels().clearAllFilters\"\n :disabled=\"!canClearAll\"\n @click.stop=\"onClearAll\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </th>\n </template>\n <th\n v-for=\"column in columns\"\n :key=\"column.field\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n :data-field=\"column.field\"\n :data-type=\"columnTypeOf(column)\"\n :data-sort=\"sort.sortOf(column) ?? undefined\"\n :data-sortable=\"sort.isSortable(column) ? '' : undefined\"\n :data-filtered=\"isFiltered(column) ? '' : undefined\"\n :aria-sort=\"ariaSort(sort.sortOf(column))\"\n v-bind=\"{ ...cellAttrs(column), ...dragAttrs(column) }\"\n >\n <!-- C-73: the reorder handle is the first child, the resize handle the last. -->\n <reorder-handle v-if=\"reorder.isReorderable(column)\" :column=\"column\" />\n <!-- C-51: the header slot replaces the label only. -->\n <slot\n v-if=\"given(`header-${column.field}`)\"\n name=\"header\"\n v-bind=\"headerSlotProps(column)\"\n />\n <sort-button\n v-else-if=\"sort.isSortable(column)\"\n :column=\"column\"\n :direction=\"sort.sortOf(column)\"\n @click=\"sort.sortBy(column)\"\n />\n <span v-else class=\"qt-title\">{{ column.title }}</span>\n <filter-cell\n v-if=\"hasFilter(column)\"\n :column=\"column\"\n :type=\"columnTypeOf(column)\"\n :query=\"query\"\n >\n <template v-if=\"given('filter-datetime')\" #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template v-if=\"given('filter-menu')\" #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </filter-cell>\n <resize-handle v-if=\"resize.isResizable(column)\" :column=\"column\" />\n </th>\n </tr>\n</template>\n","<script setup lang=\"ts\">\nimport { rulesOf } from '@dolusoft/query-protocol'\nimport { computed, nextTick } from 'vue'\n\nimport type {\n Column,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n HeaderSlotProps,\n Query\n} from '../contract'\nimport FilterCell from './filter-cell.vue'\nimport ReorderHandle from './reorder-handle.vue'\nimport ResizeHandle from './resize-handle.vue'\nimport SortButton from './sort-button.vue'\nimport { sideOf } from '../columns/column-layout'\nimport { columnTypeOf } from '../core/column'\nimport { useTableContext } from '../core/table-context'\nimport { focusFirstFilter } from '../filter/focus-filter'\nimport { pinAttrs, utilityKey, type Utility } from '../pin/pin'\nimport { ariaSort } from '../sort/sort'\n\nconst props = defineProps<{\n /** Columns to draw: hidden ones dropped, pinned left first, pinned right last. */\n columns: Column[]\n query: Query\n filterable: boolean\n /** Utility cells before the columns, in order. */\n utilities: Utility[]\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** Automatic width of each column without a width, by `field` (C-100). */\n autoWidths: Readonly<Record<string, number>>\n /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), one per line: a field name may hold a space, never a\n * line break. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n /** Draws the consumer's `header-<field>` slot for `column`. */\n header?(props: HeaderSlotProps): unknown\n}>()\n\nconst given = (name: string) => props.slotNames.split('\\n').includes(name)\n\nconst { filters, sort, layout, resize, reorder, selection, labels } =\n useTableContext()\n\n// C-73: the drag preview is attributes only; nothing moves until release.\nconst dragAttrs = (column: Column) => {\n const drag = reorder.dragging.value\n return {\n 'data-dragging': drag?.field === column.field ? '' : undefined,\n 'data-drop': drag?.target === column.field ? drag.place : undefined\n }\n}\n\n// A computed: the header re-renders when the answer changes, not with every\n// pending filter draft.\nconst canClearAll = computed(() => filters.canClearAll())\n\n// C-22: a disabled button drops the focus to the page. When the button holds\n// the focus, a click with `detail` 0 (a key, `element.click()`, some\n// assistive technologies) activates it and the update that clear causes\n// disables it, the focus goes to the first filter instead. A pointer click\n// is left alone, so a touch screen opens no keyboard; nothing else (the\n// `toolbar` slot's `clearFilters()`, a later query) moves the focus.\nconst onClearAll = async (event: MouseEvent) => {\n const button = event.currentTarget as HTMLButtonElement\n const doc = button.ownerDocument\n const keyed = event.detail === 0 && doc.activeElement === button\n filters.clearAll()\n if (!keyed) {\n return\n }\n // The clear queued the re-render that disables the button, or keeps it\n // enabled when the consumer's query keeps a filter.\n await nextTick()\n const active = doc.activeElement\n if (\n button.disabled &&\n (active === button || active === doc.body || active === null)\n ) {\n focusFirstFilter(button.closest('table'))\n }\n}\n\nconst isFiltered = (column: Column) =>\n rulesOf(props.query.filters, column.field).length > 0\n\nconst hasFilter = (column: Column) =>\n props.filterable && column.filterable !== false\n\n// The first utility hosts the clear-all button (C-22); the selection column\n// holds its select-all checkbox instead.\nconst hostsClearAll = (utility: Utility) =>\n props.filterable &&\n utility === props.utilities.find(candidate => candidate !== 'select')\n\nconst utilityAttrs = (utility: Utility) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\n\n// The only inline styles of a header cell: the column width (or the drag\n// preview, C-49, or the automatic width, C-100) and the pin offset (C-47,\n// C-71), with `data-pinned`.\nconst widthOf = (column: Column) => {\n if (column.width) {\n return column.width\n }\n const auto = props.autoWidths[column.field]\n return auto === undefined ? undefined : `${auto}px`\n}\n\nconst cellAttrs = (column: Column) => {\n const preview = resize.preview.value\n return pinAttrs(\n sideOf(column),\n props.offsets[column.field],\n preview?.field === column.field ? `${preview.width}px` : widthOf(column)\n )\n}\n\nconst headerSlotProps = (column: Column): HeaderSlotProps => ({\n column,\n sortDirection: sort.sortOf(column),\n sortable: sort.isSortable(column),\n toggleSort: () => {\n sort.sortBy(column)\n },\n control: layout.controlOf(column.field)\n})\n</script>\n\n<template>\n <tr :role=\"roles ? 'row' : undefined\">\n <!-- A utility header cell labels nothing; it is a `th` only when it holds\n the clear-all button, and an empty `td` otherwise (C-45). -->\n <template v-for=\"utility in utilities\" :key=\"utility\">\n <th\n v-if=\"utility === 'select'\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <input\n type=\"checkbox\"\n class=\"qt-select-all\"\n :aria-label=\"labels().selectAllRows\"\n :checked=\"selection.allSelected.value\"\n :indeterminate=\"selection.someSelected.value\"\n @change=\"\n selection.toggleAll(($event.target as HTMLInputElement).checked)\n \"\n />\n </th>\n <td\n v-else-if=\"!hostsClearAll(utility)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n />\n <th\n v-else\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <button\n type=\"button\"\n class=\"qt-clear-all-button\"\n :title=\"labels().clearAllFilters\"\n :aria-label=\"labels().clearAllFilters\"\n :disabled=\"!canClearAll\"\n @click.stop=\"onClearAll\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </th>\n </template>\n <th\n v-for=\"column in columns\"\n :key=\"column.field\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n :data-field=\"column.field\"\n :data-type=\"columnTypeOf(column)\"\n :data-sort=\"sort.sortOf(column) ?? undefined\"\n :data-sortable=\"sort.isSortable(column) ? '' : undefined\"\n :data-filtered=\"isFiltered(column) ? '' : undefined\"\n :aria-sort=\"ariaSort(sort.sortOf(column))\"\n v-bind=\"{ ...cellAttrs(column), ...dragAttrs(column) }\"\n >\n <!-- C-73: the reorder handle is the first child, the resize handle the last. -->\n <reorder-handle v-if=\"reorder.isReorderable(column)\" :column=\"column\" />\n <!-- C-51: the header slot replaces the label only. -->\n <slot\n v-if=\"given(`header-${column.field}`)\"\n name=\"header\"\n v-bind=\"headerSlotProps(column)\"\n />\n <sort-button\n v-else-if=\"sort.isSortable(column)\"\n :column=\"column\"\n :direction=\"sort.sortOf(column)\"\n @click=\"sort.sortBy(column)\"\n />\n <span v-else class=\"qt-title\">{{ column.title }}</span>\n <filter-cell\n v-if=\"hasFilter(column)\"\n :column=\"column\"\n :type=\"columnTypeOf(column)\"\n :query=\"query\"\n >\n <template v-if=\"given('filter-datetime')\" #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template v-if=\"given('filter-menu')\" #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </filter-cell>\n <resize-handle v-if=\"resize.isResizable(column)\" :column=\"column\" />\n </th>\n </tr>\n</template>\n","<script setup lang=\"ts\">\nimport type { PaginationSlotProps } from '../contract'\n\ndefineProps<{ paginationProps: PaginationSlotProps }>()\n\ndefineSlots<{ pagination(props: PaginationSlotProps): unknown }>()\n</script>\n\n<template>\n <div class=\"qt-pagination\">\n <slot name=\"pagination\" v-bind=\"paginationProps\" />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { PaginationSlotProps } from '../contract'\n\ndefineProps<{ paginationProps: PaginationSlotProps }>()\n\ndefineSlots<{ pagination(props: PaginationSlotProps): unknown }>()\n</script>\n\n<template>\n <div class=\"qt-pagination\">\n <slot name=\"pagination\" v-bind=\"paginationProps\" />\n </div>\n</template>\n","import {\n nextTick,\n onBeforeUnmount,\n shallowRef,\n watch,\n type ShallowRef\n} from 'vue'\n\nimport type { PinSide } from '../columns/column-layout'\n\n/** A drawn header cell, in order: its key (`field`, or the utility) and side. */\ninterface HeaderCellKey {\n key: string\n side: PinSide\n}\n\nexport interface HeaderGeometryOptions {\n /** The `table` element once it is mounted. */\n table: ShallowRef<HTMLTableElement | null>\n /** The header cells as drawn: utilities first, then the columns. */\n cells: () => HeaderCellKey[]\n /**\n * Some column is pinned on either side (C-46, C-71) or has a resize handle\n * (C-48), or the body is a table of its own (`scrollBody`, C-101).\n */\n active: () => boolean\n}\n\ntype Numbers = Readonly<Record<string, number>>\n\n/** One string per map: compares two maps in one step. */\nconst signature = (numbers: Numbers | readonly number[]) =>\n JSON.stringify(numbers)\n\n/**\n * Measured header geometry (C-47, C-48, C-71): the rendered width of every\n * header cell and, for the pinned cells, the cumulative offset: from the left\n * for a left-pinned cell (`--qt-pin-left`), from the right for a\n * right-pinned one (`--qt-pin-right`). One `ResizeObserver` watches the header cells and the\n * table; it reports width changes from any cause (a resize, a font that\n * loads, a container that narrows) in one batched callback, after layout, so\n * reading the cells there forces no extra layout. The observer is rebuilt\n * only when the drawn cells change, not when a width does. Nothing is\n * measured while inactive, and the observer is disconnected on unmount.\n */\nexport const useHeaderGeometry = (options: HeaderGeometryOptions) => {\n /** Rendered width of each header cell, by key. */\n const widths = shallowRef<Numbers>({})\n /** Rendered width of the table. */\n const tableWidth = shallowRef(0)\n /**\n * `--qt-pin-left` of each left-pinned cell and `--qt-pin-right` of each\n * right-pinned one, by key, in pixels.\n */\n const offsets = shallowRef<Numbers>({})\n /**\n * The exact width of every header cell, in drawing order: the `col` widths\n * of the body and footer tables with `scrollBody` (C-101).\n */\n const columns = shallowRef<readonly number[]>([])\n let observer: ResizeObserver | null = null\n\n const headerCells = (table: HTMLTableElement) =>\n table.querySelectorAll(':scope > thead > tr > *')\n\n const measure = (table: HTMLTableElement) => {\n // `widths` and `tableWidth` are whole pixels: they are reported (resize\n // handle, `aria-valuenow`) and compared, and sub-pixel noise from live\n // content would rewrite them for nothing.\n tableWidth.value = Math.round(table.getBoundingClientRect().width)\n const cells = options.cells()\n const next: Record<string, number> = {}\n const nextOffsets: Record<string, number> = {}\n const rights: Array<[string, number]> = []\n const nextColumns: number[] = []\n let left = 0\n headerCells(table).forEach((cell, index) => {\n const drawn = cells[index]\n if (drawn) {\n const exact = cell.getBoundingClientRect().width\n nextColumns.push(exact)\n next[drawn.key] = Math.round(exact)\n // The offsets add up the exact widths. A cell is drawn at a fractional\n // width (a percentage, a collapsed border), so summing rounded widths\n // drifts: a pinned cell then stops short of its neighbour (a gap the\n // scrolled content shows through) or over it.\n if (drawn.side === 'left') {\n nextOffsets[drawn.key] = left\n left += exact\n } else if (drawn.side === 'right') {\n rights.push([drawn.key, exact])\n }\n }\n })\n // Right offsets add up from the right edge: the last cell is at 0.\n let right = 0\n for (let i = rights.length - 1; i >= 0; i--) {\n const [key, width] = rights[i]\n nextOffsets[key] = right\n right += width\n }\n // Only a real change re-renders the cells that read these.\n if (signature(next) !== signature(widths.value)) {\n widths.value = next\n }\n if (signature(nextOffsets) !== signature(offsets.value)) {\n offsets.value = nextOffsets\n }\n if (signature(nextColumns) !== signature(columns.value)) {\n columns.value = nextColumns\n }\n }\n\n const observe = () => {\n observer?.disconnect()\n observer = null\n const table = options.table.value\n if (!table || !options.active() || typeof ResizeObserver === 'undefined') {\n if (Object.keys(offsets.value).length > 0) {\n offsets.value = {}\n }\n if (columns.value.length > 0) {\n columns.value = []\n }\n return\n }\n const current = new ResizeObserver(() => {\n measure(table)\n })\n observer = current\n current.observe(table)\n headerCells(table).forEach(cell => {\n current.observe(cell)\n })\n measure(table)\n }\n\n // Re-observe once the drawn cells change (columns, order, pinning,\n // utilities), after they are rendered. A width written back does not\n // change this key, so it does not rebuild the observer.\n watch(\n [\n // A getter, not the ref: a shallow ref among the sources forces the\n // callback on every trigger, rebuilding the observer for nothing.\n () => options.table.value,\n options.active,\n () =>\n options\n .cells()\n .map(cell =>\n cell.side === 'left'\n ? `${cell.key}*`\n : cell.side === 'right'\n ? `${cell.key}>`\n : cell.key\n )\n .join('|')\n ],\n () => {\n void nextTick(observe)\n },\n { immediate: true, flush: 'post' }\n )\n\n onBeforeUnmount(() => {\n observer?.disconnect()\n observer = null\n })\n\n return { widths, tableWidth, offsets, columns }\n}\n","import {\n nextTick,\n onBeforeUnmount,\n shallowRef,\n watch,\n type ShallowRef\n} from 'vue'\n\nimport type { Column } from '../contract'\nimport type { QueryTableLayout } from '../use-query-table'\n\nexport interface ColumnReorderOptions {\n /** The `reorderable` prop: whether the table draws reorder handles. */\n reorderable: () => boolean\n /** The table element: drop targets and refocus look at its own header only. */\n table: ShallowRef<HTMLTableElement | null>\n layout: QueryTableLayout\n /** The `columns` prop: an outside change ends a drag (C-73). */\n columns: () => Column[]\n}\n\n/** What the header shows while a column is dragged (C-73). */\nexport interface ColumnDrag {\n field: string\n /** The header cell the column would be placed next to, if any. */\n target: string | null\n place: 'before' | 'after'\n}\n\ninterface Drag {\n field: string\n pointerId: number\n /** Visible header cells of the region at the start: field and box. */\n cells: Array<{ field: string; left: number; right: number }>\n}\n\nconst placeOf = (key: string) =>\n key === 'ArrowLeft' || key === 'Home' ? 'before' : 'after'\n\n/**\n * Reordering a column with its handle (C-73): a pointer drag or the arrow\n * keys, Home and End, inside the column's region. The table keeps only the\n * drag in progress (P15); the order itself goes out as `update:columns` and\n * comes back, if the consumer wants it, as the order of `columns`. Like the\n * resize handle, the handle captures the pointer, so every drag event\n * arrives at the handle itself, and it has the focus, so Escape does too.\n */\nexport const useColumnReorder = (options: ColumnReorderOptions) => {\n const dragging = shallowRef<ColumnDrag | null>(null)\n let drag: Drag | null = null\n /** The column whose handle moved it by key and still has the focus. */\n let refocus: string | null = null\n /** Between the new `columns` and their render: a blur then is the move's. */\n let patching = false\n\n const isReorderable = (column: Column) =>\n options.reorderable() && column.reorderable !== false\n\n /** This table's own header cell, never one of a nested table. */\n const headerCell = (field: string) =>\n options.table.value?.querySelector<HTMLElement>(\n `:scope > thead > tr > th[data-field=\"${CSS.escape(field)}\"]`\n ) ?? null\n\n const end = () => {\n drag = null\n dragging.value = null\n }\n\n /** Every pointer event of a handle; one listener for the whole drag. */\n const onPointer = (event: PointerEvent, column: Column) => {\n if (event.type === 'pointerdown') {\n if (event.button !== 0 || drag) {\n return\n }\n const handle = event.currentTarget as HTMLElement\n // No text selection while dragging; the handle takes the focus itself.\n event.preventDefault()\n handle.focus({ preventScroll: true })\n handle.setPointerCapture(event.pointerId)\n refocus = null\n drag = {\n field: column.field,\n pointerId: event.pointerId,\n cells: options.layout.regionOf(column.field).flatMap(field => {\n const box = headerCell(field)?.getBoundingClientRect()\n return box ? [{ field, left: box.left, right: box.right }] : []\n })\n }\n dragging.value = { field: column.field, target: null, place: 'after' }\n return\n }\n if (!drag || event.pointerId !== drag.pointerId) {\n return\n }\n if (event.type === 'pointermove') {\n const x = event.clientX\n const over = drag.cells.find(cell => x >= cell.left && x < cell.right)\n const target = over && over.field !== drag.field ? over.field : null\n const place =\n over && x < (over.left + over.right) / 2 ? 'before' : 'after'\n const current = dragging.value\n if (current?.target !== target || current.place !== place) {\n dragging.value = { field: drag.field, target, place }\n }\n return\n }\n // pointerup places the column; pointercancel and a lost capture cancel.\n const done = dragging.value\n end()\n if (event.type === 'pointerup' && done?.target) {\n options.layout.moveColumn(done.field, done.target, done.place)\n }\n }\n\n const onKey = (event: KeyboardEvent, column: Column) => {\n const { key } = event\n if (drag) {\n if (key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n end()\n }\n return\n }\n // Alt+Arrow, Ctrl+Home and the like keep their browser meaning.\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return\n }\n const region = options.layout.regionOf(column.field)\n const at = region.indexOf(column.field)\n const target =\n key === 'ArrowLeft'\n ? region[at - 1]\n : key === 'ArrowRight'\n ? region[at + 1]\n : key === 'Home'\n ? region[0]\n : key === 'End'\n ? region[region.length - 1]\n : undefined\n if (at < 0 || target === undefined) {\n return\n }\n event.preventDefault()\n if (target !== column.field) {\n refocus = column.field\n options.layout.moveColumn(column.field, target, placeOf(key))\n }\n }\n\n // New `columns`: an outside change ends a drag; a written-back order gives\n // the focus back to the moved column's handle, which a keyed move of its\n // header cell can drop.\n watch(options.columns, () => {\n patching = true\n })\n watch(\n options.columns,\n () => {\n patching = false\n if (drag) {\n end()\n }\n const field = refocus\n if (field !== null) {\n void nextTick(() => {\n const handle = headerCell(field)?.querySelector<HTMLElement>(\n ':scope > .qt-reorder-handle'\n )\n if (\n handle &&\n refocus === field &&\n document.activeElement !== handle\n ) {\n handle.focus({ preventScroll: true })\n }\n })\n }\n },\n { flush: 'post' }\n )\n\n onBeforeUnmount(end)\n\n /**\n * The listeners of one handle, as one `v-on` object made once per handle.\n * Pointer capture sends every drag event to the handle itself.\n */\n const listeners = (column: () => Column) => {\n const pointer = (event: Event) => {\n onPointer(event as PointerEvent, column())\n }\n return {\n pointerdown: pointer,\n pointermove: pointer,\n pointerup: pointer,\n pointercancel: pointer,\n lostpointercapture: pointer,\n keydown: (event: Event) => {\n onKey(event as KeyboardEvent, column())\n },\n // The user left the handle: nothing to give back. A blur while the\n // moved header renders is the move's, not the user's.\n blur: () => {\n if (!patching) {\n refocus = null\n }\n },\n // The handle sits inside the header cell: a click never sorts.\n click: (event: Event) => {\n event.stopPropagation()\n }\n }\n }\n\n return { isReorderable, dragging, listeners }\n}\n\nexport type ColumnReorder = ReturnType<typeof useColumnReorder>\n","import {\n cloneQuery,\n isCursorQuery,\n sameQuery,\n type Query\n} from '@dolusoft/query-protocol'\nimport type { RowsUpdate } from '@dolusoft/query-table-core/row-changes'\nimport { onBeforeUnmount, shallowRef, watch, type ShallowRef } from 'vue'\n\nimport type { Column } from '../contract'\nimport { measureColumnWidths } from './measure-widths'\nimport { clampWidth, limitOf } from './use-column-resize'\n\nexport interface AutoWidthOptions {\n /** The `autoWidth` prop. */\n enabled: () => boolean\n /** The `autoWidthMax` prop: the limit of a column without `maxWidth`. */\n max: () => number | undefined\n table: ShallowRef<HTMLTableElement | null>\n /** With `scrollBody`: the table of the body rows (C-101), else `null`. */\n body: () => HTMLTableElement | null\n /** The visible columns, as given. */\n columns: () => Column[]\n rows: () => readonly unknown[]\n query: () => Query\n rowsUpdate: () => RowsUpdate | undefined\n}\n\ntype Widths = Readonly<Record<string, number>>\n\n/**\n * The query without what moves inside one result: the paging position, the\n * page size and the sort. Two queries alike in the rest ask for the same\n * rows, in another order or slice (C-100).\n */\nconst resultOf = (query: Query): Query =>\n isCursorQuery(query)\n ? { ...query, cursor: null, pageSize: 0, sort: null }\n : { ...query, page: 1, pageSize: 0, sort: null }\n\nconst sameWidths = (a: Widths, b: Widths) => {\n const keys = Object.keys(a)\n return (\n keys.length === Object.keys(b).length &&\n keys.every(key => a[key] === b[key])\n )\n}\n\nconst none: Widths = Object.freeze({})\n\n/**\n * Automatic column widths (C-100, ADR 0014). With `autoWidth`, every visible\n * column without `Column.width` is measured (C-99) after the drawn rows\n * change, clamped as a resize is (C-49), and drawn at that width. The widths\n * are UI state (P2): never emitted, never written to `columns`, gone when\n * `autoWidth` is off or the column gets a width. Within one result (the query\n * apart from its paging position, page size and sort) they only grow, so a\n * page, a sort or a live tick never narrows a column.\n */\nexport const useAutoWidth = (options: AutoWidthOptions) => {\n const widths = shallowRef<Widths>(none)\n /** The result the widths were last measured for, `null` before one. */\n let result: Query | null = null\n /** The next measure starts over: the result moved before it could run. */\n let fromScratch = false\n /** A measure found the table not displayed: measure once it is. */\n let waiting = false\n let observer: ResizeObserver | null = null\n\n const autoColumns = () => options.columns().filter(column => !column.width)\n\n const clear = () => {\n widths.value = none\n result = null\n fromScratch = false\n waiting = false\n observer?.disconnect()\n observer = null\n }\n\n const measure = (rowsChanged: boolean) => {\n const table = options.table.value\n const columns = autoColumns()\n if (!table || columns.length === 0) {\n return\n }\n const query = options.query()\n const moved =\n result === null ||\n (rowsChanged &&\n (options.rowsUpdate() === 'reset' ||\n !sameQuery(resultOf(result), resultOf(query))))\n if (moved) {\n fromScratch = true\n result = cloneQuery(query)\n }\n if (options.rows().length === 0) {\n return\n }\n const measured = measureColumnWidths(\n table,\n columns.map(column => column.field),\n options.body(),\n // The filter row is a floor: a column never draws its filter\n // unusable (C-100).\n { filters: true }\n )\n if (Object.keys(measured).length === 0) {\n // Not displayed: nothing has a box. Keep what is drawn.\n waiting = true\n return\n }\n waiting = false\n const previous = widths.value\n const next: Record<string, number> = {}\n for (const column of columns) {\n const width = measured[column.field]\n if (width === undefined) {\n continue\n }\n const fitted = clampWidth(\n { ...column, maxWidth: limitOf(column.maxWidth) ?? options.max() },\n width\n )\n next[column.field] = fromScratch\n ? fitted\n : Math.max(fitted, previous[column.field] ?? 0)\n }\n fromScratch = false\n if (!sameWidths(next, previous)) {\n widths.value = next\n }\n }\n\n const observe = (table: HTMLTableElement | null) => {\n observer?.disconnect()\n observer = null\n if (!table || typeof ResizeObserver === 'undefined') {\n return\n }\n observer = new ResizeObserver(() => {\n if (waiting) {\n measure(false)\n }\n })\n observer.observe(table)\n }\n\n watch(\n [\n // Getters, not the refs: a shallow ref among the sources forces the\n // callback on every trigger.\n () => options.enabled(),\n () => options.max(),\n () => options.table.value,\n () => options.rows(),\n () =>\n autoColumns()\n .map(column => column.field)\n .join('|')\n ],\n // The first call gets `[]`: every old value is `undefined`.\n ([enabled, max, table, rows], [wasEnabled, oldMax, oldTable, oldRows]) => {\n if (!enabled) {\n if (wasEnabled) {\n clear()\n }\n return\n }\n if (!wasEnabled || max !== oldMax) {\n fromScratch = true\n }\n if (table !== oldTable || !wasEnabled) {\n observe(table)\n }\n measure(rows !== oldRows)\n },\n { immediate: true, flush: 'post' }\n )\n\n onBeforeUnmount(() => {\n observer?.disconnect()\n observer = null\n })\n\n return { widths }\n}\n","import { onBeforeUnmount, watch } from 'vue'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n// A try/catch keeps the constant replacement in production builds.\nconst isDevelopment = (): boolean => {\n try {\n return process.env.NODE_ENV !== 'production'\n } catch {\n return true\n }\n}\n\n/** The wrappers of `scrollBody`, `null` while not drawn. */\ninterface ScrollBodyWrappers {\n head: HTMLElement | null\n body: HTMLElement | null\n foot: HTMLElement | null\n}\n\nexport interface ScrollBodyOptions {\n /** The `scrollBody` prop. */\n enabled: () => boolean\n wrappers: () => ScrollBodyWrappers\n /** The table of the header cells, whose widths the body takes. */\n headTable: () => HTMLTableElement | null\n /** The table of the body rows: its layout is checked (C-101). */\n bodyTable: () => HTMLTableElement | null\n /** The `col` widths written to the body table, in pixels. */\n colWidths: () => readonly (number | undefined)[]\n /** Changes when the body rows do: their content can widen a column. */\n rows: () => unknown\n}\n\nconst automaticLayout =\n '[QueryTable] `scrollBody`: the body table has the automatic layout, so its columns follow its rows, not the header. Give the body and footer tables `table-layout: fixed` and a width that is a length or a percentage, such as `width: 100%`: with `width: auto` or `max-content` the browser uses the automatic layout whatever `table-layout` says (C-101).'\n\n/**\n * Header, body and footer of `scrollBody` scroll sideways together (C-101):\n * one passive `scroll` listener on each wrapper sets the `scrollLeft` of the\n * others to its own. A position written here is remembered, so the `scroll`\n * event it fires is not taken for one of the user's. The table writes no\n * style and no attribute to the wrappers. Off, nothing is listened to.\n */\nexport const useScrollBody = (options: ScrollBodyOptions) => {\n let attached: HTMLElement[] = []\n /** The `scrollLeft` this table wrote to a wrapper, until its event. */\n const written = new WeakMap<HTMLElement, number>()\n let warned = false\n let clamped = false\n\n /** Every wrapper but `source` to `left`, remembering what was written. */\n const follow = (source: HTMLElement, left: number) => {\n for (const element of attached) {\n if (element !== source && element.scrollLeft !== left) {\n element.scrollLeft = left\n written.set(element, element.scrollLeft)\n // A header or footer that stops short of the body: its scroll range\n // lacks the body's vertical scrollbar, and its columns end shifted.\n if (\n !clamped &&\n source === options.wrappers().body &&\n left - element.scrollLeft >= 1 &&\n isDevelopment()\n ) {\n clamped = true\n console.warn(\n '[QueryTable] `scrollBody`: `.qt-table-head` or `.qt-table-foot` cannot scroll sideways as far as `.qt-table-body`, so its columns end shifted. Give it a vertical scrollbar as wide as that of the body (`overflow-y: scroll`; a transparent `scrollbar-color` hides it) (C-101).'\n )\n }\n }\n }\n }\n\n const onScroll = (event: Event) => {\n const source = event.currentTarget as HTMLElement\n const left = source.scrollLeft\n const echo = written.get(source)\n written.delete(source)\n if (echo !== left) {\n follow(source, left)\n }\n }\n\n const detach = () => {\n for (const element of attached) {\n element.removeEventListener('scroll', onScroll)\n }\n attached = []\n }\n\n watch(\n () => (options.enabled() ? options.wrappers() : null),\n wrappers => {\n detach()\n if (!wrappers) {\n return\n }\n attached = [wrappers.head, wrappers.body, wrappers.foot].filter(\n (element): element is HTMLElement => element !== null\n )\n for (const element of attached) {\n element.addEventListener('scroll', onScroll, { passive: true })\n }\n // A wrapper drawn later (a footer) starts where the body is.\n if (wrappers.body) {\n follow(wrappers.body, wrappers.body.scrollLeft)\n }\n const table = options.bodyTable()\n if (\n table &&\n !warned &&\n isDevelopment() &&\n getComputedStyle(table).tableLayout !== 'fixed'\n ) {\n warned = true\n console.warn(automaticLayout)\n }\n },\n { flush: 'post', immediate: true }\n )\n\n /**\n * `table-layout: fixed` applies only to a table with a definite width:\n * under `width: auto` or `max-content` the browser lays the body out\n * automatically while `tableLayout` still reads `fixed`, and a cell wider\n * than its `col` widens its column and the table. That shows once the\n * rows hold such a cell, so it is checked whenever the rows or the `col`\n * widths change, against `col` widths that match the header cells (not\n * ones a change of the drawn columns has made stale until measured).\n */\n const checkLayout = () => {\n const head = options.headTable()\n const body = options.bodyTable()\n if (warned || !head || !body) {\n return\n }\n const cells = head.querySelectorAll(':scope > thead > tr > *')\n const widths = options.colWidths()\n if (\n cells.length === 0 ||\n cells.length !== widths.length ||\n [...cells].some((cell, i) => {\n const width = widths[i]\n return (\n width === undefined ||\n Math.abs(cell.getBoundingClientRect().width - width) >= 0.5\n )\n })\n ) {\n return\n }\n if (\n body.getBoundingClientRect().width - head.getBoundingClientRect().width >=\n 1\n ) {\n warned = true\n console.warn(automaticLayout)\n }\n }\n\n if (isDevelopment()) {\n watch(\n () =>\n options.enabled()\n ? [options.colWidths(), options.rows(), options.bodyTable()]\n : null,\n sources => {\n if (sources) {\n checkLayout()\n }\n },\n { flush: 'post' }\n )\n }\n\n onBeforeUnmount(detach)\n}\n","// useQueryTable (K4): the state of a Query Table without its markup. A\n// TanStack table (`@tanstack/vue-table`) with the two plugins of\n// `@dolusoft/query-table-core`, and the actions the parts of `QueryTable`\n// call. `QueryTable` is built on it and holds no state logic of its own.\n//\n// The consumer owns every lasting value (P2): the query, the selection and\n// the column layout (visibility, order, pinning, widths) arrive as options\n// and changes leave as callbacks. The TanStack slices are projections of the\n// query (ADR 0004) and of the columns (ADR 0007); what the table\n// keeps is short-lived: typed filter and search text, and which rows are\n// expanded (TanStack's `expanded` slice, P15).\nimport {\n columnTypeOf,\n type FilterDraft,\n isCursorQuery,\n type Query,\n searchOf\n} from '@dolusoft/query-protocol'\nimport {\n dispose,\n type FilterLabel,\n filterInputFeature,\n projectServerQuery,\n serverQueryFeature\n} from '@dolusoft/query-table-core'\nimport {\n columnFilteringFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnVisibilityFeature,\n functionalUpdate,\n globalFilteringFeature,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n type Row,\n tableFeatures,\n type Updater,\n useTable,\n type VueTable\n} from '@tanstack/vue-table'\nimport {\n computed,\n type ComputedRef,\n type MaybeRefOrGetter,\n onScopeDispose,\n shallowRef,\n toValue,\n watch\n} from 'vue'\n\nimport {\n applyOrder,\n applyPinning,\n applyVisibility,\n moveField,\n sideOf\n} from './columns/column-layout'\nimport type {\n Column,\n ColumnChangeReason,\n ColumnControl,\n FilterCondition,\n PageCursors,\n PaginationSlotProps,\n QueryChangeReason,\n RowPinning,\n RowSelection,\n SortDirection,\n TableProps,\n TableQuery\n} from './contract'\nimport { valueAt } from './core/column'\n\n/** The TanStack features of a Query Table, the two plugins included. */\nconst features = tableFeatures({\n rowSortingFeature,\n rowPaginationFeature,\n columnFilteringFeature,\n globalFilteringFeature,\n rowSelectionFeature,\n rowExpandingFeature,\n // K31-5: registered always; projections of `columns` (ADR 0007).\n columnVisibilityFeature,\n columnOrderingFeature,\n // D3: start = left, end = right; order and region only, offsets are\n // measured by the table, not computed from sizes.\n columnPinningFeature,\n // C-74: controlled by `rowPinning`; on only with `rowKey`.\n rowPinningFeature,\n serverQueryFeature,\n filterInputFeature\n})\n\nexport type QueryTableFeatures = typeof features\n\n/** Identity of a row: a property name or a function (see `TableProps.rowKey`). */\nexport type RowKey<T extends object> = TableProps<T>['rowKey']\n\nexport interface UseQueryTableOptions<\n T extends object,\n Q extends Query = TableQuery\n> {\n /** The query the table shows. The consumer owns it. */\n query: MaybeRefOrGetter<Q>\n /** Column definitions, hidden ones included. Never mutated. */\n columns: MaybeRefOrGetter<Column[]>\n /** Rows of the current page. Defaults to none. */\n rows?: MaybeRefOrGetter<T[] | undefined>\n /** Rows on the server, `null` when unknown. */\n totalRows?: MaybeRefOrGetter<number | null | undefined>\n /** Cursor mode: the cursors of the page shown (C-56). */\n cursors?: MaybeRefOrGetter<PageCursors | null | undefined>\n /** Allow sorting (needs column `sortable`). Defaults to `false`. */\n sortable?: MaybeRefOrGetter<boolean | undefined>\n /** Milliseconds before typed filter text is applied. Defaults to `100`. */\n filterDebounce?: MaybeRefOrGetter<number | undefined>\n /** Milliseconds before typed search text is applied. Defaults to `300`. */\n searchDebounce?: MaybeRefOrGetter<number | undefined>\n /** The selected rows; `undefined` turns selection off. */\n selection?: MaybeRefOrGetter<RowSelection | undefined>\n /**\n * The pinned rows (C-74); `undefined`, or no `rowKey`, turns row pinning\n * off.\n */\n rowPinning?: MaybeRefOrGetter<RowPinning | undefined>\n /** Identity of a row. Without it the row index is the identity. */\n rowKey?: MaybeRefOrGetter<RowKey<T>>\n /** Rows can expand (the `subtable` column). Defaults to `false`. */\n hasSubtable?: MaybeRefOrGetter<boolean | undefined>\n /**\n * Which rows can expand, with `hasSubtable` (C-98); without it every row\n * can. Give a getter or a ref that holds the function (`() => fn`): a bare\n * function is read as a getter.\n */\n rowExpandable?: MaybeRefOrGetter<TableProps<T>['rowExpandable']>\n /** Page sizes offered. Defaults to `[10, 20, 30, 50, 100]`. */\n pageSizeOptions?: MaybeRefOrGetter<number[] | undefined>\n /** Called once per user action that changes the query, with a new object. */\n onQueryChange: (query: Q, reason: QueryChangeReason) => void\n /** Called with the new selection (its `true` entries) when the user changes it. */\n onSelectionChange?: (selection: RowSelection) => void\n /**\n * Called once per user action that changes the layout, with a new array\n * (C-68).\n */\n onColumnsChange?: (columns: Column[], reason: ColumnChangeReason) => void\n /** Called with the new map when the user pins or unpins a row (C-74). */\n onRowPinningChange?: (rowPinning: RowPinning) => void\n}\n\n/** A row of the body in drawing order (C-74). */\nexport interface BodyRow<T> {\n row: T\n /** The row's index in `rows`. */\n index: number\n pinned: 'top' | 'bottom' | false\n}\n\n/** Row pinning (C-74), owned by the consumer. */\nexport interface QueryTableRowPinning<T extends object> {\n /** `rowPinning` and `rowKey` were given: rows can be pinned. */\n enabled: ComputedRef<boolean>\n /** The rows to draw: pinned to the top first, pinned to the bottom last. */\n rows: ComputedRef<BodyRow<T>[]>\n /**\n * Pin a row or unpin it (`false`): tells the consumer the new map; nothing\n * for the position the row has, or while row pinning is off.\n */\n pin: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n}\n\n/** A column the table draws and its position in `columns`, hidden ones included. */\nexport interface ColumnEntry {\n column: Column\n index: number\n}\n\n/** The filter input of each column (C-08 to C-22). */\nexport interface QueryTableFilters {\n /** The column's typed text and picked condition; blank when nothing is typed. */\n draftOf: (field: string) => Readonly<FilterDraft>\n /** The input's text changed: applied after the debounce (C-09). */\n setInput: (field: string, text: string) => void\n /** Enter: applies the column's pending text now (C-12). */\n apply: (field: string) => void\n /** Applies every pending text in one update; `true` when it changed the filters. */\n flushAll: () => boolean\n /** Picks a condition; `null` clears the column (C-20). */\n setCondition: (field: string, condition: FilterCondition | null) => void\n /** Removes the column's rules and text (C-21). */\n clear: (field: string) => void\n /** Removes every rule and discards every text (C-22). */\n clearAll: () => void\n /** There is a rule or typed text to clear (C-22). */\n canClearAll: () => boolean\n /** The condition label under an input, `null` when there is none. */\n labelOf: (field: string) => FilterLabel | null\n /** How many rules a read-only input stands for; `0` when it is editable. */\n multiOf: (field: string) => number\n}\n\n/** Sorting by the headers and the filter menu (C-07). */\nexport interface QueryTableSort {\n /** The table and the column allow sorting by it. */\n isSortable: (column: Column) => boolean\n /** The direction the query sorts `column` in, `null` when it sorts another. */\n sortOf: (column: Column) => SortDirection | null\n /**\n * Without a direction, the header click: ascending, descending, none.\n * Does nothing for a column that cannot sort.\n */\n sortBy: (column: Column, direction?: SortDirection) => void\n}\n\n/** The global search (C-58). */\nexport interface QueryTableSearch {\n /** Text being typed, else `query.search`, else `''`. */\n text: ComputedRef<string>\n /** The input changed: applied after `searchDebounce`, at once when it is `0` or blank. */\n set: (text: string) => void\n /** Applies a pending text now; `true` when it emitted an update. */\n apply: () => boolean\n}\n\n/** Expanded rows (C-26, C-55), held in TanStack's `expanded` slice. */\nexport interface QueryTableExpansion<T extends object> {\n /** Identity of a row: `rowKey`, else its index. */\n keyOf: (row: T, index: number) => string | number\n /** `hasSubtable` is on and `rowExpandable` lets the row expand (C-98). */\n canExpand: (row: T, index: number) => boolean\n isExpanded: (row: T, index: number) => boolean\n /** Opens or closes the row; nothing for a row that cannot expand (C-98). */\n toggle: (row: T, index: number) => void\n collapseAll: () => void\n /** Opens every row given that can expand; nothing is fetched. */\n expandAll: () => void\n}\n\n/** Row selection (C-59), owned by the consumer. */\nexport interface QueryTableSelection<T extends object> {\n /** A `selection` was given: the table offers selection. */\n enabled: ComputedRef<boolean>\n isSelected: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\n /** Every row of the page is selected (and there is one). */\n allSelected: ComputedRef<boolean>\n /** Some but not every row of the page is selected. */\n someSelected: ComputedRef<boolean>\n /** Select or deselect every row of the page. */\n toggleAll: (value: boolean) => void\n}\n\n/** The column layout actions (C-67 to C-70). */\nexport interface QueryTableLayout {\n /** What the `header-<field>` and `filter-menu` slots receive as `control`. */\n controlOf: (field: string) => ColumnControl\n /** The drawn columns of the field's region (left, center or right), in order. */\n regionOf: (field: string) => string[]\n /**\n * Puts `field` right before or after `target` in `columns` and emits the\n * order; nothing when `target` is not in the same region.\n */\n moveColumn: (field: string, target: string, place: 'before' | 'after') => void\n}\n\nexport interface QueryTable<T extends object, Q extends Query = TableQuery> {\n /** The TanStack table, for the advanced path (headless markup). */\n table: VueTable<QueryTableFeatures, T>\n /**\n * The columns to draw: hidden ones dropped; pinned left first, pinned\n * right last (C-69).\n */\n columns: ComputedRef<ColumnEntry[]>\n /** Some drawn column is pinned to the left: the utility cells are pinned with it. */\n hasPinned: ComputedRef<boolean>\n /** Visibility, order and pinning actions (C-67 to C-70). */\n layout: QueryTableLayout\n sort: QueryTableSort\n filters: QueryTableFilters\n search: QueryTableSearch\n /** What the `pagination` slot receives (C-05, C-06, C-23, C-56). */\n pagination: ComputedRef<PaginationSlotProps>\n expansion: QueryTableExpansion<T>\n selection: QueryTableSelection<T>\n rowPinning: QueryTableRowPinning<T>\n /** The query a new action builds on (an update not yet answered included). */\n baseQuery: () => Q\n}\n\nconst blank: Readonly<FilterDraft> = Object.freeze({\n text: '',\n condition: null\n})\n\nconst defaultPageSizes = [10, 20, 30, 50, 100]\n\n/** Only the `true` entries: the selection a consumer stores. */\nconst selectedOnly = (selection: RowSelection): RowSelection =>\n Object.fromEntries(Object.entries(selection).filter(([, value]) => value))\n\nconst noPinnedRows: RowPinning = Object.freeze({\n top: Object.freeze([]) as unknown as string[],\n bottom: Object.freeze([]) as unknown as string[]\n})\n\nconst sameKeys = (a: readonly string[], b: readonly string[]) =>\n a.length === b.length && a.every((key, i) => key === b[i])\n\n/**\n * The state and actions of a server-side table: TanStack Table with\n * `serverQueryFeature` and `filterInputFeature`, in a Vue scope. Disposed\n * with the scope (C-62).\n */\nexport function useQueryTable<T extends object, Q extends Query = TableQuery>(\n options: UseQueryTableOptions<T, Q>\n): QueryTable<T, Q> {\n const query = () => toValue(options.query)\n const rows = () => toValue(options.rows) ?? []\n const totalRows = () => toValue(options.totalRows) ?? null\n const cursors = () => toValue(options.cursors) ?? null\n const columns = () => toValue(options.columns)\n const rowKey = () => toValue(options.rowKey)\n const hasSubtable = () => toValue(options.hasSubtable) ?? false\n // C-98: with `hasSubtable`, a row expands unless `rowExpandable` says no.\n const canExpand = (row: T, index: number) => {\n if (!hasSubtable()) {\n return false\n }\n const expandable = toValue(options.rowExpandable)\n return expandable === undefined || expandable(row, index)\n }\n const pinnedRows = () => toValue(options.rowPinning)\n // C-74: without a row identity an index would pin another row on the next\n // page, so the map needs `rowKey`.\n const pinningEnabled = computed(\n () => rowKey() !== undefined && pinnedRows() !== undefined\n )\n const rowPinningState = computed(() => {\n if (!pinningEnabled.value) {\n return noPinnedRows\n }\n const map = pinnedRows()!\n return { top: map.top ?? [], bottom: map.bottom ?? [] }\n })\n\n const keyOf = (row: T, index: number): string | number => {\n const key = rowKey()\n if (typeof key === 'function') {\n return key(row, index)\n }\n if (typeof key === 'string') {\n return (row as Record<string, string | number>)[key]\n }\n return index\n }\n const idOf = (row: T, index: number) => String(keyOf(row, index))\n\n // The query as TanStack slices (ADR 0004).\n const projection = computed(() =>\n projectServerQuery({\n query: query(),\n rowCount: totalRows(),\n cursors: cursors(),\n pageRows: rows().length\n })\n )\n\n // Every column, hidden ones too: a filter of a hidden column still applies.\n const columnDefs = computed(() =>\n columns().map(column => ({\n id: column.field,\n accessorFn: (row: T) => valueAt(row, column.field),\n enableSorting: column.sortable !== false,\n filterType: columnTypeOf(column)\n }))\n )\n\n // The layout as TanStack slices (ADR 0007): visibility from `hide`, order\n // from the array, pinning from `pinned` (start = left, end = right).\n const columnVisibility = computed(() =>\n Object.fromEntries(columns().map(column => [column.field, !column.hide]))\n )\n const columnOrder = computed(() => columns().map(column => column.field))\n const columnPinning = computed(() => ({\n start: columns()\n .filter(column => sideOf(column) === 'left')\n .map(column => column.field),\n end: columns()\n .filter(column => sideOf(column) === 'right')\n .map(column => column.field)\n }))\n\n /** A layout change goes to the consumer; an equal result is no change (C-68). */\n const tell = (next: Column[] | null, reason: ColumnChangeReason) => {\n if (next) {\n options.onColumnsChange?.(next, reason)\n }\n }\n\n /** Updates emitted so far: tells whether an action emitted one. */\n let emits = 0\n\n const table = useTable<QueryTableFeatures, T>({\n features,\n columns: columnDefs,\n get data() {\n return rows()\n },\n getRowId: (row: T, index: number) => idOf(row, index),\n get query() {\n return query()\n },\n onQueryChange: (next: Query, reason: QueryChangeReason) => {\n emits += 1\n options.onQueryChange(next as Q, reason)\n },\n get cursors() {\n return cursors()\n },\n get rowCount() {\n return totalRows() ?? undefined\n },\n get pageCount() {\n return projection.value.pageCount\n },\n get enableSorting() {\n return toValue(options.sortable) ?? false\n },\n get filterDebounce() {\n return toValue(options.filterDebounce) ?? 100\n },\n enableRowSelection: true,\n // P15: the expansion is TanStack's; the table resets it itself (C-26).\n manualExpanding: true,\n getRowCanExpand: (row: Row<QueryTableFeatures, T>) =>\n canExpand(row.original, row.index),\n onRowSelectionChange: (updater: Updater<RowSelection>) => {\n const current = toValue(options.selection) ?? {}\n options.onSelectionChange?.(\n selectedOnly(functionalUpdate(updater, current))\n )\n },\n // C-68: the layout slices are controlled; a change becomes `columns`.\n onColumnVisibilityChange: (updater: Updater<Record<string, boolean>>) =>\n tell(\n applyVisibility(\n columns(),\n functionalUpdate(updater, columnVisibility.value)\n ),\n 'visibility'\n ),\n onColumnOrderChange: (updater: Updater<string[]>) =>\n tell(\n applyOrder(columns(), functionalUpdate(updater, columnOrder.value)),\n 'order'\n ),\n onColumnPinningChange: (\n updater: Updater<{ start?: string[]; end?: string[] }>\n ) =>\n tell(\n applyPinning(columns(), functionalUpdate(updater, columnPinning.value)),\n 'pin'\n ),\n // C-74: the slice is controlled; a change is a new map for the consumer.\n get enableRowPinning() {\n return pinningEnabled.value\n },\n onRowPinningChange: (updater: Updater<RowPinning>) => {\n if (!pinningEnabled.value) {\n return\n }\n const current = rowPinningState.value\n const next = functionalUpdate(updater, current)\n if (\n !sameKeys(next.top, current.top) ||\n !sameKeys(next.bottom, current.bottom)\n ) {\n options.onRowPinningChange?.({\n top: [...next.top],\n bottom: [...next.bottom]\n })\n }\n },\n state: {\n get sorting() {\n return projection.value.state.sorting\n },\n get columnFilters() {\n return projection.value.state.columnFilters\n },\n get pagination() {\n return projection.value.state.pagination\n },\n get globalFilter() {\n return projection.value.state.globalFilter\n },\n get rowSelection() {\n return toValue(options.selection) ?? {}\n },\n get columnVisibility() {\n return columnVisibility.value\n },\n get columnOrder() {\n return columnOrder.value\n },\n get columnPinning() {\n return columnPinning.value\n },\n get rowPinning() {\n return rowPinningState.value\n }\n }\n } as never)\n\n onScopeDispose(() => dispose(table))\n\n const columnById = (field: string) =>\n table.getAllLeafColumns().find(column => column.id === field)\n\n // ---- columns -------------------------------------------------------------\n\n const entries = computed<ColumnEntry[]>(() => {\n const byField = new Map(\n columns().map((column, index) => [column.field, { column, index }])\n )\n return [\n ...table.getStartVisibleLeafColumns(),\n ...table.getCenterVisibleLeafColumns(),\n ...table.getEndVisibleLeafColumns()\n ]\n .map(column => byField.get(column.id))\n .filter((entry): entry is ColumnEntry => !!entry)\n })\n const hasPinned = computed(() =>\n entries.value.some(entry => sideOf(entry.column) === 'left')\n )\n\n // ---- layout (C-67 to C-70) -------------------------------------------------\n\n const regionOf = (field: string): string[] => {\n const own = entries.value.find(entry => entry.column.field === field)\n if (!own) {\n return []\n }\n const side = sideOf(own.column)\n return entries.value\n .filter(entry => sideOf(entry.column) === side)\n .map(entry => entry.column.field)\n }\n\n const moveColumn = (\n field: string,\n target: string,\n place: 'before' | 'after'\n ) => {\n if (field !== target && regionOf(field).includes(target)) {\n table.setColumnOrder(moveField(columnOrder.value, field, target, place))\n }\n }\n\n /**\n * A column's control. Every slot of every column gets one, so making it\n * does no work: `pinned`, `canMoveLeft` and `canMoveRight` read the layout\n * when they are read (a region is O(n)), and a slot that never reads them\n * costs nothing. A control kept past a re-render reads the current layout.\n */\n const controlOf = (field: string): ColumnControl => {\n const place = () => {\n const region = regionOf(field)\n return { at: region.indexOf(field), size: region.length }\n }\n return {\n get pinned() {\n const column = columns().find(candidate => candidate.field === field)\n return column ? sideOf(column) : false\n },\n pin: side =>\n columnById(field)?.pin(\n side === 'left' ? 'start' : side === 'right' ? 'end' : false\n ),\n hide: () => columnById(field)?.toggleVisibility(false),\n get canMoveLeft() {\n return place().at > 0\n },\n get canMoveRight() {\n const { at, size } = place()\n return at >= 0 && at < size - 1\n },\n // Read at call time, like the flags above.\n move: direction => {\n const current = regionOf(field)\n const from = current.indexOf(field)\n const target = current[from + (direction === 'left' ? -1 : 1)]\n if (from >= 0 && target !== undefined) {\n moveColumn(field, target, direction === 'left' ? 'before' : 'after')\n }\n }\n }\n }\n\n const layout: QueryTableLayout = { controlOf, regionOf, moveColumn }\n\n // ---- search (C-58) --------------------------------------------------------\n\n /** Typed and not yet answered; `null` when the input shows the query. */\n const typed = shallowRef<string | null>(null)\n let searchTimer: ReturnType<typeof setTimeout> | undefined\n\n const cancelSearch = () => {\n if (searchTimer !== undefined) {\n clearTimeout(searchTimer)\n searchTimer = undefined\n }\n }\n\n const applySearch = (): boolean => {\n const pending = searchTimer !== undefined\n cancelSearch()\n if (!pending || typed.value === null) {\n return false\n }\n const text = typed.value\n const before = emits\n table.setGlobalFilter(text)\n const emitted = emits !== before\n // Nothing to wait for: the text is no change, or the answer came already.\n if (!emitted || searchOf(query()) === text) {\n typed.value = null\n }\n return emitted\n }\n\n const setSearch = (text: string) => {\n typed.value = text\n cancelSearch()\n const wait = toValue(options.searchDebounce) ?? 300\n searchTimer = setTimeout(applySearch, Math.max(0, wait))\n if (wait <= 0 || text.trim() === '') {\n applySearch()\n }\n }\n\n // A new search text in the query replaces what was typed and applied.\n watch(\n () => searchOf(query()),\n () => {\n if (searchTimer === undefined) {\n typed.value = null\n }\n },\n { flush: 'sync' }\n )\n onScopeDispose(cancelSearch)\n\n const search: QueryTableSearch = {\n text: computed(() => typed.value ?? searchOf(query())),\n set: setSearch,\n apply: applySearch\n }\n\n // ---- filters --------------------------------------------------------------\n\n const draftOf = (field: string): Readonly<FilterDraft> =>\n columnById(field)?.getFilterInput() ?? blank\n\n const filters: QueryTableFilters = {\n draftOf,\n setInput: (field, text) => columnById(field)?.setFilterInput(text),\n apply: field => columnById(field)?.applyFilterInput(),\n flushAll: () => table.flushPendingFilters(),\n setCondition: (field, condition) =>\n columnById(field)?.setFilterCondition(condition),\n clear: field => columnById(field)?.clearFilterInput(),\n clearAll: () => table.clearAllFilters(),\n canClearAll: () => table.getCanClearAllFilters(),\n labelOf: field => columnById(field)?.getFilterLabel() ?? null,\n multiOf: field => draftOf(field).multi ?? 0\n }\n\n // ---- sort (C-07) ----------------------------------------------------------\n\n const isSortable = (column: Column) =>\n (toValue(options.sortable) ?? false) && column.sortable !== false\n\n const sort: QueryTableSort = {\n isSortable,\n sortOf: column => {\n const current = query().sort\n return current?.field === column.field ? current.direction : null\n },\n sortBy: (column, direction) => {\n const target = columnById(column.field)\n if (!isSortable(column) || !target) {\n return\n }\n applySearch()\n if (direction) {\n target.toggleSorting(direction === 'desc', false)\n } else {\n target.toggleQuerySorting()\n }\n }\n }\n\n // ---- pagination -----------------------------------------------------------\n\n const pageCountFor = (pageSize: number): number | null => {\n const total = totalRows()\n return total !== null && pageSize >= 1\n ? Math.max(1, Math.ceil(total / pageSize))\n : null\n }\n\n /** Page mode: there is a page after `base.page` (C-23). */\n const hasNext = (base: { page: number; pageSize: number }): boolean => {\n const count = pageCountFor(base.pageSize)\n return count !== null ? base.page < count : rows().length >= base.pageSize\n }\n\n const baseQuery = () => table.getBaseQuery() as Q\n\n /**\n * Applies pending search and filter text before a page action; `true`\n * when that changed the query, so the page asked for is dropped (C-14).\n */\n const flushBeforePage = () => {\n const searched = applySearch()\n const filtered = table.flushPendingFilters()\n return searched || filtered\n }\n\n const goTo = (page: number) => {\n table.setPagination(old => ({ ...old, pageIndex: page - 1 }))\n }\n\n const step = (by: 1 | -1) => {\n table.setPagination(old => ({ ...old, pageIndex: old.pageIndex + by }))\n }\n\n const setPage = (page: number) => {\n if (!Number.isFinite(page) || flushBeforePage()) {\n return\n }\n const base = baseQuery()\n if (isCursorQuery(base)) {\n return\n }\n const count = pageCountFor(base.pageSize)\n const target = Math.max(1, Math.trunc(page))\n goTo(count === null ? target : Math.min(target, count))\n }\n\n const nextPage = () => {\n if (flushBeforePage()) {\n return\n }\n const base = baseQuery()\n if (isCursorQuery(base)) {\n step(1)\n } else if (hasNext(base)) {\n goTo(base.page + 1)\n }\n }\n\n const previousPage = () => {\n if (flushBeforePage()) {\n return\n }\n const base = baseQuery()\n if (isCursorQuery(base)) {\n step(-1)\n } else {\n goTo(Math.max(1, base.page - 1))\n }\n }\n\n const setPageSize = (size: number) => {\n if (!Number.isInteger(size) || size < 1) {\n return\n }\n applySearch()\n table.flushPendingFilters()\n table.setPagination(old => ({ ...old, pageSize: size }))\n }\n\n const pagination = computed<PaginationSlotProps>(() => {\n const current = query()\n const cursorMode = isCursorQuery(current)\n const around = cursors()\n return {\n page: cursorMode ? 1 : current.page,\n pageSize: current.pageSize,\n pageCount: cursorMode ? null : pageCountFor(current.pageSize),\n totalRows: totalRows(),\n pageSizeOptions: toValue(options.pageSizeOptions) ?? defaultPageSizes,\n canPrevious: cursorMode ? !!around?.prev : current.page > 1,\n canNext: cursorMode ? !!around?.next : hasNext(current),\n setPage,\n nextPage,\n previousPage,\n setPageSize,\n cursorMode\n }\n })\n\n // ---- expansion (C-26, C-55) -----------------------------------------------\n\n // Vue computed around the atom: `atoms.*.get()` alone is not a tracked read\n // for every consumer path (TanStack vue-table: use a computed or Subscribe).\n const expandedState = computed(() => {\n const state = table.atoms.expanded.get()\n return state === true ? {} : state\n })\n const setExpanded = (\n update: (state: Record<string, boolean>) => Record<string, boolean>\n ) => {\n table.setExpanded(old => update(old === true ? {} : { ...old }))\n }\n\n const expansion: QueryTableExpansion<T> = {\n keyOf,\n canExpand,\n isExpanded: (row, index) =>\n !!expandedState.value[idOf(row, index)] && canExpand(row, index),\n toggle: (row, index) => {\n if (!canExpand(row, index)) {\n return\n }\n const id = idOf(row, index)\n setExpanded(state => {\n if (state[id]) {\n delete state[id]\n } else {\n state[id] = true\n }\n return state\n })\n },\n collapseAll: () => table.setExpanded({}),\n expandAll: () => {\n if (hasSubtable()) {\n setExpanded(state => {\n rows().forEach((row, index) => {\n if (canExpand(row, index)) {\n state[idOf(row, index)] = true\n }\n })\n return state\n })\n }\n }\n }\n\n // Without a row identity the state belongs to the rows it was set on; with\n // one, only keys of the rows given stay, so it never grows past a page. A\n // row's `isExpanded` field seeds it each time `rows` changes (C-26).\n watch(\n rows,\n current => {\n setExpanded(state => {\n if (rowKey() === undefined) {\n state = {}\n } else {\n const present = new Set(current.map(idOf))\n for (const id of Object.keys(state)) {\n if (!present.has(id)) {\n delete state[id]\n }\n }\n }\n if (hasSubtable()) {\n current.forEach((row, index) => {\n const seeded = (row as { isExpanded?: unknown }).isExpanded\n if (!canExpand(row, index)) {\n // C-98: a row that cannot expand keeps no state.\n delete state[idOf(row, index)]\n } else if (seeded === true) {\n state[idOf(row, index)] = true\n } else if (seeded === false) {\n delete state[idOf(row, index)]\n }\n })\n }\n return state\n })\n },\n { immediate: true }\n )\n\n // ---- selection (C-59) -----------------------------------------------------\n\n const selection: QueryTableSelection<T> = {\n enabled: computed(() => toValue(options.selection) !== undefined),\n isSelected: (row, index) =>\n !!toValue(options.selection)?.[idOf(row, index)],\n toggle: (row, index) => {\n const id = idOf(row, index)\n table.setRowSelection(old => {\n const next = { ...old }\n if (next[id]) {\n delete next[id]\n } else {\n next[id] = true\n }\n return next\n })\n },\n allSelected: computed(() => table.getIsAllPageRowsSelected()),\n someSelected: computed(() => table.getIsSomePageRowsSelected()),\n toggleAll: value => table.toggleAllPageRowsSelected(value)\n }\n\n // ---- row pinning (C-74) ---------------------------------------------------\n\n const bodyRows = computed<BodyRow<T>[]>(() => {\n // Off: the rows as given, without TanStack's row model (the 3.0 path).\n if (!pinningEnabled.value) {\n return rows().map((row, index) => ({ row, index, pinned: false }))\n }\n const of = (\n row: Row<QueryTableFeatures, T>,\n pinned: BodyRow<T>['pinned']\n ): BodyRow<T> => ({ row: row.original, index: row.index, pinned })\n return [\n ...table.getTopRows().map(row => of(row, 'top')),\n ...table.getCenterRows().map(row => of(row, false)),\n ...table.getBottomRows().map(row => of(row, 'bottom'))\n ]\n })\n\n const positionOf = (id: string): BodyRow<T>['pinned'] => {\n const { top, bottom } = rowPinningState.value\n return top.includes(id) ? 'top' : bottom.includes(id) ? 'bottom' : false\n }\n\n const rowPinning: QueryTableRowPinning<T> = {\n enabled: pinningEnabled,\n rows: bodyRows,\n pin: (row, index, position) => {\n const id = idOf(row, index)\n // TanStack moves a row pinned again to the end of its region; the rule\n // is that the position the row has is no change.\n if (!pinningEnabled.value || positionOf(id) === position) {\n return\n }\n table.getRow(id, true)?.pin(position)\n }\n }\n\n return {\n table,\n columns: entries,\n hasPinned,\n layout,\n sort,\n filters,\n search,\n pagination,\n expansion,\n selection,\n rowPinning,\n baseQuery\n }\n}\n","import {\n isCursorQuery,\n type PageCursors,\n type Query\n} from '@dolusoft/query-protocol'\nimport {\n computed,\n onBeforeUnmount,\n shallowRef,\n watch,\n watchEffect,\n type Ref\n} from 'vue'\n\nimport type { InfiniteOptions } from '../contract'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nexport interface LoadMoreOptions {\n infinite: () => boolean | InfiniteOptions | undefined\n rowKey: () => unknown\n rows: () => readonly unknown[]\n query: () => Query\n totalRows: () => number | null\n cursors: () => PageCursors | null\n loading: () => boolean\n /** The next page action (C-05, C-56). */\n nextPage: () => void\n table: Readonly<Ref<HTMLTableElement | null>>\n /** The body is virtual (C-83). */\n virtual: () => boolean\n /**\n * With `virtual`: the end of the drawn window among the center rows, and\n * their number; `null` until the window was laid out (C-83).\n */\n window: () => { end: number; count: number } | null\n}\n\n/**\n * Infinite scroll (C-88 to C-90): whether there is more to load, the\n * automatic request near the end of `rows` and `loadMore`. The rows are\n * the consumer's; the table only emits the next page action.\n */\nexport const useLoadMore = (o: LoadMoreOptions) => {\n const enabled = computed(() => !!o.infinite() && o.rowKey() !== undefined)\n const threshold = () => {\n const value = o.infinite()\n const given = typeof value === 'object' ? value.threshold : undefined\n return given !== undefined && given >= 0 ? Math.trunc(given) : 5\n }\n\n const canLoadMore = computed(() => {\n const query = o.query()\n if (isCursorQuery(query)) {\n return !!o.cursors()?.next\n }\n const total = o.totalRows()\n return total !== null\n ? query.page < Math.max(1, Math.ceil(total / query.pageSize))\n : o.rows().length >= query.page * query.pageSize\n })\n\n const loadMore = () => {\n if (enabled.value && canLoadMore.value && !o.loading()) {\n o.nextPage()\n }\n }\n\n // Without `virtual`: the row `threshold` rows before the last one, watched\n // in the viewport (the implicit root sees the clipping of every ancestor).\n const seen = shallowRef(false)\n let observer: IntersectionObserver | null = null\n watch(\n [enabled, o.virtual, o.rows, o.table],\n () => {\n observer?.disconnect()\n observer = null\n seen.value = false\n const count = o.rows().length\n const tbody = o.table.value?.tBodies[0]\n if (\n !enabled.value ||\n o.virtual() ||\n !tbody ||\n count === 0 ||\n typeof IntersectionObserver === 'undefined'\n ) {\n return\n }\n // Pinned rows (C-74) are drawn at the ends whatever their index: the\n // threshold row is counted among the others, from the last one.\n const others = tbody.querySelectorAll(\n ':scope > tr[data-row-index]:not([data-pinned-row])'\n )\n const target = others[Math.max(0, others.length - 1 - threshold())]\n if (target) {\n observer = new IntersectionObserver(entries => {\n seen.value = entries.some(entry => entry.isIntersecting)\n })\n observer.observe(target)\n }\n },\n { flush: 'post', immediate: true }\n )\n onBeforeUnmount(() => observer?.disconnect())\n\n // One automatic request per query and number of rows: an answer that\n // changes neither (an error) is not asked again (C-88).\n let asked = ''\n watchEffect(\n () => {\n if (!enabled.value || !canLoadMore.value || o.loading()) {\n return\n }\n const range = o.window()\n const near = o.virtual()\n ? range !== null && range.end >= range.count - threshold()\n : seen.value\n if (!near) {\n return\n }\n const signature = `${JSON.stringify(o.query())}#${o.rows().length}`\n if (signature !== asked) {\n asked = signature\n o.nextPage()\n }\n },\n { flush: 'post' }\n )\n\n let warned = false\n watchEffect(() => {\n if (!warned && o.infinite() && o.rowKey() === undefined) {\n warned = true\n try {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n } catch {\n // No `process`: a development build.\n }\n console.warn(\n '[QueryTable] `infinite` needs `rowKey`; it is ignored without one (C-88).'\n )\n }\n })\n\n return { enabled, canLoadMore, loadMore }\n}\n","import type { BodyRow } from '../use-query-table'\n\n/** A group key: what `groupBy` returns for a row that belongs to a group. */\nexport type GroupKey = string | number\n\n/** One group: a run of consecutive rows with the same key (C-103). */\nexport interface GroupRun<T> {\n key: GroupKey\n /** Rows in the group. */\n count: number\n /** Its first row and that row's index in `rows`. */\n row: T\n index: number\n /** Position of its first row among the rows it was computed over. */\n start: number\n /** Identity of its header row: the key and the how-many-th run of it. */\n id: string\n}\n\n/** The groups of a list of rows and, per row, the group it belongs to. */\nexport interface GroupRuns<T> {\n runs: GroupRun<T>[]\n /** Per position: the index of its group in `runs`, or -1. */\n groupOf: Int32Array\n /** Per position: the number of header rows drawn up to and with it. */\n headersThrough: Int32Array\n}\n\n/** The runs as a string (start and count of each), or `null` without groups. */\nexport const groupShape = <T>(groups: GroupRuns<T> | null): string | null =>\n groups ? groups.runs.map(run => `${run.start}:${run.count}`).join(',') : null\n\n/**\n * Splits `rows` into runs of consecutive rows with the same `groupBy` key\n * (C-103). The rows are not reordered: a key that comes back after another\n * starts a new run. `null` and `undefined` mean no group.\n */\nexport const groupRuns = <T>(\n rows: readonly BodyRow<T>[],\n groupBy: (row: T, index: number) => GroupKey | null | undefined\n): GroupRuns<T> => {\n const runs: GroupRun<T>[] = []\n const groupOf = new Int32Array(rows.length)\n const headersThrough = new Int32Array(rows.length)\n const seen = new Map<GroupKey, number>()\n let current: GroupRun<T> | null = null\n for (let p = 0; p < rows.length; p++) {\n const { row, index } = rows[p]\n const key = groupBy(row, index)\n // NaN never equals itself: it is no group, not a group per row.\n if (key === null || key === undefined || Number.isNaN(key)) {\n current = null\n groupOf[p] = -1\n } else if (current && current.key === key) {\n current.count++\n groupOf[p] = runs.length - 1\n } else {\n const nth: number = seen.get(key) ?? 0\n seen.set(key, nth + 1)\n current = {\n key,\n count: 1,\n row,\n index,\n start: p,\n id: `${typeof key}:${String(key)}#${nth}`\n }\n runs.push(current)\n groupOf[p] = runs.length - 1\n }\n headersThrough[p] = runs.length\n }\n return { runs, groupOf, headersThrough }\n}\n","// The pure part of the virtual body (C-83, C-84): which items to draw for a\n// scroll position, and how the drawn items and the spacers between them line\n// up. No DOM here; `use-row-window.ts` feeds it measured numbers.\n\n/** A half-open range of item positions: `start` drawn, `end` not. */\nexport interface WindowRange {\n start: number\n end: number\n}\n\nexport interface WindowInput {\n /**\n * The top of every item from the top of the first one, and last the total\n * height: `count + 1` numbers, never decreasing.\n */\n offsets: ArrayLike<number>\n /** The top of the view, from the top of the first item. May be negative. */\n scrollTop: number\n viewportHeight: number\n /** Items drawn beyond each edge of the view. */\n overscan: number\n}\n\n/**\n * Fills `offsets` from `heights`, starting at position `from` (the offsets\n * before it are kept): `offsets[i + 1] = offsets[i] + heights[i]`.\n */\nexport const fillOffsets = (\n heights: ArrayLike<number>,\n offsets: Float64Array,\n from = 0\n): void => {\n for (let i = from; i < heights.length; i++) {\n offsets[i + 1] = offsets[i] + heights[i]\n }\n}\n\n/**\n * The item that holds the point `y`: the last position whose top is at most\n * `y`, clamped to the items (0 for a point above them, the last item for a\n * point below them). `-1` when there is no item.\n */\nexport const indexAt = (offsets: ArrayLike<number>, y: number): number => {\n let low = 0\n let high = offsets.length - 2\n if (high < 0) {\n return -1\n }\n while (low < high) {\n const mid = (low + high + 1) >> 1\n if (offsets[mid] <= y) {\n low = mid\n } else {\n high = mid - 1\n }\n }\n return low\n}\n\n/** The items to draw: the ones in view and `overscan` more on each side. */\nexport const computeWindow = ({\n offsets,\n scrollTop,\n viewportHeight,\n overscan\n}: WindowInput): WindowRange => {\n const count = offsets.length - 1\n if (count <= 0) {\n return { start: 0, end: 0 }\n }\n const first = indexAt(offsets, scrollTop)\n const bottom = scrollTop + Math.max(0, viewportHeight)\n let last = indexAt(offsets, bottom)\n // An item that starts exactly at the bottom edge is not in view.\n if (last > first && offsets[last] >= bottom) {\n last -= 1\n }\n return {\n start: Math.max(0, first - overscan),\n end: Math.min(count, last + 1 + overscan)\n }\n}\n\n/** A run of drawn items, or a spacer that stands for the items left out. */\nexport type Segment =\n { from: number; to: number } | { spacer: number; slot: 0 | 1 | 2 }\n\n/**\n * The body between the pinned rows: an upper spacer, the drawn items and a\n * lower spacer. A `kept` item outside the range (it holds the focus, C-86)\n * is drawn on its own, with a spacer of its own between it and the range.\n * Spacers of height 0 are left out. `slot` names a spacer's place, so a\n * spacer keeps its identity while its height changes.\n */\nexport const segmentsOf = (\n offsets: ArrayLike<number>,\n range: WindowRange,\n kept: number | null\n): Segment[] => {\n const count = offsets.length - 1\n const total = count > 0 ? offsets[count] : 0\n const out: Segment[] = []\n const spacer = (height: number, slot: 0 | 1 | 2) => {\n if (height > 0) {\n out.push({ spacer: height, slot })\n }\n }\n const run = (from: number, to: number) => {\n if (to > from) {\n out.push({ from, to })\n }\n }\n const { start, end } = range\n if (kept !== null && kept >= 0 && kept < start) {\n spacer(offsets[kept], 0)\n run(kept, kept + 1)\n spacer(offsets[start] - offsets[kept + 1], 1)\n run(start, end)\n spacer(total - offsets[end], 2)\n } else if (kept !== null && kept >= end && kept < count) {\n spacer(offsets[start], 0)\n run(start, end)\n spacer(offsets[kept] - offsets[end], 1)\n run(kept, kept + 1)\n spacer(total - offsets[kept + 1], 2)\n } else {\n spacer(offsets[start], 0)\n run(start, end)\n spacer(total - offsets[end], 2)\n }\n return out\n}\n","import { computed, onBeforeUnmount, shallowRef, watch, type Ref } from 'vue'\n\nimport {\n groupRuns,\n groupShape,\n type GroupKey,\n type GroupRun\n} from '../body/group-runs'\nimport type { ScrollToIndexOptions, VirtualOptions } from '../contract'\nimport type { BodyRow } from '../use-query-table'\nimport {\n computeWindow,\n fillOffsets,\n indexAt,\n segmentsOf,\n type WindowRange\n} from './compute-window'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n// A try/catch keeps the constant replacement in production builds.\nconst isDevelopment = (): boolean => {\n try {\n return process.env.NODE_ENV !== 'production'\n } catch {\n return true\n }\n}\n\n/** A row the body draws, with its `aria-rowindex` when the body is virtual. */\nexport type DrawnRow<T> = BodyRow<T> & { aria?: number }\n/** A spacer row: the height of the items it stands for (C-83). */\nexport interface SpacerRow {\n spacer: number\n key: symbol\n}\n/** The header row of a group (C-103), with its `aria-rowindex` when virtual. */\nexport interface GroupRow<T> {\n group: GroupRun<T>\n key: symbol\n aria?: number\n}\n/** An item of the body: a data row, a spacer or a group row. */\nexport type BodyItem<T> = DrawnRow<T> | SpacerRow | GroupRow<T>\n\nexport interface RowWindowOptions<T> {\n virtual: () => boolean | VirtualOptions | undefined\n table: Readonly<Ref<HTMLTableElement | null>>\n /** The rows in drawing order: pinned top, the others, pinned bottom (C-74). */\n bodyRows: () => BodyRow<T>[]\n keyOf: (row: T, index: number) => string | number\n isExpanded: (row: T, index: number) => boolean\n /** The `groupBy` prop (C-103); absent, no group is drawn. */\n groupBy?: () =>\n ((row: T, index: number) => GroupKey | null | undefined) | undefined\n}\n\ntype Align = NonNullable<ScrollToIndexOptions['align']>\ntype Container = HTMLElement | Window\n\n/** One identity per spacer place: above, between, below (`segmentsOf`). */\nconst spacerKeys = [Symbol('above'), Symbol('between'), Symbol('below')]\n\n/**\n * The virtual body (C-83 to C-87): which rows are drawn, the spacers that\n * stand for the others, the measured heights, the focused row kept drawn,\n * printing and `scrollToIndex`. Without `virtual` it draws `bodyRows` as\n * they are and touches no DOM.\n */\nexport const useRowWindow = <T extends object>(o: RowWindowOptions<T>) => {\n // Compared by value: `:virtual=\"{ overscan: 5 }\"` is a new object on every\n // render of the consumer and must not draw the body again.\n const settings = computed<VirtualOptions | null>(previous => {\n const value = o.virtual()\n const next = value === true ? {} : value || null\n return previous &&\n next &&\n previous.overscan === next.overscan &&\n previous.rowHeight === next.rowHeight &&\n previous.estimateRowHeight === next.estimateRowHeight &&\n previous.groupRowHeight === next.groupRowHeight &&\n previous.scrollElement === next.scrollElement\n ? previous\n : next\n })\n const enabled = () => settings.value !== null\n const overscan = () => Math.max(0, settings.value?.overscan ?? 10)\n const fixed = () => settings.value?.rowHeight\n\n /** Pinned rows sit at both ends of `bodyRows`; the window is the middle. */\n const parts = computed(() => {\n const all = o.bodyRows()\n let top = 0\n while (top < all.length && all[top].pinned === 'top') {\n top++\n }\n let bottom = all.length\n while (bottom > top && all[bottom - 1].pinned === 'bottom') {\n bottom--\n }\n return {\n all,\n top,\n center: top === 0 && bottom === all.length ? all : all.slice(top, bottom)\n }\n })\n const center = () => parts.value.center\n\n /** The groups of the center rows (C-103), or `null` without `groupBy`. */\n const groups = computed(() => {\n const groupBy = o.groupBy?.()\n return groupBy ? groupRuns(center(), groupBy) : null\n })\n /** The center position starts a group: its group row is drawn above it. */\n const startsGroup = (position: number) => {\n const g = groups.value\n if (!g) {\n return false\n }\n const at = g.groupOf[position]\n return at >= 0 && g.runs[at].start === position\n }\n // A symbol per group id: a group row's `v-for` key can never equal a\n // consumer's `rowKey`, whatever string that is. Ids that left are dropped.\n let groupKeys = new Map<string, symbol>()\n watch(groups, g => {\n if (!g) {\n groupKeys = new Map()\n return\n }\n const kept = new Map<string, symbol>()\n for (const run of g.runs) {\n const known = groupKeys.get(run.id)\n if (known) {\n kept.set(run.id, known)\n }\n }\n groupKeys = kept\n })\n const groupKey = (id: string) => {\n let key = groupKeys.get(id)\n if (!key) {\n key = Symbol(id)\n groupKeys.set(id, key)\n }\n return key\n }\n const groupRowOf = (run: GroupRun<T>, aria?: number): GroupRow<T> => ({\n group: run,\n key: groupKey(run.id),\n aria\n })\n\n /** Position of a row index among the center rows (ascending), or -1. */\n const positionOf = (index: number): number => {\n const rows = center()\n if (rows[index]?.index === index) {\n return index\n }\n let low = 0\n let high = rows.length - 1\n while (low <= high) {\n const mid = (low + high) >> 1\n const at = rows[mid].index\n if (at === index) {\n return mid\n }\n if (at < index) {\n low = mid + 1\n } else {\n high = mid - 1\n }\n }\n return -1\n }\n\n // ---- heights (C-84) -------------------------------------------------------\n\n let heights = new Float64Array(0)\n /** Item heights without the group row above an item (C-104). */\n let base = new Float64Array(0)\n let measured = new Uint8Array(0)\n /** The measured height of a group row, `0` until one is measured. */\n let groupMeasured = 0\n let offsets = new Float64Array(1)\n let byKey = new Map<string | number, number>()\n /** The first measured height, the estimate when none is given. */\n let firstMeasured = 0\n /** Bumped whenever `offsets` change, so the spacers are drawn again. */\n const version = shallowRef(0)\n const estimate = () =>\n fixed() ?? settings.value?.estimateRowHeight ?? (firstMeasured || 32)\n /** Height counted for a group row (C-104). */\n const groupHeight = () => {\n const height = fixed()\n if (height !== undefined) {\n return settings.value?.groupRowHeight ?? height\n }\n return groupMeasured || estimate()\n }\n /** An item's height: its row and, above it, its group row. */\n const withGroup = (position: number) =>\n base[position] + (startsGroup(position) ? groupHeight() : 0)\n\n const rebuild = () => {\n const rows = enabled() ? center() : []\n const height = fixed()\n heights = new Float64Array(rows.length)\n // Without groups an item is its row: one array serves both (P8).\n base = groups.value ? new Float64Array(rows.length) : heights\n measured = new Uint8Array(rows.length)\n const kept = new Map<string | number, number>()\n for (let i = 0; i < rows.length; i++) {\n if (height !== undefined) {\n base[i] = height\n } else {\n const key = o.keyOf(rows[i].row, rows[i].index)\n const known = byKey.get(key)\n if (known === undefined) {\n base[i] = estimate()\n } else {\n kept.set(key, known)\n base[i] = known\n measured[i] = 1\n }\n }\n heights[i] = withGroup(i)\n }\n // Keys that left `rows` are dropped (C-84).\n byKey = kept\n // A `scrollToIndex` waiting for its row meant the rows it was given.\n pending = null\n offsets = new Float64Array(rows.length + 1)\n fillOffsets(heights, offsets)\n version.value++\n }\n\n const body = () => o.table.value?.tBodies[0] ?? null\n\n /** The drawn data row at a center position. */\n const rowElement = (tbody: HTMLElement, position: number) => {\n const row = center()[position]\n return row\n ? tbody.querySelector<HTMLElement>(\n `:scope > tr[data-row-index=\"${row.index}\"]:not([data-pinned-row])`\n )\n : null\n }\n\n /** Height of a drawn item: its row and its subtable row. */\n const itemHeight = (tr: Element) => {\n const next = tr.nextElementSibling\n return (\n tr.getBoundingClientRect().height +\n (next?.classList.contains('qt-subtable-row')\n ? next.getBoundingClientRect().height\n : 0)\n )\n }\n\n /** Reads the drawn items; `true` when a height changed. */\n const measure = (tbody: HTMLElement): boolean => {\n if (fixed() !== undefined) {\n return false\n }\n const rows = center()\n let from = -1\n for (const tr of tbody.children) {\n if (groups.value && tr.classList.contains('qt-group-row')) {\n // Every group row counts as tall as the last one measured (C-104).\n const height = tr.getBoundingClientRect().height\n if (height > 0 && Math.abs(height - groupMeasured) > 0.5) {\n groupMeasured = height\n from = 0\n }\n continue\n }\n const at = tr.getAttribute('data-row-index')\n if (at === null || tr.hasAttribute('data-pinned-row')) {\n continue\n }\n const position = positionOf(Number(at))\n if (position < 0) {\n continue\n }\n const height = itemHeight(tr)\n if (\n !firstMeasured &&\n height > 0 &&\n settings.value?.estimateRowHeight === undefined\n ) {\n // The first measured item becomes the estimate of the others.\n firstMeasured = height\n for (let i = 0; i < base.length; i++) {\n if (!measured[i]) {\n base[i] = height\n }\n }\n from = 0\n }\n if (!measured[position] || Math.abs(base[position] - height) > 0.5) {\n base[position] = height\n measured[position] = 1\n byKey.set(o.keyOf(rows[position].row, rows[position].index), height)\n from = from < 0 ? position : Math.min(from, position)\n }\n }\n if (from >= 0) {\n for (let i = from; i < heights.length; i++) {\n heights[i] = withGroup(i)\n }\n fillOffsets(heights, offsets, from)\n version.value++\n return true\n }\n return false\n }\n\n // ---- the window (C-83, C-85) ----------------------------------------------\n\n const range = shallowRef<WindowRange>({\n start: 0,\n end: Math.ceil((globalThis.innerHeight || 800) / 32) + 10\n })\n /** The window was computed from the layout at least once. */\n const ready = shallowRef(false)\n let container: Container | null = null\n let frame = 0\n /** The first visible item and its top before the window moved (C-84). */\n let anchor: { position: number; top: number } | null = null\n /**\n * The container's scroll position the window was computed for. The\n * browser's own scroll anchoring may move it when the drawn rows change\n * (it anchors to a spacer when no row is in view); it is put back.\n */\n let expected: number | null = null\n /** A `scrollToIndex` to correct once its row is drawn (C-87). */\n let pending: { position: number; align: Align; tries: number } | null = null\n /** Frames a `scrollToIndex` waits for its row before it is given up. */\n const pendingFrames = 6\n\n const viewport = () => {\n if (container === null || container === window) {\n return { top: 0, height: globalThis.innerHeight }\n }\n const element = container as HTMLElement\n return {\n top: element.getBoundingClientRect().top + element.clientTop,\n height: element.clientHeight\n }\n }\n\n /** Client top of the first center item: below the top-pinned rows. */\n const itemsTop = (tbody: HTMLElement) => {\n for (const tr of tbody.children) {\n if (tr.getAttribute('data-pinned-row') !== 'top') {\n return tr.getBoundingClientRect().top\n }\n }\n return tbody.getBoundingClientRect().bottom\n }\n\n const scrollTopOf = (target: Container) =>\n target === window ? window.scrollY : (target as HTMLElement).scrollTop\n\n // Always instant: with `scroll-behavior: smooth` on the container (or on\n // the root, for the window) a plain assignment animates, the position\n // read right after is the old one and the corrections land wrong.\n const scrollBy = (delta: number) => {\n if (Math.abs(delta) < 1 || !container) {\n return\n }\n container.scrollTo({\n top: scrollTopOf(container) + delta,\n behavior: 'instant'\n })\n }\n\n /** How far to scroll to show an item at `top` (client) with `height`. */\n const alignDelta = (\n top: number,\n height: number,\n align: Align,\n groupCover = 0\n ) => {\n const view = viewport()\n // A sticky header that covers the top of the container hides a row\n // aligned to the top; the row goes below it, and below a sticky group\n // row that covers it too (C-104).\n const head = o.table.value?.tHead?.getBoundingClientRect()\n const cover =\n head && head.top <= view.top + 1 && head.bottom > view.top\n ? head.bottom - view.top\n : 0\n const viewTop = view.top + cover + groupCover\n const viewBottom = view.top + view.height\n const bottom = top + height\n switch (align) {\n case 'start':\n return top - viewTop\n case 'end':\n return bottom - viewBottom\n case 'center':\n return (top + bottom - viewTop - viewBottom) / 2\n default:\n return top < viewTop\n ? top - viewTop\n : bottom > viewBottom\n ? bottom - viewBottom\n : 0\n }\n }\n\n /**\n * Height of a group row the consumer's CSS made sticky, which covers a\n * row aligned to the top of its group (C-104); `0` without one.\n */\n const stickyGroupCover = (tbody: HTMLElement) => {\n if (!groups.value) {\n return 0\n }\n // Sticky on the cell only: the window reads the row's place in the flow.\n const cell = tbody.querySelector(':scope > tr.qt-group-row > th')\n return cell && getComputedStyle(cell).position === 'sticky'\n ? cell.getBoundingClientRect().height\n : 0\n }\n /** The sticky cover over a row: only a grouped row that does not start its group. */\n const coverOf = (position: number, tbody: HTMLElement) => {\n const g = groups.value\n return g && g.groupOf[position] >= 0 && !startsGroup(position)\n ? stickyGroupCover(tbody)\n : 0\n }\n\n /** After a render: correct the drift (C-84) or a `scrollToIndex` (C-87). */\n const settle = () => {\n const tbody = body()\n if (!tbody) {\n return\n }\n if (expected !== null && container) {\n // Reading the position lays the page out, the browser's anchoring\n // adjustment included; undo it, the corrections below are ours.\n scrollBy(expected - scrollTopOf(container))\n expected = null\n }\n if (pending) {\n const tr = rowElement(tbody, pending.position)\n if (tr) {\n const { align, position } = pending\n pending = null\n // The first row of a group is shown with its group row above it.\n const above = startsGroup(position) ? tr.previousElementSibling : null\n const head = above?.classList.contains('qt-group-row') ? above : null\n scrollBy(\n alignDelta(\n (head ?? tr).getBoundingClientRect().top,\n itemHeight(tr) + (head ? head.getBoundingClientRect().height : 0),\n align,\n head ? 0 : coverOf(position, tbody)\n )\n )\n return\n }\n // Its row never got drawn (the container could not scroll that far,\n // say): give up, so the drift correction works again.\n if (++pending.tries <= pendingFrames) {\n schedule()\n return\n }\n pending = null\n }\n if (anchor) {\n const tr = rowElement(tbody, anchor.position)\n if (tr) {\n scrollBy(tr.getBoundingClientRect().top - anchor.top)\n }\n anchor = null\n }\n }\n\n const update = () => {\n frame = 0\n const tbody = body()\n if (!tbody || !container || printing.value) {\n return\n }\n measure(tbody)\n const view = viewport()\n const scrollTop = view.top - itemsTop(tbody)\n const next = computeWindow({\n offsets,\n scrollTop,\n viewportHeight: view.height,\n overscan: overscan()\n })\n ready.value = true\n const current = range.value\n if (next.start === current.start && next.end === current.end) {\n settle()\n return\n }\n if (!pending && fixed() === undefined) {\n // The item at the top of the view, or the nearest drawn one when a\n // fast scroll went past the drawn rows: the anchor must be drawn now.\n const position = Math.min(\n Math.max(indexAt(offsets, scrollTop), current.start),\n current.end - 1\n )\n const tr = position < 0 ? null : rowElement(tbody, position)\n anchor = tr ? { position, top: tr.getBoundingClientRect().top } : null\n }\n expected = scrollTopOf(container)\n range.value = next\n }\n\n const schedule = () => {\n if (!frame) {\n frame = requestAnimationFrame(update)\n }\n }\n\n // ---- printing (C-87) ------------------------------------------------------\n\n const printing = shallowRef(false)\n const startPrint = () => {\n printing.value = true\n }\n const endPrint = () => {\n printing.value = false\n schedule()\n }\n const onPrintMedia = (event: MediaQueryListEvent) => {\n if (event.matches) {\n startPrint()\n } else {\n endPrint()\n }\n }\n let printMedia: MediaQueryList | null = null\n\n // ---- focus (C-86) ---------------------------------------------------------\n\n const kept = shallowRef<{ row: T; position: number } | null>(null)\n\n /** The row index of the item (data row or subtable row) holding `target`. */\n const itemOf = (target: EventTarget | null, tbody: Element) => {\n let tr = (target as Element | null)?.closest?.('tr') ?? null\n while (tr && tr.parentElement !== tbody) {\n tr = tr.parentElement?.closest('tr') ?? null\n }\n if (tr?.classList.contains('qt-subtable-row')) {\n tr = tr.previousElementSibling as HTMLTableRowElement | null\n }\n const at = tr?.getAttribute('data-row-index')\n return !tr ||\n at === null ||\n at === undefined ||\n tr.hasAttribute('data-pinned-row')\n ? -1\n : positionOf(Number(at))\n }\n\n const onFocusIn = (event: FocusEvent) => {\n if (!enabled()) {\n return\n }\n const position = itemOf(event.target, event.currentTarget as Element)\n if (position >= 0) {\n kept.value = { row: center()[position].row, position }\n }\n }\n\n const onFocusOut = (event: FocusEvent) => {\n if (\n kept.value &&\n itemOf(event.relatedTarget, event.currentTarget as Element) !==\n kept.value.position\n ) {\n kept.value = null\n }\n }\n\n const keptPosition = () => {\n const focus = kept.value\n if (!focus) {\n return null\n }\n const rows = center()\n if (rows[focus.position]?.row === focus.row) {\n return focus.position\n }\n const found = rows.findIndex(row => row.row === focus.row)\n return found < 0 ? null : found\n }\n\n // ---- the drawn rows -------------------------------------------------------\n\n /** Open subtable rows before each row of `bodyRows`, and in all (C-86). */\n const expandedBefore = computed(() => {\n const all = enabled() ? parts.value.all : []\n const counts = new Int32Array(all.length + 1)\n for (let i = 0; i < all.length; i++) {\n counts[i + 1] =\n counts[i] + (o.isExpanded(all[i].row, all[i].index) ? 1 : 0)\n }\n return counts\n })\n\n /** Group rows drawn up to and with the center position (C-104). */\n const groupsThrough = (position: number) =>\n groups.value ? groups.value.headersThrough[position] : 0\n const groupCount = () => groups.value?.runs.length ?? 0\n\n const drawn = computed<Array<BodyItem<T>>>(() => {\n const { all, top } = parts.value\n const g = groups.value\n if (!enabled()) {\n if (!g) {\n return all\n }\n // Without `virtual` every group row is drawn above its first row.\n const out: Array<BodyItem<T>> = []\n for (let q = 0; q < all.length; q++) {\n const p = q - top\n if (p >= 0 && p < g.groupOf.length && startsGroup(p)) {\n out.push(groupRowOf(g.runs[g.groupOf[p]]))\n }\n out.push(all[q])\n }\n return out\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n version.value\n const rows = center()\n const before = expandedBefore.value\n // The header row is 1, the first body row 2; a group row counts as a\n // row, before the first row of its group (C-104).\n const headersBefore = (q: number) =>\n q < top\n ? 0\n : q < top + rows.length\n ? groupsThrough(q - top)\n : groupCount()\n const ariaOf = (q: number) => q + before[q] + headersBefore(q) + 2\n const at = (q: number): DrawnRow<T> => ({ ...all[q], aria: ariaOf(q) })\n const out: Array<BodyItem<T>> = []\n /** The group whose row was drawn last, or -1. */\n let drawnGroup = -1\n /** The center row at `p`, after its group row when it needs one. */\n const push = (p: number, carry: boolean) => {\n const group = g ? g.groupOf[p] : -1\n if (g && group >= 0 && group !== drawnGroup) {\n const run = g.runs[group]\n if (run.start === p) {\n out.push(groupRowOf(run, ariaOf(top + p) - 1))\n } else if (carry) {\n // The first row of the group is not drawn: its group row is drawn\n // here, with its height taken from the spacer above, so a sticky\n // group row stays while its group is in view (C-104).\n const last = out[out.length - 1]\n if (last && 'spacer' in last) {\n const height = Math.max(0, last.spacer - groupHeight())\n out[out.length - 1] = { spacer: height, key: last.key }\n }\n out.push(groupRowOf(run, ariaOf(top + run.start) - 1))\n }\n }\n drawnGroup = group\n out.push(at(top + p))\n }\n for (let q = 0; q < top; q++) {\n out.push(at(q))\n }\n if (printing.value) {\n for (let p = 0; p < rows.length; p++) {\n push(p, false)\n }\n } else {\n const end = Math.min(range.value.end, rows.length)\n const win = { start: Math.min(range.value.start, end), end }\n for (const segment of segmentsOf(offsets, win, keptPosition())) {\n if ('spacer' in segment) {\n out.push({ spacer: segment.spacer, key: spacerKeys[segment.slot] })\n } else {\n for (let p = segment.from; p < segment.to; p++) {\n push(p, p === segment.from)\n }\n }\n }\n }\n for (let q = top + rows.length; q < all.length; q++) {\n out.push(at(q))\n }\n // A spacer whose height went to a group row is not drawn.\n return g ? out.filter(item => !('spacer' in item) || item.spacer > 0) : out\n })\n\n // ---- the container and its listeners (C-85) -------------------------------\n\n let box: ResizeObserver | null = null\n let rowsObserver: ResizeObserver | null = null\n /**\n * Watches the table for coming into the layout: a table mounted inside\n * `display: none` has no scrolling ancestor yet, so the container is\n * looked for again once it has a size.\n */\n let shown: ResizeObserver | null = null\n let hadSize = false\n let watchedTable: HTMLTableElement | null = null\n const watchShown = (table: HTMLTableElement | null) => {\n if (table === watchedTable) {\n return\n }\n shown?.disconnect()\n shown = null\n watchedTable = table\n if (!table || typeof ResizeObserver === 'undefined') {\n return\n }\n hadSize = table.getBoundingClientRect().height > 0\n shown = new ResizeObserver(() => {\n const hasSize = table.getBoundingClientRect().height > 0\n if (hasSize !== hadSize) {\n hadSize = hasSize\n if (hasSize) {\n attach()\n }\n }\n })\n shown.observe(table)\n }\n const observed = new Set<Element>()\n let warned = false\n\n const findContainer = (table: HTMLTableElement): Container => {\n const given = settings.value?.scrollElement?.()\n if (given) {\n return given\n }\n for (\n let element = table.parentElement;\n element &&\n element !== document.body &&\n element !== document.documentElement;\n element = element.parentElement\n ) {\n const overflow = getComputedStyle(element).overflowY\n if (\n (overflow === 'auto' || overflow === 'scroll') &&\n element.scrollHeight > element.clientHeight\n ) {\n return element\n }\n }\n return window\n }\n\n const detach = () => {\n container?.removeEventListener('scroll', schedule)\n container = null\n box?.disconnect()\n box = null\n removeEventListener('resize', schedule)\n }\n\n const attach = () => {\n const table = o.table.value\n if (!table || !enabled()) {\n watchShown(null)\n detach()\n return\n }\n watchShown(table)\n const next = findContainer(table)\n if (next !== container) {\n detach()\n container = next\n next.addEventListener('scroll', schedule, { passive: true })\n addEventListener('resize', schedule)\n if (next !== window && typeof ResizeObserver !== 'undefined') {\n box = new ResizeObserver(schedule)\n box.observe(next as HTMLElement)\n }\n }\n if (\n !warned &&\n isDevelopment() &&\n getComputedStyle(table).tableLayout !== 'fixed'\n ) {\n warned = true\n console.warn(\n '[QueryTable] `virtual` with `table-layout: auto`: column widths follow the drawn rows. Set `table-layout: fixed` (C-85).'\n )\n }\n schedule()\n }\n\n /** Watches the drawn rows for size changes; measured on the next frame. */\n const observeRows = () => {\n const tbody = body()\n if (\n !tbody ||\n !enabled() ||\n fixed() !== undefined ||\n typeof ResizeObserver === 'undefined'\n ) {\n rowsObserver?.disconnect()\n observed.clear()\n return\n }\n rowsObserver ??= new ResizeObserver(schedule)\n for (const element of observed) {\n if (element.parentElement !== tbody) {\n rowsObserver.unobserve(element)\n observed.delete(element)\n }\n }\n for (const tr of tbody.children) {\n if (!observed.has(tr) && !tr.classList.contains('qt-virtual-spacer')) {\n rowsObserver.observe(tr)\n observed.add(tr)\n }\n }\n }\n\n watch(\n [\n () => parts.value.center,\n () => settings.value?.rowHeight,\n () => settings.value?.estimateRowHeight,\n () => settings.value?.groupRowHeight,\n // By shape, not identity: a `groupBy` given anew on each render with\n // the same runs does not rebuild the heights.\n () => groupShape(groups.value),\n enabled\n ],\n rebuild,\n { immediate: true }\n )\n\n // The container is looked for again when the rows change: a container\n // only scrolls once its content is taller than it.\n watch(\n [\n () => o.table.value,\n enabled,\n () => settings.value?.scrollElement,\n () => parts.value.center\n ],\n attach,\n { flush: 'post', immediate: true }\n )\n\n watch(\n drawn,\n () => {\n observeRows()\n settle()\n },\n { flush: 'post' }\n )\n\n watch(\n enabled,\n on => {\n printMedia?.removeEventListener('change', onPrintMedia)\n removeEventListener('beforeprint', startPrint)\n removeEventListener('afterprint', endPrint)\n printMedia = null\n if (on && typeof window !== 'undefined') {\n addEventListener('beforeprint', startPrint)\n addEventListener('afterprint', endPrint)\n printMedia = window.matchMedia?.('print') ?? null\n printMedia?.addEventListener('change', onPrintMedia)\n }\n },\n { immediate: true }\n )\n\n onBeforeUnmount(() => {\n detach()\n watchShown(null)\n cancelAnimationFrame(frame)\n rowsObserver?.disconnect()\n printMedia?.removeEventListener('change', onPrintMedia)\n removeEventListener('beforeprint', startPrint)\n removeEventListener('afterprint', endPrint)\n })\n\n // ---- scrollToIndex (C-87) -------------------------------------------------\n\n const scrollToIndex = (index: number, options: ScrollToIndexOptions = {}) => {\n const align = options.align ?? 'auto'\n const tbody = body()\n if (!tbody || !Number.isInteger(index) || index < 0) {\n return\n }\n const position =\n enabled() && container && !printing.value ? positionOf(index) : -1\n if (position < 0) {\n tbody\n .querySelector(`:scope > tr[data-row-index=\"${index}\"]`)\n ?.scrollIntoView({\n block: align === 'auto' ? 'nearest' : align,\n behavior: 'instant'\n })\n return\n }\n anchor = null\n pending = { position, align, tries: 0 }\n scrollBy(\n alignDelta(\n itemsTop(tbody) + offsets[position],\n heights[position],\n align,\n coverOf(position, tbody)\n )\n )\n schedule()\n }\n\n return {\n enabled,\n drawn,\n range,\n ready,\n centerCount: () => center().length,\n expandedCount: () => expandedBefore.value[expandedBefore.value.length - 1],\n /** Group rows of the body, drawn or not (C-104). */\n groupCount,\n scrollToIndex,\n onFocusIn,\n onFocusOut\n }\n}\n","<script\n setup\n lang=\"ts\"\n generic=\"T extends object, Q extends Query = TableQuery\"\n>\nimport { computed, getCurrentInstance, shallowRef, useSlots } from 'vue'\n\nimport { applyWidth, sideOf, type PinSide } from './columns/column-layout'\nimport type {\n CellSlotProps,\n HeaderSlotProps,\n LoadMoreSlotProps,\n Query,\n QueryTableExpose,\n TableEmits,\n TableProps,\n TableQuery,\n TableSlots,\n ToolbarSlotProps\n} from './contract'\nimport { resolveLabels } from './core/labels'\nimport { provideTableContext } from './core/table-context'\nimport { focusFilterOf } from './filter/focus-filter'\nimport { useChangeFlash } from './flash/use-change-flash'\nimport { useHeaderContextMenu } from './header/use-header-context-menu'\nimport TableBody from './parts/table-body.vue'\nimport TableFooter from './parts/table-footer.vue'\nimport TableHeader from './parts/table-header.vue'\nimport TablePagination from './parts/table-pagination.vue'\nimport { utilityKey, type Utility } from './pin/pin'\nimport { useHeaderGeometry } from './pin/use-header-geometry'\nimport { useColumnReorder } from './reorder/use-column-reorder'\nimport { measureColumnWidths } from './resize/measure-widths'\nimport { useAutoWidth } from './resize/use-auto-width'\nimport { useColumnResize } from './resize/use-column-resize'\nimport { useScrollBody } from './scroll/use-scroll-body'\nimport { useQueryTable } from './use-query-table'\nimport { useLoadMore } from './virtual/use-load-more'\nimport { useRowWindow } from './virtual/use-row-window'\n\ndefineOptions({ name: 'QueryTable' })\n\nconst props = withDefaults(defineProps<TableProps<T, Q>>(), {\n cursors: null,\n selection: undefined,\n rowPinning: undefined,\n searchDebounce: 300,\n rows: () => [],\n totalRows: null,\n footerRows: () => [],\n loading: false,\n sortable: false,\n filterable: false,\n resizable: false,\n autoWidth: false,\n autoWidthMax: undefined,\n reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n rowExpandable: undefined,\n rowKind: undefined,\n groupBy: undefined,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: false,\n scrollBody: false,\n infinite: false,\n flash: false,\n rowsUpdate: undefined\n})\n\nconst emit = defineEmits<TableEmits<T, Q>>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\n// Every piece of state lives in the composable; the component draws it. The\n// table never writes to its props.\nconst state = useQueryTable<T, Q>({\n query: () => props.query,\n columns: () => props.columns,\n rows: () => props.rows,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n sortable: () => props.sortable,\n filterDebounce: () => props.filterDebounce,\n searchDebounce: () => props.searchDebounce,\n selection: () => props.selection,\n rowPinning: () => props.rowPinning,\n rowKey: () => props.rowKey,\n hasSubtable: () => props.hasSubtable,\n rowExpandable: () => props.rowExpandable,\n pageSizeOptions: () => props.pagination?.pageSizeOptions,\n onQueryChange: (query, reason) => emit('update:query', query, reason),\n onSelectionChange: selection => emit('update:selection', selection),\n onColumnsChange: (columns, reason) => emit('update:columns', columns, reason),\n onRowPinningChange: rowPinning => emit('update:rowPinning', rowPinning)\n})\nconst { filters, sort, search, expansion } = state\nconst rowSelection = state.selection\nconst paginationProps = state.pagination\n\nconst labels = computed(() => resolveLabels(props.labels))\n\n// C-28 / C-96: the browser menu is suppressed only for a consumer that listens.\n// The check runs when the event fires: a listener is not a prop, so adding one\n// later does not re-render the table.\nconst instance = getCurrentInstance()\n// A `.once` listener arrives as `onCellContextMenuOnce` / `onHeaderContextMenuOnce`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\nconst hasHeaderContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(\n vnodeProps?.onHeaderContextMenu || vnodeProps?.onHeaderContextMenuOnce\n )\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\n\nconst { onContextMenu: onHeaderContextMenu } = useHeaderContextMenu({\n columns: () => visibleColumns.value,\n indexOf: field => entries.value.find(e => e.column.field === field)?.index,\n listening: () => hasHeaderContextMenuListener(),\n onContextMenu: payload => emit('headerContextMenu', payload)\n})\nconst hasPinned = state.hasPinned\n/** Right panel first, then subtable, then selection (C-22: the first hosts clear-all). */\nconst utilities = computed(() =>\n [\n props.hasRightPanel ? 'right-panel' : null,\n props.hasSubtable ? 'subtable' : null,\n rowSelection.enabled.value ? 'select' : null\n ].filter((name): name is Utility => name !== null)\n)\nconst utilityCount = computed(() => utilities.value.length)\nconst columnCount = computed(() => entries.value.length + utilityCount.value)\n\n/** Utilities are pinned only with a left-pinned column (C-46, C-71). */\nconst utilitySide = (): PinSide => (hasPinned.value ? 'left' : false)\n/** The table of the header: with `scrollBody` the first of three (C-101). */\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\n// With `scrollBody` the body rows have a table of their own, and the three\n// tables a wrapper each; without it the one table holds every part.\nconst bodyTableEl = shallowRef<HTMLTableElement | null>(null)\nconst headWrap = shallowRef<HTMLElement | null>(null)\nconst bodyWrap = shallowRef<HTMLElement | null>(null)\nconst footWrap = shallowRef<HTMLElement | null>(null)\n/** The table of the body rows. */\nconst bodyTable = computed(() => bodyTableEl.value ?? tableEl.value)\n/** With `scrollBody`, the body table to measure apart from the header. */\nconst splitBody = () => (props.scrollBody ? bodyTableEl.value : null)\nconst {\n widths,\n tableWidth,\n offsets,\n columns: cellWidths\n} = useHeaderGeometry({\n table: tableEl,\n cells: () => [\n ...utilities.value.map(utility => ({\n key: utilityKey(utility),\n side: utilitySide()\n })),\n ...entries.value.map(({ column }) => ({\n key: column.field,\n side: sideOf(column)\n }))\n ],\n active: () =>\n props.scrollBody ||\n entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\n/** The `col` widths of the body and footer tables (C-101), in pixels. */\nconst colWidths = computed(() =>\n Array.from({ length: columnCount.value }, (_, i) => cellWidths.value[i])\n)\nuseScrollBody({\n enabled: () => props.scrollBody,\n wrappers: () => ({\n head: headWrap.value,\n body: bodyWrap.value,\n foot: footWrap.value\n }),\n headTable: () => tableEl.value,\n bodyTable: () => bodyTableEl.value,\n colWidths: () => colWidths.value,\n rows: () => props.rows\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\n body: splitBody,\n // C-68: the width goes back as `columnResize`, then as the new `columns`.\n emit: payload => {\n emit('columnResize', payload)\n const next = applyWidth(props.columns, payload.field, `${payload.width}px`)\n if (next) {\n emit('update:columns', next, 'resize')\n }\n }\n})\n\n// Automatic widths of the columns without a width (C-100): drawn on the\n// header cells, never emitted.\nconst autoWidth = useAutoWidth({\n enabled: () => props.autoWidth,\n max: () => props.autoWidthMax,\n table: tableEl,\n body: splitBody,\n columns: () => visibleColumns.value,\n rows: () => props.rows,\n query: () => props.query,\n rowsUpdate: () => props.rowsUpdate\n})\n\n// The virtual body (C-83 to C-87) and infinite scroll (C-88 to C-90).\n// Without `virtual` the body draws `bodyRows` as they are; without\n// `infinite` nothing is asked for.\nconst rowWindow = useRowWindow<T>({\n virtual: () => props.virtual,\n table: bodyTable,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded,\n groupBy: () => props.groupBy\n})\nconst infinite = useLoadMore({\n infinite: () => props.infinite,\n rowKey: () => props.rowKey,\n rows: () => props.rows,\n query: () => props.query,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n loading: () => props.loading,\n nextPage: () => paginationProps.value.nextPage(),\n table: bodyTable,\n virtual: rowWindow.enabled,\n window: () =>\n rowWindow.ready.value\n ? { end: rowWindow.range.value.end, count: rowWindow.centerCount() }\n : null\n})\nconst loadMoreProps = computed<LoadMoreSlotProps | null>(() =>\n infinite.enabled.value\n ? {\n loadMore: infinite.loadMore,\n canLoadMore: infinite.canLoadMore.value,\n loading: props.loading\n }\n : null\n)\nconst footerCount = computed(() => props.footerRows.length)\n/** More to load in an infinite list: the count is not the rows given (C-86). */\nconst growing = () => infinite.enabled.value && infinite.canLoadMore.value\nconst ariaRowCount = computed(() => {\n if (!rowWindow.enabled()) {\n return undefined\n }\n const total = props.totalRows\n // The group rows of the pages still to load are unknown (C-104).\n if (growing() && (total === null || rowWindow.groupCount() > 0)) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return (\n 1 +\n rows +\n rowWindow.expandedCount() +\n rowWindow.groupCount() +\n footerCount.value\n )\n})\n/** `aria-rowindex` of the first footer row, or `undefined` (C-86). */\nconst footerRowIndex = computed(() =>\n !rowWindow.enabled() || growing()\n ? undefined\n : 2 + props.rows.length + rowWindow.expandedCount() + rowWindow.groupCount()\n)\n\n// The change flash (C-93 to C-95). Off, one watcher of `flash` and nothing\n// else; the body gets `null` and draws what it drew in 3.2.\nconst flashView = useChangeFlash<T>({\n flash: () => props.flash,\n rowsUpdate: () => props.rowsUpdate,\n rows: () => props.rows,\n query: () => props.query,\n loading: () => props.loading,\n fields: () => entries.value.map(entry => entry.column.field),\n rowKey: () => props.rowKey,\n table: bodyTable\n})\n\nconst reorder = useColumnReorder({\n reorderable: () => props.reorderable,\n table: tableEl,\n layout: state.layout,\n columns: () => props.columns\n})\n\nprovideTableContext({\n filters,\n sort,\n layout: state.layout,\n resize,\n reorder,\n selection: rowSelection,\n labels: () => labels.value\n})\n\nconst showPagination = computed(\n () =>\n !!slots.pagination &&\n (props.rows.length > 0 ||\n (props.totalRows ?? 0) > 0 ||\n (props.pagination?.alwaysShow ?? false))\n)\n\n// A computed, so a pending filter draft re-renders the root only when the\n// answer changes, not with every key typed.\nconst canClearFilters = computed(() => filters.canClearAll())\n\nconst toolbarProps = (): ToolbarSlotProps => ({\n canClearFilters: canClearFilters.value,\n clearFilters: () => {\n filters.clearAll()\n },\n search: search.text.value,\n setSearch: search.set,\n applySearch: () => {\n search.apply()\n }\n})\n\n// The slots `table-body` draws: only the ones the consumer gave are passed on,\n// so the body can tell whether a `cell-<field>` or `empty` slot exists.\nconst bodySlotNames = () =>\n Object.keys(rawSlots).filter(\n name =>\n name.startsWith('cell-') ||\n name === 'subtable' ||\n name === 'empty' ||\n name === 'loading' ||\n name === 'load-more' ||\n name === 'group'\n )\n// A string, so the header sees a changed prop only when the set changes;\n// one name per line, since a field name may hold a space.\nconst headerSlotNames = () =>\n Object.keys(rawSlots)\n .filter(\n name =>\n name.startsWith('header-') ||\n name === 'filter-datetime' ||\n name === 'filter-menu'\n )\n .sort()\n .join('\\n')\n// The `cell-<field>` slots the rows call, as one string: the body's cells\n// change only when the set changes (K311-3).\nconst cellSlotNames = () =>\n Object.keys(rawSlots)\n .filter(name => name.startsWith('cell-'))\n .sort()\n .join('\\n')\n\nconst exposed: QueryTableExpose = {\n collapseAll: expansion.collapseAll,\n expandAll: expansion.expandAll,\n focusFilter: field => focusFilterOf(tableEl.value, field),\n flushPendingFilters: () => {\n filters.flushAll()\n },\n scrollToIndex: rowWindow.scrollToIndex,\n loadMore: infinite.loadMore,\n measureColumnWidths: fields =>\n measureColumnWidths(tableEl.value, fields, splitBody())\n}\ndefineExpose(exposed)\n</script>\n\n<template>\n <div\n class=\"qt-datatable\"\n :data-empty=\"!loading && rows.length === 0 ? '' : undefined\"\n :data-loading=\"loading ? '' : undefined\"\n :aria-busy=\"loading ? 'true' : undefined\"\n >\n <slot name=\"toolbar\" v-bind=\"toolbarProps()\" />\n <div\n class=\"qt-table-responsive\"\n :role=\"scrollBody ? 'table' : undefined\"\n :aria-rowcount=\"scrollBody ? ariaRowCount : undefined\"\n >\n <!-- C-101: three tables, so the body scrolls under the header; the\n body and footer columns take the widths of the header cells. -->\n <template v-if=\"scrollBody\">\n <div ref=\"headWrap\" class=\"qt-table-head\">\n <table ref=\"tableEl\" class=\"qt-table\" role=\"presentation\">\n <thead role=\"rowgroup\" @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n roles\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n </table>\n </div>\n <div ref=\"bodyWrap\" class=\"qt-table-body\">\n <table ref=\"bodyTableEl\" class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n roles\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n </table>\n </div>\n <div v-if=\"footerRows.length > 0\" ref=\"footWrap\" class=\"qt-table-foot\">\n <table class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-footer\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n roles\n />\n </table>\n </div>\n </template>\n <table\n v-else\n ref=\"tableEl\"\n class=\"qt-table\"\n :aria-rowcount=\"ariaRowCount\"\n >\n <thead @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n <table-footer\n v-if=\"footerRows.length > 0\"\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n />\n </table>\n </div>\n <table-pagination v-if=\"showPagination\" :pagination-props=\"paginationProps\">\n <template #pagination=\"p\">\n <slot name=\"pagination\" v-bind=\"p\" />\n </template>\n </table-pagination>\n </div>\n</template>\n","<script\n setup\n lang=\"ts\"\n generic=\"T extends object, Q extends Query = TableQuery\"\n>\nimport { computed, getCurrentInstance, shallowRef, useSlots } from 'vue'\n\nimport { applyWidth, sideOf, type PinSide } from './columns/column-layout'\nimport type {\n CellSlotProps,\n HeaderSlotProps,\n LoadMoreSlotProps,\n Query,\n QueryTableExpose,\n TableEmits,\n TableProps,\n TableQuery,\n TableSlots,\n ToolbarSlotProps\n} from './contract'\nimport { resolveLabels } from './core/labels'\nimport { provideTableContext } from './core/table-context'\nimport { focusFilterOf } from './filter/focus-filter'\nimport { useChangeFlash } from './flash/use-change-flash'\nimport { useHeaderContextMenu } from './header/use-header-context-menu'\nimport TableBody from './parts/table-body.vue'\nimport TableFooter from './parts/table-footer.vue'\nimport TableHeader from './parts/table-header.vue'\nimport TablePagination from './parts/table-pagination.vue'\nimport { utilityKey, type Utility } from './pin/pin'\nimport { useHeaderGeometry } from './pin/use-header-geometry'\nimport { useColumnReorder } from './reorder/use-column-reorder'\nimport { measureColumnWidths } from './resize/measure-widths'\nimport { useAutoWidth } from './resize/use-auto-width'\nimport { useColumnResize } from './resize/use-column-resize'\nimport { useScrollBody } from './scroll/use-scroll-body'\nimport { useQueryTable } from './use-query-table'\nimport { useLoadMore } from './virtual/use-load-more'\nimport { useRowWindow } from './virtual/use-row-window'\n\ndefineOptions({ name: 'QueryTable' })\n\nconst props = withDefaults(defineProps<TableProps<T, Q>>(), {\n cursors: null,\n selection: undefined,\n rowPinning: undefined,\n searchDebounce: 300,\n rows: () => [],\n totalRows: null,\n footerRows: () => [],\n loading: false,\n sortable: false,\n filterable: false,\n resizable: false,\n autoWidth: false,\n autoWidthMax: undefined,\n reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n rowExpandable: undefined,\n rowKind: undefined,\n groupBy: undefined,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: false,\n scrollBody: false,\n infinite: false,\n flash: false,\n rowsUpdate: undefined\n})\n\nconst emit = defineEmits<TableEmits<T, Q>>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\n// Every piece of state lives in the composable; the component draws it. The\n// table never writes to its props.\nconst state = useQueryTable<T, Q>({\n query: () => props.query,\n columns: () => props.columns,\n rows: () => props.rows,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n sortable: () => props.sortable,\n filterDebounce: () => props.filterDebounce,\n searchDebounce: () => props.searchDebounce,\n selection: () => props.selection,\n rowPinning: () => props.rowPinning,\n rowKey: () => props.rowKey,\n hasSubtable: () => props.hasSubtable,\n rowExpandable: () => props.rowExpandable,\n pageSizeOptions: () => props.pagination?.pageSizeOptions,\n onQueryChange: (query, reason) => emit('update:query', query, reason),\n onSelectionChange: selection => emit('update:selection', selection),\n onColumnsChange: (columns, reason) => emit('update:columns', columns, reason),\n onRowPinningChange: rowPinning => emit('update:rowPinning', rowPinning)\n})\nconst { filters, sort, search, expansion } = state\nconst rowSelection = state.selection\nconst paginationProps = state.pagination\n\nconst labels = computed(() => resolveLabels(props.labels))\n\n// C-28 / C-96: the browser menu is suppressed only for a consumer that listens.\n// The check runs when the event fires: a listener is not a prop, so adding one\n// later does not re-render the table.\nconst instance = getCurrentInstance()\n// A `.once` listener arrives as `onCellContextMenuOnce` / `onHeaderContextMenuOnce`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\nconst hasHeaderContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(\n vnodeProps?.onHeaderContextMenu || vnodeProps?.onHeaderContextMenuOnce\n )\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\n\nconst { onContextMenu: onHeaderContextMenu } = useHeaderContextMenu({\n columns: () => visibleColumns.value,\n indexOf: field => entries.value.find(e => e.column.field === field)?.index,\n listening: () => hasHeaderContextMenuListener(),\n onContextMenu: payload => emit('headerContextMenu', payload)\n})\nconst hasPinned = state.hasPinned\n/** Right panel first, then subtable, then selection (C-22: the first hosts clear-all). */\nconst utilities = computed(() =>\n [\n props.hasRightPanel ? 'right-panel' : null,\n props.hasSubtable ? 'subtable' : null,\n rowSelection.enabled.value ? 'select' : null\n ].filter((name): name is Utility => name !== null)\n)\nconst utilityCount = computed(() => utilities.value.length)\nconst columnCount = computed(() => entries.value.length + utilityCount.value)\n\n/** Utilities are pinned only with a left-pinned column (C-46, C-71). */\nconst utilitySide = (): PinSide => (hasPinned.value ? 'left' : false)\n/** The table of the header: with `scrollBody` the first of three (C-101). */\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\n// With `scrollBody` the body rows have a table of their own, and the three\n// tables a wrapper each; without it the one table holds every part.\nconst bodyTableEl = shallowRef<HTMLTableElement | null>(null)\nconst headWrap = shallowRef<HTMLElement | null>(null)\nconst bodyWrap = shallowRef<HTMLElement | null>(null)\nconst footWrap = shallowRef<HTMLElement | null>(null)\n/** The table of the body rows. */\nconst bodyTable = computed(() => bodyTableEl.value ?? tableEl.value)\n/** With `scrollBody`, the body table to measure apart from the header. */\nconst splitBody = () => (props.scrollBody ? bodyTableEl.value : null)\nconst {\n widths,\n tableWidth,\n offsets,\n columns: cellWidths\n} = useHeaderGeometry({\n table: tableEl,\n cells: () => [\n ...utilities.value.map(utility => ({\n key: utilityKey(utility),\n side: utilitySide()\n })),\n ...entries.value.map(({ column }) => ({\n key: column.field,\n side: sideOf(column)\n }))\n ],\n active: () =>\n props.scrollBody ||\n entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\n/** The `col` widths of the body and footer tables (C-101), in pixels. */\nconst colWidths = computed(() =>\n Array.from({ length: columnCount.value }, (_, i) => cellWidths.value[i])\n)\nuseScrollBody({\n enabled: () => props.scrollBody,\n wrappers: () => ({\n head: headWrap.value,\n body: bodyWrap.value,\n foot: footWrap.value\n }),\n headTable: () => tableEl.value,\n bodyTable: () => bodyTableEl.value,\n colWidths: () => colWidths.value,\n rows: () => props.rows\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\n body: splitBody,\n // C-68: the width goes back as `columnResize`, then as the new `columns`.\n emit: payload => {\n emit('columnResize', payload)\n const next = applyWidth(props.columns, payload.field, `${payload.width}px`)\n if (next) {\n emit('update:columns', next, 'resize')\n }\n }\n})\n\n// Automatic widths of the columns without a width (C-100): drawn on the\n// header cells, never emitted.\nconst autoWidth = useAutoWidth({\n enabled: () => props.autoWidth,\n max: () => props.autoWidthMax,\n table: tableEl,\n body: splitBody,\n columns: () => visibleColumns.value,\n rows: () => props.rows,\n query: () => props.query,\n rowsUpdate: () => props.rowsUpdate\n})\n\n// The virtual body (C-83 to C-87) and infinite scroll (C-88 to C-90).\n// Without `virtual` the body draws `bodyRows` as they are; without\n// `infinite` nothing is asked for.\nconst rowWindow = useRowWindow<T>({\n virtual: () => props.virtual,\n table: bodyTable,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded,\n groupBy: () => props.groupBy\n})\nconst infinite = useLoadMore({\n infinite: () => props.infinite,\n rowKey: () => props.rowKey,\n rows: () => props.rows,\n query: () => props.query,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n loading: () => props.loading,\n nextPage: () => paginationProps.value.nextPage(),\n table: bodyTable,\n virtual: rowWindow.enabled,\n window: () =>\n rowWindow.ready.value\n ? { end: rowWindow.range.value.end, count: rowWindow.centerCount() }\n : null\n})\nconst loadMoreProps = computed<LoadMoreSlotProps | null>(() =>\n infinite.enabled.value\n ? {\n loadMore: infinite.loadMore,\n canLoadMore: infinite.canLoadMore.value,\n loading: props.loading\n }\n : null\n)\nconst footerCount = computed(() => props.footerRows.length)\n/** More to load in an infinite list: the count is not the rows given (C-86). */\nconst growing = () => infinite.enabled.value && infinite.canLoadMore.value\nconst ariaRowCount = computed(() => {\n if (!rowWindow.enabled()) {\n return undefined\n }\n const total = props.totalRows\n // The group rows of the pages still to load are unknown (C-104).\n if (growing() && (total === null || rowWindow.groupCount() > 0)) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return (\n 1 +\n rows +\n rowWindow.expandedCount() +\n rowWindow.groupCount() +\n footerCount.value\n )\n})\n/** `aria-rowindex` of the first footer row, or `undefined` (C-86). */\nconst footerRowIndex = computed(() =>\n !rowWindow.enabled() || growing()\n ? undefined\n : 2 + props.rows.length + rowWindow.expandedCount() + rowWindow.groupCount()\n)\n\n// The change flash (C-93 to C-95). Off, one watcher of `flash` and nothing\n// else; the body gets `null` and draws what it drew in 3.2.\nconst flashView = useChangeFlash<T>({\n flash: () => props.flash,\n rowsUpdate: () => props.rowsUpdate,\n rows: () => props.rows,\n query: () => props.query,\n loading: () => props.loading,\n fields: () => entries.value.map(entry => entry.column.field),\n rowKey: () => props.rowKey,\n table: bodyTable\n})\n\nconst reorder = useColumnReorder({\n reorderable: () => props.reorderable,\n table: tableEl,\n layout: state.layout,\n columns: () => props.columns\n})\n\nprovideTableContext({\n filters,\n sort,\n layout: state.layout,\n resize,\n reorder,\n selection: rowSelection,\n labels: () => labels.value\n})\n\nconst showPagination = computed(\n () =>\n !!slots.pagination &&\n (props.rows.length > 0 ||\n (props.totalRows ?? 0) > 0 ||\n (props.pagination?.alwaysShow ?? false))\n)\n\n// A computed, so a pending filter draft re-renders the root only when the\n// answer changes, not with every key typed.\nconst canClearFilters = computed(() => filters.canClearAll())\n\nconst toolbarProps = (): ToolbarSlotProps => ({\n canClearFilters: canClearFilters.value,\n clearFilters: () => {\n filters.clearAll()\n },\n search: search.text.value,\n setSearch: search.set,\n applySearch: () => {\n search.apply()\n }\n})\n\n// The slots `table-body` draws: only the ones the consumer gave are passed on,\n// so the body can tell whether a `cell-<field>` or `empty` slot exists.\nconst bodySlotNames = () =>\n Object.keys(rawSlots).filter(\n name =>\n name.startsWith('cell-') ||\n name === 'subtable' ||\n name === 'empty' ||\n name === 'loading' ||\n name === 'load-more' ||\n name === 'group'\n )\n// A string, so the header sees a changed prop only when the set changes;\n// one name per line, since a field name may hold a space.\nconst headerSlotNames = () =>\n Object.keys(rawSlots)\n .filter(\n name =>\n name.startsWith('header-') ||\n name === 'filter-datetime' ||\n name === 'filter-menu'\n )\n .sort()\n .join('\\n')\n// The `cell-<field>` slots the rows call, as one string: the body's cells\n// change only when the set changes (K311-3).\nconst cellSlotNames = () =>\n Object.keys(rawSlots)\n .filter(name => name.startsWith('cell-'))\n .sort()\n .join('\\n')\n\nconst exposed: QueryTableExpose = {\n collapseAll: expansion.collapseAll,\n expandAll: expansion.expandAll,\n focusFilter: field => focusFilterOf(tableEl.value, field),\n flushPendingFilters: () => {\n filters.flushAll()\n },\n scrollToIndex: rowWindow.scrollToIndex,\n loadMore: infinite.loadMore,\n measureColumnWidths: fields =>\n measureColumnWidths(tableEl.value, fields, splitBody())\n}\ndefineExpose(exposed)\n</script>\n\n<template>\n <div\n class=\"qt-datatable\"\n :data-empty=\"!loading && rows.length === 0 ? '' : undefined\"\n :data-loading=\"loading ? '' : undefined\"\n :aria-busy=\"loading ? 'true' : undefined\"\n >\n <slot name=\"toolbar\" v-bind=\"toolbarProps()\" />\n <div\n class=\"qt-table-responsive\"\n :role=\"scrollBody ? 'table' : undefined\"\n :aria-rowcount=\"scrollBody ? ariaRowCount : undefined\"\n >\n <!-- C-101: three tables, so the body scrolls under the header; the\n body and footer columns take the widths of the header cells. -->\n <template v-if=\"scrollBody\">\n <div ref=\"headWrap\" class=\"qt-table-head\">\n <table ref=\"tableEl\" class=\"qt-table\" role=\"presentation\">\n <thead role=\"rowgroup\" @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n roles\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n </table>\n </div>\n <div ref=\"bodyWrap\" class=\"qt-table-body\">\n <table ref=\"bodyTableEl\" class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n roles\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n </table>\n </div>\n <div v-if=\"footerRows.length > 0\" ref=\"footWrap\" class=\"qt-table-foot\">\n <table class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-footer\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n roles\n />\n </table>\n </div>\n </template>\n <table\n v-else\n ref=\"tableEl\"\n class=\"qt-table\"\n :aria-rowcount=\"ariaRowCount\"\n >\n <thead @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n <table-footer\n v-if=\"footerRows.length > 0\"\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n />\n </table>\n </div>\n <table-pagination v-if=\"showPagination\" :pagination-props=\"paginationProps\">\n <template #pagination=\"p\">\n <slot name=\"pagination\" v-bind=\"p\" />\n </template>\n </table-pagination>\n </div>\n</template>\n","import { parseFilterInput as parse } from '@dolusoft/query-protocol'\n\nimport type { Column, FilterCondition, FilterRule } from '../contract'\n\n/**\n * The rules the table emits when `text` is typed into the filter input of\n * `column` (C-53): the same grammar and the same coercion per column type.\n *\n * - `string`: operator shortcuts (`*a*`, `a*`, `*a`, `!a`, `!*a*`, `a,b`);\n * a segment without an operator uses `condition`.\n * - `number`: one rule with a number value; text that is not a finite number\n * gives `[]`.\n * - `integer`: the same, but only a whole number in the safe range; `2.5`\n * and `9007199254740993` give `[]`.\n * - `bool`: `'true'` or `'false'` gives one rule with a boolean value;\n * anything else gives `[]`.\n * - `date` and `datetime`: one rule with the trimmed text as its value; the\n * text is not validated, as the input already gives an ISO date.\n *\n * `condition` is the one picked in the filter menu; without it the column\n * type's default applies (`Contains` for text, `Equal` otherwise). Empty or\n * blank text, and text that is only operators (`*`, `!`, `!*`), gives `[]`.\n * Invalid input never throws. Pure: no Vue, no DOM; the column is not written.\n * The grammar is the protocol's (`@dolusoft/query-protocol`).\n */\nexport function parseFilterInput(\n text: string,\n column: Column,\n condition: FilterCondition | null = null\n): FilterRule[] {\n return parse(text, column, condition)\n}\n","import QueryTable from './query-table.vue'\n\nexport { QueryTable }\nexport default QueryTable\n\nexport { parseFilterInput } from './filter/parse-filter-input'\nexport {\n useQueryTable,\n type BodyRow,\n type ColumnEntry,\n type QueryTable as QueryTableState,\n type QueryTableExpansion,\n type QueryTableFeatures,\n type QueryTableFilters,\n type QueryTableLayout,\n type QueryTableRowPinning,\n type QueryTableSearch,\n type QueryTableSelection,\n type QueryTableSort,\n type RowKey,\n type UseQueryTableOptions\n} from './use-query-table'\n\nexport type * from './contract'\n"],"mappings":";;;;;;AAUA,IAAa,UAAU,WACrB,OAAO,WAAW,SACd,SACA,OAAO,WAAW,UAChB,UACA;;AAGR,IAAM,WAAW,QAAgB,QAAmC;CAClE,MAAM,OAAO,EAAE,GAAG,OAAO;CACzB,OAAO,KAAK;CACZ,OAAO;AACT;;AAGA,IAAa,mBACX,SACA,eACoB;CACpB,IAAI,UAAU;CACd,MAAM,OAAO,QAAQ,KAAI,WAAU;EACjC,MAAM,UAAU,WAAW,OAAO,UAAU;EAC5C,IAAI,YAAY,CAAC,OAAO,MACtB,OAAO;EAET,UAAU;EACV,OAAO,UAAU,QAAQ,QAAQ,MAAM,IAAI;GAAE,GAAG;GAAQ,MAAM;EAAK;CACrE,CAAC;CACD,OAAO,UAAU,OAAO;AAC1B;;AAGA,IAAa,cACX,SACA,UACoB;CACpB,MAAM,UAAU,IAAI,IAAI,QAAQ,KAAI,WAAU,CA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mBAAiB,eAAA;;;;;;;;;;IAIA,eAAA,SAAxBP,UAAA,GAAAiB,YAImBC,0BAAA;;KAJsB,oBAAkBX,MAAA,eAAA;;KAC9C,YAAUG,SAAE,MAAC,CACtBR,WAAqC,KAAA,QAAA,cAAAC,eAAAC,mBAAL,CAAC,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AExjBzC,SAAgB,iBACd,MACA,QACA,YAAoC,MACtB;CACd,OAAOgB,mBAAM,MAAM,QAAQ,SAAS;AACtC;;;AC5BA,IAAA,cAAeC"}
|
|
1
|
+
{"version":3,"file":"query-table.js","names":["focusable","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_useSlots","columnTypeOf","_openBlock","_createElementBlock","_unref","_Fragment","_renderList","_normalizeStyle","_createElementVNode","_mergeProps","_renderSlot","_createTextVNode","_toDisplayString","_createBlock","_createCommentVNode","_normalizeProps","_guardReactiveProps","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_unref","_createCommentVNode","columnTypeOf","_toDisplayString","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_createElementVNode","_sfc_main","IconFilter","$slots","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_openBlock","_createElementBlock","_Fragment","_renderList","_renderSlot","_mergeProps","_unref","_withKeys","_createElementVNode","_toDisplayString","_normalizeProps","_guardReactiveProps","_createCommentVNode","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_mergeProps","_unref","_toHandlers","_createStaticVNode","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_mergeProps","_unref","_toHandlers","_sfc_main","$emit","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_createTextVNode","_toDisplayString","_createElementVNode","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_createElementVNode","_unref","_withModifiers","columnTypeOf","_createBlock","ReorderHandle","_createCommentVNode","_renderSlot","SortButton","_toDisplayString","FilterCell","_createSlots","_withCtx","ResizeHandle","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_sfc_main","isDevelopment","_useSlots","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_Fragment","_unref","_createVNode","TableHeader","_withCtx","_renderList","_normalizeStyle","TableBody","_mergeProps","_toHandlers","_createSlots","TableFooter","_createCommentVNode","_createBlock","TablePagination","_sfc_main","parse","QueryTable"],"sources":["../src/body/use-row-navigation.ts","../src/columns/column-layout.ts","../src/core/labels.ts","../src/core/table-context.ts","../src/filter/focus-filter.ts","../src/flash/marks.ts","../src/flash/read-duration.ts","../src/flash/use-change-flash.ts","../src/header/use-header-context-menu.ts","../src/core/column.ts","../src/body/use-cell-view.ts","../src/parts/table-row.ts","../src/pin/pin.ts","../src/parts/table-body.vue","../src/parts/table-body.vue","../src/parts/table-footer.vue","../src/parts/table-footer.vue","../src/parts/filter-icon.vue","../src/parts/filter-icon.vue","../src/filter/use-filter-trigger.ts","../src/parts/filter-cell.vue","../src/parts/filter-cell.vue","../src/parts/reorder-handle.vue","../src/parts/reorder-handle.vue","../src/resize/measure-widths.ts","../src/resize/width-scale.ts","../src/resize/use-column-resize.ts","../src/parts/resize-handle.vue","../src/parts/resize-handle.vue","../src/parts/sort-button.vue","../src/parts/sort-button.vue","../src/sort/sort.ts","../src/parts/table-header.vue","../src/parts/table-header.vue","../src/parts/table-pagination.vue","../src/parts/table-pagination.vue","../src/pin/use-header-geometry.ts","../src/reorder/use-column-reorder.ts","../src/resize/use-auto-width.ts","../src/scroll/use-scroll-body.ts","../src/use-query-table.ts","../src/virtual/use-load-more.ts","../src/body/group-runs.ts","../src/virtual/compute-window.ts","../src/virtual/use-row-window.ts","../src/query-table.vue","../src/query-table.vue","../src/filter/parse-filter-input.ts","../src/index.ts"],"sourcesContent":["import { computed, onBeforeUnmount, type Ref } from 'vue'\n\nimport type {\n RowFocusPayload,\n RowNavigationOptions,\n ScrollToIndexOptions\n} from '../contract'\nimport type { BodyRow } from '../use-query-table'\n\ntype NavigationKey = RowFocusPayload<object>['key']\n\nexport interface UseRowNavigationOptions<T extends object> {\n rowNavigation: () => boolean | RowNavigationOptions<T> | undefined\n /** The body table: its first `tbody` holds the rows. */\n table: Readonly<Ref<HTMLTableElement | null>>\n /** The rows in drawing order: pinned top, the others, pinned bottom (C-74). */\n bodyRows: () => BodyRow<T>[]\n keyOf: (row: T, index: number) => string | number\n /**\n * `rowKey` is given: a move finds its row by key. Without it the key is\n * the index, so the row is found by its object instead (as C-86 does).\n */\n hasRowKey: () => boolean\n /** The body is virtual (C-83): a row out of the window is not drawn. */\n virtual: () => boolean\n scrollToIndex: (index: number, options?: ScrollToIndexOptions) => void\n /** Shows a drawn row whole, below the sticky covers (C-110). */\n reveal: (index: number) => void\n /** The window still has a scroll or a render to do (C-110). */\n busy: () => boolean\n onFocus: (payload: RowFocusPayload<T>) => void\n}\n\n/**\n * The first focusable element of a row, when no `focus` selector is given.\n * Controls that use the arrow keys themselves (text fields, `select`, radio\n * buttons, editable content) are left out: they keep their keys (C-109).\n */\nconst focusable = [\n 'a[href]',\n 'button:not([disabled])',\n 'input[type=\"checkbox\"]:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"]):not(input, select, textarea, [contenteditable])'\n].join(', ')\n\nconst keys = new Set<string>(['ArrowUp', 'ArrowDown', 'Home', 'End'])\n\n/** Frames a move waits for its row to be drawn and to keep the focus. */\nconst maxFrames = 30\n/** Frames the focus must stay on the target before a move is done. */\nconst keepFrames = 2\n\ninterface Move {\n /** The key of the row the focus goes to. */\n key: string | number\n /** Its row object: the identity when there is no `rowKey`. */\n row: object\n /** The key the user pressed, for `rowFocus`. */\n pressed: NavigationKey\n /** The element that had the focus when the key was pressed. */\n origin: Element\n /** The focus target the move put the focus on, once it did. */\n landed: HTMLElement | null\n frames: number\n kept: number\n}\n\n/**\n * Keyboard navigation between the data rows (C-109 to C-111): one `keydown`\n * listener on the `tbody`, only while `rowNavigation` is on. A move goes by\n * the row's key, not its index: the rows may change while a virtual body\n * draws the row (C-110), and the focus is put back when moving DOM nodes\n * drops it.\n */\nexport const useRowNavigation = <T extends object>(\n o: UseRowNavigationOptions<T>\n) => {\n const settings = computed<RowNavigationOptions<T> | null>(() => {\n const value = o.rowNavigation()\n return value === true ? {} : value || null\n })\n const enabled = () => settings.value !== null\n\n const body = () => o.table.value?.tBodies[0] ?? null\n\n /** The focus target of a drawn row, or `null`. */\n const targetOf = (tr: Element) =>\n tr.querySelector<HTMLElement>(settings.value?.focus ?? focusable)\n\n /** The data row of the body that holds `element`, or `null`. */\n const rowOf = (element: Element | null, tbody: Element) => {\n let tr = element?.closest?.('tr') ?? null\n while (tr && tr.parentElement !== tbody) {\n tr = tr.parentElement?.closest('tr') ?? null\n }\n return tr?.hasAttribute('data-row-index') ? tr : null\n }\n\n /** Position in drawing order of the move's row, or -1. */\n const positionOf = (rows: BodyRow<T>[], m: Move) =>\n o.hasRowKey()\n ? rows.findIndex(item => o.keyOf(item.row, item.index) === m.key)\n : rows.findIndex(item => item.row === m.row)\n\n /** The next stop from `from` for `key`: a row `skip` does not name. */\n const stopFrom = (rows: BodyRow<T>[], from: number, key: string) => {\n const skip = settings.value?.skip\n const stop = (p: number) => !skip || !skip(rows[p].row, rows[p].index)\n const step = key === 'ArrowUp' || key === 'End' ? -1 : 1\n let p = key === 'Home' ? 0 : key === 'End' ? rows.length - 1 : from + step\n while (p >= 0 && p < rows.length && !stop(p)) {\n p += step\n }\n return p >= 0 && p < rows.length ? p : -1\n }\n\n let move: Move | null = null\n let frame = 0\n\n const stop = () => {\n move = null\n cancelAnimationFrame(frame)\n frame = 0\n removeEventListener('pointerdown', stop, true)\n }\n\n const again = () => {\n if (!frame) {\n frame = requestAnimationFrame(tick)\n }\n }\n\n /**\n * The focus is where the move left it, or nowhere: a click or a script\n * that moved it elsewhere ends the move.\n */\n const free = (m: Move) => {\n const active = document.activeElement\n return (\n !active ||\n active === document.body ||\n active === m.origin ||\n active === m.landed ||\n !active.isConnected\n )\n }\n\n /**\n * Puts the focus on the move's row; `true` when it has it. A row of a\n * virtual body that is not drawn is scrolled to (C-110): again when the\n * window dropped the scroll because `rows` changed (C-87), and right away\n * with `scroll`.\n */\n const land = (m: Move, scroll = false): boolean => {\n const tbody = body()\n const rows = o.bodyRows()\n const p = positionOf(rows, m)\n if (!tbody || p < 0) {\n stop()\n return false\n }\n const { index, pinned } = rows[p]\n const tr = tbody.querySelector(`:scope > tr[data-row-index=\"${index}\"]`)\n if (!tr) {\n if (o.virtual() && !pinned && (scroll || !o.busy())) {\n o.scrollToIndex(index, { align: 'auto' })\n }\n return false\n }\n const target = targetOf(tr)\n if (!target) {\n // A row with no focus target: the move ends where it is (C-109).\n stop()\n return false\n }\n // The table scrolls the row in itself, below the sticky covers.\n target.focus({ preventScroll: true })\n if (document.activeElement !== target) {\n return false\n }\n const first = m.landed === null\n m.landed = target\n if (first) {\n o.reveal(index)\n o.onFocus({ row: rows[p].row, rowIndex: index, key: m.pressed })\n }\n return true\n }\n\n function tick() {\n frame = 0\n const m = move\n if (!m) {\n return\n }\n if (++m.frames > maxFrames || !free(m)) {\n stop()\n return\n }\n if (m.landed && document.activeElement === m.landed) {\n // Moving DOM nodes can drop the focus (Chrome): it is watched for a\n // few frames after it landed, counted while the window is idle (the\n // scroll of `reveal` makes it draw again), and put back (C-110).\n if (!o.busy() && ++m.kept >= keepFrames) {\n stop()\n return\n }\n again()\n return\n }\n if (!o.busy()) {\n land(m)\n }\n if (move) {\n again()\n }\n }\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (\n !enabled() ||\n !keys.has(event.key) ||\n event.defaultPrevented ||\n event.isComposing ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return\n }\n const tbody = event.currentTarget as Element\n const target = event.target as Element | null\n // A move still waiting for its row: the key moves on from that row.\n const waiting = move && !move.landed && target === move.origin ? move : null\n const tr = rowOf(target, tbody)\n if (!waiting && (!tr || targetOf(tr) !== target)) {\n return\n }\n const rows = o.bodyRows()\n const from = waiting\n ? positionOf(rows, waiting)\n : rows.findIndex(\n item => item.index === Number(tr!.getAttribute('data-row-index'))\n )\n if (from < 0) {\n return\n }\n event.preventDefault()\n const to = stopFrom(rows, from, event.key)\n if (to < 0 || to === from) {\n return\n }\n stop()\n const { row, index } = rows[to]\n const m: Move = {\n key: o.keyOf(row, index),\n row,\n pressed: event.key as NavigationKey,\n origin: waiting ? waiting.origin : target!,\n landed: null,\n frames: 0,\n kept: 0\n }\n move = m\n // A click anywhere, the origin included, ends the move (C-110).\n addEventListener('pointerdown', stop, true)\n land(m, true)\n if (move) {\n again()\n }\n }\n\n onBeforeUnmount(stop)\n\n return { enabled, onKeyDown }\n}\n","// The column layout as data (ADR 0007, C-67 to C-70): the consumer's\n// `columns` owns visibility (`hide`), order (the array) and pinning\n// (`pinned`). TanStack's slices are projected from it, and its updates come\n// back here to become a new `columns` array: changed columns are new\n// objects, the others stay the consumer's.\nimport type { Column } from '../contract'\n\n/** Side a column is pinned to; `false` when it is not pinned. */\nexport type PinSide = 'left' | 'right' | false\n\nexport const sideOf = (column: Column): PinSide =>\n column.pinned === 'left'\n ? 'left'\n : column.pinned === 'right'\n ? 'right'\n : false\n\n/** A copy of `column` without `key`: a default is removed, never set (C-68). */\nconst without = (column: Column, key: 'hide' | 'pinned'): Column => {\n const copy = { ...column }\n delete copy[key]\n return copy\n}\n\n/** The columns with the visibility of `visibility`; `null` when nothing changes. */\nexport const applyVisibility = (\n columns: Column[],\n visibility: Record<string, boolean>\n): Column[] | null => {\n let changed = false\n const next = columns.map(column => {\n const visible = visibility[column.field] ?? true\n if (visible === !column.hide) {\n return column\n }\n changed = true\n return visible ? without(column, 'hide') : { ...column, hide: true }\n })\n return changed ? next : null\n}\n\n/** The columns in `order` (unknown fields skipped, missing ones kept last); `null` when unchanged. */\nexport const applyOrder = (\n columns: Column[],\n order: string[]\n): Column[] | null => {\n const byField = new Map(columns.map(column => [column.field, column]))\n const placed = new Set<string>()\n const next: Column[] = []\n for (const field of order) {\n const column = byField.get(field)\n if (column && !placed.has(field)) {\n placed.add(field)\n next.push(column)\n }\n }\n next.push(...columns.filter(column => !placed.has(column.field)))\n return next.every((column, index) => column === columns[index]) ? null : next\n}\n\n/** The columns with the sides of `pinning` (start = left, end = right); `null` when unchanged. */\nexport const applyPinning = (\n columns: Column[],\n pinning: { start?: string[]; end?: string[] }\n): Column[] | null => {\n const left = new Set(pinning.start ?? [])\n const right = new Set(pinning.end ?? [])\n let changed = false\n const next = columns.map(column => {\n const side: PinSide = left.has(column.field)\n ? 'left'\n : right.has(column.field)\n ? 'right'\n : false\n if (side === sideOf(column)) {\n return column\n }\n changed = true\n return side ? { ...column, pinned: side } : without(column, 'pinned')\n })\n return changed ? next : null\n}\n\n/** The columns with `field` at `width`; `null` when it already has it. */\nexport const applyWidth = (\n columns: Column[],\n field: string,\n width: string\n): Column[] | null => {\n const at = columns.findIndex(column => column.field === field)\n if (at < 0 || columns[at].width === width) {\n return null\n }\n const next = [...columns]\n next[at] = { ...columns[at], width }\n return next\n}\n\n/**\n * `field` taken out and put right before or after `target` (C-69): the\n * columns between keep their place, hidden ones included.\n */\nexport const moveField = (\n fields: string[],\n field: string,\n target: string,\n place: 'before' | 'after'\n): string[] => {\n if (field === target || !fields.includes(field)) {\n return fields\n }\n const rest = fields.filter(name => name !== field)\n const at = rest.indexOf(target)\n if (at < 0) {\n return fields\n }\n rest.splice(place === 'before' ? at : at + 1, 0, field)\n return rest\n}\n","import { conditionLabel } from '@dolusoft/query-protocol'\n\nimport type { Column, TableLabels } from '../contract'\n\n/** The labels the table reads: every entry filled, the optional ones too. */\nexport type ResolvedLabels = Required<TableLabels>\n\n/** English defaults of the `labels` prop (C-44). */\nconst defaultLabels: ResolvedLabels = {\n clearAllFilters: 'Clear all filters',\n expandRow: 'Expand row',\n openRightPanel: 'Open right panel',\n filterInput: column => `Filter ${column}`,\n filterInputFrom: column => `Filter ${column} from`,\n filterInputTo: column => `Filter ${column} to`,\n filterOptions: column => `Filter options for ${column}`,\n resizeColumn: column => `Resize ${column}`,\n moveColumn: column => `Move ${column}`,\n filterCondition: (condition, type) => conditionLabel(type, condition),\n boolAll: 'All',\n boolTrue: 'True',\n boolFalse: 'False',\n selectRow: 'Select row',\n selectAllRows: 'Select all rows'\n}\n\nexport const resolveLabels = (\n labels: Partial<TableLabels> | undefined\n): ResolvedLabels => ({ ...defaultLabels, ...labels })\n\n/** The name of a column in a label: its `title`, else its `field`. */\nexport const columnName = (column: Column) => column.title || column.field\n","import { inject, provide, type InjectionKey } from 'vue'\n\nimport type { ResolvedLabels } from './labels'\nimport type { ColumnReorder } from '../reorder/use-column-reorder'\nimport type { ColumnResize } from '../resize/use-column-resize'\nimport type {\n QueryTableFilters,\n QueryTableLayout,\n QueryTableSelection,\n QueryTableSort\n} from '../use-query-table'\n\n/**\n * What the header parts call: the filter inputs, the sort gate and the\n * layout actions of the composable, the resize and reorder actions and the\n * labels. Only actions and getters travel here; data (`columns`, `query`)\n * comes down as props.\n */\nexport interface TableContext {\n filters: QueryTableFilters\n sort: QueryTableSort\n /** The `control` of the header and filter-menu slots (C-70). */\n layout: QueryTableLayout\n resize: ColumnResize\n /** The reorder handles: drag, keys and the drag preview (C-73). */\n reorder: ColumnReorder\n /** The select-all checkbox of the selection column (C-59). */\n selection: Pick<\n QueryTableSelection<object>,\n 'allSelected' | 'someSelected' | 'toggleAll'\n >\n labels: () => ResolvedLabels\n}\n\nconst tableContextKey: InjectionKey<TableContext> = Symbol('query-table')\n\nexport const provideTableContext = (context: TableContext) => {\n provide(tableContextKey, context)\n}\n\nexport const useTableContext = (): TableContext => {\n const context = inject(tableContextKey)\n if (!context) {\n throw new Error('Header parts must be rendered inside a QueryTable')\n }\n return context\n}\n","// Elements of a filter row that can take focus, in the order they are drawn:\n// the table's own input or select, or what the `filter-datetime` slot draws.\n// The `filter-menu` trigger is a menu button, not the filter itself.\nconst focusable =\n 'input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\n/**\n * Focuses the filter of `field` in this table's own header (C-54). Header\n * cells are walked directly, so a table nested in a slot is never searched.\n * Returns whether the element took focus.\n */\nexport const focusFilterOf = (\n table: HTMLTableElement | null,\n field: string\n): boolean => {\n const head = [...(table?.children ?? [])].find(\n child => child.tagName === 'THEAD'\n )\n for (const row of head?.children ?? []) {\n for (const cell of row.children) {\n if (cell.getAttribute('data-field') !== field) {\n continue\n }\n const filter = [...cell.children].find(child =>\n child.classList.contains('qt-filter')\n )\n const target = [\n ...(filter?.querySelectorAll<HTMLElement>(focusable) ?? [])\n ].find(element => !element.classList.contains('qt-filter-button'))\n if (!target) {\n return false\n }\n target.focus()\n return target.ownerDocument.activeElement === target\n }\n }\n return false\n}\n\n/**\n * Focuses the first filter of this table's header that takes the focus, in\n * column order (C-22). Returns whether one did.\n */\nexport const focusFirstFilter = (table: HTMLTableElement | null): boolean => {\n const head = [...(table?.children ?? [])].find(\n child => child.tagName === 'THEAD'\n )\n for (const row of head?.children ?? []) {\n for (const cell of row.children) {\n const field = cell.getAttribute('data-field')\n if (field !== null && focusFilterOf(table, field)) {\n return true\n }\n }\n }\n return false\n}\n","import type { RowChangeKey } from '@dolusoft/query-table-core/row-changes'\n\n/** The value of `data-flash`: a new value restarts the CSS animation. */\nexport type FlashPhase = 'a' | 'b'\n\n/**\n * One running flash. Updated in place when it restarts, so a stream of\n * changes allocates nothing per change (C-94).\n */\nexport interface Mark {\n /** `performance.now()` when the flash began. */\n start: number\n /** `start` plus the duration: from then on the mark is not drawn. */\n end: number\n /** Bumped on every start or restart: the identity of this flash. */\n gen: number\n phase: FlashPhase\n /** The frame the phase last changed in: one change per frame. */\n flipFrame: number\n}\n\n/** The marks of one row key: the row flash and the cell flashes by field. */\nexport interface RowMarks {\n row: Mark | null\n cells: Map<string, Mark> | null\n}\n\n/** A mark that is still running at `now`, else `null`. */\nexport const live = (mark: Mark | null | undefined, now: number) =>\n mark && mark.end > now ? mark : null\n\n/**\n * The marks of one table (C-94): row and cell flashes by row key. Starting\n * a flash that runs already restarts it, and the phase changes at most once\n * a frame, so changes within one frame are one visual restart (K33-4).\n */\nexport const createMarks = () => {\n const byKey = new Map<RowChangeKey, RowMarks>()\n let gen = 0\n\n const restart = (\n mark: Mark | null | undefined,\n now: number,\n duration: number,\n frame: number\n ): Mark => {\n gen++\n if (!mark) {\n return {\n start: now,\n end: now + duration,\n gen,\n phase: 'a',\n flipFrame: frame\n }\n }\n mark.start = now\n mark.end = now + duration\n mark.gen = gen\n if (mark.flipFrame !== frame) {\n mark.phase = mark.phase === 'a' ? 'b' : 'a'\n mark.flipFrame = frame\n }\n return mark\n }\n\n const entry = (key: RowChangeKey): RowMarks => {\n let marks = byKey.get(key)\n if (!marks) {\n marks = { row: null, cells: null }\n byKey.set(key, marks)\n }\n return marks\n }\n\n /** Flash the row of `key`; its cell flashes go (a new row is new as a whole). */\n const flashRow = (\n key: RowChangeKey,\n now: number,\n duration: number,\n frame: number\n ) => {\n const marks = entry(key)\n marks.row = restart(marks.row, now, duration, frame)\n marks.cells?.clear()\n }\n\n const flashCell = (\n key: RowChangeKey,\n field: string,\n now: number,\n duration: number,\n frame: number\n ) => {\n const marks = entry(key)\n const cells = (marks.cells ??= new Map<string, Mark>())\n cells.set(field, restart(cells.get(field), now, duration, frame))\n }\n\n const isEmpty = (marks: RowMarks) =>\n marks.row === null && (marks.cells === null || marks.cells.size === 0)\n\n /** Drop every row flash (`flash.rows` turned off). True when one went. */\n const clearRows = (): boolean => {\n let dropped = false\n for (const [key, marks] of byKey) {\n if (marks.row) {\n marks.row = null\n dropped = true\n }\n if (isEmpty(marks)) {\n byKey.delete(key)\n }\n }\n return dropped\n }\n\n /** Drop the cell flashes of `fields`, or of every field. True when one went. */\n const clearCells = (fields?: readonly string[]): boolean => {\n let dropped = false\n for (const [key, marks] of byKey) {\n const cells = marks.cells\n if (cells && cells.size > 0) {\n if (fields) {\n for (const field of fields) {\n dropped = cells.delete(field) || dropped\n }\n } else {\n cells.clear()\n dropped = true\n }\n }\n if (isEmpty(marks)) {\n byKey.delete(key)\n }\n }\n return dropped\n }\n\n /** Drop everything. True when something went. */\n const clear = (): boolean => {\n const had = byKey.size > 0\n byKey.clear()\n return had\n }\n\n /**\n * Drop the marks that end by `until`; the nearest end of the ones left,\n * or `Infinity`. True in `dropped` when one went.\n */\n const prune = (until: number) => {\n let nearest = Infinity\n let dropped = false\n for (const [key, marks] of byKey) {\n if (marks.row) {\n if (marks.row.end <= until) {\n marks.row = null\n dropped = true\n } else {\n nearest = Math.min(nearest, marks.row.end)\n }\n }\n if (marks.cells) {\n for (const [field, mark] of marks.cells) {\n if (mark.end <= until) {\n marks.cells.delete(field)\n dropped = true\n } else {\n nearest = Math.min(nearest, mark.end)\n }\n }\n }\n if (isEmpty(marks)) {\n byKey.delete(key)\n }\n }\n return { nearest, dropped }\n }\n\n return {\n get: (key: RowChangeKey) => byKey.get(key),\n get size() {\n return byKey.size\n },\n /** The generation of the last start. */\n get gen() {\n return gen\n },\n flashRow,\n flashCell,\n clearRows,\n clearCells,\n clear,\n prune\n }\n}\n","/** The custom property a skin sets the flash duration with (C-94). */\nconst durationProperty = '--qt-flash-duration'\n\n/**\n * A CSS time in milliseconds: `250ms`, `2s`, `.5s`. Anything else (a\n * missing value, `calc()`, a negative or a zero time, a number without a\n * unit) is `0`: no flash.\n */\nexport const parseDuration = (text: string): number => {\n const match = /^\\s*(\\d*\\.?\\d+(?:e[+-]?\\d+)?)(ms|s)\\s*$/i.exec(text)\n if (!match) {\n return 0\n }\n const value = Number(match[1]) * (match[2].toLowerCase() === 's' ? 1000 : 1)\n return Number.isFinite(value) && value > 0 ? value : 0\n}\n\n/**\n * The flash duration the skin set on the table root (`.qt-datatable`) or\n * above it, in milliseconds; `0` without one. One style read: the caller\n * reads it at most once a frame, and only for an update that marks\n * something (C-94).\n */\nexport const readDuration = (table: Element | null): number => {\n const root = table?.closest('.qt-datatable')\n if (!root) {\n return 0\n }\n return parseDuration(\n getComputedStyle(root).getPropertyValue(durationProperty)\n )\n}\n","import {\n createRowChangeTracker,\n type RowChangeKey,\n type RowsUpdate\n} from '@dolusoft/query-table-core/row-changes'\nimport {\n effectScope,\n getCurrentInstance,\n getCurrentScope,\n nextTick,\n onActivated,\n onDeactivated,\n onMounted,\n onScopeDispose,\n shallowRef,\n watch,\n type ComponentInternalInstance,\n type EffectScope,\n type Ref,\n type ShallowRef\n} from 'vue'\n\nimport type { FlashOptions, Query } from '../contract'\nimport type { RowKey } from '../use-query-table'\nimport { createMarks, live, type FlashPhase, type Mark } from './marks'\nimport { readDuration } from './read-duration'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nconst warn = (message: string) => {\n try {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n } catch {\n // No `process`: a development build.\n }\n console.warn(`[QueryTable] ${message}`)\n}\n\n/** The inline custom property of an element bound after its flash began. */\nconst elapsedProperty = '--qt-flash-elapsed'\n\nexport interface ChangeFlashOptions<T extends object> {\n flash: () => boolean | FlashOptions | undefined\n rowsUpdate: () => RowsUpdate | undefined\n rows: () => readonly T[]\n query: () => Query\n loading: () => boolean\n /** The fields of the drawn columns. */\n fields: () => readonly string[]\n rowKey: () => RowKey<T>\n table: Readonly<Ref<HTMLTableElement | null>>\n}\n\n/**\n * The live marks of one row (K311-6): the `data-flash` value of the row and\n * of each cell with a mark of its own.\n */\nexport interface RowFlash {\n row?: FlashPhase\n cells?: Readonly<Record<string, FlashPhase>>\n}\n\n/** What the body draws with: the marks and the binding hook (C-94). */\nexport interface FlashView {\n /**\n * The live marks of the row of `key`, or `undefined`. Read in the body's\n * render: a change of the marks draws the body again. Equal marks give the\n * same object, so a row whose marks did not change is not drawn again.\n */\n of: (key: RowChangeKey) => RowFlash | undefined\n /**\n * Called with a data row's `tr` after it is mounted or patched: writes\n * `--qt-flash-elapsed` on the row and on its cells that were bound after\n * their flash began, or whose flash changed. Reads nothing reactive: it\n * runs while the row's render effect is active.\n */\n bind: (el: HTMLElement, key: RowChangeKey) => void\n}\n\ninterface Controller {\n view: FlashView\n /** Remove the elapsed times written on the body (`flash` turned off). */\n unbind: () => void\n update: () => void\n deactivate: () => void\n activate: () => void\n}\n\ninterface Kinds {\n rows: boolean\n cells: boolean\n}\n\nconst kindsOf = (value: boolean | FlashOptions | undefined): Kinds =>\n typeof value === 'object'\n ? { rows: value.rows !== false, cells: value.cells !== false }\n : { rows: true, cells: true }\n\nconst keyReader =\n <T extends object>(rowKey: NonNullable<RowKey<T>>) =>\n (row: T, index: number): RowChangeKey =>\n typeof rowKey === 'function'\n ? rowKey(row, index)\n : (row as Record<string, RowChangeKey>)[rowKey]\n\n/**\n * The flash of one table while `flash` is on: feeds the tracker, keeps the\n * marks, reads the duration, runs the one timer and binds the elapsed time.\n * It lives in the effect scope it is created in and goes with it.\n */\nconst startFlash = <T extends object>(o: ChangeFlashOptions<T>): Controller => {\n let rowKey = o.rowKey()\n let keyOf = rowKey === undefined ? null : keyReader(rowKey)\n const newTracker = () =>\n createRowChangeTracker<T>((row, index) => keyOf!(row, index))\n let tracker = newTracker()\n const marks = createMarks()\n /** Bumped when the drawn marks change: the body reads it. */\n const version = shallowRef(0)\n let kinds = kindsOf(o.flash())\n\n let active = true\n let warnedKey = false\n let warnedBadKeys = false\n\n // ---- clock: the frame and the one timer (C-94) ---------------------------\n\n let frame = 0\n let frameRequest: number | undefined\n /** The duration read in this frame (valid while a frame is requested). */\n let duration = 0\n let timer: ReturnType<typeof setTimeout> | undefined\n /** The end the timer wakes at. */\n let timerAt = Infinity\n /**\n * The first generation started in the update being drawn: an element\n * bound to it in the same render gets no elapsed time.\n */\n let freshFrom = Infinity\n\n /** A frame went by: the next change flips the phase, the duration is read again. */\n const requestFrame = () => {\n frameRequest ??= requestAnimationFrame(() => {\n frameRequest = undefined\n frame++\n })\n }\n const durationNow = () => {\n if (frameRequest === undefined) {\n duration = readDuration(o.table.value)\n // Read once a frame, a zero length (reduced motion) included.\n requestFrame()\n }\n return duration\n }\n\n const stopClock = () => {\n if (timer !== undefined) {\n clearTimeout(timer)\n timer = undefined\n timerAt = Infinity\n }\n if (frameRequest !== undefined) {\n cancelAnimationFrame(frameRequest)\n frameRequest = undefined\n }\n }\n\n /** Wake at `end`: drop what ended, then wake at the next end. */\n const wakeAt = (end: number) => {\n if (timer !== undefined) {\n clearTimeout(timer)\n }\n timerAt = end\n timer = setTimeout(\n () => {\n timer = undefined\n timerAt = Infinity\n // Only what has ended goes; the next wake takes the rest.\n const { nearest, dropped } = marks.prune(performance.now())\n if (dropped) {\n pruneDrawn()\n version.value++\n }\n if (nearest !== Infinity) {\n wakeAt(nearest)\n }\n },\n Math.max(0, end - performance.now())\n )\n }\n\n /** Everything goes: marks, timer, frame and the rows compared against. */\n const resetAll = () => {\n tracker.clear()\n stopClock()\n drawn.clear()\n if (marks.clear()) {\n version.value++\n }\n }\n\n // ---- the marks each row is drawn with (K311-6) ----------------------------\n\n /**\n * The last `RowFlash` of each row key, with the live marks it was made\n * from as a text of copied numbers (field, phase, generation): never the\n * `Mark` objects, which a restart updates in place. Pruned with the marks.\n */\n const drawn = new Map<RowChangeKey, { live: string; flash: RowFlash }>()\n const pruneDrawn = () => {\n for (const key of drawn.keys()) {\n if (!marks.get(key)) {\n drawn.delete(key)\n }\n }\n }\n\n // ---- marks from the tracker (C-93) ---------------------------------------\n\n const update = () => {\n if (!active) {\n return\n }\n // A new `rowKey` starts over: the keys mean something else now (K33-3).\n if (o.rowKey() !== rowKey) {\n rowKey = o.rowKey()\n keyOf = rowKey === undefined ? null : keyReader(rowKey)\n resetAll()\n tracker = newTracker()\n }\n if (keyOf === null) {\n if (!warnedKey) {\n warnedKey = true\n warn('`flash` needs `rowKey`; it is ignored without one (C-93).')\n }\n return\n }\n let changed = false\n // A kind turned off: its marks go now (K33-8).\n const next = kindsOf(o.flash())\n if (!next.rows && kinds.rows) {\n changed = marks.clearRows() || changed\n }\n if (!next.cells && kinds.cells) {\n changed = marks.clearCells() || changed\n }\n kinds = next\n const result = tracker.update({\n rows: o.rows(),\n query: o.query(),\n loading: o.loading(),\n fields: kinds.cells ? o.fields() : [],\n hint: o.rowsUpdate(),\n // A hidden document flashes nothing and replays nothing (K33-8).\n quiet: document.hidden\n })\n if (result.badKeys && !warnedBadKeys) {\n warnedBadKeys = true\n warn(\n '`flash` found a row without a `rowKey` value, or a key two rows share; the index is never used instead (C-93).'\n )\n }\n if (result.reset) {\n stopClock()\n changed = marks.clear() || changed\n }\n if (result.droppedFields.length > 0) {\n changed = marks.clearCells(result.droppedFields) || changed\n }\n const added = kinds.rows ? result.added : []\n const cells = kinds.cells ? result.changed : null\n if (added.length > 0 || (cells !== null && cells.size > 0)) {\n const length = durationNow()\n // No duration (a reduced-motion skin): no mark; the rows compared\n // against moved all the same (K33-5).\n if (length > 0) {\n const at = performance.now()\n const firstGen = marks.gen + 1\n for (const key of added) {\n marks.flashRow(key, at, length, frame)\n }\n cells?.forEach((fields, key) => {\n for (const field of fields) {\n marks.flashCell(key, field, at, length, frame)\n }\n })\n changed = true\n // Flashes started now are bound in this update's render: no time\n // has gone for them yet.\n if (freshFrom === Infinity) {\n freshFrom = firstGen\n void nextTick(() => {\n freshFrom = Infinity\n })\n }\n requestFrame()\n // A timer set for a later end (the skin shortened the duration)\n // is set again; one set for an earlier end wakes first.\n if (at + length < timerAt) {\n wakeAt(at + length)\n }\n }\n }\n if (changed) {\n pruneDrawn()\n version.value++\n }\n }\n\n // The rows at the start are the baseline.\n update()\n\n // ---- drawing (C-94) ------------------------------------------------------\n\n /** The generation bound to an element, and the elapsed value written on it. */\n const bound = new WeakMap<Element, number>()\n const written = new WeakMap<Element, string>()\n /** Rows with something bound on them or on one of their cells. */\n const boundRows = new WeakSet<Element>()\n /** The row flash a cell was last seen under. */\n const seenUnder = new WeakMap<Element, number>()\n\n const bindTo = (\n el: HTMLElement,\n mark: Mark | null,\n now: number,\n blockInherited: boolean\n ) => {\n const gen = bound.get(el)\n if (!mark) {\n if (gen !== undefined) {\n bound.delete(el)\n written.delete(el)\n el.style.removeProperty(elapsedProperty)\n }\n return\n }\n if (gen === mark.gen) {\n // Vue drops the whole `style` attribute when a cell's style binding\n // goes away: put the value back, unchanged.\n const value = written.get(el) ?? ''\n if (value !== '' && el.style.getPropertyValue(elapsedProperty) === '') {\n el.style.setProperty(elapsedProperty, value)\n }\n return\n }\n const elapsed = mark.gen >= freshFrom ? 0 : now - mark.start\n // A cell's own fresh flash must not inherit the row's elapsed time.\n const value =\n elapsed >= 1 ? `${Math.round(elapsed)}ms` : blockInherited ? '0ms' : ''\n if (value === '') {\n el.style.removeProperty(elapsedProperty)\n } else {\n el.style.setProperty(elapsedProperty, value)\n }\n bound.set(el, mark.gen)\n written.set(el, value)\n }\n\n const view: FlashView = {\n of: key => {\n // Read by the body's render: a change of the marks draws it again.\n void version.value\n const rowMarks = keyOf === null ? undefined : marks.get(key)\n if (!rowMarks) {\n drawn.delete(key)\n return undefined\n }\n // The clock is read only for a row that has a mark.\n const now = performance.now()\n const rowMark = live(rowMarks.row, now)\n let text = rowMark ? `${rowMark.phase}${rowMark.gen}` : ''\n rowMarks.cells?.forEach((mark, field) => {\n if (live(mark, now)) {\n text += `|${field}:${mark.phase}${mark.gen}`\n }\n })\n if (text === '') {\n drawn.delete(key)\n return undefined\n }\n const last = drawn.get(key)\n if (last?.live === text) {\n return last.flash\n }\n const flash: RowFlash = {}\n if (rowMark) {\n flash.row = rowMark.phase\n }\n let cells: Record<string, FlashPhase> | undefined\n rowMarks.cells?.forEach((mark, field) => {\n if (live(mark, now)) {\n ;(cells ??= {})[field] = mark.phase\n }\n })\n if (cells) {\n flash.cells = cells\n }\n drawn.set(key, { live: text, flash })\n return flash\n },\n bind: (tr, key) => {\n if (keyOf === null) {\n return\n }\n const rowMarks = marks.get(key)\n // Most rows have no flash and nothing bound: nothing to do.\n if (!rowMarks && !boundRows.has(tr)) {\n return\n }\n const now = performance.now()\n const rowMark = live(rowMarks?.row, now)\n // The row was bound to this flash in an earlier render: a cell seen\n // only now was mounted since (a column shown), and the row's value,\n // written when the row was bound, is not its time.\n const rowWasBound = rowMark !== null && bound.get(tr) === rowMark.gen\n bindTo(tr, rowMark, now, false)\n const rowValue = written.get(tr) ?? ''\n let any = bound.has(tr)\n const cells = tr.children\n for (let i = 0; i < cells.length; i++) {\n const td = cells[i] as HTMLElement\n const field = td.getAttribute('data-field')\n const own =\n field === null ? null : live(rowMarks?.cells?.get(field), now)\n if (own) {\n bindTo(td, own, now, rowValue !== '')\n } else if (\n rowMark &&\n (bound.get(td) === rowMark.gen ||\n (rowWasBound && seenUnder.get(td) !== rowMark.gen))\n ) {\n // A cell mounted after its row was bound takes the row's flash\n // with its own elapsed time.\n bindTo(td, rowMark, now, false)\n } else {\n // A cell without a flash of its own inherits the row's value.\n bindTo(td, null, now, false)\n }\n if (rowMark) {\n seenUnder.set(td, rowMark.gen)\n }\n any ||= bound.has(td)\n }\n if (any) {\n boundRows.add(tr)\n } else {\n boundRows.delete(tr)\n }\n }\n }\n\n /** Remove the elapsed times written on the body. */\n const unbindAll = () => {\n const body = o.table.value?.tBodies[0]\n if (!body) {\n return\n }\n const rows = body.children\n for (let i = 0; i < rows.length; i++) {\n const tr = rows[i] as HTMLElement\n tr.style.removeProperty(elapsedProperty)\n const cells = tr.children\n for (let j = 0; j < cells.length; j++) {\n ;(cells[j] as HTMLElement).style.removeProperty(elapsedProperty)\n }\n }\n }\n\n // On unmount the elements go with the table: only the clock is stopped.\n onScopeDispose(stopClock)\n\n return {\n view,\n unbind: unbindAll,\n update,\n // KeepAlive: nothing runs while away; back, the rows are a baseline.\n deactivate: () => {\n active = false\n resetAll()\n unbindAll()\n },\n activate: () => {\n active = true\n update()\n }\n }\n}\n\n/**\n * The change flash of `QueryTable` (C-93 to C-95). Off, it sets up one\n * watcher that reads `flash` and nothing else: no comparison, timer, frame\n * callback, listener, style read or memory per row. On, the same watcher\n * also reads what the tracker compares, and the flash runs in an effect\n * scope of its own; stopping that scope undoes everything. Nothing runs on\n * the server: the flash starts once the table is mounted.\n */\nexport const useChangeFlash = <T extends object>(\n o: ChangeFlashOptions<T>\n): ShallowRef<FlashView | null> => {\n const view = shallowRef<FlashView | null>(null)\n const instance = getCurrentInstance() as ComponentInternalInstance\n const owner = getCurrentScope() as EffectScope\n let scope: EffectScope | null = null\n let controller: Controller | null = null\n let hooked = false\n let mounted = false\n\n const start = () => {\n scope = owner.run(() => effectScope())!\n controller = scope.run(() => startFlash(o))!\n view.value = controller.view\n if (!hooked) {\n hooked = true\n onDeactivated(() => controller?.deactivate(), instance)\n onActivated(() => controller?.activate(), instance)\n }\n }\n const stop = () => {\n controller?.unbind()\n scope?.stop()\n scope = null\n controller = null\n view.value = null\n }\n\n // One watcher, run before the table renders. Off it reads `flash` only.\n watch(\n () =>\n o.flash()\n ? [\n o.flash(),\n o.rows(),\n o.query(),\n o.loading(),\n o.rowsUpdate(),\n o.rowKey(),\n o.fields()\n ]\n : null,\n on => {\n if (!mounted) {\n return\n }\n if (!on) {\n stop()\n } else if (controller) {\n controller.update()\n } else {\n start()\n }\n }\n )\n onMounted(() => {\n mounted = true\n if (o.flash()) {\n start()\n }\n })\n return view\n}\n","import type { Column, HeaderContextMenuPayload } from '../contract'\n\nexport interface HeaderContextMenuOptions {\n /** The drawn columns (hidden already dropped), in drawing order. */\n columns: () => Column[]\n /**\n * Original index of a drawn column in the consumer's `columns` (hidden\n * included), as C-28's `columnIndex`.\n */\n indexOf: (field: string) => number | undefined\n /** Someone listens to `headerContextMenu`; without one the menu is left alone. */\n listening: () => boolean\n onContextMenu: (payload: HeaderContextMenuPayload) => void\n}\n\n/**\n * One listener on the `thead` serves every header cell (C-96): a listener per\n * cell would be a new closure per cell on every render. Only a data column\n * header emits (`data-field`); utility cells keep the browser menu. A right\n * click inside the filter row (`.qt-filter`) keeps the browser menu too, so\n * paste and spell-check stay (issue #102 S1(a)).\n */\nexport const useHeaderContextMenu = (options: HeaderContextMenuOptions) => {\n const onContextMenu = (event: MouseEvent) => {\n if (!options.listening()) {\n return\n }\n const head = event.currentTarget as Element\n let cell = (event.target as Element | null)?.closest('th') ?? null\n while (cell && cell.parentElement?.parentElement !== head) {\n cell = cell.parentElement?.closest('th') ?? null\n }\n const field = cell?.getAttribute('data-field') ?? null\n if (field === null || !cell) {\n return\n }\n // Filter inputs keep the native menu (paste, spell check).\n const target = event.target as Element | null\n if (\n target?.closest('.qt-filter') &&\n cell.contains(target.closest('.qt-filter'))\n ) {\n return\n }\n const column = options.columns().find(c => c.field === field)\n const columnIndex = options.indexOf(field)\n if (!column || columnIndex === undefined) {\n return\n }\n event.preventDefault()\n options.onContextMenu({\n event,\n column,\n columnIndex\n })\n }\n\n return { onContextMenu }\n}\n","// The type of a column, read case-insensitively (C-39), is the protocol's.\nexport { columnTypeOf } from '@dolusoft/query-protocol'\n\n/** Reads a dotted path (`'a.b'`) from a row. */\nexport const valueAt = (row: object, path: string): unknown =>\n path\n .split('.')\n .reduce<unknown>(\n (value, key) =>\n value === null || value === undefined\n ? undefined\n : (value as Record<string, unknown>)[key],\n row\n )\n","import type { CellContextMenuPayload } from '../contract'\nimport { valueAt } from '../core/column'\nimport type { ColumnEntry } from '../use-query-table'\n\nexport interface CellViewOptions<T extends object> {\n /** The rows of the body, to find the one a context menu event belongs to. */\n rows: () => T[]\n /** The drawn columns, to find the one a context menu event belongs to. */\n entries: () => ColumnEntry[]\n /** Someone listens to `cellContextMenu`; without one the menu is left alone. */\n listening: () => boolean\n onContextMenu: (payload: CellContextMenuPayload<T>) => void\n}\n\n/**\n * The context menu event of the body cells (C-28). What a cell shows is\n * drawn by its row (`parts/table-row.ts`).\n */\nexport const useCellView = <T extends object>(options: CellViewOptions<T>) => {\n /**\n * One listener on the `tbody` serves every cell (C-28): a listener per cell\n * would be a new closure per cell on every render. The cell is the nearest\n * `td` whose row is a direct child of this body. A table nested in a\n * subtable row: the walk ends on the subtable `td`, which has no\n * `data-field`, so this body stays quiet and the inner table answers for its\n * own cells. A table nested in a `cell-<field>` slot: the inner table emits\n * for its cell, then this body emits for the outer cell that holds it (the\n * same as a listener on every cell did). Only a data cell counts: it carries\n * `data-field`, and its row carries `data-row-index`.\n */\n const onContextMenu = (event: MouseEvent) => {\n // Without a listener the event has no use: keep the browser menu (C-28).\n if (!options.listening()) {\n return\n }\n const body = event.currentTarget as Element\n let cell = (event.target as Element | null)?.closest('td') ?? null\n while (cell && cell.parentElement?.parentElement !== body) {\n cell = cell.parentElement?.closest('td') ?? null\n }\n const field = cell?.getAttribute('data-field') ?? null\n const index = cell?.parentElement?.getAttribute('data-row-index') ?? null\n if (field === null || index === null) {\n return\n }\n const rowIndex = Number(index)\n const row = options.rows()[rowIndex]\n const entry = options.entries().find(e => e.column.field === field)\n if (row === undefined || !entry) {\n return\n }\n event.preventDefault()\n options.onContextMenu({\n event,\n row,\n column: entry.column,\n cellValue: valueAt(row, field),\n rowIndex,\n columnIndex: entry.index\n })\n }\n\n return { onContextMenu }\n}\n","import {\n createCommentVNode,\n createElementBlock,\n createElementVNode,\n defineComponent,\n Fragment,\n mergeProps,\n openBlock,\n renderList,\n renderSlot,\n toDisplayString,\n withModifiers,\n type PropType,\n type Slots,\n type VNode\n} from 'vue'\n\nimport type { PinSide } from '../columns/column-layout'\nimport type { CellSlotProps, Column } from '../contract'\nimport { valueAt } from '../core/column'\nimport type { RowFlash } from '../flash/use-change-flash'\n\n/**\n * One drawn column of a data row, kept by value by the body (K311-2): the\n * same object while its column, place, type, pinning, slot and role stay.\n */\nexport interface RowCell {\n field: string\n column: Column\n type: string\n side: PinSide\n offset: number | undefined\n role: string | undefined\n /** `cell-<field>` when the consumer gives that slot, else `null`. */\n slot: string | null\n /** The `td` attributes before `data-flash`, in the order 3.10 wrote them. */\n attrs: Record<string, unknown>\n}\n\n/**\n * The utility cells of a data row (C-46, C-59, C-98): the attributes of\n * each one drawn, `null` for one that is not. Kept by value by the body.\n */\nexport interface RowUtilities {\n panel: Record<string, unknown> | null\n expand: Record<string, unknown> | null\n select: Record<string, unknown> | null\n /** What the attributes were made from: equal keys, equal cells. */\n signature: string\n}\n\ntype RowPinned = CellSlotProps<object>['rowPinned']\ntype PinRow = (\n row: object,\n index: number,\n position: 'top' | 'bottom' | false\n) => void\n\n// Any value, no runtime type check: the body is the only caller.\nconst value = <V>() => ({ type: null as unknown as PropType<V> })\nconst needed = <V>() => ({\n type: null as unknown as PropType<V>,\n required: true as const\n})\n\n// The empty comment of a branch that is off, as the library build writes\n// it (a development build of a template writes `v-if`, C-108).\nconst off = () => createCommentVNode('', true)\n\nconst panelIcon = () =>\n createElementVNode(\n 'svg',\n {\n width: '14',\n height: '14',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': '2',\n 'stroke-linecap': 'round',\n 'aria-hidden': 'true'\n },\n [\n createElementVNode('line', { x1: '12', y1: '5', x2: '12', y2: '19' }),\n createElementVNode('line', { x1: '5', y1: '12', x2: '19', y2: '12' })\n ],\n -1 /* CACHED */\n )\n\nconst expandIcon = {\n width: '14',\n height: '14',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': '2',\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n 'aria-hidden': 'true'\n}\nconst chevronDown = { key: 0, points: '6 9 12 15 18 9' }\nconst chevronRight = { key: 1, points: '9 6 15 12 9 18' }\n\nconst rowDynamic = [\n 'role',\n 'data-row-index',\n 'aria-rowindex',\n 'data-pinned-row',\n 'data-row-kind',\n 'data-expanded',\n 'data-selected',\n 'data-flash'\n]\nconst panelDynamic = ['aria-label', 'onClick']\nconst expandDynamic = ['aria-expanded', 'aria-label', 'onClick']\nconst selectDynamic = ['aria-label', 'checked', 'onChange']\n\n/** Text of a cell, whole: the table never cuts it. */\nconst cellText = (row: object, column: Column) =>\n // A cell value may be any type; its string form is what the table shows.\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n String(valueAt(row, column.field) ?? '')\n\n/**\n * One data row of the body (ADR 0017, C-106 to C-108): its `tr`, the\n * utility cells and the column cells with their `cell-<field>` slots.\n * Internal: not exported from the package.\n *\n * Every prop is a value the body computed for this row (K311-2), so Vue\n * skips a row whose props did not change; the row's render calls no\n * function that reads shared state. Its cell slots are called here, so what\n * a slot reads reactively belongs to this row (K311-4). The render is\n * written with the helpers compiled templates use, and draws the vnodes the\n * `tr` branch of the body's template drew in 3.10 (C-108).\n */\nexport const tableRow = defineComponent({\n name: 'TableRow',\n inheritAttrs: false,\n props: {\n row: needed<object>(),\n /** The row's key, as the body keys it (C-26). */\n rowKey: needed<string | number>(),\n /** `data-row-index`: the row's index in `rows`. */\n index: needed<number>(),\n /** `aria-rowindex`, with `virtual` only (C-86). */\n aria: value<number | undefined>(),\n pinned: needed<RowPinned>(),\n /** `data-row-kind` (C-97); `undefined` for none. */\n kind: value<string | undefined>(),\n selected: needed<boolean>(),\n expanded: needed<boolean>(),\n /** An expand button is drawn (C-98). */\n expandable: needed<boolean>(),\n /** The row's flash marks (C-94), or `undefined`. */\n flash: value<RowFlash | undefined>(),\n cells: needed<readonly RowCell[]>(),\n utilities: needed<RowUtilities>(),\n labelPanel: needed<string>(),\n labelExpand: needed<string>(),\n labelSelect: needed<string>(),\n /** `scrollBody`: the ARIA roles of C-102. */\n roles: value<boolean | undefined>(),\n /** The body's slots object: the same object for the body's life (K311-3). */\n slots: needed<Slots>(),\n /** With `flash`: binds the elapsed time after a render (K311-6). */\n flashBind: value<\n ((el: HTMLElement, key: string | number) => void) | undefined\n >(),\n pinRow: needed<PinRow>()\n },\n emits: ['toggle', 'toggleSelected', 'rightPanel'],\n setup(props, { emit }) {\n // Stable for the row's life, so a render patches nothing for them.\n const onPanel = withModifiers(() => emit('rightPanel'), ['stop'])\n const onToggle = () => emit('toggle')\n const onSelect = () => emit('toggleSelected')\n // Called by Vue right after the row's `tr` is mounted or patched, while\n // the row's render effect is active: it reads only this row's props.\n const bind = (vnode: VNode) => {\n props.flashBind?.(vnode.el as HTMLElement, props.rowKey)\n }\n // The compiler's per-instance cache of static content (`_cache`).\n let panelCache: VNode[] | null = null\n\n return () => {\n const { row, index, pinned, cells, utilities, flash, slots } = props\n const cellFlash = flash?.cells\n return (\n openBlock(),\n createElementBlock(\n 'tr',\n {\n role: props.roles ? 'row' : undefined,\n 'data-row-index': index,\n 'aria-rowindex': props.aria,\n 'data-pinned-row': pinned || undefined,\n 'data-row-kind': props.kind,\n 'data-expanded': props.expanded ? '' : undefined,\n 'data-selected': props.selected ? '' : undefined,\n 'data-flash': flash?.row,\n // Read from the vnode by Vue, never patched as attributes: they\n // stay out of the dynamic props below, so no DOM listener is\n // made of them (C-108).\n onVnodeBeforeMount: props.flashBind ? bind : undefined,\n onVnodeUpdated: props.flashBind ? bind : undefined\n },\n [\n utilities.panel\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 0 }, utilities.panel),\n [\n createElementVNode(\n 'button',\n {\n type: 'button',\n class: 'qt-right-panel-button',\n 'aria-label': props.labelPanel,\n onClick: onPanel\n },\n [...(panelCache ??= [panelIcon()])],\n 8 /* PROPS */,\n panelDynamic\n )\n ],\n 16 /* FULL_PROPS */\n ))\n : off(),\n utilities.expand\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 1 }, utilities.expand),\n [\n props.expandable\n ? (openBlock(),\n createElementBlock(\n 'button',\n {\n key: 0,\n type: 'button',\n class: 'qt-expand',\n 'aria-expanded': props.expanded,\n 'aria-label': props.labelExpand,\n onClick: onToggle\n },\n [\n (openBlock(),\n createElementBlock('svg', expandIcon, [\n props.expanded\n ? (openBlock(),\n createElementBlock('polyline', chevronDown))\n : (openBlock(),\n createElementBlock('polyline', chevronRight))\n ]))\n ],\n 8 /* PROPS */,\n expandDynamic\n ))\n : off()\n ],\n 16 /* FULL_PROPS */\n ))\n : off(),\n utilities.select\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 2 }, utilities.select),\n [\n createElementVNode(\n 'input',\n {\n type: 'checkbox',\n class: 'qt-select-row',\n 'aria-label': props.labelSelect,\n checked: props.selected,\n onChange: onSelect\n },\n null,\n 40 /* PROPS, NEED_HYDRATION */,\n selectDynamic\n )\n ],\n 16 /* FULL_PROPS */\n ))\n : off(),\n (openBlock(true),\n createElementBlock(\n Fragment,\n null,\n renderList(\n cells,\n cell => (\n openBlock(),\n createElementBlock(\n Fragment,\n { key: cell.field },\n [\n cell.slot\n ? (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 0 }, cell.attrs, {\n 'data-flash': cellFlash?.[cell.field]\n }),\n [\n renderSlot(slots, cell.slot, {\n row,\n rowIndex: index,\n column: cell.column,\n cellValue: valueAt(row, cell.field),\n rowPinned: pinned,\n pinRow: position =>\n props.pinRow(row, index, position)\n } satisfies CellSlotProps<object>)\n ],\n 16 /* FULL_PROPS */\n ))\n : (openBlock(),\n createElementBlock(\n 'td',\n mergeProps({ key: 1 }, cell.attrs, {\n 'data-flash': cellFlash?.[cell.field]\n }),\n toDisplayString(cellText(row, cell.column)),\n 17 /* TEXT, FULL_PROPS */\n ))\n ],\n 64 /* STABLE_FRAGMENT */\n )\n )\n ),\n 128 /* KEYED_FRAGMENT */\n ))\n ],\n 8 /* PROPS */,\n rowDynamic\n )\n )\n }\n }\n})\n","import type { PinSide } from '../columns/column-layout'\n\n/**\n * Cells before the first column, in drawing order: the right panel, the\n * expand button, the selection checkbox.\n */\nexport type Utility = 'right-panel' | 'subtable' | 'select'\n\n/** Geometry key of a utility cell; a column's key is its `field`. */\nexport const utilityKey = (utility: string) => `utility:${utility}`\n\n/**\n * Attributes of a pinned cell (C-47, C-71): `data-pinned` (`''` on the left,\n * `'right'` on the right) and, once measured, the `--qt-pin-left` or\n * `--qt-pin-right` offset in pixels, next to an optional `width`. Nothing but\n * the width for a cell that is not pinned; no `style` when both are absent.\n */\nexport const pinAttrs = (\n side: PinSide,\n offset: number | undefined,\n width?: string\n): Record<string, unknown> => {\n const style: Record<string, string> = {}\n if (width) {\n style.width = width\n }\n if (side && offset !== undefined) {\n style[side === 'left' ? '--qt-pin-left' : '--qt-pin-right'] = `${offset}px`\n }\n return {\n 'data-pinned':\n side === 'left' ? '' : side === 'right' ? 'right' : undefined,\n style: Object.keys(style).length > 0 ? style : undefined\n }\n}\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { computed, onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport { sideOf } from '../columns/column-layout'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { tableRow, type RowCell, type RowUtilities } from './table-row'\nimport { columnTypeOf } from '../core/column'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type {\n BodyItem,\n DrawnRow,\n GroupRow,\n SpacerRow\n} from '../virtual/use-row-window'\n\nconst props = defineProps<{\n rows: T[]\n /**\n * The rows in drawing order: pinned top, the others, pinned bottom (C-74);\n * with `virtual` only the drawn ones, between spacers (C-83); with\n * `groupBy` a group row above the first row of each group (C-103).\n */\n bodyRows: Array<BodyItem<T>>\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n /** The consumer is fetching: no empty row, the `loading` row instead (C-52). */\n loading: boolean\n /** The columns to draw, hidden ones already dropped. */\n entries: ColumnEntry[]\n /**\n * The `cell-<field>` slots the consumer gives, one per line (a field name\n * may hold a space, never a line break). Slots are not reactive; a slot\n * that comes or goes changes this text (K311-3).\n */\n slotNames: string\n /** Cells a full-width row (subtable, empty) spans. */\n columnCount: number\n hasSubtable: boolean\n hasRightPanel: boolean\n /** Draw the selection checkbox column (C-59). */\n hasSelection: boolean\n isSelected: (row: T, index: number) => boolean\n toggleSelected: (row: T, index: number) => void\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n keyOf: (row: T, index: number) => string | number\n /** The row can expand: no expand button otherwise (C-98). */\n canExpand: (row: T, index: number) => boolean\n isExpanded: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\n /** `data-row-kind` of a row (C-97); absent, no row carries it. */\n rowKind?: (row: T, index: number) => string | null | undefined\n labels: TableLabels\n /** The consumer listens to `cellContextMenu` (C-28); read at event time. */\n hasContextMenuListener: () => boolean\n /** With `infinite`: what the `load-more` slot receives, else `null` (C-89). */\n loadMore: LoadMoreSlotProps | null\n /**\n * With `flash`: the marks and the binding hook (C-94), else `null`; off,\n * the body draws what it drew in 3.2 and calls nothing per row (C-95).\n */\n flash: FlashView | null\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\n/**\n * The body's slots object: the same object for the life of the body, whose\n * functions Vue replaces before each render. Every row gets it as a prop and\n * calls the latest `cell-<field>` function when it renders (K311-3).\n */\nconst rawSlots = useSlots()\n\nconst { onContextMenu } = useCellView<T>({\n rows: () => props.rows,\n entries: () => props.entries,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload)\n})\n\n/** `role` of a row and of a cell with `scrollBody` (C-102). */\nconst rowRole = () => (props.roles ? 'row' : undefined)\nconst cellRole = () => (props.roles ? 'cell' : undefined)\n/** A cell over every column; with `scrollBody` also its `aria-colspan`. */\nconst spanAttrs = () => ({\n colspan: props.columnCount,\n role: cellRole(),\n 'aria-colspan': props.roles ? props.columnCount : undefined\n})\n\n/*\n The cells every row draws, kept by value (K311-2): `entries` is a new\n array of new entries after a change of `rows` (TanStack's column getters\n read its options), so a cell keeps its object while its column (by\n identity), place, type, pinning, slot and role are the same, and the\n array is the previous one when every cell is. A row compares this array\n by identity.\n*/\nconst cells = computed<readonly RowCell[]>(previous => {\n const names = new Set(props.slotNames.split('\\n'))\n const role = cellRole()\n let same = previous?.length === props.entries.length\n const next = props.entries.map((entry, i): RowCell => {\n const { column } = entry\n const field = column.field\n // The type of a column, read once per change of the columns (C-82).\n const type = columnTypeOf(column)\n const side = sideOf(column)\n const offset = props.offsets[field]\n const slot = names.has(`cell-${field}`) ? `cell-${field}` : null\n const old = previous?.[i]\n if (\n old &&\n old.column === column &&\n old.type === type &&\n old.side === side &&\n old.offset === offset &&\n old.slot === slot &&\n old.role === role\n ) {\n return old\n }\n same = false\n return {\n field,\n column,\n type,\n side,\n offset,\n role,\n slot,\n attrs: {\n role,\n 'data-field': field,\n 'data-type': type,\n ...pinAttrs(side, offset)\n }\n }\n })\n return same && previous ? previous : next\n})\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71); kept by\n// value like the cells.\nconst utilities = computed<RowUtilities>(previous => {\n const role = cellRole()\n const side = props.hasPinned ? 'left' : false\n const offsetOf = (utility: string) => props.offsets[utilityKey(utility)]\n const signature = [\n role,\n side,\n props.hasRightPanel && `p${offsetOf('right-panel')}`,\n props.hasSubtable && `e${offsetOf('subtable')}`,\n props.hasSelection && `s${offsetOf('select')}`\n ].join('|')\n if (previous?.signature === signature) {\n return previous\n }\n const attrs = (on: boolean, utility: string) =>\n on ? { role, ...pinAttrs(side, offsetOf(utility)) } : null\n return {\n panel: attrs(props.hasRightPanel, 'right-panel'),\n expand: attrs(props.hasSubtable, 'subtable'),\n select: attrs(props.hasSelection, 'select'),\n signature\n }\n})\n\nconst isSpacer = (item: BodyItem<T>): item is SpacerRow => 'spacer' in item\nconst isGroup = (item: BodyItem<T>): item is GroupRow<T> => 'group' in item\n/** A data row: neither a spacer nor a group row. */\nconst isRow = (item: BodyItem<T>): item is DrawnRow<T> =>\n !isSpacer(item) && !isGroup(item)\n/** The identity of a body item in the `v-for`. */\nconst itemKey = (item: BodyItem<T>) =>\n isRow(item) ? props.keyOf(item.row, item.index) : item.key\n/** `data-row-kind` of a drawn row (C-97): no attribute for an empty kind. */\nconst kindOf = (item: DrawnRow<T>) =>\n props.rowKind ? props.rowKind(item.row, item.index) || undefined : undefined\n/** `aria-rowindex` of the subtable row under a drawn row (C-86). */\nconst nextIndex = (aria: number | undefined) =>\n aria === undefined ? undefined : aria + 1\n\n/*\n Snapshot expansion once per body render (not a live computed). A row's\n `expanded` prop is computed before the subtable `v-if`, and the `group`\n and `subtable` slots run in this render: a consumer slot that writes\n reactive state mid-render can clear TanStack's `expanded` atom before the\n subtable `v-if` runs — chevron flips, detail row never mounts. A computed\n would re-read the cleared atom; this map is filled on first use in the\n render and kept until the next update (K311-7).\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: BodyItem<T>) => {\n if (!isRow(item)) {\n return false\n }\n if (!expandedSnapshot) {\n const open = new Map<string, boolean>()\n if (props.hasSubtable) {\n for (const row of props.bodyRows) {\n if (isRow(row)) {\n open.set(\n String(props.keyOf(row.row, row.index)),\n props.isExpanded(row.row, row.index)\n )\n }\n }\n }\n expandedSnapshot = open\n }\n return (\n expandedSnapshot.get(String(props.keyOf(item.row, item.index))) === true\n )\n}\n</script>\n\n<template>\n <tbody :role=\"roles ? 'rowgroup' : undefined\" @contextmenu=\"onContextMenu\">\n <!--\n Flat `template v-for` children (no nested `<template v-else>` Fragment).\n A nested Fragment left the subtable `tr` vnode created but not inserted\n into `tbody` — chevron flipped, detail row never appeared in the DOM.\n A data row is one `TableRow` (ADR 0017): every prop is a value, so Vue\n skips a row whose values did not change (C-106). No children and no\n directive on it: either would update every row on every render.\n -->\n <template v-for=\"item in bodyRows\" :key=\"itemKey(item)\">\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :role=\"rowRole()\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td v-bind=\"spanAttrs()\" />\n </tr>\n <tr\n v-else-if=\"isGroup(item)\"\n class=\"qt-group-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"item.aria\"\n >\n <th\n scope=\"row\"\n :colspan=\"columnCount\"\n :role=\"roles ? 'rowheader' : undefined\"\n :aria-colspan=\"roles ? columnCount : undefined\"\n >\n <slot\n name=\"group\"\n :group-key=\"item.group.key\"\n :count=\"item.group.count\"\n :row=\"item.group.row\"\n :row-index=\"item.group.index\"\n >{{ item.group.key }}</slot\n >\n </th>\n </tr>\n <table-row\n v-else\n :row=\"item.row\"\n :row-key=\"keyOf(item.row, item.index)\"\n :index=\"item.index\"\n :aria=\"item.aria\"\n :pinned=\"item.pinned\"\n :kind=\"kindOf(item)\"\n :selected=\"hasSelection && isSelected(item.row, item.index)\"\n :expanded=\"isRowExpanded(item)\"\n :expandable=\"hasSubtable && canExpand(item.row, item.index)\"\n :flash=\"flash ? flash.of(keyOf(item.row, item.index)) : undefined\"\n :cells=\"cells\"\n :utilities=\"utilities\"\n :label-panel=\"labels.openRightPanel\"\n :label-expand=\"labels.expandRow\"\n :label-select=\"labels.selectRow\"\n :roles=\"roles\"\n :slots=\"rawSlots\"\n :flash-bind=\"flash ? flash.bind : undefined\"\n :pin-row=\"\n pinRow as (\n row: object,\n index: number,\n position: 'top' | 'bottom' | false\n ) => void\n \"\n @toggle=\"toggle(item.row, item.index)\"\n @toggle-selected=\"toggleSelected(item.row, item.index)\"\n @right-panel=\"emit('rowRightPanelClick', item.row)\"\n />\n <tr\n v-if=\"isRow(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr\n v-if=\"loading && slots.loading\"\n class=\"qt-loading-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"empty\" /></td>\n </tr>\n <tr\n v-if=\"!loading && rows.length > 0 && loadMore && slots['load-more']\"\n class=\"qt-load-more-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"load-more\" v-bind=\"loadMore\" />\n </td>\n </tr>\n </tbody>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { computed, onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport { sideOf } from '../columns/column-layout'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { tableRow, type RowCell, type RowUtilities } from './table-row'\nimport { columnTypeOf } from '../core/column'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type {\n BodyItem,\n DrawnRow,\n GroupRow,\n SpacerRow\n} from '../virtual/use-row-window'\n\nconst props = defineProps<{\n rows: T[]\n /**\n * The rows in drawing order: pinned top, the others, pinned bottom (C-74);\n * with `virtual` only the drawn ones, between spacers (C-83); with\n * `groupBy` a group row above the first row of each group (C-103).\n */\n bodyRows: Array<BodyItem<T>>\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n /** The consumer is fetching: no empty row, the `loading` row instead (C-52). */\n loading: boolean\n /** The columns to draw, hidden ones already dropped. */\n entries: ColumnEntry[]\n /**\n * The `cell-<field>` slots the consumer gives, one per line (a field name\n * may hold a space, never a line break). Slots are not reactive; a slot\n * that comes or goes changes this text (K311-3).\n */\n slotNames: string\n /** Cells a full-width row (subtable, empty) spans. */\n columnCount: number\n hasSubtable: boolean\n hasRightPanel: boolean\n /** Draw the selection checkbox column (C-59). */\n hasSelection: boolean\n isSelected: (row: T, index: number) => boolean\n toggleSelected: (row: T, index: number) => void\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n keyOf: (row: T, index: number) => string | number\n /** The row can expand: no expand button otherwise (C-98). */\n canExpand: (row: T, index: number) => boolean\n isExpanded: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\n /** `data-row-kind` of a row (C-97); absent, no row carries it. */\n rowKind?: (row: T, index: number) => string | null | undefined\n labels: TableLabels\n /** The consumer listens to `cellContextMenu` (C-28); read at event time. */\n hasContextMenuListener: () => boolean\n /** With `infinite`: what the `load-more` slot receives, else `null` (C-89). */\n loadMore: LoadMoreSlotProps | null\n /**\n * With `flash`: the marks and the binding hook (C-94), else `null`; off,\n * the body draws what it drew in 3.2 and calls nothing per row (C-95).\n */\n flash: FlashView | null\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\n/**\n * The body's slots object: the same object for the life of the body, whose\n * functions Vue replaces before each render. Every row gets it as a prop and\n * calls the latest `cell-<field>` function when it renders (K311-3).\n */\nconst rawSlots = useSlots()\n\nconst { onContextMenu } = useCellView<T>({\n rows: () => props.rows,\n entries: () => props.entries,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload)\n})\n\n/** `role` of a row and of a cell with `scrollBody` (C-102). */\nconst rowRole = () => (props.roles ? 'row' : undefined)\nconst cellRole = () => (props.roles ? 'cell' : undefined)\n/** A cell over every column; with `scrollBody` also its `aria-colspan`. */\nconst spanAttrs = () => ({\n colspan: props.columnCount,\n role: cellRole(),\n 'aria-colspan': props.roles ? props.columnCount : undefined\n})\n\n/*\n The cells every row draws, kept by value (K311-2): `entries` is a new\n array of new entries after a change of `rows` (TanStack's column getters\n read its options), so a cell keeps its object while its column (by\n identity), place, type, pinning, slot and role are the same, and the\n array is the previous one when every cell is. A row compares this array\n by identity.\n*/\nconst cells = computed<readonly RowCell[]>(previous => {\n const names = new Set(props.slotNames.split('\\n'))\n const role = cellRole()\n let same = previous?.length === props.entries.length\n const next = props.entries.map((entry, i): RowCell => {\n const { column } = entry\n const field = column.field\n // The type of a column, read once per change of the columns (C-82).\n const type = columnTypeOf(column)\n const side = sideOf(column)\n const offset = props.offsets[field]\n const slot = names.has(`cell-${field}`) ? `cell-${field}` : null\n const old = previous?.[i]\n if (\n old &&\n old.column === column &&\n old.type === type &&\n old.side === side &&\n old.offset === offset &&\n old.slot === slot &&\n old.role === role\n ) {\n return old\n }\n same = false\n return {\n field,\n column,\n type,\n side,\n offset,\n role,\n slot,\n attrs: {\n role,\n 'data-field': field,\n 'data-type': type,\n ...pinAttrs(side, offset)\n }\n }\n })\n return same && previous ? previous : next\n})\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71); kept by\n// value like the cells.\nconst utilities = computed<RowUtilities>(previous => {\n const role = cellRole()\n const side = props.hasPinned ? 'left' : false\n const offsetOf = (utility: string) => props.offsets[utilityKey(utility)]\n const signature = [\n role,\n side,\n props.hasRightPanel && `p${offsetOf('right-panel')}`,\n props.hasSubtable && `e${offsetOf('subtable')}`,\n props.hasSelection && `s${offsetOf('select')}`\n ].join('|')\n if (previous?.signature === signature) {\n return previous\n }\n const attrs = (on: boolean, utility: string) =>\n on ? { role, ...pinAttrs(side, offsetOf(utility)) } : null\n return {\n panel: attrs(props.hasRightPanel, 'right-panel'),\n expand: attrs(props.hasSubtable, 'subtable'),\n select: attrs(props.hasSelection, 'select'),\n signature\n }\n})\n\nconst isSpacer = (item: BodyItem<T>): item is SpacerRow => 'spacer' in item\nconst isGroup = (item: BodyItem<T>): item is GroupRow<T> => 'group' in item\n/** A data row: neither a spacer nor a group row. */\nconst isRow = (item: BodyItem<T>): item is DrawnRow<T> =>\n !isSpacer(item) && !isGroup(item)\n/** The identity of a body item in the `v-for`. */\nconst itemKey = (item: BodyItem<T>) =>\n isRow(item) ? props.keyOf(item.row, item.index) : item.key\n/** `data-row-kind` of a drawn row (C-97): no attribute for an empty kind. */\nconst kindOf = (item: DrawnRow<T>) =>\n props.rowKind ? props.rowKind(item.row, item.index) || undefined : undefined\n/** `aria-rowindex` of the subtable row under a drawn row (C-86). */\nconst nextIndex = (aria: number | undefined) =>\n aria === undefined ? undefined : aria + 1\n\n/*\n Snapshot expansion once per body render (not a live computed). A row's\n `expanded` prop is computed before the subtable `v-if`, and the `group`\n and `subtable` slots run in this render: a consumer slot that writes\n reactive state mid-render can clear TanStack's `expanded` atom before the\n subtable `v-if` runs — chevron flips, detail row never mounts. A computed\n would re-read the cleared atom; this map is filled on first use in the\n render and kept until the next update (K311-7).\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: BodyItem<T>) => {\n if (!isRow(item)) {\n return false\n }\n if (!expandedSnapshot) {\n const open = new Map<string, boolean>()\n if (props.hasSubtable) {\n for (const row of props.bodyRows) {\n if (isRow(row)) {\n open.set(\n String(props.keyOf(row.row, row.index)),\n props.isExpanded(row.row, row.index)\n )\n }\n }\n }\n expandedSnapshot = open\n }\n return (\n expandedSnapshot.get(String(props.keyOf(item.row, item.index))) === true\n )\n}\n</script>\n\n<template>\n <tbody :role=\"roles ? 'rowgroup' : undefined\" @contextmenu=\"onContextMenu\">\n <!--\n Flat `template v-for` children (no nested `<template v-else>` Fragment).\n A nested Fragment left the subtable `tr` vnode created but not inserted\n into `tbody` — chevron flipped, detail row never appeared in the DOM.\n A data row is one `TableRow` (ADR 0017): every prop is a value, so Vue\n skips a row whose values did not change (C-106). No children and no\n directive on it: either would update every row on every render.\n -->\n <template v-for=\"item in bodyRows\" :key=\"itemKey(item)\">\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :role=\"rowRole()\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td v-bind=\"spanAttrs()\" />\n </tr>\n <tr\n v-else-if=\"isGroup(item)\"\n class=\"qt-group-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"item.aria\"\n >\n <th\n scope=\"row\"\n :colspan=\"columnCount\"\n :role=\"roles ? 'rowheader' : undefined\"\n :aria-colspan=\"roles ? columnCount : undefined\"\n >\n <slot\n name=\"group\"\n :group-key=\"item.group.key\"\n :count=\"item.group.count\"\n :row=\"item.group.row\"\n :row-index=\"item.group.index\"\n >{{ item.group.key }}</slot\n >\n </th>\n </tr>\n <table-row\n v-else\n :row=\"item.row\"\n :row-key=\"keyOf(item.row, item.index)\"\n :index=\"item.index\"\n :aria=\"item.aria\"\n :pinned=\"item.pinned\"\n :kind=\"kindOf(item)\"\n :selected=\"hasSelection && isSelected(item.row, item.index)\"\n :expanded=\"isRowExpanded(item)\"\n :expandable=\"hasSubtable && canExpand(item.row, item.index)\"\n :flash=\"flash ? flash.of(keyOf(item.row, item.index)) : undefined\"\n :cells=\"cells\"\n :utilities=\"utilities\"\n :label-panel=\"labels.openRightPanel\"\n :label-expand=\"labels.expandRow\"\n :label-select=\"labels.selectRow\"\n :roles=\"roles\"\n :slots=\"rawSlots\"\n :flash-bind=\"flash ? flash.bind : undefined\"\n :pin-row=\"\n pinRow as (\n row: object,\n index: number,\n position: 'top' | 'bottom' | false\n ) => void\n \"\n @toggle=\"toggle(item.row, item.index)\"\n @toggle-selected=\"toggleSelected(item.row, item.index)\"\n @right-panel=\"emit('rowRightPanelClick', item.row)\"\n />\n <tr\n v-if=\"isRow(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :role=\"rowRole()\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr\n v-if=\"loading && slots.loading\"\n class=\"qt-loading-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\"><slot name=\"empty\" /></td>\n </tr>\n <tr\n v-if=\"!loading && rows.length > 0 && loadMore && slots['load-more']\"\n class=\"qt-load-more-row\"\n :role=\"rowRole()\"\n >\n <td v-bind=\"spanAttrs()\">\n <slot name=\"load-more\" v-bind=\"loadMore\" />\n </td>\n </tr>\n </tbody>\n</template>\n","<script setup lang=\"ts\">\nimport { sideOf } from '../columns/column-layout'\nimport type { Column, FooterRow } from '../contract'\nimport { columnTypeOf } from '../core/column'\nimport { pinAttrs } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\ndefineProps<{\n footerRows: FooterRow[]\n entries: ColumnEntry[]\n /** Cells before the first column (right panel, expand button). */\n utilityCount: number\n /** Some column is pinned to the left: the utility cell gets `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** With `virtual`: `aria-rowindex` of the first footer row (C-86). */\n firstRowIndex?: number\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst footerText = (row: FooterRow, column: Column) =>\n row.cells.find(cell => cell.field === column.field)?.text\n</script>\n\n<template>\n <tfoot class=\"qt-footer\" :role=\"roles ? 'rowgroup' : undefined\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\n :role=\"roles ? 'row' : undefined\"\n :aria-rowindex=\"\n firstRowIndex === undefined ? undefined : firstRowIndex + i\n \"\n >\n <!-- One cell spans the utilities; pinned, it starts at offset 0. -->\n <td\n v-if=\"utilityCount > 0\"\n :colspan=\"utilityCount\"\n :role=\"roles ? 'cell' : undefined\"\n :aria-colspan=\"roles ? utilityCount : undefined\"\n v-bind=\"pinAttrs(hasPinned ? 'left' : false, 0)\"\n />\n <td\n v-for=\"entry in entries\"\n :key=\"entry.column.field\"\n :data-field=\"entry.column.field\"\n :data-type=\"columnTypeOf(entry.column)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"pinAttrs(sideOf(entry.column), offsets[entry.column.field])\"\n >\n {{ footerText(footerRow, entry.column) }}\n </td>\n </tr>\n </tfoot>\n</template>\n","<script setup lang=\"ts\">\nimport { sideOf } from '../columns/column-layout'\nimport type { Column, FooterRow } from '../contract'\nimport { columnTypeOf } from '../core/column'\nimport { pinAttrs } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\ndefineProps<{\n footerRows: FooterRow[]\n entries: ColumnEntry[]\n /** Cells before the first column (right panel, expand button). */\n utilityCount: number\n /** Some column is pinned to the left: the utility cell gets `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** With `virtual`: `aria-rowindex` of the first footer row (C-86). */\n firstRowIndex?: number\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\nconst footerText = (row: FooterRow, column: Column) =>\n row.cells.find(cell => cell.field === column.field)?.text\n</script>\n\n<template>\n <tfoot class=\"qt-footer\" :role=\"roles ? 'rowgroup' : undefined\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\n :role=\"roles ? 'row' : undefined\"\n :aria-rowindex=\"\n firstRowIndex === undefined ? undefined : firstRowIndex + i\n \"\n >\n <!-- One cell spans the utilities; pinned, it starts at offset 0. -->\n <td\n v-if=\"utilityCount > 0\"\n :colspan=\"utilityCount\"\n :role=\"roles ? 'cell' : undefined\"\n :aria-colspan=\"roles ? utilityCount : undefined\"\n v-bind=\"pinAttrs(hasPinned ? 'left' : false, 0)\"\n />\n <td\n v-for=\"entry in entries\"\n :key=\"entry.column.field\"\n :data-field=\"entry.column.field\"\n :data-type=\"columnTypeOf(entry.column)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"pinAttrs(sideOf(entry.column), offsets[entry.column.field])\"\n >\n {{ footerText(footerRow, entry.column) }}\n </td>\n </tr>\n </tfoot>\n</template>\n","<script setup lang=\"ts\">\n// `filled` marks an applied filter: the funnel is painted instead of outlined.\ndefineProps<{ filled?: boolean }>()\n</script>\n\n<template>\n <svg\n viewBox=\"0 0 24 24\"\n width=\"14\"\n height=\"14\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n :fill=\"filled ? 'currentColor' : 'none'\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\" />\n </svg>\n</template>\n","<script setup lang=\"ts\">\n// `filled` marks an applied filter: the funnel is painted instead of outlined.\ndefineProps<{ filled?: boolean }>()\n</script>\n\n<template>\n <svg\n viewBox=\"0 0 24 24\"\n width=\"14\"\n height=\"14\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n :fill=\"filled ? 'currentColor' : 'none'\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\" />\n </svg>\n</template>\n","import { type Component, defineComponent, h } from 'vue'\n\nimport type { Column } from '../contract'\nimport { columnName, type ResolvedLabels } from '../core/labels'\nimport IconFilter from '../parts/filter-icon.vue'\n\nexport interface FilterTriggerOptions {\n /** The column of this header cell, as the table has it now. */\n column: () => Column\n labels: () => ResolvedLabels\n isFiltered: () => boolean\n}\n\n/**\n * The filter button a `filter-menu` slot receives as `trigger` (C-34). It is\n * created once, so a popover wrapped around it does not remount the button on\n * every render. It reads reactive state when it renders, so it still updates:\n * the column and the labels come from getters on each render, not from a\n * capture, so a new title or label shows at once.\n */\nexport const useFilterTrigger = (options: FilterTriggerOptions): Component =>\n defineComponent({\n name: 'FilterTrigger',\n setup: () => () => {\n const name = options.labels().filterOptions(columnName(options.column()))\n const filtered = options.isFiltered()\n return h(\n 'button',\n {\n type: 'button',\n class: 'qt-filter-button',\n title: name,\n 'aria-label': name,\n 'data-filtered': filtered ? '' : undefined\n },\n [h(IconFilter, { filled: filtered })]\n )\n }\n })\n","<script setup lang=\"ts\">\nimport {\n conditionArity,\n conditionOptions,\n rulesOf\n} from '@dolusoft/query-protocol'\n\nimport type {\n Column,\n ColumnType,\n FilterBound,\n FilterCondition,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n Query\n} from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { useFilterTrigger } from '../filter/use-filter-trigger'\n\nconst props = defineProps<{\n column: Column\n type: ColumnType\n query: Query\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n}>()\n\nconst { filters, sort, layout, labels } = useTableContext()\n\nconst inputName = () => labels().filterInput(columnName(props.column))\n\nconst isFiltered = () =>\n rulesOf(props.query.filters, props.column.field).length > 0\n\nconst trigger = useFilterTrigger({\n column: () => props.column,\n labels,\n isFiltered\n})\n\nconst labelOf = () => {\n const label = filters.labelOf(props.column.field)\n if (!label) {\n return ''\n }\n const text = labels().filterCondition(label.condition, props.type)\n return label.count > 1 ? `${text} (${label.count})` : text\n}\n\n// A column with several rules shows their count where the value would be.\nconst inputText = () => {\n const count = filters.multiOf(props.column.field)\n return count > 0 ? `(${count})` : filters.draftOf(props.column.field).text\n}\n\nconst draft = () => filters.draftOf(props.column.field)\nconst isMulti = () => filters.multiOf(props.column.field) > 0\n\n// Types whose values have an order: the ones `Between` takes.\nconst ordered: readonly ColumnType[] = ['number', 'integer', 'date', 'datetime']\nconst isDated = () => props.type === 'date' || props.type === 'datetime'\n\n// A condition without a value has no input to type in: its label says it\n// all (C-113). A bool column keeps its select: it has no menu to pick one.\nconst hidesInput = () => {\n const { condition } = draft()\n return (\n !isMulti() &&\n props.type !== 'bool' &&\n condition !== null &&\n conditionArity(condition) === 0\n )\n}\n\n// `Between` takes two inputs, the lower bound first (C-114).\nconst isRange = () =>\n !isMulti() && draft().condition === 'Between' && ordered.includes(props.type)\n\nconst bounds: readonly FilterBound[] = ['lower', 'upper']\n\nconst boundText = (bound: FilterBound) =>\n bound === 'upper' ? (draft().text2 ?? '') : draft().text\n\nconst boundName = (bound: FilterBound) => {\n const name = columnName(props.column)\n return bound === 'upper'\n ? labels().filterInputTo(name)\n : labels().filterInputFrom(name)\n}\n\n// Whether the column type takes `condition`: one of its list, a null\n// predicate, or `Between` where values have an order.\nconst takes = (condition: FilterCondition) =>\n condition === 'Between'\n ? ordered.includes(props.type)\n : conditionArity(condition) === 0 ||\n conditionOptions[props.type].some(option => option.value === condition)\n\n// The column's own list when it has one (C-112), else its type's.\nconst offered = (): FilterCondition[] => {\n const own = props.column.filterConditions\n return own\n ? [...new Set(own)].filter(takes)\n : conditionOptions[props.type].map(({ value }) => value)\n}\n\nconst currentCondition = (): FilterCondition | null =>\n rulesOf(props.query.filters, props.column.field)[0]?.condition ??\n filters.draftOf(props.column.field).condition\n\nconst menuProps = (): FilterMenuSlotProps => {\n const { column } = props\n return {\n column,\n rules: rulesOf(props.query.filters, column.field),\n condition: currentCondition(),\n conditions: offered().map(value => ({\n value,\n label: labels().filterCondition(value, props.type)\n })),\n setCondition: condition => filters.setCondition(column.field, condition),\n clear: () => filters.clear(column.field),\n sortable: sort.isSortable(column),\n sortDirection: sort.sortOf(column),\n // `sortBy` does nothing where sorting is off, like a header click (C-07).\n setSort: direction => sort.sortBy(column, direction),\n trigger,\n control: layout.controlOf(column.field)\n }\n}\n\nconst datetimeProps = (\n bound: FilterBound | null = null\n): FilterDatetimeSlotProps => ({\n column: props.column,\n value: bound ? boundText(bound) : draft().text,\n updateValue: value =>\n filters.setInput(props.column.field, value, bound ?? undefined),\n bound\n})\n\nconst inputValue = (event: Event) =>\n (event.target as HTMLInputElement | HTMLSelectElement).value\n\n// A select has no typing: a pick applies at once.\nconst pick = (event: Event) => {\n filters.setInput(props.column.field, inputValue(event))\n filters.apply(props.column.field)\n}\n</script>\n\n<template>\n <div class=\"qt-filter\">\n <template v-if=\"isRange()\">\n <template v-for=\"bound in bounds\" :key=\"bound\">\n <slot\n v-if=\"isDated() && $slots['filter-datetime']\"\n name=\"filter-datetime\"\n v-bind=\"datetimeProps(bound)\"\n />\n <input\n v-else\n :type=\"isDated() ? 'date' : 'number'\"\n class=\"qt-filter-input\"\n :aria-label=\"boundName(bound)\"\n :value=\"boundText(bound)\"\n @input=\"filters.setInput(column.field, inputValue($event), bound)\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n </template>\n </template>\n <template v-else-if=\"hidesInput()\" />\n <input\n v-else-if=\"type === 'string'\"\n type=\"text\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"isMulti()\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <input\n v-else-if=\"type === 'number' || type === 'integer'\"\n :type=\"filters.multiOf(column.field) ? 'text' : 'number'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <template v-else-if=\"type === 'bool'\">\n <select\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"filters.draftOf(column.field).text\"\n :disabled=\"filters.multiOf(column.field) > 0\"\n @change=\"pick($event)\"\n >\n <option value=\"\">{{ labels().boolAll }}</option>\n <option value=\"true\">{{ labels().boolTrue }}</option>\n <option value=\"false\">{{ labels().boolFalse }}</option>\n </select>\n </template>\n <template v-else>\n <slot\n v-if=\"$slots['filter-datetime']\"\n name=\"filter-datetime\"\n v-bind=\"datetimeProps()\"\n />\n <input\n v-else\n :type=\"filters.multiOf(column.field) ? 'text' : 'date'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n </template>\n <slot v-if=\"type !== 'bool'\" name=\"filter-menu\" v-bind=\"menuProps()\" />\n <small v-if=\"labelOf()\" class=\"qt-filter-condition\">\n {{ labelOf() }}\n </small>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n conditionArity,\n conditionOptions,\n rulesOf\n} from '@dolusoft/query-protocol'\n\nimport type {\n Column,\n ColumnType,\n FilterBound,\n FilterCondition,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n Query\n} from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { useFilterTrigger } from '../filter/use-filter-trigger'\n\nconst props = defineProps<{\n column: Column\n type: ColumnType\n query: Query\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n}>()\n\nconst { filters, sort, layout, labels } = useTableContext()\n\nconst inputName = () => labels().filterInput(columnName(props.column))\n\nconst isFiltered = () =>\n rulesOf(props.query.filters, props.column.field).length > 0\n\nconst trigger = useFilterTrigger({\n column: () => props.column,\n labels,\n isFiltered\n})\n\nconst labelOf = () => {\n const label = filters.labelOf(props.column.field)\n if (!label) {\n return ''\n }\n const text = labels().filterCondition(label.condition, props.type)\n return label.count > 1 ? `${text} (${label.count})` : text\n}\n\n// A column with several rules shows their count where the value would be.\nconst inputText = () => {\n const count = filters.multiOf(props.column.field)\n return count > 0 ? `(${count})` : filters.draftOf(props.column.field).text\n}\n\nconst draft = () => filters.draftOf(props.column.field)\nconst isMulti = () => filters.multiOf(props.column.field) > 0\n\n// Types whose values have an order: the ones `Between` takes.\nconst ordered: readonly ColumnType[] = ['number', 'integer', 'date', 'datetime']\nconst isDated = () => props.type === 'date' || props.type === 'datetime'\n\n// A condition without a value has no input to type in: its label says it\n// all (C-113). A bool column keeps its select: it has no menu to pick one.\nconst hidesInput = () => {\n const { condition } = draft()\n return (\n !isMulti() &&\n props.type !== 'bool' &&\n condition !== null &&\n conditionArity(condition) === 0\n )\n}\n\n// `Between` takes two inputs, the lower bound first (C-114).\nconst isRange = () =>\n !isMulti() && draft().condition === 'Between' && ordered.includes(props.type)\n\nconst bounds: readonly FilterBound[] = ['lower', 'upper']\n\nconst boundText = (bound: FilterBound) =>\n bound === 'upper' ? (draft().text2 ?? '') : draft().text\n\nconst boundName = (bound: FilterBound) => {\n const name = columnName(props.column)\n return bound === 'upper'\n ? labels().filterInputTo(name)\n : labels().filterInputFrom(name)\n}\n\n// Whether the column type takes `condition`: one of its list, a null\n// predicate, or `Between` where values have an order.\nconst takes = (condition: FilterCondition) =>\n condition === 'Between'\n ? ordered.includes(props.type)\n : conditionArity(condition) === 0 ||\n conditionOptions[props.type].some(option => option.value === condition)\n\n// The column's own list when it has one (C-112), else its type's.\nconst offered = (): FilterCondition[] => {\n const own = props.column.filterConditions\n return own\n ? [...new Set(own)].filter(takes)\n : conditionOptions[props.type].map(({ value }) => value)\n}\n\nconst currentCondition = (): FilterCondition | null =>\n rulesOf(props.query.filters, props.column.field)[0]?.condition ??\n filters.draftOf(props.column.field).condition\n\nconst menuProps = (): FilterMenuSlotProps => {\n const { column } = props\n return {\n column,\n rules: rulesOf(props.query.filters, column.field),\n condition: currentCondition(),\n conditions: offered().map(value => ({\n value,\n label: labels().filterCondition(value, props.type)\n })),\n setCondition: condition => filters.setCondition(column.field, condition),\n clear: () => filters.clear(column.field),\n sortable: sort.isSortable(column),\n sortDirection: sort.sortOf(column),\n // `sortBy` does nothing where sorting is off, like a header click (C-07).\n setSort: direction => sort.sortBy(column, direction),\n trigger,\n control: layout.controlOf(column.field)\n }\n}\n\nconst datetimeProps = (\n bound: FilterBound | null = null\n): FilterDatetimeSlotProps => ({\n column: props.column,\n value: bound ? boundText(bound) : draft().text,\n updateValue: value =>\n filters.setInput(props.column.field, value, bound ?? undefined),\n bound\n})\n\nconst inputValue = (event: Event) =>\n (event.target as HTMLInputElement | HTMLSelectElement).value\n\n// A select has no typing: a pick applies at once.\nconst pick = (event: Event) => {\n filters.setInput(props.column.field, inputValue(event))\n filters.apply(props.column.field)\n}\n</script>\n\n<template>\n <div class=\"qt-filter\">\n <template v-if=\"isRange()\">\n <template v-for=\"bound in bounds\" :key=\"bound\">\n <slot\n v-if=\"isDated() && $slots['filter-datetime']\"\n name=\"filter-datetime\"\n v-bind=\"datetimeProps(bound)\"\n />\n <input\n v-else\n :type=\"isDated() ? 'date' : 'number'\"\n class=\"qt-filter-input\"\n :aria-label=\"boundName(bound)\"\n :value=\"boundText(bound)\"\n @input=\"filters.setInput(column.field, inputValue($event), bound)\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n </template>\n </template>\n <template v-else-if=\"hidesInput()\" />\n <input\n v-else-if=\"type === 'string'\"\n type=\"text\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"isMulti()\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <input\n v-else-if=\"type === 'number' || type === 'integer'\"\n :type=\"filters.multiOf(column.field) ? 'text' : 'number'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n <template v-else-if=\"type === 'bool'\">\n <select\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"filters.draftOf(column.field).text\"\n :disabled=\"filters.multiOf(column.field) > 0\"\n @change=\"pick($event)\"\n >\n <option value=\"\">{{ labels().boolAll }}</option>\n <option value=\"true\">{{ labels().boolTrue }}</option>\n <option value=\"false\">{{ labels().boolFalse }}</option>\n </select>\n </template>\n <template v-else>\n <slot\n v-if=\"$slots['filter-datetime']\"\n name=\"filter-datetime\"\n v-bind=\"datetimeProps()\"\n />\n <input\n v-else\n :type=\"filters.multiOf(column.field) ? 'text' : 'date'\"\n class=\"qt-filter-input\"\n :aria-label=\"inputName()\"\n :value=\"inputText()\"\n :readonly=\"filters.multiOf(column.field) > 0\"\n @input=\"filters.setInput(column.field, inputValue($event))\"\n @keydown.enter=\"filters.apply(column.field)\"\n />\n </template>\n <slot v-if=\"type !== 'bool'\" name=\"filter-menu\" v-bind=\"menuProps()\" />\n <small v-if=\"labelOf()\" class=\"qt-filter-condition\">\n {{ labelOf() }}\n </small>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { reorder, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = reorder.listeners(() => props.column)\n</script>\n\n<template>\n <!-- C-73: a button that moves the column within its region, by drag or by\n key. The table draws no live region: the consumer announces. -->\n <button\n type=\"button\"\n class=\"qt-reorder-handle\"\n :aria-label=\"labels().moveColumn(columnName(column))\"\n aria-keyshortcuts=\"ArrowLeft ArrowRight Home End\"\n v-on=\"on\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <circle cx=\"9\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"18\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"18\" r=\"1.5\" />\n </svg>\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { reorder, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = reorder.listeners(() => props.column)\n</script>\n\n<template>\n <!-- C-73: a button that moves the column within its region, by drag or by\n key. The table draws no live region: the consumer announces. -->\n <button\n type=\"button\"\n class=\"qt-reorder-handle\"\n :aria-label=\"labels().moveColumn(columnName(column))\"\n aria-keyshortcuts=\"ArrowLeft ArrowRight Home End\"\n v-on=\"on\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <circle cx=\"9\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"18\" r=\"1.5\" />\n <circle cx=\"15\" cy=\"18\" r=\"1.5\" />\n </svg>\n </button>\n</template>\n","// The width each drawn column needs for its content (C-99, ADR 0013).\n\n/**\n * What must not count, inside the table: the filter row and the resize handle\n * of a header cell (C-50 counts the label only), the footer, and every body\n * row that is not a data row (subtable, virtual spacer, loading, empty,\n * load-more). A subtable or a spanning cell would otherwise widen the\n * columns it spans with content that is not theirs.\n */\nconst notCountedParts = [\n ':scope > thead > tr > th[data-field] > .qt-resize-handle',\n ':scope > tbody > tr:not([data-row-index])',\n ':scope > tfoot'\n]\nconst filterRow = ':scope > thead > tr > th[data-field] > .qt-filter'\nconst notCounted = [filterRow, ...notCountedParts].join(', ')\nconst notCountedWithFilters = notCountedParts.join(', ')\n\n/**\n * The room a text, number or date filter input keeps for its text when the\n * filter row counts (C-100): six characters of the input's own font.\n */\nconst filterText = '6ch'\n\ninterface MeasureOptions {\n /**\n * The filter row counts as a floor (C-100): laid out at the width it\n * needs, its controls side by side and six characters of text in each\n * input, so a column is never drawn narrower than its filter.\n */\n filters?: boolean\n}\n\n/**\n * Sets inline declarations for one read and puts every `style` attribute\n * back exactly as it was, absent included, so the markup after the call is\n * the markup before it (C-31). `!important` so a consumer's `!important`\n * rule cannot keep the fixed layout during the read.\n */\nexport const styleSwap = () => {\n const saved = new Map<HTMLElement, string | null>()\n return {\n set(element: HTMLElement, property: string, value: string) {\n if (!saved.has(element)) {\n saved.set(element, element.getAttribute('style'))\n }\n element.style.setProperty(property, value, 'important')\n },\n restore() {\n for (const [element, style] of saved) {\n if (style === null) {\n // Chrome writes a CSSOM change to the attribute lazily: removed\n // before that write, the attribute comes back as `style=\"\"`. The\n // read flushes it first.\n element.getAttribute('style')\n element.removeAttribute('style')\n } else {\n element.setAttribute('style', style)\n }\n }\n saved.clear()\n }\n }\n}\n\n/**\n * The max-content width of each drawn column, by `field`: header label and\n * the cells of the drawn data rows, padding and border included, in whole\n * pixels rounded up. The browser lays the table out once with its automatic\n * layout and no widths, the parts that do not count taken out, and every\n * style is put back before the function returns: nothing is painted in\n * between, and slot content that draws a block or a flex box counts with the\n * width its content needs, not the width its cell gives it. Only `fields`\n * when given; a column with no box (the table not displayed) is left out.\n * With `scrollBody` the data rows are in a table of their own, `body`\n * (C-101): it is laid out the same way, its `col` widths left out, and a\n * column takes the wider of its header cell and its body cells.\n */\nexport const measureColumnWidths = (\n table: HTMLTableElement | null | undefined,\n fields?: readonly string[],\n body?: HTMLTableElement | null,\n options: MeasureOptions = {}\n): Record<string, number> => {\n const widths: Record<string, number> = {}\n if (!table?.tHead) {\n return widths\n }\n const wanted = fields ? new Set(fields) : null\n const headers = Array.from(\n table.querySelectorAll<HTMLTableCellElement>(\n ':scope > thead > tr > th[data-field]'\n )\n )\n const swap = styleSwap()\n try {\n swap.set(table, 'table-layout', 'auto')\n swap.set(table, 'width', 'max-content')\n swap.set(table, 'min-width', '0')\n for (const th of headers) {\n swap.set(th, 'width', 'auto')\n }\n for (const part of Array.from(\n table.querySelectorAll<HTMLElement>(\n options.filters ? notCountedWithFilters : notCounted\n )\n )) {\n swap.set(part, 'display', 'none')\n }\n if (options.filters) {\n countFilters(table, swap)\n }\n const split = body && body !== table ? body : null\n if (split) {\n swap.set(split, 'table-layout', 'auto')\n swap.set(split, 'width', 'max-content')\n swap.set(split, 'min-width', '0')\n for (const col of Array.from(\n split.querySelectorAll<HTMLElement>(':scope > colgroup > col')\n )) {\n swap.set(col, 'width', 'auto')\n }\n for (const part of Array.from(\n split.querySelectorAll<HTMLElement>(\n ':scope > tbody > tr:not([data-row-index])'\n )\n )) {\n swap.set(part, 'display', 'none')\n }\n }\n // One data row is enough: the cells of a column share its width.\n const firstRow = split?.querySelector(':scope > tbody > tr[data-row-index]')\n const measured: [string, HTMLTableCellElement, number][] = []\n for (const th of headers) {\n const field = th.dataset.field\n if (field === undefined || (wanted && !wanted.has(field))) {\n continue\n }\n const own = th.getBoundingClientRect().width\n if (own === 0) {\n // No box: the table is not displayed.\n continue\n }\n const cell = firstRow?.querySelector(\n `:scope > td[data-field=\"${CSS.escape(field)}\"]`\n )\n measured.push([\n field,\n th,\n Math.max(own, cell?.getBoundingClientRect().width ?? 0)\n ])\n }\n const floors = options.filters\n ? filterFloors(\n measured.map(([, th]) => th),\n swap\n )\n : null\n for (const [field, th, width] of measured) {\n widths[field] = Math.ceil(Math.max(width, floors?.get(th) ?? 0))\n }\n } finally {\n swap.restore()\n }\n return widths\n}\n\n/**\n * Takes the filter rows out of the read (C-100): out of the cell's flow\n * (`position: absolute`), so nothing in them widens the column by being\n * there, and no size container, which would switch the row to its narrow\n * form. Each control of the table stops growing and shrinking: a text or\n * number input six characters wide (padding and border on top), a select\n * and a date or time input as wide as they draw themselves, a filter button\n * at its own width, back in the row's flow when a skin's narrow form laid it\n * `absolute` over the input. A control `fixed` over the page (a panel)\n * stays out.\n */\nconst countFilters = (\n table: HTMLTableElement,\n swap: ReturnType<typeof styleSwap>\n) => {\n const rows = Array.from(table.querySelectorAll<HTMLElement>(filterRow))\n for (const row of rows) {\n swap.set(row, 'position', 'absolute')\n swap.set(row, 'container-type', 'normal')\n swap.set(row, 'contain', 'none')\n swap.set(row, 'box-sizing', 'content-box')\n for (const input of Array.from(\n row.querySelectorAll<HTMLElement>(':scope > .qt-filter-input')\n )) {\n swap.set(input, 'flex', 'none')\n swap.set(input, 'min-width', '0')\n if (input instanceof HTMLInputElement && textTypes.has(input.type)) {\n swap.set(input, 'box-sizing', 'content-box')\n swap.set(input, 'width', filterText)\n } else {\n swap.set(input, 'width', 'auto')\n }\n }\n for (const button of Array.from(\n row.querySelectorAll<HTMLElement>(':scope > .qt-filter-button')\n )) {\n swap.set(button, 'flex', 'none')\n }\n }\n // Read once the rows are no containers: a skin's narrow form is gone.\n for (const row of rows) {\n for (const button of Array.from(\n row.querySelectorAll<HTMLElement>(':scope > .qt-filter-button')\n )) {\n if (getComputedStyle(button).position === 'absolute') {\n swap.set(button, 'position', 'static')\n }\n }\n }\n}\n\n/** The inputs that keep six characters of text; the others draw their own. */\nconst textTypes = new Set(['text', 'number', 'search'])\n\nconst horizontal = (style: CSSStyleDeclaration) =>\n (parseFloat(style.paddingLeft) || 0) +\n (parseFloat(style.paddingRight) || 0) +\n (parseFloat(style.borderLeftWidth) || 0) +\n (parseFloat(style.borderRightWidth) || 0)\n\n/** The table's own filter controls, the row's children, that take room. */\nconst controlsOf = (row: HTMLElement) =>\n Array.from(\n row.querySelectorAll<HTMLElement>(\n ':scope > :is(.qt-filter-input, .qt-filter-button)'\n )\n ).filter(control => {\n // A control laid out of the row's flow (a panel over the page) takes\n // no room in the column.\n const { position } = getComputedStyle(control)\n return position !== 'fixed' && position !== 'absolute'\n })\n\n/** The row's content width the probes draw it at: `0` and this. */\nconst probe = 1000\n\n/**\n * The width each header cell needs for its filter controls, from the\n * controls alone: the row's width is never read, so slot content in it\n * cannot count, by its own width or by a width it took from the column. The\n * controls are drawn side by side in rows `0` and `probe` pixels wide, and\n * each width (a control, the gap) is taken as a fixed part plus a share of\n * the row, which is what a percentage padding is. The row then needs `R`\n * with `R = fixed + share * R`, the cell `R` plus the row's and the cell's\n * padding and border.\n */\nconst filterFloors = (\n headers: HTMLTableCellElement[],\n swap: ReturnType<typeof styleSwap>\n) => {\n const rows = headers.flatMap(th => {\n const row = th.querySelector<HTMLElement>(':scope > .qt-filter')\n const controls = row ? controlsOf(row) : []\n return row && controls.length > 0 ? [{ th, row, controls }] : []\n })\n const read = (width: number) => {\n for (const { row } of rows) {\n swap.set(row, 'width', `${width}px`)\n }\n return rows.map(({ row, controls }) => {\n const drawn = controls\n .map(control => control.getBoundingClientRect().width)\n .filter(each => each > 0)\n const gap = parseFloat(getComputedStyle(row).columnGap) || 0\n return drawn.length === 0\n ? 0\n : drawn.reduce((sum, each) => sum + each, 0) + gap * (drawn.length - 1)\n })\n }\n const atZero = read(0)\n const atProbe = read(probe)\n const floors = new Map<HTMLTableCellElement, number>()\n rows.forEach(({ th, row }, index) => {\n const fixed = atZero[index]\n if (fixed === 0) {\n return\n }\n // At most 90% of the row can be a share: past that no width holds.\n const share = Math.min(0.9, Math.max(0, (atProbe[index] - fixed) / probe))\n floors.set(\n th,\n fixed / (1 - share) +\n horizontal(getComputedStyle(row)) +\n horizontal(getComputedStyle(th))\n )\n })\n return floors\n}\n","// Between the width a column is declared with and the width it is drawn at\n// (C-49, C-50).\n\nimport { styleSwap } from './measure-widths'\n\n/** How a column's declared width maps to the width it is drawn at. */\nexport interface WidthScale {\n /** The declared width that draws the column `rendered` pixels wide. */\n declared: (rendered: number) => number\n /** The width the column is drawn at with the `declared` width. */\n rendered: (declared: number) => number\n}\n\nconst same = (width: number) => width\n\nconst sum = (widths: number[]) => widths.reduce((a, b) => a + b, 0)\n\n/** The declared width is the drawn one. */\nexport const identityScale: WidthScale = { declared: same, rendered: same }\n\n/**\n * A table whose cells take `space` (a container's width, with\n * `min-width: 100%`) and whose columns are declared narrower: the fixed\n * layout spreads the rest over the columns by their declared widths, so a\n * column declared `w` next to `others` is drawn `w * space / (w + others)`\n * wide until the columns fill the space, and `w` from there on. With no other\n * column the one column takes the space whatever its width: the identity.\n */\nexport const stretchedScale = (space: number, others: number): WidthScale =>\n others > 0 && space > others\n ? {\n declared: rendered =>\n rendered >= space - others\n ? rendered\n : (rendered * others) / (space - rendered),\n rendered: declared =>\n declared + others >= space\n ? declared\n : (declared * space) / (declared + others)\n }\n : identityScale\n\n/**\n * How the declared width of the column of `th` maps to its drawn width, read\n * from the layout. The column is drawn once at the width it is drawn at now.\n * Wider there, the table stretches it: its row's cells take the whole space,\n * and the other columns' declared widths follow from the stretch; the fit\n * must then give back the width the column is drawn at now. Not wider, the\n * column is drawn once more at `low`, the narrowest width a resize writes. A\n * table that stretches it there widens every cell of the row by one factor,\n * the column at least as much (content the fixed layout keeps wider than\n * `low` only adds to it), and its cells then take the space the columns can\n * shrink into before the table stretches them. Any other layout gets the\n * identity: one that never stretches, a column without a width that takes\n * what is left, one that spreads the space otherwise. Every style is put back before the\n * function returns (C-31), so nothing is painted in between.\n */\nexport const measureWidthScale = (th: HTMLElement, low: number): WidthScale => {\n const now = th.getBoundingClientRect().width\n const others = Array.from(th.parentElement?.children ?? []).filter(\n cell => cell !== th\n )\n const widths = () => others.map(cell => cell.getBoundingClientRect().width)\n const swap = styleSwap()\n /** Draws the column `width` wide; the width it takes. */\n const draw = (width: number) => {\n swap.set(th, 'width', `${width}px`)\n return th.getBoundingClientRect().width\n }\n try {\n const drawn = draw(now)\n const before = widths()\n const rest = sum(before)\n if (drawn > now + 0.5) {\n const space = drawn + rest\n const scale = stretchedScale(space, (now * rest) / drawn)\n return Math.abs(draw(scale.declared(now)) - now) <= 1\n ? scale\n : identityScale\n }\n const narrow = draw(low)\n const after = widths()\n const factor = sum(after) / rest\n const stretched =\n factor > 1 &&\n narrow >= low * factor - 1 &&\n after.every((width, i) => Math.abs(width - before[i] * factor) <= 1)\n return stretched ? stretchedScale(narrow + sum(after), rest) : identityScale\n } finally {\n swap.restore()\n }\n}\n","import { onBeforeUnmount, shallowRef } from 'vue'\n\nimport type { Column, ColumnResizePayload } from '../contract'\nimport { measureColumnWidths } from './measure-widths'\nimport { measureWidthScale, type WidthScale } from './width-scale'\n\n/** Default `Column.minWidth`, in pixels. */\nconst defaultMinWidth = 40\n\nexport interface ColumnResizeOptions {\n /** The `resizable` prop: whether the table draws resize handles. */\n resizable: () => boolean\n /** Measured width of a header cell, by `field`. */\n measuredWidth: (field: string) => number | undefined\n /** Measured width of the table. */\n tableWidth: () => number\n /** With `scrollBody`: the table of the body rows (C-101), else `null`. */\n body: () => HTMLTableElement | null\n emit: (payload: ColumnResizePayload) => void\n}\n\n/**\n * A width limit a consumer gave, or `undefined` when it cannot be one. The\n * types say `number`, but a loosely typed consumer can pass `''`, `NaN`,\n * `0` or a negative: those count as unset instead of clamping to 0.\n */\nexport const limitOf = (value: unknown) =>\n typeof value === 'number' && Number.isFinite(value) && value > 0\n ? value\n : undefined\n\n/**\n * The smallest width: `Column.minWidth`, else the default 40 (which gives way\n * to a smaller `Column.maxWidth`, so a maximum alone keeps working).\n */\nexport const minWidthOf = (column: Column) =>\n limitOf(column.minWidth) ??\n Math.min(defaultMinWidth, limitOf(column.maxWidth) ?? defaultMinWidth)\n\n/** The largest width, or `undefined` for none. A `minWidth` above it wins. */\nconst maxWidthOf = (column: Column) => {\n const max = limitOf(column.maxWidth)\n return max === undefined ? undefined : Math.max(max, minWidthOf(column))\n}\n\nexport const clampWidth = (column: Column, width: number) =>\n Math.round(\n Math.min(\n maxWidthOf(column) ?? Infinity,\n Math.max(minWidthOf(column), width)\n )\n )\n\ninterface Drag {\n column: Column\n pointerId: number\n startX: number\n /** The width the column is drawn at when the drag starts. */\n startWidth: number\n scale: WidthScale\n lastX: number\n frame: number\n}\n\nconst cellOf = (event: Event) =>\n (event.currentTarget as HTMLElement).closest('th')\n\n/**\n * Which edge of the column the handle stands for: `1` for the right edge,\n * `-1` for the left one. A right-pinned column stays at the right edge of the\n * scroll container, so it grows to the left: its handle stands for its left\n * edge, and moving that edge to the left widens it (C-71).\n */\nconst edgeOf = (column: Column) => (column.pinned === 'right' ? -1 : 1)\n\n/**\n * The scale of a column's widths, read from the layout once per drag or key:\n * a table stretched to its container draws a column wider than declared.\n */\nconst scaleOf = (th: HTMLElement, column: Column) =>\n measureWidthScale(th, clampWidth(column, 0))\n\n/**\n * Resizing a column (C-48 to C-50). The table holds a width only while a\n * drag is under way (the preview, P2); every committed width goes out as a\n * `columnResize` event and comes back, if the consumer wants it, as\n * `Column.width`. The handle captures the pointer, so all drag events arrive\n * at the handle itself, and it has the focus, so Escape does too. The pointer\n * and the arrow keys move the drawn width; what the table writes and emits is\n * the declared width that draws it (`measureWidthScale`).\n */\nexport const useColumnResize = (options: ColumnResizeOptions) => {\n /** `width` is declared (the inline style), `rendered` drawn. */\n const preview = shallowRef<{\n field: string\n width: number\n rendered: number\n } | null>(null)\n let drag: Drag | null = null\n\n const isResizable = (column: Column) =>\n options.resizable() && column.resizable !== false\n\n /** The width the header shows: the preview while dragging, else measured. */\n const widthOf = (column: Column) =>\n preview.value?.field === column.field\n ? preview.value.rendered\n : Math.round(options.measuredWidth(column.field) ?? 0)\n\n /** Emits the declared width `width`, unless it is the declared `from`. */\n const commit = (column: Column, from: number, width: number) => {\n const next = clampWidth(column, width)\n if (next !== Math.round(from)) {\n options.emit({ field: column.field, width: next })\n }\n }\n\n /** The declared width that draws the column where the pointer is. */\n const dragged = (current: Drag) =>\n current.scale.declared(\n current.startWidth +\n edgeOf(current.column) * (current.lastX - current.startX)\n )\n\n const end = (apply: boolean) => {\n const current = drag\n if (current) {\n drag = null\n cancelAnimationFrame(current.frame)\n preview.value = null\n if (apply) {\n commit(\n current.column,\n current.scale.declared(current.startWidth),\n dragged(current)\n )\n }\n }\n }\n\n /** Every pointer event of a handle; one listener for the whole drag. */\n const onPointer = (event: PointerEvent, column: Column) => {\n if (event.type === 'pointerdown') {\n const th = cellOf(event)\n if (event.button !== 0 || drag || !th) {\n return\n }\n const handle = event.currentTarget as HTMLElement\n // No text selection and no focus ring flicker while dragging.\n event.preventDefault()\n handle.focus({ preventScroll: true })\n handle.setPointerCapture(event.pointerId)\n drag = {\n column,\n pointerId: event.pointerId,\n startX: event.clientX,\n startWidth: th.getBoundingClientRect().width,\n scale: scaleOf(th, column),\n lastX: event.clientX,\n frame: 0\n }\n return\n }\n if (!drag || event.pointerId !== drag.pointerId) {\n return\n }\n drag.lastX = event.clientX\n if (event.type === 'pointermove') {\n // One preview per frame, whatever the pointer rate (no layout thrash).\n drag.frame ||= requestAnimationFrame(() => {\n if (drag) {\n drag.frame = 0\n const width = clampWidth(drag.column, dragged(drag))\n preview.value = {\n field: drag.column.field,\n width,\n rendered: Math.round(drag.scale.rendered(width))\n }\n }\n })\n } else {\n // pointerup commits; pointercancel and a lost capture cancel.\n end(event.type === 'pointerup')\n }\n }\n\n /**\n * Arrow keys step the drawn width, Enter fits it to the content (the\n * declared width `measureColumnWidths` gives, as it is).\n */\n const onKey = (event: KeyboardEvent, column: Column) => {\n const { key } = event\n if (drag) {\n if (key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n end(false)\n }\n return\n }\n const sign =\n (key === 'ArrowRight' ? 1 : key === 'ArrowLeft' ? -1 : 0) * edgeOf(column)\n const th = cellOf(event)\n if (th && (sign || key === 'Enter' || event.type === 'dblclick')) {\n event.preventDefault()\n const drawn = th.getBoundingClientRect().width\n const scale = scaleOf(th, column)\n const from = scale.declared(drawn)\n const step = scale.declared(\n Math.round(drawn) + sign * (event.shiftKey ? 50 : 10)\n )\n // A step moves at least one declared pixel, however stretched the\n // table. Autofit is the width `measureColumnWidths` gives (C-50, C-99),\n // with the filter row as a floor as for `autoWidth` (C-100); a column\n // that measures nothing (the table not displayed) stays.\n const to = sign\n ? from + sign * Math.max(1, Math.abs(step - from))\n : measureColumnWidths(\n th.closest('table'),\n [column.field],\n options.body(),\n { filters: true }\n )[column.field]\n if (to !== undefined) {\n commit(column, from, to)\n }\n }\n }\n\n /**\n * The listeners of one handle, as one `v-on` object made once per handle.\n * Pointer capture sends every drag event to the handle itself.\n */\n const listeners = (column: () => Column) => {\n const pointer = (event: PointerEvent) => {\n onPointer(event, column())\n }\n const key = (event: Event) => {\n onKey(event as KeyboardEvent, column())\n }\n return {\n pointerdown: pointer,\n pointermove: pointer,\n pointerup: pointer,\n pointercancel: pointer,\n lostpointercapture: pointer,\n keydown: key,\n dblclick: key,\n // The handle sits inside the header cell: a click never sorts.\n click: (event: Event) => {\n event.stopPropagation()\n }\n }\n }\n\n /** `aria-valuemax`: `maxWidth`, or else the table width (what can show). */\n const maxOf = (column: Column) =>\n maxWidthOf(column) ??\n Math.max(widthOf(column), Math.round(options.tableWidth()))\n\n onBeforeUnmount(() => {\n if (drag) {\n cancelAnimationFrame(drag.frame)\n drag = null\n }\n })\n\n return { preview, isResizable, widthOf, maxOf, listeners }\n}\n\nexport type ColumnResize = ReturnType<typeof useColumnResize>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { minWidthOf } from '../resize/use-column-resize'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { resize, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = resize.listeners(() => props.column)\n</script>\n\n<template>\n <!-- A focusable vertical separator (C-48): the value is the column width in\n pixels, from `minWidth` to `maxWidth` (or the table width). -->\n <div\n class=\"qt-resize-handle\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n :aria-label=\"labels().resizeColumn(columnName(column))\"\n :aria-valuenow=\"resize.widthOf(column)\"\n :aria-valuemin=\"minWidthOf(column)\"\n :aria-valuemax=\"resize.maxOf(column)\"\n v-on=\"on\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport type { Column } from '../contract'\nimport { columnName } from '../core/labels'\nimport { useTableContext } from '../core/table-context'\nimport { minWidthOf } from '../resize/use-column-resize'\n\nconst props = defineProps<{ column: Column }>()\n\nconst { resize, labels } = useTableContext()\n\n// One listener object per handle, made once; it reads the current column.\nconst on = resize.listeners(() => props.column)\n</script>\n\n<template>\n <!-- A focusable vertical separator (C-48): the value is the column width in\n pixels, from `minWidth` to `maxWidth` (or the table width). -->\n <div\n class=\"qt-resize-handle\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n :aria-label=\"labels().resizeColumn(columnName(column))\"\n :aria-valuenow=\"resize.widthOf(column)\"\n :aria-valuemin=\"minWidthOf(column)\"\n :aria-valuemax=\"resize.maxOf(column)\"\n v-on=\"on\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport type { Column, SortDirection } from '../contract'\n\ndefineProps<{\n column: Column\n /** The direction the table is sorted in on this column, if any. */\n direction: SortDirection | null\n}>()\n\ndefineEmits<{ click: [] }>()\n</script>\n\n<template>\n <button\n type=\"button\"\n class=\"qt-sort\"\n :aria-label=\"column.title ? undefined : column.field\"\n @click=\"$emit('click')\"\n >\n {{ column.title }}\n <svg\n v-if=\"direction === 'asc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3.5L12.5 9.5H3.5L8 3.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else-if=\"direction === 'desc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 12.5L3.5 6.5H12.5L8 12.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3L11.5 7H4.5L8 3Z\" fill=\"currentColor\" />\n <path d=\"M8 13L4.5 9H11.5L8 13Z\" fill=\"currentColor\" />\n </svg>\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column, SortDirection } from '../contract'\n\ndefineProps<{\n column: Column\n /** The direction the table is sorted in on this column, if any. */\n direction: SortDirection | null\n}>()\n\ndefineEmits<{ click: [] }>()\n</script>\n\n<template>\n <button\n type=\"button\"\n class=\"qt-sort\"\n :aria-label=\"column.title ? undefined : column.field\"\n @click=\"$emit('click')\"\n >\n {{ column.title }}\n <svg\n v-if=\"direction === 'asc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3.5L12.5 9.5H3.5L8 3.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else-if=\"direction === 'desc'\"\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 12.5L3.5 6.5H12.5L8 12.5Z\" fill=\"currentColor\" />\n </svg>\n <svg\n v-else\n class=\"qt-sort-icon\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 16 16\"\n aria-hidden=\"true\"\n >\n <path d=\"M8 3L11.5 7H4.5L8 3Z\" fill=\"currentColor\" />\n <path d=\"M8 13L4.5 9H11.5L8 13Z\" fill=\"currentColor\" />\n </svg>\n </button>\n</template>\n","import type { SortDirection } from '../contract'\n\n/** Value of the `aria-sort` attribute for a direction. */\nexport const ariaSort = (direction: SortDirection | null) =>\n direction === 'asc'\n ? 'ascending'\n : direction === 'desc'\n ? 'descending'\n : undefined\n","<script setup lang=\"ts\">\nimport { rulesOf } from '@dolusoft/query-protocol'\nimport { computed, nextTick } from 'vue'\n\nimport type {\n Column,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n HeaderSlotProps,\n Query\n} from '../contract'\nimport FilterCell from './filter-cell.vue'\nimport ReorderHandle from './reorder-handle.vue'\nimport ResizeHandle from './resize-handle.vue'\nimport SortButton from './sort-button.vue'\nimport { sideOf } from '../columns/column-layout'\nimport { columnTypeOf } from '../core/column'\nimport { useTableContext } from '../core/table-context'\nimport { focusFirstFilter } from '../filter/focus-filter'\nimport { pinAttrs, utilityKey, type Utility } from '../pin/pin'\nimport { ariaSort } from '../sort/sort'\n\nconst props = defineProps<{\n /** Columns to draw: hidden ones dropped, pinned left first, pinned right last. */\n columns: Column[]\n query: Query\n filterable: boolean\n /** Utility cells before the columns, in order. */\n utilities: Utility[]\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** Automatic width of each column without a width, by `field` (C-100). */\n autoWidths: Readonly<Record<string, number>>\n /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), one per line: a field name may hold a space, never a\n * line break. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n /** Draws the consumer's `header-<field>` slot for `column`. */\n header?(props: HeaderSlotProps): unknown\n}>()\n\nconst given = (name: string) => props.slotNames.split('\\n').includes(name)\n\nconst { filters, sort, layout, resize, reorder, selection, labels } =\n useTableContext()\n\n// C-73: the drag preview is attributes only; nothing moves until release.\nconst dragAttrs = (column: Column) => {\n const drag = reorder.dragging.value\n return {\n 'data-dragging': drag?.field === column.field ? '' : undefined,\n 'data-drop': drag?.target === column.field ? drag.place : undefined\n }\n}\n\n// A computed: the header re-renders when the answer changes, not with every\n// pending filter draft.\nconst canClearAll = computed(() => filters.canClearAll())\n\n// C-22: a disabled button drops the focus to the page. When the button holds\n// the focus, a click with `detail` 0 (a key, `element.click()`, some\n// assistive technologies) activates it and the update that clear causes\n// disables it, the focus goes to the first filter instead. A pointer click\n// is left alone, so a touch screen opens no keyboard; nothing else (the\n// `toolbar` slot's `clearFilters()`, a later query) moves the focus.\nconst onClearAll = async (event: MouseEvent) => {\n const button = event.currentTarget as HTMLButtonElement\n const doc = button.ownerDocument\n const keyed = event.detail === 0 && doc.activeElement === button\n filters.clearAll()\n if (!keyed) {\n return\n }\n // The clear queued the re-render that disables the button, or keeps it\n // enabled when the consumer's query keeps a filter.\n await nextTick()\n const active = doc.activeElement\n if (\n button.disabled &&\n (active === button || active === doc.body || active === null)\n ) {\n focusFirstFilter(button.closest('table'))\n }\n}\n\nconst isFiltered = (column: Column) =>\n rulesOf(props.query.filters, column.field).length > 0\n\nconst hasFilter = (column: Column) =>\n props.filterable && column.filterable !== false\n\n// The first utility hosts the clear-all button (C-22); the selection column\n// holds its select-all checkbox instead.\nconst hostsClearAll = (utility: Utility) =>\n props.filterable &&\n utility === props.utilities.find(candidate => candidate !== 'select')\n\nconst utilityAttrs = (utility: Utility) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\n\n// The only inline styles of a header cell: the column width (or the drag\n// preview, C-49, or the automatic width, C-100) and the pin offset (C-47,\n// C-71), with `data-pinned`.\nconst widthOf = (column: Column) => {\n if (column.width) {\n return column.width\n }\n const auto = props.autoWidths[column.field]\n return auto === undefined ? undefined : `${auto}px`\n}\n\nconst cellAttrs = (column: Column) => {\n const preview = resize.preview.value\n return pinAttrs(\n sideOf(column),\n props.offsets[column.field],\n preview?.field === column.field ? `${preview.width}px` : widthOf(column)\n )\n}\n\nconst headerSlotProps = (column: Column): HeaderSlotProps => ({\n column,\n sortDirection: sort.sortOf(column),\n sortable: sort.isSortable(column),\n toggleSort: () => {\n sort.sortBy(column)\n },\n control: layout.controlOf(column.field)\n})\n</script>\n\n<template>\n <tr :role=\"roles ? 'row' : undefined\">\n <!-- A utility header cell labels nothing; it is a `th` only when it holds\n the clear-all button, and an empty `td` otherwise (C-45). -->\n <template v-for=\"utility in utilities\" :key=\"utility\">\n <th\n v-if=\"utility === 'select'\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <input\n type=\"checkbox\"\n class=\"qt-select-all\"\n :aria-label=\"labels().selectAllRows\"\n :checked=\"selection.allSelected.value\"\n :indeterminate=\"selection.someSelected.value\"\n @change=\"\n selection.toggleAll(($event.target as HTMLInputElement).checked)\n \"\n />\n </th>\n <td\n v-else-if=\"!hostsClearAll(utility)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n />\n <th\n v-else\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <button\n type=\"button\"\n class=\"qt-clear-all-button\"\n :title=\"labels().clearAllFilters\"\n :aria-label=\"labels().clearAllFilters\"\n :disabled=\"!canClearAll\"\n @click.stop=\"onClearAll\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </th>\n </template>\n <th\n v-for=\"column in columns\"\n :key=\"column.field\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n :data-field=\"column.field\"\n :data-type=\"columnTypeOf(column)\"\n :data-sort=\"sort.sortOf(column) ?? undefined\"\n :data-sortable=\"sort.isSortable(column) ? '' : undefined\"\n :data-filtered=\"isFiltered(column) ? '' : undefined\"\n :aria-sort=\"ariaSort(sort.sortOf(column))\"\n v-bind=\"{ ...cellAttrs(column), ...dragAttrs(column) }\"\n >\n <!-- C-73: the reorder handle is the first child, the resize handle the last. -->\n <reorder-handle v-if=\"reorder.isReorderable(column)\" :column=\"column\" />\n <!-- C-51: the header slot replaces the label only. -->\n <slot\n v-if=\"given(`header-${column.field}`)\"\n name=\"header\"\n v-bind=\"headerSlotProps(column)\"\n />\n <sort-button\n v-else-if=\"sort.isSortable(column)\"\n :column=\"column\"\n :direction=\"sort.sortOf(column)\"\n @click=\"sort.sortBy(column)\"\n />\n <span v-else class=\"qt-title\">{{ column.title }}</span>\n <filter-cell\n v-if=\"hasFilter(column)\"\n :column=\"column\"\n :type=\"columnTypeOf(column)\"\n :query=\"query\"\n >\n <template v-if=\"given('filter-datetime')\" #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template v-if=\"given('filter-menu')\" #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </filter-cell>\n <resize-handle v-if=\"resize.isResizable(column)\" :column=\"column\" />\n </th>\n </tr>\n</template>\n","<script setup lang=\"ts\">\nimport { rulesOf } from '@dolusoft/query-protocol'\nimport { computed, nextTick } from 'vue'\n\nimport type {\n Column,\n FilterDatetimeSlotProps,\n FilterMenuSlotProps,\n HeaderSlotProps,\n Query\n} from '../contract'\nimport FilterCell from './filter-cell.vue'\nimport ReorderHandle from './reorder-handle.vue'\nimport ResizeHandle from './resize-handle.vue'\nimport SortButton from './sort-button.vue'\nimport { sideOf } from '../columns/column-layout'\nimport { columnTypeOf } from '../core/column'\nimport { useTableContext } from '../core/table-context'\nimport { focusFirstFilter } from '../filter/focus-filter'\nimport { pinAttrs, utilityKey, type Utility } from '../pin/pin'\nimport { ariaSort } from '../sort/sort'\n\nconst props = defineProps<{\n /** Columns to draw: hidden ones dropped, pinned left first, pinned right last. */\n columns: Column[]\n query: Query\n filterable: boolean\n /** Utility cells before the columns, in order. */\n utilities: Utility[]\n /** Some column is pinned to the left: the utilities get `data-pinned` (C-46). */\n hasPinned: boolean\n /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: Readonly<Record<string, number>>\n /** Automatic width of each column without a width, by `field` (C-100). */\n autoWidths: Readonly<Record<string, number>>\n /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), one per line: a field name may hold a space, never a\n * line break. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\n /** With `scrollBody`: the ARIA table roles of C-102. */\n roles?: boolean\n}>()\n\ndefineSlots<{\n 'filter-datetime'?(props: FilterDatetimeSlotProps): unknown\n 'filter-menu'?(props: FilterMenuSlotProps): unknown\n /** Draws the consumer's `header-<field>` slot for `column`. */\n header?(props: HeaderSlotProps): unknown\n}>()\n\nconst given = (name: string) => props.slotNames.split('\\n').includes(name)\n\nconst { filters, sort, layout, resize, reorder, selection, labels } =\n useTableContext()\n\n// C-73: the drag preview is attributes only; nothing moves until release.\nconst dragAttrs = (column: Column) => {\n const drag = reorder.dragging.value\n return {\n 'data-dragging': drag?.field === column.field ? '' : undefined,\n 'data-drop': drag?.target === column.field ? drag.place : undefined\n }\n}\n\n// A computed: the header re-renders when the answer changes, not with every\n// pending filter draft.\nconst canClearAll = computed(() => filters.canClearAll())\n\n// C-22: a disabled button drops the focus to the page. When the button holds\n// the focus, a click with `detail` 0 (a key, `element.click()`, some\n// assistive technologies) activates it and the update that clear causes\n// disables it, the focus goes to the first filter instead. A pointer click\n// is left alone, so a touch screen opens no keyboard; nothing else (the\n// `toolbar` slot's `clearFilters()`, a later query) moves the focus.\nconst onClearAll = async (event: MouseEvent) => {\n const button = event.currentTarget as HTMLButtonElement\n const doc = button.ownerDocument\n const keyed = event.detail === 0 && doc.activeElement === button\n filters.clearAll()\n if (!keyed) {\n return\n }\n // The clear queued the re-render that disables the button, or keeps it\n // enabled when the consumer's query keeps a filter.\n await nextTick()\n const active = doc.activeElement\n if (\n button.disabled &&\n (active === button || active === doc.body || active === null)\n ) {\n focusFirstFilter(button.closest('table'))\n }\n}\n\nconst isFiltered = (column: Column) =>\n rulesOf(props.query.filters, column.field).length > 0\n\nconst hasFilter = (column: Column) =>\n props.filterable && column.filterable !== false\n\n// The first utility hosts the clear-all button (C-22); the selection column\n// holds its select-all checkbox instead.\nconst hostsClearAll = (utility: Utility) =>\n props.filterable &&\n utility === props.utilities.find(candidate => candidate !== 'select')\n\nconst utilityAttrs = (utility: Utility) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\n\n// The only inline styles of a header cell: the column width (or the drag\n// preview, C-49, or the automatic width, C-100) and the pin offset (C-47,\n// C-71), with `data-pinned`.\nconst widthOf = (column: Column) => {\n if (column.width) {\n return column.width\n }\n const auto = props.autoWidths[column.field]\n return auto === undefined ? undefined : `${auto}px`\n}\n\nconst cellAttrs = (column: Column) => {\n const preview = resize.preview.value\n return pinAttrs(\n sideOf(column),\n props.offsets[column.field],\n preview?.field === column.field ? `${preview.width}px` : widthOf(column)\n )\n}\n\nconst headerSlotProps = (column: Column): HeaderSlotProps => ({\n column,\n sortDirection: sort.sortOf(column),\n sortable: sort.isSortable(column),\n toggleSort: () => {\n sort.sortBy(column)\n },\n control: layout.controlOf(column.field)\n})\n</script>\n\n<template>\n <tr :role=\"roles ? 'row' : undefined\">\n <!-- A utility header cell labels nothing; it is a `th` only when it holds\n the clear-all button, and an empty `td` otherwise (C-45). -->\n <template v-for=\"utility in utilities\" :key=\"utility\">\n <th\n v-if=\"utility === 'select'\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <input\n type=\"checkbox\"\n class=\"qt-select-all\"\n :aria-label=\"labels().selectAllRows\"\n :checked=\"selection.allSelected.value\"\n :indeterminate=\"selection.someSelected.value\"\n @change=\"\n selection.toggleAll(($event.target as HTMLInputElement).checked)\n \"\n />\n </th>\n <td\n v-else-if=\"!hostsClearAll(utility)\"\n :role=\"roles ? 'cell' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n />\n <th\n v-else\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n v-bind=\"utilityAttrs(utility)\"\n >\n <button\n type=\"button\"\n class=\"qt-clear-all-button\"\n :title=\"labels().clearAllFilters\"\n :aria-label=\"labels().clearAllFilters\"\n :disabled=\"!canClearAll\"\n @click.stop=\"onClearAll\"\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </th>\n </template>\n <th\n v-for=\"column in columns\"\n :key=\"column.field\"\n scope=\"col\"\n :role=\"roles ? 'columnheader' : undefined\"\n :data-field=\"column.field\"\n :data-type=\"columnTypeOf(column)\"\n :data-sort=\"sort.sortOf(column) ?? undefined\"\n :data-sortable=\"sort.isSortable(column) ? '' : undefined\"\n :data-filtered=\"isFiltered(column) ? '' : undefined\"\n :aria-sort=\"ariaSort(sort.sortOf(column))\"\n v-bind=\"{ ...cellAttrs(column), ...dragAttrs(column) }\"\n >\n <!-- C-73: the reorder handle is the first child, the resize handle the last. -->\n <reorder-handle v-if=\"reorder.isReorderable(column)\" :column=\"column\" />\n <!-- C-51: the header slot replaces the label only. -->\n <slot\n v-if=\"given(`header-${column.field}`)\"\n name=\"header\"\n v-bind=\"headerSlotProps(column)\"\n />\n <sort-button\n v-else-if=\"sort.isSortable(column)\"\n :column=\"column\"\n :direction=\"sort.sortOf(column)\"\n @click=\"sort.sortBy(column)\"\n />\n <span v-else class=\"qt-title\">{{ column.title }}</span>\n <filter-cell\n v-if=\"hasFilter(column)\"\n :column=\"column\"\n :type=\"columnTypeOf(column)\"\n :query=\"query\"\n >\n <template v-if=\"given('filter-datetime')\" #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template v-if=\"given('filter-menu')\" #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </filter-cell>\n <resize-handle v-if=\"resize.isResizable(column)\" :column=\"column\" />\n </th>\n </tr>\n</template>\n","<script setup lang=\"ts\">\nimport type { PaginationSlotProps } from '../contract'\n\ndefineProps<{ paginationProps: PaginationSlotProps }>()\n\ndefineSlots<{ pagination(props: PaginationSlotProps): unknown }>()\n</script>\n\n<template>\n <div class=\"qt-pagination\">\n <slot name=\"pagination\" v-bind=\"paginationProps\" />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { PaginationSlotProps } from '../contract'\n\ndefineProps<{ paginationProps: PaginationSlotProps }>()\n\ndefineSlots<{ pagination(props: PaginationSlotProps): unknown }>()\n</script>\n\n<template>\n <div class=\"qt-pagination\">\n <slot name=\"pagination\" v-bind=\"paginationProps\" />\n </div>\n</template>\n","import {\n nextTick,\n onBeforeUnmount,\n shallowRef,\n watch,\n type ShallowRef\n} from 'vue'\n\nimport type { PinSide } from '../columns/column-layout'\n\n/** A drawn header cell, in order: its key (`field`, or the utility) and side. */\ninterface HeaderCellKey {\n key: string\n side: PinSide\n}\n\nexport interface HeaderGeometryOptions {\n /** The `table` element once it is mounted. */\n table: ShallowRef<HTMLTableElement | null>\n /** The header cells as drawn: utilities first, then the columns. */\n cells: () => HeaderCellKey[]\n /**\n * Some column is pinned on either side (C-46, C-71) or has a resize handle\n * (C-48), or the body is a table of its own (`scrollBody`, C-101).\n */\n active: () => boolean\n}\n\ntype Numbers = Readonly<Record<string, number>>\n\n/** One string per map: compares two maps in one step. */\nconst signature = (numbers: Numbers | readonly number[]) =>\n JSON.stringify(numbers)\n\n/**\n * Measured header geometry (C-47, C-48, C-71): the rendered width of every\n * header cell and, for the pinned cells, the cumulative offset: from the left\n * for a left-pinned cell (`--qt-pin-left`), from the right for a\n * right-pinned one (`--qt-pin-right`). One `ResizeObserver` watches the header cells and the\n * table; it reports width changes from any cause (a resize, a font that\n * loads, a container that narrows) in one batched callback, after layout, so\n * reading the cells there forces no extra layout. The observer is rebuilt\n * only when the drawn cells change, not when a width does. Nothing is\n * measured while inactive, and the observer is disconnected on unmount.\n */\nexport const useHeaderGeometry = (options: HeaderGeometryOptions) => {\n /** Rendered width of each header cell, by key. */\n const widths = shallowRef<Numbers>({})\n /** Rendered width of the table. */\n const tableWidth = shallowRef(0)\n /**\n * `--qt-pin-left` of each left-pinned cell and `--qt-pin-right` of each\n * right-pinned one, by key, in pixels.\n */\n const offsets = shallowRef<Numbers>({})\n /**\n * The exact width of every header cell, in drawing order: the `col` widths\n * of the body and footer tables with `scrollBody` (C-101).\n */\n const columns = shallowRef<readonly number[]>([])\n let observer: ResizeObserver | null = null\n\n const headerCells = (table: HTMLTableElement) =>\n table.querySelectorAll(':scope > thead > tr > *')\n\n const measure = (table: HTMLTableElement) => {\n // `widths` and `tableWidth` are whole pixels: they are reported (resize\n // handle, `aria-valuenow`) and compared, and sub-pixel noise from live\n // content would rewrite them for nothing.\n tableWidth.value = Math.round(table.getBoundingClientRect().width)\n const cells = options.cells()\n const next: Record<string, number> = {}\n const nextOffsets: Record<string, number> = {}\n const rights: Array<[string, number]> = []\n const nextColumns: number[] = []\n let left = 0\n headerCells(table).forEach((cell, index) => {\n const drawn = cells[index]\n if (drawn) {\n const exact = cell.getBoundingClientRect().width\n nextColumns.push(exact)\n next[drawn.key] = Math.round(exact)\n // The offsets add up the exact widths. A cell is drawn at a fractional\n // width (a percentage, a collapsed border), so summing rounded widths\n // drifts: a pinned cell then stops short of its neighbour (a gap the\n // scrolled content shows through) or over it.\n if (drawn.side === 'left') {\n nextOffsets[drawn.key] = left\n left += exact\n } else if (drawn.side === 'right') {\n rights.push([drawn.key, exact])\n }\n }\n })\n // Right offsets add up from the right edge: the last cell is at 0.\n let right = 0\n for (let i = rights.length - 1; i >= 0; i--) {\n const [key, width] = rights[i]\n nextOffsets[key] = right\n right += width\n }\n // Only a real change re-renders the cells that read these.\n if (signature(next) !== signature(widths.value)) {\n widths.value = next\n }\n if (signature(nextOffsets) !== signature(offsets.value)) {\n offsets.value = nextOffsets\n }\n if (signature(nextColumns) !== signature(columns.value)) {\n columns.value = nextColumns\n }\n }\n\n const observe = () => {\n observer?.disconnect()\n observer = null\n const table = options.table.value\n if (!table || !options.active() || typeof ResizeObserver === 'undefined') {\n if (Object.keys(offsets.value).length > 0) {\n offsets.value = {}\n }\n if (columns.value.length > 0) {\n columns.value = []\n }\n return\n }\n const current = new ResizeObserver(() => {\n measure(table)\n })\n observer = current\n current.observe(table)\n headerCells(table).forEach(cell => {\n current.observe(cell)\n })\n measure(table)\n }\n\n // Re-observe once the drawn cells change (columns, order, pinning,\n // utilities), after they are rendered. A width written back does not\n // change this key, so it does not rebuild the observer.\n watch(\n [\n // A getter, not the ref: a shallow ref among the sources forces the\n // callback on every trigger, rebuilding the observer for nothing.\n () => options.table.value,\n options.active,\n () =>\n options\n .cells()\n .map(cell =>\n cell.side === 'left'\n ? `${cell.key}*`\n : cell.side === 'right'\n ? `${cell.key}>`\n : cell.key\n )\n .join('|')\n ],\n () => {\n void nextTick(observe)\n },\n { immediate: true, flush: 'post' }\n )\n\n onBeforeUnmount(() => {\n observer?.disconnect()\n observer = null\n })\n\n return { widths, tableWidth, offsets, columns }\n}\n","import {\n nextTick,\n onBeforeUnmount,\n shallowRef,\n watch,\n type ShallowRef\n} from 'vue'\n\nimport type { Column } from '../contract'\nimport type { QueryTableLayout } from '../use-query-table'\n\nexport interface ColumnReorderOptions {\n /** The `reorderable` prop: whether the table draws reorder handles. */\n reorderable: () => boolean\n /** The table element: drop targets and refocus look at its own header only. */\n table: ShallowRef<HTMLTableElement | null>\n layout: QueryTableLayout\n /** The `columns` prop: an outside change ends a drag (C-73). */\n columns: () => Column[]\n}\n\n/** What the header shows while a column is dragged (C-73). */\nexport interface ColumnDrag {\n field: string\n /** The header cell the column would be placed next to, if any. */\n target: string | null\n place: 'before' | 'after'\n}\n\ninterface Drag {\n field: string\n pointerId: number\n /** Visible header cells of the region at the start: field and box. */\n cells: Array<{ field: string; left: number; right: number }>\n}\n\nconst placeOf = (key: string) =>\n key === 'ArrowLeft' || key === 'Home' ? 'before' : 'after'\n\n/**\n * Reordering a column with its handle (C-73): a pointer drag or the arrow\n * keys, Home and End, inside the column's region. The table keeps only the\n * drag in progress (P15); the order itself goes out as `update:columns` and\n * comes back, if the consumer wants it, as the order of `columns`. Like the\n * resize handle, the handle captures the pointer, so every drag event\n * arrives at the handle itself, and it has the focus, so Escape does too.\n */\nexport const useColumnReorder = (options: ColumnReorderOptions) => {\n const dragging = shallowRef<ColumnDrag | null>(null)\n let drag: Drag | null = null\n /** The column whose handle moved it by key and still has the focus. */\n let refocus: string | null = null\n /** Between the new `columns` and their render: a blur then is the move's. */\n let patching = false\n\n const isReorderable = (column: Column) =>\n options.reorderable() && column.reorderable !== false\n\n /** This table's own header cell, never one of a nested table. */\n const headerCell = (field: string) =>\n options.table.value?.querySelector<HTMLElement>(\n `:scope > thead > tr > th[data-field=\"${CSS.escape(field)}\"]`\n ) ?? null\n\n const end = () => {\n drag = null\n dragging.value = null\n }\n\n /** Every pointer event of a handle; one listener for the whole drag. */\n const onPointer = (event: PointerEvent, column: Column) => {\n if (event.type === 'pointerdown') {\n if (event.button !== 0 || drag) {\n return\n }\n const handle = event.currentTarget as HTMLElement\n // No text selection while dragging; the handle takes the focus itself.\n event.preventDefault()\n handle.focus({ preventScroll: true })\n handle.setPointerCapture(event.pointerId)\n refocus = null\n drag = {\n field: column.field,\n pointerId: event.pointerId,\n cells: options.layout.regionOf(column.field).flatMap(field => {\n const box = headerCell(field)?.getBoundingClientRect()\n return box ? [{ field, left: box.left, right: box.right }] : []\n })\n }\n dragging.value = { field: column.field, target: null, place: 'after' }\n return\n }\n if (!drag || event.pointerId !== drag.pointerId) {\n return\n }\n if (event.type === 'pointermove') {\n const x = event.clientX\n const over = drag.cells.find(cell => x >= cell.left && x < cell.right)\n const target = over && over.field !== drag.field ? over.field : null\n const place =\n over && x < (over.left + over.right) / 2 ? 'before' : 'after'\n const current = dragging.value\n if (current?.target !== target || current.place !== place) {\n dragging.value = { field: drag.field, target, place }\n }\n return\n }\n // pointerup places the column; pointercancel and a lost capture cancel.\n const done = dragging.value\n end()\n if (event.type === 'pointerup' && done?.target) {\n options.layout.moveColumn(done.field, done.target, done.place)\n }\n }\n\n const onKey = (event: KeyboardEvent, column: Column) => {\n const { key } = event\n if (drag) {\n if (key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n end()\n }\n return\n }\n // Alt+Arrow, Ctrl+Home and the like keep their browser meaning.\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return\n }\n const region = options.layout.regionOf(column.field)\n const at = region.indexOf(column.field)\n const target =\n key === 'ArrowLeft'\n ? region[at - 1]\n : key === 'ArrowRight'\n ? region[at + 1]\n : key === 'Home'\n ? region[0]\n : key === 'End'\n ? region[region.length - 1]\n : undefined\n if (at < 0 || target === undefined) {\n return\n }\n event.preventDefault()\n if (target !== column.field) {\n refocus = column.field\n options.layout.moveColumn(column.field, target, placeOf(key))\n }\n }\n\n // New `columns`: an outside change ends a drag; a written-back order gives\n // the focus back to the moved column's handle, which a keyed move of its\n // header cell can drop.\n watch(options.columns, () => {\n patching = true\n })\n watch(\n options.columns,\n () => {\n patching = false\n if (drag) {\n end()\n }\n const field = refocus\n if (field !== null) {\n void nextTick(() => {\n const handle = headerCell(field)?.querySelector<HTMLElement>(\n ':scope > .qt-reorder-handle'\n )\n if (\n handle &&\n refocus === field &&\n document.activeElement !== handle\n ) {\n handle.focus({ preventScroll: true })\n }\n })\n }\n },\n { flush: 'post' }\n )\n\n onBeforeUnmount(end)\n\n /**\n * The listeners of one handle, as one `v-on` object made once per handle.\n * Pointer capture sends every drag event to the handle itself.\n */\n const listeners = (column: () => Column) => {\n const pointer = (event: Event) => {\n onPointer(event as PointerEvent, column())\n }\n return {\n pointerdown: pointer,\n pointermove: pointer,\n pointerup: pointer,\n pointercancel: pointer,\n lostpointercapture: pointer,\n keydown: (event: Event) => {\n onKey(event as KeyboardEvent, column())\n },\n // The user left the handle: nothing to give back. A blur while the\n // moved header renders is the move's, not the user's.\n blur: () => {\n if (!patching) {\n refocus = null\n }\n },\n // The handle sits inside the header cell: a click never sorts.\n click: (event: Event) => {\n event.stopPropagation()\n }\n }\n }\n\n return { isReorderable, dragging, listeners }\n}\n\nexport type ColumnReorder = ReturnType<typeof useColumnReorder>\n","import {\n cloneQuery,\n isCursorQuery,\n sameQuery,\n type Query\n} from '@dolusoft/query-protocol'\nimport type { RowsUpdate } from '@dolusoft/query-table-core/row-changes'\nimport { onBeforeUnmount, shallowRef, watch, type ShallowRef } from 'vue'\n\nimport type { Column } from '../contract'\nimport { measureColumnWidths } from './measure-widths'\nimport { clampWidth, limitOf } from './use-column-resize'\n\nexport interface AutoWidthOptions {\n /** The `autoWidth` prop. */\n enabled: () => boolean\n /** The `autoWidthMax` prop: the limit of a column without `maxWidth`. */\n max: () => number | undefined\n table: ShallowRef<HTMLTableElement | null>\n /** With `scrollBody`: the table of the body rows (C-101), else `null`. */\n body: () => HTMLTableElement | null\n /** The visible columns, as given. */\n columns: () => Column[]\n rows: () => readonly unknown[]\n query: () => Query\n rowsUpdate: () => RowsUpdate | undefined\n}\n\ntype Widths = Readonly<Record<string, number>>\n\n/**\n * The query without what moves inside one result: the paging position, the\n * page size and the sort. Two queries alike in the rest ask for the same\n * rows, in another order or slice (C-100).\n */\nconst resultOf = (query: Query): Query =>\n isCursorQuery(query)\n ? { ...query, cursor: null, pageSize: 0, sort: null }\n : { ...query, page: 1, pageSize: 0, sort: null }\n\nconst sameWidths = (a: Widths, b: Widths) => {\n const keys = Object.keys(a)\n return (\n keys.length === Object.keys(b).length &&\n keys.every(key => a[key] === b[key])\n )\n}\n\nconst none: Widths = Object.freeze({})\n\n/**\n * Automatic column widths (C-100, ADR 0014). With `autoWidth`, every visible\n * column without `Column.width` is measured (C-99) after the drawn rows\n * change, clamped as a resize is (C-49), and drawn at that width. The widths\n * are UI state (P2): never emitted, never written to `columns`, gone when\n * `autoWidth` is off or the column gets a width. Within one result (the query\n * apart from its paging position, page size and sort) they only grow, so a\n * page, a sort or a live tick never narrows a column.\n */\nexport const useAutoWidth = (options: AutoWidthOptions) => {\n const widths = shallowRef<Widths>(none)\n /** The result the widths were last measured for, `null` before one. */\n let result: Query | null = null\n /** The next measure starts over: the result moved before it could run. */\n let fromScratch = false\n /** A measure found the table not displayed: measure once it is. */\n let waiting = false\n let observer: ResizeObserver | null = null\n\n const autoColumns = () => options.columns().filter(column => !column.width)\n\n const clear = () => {\n widths.value = none\n result = null\n fromScratch = false\n waiting = false\n observer?.disconnect()\n observer = null\n }\n\n const measure = (rowsChanged: boolean) => {\n const table = options.table.value\n const columns = autoColumns()\n if (!table || columns.length === 0) {\n return\n }\n const query = options.query()\n const moved =\n result === null ||\n (rowsChanged &&\n (options.rowsUpdate() === 'reset' ||\n !sameQuery(resultOf(result), resultOf(query))))\n if (moved) {\n fromScratch = true\n result = cloneQuery(query)\n }\n if (options.rows().length === 0) {\n return\n }\n const measured = measureColumnWidths(\n table,\n columns.map(column => column.field),\n options.body(),\n // The filter row is a floor: a column never draws its filter\n // unusable (C-100).\n { filters: true }\n )\n if (Object.keys(measured).length === 0) {\n // Not displayed: nothing has a box. Keep what is drawn.\n waiting = true\n return\n }\n waiting = false\n const previous = widths.value\n const next: Record<string, number> = {}\n for (const column of columns) {\n const width = measured[column.field]\n if (width === undefined) {\n continue\n }\n const fitted = clampWidth(\n { ...column, maxWidth: limitOf(column.maxWidth) ?? options.max() },\n width\n )\n next[column.field] = fromScratch\n ? fitted\n : Math.max(fitted, previous[column.field] ?? 0)\n }\n fromScratch = false\n if (!sameWidths(next, previous)) {\n widths.value = next\n }\n }\n\n const observe = (table: HTMLTableElement | null) => {\n observer?.disconnect()\n observer = null\n if (!table || typeof ResizeObserver === 'undefined') {\n return\n }\n observer = new ResizeObserver(() => {\n if (waiting) {\n measure(false)\n }\n })\n observer.observe(table)\n }\n\n watch(\n [\n // Getters, not the refs: a shallow ref among the sources forces the\n // callback on every trigger.\n () => options.enabled(),\n () => options.max(),\n () => options.table.value,\n () => options.rows(),\n () =>\n autoColumns()\n .map(column => column.field)\n .join('|')\n ],\n // The first call gets `[]`: every old value is `undefined`.\n ([enabled, max, table, rows], [wasEnabled, oldMax, oldTable, oldRows]) => {\n if (!enabled) {\n if (wasEnabled) {\n clear()\n }\n return\n }\n if (!wasEnabled || max !== oldMax) {\n fromScratch = true\n }\n if (table !== oldTable || !wasEnabled) {\n observe(table)\n }\n measure(rows !== oldRows)\n },\n { immediate: true, flush: 'post' }\n )\n\n onBeforeUnmount(() => {\n observer?.disconnect()\n observer = null\n })\n\n return { widths }\n}\n","import { onBeforeUnmount, watch } from 'vue'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n// A try/catch keeps the constant replacement in production builds.\nconst isDevelopment = (): boolean => {\n try {\n return process.env.NODE_ENV !== 'production'\n } catch {\n return true\n }\n}\n\n/** The wrappers of `scrollBody`, `null` while not drawn. */\ninterface ScrollBodyWrappers {\n head: HTMLElement | null\n body: HTMLElement | null\n foot: HTMLElement | null\n}\n\nexport interface ScrollBodyOptions {\n /** The `scrollBody` prop. */\n enabled: () => boolean\n wrappers: () => ScrollBodyWrappers\n /** The table of the header cells, whose widths the body takes. */\n headTable: () => HTMLTableElement | null\n /** The table of the body rows: its layout is checked (C-101). */\n bodyTable: () => HTMLTableElement | null\n /** The `col` widths written to the body table, in pixels. */\n colWidths: () => readonly (number | undefined)[]\n /** Changes when the body rows do: their content can widen a column. */\n rows: () => unknown\n}\n\nconst automaticLayout =\n '[QueryTable] `scrollBody`: the body table has the automatic layout, so its columns follow its rows, not the header. Give the body and footer tables `table-layout: fixed` and a width that is a length or a percentage, such as `width: 100%`: with `width: auto` or `max-content` the browser uses the automatic layout whatever `table-layout` says (C-101).'\n\n/**\n * Header, body and footer of `scrollBody` scroll sideways together (C-101):\n * one passive `scroll` listener on each wrapper sets the `scrollLeft` of the\n * others to its own. A position written here is remembered, so the `scroll`\n * event it fires is not taken for one of the user's. The table writes no\n * style and no attribute to the wrappers. Off, nothing is listened to.\n */\nexport const useScrollBody = (options: ScrollBodyOptions) => {\n let attached: HTMLElement[] = []\n /** The `scrollLeft` this table wrote to a wrapper, until its event. */\n const written = new WeakMap<HTMLElement, number>()\n let warned = false\n let clamped = false\n\n /** Every wrapper but `source` to `left`, remembering what was written. */\n const follow = (source: HTMLElement, left: number) => {\n for (const element of attached) {\n if (element !== source && element.scrollLeft !== left) {\n element.scrollLeft = left\n written.set(element, element.scrollLeft)\n // A header or footer that stops short of the body: its scroll range\n // lacks the body's vertical scrollbar, and its columns end shifted.\n if (\n !clamped &&\n source === options.wrappers().body &&\n left - element.scrollLeft >= 1 &&\n isDevelopment()\n ) {\n clamped = true\n console.warn(\n '[QueryTable] `scrollBody`: `.qt-table-head` or `.qt-table-foot` cannot scroll sideways as far as `.qt-table-body`, so its columns end shifted. Give it a vertical scrollbar as wide as that of the body (`overflow-y: scroll`; a transparent `scrollbar-color` hides it) (C-101).'\n )\n }\n }\n }\n }\n\n const onScroll = (event: Event) => {\n const source = event.currentTarget as HTMLElement\n const left = source.scrollLeft\n const echo = written.get(source)\n written.delete(source)\n if (echo !== left) {\n follow(source, left)\n }\n }\n\n const detach = () => {\n for (const element of attached) {\n element.removeEventListener('scroll', onScroll)\n }\n attached = []\n }\n\n watch(\n () => (options.enabled() ? options.wrappers() : null),\n wrappers => {\n detach()\n if (!wrappers) {\n return\n }\n attached = [wrappers.head, wrappers.body, wrappers.foot].filter(\n (element): element is HTMLElement => element !== null\n )\n for (const element of attached) {\n element.addEventListener('scroll', onScroll, { passive: true })\n }\n // A wrapper drawn later (a footer) starts where the body is.\n if (wrappers.body) {\n follow(wrappers.body, wrappers.body.scrollLeft)\n }\n const table = options.bodyTable()\n if (\n table &&\n !warned &&\n isDevelopment() &&\n getComputedStyle(table).tableLayout !== 'fixed'\n ) {\n warned = true\n console.warn(automaticLayout)\n }\n },\n { flush: 'post', immediate: true }\n )\n\n /**\n * `table-layout: fixed` applies only to a table with a definite width:\n * under `width: auto` or `max-content` the browser lays the body out\n * automatically while `tableLayout` still reads `fixed`, and a cell wider\n * than its `col` widens its column and the table. That shows once the\n * rows hold such a cell, so it is checked whenever the rows or the `col`\n * widths change, against `col` widths that match the header cells (not\n * ones a change of the drawn columns has made stale until measured).\n */\n const checkLayout = () => {\n const head = options.headTable()\n const body = options.bodyTable()\n if (warned || !head || !body) {\n return\n }\n const cells = head.querySelectorAll(':scope > thead > tr > *')\n const widths = options.colWidths()\n if (\n cells.length === 0 ||\n cells.length !== widths.length ||\n [...cells].some((cell, i) => {\n const width = widths[i]\n return (\n width === undefined ||\n Math.abs(cell.getBoundingClientRect().width - width) >= 0.5\n )\n })\n ) {\n return\n }\n if (\n body.getBoundingClientRect().width - head.getBoundingClientRect().width >=\n 1\n ) {\n warned = true\n console.warn(automaticLayout)\n }\n }\n\n if (isDevelopment()) {\n watch(\n () =>\n options.enabled()\n ? [options.colWidths(), options.rows(), options.bodyTable()]\n : null,\n sources => {\n if (sources) {\n checkLayout()\n }\n },\n { flush: 'post' }\n )\n }\n\n onBeforeUnmount(detach)\n}\n","// useQueryTable (K4): the state of a Query Table without its markup. A\n// TanStack table (`@tanstack/vue-table`) with the two plugins of\n// `@dolusoft/query-table-core`, and the actions the parts of `QueryTable`\n// call. `QueryTable` is built on it and holds no state logic of its own.\n//\n// The consumer owns every lasting value (P2): the query, the selection and\n// the column layout (visibility, order, pinning, widths) arrive as options\n// and changes leave as callbacks. The TanStack slices are projections of the\n// query (ADR 0004) and of the columns (ADR 0007); what the table\n// keeps is short-lived: typed filter and search text, and which rows are\n// expanded (TanStack's `expanded` slice, P15).\nimport {\n columnTypeOf,\n type FilterDraft,\n isCursorQuery,\n type Query,\n searchOf\n} from '@dolusoft/query-protocol'\nimport {\n dispose,\n type FilterBound,\n type FilterLabel,\n filterInputFeature,\n projectServerQuery,\n serverQueryFeature\n} from '@dolusoft/query-table-core'\nimport {\n columnFilteringFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnVisibilityFeature,\n functionalUpdate,\n globalFilteringFeature,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n type Row,\n tableFeatures,\n type Updater,\n useTable,\n type VueTable\n} from '@tanstack/vue-table'\nimport {\n computed,\n type ComputedRef,\n type MaybeRefOrGetter,\n onScopeDispose,\n shallowRef,\n toValue,\n watch\n} from 'vue'\n\nimport {\n applyOrder,\n applyPinning,\n applyVisibility,\n moveField,\n sideOf\n} from './columns/column-layout'\nimport type {\n Column,\n ColumnChangeReason,\n ColumnControl,\n FilterCondition,\n PageCursors,\n PaginationSlotProps,\n QueryChangeReason,\n RowPinning,\n RowSelection,\n SortDirection,\n TableProps,\n TableQuery\n} from './contract'\nimport { valueAt } from './core/column'\n\n/** The TanStack features of a Query Table, the two plugins included. */\nconst features = tableFeatures({\n rowSortingFeature,\n rowPaginationFeature,\n columnFilteringFeature,\n globalFilteringFeature,\n rowSelectionFeature,\n rowExpandingFeature,\n // K31-5: registered always; projections of `columns` (ADR 0007).\n columnVisibilityFeature,\n columnOrderingFeature,\n // D3: start = left, end = right; order and region only, offsets are\n // measured by the table, not computed from sizes.\n columnPinningFeature,\n // C-74: controlled by `rowPinning`; on only with `rowKey`.\n rowPinningFeature,\n serverQueryFeature,\n filterInputFeature\n})\n\nexport type QueryTableFeatures = typeof features\n\n/** Identity of a row: a property name or a function (see `TableProps.rowKey`). */\nexport type RowKey<T extends object> = TableProps<T>['rowKey']\n\nexport interface UseQueryTableOptions<\n T extends object,\n Q extends Query = TableQuery\n> {\n /** The query the table shows. The consumer owns it. */\n query: MaybeRefOrGetter<Q>\n /** Column definitions, hidden ones included. Never mutated. */\n columns: MaybeRefOrGetter<Column[]>\n /** Rows of the current page. Defaults to none. */\n rows?: MaybeRefOrGetter<T[] | undefined>\n /** Rows on the server, `null` when unknown. */\n totalRows?: MaybeRefOrGetter<number | null | undefined>\n /** Cursor mode: the cursors of the page shown (C-56). */\n cursors?: MaybeRefOrGetter<PageCursors | null | undefined>\n /** Allow sorting (needs column `sortable`). Defaults to `false`. */\n sortable?: MaybeRefOrGetter<boolean | undefined>\n /** Milliseconds before typed filter text is applied. Defaults to `100`. */\n filterDebounce?: MaybeRefOrGetter<number | undefined>\n /** Milliseconds before typed search text is applied. Defaults to `300`. */\n searchDebounce?: MaybeRefOrGetter<number | undefined>\n /** The selected rows; `undefined` turns selection off. */\n selection?: MaybeRefOrGetter<RowSelection | undefined>\n /**\n * The pinned rows (C-74); `undefined`, or no `rowKey`, turns row pinning\n * off.\n */\n rowPinning?: MaybeRefOrGetter<RowPinning | undefined>\n /** Identity of a row. Without it the row index is the identity. */\n rowKey?: MaybeRefOrGetter<RowKey<T>>\n /** Rows can expand (the `subtable` column). Defaults to `false`. */\n hasSubtable?: MaybeRefOrGetter<boolean | undefined>\n /**\n * Which rows can expand, with `hasSubtable` (C-98); without it every row\n * can. Give a getter or a ref that holds the function (`() => fn`): a bare\n * function is read as a getter.\n */\n rowExpandable?: MaybeRefOrGetter<TableProps<T>['rowExpandable']>\n /** Page sizes offered. Defaults to `[10, 20, 30, 50, 100]`. */\n pageSizeOptions?: MaybeRefOrGetter<number[] | undefined>\n /** Called once per user action that changes the query, with a new object. */\n onQueryChange: (query: Q, reason: QueryChangeReason) => void\n /** Called with the new selection (its `true` entries) when the user changes it. */\n onSelectionChange?: (selection: RowSelection) => void\n /**\n * Called once per user action that changes the layout, with a new array\n * (C-68).\n */\n onColumnsChange?: (columns: Column[], reason: ColumnChangeReason) => void\n /** Called with the new map when the user pins or unpins a row (C-74). */\n onRowPinningChange?: (rowPinning: RowPinning) => void\n}\n\n/** A row of the body in drawing order (C-74). */\nexport interface BodyRow<T> {\n row: T\n /** The row's index in `rows`. */\n index: number\n pinned: 'top' | 'bottom' | false\n}\n\n/** Row pinning (C-74), owned by the consumer. */\nexport interface QueryTableRowPinning<T extends object> {\n /** `rowPinning` and `rowKey` were given: rows can be pinned. */\n enabled: ComputedRef<boolean>\n /** The rows to draw: pinned to the top first, pinned to the bottom last. */\n rows: ComputedRef<BodyRow<T>[]>\n /**\n * Pin a row or unpin it (`false`): tells the consumer the new map; nothing\n * for the position the row has, or while row pinning is off.\n */\n pin: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n}\n\n/** A column the table draws and its position in `columns`, hidden ones included. */\nexport interface ColumnEntry {\n column: Column\n index: number\n}\n\n/** The filter input of each column (C-08 to C-22). */\nexport interface QueryTableFilters {\n /** The column's typed text and picked condition; blank when nothing is typed. */\n draftOf: (field: string) => Readonly<FilterDraft>\n /**\n * The input's text changed: applied after the debounce (C-09). `'upper'`\n * sets the upper bound of a `Between` filter instead (C-114).\n */\n setInput: (field: string, text: string, bound?: FilterBound) => void\n /** Enter: applies the column's pending text now (C-12). */\n apply: (field: string) => void\n /** Applies every pending text in one update; `true` when it changed the filters. */\n flushAll: () => boolean\n /** Picks a condition; `null` clears the column (C-20). */\n setCondition: (field: string, condition: FilterCondition | null) => void\n /** Removes the column's rules and text (C-21). */\n clear: (field: string) => void\n /** Removes every rule and discards every text (C-22). */\n clearAll: () => void\n /** There is a rule or typed text to clear (C-22). */\n canClearAll: () => boolean\n /** The condition label under an input, `null` when there is none. */\n labelOf: (field: string) => FilterLabel | null\n /** How many rules a read-only input stands for; `0` when it is editable. */\n multiOf: (field: string) => number\n}\n\n/** Sorting by the headers and the filter menu (C-07). */\nexport interface QueryTableSort {\n /** The table and the column allow sorting by it. */\n isSortable: (column: Column) => boolean\n /** The direction the query sorts `column` in, `null` when it sorts another. */\n sortOf: (column: Column) => SortDirection | null\n /**\n * Without a direction, the header click: ascending, descending, none.\n * Does nothing for a column that cannot sort.\n */\n sortBy: (column: Column, direction?: SortDirection) => void\n}\n\n/** The global search (C-58). */\nexport interface QueryTableSearch {\n /** Text being typed, else `query.search`, else `''`. */\n text: ComputedRef<string>\n /** The input changed: applied after `searchDebounce`, at once when it is `0` or blank. */\n set: (text: string) => void\n /** Applies a pending text now; `true` when it emitted an update. */\n apply: () => boolean\n}\n\n/** Expanded rows (C-26, C-55), held in TanStack's `expanded` slice. */\nexport interface QueryTableExpansion<T extends object> {\n /** Identity of a row: `rowKey`, else its index. */\n keyOf: (row: T, index: number) => string | number\n /** `hasSubtable` is on and `rowExpandable` lets the row expand (C-98). */\n canExpand: (row: T, index: number) => boolean\n isExpanded: (row: T, index: number) => boolean\n /** Opens or closes the row; nothing for a row that cannot expand (C-98). */\n toggle: (row: T, index: number) => void\n collapseAll: () => void\n /** Opens every row given that can expand; nothing is fetched. */\n expandAll: () => void\n}\n\n/** Row selection (C-59), owned by the consumer. */\nexport interface QueryTableSelection<T extends object> {\n /** A `selection` was given: the table offers selection. */\n enabled: ComputedRef<boolean>\n isSelected: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\n /** Every row of the page is selected (and there is one). */\n allSelected: ComputedRef<boolean>\n /** Some but not every row of the page is selected. */\n someSelected: ComputedRef<boolean>\n /** Select or deselect every row of the page. */\n toggleAll: (value: boolean) => void\n}\n\n/** The column layout actions (C-67 to C-70). */\nexport interface QueryTableLayout {\n /** What the `header-<field>` and `filter-menu` slots receive as `control`. */\n controlOf: (field: string) => ColumnControl\n /** The drawn columns of the field's region (left, center or right), in order. */\n regionOf: (field: string) => string[]\n /**\n * Puts `field` right before or after `target` in `columns` and emits the\n * order; nothing when `target` is not in the same region.\n */\n moveColumn: (field: string, target: string, place: 'before' | 'after') => void\n}\n\nexport interface QueryTable<T extends object, Q extends Query = TableQuery> {\n /** The TanStack table, for the advanced path (headless markup). */\n table: VueTable<QueryTableFeatures, T>\n /**\n * The columns to draw: hidden ones dropped; pinned left first, pinned\n * right last (C-69).\n */\n columns: ComputedRef<ColumnEntry[]>\n /** Some drawn column is pinned to the left: the utility cells are pinned with it. */\n hasPinned: ComputedRef<boolean>\n /** Visibility, order and pinning actions (C-67 to C-70). */\n layout: QueryTableLayout\n sort: QueryTableSort\n filters: QueryTableFilters\n search: QueryTableSearch\n /** What the `pagination` slot receives (C-05, C-06, C-23, C-56). */\n pagination: ComputedRef<PaginationSlotProps>\n expansion: QueryTableExpansion<T>\n selection: QueryTableSelection<T>\n rowPinning: QueryTableRowPinning<T>\n /** The query a new action builds on (an update not yet answered included). */\n baseQuery: () => Q\n}\n\nconst blank: Readonly<FilterDraft> = Object.freeze({\n text: '',\n condition: null\n})\n\nconst defaultPageSizes = [10, 20, 30, 50, 100]\n\n/** Only the `true` entries: the selection a consumer stores. */\nconst selectedOnly = (selection: RowSelection): RowSelection =>\n Object.fromEntries(Object.entries(selection).filter(([, value]) => value))\n\nconst noPinnedRows: RowPinning = Object.freeze({\n top: Object.freeze([]) as unknown as string[],\n bottom: Object.freeze([]) as unknown as string[]\n})\n\nconst sameKeys = (a: readonly string[], b: readonly string[]) =>\n a.length === b.length && a.every((key, i) => key === b[i])\n\n/**\n * The state and actions of a server-side table: TanStack Table with\n * `serverQueryFeature` and `filterInputFeature`, in a Vue scope. Disposed\n * with the scope (C-62).\n */\nexport function useQueryTable<T extends object, Q extends Query = TableQuery>(\n options: UseQueryTableOptions<T, Q>\n): QueryTable<T, Q> {\n const query = () => toValue(options.query)\n const rows = () => toValue(options.rows) ?? []\n const totalRows = () => toValue(options.totalRows) ?? null\n const cursors = () => toValue(options.cursors) ?? null\n const columns = () => toValue(options.columns)\n const rowKey = () => toValue(options.rowKey)\n const hasSubtable = () => toValue(options.hasSubtable) ?? false\n // C-98: with `hasSubtable`, a row expands unless `rowExpandable` says no.\n const canExpand = (row: T, index: number) => {\n if (!hasSubtable()) {\n return false\n }\n const expandable = toValue(options.rowExpandable)\n return expandable === undefined || expandable(row, index)\n }\n const pinnedRows = () => toValue(options.rowPinning)\n // C-74: without a row identity an index would pin another row on the next\n // page, so the map needs `rowKey`.\n const pinningEnabled = computed(\n () => rowKey() !== undefined && pinnedRows() !== undefined\n )\n const rowPinningState = computed(() => {\n if (!pinningEnabled.value) {\n return noPinnedRows\n }\n const map = pinnedRows()!\n return { top: map.top ?? [], bottom: map.bottom ?? [] }\n })\n\n const keyOf = (row: T, index: number): string | number => {\n const key = rowKey()\n if (typeof key === 'function') {\n return key(row, index)\n }\n if (typeof key === 'string') {\n return (row as Record<string, string | number>)[key]\n }\n return index\n }\n const idOf = (row: T, index: number) => String(keyOf(row, index))\n\n // The query as TanStack slices (ADR 0004).\n const projection = computed(() =>\n projectServerQuery({\n query: query(),\n rowCount: totalRows(),\n cursors: cursors(),\n pageRows: rows().length\n })\n )\n\n // Every column, hidden ones too: a filter of a hidden column still applies.\n const columnDefs = computed(() =>\n columns().map(column => ({\n id: column.field,\n accessorFn: (row: T) => valueAt(row, column.field),\n enableSorting: column.sortable !== false,\n filterType: columnTypeOf(column)\n }))\n )\n\n // The layout as TanStack slices (ADR 0007): visibility from `hide`, order\n // from the array, pinning from `pinned` (start = left, end = right).\n const columnVisibility = computed(() =>\n Object.fromEntries(columns().map(column => [column.field, !column.hide]))\n )\n const columnOrder = computed(() => columns().map(column => column.field))\n const columnPinning = computed(() => ({\n start: columns()\n .filter(column => sideOf(column) === 'left')\n .map(column => column.field),\n end: columns()\n .filter(column => sideOf(column) === 'right')\n .map(column => column.field)\n }))\n\n /** A layout change goes to the consumer; an equal result is no change (C-68). */\n const tell = (next: Column[] | null, reason: ColumnChangeReason) => {\n if (next) {\n options.onColumnsChange?.(next, reason)\n }\n }\n\n /** Updates emitted so far: tells whether an action emitted one. */\n let emits = 0\n\n const table = useTable<QueryTableFeatures, T>({\n features,\n columns: columnDefs,\n get data() {\n return rows()\n },\n getRowId: (row: T, index: number) => idOf(row, index),\n get query() {\n return query()\n },\n onQueryChange: (next: Query, reason: QueryChangeReason) => {\n emits += 1\n options.onQueryChange(next as Q, reason)\n },\n get cursors() {\n return cursors()\n },\n get rowCount() {\n return totalRows() ?? undefined\n },\n get pageCount() {\n return projection.value.pageCount\n },\n get enableSorting() {\n return toValue(options.sortable) ?? false\n },\n get filterDebounce() {\n return toValue(options.filterDebounce) ?? 100\n },\n enableRowSelection: true,\n // P15: the expansion is TanStack's; the table resets it itself (C-26).\n manualExpanding: true,\n getRowCanExpand: (row: Row<QueryTableFeatures, T>) =>\n canExpand(row.original, row.index),\n onRowSelectionChange: (updater: Updater<RowSelection>) => {\n const current = toValue(options.selection) ?? {}\n options.onSelectionChange?.(\n selectedOnly(functionalUpdate(updater, current))\n )\n },\n // C-68: the layout slices are controlled; a change becomes `columns`.\n onColumnVisibilityChange: (updater: Updater<Record<string, boolean>>) =>\n tell(\n applyVisibility(\n columns(),\n functionalUpdate(updater, columnVisibility.value)\n ),\n 'visibility'\n ),\n onColumnOrderChange: (updater: Updater<string[]>) =>\n tell(\n applyOrder(columns(), functionalUpdate(updater, columnOrder.value)),\n 'order'\n ),\n onColumnPinningChange: (\n updater: Updater<{ start?: string[]; end?: string[] }>\n ) =>\n tell(\n applyPinning(columns(), functionalUpdate(updater, columnPinning.value)),\n 'pin'\n ),\n // C-74: the slice is controlled; a change is a new map for the consumer.\n get enableRowPinning() {\n return pinningEnabled.value\n },\n onRowPinningChange: (updater: Updater<RowPinning>) => {\n if (!pinningEnabled.value) {\n return\n }\n const current = rowPinningState.value\n const next = functionalUpdate(updater, current)\n if (\n !sameKeys(next.top, current.top) ||\n !sameKeys(next.bottom, current.bottom)\n ) {\n options.onRowPinningChange?.({\n top: [...next.top],\n bottom: [...next.bottom]\n })\n }\n },\n state: {\n get sorting() {\n return projection.value.state.sorting\n },\n get columnFilters() {\n return projection.value.state.columnFilters\n },\n get pagination() {\n return projection.value.state.pagination\n },\n get globalFilter() {\n return projection.value.state.globalFilter\n },\n get rowSelection() {\n return toValue(options.selection) ?? {}\n },\n get columnVisibility() {\n return columnVisibility.value\n },\n get columnOrder() {\n return columnOrder.value\n },\n get columnPinning() {\n return columnPinning.value\n },\n get rowPinning() {\n return rowPinningState.value\n }\n }\n } as never)\n\n onScopeDispose(() => dispose(table))\n\n const columnById = (field: string) =>\n table.getAllLeafColumns().find(column => column.id === field)\n\n // ---- columns -------------------------------------------------------------\n\n const entries = computed<ColumnEntry[]>(() => {\n const byField = new Map(\n columns().map((column, index) => [column.field, { column, index }])\n )\n return [\n ...table.getStartVisibleLeafColumns(),\n ...table.getCenterVisibleLeafColumns(),\n ...table.getEndVisibleLeafColumns()\n ]\n .map(column => byField.get(column.id))\n .filter((entry): entry is ColumnEntry => !!entry)\n })\n const hasPinned = computed(() =>\n entries.value.some(entry => sideOf(entry.column) === 'left')\n )\n\n // ---- layout (C-67 to C-70) -------------------------------------------------\n\n const regionOf = (field: string): string[] => {\n const own = entries.value.find(entry => entry.column.field === field)\n if (!own) {\n return []\n }\n const side = sideOf(own.column)\n return entries.value\n .filter(entry => sideOf(entry.column) === side)\n .map(entry => entry.column.field)\n }\n\n const moveColumn = (\n field: string,\n target: string,\n place: 'before' | 'after'\n ) => {\n if (field !== target && regionOf(field).includes(target)) {\n table.setColumnOrder(moveField(columnOrder.value, field, target, place))\n }\n }\n\n /**\n * A column's control. Every slot of every column gets one, so making it\n * does no work: `pinned`, `canMoveLeft` and `canMoveRight` read the layout\n * when they are read (a region is O(n)), and a slot that never reads them\n * costs nothing. A control kept past a re-render reads the current layout.\n */\n const controlOf = (field: string): ColumnControl => {\n const place = () => {\n const region = regionOf(field)\n return { at: region.indexOf(field), size: region.length }\n }\n return {\n get pinned() {\n const column = columns().find(candidate => candidate.field === field)\n return column ? sideOf(column) : false\n },\n pin: side =>\n columnById(field)?.pin(\n side === 'left' ? 'start' : side === 'right' ? 'end' : false\n ),\n hide: () => columnById(field)?.toggleVisibility(false),\n get canMoveLeft() {\n return place().at > 0\n },\n get canMoveRight() {\n const { at, size } = place()\n return at >= 0 && at < size - 1\n },\n // Read at call time, like the flags above.\n move: direction => {\n const current = regionOf(field)\n const from = current.indexOf(field)\n const target = current[from + (direction === 'left' ? -1 : 1)]\n if (from >= 0 && target !== undefined) {\n moveColumn(field, target, direction === 'left' ? 'before' : 'after')\n }\n }\n }\n }\n\n const layout: QueryTableLayout = { controlOf, regionOf, moveColumn }\n\n // ---- search (C-58) --------------------------------------------------------\n\n /** Typed and not yet answered; `null` when the input shows the query. */\n const typed = shallowRef<string | null>(null)\n let searchTimer: ReturnType<typeof setTimeout> | undefined\n\n const cancelSearch = () => {\n if (searchTimer !== undefined) {\n clearTimeout(searchTimer)\n searchTimer = undefined\n }\n }\n\n const applySearch = (): boolean => {\n const pending = searchTimer !== undefined\n cancelSearch()\n if (!pending || typed.value === null) {\n return false\n }\n const text = typed.value\n const before = emits\n table.setGlobalFilter(text)\n const emitted = emits !== before\n // Nothing to wait for: the text is no change, or the answer came already.\n if (!emitted || searchOf(query()) === text) {\n typed.value = null\n }\n return emitted\n }\n\n const setSearch = (text: string) => {\n typed.value = text\n cancelSearch()\n const wait = toValue(options.searchDebounce) ?? 300\n searchTimer = setTimeout(applySearch, Math.max(0, wait))\n if (wait <= 0 || text.trim() === '') {\n applySearch()\n }\n }\n\n // A new search text in the query replaces what was typed and applied.\n watch(\n () => searchOf(query()),\n () => {\n if (searchTimer === undefined) {\n typed.value = null\n }\n },\n { flush: 'sync' }\n )\n onScopeDispose(cancelSearch)\n\n const search: QueryTableSearch = {\n text: computed(() => typed.value ?? searchOf(query())),\n set: setSearch,\n apply: applySearch\n }\n\n // ---- filters --------------------------------------------------------------\n\n const draftOf = (field: string): Readonly<FilterDraft> =>\n columnById(field)?.getFilterInput() ?? blank\n\n const filters: QueryTableFilters = {\n draftOf,\n setInput: (field, text, bound) =>\n columnById(field)?.setFilterInput(text, bound),\n apply: field => columnById(field)?.applyFilterInput(),\n flushAll: () => table.flushPendingFilters(),\n setCondition: (field, condition) =>\n columnById(field)?.setFilterCondition(condition),\n clear: field => columnById(field)?.clearFilterInput(),\n clearAll: () => table.clearAllFilters(),\n canClearAll: () => table.getCanClearAllFilters(),\n labelOf: field => columnById(field)?.getFilterLabel() ?? null,\n multiOf: field => draftOf(field).multi ?? 0\n }\n\n // ---- sort (C-07) ----------------------------------------------------------\n\n const isSortable = (column: Column) =>\n (toValue(options.sortable) ?? false) && column.sortable !== false\n\n const sort: QueryTableSort = {\n isSortable,\n sortOf: column => {\n const current = query().sort\n return current?.field === column.field ? current.direction : null\n },\n sortBy: (column, direction) => {\n const target = columnById(column.field)\n if (!isSortable(column) || !target) {\n return\n }\n applySearch()\n if (direction) {\n target.toggleSorting(direction === 'desc', false)\n } else {\n target.toggleQuerySorting()\n }\n }\n }\n\n // ---- pagination -----------------------------------------------------------\n\n const pageCountFor = (pageSize: number): number | null => {\n const total = totalRows()\n return total !== null && pageSize >= 1\n ? Math.max(1, Math.ceil(total / pageSize))\n : null\n }\n\n /** Page mode: there is a page after `base.page` (C-23). */\n const hasNext = (base: { page: number; pageSize: number }): boolean => {\n const count = pageCountFor(base.pageSize)\n return count !== null ? base.page < count : rows().length >= base.pageSize\n }\n\n const baseQuery = () => table.getBaseQuery() as Q\n\n /**\n * Applies pending search and filter text before a page action; `true`\n * when that changed the query, so the page asked for is dropped (C-14).\n */\n const flushBeforePage = () => {\n const searched = applySearch()\n const filtered = table.flushPendingFilters()\n return searched || filtered\n }\n\n const goTo = (page: number) => {\n table.setPagination(old => ({ ...old, pageIndex: page - 1 }))\n }\n\n const step = (by: 1 | -1) => {\n table.setPagination(old => ({ ...old, pageIndex: old.pageIndex + by }))\n }\n\n const setPage = (page: number) => {\n if (!Number.isFinite(page) || flushBeforePage()) {\n return\n }\n const base = baseQuery()\n if (isCursorQuery(base)) {\n return\n }\n const count = pageCountFor(base.pageSize)\n const target = Math.max(1, Math.trunc(page))\n goTo(count === null ? target : Math.min(target, count))\n }\n\n const nextPage = () => {\n if (flushBeforePage()) {\n return\n }\n const base = baseQuery()\n if (isCursorQuery(base)) {\n step(1)\n } else if (hasNext(base)) {\n goTo(base.page + 1)\n }\n }\n\n const previousPage = () => {\n if (flushBeforePage()) {\n return\n }\n const base = baseQuery()\n if (isCursorQuery(base)) {\n step(-1)\n } else {\n goTo(Math.max(1, base.page - 1))\n }\n }\n\n const setPageSize = (size: number) => {\n if (!Number.isInteger(size) || size < 1) {\n return\n }\n applySearch()\n table.flushPendingFilters()\n table.setPagination(old => ({ ...old, pageSize: size }))\n }\n\n const pagination = computed<PaginationSlotProps>(() => {\n const current = query()\n const cursorMode = isCursorQuery(current)\n const around = cursors()\n return {\n page: cursorMode ? 1 : current.page,\n pageSize: current.pageSize,\n pageCount: cursorMode ? null : pageCountFor(current.pageSize),\n totalRows: totalRows(),\n pageSizeOptions: toValue(options.pageSizeOptions) ?? defaultPageSizes,\n canPrevious: cursorMode ? !!around?.prev : current.page > 1,\n canNext: cursorMode ? !!around?.next : hasNext(current),\n setPage,\n nextPage,\n previousPage,\n setPageSize,\n cursorMode\n }\n })\n\n // ---- expansion (C-26, C-55) -----------------------------------------------\n\n // Vue computed around the atom: `atoms.*.get()` alone is not a tracked read\n // for every consumer path (TanStack vue-table: use a computed or Subscribe).\n const expandedState = computed(() => {\n const state = table.atoms.expanded.get()\n return state === true ? {} : state\n })\n const setExpanded = (\n update: (state: Record<string, boolean>) => Record<string, boolean>\n ) => {\n table.setExpanded(old => update(old === true ? {} : { ...old }))\n }\n\n const expansion: QueryTableExpansion<T> = {\n keyOf,\n canExpand,\n isExpanded: (row, index) =>\n !!expandedState.value[idOf(row, index)] && canExpand(row, index),\n toggle: (row, index) => {\n if (!canExpand(row, index)) {\n return\n }\n const id = idOf(row, index)\n setExpanded(state => {\n if (state[id]) {\n delete state[id]\n } else {\n state[id] = true\n }\n return state\n })\n },\n collapseAll: () => table.setExpanded({}),\n expandAll: () => {\n if (hasSubtable()) {\n setExpanded(state => {\n rows().forEach((row, index) => {\n if (canExpand(row, index)) {\n state[idOf(row, index)] = true\n }\n })\n return state\n })\n }\n }\n }\n\n // Without a row identity the state belongs to the rows it was set on; with\n // one, only keys of the rows given stay, so it never grows past a page. A\n // row's `isExpanded` field seeds it each time `rows` changes (C-26).\n watch(\n rows,\n current => {\n setExpanded(state => {\n if (rowKey() === undefined) {\n state = {}\n } else {\n const present = new Set(current.map(idOf))\n for (const id of Object.keys(state)) {\n if (!present.has(id)) {\n delete state[id]\n }\n }\n }\n if (hasSubtable()) {\n current.forEach((row, index) => {\n const seeded = (row as { isExpanded?: unknown }).isExpanded\n if (!canExpand(row, index)) {\n // C-98: a row that cannot expand keeps no state.\n delete state[idOf(row, index)]\n } else if (seeded === true) {\n state[idOf(row, index)] = true\n } else if (seeded === false) {\n delete state[idOf(row, index)]\n }\n })\n }\n return state\n })\n },\n { immediate: true }\n )\n\n // ---- selection (C-59) -----------------------------------------------------\n\n const selection: QueryTableSelection<T> = {\n enabled: computed(() => toValue(options.selection) !== undefined),\n isSelected: (row, index) =>\n !!toValue(options.selection)?.[idOf(row, index)],\n toggle: (row, index) => {\n const id = idOf(row, index)\n table.setRowSelection(old => {\n const next = { ...old }\n if (next[id]) {\n delete next[id]\n } else {\n next[id] = true\n }\n return next\n })\n },\n allSelected: computed(() => table.getIsAllPageRowsSelected()),\n someSelected: computed(() => table.getIsSomePageRowsSelected()),\n toggleAll: value => table.toggleAllPageRowsSelected(value)\n }\n\n // ---- row pinning (C-74) ---------------------------------------------------\n\n const bodyRows = computed<BodyRow<T>[]>(() => {\n // Off: the rows as given, without TanStack's row model (the 3.0 path).\n if (!pinningEnabled.value) {\n return rows().map((row, index) => ({ row, index, pinned: false }))\n }\n const of = (\n row: Row<QueryTableFeatures, T>,\n pinned: BodyRow<T>['pinned']\n ): BodyRow<T> => ({ row: row.original, index: row.index, pinned })\n return [\n ...table.getTopRows().map(row => of(row, 'top')),\n ...table.getCenterRows().map(row => of(row, false)),\n ...table.getBottomRows().map(row => of(row, 'bottom'))\n ]\n })\n\n const positionOf = (id: string): BodyRow<T>['pinned'] => {\n const { top, bottom } = rowPinningState.value\n return top.includes(id) ? 'top' : bottom.includes(id) ? 'bottom' : false\n }\n\n const rowPinning: QueryTableRowPinning<T> = {\n enabled: pinningEnabled,\n rows: bodyRows,\n pin: (row, index, position) => {\n const id = idOf(row, index)\n // TanStack moves a row pinned again to the end of its region; the rule\n // is that the position the row has is no change.\n if (!pinningEnabled.value || positionOf(id) === position) {\n return\n }\n table.getRow(id, true)?.pin(position)\n }\n }\n\n return {\n table,\n columns: entries,\n hasPinned,\n layout,\n sort,\n filters,\n search,\n pagination,\n expansion,\n selection,\n rowPinning,\n baseQuery\n }\n}\n","import {\n isCursorQuery,\n type PageCursors,\n type Query\n} from '@dolusoft/query-protocol'\nimport {\n computed,\n onBeforeUnmount,\n shallowRef,\n watch,\n watchEffect,\n type Ref\n} from 'vue'\n\nimport type { InfiniteOptions } from '../contract'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nexport interface LoadMoreOptions {\n infinite: () => boolean | InfiniteOptions | undefined\n rowKey: () => unknown\n rows: () => readonly unknown[]\n query: () => Query\n totalRows: () => number | null\n cursors: () => PageCursors | null\n loading: () => boolean\n /** The next page action (C-05, C-56). */\n nextPage: () => void\n table: Readonly<Ref<HTMLTableElement | null>>\n /** The body is virtual (C-83). */\n virtual: () => boolean\n /**\n * With `virtual`: the end of the drawn window among the center rows, and\n * their number; `null` until the window was laid out (C-83).\n */\n window: () => { end: number; count: number } | null\n}\n\n/**\n * Infinite scroll (C-88 to C-90): whether there is more to load, the\n * automatic request near the end of `rows` and `loadMore`. The rows are\n * the consumer's; the table only emits the next page action.\n */\nexport const useLoadMore = (o: LoadMoreOptions) => {\n const enabled = computed(() => !!o.infinite() && o.rowKey() !== undefined)\n const threshold = () => {\n const value = o.infinite()\n const given = typeof value === 'object' ? value.threshold : undefined\n return given !== undefined && given >= 0 ? Math.trunc(given) : 5\n }\n\n const canLoadMore = computed(() => {\n const query = o.query()\n if (isCursorQuery(query)) {\n return !!o.cursors()?.next\n }\n const total = o.totalRows()\n return total !== null\n ? query.page < Math.max(1, Math.ceil(total / query.pageSize))\n : o.rows().length >= query.page * query.pageSize\n })\n\n const loadMore = () => {\n if (enabled.value && canLoadMore.value && !o.loading()) {\n o.nextPage()\n }\n }\n\n // Without `virtual`: the row `threshold` rows before the last one, watched\n // in the viewport (the implicit root sees the clipping of every ancestor).\n const seen = shallowRef(false)\n let observer: IntersectionObserver | null = null\n watch(\n [enabled, o.virtual, o.rows, o.table],\n () => {\n observer?.disconnect()\n observer = null\n seen.value = false\n const count = o.rows().length\n const tbody = o.table.value?.tBodies[0]\n if (\n !enabled.value ||\n o.virtual() ||\n !tbody ||\n count === 0 ||\n typeof IntersectionObserver === 'undefined'\n ) {\n return\n }\n // Pinned rows (C-74) are drawn at the ends whatever their index: the\n // threshold row is counted among the others, from the last one.\n const others = tbody.querySelectorAll(\n ':scope > tr[data-row-index]:not([data-pinned-row])'\n )\n const target = others[Math.max(0, others.length - 1 - threshold())]\n if (target) {\n observer = new IntersectionObserver(entries => {\n seen.value = entries.some(entry => entry.isIntersecting)\n })\n observer.observe(target)\n }\n },\n { flush: 'post', immediate: true }\n )\n onBeforeUnmount(() => observer?.disconnect())\n\n // One automatic request per query and number of rows: an answer that\n // changes neither (an error) is not asked again (C-88).\n let asked = ''\n watchEffect(\n () => {\n if (!enabled.value || !canLoadMore.value || o.loading()) {\n return\n }\n const range = o.window()\n const near = o.virtual()\n ? range !== null && range.end >= range.count - threshold()\n : seen.value\n if (!near) {\n return\n }\n const signature = `${JSON.stringify(o.query())}#${o.rows().length}`\n if (signature !== asked) {\n asked = signature\n o.nextPage()\n }\n },\n { flush: 'post' }\n )\n\n let warned = false\n watchEffect(() => {\n if (!warned && o.infinite() && o.rowKey() === undefined) {\n warned = true\n try {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n } catch {\n // No `process`: a development build.\n }\n console.warn(\n '[QueryTable] `infinite` needs `rowKey`; it is ignored without one (C-88).'\n )\n }\n })\n\n return { enabled, canLoadMore, loadMore }\n}\n","import type { BodyRow } from '../use-query-table'\n\n/** A group key: what `groupBy` returns for a row that belongs to a group. */\nexport type GroupKey = string | number\n\n/** One group: a run of consecutive rows with the same key (C-103). */\nexport interface GroupRun<T> {\n key: GroupKey\n /** Rows in the group. */\n count: number\n /** Its first row and that row's index in `rows`. */\n row: T\n index: number\n /** Position of its first row among the rows it was computed over. */\n start: number\n /** Identity of its header row: the key and the how-many-th run of it. */\n id: string\n}\n\n/** The groups of a list of rows and, per row, the group it belongs to. */\nexport interface GroupRuns<T> {\n runs: GroupRun<T>[]\n /** Per position: the index of its group in `runs`, or -1. */\n groupOf: Int32Array\n /** Per position: the number of header rows drawn up to and with it. */\n headersThrough: Int32Array\n}\n\n/** The runs as a string (start and count of each), or `null` without groups. */\nexport const groupShape = <T>(groups: GroupRuns<T> | null): string | null =>\n groups ? groups.runs.map(run => `${run.start}:${run.count}`).join(',') : null\n\n/**\n * Splits `rows` into runs of consecutive rows with the same `groupBy` key\n * (C-103). The rows are not reordered: a key that comes back after another\n * starts a new run. `null` and `undefined` mean no group.\n */\nexport const groupRuns = <T>(\n rows: readonly BodyRow<T>[],\n groupBy: (row: T, index: number) => GroupKey | null | undefined\n): GroupRuns<T> => {\n const runs: GroupRun<T>[] = []\n const groupOf = new Int32Array(rows.length)\n const headersThrough = new Int32Array(rows.length)\n const seen = new Map<GroupKey, number>()\n let current: GroupRun<T> | null = null\n for (let p = 0; p < rows.length; p++) {\n const { row, index } = rows[p]\n const key = groupBy(row, index)\n // NaN never equals itself: it is no group, not a group per row.\n if (key === null || key === undefined || Number.isNaN(key)) {\n current = null\n groupOf[p] = -1\n } else if (current && current.key === key) {\n current.count++\n groupOf[p] = runs.length - 1\n } else {\n const nth: number = seen.get(key) ?? 0\n seen.set(key, nth + 1)\n current = {\n key,\n count: 1,\n row,\n index,\n start: p,\n id: `${typeof key}:${String(key)}#${nth}`\n }\n runs.push(current)\n groupOf[p] = runs.length - 1\n }\n headersThrough[p] = runs.length\n }\n return { runs, groupOf, headersThrough }\n}\n","// The pure part of the virtual body (C-83, C-84): which items to draw for a\n// scroll position, and how the drawn items and the spacers between them line\n// up. No DOM here; `use-row-window.ts` feeds it measured numbers.\n\n/** A half-open range of item positions: `start` drawn, `end` not. */\nexport interface WindowRange {\n start: number\n end: number\n}\n\nexport interface WindowInput {\n /**\n * The top of every item from the top of the first one, and last the total\n * height: `count + 1` numbers, never decreasing.\n */\n offsets: ArrayLike<number>\n /** The top of the view, from the top of the first item. May be negative. */\n scrollTop: number\n viewportHeight: number\n /** Items drawn beyond each edge of the view. */\n overscan: number\n}\n\n/**\n * Fills `offsets` from `heights`, starting at position `from` (the offsets\n * before it are kept): `offsets[i + 1] = offsets[i] + heights[i]`.\n */\nexport const fillOffsets = (\n heights: ArrayLike<number>,\n offsets: Float64Array,\n from = 0\n): void => {\n for (let i = from; i < heights.length; i++) {\n offsets[i + 1] = offsets[i] + heights[i]\n }\n}\n\n/**\n * The item that holds the point `y`: the last position whose top is at most\n * `y`, clamped to the items (0 for a point above them, the last item for a\n * point below them). `-1` when there is no item.\n */\nexport const indexAt = (offsets: ArrayLike<number>, y: number): number => {\n let low = 0\n let high = offsets.length - 2\n if (high < 0) {\n return -1\n }\n while (low < high) {\n const mid = (low + high + 1) >> 1\n if (offsets[mid] <= y) {\n low = mid\n } else {\n high = mid - 1\n }\n }\n return low\n}\n\n/** The items to draw: the ones in view and `overscan` more on each side. */\nexport const computeWindow = ({\n offsets,\n scrollTop,\n viewportHeight,\n overscan\n}: WindowInput): WindowRange => {\n const count = offsets.length - 1\n if (count <= 0) {\n return { start: 0, end: 0 }\n }\n const first = indexAt(offsets, scrollTop)\n const bottom = scrollTop + Math.max(0, viewportHeight)\n let last = indexAt(offsets, bottom)\n // An item that starts exactly at the bottom edge is not in view.\n if (last > first && offsets[last] >= bottom) {\n last -= 1\n }\n return {\n start: Math.max(0, first - overscan),\n end: Math.min(count, last + 1 + overscan)\n }\n}\n\n/** A run of drawn items, or a spacer that stands for the items left out. */\nexport type Segment =\n { from: number; to: number } | { spacer: number; slot: 0 | 1 | 2 }\n\n/**\n * The body between the pinned rows: an upper spacer, the drawn items and a\n * lower spacer. A `kept` item outside the range (it holds the focus, C-86)\n * is drawn on its own, with a spacer of its own between it and the range.\n * Spacers of height 0 are left out. `slot` names a spacer's place, so a\n * spacer keeps its identity while its height changes.\n */\nexport const segmentsOf = (\n offsets: ArrayLike<number>,\n range: WindowRange,\n kept: number | null\n): Segment[] => {\n const count = offsets.length - 1\n const total = count > 0 ? offsets[count] : 0\n const out: Segment[] = []\n const spacer = (height: number, slot: 0 | 1 | 2) => {\n if (height > 0) {\n out.push({ spacer: height, slot })\n }\n }\n const run = (from: number, to: number) => {\n if (to > from) {\n out.push({ from, to })\n }\n }\n const { start, end } = range\n if (kept !== null && kept >= 0 && kept < start) {\n spacer(offsets[kept], 0)\n run(kept, kept + 1)\n spacer(offsets[start] - offsets[kept + 1], 1)\n run(start, end)\n spacer(total - offsets[end], 2)\n } else if (kept !== null && kept >= end && kept < count) {\n spacer(offsets[start], 0)\n run(start, end)\n spacer(offsets[kept] - offsets[end], 1)\n run(kept, kept + 1)\n spacer(total - offsets[kept + 1], 2)\n } else {\n spacer(offsets[start], 0)\n run(start, end)\n spacer(total - offsets[end], 2)\n }\n return out\n}\n","import { computed, onBeforeUnmount, shallowRef, watch, type Ref } from 'vue'\n\nimport {\n groupRuns,\n groupShape,\n type GroupKey,\n type GroupRun\n} from '../body/group-runs'\nimport type { ScrollToIndexOptions, VirtualOptions } from '../contract'\nimport type { BodyRow } from '../use-query-table'\nimport {\n computeWindow,\n fillOffsets,\n indexAt,\n segmentsOf,\n type WindowRange\n} from './compute-window'\n\n// Replaced by the consumer's bundler, just as in Vue's esm-bundler build.\ndeclare const process: { env: { NODE_ENV?: string } }\n\n// A try/catch keeps the constant replacement in production builds.\nconst isDevelopment = (): boolean => {\n try {\n return process.env.NODE_ENV !== 'production'\n } catch {\n return true\n }\n}\n\n/** A row the body draws, with its `aria-rowindex` when the body is virtual. */\nexport type DrawnRow<T> = BodyRow<T> & { aria?: number }\n/** A spacer row: the height of the items it stands for (C-83). */\nexport interface SpacerRow {\n spacer: number\n key: symbol\n}\n/** The header row of a group (C-103), with its `aria-rowindex` when virtual. */\nexport interface GroupRow<T> {\n group: GroupRun<T>\n key: symbol\n aria?: number\n}\n/** An item of the body: a data row, a spacer or a group row. */\nexport type BodyItem<T> = DrawnRow<T> | SpacerRow | GroupRow<T>\n\nexport interface RowWindowOptions<T> {\n virtual: () => boolean | VirtualOptions | undefined\n table: Readonly<Ref<HTMLTableElement | null>>\n /** The rows in drawing order: pinned top, the others, pinned bottom (C-74). */\n bodyRows: () => BodyRow<T>[]\n keyOf: (row: T, index: number) => string | number\n isExpanded: (row: T, index: number) => boolean\n /** The `groupBy` prop (C-103); absent, no group is drawn. */\n groupBy?: () =>\n ((row: T, index: number) => GroupKey | null | undefined) | undefined\n}\n\ntype Align = NonNullable<ScrollToIndexOptions['align']>\ntype Container = HTMLElement | Window\n\n/** One identity per spacer place: above, between, below (`segmentsOf`). */\nconst spacerKeys = [Symbol('above'), Symbol('between'), Symbol('below')]\n\n/**\n * The virtual body (C-83 to C-87): which rows are drawn, the spacers that\n * stand for the others, the measured heights, the focused row kept drawn,\n * printing and `scrollToIndex`. Without `virtual` it draws `bodyRows` as\n * they are and touches no DOM.\n */\nexport const useRowWindow = <T extends object>(o: RowWindowOptions<T>) => {\n // Compared by value: `:virtual=\"{ overscan: 5 }\"` is a new object on every\n // render of the consumer and must not draw the body again.\n const settings = computed<VirtualOptions | null>(previous => {\n const value = o.virtual()\n const next = value === true ? {} : value || null\n return previous &&\n next &&\n previous.overscan === next.overscan &&\n previous.rowHeight === next.rowHeight &&\n previous.estimateRowHeight === next.estimateRowHeight &&\n previous.groupRowHeight === next.groupRowHeight &&\n previous.scrollElement === next.scrollElement\n ? previous\n : next\n })\n const enabled = () => settings.value !== null\n const overscan = () => Math.max(0, settings.value?.overscan ?? 10)\n const fixed = () => settings.value?.rowHeight\n\n /** Pinned rows sit at both ends of `bodyRows`; the window is the middle. */\n const parts = computed(() => {\n const all = o.bodyRows()\n let top = 0\n while (top < all.length && all[top].pinned === 'top') {\n top++\n }\n let bottom = all.length\n while (bottom > top && all[bottom - 1].pinned === 'bottom') {\n bottom--\n }\n return {\n all,\n top,\n center: top === 0 && bottom === all.length ? all : all.slice(top, bottom)\n }\n })\n const center = () => parts.value.center\n\n /** The groups of the center rows (C-103), or `null` without `groupBy`. */\n const groups = computed(() => {\n const groupBy = o.groupBy?.()\n return groupBy ? groupRuns(center(), groupBy) : null\n })\n /** The center position starts a group: its group row is drawn above it. */\n const startsGroup = (position: number) => {\n const g = groups.value\n if (!g) {\n return false\n }\n const at = g.groupOf[position]\n return at >= 0 && g.runs[at].start === position\n }\n // A symbol per group id: a group row's `v-for` key can never equal a\n // consumer's `rowKey`, whatever string that is. Ids that left are dropped.\n let groupKeys = new Map<string, symbol>()\n watch(groups, g => {\n if (!g) {\n groupKeys = new Map()\n return\n }\n const kept = new Map<string, symbol>()\n for (const run of g.runs) {\n const known = groupKeys.get(run.id)\n if (known) {\n kept.set(run.id, known)\n }\n }\n groupKeys = kept\n })\n const groupKey = (id: string) => {\n let key = groupKeys.get(id)\n if (!key) {\n key = Symbol(id)\n groupKeys.set(id, key)\n }\n return key\n }\n const groupRowOf = (run: GroupRun<T>, aria?: number): GroupRow<T> => ({\n group: run,\n key: groupKey(run.id),\n aria\n })\n\n /** Position of a row index among the center rows (ascending), or -1. */\n const positionOf = (index: number): number => {\n const rows = center()\n if (rows[index]?.index === index) {\n return index\n }\n let low = 0\n let high = rows.length - 1\n while (low <= high) {\n const mid = (low + high) >> 1\n const at = rows[mid].index\n if (at === index) {\n return mid\n }\n if (at < index) {\n low = mid + 1\n } else {\n high = mid - 1\n }\n }\n return -1\n }\n\n // ---- heights (C-84) -------------------------------------------------------\n\n let heights = new Float64Array(0)\n /** Item heights without the group row above an item (C-104). */\n let base = new Float64Array(0)\n let measured = new Uint8Array(0)\n /** The measured height of a group row, `0` until one is measured. */\n let groupMeasured = 0\n let offsets = new Float64Array(1)\n let byKey = new Map<string | number, number>()\n /** The first measured height, the estimate when none is given. */\n let firstMeasured = 0\n /** Bumped whenever `offsets` change, so the spacers are drawn again. */\n const version = shallowRef(0)\n const estimate = () =>\n fixed() ?? settings.value?.estimateRowHeight ?? (firstMeasured || 32)\n /** Height counted for a group row (C-104). */\n const groupHeight = () => {\n const height = fixed()\n if (height !== undefined) {\n return settings.value?.groupRowHeight ?? height\n }\n return groupMeasured || estimate()\n }\n /** An item's height: its row and, above it, its group row. */\n const withGroup = (position: number) =>\n base[position] + (startsGroup(position) ? groupHeight() : 0)\n\n const rebuild = () => {\n const rows = enabled() ? center() : []\n const height = fixed()\n heights = new Float64Array(rows.length)\n // Without groups an item is its row: one array serves both (P8).\n base = groups.value ? new Float64Array(rows.length) : heights\n measured = new Uint8Array(rows.length)\n const kept = new Map<string | number, number>()\n for (let i = 0; i < rows.length; i++) {\n if (height !== undefined) {\n base[i] = height\n } else {\n const key = o.keyOf(rows[i].row, rows[i].index)\n const known = byKey.get(key)\n if (known === undefined) {\n base[i] = estimate()\n } else {\n kept.set(key, known)\n base[i] = known\n measured[i] = 1\n }\n }\n heights[i] = withGroup(i)\n }\n // Keys that left `rows` are dropped (C-84).\n byKey = kept\n // A `scrollToIndex` waiting for its row meant the rows it was given.\n pending = null\n offsets = new Float64Array(rows.length + 1)\n fillOffsets(heights, offsets)\n version.value++\n }\n\n const body = () => o.table.value?.tBodies[0] ?? null\n\n /** The drawn data row at a center position. */\n const rowElement = (tbody: HTMLElement, position: number) => {\n const row = center()[position]\n return row\n ? tbody.querySelector<HTMLElement>(\n `:scope > tr[data-row-index=\"${row.index}\"]:not([data-pinned-row])`\n )\n : null\n }\n\n /** Height of a drawn item: its row and its subtable row. */\n const itemHeight = (tr: Element) => {\n const next = tr.nextElementSibling\n return (\n tr.getBoundingClientRect().height +\n (next?.classList.contains('qt-subtable-row')\n ? next.getBoundingClientRect().height\n : 0)\n )\n }\n\n /** Reads the drawn items; `true` when a height changed. */\n const measure = (tbody: HTMLElement): boolean => {\n if (fixed() !== undefined) {\n return false\n }\n const rows = center()\n let from = -1\n for (const tr of tbody.children) {\n if (groups.value && tr.classList.contains('qt-group-row')) {\n // Every group row counts as tall as the last one measured (C-104).\n const height = tr.getBoundingClientRect().height\n if (height > 0 && Math.abs(height - groupMeasured) > 0.5) {\n groupMeasured = height\n from = 0\n }\n continue\n }\n const at = tr.getAttribute('data-row-index')\n if (at === null || tr.hasAttribute('data-pinned-row')) {\n continue\n }\n const position = positionOf(Number(at))\n if (position < 0) {\n continue\n }\n const height = itemHeight(tr)\n if (\n !firstMeasured &&\n height > 0 &&\n settings.value?.estimateRowHeight === undefined\n ) {\n // The first measured item becomes the estimate of the others.\n firstMeasured = height\n for (let i = 0; i < base.length; i++) {\n if (!measured[i]) {\n base[i] = height\n }\n }\n from = 0\n }\n if (!measured[position] || Math.abs(base[position] - height) > 0.5) {\n base[position] = height\n measured[position] = 1\n byKey.set(o.keyOf(rows[position].row, rows[position].index), height)\n from = from < 0 ? position : Math.min(from, position)\n }\n }\n if (from >= 0) {\n for (let i = from; i < heights.length; i++) {\n heights[i] = withGroup(i)\n }\n fillOffsets(heights, offsets, from)\n version.value++\n return true\n }\n return false\n }\n\n // ---- the window (C-83, C-85) ----------------------------------------------\n\n const range = shallowRef<WindowRange>({\n start: 0,\n end: Math.ceil((globalThis.innerHeight || 800) / 32) + 10\n })\n /** The window was computed from the layout at least once. */\n const ready = shallowRef(false)\n let container: Container | null = null\n let frame = 0\n /** The first visible item and its top before the window moved (C-84). */\n let anchor: { position: number; top: number } | null = null\n /**\n * The container's scroll position the window was computed for. The\n * browser's own scroll anchoring may move it when the drawn rows change\n * (it anchors to a spacer when no row is in view); it is put back.\n */\n let expected: number | null = null\n /** A `scrollToIndex` to correct once its row is drawn (C-87). */\n let pending: { position: number; align: Align; tries: number } | null = null\n /** Frames a `scrollToIndex` waits for its row before it is given up. */\n const pendingFrames = 6\n\n const viewport = (target: Container | null = container) => {\n if (target === null || target === window) {\n return { top: 0, height: globalThis.innerHeight }\n }\n const element = target as HTMLElement\n return {\n top: element.getBoundingClientRect().top + element.clientTop,\n height: element.clientHeight\n }\n }\n\n /** Client top of the first center item: below the top-pinned rows. */\n const itemsTop = (tbody: HTMLElement) => {\n for (const tr of tbody.children) {\n if (tr.getAttribute('data-pinned-row') !== 'top') {\n return tr.getBoundingClientRect().top\n }\n }\n return tbody.getBoundingClientRect().bottom\n }\n\n const scrollTopOf = (target: Container) =>\n target === window ? window.scrollY : (target as HTMLElement).scrollTop\n\n // Always instant: with `scroll-behavior: smooth` on the container (or on\n // the root, for the window) a plain assignment animates, the position\n // read right after is the old one and the corrections land wrong.\n const scrollBy = (delta: number, target: Container | null = container) => {\n if (Math.abs(delta) < 1 || !target) {\n return\n }\n target.scrollTo({\n top: scrollTopOf(target) + delta,\n behavior: 'instant'\n })\n }\n\n /** How far to scroll to show an item at `top` (client) with `height`. */\n const alignDelta = (\n top: number,\n height: number,\n align: Align,\n groupCover = 0,\n target: Container | null = container\n ) => {\n const view = viewport(target)\n // A sticky header that covers the top of the container hides a row\n // aligned to the top; the row goes below it, and below a sticky group\n // row that covers it too (C-104).\n const head = o.table.value?.tHead?.getBoundingClientRect()\n const cover =\n head && head.top <= view.top + 1 && head.bottom > view.top\n ? head.bottom - view.top\n : 0\n const viewTop = view.top + cover + groupCover\n const viewBottom = view.top + view.height\n const bottom = top + height\n switch (align) {\n case 'start':\n return top - viewTop\n case 'end':\n return bottom - viewBottom\n case 'center':\n return (top + bottom - viewTop - viewBottom) / 2\n default:\n return top < viewTop\n ? top - viewTop\n : bottom > viewBottom\n ? bottom - viewBottom\n : 0\n }\n }\n\n /**\n * Height of a group row the consumer's CSS made sticky, which covers a\n * row aligned to the top of its group (C-104); `0` without one.\n */\n const stickyGroupCover = (tbody: HTMLElement) => {\n if (!groups.value) {\n return 0\n }\n // Sticky on the cell only: the window reads the row's place in the flow.\n const cell = tbody.querySelector(':scope > tr.qt-group-row > th')\n return cell && getComputedStyle(cell).position === 'sticky'\n ? cell.getBoundingClientRect().height\n : 0\n }\n /** The sticky cover over a row: only a grouped row that does not start its group. */\n const coverOf = (position: number, tbody: HTMLElement) => {\n const g = groups.value\n return g && g.groupOf[position] >= 0 && !startsGroup(position)\n ? stickyGroupCover(tbody)\n : 0\n }\n\n /**\n * Scrolls `target` so the drawn row `tr` (at a center position, or `-1`\n * for a pinned row) is shown as `align` asks, below a sticky header and a\n * sticky group row (C-87, C-104).\n */\n const alignRow = (\n tbody: HTMLElement,\n tr: Element,\n position: number,\n align: Align,\n target: Container | null,\n /** The item with its open subtable row, or the row alone. */\n whole = true\n ) => {\n // The first row of a group is shown with its group row above it.\n const above = startsGroup(position) ? tr.previousElementSibling : null\n const head = above?.classList.contains('qt-group-row') ? above : null\n scrollBy(\n alignDelta(\n (head ?? tr).getBoundingClientRect().top,\n (whole ? itemHeight(tr) : tr.getBoundingClientRect().height) +\n (head ? head.getBoundingClientRect().height : 0),\n align,\n head ? 0 : coverOf(position, tbody),\n target\n ),\n target\n )\n }\n\n /** After a render: correct the drift (C-84) or a `scrollToIndex` (C-87). */\n const settle = () => {\n const tbody = body()\n if (!tbody) {\n return\n }\n if (expected !== null && container) {\n // Reading the position lays the page out, the browser's anchoring\n // adjustment included; undo it, the corrections below are ours.\n scrollBy(expected - scrollTopOf(container))\n expected = null\n }\n if (pending) {\n const tr = rowElement(tbody, pending.position)\n if (tr) {\n const { align, position } = pending\n pending = null\n alignRow(tbody, tr, position, align, container)\n return\n }\n // Its row never got drawn (the container could not scroll that far,\n // say): give up, so the drift correction works again.\n if (++pending.tries <= pendingFrames) {\n schedule()\n return\n }\n pending = null\n }\n if (anchor) {\n const tr = rowElement(tbody, anchor.position)\n if (tr) {\n scrollBy(tr.getBoundingClientRect().top - anchor.top)\n }\n anchor = null\n }\n }\n\n const update = () => {\n frame = 0\n const tbody = body()\n if (!tbody || !container || printing.value) {\n return\n }\n measure(tbody)\n const view = viewport()\n const scrollTop = view.top - itemsTop(tbody)\n const next = computeWindow({\n offsets,\n scrollTop,\n viewportHeight: view.height,\n overscan: overscan()\n })\n ready.value = true\n const current = range.value\n if (next.start === current.start && next.end === current.end) {\n settle()\n return\n }\n if (!pending && fixed() === undefined) {\n // The item at the top of the view, or the nearest drawn one when a\n // fast scroll went past the drawn rows: the anchor must be drawn now.\n const position = Math.min(\n Math.max(indexAt(offsets, scrollTop), current.start),\n current.end - 1\n )\n const tr = position < 0 ? null : rowElement(tbody, position)\n anchor = tr ? { position, top: tr.getBoundingClientRect().top } : null\n }\n expected = scrollTopOf(container)\n range.value = next\n }\n\n const schedule = () => {\n if (!frame) {\n frame = requestAnimationFrame(update)\n }\n }\n\n // ---- printing (C-87) ------------------------------------------------------\n\n const printing = shallowRef(false)\n const startPrint = () => {\n printing.value = true\n }\n const endPrint = () => {\n printing.value = false\n schedule()\n }\n const onPrintMedia = (event: MediaQueryListEvent) => {\n if (event.matches) {\n startPrint()\n } else {\n endPrint()\n }\n }\n let printMedia: MediaQueryList | null = null\n\n // ---- focus (C-86) ---------------------------------------------------------\n\n const kept = shallowRef<{ row: T; position: number } | null>(null)\n\n /** The row index of the item (data row or subtable row) holding `target`. */\n const itemOf = (target: EventTarget | null, tbody: Element) => {\n let tr = (target as Element | null)?.closest?.('tr') ?? null\n while (tr && tr.parentElement !== tbody) {\n tr = tr.parentElement?.closest('tr') ?? null\n }\n if (tr?.classList.contains('qt-subtable-row')) {\n tr = tr.previousElementSibling as HTMLTableRowElement | null\n }\n const at = tr?.getAttribute('data-row-index')\n return !tr ||\n at === null ||\n at === undefined ||\n tr.hasAttribute('data-pinned-row')\n ? -1\n : positionOf(Number(at))\n }\n\n const onFocusIn = (event: FocusEvent) => {\n if (!enabled()) {\n return\n }\n const position = itemOf(event.target, event.currentTarget as Element)\n if (position >= 0) {\n kept.value = { row: center()[position].row, position }\n }\n }\n\n const onFocusOut = (event: FocusEvent) => {\n if (\n kept.value &&\n itemOf(event.relatedTarget, event.currentTarget as Element) !==\n kept.value.position\n ) {\n kept.value = null\n }\n }\n\n const keptPosition = () => {\n const focus = kept.value\n if (!focus) {\n return null\n }\n const rows = center()\n if (rows[focus.position]?.row === focus.row) {\n return focus.position\n }\n const found = rows.findIndex(row => row.row === focus.row)\n return found < 0 ? null : found\n }\n\n // ---- the drawn rows -------------------------------------------------------\n\n /** Open subtable rows before each row of `bodyRows`, and in all (C-86). */\n const expandedBefore = computed(() => {\n const all = enabled() ? parts.value.all : []\n const counts = new Int32Array(all.length + 1)\n for (let i = 0; i < all.length; i++) {\n counts[i + 1] =\n counts[i] + (o.isExpanded(all[i].row, all[i].index) ? 1 : 0)\n }\n return counts\n })\n\n /** Group rows drawn up to and with the center position (C-104). */\n const groupsThrough = (position: number) =>\n groups.value ? groups.value.headersThrough[position] : 0\n const groupCount = () => groups.value?.runs.length ?? 0\n\n const drawn = computed<Array<BodyItem<T>>>(() => {\n const { all, top } = parts.value\n const g = groups.value\n if (!enabled()) {\n if (!g) {\n return all\n }\n // Without `virtual` every group row is drawn above its first row.\n const out: Array<BodyItem<T>> = []\n for (let q = 0; q < all.length; q++) {\n const p = q - top\n if (p >= 0 && p < g.groupOf.length && startsGroup(p)) {\n out.push(groupRowOf(g.runs[g.groupOf[p]]))\n }\n out.push(all[q])\n }\n return out\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n version.value\n const rows = center()\n const before = expandedBefore.value\n // The header row is 1, the first body row 2; a group row counts as a\n // row, before the first row of its group (C-104).\n const headersBefore = (q: number) =>\n q < top\n ? 0\n : q < top + rows.length\n ? groupsThrough(q - top)\n : groupCount()\n const ariaOf = (q: number) => q + before[q] + headersBefore(q) + 2\n const at = (q: number): DrawnRow<T> => ({ ...all[q], aria: ariaOf(q) })\n const out: Array<BodyItem<T>> = []\n /** The group whose row was drawn last, or -1. */\n let drawnGroup = -1\n /** The center row at `p`, after its group row when it needs one. */\n const push = (p: number, carry: boolean) => {\n const group = g ? g.groupOf[p] : -1\n if (g && group >= 0 && group !== drawnGroup) {\n const run = g.runs[group]\n if (run.start === p) {\n out.push(groupRowOf(run, ariaOf(top + p) - 1))\n } else if (carry) {\n // The first row of the group is not drawn: its group row is drawn\n // here, with its height taken from the spacer above, so a sticky\n // group row stays while its group is in view (C-104).\n const last = out[out.length - 1]\n if (last && 'spacer' in last) {\n const height = Math.max(0, last.spacer - groupHeight())\n out[out.length - 1] = { spacer: height, key: last.key }\n }\n out.push(groupRowOf(run, ariaOf(top + run.start) - 1))\n }\n }\n drawnGroup = group\n out.push(at(top + p))\n }\n for (let q = 0; q < top; q++) {\n out.push(at(q))\n }\n if (printing.value) {\n for (let p = 0; p < rows.length; p++) {\n push(p, false)\n }\n } else {\n const end = Math.min(range.value.end, rows.length)\n const win = { start: Math.min(range.value.start, end), end }\n for (const segment of segmentsOf(offsets, win, keptPosition())) {\n if ('spacer' in segment) {\n out.push({ spacer: segment.spacer, key: spacerKeys[segment.slot] })\n } else {\n for (let p = segment.from; p < segment.to; p++) {\n push(p, p === segment.from)\n }\n }\n }\n }\n for (let q = top + rows.length; q < all.length; q++) {\n out.push(at(q))\n }\n // A spacer whose height went to a group row is not drawn.\n return g ? out.filter(item => !('spacer' in item) || item.spacer > 0) : out\n })\n\n // ---- the container and its listeners (C-85) -------------------------------\n\n let box: ResizeObserver | null = null\n let rowsObserver: ResizeObserver | null = null\n /**\n * Watches the table for coming into the layout: a table mounted inside\n * `display: none` has no scrolling ancestor yet, so the container is\n * looked for again once it has a size.\n */\n let shown: ResizeObserver | null = null\n let hadSize = false\n let watchedTable: HTMLTableElement | null = null\n const watchShown = (table: HTMLTableElement | null) => {\n if (table === watchedTable) {\n return\n }\n shown?.disconnect()\n shown = null\n watchedTable = table\n if (!table || typeof ResizeObserver === 'undefined') {\n return\n }\n hadSize = table.getBoundingClientRect().height > 0\n shown = new ResizeObserver(() => {\n const hasSize = table.getBoundingClientRect().height > 0\n if (hasSize !== hadSize) {\n hadSize = hasSize\n if (hasSize) {\n attach()\n }\n }\n })\n shown.observe(table)\n }\n const observed = new Set<Element>()\n let warned = false\n\n const findContainer = (table: HTMLTableElement): Container => {\n const given = settings.value?.scrollElement?.()\n if (given) {\n return given\n }\n for (\n let element = table.parentElement;\n element &&\n element !== document.body &&\n element !== document.documentElement;\n element = element.parentElement\n ) {\n const overflow = getComputedStyle(element).overflowY\n if (\n (overflow === 'auto' || overflow === 'scroll') &&\n element.scrollHeight > element.clientHeight\n ) {\n return element\n }\n }\n return window\n }\n\n const detach = () => {\n container?.removeEventListener('scroll', schedule)\n container = null\n box?.disconnect()\n box = null\n removeEventListener('resize', schedule)\n }\n\n const attach = () => {\n const table = o.table.value\n if (!table || !enabled()) {\n watchShown(null)\n detach()\n return\n }\n watchShown(table)\n const next = findContainer(table)\n if (next !== container) {\n detach()\n container = next\n next.addEventListener('scroll', schedule, { passive: true })\n addEventListener('resize', schedule)\n if (next !== window && typeof ResizeObserver !== 'undefined') {\n box = new ResizeObserver(schedule)\n box.observe(next as HTMLElement)\n }\n }\n if (\n !warned &&\n isDevelopment() &&\n getComputedStyle(table).tableLayout !== 'fixed'\n ) {\n warned = true\n console.warn(\n '[QueryTable] `virtual` with `table-layout: auto`: column widths follow the drawn rows. Set `table-layout: fixed` (C-85).'\n )\n }\n schedule()\n }\n\n /** Watches the drawn rows for size changes; measured on the next frame. */\n const observeRows = () => {\n const tbody = body()\n if (\n !tbody ||\n !enabled() ||\n fixed() !== undefined ||\n typeof ResizeObserver === 'undefined'\n ) {\n rowsObserver?.disconnect()\n observed.clear()\n return\n }\n rowsObserver ??= new ResizeObserver(schedule)\n for (const element of observed) {\n if (element.parentElement !== tbody) {\n rowsObserver.unobserve(element)\n observed.delete(element)\n }\n }\n for (const tr of tbody.children) {\n if (!observed.has(tr) && !tr.classList.contains('qt-virtual-spacer')) {\n rowsObserver.observe(tr)\n observed.add(tr)\n }\n }\n }\n\n watch(\n [\n () => parts.value.center,\n () => settings.value?.rowHeight,\n () => settings.value?.estimateRowHeight,\n () => settings.value?.groupRowHeight,\n // By shape, not identity: a `groupBy` given anew on each render with\n // the same runs does not rebuild the heights.\n () => groupShape(groups.value),\n enabled\n ],\n rebuild,\n { immediate: true }\n )\n\n // The container is looked for again when the rows change: a container\n // only scrolls once its content is taller than it.\n watch(\n [\n () => o.table.value,\n enabled,\n () => settings.value?.scrollElement,\n () => parts.value.center\n ],\n attach,\n { flush: 'post', immediate: true }\n )\n\n watch(\n drawn,\n () => {\n observeRows()\n settle()\n },\n { flush: 'post' }\n )\n\n watch(\n enabled,\n on => {\n printMedia?.removeEventListener('change', onPrintMedia)\n removeEventListener('beforeprint', startPrint)\n removeEventListener('afterprint', endPrint)\n printMedia = null\n if (on && typeof window !== 'undefined') {\n addEventListener('beforeprint', startPrint)\n addEventListener('afterprint', endPrint)\n printMedia = window.matchMedia?.('print') ?? null\n printMedia?.addEventListener('change', onPrintMedia)\n }\n },\n { immediate: true }\n )\n\n onBeforeUnmount(() => {\n detach()\n watchShown(null)\n cancelAnimationFrame(frame)\n rowsObserver?.disconnect()\n printMedia?.removeEventListener('change', onPrintMedia)\n removeEventListener('beforeprint', startPrint)\n removeEventListener('afterprint', endPrint)\n })\n\n // ---- scrollToIndex (C-87) -------------------------------------------------\n\n const scrollToIndex = (index: number, options: ScrollToIndexOptions = {}) => {\n const align = options.align ?? 'auto'\n const tbody = body()\n if (!tbody || !Number.isInteger(index) || index < 0) {\n return\n }\n const position =\n enabled() && container && !printing.value ? positionOf(index) : -1\n if (position < 0) {\n tbody\n .querySelector(`:scope > tr[data-row-index=\"${index}\"]`)\n ?.scrollIntoView({\n block: align === 'auto' ? 'nearest' : align,\n behavior: 'instant'\n })\n return\n }\n anchor = null\n pending = { position, align, tries: 0 }\n scrollBy(\n alignDelta(\n itemsTop(tbody) + offsets[position],\n heights[position],\n align,\n coverOf(position, tbody)\n )\n )\n schedule()\n }\n\n /**\n * Shows the drawn row with this index in `rows` whole, below a sticky\n * header and a sticky group row, in its scroll container (C-110); with\n * `virtual` that is the container of C-85, else the nearest scrolling\n * ancestor of the table or the window. Only the row: an open subtable row\n * taller than the view would push it out. A `scrollToIndex` still waiting\n * is dropped, so it cannot move the view away after. A row not drawn does\n * nothing.\n */\n const reveal = (index: number) => {\n const tbody = body()\n const table = o.table.value\n const tr = tbody?.querySelector(`:scope > tr[data-row-index=\"${index}\"]`)\n if (!tbody || !table || !tr) {\n return\n }\n pending = null\n const target = enabled() && container ? container : findContainer(table)\n alignRow(\n tbody,\n tr,\n tr.hasAttribute('data-pinned-row') ? -1 : positionOf(index),\n 'auto',\n target,\n false\n )\n }\n\n return {\n enabled,\n drawn,\n range,\n ready,\n centerCount: () => center().length,\n expandedCount: () => expandedBefore.value[expandedBefore.value.length - 1],\n /** Group rows of the body, drawn or not (C-104). */\n groupCount,\n scrollToIndex,\n reveal,\n /** A `scrollToIndex` or a window update is still to come (C-110). */\n busy: () => pending !== null || frame !== 0,\n onFocusIn,\n onFocusOut\n }\n}\n","<script\n setup\n lang=\"ts\"\n generic=\"T extends object, Q extends Query = TableQuery\"\n>\nimport { computed, getCurrentInstance, shallowRef, useSlots } from 'vue'\n\nimport { useRowNavigation } from './body/use-row-navigation'\nimport { applyWidth, sideOf, type PinSide } from './columns/column-layout'\nimport type {\n CellSlotProps,\n HeaderSlotProps,\n LoadMoreSlotProps,\n Query,\n QueryTableExpose,\n TableEmits,\n TableProps,\n TableQuery,\n TableSlots,\n ToolbarSlotProps\n} from './contract'\nimport { resolveLabels } from './core/labels'\nimport { provideTableContext } from './core/table-context'\nimport { focusFilterOf } from './filter/focus-filter'\nimport { useChangeFlash } from './flash/use-change-flash'\nimport { useHeaderContextMenu } from './header/use-header-context-menu'\nimport TableBody from './parts/table-body.vue'\nimport TableFooter from './parts/table-footer.vue'\nimport TableHeader from './parts/table-header.vue'\nimport TablePagination from './parts/table-pagination.vue'\nimport { utilityKey, type Utility } from './pin/pin'\nimport { useHeaderGeometry } from './pin/use-header-geometry'\nimport { useColumnReorder } from './reorder/use-column-reorder'\nimport { measureColumnWidths } from './resize/measure-widths'\nimport { useAutoWidth } from './resize/use-auto-width'\nimport { useColumnResize } from './resize/use-column-resize'\nimport { useScrollBody } from './scroll/use-scroll-body'\nimport { useQueryTable } from './use-query-table'\nimport { useLoadMore } from './virtual/use-load-more'\nimport { useRowWindow } from './virtual/use-row-window'\n\ndefineOptions({ name: 'QueryTable' })\n\nconst props = withDefaults(defineProps<TableProps<T, Q>>(), {\n cursors: null,\n selection: undefined,\n rowPinning: undefined,\n searchDebounce: 300,\n rows: () => [],\n totalRows: null,\n footerRows: () => [],\n loading: false,\n sortable: false,\n filterable: false,\n resizable: false,\n autoWidth: false,\n autoWidthMax: undefined,\n reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n rowExpandable: undefined,\n rowKind: undefined,\n groupBy: undefined,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: false,\n rowNavigation: false,\n scrollBody: false,\n infinite: false,\n flash: false,\n rowsUpdate: undefined\n})\n\nconst emit = defineEmits<TableEmits<T, Q>>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\n// Every piece of state lives in the composable; the component draws it. The\n// table never writes to its props.\nconst state = useQueryTable<T, Q>({\n query: () => props.query,\n columns: () => props.columns,\n rows: () => props.rows,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n sortable: () => props.sortable,\n filterDebounce: () => props.filterDebounce,\n searchDebounce: () => props.searchDebounce,\n selection: () => props.selection,\n rowPinning: () => props.rowPinning,\n rowKey: () => props.rowKey,\n hasSubtable: () => props.hasSubtable,\n rowExpandable: () => props.rowExpandable,\n pageSizeOptions: () => props.pagination?.pageSizeOptions,\n onQueryChange: (query, reason) => emit('update:query', query, reason),\n onSelectionChange: selection => emit('update:selection', selection),\n onColumnsChange: (columns, reason) => emit('update:columns', columns, reason),\n onRowPinningChange: rowPinning => emit('update:rowPinning', rowPinning)\n})\nconst { filters, sort, search, expansion } = state\nconst rowSelection = state.selection\nconst paginationProps = state.pagination\n\nconst labels = computed(() => resolveLabels(props.labels))\n\n// C-28 / C-96: the browser menu is suppressed only for a consumer that listens.\n// The check runs when the event fires: a listener is not a prop, so adding one\n// later does not re-render the table.\nconst instance = getCurrentInstance()\n// A `.once` listener arrives as `onCellContextMenuOnce` / `onHeaderContextMenuOnce`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\nconst hasHeaderContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(\n vnodeProps?.onHeaderContextMenu || vnodeProps?.onHeaderContextMenuOnce\n )\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\n\nconst { onContextMenu: onHeaderContextMenu } = useHeaderContextMenu({\n columns: () => visibleColumns.value,\n indexOf: field => entries.value.find(e => e.column.field === field)?.index,\n listening: () => hasHeaderContextMenuListener(),\n onContextMenu: payload => emit('headerContextMenu', payload)\n})\nconst hasPinned = state.hasPinned\n/** Right panel first, then subtable, then selection (C-22: the first hosts clear-all). */\nconst utilities = computed(() =>\n [\n props.hasRightPanel ? 'right-panel' : null,\n props.hasSubtable ? 'subtable' : null,\n rowSelection.enabled.value ? 'select' : null\n ].filter((name): name is Utility => name !== null)\n)\nconst utilityCount = computed(() => utilities.value.length)\nconst columnCount = computed(() => entries.value.length + utilityCount.value)\n\n/** Utilities are pinned only with a left-pinned column (C-46, C-71). */\nconst utilitySide = (): PinSide => (hasPinned.value ? 'left' : false)\n/** The table of the header: with `scrollBody` the first of three (C-101). */\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\n// With `scrollBody` the body rows have a table of their own, and the three\n// tables a wrapper each; without it the one table holds every part.\nconst bodyTableEl = shallowRef<HTMLTableElement | null>(null)\nconst headWrap = shallowRef<HTMLElement | null>(null)\nconst bodyWrap = shallowRef<HTMLElement | null>(null)\nconst footWrap = shallowRef<HTMLElement | null>(null)\n/** The table of the body rows. */\nconst bodyTable = computed(() => bodyTableEl.value ?? tableEl.value)\n/** With `scrollBody`, the body table to measure apart from the header. */\nconst splitBody = () => (props.scrollBody ? bodyTableEl.value : null)\nconst {\n widths,\n tableWidth,\n offsets,\n columns: cellWidths\n} = useHeaderGeometry({\n table: tableEl,\n cells: () => [\n ...utilities.value.map(utility => ({\n key: utilityKey(utility),\n side: utilitySide()\n })),\n ...entries.value.map(({ column }) => ({\n key: column.field,\n side: sideOf(column)\n }))\n ],\n active: () =>\n props.scrollBody ||\n entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\n/** The `col` widths of the body and footer tables (C-101), in pixels. */\nconst colWidths = computed(() =>\n Array.from({ length: columnCount.value }, (_, i) => cellWidths.value[i])\n)\nuseScrollBody({\n enabled: () => props.scrollBody,\n wrappers: () => ({\n head: headWrap.value,\n body: bodyWrap.value,\n foot: footWrap.value\n }),\n headTable: () => tableEl.value,\n bodyTable: () => bodyTableEl.value,\n colWidths: () => colWidths.value,\n rows: () => props.rows\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\n body: splitBody,\n // C-68: the width goes back as `columnResize`, then as the new `columns`.\n emit: payload => {\n emit('columnResize', payload)\n const next = applyWidth(props.columns, payload.field, `${payload.width}px`)\n if (next) {\n emit('update:columns', next, 'resize')\n }\n }\n})\n\n// Automatic widths of the columns without a width (C-100): drawn on the\n// header cells, never emitted.\nconst autoWidth = useAutoWidth({\n enabled: () => props.autoWidth,\n max: () => props.autoWidthMax,\n table: tableEl,\n body: splitBody,\n columns: () => visibleColumns.value,\n rows: () => props.rows,\n query: () => props.query,\n rowsUpdate: () => props.rowsUpdate\n})\n\n// The virtual body (C-83 to C-87) and infinite scroll (C-88 to C-90).\n// Without `virtual` the body draws `bodyRows` as they are; without\n// `infinite` nothing is asked for.\nconst rowWindow = useRowWindow<T>({\n virtual: () => props.virtual,\n table: bodyTable,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded,\n groupBy: () => props.groupBy\n})\n// Keyboard navigation between rows (C-109 to C-111). Off, no listener.\nconst navigation = useRowNavigation<T>({\n rowNavigation: () => props.rowNavigation,\n table: bodyTable,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n hasRowKey: () => props.rowKey !== undefined,\n virtual: rowWindow.enabled,\n scrollToIndex: rowWindow.scrollToIndex,\n reveal: rowWindow.reveal,\n busy: rowWindow.busy,\n onFocus: payload => emit('rowFocus', payload)\n})\n/** The `tbody` listener of the navigation: none while it is off (C-111). */\nconst navigationListeners = () =>\n navigation.enabled() ? { keydown: navigation.onKeyDown } : {}\nconst infinite = useLoadMore({\n infinite: () => props.infinite,\n rowKey: () => props.rowKey,\n rows: () => props.rows,\n query: () => props.query,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n loading: () => props.loading,\n nextPage: () => paginationProps.value.nextPage(),\n table: bodyTable,\n virtual: rowWindow.enabled,\n window: () =>\n rowWindow.ready.value\n ? { end: rowWindow.range.value.end, count: rowWindow.centerCount() }\n : null\n})\nconst loadMoreProps = computed<LoadMoreSlotProps | null>(() =>\n infinite.enabled.value\n ? {\n loadMore: infinite.loadMore,\n canLoadMore: infinite.canLoadMore.value,\n loading: props.loading\n }\n : null\n)\nconst footerCount = computed(() => props.footerRows.length)\n/** More to load in an infinite list: the count is not the rows given (C-86). */\nconst growing = () => infinite.enabled.value && infinite.canLoadMore.value\nconst ariaRowCount = computed(() => {\n if (!rowWindow.enabled()) {\n return undefined\n }\n const total = props.totalRows\n // The group rows of the pages still to load are unknown (C-104).\n if (growing() && (total === null || rowWindow.groupCount() > 0)) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return (\n 1 +\n rows +\n rowWindow.expandedCount() +\n rowWindow.groupCount() +\n footerCount.value\n )\n})\n/** `aria-rowindex` of the first footer row, or `undefined` (C-86). */\nconst footerRowIndex = computed(() =>\n !rowWindow.enabled() || growing()\n ? undefined\n : 2 + props.rows.length + rowWindow.expandedCount() + rowWindow.groupCount()\n)\n\n// The change flash (C-93 to C-95). Off, one watcher of `flash` and nothing\n// else; the body gets `null` and draws what it drew in 3.2.\nconst flashView = useChangeFlash<T>({\n flash: () => props.flash,\n rowsUpdate: () => props.rowsUpdate,\n rows: () => props.rows,\n query: () => props.query,\n loading: () => props.loading,\n fields: () => entries.value.map(entry => entry.column.field),\n rowKey: () => props.rowKey,\n table: bodyTable\n})\n\nconst reorder = useColumnReorder({\n reorderable: () => props.reorderable,\n table: tableEl,\n layout: state.layout,\n columns: () => props.columns\n})\n\nprovideTableContext({\n filters,\n sort,\n layout: state.layout,\n resize,\n reorder,\n selection: rowSelection,\n labels: () => labels.value\n})\n\nconst showPagination = computed(\n () =>\n !!slots.pagination &&\n (props.rows.length > 0 ||\n (props.totalRows ?? 0) > 0 ||\n (props.pagination?.alwaysShow ?? false))\n)\n\n// A computed, so a pending filter draft re-renders the root only when the\n// answer changes, not with every key typed.\nconst canClearFilters = computed(() => filters.canClearAll())\n\nconst toolbarProps = (): ToolbarSlotProps => ({\n canClearFilters: canClearFilters.value,\n clearFilters: () => {\n filters.clearAll()\n },\n search: search.text.value,\n setSearch: search.set,\n applySearch: () => {\n search.apply()\n }\n})\n\n// The slots `table-body` draws: only the ones the consumer gave are passed on,\n// so the body can tell whether a `cell-<field>` or `empty` slot exists.\nconst bodySlotNames = () =>\n Object.keys(rawSlots).filter(\n name =>\n name.startsWith('cell-') ||\n name === 'subtable' ||\n name === 'empty' ||\n name === 'loading' ||\n name === 'load-more' ||\n name === 'group'\n )\n// A string, so the header sees a changed prop only when the set changes;\n// one name per line, since a field name may hold a space.\nconst headerSlotNames = () =>\n Object.keys(rawSlots)\n .filter(\n name =>\n name.startsWith('header-') ||\n name === 'filter-datetime' ||\n name === 'filter-menu'\n )\n .sort()\n .join('\\n')\n// The `cell-<field>` slots the rows call, as one string: the body's cells\n// change only when the set changes (K311-3).\nconst cellSlotNames = () =>\n Object.keys(rawSlots)\n .filter(name => name.startsWith('cell-'))\n .sort()\n .join('\\n')\n\nconst exposed: QueryTableExpose = {\n collapseAll: expansion.collapseAll,\n expandAll: expansion.expandAll,\n focusFilter: field => focusFilterOf(tableEl.value, field),\n flushPendingFilters: () => {\n filters.flushAll()\n },\n scrollToIndex: rowWindow.scrollToIndex,\n loadMore: infinite.loadMore,\n measureColumnWidths: fields =>\n measureColumnWidths(tableEl.value, fields, splitBody())\n}\ndefineExpose(exposed)\n</script>\n\n<template>\n <div\n class=\"qt-datatable\"\n :data-empty=\"!loading && rows.length === 0 ? '' : undefined\"\n :data-loading=\"loading ? '' : undefined\"\n :aria-busy=\"loading ? 'true' : undefined\"\n >\n <slot name=\"toolbar\" v-bind=\"toolbarProps()\" />\n <div\n class=\"qt-table-responsive\"\n :role=\"scrollBody ? 'table' : undefined\"\n :aria-rowcount=\"scrollBody ? ariaRowCount : undefined\"\n >\n <!-- C-101: three tables, so the body scrolls under the header; the\n body and footer columns take the widths of the header cells. -->\n <template v-if=\"scrollBody\">\n <div ref=\"headWrap\" class=\"qt-table-head\">\n <table ref=\"tableEl\" class=\"qt-table\" role=\"presentation\">\n <thead role=\"rowgroup\" @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n roles\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n </table>\n </div>\n <div ref=\"bodyWrap\" class=\"qt-table-body\">\n <table ref=\"bodyTableEl\" class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n roles\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n v-on=\"navigationListeners()\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n </table>\n </div>\n <div v-if=\"footerRows.length > 0\" ref=\"footWrap\" class=\"qt-table-foot\">\n <table class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-footer\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n roles\n />\n </table>\n </div>\n </template>\n <table\n v-else\n ref=\"tableEl\"\n class=\"qt-table\"\n :aria-rowcount=\"ariaRowCount\"\n >\n <thead @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n v-on=\"navigationListeners()\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n <table-footer\n v-if=\"footerRows.length > 0\"\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n />\n </table>\n </div>\n <table-pagination v-if=\"showPagination\" :pagination-props=\"paginationProps\">\n <template #pagination=\"p\">\n <slot name=\"pagination\" v-bind=\"p\" />\n </template>\n </table-pagination>\n </div>\n</template>\n","<script\n setup\n lang=\"ts\"\n generic=\"T extends object, Q extends Query = TableQuery\"\n>\nimport { computed, getCurrentInstance, shallowRef, useSlots } from 'vue'\n\nimport { useRowNavigation } from './body/use-row-navigation'\nimport { applyWidth, sideOf, type PinSide } from './columns/column-layout'\nimport type {\n CellSlotProps,\n HeaderSlotProps,\n LoadMoreSlotProps,\n Query,\n QueryTableExpose,\n TableEmits,\n TableProps,\n TableQuery,\n TableSlots,\n ToolbarSlotProps\n} from './contract'\nimport { resolveLabels } from './core/labels'\nimport { provideTableContext } from './core/table-context'\nimport { focusFilterOf } from './filter/focus-filter'\nimport { useChangeFlash } from './flash/use-change-flash'\nimport { useHeaderContextMenu } from './header/use-header-context-menu'\nimport TableBody from './parts/table-body.vue'\nimport TableFooter from './parts/table-footer.vue'\nimport TableHeader from './parts/table-header.vue'\nimport TablePagination from './parts/table-pagination.vue'\nimport { utilityKey, type Utility } from './pin/pin'\nimport { useHeaderGeometry } from './pin/use-header-geometry'\nimport { useColumnReorder } from './reorder/use-column-reorder'\nimport { measureColumnWidths } from './resize/measure-widths'\nimport { useAutoWidth } from './resize/use-auto-width'\nimport { useColumnResize } from './resize/use-column-resize'\nimport { useScrollBody } from './scroll/use-scroll-body'\nimport { useQueryTable } from './use-query-table'\nimport { useLoadMore } from './virtual/use-load-more'\nimport { useRowWindow } from './virtual/use-row-window'\n\ndefineOptions({ name: 'QueryTable' })\n\nconst props = withDefaults(defineProps<TableProps<T, Q>>(), {\n cursors: null,\n selection: undefined,\n rowPinning: undefined,\n searchDebounce: 300,\n rows: () => [],\n totalRows: null,\n footerRows: () => [],\n loading: false,\n sortable: false,\n filterable: false,\n resizable: false,\n autoWidth: false,\n autoWidthMax: undefined,\n reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n rowExpandable: undefined,\n rowKind: undefined,\n groupBy: undefined,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: false,\n rowNavigation: false,\n scrollBody: false,\n infinite: false,\n flash: false,\n rowsUpdate: undefined\n})\n\nconst emit = defineEmits<TableEmits<T, Q>>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\n// Every piece of state lives in the composable; the component draws it. The\n// table never writes to its props.\nconst state = useQueryTable<T, Q>({\n query: () => props.query,\n columns: () => props.columns,\n rows: () => props.rows,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n sortable: () => props.sortable,\n filterDebounce: () => props.filterDebounce,\n searchDebounce: () => props.searchDebounce,\n selection: () => props.selection,\n rowPinning: () => props.rowPinning,\n rowKey: () => props.rowKey,\n hasSubtable: () => props.hasSubtable,\n rowExpandable: () => props.rowExpandable,\n pageSizeOptions: () => props.pagination?.pageSizeOptions,\n onQueryChange: (query, reason) => emit('update:query', query, reason),\n onSelectionChange: selection => emit('update:selection', selection),\n onColumnsChange: (columns, reason) => emit('update:columns', columns, reason),\n onRowPinningChange: rowPinning => emit('update:rowPinning', rowPinning)\n})\nconst { filters, sort, search, expansion } = state\nconst rowSelection = state.selection\nconst paginationProps = state.pagination\n\nconst labels = computed(() => resolveLabels(props.labels))\n\n// C-28 / C-96: the browser menu is suppressed only for a consumer that listens.\n// The check runs when the event fires: a listener is not a prop, so adding one\n// later does not re-render the table.\nconst instance = getCurrentInstance()\n// A `.once` listener arrives as `onCellContextMenuOnce` / `onHeaderContextMenuOnce`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\nconst hasHeaderContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(\n vnodeProps?.onHeaderContextMenu || vnodeProps?.onHeaderContextMenuOnce\n )\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\n\nconst { onContextMenu: onHeaderContextMenu } = useHeaderContextMenu({\n columns: () => visibleColumns.value,\n indexOf: field => entries.value.find(e => e.column.field === field)?.index,\n listening: () => hasHeaderContextMenuListener(),\n onContextMenu: payload => emit('headerContextMenu', payload)\n})\nconst hasPinned = state.hasPinned\n/** Right panel first, then subtable, then selection (C-22: the first hosts clear-all). */\nconst utilities = computed(() =>\n [\n props.hasRightPanel ? 'right-panel' : null,\n props.hasSubtable ? 'subtable' : null,\n rowSelection.enabled.value ? 'select' : null\n ].filter((name): name is Utility => name !== null)\n)\nconst utilityCount = computed(() => utilities.value.length)\nconst columnCount = computed(() => entries.value.length + utilityCount.value)\n\n/** Utilities are pinned only with a left-pinned column (C-46, C-71). */\nconst utilitySide = (): PinSide => (hasPinned.value ? 'left' : false)\n/** The table of the header: with `scrollBody` the first of three (C-101). */\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\n// With `scrollBody` the body rows have a table of their own, and the three\n// tables a wrapper each; without it the one table holds every part.\nconst bodyTableEl = shallowRef<HTMLTableElement | null>(null)\nconst headWrap = shallowRef<HTMLElement | null>(null)\nconst bodyWrap = shallowRef<HTMLElement | null>(null)\nconst footWrap = shallowRef<HTMLElement | null>(null)\n/** The table of the body rows. */\nconst bodyTable = computed(() => bodyTableEl.value ?? tableEl.value)\n/** With `scrollBody`, the body table to measure apart from the header. */\nconst splitBody = () => (props.scrollBody ? bodyTableEl.value : null)\nconst {\n widths,\n tableWidth,\n offsets,\n columns: cellWidths\n} = useHeaderGeometry({\n table: tableEl,\n cells: () => [\n ...utilities.value.map(utility => ({\n key: utilityKey(utility),\n side: utilitySide()\n })),\n ...entries.value.map(({ column }) => ({\n key: column.field,\n side: sideOf(column)\n }))\n ],\n active: () =>\n props.scrollBody ||\n entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\n/** The `col` widths of the body and footer tables (C-101), in pixels. */\nconst colWidths = computed(() =>\n Array.from({ length: columnCount.value }, (_, i) => cellWidths.value[i])\n)\nuseScrollBody({\n enabled: () => props.scrollBody,\n wrappers: () => ({\n head: headWrap.value,\n body: bodyWrap.value,\n foot: footWrap.value\n }),\n headTable: () => tableEl.value,\n bodyTable: () => bodyTableEl.value,\n colWidths: () => colWidths.value,\n rows: () => props.rows\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\n body: splitBody,\n // C-68: the width goes back as `columnResize`, then as the new `columns`.\n emit: payload => {\n emit('columnResize', payload)\n const next = applyWidth(props.columns, payload.field, `${payload.width}px`)\n if (next) {\n emit('update:columns', next, 'resize')\n }\n }\n})\n\n// Automatic widths of the columns without a width (C-100): drawn on the\n// header cells, never emitted.\nconst autoWidth = useAutoWidth({\n enabled: () => props.autoWidth,\n max: () => props.autoWidthMax,\n table: tableEl,\n body: splitBody,\n columns: () => visibleColumns.value,\n rows: () => props.rows,\n query: () => props.query,\n rowsUpdate: () => props.rowsUpdate\n})\n\n// The virtual body (C-83 to C-87) and infinite scroll (C-88 to C-90).\n// Without `virtual` the body draws `bodyRows` as they are; without\n// `infinite` nothing is asked for.\nconst rowWindow = useRowWindow<T>({\n virtual: () => props.virtual,\n table: bodyTable,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded,\n groupBy: () => props.groupBy\n})\n// Keyboard navigation between rows (C-109 to C-111). Off, no listener.\nconst navigation = useRowNavigation<T>({\n rowNavigation: () => props.rowNavigation,\n table: bodyTable,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n hasRowKey: () => props.rowKey !== undefined,\n virtual: rowWindow.enabled,\n scrollToIndex: rowWindow.scrollToIndex,\n reveal: rowWindow.reveal,\n busy: rowWindow.busy,\n onFocus: payload => emit('rowFocus', payload)\n})\n/** The `tbody` listener of the navigation: none while it is off (C-111). */\nconst navigationListeners = () =>\n navigation.enabled() ? { keydown: navigation.onKeyDown } : {}\nconst infinite = useLoadMore({\n infinite: () => props.infinite,\n rowKey: () => props.rowKey,\n rows: () => props.rows,\n query: () => props.query,\n totalRows: () => props.totalRows,\n cursors: () => props.cursors,\n loading: () => props.loading,\n nextPage: () => paginationProps.value.nextPage(),\n table: bodyTable,\n virtual: rowWindow.enabled,\n window: () =>\n rowWindow.ready.value\n ? { end: rowWindow.range.value.end, count: rowWindow.centerCount() }\n : null\n})\nconst loadMoreProps = computed<LoadMoreSlotProps | null>(() =>\n infinite.enabled.value\n ? {\n loadMore: infinite.loadMore,\n canLoadMore: infinite.canLoadMore.value,\n loading: props.loading\n }\n : null\n)\nconst footerCount = computed(() => props.footerRows.length)\n/** More to load in an infinite list: the count is not the rows given (C-86). */\nconst growing = () => infinite.enabled.value && infinite.canLoadMore.value\nconst ariaRowCount = computed(() => {\n if (!rowWindow.enabled()) {\n return undefined\n }\n const total = props.totalRows\n // The group rows of the pages still to load are unknown (C-104).\n if (growing() && (total === null || rowWindow.groupCount() > 0)) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return (\n 1 +\n rows +\n rowWindow.expandedCount() +\n rowWindow.groupCount() +\n footerCount.value\n )\n})\n/** `aria-rowindex` of the first footer row, or `undefined` (C-86). */\nconst footerRowIndex = computed(() =>\n !rowWindow.enabled() || growing()\n ? undefined\n : 2 + props.rows.length + rowWindow.expandedCount() + rowWindow.groupCount()\n)\n\n// The change flash (C-93 to C-95). Off, one watcher of `flash` and nothing\n// else; the body gets `null` and draws what it drew in 3.2.\nconst flashView = useChangeFlash<T>({\n flash: () => props.flash,\n rowsUpdate: () => props.rowsUpdate,\n rows: () => props.rows,\n query: () => props.query,\n loading: () => props.loading,\n fields: () => entries.value.map(entry => entry.column.field),\n rowKey: () => props.rowKey,\n table: bodyTable\n})\n\nconst reorder = useColumnReorder({\n reorderable: () => props.reorderable,\n table: tableEl,\n layout: state.layout,\n columns: () => props.columns\n})\n\nprovideTableContext({\n filters,\n sort,\n layout: state.layout,\n resize,\n reorder,\n selection: rowSelection,\n labels: () => labels.value\n})\n\nconst showPagination = computed(\n () =>\n !!slots.pagination &&\n (props.rows.length > 0 ||\n (props.totalRows ?? 0) > 0 ||\n (props.pagination?.alwaysShow ?? false))\n)\n\n// A computed, so a pending filter draft re-renders the root only when the\n// answer changes, not with every key typed.\nconst canClearFilters = computed(() => filters.canClearAll())\n\nconst toolbarProps = (): ToolbarSlotProps => ({\n canClearFilters: canClearFilters.value,\n clearFilters: () => {\n filters.clearAll()\n },\n search: search.text.value,\n setSearch: search.set,\n applySearch: () => {\n search.apply()\n }\n})\n\n// The slots `table-body` draws: only the ones the consumer gave are passed on,\n// so the body can tell whether a `cell-<field>` or `empty` slot exists.\nconst bodySlotNames = () =>\n Object.keys(rawSlots).filter(\n name =>\n name.startsWith('cell-') ||\n name === 'subtable' ||\n name === 'empty' ||\n name === 'loading' ||\n name === 'load-more' ||\n name === 'group'\n )\n// A string, so the header sees a changed prop only when the set changes;\n// one name per line, since a field name may hold a space.\nconst headerSlotNames = () =>\n Object.keys(rawSlots)\n .filter(\n name =>\n name.startsWith('header-') ||\n name === 'filter-datetime' ||\n name === 'filter-menu'\n )\n .sort()\n .join('\\n')\n// The `cell-<field>` slots the rows call, as one string: the body's cells\n// change only when the set changes (K311-3).\nconst cellSlotNames = () =>\n Object.keys(rawSlots)\n .filter(name => name.startsWith('cell-'))\n .sort()\n .join('\\n')\n\nconst exposed: QueryTableExpose = {\n collapseAll: expansion.collapseAll,\n expandAll: expansion.expandAll,\n focusFilter: field => focusFilterOf(tableEl.value, field),\n flushPendingFilters: () => {\n filters.flushAll()\n },\n scrollToIndex: rowWindow.scrollToIndex,\n loadMore: infinite.loadMore,\n measureColumnWidths: fields =>\n measureColumnWidths(tableEl.value, fields, splitBody())\n}\ndefineExpose(exposed)\n</script>\n\n<template>\n <div\n class=\"qt-datatable\"\n :data-empty=\"!loading && rows.length === 0 ? '' : undefined\"\n :data-loading=\"loading ? '' : undefined\"\n :aria-busy=\"loading ? 'true' : undefined\"\n >\n <slot name=\"toolbar\" v-bind=\"toolbarProps()\" />\n <div\n class=\"qt-table-responsive\"\n :role=\"scrollBody ? 'table' : undefined\"\n :aria-rowcount=\"scrollBody ? ariaRowCount : undefined\"\n >\n <!-- C-101: three tables, so the body scrolls under the header; the\n body and footer columns take the widths of the header cells. -->\n <template v-if=\"scrollBody\">\n <div ref=\"headWrap\" class=\"qt-table-head\">\n <table ref=\"tableEl\" class=\"qt-table\" role=\"presentation\">\n <thead role=\"rowgroup\" @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n roles\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n </table>\n </div>\n <div ref=\"bodyWrap\" class=\"qt-table-body\">\n <table ref=\"bodyTableEl\" class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n roles\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n v-on=\"navigationListeners()\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n </table>\n </div>\n <div v-if=\"footerRows.length > 0\" ref=\"footWrap\" class=\"qt-table-foot\">\n <table class=\"qt-table\" role=\"presentation\">\n <colgroup>\n <col\n v-for=\"(width, i) in colWidths\"\n :key=\"i\"\n :style=\"\n width === undefined ? undefined : { width: `${width}px` }\n \"\n />\n </colgroup>\n <table-footer\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n roles\n />\n </table>\n </div>\n </template>\n <table\n v-else\n ref=\"tableEl\"\n class=\"qt-table\"\n :aria-rowcount=\"ariaRowCount\"\n >\n <thead @contextmenu=\"onHeaderContextMenu\">\n <table-header\n :columns=\"visibleColumns\"\n :query=\"query\"\n :filterable=\"filterable\"\n :utilities=\"utilities\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :auto-widths=\"autoWidth.widths.value\"\n :slot-names=\"headerSlotNames()\"\n :aria-rowindex=\"rowWindow.enabled() ? 1 : undefined\"\n >\n <!-- Stable slots: the header re-renders only when its props\n change, not with every render of the root (`loading`,\n `rows`). `slot-names` says which ones the consumer gave. -->\n <template #header=\"p\">\n <!-- Names are dynamic (header-<field>); the types only widen here. -->\n <slot\n :name=\"`header-${p.column.field}` as 'header-x'\"\n v-bind=\"p as HeaderSlotProps\"\n />\n </template>\n <template #filter-datetime=\"p\">\n <slot name=\"filter-datetime\" v-bind=\"p\" />\n </template>\n <template #filter-menu=\"p\">\n <slot name=\"filter-menu\" v-bind=\"p\" />\n </template>\n </table-header>\n </thead>\n <table-body\n :rows=\"rows\"\n :body-rows=\"rowWindow.drawn.value\"\n :pin-row=\"state.rowPinning.pin\"\n :loading=\"loading\"\n :entries=\"entries\"\n :slot-names=\"cellSlotNames()\"\n :column-count=\"columnCount\"\n :has-subtable=\"hasSubtable\"\n :has-right-panel=\"hasRightPanel\"\n :has-selection=\"rowSelection.enabled.value\"\n :is-selected=\"rowSelection.isSelected\"\n :toggle-selected=\"rowSelection.toggle\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :key-of=\"expansion.keyOf\"\n :can-expand=\"expansion.canExpand\"\n :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\n :row-kind=\"rowKind\"\n :labels=\"labels\"\n :has-context-menu-listener=\"hasContextMenuListener\"\n :load-more=\"loadMoreProps\"\n :flash=\"flashView\"\n @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\n @focusin=\"rowWindow.onFocusIn\"\n @focusout=\"rowWindow.onFocusOut\"\n v-on=\"navigationListeners()\"\n >\n <template v-for=\"name in bodySlotNames()\" :key=\"name\" #[name]=\"p\">\n <!-- Names are dynamic (cell-<field>); the types only widen here. -->\n <slot :name=\"name as 'cell-x'\" v-bind=\"p as CellSlotProps<T>\" />\n </template>\n </table-body>\n <table-footer\n v-if=\"footerRows.length > 0\"\n :footer-rows=\"footerRows\"\n :entries=\"entries\"\n :utility-count=\"utilityCount\"\n :has-pinned=\"hasPinned\"\n :offsets=\"offsets\"\n :first-row-index=\"footerRowIndex\"\n />\n </table>\n </div>\n <table-pagination v-if=\"showPagination\" :pagination-props=\"paginationProps\">\n <template #pagination=\"p\">\n <slot name=\"pagination\" v-bind=\"p\" />\n </template>\n </table-pagination>\n </div>\n</template>\n","import { parseFilterInput as parse } from '@dolusoft/query-protocol'\n\nimport type { Column, FilterCondition, FilterRule } from '../contract'\n\n/**\n * The rules the table emits when `text` is typed into the filter input of\n * `column` (C-53): the same grammar and the same coercion per column type.\n *\n * - `string`: operator shortcuts (`*a*`, `a*`, `*a`, `!a`, `!*a*`, `a,b`);\n * a segment without an operator uses `condition`.\n * - `number`: one rule with a number value; text that is not a finite number\n * gives `[]`.\n * - `integer`: the same, but only a whole number in the safe range; `2.5`\n * and `9007199254740993` give `[]`.\n * - `bool`: `'true'` or `'false'` gives one rule with a boolean value;\n * anything else gives `[]`.\n * - `date` and `datetime`: one rule with the trimmed text as its value; the\n * text is not validated, as the input already gives an ISO date.\n *\n * `condition` is the one picked in the filter menu; without it the column\n * type's default applies (`Contains` for text, `Equal` otherwise). Empty or\n * blank text, and text that is only operators (`*`, `!`, `!*`), gives `[]`.\n * Invalid input never throws. Pure: no Vue, no DOM; the column is not written.\n * The grammar is the protocol's (`@dolusoft/query-protocol`).\n */\nexport function parseFilterInput(\n text: string,\n column: Column,\n condition: FilterCondition | null = null\n): FilterRule[] {\n return parse(text, column, condition)\n}\n","import QueryTable from './query-table.vue'\n\nexport { QueryTable }\nexport default QueryTable\n\nexport { parseFilterInput } from './filter/parse-filter-input'\nexport {\n useQueryTable,\n type BodyRow,\n type ColumnEntry,\n type QueryTable as QueryTableState,\n type QueryTableExpansion,\n type QueryTableFeatures,\n type QueryTableFilters,\n type QueryTableLayout,\n type QueryTableRowPinning,\n type QueryTableSearch,\n type QueryTableSelection,\n type QueryTableSort,\n type RowKey,\n type UseQueryTableOptions\n} from './use-query-table'\n\nexport type * from './contract'\n"],"mappings":";;;;;;;;;;;AAsCA,IAAMA,cAAY;CAChB;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,IAAM,uBAAO,IAAI,IAAY;CAAC;CAAW;CAAa;CAAQ;AAAK,CAAC;;AAGpE,IAAM,YAAY;;AAElB,IAAM,aAAa;;;;;;;;AAwBnB,IAAa,oBACX,MACG;CACH,MAAM,WAAW,eAA+C;EAC9D,MAAM,QAAQ,EAAE,cAAc;EAC9B,OAAO,UAAU,OAAO,CAAC,IAAI,SAAS;CACxC,CAAC;CACD,MAAM,gBAAgB,SAAS,UAAU;CAEzC,MAAM,aAAa,EAAE,MAAM,OAAO,QAAQ,MAAM;;C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