@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/llms-full.txt CHANGED
@@ -44,51 +44,51 @@ JSON Schema. The `@nocopypaste/vue-grid-mcp` MCP server serves all of this as to
44
44
 
45
45
  ## Which feature for what
46
46
 
47
- | The user wants… | Feature(s) | Props / column options |
48
- |---|---|---|
49
- | Click a header to sort | `sortingFeature` | column `sortable: true`; `sort-mode="client"` (or handle `v-model:sort`) |
50
- | Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
51
- | Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
52
- | Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
53
- | Checkboxes / row selection, batch actions | `selectionFeature` | `selectable` (or `'single'`), `v-model:selected`, `is-row-selectable`, `prune-selection`; `#toolbar="{ selected, selectedCount, clearSelection }"`; server data: `v-model:select-all-matching` |
54
- | Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
55
- | An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
56
- | 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
57
- | Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
58
- | Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'` |
59
- | Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
60
- | Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
61
- | Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
62
- | Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
63
- | Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
64
- | A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
65
- | Group rows by a column ("by status, then city") | `rowGroupingFeature` | `v-model:group-by="['status', 'city']"`, `groups-expanded`; column `groupable: true` (header menu), `groupValue: (row) => …` (e.g. month); `aggregate` shows per group |
66
- | Download CSV, copy rows / cells (Ctrl+C) | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
67
- | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
68
- | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
69
- | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
47
+ | The user wants… | Feature(s) | Props / column options |
48
+ | ------------------------------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
49
+ | Click a header to sort | `sortingFeature` | column `sortable: true`; `sort-mode="client"` (or handle `v-model:sort`) |
50
+ | Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
51
+ | Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
52
+ | Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
53
+ | Checkboxes / row selection, batch actions | `selectionFeature` | `selectable` (or `'single'`), `v-model:selected`, `is-row-selectable`, `prune-selection`; `#toolbar="{ selected, selectedCount, clearSelection }"`; server data: `v-model:select-all-matching` |
54
+ | Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
55
+ | An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
56
+ | 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
57
+ | Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
58
+ | Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`; on narrow grids they scroll unless `pinned-max-share` allows (default half the width) |
59
+ | Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
60
+ | Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
61
+ | Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
62
+ | Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
63
+ | Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
64
+ | A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
65
+ | Group rows by a column ("by status, then city") | `rowGroupingFeature` | `v-model:group-by="['status', 'city']"`, `groups-expanded`; column `groupable: true` (header menu), `groupValue: (row) => …` (e.g. month); `aggregate` shows per group |
66
+ | Download CSV, copy rows / cells (Ctrl+C) | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
67
+ | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
68
+ | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
69
+ | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
70
70
 
71
71
  ## Renderers (pick by data)
72
72
 
73
- | Data | Renderer export | Useful options |
74
- |---|---|---|
75
- | Plain / long text | default (`text`) | `ellipsis`, `lines`, `tone`, `badge`, `copyable`, `tooltip` |
76
- | Numbers | `numberRenderer` | `format` (Intl), `clickable` |
77
- | Money | `currencyRenderer` | `currency` (code or `(v, row) => code`) |
78
- | Up / down change | `changeRenderer` | `direction`, `currency`, `iconOnly` |
79
- | Dates / date-times | `dateRenderer` / `dateTimeRenderer` | `format`, `twoLines` |
80
- | Yes / no | `booleanRenderer` | `display: 'icon'`, labels |
81
- | Status badge | `statusRenderer` | `tone: { Paid: 'success', Open: 'info' }`, `label`, `variant` |
82
- | Colour chip / tag | `chipRenderer` | `color`, `tone`, `shape` |
83
- | Links | `linkRenderer` | `href` / `to` (vue-router), `label`, `target` |
84
- | Several lines in one cell | `multiLineRenderer` | `lines: (v, row) => [...]` |
85
- | Arrays | `listRenderer` | `max`, `itemLabel` |
86
- | Images | `imageRenderer` | `src`, `size`, `shape` |
87
- | JSON / code | `jsonTreeRenderer`, `jsonRenderer`, `codeRenderer` | `collapseAt`, `language` |
88
- | Badge + info popover | `detailsRenderer` | `items: (v, row) => [{ label, value }]` |
89
- | Buttons / menus | `actionButtonRenderer`, `buttonGroupRenderer`, `actionsMenuRenderer` | `action`, `buttons`, `actions` |
90
- | Toggles / inputs (controlled) | `checkboxRenderer`, `switchRenderer`, `radioRenderer`, `iconToggleRenderer`, `editRenderer` | handle `@cell-action` |
91
- | Copy to clipboard | `copyRenderer` | `copyValue`, `iconOnly` |
73
+ | Data | Renderer export | Useful options |
74
+ | ----------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
75
+ | Plain / long text | default (`text`) | `ellipsis`, `lines`, `tone`, `badge`, `copyable`, `tooltip` |
76
+ | Numbers | `numberRenderer` | `format` (Intl), `clickable` |
77
+ | Money | `currencyRenderer` | `currency` (code or `(v, row) => code`) |
78
+ | Up / down change | `changeRenderer` | `direction`, `currency`, `iconOnly` |
79
+ | Dates / date-times | `dateRenderer` / `dateTimeRenderer` | `format`, `twoLines` |
80
+ | Yes / no | `booleanRenderer` | `display: 'icon'`, labels |
81
+ | Status badge | `statusRenderer` | `tone: { Paid: 'success', Open: 'info' }`, `label`, `variant` |
82
+ | Colour chip / tag | `chipRenderer` | `color`, `tone`, `shape` |
83
+ | Links | `linkRenderer` | `href` / `to` (vue-router), `label`, `target` |
84
+ | Several lines in one cell | `multiLineRenderer` | `lines: (v, row) => [...]` |
85
+ | Arrays | `listRenderer` | `max`, `itemLabel` |
86
+ | Images | `imageRenderer` | `src`, `size`, `shape` |
87
+ | JSON / code | `jsonTreeRenderer`, `jsonRenderer`, `codeRenderer` | `collapseAt`, `language` |
88
+ | Badge + info popover | `detailsRenderer` | `items: (v, row) => [{ label, value }]` |
89
+ | Buttons / menus | `actionButtonRenderer`, `buttonGroupRenderer`, `actionsMenuRenderer` | `action`, `buttons`, `actions` |
90
+ | Toggles / inputs (controlled) | `checkboxRenderer`, `switchRenderer`, `radioRenderer`, `iconToggleRenderer`, `editRenderer` | handle `@cell-action` |
91
+ | Copy to clipboard | `copyRenderer` | `copyValue`, `iconOnly` |
92
92
 
93
93
  Every option is in `agent/api.md` → Renderers. Options typed `RowFn` / `RowOption` also take
94
94
  `(value, row) => …`. Status / chip / details `tone`s: `success`, `danger`, `warning`, `info`,
@@ -100,23 +100,54 @@ Every option is in `agent/api.md` → Renderers. Options typed `RowFn` / `RowOpt
100
100
 
101
101
  ```vue
102
102
  <script setup lang="ts">
103
- import { VGrid, createColumnHelper, currencyRenderer, dateRenderer, sortingFeature, statusRenderer } from '@nocopypaste/vue-grid'
103
+ import {
104
+ VGrid,
105
+ createColumnHelper,
106
+ currencyRenderer,
107
+ dateRenderer,
108
+ sortingFeature,
109
+ statusRenderer,
110
+ } from '@nocopypaste/vue-grid'
104
111
 
105
- interface Order { id: number; customer: { name: string }; total: number; status: 'Paid' | 'Open'; placedAt: string }
112
+ interface Order {
113
+ id: number
114
+ customer: { name: string }
115
+ total: number
116
+ status: 'Paid' | 'Open'
117
+ placedAt: string
118
+ }
106
119
  defineProps<{ orders: Order[] }>()
107
120
 
108
121
  const col = createColumnHelper<Order>()
109
122
  const columns = [
110
123
  col({ key: 'id', header: '#', width: 'min-content' }),
111
- col({ key: 'customer', header: 'Customer', field: 'customer.name', sortable: true, width: 'minmax(10rem, 1fr)' }),
124
+ col({
125
+ key: 'customer',
126
+ header: 'Customer',
127
+ field: 'customer.name',
128
+ sortable: true,
129
+ width: 'minmax(10rem, 1fr)',
130
+ }),
112
131
  col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
113
- col({ key: 'status', header: 'Status', renderer: statusRenderer, rendererOptions: { tone: { Paid: 'success', Open: 'info' } } }),
132
+ col({
133
+ key: 'status',
134
+ header: 'Status',
135
+ renderer: statusRenderer,
136
+ rendererOptions: { tone: { Paid: 'success', Open: 'info' } },
137
+ }),
114
138
  col({ key: 'placedAt', header: 'Placed', renderer: dateRenderer, sortable: true }),
115
139
  ]
116
140
  </script>
117
141
 
118
142
  <template>
119
- <VGrid :rows="orders" :columns="columns" row-key="id" :features="[sortingFeature]" sort-mode="client" style="height: 480px" />
143
+ <VGrid
144
+ :rows="orders"
145
+ :columns="columns"
146
+ row-key="id"
147
+ :features="[sortingFeature]"
148
+ sort-mode="client"
149
+ style="height: 480px"
150
+ />
120
151
  </template>
121
152
  ```
122
153
 
@@ -125,21 +156,41 @@ const columns = [
125
156
  ```vue
126
157
  <script setup lang="ts">
127
158
  import {
128
- VGrid, VGridColumnMenu, VGridSearch,
129
- columnVisibilityFeature, filteringFeature, sortingFeature, type FilterState,
159
+ VGrid,
160
+ VGridColumnMenu,
161
+ VGridSearch,
162
+ columnVisibilityFeature,
163
+ filteringFeature,
164
+ sortingFeature,
165
+ type FilterState,
130
166
  } from '@nocopypaste/vue-grid'
131
167
  const filters = ref<FilterState | null>(null)
132
168
  // columns: add `filterable: true` (type from the renderer, or `filter: 'date'` etc.)
133
169
  </script>
134
170
 
135
171
  <template>
136
- <VGrid v-model:filters="filters" :rows="rows" :columns="columns" row-key="id" filter-row sort-mode="client"
137
- storage="orders-grid" filter-storage="orders-filters"
138
- :features="[sortingFeature, filteringFeature, columnVisibilityFeature]" style="height: 480px">
172
+ <VGrid
173
+ v-model:filters="filters"
174
+ :rows="rows"
175
+ :columns="columns"
176
+ row-key="id"
177
+ filter-row
178
+ sort-mode="client"
179
+ storage="orders-grid"
180
+ filter-storage="orders-filters"
181
+ :features="[sortingFeature, filteringFeature, columnVisibilityFeature]"
182
+ style="height: 480px"
183
+ >
139
184
  <template #toolbar="{ columnState, setColumnState, activeFilterCount, clearFilters }">
140
185
  <VGridSearch />
141
- <button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }}</button>
142
- <VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
186
+ <button v-if="activeFilterCount" @click="clearFilters()">
187
+ Clear {{ activeFilterCount }}
188
+ </button>
189
+ <VGridColumnMenu
190
+ :columns="columns"
191
+ :column-state="columnState"
192
+ @update:column-state="setColumnState($event!)"
193
+ />
143
194
  </template>
144
195
  </VGrid>
145
196
  </template>
@@ -148,19 +199,36 @@ const filters = ref<FilterState | null>(null)
148
199
  ### Server data with paging
149
200
 
150
201
  ```ts
151
- import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
202
+ import {
203
+ filteringFeature,
204
+ paginationFeature,
205
+ serverDataFeature,
206
+ sortingFeature,
207
+ type DataSource,
208
+ } from '@nocopypaste/vue-grid'
152
209
 
153
210
  const fetchOrders: DataSource<Order> = async (query, { signal }) => {
154
211
  // query: { sort: { key, dir } | null, filters: { columns, search }, page, pageSize }
155
- const res = await fetch('/api/orders/search', { method: 'POST', body: JSON.stringify(query), signal })
212
+ const res = await fetch('/api/orders/search', {
213
+ method: 'POST',
214
+ body: JSON.stringify(query),
215
+ signal,
216
+ })
156
217
  if (!res.ok) throw new Error(res.statusText) // the grid shows an error with Retry, emits load-error
157
218
  return res.json() as Promise<{ rows: Order[]; total: number }>
158
219
  }
159
220
  ```
160
221
 
161
222
  ```vue
162
- <VGrid :data-source="fetchOrders" :columns="columns" row-key="id" pagination filter-row
163
- :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" style="height: 520px" />
223
+ <VGrid
224
+ :data-source="fetchOrders"
225
+ :columns="columns"
226
+ row-key="id"
227
+ pagination
228
+ filter-row
229
+ :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]"
230
+ style="height: 520px"
231
+ />
164
232
  ```
165
233
 
166
234
  Server totals: pass them as `:aggregates="{ total: 125000 }"` with `totals` and `aggregationFeature`.
@@ -169,10 +237,23 @@ Server totals: pass them as `:aggregates="{ total: 125000 }"` with `totals` and
169
237
 
170
238
  ```vue
171
239
  <!-- synchronous children -->
172
- <VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(m) => m.children" :features="[subGridsFeature]" />
240
+ <VGrid
241
+ :rows="markets"
242
+ :columns="columns"
243
+ row-key="id"
244
+ :sub-rows="(m) => m.children"
245
+ :features="[subGridsFeature]"
246
+ />
173
247
  <!-- lazy children, fetched on first expand -->
174
- <VGrid :rows="folders" :columns="columns" row-key="id" :load-sub-rows="loadChildren" :has-sub-rows="(f) => f.hasChildren"
175
- v-model:expanded="expanded" :features="[subGridsFeature]" />
248
+ <VGrid
249
+ :rows="folders"
250
+ :columns="columns"
251
+ row-key="id"
252
+ :load-sub-rows="loadChildren"
253
+ :has-sub-rows="(f) => f.hasChildren"
254
+ v-model:expanded="expanded"
255
+ :features="[subGridsFeature]"
256
+ />
176
257
  ```
177
258
 
178
259
  Children share the parent's columns. For a different set of columns, use the `#detail` slot with
@@ -189,8 +270,16 @@ another `<VGrid>` inside.
189
270
  ### Selection and batch actions
190
271
 
191
272
  ```vue
192
- <VGrid v-model:selected="selected" :rows="rows" :columns="columns" row-key="id" selectable prune-selection
193
- :is-row-selectable="(r) => r.status !== 'locked'" :features="[selectionFeature]">
273
+ <VGrid
274
+ v-model:selected="selected"
275
+ :rows="rows"
276
+ :columns="columns"
277
+ row-key="id"
278
+ selectable
279
+ prune-selection
280
+ :is-row-selectable="(r) => r.status !== 'locked'"
281
+ :features="[selectionFeature]"
282
+ >
194
283
  <template #toolbar="{ selected, selectedCount, clearSelection }">
195
284
  <span v-if="selectedCount">{{ selectedCount }} selected
196
285
  <button @click="approve(selected).then(clearSelection)">Approve</button></span>
@@ -205,8 +294,15 @@ the banner's "Select all N rows" sets `v-model:select-all-matching`; act on the
205
294
  ### 10,000+ rows
206
295
 
207
296
  ```vue
208
- <VGrid :rows="bigList" :columns="columns" row-key="id" :virtual="{ rowHeight: 40 }" sort-mode="client"
209
- :features="[virtualScrollingFeature, sortingFeature]" style="height: 600px" />
297
+ <VGrid
298
+ :rows="bigList"
299
+ :columns="columns"
300
+ row-key="id"
301
+ :virtual="{ rowHeight: 40 }"
302
+ sort-mode="client"
303
+ :features="[virtualScrollingFeature, sortingFeature]"
304
+ style="height: 600px"
305
+ />
210
306
  ```
211
307
 
212
308
  ### Totals and pinned rows
@@ -220,8 +316,16 @@ const pinned = ref<PinnedRowsState>({ top: [42] })
220
316
  ```
221
317
 
222
318
  ```vue
223
- <VGrid ref="grid" v-model:pinned-rows="pinned" :rows="rows" :columns="columns" row-key="id" totals
224
- :features="[aggregationFeature, rowPinningFeature]" style="height: 480px" />
319
+ <VGrid
320
+ ref="grid"
321
+ v-model:pinned-rows="pinned"
322
+ :rows="rows"
323
+ :columns="columns"
324
+ row-key="id"
325
+ totals
326
+ :features="[aggregationFeature, rowPinningFeature]"
327
+ style="height: 480px"
328
+ />
225
329
  <!-- grid.value.pinRow(key, 'top' | 'bottom' | null) from your own button or context menu -->
226
330
  ```
227
331
 
@@ -231,26 +335,44 @@ const pinned = ref<PinnedRowsState>({ top: [42] })
231
335
  const columns = [
232
336
  col({ key: 'customer', field: 'customer.name' }),
233
337
  col({ key: 'status', renderer: statusRenderer, groupable: true }),
234
- col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (o) => o.placedAt.slice(0, 7) }),
338
+ col({
339
+ key: 'placedAt',
340
+ renderer: dateRenderer,
341
+ groupable: true,
342
+ groupValue: (o) => o.placedAt.slice(0, 7),
343
+ }),
235
344
  col({ key: 'total', renderer: currencyRenderer, aggregate: 'sum' }), // shown in every group row
236
345
  ]
237
346
  const groupBy = ref(['status'])
238
347
  ```
239
348
 
240
349
  ```vue
241
- <VGrid v-model:group-by="groupBy" :rows="orders" :columns="columns" row-key="id" sort-mode="client"
242
- :features="[rowGroupingFeature, sortingFeature, menusFeature]" style="height: 480px" />
350
+ <VGrid
351
+ v-model:group-by="groupBy"
352
+ :rows="orders"
353
+ :columns="columns"
354
+ row-key="id"
355
+ sort-mode="client"
356
+ :features="[rowGroupingFeature, sortingFeature, menusFeature]"
357
+ style="height: 480px"
358
+ />
243
359
  ```
244
360
 
245
361
  Groups start collapsed (`groups-expanded` to open them); the group label sits in the first
246
- visible column, so keep that column wide enough (or give the next columns no `aggregate`, so the
247
- label runs across them). `#group-<key>="{ value, count }"` renders a group's value yourself.
362
+ visible column and runs across the next ones up to the first with an `aggregate`. In a narrow
363
+ column it drops the column name and ellipsizes the value (full label as tooltip), so give it room
364
+ where the value matters. `#group-<key>="{ value, count }"` renders a group's value yourself.
248
365
 
249
366
  ### CSV export and copy
250
367
 
251
368
  ```vue
252
369
  <script setup lang="ts">
253
- import { exportFeature, keyboardNavigationFeature, selectionFeature, type VGridExposed } from '@nocopypaste/vue-grid'
370
+ import {
371
+ exportFeature,
372
+ keyboardNavigationFeature,
373
+ selectionFeature,
374
+ type VGridExposed,
375
+ } from '@nocopypaste/vue-grid'
254
376
  const grid = ref<VGridExposed>()
255
377
  // columns: `exportable: false` on action columns; `exportValue: (row) => row.id` where the cell isn't the data
256
378
  </script>
@@ -258,8 +380,15 @@ const grid = ref<VGridExposed>()
258
380
  <template>
259
381
  <button @click="grid?.exportCsv({ filename: 'orders.csv' })">Download CSV</button>
260
382
  <button @click="grid?.copyRows()">Copy selected</button>
261
- <VGrid ref="grid" :rows="orders" :columns="columns" row-key="id" selectable
262
- :features="[exportFeature, selectionFeature, keyboardNavigationFeature]" @copy="(e) => notify(e.text)" />
383
+ <VGrid
384
+ ref="grid"
385
+ :rows="orders"
386
+ :columns="columns"
387
+ row-key="id"
388
+ selectable
389
+ :features="[exportFeature, selectionFeature, keyboardNavigationFeature]"
390
+ @copy="(e) => notify(e.text)"
391
+ />
263
392
  </template>
264
393
  ```
265
394
 
@@ -272,19 +401,47 @@ raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-sep
272
401
 
273
402
  ```vue
274
403
  <script setup lang="ts">
275
- import { actionsMenuRenderer, menusFeature, type CellActionEvent, type CellContext, type MenuItem } from '@nocopypaste/vue-grid'
404
+ import {
405
+ actionsMenuRenderer,
406
+ menusFeature,
407
+ type CellActionEvent,
408
+ type CellContext,
409
+ type MenuItem,
410
+ } from '@nocopypaste/vue-grid'
276
411
  const columns = [
277
412
  /* … */
278
- col({ key: 'actions', header: '', width: 'min-content', renderer: actionsMenuRenderer,
279
- rendererOptions: { actions: [{ name: 'edit', label: 'Edit' }, { separator: true }, { name: 'delete', label: 'Delete', tone: 'danger' }] } }),
413
+ col({
414
+ key: 'actions',
415
+ header: '',
416
+ width: 'min-content',
417
+ renderer: actionsMenuRenderer,
418
+ rendererOptions: {
419
+ actions: [
420
+ { name: 'edit', label: 'Edit' },
421
+ { separator: true },
422
+ { name: 'delete', label: 'Delete', tone: 'danger' },
423
+ ],
424
+ },
425
+ }),
426
+ ]
427
+ const cellMenu = (ctx: CellContext<Order>): MenuItem[] => [
428
+ { name: 'copy', label: `Copy ${ctx.column.header}` },
280
429
  ]
281
- const cellMenu = (ctx: CellContext<Order>): MenuItem[] => [{ name: 'copy', label: `Copy ${ctx.column.header}` }]
282
- function onAction(e: CellActionEvent<Order>) { if (e.name === 'delete') remove(e.rowKey) }
430
+ function onAction(e: CellActionEvent<Order>) {
431
+ if (e.name === 'delete') remove(e.rowKey)
432
+ }
283
433
  </script>
284
434
 
285
435
  <template>
286
- <VGrid :rows :columns row-key="id" :context-menu="cellMenu" :features="[menusFeature]"
287
- @cell-action="onAction" @context-action="(e) => copy(String(e.value))" />
436
+ <VGrid
437
+ :rows
438
+ :columns
439
+ row-key="id"
440
+ :context-menu="cellMenu"
441
+ :features="[menusFeature]"
442
+ @cell-action="onAction"
443
+ @context-action="(e) => copy(String(e.value))"
444
+ />
288
445
  </template>
289
446
  ```
290
447
 
@@ -300,14 +457,22 @@ col({ key: 'active', renderer: switchRenderer })
300
457
  ```ts
301
458
  import { defineCellRenderer } from '@nocopypaste/vue-grid'
302
459
  import RatingCell from './RatingCell.vue' // props: CellRendererProps<Row, number, { max?: number }>; emit('action', 'rate', n)
303
- export const ratingRenderer = defineCellRenderer<{ max?: number }>({ name: 'rating', component: RatingCell, defaults: { max: 5 } })
460
+ export const ratingRenderer = defineCellRenderer<{ max?: number }>({
461
+ name: 'rating',
462
+ component: RatingCell,
463
+ defaults: { max: 5 },
464
+ })
304
465
  // column: { key: 'rating', renderer: ratingRenderer, rendererOptions: { max: 10 } }
305
466
  ```
306
467
 
307
468
  ### Theming
308
469
 
309
470
  ```css
310
- .my-grid { --vg-color-accent: #db2777; --vg-radius: 1rem; --vg-font-size: 0.8125rem; }
471
+ .my-grid {
472
+ --vg-color-accent: #db2777;
473
+ --vg-radius: 1rem;
474
+ --vg-font-size: 0.8125rem;
475
+ }
311
476
  ```
312
477
 
313
478
  Tokens: `--vg-*` (see README → Theming). Dark mode follows `color-scheme`. Density:
@@ -351,7 +516,7 @@ Tokens: `--vg-*` (see README → Theming). Dark mode follows `color-scheme`. Den
351
516
 
352
517
  ---
353
518
 
354
- # @nocopypaste/vue-grid 0.3.1 — API reference
519
+ # @nocopypaste/vue-grid 0.4.0 — API reference
355
520
 
356
521
  > Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
357
522
 
@@ -363,7 +528,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
363
528
  |---|---|---|---|
364
529
  | `aggregationFeature` | Aggregates and the totals row: columns with an `aggregate` (`sum`, `avg`, `min`, `max`, `count` or a function) and `totals` (`true` / `'bottom'` or `'top'`) show a sticky totals row over the rows that pass the filters, on every page. `aggregates` supplies the values instead (e.g. from a server). Without it, `aggregate` and `totals` are ignored. | `totals` `totalsLabel` `aggregates` | `aggregate` |
365
530
  | `columnGroupsFeature` | Grouped column headers: give columns a `group` and adjacent visible columns of the same group get one header cell spanning them, in a sticky row above the column headers. Groups follow reordering, hiding and pinning (a pin boundary splits a group). Without it, `group` is ignored. | | `group` |
366
- | `columnPinningFeature` | Pinned columns: `pinned: 'left' \| 'right'` columns stay put (sticky) while the grid scrolls sideways, with edge shadows; runtime pins from the header menu (Pin left / Pin right / Unpin) are kept in `v-model:column-state` and persisted with `storage`. Without it, pins are ignored. | | `pinned` `pinnable` |
531
+ | `columnPinningFeature` | Pinned columns: `pinned: 'left' \| 'right'` columns stay put (sticky) while the grid scrolls sideways, with edge shadows; runtime pins from the header menu (Pin left / Pin right / Unpin) are kept in `v-model:column-state` and persisted with `storage`. While the pinned columns would take more than `pinned-max-share` of the grid's width (half, by default), they scroll like the others. Without it, pins are ignored. | `pinnedMaxShare` | `pinned` `pinnable` |
367
532
  | `columnReorderFeature` | Column reordering: drag a header (mouse, pen, touch), Alt+←/→ on a focused header, and the header menu's Move left / Move right. Columns opt out with `reorderable: false`. The order is part of `v-model:column-state` and persisted with `storage`; `<VGridColumnMenu>` works without it. | | `reorderable` |
368
533
  | `columnResizingFeature` | Column resizing: drag a header's edge (mouse, pen, touch), use ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation), or double-click the edge to fit the content. `minWidth` / `maxWidth` bound it; columns opt out with `resizable: false`. Widths are kept in `columnState.widths` and persisted with `storage`. The header menu gains Fit width / Reset width. | | `maxWidth` `resizable` |
369
534
  | `columnVisibilityFeature` | Column visibility: `hidden: true` columns, `columnState.hidden` (persisted with `storage`), the header menu's Hide column item and `<VGridColumnMenu>`'s checkboxes. Columns opt out with `hideable: false`. Without it, every column shows. | | `hidden` `hideable` |
@@ -409,6 +574,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
409
574
  | `flash` | `FlashMode` | | | Briefly highlight cells whose value changes (live data, enrichment). Columns can override. |
410
575
  | `virtual` | `VirtualOptions \| false` | `false` | `virtualScrollingFeature` | Virtual scrolling: only the rows in view render. Rows share one height (`rowHeight`, px) and the grid needs a bounded height. Needs the virtual scrolling feature. |
411
576
  | `storage` | `ColumnStateStorage \| string` | | | Persist column state (order, hidden, pins, widths): a localStorage key or your own storage. |
577
+ | `pinnedMaxShare` | `number \| false` | `0.5` | `columnPinningFeature` | 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); pinned again once there's room. `false`: always pinned. Column pinning feature. |
412
578
  | `renderers` | `CellRendererDefinition[]` | | | Renderers usable by name in this grid (merged over the app-wide ones). |
413
579
  | `locale` | `string` | | | Locale for number / date renderers (default: the plugin's, else the browser's). |
414
580
  | `currency` | `string` | | | Default ISO 4217 currency for currency renderers. |
@@ -544,16 +710,16 @@ Text, the default renderer (the only one `<VGrid>` bundles): ellipsis, line clam
544
710
  |---|---|---|
545
711
  | `ellipsis` | `boolean` | Single line with ellipsis (full text in a tooltip). |
546
712
  | `lines` | `number` | Clamp to N lines. |
547
- | `maxWidth` | `string` | |
713
+ | `maxWidth` | `string` | CSS max width of the text, e.g. `'16rem'`: longer text wraps or, with `ellipsis`, is cut. |
548
714
  | `preserveNewlines` | `boolean` | Keep line breaks in the value (`white-space: pre-line`). |
549
715
  | `tooltip` | `boolean \| RowFn<string \| undefined>` | `true` = value as tooltip; a function computes it. |
550
716
  | `placeholder` | `string` | Shown when the value is empty. |
551
- | `tone` | `RowOption<Tone \| undefined>` | |
717
+ | `tone` | `RowOption<Tone \| undefined>` | Colour of the text (`success`, `danger`, `warning`, `info`, `neutral`, `accent`), or `(value, row) => tone`. |
552
718
  | `toneMode` | `'text' \| 'fill'` | `text` (default) colours the text; `fill` colours the badge-like background. |
553
- | `bold` | `RowOption<boolean>` | |
719
+ | `bold` | `RowOption<boolean>` | Bold text, for every row or `(value, row) => boolean`. |
554
720
  | `secondary` | `RowFn<string \| null \| undefined>` | Muted text after the value, e.g. a half-time score: `2:1 (1:0)`. |
555
721
  | `badge` | `RowFn<BadgeSpec \| string \| null \| undefined>` | Badge before (default) or after the value. |
556
- | `badgePosition` | `'start' \| 'end'` | |
722
+ | `badgePosition` | `'start' \| 'end'` | Where `badge` goes: `start` (default, before the value) or `end`. |
557
723
  | `icon` | `RowFn<IconSpec \| null \| undefined>` | Icon before the value, e.g. `{ icon: BellIcon, tone: 'warning', label: 'Notify' }`. |
558
724
  | `copyable` | `boolean` | Adds a copy-to-clipboard button; emits `copy` with the copied text. |
559
725
  | `copyValue` | `RowFn<string>` | What gets copied (default: the displayed text). |
@@ -565,7 +731,7 @@ Text that toggles a highlight when clicked. Emits `toggle` (with `clickable`). A
565
731
  | Option | Type | Description |
566
732
  |---|---|---|
567
733
  | `clickable` | `boolean \| RowFn<boolean>` | When true, the text is a button that emits action `toggle`. |
568
- | `highlighted` | `boolean \| RowFn<boolean>` | |
734
+ | `highlighted` | `boolean \| RowFn<boolean>` | Shown as switched on (highlighted, `aria-pressed`), e.g. `(v, row) => row.starred`. |
569
735
  | `placeholder` | `string` | Shown when the value is empty. |
570
736
 
571
737
  ### `number` — `numberRenderer`
@@ -584,10 +750,10 @@ Numbers that always show their sign (+ / −). With `clickable`, emits `click`.
584
750
 
585
751
  | Option | Type | Description |
586
752
  |---|---|---|
753
+ | `signed` | `boolean` | Always show the sign (`+3`, `−2`). Default `true` for `signed-number`; `false` formats like `number`. |
587
754
  | `format` | `Intl.NumberFormatOptions` | `Intl.NumberFormat` options, e.g. `{ maximumFractionDigits: 0 }` or `{ style: 'percent' }`. |
588
755
  | `placeholder` | `string` | Shown when the value is empty. |
589
756
  | `clickable` | `RowOption<boolean>` | Renders the number as a link-style button that emits `click` (drill-down). |
590
- | `signed` | `boolean` | |
591
757
 
592
758
  ### `currency` — `currencyRenderer`
593
759
 
@@ -628,7 +794,7 @@ Date and time, on two lines by default. Align: `start` · filter type: `date`.
628
794
 
629
795
  | Option | Type | Description |
630
796
  |---|---|---|
631
- | `milliseconds` | `boolean` | |
797
+ | `milliseconds` | `boolean` | Show milliseconds in the time (`12:30:05.123`). |
632
798
  | `twoLines` | `boolean` | Date and time on two lines (default true). |
633
799
  | `format` | `Intl.DateTimeFormatOptions` | `Intl.DateTimeFormat` options, e.g. `{ dateStyle: 'medium' }`. |
634
800
  | `placeholder` | `string` | Shown when the value is empty. |
@@ -639,9 +805,9 @@ Yes / no as text labels or icons. Align: `start` · filter type: `boolean`.
639
805
 
640
806
  | Option | Type | Description |
641
807
  |---|---|---|
642
- | `trueLabel` | `string` | |
643
- | `falseLabel` | `string` | |
644
- | `nullLabel` | `string` | |
808
+ | `trueLabel` | `string` | Text for `true` (and its accessible name in icon mode). Default “Yes”. |
809
+ | `falseLabel` | `string` | Text for `false`. Default “No”. |
810
+ | `nullLabel` | `string` | Text for `null` / `undefined`. Default: nothing. |
645
811
  | `display` | `'text' \| 'icon'` | `text` (default): labels. `icon`: a check for true, nothing (or a cross) for false. |
646
812
  | `falseIcon` | `boolean` | In icon mode, show a cross for false (default: nothing). |
647
813
 
@@ -651,9 +817,9 @@ A coloured status badge (tone from a map, a function or a constant). With `click
651
817
 
652
818
  | Option | Type | Description |
653
819
  |---|---|---|
654
- | `tone` | `ToneOption` | |
820
+ | `tone` | `ToneOption` | Badge colour: one tone, a value → tone map (`{ Paid: 'success', Open: 'info' }`), or `(value, row) => tone`. Default `neutral`. |
655
821
  | `label` | `RowFn<string> \| Record<string, string>` | Label from a function, or a value → label map. |
656
- | `dot` | `boolean` | |
822
+ | `dot` | `boolean` | A coloured dot before the label. Default `true`; `false` hides it. |
657
823
  | `variant` | `'soft' \| 'solid' \| 'outline'` | `soft` (default, tinted), `solid` (filled) or `outline`. |
658
824
  | `placeholder` | `string` | Shown when the value is empty. |
659
825
  | `clickable` | `RowOption<boolean>` | Badge becomes a button that emits `click`. |
@@ -664,11 +830,11 @@ A safe link (http(s), mailto, tel only), or a `<RouterLink>` with `to` when vue-
664
830
 
665
831
  | Option | Type | Description |
666
832
  |---|---|---|
667
- | `href` | `RowFn<string \| undefined>` | |
833
+ | `href` | `RowFn<string \| undefined>` | The URL, from the value and row (default: the value). Only http(s), mailto and tel are linked; wins over `to`. |
668
834
  | `to` | `RowFn<RouteTarget \| null \| undefined>` | Router location; rendered with `<RouterLink>` when vue-router is installed, else as an href. |
669
- | `label` | `RowFn<string>` | |
670
- | `target` | `'_self' \| '_blank'` | |
671
- | `tooltip` | `RowFn<string \| undefined>` | |
835
+ | `label` | `RowFn<string>` | Link text (default: the value). |
836
+ | `target` | `'_self' \| '_blank'` | `_blank` opens a new tab (with `rel="noopener noreferrer"`). |
837
+ | `tooltip` | `RowFn<string \| undefined>` | Hover text of the link. |
672
838
 
673
839
  ### `icon` — `iconRenderer`
674
840
 
@@ -678,9 +844,9 @@ An icon component, fixed or picked per row. Align: `center` · filter type: `tex
678
844
  |---|---|---|
679
845
  | `icon` | `Component` | Static icon component. |
680
846
  | `iconFor` | `RowFn<Component \| undefined>` | Picks the icon per row (wins over `icon`). Kept separate because functional components are functions too. |
681
- | `show` | `RowFn<boolean>` | |
682
- | `label` | `string \| RowFn<string>` | |
683
- | `tone` | `Tone \| RowFn<Tone \| undefined>` | |
847
+ | `show` | `RowFn<boolean>` | Show the icon for this row (default: always). A hidden icon keeps its space, so columns stay aligned. |
848
+ | `label` | `string \| RowFn<string>` | Accessible name and tooltip. Without one the icon is decorative. |
849
+ | `tone` | `Tone \| RowFn<Tone \| undefined>` | Icon colour, or `(value, row) => tone`. |
684
850
 
685
851
  ### `json` — `jsonRenderer`
686
852
 
@@ -688,8 +854,8 @@ A button that opens the value as escaped JSON in a dialog. Align: `start` · fil
688
854
 
689
855
  | Option | Type | Description |
690
856
  |---|---|---|
691
- | `label` | `string` | |
692
- | `dialogTitle` | `string \| RowFn<string>` | |
857
+ | `label` | `string` | Text of the button that opens the JSON in a dialog. Default “View”. |
858
+ | `dialogTitle` | `string \| RowFn<string>` | Heading of the dialog (default: the column header). |
693
859
 
694
860
  ### `json-tree` — `jsonTreeRenderer`
695
861
 
@@ -701,7 +867,7 @@ A collapsible tree of nested data. Align: `start` · filter type: `text`.
701
867
  | `maxDepth` | `number` | Deeper nodes are summarised (“3 items”) instead of expanded. Default unlimited. |
702
868
  | `parseNested` | `boolean` | String values that contain JSON are shown as nested trees. |
703
869
  | `collapsed` | `boolean` | Starts hidden behind a toggle button (labelled `toggleLabel`, default “More info”). |
704
- | `toggleLabel` | `string` | |
870
+ | `toggleLabel` | `string` | Text of the `collapsed` toggle. Default “More info”. |
705
871
  | `emptyText` | `string` | Shown for null / empty values. Default: nothing. |
706
872
 
707
873
  ### `actions-menu` — `actionsMenuRenderer`
@@ -711,7 +877,7 @@ A `⋯` button with a keyboard-friendly menu. Emits the chosen item's `name`. Al
711
877
  | Option | Type | Description |
712
878
  |---|---|---|
713
879
  | `actions` | `MenuItem[] \| ((row: any) => MenuItem[])` | Menu items (actions and `{ separator: true }`), or a function of the row. |
714
- | `label` | `string` | |
880
+ | `label` | `string` | Accessible name of the `⋯` button and the menu. Default “Actions”. |
715
881
 
716
882
  ### `action-button` — `actionButtonRenderer`
717
883
 
@@ -719,13 +885,13 @@ One button per row. Emits its `action` (default `click`). Align: `start` · filt
719
885
 
720
886
  | Option | Type | Description |
721
887
  |---|---|---|
722
- | `label` | `string \| RowFn<string>` | |
888
+ | `label` | `string \| RowFn<string>` | Button text (default: the value), or `(value, row) => text`. |
723
889
  | `action` | `string` | Action name emitted on click. Default `click`. |
724
- | `icon` | `Component` | |
725
- | `tone` | `Tone` | |
726
- | `disabled` | `RowFn<boolean>` | |
890
+ | `icon` | `Component` | An icon component before the label. |
891
+ | `tone` | `Tone` | Button colour, e.g. `danger` for a delete button. |
892
+ | `disabled` | `RowFn<boolean>` | Disable the button for some rows: `(value, row) => boolean`. |
727
893
  | `visible` | `RowFn<boolean>` | Hide the button for some rows. |
728
- | `variant` | `ButtonVariant` | |
894
+ | `variant` | `ButtonVariant` | `outline` (default), `solid` or `ghost`. |
729
895
  | `iconOnly` | `boolean` | Only the icon; the label becomes its accessible name and tooltip. |
730
896
 
731
897
  ### `multi-line` — `multiLineRenderer`
@@ -737,7 +903,7 @@ Stacked lines, each with its own style, link, badge, trend or action. Align: `st
737
903
  | `lines` | `RowFn<LineInput[] \| null \| undefined>` | Builds the lines; default: the value itself when it's an array. |
738
904
  | `boldLines` | `number[]` | Indexes of lines to show in bold. |
739
905
  | `ellipsis` | `boolean` | Each line on one row with ellipsis (default true). |
740
- | `target` | `'_self' \| '_blank'` | |
906
+ | `target` | `'_self' \| '_blank'` | `_blank` opens linked lines in a new tab. |
741
907
  | `placeholder` | `string` | Shown when the value is empty. |
742
908
 
743
909
  ### `copy` — `copyRenderer`
@@ -760,9 +926,9 @@ A chip in any colour (readable text picked by contrast), square, circle or pill.
760
926
  |---|---|---|
761
927
  | `color` | `RowOption<string \| null \| undefined>` | Any CSS colour (e.g. from an API); text colour is picked for contrast. |
762
928
  | `tone` | `ToneOption` | Named tone instead of a raw colour. |
763
- | `label` | `RowFn<string>` | |
764
- | `tooltip` | `RowFn<string \| null \| undefined>` | |
765
- | `shape` | `'square' \| 'circle' \| 'pill'` | |
929
+ | `label` | `RowFn<string>` | Chip text (default: the value, or its `label` / `name` / `text` field). A tone map is keyed by this label. |
930
+ | `tooltip` | `RowFn<string \| null \| undefined>` | Hover text (default: the value's `description` field, if any). |
931
+ | `shape` | `'square' \| 'circle' \| 'pill'` | `square` (default), `circle` or `pill`. |
766
932
  | `size` | `string` | Box size for square/circle. Default `1.75rem`. |
767
933
  | `placeholder` | `string` | Shown when the value is empty. |
768
934
 
@@ -773,7 +939,7 @@ A controlled checkbox, with a tooltip when disabled. Emits `change` with the req
773
939
  | Option | Type | Description |
774
940
  |---|---|---|
775
941
  | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
776
- | `disabled` | `RowOption<boolean>` | |
942
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
777
943
  | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
778
944
  | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
779
945
 
@@ -784,7 +950,7 @@ A controlled on / off switch. Emits `change` with the requested state. Align: `c
784
950
  | Option | Type | Description |
785
951
  |---|---|---|
786
952
  | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
787
- | `disabled` | `RowOption<boolean>` | |
953
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
788
954
  | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
789
955
  | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
790
956
 
@@ -796,7 +962,7 @@ One selected row across the column (controlled). Emits `select`. Align: `center`
796
962
  |---|---|---|
797
963
  | `name` | `string` | Radio group name. Default: the column key. |
798
964
  | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
799
- | `disabled` | `RowOption<boolean>` | |
965
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
800
966
  | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
801
967
  | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
802
968
 
@@ -809,8 +975,8 @@ A value with an edit button, for opening your own editor. Emits `edit`. Align: `
809
975
  | `format` | `RowFn<string>` | Text shown next to the edit button (default: the value). |
810
976
  | `placeholder` | `string` | Shown when the value is empty. |
811
977
  | `label` | `string` | Accessible name of the button. Default “Edit”. |
812
- | `disabled` | `RowOption<boolean>` | |
813
- | `bold` | `boolean` | |
978
+ | `disabled` | `RowOption<boolean>` | Disables the edit button, for every row or `(value, row) => boolean`. |
979
+ | `bold` | `boolean` | Bold text. |
814
980
 
815
981
  ### `image` — `imageRenderer`
816
982
 
@@ -820,10 +986,10 @@ A thumbnail, with a placeholder when empty or broken. Align: `center` · filter
820
986
  |---|---|---|
821
987
  | `src` | `RowFn<string \| null \| undefined>` | Default: the value. |
822
988
  | `baseUrl` | `string` | Prefixed to relative paths (e.g. a CDN). |
823
- | `alt` | `RowOption<string>` | |
989
+ | `alt` | `RowOption<string>` | Alternative text (default: none, a decorative image), or `(value, row) => text`. |
824
990
  | `size` | `string` | Default `2.5rem`. |
825
- | `fit` | `'contain' \| 'cover'` | |
826
- | `shape` | `'rounded' \| 'circle' \| 'square'` | |
991
+ | `fit` | `'contain' \| 'cover'` | `contain` (default) shows the whole image; `cover` fills the box and crops. |
992
+ | `shape` | `'rounded' \| 'circle' \| 'square'` | `rounded` (default), `circle` (avatars) or `square`. |
827
993
 
828
994
  ### `code` — `codeRenderer`
829
995
 
@@ -842,7 +1008,7 @@ Several buttons, fixed or per row. Emits the clicked button's `name`. Align: `st
842
1008
 
843
1009
  | Option | Type | Description |
844
1010
  |---|---|---|
845
- | `buttons` | `ButtonSpec[] \| ((row: any) => ButtonSpec[])` | |
1011
+ | `buttons` | `ButtonSpec[] \| ((row: any) => ButtonSpec[])` | The buttons (`{ name, label, tone?, variant?, disabled?, icon?, hidden? }`), or a function of the row. A click emits the button's `name`. |
846
1012
 
847
1013
  ### `icon-toggle` — `iconToggleRenderer`
848
1014
 
@@ -855,7 +1021,7 @@ A star / flag style on-off button (controlled). Emits `toggle`. Align: `center`
855
1021
  | `activeIcon` | `Component` | Default: a filled star (or `icon`). |
856
1022
  | `label` | `RowOption<string>` | Accessible name. Default “Toggle”. |
857
1023
  | `activeTone` | `Tone` | Tone when active. Default `warning`. |
858
- | `disabled` | `RowOption<boolean>` | |
1024
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
859
1025
 
860
1026
  ### `details` — `detailsRenderer`
861
1027
 
@@ -864,7 +1030,7 @@ A status badge plus an info button with an anchored popover of label / value row
864
1030
  | Option | Type | Description |
865
1031
  |---|---|---|
866
1032
  | `tone` | `ToneOption` | Summary badge tone, like `status`. |
867
- | `label` | `RowFn<string>` | |
1033
+ | `label` | `RowFn<string>` | Badge text (default: the value). |
868
1034
  | `items` | `RowFn<DetailItem[] \| null \| undefined>` | Popover rows. Empty → no info button. |
869
1035
  | `title` | `RowOption<string>` | Popover heading. Default: the column header. |
870
1036
  | `triggerLabel` | `string` | Accessible name of the info button. Default “Details”. |
@@ -876,7 +1042,7 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
876
1042
  | Option | Type | Description |
877
1043
  |---|---|---|
878
1044
  | `items` | `RowFn<unknown[] \| null \| undefined>` | Default: the value when it's an array. |
879
- | `itemLabel` | `RowFn<string>` | |
1045
+ | `itemLabel` | `RowFn<string>` | Text of one item, `(item, row) => string` (default: the item, objects as JSON). |
880
1046
  | `max` | `number` | Items shown before “+N more”. Default 1. |
881
1047
  | `placeholder` | `string` | Shown when the value is empty. |
882
1048
 
@@ -894,8 +1060,8 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
894
1060
 
895
1061
  | Field | Type | Description |
896
1062
  |---|---|---|
897
- | `top`? | `RowKey[]` | |
898
- | `bottom`? | `RowKey[]` | |
1063
+ | `top`? | `RowKey[]` | Keys of the rows pinned above the body, in display order. |
1064
+ | `bottom`? | `RowKey[]` | Keys of the rows pinned below the body, in display order. |
899
1065
 
900
1066
  ### `ColumnState`
901
1067
 
@@ -910,14 +1076,14 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
910
1076
 
911
1077
  | Field | Type | Description |
912
1078
  |---|---|---|
913
- | `key` | `string` | |
914
- | `dir` | `SortDir` | |
1079
+ | `key` | `string` | The sorted column’s `key`. |
1080
+ | `dir` | `SortDir` | `asc` or `desc`. |
915
1081
 
916
1082
  ### `ColumnFilterOptions`
917
1083
 
918
1084
  | Field | Type | Description |
919
1085
  |---|---|---|
920
- | `type`? | `FilterType` | |
1086
+ | `type`? | `FilterType` | `text`, `number`, `date`, `boolean` or `set` (default: from the renderer). |
921
1087
  | `options`? | `readonly FilterOption[] \| FilterOptionsLoader` | Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a backend — honour `signal`). Default: distinct values from the rows. |
922
1088
  | `placeholder`? | `string` | Placeholder of the filter-row input. |
923
1089
 
@@ -925,8 +1091,8 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
925
1091
 
926
1092
  | Field | Type | Description |
927
1093
  |---|---|---|
928
- | `value` | `unknown` | |
929
- | `label`? | `string` | |
1094
+ | `value` | `unknown` | The value rows are matched against. |
1095
+ | `label`? | `string` | Text shown for the option (default: the value). |
930
1096
  | `count`? | `number` | Shown next to the option (e.g. number of rows). |
931
1097
 
932
1098
  ### `MenuAction`
@@ -934,70 +1100,70 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
934
1100
  | Field | Type | Description |
935
1101
  |---|---|---|
936
1102
  | `name` | `string` | Emitted as the action name. |
937
- | `label` | `string` | |
938
- | `disabled`? | `boolean` | |
939
- | `tone`? | `MenuTone` | |
940
- | `icon`? | `Component` | |
1103
+ | `label` | `string` | Text of the item. |
1104
+ | `disabled`? | `boolean` | Shown but can’t be chosen. |
1105
+ | `tone`? | `MenuTone` | Colour, e.g. `danger` for a delete item. |
1106
+ | `icon`? | `Component` | An icon component before the label. |
941
1107
  | `hint`? | `string` | Shown right-aligned, e.g. a shortcut hint. |
942
1108
 
943
1109
  ### `CellContext`
944
1110
 
945
1111
  | Field | Type | Description |
946
1112
  |---|---|---|
947
- | `row` | `T` | |
948
- | `rowKey` | `RowKey` | |
949
- | `column` | `ColumnDef<T>` | |
950
- | `value` | `unknown` | |
1113
+ | `row` | `T` | The row the cell belongs to. |
1114
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1115
+ | `column` | `ColumnDef<T>` | The cell’s column definition. |
1116
+ | `value` | `unknown` | The cell value (`value` / `field` / `key`). |
951
1117
 
952
1118
  ### `CellActionEvent`
953
1119
 
954
1120
  | Field | Type | Description |
955
1121
  |---|---|---|
956
- | `name` | `string` | |
957
- | `payload` | `unknown` | |
958
- | `row` | `T` | |
959
- | `rowKey` | `RowKey` | |
960
- | `column` | `ColumnDef<T>` | |
1122
+ | `name` | `string` | The action, e.g. `click`, `change`, `toggle`, `copy` or a button’s `name`. |
1123
+ | `payload` | `unknown` | Action data: the new value of a toggle or input, the copied text, a line index… |
1124
+ | `row` | `T` | The row the cell belongs to. |
1125
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1126
+ | `column` | `ColumnDef<T>` | The cell’s column definition. |
961
1127
 
962
1128
  ### `CellClickEvent`
963
1129
 
964
1130
  | Field | Type | Description |
965
1131
  |---|---|---|
966
- | `row` | `T` | |
967
- | `rowKey` | `RowKey` | |
968
- | `column` | `ColumnDef<T>` | |
969
- | `value` | `unknown` | |
970
- | `event` | `MouseEvent \| KeyboardEvent` | |
1132
+ | `row` | `T` | The row the cell belongs to. |
1133
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1134
+ | `column` | `ColumnDef<T>` | The clicked column (one with `clickable: true`). |
1135
+ | `value` | `unknown` | The cell value. |
1136
+ | `event` | `MouseEvent \| KeyboardEvent` | The DOM event of the click (Enter on a focused cell clicks it too). |
971
1137
 
972
1138
  ### `ContextActionEvent`
973
1139
 
974
1140
  | Field | Type | Description |
975
1141
  |---|---|---|
976
- | `name` | `string` | |
977
- | `item` | `MenuAction` | |
978
- | `row` | `T` | |
979
- | `rowKey` | `RowKey` | |
980
- | `column` | `ColumnDef<T>` | |
981
- | `value` | `unknown` | |
1142
+ | `name` | `string` | The chosen item’s `name`. |
1143
+ | `item` | `MenuAction` | The chosen item. |
1144
+ | `row` | `T` | The row the cell belongs to. |
1145
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1146
+ | `column` | `ColumnDef<T>` | The cell’s column definition. |
1147
+ | `value` | `unknown` | The cell value (`value` / `field` / `key`). |
982
1148
 
983
1149
  ### `HeaderActionEvent`
984
1150
 
985
1151
  | Field | Type | Description |
986
1152
  |---|---|---|
987
- | `name` | `string` | |
988
- | `item` | `MenuAction` | |
989
- | `column` | `ColumnDef<T>` | |
1153
+ | `name` | `string` | The chosen item’s `name`. |
1154
+ | `item` | `MenuAction` | The chosen item. |
1155
+ | `column` | `ColumnDef<T>` | The column whose header menu it was. |
990
1156
 
991
1157
  ### `VueGridConfig`
992
1158
 
993
1159
  | Field | Type | Description |
994
1160
  |---|---|---|
995
- | `renderers`? | `CellRendererDefinition[]` | |
1161
+ | `renderers`? | `CellRendererDefinition[]` | Renderers every grid can use by name (`renderer: 'currency'`); `allRenderers` for all of them. |
996
1162
  | `features`? | `readonly GridFeature[]` | Features every grid in the app gets (`allFeatures` for all of them). |
997
- | `locale`? | `string` | |
998
- | `currency`? | `string` | |
999
- | `timeZone`? | `string` | |
1000
- | `density`? | `Density` | |
1163
+ | `locale`? | `string` | Default locale for number and date renderers (default: the browser’s). |
1164
+ | `currency`? | `string` | Default ISO 4217 currency for currency renderers. |
1165
+ | `timeZone`? | `string` | Default IANA time zone for date renderers and date filters. |
1166
+ | `density`? | `Density` | Default density: `compact`, `cozy` (default) or `comfortable`. |
1001
1167
 
1002
1168
  ---
1003
1169
 
@@ -1062,7 +1228,13 @@ import {
1062
1228
  type SortState,
1063
1229
  } from '@nocopypaste/vue-grid'
1064
1230
 
1065
- interface Order { id: number; customer: { name: string }; total: number; status: 'Paid' | 'Open'; placedAt: string }
1231
+ interface Order {
1232
+ id: number
1233
+ customer: { name: string }
1234
+ total: number
1235
+ status: 'Paid' | 'Open'
1236
+ placedAt: string
1237
+ }
1066
1238
 
1067
1239
  const rows = ref<Order[]>([/* … */])
1068
1240
  const sort = ref<SortState | null>(null)
@@ -1070,9 +1242,20 @@ const sort = ref<SortState | null>(null)
1070
1242
  const col = createColumnHelper<Order>()
1071
1243
  const columns = [
1072
1244
  col({ key: 'id', header: '#', renderer: numberRenderer, width: 'min-content', pinned: 'left' }),
1073
- col({ key: 'customer', header: 'Customer', field: 'customer.name', sortable: true, width: 'minmax(10rem, 1fr)' }),
1245
+ col({
1246
+ key: 'customer',
1247
+ header: 'Customer',
1248
+ field: 'customer.name',
1249
+ sortable: true,
1250
+ width: 'minmax(10rem, 1fr)',
1251
+ }),
1074
1252
  col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
1075
- col({ key: 'status', header: 'Status', renderer: statusRenderer, rendererOptions: { tone: { Paid: 'success', Open: 'info' } } }),
1253
+ col({
1254
+ key: 'status',
1255
+ header: 'Status',
1256
+ renderer: statusRenderer,
1257
+ rendererOptions: { tone: { Paid: 'success', Open: 'info' } },
1258
+ }),
1076
1259
  col({ key: 'placedAt', header: 'Placed', renderer: dateTimeRenderer }),
1077
1260
  ]
1078
1261
  </script>
@@ -1098,26 +1281,26 @@ Out of the box `<VGrid>` is a plain, read-only table: columns with any renderer
1098
1281
  saved column state (`storage`), detail rows, tabbable controls and theming. Everything else is
1099
1282
  an opt-in feature:
1100
1283
 
1101
- | Feature | Turns on |
1102
- |---|---|
1103
- | `sortingFeature` | Sort buttons on `sortable` headers, the header menu's sort items, `sort-mode="client"` sorting |
1104
- | `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
1105
- | `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
1106
- | `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
1107
- | `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`) |
1108
- | `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
1109
- | `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 |
1110
- | `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
1111
- | `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; without it pins are ignored |
1112
- | `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
1113
- | `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
1114
- | `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 |
1115
- | `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 |
1116
- | `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) |
1117
- | `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 |
1118
- | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
1119
- | `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 |
1120
- | `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
1284
+ | Feature | Turns on |
1285
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1286
+ | `sortingFeature` | Sort buttons on `sortable` headers, the header menu's sort items, `sort-mode="client"` sorting |
1287
+ | `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
1288
+ | `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
1289
+ | `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
1290
+ | `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`) |
1291
+ | `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
1292
+ | `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 |
1293
+ | `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
1294
+ | `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 |
1295
+ | `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
1296
+ | `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
1297
+ | `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 |
1298
+ | `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 |
1299
+ | `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) |
1300
+ | `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 |
1301
+ | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
1302
+ | `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 |
1303
+ | `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
1121
1304
 
1122
1305
  ```ts
1123
1306
  // per grid
@@ -1143,50 +1326,50 @@ what you import.
1143
1326
  - **per column** (recommended, smallest bundle, typed options): `renderer: currencyRenderer`, or
1144
1327
  - **by name**, after registering them: `createVueGrid({ renderers: [currencyRenderer, statusRenderer] })`
1145
1328
  or `<VGrid :renderers="[…]">`, then `renderer: 'currency'`. `allRenderers` registers every built-in.
1146
- An unregistered name renders as plain text and logs a dev warning saying how to register it.
1329
+ An unregistered name renders as plain text and logs a dev warning saying how to register it.
1147
1330
  - **Components and helpers** (`VGridPagination`, `VGridColumnMenu`, `VGridMenu`, `sortRows`, …) are
1148
1331
  only bundled when imported.
1149
1332
  - **CSS**: `@nocopypaste/vue-grid/style.css` has everything. Pick parts instead:
1150
1333
 
1151
- | File | What | gzip |
1152
- |---|---|---|
1153
- | `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
1154
- | `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.3 kB |
1155
- | `core.css` | `base.css` + `theme.css` | 5.1 kB |
1156
- | `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
1157
- | `style.css` | All of the above | 6.6 kB |
1334
+ | File | What | gzip |
1335
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------ |
1336
+ | `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
1337
+ | `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.3 kB |
1338
+ | `core.css` | `base.css` + `theme.css` | 5.1 kB |
1339
+ | `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
1340
+ | `style.css` | All of the above | 6.6 kB |
1158
1341
 
1159
1342
  For a fully custom look, import only `base.css` (and `renderers.css` if you use renderers)
1160
1343
  and style the `.vg-*` classes yourself. See [Theming](#theming).
1161
1344
 
1162
- | Import (minified / gzip, Vue excluded) | Initial chunk |
1163
- |---|---|
1164
- | `VGrid` (no features) | 39.0 kB / 13.6 kB |
1165
- | `VGrid` + `sortingFeature` | 39.8 kB / 13.9 kB |
1166
- | `VGrid` + `filteringFeature` | 49.7 kB / 17.4 kB |
1167
- | `VGrid` + `serverDataFeature` | 40.4 kB / 14.2 kB |
1168
- | `VGrid` + `paginationFeature` | 39.2 kB / 13.7 kB |
1169
- | `VGrid` + `selectionFeature` | 43.2 kB / 15.1 kB |
1170
- | `VGrid` + `subGridsFeature` | 41.4 kB / 14.5 kB |
1171
- | `VGrid` + `menusFeature` | 49.6 kB / 17.2 kB |
1172
- | `VGrid` + `columnReorderFeature` | 42.7 kB / 14.9 kB |
1173
- | `VGrid` + `columnPinningFeature` | 41.2 kB / 14.5 kB |
1174
- | `VGrid` + `virtualScrollingFeature` | 44.8 kB / 15.8 kB |
1175
- | `VGrid` + `columnVisibilityFeature` | 39.2 kB / 13.7 kB |
1176
- | `VGrid` + `keyboardNavigationFeature` | 41.5 kB / 14.5 kB |
1177
- | `VGrid` + `columnResizingFeature` | 41.8 kB / 14.7 kB |
1178
- | `VGrid` + `columnGroupsFeature` | 40.3 kB / 14.1 kB |
1179
- | `VGrid` + `rowPinningFeature` | 44.0 kB / 15.0 kB |
1180
- | `VGrid` + `aggregationFeature` | 44.2 kB / 15.1 kB |
1181
- | `VGrid` + `rowGroupingFeature` | 48.6 kB / 16.4 kB |
1182
- | `VGrid` + `exportFeature` | 42.8 kB / 15.1 kB |
1183
- | `VGrid` + `allFeatures` + `VGridSearch` | 102.8 kB / 34.7 kB |
1184
- | `VGrid` + `currencyRenderer` | 40.4 kB / 14.1 kB |
1185
- | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 45.8 kB / 15.9 kB |
1186
- | `sortRows` only | 0.7 kB / 0.4 kB |
1187
- | `toCsv` only | 1.1 kB / 0.6 kB |
1188
- | everything | 147.4 kB / 47.2 kB |
1189
- | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 63.7 kB / 17.1 kB |
1345
+ | Import (minified / gzip, Vue excluded) | Initial chunk |
1346
+ | ---------------------------------------------------------------------------- | ------------------ |
1347
+ | `VGrid` (no features) | 39.0 kB / 13.6 kB |
1348
+ | `VGrid` + `sortingFeature` | 39.8 kB / 13.9 kB |
1349
+ | `VGrid` + `filteringFeature` | 49.7 kB / 17.4 kB |
1350
+ | `VGrid` + `serverDataFeature` | 40.4 kB / 14.2 kB |
1351
+ | `VGrid` + `paginationFeature` | 39.2 kB / 13.7 kB |
1352
+ | `VGrid` + `selectionFeature` | 43.2 kB / 15.1 kB |
1353
+ | `VGrid` + `subGridsFeature` | 41.4 kB / 14.5 kB |
1354
+ | `VGrid` + `menusFeature` | 49.6 kB / 17.2 kB |
1355
+ | `VGrid` + `columnReorderFeature` | 42.7 kB / 14.9 kB |
1356
+ | `VGrid` + `columnPinningFeature` | 41.2 kB / 14.5 kB |
1357
+ | `VGrid` + `virtualScrollingFeature` | 44.8 kB / 15.8 kB |
1358
+ | `VGrid` + `columnVisibilityFeature` | 39.2 kB / 13.7 kB |
1359
+ | `VGrid` + `keyboardNavigationFeature` | 41.5 kB / 14.5 kB |
1360
+ | `VGrid` + `columnResizingFeature` | 41.8 kB / 14.7 kB |
1361
+ | `VGrid` + `columnGroupsFeature` | 40.3 kB / 14.1 kB |
1362
+ | `VGrid` + `rowPinningFeature` | 44.0 kB / 15.0 kB |
1363
+ | `VGrid` + `aggregationFeature` | 44.2 kB / 15.1 kB |
1364
+ | `VGrid` + `rowGroupingFeature` | 48.6 kB / 16.4 kB |
1365
+ | `VGrid` + `exportFeature` | 42.8 kB / 15.1 kB |
1366
+ | `VGrid` + `allFeatures` + `VGridSearch` | 102.8 kB / 34.7 kB |
1367
+ | `VGrid` + `currencyRenderer` | 40.4 kB / 14.1 kB |
1368
+ | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 45.8 kB / 15.9 kB |
1369
+ | `sortRows` only | 0.7 kB / 0.4 kB |
1370
+ | `toCsv` only | 1.1 kB / 0.6 kB |
1371
+ | everything | 147.4 kB / 47.2 kB |
1372
+ | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 63.7 kB / 17.1 kB |
1190
1373
 
1191
1374
  With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
1192
1375
  chunks**: they load the first time a popover opens or `filter-row` is on. With
@@ -1203,56 +1386,57 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1203
1386
 
1204
1387
  ### Props
1205
1388
 
1206
- | Prop | Type | Default | |
1207
- |---|---|---|---|
1208
- | `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
1209
- | `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
1210
- | `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). |
1211
- | `columns` | `ColumnDef<T>[]` | — | See below. |
1212
- | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
1213
- | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
1214
- | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
1215
- | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
1216
- | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
1217
- | `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
1218
- | `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
1219
- | `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a *Clear filters* button, when filters hide every row. |
1220
- | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
1221
- | `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
1222
- | `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
1223
- | `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
1224
- | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
1225
- | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
1226
- | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
1227
- | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
1228
- | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
1229
- | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
1230
- | `v-model:selected` | `RowKey[]` | `[]` | |
1231
- | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
1232
- | `isRowSelectable` | `(row) => boolean` | — | |
1233
- | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
1234
- | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
1235
- | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
1236
- | `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). |
1237
- | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
1238
- | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
1239
- | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
1240
- | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
1241
- | `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). |
1242
- | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
1243
- | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
1244
- | `rowClass` | `(row, index) => ClassValue` | — | |
1245
- | `highlightedRows` | `RowKey[]` | — | |
1246
- | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
1247
- | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
1248
- | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
1249
- | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
1250
- | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
1251
- | `emptyText` | `string` | `'No data to show.'` | |
1252
- | `ariaLabel` | `string` | — | |
1253
- | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
1254
- | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
1255
- | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
1389
+ | Prop | Type | Default | |
1390
+ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1391
+ | `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
1392
+ | `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
1393
+ | `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). |
1394
+ | `columns` | `ColumnDef<T>[]` | — | See below. |
1395
+ | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
1396
+ | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
1397
+ | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
1398
+ | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
1399
+ | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
1400
+ | `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
1401
+ | `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
1402
+ | `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a _Clear filters_ button, when filters hide every row. |
1403
+ | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
1404
+ | `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
1405
+ | `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
1406
+ | `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
1407
+ | `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`. |
1408
+ | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
1409
+ | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
1410
+ | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
1411
+ | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
1412
+ | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
1413
+ | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
1414
+ | `v-model:selected` | `RowKey[]` | `[]` | |
1415
+ | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
1416
+ | `isRowSelectable` | `(row) => boolean` | — | |
1417
+ | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
1418
+ | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
1419
+ | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
1420
+ | `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). |
1421
+ | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
1422
+ | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
1423
+ | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
1424
+ | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
1425
+ | `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). |
1426
+ | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
1427
+ | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
1428
+ | `rowClass` | `(row, index) => ClassValue` | — | |
1429
+ | `highlightedRows` | `RowKey[]` | — | |
1430
+ | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
1431
+ | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
1432
+ | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
1433
+ | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
1434
+ | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
1435
+ | `emptyText` | `string` | `'No data to show.'` | |
1436
+ | `ariaLabel` | `string` | — | |
1437
+ | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
1438
+ | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
1439
+ | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
1256
1440
 
1257
1441
  ### Events
1258
1442
 
@@ -1359,8 +1543,16 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
1359
1543
  `#toolbar` slot gets them too, so a batch-action bar lives in the grid:
1360
1544
 
1361
1545
  ```vue
1362
- <VGrid v-model:selected="selected" :rows="requests" :columns="columns" row-key="id" selectable prune-selection
1363
- :is-row-selectable="(r) => r.status === 'pending'" :features="[selectionFeature]">
1546
+ <VGrid
1547
+ v-model:selected="selected"
1548
+ :rows="requests"
1549
+ :columns="columns"
1550
+ row-key="id"
1551
+ selectable
1552
+ prune-selection
1553
+ :is-row-selectable="(r) => r.status === 'pending'"
1554
+ :features="[selectionFeature]"
1555
+ >
1364
1556
  <template #toolbar="{ selected, selectedCount, clearSelection }">
1365
1557
  <template v-if="selectedCount">
1366
1558
  {{ selectedCount }} selected
@@ -1381,11 +1573,11 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
1381
1573
  selection can span server pages. `prune-selection` drops them instead: after a reload, a batch
1382
1574
  delete or a new page, `selected` only holds rows that exist.
1383
1575
  - **All matching rows (server data).** With a `data-source`, the header checkbox selects the loaded
1384
- page; a banner then offers *Select all N rows* (N = the `total` the source returned). That sets
1576
+ page; a banner then offers _Select all N rows_ (N = the `total` the source returned). That sets
1385
1577
  `v-model:select-all-matching`: every row shows ticked, `selectedCount` is N, and your batch
1386
1578
  action should run on the query (`@query-change`) rather than on `selected`. Changing the
1387
1579
  filters, unticking a row (the keys already in `selected` stay, plus the rest of the loaded page) or
1388
- *Clear selection* ends it.
1580
+ _Clear selection_ ends it.
1389
1581
  - `grid.clearSelection()` clears it all from code. Cascading through sub-grids, group checkboxes
1390
1582
  (row grouping) and copying the selected rows (export feature) work as described in their
1391
1583
  sections.
@@ -1393,7 +1585,13 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
1393
1585
  ## Sub-grids (CSS `subgrid`)
1394
1586
 
1395
1587
  ```vue
1396
- <VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(row) => row.children" selectable />
1588
+ <VGrid
1589
+ :rows="markets"
1590
+ :columns="columns"
1591
+ row-key="id"
1592
+ :sub-rows="(row) => row.children"
1593
+ selectable
1594
+ />
1397
1595
  ```
1398
1596
 
1399
1597
  Expanded children render inside a `.vg-subgrid` element that spans every column and uses
@@ -1407,7 +1605,13 @@ Need children with a **different** set of columns? Put another `<VGrid>` in the
1407
1605
  ## Column menu, reorder, persistence
1408
1606
 
1409
1607
  ```vue
1410
- <VGrid :rows :columns row-key="id" storage="orders-grid" :features="[columnVisibilityFeature, columnReorderFeature]">
1608
+ <VGrid
1609
+ :rows
1610
+ :columns
1611
+ row-key="id"
1612
+ storage="orders-grid"
1613
+ :features="[columnVisibilityFeature, columnReorderFeature]"
1614
+ >
1411
1615
  <!-- the picker hides columns (columnVisibilityFeature); dragging headers needs columnReorderFeature -->
1412
1616
  <template #toolbar="{ columnState, setColumnState }">
1413
1617
  <VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
@@ -1430,13 +1634,20 @@ scrolls. No JS positioning, except a small fallback for browsers without anchor
1430
1634
 
1431
1635
  ```vue
1432
1636
  <VGrid
1433
- :rows :columns row-key="id"
1434
- :context-menu="({ row, column, value }) => column.key === 'link' ? [] : [
1435
- { name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
1436
- { name: 'open', label: `Open #${row.id}` },
1437
- { separator: true },
1438
- { name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
1439
- ]"
1637
+ :rows
1638
+ :columns
1639
+ row-key="id"
1640
+ :context-menu="
1641
+ ({ row, column, value }) =>
1642
+ column.key === 'link'
1643
+ ? []
1644
+ : [
1645
+ { name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
1646
+ { name: 'open', label: `Open #${row.id}` },
1647
+ { separator: true },
1648
+ { name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
1649
+ ]
1650
+ "
1440
1651
  @context-action="({ name, row, column, value }) => run(name, row)"
1441
1652
  />
1442
1653
  ```
@@ -1454,9 +1665,14 @@ Pin items need `columnPinningFeature`, move items `columnReorderFeature`, Hide c
1454
1665
 
1455
1666
  ```vue
1456
1667
  <!-- extend (or replace) the built-in items; custom items emit header-action -->
1457
- <VGrid :header-menu="({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]"
1458
- @header-action="({ name, column }) => …" />
1459
- <VGrid :header-menu="false" /> <!-- off -->
1668
+ <VGrid
1669
+ :header-menu="
1670
+ ({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]
1671
+ "
1672
+ @header-action="({ name, column }) => …"
1673
+ />
1674
+ <VGrid :header-menu="false" />
1675
+ <!-- off -->
1460
1676
  ```
1461
1677
 
1462
1678
  Columns opt out with `pinnable: false`, `reorderable: false`, `hideable: false`.
@@ -1475,23 +1691,39 @@ The same component powers the `actions-menu` renderer and is exported for add-on
1475
1691
 
1476
1692
  ```vue
1477
1693
  <script setup lang="ts">
1478
- import { VGrid, VGridSearch, filteringFeature, numberRenderer, statusRenderer, type FilterState } from '@nocopypaste/vue-grid'
1694
+ import {
1695
+ VGrid,
1696
+ VGridSearch,
1697
+ filteringFeature,
1698
+ numberRenderer,
1699
+ statusRenderer,
1700
+ type FilterState,
1701
+ } from '@nocopypaste/vue-grid'
1479
1702
 
1480
1703
  const filters = ref<FilterState | null>(null)
1481
1704
  const columns = [
1482
- { key: 'player', header: 'Player', filterable: true }, // text
1483
- { key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
1484
- { key: 'status', header: 'Status', filterable: true, renderer: statusRenderer },// value list
1485
- { key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
1705
+ { key: 'player', header: 'Player', filterable: true }, // text
1706
+ { key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
1707
+ { key: 'status', header: 'Status', filterable: true, renderer: statusRenderer }, // value list
1708
+ { key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
1486
1709
  ]
1487
1710
  </script>
1488
1711
 
1489
1712
  <template>
1490
- <VGrid v-model:filters="filters" :rows :columns row-key="id" :features="[filteringFeature]"
1491
- filter-row filter-storage="bets-filters">
1713
+ <VGrid
1714
+ v-model:filters="filters"
1715
+ :rows
1716
+ :columns
1717
+ row-key="id"
1718
+ :features="[filteringFeature]"
1719
+ filter-row
1720
+ filter-storage="bets-filters"
1721
+ >
1492
1722
  <template #toolbar="{ activeFilterCount, clearFilters }">
1493
1723
  <VGridSearch />
1494
- <button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }} filters</button>
1724
+ <button v-if="activeFilterCount" @click="clearFilters()">
1725
+ Clear {{ activeFilterCount }} filters
1726
+ </button>
1495
1727
  </template>
1496
1728
  </VGrid>
1497
1729
  </template>
@@ -1502,18 +1734,19 @@ const columns = [
1502
1734
  popover through the Popover API and CSS anchor positioning, and the popover holds an editor for
1503
1735
  the column's type:
1504
1736
 
1505
- | Type | Editor | Operators |
1506
- |---|---|---|
1507
- | `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
1508
- | `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
1509
- | `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
1510
- | `boolean` | radio group | any, yes, no, empty |
1511
- | `set` | searchable checkbox list with counts | (the selected values) |
1512
- | `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
1737
+ | Type | Editor | Operators |
1738
+ | --------- | ------------------------------------ | -------------------------------------------------------------------------------------------------- |
1739
+ | `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
1740
+ | `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
1741
+ | `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
1742
+ | `boolean` | radio group | any, yes, no, empty |
1743
+ | `set` | searchable checkbox list with counts | (the selected values) |
1744
+ | `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
1513
1745
 
1514
1746
  The type comes from `filter`, else from the renderer (number, currency, change → `number`;
1515
1747
  date, datetime → `date`; boolean, checkbox, switch → `boolean`; status, chip → `set`), else
1516
1748
  `text`.
1749
+
1517
1750
  - **Filter row** (`filter-row`). An inline input under each header that accepts shorthand:
1518
1751
  `>10`, `>=10`, `5..20`, `-5..-1`, open ranges `5..` / `..20`, `!=3`, a decimal comma (`1,5`),
1519
1752
  and `>2026-01-01` or `2026-01-01..2026-03-31` for dates; plain text for text columns. Input that
@@ -1522,7 +1755,7 @@ const columns = [
1522
1755
  - **Quick search.** `<VGridSearch>` inside the `#toolbar` slot drives that grid's search. Anywhere
1523
1756
  else, bind it with `v-model` to `filters.search`. The search matches any visible column that is
1524
1757
  not marked `searchable: false`.
1525
- - **Matching** is case- and accent-insensitive (`nis` finds *Niš*). Dates compare by calendar day
1758
+ - **Matching** is case- and accent-insensitive (`nis` finds _Niš_). Dates compare by calendar day
1526
1759
  in the grid's `timeZone`; a date-only string (`2026-01-05`) is that calendar day in every time
1527
1760
  zone, for filtering and for the `date` renderer. Column filters combine with AND, and then the
1528
1761
  search must match too. Saved filters for columns that no longer exist are ignored.
@@ -1534,18 +1767,43 @@ const columns = [
1534
1767
  The list is fetched when the popover opens and again on every search (debounced). Superseded
1535
1768
  requests are cancelled.
1536
1769
  - The header menu has **Filter… / Clear filter / Clear all filters** items. When filters hide
1537
- every row, the grid shows `noMatchText` with a *Clear filters* button.
1770
+ every row, the grid shows `noMatchText` with a _Clear filters_ button.
1538
1771
 
1539
1772
  The model is plain JSON, so you can store it, put it in the URL or send it to an API as is:
1540
1773
 
1541
1774
  ```ts
1542
- interface FilterState { columns: Record<string, ColumnFilter>; search?: string }
1775
+ interface FilterState {
1776
+ columns: Record<string, ColumnFilter>
1777
+ search?: string
1778
+ }
1543
1779
  type ColumnFilter =
1544
- | { type: 'text'; op: 'contains' | 'notContains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'empty' | 'notEmpty'; value?: string }
1545
- | { type: 'number'; op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'; value?: number | null; to?: number | null }
1546
- | { type: 'date'; op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'; value?: string; to?: string } // YYYY-MM-DD
1780
+ | {
1781
+ type: 'text'
1782
+ op:
1783
+ | 'contains'
1784
+ | 'notContains'
1785
+ | 'equals'
1786
+ | 'notEquals'
1787
+ | 'startsWith'
1788
+ | 'endsWith'
1789
+ | 'empty'
1790
+ | 'notEmpty'
1791
+ value?: string
1792
+ }
1793
+ | {
1794
+ type: 'number'
1795
+ op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'
1796
+ value?: number | null
1797
+ to?: number | null
1798
+ }
1799
+ | {
1800
+ type: 'date'
1801
+ op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'
1802
+ value?: string
1803
+ to?: string
1804
+ } // YYYY-MM-DD
1547
1805
  | { type: 'boolean'; value: boolean | null }
1548
- | { type: 'set'; values: string[] } // '' stands for blank cells
1806
+ | { type: 'set'; values: string[] } // '' stands for blank cells
1549
1807
  | { type: 'custom'; value: unknown }
1550
1808
  ```
1551
1809
 
@@ -1565,7 +1823,13 @@ itself; it shows exactly what the function returns.
1565
1823
 
1566
1824
  ```vue
1567
1825
  <script setup lang="ts">
1568
- import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
1826
+ import {
1827
+ filteringFeature,
1828
+ paginationFeature,
1829
+ serverDataFeature,
1830
+ sortingFeature,
1831
+ type DataSource,
1832
+ } from '@nocopypaste/vue-grid'
1569
1833
 
1570
1834
  const fetchBets: DataSource<Bet> = async (query, { signal }) => {
1571
1835
  // query: { sort: { key, dir } | null, filters: FilterState, page: number, pageSize: number | null }
@@ -1576,15 +1840,23 @@ const fetchBets: DataSource<Bet> = async (query, { signal }) => {
1576
1840
  </script>
1577
1841
 
1578
1842
  <template>
1579
- <VGrid ref="grid" :data-source="fetchBets" :columns row-key="id" pagination filter-row @load-error="toast"
1580
- :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" />
1843
+ <VGrid
1844
+ ref="grid"
1845
+ :data-source="fetchBets"
1846
+ :columns
1847
+ row-key="id"
1848
+ pagination
1849
+ filter-row
1850
+ @load-error="toast"
1851
+ :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]"
1852
+ />
1581
1853
  </template>
1582
1854
  ```
1583
1855
 
1584
1856
  - **Cancellation.** A new query aborts the previous request through `signal`, and a late response
1585
1857
  from a superseded request is ignored, so fast typing never shows stale rows.
1586
1858
  - **States.** The grid shows a progress bar while loading. If the function throws, it shows
1587
- *Couldn't load the rows.* with a *Retry* button and emits `load-error`.
1859
+ _Couldn't load the rows._ with a _Retry_ button and emits `load-error`.
1588
1860
  - **Paging.** `pagination` adds the pager and sends `page` / `pageSize`; return `total` so the
1589
1861
  pager knows how many pages there are. Without `pagination`, `pageSize` is `null` (fetch
1590
1862
  everything). The page resets to 1 when sort or filters change.
@@ -1596,8 +1868,16 @@ and `filter-mode="controlled"`, and handle one event. The grid emits the combine
1596
1868
  and on every change, and skips duplicates:
1597
1869
 
1598
1870
  ```vue
1599
- <VGrid :rows="rows" :columns row-key="id" :loading="loading" :features="[sortingFeature, filteringFeature]"
1600
- sort-mode="controlled" filter-mode="controlled" @query-change="load" />
1871
+ <VGrid
1872
+ :rows="rows"
1873
+ :columns
1874
+ row-key="id"
1875
+ :loading="loading"
1876
+ :features="[sortingFeature, filteringFeature]"
1877
+ sort-mode="controlled"
1878
+ filter-mode="controlled"
1879
+ @query-change="load"
1880
+ />
1601
1881
  ```
1602
1882
 
1603
1883
  Use this when the data comes from a store, a WebSocket or a GraphQL client that you already manage.
@@ -1608,14 +1888,34 @@ Use this when the data comes from a store, a WebSocket or a GraphQL client that
1608
1888
  filtered rows; with a `dataSource` it requests pages.
1609
1889
 
1610
1890
  ```vue
1611
- <VGrid :rows :columns row-key="id" :features="[paginationFeature]" :pagination="{ pageSizes: [10, 25, 50] }" v-model:page="page" v-model:page-size="pageSize" />
1891
+ <VGrid
1892
+ :rows
1893
+ :columns
1894
+ row-key="id"
1895
+ :features="[paginationFeature]"
1896
+ :pagination="{ pageSizes: [10, 25, 50] }"
1897
+ v-model:page="page"
1898
+ v-model:page-size="pageSize"
1899
+ />
1612
1900
  ```
1613
1901
 
1614
1902
  Or place the standalone component yourself and feed the grid one page at a time:
1615
1903
 
1616
1904
  ```vue
1617
- <VGrid v-model:sort="sort" :rows="pageRows" :columns row-key="id" :loading="loading" :features="[sortingFeature]" />
1618
- <VGridPagination v-model:page="page" v-model:page-size="pageSize" :total="total" :page-sizes="[10, 25, 50]" />
1905
+ <VGrid
1906
+ v-model:sort="sort"
1907
+ :rows="pageRows"
1908
+ :columns
1909
+ row-key="id"
1910
+ :loading="loading"
1911
+ :features="[sortingFeature]"
1912
+ />
1913
+ <VGridPagination
1914
+ v-model:page="page"
1915
+ v-model:page-size="pageSize"
1916
+ :total="total"
1917
+ :page-sizes="[10, 25, 50]"
1918
+ />
1619
1919
  ```
1620
1920
 
1621
1921
  ## Pinned rows and totals
@@ -1675,14 +1975,25 @@ const columns = [
1675
1975
  col({ key: 'city', field: 'player.city', groupable: true }),
1676
1976
  col({ key: 'status', renderer: statusRenderer, groupable: true }),
1677
1977
  col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
1678
- col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (b) => b.placedAt.slice(0, 7) }),
1978
+ col({
1979
+ key: 'placedAt',
1980
+ renderer: dateRenderer,
1981
+ groupable: true,
1982
+ groupValue: (b) => b.placedAt.slice(0, 7),
1983
+ }),
1679
1984
  ]
1680
1985
  const groupBy = ref(['status', 'city'])
1681
1986
  </script>
1682
1987
 
1683
1988
  <template>
1684
- <VGrid v-model:group-by="groupBy" :rows="bets" :columns="columns" row-key="id" totals
1685
- :features="[rowGroupingFeature, aggregationFeature]" />
1989
+ <VGrid
1990
+ v-model:group-by="groupBy"
1991
+ :rows="bets"
1992
+ :columns="columns"
1993
+ row-key="id"
1994
+ totals
1995
+ :features="[rowGroupingFeature, aggregationFeature]"
1996
+ />
1686
1997
  </template>
1687
1998
  ```
1688
1999
 
@@ -1692,6 +2003,11 @@ const groupBy = ref(['status', 'city'])
1692
2003
  an `aggregate`; those show the group's own aggregate. The `group-<key>` slot renders the value
1693
2004
  yourself (`{ value, count, rows, column, group }`); `total-<key>` also renders group cells
1694
2005
  (with `group` set). Empty values form a `(blank)` group, last.
2006
+ - **In a narrow column** (a fixed-width first column followed by an aggregate) the label never
2007
+ widens the column: under 12rem the column name is dropped, then the value is cut with an
2008
+ ellipsis; the count stays. The whole label (“City: Novi Sad (12)”) is the cell's tooltip.
2009
+ - **Keyboard.** ↑ / ↓ keep their column across a group row, even though its label spans several:
2010
+ from Stake up onto a group row lands on its Stake aggregate, and back down on Stake.
1695
2011
  - **Order, filters, pages.** Groups follow the filters and are ordered by value, descending when
1696
2012
  the grid is sorted descending by the grouped column; sorting by any other column orders the
1697
2013
  rows inside each group. Pagination pages the top-level groups. With server data, the rows of
@@ -1701,8 +2017,8 @@ const groupBy = ref(['status', 'city'])
1701
2017
  Changing `group-by` starts over.
1702
2018
  - **Selection.** A group's checkbox selects or clears every row in it, and shows partly
1703
2019
  selected groups as indeterminate.
1704
- - **Header menu.** Columns with `groupable: true` get *Group by* (adds a level) / *Ungroup*, and
1705
- *Ungroup all*. Any column can be grouped through `v-model:group-by`.
2020
+ - **Header menu.** Columns with `groupable: true` get _Group by_ (adds a level) / _Ungroup_, and
2021
+ _Ungroup all_. Any column can be grouped through `v-model:group-by`.
1706
2022
  - **Virtual scrolling.** Group rows are part of the virtual layout: thousands of rows in a few
1707
2023
  groups render only what's in view.
1708
2024
 
@@ -1729,9 +2045,16 @@ const columns = [
1729
2045
  <template>
1730
2046
  <button @click="grid?.exportCsv({ filename: 'orders.csv', totals: true })">Download CSV</button>
1731
2047
  <button @click="grid?.copyRows()">Copy selected</button>
1732
- <VGrid ref="grid" :rows="orders" :columns="columns" row-key="id" selectable totals
1733
- :features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
1734
- @copy="(e) => toast(`Copied ${e.rows.length} rows`)" />
2048
+ <VGrid
2049
+ ref="grid"
2050
+ :rows="orders"
2051
+ :columns="columns"
2052
+ row-key="id"
2053
+ selectable
2054
+ totals
2055
+ :features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
2056
+ @copy="(e) => toast(`Copied ${e.rows.length} rows`)"
2057
+ />
1735
2058
  </template>
1736
2059
  ```
1737
2060
 
@@ -1768,8 +2091,14 @@ and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(t
1768
2091
  ## Virtual scrolling
1769
2092
 
1770
2093
  ```vue
1771
- <VGrid :rows="tenThousandRows" :columns row-key="id" :features="[virtualScrollingFeature]"
1772
- :virtual="{ rowHeight: 40 }" style="height: 600px" />
2094
+ <VGrid
2095
+ :rows="tenThousandRows"
2096
+ :columns
2097
+ row-key="id"
2098
+ :features="[virtualScrollingFeature]"
2099
+ :virtual="{ rowHeight: 40 }"
2100
+ style="height: 600px"
2101
+ />
1773
2102
  ```
1774
2103
 
1775
2104
  Rows have a fixed height; only the visible window plus `overscan` is rendered.
@@ -1851,6 +2180,10 @@ header moves the column; `Alt+Shift+←/→` on a header resizes it (with `colum
1851
2180
  your own element inside a flex or grid layout, give that element `min-width: 0` too, or it
1852
2181
  grows to the columns' width. The toolbar wraps, and on narrow screens the pager drops its
1853
2182
  « / » buttons (page 1 and the last page stay).
2183
+ - **Pinned columns** that would take more than half of a narrow grid (`pinned-max-share`)
2184
+ scroll like the others there, so the rest of the row stays readable; they pin again once the
2185
+ grid is wide enough. The pins stay in the column state; `pinned-max-share="false"` keeps them
2186
+ pinned at any width.
1854
2187
  - **Swipes scroll** the grid, also when they start on a header (except on a column's narrow
1855
2188
  resize edge).
1856
2189
  - **Hold a header** (about half a second) to pick the column up, then drag it to reorder
@@ -1868,44 +2201,48 @@ Screenshots of every renderer are in the repository README's
1868
2201
 
1869
2202
  **Display**
1870
2203
 
1871
- | Name | Options |
1872
- |---|---|
1873
- | `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
1874
- | `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
1875
- | `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
1876
- | `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
1877
- | `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
1878
- | `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
1879
- | `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
1880
- | `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
1881
- | `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
1882
- | `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 }` |
1883
- | `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
1884
- | `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
1885
- | `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
1886
- | `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
1887
- | `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
1888
- | `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
1889
- | `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
1890
- | `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
1891
-
1892
- **Actions and editing** — editable renderers are *controlled*: they show the data and emit the requested
2204
+ | Name | Options |
2205
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2206
+ | `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
2207
+ | `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
2208
+ | `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
2209
+ | `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
2210
+ | `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
2211
+ | `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
2212
+ | `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
2213
+ | `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
2214
+ | `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
2215
+ | `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 }` |
2216
+ | `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
2217
+ | `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
2218
+ | `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
2219
+ | `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
2220
+ | `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
2221
+ | `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
2222
+ | `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
2223
+ | `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
2224
+
2225
+ **Actions and editing** — editable renderers are _controlled_: they show the data and emit the requested
1893
2226
  change; your `@cell-action` handler updates the row.
1894
2227
 
1895
- | Name | Options → emits |
1896
- |---|---|
1897
- | `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
1898
- | `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
1899
- | `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
1900
- | `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
1901
- | `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
1902
- | `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
1903
- | `radio` | same + `name` → `select` (payload: the row key) |
1904
- | `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
2228
+ | Name | Options → emits |
2229
+ | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
2230
+ | `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
2231
+ | `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
2232
+ | `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
2233
+ | `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
2234
+ | `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
2235
+ | `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
2236
+ | `radio` | same + `name` → `select` (payload: the row key) |
2237
+ | `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
1905
2238
 
1906
2239
  ```vue
1907
- <VGrid :rows="rows" :columns="[{ key: 'web', renderer: 'switch' }]" row-key="id"
1908
- @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)" />
2240
+ <VGrid
2241
+ :rows="rows"
2242
+ :columns="[{ key: 'web', renderer: 'switch' }]"
2243
+ row-key="id"
2244
+ @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)"
2245
+ />
1909
2246
  ```
1910
2247
 
1911
2248
  Values option callbacks receive `(value, row)`. The component of every renderer is exported too
@@ -1924,17 +2261,24 @@ const props = defineProps<CellRendererProps<unknown, number, { max?: number }>>(
1924
2261
  const emit = defineEmits<CellRendererEmits>()
1925
2262
  </script>
1926
2263
  <template>
1927
- <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">{{ n <= value ? '★' : '☆' }}</button>
2264
+ <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">
2265
+ {{ n <= value ? '★' : '☆' }}
2266
+ </button>
1928
2267
  </template>
1929
2268
  ```
1930
2269
 
1931
2270
  ```ts
1932
2271
  import { defineCellRenderer } from '@nocopypaste/vue-grid'
1933
2272
  declare module '@nocopypaste/vue-grid' {
1934
- interface CellRendererRegistry { rating: { max?: number } } // typed `renderer: 'rating'`
2273
+ interface CellRendererRegistry {
2274
+ rating: { max?: number }
2275
+ } // typed `renderer: 'rating'`
1935
2276
  }
1936
2277
  export const ratingRenderer = defineCellRenderer<{ max?: number }>({
1937
- name: 'rating', component: RatingCell, defaults: { max: 5 }, sortValue: (v) => Number(v),
2278
+ name: 'rating',
2279
+ component: RatingCell,
2280
+ defaults: { max: 5 },
2281
+ sortValue: (v) => Number(v),
1938
2282
  // what Ctrl+C and formatted CSV exports copy (export feature); without it the raw value
1939
2283
  format: (v, options, ctx, row) => `${Number(v ?? 0)} of ${options.max ?? 5}`,
1940
2284
  })
@@ -1960,14 +2304,14 @@ Override any token on `:root`, a wrapper, or the grid itself:
1960
2304
  }
1961
2305
  ```
1962
2306
 
1963
- | Group | Tokens |
1964
- |---|---|
1965
- | 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` |
1966
- | 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` |
1967
- | 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` |
1968
- | Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
1969
- | Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
1970
- | Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
2307
+ | Group | Tokens |
2308
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2309
+ | 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` |
2310
+ | 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` |
2311
+ | 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` |
2312
+ | Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
2313
+ | Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
2314
+ | Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
1971
2315
 
1972
2316
  Motion stays on the compositor (`transform`, `opacity`) wherever layout would otherwise animate.
1973
2317
  Row highlights (hover, selection) appear at once and fade out over `--vg-transition`, so the grid
@@ -1990,10 +2334,21 @@ import './my-grid-theme.css'
1990
2334
 
1991
2335
  ```css
1992
2336
  /* my-grid-theme.css — unlayered, or in your own layer after `vue-grid` */
1993
- .vg-viewport { border: 1px solid #ddd; }
1994
- .vg-header-cell { padding: 0.5rem 0.75rem; background: #fafafa; font-weight: 600; }
1995
- .vg-cell { padding: 0.5rem 0.75rem; border-top: 1px solid #eee; }
1996
- .vg-row:hover > .vg-cell { background: #f5f5f5; }
2337
+ .vg-viewport {
2338
+ border: 1px solid #ddd;
2339
+ }
2340
+ .vg-header-cell {
2341
+ padding: 0.5rem 0.75rem;
2342
+ background: #fafafa;
2343
+ font-weight: 600;
2344
+ }
2345
+ .vg-cell {
2346
+ padding: 0.5rem 0.75rem;
2347
+ border-top: 1px solid #eee;
2348
+ }
2349
+ .vg-row:hover > .vg-cell {
2350
+ background: #f5f5f5;
2351
+ }
1997
2352
  ```
1998
2353
 
1999
2354
  Base only gives sticky header and pinned cells the system `Canvas` background, so content doesn't
@@ -2016,8 +2371,8 @@ import { validateGridConfig } from '@nocopypaste/vue-grid/agent'
2016
2371
 
2017
2372
  const { ok, diagnostics } = validateGridConfig({
2018
2373
  rowKey: 'id',
2019
- features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
2020
- renderers: [], // registered renderer names / definitions
2374
+ features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
2375
+ renderers: [], // registered renderer names / definitions
2021
2376
  columns: [{ key: 'total', renderer: 'currency', sortable: true, widht: '8rem' }],
2022
2377
  })
2023
2378
  // error columns[0].widht Columns have no option `widht`. Did you mean `width`?
@@ -2037,16 +2392,16 @@ Evergreen browsers: CSS `subgrid`, `light-dark()`, `@layer`, the Popover API and
2037
2392
  **CSS first, JS only as a fallback.** Everything the browser can do in CSS / HTML is done there; a
2038
2393
  small JS fallback runs only when a feature check (`CSS.supports`) says the browser can't:
2039
2394
 
2040
- | Behaviour | Done with | JS fallback when unsupported |
2041
- |---|---|---|
2042
- | Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
2043
- | 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) |
2044
- | Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
2045
- | Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
2046
- | Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
2047
- | Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
2048
- | Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
2049
- | Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
2395
+ | Behaviour | Done with | JS fallback when unsupported |
2396
+ | ------------------------------------------------------------------ | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2397
+ | Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
2398
+ | 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) |
2399
+ | Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
2400
+ | Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
2401
+ | Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
2402
+ | Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
2403
+ | Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
2404
+ | Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
2050
2405
 
2051
2406
  What stays in JS is what CSS can't express: data (sorting, selection, expansion state), keyboard
2052
2407
  navigation, column drag, virtual scrolling and lazy loading.