@nocopypaste/vue-grid 0.10.0 → 0.12.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 (65) hide show
  1. package/AGENTS.md +56 -29
  2. package/CHANGELOG.md +31 -0
  3. package/README.md +114 -29
  4. package/agent/api.json +43 -1
  5. package/agent/api.md +7 -1
  6. package/agent/grid-config.schema.json +8 -0
  7. package/dist/agent/api.js +40 -1
  8. package/dist/agent/requirements.js +3 -1
  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 +320 -288
  12. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +15 -8
  14. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VGridSortMarker.vue_vue_type_script_setup_true_lang.js +1 -1
  16. package/dist/components/VGridSortMarker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js +29 -22
  18. package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/composables/useCellRange.js +206 -0
  20. package/dist/composables/useCellRange.js.map +1 -0
  21. package/dist/composables/useStatusBar.js +17 -0
  22. package/dist/composables/useStatusBar.js.map +1 -1
  23. package/dist/core.css +1 -1
  24. package/dist/features/index.js +23 -21
  25. package/dist/features/index.js.map +1 -1
  26. package/dist/features/rangeSelection.js +9 -0
  27. package/dist/features/rangeSelection.js.map +1 -0
  28. package/dist/index.js +12 -11
  29. package/dist/internal/context.js.map +1 -1
  30. package/dist/internal/features.js.map +1 -1
  31. package/dist/locales/de.js +137 -0
  32. package/dist/locales/de.js.map +1 -0
  33. package/dist/locales/en.js +137 -0
  34. package/dist/locales/en.js.map +1 -0
  35. package/dist/locales/es.js +155 -0
  36. package/dist/locales/es.js.map +1 -0
  37. package/dist/locales/fr.js +155 -0
  38. package/dist/locales/fr.js.map +1 -0
  39. package/dist/locales/plural.js +11 -0
  40. package/dist/locales/plural.js.map +1 -0
  41. package/dist/locales/sr-Latn.js +140 -0
  42. package/dist/locales/sr-Latn.js.map +1 -0
  43. package/dist/locales/sr.js +140 -0
  44. package/dist/locales/sr.js.map +1 -0
  45. package/dist/theme.css +1 -1
  46. package/dist/types/agent/requirements.d.ts +1 -1
  47. package/dist/types/components/VGrid.vue.d.ts +14 -2
  48. package/dist/types/composables/useCellRange.d.ts +72 -0
  49. package/dist/types/composables/useStatusBar.d.ts +7 -0
  50. package/dist/types/features/index.d.ts +2 -1
  51. package/dist/types/features/rangeSelection.d.ts +9 -0
  52. package/dist/types/internal/context.d.ts +2 -0
  53. package/dist/types/internal/features.d.ts +2 -1
  54. package/dist/types/locales/de.d.ts +125 -0
  55. package/dist/types/locales/en.d.ts +128 -0
  56. package/dist/types/locales/es.d.ts +125 -0
  57. package/dist/types/locales/fr.d.ts +125 -0
  58. package/dist/types/locales/plural.d.ts +11 -0
  59. package/dist/types/locales/sr-Latn.d.ts +125 -0
  60. package/dist/types/locales/sr.d.ts +125 -0
  61. package/dist/types/types.d.ts +67 -10
  62. package/dist/vue-grid.css +1 -1
  63. package/llms-full.txt +177 -59
  64. package/llms.txt +1 -1
  65. package/package.json +5 -1
package/llms-full.txt CHANGED
@@ -49,34 +49,35 @@ runs in the [live examples](https://eboye.github.io/eboye-vue-grid/), each with
49
49
 
50
50
  ## Which feature for what
51
51
 
52
- | The user wants… | Feature(s) | Props / column options |
53
- | ------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
- | Click a header to sort | `sortingFeature` | column `sortable: true`; `sort-mode="client"` (or handle `v-model:sort`) |
55
- | Sort by several columns ("city, then stake") | `sortingFeature` | `multi-sort`, `v-model:sorts="[{ key, dir }, …]"`; Shift-click adds a column; server: `query.sorts` |
56
- | Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
57
- | Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
58
- | Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
59
- | 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` |
60
- | Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
61
- | An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
62
- | 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
63
- | Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
64
- | Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`; on narrow grids they scroll unless `pinned-max-share` allows (default half the width) |
65
- | Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
66
- | Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
67
- | Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
68
- | Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
69
- | Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
70
- | A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
71
- | 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` |
72
- | 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 |
73
- | Download CSV / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
74
- | Row / selection counts, sum of the selected rows | `statusBarFeature` | `status-bar` (or `{ summary: ['total'], aggregates?: ['sum', 'avg'] }`); `#status-bar="{ rowCount, selectedCount, summary, … }"` |
75
- | Edit cells in place (spreadsheet-like) | `editingFeature` (+ `keyboardNavigationFeature` for typing / Enter) | column `editable: true \| (row) => boolean`, `editor`, `editorOptions`, `validate`; `@cell-edit` (store `value`: `setCellValue(e.row, e.column, e.value)`), `:save-cell` (async, rejection = error) |
76
- | 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` |
77
- | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
78
- | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
79
- | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
52
+ | The user wants… | Feature(s) | Props / column options |
53
+ | ------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | Click a header to sort | `sortingFeature` | column `sortable: true`; `sort-mode="client"` (or handle `v-model:sort`) |
55
+ | Sort by several columns ("city, then stake") | `sortingFeature` | `multi-sort`, `v-model:sorts="[{ key, dir }, …]"`; Shift-click adds a column; server: `query.sorts` |
56
+ | Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
57
+ | Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
58
+ | Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
59
+ | 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` |
60
+ | Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
61
+ | An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
62
+ | 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
63
+ | Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
64
+ | Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`; on narrow grids they scroll unless `pinned-max-share` allows (default half the width) |
65
+ | Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
66
+ | Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
67
+ | Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
68
+ | Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
69
+ | Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
70
+ | A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
71
+ | 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` |
72
+ | 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 |
73
+ | Download CSV / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
74
+ | Row / selection counts, sum of the selected rows | `statusBarFeature` | `status-bar` (or `{ summary: ['total'], aggregates?: ['sum', 'avg'] }`); `#status-bar="{ rowCount, selectedCount, summary, … }"` |
75
+ | Edit cells in place (spreadsheet-like) | `editingFeature` (+ `keyboardNavigationFeature` for typing / Enter) | column `editable: true \| (row) => boolean`, `editor`, `editorOptions`, `validate`; `@cell-edit` (store `value`: `setCellValue(e.row, e.column, e.value)`), `:save-cell` (async, rejection = error) |
76
+ | Select a block of cells, copy it, add it up | `rangeSelectionFeature` (+ `keyboardNavigationFeature`, `statusBarFeature`) | `range-selection`, `v-model:range="{ start: { rowKey, columnKey }, end }"`; `@copy` (`kind: 'range'`), `copyRange()`, `getRangeValues()`, `selectRange()` |
77
+ | Translate / reword the grid, drop built-in pieces | — | a language pack (`import { de } from '@nocopypaste/vue-grid/locales/de'`; also `fr`, `es`, `sr`, `sr-Latn`) or your own `messages` (`GridMessages`), `parts` (`GridParts`): app-wide in `createVueGrid` or per grid; slots `#load-error`, `#no-match`, `#select-all-banner` |
78
+ | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
79
+ | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
80
+ | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
80
81
 
81
82
  ## Renderers (pick by data)
82
83
 
@@ -484,6 +485,24 @@ The editor comes from the renderer (number, date, datetime, select, checkbox, te
484
485
  (a name or your component). Double-click / Enter / F2 / typing opens it; Enter saves, Tab moves to
485
486
  the next editable cell, Esc cancels.
486
487
 
488
+ ### Cell-range selection
489
+
490
+ ```vue
491
+ <VGrid
492
+ v-model:range="range"
493
+ :rows
494
+ :columns
495
+ row-key="id"
496
+ range-selection
497
+ status-bar
498
+ :features="[rangeSelectionFeature, keyboardNavigationFeature, statusBarFeature]"
499
+ />
500
+ <!-- drag / Shift+click / Shift+arrows select; Ctrl/⌘+C copies tab-separated; the bar shows sum and average -->
501
+ ```
502
+
503
+ `range` is `{ start, end }` (each `{ rowKey, columnKey }`) or null; it is not row selection
504
+ (`selected`), and both can be on.
505
+
487
506
  ### Editable checkbox (controlled)
488
507
 
489
508
  ```ts
@@ -534,6 +553,10 @@ only sees stylesheet rules. Density:
534
553
  - Nothing sorts → `sort-mode="client"` missing (or `sortingFeature` missing).
535
554
  - An edited cell snaps back to its old value → nothing stores it: handle `@cell-edit` (or
536
555
  `save-cell`) and write `e.value` into reactive rows (`setCellValue`); the grid never does.
556
+ - Dragging across cells selects text, not a range → add `range-selection` (and
557
+ `rangeSelectionFeature`); `selectable` only selects whole rows.
558
+ - Building copy-a-block by hand from `selected` rows and a column picker → `range-selection` copies
559
+ the block (Ctrl/⌘+C or `copyRange()`), as displayed and tab-separated.
537
560
  - Typing / Enter on a cell doesn't start editing → cells only take focus with
538
561
  `keyboardNavigationFeature`; without it, double-click.
539
562
  - 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`.
@@ -553,7 +576,11 @@ only sees stylesheet rules. Density:
553
576
  (or select rows first); `exportFeature` must be registered too.
554
577
  - An exported column of `⋯` / buttons / `[object Object]` → `exportable: false`, or `exportValue: (row) => …`.
555
578
  - Printing the page (Ctrl+P) shows only the rows on screen, clipped to the grid → use `grid.print()`.
556
- - Translating by replacing components or CSS `content` → set `messages` (every built-in text has a key).
579
+ - Translating by replacing components or CSS `content` → set `messages` (every built-in text has a
580
+ key); for German, French, Spanish or Serbian import the ready-made pack
581
+ (`@nocopypaste/vue-grid/locales/de` …) instead of writing it.
582
+ - Text translated but money / dates still formatted in English → a pack only translates text; set
583
+ `locale` too (`createVueGrid({ messages: de, locale: 'de' })`).
557
584
  - Hiding a built-in piece with CSS → `parts: { filterButtons: false, … }` leaves it out of the DOM (and the tab order).
558
585
  - Grouped server data shows groups of one page only → add `serverGroupingFeature` and answer `query.groupBy` with `{ groups }` (`count` per group, `total` = number of groups).
559
586
  - A batch action on a selected server group touched only loaded rows → act on `selectedGroups` (paths) with the filters on the server.
@@ -567,7 +594,7 @@ only sees stylesheet rules. Density:
567
594
 
568
595
  ---
569
596
 
570
- # @nocopypaste/vue-grid 0.10.0 — API reference
597
+ # @nocopypaste/vue-grid 0.12.0 — API reference
571
598
 
572
599
  > Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
573
600
 
@@ -589,6 +616,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
589
616
  | `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. | | |
590
617
  | `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` | |
591
618
  | `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` | |
619
+ | `rangeSelectionFeature` | Cell-range selection, as in a spreadsheet (`range-selection`, `v-model:range`): drag across cells or Shift+click to select a block, Shift+arrows to extend it (with `keyboardNavigationFeature`), Ctrl/⌘+A for every cell, Esc to clear. Ctrl/⌘+C copies it as tab-separated text, as the cells show it, and the status bar (`statusBarFeature`) shows its count, sum and average. Separate from row selection (`selectable`): both can be on. | `rangeSelection` `range` | |
592
620
  | `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` |
593
621
  | `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` | |
594
622
  | `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` | |
@@ -611,6 +639,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
611
639
  | `pagination` | `boolean \| PaginationOptions` | `false` | `paginationFeature` | Built-in pagination under the grid (server-side with `dataSource`, client-side otherwise). |
612
640
  | `statusBar` | `boolean \| StatusBarOptions` | | `statusBarFeature` | A status bar under the grid (status bar feature): rows that pass the filters ("84 of 200 rows"), selected rows, active filters with Clear; `{ summary: ['total'] }` adds the sum and average of those columns over the selected rows. `#status-bar` replaces its content. |
613
641
  | `saveCell` | `(event: CellEditEvent<T>) => unknown` | | `editingFeature` | Saves an edited cell (editing feature), after `cell-edit`: return a Promise and the cell shows it saving; a rejection keeps the editor open with the error's message. Without it, `cell-edit` alone carries the change. |
642
+ | `rangeSelection` | `boolean` | | `rangeSelectionFeature` | Cell-range selection (range selection feature), as in a spreadsheet: drag across cells or Shift+click to select a block, Shift+arrows to extend it, Ctrl/⌘+A for every cell, Esc to clear; Ctrl/⌘+C copies it. Bind `v-model:range` to read or set it. |
614
643
  | `messages` | `GridMessages` | | | Built-in text (translations, wording), over `createVueGrid({ messages })`. |
615
644
  | `parts` | `GridParts` | | | Built-in parts to leave out (`{ progressBar: false }`), over `createVueGrid({ parts })`. |
616
645
  | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | | `controlled` (default): a header click only updates `v-model:sort` (sort on the server or in your own code). `client`: the grid sorts the rows itself. Ignored with `dataSource`. |
@@ -668,6 +697,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
668
697
  | `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. |
669
698
  | `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. |
670
699
  | `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. |
700
+ | `v-model:range` | `CellRange \| null` | `null` | `rangeSelectionFeature` | The selected block of cells (`range-selection`): `{ start, end }` corner cells by row key and column key, or null. One cell alone is no range. Needs the range selection feature. |
671
701
 
672
702
  ## Events
673
703
 
@@ -727,6 +757,9 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
727
757
  | `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. |
728
758
  | `startEdit` | `boolean` | | Opens the editor of a cell (editing feature), if the column is `editable` for that row and the row is on screen. Returns whether it opened. |
729
759
  | `stopEdit` | `void` | | Closes the open editor: saves its value, or with `cancel` drops it. Editing feature. |
760
+ | `selectRange` | `void` | | Selects a block of cells (`null` clears it), as `v-model:range` does. Range selection feature, with `range-selection`. |
761
+ | `getRangeValues` | `unknown[][]` | | The selected range's raw values, row by row (`[]` without a range). Range selection feature. |
762
+ | `copyRange` | `Promise<boolean>` | | Copies the selected range as tab-separated text, as the cells show it (Ctrl/⌘+C does the same). Resolves `false` without a range. Range selection feature. |
730
763
 
731
764
  ## `ColumnDef<T>`
732
765
 
@@ -1384,6 +1417,7 @@ an opt-in feature:
1384
1417
  | `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` |
1385
1418
  | `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 |
1386
1419
  | `editingFeature` | `editable` columns: an editor in the cell (text, number, date, select, checkbox, or your own) on double-click, Enter / F2 or typing; `cell-edit`, and `save-cell` for async saves. See [Inline editing](#inline-editing) |
1420
+ | `rangeSelectionFeature` | `range-selection`: drag, Shift+click or Shift+arrows select a block of cells, Ctrl/⌘+C copies it (tab-separated, pastes into spreadsheets), the status bar adds it up; `v-model:range`. See [Cell-range selection](#cell-range-selection) |
1387
1421
 
1388
1422
  ```ts
1389
1423
  // per grid
@@ -1427,35 +1461,36 @@ what you import.
1427
1461
 
1428
1462
  | Import (minified / gzip, Vue excluded) | Initial chunk |
1429
1463
  | ---------------------------------------------------------------------------- | ------------------ |
1430
- | `VGrid` (no features) | 44.5 kB / 15.3 kB |
1431
- | `VGrid` + `sortingFeature` | 47.2 kB / 16.3 kB |
1432
- | `VGrid` + `filteringFeature` | 55.2 kB / 19.1 kB |
1433
- | `VGrid` + `serverDataFeature` | 45.9 kB / 15.9 kB |
1434
- | `VGrid` + `paginationFeature` | 44.6 kB / 15.3 kB |
1435
- | `VGrid` + `selectionFeature` | 48.6 kB / 16.7 kB |
1436
- | `VGrid` + `subGridsFeature` | 46.8 kB / 16.1 kB |
1437
- | `VGrid` + `menusFeature` | 55.7 kB / 19.1 kB |
1438
- | `VGrid` + `columnReorderFeature` | 48.1 kB / 16.5 kB |
1439
- | `VGrid` + `columnPinningFeature` | 47.4 kB / 16.3 kB |
1440
- | `VGrid` + `virtualScrollingFeature` | 50.2 kB / 17.5 kB |
1441
- | `VGrid` + `columnVisibilityFeature` | 44.6 kB / 15.3 kB |
1442
- | `VGrid` + `keyboardNavigationFeature` | 47.2 kB / 16.3 kB |
1443
- | `VGrid` + `columnResizingFeature` | 47.7 kB / 16.5 kB |
1444
- | `VGrid` + `columnGroupsFeature` | 45.8 kB / 15.7 kB |
1445
- | `VGrid` + `rowPinningFeature` | 49.4 kB / 16.6 kB |
1446
- | `VGrid` + `aggregationFeature` | 49.6 kB / 16.7 kB |
1447
- | `VGrid` + `rowGroupingFeature` | 55.3 kB / 18.8 kB |
1448
- | `VGrid` + `exportFeature` | 49.4 kB / 17.2 kB |
1449
- | `VGrid` + `statusBarFeature` | 46.9 kB / 16.2 kB |
1450
- | `VGrid` + `serverGroupingFeature` | 47.6 kB / 16.4 kB |
1451
- | `VGrid` + `editingFeature` | 48.8 kB / 17.0 kB |
1452
- | `VGrid` + `allFeatures` + `VGridSearch` | 123.4 kB / 41.7 kB |
1453
- | `VGrid` + `currencyRenderer` | 45.8 kB / 15.7 kB |
1454
- | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 51.7 kB / 17.7 kB |
1464
+ | `VGrid` (no features) | 45.3 kB / 15.5 kB |
1465
+ | `VGrid` + `sortingFeature` | 48.0 kB / 16.5 kB |
1466
+ | `VGrid` + `filteringFeature` | 56.0 kB / 19.4 kB |
1467
+ | `VGrid` + `serverDataFeature` | 46.7 kB / 16.1 kB |
1468
+ | `VGrid` + `paginationFeature` | 45.4 kB / 15.6 kB |
1469
+ | `VGrid` + `selectionFeature` | 49.4 kB / 17.0 kB |
1470
+ | `VGrid` + `subGridsFeature` | 47.6 kB / 16.3 kB |
1471
+ | `VGrid` + `menusFeature` | 56.6 kB / 19.3 kB |
1472
+ | `VGrid` + `columnReorderFeature` | 49.0 kB / 16.8 kB |
1473
+ | `VGrid` + `columnPinningFeature` | 48.2 kB / 16.5 kB |
1474
+ | `VGrid` + `virtualScrollingFeature` | 51.0 kB / 17.7 kB |
1475
+ | `VGrid` + `columnVisibilityFeature` | 45.5 kB / 15.6 kB |
1476
+ | `VGrid` + `keyboardNavigationFeature` | 48.1 kB / 16.5 kB |
1477
+ | `VGrid` + `columnResizingFeature` | 48.6 kB / 16.7 kB |
1478
+ | `VGrid` + `columnGroupsFeature` | 46.6 kB / 16.0 kB |
1479
+ | `VGrid` + `rowPinningFeature` | 50.2 kB / 16.9 kB |
1480
+ | `VGrid` + `aggregationFeature` | 50.4 kB / 17.0 kB |
1481
+ | `VGrid` + `rowGroupingFeature` | 56.1 kB / 19.1 kB |
1482
+ | `VGrid` + `exportFeature` | 50.2 kB / 17.4 kB |
1483
+ | `VGrid` + `statusBarFeature` | 48.2 kB / 16.6 kB |
1484
+ | `VGrid` + `serverGroupingFeature` | 48.4 kB / 16.7 kB |
1485
+ | `VGrid` + `editingFeature` | 49.7 kB / 17.2 kB |
1486
+ | `VGrid` + `rangeSelectionFeature` | 51.7 kB / 17.8 kB |
1487
+ | `VGrid` + `allFeatures` + `VGridSearch` | 130.4 kB / 43.8 kB |
1488
+ | `VGrid` + `currencyRenderer` | 46.7 kB / 16.0 kB |
1489
+ | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 52.6 kB / 18.0 kB |
1455
1490
  | `sortRows` only | 0.7 kB / 0.4 kB |
1456
1491
  | `toCsv` only | 1.1 kB / 0.6 kB |
1457
- | everything | 177.3 kB / 57.2 kB |
1458
- | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 75.6 kB / 20.7 kB |
1492
+ | everything | 184.4 kB / 59.3 kB |
1493
+ | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 77.4 kB / 21.1 kB |
1459
1494
 
1460
1495
  With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
1461
1496
  chunks**: they load the first time a popover opens or `filter-row` is on. With
@@ -1513,6 +1548,7 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1513
1548
  | `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). |
1514
1549
  | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
1515
1550
  | `v-model:selectedGroups` | `GroupPath[]` | `[]` | Server-side grouping: groups selected by query, by path (`[[{ key, value }]]`), without their rows. |
1551
+ | `v-model:range` | `CellRange \| null` | `null` | Cell-range selection: the selected block, `{ start, end }` corner cells (`{ rowKey, columnKey }`). One cell alone is no range. |
1516
1552
  | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
1517
1553
  | `rowClass` | `(row, index) => ClassValue` | — | |
1518
1554
  | `highlightedRows` | `RowKey[]` | — | |
@@ -1525,6 +1561,7 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1525
1561
  | `ariaLabel` | `string` | — | |
1526
1562
  | `statusBar` | `boolean \| StatusBarOptions` | `false` | A status bar under the grid (status bar feature): counts, and `{ summary: [keys] }` sums of the selected rows. See [Status bar](#status-bar). |
1527
1563
  | `saveCell` | `(event: CellEditEvent) => unknown` | — | Saves an edited cell (editing feature): return a Promise and the cell shows it saving; a rejection keeps the editor open with its message. See [Inline editing](#inline-editing). |
1564
+ | `rangeSelection` | `boolean` | `false` | Cell-range selection (range selection feature): drag across cells, Shift+click or Shift+arrows; Ctrl/⌘+C copies the block. `v-model:range` holds it. See [Cell-range selection](#cell-range-selection). |
1528
1565
  | `messages` | `GridMessages` | — | Built-in text (translations, wording), over `createVueGrid({ messages })`. See [Text and parts](#text-and-parts). |
1529
1566
  | `parts` | `GridParts` | — | Built-in parts to leave out (`{ filterButtons: false }`), over `createVueGrid({ parts })`. |
1530
1567
  | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
@@ -1536,7 +1573,7 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
1536
1573
  `row-click(row, event)` · `cell-click({ row, rowKey, column, value, event })` (columns with `clickable: true`) ·
1537
1574
  `cell-action({ name, payload, row, rowKey, column })` (from renderers) · `sub-rows-error({ row, error })` · `context-action({ name, item, row, rowKey, column, value })` · `header-action({ name, item, column })` ·
1538
1575
  `query-change(query: GridQuery)` (sort + filters + page as one object, on mount and on every real change) ·
1539
- `copy({ kind, text, rows, columns })` (rows or a cell were copied: `exportFeature`) ·
1576
+ `copy({ kind, text, rows, columns })` (rows or a cell were copied: `exportFeature`; a cell range: `rangeSelectionFeature`, `kind: 'range'`) ·
1540
1577
  `load-error(error)` (a `dataSource` call failed) ·
1541
1578
  `cell-edit({ row, rowKey, column, value, oldValue })` (an edited cell: `editingFeature`; update your data) ·
1542
1579
  plus the `update:*` events of every `v-model`.
@@ -1566,6 +1603,11 @@ grid.value?.reloadSubRows('c2') // forget lazily loaded children (of one row, or
1566
1603
  grid.value?.pinRow(42, 'top') // pin a row above the body ('bottom' below it, null to unpin): rowPinningFeature
1567
1604
  grid.value?.exportCsv({ filename: 'orders.csv' }) / getCsv() / copyRows() // exportFeature, see Export and copy
1568
1605
  grid.value?.startEdit(42, 'stake') / stopEdit() // editingFeature: open a cell's editor; save (or stopEdit(true): drop) the open one
1606
+ grid.value?.selectRange({
1607
+ start: { rowKey: 1, columnKey: 'stake' },
1608
+ end: { rowKey: 9, columnKey: 'stake' },
1609
+ }) // rangeSelectionFeature (null clears)
1610
+ grid.value?.getRangeValues() / copyRange() // the selected block's raw values, row by row / copy it as tab-separated text
1569
1611
  ```
1570
1612
 
1571
1613
  `reload()` also forgets lazily loaded children, as does passing a different `load-sub-rows`
@@ -2387,6 +2429,52 @@ editor's code loads on demand, while the browser is idle, once a grid has an edi
2387
2429
  `grid.startEdit(rowKey, columnKey)` opens an editor from code, `grid.stopEdit()` closes it. Its
2388
2430
  text (`Edit {column}`, `Enter a number.`, `Saving…`) is in `messages`.
2389
2431
 
2432
+ ## Cell-range selection
2433
+
2434
+ `rangeSelectionFeature` selects blocks of cells, as in a spreadsheet:
2435
+
2436
+ ```vue
2437
+ <script setup lang="ts">
2438
+ import { ref } from 'vue'
2439
+ import {
2440
+ VGrid,
2441
+ keyboardNavigationFeature,
2442
+ rangeSelectionFeature,
2443
+ statusBarFeature,
2444
+ type CellRange,
2445
+ } from '@nocopypaste/vue-grid'
2446
+ const range = ref<CellRange | null>(null) // { start: { rowKey, columnKey }, end: { rowKey, columnKey } }
2447
+ </script>
2448
+
2449
+ <template>
2450
+ <VGrid
2451
+ v-model:range="range"
2452
+ :rows
2453
+ :columns
2454
+ row-key="id"
2455
+ range-selection
2456
+ status-bar
2457
+ :features="[rangeSelectionFeature, statusBarFeature, keyboardNavigationFeature]"
2458
+ @copy="(e) => e.kind === 'range' && notify('Copied')"
2459
+ />
2460
+ </template>
2461
+ ```
2462
+
2463
+ - **Mouse**: press on a cell and drag; past an edge the grid scrolls and the block follows.
2464
+ Shift+click stretches it from the last clicked cell. A plain click is one cell again (no range).
2465
+ Touch drags still scroll.
2466
+ - **Keyboard** (with `keyboardNavigationFeature`): Shift+arrows extend it from the focused cell,
2467
+ Ctrl/⌘+A selects every cell, Esc clears it.
2468
+ - **Copy**: Ctrl/⌘+C copies it as tab-separated lines, as the cells show them (`exportValue` wins),
2469
+ so it pastes into Excel or Google Sheets as cells; the grid emits `copy` with `kind: 'range'`.
2470
+ `grid.copyRange()` does it from code, `grid.getRangeValues()` returns the raw values.
2471
+ - **Status bar** (`statusBarFeature`): the number of cells, and the sum and average of its numbers.
2472
+ - **What it covers**: the corner cells are kept by row key and column key, so the block follows
2473
+ sorting and filtering and spans rows virtual scrolling hasn't drawn; expanded child rows are in
2474
+ it, group rows and pinned rows are not. Row selection (`selectable`) works alongside: checkboxes
2475
+ select rows, dragging over cells selects a range, and Ctrl/⌘+C copies the range while there is one.
2476
+ - Style it with `--vg-color-range` (the cells' tint) and `--vg-color-range-border` (the outline).
2477
+
2390
2478
  ## Status bar
2391
2479
 
2392
2480
  `statusBarFeature` adds a bar under the grid, like a spreadsheet's:
@@ -2412,7 +2500,10 @@ text (`Edit {column}`, `Enter a number.`, `Saving…`) is in `messages`.
2412
2500
  like the column's cells. Selected child rows count too. With "select all N matching rows" on
2413
2501
  (server data) the summary hides: only the loaded page is known.
2414
2502
  - **Your own content**: the `#status-bar` slot gets `{ rowCount, totalRowCount, selectedCount,
2415
- allSelected, filterCount, summary, clearFilters }` and replaces the default content.
2503
+ allSelected, filterCount, summary, range, clearFilters }` and replaces the default content.
2504
+ - **Cell range**: with `rangeSelectionFeature`, a selected block of cells shows its size and the
2505
+ `aggregates` of its numbers (`12 cells: Sum 1,135.47 Average 283.87`), formatted like the cells
2506
+ when they all come from one column.
2416
2507
  - Leave items out with `rows: false`, `selected: false`, `filters: false` or `clear: false`.
2417
2508
  - The bar is a `group` labelled "Grid status"; style it with `.vg-status-bar`. Its component loads
2418
2509
  on demand (own chunk).
@@ -2506,6 +2597,9 @@ With `keyboardNavigationFeature` it is an ARIA `grid` (`treegrid` with sub-grids
2506
2597
  `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
2507
2598
  cell's control; `Space` toggles row selection; `→`/`←` on a tree cell expands/collapses; `Alt+←/→` on a
2508
2599
  header moves the column; `Alt+Shift+←/→` on a header resizes it (with `columnResizingFeature`).
2600
+ With `range-selection` (`rangeSelectionFeature`), `Shift+arrows` select a block of cells from the
2601
+ focused one, `Ctrl/⌘+A` every cell, `Esc` clears it and `Ctrl/⌘+C` copies it; cells in it carry
2602
+ `aria-selected`.
2509
2603
 
2510
2604
  ## Touch, phones and tablets
2511
2605
 
@@ -2651,6 +2745,30 @@ A grid's own `:messages` win over the app's, and props that name a text (`empty-
2651
2745
  `<VGridPagination>`, `<VGridSearch>`, `<VGridColumnMenu>` and `<VGridMenu>` use the app's messages on
2652
2746
  their own too. Every key, with its English default, is in the API reference (`GridMessages`).
2653
2747
 
2748
+ **Language packs.** Ready-made, complete translations, each its own import (so only the ones you
2749
+ import are bundled, about 2 kB gzipped each):
2750
+
2751
+ | Import | Export | Language |
2752
+ | --------------------------------------- | -------- | ---------------------------------------------------- |
2753
+ | `@nocopypaste/vue-grid/locales/de` | `de` | German |
2754
+ | `@nocopypaste/vue-grid/locales/fr` | `fr` | French |
2755
+ | `@nocopypaste/vue-grid/locales/es` | `es` | Spanish |
2756
+ | `@nocopypaste/vue-grid/locales/sr` | `sr` | Serbian, Cyrillic |
2757
+ | `@nocopypaste/vue-grid/locales/sr-Latn` | `srLatn` | Serbian, Latin |
2758
+ | `@nocopypaste/vue-grid/locales/en` | `en` | English (the built-in text, a template for your own) |
2759
+
2760
+ ```ts
2761
+ import { de } from '@nocopypaste/vue-grid/locales/de'
2762
+
2763
+ app.use(createVueGrid({ messages: de })) // or per grid: <VGrid :messages="de" />
2764
+ // change a few texts on top: { ...de, total: 'Gesamt' }
2765
+ ```
2766
+
2767
+ Counts follow the language's plural rules (`1 red`, `2 reda`, `5 redova`). A pack only translates
2768
+ text: money, numbers and dates follow `locale` (`<VGrid locale="de">` or `createVueGrid({ locale })`).
2769
+ Text that takes a count gets the number too (`rowCount(shown, total, count, totalCount)`,
2770
+ `selectedCount(count, all, amount)`, `sortPosition(position, dir, count)`), for your own plurals.
2771
+
2654
2772
  **Parts.** `GridParts` turns off what a feature adds, each on by default; app-wide in
2655
2773
  `createVueGrid({ parts })`, per grid with `:parts`:
2656
2774
 
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 (15.3 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), inline cell editing, 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.5 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), inline cell editing, spreadsheet-like cell-range selection (copy, sum), 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`), with ready-made language packs (`@nocopypaste/vue-grid/locales/de`, `fr`, `es`, `sr`, `sr-Latn`), with ready-made language packs (`@nocopypaste/vue-grid/locales/de`, `fr`, `es`, `sr`, `sr-Latn`) 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.10.0",
3
+ "version": "0.12.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",
@@ -43,6 +43,10 @@
43
43
  "types": "./dist/types/agent/index.d.ts",
44
44
  "import": "./dist/agent/index.js"
45
45
  },
46
+ "./locales/*": {
47
+ "types": "./dist/types/locales/*.d.ts",
48
+ "import": "./dist/locales/*.js"
49
+ },
46
50
  "./agent/api.json": "./agent/api.json",
47
51
  "./agent/grid-config.schema.json": "./agent/grid-config.schema.json",
48
52
  "./AGENTS.md": "./AGENTS.md",