@nocopypaste/vue-grid 0.7.0 → 0.9.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 (71) hide show
  1. package/AGENTS.md +30 -25
  2. package/CHANGELOG.md +34 -0
  3. package/README.md +130 -28
  4. package/agent/api.json +36 -3
  5. package/agent/api.md +7 -3
  6. package/agent/grid-config.schema.json +31 -0
  7. package/dist/agent/api.js +31 -3
  8. package/dist/agent/requirements.js +3 -0
  9. package/dist/agent/requirements.js.map +1 -1
  10. package/dist/base.css +1 -1
  11. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +578 -541
  12. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +3 -3
  14. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +82 -53
  16. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/VGridSortMarker.js +6 -0
  18. package/dist/components/VGridSortMarker.js.map +1 -0
  19. package/dist/components/VGridSortMarker.vue_vue_type_script_setup_true_lang.js +21 -0
  20. package/dist/components/VGridSortMarker.vue_vue_type_script_setup_true_lang.js.map +1 -0
  21. package/dist/composables/useDataSource.js +21 -19
  22. package/dist/composables/useDataSource.js.map +1 -1
  23. package/dist/composables/useGridExport.js +1 -1
  24. package/dist/composables/useGridExport.js.map +1 -1
  25. package/dist/composables/useGridKeyboard.js +5 -1
  26. package/dist/composables/useGridKeyboard.js.map +1 -1
  27. package/dist/composables/useGridMenus.js +24 -12
  28. package/dist/composables/useGridMenus.js.map +1 -1
  29. package/dist/composables/useRowGrouping.js +103 -74
  30. package/dist/composables/useRowGrouping.js.map +1 -1
  31. package/dist/composables/useServerGroups.js +106 -0
  32. package/dist/composables/useServerGroups.js.map +1 -0
  33. package/dist/composables/useSorting.js +48 -0
  34. package/dist/composables/useSorting.js.map +1 -0
  35. package/dist/core/grouping.js +41 -24
  36. package/dist/core/grouping.js.map +1 -1
  37. package/dist/core/sort.js +31 -1
  38. package/dist/core/sort.js.map +1 -1
  39. package/dist/core.css +1 -1
  40. package/dist/features/index.js +12 -10
  41. package/dist/features/index.js.map +1 -1
  42. package/dist/features/serverGrouping.js +9 -0
  43. package/dist/features/serverGrouping.js.map +1 -0
  44. package/dist/features/sorting.js +8 -4
  45. package/dist/features/sorting.js.map +1 -1
  46. package/dist/index.js +60 -59
  47. package/dist/internal/context.js.map +1 -1
  48. package/dist/internal/features.js.map +1 -1
  49. package/dist/theme.css +1 -1
  50. package/dist/types/agent/requirements.d.ts +1 -1
  51. package/dist/types/components/VGrid.vue.d.ts +20 -2
  52. package/dist/types/components/VGridHeader.vue.d.ts +4 -3
  53. package/dist/types/components/VGridSortMarker.vue.d.ts +9 -0
  54. package/dist/types/composables/useDataSource.d.ts +36 -2
  55. package/dist/types/composables/useGridExport.d.ts +2 -0
  56. package/dist/types/composables/useGridMenus.d.ts +5 -0
  57. package/dist/types/composables/useRowGrouping.d.ts +14 -2
  58. package/dist/types/composables/useServerGroups.d.ts +37 -0
  59. package/dist/types/composables/useSorting.d.ts +24 -0
  60. package/dist/types/core/grouping.d.ts +31 -2
  61. package/dist/types/core/sort.d.ts +16 -0
  62. package/dist/types/features/index.d.ts +2 -1
  63. package/dist/types/features/serverGrouping.d.ts +9 -0
  64. package/dist/types/index.d.ts +2 -2
  65. package/dist/types/internal/context.d.ts +2 -0
  66. package/dist/types/internal/features.d.ts +2 -1
  67. package/dist/types/types.d.ts +17 -1
  68. package/dist/vue-grid.css +1 -1
  69. package/llms-full.txt +167 -56
  70. package/llms.txt +1 -1
  71. package/package.json +1 -1
package/llms-full.txt CHANGED
@@ -45,31 +45,33 @@ 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) | 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 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 / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
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` |
70
- | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
71
- | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
72
- | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
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
+ | Sort by several columns ("city, then stake") | `sortingFeature` | `multi-sort`, `v-model:sorts="[{ key, dir }, …]"`; Shift-click adds a column; server: `query.sorts` |
52
+ | Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
53
+ | Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
54
+ | Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
55
+ | 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` |
56
+ | Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
57
+ | An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
58
+ | 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
59
+ | Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
60
+ | Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`; on narrow grids they scroll unless `pinned-max-share` allows (default half the width) |
61
+ | Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
62
+ | Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
63
+ | Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
64
+ | Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
65
+ | Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
66
+ | A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
67
+ | 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` |
68
+ | 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 |
69
+ | Download CSV / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
70
+ | Row / selection counts, sum of the selected rows | `statusBarFeature` | `status-bar` (or `{ summary: ['total'], aggregates?: ['sum', 'avg'] }`); `#status-bar="{ rowCount, selectedCount, summary, … }"` |
71
+ | 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` |
72
+ | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
73
+ | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
74
+ | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
73
75
 
74
76
  ## Renderers (pick by data)
75
77
 
@@ -500,6 +502,7 @@ only sees stylesheet rules. Density:
500
502
  ## Pitfalls
501
503
 
502
504
  - Nothing sorts → `sort-mode="client"` missing (or `sortingFeature` missing).
505
+ - Shift-click sorts by one column only → add `multi-sort`, and bind `v-model:sorts` (not `sort`) to read every key; a `dataSource` reads `query.sorts`.
503
506
  - Columns are squeezed / the page scrolls sideways → give `width`s (`minmax(8rem, 1fr)`); the grid
504
507
  scrolls horizontally inside itself when columns are wider than it.
505
508
  - Grid grows forever / no sticky header → no bounded height.
@@ -518,6 +521,8 @@ only sees stylesheet rules. Density:
518
521
  - Printing the page (Ctrl+P) shows only the rows on screen, clipped to the grid → use `grid.print()`.
519
522
  - Translating by replacing components or CSS `content` → set `messages` (every built-in text has a key).
520
523
  - Hiding a built-in piece with CSS → `parts: { filterButtons: false, … }` leaves it out of the DOM (and the tab order).
524
+ - Grouped server data shows groups of one page only → add `serverGroupingFeature` and answer `query.groupBy` with `{ groups }` (`count` per group, `total` = number of groups).
525
+ - A batch action on a selected server group touched only loaded rows → act on `selectedGroups` (paths) with the filters on the server.
521
526
  - Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
522
527
  (CSV exports are raw by default).
523
528
  - `group-by` names a field, not a column → it takes column `key`s; add a (hidden) column for it.
@@ -528,7 +533,7 @@ only sees stylesheet rules. Density:
528
533
 
529
534
  ---
530
535
 
531
- # @nocopypaste/vue-grid 0.7.0 — API reference
536
+ # @nocopypaste/vue-grid 0.9.0 — API reference
532
537
 
533
538
  > Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
534
539
 
@@ -553,7 +558,8 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
553
558
  | `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` | |
554
559
  | `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` | |
555
560
  | `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` | |
556
- | `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` |
561
+ | `serverGroupingFeature` | Row grouping with server data: with `group-by` and a `data-source`, the query carries `groupBy` and `groupPath`, the server answers with groups (value, count, aggregates), and each group's contents load when it expands. A group's checkbox selects it by query (`v-model:selected-groups`), without loading its rows. Needs the row grouping and server data features too. Without it, a grouped server grid groups only the rows it has loaded. | `selectedGroups` | |
562
+ | `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. | `multiSort` `sorts` | `sortable` `sortValue` `sortFn` |
557
563
  | `statusBarFeature` | A status bar under the grid (`status-bar`): how many rows pass the filters ("84 of 200 rows"), how many are selected, how many filters are on (with Clear), and with `{ summary: ['total'] }` the sum and average of those columns over the selected rows, as the cells show them. The `#status-bar` slot replaces its content. Its component loads on demand (own chunk). | `statusBar` | |
558
564
  | `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` | |
559
565
  | `virtualScrollingFeature` | Virtual scrolling: `:virtual="{ rowHeight, overscan?, detailHeight? }"` renders only the rows in view (plus `overscan`), so tens of thousands of rows stay fast — sub-grids and detail rows included, inside the same CSS grid / subgrid layout. Without it, `virtual` is ignored and every row renders. | `virtual` | |
@@ -608,12 +614,14 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
608
614
  | `totalsLabel` | `string` | | `aggregationFeature` | The totals row's label, in its first column (unless that column has an aggregate). Default: `messages.total`, else `Total`. |
609
615
  | `aggregates` | `Record<string, unknown>` | | `aggregationFeature` | Totals row values by column key, instead of computing them (e.g. totals from a server). |
610
616
  | `groupsExpanded` | `boolean` | `false` | `rowGroupingFeature` | Groups start expanded (row grouping feature). Default: collapsed. |
617
+ | `multiSort` | `boolean` | | `sortingFeature` | Multi-column sort (sorting feature): Shift-click (or Shift+Enter) on a header adds it as the next key, Shift-click again turns it descending, then removes it. `v-model:sorts` holds every key, `v-model:sort` the first; server queries get `sorts` too. |
611
618
 
612
619
  ## `v-model`s
613
620
 
614
621
  | Model | Type | Default | Needs | Description |
615
622
  |---|---|---|---|---|
616
623
  | `v-model:sort` | `SortState \| null` | `null` | | Sort state: a header click cycles asc → desc → none. Header UI needs the sorting feature. |
624
+ | `v-model:sorts` | `SortState[]` | `[]` | `sortingFeature` | Every sort key, the first one first (`multi-sort`). `sort` is the first of them. |
617
625
  | `v-model:columnState` | `ColumnState \| undefined` | `undefined` | | Column order, hidden columns, runtime pins and resized widths (persisted with `storage`). |
618
626
  | `v-model:expanded` | `RowKey[]` | `[]` | | Keys of expanded rows (sub-grids and detail rows). |
619
627
  | `v-model:selected` | `RowKey[]` | `[]` | `selectionFeature` | Keys of selected rows. Needs the selection feature. |
@@ -623,6 +631,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
623
631
  | `v-model:pinnedRows` | `PinnedRowsState \| null` | `null` | `rowPinningFeature` | Top-level rows pinned above / below the body, by key: `{ top, bottom }`. Needs the row pinning feature. |
624
632
  | `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. |
625
633
  | `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. |
634
+ | `v-model:selectedGroups` | `GroupPath[]` | `[]` | `serverGroupingFeature` | Server data with row grouping: groups selected by query, by their paths, without loading their rows (a group's checkbox). Act on these with `selected` and the filters. Ends when the filters or the grouping change. Needs the selection and row grouping features. |
626
635
 
627
636
  ## Events
628
637
 
@@ -654,7 +663,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
654
663
  | `status-bar` | `StatusBarScope` | The status bar's content (status bar feature): replaces the counts and the summary. |
655
664
  | `loading` | | Shown while loading with no rows yet. |
656
665
  | `sub-rows-loading` | `{ row: T }` | Shown while a row's lazy children load. |
657
- | `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. |
666
+ | `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; selectedGroups: GroupPath[]; selectAllMatching: boolean; clearSelection: () => void }` | Above the grid: put a search box, column menu, filter summary or batch actions here. |
658
667
 
659
668
  ## Exposed methods (`ref<VGridExposed>()`)
660
669
 
@@ -1328,6 +1337,7 @@ an opt-in feature:
1328
1337
  | `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 |
1329
1338
  | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
1330
1339
  | `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 |
1340
+ | `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) |
1331
1341
  | `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` |
1332
1342
  | `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 |
1333
1343
 
@@ -1373,33 +1383,34 @@ what you import.
1373
1383
 
1374
1384
  | Import (minified / gzip, Vue excluded) | Initial chunk |
1375
1385
  | ---------------------------------------------------------------------------- | ------------------ |
1376
- | `VGrid` (no features) | 40.5 kB / 14.1 kB |
1377
- | `VGrid` + `sortingFeature` | 41.2 kB / 14.4 kB |
1378
- | `VGrid` + `filteringFeature` | 51.1 kB / 17.8 kB |
1379
- | `VGrid` + `serverDataFeature` | 41.8 kB / 14.7 kB |
1380
- | `VGrid` + `paginationFeature` | 40.6 kB / 14.1 kB |
1381
- | `VGrid` + `selectionFeature` | 44.6 kB / 15.5 kB |
1382
- | `VGrid` + `subGridsFeature` | 42.8 kB / 14.9 kB |
1383
- | `VGrid` + `menusFeature` | 50.9 kB / 17.6 kB |
1384
- | `VGrid` + `columnReorderFeature` | 44.2 kB / 15.3 kB |
1385
- | `VGrid` + `columnPinningFeature` | 43.4 kB / 15.1 kB |
1386
- | `VGrid` + `virtualScrollingFeature` | 46.2 kB / 16.3 kB |
1387
- | `VGrid` + `columnVisibilityFeature` | 40.6 kB / 14.1 kB |
1388
- | `VGrid` + `keyboardNavigationFeature` | 43.2 kB / 15.1 kB |
1389
- | `VGrid` + `columnResizingFeature` | 43.7 kB / 15.3 kB |
1390
- | `VGrid` + `columnGroupsFeature` | 41.8 kB / 14.5 kB |
1391
- | `VGrid` + `rowPinningFeature` | 45.4 kB / 15.4 kB |
1392
- | `VGrid` + `aggregationFeature` | 45.6 kB / 15.5 kB |
1393
- | `VGrid` + `rowGroupingFeature` | 50.2 kB / 16.9 kB |
1394
- | `VGrid` + `exportFeature` | 45.4 kB / 16.0 kB |
1395
- | `VGrid` + `statusBarFeature` | 42.8 kB / 15.0 kB |
1396
- | `VGrid` + `allFeatures` + `VGridSearch` | 108.1 kB / 36.5 kB |
1397
- | `VGrid` + `currencyRenderer` | 41.9 kB / 14.5 kB |
1398
- | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 47.2 kB / 16.3 kB |
1386
+ | `VGrid` (no features) | 43.7 kB / 15.0 kB |
1387
+ | `VGrid` + `sortingFeature` | 46.4 kB / 16.0 kB |
1388
+ | `VGrid` + `filteringFeature` | 54.5 kB / 18.9 kB |
1389
+ | `VGrid` + `serverDataFeature` | 45.2 kB / 15.6 kB |
1390
+ | `VGrid` + `paginationFeature` | 43.9 kB / 15.1 kB |
1391
+ | `VGrid` + `selectionFeature` | 47.9 kB / 16.5 kB |
1392
+ | `VGrid` + `subGridsFeature` | 46.1 kB / 15.8 kB |
1393
+ | `VGrid` + `menusFeature` | 55.0 kB / 18.8 kB |
1394
+ | `VGrid` + `columnReorderFeature` | 47.4 kB / 16.3 kB |
1395
+ | `VGrid` + `columnPinningFeature` | 46.7 kB / 16.1 kB |
1396
+ | `VGrid` + `virtualScrollingFeature` | 49.5 kB / 17.2 kB |
1397
+ | `VGrid` + `columnVisibilityFeature` | 43.9 kB / 15.1 kB |
1398
+ | `VGrid` + `keyboardNavigationFeature` | 46.5 kB / 16.0 kB |
1399
+ | `VGrid` + `columnResizingFeature` | 47.0 kB / 16.3 kB |
1400
+ | `VGrid` + `columnGroupsFeature` | 45.0 kB / 15.5 kB |
1401
+ | `VGrid` + `rowPinningFeature` | 48.7 kB / 16.3 kB |
1402
+ | `VGrid` + `aggregationFeature` | 48.9 kB / 16.5 kB |
1403
+ | `VGrid` + `rowGroupingFeature` | 54.6 kB / 18.6 kB |
1404
+ | `VGrid` + `exportFeature` | 48.7 kB / 16.9 kB |
1405
+ | `VGrid` + `statusBarFeature` | 46.2 kB / 16.0 kB |
1406
+ | `VGrid` + `serverGroupingFeature` | 46.8 kB / 16.2 kB |
1407
+ | `VGrid` + `allFeatures` + `VGridSearch` | 118.3 kB / 39.8 kB |
1408
+ | `VGrid` + `currencyRenderer` | 45.1 kB / 15.5 kB |
1409
+ | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 51.0 kB / 17.5 kB |
1399
1410
  | `sortRows` only | 0.7 kB / 0.4 kB |
1400
1411
  | `toCsv` only | 1.1 kB / 0.6 kB |
1401
- | everything | 160.7 kB / 51.5 kB |
1402
- | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 70.5 kB / 19.2 kB |
1412
+ | everything | 171.9 kB / 55.2 kB |
1413
+ | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 73.4 kB / 20.0 kB |
1403
1414
 
1404
1415
  With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
1405
1416
  chunks**: they load the first time a popover opens or `filter-row` is on. With
@@ -1424,6 +1435,8 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1424
1435
  | `columns` | `ColumnDef<T>[]` | — | See below. |
1425
1436
  | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
1426
1437
  | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
1438
+ | `multiSort` | `boolean` | `false` | Shift-click (Shift+Enter) a header to sort by it next; `v-model:sorts` holds every key. See [Sorting](#sorting). |
1439
+ | `v-model:sorts` | `SortState[]` | `[]` | Every sort key, the first one first (with `multiSort`). `sort` follows its first key. |
1427
1440
  | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
1428
1441
  | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
1429
1442
  | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
@@ -1454,6 +1467,7 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1454
1467
  | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
1455
1468
  | `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). |
1456
1469
  | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
1470
+ | `v-model:selectedGroups` | `GroupPath[]` | `[]` | Server-side grouping: groups selected by query, by path (`[[{ key, value }]]`), without their rows. |
1457
1471
  | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
1458
1472
  | `rowClass` | `(row, index) => ClassValue` | — | |
1459
1473
  | `highlightedRows` | `RowKey[]` | — | |
@@ -1695,7 +1709,7 @@ typeahead move through items; focus returns to the cell on close.
1695
1709
  ### Column headers
1696
1710
 
1697
1711
  Right-clicking a header opens a built-in menu: **Sort ascending / descending / Clear sort** (sortable
1698
- columns), **Pin left / Pin right / Unpin**, **Move left / right**, **Hide column**, **Reset columns**.
1712
+ columns; with `multi-sort` also **Then sort ascending / descending**, and Clear sort drops only that column), **Pin left / Pin right / Unpin**, **Move left / right**, **Hide column**, **Reset columns**.
1699
1713
  Pin items need `columnPinningFeature`, move items `columnReorderFeature`, Hide column `columnVisibilityFeature`. Runtime pins are stored in column state (`columnState.pinned`) and persisted with `storage`.
1700
1714
 
1701
1715
  ```vue
@@ -1722,6 +1736,47 @@ The same component powers the `actions-menu` renderer and is exported for add-on
1722
1736
  <!-- or imperatively: menuRef.value.openAt(element | { x, y }) -->
1723
1737
  ```
1724
1738
 
1739
+ ## Sorting
1740
+
1741
+ A `sortable` column (with `sortingFeature`) sorts on a header click: ascending, descending, none.
1742
+ `v-model:sort` holds `{ key, dir }`. The grid sorts the rows itself with `sort-mode="client"`;
1743
+ otherwise it only updates `sort` (or asks the `dataSource`). Values sort by type (numbers, dates,
1744
+ text with `localeCompare`), a renderer can define its sort value, and a column can override it with
1745
+ `sortValue: (row) => …` or `sortFn: (a, b) => …`. Empty values sort last in both directions.
1746
+
1747
+ **Several columns.** With `multi-sort`, Shift-click a header (Shift+Enter on a focused one) to sort
1748
+ by it after the others: ascending, then descending, then removed. A plain click still sorts by that
1749
+ column alone. The headers show each column's number (1, 2, …); `aria-sort` stays on the first key, as
1750
+ the ARIA grid pattern has it, and screen readers hear the rest as “sorted 2 of 3, descending”. The
1751
+ header menu adds **Then sort ascending / descending**.
1752
+
1753
+ ```vue
1754
+ <script setup lang="ts">
1755
+ import { VGrid, sortingFeature, type SortState } from '@nocopypaste/vue-grid'
1756
+ const sorts = ref<SortState[]>([
1757
+ { key: 'city', dir: 'asc' },
1758
+ { key: 'stake', dir: 'desc' },
1759
+ ])
1760
+ </script>
1761
+
1762
+ <template>
1763
+ <VGrid
1764
+ v-model:sorts="sorts"
1765
+ multi-sort
1766
+ sort-mode="client"
1767
+ :rows
1768
+ :columns
1769
+ row-key="id"
1770
+ :features="[sortingFeature]"
1771
+ />
1772
+ </template>
1773
+ ```
1774
+
1775
+ `v-model:sort` keeps working beside it: it is the first key, and setting it from outside makes it
1776
+ the only one. A `dataSource` gets every key in `query.sorts` (only with `multi-sort`; `query.sort`
1777
+ is still the first). Row groups follow their own column's key wherever it is in the list.
1778
+ `sortRowsBy(rows, keys)` and `nextSorts(sorts, key)` sort and cycle without a grid.
1779
+
1725
1780
  ## Filtering
1726
1781
 
1727
1782
  ```vue
@@ -1867,7 +1922,7 @@ import {
1867
1922
  } from '@nocopypaste/vue-grid'
1868
1923
 
1869
1924
  const fetchBets: DataSource<Bet> = async (query, { signal }) => {
1870
- // query: { sort: { key, dir } | null, filters: FilterState, page: number, pageSize: number | null }
1925
+ // query: { sort: { key, dir } | null, sorts?: SortState[] (multi-sort), filters: FilterState, page: number, pageSize: number | null }
1871
1926
  const res = await fetch('/api/bets', { method: 'POST', body: JSON.stringify(query), signal })
1872
1927
  if (!res.ok) throw new Error(res.statusText)
1873
1928
  return res.json() // { rows: Bet[], total?: number }
@@ -2064,6 +2119,62 @@ Style group rows with `.vg-rowgroup` (and `[data-group-level]`), `.vg-rowgroup-n
2064
2119
  `--vg-rowgroup-font-weight` tokens. `groupRows()` and `isRowGroup()` are exported for using the
2065
2120
  same grouping elsewhere.
2066
2121
 
2122
+ ### Server-side grouping
2123
+
2124
+ With a `data-source`, `serverGroupingFeature` groups across all the data on the server instead of
2125
+ only the rows the grid has loaded. The query then carries `groupBy` and `groupPath`, and your source
2126
+ answers with **groups** instead of rows:
2127
+
2128
+ ```ts
2129
+ const source: DataSource<Bet> = async (query, { signal }) => {
2130
+ const res = await fetch('/api/bets/search', {
2131
+ method: 'POST',
2132
+ body: JSON.stringify(query),
2133
+ signal,
2134
+ })
2135
+ return res.json()
2136
+ }
2137
+ // query.groupBy = ['status', 'city'], query.groupPath = [] → the top-level groups
2138
+ // { groups: [{ value: 'Won', count: 1204, aggregates: { stake: 98211.5 } }, …], total: 4 }
2139
+ // query.groupPath = [{ key: 'status', value: 'Won' }] → the groups inside "Won"
2140
+ // { groups: [{ value: 'Niš', count: 310, aggregates: { … } }, …] }
2141
+ // query.groupPath = [{ key: 'status', value: 'Won' }, { key: 'city', value: 'Niš' }]
2142
+ // → the last level: { rows: [ …310 rows… ] }
2143
+ ```
2144
+
2145
+ ```vue
2146
+ <VGrid
2147
+ v-model:group-by="groupBy"
2148
+ v-model:selected="selected"
2149
+ v-model:selected-groups="selectedGroups"
2150
+ :data-source="source"
2151
+ :columns="columns"
2152
+ row-key="id"
2153
+ selectable
2154
+ :features="[serverDataFeature, rowGroupingFeature, serverGroupingFeature, selectionFeature]"
2155
+ />
2156
+ ```
2157
+
2158
+ - **Lazy.** The first request returns only the top-level groups (`value`, `count`, `aggregates`).
2159
+ Expanding a group asks for its sub-groups, or at the last level all its rows; a level loads
2160
+ once, with a loading row meanwhile and the error and Retry of lazy sub-grids when it fails
2161
+ (`load-error` fires). Requests for a group carry the current sort and filters, `page: 1`,
2162
+ `pageSize: null`.
2163
+ - **Paging.** `pagination` pages the top-level groups: return their number as `total`. Return
2164
+ `rowTotal` (every matching row) for the status bar; without it the groups' counts are added up.
2165
+ - **Sort, filters, page.** A new query asks for the top-level groups again; open groups load their
2166
+ contents again.
2167
+ - **Selection by query.** A group's checkbox selects it by its path in `v-model:selected-groups`
2168
+ (`[[{ key: 'status', value: 'Won' }]]`), without loading its rows; rows and sub-groups inside a
2169
+ selected group show ticked and locked. The header checkbox selects every top-level group. Act on
2170
+ `selectedGroups` + `selected` + the filters on the server. The selected groups end when the
2171
+ filters or the grouping change, or with `clearSelection()`; the status bar and the toolbar's
2172
+ `selectedCount` add their counts.
2173
+ - **Export, print, totals.** `exportCsv()`, `print()` and the others cover the rows that are loaded.
2174
+ For the totals row pass `aggregates` (the server's totals).
2175
+ - Without the feature, a grouped grid with a data source groups only the rows it has loaded (with
2176
+ a dev warning). A source that returns `rows` to a grouped query gets the same.
2177
+
2067
2178
  ## Export and copy
2068
2179
 
2069
2180
  `exportFeature` turns the grid's rows into CSV or an Excel workbook, prints them, and copies them to
@@ -2281,7 +2392,7 @@ and the grid's own controls (sort buttons, expanders, checkboxes, filter buttons
2281
2392
  normal Tab order.
2282
2393
 
2283
2394
  With `keyboardNavigationFeature` it is an ARIA `grid` (`treegrid` with sub-grids). The grid is one tab stop. Arrow keys move between cells (header, rows, sub-grid rows, detail rows),
2284
- `Home`/`End`, `Ctrl+Home`/`Ctrl+End`, `PageUp`/`PageDown`; `ContextMenu` / `Shift+F10` opens the context menu. `Enter` sorts a header or activates the
2395
+ `Home`/`End`, `Ctrl+Home`/`Ctrl+End`, `PageUp`/`PageDown`; `ContextMenu` / `Shift+F10` opens the context menu. `Enter` sorts a header (`Shift+Enter` adds it with `multi-sort`) or activates the
2285
2396
  cell's control; `Space` toggles row selection; `→`/`←` on a tree cell expands/collapses; `Alt+←/→` on a
2286
2397
  header moves the column; `Alt+Shift+←/→` on a header resizes it (with `columnResizingFeature`).
2287
2398
 
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # @nocopypaste/vue-grid
2
2
 
3
- > A Vue 3 data grid laid out with CSS Grid and `subgrid`. A plain grid is a read-only table (14.1 kB gzip); sorting, filtering, server data, pagination, selection, sub-grids, menus, column pinning / reordering / resizing / visibility / groups, pinned rows, totals, row grouping, CSV and Excel export, printing, copying, a status bar, virtual scrolling and keyboard navigation are opt-in features, and 29 cell renderers are opt-in imports. Every built-in text is translatable (`messages`) and every piece a feature adds can be turned off (`parts`). Typed end to end, accessible, themeable with CSS variables, mobile and touch ready.
3
+ > A Vue 3 data grid laid out with CSS Grid and `subgrid`. A plain grid is a read-only table (15.0 kB gzip); sorting, filtering, server data, pagination, selection, sub-grids, menus, column pinning / reordering / resizing / visibility / groups, pinned rows, totals, row grouping (also on the server), CSV and Excel export, printing, copying, a status bar, virtual scrolling and keyboard navigation are opt-in features, and 29 cell renderers are opt-in imports. Every built-in text is translatable (`messages`) and every piece a feature adds can be turned off (`parts`). Typed end to end, accessible, themeable with CSS variables, mobile and touch ready.
4
4
 
5
5
  Read AGENTS.md first: it lists the rules that cause silent bugs when skipped (register features, pass renderer definitions, `sort-mode="client"`, bounded height), a "which feature for what" table and copy-paste recipes. Validate a grid config with `validateGridConfig()` from `@nocopypaste/vue-grid/agent`.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocopypaste/vue-grid",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "CSS-Grid based data grid for Vue 3 with opt-in features, pluggable cell renderers, sub-grids and CSS-variable theming — documented for coding agents (AGENTS.md, llms.txt, JSON Schema, validator).",
5
5
  "license": "MIT",
6
6
  "type": "module",