@mui/x-data-grid 8.12.0 → 8.13.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 +145 -0
- package/DataGrid/DataGrid.js +2 -1
- package/DataGrid/useDataGridComponent.js +2 -2
- package/components/GridLoadingOverlay.d.ts +1 -1
- package/components/GridRow.js +3 -7
- package/components/GridScrollShadows.d.ts +6 -0
- package/components/GridScrollShadows.js +108 -0
- package/components/GridScrollbarFillerCell.d.ts +0 -6
- package/components/GridScrollbarFillerCell.js +1 -7
- package/components/GridSkeletonLoadingOverlay.js +3 -10
- package/components/base/GridOverlays.d.ts +1 -3
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +0 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -3
- package/components/containers/GridRootStyles.js +6 -21
- package/components/toolbarV8/GridToolbar.js +12 -10
- package/components/virtualization/GridMainContainer.d.ts +1 -2
- package/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
- package/components/virtualization/GridVirtualScrollbar.js +21 -25
- package/components/virtualization/GridVirtualScroller.js +31 -12
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -4
- package/constants/gridClasses.d.ts +0 -20
- package/constants/gridClasses.js +2 -2
- package/esm/DataGrid/DataGrid.js +2 -1
- package/esm/DataGrid/useDataGridComponent.js +2 -2
- package/esm/components/GridLoadingOverlay.d.ts +1 -1
- package/esm/components/GridRow.js +3 -7
- package/esm/components/GridScrollShadows.d.ts +6 -0
- package/esm/components/GridScrollShadows.js +103 -0
- package/esm/components/GridScrollbarFillerCell.d.ts +0 -6
- package/esm/components/GridScrollbarFillerCell.js +1 -7
- package/esm/components/GridSkeletonLoadingOverlay.js +3 -10
- package/esm/components/base/GridOverlays.d.ts +1 -3
- package/esm/components/columnHeaders/GridColumnHeaderItem.d.ts +0 -1
- package/esm/components/columnHeaders/GridColumnHeaderItem.js +1 -3
- package/esm/components/containers/GridRootStyles.js +6 -21
- package/esm/components/toolbarV8/GridToolbar.js +12 -10
- package/esm/components/virtualization/GridMainContainer.d.ts +1 -2
- package/esm/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
- package/esm/components/virtualization/GridVirtualScrollbar.js +20 -24
- package/esm/components/virtualization/GridVirtualScroller.js +32 -13
- package/esm/components/virtualization/GridVirtualScrollerFiller.js +2 -4
- package/esm/constants/gridClasses.d.ts +0 -20
- package/esm/constants/gridClasses.js +2 -2
- package/esm/hooks/core/useGridVirtualizer.js +4 -0
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -10
- package/esm/hooks/features/columnResize/useGridColumnResize.js +16 -0
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +6 -0
- package/esm/hooks/features/index.d.ts +2 -1
- package/esm/hooks/features/index.js +2 -1
- package/esm/hooks/features/overlays/gridOverlaysInterfaces.d.ts +3 -0
- package/esm/hooks/features/overlays/gridOverlaysInterfaces.js +1 -0
- package/esm/hooks/features/overlays/index.d.ts +1 -0
- package/esm/hooks/features/overlays/index.js +1 -0
- package/esm/hooks/features/overlays/useGridOverlays.d.ts +6 -8
- package/esm/hooks/features/overlays/useGridOverlays.js +3 -27
- package/esm/hooks/features/rows/useGridParamsApi.d.ts +2 -1
- package/esm/hooks/features/rows/useGridParamsApi.js +5 -24
- package/esm/hooks/features/rows/useGridParamsOverridableMethods.d.ts +7 -0
- package/esm/hooks/features/rows/useGridParamsOverridableMethods.js +28 -0
- package/esm/hooks/features/rows/useGridRowSpanning.js +4 -1
- package/esm/hooks/features/rows/useGridRows.js +41 -1
- package/esm/hooks/features/sorting/gridSortingUtils.d.ts +1 -3
- package/esm/hooks/features/sorting/gridSortingUtils.js +4 -6
- package/esm/hooks/features/sorting/useGridSorting.d.ts +1 -2
- package/esm/hooks/features/sorting/useGridSorting.js +3 -4
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +1 -0
- package/esm/internals/index.js +1 -0
- package/esm/material/variables.js +2 -2
- package/esm/models/api/gridRowApi.d.ts +10 -0
- package/esm/models/configuration/gridAggregationConfiguration.d.ts +0 -6
- package/esm/models/configuration/gridConfiguration.d.ts +2 -1
- package/esm/models/configuration/gridParamsConfiguration.d.ts +12 -0
- package/esm/models/configuration/gridParamsConfiguration.js +1 -0
- package/esm/models/props/DataGridProps.d.ts +10 -0
- package/esm/utils/cellBorderUtils.d.ts +3 -2
- package/esm/utils/cellBorderUtils.js +7 -4
- package/hooks/core/useGridVirtualizer.js +4 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -10
- package/hooks/features/columnResize/useGridColumnResize.js +16 -0
- package/hooks/features/dataSource/useGridDataSourceBase.js +6 -0
- package/hooks/features/index.d.ts +2 -1
- package/hooks/features/index.js +11 -0
- package/hooks/features/overlays/gridOverlaysInterfaces.d.ts +3 -0
- package/hooks/features/overlays/gridOverlaysInterfaces.js +5 -0
- package/hooks/features/overlays/index.d.ts +1 -0
- package/hooks/features/overlays/index.js +5 -0
- package/hooks/features/overlays/useGridOverlays.d.ts +6 -8
- package/hooks/features/overlays/useGridOverlays.js +3 -28
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -1
- package/hooks/features/rows/useGridParamsApi.js +5 -24
- package/hooks/features/rows/useGridParamsOverridableMethods.d.ts +7 -0
- package/hooks/features/rows/useGridParamsOverridableMethods.js +36 -0
- package/hooks/features/rows/useGridRowSpanning.js +4 -1
- package/hooks/features/rows/useGridRows.js +41 -1
- package/hooks/features/sorting/gridSortingUtils.d.ts +1 -3
- package/hooks/features/sorting/gridSortingUtils.js +4 -6
- package/hooks/features/sorting/useGridSorting.d.ts +1 -2
- package/hooks/features/sorting/useGridSorting.js +3 -4
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +8 -0
- package/material/variables.js +2 -2
- package/models/api/gridRowApi.d.ts +10 -0
- package/models/configuration/gridAggregationConfiguration.d.ts +0 -6
- package/models/configuration/gridConfiguration.d.ts +2 -1
- package/models/configuration/gridParamsConfiguration.d.ts +12 -0
- package/models/configuration/gridParamsConfiguration.js +5 -0
- package/models/props/DataGridProps.d.ts +10 -0
- package/package.json +3 -3
- package/utils/cellBorderUtils.d.ts +3 -2
- package/utils/cellBorderUtils.js +7 -4
|
@@ -105,8 +105,6 @@ export const GridRootStyles = styled('div', {
|
|
|
105
105
|
[`& .${c['columnHeader--filtered']}`]: styles['columnHeader--filtered']
|
|
106
106
|
}, {
|
|
107
107
|
[`& .${c['columnHeader--last']}`]: styles['columnHeader--last']
|
|
108
|
-
}, {
|
|
109
|
-
[`& .${c['columnHeader--lastUnpinned']}`]: styles['columnHeader--lastUnpinned']
|
|
110
108
|
}, {
|
|
111
109
|
[`& .${c['columnHeader--moving']}`]: styles['columnHeader--moving']
|
|
112
110
|
}, {
|
|
@@ -223,12 +221,6 @@ export const GridRootStyles = styled('div', {
|
|
|
223
221
|
[`& .${c['scrollbar--vertical']}`]: styles['scrollbar--vertical']
|
|
224
222
|
}, {
|
|
225
223
|
[`& .${c.scrollbarFiller}`]: styles.scrollbarFiller
|
|
226
|
-
}, {
|
|
227
|
-
[`& .${c['scrollbarFiller--borderBottom']}`]: styles['scrollbarFiller--borderBottom']
|
|
228
|
-
}, {
|
|
229
|
-
[`& .${c['scrollbarFiller--borderTop']}`]: styles['scrollbarFiller--borderTop']
|
|
230
|
-
}, {
|
|
231
|
-
[`& .${c['scrollbarFiller--header']}`]: styles['scrollbarFiller--header']
|
|
232
224
|
}, {
|
|
233
225
|
[`& .${c['scrollbarFiller--pinnedRight']}`]: styles['scrollbarFiller--pinnedRight']
|
|
234
226
|
}, {
|
|
@@ -390,9 +382,7 @@ export const GridRootStyles = styled('div', {
|
|
|
390
382
|
[`& .${c.columnHeader}:focus,
|
|
391
383
|
& .${c['columnHeader--withLeftBorder']},
|
|
392
384
|
& .${c['columnHeader--withRightBorder']},
|
|
393
|
-
& .${c['columnHeader--siblingFocused']}
|
|
394
|
-
& .${c['virtualScroller--hasScrollX']} .${c['columnHeader--lastUnpinned']},
|
|
395
|
-
& .${c['virtualScroller--hasScrollX']} .${c['columnHeader--last']}
|
|
385
|
+
& .${c['columnHeader--siblingFocused']}
|
|
396
386
|
`]: {
|
|
397
387
|
[`& .${c.columnSeparator}`]: {
|
|
398
388
|
opacity: 0
|
|
@@ -597,7 +587,7 @@ export const GridRootStyles = styled('div', {
|
|
|
597
587
|
width: 'auto'
|
|
598
588
|
},
|
|
599
589
|
[`& .${c.headerFilterRow}`]: {
|
|
600
|
-
[`& .${c.columnHeader}`]: {
|
|
590
|
+
[`& .${c.columnHeader}, & .${c.scrollbarFiller}`]: {
|
|
601
591
|
boxSizing: 'border-box',
|
|
602
592
|
borderBottom: '1px solid var(--DataGrid-rowBorderColor)'
|
|
603
593
|
}
|
|
@@ -846,14 +836,8 @@ export const GridRootStyles = styled('div', {
|
|
|
846
836
|
[`.${c.scrollbarFiller}`]: {
|
|
847
837
|
minWidth: 'calc(var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize))',
|
|
848
838
|
alignSelf: 'stretch',
|
|
849
|
-
|
|
850
|
-
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
851
|
-
},
|
|
852
|
-
[`&.${c['scrollbarFiller--borderBottom']}`]: {
|
|
853
|
-
borderBottom: '1px solid var(--DataGrid-rowBorderColor)'
|
|
854
|
-
},
|
|
839
|
+
backgroundColor: headerBackground,
|
|
855
840
|
[`&.${c['scrollbarFiller--pinnedRight']}`]: {
|
|
856
|
-
backgroundColor: vars.cell.background.pinned,
|
|
857
841
|
position: 'sticky',
|
|
858
842
|
zIndex: 40,
|
|
859
843
|
// Should be above the column separator
|
|
@@ -869,7 +853,7 @@ export const GridRootStyles = styled('div', {
|
|
|
869
853
|
[`& .${c.columnHeaders} .${c.filler}`]: {
|
|
870
854
|
backgroundColor: headerBackground
|
|
871
855
|
},
|
|
872
|
-
/*
|
|
856
|
+
/* Used when skeleton/no columns overlay is visible */
|
|
873
857
|
[`& .${c['main--hiddenContent']}`]: {
|
|
874
858
|
[`& .${c.virtualScrollerContent}`]: {
|
|
875
859
|
// We use visibility hidden so that the virtual scroller content retains its height.
|
|
@@ -878,7 +862,8 @@ export const GridRootStyles = styled('div', {
|
|
|
878
862
|
position: 'fixed',
|
|
879
863
|
visibility: 'hidden'
|
|
880
864
|
},
|
|
881
|
-
|
|
865
|
+
// Hide grid content
|
|
866
|
+
[`& .${c.pinnedRows}`]: {
|
|
882
867
|
display: 'none'
|
|
883
868
|
}
|
|
884
869
|
},
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["className"],
|
|
6
|
-
_excluded2 = ["className"]
|
|
6
|
+
_excluded2 = ["className"],
|
|
7
|
+
_excluded3 = ["showQuickFilter", "quickFilterProps", "csvOptions", "printOptions", "additionalItems", "additionalExportMenuItems"];
|
|
7
8
|
import * as React from 'react';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import useId from '@mui/utils/useId';
|
|
@@ -79,13 +80,14 @@ function GridToolbarLabel(props) {
|
|
|
79
80
|
}
|
|
80
81
|
function GridToolbar(props) {
|
|
81
82
|
const {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
showQuickFilter = true,
|
|
84
|
+
quickFilterProps,
|
|
85
|
+
csvOptions,
|
|
86
|
+
printOptions,
|
|
87
|
+
additionalItems,
|
|
88
|
+
additionalExportMenuItems
|
|
89
|
+
} = props,
|
|
90
|
+
other = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
89
91
|
const apiRef = useGridApiContext();
|
|
90
92
|
const rootProps = useGridRootProps();
|
|
91
93
|
const [exportMenuOpen, setExportMenuOpen] = React.useState(false);
|
|
@@ -94,7 +96,7 @@ function GridToolbar(props) {
|
|
|
94
96
|
const exportMenuTriggerId = useId();
|
|
95
97
|
const showExportMenu = !csvOptions?.disableToolbarButton || !printOptions?.disableToolbarButton || additionalExportMenuItems;
|
|
96
98
|
const closeExportMenu = () => setExportMenuOpen(false);
|
|
97
|
-
return /*#__PURE__*/_jsxs(Toolbar, {
|
|
99
|
+
return /*#__PURE__*/_jsxs(Toolbar, _extends({}, other, {
|
|
98
100
|
children: [rootProps.label && /*#__PURE__*/_jsx(GridToolbarLabel, {
|
|
99
101
|
children: rootProps.label
|
|
100
102
|
}), !rootProps.disableColumnSelector && /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
@@ -161,7 +163,7 @@ function GridToolbar(props) {
|
|
|
161
163
|
}), showQuickFilter && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
162
164
|
children: [/*#__PURE__*/_jsx(GridToolbarDivider, {}), /*#__PURE__*/_jsx(GridToolbarQuickFilter, _extends({}, quickFilterProps))]
|
|
163
165
|
})]
|
|
164
|
-
});
|
|
166
|
+
}));
|
|
165
167
|
}
|
|
166
168
|
process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
|
|
167
169
|
// ----------------------------- Warning --------------------------------
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
3
|
-
import { GridLoadingOverlayVariant } from "
|
|
4
|
-
import { GridOverlayType } from "../base/GridOverlays.js";
|
|
3
|
+
import type { GridOverlayType, GridLoadingOverlayVariant } from "../../hooks/features/overlays/gridOverlaysInterfaces.js";
|
|
5
4
|
type OwnerState = Pick<DataGridProcessedProps, 'classes'> & {
|
|
6
5
|
hasScrollX: boolean;
|
|
7
6
|
hasPinnedRight: boolean;
|
|
@@ -7,5 +7,6 @@ type GridVirtualScrollbarProps = {
|
|
|
7
7
|
top: number;
|
|
8
8
|
}>;
|
|
9
9
|
};
|
|
10
|
+
export declare const ScrollbarCorner: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, {}, {}>;
|
|
10
11
|
declare const GridVirtualScrollbar: React.ForwardRefExoticComponent<GridVirtualScrollbarProps> | React.ForwardRefExoticComponent<GridVirtualScrollbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
12
|
export { GridVirtualScrollbar };
|
|
@@ -37,7 +37,7 @@ const Scrollbar = styled('div')({
|
|
|
37
37
|
});
|
|
38
38
|
const ScrollbarVertical = styled(Scrollbar)({
|
|
39
39
|
width: 'var(--size)',
|
|
40
|
-
height: 'calc(var(--DataGrid-hasScrollY) * (100% - var(--DataGrid-
|
|
40
|
+
height: 'calc(var(--DataGrid-hasScrollY) * (100% - var(--DataGrid-headersTotalHeight) - var(--DataGrid-hasScrollX) * var(--DataGrid-scrollbarSize)))',
|
|
41
41
|
overflowY: 'auto',
|
|
42
42
|
overflowX: 'hidden',
|
|
43
43
|
// Disable focus-visible style, it's a scrollbar.
|
|
@@ -45,11 +45,11 @@ const ScrollbarVertical = styled(Scrollbar)({
|
|
|
45
45
|
'& > div': {
|
|
46
46
|
width: 'var(--size)'
|
|
47
47
|
},
|
|
48
|
-
top: 'var(--DataGrid-
|
|
49
|
-
right:
|
|
48
|
+
top: 'var(--DataGrid-headersTotalHeight)',
|
|
49
|
+
right: 0
|
|
50
50
|
});
|
|
51
51
|
const ScrollbarHorizontal = styled(Scrollbar)({
|
|
52
|
-
width: '100%',
|
|
52
|
+
width: 'calc(var(--DataGrid-hasScrollX) * (100% - var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize)))',
|
|
53
53
|
height: 'var(--size)',
|
|
54
54
|
overflowY: 'hidden',
|
|
55
55
|
overflowX: 'auto',
|
|
@@ -58,7 +58,14 @@ const ScrollbarHorizontal = styled(Scrollbar)({
|
|
|
58
58
|
'& > div': {
|
|
59
59
|
height: 'var(--size)'
|
|
60
60
|
},
|
|
61
|
-
bottom:
|
|
61
|
+
bottom: 0
|
|
62
|
+
});
|
|
63
|
+
export const ScrollbarCorner = styled(Scrollbar)({
|
|
64
|
+
width: 'var(--size)',
|
|
65
|
+
height: 'var(--size)',
|
|
66
|
+
right: 0,
|
|
67
|
+
bottom: 0,
|
|
68
|
+
overflow: 'scroll'
|
|
62
69
|
});
|
|
63
70
|
const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref) {
|
|
64
71
|
const apiRef = useGridPrivateApiContext();
|
|
@@ -66,16 +73,12 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
66
73
|
const isLocked = React.useRef(false);
|
|
67
74
|
const lastPosition = React.useRef(0);
|
|
68
75
|
const scrollbarRef = React.useRef(null);
|
|
69
|
-
const contentRef = React.useRef(null);
|
|
70
76
|
const classes = useUtilityClasses(rootProps, props.position);
|
|
71
77
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
72
78
|
const propertyDimension = props.position === 'vertical' ? 'height' : 'width';
|
|
73
79
|
const propertyScroll = props.position === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
|
74
80
|
const propertyScrollPosition = props.position === 'vertical' ? 'top' : 'left';
|
|
75
|
-
const
|
|
76
|
-
const contentSize = dimensions.minimumSize[propertyDimension] + (hasScroll ? dimensions.scrollbarSize : 0);
|
|
77
|
-
const scrollbarSize = props.position === 'vertical' ? dimensions.viewportInnerSize.height : dimensions.viewportOuterSize.width;
|
|
78
|
-
const scrollbarInnerSize = scrollbarSize * (contentSize / dimensions.viewportOuterSize[propertyDimension]);
|
|
81
|
+
const scrollbarInnerSize = props.position === 'horizontal' ? dimensions.minimumSize.width : dimensions.minimumSize.height - dimensions.headersTotalHeight;
|
|
79
82
|
const onScrollerScroll = useEventCallback(() => {
|
|
80
83
|
const scrollbar = scrollbarRef.current;
|
|
81
84
|
const scrollPosition = props.scrollPosition.current;
|
|
@@ -91,8 +94,7 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
91
94
|
return;
|
|
92
95
|
}
|
|
93
96
|
isLocked.current = true;
|
|
94
|
-
|
|
95
|
-
scrollbar[propertyScroll] = value * scrollbarInnerSize;
|
|
97
|
+
scrollbar[propertyScroll] = scrollPosition[propertyScrollPosition];
|
|
96
98
|
});
|
|
97
99
|
const onScrollbarScroll = useEventCallback(() => {
|
|
98
100
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
@@ -105,8 +107,7 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
109
|
isLocked.current = true;
|
|
108
|
-
|
|
109
|
-
scroller[propertyScroll] = value * contentSize;
|
|
110
|
+
scroller[propertyScroll] = scrollbar[propertyScroll];
|
|
110
111
|
});
|
|
111
112
|
useOnMount(() => {
|
|
112
113
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
@@ -121,18 +122,13 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
121
122
|
scrollbar.removeEventListener('scroll', onScrollbarScroll, options);
|
|
122
123
|
};
|
|
123
124
|
});
|
|
124
|
-
React.useEffect(() => {
|
|
125
|
-
const content = contentRef.current;
|
|
126
|
-
content.style.setProperty(propertyDimension, `${scrollbarInnerSize}px`);
|
|
127
|
-
}, [scrollbarInnerSize, propertyDimension]);
|
|
128
125
|
const Container = props.position === 'vertical' ? ScrollbarVertical : ScrollbarHorizontal;
|
|
126
|
+
const scrollbarInnerStyle = React.useMemo(() => ({
|
|
127
|
+
[propertyDimension]: `${scrollbarInnerSize}px`
|
|
128
|
+
}), [propertyDimension, scrollbarInnerSize]);
|
|
129
129
|
return /*#__PURE__*/_jsx(Container, {
|
|
130
130
|
ref: useForkRef(ref, scrollbarRef),
|
|
131
131
|
className: classes.root,
|
|
132
|
-
style: props.position === 'vertical' && rootProps.listView ? {
|
|
133
|
-
height: '100%',
|
|
134
|
-
top: 0
|
|
135
|
-
} : undefined,
|
|
136
132
|
tabIndex: -1,
|
|
137
133
|
"aria-hidden": "true"
|
|
138
134
|
// tabIndex does not prevent focus with a mouse click, throwing a console error
|
|
@@ -142,8 +138,8 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
142
138
|
event.target.blur();
|
|
143
139
|
},
|
|
144
140
|
children: /*#__PURE__*/_jsx("div", {
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
className: classes.content,
|
|
142
|
+
style: scrollbarInnerStyle
|
|
147
143
|
})
|
|
148
144
|
});
|
|
149
145
|
});
|
|
@@ -16,7 +16,9 @@ import { GridTopContainer as TopContainer } from "./GridTopContainer.js";
|
|
|
16
16
|
import { GridVirtualScrollerContent as Content } from "./GridVirtualScrollerContent.js";
|
|
17
17
|
import { GridVirtualScrollerFiller as SpaceFiller } from "./GridVirtualScrollerFiller.js";
|
|
18
18
|
import { GridVirtualScrollerRenderZone as RenderZone } from "./GridVirtualScrollerRenderZone.js";
|
|
19
|
-
import { GridVirtualScrollbar as Scrollbar } from "./GridVirtualScrollbar.js";
|
|
19
|
+
import { GridVirtualScrollbar as Scrollbar, ScrollbarCorner } from "./GridVirtualScrollbar.js";
|
|
20
|
+
import { GridScrollShadows as ScrollShadows } from "../GridScrollShadows.js";
|
|
21
|
+
import { GridOverlayWrapper } from "../base/GridOverlays.js";
|
|
20
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
23
|
const useUtilityClasses = ownerState => {
|
|
22
24
|
const {
|
|
@@ -68,14 +70,17 @@ function GridVirtualScroller(props) {
|
|
|
68
70
|
const hasPinnedRight = useGridSelector(apiRef, hasPinnedRightSelector);
|
|
69
71
|
const hasBottomFiller = useGridSelector(apiRef, gridHasBottomFillerSelector);
|
|
70
72
|
const {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} = useGridOverlays();
|
|
74
|
-
const
|
|
73
|
+
overlayType,
|
|
74
|
+
loadingOverlayVariant
|
|
75
|
+
} = useGridOverlays(apiRef, rootProps);
|
|
76
|
+
const Overlay = rootProps.slots?.[overlayType];
|
|
77
|
+
const ownerState = {
|
|
75
78
|
classes: rootProps.classes,
|
|
76
79
|
hasScrollX,
|
|
77
|
-
hasPinnedRight
|
|
78
|
-
|
|
80
|
+
hasPinnedRight,
|
|
81
|
+
overlayType,
|
|
82
|
+
loadingOverlayVariant
|
|
83
|
+
};
|
|
79
84
|
const classes = useUtilityClasses(ownerState);
|
|
80
85
|
const virtualScroller = apiRef.current.virtualizer.api.useVirtualization().getters;
|
|
81
86
|
const {
|
|
@@ -109,7 +114,11 @@ function GridVirtualScroller(props) {
|
|
|
109
114
|
position: "top",
|
|
110
115
|
virtualScroller: virtualScroller
|
|
111
116
|
})]
|
|
112
|
-
}),
|
|
117
|
+
}), overlayType && /*#__PURE__*/_jsx(GridOverlayWrapper, {
|
|
118
|
+
overlayType: overlayType,
|
|
119
|
+
loadingOverlayVariant: loadingOverlayVariant,
|
|
120
|
+
children: /*#__PURE__*/_jsx(Overlay, _extends({}, rootProps.slotProps?.[overlayType]))
|
|
121
|
+
}), /*#__PURE__*/_jsx(Content, _extends({}, getContentProps(), {
|
|
113
122
|
children: /*#__PURE__*/_jsxs(RenderZone, {
|
|
114
123
|
role: "rowgroup",
|
|
115
124
|
children: [rows, /*#__PURE__*/_jsx(rootProps.slots.detailPanels, {
|
|
@@ -124,11 +133,21 @@ function GridVirtualScroller(props) {
|
|
|
124
133
|
virtualScroller: virtualScroller
|
|
125
134
|
})
|
|
126
135
|
})]
|
|
127
|
-
})), hasScrollX &&
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
})), hasScrollX && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
137
|
+
children: [rootProps.pinnedColumnsSectionSeparator?.endsWith('shadow') && /*#__PURE__*/_jsx(ScrollShadows, {
|
|
138
|
+
position: "horizontal"
|
|
139
|
+
}), /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
140
|
+
position: "horizontal"
|
|
141
|
+
}, getScrollbarHorizontalProps()))]
|
|
142
|
+
}), hasScrollY && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
143
|
+
children: [rootProps.pinnedRowsSectionSeparator?.endsWith('shadow') && /*#__PURE__*/_jsx(ScrollShadows, {
|
|
144
|
+
position: "vertical"
|
|
145
|
+
}), /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
146
|
+
position: "vertical"
|
|
147
|
+
}, getScrollbarVerticalProps()))]
|
|
148
|
+
}), hasScrollX && hasScrollY && /*#__PURE__*/_jsx(ScrollbarCorner, {
|
|
149
|
+
"aria-hidden": "true"
|
|
150
|
+
}), props.children]
|
|
132
151
|
}));
|
|
133
152
|
}
|
|
134
153
|
export { GridVirtualScroller };
|
|
@@ -21,12 +21,10 @@ const Pinned = styled('div')({
|
|
|
21
21
|
backgroundColor: vars.cell.background.pinned
|
|
22
22
|
});
|
|
23
23
|
const PinnedLeft = styled(Pinned)({
|
|
24
|
-
left: 0
|
|
25
|
-
borderRight: '1px solid var(--rowBorderColor)'
|
|
24
|
+
left: 0
|
|
26
25
|
});
|
|
27
26
|
const PinnedRight = styled(Pinned)({
|
|
28
|
-
right: 0
|
|
29
|
-
borderLeft: '1px solid var(--rowBorderColor)'
|
|
27
|
+
right: 0
|
|
30
28
|
});
|
|
31
29
|
const Main = styled('div')({
|
|
32
30
|
flexGrow: 1,
|
|
@@ -235,11 +235,6 @@ export interface GridClasses {
|
|
|
235
235
|
* Styles applied to the last column header element.
|
|
236
236
|
*/
|
|
237
237
|
'columnHeader--last': string;
|
|
238
|
-
/**
|
|
239
|
-
* Styles applied to the last unpinned column header item.
|
|
240
|
-
* @ignore - do not document.
|
|
241
|
-
*/
|
|
242
|
-
'columnHeader--lastUnpinned': string;
|
|
243
238
|
/**
|
|
244
239
|
* Styles applied to a column header item when its sibling with a bordering separator is focused.
|
|
245
240
|
* @ignore - do not document.
|
|
@@ -676,21 +671,6 @@ export interface GridClasses {
|
|
|
676
671
|
* Styles applied to the scrollbar filler cell.
|
|
677
672
|
*/
|
|
678
673
|
scrollbarFiller: string;
|
|
679
|
-
/**
|
|
680
|
-
* @ignore - do not document.
|
|
681
|
-
* Styles applied to the scrollbar filler cell, in header position.
|
|
682
|
-
*/
|
|
683
|
-
'scrollbarFiller--header': string;
|
|
684
|
-
/**
|
|
685
|
-
* @ignore - do not document.
|
|
686
|
-
* Styles applied to the scrollbar filler cell, with a border top.
|
|
687
|
-
*/
|
|
688
|
-
'scrollbarFiller--borderTop': string;
|
|
689
|
-
/**
|
|
690
|
-
* @ignore - do not document.
|
|
691
|
-
* Styles applied to the scrollbar filler cell, with a border bottom.
|
|
692
|
-
*/
|
|
693
|
-
'scrollbarFiller--borderBottom': string;
|
|
694
674
|
/**
|
|
695
675
|
* @ignore - do not document.
|
|
696
676
|
* Styles applied to the scrollbar filler cell.
|
|
@@ -3,6 +3,6 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
|
3
3
|
export function getDataGridUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
5
5
|
}
|
|
6
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'mainContent', 'withSidePanel', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--
|
|
6
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'mainContent', 'withSidePanel', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible',
|
|
7
7
|
// TODO v9: Rename to `cell--dragging`
|
|
8
|
-
'row--dragging', 'row--dropAbove', 'row--dropBelow', 'row--beingDragged', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderIcon', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--
|
|
8
|
+
'row--dragging', 'row--dropAbove', 'row--dropBelow', 'row--beingDragged', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderIcon', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortButton', 'sortIcon', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction']);
|
|
@@ -21,6 +21,7 @@ import { gridRowSelectionManagerSelector } from "../features/rowSelection/index.
|
|
|
21
21
|
import { DATA_GRID_PROPS_DEFAULT_VALUES } from "../../constants/dataGridPropsDefaultValues.js";
|
|
22
22
|
import { getValidRowHeight, minimalContentHeight, rowHeightWarning } from "../features/rows/gridRowsUtils.js";
|
|
23
23
|
import { getTotalHeaderHeight } from "../features/columns/gridColumnsUtils.js";
|
|
24
|
+
import { useGridOverlays } from "../features/overlays/useGridOverlays.js";
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
26
|
function identity(x) {
|
|
26
27
|
return x;
|
|
@@ -78,6 +79,7 @@ export function useGridVirtualizer(apiRef, rootProps) {
|
|
|
78
79
|
const headersTotalHeight = getTotalHeaderHeight(apiRef, rootProps);
|
|
79
80
|
const leftPinnedWidth = pinnedColumns.left.reduce((w, col) => w + col.computedWidth, 0);
|
|
80
81
|
const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
|
|
82
|
+
const overlayState = useGridOverlays(apiRef, rootProps);
|
|
81
83
|
const dimensionsParams = {
|
|
82
84
|
rowHeight,
|
|
83
85
|
headerHeight,
|
|
@@ -140,6 +142,8 @@ export function useGridVirtualizer(apiRef, rootProps) {
|
|
|
140
142
|
pinnedRows,
|
|
141
143
|
pinnedColumns,
|
|
142
144
|
autoHeight,
|
|
145
|
+
disableHorizontalScroll: listView,
|
|
146
|
+
disableVerticalScroll: overlayState.overlayType === 'noColumnsOverlay' || overlayState.loadingOverlayVariant === 'skeleton',
|
|
143
147
|
minimalContentHeight,
|
|
144
148
|
getRowHeight: React.useMemo(() => {
|
|
145
149
|
if (!getRowHeight) {
|
|
@@ -109,10 +109,7 @@ export const useGridColumnHeaders = props => {
|
|
|
109
109
|
role: "presentation",
|
|
110
110
|
className: clsx(gridClasses.filler, borderBottom && gridClasses['filler--borderBottom'])
|
|
111
111
|
}), hasScrollbarFiller && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
112
|
-
|
|
113
|
-
pinnedRight: isPinnedRight,
|
|
114
|
-
borderBottom: borderBottom,
|
|
115
|
-
borderTop: false
|
|
112
|
+
pinnedRight: isPinnedRight
|
|
116
113
|
})]
|
|
117
114
|
});
|
|
118
115
|
};
|
|
@@ -134,11 +131,10 @@ export const useGridColumnHeaders = props => {
|
|
|
134
131
|
const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, columnsTotalWidth, scrollbarWidth);
|
|
135
132
|
const siblingWithBorderingSeparator = pinnedPosition === PinnedColumnPosition.RIGHT ? renderedColumns[i - 1] : renderedColumns[i + 1];
|
|
136
133
|
const isSiblingFocused = siblingWithBorderingSeparator ? columnHeaderFocus !== null && columnHeaderFocus.field === siblingWithBorderingSeparator.field : false;
|
|
137
|
-
const isLastUnpinned = columnIndex + 1 === columnPositions.length - pinnedColumns.right.length;
|
|
138
134
|
const indexInSection = i;
|
|
139
135
|
const sectionLength = renderedColumns.length;
|
|
140
|
-
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
141
|
-
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showColumnVerticalBorder, gridHasFiller);
|
|
136
|
+
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection, rootProps.showColumnVerticalBorder, rootProps.pinnedColumnsSectionSeparator);
|
|
137
|
+
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showColumnVerticalBorder, gridHasFiller, rootProps.pinnedColumnsSectionSeparator);
|
|
142
138
|
columns.push(/*#__PURE__*/_jsx(GridColumnHeaderItem, _extends({}, sortColumnLookup[colDef.field], {
|
|
143
139
|
columnMenuOpen: open,
|
|
144
140
|
filterItemsCounter: filterColumnLookup[colDef.field] && filterColumnLookup[colDef.field].length,
|
|
@@ -152,7 +148,6 @@ export const useGridColumnHeaders = props => {
|
|
|
152
148
|
tabIndex: tabIndex,
|
|
153
149
|
pinnedPosition: pinnedPosition,
|
|
154
150
|
pinnedOffset: pinnedOffset,
|
|
155
|
-
isLastUnpinned: isLastUnpinned,
|
|
156
151
|
isSiblingFocused: isSiblingFocused,
|
|
157
152
|
showLeftBorder: showLeftBorder,
|
|
158
153
|
showRightBorder: showRightBorder
|
|
@@ -258,8 +253,8 @@ export const useGridColumnHeaders = props => {
|
|
|
258
253
|
tabIndex: tabIndex,
|
|
259
254
|
pinnedPosition: pinnedPosition,
|
|
260
255
|
pinnedOffset: pinnedOffset,
|
|
261
|
-
showLeftBorder: shouldCellShowLeftBorder(pinnedPosition, indexInSection),
|
|
262
|
-
showRightBorder: shouldCellShowRightBorder(pinnedPosition, indexInSection, visibleColumnGroupHeader.length, rootProps.showColumnVerticalBorder, gridHasFiller)
|
|
256
|
+
showLeftBorder: shouldCellShowLeftBorder(pinnedPosition, indexInSection, rootProps.showColumnVerticalBorder, rootProps.pinnedColumnsSectionSeparator),
|
|
257
|
+
showRightBorder: shouldCellShowRightBorder(pinnedPosition, indexInSection, visibleColumnGroupHeader.length, rootProps.showColumnVerticalBorder, gridHasFiller, rootProps.pinnedColumnsSectionSeparator)
|
|
263
258
|
}, index);
|
|
264
259
|
});
|
|
265
260
|
return getFillers(params, children, leftOverflow);
|
|
@@ -16,6 +16,7 @@ import { clamp } from "../../../utils/utils.js";
|
|
|
16
16
|
import { useTimeout } from "../../utils/useTimeout.js";
|
|
17
17
|
import { GridPinnedColumnPosition } from "../columns/gridColumnsInterfaces.js";
|
|
18
18
|
import { gridColumnsStateSelector } from "../columns/index.js";
|
|
19
|
+
import { gridDimensionsSelector } from "../dimensions/index.js";
|
|
19
20
|
function trackFinger(event, currentTouchId) {
|
|
20
21
|
if (currentTouchId !== undefined && event.changedTouches) {
|
|
21
22
|
for (let i = 0; i < event.changedTouches.length; i += 1) {
|
|
@@ -63,6 +64,18 @@ function getResizeDirection(separator, isRtl) {
|
|
|
63
64
|
}
|
|
64
65
|
return side;
|
|
65
66
|
}
|
|
67
|
+
function getPinnedWidthProperty(isRtl, pinnedPosition) {
|
|
68
|
+
if (pinnedPosition === GridPinnedColumnPosition.LEFT) {
|
|
69
|
+
return isRtl ? '--DataGrid-rightPinnedWidth' : '--DataGrid-leftPinnedWidth';
|
|
70
|
+
}
|
|
71
|
+
return isRtl ? '--DataGrid-leftPinnedWidth' : '--DataGrid-rightPinnedWidth';
|
|
72
|
+
}
|
|
73
|
+
function getPinnedWidth(dimensions, isRtl, pinnedPosition) {
|
|
74
|
+
if (pinnedPosition === GridPinnedColumnPosition.LEFT) {
|
|
75
|
+
return isRtl ? dimensions.rightPinnedWidth : dimensions.leftPinnedWidth;
|
|
76
|
+
}
|
|
77
|
+
return isRtl ? dimensions.leftPinnedWidth : dimensions.rightPinnedWidth;
|
|
78
|
+
}
|
|
66
79
|
function preventClick(event) {
|
|
67
80
|
event.preventDefault();
|
|
68
81
|
event.stopImmediatePropagation();
|
|
@@ -232,6 +245,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
232
245
|
}
|
|
233
246
|
div.style.setProperty('--width', finalWidth);
|
|
234
247
|
});
|
|
248
|
+
const dimensions = gridDimensionsSelector(apiRef);
|
|
235
249
|
const pinnedPosition = apiRef.current.unstable_applyPipeProcessors('isColumnPinned', false, refs.colDef.field);
|
|
236
250
|
if (pinnedPosition === GridPinnedColumnPosition.LEFT) {
|
|
237
251
|
updateProperty(refs.fillerLeft, 'width', widthDiff);
|
|
@@ -241,6 +255,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
241
255
|
refs.leftPinnedHeadersAfter.forEach(header => {
|
|
242
256
|
updateProperty(header, 'left', widthDiff);
|
|
243
257
|
});
|
|
258
|
+
apiRef.current.rootElementRef?.current?.style.setProperty(getPinnedWidthProperty(isRtl, pinnedPosition), `${getPinnedWidth(dimensions, isRtl, pinnedPosition) + columnWidthDiff}px`);
|
|
244
259
|
}
|
|
245
260
|
if (pinnedPosition === GridPinnedColumnPosition.RIGHT) {
|
|
246
261
|
updateProperty(refs.fillerRight, 'width', widthDiff);
|
|
@@ -250,6 +265,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
250
265
|
refs.rightPinnedHeadersBefore.forEach(header => {
|
|
251
266
|
updateProperty(header, 'right', widthDiff);
|
|
252
267
|
});
|
|
268
|
+
apiRef.current.rootElementRef?.current?.style.setProperty(getPinnedWidthProperty(isRtl, pinnedPosition), `${getPinnedWidth(dimensions, isRtl, pinnedPosition) + columnWidthDiff}px`);
|
|
253
269
|
}
|
|
254
270
|
};
|
|
255
271
|
const finishResize = nativeEvent => {
|
|
@@ -181,6 +181,12 @@ export const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
181
181
|
setCache(prevCache => prevCache !== newCache ? newCache : prevCache);
|
|
182
182
|
}, [props.dataSourceCache, options.cacheOptions]);
|
|
183
183
|
React.useEffect(() => {
|
|
184
|
+
// Return early if the proper strategy isn't set yet
|
|
185
|
+
// Context: https://github.com/mui/mui-x/issues/19650
|
|
186
|
+
const strategy = apiRef.current.getActiveStrategy(GridStrategyGroup.DataSource);
|
|
187
|
+
if (strategy !== DataSourceRowsUpdateStrategy.Default && strategy !== DataSourceRowsUpdateStrategy.LazyLoading) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
184
190
|
if (props.dataSource) {
|
|
185
191
|
apiRef.current.dataSource.cache.clear();
|
|
186
192
|
apiRef.current.dataSource.fetchRows();
|
|
@@ -16,4 +16,5 @@ export * from "./dimensions/index.js";
|
|
|
16
16
|
export * from "./statePersistence/index.js";
|
|
17
17
|
export * from "./headerFiltering/index.js";
|
|
18
18
|
export * from "./virtualization/index.js";
|
|
19
|
-
export * from "./dataSource/index.js";
|
|
19
|
+
export * from "./dataSource/index.js";
|
|
20
|
+
export * from "./overlays/index.js";
|
|
@@ -17,4 +17,5 @@ export * from "./dimensions/index.js";
|
|
|
17
17
|
export * from "./statePersistence/index.js";
|
|
18
18
|
export * from "./headerFiltering/index.js";
|
|
19
19
|
export * from "./virtualization/index.js";
|
|
20
|
-
export * from "./dataSource/index.js";
|
|
20
|
+
export * from "./dataSource/index.js";
|
|
21
|
+
export * from "./overlays/index.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GridSlotsComponent } from "../../../models/index.js";
|
|
2
|
+
export type GridOverlayType = keyof Pick<GridSlotsComponent, 'noColumnsOverlay' | 'noRowsOverlay' | 'noResultsOverlay' | 'loadingOverlay'> | null;
|
|
3
|
+
export type GridLoadingOverlayVariant = 'circular-progress' | 'linear-progress' | 'skeleton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { GridLoadingOverlayVariant } from "./gridOverlaysInterfaces.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { GridApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
3
|
+
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
4
|
+
import type { GridOverlayType, GridLoadingOverlayVariant } from "./gridOverlaysInterfaces.js";
|
|
4
5
|
/**
|
|
5
6
|
* Uses the grid state to determine which overlay to display.
|
|
6
7
|
* Returns the active overlay type and the active loading overlay variant.
|
|
7
8
|
*/
|
|
8
|
-
export declare const useGridOverlays: () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
overlayType: NonNullable<GridOverlayType>;
|
|
12
|
-
loadingOverlayVariant: GridLoadingOverlayVariant | null;
|
|
13
|
-
};
|
|
9
|
+
export declare const useGridOverlays: (apiRef: React.RefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, "slotProps">) => {
|
|
10
|
+
overlayType: NonNullable<GridOverlayType>;
|
|
11
|
+
loadingOverlayVariant: GridLoadingOverlayVariant | null;
|
|
14
12
|
};
|