@mui/x-data-grid 8.10.1 → 8.11.0
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 +221 -8
- package/DataGrid/DataGrid.js +4 -2
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/DataGrid/useDataGridComponent.js +2 -2
- package/colDef/gridDateColDef.js +7 -0
- package/components/GridColumnSortButton.js +1 -2
- package/components/GridColumnUnsortedIcon.d.ts +2 -3
- package/components/GridRow.js +11 -5
- package/components/cell/GridActionsCell.js +8 -4
- package/components/columnHeaders/GridColumnGroupHeader.js +13 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +17 -4
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
- package/components/columnsManagement/GridColumnsManagement.js +7 -2
- package/components/containers/GridRootStyles.js +24 -6
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -9
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +4 -10
- package/components/virtualization/GridVirtualScrollerRenderZone.js +3 -10
- package/esm/DataGrid/DataGrid.js +4 -2
- package/esm/DataGrid/useDataGridComponent.d.ts +2 -1
- package/esm/DataGrid/useDataGridComponent.js +2 -2
- package/esm/colDef/gridDateColDef.js +7 -0
- package/esm/components/GridColumnSortButton.js +1 -2
- package/esm/components/GridColumnUnsortedIcon.d.ts +2 -3
- package/esm/components/GridRow.js +12 -6
- package/esm/components/cell/GridActionsCell.js +8 -4
- package/esm/components/columnHeaders/GridColumnGroupHeader.js +13 -1
- package/esm/components/columnHeaders/GridColumnHeaderItem.js +17 -4
- package/esm/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
- package/esm/components/columnsManagement/GridColumnsManagement.js +6 -1
- package/esm/components/containers/GridRootStyles.js +24 -6
- package/esm/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -2
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
- package/esm/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -9
- package/esm/components/panel/filterPanel/GridFilterInputSingleSelect.js +4 -10
- package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +3 -10
- package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +15 -0
- package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
- package/esm/hooks/features/filter/gridFilterSelector.d.ts +9 -1
- package/esm/hooks/features/filter/gridFilterSelector.js +12 -0
- package/esm/hooks/features/filter/gridFilterUtils.js +11 -2
- package/esm/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/esm/hooks/features/rows/useGridRows.d.ts +2 -1
- package/esm/hooks/features/rows/useGridRows.js +6 -34
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +6 -0
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +43 -0
- package/esm/hooks/features/scroll/useGridScroll.js +1 -1
- package/esm/hooks/utils/useGridConfiguration.d.ts +3 -1
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +2 -1
- package/esm/internals/index.js +2 -1
- package/esm/locales/fiFI.js +6 -6
- package/esm/material/index.js +2 -0
- package/esm/models/api/gridParamsApi.d.ts +3 -3
- package/esm/models/colDef/gridColDef.d.ts +4 -2
- package/esm/models/configuration/gridConfiguration.d.ts +6 -4
- package/esm/models/configuration/gridRowConfiguration.d.ts +11 -1
- package/esm/models/gridIconSlotsComponent.d.ts +6 -0
- package/esm/models/props/DataGridProps.d.ts +1 -1
- package/esm/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -2
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +15 -0
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +9 -1
- package/hooks/features/filter/gridFilterSelector.js +13 -1
- package/hooks/features/filter/gridFilterUtils.js +10 -1
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/rows/useGridRows.d.ts +2 -1
- package/hooks/features/rows/useGridRows.js +6 -34
- package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +6 -0
- package/hooks/features/rows/useGridRowsOverridableMethods.js +52 -0
- package/hooks/features/scroll/useGridScroll.js +1 -1
- package/hooks/utils/useGridConfiguration.d.ts +3 -1
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +15 -0
- package/locales/fiFI.js +6 -6
- package/material/index.js +2 -0
- package/models/api/gridParamsApi.d.ts +3 -3
- package/models/colDef/gridColDef.d.ts +4 -2
- package/models/configuration/gridConfiguration.d.ts +6 -4
- package/models/configuration/gridRowConfiguration.d.ts +11 -1
- package/models/gridIconSlotsComponent.d.ts +6 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/package.json +3 -3
- package/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -2
|
@@ -547,6 +547,11 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
547
547
|
opacity: 0.5
|
|
548
548
|
}
|
|
549
549
|
},
|
|
550
|
+
// Hide the column separator when the column has border and it is not resizable
|
|
551
|
+
// In this case, this column separator may block interaction with the separator from the adjacent column that is resizable
|
|
552
|
+
[`& .${_gridClasses.gridClasses['columnHeader--withLeftBorder']} .${_gridClasses.gridClasses['columnSeparator--sideLeft']}:not(.${_gridClasses.gridClasses['columnSeparator--resizable']}), & .${_gridClasses.gridClasses['columnHeader--withRightBorder']} .${_gridClasses.gridClasses['columnSeparator--sideRight']}:not(.${_gridClasses.gridClasses['columnSeparator--resizable']})`]: {
|
|
553
|
+
display: 'none'
|
|
554
|
+
},
|
|
550
555
|
[`& .${_gridClasses.gridClasses['columnSeparator--sideLeft']}`]: {
|
|
551
556
|
left: columnSeparatorOffset
|
|
552
557
|
},
|
|
@@ -689,6 +694,11 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
689
694
|
outlineOffset: focusOutlineWidth * -1
|
|
690
695
|
}
|
|
691
696
|
},
|
|
697
|
+
[`& .${_gridClasses.gridClasses['cell--editing']}`]: {
|
|
698
|
+
'& .MuiInputBase-root': {
|
|
699
|
+
height: '100%'
|
|
700
|
+
}
|
|
701
|
+
},
|
|
692
702
|
[`& .${_gridClasses.gridClasses['row--editing']}`]: {
|
|
693
703
|
boxShadow: _cssVariables.vars.shadows.base
|
|
694
704
|
},
|
|
@@ -791,7 +801,7 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
791
801
|
[`& .${_gridClasses.gridClasses.rowReorderCellPlaceholder}`]: {
|
|
792
802
|
display: 'none'
|
|
793
803
|
},
|
|
794
|
-
[`& .${_gridClasses.gridClasses['columnHeader--dragging']}
|
|
804
|
+
[`& .${_gridClasses.gridClasses['columnHeader--dragging']}`]: {
|
|
795
805
|
background: _cssVariables.vars.colors.background.overlay,
|
|
796
806
|
padding: '0 12px',
|
|
797
807
|
borderRadius: 'var(--unstable_DataGrid-radius)',
|
|
@@ -801,8 +811,11 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
801
811
|
background: _cssVariables.vars.colors.background.overlay,
|
|
802
812
|
padding: '0 12px',
|
|
803
813
|
borderRadius: 'var(--unstable_DataGrid-radius)',
|
|
804
|
-
|
|
814
|
+
border: '1px solid var(--DataGrid-rowBorderColor)',
|
|
815
|
+
color: _cssVariables.vars.colors.foreground.base,
|
|
816
|
+
transform: 'translateZ(0)',
|
|
805
817
|
[`& .${_gridClasses.gridClasses.rowReorderCellPlaceholder}`]: {
|
|
818
|
+
padding: '0 6px',
|
|
806
819
|
display: 'flex'
|
|
807
820
|
}
|
|
808
821
|
},
|
|
@@ -878,6 +891,7 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
878
891
|
[`& .${_gridClasses.gridClasses['row--dropAbove']}`]: {
|
|
879
892
|
position: 'relative',
|
|
880
893
|
'&::before': {
|
|
894
|
+
pointerEvents: 'none',
|
|
881
895
|
content: '""',
|
|
882
896
|
position: 'absolute',
|
|
883
897
|
top: 0,
|
|
@@ -889,7 +903,9 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
889
903
|
},
|
|
890
904
|
[`& .${_gridClasses.gridClasses['row--dropBelow']}`]: {
|
|
891
905
|
position: 'relative',
|
|
892
|
-
'&::
|
|
906
|
+
'&::after': {
|
|
907
|
+
zIndex: 100,
|
|
908
|
+
pointerEvents: 'none',
|
|
893
909
|
content: '""',
|
|
894
910
|
position: 'absolute',
|
|
895
911
|
bottom: '-2px',
|
|
@@ -899,14 +915,16 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
899
915
|
backgroundColor: _cssVariables.vars.colors.interactive.selected
|
|
900
916
|
},
|
|
901
917
|
[`&.${_gridClasses.gridClasses['row--lastVisible']}`]: {
|
|
902
|
-
'&::
|
|
918
|
+
'&::after': {
|
|
903
919
|
bottom: 'calc(var(--DataGrid-hasScrollY) * 0px + (1 - var(--DataGrid-hasScrollY)) * -2px)'
|
|
904
920
|
}
|
|
905
921
|
}
|
|
906
922
|
},
|
|
907
923
|
[`& .${_gridClasses.gridClasses['row--beingDragged']}`]: {
|
|
908
|
-
|
|
909
|
-
|
|
924
|
+
color: _cssVariables.vars.colors.foreground.disabled,
|
|
925
|
+
'&:hover': {
|
|
926
|
+
backgroundColor: 'transparent'
|
|
927
|
+
}
|
|
910
928
|
}
|
|
911
929
|
};
|
|
912
930
|
return gridStyle;
|
|
@@ -32,8 +32,9 @@ function GridColumnMenuSortItem(props) {
|
|
|
32
32
|
const onSortMenuItemClick = React.useCallback(event => {
|
|
33
33
|
onClick(event);
|
|
34
34
|
const direction = event.currentTarget.getAttribute('data-value') || null;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const allowMultipleSorting = rootProps.multipleColumnsSortingMode === 'always';
|
|
36
|
+
apiRef.current.sortColumn(colDef.field, direction === sortDirection ? null : direction, allowMultipleSorting);
|
|
37
|
+
}, [apiRef, colDef, onClick, sortDirection, rootProps.multipleColumnsSortingMode]);
|
|
37
38
|
if (rootProps.disableColumnSorting || !colDef || !colDef.sortable || !sortingOrder.some(item => !!item)) {
|
|
38
39
|
return null;
|
|
39
40
|
}
|
|
@@ -5,7 +5,7 @@ import type { ValueOptions } from "../../../models/colDef/gridColDef.js";
|
|
|
5
5
|
export type GridFilterInputMultipleSingleSelectProps = GridFilterInputValueProps<Omit<AutocompleteProps<ValueOptions, true, false, true>, 'options'>> & {
|
|
6
6
|
type?: 'singleSelect';
|
|
7
7
|
};
|
|
8
|
-
declare function GridFilterInputMultipleSingleSelect(props: GridFilterInputMultipleSingleSelectProps): React.JSX.Element;
|
|
8
|
+
declare function GridFilterInputMultipleSingleSelect(props: GridFilterInputMultipleSingleSelectProps): React.JSX.Element | null;
|
|
9
9
|
declare namespace GridFilterInputMultipleSingleSelect {
|
|
10
10
|
var propTypes: any;
|
|
11
11
|
}
|
|
@@ -27,15 +27,9 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
27
27
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
28
28
|
const id = (0, _useId.default)();
|
|
29
29
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if ((0, _filterPanelUtils.isSingleSelectColDef)(column)) {
|
|
34
|
-
resolvedColumn = column;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const getOptionValue = resolvedColumn?.getOptionValue;
|
|
38
|
-
const getOptionLabel = resolvedColumn?.getOptionLabel;
|
|
30
|
+
const resolvedColumn = apiRef.current.getColumn(item.field);
|
|
31
|
+
const getOptionValue = resolvedColumn.getOptionValue;
|
|
32
|
+
const getOptionLabel = resolvedColumn.getOptionLabel;
|
|
39
33
|
const isOptionEqualToValue = React.useCallback((option, value) => getOptionValue(option) === getOptionValue(value), [getOptionValue]);
|
|
40
34
|
const resolvedValueOptions = React.useMemo(() => {
|
|
41
35
|
return (0, _filterPanelUtils.getValueOptions)(resolvedColumn) || [];
|
|
@@ -60,6 +54,9 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
60
54
|
value: value.map(getOptionValue)
|
|
61
55
|
}));
|
|
62
56
|
}, [applyValue, item, getOptionValue]);
|
|
57
|
+
if (!resolvedColumn || !(0, _filterPanelUtils.isSingleSelectColDef)(resolvedColumn)) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
63
60
|
const BaseAutocomplete = rootProps.slots.baseAutocomplete;
|
|
64
61
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BaseAutocomplete, (0, _extends2.default)({
|
|
65
62
|
multiple: true,
|
|
@@ -56,15 +56,9 @@ function GridFilterInputSingleSelect(props) {
|
|
|
56
56
|
const labelId = (0, _useId.default)();
|
|
57
57
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
58
58
|
const isSelectNative = rootProps.slotProps?.baseSelect?.native ?? false;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if ((0, _filterPanelUtils.isSingleSelectColDef)(column)) {
|
|
63
|
-
resolvedColumn = column;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const getOptionValue = resolvedColumn?.getOptionValue;
|
|
67
|
-
const getOptionLabel = resolvedColumn?.getOptionLabel;
|
|
59
|
+
const resolvedColumn = apiRef.current.getColumn(item.field);
|
|
60
|
+
const getOptionValue = resolvedColumn.getOptionValue;
|
|
61
|
+
const getOptionLabel = resolvedColumn.getOptionLabel;
|
|
68
62
|
const currentValueOptions = React.useMemo(() => {
|
|
69
63
|
return (0, _filterPanelUtils.getValueOptions)(resolvedColumn);
|
|
70
64
|
}, [resolvedColumn]);
|
|
@@ -77,7 +71,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
77
71
|
value
|
|
78
72
|
}));
|
|
79
73
|
}, [currentValueOptions, getOptionValue, applyValue, item]);
|
|
80
|
-
if (!(0, _filterPanelUtils.isSingleSelectColDef)(resolvedColumn)) {
|
|
74
|
+
if (!resolvedColumn || !(0, _filterPanelUtils.isSingleSelectColDef)(resolvedColumn)) {
|
|
81
75
|
return null;
|
|
82
76
|
}
|
|
83
77
|
const label = slotProps?.root.label ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
@@ -13,10 +13,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
13
13
|
var _system = require("@mui/system");
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
15
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
|
-
var
|
|
17
|
-
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
18
|
-
var _rows = require("../../hooks/features/rows");
|
|
19
|
-
var _virtualization = require("../../hooks/features/virtualization");
|
|
16
|
+
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
20
17
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
21
18
|
var _gridClasses = require("../../constants/gridClasses");
|
|
22
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -44,14 +41,10 @@ const GridVirtualScrollerRenderZone = exports.GridVirtualScrollerRenderZone = (0
|
|
|
44
41
|
className
|
|
45
42
|
} = props,
|
|
46
43
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
47
|
-
const apiRef = (0,
|
|
44
|
+
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
48
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
49
46
|
const classes = useUtilityClasses(rootProps);
|
|
50
|
-
const offsetTop = (
|
|
51
|
-
const renderContext = (0, _virtualization.gridRenderContextSelector)(apiRef);
|
|
52
|
-
const rowsMeta = (0, _rows.gridRowsMetaSelector)(apiRef);
|
|
53
|
-
return rowsMeta.positions[renderContext.firstRowIndex] ?? 0;
|
|
54
|
-
});
|
|
47
|
+
const offsetTop = apiRef.current.virtualizer.api.useVirtualization().getters.getOffsetTop();
|
|
55
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerRenderZoneRoot, (0, _extends2.default)({
|
|
56
49
|
className: (0, _clsx.default)(classes.root, className),
|
|
57
50
|
ownerState: rootProps,
|
package/esm/DataGrid/DataGrid.js
CHANGED
|
@@ -7,6 +7,7 @@ import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
|
7
7
|
import { GridRoot } from "../components/index.js";
|
|
8
8
|
import { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
|
|
9
9
|
import { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
10
|
+
import { useGridRowsOverridableMethods } from "../hooks/features/rows/useGridRowsOverridableMethods.js";
|
|
10
11
|
import { GridContextProvider } from "../context/GridContextProvider.js";
|
|
11
12
|
import { useDataGridComponent } from "./useDataGridComponent.js";
|
|
12
13
|
import { useDataGridProps } from "./useDataGridProps.js";
|
|
@@ -19,13 +20,14 @@ const configuration = {
|
|
|
19
20
|
useCSSVariables: useMaterialCSSVariables,
|
|
20
21
|
useGridAriaAttributes,
|
|
21
22
|
useGridRowAriaAttributes,
|
|
23
|
+
useGridRowsOverridableMethods,
|
|
22
24
|
useCellAggregationResult: () => null
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
27
|
const DataGridRaw = function DataGrid(inProps, ref) {
|
|
26
28
|
const props = useDataGridProps(inProps);
|
|
27
29
|
const privateApiRef = useGridApiInitialization(props.apiRef, props);
|
|
28
|
-
useDataGridComponent(privateApiRef, props);
|
|
30
|
+
useDataGridComponent(privateApiRef, props, configuration);
|
|
29
31
|
if (process.env.NODE_ENV !== 'production') {
|
|
30
32
|
validateProps(props, propValidatorsDataGrid);
|
|
31
33
|
}
|
|
@@ -580,7 +582,7 @@ DataGridRaw.propTypes = {
|
|
|
580
582
|
*/
|
|
581
583
|
onPreferencePanelOpen: PropTypes.func,
|
|
582
584
|
/**
|
|
583
|
-
* Callback called when `processRowUpdate` throws an error or rejects.
|
|
585
|
+
* Callback called when `processRowUpdate()` throws an error or rejects.
|
|
584
586
|
* @param {any} error The error thrown.
|
|
585
587
|
*/
|
|
586
588
|
onProcessRowUpdateError: PropTypes.func,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { DataGridProcessedProps } from "../models/props/DataGridProps.js";
|
|
3
3
|
import { GridPrivateApiCommunity } from "../models/api/gridApiCommunity.js";
|
|
4
|
-
|
|
4
|
+
import { GridConfiguration } from "../models/configuration/gridConfiguration.js";
|
|
5
|
+
export declare const useDataGridComponent: (apiRef: RefObject<GridPrivateApiCommunity>, props: DataGridProcessedProps, configuration: GridConfiguration) => void;
|
|
@@ -35,7 +35,7 @@ import { rowSpanningStateInitializer, useGridRowSpanning } from "../hooks/featur
|
|
|
35
35
|
import { listViewStateInitializer, useGridListView } from "../hooks/features/listView/useGridListView.js";
|
|
36
36
|
import { propsStateInitializer } from "../hooks/core/useGridProps.js";
|
|
37
37
|
import { useGridDataSource } from "../hooks/features/dataSource/useGridDataSource.js";
|
|
38
|
-
export const useDataGridComponent = (apiRef, props) => {
|
|
38
|
+
export const useDataGridComponent = (apiRef, props, configuration) => {
|
|
39
39
|
useGridInitialization(apiRef, props);
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -70,7 +70,7 @@ export const useDataGridComponent = (apiRef, props) => {
|
|
|
70
70
|
useGridKeyboardNavigation(apiRef, props);
|
|
71
71
|
useGridRowSelection(apiRef, props);
|
|
72
72
|
useGridColumns(apiRef, props);
|
|
73
|
-
useGridRows(apiRef, props);
|
|
73
|
+
useGridRows(apiRef, props, configuration);
|
|
74
74
|
useGridRowSpanning(apiRef, props);
|
|
75
75
|
useGridParamsApi(apiRef, props);
|
|
76
76
|
useGridColumnSpanning(apiRef);
|
|
@@ -4,6 +4,7 @@ import { getGridDateOperators } from "./gridDateOperators.js";
|
|
|
4
4
|
import { GRID_STRING_COL_DEF } from "./gridStringColDef.js";
|
|
5
5
|
import { renderEditDateCell } from "../components/cell/GridEditDateCell.js";
|
|
6
6
|
import { gridRowIdSelector } from "../hooks/core/gridPropsSelectors.js";
|
|
7
|
+
import { isAutogeneratedRow } from "../hooks/features/rows/gridRowsUtils.js";
|
|
7
8
|
function throwIfNotDateObject({
|
|
8
9
|
value,
|
|
9
10
|
columnType,
|
|
@@ -19,6 +20,9 @@ export const gridDateFormatter = (value, row, column, apiRef) => {
|
|
|
19
20
|
return '';
|
|
20
21
|
}
|
|
21
22
|
const rowId = gridRowIdSelector(apiRef, row);
|
|
23
|
+
if (isAutogeneratedRow(row) && !(value instanceof Date)) {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
22
26
|
throwIfNotDateObject({
|
|
23
27
|
value,
|
|
24
28
|
columnType: 'date',
|
|
@@ -32,6 +36,9 @@ export const gridDateTimeFormatter = (value, row, column, apiRef) => {
|
|
|
32
36
|
return '';
|
|
33
37
|
}
|
|
34
38
|
const rowId = gridRowIdSelector(apiRef, row);
|
|
39
|
+
if (isAutogeneratedRow(row) && !(value instanceof Date)) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
35
42
|
throwIfNotDateObject({
|
|
36
43
|
value,
|
|
37
44
|
columnType: 'dateTime',
|
|
@@ -10,7 +10,6 @@ import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
|
10
10
|
import { getDataGridUtilityClass } from "../constants/gridClasses.js";
|
|
11
11
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
12
12
|
import { vars } from "../constants/cssVariables.js";
|
|
13
|
-
import { GridColumnUnsortedIcon } from "./GridColumnUnsortedIcon.js";
|
|
14
13
|
import { NotRendered } from "../utils/assert.js";
|
|
15
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
15
|
const useUtilityClasses = ownerState => {
|
|
@@ -40,7 +39,7 @@ function getIcon(icons, direction, className, sortingOrder) {
|
|
|
40
39
|
} else if (direction === 'desc') {
|
|
41
40
|
Icon = icons.columnSortedDescendingIcon;
|
|
42
41
|
} else {
|
|
43
|
-
Icon =
|
|
42
|
+
Icon = icons.columnUnsortedIcon;
|
|
44
43
|
iconProps.sortingOrder = sortingOrder;
|
|
45
44
|
}
|
|
46
45
|
return Icon ? /*#__PURE__*/_jsx(Icon, _extends({
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridBaseIconProps } from "../models/gridSlotsComponentsProps.js";
|
|
3
3
|
import { GridSortDirection } from "../models/gridSortModel.js";
|
|
4
|
-
interface GridColumnUnsortedIconProps extends GridBaseIconProps {
|
|
4
|
+
export interface GridColumnUnsortedIconProps extends GridBaseIconProps {
|
|
5
5
|
sortingOrder: GridSortDirection[];
|
|
6
6
|
}
|
|
7
|
-
export declare const GridColumnUnsortedIcon: React.NamedExoticComponent<GridColumnUnsortedIconProps>;
|
|
8
|
-
export {};
|
|
7
|
+
export declare const GridColumnUnsortedIcon: React.NamedExoticComponent<GridColumnUnsortedIconProps>;
|
|
@@ -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 {
|
|
26
|
+
import { gridRowNodeSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
27
27
|
import { gridEditRowsStateSelector, gridRowIsEditingSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
28
28
|
import { gridIsRowDragActiveSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
|
|
29
29
|
import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFillerCell.js";
|
|
@@ -32,8 +32,11 @@ import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
|
|
|
32
32
|
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
33
33
|
import { createSelector } from "../utils/createSelector.js";
|
|
34
34
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
|
-
const isRowReorderingEnabledSelector = createSelector(gridEditRowsStateSelector, (editRows,
|
|
36
|
-
|
|
35
|
+
const isRowReorderingEnabledSelector = createSelector(gridEditRowsStateSelector, (editRows, {
|
|
36
|
+
rowReordering,
|
|
37
|
+
treeData
|
|
38
|
+
}) => {
|
|
39
|
+
if (!rowReordering || treeData) {
|
|
37
40
|
return false;
|
|
38
41
|
}
|
|
39
42
|
const isEditingRows = !isObjectEmpty(editRows);
|
|
@@ -75,10 +78,13 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
75
78
|
const rootProps = useGridRootProps();
|
|
76
79
|
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
77
80
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
78
|
-
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
79
81
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
80
82
|
const rowReordering = rootProps.rowReordering;
|
|
81
|
-
const
|
|
83
|
+
const treeData = rootProps.treeData;
|
|
84
|
+
const isRowReorderingEnabled = useGridSelector(apiRef, isRowReorderingEnabledSelector, {
|
|
85
|
+
rowReordering,
|
|
86
|
+
treeData
|
|
87
|
+
});
|
|
82
88
|
const isRowDragActive = useGridSelector(apiRef, gridIsRowDragActiveSelector);
|
|
83
89
|
const handleRef = useForkRef(ref, refProp);
|
|
84
90
|
const rowNode = gridRowNodeSelector(apiRef, rowId);
|
|
@@ -231,7 +237,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
231
237
|
// fixes https://github.com/mui/mui-x/issues/11126
|
|
232
238
|
const isReorderCell = column.field === '__reorder__';
|
|
233
239
|
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
234
|
-
const canReorderRow = isRowReorderingEnabled && !sortModel.length
|
|
240
|
+
const canReorderRow = isRowReorderingEnabled && !sortModel.length;
|
|
235
241
|
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow || isRowDragActive);
|
|
236
242
|
const cellIsNotVisible = pinnedPosition === PinnedColumnPosition.VIRTUAL;
|
|
237
243
|
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
@@ -141,13 +141,17 @@ function GridActionsCell(props) {
|
|
|
141
141
|
setFocusedButtonIndex(newIndex);
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
+
|
|
145
|
+
// role="menu" requires at least one child element
|
|
146
|
+
const attributes = numberOfButtons > 0 ? {
|
|
147
|
+
role: 'menu',
|
|
148
|
+
onKeyDown: handleRootKeyDown
|
|
149
|
+
} : undefined;
|
|
144
150
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
145
|
-
role: "menu",
|
|
146
151
|
ref: rootRef,
|
|
147
152
|
tabIndex: -1,
|
|
148
|
-
className: gridClasses.actionsCell
|
|
149
|
-
|
|
150
|
-
}, other, {
|
|
153
|
+
className: gridClasses.actionsCell
|
|
154
|
+
}, attributes, other, {
|
|
151
155
|
children: [iconButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
152
156
|
key: index,
|
|
153
157
|
touchRippleRef: handleTouchRippleRef(index),
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import useId from '@mui/utils/useId';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
|
+
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
8
9
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
9
10
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
10
11
|
import { gridColumnGroupsLookupSelector } from "../../hooks/features/columnGrouping/gridColumnGroupsSelector.js";
|
|
@@ -89,7 +90,18 @@ function GridColumnGroupHeader(props) {
|
|
|
89
90
|
if (hasFocus) {
|
|
90
91
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
91
92
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
92
|
-
elementToFocus
|
|
93
|
+
if (!elementToFocus) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (doesSupportPreventScroll()) {
|
|
97
|
+
elementToFocus.focus({
|
|
98
|
+
preventScroll: true
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
102
|
+
elementToFocus.focus();
|
|
103
|
+
apiRef.current.scroll(scrollPosition);
|
|
104
|
+
}
|
|
93
105
|
}
|
|
94
106
|
}, [apiRef, hasFocus]);
|
|
95
107
|
const publish = React.useCallback(eventName => event => {
|
|
@@ -8,6 +8,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
8
8
|
import useId from '@mui/utils/useId';
|
|
9
9
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
10
10
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
11
|
+
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
11
12
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
12
13
|
import { ColumnHeaderMenuIcon } from "./ColumnHeaderMenuIcon.js";
|
|
13
14
|
import { GridColumnHeaderMenu } from "../menu/columnMenu/GridColumnHeaderMenu.js";
|
|
@@ -19,6 +20,9 @@ import { PinnedColumnPosition } from "../../internals/constants.js";
|
|
|
19
20
|
import { attachPinnedStyle } from "../../internals/utils/index.js";
|
|
20
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
const useUtilityClasses = ownerState => {
|
|
23
|
+
const {
|
|
24
|
+
disableColumnSorting
|
|
25
|
+
} = useGridRootProps();
|
|
22
26
|
const {
|
|
23
27
|
colDef,
|
|
24
28
|
classes,
|
|
@@ -31,12 +35,13 @@ const useUtilityClasses = ownerState => {
|
|
|
31
35
|
isLastUnpinned,
|
|
32
36
|
isSiblingFocused
|
|
33
37
|
} = ownerState;
|
|
38
|
+
const isColumnSortable = colDef.sortable && !disableColumnSorting;
|
|
34
39
|
const isColumnSorted = sortDirection != null;
|
|
35
40
|
const isColumnFiltered = filterItemsCounter != null && filterItemsCounter > 0;
|
|
36
41
|
// todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
|
|
37
42
|
const isColumnNumeric = colDef.type === 'number';
|
|
38
43
|
const slots = {
|
|
39
|
-
root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight',
|
|
44
|
+
root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', isColumnSortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition === PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight',
|
|
40
45
|
// TODO: Remove classes below and restore `:has` selectors when they are supported in jsdom
|
|
41
46
|
// See https://github.com/mui/mui-x/pull/14559
|
|
42
47
|
isLastUnpinned && 'columnHeader--lastUnpinned', isSiblingFocused && 'columnHeader--siblingFocused'],
|
|
@@ -163,9 +168,17 @@ function GridColumnHeaderItem(props) {
|
|
|
163
168
|
if (hasFocus && !columnMenuState.open) {
|
|
164
169
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
165
170
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
166
|
-
elementToFocus
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
if (!elementToFocus) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (doesSupportPreventScroll()) {
|
|
175
|
+
elementToFocus.focus({
|
|
176
|
+
preventScroll: true
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
180
|
+
elementToFocus.focus();
|
|
181
|
+
apiRef.current.scroll(scrollPosition);
|
|
169
182
|
}
|
|
170
183
|
}
|
|
171
184
|
}, [apiRef, hasFocus]);
|
|
@@ -7,7 +7,6 @@ import * as React from 'react';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import useForkRef from '@mui/utils/useForkRef';
|
|
9
9
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
|
-
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
11
10
|
import { GridColumnHeaderTitle } from "./GridColumnHeaderTitle.js";
|
|
12
11
|
import { GridColumnHeaderSeparator } from "./GridColumnHeaderSeparator.js";
|
|
13
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
@@ -19,7 +18,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
19
18
|
height,
|
|
20
19
|
isResizing,
|
|
21
20
|
sortDirection,
|
|
22
|
-
hasFocus,
|
|
23
21
|
tabIndex,
|
|
24
22
|
separatorSide,
|
|
25
23
|
isDraggable,
|
|
@@ -37,7 +35,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
37
35
|
style
|
|
38
36
|
} = props,
|
|
39
37
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
40
|
-
const apiRef = useGridPrivateApiContext();
|
|
41
38
|
const rootProps = useGridRootProps();
|
|
42
39
|
const headerCellRef = React.useRef(null);
|
|
43
40
|
const handleRef = useForkRef(headerCellRef, ref);
|
|
@@ -45,17 +42,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
45
42
|
if (sortDirection != null) {
|
|
46
43
|
ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
|
|
47
44
|
}
|
|
48
|
-
React.useLayoutEffect(() => {
|
|
49
|
-
const columnMenuState = apiRef.current.state.columnMenu;
|
|
50
|
-
if (hasFocus && !columnMenuState.open) {
|
|
51
|
-
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
52
|
-
const elementToFocus = focusableElement || headerCellRef.current;
|
|
53
|
-
elementToFocus?.focus();
|
|
54
|
-
if (apiRef.current.columnHeadersContainerRef?.current) {
|
|
55
|
-
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, [apiRef, hasFocus]);
|
|
59
45
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
60
46
|
className: clsx(classes.root, headerClassName),
|
|
61
47
|
style: _extends({}, style, {
|
|
@@ -178,7 +178,8 @@ function GridColumnsManagement(props) {
|
|
|
178
178
|
children: /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
|
|
179
179
|
className: classes.root,
|
|
180
180
|
ownerState: rootProps,
|
|
181
|
-
children: [currentColumns.map(column => /*#__PURE__*/_jsx(
|
|
181
|
+
children: [currentColumns.map(column => /*#__PURE__*/_jsx(GridColumnsManagementRow, _extends({
|
|
182
|
+
as: rootProps.slots.baseCheckbox,
|
|
182
183
|
className: classes.row,
|
|
183
184
|
disabled: column.hideable === false || pivotActive,
|
|
184
185
|
checked: columnVisibilityModel[column.field] !== false,
|
|
@@ -309,4 +310,8 @@ const GridColumnsManagementEmptyText = styled('div', {
|
|
|
309
310
|
alignSelf: 'center',
|
|
310
311
|
font: vars.typography.font.body
|
|
311
312
|
});
|
|
313
|
+
const GridColumnsManagementRow = styled(NotRendered, {
|
|
314
|
+
name: 'MuiDataGrid',
|
|
315
|
+
slot: 'ColumnsManagementRow'
|
|
316
|
+
})();
|
|
312
317
|
export { GridColumnsManagement };
|
|
@@ -541,6 +541,11 @@ export const GridRootStyles = styled('div', {
|
|
|
541
541
|
opacity: 0.5
|
|
542
542
|
}
|
|
543
543
|
},
|
|
544
|
+
// Hide the column separator when the column has border and it is not resizable
|
|
545
|
+
// In this case, this column separator may block interaction with the separator from the adjacent column that is resizable
|
|
546
|
+
[`& .${c['columnHeader--withLeftBorder']} .${c['columnSeparator--sideLeft']}:not(.${c['columnSeparator--resizable']}), & .${c['columnHeader--withRightBorder']} .${c['columnSeparator--sideRight']}:not(.${c['columnSeparator--resizable']})`]: {
|
|
547
|
+
display: 'none'
|
|
548
|
+
},
|
|
544
549
|
[`& .${c['columnSeparator--sideLeft']}`]: {
|
|
545
550
|
left: columnSeparatorOffset
|
|
546
551
|
},
|
|
@@ -683,6 +688,11 @@ export const GridRootStyles = styled('div', {
|
|
|
683
688
|
outlineOffset: focusOutlineWidth * -1
|
|
684
689
|
}
|
|
685
690
|
},
|
|
691
|
+
[`& .${c['cell--editing']}`]: {
|
|
692
|
+
'& .MuiInputBase-root': {
|
|
693
|
+
height: '100%'
|
|
694
|
+
}
|
|
695
|
+
},
|
|
686
696
|
[`& .${c['row--editing']}`]: {
|
|
687
697
|
boxShadow: vars.shadows.base
|
|
688
698
|
},
|
|
@@ -785,7 +795,7 @@ export const GridRootStyles = styled('div', {
|
|
|
785
795
|
[`& .${c.rowReorderCellPlaceholder}`]: {
|
|
786
796
|
display: 'none'
|
|
787
797
|
},
|
|
788
|
-
[`& .${c['columnHeader--dragging']}
|
|
798
|
+
[`& .${c['columnHeader--dragging']}`]: {
|
|
789
799
|
background: vars.colors.background.overlay,
|
|
790
800
|
padding: '0 12px',
|
|
791
801
|
borderRadius: 'var(--unstable_DataGrid-radius)',
|
|
@@ -795,8 +805,11 @@ export const GridRootStyles = styled('div', {
|
|
|
795
805
|
background: vars.colors.background.overlay,
|
|
796
806
|
padding: '0 12px',
|
|
797
807
|
borderRadius: 'var(--unstable_DataGrid-radius)',
|
|
798
|
-
|
|
808
|
+
border: '1px solid var(--DataGrid-rowBorderColor)',
|
|
809
|
+
color: vars.colors.foreground.base,
|
|
810
|
+
transform: 'translateZ(0)',
|
|
799
811
|
[`& .${c.rowReorderCellPlaceholder}`]: {
|
|
812
|
+
padding: '0 6px',
|
|
800
813
|
display: 'flex'
|
|
801
814
|
}
|
|
802
815
|
},
|
|
@@ -872,6 +885,7 @@ export const GridRootStyles = styled('div', {
|
|
|
872
885
|
[`& .${c['row--dropAbove']}`]: {
|
|
873
886
|
position: 'relative',
|
|
874
887
|
'&::before': {
|
|
888
|
+
pointerEvents: 'none',
|
|
875
889
|
content: '""',
|
|
876
890
|
position: 'absolute',
|
|
877
891
|
top: 0,
|
|
@@ -883,7 +897,9 @@ export const GridRootStyles = styled('div', {
|
|
|
883
897
|
},
|
|
884
898
|
[`& .${c['row--dropBelow']}`]: {
|
|
885
899
|
position: 'relative',
|
|
886
|
-
'&::
|
|
900
|
+
'&::after': {
|
|
901
|
+
zIndex: 100,
|
|
902
|
+
pointerEvents: 'none',
|
|
887
903
|
content: '""',
|
|
888
904
|
position: 'absolute',
|
|
889
905
|
bottom: '-2px',
|
|
@@ -893,14 +909,16 @@ export const GridRootStyles = styled('div', {
|
|
|
893
909
|
backgroundColor: vars.colors.interactive.selected
|
|
894
910
|
},
|
|
895
911
|
[`&.${c['row--lastVisible']}`]: {
|
|
896
|
-
'&::
|
|
912
|
+
'&::after': {
|
|
897
913
|
bottom: 'calc(var(--DataGrid-hasScrollY) * 0px + (1 - var(--DataGrid-hasScrollY)) * -2px)'
|
|
898
914
|
}
|
|
899
915
|
}
|
|
900
916
|
},
|
|
901
917
|
[`& .${c['row--beingDragged']}`]: {
|
|
902
|
-
|
|
903
|
-
|
|
918
|
+
color: vars.colors.foreground.disabled,
|
|
919
|
+
'&:hover': {
|
|
920
|
+
backgroundColor: 'transparent'
|
|
921
|
+
}
|
|
904
922
|
}
|
|
905
923
|
};
|
|
906
924
|
return gridStyle;
|
|
@@ -24,8 +24,9 @@ function GridColumnMenuSortItem(props) {
|
|
|
24
24
|
const onSortMenuItemClick = React.useCallback(event => {
|
|
25
25
|
onClick(event);
|
|
26
26
|
const direction = event.currentTarget.getAttribute('data-value') || null;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const allowMultipleSorting = rootProps.multipleColumnsSortingMode === 'always';
|
|
28
|
+
apiRef.current.sortColumn(colDef.field, direction === sortDirection ? null : direction, allowMultipleSorting);
|
|
29
|
+
}, [apiRef, colDef, onClick, sortDirection, rootProps.multipleColumnsSortingMode]);
|
|
29
30
|
if (rootProps.disableColumnSorting || !colDef || !colDef.sortable || !sortingOrder.some(item => !!item)) {
|
|
30
31
|
return null;
|
|
31
32
|
}
|
|
@@ -5,7 +5,7 @@ import type { ValueOptions } from "../../../models/colDef/gridColDef.js";
|
|
|
5
5
|
export type GridFilterInputMultipleSingleSelectProps = GridFilterInputValueProps<Omit<AutocompleteProps<ValueOptions, true, false, true>, 'options'>> & {
|
|
6
6
|
type?: 'singleSelect';
|
|
7
7
|
};
|
|
8
|
-
declare function GridFilterInputMultipleSingleSelect(props: GridFilterInputMultipleSingleSelectProps): React.JSX.Element;
|
|
8
|
+
declare function GridFilterInputMultipleSingleSelect(props: GridFilterInputMultipleSingleSelectProps): React.JSX.Element | null;
|
|
9
9
|
declare namespace GridFilterInputMultipleSingleSelect {
|
|
10
10
|
var propTypes: any;
|
|
11
11
|
}
|