@mui/x-data-grid 6.0.0 → 6.0.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 (53) hide show
  1. package/CHANGELOG.md +103 -12
  2. package/DataGrid/DataGrid.js +6 -6
  3. package/components/cell/GridEditSingleSelectCell.js +10 -4
  4. package/components/panel/GridPanel.d.ts +9 -1
  5. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
  6. package/constants/gridClasses.d.ts +1 -1
  7. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
  8. package/hooks/features/columnMenu/columnMenuInterfaces.d.ts +2 -2
  9. package/hooks/features/columns/gridColumnsUtils.js +2 -9
  10. package/hooks/features/editing/useGridCellEditing.js +3 -3
  11. package/hooks/features/editing/useGridEditing.js +1 -1
  12. package/hooks/features/editing/useGridRowEditing.js +3 -3
  13. package/hooks/features/export/useGridPrintExport.js +10 -11
  14. package/index.js +1 -1
  15. package/legacy/DataGrid/DataGrid.js +6 -6
  16. package/legacy/components/cell/GridEditSingleSelectCell.js +10 -6
  17. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +2 -2
  18. package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
  19. package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -9
  20. package/legacy/hooks/features/editing/useGridCellEditing.js +3 -3
  21. package/legacy/hooks/features/editing/useGridEditing.js +1 -1
  22. package/legacy/hooks/features/editing/useGridRowEditing.js +3 -3
  23. package/legacy/hooks/features/export/useGridPrintExport.js +10 -11
  24. package/legacy/index.js +1 -1
  25. package/legacy/locales/ptBR.js +1 -1
  26. package/locales/ptBR.js +1 -1
  27. package/material/index.d.ts +9 -1
  28. package/models/api/gridEditingApi.d.ts +1 -1
  29. package/models/gridSlotsComponentsProps.d.ts +1 -1
  30. package/models/props/DataGridProps.d.ts +6 -6
  31. package/modern/DataGrid/DataGrid.js +6 -6
  32. package/modern/components/cell/GridEditSingleSelectCell.js +10 -4
  33. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
  34. package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
  35. package/modern/hooks/features/columns/gridColumnsUtils.js +2 -9
  36. package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
  37. package/modern/hooks/features/editing/useGridEditing.js +1 -1
  38. package/modern/hooks/features/editing/useGridRowEditing.js +3 -3
  39. package/modern/hooks/features/export/useGridPrintExport.js +10 -11
  40. package/modern/index.js +1 -1
  41. package/modern/locales/ptBR.js +1 -1
  42. package/node/DataGrid/DataGrid.js +6 -6
  43. package/node/components/cell/GridEditSingleSelectCell.js +10 -4
  44. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
  45. package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
  46. package/node/hooks/features/columns/gridColumnsUtils.js +3 -10
  47. package/node/hooks/features/editing/useGridCellEditing.js +3 -3
  48. package/node/hooks/features/editing/useGridEditing.js +1 -1
  49. package/node/hooks/features/editing/useGridRowEditing.js +3 -3
  50. package/node/hooks/features/export/useGridPrintExport.js +10 -11
  51. package/node/index.js +1 -1
  52. package/node/locales/ptBR.js +1 -1
  53. package/package.json +2 -2
@@ -109,12 +109,12 @@ DataGridRaw.propTypes = {
109
109
  */
110
110
  columnVisibilityModel: _propTypes.default.object,
111
111
  /**
112
- * Overrideable components.
112
+ * Overridable components.
113
113
  * @deprecated Use `slots` instead.
114
114
  */
115
115
  components: _propTypes.default.object,
116
116
  /**
117
- * Overrideable components props dynamically passed to the component at rendering.
117
+ * Overridable components props dynamically passed to the component at rendering.
118
118
  * @deprecated Use the `slotProps` prop instead.
119
119
  */
120
120
  componentsProps: _propTypes.default.object,
@@ -331,7 +331,7 @@ DataGridRaw.propTypes = {
331
331
  onCellKeyDown: _propTypes.default.func,
332
332
  /**
333
333
  * Callback fired when the `cellModesModel` prop changes.
334
- * @param {GridCellModesModel} cellModesModel Object containig which cells are in "edit" mode.
334
+ * @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
335
335
  * @param {GridCallbackDetails} details Additional details for this callback.
336
336
  */
337
337
  onCellModesModelChange: _propTypes.default.func,
@@ -477,7 +477,7 @@ DataGridRaw.propTypes = {
477
477
  onRowEditStop: _propTypes.default.func,
478
478
  /**
479
479
  * Callback fired when the `rowModesModel` prop changes.
480
- * @param {GridRowModesModel} rowModesModel Object containig which rows are in "edit" mode.
480
+ * @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
481
481
  * @param {GridCallbackDetails} details Additional details for this callback.
482
482
  */
483
483
  onRowModesModelChange: _propTypes.default.func,
@@ -591,11 +591,11 @@ DataGridRaw.propTypes = {
591
591
  */
592
592
  showColumnVerticalBorder: _propTypes.default.bool,
593
593
  /**
594
- * Overrideable components props dynamically passed to the component at rendering.
594
+ * Overridable components props dynamically passed to the component at rendering.
595
595
  */
596
596
  slotProps: _propTypes.default.object,
597
597
  /**
598
- * Overrideable components.
598
+ * Overridable components.
599
599
  */
600
600
  slots: _propTypes.default.object,
601
601
  /**
@@ -17,7 +17,8 @@ var _gridEditRowModel = require("../../models/gridEditRowModel");
17
17
  var _filterPanelUtils = require("../panel/filterPanel/filterPanelUtils");
18
18
  var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
- const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"];
20
+ const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"],
21
+ _excluded2 = ["MenuProps"];
21
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
23
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
24
  function isKeyboardEvent(event) {
@@ -45,6 +46,11 @@ function GridEditSingleSelectCell(props) {
45
46
  const [open, setOpen] = React.useState(initialOpen);
46
47
  const baseSelectProps = rootProps.slotProps?.baseSelect || {};
47
48
  const isSelectNative = baseSelectProps.native ?? false;
49
+ const _ref = rootProps.slotProps?.baseSelect || {},
50
+ {
51
+ MenuProps
52
+ } = _ref,
53
+ otherBaseSelectProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
48
54
  (0, _utils.unstable_useEnhancedEffect)(() => {
49
55
  if (hasFocus) {
50
56
  inputRef.current?.focus();
@@ -114,13 +120,13 @@ function GridEditSingleSelectCell(props) {
114
120
  onChange: handleChange,
115
121
  open: open,
116
122
  onOpen: handleOpen,
117
- MenuProps: {
123
+ MenuProps: (0, _extends2.default)({
118
124
  onClose: handleClose
119
- },
125
+ }, MenuProps),
120
126
  error: error,
121
127
  native: isSelectNative,
122
128
  fullWidth: true
123
- }, other, rootProps.slotProps?.baseSelect, {
129
+ }, other, otherBaseSelectProps, {
124
130
  children: valueOptions.map(valueOption => {
125
131
  const value = getOptionValue(valueOption);
126
132
  return /*#__PURE__*/(0, React.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, rootProps.slotProps?.baseSelectOption || {}, {
@@ -77,7 +77,7 @@ function GridFilterInputMultipleSingleSelect(props) {
77
77
  if (resolvedValueOptions !== undefined) {
78
78
  const itemValueIndexes = item.value.map(element => {
79
79
  // Gets the index matching between values and valueOptions
80
- return resolvedFormattedValueOptions?.findIndex(formatedOption => formatedOption === element);
80
+ return resolvedFormattedValueOptions?.findIndex(formattedOption => formattedOption === element);
81
81
  });
82
82
  return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
83
83
  }
@@ -7,12 +7,12 @@ exports.unwrapGroupingColumnModel = exports.getColumnGroupsHeaderStructure = voi
7
7
  var _gridColumnGrouping = require("../../../models/gridColumnGrouping");
8
8
  var _utils = require("../../../utils/utils");
9
9
  // This is the recurrence function that help writing `unwrapGroupingColumnModel()`
10
- const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplet) => {
10
+ const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
11
11
  if ((0, _gridColumnGrouping.isLeaf)(columnGroupNode)) {
12
- if (unwrappedGroupingModelToComplet[columnGroupNode.field] !== undefined) {
13
- throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field} occurrs two times in the grouping model:`, `- ${unwrappedGroupingModelToComplet[columnGroupNode.field].join(' > ')}`, `- ${parents.join(' > ')}`].join('\n'));
12
+ if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
13
+ throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field} occurs two times in the grouping model:`, `- ${unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')}`, `- ${parents.join(' > ')}`].join('\n'));
14
14
  }
15
- unwrappedGroupingModelToComplet[columnGroupNode.field] = parents;
15
+ unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
16
16
  return;
17
17
  }
18
18
  const {
@@ -20,7 +20,7 @@ const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedG
20
20
  children
21
21
  } = columnGroupNode;
22
22
  children.forEach(child => {
23
- recurrentUnwrapGroupingColumnModel(child, [...parents, groupId], unwrappedGroupingModelToComplet);
23
+ recurrentUnwrapGroupingColumnModel(child, [...parents, groupId], unwrappedGroupingModelToComplete);
24
24
  });
25
25
  };
26
26
 
@@ -164,13 +164,12 @@ const hydrateColumnsWidth = (rawState, viewportInnerWidth) => {
164
164
  lookup: columnsLookup
165
165
  });
166
166
  };
167
- exports.hydrateColumnsWidth = hydrateColumnsWidth;
168
- let columnTypeWarnedOnce = false;
169
167
 
170
168
  /**
171
169
  * Apply the order and the dimensions of the initial state.
172
170
  * The columns not registered in `orderedFields` will be placed after the imported columns.
173
171
  */
172
+ exports.hydrateColumnsWidth = hydrateColumnsWidth;
174
173
  const applyInitialState = (columnsState, initialState) => {
175
174
  if (!initialState) {
176
175
  return columnsState;
@@ -254,14 +253,8 @@ const createColumnsState = ({
254
253
  let existingState = columnsState.lookup[field];
255
254
  if (existingState == null) {
256
255
  let colDef = columnTypes[_colDef.DEFAULT_GRID_COL_TYPE_KEY];
257
- if (newColumn.type) {
258
- if (process.env.NODE_ENV !== 'production' && !columnTypeWarnedOnce && !columnTypes[newColumn.type]) {
259
- console.warn([`MUI: The column type "${newColumn.type}" you are using is not supported.`, `Column type "string" is being used instead.`].join('\n'));
260
- columnTypeWarnedOnce = true;
261
- }
262
- if (columnTypes[newColumn.type]) {
263
- colDef = columnTypes[newColumn.type];
264
- }
256
+ if (newColumn.type && columnTypes[newColumn.type]) {
257
+ colDef = columnTypes[newColumn.type];
265
258
  }
266
259
  existingState = (0, _extends2.default)({}, colDef, {
267
260
  field,
@@ -77,7 +77,7 @@ const useGridCellEditing = (apiRef, props) => {
77
77
  const handleCellKeyDown = React.useCallback((params, event) => {
78
78
  if (params.cellMode === _gridEditRowModel.GridCellModes.Edit) {
79
79
  // Wait until IME is settled for Asian languages like Japanese and Chinese
80
- // TODO: `event.which` is depricated but this is a temporary workaround
80
+ // TODO: `event.which` is deprecated but this is a temporary workaround
81
81
  if (event.which === 229) {
82
82
  return;
83
83
  }
@@ -99,8 +99,8 @@ const useGridCellEditing = (apiRef, props) => {
99
99
  }
100
100
  } else if (params.isEditable) {
101
101
  let reason;
102
- if (event.key === ' ' && event.shiftKey) {
103
- return; // Shift + Space is used to select the row
102
+ if (event.key === ' ') {
103
+ return; // Space scrolls to the last row
104
104
  }
105
105
 
106
106
  if ((0, _keyboardUtils.isPrintableKey)(event)) {
@@ -57,7 +57,7 @@ const useGridEditing = (apiRef, props) => {
57
57
  clearTimeout(timeout);
58
58
  }
59
59
 
60
- // To run the callback immediatelly without waiting the timeout
60
+ // To run the callback immediately without waiting the timeout
61
61
  const runImmediately = () => {
62
62
  const [timeout] = debounceMap.current[id][field];
63
63
  clearTimeout(timeout);
@@ -112,7 +112,7 @@ const useGridRowEditing = (apiRef, props) => {
112
112
  const handleCellKeyDown = React.useCallback((params, event) => {
113
113
  if (params.cellMode === _gridEditRowModel.GridRowModes.Edit) {
114
114
  // Wait until IME is settled for Asian languages like Japanese and Chinese
115
- // TODO: `event.which` is depricated but this is a temporary workaround
115
+ // TODO: `event.which` is deprecated but this is a temporary workaround
116
116
  if (event.which === 229) {
117
117
  return;
118
118
  }
@@ -152,8 +152,8 @@ const useGridRowEditing = (apiRef, props) => {
152
152
  }
153
153
  } else if (params.isEditable) {
154
154
  let reason;
155
- if (event.key === ' ' && event.shiftKey) {
156
- return; // Shift + Space is used to select the row
155
+ if (event.key === ' ') {
156
+ return; // Space scrolls to the last row
157
157
  }
158
158
 
159
159
  if ((0, _keyboardUtils.isPrintableKey)(event)) {
@@ -28,6 +28,15 @@ function raf() {
28
28
  });
29
29
  });
30
30
  }
31
+ function buildPrintWindow(title) {
32
+ const iframeEl = document.createElement('iframe');
33
+ iframeEl.style.position = 'absolute';
34
+ iframeEl.style.width = '0px';
35
+ iframeEl.style.height = '0px';
36
+ iframeEl.title = title || document.title;
37
+ return iframeEl;
38
+ }
39
+
31
40
  /**
32
41
  * @requires useGridColumns (state)
33
42
  * @requires useGridFilter (state)
@@ -66,16 +75,6 @@ const useGridPrintExport = (apiRef, props) => {
66
75
  apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
67
76
  resolve();
68
77
  }), [apiRef]);
69
-
70
- // TODO move outside of this scope and remove React.useCallback
71
- const buildPrintWindow = React.useCallback(title => {
72
- const iframeEl = document.createElement('iframe');
73
- iframeEl.style.position = 'absolute';
74
- iframeEl.style.width = '0px';
75
- iframeEl.style.height = '0px';
76
- iframeEl.title = title || document.title;
77
- return iframeEl;
78
- }, []);
79
78
  const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
80
79
  const normalizeOptions = (0, _extends2.default)({
81
80
  copyStyles: true,
@@ -218,7 +217,7 @@ const useGridPrintExport = (apiRef, props) => {
218
217
  };
219
218
  doc.current.body.appendChild(printWindow);
220
219
  }
221
- }, [props, logger, apiRef, buildPrintWindow, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
220
+ }, [props, logger, apiRef, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
222
221
  const printExportApi = {
223
222
  exportDataAsPrint
224
223
  };
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.0.0
2
+ * @mui/x-data-grid v6.0.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -73,7 +73,7 @@ const ptBRGrid = {
73
73
  // Column menu text
74
74
  columnMenuLabel: 'Menu',
75
75
  columnMenuShowColumns: 'Exibir colunas',
76
- // columnMenuManageColumns: 'Manage columns',
76
+ columnMenuManageColumns: 'Gerir colunas',
77
77
  columnMenuFilter: 'Filtrar',
78
78
  columnMenuHideColumn: 'Ocultar',
79
79
  columnMenuUnsort: 'Desfazer ordenação',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "The community edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@babel/runtime": "^7.20.13",
39
- "@mui/utils": "^5.11.7",
39
+ "@mui/utils": "^5.11.13",
40
40
  "clsx": "^1.2.1",
41
41
  "prop-types": "^15.8.1",
42
42
  "reselect": "^4.1.7"