@nocopypaste/vue-grid 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +70 -5
- package/CHANGELOG.md +39 -0
- package/README.md +198 -33
- package/agent/api.json +130 -13
- package/agent/api.md +26 -10
- package/agent/grid-config.schema.json +50 -5
- package/dist/agent/api.js +121 -13
- package/dist/agent/requirements.js +12 -3
- package/dist/agent/requirements.js.map +1 -1
- package/dist/agent/validate.js +6 -2
- package/dist/agent/validate.js.map +1 -1
- package/dist/base.css +1 -1
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +498 -414
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridGroupCells.js +6 -0
- package/dist/components/VGridGroupCells.js.map +1 -0
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +181 -0
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +69 -56
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridSelectionBanner.js +6 -0
- package/dist/components/VGridSelectionBanner.js.map +1 -0
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composables/useGridExport.js +135 -0
- package/dist/composables/useGridExport.js.map +1 -0
- package/dist/composables/useGridKeyboard.js +5 -1
- package/dist/composables/useGridKeyboard.js.map +1 -1
- package/dist/composables/useGridMenus.js +21 -1
- package/dist/composables/useGridMenus.js.map +1 -1
- package/dist/composables/useGridSelection.js +113 -50
- package/dist/composables/useGridSelection.js.map +1 -1
- package/dist/composables/useRowGrouping.js +103 -0
- package/dist/composables/useRowGrouping.js.map +1 -0
- package/dist/composables/useVirtualRows.js +5 -5
- package/dist/composables/useVirtualRows.js.map +1 -1
- package/dist/core/csv.js +28 -0
- package/dist/core/csv.js.map +1 -0
- package/dist/core/grouping.js +66 -0
- package/dist/core/grouping.js.map +1 -0
- package/dist/core.css +1 -1
- package/dist/features/export.js +9 -0
- package/dist/features/export.js.map +1 -0
- package/dist/features/index.js +25 -21
- package/dist/features/index.js.map +1 -1
- package/dist/features/rowGrouping.js +11 -0
- package/dist/features/rowGrouping.js.map +1 -0
- package/dist/features/selection.js +5 -3
- package/dist/features/selection.js.map +1 -1
- package/dist/index.js +55 -51
- package/dist/internal/clipboard.js +8 -2
- package/dist/internal/clipboard.js.map +1 -1
- package/dist/internal/context.js.map +1 -1
- package/dist/internal/features.js.map +1 -1
- package/dist/renderers/index.js +94 -83
- package/dist/renderers/index.js.map +1 -1
- package/dist/renderers/plainText.js +34 -0
- package/dist/renderers/plainText.js.map +1 -0
- package/dist/theme.css +1 -1
- package/dist/types/agent/requirements.d.ts +1 -1
- package/dist/types/components/VGrid.vue.d.ts +42 -4
- package/dist/types/components/VGridCheckbox.vue.d.ts +2 -2
- package/dist/types/components/VGridGroupCells.vue.d.ts +14 -0
- package/dist/types/components/VGridMenu.vue.d.ts +2 -2
- package/dist/types/components/VGridPagination.vue.d.ts +1 -1
- package/dist/types/components/VGridSelectionBanner.vue.d.ts +18 -0
- package/dist/types/composables/useGridExport.d.ts +49 -0
- package/dist/types/composables/useGridMenus.d.ts +8 -0
- package/dist/types/composables/useGridSelection.d.ts +26 -2
- package/dist/types/composables/useRowGrouping.d.ts +50 -0
- package/dist/types/composables/useVirtualRows.d.ts +2 -0
- package/dist/types/core/csv.d.ts +25 -0
- package/dist/types/core/grouping.d.ts +51 -0
- package/dist/types/features/export.d.ts +8 -0
- package/dist/types/features/index.d.ts +3 -1
- package/dist/types/features/rowGrouping.d.ts +8 -0
- package/dist/types/features/selection.d.ts +3 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/internal/clipboard.d.ts +5 -1
- package/dist/types/internal/context.d.ts +8 -1
- package/dist/types/internal/features.d.ts +3 -1
- package/dist/types/renderers/plainText.d.ts +17 -0
- package/dist/types/types.d.ts +81 -3
- package/dist/vue-grid.css +1 -1
- package/llms-full.txt +294 -48
- package/llms.txt +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -15,7 +15,7 @@ JSON Schema. The `@nocopypaste/vue-grid-mcp` MCP server serves all of this as to
|
|
|
15
15
|
1. **Import the CSS once**: `import '@nocopypaste/vue-grid/style.css'` (in `main.ts`). Without it the
|
|
16
16
|
grid has no layout.
|
|
17
17
|
2. **Register every feature an option needs.** `sortable`, `filterable`, `pagination`,
|
|
18
|
-
`selectable`, `sub-rows`, `virtual`, `pinned`, `hidden`, `group`, `aggregate`, `totals`,
|
|
18
|
+
`selectable`, `sub-rows`, `virtual`, `pinned`, `hidden`, `group`, `aggregate`, `totals`, `group-by`,
|
|
19
19
|
`pinned-rows`, `context-menu`… each needs its feature (table below). Without it the option
|
|
20
20
|
**silently does nothing** (dev builds log a `[vue-grid]` warning naming the feature). Per grid:
|
|
21
21
|
`:features="[sortingFeature, filteringFeature]"`; app-wide: `createVueGrid({ features: [...] })`;
|
|
@@ -50,7 +50,7 @@ JSON Schema. The `@nocopypaste/vue-grid-mcp` MCP server serves all of this as to
|
|
|
50
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
51
|
| Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
|
|
52
52
|
| Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
|
|
53
|
-
| Checkboxes / row selection | `selectionFeature` | `selectable` (or `'single'`), `v-model:selected`, `is-row-selectable` |
|
|
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
54
|
| Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
|
|
55
55
|
| An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
|
|
56
56
|
| 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
|
|
@@ -62,6 +62,8 @@ JSON Schema. The `@nocopypaste/vue-grid-mcp` MCP server serves all of this as to
|
|
|
62
62
|
| Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
|
|
63
63
|
| Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
|
|
64
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` |
|
|
65
67
|
| Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
|
|
66
68
|
| Remember column layout | — | `storage="orders-grid"` (localStorage key) |
|
|
67
69
|
| Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
|
|
@@ -184,13 +186,22 @@ another `<VGrid>` inside.
|
|
|
184
186
|
</VGrid>
|
|
185
187
|
```
|
|
186
188
|
|
|
187
|
-
### Selection
|
|
189
|
+
### Selection and batch actions
|
|
188
190
|
|
|
189
191
|
```vue
|
|
190
|
-
<VGrid v-model:selected="selected" :rows="rows" :columns="columns" row-key="id" selectable
|
|
191
|
-
:is-row-selectable="(r) => r.status !== 'locked'" :features="[selectionFeature]"
|
|
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]">
|
|
194
|
+
<template #toolbar="{ selected, selectedCount, clearSelection }">
|
|
195
|
+
<span v-if="selectedCount">{{ selectedCount }} selected
|
|
196
|
+
<button @click="approve(selected).then(clearSelection)">Approve</button></span>
|
|
197
|
+
</template>
|
|
198
|
+
</VGrid>
|
|
192
199
|
```
|
|
193
200
|
|
|
201
|
+
Don't build a checkbox column with a renderer and your own `ref` of ids: `selectable` gives the
|
|
202
|
+
column, select-all, shift-click ranges, disabled rows and keyboard support. With `data-source`,
|
|
203
|
+
the banner's "Select all N rows" sets `v-model:select-all-matching`; act on the query then.
|
|
204
|
+
|
|
194
205
|
### 10,000+ rows
|
|
195
206
|
|
|
196
207
|
```vue
|
|
@@ -214,6 +225,49 @@ const pinned = ref<PinnedRowsState>({ top: [42] })
|
|
|
214
225
|
<!-- grid.value.pinRow(key, 'top' | 'bottom' | null) from your own button or context menu -->
|
|
215
226
|
```
|
|
216
227
|
|
|
228
|
+
### Row grouping
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
const columns = [
|
|
232
|
+
col({ key: 'customer', field: 'customer.name' }),
|
|
233
|
+
col({ key: 'status', renderer: statusRenderer, groupable: true }),
|
|
234
|
+
col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (o) => o.placedAt.slice(0, 7) }),
|
|
235
|
+
col({ key: 'total', renderer: currencyRenderer, aggregate: 'sum' }), // shown in every group row
|
|
236
|
+
]
|
|
237
|
+
const groupBy = ref(['status'])
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
```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" />
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
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.
|
|
248
|
+
|
|
249
|
+
### CSV export and copy
|
|
250
|
+
|
|
251
|
+
```vue
|
|
252
|
+
<script setup lang="ts">
|
|
253
|
+
import { exportFeature, keyboardNavigationFeature, selectionFeature, type VGridExposed } from '@nocopypaste/vue-grid'
|
|
254
|
+
const grid = ref<VGridExposed>()
|
|
255
|
+
// columns: `exportable: false` on action columns; `exportValue: (row) => row.id` where the cell isn't the data
|
|
256
|
+
</script>
|
|
257
|
+
|
|
258
|
+
<template>
|
|
259
|
+
<button @click="grid?.exportCsv({ filename: 'orders.csv' })">Download CSV</button>
|
|
260
|
+
<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)" />
|
|
263
|
+
</template>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`exportCsv` / `getCsv` default to the filtered, sorted rows on every page, the visible columns and
|
|
267
|
+
raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-separated. Options:
|
|
268
|
+
`rows: 'filtered' | 'all' | 'page' | 'selected'`, `columns: [keys]`, `values: 'raw' | 'formatted'`,
|
|
269
|
+
`header`, `totals`, `children`, `delimiter`. `toCsv(rows, columns)` works without a grid.
|
|
270
|
+
|
|
217
271
|
### Row actions and context menu
|
|
218
272
|
|
|
219
273
|
```vue
|
|
@@ -283,3 +337,14 @@ Tokens: `--vg-*` (see README → Theming). Dark mode follows `color-scheme`. Den
|
|
|
283
337
|
- Virtual grid with variable row content → rows must share `rowHeight`; use `lines`/`ellipsis` to keep them uniform.
|
|
284
338
|
- `dataSource` plus `rows` → `rows` is ignored with a data source.
|
|
285
339
|
- A nested child with different columns → not a sub-grid; use `#detail` with another `<VGrid>`.
|
|
340
|
+
- One group per date or timestamp → group by a coarser value: `groupValue: (row) => row.date.slice(0, 7)`.
|
|
341
|
+
- Ctrl+C copies nothing for a clicked cell → cells only take focus with `keyboardNavigationFeature`
|
|
342
|
+
(or select rows first); `exportFeature` must be registered too.
|
|
343
|
+
- An exported column of `⋯` / buttons / `[object Object]` → `exportable: false`, or `exportValue: (row) => …`.
|
|
344
|
+
- Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
|
|
345
|
+
(CSV exports are raw by default).
|
|
346
|
+
- `group-by` names a field, not a column → it takes column `key`s; add a (hidden) column for it.
|
|
347
|
+
- `selected` still holds deleted or reloaded rows' keys → add `prune-selection` (keys are kept by
|
|
348
|
+
default so a selection can span server pages).
|
|
349
|
+
- A batch action on "Select all N rows" only touched one page → check `selectAllMatching` and act on
|
|
350
|
+
the query, not on `selected` (which holds the loaded rows only).
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 — 2026-11-24
|
|
4
|
+
|
|
5
|
+
**Row grouping** (`rowGroupingFeature`): `v-model:group-by` groups the rows by one or more
|
|
6
|
+
columns into collapsible group rows with the value (in the column's renderer, or the
|
|
7
|
+
`#group-<key>` slot), the row count and each column's `aggregate` for the group. Groups follow
|
|
8
|
+
filters and sorting, page as a unit, work with virtual scrolling, and select their rows from a
|
|
9
|
+
group checkbox. Columns with `groupable: true` get Group by / Ungroup in the header menu;
|
|
10
|
+
`groupValue` groups by a derived value (a month, a range); `groups-expanded` opens every group;
|
|
11
|
+
`expandAll()` / `collapseAll()` include groups. `validateGridConfig()` checks `group-by` keys.
|
|
12
|
+
`groupRows()` and `isRowGroup()` are exported.
|
|
13
|
+
|
|
14
|
+
**CSV export and copy** (`exportFeature`): `grid.exportCsv()` downloads the filtered, sorted
|
|
15
|
+
rows as CSV (UTF-8 with a BOM), `grid.getCsv()` returns the text, `grid.copyRows()` copies rows as
|
|
16
|
+
tab-separated text that pastes as cells into spreadsheets, and Ctrl/⌘+C copies the selected rows,
|
|
17
|
+
else the focused cell, as displayed (`copy` event). Options pick the rows (`filtered`, `all`,
|
|
18
|
+
`page`, `selected`, plus sub-grid `children`), columns, raw or formatted values, header, totals and
|
|
19
|
+
delimiter. Fields are quoted per RFC 4180 and formula-like text is guarded. New column options
|
|
20
|
+
`exportValue` and `exportable`; `toCsv()` writes CSV without a grid.
|
|
21
|
+
|
|
22
|
+
**Selection for batch actions**: shift-click a row checkbox (or Shift+Space) to select a range in
|
|
23
|
+
display order; the `#toolbar` slot gets `selected`, `selectedCount`, `selectAllMatching` and
|
|
24
|
+
`clearSelection()` for a batch-action bar; `grid.clearSelection()`; `prune-selection` drops keys
|
|
25
|
+
whose rows left the data; with server data, a banner offers "Select all N rows" once the page is
|
|
26
|
+
selected (`v-model:select-all-matching`), ending when the filters change or a row is unticked.
|
|
27
|
+
|
|
28
|
+
Renderers: number, signed number, currency, change, date, date-time, boolean, status, chip and
|
|
29
|
+
list now have a plain-text `format` (what copying shows); a renderer's `format` also receives the
|
|
30
|
+
row.
|
|
31
|
+
|
|
32
|
+
Copying (the text cell's copy button too) falls back to the browser's copy command where the
|
|
33
|
+
Clipboard API is missing or refused, e.g. on pages served over plain http.
|
|
34
|
+
|
|
35
|
+
Bundle: virtual scrolling and export no longer pull in the row grouping code; the README's
|
|
36
|
+
bundle sizes are now measured with Rolldown (Vite's bundler), counting every chunk an app loads up
|
|
37
|
+
front (a plain grid: 13.6 kB gzip).
|
|
38
|
+
|
|
39
|
+
Docs: the generated API reference no longer inserts stray `;` into multi-line column option
|
|
40
|
+
descriptions.
|
|
41
|
+
|
|
3
42
|
## 0.2.0 — first public release
|
|
4
43
|
|
|
5
44
|
`<VGrid>`: a Vue 3 data grid laid out with CSS Grid, nested rows in real `subgrid`. A plain grid
|
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ an opt-in feature:
|
|
|
99
99
|
| `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
|
|
100
100
|
| `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
|
|
101
101
|
| `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
|
|
102
|
-
| `selectionFeature` | `selectable` (multi or single), `v-model:selected`, `selection-mode`, `is-row-selectable`, select-all, Space to select |
|
|
102
|
+
| `selectionFeature` | `selectable` (multi or single), `v-model:selected`, `selection-mode`, `is-row-selectable`, select-all, Space to select, shift-click / Shift+Space ranges, `prune-selection`, the selection in `#toolbar` for batch actions, "select all N matching rows" with server data (`v-model:select-all-matching`) |
|
|
103
103
|
| `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
|
|
104
104
|
| `menusFeature` | The header right-click menu (`header-menu`) and body-cell menus (`context-menu`); without it the browser's menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it |
|
|
105
105
|
| `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
|
|
@@ -111,6 +111,8 @@ an opt-in feature:
|
|
|
111
111
|
| `columnGroupsFeature` | Grouped column headers: columns with the same `group` share a header cell in a sticky row above theirs; groups follow reordering, hiding, resizing and pinning (a pin boundary splits a group) |
|
|
112
112
|
| `rowPinningFeature` | `v-model:pinned-rows` / `pinRow()`: rows that stay in view above or below the body, plus `pinned-top-rows` / `pinned-bottom-rows` for rows that aren't in the data |
|
|
113
113
|
| `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
|
|
114
|
+
| `rowGroupingFeature` | `v-model:group-by`: rows grouped by one or more columns into collapsible group rows with the value, row count and aggregates; Group by / Ungroup in the header menu for `groupable` columns |
|
|
115
|
+
| `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
|
|
114
116
|
|
|
115
117
|
```ts
|
|
116
118
|
// per grid
|
|
@@ -144,44 +146,53 @@ what you import.
|
|
|
144
146
|
| File | What | gzip |
|
|
145
147
|
|---|---|---|
|
|
146
148
|
| `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
|
|
147
|
-
| `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.
|
|
148
|
-
| `core.css` | `base.css` + `theme.css` | 5.
|
|
149
|
+
| `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.3 kB |
|
|
150
|
+
| `core.css` | `base.css` + `theme.css` | 5.1 kB |
|
|
149
151
|
| `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
|
|
150
|
-
| `style.css` | All of the above | 6.
|
|
152
|
+
| `style.css` | All of the above | 6.6 kB |
|
|
151
153
|
|
|
152
154
|
For a fully custom look, import only `base.css` (and `renderers.css` if you use renderers)
|
|
153
155
|
and style the `.vg-*` classes yourself. See [Theming](#theming).
|
|
154
156
|
|
|
155
157
|
| Import (minified / gzip, Vue excluded) | Initial chunk |
|
|
156
158
|
|---|---|
|
|
157
|
-
| `VGrid` (no features) |
|
|
158
|
-
| `VGrid` + `sortingFeature` |
|
|
159
|
-
| `VGrid` + `filteringFeature` |
|
|
160
|
-
| `VGrid` + `serverDataFeature` |
|
|
161
|
-
| `VGrid` + `paginationFeature` |
|
|
162
|
-
| `VGrid` + `selectionFeature` |
|
|
163
|
-
| `VGrid` + `subGridsFeature` |
|
|
164
|
-
| `VGrid` + `menusFeature` |
|
|
165
|
-
| `VGrid` + `columnReorderFeature` |
|
|
166
|
-
| `VGrid` + `columnPinningFeature` |
|
|
167
|
-
| `VGrid` + `virtualScrollingFeature` |
|
|
168
|
-
| `VGrid` + `columnVisibilityFeature` |
|
|
169
|
-
| `VGrid` + `keyboardNavigationFeature` |
|
|
170
|
-
| `VGrid` + `columnResizingFeature` |
|
|
171
|
-
| `VGrid` + `columnGroupsFeature` |
|
|
172
|
-
| `VGrid` + `rowPinningFeature` |
|
|
173
|
-
| `VGrid` + `aggregationFeature` |
|
|
174
|
-
| `VGrid` + `
|
|
175
|
-
| `VGrid` + `
|
|
176
|
-
| `VGrid` + `
|
|
177
|
-
| `
|
|
178
|
-
|
|
|
179
|
-
| `
|
|
159
|
+
| `VGrid` (no features) | 39.0 kB / 13.6 kB |
|
|
160
|
+
| `VGrid` + `sortingFeature` | 39.8 kB / 13.9 kB |
|
|
161
|
+
| `VGrid` + `filteringFeature` | 49.7 kB / 17.4 kB |
|
|
162
|
+
| `VGrid` + `serverDataFeature` | 40.4 kB / 14.2 kB |
|
|
163
|
+
| `VGrid` + `paginationFeature` | 39.2 kB / 13.7 kB |
|
|
164
|
+
| `VGrid` + `selectionFeature` | 43.2 kB / 15.1 kB |
|
|
165
|
+
| `VGrid` + `subGridsFeature` | 41.4 kB / 14.5 kB |
|
|
166
|
+
| `VGrid` + `menusFeature` | 49.6 kB / 17.2 kB |
|
|
167
|
+
| `VGrid` + `columnReorderFeature` | 42.7 kB / 14.9 kB |
|
|
168
|
+
| `VGrid` + `columnPinningFeature` | 41.2 kB / 14.5 kB |
|
|
169
|
+
| `VGrid` + `virtualScrollingFeature` | 44.8 kB / 15.8 kB |
|
|
170
|
+
| `VGrid` + `columnVisibilityFeature` | 39.2 kB / 13.7 kB |
|
|
171
|
+
| `VGrid` + `keyboardNavigationFeature` | 41.5 kB / 14.5 kB |
|
|
172
|
+
| `VGrid` + `columnResizingFeature` | 41.8 kB / 14.7 kB |
|
|
173
|
+
| `VGrid` + `columnGroupsFeature` | 40.3 kB / 14.1 kB |
|
|
174
|
+
| `VGrid` + `rowPinningFeature` | 44.0 kB / 15.0 kB |
|
|
175
|
+
| `VGrid` + `aggregationFeature` | 44.2 kB / 15.1 kB |
|
|
176
|
+
| `VGrid` + `rowGroupingFeature` | 48.6 kB / 16.4 kB |
|
|
177
|
+
| `VGrid` + `exportFeature` | 42.8 kB / 15.1 kB |
|
|
178
|
+
| `VGrid` + `allFeatures` + `VGridSearch` | 102.8 kB / 34.7 kB |
|
|
179
|
+
| `VGrid` + `currencyRenderer` | 40.4 kB / 14.1 kB |
|
|
180
|
+
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 45.8 kB / 15.9 kB |
|
|
181
|
+
| `sortRows` only | 0.7 kB / 0.4 kB |
|
|
182
|
+
| `toCsv` only | 1.1 kB / 0.6 kB |
|
|
183
|
+
| everything | 147.4 kB / 47.2 kB |
|
|
184
|
+
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 63.7 kB / 17.1 kB |
|
|
180
185
|
|
|
181
186
|
With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
|
|
182
187
|
chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
183
|
-
`paginationFeature`, the pager is one too
|
|
184
|
-
|
|
188
|
+
`paginationFeature`, the pager is one too, and with `selectionFeature` the "select all N rows" banner.
|
|
189
|
+
|
|
190
|
+
Measured with Rolldown (the bundler in Vite) on tiny apps importing the published build:
|
|
191
|
+
minified, gzipped, Vue external, `process.env.NODE_ENV` set to `production` (which also drops the
|
|
192
|
+
dev warnings). "Initial" counts the entry and every chunk it loads up front; on-demand chunks are
|
|
193
|
+
left out. esbuild with `--splitting` tree-shakes the package too, but also loads the pager's and
|
|
194
|
+
the filter core's chunks (5.2 kB, 2.3 kB gzip) in a grid without those features: esbuild keeps
|
|
195
|
+
chunks that on-demand imports share with the entry, even when nothing uses them.
|
|
185
196
|
|
|
186
197
|
## `<VGrid>` API
|
|
187
198
|
|
|
@@ -210,16 +221,20 @@ chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
|
210
221
|
| `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
|
|
211
222
|
| `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
|
|
212
223
|
| `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
|
|
213
|
-
| `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next
|
|
224
|
+
| `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
|
|
214
225
|
| `v-model:selected` | `RowKey[]` | `[]` | |
|
|
215
226
|
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
|
|
216
227
|
| `isRowSelectable` | `(row) => boolean` | — | |
|
|
228
|
+
| `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
|
|
229
|
+
| `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
|
|
217
230
|
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
|
|
218
231
|
| `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null` | Top-level rows pinned above / below the body. Needs `rowPinningFeature` (as do the next two). See [Pinned rows and totals](#pinned-rows-and-totals). |
|
|
219
232
|
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
|
|
220
233
|
| `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
|
|
221
234
|
| `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
|
|
222
235
|
| `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
|
|
236
|
+
| `v-model:groupBy` | `string[] \| string \| null` | `null` | Column keys to group the rows by, outermost first. Needs `rowGroupingFeature` (as does the next one). See [Row grouping](#row-grouping). |
|
|
237
|
+
| `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
|
|
223
238
|
| `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
|
|
224
239
|
| `rowClass` | `(row, index) => ClassValue` | — | |
|
|
225
240
|
| `highlightedRows` | `RowKey[]` | — | |
|
|
@@ -239,6 +254,7 @@ chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
|
239
254
|
`row-click(row, event)` · `cell-click({ row, rowKey, column, value, event })` (columns with `clickable: true`) ·
|
|
240
255
|
`cell-action({ name, payload, row, rowKey, column })` (from renderers) · `sub-rows-error({ row, error })` · `context-action({ name, item, row, rowKey, column, value })` · `header-action({ name, item, column })` ·
|
|
241
256
|
`query-change(query: GridQuery)` (sort + filters + page as one object, on mount and on every real change) ·
|
|
257
|
+
`copy({ kind, text, rows, columns })` (rows or a cell were copied: `exportFeature`) ·
|
|
242
258
|
`load-error(error)` (a `dataSource` call failed) ·
|
|
243
259
|
plus the `update:*` events of every `v-model`.
|
|
244
260
|
|
|
@@ -247,8 +263,9 @@ Clicks on links, buttons and inputs inside a cell never trigger `row-click`.
|
|
|
247
263
|
### Slots
|
|
248
264
|
|
|
249
265
|
`cell-<key>` (`{ row, value, rowKey, rowIndex, depth, column }`) · `header-<key>` (`{ column }`) ·
|
|
250
|
-
`total-<key>` (`{ value, column }`, a cell of the totals row
|
|
251
|
-
`
|
|
266
|
+
`total-<key>` (`{ value, column, group? }`, a cell of the totals row or a group row) ·
|
|
267
|
+
`group-<key>` (`{ value, count, rows, column, group }`, the value of a group row) · `detail` (`{ row, rowKey, depth }`) ·
|
|
268
|
+
`toolbar` (`{ columns, columnState, setColumnState, filters, setFilters, clearFilters, activeFilterCount, selected, selectedCount, selectAllMatching, clearSelection }`) ·
|
|
252
269
|
`empty` · `loading` · `sub-rows-loading` (`{ row }`).
|
|
253
270
|
|
|
254
271
|
### Exposed methods
|
|
@@ -259,8 +276,10 @@ grid.value?.scrollToTop() / scrollToRow(key) / expandAll() / collapseAll() / set
|
|
|
259
276
|
grid.value?.patchLoadedRows([{ id: 'c2', city: 'Niš' }]) // field updates for lazy children and dataSource rows
|
|
260
277
|
grid.value?.setFilters({ columns: { city: { type: 'text', op: 'contains', value: 'nis' } } })
|
|
261
278
|
grid.value?.clearFilters() / openFilter('city') / reload() // reload: re-run the dataSource query
|
|
279
|
+
grid.value?.clearSelection() // selectionFeature: clears the selection, "all matching" included
|
|
262
280
|
grid.value?.reloadSubRows('c2') // forget lazily loaded children (of one row, or all): they load again
|
|
263
281
|
grid.value?.pinRow(42, 'top') // pin a row above the body ('bottom' below it, null to unpin): rowPinningFeature
|
|
282
|
+
grid.value?.exportCsv({ filename: 'orders.csv' }) / getCsv() / copyRows() // exportFeature, see Export and copy
|
|
264
283
|
```
|
|
265
284
|
|
|
266
285
|
`reload()` also forgets lazily loaded children, as does passing a different `load-sub-rows`
|
|
@@ -320,11 +339,52 @@ animate on the compositor (GPU): a busy live feed costs the main thread about a
|
|
|
320
339
|
filterFn?: (row, filter) => boolean // replaces the built-in matching for this column
|
|
321
340
|
filterComponent?: Component // custom popover body: props { modelValue, column }, emits update:modelValue
|
|
322
341
|
searchable?: boolean // included in the quick search (default true for visible columns)
|
|
323
|
-
aggregate?: 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values, rows) => unknown) // totals row (aggregationFeature)
|
|
342
|
+
aggregate?: 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values, rows) => unknown) // totals row (aggregationFeature) and group rows
|
|
343
|
+
groupable?: boolean // Group by / Ungroup in the header menu (rowGroupingFeature)
|
|
344
|
+
groupValue?: (row) => unknown // what rows are grouped by (default: the cell value), e.g. the month of a date
|
|
345
|
+
exportValue?: (row) => unknown // what CSV exports and copying use (exportFeature), e.g. an id instead of a link
|
|
346
|
+
exportable?: boolean // in exports and copied rows (default true); false for action columns
|
|
324
347
|
cellClass?: ClassValue | ((row) => ClassValue); headerClass?: ClassValue
|
|
325
348
|
}
|
|
326
349
|
```
|
|
327
350
|
|
|
351
|
+
## Selection and batch actions
|
|
352
|
+
|
|
353
|
+
`selectionFeature` adds a checkbox column. `v-model:selected` holds the selected row keys; the
|
|
354
|
+
`#toolbar` slot gets them too, so a batch-action bar lives in the grid:
|
|
355
|
+
|
|
356
|
+
```vue
|
|
357
|
+
<VGrid v-model:selected="selected" :rows="requests" :columns="columns" row-key="id" selectable prune-selection
|
|
358
|
+
:is-row-selectable="(r) => r.status === 'pending'" :features="[selectionFeature]">
|
|
359
|
+
<template #toolbar="{ selected, selectedCount, clearSelection }">
|
|
360
|
+
<template v-if="selectedCount">
|
|
361
|
+
{{ selectedCount }} selected
|
|
362
|
+
<button @click="approve(selected).then(clearSelection)">Approve</button>
|
|
363
|
+
<button @click="clearSelection()">Clear</button>
|
|
364
|
+
</template>
|
|
365
|
+
</template>
|
|
366
|
+
</VGrid>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
- **Ranges.** Shift-click a checkbox (or Shift+Space with keyboard navigation) to give every row
|
|
370
|
+
on screen from the last toggled one to this one the clicked row's new state. Ranges follow the
|
|
371
|
+
display order (sort, filters, expanded sub-grids, open groups) and skip rows that can't be
|
|
372
|
+
selected.
|
|
373
|
+
- **Select all.** The header checkbox selects every selectable row that passes the filters, on
|
|
374
|
+
every page; `selectable="single"` has radio buttons and no select-all.
|
|
375
|
+
- **Rows that leave.** By default selected keys stay when their rows leave the data, so a
|
|
376
|
+
selection can span server pages. `prune-selection` drops them instead: after a reload, a batch
|
|
377
|
+
delete or a new page, `selected` only holds rows that exist.
|
|
378
|
+
- **All matching rows (server data).** With a `data-source`, the header checkbox selects the loaded
|
|
379
|
+
page; a banner then offers *Select all N rows* (N = the `total` the source returned). That sets
|
|
380
|
+
`v-model:select-all-matching`: every row shows ticked, `selectedCount` is N, and your batch
|
|
381
|
+
action should run on the query (`@query-change`) rather than on `selected`. Changing the
|
|
382
|
+
filters, unticking a row (the keys already in `selected` stay, plus the rest of the loaded page) or
|
|
383
|
+
*Clear selection* ends it.
|
|
384
|
+
- `grid.clearSelection()` clears it all from code. Cascading through sub-grids, group checkboxes
|
|
385
|
+
(row grouping) and copying the selected rows (export feature) work as described in their
|
|
386
|
+
sections.
|
|
387
|
+
|
|
328
388
|
## Sub-grids (CSS `subgrid`)
|
|
329
389
|
|
|
330
390
|
```vue
|
|
@@ -597,6 +657,109 @@ With virtual scrolling, `aria-rowindex` / `aria-rowcount` count them. Style them
|
|
|
597
657
|
`.vg-pinned-top`, `.vg-pinned-bottom`, `.vg-row-pinned`, `.vg-row-total` and the
|
|
598
658
|
`--vg-total-row-bg` / `--vg-total-row-font-weight` tokens.
|
|
599
659
|
|
|
660
|
+
## Row grouping
|
|
661
|
+
|
|
662
|
+
`rowGroupingFeature` groups the rows by one or more columns. Each group is a row with the grouped
|
|
663
|
+
column's name, the value, the number of rows and each column's `aggregate` over the group; expand
|
|
664
|
+
it to see its sub-groups or, at the last level, its rows.
|
|
665
|
+
|
|
666
|
+
```vue
|
|
667
|
+
<script setup lang="ts">
|
|
668
|
+
const columns = [
|
|
669
|
+
col({ key: 'player', field: 'player.name' }),
|
|
670
|
+
col({ key: 'city', field: 'player.city', groupable: true }),
|
|
671
|
+
col({ key: 'status', renderer: statusRenderer, groupable: true }),
|
|
672
|
+
col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
|
|
673
|
+
col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (b) => b.placedAt.slice(0, 7) }),
|
|
674
|
+
]
|
|
675
|
+
const groupBy = ref(['status', 'city'])
|
|
676
|
+
</script>
|
|
677
|
+
|
|
678
|
+
<template>
|
|
679
|
+
<VGrid v-model:group-by="groupBy" :rows="bets" :columns="columns" row-key="id" totals
|
|
680
|
+
:features="[rowGroupingFeature, aggregationFeature]" />
|
|
681
|
+
</template>
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
- **What a group shows.** The first column holds the expander, the grouped column's header, the
|
|
685
|
+
value (with that column's renderer, so a status groups under its badge; a `groupValue` shows as
|
|
686
|
+
text) and the row count. That cell runs across the columns after it up to the first one with
|
|
687
|
+
an `aggregate`; those show the group's own aggregate. The `group-<key>` slot renders the value
|
|
688
|
+
yourself (`{ value, count, rows, column, group }`); `total-<key>` also renders group cells
|
|
689
|
+
(with `group` set). Empty values form a `(blank)` group, last.
|
|
690
|
+
- **Order, filters, pages.** Groups follow the filters and are ordered by value, descending when
|
|
691
|
+
the grid is sorted descending by the grouped column; sorting by any other column orders the
|
|
692
|
+
rows inside each group. Pagination pages the top-level groups. With server data, the rows of
|
|
693
|
+
the current page are grouped.
|
|
694
|
+
- **Expanding.** Groups start collapsed (`groups-expanded` opens them). Click a group's label or its
|
|
695
|
+
arrow, or use →/← with keyboard navigation; `expandAll()` / `collapseAll()` include groups.
|
|
696
|
+
Changing `group-by` starts over.
|
|
697
|
+
- **Selection.** A group's checkbox selects or clears every row in it, and shows partly
|
|
698
|
+
selected groups as indeterminate.
|
|
699
|
+
- **Header menu.** Columns with `groupable: true` get *Group by* (adds a level) / *Ungroup*, and
|
|
700
|
+
*Ungroup all*. Any column can be grouped through `v-model:group-by`.
|
|
701
|
+
- **Virtual scrolling.** Group rows are part of the virtual layout: thousands of rows in a few
|
|
702
|
+
groups render only what's in view.
|
|
703
|
+
|
|
704
|
+
Style group rows with `.vg-rowgroup` (and `[data-group-level]`), `.vg-rowgroup-name`,
|
|
705
|
+
`.vg-rowgroup-value`, `.vg-rowgroup-count` and the `--vg-rowgroup-bg` /
|
|
706
|
+
`--vg-rowgroup-font-weight` tokens. `groupRows()` and `isRowGroup()` are exported for using the
|
|
707
|
+
same grouping elsewhere.
|
|
708
|
+
|
|
709
|
+
## Export and copy
|
|
710
|
+
|
|
711
|
+
`exportFeature` turns the grid's rows into CSV and copies them to the clipboard.
|
|
712
|
+
|
|
713
|
+
```vue
|
|
714
|
+
<script setup lang="ts">
|
|
715
|
+
const grid = ref<VGridExposed>()
|
|
716
|
+
const columns = [
|
|
717
|
+
col({ key: 'customer', field: 'customer.name' }),
|
|
718
|
+
col({ key: 'total', renderer: currencyRenderer, aggregate: 'sum' }),
|
|
719
|
+
col({ key: 'link', renderer: linkRenderer, exportValue: (o) => o.id }), // export the id, not the link
|
|
720
|
+
col({ key: 'actions', renderer: actionsMenuRenderer, exportable: false }), // left out
|
|
721
|
+
]
|
|
722
|
+
</script>
|
|
723
|
+
|
|
724
|
+
<template>
|
|
725
|
+
<button @click="grid?.exportCsv({ filename: 'orders.csv', totals: true })">Download CSV</button>
|
|
726
|
+
<button @click="grid?.copyRows()">Copy selected</button>
|
|
727
|
+
<VGrid ref="grid" :rows="orders" :columns="columns" row-key="id" selectable totals
|
|
728
|
+
:features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
|
|
729
|
+
@copy="(e) => toast(`Copied ${e.rows.length} rows`)" />
|
|
730
|
+
</template>
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
- **`exportCsv(options)`** downloads a `.csv` file (`filename`, default `export.csv`) in UTF-8 with
|
|
734
|
+
a BOM, so Excel shows accents right (`bom: false` to drop it). **`getCsv(options)`** returns the
|
|
735
|
+
same text, for uploading or previewing.
|
|
736
|
+
- **`copyRows(options)`** copies rows as tab-separated text, which pastes as cells into Excel,
|
|
737
|
+
Google Sheets or Numbers. It resolves `false` when nothing was copied.
|
|
738
|
+
- **Ctrl / ⌘ + C** inside the grid copies the selected rows; with none selected, the focused cell
|
|
739
|
+
(cells take focus with `keyboardNavigationFeature`). A text selection, or focus in an input,
|
|
740
|
+
is left to the browser.
|
|
741
|
+
- **Options** (all methods): `rows` — `'filtered'` (default for exports: the rows that pass the
|
|
742
|
+
filters, sorted, every page), `'all'`, `'page'`, `'selected'` (default for copying, nested rows
|
|
743
|
+
included); `children: true` adds the known sub-grid rows after their parent; `columns` — keys,
|
|
744
|
+
in order, hidden columns allowed (default: the visible columns without `exportable: false`);
|
|
745
|
+
`values` — `'raw'` (default for exports: numbers and ISO dates a spreadsheet can compute with)
|
|
746
|
+
or `'formatted'` (default for copying: as the cells show them); `header` (default `true` for
|
|
747
|
+
exports, `false` for copying); `totals: true` adds the totals row; `delimiter` (`,` / tab);
|
|
748
|
+
`guard` (default `true`).
|
|
749
|
+
- **Values.** A column's `exportValue(row)` wins. Formatted values come from the renderer's
|
|
750
|
+
`format` (numbers, currency, change, dates, date-times, booleans, status, chips and lists have
|
|
751
|
+
one; your own renderers can add it); other values are written as text: dates in ISO 8601,
|
|
752
|
+
arrays joined with `, `, objects as JSON. Grouped grids export their rows, not the group rows.
|
|
753
|
+
- **Safe for spreadsheets.** Fields are quoted per RFC 4180, and text that a spreadsheet would run
|
|
754
|
+
as a formula (`=…`, `+…`, `-…`, `@…`) gets a leading `'`; numbers are left alone.
|
|
755
|
+
- **Clipboard.** Copying uses the Clipboard API and falls back to the browser's copy command where
|
|
756
|
+
that API is missing or refused (pages served over plain http), as does the copy button of
|
|
757
|
+
text cells.
|
|
758
|
+
|
|
759
|
+
Without the grid: `toCsv(rows, columns, { delimiter, header, guard })` writes CSV from any rows
|
|
760
|
+
and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(table)`,
|
|
761
|
+
`plainText(value)` and `guardFormula(text)` are its parts.
|
|
762
|
+
|
|
600
763
|
## Virtual scrolling
|
|
601
764
|
|
|
602
765
|
```vue
|
|
@@ -767,6 +930,8 @@ declare module '@nocopypaste/vue-grid' {
|
|
|
767
930
|
}
|
|
768
931
|
export const ratingRenderer = defineCellRenderer<{ max?: number }>({
|
|
769
932
|
name: 'rating', component: RatingCell, defaults: { max: 5 }, sortValue: (v) => Number(v),
|
|
933
|
+
// what Ctrl+C and formatted CSV exports copy (export feature); without it the raw value
|
|
934
|
+
format: (v, options, ctx, row) => `${Number(v ?? 0)} of ${options.max ?? 5}`,
|
|
770
935
|
})
|
|
771
936
|
// app.use(createVueGrid({ renderers: [ratingRenderer] })) or <VGrid :renderers="[ratingRenderer]">
|
|
772
937
|
```
|