@mui/x-data-grid 9.2.0 → 9.4.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 +314 -0
- package/components/GridRow.js +11 -3
- package/components/GridRow.mjs +11 -3
- package/components/GridScrollbarFillerCell.js +1 -1
- package/components/GridScrollbarFillerCell.mjs +1 -1
- package/components/cell/GridActionsCellItem.js +1 -1
- package/components/cell/GridActionsCellItem.mjs +1 -1
- package/components/cell/GridCell.js +1 -1
- package/components/cell/GridCell.mjs +1 -1
- package/components/cell/GridSkeletonCell.d.mts +2 -1
- package/components/cell/GridSkeletonCell.d.ts +2 -1
- package/components/cell/GridSkeletonCell.js +8 -3
- package/components/cell/GridSkeletonCell.mjs +8 -3
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/components/columnHeaders/GridBaseColumnHeaders.mjs +1 -1
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +2 -2
- package/components/columnHeaders/GridGenericColumnHeaderItem.mjs +2 -2
- package/components/containers/GridRoot.js +1 -1
- package/components/containers/GridRoot.mjs +1 -1
- package/components/virtualization/GridBottomContainer.js +1 -1
- package/components/virtualization/GridBottomContainer.mjs +1 -1
- package/components/virtualization/GridMainContainer.js +1 -1
- package/components/virtualization/GridMainContainer.mjs +1 -1
- package/components/virtualization/GridTopContainer.js +1 -1
- package/components/virtualization/GridTopContainer.mjs +1 -1
- package/components/virtualization/GridVirtualScroller.js +3 -11
- package/components/virtualization/GridVirtualScroller.mjs +3 -11
- package/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/components/virtualization/GridVirtualScrollerFiller.mjs +1 -1
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.mts +17 -1
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +17 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.mjs +2 -1
- package/hooks/core/useGridVirtualizer.d.mts +10 -10
- package/hooks/core/useGridVirtualizer.d.ts +10 -10
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.mjs +2 -2
- package/hooks/features/dataSource/models.d.mts +1 -1
- package/hooks/features/dataSource/models.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.d.mts +2 -2
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +2 -2
- package/hooks/features/dataSource/useGridDataSourceBase.js +29 -17
- package/hooks/features/dataSource/useGridDataSourceBase.mjs +29 -17
- package/hooks/features/dataSource/utils.d.mts +1 -0
- package/hooks/features/dataSource/utils.d.ts +1 -0
- package/hooks/features/dataSource/utils.js +1 -0
- package/hooks/features/dataSource/utils.mjs +1 -0
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.mts +1 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/locales/svSE.js +116 -129
- package/locales/svSE.mjs +116 -129
- package/models/gridDataSource.d.mts +6 -0
- package/models/gridDataSource.d.ts +6 -0
- package/models/gridRows.d.mts +0 -1
- package/models/gridRows.d.ts +0 -1
- package/package.json +4 -4
|
@@ -56,7 +56,7 @@ const GridMainContainer = exports.GridMainContainer = (0, _forwardRef.forwardRef
|
|
|
56
56
|
}, ariaAttributes, rootProps.slotProps?.main, {
|
|
57
57
|
ref: ref,
|
|
58
58
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelAnchor, {
|
|
59
|
-
role: "
|
|
59
|
+
role: "none",
|
|
60
60
|
"data-id": "gridPanelAnchor"
|
|
61
61
|
}), props.children]
|
|
62
62
|
}));
|
|
@@ -49,7 +49,7 @@ export const GridMainContainer = forwardRef((props, ref) => {
|
|
|
49
49
|
}, ariaAttributes, rootProps.slotProps?.main, {
|
|
50
50
|
ref: ref,
|
|
51
51
|
children: [/*#__PURE__*/_jsx(GridPanelAnchor, {
|
|
52
|
-
role: "
|
|
52
|
+
role: "none",
|
|
53
53
|
"data-id": "gridPanelAnchor"
|
|
54
54
|
}), props.children]
|
|
55
55
|
}));
|
|
@@ -31,6 +31,6 @@ function GridTopContainer(props) {
|
|
|
31
31
|
const classes = useUtilityClasses();
|
|
32
32
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({}, props, {
|
|
33
33
|
className: (0, _clsx.default)(classes.root, _gridClasses.gridClasses['container--top']),
|
|
34
|
-
role: "
|
|
34
|
+
role: "none"
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
@@ -55,9 +55,7 @@ const Scroller = (0, _styles.styled)('div', {
|
|
|
55
55
|
} = props;
|
|
56
56
|
return [styles.virtualScroller, ownerState.hasScrollX && styles['virtualScroller--hasScrollX']];
|
|
57
57
|
}
|
|
58
|
-
})(
|
|
59
|
-
ownerState
|
|
60
|
-
}) => ({
|
|
58
|
+
})({
|
|
61
59
|
position: 'relative',
|
|
62
60
|
height: '100%',
|
|
63
61
|
flexGrow: 1,
|
|
@@ -72,10 +70,8 @@ const Scroller = (0, _styles.styled)('div', {
|
|
|
72
70
|
overflow: 'hidden'
|
|
73
71
|
},
|
|
74
72
|
// See https://github.com/mui/mui-x/issues/10547
|
|
75
|
-
zIndex: 0
|
|
76
|
-
|
|
77
|
-
overscrollBehaviorX: ownerState.hasPinnedColumns ? 'none' : undefined
|
|
78
|
-
}));
|
|
73
|
+
zIndex: 0
|
|
74
|
+
});
|
|
79
75
|
const Viewport = (0, _styles.styled)('div', {
|
|
80
76
|
slot: 'internal',
|
|
81
77
|
shouldForwardProp: undefined
|
|
@@ -90,26 +86,22 @@ const Viewport = (0, _styles.styled)('div', {
|
|
|
90
86
|
}
|
|
91
87
|
});
|
|
92
88
|
const hasPinnedRightSelector = apiRef => apiRef.current.state.dimensions.rightPinnedWidth > 0;
|
|
93
|
-
const hasPinnedLeftSelector = apiRef => apiRef.current.state.dimensions.leftPinnedWidth > 0;
|
|
94
89
|
function GridVirtualScroller(props) {
|
|
95
90
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
96
91
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
97
92
|
const hasScrollY = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridHasScrollYSelector);
|
|
98
93
|
const hasScrollX = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridHasScrollXSelector);
|
|
99
94
|
const hasPinnedRight = (0, _useGridSelector.useGridSelector)(apiRef, hasPinnedRightSelector);
|
|
100
|
-
const hasPinnedLeft = (0, _useGridSelector.useGridSelector)(apiRef, hasPinnedLeftSelector);
|
|
101
95
|
const hasBottomFiller = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridHasBottomFillerSelector);
|
|
102
96
|
const {
|
|
103
97
|
overlayType,
|
|
104
98
|
loadingOverlayVariant
|
|
105
99
|
} = (0, _useGridOverlays.useGridOverlays)(apiRef, rootProps);
|
|
106
100
|
const Overlay = rootProps.slots?.[overlayType];
|
|
107
|
-
const hasPinnedColumns = hasPinnedRight || hasPinnedLeft;
|
|
108
101
|
const ownerState = {
|
|
109
102
|
classes: rootProps.classes,
|
|
110
103
|
hasScrollX,
|
|
111
104
|
hasPinnedRight,
|
|
112
|
-
hasPinnedColumns,
|
|
113
105
|
overlayType,
|
|
114
106
|
loadingOverlayVariant
|
|
115
107
|
};
|
|
@@ -47,9 +47,7 @@ const Scroller = styled('div', {
|
|
|
47
47
|
} = props;
|
|
48
48
|
return [styles.virtualScroller, ownerState.hasScrollX && styles['virtualScroller--hasScrollX']];
|
|
49
49
|
}
|
|
50
|
-
})(
|
|
51
|
-
ownerState
|
|
52
|
-
}) => ({
|
|
50
|
+
})({
|
|
53
51
|
position: 'relative',
|
|
54
52
|
height: '100%',
|
|
55
53
|
flexGrow: 1,
|
|
@@ -64,10 +62,8 @@ const Scroller = styled('div', {
|
|
|
64
62
|
overflow: 'hidden'
|
|
65
63
|
},
|
|
66
64
|
// See https://github.com/mui/mui-x/issues/10547
|
|
67
|
-
zIndex: 0
|
|
68
|
-
|
|
69
|
-
overscrollBehaviorX: ownerState.hasPinnedColumns ? 'none' : undefined
|
|
70
|
-
}));
|
|
65
|
+
zIndex: 0
|
|
66
|
+
});
|
|
71
67
|
const Viewport = styled('div', {
|
|
72
68
|
slot: 'internal',
|
|
73
69
|
shouldForwardProp: undefined
|
|
@@ -82,26 +78,22 @@ const Viewport = styled('div', {
|
|
|
82
78
|
}
|
|
83
79
|
});
|
|
84
80
|
const hasPinnedRightSelector = apiRef => apiRef.current.state.dimensions.rightPinnedWidth > 0;
|
|
85
|
-
const hasPinnedLeftSelector = apiRef => apiRef.current.state.dimensions.leftPinnedWidth > 0;
|
|
86
81
|
function GridVirtualScroller(props) {
|
|
87
82
|
const apiRef = useGridPrivateApiContext();
|
|
88
83
|
const rootProps = useGridRootProps();
|
|
89
84
|
const hasScrollY = useGridSelector(apiRef, gridHasScrollYSelector);
|
|
90
85
|
const hasScrollX = useGridSelector(apiRef, gridHasScrollXSelector);
|
|
91
86
|
const hasPinnedRight = useGridSelector(apiRef, hasPinnedRightSelector);
|
|
92
|
-
const hasPinnedLeft = useGridSelector(apiRef, hasPinnedLeftSelector);
|
|
93
87
|
const hasBottomFiller = useGridSelector(apiRef, gridHasBottomFillerSelector);
|
|
94
88
|
const {
|
|
95
89
|
overlayType,
|
|
96
90
|
loadingOverlayVariant
|
|
97
91
|
} = useGridOverlays(apiRef, rootProps);
|
|
98
92
|
const Overlay = rootProps.slots?.[overlayType];
|
|
99
|
-
const hasPinnedColumns = hasPinnedRight || hasPinnedLeft;
|
|
100
93
|
const ownerState = {
|
|
101
94
|
classes: rootProps.classes,
|
|
102
95
|
hasScrollX,
|
|
103
96
|
hasPinnedRight,
|
|
104
|
-
hasPinnedColumns,
|
|
105
97
|
overlayType,
|
|
106
98
|
loadingOverlayVariant
|
|
107
99
|
};
|
|
@@ -70,7 +70,7 @@ function GridVirtualScrollerFiller({
|
|
|
70
70
|
}
|
|
71
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Filler, {
|
|
72
72
|
className: _constants.gridClasses.filler,
|
|
73
|
-
role: "
|
|
73
|
+
role: "none",
|
|
74
74
|
style: {
|
|
75
75
|
height,
|
|
76
76
|
'--rowBorderColor': rowsLength === 0 ? 'transparent' : 'var(--DataGrid-rowBorderColor)'
|
|
@@ -63,7 +63,7 @@ function GridVirtualScrollerFiller({
|
|
|
63
63
|
}
|
|
64
64
|
return /*#__PURE__*/_jsxs(Filler, {
|
|
65
65
|
className: gridClasses.filler,
|
|
66
|
-
role: "
|
|
66
|
+
role: "none",
|
|
67
67
|
style: {
|
|
68
68
|
height,
|
|
69
69
|
'--rowBorderColor': rowsLength === 0 ? 'transparent' : 'var(--DataGrid-rowBorderColor)'
|
|
@@ -2,6 +2,7 @@ import type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridRowsState
|
|
|
2
2
|
import type { GridFilteringMethodParams, GridFilteringMethodValue, GridFilterState, GridVisibleRowsLookupState } from "../../features/filter/gridFilterState.mjs";
|
|
3
3
|
import type { GridSortingMethodParams, GridSortingMethodValue } from "../../features/sorting/gridSortingState.mjs";
|
|
4
4
|
import type { GridGetRowsParams, GridGetRowsResponse, GridGetRowsOptions } from "../../../models/gridDataSource.mjs";
|
|
5
|
+
import type { GridRowId } from "../../../models/gridRows.mjs";
|
|
5
6
|
export type GridStrategyProcessorName = keyof GridStrategyProcessingLookup;
|
|
6
7
|
export declare enum GridStrategyGroup {
|
|
7
8
|
DataSource = "dataSource",
|
|
@@ -9,7 +10,7 @@ export declare enum GridStrategyGroup {
|
|
|
9
10
|
}
|
|
10
11
|
export type GridStrategyGroupValue = `${GridStrategyGroup}`;
|
|
11
12
|
export interface GridStrategyProcessingLookup {
|
|
12
|
-
|
|
13
|
+
dataSourceRootRowsUpdate: {
|
|
13
14
|
group: GridStrategyGroup.DataSource;
|
|
14
15
|
params: {
|
|
15
16
|
response: GridGetRowsResponse;
|
|
@@ -22,6 +23,21 @@ export interface GridStrategyProcessingLookup {
|
|
|
22
23
|
};
|
|
23
24
|
value: void;
|
|
24
25
|
};
|
|
26
|
+
dataSourceNestedRowsUpdate: {
|
|
27
|
+
group: GridStrategyGroup.DataSource;
|
|
28
|
+
params: {
|
|
29
|
+
parentId: GridRowId;
|
|
30
|
+
path: string[];
|
|
31
|
+
response: GridGetRowsResponse;
|
|
32
|
+
fetchParams: GridGetRowsParams;
|
|
33
|
+
} | {
|
|
34
|
+
parentId: GridRowId;
|
|
35
|
+
path: string[];
|
|
36
|
+
error: Error;
|
|
37
|
+
fetchParams: GridGetRowsParams;
|
|
38
|
+
};
|
|
39
|
+
value: void;
|
|
40
|
+
};
|
|
25
41
|
rowTreeCreation: {
|
|
26
42
|
group: GridStrategyGroup.RowTree;
|
|
27
43
|
params: GridRowTreeCreationParams;
|
|
@@ -2,6 +2,7 @@ import type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridRowsState
|
|
|
2
2
|
import type { GridFilteringMethodParams, GridFilteringMethodValue, GridFilterState, GridVisibleRowsLookupState } from "../../features/filter/gridFilterState.js";
|
|
3
3
|
import type { GridSortingMethodParams, GridSortingMethodValue } from "../../features/sorting/gridSortingState.js";
|
|
4
4
|
import type { GridGetRowsParams, GridGetRowsResponse, GridGetRowsOptions } from "../../../models/gridDataSource.js";
|
|
5
|
+
import type { GridRowId } from "../../../models/gridRows.js";
|
|
5
6
|
export type GridStrategyProcessorName = keyof GridStrategyProcessingLookup;
|
|
6
7
|
export declare enum GridStrategyGroup {
|
|
7
8
|
DataSource = "dataSource",
|
|
@@ -9,7 +10,7 @@ export declare enum GridStrategyGroup {
|
|
|
9
10
|
}
|
|
10
11
|
export type GridStrategyGroupValue = `${GridStrategyGroup}`;
|
|
11
12
|
export interface GridStrategyProcessingLookup {
|
|
12
|
-
|
|
13
|
+
dataSourceRootRowsUpdate: {
|
|
13
14
|
group: GridStrategyGroup.DataSource;
|
|
14
15
|
params: {
|
|
15
16
|
response: GridGetRowsResponse;
|
|
@@ -22,6 +23,21 @@ export interface GridStrategyProcessingLookup {
|
|
|
22
23
|
};
|
|
23
24
|
value: void;
|
|
24
25
|
};
|
|
26
|
+
dataSourceNestedRowsUpdate: {
|
|
27
|
+
group: GridStrategyGroup.DataSource;
|
|
28
|
+
params: {
|
|
29
|
+
parentId: GridRowId;
|
|
30
|
+
path: string[];
|
|
31
|
+
response: GridGetRowsResponse;
|
|
32
|
+
fetchParams: GridGetRowsParams;
|
|
33
|
+
} | {
|
|
34
|
+
parentId: GridRowId;
|
|
35
|
+
path: string[];
|
|
36
|
+
error: Error;
|
|
37
|
+
fetchParams: GridGetRowsParams;
|
|
38
|
+
};
|
|
39
|
+
value: void;
|
|
40
|
+
};
|
|
25
41
|
rowTreeCreation: {
|
|
26
42
|
group: GridStrategyGroup.RowTree;
|
|
27
43
|
params: GridRowTreeCreationParams;
|
|
@@ -15,7 +15,8 @@ var _gridStrategyProcessingApi = require("./gridStrategyProcessingApi");
|
|
|
15
15
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
16
16
|
const GRID_DEFAULT_STRATEGY = exports.GRID_DEFAULT_STRATEGY = 'none';
|
|
17
17
|
const GRID_STRATEGIES_PROCESSORS = {
|
|
18
|
-
|
|
18
|
+
dataSourceRootRowsUpdate: _gridStrategyProcessingApi.GridStrategyGroup.DataSource,
|
|
19
|
+
dataSourceNestedRowsUpdate: _gridStrategyProcessingApi.GridStrategyGroup.DataSource,
|
|
19
20
|
rowTreeCreation: _gridStrategyProcessingApi.GridStrategyGroup.RowTree,
|
|
20
21
|
filtering: _gridStrategyProcessingApi.GridStrategyGroup.RowTree,
|
|
21
22
|
sorting: _gridStrategyProcessingApi.GridStrategyGroup.RowTree,
|
|
@@ -8,7 +8,8 @@ import { GridStrategyGroup } from "./gridStrategyProcessingApi.mjs";
|
|
|
8
8
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.mjs";
|
|
9
9
|
export const GRID_DEFAULT_STRATEGY = 'none';
|
|
10
10
|
const GRID_STRATEGIES_PROCESSORS = {
|
|
11
|
-
|
|
11
|
+
dataSourceRootRowsUpdate: GridStrategyGroup.DataSource,
|
|
12
|
+
dataSourceNestedRowsUpdate: GridStrategyGroup.DataSource,
|
|
12
13
|
rowTreeCreation: GridStrategyGroup.RowTree,
|
|
13
14
|
filtering: GridStrategyGroup.RowTree,
|
|
14
15
|
sorting: GridStrategyGroup.RowTree,
|
|
@@ -9,28 +9,28 @@ export declare function useGridVirtualizer(): {
|
|
|
9
9
|
updateDimensions: (firstUpdate?: boolean) => void;
|
|
10
10
|
debouncedUpdateDimensions: (((firstUpdate?: boolean) => void) & import("@mui/x-internals/throttle").Cancelable) | undefined;
|
|
11
11
|
rowsMeta: {
|
|
12
|
-
getRowHeight: (rowId: import("@mui/x-virtualizer
|
|
12
|
+
getRowHeight: (rowId: import("@mui/x-virtualizer").RowId) => any;
|
|
13
13
|
setLastMeasuredRowIndex: (index: number) => void;
|
|
14
|
-
storeRowHeightMeasurement: (id: import("@mui/x-virtualizer
|
|
14
|
+
storeRowHeightMeasurement: (id: import("@mui/x-virtualizer").RowId, height: number) => void;
|
|
15
15
|
hydrateRowsMeta: () => void;
|
|
16
|
-
observeRowHeight: (element: Element, rowId: import("@mui/x-virtualizer
|
|
17
|
-
rowHasAutoHeight: (id: import("@mui/x-virtualizer
|
|
18
|
-
getRowHeightEntry: (rowId: import("@mui/x-virtualizer
|
|
16
|
+
observeRowHeight: (element: Element, rowId: import("@mui/x-virtualizer").RowId) => () => void | undefined;
|
|
17
|
+
rowHasAutoHeight: (id: import("@mui/x-virtualizer").RowId) => any;
|
|
18
|
+
getRowHeightEntry: (rowId: import("@mui/x-virtualizer").RowId) => any;
|
|
19
19
|
getLastMeasuredRowIndex: () => number;
|
|
20
20
|
resetRowHeights: () => void;
|
|
21
21
|
};
|
|
22
22
|
} & {
|
|
23
|
-
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer
|
|
24
|
-
calculateColSpan: (rowId: import("@mui/x-virtualizer
|
|
25
|
-
getHiddenCellsOrigin: () => Record<import("@mui/x-virtualizer
|
|
23
|
+
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer").CellColSpanInfo;
|
|
24
|
+
calculateColSpan: (rowId: import("@mui/x-virtualizer").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer").ColumnWithWidth[]) => void;
|
|
25
|
+
getHiddenCellsOrigin: () => Record<import("@mui/x-virtualizer").RowId, Record<number, number>>;
|
|
26
26
|
getters: any;
|
|
27
27
|
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
28
28
|
forceUpdateRenderContext: () => void;
|
|
29
29
|
scheduleUpdateRenderContext: () => void;
|
|
30
30
|
} & {
|
|
31
31
|
resetColSpan: () => void;
|
|
32
|
-
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer
|
|
33
|
-
calculateColSpan: (rowId: import("@mui/x-virtualizer
|
|
32
|
+
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer").CellColSpanInfo | undefined;
|
|
33
|
+
calculateColSpan: (rowId: import("@mui/x-virtualizer").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer").ColumnWithWidth[]) => void;
|
|
34
34
|
} & {
|
|
35
35
|
getHiddenCellsOrigin: () => Record<number, Record<number, number>>;
|
|
36
36
|
} & {
|
|
@@ -9,28 +9,28 @@ export declare function useGridVirtualizer(): {
|
|
|
9
9
|
updateDimensions: (firstUpdate?: boolean) => void;
|
|
10
10
|
debouncedUpdateDimensions: (((firstUpdate?: boolean) => void) & import("@mui/x-internals/throttle").Cancelable) | undefined;
|
|
11
11
|
rowsMeta: {
|
|
12
|
-
getRowHeight: (rowId: import("@mui/x-virtualizer
|
|
12
|
+
getRowHeight: (rowId: import("@mui/x-virtualizer").RowId) => any;
|
|
13
13
|
setLastMeasuredRowIndex: (index: number) => void;
|
|
14
|
-
storeRowHeightMeasurement: (id: import("@mui/x-virtualizer
|
|
14
|
+
storeRowHeightMeasurement: (id: import("@mui/x-virtualizer").RowId, height: number) => void;
|
|
15
15
|
hydrateRowsMeta: () => void;
|
|
16
|
-
observeRowHeight: (element: Element, rowId: import("@mui/x-virtualizer
|
|
17
|
-
rowHasAutoHeight: (id: import("@mui/x-virtualizer
|
|
18
|
-
getRowHeightEntry: (rowId: import("@mui/x-virtualizer
|
|
16
|
+
observeRowHeight: (element: Element, rowId: import("@mui/x-virtualizer").RowId) => () => void | undefined;
|
|
17
|
+
rowHasAutoHeight: (id: import("@mui/x-virtualizer").RowId) => any;
|
|
18
|
+
getRowHeightEntry: (rowId: import("@mui/x-virtualizer").RowId) => any;
|
|
19
19
|
getLastMeasuredRowIndex: () => number;
|
|
20
20
|
resetRowHeights: () => void;
|
|
21
21
|
};
|
|
22
22
|
} & {
|
|
23
|
-
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer
|
|
24
|
-
calculateColSpan: (rowId: import("@mui/x-virtualizer
|
|
25
|
-
getHiddenCellsOrigin: () => Record<import("@mui/x-virtualizer
|
|
23
|
+
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer").CellColSpanInfo;
|
|
24
|
+
calculateColSpan: (rowId: import("@mui/x-virtualizer").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer").ColumnWithWidth[]) => void;
|
|
25
|
+
getHiddenCellsOrigin: () => Record<import("@mui/x-virtualizer").RowId, Record<number, number>>;
|
|
26
26
|
getters: any;
|
|
27
27
|
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
28
28
|
forceUpdateRenderContext: () => void;
|
|
29
29
|
scheduleUpdateRenderContext: () => void;
|
|
30
30
|
} & {
|
|
31
31
|
resetColSpan: () => void;
|
|
32
|
-
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer
|
|
33
|
-
calculateColSpan: (rowId: import("@mui/x-virtualizer
|
|
32
|
+
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer").CellColSpanInfo | undefined;
|
|
33
|
+
calculateColSpan: (rowId: import("@mui/x-virtualizer").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer").ColumnWithWidth[]) => void;
|
|
34
34
|
} & {
|
|
35
35
|
getHiddenCellsOrigin: () => Record<number, Record<number, number>>;
|
|
36
36
|
} & {
|
|
@@ -110,12 +110,12 @@ const useGridColumnHeaders = props => {
|
|
|
110
110
|
const leftOffsetWidth = offsetLeft - leftOverflow;
|
|
111
111
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
112
112
|
children: [isNotPinned && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
113
|
-
role: "
|
|
113
|
+
role: "none",
|
|
114
114
|
style: {
|
|
115
115
|
width: leftOffsetWidth
|
|
116
116
|
}
|
|
117
117
|
}), children, isNotPinned && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
118
|
-
role: "
|
|
118
|
+
role: "none",
|
|
119
119
|
className: (0, _clsx.default)(_gridClasses.gridClasses.filler, _gridClasses.gridClasses['filler--horizontal'], borderBottom && _gridClasses.gridClasses['filler--borderBottom'])
|
|
120
120
|
}), hasScrollbarFiller && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridScrollbarFillerCell.GridScrollbarFillerCell, {
|
|
121
121
|
pinnedRight: isPinnedRight
|
|
@@ -103,12 +103,12 @@ export const useGridColumnHeaders = props => {
|
|
|
103
103
|
const leftOffsetWidth = offsetLeft - leftOverflow;
|
|
104
104
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
105
105
|
children: [isNotPinned && /*#__PURE__*/_jsx("div", {
|
|
106
|
-
role: "
|
|
106
|
+
role: "none",
|
|
107
107
|
style: {
|
|
108
108
|
width: leftOffsetWidth
|
|
109
109
|
}
|
|
110
110
|
}), children, isNotPinned && /*#__PURE__*/_jsx("div", {
|
|
111
|
-
role: "
|
|
111
|
+
role: "none",
|
|
112
112
|
className: clsx(gridClasses.filler, gridClasses['filler--horizontal'], borderBottom && gridClasses['filler--borderBottom'])
|
|
113
113
|
}), hasScrollbarFiller && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
114
114
|
pinnedRight: isPinnedRight
|
|
@@ -41,7 +41,7 @@ export interface GridDataSourceApiBase {
|
|
|
41
41
|
}
|
|
42
42
|
export interface GridDataSourceBaseOptions {
|
|
43
43
|
cacheOptions?: GridDataSourceCacheDefaultConfig;
|
|
44
|
-
fetchRowChildren?: (parents: GridRowId[],
|
|
44
|
+
fetchRowChildren?: (parents: GridRowId[], fetchParams: GridGetRowsParams[], showChildrenLoading?: boolean) => void;
|
|
45
45
|
clearDataSourceState?: () => void;
|
|
46
46
|
handleEditRow?: (params: GridUpdateRowParams, updatedRow: GridRowModel) => void;
|
|
47
47
|
}
|
|
@@ -41,7 +41,7 @@ export interface GridDataSourceApiBase {
|
|
|
41
41
|
}
|
|
42
42
|
export interface GridDataSourceBaseOptions {
|
|
43
43
|
cacheOptions?: GridDataSourceCacheDefaultConfig;
|
|
44
|
-
fetchRowChildren?: (parents: GridRowId[],
|
|
44
|
+
fetchRowChildren?: (parents: GridRowId[], fetchParams: GridGetRowsParams[], showChildrenLoading?: boolean) => void;
|
|
45
45
|
clearDataSourceState?: () => void;
|
|
46
46
|
handleEditRow?: (params: GridUpdateRowParams, updatedRow: GridRowModel) => void;
|
|
47
47
|
}
|
|
@@ -14,8 +14,8 @@ export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity
|
|
|
14
14
|
debouncedFetchRows: ((parentId?: GridRowId, params?: import("./models.mjs").GridDataSourceFetchRowsParams<import("@mui/x-data-grid").GridGetRowsParams>) => Promise<void>) & import("@mui/utils/debounce").Cancelable;
|
|
15
15
|
strategyProcessor: {
|
|
16
16
|
strategyName: DataSourceRowsUpdateStrategy;
|
|
17
|
-
group: "
|
|
18
|
-
processor: GridStrategyProcessor<"
|
|
17
|
+
group: "dataSourceRootRowsUpdate";
|
|
18
|
+
processor: GridStrategyProcessor<"dataSourceRootRowsUpdate">;
|
|
19
19
|
};
|
|
20
20
|
setStrategyAvailability: () => void;
|
|
21
21
|
startPolling: () => void;
|
|
@@ -14,8 +14,8 @@ export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity
|
|
|
14
14
|
debouncedFetchRows: ((parentId?: GridRowId, params?: import("./models.js").GridDataSourceFetchRowsParams<import("@mui/x-data-grid").GridGetRowsParams>) => Promise<void>) & import("@mui/utils/debounce").Cancelable;
|
|
15
15
|
strategyProcessor: {
|
|
16
16
|
strategyName: DataSourceRowsUpdateStrategy;
|
|
17
|
-
group: "
|
|
18
|
-
processor: GridStrategyProcessor<"
|
|
17
|
+
group: "dataSourceRootRowsUpdate";
|
|
18
|
+
processor: GridStrategyProcessor<"dataSourceRootRowsUpdate">;
|
|
19
19
|
};
|
|
20
20
|
setStrategyAvailability: () => void;
|
|
21
21
|
startPolling: () => void;
|
|
@@ -25,7 +25,7 @@ var _gridDataSourceSelector = require("./gridDataSourceSelector");
|
|
|
25
25
|
var _utils2 = require("./utils");
|
|
26
26
|
var _cache = require("./cache");
|
|
27
27
|
var _gridDataSourceError = require("./gridDataSourceError");
|
|
28
|
-
const _excluded = ["skipCache", "keepChildrenExpanded"];
|
|
28
|
+
const _excluded = ["skipCache", "keepChildrenExpanded", "showChildrenLoading"];
|
|
29
29
|
const noopCache = {
|
|
30
30
|
clear: () => {},
|
|
31
31
|
get: () => undefined,
|
|
@@ -64,22 +64,26 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
64
64
|
if (!getRows) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
if (parentId && parentId !== _gridRowsUtils.GRID_ROOT_GROUP_ID && props.signature !== 'DataGrid') {
|
|
68
|
-
options.fetchRowChildren?.([parentId]);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
options.clearDataSourceState?.();
|
|
72
67
|
const _ref = params || {},
|
|
73
68
|
{
|
|
74
69
|
skipCache,
|
|
75
|
-
keepChildrenExpanded
|
|
70
|
+
keepChildrenExpanded,
|
|
71
|
+
showChildrenLoading
|
|
76
72
|
} = _ref,
|
|
77
73
|
getRowsParams = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
78
74
|
const fetchParams = (0, _extends2.default)({}, (0, _gridDataSourceSelector.gridGetRowsParamsSelector)(apiRef), apiRef.current.unstable_applyPipeProcessors('getRowsParams', {}), getRowsParams);
|
|
75
|
+
if (parentId && parentId !== _gridRowsUtils.GRID_ROOT_GROUP_ID && props.signature !== 'DataGrid') {
|
|
76
|
+
options.fetchRowChildren?.([parentId], [fetchParams], showChildrenLoading);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
options.clearDataSourceState?.();
|
|
79
80
|
const cacheKeys = cacheChunkManager.getCacheKeys(fetchParams);
|
|
80
81
|
const responses = cacheKeys.map(cacheKey => cache.get(cacheKey));
|
|
81
82
|
if (!skipCache && responses.every(response => response !== undefined)) {
|
|
82
|
-
|
|
83
|
+
// Bump the request id so any cache-miss request still in flight is treated as
|
|
84
|
+
// stale and won't override the cached data we're about to apply.
|
|
85
|
+
lastRequestId.current += 1;
|
|
86
|
+
apiRef.current.applyStrategyProcessor('dataSourceRootRowsUpdate', {
|
|
83
87
|
response: _utils2.CacheChunkManager.mergeResponses(responses),
|
|
84
88
|
fetchParams,
|
|
85
89
|
options: {
|
|
@@ -87,6 +91,9 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
87
91
|
keepChildrenExpanded
|
|
88
92
|
}
|
|
89
93
|
});
|
|
94
|
+
if (standardRowsUpdateStrategyActive) {
|
|
95
|
+
apiRef.current.setLoading(false);
|
|
96
|
+
}
|
|
90
97
|
return;
|
|
91
98
|
}
|
|
92
99
|
|
|
@@ -101,7 +108,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
101
108
|
const cacheResponses = cacheChunkManager.splitResponse(fetchParams, getRowsResponse);
|
|
102
109
|
cacheResponses.forEach((response, key) => cache.set(key, response));
|
|
103
110
|
if (lastRequestId.current === requestId) {
|
|
104
|
-
apiRef.current.applyStrategyProcessor('
|
|
111
|
+
apiRef.current.applyStrategyProcessor('dataSourceRootRowsUpdate', {
|
|
105
112
|
response: getRowsResponse,
|
|
106
113
|
fetchParams,
|
|
107
114
|
options: {
|
|
@@ -112,7 +119,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
112
119
|
}
|
|
113
120
|
} catch (originalError) {
|
|
114
121
|
if (lastRequestId.current === requestId) {
|
|
115
|
-
apiRef.current.applyStrategyProcessor('
|
|
122
|
+
apiRef.current.applyStrategyProcessor('dataSourceRootRowsUpdate', {
|
|
116
123
|
error: originalError,
|
|
117
124
|
fetchParams,
|
|
118
125
|
options: {
|
|
@@ -159,9 +166,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
159
166
|
return acc;
|
|
160
167
|
}, []);
|
|
161
168
|
if (expandedGroupIds.length > 0) {
|
|
162
|
-
fetchRowChildrenOption(expandedGroupIds,
|
|
163
|
-
showChildrenLoading: false
|
|
164
|
-
});
|
|
169
|
+
fetchRowChildrenOption(expandedGroupIds, [], false);
|
|
165
170
|
}
|
|
166
171
|
};
|
|
167
172
|
const fetchParams = (0, _extends2.default)({}, (0, _gridDataSourceSelector.gridGetRowsParamsSelector)(apiRef), apiRef.current.unstable_applyPipeProcessors('getRowsParams', {}));
|
|
@@ -179,7 +184,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
179
184
|
}
|
|
180
185
|
const cacheResponses = cacheChunkManager.splitResponse(fetchParams, response);
|
|
181
186
|
cacheResponses.forEach((cacheResponse, key) => cache.set(key, cacheResponse));
|
|
182
|
-
apiRef.current.applyStrategyProcessor('
|
|
187
|
+
apiRef.current.applyStrategyProcessor('dataSourceRootRowsUpdate', {
|
|
183
188
|
response,
|
|
184
189
|
fetchParams,
|
|
185
190
|
options: {}
|
|
@@ -260,10 +265,17 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
260
265
|
};
|
|
261
266
|
const debouncedFetchRows = React.useMemo(() => (0, _debounce.default)(fetchRows, 0), [fetchRows]);
|
|
262
267
|
const handleFetchRowsOnParamsChange = React.useCallback(() => {
|
|
268
|
+
// Clear the rows first and immediately mark the grid as loading so the overlay
|
|
269
|
+
// selector never observes the intermediate `rows=[] && loading=false` state that
|
|
270
|
+
// would otherwise pick `noRowsOverlay`. Order matters: `setRows([])` rebuilds
|
|
271
|
+
// `state.rows` from `props.loading`, so the `setLoading(true)` call must come after
|
|
272
|
+
// it to survive the rebuild. This handler is only wired up when a standard strategy
|
|
273
|
+
// is active via the `runIf` guards on the returned `events` object.
|
|
263
274
|
apiRef.current.setRows([]);
|
|
275
|
+
apiRef.current.setLoading(true);
|
|
264
276
|
stopPolling();
|
|
265
277
|
debouncedFetchRows();
|
|
266
|
-
}, [stopPolling, debouncedFetchRows
|
|
278
|
+
}, [apiRef, stopPolling, debouncedFetchRows]);
|
|
267
279
|
const isFirstRender = React.useRef(true);
|
|
268
280
|
React.useEffect(() => {
|
|
269
281
|
if (isFirstRender.current) {
|
|
@@ -290,7 +302,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
290
302
|
React.useEffect(() => {
|
|
291
303
|
// Return early if the proper strategy isn't set yet
|
|
292
304
|
// Context: https://github.com/mui/mui-x/issues/19650
|
|
293
|
-
if (currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.Default && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.LazyLoading && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.GroupedData) {
|
|
305
|
+
if (currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.Default && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.LazyLoading && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.GroupedData && currentStrategy !== _utils2.DataSourceRowsUpdateStrategy.LazyLoadedGroupedData) {
|
|
294
306
|
return undefined;
|
|
295
307
|
}
|
|
296
308
|
if (props.dataSource) {
|
|
@@ -311,7 +323,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
|
|
|
311
323
|
debouncedFetchRows,
|
|
312
324
|
strategyProcessor: {
|
|
313
325
|
strategyName: _utils2.DataSourceRowsUpdateStrategy.Default,
|
|
314
|
-
group: '
|
|
326
|
+
group: 'dataSourceRootRowsUpdate',
|
|
315
327
|
processor: handleDataUpdate
|
|
316
328
|
},
|
|
317
329
|
setStrategyAvailability,
|