@nocopypaste/vue-grid 0.3.2 → 0.4.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 +1 -1
- package/CHANGELOG.md +9 -0
- package/README.md +56 -51
- package/agent/api.json +13 -3
- package/agent/api.md +3 -2
- package/agent/grid-config.schema.json +11 -0
- package/dist/agent/api.js +11 -3
- package/dist/agent/requirements.js +3 -1
- package/dist/agent/requirements.js.map +1 -1
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +195 -182
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/usePinFit.js +41 -0
- package/dist/composables/usePinFit.js.map +1 -0
- package/dist/features/columnPinning.js +8 -6
- package/dist/features/columnPinning.js.map +1 -1
- package/dist/types/components/VGrid.vue.d.ts +6 -0
- package/dist/types/composables/usePinFit.d.ts +17 -0
- package/dist/types/features/columnPinning.d.ts +3 -1
- package/dist/types/types.d.ts +1 -0
- package/llms-full.txt +60 -54
- package/package.json +1 -1
package/llms-full.txt
CHANGED
|
@@ -55,7 +55,7 @@ JSON Schema. The `@nocopypaste/vue-grid-mcp` MCP server serves all of this as to
|
|
|
55
55
|
| An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
|
|
56
56
|
| 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
|
|
57
57
|
| Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
|
|
58
|
-
| Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`
|
|
58
|
+
| Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'`; on narrow grids they scroll unless `pinned-max-share` allows (default half the width) |
|
|
59
59
|
| Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
|
|
60
60
|
| Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
|
|
61
61
|
| Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
|
|
@@ -516,7 +516,7 @@ Tokens: `--vg-*` (see README → Theming). Dark mode follows `color-scheme`. Den
|
|
|
516
516
|
|
|
517
517
|
---
|
|
518
518
|
|
|
519
|
-
# @nocopypaste/vue-grid 0.
|
|
519
|
+
# @nocopypaste/vue-grid 0.4.0 — API reference
|
|
520
520
|
|
|
521
521
|
> Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
|
|
522
522
|
|
|
@@ -528,7 +528,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
528
528
|
|---|---|---|---|
|
|
529
529
|
| `aggregationFeature` | Aggregates and the totals row: columns with an `aggregate` (`sum`, `avg`, `min`, `max`, `count` or a function) and `totals` (`true` / `'bottom'` or `'top'`) show a sticky totals row over the rows that pass the filters, on every page. `aggregates` supplies the values instead (e.g. from a server). Without it, `aggregate` and `totals` are ignored. | `totals` `totalsLabel` `aggregates` | `aggregate` |
|
|
530
530
|
| `columnGroupsFeature` | Grouped column headers: give columns a `group` and adjacent visible columns of the same group get one header cell spanning them, in a sticky row above the column headers. Groups follow reordering, hiding and pinning (a pin boundary splits a group). Without it, `group` is ignored. | | `group` |
|
|
531
|
-
| `columnPinningFeature` | Pinned columns: `pinned: 'left' \| 'right'` columns stay put (sticky) while the grid scrolls sideways, with edge shadows; runtime pins from the header menu (Pin left / Pin right / Unpin) are kept in `v-model:column-state` and persisted with `storage`. Without it, pins are ignored. |
|
|
531
|
+
| `columnPinningFeature` | Pinned columns: `pinned: 'left' \| 'right'` columns stay put (sticky) while the grid scrolls sideways, with edge shadows; runtime pins from the header menu (Pin left / Pin right / Unpin) are kept in `v-model:column-state` and persisted with `storage`. While the pinned columns would take more than `pinned-max-share` of the grid's width (half, by default), they scroll like the others. Without it, pins are ignored. | `pinnedMaxShare` | `pinned` `pinnable` |
|
|
532
532
|
| `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` |
|
|
533
533
|
| `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` |
|
|
534
534
|
| `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` |
|
|
@@ -574,6 +574,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
574
574
|
| `flash` | `FlashMode` | | | Briefly highlight cells whose value changes (live data, enrichment). Columns can override. |
|
|
575
575
|
| `virtual` | `VirtualOptions \| false` | `false` | `virtualScrollingFeature` | Virtual scrolling: only the rows in view render. Rows share one height (`rowHeight`, px) and the grid needs a bounded height. Needs the virtual scrolling feature. |
|
|
576
576
|
| `storage` | `ColumnStateStorage \| string` | | | Persist column state (order, hidden, pins, widths): a localStorage key or your own storage. |
|
|
577
|
+
| `pinnedMaxShare` | `number \| false` | `0.5` | `columnPinningFeature` | 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); pinned again once there's room. `false`: always pinned. Column pinning feature. |
|
|
577
578
|
| `renderers` | `CellRendererDefinition[]` | | | Renderers usable by name in this grid (merged over the app-wide ones). |
|
|
578
579
|
| `locale` | `string` | | | Locale for number / date renderers (default: the plugin's, else the browser's). |
|
|
579
580
|
| `currency` | `string` | | | Default ISO 4217 currency for currency renderers. |
|
|
@@ -1290,7 +1291,7 @@ an opt-in feature:
|
|
|
1290
1291
|
| `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
|
|
1291
1292
|
| `menusFeature` | The header right-click menu (`header-menu`) and body-cell menus (`context-menu`); without it the browser's menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it |
|
|
1292
1293
|
| `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
|
|
1293
|
-
| `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; without it pins are ignored
|
|
1294
|
+
| `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; while they'd take more than `pinned-max-share` of the grid (half), they scroll like the others; without it pins are ignored |
|
|
1294
1295
|
| `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
|
|
1295
1296
|
| `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
|
|
1296
1297
|
| `keyboardNavigationFeature` | The ARIA grid pattern: one Tab stop, arrow keys / Home / End / PageUp / PageDown between cells, Enter, Space to select, →/← to expand, Alt+←/→ to move a column. Without it the grid is an ARIA `table` with its controls in the Tab order |
|
|
@@ -1385,56 +1386,57 @@ chunks that on-demand imports share with the entry, even when nothing uses them.
|
|
|
1385
1386
|
|
|
1386
1387
|
### Props
|
|
1387
1388
|
|
|
1388
|
-
| Prop | Type | Default |
|
|
1389
|
-
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
|
|
1390
|
-
| `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`.
|
|
1391
|
-
| `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional).
|
|
1392
|
-
| `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).
|
|
1393
|
-
| `columns` | `ColumnDef<T>[]` | — | See below.
|
|
1394
|
-
| `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it.
|
|
1395
|
-
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI.
|
|
1396
|
-
| `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`.
|
|
1397
|
-
| `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering).
|
|
1398
|
-
| `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`.
|
|
1399
|
-
| `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers.
|
|
1400
|
-
| `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key).
|
|
1401
|
-
| `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a _Clear filters_ button, when filters hide every row.
|
|
1402
|
-
| `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`.
|
|
1403
|
-
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change.
|
|
1404
|
-
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins.
|
|
1405
|
-
| `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key).
|
|
1406
|
-
| `
|
|
1407
|
-
| `
|
|
1408
|
-
| `
|
|
1409
|
-
| `
|
|
1410
|
-
| `
|
|
1411
|
-
| `
|
|
1412
|
-
| `
|
|
1413
|
-
| `
|
|
1414
|
-
| `
|
|
1415
|
-
| `
|
|
1416
|
-
| `
|
|
1417
|
-
| `
|
|
1418
|
-
| `
|
|
1419
|
-
| `
|
|
1420
|
-
| `
|
|
1421
|
-
| `
|
|
1422
|
-
| `
|
|
1423
|
-
| `
|
|
1424
|
-
| `
|
|
1425
|
-
| `
|
|
1426
|
-
| `
|
|
1427
|
-
| `
|
|
1428
|
-
| `
|
|
1429
|
-
| `
|
|
1430
|
-
| `
|
|
1431
|
-
| `
|
|
1432
|
-
| `
|
|
1433
|
-
| `
|
|
1434
|
-
| `
|
|
1435
|
-
| `
|
|
1436
|
-
| `
|
|
1437
|
-
| `
|
|
1389
|
+
| Prop | Type | Default | |
|
|
1390
|
+
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1391
|
+
| `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
|
|
1392
|
+
| `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
|
|
1393
|
+
| `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). |
|
|
1394
|
+
| `columns` | `ColumnDef<T>[]` | — | See below. |
|
|
1395
|
+
| `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
|
|
1396
|
+
| `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
|
|
1397
|
+
| `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
|
|
1398
|
+
| `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
|
|
1399
|
+
| `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
|
|
1400
|
+
| `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
|
|
1401
|
+
| `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
|
|
1402
|
+
| `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a _Clear filters_ button, when filters hide every row. |
|
|
1403
|
+
| `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
|
|
1404
|
+
| `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
|
|
1405
|
+
| `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
|
|
1406
|
+
| `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
|
|
1407
|
+
| `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`. |
|
|
1408
|
+
| `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
|
|
1409
|
+
| `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
|
|
1410
|
+
| `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
|
|
1411
|
+
| `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
|
|
1412
|
+
| `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
|
|
1413
|
+
| `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
|
|
1414
|
+
| `v-model:selected` | `RowKey[]` | `[]` | |
|
|
1415
|
+
| `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
|
|
1416
|
+
| `isRowSelectable` | `(row) => boolean` | — | |
|
|
1417
|
+
| `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
|
|
1418
|
+
| `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
|
|
1419
|
+
| `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
|
|
1420
|
+
| `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). |
|
|
1421
|
+
| `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
|
|
1422
|
+
| `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
|
|
1423
|
+
| `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
|
|
1424
|
+
| `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
|
|
1425
|
+
| `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). |
|
|
1426
|
+
| `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
|
|
1427
|
+
| `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
|
|
1428
|
+
| `rowClass` | `(row, index) => ClassValue` | — | |
|
|
1429
|
+
| `highlightedRows` | `RowKey[]` | — | |
|
|
1430
|
+
| `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
|
|
1431
|
+
| `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
|
|
1432
|
+
| `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
|
|
1433
|
+
| `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
|
|
1434
|
+
| `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
|
|
1435
|
+
| `emptyText` | `string` | `'No data to show.'` | |
|
|
1436
|
+
| `ariaLabel` | `string` | — | |
|
|
1437
|
+
| `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
|
|
1438
|
+
| `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
|
|
1439
|
+
| `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
|
|
1438
1440
|
|
|
1439
1441
|
### Events
|
|
1440
1442
|
|
|
@@ -2178,6 +2180,10 @@ header moves the column; `Alt+Shift+←/→` on a header resizes it (with `colum
|
|
|
2178
2180
|
your own element inside a flex or grid layout, give that element `min-width: 0` too, or it
|
|
2179
2181
|
grows to the columns' width. The toolbar wraps, and on narrow screens the pager drops its
|
|
2180
2182
|
« / » buttons (page 1 and the last page stay).
|
|
2183
|
+
- **Pinned columns** that would take more than half of a narrow grid (`pinned-max-share`)
|
|
2184
|
+
scroll like the others there, so the rest of the row stays readable; they pin again once the
|
|
2185
|
+
grid is wide enough. The pins stay in the column state; `pinned-max-share="false"` keeps them
|
|
2186
|
+
pinned at any width.
|
|
2181
2187
|
- **Swipes scroll** the grid, also when they start on a header (except on a column's narrow
|
|
2182
2188
|
resize edge).
|
|
2183
2189
|
- **Hold a header** (about half a second) to pick the column up, then drag it to reorder
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocopypaste/vue-grid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|