@mui/x-data-grid-premium 8.24.0 → 8.26.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 (68) hide show
  1. package/CHANGELOG.md +196 -6479
  2. package/DataGridPremium/DataGridPremium.js +25 -1
  3. package/DataGridPremium/useDataGridPremiumComponent.js +3 -0
  4. package/DataGridPremium/useDataGridPremiumProps.js +5 -1
  5. package/components/GridAggregationRowOverlay.js +1 -0
  6. package/components/GridEmptyPivotOverlay.js +1 -0
  7. package/components/GridPremiumColumnMenu.js +1 -0
  8. package/components/GridPremiumToolbar.js +55 -3
  9. package/components/columnMenu/menuItems/GridColumnMenuAggregationItem.js +1 -0
  10. package/components/resizablePanel/ResizablePanel.js +1 -0
  11. package/components/resizablePanel/ResizablePanelHandle.js +1 -0
  12. package/esm/DataGridPremium/DataGridPremium.js +25 -1
  13. package/esm/DataGridPremium/useDataGridPremiumComponent.js +3 -0
  14. package/esm/DataGridPremium/useDataGridPremiumProps.js +5 -1
  15. package/esm/components/GridAggregationRowOverlay.js +2 -0
  16. package/esm/components/GridEmptyPivotOverlay.js +2 -0
  17. package/esm/components/GridPremiumColumnMenu.js +2 -0
  18. package/esm/components/GridPremiumToolbar.js +57 -5
  19. package/esm/components/columnMenu/menuItems/GridColumnMenuAggregationItem.js +2 -0
  20. package/esm/components/resizablePanel/ResizablePanel.js +2 -0
  21. package/esm/components/resizablePanel/ResizablePanelHandle.js +2 -0
  22. package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +2 -0
  23. package/esm/hooks/features/clipboard/useGridClipboardImport.js +20 -9
  24. package/esm/hooks/features/history/constants.d.ts +2 -0
  25. package/esm/hooks/features/history/constants.js +1 -0
  26. package/esm/hooks/features/history/defaultHistoryHandlers.d.ts +20 -0
  27. package/esm/hooks/features/history/defaultHistoryHandlers.js +365 -0
  28. package/esm/hooks/features/history/gridHistoryInterfaces.d.ts +95 -0
  29. package/esm/hooks/features/history/gridHistoryInterfaces.js +1 -0
  30. package/esm/hooks/features/history/gridHistorySelectors.d.ts +16 -0
  31. package/esm/hooks/features/history/gridHistorySelectors.js +7 -0
  32. package/esm/hooks/features/history/index.d.ts +3 -0
  33. package/esm/hooks/features/history/index.js +2 -0
  34. package/esm/hooks/features/history/useGridHistory.d.ts +6 -0
  35. package/esm/hooks/features/history/useGridHistory.js +294 -0
  36. package/esm/hooks/features/index.d.ts +2 -1
  37. package/esm/hooks/features/index.js +2 -1
  38. package/esm/hooks/utils/useGridChartIntegration.js +2 -0
  39. package/esm/index.js +1 -1
  40. package/esm/models/dataGridPremiumProps.d.ts +26 -1
  41. package/esm/models/gridApiPremium.d.ts +2 -1
  42. package/esm/models/gridStatePremium.d.ts +2 -0
  43. package/esm/typeOverloads/modules.d.ts +25 -2
  44. package/esm/typeOverloads/modules.js +5 -1
  45. package/hooks/features/aggregation/useGridAggregationPreProcessors.js +1 -0
  46. package/hooks/features/clipboard/useGridClipboardImport.js +20 -9
  47. package/hooks/features/history/constants.d.ts +2 -0
  48. package/hooks/features/history/constants.js +7 -0
  49. package/hooks/features/history/defaultHistoryHandlers.d.ts +20 -0
  50. package/hooks/features/history/defaultHistoryHandlers.js +376 -0
  51. package/hooks/features/history/gridHistoryInterfaces.d.ts +95 -0
  52. package/hooks/features/history/gridHistoryInterfaces.js +5 -0
  53. package/hooks/features/history/gridHistorySelectors.d.ts +16 -0
  54. package/hooks/features/history/gridHistorySelectors.js +13 -0
  55. package/hooks/features/history/index.d.ts +3 -0
  56. package/hooks/features/history/index.js +43 -0
  57. package/hooks/features/history/useGridHistory.d.ts +6 -0
  58. package/hooks/features/history/useGridHistory.js +303 -0
  59. package/hooks/features/index.d.ts +2 -1
  60. package/hooks/features/index.js +11 -0
  61. package/hooks/utils/useGridChartIntegration.js +1 -0
  62. package/index.js +1 -1
  63. package/models/dataGridPremiumProps.d.ts +26 -1
  64. package/models/gridApiPremium.d.ts +2 -1
  65. package/models/gridStatePremium.d.ts +2 -0
  66. package/package.json +5 -5
  67. package/typeOverloads/modules.d.ts +25 -2
  68. package/typeOverloads/modules.js +1 -3
@@ -0,0 +1,365 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
3
+ import { gridVisibleRowsSelector, gridVisibleColumnFieldsSelector, gridColumnFieldsSelector } from '@mui/x-data-grid-pro';
4
+ /**
5
+ * Create the default handler for cellEditStop events.
6
+ */
7
+ export const createCellEditHistoryHandler = apiRef => {
8
+ return {
9
+ store: params => {
10
+ const {
11
+ id,
12
+ field
13
+ } = params;
14
+ const oldValue = apiRef.current.getRow(id)[field];
15
+ const newValue = apiRef.current.getRowWithUpdatedValues(id, field)[field];
16
+ if (isDeepEqual(oldValue, newValue)) {
17
+ return null;
18
+ }
19
+ return {
20
+ id,
21
+ field,
22
+ oldValue,
23
+ newValue
24
+ };
25
+ },
26
+ validate: (data, direction) => {
27
+ const {
28
+ id,
29
+ field,
30
+ oldValue,
31
+ newValue
32
+ } = data;
33
+
34
+ // Check if column is visible
35
+ if (!gridVisibleColumnFieldsSelector(apiRef).includes(field)) {
36
+ return false;
37
+ }
38
+ const {
39
+ rowIdToIndexMap,
40
+ range
41
+ } = gridVisibleRowsSelector(apiRef);
42
+
43
+ // Check if row is in the current page
44
+ const rowIndex = rowIdToIndexMap.get(id);
45
+ if (rowIndex === undefined || rowIndex < (range?.firstRowIndex || 0) || rowIndex > (range?.lastRowIndex || rowIndex)) {
46
+ return false;
47
+ }
48
+ const row = apiRef.current.getRow(id);
49
+
50
+ // Check if the value hasn't changed externally
51
+ const currentValue = row[field];
52
+ const expectedValue = direction === 'undo' ? newValue : oldValue;
53
+ if (!isDeepEqual(currentValue, expectedValue)) {
54
+ return false;
55
+ }
56
+ return true;
57
+ },
58
+ undo: async data => {
59
+ const {
60
+ id,
61
+ field,
62
+ oldValue
63
+ } = data;
64
+ if (apiRef.current.state.props.dataSource?.updateRow) {
65
+ const row = apiRef.current.getRow(id);
66
+ await apiRef.current.dataSource.editRow({
67
+ rowId: id,
68
+ updatedRow: _extends({}, row, {
69
+ [field]: oldValue
70
+ }),
71
+ previousRow: row
72
+ });
73
+ } else {
74
+ apiRef.current.updateRows([{
75
+ id,
76
+ [field]: oldValue
77
+ }]);
78
+ }
79
+
80
+ // Use `requestAnimationFrame` to ensure all undo updates are applied
81
+ requestAnimationFrame(() => {
82
+ apiRef.current.setCellFocus(id, field);
83
+ apiRef.current.scrollToIndexes({
84
+ rowIndex: apiRef.current.getRowIndexRelativeToVisibleRows(id),
85
+ colIndex: apiRef.current.getColumnIndex(field)
86
+ });
87
+ });
88
+ },
89
+ redo: async data => {
90
+ const {
91
+ id,
92
+ field,
93
+ newValue
94
+ } = data;
95
+ if (apiRef.current.state.props.dataSource?.updateRow) {
96
+ const row = apiRef.current.getRow(id);
97
+ await apiRef.current.dataSource.editRow({
98
+ rowId: id,
99
+ updatedRow: _extends({}, row, {
100
+ [field]: newValue
101
+ }),
102
+ previousRow: row
103
+ });
104
+ } else {
105
+ apiRef.current.updateRows([{
106
+ id,
107
+ [field]: newValue
108
+ }]);
109
+ }
110
+
111
+ // Use `requestAnimationFrame` to ensure all redo updates are applied
112
+ requestAnimationFrame(() => {
113
+ apiRef.current.setCellFocus(id, field);
114
+ apiRef.current.scrollToIndexes({
115
+ rowIndex: apiRef.current.getRowIndexRelativeToVisibleRows(id),
116
+ colIndex: apiRef.current.getColumnIndex(field)
117
+ });
118
+ });
119
+ }
120
+ };
121
+ };
122
+
123
+ /**
124
+ * Create the default handler for rowEditStop events.
125
+ */
126
+ export const createRowEditHistoryHandler = apiRef => {
127
+ return {
128
+ store: params => {
129
+ const {
130
+ id
131
+ } = params;
132
+ const oldRow = apiRef.current.getRow(id) || {};
133
+ const newRow = apiRef.current.getRowWithUpdatedValues(id, '');
134
+ if (isDeepEqual(oldRow, newRow)) {
135
+ return null;
136
+ }
137
+ return {
138
+ id,
139
+ oldRow,
140
+ newRow
141
+ };
142
+ },
143
+ validate: (data, direction) => {
144
+ const {
145
+ id,
146
+ oldRow,
147
+ newRow
148
+ } = data;
149
+ const {
150
+ rowIdToIndexMap,
151
+ range
152
+ } = gridVisibleRowsSelector(apiRef);
153
+
154
+ // Check if row is in the current page
155
+ const rowIndex = rowIdToIndexMap.get(id);
156
+ if (rowIndex === undefined || rowIndex < (range?.firstRowIndex || 0) || rowIndex > (range?.lastRowIndex || rowIndex)) {
157
+ return false;
158
+ }
159
+ const row = apiRef.current.getRow(id);
160
+
161
+ // Check if modified fields haven't changed externally
162
+ const expectedRow = direction === 'undo' ? newRow : oldRow;
163
+ for (const field of Object.keys(expectedRow)) {
164
+ if (!isDeepEqual(row[field], expectedRow[field])) {
165
+ return false;
166
+ }
167
+ }
168
+ return true;
169
+ },
170
+ undo: async data => {
171
+ const {
172
+ id,
173
+ oldRow,
174
+ newRow
175
+ } = data;
176
+ if (apiRef.current.state.props.dataSource?.updateRow) {
177
+ await apiRef.current.dataSource.editRow({
178
+ rowId: id,
179
+ updatedRow: oldRow,
180
+ previousRow: newRow
181
+ });
182
+ } else {
183
+ apiRef.current.updateRows([_extends({
184
+ id
185
+ }, oldRow)]);
186
+ }
187
+
188
+ // Use `requestAnimationFrame` to ensure all undo updates are applied
189
+ requestAnimationFrame(() => {
190
+ apiRef.current.setCellFocus(id, Object.keys(oldRow)[0]);
191
+ apiRef.current.scrollToIndexes({
192
+ rowIndex: apiRef.current.getRowIndexRelativeToVisibleRows(id),
193
+ colIndex: 0
194
+ });
195
+ });
196
+ },
197
+ redo: async data => {
198
+ const {
199
+ id,
200
+ oldRow,
201
+ newRow
202
+ } = data;
203
+ if (apiRef.current.state.props.dataSource?.updateRow) {
204
+ await apiRef.current.dataSource.editRow({
205
+ rowId: id,
206
+ updatedRow: newRow,
207
+ previousRow: oldRow
208
+ });
209
+ } else {
210
+ apiRef.current.updateRows([_extends({
211
+ id
212
+ }, newRow)]);
213
+ }
214
+
215
+ // Use `requestAnimationFrame` to ensure all redo updates are applied
216
+ requestAnimationFrame(() => {
217
+ apiRef.current.setCellFocus(id, Object.keys(newRow)[0]);
218
+ apiRef.current.scrollToIndexes({
219
+ rowIndex: apiRef.current.getRowIndexRelativeToVisibleRows(id),
220
+ colIndex: 0
221
+ });
222
+ });
223
+ }
224
+ };
225
+ };
226
+
227
+ /**
228
+ * Create the default handler for clipboardPasteEnd events.
229
+ */
230
+ export const createClipboardPasteHistoryHandler = apiRef => {
231
+ return {
232
+ store: params => params,
233
+ validate: (data, direction) => {
234
+ const {
235
+ oldRows,
236
+ newRows
237
+ } = data;
238
+ const updatedRowIds = Array.from(newRows.keys());
239
+
240
+ // Check if any rows were updated
241
+ if (updatedRowIds.length === 0) {
242
+ return false;
243
+ }
244
+
245
+ // Check if all affected rows are still visible and have expected values
246
+ const {
247
+ rowIdToIndexMap,
248
+ range
249
+ } = gridVisibleRowsSelector(apiRef);
250
+ for (let i = 0; i < updatedRowIds.length; i += 1) {
251
+ const rowId = updatedRowIds[i];
252
+ const rowIndex = rowIdToIndexMap.get(rowId);
253
+ if (rowIndex === undefined || rowIndex < (range?.firstRowIndex || 0) || rowIndex > (range?.lastRowIndex || rowIndex)) {
254
+ return false;
255
+ }
256
+ const row = apiRef.current.getRow(rowId);
257
+ if (!row) {
258
+ return false;
259
+ }
260
+ const expectedRow = direction === 'undo' ? newRows.get(rowId) : oldRows.get(rowId);
261
+
262
+ // Check if the row values match what we expect
263
+ for (const field of Object.keys(expectedRow)) {
264
+ if (!isDeepEqual(row[field], expectedRow[field])) {
265
+ return false;
266
+ }
267
+ }
268
+ }
269
+ return true;
270
+ },
271
+ undo: async data => {
272
+ const {
273
+ oldRows,
274
+ newRows
275
+ } = data;
276
+ const oldRowsValues = Array.from(oldRows.values());
277
+ const visibleColumns = apiRef.current.getVisibleColumns();
278
+
279
+ // Focus the first affected cell
280
+ if (oldRowsValues.length > 0 && visibleColumns.length > 0) {
281
+ const columnOrder = gridColumnFieldsSelector(apiRef);
282
+
283
+ // Since we undo, oldRowData is the new data that will be set and newRowData is the current row
284
+ const firstOldRow = Array.from(newRows.values())[0];
285
+ const [firstNewRowId, firstNewRow] = Array.from(oldRows.entries())[0];
286
+ let differentFieldIndex = columnOrder.length - 1;
287
+ // Find the first field that is different to set the focus on
288
+ for (let i = 0; i < columnOrder.length; i += 1) {
289
+ const field = columnOrder[i];
290
+ if (!isDeepEqual(firstOldRow[field], firstNewRow[field])) {
291
+ differentFieldIndex = i;
292
+ break;
293
+ }
294
+ }
295
+
296
+ // Restore all rows to their original state
297
+ apiRef.current.updateRows(oldRowsValues);
298
+ if (differentFieldIndex >= 0) {
299
+ requestAnimationFrame(() => {
300
+ apiRef.current.setCellFocus(firstNewRowId, columnOrder[differentFieldIndex]);
301
+ apiRef.current.scrollToIndexes({
302
+ rowIndex: apiRef.current.getRowIndexRelativeToVisibleRows(firstNewRowId),
303
+ colIndex: differentFieldIndex
304
+ });
305
+ });
306
+ }
307
+ }
308
+ },
309
+ redo: async data => {
310
+ const {
311
+ oldRows,
312
+ newRows
313
+ } = data;
314
+ const newRowsValues = Array.from(newRows.values());
315
+ const visibleColumns = apiRef.current.getVisibleColumns();
316
+
317
+ // Focus the first affected cell
318
+ if (newRowsValues.length > 0 && visibleColumns.length > 0) {
319
+ const columnOrder = gridColumnFieldsSelector(apiRef);
320
+ const firstOldRow = Array.from(oldRows.values())[0];
321
+ const [firstNewRowId, firstNewRow] = Array.from(newRows.entries())[0];
322
+ let differentFieldIndex = columnOrder.length - 1;
323
+ // Find the first field that is different to set the focus on
324
+ for (let i = 0; i < columnOrder.length; i += 1) {
325
+ const field = columnOrder[i];
326
+ if (!isDeepEqual(firstOldRow[field], firstNewRow[field])) {
327
+ differentFieldIndex = i;
328
+ break;
329
+ }
330
+ }
331
+
332
+ // Restore all rows to the pasted state
333
+ apiRef.current.updateRows(newRowsValues);
334
+ if (differentFieldIndex >= 0) {
335
+ requestAnimationFrame(() => {
336
+ apiRef.current.setCellFocus(firstNewRowId, columnOrder[differentFieldIndex]);
337
+ apiRef.current.scrollToIndexes({
338
+ rowIndex: apiRef.current.getRowIndexRelativeToVisibleRows(firstNewRowId),
339
+ colIndex: differentFieldIndex
340
+ });
341
+ });
342
+ }
343
+ }
344
+ }
345
+ };
346
+ };
347
+
348
+ /**
349
+ * Create the default history events map.
350
+ */
351
+ export const createDefaultHistoryHandlers = (apiRef, props) => {
352
+ const handlers = {};
353
+ const canHaveEditing = props.isCellEditable || props.columns.some(col => col.editable);
354
+ if (!canHaveEditing) {
355
+ return handlers;
356
+ }
357
+ if (!props.dataSource || props.dataSource.updateRow) {
358
+ handlers.cellEditStop = createCellEditHistoryHandler(apiRef);
359
+ handlers.rowEditStop = createRowEditHistoryHandler(apiRef);
360
+ }
361
+ if (!props.dataSource) {
362
+ handlers.clipboardPasteEnd = createClipboardPasteHistoryHandler(apiRef);
363
+ }
364
+ return handlers;
365
+ };
@@ -0,0 +1,95 @@
1
+ import type { GridRowId, GridEvents, GridValidRowModel } from '@mui/x-data-grid-pro';
2
+ /**
3
+ * Handler for a specific grid event
4
+ */
5
+ export interface GridHistoryEventHandler<T = any> {
6
+ /**
7
+ * Store the data to be used for undo/redo operations.
8
+ * @param {any} params The parameters from the original event.
9
+ * @returns {T | null} The data to store in the history stack.
10
+ * Return `null` if the event should not be stored.
11
+ * This can be used to descrease the granularity of the undo steps.
12
+ */
13
+ store: (...params: any[]) => T | null;
14
+ /**
15
+ * Undo the changes made by this event.
16
+ * @param {T} data The stored data.
17
+ * @returns {boolean | Promise<boolean>} True if the operation was successful, false otherwise.
18
+ */
19
+ undo: (data: T) => void | Promise<void>;
20
+ /**
21
+ * Redo the changes made by this event.
22
+ * @param {T} data The stored data.
23
+ * @returns {boolean | Promise<boolean>} True if the operation was successful, false otherwise.
24
+ */
25
+ redo: (data: T) => void | Promise<void>;
26
+ /**
27
+ * Validate if the undo/redo operation can be performed.
28
+ * If validation is not needed, do not provide this method to avoid impacting performance.
29
+ * @param {T} data The stored data.
30
+ * @param {'undo' | 'redo'} operation - The operation to validate.
31
+ * @returns {boolean} True if the operation is valid, false otherwise.
32
+ */
33
+ validate?: (data: T, operation: 'undo' | 'redo') => boolean;
34
+ }
35
+ export interface GridHistoryItem<T = any> {
36
+ eventName: GridEvents;
37
+ data: T;
38
+ }
39
+ export interface GridHistoryState {
40
+ stack: GridHistoryItem[];
41
+ /**
42
+ * The current position in the stack.
43
+ * Points to the last executed action.
44
+ * -1 means no actions have been executed.
45
+ */
46
+ currentPosition: number;
47
+ /**
48
+ * True if the stack size is greater than 0 and there is at least one event handler.
49
+ */
50
+ enabled: boolean;
51
+ }
52
+ export interface GridHistoryApi {
53
+ /**
54
+ * The history API.
55
+ */
56
+ history: {
57
+ /**
58
+ * Undo the last action.
59
+ * @returns {Promise<boolean>} True if the operation was successful, false otherwise.
60
+ */
61
+ undo: () => Promise<boolean>;
62
+ /**
63
+ * Redo the last undone action.
64
+ * @returns {Promise<boolean>} True if the operation was successful, false otherwise.
65
+ */
66
+ redo: () => Promise<boolean>;
67
+ /**
68
+ * Clear the entire history.
69
+ */
70
+ clear: () => void;
71
+ /**
72
+ * @returns {boolean} True if there are undo steps available, false otherwise.
73
+ */
74
+ canUndo: () => boolean;
75
+ /**
76
+ * @returns {boolean} True if there are redo steps available, false otherwise.
77
+ */
78
+ canRedo: () => boolean;
79
+ };
80
+ }
81
+ export interface GridCellEditHistoryData {
82
+ id: GridRowId;
83
+ field: string;
84
+ oldValue: any;
85
+ newValue: any;
86
+ }
87
+ export interface GridRowEditHistoryData {
88
+ id: GridRowId;
89
+ oldRow: GridValidRowModel;
90
+ newRow: GridValidRowModel;
91
+ }
92
+ export interface GridClipboardPasteHistoryData {
93
+ oldRows: Map<GridRowId, GridValidRowModel>;
94
+ newRows: Map<GridRowId, GridValidRowModel>;
95
+ }
@@ -0,0 +1,16 @@
1
+ import type { GridStatePremium } from "../../../models/gridStatePremium.js";
2
+ export declare const gridHistoryEnabledSelector: (args_0: import("react").RefObject<{
3
+ state: GridStatePremium;
4
+ } | null>) => boolean;
5
+ export declare const gridHistoryStackSelector: (args_0: import("react").RefObject<{
6
+ state: GridStatePremium;
7
+ } | null>) => import("./gridHistoryInterfaces.js").GridHistoryItem<any>[];
8
+ export declare const gridHistoryCurrentPositionSelector: (args_0: import("react").RefObject<{
9
+ state: GridStatePremium;
10
+ } | null>) => number;
11
+ export declare const gridHistoryCanUndoSelector: (args_0: import("react").RefObject<{
12
+ state: GridStatePremium;
13
+ } | null>) => boolean;
14
+ export declare const gridHistoryCanRedoSelector: (args_0: import("react").RefObject<{
15
+ state: GridStatePremium;
16
+ } | null>) => boolean;
@@ -0,0 +1,7 @@
1
+ import { createSelector, createRootSelector } from '@mui/x-data-grid-pro/internals';
2
+ const gridHistoryStateSelector = createRootSelector(state => state.history);
3
+ export const gridHistoryEnabledSelector = createSelector(gridHistoryStateSelector, history => history.enabled);
4
+ export const gridHistoryStackSelector = createSelector(gridHistoryStateSelector, history => history.stack);
5
+ export const gridHistoryCurrentPositionSelector = createSelector(gridHistoryStateSelector, history => history.currentPosition);
6
+ export const gridHistoryCanUndoSelector = createSelector(gridHistoryCurrentPositionSelector, currentPosition => currentPosition >= 0);
7
+ export const gridHistoryCanRedoSelector = createSelector(gridHistoryStackSelector, gridHistoryCurrentPositionSelector, (stack, currentPosition) => currentPosition < stack.length - 1);
@@ -0,0 +1,3 @@
1
+ export type { GridHistoryEventHandler } from "./gridHistoryInterfaces.js";
2
+ export { createCellEditHistoryHandler, createRowEditHistoryHandler, createClipboardPasteHistoryHandler } from "./defaultHistoryHandlers.js";
3
+ export { gridHistoryCanUndoSelector, gridHistoryCanRedoSelector, gridHistoryEnabledSelector } from "./gridHistorySelectors.js";
@@ -0,0 +1,2 @@
1
+ export { createCellEditHistoryHandler, createRowEditHistoryHandler, createClipboardPasteHistoryHandler } from "./defaultHistoryHandlers.js";
2
+ export { gridHistoryCanUndoSelector, gridHistoryCanRedoSelector, gridHistoryEnabledSelector } from "./gridHistorySelectors.js";
@@ -0,0 +1,6 @@
1
+ import { RefObject } from '@mui/x-internals/types';
2
+ import { GridStateInitializer } from '@mui/x-data-grid-pro/internals';
3
+ import { GridPrivateApiPremium } from "../../../models/gridApiPremium.js";
4
+ import { DataGridPremiumProcessedProps } from "../../../models/dataGridPremiumProps.js";
5
+ export declare const historyStateInitializer: GridStateInitializer;
6
+ export declare const useGridHistory: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "columns" | "isCellEditable" | "dataSource" | "historyStackSize" | "historyEventHandlers" | "historyValidationEvents" | "onUndo" | "onRedo">) => void;