@mui/x-data-grid 5.11.1 → 5.12.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 (140) hide show
  1. package/CHANGELOG.md +95 -18
  2. package/DataGrid/DataGrid.js +26 -1
  3. package/README.md +2 -2
  4. package/components/GridRow.d.ts +1 -1
  5. package/components/GridRow.js +51 -12
  6. package/components/cell/GridActionsCellItem.d.ts +1 -1
  7. package/components/cell/GridCell.d.ts +2 -1
  8. package/components/cell/GridCell.js +12 -7
  9. package/components/columnHeaders/GridColumnHeaderItem.js +4 -3
  10. package/components/containers/GridRootStyles.js +4 -2
  11. package/components/menu/GridMenu.js +9 -2
  12. package/components/panel/GridColumnsPanel.js +10 -2
  13. package/components/panel/GridPanelWrapper.d.ts +1 -1
  14. package/components/panel/GridPanelWrapper.js +3 -3
  15. package/components/panel/filterPanel/GridFilterForm.d.ts +61 -4
  16. package/components/panel/filterPanel/GridFilterForm.js +88 -8
  17. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  18. package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -5
  19. package/components/panel/filterPanel/GridFilterPanel.js +24 -6
  20. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  21. package/constants/gridClasses.d.ts +4 -0
  22. package/constants/gridClasses.js +1 -1
  23. package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -0
  24. package/hooks/features/columns/useGridColumns.js +12 -14
  25. package/hooks/features/editRows/useGridCellEditing.new.js +11 -4
  26. package/hooks/features/editRows/useGridRowEditing.new.js +10 -4
  27. package/hooks/features/events/useGridEvents.d.ts +1 -1
  28. package/hooks/features/events/useGridEvents.js +2 -0
  29. package/hooks/features/filter/gridFilterUtils.d.ts +9 -1
  30. package/hooks/features/filter/gridFilterUtils.js +1 -2
  31. package/hooks/features/filter/useGridFilter.js +5 -5
  32. package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
  33. package/hooks/features/rows/useGridRowsMeta.js +107 -43
  34. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -0
  35. package/hooks/features/virtualization/useGridVirtualScroller.js +27 -7
  36. package/index.js +1 -1
  37. package/internals/index.d.ts +1 -0
  38. package/legacy/DataGrid/DataGrid.js +26 -1
  39. package/legacy/components/GridRow.js +56 -12
  40. package/legacy/components/cell/GridCell.js +12 -7
  41. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +6 -3
  42. package/legacy/components/containers/GridRootStyles.js +3 -2
  43. package/legacy/components/menu/GridMenu.js +9 -2
  44. package/legacy/components/panel/GridColumnsPanel.js +12 -2
  45. package/legacy/components/panel/GridPanelWrapper.js +3 -3
  46. package/legacy/components/panel/filterPanel/GridFilterForm.js +89 -8
  47. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  48. package/legacy/components/panel/filterPanel/GridFilterPanel.js +25 -6
  49. package/legacy/constants/gridClasses.js +1 -1
  50. package/legacy/hooks/features/columns/useGridColumns.js +12 -14
  51. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -7
  52. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +10 -4
  53. package/legacy/hooks/features/events/useGridEvents.js +2 -0
  54. package/legacy/hooks/features/filter/gridFilterUtils.js +1 -2
  55. package/legacy/hooks/features/filter/useGridFilter.js +5 -5
  56. package/legacy/hooks/features/rows/useGridRowsMeta.js +104 -41
  57. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +46 -22
  58. package/legacy/index.js +1 -1
  59. package/legacy/locales/heIL.js +9 -9
  60. package/legacy/locales/nbNO.js +127 -0
  61. package/legacy/locales/trTR.js +7 -7
  62. package/legacy/models/events/gridEvents.js +2 -0
  63. package/legacy/models/gridApiCaches.js +1 -0
  64. package/legacy/models/params/gridMenuParams.js +1 -0
  65. package/legacy/models/params/index.js +2 -1
  66. package/locales/heIL.js +9 -9
  67. package/locales/nbNO.d.ts +2 -0
  68. package/locales/nbNO.js +115 -0
  69. package/locales/trTR.js +7 -7
  70. package/models/api/gridCoreApi.d.ts +2 -6
  71. package/models/api/gridRowsMetaApi.d.ts +24 -0
  72. package/models/colDef/gridColDef.d.ts +3 -3
  73. package/models/events/gridEventLookup.d.ts +13 -1
  74. package/models/events/gridEvents.d.ts +3 -1
  75. package/models/events/gridEvents.js +2 -0
  76. package/models/gridApiCaches.d.ts +6 -0
  77. package/models/gridApiCaches.js +1 -0
  78. package/models/params/gridMenuParams.d.ts +7 -0
  79. package/models/params/gridMenuParams.js +1 -0
  80. package/models/params/gridRowParams.d.ts +1 -1
  81. package/models/params/index.d.ts +1 -0
  82. package/models/params/index.js +2 -1
  83. package/models/props/DataGridProps.d.ts +23 -1
  84. package/modern/DataGrid/DataGrid.js +26 -1
  85. package/modern/components/GridRow.js +51 -12
  86. package/modern/components/cell/GridCell.js +12 -7
  87. package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -3
  88. package/modern/components/containers/GridRootStyles.js +4 -2
  89. package/modern/components/menu/GridMenu.js +9 -2
  90. package/modern/components/panel/GridColumnsPanel.js +10 -2
  91. package/modern/components/panel/GridPanelWrapper.js +3 -3
  92. package/modern/components/panel/filterPanel/GridFilterForm.js +88 -8
  93. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  94. package/modern/components/panel/filterPanel/GridFilterPanel.js +24 -6
  95. package/modern/constants/gridClasses.js +1 -1
  96. package/modern/hooks/features/columns/useGridColumns.js +11 -13
  97. package/modern/hooks/features/editRows/useGridCellEditing.new.js +10 -3
  98. package/modern/hooks/features/editRows/useGridRowEditing.new.js +9 -3
  99. package/modern/hooks/features/events/useGridEvents.js +2 -0
  100. package/modern/hooks/features/filter/gridFilterUtils.js +1 -2
  101. package/modern/hooks/features/filter/useGridFilter.js +5 -5
  102. package/modern/hooks/features/rows/useGridRowsMeta.js +105 -37
  103. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +27 -7
  104. package/modern/index.js +1 -1
  105. package/modern/locales/heIL.js +9 -9
  106. package/modern/locales/nbNO.js +115 -0
  107. package/modern/locales/trTR.js +7 -7
  108. package/modern/models/events/gridEvents.js +2 -0
  109. package/modern/models/gridApiCaches.js +1 -0
  110. package/modern/models/params/gridMenuParams.js +1 -0
  111. package/modern/models/params/index.js +2 -1
  112. package/node/DataGrid/DataGrid.js +26 -1
  113. package/node/components/GridRow.js +53 -12
  114. package/node/components/cell/GridCell.js +12 -7
  115. package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -3
  116. package/node/components/containers/GridRootStyles.js +4 -2
  117. package/node/components/menu/GridMenu.js +10 -2
  118. package/node/components/panel/GridColumnsPanel.js +10 -2
  119. package/node/components/panel/GridPanelWrapper.js +5 -3
  120. package/node/components/panel/filterPanel/GridFilterForm.js +91 -9
  121. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  122. package/node/components/panel/filterPanel/GridFilterPanel.js +26 -6
  123. package/node/constants/gridClasses.js +1 -1
  124. package/node/hooks/features/columns/useGridColumns.js +12 -14
  125. package/node/hooks/features/editRows/useGridCellEditing.new.js +11 -4
  126. package/node/hooks/features/editRows/useGridRowEditing.new.js +10 -4
  127. package/node/hooks/features/events/useGridEvents.js +2 -0
  128. package/node/hooks/features/filter/gridFilterUtils.js +2 -1
  129. package/node/hooks/features/filter/useGridFilter.js +4 -4
  130. package/node/hooks/features/rows/useGridRowsMeta.js +107 -43
  131. package/node/hooks/features/virtualization/useGridVirtualScroller.js +27 -7
  132. package/node/index.js +1 -1
  133. package/node/locales/heIL.js +9 -9
  134. package/node/locales/nbNO.js +125 -0
  135. package/node/locales/trTR.js +7 -7
  136. package/node/models/events/gridEvents.js +2 -0
  137. package/node/models/gridApiCaches.js +5 -0
  138. package/node/models/params/gridMenuParams.js +5 -0
  139. package/node/models/params/index.js +13 -0
  140. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,85 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## v5.12.0
7
+
8
+ _May 31, 2022_
9
+
10
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
13
+
14
+ <img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
15
+
16
+ - ⚠️ Remove deprecated row grouping feature from `@mui/x-data-grid-pro`
17
+
18
+ Row grouping is available through the `@mui/x-data-grid-premium` package - see [Premium plan release blogpost](https://mui.com/blog/premium-plan-release/).
19
+
20
+ - 🐞 Bug fixes and improvements
21
+
22
+ ### `@mui/x-data-grid@v5.12.0` / `@mui/x-data-grid-pro@v5.12.0` / `@mui/x-data-grid-premium@v5.12.0`
23
+
24
+ - [DataGrid] Support dynamic row height (#4859) @m4theushw
25
+ - [DataGrid] Add `onMenuOpen` and `onMenuClose` props (#4825) @DanailH
26
+ - [DataGrid] Add generics to `GridActionsColDef` to match `GridColDef` (#4982) @subvertallchris
27
+ - [DataGrid] Disable drag event handlers when row or column reorder are disabled (#4857) @DanailH
28
+ - [DataGrid] Allow other attempts to stop edit mode if the first failed (#5016) @m4theushw
29
+ - [DataGrid] Better reflect the dependency on Material UI (#4795) @oliviertassinari
30
+ - [DataGrid] Add an id to the filter item created when opening the filter panel (#5014) @flaviendelangle
31
+ - [DataGrid] Use column visibility model on Hide All / Show All when enabled (#5050) @flaviendelangle
32
+ - [DataGridPro] Unpin columns back to original position (#4512) @m4theushw
33
+ - [DataGridPro] Remove experimental row grouping from Pro plan (#4949) @flaviendelangle
34
+ - [DataGridPro] Allow to scroll detail panel content if it overflows the panel (#4979) @cherniavskii
35
+ - [DataGridPro] Do not call `setRowIndex` when dragging a column over a row (#4987) @flaviendelangle
36
+ - [l10n] Add Norwegian (Bokmål) (nb-NO) locale (#5001) @spiftire
37
+ - [l10n] Add Turkish (tr-TR) locale (#5026) @Rassilion
38
+
39
+ ### `@mui/x-date-pickers@5.0.0-alpha.5` / `@mui/x-date-pickers-pro@5.0.0-alpha.5`
40
+
41
+ #### Breaking changes
42
+
43
+ - [pickers] Restructure props in `MonthPicker` / `YearPicker` and `DayPicker` (#4814) @flaviendelangle
44
+
45
+ The props of `MonthPicker` / `YearPicker` and `DayPicker` have been reworked to make them more consistent for a standalone usage (#4814) @flaviendelangle
46
+
47
+ **MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
48
+
49
+ **YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
50
+
51
+ **DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
52
+
53
+ #### Changes
54
+
55
+ - [pickers] Add German (de-DE) translations (#4974) @felixh10r
56
+ - [pickers] Support action bar on static pickers and improve typing (#5015) @flaviendelangle
57
+
58
+ ### Docs
59
+
60
+ - [docs] Add docs sections / pages for upcoming features on pickers (#4603) @flaviendelangle
61
+ - [docs] Add docs for filter panel components (#4919) @m4theushw
62
+ - [docs] Explain how to manage focus with `renderCell` (#4254) @alexfauquette
63
+ - [docs] Fix broken links to GitHub source (#5003) @Edwardveb
64
+ - [docs] Fix navigation links (#4956) @oliviertassinari
65
+ - [docs] Fix typo on rows docs (#4952) @jamesRadicl
66
+ - [docs] New WAI-ARIA guidelines location (#4957) @oliviertassinari
67
+ - [docs] Add "Slots" section to the right nav in the API pages (#4993) @DanailH
68
+ - [docs] Fix docs feedback widget not working (#4905) @cherniavskii
69
+ - [docs] Replace custom notes and warning with callouts (#5008) @flaviendelangle
70
+
71
+ ### Core
72
+
73
+ - [core] Avoid Order ID to refer to GitHub issues/PRs (#5005) @oliviertassinari
74
+ - [core] Improve the workflow for incomplete issues (#5012) @mnajdova
75
+ - [core] Remove dead code on row grouping tree creation (#4945) @flaviendelangle
76
+ - [core] Use new cache api for the row grouping last model tracking (#4980) @flaviendelangle
77
+ - [core] Ensure that PRs have atleast 1 label (#5011) @DanailH
78
+ - [core] Fix trailing-space @oliviertassinari
79
+ - [core] Stop Renovate PR updates when PR is on hold (#5020) @cherniavskii
80
+ - [license] Remove support for UTF-8 (#4893) @oliviertassinari
81
+ - [license] Tweak error messages (#4907) @mbrookes
82
+ - [test] Skip Safari and Firefox on broken tests (#4994) @alexfauquette
83
+ - [test] Make argos screenshots stable (#5061) @m4theushw
84
+
6
85
  ## v5.11.1
7
86
 
8
87
  _May 20, 2022_
@@ -38,30 +117,28 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
38
117
 
39
118
  To decide which button must be displayed and in which order, you can now use the `actions` prop of the `actionBar` component slot props.
40
119
 
41
- ```jsx
42
- <DatePicker
43
- componentsProps={{
44
- actionBar: {
45
- // The actions will be the same between desktop and mobile
46
- actions: ['clear'],
120
+ ```jsx
121
+ <DatePicker
122
+ componentsProps={{
123
+ actionBar: {
124
+ // The actions will be the same between desktop and mobile
125
+ actions: ['clear'],
47
126
 
48
- // The actions will be different between desktop and mobile
49
- actions: (variant) => variant === 'desktop' ? [] : ['clear'],
50
- }
51
- }}
52
- />
53
- ```
127
+ // The actions will be different between desktop and mobile
128
+ actions: (variant) => (variant === 'desktop' ? [] : ['clear']),
129
+ },
130
+ }}
131
+ />
132
+ ```
54
133
 
55
134
  The build-in `ActionBar` component supports 4 different actions: `'clear'`, `'cancel'`, `'accept'`, and `'today'`.
56
135
  By default, the pickers will render the cancel and accept button on mobile and no action on desktop.
57
136
 
58
137
  If you need other actions, you can provide your own component to the `ActionBar` component slot
59
138
 
60
- ```jsx
61
- <DatePicker
62
- components={{ ActionBar: CustomActionBar }}
63
- />
64
- ```
139
+ ```jsx
140
+ <DatePicker components={{ ActionBar: CustomActionBar }} />
141
+ ```
65
142
 
66
143
  #### Changes
67
144
 
@@ -121,7 +198,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
121
198
 
122
199
  - 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
123
200
 
124
- - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation]( https://mui.com/x/react-data-grid/filtering/#quick-filter).
201
+ - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter).
125
202
 
126
203
  <img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
127
204
 
@@ -229,6 +229,15 @@ DataGridRaw.propTypes = {
229
229
  */
230
230
  getDetailPanelContent: PropTypes.func,
231
231
 
232
+ /**
233
+ * Function that returns the estimated height for a row.
234
+ * Only works if dynamic row height is used.
235
+ * Once the row height is measured this value is discarded.
236
+ * @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
237
+ * @returns {number | null} The estimated row height value. If `null` or `undefined` then the default row height, based on the density, is applied.
238
+ */
239
+ getEstimatedRowHeight: PropTypes.func,
240
+
232
241
  /**
233
242
  * Function that applies CSS classes dynamically on rows.
234
243
  * @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
@@ -239,7 +248,7 @@ DataGridRaw.propTypes = {
239
248
  /**
240
249
  * Function that sets the row height per row.
241
250
  * @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
242
- * @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
251
+ * @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied. If "auto" then the row height is calculated based on the content.
243
252
  */
244
253
  getRowHeight: PropTypes.func,
245
254
 
@@ -506,6 +515,22 @@ DataGridRaw.propTypes = {
506
515
  */
507
516
  onFilterModelChange: PropTypes.func,
508
517
 
518
+ /**
519
+ * Callback fired when the menu is closed.
520
+ * @param {GridMenuParams} params With all properties from [[GridMenuParams]].
521
+ * @param {MuiEvent<{}>} event The event object.
522
+ * @param {GridCallbackDetails} details Additional details for this callback.
523
+ */
524
+ onMenuClose: PropTypes.func,
525
+
526
+ /**
527
+ * Callback fired when the menu is opened.
528
+ * @param {GridMenuParams} params With all properties from [[GridMenuParams]].
529
+ * @param {MuiEvent<{}>} event The event object.
530
+ * @param {GridCallbackDetails} details Additional details for this callback.
531
+ */
532
+ onMenuOpen: PropTypes.func,
533
+
509
534
  /**
510
535
  * Callback fired when the current page has changed.
511
536
  * @param {number} page Index of the page displayed on the Grid.
package/README.md CHANGED
@@ -19,8 +19,8 @@ This component has the following peer dependencies that you will need to install
19
19
 
20
20
  ```json
21
21
  "peerDependencies": {
22
- "@mui/material": "^5.2.8",
23
- "@mui/system": "^5.2.8",
22
+ "@mui/material": "^5.4.1",
23
+ "@mui/system": "^5.4.1",
24
24
  "react": "^17.0.2 || ^18.0.0"
25
25
  },
26
26
  ```
@@ -11,7 +11,7 @@ export interface GridRowProps {
11
11
  * If some rows above have expanded children, this index also take those children into account.
12
12
  */
13
13
  index: number;
14
- rowHeight: number;
14
+ rowHeight: number | 'auto';
15
15
  containerWidth: number;
16
16
  row: GridRowModel;
17
17
  firstColumnToRender: number;
@@ -20,6 +20,8 @@ import { findParentElementFromClassName } from '../utils/domUtils';
20
20
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
21
21
  import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
22
22
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
23
+ import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
24
+ import { gridRowTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
23
25
  import { jsx as _jsx } from "react/jsx-runtime";
24
26
  import { jsxs as _jsxs } from "react/jsx-runtime";
25
27
 
@@ -29,25 +31,24 @@ const useUtilityClasses = ownerState => {
29
31
  editing,
30
32
  selected,
31
33
  isLastVisible,
34
+ rowHeight,
32
35
  classes
33
36
  } = ownerState;
34
37
  const slots = {
35
- root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isLastVisible && 'row--lastVisible']
38
+ root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight']
36
39
  };
37
40
  return composeClasses(slots, getDataGridUtilityClass, classes);
38
41
  };
39
42
 
40
43
  const EmptyCell = ({
41
- width,
42
- height
44
+ width
43
45
  }) => {
44
- if (!width || !height) {
46
+ if (!width) {
45
47
  return null;
46
48
  }
47
49
 
48
50
  const style = {
49
- width,
50
- height
51
+ width
51
52
  };
52
53
  return /*#__PURE__*/_jsx("div", {
53
54
  className: "MuiDataGrid-cell",
@@ -84,9 +85,12 @@ function GridRow(props) {
84
85
  const ariaRowIndex = index + 2; // 1 for the header row and 1 as it's 1-based
85
86
 
86
87
  const apiRef = useGridApiContext();
88
+ const ref = React.useRef(null);
87
89
  const rootProps = useGridRootProps();
88
90
  const currentPage = useGridVisibleRows(apiRef, rootProps);
89
91
  const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
92
+ const sortModel = useGridSelector(apiRef, gridSortModelSelector);
93
+ const treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
90
94
  const {
91
95
  hasScrollX,
92
96
  hasScrollY
@@ -99,9 +103,41 @@ function GridRow(props) {
99
103
  isLastVisible,
100
104
  classes: rootProps.classes,
101
105
  editing: apiRef.current.getRowMode(rowId) === GridRowModes.Edit,
102
- editable: rootProps.editMode === GridEditModes.Row
106
+ editable: rootProps.editMode === GridEditModes.Row,
107
+ rowHeight
103
108
  };
104
109
  const classes = useUtilityClasses(ownerState);
110
+ React.useLayoutEffect(() => {
111
+ if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
112
+ // Fallback for IE
113
+ apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
114
+ }
115
+ });
116
+ React.useLayoutEffect(() => {
117
+ if (currentPage.range) {
118
+ // The index prop is relative to the rows from all pages. As example, the index prop of the
119
+ // first row is 5 if pageSize=5 and page=1. However, the index used by the virtualization
120
+ // doesn't care about pagination and considers the rows from the current page only, so the
121
+ // first row always has index=0. We need to subtract the index of the first row to make it
122
+ // compatible with the index used by the virtualization.
123
+ apiRef.current.unstable_setLastMeasuredRowIndex(index - currentPage.range.firstRowIndex);
124
+ }
125
+
126
+ const rootElement = ref.current;
127
+ const hasFixedHeight = rowHeight !== 'auto';
128
+
129
+ if (!rootElement || hasFixedHeight || typeof ResizeObserver === 'undefined') {
130
+ return undefined;
131
+ }
132
+
133
+ const resizeObserver = new ResizeObserver(entries => {
134
+ const [entry] = entries;
135
+ const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
136
+ apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
137
+ });
138
+ resizeObserver.observe(rootElement);
139
+ return () => resizeObserver.disconnect();
140
+ }, [apiRef, currentPage.range, index, rowHeight, rowId]);
105
141
  const publish = React.useCallback((eventName, propHandler) => event => {
106
142
  // Ignore portal
107
143
  // The target is not an element when triggered by a Select inside the cell
@@ -159,7 +195,8 @@ function GridRow(props) {
159
195
  }, [apiRef, onClick, publish, rowId]);
160
196
 
161
197
  const style = _extends({}, styleProp, {
162
- maxHeight: rowHeight,
198
+ maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
199
+ // max-height doesn't support "auto"
163
200
  minHeight: rowHeight
164
201
  });
165
202
 
@@ -199,6 +236,7 @@ function GridRow(props) {
199
236
  const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
200
237
  const cellParams = apiRef.current.getCellParams(rowId, column.field);
201
238
  const classNames = [];
239
+ const disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
202
240
 
203
241
  if (column.cellClassName) {
204
242
  classNames.push(clsx(typeof column.cellClassName === 'function' ? column.cellClassName(cellParams) : column.cellClassName));
@@ -269,7 +307,8 @@ function GridRow(props) {
269
307
  hasFocus: hasFocus,
270
308
  tabIndex: tabIndex,
271
309
  className: clsx(classNames),
272
- colSpan: colSpan
310
+ colSpan: colSpan,
311
+ disableDragEvents: disableDragEvents
273
312
  }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
274
313
  children: content
275
314
  }), column.field));
@@ -278,6 +317,7 @@ function GridRow(props) {
278
317
 
279
318
  const emptyCellWidth = containerWidth - columnsTotalWidth;
280
319
  return /*#__PURE__*/_jsxs("div", _extends({
320
+ ref: ref,
281
321
  "data-id": rowId,
282
322
  "data-rowindex": index,
283
323
  role: "row",
@@ -291,8 +331,7 @@ function GridRow(props) {
291
331
  onMouseLeave: publish('rowMouseLeave', onMouseLeave)
292
332
  }, other, {
293
333
  children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
294
- width: emptyCellWidth,
295
- height: rowHeight
334
+ width: emptyCellWidth
296
335
  })]
297
336
  }));
298
337
  }
@@ -317,7 +356,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
317
356
  lastColumnToRender: PropTypes.number.isRequired,
318
357
  renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
319
358
  row: PropTypes.any.isRequired,
320
- rowHeight: PropTypes.number.isRequired,
359
+ rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
321
360
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
322
361
  selected: PropTypes.bool.isRequired,
323
362
  visibleColumns: PropTypes.arrayOf(PropTypes.object).isRequired
@@ -75,5 +75,5 @@ declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Pick<{
75
75
  touchRippleRef?: React.Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
76
76
  }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof React.LiHTMLAttributes<HTMLLIElement>> & {
77
77
  ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
78
- }, "dense" | "disabled" | "children" | "action" | "autoFocus" | "tabIndex" | "selected" | "sx" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters">, "hidden" | "color" | "dense" | "icon" | "translate" | "disabled" | "label" | "slot" | "title" | "children" | "key" | "action" | "autoFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "selected" | "value" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters" | "showInMenu">) & React.RefAttributes<HTMLButtonElement>>;
78
+ }, "dense" | "disabled" | "children" | "action" | "autoFocus" | "tabIndex" | "selected" | "sx" | "disableGutters" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef">, "hidden" | "color" | "dense" | "icon" | "translate" | "disabled" | "label" | "slot" | "title" | "children" | "key" | "action" | "autoFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "selected" | "value" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "disableGutters" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "showInMenu">) & React.RefAttributes<HTMLButtonElement>>;
79
79
  export { GridActionsCellItem };
@@ -9,7 +9,7 @@ export interface GridCellProps<V = any, F = V> {
9
9
  rowId: GridRowId;
10
10
  formattedValue?: F;
11
11
  hasFocus?: boolean;
12
- height: number;
12
+ height: number | 'auto';
13
13
  isEditable?: boolean;
14
14
  showRightBorder?: boolean;
15
15
  value?: V;
@@ -18,6 +18,7 @@ export interface GridCellProps<V = any, F = V> {
18
18
  children: React.ReactNode;
19
19
  tabIndex: 0 | -1;
20
20
  colSpan?: number;
21
+ disableDragEvents?: boolean;
21
22
  onClick?: React.MouseEventHandler<HTMLDivElement>;
22
23
  onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
23
24
  onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
3
+ const _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
4
4
 
5
5
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
6
6
  import * as React from 'react';
@@ -67,6 +67,7 @@ function GridCell(props) {
67
67
  className,
68
68
  showRightBorder,
69
69
  colSpan,
70
+ disableDragEvents,
70
71
  onClick,
71
72
  onDoubleClick,
72
73
  onMouseDown,
@@ -119,7 +120,8 @@ function GridCell(props) {
119
120
  minWidth: width,
120
121
  maxWidth: width,
121
122
  minHeight: height,
122
- maxHeight: height
123
+ maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
124
+
123
125
  };
124
126
  React.useLayoutEffect(() => {
125
127
  if (!hasFocus || cellMode === GridCellModes.Edit) {
@@ -184,6 +186,10 @@ function GridCell(props) {
184
186
  return children;
185
187
  };
186
188
 
189
+ const draggableEventHandlers = disableDragEvents ? null : {
190
+ onDragEnter: publish('cellDragEnter', onDragEnter),
191
+ onDragOver: publish('cellDragOver', onDragOver)
192
+ };
187
193
  return /*#__PURE__*/_jsx("div", _extends({
188
194
  ref: cellRef,
189
195
  className: clsx(className, classes.root),
@@ -198,10 +204,8 @@ function GridCell(props) {
198
204
  onDoubleClick: publish('cellDoubleClick', onDoubleClick),
199
205
  onMouseDown: publish('cellMouseDown', onMouseDown),
200
206
  onMouseUp: publishMouseUp('cellMouseUp'),
201
- onKeyDown: publish('cellKeyDown', onKeyDown),
202
- onDragEnter: publish('cellDragEnter', onDragEnter),
203
- onDragOver: publish('cellDragOver', onDragOver)
204
- }, other, {
207
+ onKeyDown: publish('cellKeyDown', onKeyDown)
208
+ }, draggableEventHandlers, other, {
205
209
  onFocus: handleFocus,
206
210
  children: renderChildren()
207
211
  }));
@@ -218,10 +222,11 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
218
222
  className: PropTypes.string,
219
223
  colIndex: PropTypes.number.isRequired,
220
224
  colSpan: PropTypes.number,
225
+ disableDragEvents: PropTypes.bool,
221
226
  field: PropTypes.string.isRequired,
222
227
  formattedValue: PropTypes.any,
223
228
  hasFocus: PropTypes.bool,
224
- height: PropTypes.number.isRequired,
229
+ height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
225
230
  isEditable: PropTypes.bool,
226
231
  onClick: PropTypes.func,
227
232
  onDoubleClick: PropTypes.func,
@@ -70,6 +70,7 @@ function GridColumnHeaderItem(props) {
70
70
  hasScrollX: false,
71
71
  hasScrollY: false
72
72
  };
73
+ const isDraggable = React.useMemo(() => !rootProps.disableColumnReorder && !disableReorder && !column.disableReorder, [rootProps.disableColumnReorder, disableReorder, column.disableReorder]);
73
74
  let headerComponent = null;
74
75
 
75
76
  if (column.renderHeader) {
@@ -100,12 +101,12 @@ function GridColumnHeaderItem(props) {
100
101
  onFocus: publish('columnHeaderFocus'),
101
102
  onBlur: publish('columnHeaderBlur')
102
103
  };
103
- const draggableEventHandlers = {
104
+ const draggableEventHandlers = isDraggable ? {
104
105
  onDragStart: publish('columnHeaderDragStart'),
105
106
  onDragEnter: publish('columnHeaderDragEnter'),
106
107
  onDragOver: publish('columnHeaderDragOver'),
107
108
  onDragEnd: publish('columnHeaderDragEnd')
108
- };
109
+ } : null;
109
110
  const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
110
111
  const showRightBorder = !isLastColumn ? rootProps.showColumnRightBorder : !removeLastBorderRight && !extendRowFullWidth;
111
112
 
@@ -182,7 +183,7 @@ function GridColumnHeaderItem(props) {
182
183
  }, mouseEventsHandlers, {
183
184
  children: [/*#__PURE__*/_jsxs("div", _extends({
184
185
  className: classes.draggableContainer,
185
- draggable: !rootProps.disableColumnReorder && !disableReorder && !column.disableReorder
186
+ draggable: isDraggable
186
187
  }, draggableEventHandlers, {
187
188
  children: [/*#__PURE__*/_jsxs("div", {
188
189
  className: classes.titleContainer,
@@ -274,10 +274,12 @@ export const GridRootStyles = styled('div', {
274
274
  [`& .${gridClasses.cell}`]: {
275
275
  display: 'flex',
276
276
  alignItems: 'center',
277
- overflow: 'hidden',
278
- whiteSpace: 'nowrap',
279
277
  borderBottom: `1px solid ${borderColor}`
280
278
  },
279
+ [`& .${gridClasses.row}:not(.${gridClasses['row--dynamicHeight']}) > .${gridClasses.cell}`]: {
280
+ overflow: 'hidden',
281
+ whiteSpace: 'nowrap'
282
+ },
281
283
  [`& .${gridClasses.cellContent}`]: {
282
284
  overflow: 'hidden',
283
285
  textOverflow: 'ellipsis'
@@ -13,6 +13,7 @@ import { styled } from '@mui/material/styles';
13
13
  import { HTMLElementType } from '@mui/utils';
14
14
  import { getDataGridUtilityClass, gridClasses } from '../../constants/gridClasses';
15
15
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
16
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
 
18
19
  const useUtilityClasses = ownerState => {
@@ -56,6 +57,7 @@ const GridMenu = props => {
56
57
  } = props,
57
58
  other = _objectWithoutPropertiesLoose(props, _excluded);
58
59
 
60
+ const apiRef = useGridApiContext();
59
61
  const prevTarget = React.useRef(target);
60
62
  const prevOpen = React.useRef(open);
61
63
  const rootProps = useGridRootProps();
@@ -66,11 +68,16 @@ const GridMenu = props => {
66
68
  React.useEffect(() => {
67
69
  if (prevOpen.current && prevTarget.current) {
68
70
  prevTarget.current.focus();
69
- }
71
+ } // Emit menuOpen or menuClose events
72
+
70
73
 
74
+ const eventName = open ? 'menuOpen' : 'menuClose';
75
+ apiRef.current.publishEvent(eventName, {
76
+ target
77
+ });
71
78
  prevOpen.current = open;
72
79
  prevTarget.current = target;
73
- }, [open, target]);
80
+ }, [apiRef, open, target]);
74
81
 
75
82
  const handleExited = popperOnExited => node => {
76
83
  if (popperOnExited) {
@@ -76,8 +76,16 @@ export function GridColumnsPanel(props) {
76
76
  };
77
77
 
78
78
  const toggleAllColumns = React.useCallback(isVisible => {
79
- // TODO v6: call `setColumnVisibilityModel` directly
80
- apiRef.current.updateColumns(columns.map(col => {
79
+ if (apiRef.current.unstable_caches.columns.isUsingColumnVisibilityModel) {
80
+ if (isVisible) {
81
+ return apiRef.current.setColumnVisibilityModel({});
82
+ }
83
+
84
+ return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
85
+ } // TODO v6: Remove
86
+
87
+
88
+ return apiRef.current.updateColumns(columns.map(col => {
81
89
  if (col.hideable !== false) {
82
90
  return {
83
91
  field: col.field,
@@ -3,5 +3,5 @@ import { Theme } from '@mui/material/styles';
3
3
  import { MUIStyledCommonProps } from '@mui/system';
4
4
  export interface GridPanelWrapperProps extends React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>, MUIStyledCommonProps<Theme> {
5
5
  }
6
- declare function GridPanelWrapper(props: GridPanelWrapperProps): JSX.Element;
6
+ declare const GridPanelWrapper: React.ForwardRefExoticComponent<GridPanelWrapperProps & React.RefAttributes<HTMLDivElement>>;
7
7
  export { GridPanelWrapper };
@@ -35,7 +35,7 @@ const GridPanelWrapperRoot = styled('div', {
35
35
 
36
36
  const isEnabled = () => true;
37
37
 
38
- function GridPanelWrapper(props) {
38
+ const GridPanelWrapper = /*#__PURE__*/React.forwardRef(function GridPanelWrapper(props, ref) {
39
39
  const {
40
40
  className
41
41
  } = props,
@@ -51,10 +51,10 @@ function GridPanelWrapper(props) {
51
51
  disableEnforceFocus: true,
52
52
  isEnabled: isEnabled,
53
53
  children: /*#__PURE__*/_jsx(GridPanelWrapperRoot, _extends({
54
+ ref: ref,
54
55
  tabIndex: -1,
55
56
  className: clsx(className, classes.root)
56
57
  }, other))
57
58
  });
58
- }
59
-
59
+ });
60
60
  export { GridPanelWrapper };