@mui/x-data-grid 8.0.0-beta.0 → 8.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +171 -0
- package/DataGrid/DataGrid.js +2 -0
- package/components/GridRow.js +3 -8
- package/components/GridShadowScrollArea.js +43 -35
- package/components/cell/GridBooleanCell.d.ts +1 -2
- package/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/components/cell/GridEditSingleSelectCell.js +1 -1
- package/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/components/containers/GridToolbarContainer.js +5 -3
- package/components/quickFilter/QuickFilter.d.ts +26 -3
- package/components/quickFilter/QuickFilter.js +103 -19
- package/components/quickFilter/QuickFilterClear.js +10 -4
- package/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/components/quickFilter/QuickFilterControl.js +36 -10
- package/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/components/quickFilter/QuickFilterTrigger.js +211 -0
- package/components/quickFilter/index.d.ts +2 -1
- package/components/quickFilter/index.js +11 -0
- package/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/components/toolbar/GridToolbarQuickFilter.js +101 -41
- package/components/toolbarV8/GridToolbar.js +22 -19
- package/components/toolbarV8/Toolbar.d.ts +1 -1
- package/components/toolbarV8/Toolbar.js +76 -23
- package/components/toolbarV8/ToolbarButton.js +34 -14
- package/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/constants/gridClasses.d.ts +12 -0
- package/constants/gridClasses.js +1 -1
- package/esm/DataGrid/DataGrid.js +2 -0
- package/esm/components/GridRow.js +4 -9
- package/esm/components/GridShadowScrollArea.js +43 -35
- package/esm/components/cell/GridBooleanCell.d.ts +1 -2
- package/esm/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
- package/esm/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/esm/components/containers/GridToolbarContainer.js +5 -3
- package/esm/components/quickFilter/QuickFilter.d.ts +26 -3
- package/esm/components/quickFilter/QuickFilter.js +101 -17
- package/esm/components/quickFilter/QuickFilterClear.js +10 -4
- package/esm/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/esm/components/quickFilter/QuickFilterControl.js +36 -10
- package/esm/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterTrigger.js +204 -0
- package/esm/components/quickFilter/index.d.ts +2 -1
- package/esm/components/quickFilter/index.js +2 -1
- package/esm/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/esm/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/esm/components/toolbar/GridToolbarQuickFilter.js +102 -44
- package/esm/components/toolbarV8/GridToolbar.js +22 -19
- package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/components/toolbarV8/Toolbar.js +75 -22
- package/esm/components/toolbarV8/ToolbarButton.js +34 -14
- package/esm/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/esm/constants/gridClasses.d.ts +12 -0
- package/esm/constants/gridClasses.js +1 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/esm/hooks/features/columns/useGridColumns.js +0 -1
- package/esm/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
- package/esm/hooks/features/filter/useGridFilter.js +1 -1
- package/esm/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
- package/esm/index.js +1 -1
- package/esm/locales/deDE.js +13 -13
- package/esm/material/index.js +1 -2
- package/esm/models/props/DataGridProps.d.ts +6 -2
- package/esm/utils/utils.d.ts +0 -27
- package/esm/utils/utils.js +0 -122
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +2 -2
- package/hooks/features/columns/useGridColumns.js +0 -1
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -3
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -0
- package/index.js +1 -1
- package/locales/deDE.js +13 -13
- package/material/index.js +1 -2
- package/models/props/DataGridProps.d.ts +6 -2
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/components/GridRow.js +4 -9
- package/modern/components/GridShadowScrollArea.js +43 -35
- package/modern/components/cell/GridBooleanCell.d.ts +1 -2
- package/modern/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/modern/components/containers/GridToolbarContainer.js +5 -3
- package/modern/components/quickFilter/QuickFilter.d.ts +26 -3
- package/modern/components/quickFilter/QuickFilter.js +101 -17
- package/modern/components/quickFilter/QuickFilterClear.js +10 -4
- package/modern/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/modern/components/quickFilter/QuickFilterControl.js +36 -10
- package/modern/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterTrigger.js +204 -0
- package/modern/components/quickFilter/index.d.ts +2 -1
- package/modern/components/quickFilter/index.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/modern/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/modern/components/toolbar/GridToolbarQuickFilter.js +102 -44
- package/modern/components/toolbarV8/GridToolbar.js +22 -19
- package/modern/components/toolbarV8/Toolbar.d.ts +1 -1
- package/modern/components/toolbarV8/Toolbar.js +75 -22
- package/modern/components/toolbarV8/ToolbarButton.js +34 -14
- package/modern/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/modern/constants/gridClasses.d.ts +12 -0
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/modern/hooks/features/columns/useGridColumns.js +0 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
- package/modern/index.js +1 -1
- package/modern/locales/deDE.js +13 -13
- package/modern/material/index.js +1 -2
- package/modern/models/props/DataGridProps.d.ts +6 -2
- package/modern/utils/utils.d.ts +0 -27
- package/modern/utils/utils.js +0 -122
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/utils.d.ts +0 -27
- package/utils/utils.js +0 -123
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.unwrapGroupingColumnModel = exports.getColumnGroupsHeaderStructure = void 0;
|
|
7
|
+
var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
|
|
7
8
|
var _gridColumnGrouping = require("../../../models/gridColumnGrouping");
|
|
8
|
-
var _utils = require("../../../utils/utils");
|
|
9
9
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
10
10
|
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
11
11
|
if ((0, _gridColumnGrouping.isLeaf)(columnGroupNode)) {
|
|
@@ -45,7 +45,7 @@ const getColumnGroupsHeaderStructure = (orderedColumns, unwrappedGroupingModel,
|
|
|
45
45
|
const getParents = field => unwrappedGroupingModel[field] ?? [];
|
|
46
46
|
const groupingHeaderStructure = [];
|
|
47
47
|
const maxDepth = Math.max(...orderedColumns.map(field => getParents(field).length));
|
|
48
|
-
const haveSameParents = (field1, field2, depth) => (0,
|
|
48
|
+
const haveSameParents = (field1, field2, depth) => (0, _isDeepEqual.isDeepEqual)(getParents(field1).slice(0, depth + 1), getParents(field2).slice(0, depth + 1));
|
|
49
49
|
const haveDifferentContainers = (field1, field2) => {
|
|
50
50
|
if (pinnedFields?.left && pinnedFields.left.includes(field1) && !pinnedFields.left.includes(field2)) {
|
|
51
51
|
return true;
|
|
@@ -55,7 +55,6 @@ function useGridColumns(apiRef, props) {
|
|
|
55
55
|
logger.debug('Updating columns state.');
|
|
56
56
|
apiRef.current.setState(mergeColumnsState(columnsState));
|
|
57
57
|
apiRef.current.publishEvent('columnsChange', columnsState.orderedFields);
|
|
58
|
-
apiRef.current.updateRenderContext?.();
|
|
59
58
|
}, [logger, apiRef]);
|
|
60
59
|
|
|
61
60
|
/**
|
|
@@ -13,6 +13,7 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
|
|
|
13
13
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
14
14
|
var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
|
|
15
15
|
var _throttle = require("@mui/x-internals/throttle");
|
|
16
|
+
var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
|
|
16
17
|
var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
|
|
17
18
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
18
19
|
var _createSelector = require("../../../utils/createSelector");
|
|
@@ -29,7 +30,6 @@ var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
|
29
30
|
var _dataGridPropsDefaultValues = require("../../../constants/dataGridPropsDefaultValues");
|
|
30
31
|
var _roundToDecimalPlaces = require("../../../utils/roundToDecimalPlaces");
|
|
31
32
|
var _isJSDOM = require("../../../utils/isJSDOM");
|
|
32
|
-
var _utils2 = require("../../../utils/utils");
|
|
33
33
|
const EMPTY_SIZE = {
|
|
34
34
|
width: 0,
|
|
35
35
|
height: 0
|
|
@@ -201,7 +201,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
201
201
|
bottomContainerHeight
|
|
202
202
|
};
|
|
203
203
|
const prevDimensions = apiRef.current.state.dimensions;
|
|
204
|
-
if ((0,
|
|
204
|
+
if ((0, _isDeepEqual.isDeepEqual)(prevDimensions, newDimensions)) {
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
setDimensions(newDimensions);
|
|
@@ -413,7 +413,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
413
413
|
});
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
|
-
const rowUpdate = apiRef.current.getRowWithUpdatedValuesFromRowEditing(
|
|
416
|
+
const rowUpdate = apiRef.current.getRowWithUpdatedValuesFromRowEditing(id);
|
|
417
417
|
if (processRowUpdate) {
|
|
418
418
|
const handleError = errorThrown => {
|
|
419
419
|
// The row might have been deleted
|
|
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _reselect = require("reselect");
|
|
12
12
|
var _utils = require("@mui/utils");
|
|
13
|
+
var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
|
|
13
14
|
var _useLazyRef = require("../../utils/useLazyRef");
|
|
14
15
|
var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
|
|
15
16
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
@@ -23,7 +24,6 @@ var _rows = require("../rows");
|
|
|
23
24
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
24
25
|
var _strategyProcessing = require("../../core/strategyProcessing");
|
|
25
26
|
var _gridFilterUtils = require("./gridFilterUtils");
|
|
26
|
-
var _utils2 = require("../../../utils/utils");
|
|
27
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
28
|
const filterStateInitializer = (state, props, apiRef) => {
|
|
29
29
|
const filterModel = props.filterModel ?? props.initialState?.filter?.filterModel ?? (0, _gridFilterState.getDefaultGridFilterModel)();
|
|
@@ -187,7 +187,7 @@ const useGridFilter = (apiRef, props) => {
|
|
|
187
187
|
}, [apiRef]);
|
|
188
188
|
const setQuickFilterValues = React.useCallback(values => {
|
|
189
189
|
const filterModel = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
|
|
190
|
-
if ((0,
|
|
190
|
+
if ((0, _isDeepEqual.isDeepEqual)(filterModel.quickFilterValues, values)) {
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
apiRef.current.setFilterModel((0, _extends2.default)({}, filterModel, {
|
|
@@ -246,7 +246,7 @@ const useGridFilter = (apiRef, props) => {
|
|
|
246
246
|
// Always export if the model has been initialized
|
|
247
247
|
props.initialState?.filter?.filterModel != null ||
|
|
248
248
|
// Export if the model is not equal to the default value
|
|
249
|
-
!(0,
|
|
249
|
+
!(0, _isDeepEqual.isDeepEqual)(filterModelToExport, (0, _gridFilterState.getDefaultGridFilterModel)());
|
|
250
250
|
if (!shouldExportFilterModel) {
|
|
251
251
|
return prevState;
|
|
252
252
|
}
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useGridPaginationModel = exports.getDerivedPaginationModel = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
|
|
11
12
|
var _gridFilterSelector = require("../filter/gridFilterSelector");
|
|
12
13
|
var _density = require("../density");
|
|
13
14
|
var _utils = require("../../utils");
|
|
14
|
-
var _utils2 = require("../../../utils/utils");
|
|
15
15
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
16
16
|
var _gridPaginationSelector = require("./gridPaginationSelector");
|
|
17
17
|
var _gridPaginationUtils = require("./gridPaginationUtils");
|
|
@@ -193,7 +193,7 @@ const useGridPaginationModel = (apiRef, props) => {
|
|
|
193
193
|
// replace items with the active items
|
|
194
194
|
items: (0, _gridFilterSelector.gridFilterActiveItemsSelector)(apiRef)
|
|
195
195
|
});
|
|
196
|
-
if ((0,
|
|
196
|
+
if ((0, _isDeepEqual.isDeepEqual)(currentActiveFilters, previousFilterModel.current)) {
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
previousFilterModel.current = currentActiveFilters;
|
|
@@ -270,6 +270,7 @@ const useGridVirtualScroller = () => {
|
|
|
270
270
|
if (!params.rows && !currentPage.range) {
|
|
271
271
|
return [];
|
|
272
272
|
}
|
|
273
|
+
const rowTree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
|
|
273
274
|
let baseRenderContext = renderContext;
|
|
274
275
|
if (params.renderContext) {
|
|
275
276
|
baseRenderContext = params.renderContext;
|
|
@@ -315,6 +316,16 @@ const useGridVirtualScroller = () => {
|
|
|
315
316
|
id,
|
|
316
317
|
model
|
|
317
318
|
} = rowModels[rowIndexInPage];
|
|
319
|
+
|
|
320
|
+
// In certain cases, the state might already be updated and `currentPage.rows` (which sets `rowModels`)
|
|
321
|
+
// contains stale data.
|
|
322
|
+
// In that case, skip any further row processing.
|
|
323
|
+
// See:
|
|
324
|
+
// - https://github.com/mui/mui-x/issues/16638
|
|
325
|
+
// - https://github.com/mui/mui-x/issues/17022
|
|
326
|
+
if (!rowTree[id]) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
318
329
|
const rowIndex = (currentPage?.range?.firstRowIndex || 0) + rowIndexOffset + rowIndexInPage;
|
|
319
330
|
|
|
320
331
|
// NOTE: This is an expensive feature, the colSpan code could be optimized.
|
package/index.js
CHANGED
package/locales/deDE.js
CHANGED
|
@@ -114,7 +114,7 @@ const deDEGrid = {
|
|
|
114
114
|
filterValueFalse: 'Nein',
|
|
115
115
|
// Column menu text
|
|
116
116
|
columnMenuLabel: 'Menü',
|
|
117
|
-
|
|
117
|
+
columnMenuAriaLabel: columnName => `${columnName} Spaltenmenü`,
|
|
118
118
|
columnMenuShowColumns: 'Zeige alle Spalten',
|
|
119
119
|
columnMenuManageColumns: 'Spalten verwalten',
|
|
120
120
|
columnMenuFilter: 'Filter',
|
|
@@ -161,18 +161,18 @@ const deDEGrid = {
|
|
|
161
161
|
collapseDetailPanel: 'Zuklappen',
|
|
162
162
|
// Pagination
|
|
163
163
|
paginationRowsPerPage: 'Zeilen pro Seite:',
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
paginationDisplayedRows: ({
|
|
165
|
+
from,
|
|
166
|
+
to,
|
|
167
|
+
count,
|
|
168
|
+
estimated
|
|
169
|
+
}) => {
|
|
170
|
+
if (!estimated) {
|
|
171
|
+
return `${from}–${to} von ${count !== -1 ? count : `mehr als ${to}`}`;
|
|
172
|
+
}
|
|
173
|
+
const estimatedLabel = estimated && estimated > to ? `ungefähr ${estimated}` : `mehr als ${to}`;
|
|
174
|
+
return `${from}–${to} von ${count !== -1 ? count : estimatedLabel}`;
|
|
175
|
+
},
|
|
176
176
|
paginationItemAriaLabel: type => {
|
|
177
177
|
if (type === 'first') {
|
|
178
178
|
return 'Zur ersten Seite';
|
package/material/index.js
CHANGED
|
@@ -64,7 +64,6 @@ const _excluded = ["id", "label", "labelId", "disabled", "slotProps", "onChange"
|
|
|
64
64
|
_excluded8 = ["inputProps", "InputProps", "InputLabelProps"],
|
|
65
65
|
_excluded9 = ["slotProps"],
|
|
66
66
|
_excluded10 = ["native"];
|
|
67
|
-
const ClickAwayListener = (0, _forwardRef.forwardRef)(_ClickAwayListener.default);
|
|
68
67
|
const InputAdornment = (0, _styles.styled)(_InputAdornment.default)({
|
|
69
68
|
[`&.${_InputAdornment.inputAdornmentClasses.positionEnd} .${_IconButton.iconButtonClasses.sizeSmall}`]: {
|
|
70
69
|
marginRight: '-7px'
|
|
@@ -526,7 +525,7 @@ function clickAwayWrapper(props, content) {
|
|
|
526
525
|
if (props.onClickAway === undefined) {
|
|
527
526
|
return content;
|
|
528
527
|
}
|
|
529
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
528
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickAwayListener.default, {
|
|
530
529
|
onClickAway: props.onClickAway,
|
|
531
530
|
touchEvent: props.clickAwayTouchEvent,
|
|
532
531
|
mouseEvent: props.clickAwayMouseEvent,
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { RefObject } from '@mui/x-internals/types';
|
|
3
3
|
import { SxProps } from '@mui/system';
|
|
4
4
|
import { Theme } from '@mui/material/styles';
|
|
5
|
-
import { CommonProps } from '@mui/material/OverridableComponent';
|
|
6
5
|
import { GridDensity } from "../gridDensity.js";
|
|
7
6
|
import { GridEditMode } from "../gridEditRowModel.js";
|
|
8
7
|
import { GridFeatureMode } from "../gridFeatureMode.js";
|
|
@@ -29,6 +28,10 @@ import type { GridAutosizeOptions } from '../../hooks/features/columnResize';
|
|
|
29
28
|
import type { GridDataSource, GridDataSourceCache } from '../gridDataSource';
|
|
30
29
|
import type { GridRowSelectionPropagation } from '../gridRowSelectionModel';
|
|
31
30
|
import type { GridGetRowsError, GridUpdateRowError } from '../../hooks/features/dataSource/gridDataSourceError';
|
|
31
|
+
type CommonProps = {
|
|
32
|
+
className?: string;
|
|
33
|
+
style?: React.CSSProperties;
|
|
34
|
+
};
|
|
32
35
|
export interface GridExperimentalFeatures {
|
|
33
36
|
/**
|
|
34
37
|
* Emits a warning if the cell receives focus without also syncing the focus state.
|
|
@@ -853,4 +856,5 @@ export interface DataGridPremiumSharedPropsWithDefaultValue {
|
|
|
853
856
|
/**
|
|
854
857
|
* The props of the Data Grid component after the pre-processing phase.
|
|
855
858
|
*/
|
|
856
|
-
export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {}
|
|
859
|
+
export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {}
|
|
860
|
+
export {};
|
|
@@ -110,6 +110,7 @@ DataGridRaw.propTypes = {
|
|
|
110
110
|
* Override or extend the styles applied to the component.
|
|
111
111
|
*/
|
|
112
112
|
classes: PropTypes.object,
|
|
113
|
+
className: PropTypes.string,
|
|
113
114
|
/**
|
|
114
115
|
* The character used to separate cell values when copying to the clipboard.
|
|
115
116
|
* @default '\t'
|
|
@@ -769,6 +770,7 @@ DataGridRaw.propTypes = {
|
|
|
769
770
|
field: PropTypes.string.isRequired,
|
|
770
771
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
771
772
|
})),
|
|
773
|
+
style: PropTypes.object,
|
|
772
774
|
/**
|
|
773
775
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
774
776
|
*/
|
|
@@ -23,7 +23,7 @@ import { GRID_CHECKBOX_SELECTION_COL_DEF } from "../colDef/gridCheckboxSelection
|
|
|
23
23
|
import { GRID_ACTIONS_COLUMN_TYPE } from "../colDef/gridActionsColDef.js";
|
|
24
24
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD, PinnedColumnPosition } from "../internals/constants.js";
|
|
25
25
|
import { gridSortModelSelector } from "../hooks/features/sorting/gridSortingSelector.js";
|
|
26
|
-
import { gridRowMaximumTreeDepthSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
26
|
+
import { gridRowMaximumTreeDepthSelector, gridRowNodeSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
27
27
|
import { gridEditRowsStateSelector, gridRowIsEditingSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
28
28
|
import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFillerCell.js";
|
|
29
29
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
@@ -79,7 +79,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
79
79
|
const rowReordering = rootProps.rowReordering;
|
|
80
80
|
const isRowReorderingEnabled = useGridSelector(apiRef, isRowReorderingEnabledSelector, rowReordering);
|
|
81
81
|
const handleRef = useForkRef(ref, refProp);
|
|
82
|
-
const rowNode = apiRef
|
|
82
|
+
const rowNode = gridRowNodeSelector(apiRef, rowId);
|
|
83
83
|
const editing = useGridSelector(apiRef, gridRowIsEditingSelector, {
|
|
84
84
|
rowId,
|
|
85
85
|
editMode: rootProps.editMode
|
|
@@ -192,7 +192,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
192
192
|
return rowStyle;
|
|
193
193
|
}, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
|
|
194
194
|
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
195
|
-
const ariaAttributes =
|
|
195
|
+
const ariaAttributes = getRowAriaAttributes(rowNode, index);
|
|
196
196
|
if (typeof rootProps.getRowClassName === 'function') {
|
|
197
197
|
const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
|
|
198
198
|
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
@@ -202,11 +202,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
202
202
|
});
|
|
203
203
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
204
204
|
}
|
|
205
|
-
|
|
206
|
-
/* Start of rendering */
|
|
207
|
-
if (!rowNode) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
205
|
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
|
|
211
206
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
212
207
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
@@ -215,7 +210,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
215
210
|
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
216
211
|
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
217
212
|
const pinnedOffset = getPinnedCellOffset(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
|
|
218
|
-
if (rowNode
|
|
213
|
+
if (rowNode.type === 'skeletonRow') {
|
|
219
214
|
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
220
215
|
type: column.type,
|
|
221
216
|
width: width,
|
|
@@ -17,48 +17,56 @@ const detectScroll = keyframes({
|
|
|
17
17
|
'--scrollable': '" "'
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
// This `styled()` function invokes keyframes. `styled-components` only supports keyframes
|
|
22
|
+
// in string templates. Do not convert these styles in JS object as it will break.
|
|
20
23
|
const ShadowScrollArea = styled('div', {
|
|
21
24
|
name: 'MuiDataGrid',
|
|
22
25
|
slot: 'ShadowScrollArea'
|
|
23
|
-
})
|
|
24
|
-
flex: 1
|
|
25
|
-
display:
|
|
26
|
-
|
|
27
|
-
animation: detectScroll
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
overflow:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
})`
|
|
27
|
+
flex: 1;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
animation: ${detectScroll};
|
|
31
|
+
animation-timeline: --scroll-timeline;
|
|
32
|
+
animation-fill-mode: none;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
overflow: auto;
|
|
35
|
+
scroll-timeline: --scroll-timeline block;
|
|
36
|
+
|
|
37
|
+
&::before,
|
|
38
|
+
&::after {
|
|
39
|
+
content: '';
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
display: block;
|
|
42
|
+
position: sticky;
|
|
43
|
+
left: 0;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 4px;
|
|
46
|
+
animation: ${reveal} linear both;
|
|
47
|
+
animation-timeline: --scroll-timeline;
|
|
48
|
+
|
|
43
49
|
// Custom property toggle trick:
|
|
44
50
|
// - Detects if the element is scrollable
|
|
45
51
|
// - https://css-tricks.com/the-css-custom-property-toggle-trick/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
visibility:
|
|
49
|
-
},
|
|
50
|
-
'&::before': {
|
|
51
|
-
top: 0,
|
|
52
|
-
background: 'linear-gradient(to bottom, rgba(0,0,0,0.05) 0, transparent 100%)',
|
|
53
|
-
animationRange: '0 4px'
|
|
54
|
-
},
|
|
55
|
-
'&::after': {
|
|
56
|
-
bottom: 0,
|
|
57
|
-
background: 'linear-gradient(to top, rgba(0,0,0,0.05) 0, transparent 100%)',
|
|
58
|
-
animationDirection: 'reverse',
|
|
59
|
-
animationRange: 'calc(100% - 4px) 100%'
|
|
52
|
+
--visibility-scrollable: var(--scrollable) visible;
|
|
53
|
+
--visibility-not-scrollable: hidden;
|
|
54
|
+
visibility: var(--visibility-scrollable, var(--visibility-not-scrollable));
|
|
60
55
|
}
|
|
61
|
-
|
|
56
|
+
|
|
57
|
+
&::before {
|
|
58
|
+
top: 0;
|
|
59
|
+
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0, transparent 100%);
|
|
60
|
+
animation-range: 0 4px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&::after {
|
|
64
|
+
bottom: 0;
|
|
65
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.05) 0, transparent 100%);
|
|
66
|
+
animation-direction: reverse;
|
|
67
|
+
animation-range: calc(100% - 4px) 100%;
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
62
70
|
|
|
63
71
|
/**
|
|
64
72
|
* Adds scroll shadows above and below content in a scrollable container.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SvgIconProps } from '@mui/material/SvgIcon';
|
|
3
2
|
import type { GridColDef } from '../../models/colDef/gridColDef';
|
|
4
3
|
import type { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
5
|
-
interface GridBooleanCellProps extends GridRenderCellParams
|
|
4
|
+
interface GridBooleanCellProps extends GridRenderCellParams {
|
|
6
5
|
hideDescendantCount?: boolean;
|
|
7
6
|
}
|
|
8
7
|
declare function GridBooleanCellRaw(props: GridBooleanCellProps): React.JSX.Element | null;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
|
|
3
3
|
import { GridRenderEditCellParams } from "../../models/params/gridCellParams.js";
|
|
4
|
-
export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams
|
|
4
|
+
export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams {
|
|
5
5
|
/**
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
|
-
* @param {
|
|
7
|
+
* @param {Event<any>} event The event source of the callback.
|
|
8
8
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
9
|
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
10
10
|
*/
|
|
11
|
-
onValueChange?: (event:
|
|
11
|
+
onValueChange?: (event: Parameters<NonNullable<GridSlotProps['baseSelect']['onOpen']>>[0], newValue: any) => Promise<void> | void;
|
|
12
12
|
/**
|
|
13
13
|
* If true, the select opens by default.
|
|
14
14
|
*/
|
|
@@ -162,7 +162,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
162
162
|
isValidating: PropTypes.bool,
|
|
163
163
|
/**
|
|
164
164
|
* Callback called when the value is changed by the user.
|
|
165
|
-
* @param {
|
|
165
|
+
* @param {Event<any>} event The event source of the callback.
|
|
166
166
|
* @param {any} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
167
167
|
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
168
168
|
*/
|
|
@@ -69,7 +69,7 @@ const GridHeaderCheckbox = forwardRef(function GridHeaderCheckbox(props, ref) {
|
|
|
69
69
|
|
|
70
70
|
// All the rows that could be selected / unselected by toggling this checkbox
|
|
71
71
|
const selectionCandidates = React.useMemo(() => {
|
|
72
|
-
const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly ? visibleRowIds : paginatedVisibleRowIds;
|
|
72
|
+
const rowIds = !rootProps.pagination || !rootProps.checkboxSelectionVisibleOnly || rootProps.paginationMode === 'server' ? visibleRowIds : paginatedVisibleRowIds;
|
|
73
73
|
|
|
74
74
|
// Convert to a Set to make O(1) checking if a row exists or not
|
|
75
75
|
const candidates = new Set();
|
|
@@ -80,7 +80,7 @@ const GridHeaderCheckbox = forwardRef(function GridHeaderCheckbox(props, ref) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
return candidates;
|
|
83
|
-
}, [apiRef, rootProps.pagination, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
|
|
83
|
+
}, [apiRef, rootProps.pagination, rootProps.paginationMode, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
|
|
84
84
|
|
|
85
85
|
// Amount of rows selected and that are visible in the current page
|
|
86
86
|
const currentSelectionSize = React.useMemo(() => {
|
|
@@ -10,6 +10,7 @@ import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
|
10
10
|
import { vars } from "../../constants/cssVariables.js";
|
|
11
11
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
12
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
13
|
+
import { Toolbar } from "../toolbarV8/index.js";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const useUtilityClasses = ownerState => {
|
|
15
16
|
const {
|
|
@@ -20,16 +21,17 @@ const useUtilityClasses = ownerState => {
|
|
|
20
21
|
};
|
|
21
22
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
22
23
|
};
|
|
23
|
-
const GridToolbarContainerRoot = styled(
|
|
24
|
+
const GridToolbarContainerRoot = styled(Toolbar, {
|
|
24
25
|
name: 'MuiDataGrid',
|
|
25
26
|
slot: 'ToolbarContainer',
|
|
26
|
-
|
|
27
|
+
shouldForwardProp: prop => prop !== 'ownerState'
|
|
27
28
|
})({
|
|
28
29
|
display: 'flex',
|
|
29
30
|
alignItems: 'center',
|
|
30
31
|
flexWrap: 'wrap',
|
|
31
32
|
gap: vars.spacing(1),
|
|
32
|
-
padding: vars.spacing(0.5,
|
|
33
|
+
padding: vars.spacing(0.5),
|
|
34
|
+
minHeight: 'auto'
|
|
33
35
|
});
|
|
34
36
|
const GridToolbarContainer = forwardRef(function GridToolbarContainer(props, ref) {
|
|
35
37
|
const {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { QuickFilterState } from "./QuickFilterContext.js";
|
|
3
|
+
import { RenderProp } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
2
4
|
import type { GridFilterModel } from '../../models';
|
|
3
|
-
export type QuickFilterProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
+
export type QuickFilterProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> & {
|
|
5
6
|
/**
|
|
6
7
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
7
8
|
* @param {string} input The value entered by the user
|
|
@@ -21,10 +22,32 @@ export type QuickFilterProps = {
|
|
|
21
22
|
* @default 150
|
|
22
23
|
*/
|
|
23
24
|
debounceMs?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The default expanded state of the quick filter control.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
defaultExpanded?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The expanded state of the quick filter control.
|
|
32
|
+
*/
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A function to customize rendering of the component.
|
|
36
|
+
*/
|
|
37
|
+
render?: RenderProp<React.ComponentProps<'div'>, QuickFilterState>;
|
|
38
|
+
/**
|
|
39
|
+
* Override or extend the styles applied to the component.
|
|
40
|
+
*/
|
|
41
|
+
className?: string | ((state: QuickFilterState) => string);
|
|
42
|
+
/**
|
|
43
|
+
* Callback function that is called when the quick filter input is expanded or collapsed.
|
|
44
|
+
* @param {boolean} expanded The new expanded state of the quick filter control
|
|
45
|
+
*/
|
|
46
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
24
47
|
};
|
|
25
48
|
/**
|
|
26
49
|
* The top level Quick Filter component that provides context to child components.
|
|
27
|
-
* It
|
|
50
|
+
* It renders a `<div />` element.
|
|
28
51
|
*
|
|
29
52
|
* Demos:
|
|
30
53
|
*
|