@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
package/legacy/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,21 @@
|
|
|
1
|
+
export var propValidatorsDataGrid = [function (props) {
|
|
2
|
+
return 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;
|
|
3
|
+
}];
|
|
4
|
+
var warnedOnceMap = new Set();
|
|
5
|
+
var warnOnce = function warnOnce(message) {
|
|
6
|
+
if (!warnedOnceMap.has(message)) {
|
|
7
|
+
console.error(message);
|
|
8
|
+
warnedOnceMap.add(message);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export var validateProps = function validateProps(props, validators) {
|
|
12
|
+
if (process.env.NODE_ENV === 'production') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
validators.forEach(function (validator) {
|
|
16
|
+
var warning = validator(props);
|
|
17
|
+
if (warning) {
|
|
18
|
+
warnOnce(warning);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
package/legacy/locales/csCZ.js
CHANGED
|
@@ -160,10 +160,10 @@ var csCZGrid = {
|
|
|
160
160
|
// Grouping columns
|
|
161
161
|
groupingColumnHeaderName: 'Skupina',
|
|
162
162
|
groupColumn: function groupColumn(name) {
|
|
163
|
-
return "
|
|
163
|
+
return "Seskupit podle ".concat(name);
|
|
164
164
|
},
|
|
165
165
|
unGroupColumn: function unGroupColumn(name) {
|
|
166
|
-
return "P\u0159estat
|
|
166
|
+
return "P\u0159estat seskupovat podle ".concat(name);
|
|
167
167
|
},
|
|
168
168
|
// Master/detail
|
|
169
169
|
detailPanelToggle: 'Přepnout detail panelu',
|
|
@@ -3,7 +3,7 @@ import { buildWarning } from './warning';
|
|
|
3
3
|
var cacheContainer = {
|
|
4
4
|
cache: new WeakMap()
|
|
5
5
|
};
|
|
6
|
-
var 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
|
+
var 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/legacy/utils/exportAs.js
CHANGED
package/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',
|
|
@@ -159,7 +159,6 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
159
159
|
/**
|
|
160
160
|
* If `true`, `eval()` is not used for performance optimization.
|
|
161
161
|
* @default false
|
|
162
|
-
* @ignore - do not document
|
|
163
162
|
*/
|
|
164
163
|
disableEval: boolean;
|
|
165
164
|
/**
|
|
@@ -669,7 +668,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
669
668
|
*/
|
|
670
669
|
'aria-labelledby'?: string;
|
|
671
670
|
/**
|
|
672
|
-
* Set of columns of type [[GridColDef
|
|
671
|
+
* Set of columns of type [[GridColDef]][].
|
|
673
672
|
*/
|
|
674
673
|
columns: readonly GridColDef<R>[];
|
|
675
674
|
/**
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { chainPropTypes } from '@mui/utils';
|
|
5
4
|
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from '../components';
|
|
6
5
|
import { GridContextProvider } from '../context/GridContextProvider';
|
|
7
6
|
import { useDataGridComponent } from './useDataGridComponent';
|
|
8
7
|
import { useDataGridProps } from './useDataGridProps';
|
|
9
8
|
import { DataGridVirtualScroller } from '../components/DataGridVirtualScroller';
|
|
9
|
+
import { propValidatorsDataGrid, validateProps } from '../internals/utils/propValidation';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const propValidators = [...propValidatorsDataGrid,
|
|
13
|
+
// Only validate in MIT version
|
|
14
|
+
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];
|
|
12
15
|
const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref) {
|
|
13
16
|
const props = useDataGridProps(inProps);
|
|
14
17
|
const privateApiRef = useDataGridComponent(props.apiRef, props);
|
|
18
|
+
validateProps(props, propValidators);
|
|
15
19
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
16
20
|
privateApiRef: privateApiRef,
|
|
17
21
|
props: props,
|
|
@@ -94,15 +98,9 @@ DataGridRaw.propTypes = {
|
|
|
94
98
|
*/
|
|
95
99
|
columnHeaderHeight: PropTypes.number,
|
|
96
100
|
/**
|
|
97
|
-
* Set of columns of type [[GridColDef
|
|
101
|
+
* Set of columns of type [[GridColDef]][].
|
|
98
102
|
*/
|
|
99
|
-
columns:
|
|
100
|
-
// @ts-ignore because otherwise `build:api` doesn't work
|
|
101
|
-
if (props.columns && props.columns.some(column => column.resizable)) {
|
|
102
|
-
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'));
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}),
|
|
103
|
+
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
106
104
|
/**
|
|
107
105
|
* Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
|
|
108
106
|
* @default 3
|
|
@@ -141,7 +139,6 @@ DataGridRaw.propTypes = {
|
|
|
141
139
|
/**
|
|
142
140
|
* If `true`, `eval()` is not used for performance optimization.
|
|
143
141
|
* @default false
|
|
144
|
-
* @ignore - do not document
|
|
145
142
|
*/
|
|
146
143
|
disableEval: PropTypes.bool,
|
|
147
144
|
/**
|
|
@@ -548,12 +545,7 @@ DataGridRaw.propTypes = {
|
|
|
548
545
|
label: PropTypes.string.isRequired,
|
|
549
546
|
value: PropTypes.number.isRequired
|
|
550
547
|
})]).isRequired),
|
|
551
|
-
pagination:
|
|
552
|
-
if (props.pagination === false) {
|
|
553
|
-
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'));
|
|
554
|
-
}
|
|
555
|
-
return null;
|
|
556
|
-
},
|
|
548
|
+
pagination: PropTypes.oneOf([true]),
|
|
557
549
|
/**
|
|
558
550
|
* Pagination can be processed on the server or client-side.
|
|
559
551
|
* Set it to 'client' if you would like to handle the pagination on the client-side.
|
|
@@ -10,7 +10,7 @@ function throwIfNotDateObject({
|
|
|
10
10
|
field
|
|
11
11
|
}) {
|
|
12
12
|
if (!(value instanceof Date)) {
|
|
13
|
-
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'));
|
|
13
|
+
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'));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
export function gridDateFormatter({
|
|
@@ -56,7 +56,7 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
56
56
|
const warnedOnceMissingInPageSizeOptions = React.useRef(false);
|
|
57
57
|
const pageSize = rootProps.paginationModel?.pageSize ?? paginationModel.pageSize;
|
|
58
58
|
if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !isPageSizeIncludedInPageSizeOptions(pageSize)) {
|
|
59
|
-
console.warn([`MUI: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions
|
|
59
|
+
console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
|
|
60
60
|
warnedOnceMissingInPageSizeOptions.current = true;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -35,7 +35,7 @@ function GridActionsCell(props) {
|
|
|
35
35
|
const buttonId = useId();
|
|
36
36
|
const rootProps = useGridRootProps();
|
|
37
37
|
if (!hasActions(colDef)) {
|
|
38
|
-
throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
|
|
38
|
+
throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
|
|
39
39
|
}
|
|
40
40
|
const options = colDef.getActions(apiRef.current.getRowParams(id));
|
|
41
41
|
const iconButtons = options.filter(option => !option.props.showInMenu);
|
|
@@ -274,7 +274,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
276
|
if (!warnedOnce) {
|
|
277
|
-
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'));
|
|
277
|
+
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'));
|
|
278
278
|
warnedOnce = true;
|
|
279
279
|
}
|
|
280
280
|
};
|
|
@@ -544,7 +544,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
546
546
|
if (!warnedOnce) {
|
|
547
|
-
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'));
|
|
547
|
+
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'));
|
|
548
548
|
warnedOnce = true;
|
|
549
549
|
}
|
|
550
550
|
};
|
|
@@ -91,7 +91,7 @@ const getLogicOperatorLocaleKey = logicOperator => {
|
|
|
91
91
|
case GridLogicOperator.Or:
|
|
92
92
|
return 'filterPanelOperatorOr';
|
|
93
93
|
default:
|
|
94
|
-
throw new Error('MUI: Invalid `logicOperator` property in the `GridFilterPanel`.');
|
|
94
|
+
throw new Error('MUI X: Invalid `logicOperator` property in the `GridFilterPanel`.');
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
const getColumnLabel = col => col.headerName || col.field;
|
|
@@ -123,12 +123,16 @@ process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|
|
|
123
123
|
* Function responsible for formatting values of quick filter in a string when the model is modified
|
|
124
124
|
* @param {any[]} values The new values passed to the quick filter model
|
|
125
125
|
* @returns {string} The string to display in the text field
|
|
126
|
+
* @default (values: string[]) => values.join(' ')
|
|
126
127
|
*/
|
|
127
128
|
quickFilterFormatter: PropTypes.func,
|
|
128
129
|
/**
|
|
129
130
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
130
131
|
* @param {string} input The value entered by the user
|
|
131
132
|
* @returns {any[]} The array of value on which quick filter is applied
|
|
133
|
+
* @default (searchText: string) => searchText
|
|
134
|
+
* .split(' ')
|
|
135
|
+
* .filter((word) => word !== '')
|
|
132
136
|
*/
|
|
133
137
|
quickFilterParser: PropTypes.func
|
|
134
138
|
} : void 0;
|
|
@@ -13,13 +13,13 @@ const LOG_LEVELS = ['debug', 'info', 'warn', 'error'];
|
|
|
13
13
|
function getAppender(name, logLevel, appender = console) {
|
|
14
14
|
const minLogLevelIdx = LOG_LEVELS.indexOf(logLevel);
|
|
15
15
|
if (minLogLevelIdx === -1) {
|
|
16
|
-
throw new Error(`MUI: Log level ${logLevel} not recognized.`);
|
|
16
|
+
throw new Error(`MUI X: Log level ${logLevel} not recognized.`);
|
|
17
17
|
}
|
|
18
18
|
const logger = LOG_LEVELS.reduce((loggerObj, method, idx) => {
|
|
19
19
|
if (idx >= minLogLevelIdx) {
|
|
20
20
|
loggerObj[method] = (...args) => {
|
|
21
21
|
const [message, ...other] = args;
|
|
22
|
-
appender[method](`MUI: ${name} - ${message}`, ...other);
|
|
22
|
+
appender[method](`MUI X: ${name} - ${message}`, ...other);
|
|
23
23
|
};
|
|
24
24
|
} else {
|
|
25
25
|
loggerObj[method] = noop;
|
|
@@ -4,7 +4,7 @@ import { isDeepEqual } from '../../../utils/utils';
|
|
|
4
4
|
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
5
5
|
if (isLeaf(columnGroupNode)) {
|
|
6
6
|
if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
|
|
7
|
-
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'));
|
|
7
|
+
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'));
|
|
8
8
|
}
|
|
9
9
|
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
10
10
|
return;
|
|
@@ -20,17 +20,19 @@ const createGroupLookup = columnGroupingModel => {
|
|
|
20
20
|
} = node,
|
|
21
21
|
other = _objectWithoutPropertiesLoose(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 (
|
|
26
|
-
|
|
25
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
26
|
+
if (!children) {
|
|
27
|
+
console.warn(`MUI X: group groupId=${groupId} has no children.`);
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
const groupParam = _extends({}, other, {
|
|
29
31
|
groupId
|
|
30
32
|
});
|
|
31
33
|
const subTreeLookup = createGroupLookup(children);
|
|
32
34
|
if (subTreeLookup[groupId] !== undefined || groupLookup[groupId] !== undefined) {
|
|
33
|
-
throw new Error(`MUI: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
|
|
35
|
+
throw new Error(`MUI X: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
|
|
34
36
|
}
|
|
35
37
|
groupLookup = _extends({}, groupLookup, subTreeLookup, {
|
|
36
38
|
[groupId]: groupParam
|
|
@@ -14,7 +14,7 @@ import { buildWarning } from '../../../utils/warning';
|
|
|
14
14
|
import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
|
|
15
15
|
import { deepClone } from '../../../utils/utils';
|
|
16
16
|
import { GridCellEditStartReasons, GridCellEditStopReasons } from '../../../models/params/gridEditCellParams';
|
|
17
|
-
const 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
|
|
17
|
+
const 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');
|
|
18
18
|
export const useGridCellEditing = (apiRef, props) => {
|
|
19
19
|
const [cellModesModel, setCellModesModel] = React.useState({});
|
|
20
20
|
const cellModesModelRef = React.useRef(cellModesModel);
|
|
@@ -33,12 +33,12 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
33
33
|
const throwIfNotEditable = React.useCallback((id, field) => {
|
|
34
34
|
const params = apiRef.current.getCellParams(id, field);
|
|
35
35
|
if (!apiRef.current.isCellEditable(params)) {
|
|
36
|
-
throw new Error(`MUI: The cell with id=${id} and field=${field} is not editable.`);
|
|
36
|
+
throw new Error(`MUI X: The cell with id=${id} and field=${field} is not editable.`);
|
|
37
37
|
}
|
|
38
38
|
}, [apiRef]);
|
|
39
39
|
const throwIfNotInMode = React.useCallback((id, field, mode) => {
|
|
40
40
|
if (apiRef.current.getCellMode(id, field) !== mode) {
|
|
41
|
-
throw new Error(`MUI: The cell with id=${id} and field=${field} is not in ${mode} mode.`);
|
|
41
|
+
throw new Error(`MUI X: The cell with id=${id} and field=${field} is not in ${mode} mode.`);
|
|
42
42
|
}
|
|
43
43
|
}, [apiRef]);
|
|
44
44
|
const handleCellDoubleClick = React.useCallback((params, event) => {
|
|
@@ -302,7 +302,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
302
302
|
});
|
|
303
303
|
if (onProcessRowUpdateError) {
|
|
304
304
|
onProcessRowUpdateError(errorThrown);
|
|
305
|
-
} else {
|
|
305
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
306
306
|
missingOnProcessRowUpdateErrorWarning();
|
|
307
307
|
}
|
|
308
308
|
};
|
|
@@ -16,7 +16,7 @@ import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
|
|
|
16
16
|
import { deepClone } from '../../../utils/utils';
|
|
17
17
|
import { GridRowEditStopReasons, GridRowEditStartReasons } from '../../../models/params/gridRowParams';
|
|
18
18
|
import { GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
|
|
19
|
-
const 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
|
|
19
|
+
const 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');
|
|
20
20
|
export const useGridRowEditing = (apiRef, props) => {
|
|
21
21
|
const [rowModesModel, setRowModesModel] = React.useState({});
|
|
22
22
|
const rowModesModelRef = React.useRef(rowModesModel);
|
|
@@ -37,12 +37,12 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
37
37
|
const throwIfNotEditable = React.useCallback((id, field) => {
|
|
38
38
|
const params = apiRef.current.getCellParams(id, field);
|
|
39
39
|
if (!apiRef.current.isCellEditable(params)) {
|
|
40
|
-
throw new Error(`MUI: The cell with id=${id} and field=${field} is not editable.`);
|
|
40
|
+
throw new Error(`MUI X: The cell with id=${id} and field=${field} is not editable.`);
|
|
41
41
|
}
|
|
42
42
|
}, [apiRef]);
|
|
43
43
|
const throwIfNotInMode = React.useCallback((id, mode) => {
|
|
44
44
|
if (apiRef.current.getRowMode(id) !== mode) {
|
|
45
|
-
throw new Error(`MUI: The row with id=${id} is not in ${mode} mode.`);
|
|
45
|
+
throw new Error(`MUI X: The row with id=${id} is not in ${mode} mode.`);
|
|
46
46
|
}
|
|
47
47
|
}, [apiRef]);
|
|
48
48
|
const handleCellDoubleClick = React.useCallback((params, event) => {
|
|
@@ -379,7 +379,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
379
379
|
});
|
|
380
380
|
if (onProcessRowUpdateError) {
|
|
381
381
|
onProcessRowUpdateError(errorThrown);
|
|
382
|
-
} else {
|
|
382
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
383
383
|
missingOnProcessRowUpdateErrorWarning();
|
|
384
384
|
}
|
|
385
385
|
};
|
|
@@ -32,7 +32,7 @@ export const serializeCellValue = (cellParams, options) => {
|
|
|
32
32
|
}
|
|
33
33
|
return sanitizeCellValue(value, delimiterCharacter);
|
|
34
34
|
};
|
|
35
|
-
const 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.']);
|
|
35
|
+
const 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.']);
|
|
36
36
|
class CSVRow {
|
|
37
37
|
constructor(options) {
|
|
38
38
|
this.options = void 0;
|
|
@@ -206,7 +206,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
206
206
|
const exportDataAsPrint = React.useCallback(async options => {
|
|
207
207
|
logger.debug(`Export data as Print`);
|
|
208
208
|
if (!apiRef.current.rootElementRef.current) {
|
|
209
|
-
throw new Error('MUI: No grid root element available.');
|
|
209
|
+
throw new Error('MUI X: No grid root element available.');
|
|
210
210
|
}
|
|
211
211
|
previousGridState.current = apiRef.current.exportState();
|
|
212
212
|
// 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
|
-
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
10
|
-
const evalCode = globalScope[atob('ZXZhbA==')];
|
|
11
7
|
let hasEval;
|
|
12
|
-
|
|
13
|
-
hasEval
|
|
14
|
-
|
|
15
|
-
|
|
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 const cleanFilterItem = (item, apiRef) => {
|
|
|
34
36
|
}
|
|
35
37
|
return cleanItem;
|
|
36
38
|
};
|
|
37
|
-
const 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
|
-
const filterModelMissingItemIdWarning = buildWarning('MUI: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
|
|
39
|
-
const filterModelMissingItemOperatorWarning = buildWarning('MUI: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
|
|
39
|
+
const 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
|
+
const filterModelMissingItemIdWarning = buildWarning('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
|
|
41
|
+
const 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 const sanitizeFilterModel = (model, disableMultipleColumnsFiltering, apiRef) => {
|
|
41
43
|
const hasSeveralItems = model.items.length > 1;
|
|
42
44
|
let items;
|
|
@@ -101,11 +103,11 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
101
103
|
});
|
|
102
104
|
const filterOperators = column.filterOperators;
|
|
103
105
|
if (!filterOperators?.length) {
|
|
104
|
-
throw new Error(`MUI: No filter operators found for column '${column.field}'.`);
|
|
106
|
+
throw new Error(`MUI X: No filter operators found for column '${column.field}'.`);
|
|
105
107
|
}
|
|
106
108
|
const filterOperator = filterOperators.find(operator => operator.value === newFilterItem.operator);
|
|
107
109
|
if (!filterOperator) {
|
|
108
|
-
throw new Error(`MUI: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
|
|
110
|
+
throw new Error(`MUI X: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
|
|
109
111
|
}
|
|
110
112
|
const publicApiRef = getPublicApiRef(apiRef);
|
|
111
113
|
const applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
|
|
@@ -139,7 +141,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
139
141
|
if (appliers.length === 0) {
|
|
140
142
|
return null;
|
|
141
143
|
}
|
|
142
|
-
if (
|
|
144
|
+
if (disableEval || !getHasEval()) {
|
|
143
145
|
// This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
|
|
144
146
|
return (row, shouldApplyFilter) => {
|
|
145
147
|
const resultPerItemId = {};
|
|
@@ -153,25 +155,20 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
// We generate a new function with `
|
|
158
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
157
159
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
+
const filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', `"use strict";
|
|
161
|
+
${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
|
|
160
162
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
false :
|
|
165
|
-
appliers[${i}].fn(row),
|
|
166
|
-
`).join('\n')}};
|
|
163
|
+
const result$$ = {
|
|
164
|
+
${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i} ? false : appliers[${i}].fn(row),`).join('\n')}
|
|
165
|
+
};
|
|
167
166
|
|
|
168
|
-
|
|
169
|
-
})`;
|
|
170
|
-
const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
|
|
171
|
-
const filterItem = (row, shouldApplyItem) => {
|
|
172
|
-
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
173
|
-
};
|
|
167
|
+
return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
|
|
174
168
|
filterItemsApplierId += 1;
|
|
169
|
+
|
|
170
|
+
// Assign to the arrow function a name to help debugging
|
|
171
|
+
const filterItem = (row, shouldApplyItem) => filterItemCore(appliers, row, shouldApplyItem);
|
|
175
172
|
return filterItem;
|
|
176
173
|
};
|
|
177
174
|
export const shouldQuickFilterExcludeHiddenColumns = filterModel => {
|
|
@@ -8,7 +8,7 @@ export const getPageCount = (rowCount, pageSize) => {
|
|
|
8
8
|
}
|
|
9
9
|
return 0;
|
|
10
10
|
};
|
|
11
|
-
export const 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');
|
|
11
|
+
export const 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');
|
|
12
12
|
export const getDefaultGridPaginationModel = autoPageSize => ({
|
|
13
13
|
page: 0,
|
|
14
14
|
pageSize: autoPageSize ? 0 : 100
|
|
@@ -21,6 +21,6 @@ export const getValidPage = (page, pageCount = 0) => {
|
|
|
21
21
|
};
|
|
22
22
|
export const throwIfPageSizeExceedsTheLimit = (pageSize, signatureProp) => {
|
|
23
23
|
if (signatureProp === GridSignature.DataGrid && pageSize > MAX_PAGE_SIZE) {
|
|
24
|
-
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'));
|
|
24
|
+
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'));
|
|
25
25
|
}
|
|
26
26
|
};
|
|
@@ -92,7 +92,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
92
92
|
*/
|
|
93
93
|
const setRowSelectionModel = React.useCallback(model => {
|
|
94
94
|
if (props.signature === GridSignature.DataGrid && !canHaveMultipleSelection && Array.isArray(model) && model.length > 1) {
|
|
95
|
-
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'));
|
|
95
|
+
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'));
|
|
96
96
|
}
|
|
97
97
|
const currentModel = gridRowSelectionStateSelector(apiRef.current.state);
|
|
98
98
|
if (currentModel !== model) {
|
|
@@ -24,7 +24,7 @@ export const buildRootGroup = () => ({
|
|
|
24
24
|
*/
|
|
25
25
|
export function checkGridRowIdIsValid(id, row, detailErrorMessage = 'A row was provided without id in the rows prop:') {
|
|
26
26
|
if (id == null) {
|
|
27
|
-
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'));
|
|
27
|
+
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'));
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
export const getRowIdFromRowModel = (rowModel, getRowId, detailErrorMessage) => {
|
|
@@ -144,7 +144,7 @@ export const updateCacheWithNewRows = ({
|
|
|
144
144
|
updates
|
|
145
145
|
}) => {
|
|
146
146
|
if (previousCache.updates.type === 'full') {
|
|
147
|
-
throw new Error('MUI: Unable to prepare a partial update if a full update is not applied yet');
|
|
147
|
+
throw new Error('MUI X: Unable to prepare a partial update if a full update is not applied yet.');
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
// Remove duplicate updates.
|
|
@@ -121,7 +121,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
121
121
|
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
|
|
122
122
|
const updateRows = React.useCallback(updates => {
|
|
123
123
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
124
|
-
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'));
|
|
124
|
+
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'));
|
|
125
125
|
}
|
|
126
126
|
const nonPinnedRowsUpdates = [];
|
|
127
127
|
updates.forEach(update => {
|
|
@@ -159,10 +159,10 @@ export const useGridRows = (apiRef, props) => {
|
|
|
159
159
|
const setRowChildrenExpansion = React.useCallback((id, isExpanded) => {
|
|
160
160
|
const currentNode = apiRef.current.getRowNode(id);
|
|
161
161
|
if (!currentNode) {
|
|
162
|
-
throw new Error(`MUI: No row with id #${id} found
|
|
162
|
+
throw new Error(`MUI X: No row with id #${id} found.`);
|
|
163
163
|
}
|
|
164
164
|
if (currentNode.type !== 'group') {
|
|
165
|
-
throw new Error('MUI: Only group nodes can be expanded or collapsed');
|
|
165
|
+
throw new Error('MUI X: Only group nodes can be expanded or collapsed.');
|
|
166
166
|
}
|
|
167
167
|
const newNode = _extends({}, currentNode, {
|
|
168
168
|
childrenExpanded: isExpanded
|
|
@@ -214,13 +214,13 @@ export const useGridRows = (apiRef, props) => {
|
|
|
214
214
|
const setRowIndex = React.useCallback((rowId, targetIndex) => {
|
|
215
215
|
const node = apiRef.current.getRowNode(rowId);
|
|
216
216
|
if (!node) {
|
|
217
|
-
throw new Error(`MUI: No row with id #${rowId} found
|
|
217
|
+
throw new Error(`MUI X: No row with id #${rowId} found.`);
|
|
218
218
|
}
|
|
219
219
|
if (node.parent !== GRID_ROOT_GROUP_ID) {
|
|
220
|
-
throw new Error(`MUI: The row reordering do not support reordering of grouped rows yet
|
|
220
|
+
throw new Error(`MUI X: The row reordering do not support reordering of grouped rows yet.`);
|
|
221
221
|
}
|
|
222
222
|
if (node.type !== 'leaf') {
|
|
223
|
-
throw new Error(`MUI: The row reordering do not support reordering of footer or grouping rows
|
|
223
|
+
throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
|
|
224
224
|
}
|
|
225
225
|
apiRef.current.setState(state => {
|
|
226
226
|
const group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
|
|
@@ -246,7 +246,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
246
246
|
}, [apiRef, logger]);
|
|
247
247
|
const replaceRows = React.useCallback((firstRowToRender, newRows) => {
|
|
248
248
|
if (props.signature === GridSignature.DataGrid && newRows.length > 1) {
|
|
249
|
-
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'));
|
|
249
|
+
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'));
|
|
250
250
|
}
|
|
251
251
|
if (newRows.length === 0) {
|
|
252
252
|
return;
|
|
@@ -28,8 +28,8 @@ const getValidRowHeight = (rowHeightProp, defaultRowHeight, warningMessage) => {
|
|
|
28
28
|
}
|
|
29
29
|
return defaultRowHeight;
|
|
30
30
|
};
|
|
31
|
-
const rowHeightWarning = [`MUI: The \`rowHeight\` prop should be a number greater than 0.`, `The default value will be used instead.`].join('\n');
|
|
32
|
-
const getRowHeightWarning = [`MUI: The \`getRowHeight\` prop should return a number greater than 0 or 'auto'.`, `The default value will be used instead.`].join('\n');
|
|
31
|
+
const rowHeightWarning = [`MUI X: The \`rowHeight\` prop should be a number greater than 0.`, `The default value will be used instead.`].join('\n');
|
|
32
|
+
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');
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* @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
|
-
const 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
|
+
const 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 const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
|
|
5
5
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
6
|
-
|
|
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
|
const 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
|
}
|