@mui/x-data-grid 8.0.0-beta.0 → 8.0.0-beta.2

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 (135) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/DataGrid/DataGrid.js +2 -0
  3. package/components/GridRow.js +3 -8
  4. package/components/GridShadowScrollArea.js +43 -35
  5. package/components/cell/GridBooleanCell.d.ts +1 -2
  6. package/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  7. package/components/cell/GridEditSingleSelectCell.js +1 -1
  8. package/components/columnSelection/GridHeaderCheckbox.js +2 -2
  9. package/components/containers/GridToolbarContainer.js +5 -3
  10. package/components/quickFilter/QuickFilter.d.ts +26 -3
  11. package/components/quickFilter/QuickFilter.js +103 -19
  12. package/components/quickFilter/QuickFilterClear.js +10 -4
  13. package/components/quickFilter/QuickFilterContext.d.ts +4 -1
  14. package/components/quickFilter/QuickFilterControl.js +36 -10
  15. package/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  16. package/components/quickFilter/QuickFilterTrigger.js +211 -0
  17. package/components/quickFilter/index.d.ts +2 -1
  18. package/components/quickFilter/index.js +11 -0
  19. package/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  20. package/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  21. package/components/toolbar/GridToolbarExport.d.ts +3 -4
  22. package/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  23. package/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  24. package/components/toolbar/GridToolbarFilterButton.js +1 -4
  25. package/components/toolbar/GridToolbarQuickFilter.js +101 -41
  26. package/components/toolbarV8/GridToolbar.js +22 -19
  27. package/components/toolbarV8/Toolbar.d.ts +1 -1
  28. package/components/toolbarV8/Toolbar.js +76 -23
  29. package/components/toolbarV8/ToolbarButton.js +34 -14
  30. package/components/toolbarV8/ToolbarContext.d.ts +4 -2
  31. package/constants/gridClasses.d.ts +12 -0
  32. package/constants/gridClasses.js +1 -1
  33. package/esm/DataGrid/DataGrid.js +2 -0
  34. package/esm/components/GridRow.js +4 -9
  35. package/esm/components/GridShadowScrollArea.js +43 -35
  36. package/esm/components/cell/GridBooleanCell.d.ts +1 -2
  37. package/esm/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  38. package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
  39. package/esm/components/columnSelection/GridHeaderCheckbox.js +2 -2
  40. package/esm/components/containers/GridToolbarContainer.js +5 -3
  41. package/esm/components/quickFilter/QuickFilter.d.ts +26 -3
  42. package/esm/components/quickFilter/QuickFilter.js +101 -17
  43. package/esm/components/quickFilter/QuickFilterClear.js +10 -4
  44. package/esm/components/quickFilter/QuickFilterContext.d.ts +4 -1
  45. package/esm/components/quickFilter/QuickFilterControl.js +36 -10
  46. package/esm/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  47. package/esm/components/quickFilter/QuickFilterTrigger.js +204 -0
  48. package/esm/components/quickFilter/index.d.ts +2 -1
  49. package/esm/components/quickFilter/index.js +2 -1
  50. package/esm/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  51. package/esm/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  52. package/esm/components/toolbar/GridToolbarExport.d.ts +3 -4
  53. package/esm/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  54. package/esm/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  55. package/esm/components/toolbar/GridToolbarFilterButton.js +1 -4
  56. package/esm/components/toolbar/GridToolbarQuickFilter.js +102 -44
  57. package/esm/components/toolbarV8/GridToolbar.js +22 -19
  58. package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
  59. package/esm/components/toolbarV8/Toolbar.js +75 -22
  60. package/esm/components/toolbarV8/ToolbarButton.js +34 -14
  61. package/esm/components/toolbarV8/ToolbarContext.d.ts +4 -2
  62. package/esm/constants/gridClasses.d.ts +12 -0
  63. package/esm/constants/gridClasses.js +1 -1
  64. package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  65. package/esm/hooks/features/columns/useGridColumns.js +0 -1
  66. package/esm/hooks/features/dimensions/useGridDimensions.js +1 -1
  67. package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
  68. package/esm/hooks/features/filter/useGridFilter.js +1 -1
  69. package/esm/hooks/features/pagination/useGridPaginationModel.js +1 -1
  70. package/esm/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
  71. package/esm/index.js +1 -1
  72. package/esm/locales/deDE.js +13 -13
  73. package/esm/material/index.js +1 -2
  74. package/esm/models/props/DataGridProps.d.ts +6 -2
  75. package/esm/utils/utils.d.ts +0 -27
  76. package/esm/utils/utils.js +0 -122
  77. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +2 -2
  78. package/hooks/features/columns/useGridColumns.js +0 -1
  79. package/hooks/features/dimensions/useGridDimensions.js +2 -2
  80. package/hooks/features/editing/useGridRowEditing.js +1 -1
  81. package/hooks/features/filter/useGridFilter.js +3 -3
  82. package/hooks/features/pagination/useGridPaginationModel.js +2 -2
  83. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -0
  84. package/index.js +1 -1
  85. package/locales/deDE.js +13 -13
  86. package/material/index.js +1 -2
  87. package/models/props/DataGridProps.d.ts +6 -2
  88. package/modern/DataGrid/DataGrid.js +2 -0
  89. package/modern/components/GridRow.js +4 -9
  90. package/modern/components/GridShadowScrollArea.js +43 -35
  91. package/modern/components/cell/GridBooleanCell.d.ts +1 -2
  92. package/modern/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  93. package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
  94. package/modern/components/columnSelection/GridHeaderCheckbox.js +2 -2
  95. package/modern/components/containers/GridToolbarContainer.js +5 -3
  96. package/modern/components/quickFilter/QuickFilter.d.ts +26 -3
  97. package/modern/components/quickFilter/QuickFilter.js +101 -17
  98. package/modern/components/quickFilter/QuickFilterClear.js +10 -4
  99. package/modern/components/quickFilter/QuickFilterContext.d.ts +4 -1
  100. package/modern/components/quickFilter/QuickFilterControl.js +36 -10
  101. package/modern/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  102. package/modern/components/quickFilter/QuickFilterTrigger.js +204 -0
  103. package/modern/components/quickFilter/index.d.ts +2 -1
  104. package/modern/components/quickFilter/index.js +2 -1
  105. package/modern/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  106. package/modern/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  107. package/modern/components/toolbar/GridToolbarExport.d.ts +3 -4
  108. package/modern/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  109. package/modern/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  110. package/modern/components/toolbar/GridToolbarFilterButton.js +1 -4
  111. package/modern/components/toolbar/GridToolbarQuickFilter.js +102 -44
  112. package/modern/components/toolbarV8/GridToolbar.js +22 -19
  113. package/modern/components/toolbarV8/Toolbar.d.ts +1 -1
  114. package/modern/components/toolbarV8/Toolbar.js +75 -22
  115. package/modern/components/toolbarV8/ToolbarButton.js +34 -14
  116. package/modern/components/toolbarV8/ToolbarContext.d.ts +4 -2
  117. package/modern/constants/gridClasses.d.ts +12 -0
  118. package/modern/constants/gridClasses.js +1 -1
  119. package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  120. package/modern/hooks/features/columns/useGridColumns.js +0 -1
  121. package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
  122. package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
  123. package/modern/hooks/features/filter/useGridFilter.js +1 -1
  124. package/modern/hooks/features/pagination/useGridPaginationModel.js +1 -1
  125. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
  126. package/modern/index.js +1 -1
  127. package/modern/locales/deDE.js +13 -13
  128. package/modern/material/index.js +1 -2
  129. package/modern/models/props/DataGridProps.d.ts +6 -2
  130. package/modern/utils/utils.d.ts +0 -27
  131. package/modern/utils/utils.js +0 -122
  132. package/package.json +2 -2
  133. package/tsconfig.build.tsbuildinfo +1 -1
  134. package/utils/utils.d.ts +0 -27
  135. package/utils/utils.js +0 -123
package/CHANGELOG.md CHANGED
@@ -5,6 +5,177 @@
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.0.0-beta.2
9
+
10
+ _Mar 27, 2025_
11
+
12
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🔍 Update the Data Grid quick filter to be collapsed when not in use
15
+ - 🐞 Bugfixes
16
+
17
+ Special thanks go out to the community members for their valuable contributions:
18
+ @lhilgert9.
19
+ Following are all team members who have contributed to this release:
20
+ @alexfauquette, @arminmeh, @flaviendelangle, @hasdfa, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @michelengelen, @mnajdova, @romgrk.
21
+
22
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
23
+
24
+ ### Data Grid
25
+
26
+ #### `@mui/x-data-grid@8.0.0-beta.2`
27
+
28
+ - [DataGrid] Fix error caused by trying to render rows that are not in the state anymore (#17057) @arminmeh
29
+ - [DataGrid] Refactor: remove more material (#16922) @romgrk
30
+ - [DataGrid] Update Quick Filter component to be expandable (#16862) @KenanYusuf
31
+ - [DataGrid] Fix crash when used with `@mui/styled-engine-sc` (#17154) @KenanYusuf
32
+
33
+ #### `@mui/x-data-grid-pro@8.0.0-beta.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
34
+
35
+ Same changes as in `@mui/x-data-grid@8.0.0-beta.2`, plus:
36
+
37
+ - [DataGridPro] Data source: Allow expanding groups with unknown children (#17144) @MBilalShafi
38
+
39
+ #### `@mui/x-data-grid-premium@8.0.0-beta.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
40
+
41
+ Same changes as in `@mui/x-data-grid-pro@8.0.0-beta.2`.
42
+
43
+ ### Date and Time Pickers
44
+
45
+ #### `@mui/x-date-pickers@8.0.0-beta.2`
46
+
47
+ - [fields] Extract the props of each field slot into a standalone hook for easier re-use (#17114) @flaviendelangle
48
+ - [pickers] Fix visual regression in Date Range Calendar's day (#17148) @flaviendelangle
49
+ - [pickers] Remove all code duplication to apply default values to validation props (#17038) @flaviendelangle
50
+
51
+ #### `@mui/x-date-pickers-pro@8.0.0-beta.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
52
+
53
+ Same changes as in `@mui/x-date-pickers@8.0.0-beta.2`.
54
+
55
+ ### Charts
56
+
57
+ #### `@mui/x-charts@8.0.0-beta.2`
58
+
59
+ - [charts] Memoize axes and series with default (#17156) @alexfauquette
60
+ - [charts] Add pie benchmark (#17115) @JCQuintas
61
+ - [charts] Fix CSS vars support for dark theme (#17106) @alexfauquette
62
+ - [charts] Fix radar hover (#17134) @alexfauquette
63
+ - [charts] Move axis interaction to selectors (#17039) @alexfauquette
64
+ - [charts] Fix Pie benchmark (#17125) @JCQuintas
65
+
66
+ #### `@mui/x-charts-pro@8.0.0-beta.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
67
+
68
+ Same changes as in `@mui/x-charts@8.0.0-beta.2`.
69
+
70
+ ### Tree View
71
+
72
+ #### `@mui/x-tree-view@8.0.0-beta.2`
73
+
74
+ Internal changes.
75
+
76
+ #### `@mui/x-tree-view-pro@8.0.0-beta.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
77
+
78
+ Same changes as in `@mui/x-tree-view@8.0.0-beta.2`.
79
+
80
+ ### `@mui/x-codemod@8.0.0-beta.1`
81
+
82
+ - [codemod] Add Data Grid codemods (#17121, #17124) @MBilalShafi
83
+
84
+ ### Docs
85
+
86
+ - [docs] Fix example import for `ExportExcel` component (#17110) @KenanYusuf
87
+
88
+ ### Core
89
+
90
+ - [code-infra] Remove `@mui/styles` dependency & patches (#17071) @mnajdova
91
+ - [code-infra] Add more tests to slow screenshot tests (#17075) @JCQuintas
92
+ - [code-infra] Fix pickers codecov (#17120) @JCQuintas
93
+ - [code-infra] Move `isDeepEqual` to @mui/x-internals (#17129) @JCQuintas
94
+ - [code-infra] Remove `test_regressions` step from React 18 pipeline (#17108) @LukasTy
95
+ - [code-infra] Update some data-grid tests for vitest (#17078, #17104, #17146) @JCQuintas
96
+ - [code-infra] Update some date-pickers tests for vitest (#17083) @JCQuintas
97
+ - [infra] Update `issue-status-label-handler.yml` @michelengelen
98
+ - [infra] Added reusable issue status label handler workflow (#17145) @michelengelen
99
+ - [infra] Switch to reusable 'stale issues/PRs' workflow (#17107) @michelengelen
100
+ - [telemetry] Improve request body size, update dependencies, and optimize SSR handling (#17008) @hasdfa
101
+
102
+ ## 8.0.0-beta.1
103
+
104
+ _Mar 21, 2025_
105
+
106
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
107
+
108
+ - 🐞 Bugfixes
109
+
110
+ Special thanks go out to the community members for their valuable contributions:
111
+ @jyash97.
112
+ Following are all team members who have contributed to this release:
113
+ @alexfauquette, @arminmeh, @flaviendelangle, @JCQuintas, @KenanYusuf.
114
+
115
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
116
+
117
+ ### Data Grid
118
+
119
+ #### `@mui/x-data-grid@8.0.0-beta.1`
120
+
121
+ - [DataGrid] Fix error caused by `forwardRef` to `ClickAwayListener` (#17049) @arminmeh
122
+ - [DataGrid] Fix error while editing rows with custom id (#17048) @arminmeh
123
+
124
+ #### `@mui/x-data-grid-pro@8.0.0-beta.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
125
+
126
+ Same changes as in `@mui/x-data-grid@8.0.0-beta.1`, plus:
127
+
128
+ - [DataGridPro] Fix header select checkbox state with `checkboxSelectionVisibleOnly` and `paginationMode="server"` (#17026) @arminmeh
129
+
130
+ #### `@mui/x-data-grid-premium@8.0.0-beta.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
131
+
132
+ Same changes as in `@mui/x-data-grid-pro@8.0.0-beta.1`, plus:
133
+
134
+ - [DataGridPremium] Update column state correctly when grouping mode is updated with one grouping column (#17069) @arminmeh
135
+
136
+ ### Date and Time Pickers
137
+
138
+ #### `@mui/x-date-pickers@8.0.0-beta.1`
139
+
140
+ - [fields] Clean the `useField` hook (part 1) (#16944) @flaviendelangle
141
+ - [fields] Improve the check for year in `doesSectionFormatHaveLeadingZeros` (#17051) @flaviendelangle
142
+ - [pickers] Deprecate the `disableOpenPicker` prop (#17040) @flaviendelangle
143
+ - [pickers] Simplify the `cleanLeadingZeros` method (#17063) @flaviendelangle
144
+ - [pickers] Use the new `ownerState` in `PickersDay` and `DateRangePickerDay` (#17035) @flaviendelangle
145
+
146
+ #### `@mui/x-date-pickers-pro@8.0.0-beta.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
147
+
148
+ Same changes as in `@mui/x-date-pickers@8.0.0-beta.1`, plus:
149
+
150
+ - [DateRangePicker] Use desktop media query constant on range pickers (#17052) @flaviendelangle
151
+
152
+ ### Charts
153
+
154
+ #### `@mui/x-charts@8.0.0-beta.1`
155
+
156
+ - [charts] Fix horizontal bar with multiple axes (#17059) @alexfauquette
157
+
158
+ #### `@mui/x-charts-pro@8.0.0-beta.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
159
+
160
+ Same changes as in `@mui/x-charts@8.0.0-beta.1`, plus:
161
+
162
+ - [charts-pro] Allow disabling Heatmap tooltip (#17060) @JCQuintas
163
+
164
+ ### Tree View
165
+
166
+ #### `@mui/x-tree-view@8.0.0-beta.1`
167
+
168
+ Internal changes.
169
+
170
+ #### `@mui/x-tree-view-pro@8.0.0-beta.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
171
+
172
+ Same changes as in `@mui/x-tree-view@8.0.0-beta.1`.
173
+
174
+ ### Docs
175
+
176
+ - [docs] Fix 404 (#17033) @alexfauquette
177
+ - [docs] Fix Data Grid advanced list view demo (#17064) @KenanYusuf
178
+
8
179
  ## 8.0.0-beta.0
9
180
 
10
181
  <img width="100%" alt="MUI X v8 Beta is live" src="https://github.com/user-attachments/assets/61ec4dd8-c946-456b-8b45-d51de8772f5d">
@@ -117,6 +117,7 @@ DataGridRaw.propTypes = {
117
117
  * Override or extend the styles applied to the component.
118
118
  */
119
119
  classes: _propTypes.default.object,
120
+ className: _propTypes.default.string,
120
121
  /**
121
122
  * The character used to separate cell values when copying to the clipboard.
122
123
  * @default '\t'
@@ -776,6 +777,7 @@ DataGridRaw.propTypes = {
776
777
  field: _propTypes.default.string.isRequired,
777
778
  sort: _propTypes.default.oneOf(['asc', 'desc'])
778
779
  })),
780
+ style: _propTypes.default.object,
779
781
  /**
780
782
  * The system prop that allows defining system overrides as well as additional CSS styles.
781
783
  */
@@ -86,7 +86,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
86
86
  const rowReordering = rootProps.rowReordering;
87
87
  const isRowReorderingEnabled = (0, _useGridSelector.useGridSelector)(apiRef, isRowReorderingEnabledSelector, rowReordering);
88
88
  const handleRef = (0, _utils.unstable_useForkRef)(ref, refProp);
89
- const rowNode = apiRef.current.getRowNode(rowId);
89
+ const rowNode = (0, _gridRowsSelector.gridRowNodeSelector)(apiRef, rowId);
90
90
  const editing = (0, _useGridSelector.useGridSelector)(apiRef, _gridEditingSelectors.gridRowIsEditingSelector, {
91
91
  rowId,
92
92
  editMode: rootProps.editMode
@@ -199,7 +199,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
199
199
  return rowStyle;
200
200
  }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
201
201
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
202
- const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
202
+ const ariaAttributes = getRowAriaAttributes(rowNode, index);
203
203
  if (typeof rootProps.getRowClassName === 'function') {
204
204
  const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
205
205
  const rowParams = (0, _extends2.default)({}, apiRef.current.getRowParams(rowId), {
@@ -209,11 +209,6 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
209
209
  });
210
210
  rowClassNames.push(rootProps.getRowClassName(rowParams));
211
211
  }
212
-
213
- /* Start of rendering */
214
- if (!rowNode) {
215
- return null;
216
- }
217
212
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = _constants.PinnedColumnPosition.NONE) => {
218
213
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
219
214
  if (cellColSpanInfo?.spannedByColSpan) {
@@ -222,7 +217,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
222
217
  const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
223
218
  const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
224
219
  const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
225
- if (rowNode?.type === 'skeletonRow') {
220
+ if (rowNode.type === 'skeletonRow') {
226
221
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
227
222
  type: column.type,
228
223
  width: width,
@@ -25,48 +25,56 @@ const detectScroll = (0, _system.keyframes)({
25
25
  '--scrollable': '" "'
26
26
  }
27
27
  });
28
+
29
+ // This `styled()` function invokes keyframes. `styled-components` only supports keyframes
30
+ // in string templates. Do not convert these styles in JS object as it will break.
28
31
  const ShadowScrollArea = (0, _system.styled)('div', {
29
32
  name: 'MuiDataGrid',
30
33
  slot: 'ShadowScrollArea'
31
- })({
32
- flex: 1,
33
- display: 'flex',
34
- flexDirection: 'column',
35
- animation: detectScroll,
36
- animationTimeline: '--scroll-timeline',
37
- animationFillMode: 'none',
38
- boxSizing: 'border-box',
39
- overflow: 'auto',
40
- scrollTimeline: '--scroll-timeline block',
41
- '&::before, &::after': {
42
- content: '""',
43
- flexShrink: 0,
44
- display: 'block',
45
- position: 'sticky',
46
- left: 0,
47
- width: '100%',
48
- height: '4px',
49
- animation: `${reveal} linear both`,
50
- animationTimeline: '--scroll-timeline',
34
+ })`
35
+ flex: 1;
36
+ display: flex;
37
+ flex-direction: column;
38
+ animation: ${detectScroll};
39
+ animation-timeline: --scroll-timeline;
40
+ animation-fill-mode: none;
41
+ box-sizing: border-box;
42
+ overflow: auto;
43
+ scroll-timeline: --scroll-timeline block;
44
+
45
+ &::before,
46
+ &::after {
47
+ content: '';
48
+ flex-shrink: 0;
49
+ display: block;
50
+ position: sticky;
51
+ left: 0;
52
+ width: 100%;
53
+ height: 4px;
54
+ animation: ${reveal} linear both;
55
+ animation-timeline: --scroll-timeline;
56
+
51
57
  // Custom property toggle trick:
52
58
  // - Detects if the element is scrollable
53
59
  // - https://css-tricks.com/the-css-custom-property-toggle-trick/
54
- '--visibility-scrollable': 'var(--scrollable) visible',
55
- '--visibility-not-scrollable': 'hidden',
56
- visibility: 'var(--visibility-scrollable, var(--visibility-not-scrollable))'
57
- },
58
- '&::before': {
59
- top: 0,
60
- background: 'linear-gradient(to bottom, rgba(0,0,0,0.05) 0, transparent 100%)',
61
- animationRange: '0 4px'
62
- },
63
- '&::after': {
64
- bottom: 0,
65
- background: 'linear-gradient(to top, rgba(0,0,0,0.05) 0, transparent 100%)',
66
- animationDirection: 'reverse',
67
- animationRange: 'calc(100% - 4px) 100%'
60
+ --visibility-scrollable: var(--scrollable) visible;
61
+ --visibility-not-scrollable: hidden;
62
+ visibility: var(--visibility-scrollable, var(--visibility-not-scrollable));
68
63
  }
69
- });
64
+
65
+ &::before {
66
+ top: 0;
67
+ background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0, transparent 100%);
68
+ animation-range: 0 4px;
69
+ }
70
+
71
+ &::after {
72
+ bottom: 0;
73
+ background: linear-gradient(to top, rgba(0, 0, 0, 0.05) 0, transparent 100%);
74
+ animation-direction: reverse;
75
+ animation-range: calc(100% - 4px) 100%;
76
+ }
77
+ `;
70
78
 
71
79
  /**
72
80
  * Adds scroll shadows above and below content in a scrollable container.
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
- import { SvgIconProps } from '@mui/material/SvgIcon';
3
2
  import type { GridColDef } from '../../models/colDef/gridColDef';
4
3
  import type { GridRenderCellParams } from '../../models/params/gridCellParams';
5
- interface GridBooleanCellProps extends GridRenderCellParams, Omit<SvgIconProps, 'tabIndex' | 'id'> {
4
+ interface GridBooleanCellProps extends GridRenderCellParams {
6
5
  hideDescendantCount?: boolean;
7
6
  }
8
7
  declare function GridBooleanCellRaw(props: GridBooleanCellProps): React.JSX.Element | null;
@@ -1,14 +1,14 @@
1
1
  import * as React from 'react';
2
- import { SelectProps, SelectChangeEvent } from '@mui/material/Select';
2
+ import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
3
3
  import { GridRenderEditCellParams } from "../../models/params/gridCellParams.js";
4
- export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams, Omit<SelectProps, 'id' | 'tabIndex' | 'value'> {
4
+ export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams {
5
5
  /**
6
6
  * Callback called when the value is changed by the user.
7
- * @param {SelectChangeEvent<any>} event The event source of the callback.
7
+ * @param {Event<any>} event The event source of the callback.
8
8
  * @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
9
9
  * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
10
10
  */
11
- onValueChange?: (event: SelectChangeEvent<any>, newValue: any) => Promise<void> | void;
11
+ onValueChange?: (event: Parameters<NonNullable<GridSlotProps['baseSelect']['onOpen']>>[0], newValue: any) => Promise<void> | void;
12
12
  /**
13
13
  * If true, the select opens by default.
14
14
  */
@@ -171,7 +171,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
171
171
  isValidating: _propTypes.default.bool,
172
172
  /**
173
173
  * Callback called when the value is changed by the user.
174
- * @param {SelectChangeEvent<any>} event The event source of the callback.
174
+ * @param {Event<any>} event The event source of the callback.
175
175
  * @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
176
176
  * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
177
177
  */
@@ -77,7 +77,7 @@ const GridHeaderCheckbox = exports.GridHeaderCheckbox = (0, _forwardRef.forwardR
77
77
 
78
78
  // All the rows that could be selected / unselected by toggling this checkbox
79
79
  const selectionCandidates = React.useMemo(() => {
80
- const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly ? visibleRowIds : paginatedVisibleRowIds;
80
+ const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly || rootProps.paginationMode === 'server' ? visibleRowIds : paginatedVisibleRowIds;
81
81
 
82
82
  // Convert to a Set to make O(1) checking if a row exists or not
83
83
  const candidates = new Set();
@@ -88,7 +88,7 @@ const GridHeaderCheckbox = exports.GridHeaderCheckbox = (0, _forwardRef.forwardR
88
88
  }
89
89
  }
90
90
  return candidates;
91
- }, [apiRef, rootProps.pagination, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
91
+ }, [apiRef, rootProps.pagination, rootProps.paginationMode, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
92
92
 
93
93
  // Amount of rows selected and that are visible in the current page
94
94
  const currentSelectionSize = React.useMemo(() => {
@@ -17,6 +17,7 @@ var _forwardRef = require("@mui/x-internals/forwardRef");
17
17
  var _cssVariables = require("../../constants/cssVariables");
18
18
  var _gridClasses = require("../../constants/gridClasses");
19
19
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
20
+ var _toolbarV = require("../toolbarV8");
20
21
  var _jsxRuntime = require("react/jsx-runtime");
21
22
  const _excluded = ["className", "children"];
22
23
  const useUtilityClasses = ownerState => {
@@ -28,16 +29,17 @@ const useUtilityClasses = ownerState => {
28
29
  };
29
30
  return (0, _composeClasses.default)(slots, _gridClasses.getDataGridUtilityClass, classes);
30
31
  };
31
- const GridToolbarContainerRoot = (0, _system.styled)('div', {
32
+ const GridToolbarContainerRoot = (0, _system.styled)(_toolbarV.Toolbar, {
32
33
  name: 'MuiDataGrid',
33
34
  slot: 'ToolbarContainer',
34
- overridesResolver: (_, styles) => styles.toolbarContainer
35
+ shouldForwardProp: prop => prop !== 'ownerState'
35
36
  })({
36
37
  display: 'flex',
37
38
  alignItems: 'center',
38
39
  flexWrap: 'wrap',
39
40
  gap: _cssVariables.vars.spacing(1),
40
- padding: _cssVariables.vars.spacing(0.5, 0.5, 0)
41
+ padding: _cssVariables.vars.spacing(0.5),
42
+ minHeight: 'auto'
41
43
  });
42
44
  const GridToolbarContainer = exports.GridToolbarContainer = (0, _forwardRef.forwardRef)(function GridToolbarContainer(props, ref) {
43
45
  const {
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
+ import { QuickFilterState } from "./QuickFilterContext.js";
3
+ import { RenderProp } from "../../hooks/utils/useGridComponentRenderer.js";
2
4
  import type { GridFilterModel } from '../../models';
3
- export type QuickFilterProps = {
4
- children: React.ReactNode;
5
+ export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {
5
6
  /**
6
7
  * Function responsible for parsing text input in an array of independent values for quick filtering.
7
8
  * @param {string} input The value entered by the user
@@ -21,10 +22,32 @@ export type QuickFilterProps = {
21
22
  * @default 150
22
23
  */
23
24
  debounceMs?: number;
25
+ /**
26
+ * The default expanded state of the quick filter control.
27
+ * @default false
28
+ */
29
+ defaultExpanded?: boolean;
30
+ /**
31
+ * The expanded state of the quick filter control.
32
+ */
33
+ expanded?: boolean;
34
+ /**
35
+ * A function to customize rendering of the component.
36
+ */
37
+ render?: RenderProp<React.ComponentProps<'div'>, QuickFilterState>;
38
+ /**
39
+ * Override or extend the styles applied to the component.
40
+ */
41
+ className?: string | ((state: QuickFilterState) => string);
42
+ /**
43
+ * Callback function that is called when the quick filter input is expanded or collapsed.
44
+ * @param {boolean} expanded The new expanded state of the quick filter control
45
+ */
46
+ onExpandedChange?: (expanded: boolean) => void;
24
47
  };
25
48
  /**
26
49
  * The top level Quick Filter component that provides context to child components.
27
- * It does not render any DOM elements.
50
+ * It renders a `<div />` element.
28
51
  *
29
52
  * Demos:
30
53
  *
@@ -6,22 +6,28 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.QuickFilter = QuickFilter;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
11
  var React = _interopRequireWildcard(require("react"));
10
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
13
  var _utils = require("@mui/utils");
14
+ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
15
+ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
16
+ var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
12
17
  var _QuickFilterContext = require("./QuickFilterContext");
18
+ var _useGridComponentRenderer = require("../../hooks/utils/useGridComponentRenderer");
13
19
  var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
14
20
  var _useGridSelector = require("../../hooks/utils/useGridSelector");
15
21
  var _filter = require("../../hooks/features/filter");
16
22
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
17
- var _utils2 = require("../../utils/utils");
18
23
  var _jsxRuntime = require("react/jsx-runtime");
24
+ const _excluded = ["render", "className", "parser", "formatter", "debounceMs", "defaultExpanded", "expanded", "onExpandedChange"];
19
25
  const DEFAULT_PARSER = searchText => searchText.split(' ').filter(word => word !== '');
20
26
  const DEFAULT_FORMATTER = values => values.join(' ');
21
27
 
22
28
  /**
23
29
  * The top level Quick Filter component that provides context to child components.
24
- * It does not render any DOM elements.
30
+ * It renders a `<div />` element.
25
31
  *
26
32
  * Demos:
27
33
  *
@@ -34,26 +40,73 @@ const DEFAULT_FORMATTER = values => values.join(' ');
34
40
  function QuickFilter(props) {
35
41
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
36
42
  const {
37
- parser = DEFAULT_PARSER,
38
- formatter = DEFAULT_FORMATTER,
39
- debounceMs = rootProps.filterDebounceMs,
40
- children
41
- } = props;
43
+ render,
44
+ className,
45
+ parser = DEFAULT_PARSER,
46
+ formatter = DEFAULT_FORMATTER,
47
+ debounceMs = rootProps.filterDebounceMs,
48
+ defaultExpanded,
49
+ expanded,
50
+ onExpandedChange
51
+ } = props,
52
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
42
53
  const apiRef = (0, _useGridApiContext.useGridApiContext)();
43
54
  const controlRef = React.useRef(null);
44
55
  const triggerRef = React.useRef(null);
45
56
  const quickFilterValues = (0, _useGridSelector.useGridSelector)(apiRef, _filter.gridQuickFilterValuesSelector);
46
57
  const [value, setValue] = React.useState(formatter(quickFilterValues ?? []));
58
+ const [internalExpanded, setInternalExpanded] = React.useState(defaultExpanded ?? value.length > 0);
59
+ const expandedValue = expanded ?? internalExpanded;
60
+ const state = React.useMemo(() => ({
61
+ value,
62
+ expanded: expandedValue
63
+ }), [value, expandedValue]);
64
+ const resolvedClassName = typeof className === 'function' ? className(state) : className;
65
+ const ref = React.useRef(null);
66
+ const controlId = (0, _useId.default)();
67
+ const handleExpandedChange = React.useCallback(newExpanded => {
68
+ if (onExpandedChange) {
69
+ onExpandedChange(newExpanded);
70
+ }
71
+ if (expanded === undefined) {
72
+ setInternalExpanded(newExpanded);
73
+ }
74
+ }, [onExpandedChange, expanded]);
47
75
  const prevQuickFilterValuesRef = React.useRef(quickFilterValues);
48
76
  React.useEffect(() => {
49
- if (!(0, _utils2.isDeepEqual)(prevQuickFilterValuesRef.current, quickFilterValues)) {
77
+ if (!(0, _isDeepEqual.isDeepEqual)(prevQuickFilterValuesRef.current, quickFilterValues)) {
50
78
  // The model of quick filter value has been updated
51
79
  prevQuickFilterValuesRef.current = quickFilterValues;
52
80
 
53
81
  // Update the input value if needed to match the new model
54
- setValue(prevSearchValue => (0, _utils2.isDeepEqual)(parser(prevSearchValue), quickFilterValues) ? prevSearchValue : formatter(quickFilterValues ?? []));
82
+ setValue(prevSearchValue => (0, _isDeepEqual.isDeepEqual)(parser(prevSearchValue), quickFilterValues) ? prevSearchValue : formatter(quickFilterValues ?? []));
55
83
  }
56
84
  }, [quickFilterValues, formatter, parser]);
85
+ const isFirstRender = React.useRef(true);
86
+ const previousExpandedValue = React.useRef(expandedValue);
87
+ React.useEffect(() => {
88
+ if (isFirstRender.current) {
89
+ isFirstRender.current = false;
90
+ return;
91
+ }
92
+
93
+ // Ensure the expanded state has actually changed before focusing
94
+ if (previousExpandedValue.current !== expandedValue) {
95
+ if (expandedValue) {
96
+ // Ensures the focus does not interupt CSS transitions and animations on the control
97
+ requestAnimationFrame(() => {
98
+ controlRef.current?.focus({
99
+ preventScroll: true
100
+ });
101
+ });
102
+ } else {
103
+ triggerRef.current?.focus({
104
+ preventScroll: true
105
+ });
106
+ }
107
+ previousExpandedValue.current = expandedValue;
108
+ }
109
+ }, [expandedValue]);
57
110
  const setQuickFilterValueDebounced = React.useMemo(() => (0, _utils.unstable_debounce)(newValue => {
58
111
  const newQuickFilterValues = parser(newValue);
59
112
  prevQuickFilterValuesRef.current = newQuickFilterValues;
@@ -65,7 +118,7 @@ function QuickFilter(props) {
65
118
  setValue(newValue);
66
119
  setQuickFilterValueDebounced(newValue);
67
120
  }, [setQuickFilterValueDebounced]);
68
- const handleClear = React.useCallback(() => {
121
+ const handleClearValue = React.useCallback(() => {
69
122
  setValue('');
70
123
  apiRef.current.setQuickFilterValues([]);
71
124
  controlRef.current?.focus();
@@ -73,15 +126,25 @@ function QuickFilter(props) {
73
126
  const contextValue = React.useMemo(() => ({
74
127
  controlRef,
75
128
  triggerRef,
76
- state: {
77
- value
78
- },
79
- clearValue: handleClear,
80
- onValueChange: handleValueChange
81
- }), [value, handleValueChange, handleClear]);
129
+ state,
130
+ controlId,
131
+ clearValue: handleClearValue,
132
+ onValueChange: handleValueChange,
133
+ onExpandedChange: handleExpandedChange
134
+ }), [controlId, state, handleValueChange, handleClearValue, handleExpandedChange]);
135
+ (0, _useEnhancedEffect.default)(() => {
136
+ if (ref.current && triggerRef.current) {
137
+ ref.current.style.setProperty('--trigger-width', `${triggerRef.current?.offsetWidth}px`);
138
+ }
139
+ }, []);
140
+ const element = (0, _useGridComponentRenderer.useGridComponentRenderer)('div', render, (0, _extends2.default)({
141
+ className: resolvedClassName
142
+ }, other, {
143
+ ref
144
+ }), state);
82
145
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_QuickFilterContext.QuickFilterContext.Provider, {
83
146
  value: contextValue,
84
- children: children
147
+ children: element
85
148
  });
86
149
  }
87
150
  process.env.NODE_ENV !== "production" ? QuickFilter.propTypes = {
@@ -89,12 +152,24 @@ process.env.NODE_ENV !== "production" ? QuickFilter.propTypes = {
89
152
  // | These PropTypes are generated from the TypeScript type definitions |
90
153
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
91
154
  // ----------------------------------------------------------------------
92
- children: _propTypes.default.node,
155
+ /**
156
+ * Override or extend the styles applied to the component.
157
+ */
158
+ className: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
93
159
  /**
94
160
  * The debounce time in milliseconds.
95
161
  * @default 150
96
162
  */
97
163
  debounceMs: _propTypes.default.number,
164
+ /**
165
+ * The default expanded state of the quick filter control.
166
+ * @default false
167
+ */
168
+ defaultExpanded: _propTypes.default.bool,
169
+ /**
170
+ * The expanded state of the quick filter control.
171
+ */
172
+ expanded: _propTypes.default.bool,
98
173
  /**
99
174
  * Function responsible for formatting values of quick filter in a string when the model is modified
100
175
  * @param {any[]} values The new values passed to the quick filter model
@@ -102,11 +177,20 @@ process.env.NODE_ENV !== "production" ? QuickFilter.propTypes = {
102
177
  * @default (values: string[]) => values.join(' ')
103
178
  */
104
179
  formatter: _propTypes.default.func,
180
+ /**
181
+ * Callback function that is called when the quick filter input is expanded or collapsed.
182
+ * @param {boolean} expanded The new expanded state of the quick filter control
183
+ */
184
+ onExpandedChange: _propTypes.default.func,
105
185
  /**
106
186
  * Function responsible for parsing text input in an array of independent values for quick filtering.
107
187
  * @param {string} input The value entered by the user
108
188
  * @returns {any[]} The array of value on which quick filter is applied
109
189
  * @default (searchText: string) => searchText.split(' ').filter((word) => word !== '')
110
190
  */
111
- parser: _propTypes.default.func
191
+ parser: _propTypes.default.func,
192
+ /**
193
+ * A function to customize rendering of the component.
194
+ */
195
+ render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func])
112
196
  } : void 0;