@mui/x-data-grid 7.29.9 → 7.29.12
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 +83 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +13 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +12 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
- package/hooks/features/export/useGridPrintExport.js +2 -7
- package/hooks/utils/useGridApiEventHandler.js +6 -2
- package/index.js +1 -1
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +13 -1
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +12 -3
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
- package/modern/hooks/features/export/useGridPrintExport.js +2 -7
- package/modern/hooks/utils/useGridApiEventHandler.js +6 -2
- package/modern/index.js +1 -1
- package/node/components/columnHeaders/GridColumnGroupHeader.js +13 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +12 -3
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -14
- package/node/hooks/features/export/useGridPrintExport.js +2 -7
- package/node/hooks/utils/useGridApiEventHandler.js +6 -2
- package/node/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,89 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.29.12
|
|
7
|
+
|
|
8
|
+
_Nov 26, 2025_
|
|
9
|
+
|
|
10
|
+
We'd like to extend a big thank you to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
|
|
14
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
15
|
+
@m2mathew
|
|
16
|
+
|
|
17
|
+
Following are all team members who have contributed to this release:
|
|
18
|
+
@arminmeh
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@7.29.12`
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Avoid automatic scroll back to the focused element after it leaves the viewport (#20417) @arminmeh
|
|
25
|
+
- [DataGrid] Fix missing rows in the print export window (#20157) @m2mathew
|
|
26
|
+
|
|
27
|
+
#### `@mui/x-data-grid-pro@7.29.12` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
28
|
+
|
|
29
|
+
Same changes as in `@mui/x-data-grid@7.29.12`.
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-premium@7.29.12` [](https://mui.com/r/x-premium-svg-link "Premium plan")
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid-pro@7.29.12`.
|
|
34
|
+
|
|
35
|
+
## 7.29.11
|
|
36
|
+
|
|
37
|
+
_Nov 19, 2025_
|
|
38
|
+
|
|
39
|
+
We'd like to extend a big thank you to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
40
|
+
|
|
41
|
+
- 🐞 Bugfixes
|
|
42
|
+
|
|
43
|
+
Following are all team members who have contributed to this release:
|
|
44
|
+
@arminmeh, @mapache-salvaje
|
|
45
|
+
|
|
46
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
47
|
+
|
|
48
|
+
### Data Grid
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-data-grid@7.29.11`
|
|
51
|
+
|
|
52
|
+
- [DataGrid] Prevent Safari 26 error in the event handler (#20382) @arminmeh
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-data-grid-pro@7.29.11` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
55
|
+
|
|
56
|
+
Same changes as in `@mui/x-data-grid@7.29.11`.
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-data-grid-premium@7.29.11` [](https://mui.com/r/x-premium-svg-link "Premium plan")
|
|
59
|
+
|
|
60
|
+
Same changes as in `@mui/x-data-grid-pro@7.29.11`.
|
|
61
|
+
|
|
62
|
+
### Docs
|
|
63
|
+
|
|
64
|
+
- [docs] Revise the Pro filter docs (#18815) @mapache-salvaje
|
|
65
|
+
|
|
66
|
+
## v7.29.10
|
|
67
|
+
|
|
68
|
+
_Sep 25, 2025_
|
|
69
|
+
|
|
70
|
+
We'd like to extend a big thank you to the 1 contributor who made this release possible. Here are some highlights ✨:
|
|
71
|
+
|
|
72
|
+
- 🐞 Bugfixes
|
|
73
|
+
|
|
74
|
+
The following is the team member who have contributed to this release:
|
|
75
|
+
@flaviendelangle
|
|
76
|
+
|
|
77
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
78
|
+
|
|
79
|
+
### Tree View
|
|
80
|
+
|
|
81
|
+
#### `@mui/x-tree-view@7.29.10`
|
|
82
|
+
|
|
83
|
+
- [tree view] Fix the expansion toggle on icon container with old DOM structure (#19546) @flaviendelangle
|
|
84
|
+
|
|
85
|
+
#### `@mui/x-tree-view-pro@7.29.10` [](https://mui.com/r/x-pro-svg-link "Pro plan")
|
|
86
|
+
|
|
87
|
+
Same changes as in `@mui/x-tree-view@7.29.10`.
|
|
88
|
+
|
|
6
89
|
## 7.29.9
|
|
7
90
|
|
|
8
91
|
_Aug 7, 2025_
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_useId as useId, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
4
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
5
|
+
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
5
6
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
6
7
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
7
8
|
import { gridColumnGroupsLookupSelector } from "../../hooks/features/columnGrouping/gridColumnGroupsSelector.js";
|
|
@@ -86,7 +87,18 @@ function GridColumnGroupHeader(props) {
|
|
|
86
87
|
if (hasFocus) {
|
|
87
88
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
88
89
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
89
|
-
elementToFocus
|
|
90
|
+
if (!elementToFocus) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (doesSupportPreventScroll()) {
|
|
94
|
+
elementToFocus.focus({
|
|
95
|
+
preventScroll: true
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
99
|
+
elementToFocus.focus();
|
|
100
|
+
apiRef.current.scroll(scrollPosition);
|
|
101
|
+
}
|
|
90
102
|
}
|
|
91
103
|
}, [apiRef, hasFocus]);
|
|
92
104
|
const publish = React.useCallback(eventName => event => {
|
|
@@ -5,6 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
6
6
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
7
7
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
|
+
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
8
9
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
9
10
|
import { ColumnHeaderMenuIcon } from "./ColumnHeaderMenuIcon.js";
|
|
10
11
|
import { GridColumnHeaderMenu } from "../menu/columnMenu/GridColumnHeaderMenu.js";
|
|
@@ -160,9 +161,17 @@ function GridColumnHeaderItem(props) {
|
|
|
160
161
|
if (hasFocus && !columnMenuState.open) {
|
|
161
162
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
162
163
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
163
|
-
elementToFocus
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
if (!elementToFocus) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (doesSupportPreventScroll()) {
|
|
168
|
+
elementToFocus.focus({
|
|
169
|
+
preventScroll: true
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
173
|
+
elementToFocus.focus();
|
|
174
|
+
apiRef.current.scroll(scrollPosition);
|
|
166
175
|
}
|
|
167
176
|
}
|
|
168
177
|
}, [apiRef, hasFocus]);
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
7
7
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
|
-
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
9
8
|
import { GridColumnHeaderTitle } from "./GridColumnHeaderTitle.js";
|
|
10
9
|
import { GridColumnHeaderSeparator } from "./GridColumnHeaderSeparator.js";
|
|
11
10
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
@@ -17,7 +16,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
17
16
|
height,
|
|
18
17
|
isResizing,
|
|
19
18
|
sortDirection,
|
|
20
|
-
hasFocus,
|
|
21
19
|
tabIndex,
|
|
22
20
|
separatorSide,
|
|
23
21
|
isDraggable,
|
|
@@ -35,7 +33,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
35
33
|
style
|
|
36
34
|
} = props,
|
|
37
35
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
|
-
const apiRef = useGridPrivateApiContext();
|
|
39
36
|
const rootProps = useGridRootProps();
|
|
40
37
|
const headerCellRef = React.useRef(null);
|
|
41
38
|
const handleRef = useForkRef(headerCellRef, ref);
|
|
@@ -43,17 +40,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
43
40
|
if (sortDirection != null) {
|
|
44
41
|
ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
|
|
45
42
|
}
|
|
46
|
-
React.useLayoutEffect(() => {
|
|
47
|
-
const columnMenuState = apiRef.current.state.columnMenu;
|
|
48
|
-
if (hasFocus && !columnMenuState.open) {
|
|
49
|
-
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
50
|
-
const elementToFocus = focusableElement || headerCellRef.current;
|
|
51
|
-
elementToFocus?.focus();
|
|
52
|
-
if (apiRef.current.columnHeadersContainerRef?.current) {
|
|
53
|
-
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, [apiRef, hasFocus]);
|
|
57
43
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
58
44
|
className: clsx(classes.root, headerClassName),
|
|
59
45
|
style: _extends({}, style, {
|
|
@@ -201,7 +201,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
201
201
|
// Revert grid to previous state
|
|
202
202
|
apiRef.current.restoreState(previousGridState.current || {});
|
|
203
203
|
if (!previousGridState.current?.columns?.columnVisibilityModel) {
|
|
204
|
-
// if the apiRef.current.exportState(); did not
|
|
204
|
+
// if the apiRef.current.exportState(); did not export the column visibility, we update it
|
|
205
205
|
apiRef.current.setColumnVisibilityModel(previousColumnVisibility.current);
|
|
206
206
|
}
|
|
207
207
|
apiRef.current.setState(state => _extends({}, state, {
|
|
@@ -238,12 +238,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
238
238
|
}));
|
|
239
239
|
}
|
|
240
240
|
previousVirtualizationState.current = apiRef.current.state.virtualization;
|
|
241
|
-
apiRef.current.
|
|
242
|
-
virtualization: _extends({}, state.virtualization, {
|
|
243
|
-
enabled: false,
|
|
244
|
-
enabledForColumns: false
|
|
245
|
-
})
|
|
246
|
-
}));
|
|
241
|
+
apiRef.current.unstable_setVirtualization(false);
|
|
247
242
|
await updateGridColumnsForPrint(options?.fields, options?.allColumns, options?.includeCheckboxes);
|
|
248
243
|
updateGridRowsForPrint(options?.getRowsToExport ?? defaultGetRowsToExport);
|
|
249
244
|
await raf(); // wait for the state changes to take action
|
|
@@ -29,7 +29,9 @@ export function createUseGridApiEventHandler(registryContainer) {
|
|
|
29
29
|
const cleanupTokenRef = React.useRef(null);
|
|
30
30
|
if (!subscription.current && handlerRef.current) {
|
|
31
31
|
const enhancedHandler = (params, event, details) => {
|
|
32
|
-
|
|
32
|
+
// Check for the existence of the event once more to avoid Safari 26 issue
|
|
33
|
+
// https://github.com/mui/mui-x/issues/20159
|
|
34
|
+
if (event && !event.defaultMuiPrevented) {
|
|
33
35
|
handlerRef.current?.(params, event, details);
|
|
34
36
|
}
|
|
35
37
|
};
|
|
@@ -56,7 +58,9 @@ export function createUseGridApiEventHandler(registryContainer) {
|
|
|
56
58
|
React.useEffect(() => {
|
|
57
59
|
if (!subscription.current && handlerRef.current) {
|
|
58
60
|
const enhancedHandler = (params, event, details) => {
|
|
59
|
-
|
|
61
|
+
// Check for the existence of the event once more to avoid Safari 26 issue
|
|
62
|
+
// https://github.com/mui/mui-x/issues/20159
|
|
63
|
+
if (event && !event.defaultMuiPrevented) {
|
|
60
64
|
handlerRef.current?.(params, event, details);
|
|
61
65
|
}
|
|
62
66
|
};
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_useId as useId, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
4
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
5
|
+
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
5
6
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
6
7
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
7
8
|
import { gridColumnGroupsLookupSelector } from "../../hooks/features/columnGrouping/gridColumnGroupsSelector.js";
|
|
@@ -86,7 +87,18 @@ function GridColumnGroupHeader(props) {
|
|
|
86
87
|
if (hasFocus) {
|
|
87
88
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
88
89
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
89
|
-
elementToFocus
|
|
90
|
+
if (!elementToFocus) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (doesSupportPreventScroll()) {
|
|
94
|
+
elementToFocus.focus({
|
|
95
|
+
preventScroll: true
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
99
|
+
elementToFocus.focus();
|
|
100
|
+
apiRef.current.scroll(scrollPosition);
|
|
101
|
+
}
|
|
90
102
|
}
|
|
91
103
|
}, [apiRef, hasFocus]);
|
|
92
104
|
const publish = React.useCallback(eventName => event => {
|
|
@@ -5,6 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
6
6
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
7
7
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
|
+
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
8
9
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
9
10
|
import { ColumnHeaderMenuIcon } from "./ColumnHeaderMenuIcon.js";
|
|
10
11
|
import { GridColumnHeaderMenu } from "../menu/columnMenu/GridColumnHeaderMenu.js";
|
|
@@ -160,9 +161,17 @@ function GridColumnHeaderItem(props) {
|
|
|
160
161
|
if (hasFocus && !columnMenuState.open) {
|
|
161
162
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
162
163
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
163
|
-
elementToFocus
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
if (!elementToFocus) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (doesSupportPreventScroll()) {
|
|
168
|
+
elementToFocus.focus({
|
|
169
|
+
preventScroll: true
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
173
|
+
elementToFocus.focus();
|
|
174
|
+
apiRef.current.scroll(scrollPosition);
|
|
166
175
|
}
|
|
167
176
|
}
|
|
168
177
|
}, [apiRef, hasFocus]);
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
7
7
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
|
-
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
9
8
|
import { GridColumnHeaderTitle } from "./GridColumnHeaderTitle.js";
|
|
10
9
|
import { GridColumnHeaderSeparator } from "./GridColumnHeaderSeparator.js";
|
|
11
10
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
@@ -17,7 +16,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
17
16
|
height,
|
|
18
17
|
isResizing,
|
|
19
18
|
sortDirection,
|
|
20
|
-
hasFocus,
|
|
21
19
|
tabIndex,
|
|
22
20
|
separatorSide,
|
|
23
21
|
isDraggable,
|
|
@@ -35,7 +33,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
35
33
|
style
|
|
36
34
|
} = props,
|
|
37
35
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
|
-
const apiRef = useGridPrivateApiContext();
|
|
39
36
|
const rootProps = useGridRootProps();
|
|
40
37
|
const headerCellRef = React.useRef(null);
|
|
41
38
|
const handleRef = useForkRef(headerCellRef, ref);
|
|
@@ -43,17 +40,6 @@ const GridGenericColumnHeaderItem = forwardRef(function GridGenericColumnHeaderI
|
|
|
43
40
|
if (sortDirection != null) {
|
|
44
41
|
ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
|
|
45
42
|
}
|
|
46
|
-
React.useLayoutEffect(() => {
|
|
47
|
-
const columnMenuState = apiRef.current.state.columnMenu;
|
|
48
|
-
if (hasFocus && !columnMenuState.open) {
|
|
49
|
-
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
50
|
-
const elementToFocus = focusableElement || headerCellRef.current;
|
|
51
|
-
elementToFocus?.focus();
|
|
52
|
-
if (apiRef.current.columnHeadersContainerRef?.current) {
|
|
53
|
-
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, [apiRef, hasFocus]);
|
|
57
43
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
58
44
|
className: clsx(classes.root, headerClassName),
|
|
59
45
|
style: _extends({}, style, {
|
|
@@ -201,7 +201,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
201
201
|
// Revert grid to previous state
|
|
202
202
|
apiRef.current.restoreState(previousGridState.current || {});
|
|
203
203
|
if (!previousGridState.current?.columns?.columnVisibilityModel) {
|
|
204
|
-
// if the apiRef.current.exportState(); did not
|
|
204
|
+
// if the apiRef.current.exportState(); did not export the column visibility, we update it
|
|
205
205
|
apiRef.current.setColumnVisibilityModel(previousColumnVisibility.current);
|
|
206
206
|
}
|
|
207
207
|
apiRef.current.setState(state => _extends({}, state, {
|
|
@@ -238,12 +238,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
238
238
|
}));
|
|
239
239
|
}
|
|
240
240
|
previousVirtualizationState.current = apiRef.current.state.virtualization;
|
|
241
|
-
apiRef.current.
|
|
242
|
-
virtualization: _extends({}, state.virtualization, {
|
|
243
|
-
enabled: false,
|
|
244
|
-
enabledForColumns: false
|
|
245
|
-
})
|
|
246
|
-
}));
|
|
241
|
+
apiRef.current.unstable_setVirtualization(false);
|
|
247
242
|
await updateGridColumnsForPrint(options?.fields, options?.allColumns, options?.includeCheckboxes);
|
|
248
243
|
updateGridRowsForPrint(options?.getRowsToExport ?? defaultGetRowsToExport);
|
|
249
244
|
await raf(); // wait for the state changes to take action
|
|
@@ -29,7 +29,9 @@ export function createUseGridApiEventHandler(registryContainer) {
|
|
|
29
29
|
const cleanupTokenRef = React.useRef(null);
|
|
30
30
|
if (!subscription.current && handlerRef.current) {
|
|
31
31
|
const enhancedHandler = (params, event, details) => {
|
|
32
|
-
|
|
32
|
+
// Check for the existence of the event once more to avoid Safari 26 issue
|
|
33
|
+
// https://github.com/mui/mui-x/issues/20159
|
|
34
|
+
if (event && !event.defaultMuiPrevented) {
|
|
33
35
|
handlerRef.current?.(params, event, details);
|
|
34
36
|
}
|
|
35
37
|
};
|
|
@@ -56,7 +58,9 @@ export function createUseGridApiEventHandler(registryContainer) {
|
|
|
56
58
|
React.useEffect(() => {
|
|
57
59
|
if (!subscription.current && handlerRef.current) {
|
|
58
60
|
const enhancedHandler = (params, event, details) => {
|
|
59
|
-
|
|
61
|
+
// Check for the existence of the event once more to avoid Safari 26 issue
|
|
62
|
+
// https://github.com/mui/mui-x/issues/20159
|
|
63
|
+
if (event && !event.defaultMuiPrevented) {
|
|
60
64
|
handlerRef.current?.(params, event, details);
|
|
61
65
|
}
|
|
62
66
|
};
|
package/modern/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _utils = require("@mui/utils");
|
|
12
12
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
13
|
+
var _doesSupportPreventScroll = require("../../utils/doesSupportPreventScroll");
|
|
13
14
|
var _gridClasses = require("../../constants/gridClasses");
|
|
14
15
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
15
16
|
var _gridColumnGroupsSelector = require("../../hooks/features/columnGrouping/gridColumnGroupsSelector");
|
|
@@ -94,7 +95,18 @@ function GridColumnGroupHeader(props) {
|
|
|
94
95
|
if (hasFocus) {
|
|
95
96
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
96
97
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
97
|
-
elementToFocus
|
|
98
|
+
if (!elementToFocus) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if ((0, _doesSupportPreventScroll.doesSupportPreventScroll)()) {
|
|
102
|
+
elementToFocus.focus({
|
|
103
|
+
preventScroll: true
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
107
|
+
elementToFocus.focus();
|
|
108
|
+
apiRef.current.scroll(scrollPosition);
|
|
109
|
+
}
|
|
98
110
|
}
|
|
99
111
|
}, [apiRef, hasFocus]);
|
|
100
112
|
const publish = React.useCallback(eventName => event => {
|
|
@@ -13,6 +13,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
14
|
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
15
15
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
16
|
+
var _doesSupportPreventScroll = require("../../utils/doesSupportPreventScroll");
|
|
16
17
|
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
17
18
|
var _ColumnHeaderMenuIcon = require("./ColumnHeaderMenuIcon");
|
|
18
19
|
var _GridColumnHeaderMenu = require("../menu/columnMenu/GridColumnHeaderMenu");
|
|
@@ -168,9 +169,17 @@ function GridColumnHeaderItem(props) {
|
|
|
168
169
|
if (hasFocus && !columnMenuState.open) {
|
|
169
170
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
170
171
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
171
|
-
elementToFocus
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
if (!elementToFocus) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if ((0, _doesSupportPreventScroll.doesSupportPreventScroll)()) {
|
|
176
|
+
elementToFocus.focus({
|
|
177
|
+
preventScroll: true
|
|
178
|
+
});
|
|
179
|
+
} else {
|
|
180
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
181
|
+
elementToFocus.focus();
|
|
182
|
+
apiRef.current.scroll(scrollPosition);
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
}, [apiRef, hasFocus]);
|
|
@@ -12,7 +12,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
14
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
15
|
-
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
16
15
|
var _GridColumnHeaderTitle = require("./GridColumnHeaderTitle");
|
|
17
16
|
var _GridColumnHeaderSeparator = require("./GridColumnHeaderSeparator");
|
|
18
17
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
@@ -25,7 +24,6 @@ const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = (0, _f
|
|
|
25
24
|
height,
|
|
26
25
|
isResizing,
|
|
27
26
|
sortDirection,
|
|
28
|
-
hasFocus,
|
|
29
27
|
tabIndex,
|
|
30
28
|
separatorSide,
|
|
31
29
|
isDraggable,
|
|
@@ -43,7 +41,6 @@ const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = (0, _f
|
|
|
43
41
|
style
|
|
44
42
|
} = props,
|
|
45
43
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
46
|
-
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
47
44
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
48
45
|
const headerCellRef = React.useRef(null);
|
|
49
46
|
const handleRef = (0, _utils.unstable_useForkRef)(headerCellRef, ref);
|
|
@@ -51,17 +48,6 @@ const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = (0, _f
|
|
|
51
48
|
if (sortDirection != null) {
|
|
52
49
|
ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
|
|
53
50
|
}
|
|
54
|
-
React.useLayoutEffect(() => {
|
|
55
|
-
const columnMenuState = apiRef.current.state.columnMenu;
|
|
56
|
-
if (hasFocus && !columnMenuState.open) {
|
|
57
|
-
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
58
|
-
const elementToFocus = focusableElement || headerCellRef.current;
|
|
59
|
-
elementToFocus?.focus();
|
|
60
|
-
if (apiRef.current.columnHeadersContainerRef?.current) {
|
|
61
|
-
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}, [apiRef, hasFocus]);
|
|
65
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
66
52
|
className: (0, _clsx.default)(classes.root, headerClassName),
|
|
67
53
|
style: (0, _extends2.default)({}, style, {
|
|
@@ -209,7 +209,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
209
209
|
// Revert grid to previous state
|
|
210
210
|
apiRef.current.restoreState(previousGridState.current || {});
|
|
211
211
|
if (!previousGridState.current?.columns?.columnVisibilityModel) {
|
|
212
|
-
// if the apiRef.current.exportState(); did not
|
|
212
|
+
// if the apiRef.current.exportState(); did not export the column visibility, we update it
|
|
213
213
|
apiRef.current.setColumnVisibilityModel(previousColumnVisibility.current);
|
|
214
214
|
}
|
|
215
215
|
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
@@ -246,12 +246,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
246
246
|
}));
|
|
247
247
|
}
|
|
248
248
|
previousVirtualizationState.current = apiRef.current.state.virtualization;
|
|
249
|
-
apiRef.current.
|
|
250
|
-
virtualization: (0, _extends2.default)({}, state.virtualization, {
|
|
251
|
-
enabled: false,
|
|
252
|
-
enabledForColumns: false
|
|
253
|
-
})
|
|
254
|
-
}));
|
|
249
|
+
apiRef.current.unstable_setVirtualization(false);
|
|
255
250
|
await updateGridColumnsForPrint(options?.fields, options?.allColumns, options?.includeCheckboxes);
|
|
256
251
|
updateGridRowsForPrint(options?.getRowsToExport ?? _utils2.defaultGetRowsToExport);
|
|
257
252
|
await raf(); // wait for the state changes to take action
|
|
@@ -39,7 +39,9 @@ function createUseGridApiEventHandler(registryContainer) {
|
|
|
39
39
|
const cleanupTokenRef = React.useRef(null);
|
|
40
40
|
if (!subscription.current && handlerRef.current) {
|
|
41
41
|
const enhancedHandler = (params, event, details) => {
|
|
42
|
-
|
|
42
|
+
// Check for the existence of the event once more to avoid Safari 26 issue
|
|
43
|
+
// https://github.com/mui/mui-x/issues/20159
|
|
44
|
+
if (event && !event.defaultMuiPrevented) {
|
|
43
45
|
handlerRef.current?.(params, event, details);
|
|
44
46
|
}
|
|
45
47
|
};
|
|
@@ -66,7 +68,9 @@ function createUseGridApiEventHandler(registryContainer) {
|
|
|
66
68
|
React.useEffect(() => {
|
|
67
69
|
if (!subscription.current && handlerRef.current) {
|
|
68
70
|
const enhancedHandler = (params, event, details) => {
|
|
69
|
-
|
|
71
|
+
// Check for the existence of the event once more to avoid Safari 26 issue
|
|
72
|
+
// https://github.com/mui/mui-x/issues/20159
|
|
73
|
+
if (event && !event.defaultMuiPrevented) {
|
|
70
74
|
handlerRef.current?.(params, event, details);
|
|
71
75
|
}
|
|
72
76
|
};
|
package/node/index.js
CHANGED