@nocopypaste/vue-grid 0.5.0 → 0.6.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 +4 -2
- package/CHANGELOG.md +13 -0
- package/README.md +49 -27
- package/agent/api.json +14 -2
- package/agent/api.md +4 -2
- package/dist/agent/api.js +14 -2
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +161 -159
- package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/useGridExport.js +83 -51
- package/dist/composables/useGridExport.js.map +1 -1
- package/dist/core/xlsx.js +172 -0
- package/dist/core/xlsx.js.map +1 -0
- package/dist/features/export.js.map +1 -1
- package/dist/index.js +55 -54
- package/dist/types/composables/useGridExport.d.ts +5 -1
- package/dist/types/core/xlsx.d.ts +34 -0
- package/dist/types/features/export.d.ts +5 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types.d.ts +14 -0
- package/llms-full.txt +57 -31
- package/llms.txt +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,57 +16,58 @@ import { compareValues as U, nextSort as W, sortRows as G } from "./core/sort.js
|
|
|
16
16
|
import { aggregateRows as K, aggregateValues as q } from "./core/aggregate.js";
|
|
17
17
|
import { groupRows as J, isRowGroup as Y } from "./core/grouping.js";
|
|
18
18
|
import { guardFormula as X, plainText as Z, toCsv as Q, toDelimited as $ } from "./core/csv.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import pe from "./
|
|
25
|
-
import me from "./renderers/
|
|
26
|
-
import he from "./renderers/
|
|
27
|
-
import ge from "./renderers/
|
|
28
|
-
import _e from "./renderers/
|
|
29
|
-
import ve from "./renderers/
|
|
30
|
-
import ye from "./renderers/
|
|
31
|
-
import be from "./renderers/
|
|
32
|
-
import xe from "./renderers/
|
|
33
|
-
import Se from "./renderers/
|
|
34
|
-
import Ce from "./renderers/
|
|
35
|
-
import we from "./renderers/
|
|
36
|
-
import Te from "./renderers/
|
|
37
|
-
import Ee from "./renderers/
|
|
38
|
-
import De from "./renderers/
|
|
39
|
-
import Oe from "./renderers/
|
|
40
|
-
import ke from "./renderers/
|
|
41
|
-
import Ae from "./renderers/
|
|
42
|
-
import je from "./renderers/
|
|
43
|
-
import Me from "./renderers/
|
|
44
|
-
import Ne from "./renderers/
|
|
45
|
-
import Pe from "./renderers/
|
|
46
|
-
import Fe from "./renderers/
|
|
47
|
-
import Ie from "./renderers/
|
|
48
|
-
import Le from "./renderers/
|
|
49
|
-
import Re from "./renderers/
|
|
50
|
-
import ze from "./renderers/
|
|
51
|
-
import
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
|
|
19
|
+
import { toXlsx as ee } from "./core/xlsx.js";
|
|
20
|
+
import { patchRows as te } from "./core/patch.js";
|
|
21
|
+
import { activeFilterCount as ne, emptyFilters as re, filterTree as ie, foldText as ae, isFilterActive as oe, localFilterStorage as se, matchesFilter as ce, parseQuickFilter as le, setKey as ue } from "./core/filter.js";
|
|
22
|
+
import { localStorageAdapter as de } from "./core/storage.js";
|
|
23
|
+
import { pageItems as fe } from "./core/pagination.js";
|
|
24
|
+
import { createColumnHelper as pe } from "./core/helpers.js";
|
|
25
|
+
import me from "./renderers/ActionButtonCell.js";
|
|
26
|
+
import he from "./renderers/ActionsMenuCell.js";
|
|
27
|
+
import ge from "./renderers/BooleanCell.js";
|
|
28
|
+
import _e from "./renderers/ChangeCell.js";
|
|
29
|
+
import ve from "./renderers/CurrencyCell.js";
|
|
30
|
+
import ye from "./renderers/DateCell.js";
|
|
31
|
+
import be from "./renderers/DateTimeCell.js";
|
|
32
|
+
import xe from "./renderers/IconCell.js";
|
|
33
|
+
import Se from "./renderers/JsonCell.js";
|
|
34
|
+
import Ce from "./renderers/JsonTreeCell.js";
|
|
35
|
+
import we from "./renderers/LinkCell.js";
|
|
36
|
+
import Te from "./renderers/NumberCell.js";
|
|
37
|
+
import Ee from "./renderers/StatusCell.js";
|
|
38
|
+
import De from "./renderers/ToggleTextCell.js";
|
|
39
|
+
import Oe from "./renderers/ButtonGroupCell.js";
|
|
40
|
+
import ke from "./renderers/CheckboxCell.js";
|
|
41
|
+
import Ae from "./renderers/ChipCell.js";
|
|
42
|
+
import je from "./renderers/CodeCell.js";
|
|
43
|
+
import Me from "./renderers/CopyCell.js";
|
|
44
|
+
import Ne from "./renderers/DetailsCell.js";
|
|
45
|
+
import Pe from "./renderers/EditCell.js";
|
|
46
|
+
import Fe from "./renderers/IconToggleCell.js";
|
|
47
|
+
import Ie from "./renderers/ImageCell.js";
|
|
48
|
+
import Le from "./renderers/ListCell.js";
|
|
49
|
+
import Re from "./renderers/MultiLineCell.js";
|
|
50
|
+
import ze from "./renderers/RadioCell.js";
|
|
51
|
+
import Be from "./renderers/SwitchCell.js";
|
|
52
|
+
import { actionButtonRenderer as Ve, actionsMenuRenderer as He, allRenderers as Ue, booleanRenderer as We, buttonGroupRenderer as Ge, changeRenderer as Ke, checkboxRenderer as qe, chipRenderer as Je, codeRenderer as Ye, copyRenderer as Xe, currencyRenderer as Ze, dateRenderer as Qe, dateTimeRenderer as $e, detailsRenderer as et, editRenderer as tt, iconRenderer as nt, iconToggleRenderer as rt, imageRenderer as it, jsonRenderer as at, jsonTreeRenderer as ot, linkRenderer as st, listRenderer as ct, multiLineRenderer as lt, numberRenderer as ut, radioRenderer as dt, signedNumberRenderer as ft, statusRenderer as pt, switchRenderer as mt, toggleTextRenderer as ht } from "./renderers/index.js";
|
|
53
|
+
import { aggregationFeature as gt } from "./features/aggregation.js";
|
|
54
|
+
import { columnGroupsFeature as _t } from "./features/columnGroups.js";
|
|
55
|
+
import { columnPinningFeature as vt } from "./features/columnPinning.js";
|
|
56
|
+
import { columnResizingFeature as yt } from "./features/columnResizing.js";
|
|
57
|
+
import { columnReorderFeature as bt } from "./features/columnReorder.js";
|
|
58
|
+
import { columnVisibilityFeature as xt } from "./features/columnVisibility.js";
|
|
59
|
+
import { exportFeature as St } from "./features/export.js";
|
|
60
|
+
import { filteringFeature as Ct } from "./features/filtering.js";
|
|
61
|
+
import { keyboardNavigationFeature as wt } from "./features/keyboardNavigation.js";
|
|
62
|
+
import { menusFeature as Tt } from "./features/menus.js";
|
|
63
|
+
import { paginationFeature as Et } from "./features/pagination.js";
|
|
64
|
+
import { rowGroupingFeature as Dt } from "./features/rowGrouping.js";
|
|
65
|
+
import { rowPinningFeature as Ot } from "./features/rowPinning.js";
|
|
66
|
+
import { selectionFeature as kt } from "./features/selection.js";
|
|
67
|
+
import { serverDataFeature as At } from "./features/serverData.js";
|
|
68
|
+
import { sortingFeature as jt } from "./features/sorting.js";
|
|
69
|
+
import { statusBarFeature as Mt } from "./features/statusBar.js";
|
|
70
|
+
import { subGridsFeature as Nt } from "./features/subGrids.js";
|
|
71
|
+
import { virtualScrollingFeature as Pt } from "./features/virtualScrolling.js";
|
|
72
|
+
import { allFeatures as Ft } from "./features/index.js";
|
|
73
|
+
export { me as ActionButtonCell, he as ActionsMenuCell, ge as BooleanCell, Oe as ButtonGroupCell, _e as ChangeCell, ke as CheckboxCell, Ae as ChipCell, je as CodeCell, Me as CopyCell, ve as CurrencyCell, d as DATE_DEFAULT, ye as DateCell, be as DateTimeCell, Ne as DetailsCell, Pe as EditCell, D as GRID_CONFIG_KEY, xe as IconCell, Fe as IconToggleCell, Ie as ImageCell, Se as JsonCell, Ce as JsonTreeCell, we as LinkCell, Le as ListCell, Re as MultiLineCell, Te as NumberCell, ze as RadioCell, Ee as StatusCell, Be as SwitchCell, f as TIME_DEFAULT, l as TextCell, De as ToggleTextCell, e as VGrid, n as VGridColumnMenu, r as VGridMenu, t as VGridPagination, i as VGridSearch, Ve as actionButtonRenderer, He as actionsMenuRenderer, ne as activeFilterCount, K as aggregateRows, q as aggregateValues, gt as aggregationFeature, Ft as allFeatures, Ue as allRenderers, T as anchorNameFor, We as booleanRenderer, Ge as buttonGroupRenderer, Ke as changeRenderer, qe as checkboxRenderer, Je as chipRenderer, Ye as codeRenderer, _t as columnGroupsFeature, vt as columnPinningFeature, bt as columnReorderFeature, yt as columnResizingFeature, xt as columnVisibilityFeature, U as compareValues, Xe as copyRenderer, pe as createColumnHelper, A as createRendererRegistry, O as createVueGrid, Ze as currencyRenderer, Qe as dateRenderer, $e as dateTimeRenderer, j as defineCellRenderer, et as detailsRenderer, tt as editRenderer, I as effectivePin, re as emptyFilters, St as exportFeature, ie as filterTree, Ct as filteringFeature, ae as foldText, p as formatCurrency, m as formatDate, h as formatNumber, g as formatSigned, N as getByPath, P as getCellValue, J as groupRows, X as guardFormula, nt as iconRenderer, rt as iconToggleRenderer, it as imageRenderer, oe as isFilterActive, M as isRendererDefinition, Y as isRowGroup, at as jsonRenderer, ot as jsonTreeRenderer, wt as keyboardNavigationFeature, st as linkRenderer, ct as listRenderer, se as localFilterStorage, de as localStorageAdapter, a as lookup, ce as matchesFilter, Tt as menusFeature, L as moveColumn, R as moveColumnRelative, lt as multiLineRenderer, W as nextSort, z as normalizeColumnState, ut as numberRenderer, fe as pageItems, Et as paginationFeature, _ as parseJsonish, le as parseQuickFilter, te as patchRows, Z as plainText, dt as radioRenderer, v as readableTextColor, y as resolveImageSrc, o as resolveOption, F as resolveRowKey, s as resolveTone, Dt as rowGroupingFeature, Ot as rowPinningFeature, b as safeHref, c as safeTone, kt as selectionFeature, At as serverDataFeature, B as setColumnHidden, V as setColumnPinned, ue as setKey, ft as signedNumberRenderer, G as sortRows, jt as sortingFeature, Mt as statusBarFeature, pt as statusRenderer, x as stringifyJson, Nt as subGridsFeature, E as supportsAnchorPositioning, mt as switchRenderer, u as textRenderer, Q as toCsv, S as toDate, $ as toDelimited, C as toNumber, ee as toXlsx, ht as toggleTextRenderer, w as tokenizeJson, k as useGridContext, Pt as virtualScrollingFeature, H as visibleColumns };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import type { ResolvedColumn } from '../internal/context';
|
|
3
|
-
import type { CellRendererDefinition, ColumnDef, CopyEvent, ExportOptions, FormatContext, RowKey } from '../types';
|
|
3
|
+
import type { CellRendererDefinition, ColumnDef, CopyEvent, ExportOptions, FormatContext, RowKey, XlsxExportOptions } from '../types';
|
|
4
4
|
export interface GridExportOptions<T> {
|
|
5
5
|
/** The visible columns, resolved (renderer definition and options). */
|
|
6
6
|
columns: () => readonly ResolvedColumn[];
|
|
@@ -44,6 +44,10 @@ export declare function useGridExport<T>(opts: GridExportOptions<T>): {
|
|
|
44
44
|
filename?: string;
|
|
45
45
|
bom?: boolean;
|
|
46
46
|
}) => void;
|
|
47
|
+
getXlsx: (o?: XlsxExportOptions) => Promise<Blob>;
|
|
48
|
+
exportXlsx: (o?: XlsxExportOptions & {
|
|
49
|
+
filename?: string;
|
|
50
|
+
}) => Promise<void>;
|
|
47
51
|
copyRows: (o?: ExportOptions) => Promise<boolean>;
|
|
48
52
|
onKeyDown: (event: KeyboardEvent) => void;
|
|
49
53
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ColumnDef } from '../types';
|
|
2
|
+
/** How a column's values are written: Excel number formats for money, percentages and dates. */
|
|
3
|
+
export type XlsxFormat = 'auto' | 'number' | 'money' | 'percent' | 'date' | 'datetime';
|
|
4
|
+
export interface ToXlsxOptions {
|
|
5
|
+
/** The sheet's name (31 characters at most; `[]:*?/\` are dropped). Default `Sheet1`. */
|
|
6
|
+
sheetName?: string;
|
|
7
|
+
/** A bold header line with the column headers, frozen. Default `true`. */
|
|
8
|
+
header?: boolean;
|
|
9
|
+
/** Time zone that date-times are written in (Excel dates have none). Default: the browser's. */
|
|
10
|
+
timeZone?: string;
|
|
11
|
+
/** Formats by column key, instead of the ones guessed from each column's renderer. */
|
|
12
|
+
formats?: Record<string, XlsxFormat>;
|
|
13
|
+
}
|
|
14
|
+
/** One sheet, ready to write: values are raw (typed) or text. */
|
|
15
|
+
export interface XlsxSheet {
|
|
16
|
+
name?: string;
|
|
17
|
+
header?: readonly string[];
|
|
18
|
+
formats: readonly XlsxFormat[];
|
|
19
|
+
rows: readonly (readonly unknown[])[];
|
|
20
|
+
/** A last, bold line (the totals row). */
|
|
21
|
+
footer?: readonly unknown[];
|
|
22
|
+
timeZone?: string;
|
|
23
|
+
}
|
|
24
|
+
/** The Excel format a column's renderer implies (`currency` → money, `date` → date, …). */
|
|
25
|
+
export declare function xlsxFormatOf(col: ColumnDef): XlsxFormat;
|
|
26
|
+
/**
|
|
27
|
+
* Rows as an Excel workbook (the bytes of an .xlsx file): one row per row, one cell per column
|
|
28
|
+
* (its `exportValue`, else the cell value), typed: numbers, dates and booleans stay what they are.
|
|
29
|
+
* Columns with `exportable: false` are left out. For the grid's own rows, filters and sort, use
|
|
30
|
+
* the export feature (`grid.exportXlsx()`).
|
|
31
|
+
*/
|
|
32
|
+
export declare function toXlsx<T>(rows: readonly T[], columns: readonly ColumnDef<T>[], options?: ToXlsxOptions): Uint8Array;
|
|
33
|
+
/** The bytes of an .xlsx file with one sheet. */
|
|
34
|
+
export declare function writeXlsx(sheet: XlsxSheet): Uint8Array;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ExportFeature } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* CSV export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a
|
|
4
|
-
* `grid.getCsv()` returns the text, `grid.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* CSV and Excel export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a
|
|
4
|
+
* CSV file, `grid.getCsv()` returns the text, `grid.exportXlsx()` / `grid.getXlsx()` write an Excel
|
|
5
|
+
* workbook with typed cells (the writer loads on demand), `grid.copyRows()` copies rows as
|
|
6
|
+
* tab-separated text, and Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed.
|
|
7
|
+
* Columns can set `exportValue` and `exportable: false`. Without it those methods only warn.
|
|
7
8
|
*/
|
|
8
9
|
export declare const exportFeature: ExportFeature;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { nextSort, sortRows, compareValues } from './core/sort';
|
|
|
12
12
|
export { aggregateRows, aggregateValues } from './core/aggregate';
|
|
13
13
|
export { groupRows, isRowGroup, type RowGroup, type GroupRowsOptions } from './core/grouping';
|
|
14
14
|
export { toCsv, toDelimited, plainText, guardFormula, type ToCsvOptions } from './core/csv';
|
|
15
|
+
export { toXlsx, type ToXlsxOptions, type XlsxFormat } from './core/xlsx';
|
|
15
16
|
export { patchRows, type RowPatches, type PatchRowsOptions } from './core/patch';
|
|
16
17
|
export type { DataSource, DataSourceResult, GridQuery } from './composables/useDataSource';
|
|
17
18
|
export { activeFilterCount, emptyFilters, filterTree, foldText, isFilterActive, localFilterStorage, matchesFilter, parseQuickFilter, setKey, type BooleanFilter, type CustomFilter, type DateFilter, type DateFilterOp, type NumberFilter, type NumberFilterOp, type SetFilter, type TextFilter, type TextFilterOp, } from './core/filter';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -350,6 +350,15 @@ export interface VGridExposed {
|
|
|
350
350
|
filename?: string;
|
|
351
351
|
bom?: boolean;
|
|
352
352
|
}): void;
|
|
353
|
+
/**
|
|
354
|
+
* The rows as an Excel workbook (.xlsx): typed cells (numbers, dates, booleans), number formats
|
|
355
|
+
* from the columns' renderers, a bold frozen header. The writer loads on demand. Export feature.
|
|
356
|
+
*/
|
|
357
|
+
getXlsx(options?: XlsxExportOptions): Promise<Blob>;
|
|
358
|
+
/** Downloads the rows as an Excel file (`filename`, default `export.xlsx`). Export feature. */
|
|
359
|
+
exportXlsx(options?: XlsxExportOptions & {
|
|
360
|
+
filename?: string;
|
|
361
|
+
}): Promise<void>;
|
|
353
362
|
/**
|
|
354
363
|
* Copies rows to the clipboard as tab-separated text (pastes as cells into spreadsheets): the
|
|
355
364
|
* selected rows by default, as displayed, no header. Resolves `false` if nothing was copied.
|
|
@@ -379,6 +388,11 @@ export interface ExportOptions {
|
|
|
379
388
|
/** Prefix text a spreadsheet would run as a formula (`=…`, `+…`, `@…`) with `'`. Default `true`. */
|
|
380
389
|
guard?: boolean;
|
|
381
390
|
}
|
|
391
|
+
/** Options of `getXlsx` / `exportXlsx` (export feature): the CSV ones, without the text-only ones. */
|
|
392
|
+
export interface XlsxExportOptions extends Omit<ExportOptions, 'delimiter' | 'guard'> {
|
|
393
|
+
/** The sheet's name (31 characters at most). Default `Sheet1`. */
|
|
394
|
+
sheetName?: string;
|
|
395
|
+
}
|
|
382
396
|
/** Something was copied to the clipboard (export feature): rows (`copyRows`, Ctrl+C) or one cell. */
|
|
383
397
|
export interface CopyEvent<T = any> {
|
|
384
398
|
kind: 'rows' | 'cell';
|
package/llms-full.txt
CHANGED
|
@@ -64,7 +64,7 @@ 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, copy rows / cells (Ctrl+C)
|
|
67
|
+
| Download CSV or Excel, copy rows / cells (Ctrl+C) | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `exportXlsx()`, `getXlsx()`, `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
69
|
| Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
|
|
70
70
|
| Remember column layout | — | `storage="orders-grid"` (localStorage key) |
|
|
@@ -365,7 +365,7 @@ visible column and runs across the next ones up to the first with an `aggregate`
|
|
|
365
365
|
column it drops the column name and ellipsizes the value (full label as tooltip), so give it room
|
|
366
366
|
where the value matters. `#group-<key>="{ value, count }"` renders a group's value yourself.
|
|
367
367
|
|
|
368
|
-
### CSV export and copy
|
|
368
|
+
### CSV / Excel export and copy
|
|
369
369
|
|
|
370
370
|
```vue
|
|
371
371
|
<script setup lang="ts">
|
|
@@ -398,6 +398,8 @@ const grid = ref<VGridExposed>()
|
|
|
398
398
|
raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-separated. Options:
|
|
399
399
|
`rows: 'filtered' | 'all' | 'page' | 'selected'`, `columns: [keys]`, `values: 'raw' | 'formatted'`,
|
|
400
400
|
`header`, `totals`, `children`, `delimiter`. `toCsv(rows, columns)` works without a grid.
|
|
401
|
+
`exportXlsx({ filename, sheetName })` / `getXlsx()` (a Promise) write an Excel file with typed cells
|
|
402
|
+
(numbers, dates, booleans) and number formats from the renderers; `toXlsx(rows, columns)` without a grid.
|
|
401
403
|
|
|
402
404
|
### Row actions and context menu
|
|
403
405
|
|
|
@@ -520,7 +522,7 @@ only sees stylesheet rules. Density:
|
|
|
520
522
|
|
|
521
523
|
---
|
|
522
524
|
|
|
523
|
-
# @nocopypaste/vue-grid 0.
|
|
525
|
+
# @nocopypaste/vue-grid 0.6.0 — API reference
|
|
524
526
|
|
|
525
527
|
> Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
|
|
526
528
|
|
|
@@ -536,7 +538,7 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
536
538
|
| `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` |
|
|
537
539
|
| `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` |
|
|
538
540
|
| `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` |
|
|
539
|
-
| `exportFeature` | CSV export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `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` |
|
|
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` |
|
|
540
542
|
| `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` |
|
|
541
543
|
| `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. | | |
|
|
542
544
|
| `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` | |
|
|
@@ -662,6 +664,8 @@ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid
|
|
|
662
664
|
| `clearSelection` | `void` | | Clears the selection, "all matching rows" included. Selection feature. |
|
|
663
665
|
| `getCsv` | `string` | | The rows as CSV text: the filtered, sorted rows, visible columns, raw values. Export feature. |
|
|
664
666
|
| `exportCsv` | `void` | | Downloads the rows as a CSV file (`filename`, default `export.csv`; UTF-8 with a BOM). Export feature. |
|
|
667
|
+
| `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
|
+
| `exportXlsx` | `Promise<void>` | | Downloads the rows as an Excel file (`filename`, default `export.xlsx`). Export feature. |
|
|
665
669
|
| `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. |
|
|
666
670
|
|
|
667
671
|
## `ColumnDef<T>`
|
|
@@ -1308,7 +1312,7 @@ an opt-in feature:
|
|
|
1308
1312
|
| `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 |
|
|
1309
1313
|
| `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
|
|
1310
1314
|
| `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 |
|
|
1311
|
-
| `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable`
|
|
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` |
|
|
1312
1316
|
| `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 |
|
|
1313
1317
|
|
|
1314
1318
|
```ts
|
|
@@ -1353,33 +1357,33 @@ what you import.
|
|
|
1353
1357
|
|
|
1354
1358
|
| Import (minified / gzip, Vue excluded) | Initial chunk |
|
|
1355
1359
|
| ---------------------------------------------------------------------------- | ------------------ |
|
|
1356
|
-
| `VGrid` (no features) | 40.
|
|
1357
|
-
| `VGrid` + `sortingFeature` | 41.
|
|
1358
|
-
| `VGrid` + `filteringFeature` |
|
|
1359
|
-
| `VGrid` + `serverDataFeature` | 41.
|
|
1360
|
-
| `VGrid` + `paginationFeature` | 40.
|
|
1361
|
-
| `VGrid` + `selectionFeature` | 44.
|
|
1362
|
-
| `VGrid` + `subGridsFeature` | 42.
|
|
1363
|
-
| `VGrid` + `menusFeature` | 50.
|
|
1364
|
-
| `VGrid` + `columnReorderFeature` | 44.
|
|
1365
|
-
| `VGrid` + `columnPinningFeature` | 43.
|
|
1366
|
-
| `VGrid` + `virtualScrollingFeature` | 46.
|
|
1367
|
-
| `VGrid` + `columnVisibilityFeature` | 40.
|
|
1368
|
-
| `VGrid` + `keyboardNavigationFeature` | 43.
|
|
1369
|
-
| `VGrid` + `columnResizingFeature` | 43.
|
|
1370
|
-
| `VGrid` + `columnGroupsFeature` | 41.
|
|
1371
|
-
| `VGrid` + `rowPinningFeature` | 45.
|
|
1372
|
-
| `VGrid` + `aggregationFeature` | 45.
|
|
1373
|
-
| `VGrid` + `rowGroupingFeature` | 50.
|
|
1374
|
-
| `VGrid` + `exportFeature` |
|
|
1375
|
-
| `VGrid` + `statusBarFeature` | 42.
|
|
1376
|
-
| `VGrid` + `allFeatures` + `VGridSearch` |
|
|
1377
|
-
| `VGrid` + `currencyRenderer` | 41.
|
|
1378
|
-
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 47.
|
|
1360
|
+
| `VGrid` (no features) | 40.4 kB / 14.1 kB |
|
|
1361
|
+
| `VGrid` + `sortingFeature` | 41.2 kB / 14.3 kB |
|
|
1362
|
+
| `VGrid` + `filteringFeature` | 51.0 kB / 17.8 kB |
|
|
1363
|
+
| `VGrid` + `serverDataFeature` | 41.8 kB / 14.6 kB |
|
|
1364
|
+
| `VGrid` + `paginationFeature` | 40.6 kB / 14.1 kB |
|
|
1365
|
+
| `VGrid` + `selectionFeature` | 44.6 kB / 15.5 kB |
|
|
1366
|
+
| `VGrid` + `subGridsFeature` | 42.8 kB / 14.9 kB |
|
|
1367
|
+
| `VGrid` + `menusFeature` | 50.9 kB / 17.6 kB |
|
|
1368
|
+
| `VGrid` + `columnReorderFeature` | 44.1 kB / 15.3 kB |
|
|
1369
|
+
| `VGrid` + `columnPinningFeature` | 43.4 kB / 15.1 kB |
|
|
1370
|
+
| `VGrid` + `virtualScrollingFeature` | 46.2 kB / 16.2 kB |
|
|
1371
|
+
| `VGrid` + `columnVisibilityFeature` | 40.6 kB / 14.1 kB |
|
|
1372
|
+
| `VGrid` + `keyboardNavigationFeature` | 43.2 kB / 15.1 kB |
|
|
1373
|
+
| `VGrid` + `columnResizingFeature` | 43.7 kB / 15.2 kB |
|
|
1374
|
+
| `VGrid` + `columnGroupsFeature` | 41.7 kB / 14.5 kB |
|
|
1375
|
+
| `VGrid` + `rowPinningFeature` | 45.4 kB / 15.4 kB |
|
|
1376
|
+
| `VGrid` + `aggregationFeature` | 45.6 kB / 15.5 kB |
|
|
1377
|
+
| `VGrid` + `rowGroupingFeature` | 50.2 kB / 16.9 kB |
|
|
1378
|
+
| `VGrid` + `exportFeature` | 45.0 kB / 15.8 kB |
|
|
1379
|
+
| `VGrid` + `statusBarFeature` | 42.8 kB / 15.0 kB |
|
|
1380
|
+
| `VGrid` + `allFeatures` + `VGridSearch` | 107.7 kB / 36.3 kB |
|
|
1381
|
+
| `VGrid` + `currencyRenderer` | 41.8 kB / 14.5 kB |
|
|
1382
|
+
| `VGrid` + `VGridPagination` + `VGridColumnMenu` | 47.2 kB / 16.3 kB |
|
|
1379
1383
|
| `sortRows` only | 0.7 kB / 0.4 kB |
|
|
1380
1384
|
| `toCsv` only | 1.1 kB / 0.6 kB |
|
|
1381
|
-
| everything |
|
|
1382
|
-
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) |
|
|
1385
|
+
| everything | 160.4 kB / 51.3 kB |
|
|
1386
|
+
| `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 70.2 kB / 19.1 kB |
|
|
1383
1387
|
|
|
1384
1388
|
With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
|
|
1385
1389
|
chunks**: they load the first time a popover opens or `filter-row` is on. With
|
|
@@ -2041,7 +2045,7 @@ same grouping elsewhere.
|
|
|
2041
2045
|
|
|
2042
2046
|
## Export and copy
|
|
2043
2047
|
|
|
2044
|
-
`exportFeature` turns the grid's rows into CSV and copies them to the clipboard.
|
|
2048
|
+
`exportFeature` turns the grid's rows into CSV or an Excel workbook and copies them to the clipboard.
|
|
2045
2049
|
|
|
2046
2050
|
```vue
|
|
2047
2051
|
<script setup lang="ts">
|
|
@@ -2100,6 +2104,28 @@ Without the grid: `toCsv(rows, columns, { delimiter, header, guard })` writes CS
|
|
|
2100
2104
|
and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(table)`,
|
|
2101
2105
|
`plainText(value)` and `guardFormula(text)` are its parts.
|
|
2102
2106
|
|
|
2107
|
+
### Excel (.xlsx)
|
|
2108
|
+
|
|
2109
|
+
**`exportXlsx(options)`** downloads an Excel workbook (`filename`, default `export.xlsx`) and
|
|
2110
|
+
**`getXlsx(options)`** resolves to it as a `Blob`; both take the options above (but `delimiter` and
|
|
2111
|
+
`guard`) plus `sheetName`.
|
|
2112
|
+
|
|
2113
|
+
```ts
|
|
2114
|
+
await grid.value?.exportXlsx({ filename: 'orders.xlsx', sheetName: 'Orders', totals: true })
|
|
2115
|
+
```
|
|
2116
|
+
|
|
2117
|
+
- **Typed cells**: numbers stay numbers, booleans booleans, and dates are Excel dates, so the sheet
|
|
2118
|
+
can sum, sort and filter them. Number formats follow the renderer: `currency` (and `change` with
|
|
2119
|
+
`currency`) → `#,##0.00`, a percent `number` → `0.00%`, `date` → `yyyy-mm-dd`, `datetime` →
|
|
2120
|
+
`yyyy-mm-dd hh:mm`, in the grid's `time-zone` (date-only values stay that day).
|
|
2121
|
+
- A bold header frozen at the top, the totals as a bold last line, column widths from the content.
|
|
2122
|
+
- Text is written as text, never as a formula. `values: 'formatted'` writes the cells as shown.
|
|
2123
|
+
- The writer (2.9 kB gzip) loads the first time you export; it has no dependencies.
|
|
2124
|
+
|
|
2125
|
+
Without the grid: `toXlsx(rows, columns, { sheetName, header, timeZone, formats })` returns the
|
|
2126
|
+
file's bytes (`Uint8Array`); `formats` overrides the guess per column key (`'money'`, `'percent'`,
|
|
2127
|
+
`'date'`, `'datetime'`, `'number'`, `'auto'`).
|
|
2128
|
+
|
|
2103
2129
|
## Status bar
|
|
2104
2130
|
|
|
2105
2131
|
`statusBarFeature` adds a bar under the grid, like a spreadsheet's:
|
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.
|
|
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.
|
|
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.6.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",
|