@opencorestack/opengridx 3.9.0 → 3.10.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/CHANGELOG.md +37 -0
- package/README.md +11 -7
- package/dist/index.d.ts +55 -0
- package/dist/opengridx.es.js +6346 -6279
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +16 -16
- package/dist/opengridx.umd.js.map +1 -1
- package/docs/API_REFERENCE.md +4 -0
- package/docs/architecture/datagrid-orchestration.md +4 -2
- package/docs/architecture/use-grid-virtualization.md +2 -0
- package/docs/components/pagination.md +1 -1
- package/docs/features/ai-toolkit.md +1 -0
- package/docs/features/rtl.md +1 -1
- package/docs/performance.md +19 -1
- package/docs/roadmap.md +26 -5
- package/lib/components/Cell/Cell.tsx +2 -1
- package/lib/components/DataGrid/DataGrid.tsx +19 -18
- package/lib/components/DataGrid/GridListView.tsx +1 -1
- package/lib/components/DataGrid/GridPinnedRows.tsx +1 -1
- package/lib/components/DataGrid/GridViewport.tsx +2 -1
- package/lib/components/DataGrid/GridVirtualRows.tsx +1 -1
- package/lib/components/Header/Header.tsx +4 -3
- package/lib/components/Row/Row.tsx +6 -2
- package/lib/components/Toolbar/AggregationPanel.tsx +90 -0
- package/lib/components/Toolbar/ColumnsPanelWrapper.tsx +56 -0
- package/lib/components/Toolbar/FilterPanelWrapper.tsx +82 -0
- package/lib/components/Toolbar/GridToolbar.tsx +7 -380
- package/lib/components/Toolbar/ToolbarIcons.tsx +35 -0
- package/lib/components/Toolbar/useToolbarPanel.ts +71 -0
- package/lib/hooks/core/gridKeyDown.ts +272 -0
- package/lib/hooks/core/useDataGrid.ts +13 -5
- package/lib/hooks/core/useGridApiMethods.ts +2 -2
- package/lib/hooks/core/useGridCellRangeDrag.ts +345 -0
- package/lib/hooks/core/useGridCellSelection.ts +17 -297
- package/lib/hooks/core/useGridColumnLookup.ts +2 -1
- package/lib/hooks/core/useGridColumns.tsx +3 -2
- package/lib/hooks/core/useGridControlledState.ts +3 -2
- package/lib/hooks/core/useGridHierarchy.ts +1 -1
- package/lib/hooks/core/useGridKeyboardNavigation.ts +51 -235
- package/lib/hooks/core/useGridLiveRowSelection.ts +2 -2
- package/lib/hooks/core/useGridRowInteractions.ts +1 -1
- package/lib/hooks/core/useGridRowSelection.ts +11 -2
- package/lib/hooks/core/useGridToolbarProps.ts +3 -2
- package/lib/hooks/features/useGridAiAssistant.ts +3 -2
- package/lib/hooks/useColumnReorder.ts +2 -1
- package/lib/hooks/useTreeData.ts +4 -2
- package/lib/types/locale.ts +22 -0
- package/lib/utils/aggregation/index.ts +16 -0
- package/lib/utils/aiAssistant.ts +46 -15
- package/lib/utils/export/excelCells.ts +244 -0
- package/lib/utils/export/exportCsv.ts +179 -0
- package/lib/utils/export/exportExcelHtml.ts +220 -0
- package/lib/utils/export/exportJson.ts +179 -0
- package/lib/utils/export/exportRows.ts +85 -0
- package/lib/utils/export/exportToExcelAdvanced.ts +22 -242
- package/lib/utils/export/index.ts +5 -695
- package/lib/utils/export/printGrid.ts +282 -0
- package/lib/utils/gridLocale.ts +30 -0
- package/lib/utils/selectionSets.ts +36 -0
- package/lib/utils/untypedColumns.ts +16 -0
- package/llms.txt +3 -1
- package/package.json +6 -2
- package/lib/theme/__baseline__/default-theme.darwin.chromium.json +0 -1
- package/lib/theme/__baseline__/default-theme.darwin.firefox.json +0 -1
- package/lib/theme/__baseline__/default-theme.darwin.webkit.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,43 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [3.10.0] — 2026-10-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **The AI assistant's change chips are translatable**: 11 `localeText` keys (`aiAssistantChipSearch`, `ChipNoFilters`, `ChipSort(field, direction)`, `ChipNoSorting`, `ChipGroup`, `ChipNoGrouping`, `ChipSummary(fn, field)`, `ChipNoSummaries`, `ChipPivot`, `ChipNoPivot`, `ChipVisibility(field, visible)`), English by default; filter operators in the chips use `filterPanelOperators`. `buildAiChips` takes the texts as an optional third argument.
|
|
13
|
+
|
|
14
|
+
### Performance
|
|
15
|
+
|
|
16
|
+
- **Select all at 1,000,000 rows takes ~130 ms instead of ~260 ms** (deselect ~95 instead of ~120), with no API change. The selection set built for the new model is reused when that array comes back as `rowSelectionModel` (instead of `new Set(model)` again), and a set built by selecting all rows is known to contain them, so the header checkbox's "all selected" count is skipped. The shared selection set is typed `ReadonlySet` internally, so nothing can change it in place.
|
|
17
|
+
|
|
18
|
+
### Internal
|
|
19
|
+
|
|
20
|
+
- **Guards that fail CI instead of relying on review:** `check:versions` (llms.txt, CLAUDE.md and CHANGELOG must name the `package.json` version), `check:compiler` (fails on any React Compiler result outside a short allowlist, so a refactor that stops it from optimizing a hook is caught), ESLint `no-explicit-any` turned on (it was off; the library had none, the demo's 9 are now typed) and a rule against new `as unknown as` casts in the library outside the documented boundary files.
|
|
21
|
+
|
|
22
|
+
- **Refactors (no behaviour change):** `GridToolbar` split into its panels with a shared `useToolbarPanel` (861 → 492 lines); the exporters one file per format; the xlsx cell helpers in `excelCells`; the cell range drag in `useGridCellRangeDrag`; keydown handling in a plain, unit-tested `handleGridKeyDown` function. Type casts `as unknown as` 43 → 15: the row pipeline, data source and grouping are called with the row type, the row store is typed with it, and column widenings go through one documented helper. DOM, styles and behaviour unchanged (theme baseline and the full browser suite in three engines).
|
|
23
|
+
|
|
24
|
+
- Demo: the source viewer on every example page is syntax-highlighted (`CodeBlock`, prism-react-renderer), and the integration tips under it are corrected (inline columns and handlers are fine since 3.0 / 3.9; replace rows instead of mutating them).
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## [3.9.1] — 2026-10-13
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **The npm package no longer ships the theme test baselines.** `lib/theme/__baseline__/` (three JSON files, 1.6 MB, added in 3.7.0) was published because `files` excluded tests, screenshots and snapshots but not that folder. Unpacked size 9.4 → 7.8 MB.
|
|
33
|
+
- The demo's home page badge showed v3.7.0; it and the header now read the version from `package.json`.
|
|
34
|
+
|
|
35
|
+
### Internal
|
|
36
|
+
|
|
37
|
+
- **`npm run check:package`**, run in CI and before publishing: fails when `npm pack` would ship a test artifact or when `DataGrid` alone, minified and gzipped, grows past its budget (92 KB; 85.5 KB now).
|
|
38
|
+
|
|
39
|
+
### Documentation
|
|
40
|
+
|
|
41
|
+
- Roadmap brought up to date (3.5.1 – 3.9.1 shipped; new features on hold until the backlog of fixes, refactors and performance work is closed; the 4.0 feature-modules proposal). `docs/performance.md`: edit, paste, fill, group toggle and select-all timings at 1M rows and how to keep rows memoised. README: spreadsheet editing, Ask AI panel, `localeText`, RTL and Theme Builder in the feature list; bundle sizes re-measured. `rtl.md` and `components/pagination.md` no longer say their labels cannot be translated. Architecture notes on the column-window memo and the locale context. The wiki home links the newer feature pages.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
8
45
|
## [3.9.0] — 2026-10-13
|
|
9
46
|
|
|
10
47
|
### Added
|
package/README.md
CHANGED
|
@@ -76,11 +76,13 @@ Without a `height` prop the grid fills its container (`height: 100%`, or the fre
|
|
|
76
76
|
- **Fully Customizable**: Slots system for replacing any component (pagination, overlays, toolbar).
|
|
77
77
|
- **Export Functionality**: Built-in CSV, Excel (HTML `.xls`, or real `.xlsx` with the optional ExcelJS peer), JSON, PDF (optional jsPDF peer) and Print export.
|
|
78
78
|
- **Clipboard**: `Ctrl+C` / `Cmd+C` copies the selected rows' visible columns as TSV for Excel/Sheets.
|
|
79
|
+
- **Spreadsheet editing** (v3.4–3.5): paste from Excel / Google Sheets into a cell range (parsed per column type, through `processRowUpdate`), Delete clears a range, **undo / redo** (`undoRedo`, Ctrl+Z / Ctrl+Shift+Z), and a **fill handle** that extends series, patterns or copies (Ctrl/Cmd+D / R).
|
|
79
80
|
- **Header Filters** (v3.5): `headerFilters` adds a filter row under the column headers (text, number, date and select controls with an operator menu) that edits the same `filterModel` as the filter panel and the quick filter.
|
|
80
81
|
- **Cell Range Selection** (v3.3): drag, Shift+click or Shift+arrows select a rectangle of cells; copy it as TSV and see its count, sum and average in a status bar (`cellSelection`, `showCellSelectionStats`).
|
|
81
|
-
- **AI Toolkit** (v3.4): `@opencorestack/opengridx/ai` turns your columns into a JSON Schema for your own model and validates its reply before the grid applies it (`getGridAiSchema`, `validateGridAiState`). No AI SDK, no row data sent by default.
|
|
82
|
+
- **AI Toolkit** (v3.4–3.5): `@opencorestack/opengridx/ai` turns your columns into a JSON Schema for your own model and validates its reply before the grid applies it (`getGridAiSchema`, `validateGridAiState`); `aiAssistant` adds an **Ask AI panel** whose changes show as removable chips with one-click undo, and `createGridAgentTools` gives agents typed tools. No AI SDK, no row data sent by default.
|
|
83
|
+
- **Internationalisation** (v3.9): every built-in string (menus, toolbar, panels, AI panel, pagination, screen-reader announcements) is a `localeText` key, and **right-to-left** layouts work with `dir="rtl"` (v3.6), including pinned columns.
|
|
82
84
|
- **Accessibility**: WCAG 2.1 AA — full ARIA roles and keyboard navigation.
|
|
83
|
-
- **Theming**: CSS variable API, `DataGridThemeProvider` with 5 built-in themes (`darkTheme`, `roseTheme`, `emeraldTheme`, `amberTheme`, `compactTheme`) and custom themes.
|
|
85
|
+
- **Theming**: CSS variable API, `DataGridThemeProvider` with 5 built-in themes (`darkTheme`, `roseTheme`, `emeraldTheme`, `amberTheme`, `compactTheme`) and custom themes; the demo's **Theme Builder** edits every theme key live and exports the result as code.
|
|
84
86
|
- **Column & Row Reordering**: Drag-and-drop column reordering and row reordering.
|
|
85
87
|
- **Inline Cell Editing**: Full inline editing with `processRowUpdate` validation.
|
|
86
88
|
- **State Persistence**: Save and restore grid state (sort, filter, pagination, columns, density) via `useGridStateStorage`.
|
|
@@ -120,7 +122,7 @@ This means that **Cursor**, **GitHub Copilot**, **Windsurf**, and other AI agent
|
|
|
120
122
|
| `rowHeight` | `number` | `52` | Row height in pixels. |
|
|
121
123
|
| `headerHeight` | `number` | `56` | Header height in pixels. |
|
|
122
124
|
| `noRowsLabel` | `string` | `'No Data'` | Custom empty-state message. |
|
|
123
|
-
| `localeText` | `GridLocaleText` | — | Overrides for
|
|
125
|
+
| `localeText` | `GridLocaleText` | — | Overrides for every built-in UI string (v3.9; pagination and the empty state before). |
|
|
124
126
|
| `ariaLabel` | `string` | — | Accessible name for the grid. |
|
|
125
127
|
| `initialState` | `GridInitialState` | — | Starting sort, filter, pagination, column and density state (uncontrolled). |
|
|
126
128
|
| `onStateChange` | `(state: GridState) => void` | — | Fires when sort, filter, pagination, columns or density change. |
|
|
@@ -490,12 +492,14 @@ Built-in themes: `darkTheme`, `roseTheme`, `emeraldTheme`, `amberTheme`, `compac
|
|
|
490
492
|
|
|
491
493
|
| Artifact | Size | Gzipped | Notes |
|
|
492
494
|
| :--- | :--- | :--- | :--- |
|
|
493
|
-
| **
|
|
494
|
-
| **Core
|
|
495
|
-
| **
|
|
495
|
+
| **What an app ships for `DataGrid`** (your bundler minifies) | 271 KB | **87 KB** | Measured v3.9.0: esbuild, minified, React external, `DataGrid` only |
|
|
496
|
+
| **Core ES Module** (`opengridx.es.js`, as published) | 493 KB | 130 KB | Unminified with readable names; use this — tree-shakeable |
|
|
497
|
+
| **Core UMD** (`opengridx.umd.js`) | 357 KB | 112 KB | CommonJS / CDN compat |
|
|
498
|
+
| **Styles** (`opengridx.css`) | 81 KB | **12 KB** | `import '@opencorestack/opengridx/styles'` |
|
|
499
|
+
| **AI toolkit** (`/ai`, optional import) | 20 KB | **7 KB** | Adds nothing unless imported |
|
|
496
500
|
| **ExcelJS** (optional peer dep) | — | — | `npm install exceljs` |
|
|
497
501
|
| **jsPDF** (optional peer dep) | — | — | `npm install jspdf jspdf-autotable` |
|
|
498
|
-
| **npm package download** | — | **~
|
|
502
|
+
| **npm package download** | — | **~2.5 MB** | Compressed tarball (includes `lib/` source, docs and source maps; 7.8 MB unpacked) |
|
|
499
503
|
|
|
500
504
|
- **Tree-shaking Ready**: ES Module build — bundlers (Vite, Webpack) only include what you use.
|
|
501
505
|
- **Zero UI Dependencies**: No MUI, Ant Design, or Radix. Pure React + vanilla CSS.
|
package/dist/index.d.ts
CHANGED
|
@@ -162,6 +162,39 @@ export declare interface CsvExportOptions<R extends GridValidRowModel = GridRowM
|
|
|
162
162
|
bom?: boolean;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
export declare interface CsvExportOptions<R extends GridValidRowModel = GridRowModel> {
|
|
166
|
+
fileName?: string;
|
|
167
|
+
includeHeaders?: boolean;
|
|
168
|
+
delimiter?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Export only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
|
|
171
|
+
* selected rows are exported flat), and the totals row is recomputed over the selected rows.
|
|
172
|
+
*/
|
|
173
|
+
selectedRows?: (string | number)[];
|
|
174
|
+
/**
|
|
175
|
+
* The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
|
|
176
|
+
* copy them onto `row.id` (v3.0+). Defaults to `row.id`.
|
|
177
|
+
*/
|
|
178
|
+
getRowId?: (row: R) => GridRowId;
|
|
179
|
+
aggregationResult?: Record<string, unknown> | null;
|
|
180
|
+
aggregationModel?: GridAggregationModel | null;
|
|
181
|
+
/** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
|
|
182
|
+
groupedRows?: GridGroupedExportRow[];
|
|
183
|
+
/**
|
|
184
|
+
* Prefix text cells that start with `=`, `+`, `-`, `@`, tab or carriage return with `'`, so
|
|
185
|
+
* spreadsheet apps show them as text instead of running them as formulas (CSV injection).
|
|
186
|
+
* Plain signed numbers are left alone. Default: `true`
|
|
187
|
+
* @since v3.0
|
|
188
|
+
*/
|
|
189
|
+
escapeFormulas?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Start the file with a UTF-8 byte-order mark, so Excel reads non-ASCII text (é, ü, ₹, 中文)
|
|
192
|
+
* correctly. Default: `true`
|
|
193
|
+
* @since v3.0
|
|
194
|
+
*/
|
|
195
|
+
bom?: boolean;
|
|
196
|
+
}
|
|
197
|
+
|
|
165
198
|
export declare const darkTheme: GridTheme;
|
|
166
199
|
|
|
167
200
|
/**
|
|
@@ -1842,6 +1875,28 @@ export declare interface GridLocaleText {
|
|
|
1842
1875
|
aiAssistantFailed?: (message: string) => string;
|
|
1843
1876
|
/** Error text when a failed request has no message. Default: `"Unknown error"` @since v3.9 */
|
|
1844
1877
|
aiAssistantUnknownError?: string;
|
|
1878
|
+
/** Change chip for the quick-filter words. Default: `` (w) => `Search: ${w}` `` @since v3.10 */
|
|
1879
|
+
aiAssistantChipSearch?: (words: string) => string;
|
|
1880
|
+
/** Change chip when the reply cleared the filters. Default: `"No filters"` @since v3.10 */
|
|
1881
|
+
aiAssistantChipNoFilters?: string;
|
|
1882
|
+
/** Change chip for one sort key. Default: `` (f, d) => `Sort: ${f}, ascending|descending` `` @since v3.10 */
|
|
1883
|
+
aiAssistantChipSort?: (field: string, direction: 'asc' | 'desc') => string;
|
|
1884
|
+
/** Change chip when the reply cleared the sort. Default: `"No sorting"` @since v3.10 */
|
|
1885
|
+
aiAssistantChipNoSorting?: string;
|
|
1886
|
+
/** Change chip for one grouping field. Default: `` (f) => `Group: ${f}` `` @since v3.10 */
|
|
1887
|
+
aiAssistantChipGroup?: (field: string) => string;
|
|
1888
|
+
/** Change chip when the reply removed grouping. Default: `"No grouping"` @since v3.10 */
|
|
1889
|
+
aiAssistantChipNoGrouping?: string;
|
|
1890
|
+
/** Change chip for one summary; `fn` is the function id (`sum`, `avg`, …). Default: `` (fn, f) => `Sum: ${f}` `` (Sum, Average, Count, Min, Max, Unique) @since v3.10 */
|
|
1891
|
+
aiAssistantChipSummary?: (fn: string, field: string) => string;
|
|
1892
|
+
/** Change chip when the reply removed the summaries. Default: `"No summaries"` @since v3.10 */
|
|
1893
|
+
aiAssistantChipNoSummaries?: string;
|
|
1894
|
+
/** Change chip for the pivot; receives the column labels joined with ", ". Default: `` (f) => `Pivot: ${f}` `` @since v3.10 */
|
|
1895
|
+
aiAssistantChipPivot?: (fields: string) => string;
|
|
1896
|
+
/** Change chip when the reply turned the pivot off. Default: `"No pivot"` @since v3.10 */
|
|
1897
|
+
aiAssistantChipNoPivot?: string;
|
|
1898
|
+
/** Change chip for a column shown or hidden. Default: `` (f, v) => `Show: ${f}` `` / `` `Hide: ${f}` `` @since v3.10 */
|
|
1899
|
+
aiAssistantChipVisibility?: (field: string, visible: boolean) => string;
|
|
1845
1900
|
/** `aria-label` of the pagination bar. Default: `"Pagination"` @since v3.9 */
|
|
1846
1901
|
paginationLabel?: string;
|
|
1847
1902
|
/** Default: `"Go to first page"` @since v3.9 */
|