@dolusoft/query-table 3.0.1 → 3.1.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/local.js +88 -0
- package/dist/local.js.map +1 -0
- package/dist/query-table.js +525 -82
- package/dist/query-table.js.map +1 -1
- package/dist/types/body/use-cell-view.d.ts +4 -2
- package/dist/types/columns/column-layout.d.ts +20 -0
- package/dist/types/contract.d.ts +85 -6
- package/dist/types/core/table-context.d.ts +10 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/local/index.d.ts +2 -0
- package/dist/types/local/use-local-query.d.ts +24 -0
- package/dist/types/parts/reorder-handle.vue.d.ts +7 -0
- package/dist/types/parts/table-body.vue.d.ts +7 -3
- package/dist/types/parts/table-footer.vue.d.ts +2 -2
- package/dist/types/parts/table-header.vue.d.ts +3 -3
- package/dist/types/pin/pin.d.ts +5 -3
- package/dist/types/pin/use-header-geometry.d.ts +8 -6
- package/dist/types/query-table.vue.d.ts +3 -1
- package/dist/types/reorder/use-column-reorder.d.ts +42 -0
- package/dist/types/use-query-table.d.ts +55 -3
- package/package.json +7 -3
package/dist/query-table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-table.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_useSlots","_openBlock","_createElementBlock","_unref","_Fragment","_renderList","_createElementVNode","_mergeProps","_withModifiers","_createCommentVNode","_renderSlot","_toDisplayString","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_unref","_createCommentVNode","_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","_sfc_main","$emit","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_openBlock","_createElementBlock","_createTextVNode","_toDisplayString","_createElementVNode","_sfc_main","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_createElementVNode","_unref","_withModifiers","_renderSlot","_createBlock","SortButton","_toDisplayString","FilterCell","columnTypeOf","_createSlots","_withCtx","_createCommentVNode","ResizeHandle","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_sfc_main","_useSlots","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_createVNode","TableHeader","_unref","_withCtx","TableBody","_createSlots","_renderList","_createBlock","TableFooter","_createCommentVNode","TablePagination","_sfc_main","parse","QueryTable"],"sources":["../src/core/labels.ts","../src/core/table-context.ts","../src/filter/focus-filter.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/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/use-query-table.ts","../src/query-table.vue","../src/query-table.vue","../src/filter/parse-filter-input.ts","../src/index.ts"],"sourcesContent":["import 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 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 { ColumnResize } from '../resize/use-column-resize'\nimport type {\n QueryTableFilters,\n QueryTableSelection,\n QueryTableSort\n} from '../use-query-table'\n\n/**\n * What the header parts call: the filter inputs and the sort gate of the\n * composable, the resize actions and the labels. Only actions and getters\n * travel here; data (`columns`, `query`) comes down as props.\n */\nexport interface TableContext {\n filters: QueryTableFilters\n sort: QueryTableSort\n resize: ColumnResize\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","// 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","/**\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): `data-pinned` and, once measured, the\n * `--qt-pin-left` 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 pinned: boolean,\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 (pinned && offset !== undefined) {\n style['--qt-pin-left'] = `${offset}px`\n }\n return {\n 'data-pinned': pinned ? '' : undefined,\n style: width || style['--qt-pin-left'] ? style : undefined\n }\n}\n","import type { Slots } from 'vue'\n\nimport type { CellContextMenuPayload, CellSlotProps, Column } from '../contract'\nimport { 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` of each pinned cell, by key (C-47). */\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}\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 const cellAttrs = (entry: ColumnEntry) => ({\n 'data-field': entry.column.field,\n ...pinAttrs(\n entry.column.pinned === 'left',\n options.offsets()[entry.column.field]\n )\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 ): CellSlotProps<T> => ({\n row,\n rowIndex,\n column,\n cellValue: valueAt(row, column.field)\n })\n\n return { cellText, cellAttrs, hasCellSlot, slotProps, onContextMenu }\n}\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\nconst props = defineProps<{\n rows: T[]\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 /** Pinned cells, utilities included, get `data-pinned` (C-47). */\n hasPinned: boolean\n /** `--qt-pin-left` of each pinned cell, by key. */\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}>()\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 })\n\nconst rightPanelAttrs = () =>\n pinAttrs(props.hasPinned, props.offsets[utilityKey('right-panel')])\nconst expandAttrs = () =>\n pinAttrs(props.hasPinned, props.offsets[utilityKey('subtable')])\nconst selectAttrs = () =>\n pinAttrs(props.hasPinned, props.offsets[utilityKey('select')])\n</script>\n\n<template>\n <tbody @contextmenu=\"onContextMenu\">\n <template v-for=\"(row, i) in rows\" :key=\"keyOf(row, i)\">\n <tr\n :data-row-index=\"i\"\n :data-expanded=\"isExpanded(row, i) ? '' : undefined\"\n :data-selected=\"hasSelection && isSelected(row, i) ? '' : 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', 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=\"isExpanded(row, i)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(row, i)\"\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=\"isExpanded(row, i)\" 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(row, i)\"\n @change=\"toggleSelected(row, i)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td v-if=\"hasCellSlot(entry.column)\" v-bind=\"cellAttrs(entry)\">\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"slotProps(row, entry.column, i)\"\n />\n </td>\n <td v-else v-bind=\"cellAttrs(entry)\">\n {{ cellText(row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr v-if=\"isExpanded(row, i)\" class=\"qt-subtable-row\">\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"row\" :row-index=\"i\" />\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 </tbody>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { ColumnEntry } from '../use-query-table'\n\nconst props = defineProps<{\n rows: T[]\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 /** Pinned cells, utilities included, get `data-pinned` (C-47). */\n hasPinned: boolean\n /** `--qt-pin-left` of each pinned cell, by key. */\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}>()\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 })\n\nconst rightPanelAttrs = () =>\n pinAttrs(props.hasPinned, props.offsets[utilityKey('right-panel')])\nconst expandAttrs = () =>\n pinAttrs(props.hasPinned, props.offsets[utilityKey('subtable')])\nconst selectAttrs = () =>\n pinAttrs(props.hasPinned, props.offsets[utilityKey('select')])\n</script>\n\n<template>\n <tbody @contextmenu=\"onContextMenu\">\n <template v-for=\"(row, i) in rows\" :key=\"keyOf(row, i)\">\n <tr\n :data-row-index=\"i\"\n :data-expanded=\"isExpanded(row, i) ? '' : undefined\"\n :data-selected=\"hasSelection && isSelected(row, i) ? '' : 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', 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=\"isExpanded(row, i)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(row, i)\"\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=\"isExpanded(row, i)\" 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(row, i)\"\n @change=\"toggleSelected(row, i)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td v-if=\"hasCellSlot(entry.column)\" v-bind=\"cellAttrs(entry)\">\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"slotProps(row, entry.column, i)\"\n />\n </td>\n <td v-else v-bind=\"cellAttrs(entry)\">\n {{ cellText(row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr v-if=\"isExpanded(row, i)\" class=\"qt-subtable-row\">\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"row\" :row-index=\"i\" />\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 </tbody>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column, FooterRow } from '../contract'\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 /** Pinned cells, the utility cell included, get `data-pinned` (C-47). */\n hasPinned: boolean\n /** `--qt-pin-left` of each pinned cell, by key. */\n offsets: Readonly<Record<string, 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 v-for=\"(footerRow, i) in footerRows\" :key=\"i\">\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, 0)\"\n />\n <td\n v-for=\"entry in entries\"\n :key=\"entry.column.field\"\n :data-field=\"entry.column.field\"\n v-bind=\"\n pinAttrs(entry.column.pinned === 'left', offsets[entry.column.field])\n \"\n >\n {{ footerText(footerRow, entry.column) }}\n </td>\n </tr>\n </tfoot>\n</template>\n","<script setup lang=\"ts\">\nimport type { Column, FooterRow } from '../contract'\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 /** Pinned cells, the utility cell included, get `data-pinned` (C-47). */\n hasPinned: boolean\n /** `--qt-pin-left` of each pinned cell, by key. */\n offsets: Readonly<Record<string, 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 v-for=\"(footerRow, i) in footerRows\" :key=\"i\">\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, 0)\"\n />\n <td\n v-for=\"entry in entries\"\n :key=\"entry.column.field\"\n :data-field=\"entry.column.field\"\n v-bind=\"\n pinAttrs(entry.column.pinned === 'left', offsets[entry.column.field])\n \"\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 {\n conditionLabel,\n conditionOptions,\n rulesOf\n} 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, 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 = conditionLabel(props.type, label.condition)\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],\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 }\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 {\n conditionLabel,\n conditionOptions,\n rulesOf\n} 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, 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 = conditionLabel(props.type, label.condition)\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],\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 }\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","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 * 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 + 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 = key === 'ArrowRight' ? 1 : key === 'ArrowLeft' ? -1 : 0\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 } 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 ResizeHandle from './resize-handle.vue'\nimport SortButton from './sort-button.vue'\nimport { columnTypeOf } from '../core/column'\nimport { useTableContext } from '../core/table-context'\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 ones first. */\n columns: Column[]\n query: Query\n filterable: boolean\n /** Utility cells before the columns, in order. */\n utilities: Utility[]\n /** Pinned cells, utilities included, get `data-pinned` (C-47). */\n hasPinned: boolean\n /** `--qt-pin-left` of each pinned cell, by key. */\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, resize, selection, labels } = useTableContext()\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\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, 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), with `data-pinned`.\nconst cellAttrs = (column: Column) => {\n const preview = resize.preview.value\n return pinAttrs(\n column.pinned === 'left',\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})\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=\"filters.clearAll()\"\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-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)\"\n >\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 } 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 ResizeHandle from './resize-handle.vue'\nimport SortButton from './sort-button.vue'\nimport { columnTypeOf } from '../core/column'\nimport { useTableContext } from '../core/table-context'\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 ones first. */\n columns: Column[]\n query: Query\n filterable: boolean\n /** Utility cells before the columns, in order. */\n utilities: Utility[]\n /** Pinned cells, utilities included, get `data-pinned` (C-47). */\n hasPinned: boolean\n /** `--qt-pin-left` of each pinned cell, by key. */\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, resize, selection, labels } = useTableContext()\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\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, 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), with `data-pinned`.\nconst cellAttrs = (column: Column) => {\n const preview = resize.preview.value\n return pinAttrs(\n column.pinned === 'left',\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})\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=\"filters.clearAll()\"\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-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)\"\n >\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\n/** A drawn header cell, in order: its key (`field`, or the utility) and pin. */\ninterface HeaderCellKey {\n key: string\n pinned: boolean\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 (C-46) 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): the rendered width of every header\n * cell and, for the pinned cells, the cumulative left offset written as\n * `--qt-pin-left`. 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 /** `--qt-pin-left` of each pinned cell, by key, in pixels. */\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 tableWidth.value = table.getBoundingClientRect().width\n const cells = options.cells()\n const next: Record<string, number> = {}\n const nextOffsets: Record<string, number> = {}\n let left = 0\n headerCells(table).forEach((cell, index) => {\n const drawn = cells[index]\n if (drawn) {\n const width = cell.getBoundingClientRect().width\n next[drawn.key] = width\n if (drawn.pinned) {\n nextOffsets[drawn.key] = left\n left += width\n }\n }\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 => (cell.pinned ? `${cell.key}*` : cell.key))\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","// 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 widths arrive as options and changes leave as callbacks. The\n// TanStack slices are projections of the query (ADR 0004); 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 columnPinningFeature,\n functionalUpdate,\n globalFilteringFeature,\n rowExpandingFeature,\n rowPaginationFeature,\n rowSelectionFeature,\n rowSortingFeature,\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 type {\n Column,\n FilterCondition,\n PageCursors,\n PaginationSlotProps,\n QueryChangeReason,\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 // D3: pinning gives the order only (pinned columns first, as `start`);\n // the offsets are measured by the table, not computed from sizes.\n columnPinningFeature,\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 /** 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\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\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 /** The columns to draw: hidden ones dropped, pinned ones first. */\n columns: ComputedRef<ColumnEntry[]>\n /** Some drawn column is pinned. */\n hasPinned: ComputedRef<boolean>\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 /** 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\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\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 // D3: TanStack's `start` region is the left one; the order only.\n const columnPinning = computed(() => ({\n start: columns()\n .filter(column => column.pinned === 'left')\n .map(column => column.field),\n end: []\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 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 columnPinning() {\n return columnPinning.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 [...table.getStartLeafColumns(), ...table.getCenterLeafColumns()]\n .map(column => byField.get(column.id))\n .filter((entry): entry is ColumnEntry => !!entry && !entry.column.hide)\n })\n const hasPinned = computed(() =>\n entries.value.some(entry => entry.column.pinned === 'left')\n )\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 const expanded = (): Record<string, boolean> => {\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) => hasSubtable() && !!expanded()[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 return {\n table,\n columns: entries,\n hasPinned,\n sort,\n filters,\n search,\n pagination,\n expansion,\n selection,\n baseQuery\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 type {\n CellSlotProps,\n HeaderSlotProps,\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 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 { useColumnResize } from './resize/use-column-resize'\nimport { useQueryTable } from './use-query-table'\n\ndefineOptions({ name: 'QueryTable' })\n\nconst props = withDefaults(defineProps<TableProps<T, Q>>(), {\n cursors: null,\n selection: undefined,\n searchDebounce: 300,\n rows: () => [],\n totalRows: null,\n footerRows: () => [],\n loading: false,\n sortable: false,\n filterable: false,\n resizable: false,\n filterDebounce: 100,\n hasSubtable: false,\n hasRightPanel: false,\n rowKey: undefined,\n labels: 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 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})\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: the browser menu is suppressed only for a consumer that listens. The\n// 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`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\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\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 pinned: hasPinned.value\n })),\n ...entries.value.map(({ column }) => ({\n key: column.field,\n pinned: column.pinned === 'left'\n }))\n ],\n active: () =>\n hasPinned.value ||\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 emit: payload => emit('columnResize', payload)\n})\n\nprovideTableContext({\n filters,\n sort,\n resize,\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 )\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}\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\">\n <thead>\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 >\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 :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 @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\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 />\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 type {\n CellSlotProps,\n HeaderSlotProps,\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 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 { useColumnResize } from './resize/use-column-resize'\nimport { useQueryTable } from './use-query-table'\n\ndefineOptions({ name: 'QueryTable' })\n\nconst props = withDefaults(defineProps<TableProps<T, Q>>(), {\n cursors: null,\n selection: undefined,\n searchDebounce: 300,\n rows: () => [],\n totalRows: null,\n footerRows: () => [],\n loading: false,\n sortable: false,\n filterable: false,\n resizable: false,\n filterDebounce: 100,\n hasSubtable: false,\n hasRightPanel: false,\n rowKey: undefined,\n labels: 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 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})\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: the browser menu is suppressed only for a consumer that listens. The\n// 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`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\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\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 pinned: hasPinned.value\n })),\n ...entries.value.map(({ column }) => ({\n key: column.field,\n pinned: column.pinned === 'left'\n }))\n ],\n active: () =>\n hasPinned.value ||\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 emit: payload => emit('columnResize', payload)\n})\n\nprovideTableContext({\n filters,\n sort,\n resize,\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 )\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}\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\">\n <thead>\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 >\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 :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 @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\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 />\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 ColumnEntry,\n type QueryTable as QueryTableState,\n type QueryTableExpansion,\n type QueryTableFeatures,\n type QueryTableFilters,\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":";;;;;;AAGA,IAAM,gBAA6B;CACjC,iBAAiB;CACjB,WAAW;CACX,gBAAgB;CAChB,cAAa,WAAU,UAAU;CACjC,gBAAe,WAAU,sBAAsB;CAC/C,eAAc,WAAU,UAAU;CAClC,SAAS;CACT,UAAU;CACV,WAAW;CACX,WAAW;CACX,eAAe;AACjB;AAEA,IAAa,iBACX,YACiB;CAAE,GAAG;CAAe,GAAG;AAAO;;AAGjD,IAAa,cAAc,WAAmB,OAAO,SAAS,OAAO;;;ACKrE,IAAM,kBAA8C,OAAO,aAAa;AAExE,IAAa,uBAAuB,YAA0B;CAC5D,QAAQ,iBAAiB,OAAO;AAClC;AAEA,IAAa,wBAAsC;CACjD,MAAM,UAAU,OAAO,eAAe;CACtC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;;;ACpCA,IAAM,YACJ;;;;;;AAOF,IAAa,iBACX,OACA,UACY;CACZ,MAAM,OAAO,CAAC,GAAI,OAAO,YAAY,CAAC,CAAE,CAAC,CAAC,MACxC,UAAS,MAAM,YAAY,OAC7B;CACA,KAAK,MAAM,OAAO,MAAM,YAAY,CAAC,GACnC,KAAK,MAAM,QAAQ,IAAI,UAAU;EAC/B,IAAI,KAAK,aAAa,YAAY,MAAM,OACtC;EAKF,MAAM,SAAS,CACb,GAJa,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,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G;MAC5D,mBAAiB,OAAA,OAAA,OAAA,MAAE,YAAW,KAAI,mBAAoB,OAAO;KAErCI,GAAAA,YAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,WAAA,cAAa,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,YAOEC,sBAAA;;MALC,eAAa,QAAA;MACb,SAASN,MAAA,OAAA;MACT,iBAAe,aAAA;MACf,cAAYA,MAAA,SAAA;MACZ,SAASA,MAAA,OAAA;;;;;;;;;IAIQ,eAAA,SAAxBR,UAAA,GAAAa,YAImBG,0BAAA;;KAJsB,oBAAkBR,MAAA,eAAA;;KAC9C,YAAUC,SAAE,MAAC,CACtBP,WAAqC,KAAA,QAAA,cAAAC,eAAAC,mBAAL,CAAC,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEpPzC,SAAgB,iBACd,MACA,QACA,YAAoC,MACtB;CACd,OAAOc,mBAAM,MAAM,QAAQ,SAAS;AACtC;;;AC3BA,IAAA,cAAeC"}
|
|
1
|
+
{"version":3,"file":"query-table.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_useSlots","_openBlock","_createElementBlock","_unref","_Fragment","_renderList","_createElementVNode","_mergeProps","_withModifiers","_createCommentVNode","_renderSlot","_toDisplayString","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_unref","_createCommentVNode","_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","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_createElementVNode","_unref","_withModifiers","_createBlock","ReorderHandle","_createCommentVNode","_renderSlot","SortButton","_toDisplayString","FilterCell","columnTypeOf","_createSlots","_withCtx","ResizeHandle","_sfc_main","_hoisted_1","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_sfc_main","_useSlots","_openBlock","_createElementBlock","_renderSlot","_normalizeProps","_guardReactiveProps","_createElementVNode","_createVNode","TableHeader","_unref","_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/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/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 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 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","// 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 type { Slots } from 'vue'\n\nimport { sideOf } from '../columns/column-layout'\nimport type { CellContextMenuPayload, CellSlotProps, Column } from '../contract'\nimport { 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 const cellAttrs = (entry: ColumnEntry) => ({\n 'data-field': 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 { useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { BodyRow, ColumnEntry } from '../use-query-table'\n\nconst props = defineProps<{\n rows: T[]\n /** The rows in drawing order: pinned top, the others, pinned bottom (C-74). */\n bodyRows: BodyRow<T>[]\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n /** The consumer is fetching: no empty row, the `loading` row instead (C-52). */\n loading: boolean\n /** The columns to draw, hidden ones already dropped. */\n entries: ColumnEntry[]\n /** 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}>()\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</script>\n\n<template>\n <tbody @contextmenu=\"onContextMenu\">\n <template\n v-for=\"{ row, index: i, pinned } in bodyRows\"\n :key=\"keyOf(row, i)\"\n >\n <tr\n :data-row-index=\"i\"\n :data-pinned-row=\"pinned || undefined\"\n :data-expanded=\"isExpanded(row, i) ? '' : undefined\"\n :data-selected=\"hasSelection && isSelected(row, i) ? '' : 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', 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=\"isExpanded(row, i)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(row, i)\"\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=\"isExpanded(row, i)\" 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(row, i)\"\n @change=\"toggleSelected(row, i)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td v-if=\"hasCellSlot(entry.column)\" v-bind=\"cellAttrs(entry)\">\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"slotProps(row, entry.column, i, pinned)\"\n />\n </td>\n <td v-else v-bind=\"cellAttrs(entry)\">\n {{ cellText(row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr\n v-if=\"isExpanded(row, i)\"\n class=\"qt-subtable-row\"\n :data-pinned-row=\"pinned || undefined\"\n >\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"row\" :row-index=\"i\" />\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 </tbody>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends object\">\nimport { useSlots } from 'vue'\n\nimport { useCellView } from '../body/use-cell-view'\nimport type {\n CellContextMenuPayload,\n TableLabels,\n TableSlots\n} from '../contract'\nimport { pinAttrs, utilityKey } from '../pin/pin'\nimport type { BodyRow, ColumnEntry } from '../use-query-table'\n\nconst props = defineProps<{\n rows: T[]\n /** The rows in drawing order: pinned top, the others, pinned bottom (C-74). */\n bodyRows: BodyRow<T>[]\n /** Pin a row or unpin it (C-74). */\n pinRow: (row: T, index: number, position: 'top' | 'bottom' | false) => void\n /** The consumer is fetching: no empty row, the `loading` row instead (C-52). */\n loading: boolean\n /** The columns to draw, hidden ones already dropped. */\n entries: ColumnEntry[]\n /** 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}>()\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</script>\n\n<template>\n <tbody @contextmenu=\"onContextMenu\">\n <template\n v-for=\"{ row, index: i, pinned } in bodyRows\"\n :key=\"keyOf(row, i)\"\n >\n <tr\n :data-row-index=\"i\"\n :data-pinned-row=\"pinned || undefined\"\n :data-expanded=\"isExpanded(row, i) ? '' : undefined\"\n :data-selected=\"hasSelection && isSelected(row, i) ? '' : 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', 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=\"isExpanded(row, i)\"\n :aria-label=\"labels.expandRow\"\n @click=\"toggle(row, i)\"\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=\"isExpanded(row, i)\" 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(row, i)\"\n @change=\"toggleSelected(row, i)\"\n />\n </td>\n <template v-for=\"entry in entries\" :key=\"entry.column.field\">\n <td v-if=\"hasCellSlot(entry.column)\" v-bind=\"cellAttrs(entry)\">\n <slot\n :name=\"`cell-${entry.column.field}`\"\n v-bind=\"slotProps(row, entry.column, i, pinned)\"\n />\n </td>\n <td v-else v-bind=\"cellAttrs(entry)\">\n {{ cellText(row, entry.column) }}\n </td>\n </template>\n </tr>\n <tr\n v-if=\"isExpanded(row, i)\"\n class=\"qt-subtable-row\"\n :data-pinned-row=\"pinned || undefined\"\n >\n <td :colspan=\"columnCount\">\n <slot name=\"subtable\" :row=\"row\" :row-index=\"i\" />\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 </tbody>\n</template>\n","<script setup lang=\"ts\">\nimport { sideOf } from '../columns/column-layout'\nimport type { Column, FooterRow } from '../contract'\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}>()\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 v-for=\"(footerRow, i) in footerRows\" :key=\"i\">\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 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 { 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}>()\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 v-for=\"(footerRow, i) in footerRows\" :key=\"i\">\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 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 {\n conditionLabel,\n conditionOptions,\n rulesOf\n} 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 = conditionLabel(props.type, label.condition)\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],\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 {\n conditionLabel,\n conditionOptions,\n rulesOf\n} 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 = conditionLabel(props.type, label.condition)\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],\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 } 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 { 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\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=\"filters.clearAll()\"\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-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 } 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 { 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\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=\"filters.clearAll()\"\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-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 tableWidth.value = 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 = 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 const expanded = (): Record<string, boolean> => {\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) => hasSubtable() && !!expanded()[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","<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 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 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'\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})\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: the browser menu is suppressed only for a consumer that listens. The\n// 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`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\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\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 )\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}\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\">\n <thead>\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 >\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=\"state.rowPinning.rows.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 @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\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 />\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 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 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'\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})\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: the browser menu is suppressed only for a consumer that listens. The\n// 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`.\nconst hasContextMenuListener = () => {\n const vnodeProps = instance?.vnode.props\n return !!(vnodeProps?.onCellContextMenu || vnodeProps?.onCellContextMenuOnce)\n}\n\nconst entries = state.columns\nconst visibleColumns = computed(() => entries.value.map(e => e.column))\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\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 )\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}\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\">\n <thead>\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 >\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=\"state.rowPinning.rows.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 @row-right-panel-click=\"row => emit('rowRightPanelClick', row)\"\n @cell-context-menu=\"payload => emit('cellContextMenu', payload)\"\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 />\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;;AAGA,IAAa,gBACX,SACA,YACoB;CACpB,MAAM,OAAO,IAAI,IAAI,QAAQ,SAAS,CAAC,CAAC;CACxC,MAAM,QAAQ,IAAI,IAAI,QAAQ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