@nocopypaste/vue-grid 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/AGENTS.md +28 -25
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +84 -25
  4. package/agent/api.json +18 -2
  5. package/agent/api.md +4 -2
  6. package/agent/grid-config.schema.json +6 -0
  7. package/dist/agent/api.js +16 -2
  8. package/dist/agent/requirements.js +1 -0
  9. package/dist/agent/requirements.js.map +1 -1
  10. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +406 -370
  11. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  12. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +3 -3
  13. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
  14. package/dist/composables/useDataSource.js +21 -19
  15. package/dist/composables/useDataSource.js.map +1 -1
  16. package/dist/composables/useGridExport.js +1 -1
  17. package/dist/composables/useGridExport.js.map +1 -1
  18. package/dist/composables/useRowGrouping.js +103 -74
  19. package/dist/composables/useRowGrouping.js.map +1 -1
  20. package/dist/composables/useServerGroups.js +106 -0
  21. package/dist/composables/useServerGroups.js.map +1 -0
  22. package/dist/core/grouping.js +41 -24
  23. package/dist/core/grouping.js.map +1 -1
  24. package/dist/features/index.js +12 -10
  25. package/dist/features/index.js.map +1 -1
  26. package/dist/features/serverGrouping.js +9 -0
  27. package/dist/features/serverGrouping.js.map +1 -0
  28. package/dist/index.js +7 -6
  29. package/dist/internal/features.js.map +1 -1
  30. package/dist/types/agent/requirements.d.ts +1 -1
  31. package/dist/types/components/VGrid.vue.d.ts +11 -2
  32. package/dist/types/composables/useDataSource.d.ts +33 -2
  33. package/dist/types/composables/useGridExport.d.ts +2 -0
  34. package/dist/types/composables/useRowGrouping.d.ts +12 -1
  35. package/dist/types/composables/useServerGroups.d.ts +37 -0
  36. package/dist/types/core/grouping.d.ts +26 -0
  37. package/dist/types/features/index.d.ts +2 -1
  38. package/dist/types/features/serverGrouping.d.ts +9 -0
  39. package/dist/types/index.d.ts +1 -1
  40. package/dist/types/internal/features.d.ts +2 -1
  41. package/dist/types/types.d.ts +5 -1
  42. package/llms-full.txt +116 -52
  43. package/llms.txt +1 -1
  44. package/package.json +1 -1
@@ -21,6 +21,18 @@ export interface RowGroup<T = any> {
21
21
  readonly children: readonly (RowGroup<T> | T)[];
22
22
  /** Aggregates of the group's rows, by column key (columns with an `aggregate`). */
23
23
  readonly aggregates: Readonly<Record<string, unknown>>;
24
+ /** How many rows it holds: `rows.length`, or the server's count (server data). */
25
+ readonly count: number;
26
+ /** The grouped columns' values from the top: `[{ key: 'status', value: 'Won' }, …]`. */
27
+ readonly path: readonly {
28
+ key: string;
29
+ value: unknown;
30
+ }[];
31
+ /**
32
+ * A group from the server (row grouping with server data): `rows` and `children` are empty and
33
+ * its contents load when it expands.
34
+ */
35
+ readonly server?: boolean;
24
36
  }
25
37
  /** A row of the grid is a group row, not a row of the data. */
26
38
  export declare function isRowGroup(row: unknown): row is RowGroup;
@@ -44,6 +56,20 @@ export interface GroupRowsOptions<T> {
44
56
  * sorted descending by that column.
45
57
  */
46
58
  export declare function groupRows<T>(rows: readonly T[], opts: GroupRowsOptions<T>): RowGroup<T>[];
59
+ /** The key of the group at a path (`[{ key: 'status', value: 'Won' }, …]`), as its group row has it. */
60
+ export declare function pathKey(path: readonly {
61
+ key: string;
62
+ value: unknown;
63
+ }[]): string;
64
+ /**
65
+ * Group rows for groups the server sent (row grouping with server data), at one level: their
66
+ * contents load when they expand. `parent` is the group they are inside (none at the top).
67
+ */
68
+ export declare function serverGroups<T>(groups: readonly {
69
+ value: unknown;
70
+ count: number;
71
+ aggregates?: Record<string, unknown>;
72
+ }[], column: ColumnDef<T>, parent?: RowGroup<T>): RowGroup<T>[];
47
73
  /** Pre-order walk over groups and their sub-groups (not their rows). */
48
74
  export declare function walkGroups<T>(groups: readonly (RowGroup<T> | T)[], visit: (group: RowGroup<T>) => void): void;
49
75
  /** Row keys of every group in the tree. */
@@ -14,10 +14,11 @@ import { rowGroupingFeature } from './rowGrouping';
14
14
  import { rowPinningFeature } from './rowPinning';
15
15
  import { selectionFeature } from './selection';
16
16
  import { serverDataFeature } from './serverData';
17
+ import { serverGroupingFeature } from './serverGrouping';
17
18
  import { sortingFeature } from './sorting';
18
19
  import { statusBarFeature } from './statusBar';
19
20
  import { subGridsFeature } from './subGrids';
20
21
  import { virtualScrollingFeature } from './virtualScrolling';
21
- export { aggregationFeature, columnGroupsFeature, columnPinningFeature, columnReorderFeature, columnResizingFeature, columnVisibilityFeature, exportFeature, filteringFeature, keyboardNavigationFeature, menusFeature, paginationFeature, rowGroupingFeature, rowPinningFeature, selectionFeature, serverDataFeature, sortingFeature, statusBarFeature, subGridsFeature, virtualScrollingFeature, };
22
+ export { aggregationFeature, columnGroupsFeature, columnPinningFeature, columnReorderFeature, columnResizingFeature, columnVisibilityFeature, exportFeature, filteringFeature, keyboardNavigationFeature, menusFeature, paginationFeature, rowGroupingFeature, rowPinningFeature, selectionFeature, serverDataFeature, serverGroupingFeature, sortingFeature, statusBarFeature, subGridsFeature, virtualScrollingFeature, };
22
23
  /** Every built-in feature, for apps that want them all: `createVueGrid({ features: allFeatures })`. */
23
24
  export declare const allFeatures: readonly GridFeature[];
@@ -0,0 +1,9 @@
1
+ import type { ServerGroupingFeature } from '../types';
2
+ /**
3
+ * Row grouping with server data: with `group-by` and a `data-source`, the query carries `groupBy` and
4
+ * `groupPath`, the server answers with groups (value, count, aggregates), and each group's contents
5
+ * load when it expands. A group's checkbox selects it by query (`v-model:selected-groups`), without
6
+ * loading its rows. Needs the row grouping and server data features too. Without it, a grouped
7
+ * server grid groups only the rows it has loaded.
8
+ */
9
+ export declare const serverGroupingFeature: ServerGroupingFeature;
@@ -14,7 +14,7 @@ export { groupRows, isRowGroup, type RowGroup, type GroupRowsOptions } from './c
14
14
  export { toCsv, toDelimited, plainText, guardFormula, type ToCsvOptions } from './core/csv';
15
15
  export { toXlsx, type ToXlsxOptions, type XlsxFormat } from './core/xlsx';
16
16
  export { patchRows, type RowPatches, type PatchRowsOptions } from './core/patch';
17
- export type { DataSource, DataSourceResult, GridQuery } from './composables/useDataSource';
17
+ export type { DataSource, DataSourceResult, GridQuery, GroupPath, ServerGroup, } from './composables/useDataSource';
18
18
  export { activeFilterCount, emptyFilters, filterTree, foldText, isFilterActive, localFilterStorage, matchesFilter, parseQuickFilter, setKey, type BooleanFilter, type CustomFilter, type DateFilter, type DateFilterOp, type NumberFilter, type NumberFilterOp, type SetFilter, type TextFilter, type TextFilterOp, } from './core/filter';
19
19
  export { localStorageAdapter } from './core/storage';
20
20
  export { pageItems, type PageItem } from './core/pagination';
@@ -1,4 +1,4 @@
1
- import type { AggregationFeature, ExportFeature, RowGroupingFeature, RowPinningFeature, ColumnGroupsFeature, ColumnPinningFeature, ColumnResizingFeature, ColumnReorderFeature, ColumnVisibilityFeature, FilteringFeature, KeyboardNavigationFeature, GridFeature, MenusFeature, PaginationFeature, SelectionFeature, ServerDataFeature, SortingFeature, StatusBarFeature, SubGridsFeature, VirtualScrollingFeature } from '../types';
1
+ import type { AggregationFeature, ExportFeature, RowGroupingFeature, RowPinningFeature, ColumnGroupsFeature, ColumnPinningFeature, ColumnResizingFeature, ColumnReorderFeature, ColumnVisibilityFeature, FilteringFeature, KeyboardNavigationFeature, GridFeature, MenusFeature, PaginationFeature, SelectionFeature, ServerDataFeature, ServerGroupingFeature, SortingFeature, StatusBarFeature, SubGridsFeature, VirtualScrollingFeature } from '../types';
2
2
  /** The features a grid has, by name. */
3
3
  export interface FeatureSet {
4
4
  sorting?: SortingFeature;
@@ -20,6 +20,7 @@ export interface FeatureSet {
20
20
  rowGrouping?: RowGroupingFeature;
21
21
  export?: ExportFeature;
22
22
  statusBar?: StatusBarFeature;
23
+ serverGrouping?: ServerGroupingFeature;
23
24
  }
24
25
  /** Merges feature lists (app-wide, then per grid); a later entry with the same name wins. */
25
26
  export declare function resolveFeatures(...lists: (readonly GridFeature[] | undefined)[]): FeatureSet;
@@ -574,7 +574,11 @@ export interface StatusBarFeature {
574
574
  /** The status bar's default content. */
575
575
  StatusBar: Component;
576
576
  }
577
- export type GridFeature = StatusBarFeature | ExportFeature | RowGroupingFeature | AggregationFeature | RowPinningFeature | ColumnGroupsFeature | ColumnResizingFeature | KeyboardNavigationFeature | ColumnVisibilityFeature | VirtualScrollingFeature | ColumnReorderFeature | ColumnPinningFeature | SortingFeature | FilteringFeature | ServerDataFeature | PaginationFeature | SelectionFeature | SubGridsFeature | MenusFeature;
577
+ export interface ServerGroupingFeature {
578
+ readonly feature: 'serverGrouping';
579
+ useServerGroups: typeof import('./composables/useServerGroups').useServerGroups;
580
+ }
581
+ export type GridFeature = ServerGroupingFeature | StatusBarFeature | ExportFeature | RowGroupingFeature | AggregationFeature | RowPinningFeature | ColumnGroupsFeature | ColumnResizingFeature | KeyboardNavigationFeature | ColumnVisibilityFeature | VirtualScrollingFeature | ColumnReorderFeature | ColumnPinningFeature | SortingFeature | FilteringFeature | ServerDataFeature | PaginationFeature | SelectionFeature | SubGridsFeature | MenusFeature;
578
582
  export type GridFeatureName = GridFeature['feature'];
579
583
  export interface VueGridConfig {
580
584
  /** Renderers every grid can use by name (`renderer: 'currency'`); `allRenderers` for all of them. */
package/llms-full.txt CHANGED
@@ -45,31 +45,32 @@ runs in the [live examples](https://eboye.github.io/eboye-vue-grid/), each with
45
45
 
46
46
  ## Which feature for what
47
47
 
48
- | The user wants… | Feature(s) | 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
+ | Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
52
+ | Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
53
+ | Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
54
+ | Checkboxes / row selection, batch actions | `selectionFeature` | `selectable` (or `'single'`), `v-model:selected`, `is-row-selectable`, `prune-selection`; `#toolbar="{ selected, selectedCount, clearSelection }"`; server data: `v-model:select-all-matching` |
55
+ | Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
56
+ | An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
57
+ | 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
58
+ | Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
59
+ | Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`; on narrow grids they scroll unless `pinned-max-share` allows (default half the width) |
60
+ | Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
61
+ | Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
62
+ | Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
63
+ | Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
64
+ | Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
65
+ | A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
66
+ | Group server data across all rows (not the page) | `serverGroupingFeature` (+ `rowGroupingFeature`, `serverDataFeature`) | return `{ groups: [{ value, count, aggregates }], total }` for `query.groupBy` / `query.groupPath`, `{ rows }` at the last level; `v-model:selected-groups` |
67
+ | Group rows by a column ("by status, then city") | `rowGroupingFeature` | `v-model:group-by="['status', 'city']"`, `groups-expanded`; column `groupable: true` (header menu), `groupValue: (row) => …` (e.g. month); `aggregate` shows per group |
68
+ | Download CSV / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
69
+ | Row / selection counts, sum of the selected rows | `statusBarFeature` | `status-bar` (or `{ summary: ['total'], aggregates?: ['sum', 'avg'] }`); `#status-bar="{ rowCount, selectedCount, summary, … }"` |
70
+ | Translate / reword the grid, drop built-in pieces | — | `messages` (`GridMessages`), `parts` (`GridParts`): app-wide in `createVueGrid` or per grid; slots `#load-error`, `#no-match`, `#select-all-banner` |
71
+ | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
72
+ | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
73
+ | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
73
74
 
74
75
  ## Renderers (pick by data)
75
76
 
@@ -518,6 +519,8 @@ only sees stylesheet rules. Density:
518
519
  - Printing the page (Ctrl+P) shows only the rows on screen, clipped to the grid → use `grid.print()`.
519
520
  - Translating by replacing components or CSS `content` → set `messages` (every built-in text has a key).
520
521
  - Hiding a built-in piece with CSS → `parts: { filterButtons: false, … }` leaves it out of the DOM (and the tab order).
522
+ - Grouped server data shows groups of one page only → add `serverGroupingFeature` and answer `query.groupBy` with `{ groups }` (`count` per group, `total` = number of groups).
523
+ - A batch action on a selected server group touched only loaded rows → act on `selectedGroups` (paths) with the filters on the server.
521
524
  - Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
522
525
  (CSV exports are raw by default).
523
526
  - `group-by` names a field, not a column → it takes column `key`s; add a (hidden) column for it.
@@ -528,7 +531,7 @@ only sees stylesheet rules. Density:
528
531
 
529
532
  ---
530
533
 
531
- # @nocopypaste/vue-grid 0.7.0 — API reference
534
+ # @nocopypaste/vue-grid 0.8.0 — API reference
532
535
 
533
536
  > Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
534
537
 
@@ -553,6 +556,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
553
556
  | `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
557
  | `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
558
  | `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` | |
559
+ | `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` | |
556
560
  | `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` |
557
561
  | `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
562
  | `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` | |
@@ -623,6 +627,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
623
627
  | `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
628
  | `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
629
  | `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. |
630
+ | `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
631
 
627
632
  ## Events
628
633
 
@@ -654,7 +659,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
654
659
  | `status-bar` | `StatusBarScope` | The status bar's content (status bar feature): replaces the counts and the summary. |
655
660
  | `loading` | | Shown while loading with no rows yet. |
656
661
  | `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. |
662
+ | `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
663
 
659
664
  ## Exposed methods (`ref<VGridExposed>()`)
660
665
 
@@ -1328,6 +1333,7 @@ an opt-in feature:
1328
1333
  | `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
1334
  | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
1330
1335
  | `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 |
1336
+ | `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
1337
  | `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
1338
  | `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
1339
 
@@ -1373,33 +1379,34 @@ what you import.
1373
1379
 
1374
1380
  | Import (minified / gzip, Vue excluded) | Initial chunk |
1375
1381
  | ---------------------------------------------------------------------------- | ------------------ |
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 |
1382
+ | `VGrid` (no features) | 43.1 kB / 14.8 kB |
1383
+ | `VGrid` + `sortingFeature` | 43.8 kB / 15.1 kB |
1384
+ | `VGrid` + `filteringFeature` | 53.8 kB / 18.6 kB |
1385
+ | `VGrid` + `serverDataFeature` | 44.5 kB / 15.4 kB |
1386
+ | `VGrid` + `paginationFeature` | 43.2 kB / 14.8 kB |
1387
+ | `VGrid` + `selectionFeature` | 47.2 kB / 16.2 kB |
1388
+ | `VGrid` + `subGridsFeature` | 45.4 kB / 15.6 kB |
1389
+ | `VGrid` + `menusFeature` | 53.9 kB / 18.4 kB |
1390
+ | `VGrid` + `columnReorderFeature` | 46.7 kB / 16.0 kB |
1391
+ | `VGrid` + `columnPinningFeature` | 46.0 kB / 15.8 kB |
1392
+ | `VGrid` + `virtualScrollingFeature` | 48.8 kB / 17.0 kB |
1393
+ | `VGrid` + `columnVisibilityFeature` | 43.2 kB / 14.8 kB |
1394
+ | `VGrid` + `keyboardNavigationFeature` | 45.8 kB / 15.8 kB |
1395
+ | `VGrid` + `columnResizingFeature` | 46.3 kB / 16.0 kB |
1396
+ | `VGrid` + `columnGroupsFeature` | 44.4 kB / 15.2 kB |
1397
+ | `VGrid` + `rowPinningFeature` | 48.0 kB / 16.1 kB |
1398
+ | `VGrid` + `aggregationFeature` | 48.2 kB / 16.2 kB |
1399
+ | `VGrid` + `rowGroupingFeature` | 53.8 kB / 18.3 kB |
1400
+ | `VGrid` + `exportFeature` | 48.0 kB / 16.7 kB |
1401
+ | `VGrid` + `statusBarFeature` | 45.5 kB / 15.7 kB |
1402
+ | `VGrid` + `serverGroupingFeature` | 46.2 kB / 15.9 kB |
1403
+ | `VGrid` + `allFeatures` + `VGridSearch` | 115.0 kB / 38.6 kB |
1404
+ | `VGrid` + `currencyRenderer` | 44.4 kB / 15.2 kB |
1405
+ | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 50.3 kB / 17.2 kB |
1399
1406
  | `sortRows` only | 0.7 kB / 0.4 kB |
1400
1407
  | `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 |
1408
+ | everything | 168.7 kB / 54.0 kB |
1409
+ | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 72.9 kB / 19.8 kB |
1403
1410
 
1404
1411
  With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
1405
1412
  chunks**: they load the first time a popover opens or `filter-row` is on. With
@@ -1454,6 +1461,7 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1454
1461
  | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
1455
1462
  | `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
1463
  | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
1464
+ | `v-model:selectedGroups` | `GroupPath[]` | `[]` | Server-side grouping: groups selected by query, by path (`[[{ key, value }]]`), without their rows. |
1457
1465
  | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
1458
1466
  | `rowClass` | `(row, index) => ClassValue` | — | |
1459
1467
  | `highlightedRows` | `RowKey[]` | — | |
@@ -2064,6 +2072,62 @@ Style group rows with `.vg-rowgroup` (and `[data-group-level]`), `.vg-rowgroup-n
2064
2072
  `--vg-rowgroup-font-weight` tokens. `groupRows()` and `isRowGroup()` are exported for using the
2065
2073
  same grouping elsewhere.
2066
2074
 
2075
+ ### Server-side grouping
2076
+
2077
+ With a `data-source`, `serverGroupingFeature` groups across all the data on the server instead of
2078
+ only the rows the grid has loaded. The query then carries `groupBy` and `groupPath`, and your source
2079
+ answers with **groups** instead of rows:
2080
+
2081
+ ```ts
2082
+ const source: DataSource<Bet> = async (query, { signal }) => {
2083
+ const res = await fetch('/api/bets/search', {
2084
+ method: 'POST',
2085
+ body: JSON.stringify(query),
2086
+ signal,
2087
+ })
2088
+ return res.json()
2089
+ }
2090
+ // query.groupBy = ['status', 'city'], query.groupPath = [] → the top-level groups
2091
+ // { groups: [{ value: 'Won', count: 1204, aggregates: { stake: 98211.5 } }, …], total: 4 }
2092
+ // query.groupPath = [{ key: 'status', value: 'Won' }] → the groups inside "Won"
2093
+ // { groups: [{ value: 'Niš', count: 310, aggregates: { … } }, …] }
2094
+ // query.groupPath = [{ key: 'status', value: 'Won' }, { key: 'city', value: 'Niš' }]
2095
+ // → the last level: { rows: [ …310 rows… ] }
2096
+ ```
2097
+
2098
+ ```vue
2099
+ <VGrid
2100
+ v-model:group-by="groupBy"
2101
+ v-model:selected="selected"
2102
+ v-model:selected-groups="selectedGroups"
2103
+ :data-source="source"
2104
+ :columns="columns"
2105
+ row-key="id"
2106
+ selectable
2107
+ :features="[serverDataFeature, rowGroupingFeature, serverGroupingFeature, selectionFeature]"
2108
+ />
2109
+ ```
2110
+
2111
+ - **Lazy.** The first request returns only the top-level groups (`value`, `count`, `aggregates`).
2112
+ Expanding a group asks for its sub-groups, or at the last level all its rows; a level loads
2113
+ once, with a loading row meanwhile and the error and Retry of lazy sub-grids when it fails
2114
+ (`load-error` fires). Requests for a group carry the current sort and filters, `page: 1`,
2115
+ `pageSize: null`.
2116
+ - **Paging.** `pagination` pages the top-level groups: return their number as `total`. Return
2117
+ `rowTotal` (every matching row) for the status bar; without it the groups' counts are added up.
2118
+ - **Sort, filters, page.** A new query asks for the top-level groups again; open groups load their
2119
+ contents again.
2120
+ - **Selection by query.** A group's checkbox selects it by its path in `v-model:selected-groups`
2121
+ (`[[{ key: 'status', value: 'Won' }]]`), without loading its rows; rows and sub-groups inside a
2122
+ selected group show ticked and locked. The header checkbox selects every top-level group. Act on
2123
+ `selectedGroups` + `selected` + the filters on the server. The selected groups end when the
2124
+ filters or the grouping change, or with `clearSelection()`; the status bar and the toolbar's
2125
+ `selectedCount` add their counts.
2126
+ - **Export, print, totals.** `exportCsv()`, `print()` and the others cover the rows that are loaded.
2127
+ For the totals row pass `aggregates` (the server's totals).
2128
+ - Without the feature, a grouped grid with a data source groups only the rows it has loaded (with
2129
+ a dev warning). A source that returns `rows` to a grouped query gets the same.
2130
+
2067
2131
  ## Export and copy
2068
2132
 
2069
2133
  `exportFeature` turns the grid's rows into CSV or an Excel workbook, prints them, and copies them to
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 (14.8 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.8.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",