@mui/x-data-grid 7.6.0 → 7.6.2
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 +91 -0
- package/components/GridRow.js +0 -6
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
- package/components/toolbar/GridToolbarQuickFilter.js +0 -7
- package/hooks/features/columnResize/useGridColumnResize.js +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +11 -12
- package/index.js +1 -1
- package/modern/components/GridRow.js +0 -6
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
- package/modern/components/toolbar/GridToolbarQuickFilter.js +0 -7
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +11 -12
- package/modern/index.js +1 -1
- package/modern/utils/domUtils.js +8 -5
- package/node/components/GridRow.js +0 -6
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
- package/node/components/toolbar/GridToolbarQuickFilter.js +0 -7
- package/node/hooks/features/columnResize/useGridColumnResize.js +1 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +11 -12
- package/node/index.js +1 -1
- package/node/utils/domUtils.js +8 -4
- package/package.json +1 -2
- package/utils/domUtils.d.ts +1 -0
- package/utils/domUtils.js +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,97 @@
|
|
|
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.6.2
|
|
7
|
+
|
|
8
|
+
_Jun 6, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 📚 Adds Date and Time Pickers accessibility page
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
|
|
16
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
17
|
+
|
|
18
|
+
### Data Grid
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid@7.6.2`
|
|
21
|
+
|
|
22
|
+
- [DataGrid] Add the `areElementSizesEqual` utility to improve code readability (#13254) @layerok
|
|
23
|
+
- [DataGrid] Clean up IE remnants from the codebase (#13390) @MBilalShafi
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid-pro@7.6.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
26
|
+
|
|
27
|
+
Same changes as in `@mui/x-data-grid@7.6.2`.
|
|
28
|
+
|
|
29
|
+
#### `@mui/x-data-grid-premium@7.6.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
30
|
+
|
|
31
|
+
Same changes as in `@mui/x-data-grid-pro@7.6.2`.
|
|
32
|
+
|
|
33
|
+
### Date and Time Pickers
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-date-pickers@7.6.2`
|
|
36
|
+
|
|
37
|
+
- [fields] Fix `PageUp` and `PageDown` editing on letter sections (#13310) @arthurbalduini
|
|
38
|
+
- [pickers] Fix `AdapterDayjs` timezone behavior (#13362) @LukasTy
|
|
39
|
+
- [pickers] Use `useRtl` instead of `useTheme` to access direction (#13363) @flaviendelangle
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers-pro@7.6.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-date-pickers@7.6.2`.
|
|
44
|
+
|
|
45
|
+
### Charts
|
|
46
|
+
|
|
47
|
+
#### `@mui/x-charts@7.6.2`
|
|
48
|
+
|
|
49
|
+
- [charts] Add `Initializable` type and behaviour to allow checking if a complex context has been initialized. (#13365) @JCQuintas
|
|
50
|
+
- [charts] Fix some props not working in `xAxis` and `yAxis` (#13372) @Valyok26
|
|
51
|
+
- [charts] Harmonize charts types (#13366) @alexfauquette
|
|
52
|
+
- [charts] Introduce plugins system (#13367) @alexfauquette
|
|
53
|
+
- [charts] Simplify plugin types (#13396) @JCQuintas
|
|
54
|
+
|
|
55
|
+
### Docs
|
|
56
|
+
|
|
57
|
+
- [docs] Add badges like in Material UI @oliviertassinari
|
|
58
|
+
- [docs] Update twitter.com to x.com @oliviertassinari
|
|
59
|
+
- [docs] Fix the description of `tickInterval` (#13355) @alexfauquette
|
|
60
|
+
- [docs] Adjust the code example for `quickFilterValues` (#12919) @michelengelen
|
|
61
|
+
- [docs] Create Pickers accessibility page (#13274) @arthurbalduini
|
|
62
|
+
|
|
63
|
+
### Core
|
|
64
|
+
|
|
65
|
+
- [core] Comment on `CSS.escape` for the future @oliviertassinari
|
|
66
|
+
- [core] Fix `l10n` action setup (#13382) @LukasTy
|
|
67
|
+
- [core] Fixes in preparation for React 18.3 (#13378) @LukasTy
|
|
68
|
+
- [core] Remove explicit `marked` dependency (#13383) @LukasTy
|
|
69
|
+
- [core] Remove unused `@types/prettier` dependency (#13389) @LukasTy
|
|
70
|
+
- [core] Add `docs/.env.local` to `.gitignore` (#13377) @KenanYusuf
|
|
71
|
+
|
|
72
|
+
## 7.6.1
|
|
73
|
+
|
|
74
|
+
_May 31, 2024_
|
|
75
|
+
|
|
76
|
+
We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
77
|
+
|
|
78
|
+
🐞 Address the `@mui/internal-test-utils` added as a direct dependency to `@mui/x-data-grid` by mistake.
|
|
79
|
+
|
|
80
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
81
|
+
|
|
82
|
+
### Data Grid
|
|
83
|
+
|
|
84
|
+
#### `@mui/x-data-grid@7.6.1`
|
|
85
|
+
|
|
86
|
+
- [DataGrid] Fix column resize not working with special character (#13069) @oukunan
|
|
87
|
+
- [DataGrid] Move `@mui/internal-test-utils` to dev dependency (#13318) @LukasTy
|
|
88
|
+
|
|
89
|
+
#### `@mui/x-data-grid-pro@7.6.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
90
|
+
|
|
91
|
+
Same changes as in `@mui/x-data-grid@7.6.1`.
|
|
92
|
+
|
|
93
|
+
#### `@mui/x-data-grid-premium@7.6.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
94
|
+
|
|
95
|
+
Same changes as in `@mui/x-data-grid-pro@7.6.1`.
|
|
96
|
+
|
|
6
97
|
## 7.6.0
|
|
7
98
|
|
|
8
99
|
_May 30, 2024_
|
package/components/GridRow.js
CHANGED
|
@@ -108,12 +108,6 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
108
108
|
rowHeight
|
|
109
109
|
};
|
|
110
110
|
const classes = useUtilityClasses(ownerState);
|
|
111
|
-
React.useLayoutEffect(() => {
|
|
112
|
-
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
113
|
-
// Fallback for IE
|
|
114
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
115
|
-
}
|
|
116
|
-
}, [apiRef, rowHeight, rowId]);
|
|
117
111
|
React.useLayoutEffect(() => {
|
|
118
112
|
if (currentPage.range) {
|
|
119
113
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"]
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"],
|
|
4
|
+
_excluded2 = ["key"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
@@ -73,13 +74,20 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
73
74
|
value: filteredValues,
|
|
74
75
|
onChange: handleChange,
|
|
75
76
|
getOptionLabel: getOptionLabel,
|
|
76
|
-
renderTags: (value, getTagProps) => value.map((option, index) =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
renderTags: (value, getTagProps) => value.map((option, index) => {
|
|
78
|
+
const _getTagProps = getTagProps({
|
|
79
|
+
index
|
|
80
|
+
}),
|
|
81
|
+
{
|
|
82
|
+
key
|
|
83
|
+
} = _getTagProps,
|
|
84
|
+
tagProps = _objectWithoutPropertiesLoose(_getTagProps, _excluded2);
|
|
85
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
86
|
+
variant: "outlined",
|
|
87
|
+
size: "small",
|
|
88
|
+
label: getOptionLabel(option)
|
|
89
|
+
}, tagProps), key);
|
|
90
|
+
}),
|
|
83
91
|
renderInput: params => /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({}, params, {
|
|
84
92
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
85
93
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -39,13 +39,6 @@ const GridToolbarQuickFilterRoot = styled(TextField, {
|
|
|
39
39
|
'& .MuiInput-underline:before': {
|
|
40
40
|
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
|
|
41
41
|
},
|
|
42
|
-
[`& input[type=search]::-ms-clear,
|
|
43
|
-
& input[type=search]::-ms-reveal`]: {
|
|
44
|
-
/* clears the 'X' icon from IE */
|
|
45
|
-
display: 'none',
|
|
46
|
-
width: 0,
|
|
47
|
-
height: 0
|
|
48
|
-
},
|
|
49
42
|
[`& input[type="search"]::-webkit-search-decoration,
|
|
50
43
|
& input[type="search"]::-webkit-search-cancel-button,
|
|
51
44
|
& input[type="search"]::-webkit-search-results-button,
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { unstable_ownerDocument as ownerDocument, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
4
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
5
5
|
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, getFieldsFromGroupHeaderElem, findGroupHeaderElementsFromField, findGridHeader, findGridCells, findParentElementFromClassName, findLeftPinnedHeadersAfterCol, findRightPinnedHeadersBeforeCol } from '../../../utils/domUtils';
|
|
6
|
+
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, getFieldsFromGroupHeaderElem, findGroupHeaderElementsFromField, findGridHeader, findGridCells, findParentElementFromClassName, findLeftPinnedHeadersAfterCol, findRightPinnedHeadersBeforeCol, escapeOperandAttributeSelector } from '../../../utils/domUtils';
|
|
7
7
|
import { DEFAULT_GRID_AUTOSIZE_OPTIONS } from './gridColumnResizeApi';
|
|
8
8
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
9
9
|
import { useGridApiEventHandler, useGridApiMethod, useGridApiOptionHandler, useGridLogger, useGridNativeEventListener, useGridSelector, useOnMount } from '../../utils';
|
|
@@ -303,7 +303,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
303
303
|
refs.initialTotalWidth = apiRef.current.getRootDimensions().rowWidth;
|
|
304
304
|
refs.colDef = colDef;
|
|
305
305
|
refs.columnHeaderElement = findHeaderElementFromField(apiRef.current.columnHeadersContainerRef.current, colDef.field);
|
|
306
|
-
const headerFilterElement = root.querySelector(`.${gridClasses.headerFilterRow} [data-field="${colDef.field}"]`);
|
|
306
|
+
const headerFilterElement = root.querySelector(`.${gridClasses.headerFilterRow} [data-field="${escapeOperandAttributeSelector(colDef.field)}"]`);
|
|
307
307
|
if (headerFilterElement) {
|
|
308
308
|
refs.headerFilterElement = headerFilterElement;
|
|
309
309
|
}
|
|
@@ -74,17 +74,13 @@ export function useGridDimensions(apiRef, props) {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const computedStyle = ownerWindow(element).getComputedStyle(element);
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!previousSize.current ||
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
height
|
|
85
|
-
};
|
|
86
|
-
apiRef.current.publishEvent('resize', size);
|
|
87
|
-
previousSize.current = size;
|
|
77
|
+
const newSize = {
|
|
78
|
+
width: parseFloat(computedStyle.width) || 0,
|
|
79
|
+
height: parseFloat(computedStyle.height) || 0
|
|
80
|
+
};
|
|
81
|
+
if (!previousSize.current || !areElementSizesEqual(previousSize.current, newSize)) {
|
|
82
|
+
apiRef.current.publishEvent('resize', newSize);
|
|
83
|
+
previousSize.current = newSize;
|
|
88
84
|
}
|
|
89
85
|
}, [apiRef]);
|
|
90
86
|
const getViewportPageSize = React.useCallback(() => {
|
|
@@ -190,7 +186,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
190
186
|
};
|
|
191
187
|
const prevDimensions = apiRef.current.state.dimensions;
|
|
192
188
|
setDimensions(newDimensions);
|
|
193
|
-
if (newDimensions.viewportInnerSize
|
|
189
|
+
if (!areElementSizesEqual(newDimensions.viewportInnerSize, prevDimensions.viewportInnerSize)) {
|
|
194
190
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
195
191
|
}
|
|
196
192
|
apiRef.current.updateRenderContext?.();
|
|
@@ -285,4 +281,7 @@ function measureScrollbarSize(rootElement, columnsTotalWidth, scrollbarSize) {
|
|
|
285
281
|
// https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
|
|
286
282
|
function roundToDecimalPlaces(value, decimals) {
|
|
287
283
|
return Math.round(value * 10 ** decimals) / 10 ** decimals;
|
|
284
|
+
}
|
|
285
|
+
function areElementSizesEqual(a, b) {
|
|
286
|
+
return a.width === b.width && a.height === b.height;
|
|
288
287
|
}
|
package/index.js
CHANGED
|
@@ -108,12 +108,6 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
108
108
|
rowHeight
|
|
109
109
|
};
|
|
110
110
|
const classes = useUtilityClasses(ownerState);
|
|
111
|
-
React.useLayoutEffect(() => {
|
|
112
|
-
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
113
|
-
// Fallback for IE
|
|
114
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
115
|
-
}
|
|
116
|
-
}, [apiRef, rowHeight, rowId]);
|
|
117
111
|
React.useLayoutEffect(() => {
|
|
118
112
|
if (currentPage.range) {
|
|
119
113
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"]
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"],
|
|
4
|
+
_excluded2 = ["key"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
@@ -73,13 +74,20 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
73
74
|
value: filteredValues,
|
|
74
75
|
onChange: handleChange,
|
|
75
76
|
getOptionLabel: getOptionLabel,
|
|
76
|
-
renderTags: (value, getTagProps) => value.map((option, index) =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
renderTags: (value, getTagProps) => value.map((option, index) => {
|
|
78
|
+
const _getTagProps = getTagProps({
|
|
79
|
+
index
|
|
80
|
+
}),
|
|
81
|
+
{
|
|
82
|
+
key
|
|
83
|
+
} = _getTagProps,
|
|
84
|
+
tagProps = _objectWithoutPropertiesLoose(_getTagProps, _excluded2);
|
|
85
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseChip, _extends({
|
|
86
|
+
variant: "outlined",
|
|
87
|
+
size: "small",
|
|
88
|
+
label: getOptionLabel(option)
|
|
89
|
+
}, tagProps), key);
|
|
90
|
+
}),
|
|
83
91
|
renderInput: params => /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({}, params, {
|
|
84
92
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
85
93
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -39,13 +39,6 @@ const GridToolbarQuickFilterRoot = styled(TextField, {
|
|
|
39
39
|
'& .MuiInput-underline:before': {
|
|
40
40
|
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
|
|
41
41
|
},
|
|
42
|
-
[`& input[type=search]::-ms-clear,
|
|
43
|
-
& input[type=search]::-ms-reveal`]: {
|
|
44
|
-
/* clears the 'X' icon from IE */
|
|
45
|
-
display: 'none',
|
|
46
|
-
width: 0,
|
|
47
|
-
height: 0
|
|
48
|
-
},
|
|
49
42
|
[`& input[type="search"]::-webkit-search-decoration,
|
|
50
43
|
& input[type="search"]::-webkit-search-cancel-button,
|
|
51
44
|
& input[type="search"]::-webkit-search-results-button,
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { unstable_ownerDocument as ownerDocument, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
4
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
5
5
|
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, getFieldsFromGroupHeaderElem, findGroupHeaderElementsFromField, findGridHeader, findGridCells, findParentElementFromClassName, findLeftPinnedHeadersAfterCol, findRightPinnedHeadersBeforeCol } from '../../../utils/domUtils';
|
|
6
|
+
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, getFieldsFromGroupHeaderElem, findGroupHeaderElementsFromField, findGridHeader, findGridCells, findParentElementFromClassName, findLeftPinnedHeadersAfterCol, findRightPinnedHeadersBeforeCol, escapeOperandAttributeSelector } from '../../../utils/domUtils';
|
|
7
7
|
import { DEFAULT_GRID_AUTOSIZE_OPTIONS } from './gridColumnResizeApi';
|
|
8
8
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
9
9
|
import { useGridApiEventHandler, useGridApiMethod, useGridApiOptionHandler, useGridLogger, useGridNativeEventListener, useGridSelector, useOnMount } from '../../utils';
|
|
@@ -303,7 +303,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
303
303
|
refs.initialTotalWidth = apiRef.current.getRootDimensions().rowWidth;
|
|
304
304
|
refs.colDef = colDef;
|
|
305
305
|
refs.columnHeaderElement = findHeaderElementFromField(apiRef.current.columnHeadersContainerRef.current, colDef.field);
|
|
306
|
-
const headerFilterElement = root.querySelector(`.${gridClasses.headerFilterRow} [data-field="${colDef.field}"]`);
|
|
306
|
+
const headerFilterElement = root.querySelector(`.${gridClasses.headerFilterRow} [data-field="${escapeOperandAttributeSelector(colDef.field)}"]`);
|
|
307
307
|
if (headerFilterElement) {
|
|
308
308
|
refs.headerFilterElement = headerFilterElement;
|
|
309
309
|
}
|
|
@@ -74,17 +74,13 @@ export function useGridDimensions(apiRef, props) {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const computedStyle = ownerWindow(element).getComputedStyle(element);
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!previousSize.current ||
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
height
|
|
85
|
-
};
|
|
86
|
-
apiRef.current.publishEvent('resize', size);
|
|
87
|
-
previousSize.current = size;
|
|
77
|
+
const newSize = {
|
|
78
|
+
width: parseFloat(computedStyle.width) || 0,
|
|
79
|
+
height: parseFloat(computedStyle.height) || 0
|
|
80
|
+
};
|
|
81
|
+
if (!previousSize.current || !areElementSizesEqual(previousSize.current, newSize)) {
|
|
82
|
+
apiRef.current.publishEvent('resize', newSize);
|
|
83
|
+
previousSize.current = newSize;
|
|
88
84
|
}
|
|
89
85
|
}, [apiRef]);
|
|
90
86
|
const getViewportPageSize = React.useCallback(() => {
|
|
@@ -190,7 +186,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
190
186
|
};
|
|
191
187
|
const prevDimensions = apiRef.current.state.dimensions;
|
|
192
188
|
setDimensions(newDimensions);
|
|
193
|
-
if (newDimensions.viewportInnerSize
|
|
189
|
+
if (!areElementSizesEqual(newDimensions.viewportInnerSize, prevDimensions.viewportInnerSize)) {
|
|
194
190
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
195
191
|
}
|
|
196
192
|
apiRef.current.updateRenderContext?.();
|
|
@@ -285,4 +281,7 @@ function measureScrollbarSize(rootElement, columnsTotalWidth, scrollbarSize) {
|
|
|
285
281
|
// https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
|
|
286
282
|
function roundToDecimalPlaces(value, decimals) {
|
|
287
283
|
return Math.round(value * 10 ** decimals) / 10 ** decimals;
|
|
284
|
+
}
|
|
285
|
+
function areElementSizesEqual(a, b) {
|
|
286
|
+
return a.width === b.width && a.height === b.height;
|
|
288
287
|
}
|
package/modern/index.js
CHANGED
package/modern/utils/domUtils.js
CHANGED
|
@@ -5,7 +5,10 @@ export function isOverflown(element) {
|
|
|
5
5
|
export function findParentElementFromClassName(elem, className) {
|
|
6
6
|
return elem.closest(`.${className}`);
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// TODO, eventually replaces this function with CSS.escape, once available in jsdom, either added manually or built in
|
|
10
|
+
// https://github.com/jsdom/jsdom/issues/1550#issuecomment-236734471
|
|
11
|
+
export function escapeOperandAttributeSelector(operand) {
|
|
9
12
|
return operand.replace(/["\\]/g, '\\$&');
|
|
10
13
|
}
|
|
11
14
|
export function getGridColumnHeaderElement(root, field) {
|
|
@@ -51,13 +54,13 @@ export function getFieldFromHeaderElem(colCellEl) {
|
|
|
51
54
|
return colCellEl.getAttribute('data-field');
|
|
52
55
|
}
|
|
53
56
|
export function findHeaderElementFromField(elem, field) {
|
|
54
|
-
return elem.querySelector(`[data-field="${field}"]`);
|
|
57
|
+
return elem.querySelector(`[data-field="${escapeOperandAttributeSelector(field)}"]`);
|
|
55
58
|
}
|
|
56
59
|
export function getFieldsFromGroupHeaderElem(colCellEl) {
|
|
57
60
|
return colCellEl.getAttribute('data-fields').slice(2, -2).split('-|-');
|
|
58
61
|
}
|
|
59
62
|
export function findGroupHeaderElementsFromField(elem, field) {
|
|
60
|
-
return Array.from(elem.querySelectorAll(`[data-fields*="|-${field}-|"]`) ?? []);
|
|
63
|
+
return Array.from(elem.querySelectorAll(`[data-fields*="|-${escapeOperandAttributeSelector(field)}-|"]`) ?? []);
|
|
61
64
|
}
|
|
62
65
|
export function findGridCellElementsFromCol(col, api) {
|
|
63
66
|
const root = findParentElementFromClassName(col, gridClasses.root);
|
|
@@ -176,11 +179,11 @@ export function findRightPinnedHeadersBeforeCol(api, col) {
|
|
|
176
179
|
}
|
|
177
180
|
export function findGridHeader(api, field) {
|
|
178
181
|
const headers = api.columnHeadersContainerRef.current;
|
|
179
|
-
return headers.querySelector(`:scope > div > [data-field="${field}"][role="columnheader"]`);
|
|
182
|
+
return headers.querySelector(`:scope > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="columnheader"]`);
|
|
180
183
|
}
|
|
181
184
|
export function findGridCells(api, field) {
|
|
182
185
|
const container = api.virtualScrollerRef.current;
|
|
183
|
-
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${field}"][role="gridcell"]`));
|
|
186
|
+
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="gridcell"]`));
|
|
184
187
|
}
|
|
185
188
|
function queryRows(api) {
|
|
186
189
|
return api.virtualScrollerRef.current.querySelectorAll(
|
|
@@ -117,12 +117,6 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
117
117
|
rowHeight
|
|
118
118
|
};
|
|
119
119
|
const classes = useUtilityClasses(ownerState);
|
|
120
|
-
React.useLayoutEffect(() => {
|
|
121
|
-
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
122
|
-
// Fallback for IE
|
|
123
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
124
|
-
}
|
|
125
|
-
}, [apiRef, rowHeight, rowId]);
|
|
126
120
|
React.useLayoutEffect(() => {
|
|
127
121
|
if (currentPage.range) {
|
|
128
122
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -14,7 +14,8 @@ var _utils = require("@mui/utils");
|
|
|
14
14
|
var _filterPanelUtils = require("./filterPanelUtils");
|
|
15
15
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"]
|
|
17
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"],
|
|
18
|
+
_excluded2 = ["key"];
|
|
18
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
21
|
const filter = (0, _Autocomplete.createFilterOptions)();
|
|
@@ -82,13 +83,20 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
82
83
|
value: filteredValues,
|
|
83
84
|
onChange: handleChange,
|
|
84
85
|
getOptionLabel: getOptionLabel,
|
|
85
|
-
renderTags: (value, getTagProps) => value.map((option, index) =>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
renderTags: (value, getTagProps) => value.map((option, index) => {
|
|
87
|
+
const _getTagProps = getTagProps({
|
|
88
|
+
index
|
|
89
|
+
}),
|
|
90
|
+
{
|
|
91
|
+
key
|
|
92
|
+
} = _getTagProps,
|
|
93
|
+
tagProps = (0, _objectWithoutPropertiesLoose2.default)(_getTagProps, _excluded2);
|
|
94
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseChip, (0, _extends2.default)({
|
|
95
|
+
variant: "outlined",
|
|
96
|
+
size: "small",
|
|
97
|
+
label: getOptionLabel(option)
|
|
98
|
+
}, tagProps), key);
|
|
99
|
+
}),
|
|
92
100
|
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({}, params, {
|
|
93
101
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
94
102
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -48,13 +48,6 @@ const GridToolbarQuickFilterRoot = (0, _styles.styled)(_TextField.default, {
|
|
|
48
48
|
'& .MuiInput-underline:before': {
|
|
49
49
|
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
|
|
50
50
|
},
|
|
51
|
-
[`& input[type=search]::-ms-clear,
|
|
52
|
-
& input[type=search]::-ms-reveal`]: {
|
|
53
|
-
/* clears the 'X' icon from IE */
|
|
54
|
-
display: 'none',
|
|
55
|
-
width: 0,
|
|
56
|
-
height: 0
|
|
57
|
-
},
|
|
58
51
|
[`& input[type="search"]::-webkit-search-decoration,
|
|
59
52
|
& input[type="search"]::-webkit-search-cancel-button,
|
|
60
53
|
& input[type="search"]::-webkit-search-results-button,
|
|
@@ -313,7 +313,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
313
313
|
refs.initialTotalWidth = apiRef.current.getRootDimensions().rowWidth;
|
|
314
314
|
refs.colDef = colDef;
|
|
315
315
|
refs.columnHeaderElement = (0, _domUtils.findHeaderElementFromField)(apiRef.current.columnHeadersContainerRef.current, colDef.field);
|
|
316
|
-
const headerFilterElement = root.querySelector(`.${_gridClasses.gridClasses.headerFilterRow} [data-field="${colDef.field}"]`);
|
|
316
|
+
const headerFilterElement = root.querySelector(`.${_gridClasses.gridClasses.headerFilterRow} [data-field="${(0, _domUtils.escapeOperandAttributeSelector)(colDef.field)}"]`);
|
|
317
317
|
if (headerFilterElement) {
|
|
318
318
|
refs.headerFilterElement = headerFilterElement;
|
|
319
319
|
}
|
|
@@ -85,17 +85,13 @@ function useGridDimensions(apiRef, props) {
|
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
const computedStyle = (0, _utils.unstable_ownerWindow)(element).getComputedStyle(element);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!previousSize.current ||
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
height
|
|
96
|
-
};
|
|
97
|
-
apiRef.current.publishEvent('resize', size);
|
|
98
|
-
previousSize.current = size;
|
|
88
|
+
const newSize = {
|
|
89
|
+
width: parseFloat(computedStyle.width) || 0,
|
|
90
|
+
height: parseFloat(computedStyle.height) || 0
|
|
91
|
+
};
|
|
92
|
+
if (!previousSize.current || !areElementSizesEqual(previousSize.current, newSize)) {
|
|
93
|
+
apiRef.current.publishEvent('resize', newSize);
|
|
94
|
+
previousSize.current = newSize;
|
|
99
95
|
}
|
|
100
96
|
}, [apiRef]);
|
|
101
97
|
const getViewportPageSize = React.useCallback(() => {
|
|
@@ -201,7 +197,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
201
197
|
};
|
|
202
198
|
const prevDimensions = apiRef.current.state.dimensions;
|
|
203
199
|
setDimensions(newDimensions);
|
|
204
|
-
if (newDimensions.viewportInnerSize
|
|
200
|
+
if (!areElementSizesEqual(newDimensions.viewportInnerSize, prevDimensions.viewportInnerSize)) {
|
|
205
201
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
206
202
|
}
|
|
207
203
|
apiRef.current.updateRenderContext?.();
|
|
@@ -296,4 +292,7 @@ function measureScrollbarSize(rootElement, columnsTotalWidth, scrollbarSize) {
|
|
|
296
292
|
// https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
|
|
297
293
|
function roundToDecimalPlaces(value, decimals) {
|
|
298
294
|
return Math.round(value * 10 ** decimals) / 10 ** decimals;
|
|
295
|
+
}
|
|
296
|
+
function areElementSizesEqual(a, b) {
|
|
297
|
+
return a.width === b.width && a.height === b.height;
|
|
299
298
|
}
|
package/node/index.js
CHANGED
package/node/utils/domUtils.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.escapeOperandAttributeSelector = escapeOperandAttributeSelector;
|
|
6
7
|
exports.findGridCellElementsFromCol = findGridCellElementsFromCol;
|
|
7
8
|
exports.findGridCells = findGridCells;
|
|
8
9
|
exports.findGridElement = findGridElement;
|
|
@@ -29,6 +30,9 @@ function isOverflown(element) {
|
|
|
29
30
|
function findParentElementFromClassName(elem, className) {
|
|
30
31
|
return elem.closest(`.${className}`);
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
// TODO, eventually replaces this function with CSS.escape, once available in jsdom, either added manually or built in
|
|
35
|
+
// https://github.com/jsdom/jsdom/issues/1550#issuecomment-236734471
|
|
32
36
|
function escapeOperandAttributeSelector(operand) {
|
|
33
37
|
return operand.replace(/["\\]/g, '\\$&');
|
|
34
38
|
}
|
|
@@ -76,13 +80,13 @@ function getFieldFromHeaderElem(colCellEl) {
|
|
|
76
80
|
return colCellEl.getAttribute('data-field');
|
|
77
81
|
}
|
|
78
82
|
function findHeaderElementFromField(elem, field) {
|
|
79
|
-
return elem.querySelector(`[data-field="${field}"]`);
|
|
83
|
+
return elem.querySelector(`[data-field="${escapeOperandAttributeSelector(field)}"]`);
|
|
80
84
|
}
|
|
81
85
|
function getFieldsFromGroupHeaderElem(colCellEl) {
|
|
82
86
|
return colCellEl.getAttribute('data-fields').slice(2, -2).split('-|-');
|
|
83
87
|
}
|
|
84
88
|
function findGroupHeaderElementsFromField(elem, field) {
|
|
85
|
-
return Array.from(elem.querySelectorAll(`[data-fields*="|-${field}-|"]`) ?? []);
|
|
89
|
+
return Array.from(elem.querySelectorAll(`[data-fields*="|-${escapeOperandAttributeSelector(field)}-|"]`) ?? []);
|
|
86
90
|
}
|
|
87
91
|
function findGridCellElementsFromCol(col, api) {
|
|
88
92
|
const root = findParentElementFromClassName(col, _gridClasses.gridClasses.root);
|
|
@@ -201,11 +205,11 @@ function findRightPinnedHeadersBeforeCol(api, col) {
|
|
|
201
205
|
}
|
|
202
206
|
function findGridHeader(api, field) {
|
|
203
207
|
const headers = api.columnHeadersContainerRef.current;
|
|
204
|
-
return headers.querySelector(`:scope > div > [data-field="${field}"][role="columnheader"]`);
|
|
208
|
+
return headers.querySelector(`:scope > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="columnheader"]`);
|
|
205
209
|
}
|
|
206
210
|
function findGridCells(api, field) {
|
|
207
211
|
const container = api.virtualScrollerRef.current;
|
|
208
|
-
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${field}"][role="gridcell"]`));
|
|
212
|
+
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="gridcell"]`));
|
|
209
213
|
}
|
|
210
214
|
function queryRows(api) {
|
|
211
215
|
return api.virtualScrollerRef.current.querySelectorAll(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.2",
|
|
4
4
|
"description": "The Community plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/runtime": "^7.24.6",
|
|
41
|
-
"@mui/internal-test-utils": "1.0.0-dev.20240529-082515-213b5e33ab",
|
|
42
41
|
"@mui/system": "^5.15.15",
|
|
43
42
|
"@mui/utils": "^5.15.14",
|
|
44
43
|
"clsx": "^2.1.1",
|
package/utils/domUtils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
|
|
|
4
4
|
import type { GridRowId } from '../models/gridRows';
|
|
5
5
|
export declare function isOverflown(element: Element): boolean;
|
|
6
6
|
export declare function findParentElementFromClassName(elem: Element, className: string): Element | null;
|
|
7
|
+
export declare function escapeOperandAttributeSelector(operand: string): string;
|
|
7
8
|
export declare function getGridColumnHeaderElement(root: Element, field: string): HTMLDivElement | null;
|
|
8
9
|
export declare function getGridRowElement(root: Element, id: GridRowId): HTMLDivElement | null;
|
|
9
10
|
export declare function getGridCellElement(root: Element, { id, field }: {
|
package/utils/domUtils.js
CHANGED
|
@@ -5,7 +5,10 @@ export function isOverflown(element) {
|
|
|
5
5
|
export function findParentElementFromClassName(elem, className) {
|
|
6
6
|
return elem.closest(`.${className}`);
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// TODO, eventually replaces this function with CSS.escape, once available in jsdom, either added manually or built in
|
|
10
|
+
// https://github.com/jsdom/jsdom/issues/1550#issuecomment-236734471
|
|
11
|
+
export function escapeOperandAttributeSelector(operand) {
|
|
9
12
|
return operand.replace(/["\\]/g, '\\$&');
|
|
10
13
|
}
|
|
11
14
|
export function getGridColumnHeaderElement(root, field) {
|
|
@@ -51,13 +54,13 @@ export function getFieldFromHeaderElem(colCellEl) {
|
|
|
51
54
|
return colCellEl.getAttribute('data-field');
|
|
52
55
|
}
|
|
53
56
|
export function findHeaderElementFromField(elem, field) {
|
|
54
|
-
return elem.querySelector(`[data-field="${field}"]`);
|
|
57
|
+
return elem.querySelector(`[data-field="${escapeOperandAttributeSelector(field)}"]`);
|
|
55
58
|
}
|
|
56
59
|
export function getFieldsFromGroupHeaderElem(colCellEl) {
|
|
57
60
|
return colCellEl.getAttribute('data-fields').slice(2, -2).split('-|-');
|
|
58
61
|
}
|
|
59
62
|
export function findGroupHeaderElementsFromField(elem, field) {
|
|
60
|
-
return Array.from(elem.querySelectorAll(`[data-fields*="|-${field}-|"]`) ?? []);
|
|
63
|
+
return Array.from(elem.querySelectorAll(`[data-fields*="|-${escapeOperandAttributeSelector(field)}-|"]`) ?? []);
|
|
61
64
|
}
|
|
62
65
|
export function findGridCellElementsFromCol(col, api) {
|
|
63
66
|
const root = findParentElementFromClassName(col, gridClasses.root);
|
|
@@ -176,11 +179,11 @@ export function findRightPinnedHeadersBeforeCol(api, col) {
|
|
|
176
179
|
}
|
|
177
180
|
export function findGridHeader(api, field) {
|
|
178
181
|
const headers = api.columnHeadersContainerRef.current;
|
|
179
|
-
return headers.querySelector(`:scope > div > [data-field="${field}"][role="columnheader"]`);
|
|
182
|
+
return headers.querySelector(`:scope > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="columnheader"]`);
|
|
180
183
|
}
|
|
181
184
|
export function findGridCells(api, field) {
|
|
182
185
|
const container = api.virtualScrollerRef.current;
|
|
183
|
-
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${field}"][role="gridcell"]`));
|
|
186
|
+
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="gridcell"]`));
|
|
184
187
|
}
|
|
185
188
|
function queryRows(api) {
|
|
186
189
|
return api.virtualScrollerRef.current.querySelectorAll(
|