@nocopypaste/vue-grid 0.6.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.
Files changed (88) hide show
  1. package/AGENTS.md +7 -1
  2. package/CHANGELOG.md +24 -0
  3. package/README.md +143 -67
  4. package/agent/api.json +51 -9
  5. package/agent/api.md +14 -6
  6. package/agent/grid-config.schema.json +9 -11
  7. package/dist/agent/api.js +51 -9
  8. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +545 -520
  9. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  10. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +4 -3
  11. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  12. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js +58 -53
  13. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  14. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js +50 -49
  15. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +151 -146
  17. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js +44 -43
  19. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +10 -8
  21. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +62 -57
  23. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  24. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js +59 -58
  25. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +62 -55
  27. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js +1 -1
  29. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +60 -59
  31. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  32. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js +27 -26
  33. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  34. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +12 -11
  35. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  36. package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js +37 -30
  37. package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  38. package/dist/composables/useGridExport.js +21 -6
  39. package/dist/composables/useGridExport.js.map +1 -1
  40. package/dist/composables/useGridMenus.js +41 -41
  41. package/dist/composables/useGridMenus.js.map +1 -1
  42. package/dist/composables/useStatusBar.js +9 -0
  43. package/dist/composables/useStatusBar.js.map +1 -1
  44. package/dist/features/export.js.map +1 -1
  45. package/dist/internal/context.js.map +1 -1
  46. package/dist/internal/messages.js +20 -0
  47. package/dist/internal/messages.js.map +1 -0
  48. package/dist/internal/print.js +51 -0
  49. package/dist/internal/print.js.map +1 -0
  50. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js +31 -30
  51. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  52. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js +28 -27
  53. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  54. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js +22 -21
  55. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  56. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js +37 -36
  57. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  58. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js +16 -15
  59. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  60. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js +19 -18
  61. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  62. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js +21 -20
  63. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  64. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js +21 -20
  65. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  66. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js +18 -17
  67. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js +35 -34
  69. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  70. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js +19 -18
  71. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/types/components/VGrid.vue.d.ts +34 -7
  73. package/dist/types/components/VGridColumnMenu.vue.d.ts +4 -5
  74. package/dist/types/components/VGridMenu.vue.d.ts +1 -1
  75. package/dist/types/components/VGridPagination.vue.d.ts +8 -3
  76. package/dist/types/components/VGridSearch.vue.d.ts +2 -2
  77. package/dist/types/composables/useGridExport.d.ts +2 -1
  78. package/dist/types/composables/useGridMenus.d.ts +3 -1
  79. package/dist/types/composables/useStatusBar.d.ts +7 -0
  80. package/dist/types/features/export.d.ts +2 -1
  81. package/dist/types/internal/context.d.ts +5 -1
  82. package/dist/types/internal/messages.d.ts +16 -0
  83. package/dist/types/internal/print.d.ts +16 -0
  84. package/dist/types/renderers/parts/CopyButton.vue.d.ts +1 -3
  85. package/dist/types/types.d.ts +300 -0
  86. package/llms-full.txt +164 -74
  87. package/llms.txt +1 -1
  88. 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 or Excel, copy rows / cells (Ctrl+C) | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
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) |
@@ -400,6 +401,8 @@ raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-sep
400
401
  `header`, `totals`, `children`, `delimiter`. `toCsv(rows, columns)` works without a grid.
401
402
  `exportXlsx({ filename, sheetName })` / `getXlsx()` (a Promise) write an Excel file with typed cells
402
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.
403
406
 
404
407
  ### Row actions and context menu
405
408
 
@@ -512,6 +515,9 @@ only sees stylesheet rules. Density:
512
515
  - Ctrl+C copies nothing for a clicked cell → cells only take focus with `keyboardNavigationFeature`
513
516
  (or select rows first); `exportFeature` must be registered too.
514
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).
515
521
  - Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
516
522
  (CSV exports are raw by default).
517
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,29 @@
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
+
3
27
  ## 0.6.0 — 2026-11-24
4
28
 
5
29
  **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
+ [![Live demo](https://img.shields.io/badge/live_demo-eboye.github.io-2563eb?logo=googlechrome&logoColor=white)](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()`, `exportXlsx()` / `getXlsx()` (Excel, typed cells), `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.4 kB / 14.1 kB |
179
- | `VGrid` + `sortingFeature` | 41.2 kB / 14.3 kB |
180
- | `VGrid` + `filteringFeature` | 51.0 kB / 17.8 kB |
181
- | `VGrid` + `serverDataFeature` | 41.8 kB / 14.6 kB |
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 |
182
184
  | `VGrid` + `paginationFeature` | 40.6 kB / 14.1 kB |
183
185
  | `VGrid` + `selectionFeature` | 44.6 kB / 15.5 kB |
184
186
  | `VGrid` + `subGridsFeature` | 42.8 kB / 14.9 kB |
185
187
  | `VGrid` + `menusFeature` | 50.9 kB / 17.6 kB |
186
- | `VGrid` + `columnReorderFeature` | 44.1 kB / 15.3 kB |
188
+ | `VGrid` + `columnReorderFeature` | 44.2 kB / 15.3 kB |
187
189
  | `VGrid` + `columnPinningFeature` | 43.4 kB / 15.1 kB |
188
- | `VGrid` + `virtualScrollingFeature` | 46.2 kB / 16.2 kB |
190
+ | `VGrid` + `virtualScrollingFeature` | 46.2 kB / 16.3 kB |
189
191
  | `VGrid` + `columnVisibilityFeature` | 40.6 kB / 14.1 kB |
190
192
  | `VGrid` + `keyboardNavigationFeature` | 43.2 kB / 15.1 kB |
191
- | `VGrid` + `columnResizingFeature` | 43.7 kB / 15.2 kB |
192
- | `VGrid` + `columnGroupsFeature` | 41.7 kB / 14.5 kB |
193
+ | `VGrid` + `columnResizingFeature` | 43.7 kB / 15.3 kB |
194
+ | `VGrid` + `columnGroupsFeature` | 41.8 kB / 14.5 kB |
193
195
  | `VGrid` + `rowPinningFeature` | 45.4 kB / 15.4 kB |
194
196
  | `VGrid` + `aggregationFeature` | 45.6 kB / 15.5 kB |
195
197
  | `VGrid` + `rowGroupingFeature` | 50.2 kB / 16.9 kB |
196
- | `VGrid` + `exportFeature` | 45.0 kB / 15.8 kB |
198
+ | `VGrid` + `exportFeature` | 45.4 kB / 16.0 kB |
197
199
  | `VGrid` + `statusBarFeature` | 42.8 kB / 15.0 kB |
198
- | `VGrid` + `allFeatures` + `VGridSearch` | 107.7 kB / 36.3 kB |
199
- | `VGrid` + `currencyRenderer` | 41.8 kB / 14.5 kB |
200
+ | `VGrid` + `allFeatures` + `VGridSearch` | 108.1 kB / 36.5 kB |
201
+ | `VGrid` + `currencyRenderer` | 41.9 kB / 14.5 kB |
200
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 | 160.4 kB / 51.3 kB |
204
- | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 70.2 kB / 19.1 kB |
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[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
224
- | `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
225
- | `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). |
226
- | `columns` | `ColumnDef<T>[]` | — | See below. |
227
- | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
228
- | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
229
- | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
230
- | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
231
- | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
232
- | `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
233
- | `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
234
- | `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a _Clear filters_ button, when filters hide every row. |
235
- | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
236
- | `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
237
- | `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
238
- | `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
239
- | `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`. |
240
- | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
241
- | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
242
- | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
243
- | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
244
- | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
245
- | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
246
- | `v-model:selected` | `RowKey[]` | `[]` | |
247
- | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
248
- | `isRowSelectable` | `(row) => boolean` | — | |
249
- | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
250
- | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
251
- | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
252
- | `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). |
253
- | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
254
- | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
255
- | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
256
- | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
257
- | `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). |
258
- | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
259
- | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
260
- | `rowClass` | `(row, index) => ClassValue` | — | |
261
- | `highlightedRows` | `RowKey[]` | — | |
262
- | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
263
- | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
264
- | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
265
- | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
266
- | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
267
- | `emptyText` | `string` | `'No data to show.'` | |
268
- | `ariaLabel` | `string` | — | |
269
- | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
270
- | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
271
- | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
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 or an Excel workbook and copies them to the clipboard.
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">
@@ -944,6 +952,23 @@ Without the grid: `toXlsx(rows, columns, { sheetName, header, timeZone, formats
944
952
  file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'money'`, `'percent'`,
945
953
  `'date'`, `'datetime'`, `'number'`, `'auto'`).
946
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
+
947
972
  ## Status bar
948
973
 
949
974
  `statusBarFeature` adds a bar under the grid, like a spreadsheet's:
@@ -970,6 +995,7 @@ file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'mon
970
995
  (server data) the summary hides: only the loaded page is known.
971
996
  - **Your own content**: the `#status-bar` slot gets `{ rowCount, totalRowCount, selectedCount,
972
997
  allSelected, filterCount, summary, clearFilters }` and replaces the default content.
998
+ - Leave items out with `rows: false`, `selected: false`, `filters: false` or `clear: false`.
973
999
  - The bar is a `group` labelled "Grid status"; style it with `.vg-status-bar`. Its component loads
974
1000
  on demand (own chunk).
975
1001
 
@@ -1180,6 +1206,56 @@ with `rendererOptions`). Emit `action(name, payload)`; the grid re-emits it as `
1180
1206
  row and column. `useGridContext()` gives `{ locale, currency, timeZone }`. Lookup order:
1181
1207
  a definition or component on the column → `:renderers` → plugin → `text` (the only renderer built in).
1182
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
+
1183
1259
  ## Theming
1184
1260
 
1185
1261
  Override any token on `:root`, a wrapper, or the grid itself:
package/agent/api.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@nocopypaste/vue-grid",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "component": "VGrid",
5
5
  "props": [
6
6
  {
@@ -37,7 +37,7 @@
37
37
  },
38
38
  {
39
39
  "name": "pagination",
40
- "type": "boolean | { pageSizes?: number[] }",
40
+ "type": "boolean | PaginationOptions",
41
41
  "required": false,
42
42
  "default": "false",
43
43
  "description": "Built-in pagination under the grid (server-side with `dataSource`, client-side otherwise).",
@@ -50,6 +50,18 @@
50
50
  "description": "A status bar under the grid (status bar feature): rows that pass the filters (\"84 of 200 rows\"), selected rows, active filters with Clear; `{ summary: ['total'] }` adds the sum and average of those columns over the selected rows. `#status-bar` replaces its content.",
51
51
  "feature": "statusBar"
52
52
  },
53
+ {
54
+ "name": "messages",
55
+ "type": "GridMessages",
56
+ "required": false,
57
+ "description": "Built-in text (translations, wording), over `createVueGrid({ messages })`."
58
+ },
59
+ {
60
+ "name": "parts",
61
+ "type": "GridParts",
62
+ "required": false,
63
+ "description": "Built-in parts to leave out (`{ progressBar: false }`), over `createVueGrid({ parts })`."
64
+ },
53
65
  {
54
66
  "name": "sortMode",
55
67
  "type": "'controlled' | 'client'",
@@ -84,8 +96,7 @@
84
96
  "name": "noMatchText",
85
97
  "type": "string",
86
98
  "required": false,
87
- "default": "'No rows match the current filters.'",
88
- "description": "Shown when filters hide every row.",
99
+ "description": "Shown when filters hide every row. Default: `messages.noMatch`, else `No rows match the current filters.`",
89
100
  "feature": "filtering"
90
101
  },
91
102
  {
@@ -234,8 +245,7 @@
234
245
  "name": "emptyText",
235
246
  "type": "string",
236
247
  "required": false,
237
- "default": "'No data to show.'",
238
- "description": "Shown when there are no rows."
248
+ "description": "Shown when there are no rows. Default: `messages.empty`, else `No data to show.`"
239
249
  },
240
250
  {
241
251
  "name": "ariaLabel",
@@ -290,8 +300,7 @@
290
300
  "name": "totalsLabel",
291
301
  "type": "string",
292
302
  "required": false,
293
- "default": "'Total'",
294
- "description": "The totals row's label, in its first column (unless that column has an aggregate).",
303
+ "description": "The totals row's label, in its first column (unless that column has an aggregate). Default: `messages.total`, else `Total`.",
295
304
  "feature": "aggregation"
296
305
  },
297
306
  {
@@ -457,6 +466,21 @@
457
466
  "scope": null,
458
467
  "description": "Shown when there are no rows."
459
468
  },
469
+ {
470
+ "name": "no-match",
471
+ "scope": "{ clearFilters: () => void; filterCount: number }",
472
+ "description": "Shown when filters hide every row, instead of the message and its Clear filters button."
473
+ },
474
+ {
475
+ "name": "load-error",
476
+ "scope": "{ error: unknown; retry: () => Promise<void>; stale: boolean }",
477
+ "description": "A failed server request (server data): `stale` when the rows from before stay on screen (the notice above them), else in place of the rows. `retry()` asks again."
478
+ },
479
+ {
480
+ "name": "select-all-banner",
481
+ "scope": "{ total: number; page: number; all: boolean; selectAll: () => void; clearSelection: () => void }",
482
+ "description": "Selection with server data: the \"Select all N rows\" banner."
483
+ },
460
484
  {
461
485
  "name": "status-bar",
462
486
  "scope": "StatusBarScope",
@@ -586,6 +610,12 @@
586
610
  "required": true,
587
611
  "description": "Downloads the rows as an Excel file (`filename`, default `export.xlsx`). Export feature."
588
612
  },
613
+ {
614
+ "name": "print",
615
+ "type": "Promise<void>",
616
+ "required": true,
617
+ "description": "Prints the rows as a table (the browser's print dialog): the filtered, sorted rows on every page (not just those in view), as the cells show them, the header repeated on each printed page, numbers right-aligned, the totals in bold. Resolves when printing is over. Export feature."
618
+ },
589
619
  {
590
620
  "name": "copyRows",
591
621
  "type": "Promise<boolean>",
@@ -900,7 +930,7 @@
900
930
  {
901
931
  "id": "export",
902
932
  "export": "exportFeature",
903
- "description": "CSV and Excel export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `grid.exportXlsx()` / `grid.getXlsx()` write an Excel workbook with typed cells (the writer loads on demand), `grid.copyRows()` copies rows as tab-separated text, and Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed. Columns can set `exportValue` and `exportable: false`. Without it those methods only warn.",
933
+ "description": "CSV and Excel export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `grid.exportXlsx()` / `grid.getXlsx()` write an Excel workbook with typed cells (the writer loads on demand), `grid.print()` prints every matching row as a table with the header on each page, `grid.copyRows()` copies rows as tab-separated text, and Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed. Columns can set `exportValue` and `exportable: false`. Without it those methods only warn.",
904
934
  "props": [],
905
935
  "columnOptions": [
906
936
  "exportValue",
@@ -2490,6 +2520,18 @@
2490
2520
  "type": "Density",
2491
2521
  "required": false,
2492
2522
  "description": "Default density: `compact`, `cozy` (default) or `comfortable`."
2523
+ },
2524
+ {
2525
+ "name": "messages",
2526
+ "type": "GridMessages",
2527
+ "required": false,
2528
+ "description": "Built-in text for every grid (translations, wording); a grid's own `messages` win."
2529
+ },
2530
+ {
2531
+ "name": "parts",
2532
+ "type": "GridParts",
2533
+ "required": false,
2534
+ "description": "Built-in parts to turn off in every grid; a grid's own `parts` win."
2493
2535
  }
2494
2536
  ]
2495
2537
  }