@mui/x-data-grid 5.8.0 → 5.9.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 (242) hide show
  1. package/CHANGELOG.md +141 -63
  2. package/DataGrid/DataGrid.js +1 -1
  3. package/DataGrid/useDataGridComponent.js +3 -1
  4. package/LICENSE +21 -0
  5. package/README.md +1 -1
  6. package/components/GridRow.d.ts +4 -0
  7. package/components/GridRow.js +49 -23
  8. package/components/base/GridOverlays.js +4 -3
  9. package/components/cell/GridActionsCell.d.ts +5 -1
  10. package/components/cell/GridActionsCell.js +170 -21
  11. package/components/cell/GridActionsCellItem.d.ts +66 -4
  12. package/components/cell/GridActionsCellItem.js +7 -5
  13. package/components/cell/GridCell.d.ts +1 -0
  14. package/components/cell/GridCell.js +28 -7
  15. package/components/cell/GridEditInputCell.js +1 -1
  16. package/components/cell/GridEditSingleSelectCell.js +22 -13
  17. package/components/columnHeaders/GridColumnHeaderItem.js +4 -7
  18. package/components/columnHeaders/GridColumnHeaders.d.ts +0 -1
  19. package/components/columnHeaders/GridColumnHeaders.js +1 -1
  20. package/components/columnSelection/GridCellCheckboxRenderer.d.ts +3 -3
  21. package/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
  22. package/components/panel/GridPanel.js +1 -0
  23. package/components/panel/filterPanel/GridFilterForm.js +14 -10
  24. package/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
  25. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -15
  26. package/components/panel/filterPanel/GridFilterInputValue.js +22 -15
  27. package/components/toolbar/GridToolbarDensitySelector.js +1 -1
  28. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  29. package/components/virtualization/GridVirtualScroller.js +2 -0
  30. package/components/virtualization/GridVirtualScrollerContent.js +1 -3
  31. package/constants/gridDetailPanelToggleField.d.ts +1 -0
  32. package/constants/gridDetailPanelToggleField.js +2 -0
  33. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +32 -15
  34. package/hooks/core/pipeProcessing/index.d.ts +1 -0
  35. package/hooks/core/pipeProcessing/index.js +2 -1
  36. package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +8 -3
  37. package/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
  38. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +3 -0
  39. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
  40. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +0 -3
  41. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
  42. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +0 -1
  43. package/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
  44. package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -1
  45. package/hooks/features/columns/gridColumnsUtils.d.ts +19 -1
  46. package/hooks/features/columns/gridColumnsUtils.js +61 -8
  47. package/hooks/features/columns/useGridColumnSpanning.d.ts +7 -0
  48. package/hooks/features/columns/useGridColumnSpanning.js +109 -0
  49. package/hooks/features/columns/useGridColumns.js +24 -18
  50. package/hooks/features/dimensions/useGridDimensions.js +3 -3
  51. package/hooks/features/editRows/useGridCellEditing.new.js +18 -10
  52. package/hooks/features/editRows/useGridEditing.new.js +7 -3
  53. package/hooks/features/editRows/useGridRowEditing.new.js +23 -15
  54. package/hooks/features/filter/useGridFilter.js +14 -9
  55. package/hooks/features/focus/useGridFocus.js +19 -9
  56. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -0
  57. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -7
  58. package/hooks/features/rows/gridRowsSelector.d.ts +1 -0
  59. package/hooks/features/rows/gridRowsSelector.js +1 -0
  60. package/hooks/features/rows/gridRowsState.d.ts +4 -0
  61. package/hooks/features/rows/useGridRows.d.ts +2 -2
  62. package/hooks/features/rows/useGridRows.js +5 -4
  63. package/hooks/features/rows/useGridRowsMeta.js +6 -13
  64. package/hooks/features/scroll/useGridScroll.d.ts +2 -0
  65. package/hooks/features/scroll/useGridScroll.js +25 -3
  66. package/hooks/features/selection/useGridSelection.js +3 -2
  67. package/hooks/features/sorting/useGridSorting.js +10 -10
  68. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +7 -0
  69. package/hooks/features/virtualization/useGridVirtualScroller.js +54 -27
  70. package/index.js +1 -1
  71. package/internals/index.d.ts +1 -0
  72. package/internals/index.js +1 -0
  73. package/legacy/DataGrid/DataGrid.js +1 -1
  74. package/legacy/DataGrid/useDataGridComponent.js +3 -1
  75. package/legacy/components/GridRow.js +47 -23
  76. package/legacy/components/base/GridOverlays.js +4 -3
  77. package/legacy/components/cell/GridActionsCell.js +188 -27
  78. package/legacy/components/cell/GridActionsCellItem.js +7 -5
  79. package/legacy/components/cell/GridCell.js +29 -7
  80. package/legacy/components/cell/GridEditInputCell.js +1 -1
  81. package/legacy/components/cell/GridEditSingleSelectCell.js +33 -24
  82. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +4 -7
  83. package/legacy/components/columnHeaders/GridColumnHeaders.js +2 -3
  84. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +21 -3
  85. package/legacy/components/panel/GridPanel.js +1 -0
  86. package/legacy/components/panel/filterPanel/GridFilterForm.js +14 -10
  87. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
  88. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -17
  89. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +22 -17
  90. package/legacy/components/toolbar/GridToolbarDensitySelector.js +1 -1
  91. package/legacy/components/virtualization/GridVirtualScroller.js +2 -0
  92. package/legacy/components/virtualization/GridVirtualScrollerContent.js +1 -3
  93. package/legacy/constants/gridDetailPanelToggleField.js +2 -0
  94. package/legacy/hooks/core/pipeProcessing/index.js +2 -1
  95. package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +60 -24
  96. package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
  97. package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
  98. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +89 -10
  99. package/legacy/hooks/features/columns/gridColumnsUtils.js +79 -22
  100. package/legacy/hooks/features/columns/useGridColumnSpanning.js +107 -0
  101. package/legacy/hooks/features/columns/useGridColumns.js +24 -18
  102. package/legacy/hooks/features/dimensions/useGridDimensions.js +3 -3
  103. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -8
  104. package/legacy/hooks/features/editRows/useGridEditing.new.js +7 -3
  105. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +32 -24
  106. package/legacy/hooks/features/filter/useGridFilter.js +14 -9
  107. package/legacy/hooks/features/focus/useGridFocus.js +19 -9
  108. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -6
  109. package/legacy/hooks/features/rows/gridRowsSelector.js +3 -0
  110. package/legacy/hooks/features/rows/useGridRows.js +5 -4
  111. package/legacy/hooks/features/rows/useGridRowsMeta.js +6 -13
  112. package/legacy/hooks/features/scroll/useGridScroll.js +25 -3
  113. package/legacy/hooks/features/selection/useGridSelection.js +3 -2
  114. package/legacy/hooks/features/sorting/useGridSorting.js +5 -7
  115. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +65 -37
  116. package/legacy/index.js +1 -1
  117. package/legacy/internals/index.js +1 -0
  118. package/legacy/locales/huHU.js +120 -0
  119. package/legacy/locales/index.js +1 -0
  120. package/legacy/models/api/gridColumnSpanning.js +1 -0
  121. package/legacy/models/events/gridEvents.js +2 -3
  122. package/legacy/models/gridColumnSpanning.js +1 -0
  123. package/locales/huHU.d.ts +2 -0
  124. package/locales/huHU.js +108 -0
  125. package/locales/index.d.ts +1 -0
  126. package/locales/index.js +1 -0
  127. package/models/api/gridApiCommon.d.ts +2 -1
  128. package/models/api/gridColumnSpanning.d.ts +28 -0
  129. package/models/api/gridColumnSpanning.js +1 -0
  130. package/models/api/gridEditingApi.d.ts +49 -3
  131. package/models/colDef/gridColDef.d.ts +5 -0
  132. package/models/events/gridEventLookup.d.ts +3 -8
  133. package/models/events/gridEvents.d.ts +9 -14
  134. package/models/events/gridEvents.js +2 -3
  135. package/models/gridColumnSpanning.d.ts +12 -0
  136. package/models/gridColumnSpanning.js +1 -0
  137. package/models/gridEditRowModel.d.ts +1 -1
  138. package/models/params/gridCellParams.d.ts +12 -2
  139. package/models/params/gridRowParams.d.ts +5 -0
  140. package/models/props/DataGridProps.d.ts +1 -1
  141. package/modern/DataGrid/DataGrid.js +1 -1
  142. package/modern/DataGrid/useDataGridComponent.js +3 -1
  143. package/modern/components/GridRow.js +47 -21
  144. package/modern/components/base/GridOverlays.js +4 -3
  145. package/modern/components/cell/GridActionsCell.js +168 -21
  146. package/modern/components/cell/GridActionsCellItem.js +7 -5
  147. package/modern/components/cell/GridCell.js +28 -7
  148. package/modern/components/cell/GridEditInputCell.js +1 -1
  149. package/modern/components/cell/GridEditSingleSelectCell.js +20 -11
  150. package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -7
  151. package/modern/components/columnHeaders/GridColumnHeaders.js +1 -1
  152. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
  153. package/modern/components/panel/GridPanel.js +1 -0
  154. package/modern/components/panel/filterPanel/GridFilterForm.js +10 -6
  155. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +11 -6
  156. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +20 -13
  157. package/modern/components/panel/filterPanel/GridFilterInputValue.js +20 -13
  158. package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
  159. package/modern/components/virtualization/GridVirtualScroller.js +2 -0
  160. package/modern/components/virtualization/GridVirtualScrollerContent.js +1 -3
  161. package/modern/constants/gridDetailPanelToggleField.js +2 -0
  162. package/modern/hooks/core/pipeProcessing/index.js +2 -1
  163. package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
  164. package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
  165. package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
  166. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
  167. package/modern/hooks/features/columns/gridColumnsUtils.js +61 -8
  168. package/modern/hooks/features/columns/useGridColumnSpanning.js +107 -0
  169. package/modern/hooks/features/columns/useGridColumns.js +24 -18
  170. package/modern/hooks/features/dimensions/useGridDimensions.js +3 -3
  171. package/modern/hooks/features/editRows/useGridCellEditing.new.js +18 -10
  172. package/modern/hooks/features/editRows/useGridEditing.new.js +7 -3
  173. package/modern/hooks/features/editRows/useGridRowEditing.new.js +23 -15
  174. package/modern/hooks/features/filter/useGridFilter.js +14 -9
  175. package/modern/hooks/features/focus/useGridFocus.js +19 -9
  176. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +37 -7
  177. package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
  178. package/modern/hooks/features/rows/useGridRows.js +5 -4
  179. package/modern/hooks/features/rows/useGridRowsMeta.js +6 -13
  180. package/modern/hooks/features/scroll/useGridScroll.js +23 -3
  181. package/modern/hooks/features/selection/useGridSelection.js +3 -2
  182. package/modern/hooks/features/sorting/useGridSorting.js +10 -10
  183. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +54 -23
  184. package/modern/index.js +1 -1
  185. package/modern/internals/index.js +1 -0
  186. package/modern/locales/huHU.js +108 -0
  187. package/modern/locales/index.js +1 -0
  188. package/modern/models/api/gridColumnSpanning.js +1 -0
  189. package/modern/models/events/gridEvents.js +2 -3
  190. package/modern/models/gridColumnSpanning.js +1 -0
  191. package/node/DataGrid/DataGrid.js +1 -1
  192. package/node/DataGrid/useDataGridComponent.js +4 -1
  193. package/node/components/GridRow.js +50 -23
  194. package/node/components/base/GridOverlays.js +3 -2
  195. package/node/components/cell/GridActionsCell.js +172 -21
  196. package/node/components/cell/GridActionsCellItem.js +7 -4
  197. package/node/components/cell/GridCell.js +28 -7
  198. package/node/components/cell/GridEditInputCell.js +1 -1
  199. package/node/components/cell/GridEditSingleSelectCell.js +23 -13
  200. package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -7
  201. package/node/components/columnHeaders/GridColumnHeaders.js +1 -1
  202. package/node/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
  203. package/node/components/panel/GridPanel.js +1 -0
  204. package/node/components/panel/filterPanel/GridFilterForm.js +15 -10
  205. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +14 -8
  206. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +23 -15
  207. package/node/components/panel/filterPanel/GridFilterInputValue.js +23 -15
  208. package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
  209. package/node/components/virtualization/GridVirtualScroller.js +2 -0
  210. package/node/components/virtualization/GridVirtualScrollerContent.js +1 -3
  211. package/node/constants/gridDetailPanelToggleField.js +9 -0
  212. package/node/hooks/core/pipeProcessing/index.js +13 -0
  213. package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +51 -20
  214. package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +42 -0
  215. package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -3
  216. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +80 -10
  217. package/node/hooks/features/columns/gridColumnsUtils.js +65 -9
  218. package/node/hooks/features/columns/useGridColumnSpanning.js +130 -0
  219. package/node/hooks/features/columns/useGridColumns.js +23 -17
  220. package/node/hooks/features/dimensions/useGridDimensions.js +3 -3
  221. package/node/hooks/features/editRows/useGridCellEditing.new.js +18 -10
  222. package/node/hooks/features/editRows/useGridEditing.new.js +6 -2
  223. package/node/hooks/features/editRows/useGridRowEditing.new.js +21 -14
  224. package/node/hooks/features/filter/useGridFilter.js +14 -9
  225. package/node/hooks/features/focus/useGridFocus.js +19 -9
  226. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +40 -7
  227. package/node/hooks/features/rows/gridRowsSelector.js +3 -1
  228. package/node/hooks/features/rows/useGridRows.js +5 -4
  229. package/node/hooks/features/rows/useGridRowsMeta.js +6 -14
  230. package/node/hooks/features/scroll/useGridScroll.js +26 -2
  231. package/node/hooks/features/selection/useGridSelection.js +4 -2
  232. package/node/hooks/features/sorting/useGridSorting.js +10 -10
  233. package/node/hooks/features/virtualization/useGridVirtualScroller.js +59 -27
  234. package/node/index.js +1 -1
  235. package/node/internals/index.js +8 -0
  236. package/node/locales/huHU.js +118 -0
  237. package/node/locales/index.js +13 -0
  238. package/node/models/api/gridColumnSpanning.js +5 -0
  239. package/node/models/events/gridEvents.js +2 -3
  240. package/node/models/gridColumnSpanning.js +5 -0
  241. package/package.json +4 -4
  242. package/utils/domUtils.d.ts +2 -2
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["field", "id", "value", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "getValue"];
3
+ var _excluded = ["field", "id", "value", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "getValue", "api"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_composeClasses as composeClasses } from '@mui/material';
@@ -35,6 +35,7 @@ var GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCell
35
35
  hasFocus = props.hasFocus,
36
36
  tabIndex = props.tabIndex,
37
37
  getValue = props.getValue,
38
+ api = props.api,
38
39
  other = _objectWithoutProperties(props, _excluded);
39
40
 
40
41
  var apiRef = useGridApiContext();
@@ -104,6 +105,12 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
104
105
  // | To update them edit the TypeScript types and run "yarn proptypes" |
105
106
  // ----------------------------------------------------------------------
106
107
 
108
+ /**
109
+ * GridApi that let you manipulate the grid.
110
+ * @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
111
+ */
112
+ api: PropTypes.any.isRequired,
113
+
107
114
  /**
108
115
  * The mode of the cell.
109
116
  */
@@ -119,10 +126,21 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
119
126
  */
120
127
  field: PropTypes.string.isRequired,
121
128
 
129
+ /**
130
+ * A ref allowing to set imperative focus.
131
+ * It can be passed to the element that should receive focus.
132
+ * @ignore - do not document.
133
+ */
134
+ focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
135
+ current: PropTypes.shape({
136
+ focus: PropTypes.func.isRequired
137
+ })
138
+ })]),
139
+
122
140
  /**
123
141
  * The cell value formatted with the column valueFormatter.
124
142
  */
125
- formattedValue: PropTypes.any.isRequired,
143
+ formattedValue: PropTypes.any,
126
144
 
127
145
  /**
128
146
  * Get the cell value of a row and field.
@@ -166,7 +184,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
166
184
  /**
167
185
  * The cell value, but if the column has valueGetter, use getValue.
168
186
  */
169
- value: PropTypes.any.isRequired
187
+ value: PropTypes.any
170
188
  } : void 0;
171
189
  export { GridCellCheckboxForwardRef };
172
190
  export var GridCellCheckboxRenderer = /*#__PURE__*/React.memo(GridCellCheckboxForwardRef);
@@ -97,6 +97,7 @@ var GridPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
97
97
  modifiers: modifiers
98
98
  }, other, {
99
99
  children: /*#__PURE__*/_jsx(ClickAwayListener, {
100
+ mouseEvent: "onMouseUp",
100
101
  onClickAway: handleClickAway,
101
102
  children: /*#__PURE__*/_jsx(GridPaperRoot, {
102
103
  className: classes.paper,
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { unstable_composeClasses as composeClasses } from '@mui/material';
5
5
  import IconButton from '@mui/material/IconButton';
6
+ import MenuItem from '@mui/material/MenuItem';
6
7
  import InputLabel from '@mui/material/InputLabel';
7
8
  import FormControl from '@mui/material/FormControl';
8
9
  import { capitalize, unstable_useId as useId } from '@mui/material/utils';
@@ -117,7 +118,7 @@ var getColumnLabel = function getColumnLabel(col) {
117
118
  var collator = new Intl.Collator();
118
119
 
119
120
  function GridFilterForm(props) {
120
- var _rootProps$components, _rootProps$components2, _rootProps$components3, _rootProps$components4, _currentColumn$filter2;
121
+ var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _currentColumn$filter2;
121
122
 
122
123
  var item = props.item,
123
124
  hasMultipleFilters = props.hasMultipleFilters,
@@ -156,6 +157,9 @@ function GridFilterForm(props) {
156
157
  var filterSelectorRef = React.useRef(null);
157
158
  var hasLinkOperatorColumn = hasMultipleFilters && linkOperators.length > 0;
158
159
  var baseFormControlProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseFormControl) || {};
160
+ var baseSelectProps = ((_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect) || {};
161
+ var isBaseSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
162
+ var OptionComponent = isBaseSelectNative ? 'option' : MenuItem;
159
163
  var sortedFilterableColumns = React.useMemo(function () {
160
164
  switch (columnsSort) {
161
165
  case 'asc':
@@ -281,10 +285,10 @@ function GridFilterForm(props) {
281
285
  value: multiFilterOperator,
282
286
  onChange: changeLinkOperator,
283
287
  disabled: !!disableMultiFilterOperator || linkOperators.length === 1,
284
- native: true
285
- }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect, {
288
+ native: isBaseSelectNative
289
+ }, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseSelect, {
286
290
  children: linkOperators.map(function (linkOperator) {
287
- return /*#__PURE__*/_jsx("option", {
291
+ return /*#__PURE__*/_jsx(OptionComponent, {
288
292
  value: linkOperator.toString(),
289
293
  children: apiRef.current.getLocaleText(getLinkOperatorLocaleKey(linkOperator))
290
294
  }, linkOperator.toString());
@@ -305,10 +309,10 @@ function GridFilterForm(props) {
305
309
  label: apiRef.current.getLocaleText('filterPanelColumns'),
306
310
  value: item.columnField || '',
307
311
  onChange: changeColumn,
308
- native: true
309
- }, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseSelect, {
312
+ native: isBaseSelectNative
313
+ }, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseSelect, {
310
314
  children: sortedFilterableColumns.map(function (col) {
311
- return /*#__PURE__*/_jsx("option", {
315
+ return /*#__PURE__*/_jsx(OptionComponent, {
312
316
  value: col.field,
313
317
  children: getColumnLabel(col)
314
318
  }, col.field);
@@ -329,11 +333,11 @@ function GridFilterForm(props) {
329
333
  id: operatorSelectId,
330
334
  value: item.operatorValue,
331
335
  onChange: changeOperator,
332
- native: true,
336
+ native: isBaseSelectNative,
333
337
  inputRef: filterSelectorRef
334
- }, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseSelect, {
338
+ }, (_rootProps$components5 = rootProps.componentsProps) == null ? void 0 : _rootProps$components5.baseSelect, {
335
339
  children: currentColumn == null ? void 0 : (_currentColumn$filter2 = currentColumn.filterOperators) == null ? void 0 : _currentColumn$filter2.map(function (operator) {
336
- return /*#__PURE__*/_jsx("option", {
340
+ return /*#__PURE__*/_jsx(OptionComponent, {
337
341
  value: operator.value,
338
342
  children: operator.label || apiRef.current.getLocaleText("filterOperator".concat(capitalize(operator.value)))
339
343
  }, operator.value);
@@ -3,11 +3,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
4
  var _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
5
5
  import * as React from 'react';
6
+ import MenuItem from '@mui/material/MenuItem';
6
7
  import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
10
  export function GridFilterInputBoolean(props) {
10
- var _rootProps$components;
11
+ var _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
11
12
 
12
13
  var item = props.item,
13
14
  applyValue = props.applyValue,
@@ -21,6 +22,9 @@ export function GridFilterInputBoolean(props) {
21
22
  setFilterValueState = _React$useState2[1];
22
23
 
23
24
  var rootProps = useGridRootProps();
25
+ var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
26
+ var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
27
+ var OptionComponent = isSelectNative ? 'option' : MenuItem;
24
28
  var onFilterChange = React.useCallback(function (event) {
25
29
  var value = event.target.value;
26
30
  setFilterValueState(value);
@@ -37,21 +41,22 @@ export function GridFilterInputBoolean(props) {
37
41
  onChange: onFilterChange,
38
42
  variant: "standard",
39
43
  select: true,
40
- SelectProps: {
41
- native: true
42
- },
44
+ SelectProps: _extends({
45
+ native: isSelectNative,
46
+ displayEmpty: true
47
+ }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect),
43
48
  InputLabelProps: {
44
49
  shrink: true
45
50
  },
46
51
  inputRef: focusElementRef
47
- }, others, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField, {
48
- children: [/*#__PURE__*/_jsx("option", {
52
+ }, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {
53
+ children: [/*#__PURE__*/_jsx(OptionComponent, {
49
54
  value: "",
50
55
  children: apiRef.current.getLocaleText('filterValueAny')
51
- }), /*#__PURE__*/_jsx("option", {
56
+ }), /*#__PURE__*/_jsx(OptionComponent, {
52
57
  value: "true",
53
58
  children: apiRef.current.getLocaleText('filterValueTrue')
54
- }), /*#__PURE__*/_jsx("option", {
59
+ }), /*#__PURE__*/_jsx(OptionComponent, {
55
60
  value: "false",
56
61
  children: apiRef.current.getLocaleText('filterValueFalse')
57
62
  })]
@@ -7,11 +7,12 @@ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import { unstable_useId as useId } from '@mui/material/utils';
10
+ import MenuItem from '@mui/material/MenuItem';
10
11
  import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
11
12
  import { getValueFromValueOptions } from './filterPanelUtils';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
 
14
- var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
15
+ var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api, OptionComponent) {
15
16
  var valueOptions = _ref.valueOptions,
16
17
  valueFormatter = _ref.valueFormatter,
17
18
  field = _ref.field;
@@ -19,22 +20,24 @@ var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
19
20
  field: field
20
21
  }))) : [''].concat(_toConsumableArray(valueOptions || []));
21
22
  return iterableColumnValues.map(function (option) {
22
- return _typeof(option) === 'object' ? /*#__PURE__*/_jsx("option", {
23
- value: option.value,
24
- children: option.label
25
- }, option.value) : /*#__PURE__*/_jsx("option", {
23
+ var isOptionTypeObject = _typeof(option) === 'object';
24
+ var key = isOptionTypeObject ? option.value : option;
25
+ var value = isOptionTypeObject ? option.value : option;
26
+ var formattedValue = valueFormatter && option !== '' ? valueFormatter({
26
27
  value: option,
27
- children: valueFormatter && option !== '' ? valueFormatter({
28
- value: option,
29
- field: field,
30
- api: api
31
- }) : option
32
- }, option);
28
+ field: field,
29
+ api: api
30
+ }) : option;
31
+ var content = isOptionTypeObject ? option.label : formattedValue;
32
+ return /*#__PURE__*/_jsx(OptionComponent, {
33
+ value: value,
34
+ children: content
35
+ }, key);
33
36
  });
34
37
  };
35
38
 
36
39
  function GridFilterInputSingleSelect(props) {
37
- var _item$value, _rootProps$components;
40
+ var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
38
41
 
39
42
  var item = props.item,
40
43
  applyValue = props.applyValue,
@@ -50,6 +53,8 @@ function GridFilterInputSingleSelect(props) {
50
53
 
51
54
  var id = useId();
52
55
  var rootProps = useGridRootProps();
56
+ var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
57
+ var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
53
58
  var currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
54
59
  var currentValueOptions = React.useMemo(function () {
55
60
  return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({
@@ -100,11 +105,11 @@ function GridFilterInputSingleSelect(props) {
100
105
  },
101
106
  inputRef: focusElementRef,
102
107
  select: true,
103
- SelectProps: {
104
- native: true
105
- }
106
- }, others, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField, {
107
- children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current)
108
+ SelectProps: _extends({
109
+ native: isSelectNative
110
+ }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect)
111
+ }, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {
112
+ children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)
108
113
  }));
109
114
  }
110
115
 
@@ -7,6 +7,7 @@ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import { unstable_useId as useId } from '@mui/material/utils';
10
+ import MenuItem from '@mui/material/MenuItem';
10
11
  import { GridLoadIcon } from '../../icons';
11
12
  import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
12
13
  import { getValueFromValueOptions } from './filterPanelUtils';
@@ -18,7 +19,7 @@ function warnDeprecatedTypeSupport(type) {
18
19
  warnedOnce[type] = true;
19
20
  }
20
21
 
21
- var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
22
+ var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api, OptionComponent) {
22
23
  var valueOptions = _ref.valueOptions,
23
24
  valueFormatter = _ref.valueFormatter,
24
25
  field = _ref.field;
@@ -26,24 +27,26 @@ var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
26
27
  field: field
27
28
  }))) : [''].concat(_toConsumableArray(valueOptions || []));
28
29
  return iterableColumnValues.map(function (option) {
29
- return _typeof(option) === 'object' ? /*#__PURE__*/_jsx("option", {
30
- value: option.value,
31
- children: option.label
32
- }, option.value) : /*#__PURE__*/_jsx("option", {
30
+ var isOptionTypeObject = _typeof(option) === 'object';
31
+ var key = isOptionTypeObject ? option.value : option;
32
+ var value = isOptionTypeObject ? option.value : option;
33
+ var formattedValue = valueFormatter && option !== '' ? valueFormatter({
33
34
  value: option,
34
- children: valueFormatter && option !== '' ? valueFormatter({
35
- value: option,
36
- field: field,
37
- api: api
38
- }) : option
39
- }, option);
35
+ field: field,
36
+ api: api
37
+ }) : option;
38
+ var content = isOptionTypeObject ? option.label : formattedValue;
39
+ return /*#__PURE__*/_jsx(OptionComponent, {
40
+ value: value,
41
+ children: content
42
+ }, key);
40
43
  });
41
44
  };
42
45
 
43
46
  export var SUBMIT_FILTER_STROKE_TIME = 500;
44
47
 
45
48
  function GridFilterInputValue(props) {
46
- var _item$value, _rootProps$components;
49
+ var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
47
50
 
48
51
  var item = props.item,
49
52
  applyValue = props.applyValue,
@@ -70,12 +73,14 @@ function GridFilterInputValue(props) {
70
73
 
71
74
  var id = useId();
72
75
  var rootProps = useGridRootProps();
76
+ var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
77
+ var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
73
78
  var singleSelectProps = type === 'singleSelect' ? {
74
79
  select: true,
75
- SelectProps: {
76
- native: true
77
- },
78
- children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current)
80
+ SelectProps: _extends({
81
+ native: isSelectNative
82
+ }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect),
83
+ children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)
79
84
  } : {};
80
85
  var onFilterChange = React.useCallback(function (event) {
81
86
  var value = event.target.value; // NativeSelect casts the value to a string.
@@ -126,7 +131,7 @@ function GridFilterInputValue(props) {
126
131
  shrink: true
127
132
  },
128
133
  inputRef: focusElementRef
129
- }, singleSelectProps, others, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
134
+ }, singleSelectProps, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField));
130
135
  }
131
136
 
132
137
  process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
@@ -111,7 +111,7 @@ export var GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function G
111
111
  "aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
112
112
  "aria-expanded": open ? 'true' : undefined,
113
113
  "aria-haspopup": "menu",
114
- "aria-labelledby": densityMenuId,
114
+ "aria-controls": densityMenuId,
115
115
  id: densityButtonId
116
116
  }, other, {
117
117
  onClick: handleDensitySelectorOpen
@@ -25,6 +25,8 @@ var VirtualScrollerRoot = styled('div', {
25
25
  }
26
26
  })({
27
27
  overflow: 'auto',
28
+ // See https://github.com/mui/mui-x/issues/4360
29
+ position: 'relative',
28
30
  '@media print': {
29
31
  overflow: 'hidden'
30
32
  }
@@ -24,9 +24,7 @@ var VirtualScrollerContentRoot = styled('div', {
24
24
  overridesResolver: function overridesResolver(props, styles) {
25
25
  return styles.virtualScrollerContent;
26
26
  }
27
- })({
28
- position: 'relative'
29
- });
27
+ })({});
30
28
  var GridVirtualScrollerContent = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerContent(props, ref) {
31
29
  var className = props.className,
32
30
  style = props.style,
@@ -0,0 +1,2 @@
1
+ // Can't import from pro package - hence duplication
2
+ export var GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
@@ -1,3 +1,4 @@
1
1
  export * from './gridPipeProcessingApi';
2
2
  export * from './useGridPipeProcessing';
3
- export * from './useGridRegisterPipeProcessor';
3
+ export * from './useGridRegisterPipeProcessor';
4
+ export * from './useGridRegisterPipeApplier';
@@ -1,11 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
4
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
- import _extends from "@babel/runtime/helpers/esm/extends";
6
4
  import * as React from 'react';
7
5
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
8
- import { GridEvents } from '../../../models/events';
6
+
9
7
  /**
10
8
  * Implement the Pipeline Pattern
11
9
  *
@@ -19,7 +17,10 @@ import { GridEvents } from '../../../models/events';
19
17
  * The plugin containing the custom logic must use:
20
18
  *
21
19
  * - `useGridRegisterPipeProcessor` to register their processor.
22
- * When the processor changes, it will fire `GridEvents.pipeProcessorRegister` to re-apply the whole pipe.
20
+ *
21
+ * - `apiRef.current.unstable_requestPipeProcessorsApplication` to imperatively re-apply a group.
22
+ * This method should be used in last resort.
23
+ * Most of the time, the application should be triggered by an update on the deps of the processor.
23
24
  *
24
25
  * =====================================================================================================================
25
26
  *
@@ -27,56 +28,91 @@ import { GridEvents } from '../../../models/events';
27
28
  *
28
29
  * - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
29
30
  *
30
- * - `GridEvents.pipeProcessorRegister` to re-apply the whole pipe when a processor of this pipe changes.
31
- *
31
+ * - `useGridRegisterPipeApplier` to re-apply the whole pipe when requested.
32
+ * The applier will be called when:
33
+ * * a processor is registered.
34
+ * * `apiRef.current.unstable_requestPipeProcessorsApplication` is called for the given group.
32
35
  */
33
-
34
36
  export var useGridPipeProcessing = function useGridPipeProcessing(apiRef) {
35
37
  var processorsCache = React.useRef({});
38
+ var runAppliers = React.useCallback(function (groupCache) {
39
+ if (!groupCache) {
40
+ return;
41
+ }
42
+
43
+ Object.values(groupCache.appliers).forEach(function (callback) {
44
+ callback();
45
+ });
46
+ }, []);
36
47
  var registerPipeProcessor = React.useCallback(function (group, id, processor) {
37
48
  if (!processorsCache.current[group]) {
38
- processorsCache.current[group] = {};
49
+ processorsCache.current[group] = {
50
+ processors: {},
51
+ appliers: {}
52
+ };
39
53
  }
40
54
 
41
- var groupProcessors = processorsCache.current[group];
42
- var oldProcessor = groupProcessors[id];
55
+ var groupCache = processorsCache.current[group];
56
+ var oldProcessor = groupCache.processors[id];
43
57
 
44
58
  if (oldProcessor !== processor) {
45
- processorsCache.current[group] = _extends({}, groupProcessors, _defineProperty({}, id, processor));
46
- apiRef.current.publishEvent(GridEvents.pipeProcessorRegister, group);
59
+ groupCache.processors[id] = processor;
60
+ runAppliers(groupCache);
47
61
  }
48
62
 
49
63
  return function () {
50
- var _ref = processorsCache.current[group],
51
- removedGroupProcessor = _ref[id],
52
- otherProcessors = _objectWithoutProperties(_ref, [id].map(_toPropertyKey));
64
+ var _processors = processorsCache.current[group].processors,
65
+ removedGroupProcessor = _processors[id],
66
+ otherProcessors = _objectWithoutProperties(_processors, [id].map(_toPropertyKey));
53
67
 
54
- processorsCache.current[group] = otherProcessors;
55
- apiRef.current.publishEvent(GridEvents.pipeProcessorUnregister, group);
68
+ processorsCache.current[group].processors = otherProcessors;
56
69
  };
57
- }, [apiRef]);
70
+ }, [runAppliers]);
71
+ var registerPipeApplier = React.useCallback(function (group, id, applier) {
72
+ if (!processorsCache.current[group]) {
73
+ processorsCache.current[group] = {
74
+ processors: {},
75
+ appliers: {}
76
+ };
77
+ }
78
+
79
+ processorsCache.current[group].appliers[id] = applier;
80
+ return function () {
81
+ var _appliers = processorsCache.current[group].appliers,
82
+ removedGroupApplier = _appliers[id],
83
+ otherAppliers = _objectWithoutProperties(_appliers, [id].map(_toPropertyKey));
84
+
85
+ processorsCache.current[group].appliers = otherAppliers;
86
+ };
87
+ }, []);
88
+ var requestPipeProcessorsApplication = React.useCallback(function (group) {
89
+ var groupCache = processorsCache.current[group];
90
+ runAppliers(groupCache);
91
+ }, [runAppliers]);
58
92
  var applyPipeProcessors = React.useCallback(function () {
59
93
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60
94
  args[_key] = arguments[_key];
61
95
  }
62
96
 
63
- var _ref2 = args,
64
- _ref3 = _slicedToArray(_ref2, 3),
65
- group = _ref3[0],
66
- value = _ref3[1],
67
- context = _ref3[2];
97
+ var _ref = args,
98
+ _ref2 = _slicedToArray(_ref, 3),
99
+ group = _ref2[0],
100
+ value = _ref2[1],
101
+ context = _ref2[2];
68
102
 
69
103
  if (!processorsCache.current[group]) {
70
104
  return value;
71
105
  }
72
106
 
73
- var preProcessors = Object.values(processorsCache.current[group]);
107
+ var preProcessors = Object.values(processorsCache.current[group].processors);
74
108
  return preProcessors.reduce(function (acc, preProcessor) {
75
109
  return preProcessor(acc, context);
76
110
  }, value);
77
111
  }, []);
78
112
  var preProcessingApi = {
79
113
  unstable_registerPipeProcessor: registerPipeProcessor,
114
+ unstable_registerPipeApplier: registerPipeApplier,
115
+ unstable_requestPipeProcessorsApplication: requestPipeProcessorsApplication,
80
116
  unstable_applyPipeProcessors: applyPipeProcessors
81
117
  };
82
118
  useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import { useFirstRender } from '../../utils/useFirstRender';
3
+ export var useGridRegisterPipeApplier = function useGridRegisterPipeApplier(apiRef, group, callback) {
4
+ var cleanup = React.useRef();
5
+ var id = React.useRef("mui-".concat(Math.round(Math.random() * 1e9)));
6
+ var registerPreProcessor = React.useCallback(function () {
7
+ cleanup.current = apiRef.current.unstable_registerPipeApplier(group, id.current, callback);
8
+ }, [apiRef, callback, group]);
9
+ useFirstRender(function () {
10
+ registerPreProcessor();
11
+ });
12
+ var isFirstRender = React.useRef(true);
13
+ React.useEffect(function () {
14
+ if (isFirstRender.current) {
15
+ isFirstRender.current = false;
16
+ } else {
17
+ registerPreProcessor();
18
+ }
19
+
20
+ return function () {
21
+ if (cleanup.current) {
22
+ cleanup.current();
23
+ cleanup.current = null;
24
+ }
25
+ };
26
+ }, [registerPreProcessor]);
27
+ };
@@ -1,9 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { useFirstRender } from '../../utils/useFirstRender';
3
-
4
- /**
5
- * TODO: Rename `useGridRegisterPipeProcessor`
6
- */
7
3
  export var useGridRegisterPipeProcessor = function useGridRegisterPipeProcessor(apiRef, group, callback) {
8
4
  var cleanup = React.useRef();
9
5
  var id = React.useRef("mui-".concat(Math.round(Math.random() * 1e9)));