@mui/x-data-grid 8.20.0 → 8.21.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 +112 -0
- package/components/virtualization/GridVirtualScroller.js +5 -3
- package/components/virtualization/GridVirtualScrollerRenderZone.js +4 -16
- package/esm/components/virtualization/GridVirtualScroller.js +5 -3
- package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +3 -15
- package/esm/hooks/core/useGridVirtualizer.d.ts +6 -50
- package/esm/hooks/core/useGridVirtualizer.js +10 -9
- package/esm/hooks/features/columnResize/useGridColumnResize.js +17 -8
- package/esm/hooks/features/dimensions/useGridDimensions.js +3 -1
- package/esm/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/esm/index.js +1 -1
- package/hooks/core/useGridVirtualizer.d.ts +6 -50
- package/hooks/core/useGridVirtualizer.js +9 -8
- package/hooks/features/columnResize/useGridColumnResize.js +17 -8
- package/hooks/features/dimensions/useGridDimensions.js +3 -1
- package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,118 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.21.0
|
|
9
|
+
|
|
10
|
+
_Dec 3, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- ✨ Add [tick spacing property](https://mui.com/x/react-charts/axis/#tick-spacing) to charts axis to control the distance between ticks.
|
|
15
|
+
|
|
16
|
+
The following team members contributed to this release:
|
|
17
|
+
@alexfauquette, @bernardobelchior, @ElliottMiller, @Janpot, @JCQuintas, @romgrk, @sai6855, @siriwatknp
|
|
18
|
+
|
|
19
|
+
### Data Grid
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-data-grid@8.21.0`
|
|
22
|
+
|
|
23
|
+
- [DataGrid] Fix autosizing header width calculation (#20323) @siriwatknp
|
|
24
|
+
- [DataGrid] Virtualizer refactor (#19465) @romgrk
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-pro@8.21.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid@8.21.0`.
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-premium@8.21.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid-pro@8.21.0`, plus:
|
|
33
|
+
|
|
34
|
+
- [DataGridPremium] Prevent pasting to non-editable cells (#20333) @ElliottMiller
|
|
35
|
+
|
|
36
|
+
### Date and Time Pickers
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-date-pickers@8.21.0`
|
|
39
|
+
|
|
40
|
+
Internal changes.
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-date-pickers-pro@8.21.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
43
|
+
|
|
44
|
+
Same changes as in `@mui/x-date-pickers@8.21.0`.
|
|
45
|
+
|
|
46
|
+
### Charts
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-charts@8.21.0`
|
|
49
|
+
|
|
50
|
+
- [charts] Fix string measuring types (#20454) @bernardobelchior
|
|
51
|
+
- [charts] Fix typo in performance note for CustomLineMarks demo (#20529) @sai6855
|
|
52
|
+
- [charts] Introduce the notion of series with positions (#20461) @alexfauquette
|
|
53
|
+
- [charts] Migrate from sinon to Vitest mocking utilities for x-charts\* packages (#20444) @Copilot
|
|
54
|
+
- [charts] Move series-level values to series computed data in bar plot (#20467) @bernardobelchior
|
|
55
|
+
- [charts] Refactor bar chart components in preparation for range bar chart (#20521) @bernardobelchior
|
|
56
|
+
- [charts] Remove unnecessary `any` types (#20527) @sai6855
|
|
57
|
+
- [charts] Remove unused `drawingArea` from `findClosestPoints` (#20471) @bernardobelchior
|
|
58
|
+
- [charts] Revert `useIsHydrated` to default=false (#20511) @JCQuintas
|
|
59
|
+
- [charts] Support tooltip anchor position for radar (#20422) @alexfauquette
|
|
60
|
+
- [charts] Add tick spacing property (#20282) @bernardobelchior
|
|
61
|
+
- [charts] Fix Vitest lint error (#20550) @bernardobelchior
|
|
62
|
+
- [charts] Fix infinite loop when highlighting pie slices or scatter points (#20549) @bernardobelchior
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-charts-pro@8.21.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-charts@8.21.0`, plus:
|
|
67
|
+
|
|
68
|
+
- [charts-pro] Add support for `anchor="node"` on Sankey tooltip (#20462) @alexfauquette
|
|
69
|
+
|
|
70
|
+
#### `@mui/x-charts-premium@8.21.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
71
|
+
|
|
72
|
+
Same changes as in `@mui/x-charts-pro@8.21.0`.
|
|
73
|
+
|
|
74
|
+
### Tree View
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-tree-view@8.21.0`
|
|
77
|
+
|
|
78
|
+
Internal changes.
|
|
79
|
+
|
|
80
|
+
#### `@mui/x-tree-view-pro@8.21.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
81
|
+
|
|
82
|
+
Same changes as in `@mui/x-tree-view@8.21.0`.
|
|
83
|
+
|
|
84
|
+
### Codemod
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-codemod@8.21.0`
|
|
87
|
+
|
|
88
|
+
Internal changes.
|
|
89
|
+
|
|
90
|
+
### Docs
|
|
91
|
+
|
|
92
|
+
- [docs] Migrate to `next/font` for fonts loading (#20407) @Copilot
|
|
93
|
+
|
|
94
|
+
### Core
|
|
95
|
+
|
|
96
|
+
- [code-infra] Enable vitest eslint plugin (#20530) @Janpot
|
|
97
|
+
- [code-infra] Fix missing font loading for local fonts (#20480) @Janpot
|
|
98
|
+
- [internal] Performance: use raw `useSyncExternalStore` (#20447) @romgrk
|
|
99
|
+
- [code-infra] Enable `vitest/expect-expect` and `vitest/no-standalone-expect` rules for x-charts packages (#20535) @Copilot
|
|
100
|
+
|
|
101
|
+
### Miscellaneous
|
|
102
|
+
|
|
103
|
+
- Bump @types/d3-sankey to ^0.12.5 (#20489) @renovate[bot]
|
|
104
|
+
- Bump @types/react to 19.2.7 (#20490) @renovate[bot]
|
|
105
|
+
- Bump @types/yargs to ^17.0.35 (#20491) @renovate[bot]
|
|
106
|
+
- Bump Vite & Vitest to ^4.0.14 (#20500) @renovate[bot]
|
|
107
|
+
- Bump csstype to ^3.2.3 (#20493) @renovate[bot]
|
|
108
|
+
- Bump es-toolkit to ^1.42.0 (#20494) @renovate[bot]
|
|
109
|
+
- Bump eslint to ^8.48.0 (#20495) @renovate[bot]
|
|
110
|
+
- Bump lerna to ^9.0.3 (#20496) @renovate[bot]
|
|
111
|
+
- Bump lucide-react to ^0.555.0 (#20502) @renovate[bot]
|
|
112
|
+
- Bump playwright monorepo (#20503) @renovate[bot]
|
|
113
|
+
- Bump pnpm to 10.24.0 (#20504) @renovate[bot]
|
|
114
|
+
- Bump react monorepo (#20340) @renovate[bot]
|
|
115
|
+
- Bump react-hook-form to ^7.66.1 (#20497) @renovate[bot]
|
|
116
|
+
- Bump rimraf to ^6.1.2 (#20498) @renovate[bot]
|
|
117
|
+
- Bump webpack-bundle-analyzer to ^5.0.1 (#20508) @renovate[bot]
|
|
118
|
+
- Bump next to ^15.5.6 [SECURITY] (#20555) @renovate[bot]
|
|
119
|
+
|
|
8
120
|
## 8.20.0
|
|
9
121
|
|
|
10
122
|
_Nov 26, 2025_
|
|
@@ -96,6 +96,7 @@ function GridVirtualScroller(props) {
|
|
|
96
96
|
getContainerProps,
|
|
97
97
|
getScrollerProps,
|
|
98
98
|
getContentProps,
|
|
99
|
+
getPositionerProps,
|
|
99
100
|
getScrollbarVerticalProps,
|
|
100
101
|
getScrollbarHorizontalProps,
|
|
101
102
|
getRows,
|
|
@@ -128,12 +129,13 @@ function GridVirtualScroller(props) {
|
|
|
128
129
|
loadingOverlayVariant: loadingOverlayVariant,
|
|
129
130
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Overlay, (0, _extends2.default)({}, rootProps.slotProps?.[overlayType]))
|
|
130
131
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridVirtualScrollerContent.GridVirtualScrollerContent, (0, _extends2.default)({}, getContentProps(), {
|
|
131
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridVirtualScrollerRenderZone.GridVirtualScrollerRenderZone, {
|
|
132
|
-
role: "rowgroup"
|
|
132
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridVirtualScrollerRenderZone.GridVirtualScrollerRenderZone, (0, _extends2.default)({
|
|
133
|
+
role: "rowgroup"
|
|
134
|
+
}, getPositionerProps(), {
|
|
133
135
|
children: [rows, /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.detailPanels, {
|
|
134
136
|
virtualScroller: virtualScroller
|
|
135
137
|
})]
|
|
136
|
-
})
|
|
138
|
+
}))
|
|
137
139
|
})), hasBottomFiller && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridVirtualScrollerFiller.GridVirtualScrollerFiller, {
|
|
138
140
|
rowsLength: rows.length
|
|
139
141
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.bottomContainer, {
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.GridVirtualScrollerRenderZone = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
10
|
var React = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
12
|
var _system = require("@mui/system");
|
|
14
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
14
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
|
-
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
17
15
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
18
16
|
var _gridClasses = require("../../constants/gridClasses");
|
|
19
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["className"];
|
|
21
18
|
const useUtilityClasses = ownerState => {
|
|
22
19
|
const {
|
|
23
20
|
classes
|
|
@@ -37,21 +34,12 @@ const VirtualScrollerRenderZoneRoot = (0, _system.styled)('div', {
|
|
|
37
34
|
flexDirection: 'column'
|
|
38
35
|
});
|
|
39
36
|
const GridVirtualScrollerRenderZone = exports.GridVirtualScrollerRenderZone = (0, _forwardRef.forwardRef)(function GridVirtualScrollerRenderZone(props, ref) {
|
|
40
|
-
const {
|
|
41
|
-
className
|
|
42
|
-
} = props,
|
|
43
|
-
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
44
|
-
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
45
37
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
46
38
|
const classes = useUtilityClasses(rootProps);
|
|
47
|
-
const offsetTop = apiRef.current.virtualizer.api.getters.getOffsetTop();
|
|
48
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerRenderZoneRoot, (0, _extends2.default)({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
transform: `translate3d(0, ${offsetTop}px, 0)`
|
|
53
|
-
}
|
|
54
|
-
}, other, {
|
|
40
|
+
ownerState: rootProps
|
|
41
|
+
}, props, {
|
|
42
|
+
className: (0, _clsx.default)(classes.root, props.className),
|
|
55
43
|
ref: ref
|
|
56
44
|
}));
|
|
57
45
|
});
|
|
@@ -88,6 +88,7 @@ function GridVirtualScroller(props) {
|
|
|
88
88
|
getContainerProps,
|
|
89
89
|
getScrollerProps,
|
|
90
90
|
getContentProps,
|
|
91
|
+
getPositionerProps,
|
|
91
92
|
getScrollbarVerticalProps,
|
|
92
93
|
getScrollbarHorizontalProps,
|
|
93
94
|
getRows,
|
|
@@ -120,12 +121,13 @@ function GridVirtualScroller(props) {
|
|
|
120
121
|
loadingOverlayVariant: loadingOverlayVariant,
|
|
121
122
|
children: /*#__PURE__*/_jsx(Overlay, _extends({}, rootProps.slotProps?.[overlayType]))
|
|
122
123
|
}), /*#__PURE__*/_jsx(Content, _extends({}, getContentProps(), {
|
|
123
|
-
children: /*#__PURE__*/_jsxs(RenderZone, {
|
|
124
|
-
role: "rowgroup"
|
|
124
|
+
children: /*#__PURE__*/_jsxs(RenderZone, _extends({
|
|
125
|
+
role: "rowgroup"
|
|
126
|
+
}, getPositionerProps(), {
|
|
125
127
|
children: [rows, /*#__PURE__*/_jsx(rootProps.slots.detailPanels, {
|
|
126
128
|
virtualScroller: virtualScroller
|
|
127
129
|
})]
|
|
128
|
-
})
|
|
130
|
+
}))
|
|
129
131
|
})), hasBottomFiller && /*#__PURE__*/_jsx(SpaceFiller, {
|
|
130
132
|
rowsLength: rows.length
|
|
131
133
|
}), /*#__PURE__*/_jsx(rootProps.slots.bottomContainer, {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["className"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import clsx from 'clsx';
|
|
6
4
|
import { styled } from '@mui/system';
|
|
7
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
6
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
|
-
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
10
7
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
11
8
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
12
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -29,21 +26,12 @@ const VirtualScrollerRenderZoneRoot = styled('div', {
|
|
|
29
26
|
flexDirection: 'column'
|
|
30
27
|
});
|
|
31
28
|
const GridVirtualScrollerRenderZone = forwardRef(function GridVirtualScrollerRenderZone(props, ref) {
|
|
32
|
-
const {
|
|
33
|
-
className
|
|
34
|
-
} = props,
|
|
35
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
36
|
-
const apiRef = useGridPrivateApiContext();
|
|
37
29
|
const rootProps = useGridRootProps();
|
|
38
30
|
const classes = useUtilityClasses(rootProps);
|
|
39
|
-
const offsetTop = apiRef.current.virtualizer.api.getters.getOffsetTop();
|
|
40
31
|
return /*#__PURE__*/_jsx(VirtualScrollerRenderZoneRoot, _extends({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
transform: `translate3d(0, ${offsetTop}px, 0)`
|
|
45
|
-
}
|
|
46
|
-
}, other, {
|
|
32
|
+
ownerState: rootProps
|
|
33
|
+
}, props, {
|
|
34
|
+
className: clsx(classes.root, props.className),
|
|
47
35
|
ref: ref
|
|
48
36
|
}));
|
|
49
37
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Dimensions, Virtualization } from '@mui/x-virtualizer';
|
|
2
|
+
import { Dimensions, LayoutDataGridLegacy, Virtualization } from '@mui/x-virtualizer';
|
|
3
3
|
/**
|
|
4
4
|
* Virtualizer setup
|
|
5
5
|
*/
|
|
6
6
|
export declare function useGridVirtualizer(): {
|
|
7
|
-
store: import("@mui/x-internals/store").Store<Dimensions.State & Virtualization.State & import("@mui/x-virtualizer").Colspan.State & import("@mui/x-virtualizer").Rowspan.State>;
|
|
7
|
+
store: import("@mui/x-internals/store").Store<Dimensions.State & Virtualization.State<LayoutDataGridLegacy> & import("@mui/x-virtualizer").Colspan.State & import("@mui/x-virtualizer").Rowspan.State>;
|
|
8
8
|
api: {
|
|
9
9
|
updateDimensions: (firstUpdate?: boolean) => void;
|
|
10
10
|
debouncedUpdateDimensions: (((firstUpdate?: boolean) => void) & import("@mui/x-internals/throttle").Cancelable) | undefined;
|
|
@@ -20,57 +20,13 @@ export declare function useGridVirtualizer(): {
|
|
|
20
20
|
resetRowHeights: () => void;
|
|
21
21
|
};
|
|
22
22
|
} & {
|
|
23
|
-
getters: {
|
|
24
|
-
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
25
|
-
getOffsetTop: () => number;
|
|
26
|
-
getRows: (rowParams?: {
|
|
27
|
-
rows?: import("@mui/x-virtualizer/models").RowEntry[];
|
|
28
|
-
position?: import("@mui/x-virtualizer/models").PinnedRowPosition;
|
|
29
|
-
renderContext?: import("@mui/x-virtualizer/models").RenderContext;
|
|
30
|
-
}, unstable_rowTree?: Record<import("@mui/x-virtualizer/models").RowId, any>) => React.ReactNode[];
|
|
31
|
-
rows: import("@mui/x-virtualizer/models").RowEntry[];
|
|
32
|
-
getContainerProps: () => {
|
|
33
|
-
ref: (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
|
|
34
|
-
};
|
|
35
|
-
getScrollerProps: () => {
|
|
36
|
-
ref: (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
|
|
37
|
-
style: React.CSSProperties;
|
|
38
|
-
role: string;
|
|
39
|
-
tabIndex: number | undefined;
|
|
40
|
-
};
|
|
41
|
-
getContentProps: () => {
|
|
42
|
-
ref: (node: HTMLDivElement | null) => void;
|
|
43
|
-
style: React.CSSProperties;
|
|
44
|
-
role: string;
|
|
45
|
-
};
|
|
46
|
-
getScrollbarVerticalProps: () => {
|
|
47
|
-
ref: (node: HTMLDivElement | null) => void;
|
|
48
|
-
scrollPosition: React.RefObject<{
|
|
49
|
-
top: number;
|
|
50
|
-
left: number;
|
|
51
|
-
}>;
|
|
52
|
-
};
|
|
53
|
-
getScrollbarHorizontalProps: () => {
|
|
54
|
-
ref: (node: HTMLDivElement | null) => void;
|
|
55
|
-
scrollPosition: React.RefObject<{
|
|
56
|
-
top: number;
|
|
57
|
-
left: number;
|
|
58
|
-
}>;
|
|
59
|
-
};
|
|
60
|
-
getScrollAreaProps: () => {
|
|
61
|
-
scrollPosition: React.RefObject<{
|
|
62
|
-
top: number;
|
|
63
|
-
left: number;
|
|
64
|
-
}>;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
useVirtualization: () => import("@mui/x-virtualizer").BaseState;
|
|
68
|
-
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
69
|
-
forceUpdateRenderContext: () => void;
|
|
70
|
-
scheduleUpdateRenderContext: () => void;
|
|
71
23
|
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer/models").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer/models").CellColSpanInfo;
|
|
72
24
|
calculateColSpan: (rowId: import("@mui/x-virtualizer/models").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer/models").ColumnWithWidth[]) => void;
|
|
73
25
|
getHiddenCellsOrigin: () => Record<import("@mui/x-virtualizer/models").RowId, Record<number, number>>;
|
|
26
|
+
getters: any;
|
|
27
|
+
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
28
|
+
forceUpdateRenderContext: () => void;
|
|
29
|
+
scheduleUpdateRenderContext: () => void;
|
|
74
30
|
} & {
|
|
75
31
|
resetColSpan: () => void;
|
|
76
32
|
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer/models").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer/models").CellColSpanInfo | undefined;
|
|
@@ -6,7 +6,7 @@ import { useRtl } from '@mui/system/RtlProvider';
|
|
|
6
6
|
import { roundToDecimalPlaces } from '@mui/x-internals/math';
|
|
7
7
|
import { lruMemoize } from '@mui/x-internals/lruMemoize';
|
|
8
8
|
import { useStoreEffect } from '@mui/x-internals/store';
|
|
9
|
-
import { useVirtualizer, Dimensions, Virtualization, EMPTY_RENDER_CONTEXT } from '@mui/x-virtualizer';
|
|
9
|
+
import { useVirtualizer, Dimensions, LayoutDataGridLegacy, Virtualization, EMPTY_RENDER_CONTEXT } from '@mui/x-virtualizer';
|
|
10
10
|
import { useFirstRender } from "../utils/useFirstRender.js";
|
|
11
11
|
import { createSelector } from "../../utils/createSelector.js";
|
|
12
12
|
import { useGridSelector } from "../utils/useGridSelector.js";
|
|
@@ -91,6 +91,8 @@ export function useGridVirtualizer() {
|
|
|
91
91
|
rightPinnedWidth,
|
|
92
92
|
topPinnedHeight: headersTotalHeight,
|
|
93
93
|
bottomPinnedHeight: 0,
|
|
94
|
+
autoHeight,
|
|
95
|
+
minimalContentHeight,
|
|
94
96
|
scrollbarSize: rootProps.scrollbarSize
|
|
95
97
|
};
|
|
96
98
|
const addGridDimensions = useLazyRef(addGridDimensionsCreator).current;
|
|
@@ -113,13 +115,14 @@ export function useGridVirtualizer() {
|
|
|
113
115
|
const focusedVirtualCell = useGridSelector(apiRef, gridFocusedVirtualCellSelector);
|
|
114
116
|
// We need it to trigger a new render, but rowsMeta needs access to the latest value, hence we cannot pass it to the focusedVirtualCell callback in the virtualizer params
|
|
115
117
|
eslintUseValue(focusedVirtualCell);
|
|
118
|
+
const layout = useLazyRef(() => new LayoutDataGridLegacy({
|
|
119
|
+
container: apiRef.current.mainElementRef,
|
|
120
|
+
scroller: apiRef.current.virtualScrollerRef,
|
|
121
|
+
scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
|
|
122
|
+
scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
|
|
123
|
+
})).current;
|
|
116
124
|
const virtualizer = useVirtualizer({
|
|
117
|
-
|
|
118
|
-
container: apiRef.current.mainElementRef,
|
|
119
|
-
scroller: apiRef.current.virtualScrollerRef,
|
|
120
|
-
scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
|
|
121
|
-
scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
|
|
122
|
-
},
|
|
125
|
+
layout,
|
|
123
126
|
dimensions: dimensionsParams,
|
|
124
127
|
virtualization: {
|
|
125
128
|
isRtl,
|
|
@@ -148,10 +151,8 @@ export function useGridVirtualizer() {
|
|
|
148
151
|
columns: visibleColumns,
|
|
149
152
|
pinnedRows,
|
|
150
153
|
pinnedColumns,
|
|
151
|
-
autoHeight,
|
|
152
154
|
disableHorizontalScroll: listView,
|
|
153
155
|
disableVerticalScroll: overlayState.overlayType === 'noColumnsOverlay' || overlayState.loadingOverlayVariant === 'skeleton',
|
|
154
|
-
minimalContentHeight,
|
|
155
156
|
getRowHeight: React.useMemo(() => {
|
|
156
157
|
if (!getRowHeight) {
|
|
157
158
|
return undefined;
|
|
@@ -142,15 +142,24 @@ function extractColumnWidths(apiRef, options, columns) {
|
|
|
142
142
|
if (options.includeHeaders) {
|
|
143
143
|
const header = findGridHeader(apiRef.current, column.field);
|
|
144
144
|
if (header) {
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const iconContainer = header.querySelector(`.${gridClasses.iconButtonContainer}`);
|
|
145
|
+
const titleContainer = header.querySelector(`.${gridClasses.columnHeaderTitleContainer}`);
|
|
146
|
+
const children = Array.from(titleContainer.children);
|
|
148
147
|
const menuContainer = header.querySelector(`.${gridClasses.menuIcon}`);
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
|
|
148
|
+
const titleContainerStyle = window.getComputedStyle(titleContainer, null);
|
|
149
|
+
const gap = parseInt(titleContainerStyle.gap, 10) || 0;
|
|
150
|
+
const headerStyle = window.getComputedStyle(header, null);
|
|
151
|
+
const paddingWidth = parseInt(headerStyle.paddingLeft, 10) + parseInt(headerStyle.paddingRight, 10);
|
|
152
|
+
let totalChildren = 0;
|
|
153
|
+
let childrenWidth = 0;
|
|
154
|
+
for (let i = 0; i < children.length; i += 1) {
|
|
155
|
+
const child = children[i];
|
|
156
|
+
if (child.clientWidth > 0) {
|
|
157
|
+
totalChildren += 1;
|
|
158
|
+
childrenWidth += child.scrollWidth;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
childrenWidth += 1;
|
|
162
|
+
const width = childrenWidth + gap * (totalChildren - 1) + paddingWidth + (menuContainer?.clientWidth ?? 0);
|
|
154
163
|
filteredWidths.push(width);
|
|
155
164
|
}
|
|
156
165
|
}
|
|
@@ -39,7 +39,9 @@ const EMPTY_DIMENSIONS = {
|
|
|
39
39
|
rightPinnedWidth: 0,
|
|
40
40
|
headersTotalHeight: 0,
|
|
41
41
|
topContainerHeight: 0,
|
|
42
|
-
bottomContainerHeight: 0
|
|
42
|
+
bottomContainerHeight: 0,
|
|
43
|
+
autoHeight: false,
|
|
44
|
+
minimalContentHeight: undefined
|
|
43
45
|
};
|
|
44
46
|
export const dimensionsStateInitializer = (state, props, apiRef) => {
|
|
45
47
|
const dimensions = EMPTY_DIMENSIONS;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import { Virtualization } from '@mui/x-virtualizer';
|
|
2
|
+
import { Virtualization, LayoutDataGridLegacy } from '@mui/x-virtualizer';
|
|
3
3
|
import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
4
4
|
import { GridStateInitializer } from "../../utils/useGridInitializeState.js";
|
|
5
5
|
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
6
6
|
type RootProps = DataGridProcessedProps;
|
|
7
|
-
export type GridVirtualizationState = { [K in keyof Virtualization.State['virtualization']]: Virtualization.State['virtualization'][K] };
|
|
7
|
+
export type GridVirtualizationState = { [K in keyof Virtualization.State<LayoutDataGridLegacy>['virtualization']]: Virtualization.State<LayoutDataGridLegacy>['virtualization'][K] };
|
|
8
8
|
export declare const virtualizationStateInitializer: GridStateInitializer<RootProps>;
|
|
9
9
|
export declare function useGridVirtualization(apiRef: RefObject<GridPrivateApiCommunity>, rootProps: RootProps): void;
|
|
10
10
|
export {};
|
package/esm/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Dimensions, Virtualization } from '@mui/x-virtualizer';
|
|
2
|
+
import { Dimensions, LayoutDataGridLegacy, Virtualization } from '@mui/x-virtualizer';
|
|
3
3
|
/**
|
|
4
4
|
* Virtualizer setup
|
|
5
5
|
*/
|
|
6
6
|
export declare function useGridVirtualizer(): {
|
|
7
|
-
store: import("@mui/x-internals/store").Store<Dimensions.State & Virtualization.State & import("@mui/x-virtualizer").Colspan.State & import("@mui/x-virtualizer").Rowspan.State>;
|
|
7
|
+
store: import("@mui/x-internals/store").Store<Dimensions.State & Virtualization.State<LayoutDataGridLegacy> & import("@mui/x-virtualizer").Colspan.State & import("@mui/x-virtualizer").Rowspan.State>;
|
|
8
8
|
api: {
|
|
9
9
|
updateDimensions: (firstUpdate?: boolean) => void;
|
|
10
10
|
debouncedUpdateDimensions: (((firstUpdate?: boolean) => void) & import("@mui/x-internals/throttle").Cancelable) | undefined;
|
|
@@ -20,57 +20,13 @@ export declare function useGridVirtualizer(): {
|
|
|
20
20
|
resetRowHeights: () => void;
|
|
21
21
|
};
|
|
22
22
|
} & {
|
|
23
|
-
getters: {
|
|
24
|
-
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
25
|
-
getOffsetTop: () => number;
|
|
26
|
-
getRows: (rowParams?: {
|
|
27
|
-
rows?: import("@mui/x-virtualizer/models").RowEntry[];
|
|
28
|
-
position?: import("@mui/x-virtualizer/models").PinnedRowPosition;
|
|
29
|
-
renderContext?: import("@mui/x-virtualizer/models").RenderContext;
|
|
30
|
-
}, unstable_rowTree?: Record<import("@mui/x-virtualizer/models").RowId, any>) => React.ReactNode[];
|
|
31
|
-
rows: import("@mui/x-virtualizer/models").RowEntry[];
|
|
32
|
-
getContainerProps: () => {
|
|
33
|
-
ref: (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
|
|
34
|
-
};
|
|
35
|
-
getScrollerProps: () => {
|
|
36
|
-
ref: (node: HTMLDivElement | null) => (() => void | undefined) | undefined;
|
|
37
|
-
style: React.CSSProperties;
|
|
38
|
-
role: string;
|
|
39
|
-
tabIndex: number | undefined;
|
|
40
|
-
};
|
|
41
|
-
getContentProps: () => {
|
|
42
|
-
ref: (node: HTMLDivElement | null) => void;
|
|
43
|
-
style: React.CSSProperties;
|
|
44
|
-
role: string;
|
|
45
|
-
};
|
|
46
|
-
getScrollbarVerticalProps: () => {
|
|
47
|
-
ref: (node: HTMLDivElement | null) => void;
|
|
48
|
-
scrollPosition: React.RefObject<{
|
|
49
|
-
top: number;
|
|
50
|
-
left: number;
|
|
51
|
-
}>;
|
|
52
|
-
};
|
|
53
|
-
getScrollbarHorizontalProps: () => {
|
|
54
|
-
ref: (node: HTMLDivElement | null) => void;
|
|
55
|
-
scrollPosition: React.RefObject<{
|
|
56
|
-
top: number;
|
|
57
|
-
left: number;
|
|
58
|
-
}>;
|
|
59
|
-
};
|
|
60
|
-
getScrollAreaProps: () => {
|
|
61
|
-
scrollPosition: React.RefObject<{
|
|
62
|
-
top: number;
|
|
63
|
-
left: number;
|
|
64
|
-
}>;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
useVirtualization: () => import("@mui/x-virtualizer").BaseState;
|
|
68
|
-
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
69
|
-
forceUpdateRenderContext: () => void;
|
|
70
|
-
scheduleUpdateRenderContext: () => void;
|
|
71
23
|
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer/models").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer/models").CellColSpanInfo;
|
|
72
24
|
calculateColSpan: (rowId: import("@mui/x-virtualizer/models").RowId, minFirstColumn: import("@mui/x-internals/types").integer, maxLastColumn: import("@mui/x-internals/types").integer, columns: import("@mui/x-virtualizer/models").ColumnWithWidth[]) => void;
|
|
73
25
|
getHiddenCellsOrigin: () => Record<import("@mui/x-virtualizer/models").RowId, Record<number, number>>;
|
|
26
|
+
getters: any;
|
|
27
|
+
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<any, React.ReactNode>>>>;
|
|
28
|
+
forceUpdateRenderContext: () => void;
|
|
29
|
+
scheduleUpdateRenderContext: () => void;
|
|
74
30
|
} & {
|
|
75
31
|
resetColSpan: () => void;
|
|
76
32
|
getCellColSpanInfo: (rowId: import("@mui/x-virtualizer/models").RowId, columnIndex: import("@mui/x-internals/types").integer) => import("@mui/x-virtualizer/models").CellColSpanInfo | undefined;
|
|
@@ -99,6 +99,8 @@ function useGridVirtualizer() {
|
|
|
99
99
|
rightPinnedWidth,
|
|
100
100
|
topPinnedHeight: headersTotalHeight,
|
|
101
101
|
bottomPinnedHeight: 0,
|
|
102
|
+
autoHeight,
|
|
103
|
+
minimalContentHeight: _gridRowsUtils.minimalContentHeight,
|
|
102
104
|
scrollbarSize: rootProps.scrollbarSize
|
|
103
105
|
};
|
|
104
106
|
const addGridDimensions = (0, _useLazyRef.default)(addGridDimensionsCreator).current;
|
|
@@ -121,13 +123,14 @@ function useGridVirtualizer() {
|
|
|
121
123
|
const focusedVirtualCell = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusedVirtualCellSelector.gridFocusedVirtualCellSelector);
|
|
122
124
|
// We need it to trigger a new render, but rowsMeta needs access to the latest value, hence we cannot pass it to the focusedVirtualCell callback in the virtualizer params
|
|
123
125
|
(0, _utils.eslintUseValue)(focusedVirtualCell);
|
|
126
|
+
const layout = (0, _useLazyRef.default)(() => new _xVirtualizer.LayoutDataGridLegacy({
|
|
127
|
+
container: apiRef.current.mainElementRef,
|
|
128
|
+
scroller: apiRef.current.virtualScrollerRef,
|
|
129
|
+
scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
|
|
130
|
+
scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
|
|
131
|
+
})).current;
|
|
124
132
|
const virtualizer = (0, _xVirtualizer.useVirtualizer)({
|
|
125
|
-
|
|
126
|
-
container: apiRef.current.mainElementRef,
|
|
127
|
-
scroller: apiRef.current.virtualScrollerRef,
|
|
128
|
-
scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
|
|
129
|
-
scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
|
|
130
|
-
},
|
|
133
|
+
layout,
|
|
131
134
|
dimensions: dimensionsParams,
|
|
132
135
|
virtualization: {
|
|
133
136
|
isRtl,
|
|
@@ -156,10 +159,8 @@ function useGridVirtualizer() {
|
|
|
156
159
|
columns: visibleColumns,
|
|
157
160
|
pinnedRows,
|
|
158
161
|
pinnedColumns,
|
|
159
|
-
autoHeight,
|
|
160
162
|
disableHorizontalScroll: listView,
|
|
161
163
|
disableVerticalScroll: overlayState.overlayType === 'noColumnsOverlay' || overlayState.loadingOverlayVariant === 'skeleton',
|
|
162
|
-
minimalContentHeight: _gridRowsUtils.minimalContentHeight,
|
|
163
164
|
getRowHeight: React.useMemo(() => {
|
|
164
165
|
if (!getRowHeight) {
|
|
165
166
|
return undefined;
|
|
@@ -149,15 +149,24 @@ function extractColumnWidths(apiRef, options, columns) {
|
|
|
149
149
|
if (options.includeHeaders) {
|
|
150
150
|
const header = (0, _domUtils.findGridHeader)(apiRef.current, column.field);
|
|
151
151
|
if (header) {
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
const iconContainer = header.querySelector(`.${_gridClasses.gridClasses.iconButtonContainer}`);
|
|
152
|
+
const titleContainer = header.querySelector(`.${_gridClasses.gridClasses.columnHeaderTitleContainer}`);
|
|
153
|
+
const children = Array.from(titleContainer.children);
|
|
155
154
|
const menuContainer = header.querySelector(`.${_gridClasses.gridClasses.menuIcon}`);
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
|
|
155
|
+
const titleContainerStyle = window.getComputedStyle(titleContainer, null);
|
|
156
|
+
const gap = parseInt(titleContainerStyle.gap, 10) || 0;
|
|
157
|
+
const headerStyle = window.getComputedStyle(header, null);
|
|
158
|
+
const paddingWidth = parseInt(headerStyle.paddingLeft, 10) + parseInt(headerStyle.paddingRight, 10);
|
|
159
|
+
let totalChildren = 0;
|
|
160
|
+
let childrenWidth = 0;
|
|
161
|
+
for (let i = 0; i < children.length; i += 1) {
|
|
162
|
+
const child = children[i];
|
|
163
|
+
if (child.clientWidth > 0) {
|
|
164
|
+
totalChildren += 1;
|
|
165
|
+
childrenWidth += child.scrollWidth;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
childrenWidth += 1;
|
|
169
|
+
const width = childrenWidth + gap * (totalChildren - 1) + paddingWidth + (menuContainer?.clientWidth ?? 0);
|
|
161
170
|
filteredWidths.push(width);
|
|
162
171
|
}
|
|
163
172
|
}
|
|
@@ -47,7 +47,9 @@ const EMPTY_DIMENSIONS = {
|
|
|
47
47
|
rightPinnedWidth: 0,
|
|
48
48
|
headersTotalHeight: 0,
|
|
49
49
|
topContainerHeight: 0,
|
|
50
|
-
bottomContainerHeight: 0
|
|
50
|
+
bottomContainerHeight: 0,
|
|
51
|
+
autoHeight: false,
|
|
52
|
+
minimalContentHeight: undefined
|
|
51
53
|
};
|
|
52
54
|
const dimensionsStateInitializer = (state, props, apiRef) => {
|
|
53
55
|
const dimensions = EMPTY_DIMENSIONS;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import { Virtualization } from '@mui/x-virtualizer';
|
|
2
|
+
import { Virtualization, LayoutDataGridLegacy } from '@mui/x-virtualizer';
|
|
3
3
|
import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
4
4
|
import { GridStateInitializer } from "../../utils/useGridInitializeState.js";
|
|
5
5
|
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
6
6
|
type RootProps = DataGridProcessedProps;
|
|
7
|
-
export type GridVirtualizationState = { [K in keyof Virtualization.State['virtualization']]: Virtualization.State['virtualization'][K] };
|
|
7
|
+
export type GridVirtualizationState = { [K in keyof Virtualization.State<LayoutDataGridLegacy>['virtualization']]: Virtualization.State<LayoutDataGridLegacy>['virtualization'][K] };
|
|
8
8
|
export declare const virtualizationStateInitializer: GridStateInitializer<RootProps>;
|
|
9
9
|
export declare function useGridVirtualization(apiRef: RefObject<GridPrivateApiCommunity>, rootProps: RootProps): void;
|
|
10
10
|
export {};
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.21.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Community plan edition of the MUI X Data Grid components.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"use-sync-external-store": "^1.6.0",
|
|
45
|
-
"@mui/x-internals": "8.
|
|
46
|
-
"@mui/x-virtualizer": "0.2.
|
|
45
|
+
"@mui/x-internals": "8.21.0",
|
|
46
|
+
"@mui/x-virtualizer": "0.2.11"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@emotion/react": "^11.9.0",
|