@mui/x-data-grid 5.12.2 → 5.13.1

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 (177) hide show
  1. package/CHANGELOG.md +160 -6
  2. package/DataGrid/DataGrid.js +4 -4
  3. package/colDef/gridDateOperators.js +4 -2
  4. package/colDef/gridNumericOperators.js +4 -2
  5. package/colDef/gridStringOperators.d.ts +1 -1
  6. package/colDef/gridStringOperators.js +15 -8
  7. package/components/GridRow.js +1 -1
  8. package/components/cell/GridActionsCellItem.d.ts +2 -2
  9. package/components/cell/GridBooleanCell.js +4 -3
  10. package/components/cell/GridEditBooleanCell.js +4 -3
  11. package/components/cell/GridEditDateCell.js +4 -3
  12. package/components/cell/GridEditInputCell.js +4 -3
  13. package/components/cell/GridEditSingleSelectCell.js +9 -7
  14. package/components/panel/GridColumnsPanel.js +1 -1
  15. package/components/panel/GridPanel.d.ts +1 -1
  16. package/components/panel/filterPanel/GridFilterForm.js +11 -4
  17. package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  18. package/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  19. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +5 -9
  20. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +42 -19
  21. package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +3 -7
  22. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +32 -14
  23. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  24. package/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  25. package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +6 -3
  26. package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
  27. package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
  28. package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
  29. package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
  30. package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
  31. package/hooks/features/dimensions/useGridDimensions.js +28 -15
  32. package/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  33. package/hooks/features/editRows/useGridCellEditing.old.js +6 -0
  34. package/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  35. package/hooks/features/editRows/useGridRowEditing.old.js +6 -0
  36. package/hooks/features/filter/gridFilterUtils.js +8 -5
  37. package/hooks/features/filter/useGridFilter.js +19 -1
  38. package/hooks/features/rows/useGridRows.js +16 -3
  39. package/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  40. package/hooks/features/virtualization/useGridVirtualScroller.js +14 -3
  41. package/hooks/utils/useGridApiContext.js +1 -1
  42. package/hooks/utils/useGridRootProps.js +1 -1
  43. package/index.js +1 -1
  44. package/legacy/DataGrid/DataGrid.js +4 -4
  45. package/legacy/colDef/gridDateOperators.js +4 -2
  46. package/legacy/colDef/gridNumericOperators.js +4 -2
  47. package/legacy/colDef/gridStringOperators.js +17 -7
  48. package/legacy/components/GridRow.js +1 -1
  49. package/legacy/components/cell/GridBooleanCell.js +3 -1
  50. package/legacy/components/cell/GridEditBooleanCell.js +4 -2
  51. package/legacy/components/cell/GridEditDateCell.js +4 -2
  52. package/legacy/components/cell/GridEditInputCell.js +4 -2
  53. package/legacy/components/cell/GridEditSingleSelectCell.js +9 -7
  54. package/legacy/components/panel/GridColumnsPanel.js +3 -1
  55. package/legacy/components/panel/filterPanel/GridFilterForm.js +9 -4
  56. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  57. package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  58. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +34 -12
  59. package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +24 -7
  60. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  61. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  62. package/legacy/hooks/features/dimensions/useGridDimensions.js +27 -15
  63. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  64. package/legacy/hooks/features/editRows/useGridCellEditing.old.js +16 -8
  65. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  66. package/legacy/hooks/features/editRows/useGridRowEditing.old.js +22 -14
  67. package/legacy/hooks/features/filter/gridFilterUtils.js +8 -5
  68. package/legacy/hooks/features/filter/useGridFilter.js +19 -1
  69. package/legacy/hooks/features/rows/useGridRows.js +18 -3
  70. package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  71. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +19 -8
  72. package/legacy/hooks/utils/useGridApiContext.js +1 -1
  73. package/legacy/hooks/utils/useGridRootProps.js +1 -1
  74. package/legacy/index.js +1 -1
  75. package/legacy/locales/deDE.js +4 -4
  76. package/legacy/locales/frFR.js +11 -11
  77. package/legacy/locales/index.js +3 -0
  78. package/legacy/locales/nlNL.js +15 -15
  79. package/legacy/locales/ptBR.js +11 -11
  80. package/legacy/locales/roRO.js +128 -0
  81. package/legacy/locales/skSK.js +16 -16
  82. package/legacy/locales/svSE.js +128 -0
  83. package/legacy/utils/keyboardUtils.js +4 -3
  84. package/locales/deDE.js +4 -4
  85. package/locales/frFR.js +11 -11
  86. package/locales/index.d.ts +3 -0
  87. package/locales/index.js +3 -0
  88. package/locales/nlNL.js +15 -15
  89. package/locales/ptBR.js +11 -11
  90. package/locales/roRO.d.ts +2 -0
  91. package/locales/roRO.js +116 -0
  92. package/locales/skSK.js +16 -16
  93. package/locales/svSE.d.ts +2 -0
  94. package/locales/svSE.js +116 -0
  95. package/models/gridFilterOperator.d.ts +6 -0
  96. package/modern/DataGrid/DataGrid.js +4 -4
  97. package/modern/colDef/gridDateOperators.js +4 -2
  98. package/modern/colDef/gridNumericOperators.js +4 -2
  99. package/modern/colDef/gridStringOperators.js +15 -8
  100. package/modern/components/GridRow.js +1 -1
  101. package/modern/components/cell/GridBooleanCell.js +4 -3
  102. package/modern/components/cell/GridEditBooleanCell.js +4 -3
  103. package/modern/components/cell/GridEditDateCell.js +4 -3
  104. package/modern/components/cell/GridEditInputCell.js +4 -3
  105. package/modern/components/cell/GridEditSingleSelectCell.js +9 -7
  106. package/modern/components/panel/GridColumnsPanel.js +1 -1
  107. package/modern/components/panel/filterPanel/GridFilterForm.js +11 -4
  108. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  109. package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  110. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +32 -13
  111. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +22 -8
  112. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  113. package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  114. package/modern/hooks/features/dimensions/useGridDimensions.js +28 -15
  115. package/modern/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  116. package/modern/hooks/features/editRows/useGridCellEditing.old.js +6 -0
  117. package/modern/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  118. package/modern/hooks/features/editRows/useGridRowEditing.old.js +6 -0
  119. package/modern/hooks/features/filter/gridFilterUtils.js +8 -5
  120. package/modern/hooks/features/filter/useGridFilter.js +17 -1
  121. package/modern/hooks/features/rows/useGridRows.js +16 -3
  122. package/modern/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  123. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +10 -3
  124. package/modern/hooks/utils/useGridApiContext.js +1 -1
  125. package/modern/hooks/utils/useGridRootProps.js +1 -1
  126. package/modern/index.js +1 -1
  127. package/modern/locales/deDE.js +4 -4
  128. package/modern/locales/frFR.js +11 -11
  129. package/modern/locales/index.js +3 -0
  130. package/modern/locales/nlNL.js +15 -15
  131. package/modern/locales/ptBR.js +11 -11
  132. package/modern/locales/roRO.js +116 -0
  133. package/modern/locales/skSK.js +16 -16
  134. package/modern/locales/svSE.js +116 -0
  135. package/modern/utils/keyboardUtils.js +4 -3
  136. package/node/DataGrid/DataGrid.js +4 -4
  137. package/node/colDef/gridDateOperators.js +4 -2
  138. package/node/colDef/gridNumericOperators.js +4 -2
  139. package/node/colDef/gridStringOperators.js +15 -8
  140. package/node/components/GridRow.js +1 -1
  141. package/node/components/cell/GridBooleanCell.js +5 -3
  142. package/node/components/cell/GridEditBooleanCell.js +5 -3
  143. package/node/components/cell/GridEditDateCell.js +5 -3
  144. package/node/components/cell/GridEditInputCell.js +5 -3
  145. package/node/components/cell/GridEditSingleSelectCell.js +10 -7
  146. package/node/components/panel/GridColumnsPanel.js +1 -1
  147. package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
  148. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  149. package/node/components/panel/filterPanel/GridFilterInputDate.js +4 -2
  150. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +43 -20
  151. package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +33 -15
  152. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
  153. package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  154. package/node/hooks/features/dimensions/useGridDimensions.js +28 -15
  155. package/node/hooks/features/editRows/useGridCellEditing.new.js +7 -1
  156. package/node/hooks/features/editRows/useGridCellEditing.old.js +6 -0
  157. package/node/hooks/features/editRows/useGridRowEditing.new.js +7 -1
  158. package/node/hooks/features/editRows/useGridRowEditing.old.js +6 -0
  159. package/node/hooks/features/filter/gridFilterUtils.js +7 -4
  160. package/node/hooks/features/filter/useGridFilter.js +19 -1
  161. package/node/hooks/features/rows/useGridRows.js +16 -3
  162. package/node/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
  163. package/node/hooks/features/virtualization/useGridVirtualScroller.js +14 -3
  164. package/node/hooks/utils/useGridApiContext.js +1 -1
  165. package/node/hooks/utils/useGridRootProps.js +1 -1
  166. package/node/index.js +1 -1
  167. package/node/locales/deDE.js +4 -4
  168. package/node/locales/frFR.js +11 -11
  169. package/node/locales/index.js +39 -0
  170. package/node/locales/nlNL.js +15 -15
  171. package/node/locales/ptBR.js +11 -11
  172. package/node/locales/roRO.js +126 -0
  173. package/node/locales/skSK.js +16 -16
  174. package/node/locales/svSE.js +126 -0
  175. package/node/utils/keyboardUtils.js +4 -3
  176. package/package.json +4 -4
  177. package/utils/keyboardUtils.js +4 -3
@@ -14,6 +14,7 @@ import { getDataGridUtilityClass } from '../../constants/gridClasses';
14
14
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
15
15
  import { GridLoadIcon } from '../icons/index';
16
16
  import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
17
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
 
19
20
  var useUtilityClasses = function useUtilityClasses(ownerState) {
@@ -66,6 +67,7 @@ function GridEditInputCell(props) {
66
67
  onValueChange = props.onValueChange,
67
68
  other = _objectWithoutProperties(props, _excluded);
68
69
 
70
+ var apiRef = useGridApiContext();
69
71
  var inputRef = React.useRef();
70
72
 
71
73
  var _React$useState = React.useState(value),
@@ -96,7 +98,7 @@ function GridEditInputCell(props) {
96
98
 
97
99
  case 4:
98
100
  setValueState(newValue);
99
- api.setEditCellValue({
101
+ apiRef.current.setEditCellValue({
100
102
  id: id,
101
103
  field: field,
102
104
  value: newValue,
@@ -114,7 +116,7 @@ function GridEditInputCell(props) {
114
116
  return function (_x) {
115
117
  return _ref2.apply(this, arguments);
116
118
  };
117
- }(), [api, debounceMs, field, id, onValueChange]);
119
+ }(), [apiRef, debounceMs, field, id, onValueChange]);
118
120
  React.useEffect(function () {
119
121
  setValueState(value);
120
122
  }, [value]);
@@ -13,6 +13,7 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
13
13
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
14
14
  import { GridEditModes } from '../../models/gridEditRowModel';
15
15
  import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
16
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
 
18
19
  var renderSingleSelectOptions = function renderSingleSelectOptions(option, OptionComponent) {
@@ -49,6 +50,7 @@ function GridEditSingleSelectCell(props) {
49
50
  onValueChange = props.onValueChange,
50
51
  other = _objectWithoutProperties(props, _excluded);
51
52
 
53
+ var apiRef = useGridApiContext();
52
54
  var ref = React.useRef();
53
55
  var inputRef = React.useRef();
54
56
  var rootProps = useGridRootProps();
@@ -114,7 +116,7 @@ function GridEditSingleSelectCell(props) {
114
116
 
115
117
  case 6:
116
118
  _context.next = 8;
117
- return api.setEditCellValue({
119
+ return apiRef.current.setEditCellValue({
118
120
  id: id,
119
121
  field: field,
120
122
  value: formattedTargetValue
@@ -140,7 +142,7 @@ function GridEditSingleSelectCell(props) {
140
142
 
141
143
  case 13:
142
144
  _context.next = 15;
143
- return Promise.resolve(api.commitCellChange({
145
+ return Promise.resolve(apiRef.current.commitCellChange({
144
146
  id: id,
145
147
  field: field
146
148
  }, event));
@@ -149,12 +151,12 @@ function GridEditSingleSelectCell(props) {
149
151
  canCommit = _context.sent;
150
152
 
151
153
  if (canCommit) {
152
- api.setCellMode(id, field, 'view');
154
+ apiRef.current.setCellMode(id, field, 'view');
153
155
 
154
156
  if (event.key) {
155
157
  // TODO v6: remove once we stop ignoring events fired from portals
156
- params = api.getCellParams(id, field);
157
- api.publishEvent('cellNavigationKeyDown', params, event);
158
+ params = apiRef.current.getCellParams(id, field);
159
+ apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
158
160
  }
159
161
  }
160
162
 
@@ -181,13 +183,13 @@ function GridEditSingleSelectCell(props) {
181
183
  var _rootProps$experiment2;
182
184
 
183
185
  if ((_rootProps$experiment2 = rootProps.experimentalFeatures) != null && _rootProps$experiment2.newEditingApi) {
184
- api.stopCellEditMode({
186
+ apiRef.current.stopCellEditMode({
185
187
  id: id,
186
188
  field: field,
187
189
  ignoreModifications: true
188
190
  });
189
191
  } else {
190
- api.setCellMode(id, field, 'view');
192
+ apiRef.current.setCellMode(id, field, 'view');
191
193
  }
192
194
  }
193
195
  };
@@ -91,7 +91,9 @@ export function GridColumnsPanel(props) {
91
91
  return apiRef.current.setColumnVisibilityModel({});
92
92
  }
93
93
 
94
- return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(function (col) {
94
+ return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.filter(function (col) {
95
+ return col.hideable !== false;
96
+ }).map(function (col) {
95
97
  return [col.field, false];
96
98
  })));
97
99
  } // TODO v6: Remove
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"];
3
+ var _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"],
4
+ _excluded2 = ["InputComponentProps"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import { unstable_composeClasses as composeClasses } from '@mui/material';
@@ -164,6 +165,10 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
164
165
  var baseSelectProps = ((_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect) || {};
165
166
  var isBaseSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
166
167
  var OptionComponent = isBaseSelectNative ? 'option' : MenuItem;
168
+
169
+ var InputComponentProps = valueInputProps.InputComponentProps,
170
+ valueInputPropsOther = _objectWithoutProperties(valueInputProps, _excluded2);
171
+
167
172
  var sortedFilterableColumns = React.useMemo(function () {
168
173
  switch (columnsSort) {
169
174
  case 'asc':
@@ -352,14 +357,14 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
352
357
  })), /*#__PURE__*/_jsx(FilterFormValueInput, _extends({
353
358
  variant: "standard",
354
359
  as: rootProps.components.BaseFormControl
355
- }, baseFormControlProps, valueInputProps, {
356
- className: clsx(classes.valueInput, baseFormControlProps.className, valueInputProps.className),
360
+ }, baseFormControlProps, valueInputPropsOther, {
361
+ className: clsx(classes.valueInput, baseFormControlProps.className, valueInputPropsOther.className),
357
362
  children: currentOperator != null && currentOperator.InputComponent ? /*#__PURE__*/_jsx(currentOperator.InputComponent, _extends({
358
363
  apiRef: apiRef,
359
364
  item: item,
360
365
  applyValue: applyFilterChanges,
361
366
  focusElementRef: valueRef
362
- }, currentOperator.InputComponentProps)) : null
367
+ }, currentOperator.InputComponentProps, InputComponentProps)) : null
363
368
  }))]
364
369
  }));
365
370
  });
@@ -39,8 +39,8 @@ export function GridFilterInputBoolean(props) {
39
39
  label: apiRef.current.getLocaleText('filterPanelInputLabel'),
40
40
  value: filterValueState,
41
41
  onChange: onFilterChange,
42
- variant: "standard",
43
42
  select: true,
43
+ variant: "standard",
44
44
  SelectProps: _extends({
45
45
  native: isSelectNative,
46
46
  displayEmpty: true
@@ -64,8 +64,8 @@ function GridFilterInputDate(props) {
64
64
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
65
65
  value: filterValueState,
66
66
  onChange: onFilterChange,
67
- type: type || 'text',
68
67
  variant: "standard",
68
+ type: type || 'text',
69
69
  InputLabelProps: {
70
70
  shrink: true
71
71
  },
@@ -85,7 +85,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
85
85
  // | These PropTypes are generated from the TypeScript type definitions |
86
86
  // | To update them edit the TypeScript types and run "yarn proptypes" |
87
87
  // ----------------------------------------------------------------------
88
- apiRef: PropTypes.any.isRequired,
88
+ apiRef: PropTypes.shape({
89
+ current: PropTypes.object.isRequired
90
+ }).isRequired,
89
91
  applyValue: PropTypes.func.isRequired,
90
92
  focusElementRef: PropTypes
91
93
  /* @typescript-to-proptypes-ignore */
@@ -2,14 +2,14 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _typeof from "@babel/runtime/helpers/esm/typeof";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
5
+ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
9
9
  import Chip from '@mui/material/Chip';
10
- import TextField from '@mui/material/TextField';
11
10
  import { unstable_useId as useId } from '@mui/material/utils';
12
11
  import { getValueFromOption } from './filterPanelUtils';
12
+ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
 
15
15
  var isOptionEqualToValue = function isOptionEqualToValue(option, value) {
@@ -24,14 +24,36 @@ function GridFilterInputMultipleSingleSelect(props) {
24
24
  type = props.type,
25
25
  apiRef = props.apiRef,
26
26
  focusElementRef = props.focusElementRef,
27
+ color = props.color,
28
+ error = props.error,
29
+ helperText = props.helperText,
30
+ size = props.size,
31
+ _props$variant = props.variant,
32
+ variant = _props$variant === void 0 ? 'standard' : _props$variant,
27
33
  other = _objectWithoutProperties(props, _excluded);
28
34
 
35
+ var TextFieldProps = {
36
+ color: color,
37
+ error: error,
38
+ helperText: helperText,
39
+ size: size,
40
+ variant: variant
41
+ };
29
42
  var id = useId();
43
+ var rootProps = useGridRootProps();
30
44
  var resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
31
45
  var resolvedValueOptions = React.useMemo(function () {
32
- return typeof (resolvedColumn == null ? void 0 : resolvedColumn.valueOptions) === 'function' ? resolvedColumn.valueOptions({
33
- field: resolvedColumn.field
34
- }) : resolvedColumn == null ? void 0 : resolvedColumn.valueOptions;
46
+ if (!(resolvedColumn != null && resolvedColumn.valueOptions)) {
47
+ return [];
48
+ }
49
+
50
+ if (typeof resolvedColumn.valueOptions === 'function') {
51
+ return resolvedColumn.valueOptions({
52
+ field: resolvedColumn.field
53
+ });
54
+ }
55
+
56
+ return resolvedColumn.valueOptions;
35
57
  }, [resolvedColumn]);
36
58
  var resolvedFormattedValueOptions = React.useMemo(function () {
37
59
  return resolvedValueOptions == null ? void 0 : resolvedValueOptions.map(getValueFromOption);
@@ -62,7 +84,7 @@ function GridFilterInputMultipleSingleSelect(props) {
62
84
 
63
85
  if (resolvedValueOptions !== undefined) {
64
86
  var itemValueIndexes = item.value.map(function (element) {
65
- // get the index matching between values and valueoptions
87
+ // get the index matching between values and valueOptions
66
88
  var formattedElement = getValueFromOption(element);
67
89
  var index = (resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(function (formatedOption) {
68
90
  return formatedOption === formattedElement;
@@ -94,8 +116,7 @@ function GridFilterInputMultipleSingleSelect(props) {
94
116
  return /*#__PURE__*/_jsx(Autocomplete, _extends({
95
117
  multiple: true,
96
118
  limitTags: 1,
97
- options: resolvedValueOptions // TODO: avoid `any`?
98
- ,
119
+ options: resolvedValueOptions,
99
120
  isOptionEqualToValue: isOptionEqualToValue,
100
121
  filterOptions: filter,
101
122
  id: id,
@@ -113,16 +134,17 @@ function GridFilterInputMultipleSingleSelect(props) {
113
134
  });
114
135
  },
115
136
  renderInput: function renderInput(params) {
116
- return /*#__PURE__*/_jsx(TextField, _extends({}, params, {
137
+ var _rootProps$components;
138
+
139
+ return /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
117
140
  label: apiRef.current.getLocaleText('filterPanelInputLabel'),
118
141
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
119
142
  InputLabelProps: _extends({}, params.InputLabelProps, {
120
143
  shrink: true
121
144
  }),
122
145
  inputRef: focusElementRef,
123
- type: 'singleSelect',
124
- variant: "standard"
125
- }));
146
+ type: "singleSelect"
147
+ }, TextFieldProps, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
126
148
  }
127
149
  }, other));
128
150
  }
@@ -2,13 +2,13 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
5
+ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import Autocomplete from '@mui/material/Autocomplete';
9
9
  import Chip from '@mui/material/Chip';
10
- import TextField from '@mui/material/TextField';
11
10
  import { unstable_useId as useId } from '@mui/material/utils';
11
+ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
 
14
14
  function GridFilterInputMultipleValue(props) {
@@ -17,14 +17,28 @@ function GridFilterInputMultipleValue(props) {
17
17
  type = props.type,
18
18
  apiRef = props.apiRef,
19
19
  focusElementRef = props.focusElementRef,
20
+ color = props.color,
21
+ error = props.error,
22
+ helperText = props.helperText,
23
+ size = props.size,
24
+ variant = props.variant,
20
25
  other = _objectWithoutProperties(props, _excluded);
21
26
 
27
+ var TextFieldProps = {
28
+ color: color,
29
+ error: error,
30
+ helperText: helperText,
31
+ size: size,
32
+ variant: variant
33
+ };
34
+
22
35
  var _React$useState = React.useState(item.value || []),
23
36
  _React$useState2 = _slicedToArray(_React$useState, 2),
24
37
  filterValueState = _React$useState2[0],
25
38
  setFilterValueState = _React$useState2[1];
26
39
 
27
40
  var id = useId();
41
+ var rootProps = useGridRootProps();
28
42
  React.useEffect(function () {
29
43
  var _item$value;
30
44
 
@@ -61,16 +75,17 @@ function GridFilterInputMultipleValue(props) {
61
75
  });
62
76
  },
63
77
  renderInput: function renderInput(params) {
64
- return /*#__PURE__*/_jsx(TextField, _extends({}, params, {
78
+ var _rootProps$components;
79
+
80
+ return /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
65
81
  label: apiRef.current.getLocaleText('filterPanelInputLabel'),
66
82
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
67
83
  InputLabelProps: _extends({}, params.InputLabelProps, {
68
84
  shrink: true
69
85
  }),
70
86
  inputRef: focusElementRef,
71
- type: type || 'text',
72
- variant: "standard"
73
- }));
87
+ type: type || 'text'
88
+ }, TextFieldProps, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
74
89
  }
75
90
  }, other));
76
91
  }
@@ -80,7 +95,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleValue.propTypes =
80
95
  // | These PropTypes are generated from the TypeScript type definitions |
81
96
  // | To update them edit the TypeScript types and run "yarn proptypes" |
82
97
  // ----------------------------------------------------------------------
83
- apiRef: PropTypes.any.isRequired,
98
+ apiRef: PropTypes.shape({
99
+ current: PropTypes.object.isRequired
100
+ }).isRequired,
84
101
  applyValue: PropTypes.func.isRequired,
85
102
  focusElementRef: PropTypes
86
103
  /* @typescript-to-proptypes-ignore */
@@ -57,6 +57,10 @@ function GridFilterInputSingleSelect(props) {
57
57
  var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
58
58
  var currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
59
59
  var currentValueOptions = React.useMemo(function () {
60
+ if (currentColumn === null) {
61
+ return undefined;
62
+ }
63
+
60
64
  return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({
61
65
  field: currentColumn.field
62
66
  }) : currentColumn.valueOptions;
@@ -98,8 +102,8 @@ function GridFilterInputSingleSelect(props) {
98
102
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
99
103
  value: filterValueState,
100
104
  onChange: onFilterChange,
101
- type: type || 'text',
102
105
  variant: "standard",
106
+ type: type || 'text',
103
107
  InputLabelProps: {
104
108
  shrink: true
105
109
  },
@@ -118,7 +122,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
118
122
  // | These PropTypes are generated from the TypeScript type definitions |
119
123
  // | To update them edit the TypeScript types and run "yarn proptypes" |
120
124
  // ----------------------------------------------------------------------
121
- apiRef: PropTypes.any.isRequired,
125
+ apiRef: PropTypes.shape({
126
+ current: PropTypes.object.isRequired
127
+ }).isRequired,
122
128
  applyValue: PropTypes.func.isRequired,
123
129
  focusElementRef: PropTypes
124
130
  /* @typescript-to-proptypes-ignore */
@@ -124,8 +124,8 @@ function GridFilterInputValue(props) {
124
124
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
125
125
  value: filterValueState,
126
126
  onChange: onFilterChange,
127
- type: type || 'text',
128
127
  variant: "standard",
128
+ type: type || 'text',
129
129
  InputProps: InputProps,
130
130
  InputLabelProps: {
131
131
  shrink: true
@@ -139,7 +139,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
139
139
  // | These PropTypes are generated from the TypeScript type definitions |
140
140
  // | To update them edit the TypeScript types and run "yarn proptypes" |
141
141
  // ----------------------------------------------------------------------
142
- apiRef: PropTypes.any.isRequired,
142
+ apiRef: PropTypes.shape({
143
+ current: PropTypes.object.isRequired
144
+ }).isRequired,
143
145
  applyValue: PropTypes.func.isRequired,
144
146
  focusElementRef: PropTypes
145
147
  /* @typescript-to-proptypes-ignore */
@@ -70,21 +70,33 @@ export function useGridDimensions(apiRef, props) {
70
70
  rootElement.removeChild(scrollDiv);
71
71
  }
72
72
 
73
- var viewportOuterSize = {
74
- width: rootDimensionsRef.current.width,
75
- height: props.autoHeight ? rowsMeta.currentPageTotalHeight : rootDimensionsRef.current.height - headerHeight
76
- };
77
-
78
- var _hasScroll = hasScroll({
79
- content: {
80
- width: Math.round(columnsTotalWidth),
81
- height: rowsMeta.currentPageTotalHeight
82
- },
83
- container: viewportOuterSize,
84
- scrollBarSize: scrollBarSize
85
- }),
86
- hasScrollX = _hasScroll.hasScrollX,
87
- hasScrollY = _hasScroll.hasScrollY;
73
+ var viewportOuterSize;
74
+ var hasScrollX;
75
+ var hasScrollY;
76
+
77
+ if (props.autoHeight) {
78
+ hasScrollY = false;
79
+ hasScrollX = Math.round(columnsTotalWidth) > rootDimensionsRef.current.width;
80
+ viewportOuterSize = {
81
+ width: rootDimensionsRef.current.width,
82
+ height: rowsMeta.currentPageTotalHeight + (hasScrollX ? scrollBarSize : 0)
83
+ };
84
+ } else {
85
+ viewportOuterSize = {
86
+ width: rootDimensionsRef.current.width,
87
+ height: rootDimensionsRef.current.height - headerHeight
88
+ };
89
+ var scrollInformation = hasScroll({
90
+ content: {
91
+ width: Math.round(columnsTotalWidth),
92
+ height: rowsMeta.currentPageTotalHeight
93
+ },
94
+ container: viewportOuterSize,
95
+ scrollBarSize: scrollBarSize
96
+ });
97
+ hasScrollY = scrollInformation.hasScrollY;
98
+ hasScrollX = scrollInformation.hasScrollX;
99
+ }
88
100
 
89
101
  var viewportInnerSize = {
90
102
  width: viewportOuterSize.width - (hasScrollY ? scrollBarSize : 0),
@@ -78,6 +78,12 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
78
78
  }, [apiRef]);
79
79
  var handleCellKeyDown = React.useCallback(function (params, event) {
80
80
  if (params.cellMode === GridCellModes.Edit) {
81
+ // Wait until IME is settled for Asian languages like Japanese and Chinese
82
+ // TODO: `event.which` is depricated but this is a temporary workaround
83
+ if (event.which === 229) {
84
+ return;
85
+ }
86
+
81
87
  var reason;
82
88
 
83
89
  if (event.key === 'Escape') {
@@ -100,7 +106,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
100
106
  var _reason;
101
107
 
102
108
  if (isPrintableKey(event.key)) {
103
- if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) {
109
+ if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
104
110
  return;
105
111
  }
106
112
 
@@ -189,16 +189,24 @@ export var useCellEditing = function useCellEditing(apiRef, props) {
189
189
  while (1) {
190
190
  switch (_context.prev = _context.next) {
191
191
  case 0:
192
+ if (!(event.which === 229)) {
193
+ _context.next = 2;
194
+ break;
195
+ }
196
+
197
+ return _context.abrupt("return");
198
+
199
+ case 2:
192
200
  id = params.id, field = params.field, cellMode = params.cellMode, isEditable = params.isEditable;
193
201
 
194
202
  if (isEditable) {
195
- _context.next = 3;
203
+ _context.next = 5;
196
204
  break;
197
205
  }
198
206
 
199
207
  return _context.abrupt("return");
200
208
 
201
- case 3:
209
+ case 5:
202
210
  isEditMode = cellMode === GridCellModes.Edit;
203
211
  isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey;
204
212
 
@@ -220,7 +228,7 @@ export var useCellEditing = function useCellEditing(apiRef, props) {
220
228
  }
221
229
 
222
230
  if (!(isEditMode && isCellEditCommitKeys(event.key))) {
223
- _context.next = 14;
231
+ _context.next = 16;
224
232
  break;
225
233
  }
226
234
 
@@ -228,25 +236,25 @@ export var useCellEditing = function useCellEditing(apiRef, props) {
228
236
  id: id,
229
237
  field: field
230
238
  };
231
- _context.next = 11;
239
+ _context.next = 13;
232
240
  return apiRef.current.commitCellChange(commitParams, event);
233
241
 
234
- case 11:
242
+ case 13:
235
243
  isValid = _context.sent;
236
244
 
237
245
  if (isValid) {
238
- _context.next = 14;
246
+ _context.next = 16;
239
247
  break;
240
248
  }
241
249
 
242
250
  return _context.abrupt("return");
243
251
 
244
- case 14:
252
+ case 16:
245
253
  if (isEditMode && isCellExitEditModeKeys(event.key)) {
246
254
  apiRef.current.publishEvent('cellEditStop', params, event);
247
255
  }
248
256
 
249
- case 15:
257
+ case 17:
250
258
  case "end":
251
259
  return _context.stop();
252
260
  }
@@ -116,6 +116,12 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
116
116
  }, []);
117
117
  var handleCellKeyDown = React.useCallback(function (params, event) {
118
118
  if (params.cellMode === GridRowModes.Edit) {
119
+ // Wait until IME is settled for Asian languages like Japanese and Chinese
120
+ // TODO: `event.which` is depricated but this is a temporary workaround
121
+ if (event.which === 229) {
122
+ return;
123
+ }
124
+
119
125
  var reason;
120
126
 
121
127
  if (event.key === 'Escape') {
@@ -156,7 +162,7 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
156
162
  var _reason;
157
163
 
158
164
  if (isPrintableKey(event.key)) {
159
- if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) {
165
+ if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
160
166
  return;
161
167
  }
162
168
 
@@ -241,62 +241,70 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
241
241
  while (1) {
242
242
  switch (_context3.prev = _context3.next) {
243
243
  case 0:
244
+ if (!(event.which === 229)) {
245
+ _context3.next = 2;
246
+ break;
247
+ }
248
+
249
+ return _context3.abrupt("return");
250
+
251
+ case 2:
244
252
  cellMode = params.cellMode, isEditable = params.isEditable;
245
253
 
246
254
  if (isEditable) {
247
- _context3.next = 3;
255
+ _context3.next = 5;
248
256
  break;
249
257
  }
250
258
 
251
259
  return _context3.abrupt("return");
252
260
 
253
- case 3:
261
+ case 5:
254
262
  isEditMode = cellMode === GridCellModes.Edit;
255
263
  rowParams = apiRef.current.getRowParams(params.id);
256
264
 
257
265
  if (!isEditMode) {
258
- _context3.next = 18;
266
+ _context3.next = 20;
259
267
  break;
260
268
  }
261
269
 
262
270
  if (!(event.key === 'Enter')) {
263
- _context3.next = 15;
271
+ _context3.next = 17;
264
272
  break;
265
273
  }
266
274
 
267
- _context3.next = 9;
275
+ _context3.next = 11;
268
276
  return apiRef.current.commitRowChange(params.id);
269
277
 
270
- case 9:
278
+ case 11:
271
279
  isValid = _context3.sent;
272
280
 
273
281
  if (!(!isValid && (_props$experimentalFe3 = props.experimentalFeatures) != null && _props$experimentalFe3.preventCommitWhileValidating)) {
274
- _context3.next = 12;
282
+ _context3.next = 14;
275
283
  break;
276
284
  }
277
285
 
278
286
  return _context3.abrupt("return");
279
287
 
280
- case 12:
288
+ case 14:
281
289
  apiRef.current.publishEvent('rowEditStop', rowParams, event);
282
- _context3.next = 16;
290
+ _context3.next = 18;
283
291
  break;
284
292
 
285
- case 15:
293
+ case 17:
286
294
  if (event.key === 'Escape') {
287
295
  apiRef.current.publishEvent('rowEditStop', rowParams, event);
288
296
  }
289
297
 
290
- case 16:
291
- _context3.next = 19;
298
+ case 18:
299
+ _context3.next = 21;
292
300
  break;
293
301
 
294
- case 18:
302
+ case 20:
295
303
  if (event.key === 'Enter') {
296
304
  apiRef.current.publishEvent('rowEditStart', rowParams, event);
297
305
  }
298
306
 
299
- case 19:
307
+ case 21:
300
308
  case "end":
301
309
  return _context3.stop();
302
310
  }