@nocopypaste/vue-grid 0.5.0 → 0.7.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 +10 -2
- package/CHANGELOG.md +37 -0
- package/README.md +177 -79
- package/agent/api.json +63 -9
- package/agent/api.md +16 -6
- package/agent/grid-config.schema.json +9 -11
- package/dist/agent/api.js +63 -9
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +545 -518
- 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 +4 -3
- package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js +58 -53
- package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js +50 -49
- package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +151 -146
- package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js +44 -43
- package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +10 -8
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +62 -57
- package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js +59 -58
- package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +62 -55
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +60 -59
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js +27 -26
- package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +12 -11
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js +37 -30
- package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/useGridExport.js +98 -51
- package/dist/composables/useGridExport.js.map +1 -1
- package/dist/composables/useGridMenus.js +41 -41
- package/dist/composables/useGridMenus.js.map +1 -1
- package/dist/composables/useStatusBar.js +9 -0
- package/dist/composables/useStatusBar.js.map +1 -1
- package/dist/core/xlsx.js +172 -0
- package/dist/core/xlsx.js.map +1 -0
- package/dist/features/export.js.map +1 -1
- package/dist/index.js +55 -54
- package/dist/internal/context.js.map +1 -1
- package/dist/internal/messages.js +20 -0
- package/dist/internal/messages.js.map +1 -0
- package/dist/internal/print.js +51 -0
- package/dist/internal/print.js.map +1 -0
- package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js +31 -30
- package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js +28 -27
- package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js +22 -21
- package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js +37 -36
- package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js +16 -15
- package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js +21 -20
- package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js +21 -20
- package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js +18 -17
- package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js +35 -34
- package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/types/components/VGrid.vue.d.ts +34 -7
- package/dist/types/components/VGridColumnMenu.vue.d.ts +4 -5
- package/dist/types/components/VGridMenu.vue.d.ts +1 -1
- package/dist/types/components/VGridPagination.vue.d.ts +8 -3
- package/dist/types/components/VGridSearch.vue.d.ts +2 -2
- package/dist/types/composables/useGridExport.d.ts +6 -1
- package/dist/types/composables/useGridMenus.d.ts +3 -1
- package/dist/types/composables/useStatusBar.d.ts +7 -0
- package/dist/types/core/xlsx.d.ts +34 -0
- package/dist/types/features/export.d.ts +6 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/internal/context.d.ts +5 -1
- package/dist/types/internal/messages.d.ts +16 -0
- package/dist/types/internal/print.d.ts +16 -0
- package/dist/types/renderers/parts/CopyButton.vue.d.ts +1 -3
- package/dist/types/types.d.ts +314 -0
- package/llms-full.txt +203 -87
- package/llms.txt +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -64,8 +64,9 @@ runs in the [live examples](https://eboye.github.io/eboye-vue-grid/), each with
|
|
|
64
64
|
| Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
|
|
65
65
|
| A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
|
|
66
66
|
| 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 |
|
|
67
|
-
| Download CSV, copy rows / cells
|
|
67
|
+
| Download CSV / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
|
|
68
68
|
| Row / selection counts, sum of the selected rows | `statusBarFeature` | `status-bar` (or `{ summary: ['total'], aggregates?: ['sum', 'avg'] }`); `#status-bar="{ rowCount, selectedCount, summary, … }"` |
|
|
69
|
+
| Translate / reword the grid, drop built-in pieces | — | `messages` (`GridMessages`), `parts` (`GridParts`): app-wide in `createVueGrid` or per grid; slots `#load-error`, `#no-match`, `#select-all-banner` |
|
|
69
70
|
| Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
|
|
70
71
|
| Remember column layout | — | `storage="orders-grid"` (localStorage key) |
|
|
71
72
|
| Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
|
|
@@ -365,7 +366,7 @@ visible column and runs across the next ones up to the first with an `aggregate`
|
|
|
365
366
|
column it drops the column name and ellipsizes the value (full label as tooltip), so give it room
|
|
366
367
|
where the value matters. `#group-<key>="{ value, count }"` renders a group's value yourself.
|
|
367
368
|
|
|
368
|
-
### CSV export and copy
|
|
369
|
+
### CSV / Excel export and copy
|
|
369
370
|
|
|
370
371
|
```vue
|
|
371
372
|
<script setup lang="ts">
|
|
@@ -398,6 +399,10 @@ const grid = ref<VGridExposed>()
|
|
|
398
399
|
raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-separated. Options:
|
|
399
400
|
`rows: 'filtered' | 'all' | 'page' | 'selected'`, `columns: [keys]`, `values: 'raw' | 'formatted'`,
|
|
400
401
|
`header`, `totals`, `children`, `delimiter`. `toCsv(rows, columns)` works without a grid.
|
|
402
|
+
`exportXlsx({ filename, sheetName })` / `getXlsx()` (a Promise) write an Excel file with typed cells
|
|
403
|
+
(numbers, dates, booleans) and number formats from the renderers; `toXlsx(rows, columns)` without a grid.
|
|
404
|
+
`print({ title, totals, landscape })` prints every matching row as a table (header on each page);
|
|
405
|
+
Ctrl+P on the page only prints what is on screen.
|
|
401
406
|
|
|
402
407
|
### Row actions and context menu
|
|
403
408
|
|
|
@@ -510,6 +515,9 @@ only sees stylesheet rules. Density:
|
|
|
510
515
|
- Ctrl+C copies nothing for a clicked cell → cells only take focus with `keyboardNavigationFeature`
|
|
511
516
|
(or select rows first); `exportFeature` must be registered too.
|
|
512
517
|
- An exported column of `⋯` / buttons / `[object Object]` → `exportable: false`, or `exportValue: (row) => …`.
|
|
518
|
+
- Printing the page (Ctrl+P) shows only the rows on screen, clipped to the grid → use `grid.print()`.
|
|
519
|
+
- Translating by replacing components or CSS `content` → set `messages` (every built-in text has a key).
|
|
520
|
+
- Hiding a built-in piece with CSS → `parts: { filterButtons: false, … }` leaves it out of the DOM (and the tab order).
|
|
513
521
|
- Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
|
|
514
522
|
(CSV exports are raw by default).
|
|
515
523
|
- `group-by` names a field, not a column → it takes column `key`s; add a (hidden) column for it.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0 — 2026-11-24
|
|
4
|
+
|
|
5
|
+
**Text and parts are configurable.** `messages` (`GridMessages`) replaces any built-in text: menus,
|
|
6
|
+
filters, the pager, the status bar, notices, screen-reader labels and renderer buttons, 112
|
|
7
|
+
keys, functions where a value goes in (`groupBy(column)`, `rowCount(shown, total)`…). `parts`
|
|
8
|
+
(`GridParts`) leaves out pieces a feature adds: the progress bar, the load-error notice, Retry
|
|
9
|
+
buttons, the no-match Clear button, the select-all checkbox and banner, filter funnels, resize
|
|
10
|
+
grips, header dragging, Ctrl/⌘+C and group counts. Both are app-wide in `createVueGrid` or per
|
|
11
|
+
grid, the grid's own winning. New slots replace parts: `#load-error`, `#no-match`,
|
|
12
|
+
`#select-all-banner`. `pagination` takes `{ siblings, summary, firstLast }` too (`PaginationOptions`;
|
|
13
|
+
`<VGridPagination first-last>`), and the status bar `{ rows, selected, filters, clear }` flags.
|
|
14
|
+
`empty-text`, `no-match-text` and `totals-label` now default to `messages`, then English; the
|
|
15
|
+
standalone components' label props to `messages` too. New exported types `GridMessages`,
|
|
16
|
+
`GridParts`, `PaginationOptions`.
|
|
17
|
+
|
|
18
|
+
**Printing** (export feature): `grid.print()` prints the rows as a table from a hidden frame,
|
|
19
|
+
through the browser's print dialog: every row that passes the filters, sorted, on every page (a
|
|
20
|
+
virtual grid included, which only has the rows in view on screen), as the cells show them. The
|
|
21
|
+
header repeats on each printed page, numbers are right-aligned as in the grid, and the totals
|
|
22
|
+
print once, in bold, after the last row. Options: the export ones (`rows`, `columns`, `header`,
|
|
23
|
+
`totals`, `children`) plus `title` and `landscape`. It resolves when printing is over. The
|
|
24
|
+
printing code loads on first use (1.1 kB gzip); the export feature grows by 0.2 kB gzip. New
|
|
25
|
+
exported type `PrintOptions`.
|
|
26
|
+
|
|
27
|
+
## 0.6.0 — 2026-11-24
|
|
28
|
+
|
|
29
|
+
**Excel export** (export feature): `grid.exportXlsx()` downloads the rows as an `.xlsx` workbook
|
|
30
|
+
and `grid.getXlsx()` resolves to it as a `Blob`. They take the CSV options (which rows, columns,
|
|
31
|
+
raw or formatted values, header, totals, sub-grid rows) plus `sheetName`. Cells are typed:
|
|
32
|
+
numbers, booleans and dates stay what they are, so the sheet can sum and sort them, with number
|
|
33
|
+
formats from the columns' renderers (money `#,##0.00`, percentages, `yyyy-mm-dd` dates and date-
|
|
34
|
+
times in the grid's time zone). The header is bold and frozen, the totals line bold, and column
|
|
35
|
+
widths follow the content. Text is never written as a formula. The writer has no dependencies and
|
|
36
|
+
loads the first time you export (2.9 kB gzip); the export feature itself grows by 0.3 kB gzip.
|
|
37
|
+
`toXlsx(rows, columns)` writes a workbook without a grid. New exported types `XlsxExportOptions`,
|
|
38
|
+
`ToXlsxOptions`, `XlsxFormat`.
|
|
39
|
+
|
|
3
40
|
## 0.5.0 — 2026-11-24
|
|
4
41
|
|
|
5
42
|
**Status bar** (`statusBarFeature`): `status-bar` adds a bar under the grid with the rows that pass
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @nocopypaste/vue-grid
|
|
2
2
|
|
|
3
|
+
[](https://eboye.github.io/eboye-vue-grid/) — every feature running live, with its source.
|
|
4
|
+
|
|
3
5
|
A data grid for Vue 3 built on **CSS Grid** — with real `subgrid` sub-rows, pinned columns, column
|
|
4
6
|
reorder/visibility with persistence, selection, virtual scrolling, pagination, a pluggable
|
|
5
7
|
**cell-renderer registry** for 3rd-party addons, and a theme you customise with **CSS variables**.
|
|
@@ -130,7 +132,7 @@ an opt-in feature:
|
|
|
130
132
|
| `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 |
|
|
131
133
|
| `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
|
|
132
134
|
| `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 |
|
|
133
|
-
| `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable`
|
|
135
|
+
| `exportFeature` | `exportCsv()` / `getCsv()`, `exportXlsx()` / `getXlsx()` (Excel, typed cells), `print()` (every row, header on each page), `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
|
|
134
136
|
| `statusBarFeature` | `status-bar`: a bar under the grid with the rows that pass the filters, the selected rows, the active filters (with Clear), and `{ summary: [keys] }` columns' sum and average over the selected rows; the `#status-bar` slot |
|
|
135
137
|
|
|
136
138
|
```ts
|
|
@@ -175,33 +177,33 @@ what you import.
|
|
|
175
177
|
|
|
176
178
|
| Import (minified / gzip, Vue excluded) | Initial chunk |
|
|
177
179
|
| ---------------------------------------------------------------------------- | ------------------ |
|
|
178
|
-
| `VGrid` (no features) | 40.
|
|
179
|
-
| `VGrid` + `sortingFeature` | 41.
|
|
180
|
-
| `VGrid` + `filteringFeature` |
|
|
181
|
-
| `VGrid` + `serverDataFeature` | 41.
|
|
182
|
-
| `VGrid` + `paginationFeature` | 40.
|
|
183
|
-
| `VGrid` + `selectionFeature` | 44.
|
|
184
|
-
| `VGrid` + `subGridsFeature` | 42.
|
|
185
|
-
| `VGrid` + `menusFeature` | 50.
|
|
186
|
-
| `VGrid` + `columnReorderFeature` | 44.
|
|
187
|
-
| `VGrid` + `columnPinningFeature` | 43.
|
|
188
|
-
| `VGrid` + `virtualScrollingFeature` | 46.
|
|
189
|
-
| `VGrid` + `columnVisibilityFeature` | 40.
|
|
190
|
-
| `VGrid` + `keyboardNavigationFeature` | 43.
|
|
191
|
-
| `VGrid` + `columnResizingFeature` | 43.
|
|
192
|
-
| `VGrid` + `columnGroupsFeature` | 41.
|
|
193
|
-
| `VGrid` + `rowPinningFeature` | 45.
|
|
194
|
-
| `VGrid` + `aggregationFeature` | 45.
|
|
195
|
-
| `VGrid` + `rowGroupingFeature` | 50.
|
|
196
|
-
| `VGrid` + `exportFeature` |
|
|
197
|
-
| `VGrid` + `statusBarFeature` | 42.
|
|
198
|
-
| `VGrid` + `allFeatures` + `VGridSearch` |
|
|
199
|
-
| `VGrid` + `currencyRenderer` | 41.
|
|
200
|
-
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 47.
|
|
180
|
+
| `VGrid` (no features) | 40.5 kB / 14.1 kB |
|
|
181
|
+
| `VGrid` + `sortingFeature` | 41.2 kB / 14.4 kB |
|
|
182
|
+
| `VGrid` + `filteringFeature` | 51.1 kB / 17.8 kB |
|
|
183
|
+
| `VGrid` + `serverDataFeature` | 41.8 kB / 14.7 kB |
|
|
184
|
+
| `VGrid` + `paginationFeature` | 40.6 kB / 14.1 kB |
|
|
185
|
+
| `VGrid` + `selectionFeature` | 44.6 kB / 15.5 kB |
|
|
186
|
+
| `VGrid` + `subGridsFeature` | 42.8 kB / 14.9 kB |
|
|
187
|
+
| `VGrid` + `menusFeature` | 50.9 kB / 17.6 kB |
|
|
188
|
+
| `VGrid` + `columnReorderFeature` | 44.2 kB / 15.3 kB |
|
|
189
|
+
| `VGrid` + `columnPinningFeature` | 43.4 kB / 15.1 kB |
|
|
190
|
+
| `VGrid` + `virtualScrollingFeature` | 46.2 kB / 16.3 kB |
|
|
191
|
+
| `VGrid` + `columnVisibilityFeature` | 40.6 kB / 14.1 kB |
|
|
192
|
+
| `VGrid` + `keyboardNavigationFeature` | 43.2 kB / 15.1 kB |
|
|
193
|
+
| `VGrid` + `columnResizingFeature` | 43.7 kB / 15.3 kB |
|
|
194
|
+
| `VGrid` + `columnGroupsFeature` | 41.8 kB / 14.5 kB |
|
|
195
|
+
| `VGrid` + `rowPinningFeature` | 45.4 kB / 15.4 kB |
|
|
196
|
+
| `VGrid` + `aggregationFeature` | 45.6 kB / 15.5 kB |
|
|
197
|
+
| `VGrid` + `rowGroupingFeature` | 50.2 kB / 16.9 kB |
|
|
198
|
+
| `VGrid` + `exportFeature` | 45.4 kB / 16.0 kB |
|
|
199
|
+
| `VGrid` + `statusBarFeature` | 42.8 kB / 15.0 kB |
|
|
200
|
+
| `VGrid` + `allFeatures` + `VGridSearch` | 108.1 kB / 36.5 kB |
|
|
201
|
+
| `VGrid` + `currencyRenderer` | 41.9 kB / 14.5 kB |
|
|
202
|
+
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 47.2 kB / 16.3 kB |
|
|
201
203
|
| `sortRows` only | 0.7 kB / 0.4 kB |
|
|
202
204
|
| `toCsv` only | 1.1 kB / 0.6 kB |
|
|
203
|
-
| everything |
|
|
204
|
-
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) |
|
|
205
|
+
| everything | 160.7 kB / 51.5 kB |
|
|
206
|
+
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 70.5 kB / 19.2 kB |
|
|
205
207
|
|
|
206
208
|
With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
|
|
207
209
|
chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
@@ -218,57 +220,60 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
|
|
|
218
220
|
|
|
219
221
|
### Props
|
|
220
222
|
|
|
221
|
-
| Prop | Type | Default
|
|
222
|
-
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
223
|
-
| `rows` | `T[]` | `[]`
|
|
224
|
-
| `features` | `GridFeature[]` | —
|
|
225
|
-
| `dataSource` | `(query, { signal }) => Promise<{ rows, total? }>` | —
|
|
226
|
-
| `columns` | `ColumnDef<T>[]` | —
|
|
227
|
-
| `rowKey` | `keyof T \| (row) => string \| number` | —
|
|
228
|
-
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null`
|
|
229
|
-
| `sortMode` | `'controlled' \| 'client'` | `'controlled'`
|
|
230
|
-
| `v-model:filters` | `FilterState \| null` | `null`
|
|
231
|
-
| `filterMode` | `'client' \| 'controlled'` | `'client'`
|
|
232
|
-
| `filterRow` | `boolean` | `false`
|
|
233
|
-
| `filterStorage` | `string \| FilterStateStorage` | —
|
|
234
|
-
| `noMatchText` | `string` | `
|
|
235
|
-
| `pagination` | `boolean \|
|
|
236
|
-
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25`
|
|
237
|
-
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived
|
|
238
|
-
| `storage` | `string \| ColumnStateStorage` | —
|
|
239
|
-
| `pinnedMaxShare` | `number \| false` | `0.5`
|
|
240
|
-
| `v-model:expanded` | `RowKey[]` | `[]`
|
|
241
|
-
| `subRows` | `(row) => T[] \| undefined` | —
|
|
242
|
-
| `loadSubRows` | `(row) => Promise<T[]>` | —
|
|
243
|
-
| `hasSubRows` | `(row) => boolean` | —
|
|
244
|
-
| `rowExpandable` | `(row) => boolean` | —
|
|
245
|
-
| `selectable` | `boolean \| 'single'` | `false`
|
|
246
|
-
| `v-model:selected` | `RowKey[]` | `[]`
|
|
247
|
-
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'`
|
|
248
|
-
| `isRowSelectable` | `(row) => boolean` | —
|
|
249
|
-
| `pruneSelection` | `boolean` | `false`
|
|
250
|
-
| `v-model:selectAllMatching` | `boolean` | `false`
|
|
251
|
-
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false`
|
|
252
|
-
| `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null`
|
|
253
|
-
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | —
|
|
254
|
-
| `totals` | `boolean \| 'top' \| 'bottom'` | `false`
|
|
255
|
-
| `totalsLabel` | `string` | `
|
|
256
|
-
| `aggregates` | `Record<string, unknown>` | —
|
|
257
|
-
| `v-model:groupBy` | `string[] \| string \| null` | `null`
|
|
258
|
-
| `groupsExpanded` | `boolean` | `false`
|
|
259
|
-
| `rowClickable` | `boolean` | `false`
|
|
260
|
-
| `rowClass` | `(row, index) => ClassValue` | —
|
|
261
|
-
| `highlightedRows` | `RowKey[]` | —
|
|
262
|
-
| `flash` | `boolean \| 'direction'` | `false`
|
|
263
|
-
| `renderers` | `CellRendererDefinition[]` | —
|
|
264
|
-
| `locale` / `currency` / `timeZone` | `string` | plugin → browser
|
|
265
|
-
| `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'`
|
|
266
|
-
| `loading` | `boolean` | `false`
|
|
267
|
-
| `emptyText` | `string` | `
|
|
268
|
-
| `ariaLabel` | `string` | —
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
271
|
-
| `
|
|
223
|
+
| Prop | Type | Default | |
|
|
224
|
+
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
225
|
+
| `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
|
|
226
|
+
| `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
|
|
227
|
+
| `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). |
|
|
228
|
+
| `columns` | `ColumnDef<T>[]` | — | See below. |
|
|
229
|
+
| `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
|
|
230
|
+
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
|
|
231
|
+
| `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
|
|
232
|
+
| `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
|
|
233
|
+
| `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
|
|
234
|
+
| `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
|
|
235
|
+
| `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
|
|
236
|
+
| `noMatchText` | `string` | `messages.noMatch` | Shown, with a _Clear filters_ button, when filters hide every row (`No rows match the current filters.`). |
|
|
237
|
+
| `pagination` | `boolean \| PaginationOptions` | `false` | The built-in pager (pagination feature): `{ pageSizes, siblings, summary, firstLast }`. |
|
|
238
|
+
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
|
|
239
|
+
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
|
|
240
|
+
| `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
|
|
241
|
+
| `pinnedMaxShare` | `number \| false` | `0.5` | Pinned columns scroll like the others while together they'd take more than this share of the grid's width (a phone, a narrow panel), and pin again once there's room. `false`: always pinned. Needs `columnPinningFeature`. |
|
|
242
|
+
| `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
|
|
243
|
+
| `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
|
|
244
|
+
| `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
|
|
245
|
+
| `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
|
|
246
|
+
| `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
|
|
247
|
+
| `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
|
|
248
|
+
| `v-model:selected` | `RowKey[]` | `[]` | |
|
|
249
|
+
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
|
|
250
|
+
| `isRowSelectable` | `(row) => boolean` | — | |
|
|
251
|
+
| `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
|
|
252
|
+
| `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
|
|
253
|
+
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
|
|
254
|
+
| `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). |
|
|
255
|
+
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
|
|
256
|
+
| `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
|
|
257
|
+
| `totalsLabel` | `string` | `messages.total` | Shown in the totals row's first column (unless that column has an aggregate). `Total` by default. |
|
|
258
|
+
| `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
|
|
259
|
+
| `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). |
|
|
260
|
+
| `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
|
|
261
|
+
| `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
|
|
262
|
+
| `rowClass` | `(row, index) => ClassValue` | — | |
|
|
263
|
+
| `highlightedRows` | `RowKey[]` | — | |
|
|
264
|
+
| `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
|
|
265
|
+
| `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
|
|
266
|
+
| `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
|
|
267
|
+
| `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
|
|
268
|
+
| `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
|
|
269
|
+
| `emptyText` | `string` | `messages.empty` | Shown when there are no rows (`No data to show.`). |
|
|
270
|
+
| `ariaLabel` | `string` | — | |
|
|
271
|
+
| `statusBar` | `boolean \| StatusBarOptions` | `false` | A status bar under the grid (status bar feature): counts, and `{ summary: [keys] }` sums of the selected rows. See [Status bar](#status-bar). |
|
|
272
|
+
| `messages` | `GridMessages` | — | Built-in text (translations, wording), over `createVueGrid({ messages })`. See [Text and parts](#text-and-parts). |
|
|
273
|
+
| `parts` | `GridParts` | — | Built-in parts to leave out (`{ filterButtons: false }`), over `createVueGrid({ parts })`. |
|
|
274
|
+
| `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
|
|
275
|
+
| `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
|
|
276
|
+
| `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
|
|
272
277
|
|
|
273
278
|
### Events
|
|
274
279
|
|
|
@@ -287,7 +292,9 @@ Clicks on links, buttons and inputs inside a cell never trigger `row-click`.
|
|
|
287
292
|
`total-<key>` (`{ value, column, group? }`, a cell of the totals row or a group row) ·
|
|
288
293
|
`group-<key>` (`{ value, count, rows, column, group }`, the value of a group row) · `detail` (`{ row, rowKey, depth }`) ·
|
|
289
294
|
`toolbar` (`{ columns, columnState, setColumnState, filters, setFilters, clearFilters, activeFilterCount, selected, selectedCount, selectAllMatching, clearSelection }`) ·
|
|
290
|
-
`empty` · `loading` · `sub-rows-loading` (`{ row }`)
|
|
295
|
+
`empty` · `loading` · `sub-rows-loading` (`{ row }`) · `no-match` (`{ clearFilters, filterCount }`) ·
|
|
296
|
+
`load-error` (`{ error, retry, stale }`, server data) · `select-all-banner` (`{ total, page, all, selectAll, clearSelection }`) ·
|
|
297
|
+
`status-bar` (`StatusBarScope`).
|
|
291
298
|
|
|
292
299
|
### Exposed methods
|
|
293
300
|
|
|
@@ -863,7 +870,8 @@ same grouping elsewhere.
|
|
|
863
870
|
|
|
864
871
|
## Export and copy
|
|
865
872
|
|
|
866
|
-
`exportFeature` turns the grid's rows into CSV and copies them to
|
|
873
|
+
`exportFeature` turns the grid's rows into CSV or an Excel workbook, prints them, and copies them to
|
|
874
|
+
the clipboard.
|
|
867
875
|
|
|
868
876
|
```vue
|
|
869
877
|
<script setup lang="ts">
|
|
@@ -922,6 +930,45 @@ Without the grid: `toCsv(rows, columns, { delimiter, header, guard })` writes CS
|
|
|
922
930
|
and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(table)`,
|
|
923
931
|
`plainText(value)` and `guardFormula(text)` are its parts.
|
|
924
932
|
|
|
933
|
+
### Excel (.xlsx)
|
|
934
|
+
|
|
935
|
+
**`exportXlsx(options)`** downloads an Excel workbook (`filename`, default `export.xlsx`) and
|
|
936
|
+
**`getXlsx(options)`** resolves to it as a `Blob`; both take the options above (but `delimiter` and
|
|
937
|
+
`guard`) plus `sheetName`.
|
|
938
|
+
|
|
939
|
+
```ts
|
|
940
|
+
await grid.value?.exportXlsx({ filename: 'orders.xlsx', sheetName: 'Orders', totals: true })
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
- **Typed cells**: numbers stay numbers, booleans booleans, and dates are Excel dates, so the sheet
|
|
944
|
+
can sum, sort and filter them. Number formats follow the renderer: `currency` (and `change` with
|
|
945
|
+
`currency`) → `#,##0.00`, a percent `number` → `0.00%`, `date` → `yyyy-mm-dd`, `datetime` →
|
|
946
|
+
`yyyy-mm-dd hh:mm`, in the grid's `time-zone` (date-only values stay that day).
|
|
947
|
+
- A bold header frozen at the top, the totals as a bold last line, column widths from the content.
|
|
948
|
+
- Text is written as text, never as a formula. `values: 'formatted'` writes the cells as shown.
|
|
949
|
+
- The writer (2.9 kB gzip) loads the first time you export; it has no dependencies.
|
|
950
|
+
|
|
951
|
+
Without the grid: `toXlsx(rows, columns, { sheetName, header, timeZone, formats })` returns the
|
|
952
|
+
file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'money'`, `'percent'`,
|
|
953
|
+
`'date'`, `'datetime'`, `'number'`, `'auto'`).
|
|
954
|
+
|
|
955
|
+
### Print
|
|
956
|
+
|
|
957
|
+
**`print(options)`** prints the rows as a table from a hidden frame, with the browser's print
|
|
958
|
+
dialog: every row that passes the filters (not just the ones a virtual grid has in view), sorted,
|
|
959
|
+
as the cells show them. Printing the page itself (Ctrl+P) gives only what is on screen, clipped
|
|
960
|
+
to the grid's frame.
|
|
961
|
+
|
|
962
|
+
```ts
|
|
963
|
+
await grid.value?.print({ title: 'Orders', totals: true, landscape: true })
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
- A real `<table>`: the header repeats on every printed page, numbers and money are
|
|
967
|
+
right-aligned as in the grid, the totals print once, in bold, after the last row.
|
|
968
|
+
- Options: `rows`, `children`, `columns`, `header`, `totals` as for the exports, plus `title`
|
|
969
|
+
(a heading, also the document title) and `landscape`.
|
|
970
|
+
- It resolves when printing is over. The printing code (1.1 kB gzip) loads on first use.
|
|
971
|
+
|
|
925
972
|
## Status bar
|
|
926
973
|
|
|
927
974
|
`statusBarFeature` adds a bar under the grid, like a spreadsheet's:
|
|
@@ -948,6 +995,7 @@ and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(t
|
|
|
948
995
|
(server data) the summary hides: only the loaded page is known.
|
|
949
996
|
- **Your own content**: the `#status-bar` slot gets `{ rowCount, totalRowCount, selectedCount,
|
|
950
997
|
allSelected, filterCount, summary, clearFilters }` and replaces the default content.
|
|
998
|
+
- Leave items out with `rows: false`, `selected: false`, `filters: false` or `clear: false`.
|
|
951
999
|
- The bar is a `group` labelled "Grid status"; style it with `.vg-status-bar`. Its component loads
|
|
952
1000
|
on demand (own chunk).
|
|
953
1001
|
|
|
@@ -1158,6 +1206,56 @@ with `rendererOptions`). Emit `action(name, payload)`; the grid re-emits it as `
|
|
|
1158
1206
|
row and column. `useGridContext()` gives `{ locale, currency, timeZone }`. Lookup order:
|
|
1159
1207
|
a definition or component on the column → `:renderers` → plugin → `text` (the only renderer built in).
|
|
1160
1208
|
|
|
1209
|
+
## Text and parts
|
|
1210
|
+
|
|
1211
|
+
Everything a feature adds is configurable: its text, and whether each piece shows at all.
|
|
1212
|
+
|
|
1213
|
+
**Text.** Every built-in string (menus, filters, the pager, the status bar, notices, screen-reader
|
|
1214
|
+
labels, renderer buttons) has a key in `GridMessages`. Set the ones you need; the rest stay English.
|
|
1215
|
+
Functions get the values that go into the text.
|
|
1216
|
+
|
|
1217
|
+
```ts
|
|
1218
|
+
app.use(
|
|
1219
|
+
createVueGrid({
|
|
1220
|
+
messages: {
|
|
1221
|
+
sortAscending: 'Rastuće',
|
|
1222
|
+
empty: 'Nema podataka.',
|
|
1223
|
+
groupBy: (column) => `Grupiši po: ${column}`,
|
|
1224
|
+
pageSummary: (from, to, total) => `${from}–${to} od ${total}`,
|
|
1225
|
+
rowCount: (shown, total) => (total ? `${shown} od ${total} redova` : `${shown} redova`),
|
|
1226
|
+
},
|
|
1227
|
+
}),
|
|
1228
|
+
)
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
A grid's own `:messages` win over the app's, and props that name a text (`empty-text`,
|
|
1232
|
+
`no-match-text`, `totals-label`, `<VGridSearch placeholder>`, a renderer's `label`…) win over both.
|
|
1233
|
+
`<VGridPagination>`, `<VGridSearch>`, `<VGridColumnMenu>` and `<VGridMenu>` use the app's messages on
|
|
1234
|
+
their own too. Every key, with its English default, is in the API reference (`GridMessages`).
|
|
1235
|
+
|
|
1236
|
+
**Parts.** `GridParts` turns off what a feature adds, each on by default; app-wide in
|
|
1237
|
+
`createVueGrid({ parts })`, per grid with `:parts`:
|
|
1238
|
+
|
|
1239
|
+
| Part | Leaves out |
|
|
1240
|
+
| -------------------- | ---------------------------------------------------------------------------- |
|
|
1241
|
+
| `progressBar` | The thin bar at the top while loading (`aria-busy` stays) |
|
|
1242
|
+
| `loadErrorNotice` | The notice above the rows when a request fails while rows are shown |
|
|
1243
|
+
| `retry` | The Retry buttons of load errors and of lazy children |
|
|
1244
|
+
| `clearFiltersButton` | The Clear filters button of the no-match message |
|
|
1245
|
+
| `selectAll` | The select-all checkbox in the header (rows still select) |
|
|
1246
|
+
| `selectAllBanner` | The "Select all N rows" banner (server data) |
|
|
1247
|
+
| `filterButtons` | The funnels in `filterable` headers (the filter row and search still filter) |
|
|
1248
|
+
| `resizeGrips` | The grips on header edges (Fit width / Reset width stay in the header menu) |
|
|
1249
|
+
| `headerDrag` | Dragging headers to reorder (Alt+←/→ and the header menu still move columns) |
|
|
1250
|
+
| `copyShortcut` | Ctrl/⌘+C copying in the grid (`copyRows()` still works) |
|
|
1251
|
+
| `groupCounts` | The row count on group rows |
|
|
1252
|
+
|
|
1253
|
+
Some parts can be replaced instead: `#load-error`, `#no-match`, `#select-all-banner` and
|
|
1254
|
+
`#status-bar`. The pager takes `pagination: { firstLast: false, summary: '' }`, the status bar
|
|
1255
|
+
`{ rows, selected, filters, clear }` flags. Per column, `sortable`, `filterable`, `resizable`,
|
|
1256
|
+
`reorderable`, `pinnable`, `hideable`, `groupable` and `exportable` work as before, and
|
|
1257
|
+
`header-menu` (`false`, or a function that edits the built-in items) shapes the header menu.
|
|
1258
|
+
|
|
1161
1259
|
## Theming
|
|
1162
1260
|
|
|
1163
1261
|
Override any token on `:root`, a wrapper, or the grid itself:
|