@mui/x-data-grid 8.18.0 → 8.19.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 (106) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/DataGrid/useDataGridComponent.js +4 -3
  3. package/components/GridRow.js +1 -1
  4. package/components/cell/GridActionsCell.d.ts +9 -0
  5. package/components/cell/GridActionsCell.js +54 -34
  6. package/components/cell/GridBooleanCell.js +0 -10
  7. package/components/cell/GridCell.js +4 -10
  8. package/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  9. package/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  10. package/components/containers/GridRootStyles.js +1 -1
  11. package/components/toolbarV8/Toolbar.js +1 -1
  12. package/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  13. package/components/virtualization/GridVirtualScrollbar.js +13 -8
  14. package/components/virtualization/GridVirtualScroller.js +2 -1
  15. package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  16. package/constants/dataGridPropsDefaultValues.js +2 -1
  17. package/esm/DataGrid/useDataGridComponent.js +5 -4
  18. package/esm/components/GridRow.js +1 -1
  19. package/esm/components/cell/GridActionsCell.d.ts +9 -0
  20. package/esm/components/cell/GridActionsCell.js +55 -34
  21. package/esm/components/cell/GridBooleanCell.js +0 -10
  22. package/esm/components/cell/GridCell.js +4 -10
  23. package/esm/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  24. package/esm/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  25. package/esm/components/containers/GridRootStyles.js +1 -1
  26. package/esm/components/toolbarV8/Toolbar.js +1 -1
  27. package/esm/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  28. package/esm/components/virtualization/GridVirtualScrollbar.js +12 -7
  29. package/esm/components/virtualization/GridVirtualScroller.js +2 -1
  30. package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  31. package/esm/constants/dataGridPropsDefaultValues.js +2 -1
  32. package/esm/hooks/core/gridPropsSelectors.d.ts +2 -1
  33. package/esm/hooks/core/gridPropsSelectors.js +3 -0
  34. package/esm/hooks/core/useGridProps.js +8 -2
  35. package/esm/hooks/core/useGridVirtualizer.d.ts +80 -6
  36. package/esm/hooks/core/useGridVirtualizer.js +27 -12
  37. package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  38. package/esm/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  39. package/esm/hooks/features/columns/useGridColumnSpanning.js +9 -4
  40. package/esm/hooks/features/dimensions/useGridDimensions.js +12 -6
  41. package/esm/hooks/features/export/useGridPrintExport.js +18 -18
  42. package/esm/hooks/features/filter/useGridFilter.d.ts +1 -1
  43. package/esm/hooks/features/filter/useGridFilter.js +3 -1
  44. package/esm/hooks/features/focus/useGridFocus.js +0 -1
  45. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  46. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  47. package/esm/hooks/features/pagination/useGridPaginationMeta.js +3 -3
  48. package/esm/hooks/features/pagination/useGridPaginationModel.js +7 -4
  49. package/esm/hooks/features/pagination/useGridRowCount.js +31 -15
  50. package/esm/hooks/features/rowSelection/useGridRowSelection.js +8 -7
  51. package/esm/hooks/features/rowSelection/utils.d.ts +1 -0
  52. package/esm/hooks/features/rowSelection/utils.js +17 -4
  53. package/esm/hooks/features/rows/useGridRowSpanning.js +23 -60
  54. package/esm/hooks/features/scroll/useGridScroll.js +2 -3
  55. package/esm/hooks/features/sorting/useGridSorting.d.ts +1 -1
  56. package/esm/hooks/features/sorting/useGridSorting.js +3 -1
  57. package/esm/hooks/features/virtualization/useGridVirtualization.js +24 -5
  58. package/esm/hooks/utils/useGridEvent.js +6 -2
  59. package/esm/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  60. package/esm/hooks/utils/useRunOncePerLoop.js +28 -18
  61. package/esm/index.js +1 -1
  62. package/esm/models/colDef/gridColDef.d.ts +14 -0
  63. package/esm/models/events/gridEventLookup.d.ts +5 -0
  64. package/esm/models/gridStateCommunity.d.ts +1 -1
  65. package/esm/models/params/gridCellParams.d.ts +0 -10
  66. package/esm/models/props/DataGridProps.d.ts +13 -6
  67. package/esm/utils/keyboardUtils.d.ts +1 -8
  68. package/esm/utils/keyboardUtils.js +0 -7
  69. package/hooks/core/gridPropsSelectors.d.ts +2 -1
  70. package/hooks/core/gridPropsSelectors.js +4 -1
  71. package/hooks/core/useGridProps.js +8 -2
  72. package/hooks/core/useGridVirtualizer.d.ts +80 -6
  73. package/hooks/core/useGridVirtualizer.js +26 -11
  74. package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  75. package/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  76. package/hooks/features/columns/useGridColumnSpanning.js +9 -4
  77. package/hooks/features/dimensions/useGridDimensions.js +12 -6
  78. package/hooks/features/export/useGridPrintExport.js +18 -18
  79. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  80. package/hooks/features/filter/useGridFilter.js +3 -1
  81. package/hooks/features/focus/useGridFocus.js +0 -1
  82. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  83. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  84. package/hooks/features/pagination/useGridPaginationMeta.js +2 -2
  85. package/hooks/features/pagination/useGridPaginationModel.js +7 -4
  86. package/hooks/features/pagination/useGridRowCount.js +30 -14
  87. package/hooks/features/rowSelection/useGridRowSelection.js +8 -7
  88. package/hooks/features/rowSelection/utils.d.ts +1 -0
  89. package/hooks/features/rowSelection/utils.js +16 -3
  90. package/hooks/features/rows/useGridRowSpanning.js +23 -60
  91. package/hooks/features/scroll/useGridScroll.js +2 -3
  92. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  93. package/hooks/features/sorting/useGridSorting.js +3 -1
  94. package/hooks/features/virtualization/useGridVirtualization.js +24 -5
  95. package/hooks/utils/useGridEvent.js +6 -2
  96. package/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  97. package/hooks/utils/useRunOncePerLoop.js +27 -18
  98. package/index.js +1 -1
  99. package/models/colDef/gridColDef.d.ts +14 -0
  100. package/models/events/gridEventLookup.d.ts +5 -0
  101. package/models/gridStateCommunity.d.ts +1 -1
  102. package/models/params/gridCellParams.d.ts +0 -10
  103. package/models/props/DataGridProps.d.ts +13 -6
  104. package/package.json +3 -3
  105. package/utils/keyboardUtils.d.ts +1 -8
  106. package/utils/keyboardUtils.js +1 -13
package/CHANGELOG.md CHANGED
@@ -5,6 +5,119 @@
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.19.0
9
+
10
+ _Nov 20, 2025_
11
+
12
+ We'd like to extend a big thank you to the 15 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🔎 Add pan on `wheel` to the charts zoom
15
+ - ⌨️ Allow opt-in to [tab navigation](https://mui.com/x/react-data-grid/accessibility/#tab-navigation) inside the Data Grid.
16
+ - ⚙️ New way of defining [action columns](https://mui.com/x/react-data-grid/column-definition/#ActionsWithModalGrid.tsx) in the Data Grid that makes it easier to keep `columns` prop stable.
17
+ - 🐞 Bugfixes
18
+ - 📚 Documentation improvements
19
+
20
+ Special thanks go out to these community members for their valuable contributions:
21
+ @lauri865, @noobyogi0010, @sai6855
22
+
23
+ The following team members contributed to this release:
24
+ @alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @mj12albert, @noraleonte, @rita-codes, @siriwatknp, @ZeeshanTamboli
25
+
26
+ ### Data Grid
27
+
28
+ #### `@mui/x-data-grid@8.19.0`
29
+
30
+ - [DataGrid] Add `tabNavigation` prop to control tab navigation in the grid (#20286) @arminmeh
31
+ - [DataGrid] Allow to focus disabled checkbox cells (#19959) @mj12albert
32
+ - [DataGrid] Alternative actions column definition API (#15041) @cherniavskii
33
+ - [DataGrid] Fix failing tests (#20332) @cherniavskii
34
+ - [DataGrid] Prevent Safari 26 error in the event handler (#20369) @arminmeh
35
+ - [DataGrid] Undeprecate the `autoHeight` prop (#20363) @cherniavskii
36
+ - [DataGrid] Fix print export grid dimensions with dynamic row height and print styles (#19835) @cherniavskii
37
+
38
+ #### `@mui/x-data-grid-pro@8.19.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
39
+
40
+ Same changes as in `@mui/x-data-grid@8.19.0`.
41
+
42
+ #### `@mui/x-data-grid-premium@8.19.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
43
+
44
+ Same changes as in `@mui/x-data-grid-pro@8.19.0`, plus:
45
+
46
+ - [DataGridPremium] Fix aggregation with sorting (#19892) @lauri865
47
+ - [DataGridPremium] Lock `ExcelJS` version (#20329) @cherniavskii
48
+
49
+ ### Date and Time Pickers
50
+
51
+ #### `@mui/x-date-pickers@8.19.0`
52
+
53
+ - [pickers] Do not loose `slotProps.field.slotProps` (#20322) @flaviendelangle
54
+
55
+ #### `@mui/x-date-pickers-pro@8.19.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
56
+
57
+ Same changes as in `@mui/x-date-pickers@8.19.0`.
58
+
59
+ ### Charts
60
+
61
+ #### `@mui/x-charts@8.19.0`
62
+
63
+ - [charts] Expose `niceDomain` utility (#20250) @bernardobelchior
64
+ - [charts] Fix benchmark regression by downgrading to JSDOM v26 (#20405) @bernardobelchior
65
+ - [charts] Fix Pie Chart keyboard focus highlight (#20358) @JCQuintas
66
+ - [charts] Memoize series selectors (#20326) @JCQuintas
67
+ - [charts] Relax dataset type (#20294) @bernardobelchior
68
+ - [charts] Remove `touch-action: pan-y` when zoom is disabled (#20204) @bernardobelchior
69
+ - [charts] Use `getBBox()` for correct SVG sizes in firefox (#20309) @JCQuintas
70
+ - [charts] Use directly selector from `@mui/x-internals` (#20365) @alexfauquette
71
+ - [charts] Fix unnecessary errors in dev mode (#20380) @JCQuintas
72
+
73
+ #### `@mui/x-charts-pro@8.19.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
74
+
75
+ Same changes as in `@mui/x-charts@8.19.0`, plus:
76
+
77
+ - [charts-pro] Add pan on `wheel` to zoom (#19998) @JCQuintas
78
+ - [charts-pro] Fix zoom slider preview having an opaque background in dark mode (#20367) @bernardobelchior
79
+
80
+ #### `@mui/x-charts-premium@8.19.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
81
+
82
+ Same changes as in `@mui/x-charts-pro@8.19.0`.
83
+
84
+ ### Tree View
85
+
86
+ #### `@mui/x-tree-view@8.19.0`
87
+
88
+ - [tree view] Enable lazy load when children count is not know in tree view (#18680) @noobyogi0010
89
+ - [tree view] Fix unwanted behaviors on the item re-ordering (#20368) @flaviendelangle
90
+
91
+ #### `@mui/x-tree-view-pro@8.19.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
92
+
93
+ Same changes as in `@mui/x-tree-view@8.19.0`.
94
+
95
+ ### Codemod
96
+
97
+ #### `@mui/x-codemod@8.19.0`
98
+
99
+ Internal changes.
100
+
101
+ ### Docs
102
+
103
+ - [docs] Add minimum Typescript version to migration guide (#20320) @siriwatknp
104
+ - [docs] Fix Autosizing documentation (#20348) @siriwatknp
105
+ - [docs] Fix separator opacity in demo (#20293) @sai6855
106
+ - [docs] Replace deprecated `LoadingButton` with `Button` component (#20208) @Janpot
107
+
108
+ ### Core
109
+
110
+ - [code-infra] Add new broken links checker (#20120) @Janpot
111
+ - [code-infra] Disable Codspeed pipeline (#20370) @JCQuintas
112
+ - [code-infra] Optimize `checkMaterialVersion` (#20307) @Janpot
113
+ - [code-infra] Use utils from code-infra for changelog and PR creation (#20406) @brijeshb42
114
+ - [docs-infra] Revert `@docsearch/react` (#20313) @Janpot
115
+
116
+ ### Miscellaneous
117
+
118
+ - [test] Fix browser tests skipping some projects (#20318) @cherniavskii
119
+ - [test] Update `use-react-version` pnpm script (#20319) @cherniavskii
120
+
8
121
  ## 8.18.0
9
122
 
10
123
  <!-- generated comparing v8.17.0..master -->
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.useDataGridComponent = void 0;
9
9
  var React = _interopRequireWildcard(require("react"));
10
+ var _useFirstRender = require("@mui/x-internals/useFirstRender");
10
11
  var _useGridInitialization = require("../hooks/core/useGridInitialization");
11
- var _useGridVirtualizer = require("../hooks/core/useGridVirtualizer");
12
12
  var _useGridInitializeState = require("../hooks/utils/useGridInitializeState");
13
13
  var _useGridClipboard = require("../hooks/features/clipboard/useGridClipboard");
14
14
  var _useGridColumnMenu = require("../hooks/features/columnMenu/useGridColumnMenu");
@@ -72,7 +72,6 @@ const useDataGridComponent = (apiRef, props, configuration) => {
72
72
  (0, _useGridInitializeState.useGridInitializeState)(_useGridDimensions.dimensionsStateInitializer, apiRef, props);
73
73
  (0, _useGridInitializeState.useGridInitializeState)(_useGridRowsMeta.rowsMetaStateInitializer, apiRef, props);
74
74
  (0, _useGridInitializeState.useGridInitializeState)(_useGridListView.listViewStateInitializer, apiRef, props);
75
- (0, _useGridVirtualizer.useGridVirtualizer)(apiRef, props);
76
75
  (0, _useGridKeyboardNavigation.useGridKeyboardNavigation)(apiRef, props);
77
76
  (0, _useGridRowSelection.useGridRowSelection)(apiRef, props);
78
77
  (0, _useGridColumns.useGridColumns)(apiRef, props);
@@ -89,7 +88,6 @@ const useDataGridComponent = (apiRef, props, configuration) => {
89
88
  (0, _useGridDensity.useGridDensity)(apiRef, props);
90
89
  (0, _useGridColumnResize.useGridColumnResize)(apiRef, props);
91
90
  (0, _useGridPagination.useGridPagination)(apiRef, props);
92
- (0, _useGridRowsMeta.useGridRowsMeta)(apiRef, props);
93
91
  (0, _useGridScroll.useGridScroll)(apiRef, props);
94
92
  (0, _useGridColumnMenu.useGridColumnMenu)(apiRef);
95
93
  (0, _useGridCsvExport.useGridCsvExport)(apiRef, props);
@@ -103,6 +101,9 @@ const useDataGridComponent = (apiRef, props, configuration) => {
103
101
  (0, _useGridDataSource.useGridDataSource)(apiRef, props);
104
102
 
105
103
  // Should be the last thing to run, because all pre-processors should have been registered by now.
104
+ (0, _useFirstRender.useFirstRender)(() => {
105
+ apiRef.current.runAppliersForPendingProcessors();
106
+ });
106
107
  React.useEffect(() => {
107
108
  apiRef.current.runAppliersForPendingProcessors();
108
109
  });
@@ -204,7 +204,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
204
204
  rowStyle[property] = propertyValue;
205
205
  }
206
206
  return rowStyle;
207
- }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
207
+ }, [isNotVisible, rowHeight, styleProp, heightEntry.spacingTop, heightEntry.spacingBottom, rootProps.rowSpacingType]);
208
208
 
209
209
  // HACK: Sometimes, the rowNode has already been removed from the state but the row is still rendered.
210
210
  if (!rowNode) {
@@ -1,8 +1,17 @@
1
+ import * as React from 'react';
1
2
  import { GridRenderCellParams } from "../../models/params/gridCellParams.js";
2
3
  import { GridMenuProps } from "../menu/GridMenu.js";
3
4
  interface GridActionsCellProps extends Omit<GridRenderCellParams, 'api'> {
4
5
  api?: GridRenderCellParams['api'];
5
6
  position?: GridMenuProps['position'];
7
+ children: React.ReactNode;
8
+ /**
9
+ * If true, the children passed to the component will not be validated.
10
+ * If false, only `GridActionsCellItem` and `React.Fragment` are allowed as children.
11
+ * Only use this prop if you know what you are doing.
12
+ * @default false
13
+ */
14
+ suppressChildrenValidation?: boolean;
6
15
  }
7
16
  declare function GridActionsCell(props: GridActionsCellProps): import("react/jsx-runtime").JSX.Element;
8
17
  declare namespace GridActionsCell {
@@ -14,21 +14,22 @@ var React = _interopRequireWildcard(require("react"));
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
  var _RtlProvider = require("@mui/system/RtlProvider");
16
16
  var _useId = _interopRequireDefault(require("@mui/utils/useId"));
17
+ var _warning = require("@mui/x-internals/warning");
17
18
  var _gridClasses = require("../../constants/gridClasses");
18
19
  var _GridMenu = require("../menu/GridMenu");
19
20
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
20
21
  var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
22
+ var _GridActionsCellItem = require("./GridActionsCellItem");
21
23
  var _jsxRuntime = require("react/jsx-runtime");
22
- const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
24
+ const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "children", "suppressChildrenValidation"];
23
25
  const hasActions = colDef => typeof colDef.getActions === 'function';
24
26
  function GridActionsCell(props) {
25
27
  const {
26
- colDef,
27
- id,
28
28
  hasFocus,
29
29
  tabIndex,
30
30
  position = 'bottom-end',
31
- focusElementRef
31
+ children,
32
+ suppressChildrenValidation
32
33
  } = props,
33
34
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
34
35
  const [focusedButtonIndex, setFocusedButtonIndex] = React.useState(-1);
@@ -42,12 +43,27 @@ function GridActionsCell(props) {
42
43
  const menuId = (0, _useId.default)();
43
44
  const buttonId = (0, _useId.default)();
44
45
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
45
- if (!hasActions(colDef)) {
46
- throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
47
- }
48
- const options = colDef.getActions(apiRef.current.getRowParams(id));
49
- const iconButtons = options.filter(option => !option.props.showInMenu);
50
- const menuButtons = options.filter(option => option.props.showInMenu);
46
+ const actions = [];
47
+ React.Children.forEach(children, child => {
48
+ // Unwrap React.Fragment
49
+ if (/*#__PURE__*/React.isValidElement(child)) {
50
+ if (child.type === React.Fragment) {
51
+ React.Children.forEach(child.props.children, fragChild => {
52
+ if (/*#__PURE__*/React.isValidElement(fragChild)) {
53
+ actions.push(fragChild);
54
+ }
55
+ });
56
+ } else if (child.type === _GridActionsCellItem.GridActionsCellItem || suppressChildrenValidation) {
57
+ actions.push(child);
58
+ } else {
59
+ const childType = typeof child.type === 'function' ? child.type.name : child.type;
60
+ (0, _warning.warnOnce)(`MUI X: Invalid child type in \`GridActionsCell\`. Expected \`GridActionsCellItem\` or \`React.Fragment\`, got \`${childType}\`.
61
+ If this is intentional, you can suppress this warning by passing the \`suppressChildrenValidation\` prop to \`GridActionsCell\`.`, 'error');
62
+ }
63
+ }
64
+ });
65
+ const iconButtons = actions.filter(option => !option.props.showInMenu);
66
+ const menuButtons = actions.filter(option => option.props.showInMenu);
51
67
  const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
52
68
  React.useLayoutEffect(() => {
53
69
  if (!hasFocus) {
@@ -70,22 +86,16 @@ function GridActionsCell(props) {
70
86
  preventScroll: true
71
87
  });
72
88
  }, [focusedButtonIndex]);
89
+ const firstFocusableButtonIndex = actions.findIndex(o => !o.props.disabled);
73
90
  React.useEffect(() => {
91
+ if (hasFocus && focusedButtonIndex === -1) {
92
+ setFocusedButtonIndex(firstFocusableButtonIndex);
93
+ }
74
94
  if (!hasFocus) {
75
95
  setFocusedButtonIndex(-1);
76
96
  ignoreCallToFocus.current = false;
77
97
  }
78
- }, [hasFocus]);
79
- React.useImperativeHandle(focusElementRef, () => ({
80
- focus() {
81
- // If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
82
- if (!ignoreCallToFocus.current) {
83
- // find the first focusable button and pass the index to the state
84
- const focusableButtonIndex = options.findIndex(o => !o.props.disabled);
85
- setFocusedButtonIndex(focusableButtonIndex);
86
- }
87
- }
88
- }), [options]);
98
+ }, [hasFocus, focusedButtonIndex, firstFocusableButtonIndex]);
89
99
  React.useEffect(() => {
90
100
  if (focusedButtonIndex >= numberOfButtons) {
91
101
  setFocusedButtonIndex(numberOfButtons - 1);
@@ -123,7 +133,7 @@ function GridActionsCell(props) {
123
133
  return;
124
134
  }
125
135
  const getNewIndex = (index, direction) => {
126
- if (index < 0 || index > options.length) {
136
+ if (index < 0 || index > actions.length) {
127
137
  return index;
128
138
  }
129
139
 
@@ -132,7 +142,7 @@ function GridActionsCell(props) {
132
142
  const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
133
143
 
134
144
  // if the button that should receive focus is disabled go one more step
135
- return options[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
145
+ return actions[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
136
146
  };
137
147
  let newIndex = focusedButtonIndex;
138
148
  if (event.key === 'ArrowRight') {
@@ -209,6 +219,7 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
209
219
  * The mode of the cell.
210
220
  */
211
221
  cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
222
+ children: _propTypes.default.node.isRequired,
212
223
  /**
213
224
  * The column of the row that the current cell belongs to.
214
225
  */
@@ -217,16 +228,6 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
217
228
  * The column field of the cell that triggered the event.
218
229
  */
219
230
  field: _propTypes.default.string.isRequired,
220
- /**
221
- * A ref allowing to set imperative focus.
222
- * It can be passed to the element that should receive focus.
223
- * @ignore - do not document.
224
- */
225
- focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
226
- current: _propTypes.default.shape({
227
- focus: _propTypes.default.func.isRequired
228
- })
229
- })]),
230
231
  /**
231
232
  * The cell value formatted with the column valueFormatter.
232
233
  */
@@ -262,6 +263,25 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
262
263
  */
263
264
  value: _propTypes.default.any
264
265
  } : void 0;
265
- const renderActionsCell = params => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridActionsCell, (0, _extends2.default)({}, params));
266
+ // Temporary wrapper for backward compatibility.
267
+ // Only used to support `getActions` method in `GridColDef`.
268
+ // TODO(v9): Remove this wrapper and the default `renderCell` in gridActionsColDef
269
+ function GridActionsCellWrapper(props) {
270
+ const {
271
+ colDef,
272
+ id
273
+ } = props;
274
+ const apiRef = (0, _useGridApiContext.useGridApiContext)();
275
+ if (!hasActions(colDef)) {
276
+ throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
277
+ }
278
+ const actions = colDef.getActions(apiRef.current.getRowParams(id));
279
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridActionsCell, (0, _extends2.default)({
280
+ suppressChildrenValidation: true
281
+ }, props, {
282
+ children: actions
283
+ }));
284
+ }
285
+ const renderActionsCell = params => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridActionsCellWrapper, (0, _extends2.default)({}, params));
266
286
  exports.renderActionsCell = renderActionsCell;
267
287
  if (process.env.NODE_ENV !== "production") renderActionsCell.displayName = "renderActionsCell";
@@ -77,16 +77,6 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
77
77
  * The column field of the cell that triggered the event.
78
78
  */
79
79
  field: _propTypes.default.string.isRequired,
80
- /**
81
- * A ref allowing to set imperative focus.
82
- * It can be passed to the element that should receive focus.
83
- * @ignore - do not document.
84
- */
85
- focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
86
- current: _propTypes.default.shape({
87
- focus: _propTypes.default.func.isRequired
88
- })
89
- })]),
90
80
  /**
91
81
  * The cell value formatted with the column valueFormatter.
92
82
  */
@@ -21,6 +21,7 @@ var _RtlProvider = require("@mui/system/RtlProvider");
21
21
  var _forwardRef = require("@mui/x-internals/forwardRef");
22
22
  var _store = require("@mui/x-internals/store");
23
23
  var _xVirtualizer = require("@mui/x-virtualizer");
24
+ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
24
25
  var _doesSupportPreventScroll = require("../../utils/doesSupportPreventScroll");
25
26
  var _gridClasses = require("../../constants/gridClasses");
26
27
  var _models = require("../../models");
@@ -142,8 +143,7 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
142
143
  isEditable = false,
143
144
  value
144
145
  } = cellParams;
145
- const canManageOwnFocus = column.type === 'actions' && 'getActions' in column && typeof column.getActions === 'function' && column.getActions(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
146
- const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParams.tabIndex : -1;
146
+ const tabIndex = (cellMode === 'view' || !isEditable) && column.type !== 'actions' ? cellParams.tabIndex : -1;
147
147
  const {
148
148
  classes: rootClasses,
149
149
  getCellClassName
@@ -167,7 +167,6 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
167
167
  const valueToRender = cellParams.formattedValue ?? value;
168
168
  const cellRef = React.useRef(null);
169
169
  const handleRef = (0, _useForkRef.default)(ref, cellRef);
170
- const focusElementRef = React.useRef(null);
171
170
  const isSelectionMode = rootProps.cellSelection ?? false;
172
171
  const ownerState = {
173
172
  align,
@@ -231,14 +230,14 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
231
230
  }
232
231
  return cellStyle;
233
232
  }, [width, isNotVisible, styleProp, pinnedOffset, pinnedPosition, isRtl, rowSpan]);
234
- React.useEffect(() => {
233
+ (0, _useEnhancedEffect.default)(() => {
235
234
  if (!hasFocus || cellMode === _models.GridCellModes.Edit) {
236
235
  return;
237
236
  }
238
237
  const doc = (0, _ownerDocument.default)(apiRef.current.rootElementRef.current);
239
238
  if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
240
239
  const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
241
- const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
240
+ const elementToFocus = focusableElement || cellRef.current;
242
241
  if ((0, _doesSupportPreventScroll.doesSupportPreventScroll)()) {
243
242
  elementToFocus.focus({
244
243
  preventScroll: true
@@ -299,11 +298,6 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
299
298
  children = valueString;
300
299
  title = valueString;
301
300
  }
302
- if (/*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
303
- children = /*#__PURE__*/React.cloneElement(children, {
304
- focusElementRef
305
- });
306
- }
307
301
  const draggableEventHandlers = disableDragEvents ? null : {
308
302
  onDragEnter: publish('cellDragEnter', onDragEnter),
309
303
  onDragOver: publish('cellDragOver', onDragOver)
@@ -85,7 +85,7 @@ function GridColumnHeaderItem(props) {
85
85
  const columnMenuButtonId = (0, _useId.default)();
86
86
  const iconButtonRef = React.useRef(null);
87
87
  const [showColumnMenuIcon, setShowColumnMenuIcon] = React.useState(columnMenuOpen);
88
- const isDraggable = React.useMemo(() => !rootProps.disableColumnReorder && !disableReorder && !colDef.disableReorder, [rootProps.disableColumnReorder, disableReorder, colDef.disableReorder]);
88
+ const isDraggable = !rootProps.disableColumnReorder && !disableReorder && !colDef.disableReorder;
89
89
  let headerComponent;
90
90
  if (colDef.renderHeader) {
91
91
  headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
@@ -131,7 +131,7 @@ function GridColumnHeaderItem(props) {
131
131
  onDoubleClick: publish('columnSeparatorDoubleClick')
132
132
  }), [publish]);
133
133
  React.useEffect(() => {
134
- if (!showColumnMenuIcon) {
134
+ if (!showColumnMenuIcon && columnMenuOpen) {
135
135
  setShowColumnMenuIcon(columnMenuOpen);
136
136
  }
137
137
  }, [showColumnMenuIcon, columnMenuOpen]);
@@ -11,7 +11,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _clsx = _interopRequireDefault(require("clsx"));
14
15
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
16
+ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
15
17
  var _forwardRef = require("@mui/x-internals/forwardRef");
16
18
  var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
17
19
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
@@ -43,7 +45,19 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = (0, _for
43
45
  classes: rootProps.classes
44
46
  };
45
47
  const classes = useUtilityClasses(ownerState);
48
+ const {
49
+ isIndeterminate,
50
+ isChecked,
51
+ isSelectable
52
+ } = (0, _useGridSelector.useGridSelector)(apiRef, _utils.checkboxPropsSelector, {
53
+ groupId: id,
54
+ autoSelectParents: rootProps.rowSelectionPropagation?.parents ?? false
55
+ });
56
+ const disabled = !isSelectable;
46
57
  const handleChange = event => {
58
+ if (disabled) {
59
+ return;
60
+ }
47
61
  const params = {
48
62
  value: event.target.checked,
49
63
  id
@@ -58,20 +72,26 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = (0, _for
58
72
  }
59
73
  }
60
74
  }, [apiRef, tabIndex, id, field]);
61
- const handleKeyDown = React.useCallback(event => {
75
+ const handleKeyDown = (0, _useEventCallback.default)(event => {
62
76
  if (event.key === ' ') {
63
77
  // We call event.stopPropagation to avoid selecting the row and also scrolling to bottom
64
78
  // TODO: Remove and add a check inside useGridKeyboardNavigation
65
79
  event.stopPropagation();
66
80
  }
67
- }, []);
68
- const isSelectable = apiRef.current.isRowSelectable(id);
69
- const {
70
- isIndeterminate,
71
- isChecked
72
- } = (0, _useGridSelector.useGridSelector)(apiRef, _utils.checkboxPropsSelector, {
73
- groupId: id,
74
- autoSelectParents: rootProps.rowSelectionPropagation?.parents ?? false
81
+ if (disabled) {
82
+ return;
83
+ }
84
+ });
85
+ const handleClick = (0, _useEventCallback.default)(event => {
86
+ if (disabled) {
87
+ event.preventDefault();
88
+ return;
89
+ }
90
+ });
91
+ const handleMouseDown = (0, _useEventCallback.default)(() => {
92
+ if (disabled) {
93
+ return;
94
+ }
75
95
  });
76
96
  if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
77
97
  return null;
@@ -81,16 +101,21 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = (0, _for
81
101
  tabIndex: tabIndex,
82
102
  checked: isChecked && !isIndeterminate,
83
103
  onChange: handleChange,
84
- className: classes.root,
104
+ onClick: handleClick,
105
+ onMouseDown: handleMouseDown,
106
+ className: (0, _clsx.default)(classes.root, disabled && 'Mui-disabled'),
107
+ material: {
108
+ disableRipple: disabled
109
+ },
85
110
  slotProps: {
86
111
  htmlInput: {
112
+ 'aria-disabled': disabled || undefined,
87
113
  'aria-label': label,
88
114
  name: 'select_row'
89
115
  }
90
116
  },
91
117
  onKeyDown: handleKeyDown,
92
- indeterminate: isIndeterminate,
93
- disabled: !isSelectable
118
+ indeterminate: isIndeterminate
94
119
  }, rootProps.slotProps?.baseCheckbox, other, {
95
120
  ref: ref
96
121
  }));
@@ -117,16 +142,6 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
117
142
  * The column field of the cell that triggered the event.
118
143
  */
119
144
  field: _propTypes.default.string.isRequired,
120
- /**
121
- * A ref allowing to set imperative focus.
122
- * It can be passed to the element that should receive focus.
123
- * @ignore - do not document.
124
- */
125
- focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
126
- current: _propTypes.default.shape({
127
- focus: _propTypes.default.func.isRequired
128
- })
129
- })]),
130
145
  /**
131
146
  * The cell value formatted with the column valueFormatter.
132
147
  */
@@ -21,7 +21,7 @@ const separatorIconDragStyles = {
21
21
  // Emotion thinks it knows better than us which selector we should use.
22
22
  // https://github.com/emotion-js/emotion/issues/1105#issuecomment-1722524968
23
23
  const ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
24
- const shouldShowBorderTopRightRadiusSelector = apiRef => apiRef.current.state.dimensions.hasScrollX && (!apiRef.current.state.dimensions.hasScrollY || apiRef.current.state.dimensions.scrollbarSize === 0);
24
+ 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);
25
25
  const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
26
26
  name: 'MuiDataGrid',
27
27
  slot: 'Root',
@@ -36,7 +36,7 @@ const ToolbarRoot = (0, _system.styled)('div', {
36
36
  name: 'MuiDataGrid',
37
37
  slot: 'Toolbar'
38
38
  })({
39
- flex: 0,
39
+ flex: '0 1 1px',
40
40
  display: 'flex',
41
41
  alignItems: 'center',
42
42
  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 };
@@ -6,7 +6,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
- exports.ScrollbarCorner = exports.GridVirtualScrollbar = void 0;
9
+ exports.scrollbarSizeCssExpression = exports.ScrollbarCorner = exports.GridVirtualScrollbar = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _system = require("@mui/system");
12
12
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
@@ -29,6 +29,12 @@ const useUtilityClasses = (ownerState, position) => {
29
29
  };
30
30
  return (0, _composeClasses.default)(slots, _gridClasses.getDataGridUtilityClass, classes);
31
31
  };
32
+
33
+ // In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
34
+ // their size to be 0px throughout all the calculations, but the floating scrollbar container does need
35
+ // to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
36
+ // don't have a method to find the required size for scrollbars on those platforms.
37
+ const scrollbarSizeCssExpression = exports.scrollbarSizeCssExpression = 'calc(max(var(--DataGrid-scrollbarSize), 14px))';
32
38
  const Scrollbar = (0, _system.styled)('div')({
33
39
  position: 'absolute',
34
40
  display: 'inline-block',
@@ -36,11 +42,7 @@ const Scrollbar = (0, _system.styled)('div')({
36
42
  '&:hover': {
37
43
  zIndex: 70
38
44
  },
39
- // In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
40
- // their size to be 0px throughout all the calculations, but the floating scrollbar container does need
41
- // to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
42
- // don't have a method to find the required size for scrollbars on those platforms.
43
- '--size': 'calc(max(var(--DataGrid-scrollbarSize), 14px))'
45
+ '--size': scrollbarSizeCssExpression
44
46
  });
45
47
  const ScrollbarVertical = (0, _system.styled)(Scrollbar)({
46
48
  width: 'var(--size)',
@@ -72,7 +74,10 @@ const ScrollbarCorner = exports.ScrollbarCorner = (0, _system.styled)(Scrollbar)
72
74
  height: 'var(--size)',
73
75
  right: 0,
74
76
  bottom: 0,
75
- overflow: 'scroll'
77
+ overflow: 'scroll',
78
+ '@media print': {
79
+ display: 'none'
80
+ }
76
81
  });
77
82
  const GridVirtualScrollbar = exports.GridVirtualScrollbar = (0, _forwardRef.forwardRef)(function GridVirtualScrollbar(props, ref) {
78
83
  const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
@@ -101,7 +106,7 @@ const GridVirtualScrollbar = exports.GridVirtualScrollbar = (0, _forwardRef.forw
101
106
  return;
102
107
  }
103
108
  isLocked.current = true;
104
- scrollbar[propertyScroll] = scrollPosition[propertyScrollPosition];
109
+ scrollbar[propertyScroll] = props.scrollPosition.current[propertyScrollPosition];
105
110
  });
106
111
  const onScrollbarScroll = (0, _useEventCallback.default)(() => {
107
112
  const scroller = apiRef.current.virtualScrollerRef.current;
@@ -27,6 +27,7 @@ var _GridVirtualScrollerRenderZone = require("./GridVirtualScrollerRenderZone");
27
27
  var _GridVirtualScrollbar = require("./GridVirtualScrollbar");
28
28
  var _GridScrollShadows = require("../GridScrollShadows");
29
29
  var _GridOverlays = require("../base/GridOverlays");
30
+ var _useGridVirtualizer = require("../../hooks/core/useGridVirtualizer");
30
31
  var _jsxRuntime = require("react/jsx-runtime");
31
32
  const useUtilityClasses = ownerState => {
32
33
  const {
@@ -90,7 +91,7 @@ function GridVirtualScroller(props) {
90
91
  loadingOverlayVariant
91
92
  };
92
93
  const classes = useUtilityClasses(ownerState);
93
- const virtualScroller = apiRef.current.virtualizer.api.useVirtualization().getters;
94
+ const virtualScroller = (0, _useGridVirtualizer.useGridVirtualizer)().api.getters;
94
95
  const {
95
96
  getContainerProps,
96
97
  getScrollerProps,
@@ -44,7 +44,7 @@ const GridVirtualScrollerRenderZone = exports.GridVirtualScrollerRenderZone = (0
44
44
  const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
45
45
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
46
46
  const classes = useUtilityClasses(rootProps);
47
- const offsetTop = apiRef.current.virtualizer.api.useVirtualization().getters.getOffsetTop();
47
+ const offsetTop = apiRef.current.virtualizer.api.getters.getOffsetTop();
48
48
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerRenderZoneRoot, (0, _extends2.default)({
49
49
  className: (0, _clsx.default)(classes.root, className),
50
50
  ownerState: rootProps,