@nocopypaste/vue-grid 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -1
- package/CHANGELOG.md +24 -0
- package/README.md +143 -67
- package/agent/api.json +51 -9
- package/agent/api.md +14 -6
- package/agent/grid-config.schema.json +9 -11
- package/dist/agent/api.js +51 -9
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +545 -520
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js +58 -53
- package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js +50 -49
- package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +151 -146
- package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js +44 -43
- package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +10 -8
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +62 -57
- package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js +59 -58
- package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +62 -55
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +60 -59
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js +27 -26
- package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +12 -11
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js +37 -30
- package/dist/components/VGridStatusBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/useGridExport.js +21 -6
- package/dist/composables/useGridExport.js.map +1 -1
- package/dist/composables/useGridMenus.js +41 -41
- package/dist/composables/useGridMenus.js.map +1 -1
- package/dist/composables/useStatusBar.js +9 -0
- package/dist/composables/useStatusBar.js.map +1 -1
- package/dist/features/export.js.map +1 -1
- package/dist/internal/context.js.map +1 -1
- package/dist/internal/messages.js +20 -0
- package/dist/internal/messages.js.map +1 -0
- package/dist/internal/print.js +51 -0
- package/dist/internal/print.js.map +1 -0
- package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js +31 -30
- package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js +28 -27
- package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js +22 -21
- package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js +37 -36
- package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js +16 -15
- package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js +21 -20
- package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js +21 -20
- package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js +18 -17
- package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js +35 -34
- package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/types/components/VGrid.vue.d.ts +34 -7
- package/dist/types/components/VGridColumnMenu.vue.d.ts +4 -5
- package/dist/types/components/VGridMenu.vue.d.ts +1 -1
- package/dist/types/components/VGridPagination.vue.d.ts +8 -3
- package/dist/types/components/VGridSearch.vue.d.ts +2 -2
- package/dist/types/composables/useGridExport.d.ts +2 -1
- package/dist/types/composables/useGridMenus.d.ts +3 -1
- package/dist/types/composables/useStatusBar.d.ts +7 -0
- package/dist/types/features/export.d.ts +2 -1
- package/dist/types/internal/context.d.ts +5 -1
- package/dist/types/internal/messages.d.ts +16 -0
- package/dist/types/internal/print.d.ts +16 -0
- package/dist/types/renderers/parts/CopyButton.vue.d.ts +1 -3
- package/dist/types/types.d.ts +300 -0
- package/llms-full.txt +164 -74
- package/llms.txt +1 -1
- package/package.json +1 -1
package/llms-full.txt
CHANGED
|
@@ -64,8 +64,9 @@ runs in the [live examples](https://eboye.github.io/eboye-vue-grid/), each with
|
|
|
64
64
|
| Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
|
|
65
65
|
| A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
|
|
66
66
|
| Group rows by a column ("by status, then city") | `rowGroupingFeature` | `v-model:group-by="['status', 'city']"`, `groups-expanded`; column `groupable: true` (header menu), `groupValue: (row) => …` (e.g. month); `aggregate` shows per group |
|
|
67
|
-
| Download CSV
|
|
67
|
+
| Download CSV / Excel, print, copy rows / cells | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `print()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
|
|
68
68
|
| Row / selection counts, sum of the selected rows | `statusBarFeature` | `status-bar` (or `{ summary: ['total'], aggregates?: ['sum', 'avg'] }`); `#status-bar="{ rowCount, selectedCount, summary, … }"` |
|
|
69
|
+
| Translate / reword the grid, drop built-in pieces | — | `messages` (`GridMessages`), `parts` (`GridParts`): app-wide in `createVueGrid` or per grid; slots `#load-error`, `#no-match`, `#select-all-banner` |
|
|
69
70
|
| Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
|
|
70
71
|
| Remember column layout | — | `storage="orders-grid"` (localStorage key) |
|
|
71
72
|
| Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
|
|
@@ -400,6 +401,8 @@ raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-sep
|
|
|
400
401
|
`header`, `totals`, `children`, `delimiter`. `toCsv(rows, columns)` works without a grid.
|
|
401
402
|
`exportXlsx({ filename, sheetName })` / `getXlsx()` (a Promise) write an Excel file with typed cells
|
|
402
403
|
(numbers, dates, booleans) and number formats from the renderers; `toXlsx(rows, columns)` without a grid.
|
|
404
|
+
`print({ title, totals, landscape })` prints every matching row as a table (header on each page);
|
|
405
|
+
Ctrl+P on the page only prints what is on screen.
|
|
403
406
|
|
|
404
407
|
### Row actions and context menu
|
|
405
408
|
|
|
@@ -512,6 +515,9 @@ only sees stylesheet rules. Density:
|
|
|
512
515
|
- Ctrl+C copies nothing for a clicked cell → cells only take focus with `keyboardNavigationFeature`
|
|
513
516
|
(or select rows first); `exportFeature` must be registered too.
|
|
514
517
|
- An exported column of `⋯` / buttons / `[object Object]` → `exportable: false`, or `exportValue: (row) => …`.
|
|
518
|
+
- Printing the page (Ctrl+P) shows only the rows on screen, clipped to the grid → use `grid.print()`.
|
|
519
|
+
- Translating by replacing components or CSS `content` → set `messages` (every built-in text has a key).
|
|
520
|
+
- Hiding a built-in piece with CSS → `parts: { filterButtons: false, … }` leaves it out of the DOM (and the tab order).
|
|
515
521
|
- Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
|
|
516
522
|
(CSV exports are raw by default).
|
|
517
523
|
- `group-by` names a field, not a column → it takes column `key`s; add a (hidden) column for it.
|
|
@@ -522,7 +528,7 @@ only sees stylesheet rules. Density:
|
|
|
522
528
|
|
|
523
529
|
---
|
|
524
530
|
|
|
525
|
-
# @nocopypaste/vue-grid 0.
|
|
531
|
+
# @nocopypaste/vue-grid 0.7.0 — API reference
|
|
526
532
|
|
|
527
533
|
> Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
|
|
528
534
|
|
|
@@ -538,7 +544,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
538
544
|
| `columnReorderFeature` | Column reordering: drag a header (mouse, pen, touch), Alt+←/→ on a focused header, and the header menu's Move left / Move right. Columns opt out with `reorderable: false`. The order is part of `v-model:column-state` and persisted with `storage`; `<VGridColumnMenu>` works without it. | | `reorderable` |
|
|
539
545
|
| `columnResizingFeature` | Column resizing: drag a header's edge (mouse, pen, touch), use ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation), or double-click the edge to fit the content. `minWidth` / `maxWidth` bound it; columns opt out with `resizable: false`. Widths are kept in `columnState.widths` and persisted with `storage`. The header menu gains Fit width / Reset width. | | `maxWidth` `resizable` |
|
|
540
546
|
| `columnVisibilityFeature` | Column visibility: `hidden: true` columns, `columnState.hidden` (persisted with `storage`), the header menu's Hide column item and `<VGridColumnMenu>`'s checkboxes. Columns opt out with `hideable: false`. Without it, every column shows. | | `hidden` `hideable` |
|
|
541
|
-
| `exportFeature` | CSV and Excel export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `grid.exportXlsx()` / `grid.getXlsx()` write an Excel workbook with typed cells (the writer loads on demand), `grid.copyRows()` copies rows as tab-separated text, and Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed. Columns can set `exportValue` and `exportable: false`. Without it those methods only warn. | | `exportValue` `exportable` |
|
|
547
|
+
| `exportFeature` | CSV and Excel export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `grid.exportXlsx()` / `grid.getXlsx()` write an Excel workbook with typed cells (the writer loads on demand), `grid.print()` prints every matching row as a table with the header on each page, `grid.copyRows()` copies rows as tab-separated text, and Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed. Columns can set `exportValue` and `exportable: false`. Without it those methods only warn. | | `exportValue` `exportable` |
|
|
542
548
|
| `filteringFeature` | Filtering: header funnels with typed filter popovers on `filterable` columns, the filter row, `<VGridSearch>`, the filter items of the header menu, `v-model:filters` and filter persistence. The popover body and the filter-row editors load on demand (own chunks). | `filterMode` `filterRow` `filterStorage` `noMatchText` `filters` | `filterable` `filter` `filterValue` `filterFn` `filterComponent` `searchable` |
|
|
543
549
|
| `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. | | |
|
|
544
550
|
| `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` | |
|
|
@@ -561,13 +567,15 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
561
567
|
| `rowKey` (required) | `RowKeyGetter<T>` | | | Stable unique id of a row: a property name or `(row) => string \| number`. All row state is keyed by it. |
|
|
562
568
|
| `features` | `readonly GridFeature[]` | | | Opt-in features for this grid (added to the app-wide `createVueGrid({ features })`): `sortingFeature`, `filteringFeature`, `serverDataFeature`, `paginationFeature`, or `allFeatures`. Read once, when the grid is created. |
|
|
563
569
|
| `dataSource` | `DataSource<T>` | | `serverDataFeature` | Server data: called with the current query (sort, filters, search, page) whenever it changes. The grid cancels superseded requests, shows loading and errors, and sorts / filters / pages nothing itself. |
|
|
564
|
-
| `pagination` | `boolean \|
|
|
570
|
+
| `pagination` | `boolean \| PaginationOptions` | `false` | `paginationFeature` | Built-in pagination under the grid (server-side with `dataSource`, client-side otherwise). |
|
|
565
571
|
| `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. |
|
|
572
|
+
| `messages` | `GridMessages` | | | Built-in text (translations, wording), over `createVueGrid({ messages })`. |
|
|
573
|
+
| `parts` | `GridParts` | | | Built-in parts to leave out (`{ progressBar: false }`), over `createVueGrid({ parts })`. |
|
|
566
574
|
| `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`. |
|
|
567
575
|
| `filterMode` | `'client' \| 'controlled'` | `'client'` | `filteringFeature` | `client` (default): the grid filters its rows. `controlled`: it only emits `update:filters`. |
|
|
568
576
|
| `filterRow` | `boolean` | `false` | `filteringFeature` | Show the filter row: an input under each filterable column's header. |
|
|
569
577
|
| `filterStorage` | `FilterStateStorage \| string` | | `filteringFeature` | Persist the filter model (`string` = localStorage key). |
|
|
570
|
-
| `noMatchText` | `string` |
|
|
578
|
+
| `noMatchText` | `string` | | `filteringFeature` | Shown when filters hide every row. Default: `messages.noMatch`, else `No rows match the current filters.` |
|
|
571
579
|
| `selectable` | `boolean \| 'single'` | `false` | `selectionFeature` | A selection column: `true` = multi-select (with select-all), `'single'` = one row. |
|
|
572
580
|
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | `selectionFeature` | `cascade` (default): selecting a parent selects its children. `independent`: rows alone. |
|
|
573
581
|
| `isRowSelectable` | `(row: T) => boolean` | | `selectionFeature` | Rows that can't be selected get a disabled checkbox. |
|
|
@@ -589,7 +597,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
589
597
|
| `timeZone` | `string` | | | IANA time zone for date renderers and date filters. |
|
|
590
598
|
| `density` | `Density` | | | Cell padding scale. |
|
|
591
599
|
| `loading` | `boolean` | `false` | | Shows a progress bar and sets `aria-busy` (server data sets it by itself). |
|
|
592
|
-
| `emptyText` | `string` |
|
|
600
|
+
| `emptyText` | `string` | | | Shown when there are no rows. Default: `messages.empty`, else `No data to show.` |
|
|
593
601
|
| `ariaLabel` | `string` | | | Accessible name of the grid. |
|
|
594
602
|
| `ui` | `Partial<Record<GridPart, ClassValue>>` | | | Extra classes per part (`root`, `header`, `headerCell`, `row`, `cell`, `subgrid`, `detail`, `empty`), e.g. Tailwind utilities. |
|
|
595
603
|
| `contextMenu` | `(ctx: CellContext<T>) => MenuItem[] \| null \| undefined` | | `menusFeature` | Right-click menu items for a body cell. Return `null`/`[]` to keep the browser's menu. |
|
|
@@ -597,7 +605,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
597
605
|
| `pinnedTopRows` | `readonly T[]` | | `rowPinningFeature` | Extra rows above the body, not part of the data (row pinning feature). |
|
|
598
606
|
| `pinnedBottomRows` | `readonly T[]` | | `rowPinningFeature` | Extra rows below the body, not part of the data (row pinning feature). |
|
|
599
607
|
| `totals` | `boolean \| 'top' \| 'bottom'` | `false` | `aggregationFeature` | A totals row with each column's `aggregate` (aggregation feature): `true` / `'bottom'` sticks it to the bottom, `'top'` under the header. |
|
|
600
|
-
| `totalsLabel` | `string` |
|
|
608
|
+
| `totalsLabel` | `string` | | `aggregationFeature` | The totals row's label, in its first column (unless that column has an aggregate). Default: `messages.total`, else `Total`. |
|
|
601
609
|
| `aggregates` | `Record<string, unknown>` | | `aggregationFeature` | Totals row values by column key, instead of computing them (e.g. totals from a server). |
|
|
602
610
|
| `groupsExpanded` | `boolean` | `false` | `rowGroupingFeature` | Groups start expanded (row grouping feature). Default: collapsed. |
|
|
603
611
|
|
|
@@ -640,6 +648,9 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
640
648
|
| `group-<key>` | `{ value: unknown; count: number; rows: readonly T[]; column: ColumnDef<T>; group: RowGroup<T> }` | The value of a group row grouped by this column (row grouping feature): `#group-<key>`. |
|
|
641
649
|
| `detail` | `{ row: T; rowKey: RowKey; depth: number }` | Expandable detail row under a row: any content, even another grid. |
|
|
642
650
|
| `empty` | | Shown when there are no rows. |
|
|
651
|
+
| `no-match` | `{ clearFilters: () => void; filterCount: number }` | Shown when filters hide every row, instead of the message and its Clear filters button. |
|
|
652
|
+
| `load-error` | `{ error: unknown; retry: () => Promise<void>; stale: boolean }` | A failed server request (server data): `stale` when the rows from before stay on screen (the notice above them), else in place of the rows. `retry()` asks again. |
|
|
653
|
+
| `select-all-banner` | `{ total: number; page: number; all: boolean; selectAll: () => void; clearSelection: () => void }` | Selection with server data: the "Select all N rows" banner. |
|
|
643
654
|
| `status-bar` | `StatusBarScope` | The status bar's content (status bar feature): replaces the counts and the summary. |
|
|
644
655
|
| `loading` | | Shown while loading with no rows yet. |
|
|
645
656
|
| `sub-rows-loading` | `{ row: T }` | Shown while a row's lazy children load. |
|
|
@@ -666,6 +677,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
666
677
|
| `exportCsv` | `void` | | Downloads the rows as a CSV file (`filename`, default `export.csv`; UTF-8 with a BOM). Export feature. |
|
|
667
678
|
| `getXlsx` | `Promise<Blob>` | | The rows as an Excel workbook (.xlsx): typed cells (numbers, dates, booleans), number formats from the columns' renderers, a bold frozen header. The writer loads on demand. Export feature. |
|
|
668
679
|
| `exportXlsx` | `Promise<void>` | | Downloads the rows as an Excel file (`filename`, default `export.xlsx`). Export feature. |
|
|
680
|
+
| `print` | `Promise<void>` | | Prints the rows as a table (the browser's print dialog): the filtered, sorted rows on every page (not just those in view), as the cells show them, the header repeated on each printed page, numbers right-aligned, the totals in bold. Resolves when printing is over. Export feature. |
|
|
669
681
|
| `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. |
|
|
670
682
|
|
|
671
683
|
## `ColumnDef<T>`
|
|
@@ -1175,6 +1187,8 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
|
|
|
1175
1187
|
| `currency`? | `string` | Default ISO 4217 currency for currency renderers. |
|
|
1176
1188
|
| `timeZone`? | `string` | Default IANA time zone for date renderers and date filters. |
|
|
1177
1189
|
| `density`? | `Density` | Default density: `compact`, `cozy` (default) or `comfortable`. |
|
|
1190
|
+
| `messages`? | `GridMessages` | Built-in text for every grid (translations, wording); a grid's own `messages` win. |
|
|
1191
|
+
| `parts`? | `GridParts` | Built-in parts to turn off in every grid; a grid's own `parts` win. |
|
|
1178
1192
|
|
|
1179
1193
|
---
|
|
1180
1194
|
|
|
@@ -1182,6 +1196,8 @@ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `
|
|
|
1182
1196
|
|
|
1183
1197
|
# @nocopypaste/vue-grid
|
|
1184
1198
|
|
|
1199
|
+
[](https://eboye.github.io/eboye-vue-grid/) — every feature running live, with its source.
|
|
1200
|
+
|
|
1185
1201
|
A data grid for Vue 3 built on **CSS Grid** — with real `subgrid` sub-rows, pinned columns, column
|
|
1186
1202
|
reorder/visibility with persistence, selection, virtual scrolling, pagination, a pluggable
|
|
1187
1203
|
**cell-renderer registry** for 3rd-party addons, and a theme you customise with **CSS variables**.
|
|
@@ -1312,7 +1328,7 @@ an opt-in feature:
|
|
|
1312
1328
|
| `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 |
|
|
1313
1329
|
| `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
|
|
1314
1330
|
| `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 |
|
|
1315
|
-
| `exportFeature` | `exportCsv()` / `getCsv()`, `exportXlsx()` / `getXlsx()` (Excel, typed cells), `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable`
|
|
1331
|
+
| `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` |
|
|
1316
1332
|
| `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 |
|
|
1317
1333
|
|
|
1318
1334
|
```ts
|
|
@@ -1357,33 +1373,33 @@ what you import.
|
|
|
1357
1373
|
|
|
1358
1374
|
| Import (minified / gzip, Vue excluded) | Initial chunk |
|
|
1359
1375
|
| ---------------------------------------------------------------------------- | ------------------ |
|
|
1360
|
-
| `VGrid` (no features) | 40.
|
|
1361
|
-
| `VGrid` + `sortingFeature` | 41.2 kB / 14.
|
|
1362
|
-
| `VGrid` + `filteringFeature` | 51.
|
|
1363
|
-
| `VGrid` + `serverDataFeature` | 41.8 kB / 14.
|
|
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 |
|
|
1364
1380
|
| `VGrid` + `paginationFeature` | 40.6 kB / 14.1 kB |
|
|
1365
1381
|
| `VGrid` + `selectionFeature` | 44.6 kB / 15.5 kB |
|
|
1366
1382
|
| `VGrid` + `subGridsFeature` | 42.8 kB / 14.9 kB |
|
|
1367
1383
|
| `VGrid` + `menusFeature` | 50.9 kB / 17.6 kB |
|
|
1368
|
-
| `VGrid` + `columnReorderFeature` | 44.
|
|
1384
|
+
| `VGrid` + `columnReorderFeature` | 44.2 kB / 15.3 kB |
|
|
1369
1385
|
| `VGrid` + `columnPinningFeature` | 43.4 kB / 15.1 kB |
|
|
1370
|
-
| `VGrid` + `virtualScrollingFeature` | 46.2 kB / 16.
|
|
1386
|
+
| `VGrid` + `virtualScrollingFeature` | 46.2 kB / 16.3 kB |
|
|
1371
1387
|
| `VGrid` + `columnVisibilityFeature` | 40.6 kB / 14.1 kB |
|
|
1372
1388
|
| `VGrid` + `keyboardNavigationFeature` | 43.2 kB / 15.1 kB |
|
|
1373
|
-
| `VGrid` + `columnResizingFeature` | 43.7 kB / 15.
|
|
1374
|
-
| `VGrid` + `columnGroupsFeature` | 41.
|
|
1389
|
+
| `VGrid` + `columnResizingFeature` | 43.7 kB / 15.3 kB |
|
|
1390
|
+
| `VGrid` + `columnGroupsFeature` | 41.8 kB / 14.5 kB |
|
|
1375
1391
|
| `VGrid` + `rowPinningFeature` | 45.4 kB / 15.4 kB |
|
|
1376
1392
|
| `VGrid` + `aggregationFeature` | 45.6 kB / 15.5 kB |
|
|
1377
1393
|
| `VGrid` + `rowGroupingFeature` | 50.2 kB / 16.9 kB |
|
|
1378
|
-
| `VGrid` + `exportFeature` | 45.
|
|
1394
|
+
| `VGrid` + `exportFeature` | 45.4 kB / 16.0 kB |
|
|
1379
1395
|
| `VGrid` + `statusBarFeature` | 42.8 kB / 15.0 kB |
|
|
1380
|
-
| `VGrid` + `allFeatures` + `VGridSearch` |
|
|
1381
|
-
| `VGrid` + `currencyRenderer` | 41.
|
|
1396
|
+
| `VGrid` + `allFeatures` + `VGridSearch` | 108.1 kB / 36.5 kB |
|
|
1397
|
+
| `VGrid` + `currencyRenderer` | 41.9 kB / 14.5 kB |
|
|
1382
1398
|
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 47.2 kB / 16.3 kB |
|
|
1383
1399
|
| `sortRows` only | 0.7 kB / 0.4 kB |
|
|
1384
1400
|
| `toCsv` only | 1.1 kB / 0.6 kB |
|
|
1385
|
-
| everything | 160.
|
|
1386
|
-
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 70.
|
|
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 |
|
|
1387
1403
|
|
|
1388
1404
|
With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
|
|
1389
1405
|
chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
@@ -1400,57 +1416,60 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
|
|
|
1400
1416
|
|
|
1401
1417
|
### Props
|
|
1402
1418
|
|
|
1403
|
-
| Prop | Type | Default
|
|
1404
|
-
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
1405
|
-
| `rows` | `T[]` | `[]`
|
|
1406
|
-
| `features` | `GridFeature[]` | —
|
|
1407
|
-
| `dataSource` | `(query, { signal }) => Promise<{ rows, total? }>` | —
|
|
1408
|
-
| `columns` | `ColumnDef<T>[]` | —
|
|
1409
|
-
| `rowKey` | `keyof T \| (row) => string \| number` | —
|
|
1410
|
-
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null`
|
|
1411
|
-
| `sortMode` | `'controlled' \| 'client'` | `'controlled'`
|
|
1412
|
-
| `v-model:filters` | `FilterState \| null` | `null`
|
|
1413
|
-
| `filterMode` | `'client' \| 'controlled'` | `'client'`
|
|
1414
|
-
| `filterRow` | `boolean` | `false`
|
|
1415
|
-
| `filterStorage` | `string \| FilterStateStorage` | —
|
|
1416
|
-
| `noMatchText` | `string` | `
|
|
1417
|
-
| `pagination` | `boolean \|
|
|
1418
|
-
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25`
|
|
1419
|
-
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived
|
|
1420
|
-
| `storage` | `string \| ColumnStateStorage` | —
|
|
1421
|
-
| `pinnedMaxShare` | `number \| false` | `0.5`
|
|
1422
|
-
| `v-model:expanded` | `RowKey[]` | `[]`
|
|
1423
|
-
| `subRows` | `(row) => T[] \| undefined` | —
|
|
1424
|
-
| `loadSubRows` | `(row) => Promise<T[]>` | —
|
|
1425
|
-
| `hasSubRows` | `(row) => boolean` | —
|
|
1426
|
-
| `rowExpandable` | `(row) => boolean` | —
|
|
1427
|
-
| `selectable` | `boolean \| 'single'` | `false`
|
|
1428
|
-
| `v-model:selected` | `RowKey[]` | `[]`
|
|
1429
|
-
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'`
|
|
1430
|
-
| `isRowSelectable` | `(row) => boolean` | —
|
|
1431
|
-
| `pruneSelection` | `boolean` | `false`
|
|
1432
|
-
| `v-model:selectAllMatching` | `boolean` | `false`
|
|
1433
|
-
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false`
|
|
1434
|
-
| `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null`
|
|
1435
|
-
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | —
|
|
1436
|
-
| `totals` | `boolean \| 'top' \| 'bottom'` | `false`
|
|
1437
|
-
| `totalsLabel` | `string` | `
|
|
1438
|
-
| `aggregates` | `Record<string, unknown>` | —
|
|
1439
|
-
| `v-model:groupBy` | `string[] \| string \| null` | `null`
|
|
1440
|
-
| `groupsExpanded` | `boolean` | `false`
|
|
1441
|
-
| `rowClickable` | `boolean` | `false`
|
|
1442
|
-
| `rowClass` | `(row, index) => ClassValue` | —
|
|
1443
|
-
| `highlightedRows` | `RowKey[]` | —
|
|
1444
|
-
| `flash` | `boolean \| 'direction'` | `false`
|
|
1445
|
-
| `renderers` | `CellRendererDefinition[]` | —
|
|
1446
|
-
| `locale` / `currency` / `timeZone` | `string` | plugin → browser
|
|
1447
|
-
| `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'`
|
|
1448
|
-
| `loading` | `boolean` | `false`
|
|
1449
|
-
| `emptyText` | `string` | `
|
|
1450
|
-
| `ariaLabel` | `string` | —
|
|
1451
|
-
| `
|
|
1452
|
-
| `
|
|
1453
|
-
| `
|
|
1419
|
+
| Prop | Type | Default | |
|
|
1420
|
+
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1421
|
+
| `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
|
|
1422
|
+
| `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
|
|
1423
|
+
| `dataSource` | `(query, { signal }) => Promise<{ rows, total? }>` | — | Server rows: the grid calls it whenever sort, filters or page change. Needs `serverDataFeature`. See [Server data](#server-data). |
|
|
1424
|
+
| `columns` | `ColumnDef<T>[]` | — | See below. |
|
|
1425
|
+
| `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
|
|
1426
|
+
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
|
|
1427
|
+
| `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
|
|
1428
|
+
| `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
|
|
1429
|
+
| `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
|
|
1430
|
+
| `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
|
|
1431
|
+
| `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
|
|
1432
|
+
| `noMatchText` | `string` | `messages.noMatch` | Shown, with a _Clear filters_ button, when filters hide every row (`No rows match the current filters.`). |
|
|
1433
|
+
| `pagination` | `boolean \| PaginationOptions` | `false` | The built-in pager (pagination feature): `{ pageSizes, siblings, summary, firstLast }`. |
|
|
1434
|
+
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
|
|
1435
|
+
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
|
|
1436
|
+
| `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
|
|
1437
|
+
| `pinnedMaxShare` | `number \| false` | `0.5` | Pinned columns scroll like the others while together they'd take more than this share of the grid's width (a phone, a narrow panel), and pin again once there's room. `false`: always pinned. Needs `columnPinningFeature`. |
|
|
1438
|
+
| `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
|
|
1439
|
+
| `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
|
|
1440
|
+
| `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
|
|
1441
|
+
| `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
|
|
1442
|
+
| `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
|
|
1443
|
+
| `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
|
|
1444
|
+
| `v-model:selected` | `RowKey[]` | `[]` | |
|
|
1445
|
+
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
|
|
1446
|
+
| `isRowSelectable` | `(row) => boolean` | — | |
|
|
1447
|
+
| `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
|
|
1448
|
+
| `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
|
|
1449
|
+
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
|
|
1450
|
+
| `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null` | Top-level rows pinned above / below the body. Needs `rowPinningFeature` (as do the next two). See [Pinned rows and totals](#pinned-rows-and-totals). |
|
|
1451
|
+
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
|
|
1452
|
+
| `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
|
|
1453
|
+
| `totalsLabel` | `string` | `messages.total` | Shown in the totals row's first column (unless that column has an aggregate). `Total` by default. |
|
|
1454
|
+
| `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
|
|
1455
|
+
| `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
|
+
| `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
|
|
1457
|
+
| `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
|
|
1458
|
+
| `rowClass` | `(row, index) => ClassValue` | — | |
|
|
1459
|
+
| `highlightedRows` | `RowKey[]` | — | |
|
|
1460
|
+
| `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
|
|
1461
|
+
| `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
|
|
1462
|
+
| `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
|
|
1463
|
+
| `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
|
|
1464
|
+
| `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
|
|
1465
|
+
| `emptyText` | `string` | `messages.empty` | Shown when there are no rows (`No data to show.`). |
|
|
1466
|
+
| `ariaLabel` | `string` | — | |
|
|
1467
|
+
| `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). |
|
|
1468
|
+
| `messages` | `GridMessages` | — | Built-in text (translations, wording), over `createVueGrid({ messages })`. See [Text and parts](#text-and-parts). |
|
|
1469
|
+
| `parts` | `GridParts` | — | Built-in parts to leave out (`{ filterButtons: false }`), over `createVueGrid({ parts })`. |
|
|
1470
|
+
| `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
|
|
1471
|
+
| `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
|
|
1472
|
+
| `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
|
|
1454
1473
|
|
|
1455
1474
|
### Events
|
|
1456
1475
|
|
|
@@ -1469,7 +1488,9 @@ Clicks on links, buttons and inputs inside a cell never trigger `row-click`.
|
|
|
1469
1488
|
`total-<key>` (`{ value, column, group? }`, a cell of the totals row or a group row) ·
|
|
1470
1489
|
`group-<key>` (`{ value, count, rows, column, group }`, the value of a group row) · `detail` (`{ row, rowKey, depth }`) ·
|
|
1471
1490
|
`toolbar` (`{ columns, columnState, setColumnState, filters, setFilters, clearFilters, activeFilterCount, selected, selectedCount, selectAllMatching, clearSelection }`) ·
|
|
1472
|
-
`empty` · `loading` · `sub-rows-loading` (`{ row }`)
|
|
1491
|
+
`empty` · `loading` · `sub-rows-loading` (`{ row }`) · `no-match` (`{ clearFilters, filterCount }`) ·
|
|
1492
|
+
`load-error` (`{ error, retry, stale }`, server data) · `select-all-banner` (`{ total, page, all, selectAll, clearSelection }`) ·
|
|
1493
|
+
`status-bar` (`StatusBarScope`).
|
|
1473
1494
|
|
|
1474
1495
|
### Exposed methods
|
|
1475
1496
|
|
|
@@ -2045,7 +2066,8 @@ same grouping elsewhere.
|
|
|
2045
2066
|
|
|
2046
2067
|
## Export and copy
|
|
2047
2068
|
|
|
2048
|
-
`exportFeature` turns the grid's rows into CSV or an Excel workbook and copies them to
|
|
2069
|
+
`exportFeature` turns the grid's rows into CSV or an Excel workbook, prints them, and copies them to
|
|
2070
|
+
the clipboard.
|
|
2049
2071
|
|
|
2050
2072
|
```vue
|
|
2051
2073
|
<script setup lang="ts">
|
|
@@ -2126,6 +2148,23 @@ Without the grid: `toXlsx(rows, columns, { sheetName, header, timeZone, formats
|
|
|
2126
2148
|
file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'money'`, `'percent'`,
|
|
2127
2149
|
`'date'`, `'datetime'`, `'number'`, `'auto'`).
|
|
2128
2150
|
|
|
2151
|
+
### Print
|
|
2152
|
+
|
|
2153
|
+
**`print(options)`** prints the rows as a table from a hidden frame, with the browser's print
|
|
2154
|
+
dialog: every row that passes the filters (not just the ones a virtual grid has in view), sorted,
|
|
2155
|
+
as the cells show them. Printing the page itself (Ctrl+P) gives only what is on screen, clipped
|
|
2156
|
+
to the grid's frame.
|
|
2157
|
+
|
|
2158
|
+
```ts
|
|
2159
|
+
await grid.value?.print({ title: 'Orders', totals: true, landscape: true })
|
|
2160
|
+
```
|
|
2161
|
+
|
|
2162
|
+
- A real `<table>`: the header repeats on every printed page, numbers and money are
|
|
2163
|
+
right-aligned as in the grid, the totals print once, in bold, after the last row.
|
|
2164
|
+
- Options: `rows`, `children`, `columns`, `header`, `totals` as for the exports, plus `title`
|
|
2165
|
+
(a heading, also the document title) and `landscape`.
|
|
2166
|
+
- It resolves when printing is over. The printing code (1.1 kB gzip) loads on first use.
|
|
2167
|
+
|
|
2129
2168
|
## Status bar
|
|
2130
2169
|
|
|
2131
2170
|
`statusBarFeature` adds a bar under the grid, like a spreadsheet's:
|
|
@@ -2152,6 +2191,7 @@ file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'mon
|
|
|
2152
2191
|
(server data) the summary hides: only the loaded page is known.
|
|
2153
2192
|
- **Your own content**: the `#status-bar` slot gets `{ rowCount, totalRowCount, selectedCount,
|
|
2154
2193
|
allSelected, filterCount, summary, clearFilters }` and replaces the default content.
|
|
2194
|
+
- Leave items out with `rows: false`, `selected: false`, `filters: false` or `clear: false`.
|
|
2155
2195
|
- The bar is a `group` labelled "Grid status"; style it with `.vg-status-bar`. Its component loads
|
|
2156
2196
|
on demand (own chunk).
|
|
2157
2197
|
|
|
@@ -2362,6 +2402,56 @@ with `rendererOptions`). Emit `action(name, payload)`; the grid re-emits it as `
|
|
|
2362
2402
|
row and column. `useGridContext()` gives `{ locale, currency, timeZone }`. Lookup order:
|
|
2363
2403
|
a definition or component on the column → `:renderers` → plugin → `text` (the only renderer built in).
|
|
2364
2404
|
|
|
2405
|
+
## Text and parts
|
|
2406
|
+
|
|
2407
|
+
Everything a feature adds is configurable: its text, and whether each piece shows at all.
|
|
2408
|
+
|
|
2409
|
+
**Text.** Every built-in string (menus, filters, the pager, the status bar, notices, screen-reader
|
|
2410
|
+
labels, renderer buttons) has a key in `GridMessages`. Set the ones you need; the rest stay English.
|
|
2411
|
+
Functions get the values that go into the text.
|
|
2412
|
+
|
|
2413
|
+
```ts
|
|
2414
|
+
app.use(
|
|
2415
|
+
createVueGrid({
|
|
2416
|
+
messages: {
|
|
2417
|
+
sortAscending: 'Rastuće',
|
|
2418
|
+
empty: 'Nema podataka.',
|
|
2419
|
+
groupBy: (column) => `Grupiši po: ${column}`,
|
|
2420
|
+
pageSummary: (from, to, total) => `${from}–${to} od ${total}`,
|
|
2421
|
+
rowCount: (shown, total) => (total ? `${shown} od ${total} redova` : `${shown} redova`),
|
|
2422
|
+
},
|
|
2423
|
+
}),
|
|
2424
|
+
)
|
|
2425
|
+
```
|
|
2426
|
+
|
|
2427
|
+
A grid's own `:messages` win over the app's, and props that name a text (`empty-text`,
|
|
2428
|
+
`no-match-text`, `totals-label`, `<VGridSearch placeholder>`, a renderer's `label`…) win over both.
|
|
2429
|
+
`<VGridPagination>`, `<VGridSearch>`, `<VGridColumnMenu>` and `<VGridMenu>` use the app's messages on
|
|
2430
|
+
their own too. Every key, with its English default, is in the API reference (`GridMessages`).
|
|
2431
|
+
|
|
2432
|
+
**Parts.** `GridParts` turns off what a feature adds, each on by default; app-wide in
|
|
2433
|
+
`createVueGrid({ parts })`, per grid with `:parts`:
|
|
2434
|
+
|
|
2435
|
+
| Part | Leaves out |
|
|
2436
|
+
| -------------------- | ---------------------------------------------------------------------------- |
|
|
2437
|
+
| `progressBar` | The thin bar at the top while loading (`aria-busy` stays) |
|
|
2438
|
+
| `loadErrorNotice` | The notice above the rows when a request fails while rows are shown |
|
|
2439
|
+
| `retry` | The Retry buttons of load errors and of lazy children |
|
|
2440
|
+
| `clearFiltersButton` | The Clear filters button of the no-match message |
|
|
2441
|
+
| `selectAll` | The select-all checkbox in the header (rows still select) |
|
|
2442
|
+
| `selectAllBanner` | The "Select all N rows" banner (server data) |
|
|
2443
|
+
| `filterButtons` | The funnels in `filterable` headers (the filter row and search still filter) |
|
|
2444
|
+
| `resizeGrips` | The grips on header edges (Fit width / Reset width stay in the header menu) |
|
|
2445
|
+
| `headerDrag` | Dragging headers to reorder (Alt+←/→ and the header menu still move columns) |
|
|
2446
|
+
| `copyShortcut` | Ctrl/⌘+C copying in the grid (`copyRows()` still works) |
|
|
2447
|
+
| `groupCounts` | The row count on group rows |
|
|
2448
|
+
|
|
2449
|
+
Some parts can be replaced instead: `#load-error`, `#no-match`, `#select-all-banner` and
|
|
2450
|
+
`#status-bar`. The pager takes `pagination: { firstLast: false, summary: '' }`, the status bar
|
|
2451
|
+
`{ rows, selected, filters, clear }` flags. Per column, `sortable`, `filterable`, `resizable`,
|
|
2452
|
+
`reorderable`, `pinnable`, `hideable`, `groupable` and `exportable` work as before, and
|
|
2453
|
+
`header-menu` (`false`, or a function that edits the built-in items) shapes the header menu.
|
|
2454
|
+
|
|
2365
2455
|
## Theming
|
|
2366
2456
|
|
|
2367
2457
|
Override any token on `:root`, a wrapper, or the grid itself:
|
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, copying, a status bar, virtual scrolling and keyboard navigation are opt-in features, and 29 cell renderers are opt-in imports. 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.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.
|
|
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.
|
|
3
|
+
"version": "0.7.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",
|