@mui/x-data-grid-premium 8.19.0 → 8.21.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 (47) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/DataGridPremium/DataGridPremium.d.ts +1 -1
  3. package/DataGridPremium/DataGridPremium.js +27 -1
  4. package/DataGridPremium/useDataGridPremiumComponent.d.ts +1 -1
  5. package/esm/DataGridPremium/DataGridPremium.d.ts +1 -1
  6. package/esm/DataGridPremium/DataGridPremium.js +27 -1
  7. package/esm/DataGridPremium/useDataGridPremiumComponent.d.ts +1 -1
  8. package/esm/hooks/features/clipboard/useGridClipboardImport.js +6 -0
  9. package/esm/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  10. package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +21 -17
  11. package/esm/hooks/features/rowReorder/operations.d.ts +7 -27
  12. package/esm/hooks/features/rowReorder/operations.js +133 -274
  13. package/esm/hooks/features/rowReorder/rowGroupingReorderExecutor.d.ts +2 -0
  14. package/esm/hooks/features/rowReorder/rowGroupingReorderExecutor.js +3 -0
  15. package/esm/hooks/features/rowReorder/rowGroupingReorderValidator.d.ts +2 -0
  16. package/esm/hooks/features/rowReorder/{reorderValidator.js → rowGroupingReorderValidator.js} +2 -22
  17. package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +3 -3
  18. package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +61 -7
  19. package/esm/index.js +1 -1
  20. package/hooks/features/clipboard/useGridClipboardImport.js +6 -0
  21. package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +1 -1
  22. package/hooks/features/rowGrouping/useGridRowGrouping.js +20 -16
  23. package/hooks/features/rowReorder/operations.d.ts +7 -27
  24. package/hooks/features/rowReorder/operations.js +136 -279
  25. package/hooks/features/rowReorder/rowGroupingReorderExecutor.d.ts +2 -0
  26. package/hooks/features/rowReorder/rowGroupingReorderExecutor.js +9 -0
  27. package/hooks/features/rowReorder/rowGroupingReorderValidator.d.ts +2 -0
  28. package/hooks/features/rowReorder/rowGroupingReorderValidator.js +102 -0
  29. package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +3 -3
  30. package/hooks/features/rows/useGridRowsOverridableMethods.js +61 -7
  31. package/index.js +1 -1
  32. package/package.json +5 -5
  33. package/esm/hooks/features/rowReorder/reorderExecutor.d.ts +0 -15
  34. package/esm/hooks/features/rowReorder/reorderExecutor.js +0 -25
  35. package/esm/hooks/features/rowReorder/reorderValidator.d.ts +0 -16
  36. package/esm/hooks/features/rowReorder/types.d.ts +0 -42
  37. package/esm/hooks/features/rowReorder/types.js +0 -1
  38. package/esm/hooks/features/rowReorder/utils.d.ts +0 -127
  39. package/esm/hooks/features/rowReorder/utils.js +0 -343
  40. package/hooks/features/rowReorder/reorderExecutor.d.ts +0 -15
  41. package/hooks/features/rowReorder/reorderExecutor.js +0 -31
  42. package/hooks/features/rowReorder/reorderValidator.d.ts +0 -16
  43. package/hooks/features/rowReorder/reorderValidator.js +0 -122
  44. package/hooks/features/rowReorder/types.d.ts +0 -42
  45. package/hooks/features/rowReorder/types.js +0 -5
  46. package/hooks/features/rowReorder/utils.d.ts +0 -127
  47. package/hooks/features/rowReorder/utils.js +0 -360
package/CHANGELOG.md CHANGED
@@ -5,6 +5,180 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.21.0
9
+
10
+ _Dec 3, 2025_
11
+
12
+ We'd like to extend a big thank you to the 8 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - ✨ Add [tick spacing property](https://mui.com/x/react-charts/axis/#tick-spacing) to charts axis to control the distance between ticks.
15
+
16
+ The following team members contributed to this release:
17
+ @alexfauquette, @bernardobelchior, @ElliottMiller, @Janpot, @JCQuintas, @romgrk, @sai6855, @siriwatknp
18
+
19
+ ### Data Grid
20
+
21
+ #### `@mui/x-data-grid@8.21.0`
22
+
23
+ - [DataGrid] Fix autosizing header width calculation (#20323) @siriwatknp
24
+ - [DataGrid] Virtualizer refactor (#19465) @romgrk
25
+
26
+ #### `@mui/x-data-grid-pro@8.21.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
27
+
28
+ Same changes as in `@mui/x-data-grid@8.21.0`.
29
+
30
+ #### `@mui/x-data-grid-premium@8.21.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
31
+
32
+ Same changes as in `@mui/x-data-grid-pro@8.21.0`, plus:
33
+
34
+ - [DataGridPremium] Prevent pasting to non-editable cells (#20333) @ElliottMiller
35
+
36
+ ### Date and Time Pickers
37
+
38
+ #### `@mui/x-date-pickers@8.21.0`
39
+
40
+ Internal changes.
41
+
42
+ #### `@mui/x-date-pickers-pro@8.21.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
43
+
44
+ Same changes as in `@mui/x-date-pickers@8.21.0`.
45
+
46
+ ### Charts
47
+
48
+ #### `@mui/x-charts@8.21.0`
49
+
50
+ - [charts] Fix string measuring types (#20454) @bernardobelchior
51
+ - [charts] Fix typo in performance note for CustomLineMarks demo (#20529) @sai6855
52
+ - [charts] Introduce the notion of series with positions (#20461) @alexfauquette
53
+ - [charts] Migrate from sinon to Vitest mocking utilities for x-charts\* packages (#20444) @Copilot
54
+ - [charts] Move series-level values to series computed data in bar plot (#20467) @bernardobelchior
55
+ - [charts] Refactor bar chart components in preparation for range bar chart (#20521) @bernardobelchior
56
+ - [charts] Remove unnecessary `any` types (#20527) @sai6855
57
+ - [charts] Remove unused `drawingArea` from `findClosestPoints` (#20471) @bernardobelchior
58
+ - [charts] Revert `useIsHydrated` to default=false (#20511) @JCQuintas
59
+ - [charts] Support tooltip anchor position for radar (#20422) @alexfauquette
60
+ - [charts] Add tick spacing property (#20282) @bernardobelchior
61
+ - [charts] Fix Vitest lint error (#20550) @bernardobelchior
62
+ - [charts] Fix infinite loop when highlighting pie slices or scatter points (#20549) @bernardobelchior
63
+
64
+ #### `@mui/x-charts-pro@8.21.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
65
+
66
+ Same changes as in `@mui/x-charts@8.21.0`, plus:
67
+
68
+ - [charts-pro] Add support for `anchor="node"` on Sankey tooltip (#20462) @alexfauquette
69
+
70
+ #### `@mui/x-charts-premium@8.21.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
71
+
72
+ Same changes as in `@mui/x-charts-pro@8.21.0`.
73
+
74
+ ### Tree View
75
+
76
+ #### `@mui/x-tree-view@8.21.0`
77
+
78
+ Internal changes.
79
+
80
+ #### `@mui/x-tree-view-pro@8.21.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
81
+
82
+ Same changes as in `@mui/x-tree-view@8.21.0`.
83
+
84
+ ### Codemod
85
+
86
+ #### `@mui/x-codemod@8.21.0`
87
+
88
+ Internal changes.
89
+
90
+ ### Docs
91
+
92
+ - [docs] Migrate to `next/font` for fonts loading (#20407) @Copilot
93
+
94
+ ### Core
95
+
96
+ - [code-infra] Enable vitest eslint plugin (#20530) @Janpot
97
+ - [code-infra] Fix missing font loading for local fonts (#20480) @Janpot
98
+ - [internal] Performance: use raw `useSyncExternalStore` (#20447) @romgrk
99
+ - [code-infra] Enable `vitest/expect-expect` and `vitest/no-standalone-expect` rules for x-charts packages (#20535) @Copilot
100
+
101
+ ### Miscellaneous
102
+
103
+ - Bump @types/d3-sankey to ^0.12.5 (#20489) @renovate[bot]
104
+ - Bump @types/react to 19.2.7 (#20490) @renovate[bot]
105
+ - Bump @types/yargs to ^17.0.35 (#20491) @renovate[bot]
106
+ - Bump Vite & Vitest to ^4.0.14 (#20500) @renovate[bot]
107
+ - Bump csstype to ^3.2.3 (#20493) @renovate[bot]
108
+ - Bump es-toolkit to ^1.42.0 (#20494) @renovate[bot]
109
+ - Bump eslint to ^8.48.0 (#20495) @renovate[bot]
110
+ - Bump lerna to ^9.0.3 (#20496) @renovate[bot]
111
+ - Bump lucide-react to ^0.555.0 (#20502) @renovate[bot]
112
+ - Bump playwright monorepo (#20503) @renovate[bot]
113
+ - Bump pnpm to 10.24.0 (#20504) @renovate[bot]
114
+ - Bump react monorepo (#20340) @renovate[bot]
115
+ - Bump react-hook-form to ^7.66.1 (#20497) @renovate[bot]
116
+ - Bump rimraf to ^6.1.2 (#20498) @renovate[bot]
117
+ - Bump webpack-bundle-analyzer to ^5.0.1 (#20508) @renovate[bot]
118
+ - Bump next to ^15.5.6 [SECURITY] (#20555) @renovate[bot]
119
+
120
+ ## 8.20.0
121
+
122
+ _Nov 26, 2025_
123
+
124
+ We'd like to extend a big thank you to the 8 contributors who made this release possible. Here are some highlights ✨:
125
+
126
+ - 🔃 Data Grid tree data now supports row reordering. See the [Drag-and-drop tree data reordering](https://mui.com/x/react-data-grid/tree-data/#drag-and-drop-tree-data-reordering) section for more details.
127
+ - 🐞 Bugfixes
128
+
129
+ The following team members contributed to this release:
130
+ @alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @siriwatknp, @JCQuintas, @MBilalShafi, @prakhargupta1
131
+
132
+ ### Data Grid
133
+
134
+ #### `@mui/x-data-grid@8.20.0`
135
+
136
+ - [DataGrid] Fix RTL virtualization to display columns when viewport width is larger than the grid (#20409) @siriwatknp
137
+ - [DataGrid] Fix row range selection (#20442) @arminmeh
138
+ - [DataGrid] Initialize data grid core packages (#20276) @cherniavskii
139
+ - [DataGrid] Improve accessibility of the sort icon (#20430) @arminmeh
140
+ - [DataGrid] Use `viewport` as a boundary for the `BasePopper` flip (#20311) @arminmeh
141
+
142
+ #### `@mui/x-data-grid-pro@8.20.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
143
+
144
+ Same changes as in `@mui/x-data-grid@8.20.0`, plus:
145
+
146
+ - [DataGridPro] Avoid automatic scroll back to the focused header filter after it leaves the viewport (#20416) @arminmeh
147
+ - [DataGridPro] Tree data row reordering (#19401) @MBilalShafi
148
+
149
+ #### `@mui/x-data-grid-premium@8.20.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
150
+
151
+ Same changes as in `@mui/x-data-grid-pro@8.20.0`.
152
+
153
+ ### Charts
154
+
155
+ #### `@mui/x-charts@8.20.0`
156
+
157
+ - [charts] Fix item tooltip position with node anchor (#20421) @alexfauquette
158
+ - [charts] Fix radar item tooltip closing bug (#20429) @alexfauquette
159
+ - [charts] Move series processing to selector (#20388) @JCQuintas
160
+ - [charts] Prevent pointer out from removing controlled highlight (#20385) @alexfauquette
161
+
162
+ #### `@mui/x-charts-pro@8.20.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
163
+
164
+ Same changes as in `@mui/x-charts@8.20.0`, plus:
165
+
166
+ - [charts-pro] Fix Content-Security-Policy nonce not being correctly set on export (#20395) @bernardobelchior
167
+ - [charts-pro] Improve vertical zoom slider thumb on mobile (#20439) @bernardobelchior
168
+ - [charts-pro] Provide arguments to the `AreaPlotRoot` styled component (#20414) @arminmeh
169
+ - [charts-pro] Remove grid outside the drawing area (#20412) @alexfauquette
170
+
171
+ #### `@mui/x-charts-premium@8.20.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
172
+
173
+ Same changes as in `@mui/x-charts-pro@8.20.0`, plus:
174
+
175
+ - [charts-premium] Add explicit return type to `ChartsRenderer` for better compatibility with React 18 (#20413) @arminmeh
176
+
177
+ ### Docs
178
+
179
+ - [docs] Add `llms.txt` link to the sidebar (#20312) @siriwatknp
180
+ - [docs] Add a line chart demo for the Overview section (#20239) @prakhargupta1
181
+
8
182
  ## 8.19.0
9
183
 
10
184
  _Nov 20, 2025_
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { GridValidRowModel } from '@mui/x-data-grid-pro';
2
+ import { type GridValidRowModel } from '@mui/x-data-grid-pro';
3
3
  import { DataGridPremiumProps } from "../models/dataGridPremiumProps.js";
4
4
  export type { GridPremiumSlotsComponent as GridSlots } from "../models/index.js";
5
5
  interface DataGridPremiumComponent {
@@ -50,7 +50,7 @@ const configuration = {
50
50
  useGridParamsOverridableMethods: _useGridParamsOverridableMethods.useGridParamsOverridableMethods
51
51
  }
52
52
  };
53
- const releaseInfo = "MTc2MzU5NjgwMDAwMA==";
53
+ const releaseInfo = "MTc2NDgwNjQwMDAwMA==";
54
54
  const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
55
55
  packageName: "x-data-grid-premium",
56
56
  releaseInfo: releaseInfo
@@ -598,12 +598,29 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
598
598
  * @returns {boolean} A boolean indicating if the group is expanded.
599
599
  */
600
600
  isGroupExpandedByDefault: _propTypes.default.func,
601
+ /**
602
+ * Indicates whether a row is reorderable.
603
+ * @param {object} params With all properties from the row.
604
+ * @param {R} params.row The row model of the row that the current cell belongs to.
605
+ * @param {GridTreeNode} params.rowNode The node of the row that the current cell belongs to.
606
+ * @returns {boolean} A boolean indicating if the row is reorderable.
607
+ */
608
+ isRowReorderable: _propTypes.default.func,
601
609
  /**
602
610
  * Determines if a row can be selected.
603
611
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
604
612
  * @returns {boolean} A boolean indicating if the row is selectable.
605
613
  */
606
614
  isRowSelectable: _propTypes.default.func,
615
+ /**
616
+ * Indicates if a row reorder attempt is valid.
617
+ * Can be used to disable certain row reorder operations based on the context.
618
+ * The internal validation is still applied, preventing unsupported use-cases.
619
+ * Use `isValidRowReorder()` to add additional validation rules to the default ones.
620
+ * @param {ReorderValidationContext} context The context object containing all information about the reorder operation.
621
+ * @returns {boolean} A boolean indicating if the reorder operation should go through.
622
+ */
623
+ isValidRowReorder: _propTypes.default.func,
607
624
  /**
608
625
  * If `true`, moving the mouse pointer outside the grid before releasing the mouse button
609
626
  * in a column re-order action will not cause the column to jump back to its original position.
@@ -1274,6 +1291,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
1274
1291
  * @default 80
1275
1292
  */
1276
1293
  scrollEndThreshold: _propTypes.default.number,
1294
+ /**
1295
+ * Updates the tree path in a row model.
1296
+ * Used when reordering rows across different parents in tree data.
1297
+ * @template R
1298
+ * @param {string[]} path The new path for the row.
1299
+ * @param {R} row The row model to update.
1300
+ * @returns {R} The updated row model with the new path.
1301
+ */
1302
+ setTreeDataPath: _propTypes.default.func,
1277
1303
  /**
1278
1304
  * If `true`, vertical borders will be displayed between cells.
1279
1305
  * @default false
@@ -2,4 +2,4 @@ import { RefObject } from '@mui/x-internals/types';
2
2
  import { type GridConfiguration } from '@mui/x-data-grid-pro/internals';
3
3
  import { GridPrivateApiPremium } from "../models/gridApiPremium.js";
4
4
  import { DataGridPremiumProcessedProps } from "../models/dataGridPremiumProps.js";
5
- export declare const useDataGridPremiumComponent: (apiRef: RefObject<GridPrivateApiPremium>, inProps: DataGridPremiumProcessedProps, configuration: GridConfiguration<GridPrivateApiPremium, DataGridPremiumProcessedProps>) => DataGridPremiumProcessedProps;
5
+ export declare const useDataGridPremiumComponent: (apiRef: RefObject<GridPrivateApiPremium>, inProps: DataGridPremiumProcessedProps, configuration: GridConfiguration) => DataGridPremiumProcessedProps;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { GridValidRowModel } from '@mui/x-data-grid-pro';
2
+ import { type GridValidRowModel } from '@mui/x-data-grid-pro';
3
3
  import { DataGridPremiumProps } from "../models/dataGridPremiumProps.js";
4
4
  export type { GridPremiumSlotsComponent as GridSlots } from "../models/index.js";
5
5
  interface DataGridPremiumComponent {
@@ -43,7 +43,7 @@ const configuration = {
43
43
  useGridParamsOverridableMethods
44
44
  }
45
45
  };
46
- const releaseInfo = "MTc2MzU5NjgwMDAwMA==";
46
+ const releaseInfo = "MTc2NDgwNjQwMDAwMA==";
47
47
  const watermark = /*#__PURE__*/_jsx(Watermark, {
48
48
  packageName: "x-data-grid-premium",
49
49
  releaseInfo: releaseInfo
@@ -591,12 +591,29 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
591
591
  * @returns {boolean} A boolean indicating if the group is expanded.
592
592
  */
593
593
  isGroupExpandedByDefault: PropTypes.func,
594
+ /**
595
+ * Indicates whether a row is reorderable.
596
+ * @param {object} params With all properties from the row.
597
+ * @param {R} params.row The row model of the row that the current cell belongs to.
598
+ * @param {GridTreeNode} params.rowNode The node of the row that the current cell belongs to.
599
+ * @returns {boolean} A boolean indicating if the row is reorderable.
600
+ */
601
+ isRowReorderable: PropTypes.func,
594
602
  /**
595
603
  * Determines if a row can be selected.
596
604
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
597
605
  * @returns {boolean} A boolean indicating if the row is selectable.
598
606
  */
599
607
  isRowSelectable: PropTypes.func,
608
+ /**
609
+ * Indicates if a row reorder attempt is valid.
610
+ * Can be used to disable certain row reorder operations based on the context.
611
+ * The internal validation is still applied, preventing unsupported use-cases.
612
+ * Use `isValidRowReorder()` to add additional validation rules to the default ones.
613
+ * @param {ReorderValidationContext} context The context object containing all information about the reorder operation.
614
+ * @returns {boolean} A boolean indicating if the reorder operation should go through.
615
+ */
616
+ isValidRowReorder: PropTypes.func,
600
617
  /**
601
618
  * If `true`, moving the mouse pointer outside the grid before releasing the mouse button
602
619
  * in a column re-order action will not cause the column to jump back to its original position.
@@ -1267,6 +1284,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
1267
1284
  * @default 80
1268
1285
  */
1269
1286
  scrollEndThreshold: PropTypes.number,
1287
+ /**
1288
+ * Updates the tree path in a row model.
1289
+ * Used when reordering rows across different parents in tree data.
1290
+ * @template R
1291
+ * @param {string[]} path The new path for the row.
1292
+ * @param {R} row The row model to update.
1293
+ * @returns {R} The updated row model with the new path.
1294
+ */
1295
+ setTreeDataPath: PropTypes.func,
1270
1296
  /**
1271
1297
  * If `true`, vertical borders will be displayed between cells.
1272
1298
  * @default false
@@ -2,4 +2,4 @@ import { RefObject } from '@mui/x-internals/types';
2
2
  import { type GridConfiguration } from '@mui/x-data-grid-pro/internals';
3
3
  import { GridPrivateApiPremium } from "../models/gridApiPremium.js";
4
4
  import { DataGridPremiumProcessedProps } from "../models/dataGridPremiumProps.js";
5
- export declare const useDataGridPremiumComponent: (apiRef: RefObject<GridPrivateApiPremium>, inProps: DataGridPremiumProcessedProps, configuration: GridConfiguration<GridPrivateApiPremium, DataGridPremiumProcessedProps>) => DataGridPremiumProcessedProps;
5
+ export declare const useDataGridPremiumComponent: (apiRef: RefObject<GridPrivateApiPremium>, inProps: DataGridPremiumProcessedProps, configuration: GridConfiguration) => DataGridPremiumProcessedProps;
@@ -78,6 +78,12 @@ class CellValueUpdater {
78
78
  if (!row) {
79
79
  return;
80
80
  }
81
+
82
+ // Check if the cell is editable using the API method, which respects the isCellEditable prop
83
+ const cellParams = apiRef.current.getCellParams(rowId, field);
84
+ if (!apiRef.current.isCellEditable(cellParams)) {
85
+ return;
86
+ }
81
87
  let parsedValue = pastedCellValue;
82
88
  if (colDef.pastedValueParser) {
83
89
  parsedValue = colDef.pastedValueParser(pastedCellValue, row, colDef, apiRef);
@@ -8,4 +8,4 @@ export declare const rowGroupingStateInitializer: GridStateInitializer<Pick<Data
8
8
  * @requires useGridRows (state, method) - can be after, async only
9
9
  * @requires useGridParamsApi (method) - can be after, async only
10
10
  */
11
- export declare const useGridRowGrouping: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "initialState" | "rowGroupingModel" | "onRowGroupingModelChange" | "isGroupExpandedByDefault" | "rowGroupingColumnMode" | "disableRowGrouping" | "slotProps" | "slots" | "dataSource" | "treeData">) => void;
11
+ export declare const useGridRowGrouping: (apiRef: RefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, "initialState" | "rowGroupingModel" | "onRowGroupingModelChange" | "isGroupExpandedByDefault" | "rowGroupingColumnMode" | "disableRowGrouping" | "slotProps" | "slots" | "dataSource" | "treeData" | "isValidRowReorder">) => void;
@@ -2,11 +2,11 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
- import { useGridEvent, useGridApiMethod, gridColumnLookupSelector, gridRowMaximumTreeDepthSelector, gridRowTreeSelector, gridExpandedSortedRowIdsSelector } from '@mui/x-data-grid-pro';
6
- import { useGridRegisterPipeProcessor, GridStrategyGroup, gridExpandedSortedRowIndexLookupSelector, RowGroupingStrategy } from '@mui/x-data-grid-pro/internals';
5
+ import { useGridEvent, useGridApiMethod, gridColumnLookupSelector, gridRowMaximumTreeDepthSelector, gridRowTreeSelector, gridExpandedSortedRowIdsSelector, gridExpandedSortedRowIndexLookupSelector } from '@mui/x-data-grid-pro';
6
+ import { useGridRegisterPipeProcessor, GridStrategyGroup, RowGroupingStrategy } from '@mui/x-data-grid-pro/internals';
7
7
  import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from "./gridRowGroupingSelector.js";
8
8
  import { getRowGroupingFieldFromGroupingCriteria, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability, getGroupingRules, areGroupingRulesEqual } from "./gridRowGroupingUtils.js";
9
- import { rowGroupingReorderValidator } from "../rowReorder/reorderValidator.js";
9
+ import { rowGroupingReorderValidator } from "../rowReorder/rowGroupingReorderValidator.js";
10
10
  export const rowGroupingStateInitializer = (state, props, apiRef) => {
11
11
  apiRef.current.caches.rowGrouping = {
12
12
  rulesOnLastRowTreeCreation: []
@@ -169,7 +169,8 @@ export const useGridRowGrouping = (apiRef, props) => {
169
169
  }
170
170
  }
171
171
  }, [apiRef, props.disableRowGrouping]);
172
- const getRowReorderTargetIndex = React.useCallback((initialValue, {
172
+ const isValidRowReorderProp = props.isValidRowReorder;
173
+ const isRowReorderValid = React.useCallback((initialValue, {
173
174
  sourceRowId,
174
175
  targetRowId,
175
176
  dropPosition,
@@ -181,7 +182,6 @@ export const useGridRowGrouping = (apiRef, props) => {
181
182
  const expandedSortedRowIndexLookup = gridExpandedSortedRowIndexLookupSelector(apiRef);
182
183
  const expandedSortedRowIds = gridExpandedSortedRowIdsSelector(apiRef);
183
184
  const rowTree = gridRowTreeSelector(apiRef);
184
- const sourceRowIndex = expandedSortedRowIndexLookup[sourceRowId];
185
185
  const targetRowIndex = expandedSortedRowIndexLookup[targetRowId];
186
186
  const sourceNode = rowTree[sourceRowId];
187
187
  const targetNode = rowTree[targetRowId];
@@ -190,30 +190,34 @@ export const useGridRowGrouping = (apiRef, props) => {
190
190
 
191
191
  // Basic validity checks
192
192
  if (!sourceNode || !targetNode) {
193
- return -1;
193
+ return false;
194
194
  }
195
195
 
196
196
  // Create context object
197
197
  const context = {
198
+ apiRef,
198
199
  sourceNode,
199
200
  targetNode,
200
201
  prevNode,
201
202
  nextNode,
202
- rowTree,
203
203
  dropPosition,
204
- dragDirection,
205
- targetRowIndex,
206
- sourceRowIndex,
207
- expandedSortedRowIndexLookup
204
+ dragDirection
208
205
  };
209
206
 
210
- // Check if the reorder is valid
211
- if (rowGroupingReorderValidator.validate(context)) {
212
- return dropPosition === 'below' ? targetRowIndex + 1 : targetRowIndex;
207
+ // First apply internal validation
208
+ let isValid = rowGroupingReorderValidator.validate(context);
209
+
210
+ // If internal validation passes AND user provided additional validation
211
+ if (isValid && isValidRowReorderProp) {
212
+ // Apply additional user restrictions
213
+ isValid = isValidRowReorderProp(context);
214
+ }
215
+ if (isValid) {
216
+ return true;
213
217
  }
214
- return -1;
215
- }, [apiRef, props.treeData]);
216
- useGridRegisterPipeProcessor(apiRef, 'getRowReorderTargetIndex', getRowReorderTargetIndex);
218
+ return false;
219
+ }, [apiRef, props.treeData, isValidRowReorderProp]);
220
+ useGridRegisterPipeProcessor(apiRef, 'isRowReorderValid', isRowReorderValid);
217
221
  useGridEvent(apiRef, 'cellKeyDown', handleCellKeyDown);
218
222
  useGridEvent(apiRef, 'columnsChange', checkGroupingColumnsModelDiff);
219
223
  useGridEvent(apiRef, 'rowGroupingModelChange', checkGroupingColumnsModelDiff);
@@ -1,34 +1,13 @@
1
- import type { ReorderOperation, ReorderExecutionContext } from "./types.js";
2
- /**
3
- * Base class for all reorder operations.
4
- * Provides abstract methods for operation detection and execution.
5
- */
6
- export declare abstract class BaseReorderOperation {
7
- abstract readonly operationType: string;
8
- /**
9
- * Detects if this operation can handle the given context.
10
- */
11
- abstract detectOperation(ctx: ReorderExecutionContext): ReorderOperation | null;
12
- /**
13
- * Executes the detected operation.
14
- */
15
- abstract executeOperation(operation: ReorderOperation, ctx: ReorderExecutionContext): Promise<void> | void;
16
- }
17
- /**
18
- * Handles reordering of items within the same parent group.
19
- */
20
- export declare class SameParentSwapOperation extends BaseReorderOperation {
21
- readonly operationType = "same-parent-swap";
22
- detectOperation(ctx: ReorderExecutionContext): ReorderOperation | null;
23
- executeOperation(operation: ReorderOperation, ctx: ReorderExecutionContext): void;
24
- }
1
+ import { BaseReorderOperation, type ReorderOperation, type ReorderExecutionContext } from '@mui/x-data-grid-pro/internals';
2
+ import { GridPrivateApiPremium } from "../../../models/gridApiPremium.js";
3
+ type ReorderExecutionContextType = ReorderExecutionContext<GridPrivateApiPremium>;
25
4
  /**
26
5
  * Handles moving leaf nodes between different parent groups.
27
6
  */
28
7
  export declare class CrossParentLeafOperation extends BaseReorderOperation {
29
8
  readonly operationType = "cross-parent-leaf";
30
9
  detectOperation(ctx: ReorderExecutionContext): ReorderOperation | null;
31
- executeOperation(operation: ReorderOperation, ctx: ReorderExecutionContext): Promise<void>;
10
+ executeOperation(operation: ReorderOperation, ctx: ReorderExecutionContextType): Promise<void>;
32
11
  }
33
12
  /**
34
13
  * Handles moving entire groups between different parents.
@@ -36,5 +15,6 @@ export declare class CrossParentLeafOperation extends BaseReorderOperation {
36
15
  export declare class CrossParentGroupOperation extends BaseReorderOperation {
37
16
  readonly operationType = "cross-parent-group";
38
17
  detectOperation(ctx: ReorderExecutionContext): ReorderOperation | null;
39
- executeOperation(operation: ReorderOperation, ctx: ReorderExecutionContext): Promise<void>;
40
- }
18
+ executeOperation(operation: ReorderOperation, ctx: ReorderExecutionContextType): Promise<void>;
19
+ }
20
+ export {};