@opencorestack/opengridx 3.2.2 → 3.4.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 +53 -0
- package/README.md +16 -2
- package/dist/ai.cjs +1 -0
- package/dist/ai.cjs.map +1 -0
- package/dist/ai.d.ts +166 -0
- package/dist/ai.es.js +1 -0
- package/dist/ai.es.js.map +1 -0
- package/dist/index.d.ts +321 -3
- package/dist/opengridx.css +1 -1
- package/dist/opengridx.es.js +6483 -5291
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +16 -13
- package/dist/opengridx.umd.js.map +1 -1
- package/docs/API_REFERENCE.md +132 -3
- package/docs/README.md +4 -1
- package/docs/architecture/datagrid-orchestration.md +23 -6
- package/docs/components/header.md +25 -0
- package/docs/customization/theming.md +12 -1
- package/docs/features/ai-toolkit.md +119 -0
- package/docs/features/cell-selection.md +131 -0
- package/docs/features/clipboard.md +90 -0
- package/docs/features/editing-reordering.md +50 -0
- package/docs/features/keyboard-navigation.md +25 -2
- package/docs/features/undo-redo.md +79 -0
- package/docs/roadmap.md +64 -7
- package/lib/ai/coerce.ts +90 -0
- package/lib/ai/columns.ts +90 -0
- package/lib/ai/index.ts +16 -0
- package/lib/ai/schema.ts +214 -0
- package/lib/ai/types.ts +88 -0
- package/lib/ai/validate.ts +286 -0
- package/lib/components/Cell/Cell.css +35 -0
- package/lib/components/Cell/Cell.tsx +25 -13
- package/lib/components/Cell/CellErrorBoundary.tsx +3 -0
- package/lib/components/Cell/GridEditInputCell.css +12 -4
- package/lib/components/Cell/GridEditInputCell.tsx +19 -12
- package/lib/components/CellSelectionStats/CellSelectionStats.css +31 -0
- package/lib/components/CellSelectionStats/CellSelectionStats.tsx +32 -0
- package/lib/components/CellSelectionStats/GridCellSelectionStatsArea.tsx +24 -0
- package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +14 -0
- package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.tsx +3 -2
- package/lib/components/DataGrid/DataGrid.tsx +123 -3
- package/lib/components/DataGrid/GridLiveRegion.tsx +8 -2
- package/lib/components/DataGrid/GridPinnedRows.tsx +9 -0
- package/lib/components/DataGrid/GridToolbarSlot.tsx +5 -0
- package/lib/components/DataGrid/GridVirtualRows.tsx +9 -0
- package/lib/components/FilterPanel/FilterPanel.css +14 -0
- package/lib/components/FilterPanel/FilterPanel.tsx +5 -3
- package/lib/components/Header/Header.css +12 -0
- package/lib/components/Header/Header.tsx +17 -4
- package/lib/components/ListView/ListView.css +2 -4
- package/lib/components/ListView/ListViewRow.tsx +2 -2
- package/lib/components/Row/Row.tsx +38 -1
- package/lib/components/Toolbar/GlobalSearch.css +16 -0
- package/lib/components/Toolbar/GlobalSearch.tsx +3 -2
- package/lib/components/Toolbar/GridToolbar.tsx +10 -4
- package/lib/components/ui/Checkbox.tsx +26 -10
- package/lib/components/ui/Input.css +43 -0
- package/lib/components/ui/Input.tsx +24 -5
- package/lib/hooks/core/gridApiPlaceholder.ts +14 -1
- package/lib/hooks/core/useDataGrid.ts +27 -0
- package/lib/hooks/core/useGridCellSelection.ts +631 -0
- package/lib/hooks/core/useGridCellSelectionApi.ts +97 -0
- package/lib/hooks/core/useGridClipboardApi.ts +8 -2
- package/lib/hooks/core/useGridClipboardPaste.ts +283 -0
- package/lib/hooks/core/useGridControlledState.ts +38 -0
- package/lib/hooks/core/useGridKeyboardNavigation.ts +32 -0
- package/lib/hooks/core/useGridRowInteractions.ts +8 -4
- package/lib/hooks/core/useGridUndoRedo.ts +220 -0
- package/lib/hooks/features/useAggregation.ts +8 -6
- package/lib/hooks/features/useGridBatchEdit.ts +217 -0
- package/lib/hooks/features/useGridClipboard.ts +47 -2
- package/lib/hooks/features/useGridEditing.ts +39 -51
- package/lib/index.ts +16 -0
- package/lib/styles/base/variables.css +6 -1
- package/lib/styles/opengridx.css +3 -1
- package/lib/theme/DataGridThemeProvider.tsx +4 -0
- package/lib/theme/presets.ts +8 -0
- package/lib/theme/types.ts +4 -0
- package/lib/types/index.ts +254 -0
- package/lib/utils/attempt.ts +14 -0
- package/lib/utils/cellSelection.ts +238 -0
- package/lib/utils/editing/commit.ts +69 -0
- package/lib/utils/editing/targets.ts +109 -0
- package/lib/utils/headerWrap.ts +23 -0
- package/lib/utils/parsing.ts +252 -0
- package/llms.txt +71 -2
- package/package.json +14 -4
package/dist/index.d.ts
CHANGED
|
@@ -79,14 +79,35 @@ export declare interface CellProps<R extends GridRowModel = GridRowModel> {
|
|
|
79
79
|
rowMeta?: GridRowMeta;
|
|
80
80
|
/** The error the column's valueGetter threw for this cell (computed by Row); shown as a cell error. */
|
|
81
81
|
valueError?: unknown;
|
|
82
|
+
/**
|
|
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
|
|
85
|
+
*/
|
|
86
|
+
rangeFlags?: number;
|
|
82
87
|
}
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
/**
|
|
90
|
+
* The status bar of `showCellSelectionStats`: count of non-empty cells, and the sum and average of
|
|
91
|
+
* the numeric cells of the selected range. Replace it with `slots.cellSelectionStats`, or wrap it.
|
|
92
|
+
* @since v3.3
|
|
93
|
+
*/
|
|
94
|
+
export declare function CellSelectionStats({ count, sum, average }: CellSelectionStatsProps): JSX.Element;
|
|
95
|
+
|
|
96
|
+
export declare type CellSelectionStatsProps = GridCellSelectionStatsSlotProps & Record<string, unknown>;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A styled checkbox: a visually hidden `<input type="checkbox">` inside a `<label>`. Other props
|
|
100
|
+
* (`onChange`, `onMouseDown`, `tabIndex`, `aria-*`, …) go to the `<input>`, and so does `ref`.
|
|
101
|
+
*/
|
|
102
|
+
export declare const Checkbox: default_2.ForwardRefExoticComponent<CheckboxProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
85
103
|
|
|
86
104
|
export declare interface CheckboxProps extends Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
87
105
|
indeterminate?: boolean;
|
|
88
106
|
label?: string;
|
|
107
|
+
/** A ref to the `<input>`; the forwarded `ref` reaches it as well. */
|
|
89
108
|
inputRef?: default_2.Ref<HTMLInputElement>;
|
|
109
|
+
/** Classes added to the `<input>` itself, next to `ogx-checkbox__input`. `className` goes to the wrapper `<label>`. */
|
|
110
|
+
inputClassName?: string;
|
|
90
111
|
}
|
|
91
112
|
|
|
92
113
|
declare type ColumnKey = string;
|
|
@@ -164,6 +185,13 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
164
185
|
rowHeight?: number;
|
|
165
186
|
/** Height of the header row in pixels. Defaults to 56. */
|
|
166
187
|
headerHeight?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Wraps header titles onto several lines instead of cutting them with an ellipsis. The header
|
|
190
|
+
* keeps `headerHeight` (2 lines at the default 56px, 3 at 72px, 4 at 88px); a title that still
|
|
191
|
+
* does not fit ends in an ellipsis. `GridColDef.wrapHeaderText` overrides it per column.
|
|
192
|
+
* Defaults to `false`.
|
|
193
|
+
*/
|
|
194
|
+
wrapHeaderText?: boolean;
|
|
167
195
|
/** If true, the grid height will adjust to match the total height of its rows. */
|
|
168
196
|
autoHeight?: boolean;
|
|
169
197
|
/**
|
|
@@ -233,6 +261,55 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
233
261
|
* the shortcut. `apiRef.current.copySelectedRows()` still works. Default: false.
|
|
234
262
|
*/
|
|
235
263
|
disableClipboardCopy?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Lets users select a rectangle of cells (drag, Shift+click, Shift+arrows, Ctrl/Cmd+A) and copy it
|
|
266
|
+
* with Ctrl/Cmd+C as tab-separated text. While on, Ctrl/Cmd+C copies the cell range (the focused
|
|
267
|
+
* cell at minimum) instead of the selected rows; `apiRef.copySelectedRows()` still copies rows.
|
|
268
|
+
* Default: false. @since v3.3
|
|
269
|
+
*/
|
|
270
|
+
cellSelection?: boolean;
|
|
271
|
+
/** Controlled cell selection (zero or one range). Needs `cellSelection`. @since v3.3 */
|
|
272
|
+
cellSelectionModel?: GridCellSelectionModel;
|
|
273
|
+
/** Fired when the cell selection changes, with what changed it. @since v3.3 */
|
|
274
|
+
onCellSelectionModelChange?: (model: GridCellSelectionModel, details: GridCellSelectionChangeDetails) => void;
|
|
275
|
+
/**
|
|
276
|
+
* Shows a status bar under the grid with the count of non-empty cells and the sum and average of the
|
|
277
|
+
* numeric cells in the range, while more than one cell is selected. Replaceable through
|
|
278
|
+
* `slots.cellSelectionStats`. Needs `cellSelection`. Default: false. @since v3.3
|
|
279
|
+
*/
|
|
280
|
+
showCellSelectionStats?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* With `cellSelection` on, Ctrl/Cmd+V pastes tab-separated text (Excel, Google Sheets) into the
|
|
283
|
+
* editable cells from the range's top-left cell (or the focused cell), through `valueSetter` and
|
|
284
|
+
* `processRowUpdate`. `true` turns the shortcut off; `apiRef.pasteText()` still works. Default: false.
|
|
285
|
+
* @since v3.4
|
|
286
|
+
*/
|
|
287
|
+
disableClipboardPaste?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Fired after every paste with the result (`updated` rows, `failed` rows, `skipped` cells and why)
|
|
290
|
+
* and the pasted text. @since v3.4
|
|
291
|
+
*/
|
|
292
|
+
onClipboardPaste?: (result: GridClipboardPasteResult) => void;
|
|
293
|
+
/**
|
|
294
|
+
* Called before a paste is applied. Return `false` to cancel it, or a string to paste instead of the
|
|
295
|
+
* clipboard text. A throw cancels the paste. @since v3.4
|
|
296
|
+
*/
|
|
297
|
+
onBeforeClipboardPaste?: (params: GridBeforeClipboardPasteParams) => boolean | string;
|
|
298
|
+
/**
|
|
299
|
+
* With `cellSelection` on, Delete / Backspace on a range of more than one cell empties its editable
|
|
300
|
+
* cells (`null`, or `''` in string columns) as one edit. `true` turns that off. Default: false.
|
|
301
|
+
* @since v3.4
|
|
302
|
+
*/
|
|
303
|
+
disableRangeClear?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Undo and redo of cell edits, pastes and range clears: Ctrl/Cmd+Z, Ctrl/Cmd+Shift+Z and Ctrl+Y while
|
|
306
|
+
* focus is in the grid and no editor is open, and `apiRef.undo()` / `redo()`. Undo and redo write
|
|
307
|
+
* through `valueSetter` and `processRowUpdate`, like an edit. `{ limit }` sets how many actions are
|
|
308
|
+
* kept (default 100). Default: false. @since v3.4
|
|
309
|
+
*/
|
|
310
|
+
undoRedo?: boolean | GridUndoRedoOptions;
|
|
311
|
+
/** Fired when what can be undone or redone changes (`undoRedo`). @since v3.4 */
|
|
312
|
+
onHistoryChange?: (params: GridHistoryChangeParams) => void;
|
|
236
313
|
/** 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. */
|
|
237
314
|
loading?: boolean;
|
|
238
315
|
/** Visual density of the grid. */
|
|
@@ -371,6 +448,11 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
371
448
|
* Receives `GridFooterSlotProps` (plus `slotProps.footer`).
|
|
372
449
|
*/
|
|
373
450
|
footer?: React.ComponentType<GridFooterSlotProps & Record<string, unknown>>;
|
|
451
|
+
/**
|
|
452
|
+
* Replaces the status bar of `showCellSelectionStats`. Receives `GridCellSelectionStatsSlotProps`
|
|
453
|
+
* (plus `slotProps.cellSelectionStats`). @since v3.3
|
|
454
|
+
*/
|
|
455
|
+
cellSelectionStats?: React.ComponentType<GridCellSelectionStatsSlotProps & Record<string, unknown>>;
|
|
374
456
|
};
|
|
375
457
|
/** Properties passed directly to custom slots. */
|
|
376
458
|
slotProps?: {
|
|
@@ -386,6 +468,8 @@ export declare interface DataGridProps<R extends GridValidRowModel = GridRowMode
|
|
|
386
468
|
loadingOverlay?: GridOverlaySlotProps;
|
|
387
469
|
/** Merged over the `GridFooterSlotProps` the grid passes to the footer slot. */
|
|
388
470
|
footer?: Partial<GridFooterSlotProps> & Record<string, unknown>;
|
|
471
|
+
/** Merged over the `GridCellSelectionStatsSlotProps` the grid passes to the status bar. */
|
|
472
|
+
cellSelectionStats?: Partial<GridCellSelectionStatsSlotProps> & Record<string, unknown>;
|
|
389
473
|
};
|
|
390
474
|
/** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
|
|
391
475
|
listView?: boolean;
|
|
@@ -688,6 +772,76 @@ export declare interface GridApi<R extends GridValidRowModel = GridRowModel> {
|
|
|
688
772
|
* in which case nothing is written) and rejects when the clipboard write fails.
|
|
689
773
|
*/
|
|
690
774
|
copySelectedRows: () => Promise<void>;
|
|
775
|
+
/** The cell selection (`[]` when `cellSelection` is off or nothing is selected). @since v3.3 */
|
|
776
|
+
getCellSelectionModel: () => GridCellSelectionModel;
|
|
777
|
+
/**
|
|
778
|
+
* Replaces the cell selection (only the first range is kept) and moves focus to its anchor.
|
|
779
|
+
* Does nothing while `cellSelection` is off. @since v3.3
|
|
780
|
+
*/
|
|
781
|
+
setCellSelectionModel: (model: GridCellSelectionModel) => void;
|
|
782
|
+
/** Selects the rectangle between two cells; `anchor` becomes the active cell. @since v3.3 */
|
|
783
|
+
selectCellRange: (anchor: GridCellCoordinates, head: GridCellCoordinates) => void;
|
|
784
|
+
/** Empties the cell selection. Focus stays where it is. @since v3.3 */
|
|
785
|
+
clearCellSelection: () => void;
|
|
786
|
+
/**
|
|
787
|
+
* Cells of the current range in display order (row by row, columns in screen order), values read
|
|
788
|
+
* through the column's `valueGetter`. Synthetic rows (group headers, subtotals, tree auto-parents, the
|
|
789
|
+
* pivot Grand Total) and positions covered by a span are left out. @since v3.3
|
|
790
|
+
*/
|
|
791
|
+
getSelectedCells: () => GridSelectedCell[];
|
|
792
|
+
/**
|
|
793
|
+
* Copies the cell range (the focused cell when nothing is selected) as tab-separated text, formatted
|
|
794
|
+
* the way the cells show it, with no header line. Resolves without writing when there is nothing to
|
|
795
|
+
* copy; rejects when the clipboard write fails. @since v3.3
|
|
796
|
+
*/
|
|
797
|
+
copySelectedCells: () => Promise<void>;
|
|
798
|
+
/**
|
|
799
|
+
* Pastes tab-separated text as Ctrl/Cmd+V does: from `anchor` (default: the range's top-left cell,
|
|
800
|
+
* else the focused cell), with `onBeforeClipboardPaste` and `onClipboardPaste`. Works with
|
|
801
|
+
* `disableClipboardPaste`. Resolves once every row's `processRowUpdate` has settled. @since v3.4
|
|
802
|
+
*/
|
|
803
|
+
pasteText: (text: string, anchor?: GridCellCoordinates) => Promise<GridBatchEditResult>;
|
|
804
|
+
/** Undoes the last action (`undoRedo`). Resolves with what was written. @since v3.4 */
|
|
805
|
+
undo: () => Promise<GridBatchEditResult>;
|
|
806
|
+
/** Redoes the last undone action (`undoRedo`). @since v3.4 */
|
|
807
|
+
redo: () => Promise<GridBatchEditResult>;
|
|
808
|
+
/** Whether there is an action to undo. @since v3.4 */
|
|
809
|
+
canUndo: () => boolean;
|
|
810
|
+
/** Whether there is an undone action to redo. @since v3.4 */
|
|
811
|
+
canRedo: () => boolean;
|
|
812
|
+
/** Forgets every action (undo and redo). @since v3.4 */
|
|
813
|
+
clearHistory: () => void;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** What a batch edit (paste, range clear, undo, redo) did. @since v3.4 */
|
|
817
|
+
export declare interface GridBatchEditResult {
|
|
818
|
+
/** Rows whose `processRowUpdate` succeeded and that were stored, in the order they were first touched. */
|
|
819
|
+
updated: GridRowId[];
|
|
820
|
+
/** Rows whose `valueSetter` or `processRowUpdate` threw or rejected (also reported to `onProcessRowUpdateError`). */
|
|
821
|
+
failed: {
|
|
822
|
+
id: GridRowId;
|
|
823
|
+
error: unknown;
|
|
824
|
+
}[];
|
|
825
|
+
/** Cells that were not written, with the reason. */
|
|
826
|
+
skipped: {
|
|
827
|
+
id: GridRowId;
|
|
828
|
+
field: string;
|
|
829
|
+
reason: GridEditSkipReason;
|
|
830
|
+
}[];
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/** `onBeforeClipboardPaste` params. @since v3.4 */
|
|
834
|
+
export declare interface GridBeforeClipboardPasteParams {
|
|
835
|
+
/** The clipboard text (`text/plain`). */
|
|
836
|
+
text: string;
|
|
837
|
+
/** The cell the paste starts from (the range's top-left cell, or the focused cell). */
|
|
838
|
+
anchor: GridCellCoordinates | null;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/** One cell, addressed by its row id and column field. @since v3.3 */
|
|
842
|
+
export declare interface GridCellCoordinates {
|
|
843
|
+
id: GridRowId;
|
|
844
|
+
field: string;
|
|
691
845
|
}
|
|
692
846
|
|
|
693
847
|
export declare interface GridCellParams<R extends GridValidRowModel = GridRowModel> {
|
|
@@ -699,6 +853,59 @@ export declare interface GridCellParams<R extends GridValidRowModel = GridRowMod
|
|
|
699
853
|
colIndex: number;
|
|
700
854
|
}
|
|
701
855
|
|
|
856
|
+
/**
|
|
857
|
+
* A rectangle of cells between two corners. `anchor` is the active cell: it keeps focus, is the cell
|
|
858
|
+
* an edit starts in, and stays put while the range is extended. `head` is the corner that moves with
|
|
859
|
+
* Shift+arrows or the pointer, and the one scrolled into view. A single cell has `anchor` equal to `head`.
|
|
860
|
+
* @since v3.3
|
|
861
|
+
*/
|
|
862
|
+
export declare interface GridCellRange {
|
|
863
|
+
anchor: GridCellCoordinates;
|
|
864
|
+
head: GridCellCoordinates;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/** Second argument of `onCellSelectionModelChange`. @since v3.3 */
|
|
868
|
+
export declare interface GridCellSelectionChangeDetails {
|
|
869
|
+
reason: GridCellSelectionReason;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* The cell selection: zero or one range in 3.3 (the array form leaves room for several ranges later).
|
|
874
|
+
* Corners are ids and fields, so the rectangle follows its corner rows through sorting and filtering.
|
|
875
|
+
* @since v3.3
|
|
876
|
+
*/
|
|
877
|
+
export declare type GridCellSelectionModel = readonly GridCellRange[];
|
|
878
|
+
|
|
879
|
+
/** What changed the cell selection. @since v3.3 */
|
|
880
|
+
export declare type GridCellSelectionReason = 'pointer' | 'keyboard' | 'selectAll' | 'api' | 'clear' | 'dataChange';
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Props the grid passes to `slots.cellSelectionStats` (the status bar of `showCellSelectionStats`),
|
|
884
|
+
* before `slotProps.cellSelectionStats` is merged over them. Rendered only while more than one cell
|
|
885
|
+
* is selected.
|
|
886
|
+
* @since v3.3
|
|
887
|
+
*/
|
|
888
|
+
export declare interface GridCellSelectionStatsSlotProps {
|
|
889
|
+
apiRef: React.MutableRefObject<GridApi>;
|
|
890
|
+
/** Cells in the rectangle (rows × columns), synthetic rows and span-covered positions included. */
|
|
891
|
+
cellCount: number;
|
|
892
|
+
rowCount: number;
|
|
893
|
+
columnCount: number;
|
|
894
|
+
/** Non-empty cells of data rows. */
|
|
895
|
+
count: number;
|
|
896
|
+
/** Cells holding a number. */
|
|
897
|
+
numericCount: number;
|
|
898
|
+
/** Sum of the numeric cells, or `null` when there are none. */
|
|
899
|
+
sum: number | null;
|
|
900
|
+
/** Average of the numeric cells, or `null` when there are none. */
|
|
901
|
+
average: number | null;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/** `onClipboardPaste` details: the batch edit result plus the text that was pasted. @since v3.4 */
|
|
905
|
+
export declare interface GridClipboardPasteResult extends GridBatchEditResult {
|
|
906
|
+
text: string;
|
|
907
|
+
}
|
|
908
|
+
|
|
702
909
|
/**
|
|
703
910
|
* Metadata for a single column.
|
|
704
911
|
* Governs rendering, sorting, filtering, and data transformation.
|
|
@@ -737,6 +944,12 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
|
|
|
737
944
|
align?: GridAlignment;
|
|
738
945
|
/** Content alignment within the header cell. */
|
|
739
946
|
headerAlign?: GridAlignment;
|
|
947
|
+
/**
|
|
948
|
+
* Wraps this column's header title onto several lines instead of cutting it with an ellipsis.
|
|
949
|
+
* Overrides the grid's `wrapHeaderText`. The header keeps `headerHeight`: the title shows as many
|
|
950
|
+
* lines as fit and ends in an ellipsis if it is still longer. Raise `headerHeight` for more lines.
|
|
951
|
+
*/
|
|
952
|
+
wrapHeaderText?: boolean;
|
|
740
953
|
/** If false, sorting is disabled for this column. */
|
|
741
954
|
sortable?: boolean;
|
|
742
955
|
/** If false, filtering is disabled for this column. */
|
|
@@ -765,6 +978,14 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
|
|
|
765
978
|
* @since v3.0
|
|
766
979
|
*/
|
|
767
980
|
valueSetter?(params: GridValueSetterParams<R>): R;
|
|
981
|
+
/**
|
|
982
|
+
* Turns pasted text into this column's value (clipboard paste), instead of the default parser for
|
|
983
|
+
* the column `type` (see `docs/features/clipboard.md`). Use it for locales such as `1.234,5` or for
|
|
984
|
+
* custom codes. Throw (or return `undefined`) to reject the text: the cell is skipped with reason
|
|
985
|
+
* `'invalidValue'`. The value then goes through `valueSetter` and `processRowUpdate` like an edit.
|
|
986
|
+
* @since v3.4
|
|
987
|
+
*/
|
|
988
|
+
valueParser?(text: string, params: GridValueParserParams<R>): unknown;
|
|
768
989
|
/**
|
|
769
990
|
* Custom ascending comparator for client-side sorting by this column, used instead of the built-in
|
|
770
991
|
* type-aware comparison. `v1` / `v2` are the cell values (`valueGetter` applied) and **include
|
|
@@ -823,6 +1044,15 @@ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel>
|
|
|
823
1044
|
* @default true
|
|
824
1045
|
*/
|
|
825
1046
|
exportable?: boolean;
|
|
1047
|
+
/**
|
|
1048
|
+
* Example values for this column, put into the schema from `getGridAiSchema`
|
|
1049
|
+
* (`@opencorestack/opengridx/ai`) to help a language model write filters ("Acme" → `customer`).
|
|
1050
|
+
* **These values are sent to the model.** The grid never reads row data for the schema; only what
|
|
1051
|
+
* you list here leaves the app, so list nothing private. Strings, numbers and booleans are used
|
|
1052
|
+
* (at most 10); other values are ignored. Not used by the grid itself.
|
|
1053
|
+
* @since v3.4
|
|
1054
|
+
*/
|
|
1055
|
+
aiExamples?: unknown[];
|
|
826
1056
|
}
|
|
827
1057
|
|
|
828
1058
|
/**
|
|
@@ -921,6 +1151,17 @@ export declare interface GridDetailPanelParams<R extends GridValidRowModel = Gri
|
|
|
921
1151
|
rowIndex: number;
|
|
922
1152
|
}
|
|
923
1153
|
|
|
1154
|
+
/**
|
|
1155
|
+
* Why a cell of a batch edit (paste, range clear, undo, redo) was not written:
|
|
1156
|
+
* - `'notEditable'`: the column is not `editable`, `isCellEditable` returned false, or the row is a
|
|
1157
|
+
* synthetic row (group header, subtotal, tree auto-parent, pivot Grand Total);
|
|
1158
|
+
* - `'invalidValue'`: the pasted text does not parse for the column type (or `valueParser` rejected it);
|
|
1159
|
+
* - `'changed'`: undo/redo only, the cell no longer holds the value the history recorded;
|
|
1160
|
+
* - `'missing'`: undo/redo only, the row is gone.
|
|
1161
|
+
* @since v3.4
|
|
1162
|
+
*/
|
|
1163
|
+
export declare type GridEditSkipReason = 'notEditable' | 'invalidValue' | 'changed' | 'missing';
|
|
1164
|
+
|
|
924
1165
|
/** Describes a group of filters combined with a logical operator. */
|
|
925
1166
|
export declare interface GridFilterGroup {
|
|
926
1167
|
/** Optional ID for the group. */
|
|
@@ -1022,6 +1263,14 @@ export declare interface GridGroupedExportRow {
|
|
|
1022
1263
|
row?: GridRowModel;
|
|
1023
1264
|
}
|
|
1024
1265
|
|
|
1266
|
+
/** `onHistoryChange` params. @since v3.4 */
|
|
1267
|
+
export declare interface GridHistoryChangeParams {
|
|
1268
|
+
canUndo: boolean;
|
|
1269
|
+
canRedo: boolean;
|
|
1270
|
+
/** Number of actions that can be undone. */
|
|
1271
|
+
size: number;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1025
1274
|
/**
|
|
1026
1275
|
* The state the grid starts from. Every part is optional, including each column field, so a
|
|
1027
1276
|
* partial state such as `{ columns: { columnVisibilityModel: { age: false } } }` is valid.
|
|
@@ -1046,6 +1295,12 @@ export declare interface GridLocaleText {
|
|
|
1046
1295
|
paginationPage?: (page: number, pageCount: number) => string;
|
|
1047
1296
|
/** Empty-state label. When set, overrides the `noRowsLabel` prop on DataGrid. Default: `"No Data"` */
|
|
1048
1297
|
noRowsLabel?: string;
|
|
1298
|
+
/**
|
|
1299
|
+
* Screen-reader announcement after the cell range changes (`cellSelection`). Receives (cells, rows,
|
|
1300
|
+
* columns). Default: `` (c, r, col) => `${c} cells selected, ${r} rows by ${col} columns` `` (singular for 1).
|
|
1301
|
+
* @since v3.3
|
|
1302
|
+
*/
|
|
1303
|
+
cellSelectionAnnouncement?: (cellCount: number, rowCount: number, columnCount: number) => string;
|
|
1049
1304
|
}
|
|
1050
1305
|
|
|
1051
1306
|
/**
|
|
@@ -1132,6 +1387,20 @@ export declare interface GridRenderHeaderParams {
|
|
|
1132
1387
|
colIndex: number;
|
|
1133
1388
|
}
|
|
1134
1389
|
|
|
1390
|
+
/**
|
|
1391
|
+
* The range flags one row passes to its cells, or `null` for a row outside the range. Rows outside
|
|
1392
|
+
* keep `null`, so a drag only re-renders the rows it enters or leaves. `left` / `right` are data
|
|
1393
|
+
* column indices (`columnIndexMap`).
|
|
1394
|
+
*/
|
|
1395
|
+
declare interface GridRowCellRange {
|
|
1396
|
+
left: number;
|
|
1397
|
+
right: number;
|
|
1398
|
+
isTop: boolean;
|
|
1399
|
+
isBottom: boolean;
|
|
1400
|
+
/** Rows from this one to the bottom of the range; only set (else 0) when the grid has row spans. */
|
|
1401
|
+
bottomOffset: number;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1135
1404
|
export declare type GridRowGroupingModel = string[];
|
|
1136
1405
|
|
|
1137
1406
|
/** Unique identifier for a row (string or number). */
|
|
@@ -1213,6 +1482,14 @@ export declare interface GridRowScrollEndParams {
|
|
|
1213
1482
|
|
|
1214
1483
|
export declare type GridRowSelectionModel = GridRowId[];
|
|
1215
1484
|
|
|
1485
|
+
/** One cell of the selected range, as returned by `apiRef.getSelectedCells()`. @since v3.3 */
|
|
1486
|
+
export declare interface GridSelectedCell {
|
|
1487
|
+
id: GridRowId;
|
|
1488
|
+
field: string;
|
|
1489
|
+
/** The cell's value, read through the column's `valueGetter`. */
|
|
1490
|
+
value: unknown;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1216
1493
|
/** The `slotProps` prop of `DataGrid`: props for each slot, keyed like `GridSlots`. */
|
|
1217
1494
|
export declare type GridSlotProps = NonNullable<DataGridProps['slotProps']>;
|
|
1218
1495
|
|
|
@@ -1354,6 +1631,10 @@ export declare interface GridThemeGrid {
|
|
|
1354
1631
|
rowSelectedBackground?: string;
|
|
1355
1632
|
rowSelectedHoverBackground?: string;
|
|
1356
1633
|
cellFocusBorder?: string;
|
|
1634
|
+
/** Tint over a selected cell range (`--ogx-range-background`). Default: the primary colour at 12%. @since v3.3 */
|
|
1635
|
+
rangeBackground?: string;
|
|
1636
|
+
/** Outline of a selected cell range (`--ogx-range-border`). Default: the primary colour. @since v3.3 */
|
|
1637
|
+
rangeBorder?: string;
|
|
1357
1638
|
pinnedLeftShadow?: string;
|
|
1358
1639
|
pinnedRightShadow?: string;
|
|
1359
1640
|
checkboxBg?: string;
|
|
@@ -1545,6 +1826,12 @@ export declare interface GridTreeNode {
|
|
|
1545
1826
|
serverChildrenCount?: number;
|
|
1546
1827
|
}
|
|
1547
1828
|
|
|
1829
|
+
/** `undoRedo` options. @since v3.4 */
|
|
1830
|
+
export declare interface GridUndoRedoOptions {
|
|
1831
|
+
/** How many actions are kept; the oldest is dropped beyond it. Default: 100. */
|
|
1832
|
+
limit?: number;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1548
1835
|
/**
|
|
1549
1836
|
* The constraint on the row type `R` of the generic grid types (`DataGridProps<R>`, `GridColDef<R>`,
|
|
1550
1837
|
* `GridRenderCellParams<R>` …): any object type. Your own interfaces and type aliases can be used as `R`
|
|
@@ -1574,6 +1861,14 @@ export declare interface GridValueGetterParams<R extends GridValidRowModel = Gri
|
|
|
1574
1861
|
value: unknown;
|
|
1575
1862
|
}
|
|
1576
1863
|
|
|
1864
|
+
/** Parameters passed to `GridColDef.valueParser`. @since v3.4 */
|
|
1865
|
+
export declare interface GridValueParserParams<R extends GridValidRowModel = GridRowModel> {
|
|
1866
|
+
/** The row the text is pasted into, as stored now. */
|
|
1867
|
+
row: R;
|
|
1868
|
+
field: string;
|
|
1869
|
+
colDef: GridColDef<R>;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1577
1872
|
/**
|
|
1578
1873
|
* Parameters passed to the `valueSetter` function.
|
|
1579
1874
|
* @since v3.0
|
|
@@ -1635,15 +1930,30 @@ export declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
|
|
|
1635
1930
|
onManageColumns?: () => void;
|
|
1636
1931
|
/** Position of each visible data column in render order, for `colIndex` and `aria-colindex`. */
|
|
1637
1932
|
columnIndexMap?: Map<string, number>;
|
|
1933
|
+
/** Wraps header titles onto several lines; `GridColDef.wrapHeaderText` overrides it per column. */
|
|
1934
|
+
wrapHeaderText?: boolean;
|
|
1935
|
+
/** Header row height in pixels; sets how many lines a wrapped title may take. Defaults to 56. */
|
|
1936
|
+
headerHeight?: number;
|
|
1638
1937
|
}
|
|
1639
1938
|
|
|
1640
|
-
|
|
1939
|
+
/**
|
|
1940
|
+
* A text field: an `<input>` inside an `.ogx-input-wrapper` that holds the adornments.
|
|
1941
|
+
* `ref` reaches the `<input>` (React 18 and 19).
|
|
1942
|
+
*/
|
|
1943
|
+
export declare const Input: default_2.ForwardRefExoticComponent<InputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
1641
1944
|
|
|
1642
1945
|
export declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
|
|
1643
1946
|
fullWidth?: boolean;
|
|
1644
1947
|
error?: boolean;
|
|
1645
1948
|
startAdornment?: default_2.ReactNode;
|
|
1646
1949
|
endAdornment?: default_2.ReactNode;
|
|
1950
|
+
/** Classes added to the `<input>` itself, next to `ogx-input`. `className` goes to the wrapper. */
|
|
1951
|
+
inputClassName?: string;
|
|
1952
|
+
/**
|
|
1953
|
+
* `'field'` (default): a bordered form field. `'cell'`: fills a grid cell with no border,
|
|
1954
|
+
* background or focus ring, in the cell's font, for use in `renderEditCell`.
|
|
1955
|
+
*/
|
|
1956
|
+
variant?: 'field' | 'cell';
|
|
1647
1957
|
}
|
|
1648
1958
|
|
|
1649
1959
|
export declare interface JsonExportOptions<R extends GridValidRowModel = GridRowModel> {
|
|
@@ -1835,7 +2145,10 @@ export declare interface PrintOptions<R extends GridValidRowModel = GridRowModel
|
|
|
1835
2145
|
|
|
1836
2146
|
export declare const roseTheme: GridTheme;
|
|
1837
2147
|
|
|
1838
|
-
|
|
2148
|
+
/** One grid row. Memoised: rows whose props did not change (for example outside a dragged cell range) do not re-render. */
|
|
2149
|
+
export declare const Row: typeof RowImpl;
|
|
2150
|
+
|
|
2151
|
+
declare function RowImpl<R extends GridRowModel = GridRowModel>(props: RowProps<R>): JSX.Element;
|
|
1839
2152
|
|
|
1840
2153
|
export declare interface RowProps<R extends GridRowModel = GridRowModel> {
|
|
1841
2154
|
row: R;
|
|
@@ -1901,6 +2214,11 @@ export declare interface RowProps<R extends GridRowModel = GridRowModel> {
|
|
|
1901
2214
|
columnIndexMap?: Map<string, number>;
|
|
1902
2215
|
/** 1-based `aria-rowindex` of this row in the whole grid (header rows included). Defaults to `rowIndex + 2`. */
|
|
1903
2216
|
ariaRowIndex?: number;
|
|
2217
|
+
/**
|
|
2218
|
+
* The part of the selected cell range (`cellSelection`) in this row, or `null` / absent when the
|
|
2219
|
+
* row is outside it. @since v3.3
|
|
2220
|
+
*/
|
|
2221
|
+
cellRange?: GridRowCellRange | null;
|
|
1904
2222
|
}
|
|
1905
2223
|
|
|
1906
2224
|
declare interface RowSpanningCaches {
|