@mui/x-data-grid 5.11.0 → 5.12.1
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 +237 -16
- package/DataGrid/DataGrid.js +26 -1
- package/README.md +3 -4
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +51 -12
- package/components/base/GridOverlays.js +1 -1
- package/components/cell/GridActionsCellItem.d.ts +1 -1
- package/components/cell/GridCell.d.ts +2 -1
- package/components/cell/GridCell.js +12 -7
- package/components/columnHeaders/GridColumnHeaderItem.js +4 -3
- package/components/containers/GridRoot.js +25 -5
- package/components/containers/GridRootStyles.js +7 -2
- package/components/menu/GridMenu.js +9 -2
- package/components/panel/GridColumnsPanel.js +10 -2
- package/components/panel/GridPanelWrapper.d.ts +1 -1
- package/components/panel/GridPanelWrapper.js +3 -3
- package/components/panel/filterPanel/GridFilterForm.d.ts +61 -4
- package/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -5
- package/components/panel/filterPanel/GridFilterPanel.js +25 -9
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.d.ts +7 -0
- package/components/toolbar/GridToolbarQuickFilter.js +58 -6
- package/constants/defaultGridSlotsComponents.js +4 -2
- package/constants/gridClasses.d.ts +16 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -9
- package/hooks/core/useGridStateInitialization.js +19 -6
- package/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -0
- package/hooks/features/columns/useGridColumns.js +13 -15
- package/hooks/features/editRows/useGridCellEditing.new.js +11 -4
- package/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +2 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +5 -0
- package/hooks/features/filter/gridFilterSelector.js +6 -0
- package/hooks/features/filter/gridFilterUtils.d.ts +10 -2
- package/hooks/features/filter/gridFilterUtils.js +3 -6
- package/hooks/features/filter/useGridFilter.js +29 -12
- package/hooks/features/pagination/useGridPage.js +1 -1
- package/hooks/features/pagination/useGridPageSize.js +1 -1
- package/hooks/features/rows/gridRowsState.d.ts +14 -5
- package/hooks/features/rows/gridRowsUtils.d.ts +13 -1
- package/hooks/features/rows/gridRowsUtils.js +54 -0
- package/hooks/features/rows/useGridRows.js +63 -102
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +107 -43
- package/hooks/features/selection/useGridSelection.js +1 -1
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +27 -7
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/legacy/DataGrid/DataGrid.js +26 -1
- package/legacy/components/GridRow.js +56 -12
- package/legacy/components/base/GridOverlays.js +1 -1
- package/legacy/components/cell/GridCell.js +12 -7
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +6 -3
- package/legacy/components/containers/GridRoot.js +23 -5
- package/legacy/components/containers/GridRootStyles.js +9 -6
- package/legacy/components/menu/GridMenu.js +9 -2
- package/legacy/components/panel/GridColumnsPanel.js +12 -2
- package/legacy/components/panel/GridPanelWrapper.js +3 -3
- package/legacy/components/panel/filterPanel/GridFilterForm.js +89 -8
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +27 -10
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +68 -8
- package/legacy/constants/defaultGridSlotsComponents.js +4 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -10
- package/legacy/hooks/core/useGridStateInitialization.js +18 -6
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/legacy/hooks/features/columns/useGridColumns.js +13 -15
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -7
- package/legacy/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/legacy/hooks/features/events/useGridEvents.js +2 -0
- package/legacy/hooks/features/filter/gridFilterSelector.js +8 -0
- package/legacy/hooks/features/filter/gridFilterUtils.js +4 -7
- package/legacy/hooks/features/filter/useGridFilter.js +33 -12
- package/legacy/hooks/features/pagination/useGridPage.js +1 -1
- package/legacy/hooks/features/pagination/useGridPageSize.js +1 -1
- package/legacy/hooks/features/rows/gridRowsUtils.js +55 -0
- package/legacy/hooks/features/rows/useGridRows.js +75 -111
- package/legacy/hooks/features/rows/useGridRowsMeta.js +104 -41
- package/legacy/hooks/features/selection/useGridSelection.js +1 -1
- package/legacy/hooks/features/sorting/useGridSorting.js +1 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +46 -22
- package/legacy/index.js +1 -1
- package/legacy/locales/heIL.js +9 -9
- package/legacy/locales/jaJP.js +28 -24
- package/legacy/locales/nbNO.js +127 -0
- package/legacy/locales/ruRU.js +9 -9
- package/legacy/locales/trTR.js +7 -7
- package/legacy/models/events/gridEvents.js +2 -0
- package/legacy/models/gridApiCaches.js +1 -0
- package/legacy/models/params/gridMenuParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/locales/heIL.js +9 -9
- package/locales/jaJP.js +24 -24
- package/locales/nbNO.d.ts +2 -0
- package/locales/nbNO.js +115 -0
- package/locales/ruRU.js +9 -9
- package/locales/trTR.js +7 -7
- package/models/api/gridCallbackDetails.d.ts +6 -1
- package/models/api/gridCoreApi.d.ts +2 -6
- package/models/api/gridFilterApi.d.ts +8 -1
- package/models/api/gridRowsMetaApi.d.ts +24 -0
- package/models/api/gridStateApi.d.ts +14 -3
- package/models/colDef/gridColDef.d.ts +3 -3
- package/models/events/gridEventLookup.d.ts +16 -1
- package/models/events/gridEvents.d.ts +3 -1
- package/models/events/gridEvents.js +2 -0
- package/models/gridApiCaches.d.ts +6 -0
- package/models/gridApiCaches.js +1 -0
- package/models/gridIconSlotsComponent.d.ts +10 -0
- package/models/params/gridMenuParams.d.ts +7 -0
- package/models/params/gridMenuParams.js +1 -0
- package/models/params/gridRowParams.d.ts +1 -1
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +24 -2
- package/modern/DataGrid/DataGrid.js +26 -1
- package/modern/components/GridRow.js +51 -12
- package/modern/components/base/GridOverlays.js +1 -1
- package/modern/components/cell/GridCell.js +12 -7
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -3
- package/modern/components/containers/GridRoot.js +25 -3
- package/modern/components/containers/GridRootStyles.js +7 -2
- package/modern/components/menu/GridMenu.js +9 -2
- package/modern/components/panel/GridColumnsPanel.js +10 -2
- package/modern/components/panel/GridPanelWrapper.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/modern/components/panel/filterPanel/GridFilterPanel.js +25 -9
- package/modern/components/toolbar/GridToolbarQuickFilter.js +58 -6
- package/modern/constants/defaultGridSlotsComponents.js +4 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -9
- package/modern/hooks/core/useGridStateInitialization.js +19 -6
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/modern/hooks/features/columns/useGridColumns.js +12 -14
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +10 -3
- package/modern/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +9 -3
- package/modern/hooks/features/events/useGridEvents.js +2 -0
- package/modern/hooks/features/filter/gridFilterSelector.js +6 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -6
- package/modern/hooks/features/filter/useGridFilter.js +29 -12
- package/modern/hooks/features/pagination/useGridPage.js +1 -1
- package/modern/hooks/features/pagination/useGridPageSize.js +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +54 -0
- package/modern/hooks/features/rows/useGridRows.js +63 -102
- package/modern/hooks/features/rows/useGridRowsMeta.js +105 -37
- package/modern/hooks/features/selection/useGridSelection.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +27 -7
- package/modern/index.js +1 -1
- package/modern/locales/heIL.js +9 -9
- package/modern/locales/jaJP.js +24 -24
- package/modern/locales/nbNO.js +115 -0
- package/modern/locales/ruRU.js +9 -9
- package/modern/locales/trTR.js +7 -7
- package/modern/models/events/gridEvents.js +2 -0
- package/modern/models/gridApiCaches.js +1 -0
- package/modern/models/params/gridMenuParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/node/DataGrid/DataGrid.js +26 -1
- package/node/components/GridRow.js +53 -12
- package/node/components/base/GridOverlays.js +1 -1
- package/node/components/cell/GridCell.js +12 -7
- package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -3
- package/node/components/containers/GridRoot.js +24 -3
- package/node/components/containers/GridRootStyles.js +7 -2
- package/node/components/menu/GridMenu.js +10 -2
- package/node/components/panel/GridColumnsPanel.js +10 -2
- package/node/components/panel/GridPanelWrapper.js +5 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +91 -9
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +27 -9
- package/node/components/toolbar/GridToolbarQuickFilter.js +61 -6
- package/node/constants/defaultGridSlotsComponents.js +3 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -8
- package/node/hooks/core/useGridStateInitialization.js +19 -6
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +23 -0
- package/node/hooks/features/columns/useGridColumns.js +13 -15
- package/node/hooks/features/editRows/useGridCellEditing.new.js +11 -4
- package/node/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/node/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/node/hooks/features/events/useGridEvents.js +2 -0
- package/node/hooks/features/filter/gridFilterSelector.js +9 -2
- package/node/hooks/features/filter/gridFilterUtils.js +4 -5
- package/node/hooks/features/filter/useGridFilter.js +28 -11
- package/node/hooks/features/pagination/useGridPage.js +1 -1
- package/node/hooks/features/pagination/useGridPageSize.js +1 -1
- package/node/hooks/features/rows/gridRowsUtils.js +67 -1
- package/node/hooks/features/rows/useGridRows.js +63 -99
- package/node/hooks/features/rows/useGridRowsMeta.js +107 -43
- package/node/hooks/features/selection/useGridSelection.js +1 -1
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +27 -7
- package/node/index.js +1 -1
- package/node/locales/heIL.js +9 -9
- package/node/locales/jaJP.js +24 -24
- package/node/locales/nbNO.js +125 -0
- package/node/locales/ruRU.js +9 -9
- package/node/locales/trTR.js +7 -7
- package/node/models/events/gridEvents.js +2 -0
- package/node/models/gridApiCaches.js +5 -0
- package/node/models/params/gridMenuParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/package.json +7 -5
|
@@ -68,6 +68,7 @@ function GridColumnHeaderItem(props) {
|
|
|
68
68
|
hasScrollX: false,
|
|
69
69
|
hasScrollY: false
|
|
70
70
|
};
|
|
71
|
+
const isDraggable = React.useMemo(() => !rootProps.disableColumnReorder && !disableReorder && !column.disableReorder, [rootProps.disableColumnReorder, disableReorder, column.disableReorder]);
|
|
71
72
|
let headerComponent = null;
|
|
72
73
|
|
|
73
74
|
if (column.renderHeader) {
|
|
@@ -98,12 +99,12 @@ function GridColumnHeaderItem(props) {
|
|
|
98
99
|
onFocus: publish('columnHeaderFocus'),
|
|
99
100
|
onBlur: publish('columnHeaderBlur')
|
|
100
101
|
};
|
|
101
|
-
const draggableEventHandlers = {
|
|
102
|
+
const draggableEventHandlers = isDraggable ? {
|
|
102
103
|
onDragStart: publish('columnHeaderDragStart'),
|
|
103
104
|
onDragEnter: publish('columnHeaderDragEnter'),
|
|
104
105
|
onDragOver: publish('columnHeaderDragOver'),
|
|
105
106
|
onDragEnd: publish('columnHeaderDragEnd')
|
|
106
|
-
};
|
|
107
|
+
} : null;
|
|
107
108
|
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
108
109
|
const showRightBorder = !isLastColumn ? rootProps.showColumnRightBorder : !removeLastBorderRight && !extendRowFullWidth;
|
|
109
110
|
|
|
@@ -180,7 +181,7 @@ function GridColumnHeaderItem(props) {
|
|
|
180
181
|
}, mouseEventsHandlers, {
|
|
181
182
|
children: [/*#__PURE__*/_jsxs("div", _extends({
|
|
182
183
|
className: classes.draggableContainer,
|
|
183
|
-
draggable:
|
|
184
|
+
draggable: isDraggable
|
|
184
185
|
}, draggableEventHandlers, {
|
|
185
186
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
186
187
|
className: classes.titleContainer,
|
|
@@ -4,15 +4,30 @@ const _excluded = ["children", "className"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
7
|
+
import { useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, capitalize } from '@mui/material/utils';
|
|
8
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
8
9
|
import { GridRootStyles } from './GridRootStyles';
|
|
9
10
|
import { gridVisibleColumnDefinitionsSelector } from '../../hooks/features/columns/gridColumnsSelector';
|
|
10
11
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
11
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
12
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
|
-
import {
|
|
14
|
+
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
14
15
|
import { gridRowCountSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
16
|
+
import { gridDensityValueSelector } from '../../hooks/features/density/densitySelector';
|
|
15
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
|
|
19
|
+
const useUtilityClasses = ownerState => {
|
|
20
|
+
const {
|
|
21
|
+
autoHeight,
|
|
22
|
+
density,
|
|
23
|
+
classes
|
|
24
|
+
} = ownerState;
|
|
25
|
+
const slots = {
|
|
26
|
+
root: ['root', autoHeight && 'autoHeight', `root--density${capitalize(density)}`]
|
|
27
|
+
};
|
|
28
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
29
|
+
};
|
|
30
|
+
|
|
16
31
|
const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
17
32
|
const rootProps = useGridRootProps();
|
|
18
33
|
|
|
@@ -25,8 +40,15 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
25
40
|
const apiRef = useGridApiContext();
|
|
26
41
|
const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
27
42
|
const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
43
|
+
const densityValue = useGridSelector(apiRef, gridDensityValueSelector);
|
|
28
44
|
const rootContainerRef = React.useRef(null);
|
|
29
45
|
const handleRef = useForkRef(rootContainerRef, ref);
|
|
46
|
+
const ownerState = {
|
|
47
|
+
density: densityValue,
|
|
48
|
+
classes: rootProps.classes,
|
|
49
|
+
autoHeight: rootProps.autoHeight
|
|
50
|
+
};
|
|
51
|
+
const classes = useUtilityClasses(ownerState);
|
|
30
52
|
apiRef.current.rootElementRef = rootContainerRef; // Our implementation of <NoSsr />
|
|
31
53
|
|
|
32
54
|
const [mountedState, setMountedState] = React.useState(false);
|
|
@@ -45,7 +67,7 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
45
67
|
|
|
46
68
|
return /*#__PURE__*/_jsx(GridRootStyles, _extends({
|
|
47
69
|
ref: handleRef,
|
|
48
|
-
className: clsx(className,
|
|
70
|
+
className: clsx(className, classes.root),
|
|
49
71
|
role: "grid",
|
|
50
72
|
"aria-colcount": visibleColumns.length,
|
|
51
73
|
"aria-rowcount": totalRowCount,
|
|
@@ -221,6 +221,9 @@ export const GridRootStyles = styled('div', {
|
|
|
221
221
|
},
|
|
222
222
|
[`&.${gridClasses['columnSeparator--resizing']}`]: {
|
|
223
223
|
color: theme.palette.text.primary
|
|
224
|
+
},
|
|
225
|
+
'& svg': {
|
|
226
|
+
pointerEvents: 'none'
|
|
224
227
|
}
|
|
225
228
|
},
|
|
226
229
|
[`& .${gridClasses.iconSeparator}`]: {
|
|
@@ -274,10 +277,12 @@ export const GridRootStyles = styled('div', {
|
|
|
274
277
|
[`& .${gridClasses.cell}`]: {
|
|
275
278
|
display: 'flex',
|
|
276
279
|
alignItems: 'center',
|
|
277
|
-
overflow: 'hidden',
|
|
278
|
-
whiteSpace: 'nowrap',
|
|
279
280
|
borderBottom: `1px solid ${borderColor}`
|
|
280
281
|
},
|
|
282
|
+
[`& .${gridClasses.row}:not(.${gridClasses['row--dynamicHeight']}) > .${gridClasses.cell}`]: {
|
|
283
|
+
overflow: 'hidden',
|
|
284
|
+
whiteSpace: 'nowrap'
|
|
285
|
+
},
|
|
281
286
|
[`& .${gridClasses.cellContent}`]: {
|
|
282
287
|
overflow: 'hidden',
|
|
283
288
|
textOverflow: 'ellipsis'
|
|
@@ -13,6 +13,7 @@ import { styled } from '@mui/material/styles';
|
|
|
13
13
|
import { HTMLElementType } from '@mui/utils';
|
|
14
14
|
import { getDataGridUtilityClass, gridClasses } from '../../constants/gridClasses';
|
|
15
15
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
16
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
|
|
18
19
|
const useUtilityClasses = ownerState => {
|
|
@@ -54,6 +55,7 @@ const GridMenu = props => {
|
|
|
54
55
|
} = props,
|
|
55
56
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
56
57
|
|
|
58
|
+
const apiRef = useGridApiContext();
|
|
57
59
|
const prevTarget = React.useRef(target);
|
|
58
60
|
const prevOpen = React.useRef(open);
|
|
59
61
|
const rootProps = useGridRootProps();
|
|
@@ -64,11 +66,16 @@ const GridMenu = props => {
|
|
|
64
66
|
React.useEffect(() => {
|
|
65
67
|
if (prevOpen.current && prevTarget.current) {
|
|
66
68
|
prevTarget.current.focus();
|
|
67
|
-
}
|
|
69
|
+
} // Emit menuOpen or menuClose events
|
|
70
|
+
|
|
68
71
|
|
|
72
|
+
const eventName = open ? 'menuOpen' : 'menuClose';
|
|
73
|
+
apiRef.current.publishEvent(eventName, {
|
|
74
|
+
target
|
|
75
|
+
});
|
|
69
76
|
prevOpen.current = open;
|
|
70
77
|
prevTarget.current = target;
|
|
71
|
-
}, [open, target]);
|
|
78
|
+
}, [apiRef, open, target]);
|
|
72
79
|
|
|
73
80
|
const handleExited = popperOnExited => node => {
|
|
74
81
|
if (popperOnExited) {
|
|
@@ -74,8 +74,16 @@ export function GridColumnsPanel(props) {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const toggleAllColumns = React.useCallback(isVisible => {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (apiRef.current.unstable_caches.columns.isUsingColumnVisibilityModel) {
|
|
78
|
+
if (isVisible) {
|
|
79
|
+
return apiRef.current.setColumnVisibilityModel({});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
|
|
83
|
+
} // TODO v6: Remove
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
return apiRef.current.updateColumns(columns.map(col => {
|
|
79
87
|
if (col.hideable !== false) {
|
|
80
88
|
return {
|
|
81
89
|
field: col.field,
|
|
@@ -35,7 +35,7 @@ const GridPanelWrapperRoot = styled('div', {
|
|
|
35
35
|
|
|
36
36
|
const isEnabled = () => true;
|
|
37
37
|
|
|
38
|
-
function GridPanelWrapper(props) {
|
|
38
|
+
const GridPanelWrapper = /*#__PURE__*/React.forwardRef(function GridPanelWrapper(props, ref) {
|
|
39
39
|
const {
|
|
40
40
|
className
|
|
41
41
|
} = props,
|
|
@@ -51,10 +51,10 @@ function GridPanelWrapper(props) {
|
|
|
51
51
|
disableEnforceFocus: true,
|
|
52
52
|
isEnabled: isEnabled,
|
|
53
53
|
children: /*#__PURE__*/_jsx(GridPanelWrapperRoot, _extends({
|
|
54
|
+
ref: ref,
|
|
54
55
|
tabIndex: -1,
|
|
55
56
|
className: clsx(className, classes.root)
|
|
56
57
|
}, other))
|
|
57
58
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
59
|
+
});
|
|
60
60
|
export { GridPanelWrapper };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -102,8 +104,7 @@ const getLinkOperatorLocaleKey = linkOperator => {
|
|
|
102
104
|
const getColumnLabel = col => col.headerName || col.field;
|
|
103
105
|
|
|
104
106
|
const collator = new Intl.Collator();
|
|
105
|
-
|
|
106
|
-
function GridFilterForm(props) {
|
|
107
|
+
const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props, ref) {
|
|
107
108
|
const {
|
|
108
109
|
item,
|
|
109
110
|
hasMultipleFilters,
|
|
@@ -121,7 +122,9 @@ function GridFilterForm(props) {
|
|
|
121
122
|
operatorInputProps = {},
|
|
122
123
|
columnInputProps = {},
|
|
123
124
|
valueInputProps = {}
|
|
124
|
-
} = props
|
|
125
|
+
} = props,
|
|
126
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
127
|
+
|
|
125
128
|
const apiRef = useGridApiContext();
|
|
126
129
|
const filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
|
|
127
130
|
const columnSelectId = useId();
|
|
@@ -217,8 +220,10 @@ function GridFilterForm(props) {
|
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
}), [currentOperator]);
|
|
220
|
-
return /*#__PURE__*/_jsxs(GridFilterFormRoot, {
|
|
221
|
-
|
|
223
|
+
return /*#__PURE__*/_jsxs(GridFilterFormRoot, _extends({
|
|
224
|
+
ref: ref,
|
|
225
|
+
className: classes.root
|
|
226
|
+
}, other, {
|
|
222
227
|
children: [/*#__PURE__*/_jsx(FilterFormDeleteIcon, _extends({
|
|
223
228
|
variant: "standard",
|
|
224
229
|
as: rootProps.components.BaseFormControl
|
|
@@ -313,36 +318,111 @@ function GridFilterForm(props) {
|
|
|
313
318
|
focusElementRef: valueRef
|
|
314
319
|
}, currentOperator.InputComponentProps)) : null
|
|
315
320
|
}))]
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
|
|
321
|
+
}));
|
|
322
|
+
});
|
|
319
323
|
process.env.NODE_ENV !== "production" ? GridFilterForm.propTypes = {
|
|
320
324
|
// ----------------------------- Warning --------------------------------
|
|
321
325
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
322
326
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
323
327
|
// ----------------------------------------------------------------------
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Callback called when the operator, column field or value is changed.
|
|
331
|
+
* @param {GridFilterItem} item The updated [[GridFilterItem]].
|
|
332
|
+
*/
|
|
324
333
|
applyFilterChanges: PropTypes.func.isRequired,
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Callback called when the logic operator is changed.
|
|
337
|
+
* @param {GridLinkOperator} operator The new logic operator.
|
|
338
|
+
*/
|
|
325
339
|
applyMultiFilterOperatorChanges: PropTypes.func.isRequired,
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Props passed to the column input component.
|
|
343
|
+
* @default {}
|
|
344
|
+
*/
|
|
326
345
|
columnInputProps: PropTypes.any,
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Changes how the options in the columns selector should be ordered.
|
|
349
|
+
* If not specified, the order is derived from the `columns` prop.
|
|
350
|
+
*/
|
|
327
351
|
columnsSort: PropTypes.oneOf(['asc', 'desc']),
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Callback called when the delete button is clicked.
|
|
355
|
+
* @param {GridFilterItem} item The deleted [[GridFilterItem]].
|
|
356
|
+
*/
|
|
328
357
|
deleteFilter: PropTypes.func.isRequired,
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Props passed to the delete icon.
|
|
361
|
+
* @default {}
|
|
362
|
+
*/
|
|
329
363
|
deleteIconProps: PropTypes.any,
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* If `true`, disables the logic operator field but still renders it.
|
|
367
|
+
*/
|
|
330
368
|
disableMultiFilterOperator: PropTypes.bool,
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* A ref allowing to set imperative focus.
|
|
372
|
+
* It can be passed to the el
|
|
373
|
+
*/
|
|
331
374
|
focusElementRef: PropTypes
|
|
332
375
|
/* @typescript-to-proptypes-ignore */
|
|
333
376
|
.oneOfType([PropTypes.func, PropTypes.object]),
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* If `true`, the logic operator field is rendered.
|
|
380
|
+
* The field will be invisible if `showMultiFilterOperators` is also `true`.
|
|
381
|
+
*/
|
|
334
382
|
hasMultipleFilters: PropTypes.bool.isRequired,
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* The [[GridFilterItem]] representing this form.
|
|
386
|
+
*/
|
|
335
387
|
item: PropTypes.shape({
|
|
336
388
|
columnField: PropTypes.string.isRequired,
|
|
337
389
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
338
390
|
operatorValue: PropTypes.string,
|
|
339
391
|
value: PropTypes.any
|
|
340
392
|
}).isRequired,
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Props passed to the logic operator input component.
|
|
396
|
+
* @default {}
|
|
397
|
+
*/
|
|
341
398
|
linkOperatorInputProps: PropTypes.any,
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Sets the available logic operators.
|
|
402
|
+
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|
|
403
|
+
*/
|
|
342
404
|
linkOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* The current logic operator applied.
|
|
408
|
+
*/
|
|
343
409
|
multiFilterOperator: PropTypes.oneOf(['and', 'or']),
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Props passed to the operator input component.
|
|
413
|
+
* @default {}
|
|
414
|
+
*/
|
|
344
415
|
operatorInputProps: PropTypes.any,
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* If `true`, the logic operator field is visible.
|
|
419
|
+
*/
|
|
345
420
|
showMultiFilterOperators: PropTypes.bool,
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Props passed to the value input component.
|
|
424
|
+
* @default {}
|
|
425
|
+
*/
|
|
346
426
|
valueInputProps: PropTypes.any
|
|
347
427
|
} : void 0;
|
|
348
428
|
export { GridFilterForm };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["linkOperators", "columnsSort", "filterFormProps"];
|
|
3
|
+
const _excluded = ["linkOperators", "columnsSort", "filterFormProps", "children"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { GridLinkOperator } from '../../../models/gridFilterItem';
|
|
@@ -16,8 +16,7 @@ import { gridFilterModelSelector } from '../../../hooks/features/filter/gridFilt
|
|
|
16
16
|
import { gridFilterableColumnDefinitionsSelector } from '../../../hooks/features/columns/gridColumnsSelector';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
|
|
20
|
-
function GridFilterPanel(props) {
|
|
19
|
+
const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(props, ref) {
|
|
21
20
|
const apiRef = useGridApiContext();
|
|
22
21
|
const rootProps = useGridRootProps();
|
|
23
22
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
@@ -67,9 +66,7 @@ function GridFilterPanel(props) {
|
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
apiRef.current.
|
|
71
|
-
items: [...items, defaultItem]
|
|
72
|
-
}));
|
|
69
|
+
apiRef.current.upsertFilterItems([...items, defaultItem]);
|
|
73
70
|
};
|
|
74
71
|
|
|
75
72
|
const deleteFilter = React.useCallback(item => {
|
|
@@ -90,7 +87,9 @@ function GridFilterPanel(props) {
|
|
|
90
87
|
lastFilterRef.current.focus();
|
|
91
88
|
}
|
|
92
89
|
}, [items.length]);
|
|
93
|
-
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({
|
|
90
|
+
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({
|
|
91
|
+
ref: ref
|
|
92
|
+
}, other, {
|
|
94
93
|
children: [/*#__PURE__*/_jsx(GridPanelContent, {
|
|
95
94
|
children: items.map((item, index) => /*#__PURE__*/_jsx(GridFilterForm, _extends({
|
|
96
95
|
item: item,
|
|
@@ -115,14 +114,22 @@ function GridFilterPanel(props) {
|
|
|
115
114
|
}))
|
|
116
115
|
})]
|
|
117
116
|
}));
|
|
118
|
-
}
|
|
119
|
-
|
|
117
|
+
});
|
|
120
118
|
process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
121
119
|
// ----------------------------- Warning --------------------------------
|
|
122
120
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
123
121
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
124
122
|
// ----------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Changes how the options in the columns selector should be ordered.
|
|
126
|
+
* If not specified, the order is derived from the `columns` prop.
|
|
127
|
+
*/
|
|
125
128
|
columnsSort: PropTypes.oneOf(['asc', 'desc']),
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Props passed to each filter form.
|
|
132
|
+
*/
|
|
126
133
|
filterFormProps: PropTypes.shape({
|
|
127
134
|
columnInputProps: PropTypes.any,
|
|
128
135
|
columnsSort: PropTypes.oneOf(['asc', 'desc']),
|
|
@@ -131,7 +138,16 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
|
131
138
|
operatorInputProps: PropTypes.any,
|
|
132
139
|
valueInputProps: PropTypes.any
|
|
133
140
|
}),
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Sets the available logic operators.
|
|
144
|
+
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|
|
145
|
+
*/
|
|
134
146
|
linkOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
150
|
+
*/
|
|
135
151
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
136
152
|
} : void 0;
|
|
137
153
|
export { GridFilterPanel };
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["quickFilterParser", "debounceMs"];
|
|
3
|
+
const _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import TextField from '@mui/material/TextField';
|
|
7
|
-
import
|
|
7
|
+
import IconButton from '@mui/material/IconButton';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import { debounce } from '@mui/material/utils';
|
|
10
10
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
|
+
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
13
|
+
import { gridQuickFilterValuesSelector } from '../../hooks/features/filter';
|
|
14
|
+
import { isDeepEqual } from '../../utils/utils';
|
|
12
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
16
|
const GridToolbarQuickFilterRoot = styled(TextField, {
|
|
14
17
|
name: 'MuiDataGrid',
|
|
@@ -19,26 +22,53 @@ const GridToolbarQuickFilterRoot = styled(TextField, {
|
|
|
19
22
|
}) => ({
|
|
20
23
|
width: 'auto',
|
|
21
24
|
paddingBottom: theme.spacing(0.5),
|
|
22
|
-
'&
|
|
23
|
-
|
|
25
|
+
'& input': {
|
|
26
|
+
marginLeft: theme.spacing(0.5)
|
|
24
27
|
},
|
|
25
28
|
'& .MuiInput-underline:before': {
|
|
26
29
|
borderBottom: `1px solid ${theme.palette.divider}`
|
|
30
|
+
},
|
|
31
|
+
[`& input[type=search]::-ms-clear,
|
|
32
|
+
& input[type=search]::-ms-reveal`]: {
|
|
33
|
+
/* clears the 'X' icon from IE */
|
|
34
|
+
display: 'none',
|
|
35
|
+
width: 0,
|
|
36
|
+
height: 0
|
|
37
|
+
},
|
|
38
|
+
[`& input[type="search"]::-webkit-search-decoration,
|
|
39
|
+
& input[type="search"]::-webkit-search-cancel-button,
|
|
40
|
+
& input[type="search"]::-webkit-search-results-button,
|
|
41
|
+
& input[type="search"]::-webkit-search-results-decoration`]: {
|
|
42
|
+
/* clears the 'X' icon from Chrome */
|
|
43
|
+
display: 'none'
|
|
27
44
|
}
|
|
28
45
|
}));
|
|
29
46
|
|
|
30
47
|
const defaultSearchValueParser = searchText => searchText.split(' ').filter(word => word !== '');
|
|
31
48
|
|
|
49
|
+
const defaultSearchValueFormatter = values => values.join(' ');
|
|
50
|
+
|
|
32
51
|
function GridToolbarQuickFilter(props) {
|
|
33
52
|
const {
|
|
34
53
|
quickFilterParser = defaultSearchValueParser,
|
|
54
|
+
quickFilterFormatter = defaultSearchValueFormatter,
|
|
35
55
|
debounceMs = 500
|
|
36
56
|
} = props,
|
|
37
57
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
58
|
|
|
39
59
|
const apiRef = useGridApiContext();
|
|
40
60
|
const rootProps = useGridRootProps();
|
|
41
|
-
const
|
|
61
|
+
const quickFilterValues = useGridSelector(apiRef, gridQuickFilterValuesSelector);
|
|
62
|
+
const [searchValue, setSearchValue] = React.useState(() => quickFilterFormatter(quickFilterValues ?? []));
|
|
63
|
+
const [prevQuickFilterValues, setPrevQuickFilterValues] = React.useState(quickFilterValues);
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
if (!isDeepEqual(prevQuickFilterValues, quickFilterValues)) {
|
|
66
|
+
// The model of quick filter value has been updated
|
|
67
|
+
setPrevQuickFilterValues(quickFilterValues); // Update the input value if needed to match the new model
|
|
68
|
+
|
|
69
|
+
setSearchValue(prevSearchValue => isDeepEqual(quickFilterParser(prevSearchValue), quickFilterValues) ? prevSearchValue : quickFilterFormatter(quickFilterValues ?? []));
|
|
70
|
+
}
|
|
71
|
+
}, [prevQuickFilterValues, quickFilterValues, quickFilterFormatter, quickFilterParser]);
|
|
42
72
|
const updateSearchValue = React.useCallback(newSearchValue => {
|
|
43
73
|
apiRef.current.setQuickFilterValues(quickFilterParser(newSearchValue));
|
|
44
74
|
}, [apiRef, quickFilterParser]);
|
|
@@ -48,6 +78,10 @@ function GridToolbarQuickFilter(props) {
|
|
|
48
78
|
setSearchValue(newSearchValue);
|
|
49
79
|
debouncedUpdateSearchValue(newSearchValue);
|
|
50
80
|
}, [debouncedUpdateSearchValue]);
|
|
81
|
+
const handleSearchReset = React.useCallback(() => {
|
|
82
|
+
setSearchValue('');
|
|
83
|
+
updateSearchValue('');
|
|
84
|
+
}, [updateSearchValue]);
|
|
51
85
|
return /*#__PURE__*/_jsx(GridToolbarQuickFilterRoot, _extends({
|
|
52
86
|
as: rootProps.components.BaseTextField,
|
|
53
87
|
variant: "standard",
|
|
@@ -57,8 +91,19 @@ function GridToolbarQuickFilter(props) {
|
|
|
57
91
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
58
92
|
type: "search",
|
|
59
93
|
InputProps: {
|
|
60
|
-
startAdornment: /*#__PURE__*/_jsx(
|
|
94
|
+
startAdornment: /*#__PURE__*/_jsx(rootProps.components.QuickFilterIcon, {
|
|
61
95
|
fontSize: "small"
|
|
96
|
+
}),
|
|
97
|
+
endAdornment: /*#__PURE__*/_jsx(IconButton, {
|
|
98
|
+
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
99
|
+
size: "small",
|
|
100
|
+
sx: {
|
|
101
|
+
visibility: searchValue ? 'visible' : 'hidden'
|
|
102
|
+
},
|
|
103
|
+
onClick: handleSearchReset,
|
|
104
|
+
children: /*#__PURE__*/_jsx(rootProps.components.QuickFilterClearIcon, {
|
|
105
|
+
fontSize: "small"
|
|
106
|
+
})
|
|
62
107
|
})
|
|
63
108
|
}
|
|
64
109
|
}, other, rootProps.componentsProps?.baseTextField));
|
|
@@ -76,6 +121,13 @@ process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|
|
|
76
121
|
*/
|
|
77
122
|
debounceMs: PropTypes.number,
|
|
78
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Function responsible for formatting values of quick filter in a string when the model is modified
|
|
126
|
+
* @param {any[]} values The new values passed to the quick filter model
|
|
127
|
+
* @returns {string} The string to display in the text field
|
|
128
|
+
*/
|
|
129
|
+
quickFilterFormatter: PropTypes.func,
|
|
130
|
+
|
|
79
131
|
/**
|
|
80
132
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
81
133
|
* @param {string} input The value entered by the user
|
|
@@ -7,7 +7,7 @@ import MUISwitch from '@mui/material/Switch';
|
|
|
7
7
|
import MUIButton from '@mui/material/Button';
|
|
8
8
|
import MUITooltip from '@mui/material/Tooltip';
|
|
9
9
|
import MUIPopper from '@mui/material/Popper';
|
|
10
|
-
import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon, GridDragIcon, GridColumnHeaderFilterIconButton } from '../components';
|
|
10
|
+
import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon, GridDragIcon, GridColumnHeaderFilterIconButton, GridSearchIcon } from '../components';
|
|
11
11
|
import { GridColumnUnsortedIcon } from '../components/columnHeaders/GridColumnUnsortedIcon';
|
|
12
12
|
import { ErrorOverlay } from '../components/ErrorOverlay';
|
|
13
13
|
import { GridNoResultsOverlay } from '../components/GridNoResultsOverlay';
|
|
@@ -34,7 +34,9 @@ const DEFAULT_GRID_ICON_SLOTS_COMPONENTS = {
|
|
|
34
34
|
GroupingCriteriaExpandIcon: GridKeyboardArrowRight,
|
|
35
35
|
DetailPanelExpandIcon: GridAddIcon,
|
|
36
36
|
DetailPanelCollapseIcon: GridRemoveIcon,
|
|
37
|
-
RowReorderIcon: GridDragIcon
|
|
37
|
+
RowReorderIcon: GridDragIcon,
|
|
38
|
+
QuickFilterIcon: GridSearchIcon,
|
|
39
|
+
QuickFilterClearIcon: GridCloseIcon
|
|
38
40
|
};
|
|
39
41
|
/**
|
|
40
42
|
* TODO: Differentiate community and pro value and interface
|
|
@@ -2,4 +2,4 @@ import { generateUtilityClasses, generateUtilityClass } from '@mui/material';
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|
|
@@ -46,30 +46,27 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
46
46
|
const registerPipeProcessor = React.useCallback((group, id, processor) => {
|
|
47
47
|
if (!processorsCache.current[group]) {
|
|
48
48
|
processorsCache.current[group] = {
|
|
49
|
-
processors:
|
|
49
|
+
processors: new Map(),
|
|
50
50
|
appliers: {}
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const groupCache = processorsCache.current[group];
|
|
55
|
-
const oldProcessor = groupCache.processors
|
|
55
|
+
const oldProcessor = groupCache.processors.get(id);
|
|
56
56
|
|
|
57
57
|
if (oldProcessor !== processor) {
|
|
58
|
-
groupCache.processors
|
|
58
|
+
groupCache.processors.set(id, processor);
|
|
59
59
|
runAppliers(groupCache);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return () => {
|
|
63
|
-
|
|
64
|
-
otherProcessors = _objectWithoutPropertiesLoose(_processors, [id].map(_toPropertyKey));
|
|
65
|
-
|
|
66
|
-
processorsCache.current[group].processors = otherProcessors;
|
|
63
|
+
processorsCache.current[group].processors.set(id, null);
|
|
67
64
|
};
|
|
68
65
|
}, [runAppliers]);
|
|
69
66
|
const registerPipeApplier = React.useCallback((group, id, applier) => {
|
|
70
67
|
if (!processorsCache.current[group]) {
|
|
71
68
|
processorsCache.current[group] = {
|
|
72
|
-
processors:
|
|
69
|
+
processors: new Map(),
|
|
73
70
|
appliers: {}
|
|
74
71
|
};
|
|
75
72
|
}
|
|
@@ -93,8 +90,12 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
93
90
|
return value;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
const preProcessors =
|
|
93
|
+
const preProcessors = Array.from(processorsCache.current[group].processors.values());
|
|
97
94
|
return preProcessors.reduce((acc, preProcessor) => {
|
|
95
|
+
if (!preProcessor) {
|
|
96
|
+
return acc;
|
|
97
|
+
}
|
|
98
|
+
|
|
98
99
|
return preProcessor(acc, context);
|
|
99
100
|
}, value);
|
|
100
101
|
}, []);
|