@nocopypaste/vue-grid 0.6.0 → 0.8.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 +33 -24
- package/CHANGELOG.md +44 -0
- package/README.md +214 -79
- package/agent/api.json +68 -10
- package/agent/api.md +17 -7
- package/agent/grid-config.schema.json +15 -11
- package/dist/agent/api.js +66 -10
- package/dist/agent/requirements.js +1 -0
- package/dist/agent/requirements.js.map +1 -1
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +583 -522
- 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 +12 -10
- 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/useDataSource.js +21 -19
- package/dist/composables/useDataSource.js.map +1 -1
- package/dist/composables/useGridExport.js +22 -7
- 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/useRowGrouping.js +103 -74
- package/dist/composables/useRowGrouping.js.map +1 -1
- package/dist/composables/useServerGroups.js +106 -0
- package/dist/composables/useServerGroups.js.map +1 -0
- package/dist/composables/useStatusBar.js +9 -0
- package/dist/composables/useStatusBar.js.map +1 -1
- package/dist/core/grouping.js +41 -24
- package/dist/core/grouping.js.map +1 -1
- package/dist/features/export.js.map +1 -1
- package/dist/features/index.js +12 -10
- package/dist/features/index.js.map +1 -1
- package/dist/features/serverGrouping.js +9 -0
- package/dist/features/serverGrouping.js.map +1 -0
- package/dist/index.js +7 -6
- package/dist/internal/context.js.map +1 -1
- package/dist/internal/features.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/agent/requirements.d.ts +1 -1
- package/dist/types/components/VGrid.vue.d.ts +45 -9
- 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/useDataSource.d.ts +33 -2
- package/dist/types/composables/useGridExport.d.ts +4 -1
- package/dist/types/composables/useGridMenus.d.ts +3 -1
- package/dist/types/composables/useRowGrouping.d.ts +12 -1
- package/dist/types/composables/useServerGroups.d.ts +37 -0
- package/dist/types/composables/useStatusBar.d.ts +7 -0
- package/dist/types/core/grouping.d.ts +26 -0
- package/dist/types/features/export.d.ts +2 -1
- package/dist/types/features/index.d.ts +2 -1
- package/dist/types/features/serverGrouping.d.ts +9 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internal/context.d.ts +5 -1
- package/dist/types/internal/features.d.ts +2 -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 +305 -1
- package/llms-full.txt +264 -110
- package/llms.txt +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -45,30 +45,32 @@ runs in the [live examples](https://eboye.github.io/eboye-vue-grid/), each with
|
|
|
45
45
|
|
|
46
46
|
## Which feature for what
|
|
47
47
|
|
|
48
|
-
| The user wants… | Feature(s)
|
|
49
|
-
| ------------------------------------------------- |
|
|
50
|
-
| Click a header to sort | `sortingFeature`
|
|
51
|
-
| Filters per column, a filter row, quick search | `filteringFeature`
|
|
52
|
-
| Pages | `paginationFeature`
|
|
53
|
-
| Backend sorting / filtering / paging | `serverDataFeature` (+ the above)
|
|
54
|
-
| Checkboxes / row selection, batch actions | `selectionFeature`
|
|
55
|
-
| Nested child rows aligned to the parent's columns | `subGridsFeature`
|
|
56
|
-
| An expandable panel under a row | —
|
|
57
|
-
| 10,000+ rows | `virtualScrollingFeature`
|
|
58
|
-
| Right-click menus (cells, headers) | `menusFeature`
|
|
59
|
-
| Freeze columns left / right | `columnPinningFeature`
|
|
60
|
-
| Show / hide columns | `columnVisibilityFeature`
|
|
61
|
-
| Drag columns to reorder | `columnReorderFeature`
|
|
62
|
-
| Drag column edges to resize | `columnResizingFeature`
|
|
63
|
-
| Grouped headers ("Q1" over three columns) | `columnGroupsFeature`
|
|
64
|
-
| Rows that stay on top / bottom | `rowPinningFeature`
|
|
65
|
-
| A totals row (sum, avg, …) | `aggregationFeature`
|
|
66
|
-
| Group
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
48
|
+
| The user wants… | Feature(s) | Props / column options |
|
|
49
|
+
| ------------------------------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| Click a header to sort | `sortingFeature` | column `sortable: true`; `sort-mode="client"` (or handle `v-model:sort`) |
|
|
51
|
+
| Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
|
|
52
|
+
| Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
|
|
53
|
+
| Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
|
|
54
|
+
| 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` |
|
|
55
|
+
| Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
|
|
56
|
+
| An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
|
|
57
|
+
| 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
|
|
58
|
+
| Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
|
|
59
|
+
| Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`; on narrow grids they scroll unless `pinned-max-share` allows (default half the width) |
|
|
60
|
+
| Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
|
|
61
|
+
| Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
|
|
62
|
+
| Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
|
|
63
|
+
| Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
|
|
64
|
+
| Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
|
|
65
|
+
| A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
|
|
66
|
+
| Group server data across all rows (not the page) | `serverGroupingFeature` (+ `rowGroupingFeature`, `serverDataFeature`) | return `{ groups: [{ value, count, aggregates }], total }` for `query.groupBy` / `query.groupPath`, `{ rows }` at the last level; `v-model:selected-groups` |
|
|
67
|
+
| 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 |
|
|
68
|
+
| Download CSV / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
|
|
69
|
+
| Row / selection counts, sum of the selected rows | `statusBarFeature` | `status-bar` (or `{ summary: ['total'], aggregates?: ['sum', 'avg'] }`); `#status-bar="{ rowCount, selectedCount, summary, … }"` |
|
|
70
|
+
| 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` |
|
|
71
|
+
| Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
|
|
72
|
+
| Remember column layout | — | `storage="orders-grid"` (localStorage key) |
|
|
73
|
+
| Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
|
|
72
74
|
|
|
73
75
|
## Renderers (pick by data)
|
|
74
76
|
|
|
@@ -400,6 +402,8 @@ raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-sep
|
|
|
400
402
|
`header`, `totals`, `children`, `delimiter`. `toCsv(rows, columns)` works without a grid.
|
|
401
403
|
`exportXlsx({ filename, sheetName })` / `getXlsx()` (a Promise) write an Excel file with typed cells
|
|
402
404
|
(numbers, dates, booleans) and number formats from the renderers; `toXlsx(rows, columns)` without a grid.
|
|
405
|
+
`print({ title, totals, landscape })` prints every matching row as a table (header on each page);
|
|
406
|
+
Ctrl+P on the page only prints what is on screen.
|
|
403
407
|
|
|
404
408
|
### Row actions and context menu
|
|
405
409
|
|
|
@@ -512,6 +516,11 @@ only sees stylesheet rules. Density:
|
|
|
512
516
|
- Ctrl+C copies nothing for a clicked cell → cells only take focus with `keyboardNavigationFeature`
|
|
513
517
|
(or select rows first); `exportFeature` must be registered too.
|
|
514
518
|
- An exported column of `⋯` / buttons / `[object Object]` → `exportable: false`, or `exportValue: (row) => …`.
|
|
519
|
+
- Printing the page (Ctrl+P) shows only the rows on screen, clipped to the grid → use `grid.print()`.
|
|
520
|
+
- Translating by replacing components or CSS `content` → set `messages` (every built-in text has a key).
|
|
521
|
+
- Hiding a built-in piece with CSS → `parts: { filterButtons: false, … }` leaves it out of the DOM (and the tab order).
|
|
522
|
+
- Grouped server data shows groups of one page only → add `serverGroupingFeature` and answer `query.groupBy` with `{ groups }` (`count` per group, `total` = number of groups).
|
|
523
|
+
- A batch action on a selected server group touched only loaded rows → act on `selectedGroups` (paths) with the filters on the server.
|
|
515
524
|
- Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
|
|
516
525
|
(CSV exports are raw by default).
|
|
517
526
|
- `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,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 — 2026-11-24
|
|
4
|
+
|
|
5
|
+
**Server-side row grouping** (`serverGroupingFeature`, with `rowGroupingFeature` and
|
|
6
|
+
`serverDataFeature`): a grouped grid with a `data-source` asks the server for groups instead of
|
|
7
|
+
grouping only the rows it has loaded. The query gains `groupBy` and `groupPath`; the source
|
|
8
|
+
answers with `groups: [{ value, count, aggregates }]` (or `rows` at the last level). Only the
|
|
9
|
+
top-level groups load first; expanding a group loads its sub-groups or rows, once, with the
|
|
10
|
+
loading row and error / Retry of lazy sub-grids. `pagination` pages the top-level groups;
|
|
11
|
+
`rowTotal` feeds the status bar. A group's checkbox selects it by query, without loading its
|
|
12
|
+
rows (`v-model:selected-groups`, paths like `[[{ key: 'status', value: 'Won' }]]`); rows inside
|
|
13
|
+
show ticked and locked, the header checkbox selects every top-level group, and the selected groups
|
|
14
|
+
end with a new filter or grouping. Exports cover the loaded rows. Works with virtual scrolling and
|
|
15
|
+
keyboard navigation. New exported types `GroupPath`, `ServerGroup`; group rows gain `count` and
|
|
16
|
+
`path`; `DataSourceResult` gains `groups` and `rowTotal` (`rows` is optional). Without the
|
|
17
|
+
feature, grouped server grids work as before, with a dev hint. Grids without it grow by 0.3 kB
|
|
18
|
+
gzip (the `selected-groups` model and the grouped query), grids with row grouping by 0.6 kB more.
|
|
19
|
+
|
|
20
|
+
Docs: the bundle sizes are measured again. 0.7.0's table was not updated for its own changes:
|
|
21
|
+
a plain grid was 14.5 kB gzip there, not 14.1 (now 14.8).
|
|
22
|
+
|
|
23
|
+
## 0.7.0 — 2026-11-24
|
|
24
|
+
|
|
25
|
+
**Text and parts are configurable.** `messages` (`GridMessages`) replaces any built-in text: menus,
|
|
26
|
+
filters, the pager, the status bar, notices, screen-reader labels and renderer buttons, 112
|
|
27
|
+
keys, functions where a value goes in (`groupBy(column)`, `rowCount(shown, total)`…). `parts`
|
|
28
|
+
(`GridParts`) leaves out pieces a feature adds: the progress bar, the load-error notice, Retry
|
|
29
|
+
buttons, the no-match Clear button, the select-all checkbox and banner, filter funnels, resize
|
|
30
|
+
grips, header dragging, Ctrl/⌘+C and group counts. Both are app-wide in `createVueGrid` or per
|
|
31
|
+
grid, the grid's own winning. New slots replace parts: `#load-error`, `#no-match`,
|
|
32
|
+
`#select-all-banner`. `pagination` takes `{ siblings, summary, firstLast }` too (`PaginationOptions`;
|
|
33
|
+
`<VGridPagination first-last>`), and the status bar `{ rows, selected, filters, clear }` flags.
|
|
34
|
+
`empty-text`, `no-match-text` and `totals-label` now default to `messages`, then English; the
|
|
35
|
+
standalone components' label props to `messages` too. New exported types `GridMessages`,
|
|
36
|
+
`GridParts`, `PaginationOptions`.
|
|
37
|
+
|
|
38
|
+
**Printing** (export feature): `grid.print()` prints the rows as a table from a hidden frame,
|
|
39
|
+
through the browser's print dialog: every row that passes the filters, sorted, on every page (a
|
|
40
|
+
virtual grid included, which only has the rows in view on screen), as the cells show them. The
|
|
41
|
+
header repeats on each printed page, numbers are right-aligned as in the grid, and the totals
|
|
42
|
+
print once, in bold, after the last row. Options: the export ones (`rows`, `columns`, `header`,
|
|
43
|
+
`totals`, `children`) plus `title` and `landscape`. It resolves when printing is over. The
|
|
44
|
+
printing code loads on first use (1.1 kB gzip); the export feature grows by 0.2 kB gzip. New
|
|
45
|
+
exported type `PrintOptions`.
|
|
46
|
+
|
|
3
47
|
## 0.6.0 — 2026-11-24
|
|
4
48
|
|
|
5
49
|
**Excel export** (export feature): `grid.exportXlsx()` downloads the rows as an `.xlsx` workbook
|
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,8 @@ 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
|
-
| `
|
|
135
|
+
| `serverGroupingFeature` | With a `data-source`: groups from the server (`query.groupBy` / `groupPath`), each one's contents loaded on expand, groups selected by query (`v-model:selected-groups`). See [Server-side grouping](#server-side-grouping) |
|
|
136
|
+
| `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
137
|
| `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
138
|
|
|
136
139
|
```ts
|
|
@@ -175,33 +178,34 @@ what you import.
|
|
|
175
178
|
|
|
176
179
|
| Import (minified / gzip, Vue excluded) | Initial chunk |
|
|
177
180
|
| ---------------------------------------------------------------------------- | ------------------ |
|
|
178
|
-
| `VGrid` (no features) |
|
|
179
|
-
| `VGrid` + `sortingFeature` |
|
|
180
|
-
| `VGrid` + `filteringFeature` |
|
|
181
|
-
| `VGrid` + `serverDataFeature` |
|
|
182
|
-
| `VGrid` + `paginationFeature` |
|
|
183
|
-
| `VGrid` + `selectionFeature` |
|
|
184
|
-
| `VGrid` + `subGridsFeature` |
|
|
185
|
-
| `VGrid` + `menusFeature` |
|
|
186
|
-
| `VGrid` + `columnReorderFeature` |
|
|
187
|
-
| `VGrid` + `columnPinningFeature` |
|
|
188
|
-
| `VGrid` + `virtualScrollingFeature` |
|
|
189
|
-
| `VGrid` + `columnVisibilityFeature` |
|
|
190
|
-
| `VGrid` + `keyboardNavigationFeature` |
|
|
191
|
-
| `VGrid` + `columnResizingFeature` |
|
|
192
|
-
| `VGrid` + `columnGroupsFeature` |
|
|
193
|
-
| `VGrid` + `rowPinningFeature` |
|
|
194
|
-
| `VGrid` + `aggregationFeature` |
|
|
195
|
-
| `VGrid` + `rowGroupingFeature` |
|
|
196
|
-
| `VGrid` + `exportFeature` |
|
|
197
|
-
| `VGrid` + `statusBarFeature` |
|
|
198
|
-
| `VGrid` + `
|
|
199
|
-
| `VGrid` + `
|
|
200
|
-
| `VGrid` + `
|
|
181
|
+
| `VGrid` (no features) | 43.1 kB / 14.8 kB |
|
|
182
|
+
| `VGrid` + `sortingFeature` | 43.8 kB / 15.1 kB |
|
|
183
|
+
| `VGrid` + `filteringFeature` | 53.8 kB / 18.6 kB |
|
|
184
|
+
| `VGrid` + `serverDataFeature` | 44.5 kB / 15.4 kB |
|
|
185
|
+
| `VGrid` + `paginationFeature` | 43.2 kB / 14.8 kB |
|
|
186
|
+
| `VGrid` + `selectionFeature` | 47.2 kB / 16.2 kB |
|
|
187
|
+
| `VGrid` + `subGridsFeature` | 45.4 kB / 15.6 kB |
|
|
188
|
+
| `VGrid` + `menusFeature` | 53.9 kB / 18.4 kB |
|
|
189
|
+
| `VGrid` + `columnReorderFeature` | 46.7 kB / 16.0 kB |
|
|
190
|
+
| `VGrid` + `columnPinningFeature` | 46.0 kB / 15.8 kB |
|
|
191
|
+
| `VGrid` + `virtualScrollingFeature` | 48.8 kB / 17.0 kB |
|
|
192
|
+
| `VGrid` + `columnVisibilityFeature` | 43.2 kB / 14.8 kB |
|
|
193
|
+
| `VGrid` + `keyboardNavigationFeature` | 45.8 kB / 15.8 kB |
|
|
194
|
+
| `VGrid` + `columnResizingFeature` | 46.3 kB / 16.0 kB |
|
|
195
|
+
| `VGrid` + `columnGroupsFeature` | 44.4 kB / 15.2 kB |
|
|
196
|
+
| `VGrid` + `rowPinningFeature` | 48.0 kB / 16.1 kB |
|
|
197
|
+
| `VGrid` + `aggregationFeature` | 48.2 kB / 16.2 kB |
|
|
198
|
+
| `VGrid` + `rowGroupingFeature` | 53.8 kB / 18.3 kB |
|
|
199
|
+
| `VGrid` + `exportFeature` | 48.0 kB / 16.7 kB |
|
|
200
|
+
| `VGrid` + `statusBarFeature` | 45.5 kB / 15.7 kB |
|
|
201
|
+
| `VGrid` + `serverGroupingFeature` | 46.2 kB / 15.9 kB |
|
|
202
|
+
| `VGrid` + `allFeatures` + `VGridSearch` | 115.0 kB / 38.6 kB |
|
|
203
|
+
| `VGrid` + `currencyRenderer` | 44.4 kB / 15.2 kB |
|
|
204
|
+
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 50.3 kB / 17.2 kB |
|
|
201
205
|
| `sortRows` only | 0.7 kB / 0.4 kB |
|
|
202
206
|
| `toCsv` only | 1.1 kB / 0.6 kB |
|
|
203
|
-
| everything |
|
|
204
|
-
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) |
|
|
207
|
+
| everything | 168.7 kB / 54.0 kB |
|
|
208
|
+
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 72.9 kB / 19.8 kB |
|
|
205
209
|
|
|
206
210
|
With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
|
|
207
211
|
chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
@@ -218,57 +222,61 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
|
|
|
218
222
|
|
|
219
223
|
### Props
|
|
220
224
|
|
|
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
|
-
| `
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
262
|
-
| `
|
|
263
|
-
| `
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
271
|
-
| `
|
|
225
|
+
| Prop | Type | Default | |
|
|
226
|
+
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
227
|
+
| `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
|
|
228
|
+
| `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
|
|
229
|
+
| `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). |
|
|
230
|
+
| `columns` | `ColumnDef<T>[]` | — | See below. |
|
|
231
|
+
| `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
|
|
232
|
+
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
|
|
233
|
+
| `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
|
|
234
|
+
| `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
|
|
235
|
+
| `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
|
|
236
|
+
| `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
|
|
237
|
+
| `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
|
|
238
|
+
| `noMatchText` | `string` | `messages.noMatch` | Shown, with a _Clear filters_ button, when filters hide every row (`No rows match the current filters.`). |
|
|
239
|
+
| `pagination` | `boolean \| PaginationOptions` | `false` | The built-in pager (pagination feature): `{ pageSizes, siblings, summary, firstLast }`. |
|
|
240
|
+
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
|
|
241
|
+
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
|
|
242
|
+
| `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
|
|
243
|
+
| `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`. |
|
|
244
|
+
| `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
|
|
245
|
+
| `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
|
|
246
|
+
| `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
|
|
247
|
+
| `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
|
|
248
|
+
| `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
|
|
249
|
+
| `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
|
|
250
|
+
| `v-model:selected` | `RowKey[]` | `[]` | |
|
|
251
|
+
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
|
|
252
|
+
| `isRowSelectable` | `(row) => boolean` | — | |
|
|
253
|
+
| `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
|
|
254
|
+
| `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
|
|
255
|
+
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
|
|
256
|
+
| `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). |
|
|
257
|
+
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
|
|
258
|
+
| `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
|
|
259
|
+
| `totalsLabel` | `string` | `messages.total` | Shown in the totals row's first column (unless that column has an aggregate). `Total` by default. |
|
|
260
|
+
| `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
|
|
261
|
+
| `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). |
|
|
262
|
+
| `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
|
|
263
|
+
| `v-model:selectedGroups` | `GroupPath[]` | `[]` | Server-side grouping: groups selected by query, by path (`[[{ key, value }]]`), without their rows. |
|
|
264
|
+
| `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
|
|
265
|
+
| `rowClass` | `(row, index) => ClassValue` | — | |
|
|
266
|
+
| `highlightedRows` | `RowKey[]` | — | |
|
|
267
|
+
| `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
|
|
268
|
+
| `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
|
|
269
|
+
| `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
|
|
270
|
+
| `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
|
|
271
|
+
| `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
|
|
272
|
+
| `emptyText` | `string` | `messages.empty` | Shown when there are no rows (`No data to show.`). |
|
|
273
|
+
| `ariaLabel` | `string` | — | |
|
|
274
|
+
| `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). |
|
|
275
|
+
| `messages` | `GridMessages` | — | Built-in text (translations, wording), over `createVueGrid({ messages })`. See [Text and parts](#text-and-parts). |
|
|
276
|
+
| `parts` | `GridParts` | — | Built-in parts to leave out (`{ filterButtons: false }`), over `createVueGrid({ parts })`. |
|
|
277
|
+
| `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
|
|
278
|
+
| `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
|
|
279
|
+
| `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
|
|
272
280
|
|
|
273
281
|
### Events
|
|
274
282
|
|
|
@@ -287,7 +295,9 @@ Clicks on links, buttons and inputs inside a cell never trigger `row-click`.
|
|
|
287
295
|
`total-<key>` (`{ value, column, group? }`, a cell of the totals row or a group row) ·
|
|
288
296
|
`group-<key>` (`{ value, count, rows, column, group }`, the value of a group row) · `detail` (`{ row, rowKey, depth }`) ·
|
|
289
297
|
`toolbar` (`{ columns, columnState, setColumnState, filters, setFilters, clearFilters, activeFilterCount, selected, selectedCount, selectAllMatching, clearSelection }`) ·
|
|
290
|
-
`empty` · `loading` · `sub-rows-loading` (`{ row }`)
|
|
298
|
+
`empty` · `loading` · `sub-rows-loading` (`{ row }`) · `no-match` (`{ clearFilters, filterCount }`) ·
|
|
299
|
+
`load-error` (`{ error, retry, stale }`, server data) · `select-all-banner` (`{ total, page, all, selectAll, clearSelection }`) ·
|
|
300
|
+
`status-bar` (`StatusBarScope`).
|
|
291
301
|
|
|
292
302
|
### Exposed methods
|
|
293
303
|
|
|
@@ -861,9 +871,66 @@ Style group rows with `.vg-rowgroup` (and `[data-group-level]`), `.vg-rowgroup-n
|
|
|
861
871
|
`--vg-rowgroup-font-weight` tokens. `groupRows()` and `isRowGroup()` are exported for using the
|
|
862
872
|
same grouping elsewhere.
|
|
863
873
|
|
|
874
|
+
### Server-side grouping
|
|
875
|
+
|
|
876
|
+
With a `data-source`, `serverGroupingFeature` groups across all the data on the server instead of
|
|
877
|
+
only the rows the grid has loaded. The query then carries `groupBy` and `groupPath`, and your source
|
|
878
|
+
answers with **groups** instead of rows:
|
|
879
|
+
|
|
880
|
+
```ts
|
|
881
|
+
const source: DataSource<Bet> = async (query, { signal }) => {
|
|
882
|
+
const res = await fetch('/api/bets/search', {
|
|
883
|
+
method: 'POST',
|
|
884
|
+
body: JSON.stringify(query),
|
|
885
|
+
signal,
|
|
886
|
+
})
|
|
887
|
+
return res.json()
|
|
888
|
+
}
|
|
889
|
+
// query.groupBy = ['status', 'city'], query.groupPath = [] → the top-level groups
|
|
890
|
+
// { groups: [{ value: 'Won', count: 1204, aggregates: { stake: 98211.5 } }, …], total: 4 }
|
|
891
|
+
// query.groupPath = [{ key: 'status', value: 'Won' }] → the groups inside "Won"
|
|
892
|
+
// { groups: [{ value: 'Niš', count: 310, aggregates: { … } }, …] }
|
|
893
|
+
// query.groupPath = [{ key: 'status', value: 'Won' }, { key: 'city', value: 'Niš' }]
|
|
894
|
+
// → the last level: { rows: [ …310 rows… ] }
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
```vue
|
|
898
|
+
<VGrid
|
|
899
|
+
v-model:group-by="groupBy"
|
|
900
|
+
v-model:selected="selected"
|
|
901
|
+
v-model:selected-groups="selectedGroups"
|
|
902
|
+
:data-source="source"
|
|
903
|
+
:columns="columns"
|
|
904
|
+
row-key="id"
|
|
905
|
+
selectable
|
|
906
|
+
:features="[serverDataFeature, rowGroupingFeature, serverGroupingFeature, selectionFeature]"
|
|
907
|
+
/>
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
- **Lazy.** The first request returns only the top-level groups (`value`, `count`, `aggregates`).
|
|
911
|
+
Expanding a group asks for its sub-groups, or at the last level all its rows; a level loads
|
|
912
|
+
once, with a loading row meanwhile and the error and Retry of lazy sub-grids when it fails
|
|
913
|
+
(`load-error` fires). Requests for a group carry the current sort and filters, `page: 1`,
|
|
914
|
+
`pageSize: null`.
|
|
915
|
+
- **Paging.** `pagination` pages the top-level groups: return their number as `total`. Return
|
|
916
|
+
`rowTotal` (every matching row) for the status bar; without it the groups' counts are added up.
|
|
917
|
+
- **Sort, filters, page.** A new query asks for the top-level groups again; open groups load their
|
|
918
|
+
contents again.
|
|
919
|
+
- **Selection by query.** A group's checkbox selects it by its path in `v-model:selected-groups`
|
|
920
|
+
(`[[{ key: 'status', value: 'Won' }]]`), without loading its rows; rows and sub-groups inside a
|
|
921
|
+
selected group show ticked and locked. The header checkbox selects every top-level group. Act on
|
|
922
|
+
`selectedGroups` + `selected` + the filters on the server. The selected groups end when the
|
|
923
|
+
filters or the grouping change, or with `clearSelection()`; the status bar and the toolbar's
|
|
924
|
+
`selectedCount` add their counts.
|
|
925
|
+
- **Export, print, totals.** `exportCsv()`, `print()` and the others cover the rows that are loaded.
|
|
926
|
+
For the totals row pass `aggregates` (the server's totals).
|
|
927
|
+
- Without the feature, a grouped grid with a data source groups only the rows it has loaded (with
|
|
928
|
+
a dev warning). A source that returns `rows` to a grouped query gets the same.
|
|
929
|
+
|
|
864
930
|
## Export and copy
|
|
865
931
|
|
|
866
|
-
`exportFeature` turns the grid's rows into CSV or an Excel workbook and copies them to
|
|
932
|
+
`exportFeature` turns the grid's rows into CSV or an Excel workbook, prints them, and copies them to
|
|
933
|
+
the clipboard.
|
|
867
934
|
|
|
868
935
|
```vue
|
|
869
936
|
<script setup lang="ts">
|
|
@@ -944,6 +1011,23 @@ Without the grid: `toXlsx(rows, columns, { sheetName, header, timeZone, formats
|
|
|
944
1011
|
file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'money'`, `'percent'`,
|
|
945
1012
|
`'date'`, `'datetime'`, `'number'`, `'auto'`).
|
|
946
1013
|
|
|
1014
|
+
### Print
|
|
1015
|
+
|
|
1016
|
+
**`print(options)`** prints the rows as a table from a hidden frame, with the browser's print
|
|
1017
|
+
dialog: every row that passes the filters (not just the ones a virtual grid has in view), sorted,
|
|
1018
|
+
as the cells show them. Printing the page itself (Ctrl+P) gives only what is on screen, clipped
|
|
1019
|
+
to the grid's frame.
|
|
1020
|
+
|
|
1021
|
+
```ts
|
|
1022
|
+
await grid.value?.print({ title: 'Orders', totals: true, landscape: true })
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
- A real `<table>`: the header repeats on every printed page, numbers and money are
|
|
1026
|
+
right-aligned as in the grid, the totals print once, in bold, after the last row.
|
|
1027
|
+
- Options: `rows`, `children`, `columns`, `header`, `totals` as for the exports, plus `title`
|
|
1028
|
+
(a heading, also the document title) and `landscape`.
|
|
1029
|
+
- It resolves when printing is over. The printing code (1.1 kB gzip) loads on first use.
|
|
1030
|
+
|
|
947
1031
|
## Status bar
|
|
948
1032
|
|
|
949
1033
|
`statusBarFeature` adds a bar under the grid, like a spreadsheet's:
|
|
@@ -970,6 +1054,7 @@ file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'mon
|
|
|
970
1054
|
(server data) the summary hides: only the loaded page is known.
|
|
971
1055
|
- **Your own content**: the `#status-bar` slot gets `{ rowCount, totalRowCount, selectedCount,
|
|
972
1056
|
allSelected, filterCount, summary, clearFilters }` and replaces the default content.
|
|
1057
|
+
- Leave items out with `rows: false`, `selected: false`, `filters: false` or `clear: false`.
|
|
973
1058
|
- The bar is a `group` labelled "Grid status"; style it with `.vg-status-bar`. Its component loads
|
|
974
1059
|
on demand (own chunk).
|
|
975
1060
|
|
|
@@ -1180,6 +1265,56 @@ with `rendererOptions`). Emit `action(name, payload)`; the grid re-emits it as `
|
|
|
1180
1265
|
row and column. `useGridContext()` gives `{ locale, currency, timeZone }`. Lookup order:
|
|
1181
1266
|
a definition or component on the column → `:renderers` → plugin → `text` (the only renderer built in).
|
|
1182
1267
|
|
|
1268
|
+
## Text and parts
|
|
1269
|
+
|
|
1270
|
+
Everything a feature adds is configurable: its text, and whether each piece shows at all.
|
|
1271
|
+
|
|
1272
|
+
**Text.** Every built-in string (menus, filters, the pager, the status bar, notices, screen-reader
|
|
1273
|
+
labels, renderer buttons) has a key in `GridMessages`. Set the ones you need; the rest stay English.
|
|
1274
|
+
Functions get the values that go into the text.
|
|
1275
|
+
|
|
1276
|
+
```ts
|
|
1277
|
+
app.use(
|
|
1278
|
+
createVueGrid({
|
|
1279
|
+
messages: {
|
|
1280
|
+
sortAscending: 'Rastuće',
|
|
1281
|
+
empty: 'Nema podataka.',
|
|
1282
|
+
groupBy: (column) => `Grupiši po: ${column}`,
|
|
1283
|
+
pageSummary: (from, to, total) => `${from}–${to} od ${total}`,
|
|
1284
|
+
rowCount: (shown, total) => (total ? `${shown} od ${total} redova` : `${shown} redova`),
|
|
1285
|
+
},
|
|
1286
|
+
}),
|
|
1287
|
+
)
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
A grid's own `:messages` win over the app's, and props that name a text (`empty-text`,
|
|
1291
|
+
`no-match-text`, `totals-label`, `<VGridSearch placeholder>`, a renderer's `label`…) win over both.
|
|
1292
|
+
`<VGridPagination>`, `<VGridSearch>`, `<VGridColumnMenu>` and `<VGridMenu>` use the app's messages on
|
|
1293
|
+
their own too. Every key, with its English default, is in the API reference (`GridMessages`).
|
|
1294
|
+
|
|
1295
|
+
**Parts.** `GridParts` turns off what a feature adds, each on by default; app-wide in
|
|
1296
|
+
`createVueGrid({ parts })`, per grid with `:parts`:
|
|
1297
|
+
|
|
1298
|
+
| Part | Leaves out |
|
|
1299
|
+
| -------------------- | ---------------------------------------------------------------------------- |
|
|
1300
|
+
| `progressBar` | The thin bar at the top while loading (`aria-busy` stays) |
|
|
1301
|
+
| `loadErrorNotice` | The notice above the rows when a request fails while rows are shown |
|
|
1302
|
+
| `retry` | The Retry buttons of load errors and of lazy children |
|
|
1303
|
+
| `clearFiltersButton` | The Clear filters button of the no-match message |
|
|
1304
|
+
| `selectAll` | The select-all checkbox in the header (rows still select) |
|
|
1305
|
+
| `selectAllBanner` | The "Select all N rows" banner (server data) |
|
|
1306
|
+
| `filterButtons` | The funnels in `filterable` headers (the filter row and search still filter) |
|
|
1307
|
+
| `resizeGrips` | The grips on header edges (Fit width / Reset width stay in the header menu) |
|
|
1308
|
+
| `headerDrag` | Dragging headers to reorder (Alt+←/→ and the header menu still move columns) |
|
|
1309
|
+
| `copyShortcut` | Ctrl/⌘+C copying in the grid (`copyRows()` still works) |
|
|
1310
|
+
| `groupCounts` | The row count on group rows |
|
|
1311
|
+
|
|
1312
|
+
Some parts can be replaced instead: `#load-error`, `#no-match`, `#select-all-banner` and
|
|
1313
|
+
`#status-bar`. The pager takes `pagination: { firstLast: false, summary: '' }`, the status bar
|
|
1314
|
+
`{ rows, selected, filters, clear }` flags. Per column, `sortable`, `filterable`, `resizable`,
|
|
1315
|
+
`reorderable`, `pinnable`, `hideable`, `groupable` and `exportable` work as before, and
|
|
1316
|
+
`header-menu` (`false`, or a function that edits the built-in items) shapes the header menu.
|
|
1317
|
+
|
|
1183
1318
|
## Theming
|
|
1184
1319
|
|
|
1185
1320
|
Override any token on `:root`, a wrapper, or the grid itself:
|