@nocopypaste/vue-grid 0.3.0 → 0.3.2
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 +249 -84
- package/CHANGELOG.md +27 -0
- package/README.md +412 -228
- package/agent/api.json +89 -89
- package/agent/api.md +84 -84
- package/agent/grid-config.schema.json +11 -5
- package/dist/agent/api.js +89 -89
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/validate.js.map +1 -1
- package/dist/base.css +1 -1
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +1 -1
- 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.map +1 -1
- 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.map +1 -1
- package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- 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.map +1 -1
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- 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.map +1 -1
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +1 -1
- 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.map +1 -1
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/useColumnDrag.js.map +1 -1
- package/dist/composables/useColumnResize.js.map +1 -1
- package/dist/composables/useDataSource.js.map +1 -1
- package/dist/composables/useGridExport.js.map +1 -1
- package/dist/composables/useGridFilters.js.map +1 -1
- package/dist/composables/useGridKeyboard.js +46 -36
- package/dist/composables/useGridKeyboard.js.map +1 -1
- package/dist/composables/useGridMenus.js.map +1 -1
- package/dist/composables/useGridSelection.js.map +1 -1
- package/dist/composables/usePinnedRows.js.map +1 -1
- package/dist/composables/useRowGrouping.js.map +1 -1
- package/dist/composables/useTotals.js.map +1 -1
- package/dist/composables/useVirtualRows.js.map +1 -1
- package/dist/core/aggregate.js.map +1 -1
- package/dist/core/columns.js.map +1 -1
- package/dist/core/csv.js.map +1 -1
- package/dist/core/filter.js.map +1 -1
- package/dist/core/grouping.js.map +1 -1
- package/dist/core/pagination.js.map +1 -1
- package/dist/core/patch.js.map +1 -1
- package/dist/core/selection.js.map +1 -1
- package/dist/core/sort.js.map +1 -1
- package/dist/core/storage.js.map +1 -1
- package/dist/core/value.js.map +1 -1
- package/dist/core.css +1 -1
- package/dist/features/aggregation.js.map +1 -1
- package/dist/features/columnGroups.js.map +1 -1
- package/dist/features/columnVisibility.js.map +1 -1
- package/dist/features/filtering.js.map +1 -1
- package/dist/features/keyboardNavigation.js.map +1 -1
- package/dist/features/menus.js.map +1 -1
- package/dist/features/rowGrouping.js.map +1 -1
- package/dist/features/rowPinning.js.map +1 -1
- package/dist/features/selection.js.map +1 -1
- package/dist/features/virtualScrolling.js.map +1 -1
- package/dist/internal/RenderSlot.js.map +1 -1
- package/dist/internal/anchor.js +20 -21
- package/dist/internal/anchor.js.map +1 -1
- package/dist/internal/context.js.map +1 -1
- package/dist/internal/supports.js +2 -2
- package/dist/internal/supports.js.map +1 -1
- package/dist/internal/touchHold.js.map +1 -1
- package/dist/registry/plugin.js.map +1 -1
- package/dist/registry/registry.js.map +1 -1
- package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- 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.map +1 -1
- package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- 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.map +1 -1
- package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/format.js.map +1 -1
- package/dist/renderers/index.js.map +1 -1
- package/dist/renderers/options.js.map +1 -1
- package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/renderers/parts/icons.js.map +1 -1
- package/dist/renderers/parts/useToggleControl.js.map +1 -1
- package/dist/renderers/plainText.js.map +1 -1
- package/dist/renderers/text.js.map +1 -1
- package/dist/theme.css +1 -1
- package/dist/types/agent/index.d.ts +2 -2
- package/dist/types/internal/anchor.d.ts +10 -2
- package/dist/types/internal/supports.d.ts +0 -5
- package/dist/types/renderers/NumberCell.vue.d.ts +2 -4
- package/dist/types/renderers/index.d.ts +3 -5
- package/dist/types/renderers/options.d.ts +45 -0
- package/dist/types/renderers/plainText.d.ts +2 -4
- package/dist/types/types.d.ts +35 -0
- package/dist/vue-grid.css +1 -1
- package/llms-full.txt +745 -396
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -44,51 +44,51 @@ JSON Schema. The `@nocopypaste/vue-grid-mcp` MCP server serves all of this as to
|
|
|
44
44
|
|
|
45
45
|
## Which feature for what
|
|
46
46
|
|
|
47
|
-
| The user wants…
|
|
48
|
-
|
|
49
|
-
| Click a header to sort
|
|
50
|
-
| Filters per column, a filter row, quick search
|
|
51
|
-
| Pages
|
|
52
|
-
| Backend sorting / filtering / paging
|
|
53
|
-
| Checkboxes / row selection, batch actions
|
|
54
|
-
| Nested child rows aligned to the parent's columns | `subGridsFeature`
|
|
55
|
-
| An expandable panel under a row
|
|
56
|
-
| 10,000+ rows
|
|
57
|
-
| Right-click menus (cells, headers)
|
|
58
|
-
| Freeze columns left / right
|
|
59
|
-
| Show / hide columns
|
|
60
|
-
| Drag columns to reorder
|
|
61
|
-
| Drag column edges to resize
|
|
62
|
-
| Grouped headers ("Q1" over three columns)
|
|
63
|
-
| Rows that stay on top / bottom
|
|
64
|
-
| A totals row (sum, avg, …)
|
|
65
|
-
| Group rows by a column ("by status, then city")
|
|
66
|
-
| Download CSV, copy rows / cells (Ctrl+C)
|
|
67
|
-
| Arrow-key navigation (ARIA grid)
|
|
68
|
-
| Remember column layout
|
|
69
|
-
| Cell type (money, date, badge, link, …)
|
|
47
|
+
| The user wants… | Feature(s) | Props / column options |
|
|
48
|
+
| ------------------------------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| Click a header to sort | `sortingFeature` | column `sortable: true`; `sort-mode="client"` (or handle `v-model:sort`) |
|
|
50
|
+
| Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
|
|
51
|
+
| Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
|
|
52
|
+
| Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
|
|
53
|
+
| 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` |
|
|
54
|
+
| Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
|
|
55
|
+
| An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
|
|
56
|
+
| 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
|
|
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'` |
|
|
59
|
+
| Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
|
|
60
|
+
| Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
|
|
61
|
+
| Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
|
|
62
|
+
| Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
|
|
63
|
+
| Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
|
|
64
|
+
| A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
|
|
65
|
+
| 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 |
|
|
66
|
+
| Download CSV, copy rows / cells (Ctrl+C) | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
|
|
67
|
+
| Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
|
|
68
|
+
| Remember column layout | — | `storage="orders-grid"` (localStorage key) |
|
|
69
|
+
| Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
|
|
70
70
|
|
|
71
71
|
## Renderers (pick by data)
|
|
72
72
|
|
|
73
|
-
| Data
|
|
74
|
-
|
|
75
|
-
| Plain / long text
|
|
76
|
-
| Numbers
|
|
77
|
-
| Money
|
|
78
|
-
| Up / down change
|
|
79
|
-
| Dates / date-times
|
|
80
|
-
| Yes / no
|
|
81
|
-
| Status badge
|
|
82
|
-
| Colour chip / tag
|
|
83
|
-
| Links
|
|
84
|
-
| Several lines in one cell
|
|
85
|
-
| Arrays
|
|
86
|
-
| Images
|
|
87
|
-
| JSON / code
|
|
88
|
-
| Badge + info popover
|
|
89
|
-
| Buttons / menus
|
|
90
|
-
| Toggles / inputs (controlled) | `checkboxRenderer`, `switchRenderer`, `radioRenderer`, `iconToggleRenderer`, `editRenderer` | handle `@cell-action`
|
|
91
|
-
| Copy to clipboard
|
|
73
|
+
| Data | Renderer export | Useful options |
|
|
74
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
75
|
+
| Plain / long text | default (`text`) | `ellipsis`, `lines`, `tone`, `badge`, `copyable`, `tooltip` |
|
|
76
|
+
| Numbers | `numberRenderer` | `format` (Intl), `clickable` |
|
|
77
|
+
| Money | `currencyRenderer` | `currency` (code or `(v, row) => code`) |
|
|
78
|
+
| Up / down change | `changeRenderer` | `direction`, `currency`, `iconOnly` |
|
|
79
|
+
| Dates / date-times | `dateRenderer` / `dateTimeRenderer` | `format`, `twoLines` |
|
|
80
|
+
| Yes / no | `booleanRenderer` | `display: 'icon'`, labels |
|
|
81
|
+
| Status badge | `statusRenderer` | `tone: { Paid: 'success', Open: 'info' }`, `label`, `variant` |
|
|
82
|
+
| Colour chip / tag | `chipRenderer` | `color`, `tone`, `shape` |
|
|
83
|
+
| Links | `linkRenderer` | `href` / `to` (vue-router), `label`, `target` |
|
|
84
|
+
| Several lines in one cell | `multiLineRenderer` | `lines: (v, row) => [...]` |
|
|
85
|
+
| Arrays | `listRenderer` | `max`, `itemLabel` |
|
|
86
|
+
| Images | `imageRenderer` | `src`, `size`, `shape` |
|
|
87
|
+
| JSON / code | `jsonTreeRenderer`, `jsonRenderer`, `codeRenderer` | `collapseAt`, `language` |
|
|
88
|
+
| Badge + info popover | `detailsRenderer` | `items: (v, row) => [{ label, value }]` |
|
|
89
|
+
| Buttons / menus | `actionButtonRenderer`, `buttonGroupRenderer`, `actionsMenuRenderer` | `action`, `buttons`, `actions` |
|
|
90
|
+
| Toggles / inputs (controlled) | `checkboxRenderer`, `switchRenderer`, `radioRenderer`, `iconToggleRenderer`, `editRenderer` | handle `@cell-action` |
|
|
91
|
+
| Copy to clipboard | `copyRenderer` | `copyValue`, `iconOnly` |
|
|
92
92
|
|
|
93
93
|
Every option is in `agent/api.md` → Renderers. Options typed `RowFn` / `RowOption` also take
|
|
94
94
|
`(value, row) => …`. Status / chip / details `tone`s: `success`, `danger`, `warning`, `info`,
|
|
@@ -100,23 +100,54 @@ Every option is in `agent/api.md` → Renderers. Options typed `RowFn` / `RowOpt
|
|
|
100
100
|
|
|
101
101
|
```vue
|
|
102
102
|
<script setup lang="ts">
|
|
103
|
-
import {
|
|
103
|
+
import {
|
|
104
|
+
VGrid,
|
|
105
|
+
createColumnHelper,
|
|
106
|
+
currencyRenderer,
|
|
107
|
+
dateRenderer,
|
|
108
|
+
sortingFeature,
|
|
109
|
+
statusRenderer,
|
|
110
|
+
} from '@nocopypaste/vue-grid'
|
|
104
111
|
|
|
105
|
-
interface Order {
|
|
112
|
+
interface Order {
|
|
113
|
+
id: number
|
|
114
|
+
customer: { name: string }
|
|
115
|
+
total: number
|
|
116
|
+
status: 'Paid' | 'Open'
|
|
117
|
+
placedAt: string
|
|
118
|
+
}
|
|
106
119
|
defineProps<{ orders: Order[] }>()
|
|
107
120
|
|
|
108
121
|
const col = createColumnHelper<Order>()
|
|
109
122
|
const columns = [
|
|
110
123
|
col({ key: 'id', header: '#', width: 'min-content' }),
|
|
111
|
-
col({
|
|
124
|
+
col({
|
|
125
|
+
key: 'customer',
|
|
126
|
+
header: 'Customer',
|
|
127
|
+
field: 'customer.name',
|
|
128
|
+
sortable: true,
|
|
129
|
+
width: 'minmax(10rem, 1fr)',
|
|
130
|
+
}),
|
|
112
131
|
col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
|
|
113
|
-
col({
|
|
132
|
+
col({
|
|
133
|
+
key: 'status',
|
|
134
|
+
header: 'Status',
|
|
135
|
+
renderer: statusRenderer,
|
|
136
|
+
rendererOptions: { tone: { Paid: 'success', Open: 'info' } },
|
|
137
|
+
}),
|
|
114
138
|
col({ key: 'placedAt', header: 'Placed', renderer: dateRenderer, sortable: true }),
|
|
115
139
|
]
|
|
116
140
|
</script>
|
|
117
141
|
|
|
118
142
|
<template>
|
|
119
|
-
<VGrid
|
|
143
|
+
<VGrid
|
|
144
|
+
:rows="orders"
|
|
145
|
+
:columns="columns"
|
|
146
|
+
row-key="id"
|
|
147
|
+
:features="[sortingFeature]"
|
|
148
|
+
sort-mode="client"
|
|
149
|
+
style="height: 480px"
|
|
150
|
+
/>
|
|
120
151
|
</template>
|
|
121
152
|
```
|
|
122
153
|
|
|
@@ -125,21 +156,41 @@ const columns = [
|
|
|
125
156
|
```vue
|
|
126
157
|
<script setup lang="ts">
|
|
127
158
|
import {
|
|
128
|
-
VGrid,
|
|
129
|
-
|
|
159
|
+
VGrid,
|
|
160
|
+
VGridColumnMenu,
|
|
161
|
+
VGridSearch,
|
|
162
|
+
columnVisibilityFeature,
|
|
163
|
+
filteringFeature,
|
|
164
|
+
sortingFeature,
|
|
165
|
+
type FilterState,
|
|
130
166
|
} from '@nocopypaste/vue-grid'
|
|
131
167
|
const filters = ref<FilterState | null>(null)
|
|
132
168
|
// columns: add `filterable: true` (type from the renderer, or `filter: 'date'` etc.)
|
|
133
169
|
</script>
|
|
134
170
|
|
|
135
171
|
<template>
|
|
136
|
-
<VGrid
|
|
137
|
-
|
|
138
|
-
|
|
172
|
+
<VGrid
|
|
173
|
+
v-model:filters="filters"
|
|
174
|
+
:rows="rows"
|
|
175
|
+
:columns="columns"
|
|
176
|
+
row-key="id"
|
|
177
|
+
filter-row
|
|
178
|
+
sort-mode="client"
|
|
179
|
+
storage="orders-grid"
|
|
180
|
+
filter-storage="orders-filters"
|
|
181
|
+
:features="[sortingFeature, filteringFeature, columnVisibilityFeature]"
|
|
182
|
+
style="height: 480px"
|
|
183
|
+
>
|
|
139
184
|
<template #toolbar="{ columnState, setColumnState, activeFilterCount, clearFilters }">
|
|
140
185
|
<VGridSearch />
|
|
141
|
-
<button v-if="activeFilterCount" @click="clearFilters()">
|
|
142
|
-
|
|
186
|
+
<button v-if="activeFilterCount" @click="clearFilters()">
|
|
187
|
+
Clear {{ activeFilterCount }}
|
|
188
|
+
</button>
|
|
189
|
+
<VGridColumnMenu
|
|
190
|
+
:columns="columns"
|
|
191
|
+
:column-state="columnState"
|
|
192
|
+
@update:column-state="setColumnState($event!)"
|
|
193
|
+
/>
|
|
143
194
|
</template>
|
|
144
195
|
</VGrid>
|
|
145
196
|
</template>
|
|
@@ -148,19 +199,36 @@ const filters = ref<FilterState | null>(null)
|
|
|
148
199
|
### Server data with paging
|
|
149
200
|
|
|
150
201
|
```ts
|
|
151
|
-
import {
|
|
202
|
+
import {
|
|
203
|
+
filteringFeature,
|
|
204
|
+
paginationFeature,
|
|
205
|
+
serverDataFeature,
|
|
206
|
+
sortingFeature,
|
|
207
|
+
type DataSource,
|
|
208
|
+
} from '@nocopypaste/vue-grid'
|
|
152
209
|
|
|
153
210
|
const fetchOrders: DataSource<Order> = async (query, { signal }) => {
|
|
154
211
|
// query: { sort: { key, dir } | null, filters: { columns, search }, page, pageSize }
|
|
155
|
-
const res = await fetch('/api/orders/search', {
|
|
212
|
+
const res = await fetch('/api/orders/search', {
|
|
213
|
+
method: 'POST',
|
|
214
|
+
body: JSON.stringify(query),
|
|
215
|
+
signal,
|
|
216
|
+
})
|
|
156
217
|
if (!res.ok) throw new Error(res.statusText) // the grid shows an error with Retry, emits load-error
|
|
157
218
|
return res.json() as Promise<{ rows: Order[]; total: number }>
|
|
158
219
|
}
|
|
159
220
|
```
|
|
160
221
|
|
|
161
222
|
```vue
|
|
162
|
-
<VGrid
|
|
163
|
-
|
|
223
|
+
<VGrid
|
|
224
|
+
:data-source="fetchOrders"
|
|
225
|
+
:columns="columns"
|
|
226
|
+
row-key="id"
|
|
227
|
+
pagination
|
|
228
|
+
filter-row
|
|
229
|
+
:features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]"
|
|
230
|
+
style="height: 520px"
|
|
231
|
+
/>
|
|
164
232
|
```
|
|
165
233
|
|
|
166
234
|
Server totals: pass them as `:aggregates="{ total: 125000 }"` with `totals` and `aggregationFeature`.
|
|
@@ -169,10 +237,23 @@ Server totals: pass them as `:aggregates="{ total: 125000 }"` with `totals` and
|
|
|
169
237
|
|
|
170
238
|
```vue
|
|
171
239
|
<!-- synchronous children -->
|
|
172
|
-
<VGrid
|
|
240
|
+
<VGrid
|
|
241
|
+
:rows="markets"
|
|
242
|
+
:columns="columns"
|
|
243
|
+
row-key="id"
|
|
244
|
+
:sub-rows="(m) => m.children"
|
|
245
|
+
:features="[subGridsFeature]"
|
|
246
|
+
/>
|
|
173
247
|
<!-- lazy children, fetched on first expand -->
|
|
174
|
-
<VGrid
|
|
175
|
-
|
|
248
|
+
<VGrid
|
|
249
|
+
:rows="folders"
|
|
250
|
+
:columns="columns"
|
|
251
|
+
row-key="id"
|
|
252
|
+
:load-sub-rows="loadChildren"
|
|
253
|
+
:has-sub-rows="(f) => f.hasChildren"
|
|
254
|
+
v-model:expanded="expanded"
|
|
255
|
+
:features="[subGridsFeature]"
|
|
256
|
+
/>
|
|
176
257
|
```
|
|
177
258
|
|
|
178
259
|
Children share the parent's columns. For a different set of columns, use the `#detail` slot with
|
|
@@ -189,8 +270,16 @@ another `<VGrid>` inside.
|
|
|
189
270
|
### Selection and batch actions
|
|
190
271
|
|
|
191
272
|
```vue
|
|
192
|
-
<VGrid
|
|
193
|
-
|
|
273
|
+
<VGrid
|
|
274
|
+
v-model:selected="selected"
|
|
275
|
+
:rows="rows"
|
|
276
|
+
:columns="columns"
|
|
277
|
+
row-key="id"
|
|
278
|
+
selectable
|
|
279
|
+
prune-selection
|
|
280
|
+
:is-row-selectable="(r) => r.status !== 'locked'"
|
|
281
|
+
:features="[selectionFeature]"
|
|
282
|
+
>
|
|
194
283
|
<template #toolbar="{ selected, selectedCount, clearSelection }">
|
|
195
284
|
<span v-if="selectedCount">{{ selectedCount }} selected
|
|
196
285
|
<button @click="approve(selected).then(clearSelection)">Approve</button></span>
|
|
@@ -205,8 +294,15 @@ the banner's "Select all N rows" sets `v-model:select-all-matching`; act on the
|
|
|
205
294
|
### 10,000+ rows
|
|
206
295
|
|
|
207
296
|
```vue
|
|
208
|
-
<VGrid
|
|
209
|
-
|
|
297
|
+
<VGrid
|
|
298
|
+
:rows="bigList"
|
|
299
|
+
:columns="columns"
|
|
300
|
+
row-key="id"
|
|
301
|
+
:virtual="{ rowHeight: 40 }"
|
|
302
|
+
sort-mode="client"
|
|
303
|
+
:features="[virtualScrollingFeature, sortingFeature]"
|
|
304
|
+
style="height: 600px"
|
|
305
|
+
/>
|
|
210
306
|
```
|
|
211
307
|
|
|
212
308
|
### Totals and pinned rows
|
|
@@ -220,8 +316,16 @@ const pinned = ref<PinnedRowsState>({ top: [42] })
|
|
|
220
316
|
```
|
|
221
317
|
|
|
222
318
|
```vue
|
|
223
|
-
<VGrid
|
|
224
|
-
|
|
319
|
+
<VGrid
|
|
320
|
+
ref="grid"
|
|
321
|
+
v-model:pinned-rows="pinned"
|
|
322
|
+
:rows="rows"
|
|
323
|
+
:columns="columns"
|
|
324
|
+
row-key="id"
|
|
325
|
+
totals
|
|
326
|
+
:features="[aggregationFeature, rowPinningFeature]"
|
|
327
|
+
style="height: 480px"
|
|
328
|
+
/>
|
|
225
329
|
<!-- grid.value.pinRow(key, 'top' | 'bottom' | null) from your own button or context menu -->
|
|
226
330
|
```
|
|
227
331
|
|
|
@@ -231,26 +335,44 @@ const pinned = ref<PinnedRowsState>({ top: [42] })
|
|
|
231
335
|
const columns = [
|
|
232
336
|
col({ key: 'customer', field: 'customer.name' }),
|
|
233
337
|
col({ key: 'status', renderer: statusRenderer, groupable: true }),
|
|
234
|
-
col({
|
|
338
|
+
col({
|
|
339
|
+
key: 'placedAt',
|
|
340
|
+
renderer: dateRenderer,
|
|
341
|
+
groupable: true,
|
|
342
|
+
groupValue: (o) => o.placedAt.slice(0, 7),
|
|
343
|
+
}),
|
|
235
344
|
col({ key: 'total', renderer: currencyRenderer, aggregate: 'sum' }), // shown in every group row
|
|
236
345
|
]
|
|
237
346
|
const groupBy = ref(['status'])
|
|
238
347
|
```
|
|
239
348
|
|
|
240
349
|
```vue
|
|
241
|
-
<VGrid
|
|
242
|
-
|
|
350
|
+
<VGrid
|
|
351
|
+
v-model:group-by="groupBy"
|
|
352
|
+
:rows="orders"
|
|
353
|
+
:columns="columns"
|
|
354
|
+
row-key="id"
|
|
355
|
+
sort-mode="client"
|
|
356
|
+
:features="[rowGroupingFeature, sortingFeature, menusFeature]"
|
|
357
|
+
style="height: 480px"
|
|
358
|
+
/>
|
|
243
359
|
```
|
|
244
360
|
|
|
245
361
|
Groups start collapsed (`groups-expanded` to open them); the group label sits in the first
|
|
246
|
-
visible column
|
|
247
|
-
|
|
362
|
+
visible column and runs across the next ones up to the first with an `aggregate`. In a narrow
|
|
363
|
+
column it drops the column name and ellipsizes the value (full label as tooltip), so give it room
|
|
364
|
+
where the value matters. `#group-<key>="{ value, count }"` renders a group's value yourself.
|
|
248
365
|
|
|
249
366
|
### CSV export and copy
|
|
250
367
|
|
|
251
368
|
```vue
|
|
252
369
|
<script setup lang="ts">
|
|
253
|
-
import {
|
|
370
|
+
import {
|
|
371
|
+
exportFeature,
|
|
372
|
+
keyboardNavigationFeature,
|
|
373
|
+
selectionFeature,
|
|
374
|
+
type VGridExposed,
|
|
375
|
+
} from '@nocopypaste/vue-grid'
|
|
254
376
|
const grid = ref<VGridExposed>()
|
|
255
377
|
// columns: `exportable: false` on action columns; `exportValue: (row) => row.id` where the cell isn't the data
|
|
256
378
|
</script>
|
|
@@ -258,8 +380,15 @@ const grid = ref<VGridExposed>()
|
|
|
258
380
|
<template>
|
|
259
381
|
<button @click="grid?.exportCsv({ filename: 'orders.csv' })">Download CSV</button>
|
|
260
382
|
<button @click="grid?.copyRows()">Copy selected</button>
|
|
261
|
-
<VGrid
|
|
262
|
-
|
|
383
|
+
<VGrid
|
|
384
|
+
ref="grid"
|
|
385
|
+
:rows="orders"
|
|
386
|
+
:columns="columns"
|
|
387
|
+
row-key="id"
|
|
388
|
+
selectable
|
|
389
|
+
:features="[exportFeature, selectionFeature, keyboardNavigationFeature]"
|
|
390
|
+
@copy="(e) => notify(e.text)"
|
|
391
|
+
/>
|
|
263
392
|
</template>
|
|
264
393
|
```
|
|
265
394
|
|
|
@@ -272,19 +401,47 @@ raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-sep
|
|
|
272
401
|
|
|
273
402
|
```vue
|
|
274
403
|
<script setup lang="ts">
|
|
275
|
-
import {
|
|
404
|
+
import {
|
|
405
|
+
actionsMenuRenderer,
|
|
406
|
+
menusFeature,
|
|
407
|
+
type CellActionEvent,
|
|
408
|
+
type CellContext,
|
|
409
|
+
type MenuItem,
|
|
410
|
+
} from '@nocopypaste/vue-grid'
|
|
276
411
|
const columns = [
|
|
277
412
|
/* … */
|
|
278
|
-
col({
|
|
279
|
-
|
|
413
|
+
col({
|
|
414
|
+
key: 'actions',
|
|
415
|
+
header: '',
|
|
416
|
+
width: 'min-content',
|
|
417
|
+
renderer: actionsMenuRenderer,
|
|
418
|
+
rendererOptions: {
|
|
419
|
+
actions: [
|
|
420
|
+
{ name: 'edit', label: 'Edit' },
|
|
421
|
+
{ separator: true },
|
|
422
|
+
{ name: 'delete', label: 'Delete', tone: 'danger' },
|
|
423
|
+
],
|
|
424
|
+
},
|
|
425
|
+
}),
|
|
280
426
|
]
|
|
281
|
-
const cellMenu = (ctx: CellContext<Order>): MenuItem[] => [
|
|
282
|
-
|
|
427
|
+
const cellMenu = (ctx: CellContext<Order>): MenuItem[] => [
|
|
428
|
+
{ name: 'copy', label: `Copy ${ctx.column.header}` },
|
|
429
|
+
]
|
|
430
|
+
function onAction(e: CellActionEvent<Order>) {
|
|
431
|
+
if (e.name === 'delete') remove(e.rowKey)
|
|
432
|
+
}
|
|
283
433
|
</script>
|
|
284
434
|
|
|
285
435
|
<template>
|
|
286
|
-
<VGrid
|
|
287
|
-
|
|
436
|
+
<VGrid
|
|
437
|
+
:rows
|
|
438
|
+
:columns
|
|
439
|
+
row-key="id"
|
|
440
|
+
:context-menu="cellMenu"
|
|
441
|
+
:features="[menusFeature]"
|
|
442
|
+
@cell-action="onAction"
|
|
443
|
+
@context-action="(e) => copy(String(e.value))"
|
|
444
|
+
/>
|
|
288
445
|
</template>
|
|
289
446
|
```
|
|
290
447
|
|
|
@@ -300,14 +457,22 @@ col({ key: 'active', renderer: switchRenderer })
|
|
|
300
457
|
```ts
|
|
301
458
|
import { defineCellRenderer } from '@nocopypaste/vue-grid'
|
|
302
459
|
import RatingCell from './RatingCell.vue' // props: CellRendererProps<Row, number, { max?: number }>; emit('action', 'rate', n)
|
|
303
|
-
export const ratingRenderer = defineCellRenderer<{ max?: number }>({
|
|
460
|
+
export const ratingRenderer = defineCellRenderer<{ max?: number }>({
|
|
461
|
+
name: 'rating',
|
|
462
|
+
component: RatingCell,
|
|
463
|
+
defaults: { max: 5 },
|
|
464
|
+
})
|
|
304
465
|
// column: { key: 'rating', renderer: ratingRenderer, rendererOptions: { max: 10 } }
|
|
305
466
|
```
|
|
306
467
|
|
|
307
468
|
### Theming
|
|
308
469
|
|
|
309
470
|
```css
|
|
310
|
-
.my-grid {
|
|
471
|
+
.my-grid {
|
|
472
|
+
--vg-color-accent: #db2777;
|
|
473
|
+
--vg-radius: 1rem;
|
|
474
|
+
--vg-font-size: 0.8125rem;
|
|
475
|
+
}
|
|
311
476
|
```
|
|
312
477
|
|
|
313
478
|
Tokens: `--vg-*` (see README → Theming). Dark mode follows `color-scheme`. Density:
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.2 — 2026-11-24
|
|
4
|
+
|
|
5
|
+
Row grouping fixes:
|
|
6
|
+
|
|
7
|
+
- **Keyboard:** ↑ / ↓ / PageUp / PageDown move by column, not by cell index, and keep their
|
|
8
|
+
column across a group row whose label spans several columns. Before, ↑ from Stake onto a group
|
|
9
|
+
row could land on another column's aggregate.
|
|
10
|
+
- **Narrow first column:** the label used to give its room to the column name, leaving the value
|
|
11
|
+
invisible ("City 27" on every group). Now, under 12rem, the column name is dropped and the value
|
|
12
|
+
ellipsized; the count stays, and the whole label is the cell's tooltip. The label no longer
|
|
13
|
+
widens a narrow first column.
|
|
14
|
+
|
|
15
|
+
Docs: every renderer option (141) and every field of the public types (event payloads, menu
|
|
16
|
+
items, `createVueGrid` config, sort and pinned-row state) now has a description, in the editor's
|
|
17
|
+
hover help, the API reference, the JSON Schema and the MCP server's tools; a test keeps it that
|
|
18
|
+
way. New exported type `SignedNumberOptions` (the `signed-number` renderer's options).
|
|
19
|
+
|
|
20
|
+
## 0.3.1 — 2026-11-24
|
|
21
|
+
|
|
22
|
+
Releases are published from GitHub Actions with npm trusted publishing, so every version from
|
|
23
|
+
now on carries npm provenance (a signed link to the commit and workflow that built it). CI runs
|
|
24
|
+
the unit tests and the browser tests in Chromium, Firefox and WebKit on every push.
|
|
25
|
+
|
|
26
|
+
Fix (Safari): an open menu (row actions, cell and header menus) now hides when its trigger is
|
|
27
|
+
scrolled out of the grid. WebKit accepts CSS `position-visibility: anchor-visible` but didn't hide
|
|
28
|
+
it there; the grid's JavaScript fallback now always runs next to the CSS.
|
|
29
|
+
|
|
3
30
|
## 0.3.0 — 2026-11-24
|
|
4
31
|
|
|
5
32
|
**Row grouping** (`rowGroupingFeature`): `v-model:group-by` groups the rows by one or more
|