@nocopypaste/vue-grid 0.3.1 → 0.4.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.
Files changed (124) hide show
  1. package/AGENTS.md +249 -84
  2. package/CHANGELOG.md +26 -0
  3. package/README.md +417 -228
  4. package/agent/api.json +101 -91
  5. package/agent/api.md +86 -85
  6. package/agent/grid-config.schema.json +22 -5
  7. package/dist/agent/api.js +99 -91
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/agent/requirements.js +3 -1
  10. package/dist/agent/requirements.js.map +1 -1
  11. package/dist/agent/validate.js.map +1 -1
  12. package/dist/base.css +1 -1
  13. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +196 -183
  14. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +1 -1
  19. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  21. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +9 -4
  22. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
  23. package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  24. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  25. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +4 -4
  27. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  29. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +1 -1
  30. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  31. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  32. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +2 -2
  33. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  34. package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  35. package/dist/composables/useColumnDrag.js.map +1 -1
  36. package/dist/composables/useColumnResize.js.map +1 -1
  37. package/dist/composables/useDataSource.js.map +1 -1
  38. package/dist/composables/useGridExport.js.map +1 -1
  39. package/dist/composables/useGridFilters.js.map +1 -1
  40. package/dist/composables/useGridKeyboard.js +46 -36
  41. package/dist/composables/useGridKeyboard.js.map +1 -1
  42. package/dist/composables/useGridMenus.js.map +1 -1
  43. package/dist/composables/useGridSelection.js.map +1 -1
  44. package/dist/composables/usePinFit.js +41 -0
  45. package/dist/composables/usePinFit.js.map +1 -0
  46. package/dist/composables/usePinnedRows.js.map +1 -1
  47. package/dist/composables/useRowGrouping.js.map +1 -1
  48. package/dist/composables/useTotals.js.map +1 -1
  49. package/dist/composables/useVirtualRows.js.map +1 -1
  50. package/dist/core/aggregate.js.map +1 -1
  51. package/dist/core/columns.js.map +1 -1
  52. package/dist/core/csv.js.map +1 -1
  53. package/dist/core/filter.js.map +1 -1
  54. package/dist/core/grouping.js.map +1 -1
  55. package/dist/core/pagination.js.map +1 -1
  56. package/dist/core/patch.js.map +1 -1
  57. package/dist/core/selection.js.map +1 -1
  58. package/dist/core/sort.js.map +1 -1
  59. package/dist/core/storage.js.map +1 -1
  60. package/dist/core/value.js.map +1 -1
  61. package/dist/core.css +1 -1
  62. package/dist/features/aggregation.js.map +1 -1
  63. package/dist/features/columnGroups.js.map +1 -1
  64. package/dist/features/columnPinning.js +8 -6
  65. package/dist/features/columnPinning.js.map +1 -1
  66. package/dist/features/columnVisibility.js.map +1 -1
  67. package/dist/features/filtering.js.map +1 -1
  68. package/dist/features/keyboardNavigation.js.map +1 -1
  69. package/dist/features/menus.js.map +1 -1
  70. package/dist/features/rowGrouping.js.map +1 -1
  71. package/dist/features/rowPinning.js.map +1 -1
  72. package/dist/features/selection.js.map +1 -1
  73. package/dist/features/virtualScrolling.js.map +1 -1
  74. package/dist/internal/RenderSlot.js.map +1 -1
  75. package/dist/internal/anchor.js.map +1 -1
  76. package/dist/internal/context.js.map +1 -1
  77. package/dist/internal/supports.js.map +1 -1
  78. package/dist/internal/touchHold.js.map +1 -1
  79. package/dist/registry/plugin.js.map +1 -1
  80. package/dist/registry/registry.js.map +1 -1
  81. package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  83. package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  84. package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  86. package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  87. package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  89. package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  91. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  92. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  93. package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  95. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  96. package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  97. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  98. package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  99. package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  100. package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  101. package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/renderers/format.js.map +1 -1
  103. package/dist/renderers/index.js.map +1 -1
  104. package/dist/renderers/options.js.map +1 -1
  105. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  106. package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
  107. package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  108. package/dist/renderers/parts/icons.js.map +1 -1
  109. package/dist/renderers/parts/useToggleControl.js.map +1 -1
  110. package/dist/renderers/plainText.js.map +1 -1
  111. package/dist/renderers/text.js.map +1 -1
  112. package/dist/theme.css +1 -1
  113. package/dist/types/agent/index.d.ts +2 -2
  114. package/dist/types/components/VGrid.vue.d.ts +6 -0
  115. package/dist/types/composables/usePinFit.d.ts +17 -0
  116. package/dist/types/features/columnPinning.d.ts +3 -1
  117. package/dist/types/renderers/NumberCell.vue.d.ts +2 -4
  118. package/dist/types/renderers/index.d.ts +3 -5
  119. package/dist/types/renderers/options.d.ts +45 -0
  120. package/dist/types/renderers/plainText.d.ts +2 -4
  121. package/dist/types/types.d.ts +36 -0
  122. package/dist/vue-grid.css +1 -1
  123. package/llms-full.txt +752 -397
  124. 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; while they'd take more than `pinned-max-share` of the grid (half), they scroll like the others; 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,57 @@ 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
+ | `pinnedMaxShare` | `number \| false` | `0.5` | Pinned columns scroll like the others while together they'd take more than this share of the grid's width (a phone, a narrow panel), and pin again once there's room. `false`: always pinned. Needs `columnPinningFeature`. |
237
+ | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
238
+ | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
239
+ | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
240
+ | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
241
+ | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
242
+ | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
243
+ | `v-model:selected` | `RowKey[]` | `[]` | |
244
+ | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
245
+ | `isRowSelectable` | `(row) => boolean` | — | |
246
+ | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
247
+ | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
248
+ | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
249
+ | `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). |
250
+ | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
251
+ | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
252
+ | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
253
+ | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
254
+ | `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). |
255
+ | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
256
+ | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
257
+ | `rowClass` | `(row, index) => ClassValue` | — | |
258
+ | `highlightedRows` | `RowKey[]` | — | |
259
+ | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
260
+ | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
261
+ | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
262
+ | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
263
+ | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
264
+ | `emptyText` | `string` | `'No data to show.'` | |
265
+ | `ariaLabel` | `string` | — | |
266
+ | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
267
+ | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
268
+ | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
251
269
 
252
270
  ### Events
253
271
 
@@ -354,8 +372,16 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
354
372
  `#toolbar` slot gets them too, so a batch-action bar lives in the grid:
355
373
 
356
374
  ```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]">
375
+ <VGrid
376
+ v-model:selected="selected"
377
+ :rows="requests"
378
+ :columns="columns"
379
+ row-key="id"
380
+ selectable
381
+ prune-selection
382
+ :is-row-selectable="(r) => r.status === 'pending'"
383
+ :features="[selectionFeature]"
384
+ >
359
385
  <template #toolbar="{ selected, selectedCount, clearSelection }">
360
386
  <template v-if="selectedCount">
361
387
  {{ selectedCount }} selected
@@ -376,11 +402,11 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
376
402
  selection can span server pages. `prune-selection` drops them instead: after a reload, a batch
377
403
  delete or a new page, `selected` only holds rows that exist.
378
404
  - **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
405
+ page; a banner then offers _Select all N rows_ (N = the `total` the source returned). That sets
380
406
  `v-model:select-all-matching`: every row shows ticked, `selectedCount` is N, and your batch
381
407
  action should run on the query (`@query-change`) rather than on `selected`. Changing the
382
408
  filters, unticking a row (the keys already in `selected` stay, plus the rest of the loaded page) or
383
- *Clear selection* ends it.
409
+ _Clear selection_ ends it.
384
410
  - `grid.clearSelection()` clears it all from code. Cascading through sub-grids, group checkboxes
385
411
  (row grouping) and copying the selected rows (export feature) work as described in their
386
412
  sections.
@@ -388,7 +414,13 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
388
414
  ## Sub-grids (CSS `subgrid`)
389
415
 
390
416
  ```vue
391
- <VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(row) => row.children" selectable />
417
+ <VGrid
418
+ :rows="markets"
419
+ :columns="columns"
420
+ row-key="id"
421
+ :sub-rows="(row) => row.children"
422
+ selectable
423
+ />
392
424
  ```
393
425
 
394
426
  Expanded children render inside a `.vg-subgrid` element that spans every column and uses
@@ -402,7 +434,13 @@ Need children with a **different** set of columns? Put another `<VGrid>` in the
402
434
  ## Column menu, reorder, persistence
403
435
 
404
436
  ```vue
405
- <VGrid :rows :columns row-key="id" storage="orders-grid" :features="[columnVisibilityFeature, columnReorderFeature]">
437
+ <VGrid
438
+ :rows
439
+ :columns
440
+ row-key="id"
441
+ storage="orders-grid"
442
+ :features="[columnVisibilityFeature, columnReorderFeature]"
443
+ >
406
444
  <!-- the picker hides columns (columnVisibilityFeature); dragging headers needs columnReorderFeature -->
407
445
  <template #toolbar="{ columnState, setColumnState }">
408
446
  <VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
@@ -425,13 +463,20 @@ scrolls. No JS positioning, except a small fallback for browsers without anchor
425
463
 
426
464
  ```vue
427
465
  <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
- ]"
466
+ :rows
467
+ :columns
468
+ row-key="id"
469
+ :context-menu="
470
+ ({ row, column, value }) =>
471
+ column.key === 'link'
472
+ ? []
473
+ : [
474
+ { name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
475
+ { name: 'open', label: `Open #${row.id}` },
476
+ { separator: true },
477
+ { name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
478
+ ]
479
+ "
435
480
  @context-action="({ name, row, column, value }) => run(name, row)"
436
481
  />
437
482
  ```
@@ -449,9 +494,14 @@ Pin items need `columnPinningFeature`, move items `columnReorderFeature`, Hide c
449
494
 
450
495
  ```vue
451
496
  <!-- 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 -->
497
+ <VGrid
498
+ :header-menu="
499
+ ({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]
500
+ "
501
+ @header-action="({ name, column }) => …"
502
+ />
503
+ <VGrid :header-menu="false" />
504
+ <!-- off -->
455
505
  ```
456
506
 
457
507
  Columns opt out with `pinnable: false`, `reorderable: false`, `hideable: false`.
@@ -470,23 +520,39 @@ The same component powers the `actions-menu` renderer and is exported for add-on
470
520
 
471
521
  ```vue
472
522
  <script setup lang="ts">
473
- import { VGrid, VGridSearch, filteringFeature, numberRenderer, statusRenderer, type FilterState } from '@nocopypaste/vue-grid'
523
+ import {
524
+ VGrid,
525
+ VGridSearch,
526
+ filteringFeature,
527
+ numberRenderer,
528
+ statusRenderer,
529
+ type FilterState,
530
+ } from '@nocopypaste/vue-grid'
474
531
 
475
532
  const filters = ref<FilterState | null>(null)
476
533
  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
534
+ { key: 'player', header: 'Player', filterable: true }, // text
535
+ { key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
536
+ { key: 'status', header: 'Status', filterable: true, renderer: statusRenderer }, // value list
537
+ { key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
481
538
  ]
482
539
  </script>
483
540
 
484
541
  <template>
485
- <VGrid v-model:filters="filters" :rows :columns row-key="id" :features="[filteringFeature]"
486
- filter-row filter-storage="bets-filters">
542
+ <VGrid
543
+ v-model:filters="filters"
544
+ :rows
545
+ :columns
546
+ row-key="id"
547
+ :features="[filteringFeature]"
548
+ filter-row
549
+ filter-storage="bets-filters"
550
+ >
487
551
  <template #toolbar="{ activeFilterCount, clearFilters }">
488
552
  <VGridSearch />
489
- <button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }} filters</button>
553
+ <button v-if="activeFilterCount" @click="clearFilters()">
554
+ Clear {{ activeFilterCount }} filters
555
+ </button>
490
556
  </template>
491
557
  </VGrid>
492
558
  </template>
@@ -497,18 +563,19 @@ const columns = [
497
563
  popover through the Popover API and CSS anchor positioning, and the popover holds an editor for
498
564
  the column's type:
499
565
 
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`) |
566
+ | Type | Editor | Operators |
567
+ | --------- | ------------------------------------ | -------------------------------------------------------------------------------------------------- |
568
+ | `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
569
+ | `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
570
+ | `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
571
+ | `boolean` | radio group | any, yes, no, empty |
572
+ | `set` | searchable checkbox list with counts | (the selected values) |
573
+ | `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
508
574
 
509
575
  The type comes from `filter`, else from the renderer (number, currency, change → `number`;
510
576
  date, datetime → `date`; boolean, checkbox, switch → `boolean`; status, chip → `set`), else
511
577
  `text`.
578
+
512
579
  - **Filter row** (`filter-row`). An inline input under each header that accepts shorthand:
513
580
  `>10`, `>=10`, `5..20`, `-5..-1`, open ranges `5..` / `..20`, `!=3`, a decimal comma (`1,5`),
514
581
  and `>2026-01-01` or `2026-01-01..2026-03-31` for dates; plain text for text columns. Input that
@@ -517,7 +584,7 @@ const columns = [
517
584
  - **Quick search.** `<VGridSearch>` inside the `#toolbar` slot drives that grid's search. Anywhere
518
585
  else, bind it with `v-model` to `filters.search`. The search matches any visible column that is
519
586
  not marked `searchable: false`.
520
- - **Matching** is case- and accent-insensitive (`nis` finds *Niš*). Dates compare by calendar day
587
+ - **Matching** is case- and accent-insensitive (`nis` finds _Niš_). Dates compare by calendar day
521
588
  in the grid's `timeZone`; a date-only string (`2026-01-05`) is that calendar day in every time
522
589
  zone, for filtering and for the `date` renderer. Column filters combine with AND, and then the
523
590
  search must match too. Saved filters for columns that no longer exist are ignored.
@@ -529,18 +596,43 @@ const columns = [
529
596
  The list is fetched when the popover opens and again on every search (debounced). Superseded
530
597
  requests are cancelled.
531
598
  - 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.
599
+ every row, the grid shows `noMatchText` with a _Clear filters_ button.
533
600
 
534
601
  The model is plain JSON, so you can store it, put it in the URL or send it to an API as is:
535
602
 
536
603
  ```ts
537
- interface FilterState { columns: Record<string, ColumnFilter>; search?: string }
604
+ interface FilterState {
605
+ columns: Record<string, ColumnFilter>
606
+ search?: string
607
+ }
538
608
  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
609
+ | {
610
+ type: 'text'
611
+ op:
612
+ | 'contains'
613
+ | 'notContains'
614
+ | 'equals'
615
+ | 'notEquals'
616
+ | 'startsWith'
617
+ | 'endsWith'
618
+ | 'empty'
619
+ | 'notEmpty'
620
+ value?: string
621
+ }
622
+ | {
623
+ type: 'number'
624
+ op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'
625
+ value?: number | null
626
+ to?: number | null
627
+ }
628
+ | {
629
+ type: 'date'
630
+ op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'
631
+ value?: string
632
+ to?: string
633
+ } // YYYY-MM-DD
542
634
  | { type: 'boolean'; value: boolean | null }
543
- | { type: 'set'; values: string[] } // '' stands for blank cells
635
+ | { type: 'set'; values: string[] } // '' stands for blank cells
544
636
  | { type: 'custom'; value: unknown }
545
637
  ```
546
638
 
@@ -560,7 +652,13 @@ itself; it shows exactly what the function returns.
560
652
 
561
653
  ```vue
562
654
  <script setup lang="ts">
563
- import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
655
+ import {
656
+ filteringFeature,
657
+ paginationFeature,
658
+ serverDataFeature,
659
+ sortingFeature,
660
+ type DataSource,
661
+ } from '@nocopypaste/vue-grid'
564
662
 
565
663
  const fetchBets: DataSource<Bet> = async (query, { signal }) => {
566
664
  // query: { sort: { key, dir } | null, filters: FilterState, page: number, pageSize: number | null }
@@ -571,15 +669,23 @@ const fetchBets: DataSource<Bet> = async (query, { signal }) => {
571
669
  </script>
572
670
 
573
671
  <template>
574
- <VGrid ref="grid" :data-source="fetchBets" :columns row-key="id" pagination filter-row @load-error="toast"
575
- :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" />
672
+ <VGrid
673
+ ref="grid"
674
+ :data-source="fetchBets"
675
+ :columns
676
+ row-key="id"
677
+ pagination
678
+ filter-row
679
+ @load-error="toast"
680
+ :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]"
681
+ />
576
682
  </template>
577
683
  ```
578
684
 
579
685
  - **Cancellation.** A new query aborts the previous request through `signal`, and a late response
580
686
  from a superseded request is ignored, so fast typing never shows stale rows.
581
687
  - **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`.
688
+ _Couldn't load the rows._ with a _Retry_ button and emits `load-error`.
583
689
  - **Paging.** `pagination` adds the pager and sends `page` / `pageSize`; return `total` so the
584
690
  pager knows how many pages there are. Without `pagination`, `pageSize` is `null` (fetch
585
691
  everything). The page resets to 1 when sort or filters change.
@@ -591,8 +697,16 @@ and `filter-mode="controlled"`, and handle one event. The grid emits the combine
591
697
  and on every change, and skips duplicates:
592
698
 
593
699
  ```vue
594
- <VGrid :rows="rows" :columns row-key="id" :loading="loading" :features="[sortingFeature, filteringFeature]"
595
- sort-mode="controlled" filter-mode="controlled" @query-change="load" />
700
+ <VGrid
701
+ :rows="rows"
702
+ :columns
703
+ row-key="id"
704
+ :loading="loading"
705
+ :features="[sortingFeature, filteringFeature]"
706
+ sort-mode="controlled"
707
+ filter-mode="controlled"
708
+ @query-change="load"
709
+ />
596
710
  ```
597
711
 
598
712
  Use this when the data comes from a store, a WebSocket or a GraphQL client that you already manage.
@@ -603,14 +717,34 @@ Use this when the data comes from a store, a WebSocket or a GraphQL client that
603
717
  filtered rows; with a `dataSource` it requests pages.
604
718
 
605
719
  ```vue
606
- <VGrid :rows :columns row-key="id" :features="[paginationFeature]" :pagination="{ pageSizes: [10, 25, 50] }" v-model:page="page" v-model:page-size="pageSize" />
720
+ <VGrid
721
+ :rows
722
+ :columns
723
+ row-key="id"
724
+ :features="[paginationFeature]"
725
+ :pagination="{ pageSizes: [10, 25, 50] }"
726
+ v-model:page="page"
727
+ v-model:page-size="pageSize"
728
+ />
607
729
  ```
608
730
 
609
731
  Or place the standalone component yourself and feed the grid one page at a time:
610
732
 
611
733
  ```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]" />
734
+ <VGrid
735
+ v-model:sort="sort"
736
+ :rows="pageRows"
737
+ :columns
738
+ row-key="id"
739
+ :loading="loading"
740
+ :features="[sortingFeature]"
741
+ />
742
+ <VGridPagination
743
+ v-model:page="page"
744
+ v-model:page-size="pageSize"
745
+ :total="total"
746
+ :page-sizes="[10, 25, 50]"
747
+ />
614
748
  ```
615
749
 
616
750
  ## Pinned rows and totals
@@ -670,14 +804,25 @@ const columns = [
670
804
  col({ key: 'city', field: 'player.city', groupable: true }),
671
805
  col({ key: 'status', renderer: statusRenderer, groupable: true }),
672
806
  col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
673
- col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (b) => b.placedAt.slice(0, 7) }),
807
+ col({
808
+ key: 'placedAt',
809
+ renderer: dateRenderer,
810
+ groupable: true,
811
+ groupValue: (b) => b.placedAt.slice(0, 7),
812
+ }),
674
813
  ]
675
814
  const groupBy = ref(['status', 'city'])
676
815
  </script>
677
816
 
678
817
  <template>
679
- <VGrid v-model:group-by="groupBy" :rows="bets" :columns="columns" row-key="id" totals
680
- :features="[rowGroupingFeature, aggregationFeature]" />
818
+ <VGrid
819
+ v-model:group-by="groupBy"
820
+ :rows="bets"
821
+ :columns="columns"
822
+ row-key="id"
823
+ totals
824
+ :features="[rowGroupingFeature, aggregationFeature]"
825
+ />
681
826
  </template>
682
827
  ```
683
828
 
@@ -687,6 +832,11 @@ const groupBy = ref(['status', 'city'])
687
832
  an `aggregate`; those show the group's own aggregate. The `group-<key>` slot renders the value
688
833
  yourself (`{ value, count, rows, column, group }`); `total-<key>` also renders group cells
689
834
  (with `group` set). Empty values form a `(blank)` group, last.
835
+ - **In a narrow column** (a fixed-width first column followed by an aggregate) the label never
836
+ widens the column: under 12rem the column name is dropped, then the value is cut with an
837
+ ellipsis; the count stays. The whole label (“City: Novi Sad (12)”) is the cell's tooltip.
838
+ - **Keyboard.** ↑ / ↓ keep their column across a group row, even though its label spans several:
839
+ from Stake up onto a group row lands on its Stake aggregate, and back down on Stake.
690
840
  - **Order, filters, pages.** Groups follow the filters and are ordered by value, descending when
691
841
  the grid is sorted descending by the grouped column; sorting by any other column orders the
692
842
  rows inside each group. Pagination pages the top-level groups. With server data, the rows of
@@ -696,8 +846,8 @@ const groupBy = ref(['status', 'city'])
696
846
  Changing `group-by` starts over.
697
847
  - **Selection.** A group's checkbox selects or clears every row in it, and shows partly
698
848
  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`.
849
+ - **Header menu.** Columns with `groupable: true` get _Group by_ (adds a level) / _Ungroup_, and
850
+ _Ungroup all_. Any column can be grouped through `v-model:group-by`.
701
851
  - **Virtual scrolling.** Group rows are part of the virtual layout: thousands of rows in a few
702
852
  groups render only what's in view.
703
853
 
@@ -724,9 +874,16 @@ const columns = [
724
874
  <template>
725
875
  <button @click="grid?.exportCsv({ filename: 'orders.csv', totals: true })">Download CSV</button>
726
876
  <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`)" />
877
+ <VGrid
878
+ ref="grid"
879
+ :rows="orders"
880
+ :columns="columns"
881
+ row-key="id"
882
+ selectable
883
+ totals
884
+ :features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
885
+ @copy="(e) => toast(`Copied ${e.rows.length} rows`)"
886
+ />
730
887
  </template>
731
888
  ```
732
889
 
@@ -763,8 +920,14 @@ and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(t
763
920
  ## Virtual scrolling
764
921
 
765
922
  ```vue
766
- <VGrid :rows="tenThousandRows" :columns row-key="id" :features="[virtualScrollingFeature]"
767
- :virtual="{ rowHeight: 40 }" style="height: 600px" />
923
+ <VGrid
924
+ :rows="tenThousandRows"
925
+ :columns
926
+ row-key="id"
927
+ :features="[virtualScrollingFeature]"
928
+ :virtual="{ rowHeight: 40 }"
929
+ style="height: 600px"
930
+ />
768
931
  ```
769
932
 
770
933
  Rows have a fixed height; only the visible window plus `overscan` is rendered.
@@ -846,6 +1009,10 @@ header moves the column; `Alt+Shift+←/→` on a header resizes it (with `colum
846
1009
  your own element inside a flex or grid layout, give that element `min-width: 0` too, or it
847
1010
  grows to the columns' width. The toolbar wraps, and on narrow screens the pager drops its
848
1011
  « / » buttons (page 1 and the last page stay).
1012
+ - **Pinned columns** that would take more than half of a narrow grid (`pinned-max-share`)
1013
+ scroll like the others there, so the rest of the row stays readable; they pin again once the
1014
+ grid is wide enough. The pins stay in the column state; `pinned-max-share="false"` keeps them
1015
+ pinned at any width.
849
1016
  - **Swipes scroll** the grid, also when they start on a header (except on a column's narrow
850
1017
  resize edge).
851
1018
  - **Hold a header** (about half a second) to pick the column up, then drag it to reorder
@@ -863,44 +1030,48 @@ Screenshots of every renderer are in the repository README's
863
1030
 
864
1031
  **Display**
865
1032
 
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
1033
+ | Name | Options |
1034
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1035
+ | `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
1036
+ | `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
1037
+ | `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
1038
+ | `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
1039
+ | `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
1040
+ | `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
1041
+ | `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
1042
+ | `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
1043
+ | `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
1044
+ | `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 }` |
1045
+ | `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
1046
+ | `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
1047
+ | `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
1048
+ | `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
1049
+ | `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
1050
+ | `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
1051
+ | `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
1052
+ | `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
1053
+
1054
+ **Actions and editing** — editable renderers are _controlled_: they show the data and emit the requested
888
1055
  change; your `@cell-action` handler updates the row.
889
1056
 
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) |
1057
+ | Name | Options → emits |
1058
+ | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
1059
+ | `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
1060
+ | `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
1061
+ | `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
1062
+ | `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
1063
+ | `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
1064
+ | `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
1065
+ | `radio` | same + `name` → `select` (payload: the row key) |
1066
+ | `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
900
1067
 
901
1068
  ```vue
902
- <VGrid :rows="rows" :columns="[{ key: 'web', renderer: 'switch' }]" row-key="id"
903
- @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)" />
1069
+ <VGrid
1070
+ :rows="rows"
1071
+ :columns="[{ key: 'web', renderer: 'switch' }]"
1072
+ row-key="id"
1073
+ @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)"
1074
+ />
904
1075
  ```
905
1076
 
906
1077
  Values option callbacks receive `(value, row)`. The component of every renderer is exported too
@@ -919,17 +1090,24 @@ const props = defineProps<CellRendererProps<unknown, number, { max?: number }>>(
919
1090
  const emit = defineEmits<CellRendererEmits>()
920
1091
  </script>
921
1092
  <template>
922
- <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">{{ n <= value ? '★' : '☆' }}</button>
1093
+ <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">
1094
+ {{ n <= value ? '★' : '☆' }}
1095
+ </button>
923
1096
  </template>
924
1097
  ```
925
1098
 
926
1099
  ```ts
927
1100
  import { defineCellRenderer } from '@nocopypaste/vue-grid'
928
1101
  declare module '@nocopypaste/vue-grid' {
929
- interface CellRendererRegistry { rating: { max?: number } } // typed `renderer: 'rating'`
1102
+ interface CellRendererRegistry {
1103
+ rating: { max?: number }
1104
+ } // typed `renderer: 'rating'`
930
1105
  }
931
1106
  export const ratingRenderer = defineCellRenderer<{ max?: number }>({
932
- name: 'rating', component: RatingCell, defaults: { max: 5 }, sortValue: (v) => Number(v),
1107
+ name: 'rating',
1108
+ component: RatingCell,
1109
+ defaults: { max: 5 },
1110
+ sortValue: (v) => Number(v),
933
1111
  // what Ctrl+C and formatted CSV exports copy (export feature); without it the raw value
934
1112
  format: (v, options, ctx, row) => `${Number(v ?? 0)} of ${options.max ?? 5}`,
935
1113
  })
@@ -955,14 +1133,14 @@ Override any token on `:root`, a wrapper, or the grid itself:
955
1133
  }
956
1134
  ```
957
1135
 
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` |
1136
+ | Group | Tokens |
1137
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1138
+ | 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` |
1139
+ | 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` |
1140
+ | 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` |
1141
+ | Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
1142
+ | Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
1143
+ | Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
966
1144
 
967
1145
  Motion stays on the compositor (`transform`, `opacity`) wherever layout would otherwise animate.
968
1146
  Row highlights (hover, selection) appear at once and fade out over `--vg-transition`, so the grid
@@ -985,10 +1163,21 @@ import './my-grid-theme.css'
985
1163
 
986
1164
  ```css
987
1165
  /* 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; }
1166
+ .vg-viewport {
1167
+ border: 1px solid #ddd;
1168
+ }
1169
+ .vg-header-cell {
1170
+ padding: 0.5rem 0.75rem;
1171
+ background: #fafafa;
1172
+ font-weight: 600;
1173
+ }
1174
+ .vg-cell {
1175
+ padding: 0.5rem 0.75rem;
1176
+ border-top: 1px solid #eee;
1177
+ }
1178
+ .vg-row:hover > .vg-cell {
1179
+ background: #f5f5f5;
1180
+ }
992
1181
  ```
993
1182
 
994
1183
  Base only gives sticky header and pinned cells the system `Canvas` background, so content doesn't
@@ -1011,8 +1200,8 @@ import { validateGridConfig } from '@nocopypaste/vue-grid/agent'
1011
1200
 
1012
1201
  const { ok, diagnostics } = validateGridConfig({
1013
1202
  rowKey: 'id',
1014
- features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
1015
- renderers: [], // registered renderer names / definitions
1203
+ features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
1204
+ renderers: [], // registered renderer names / definitions
1016
1205
  columns: [{ key: 'total', renderer: 'currency', sortable: true, widht: '8rem' }],
1017
1206
  })
1018
1207
  // error columns[0].widht Columns have no option `widht`. Did you mean `width`?
@@ -1032,16 +1221,16 @@ Evergreen browsers: CSS `subgrid`, `light-dark()`, `@layer`, the Popover API and
1032
1221
  **CSS first, JS only as a fallback.** Everything the browser can do in CSS / HTML is done there; a
1033
1222
  small JS fallback runs only when a feature check (`CSS.supports`) says the browser can't:
1034
1223
 
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, 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) |
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 |
1224
+ | Behaviour | Done with | JS fallback when unsupported |
1225
+ | ------------------------------------------------------------------ | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1226
+ | Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
1227
+ | 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) |
1228
+ | Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
1229
+ | Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
1230
+ | Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
1231
+ | Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
1232
+ | Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
1233
+ | Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
1045
1234
 
1046
1235
  What stays in JS is what CSS can't express: data (sorting, selection, expansion state), keyboard
1047
1236
  navigation, column drag, virtual scrolling and lazy loading.