@mui/x-data-grid 7.0.0-alpha.6 → 7.0.0-alpha.8

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 (136) hide show
  1. package/CHANGELOG.md +357 -49
  2. package/DataGrid/DataGrid.js +8 -16
  3. package/colDef/gridDateColDef.js +1 -1
  4. package/components/GridPagination.d.ts +4 -4
  5. package/components/GridPagination.js +1 -1
  6. package/components/cell/GridActionsCell.js +1 -1
  7. package/components/cell/GridActionsCellItem.d.ts +5 -5
  8. package/components/cell/GridCell.js +2 -2
  9. package/components/panel/GridPanel.d.ts +3 -3
  10. package/components/panel/filterPanel/GridFilterForm.js +1 -1
  11. package/components/toolbar/GridToolbarQuickFilter.d.ts +4 -0
  12. package/components/toolbar/GridToolbarQuickFilter.js +4 -0
  13. package/hooks/core/useGridLoggerFactory.js +2 -2
  14. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  15. package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
  16. package/hooks/features/editing/useGridCellEditing.js +4 -4
  17. package/hooks/features/editing/useGridRowEditing.js +4 -4
  18. package/hooks/features/export/serializers/csvSerializer.js +1 -1
  19. package/hooks/features/export/useGridPrintExport.js +1 -1
  20. package/hooks/features/filter/gridFilterUtils.js +26 -29
  21. package/hooks/features/pagination/gridPaginationUtils.js +2 -2
  22. package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  23. package/hooks/features/rows/gridRowsUtils.js +2 -2
  24. package/hooks/features/rows/useGridRows.js +7 -7
  25. package/hooks/features/rows/useGridRowsMeta.js +2 -2
  26. package/hooks/features/sorting/gridSortingUtils.js +4 -2
  27. package/hooks/utils/useGridApiContext.js +1 -1
  28. package/hooks/utils/useGridPrivateApiContext.js +1 -1
  29. package/hooks/utils/useGridRootProps.js +1 -1
  30. package/hooks/utils/useGridSelector.js +1 -1
  31. package/index.d.ts +0 -1
  32. package/index.js +1 -2
  33. package/internals/index.d.ts +1 -0
  34. package/internals/utils/index.d.ts +1 -0
  35. package/internals/utils/index.js +2 -1
  36. package/internals/utils/propValidation.d.ts +4 -0
  37. package/internals/utils/propValidation.js +19 -0
  38. package/legacy/DataGrid/DataGrid.js +13 -18
  39. package/legacy/colDef/gridDateColDef.js +1 -1
  40. package/legacy/components/GridPagination.js +1 -1
  41. package/legacy/components/cell/GridActionsCell.js +1 -1
  42. package/legacy/components/cell/GridCell.js +2 -2
  43. package/legacy/components/panel/filterPanel/GridFilterForm.js +1 -1
  44. package/legacy/components/toolbar/GridToolbarQuickFilter.js +4 -0
  45. package/legacy/hooks/core/useGridLoggerFactory.js +2 -2
  46. package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  47. package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
  48. package/legacy/hooks/features/editing/useGridCellEditing.js +4 -4
  49. package/legacy/hooks/features/editing/useGridRowEditing.js +4 -4
  50. package/legacy/hooks/features/export/serializers/csvSerializer.js +1 -1
  51. package/legacy/hooks/features/export/useGridPrintExport.js +1 -1
  52. package/legacy/hooks/features/filter/gridFilterUtils.js +25 -22
  53. package/legacy/hooks/features/pagination/gridPaginationUtils.js +2 -2
  54. package/legacy/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  55. package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
  56. package/legacy/hooks/features/rows/useGridParamsApi.js +4 -5
  57. package/legacy/hooks/features/rows/useGridRows.js +7 -7
  58. package/legacy/hooks/features/rows/useGridRowsMeta.js +2 -2
  59. package/legacy/hooks/features/sorting/gridSortingUtils.js +4 -2
  60. package/legacy/hooks/utils/useGridApiContext.js +1 -1
  61. package/legacy/hooks/utils/useGridPrivateApiContext.js +1 -1
  62. package/legacy/hooks/utils/useGridRootProps.js +1 -1
  63. package/legacy/hooks/utils/useGridSelector.js +1 -1
  64. package/legacy/index.js +1 -2
  65. package/legacy/internals/utils/index.js +2 -1
  66. package/legacy/internals/utils/propValidation.js +21 -0
  67. package/legacy/locales/csCZ.js +2 -2
  68. package/legacy/utils/createSelector.js +1 -1
  69. package/legacy/utils/exportAs.js +1 -1
  70. package/locales/csCZ.js +2 -2
  71. package/models/props/DataGridProps.d.ts +1 -2
  72. package/modern/DataGrid/DataGrid.js +8 -16
  73. package/modern/colDef/gridDateColDef.js +1 -1
  74. package/modern/components/GridPagination.js +1 -1
  75. package/modern/components/cell/GridActionsCell.js +1 -1
  76. package/modern/components/cell/GridCell.js +2 -2
  77. package/modern/components/panel/filterPanel/GridFilterForm.js +1 -1
  78. package/modern/components/toolbar/GridToolbarQuickFilter.js +4 -0
  79. package/modern/hooks/core/useGridLoggerFactory.js +2 -2
  80. package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  81. package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
  82. package/modern/hooks/features/editing/useGridCellEditing.js +4 -4
  83. package/modern/hooks/features/editing/useGridRowEditing.js +4 -4
  84. package/modern/hooks/features/export/serializers/csvSerializer.js +1 -1
  85. package/modern/hooks/features/export/useGridPrintExport.js +1 -1
  86. package/modern/hooks/features/filter/gridFilterUtils.js +26 -29
  87. package/modern/hooks/features/pagination/gridPaginationUtils.js +2 -2
  88. package/modern/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  89. package/modern/hooks/features/rows/gridRowsUtils.js +2 -2
  90. package/modern/hooks/features/rows/useGridRows.js +7 -7
  91. package/modern/hooks/features/rows/useGridRowsMeta.js +2 -2
  92. package/modern/hooks/features/sorting/gridSortingUtils.js +4 -2
  93. package/modern/hooks/utils/useGridApiContext.js +1 -1
  94. package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
  95. package/modern/hooks/utils/useGridRootProps.js +1 -1
  96. package/modern/hooks/utils/useGridSelector.js +1 -1
  97. package/modern/index.js +1 -2
  98. package/modern/internals/utils/index.js +2 -1
  99. package/modern/internals/utils/propValidation.js +19 -0
  100. package/modern/locales/csCZ.js +2 -2
  101. package/modern/utils/createSelector.js +1 -1
  102. package/modern/utils/exportAs.js +1 -1
  103. package/node/DataGrid/DataGrid.js +8 -16
  104. package/node/colDef/gridDateColDef.js +1 -1
  105. package/node/components/GridPagination.js +1 -1
  106. package/node/components/cell/GridActionsCell.js +1 -1
  107. package/node/components/cell/GridCell.js +2 -2
  108. package/node/components/panel/filterPanel/GridFilterForm.js +1 -1
  109. package/node/components/toolbar/GridToolbarQuickFilter.js +4 -0
  110. package/node/hooks/core/useGridLoggerFactory.js +2 -2
  111. package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  112. package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
  113. package/node/hooks/features/editing/useGridCellEditing.js +4 -4
  114. package/node/hooks/features/editing/useGridRowEditing.js +4 -4
  115. package/node/hooks/features/export/serializers/csvSerializer.js +1 -1
  116. package/node/hooks/features/export/useGridPrintExport.js +1 -1
  117. package/node/hooks/features/filter/gridFilterUtils.js +26 -28
  118. package/node/hooks/features/pagination/gridPaginationUtils.js +2 -2
  119. package/node/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  120. package/node/hooks/features/rows/gridRowsUtils.js +2 -2
  121. package/node/hooks/features/rows/useGridRows.js +7 -7
  122. package/node/hooks/features/rows/useGridRowsMeta.js +2 -2
  123. package/node/hooks/features/sorting/gridSortingUtils.js +4 -2
  124. package/node/hooks/utils/useGridApiContext.js +1 -1
  125. package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
  126. package/node/hooks/utils/useGridRootProps.js +1 -1
  127. package/node/hooks/utils/useGridSelector.js +1 -1
  128. package/node/index.js +1 -13
  129. package/node/internals/utils/index.js +11 -0
  130. package/node/internals/utils/propValidation.js +26 -0
  131. package/node/locales/csCZ.js +2 -2
  132. package/node/utils/createSelector.js +1 -1
  133. package/node/utils/exportAs.js +1 -1
  134. package/package.json +4 -4
  135. package/utils/createSelector.js +1 -1
  136. package/utils/exportAs.js +1 -1
@@ -0,0 +1,19 @@
1
+ export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
2
+ const warnedOnceMap = new Set();
3
+ const warnOnce = message => {
4
+ if (!warnedOnceMap.has(message)) {
5
+ console.error(message);
6
+ warnedOnceMap.add(message);
7
+ }
8
+ };
9
+ export const validateProps = (props, validators) => {
10
+ if (process.env.NODE_ENV === 'production') {
11
+ return;
12
+ }
13
+ validators.forEach(validator => {
14
+ const warning = validator(props);
15
+ if (warning) {
16
+ warnOnce(warning);
17
+ }
18
+ });
19
+ };
@@ -1,17 +1,26 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
3
  import * as React from 'react';
3
4
  import PropTypes from 'prop-types';
4
- import { chainPropTypes } from '@mui/utils';
5
5
  import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from '../components';
6
6
  import { GridContextProvider } from '../context/GridContextProvider';
7
7
  import { useDataGridComponent } from './useDataGridComponent';
8
8
  import { useDataGridProps } from './useDataGridProps';
9
9
  import { DataGridVirtualScroller } from '../components/DataGridVirtualScroller';
10
+ import { propValidatorsDataGrid, validateProps } from '../internals/utils/propValidation';
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ var propValidators = [].concat(_toConsumableArray(propValidatorsDataGrid), [
14
+ // Only validate in MIT version
15
+ function (props) {
16
+ return props.columns && props.columns.some(function (column) {
17
+ return column.resizable;
18
+ }) && ["MUI X: `column.resizable = true` is not a valid prop.", 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n') || undefined;
19
+ }]);
12
20
  var DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref) {
13
21
  var props = useDataGridProps(inProps);
14
22
  var privateApiRef = useDataGridComponent(props.apiRef, props);
23
+ validateProps(props, propValidators);
15
24
  return /*#__PURE__*/_jsx(GridContextProvider, {
16
25
  privateApiRef: privateApiRef,
17
26
  props: props,
@@ -94,17 +103,9 @@ DataGridRaw.propTypes = {
94
103
  */
95
104
  columnHeaderHeight: PropTypes.number,
96
105
  /**
97
- * Set of columns of type [[GridColDef[]]].
106
+ * Set of columns of type [[GridColDef]][].
98
107
  */
99
- columns: chainPropTypes(PropTypes.array.isRequired, function (props) {
100
- // @ts-ignore because otherwise `build:api` doesn't work
101
- if (props.columns && props.columns.some(function (column) {
102
- return column.resizable;
103
- })) {
104
- return new Error(["MUI: `column.resizable = true` is not a valid prop.", 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
105
- }
106
- return null;
107
- }),
108
+ columns: PropTypes.arrayOf(PropTypes.object).isRequired,
108
109
  /**
109
110
  * Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
110
111
  * @default 3
@@ -143,7 +144,6 @@ DataGridRaw.propTypes = {
143
144
  /**
144
145
  * If `true`, `eval()` is not used for performance optimization.
145
146
  * @default false
146
- * @ignore - do not document
147
147
  */
148
148
  disableEval: PropTypes.bool,
149
149
  /**
@@ -550,12 +550,7 @@ DataGridRaw.propTypes = {
550
550
  label: PropTypes.string.isRequired,
551
551
  value: PropTypes.number.isRequired
552
552
  })]).isRequired),
553
- pagination: function pagination(props) {
554
- if (props.pagination === false) {
555
- return new Error(['MUI: `<DataGrid pagination={false} />` is not a valid prop.', 'Infinite scrolling is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to disable the pagination.'].join('\n'));
556
- }
557
- return null;
558
- },
553
+ pagination: PropTypes.oneOf([true]),
559
554
  /**
560
555
  * Pagination can be processed on the server or client-side.
561
556
  * Set it to 'client' if you would like to handle the pagination on the client-side.
@@ -9,7 +9,7 @@ function throwIfNotDateObject(_ref) {
9
9
  rowId = _ref.rowId,
10
10
  field = _ref.field;
11
11
  if (!(value instanceof Date)) {
12
- throw new Error(["MUI: `".concat(columnType, "` column type only accepts `Date` objects as values."), 'Use `valueGetter` to transform the value into a `Date` object.', "Row ID: ".concat(rowId, ", field: \"").concat(field, "\".")].join('\n'));
12
+ throw new Error(["MUI X: `".concat(columnType, "` column type only accepts `Date` objects as values."), 'Use `valueGetter` to transform the value into a `Date` object.', "Row ID: ".concat(rowId, ", field: \"").concat(field, "\".")].join('\n'));
13
13
  }
14
14
  }
15
15
  export function gridDateFormatter(_ref2) {
@@ -59,7 +59,7 @@ export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginatio
59
59
  var warnedOnceMissingInPageSizeOptions = React.useRef(false);
60
60
  var pageSize = (_rootProps$pagination = (_rootProps$pagination2 = rootProps.paginationModel) == null ? void 0 : _rootProps$pagination2.pageSize) != null ? _rootProps$pagination : paginationModel.pageSize;
61
61
  if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !isPageSizeIncludedInPageSizeOptions(pageSize)) {
62
- console.warn(["MUI: The page size `".concat(paginationModel.pageSize, "` is not preset in the `pageSizeOptions`"), "Add it to show the pagination select."].join('\n'));
62
+ console.warn(["MUI X: The page size `".concat(paginationModel.pageSize, "` is not preset in the `pageSizeOptions`."), "Add it to show the pagination select."].join('\n'));
63
63
  warnedOnceMissingInPageSizeOptions.current = true;
64
64
  }
65
65
  }
@@ -52,7 +52,7 @@ function GridActionsCell(props) {
52
52
  var buttonId = useId();
53
53
  var rootProps = useGridRootProps();
54
54
  if (!hasActions(colDef)) {
55
- throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
55
+ throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
56
56
  }
57
57
  var options = colDef.getActions(apiRef.current.getRowParams(id));
58
58
  var iconButtons = options.filter(function (option) {
@@ -276,7 +276,7 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
276
276
  return;
277
277
  }
278
278
  if (!warnedOnce) {
279
- console.warn(["MUI: The cell with id=".concat(rowId, " and field=").concat(field, " received focus."), "According to the state, the focus should be at id=".concat(focusedCell == null ? void 0 : focusedCell.id, ", field=").concat(focusedCell == null ? void 0 : focusedCell.field, "."), "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
279
+ console.warn(["MUI X: The cell with id=".concat(rowId, " and field=").concat(field, " received focus."), "According to the state, the focus should be at id=".concat(focusedCell == null ? void 0 : focusedCell.id, ", field=").concat(focusedCell == null ? void 0 : focusedCell.field, "."), "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
280
280
  warnedOnce = true;
281
281
  }
282
282
  };
@@ -554,7 +554,7 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
554
554
  return;
555
555
  }
556
556
  if (!warnedOnce) {
557
- console.warn(["MUI: The cell with id=".concat(rowId, " and field=").concat(field, " received focus."), "According to the state, the focus should be at id=".concat(focusedCell == null ? void 0 : focusedCell.id, ", field=").concat(focusedCell == null ? void 0 : focusedCell.field, "."), "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
557
+ console.warn(["MUI X: The cell with id=".concat(rowId, " and field=").concat(field, " received focus."), "According to the state, the focus should be at id=".concat(focusedCell == null ? void 0 : focusedCell.id, ", field=").concat(focusedCell == null ? void 0 : focusedCell.field, "."), "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
558
558
  warnedOnce = true;
559
559
  }
560
560
  };
@@ -103,7 +103,7 @@ var getLogicOperatorLocaleKey = function getLogicOperatorLocaleKey(logicOperator
103
103
  case GridLogicOperator.Or:
104
104
  return 'filterPanelOperatorOr';
105
105
  default:
106
- throw new Error('MUI: Invalid `logicOperator` property in the `GridFilterPanel`.');
106
+ throw new Error('MUI X: Invalid `logicOperator` property in the `GridFilterPanel`.');
107
107
  }
108
108
  };
109
109
  var getColumnLabel = function getColumnLabel(col) {
@@ -139,12 +139,16 @@ process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
139
139
  * Function responsible for formatting values of quick filter in a string when the model is modified
140
140
  * @param {any[]} values The new values passed to the quick filter model
141
141
  * @returns {string} The string to display in the text field
142
+ * @default (values: string[]) => values.join(' ')
142
143
  */
143
144
  quickFilterFormatter: PropTypes.func,
144
145
  /**
145
146
  * Function responsible for parsing text input in an array of independent values for quick filtering.
146
147
  * @param {string} input The value entered by the user
147
148
  * @returns {any[]} The array of value on which quick filter is applied
149
+ * @default (searchText: string) => searchText
150
+ * .split(' ')
151
+ * .filter((word) => word !== '')
148
152
  */
149
153
  quickFilterParser: PropTypes.func
150
154
  } : void 0;
@@ -15,7 +15,7 @@ function getAppender(name, logLevel) {
15
15
  var appender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : console;
16
16
  var minLogLevelIdx = LOG_LEVELS.indexOf(logLevel);
17
17
  if (minLogLevelIdx === -1) {
18
- throw new Error("MUI: Log level ".concat(logLevel, " not recognized."));
18
+ throw new Error("MUI X: Log level ".concat(logLevel, " not recognized."));
19
19
  }
20
20
  var logger = LOG_LEVELS.reduce(function (loggerObj, method, idx) {
21
21
  if (idx >= minLogLevelIdx) {
@@ -26,7 +26,7 @@ function getAppender(name, logLevel) {
26
26
  }
27
27
  var message = args[0],
28
28
  other = args.slice(1);
29
- (_ref = appender)[method].apply(_ref, ["MUI: ".concat(name, " - ").concat(message)].concat(_toConsumableArray(other)));
29
+ (_ref = appender)[method].apply(_ref, ["MUI X: ".concat(name, " - ").concat(message)].concat(_toConsumableArray(other)));
30
30
  };
31
31
  } else {
32
32
  loggerObj[method] = noop;
@@ -5,7 +5,7 @@ import { isDeepEqual } from '../../../utils/utils';
5
5
  var recurrentUnwrapGroupingColumnModel = function recurrentUnwrapGroupingColumnModel(columnGroupNode, parents, unwrappedGroupingModelToComplete) {
6
6
  if (isLeaf(columnGroupNode)) {
7
7
  if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
8
- throw new Error(["MUI: columnGroupingModel contains duplicated field", "column field ".concat(columnGroupNode.field, " occurs two times in the grouping model:"), "- ".concat(unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')), "- ".concat(parents.join(' > '))].join('\n'));
8
+ throw new Error(["MUI X: columnGroupingModel contains duplicated field", "column field ".concat(columnGroupNode.field, " occurs two times in the grouping model:"), "- ".concat(unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')), "- ".concat(parents.join(' > '))].join('\n'));
9
9
  }
10
10
  unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
11
11
  return;
@@ -20,17 +20,19 @@ var createGroupLookup = function createGroupLookup(columnGroupingModel) {
20
20
  children = node.children,
21
21
  other = _objectWithoutProperties(node, _excluded);
22
22
  if (!groupId) {
23
- throw new Error('MUI: An element of the columnGroupingModel does not have either `field` or `groupId`.');
23
+ throw new Error('MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.');
24
24
  }
25
- if (!children) {
26
- console.warn("MUI: group groupId=".concat(groupId, " has no children."));
25
+ if (process.env.NODE_ENV !== 'production') {
26
+ if (!children) {
27
+ console.warn("MUI X: group groupId=".concat(groupId, " has no children."));
28
+ }
27
29
  }
28
30
  var groupParam = _extends({}, other, {
29
31
  groupId: groupId
30
32
  });
31
33
  var subTreeLookup = createGroupLookup(children);
32
34
  if (subTreeLookup[groupId] !== undefined || groupLookup[groupId] !== undefined) {
33
- throw new Error("MUI: The groupId ".concat(groupId, " is used multiple times in the columnGroupingModel."));
35
+ throw new Error("MUI X: The groupId ".concat(groupId, " is used multiple times in the columnGroupingModel."));
34
36
  }
35
37
  groupLookup = _extends({}, groupLookup, subTreeLookup, _defineProperty({}, groupId, groupParam));
36
38
  });
@@ -18,7 +18,7 @@ import { buildWarning } from '../../../utils/warning';
18
18
  import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
19
19
  import { deepClone } from '../../../utils/utils';
20
20
  import { GridCellEditStartReasons, GridCellEditStopReasons } from '../../../models/params/gridEditCellParams';
21
- var missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see http://mui.com/components/data-grid/editing/#server-side-persistence.'], 'error');
21
+ var missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/#server-side-persistence.'], 'error');
22
22
  export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
23
23
  var _React$useState = React.useState({}),
24
24
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -40,12 +40,12 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
40
40
  var throwIfNotEditable = React.useCallback(function (id, field) {
41
41
  var params = apiRef.current.getCellParams(id, field);
42
42
  if (!apiRef.current.isCellEditable(params)) {
43
- throw new Error("MUI: The cell with id=".concat(id, " and field=").concat(field, " is not editable."));
43
+ throw new Error("MUI X: The cell with id=".concat(id, " and field=").concat(field, " is not editable."));
44
44
  }
45
45
  }, [apiRef]);
46
46
  var throwIfNotInMode = React.useCallback(function (id, field, mode) {
47
47
  if (apiRef.current.getCellMode(id, field) !== mode) {
48
- throw new Error("MUI: The cell with id=".concat(id, " and field=").concat(field, " is not in ").concat(mode, " mode."));
48
+ throw new Error("MUI X: The cell with id=".concat(id, " and field=").concat(field, " is not in ").concat(mode, " mode."));
49
49
  }
50
50
  }, [apiRef]);
51
51
  var handleCellDoubleClick = React.useCallback(function (params, event) {
@@ -299,7 +299,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
299
299
  });
300
300
  if (onProcessRowUpdateError) {
301
301
  onProcessRowUpdateError(errorThrown);
302
- } else {
302
+ } else if (process.env.NODE_ENV !== 'production') {
303
303
  missingOnProcessRowUpdateErrorWarning();
304
304
  }
305
305
  };
@@ -18,7 +18,7 @@ import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
18
18
  import { deepClone } from '../../../utils/utils';
19
19
  import { GridRowEditStopReasons, GridRowEditStartReasons } from '../../../models/params/gridRowParams';
20
20
  import { GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
21
- var missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see http://mui.com/components/data-grid/editing/#server-side-persistence.'], 'error');
21
+ var missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI X: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/#server-side-persistence.'], 'error');
22
22
  export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
23
23
  var _React$useState = React.useState({}),
24
24
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -42,12 +42,12 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
42
42
  var throwIfNotEditable = React.useCallback(function (id, field) {
43
43
  var params = apiRef.current.getCellParams(id, field);
44
44
  if (!apiRef.current.isCellEditable(params)) {
45
- throw new Error("MUI: The cell with id=".concat(id, " and field=").concat(field, " is not editable."));
45
+ throw new Error("MUI X: The cell with id=".concat(id, " and field=").concat(field, " is not editable."));
46
46
  }
47
47
  }, [apiRef]);
48
48
  var throwIfNotInMode = React.useCallback(function (id, mode) {
49
49
  if (apiRef.current.getRowMode(id) !== mode) {
50
- throw new Error("MUI: The row with id=".concat(id, " is not in ").concat(mode, " mode."));
50
+ throw new Error("MUI X: The row with id=".concat(id, " is not in ").concat(mode, " mode."));
51
51
  }
52
52
  }, [apiRef]);
53
53
  var handleCellDoubleClick = React.useCallback(function (params, event) {
@@ -378,7 +378,7 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
378
378
  });
379
379
  if (onProcessRowUpdateError) {
380
380
  onProcessRowUpdateError(errorThrown);
381
- } else {
381
+ } else if (process.env.NODE_ENV !== 'production') {
382
382
  missingOnProcessRowUpdateErrorWarning();
383
383
  }
384
384
  };
@@ -36,7 +36,7 @@ export var serializeCellValue = function serializeCellValue(cellParams, options)
36
36
  }
37
37
  return sanitizeCellValue(value, delimiterCharacter);
38
38
  };
39
- var objectFormattedValueWarning = buildWarning(['MUI: When the value of a field is an object or a `renderCell` is provided, the CSV export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
39
+ var objectFormattedValueWarning = buildWarning(['MUI X: When the value of a field is an object or a `renderCell` is provided, the CSV export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
40
40
  var CSVRow = /*#__PURE__*/function () {
41
41
  function CSVRow(options) {
42
42
  _classCallCheck(this, CSVRow);
@@ -234,7 +234,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
234
234
  _context.next = 3;
235
235
  break;
236
236
  }
237
- throw new Error('MUI: No grid root element available.');
237
+ throw new Error('MUI X: No grid root element available.');
238
238
  case 3:
239
239
  previousGridState.current = apiRef.current.exportState();
240
240
  // It appends that the visibility model is not exported, especially if columnVisibility is not controlled
@@ -4,15 +4,17 @@ import { getDefaultGridFilterModel } from './gridFilterState';
4
4
  import { buildWarning } from '../../../utils/warning';
5
5
  import { getPublicApiRef } from '../../../utils/getPublicApiRef';
6
6
  import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
7
-
8
- // Fixes https://github.com/mui/mui-x/issues/10056
9
- var globalScope = typeof window === 'undefined' ? globalThis : window;
10
- var evalCode = globalScope[atob('ZXZhbA==')];
11
7
  var hasEval;
12
- try {
13
- hasEval = evalCode('true');
14
- } catch (_) {
15
- hasEval = false;
8
+ function getHasEval() {
9
+ if (hasEval !== undefined) {
10
+ return hasEval;
11
+ }
12
+ try {
13
+ hasEval = new Function('return true')();
14
+ } catch (_) {
15
+ hasEval = false;
16
+ }
17
+ return hasEval;
16
18
  }
17
19
  /**
18
20
  * Adds default values to the optional fields of a filter items.
@@ -34,9 +36,9 @@ export var cleanFilterItem = function cleanFilterItem(item, apiRef) {
34
36
  }
35
37
  return cleanItem;
36
38
  };
37
- var filterModelDisableMultiColumnsFilteringWarning = buildWarning(['MUI: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
38
- var filterModelMissingItemIdWarning = buildWarning('MUI: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
39
- var filterModelMissingItemOperatorWarning = buildWarning('MUI: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
39
+ var filterModelDisableMultiColumnsFilteringWarning = buildWarning(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
40
+ var filterModelMissingItemIdWarning = buildWarning('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
41
+ var filterModelMissingItemOperatorWarning = buildWarning('MUI X: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
40
42
  export var sanitizeFilterModel = function sanitizeFilterModel(model, disableMultipleColumnsFiltering, apiRef) {
41
43
  var hasSeveralItems = model.items.length > 1;
42
44
  var items;
@@ -112,13 +114,13 @@ var getFilterCallbackFromItem = function getFilterCallbackFromItem(filterItem, a
112
114
  });
113
115
  var filterOperators = column.filterOperators;
114
116
  if (!(filterOperators != null && filterOperators.length)) {
115
- throw new Error("MUI: No filter operators found for column '".concat(column.field, "'."));
117
+ throw new Error("MUI X: No filter operators found for column '".concat(column.field, "'."));
116
118
  }
117
119
  var filterOperator = filterOperators.find(function (operator) {
118
120
  return operator.value === newFilterItem.operator;
119
121
  });
120
122
  if (!filterOperator) {
121
- throw new Error("MUI: No filter operator found for column '".concat(column.field, "' and operator value '").concat(newFilterItem.operator, "'."));
123
+ throw new Error("MUI X: No filter operator found for column '".concat(column.field, "' and operator value '").concat(newFilterItem.operator, "'."));
122
124
  }
123
125
  var publicApiRef = getPublicApiRef(apiRef);
124
126
  var applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
@@ -154,7 +156,7 @@ var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsAppli
154
156
  if (appliers.length === 0) {
155
157
  return null;
156
158
  }
157
- if (!hasEval || disableEval) {
159
+ if (disableEval || !getHasEval()) {
158
160
  // This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
159
161
  return function (row, shouldApplyFilter) {
160
162
  var resultPerItemId = {};
@@ -168,18 +170,19 @@ var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsAppli
168
170
  };
169
171
  }
170
172
 
171
- // We generate a new function with `eval()` to avoid expensive patterns for JS engines
173
+ // We generate a new function with `new Function()` to avoid expensive patterns for JS engines
172
174
  // such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
173
- var filterItemTemplate = "(function filterItem$$(getRowId, appliers, row, shouldApplyFilter) {\n ".concat(appliers.map(function (applier, i) {
175
+ var filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', "\"use strict\";\n".concat(appliers.map(function (applier, i) {
174
176
  return "const shouldApply".concat(i, " = !shouldApplyFilter || shouldApplyFilter(").concat(JSON.stringify(applier.item.field), ");");
175
- }).join('\n'), "\n\n const result$$ = {\n ").concat(appliers.map(function (applier, i) {
176
- return "".concat(JSON.stringify(String(applier.item.id)), ":\n !shouldApply").concat(i, " ?\n false :\n appliers[").concat(i, "].fn(row),\n ");
177
- }).join('\n'), "};\n\n return result$$;\n })");
178
- var filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
177
+ }).join('\n'), "\n\nconst result$$ = {\n").concat(appliers.map(function (applier, i) {
178
+ return " ".concat(JSON.stringify(String(applier.item.id)), ": !shouldApply").concat(i, " ? false : appliers[").concat(i, "].fn(row),");
179
+ }).join('\n'), "\n};\n\nreturn result$$;").replaceAll('$$', String(filterItemsApplierId)));
180
+ filterItemsApplierId += 1;
181
+
182
+ // Assign to the arrow function a name to help debugging
179
183
  var filterItem = function filterItem(row, shouldApplyItem) {
180
- return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
184
+ return filterItemCore(appliers, row, shouldApplyItem);
181
185
  };
182
- filterItemsApplierId += 1;
183
186
  return filterItem;
184
187
  };
185
188
  export var shouldQuickFilterExcludeHiddenColumns = function shouldQuickFilterExcludeHiddenColumns(filterModel) {
@@ -10,7 +10,7 @@ export var getPageCount = function getPageCount(rowCount, pageSize) {
10
10
  }
11
11
  return 0;
12
12
  };
13
- export var noRowCountInServerMode = buildWarning(["MUI: the 'rowCount' prop is undefined while using paginationMode='server'", 'For more detail, see http://mui.com/components/data-grid/pagination/#basic-implementation'], 'error');
13
+ export var noRowCountInServerMode = buildWarning(["MUI X: the 'rowCount' prop is undefined while using paginationMode='server'", 'For more detail, see http://mui.com/components/data-grid/pagination/#basic-implementation'], 'error');
14
14
  export var getDefaultGridPaginationModel = function getDefaultGridPaginationModel(autoPageSize) {
15
15
  return {
16
16
  page: 0,
@@ -26,6 +26,6 @@ export var getValidPage = function getValidPage(page) {
26
26
  };
27
27
  export var throwIfPageSizeExceedsTheLimit = function throwIfPageSizeExceedsTheLimit(pageSize, signatureProp) {
28
28
  if (signatureProp === GridSignature.DataGrid && pageSize > MAX_PAGE_SIZE) {
29
- throw new Error(['MUI: `pageSize` cannot exceed 100 in the MIT version of the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
29
+ throw new Error(['MUI X: `pageSize` cannot exceed 100 in the MIT version of the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
30
30
  }
31
31
  };
@@ -101,7 +101,7 @@ export var useGridRowSelection = function useGridRowSelection(apiRef, props) {
101
101
  */
102
102
  var setRowSelectionModel = React.useCallback(function (model) {
103
103
  if (props.signature === GridSignature.DataGrid && !canHaveMultipleSelection && Array.isArray(model) && model.length > 1) {
104
- throw new Error(['MUI: `rowSelectionModel` can only contain 1 item in DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
104
+ throw new Error(['MUI X: `rowSelectionModel` can only contain 1 item in DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
105
105
  }
106
106
  var currentModel = gridRowSelectionStateSelector(apiRef.current.state);
107
107
  if (currentModel !== model) {
@@ -28,7 +28,7 @@ export var buildRootGroup = function buildRootGroup() {
28
28
  export function checkGridRowIdIsValid(id, row) {
29
29
  var detailErrorMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'A row was provided without id in the rows prop:';
30
30
  if (id == null) {
31
- throw new Error(['MUI: The data grid component requires all rows to have a unique `id` property.', 'Alternatively, you can use the `getRowId` prop to specify a custom id for each row.', detailErrorMessage, JSON.stringify(row)].join('\n'));
31
+ throw new Error(['MUI X: The data grid component requires all rows to have a unique `id` property.', 'Alternatively, you can use the `getRowId` prop to specify a custom id for each row.', detailErrorMessage, JSON.stringify(row)].join('\n'));
32
32
  }
33
33
  }
34
34
  export var getRowIdFromRowModel = function getRowIdFromRowModel(rowModel, getRowId, detailErrorMessage) {
@@ -148,7 +148,7 @@ export var updateCacheWithNewRows = function updateCacheWithNewRows(_ref4) {
148
148
  getRowId = _ref4.getRowId,
149
149
  updates = _ref4.updates;
150
150
  if (previousCache.updates.type === 'full') {
151
- throw new Error('MUI: Unable to prepare a partial update if a full update is not applied yet');
151
+ throw new Error('MUI X: Unable to prepare a partial update if a full update is not applied yet.');
152
152
  }
153
153
 
154
154
  // Remove duplicate updates.
@@ -1,11 +1,11 @@
1
1
  import _createClass from "@babel/runtime/helpers/esm/createClass";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
4
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
6
  import _wrapNativeSuper from "@babel/runtime/helpers/esm/wrapNativeSuper";
7
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
9
  import * as React from 'react';
10
10
  import { getGridCellElement, getGridColumnHeaderElement, getGridRowElement } from '../../../utils/domUtils';
11
11
  import { GRID_ID_AUTOGENERATED } from './gridRowsUtils';
@@ -13,10 +13,9 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
13
13
  import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
14
14
  export var MissingRowIdError = /*#__PURE__*/function (_Error) {
15
15
  _inherits(MissingRowIdError, _Error);
16
- var _super = _createSuper(MissingRowIdError);
17
16
  function MissingRowIdError() {
18
17
  _classCallCheck(this, MissingRowIdError);
19
- return _super.apply(this, arguments);
18
+ return _callSuper(this, MissingRowIdError, arguments);
20
19
  }
21
20
  return _createClass(MissingRowIdError);
22
21
  }( /*#__PURE__*/_wrapNativeSuper(Error));
@@ -124,7 +124,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
124
124
  }, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
125
125
  var updateRows = React.useCallback(function (updates) {
126
126
  if (props.signature === GridSignature.DataGrid && updates.length > 1) {
127
- throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
127
+ throw new Error(["MUI X: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
128
128
  }
129
129
  var nonPinnedRowsUpdates = [];
130
130
  updates.forEach(function (update) {
@@ -171,10 +171,10 @@ export var useGridRows = function useGridRows(apiRef, props) {
171
171
  var setRowChildrenExpansion = React.useCallback(function (id, isExpanded) {
172
172
  var currentNode = apiRef.current.getRowNode(id);
173
173
  if (!currentNode) {
174
- throw new Error("MUI: No row with id #".concat(id, " found"));
174
+ throw new Error("MUI X: No row with id #".concat(id, " found."));
175
175
  }
176
176
  if (currentNode.type !== 'group') {
177
- throw new Error('MUI: Only group nodes can be expanded or collapsed');
177
+ throw new Error('MUI X: Only group nodes can be expanded or collapsed.');
178
178
  }
179
179
  var newNode = _extends({}, currentNode, {
180
180
  childrenExpanded: isExpanded
@@ -231,13 +231,13 @@ export var useGridRows = function useGridRows(apiRef, props) {
231
231
  var setRowIndex = React.useCallback(function (rowId, targetIndex) {
232
232
  var node = apiRef.current.getRowNode(rowId);
233
233
  if (!node) {
234
- throw new Error("MUI: No row with id #".concat(rowId, " found"));
234
+ throw new Error("MUI X: No row with id #".concat(rowId, " found."));
235
235
  }
236
236
  if (node.parent !== GRID_ROOT_GROUP_ID) {
237
- throw new Error("MUI: The row reordering do not support reordering of grouped rows yet");
237
+ throw new Error("MUI X: The row reordering do not support reordering of grouped rows yet.");
238
238
  }
239
239
  if (node.type !== 'leaf') {
240
- throw new Error("MUI: The row reordering do not support reordering of footer or grouping rows");
240
+ throw new Error("MUI X: The row reordering do not support reordering of footer or grouping rows.");
241
241
  }
242
242
  apiRef.current.setState(function (state) {
243
243
  var group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
@@ -263,7 +263,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
263
263
  }, [apiRef, logger]);
264
264
  var replaceRows = React.useCallback(function (firstRowToRender, newRows) {
265
265
  if (props.signature === GridSignature.DataGrid && newRows.length > 1) {
266
- throw new Error(["MUI: You can't replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
266
+ throw new Error(["MUI X: You can't replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
267
267
  }
268
268
  if (newRows.length === 0) {
269
269
  return;
@@ -30,8 +30,8 @@ var getValidRowHeight = function getValidRowHeight(rowHeightProp, defaultRowHeig
30
30
  }
31
31
  return defaultRowHeight;
32
32
  };
33
- var rowHeightWarning = ["MUI: The `rowHeight` prop should be a number greater than 0.", "The default value will be used instead."].join('\n');
34
- var getRowHeightWarning = ["MUI: The `getRowHeight` prop should return a number greater than 0 or 'auto'.", "The default value will be used instead."].join('\n');
33
+ var rowHeightWarning = ["MUI X: The `rowHeight` prop should be a number greater than 0.", "The default value will be used instead."].join('\n');
34
+ var getRowHeightWarning = ["MUI X: The `getRowHeight` prop should return a number greater than 0 or 'auto'.", "The default value will be used instead."].join('\n');
35
35
 
36
36
  /**
37
37
  * @requires useGridPageSize (method)
@@ -1,9 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { buildWarning } from '../../../utils/warning';
3
- var sortModelDisableMultiColumnsSortingWarning = buildWarning(['MUI: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
3
+ var sortModelDisableMultiColumnsSortingWarning = buildWarning(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
4
4
  export var sanitizeSortModel = function sanitizeSortModel(model, disableMultipleColumnsSorting) {
5
5
  if (disableMultipleColumnsSorting && model.length > 1) {
6
- sortModelDisableMultiColumnsSortingWarning();
6
+ if (process.env.NODE_ENV !== 'production') {
7
+ sortModelDisableMultiColumnsSortingWarning();
8
+ }
7
9
  return [model[0]];
8
10
  }
9
11
  return model;
@@ -3,7 +3,7 @@ import { GridApiContext } from '../../components/GridApiContext';
3
3
  export function useGridApiContext() {
4
4
  var apiRef = React.useContext(GridApiContext);
5
5
  if (apiRef === undefined) {
6
- throw new Error(['MUI: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
6
+ throw new Error(['MUI X: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
7
7
  }
8
8
  return apiRef;
9
9
  }
@@ -6,7 +6,7 @@ if (process.env.NODE_ENV !== 'production') {
6
6
  export function useGridPrivateApiContext() {
7
7
  var privateApiRef = React.useContext(GridPrivateApiContext);
8
8
  if (privateApiRef === undefined) {
9
- throw new Error(['MUI: Could not find the data grid private context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
9
+ throw new Error(['MUI X: Could not find the data grid private context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
10
10
  }
11
11
  return privateApiRef;
12
12
  }
@@ -3,7 +3,7 @@ import { GridRootPropsContext } from '../../context/GridRootPropsContext';
3
3
  export var useGridRootProps = function useGridRootProps() {
4
4
  var contextValue = React.useContext(GridRootPropsContext);
5
5
  if (!contextValue) {
6
- throw new Error('MUI: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.');
6
+ throw new Error('MUI X: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.');
7
7
  }
8
8
  return contextValue;
9
9
  };
@@ -4,7 +4,7 @@ import { useLazyRef } from './useLazyRef';
4
4
  import { useOnMount } from './useOnMount';
5
5
  import { buildWarning } from '../../utils/warning';
6
6
  import { fastObjectShallowCompare } from '../../utils/fastObjectShallowCompare';
7
- var stateNotInitializedWarning = buildWarning(['MUI: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
7
+ var stateNotInitializedWarning = buildWarning(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
8
8
  function isOutputSelector(selector) {
9
9
  return selector.acceptsApiRef;
10
10
  }