@opencorestack/opengridx 3.9.1 → 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.
Files changed (57) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/index.d.ts +55 -0
  3. package/dist/opengridx.es.js +6346 -6279
  4. package/dist/opengridx.es.js.map +1 -1
  5. package/dist/opengridx.umd.js +16 -16
  6. package/dist/opengridx.umd.js.map +1 -1
  7. package/docs/API_REFERENCE.md +4 -0
  8. package/docs/features/ai-toolkit.md +1 -0
  9. package/docs/performance.md +1 -1
  10. package/docs/roadmap.md +5 -5
  11. package/lib/components/Cell/Cell.tsx +2 -1
  12. package/lib/components/DataGrid/DataGrid.tsx +19 -18
  13. package/lib/components/DataGrid/GridListView.tsx +1 -1
  14. package/lib/components/DataGrid/GridPinnedRows.tsx +1 -1
  15. package/lib/components/DataGrid/GridViewport.tsx +2 -1
  16. package/lib/components/DataGrid/GridVirtualRows.tsx +1 -1
  17. package/lib/components/Header/Header.tsx +4 -3
  18. package/lib/components/Row/Row.tsx +6 -2
  19. package/lib/components/Toolbar/AggregationPanel.tsx +90 -0
  20. package/lib/components/Toolbar/ColumnsPanelWrapper.tsx +56 -0
  21. package/lib/components/Toolbar/FilterPanelWrapper.tsx +82 -0
  22. package/lib/components/Toolbar/GridToolbar.tsx +7 -380
  23. package/lib/components/Toolbar/ToolbarIcons.tsx +35 -0
  24. package/lib/components/Toolbar/useToolbarPanel.ts +71 -0
  25. package/lib/hooks/core/gridKeyDown.ts +272 -0
  26. package/lib/hooks/core/useDataGrid.ts +13 -5
  27. package/lib/hooks/core/useGridApiMethods.ts +2 -2
  28. package/lib/hooks/core/useGridCellRangeDrag.ts +345 -0
  29. package/lib/hooks/core/useGridCellSelection.ts +17 -297
  30. package/lib/hooks/core/useGridColumnLookup.ts +2 -1
  31. package/lib/hooks/core/useGridColumns.tsx +3 -2
  32. package/lib/hooks/core/useGridControlledState.ts +3 -2
  33. package/lib/hooks/core/useGridHierarchy.ts +1 -1
  34. package/lib/hooks/core/useGridKeyboardNavigation.ts +51 -235
  35. package/lib/hooks/core/useGridLiveRowSelection.ts +2 -2
  36. package/lib/hooks/core/useGridRowInteractions.ts +1 -1
  37. package/lib/hooks/core/useGridRowSelection.ts +11 -2
  38. package/lib/hooks/core/useGridToolbarProps.ts +3 -2
  39. package/lib/hooks/features/useGridAiAssistant.ts +3 -2
  40. package/lib/hooks/useColumnReorder.ts +2 -1
  41. package/lib/hooks/useTreeData.ts +4 -2
  42. package/lib/types/locale.ts +22 -0
  43. package/lib/utils/aggregation/index.ts +16 -0
  44. package/lib/utils/aiAssistant.ts +46 -15
  45. package/lib/utils/export/excelCells.ts +244 -0
  46. package/lib/utils/export/exportCsv.ts +179 -0
  47. package/lib/utils/export/exportExcelHtml.ts +220 -0
  48. package/lib/utils/export/exportJson.ts +179 -0
  49. package/lib/utils/export/exportRows.ts +85 -0
  50. package/lib/utils/export/exportToExcelAdvanced.ts +22 -242
  51. package/lib/utils/export/index.ts +5 -695
  52. package/lib/utils/export/printGrid.ts +282 -0
  53. package/lib/utils/gridLocale.ts +30 -0
  54. package/lib/utils/selectionSets.ts +36 -0
  55. package/lib/utils/untypedColumns.ts +16 -0
  56. package/llms.txt +3 -1
  57. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@
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
+
8
28
  ## [3.9.1] — 2026-10-13
9
29
 
10
30
  ### Fixed
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 */