@dolusoft/query-table 3.4.0 → 3.5.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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-table.js","names":["columnTypeOf","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_useSlots","_openBlock","_createElementBlock","_unref","_Fragment","_renderList","_normalizeStyle","_createElementVNode","_mergeProps","_withModifiers","_createCommentVNode","_renderSlot","_toDisplayString","_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","_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","_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","_useSlots","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_unref","_createVNode","TableHeader","_withCtx","TableBody","_createSlots","_renderList","_createBlock","TableFooter","_createCommentVNode","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/pin/pin.ts","../src/body/use-cell-view.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/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/use-query-table.ts","../src/virtual/use-load-more.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 ShallowRef,\n type VNode\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: ShallowRef<HTMLTableElement | null>\n}\n\n/** What the body draws with: the marks and the binding hook (C-94). */\nexport interface FlashView<T> {\n /** `data-flash` of a data row. */\n row: (row: T, index: number) => FlashPhase | undefined\n /** `data-flash` of a data cell. */\n cell: (row: T, index: number, field: string) => FlashPhase | undefined\n /**\n * `onVnodeBeforeMount` and `onVnodeUpdated` of a data row: writes\n * `--qt-flash-elapsed` on the row and on its cells that were bound after\n * their flash began, or whose flash changed.\n */\n bind: (vnode: VNode) => void\n}\n\ninterface Controller<T> {\n view: FlashView<T>\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>(\n o: ChangeFlashOptions<T>\n): Controller<T> => {\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 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 if (marks.clear()) {\n version.value++\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 version.value++\n }\n }\n\n // The rows at the start are the baseline.\n update()\n\n // ---- drawing (C-94) ------------------------------------------------------\n\n const rowMarksOf = (row: T, index: number) => {\n // Read by the render: a change of the marks draws the body again.\n void version.value\n return keyOf === null ? undefined : marks.get(keyOf(row, index))\n }\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<T> = {\n // The clock is read only for an element that has a mark.\n row: (row, index) => {\n const mark = rowMarksOf(row, index)?.row\n return mark ? live(mark, performance.now())?.phase : undefined\n },\n cell: (row, index, field) => {\n const mark = rowMarksOf(row, index)?.cells?.get(field)\n return mark ? live(mark, performance.now())?.phase : undefined\n },\n bind: vnode => {\n const tr = vnode.el as HTMLTableRowElement | null\n const index = Number(vnode.props?.['data-row-index'])\n const row = o.rows()[index]\n if (!tr || row === undefined || keyOf === null) {\n return\n }\n const rowMarks = marks.get(keyOf(row, index))\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<T> | null> => {\n const view = shallowRef<FlashView<T> | null>(null)\n const instance = getCurrentInstance() as ComponentInternalInstance\n const owner = getCurrentScope() as EffectScope\n let scope: EffectScope | null = null\n let controller: Controller<T> | 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 { 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","import { computed, type Slots } from 'vue'\n\nimport { sideOf } from '../columns/column-layout'\nimport type { CellContextMenuPayload, CellSlotProps, Column } from '../contract'\nimport { columnTypeOf, valueAt } from '../core/column'\nimport { pinAttrs } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\nexport interface CellViewOptions<T extends object> {\n /** The slots the body received: `cell-<field>` is looked up. */\n slots: Slots\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 /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: () => Readonly<Record<string, number>>\n /** Someone listens to `cellContextMenu`; without one the menu is left alone. */\n listening: () => boolean\n onContextMenu: (payload: CellContextMenuPayload<T>) => void\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n}\n\n/**\n * What a body cell shows: its text, its attributes, the props for a\n * `cell-<field>` slot and the context menu event (C-27, C-28, C-30).\n */\nexport const useCellView = <T extends object>(options: CellViewOptions<T>) => {\n /** Text of a cell, whole: the table never cuts it. */\n const cellText = (row: T, 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 // The type of each drawn column, read once per change of the columns\n // instead of once per body cell (C-82).\n const types = computed(\n () =>\n new Map(\n options\n .entries()\n .map(entry => [entry.column.field, columnTypeOf(entry.column)])\n )\n )\n\n const cellAttrs = (entry: ColumnEntry) => ({\n 'data-field': entry.column.field,\n 'data-type': types.value.get(entry.column.field),\n ...pinAttrs(sideOf(entry.column), options.offsets()[entry.column.field])\n })\n\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 const hasCellSlot = (column: Column) =>\n !!options.slots[`cell-${column.field}`]\n\n const slotProps = (\n row: T,\n column: Column,\n rowIndex: number,\n rowPinned: CellSlotProps<T>['rowPinned']\n ): CellSlotProps<T> => ({\n row,\n rowIndex,\n column,\n cellValue: valueAt(row, column.field),\n rowPinned,\n pinRow: position => options.pinRow(row, rowIndex, position)\n })\n\n return { cellText, cellAttrs, hasCellSlot, slotProps, onContextMenu }\n}\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type { DrawnRow, SpacerRow } 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).\n */\n bodyRows: Array<DrawnRow<T> | SpacerRow>\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 /** 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 isExpanded: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\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<T> | null\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\nconst { cellText, cellAttrs, hasCellSlot, slotProps, onContextMenu } =\n useCellView<T>({\n slots: rawSlots,\n rows: () => props.rows,\n entries: () => props.entries,\n offsets: () => props.offsets,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload),\n pinRow: (row, index, position) => props.pinRow(row, index, position)\n })\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71).\nconst utilityAttrs = (utility: string) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\nconst rightPanelAttrs = () => utilityAttrs('right-panel')\nconst expandAttrs = () => utilityAttrs('subtable')\nconst selectAttrs = () => utilityAttrs('select')\n\nconst isSpacer = (item: DrawnRow<T> | SpacerRow): item is SpacerRow =>\n 'spacer' in item\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). The main `tr`\n props are evaluated before cell slots; a consumer slot that writes reactive\n state mid-render can clear TanStack's `expanded` atom before the subtable\n `v-if` runs — chevron flips, detail row never mounts. A computed would\n re-read the cleared atom; this map is filled on first use in the render and\n kept until the next update.\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: DrawnRow<T> | SpacerRow) => {\n if (isSpacer(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 (!isSpacer(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 @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 -->\n <template\n v-for=\"item in bodyRows\"\n :key=\"isSpacer(item) ? item.key : keyOf(item.row, item.index)\"\n >\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td :colspan=\"columnCount\" />\n </tr>\n <tr\n v-else\n :data-row-index=\"item.index\"\n :aria-rowindex=\"item.aria\"\n :data-pinned-row=\"item.pinned || undefined\"\n :data-expanded=\"isRowExpanded(item) ? '' : undefined\"\n :data-selected=\"\n hasSelection && isSelected(item.row, item.index) ? '' : undefined\n \"\n :data-flash=\"flash ? flash.row(item.row, item.index) : undefined\"\n :onVnodeBeforeMount=\"flash ? flash.bind : undefined\"\n :onVnodeUpdated=\"flash ? flash.bind : undefined\"\n >\n <td v-if=\"hasRightPanel\" v-bind=\"rightPanelAttrs()\">\n <button\n type=\"button\"\n class=\"qt-right-panel-button\"\n :aria-label=\"labels.openRightPanel\"\n @click.stop=\"emit('rowRightPanelClick', item.row)\"\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 aria-hidden=\"true\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" />\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSubtable\" v-bind=\"expandAttrs()\">\n <button\n type=\"button\"\n class=\"qt-expand\"\n :aria-expanded=\"isRowExpanded(item)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(item.row, item.index)\"\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 <polyline v-if=\"isRowExpanded(item)\" points=\"6 9 12 15 18 9\" />\n <polyline v-else points=\"9 6 15 12 9 18\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSelection\" v-bind=\"selectAttrs()\">\n <input\n type=\"checkbox\"\n class=\"qt-select-row\"\n :aria-label=\"labels.selectRow\"\n :checked=\"isSelected(item.row, item.index)\"\n @change=\"toggleSelected(item.row, item.index)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td\n v-if=\"hasCellSlot(entry.column)\"\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"\n slotProps(item.row, entry.column, item.index, item.pinned)\n \"\n />\n </td>\n <td\n v-else\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n {{ cellText(item.row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr\n v-if=\"!isSpacer(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr v-if=\"loading && slots.loading\" class=\"qt-loading-row\">\n <td :colspan=\"columnCount\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n >\n <td :colspan=\"columnCount\"><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 >\n <td :colspan=\"columnCount\">\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 { onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type { DrawnRow, SpacerRow } 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).\n */\n bodyRows: Array<DrawnRow<T> | SpacerRow>\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 /** 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 isExpanded: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\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<T> | null\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\nconst { cellText, cellAttrs, hasCellSlot, slotProps, onContextMenu } =\n useCellView<T>({\n slots: rawSlots,\n rows: () => props.rows,\n entries: () => props.entries,\n offsets: () => props.offsets,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload),\n pinRow: (row, index, position) => props.pinRow(row, index, position)\n })\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71).\nconst utilityAttrs = (utility: string) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\nconst rightPanelAttrs = () => utilityAttrs('right-panel')\nconst expandAttrs = () => utilityAttrs('subtable')\nconst selectAttrs = () => utilityAttrs('select')\n\nconst isSpacer = (item: DrawnRow<T> | SpacerRow): item is SpacerRow =>\n 'spacer' in item\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). The main `tr`\n props are evaluated before cell slots; a consumer slot that writes reactive\n state mid-render can clear TanStack's `expanded` atom before the subtable\n `v-if` runs — chevron flips, detail row never mounts. A computed would\n re-read the cleared atom; this map is filled on first use in the render and\n kept until the next update.\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: DrawnRow<T> | SpacerRow) => {\n if (isSpacer(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 (!isSpacer(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 @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 -->\n <template\n v-for=\"item in bodyRows\"\n :key=\"isSpacer(item) ? item.key : keyOf(item.row, item.index)\"\n >\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td :colspan=\"columnCount\" />\n </tr>\n <tr\n v-else\n :data-row-index=\"item.index\"\n :aria-rowindex=\"item.aria\"\n :data-pinned-row=\"item.pinned || undefined\"\n :data-expanded=\"isRowExpanded(item) ? '' : undefined\"\n :data-selected=\"\n hasSelection && isSelected(item.row, item.index) ? '' : undefined\n \"\n :data-flash=\"flash ? flash.row(item.row, item.index) : undefined\"\n :onVnodeBeforeMount=\"flash ? flash.bind : undefined\"\n :onVnodeUpdated=\"flash ? flash.bind : undefined\"\n >\n <td v-if=\"hasRightPanel\" v-bind=\"rightPanelAttrs()\">\n <button\n type=\"button\"\n class=\"qt-right-panel-button\"\n :aria-label=\"labels.openRightPanel\"\n @click.stop=\"emit('rowRightPanelClick', item.row)\"\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 aria-hidden=\"true\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" />\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSubtable\" v-bind=\"expandAttrs()\">\n <button\n type=\"button\"\n class=\"qt-expand\"\n :aria-expanded=\"isRowExpanded(item)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(item.row, item.index)\"\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 <polyline v-if=\"isRowExpanded(item)\" points=\"6 9 12 15 18 9\" />\n <polyline v-else points=\"9 6 15 12 9 18\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSelection\" v-bind=\"selectAttrs()\">\n <input\n type=\"checkbox\"\n class=\"qt-select-row\"\n :aria-label=\"labels.selectRow\"\n :checked=\"isSelected(item.row, item.index)\"\n @change=\"toggleSelected(item.row, item.index)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td\n v-if=\"hasCellSlot(entry.column)\"\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"\n slotProps(item.row, entry.column, item.index, item.pinned)\n \"\n />\n </td>\n <td\n v-else\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n {{ cellText(item.row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr\n v-if=\"!isSpacer(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr v-if=\"loading && slots.loading\" class=\"qt-loading-row\">\n <td :colspan=\"columnCount\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n >\n <td :colspan=\"columnCount\"><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 >\n <td :colspan=\"columnCount\">\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}>()\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\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\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 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 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}>()\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\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\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 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 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","import { onBeforeUnmount, shallowRef } from 'vue'\n\nimport type { Column, ColumnResizePayload } from '../contract'\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 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 */\nconst 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\n/** Width of the content of a cell up to `until` (exclusive), padding and border included. */\nconst contentWidth = (cell: Element, until?: Element | null) => {\n const range = document.createRange()\n range.selectNodeContents(cell)\n if (until) {\n range.setEndBefore(until)\n }\n const style = getComputedStyle(cell)\n return [\n style.paddingLeft,\n style.paddingRight,\n style.borderLeftWidth,\n style.borderRightWidth\n ].reduce(\n (sum, value) => sum + (parseFloat(value) || 0),\n range.getBoundingClientRect().width\n )\n}\n\n/**\n * The widest rendered content of a column: the header label (the part before\n * the filter row and the handle) and the column's cells in this table's own\n * body rows. Only the rows given are measured (C-50).\n */\nconst autofitWidth = (th: HTMLTableCellElement, field: string) => {\n let widest = contentWidth(\n th,\n th.querySelector(':scope > .qt-filter, :scope > .qt-resize-handle')\n )\n for (const cell of th\n .closest('table')\n ?.tBodies[0]?.querySelectorAll(\n `:scope > tr[data-row-index] > td[data-field=\"${CSS.escape(field)}\"]`\n ) ?? []) {\n widest = Math.max(widest, contentWidth(cell))\n }\n return Math.ceil(widest)\n}\n\ninterface Drag {\n column: Column\n pointerId: number\n startX: number\n startWidth: number\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 * 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.\n */\nexport const useColumnResize = (options: ColumnResizeOptions) => {\n const preview = shallowRef<{ field: string; width: number } | 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.width\n : Math.round(options.measuredWidth(column.field) ?? 0)\n\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 const dragged = (current: Drag) =>\n current.startWidth +\n edgeOf(current.column) * (current.lastX - current.startX)\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(current.column, current.startWidth, dragged(current))\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 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 preview.value = {\n field: drag.column.field,\n width: clampWidth(drag.column, dragged(drag))\n }\n }\n })\n } else {\n // pointerup commits; pointercancel and a lost capture cancel.\n end(event.type === 'pointerup')\n }\n }\n\n /** Arrow keys step the width, Enter fits it; both from the rendered width. */\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 from = th.getBoundingClientRect().width\n commit(\n column,\n from,\n sign\n ? Math.round(from) + sign * (event.shiftKey ? 50 : 10)\n : autofitWidth(th, column.field)\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 /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), space-separated. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\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(' ').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) and the pin offset (C-47, C-71), with `data-pinned`.\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` : column.width\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>\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 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 v-else-if=\"!hostsClearAll(utility)\" v-bind=\"utilityAttrs(utility)\" />\n <th v-else scope=\"col\" v-bind=\"utilityAttrs(utility)\">\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 :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 /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), space-separated. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\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(' ').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) and the pin offset (C-47, C-71), with `data-pinned`.\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` : column.width\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>\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 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 v-else-if=\"!hostsClearAll(utility)\" v-bind=\"utilityAttrs(utility)\" />\n <th v-else scope=\"col\" v-bind=\"utilityAttrs(utility)\">\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 :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 /** Some column is pinned on either side (C-46, C-71) or has a resize handle (C-48). */\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) => 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 let observer: ResizeObserver | null = null\n\n const headerCells = (table: HTMLTableElement) =>\n table.querySelectorAll(':scope > thead > tr > *')\n\n const measure = (table: HTMLTableElement) => {\n // Whole pixels: sub-pixel rects from live content / scrollbars would\n // otherwise rewrite `--qt-pin-*` every frame and the sticky columns dance.\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 let left = 0\n headerCells(table).forEach((cell, index) => {\n const drawn = cells[index]\n if (drawn) {\n const width = Math.round(cell.getBoundingClientRect().width)\n next[drawn.key] = width\n if (drawn.side === 'left') {\n nextOffsets[drawn.key] = left\n left += width\n } else if (drawn.side === 'right') {\n rights.push([drawn.key, width])\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 }\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 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 }\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","// 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 /** 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 isExpanded: (row: T, index: number) => boolean\n toggle: (row: T, index: number) => void\n collapseAll: () => void\n /** Opens every row given; 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 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: () => hasSubtable(),\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 isExpanded: (row, index) =>\n hasSubtable() && !!expandedState.value[idOf(row, index)],\n toggle: (row, index) => {\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 state[idOf(row, index)] = true\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 (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 ShallowRef\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: ShallowRef<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","// 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 {\n computed,\n onBeforeUnmount,\n shallowRef,\n watch,\n type ShallowRef\n} from 'vue'\n\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\nexport interface RowWindowOptions<T> {\n virtual: () => boolean | VirtualOptions | undefined\n table: ShallowRef<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}\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.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 /** 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 let measured = new Uint8Array(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\n const rebuild = () => {\n const rows = enabled() ? center() : []\n const height = fixed()\n heights = new Float64Array(rows.length)\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 heights[i] = height\n continue\n }\n const key = o.keyOf(rows[i].row, rows[i].index)\n const known = byKey.get(key)\n if (known === undefined) {\n heights[i] = estimate()\n } else {\n kept.set(key, known)\n heights[i] = known\n measured[i] = 1\n }\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 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 < heights.length; i++) {\n if (!measured[i]) {\n heights[i] = height\n }\n }\n from = 0\n }\n if (!measured[position] || Math.abs(heights[position] - height) > 0.5) {\n heights[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 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 = (top: number, height: number, align: Align) => {\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.\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\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 /** 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 } = pending\n pending = null\n scrollBy(\n alignDelta(tr.getBoundingClientRect().top, itemHeight(tr), align)\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 const drawn = computed<Array<DrawnRow<T> | SpacerRow>>(() => {\n const { all, top } = parts.value\n if (!enabled()) {\n return all\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.\n const at = (q: number): DrawnRow<T> => ({\n ...all[q],\n aria: q + before[q] + 2\n })\n const out: Array<DrawnRow<T> | SpacerRow> = []\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 out.push(at(top + p))\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 out.push(at(top + p))\n }\n }\n }\n }\n for (let q = top + rows.length; q < all.length; q++) {\n out.push(at(q))\n }\n return 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 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(itemsTop(tbody) + offsets[position], heights[position], align)\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 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 { useColumnResize } from './resize/use-column-resize'\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 reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: 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 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)\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\nconst { widths, tableWidth, offsets } = 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 entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\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// 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: tableEl,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded\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: tableEl,\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 if (growing() && total === null) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return 1 + rows + rowWindow.expandedCount() + footerCount.value\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()\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: tableEl\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 )\n// A string, so the header sees a changed prop only when the set changes.\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\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}\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 class=\"qt-table-responsive\">\n <table ref=\"tableEl\" class=\"qt-table\" :aria-rowcount=\"ariaRowCount\">\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 :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 :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 :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\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 { useColumnResize } from './resize/use-column-resize'\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 reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: 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 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)\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\nconst { widths, tableWidth, offsets } = 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 entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\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// 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: tableEl,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded\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: tableEl,\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 if (growing() && total === null) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return 1 + rows + rowWindow.expandedCount() + footerCount.value\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()\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: tableEl\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 )\n// A string, so the header sees a changed prop only when the set changes.\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\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}\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 class=\"qt-table-responsive\">\n <table ref=\"tableEl\" class=\"qt-table\" :aria-rowcount=\"ariaRowCount\">\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 :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 :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 :is-expanded=\"expansion.isExpanded\"\n :toggle=\"expansion.toggle\"\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; `2.5` gives `[]`.\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;EA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,IAArB,SAAI;;OAAkC;OAErD,IAAAH,SAF6D,MAAC,CAE9DP,WAAgE,KAAA,QAAnD,MAAIC,eAAAC,mBAAsB,CAAC,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAIpC,QAAA,WAAW,SAAM,KADzBJ,UAAA,GAAAa,YAQEC,sBAAA;;MANC,eAAa,QAAA;MACb,SAASR,MAAA,OAAA;MACT,iBAAe,aAAA;MACf,cAAYA,MAAA,SAAA;MACZ,SAASA,MAAA,OAAA;MACT,mBAAiB,eAAA;;;;;;;;;;IAIA,eAAA,SAAxBN,UAAA,GAAAa,YAImBG,0BAAA;;KAJsB,oBAAkBV,MAAA,eAAA;;KAC9C,YAAUG,SAAE,MAAC,CACtBP,WAAqC,KAAA,QAAA,cAAAC,eAAAC,mBAAL,CAAC,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEnXzC,SAAgB,iBACd,MACA,QACA,YAAoC,MACtB;CACd,OAAOc,mBAAM,MAAM,QAAQ,SAAS;AACtC;;;AC3BA,IAAA,cAAeC"}
|
|
1
|
+
{"version":3,"file":"query-table.js","names":["columnTypeOf","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_useSlots","_openBlock","_createElementBlock","_unref","_Fragment","_renderList","_normalizeStyle","_createElementVNode","_mergeProps","_withModifiers","_createCommentVNode","_renderSlot","_toDisplayString","_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","_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","_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","_useSlots","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_unref","_createVNode","TableHeader","_withCtx","TableBody","_createSlots","_renderList","_createBlock","TableFooter","_createCommentVNode","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/pin/pin.ts","../src/body/use-cell-view.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/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/use-query-table.ts","../src/virtual/use-load-more.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 ShallowRef,\n type VNode\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: ShallowRef<HTMLTableElement | null>\n}\n\n/** What the body draws with: the marks and the binding hook (C-94). */\nexport interface FlashView<T> {\n /** `data-flash` of a data row. */\n row: (row: T, index: number) => FlashPhase | undefined\n /** `data-flash` of a data cell. */\n cell: (row: T, index: number, field: string) => FlashPhase | undefined\n /**\n * `onVnodeBeforeMount` and `onVnodeUpdated` of a data row: writes\n * `--qt-flash-elapsed` on the row and on its cells that were bound after\n * their flash began, or whose flash changed.\n */\n bind: (vnode: VNode) => void\n}\n\ninterface Controller<T> {\n view: FlashView<T>\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>(\n o: ChangeFlashOptions<T>\n): Controller<T> => {\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 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 if (marks.clear()) {\n version.value++\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 version.value++\n }\n }\n\n // The rows at the start are the baseline.\n update()\n\n // ---- drawing (C-94) ------------------------------------------------------\n\n const rowMarksOf = (row: T, index: number) => {\n // Read by the render: a change of the marks draws the body again.\n void version.value\n return keyOf === null ? undefined : marks.get(keyOf(row, index))\n }\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<T> = {\n // The clock is read only for an element that has a mark.\n row: (row, index) => {\n const mark = rowMarksOf(row, index)?.row\n return mark ? live(mark, performance.now())?.phase : undefined\n },\n cell: (row, index, field) => {\n const mark = rowMarksOf(row, index)?.cells?.get(field)\n return mark ? live(mark, performance.now())?.phase : undefined\n },\n bind: vnode => {\n const tr = vnode.el as HTMLTableRowElement | null\n const index = Number(vnode.props?.['data-row-index'])\n const row = o.rows()[index]\n if (!tr || row === undefined || keyOf === null) {\n return\n }\n const rowMarks = marks.get(keyOf(row, index))\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<T> | null> => {\n const view = shallowRef<FlashView<T> | null>(null)\n const instance = getCurrentInstance() as ComponentInternalInstance\n const owner = getCurrentScope() as EffectScope\n let scope: EffectScope | null = null\n let controller: Controller<T> | 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 { 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","import { computed, type Slots } from 'vue'\n\nimport { sideOf } from '../columns/column-layout'\nimport type { CellContextMenuPayload, CellSlotProps, Column } from '../contract'\nimport { columnTypeOf, valueAt } from '../core/column'\nimport { pinAttrs } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\nexport interface CellViewOptions<T extends object> {\n /** The slots the body received: `cell-<field>` is looked up. */\n slots: Slots\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 /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */\n offsets: () => Readonly<Record<string, number>>\n /** Someone listens to `cellContextMenu`; without one the menu is left alone. */\n listening: () => boolean\n onContextMenu: (payload: CellContextMenuPayload<T>) => void\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n}\n\n/**\n * What a body cell shows: its text, its attributes, the props for a\n * `cell-<field>` slot and the context menu event (C-27, C-28, C-30).\n */\nexport const useCellView = <T extends object>(options: CellViewOptions<T>) => {\n /** Text of a cell, whole: the table never cuts it. */\n const cellText = (row: T, 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 // The type of each drawn column, read once per change of the columns\n // instead of once per body cell (C-82).\n const types = computed(\n () =>\n new Map(\n options\n .entries()\n .map(entry => [entry.column.field, columnTypeOf(entry.column)])\n )\n )\n\n const cellAttrs = (entry: ColumnEntry) => ({\n 'data-field': entry.column.field,\n 'data-type': types.value.get(entry.column.field),\n ...pinAttrs(sideOf(entry.column), options.offsets()[entry.column.field])\n })\n\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 const hasCellSlot = (column: Column) =>\n !!options.slots[`cell-${column.field}`]\n\n const slotProps = (\n row: T,\n column: Column,\n rowIndex: number,\n rowPinned: CellSlotProps<T>['rowPinned']\n ): CellSlotProps<T> => ({\n row,\n rowIndex,\n column,\n cellValue: valueAt(row, column.field),\n rowPinned,\n pinRow: position => options.pinRow(row, rowIndex, position)\n })\n\n return { cellText, cellAttrs, hasCellSlot, slotProps, onContextMenu }\n}\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type { DrawnRow, SpacerRow } 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).\n */\n bodyRows: Array<DrawnRow<T> | SpacerRow>\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 /** 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<T> | null\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\nconst { cellText, cellAttrs, hasCellSlot, slotProps, onContextMenu } =\n useCellView<T>({\n slots: rawSlots,\n rows: () => props.rows,\n entries: () => props.entries,\n offsets: () => props.offsets,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload),\n pinRow: (row, index, position) => props.pinRow(row, index, position)\n })\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71).\nconst utilityAttrs = (utility: string) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\nconst rightPanelAttrs = () => utilityAttrs('right-panel')\nconst expandAttrs = () => utilityAttrs('subtable')\nconst selectAttrs = () => utilityAttrs('select')\n\nconst isSpacer = (item: DrawnRow<T> | SpacerRow): item is SpacerRow =>\n 'spacer' in item\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). The main `tr`\n props are evaluated before cell slots; a consumer slot that writes reactive\n state mid-render can clear TanStack's `expanded` atom before the subtable\n `v-if` runs — chevron flips, detail row never mounts. A computed would\n re-read the cleared atom; this map is filled on first use in the render and\n kept until the next update.\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: DrawnRow<T> | SpacerRow) => {\n if (isSpacer(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 (!isSpacer(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 @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 -->\n <template\n v-for=\"item in bodyRows\"\n :key=\"isSpacer(item) ? item.key : keyOf(item.row, item.index)\"\n >\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td :colspan=\"columnCount\" />\n </tr>\n <tr\n v-else\n :data-row-index=\"item.index\"\n :aria-rowindex=\"item.aria\"\n :data-pinned-row=\"item.pinned || undefined\"\n :data-row-kind=\"kindOf(item)\"\n :data-expanded=\"isRowExpanded(item) ? '' : undefined\"\n :data-selected=\"\n hasSelection && isSelected(item.row, item.index) ? '' : undefined\n \"\n :data-flash=\"flash ? flash.row(item.row, item.index) : undefined\"\n :onVnodeBeforeMount=\"flash ? flash.bind : undefined\"\n :onVnodeUpdated=\"flash ? flash.bind : undefined\"\n >\n <td v-if=\"hasRightPanel\" v-bind=\"rightPanelAttrs()\">\n <button\n type=\"button\"\n class=\"qt-right-panel-button\"\n :aria-label=\"labels.openRightPanel\"\n @click.stop=\"emit('rowRightPanelClick', item.row)\"\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 aria-hidden=\"true\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" />\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSubtable\" v-bind=\"expandAttrs()\">\n <button\n v-if=\"canExpand(item.row, item.index)\"\n type=\"button\"\n class=\"qt-expand\"\n :aria-expanded=\"isRowExpanded(item)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(item.row, item.index)\"\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 <polyline v-if=\"isRowExpanded(item)\" points=\"6 9 12 15 18 9\" />\n <polyline v-else points=\"9 6 15 12 9 18\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSelection\" v-bind=\"selectAttrs()\">\n <input\n type=\"checkbox\"\n class=\"qt-select-row\"\n :aria-label=\"labels.selectRow\"\n :checked=\"isSelected(item.row, item.index)\"\n @change=\"toggleSelected(item.row, item.index)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td\n v-if=\"hasCellSlot(entry.column)\"\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"\n slotProps(item.row, entry.column, item.index, item.pinned)\n \"\n />\n </td>\n <td\n v-else\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n {{ cellText(item.row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr\n v-if=\"!isSpacer(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr v-if=\"loading && slots.loading\" class=\"qt-loading-row\">\n <td :colspan=\"columnCount\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n >\n <td :colspan=\"columnCount\"><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 >\n <td :colspan=\"columnCount\">\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 { onBeforeUpdate, useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n LoadMoreSlotProps,\n TableLabels,\n TableSlots\n} from '../contract'\nimport type { FlashView } from '../flash/use-change-flash'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\nimport type { DrawnRow, SpacerRow } 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).\n */\n bodyRows: Array<DrawnRow<T> | SpacerRow>\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 /** 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<T> | null\n}>()\n\nconst emit = defineEmits<{\n rowRightPanelClick: [row: T]\n cellContextMenu: [payload: CellContextMenuPayload<T>]\n}>()\n\nconst slots = defineSlots<TableSlots<T>>()\nconst rawSlots = useSlots()\n\nconst { cellText, cellAttrs, hasCellSlot, slotProps, onContextMenu } =\n useCellView<T>({\n slots: rawSlots,\n rows: () => props.rows,\n entries: () => props.entries,\n offsets: () => props.offsets,\n listening: () => props.hasContextMenuListener(),\n onContextMenu: payload => emit('cellContextMenu', payload),\n pinRow: (row, index, position) => props.pinRow(row, index, position)\n })\n\n// Utilities are pinned only with a left-pinned column (C-46, C-71).\nconst utilityAttrs = (utility: string) =>\n pinAttrs(props.hasPinned ? 'left' : false, props.offsets[utilityKey(utility)])\nconst rightPanelAttrs = () => utilityAttrs('right-panel')\nconst expandAttrs = () => utilityAttrs('subtable')\nconst selectAttrs = () => utilityAttrs('select')\n\nconst isSpacer = (item: DrawnRow<T> | SpacerRow): item is SpacerRow =>\n 'spacer' in item\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). The main `tr`\n props are evaluated before cell slots; a consumer slot that writes reactive\n state mid-render can clear TanStack's `expanded` atom before the subtable\n `v-if` runs — chevron flips, detail row never mounts. A computed would\n re-read the cleared atom; this map is filled on first use in the render and\n kept until the next update.\n*/\nlet expandedSnapshot: Map<string, boolean> | null = null\nonBeforeUpdate(() => {\n expandedSnapshot = null\n})\nconst isRowExpanded = (item: DrawnRow<T> | SpacerRow) => {\n if (isSpacer(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 (!isSpacer(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 @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 -->\n <template\n v-for=\"item in bodyRows\"\n :key=\"isSpacer(item) ? item.key : keyOf(item.row, item.index)\"\n >\n <tr\n v-if=\"isSpacer(item)\"\n class=\"qt-virtual-spacer\"\n aria-hidden=\"true\"\n :style=\"{ height: `${item.spacer}px` }\"\n >\n <td :colspan=\"columnCount\" />\n </tr>\n <tr\n v-else\n :data-row-index=\"item.index\"\n :aria-rowindex=\"item.aria\"\n :data-pinned-row=\"item.pinned || undefined\"\n :data-row-kind=\"kindOf(item)\"\n :data-expanded=\"isRowExpanded(item) ? '' : undefined\"\n :data-selected=\"\n hasSelection && isSelected(item.row, item.index) ? '' : undefined\n \"\n :data-flash=\"flash ? flash.row(item.row, item.index) : undefined\"\n :onVnodeBeforeMount=\"flash ? flash.bind : undefined\"\n :onVnodeUpdated=\"flash ? flash.bind : undefined\"\n >\n <td v-if=\"hasRightPanel\" v-bind=\"rightPanelAttrs()\">\n <button\n type=\"button\"\n class=\"qt-right-panel-button\"\n :aria-label=\"labels.openRightPanel\"\n @click.stop=\"emit('rowRightPanelClick', item.row)\"\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 aria-hidden=\"true\"\n >\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" />\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSubtable\" v-bind=\"expandAttrs()\">\n <button\n v-if=\"canExpand(item.row, item.index)\"\n type=\"button\"\n class=\"qt-expand\"\n :aria-expanded=\"isRowExpanded(item)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(item.row, item.index)\"\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 <polyline v-if=\"isRowExpanded(item)\" points=\"6 9 12 15 18 9\" />\n <polyline v-else points=\"9 6 15 12 9 18\" />\n </svg>\n </button>\n </td>\n <td v-if=\"hasSelection\" v-bind=\"selectAttrs()\">\n <input\n type=\"checkbox\"\n class=\"qt-select-row\"\n :aria-label=\"labels.selectRow\"\n :checked=\"isSelected(item.row, item.index)\"\n @change=\"toggleSelected(item.row, item.index)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td\n v-if=\"hasCellSlot(entry.column)\"\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"\n slotProps(item.row, entry.column, item.index, item.pinned)\n \"\n />\n </td>\n <td\n v-else\n v-bind=\"cellAttrs(entry)\"\n :data-flash=\"\n flash\n ? flash.cell(item.row, item.index, entry.column.field)\n : undefined\n \"\n >\n {{ cellText(item.row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr\n v-if=\"!isSpacer(item) && isRowExpanded(item)\"\n class=\"qt-subtable-row\"\n :aria-rowindex=\"nextIndex(item.aria)\"\n :data-pinned-row=\"item.pinned || undefined\"\n >\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"item.row\" :row-index=\"item.index\" />\n </td>\n </tr>\n </template>\n <tr v-if=\"loading && slots.loading\" class=\"qt-loading-row\">\n <td :colspan=\"columnCount\"><slot name=\"loading\" /></td>\n </tr>\n <tr\n v-else-if=\"!loading && rows.length === 0 && slots.empty\"\n class=\"qt-empty-row\"\n >\n <td :colspan=\"columnCount\"><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 >\n <td :colspan=\"columnCount\">\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}>()\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\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\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 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 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}>()\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\">\n <tr\n v-for=\"(footerRow, i) in footerRows\"\n :key=\"i\"\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 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 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","import { onBeforeUnmount, shallowRef } from 'vue'\n\nimport type { Column, ColumnResizePayload } from '../contract'\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 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 */\nconst 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\n/** Width of the content of a cell up to `until` (exclusive), padding and border included. */\nconst contentWidth = (cell: Element, until?: Element | null) => {\n const range = document.createRange()\n range.selectNodeContents(cell)\n if (until) {\n range.setEndBefore(until)\n }\n const style = getComputedStyle(cell)\n return [\n style.paddingLeft,\n style.paddingRight,\n style.borderLeftWidth,\n style.borderRightWidth\n ].reduce(\n (sum, value) => sum + (parseFloat(value) || 0),\n range.getBoundingClientRect().width\n )\n}\n\n/**\n * The widest rendered content of a column: the header label (the part before\n * the filter row and the handle) and the column's cells in this table's own\n * body rows. Only the rows given are measured (C-50).\n */\nconst autofitWidth = (th: HTMLTableCellElement, field: string) => {\n let widest = contentWidth(\n th,\n th.querySelector(':scope > .qt-filter, :scope > .qt-resize-handle')\n )\n for (const cell of th\n .closest('table')\n ?.tBodies[0]?.querySelectorAll(\n `:scope > tr[data-row-index] > td[data-field=\"${CSS.escape(field)}\"]`\n ) ?? []) {\n widest = Math.max(widest, contentWidth(cell))\n }\n return Math.ceil(widest)\n}\n\ninterface Drag {\n column: Column\n pointerId: number\n startX: number\n startWidth: number\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 * 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.\n */\nexport const useColumnResize = (options: ColumnResizeOptions) => {\n const preview = shallowRef<{ field: string; width: number } | 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.width\n : Math.round(options.measuredWidth(column.field) ?? 0)\n\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 const dragged = (current: Drag) =>\n current.startWidth +\n edgeOf(current.column) * (current.lastX - current.startX)\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(current.column, current.startWidth, dragged(current))\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 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 preview.value = {\n field: drag.column.field,\n width: clampWidth(drag.column, dragged(drag))\n }\n }\n })\n } else {\n // pointerup commits; pointercancel and a lost capture cancel.\n end(event.type === 'pointerup')\n }\n }\n\n /** Arrow keys step the width, Enter fits it; both from the rendered width. */\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 from = th.getBoundingClientRect().width\n commit(\n column,\n from,\n sign\n ? Math.round(from) + sign * (event.shiftKey ? 50 : 10)\n : autofitWidth(th, column.field)\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 /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), space-separated. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\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(' ').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) and the pin offset (C-47, C-71), with `data-pinned`.\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` : column.width\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>\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 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 v-else-if=\"!hostsClearAll(utility)\" v-bind=\"utilityAttrs(utility)\" />\n <th v-else scope=\"col\" v-bind=\"utilityAttrs(utility)\">\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 :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 /**\n * The header slots the consumer gave (`header-<field>`, `filter-datetime`,\n * `filter-menu`), space-separated. The slots below are always passed so\n * that they stay stable; this says which ones to draw.\n */\n slotNames: string\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(' ').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) and the pin offset (C-47, C-71), with `data-pinned`.\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` : column.width\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>\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 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 v-else-if=\"!hostsClearAll(utility)\" v-bind=\"utilityAttrs(utility)\" />\n <th v-else scope=\"col\" v-bind=\"utilityAttrs(utility)\">\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 :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 /** Some column is pinned on either side (C-46, C-71) or has a resize handle (C-48). */\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) => 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 let observer: ResizeObserver | null = null\n\n const headerCells = (table: HTMLTableElement) =>\n table.querySelectorAll(':scope > thead > tr > *')\n\n const measure = (table: HTMLTableElement) => {\n // Whole pixels: sub-pixel rects from live content / scrollbars would\n // otherwise rewrite `--qt-pin-*` every frame and the sticky columns dance.\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 let left = 0\n headerCells(table).forEach((cell, index) => {\n const drawn = cells[index]\n if (drawn) {\n const width = Math.round(cell.getBoundingClientRect().width)\n next[drawn.key] = width\n if (drawn.side === 'left') {\n nextOffsets[drawn.key] = left\n left += width\n } else if (drawn.side === 'right') {\n rights.push([drawn.key, width])\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 }\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 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 }\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","// 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 ShallowRef\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: ShallowRef<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","// 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 {\n computed,\n onBeforeUnmount,\n shallowRef,\n watch,\n type ShallowRef\n} from 'vue'\n\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\nexport interface RowWindowOptions<T> {\n virtual: () => boolean | VirtualOptions | undefined\n table: ShallowRef<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}\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.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 /** 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 let measured = new Uint8Array(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\n const rebuild = () => {\n const rows = enabled() ? center() : []\n const height = fixed()\n heights = new Float64Array(rows.length)\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 heights[i] = height\n continue\n }\n const key = o.keyOf(rows[i].row, rows[i].index)\n const known = byKey.get(key)\n if (known === undefined) {\n heights[i] = estimate()\n } else {\n kept.set(key, known)\n heights[i] = known\n measured[i] = 1\n }\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 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 < heights.length; i++) {\n if (!measured[i]) {\n heights[i] = height\n }\n }\n from = 0\n }\n if (!measured[position] || Math.abs(heights[position] - height) > 0.5) {\n heights[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 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 = (top: number, height: number, align: Align) => {\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.\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\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 /** 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 } = pending\n pending = null\n scrollBy(\n alignDelta(tr.getBoundingClientRect().top, itemHeight(tr), align)\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 const drawn = computed<Array<DrawnRow<T> | SpacerRow>>(() => {\n const { all, top } = parts.value\n if (!enabled()) {\n return all\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.\n const at = (q: number): DrawnRow<T> => ({\n ...all[q],\n aria: q + before[q] + 2\n })\n const out: Array<DrawnRow<T> | SpacerRow> = []\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 out.push(at(top + p))\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 out.push(at(top + p))\n }\n }\n }\n }\n for (let q = top + rows.length; q < all.length; q++) {\n out.push(at(q))\n }\n return 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 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(itemsTop(tbody) + offsets[position], heights[position], align)\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 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 { useColumnResize } from './resize/use-column-resize'\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 reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n rowExpandable: undefined,\n rowKind: undefined,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: 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)\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\nconst { widths, tableWidth, offsets } = 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 entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\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// 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: tableEl,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded\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: tableEl,\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 if (growing() && total === null) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return 1 + rows + rowWindow.expandedCount() + footerCount.value\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()\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: tableEl\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 )\n// A string, so the header sees a changed prop only when the set changes.\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\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}\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 class=\"qt-table-responsive\">\n <table ref=\"tableEl\" class=\"qt-table\" :aria-rowcount=\"ariaRowCount\">\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 :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 :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 { useColumnResize } from './resize/use-column-resize'\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 reorderable: false,\n filterDebounce: 100,\n hasSubtable: false,\n rowExpandable: undefined,\n rowKind: undefined,\n hasRightPanel: false,\n rowKey: undefined,\n labels: undefined,\n virtual: 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)\nconst tableEl = shallowRef<HTMLTableElement | null>(null)\nconst { widths, tableWidth, offsets } = 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 entries.value.some(entry => sideOf(entry.column) !== false) ||\n (props.resizable &&\n entries.value.some(entry => entry.column.resizable !== false))\n})\nconst resize = useColumnResize({\n resizable: () => props.resizable,\n measuredWidth: field => widths.value[field],\n tableWidth: () => tableWidth.value,\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// 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: tableEl,\n bodyRows: () => state.rowPinning.rows.value,\n keyOf: expansion.keyOf,\n isExpanded: expansion.isExpanded\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: tableEl,\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 if (growing() && total === null) {\n return -1\n }\n const rows = growing() && total !== null ? total : props.rows.length\n return 1 + rows + rowWindow.expandedCount() + footerCount.value\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()\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: tableEl\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 )\n// A string, so the header sees a changed prop only when the set changes.\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\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}\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 class=\"qt-table-responsive\">\n <table ref=\"tableEl\" class=\"qt-table\" :aria-rowcount=\"ariaRowCount\">\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 :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 :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; `2.5` gives `[]`.\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,CAAC,OAAO,OAAO,MAAM,CAAC,CAAC;CACrE,MAAM,yBAAS,IAAI,IAAY;CAC/B,MAAM,OAAiB,CAAC;CACxB,KAAK,MAAM,SAAS,OAAO;EACzB,MAAM,SAAS,QAAQ,IAAI,KAAK;EAChC,IAAI,UAAU,CAAC,OAAO,IAAI,KAAK,GAAG;GAChC,OAAO,IAAI,KAAK;GAChB,KAAK,KAAK,MAAM;EAClB;CACF;CACA,KAAK,KAAK,GAAG,QAAQ,QAAO,WAAU,CAAC,OAAO,IAAI,OAAO,KAAK,CAAC,CAAC;CAChE,OAAO,KAAK,OAAO,QAAQ,UAAU,WAAW,QAAQ,MAAM,IAAI,OAAO;AAC3E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