@nocopypaste/vue-grid 0.3.0 → 0.3.2

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.
Files changed (119) hide show
  1. package/AGENTS.md +249 -84
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +412 -228
  4. package/agent/api.json +89 -89
  5. package/agent/api.md +84 -84
  6. package/agent/grid-config.schema.json +11 -5
  7. package/dist/agent/api.js +89 -89
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/agent/validate.js.map +1 -1
  10. package/dist/base.css +1 -1
  11. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +1 -1
  12. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  14. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +1 -1
  17. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +9 -4
  20. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
  21. package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  23. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  24. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +4 -4
  25. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  27. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +1 -1
  28. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  29. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +2 -2
  31. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  32. package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  33. package/dist/composables/useColumnDrag.js.map +1 -1
  34. package/dist/composables/useColumnResize.js.map +1 -1
  35. package/dist/composables/useDataSource.js.map +1 -1
  36. package/dist/composables/useGridExport.js.map +1 -1
  37. package/dist/composables/useGridFilters.js.map +1 -1
  38. package/dist/composables/useGridKeyboard.js +46 -36
  39. package/dist/composables/useGridKeyboard.js.map +1 -1
  40. package/dist/composables/useGridMenus.js.map +1 -1
  41. package/dist/composables/useGridSelection.js.map +1 -1
  42. package/dist/composables/usePinnedRows.js.map +1 -1
  43. package/dist/composables/useRowGrouping.js.map +1 -1
  44. package/dist/composables/useTotals.js.map +1 -1
  45. package/dist/composables/useVirtualRows.js.map +1 -1
  46. package/dist/core/aggregate.js.map +1 -1
  47. package/dist/core/columns.js.map +1 -1
  48. package/dist/core/csv.js.map +1 -1
  49. package/dist/core/filter.js.map +1 -1
  50. package/dist/core/grouping.js.map +1 -1
  51. package/dist/core/pagination.js.map +1 -1
  52. package/dist/core/patch.js.map +1 -1
  53. package/dist/core/selection.js.map +1 -1
  54. package/dist/core/sort.js.map +1 -1
  55. package/dist/core/storage.js.map +1 -1
  56. package/dist/core/value.js.map +1 -1
  57. package/dist/core.css +1 -1
  58. package/dist/features/aggregation.js.map +1 -1
  59. package/dist/features/columnGroups.js.map +1 -1
  60. package/dist/features/columnVisibility.js.map +1 -1
  61. package/dist/features/filtering.js.map +1 -1
  62. package/dist/features/keyboardNavigation.js.map +1 -1
  63. package/dist/features/menus.js.map +1 -1
  64. package/dist/features/rowGrouping.js.map +1 -1
  65. package/dist/features/rowPinning.js.map +1 -1
  66. package/dist/features/selection.js.map +1 -1
  67. package/dist/features/virtualScrolling.js.map +1 -1
  68. package/dist/internal/RenderSlot.js.map +1 -1
  69. package/dist/internal/anchor.js +20 -21
  70. package/dist/internal/anchor.js.map +1 -1
  71. package/dist/internal/context.js.map +1 -1
  72. package/dist/internal/supports.js +2 -2
  73. package/dist/internal/supports.js.map +1 -1
  74. package/dist/internal/touchHold.js.map +1 -1
  75. package/dist/registry/plugin.js.map +1 -1
  76. package/dist/registry/registry.js.map +1 -1
  77. package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  78. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  79. package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  80. package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  81. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  83. package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  84. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  86. package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  87. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  89. package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  91. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  92. package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  93. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  95. package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  96. package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  97. package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  98. package/dist/renderers/format.js.map +1 -1
  99. package/dist/renderers/index.js.map +1 -1
  100. package/dist/renderers/options.js.map +1 -1
  101. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
  103. package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  104. package/dist/renderers/parts/icons.js.map +1 -1
  105. package/dist/renderers/parts/useToggleControl.js.map +1 -1
  106. package/dist/renderers/plainText.js.map +1 -1
  107. package/dist/renderers/text.js.map +1 -1
  108. package/dist/theme.css +1 -1
  109. package/dist/types/agent/index.d.ts +2 -2
  110. package/dist/types/internal/anchor.d.ts +10 -2
  111. package/dist/types/internal/supports.d.ts +0 -5
  112. package/dist/types/renderers/NumberCell.vue.d.ts +2 -4
  113. package/dist/types/renderers/index.d.ts +3 -5
  114. package/dist/types/renderers/options.d.ts +45 -0
  115. package/dist/types/renderers/plainText.d.ts +2 -4
  116. package/dist/types/types.d.ts +35 -0
  117. package/dist/vue-grid.css +1 -1
  118. package/llms-full.txt +745 -396
  119. package/package.json +1 -1
package/README.md CHANGED
@@ -57,7 +57,13 @@ import {
57
57
  type SortState,
58
58
  } from '@nocopypaste/vue-grid'
59
59
 
60
- interface Order { id: number; customer: { name: string }; total: number; status: 'Paid' | 'Open'; placedAt: string }
60
+ interface Order {
61
+ id: number
62
+ customer: { name: string }
63
+ total: number
64
+ status: 'Paid' | 'Open'
65
+ placedAt: string
66
+ }
61
67
 
62
68
  const rows = ref<Order[]>([/* … */])
63
69
  const sort = ref<SortState | null>(null)
@@ -65,9 +71,20 @@ const sort = ref<SortState | null>(null)
65
71
  const col = createColumnHelper<Order>()
66
72
  const columns = [
67
73
  col({ key: 'id', header: '#', renderer: numberRenderer, width: 'min-content', pinned: 'left' }),
68
- col({ key: 'customer', header: 'Customer', field: 'customer.name', sortable: true, width: 'minmax(10rem, 1fr)' }),
74
+ col({
75
+ key: 'customer',
76
+ header: 'Customer',
77
+ field: 'customer.name',
78
+ sortable: true,
79
+ width: 'minmax(10rem, 1fr)',
80
+ }),
69
81
  col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
70
- col({ key: 'status', header: 'Status', renderer: statusRenderer, rendererOptions: { tone: { Paid: 'success', Open: 'info' } } }),
82
+ col({
83
+ key: 'status',
84
+ header: 'Status',
85
+ renderer: statusRenderer,
86
+ rendererOptions: { tone: { Paid: 'success', Open: 'info' } },
87
+ }),
71
88
  col({ key: 'placedAt', header: 'Placed', renderer: dateTimeRenderer }),
72
89
  ]
73
90
  </script>
@@ -93,26 +110,26 @@ Out of the box `<VGrid>` is a plain, read-only table: columns with any renderer
93
110
  saved column state (`storage`), detail rows, tabbable controls and theming. Everything else is
94
111
  an opt-in feature:
95
112
 
96
- | Feature | Turns on |
97
- |---|---|
98
- | `sortingFeature` | Sort buttons on `sortable` headers, the header menu's sort items, `sort-mode="client"` sorting |
99
- | `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
100
- | `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
101
- | `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
102
- | `selectionFeature` | `selectable` (multi or single), `v-model:selected`, `selection-mode`, `is-row-selectable`, select-all, Space to select, shift-click / Shift+Space ranges, `prune-selection`, the selection in `#toolbar` for batch actions, "select all N matching rows" with server data (`v-model:select-all-matching`) |
103
- | `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
104
- | `menusFeature` | The header right-click menu (`header-menu`) and body-cell menus (`context-menu`); without it the browser's menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it |
105
- | `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
106
- | `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; without it pins are ignored |
107
- | `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
108
- | `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
109
- | `keyboardNavigationFeature` | The ARIA grid pattern: one Tab stop, arrow keys / Home / End / PageUp / PageDown between cells, Enter, Space to select, →/← to expand, Alt+←/→ to move a column. Without it the grid is an ARIA `table` with its controls in the Tab order |
110
- | `columnResizingFeature` | Drag a header edge to resize (mouse, pen, touch), double-click it to fit the content, ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation); `minWidth` / `maxWidth` bound it, `resizable: false` opts out; widths in `columnState.widths`, persisted with `storage`; Fit width / Reset width in the header menu |
111
- | `columnGroupsFeature` | Grouped column headers: columns with the same `group` share a header cell in a sticky row above theirs; groups follow reordering, hiding, resizing and pinning (a pin boundary splits a group) |
112
- | `rowPinningFeature` | `v-model:pinned-rows` / `pinRow()`: rows that stay in view above or below the body, plus `pinned-top-rows` / `pinned-bottom-rows` for rows that aren't in the data |
113
- | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
114
- | `rowGroupingFeature` | `v-model:group-by`: rows grouped by one or more columns into collapsible group rows with the value, row count and aggregates; Group by / Ungroup in the header menu for `groupable` columns |
115
- | `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
113
+ | Feature | Turns on |
114
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115
+ | `sortingFeature` | Sort buttons on `sortable` headers, the header menu's sort items, `sort-mode="client"` sorting |
116
+ | `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
117
+ | `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
118
+ | `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
119
+ | `selectionFeature` | `selectable` (multi or single), `v-model:selected`, `selection-mode`, `is-row-selectable`, select-all, Space to select, shift-click / Shift+Space ranges, `prune-selection`, the selection in `#toolbar` for batch actions, "select all N matching rows" with server data (`v-model:select-all-matching`) |
120
+ | `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
121
+ | `menusFeature` | The header right-click menu (`header-menu`) and body-cell menus (`context-menu`); without it the browser's menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it |
122
+ | `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
123
+ | `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; without it pins are ignored |
124
+ | `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
125
+ | `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
126
+ | `keyboardNavigationFeature` | The ARIA grid pattern: one Tab stop, arrow keys / Home / End / PageUp / PageDown between cells, Enter, Space to select, →/← to expand, Alt+←/→ to move a column. Without it the grid is an ARIA `table` with its controls in the Tab order |
127
+ | `columnResizingFeature` | Drag a header edge to resize (mouse, pen, touch), double-click it to fit the content, ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation); `minWidth` / `maxWidth` bound it, `resizable: false` opts out; widths in `columnState.widths`, persisted with `storage`; Fit width / Reset width in the header menu |
128
+ | `columnGroupsFeature` | Grouped column headers: columns with the same `group` share a header cell in a sticky row above theirs; groups follow reordering, hiding, resizing and pinning (a pin boundary splits a group) |
129
+ | `rowPinningFeature` | `v-model:pinned-rows` / `pinRow()`: rows that stay in view above or below the body, plus `pinned-top-rows` / `pinned-bottom-rows` for rows that aren't in the data |
130
+ | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
131
+ | `rowGroupingFeature` | `v-model:group-by`: rows grouped by one or more columns into collapsible group rows with the value, row count and aggregates; Group by / Ungroup in the header menu for `groupable` columns |
132
+ | `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
116
133
 
117
134
  ```ts
118
135
  // per grid
@@ -138,50 +155,50 @@ what you import.
138
155
  - **per column** (recommended, smallest bundle, typed options): `renderer: currencyRenderer`, or
139
156
  - **by name**, after registering them: `createVueGrid({ renderers: [currencyRenderer, statusRenderer] })`
140
157
  or `<VGrid :renderers="[…]">`, then `renderer: 'currency'`. `allRenderers` registers every built-in.
141
- An unregistered name renders as plain text and logs a dev warning saying how to register it.
158
+ An unregistered name renders as plain text and logs a dev warning saying how to register it.
142
159
  - **Components and helpers** (`VGridPagination`, `VGridColumnMenu`, `VGridMenu`, `sortRows`, …) are
143
160
  only bundled when imported.
144
161
  - **CSS**: `@nocopypaste/vue-grid/style.css` has everything. Pick parts instead:
145
162
 
146
- | File | What | gzip |
147
- |---|---|---|
148
- | `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
149
- | `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.3 kB |
150
- | `core.css` | `base.css` + `theme.css` | 5.1 kB |
151
- | `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
152
- | `style.css` | All of the above | 6.6 kB |
163
+ | File | What | gzip |
164
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------ |
165
+ | `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
166
+ | `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.3 kB |
167
+ | `core.css` | `base.css` + `theme.css` | 5.1 kB |
168
+ | `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
169
+ | `style.css` | All of the above | 6.6 kB |
153
170
 
154
171
  For a fully custom look, import only `base.css` (and `renderers.css` if you use renderers)
155
172
  and style the `.vg-*` classes yourself. See [Theming](#theming).
156
173
 
157
- | Import (minified / gzip, Vue excluded) | Initial chunk |
158
- |---|---|
159
- | `VGrid` (no features) | 39.0 kB / 13.6 kB |
160
- | `VGrid` + `sortingFeature` | 39.8 kB / 13.9 kB |
161
- | `VGrid` + `filteringFeature` | 49.7 kB / 17.4 kB |
162
- | `VGrid` + `serverDataFeature` | 40.4 kB / 14.2 kB |
163
- | `VGrid` + `paginationFeature` | 39.2 kB / 13.7 kB |
164
- | `VGrid` + `selectionFeature` | 43.2 kB / 15.1 kB |
165
- | `VGrid` + `subGridsFeature` | 41.4 kB / 14.5 kB |
166
- | `VGrid` + `menusFeature` | 49.6 kB / 17.2 kB |
167
- | `VGrid` + `columnReorderFeature` | 42.7 kB / 14.9 kB |
168
- | `VGrid` + `columnPinningFeature` | 41.2 kB / 14.5 kB |
169
- | `VGrid` + `virtualScrollingFeature` | 44.8 kB / 15.8 kB |
170
- | `VGrid` + `columnVisibilityFeature` | 39.2 kB / 13.7 kB |
171
- | `VGrid` + `keyboardNavigationFeature` | 41.5 kB / 14.5 kB |
172
- | `VGrid` + `columnResizingFeature` | 41.8 kB / 14.7 kB |
173
- | `VGrid` + `columnGroupsFeature` | 40.3 kB / 14.1 kB |
174
- | `VGrid` + `rowPinningFeature` | 44.0 kB / 15.0 kB |
175
- | `VGrid` + `aggregationFeature` | 44.2 kB / 15.1 kB |
176
- | `VGrid` + `rowGroupingFeature` | 48.6 kB / 16.4 kB |
177
- | `VGrid` + `exportFeature` | 42.8 kB / 15.1 kB |
178
- | `VGrid` + `allFeatures` + `VGridSearch` | 102.8 kB / 34.7 kB |
179
- | `VGrid` + `currencyRenderer` | 40.4 kB / 14.1 kB |
180
- | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 45.8 kB / 15.9 kB |
181
- | `sortRows` only | 0.7 kB / 0.4 kB |
182
- | `toCsv` only | 1.1 kB / 0.6 kB |
183
- | everything | 147.4 kB / 47.2 kB |
184
- | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 63.7 kB / 17.1 kB |
174
+ | Import (minified / gzip, Vue excluded) | Initial chunk |
175
+ | ---------------------------------------------------------------------------- | ------------------ |
176
+ | `VGrid` (no features) | 39.0 kB / 13.6 kB |
177
+ | `VGrid` + `sortingFeature` | 39.8 kB / 13.9 kB |
178
+ | `VGrid` + `filteringFeature` | 49.7 kB / 17.4 kB |
179
+ | `VGrid` + `serverDataFeature` | 40.4 kB / 14.2 kB |
180
+ | `VGrid` + `paginationFeature` | 39.2 kB / 13.7 kB |
181
+ | `VGrid` + `selectionFeature` | 43.2 kB / 15.1 kB |
182
+ | `VGrid` + `subGridsFeature` | 41.4 kB / 14.5 kB |
183
+ | `VGrid` + `menusFeature` | 49.6 kB / 17.2 kB |
184
+ | `VGrid` + `columnReorderFeature` | 42.7 kB / 14.9 kB |
185
+ | `VGrid` + `columnPinningFeature` | 41.2 kB / 14.5 kB |
186
+ | `VGrid` + `virtualScrollingFeature` | 44.8 kB / 15.8 kB |
187
+ | `VGrid` + `columnVisibilityFeature` | 39.2 kB / 13.7 kB |
188
+ | `VGrid` + `keyboardNavigationFeature` | 41.5 kB / 14.5 kB |
189
+ | `VGrid` + `columnResizingFeature` | 41.8 kB / 14.7 kB |
190
+ | `VGrid` + `columnGroupsFeature` | 40.3 kB / 14.1 kB |
191
+ | `VGrid` + `rowPinningFeature` | 44.0 kB / 15.0 kB |
192
+ | `VGrid` + `aggregationFeature` | 44.2 kB / 15.1 kB |
193
+ | `VGrid` + `rowGroupingFeature` | 48.6 kB / 16.4 kB |
194
+ | `VGrid` + `exportFeature` | 42.8 kB / 15.1 kB |
195
+ | `VGrid` + `allFeatures` + `VGridSearch` | 102.8 kB / 34.7 kB |
196
+ | `VGrid` + `currencyRenderer` | 40.4 kB / 14.1 kB |
197
+ | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 45.8 kB / 15.9 kB |
198
+ | `sortRows` only | 0.7 kB / 0.4 kB |
199
+ | `toCsv` only | 1.1 kB / 0.6 kB |
200
+ | everything | 147.4 kB / 47.2 kB |
201
+ | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 63.7 kB / 17.1 kB |
185
202
 
186
203
  With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
187
204
  chunks**: they load the first time a popover opens or `filter-row` is on. With
@@ -198,56 +215,56 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
198
215
 
199
216
  ### Props
200
217
 
201
- | Prop | Type | Default | |
202
- |---|---|---|---|
203
- | `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
204
- | `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
205
- | `dataSource` | `(query, { signal }) => Promise<{ rows, total? }>` | — | Server rows: the grid calls it whenever sort, filters or page change. Needs `serverDataFeature`. See [Server data](#server-data). |
206
- | `columns` | `ColumnDef<T>[]` | — | See below. |
207
- | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
208
- | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
209
- | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
210
- | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
211
- | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
212
- | `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
213
- | `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
214
- | `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a *Clear filters* button, when filters hide every row. |
215
- | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
216
- | `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
217
- | `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
218
- | `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
219
- | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
220
- | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
221
- | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
222
- | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
223
- | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
224
- | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
225
- | `v-model:selected` | `RowKey[]` | `[]` | |
226
- | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
227
- | `isRowSelectable` | `(row) => boolean` | — | |
228
- | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
229
- | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
230
- | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
231
- | `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null` | Top-level rows pinned above / below the body. Needs `rowPinningFeature` (as do the next two). See [Pinned rows and totals](#pinned-rows-and-totals). |
232
- | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
233
- | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
234
- | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
235
- | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
236
- | `v-model:groupBy` | `string[] \| string \| null` | `null` | Column keys to group the rows by, outermost first. Needs `rowGroupingFeature` (as does the next one). See [Row grouping](#row-grouping). |
237
- | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
238
- | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
239
- | `rowClass` | `(row, index) => ClassValue` | — | |
240
- | `highlightedRows` | `RowKey[]` | — | |
241
- | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
242
- | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
243
- | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
244
- | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
245
- | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
246
- | `emptyText` | `string` | `'No data to show.'` | |
247
- | `ariaLabel` | `string` | — | |
248
- | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
249
- | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
250
- | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
218
+ | Prop | Type | Default | |
219
+ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
220
+ | `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
221
+ | `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
222
+ | `dataSource` | `(query, { signal }) => Promise<{ rows, total? }>` | — | Server rows: the grid calls it whenever sort, filters or page change. Needs `serverDataFeature`. See [Server data](#server-data). |
223
+ | `columns` | `ColumnDef<T>[]` | — | See below. |
224
+ | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
225
+ | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
226
+ | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
227
+ | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
228
+ | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
229
+ | `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
230
+ | `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
231
+ | `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a _Clear filters_ button, when filters hide every row. |
232
+ | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
233
+ | `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
234
+ | `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
235
+ | `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
236
+ | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
237
+ | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
238
+ | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
239
+ | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
240
+ | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
241
+ | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
242
+ | `v-model:selected` | `RowKey[]` | `[]` | |
243
+ | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
244
+ | `isRowSelectable` | `(row) => boolean` | — | |
245
+ | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
246
+ | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
247
+ | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
248
+ | `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null` | Top-level rows pinned above / below the body. Needs `rowPinningFeature` (as do the next two). See [Pinned rows and totals](#pinned-rows-and-totals). |
249
+ | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
250
+ | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
251
+ | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
252
+ | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
253
+ | `v-model:groupBy` | `string[] \| string \| null` | `null` | Column keys to group the rows by, outermost first. Needs `rowGroupingFeature` (as does the next one). See [Row grouping](#row-grouping). |
254
+ | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
255
+ | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
256
+ | `rowClass` | `(row, index) => ClassValue` | — | |
257
+ | `highlightedRows` | `RowKey[]` | — | |
258
+ | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
259
+ | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
260
+ | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
261
+ | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
262
+ | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
263
+ | `emptyText` | `string` | `'No data to show.'` | |
264
+ | `ariaLabel` | `string` | — | |
265
+ | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
266
+ | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
267
+ | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
251
268
 
252
269
  ### Events
253
270
 
@@ -354,8 +371,16 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
354
371
  `#toolbar` slot gets them too, so a batch-action bar lives in the grid:
355
372
 
356
373
  ```vue
357
- <VGrid v-model:selected="selected" :rows="requests" :columns="columns" row-key="id" selectable prune-selection
358
- :is-row-selectable="(r) => r.status === 'pending'" :features="[selectionFeature]">
374
+ <VGrid
375
+ v-model:selected="selected"
376
+ :rows="requests"
377
+ :columns="columns"
378
+ row-key="id"
379
+ selectable
380
+ prune-selection
381
+ :is-row-selectable="(r) => r.status === 'pending'"
382
+ :features="[selectionFeature]"
383
+ >
359
384
  <template #toolbar="{ selected, selectedCount, clearSelection }">
360
385
  <template v-if="selectedCount">
361
386
  {{ selectedCount }} selected
@@ -376,11 +401,11 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
376
401
  selection can span server pages. `prune-selection` drops them instead: after a reload, a batch
377
402
  delete or a new page, `selected` only holds rows that exist.
378
403
  - **All matching rows (server data).** With a `data-source`, the header checkbox selects the loaded
379
- page; a banner then offers *Select all N rows* (N = the `total` the source returned). That sets
404
+ page; a banner then offers _Select all N rows_ (N = the `total` the source returned). That sets
380
405
  `v-model:select-all-matching`: every row shows ticked, `selectedCount` is N, and your batch
381
406
  action should run on the query (`@query-change`) rather than on `selected`. Changing the
382
407
  filters, unticking a row (the keys already in `selected` stay, plus the rest of the loaded page) or
383
- *Clear selection* ends it.
408
+ _Clear selection_ ends it.
384
409
  - `grid.clearSelection()` clears it all from code. Cascading through sub-grids, group checkboxes
385
410
  (row grouping) and copying the selected rows (export feature) work as described in their
386
411
  sections.
@@ -388,7 +413,13 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
388
413
  ## Sub-grids (CSS `subgrid`)
389
414
 
390
415
  ```vue
391
- <VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(row) => row.children" selectable />
416
+ <VGrid
417
+ :rows="markets"
418
+ :columns="columns"
419
+ row-key="id"
420
+ :sub-rows="(row) => row.children"
421
+ selectable
422
+ />
392
423
  ```
393
424
 
394
425
  Expanded children render inside a `.vg-subgrid` element that spans every column and uses
@@ -402,7 +433,13 @@ Need children with a **different** set of columns? Put another `<VGrid>` in the
402
433
  ## Column menu, reorder, persistence
403
434
 
404
435
  ```vue
405
- <VGrid :rows :columns row-key="id" storage="orders-grid" :features="[columnVisibilityFeature, columnReorderFeature]">
436
+ <VGrid
437
+ :rows
438
+ :columns
439
+ row-key="id"
440
+ storage="orders-grid"
441
+ :features="[columnVisibilityFeature, columnReorderFeature]"
442
+ >
406
443
  <!-- the picker hides columns (columnVisibilityFeature); dragging headers needs columnReorderFeature -->
407
444
  <template #toolbar="{ columnState, setColumnState }">
408
445
  <VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
@@ -425,13 +462,20 @@ scrolls. No JS positioning, except a small fallback for browsers without anchor
425
462
 
426
463
  ```vue
427
464
  <VGrid
428
- :rows :columns row-key="id"
429
- :context-menu="({ row, column, value }) => column.key === 'link' ? [] : [
430
- { name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
431
- { name: 'open', label: `Open #${row.id}` },
432
- { separator: true },
433
- { name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
434
- ]"
465
+ :rows
466
+ :columns
467
+ row-key="id"
468
+ :context-menu="
469
+ ({ row, column, value }) =>
470
+ column.key === 'link'
471
+ ? []
472
+ : [
473
+ { name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
474
+ { name: 'open', label: `Open #${row.id}` },
475
+ { separator: true },
476
+ { name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
477
+ ]
478
+ "
435
479
  @context-action="({ name, row, column, value }) => run(name, row)"
436
480
  />
437
481
  ```
@@ -449,9 +493,14 @@ Pin items need `columnPinningFeature`, move items `columnReorderFeature`, Hide c
449
493
 
450
494
  ```vue
451
495
  <!-- extend (or replace) the built-in items; custom items emit header-action -->
452
- <VGrid :header-menu="({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]"
453
- @header-action="({ name, column }) => …" />
454
- <VGrid :header-menu="false" /> <!-- off -->
496
+ <VGrid
497
+ :header-menu="
498
+ ({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]
499
+ "
500
+ @header-action="({ name, column }) => …"
501
+ />
502
+ <VGrid :header-menu="false" />
503
+ <!-- off -->
455
504
  ```
456
505
 
457
506
  Columns opt out with `pinnable: false`, `reorderable: false`, `hideable: false`.
@@ -470,23 +519,39 @@ The same component powers the `actions-menu` renderer and is exported for add-on
470
519
 
471
520
  ```vue
472
521
  <script setup lang="ts">
473
- import { VGrid, VGridSearch, filteringFeature, numberRenderer, statusRenderer, type FilterState } from '@nocopypaste/vue-grid'
522
+ import {
523
+ VGrid,
524
+ VGridSearch,
525
+ filteringFeature,
526
+ numberRenderer,
527
+ statusRenderer,
528
+ type FilterState,
529
+ } from '@nocopypaste/vue-grid'
474
530
 
475
531
  const filters = ref<FilterState | null>(null)
476
532
  const columns = [
477
- { key: 'player', header: 'Player', filterable: true }, // text
478
- { key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
479
- { key: 'status', header: 'Status', filterable: true, renderer: statusRenderer },// value list
480
- { key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
533
+ { key: 'player', header: 'Player', filterable: true }, // text
534
+ { key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
535
+ { key: 'status', header: 'Status', filterable: true, renderer: statusRenderer }, // value list
536
+ { key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
481
537
  ]
482
538
  </script>
483
539
 
484
540
  <template>
485
- <VGrid v-model:filters="filters" :rows :columns row-key="id" :features="[filteringFeature]"
486
- filter-row filter-storage="bets-filters">
541
+ <VGrid
542
+ v-model:filters="filters"
543
+ :rows
544
+ :columns
545
+ row-key="id"
546
+ :features="[filteringFeature]"
547
+ filter-row
548
+ filter-storage="bets-filters"
549
+ >
487
550
  <template #toolbar="{ activeFilterCount, clearFilters }">
488
551
  <VGridSearch />
489
- <button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }} filters</button>
552
+ <button v-if="activeFilterCount" @click="clearFilters()">
553
+ Clear {{ activeFilterCount }} filters
554
+ </button>
490
555
  </template>
491
556
  </VGrid>
492
557
  </template>
@@ -497,18 +562,19 @@ const columns = [
497
562
  popover through the Popover API and CSS anchor positioning, and the popover holds an editor for
498
563
  the column's type:
499
564
 
500
- | Type | Editor | Operators |
501
- |---|---|---|
502
- | `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
503
- | `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
504
- | `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
505
- | `boolean` | radio group | any, yes, no, empty |
506
- | `set` | searchable checkbox list with counts | (the selected values) |
507
- | `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
565
+ | Type | Editor | Operators |
566
+ | --------- | ------------------------------------ | -------------------------------------------------------------------------------------------------- |
567
+ | `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
568
+ | `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
569
+ | `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
570
+ | `boolean` | radio group | any, yes, no, empty |
571
+ | `set` | searchable checkbox list with counts | (the selected values) |
572
+ | `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
508
573
 
509
574
  The type comes from `filter`, else from the renderer (number, currency, change → `number`;
510
575
  date, datetime → `date`; boolean, checkbox, switch → `boolean`; status, chip → `set`), else
511
576
  `text`.
577
+
512
578
  - **Filter row** (`filter-row`). An inline input under each header that accepts shorthand:
513
579
  `>10`, `>=10`, `5..20`, `-5..-1`, open ranges `5..` / `..20`, `!=3`, a decimal comma (`1,5`),
514
580
  and `>2026-01-01` or `2026-01-01..2026-03-31` for dates; plain text for text columns. Input that
@@ -517,7 +583,7 @@ const columns = [
517
583
  - **Quick search.** `<VGridSearch>` inside the `#toolbar` slot drives that grid's search. Anywhere
518
584
  else, bind it with `v-model` to `filters.search`. The search matches any visible column that is
519
585
  not marked `searchable: false`.
520
- - **Matching** is case- and accent-insensitive (`nis` finds *Niš*). Dates compare by calendar day
586
+ - **Matching** is case- and accent-insensitive (`nis` finds _Niš_). Dates compare by calendar day
521
587
  in the grid's `timeZone`; a date-only string (`2026-01-05`) is that calendar day in every time
522
588
  zone, for filtering and for the `date` renderer. Column filters combine with AND, and then the
523
589
  search must match too. Saved filters for columns that no longer exist are ignored.
@@ -529,18 +595,43 @@ const columns = [
529
595
  The list is fetched when the popover opens and again on every search (debounced). Superseded
530
596
  requests are cancelled.
531
597
  - The header menu has **Filter… / Clear filter / Clear all filters** items. When filters hide
532
- every row, the grid shows `noMatchText` with a *Clear filters* button.
598
+ every row, the grid shows `noMatchText` with a _Clear filters_ button.
533
599
 
534
600
  The model is plain JSON, so you can store it, put it in the URL or send it to an API as is:
535
601
 
536
602
  ```ts
537
- interface FilterState { columns: Record<string, ColumnFilter>; search?: string }
603
+ interface FilterState {
604
+ columns: Record<string, ColumnFilter>
605
+ search?: string
606
+ }
538
607
  type ColumnFilter =
539
- | { type: 'text'; op: 'contains' | 'notContains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'empty' | 'notEmpty'; value?: string }
540
- | { type: 'number'; op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'; value?: number | null; to?: number | null }
541
- | { type: 'date'; op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'; value?: string; to?: string } // YYYY-MM-DD
608
+ | {
609
+ type: 'text'
610
+ op:
611
+ | 'contains'
612
+ | 'notContains'
613
+ | 'equals'
614
+ | 'notEquals'
615
+ | 'startsWith'
616
+ | 'endsWith'
617
+ | 'empty'
618
+ | 'notEmpty'
619
+ value?: string
620
+ }
621
+ | {
622
+ type: 'number'
623
+ op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'
624
+ value?: number | null
625
+ to?: number | null
626
+ }
627
+ | {
628
+ type: 'date'
629
+ op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'
630
+ value?: string
631
+ to?: string
632
+ } // YYYY-MM-DD
542
633
  | { type: 'boolean'; value: boolean | null }
543
- | { type: 'set'; values: string[] } // '' stands for blank cells
634
+ | { type: 'set'; values: string[] } // '' stands for blank cells
544
635
  | { type: 'custom'; value: unknown }
545
636
  ```
546
637
 
@@ -560,7 +651,13 @@ itself; it shows exactly what the function returns.
560
651
 
561
652
  ```vue
562
653
  <script setup lang="ts">
563
- import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
654
+ import {
655
+ filteringFeature,
656
+ paginationFeature,
657
+ serverDataFeature,
658
+ sortingFeature,
659
+ type DataSource,
660
+ } from '@nocopypaste/vue-grid'
564
661
 
565
662
  const fetchBets: DataSource<Bet> = async (query, { signal }) => {
566
663
  // query: { sort: { key, dir } | null, filters: FilterState, page: number, pageSize: number | null }
@@ -571,15 +668,23 @@ const fetchBets: DataSource<Bet> = async (query, { signal }) => {
571
668
  </script>
572
669
 
573
670
  <template>
574
- <VGrid ref="grid" :data-source="fetchBets" :columns row-key="id" pagination filter-row @load-error="toast"
575
- :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" />
671
+ <VGrid
672
+ ref="grid"
673
+ :data-source="fetchBets"
674
+ :columns
675
+ row-key="id"
676
+ pagination
677
+ filter-row
678
+ @load-error="toast"
679
+ :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]"
680
+ />
576
681
  </template>
577
682
  ```
578
683
 
579
684
  - **Cancellation.** A new query aborts the previous request through `signal`, and a late response
580
685
  from a superseded request is ignored, so fast typing never shows stale rows.
581
686
  - **States.** The grid shows a progress bar while loading. If the function throws, it shows
582
- *Couldn't load the rows.* with a *Retry* button and emits `load-error`.
687
+ _Couldn't load the rows._ with a _Retry_ button and emits `load-error`.
583
688
  - **Paging.** `pagination` adds the pager and sends `page` / `pageSize`; return `total` so the
584
689
  pager knows how many pages there are. Without `pagination`, `pageSize` is `null` (fetch
585
690
  everything). The page resets to 1 when sort or filters change.
@@ -591,8 +696,16 @@ and `filter-mode="controlled"`, and handle one event. The grid emits the combine
591
696
  and on every change, and skips duplicates:
592
697
 
593
698
  ```vue
594
- <VGrid :rows="rows" :columns row-key="id" :loading="loading" :features="[sortingFeature, filteringFeature]"
595
- sort-mode="controlled" filter-mode="controlled" @query-change="load" />
699
+ <VGrid
700
+ :rows="rows"
701
+ :columns
702
+ row-key="id"
703
+ :loading="loading"
704
+ :features="[sortingFeature, filteringFeature]"
705
+ sort-mode="controlled"
706
+ filter-mode="controlled"
707
+ @query-change="load"
708
+ />
596
709
  ```
597
710
 
598
711
  Use this when the data comes from a store, a WebSocket or a GraphQL client that you already manage.
@@ -603,14 +716,34 @@ Use this when the data comes from a store, a WebSocket or a GraphQL client that
603
716
  filtered rows; with a `dataSource` it requests pages.
604
717
 
605
718
  ```vue
606
- <VGrid :rows :columns row-key="id" :features="[paginationFeature]" :pagination="{ pageSizes: [10, 25, 50] }" v-model:page="page" v-model:page-size="pageSize" />
719
+ <VGrid
720
+ :rows
721
+ :columns
722
+ row-key="id"
723
+ :features="[paginationFeature]"
724
+ :pagination="{ pageSizes: [10, 25, 50] }"
725
+ v-model:page="page"
726
+ v-model:page-size="pageSize"
727
+ />
607
728
  ```
608
729
 
609
730
  Or place the standalone component yourself and feed the grid one page at a time:
610
731
 
611
732
  ```vue
612
- <VGrid v-model:sort="sort" :rows="pageRows" :columns row-key="id" :loading="loading" :features="[sortingFeature]" />
613
- <VGridPagination v-model:page="page" v-model:page-size="pageSize" :total="total" :page-sizes="[10, 25, 50]" />
733
+ <VGrid
734
+ v-model:sort="sort"
735
+ :rows="pageRows"
736
+ :columns
737
+ row-key="id"
738
+ :loading="loading"
739
+ :features="[sortingFeature]"
740
+ />
741
+ <VGridPagination
742
+ v-model:page="page"
743
+ v-model:page-size="pageSize"
744
+ :total="total"
745
+ :page-sizes="[10, 25, 50]"
746
+ />
614
747
  ```
615
748
 
616
749
  ## Pinned rows and totals
@@ -670,14 +803,25 @@ const columns = [
670
803
  col({ key: 'city', field: 'player.city', groupable: true }),
671
804
  col({ key: 'status', renderer: statusRenderer, groupable: true }),
672
805
  col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
673
- col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (b) => b.placedAt.slice(0, 7) }),
806
+ col({
807
+ key: 'placedAt',
808
+ renderer: dateRenderer,
809
+ groupable: true,
810
+ groupValue: (b) => b.placedAt.slice(0, 7),
811
+ }),
674
812
  ]
675
813
  const groupBy = ref(['status', 'city'])
676
814
  </script>
677
815
 
678
816
  <template>
679
- <VGrid v-model:group-by="groupBy" :rows="bets" :columns="columns" row-key="id" totals
680
- :features="[rowGroupingFeature, aggregationFeature]" />
817
+ <VGrid
818
+ v-model:group-by="groupBy"
819
+ :rows="bets"
820
+ :columns="columns"
821
+ row-key="id"
822
+ totals
823
+ :features="[rowGroupingFeature, aggregationFeature]"
824
+ />
681
825
  </template>
682
826
  ```
683
827
 
@@ -687,6 +831,11 @@ const groupBy = ref(['status', 'city'])
687
831
  an `aggregate`; those show the group's own aggregate. The `group-<key>` slot renders the value
688
832
  yourself (`{ value, count, rows, column, group }`); `total-<key>` also renders group cells
689
833
  (with `group` set). Empty values form a `(blank)` group, last.
834
+ - **In a narrow column** (a fixed-width first column followed by an aggregate) the label never
835
+ widens the column: under 12rem the column name is dropped, then the value is cut with an
836
+ ellipsis; the count stays. The whole label (“City: Novi Sad (12)”) is the cell's tooltip.
837
+ - **Keyboard.** ↑ / ↓ keep their column across a group row, even though its label spans several:
838
+ from Stake up onto a group row lands on its Stake aggregate, and back down on Stake.
690
839
  - **Order, filters, pages.** Groups follow the filters and are ordered by value, descending when
691
840
  the grid is sorted descending by the grouped column; sorting by any other column orders the
692
841
  rows inside each group. Pagination pages the top-level groups. With server data, the rows of
@@ -696,8 +845,8 @@ const groupBy = ref(['status', 'city'])
696
845
  Changing `group-by` starts over.
697
846
  - **Selection.** A group's checkbox selects or clears every row in it, and shows partly
698
847
  selected groups as indeterminate.
699
- - **Header menu.** Columns with `groupable: true` get *Group by* (adds a level) / *Ungroup*, and
700
- *Ungroup all*. Any column can be grouped through `v-model:group-by`.
848
+ - **Header menu.** Columns with `groupable: true` get _Group by_ (adds a level) / _Ungroup_, and
849
+ _Ungroup all_. Any column can be grouped through `v-model:group-by`.
701
850
  - **Virtual scrolling.** Group rows are part of the virtual layout: thousands of rows in a few
702
851
  groups render only what's in view.
703
852
 
@@ -724,9 +873,16 @@ const columns = [
724
873
  <template>
725
874
  <button @click="grid?.exportCsv({ filename: 'orders.csv', totals: true })">Download CSV</button>
726
875
  <button @click="grid?.copyRows()">Copy selected</button>
727
- <VGrid ref="grid" :rows="orders" :columns="columns" row-key="id" selectable totals
728
- :features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
729
- @copy="(e) => toast(`Copied ${e.rows.length} rows`)" />
876
+ <VGrid
877
+ ref="grid"
878
+ :rows="orders"
879
+ :columns="columns"
880
+ row-key="id"
881
+ selectable
882
+ totals
883
+ :features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
884
+ @copy="(e) => toast(`Copied ${e.rows.length} rows`)"
885
+ />
730
886
  </template>
731
887
  ```
732
888
 
@@ -763,8 +919,14 @@ and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(t
763
919
  ## Virtual scrolling
764
920
 
765
921
  ```vue
766
- <VGrid :rows="tenThousandRows" :columns row-key="id" :features="[virtualScrollingFeature]"
767
- :virtual="{ rowHeight: 40 }" style="height: 600px" />
922
+ <VGrid
923
+ :rows="tenThousandRows"
924
+ :columns
925
+ row-key="id"
926
+ :features="[virtualScrollingFeature]"
927
+ :virtual="{ rowHeight: 40 }"
928
+ style="height: 600px"
929
+ />
768
930
  ```
769
931
 
770
932
  Rows have a fixed height; only the visible window plus `overscan` is rendered.
@@ -863,44 +1025,48 @@ Screenshots of every renderer are in the repository README's
863
1025
 
864
1026
  **Display**
865
1027
 
866
- | Name | Options |
867
- |---|---|
868
- | `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
869
- | `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
870
- | `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
871
- | `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
872
- | `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
873
- | `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
874
- | `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
875
- | `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
876
- | `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
877
- | `multi-line` | `lines` (builder; default: the value array), `boldLines`, `ellipsis`, `target`, `placeholder`; each line: `{ text, href, to, tone, fill, bold, muted, tooltip, trend, action, badge }` |
878
- | `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
879
- | `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
880
- | `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
881
- | `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
882
- | `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
883
- | `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
884
- | `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
885
- | `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
886
-
887
- **Actions and editing** — editable renderers are *controlled*: they show the data and emit the requested
1028
+ | Name | Options |
1029
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1030
+ | `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
1031
+ | `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
1032
+ | `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
1033
+ | `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
1034
+ | `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
1035
+ | `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
1036
+ | `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
1037
+ | `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
1038
+ | `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
1039
+ | `multi-line` | `lines` (builder; default: the value array), `boldLines`, `ellipsis`, `target`, `placeholder`; each line: `{ text, href, to, tone, fill, bold, muted, tooltip, trend, action, badge }` |
1040
+ | `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
1041
+ | `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
1042
+ | `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
1043
+ | `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
1044
+ | `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
1045
+ | `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
1046
+ | `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
1047
+ | `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
1048
+
1049
+ **Actions and editing** — editable renderers are _controlled_: they show the data and emit the requested
888
1050
  change; your `@cell-action` handler updates the row.
889
1051
 
890
- | Name | Options → emits |
891
- |---|---|
892
- | `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
893
- | `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
894
- | `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
895
- | `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
896
- | `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
897
- | `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
898
- | `radio` | same + `name` → `select` (payload: the row key) |
899
- | `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
1052
+ | Name | Options → emits |
1053
+ | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
1054
+ | `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
1055
+ | `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
1056
+ | `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
1057
+ | `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
1058
+ | `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
1059
+ | `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
1060
+ | `radio` | same + `name` → `select` (payload: the row key) |
1061
+ | `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
900
1062
 
901
1063
  ```vue
902
- <VGrid :rows="rows" :columns="[{ key: 'web', renderer: 'switch' }]" row-key="id"
903
- @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)" />
1064
+ <VGrid
1065
+ :rows="rows"
1066
+ :columns="[{ key: 'web', renderer: 'switch' }]"
1067
+ row-key="id"
1068
+ @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)"
1069
+ />
904
1070
  ```
905
1071
 
906
1072
  Values option callbacks receive `(value, row)`. The component of every renderer is exported too
@@ -919,17 +1085,24 @@ const props = defineProps<CellRendererProps<unknown, number, { max?: number }>>(
919
1085
  const emit = defineEmits<CellRendererEmits>()
920
1086
  </script>
921
1087
  <template>
922
- <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">{{ n <= value ? '★' : '☆' }}</button>
1088
+ <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">
1089
+ {{ n <= value ? '★' : '☆' }}
1090
+ </button>
923
1091
  </template>
924
1092
  ```
925
1093
 
926
1094
  ```ts
927
1095
  import { defineCellRenderer } from '@nocopypaste/vue-grid'
928
1096
  declare module '@nocopypaste/vue-grid' {
929
- interface CellRendererRegistry { rating: { max?: number } } // typed `renderer: 'rating'`
1097
+ interface CellRendererRegistry {
1098
+ rating: { max?: number }
1099
+ } // typed `renderer: 'rating'`
930
1100
  }
931
1101
  export const ratingRenderer = defineCellRenderer<{ max?: number }>({
932
- name: 'rating', component: RatingCell, defaults: { max: 5 }, sortValue: (v) => Number(v),
1102
+ name: 'rating',
1103
+ component: RatingCell,
1104
+ defaults: { max: 5 },
1105
+ sortValue: (v) => Number(v),
933
1106
  // what Ctrl+C and formatted CSV exports copy (export feature); without it the raw value
934
1107
  format: (v, options, ctx, row) => `${Number(v ?? 0)} of ${options.max ?? 5}`,
935
1108
  })
@@ -955,14 +1128,14 @@ Override any token on `:root`, a wrapper, or the grid itself:
955
1128
  }
956
1129
  ```
957
1130
 
958
- | Group | Tokens |
959
- |---|---|
960
- | Type | `--vg-font-family` `--vg-font-size` `--vg-line-height` `--vg-header-font-size` `--vg-header-font-weight` `--vg-header-letter-spacing` `--vg-header-text-transform` |
961
- | Colour | `--vg-color-text` `-text-muted` `-surface` `-surface-raised` `-header-bg` `-header-text` `-border` `-border-strong` `-row-hover` `-row-selected` `-row-highlight` `-accent` `-accent-contrast` `-focus-ring` `-success` `-danger` `-warning` `-info` `-neutral` |
962
- | Space & shape | `--vg-cell-padding-x/y` `--vg-header-padding-x/y` `--vg-gap` `--vg-radius` `--vg-radius-sm` `--vg-radius-pill` `--vg-border-width` `--vg-row-border` `--vg-header-border` `--vg-outer-border` `--vg-select-column-width` `--vg-expander-size` |
963
- | Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
964
- | Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
965
- | Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
1131
+ | Group | Tokens |
1132
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1133
+ | Type | `--vg-font-family` `--vg-font-size` `--vg-line-height` `--vg-header-font-size` `--vg-header-font-weight` `--vg-header-letter-spacing` `--vg-header-text-transform` |
1134
+ | Colour | `--vg-color-text` `-text-muted` `-surface` `-surface-raised` `-header-bg` `-header-text` `-border` `-border-strong` `-row-hover` `-row-selected` `-row-highlight` `-accent` `-accent-contrast` `-focus-ring` `-success` `-danger` `-warning` `-info` `-neutral` |
1135
+ | Space & shape | `--vg-cell-padding-x/y` `--vg-header-padding-x/y` `--vg-gap` `--vg-radius` `--vg-radius-sm` `--vg-radius-pill` `--vg-border-width` `--vg-row-border` `--vg-header-border` `--vg-outer-border` `--vg-select-column-width` `--vg-expander-size` |
1136
+ | Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
1137
+ | Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
1138
+ | Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
966
1139
 
967
1140
  Motion stays on the compositor (`transform`, `opacity`) wherever layout would otherwise animate.
968
1141
  Row highlights (hover, selection) appear at once and fade out over `--vg-transition`, so the grid
@@ -985,10 +1158,21 @@ import './my-grid-theme.css'
985
1158
 
986
1159
  ```css
987
1160
  /* my-grid-theme.css — unlayered, or in your own layer after `vue-grid` */
988
- .vg-viewport { border: 1px solid #ddd; }
989
- .vg-header-cell { padding: 0.5rem 0.75rem; background: #fafafa; font-weight: 600; }
990
- .vg-cell { padding: 0.5rem 0.75rem; border-top: 1px solid #eee; }
991
- .vg-row:hover > .vg-cell { background: #f5f5f5; }
1161
+ .vg-viewport {
1162
+ border: 1px solid #ddd;
1163
+ }
1164
+ .vg-header-cell {
1165
+ padding: 0.5rem 0.75rem;
1166
+ background: #fafafa;
1167
+ font-weight: 600;
1168
+ }
1169
+ .vg-cell {
1170
+ padding: 0.5rem 0.75rem;
1171
+ border-top: 1px solid #eee;
1172
+ }
1173
+ .vg-row:hover > .vg-cell {
1174
+ background: #f5f5f5;
1175
+ }
992
1176
  ```
993
1177
 
994
1178
  Base only gives sticky header and pinned cells the system `Canvas` background, so content doesn't
@@ -1011,8 +1195,8 @@ import { validateGridConfig } from '@nocopypaste/vue-grid/agent'
1011
1195
 
1012
1196
  const { ok, diagnostics } = validateGridConfig({
1013
1197
  rowKey: 'id',
1014
- features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
1015
- renderers: [], // registered renderer names / definitions
1198
+ features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
1199
+ renderers: [], // registered renderer names / definitions
1016
1200
  columns: [{ key: 'total', renderer: 'currency', sortable: true, widht: '8rem' }],
1017
1201
  })
1018
1202
  // error columns[0].widht Columns have no option `widht`. Did you mean `width`?
@@ -1032,16 +1216,16 @@ Evergreen browsers: CSS `subgrid`, `light-dark()`, `@layer`, the Popover API and
1032
1216
  **CSS first, JS only as a fallback.** Everything the browser can do in CSS / HTML is done there; a
1033
1217
  small JS fallback runs only when a feature check (`CSS.supports`) says the browser can't:
1034
1218
 
1035
- | Behaviour | Done with | JS fallback when unsupported |
1036
- |---|---|---|
1037
- | Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
1038
- | Hiding a popover once its anchor scrolls out of view | `position-visibility: anchor-visible` | IntersectionObserver (e.g. Firefox 159) |
1039
- | Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
1040
- | Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
1041
- | Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
1042
- | Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
1043
- | Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
1044
- | Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
1219
+ | Behaviour | Done with | JS fallback when unsupported |
1220
+ | ------------------------------------------------------------------ | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1221
+ | Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
1222
+ | Hiding a popover once its anchor scrolls out of view | `position-visibility: anchor-visible` | IntersectionObserver, always on as well (Firefox 159 parses only an older value; WebKit / Safari 27 accepts it but keeps a popover whose anchor is clipped by the grid) |
1223
+ | Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
1224
+ | Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
1225
+ | Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
1226
+ | Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
1227
+ | Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
1228
+ | Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
1045
1229
 
1046
1230
  What stays in JS is what CSS can't express: data (sorting, selection, expansion state), keyboard
1047
1231
  navigation, column drag, virtual scrolling and lazy loading.