@nocopypaste/vue-grid 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/AGENTS.md +249 -84
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +412 -228
  4. package/agent/api.json +89 -89
  5. package/agent/api.md +84 -84
  6. package/agent/grid-config.schema.json +11 -5
  7. package/dist/agent/api.js +89 -89
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/agent/validate.js.map +1 -1
  10. package/dist/base.css +1 -1
  11. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +1 -1
  12. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  14. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +1 -1
  17. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +9 -4
  20. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
  21. package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  23. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  24. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +4 -4
  25. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  27. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +1 -1
  28. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  29. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +2 -2
  31. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  32. package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  33. package/dist/composables/useColumnDrag.js.map +1 -1
  34. package/dist/composables/useColumnResize.js.map +1 -1
  35. package/dist/composables/useDataSource.js.map +1 -1
  36. package/dist/composables/useGridExport.js.map +1 -1
  37. package/dist/composables/useGridFilters.js.map +1 -1
  38. package/dist/composables/useGridKeyboard.js +46 -36
  39. package/dist/composables/useGridKeyboard.js.map +1 -1
  40. package/dist/composables/useGridMenus.js.map +1 -1
  41. package/dist/composables/useGridSelection.js.map +1 -1
  42. package/dist/composables/usePinnedRows.js.map +1 -1
  43. package/dist/composables/useRowGrouping.js.map +1 -1
  44. package/dist/composables/useTotals.js.map +1 -1
  45. package/dist/composables/useVirtualRows.js.map +1 -1
  46. package/dist/core/aggregate.js.map +1 -1
  47. package/dist/core/columns.js.map +1 -1
  48. package/dist/core/csv.js.map +1 -1
  49. package/dist/core/filter.js.map +1 -1
  50. package/dist/core/grouping.js.map +1 -1
  51. package/dist/core/pagination.js.map +1 -1
  52. package/dist/core/patch.js.map +1 -1
  53. package/dist/core/selection.js.map +1 -1
  54. package/dist/core/sort.js.map +1 -1
  55. package/dist/core/storage.js.map +1 -1
  56. package/dist/core/value.js.map +1 -1
  57. package/dist/core.css +1 -1
  58. package/dist/features/aggregation.js.map +1 -1
  59. package/dist/features/columnGroups.js.map +1 -1
  60. package/dist/features/columnVisibility.js.map +1 -1
  61. package/dist/features/filtering.js.map +1 -1
  62. package/dist/features/keyboardNavigation.js.map +1 -1
  63. package/dist/features/menus.js.map +1 -1
  64. package/dist/features/rowGrouping.js.map +1 -1
  65. package/dist/features/rowPinning.js.map +1 -1
  66. package/dist/features/selection.js.map +1 -1
  67. package/dist/features/virtualScrolling.js.map +1 -1
  68. package/dist/internal/RenderSlot.js.map +1 -1
  69. package/dist/internal/anchor.js +20 -21
  70. package/dist/internal/anchor.js.map +1 -1
  71. package/dist/internal/context.js.map +1 -1
  72. package/dist/internal/supports.js +2 -2
  73. package/dist/internal/supports.js.map +1 -1
  74. package/dist/internal/touchHold.js.map +1 -1
  75. package/dist/registry/plugin.js.map +1 -1
  76. package/dist/registry/registry.js.map +1 -1
  77. package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  78. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  79. package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  80. package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  81. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  83. package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  84. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  86. package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  87. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  89. package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  91. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  92. package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  93. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  95. package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  96. package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  97. package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  98. package/dist/renderers/format.js.map +1 -1
  99. package/dist/renderers/index.js.map +1 -1
  100. package/dist/renderers/options.js.map +1 -1
  101. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
  103. package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  104. package/dist/renderers/parts/icons.js.map +1 -1
  105. package/dist/renderers/parts/useToggleControl.js.map +1 -1
  106. package/dist/renderers/plainText.js.map +1 -1
  107. package/dist/renderers/text.js.map +1 -1
  108. package/dist/theme.css +1 -1
  109. package/dist/types/agent/index.d.ts +2 -2
  110. package/dist/types/internal/anchor.d.ts +10 -2
  111. package/dist/types/internal/supports.d.ts +0 -5
  112. package/dist/types/renderers/NumberCell.vue.d.ts +2 -4
  113. package/dist/types/renderers/index.d.ts +3 -5
  114. package/dist/types/renderers/options.d.ts +45 -0
  115. package/dist/types/renderers/plainText.d.ts +2 -4
  116. package/dist/types/types.d.ts +35 -0
  117. package/dist/vue-grid.css +1 -1
  118. package/llms-full.txt +745 -396
  119. package/package.json +1 -1
package/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'` |
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.0 — API reference
519
+ # @nocopypaste/vue-grid 0.3.2 — 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
 
@@ -544,16 +709,16 @@ Text, the default renderer (the only one `<VGrid>` bundles): ellipsis, line clam
544
709
  |---|---|---|
545
710
  | `ellipsis` | `boolean` | Single line with ellipsis (full text in a tooltip). |
546
711
  | `lines` | `number` | Clamp to N lines. |
547
- | `maxWidth` | `string` | |
712
+ | `maxWidth` | `string` | CSS max width of the text, e.g. `'16rem'`: longer text wraps or, with `ellipsis`, is cut. |
548
713
  | `preserveNewlines` | `boolean` | Keep line breaks in the value (`white-space: pre-line`). |
549
714
  | `tooltip` | `boolean \| RowFn<string \| undefined>` | `true` = value as tooltip; a function computes it. |
550
715
  | `placeholder` | `string` | Shown when the value is empty. |
551
- | `tone` | `RowOption<Tone \| undefined>` | |
716
+ | `tone` | `RowOption<Tone \| undefined>` | Colour of the text (`success`, `danger`, `warning`, `info`, `neutral`, `accent`), or `(value, row) => tone`. |
552
717
  | `toneMode` | `'text' \| 'fill'` | `text` (default) colours the text; `fill` colours the badge-like background. |
553
- | `bold` | `RowOption<boolean>` | |
718
+ | `bold` | `RowOption<boolean>` | Bold text, for every row or `(value, row) => boolean`. |
554
719
  | `secondary` | `RowFn<string \| null \| undefined>` | Muted text after the value, e.g. a half-time score: `2:1 (1:0)`. |
555
720
  | `badge` | `RowFn<BadgeSpec \| string \| null \| undefined>` | Badge before (default) or after the value. |
556
- | `badgePosition` | `'start' \| 'end'` | |
721
+ | `badgePosition` | `'start' \| 'end'` | Where `badge` goes: `start` (default, before the value) or `end`. |
557
722
  | `icon` | `RowFn<IconSpec \| null \| undefined>` | Icon before the value, e.g. `{ icon: BellIcon, tone: 'warning', label: 'Notify' }`. |
558
723
  | `copyable` | `boolean` | Adds a copy-to-clipboard button; emits `copy` with the copied text. |
559
724
  | `copyValue` | `RowFn<string>` | What gets copied (default: the displayed text). |
@@ -565,7 +730,7 @@ Text that toggles a highlight when clicked. Emits `toggle` (with `clickable`). A
565
730
  | Option | Type | Description |
566
731
  |---|---|---|
567
732
  | `clickable` | `boolean \| RowFn<boolean>` | When true, the text is a button that emits action `toggle`. |
568
- | `highlighted` | `boolean \| RowFn<boolean>` | |
733
+ | `highlighted` | `boolean \| RowFn<boolean>` | Shown as switched on (highlighted, `aria-pressed`), e.g. `(v, row) => row.starred`. |
569
734
  | `placeholder` | `string` | Shown when the value is empty. |
570
735
 
571
736
  ### `number` — `numberRenderer`
@@ -584,10 +749,10 @@ Numbers that always show their sign (+ / −). With `clickable`, emits `click`.
584
749
 
585
750
  | Option | Type | Description |
586
751
  |---|---|---|
752
+ | `signed` | `boolean` | Always show the sign (`+3`, `−2`). Default `true` for `signed-number`; `false` formats like `number`. |
587
753
  | `format` | `Intl.NumberFormatOptions` | `Intl.NumberFormat` options, e.g. `{ maximumFractionDigits: 0 }` or `{ style: 'percent' }`. |
588
754
  | `placeholder` | `string` | Shown when the value is empty. |
589
755
  | `clickable` | `RowOption<boolean>` | Renders the number as a link-style button that emits `click` (drill-down). |
590
- | `signed` | `boolean` | |
591
756
 
592
757
  ### `currency` — `currencyRenderer`
593
758
 
@@ -628,7 +793,7 @@ Date and time, on two lines by default. Align: `start` · filter type: `date`.
628
793
 
629
794
  | Option | Type | Description |
630
795
  |---|---|---|
631
- | `milliseconds` | `boolean` | |
796
+ | `milliseconds` | `boolean` | Show milliseconds in the time (`12:30:05.123`). |
632
797
  | `twoLines` | `boolean` | Date and time on two lines (default true). |
633
798
  | `format` | `Intl.DateTimeFormatOptions` | `Intl.DateTimeFormat` options, e.g. `{ dateStyle: 'medium' }`. |
634
799
  | `placeholder` | `string` | Shown when the value is empty. |
@@ -639,9 +804,9 @@ Yes / no as text labels or icons. Align: `start` · filter type: `boolean`.
639
804
 
640
805
  | Option | Type | Description |
641
806
  |---|---|---|
642
- | `trueLabel` | `string` | |
643
- | `falseLabel` | `string` | |
644
- | `nullLabel` | `string` | |
807
+ | `trueLabel` | `string` | Text for `true` (and its accessible name in icon mode). Default “Yes”. |
808
+ | `falseLabel` | `string` | Text for `false`. Default “No”. |
809
+ | `nullLabel` | `string` | Text for `null` / `undefined`. Default: nothing. |
645
810
  | `display` | `'text' \| 'icon'` | `text` (default): labels. `icon`: a check for true, nothing (or a cross) for false. |
646
811
  | `falseIcon` | `boolean` | In icon mode, show a cross for false (default: nothing). |
647
812
 
@@ -651,9 +816,9 @@ A coloured status badge (tone from a map, a function or a constant). With `click
651
816
 
652
817
  | Option | Type | Description |
653
818
  |---|---|---|
654
- | `tone` | `ToneOption` | |
819
+ | `tone` | `ToneOption` | Badge colour: one tone, a value → tone map (`{ Paid: 'success', Open: 'info' }`), or `(value, row) => tone`. Default `neutral`. |
655
820
  | `label` | `RowFn<string> \| Record<string, string>` | Label from a function, or a value → label map. |
656
- | `dot` | `boolean` | |
821
+ | `dot` | `boolean` | A coloured dot before the label. Default `true`; `false` hides it. |
657
822
  | `variant` | `'soft' \| 'solid' \| 'outline'` | `soft` (default, tinted), `solid` (filled) or `outline`. |
658
823
  | `placeholder` | `string` | Shown when the value is empty. |
659
824
  | `clickable` | `RowOption<boolean>` | Badge becomes a button that emits `click`. |
@@ -664,11 +829,11 @@ A safe link (http(s), mailto, tel only), or a `<RouterLink>` with `to` when vue-
664
829
 
665
830
  | Option | Type | Description |
666
831
  |---|---|---|
667
- | `href` | `RowFn<string \| undefined>` | |
832
+ | `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
833
  | `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>` | |
834
+ | `label` | `RowFn<string>` | Link text (default: the value). |
835
+ | `target` | `'_self' \| '_blank'` | `_blank` opens a new tab (with `rel="noopener noreferrer"`). |
836
+ | `tooltip` | `RowFn<string \| undefined>` | Hover text of the link. |
672
837
 
673
838
  ### `icon` — `iconRenderer`
674
839
 
@@ -678,9 +843,9 @@ An icon component, fixed or picked per row. Align: `center` · filter type: `tex
678
843
  |---|---|---|
679
844
  | `icon` | `Component` | Static icon component. |
680
845
  | `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>` | |
846
+ | `show` | `RowFn<boolean>` | Show the icon for this row (default: always). A hidden icon keeps its space, so columns stay aligned. |
847
+ | `label` | `string \| RowFn<string>` | Accessible name and tooltip. Without one the icon is decorative. |
848
+ | `tone` | `Tone \| RowFn<Tone \| undefined>` | Icon colour, or `(value, row) => tone`. |
684
849
 
685
850
  ### `json` — `jsonRenderer`
686
851
 
@@ -688,8 +853,8 @@ A button that opens the value as escaped JSON in a dialog. Align: `start` · fil
688
853
 
689
854
  | Option | Type | Description |
690
855
  |---|---|---|
691
- | `label` | `string` | |
692
- | `dialogTitle` | `string \| RowFn<string>` | |
856
+ | `label` | `string` | Text of the button that opens the JSON in a dialog. Default “View”. |
857
+ | `dialogTitle` | `string \| RowFn<string>` | Heading of the dialog (default: the column header). |
693
858
 
694
859
  ### `json-tree` — `jsonTreeRenderer`
695
860
 
@@ -701,7 +866,7 @@ A collapsible tree of nested data. Align: `start` · filter type: `text`.
701
866
  | `maxDepth` | `number` | Deeper nodes are summarised (“3 items”) instead of expanded. Default unlimited. |
702
867
  | `parseNested` | `boolean` | String values that contain JSON are shown as nested trees. |
703
868
  | `collapsed` | `boolean` | Starts hidden behind a toggle button (labelled `toggleLabel`, default “More info”). |
704
- | `toggleLabel` | `string` | |
869
+ | `toggleLabel` | `string` | Text of the `collapsed` toggle. Default “More info”. |
705
870
  | `emptyText` | `string` | Shown for null / empty values. Default: nothing. |
706
871
 
707
872
  ### `actions-menu` — `actionsMenuRenderer`
@@ -711,7 +876,7 @@ A `⋯` button with a keyboard-friendly menu. Emits the chosen item's `name`. Al
711
876
  | Option | Type | Description |
712
877
  |---|---|---|
713
878
  | `actions` | `MenuItem[] \| ((row: any) => MenuItem[])` | Menu items (actions and `{ separator: true }`), or a function of the row. |
714
- | `label` | `string` | |
879
+ | `label` | `string` | Accessible name of the `⋯` button and the menu. Default “Actions”. |
715
880
 
716
881
  ### `action-button` — `actionButtonRenderer`
717
882
 
@@ -719,13 +884,13 @@ One button per row. Emits its `action` (default `click`). Align: `start` · filt
719
884
 
720
885
  | Option | Type | Description |
721
886
  |---|---|---|
722
- | `label` | `string \| RowFn<string>` | |
887
+ | `label` | `string \| RowFn<string>` | Button text (default: the value), or `(value, row) => text`. |
723
888
  | `action` | `string` | Action name emitted on click. Default `click`. |
724
- | `icon` | `Component` | |
725
- | `tone` | `Tone` | |
726
- | `disabled` | `RowFn<boolean>` | |
889
+ | `icon` | `Component` | An icon component before the label. |
890
+ | `tone` | `Tone` | Button colour, e.g. `danger` for a delete button. |
891
+ | `disabled` | `RowFn<boolean>` | Disable the button for some rows: `(value, row) => boolean`. |
727
892
  | `visible` | `RowFn<boolean>` | Hide the button for some rows. |
728
- | `variant` | `ButtonVariant` | |
893
+ | `variant` | `ButtonVariant` | `outline` (default), `solid` or `ghost`. |
729
894
  | `iconOnly` | `boolean` | Only the icon; the label becomes its accessible name and tooltip. |
730
895
 
731
896
  ### `multi-line` — `multiLineRenderer`
@@ -737,7 +902,7 @@ Stacked lines, each with its own style, link, badge, trend or action. Align: `st
737
902
  | `lines` | `RowFn<LineInput[] \| null \| undefined>` | Builds the lines; default: the value itself when it's an array. |
738
903
  | `boldLines` | `number[]` | Indexes of lines to show in bold. |
739
904
  | `ellipsis` | `boolean` | Each line on one row with ellipsis (default true). |
740
- | `target` | `'_self' \| '_blank'` | |
905
+ | `target` | `'_self' \| '_blank'` | `_blank` opens linked lines in a new tab. |
741
906
  | `placeholder` | `string` | Shown when the value is empty. |
742
907
 
743
908
  ### `copy` — `copyRenderer`
@@ -760,9 +925,9 @@ A chip in any colour (readable text picked by contrast), square, circle or pill.
760
925
  |---|---|---|
761
926
  | `color` | `RowOption<string \| null \| undefined>` | Any CSS colour (e.g. from an API); text colour is picked for contrast. |
762
927
  | `tone` | `ToneOption` | Named tone instead of a raw colour. |
763
- | `label` | `RowFn<string>` | |
764
- | `tooltip` | `RowFn<string \| null \| undefined>` | |
765
- | `shape` | `'square' \| 'circle' \| 'pill'` | |
928
+ | `label` | `RowFn<string>` | Chip text (default: the value, or its `label` / `name` / `text` field). A tone map is keyed by this label. |
929
+ | `tooltip` | `RowFn<string \| null \| undefined>` | Hover text (default: the value's `description` field, if any). |
930
+ | `shape` | `'square' \| 'circle' \| 'pill'` | `square` (default), `circle` or `pill`. |
766
931
  | `size` | `string` | Box size for square/circle. Default `1.75rem`. |
767
932
  | `placeholder` | `string` | Shown when the value is empty. |
768
933
 
@@ -773,7 +938,7 @@ A controlled checkbox, with a tooltip when disabled. Emits `change` with the req
773
938
  | Option | Type | Description |
774
939
  |---|---|---|
775
940
  | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
776
- | `disabled` | `RowOption<boolean>` | |
941
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
777
942
  | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
778
943
  | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
779
944
 
@@ -784,7 +949,7 @@ A controlled on / off switch. Emits `change` with the requested state. Align: `c
784
949
  | Option | Type | Description |
785
950
  |---|---|---|
786
951
  | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
787
- | `disabled` | `RowOption<boolean>` | |
952
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
788
953
  | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
789
954
  | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
790
955
 
@@ -796,7 +961,7 @@ One selected row across the column (controlled). Emits `select`. Align: `center`
796
961
  |---|---|---|
797
962
  | `name` | `string` | Radio group name. Default: the column key. |
798
963
  | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
799
- | `disabled` | `RowOption<boolean>` | |
964
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
800
965
  | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
801
966
  | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
802
967
 
@@ -809,8 +974,8 @@ A value with an edit button, for opening your own editor. Emits `edit`. Align: `
809
974
  | `format` | `RowFn<string>` | Text shown next to the edit button (default: the value). |
810
975
  | `placeholder` | `string` | Shown when the value is empty. |
811
976
  | `label` | `string` | Accessible name of the button. Default “Edit”. |
812
- | `disabled` | `RowOption<boolean>` | |
813
- | `bold` | `boolean` | |
977
+ | `disabled` | `RowOption<boolean>` | Disables the edit button, for every row or `(value, row) => boolean`. |
978
+ | `bold` | `boolean` | Bold text. |
814
979
 
815
980
  ### `image` — `imageRenderer`
816
981
 
@@ -820,10 +985,10 @@ A thumbnail, with a placeholder when empty or broken. Align: `center` · filter
820
985
  |---|---|---|
821
986
  | `src` | `RowFn<string \| null \| undefined>` | Default: the value. |
822
987
  | `baseUrl` | `string` | Prefixed to relative paths (e.g. a CDN). |
823
- | `alt` | `RowOption<string>` | |
988
+ | `alt` | `RowOption<string>` | Alternative text (default: none, a decorative image), or `(value, row) => text`. |
824
989
  | `size` | `string` | Default `2.5rem`. |
825
- | `fit` | `'contain' \| 'cover'` | |
826
- | `shape` | `'rounded' \| 'circle' \| 'square'` | |
990
+ | `fit` | `'contain' \| 'cover'` | `contain` (default) shows the whole image; `cover` fills the box and crops. |
991
+ | `shape` | `'rounded' \| 'circle' \| 'square'` | `rounded` (default), `circle` (avatars) or `square`. |
827
992
 
828
993
  ### `code` — `codeRenderer`
829
994
 
@@ -842,7 +1007,7 @@ Several buttons, fixed or per row. Emits the clicked button's `name`. Align: `st
842
1007
 
843
1008
  | Option | Type | Description |
844
1009
  |---|---|---|
845
- | `buttons` | `ButtonSpec[] \| ((row: any) => ButtonSpec[])` | |
1010
+ | `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
1011
 
847
1012
  ### `icon-toggle` — `iconToggleRenderer`
848
1013
 
@@ -855,7 +1020,7 @@ A star / flag style on-off button (controlled). Emits `toggle`. Align: `center`
855
1020
  | `activeIcon` | `Component` | Default: a filled star (or `icon`). |
856
1021
  | `label` | `RowOption<string>` | Accessible name. Default “Toggle”. |
857
1022
  | `activeTone` | `Tone` | Tone when active. Default `warning`. |
858
- | `disabled` | `RowOption<boolean>` | |
1023
+ | `disabled` | `RowOption<boolean>` | Disabled for every row, or `(value, row) => boolean`. |
859
1024
 
860
1025
  ### `details` — `detailsRenderer`
861
1026
 
@@ -864,7 +1029,7 @@ A status badge plus an info button with an anchored popover of label / value row
864
1029
  | Option | Type | Description |
865
1030
  |---|---|---|
866
1031
  | `tone` | `ToneOption` | Summary badge tone, like `status`. |
867
- | `label` | `RowFn<string>` | |
1032
+ | `label` | `RowFn<string>` | Badge text (default: the value). |
868
1033
  | `items` | `RowFn<DetailItem[] \| null \| undefined>` | Popover rows. Empty → no info button. |
869
1034
  | `title` | `RowOption<string>` | Popover heading. Default: the column header. |
870
1035
  | `triggerLabel` | `string` | Accessible name of the info button. Default “Details”. |
@@ -876,7 +1041,7 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
876
1041
  | Option | Type | Description |
877
1042
  |---|---|---|
878
1043
  | `items` | `RowFn<unknown[] \| null \| undefined>` | Default: the value when it's an array. |
879
- | `itemLabel` | `RowFn<string>` | |
1044
+ | `itemLabel` | `RowFn<string>` | Text of one item, `(item, row) => string` (default: the item, objects as JSON). |
880
1045
  | `max` | `number` | Items shown before “+N more”. Default 1. |
881
1046
  | `placeholder` | `string` | Shown when the value is empty. |
882
1047
 
@@ -894,8 +1059,8 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
894
1059
 
895
1060
  | Field | Type | Description |
896
1061
  |---|---|---|
897
- | `top`? | `RowKey[]` | |
898
- | `bottom`? | `RowKey[]` | |
1062
+ | `top`? | `RowKey[]` | Keys of the rows pinned above the body, in display order. |
1063
+ | `bottom`? | `RowKey[]` | Keys of the rows pinned below the body, in display order. |
899
1064
 
900
1065
  ### `ColumnState`
901
1066
 
@@ -910,14 +1075,14 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
910
1075
 
911
1076
  | Field | Type | Description |
912
1077
  |---|---|---|
913
- | `key` | `string` | |
914
- | `dir` | `SortDir` | |
1078
+ | `key` | `string` | The sorted column’s `key`. |
1079
+ | `dir` | `SortDir` | `asc` or `desc`. |
915
1080
 
916
1081
  ### `ColumnFilterOptions`
917
1082
 
918
1083
  | Field | Type | Description |
919
1084
  |---|---|---|
920
- | `type`? | `FilterType` | |
1085
+ | `type`? | `FilterType` | `text`, `number`, `date`, `boolean` or `set` (default: from the renderer). |
921
1086
  | `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
1087
  | `placeholder`? | `string` | Placeholder of the filter-row input. |
923
1088
 
@@ -925,8 +1090,8 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
925
1090
 
926
1091
  | Field | Type | Description |
927
1092
  |---|---|---|
928
- | `value` | `unknown` | |
929
- | `label`? | `string` | |
1093
+ | `value` | `unknown` | The value rows are matched against. |
1094
+ | `label`? | `string` | Text shown for the option (default: the value). |
930
1095
  | `count`? | `number` | Shown next to the option (e.g. number of rows). |
931
1096
 
932
1097
  ### `MenuAction`
@@ -934,70 +1099,70 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
934
1099
  | Field | Type | Description |
935
1100
  |---|---|---|
936
1101
  | `name` | `string` | Emitted as the action name. |
937
- | `label` | `string` | |
938
- | `disabled`? | `boolean` | |
939
- | `tone`? | `MenuTone` | |
940
- | `icon`? | `Component` | |
1102
+ | `label` | `string` | Text of the item. |
1103
+ | `disabled`? | `boolean` | Shown but can’t be chosen. |
1104
+ | `tone`? | `MenuTone` | Colour, e.g. `danger` for a delete item. |
1105
+ | `icon`? | `Component` | An icon component before the label. |
941
1106
  | `hint`? | `string` | Shown right-aligned, e.g. a shortcut hint. |
942
1107
 
943
1108
  ### `CellContext`
944
1109
 
945
1110
  | Field | Type | Description |
946
1111
  |---|---|---|
947
- | `row` | `T` | |
948
- | `rowKey` | `RowKey` | |
949
- | `column` | `ColumnDef<T>` | |
950
- | `value` | `unknown` | |
1112
+ | `row` | `T` | The row the cell belongs to. |
1113
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1114
+ | `column` | `ColumnDef<T>` | The cell’s column definition. |
1115
+ | `value` | `unknown` | The cell value (`value` / `field` / `key`). |
951
1116
 
952
1117
  ### `CellActionEvent`
953
1118
 
954
1119
  | Field | Type | Description |
955
1120
  |---|---|---|
956
- | `name` | `string` | |
957
- | `payload` | `unknown` | |
958
- | `row` | `T` | |
959
- | `rowKey` | `RowKey` | |
960
- | `column` | `ColumnDef<T>` | |
1121
+ | `name` | `string` | The action, e.g. `click`, `change`, `toggle`, `copy` or a button’s `name`. |
1122
+ | `payload` | `unknown` | Action data: the new value of a toggle or input, the copied text, a line index… |
1123
+ | `row` | `T` | The row the cell belongs to. |
1124
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1125
+ | `column` | `ColumnDef<T>` | The cell’s column definition. |
961
1126
 
962
1127
  ### `CellClickEvent`
963
1128
 
964
1129
  | Field | Type | Description |
965
1130
  |---|---|---|
966
- | `row` | `T` | |
967
- | `rowKey` | `RowKey` | |
968
- | `column` | `ColumnDef<T>` | |
969
- | `value` | `unknown` | |
970
- | `event` | `MouseEvent \| KeyboardEvent` | |
1131
+ | `row` | `T` | The row the cell belongs to. |
1132
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1133
+ | `column` | `ColumnDef<T>` | The clicked column (one with `clickable: true`). |
1134
+ | `value` | `unknown` | The cell value. |
1135
+ | `event` | `MouseEvent \| KeyboardEvent` | The DOM event of the click (Enter on a focused cell clicks it too). |
971
1136
 
972
1137
  ### `ContextActionEvent`
973
1138
 
974
1139
  | Field | Type | Description |
975
1140
  |---|---|---|
976
- | `name` | `string` | |
977
- | `item` | `MenuAction` | |
978
- | `row` | `T` | |
979
- | `rowKey` | `RowKey` | |
980
- | `column` | `ColumnDef<T>` | |
981
- | `value` | `unknown` | |
1141
+ | `name` | `string` | The chosen item’s `name`. |
1142
+ | `item` | `MenuAction` | The chosen item. |
1143
+ | `row` | `T` | The row the cell belongs to. |
1144
+ | `rowKey` | `RowKey` | The row’s key (`row-key`). |
1145
+ | `column` | `ColumnDef<T>` | The cell’s column definition. |
1146
+ | `value` | `unknown` | The cell value (`value` / `field` / `key`). |
982
1147
 
983
1148
  ### `HeaderActionEvent`
984
1149
 
985
1150
  | Field | Type | Description |
986
1151
  |---|---|---|
987
- | `name` | `string` | |
988
- | `item` | `MenuAction` | |
989
- | `column` | `ColumnDef<T>` | |
1152
+ | `name` | `string` | The chosen item’s `name`. |
1153
+ | `item` | `MenuAction` | The chosen item. |
1154
+ | `column` | `ColumnDef<T>` | The column whose header menu it was. |
990
1155
 
991
1156
  ### `VueGridConfig`
992
1157
 
993
1158
  | Field | Type | Description |
994
1159
  |---|---|---|
995
- | `renderers`? | `CellRendererDefinition[]` | |
1160
+ | `renderers`? | `CellRendererDefinition[]` | Renderers every grid can use by name (`renderer: 'currency'`); `allRenderers` for all of them. |
996
1161
  | `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` | |
1162
+ | `locale`? | `string` | Default locale for number and date renderers (default: the browser’s). |
1163
+ | `currency`? | `string` | Default ISO 4217 currency for currency renderers. |
1164
+ | `timeZone`? | `string` | Default IANA time zone for date renderers and date filters. |
1165
+ | `density`? | `Density` | Default density: `compact`, `cozy` (default) or `comfortable`. |
1001
1166
 
1002
1167
  ---
1003
1168
 
@@ -1062,7 +1227,13 @@ import {
1062
1227
  type SortState,
1063
1228
  } from '@nocopypaste/vue-grid'
1064
1229
 
1065
- interface Order { id: number; customer: { name: string }; total: number; status: 'Paid' | 'Open'; placedAt: string }
1230
+ interface Order {
1231
+ id: number
1232
+ customer: { name: string }
1233
+ total: number
1234
+ status: 'Paid' | 'Open'
1235
+ placedAt: string
1236
+ }
1066
1237
 
1067
1238
  const rows = ref<Order[]>([/* … */])
1068
1239
  const sort = ref<SortState | null>(null)
@@ -1070,9 +1241,20 @@ const sort = ref<SortState | null>(null)
1070
1241
  const col = createColumnHelper<Order>()
1071
1242
  const columns = [
1072
1243
  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)' }),
1244
+ col({
1245
+ key: 'customer',
1246
+ header: 'Customer',
1247
+ field: 'customer.name',
1248
+ sortable: true,
1249
+ width: 'minmax(10rem, 1fr)',
1250
+ }),
1074
1251
  col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
1075
- col({ key: 'status', header: 'Status', renderer: statusRenderer, rendererOptions: { tone: { Paid: 'success', Open: 'info' } } }),
1252
+ col({
1253
+ key: 'status',
1254
+ header: 'Status',
1255
+ renderer: statusRenderer,
1256
+ rendererOptions: { tone: { Paid: 'success', Open: 'info' } },
1257
+ }),
1076
1258
  col({ key: 'placedAt', header: 'Placed', renderer: dateTimeRenderer }),
1077
1259
  ]
1078
1260
  </script>
@@ -1098,26 +1280,26 @@ Out of the box `<VGrid>` is a plain, read-only table: columns with any renderer
1098
1280
  saved column state (`storage`), detail rows, tabbable controls and theming. Everything else is
1099
1281
  an opt-in feature:
1100
1282
 
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` |
1283
+ | Feature | Turns on |
1284
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1285
+ | `sortingFeature` | Sort buttons on `sortable` headers, the header menu's sort items, `sort-mode="client"` sorting |
1286
+ | `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
1287
+ | `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
1288
+ | `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
1289
+ | `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`) |
1290
+ | `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
1291
+ | `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 |
1292
+ | `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
1293
+ | `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; without it pins are ignored |
1294
+ | `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
1295
+ | `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
1296
+ | `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 |
1297
+ | `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 |
1298
+ | `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) |
1299
+ | `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 |
1300
+ | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
1301
+ | `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 |
1302
+ | `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
1121
1303
 
1122
1304
  ```ts
1123
1305
  // per grid
@@ -1143,50 +1325,50 @@ what you import.
1143
1325
  - **per column** (recommended, smallest bundle, typed options): `renderer: currencyRenderer`, or
1144
1326
  - **by name**, after registering them: `createVueGrid({ renderers: [currencyRenderer, statusRenderer] })`
1145
1327
  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.
1328
+ An unregistered name renders as plain text and logs a dev warning saying how to register it.
1147
1329
  - **Components and helpers** (`VGridPagination`, `VGridColumnMenu`, `VGridMenu`, `sortRows`, …) are
1148
1330
  only bundled when imported.
1149
1331
  - **CSS**: `@nocopypaste/vue-grid/style.css` has everything. Pick parts instead:
1150
1332
 
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 |
1333
+ | File | What | gzip |
1334
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------ |
1335
+ | `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
1336
+ | `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.3 kB |
1337
+ | `core.css` | `base.css` + `theme.css` | 5.1 kB |
1338
+ | `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
1339
+ | `style.css` | All of the above | 6.6 kB |
1158
1340
 
1159
1341
  For a fully custom look, import only `base.css` (and `renderers.css` if you use renderers)
1160
1342
  and style the `.vg-*` classes yourself. See [Theming](#theming).
1161
1343
 
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 |
1344
+ | Import (minified / gzip, Vue excluded) | Initial chunk |
1345
+ | ---------------------------------------------------------------------------- | ------------------ |
1346
+ | `VGrid` (no features) | 39.0 kB / 13.6 kB |
1347
+ | `VGrid` + `sortingFeature` | 39.8 kB / 13.9 kB |
1348
+ | `VGrid` + `filteringFeature` | 49.7 kB / 17.4 kB |
1349
+ | `VGrid` + `serverDataFeature` | 40.4 kB / 14.2 kB |
1350
+ | `VGrid` + `paginationFeature` | 39.2 kB / 13.7 kB |
1351
+ | `VGrid` + `selectionFeature` | 43.2 kB / 15.1 kB |
1352
+ | `VGrid` + `subGridsFeature` | 41.4 kB / 14.5 kB |
1353
+ | `VGrid` + `menusFeature` | 49.6 kB / 17.2 kB |
1354
+ | `VGrid` + `columnReorderFeature` | 42.7 kB / 14.9 kB |
1355
+ | `VGrid` + `columnPinningFeature` | 41.2 kB / 14.5 kB |
1356
+ | `VGrid` + `virtualScrollingFeature` | 44.8 kB / 15.8 kB |
1357
+ | `VGrid` + `columnVisibilityFeature` | 39.2 kB / 13.7 kB |
1358
+ | `VGrid` + `keyboardNavigationFeature` | 41.5 kB / 14.5 kB |
1359
+ | `VGrid` + `columnResizingFeature` | 41.8 kB / 14.7 kB |
1360
+ | `VGrid` + `columnGroupsFeature` | 40.3 kB / 14.1 kB |
1361
+ | `VGrid` + `rowPinningFeature` | 44.0 kB / 15.0 kB |
1362
+ | `VGrid` + `aggregationFeature` | 44.2 kB / 15.1 kB |
1363
+ | `VGrid` + `rowGroupingFeature` | 48.6 kB / 16.4 kB |
1364
+ | `VGrid` + `exportFeature` | 42.8 kB / 15.1 kB |
1365
+ | `VGrid` + `allFeatures` + `VGridSearch` | 102.8 kB / 34.7 kB |
1366
+ | `VGrid` + `currencyRenderer` | 40.4 kB / 14.1 kB |
1367
+ | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 45.8 kB / 15.9 kB |
1368
+ | `sortRows` only | 0.7 kB / 0.4 kB |
1369
+ | `toCsv` only | 1.1 kB / 0.6 kB |
1370
+ | everything | 147.4 kB / 47.2 kB |
1371
+ | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 63.7 kB / 17.1 kB |
1190
1372
 
1191
1373
  With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
1192
1374
  chunks**: they load the first time a popover opens or `filter-row` is on. With
@@ -1203,56 +1385,56 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1203
1385
 
1204
1386
  ### Props
1205
1387
 
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). |
1388
+ | Prop | Type | Default | |
1389
+ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
1390
+ | `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
1391
+ | `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
1392
+ | `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). |
1393
+ | `columns` | `ColumnDef<T>[]` | — | See below. |
1394
+ | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
1395
+ | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
1396
+ | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
1397
+ | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
1398
+ | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
1399
+ | `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
1400
+ | `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
1401
+ | `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a _Clear filters_ button, when filters hide every row. |
1402
+ | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
1403
+ | `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
1404
+ | `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
1405
+ | `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
1406
+ | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
1407
+ | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
1408
+ | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
1409
+ | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
1410
+ | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
1411
+ | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
1412
+ | `v-model:selected` | `RowKey[]` | `[]` | |
1413
+ | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
1414
+ | `isRowSelectable` | `(row) => boolean` | — | |
1415
+ | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
1416
+ | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
1417
+ | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
1418
+ | `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). |
1419
+ | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
1420
+ | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
1421
+ | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
1422
+ | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
1423
+ | `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). |
1424
+ | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
1425
+ | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
1426
+ | `rowClass` | `(row, index) => ClassValue` | — | |
1427
+ | `highlightedRows` | `RowKey[]` | — | |
1428
+ | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
1429
+ | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
1430
+ | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
1431
+ | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
1432
+ | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
1433
+ | `emptyText` | `string` | `'No data to show.'` | |
1434
+ | `ariaLabel` | `string` | — | |
1435
+ | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
1436
+ | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
1437
+ | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
1256
1438
 
1257
1439
  ### Events
1258
1440
 
@@ -1359,8 +1541,16 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
1359
1541
  `#toolbar` slot gets them too, so a batch-action bar lives in the grid:
1360
1542
 
1361
1543
  ```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]">
1544
+ <VGrid
1545
+ v-model:selected="selected"
1546
+ :rows="requests"
1547
+ :columns="columns"
1548
+ row-key="id"
1549
+ selectable
1550
+ prune-selection
1551
+ :is-row-selectable="(r) => r.status === 'pending'"
1552
+ :features="[selectionFeature]"
1553
+ >
1364
1554
  <template #toolbar="{ selected, selectedCount, clearSelection }">
1365
1555
  <template v-if="selectedCount">
1366
1556
  {{ selectedCount }} selected
@@ -1381,11 +1571,11 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
1381
1571
  selection can span server pages. `prune-selection` drops them instead: after a reload, a batch
1382
1572
  delete or a new page, `selected` only holds rows that exist.
1383
1573
  - **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
1574
+ page; a banner then offers _Select all N rows_ (N = the `total` the source returned). That sets
1385
1575
  `v-model:select-all-matching`: every row shows ticked, `selectedCount` is N, and your batch
1386
1576
  action should run on the query (`@query-change`) rather than on `selected`. Changing the
1387
1577
  filters, unticking a row (the keys already in `selected` stay, plus the rest of the loaded page) or
1388
- *Clear selection* ends it.
1578
+ _Clear selection_ ends it.
1389
1579
  - `grid.clearSelection()` clears it all from code. Cascading through sub-grids, group checkboxes
1390
1580
  (row grouping) and copying the selected rows (export feature) work as described in their
1391
1581
  sections.
@@ -1393,7 +1583,13 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
1393
1583
  ## Sub-grids (CSS `subgrid`)
1394
1584
 
1395
1585
  ```vue
1396
- <VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(row) => row.children" selectable />
1586
+ <VGrid
1587
+ :rows="markets"
1588
+ :columns="columns"
1589
+ row-key="id"
1590
+ :sub-rows="(row) => row.children"
1591
+ selectable
1592
+ />
1397
1593
  ```
1398
1594
 
1399
1595
  Expanded children render inside a `.vg-subgrid` element that spans every column and uses
@@ -1407,7 +1603,13 @@ Need children with a **different** set of columns? Put another `<VGrid>` in the
1407
1603
  ## Column menu, reorder, persistence
1408
1604
 
1409
1605
  ```vue
1410
- <VGrid :rows :columns row-key="id" storage="orders-grid" :features="[columnVisibilityFeature, columnReorderFeature]">
1606
+ <VGrid
1607
+ :rows
1608
+ :columns
1609
+ row-key="id"
1610
+ storage="orders-grid"
1611
+ :features="[columnVisibilityFeature, columnReorderFeature]"
1612
+ >
1411
1613
  <!-- the picker hides columns (columnVisibilityFeature); dragging headers needs columnReorderFeature -->
1412
1614
  <template #toolbar="{ columnState, setColumnState }">
1413
1615
  <VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
@@ -1430,13 +1632,20 @@ scrolls. No JS positioning, except a small fallback for browsers without anchor
1430
1632
 
1431
1633
  ```vue
1432
1634
  <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
- ]"
1635
+ :rows
1636
+ :columns
1637
+ row-key="id"
1638
+ :context-menu="
1639
+ ({ row, column, value }) =>
1640
+ column.key === 'link'
1641
+ ? []
1642
+ : [
1643
+ { name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
1644
+ { name: 'open', label: `Open #${row.id}` },
1645
+ { separator: true },
1646
+ { name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
1647
+ ]
1648
+ "
1440
1649
  @context-action="({ name, row, column, value }) => run(name, row)"
1441
1650
  />
1442
1651
  ```
@@ -1454,9 +1663,14 @@ Pin items need `columnPinningFeature`, move items `columnReorderFeature`, Hide c
1454
1663
 
1455
1664
  ```vue
1456
1665
  <!-- 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 -->
1666
+ <VGrid
1667
+ :header-menu="
1668
+ ({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]
1669
+ "
1670
+ @header-action="({ name, column }) => …"
1671
+ />
1672
+ <VGrid :header-menu="false" />
1673
+ <!-- off -->
1460
1674
  ```
1461
1675
 
1462
1676
  Columns opt out with `pinnable: false`, `reorderable: false`, `hideable: false`.
@@ -1475,23 +1689,39 @@ The same component powers the `actions-menu` renderer and is exported for add-on
1475
1689
 
1476
1690
  ```vue
1477
1691
  <script setup lang="ts">
1478
- import { VGrid, VGridSearch, filteringFeature, numberRenderer, statusRenderer, type FilterState } from '@nocopypaste/vue-grid'
1692
+ import {
1693
+ VGrid,
1694
+ VGridSearch,
1695
+ filteringFeature,
1696
+ numberRenderer,
1697
+ statusRenderer,
1698
+ type FilterState,
1699
+ } from '@nocopypaste/vue-grid'
1479
1700
 
1480
1701
  const filters = ref<FilterState | null>(null)
1481
1702
  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
1703
+ { key: 'player', header: 'Player', filterable: true }, // text
1704
+ { key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
1705
+ { key: 'status', header: 'Status', filterable: true, renderer: statusRenderer }, // value list
1706
+ { key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
1486
1707
  ]
1487
1708
  </script>
1488
1709
 
1489
1710
  <template>
1490
- <VGrid v-model:filters="filters" :rows :columns row-key="id" :features="[filteringFeature]"
1491
- filter-row filter-storage="bets-filters">
1711
+ <VGrid
1712
+ v-model:filters="filters"
1713
+ :rows
1714
+ :columns
1715
+ row-key="id"
1716
+ :features="[filteringFeature]"
1717
+ filter-row
1718
+ filter-storage="bets-filters"
1719
+ >
1492
1720
  <template #toolbar="{ activeFilterCount, clearFilters }">
1493
1721
  <VGridSearch />
1494
- <button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }} filters</button>
1722
+ <button v-if="activeFilterCount" @click="clearFilters()">
1723
+ Clear {{ activeFilterCount }} filters
1724
+ </button>
1495
1725
  </template>
1496
1726
  </VGrid>
1497
1727
  </template>
@@ -1502,18 +1732,19 @@ const columns = [
1502
1732
  popover through the Popover API and CSS anchor positioning, and the popover holds an editor for
1503
1733
  the column's type:
1504
1734
 
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`) |
1735
+ | Type | Editor | Operators |
1736
+ | --------- | ------------------------------------ | -------------------------------------------------------------------------------------------------- |
1737
+ | `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
1738
+ | `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
1739
+ | `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
1740
+ | `boolean` | radio group | any, yes, no, empty |
1741
+ | `set` | searchable checkbox list with counts | (the selected values) |
1742
+ | `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
1513
1743
 
1514
1744
  The type comes from `filter`, else from the renderer (number, currency, change → `number`;
1515
1745
  date, datetime → `date`; boolean, checkbox, switch → `boolean`; status, chip → `set`), else
1516
1746
  `text`.
1747
+
1517
1748
  - **Filter row** (`filter-row`). An inline input under each header that accepts shorthand:
1518
1749
  `>10`, `>=10`, `5..20`, `-5..-1`, open ranges `5..` / `..20`, `!=3`, a decimal comma (`1,5`),
1519
1750
  and `>2026-01-01` or `2026-01-01..2026-03-31` for dates; plain text for text columns. Input that
@@ -1522,7 +1753,7 @@ const columns = [
1522
1753
  - **Quick search.** `<VGridSearch>` inside the `#toolbar` slot drives that grid's search. Anywhere
1523
1754
  else, bind it with `v-model` to `filters.search`. The search matches any visible column that is
1524
1755
  not marked `searchable: false`.
1525
- - **Matching** is case- and accent-insensitive (`nis` finds *Niš*). Dates compare by calendar day
1756
+ - **Matching** is case- and accent-insensitive (`nis` finds _Niš_). Dates compare by calendar day
1526
1757
  in the grid's `timeZone`; a date-only string (`2026-01-05`) is that calendar day in every time
1527
1758
  zone, for filtering and for the `date` renderer. Column filters combine with AND, and then the
1528
1759
  search must match too. Saved filters for columns that no longer exist are ignored.
@@ -1534,18 +1765,43 @@ const columns = [
1534
1765
  The list is fetched when the popover opens and again on every search (debounced). Superseded
1535
1766
  requests are cancelled.
1536
1767
  - 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.
1768
+ every row, the grid shows `noMatchText` with a _Clear filters_ button.
1538
1769
 
1539
1770
  The model is plain JSON, so you can store it, put it in the URL or send it to an API as is:
1540
1771
 
1541
1772
  ```ts
1542
- interface FilterState { columns: Record<string, ColumnFilter>; search?: string }
1773
+ interface FilterState {
1774
+ columns: Record<string, ColumnFilter>
1775
+ search?: string
1776
+ }
1543
1777
  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
1778
+ | {
1779
+ type: 'text'
1780
+ op:
1781
+ | 'contains'
1782
+ | 'notContains'
1783
+ | 'equals'
1784
+ | 'notEquals'
1785
+ | 'startsWith'
1786
+ | 'endsWith'
1787
+ | 'empty'
1788
+ | 'notEmpty'
1789
+ value?: string
1790
+ }
1791
+ | {
1792
+ type: 'number'
1793
+ op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'
1794
+ value?: number | null
1795
+ to?: number | null
1796
+ }
1797
+ | {
1798
+ type: 'date'
1799
+ op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'
1800
+ value?: string
1801
+ to?: string
1802
+ } // YYYY-MM-DD
1547
1803
  | { type: 'boolean'; value: boolean | null }
1548
- | { type: 'set'; values: string[] } // '' stands for blank cells
1804
+ | { type: 'set'; values: string[] } // '' stands for blank cells
1549
1805
  | { type: 'custom'; value: unknown }
1550
1806
  ```
1551
1807
 
@@ -1565,7 +1821,13 @@ itself; it shows exactly what the function returns.
1565
1821
 
1566
1822
  ```vue
1567
1823
  <script setup lang="ts">
1568
- import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
1824
+ import {
1825
+ filteringFeature,
1826
+ paginationFeature,
1827
+ serverDataFeature,
1828
+ sortingFeature,
1829
+ type DataSource,
1830
+ } from '@nocopypaste/vue-grid'
1569
1831
 
1570
1832
  const fetchBets: DataSource<Bet> = async (query, { signal }) => {
1571
1833
  // query: { sort: { key, dir } | null, filters: FilterState, page: number, pageSize: number | null }
@@ -1576,15 +1838,23 @@ const fetchBets: DataSource<Bet> = async (query, { signal }) => {
1576
1838
  </script>
1577
1839
 
1578
1840
  <template>
1579
- <VGrid ref="grid" :data-source="fetchBets" :columns row-key="id" pagination filter-row @load-error="toast"
1580
- :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" />
1841
+ <VGrid
1842
+ ref="grid"
1843
+ :data-source="fetchBets"
1844
+ :columns
1845
+ row-key="id"
1846
+ pagination
1847
+ filter-row
1848
+ @load-error="toast"
1849
+ :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]"
1850
+ />
1581
1851
  </template>
1582
1852
  ```
1583
1853
 
1584
1854
  - **Cancellation.** A new query aborts the previous request through `signal`, and a late response
1585
1855
  from a superseded request is ignored, so fast typing never shows stale rows.
1586
1856
  - **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`.
1857
+ _Couldn't load the rows._ with a _Retry_ button and emits `load-error`.
1588
1858
  - **Paging.** `pagination` adds the pager and sends `page` / `pageSize`; return `total` so the
1589
1859
  pager knows how many pages there are. Without `pagination`, `pageSize` is `null` (fetch
1590
1860
  everything). The page resets to 1 when sort or filters change.
@@ -1596,8 +1866,16 @@ and `filter-mode="controlled"`, and handle one event. The grid emits the combine
1596
1866
  and on every change, and skips duplicates:
1597
1867
 
1598
1868
  ```vue
1599
- <VGrid :rows="rows" :columns row-key="id" :loading="loading" :features="[sortingFeature, filteringFeature]"
1600
- sort-mode="controlled" filter-mode="controlled" @query-change="load" />
1869
+ <VGrid
1870
+ :rows="rows"
1871
+ :columns
1872
+ row-key="id"
1873
+ :loading="loading"
1874
+ :features="[sortingFeature, filteringFeature]"
1875
+ sort-mode="controlled"
1876
+ filter-mode="controlled"
1877
+ @query-change="load"
1878
+ />
1601
1879
  ```
1602
1880
 
1603
1881
  Use this when the data comes from a store, a WebSocket or a GraphQL client that you already manage.
@@ -1608,14 +1886,34 @@ Use this when the data comes from a store, a WebSocket or a GraphQL client that
1608
1886
  filtered rows; with a `dataSource` it requests pages.
1609
1887
 
1610
1888
  ```vue
1611
- <VGrid :rows :columns row-key="id" :features="[paginationFeature]" :pagination="{ pageSizes: [10, 25, 50] }" v-model:page="page" v-model:page-size="pageSize" />
1889
+ <VGrid
1890
+ :rows
1891
+ :columns
1892
+ row-key="id"
1893
+ :features="[paginationFeature]"
1894
+ :pagination="{ pageSizes: [10, 25, 50] }"
1895
+ v-model:page="page"
1896
+ v-model:page-size="pageSize"
1897
+ />
1612
1898
  ```
1613
1899
 
1614
1900
  Or place the standalone component yourself and feed the grid one page at a time:
1615
1901
 
1616
1902
  ```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]" />
1903
+ <VGrid
1904
+ v-model:sort="sort"
1905
+ :rows="pageRows"
1906
+ :columns
1907
+ row-key="id"
1908
+ :loading="loading"
1909
+ :features="[sortingFeature]"
1910
+ />
1911
+ <VGridPagination
1912
+ v-model:page="page"
1913
+ v-model:page-size="pageSize"
1914
+ :total="total"
1915
+ :page-sizes="[10, 25, 50]"
1916
+ />
1619
1917
  ```
1620
1918
 
1621
1919
  ## Pinned rows and totals
@@ -1675,14 +1973,25 @@ const columns = [
1675
1973
  col({ key: 'city', field: 'player.city', groupable: true }),
1676
1974
  col({ key: 'status', renderer: statusRenderer, groupable: true }),
1677
1975
  col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
1678
- col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (b) => b.placedAt.slice(0, 7) }),
1976
+ col({
1977
+ key: 'placedAt',
1978
+ renderer: dateRenderer,
1979
+ groupable: true,
1980
+ groupValue: (b) => b.placedAt.slice(0, 7),
1981
+ }),
1679
1982
  ]
1680
1983
  const groupBy = ref(['status', 'city'])
1681
1984
  </script>
1682
1985
 
1683
1986
  <template>
1684
- <VGrid v-model:group-by="groupBy" :rows="bets" :columns="columns" row-key="id" totals
1685
- :features="[rowGroupingFeature, aggregationFeature]" />
1987
+ <VGrid
1988
+ v-model:group-by="groupBy"
1989
+ :rows="bets"
1990
+ :columns="columns"
1991
+ row-key="id"
1992
+ totals
1993
+ :features="[rowGroupingFeature, aggregationFeature]"
1994
+ />
1686
1995
  </template>
1687
1996
  ```
1688
1997
 
@@ -1692,6 +2001,11 @@ const groupBy = ref(['status', 'city'])
1692
2001
  an `aggregate`; those show the group's own aggregate. The `group-<key>` slot renders the value
1693
2002
  yourself (`{ value, count, rows, column, group }`); `total-<key>` also renders group cells
1694
2003
  (with `group` set). Empty values form a `(blank)` group, last.
2004
+ - **In a narrow column** (a fixed-width first column followed by an aggregate) the label never
2005
+ widens the column: under 12rem the column name is dropped, then the value is cut with an
2006
+ ellipsis; the count stays. The whole label (“City: Novi Sad (12)”) is the cell's tooltip.
2007
+ - **Keyboard.** ↑ / ↓ keep their column across a group row, even though its label spans several:
2008
+ from Stake up onto a group row lands on its Stake aggregate, and back down on Stake.
1695
2009
  - **Order, filters, pages.** Groups follow the filters and are ordered by value, descending when
1696
2010
  the grid is sorted descending by the grouped column; sorting by any other column orders the
1697
2011
  rows inside each group. Pagination pages the top-level groups. With server data, the rows of
@@ -1701,8 +2015,8 @@ const groupBy = ref(['status', 'city'])
1701
2015
  Changing `group-by` starts over.
1702
2016
  - **Selection.** A group's checkbox selects or clears every row in it, and shows partly
1703
2017
  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`.
2018
+ - **Header menu.** Columns with `groupable: true` get _Group by_ (adds a level) / _Ungroup_, and
2019
+ _Ungroup all_. Any column can be grouped through `v-model:group-by`.
1706
2020
  - **Virtual scrolling.** Group rows are part of the virtual layout: thousands of rows in a few
1707
2021
  groups render only what's in view.
1708
2022
 
@@ -1729,9 +2043,16 @@ const columns = [
1729
2043
  <template>
1730
2044
  <button @click="grid?.exportCsv({ filename: 'orders.csv', totals: true })">Download CSV</button>
1731
2045
  <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`)" />
2046
+ <VGrid
2047
+ ref="grid"
2048
+ :rows="orders"
2049
+ :columns="columns"
2050
+ row-key="id"
2051
+ selectable
2052
+ totals
2053
+ :features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
2054
+ @copy="(e) => toast(`Copied ${e.rows.length} rows`)"
2055
+ />
1735
2056
  </template>
1736
2057
  ```
1737
2058
 
@@ -1768,8 +2089,14 @@ and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(t
1768
2089
  ## Virtual scrolling
1769
2090
 
1770
2091
  ```vue
1771
- <VGrid :rows="tenThousandRows" :columns row-key="id" :features="[virtualScrollingFeature]"
1772
- :virtual="{ rowHeight: 40 }" style="height: 600px" />
2092
+ <VGrid
2093
+ :rows="tenThousandRows"
2094
+ :columns
2095
+ row-key="id"
2096
+ :features="[virtualScrollingFeature]"
2097
+ :virtual="{ rowHeight: 40 }"
2098
+ style="height: 600px"
2099
+ />
1773
2100
  ```
1774
2101
 
1775
2102
  Rows have a fixed height; only the visible window plus `overscan` is rendered.
@@ -1868,44 +2195,48 @@ Screenshots of every renderer are in the repository README's
1868
2195
 
1869
2196
  **Display**
1870
2197
 
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
2198
+ | Name | Options |
2199
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2200
+ | `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
2201
+ | `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
2202
+ | `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
2203
+ | `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
2204
+ | `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
2205
+ | `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
2206
+ | `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
2207
+ | `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
2208
+ | `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
2209
+ | `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 }` |
2210
+ | `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
2211
+ | `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
2212
+ | `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
2213
+ | `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
2214
+ | `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
2215
+ | `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
2216
+ | `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
2217
+ | `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
2218
+
2219
+ **Actions and editing** — editable renderers are _controlled_: they show the data and emit the requested
1893
2220
  change; your `@cell-action` handler updates the row.
1894
2221
 
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) |
2222
+ | Name | Options → emits |
2223
+ | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
2224
+ | `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
2225
+ | `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
2226
+ | `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
2227
+ | `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
2228
+ | `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
2229
+ | `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
2230
+ | `radio` | same + `name` → `select` (payload: the row key) |
2231
+ | `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
1905
2232
 
1906
2233
  ```vue
1907
- <VGrid :rows="rows" :columns="[{ key: 'web', renderer: 'switch' }]" row-key="id"
1908
- @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)" />
2234
+ <VGrid
2235
+ :rows="rows"
2236
+ :columns="[{ key: 'web', renderer: 'switch' }]"
2237
+ row-key="id"
2238
+ @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)"
2239
+ />
1909
2240
  ```
1910
2241
 
1911
2242
  Values option callbacks receive `(value, row)`. The component of every renderer is exported too
@@ -1924,17 +2255,24 @@ const props = defineProps<CellRendererProps<unknown, number, { max?: number }>>(
1924
2255
  const emit = defineEmits<CellRendererEmits>()
1925
2256
  </script>
1926
2257
  <template>
1927
- <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">{{ n <= value ? '★' : '☆' }}</button>
2258
+ <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">
2259
+ {{ n <= value ? '★' : '☆' }}
2260
+ </button>
1928
2261
  </template>
1929
2262
  ```
1930
2263
 
1931
2264
  ```ts
1932
2265
  import { defineCellRenderer } from '@nocopypaste/vue-grid'
1933
2266
  declare module '@nocopypaste/vue-grid' {
1934
- interface CellRendererRegistry { rating: { max?: number } } // typed `renderer: 'rating'`
2267
+ interface CellRendererRegistry {
2268
+ rating: { max?: number }
2269
+ } // typed `renderer: 'rating'`
1935
2270
  }
1936
2271
  export const ratingRenderer = defineCellRenderer<{ max?: number }>({
1937
- name: 'rating', component: RatingCell, defaults: { max: 5 }, sortValue: (v) => Number(v),
2272
+ name: 'rating',
2273
+ component: RatingCell,
2274
+ defaults: { max: 5 },
2275
+ sortValue: (v) => Number(v),
1938
2276
  // what Ctrl+C and formatted CSV exports copy (export feature); without it the raw value
1939
2277
  format: (v, options, ctx, row) => `${Number(v ?? 0)} of ${options.max ?? 5}`,
1940
2278
  })
@@ -1960,14 +2298,14 @@ Override any token on `:root`, a wrapper, or the grid itself:
1960
2298
  }
1961
2299
  ```
1962
2300
 
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` |
2301
+ | Group | Tokens |
2302
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2303
+ | 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` |
2304
+ | 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` |
2305
+ | 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` |
2306
+ | Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
2307
+ | Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
2308
+ | Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
1971
2309
 
1972
2310
  Motion stays on the compositor (`transform`, `opacity`) wherever layout would otherwise animate.
1973
2311
  Row highlights (hover, selection) appear at once and fade out over `--vg-transition`, so the grid
@@ -1990,10 +2328,21 @@ import './my-grid-theme.css'
1990
2328
 
1991
2329
  ```css
1992
2330
  /* 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; }
2331
+ .vg-viewport {
2332
+ border: 1px solid #ddd;
2333
+ }
2334
+ .vg-header-cell {
2335
+ padding: 0.5rem 0.75rem;
2336
+ background: #fafafa;
2337
+ font-weight: 600;
2338
+ }
2339
+ .vg-cell {
2340
+ padding: 0.5rem 0.75rem;
2341
+ border-top: 1px solid #eee;
2342
+ }
2343
+ .vg-row:hover > .vg-cell {
2344
+ background: #f5f5f5;
2345
+ }
1997
2346
  ```
1998
2347
 
1999
2348
  Base only gives sticky header and pinned cells the system `Canvas` background, so content doesn't
@@ -2016,8 +2365,8 @@ import { validateGridConfig } from '@nocopypaste/vue-grid/agent'
2016
2365
 
2017
2366
  const { ok, diagnostics } = validateGridConfig({
2018
2367
  rowKey: 'id',
2019
- features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
2020
- renderers: [], // registered renderer names / definitions
2368
+ features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
2369
+ renderers: [], // registered renderer names / definitions
2021
2370
  columns: [{ key: 'total', renderer: 'currency', sortable: true, widht: '8rem' }],
2022
2371
  })
2023
2372
  // error columns[0].widht Columns have no option `widht`. Did you mean `width`?
@@ -2037,16 +2386,16 @@ Evergreen browsers: CSS `subgrid`, `light-dark()`, `@layer`, the Popover API and
2037
2386
  **CSS first, JS only as a fallback.** Everything the browser can do in CSS / HTML is done there; a
2038
2387
  small JS fallback runs only when a feature check (`CSS.supports`) says the browser can't:
2039
2388
 
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 (e.g. Firefox 159) |
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 |
2389
+ | Behaviour | Done with | JS fallback when unsupported |
2390
+ | ------------------------------------------------------------------ | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2391
+ | Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
2392
+ | 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) |
2393
+ | Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
2394
+ | Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
2395
+ | Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
2396
+ | Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
2397
+ | Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
2398
+ | Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
2050
2399
 
2051
2400
  What stays in JS is what CSS can't express: data (sorting, selection, expansion state), keyboard
2052
2401
  navigation, column drag, virtual scrolling and lazy loading.