@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.
- package/CHANGELOG.md +357 -49
- package/DataGrid/DataGrid.js +8 -16
- package/colDef/gridDateColDef.js +1 -1
- package/components/GridPagination.d.ts +4 -4
- package/components/GridPagination.js +1 -1
- package/components/cell/GridActionsCell.js +1 -1
- package/components/cell/GridActionsCellItem.d.ts +5 -5
- package/components/cell/GridCell.js +2 -2
- package/components/panel/GridPanel.d.ts +3 -3
- package/components/panel/filterPanel/GridFilterForm.js +1 -1
- package/components/toolbar/GridToolbarQuickFilter.d.ts +4 -0
- package/components/toolbar/GridToolbarQuickFilter.js +4 -0
- package/hooks/core/useGridLoggerFactory.js +2 -2
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
- package/hooks/features/editing/useGridCellEditing.js +4 -4
- package/hooks/features/editing/useGridRowEditing.js +4 -4
- package/hooks/features/export/serializers/csvSerializer.js +1 -1
- package/hooks/features/export/useGridPrintExport.js +1 -1
- package/hooks/features/filter/gridFilterUtils.js +26 -29
- package/hooks/features/pagination/gridPaginationUtils.js +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/hooks/features/rows/gridRowsUtils.js +2 -2
- package/hooks/features/rows/useGridRows.js +7 -7
- package/hooks/features/rows/useGridRowsMeta.js +2 -2
- package/hooks/features/sorting/gridSortingUtils.js +4 -2
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/hooks/utils/useGridRootProps.js +1 -1
- package/hooks/utils/useGridSelector.js +1 -1
- package/index.d.ts +0 -1
- package/index.js +1 -2
- package/internals/index.d.ts +1 -0
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/internals/utils/propValidation.d.ts +4 -0
- package/internals/utils/propValidation.js +19 -0
- package/legacy/DataGrid/DataGrid.js +13 -18
- package/legacy/colDef/gridDateColDef.js +1 -1
- package/legacy/components/GridPagination.js +1 -1
- package/legacy/components/cell/GridActionsCell.js +1 -1
- package/legacy/components/cell/GridCell.js +2 -2
- package/legacy/components/panel/filterPanel/GridFilterForm.js +1 -1
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +4 -0
- package/legacy/hooks/core/useGridLoggerFactory.js +2 -2
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
- package/legacy/hooks/features/editing/useGridCellEditing.js +4 -4
- package/legacy/hooks/features/editing/useGridRowEditing.js +4 -4
- package/legacy/hooks/features/export/serializers/csvSerializer.js +1 -1
- package/legacy/hooks/features/export/useGridPrintExport.js +1 -1
- package/legacy/hooks/features/filter/gridFilterUtils.js +25 -22
- package/legacy/hooks/features/pagination/gridPaginationUtils.js +2 -2
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
- package/legacy/hooks/features/rows/useGridParamsApi.js +4 -5
- package/legacy/hooks/features/rows/useGridRows.js +7 -7
- package/legacy/hooks/features/rows/useGridRowsMeta.js +2 -2
- package/legacy/hooks/features/sorting/gridSortingUtils.js +4 -2
- package/legacy/hooks/utils/useGridApiContext.js +1 -1
- package/legacy/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/legacy/hooks/utils/useGridRootProps.js +1 -1
- package/legacy/hooks/utils/useGridSelector.js +1 -1
- package/legacy/index.js +1 -2
- package/legacy/internals/utils/index.js +2 -1
- package/legacy/internals/utils/propValidation.js +21 -0
- package/legacy/locales/csCZ.js +2 -2
- package/legacy/utils/createSelector.js +1 -1
- package/legacy/utils/exportAs.js +1 -1
- package/locales/csCZ.js +2 -2
- package/models/props/DataGridProps.d.ts +1 -2
- package/modern/DataGrid/DataGrid.js +8 -16
- package/modern/colDef/gridDateColDef.js +1 -1
- package/modern/components/GridPagination.js +1 -1
- package/modern/components/cell/GridActionsCell.js +1 -1
- package/modern/components/cell/GridCell.js +2 -2
- package/modern/components/panel/filterPanel/GridFilterForm.js +1 -1
- package/modern/components/toolbar/GridToolbarQuickFilter.js +4 -0
- package/modern/hooks/core/useGridLoggerFactory.js +2 -2
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
- package/modern/hooks/features/editing/useGridCellEditing.js +4 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +4 -4
- package/modern/hooks/features/export/serializers/csvSerializer.js +1 -1
- package/modern/hooks/features/export/useGridPrintExport.js +1 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +26 -29
- package/modern/hooks/features/pagination/gridPaginationUtils.js +2 -2
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +2 -2
- package/modern/hooks/features/rows/useGridRows.js +7 -7
- package/modern/hooks/features/rows/useGridRowsMeta.js +2 -2
- package/modern/hooks/features/sorting/gridSortingUtils.js +4 -2
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/modern/hooks/utils/useGridRootProps.js +1 -1
- package/modern/hooks/utils/useGridSelector.js +1 -1
- package/modern/index.js +1 -2
- package/modern/internals/utils/index.js +2 -1
- package/modern/internals/utils/propValidation.js +19 -0
- package/modern/locales/csCZ.js +2 -2
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/exportAs.js +1 -1
- package/node/DataGrid/DataGrid.js +8 -16
- package/node/colDef/gridDateColDef.js +1 -1
- package/node/components/GridPagination.js +1 -1
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridCell.js +2 -2
- package/node/components/panel/filterPanel/GridFilterForm.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +4 -0
- package/node/hooks/core/useGridLoggerFactory.js +2 -2
- package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -4
- package/node/hooks/features/editing/useGridCellEditing.js +4 -4
- package/node/hooks/features/editing/useGridRowEditing.js +4 -4
- package/node/hooks/features/export/serializers/csvSerializer.js +1 -1
- package/node/hooks/features/export/useGridPrintExport.js +1 -1
- package/node/hooks/features/filter/gridFilterUtils.js +26 -28
- package/node/hooks/features/pagination/gridPaginationUtils.js +2 -2
- package/node/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/node/hooks/features/rows/gridRowsUtils.js +2 -2
- package/node/hooks/features/rows/useGridRows.js +7 -7
- package/node/hooks/features/rows/useGridRowsMeta.js +2 -2
- package/node/hooks/features/sorting/gridSortingUtils.js +4 -2
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/hooks/utils/useGridSelector.js +1 -1
- package/node/index.js +1 -13
- package/node/internals/utils/index.js +11 -0
- package/node/internals/utils/propValidation.js +26 -0
- package/node/locales/csCZ.js +2 -2
- package/node/utils/createSelector.js +1 -1
- package/node/utils/exportAs.js +1 -1
- package/package.json +4 -4
- package/utils/createSelector.js +1 -1
- package/utils/exportAs.js +1 -1
|
@@ -6,7 +6,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
6
6
|
export function useGridPrivateApiContext() {
|
|
7
7
|
const 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 const useGridRootProps = () => {
|
|
4
4
|
const 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
|
};
|
|
@@ -3,7 +3,7 @@ import { useLazyRef } from './useLazyRef';
|
|
|
3
3
|
import { useOnMount } from './useOnMount';
|
|
4
4
|
import { buildWarning } from '../../utils/warning';
|
|
5
5
|
import { fastObjectShallowCompare } from '../../utils/fastObjectShallowCompare';
|
|
6
|
-
const 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.']);
|
|
6
|
+
const 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.']);
|
|
7
7
|
function isOutputSelector(selector) {
|
|
8
8
|
return selector.acceptsApiRef;
|
|
9
9
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid v7.0.0-alpha.
|
|
2
|
+
* @mui/x-data-grid v7.0.0-alpha.8
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -12,7 +12,6 @@ export * from './DataGrid';
|
|
|
12
12
|
export * from './components';
|
|
13
13
|
export * from './constants';
|
|
14
14
|
export * from './hooks';
|
|
15
|
-
export * from './locales';
|
|
16
15
|
export * from './models';
|
|
17
16
|
export * from './context';
|
|
18
17
|
export * from './colDef';
|
|
@@ -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
|
+
};
|
package/modern/locales/csCZ.js
CHANGED
|
@@ -159,8 +159,8 @@ const csCZGrid = {
|
|
|
159
159
|
treeDataCollapse: 'skrýt potomky',
|
|
160
160
|
// Grouping columns
|
|
161
161
|
groupingColumnHeaderName: 'Skupina',
|
|
162
|
-
groupColumn: name => `
|
|
163
|
-
unGroupColumn: name => `Přestat
|
|
162
|
+
groupColumn: name => `Seskupit podle ${name}`,
|
|
163
|
+
unGroupColumn: name => `Přestat seskupovat podle ${name}`,
|
|
164
164
|
// Master/detail
|
|
165
165
|
detailPanelToggle: 'Přepnout detail panelu',
|
|
166
166
|
expandDetailPanel: 'Rozbalit',
|
|
@@ -3,7 +3,7 @@ import { buildWarning } from './warning';
|
|
|
3
3
|
const cacheContainer = {
|
|
4
4
|
cache: new WeakMap()
|
|
5
5
|
};
|
|
6
|
-
const missingInstanceIdWarning = buildWarning(['MUI: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, e.g. `mySelector(apiRef)`, or pass the instance ID explicitly, e.g. `mySelector(state, apiRef.current.instanceId)`.']);
|
|
6
|
+
const missingInstanceIdWarning = buildWarning(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, e.g. `mySelector(apiRef)`, or pass the instance ID explicitly, e.g. `mySelector(state, apiRef.current.instanceId)`.']);
|
|
7
7
|
function checkIsAPIRef(value) {
|
|
8
8
|
return 'current' in value && 'instanceId' in value.current;
|
|
9
9
|
}
|
package/modern/utils/exportAs.js
CHANGED
|
@@ -8,18 +8,22 @@ exports.DataGrid = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _utils = require("@mui/utils");
|
|
12
11
|
var _components = require("../components");
|
|
13
12
|
var _GridContextProvider = require("../context/GridContextProvider");
|
|
14
13
|
var _useDataGridComponent = require("./useDataGridComponent");
|
|
15
14
|
var _useDataGridProps = require("./useDataGridProps");
|
|
16
15
|
var _DataGridVirtualScroller = require("../components/DataGridVirtualScroller");
|
|
16
|
+
var _propValidation = require("../internals/utils/propValidation");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
const propValidators = [..._propValidation.propValidatorsDataGrid,
|
|
21
|
+
// Only validate in MIT version
|
|
22
|
+
props => props.columns && props.columns.some(column => column.resizable) && [`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];
|
|
20
23
|
const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref) {
|
|
21
24
|
const props = (0, _useDataGridProps.useDataGridProps)(inProps);
|
|
22
25
|
const privateApiRef = (0, _useDataGridComponent.useDataGridComponent)(props.apiRef, props);
|
|
26
|
+
(0, _propValidation.validateProps)(props, propValidators);
|
|
23
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridContextProvider.GridContextProvider, {
|
|
24
28
|
privateApiRef: privateApiRef,
|
|
25
29
|
props: props,
|
|
@@ -102,15 +106,9 @@ DataGridRaw.propTypes = {
|
|
|
102
106
|
*/
|
|
103
107
|
columnHeaderHeight: _propTypes.default.number,
|
|
104
108
|
/**
|
|
105
|
-
* Set of columns of type [[GridColDef
|
|
109
|
+
* Set of columns of type [[GridColDef]][].
|
|
106
110
|
*/
|
|
107
|
-
columns:
|
|
108
|
-
// @ts-ignore because otherwise `build:api` doesn't work
|
|
109
|
-
if (props.columns && props.columns.some(column => column.resizable)) {
|
|
110
|
-
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'));
|
|
111
|
-
}
|
|
112
|
-
return null;
|
|
113
|
-
}),
|
|
111
|
+
columns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
114
112
|
/**
|
|
115
113
|
* Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
|
|
116
114
|
* @default 3
|
|
@@ -149,7 +147,6 @@ DataGridRaw.propTypes = {
|
|
|
149
147
|
/**
|
|
150
148
|
* If `true`, `eval()` is not used for performance optimization.
|
|
151
149
|
* @default false
|
|
152
|
-
* @ignore - do not document
|
|
153
150
|
*/
|
|
154
151
|
disableEval: _propTypes.default.bool,
|
|
155
152
|
/**
|
|
@@ -556,12 +553,7 @@ DataGridRaw.propTypes = {
|
|
|
556
553
|
label: _propTypes.default.string.isRequired,
|
|
557
554
|
value: _propTypes.default.number.isRequired
|
|
558
555
|
})]).isRequired),
|
|
559
|
-
pagination:
|
|
560
|
-
if (props.pagination === false) {
|
|
561
|
-
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'));
|
|
562
|
-
}
|
|
563
|
-
return null;
|
|
564
|
-
},
|
|
556
|
+
pagination: _propTypes.default.oneOf([true]),
|
|
565
557
|
/**
|
|
566
558
|
* Pagination can be processed on the server or client-side.
|
|
567
559
|
* Set it to 'client' if you would like to handle the pagination on the client-side.
|
|
@@ -19,7 +19,7 @@ function throwIfNotDateObject({
|
|
|
19
19
|
field
|
|
20
20
|
}) {
|
|
21
21
|
if (!(value instanceof Date)) {
|
|
22
|
-
throw new Error([`MUI: \`${columnType}\` column type only accepts \`Date\` objects as values.`, 'Use `valueGetter` to transform the value into a `Date` object.', `Row ID: ${rowId}, field: "${field}".`].join('\n'));
|
|
22
|
+
throw new Error([`MUI X: \`${columnType}\` column type only accepts \`Date\` objects as values.`, 'Use `valueGetter` to transform the value into a `Date` object.', `Row ID: ${rowId}, field: "${field}".`].join('\n'));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
function gridDateFormatter({
|
|
@@ -65,7 +65,7 @@ const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(fu
|
|
|
65
65
|
const warnedOnceMissingInPageSizeOptions = React.useRef(false);
|
|
66
66
|
const pageSize = rootProps.paginationModel?.pageSize ?? paginationModel.pageSize;
|
|
67
67
|
if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !isPageSizeIncludedInPageSizeOptions(pageSize)) {
|
|
68
|
-
console.warn([`MUI: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions
|
|
68
|
+
console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
|
|
69
69
|
warnedOnceMissingInPageSizeOptions.current = true;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -44,7 +44,7 @@ function GridActionsCell(props) {
|
|
|
44
44
|
const buttonId = (0, _utils.unstable_useId)();
|
|
45
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
46
46
|
if (!hasActions(colDef)) {
|
|
47
|
-
throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
|
|
47
|
+
throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
|
|
48
48
|
}
|
|
49
49
|
const options = colDef.getActions(apiRef.current.getRowParams(id));
|
|
50
50
|
const iconButtons = options.filter(option => !option.props.showInMenu);
|
|
@@ -283,7 +283,7 @@ const GridCell = exports.GridCell = /*#__PURE__*/React.forwardRef((props, ref) =
|
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
if (!warnedOnce) {
|
|
286
|
-
console.warn([`MUI: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${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'));
|
|
286
|
+
console.warn([`MUI X: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${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'));
|
|
287
287
|
warnedOnce = true;
|
|
288
288
|
}
|
|
289
289
|
};
|
|
@@ -552,7 +552,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
552
552
|
return;
|
|
553
553
|
}
|
|
554
554
|
if (!warnedOnce) {
|
|
555
|
-
console.warn([`MUI: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${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'));
|
|
555
|
+
console.warn([`MUI X: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${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'));
|
|
556
556
|
warnedOnce = true;
|
|
557
557
|
}
|
|
558
558
|
};
|
|
@@ -99,7 +99,7 @@ const getLogicOperatorLocaleKey = logicOperator => {
|
|
|
99
99
|
case _gridFilterItem.GridLogicOperator.Or:
|
|
100
100
|
return 'filterPanelOperatorOr';
|
|
101
101
|
default:
|
|
102
|
-
throw new Error('MUI: Invalid `logicOperator` property in the `GridFilterPanel`.');
|
|
102
|
+
throw new Error('MUI X: Invalid `logicOperator` property in the `GridFilterPanel`.');
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
const getColumnLabel = col => col.headerName || col.field;
|
|
@@ -132,12 +132,16 @@ process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|
|
|
132
132
|
* Function responsible for formatting values of quick filter in a string when the model is modified
|
|
133
133
|
* @param {any[]} values The new values passed to the quick filter model
|
|
134
134
|
* @returns {string} The string to display in the text field
|
|
135
|
+
* @default (values: string[]) => values.join(' ')
|
|
135
136
|
*/
|
|
136
137
|
quickFilterFormatter: _propTypes.default.func,
|
|
137
138
|
/**
|
|
138
139
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
139
140
|
* @param {string} input The value entered by the user
|
|
140
141
|
* @returns {any[]} The array of value on which quick filter is applied
|
|
142
|
+
* @default (searchText: string) => searchText
|
|
143
|
+
* .split(' ')
|
|
144
|
+
* .filter((word) => word !== '')
|
|
141
145
|
*/
|
|
142
146
|
quickFilterParser: _propTypes.default.func
|
|
143
147
|
} : void 0;
|
|
@@ -21,13 +21,13 @@ const LOG_LEVELS = ['debug', 'info', 'warn', 'error'];
|
|
|
21
21
|
function getAppender(name, logLevel, appender = console) {
|
|
22
22
|
const minLogLevelIdx = LOG_LEVELS.indexOf(logLevel);
|
|
23
23
|
if (minLogLevelIdx === -1) {
|
|
24
|
-
throw new Error(`MUI: Log level ${logLevel} not recognized.`);
|
|
24
|
+
throw new Error(`MUI X: Log level ${logLevel} not recognized.`);
|
|
25
25
|
}
|
|
26
26
|
const logger = LOG_LEVELS.reduce((loggerObj, method, idx) => {
|
|
27
27
|
if (idx >= minLogLevelIdx) {
|
|
28
28
|
loggerObj[method] = (...args) => {
|
|
29
29
|
const [message, ...other] = args;
|
|
30
|
-
appender[method](`MUI: ${name} - ${message}`, ...other);
|
|
30
|
+
appender[method](`MUI X: ${name} - ${message}`, ...other);
|
|
31
31
|
};
|
|
32
32
|
} else {
|
|
33
33
|
loggerObj[method] = noop;
|
|
@@ -10,7 +10,7 @@ var _utils = require("../../../utils/utils");
|
|
|
10
10
|
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
11
11
|
if ((0, _gridColumnGrouping.isLeaf)(columnGroupNode)) {
|
|
12
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'));
|
|
13
|
+
throw new Error([`MUI X: 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
15
|
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
16
16
|
return;
|
|
@@ -29,17 +29,19 @@ const createGroupLookup = columnGroupingModel => {
|
|
|
29
29
|
} = node,
|
|
30
30
|
other = (0, _objectWithoutPropertiesLoose2.default)(node, _excluded);
|
|
31
31
|
if (!groupId) {
|
|
32
|
-
throw new Error('MUI: An element of the columnGroupingModel does not have either `field` or `groupId`.');
|
|
32
|
+
throw new Error('MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.');
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
35
|
-
|
|
34
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
35
|
+
if (!children) {
|
|
36
|
+
console.warn(`MUI X: group groupId=${groupId} has no children.`);
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
const groupParam = (0, _extends2.default)({}, other, {
|
|
38
40
|
groupId
|
|
39
41
|
});
|
|
40
42
|
const subTreeLookup = createGroupLookup(children);
|
|
41
43
|
if (subTreeLookup[groupId] !== undefined || groupLookup[groupId] !== undefined) {
|
|
42
|
-
throw new Error(`MUI: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
|
|
44
|
+
throw new Error(`MUI X: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
|
|
43
45
|
}
|
|
44
46
|
groupLookup = (0, _extends2.default)({}, groupLookup, subTreeLookup, {
|
|
45
47
|
[groupId]: groupParam
|
|
@@ -23,7 +23,7 @@ const _excluded = ["id", "field"],
|
|
|
23
23
|
_excluded2 = ["id", "field"];
|
|
24
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
-
const missingOnProcessRowUpdateErrorWarning = (0, _warning.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
|
|
26
|
+
const missingOnProcessRowUpdateErrorWarning = (0, _warning.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');
|
|
27
27
|
const useGridCellEditing = (apiRef, props) => {
|
|
28
28
|
const [cellModesModel, setCellModesModel] = React.useState({});
|
|
29
29
|
const cellModesModelRef = React.useRef(cellModesModel);
|
|
@@ -42,12 +42,12 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
42
42
|
const throwIfNotEditable = React.useCallback((id, field) => {
|
|
43
43
|
const params = apiRef.current.getCellParams(id, field);
|
|
44
44
|
if (!apiRef.current.isCellEditable(params)) {
|
|
45
|
-
throw new Error(`MUI: The cell with id=${id} and field=${field} is not editable.`);
|
|
45
|
+
throw new Error(`MUI X: The cell with id=${id} and field=${field} is not editable.`);
|
|
46
46
|
}
|
|
47
47
|
}, [apiRef]);
|
|
48
48
|
const throwIfNotInMode = React.useCallback((id, field, mode) => {
|
|
49
49
|
if (apiRef.current.getCellMode(id, field) !== mode) {
|
|
50
|
-
throw new Error(`MUI: The cell with id=${id} and field=${field} is not in ${mode} mode.`);
|
|
50
|
+
throw new Error(`MUI X: The cell with id=${id} and field=${field} is not in ${mode} mode.`);
|
|
51
51
|
}
|
|
52
52
|
}, [apiRef]);
|
|
53
53
|
const handleCellDoubleClick = React.useCallback((params, event) => {
|
|
@@ -311,7 +311,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
311
311
|
});
|
|
312
312
|
if (onProcessRowUpdateError) {
|
|
313
313
|
onProcessRowUpdateError(errorThrown);
|
|
314
|
-
} else {
|
|
314
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
315
315
|
missingOnProcessRowUpdateErrorWarning();
|
|
316
316
|
}
|
|
317
317
|
};
|
|
@@ -25,7 +25,7 @@ const _excluded = ["id"],
|
|
|
25
25
|
_excluded2 = ["id"];
|
|
26
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
27
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
|
-
const missingOnProcessRowUpdateErrorWarning = (0, _warning.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
|
|
28
|
+
const missingOnProcessRowUpdateErrorWarning = (0, _warning.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');
|
|
29
29
|
const useGridRowEditing = (apiRef, props) => {
|
|
30
30
|
const [rowModesModel, setRowModesModel] = React.useState({});
|
|
31
31
|
const rowModesModelRef = React.useRef(rowModesModel);
|
|
@@ -46,12 +46,12 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
46
46
|
const throwIfNotEditable = React.useCallback((id, field) => {
|
|
47
47
|
const params = apiRef.current.getCellParams(id, field);
|
|
48
48
|
if (!apiRef.current.isCellEditable(params)) {
|
|
49
|
-
throw new Error(`MUI: The cell with id=${id} and field=${field} is not editable.`);
|
|
49
|
+
throw new Error(`MUI X: The cell with id=${id} and field=${field} is not editable.`);
|
|
50
50
|
}
|
|
51
51
|
}, [apiRef]);
|
|
52
52
|
const throwIfNotInMode = React.useCallback((id, mode) => {
|
|
53
53
|
if (apiRef.current.getRowMode(id) !== mode) {
|
|
54
|
-
throw new Error(`MUI: The row with id=${id} is not in ${mode} mode.`);
|
|
54
|
+
throw new Error(`MUI X: The row with id=${id} is not in ${mode} mode.`);
|
|
55
55
|
}
|
|
56
56
|
}, [apiRef]);
|
|
57
57
|
const handleCellDoubleClick = React.useCallback((params, event) => {
|
|
@@ -388,7 +388,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
388
388
|
});
|
|
389
389
|
if (onProcessRowUpdateError) {
|
|
390
390
|
onProcessRowUpdateError(errorThrown);
|
|
391
|
-
} else {
|
|
391
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
392
392
|
missingOnProcessRowUpdateErrorWarning();
|
|
393
393
|
}
|
|
394
394
|
};
|
|
@@ -40,7 +40,7 @@ const serializeCellValue = (cellParams, options) => {
|
|
|
40
40
|
return sanitizeCellValue(value, delimiterCharacter);
|
|
41
41
|
};
|
|
42
42
|
exports.serializeCellValue = serializeCellValue;
|
|
43
|
-
const objectFormattedValueWarning = (0, _warning.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.']);
|
|
43
|
+
const objectFormattedValueWarning = (0, _warning.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.']);
|
|
44
44
|
class CSVRow {
|
|
45
45
|
constructor(options) {
|
|
46
46
|
this.options = void 0;
|
|
@@ -215,7 +215,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
215
215
|
const exportDataAsPrint = React.useCallback(async options => {
|
|
216
216
|
logger.debug(`Export data as Print`);
|
|
217
217
|
if (!apiRef.current.rootElementRef.current) {
|
|
218
|
-
throw new Error('MUI: No grid root element available.');
|
|
218
|
+
throw new Error('MUI X: No grid root element available.');
|
|
219
219
|
}
|
|
220
220
|
previousGridState.current = apiRef.current.exportState();
|
|
221
221
|
// It appends that the visibility model is not exported, especially if columnVisibility is not controlled
|
|
@@ -11,14 +11,17 @@ var _gridFilterState = require("./gridFilterState");
|
|
|
11
11
|
var _warning = require("../../../utils/warning");
|
|
12
12
|
var _getPublicApiRef = require("../../../utils/getPublicApiRef");
|
|
13
13
|
var _columns = require("../columns");
|
|
14
|
-
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
15
|
-
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
16
|
-
const evalCode = globalScope[atob('ZXZhbA==')];
|
|
17
14
|
let hasEval;
|
|
18
|
-
|
|
19
|
-
hasEval
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
function getHasEval() {
|
|
16
|
+
if (hasEval !== undefined) {
|
|
17
|
+
return hasEval;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
hasEval = new Function('return true')();
|
|
21
|
+
} catch (_) {
|
|
22
|
+
hasEval = false;
|
|
23
|
+
}
|
|
24
|
+
return hasEval;
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -41,9 +44,9 @@ const cleanFilterItem = (item, apiRef) => {
|
|
|
41
44
|
return cleanItem;
|
|
42
45
|
};
|
|
43
46
|
exports.cleanFilterItem = cleanFilterItem;
|
|
44
|
-
const filterModelDisableMultiColumnsFilteringWarning = (0, _warning.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');
|
|
45
|
-
const filterModelMissingItemIdWarning = (0, _warning.buildWarning)('MUI: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
|
|
46
|
-
const filterModelMissingItemOperatorWarning = (0, _warning.buildWarning)('MUI: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
|
|
47
|
+
const filterModelDisableMultiColumnsFilteringWarning = (0, _warning.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');
|
|
48
|
+
const filterModelMissingItemIdWarning = (0, _warning.buildWarning)('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
|
|
49
|
+
const filterModelMissingItemOperatorWarning = (0, _warning.buildWarning)('MUI X: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
|
|
47
50
|
const sanitizeFilterModel = (model, disableMultipleColumnsFiltering, apiRef) => {
|
|
48
51
|
const hasSeveralItems = model.items.length > 1;
|
|
49
52
|
let items;
|
|
@@ -111,11 +114,11 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
111
114
|
});
|
|
112
115
|
const filterOperators = column.filterOperators;
|
|
113
116
|
if (!filterOperators?.length) {
|
|
114
|
-
throw new Error(`MUI: No filter operators found for column '${column.field}'.`);
|
|
117
|
+
throw new Error(`MUI X: No filter operators found for column '${column.field}'.`);
|
|
115
118
|
}
|
|
116
119
|
const filterOperator = filterOperators.find(operator => operator.value === newFilterItem.operator);
|
|
117
120
|
if (!filterOperator) {
|
|
118
|
-
throw new Error(`MUI: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
|
|
121
|
+
throw new Error(`MUI X: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
|
|
119
122
|
}
|
|
120
123
|
const publicApiRef = (0, _getPublicApiRef.getPublicApiRef)(apiRef);
|
|
121
124
|
const applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
|
|
@@ -149,7 +152,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
149
152
|
if (appliers.length === 0) {
|
|
150
153
|
return null;
|
|
151
154
|
}
|
|
152
|
-
if (
|
|
155
|
+
if (disableEval || !getHasEval()) {
|
|
153
156
|
// This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
|
|
154
157
|
return (row, shouldApplyFilter) => {
|
|
155
158
|
const resultPerItemId = {};
|
|
@@ -163,25 +166,20 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
163
166
|
};
|
|
164
167
|
}
|
|
165
168
|
|
|
166
|
-
// We generate a new function with `
|
|
169
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
167
170
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
168
|
-
const
|
|
169
|
-
|
|
171
|
+
const filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', `"use strict";
|
|
172
|
+
${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
false :
|
|
175
|
-
appliers[${i}].fn(row),
|
|
176
|
-
`).join('\n')}};
|
|
174
|
+
const result$$ = {
|
|
175
|
+
${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i} ? false : appliers[${i}].fn(row),`).join('\n')}
|
|
176
|
+
};
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
})`;
|
|
180
|
-
const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
|
|
181
|
-
const filterItem = (row, shouldApplyItem) => {
|
|
182
|
-
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
183
|
-
};
|
|
178
|
+
return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
|
|
184
179
|
filterItemsApplierId += 1;
|
|
180
|
+
|
|
181
|
+
// Assign to the arrow function a name to help debugging
|
|
182
|
+
const filterItem = (row, shouldApplyItem) => filterItemCore(appliers, row, shouldApplyItem);
|
|
185
183
|
return filterItem;
|
|
186
184
|
};
|
|
187
185
|
const shouldQuickFilterExcludeHiddenColumns = filterModel => {
|
|
@@ -16,7 +16,7 @@ const getPageCount = (rowCount, pageSize) => {
|
|
|
16
16
|
return 0;
|
|
17
17
|
};
|
|
18
18
|
exports.getPageCount = getPageCount;
|
|
19
|
-
const noRowCountInServerMode = exports.noRowCountInServerMode = (0, _warning.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');
|
|
19
|
+
const noRowCountInServerMode = exports.noRowCountInServerMode = (0, _warning.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');
|
|
20
20
|
const getDefaultGridPaginationModel = autoPageSize => ({
|
|
21
21
|
page: 0,
|
|
22
22
|
pageSize: autoPageSize ? 0 : 100
|
|
@@ -31,7 +31,7 @@ const getValidPage = (page, pageCount = 0) => {
|
|
|
31
31
|
exports.getValidPage = getValidPage;
|
|
32
32
|
const throwIfPageSizeExceedsTheLimit = (pageSize, signatureProp) => {
|
|
33
33
|
if (signatureProp === _utils.GridSignature.DataGrid && pageSize > MAX_PAGE_SIZE) {
|
|
34
|
-
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'));
|
|
34
|
+
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'));
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
exports.throwIfPageSizeExceedsTheLimit = throwIfPageSizeExceedsTheLimit;
|
|
@@ -102,7 +102,7 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
102
102
|
*/
|
|
103
103
|
const setRowSelectionModel = React.useCallback(model => {
|
|
104
104
|
if (props.signature === _useGridApiEventHandler.GridSignature.DataGrid && !canHaveMultipleSelection && Array.isArray(model) && model.length > 1) {
|
|
105
|
-
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'));
|
|
105
|
+
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'));
|
|
106
106
|
}
|
|
107
107
|
const currentModel = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef.current.state);
|
|
108
108
|
if (currentModel !== model) {
|
|
@@ -37,7 +37,7 @@ const buildRootGroup = () => ({
|
|
|
37
37
|
exports.buildRootGroup = buildRootGroup;
|
|
38
38
|
function checkGridRowIdIsValid(id, row, detailErrorMessage = 'A row was provided without id in the rows prop:') {
|
|
39
39
|
if (id == null) {
|
|
40
|
-
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'));
|
|
40
|
+
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'));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
const getRowIdFromRowModel = (rowModel, getRowId, detailErrorMessage) => {
|
|
@@ -163,7 +163,7 @@ const updateCacheWithNewRows = ({
|
|
|
163
163
|
updates
|
|
164
164
|
}) => {
|
|
165
165
|
if (previousCache.updates.type === 'full') {
|
|
166
|
-
throw new Error('MUI: Unable to prepare a partial update if a full update is not applied yet');
|
|
166
|
+
throw new Error('MUI X: Unable to prepare a partial update if a full update is not applied yet.');
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// Remove duplicate updates.
|
|
@@ -131,7 +131,7 @@ const useGridRows = (apiRef, props) => {
|
|
|
131
131
|
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
|
|
132
132
|
const updateRows = React.useCallback(updates => {
|
|
133
133
|
if (props.signature === _useGridApiEventHandler.GridSignature.DataGrid && updates.length > 1) {
|
|
134
|
-
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'));
|
|
134
|
+
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'));
|
|
135
135
|
}
|
|
136
136
|
const nonPinnedRowsUpdates = [];
|
|
137
137
|
updates.forEach(update => {
|
|
@@ -169,10 +169,10 @@ const useGridRows = (apiRef, props) => {
|
|
|
169
169
|
const setRowChildrenExpansion = React.useCallback((id, isExpanded) => {
|
|
170
170
|
const currentNode = apiRef.current.getRowNode(id);
|
|
171
171
|
if (!currentNode) {
|
|
172
|
-
throw new Error(`MUI: No row with id #${id} found
|
|
172
|
+
throw new Error(`MUI X: No row with id #${id} found.`);
|
|
173
173
|
}
|
|
174
174
|
if (currentNode.type !== 'group') {
|
|
175
|
-
throw new Error('MUI: Only group nodes can be expanded or collapsed');
|
|
175
|
+
throw new Error('MUI X: Only group nodes can be expanded or collapsed.');
|
|
176
176
|
}
|
|
177
177
|
const newNode = (0, _extends2.default)({}, currentNode, {
|
|
178
178
|
childrenExpanded: isExpanded
|
|
@@ -224,13 +224,13 @@ const useGridRows = (apiRef, props) => {
|
|
|
224
224
|
const setRowIndex = React.useCallback((rowId, targetIndex) => {
|
|
225
225
|
const node = apiRef.current.getRowNode(rowId);
|
|
226
226
|
if (!node) {
|
|
227
|
-
throw new Error(`MUI: No row with id #${rowId} found
|
|
227
|
+
throw new Error(`MUI X: No row with id #${rowId} found.`);
|
|
228
228
|
}
|
|
229
229
|
if (node.parent !== _gridRowsUtils.GRID_ROOT_GROUP_ID) {
|
|
230
|
-
throw new Error(`MUI: The row reordering do not support reordering of grouped rows yet
|
|
230
|
+
throw new Error(`MUI X: The row reordering do not support reordering of grouped rows yet.`);
|
|
231
231
|
}
|
|
232
232
|
if (node.type !== 'leaf') {
|
|
233
|
-
throw new Error(`MUI: The row reordering do not support reordering of footer or grouping rows
|
|
233
|
+
throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
|
|
234
234
|
}
|
|
235
235
|
apiRef.current.setState(state => {
|
|
236
236
|
const group = (0, _gridRowsSelector.gridRowTreeSelector)(state, apiRef.current.instanceId)[_gridRowsUtils.GRID_ROOT_GROUP_ID];
|
|
@@ -256,7 +256,7 @@ const useGridRows = (apiRef, props) => {
|
|
|
256
256
|
}, [apiRef, logger]);
|
|
257
257
|
const replaceRows = React.useCallback((firstRowToRender, newRows) => {
|
|
258
258
|
if (props.signature === _useGridApiEventHandler.GridSignature.DataGrid && newRows.length > 1) {
|
|
259
|
-
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'));
|
|
259
|
+
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'));
|
|
260
260
|
}
|
|
261
261
|
if (newRows.length === 0) {
|
|
262
262
|
return;
|
|
@@ -38,8 +38,8 @@ const getValidRowHeight = (rowHeightProp, defaultRowHeight, warningMessage) => {
|
|
|
38
38
|
}
|
|
39
39
|
return defaultRowHeight;
|
|
40
40
|
};
|
|
41
|
-
const rowHeightWarning = [`MUI: The \`rowHeight\` prop should be a number greater than 0.`, `The default value will be used instead.`].join('\n');
|
|
42
|
-
const getRowHeightWarning = [`MUI: The \`getRowHeight\` prop should return a number greater than 0 or 'auto'.`, `The default value will be used instead.`].join('\n');
|
|
41
|
+
const rowHeightWarning = [`MUI X: The \`rowHeight\` prop should be a number greater than 0.`, `The default value will be used instead.`].join('\n');
|
|
42
|
+
const getRowHeightWarning = [`MUI X: The \`getRowHeight\` prop should return a number greater than 0 or 'auto'.`, `The default value will be used instead.`].join('\n');
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* @requires useGridPageSize (method)
|
|
@@ -7,10 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.sanitizeSortModel = exports.mergeStateWithSortModel = exports.gridStringOrNumberComparator = exports.gridNumberComparator = exports.gridDateComparator = exports.getNextGridSortDirection = exports.buildAggregatedSortingApplier = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _warning = require("../../../utils/warning");
|
|
10
|
-
const sortModelDisableMultiColumnsSortingWarning = (0, _warning.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');
|
|
10
|
+
const sortModelDisableMultiColumnsSortingWarning = (0, _warning.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');
|
|
11
11
|
const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
|
|
12
12
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
13
|
-
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
sortModelDisableMultiColumnsSortingWarning();
|
|
15
|
+
}
|
|
14
16
|
return [model[0]];
|
|
15
17
|
}
|
|
16
18
|
return model;
|