@opencorestack/opengridx 3.3.0 → 3.5.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 (101) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +10 -1
  3. package/dist/ai.cjs +2 -0
  4. package/dist/ai.cjs.map +1 -0
  5. package/dist/ai.d.ts +366 -0
  6. package/dist/ai.es.js +2 -0
  7. package/dist/ai.es.js.map +1 -0
  8. package/dist/index.d.ts +396 -6
  9. package/dist/opengridx.css +1 -1
  10. package/dist/opengridx.es.js +8029 -6090
  11. package/dist/opengridx.es.js.map +1 -1
  12. package/dist/opengridx.umd.js +16 -14
  13. package/dist/opengridx.umd.js.map +1 -1
  14. package/docs/API_REFERENCE.md +182 -4
  15. package/docs/README.md +5 -1
  16. package/docs/architecture/datagrid-orchestration.md +19 -5
  17. package/docs/components/filter-panel.md +1 -0
  18. package/docs/components/header.md +4 -1
  19. package/docs/components/toolbar.md +7 -0
  20. package/docs/customization/theming.md +12 -1
  21. package/docs/features/ai-toolkit.md +213 -0
  22. package/docs/features/cell-selection.md +8 -2
  23. package/docs/features/clipboard.md +88 -0
  24. package/docs/features/editing-reordering.md +50 -0
  25. package/docs/features/fill-handle.md +125 -0
  26. package/docs/features/filtering.md +3 -0
  27. package/docs/features/header-filters.md +138 -0
  28. package/docs/features/keyboard-navigation.md +31 -2
  29. package/docs/features/undo-redo.md +79 -0
  30. package/docs/roadmap.md +3 -4
  31. package/lib/ai/agentTools.ts +160 -0
  32. package/lib/ai/coerce.ts +90 -0
  33. package/lib/ai/columns.ts +90 -0
  34. package/lib/ai/index.ts +33 -0
  35. package/lib/ai/promptHandler.ts +109 -0
  36. package/lib/ai/schema.ts +214 -0
  37. package/lib/ai/types.ts +152 -0
  38. package/lib/ai/validate.ts +296 -0
  39. package/lib/components/AiAssistant/GridAiAssistantArea.tsx +26 -0
  40. package/lib/components/AiAssistant/GridAiAssistantPanel.css +171 -0
  41. package/lib/components/AiAssistant/GridAiAssistantPanel.tsx +145 -0
  42. package/lib/components/AiAssistant/useSpeechInput.ts +74 -0
  43. package/lib/components/Cell/Cell.css +33 -0
  44. package/lib/components/Cell/Cell.tsx +6 -2
  45. package/lib/components/Cell/GridEditInputCell.css +12 -4
  46. package/lib/components/Cell/GridEditInputCell.tsx +19 -12
  47. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +14 -0
  48. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.tsx +3 -2
  49. package/lib/components/DataGrid/DataGrid.tsx +138 -5
  50. package/lib/components/DataGrid/GridLiveRegion.tsx +5 -2
  51. package/lib/components/DataGrid/GridPinnedRows.tsx +5 -1
  52. package/lib/components/DataGrid/GridVirtualRows.tsx +5 -1
  53. package/lib/components/FilterPanel/FilterPanel.css +14 -0
  54. package/lib/components/FilterPanel/FilterPanel.tsx +5 -11
  55. package/lib/components/Header/Header.tsx +44 -23
  56. package/lib/components/Header/headerColumnStyle.ts +28 -0
  57. package/lib/components/HeaderFilter/HeaderFilter.css +160 -0
  58. package/lib/components/HeaderFilter/HeaderFilterCell.tsx +370 -0
  59. package/lib/components/HeaderFilter/HeaderFilterOperatorMenu.tsx +124 -0
  60. package/lib/components/HeaderFilter/HeaderFilterRow.tsx +157 -0
  61. package/lib/components/ListView/ListView.css +2 -4
  62. package/lib/components/ListView/ListViewRow.tsx +2 -2
  63. package/lib/components/Toolbar/GlobalSearch.css +16 -0
  64. package/lib/components/Toolbar/GlobalSearch.tsx +3 -2
  65. package/lib/components/Toolbar/GridToolbar.tsx +51 -0
  66. package/lib/components/ui/Checkbox.tsx +16 -5
  67. package/lib/components/ui/Input.css +43 -0
  68. package/lib/components/ui/Input.tsx +24 -5
  69. package/lib/hooks/core/gridApiPlaceholder.ts +16 -1
  70. package/lib/hooks/core/gridToolbarHostContext.ts +5 -0
  71. package/lib/hooks/core/useDataGrid.ts +27 -0
  72. package/lib/hooks/core/useGridApiMethods.ts +39 -0
  73. package/lib/hooks/core/useGridAriaRows.ts +5 -3
  74. package/lib/hooks/core/useGridCellSelection.ts +107 -13
  75. package/lib/hooks/core/useGridClipboardPaste.ts +283 -0
  76. package/lib/hooks/core/useGridColumnsPanel.ts +24 -1
  77. package/lib/hooks/core/useGridControlledState.ts +27 -0
  78. package/lib/hooks/core/useGridFillHandle.ts +323 -0
  79. package/lib/hooks/core/useGridKeyboardNavigation.ts +29 -10
  80. package/lib/hooks/core/useGridToolbarProps.ts +19 -0
  81. package/lib/hooks/core/useGridUndoRedo.ts +220 -0
  82. package/lib/hooks/features/useGridAiAssistant.ts +284 -0
  83. package/lib/hooks/features/useGridBatchEdit.ts +217 -0
  84. package/lib/hooks/features/useGridEditing.ts +24 -45
  85. package/lib/index.ts +10 -0
  86. package/lib/styles/opengridx.css +4 -1
  87. package/lib/theme/DataGridThemeProvider.tsx +2 -0
  88. package/lib/theme/types.ts +2 -0
  89. package/lib/types/index.ts +343 -1
  90. package/lib/utils/aiAssistant.ts +205 -0
  91. package/lib/utils/aiBrand.ts +17 -0
  92. package/lib/utils/cellSelection.ts +25 -5
  93. package/lib/utils/editing/commit.ts +69 -0
  94. package/lib/utils/editing/fill.ts +238 -0
  95. package/lib/utils/editing/targets.ts +109 -0
  96. package/lib/utils/filtering/index.ts +14 -0
  97. package/lib/utils/focus/index.ts +9 -3
  98. package/lib/utils/headerFilters.ts +189 -0
  99. package/lib/utils/parsing.ts +252 -0
  100. package/llms.txt +97 -3
  101. package/package.json +8 -2
package/dist/index.d.ts CHANGED
@@ -81,7 +81,8 @@ export declare interface CellProps<R extends GridRowModel = GridRowModel> {
81
81
  valueError?: unknown;
82
82
  /**
83
83
  * Place of the cell in the selected cell range (`cellSelection`), as bit flags: in range 1, top
84
- * edge 2, bottom 4, left 8, right 16. 0 or absent: not in a range. @since v3.3
84
+ * edge 2, bottom 4, left 8, right 16; 32 draws the fill handle (v3.5). 0 or absent: not in a range.
85
+ * @since v3.3
85
86
  */
86
87
  rangeFlags?: number;
87
88
  }
@@ -95,12 +96,19 @@ export declare function CellSelectionStats({ count, sum, average }: CellSelectio
95
96
 
96
97
  export declare type CellSelectionStatsProps = GridCellSelectionStatsSlotProps & Record<string, unknown>;
97
98
 
98
- export declare const Checkbox: default_2.FC<CheckboxProps>;
99
+ /**
100
+ * A styled checkbox: a visually hidden `<input type="checkbox">` inside a `<label>`. Other props
101
+ * (`onChange`, `onMouseDown`, `tabIndex`, `aria-*`, …) go to the `<input>`, and so does `ref`.
102
+ */
103
+ export declare const Checkbox: default_2.ForwardRefExoticComponent<CheckboxProps & default_2.RefAttributes<HTMLInputElement>>;
99
104
 
100
105
  export declare interface CheckboxProps extends Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'type'> {
101
106
  indeterminate?: boolean;
102
107
  label?: string;
108
+ /** A ref to the `<input>`; the forwarded `ref` reaches it as well. */
103
109
  inputRef?: default_2.Ref<HTMLInputElement>;
110
+ /** Classes added to the `<input>` itself, next to `ogx-checkbox__input`. `className` goes to the wrapper `<label>`. */
111
+ inputClassName?: string;
104
112
  }
105
113
 
106
114
  declare type ColumnKey = string;
@@ -185,6 +193,18 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
185
193
  * Defaults to `false`.
186
194
  */
187
195
  wrapHeaderText?: boolean;
196
+ /**
197
+ * Adds a filter row under the column headers: one control per column (text, number, date, a Yes / No
198
+ * select for booleans, the `valueOptions` for singleSelect) with an operator menu and a clear button.
199
+ * It reads and writes `filterModel`: each cell owns the root-level item with `id: 'header:<field>'`,
200
+ * so the filter panel, quick filter and `filterMode="server"` keep working. A model the row cannot
201
+ * show (root `logicOperator: 'or'`, other conditions on the column, nested groups) is shown as
202
+ * "Custom filter" and left untouched. See `docs/features/header-filters.md`. Defaults to `false`.
203
+ * @since v3.5
204
+ */
205
+ headerFilters?: boolean;
206
+ /** Height of the header filter row (`headerFilters`) in pixels. Defaults to 40. @since v3.5 */
207
+ headerFilterHeight?: number;
188
208
  /** If true, the grid height will adjust to match the total height of its rows. */
189
209
  autoHeight?: boolean;
190
210
  /**
@@ -271,6 +291,48 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
271
291
  * `slots.cellSelectionStats`. Needs `cellSelection`. Default: false. @since v3.3
272
292
  */
273
293
  showCellSelectionStats?: boolean;
294
+ /**
295
+ * With `cellSelection` on, Ctrl/Cmd+V pastes tab-separated text (Excel, Google Sheets) into the
296
+ * editable cells from the range's top-left cell (or the focused cell), through `valueSetter` and
297
+ * `processRowUpdate`. `true` turns the shortcut off; `apiRef.pasteText()` still works. Default: false.
298
+ * @since v3.4
299
+ */
300
+ disableClipboardPaste?: boolean;
301
+ /**
302
+ * Fired after every paste with the result (`updated` rows, `failed` rows, `skipped` cells and why)
303
+ * and the pasted text. @since v3.4
304
+ */
305
+ onClipboardPaste?: (result: GridClipboardPasteResult) => void;
306
+ /**
307
+ * Called before a paste is applied. Return `false` to cancel it, or a string to paste instead of the
308
+ * clipboard text. A throw cancels the paste. @since v3.4
309
+ */
310
+ onBeforeClipboardPaste?: (params: GridBeforeClipboardPasteParams) => boolean | string;
311
+ /**
312
+ * With `cellSelection` on, Delete / Backspace on a range of more than one cell empties its editable
313
+ * cells (`null`, or `''` in string columns) as one edit. `true` turns that off. Default: false.
314
+ * @since v3.4
315
+ */
316
+ disableRangeClear?: boolean;
317
+ /**
318
+ * Undo and redo of cell edits, pastes and range clears: Ctrl/Cmd+Z, Ctrl/Cmd+Shift+Z and Ctrl+Y while
319
+ * focus is in the grid and no editor is open, and `apiRef.undo()` / `redo()`. Undo and redo write
320
+ * through `valueSetter` and `processRowUpdate`, like an edit. `{ limit }` sets how many actions are
321
+ * kept (default 100). Default: false. @since v3.4
322
+ */
323
+ undoRedo?: boolean | GridUndoRedoOptions;
324
+ /** Fired when what can be undone or redone changes (`undoRedo`). @since v3.4 */
325
+ onHistoryChange?: (params: GridHistoryChangeParams) => void;
326
+ /**
327
+ * With `cellSelection` on, a fill handle sits on the bottom-right corner of the range: dragging it
328
+ * down, up, right or left fills the new cells from the range (a series of numbers or dates with an
329
+ * equal step continues, anything else repeats; Alt at release copies), and Ctrl/Cmd+D / Ctrl/Cmd+R
330
+ * fill down from the range's top row / right from its left column. `true` hides the handle and turns
331
+ * the shortcuts off. Default: false. @since v3.5
332
+ */
333
+ disableFillHandle?: boolean;
334
+ /** Fired after every fill with the result and its direction. @since v3.5 */
335
+ onFill?: (result: GridFillResult) => void;
274
336
  /** Loading state. With no rows the body shows skeleton rows (or `slots.loadingOverlay`); with rows, they stay and a progress bar (or `slots.loadingOverlay`) is shown over them. */
275
337
  loading?: boolean;
276
338
  /** Visual density of the grid. */
@@ -354,8 +416,13 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
354
416
  groupingColDef?: Partial<GridColDef<R>>;
355
417
  /** Initial expansion depth for Tree Data. */
356
418
  defaultGroupingExpansionDepth?: number;
357
- /** Controlled state for row grouping. */
419
+ /**
420
+ * The row grouping model: the fields to group by, outermost first. Passing it controls grouping;
421
+ * without it the grid keeps its own model, which `apiRef.setRowGroupingModel` and the AI assistant change.
422
+ */
358
423
  rowGroupingModel?: GridRowGroupingModel;
424
+ /** Fired when the row grouping model changes (`apiRef.setRowGroupingModel`, the AI assistant). @since v3.5 */
425
+ onRowGroupingModelChange?: (model: GridRowGroupingModel) => void;
359
426
  /** Controlled state for data aggregation (e.g., { salary: 'sum' }). */
360
427
  aggregationModel?: GridAggregationModel;
361
428
  /** Callback fired when aggregation model changes. */
@@ -414,6 +481,8 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
414
481
  * (plus `slotProps.cellSelectionStats`). @since v3.3
415
482
  */
416
483
  cellSelectionStats?: React.ComponentType<GridCellSelectionStatsSlotProps & Record<string, unknown>>;
484
+ /** Replaces the `aiAssistant` panel. Receives `GridAiAssistantPanelProps` while the panel is open. @since v3.5 */
485
+ aiAssistantPanel?: React.ComponentType<GridAiAssistantPanelProps & Record<string, unknown>>;
417
486
  };
418
487
  /** Properties passed directly to custom slots. */
419
488
  slotProps?: {
@@ -431,6 +500,8 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
431
500
  footer?: Partial<GridFooterSlotProps> & Record<string, unknown>;
432
501
  /** Merged over the `GridCellSelectionStatsSlotProps` the grid passes to the status bar. */
433
502
  cellSelectionStats?: Partial<GridCellSelectionStatsSlotProps> & Record<string, unknown>;
503
+ /** Extra props for `slots.aiAssistantPanel`. */
504
+ aiAssistantPanel?: Record<string, unknown>;
434
505
  };
435
506
  /** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
436
507
  listView?: boolean;
@@ -441,6 +512,17 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
441
512
  * column headers, supporting multiple levels of nesting.
442
513
  */
443
514
  columnGroupingModel?: GridColumnGroupingModel;
515
+ /**
516
+ * The "Ask AI" prompt panel: users describe the view they want and the grid applies the validated
517
+ * reply as one undoable step, shown as removable chips. The built-in toolbar shows an **Ask AI**
518
+ * button; `apiRef.openAiAssistant()` opens it without one. Build `onPrompt` with
519
+ * `createGridAiPromptHandler` from `@opencorestack/opengridx/ai`. @since v3.5
520
+ */
521
+ aiAssistant?: GridAiAssistantOptions;
522
+ /** Fired after the assistant applied a reply. @since v3.5 */
523
+ onAiAssistantApply?: (result: GridAiPromptResult) => void;
524
+ /** Fired when `onPrompt` fails or returns a result that was not validated. @since v3.5 */
525
+ onAiAssistantError?: (error: unknown) => void;
444
526
  }
445
527
 
446
528
  export declare function DataGridThemeProvider({ theme, children, className, style }: DataGridThemeProviderProps): JSX.Element;
@@ -642,6 +724,111 @@ export declare type GridAggregationPosition = 'inline' | 'footer' | null;
642
724
 
643
725
  export declare type GridAggregationResult = Record<string, unknown>;
644
726
 
727
+ /** The `aiAssistant` prop: the "Ask AI" prompt panel. @since v3.5 */
728
+ declare interface GridAiAssistantOptions {
729
+ /**
730
+ * Answers a prompt. Call your own model and return the validated result: `createGridAiPromptHandler`
731
+ * from `@opencorestack/opengridx/ai` builds this function, or call `validateGridAiState` yourself.
732
+ */
733
+ onPrompt: (prompt: string, context: GridAiPromptContext) => Promise<GridAiPromptResult>;
734
+ /** Placeholder of the prompt input. Default: `"Ask about this table…"` */
735
+ placeholder?: string;
736
+ /** Example prompts shown as clickable chips. */
737
+ suggestions?: string[];
738
+ /** Shows a microphone button where the browser has speech recognition; the microphone is asked for only on click. Default: true. */
739
+ voice?: boolean;
740
+ /** The parts of the state the assistant may change. Default: every part. */
741
+ parts?: GridAiPart[];
742
+ }
743
+
744
+ /** Props of `slots.aiAssistantPanel` and the built-in panel, rendered while the panel is open. @since v3.5 */
745
+ declare interface GridAiAssistantPanelProps {
746
+ status: GridAiAssistantStatus;
747
+ /** The status line: "Thinking…", "Applied 3 changes", an error. */
748
+ statusText: string;
749
+ /** The assistant's reply text (`result.message`). */
750
+ message: string | null;
751
+ /** What the last reply asked for that was ignored. */
752
+ errors: GridAiValidationError[];
753
+ /** The changes the last reply applied. */
754
+ chips: GridAiChip[];
755
+ /** Earlier prompts of this session, oldest first. */
756
+ history: GridAiHistoryEntry[];
757
+ suggestions: string[];
758
+ placeholder: string;
759
+ /** `voice` is on and this browser has speech recognition. */
760
+ voiceAvailable: boolean;
761
+ /** Undo can restore the state from before the last reply. */
762
+ canUndo: boolean;
763
+ submit: (prompt: string) => void;
764
+ /** Aborts the running request. */
765
+ stop: () => void;
766
+ /** Restores the state from before the last reply. */
767
+ undo: () => void;
768
+ /** Re-applies the last reply without this change. */
769
+ removeChip: (id: string) => void;
770
+ /** Closes the panel; focus returns to where it was before it opened. */
771
+ close: () => void;
772
+ }
773
+
774
+ /** The assistant panel's state. @since v3.5 */
775
+ declare type GridAiAssistantStatus = 'idle' | 'running' | 'applied' | 'stopped' | 'error';
776
+
777
+ /** One change the assistant applied, shown as a removable chip. @since v3.5 */
778
+ declare interface GridAiChip {
779
+ id: string;
780
+ part: GridAiPart;
781
+ label: string;
782
+ }
783
+
784
+ /** One earlier prompt of this session and the state the assistant applied for it. @since v3.5 */
785
+ declare interface GridAiHistoryEntry {
786
+ prompt: string;
787
+ applied: GridAiState;
788
+ }
789
+
790
+ /** A part of the grid state a model may change. @since v3.4 */
791
+ declare type GridAiPart = 'filter' | 'sort' | 'grouping' | 'aggregation' | 'pivot' | 'columnVisibility';
792
+
793
+ /** What `aiAssistant.onPrompt` receives next to the prompt. @since v3.5 */
794
+ declare interface GridAiPromptContext {
795
+ /** The grid's current models (`apiRef.getGridAiState()`). */
796
+ currentState: GridAiState;
797
+ /** Earlier prompts of this session, oldest first. */
798
+ history: GridAiHistoryEntry[];
799
+ /** Aborted when the user presses Stop, sends another prompt or closes the panel. */
800
+ signal: AbortSignal;
801
+ }
802
+
803
+ /**
804
+ * What `aiAssistant.onPrompt` resolves with. The grid applies it only when its `state` comes from
805
+ * `validateGridAiState` (or `createGridAiPromptHandler`), which brands the result and its `state`.
806
+ * @since v3.5
807
+ */
808
+ declare interface GridAiPromptResult {
809
+ state: GridAiState;
810
+ /** What the validator dropped; shown as "Ignored: …". */
811
+ errors: GridAiValidationError[];
812
+ /** The assistant's reply text, shown in the panel. */
813
+ message?: string;
814
+ }
815
+
816
+ /** Grid state as the AI toolkit reads and writes it. Only the parts present are applied. @since v3.4 */
817
+ declare interface GridAiState {
818
+ filterModel?: GridFilterModel;
819
+ sortModel?: GridSortItem[];
820
+ rowGroupingModel?: GridRowGroupingModel;
821
+ aggregationModel?: GridAggregationModel;
822
+ pivotModel?: GridPivotModel;
823
+ columnVisibilityModel?: GridColumnVisibilityModel;
824
+ }
825
+
826
+ /** One thing the validator dropped or could not use. `path` points into the model output. @since v3.4 */
827
+ declare interface GridAiValidationError {
828
+ path: string;
829
+ message: string;
830
+ }
831
+
645
832
  export declare type GridAlignment = 'left' | 'center' | 'right';
646
833
 
647
834
  /**
@@ -756,6 +943,66 @@ export declare interface GridApi<R extends GridValidRowModel = GridRowModel> {
756
943
  * copy; rejects when the clipboard write fails. @since v3.3
757
944
  */
758
945
  copySelectedCells: () => Promise<void>;
946
+ /**
947
+ * Pastes tab-separated text as Ctrl/Cmd+V does: from `anchor` (default: the range's top-left cell,
948
+ * else the focused cell), with `onBeforeClipboardPaste` and `onClipboardPaste`. Works with
949
+ * `disableClipboardPaste`. Resolves once every row's `processRowUpdate` has settled. @since v3.4
950
+ */
951
+ pasteText: (text: string, anchor?: GridCellCoordinates) => Promise<GridBatchEditResult>;
952
+ /** Undoes the last action (`undoRedo`). Resolves with what was written. @since v3.4 */
953
+ undo: () => Promise<GridBatchEditResult>;
954
+ /** Redoes the last undone action (`undoRedo`). @since v3.4 */
955
+ redo: () => Promise<GridBatchEditResult>;
956
+ /** Whether there is an action to undo. @since v3.4 */
957
+ canUndo: () => boolean;
958
+ /** Whether there is an undone action to redo. @since v3.4 */
959
+ canRedo: () => boolean;
960
+ /** Forgets every action (undo and redo). @since v3.4 */
961
+ clearHistory: () => void;
962
+ /** Replaces the sort model (fires `onSortModelChange`). @since v3.5 */
963
+ setSortModel: (model: GridSortItem[]) => void;
964
+ /** Replaces the row grouping model (fires `onRowGroupingModelChange`). @since v3.5 */
965
+ setRowGroupingModel: (model: GridRowGroupingModel) => void;
966
+ /** Replaces the aggregation model (fires `onAggregationModelChange`). @since v3.5 */
967
+ setAggregationModel: (model: GridAggregationModel) => void;
968
+ /** Replaces the column visibility model (fires `onColumnVisibilityModelChange`). @since v3.5 */
969
+ setColumnVisibilityModel: (model: GridColumnVisibilityModel) => void;
970
+ /** Replaces the pivot model (fires `onPivotModelChange`). @since v3.5 */
971
+ setPivotModel: (model: GridPivotModel) => void;
972
+ /**
973
+ * The current filter, sort, grouping, aggregation, pivot and column visibility models, in the shape
974
+ * of the AI toolkit (`GridAiState`). @since v3.5
975
+ */
976
+ getGridAiState: () => GridAiState;
977
+ /** Opens the `aiAssistant` panel (does nothing without `aiAssistant`). @since v3.5 */
978
+ openAiAssistant: () => void;
979
+ /** Closes the `aiAssistant` panel. @since v3.5 */
980
+ closeAiAssistant: () => void;
981
+ }
982
+
983
+ /** What a batch edit (paste, range clear, undo, redo) did. @since v3.4 */
984
+ export declare interface GridBatchEditResult {
985
+ /** Rows whose `processRowUpdate` succeeded and that were stored, in the order they were first touched. */
986
+ updated: GridRowId[];
987
+ /** Rows whose `valueSetter` or `processRowUpdate` threw or rejected (also reported to `onProcessRowUpdateError`). */
988
+ failed: {
989
+ id: GridRowId;
990
+ error: unknown;
991
+ }[];
992
+ /** Cells that were not written, with the reason. */
993
+ skipped: {
994
+ id: GridRowId;
995
+ field: string;
996
+ reason: GridEditSkipReason;
997
+ }[];
998
+ }
999
+
1000
+ /** `onBeforeClipboardPaste` params. @since v3.4 */
1001
+ export declare interface GridBeforeClipboardPasteParams {
1002
+ /** The clipboard text (`text/plain`). */
1003
+ text: string;
1004
+ /** The cell the paste starts from (the range's top-left cell, or the focused cell). */
1005
+ anchor: GridCellCoordinates | null;
759
1006
  }
760
1007
 
761
1008
  /** One cell, addressed by its row id and column field. @since v3.3 */
@@ -821,6 +1068,11 @@ export declare interface GridCellSelectionStatsSlotProps {
821
1068
  average: number | null;
822
1069
  }
823
1070
 
1071
+ /** `onClipboardPaste` details: the batch edit result plus the text that was pasted. @since v3.4 */
1072
+ export declare interface GridClipboardPasteResult extends GridBatchEditResult {
1073
+ text: string;
1074
+ }
1075
+
824
1076
  /**
825
1077
  * Metadata for a single column.
826
1078
  * Governs rendering, sorting, filtering, and data transformation.
@@ -869,6 +1121,18 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
869
1121
  sortable?: boolean;
870
1122
  /** If false, filtering is disabled for this column. */
871
1123
  filterable?: boolean;
1124
+ /**
1125
+ * Set to `false` to leave this column's cell in the header filter row (`headerFilters`) empty.
1126
+ * Columns with `filterable: false` or `type: 'image'` have no header filter either.
1127
+ * @since v3.5
1128
+ */
1129
+ headerFilter?: boolean;
1130
+ /**
1131
+ * The operator a new header filter (`headerFilters`) for this column starts with. Defaults by type:
1132
+ * `contains` (string), `=` (number), `is` (date, boolean, singleSelect).
1133
+ * @since v3.5
1134
+ */
1135
+ headerFilterOperator?: GridFilterOperator;
872
1136
  /** If false, the user cannot manually resize this column. */
873
1137
  resizable?: boolean;
874
1138
  /** If false, the column cannot be hidden via the UI. */
@@ -893,6 +1157,14 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
893
1157
  * @since v3.0
894
1158
  */
895
1159
  valueSetter?(params: GridValueSetterParams<R>): R;
1160
+ /**
1161
+ * Turns pasted text into this column's value (clipboard paste), instead of the default parser for
1162
+ * the column `type` (see `docs/features/clipboard.md`). Use it for locales such as `1.234,5` or for
1163
+ * custom codes. Throw (or return `undefined`) to reject the text: the cell is skipped with reason
1164
+ * `'invalidValue'`. The value then goes through `valueSetter` and `processRowUpdate` like an edit.
1165
+ * @since v3.4
1166
+ */
1167
+ valueParser?(text: string, params: GridValueParserParams<R>): unknown;
896
1168
  /**
897
1169
  * Custom ascending comparator for client-side sorting by this column, used instead of the built-in
898
1170
  * type-aware comparison. `v1` / `v2` are the cell values (`valueGetter` applied) and **include
@@ -903,6 +1175,13 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
903
1175
  * @since v3.1
904
1176
  */
905
1177
  sortComparator?(v1: unknown, v2: unknown, params1: GridSortCellParams<R>, params2: GridSortCellParams<R>): number;
1178
+ /**
1179
+ * Decides the value the fill handle (or Ctrl/Cmd+D, Ctrl/Cmd+R) writes into a cell of this column.
1180
+ * `params.value` is what the grid would write (a continued series, the repeated pattern or a copy);
1181
+ * return it to keep that, or any other value. A throw skips the cell with reason `'invalidValue'`.
1182
+ * The value then goes through `valueSetter` and `processRowUpdate` like an edit. @since v3.5
1183
+ */
1184
+ fillValue?(params: GridFillValueParams<R>): unknown;
906
1185
  /** Function to format a value into a human-readable string. */
907
1186
  valueFormatter?(params: GridValueFormatterParams<R>): string;
908
1187
  /** Custom component or element to render in the cell. */
@@ -951,6 +1230,15 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
951
1230
  * @default true
952
1231
  */
953
1232
  exportable?: boolean;
1233
+ /**
1234
+ * Example values for this column, put into the schema from `getGridAiSchema`
1235
+ * (`@opencorestack/opengridx/ai`) to help a language model write filters ("Acme" → `customer`).
1236
+ * **These values are sent to the model.** The grid never reads row data for the schema; only what
1237
+ * you list here leaves the app, so list nothing private. Strings, numbers and booleans are used
1238
+ * (at most 10); other values are ignored. Not used by the grid itself.
1239
+ * @since v3.4
1240
+ */
1241
+ aiExamples?: unknown[];
954
1242
  }
955
1243
 
956
1244
  /**
@@ -1049,6 +1337,43 @@ export declare interface GridDetailPanelParams<R extends GridValidRowModel = Gri
1049
1337
  rowIndex: number;
1050
1338
  }
1051
1339
 
1340
+ /**
1341
+ * Why a cell of a batch edit (paste, range clear, undo, redo) was not written:
1342
+ * - `'notEditable'`: the column is not `editable`, `isCellEditable` returned false, or the row is a
1343
+ * synthetic row (group header, subtotal, tree auto-parent, pivot Grand Total);
1344
+ * - `'invalidValue'`: the pasted text does not parse for the column type (or `valueParser` rejected it);
1345
+ * - `'changed'`: undo/redo only, the cell no longer holds the value the history recorded;
1346
+ * - `'missing'`: undo/redo only, the row is gone.
1347
+ * @since v3.4
1348
+ */
1349
+ export declare type GridEditSkipReason = 'notEditable' | 'invalidValue' | 'changed' | 'missing';
1350
+
1351
+ /** The way a fill extends the cell range. @since v3.5 */
1352
+ export declare type GridFillDirection = 'down' | 'up' | 'right' | 'left';
1353
+
1354
+ /** `onFill` details: the batch edit result plus the direction of the fill. @since v3.5 */
1355
+ export declare interface GridFillResult extends GridBatchEditResult {
1356
+ direction: GridFillDirection;
1357
+ }
1358
+
1359
+ /** Parameters passed to `GridColDef.fillValue`. @since v3.5 */
1360
+ export declare interface GridFillValueParams<R extends GridValidRowModel = GridRowModel> {
1361
+ /** The row of the cell being filled, as stored now. */
1362
+ row: R;
1363
+ id: GridRowId;
1364
+ field: string;
1365
+ colDef: GridColDef<R>;
1366
+ direction: GridFillDirection;
1367
+ /** The source cells' values in fill order: the value next to the first filled cell is last. */
1368
+ sourceValues: unknown[];
1369
+ /** Position of this cell among the filled cells of its line, from 0 (next to the source). */
1370
+ index: number;
1371
+ /** What the grid would write: the continued series, the repeated pattern or a copy. */
1372
+ value: unknown;
1373
+ /** Whether a copy was asked for (Alt held at release, or the keyboard shortcuts), so no series. */
1374
+ copy: boolean;
1375
+ }
1376
+
1052
1377
  /** Describes a group of filters combined with a logical operator. */
1053
1378
  export declare interface GridFilterGroup {
1054
1379
  /** Optional ID for the group. */
@@ -1150,6 +1475,14 @@ export declare interface GridGroupedExportRow {
1150
1475
  row?: GridRowModel;
1151
1476
  }
1152
1477
 
1478
+ /** `onHistoryChange` params. @since v3.4 */
1479
+ export declare interface GridHistoryChangeParams {
1480
+ canUndo: boolean;
1481
+ canRedo: boolean;
1482
+ /** Number of actions that can be undone. */
1483
+ size: number;
1484
+ }
1485
+
1153
1486
  /**
1154
1487
  * The state the grid starts from. Every part is optional, including each column field, so a
1155
1488
  * partial state such as `{ columns: { columnVisibilityModel: { age: false } } }` is valid.
@@ -1180,6 +1513,8 @@ export declare interface GridLocaleText {
1180
1513
  * @since v3.3
1181
1514
  */
1182
1515
  cellSelectionAnnouncement?: (cellCount: number, rowCount: number, columnCount: number) => string;
1516
+ /** Label of the toolbar button that opens the `aiAssistant` panel. Default: `"Ask AI"` @since v3.5 */
1517
+ aiAssistantButton?: string;
1183
1518
  }
1184
1519
 
1185
1520
  /**
@@ -1278,6 +1613,8 @@ declare interface GridRowCellRange {
1278
1613
  isBottom: boolean;
1279
1614
  /** Rows from this one to the bottom of the range; only set (else 0) when the grid has row spans. */
1280
1615
  bottomOffset: number;
1616
+ /** Data column index (`columnIndexMap`) of the cell carrying the fill handle; only set on its row. @since v3.5 */
1617
+ fillHandleCol?: number;
1281
1618
  }
1282
1619
 
1283
1620
  export declare type GridRowGroupingModel = string[];
@@ -1514,6 +1851,8 @@ export declare interface GridThemeGrid {
1514
1851
  rangeBackground?: string;
1515
1852
  /** Outline of a selected cell range (`--ogx-range-border`). Default: the primary colour. @since v3.3 */
1516
1853
  rangeBorder?: string;
1854
+ /** The fill handle on the range's corner (`--ogx-fill-handle-color`). Default: the range border colour. @since v3.5 */
1855
+ fillHandleColor?: string;
1517
1856
  pinnedLeftShadow?: string;
1518
1857
  pinnedRightShadow?: string;
1519
1858
  checkboxBg?: string;
@@ -1601,7 +1940,7 @@ export declare interface GridThemeTypography {
1601
1940
  fontSizeXl?: string;
1602
1941
  }
1603
1942
 
1604
- export declare function GridToolbar({ columns, baseColumns, aggregationModel, onAggregationModelChange, pivotModel, onPivotModelChange, filterModel, onFilterModelChange, columnVisibilityModel, onColumnVisibilityModelChange, onColumnReorder, onColumnOrderReset, forceColumnsOpen, onColumnsPanelClose, children, rightContent, style, renderColumnsButton, renderFilterButton, renderAggregationButton, renderExportButton, renderQuickFilter, className, showNonHideableColumns, }: GridToolbarProps): JSX.Element;
1943
+ export declare function GridToolbar({ columns, baseColumns, aggregationModel, onAggregationModelChange, pivotModel, onPivotModelChange, filterModel, onFilterModelChange, columnVisibilityModel, onColumnVisibilityModelChange, onColumnReorder, onColumnOrderReset, forceColumnsOpen, onColumnsPanelClose, forceFiltersOpen, onFiltersPanelClose, children, rightContent, style, renderColumnsButton, renderFilterButton, renderAggregationButton, renderExportButton, renderQuickFilter, className, showNonHideableColumns, onAiAssistantToggle, aiAssistantOpen, aiAssistantLabel, }: GridToolbarProps): JSX.Element;
1605
1944
 
1606
1945
  export declare interface GridToolbarProps {
1607
1946
  columns?: GridColDef[];
@@ -1622,6 +1961,10 @@ export declare interface GridToolbarProps {
1622
1961
  onColumnOrderReset?: () => void;
1623
1962
  forceColumnsOpen?: boolean;
1624
1963
  onColumnsPanelClose?: () => void;
1964
+ /** Opens the filter panel when it turns true (the grid passes it for the header filter row). @since v3.5 */
1965
+ forceFiltersOpen?: boolean;
1966
+ /** Called whenever the filter panel closes. @since v3.5 */
1967
+ onFiltersPanelClose?: () => void;
1625
1968
  children?: default_2.ReactNode;
1626
1969
  rightContent?: default_2.ReactNode;
1627
1970
  style?: default_2.CSSProperties;
@@ -1654,6 +1997,16 @@ export declare interface GridToolbarProps {
1654
1997
  className?: string;
1655
1998
  /** Show columns with `hideable: false` in the Columns panel as disabled rows. Default: false. */
1656
1999
  showNonHideableColumns?: boolean;
2000
+ /**
2001
+ * Opens or closes the `aiAssistant` panel. The grid passes it when `aiAssistant` is set; the
2002
+ * **Ask AI** button is shown only with it. Receives the button, which gets focus back on close.
2003
+ * @since v3.5
2004
+ */
2005
+ onAiAssistantToggle?: (trigger: HTMLElement | null) => void;
2006
+ /** Whether the `aiAssistant` panel is open. @since v3.5 */
2007
+ aiAssistantOpen?: boolean;
2008
+ /** Label of the Ask AI button (`localeText.aiAssistantButton`). Default: `"Ask AI"`. @since v3.5 */
2009
+ aiAssistantLabel?: string;
1657
2010
  }
1658
2011
 
1659
2012
  /**
@@ -1705,6 +2058,12 @@ export declare interface GridTreeNode {
1705
2058
  serverChildrenCount?: number;
1706
2059
  }
1707
2060
 
2061
+ /** `undoRedo` options. @since v3.4 */
2062
+ export declare interface GridUndoRedoOptions {
2063
+ /** How many actions are kept; the oldest is dropped beyond it. Default: 100. */
2064
+ limit?: number;
2065
+ }
2066
+
1708
2067
  /**
1709
2068
  * The constraint on the row type `R` of the generic grid types (`DataGridProps<R>`, `GridColDef<R>`,
1710
2069
  * `GridRenderCellParams<R>` …): any object type. Your own interfaces and type aliases can be used as `R`
@@ -1734,6 +2093,14 @@ export declare interface GridValueGetterParams<R extends GridValidRowModel = Gri
1734
2093
  value: unknown;
1735
2094
  }
1736
2095
 
2096
+ /** Parameters passed to `GridColDef.valueParser`. @since v3.4 */
2097
+ export declare interface GridValueParserParams<R extends GridValidRowModel = GridRowModel> {
2098
+ /** The row the text is pasted into, as stored now. */
2099
+ row: R;
2100
+ field: string;
2101
+ colDef: GridColDef<R>;
2102
+ }
2103
+
1737
2104
  /**
1738
2105
  * Parameters passed to the `valueSetter` function.
1739
2106
  * @since v3.0
@@ -1782,10 +2149,14 @@ export declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1782
2149
  onDragOver?: (field: string) => (event: default_2.DragEvent) => void;
1783
2150
  onDragEnd?: () => void;
1784
2151
  onDrop?: (targetField: string) => (event: default_2.DragEvent) => void;
1785
- /** The grid's focus position; `id: null` means a header cell is focused. */
2152
+ /**
2153
+ * The grid's focus position; `id: null` means a header cell is focused, and `headerFilter: true`
2154
+ * a cell of the header filter row.
2155
+ */
1786
2156
  focusedCell?: {
1787
2157
  id: string | number | null;
1788
2158
  field: string;
2159
+ headerFilter?: boolean;
1789
2160
  } | null;
1790
2161
  onHeaderClick?: (field: string) => void;
1791
2162
  onSortAdd?: (field: string, direction: GridSortDirection) => void;
@@ -1799,15 +2170,34 @@ export declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1799
2170
  wrapHeaderText?: boolean;
1800
2171
  /** Header row height in pixels; sets how many lines a wrapped title may take. Defaults to 56. */
1801
2172
  headerHeight?: number;
2173
+ /** Renders the header filter row under the column headers (`DataGridProps.headerFilters`). */
2174
+ headerFilters?: boolean;
2175
+ /** The filter model the header filter row reads. */
2176
+ filterModel?: GridFilterModel;
2177
+ /** Receives the filter model after a header filter changes. */
2178
+ onFilterModelChange?: (model: GridFilterModel) => void;
2179
+ /** Opens the filter panel; a header filter cell showing "Custom filter" calls it. */
2180
+ onOpenFilterPanel?: () => void;
1802
2181
  }
1803
2182
 
1804
- export declare const Input: default_2.FC<InputProps>;
2183
+ /**
2184
+ * A text field: an `<input>` inside an `.ogx-input-wrapper` that holds the adornments.
2185
+ * `ref` reaches the `<input>` (React 18 and 19).
2186
+ */
2187
+ export declare const Input: default_2.ForwardRefExoticComponent<InputProps & default_2.RefAttributes<HTMLInputElement>>;
1805
2188
 
1806
2189
  export declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
1807
2190
  fullWidth?: boolean;
1808
2191
  error?: boolean;
1809
2192
  startAdornment?: default_2.ReactNode;
1810
2193
  endAdornment?: default_2.ReactNode;
2194
+ /** Classes added to the `<input>` itself, next to `ogx-input`. `className` goes to the wrapper. */
2195
+ inputClassName?: string;
2196
+ /**
2197
+ * `'field'` (default): a bordered form field. `'cell'`: fills a grid cell with no border,
2198
+ * background or focus ring, in the cell's font, for use in `renderEditCell`.
2199
+ */
2200
+ variant?: 'field' | 'cell';
1811
2201
  }
1812
2202
 
1813
2203
  export declare interface JsonExportOptions<R extends GridValidRowModel = GridRowModel> {