@nocopypaste/vue-grid 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/AGENTS.md +70 -5
  2. package/CHANGELOG.md +39 -0
  3. package/README.md +198 -33
  4. package/agent/api.json +130 -13
  5. package/agent/api.md +26 -10
  6. package/agent/grid-config.schema.json +50 -5
  7. package/dist/agent/api.js +121 -13
  8. package/dist/agent/requirements.js +12 -3
  9. package/dist/agent/requirements.js.map +1 -1
  10. package/dist/agent/validate.js +6 -2
  11. package/dist/agent/validate.js.map +1 -1
  12. package/dist/base.css +1 -1
  13. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +498 -414
  14. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +1 -1
  16. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js +7 -2
  18. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/VGridGroupCells.js +6 -0
  20. package/dist/components/VGridGroupCells.js.map +1 -0
  21. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +181 -0
  22. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -0
  23. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +69 -56
  24. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
  25. package/dist/components/VGridSelectionBanner.js +6 -0
  26. package/dist/components/VGridSelectionBanner.js.map +1 -0
  27. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +33 -0
  28. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -0
  29. package/dist/composables/useGridExport.js +135 -0
  30. package/dist/composables/useGridExport.js.map +1 -0
  31. package/dist/composables/useGridKeyboard.js +5 -1
  32. package/dist/composables/useGridKeyboard.js.map +1 -1
  33. package/dist/composables/useGridMenus.js +21 -1
  34. package/dist/composables/useGridMenus.js.map +1 -1
  35. package/dist/composables/useGridSelection.js +113 -50
  36. package/dist/composables/useGridSelection.js.map +1 -1
  37. package/dist/composables/useRowGrouping.js +103 -0
  38. package/dist/composables/useRowGrouping.js.map +1 -0
  39. package/dist/composables/useVirtualRows.js +5 -5
  40. package/dist/composables/useVirtualRows.js.map +1 -1
  41. package/dist/core/csv.js +28 -0
  42. package/dist/core/csv.js.map +1 -0
  43. package/dist/core/grouping.js +66 -0
  44. package/dist/core/grouping.js.map +1 -0
  45. package/dist/core.css +1 -1
  46. package/dist/features/export.js +9 -0
  47. package/dist/features/export.js.map +1 -0
  48. package/dist/features/index.js +25 -21
  49. package/dist/features/index.js.map +1 -1
  50. package/dist/features/rowGrouping.js +11 -0
  51. package/dist/features/rowGrouping.js.map +1 -0
  52. package/dist/features/selection.js +5 -3
  53. package/dist/features/selection.js.map +1 -1
  54. package/dist/index.js +55 -51
  55. package/dist/internal/clipboard.js +8 -2
  56. package/dist/internal/clipboard.js.map +1 -1
  57. package/dist/internal/context.js.map +1 -1
  58. package/dist/internal/features.js.map +1 -1
  59. package/dist/renderers/index.js +94 -83
  60. package/dist/renderers/index.js.map +1 -1
  61. package/dist/renderers/plainText.js +34 -0
  62. package/dist/renderers/plainText.js.map +1 -0
  63. package/dist/theme.css +1 -1
  64. package/dist/types/agent/requirements.d.ts +1 -1
  65. package/dist/types/components/VGrid.vue.d.ts +42 -4
  66. package/dist/types/components/VGridCheckbox.vue.d.ts +2 -2
  67. package/dist/types/components/VGridGroupCells.vue.d.ts +14 -0
  68. package/dist/types/components/VGridMenu.vue.d.ts +2 -2
  69. package/dist/types/components/VGridPagination.vue.d.ts +1 -1
  70. package/dist/types/components/VGridSelectionBanner.vue.d.ts +18 -0
  71. package/dist/types/composables/useGridExport.d.ts +49 -0
  72. package/dist/types/composables/useGridMenus.d.ts +8 -0
  73. package/dist/types/composables/useGridSelection.d.ts +26 -2
  74. package/dist/types/composables/useRowGrouping.d.ts +50 -0
  75. package/dist/types/composables/useVirtualRows.d.ts +2 -0
  76. package/dist/types/core/csv.d.ts +25 -0
  77. package/dist/types/core/grouping.d.ts +51 -0
  78. package/dist/types/features/export.d.ts +8 -0
  79. package/dist/types/features/index.d.ts +3 -1
  80. package/dist/types/features/rowGrouping.d.ts +8 -0
  81. package/dist/types/features/selection.d.ts +3 -1
  82. package/dist/types/index.d.ts +2 -0
  83. package/dist/types/internal/clipboard.d.ts +5 -1
  84. package/dist/types/internal/context.d.ts +8 -1
  85. package/dist/types/internal/features.d.ts +3 -1
  86. package/dist/types/renderers/plainText.d.ts +17 -0
  87. package/dist/types/types.d.ts +81 -3
  88. package/dist/vue-grid.css +1 -1
  89. package/llms-full.txt +294 -48
  90. package/llms.txt +1 -1
  91. package/package.json +1 -1
package/agent/api.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@nocopypaste/vue-grid",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "component": "VGrid",
5
5
  "props": [
6
6
  {
@@ -104,6 +104,14 @@
104
104
  "description": "Rows that can't be selected get a disabled checkbox.",
105
105
  "feature": "selection"
106
106
  },
107
+ {
108
+ "name": "pruneSelection",
109
+ "type": "boolean",
110
+ "required": false,
111
+ "default": "false",
112
+ "description": "Drop selected keys whose rows are no longer in the data (after a reload, a delete, a new server page). Default: keys are kept, so a selection can span server pages.",
113
+ "feature": "selection"
114
+ },
107
115
  {
108
116
  "name": "subRows",
109
117
  "type": "(row: T) => T[] | undefined | null",
@@ -277,6 +285,14 @@
277
285
  "required": false,
278
286
  "description": "Totals row values by column key, instead of computing them (e.g. totals from a server).",
279
287
  "feature": "aggregation"
288
+ },
289
+ {
290
+ "name": "groupsExpanded",
291
+ "type": "boolean",
292
+ "required": false,
293
+ "default": "false",
294
+ "description": "Groups start expanded (row grouping feature). Default: collapsed.",
295
+ "feature": "rowGrouping"
280
296
  }
281
297
  ],
282
298
  "models": [
@@ -332,6 +348,20 @@
332
348
  "default": "null",
333
349
  "description": "Top-level rows pinned above / below the body, by key: `{ top, bottom }`. Needs the row pinning feature.",
334
350
  "feature": "rowPinning"
351
+ },
352
+ {
353
+ "name": "groupBy",
354
+ "type": "readonly string[] | string | null",
355
+ "default": "null",
356
+ "description": "Column keys to group the rows by, outermost first (`['region', 'status']`, or one key). Group rows show the value, the row count and the columns' aggregates. Needs the row grouping feature.",
357
+ "feature": "rowGrouping"
358
+ },
359
+ {
360
+ "name": "selectAllMatching",
361
+ "type": "boolean",
362
+ "default": "false",
363
+ "description": "Server data: every row matching the query is selected, not just the loaded ones (set from the \"Select all N rows\" banner; ends when filters change or a row is unticked). Act on the query then, not on `selected`. Needs the selection feature.",
364
+ "feature": "selection"
335
365
  }
336
366
  ],
337
367
  "events": [
@@ -374,6 +404,11 @@
374
404
  "name": "header-action",
375
405
  "payload": "[event: HeaderActionEvent<T>]",
376
406
  "description": "A custom item of the header menu was chosen (built-in items act by themselves)."
407
+ },
408
+ {
409
+ "name": "copy",
410
+ "payload": "[event: CopyEvent<T>]",
411
+ "description": "Rows or a cell were copied to the clipboard (export feature: `copyRows()`, Ctrl/⌘+C)."
377
412
  }
378
413
  ],
379
414
  "slots": [
@@ -389,8 +424,13 @@
389
424
  },
390
425
  {
391
426
  "name": "total-<key>",
392
- "scope": "{ value: unknown; column: ColumnDef<T> }",
393
- "description": "A column's cell in the totals row (aggregation feature)."
427
+ "scope": "{ value: unknown; column: ColumnDef<T>; group?: RowGroup<T> }",
428
+ "description": "A column's cell in the totals row and in group rows (aggregation, row grouping); `group` in group rows."
429
+ },
430
+ {
431
+ "name": "group-<key>",
432
+ "scope": "{ value: unknown; count: number; rows: readonly T[]; column: ColumnDef<T>; group: RowGroup<T> }",
433
+ "description": "The value of a group row grouped by this column (row grouping feature): `#group-<key>`."
394
434
  },
395
435
  {
396
436
  "name": "detail",
@@ -414,8 +454,8 @@
414
454
  },
415
455
  {
416
456
  "name": "toolbar",
417
- "scope": "{ columns: readonly ColumnDef<T>[]; columnState: ColumnState; setColumnState: (state: ColumnState) => void; filters: FilterState; setFilters: (state: FilterState) => void; clearFilters: () => void; activeFilterCount: number }",
418
- "description": "Above the grid: put a search box, column menu or filter summary here."
457
+ "scope": "{ columns: readonly ColumnDef<T>[]; columnState: ColumnState; setColumnState: (state: ColumnState) => void; filters: FilterState; setFilters: (state: FilterState) => void; clearFilters: () => void; activeFilterCount: number; selected: readonly RowKey[]; selectedCount: number; selectAllMatching: boolean; clearSelection: () => void }",
458
+ "description": "Above the grid: put a search box, column menu, filter summary or batch actions here."
419
459
  }
420
460
  ],
421
461
  "methods": [
@@ -453,7 +493,7 @@
453
493
  "name": "patchLoadedRows",
454
494
  "type": "number",
455
495
  "required": true,
456
- "description": "Applies field patches to lazily loaded child rows (`loadSubRows`), which the grid caches and the; app can't reach. Top-level and synchronous `subRows` data belong to the app: update them there (assign fields on reactive rows, or use `patchRows`). Returns the number of rows patched."
496
+ "description": "Applies field patches to lazily loaded child rows (`loadSubRows`), which the grid caches and the app can't reach. Top-level and synchronous `subRows` data belong to the app: update them there (assign fields on reactive rows, or use `patchRows`). Returns the number of rows patched."
457
497
  },
458
498
  {
459
499
  "name": "setFilters",
@@ -495,6 +535,30 @@
495
535
  "required": true,
496
536
  "description": "Pins a top-level row above or below the body, or unpins it (`null`). Row pinning feature.",
497
537
  "feature": "rowPinning"
538
+ },
539
+ {
540
+ "name": "clearSelection",
541
+ "type": "void",
542
+ "required": true,
543
+ "description": "Clears the selection, \"all matching rows\" included. Selection feature."
544
+ },
545
+ {
546
+ "name": "getCsv",
547
+ "type": "string",
548
+ "required": true,
549
+ "description": "The rows as CSV text: the filtered, sorted rows, visible columns, raw values. Export feature."
550
+ },
551
+ {
552
+ "name": "exportCsv",
553
+ "type": "void",
554
+ "required": true,
555
+ "description": "Downloads the rows as a CSV file (`filename`, default `export.csv`; UTF-8 with a BOM). Export feature."
556
+ },
557
+ {
558
+ "name": "copyRows",
559
+ "type": "Promise<boolean>",
560
+ "required": true,
561
+ "description": "Copies rows to the clipboard as tab-separated text (pastes as cells into spreadsheets): the selected rows by default, as displayed, no header. Resolves `false` if nothing was copied. Export feature."
498
562
  }
499
563
  ],
500
564
  "column": [
@@ -570,7 +634,7 @@
570
634
  "name": "group",
571
635
  "type": "string",
572
636
  "required": false,
573
- "description": "Header group label (column groups feature): adjacent visible columns with the same `group`; share one header cell above their own headers.",
637
+ "description": "Header group label (column groups feature): adjacent visible columns with the same `group` share one header cell above their own headers.",
574
638
  "feature": "columnGroups"
575
639
  },
576
640
  {
@@ -693,9 +757,37 @@
693
757
  "name": "aggregate",
694
758
  "type": "AggregateName | AggregateFn<T>",
695
759
  "required": false,
696
- "description": "The column's value in the totals row (aggregation feature): `'sum' | 'avg' | 'min' | 'max'`; over the cell values (empty values skipped), `'count'` of rows, or a function of the values and; the rows. Shown with the column's renderer (`count` as a plain number).",
760
+ "description": "The column's value in the totals row (aggregation feature): `'sum' | 'avg' | 'min' | 'max'` over the cell values (empty values skipped), `'count'` of rows, or a function of the values and the rows. Shown with the column's renderer (`count` as a plain number).",
697
761
  "feature": "aggregation"
698
762
  },
763
+ {
764
+ "name": "groupable",
765
+ "type": "boolean",
766
+ "required": false,
767
+ "description": "The header menu offers Group by / Ungroup for this column (row grouping feature). Any column can be grouped through `v-model:group-by`; this only adds the menu items.",
768
+ "feature": "rowGrouping"
769
+ },
770
+ {
771
+ "name": "groupValue",
772
+ "type": "(row: T) => unknown",
773
+ "required": false,
774
+ "description": "The value rows are grouped by (row grouping feature), e.g. `(row) => row.placedAt.slice(0, 7)` for months. Default: the cell value, shown with the column's renderer; a `groupValue` is shown as text (or with the `#group-<key>` slot).",
775
+ "feature": "rowGrouping"
776
+ },
777
+ {
778
+ "name": "exportValue",
779
+ "type": "(row: T) => unknown",
780
+ "required": false,
781
+ "description": "The value exports and copying use (export feature), e.g. a plain id for a link or an object. Wins over the cell value and the renderer's text.",
782
+ "feature": "export"
783
+ },
784
+ {
785
+ "name": "exportable",
786
+ "type": "boolean",
787
+ "required": false,
788
+ "description": "Included in CSV exports and copied rows (export feature)? Default `true`; set `false` on action columns.",
789
+ "feature": "export"
790
+ },
699
791
  {
700
792
  "name": "cellClass",
701
793
  "type": "ClassValue | ((row: T) => ClassValue)",
@@ -771,6 +863,16 @@
771
863
  "hideable"
772
864
  ]
773
865
  },
866
+ {
867
+ "id": "export",
868
+ "export": "exportFeature",
869
+ "description": "CSV export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `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.",
870
+ "props": [],
871
+ "columnOptions": [
872
+ "exportValue",
873
+ "exportable"
874
+ ]
875
+ },
774
876
  {
775
877
  "id": "filtering",
776
878
  "export": "filteringFeature",
@@ -819,6 +921,19 @@
819
921
  ],
820
922
  "columnOptions": []
821
923
  },
924
+ {
925
+ "id": "rowGrouping",
926
+ "export": "rowGroupingFeature",
927
+ "description": "Row grouping: `v-model:group-by=\"['region', 'status']\"` groups the rows by those columns into collapsible group rows with their value, row count and the aggregates of columns with an `aggregate`. Columns with `groupable: true` get Group by / Ungroup items in the header menu. Without it, `group-by` is ignored.",
928
+ "props": [
929
+ "groupsExpanded",
930
+ "groupBy"
931
+ ],
932
+ "columnOptions": [
933
+ "groupable",
934
+ "groupValue"
935
+ ]
936
+ },
822
937
  {
823
938
  "id": "rowPinning",
824
939
  "export": "rowPinningFeature",
@@ -833,12 +948,14 @@
833
948
  {
834
949
  "id": "selection",
835
950
  "export": "selectionFeature",
836
- "description": "Row selection: the `selectable` prop (multi or single), `v-model:selected`, `selection-mode` (cascade through sub-grids), `is-row-selectable`, Space on a row and the select-all checkbox.",
951
+ "description": "Row selection: the `selectable` prop (multi or single), `v-model:selected`, `selection-mode` (cascade through sub-grids), `is-row-selectable`, Space on a row, shift-click (or Shift+Space) for a range, the select-all checkbox, `prune-selection`, and with server data a \"select all N matching rows\" banner (`v-model:select-all-matching`; it loads on demand, its own chunk).",
837
952
  "props": [
838
953
  "selectable",
839
954
  "selectionMode",
840
955
  "isRowSelectable",
841
- "selected"
956
+ "pruneSelection",
957
+ "selected",
958
+ "selectAllMatching"
842
959
  ],
843
960
  "columnOptions": []
844
961
  },
@@ -2011,7 +2128,7 @@
2011
2128
  "name": "detailHeight",
2012
2129
  "type": "number",
2013
2130
  "required": false,
2014
- "description": "Estimated height in px of a detail row (`#detail` slot) until it has been rendered and; measured. Default 4 × `rowHeight`. Data rows always have `rowHeight`."
2131
+ "description": "Estimated height in px of a detail row (`#detail` slot) until it has been rendered and measured. Default 4 × `rowHeight`. Data rows always have `rowHeight`."
2015
2132
  }
2016
2133
  ],
2017
2134
  "PinnedRowsState": [
@@ -2045,7 +2162,7 @@
2045
2162
  "name": "pinned",
2046
2163
  "type": "Record<string, PinSide | null>",
2047
2164
  "required": false,
2048
- "description": "Runtime pin overrides (e.g. from the header menu). `null` = explicitly unpinned; a missing key; falls back to the column's `pinned` definition. Optional so older persisted state still loads."
2165
+ "description": "Runtime pin overrides (e.g. from the header menu). `null` = explicitly unpinned; a missing key falls back to the column's `pinned` definition. Optional so older persisted state still loads."
2049
2166
  },
2050
2167
  {
2051
2168
  "name": "widths",
@@ -2079,7 +2196,7 @@
2079
2196
  "name": "options",
2080
2197
  "type": "readonly FilterOption[] | FilterOptionsLoader",
2081
2198
  "required": false,
2082
- "description": "Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a; backend — honour `signal`). Default: distinct values from the rows."
2199
+ "description": "Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a backend — honour `signal`). Default: distinct values from the rows."
2083
2200
  },
2084
2201
  {
2085
2202
  "name": "placeholder",
package/agent/api.md CHANGED
@@ -1,4 +1,4 @@
1
- # @nocopypaste/vue-grid 0.2.0 — API reference
1
+ # @nocopypaste/vue-grid 0.3.0 — API reference
2
2
 
3
3
  > Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
4
4
 
@@ -14,12 +14,14 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
14
14
  | `columnReorderFeature` | Column reordering: drag a header (mouse, pen, touch), Alt+←/→ on a focused header, and the header menu's Move left / Move right. Columns opt out with `reorderable: false`. The order is part of `v-model:column-state` and persisted with `storage`; `<VGridColumnMenu>` works without it. | | `reorderable` |
15
15
  | `columnResizingFeature` | Column resizing: drag a header's edge (mouse, pen, touch), use ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation), or double-click the edge to fit the content. `minWidth` / `maxWidth` bound it; columns opt out with `resizable: false`. Widths are kept in `columnState.widths` and persisted with `storage`. The header menu gains Fit width / Reset width. | | `maxWidth` `resizable` |
16
16
  | `columnVisibilityFeature` | Column visibility: `hidden: true` columns, `columnState.hidden` (persisted with `storage`), the header menu's Hide column item and `<VGridColumnMenu>`'s checkboxes. Columns opt out with `hideable: false`. Without it, every column shows. | | `hidden` `hideable` |
17
+ | `exportFeature` | CSV export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `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. | | `exportValue` `exportable` |
17
18
  | `filteringFeature` | Filtering: header funnels with typed filter popovers on `filterable` columns, the filter row, `<VGridSearch>`, the filter items of the header menu, `v-model:filters` and filter persistence. The popover body and the filter-row editors load on demand (own chunks). | `filterMode` `filterRow` `filterStorage` `noMatchText` `filters` | `filterable` `filter` `filterValue` `filterFn` `filterComponent` `searchable` |
18
19
  | `keyboardNavigationFeature` | Keyboard navigation (the ARIA grid pattern): the grid is one tab stop, arrow keys / Home / End / PageUp / PageDown move between cells, Enter activates a cell's control, Space selects a row, →/← expand and collapse, Alt+←/→ move a column, ContextMenu / Shift+F10 open the cell menu. Without it the grid is an ARIA `table`: its own controls (sort buttons, expanders, checkboxes, filter buttons) sit in the normal Tab order instead. | | |
19
20
  | `menusFeature` | Context menus: the built-in header menu (sort, filter, pin, move, hide, reset, your own items via `header-menu`) and body-cell menus (`context-menu`), opened by right-click, the ContextMenu key or Shift+F10. Without it the browser's own menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it. | `contextMenu` `headerMenu` | |
20
21
  | `paginationFeature` | Built-in pagination: the `pagination` prop and `v-model:page` / `v-model:page-size`. Pages the client rows, or asks the `dataSource` for pages. The pager loads on demand (own chunk). Not needed for the standalone `<VGridPagination>` component. | `pagination` `page` `pageSize` | |
22
+ | `rowGroupingFeature` | Row grouping: `v-model:group-by="['region', 'status']"` groups the rows by those columns into collapsible group rows with their value, row count and the aggregates of columns with an `aggregate`. Columns with `groupable: true` get Group by / Ungroup items in the header menu. Without it, `group-by` is ignored. | `groupsExpanded` `groupBy` | `groupable` `groupValue` |
21
23
  | `rowPinningFeature` | Pinned rows: `v-model:pinned-rows` (`{ top, bottom }` row keys), `pinned-top-rows` / `pinned-bottom-rows` (extra rows that aren't in the data) and the `pinRow()` method. Pinned rows stay in view (sticky) under the header or at the bottom while the body scrolls, and aren't filtered, sorted or paged. Without it, those options are ignored. | `pinnedTopRows` `pinnedBottomRows` `pinnedRows` | |
22
- | `selectionFeature` | Row selection: the `selectable` prop (multi or single), `v-model:selected`, `selection-mode` (cascade through sub-grids), `is-row-selectable`, Space on a row and the select-all checkbox. | `selectable` `selectionMode` `isRowSelectable` `selected` | |
24
+ | `selectionFeature` | Row selection: the `selectable` prop (multi or single), `v-model:selected`, `selection-mode` (cascade through sub-grids), `is-row-selectable`, Space on a row, shift-click (or Shift+Space) for a range, the select-all checkbox, `prune-selection`, and with server data a "select all N matching rows" banner (`v-model:select-all-matching`; it loads on demand, its own chunk). | `selectable` `selectionMode` `isRowSelectable` `pruneSelection` `selected` `selectAllMatching` | |
23
25
  | `serverDataFeature` | Server data: the `dataSource` prop. The grid sends sort, filters and page to your function, cancels superseded requests, and shows loading, error and retry states. | `dataSource` | |
24
26
  | `sortingFeature` | Sorting: the sort button on `sortable` column headers, the sort items of the header menu and, with `sort-mode="client"`, sorting the rows in the browser. | | `sortable` `sortValue` `sortFn` |
25
27
  | `subGridsFeature` | Sub-grids: nested child rows in a CSS `subgrid`, from `sub-rows` (synchronous) or `load-sub-rows` (lazy, cached, with loading / error / retry). Detail rows (`#detail` slot) don't need it. | `subRows` `loadSubRows` `hasSubRows` | |
@@ -43,6 +45,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
43
45
  | `selectable` | `boolean \| 'single'` | `false` | `selectionFeature` | A selection column: `true` = multi-select (with select-all), `'single'` = one row. |
44
46
  | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | `selectionFeature` | `cascade` (default): selecting a parent selects its children. `independent`: rows alone. |
45
47
  | `isRowSelectable` | `(row: T) => boolean` | | `selectionFeature` | Rows that can't be selected get a disabled checkbox. |
48
+ | `pruneSelection` | `boolean` | `false` | `selectionFeature` | Drop selected keys whose rows are no longer in the data (after a reload, a delete, a new server page). Default: keys are kept, so a selection can span server pages. |
46
49
  | `subRows` | `(row: T) => T[] \| undefined \| null` | | `subGridsFeature` | Synchronous child rows of a row: shown in a nested sub-grid when expanded. |
47
50
  | `loadSubRows` | `(row: T) => Promise<T[]>` | | `subGridsFeature` | Lazy child rows, loaded on first expand (cached, with loading / error / retry). |
48
51
  | `hasSubRows` | `(row: T) => boolean` | | `subGridsFeature` | With `loadSubRows`: which rows get an expander (default: every row). |
@@ -69,6 +72,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
69
72
  | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | `aggregationFeature` | A totals row with each column's `aggregate` (aggregation feature): `true` / `'bottom'` sticks it to the bottom, `'top'` under the header. |
70
73
  | `totalsLabel` | `string` | `'Total'` | `aggregationFeature` | The totals row's label, in its first column (unless that column has an aggregate). |
71
74
  | `aggregates` | `Record<string, unknown>` | | `aggregationFeature` | Totals row values by column key, instead of computing them (e.g. totals from a server). |
75
+ | `groupsExpanded` | `boolean` | `false` | `rowGroupingFeature` | Groups start expanded (row grouping feature). Default: collapsed. |
72
76
 
73
77
  ## `v-model`s
74
78
 
@@ -82,6 +86,8 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
82
86
  | `v-model:page` | `number` | `1` | `paginationFeature` | Current page (1-based); resets to 1 when sort or filters change. Needs the pagination feature. |
83
87
  | `v-model:pageSize` | `number` | `25` | `paginationFeature` | Rows per page. Needs the pagination feature. |
84
88
  | `v-model:pinnedRows` | `PinnedRowsState \| null` | `null` | `rowPinningFeature` | Top-level rows pinned above / below the body, by key: `{ top, bottom }`. Needs the row pinning feature. |
89
+ | `v-model:groupBy` | `readonly string[] \| string \| null` | `null` | `rowGroupingFeature` | Column keys to group the rows by, outermost first (`['region', 'status']`, or one key). Group rows show the value, the row count and the columns' aggregates. Needs the row grouping feature. |
90
+ | `v-model:selectAllMatching` | `boolean` | `false` | `selectionFeature` | Server data: every row matching the query is selected, not just the loaded ones (set from the "Select all N rows" banner; ends when filters change or a row is unticked). Act on the query then, not on `selected`. Needs the selection feature. |
85
91
 
86
92
  ## Events
87
93
 
@@ -95,6 +101,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
95
101
  | `sub-rows-error` | `[event: { row: T; error: unknown }]` | `loadSubRows` rejected for a row. |
96
102
  | `context-action` | `[event: ContextActionEvent<T>]` | An item of the body-cell context menu was chosen. |
97
103
  | `header-action` | `[event: HeaderActionEvent<T>]` | A custom item of the header menu was chosen (built-in items act by themselves). |
104
+ | `copy` | `[event: CopyEvent<T>]` | Rows or a cell were copied to the clipboard (export feature: `copyRows()`, Ctrl/⌘+C). |
98
105
 
99
106
  ## Slots
100
107
 
@@ -102,12 +109,13 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
102
109
  |---|---|---|
103
110
  | `cell-<key>` | `{ row: T; value: unknown; rowKey: RowKey; rowIndex: number; depth: number; column: ColumnDef<T> }` | A column's body cell, replacing its renderer: `#cell-<key>`. |
104
111
  | `header-<key>` | `{ column: ColumnDef<T> }` | A column's header content: `#header-<key>`. |
105
- | `total-<key>` | `{ value: unknown; column: ColumnDef<T> }` | A column's cell in the totals row (aggregation feature). |
112
+ | `total-<key>` | `{ value: unknown; column: ColumnDef<T>; group?: RowGroup<T> }` | A column's cell in the totals row and in group rows (aggregation, row grouping); `group` in group rows. |
113
+ | `group-<key>` | `{ value: unknown; count: number; rows: readonly T[]; column: ColumnDef<T>; group: RowGroup<T> }` | The value of a group row grouped by this column (row grouping feature): `#group-<key>`. |
106
114
  | `detail` | `{ row: T; rowKey: RowKey; depth: number }` | Expandable detail row under a row: any content, even another grid. |
107
115
  | `empty` | | Shown when there are no rows. |
108
116
  | `loading` | | Shown while loading with no rows yet. |
109
117
  | `sub-rows-loading` | `{ row: T }` | Shown while a row's lazy children load. |
110
- | `toolbar` | `{ columns: readonly ColumnDef<T>[]; columnState: ColumnState; setColumnState: (state: ColumnState) => void; filters: FilterState; setFilters: (state: FilterState) => void; clearFilters: () => void; activeFilterCount: number }` | Above the grid: put a search box, column menu or filter summary here. |
118
+ | `toolbar` | `{ columns: readonly ColumnDef<T>[]; columnState: ColumnState; setColumnState: (state: ColumnState) => void; filters: FilterState; setFilters: (state: FilterState) => void; clearFilters: () => void; activeFilterCount: number; selected: readonly RowKey[]; selectedCount: number; selectAllMatching: boolean; clearSelection: () => void }` | Above the grid: put a search box, column menu, filter summary or batch actions here. |
111
119
 
112
120
  ## Exposed methods (`ref<VGridExposed>()`)
113
121
 
@@ -118,13 +126,17 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
118
126
  | `expandAll` | `void` | | Expands every expandable row (sub-grids and detail rows) that passes the filters. |
119
127
  | `collapseAll` | `void` | | Collapses every row. |
120
128
  | `setColumnState` | `void` | | Replaces the column state (order, hidden, pins, widths), and saves it with `storage`. |
121
- | `patchLoadedRows` | `number` | | Applies field patches to lazily loaded child rows (`loadSubRows`), which the grid caches and the; app can't reach. Top-level and synchronous `subRows` data belong to the app: update them there (assign fields on reactive rows, or use `patchRows`). Returns the number of rows patched. |
129
+ | `patchLoadedRows` | `number` | | Applies field patches to lazily loaded child rows (`loadSubRows`), which the grid caches and the app can't reach. Top-level and synchronous `subRows` data belong to the app: update them there (assign fields on reactive rows, or use `patchRows`). Returns the number of rows patched. |
122
130
  | `setFilters` | `void` | `filteringFeature` | Replaces the filter model (also persisted with `filter-storage`). |
123
131
  | `clearFilters` | `void` | `filteringFeature` | Removes every column filter and the search. |
124
132
  | `openFilter` | `void` | `filteringFeature` | Opens a column's filter popover. |
125
133
  | `reload` | `Promise<void>` | `serverDataFeature` | Re-runs the `dataSource` with the current query; lazily loaded child rows load again too. |
126
134
  | `reloadSubRows` | `void` | | Forgets lazily loaded child rows (one row's, or all): expanded rows load them again. |
127
135
  | `pinRow` | `void` | `rowPinningFeature` | Pins a top-level row above or below the body, or unpins it (`null`). Row pinning feature. |
136
+ | `clearSelection` | `void` | | Clears the selection, "all matching rows" included. Selection feature. |
137
+ | `getCsv` | `string` | | The rows as CSV text: the filtered, sorted rows, visible columns, raw values. Export feature. |
138
+ | `exportCsv` | `void` | | Downloads the rows as a CSV file (`filename`, default `export.csv`; UTF-8 with a BOM). Export feature. |
139
+ | `copyRows` | `Promise<boolean>` | | Copies rows to the clipboard as tab-separated text (pastes as cells into spreadsheets): the selected rows by default, as displayed, no header. Resolves `false` if nothing was copied. Export feature. |
128
140
 
129
141
  ## `ColumnDef<T>`
130
142
 
@@ -141,7 +153,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
141
153
  | `minWidth` | `string` | | Lower bound; combined with `width` into `minmax(minWidth, width)`, and the resize minimum. |
142
154
  | `maxWidth` | `string` | `columnResizingFeature` | Upper bound when the user resizes the column (column resizing feature). |
143
155
  | `resizable` | `boolean` | `columnResizingFeature` | Can the user resize this column (column resizing feature)? Default `true`. |
144
- | `group` | `string` | `columnGroupsFeature` | Header group label (column groups feature): adjacent visible columns with the same `group`; share one header cell above their own headers. |
156
+ | `group` | `string` | `columnGroupsFeature` | Header group label (column groups feature): adjacent visible columns with the same `group` share one header cell above their own headers. |
145
157
  | `align` | `Align` | | Cell and header alignment (default: the renderer's, e.g. `end` for numbers, else `start`). |
146
158
  | `sortable` | `boolean` | `sortingFeature` | A sort button in the header (sorting feature). Client sorting needs `sort-mode="client"`. |
147
159
  | `sortValue` | `(row: T) => unknown` | `sortingFeature` | The value client sorting compares (default: the renderer's sort value, else the cell value). |
@@ -159,7 +171,11 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
159
171
  | `filterComponent` | `Component` | `filteringFeature` | Custom filter UI (popover), receives `modelValue` / emits `update:modelValue` with a filter. |
160
172
  | `searchable` | `boolean` | `filteringFeature` | Include in the quick search. Default `true` for visible columns. |
161
173
  | `flash` | `FlashMode` | | Briefly highlight the cell when its value changes (overrides the grid's `flash` prop). `'direction'`: green when a number goes up, red when it goes down. |
162
- | `aggregate` | `AggregateName \| AggregateFn<T>` | `aggregationFeature` | The column's value in the totals row (aggregation feature): `'sum' \| 'avg' \| 'min' \| 'max'`; over the cell values (empty values skipped), `'count'` of rows, or a function of the values and; the rows. Shown with the column's renderer (`count` as a plain number). |
174
+ | `aggregate` | `AggregateName \| AggregateFn<T>` | `aggregationFeature` | The column's value in the totals row (aggregation feature): `'sum' \| 'avg' \| 'min' \| 'max'` over the cell values (empty values skipped), `'count'` of rows, or a function of the values and the rows. Shown with the column's renderer (`count` as a plain number). |
175
+ | `groupable` | `boolean` | `rowGroupingFeature` | The header menu offers Group by / Ungroup for this column (row grouping feature). Any column can be grouped through `v-model:group-by`; this only adds the menu items. |
176
+ | `groupValue` | `(row: T) => unknown` | `rowGroupingFeature` | The value rows are grouped by (row grouping feature), e.g. `(row) => row.placedAt.slice(0, 7)` for months. Default: the cell value, shown with the column's renderer; a `groupValue` is shown as text (or with the `#group-<key>` slot). |
177
+ | `exportValue` | `(row: T) => unknown` | `exportFeature` | The value exports and copying use (export feature), e.g. a plain id for a link or an object. Wins over the cell value and the renderer's text. |
178
+ | `exportable` | `boolean` | `exportFeature` | Included in CSV exports and copied rows (export feature)? Default `true`; set `false` on action columns. |
163
179
  | `cellClass` | `ClassValue \| ((row: T) => ClassValue)` | | Extra classes for the column's body cells (or a function of the row). |
164
180
  | `headerClass` | `ClassValue` | | Extra classes for the column's header cell. |
165
181
 
@@ -519,7 +535,7 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
519
535
  |---|---|---|
520
536
  | `rowHeight` | `number` | Fixed row height in px. |
521
537
  | `overscan`? | `number` | Extra rows rendered above/below the viewport. Default 6. |
522
- | `detailHeight`? | `number` | Estimated height in px of a detail row (`#detail` slot) until it has been rendered and; measured. Default 4 × `rowHeight`. Data rows always have `rowHeight`. |
538
+ | `detailHeight`? | `number` | Estimated height in px of a detail row (`#detail` slot) until it has been rendered and measured. Default 4 × `rowHeight`. Data rows always have `rowHeight`. |
523
539
 
524
540
  ### `PinnedRowsState`
525
541
 
@@ -534,7 +550,7 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
534
550
  |---|---|---|
535
551
  | `order` | `string[]` | Column keys in display order (all known columns, visible or not). |
536
552
  | `hidden` | `string[]` | Keys of hidden columns. |
537
- | `pinned`? | `Record<string, PinSide \| null>` | Runtime pin overrides (e.g. from the header menu). `null` = explicitly unpinned; a missing key; falls back to the column's `pinned` definition. Optional so older persisted state still loads. |
553
+ | `pinned`? | `Record<string, PinSide \| null>` | Runtime pin overrides (e.g. from the header menu). `null` = explicitly unpinned; a missing key falls back to the column's `pinned` definition. Optional so older persisted state still loads. |
538
554
  | `widths`? | `Record<string, string>` | Widths the user resized columns to (CSS lengths, e.g. `'240px'`). Column resizing feature. |
539
555
 
540
556
  ### `SortState`
@@ -549,7 +565,7 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
549
565
  | Field | Type | Description |
550
566
  |---|---|---|
551
567
  | `type`? | `FilterType` | |
552
- | `options`? | `readonly FilterOption[] \| FilterOptionsLoader` | Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a; backend — honour `signal`). Default: distinct values from the rows. |
568
+ | `options`? | `readonly FilterOption[] \| FilterOptionsLoader` | Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a backend — honour `signal`). Default: distinct values from the rows. |
553
569
  | `placeholder`? | `string` | Placeholder of the filter-row input. |
554
570
 
555
571
  ### `FilterOption`
@@ -31,10 +31,12 @@
31
31
  "columnReorderFeature",
32
32
  "columnResizingFeature",
33
33
  "columnVisibilityFeature",
34
+ "exportFeature",
34
35
  "filteringFeature",
35
36
  "keyboardNavigationFeature",
36
37
  "menusFeature",
37
38
  "paginationFeature",
39
+ "rowGroupingFeature",
38
40
  "rowPinningFeature",
39
41
  "selectionFeature",
40
42
  "serverDataFeature",
@@ -107,6 +109,10 @@
107
109
  "isRowSelectable": {
108
110
  "description": "Rows that can't be selected get a disabled checkbox."
109
111
  },
112
+ "pruneSelection": {
113
+ "type": "boolean",
114
+ "description": "Drop selected keys whose rows are no longer in the data (after a reload, a delete, a new server page). Default: keys are kept, so a selection can span server pages."
115
+ },
110
116
  "subRows": {
111
117
  "description": "Synchronous child rows of a row: shown in a nested sub-grid when expanded."
112
118
  },
@@ -162,7 +168,7 @@
162
168
  },
163
169
  "detailHeight": {
164
170
  "type": "number",
165
- "description": "Estimated height in px of a detail row (`#detail` slot) until it has been rendered and; measured. Default 4 × `rowHeight`. Data rows always have `rowHeight`."
171
+ "description": "Estimated height in px of a detail row (`#detail` slot) until it has been rendered and measured. Default 4 × `rowHeight`. Data rows always have `rowHeight`."
166
172
  }
167
173
  },
168
174
  "required": [
@@ -258,6 +264,10 @@
258
264
  "type": "object",
259
265
  "description": "Totals row values by column key, instead of computing them (e.g. totals from a server)."
260
266
  },
267
+ "groupsExpanded": {
268
+ "type": "boolean",
269
+ "description": "Groups start expanded (row grouping feature). Default: collapsed."
270
+ },
261
271
  "sort": {
262
272
  "anyOf": [
263
273
  {
@@ -301,7 +311,7 @@
301
311
  },
302
312
  "pinned": {
303
313
  "type": "object",
304
- "description": "Runtime pin overrides (e.g. from the header menu). `null` = explicitly unpinned; a missing key; falls back to the column's `pinned` definition. Optional so older persisted state still loads."
314
+ "description": "Runtime pin overrides (e.g. from the header menu). `null` = explicitly unpinned; a missing key falls back to the column's `pinned` definition. Optional so older persisted state still loads."
305
315
  },
306
316
  "widths": {
307
317
  "type": "object",
@@ -383,6 +393,27 @@
383
393
  }
384
394
  ],
385
395
  "description": "Top-level rows pinned above / below the body, by key: `{ top, bottom }`. Needs the row pinning feature."
396
+ },
397
+ "groupBy": {
398
+ "anyOf": [
399
+ {
400
+ "type": "array",
401
+ "items": {
402
+ "type": "string"
403
+ }
404
+ },
405
+ {
406
+ "type": "string"
407
+ },
408
+ {
409
+ "type": "null"
410
+ }
411
+ ],
412
+ "description": "Column keys to group the rows by, outermost first (`['region', 'status']`, or one key). Group rows show the value, the row count and the columns' aggregates. Needs the row grouping feature."
413
+ },
414
+ "selectAllMatching": {
415
+ "type": "boolean",
416
+ "description": "Server data: every row matching the query is selected, not just the loaded ones (set from the \"Select all N rows\" banner; ends when filters change or a row is unticked). Act on the query then, not on `selected`. Needs the selection feature."
386
417
  }
387
418
  },
388
419
  "required": [
@@ -478,7 +509,7 @@
478
509
  },
479
510
  "group": {
480
511
  "type": "string",
481
- "description": "Header group label (column groups feature): adjacent visible columns with the same `group`; share one header cell above their own headers."
512
+ "description": "Header group label (column groups feature): adjacent visible columns with the same `group` share one header cell above their own headers."
482
513
  },
483
514
  "align": {
484
515
  "enum": [
@@ -553,7 +584,7 @@
553
584
  ]
554
585
  },
555
586
  "options": {
556
- "description": "Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a; backend — honour `signal`). Default: distinct values from the rows."
587
+ "description": "Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a backend — honour `signal`). Default: distinct values from the rows."
557
588
  },
558
589
  "placeholder": {
559
590
  "type": "string",
@@ -591,7 +622,21 @@
591
622
  "description": "Briefly highlight the cell when its value changes (overrides the grid's `flash` prop). `'direction'`: green when a number goes up, red when it goes down."
592
623
  },
593
624
  "aggregate": {
594
- "description": "The column's value in the totals row (aggregation feature): `'sum' | 'avg' | 'min' | 'max'`; over the cell values (empty values skipped), `'count'` of rows, or a function of the values and; the rows. Shown with the column's renderer (`count` as a plain number)."
625
+ "description": "The column's value in the totals row (aggregation feature): `'sum' | 'avg' | 'min' | 'max'` over the cell values (empty values skipped), `'count'` of rows, or a function of the values and the rows. Shown with the column's renderer (`count` as a plain number)."
626
+ },
627
+ "groupable": {
628
+ "type": "boolean",
629
+ "description": "The header menu offers Group by / Ungroup for this column (row grouping feature). Any column can be grouped through `v-model:group-by`; this only adds the menu items."
630
+ },
631
+ "groupValue": {
632
+ "description": "The value rows are grouped by (row grouping feature), e.g. `(row) => row.placedAt.slice(0, 7)` for months. Default: the cell value, shown with the column's renderer; a `groupValue` is shown as text (or with the `#group-<key>` slot)."
633
+ },
634
+ "exportValue": {
635
+ "description": "The value exports and copying use (export feature), e.g. a plain id for a link or an object. Wins over the cell value and the renderer's text."
636
+ },
637
+ "exportable": {
638
+ "type": "boolean",
639
+ "description": "Included in CSV exports and copied rows (export feature)? Default `true`; set `false` on action columns."
595
640
  },
596
641
  "cellClass": {
597
642
  "description": "Extra classes for the column's body cells (or a function of the row)."