@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,303 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.useGridHistory = exports.historyStateInitializer = void 0;
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var React = _interopRequireWildcard(require("react"));
12
+ var _isObjectEmpty = require("@mui/x-internals/isObjectEmpty");
13
+ var _debounce = _interopRequireDefault(require("@mui/utils/debounce"));
14
+ var _internals = require("@mui/x-data-grid-pro/internals");
15
+ var _gridHistorySelectors = require("./gridHistorySelectors");
16
+ var _defaultHistoryHandlers = require("./defaultHistoryHandlers");
17
+ const historyStateInitializer = state => {
18
+ return (0, _extends2.default)({}, state, {
19
+ history: {
20
+ stack: [],
21
+ currentPosition: -1,
22
+ enabled: false
23
+ }
24
+ });
25
+ };
26
+ exports.historyStateInitializer = historyStateInitializer;
27
+ const useGridHistory = (apiRef, props) => {
28
+ const {
29
+ historyStackSize,
30
+ onUndo,
31
+ onRedo,
32
+ historyValidationEvents
33
+ } = props;
34
+
35
+ // Use default history events if none provided
36
+ const historyEventHandlers = React.useMemo(() => {
37
+ if (props.historyEventHandlers && !(0, _isObjectEmpty.isObjectEmpty)(props.historyEventHandlers)) {
38
+ return props.historyEventHandlers;
39
+ }
40
+ return (0, _defaultHistoryHandlers.createDefaultHistoryHandlers)(apiRef, {
41
+ dataSource: props.dataSource,
42
+ columns: props.columns,
43
+ isCellEditable: props.isCellEditable
44
+ });
45
+ }, [apiRef, props.columns, props.isCellEditable, props.dataSource, props.historyEventHandlers]);
46
+ const isEnabled = React.useMemo(() => historyStackSize > 0 && !(0, _isObjectEmpty.isObjectEmpty)(historyEventHandlers), [historyStackSize, historyEventHandlers]);
47
+ const isValidationNeeded = React.useMemo(() => isEnabled && historyValidationEvents.length > 0 && Object.values(historyEventHandlers).some(handler => handler.validate), [isEnabled, historyEventHandlers, historyValidationEvents]);
48
+
49
+ // Internal ref to track undo/redo operation state
50
+ // - 'idle': everything is done
51
+ // - 'in-progress': during async undo/redo handler execution (skip validation and prevent the state change by other events)
52
+ // - 'waiting-replay': after undo/redo handler is done, the validation event is triggered again (as undo/redo is changing the state).
53
+ // In this hook we want to skip the replayed event.
54
+ const operationStateRef = React.useRef('idle');
55
+
56
+ // History event unsubscribers
57
+ const eventUnsubscribersRef = React.useRef([]);
58
+ // Validation event unsubscribers
59
+ const validationEventUnsubscribersRef = React.useRef([]);
60
+ const updateHistoryState = React.useCallback(newState => {
61
+ apiRef.current.setState(state => (0, _extends2.default)({}, state, {
62
+ history: (0, _extends2.default)({}, state.history, newState)
63
+ }));
64
+ }, [apiRef]);
65
+ const addToStack = React.useCallback(item => {
66
+ const currentPosition = (0, _gridHistorySelectors.gridHistoryCurrentPositionSelector)(apiRef);
67
+ let newStack = [...(0, _gridHistorySelectors.gridHistoryStackSelector)(apiRef)];
68
+
69
+ // If we're not at the end of the stack, truncate forward history
70
+ if (currentPosition < newStack.length - 1) {
71
+ newStack = newStack.slice(0, currentPosition + 1);
72
+ }
73
+
74
+ // Add the new item
75
+ newStack.push(item);
76
+
77
+ // If stack exceeds size, remove oldest items
78
+ if (newStack.length > historyStackSize) {
79
+ newStack = newStack.slice(newStack.length - historyStackSize);
80
+ }
81
+ updateHistoryState({
82
+ stack: newStack,
83
+ currentPosition: newStack.length - 1
84
+ });
85
+ }, [apiRef, updateHistoryState, historyStackSize]);
86
+ const clear = React.useCallback(() => {
87
+ updateHistoryState({
88
+ stack: [],
89
+ currentPosition: -1
90
+ });
91
+ }, [updateHistoryState]);
92
+ const clearUndoItems = React.useCallback(() => {
93
+ const stack = (0, _gridHistorySelectors.gridHistoryStackSelector)(apiRef);
94
+ const currentPosition = (0, _gridHistorySelectors.gridHistoryCurrentPositionSelector)(apiRef);
95
+
96
+ // If we're at the end of the stack (no redo items), clear everything
97
+ if (currentPosition >= stack.length - 1) {
98
+ clear();
99
+ } else {
100
+ updateHistoryState({
101
+ stack: stack.slice(currentPosition + 1),
102
+ currentPosition: -1
103
+ });
104
+ }
105
+ }, [apiRef, clear, updateHistoryState]);
106
+ const clearRedoItems = React.useCallback(() => {
107
+ const stack = (0, _gridHistorySelectors.gridHistoryStackSelector)(apiRef);
108
+ const currentPosition = (0, _gridHistorySelectors.gridHistoryCurrentPositionSelector)(apiRef);
109
+ updateHistoryState({
110
+ stack: stack.slice(0, currentPosition + 1)
111
+ });
112
+ }, [apiRef, updateHistoryState]);
113
+ const canUndo = React.useCallback(() => (0, _gridHistorySelectors.gridHistoryCanUndoSelector)(apiRef), [apiRef]);
114
+ const canRedo = React.useCallback(() => (0, _gridHistorySelectors.gridHistoryCanRedoSelector)(apiRef), [apiRef]);
115
+ const validateStackItems = React.useCallback(() => {
116
+ /**
117
+ * When:
118
+ * - idle: continue with the validation
119
+ * - in-progress: skip the validation and don't change the state
120
+ * - waiting-replay: skip the validation this time and reset the state to idle
121
+ */
122
+ if (operationStateRef.current !== 'idle') {
123
+ if (operationStateRef.current === 'waiting-replay') {
124
+ operationStateRef.current = 'idle';
125
+ }
126
+ return;
127
+ }
128
+ const stack = (0, _gridHistorySelectors.gridHistoryStackSelector)(apiRef);
129
+ const currentPosition = (0, _gridHistorySelectors.gridHistoryCurrentPositionSelector)(apiRef);
130
+ if (historyStackSize === 0) {
131
+ if (stack.length > 0) {
132
+ clear();
133
+ }
134
+ return;
135
+ }
136
+ if (stack.length === 0) {
137
+ return;
138
+ }
139
+ const newStack = [...stack];
140
+
141
+ // Redo check
142
+ if (currentPosition + 1 < newStack.length) {
143
+ const item = newStack[currentPosition + 1];
144
+ const handler = historyEventHandlers[item.eventName];
145
+ if (!handler) {
146
+ clearRedoItems();
147
+ } else {
148
+ const isValid = handler.validate ? handler.validate(item.data, 'redo') : true;
149
+ if (!isValid) {
150
+ clearRedoItems();
151
+ }
152
+ }
153
+ }
154
+
155
+ // Undo check
156
+ if (currentPosition >= 0) {
157
+ const item = newStack[currentPosition];
158
+ const handler = historyEventHandlers[item.eventName];
159
+ if (!handler) {
160
+ clearUndoItems();
161
+ } else {
162
+ const isValid = handler.validate ? handler.validate(item.data, 'undo') : true;
163
+ if (!isValid) {
164
+ clearUndoItems();
165
+ }
166
+ }
167
+ }
168
+ }, [apiRef, historyEventHandlers, historyStackSize, clear, clearUndoItems, clearRedoItems]);
169
+ const debouncedValidateStackItems = React.useMemo(() => (0, _debounce.default)(validateStackItems, 0), [validateStackItems]);
170
+ const apply = React.useCallback(async (item, operation) => {
171
+ const currentPosition = (0, _gridHistorySelectors.gridHistoryCurrentPositionSelector)(apiRef);
172
+ const clearMethod = operation === 'undo' ? clearUndoItems : clearRedoItems;
173
+ const {
174
+ eventName,
175
+ data
176
+ } = item;
177
+ const handler = historyEventHandlers[eventName];
178
+ if (!handler) {
179
+ // If the handler is not found, it means tha we are updating the handlers map, so we can igore this request
180
+ return false;
181
+ }
182
+ const isValid = handler.validate ? handler.validate(data, operation) : true;
183
+
184
+ // The data is validated every time state change event happens.
185
+ // We can get into a situation where the operation is not valid at this point only with the direct state updates.
186
+ if (!isValid) {
187
+ // Clear history and return false
188
+ clearMethod();
189
+ return false;
190
+ }
191
+
192
+ // Execute the operation
193
+ operationStateRef.current = 'in-progress';
194
+ await handler[operation](data);
195
+ operationStateRef.current = 'waiting-replay';
196
+ updateHistoryState({
197
+ currentPosition: operation === 'undo' ? currentPosition - 1 : currentPosition + 1
198
+ });
199
+ apiRef.current.publishEvent(operation, {
200
+ eventName,
201
+ data
202
+ });
203
+ // If there are no validations in the current setup, skip calling it and change the operation state to idle
204
+ if (isValidationNeeded) {
205
+ validateStackItems();
206
+ } else {
207
+ operationStateRef.current = 'idle';
208
+ }
209
+ return true;
210
+ }, [apiRef, isValidationNeeded, historyEventHandlers, clearUndoItems, clearRedoItems, updateHistoryState, validateStackItems]);
211
+ const undo = React.useCallback(async () => {
212
+ if (!canUndo()) {
213
+ return false;
214
+ }
215
+ const stack = (0, _gridHistorySelectors.gridHistoryStackSelector)(apiRef);
216
+ const currentPosition = (0, _gridHistorySelectors.gridHistoryCurrentPositionSelector)(apiRef);
217
+ return apply(stack[currentPosition], 'undo');
218
+ }, [apiRef, apply, canUndo]);
219
+ const redo = React.useCallback(async () => {
220
+ if (!canRedo()) {
221
+ return false;
222
+ }
223
+ const stack = (0, _gridHistorySelectors.gridHistoryStackSelector)(apiRef);
224
+ const currentPosition = (0, _gridHistorySelectors.gridHistoryCurrentPositionSelector)(apiRef);
225
+ return apply(stack[currentPosition + 1], 'redo');
226
+ }, [apiRef, apply, canRedo]);
227
+ const historyApi = {
228
+ undo,
229
+ redo,
230
+ clear,
231
+ canUndo,
232
+ canRedo
233
+ };
234
+ (0, _internals.useGridApiMethod)(apiRef, {
235
+ history: historyApi
236
+ }, 'public');
237
+ const handleKeyDown = React.useCallback(async event => {
238
+ if (!(0, _internals.isUndoShortcut)(event) && !(0, _internals.isRedoShortcut)(event)) {
239
+ return;
240
+ }
241
+ const action = (0, _internals.isUndoShortcut)(event) ? apiRef.current.history.undo : apiRef.current.history.redo;
242
+ event.preventDefault();
243
+ event.stopPropagation();
244
+ await action();
245
+ }, [apiRef]);
246
+ (0, _internals.useGridNativeEventListener)(apiRef, () => apiRef.current.rootElementRef.current, 'keydown', (0, _internals.runIf)(isEnabled, handleKeyDown));
247
+ (0, _internals.useGridEvent)(apiRef, 'undo', onUndo);
248
+ (0, _internals.useGridEvent)(apiRef, 'redo', onRedo);
249
+ React.useEffect(() => {
250
+ updateHistoryState({
251
+ enabled: isEnabled
252
+ });
253
+ }, [isEnabled, updateHistoryState]);
254
+ React.useEffect(() => {
255
+ if (!isValidationNeeded) {
256
+ return () => {};
257
+ }
258
+ historyValidationEvents.forEach(eventName => {
259
+ validationEventUnsubscribersRef.current.push(apiRef.current.subscribeEvent(eventName, debouncedValidateStackItems));
260
+ });
261
+ return () => {
262
+ validationEventUnsubscribersRef.current.forEach(unsubscribe => unsubscribe());
263
+ validationEventUnsubscribersRef.current = [];
264
+ };
265
+ }, [apiRef, isValidationNeeded, historyValidationEvents, debouncedValidateStackItems]);
266
+ React.useEffect(() => {
267
+ if (historyStackSize === 0) {
268
+ return () => {};
269
+ }
270
+ const events = Object.keys(historyEventHandlers);
271
+ // Subscribe to all events in the map
272
+ events.forEach(eventName => {
273
+ const handler = historyEventHandlers[eventName];
274
+ const unsubscribe = apiRef.current.subscribeEvent(eventName, (...params) => {
275
+ // Don't store if the event was triggered by undo/redo
276
+ if (operationStateRef.current !== 'idle') {
277
+ return;
278
+ }
279
+ const data = handler.store(...params);
280
+ if (data !== null) {
281
+ addToStack({
282
+ eventName,
283
+ data
284
+ });
285
+ }
286
+ });
287
+ eventUnsubscribersRef.current.push(unsubscribe);
288
+ });
289
+ return () => {
290
+ eventUnsubscribersRef.current.forEach(unsubscribe => unsubscribe());
291
+ eventUnsubscribersRef.current = [];
292
+ };
293
+ }, [apiRef, historyEventHandlers, historyStackSize, addToStack]);
294
+
295
+ // If the stack size is changed and it is smaller than the current stack size, clear the stack
296
+ React.useEffect(() => {
297
+ const currentStackSize = (0, _gridHistorySelectors.gridHistoryStackSelector)(apiRef).length;
298
+ if (currentStackSize > historyStackSize) {
299
+ clear();
300
+ }
301
+ }, [apiRef, historyStackSize, clear]);
302
+ };
303
+ exports.useGridHistory = useGridHistory;
@@ -4,4 +4,5 @@ export * from "./export/index.js";
4
4
  export * from "./cellSelection/index.js";
5
5
  export * from "./aiAssistant/index.js";
6
6
  export * from "./sidebar/index.js";
7
- export * from "./pivoting/index.js";
7
+ export * from "./pivoting/index.js";
8
+ export * from "./history/index.js";
@@ -79,4 +79,15 @@ Object.keys(_pivoting).forEach(function (key) {
79
79
  return _pivoting[key];
80
80
  }
81
81
  });
82
+ });
83
+ var _history = require("./history");
84
+ Object.keys(_history).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _history[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _history[key];
91
+ }
92
+ });
82
93
  });
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-premium v8.24.0
2
+ * @mui/x-data-grid-premium v8.26.0
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
@@ -1,5 +1,5 @@
1
1
  import { RefObject } from '@mui/x-internals/types';
2
- import { GridCallbackDetails, GridValidRowModel, GridGroupNode, GridEventListener, GridGetRowsError, GridUpdateRowError, type GridColDef, GridLocaleTextApi } from '@mui/x-data-grid-pro';
2
+ import { GridCallbackDetails, GridValidRowModel, GridGroupNode, GridEventListener, GridGetRowsError, GridUpdateRowError, type GridColDef, GridLocaleTextApi, type GridEvents } from '@mui/x-data-grid-pro';
3
3
  import { GridExperimentalProFeatures, DataGridProPropsWithDefaultValue, DataGridProPropsWithoutDefaultValue, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, DataGridPremiumSharedPropsWithDefaultValue } from '@mui/x-data-grid-pro/internals';
4
4
  import type { GridRowGroupingModel } from "../hooks/features/rowGrouping/index.js";
5
5
  import type { GridAggregationModel, GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationPosition } from "../hooks/features/aggregation/index.js";
@@ -11,6 +11,7 @@ import { GridCellSelectionModel } from "../hooks/features/cellSelection/index.js
11
11
  import type { GridPivotingColDefOverrides, PivotingColDefCallback, GridPivotModel } from "../hooks/features/pivoting/gridPivotingInterfaces.js";
12
12
  import { GridDataSourcePremium as GridDataSource, GridGetRowsParamsPremium as GridGetRowsParams } from "../hooks/features/dataSource/models.js";
13
13
  import { Conversation, PromptResponse, PromptSuggestion } from "../hooks/features/aiAssistant/gridAiAssistantInterfaces.js";
14
+ import type { GridHistoryEventHandler } from "../hooks/features/history/gridHistoryInterfaces.js";
14
15
  export interface GridExperimentalPremiumFeatures extends GridExperimentalProFeatures {
15
16
  charts?: boolean;
16
17
  }
@@ -101,6 +102,22 @@ export interface DataGridPremiumPropsWithDefaultValue<R extends GridValidRowMode
101
102
  * @default false
102
103
  */
103
104
  chartsIntegration: boolean;
105
+ /**
106
+ * The maximum size of the history stack.
107
+ * Set to 0 to disable the undo/redo feature.
108
+ * @default 30
109
+ */
110
+ historyStackSize: number;
111
+ /**
112
+ * Map of grid events to their undo/redo handlers.
113
+ * @default Handlers for `rowEditStop`, `cellEditStop` and `clipboardPasteEnd` events
114
+ */
115
+ historyEventHandlers: Record<GridEvents, GridHistoryEventHandler<any>>;
116
+ /**
117
+ * List of grid events after which the history stack items should be re-validated.
118
+ * @default ['columnsChange', 'rowsSet', 'sortedRowsSet', 'filteredRowsSet', 'paginationModelChange']
119
+ */
120
+ historyValidationEvents: GridEvents[];
104
121
  }
105
122
  export interface DataGridPremiumPropsWithoutDefaultValue<R extends GridValidRowModel = any> extends Omit<DataGridProPropsWithoutDefaultValue<R>, 'initialState' | 'apiRef' | 'dataSource' | 'onDataSourceError'> {
106
123
  /**
@@ -292,4 +309,12 @@ export interface DataGridPremiumPropsWithoutDefaultValue<R extends GridValidRowM
292
309
  * @param {string} activeChartId The new active chart id.
293
310
  */
294
311
  onActiveChartIdChange?: (activeChartId: string) => void;
312
+ /**
313
+ * Callback fired when an undo operation is executed.
314
+ */
315
+ onUndo?: GridEventListener<'undo'>;
316
+ /**
317
+ * Callback fired when a redo operation is executed.
318
+ */
319
+ onRedo?: GridEventListener<'redo'>;
295
320
  }
@@ -11,9 +11,10 @@ import type { GridPivotingApi, GridPivotingPrivateApi } from "../hooks/features/
11
11
  import { GridAiAssistantApi } from "../hooks/features/aiAssistant/gridAiAssistantInterfaces.js";
12
12
  import { GridSidebarApi } from "../hooks/features/sidebar/gridSidebarInterfaces.js";
13
13
  import { GridChartsIntegrationApi, GridChartsIntegrationPrivateApi } from "../hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.js";
14
+ import type { GridHistoryApi } from "../hooks/features/history/gridHistoryInterfaces.js";
14
15
  /**
15
16
  * The api of Data Grid Premium.
16
17
  * TODO: Do not redefine manually the pro features
17
18
  */
18
- export interface GridApiPremium extends GridApiCommon<GridStatePremium, GridInitialStatePremium>, GridRowProApi, GridColumnPinningApi, GridDetailPanelApi, GridRowGroupingApi, GridExcelExportApi, GridAggregationApi, GridRowPinningApi, GridDataSourceApiPremium, GridCellSelectionApi, GridPivotingApi, GridAiAssistantApi, GridSidebarApi, GridChartsIntegrationApi, GridRowMultiSelectionApi, GridColumnReorderApi {}
19
+ export interface GridApiPremium extends GridApiCommon<GridStatePremium, GridInitialStatePremium>, GridRowProApi, GridColumnPinningApi, GridDetailPanelApi, GridRowGroupingApi, GridExcelExportApi, GridAggregationApi, GridRowPinningApi, GridDataSourceApiPremium, GridCellSelectionApi, GridPivotingApi, GridAiAssistantApi, GridSidebarApi, GridChartsIntegrationApi, GridHistoryApi, GridRowMultiSelectionApi, GridColumnReorderApi {}
19
20
  export interface GridPrivateApiPremium extends GridApiPremium, GridPrivateOnlyApiCommon<GridApiPremium, GridPrivateApiPremium, DataGridPremiumProcessedProps>, GridDataSourcePremiumPrivateApi, GridAggregationPrivateApi, GridDetailPanelPrivateApi, GridRowReorderPrivateApi, GridPivotingPrivateApi, GridChartsIntegrationPrivateApi {}
@@ -4,6 +4,7 @@ import type { GridPivotingInitialState, GridPivotingState } from "../hooks/featu
4
4
  import type { GridAiAssistantInitialState, GridAiAssistantState } from "../hooks/features/aiAssistant/gridAiAssistantInterfaces.js";
5
5
  import type { GridSidebarInitialState, GridSidebarState } from "../hooks/features/sidebar/gridSidebarState.js";
6
6
  import type { GridChartsIntegrationState, GridChartsIntegrationInitialState } from "../hooks/features/chartsIntegration/gridChartsIntegrationInterfaces.js";
7
+ import type { GridHistoryState } from "../hooks/features/history/gridHistoryInterfaces.js";
7
8
  /**
8
9
  * The state of Data Grid Premium.
9
10
  */
@@ -15,6 +16,7 @@ export interface GridStatePremium extends GridStatePro {
15
16
  aiAssistant: GridAiAssistantState;
16
17
  sidebar: GridSidebarState;
17
18
  chartsIntegration: GridChartsIntegrationState;
19
+ history: GridHistoryState;
18
20
  }
19
21
  /**
20
22
  * The initial state of Data Grid Premium.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-premium",
3
- "version": "8.24.0",
3
+ "version": "8.26.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The Premium plan edition of the MUI X Data Grid Components.",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -38,10 +38,10 @@
38
38
  "@mui/x-internal-exceljs-fork": "4.4.3",
39
39
  "clsx": "^2.1.1",
40
40
  "prop-types": "^15.8.1",
41
- "@mui/x-data-grid": "8.24.0",
42
- "@mui/x-data-grid-pro": "8.24.0",
43
- "@mui/x-license": "8.24.0",
44
- "@mui/x-internals": "8.24.0"
41
+ "@mui/x-data-grid": "8.26.0",
42
+ "@mui/x-internals": "8.26.0",
43
+ "@mui/x-data-grid-pro": "8.26.0",
44
+ "@mui/x-license": "8.26.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@emotion/react": "^11.9.0",
@@ -1,4 +1,4 @@
1
- import type { GridExportDisplayOptions, GridValidRowModel } from '@mui/x-data-grid-pro';
1
+ import { GridEventLookup, GridExportDisplayOptions, GridRowId, GridValidRowModel } from '@mui/x-data-grid-pro';
2
2
  import type { GridAggregationCellMeta } from '@mui/x-data-grid-pro/internals';
3
3
  import type { GridPipeProcessingLookupPro, GridControlledStateEventLookupPro, GridApiCachesPro, GridEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
4
4
  import type { GridGroupingValueGetter, GridGroupingValueSetter, GridPastedValueParser } from "../models/index.js";
@@ -79,7 +79,12 @@ interface GridEventLookupPremium extends GridEventLookupPro {
79
79
  /**
80
80
  * Fired when the clipboard paste operation ends.
81
81
  */
82
- clipboardPasteEnd: {};
82
+ clipboardPasteEnd: {
83
+ params: {
84
+ oldRows: Map<GridRowId, GridValidRowModel>;
85
+ newRows: Map<GridRowId, GridValidRowModel>;
86
+ };
87
+ };
83
88
  /**
84
89
  * Fired when the sidebar is opened.
85
90
  */
@@ -105,6 +110,24 @@ interface GridEventLookupPremium extends GridEventLookupPro {
105
110
  synced: boolean;
106
111
  };
107
112
  };
113
+ /**
114
+ * Fired when an undo operation is executed.
115
+ */
116
+ undo: {
117
+ params: {
118
+ eventName: keyof GridEventLookup;
119
+ data: any;
120
+ };
121
+ };
122
+ /**
123
+ * Fired when a redo operation is executed.
124
+ */
125
+ redo: {
126
+ params: {
127
+ eventName: keyof GridEventLookup;
128
+ data: any;
129
+ };
130
+ };
108
131
  }
109
132
  export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
110
133
  /**
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
3
+ var _xDataGridPro = require("@mui/x-data-grid-pro");