@mui/x-data-grid 8.18.0 → 8.20.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 (162) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/DataGrid/useDataGridComponent.js +4 -3
  3. package/components/GridRow.js +5 -2
  4. package/components/GridRowDragAndDropOverlay.d.ts +7 -0
  5. package/components/GridRowDragAndDropOverlay.js +73 -0
  6. package/components/cell/GridActionsCell.d.ts +9 -0
  7. package/components/cell/GridActionsCell.js +54 -34
  8. package/components/cell/GridBooleanCell.js +0 -10
  9. package/components/cell/GridCell.js +4 -10
  10. package/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  11. package/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  12. package/components/containers/GridRootStyles.js +17 -40
  13. package/components/toolbarV8/Toolbar.js +1 -1
  14. package/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  15. package/components/virtualization/GridVirtualScrollbar.js +13 -8
  16. package/components/virtualization/GridVirtualScroller.js +2 -1
  17. package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  18. package/constants/dataGridPropsDefaultValues.js +2 -1
  19. package/constants/gridClasses.d.ts +0 -8
  20. package/constants/gridClasses.js +1 -1
  21. package/esm/DataGrid/useDataGridComponent.js +5 -4
  22. package/esm/components/GridRow.js +5 -2
  23. package/esm/components/GridRowDragAndDropOverlay.d.ts +7 -0
  24. package/esm/components/GridRowDragAndDropOverlay.js +66 -0
  25. package/esm/components/cell/GridActionsCell.d.ts +9 -0
  26. package/esm/components/cell/GridActionsCell.js +55 -34
  27. package/esm/components/cell/GridBooleanCell.js +0 -10
  28. package/esm/components/cell/GridCell.js +4 -10
  29. package/esm/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  30. package/esm/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  31. package/esm/components/containers/GridRootStyles.js +17 -40
  32. package/esm/components/toolbarV8/Toolbar.js +1 -1
  33. package/esm/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  34. package/esm/components/virtualization/GridVirtualScrollbar.js +12 -7
  35. package/esm/components/virtualization/GridVirtualScroller.js +2 -1
  36. package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  37. package/esm/constants/dataGridPropsDefaultValues.js +2 -1
  38. package/esm/constants/gridClasses.d.ts +0 -8
  39. package/esm/constants/gridClasses.js +1 -1
  40. package/esm/hooks/core/gridPropsSelectors.d.ts +2 -1
  41. package/esm/hooks/core/gridPropsSelectors.js +3 -0
  42. package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
  43. package/esm/hooks/core/useGridProps.js +8 -2
  44. package/esm/hooks/core/useGridVirtualizer.d.ts +80 -6
  45. package/esm/hooks/core/useGridVirtualizer.js +27 -12
  46. package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  47. package/esm/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  48. package/esm/hooks/features/columns/useGridColumnSpanning.js +9 -4
  49. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
  50. package/esm/hooks/features/dimensions/useGridDimensions.js +12 -6
  51. package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
  52. package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
  53. package/esm/hooks/features/export/serializers/csvSerializer.js +2 -4
  54. package/esm/hooks/features/export/useGridPrintExport.js +18 -18
  55. package/esm/hooks/features/filter/gridFilterUtils.js +5 -11
  56. package/esm/hooks/features/filter/index.d.ts +1 -1
  57. package/esm/hooks/features/filter/index.js +1 -1
  58. package/esm/hooks/features/filter/useGridFilter.d.ts +1 -1
  59. package/esm/hooks/features/filter/useGridFilter.js +3 -1
  60. package/esm/hooks/features/focus/useGridFocus.js +0 -1
  61. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  62. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  63. package/esm/hooks/features/pagination/useGridPaginationMeta.js +3 -3
  64. package/esm/hooks/features/pagination/useGridPaginationModel.js +7 -4
  65. package/esm/hooks/features/pagination/useGridRowCount.js +31 -15
  66. package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
  67. package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
  68. package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +19 -1
  69. package/esm/hooks/features/rowSelection/useGridRowSelection.js +17 -8
  70. package/esm/hooks/features/rowSelection/utils.d.ts +1 -0
  71. package/esm/hooks/features/rowSelection/utils.js +17 -4
  72. package/esm/hooks/features/rows/useGridRowSpanning.js +23 -60
  73. package/esm/hooks/features/rows/useGridRows.js +3 -1
  74. package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
  75. package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
  76. package/esm/hooks/features/scroll/useGridScroll.js +2 -3
  77. package/esm/hooks/features/sorting/gridSortingUtils.js +1 -3
  78. package/esm/hooks/features/sorting/useGridSorting.d.ts +1 -1
  79. package/esm/hooks/features/sorting/useGridSorting.js +3 -1
  80. package/esm/hooks/features/virtualization/useGridVirtualization.js +24 -5
  81. package/esm/hooks/utils/useGridEvent.js +6 -2
  82. package/esm/hooks/utils/useGridSelector.js +2 -4
  83. package/esm/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  84. package/esm/hooks/utils/useRunOncePerLoop.js +28 -18
  85. package/esm/index.js +1 -1
  86. package/esm/internals/index.d.ts +5 -4
  87. package/esm/internals/index.js +3 -3
  88. package/esm/material/index.js +1 -4
  89. package/esm/models/api/gridRowApi.d.ts +14 -1
  90. package/esm/models/api/index.d.ts +1 -1
  91. package/esm/models/api/index.js +0 -1
  92. package/esm/models/colDef/gridColDef.d.ts +14 -0
  93. package/esm/models/configuration/gridConfiguration.d.ts +2 -2
  94. package/esm/models/configuration/gridRowConfiguration.d.ts +6 -5
  95. package/esm/models/events/gridEventLookup.d.ts +5 -0
  96. package/esm/models/gridStateCommunity.d.ts +1 -1
  97. package/esm/models/params/gridCellParams.d.ts +0 -10
  98. package/esm/models/props/DataGridProps.d.ts +13 -6
  99. package/esm/utils/keyboardUtils.d.ts +1 -8
  100. package/esm/utils/keyboardUtils.js +0 -7
  101. package/hooks/core/gridPropsSelectors.d.ts +2 -1
  102. package/hooks/core/gridPropsSelectors.js +4 -1
  103. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
  104. package/hooks/core/useGridProps.js +8 -2
  105. package/hooks/core/useGridVirtualizer.d.ts +80 -6
  106. package/hooks/core/useGridVirtualizer.js +26 -11
  107. package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  108. package/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  109. package/hooks/features/columns/useGridColumnSpanning.js +9 -4
  110. package/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
  111. package/hooks/features/dimensions/useGridDimensions.js +12 -6
  112. package/hooks/features/editing/useGridCellEditing.js +1 -1
  113. package/hooks/features/editing/useGridRowEditing.js +1 -1
  114. package/hooks/features/export/serializers/csvSerializer.js +2 -4
  115. package/hooks/features/export/useGridPrintExport.js +18 -18
  116. package/hooks/features/filter/gridFilterUtils.js +5 -11
  117. package/hooks/features/filter/index.d.ts +1 -1
  118. package/hooks/features/filter/index.js +6 -0
  119. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  120. package/hooks/features/filter/useGridFilter.js +3 -1
  121. package/hooks/features/focus/useGridFocus.js +0 -1
  122. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  123. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  124. package/hooks/features/pagination/useGridPaginationMeta.js +2 -2
  125. package/hooks/features/pagination/useGridPaginationModel.js +7 -4
  126. package/hooks/features/pagination/useGridRowCount.js +30 -14
  127. package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
  128. package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
  129. package/hooks/features/rowReorder/gridRowReorderSelector.js +20 -2
  130. package/hooks/features/rowSelection/useGridRowSelection.js +17 -8
  131. package/hooks/features/rowSelection/utils.d.ts +1 -0
  132. package/hooks/features/rowSelection/utils.js +16 -3
  133. package/hooks/features/rows/useGridRowSpanning.js +23 -60
  134. package/hooks/features/rows/useGridRows.js +3 -1
  135. package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
  136. package/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
  137. package/hooks/features/scroll/useGridScroll.js +2 -3
  138. package/hooks/features/sorting/gridSortingUtils.js +1 -3
  139. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  140. package/hooks/features/sorting/useGridSorting.js +3 -1
  141. package/hooks/features/virtualization/useGridVirtualization.js +24 -5
  142. package/hooks/utils/useGridEvent.js +6 -2
  143. package/hooks/utils/useGridSelector.js +2 -4
  144. package/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  145. package/hooks/utils/useRunOncePerLoop.js +27 -18
  146. package/index.js +1 -1
  147. package/internals/index.d.ts +5 -4
  148. package/internals/index.js +16 -9
  149. package/material/index.js +1 -4
  150. package/models/api/gridRowApi.d.ts +14 -1
  151. package/models/api/index.d.ts +1 -1
  152. package/models/api/index.js +0 -11
  153. package/models/colDef/gridColDef.d.ts +14 -0
  154. package/models/configuration/gridConfiguration.d.ts +2 -2
  155. package/models/configuration/gridRowConfiguration.d.ts +6 -5
  156. package/models/events/gridEventLookup.d.ts +5 -0
  157. package/models/gridStateCommunity.d.ts +1 -1
  158. package/models/params/gridCellParams.d.ts +0 -10
  159. package/models/props/DataGridProps.d.ts +13 -6
  160. package/package.json +3 -3
  161. package/utils/keyboardUtils.d.ts +1 -8
  162. package/utils/keyboardUtils.js +1 -13
@@ -2,25 +2,26 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
5
+ const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "children", "suppressChildrenValidation"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { useRtl } from '@mui/system/RtlProvider';
9
9
  import useId from '@mui/utils/useId';
10
+ import { warnOnce } from '@mui/x-internals/warning';
10
11
  import { gridClasses } from "../../constants/gridClasses.js";
11
12
  import { GridMenu } from "../menu/GridMenu.js";
12
13
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
13
14
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
15
+ import { GridActionsCellItem } from "./GridActionsCellItem.js";
14
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
17
  const hasActions = colDef => typeof colDef.getActions === 'function';
16
18
  function GridActionsCell(props) {
17
19
  const {
18
- colDef,
19
- id,
20
20
  hasFocus,
21
21
  tabIndex,
22
22
  position = 'bottom-end',
23
- focusElementRef
23
+ children,
24
+ suppressChildrenValidation
24
25
  } = props,
25
26
  other = _objectWithoutPropertiesLoose(props, _excluded);
26
27
  const [focusedButtonIndex, setFocusedButtonIndex] = React.useState(-1);
@@ -34,12 +35,27 @@ function GridActionsCell(props) {
34
35
  const menuId = useId();
35
36
  const buttonId = useId();
36
37
  const rootProps = useGridRootProps();
37
- if (!hasActions(colDef)) {
38
- throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
39
- }
40
- const options = colDef.getActions(apiRef.current.getRowParams(id));
41
- const iconButtons = options.filter(option => !option.props.showInMenu);
42
- const menuButtons = options.filter(option => option.props.showInMenu);
38
+ const actions = [];
39
+ React.Children.forEach(children, child => {
40
+ // Unwrap React.Fragment
41
+ if (/*#__PURE__*/React.isValidElement(child)) {
42
+ if (child.type === React.Fragment) {
43
+ React.Children.forEach(child.props.children, fragChild => {
44
+ if (/*#__PURE__*/React.isValidElement(fragChild)) {
45
+ actions.push(fragChild);
46
+ }
47
+ });
48
+ } else if (child.type === GridActionsCellItem || suppressChildrenValidation) {
49
+ actions.push(child);
50
+ } else {
51
+ const childType = typeof child.type === 'function' ? child.type.name : child.type;
52
+ warnOnce(`MUI X: Invalid child type in \`GridActionsCell\`. Expected \`GridActionsCellItem\` or \`React.Fragment\`, got \`${childType}\`.
53
+ If this is intentional, you can suppress this warning by passing the \`suppressChildrenValidation\` prop to \`GridActionsCell\`.`, 'error');
54
+ }
55
+ }
56
+ });
57
+ const iconButtons = actions.filter(option => !option.props.showInMenu);
58
+ const menuButtons = actions.filter(option => option.props.showInMenu);
43
59
  const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
44
60
  React.useLayoutEffect(() => {
45
61
  if (!hasFocus) {
@@ -62,22 +78,16 @@ function GridActionsCell(props) {
62
78
  preventScroll: true
63
79
  });
64
80
  }, [focusedButtonIndex]);
81
+ const firstFocusableButtonIndex = actions.findIndex(o => !o.props.disabled);
65
82
  React.useEffect(() => {
83
+ if (hasFocus && focusedButtonIndex === -1) {
84
+ setFocusedButtonIndex(firstFocusableButtonIndex);
85
+ }
66
86
  if (!hasFocus) {
67
87
  setFocusedButtonIndex(-1);
68
88
  ignoreCallToFocus.current = false;
69
89
  }
70
- }, [hasFocus]);
71
- React.useImperativeHandle(focusElementRef, () => ({
72
- focus() {
73
- // If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
74
- if (!ignoreCallToFocus.current) {
75
- // find the first focusable button and pass the index to the state
76
- const focusableButtonIndex = options.findIndex(o => !o.props.disabled);
77
- setFocusedButtonIndex(focusableButtonIndex);
78
- }
79
- }
80
- }), [options]);
90
+ }, [hasFocus, focusedButtonIndex, firstFocusableButtonIndex]);
81
91
  React.useEffect(() => {
82
92
  if (focusedButtonIndex >= numberOfButtons) {
83
93
  setFocusedButtonIndex(numberOfButtons - 1);
@@ -115,7 +125,7 @@ function GridActionsCell(props) {
115
125
  return;
116
126
  }
117
127
  const getNewIndex = (index, direction) => {
118
- if (index < 0 || index > options.length) {
128
+ if (index < 0 || index > actions.length) {
119
129
  return index;
120
130
  }
121
131
 
@@ -124,7 +134,7 @@ function GridActionsCell(props) {
124
134
  const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
125
135
 
126
136
  // if the button that should receive focus is disabled go one more step
127
- return options[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
137
+ return actions[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
128
138
  };
129
139
  let newIndex = focusedButtonIndex;
130
140
  if (event.key === 'ArrowRight') {
@@ -201,6 +211,7 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
201
211
  * The mode of the cell.
202
212
  */
203
213
  cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
214
+ children: PropTypes.node.isRequired,
204
215
  /**
205
216
  * The column of the row that the current cell belongs to.
206
217
  */
@@ -209,16 +220,6 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
209
220
  * The column field of the cell that triggered the event.
210
221
  */
211
222
  field: PropTypes.string.isRequired,
212
- /**
213
- * A ref allowing to set imperative focus.
214
- * It can be passed to the element that should receive focus.
215
- * @ignore - do not document.
216
- */
217
- focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
218
- current: PropTypes.shape({
219
- focus: PropTypes.func.isRequired
220
- })
221
- })]),
222
223
  /**
223
224
  * The cell value formatted with the column valueFormatter.
224
225
  */
@@ -255,5 +256,25 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
255
256
  value: PropTypes.any
256
257
  } : void 0;
257
258
  export { GridActionsCell };
258
- export const renderActionsCell = params => /*#__PURE__*/_jsx(GridActionsCell, _extends({}, params));
259
+
260
+ // Temporary wrapper for backward compatibility.
261
+ // Only used to support `getActions` method in `GridColDef`.
262
+ // TODO(v9): Remove this wrapper and the default `renderCell` in gridActionsColDef
263
+ function GridActionsCellWrapper(props) {
264
+ const {
265
+ colDef,
266
+ id
267
+ } = props;
268
+ const apiRef = useGridApiContext();
269
+ if (!hasActions(colDef)) {
270
+ throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
271
+ }
272
+ const actions = colDef.getActions(apiRef.current.getRowParams(id));
273
+ return /*#__PURE__*/_jsx(GridActionsCell, _extends({
274
+ suppressChildrenValidation: true
275
+ }, props, {
276
+ children: actions
277
+ }));
278
+ }
279
+ export const renderActionsCell = params => /*#__PURE__*/_jsx(GridActionsCellWrapper, _extends({}, params));
259
280
  if (process.env.NODE_ENV !== "production") renderActionsCell.displayName = "renderActionsCell";
@@ -69,16 +69,6 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
69
69
  * The column field of the cell that triggered the event.
70
70
  */
71
71
  field: PropTypes.string.isRequired,
72
- /**
73
- * A ref allowing to set imperative focus.
74
- * It can be passed to the element that should receive focus.
75
- * @ignore - do not document.
76
- */
77
- focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
78
- current: PropTypes.shape({
79
- focus: PropTypes.func.isRequired
80
- })
81
- })]),
82
72
  /**
83
73
  * The cell value formatted with the column valueFormatter.
84
74
  */
@@ -16,6 +16,7 @@ import { useRtl } from '@mui/system/RtlProvider';
16
16
  import { forwardRef } from '@mui/x-internals/forwardRef';
17
17
  import { useStore } from '@mui/x-internals/store';
18
18
  import { Rowspan } from '@mui/x-virtualizer';
19
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
19
20
  import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
20
21
  import { getDataGridUtilityClass, gridClasses } from "../../constants/gridClasses.js";
21
22
  import { GridCellModes } from "../../models/index.js";
@@ -135,8 +136,7 @@ const GridCell = forwardRef(function GridCell(props, ref) {
135
136
  isEditable = false,
136
137
  value
137
138
  } = cellParams;
138
- const canManageOwnFocus = column.type === 'actions' && 'getActions' in column && typeof column.getActions === 'function' && column.getActions(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
139
- const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParams.tabIndex : -1;
139
+ const tabIndex = (cellMode === 'view' || !isEditable) && column.type !== 'actions' ? cellParams.tabIndex : -1;
140
140
  const {
141
141
  classes: rootClasses,
142
142
  getCellClassName
@@ -160,7 +160,6 @@ const GridCell = forwardRef(function GridCell(props, ref) {
160
160
  const valueToRender = cellParams.formattedValue ?? value;
161
161
  const cellRef = React.useRef(null);
162
162
  const handleRef = useForkRef(ref, cellRef);
163
- const focusElementRef = React.useRef(null);
164
163
  const isSelectionMode = rootProps.cellSelection ?? false;
165
164
  const ownerState = {
166
165
  align,
@@ -224,14 +223,14 @@ const GridCell = forwardRef(function GridCell(props, ref) {
224
223
  }
225
224
  return cellStyle;
226
225
  }, [width, isNotVisible, styleProp, pinnedOffset, pinnedPosition, isRtl, rowSpan]);
227
- React.useEffect(() => {
226
+ useEnhancedEffect(() => {
228
227
  if (!hasFocus || cellMode === GridCellModes.Edit) {
229
228
  return;
230
229
  }
231
230
  const doc = ownerDocument(apiRef.current.rootElementRef.current);
232
231
  if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
233
232
  const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
234
- const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
233
+ const elementToFocus = focusableElement || cellRef.current;
235
234
  if (doesSupportPreventScroll()) {
236
235
  elementToFocus.focus({
237
236
  preventScroll: true
@@ -292,11 +291,6 @@ const GridCell = forwardRef(function GridCell(props, ref) {
292
291
  children = valueString;
293
292
  title = valueString;
294
293
  }
295
- if (/*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
296
- children = /*#__PURE__*/React.cloneElement(children, {
297
- focusElementRef
298
- });
299
- }
300
294
  const draggableEventHandlers = disableDragEvents ? null : {
301
295
  onDragEnter: publish('cellDragEnter', onDragEnter),
302
296
  onDragOver: publish('cellDragOver', onDragOver)
@@ -78,7 +78,7 @@ function GridColumnHeaderItem(props) {
78
78
  const columnMenuButtonId = useId();
79
79
  const iconButtonRef = React.useRef(null);
80
80
  const [showColumnMenuIcon, setShowColumnMenuIcon] = React.useState(columnMenuOpen);
81
- const isDraggable = React.useMemo(() => !rootProps.disableColumnReorder && !disableReorder && !colDef.disableReorder, [rootProps.disableColumnReorder, disableReorder, colDef.disableReorder]);
81
+ const isDraggable = !rootProps.disableColumnReorder && !disableReorder && !colDef.disableReorder;
82
82
  let headerComponent;
83
83
  if (colDef.renderHeader) {
84
84
  headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
@@ -124,7 +124,7 @@ function GridColumnHeaderItem(props) {
124
124
  onDoubleClick: publish('columnSeparatorDoubleClick')
125
125
  }), [publish]);
126
126
  React.useEffect(() => {
127
- if (!showColumnMenuIcon) {
127
+ if (!showColumnMenuIcon && columnMenuOpen) {
128
128
  setShowColumnMenuIcon(columnMenuOpen);
129
129
  }
130
130
  }, [showColumnMenuIcon, columnMenuOpen]);
@@ -5,7 +5,9 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
5
5
  const _excluded = ["field", "id", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "api"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import clsx from 'clsx';
8
9
  import composeClasses from '@mui/utils/composeClasses';
10
+ import useEventCallback from '@mui/utils/useEventCallback';
9
11
  import { forwardRef } from '@mui/x-internals/forwardRef';
10
12
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
11
13
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
@@ -36,7 +38,19 @@ const GridCellCheckboxForwardRef = forwardRef(function GridCellCheckboxRenderer(
36
38
  classes: rootProps.classes
37
39
  };
38
40
  const classes = useUtilityClasses(ownerState);
41
+ const {
42
+ isIndeterminate,
43
+ isChecked,
44
+ isSelectable
45
+ } = useGridSelector(apiRef, checkboxPropsSelector, {
46
+ groupId: id,
47
+ autoSelectParents: rootProps.rowSelectionPropagation?.parents ?? false
48
+ });
49
+ const disabled = !isSelectable;
39
50
  const handleChange = event => {
51
+ if (disabled) {
52
+ return;
53
+ }
40
54
  const params = {
41
55
  value: event.target.checked,
42
56
  id
@@ -51,20 +65,26 @@ const GridCellCheckboxForwardRef = forwardRef(function GridCellCheckboxRenderer(
51
65
  }
52
66
  }
53
67
  }, [apiRef, tabIndex, id, field]);
54
- const handleKeyDown = React.useCallback(event => {
68
+ const handleKeyDown = useEventCallback(event => {
55
69
  if (event.key === ' ') {
56
70
  // We call event.stopPropagation to avoid selecting the row and also scrolling to bottom
57
71
  // TODO: Remove and add a check inside useGridKeyboardNavigation
58
72
  event.stopPropagation();
59
73
  }
60
- }, []);
61
- const isSelectable = apiRef.current.isRowSelectable(id);
62
- const {
63
- isIndeterminate,
64
- isChecked
65
- } = useGridSelector(apiRef, checkboxPropsSelector, {
66
- groupId: id,
67
- autoSelectParents: rootProps.rowSelectionPropagation?.parents ?? false
74
+ if (disabled) {
75
+ return;
76
+ }
77
+ });
78
+ const handleClick = useEventCallback(event => {
79
+ if (disabled) {
80
+ event.preventDefault();
81
+ return;
82
+ }
83
+ });
84
+ const handleMouseDown = useEventCallback(() => {
85
+ if (disabled) {
86
+ return;
87
+ }
68
88
  });
69
89
  if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
70
90
  return null;
@@ -74,16 +94,21 @@ const GridCellCheckboxForwardRef = forwardRef(function GridCellCheckboxRenderer(
74
94
  tabIndex: tabIndex,
75
95
  checked: isChecked && !isIndeterminate,
76
96
  onChange: handleChange,
77
- className: classes.root,
97
+ onClick: handleClick,
98
+ onMouseDown: handleMouseDown,
99
+ className: clsx(classes.root, disabled && 'Mui-disabled'),
100
+ material: {
101
+ disableRipple: disabled
102
+ },
78
103
  slotProps: {
79
104
  htmlInput: {
105
+ 'aria-disabled': disabled || undefined,
80
106
  'aria-label': label,
81
107
  name: 'select_row'
82
108
  }
83
109
  },
84
110
  onKeyDown: handleKeyDown,
85
- indeterminate: isIndeterminate,
86
- disabled: !isSelectable
111
+ indeterminate: isIndeterminate
87
112
  }, rootProps.slotProps?.baseCheckbox, other, {
88
113
  ref: ref
89
114
  }));
@@ -110,16 +135,6 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
110
135
  * The column field of the cell that triggered the event.
111
136
  */
112
137
  field: PropTypes.string.isRequired,
113
- /**
114
- * A ref allowing to set imperative focus.
115
- * It can be passed to the element that should receive focus.
116
- * @ignore - do not document.
117
- */
118
- focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
119
- current: PropTypes.shape({
120
- focus: PropTypes.func.isRequired
121
- })
122
- })]),
123
138
  /**
124
139
  * The cell value formatted with the column valueFormatter.
125
140
  */
@@ -15,7 +15,7 @@ const separatorIconDragStyles = {
15
15
  // Emotion thinks it knows better than us which selector we should use.
16
16
  // https://github.com/emotion-js/emotion/issues/1105#issuecomment-1722524968
17
17
  const ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
18
- const shouldShowBorderTopRightRadiusSelector = apiRef => apiRef.current.state.dimensions.hasScrollX && (!apiRef.current.state.dimensions.hasScrollY || apiRef.current.state.dimensions.scrollbarSize === 0);
18
+ const shouldShowBorderTopRightRadiusSelector = apiRef => !apiRef.current.state.dimensions.isReady ? apiRef.current.state.dimensions.scrollbarSize === 0 : apiRef.current.state.dimensions.hasScrollX && (!apiRef.current.state.dimensions.hasScrollY || apiRef.current.state.dimensions.scrollbarSize === 0);
19
19
  export const GridRootStyles = styled('div', {
20
20
  name: 'MuiDataGrid',
21
21
  slot: 'Root',
@@ -233,10 +233,6 @@ export const GridRootStyles = styled('div', {
233
233
  [`& .${c.treeDataGroupingCellToggle}`]: styles.treeDataGroupingCellToggle
234
234
  }, {
235
235
  [`& .${c.withBorderColor}`]: styles.withBorderColor
236
- }, {
237
- [`& .${c['row--dropAbove']}`]: styles['row--dropAbove']
238
- }, {
239
- [`& .${c['row--dropBelow']}`]: styles['row--dropBelow']
240
236
  }, {
241
237
  [`& .${c['row--beingDragged']}`]: styles['row--beingDragged']
242
238
  }]
@@ -414,6 +410,9 @@ export const GridRootStyles = styled('div', {
414
410
  alignItems: 'center',
415
411
  backgroundColor: headerBackground
416
412
  },
413
+ [`& .${c.columnHeader} .${c.sortButton}`]: {
414
+ backgroundColor: vars.header.background.base
415
+ },
417
416
  [`& .${c['columnHeader--filter']}`]: {
418
417
  paddingTop: 8,
419
418
  paddingBottom: 8,
@@ -513,7 +512,16 @@ export const GridRootStyles = styled('div', {
513
512
  [`& .${c.columnHeader}:not(.${c['columnHeader--sorted']}):hover .${c.sortButton},
514
513
  & .${c.pivotPanelField}:not(.${c['pivotPanelField--sorted']}):hover .${c.sortButton},
515
514
  & .${c.pivotPanelField}:not(.${c['pivotPanelField--sorted']}) .${c.sortButton}:focus-visible`]: {
516
- opacity: 0.5
515
+ opacity: 1
516
+ },
517
+ // Add opacity only to the button content to avoid affecting the background color
518
+ [`& .${c.columnHeader}:not(.${c['columnHeader--sorted']}):hover .${c.sortButton} > *,
519
+ & .${c.pivotPanelField}:not(.${c['pivotPanelField--sorted']}):hover .${c.sortButton} > *,
520
+ & .${c.pivotPanelField}:not(.${c['pivotPanelField--sorted']}) .${c.sortButton}:focus-visible > *`]: {
521
+ opacity: 0.78
522
+ },
523
+ [`& .${c.pivotPanelFieldActionContainer} button:hover`]: {
524
+ backgroundColor: vars.colors.background.base
517
525
  }
518
526
  },
519
527
  '@media (hover: none)': {
@@ -528,7 +536,7 @@ export const GridRootStyles = styled('div', {
528
536
  }
529
537
  },
530
538
  [`& .${c.pivotPanelField}:not(.${c['pivotPanelField--sorted']}) .${c.sortButton}`]: {
531
- opacity: 0.5
539
+ opacity: 0.78
532
540
  }
533
541
  },
534
542
  // Hide the column separator when the column has border and it is not resizable
@@ -622,7 +630,8 @@ export const GridRootStyles = styled('div', {
622
630
  [`&.${c.rowSkeleton}:hover`]: {
623
631
  backgroundColor: 'transparent'
624
632
  },
625
- '&.Mui-selected': selectedStyles
633
+ '&.Mui-selected': selectedStyles,
634
+ position: 'relative'
626
635
  },
627
636
  /* Cell styles */
628
637
  [`& .${c.cell}`]: {
@@ -867,38 +876,6 @@ export const GridRootStyles = styled('div', {
867
876
  display: 'none'
868
877
  }
869
878
  },
870
- [`& .${c['row--dropAbove']}`]: {
871
- position: 'relative',
872
- '&::before': {
873
- pointerEvents: 'none',
874
- content: '""',
875
- position: 'absolute',
876
- top: 0,
877
- left: 0,
878
- width: '100%',
879
- height: '2px',
880
- backgroundColor: vars.colors.interactive.selected
881
- }
882
- },
883
- [`& .${c['row--dropBelow']}`]: {
884
- position: 'relative',
885
- '&::after': {
886
- zIndex: 100,
887
- pointerEvents: 'none',
888
- content: '""',
889
- position: 'absolute',
890
- bottom: '-2px',
891
- left: 0,
892
- width: '100%',
893
- height: '2px',
894
- backgroundColor: vars.colors.interactive.selected
895
- },
896
- [`&.${c['row--lastVisible']}`]: {
897
- '&::after': {
898
- bottom: 'calc(var(--DataGrid-hasScrollY) * 0px + (1 - var(--DataGrid-hasScrollY)) * -2px)'
899
- }
900
- }
901
- },
902
879
  [`& .${c['row--beingDragged']}`]: {
903
880
  color: vars.colors.foreground.disabled,
904
881
  '&:hover': {
@@ -29,7 +29,7 @@ const ToolbarRoot = styled('div', {
29
29
  name: 'MuiDataGrid',
30
30
  slot: 'Toolbar'
31
31
  })({
32
- flex: 0,
32
+ flex: '0 1 1px',
33
33
  display: 'flex',
34
34
  alignItems: 'center',
35
35
  justifyContent: 'end',
@@ -7,6 +7,7 @@ type GridVirtualScrollbarProps = {
7
7
  top: number;
8
8
  }>;
9
9
  };
10
+ export declare const scrollbarSizeCssExpression = "calc(max(var(--DataGrid-scrollbarSize), 14px))";
10
11
  export declare const ScrollbarCorner: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, {}, {}>;
11
12
  declare const GridVirtualScrollbar: React.ForwardRefExoticComponent<GridVirtualScrollbarProps> | React.ForwardRefExoticComponent<GridVirtualScrollbarProps & React.RefAttributes<HTMLDivElement>>;
12
13
  export { GridVirtualScrollbar };
@@ -22,6 +22,12 @@ const useUtilityClasses = (ownerState, position) => {
22
22
  };
23
23
  return composeClasses(slots, getDataGridUtilityClass, classes);
24
24
  };
25
+
26
+ // In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
27
+ // their size to be 0px throughout all the calculations, but the floating scrollbar container does need
28
+ // to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
29
+ // don't have a method to find the required size for scrollbars on those platforms.
30
+ export const scrollbarSizeCssExpression = 'calc(max(var(--DataGrid-scrollbarSize), 14px))';
25
31
  const Scrollbar = styled('div')({
26
32
  position: 'absolute',
27
33
  display: 'inline-block',
@@ -29,11 +35,7 @@ const Scrollbar = styled('div')({
29
35
  '&:hover': {
30
36
  zIndex: 70
31
37
  },
32
- // In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
33
- // their size to be 0px throughout all the calculations, but the floating scrollbar container does need
34
- // to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
35
- // don't have a method to find the required size for scrollbars on those platforms.
36
- '--size': 'calc(max(var(--DataGrid-scrollbarSize), 14px))'
38
+ '--size': scrollbarSizeCssExpression
37
39
  });
38
40
  const ScrollbarVertical = styled(Scrollbar)({
39
41
  width: 'var(--size)',
@@ -65,7 +67,10 @@ export const ScrollbarCorner = styled(Scrollbar)({
65
67
  height: 'var(--size)',
66
68
  right: 0,
67
69
  bottom: 0,
68
- overflow: 'scroll'
70
+ overflow: 'scroll',
71
+ '@media print': {
72
+ display: 'none'
73
+ }
69
74
  });
70
75
  const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref) {
71
76
  const apiRef = useGridPrivateApiContext();
@@ -94,7 +99,7 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
94
99
  return;
95
100
  }
96
101
  isLocked.current = true;
97
- scrollbar[propertyScroll] = scrollPosition[propertyScrollPosition];
102
+ scrollbar[propertyScroll] = props.scrollPosition.current[propertyScrollPosition];
98
103
  });
99
104
  const onScrollbarScroll = useEventCallback(() => {
100
105
  const scroller = apiRef.current.virtualScrollerRef.current;
@@ -19,6 +19,7 @@ import { GridVirtualScrollerRenderZone as RenderZone } from "./GridVirtualScroll
19
19
  import { GridVirtualScrollbar as Scrollbar, ScrollbarCorner } from "./GridVirtualScrollbar.js";
20
20
  import { GridScrollShadows as ScrollShadows } from "../GridScrollShadows.js";
21
21
  import { GridOverlayWrapper } from "../base/GridOverlays.js";
22
+ import { useGridVirtualizer } from "../../hooks/core/useGridVirtualizer.js";
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
24
  const useUtilityClasses = ownerState => {
24
25
  const {
@@ -82,7 +83,7 @@ function GridVirtualScroller(props) {
82
83
  loadingOverlayVariant
83
84
  };
84
85
  const classes = useUtilityClasses(ownerState);
85
- const virtualScroller = apiRef.current.virtualizer.api.useVirtualization().getters;
86
+ const virtualScroller = useGridVirtualizer().api.getters;
86
87
  const {
87
88
  getContainerProps,
88
89
  getScrollerProps,
@@ -36,7 +36,7 @@ const GridVirtualScrollerRenderZone = forwardRef(function GridVirtualScrollerRen
36
36
  const apiRef = useGridPrivateApiContext();
37
37
  const rootProps = useGridRootProps();
38
38
  const classes = useUtilityClasses(rootProps);
39
- const offsetTop = apiRef.current.virtualizer.api.useVirtualization().getters.getOffsetTop();
39
+ const offsetTop = apiRef.current.virtualizer.api.getters.getOffsetTop();
40
40
  return /*#__PURE__*/_jsx(VirtualScrollerRenderZoneRoot, _extends({
41
41
  className: clsx(classes.root, className),
42
42
  ownerState: rootProps,
@@ -57,5 +57,6 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
57
57
  sortingMode: 'client',
58
58
  sortingOrder: ['asc', 'desc', null],
59
59
  throttleRowsMs: 0,
60
- virtualizeColumnsWithAutoRowHeight: false
60
+ virtualizeColumnsWithAutoRowHeight: false,
61
+ tabNavigation: 'none'
61
62
  };
@@ -572,14 +572,6 @@ export interface GridClasses {
572
572
  * Styles applied to the floating special row reorder cell element when it is dragged.
573
573
  */
574
574
  'row--dragging': string;
575
- /**
576
- * Styles applied to the row element when it is a drop target above.
577
- */
578
- 'row--dropAbove': string;
579
- /**
580
- * Styles applied to the row element when it is a drop target below.
581
- */
582
- 'row--dropBelow': string;
583
575
  /**
584
576
  * Styles applied to the row element when it is being dragged (entire row).
585
577
  */
@@ -5,4 +5,4 @@ export function getDataGridUtilityClass(slot) {
5
5
  }
6
6
  export const gridClasses = generateUtilityClasses('MuiDataGrid', ['aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'mainContent', 'withSidePanel', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible',
7
7
  // TODO v9: Rename to `cell--dragging`
8
- 'row--dragging', 'row--dropAbove', 'row--dropBelow', 'row--beingDragged', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderIcon', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--pinnedRight', 'scrollShadow', 'scrollShadow--vertical', 'scrollShadow--horizontal', 'selectedRowCount', 'sortButton', 'sortIcon', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction']);
8
+ 'row--dragging', 'row--beingDragged', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderIcon', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--pinnedRight', 'scrollShadow', 'scrollShadow--vertical', 'scrollShadow--horizontal', 'selectedRowCount', 'sortButton', 'sortIcon', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction']);
@@ -6,4 +6,5 @@ import type { GridRowId } from "../../models/gridRows.js";
6
6
  * @param {GridRowModel} row - The row to get the id for
7
7
  * @returns {GridRowId} The row id
8
8
  */
9
- export declare const gridRowIdSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, import("@mui/x-data-grid").GridValidRowModel, GridRowId>;
9
+ export declare const gridRowIdSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, import("@mui/x-data-grid").GridValidRowModel, GridRowId>;
10
+ export declare const gridRowSelectableSelector: import("@mui/x-data-grid").OutputSelector<GridStateCommunity, unknown, ((params: import("@mui/x-data-grid").GridRowParams<any>) => boolean) | undefined>;
@@ -12,4 +12,7 @@ export const gridRowIdSelector = createRootSelector((state, row) => {
12
12
  return row[GRID_ID_AUTOGENERATED];
13
13
  }
14
14
  return state.props.getRowId ? state.props.getRowId(row) : row.id;
15
+ });
16
+ export const gridRowSelectableSelector = createRootSelector(state => {
17
+ return state.props.isRowSelectable;
15
18
  });
@@ -8,6 +8,7 @@ import { GridHydrateRowsValue } from "../../features/rows/gridRowsInterfaces.js"
8
8
  import { GridPreferencePanelsValue } from "../../features/preferencesPanel/index.js";
9
9
  import { GridGetRowsParams, GridGetRowsResponse } from "../../../models/gridDataSource.js";
10
10
  import { HeightEntry } from "../../features/rows/gridRowsMetaInterfaces.js";
11
+ import type { RowReorderDropPosition } from "../../../models/api/gridRowApi.js";
11
12
  export type GridPipeProcessorGroup = keyof GridPipeProcessingLookup;
12
13
  export interface GridPipeProcessingLookup {
13
14
  columnMenu: {
@@ -97,12 +98,12 @@ export interface GridPipeProcessingLookup {
97
98
  * - For example before first row is `0` and after the last row is `rows.length`.
98
99
  * If the reorder is invalid, it returns `-1`.
99
100
  */
100
- getRowReorderTargetIndex: {
101
- value: number;
101
+ isRowReorderValid: {
102
+ value: boolean;
102
103
  context: {
103
104
  sourceRowId: GridRowId;
104
105
  targetRowId: GridRowId;
105
- dropPosition: 'above' | 'below';
106
+ dropPosition: RowReorderDropPosition;
106
107
  dragDirection: 'up' | 'down';
107
108
  };
108
109
  };