@mui/x-data-grid 6.10.2 → 6.11.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/DataGrid/DataGrid.d.ts +1 -1
  3. package/DataGrid/DataGrid.js +2 -1
  4. package/colDef/utils.d.ts +1 -1
  5. package/colDef/utils.js +1 -1
  6. package/components/cell/GridCell.js +57 -46
  7. package/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  8. package/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  9. package/components/containers/GridMainContainer.js +10 -3
  10. package/components/containers/GridRoot.js +7 -13
  11. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
  12. package/hooks/features/columns/gridColumnsUtils.js +2 -2
  13. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +7 -4
  14. package/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
  15. package/hooks/utils/useGridAriaAttributes.d.ts +6 -0
  16. package/hooks/utils/useGridAriaAttributes.js +25 -0
  17. package/index.js +1 -1
  18. package/legacy/DataGrid/DataGrid.js +2 -1
  19. package/legacy/colDef/utils.js +1 -1
  20. package/legacy/components/cell/GridCell.js +57 -46
  21. package/legacy/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  22. package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  23. package/legacy/components/containers/GridMainContainer.js +10 -3
  24. package/legacy/components/containers/GridRoot.js +7 -13
  25. package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
  26. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
  27. package/legacy/hooks/utils/useGridAriaAttributes.js +25 -0
  28. package/legacy/index.js +1 -1
  29. package/legacy/locales/fiFI.js +28 -30
  30. package/legacy/locales/heIL.js +26 -29
  31. package/legacy/locales/itIT.js +34 -38
  32. package/locales/fiFI.js +28 -30
  33. package/locales/heIL.js +26 -29
  34. package/locales/itIT.js +34 -38
  35. package/models/gridFilterOperator.d.ts +1 -1
  36. package/models/props/DataGridProps.d.ts +7 -1
  37. package/modern/DataGrid/DataGrid.js +2 -1
  38. package/modern/colDef/utils.js +1 -1
  39. package/modern/components/cell/GridCell.js +54 -43
  40. package/modern/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  41. package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  42. package/modern/components/containers/GridMainContainer.js +9 -3
  43. package/modern/components/containers/GridRoot.js +6 -13
  44. package/modern/hooks/features/columns/gridColumnsUtils.js +2 -2
  45. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
  46. package/modern/hooks/utils/useGridAriaAttributes.js +24 -0
  47. package/modern/index.js +1 -1
  48. package/modern/locales/fiFI.js +28 -30
  49. package/modern/locales/heIL.js +26 -29
  50. package/modern/locales/itIT.js +34 -38
  51. package/node/DataGrid/DataGrid.js +2 -1
  52. package/node/colDef/utils.js +1 -1
  53. package/node/components/cell/GridCell.js +54 -43
  54. package/node/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  55. package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  56. package/node/components/containers/GridMainContainer.js +10 -3
  57. package/node/components/containers/GridRoot.js +6 -13
  58. package/node/hooks/features/columns/gridColumnsUtils.js +1 -1
  59. package/node/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
  60. package/node/hooks/utils/useGridAriaAttributes.js +31 -0
  61. package/node/index.js +1 -1
  62. package/node/locales/fiFI.js +28 -30
  63. package/node/locales/heIL.js +26 -29
  64. package/node/locales/itIT.js +34 -38
  65. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,98 @@
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
+ ## 6.11.0
7
+
8
+ _Aug 4, 2023_
9
+
10
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ⌚️ Move the tree view component from `@mui/lab` package
13
+
14
+ The `<TreeView />` component has been moved to the MUI X repository.
15
+ It is now accessible from its own package: `@mui/x-tree-view`.
16
+
17
+ - 🌍 Improve Hebrew (he-IL), Finnish (fi-FI), and Italian (it-IT) locales on the data grid
18
+ - 🐞 Bugfixes
19
+ - 📚 Documentation improvements
20
+
21
+ ### Data Grid
22
+
23
+ #### `@mui/x-data-grid@v6.11.0`
24
+
25
+ - [DataGrid] Add `ariaV7` experimental flag (#9496) @cherniavskii
26
+ - [DataGrid] Fix cell size when column width is set to `undefined` (#9871) @gitstart
27
+ - [l10n] Improve Hebrew (he-IL) locale (#9820) @itayG98
28
+ - [l10n] Improve Finnish (fi-FI) locale (#9848) @sambbaahh
29
+ - [l10n] Improve Italian (it-IT) locale (#9627) @fabio-rizzello-omnia
30
+
31
+ #### `@mui/x-data-grid-pro@v6.11.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
32
+
33
+ Same changes as in `@mui/x-data-grid@v6.11.0`.
34
+
35
+ #### `@mui/x-data-grid-premium@v6.11.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link)
36
+
37
+ Same changes as in `@mui/x-data-grid-pro@v6.11.0`.
38
+
39
+ ### Date Pickers
40
+
41
+ #### `@mui/x-date-pickers@v6.11.0`
42
+
43
+ - [fields] Correctly handle events with a complete value insertion (#9896) @LukasTy
44
+ - [fields] Fix hours editing on dayjs with timezone and DST (#9901) @flaviendelangle
45
+ - [fields] Fix section clearing with timezone (#9819) @flaviendelangle
46
+ - [pickers] Add `CalendarHeader` slot (#7784) @flaviendelangle
47
+ - [pickers] Allow to override the `InputProps` of the `TextField` using the `slotProps` (#9849) @flaviendelangle
48
+ - [pickers] Allow to override the opening aria text using the `localeText` prop on the pickers (#9870) @flaviendelangle
49
+ - [pickers] Fix `sx` and `className` props on `MobileDateRangePicker` (#9853) @flaviendelangle
50
+ - [pickers] Fix default descriptions (#9887) @LukasTy
51
+ - [pickers] Fix offset management on dayjs adapter (#9884) @flaviendelangle
52
+ - [pickers] Use device motion reduction preference (#9823) @LukasTy
53
+
54
+ #### `@mui/x-date-pickers-pro@v6.11.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
55
+
56
+ Same changes as in `@mui/x-date-pickers@v6.11.0`.
57
+
58
+ ### Charts / `@mui/x-charts@v6.0.0-alpha.6`
59
+
60
+ - [charts] Add TS definition to the exported elements (#9885) @alexfauquette
61
+ - [charts] Add sparkline (#9662) @alexfauquette
62
+ - [charts] Fix missing configuration types (#9886) @alexfauquette
63
+ - [charts] Introduce dataset to simplify plot of data from API (#9774) @alexfauquette
64
+
65
+ ### Tree View / `@mui/x-tree-view@v6.0.0-alpha.0`
66
+
67
+ - [TreeView] Add missing exported types (#9862) @flaviendelangle
68
+ - [TreeView] Add tree view to changelog generator script (#9903) @MBilalShafi
69
+ - [TreeView] Create the package on the X repository (#9798) @flaviendelangle
70
+ - [TreeView] Improve props typing (#9855) @flaviendelangle
71
+
72
+ ### Docs
73
+
74
+ - [docs] Add Tree View doc (#9825) @flaviendelangle
75
+ - [docs] Add charts nav item (#9821) @LukasTy
76
+ - [docs] Add charts to MUI X introduction pages (#9704) @joserodolfofreitas
77
+ - [docs] Add example for avoiding picker views layout shift (#9781) @noraleonte
78
+ - [docs] Consistency of Next.js App Router @oliviertassinari
79
+ - [docs] Fix API page regression: bring back slots section (#9866) @alexfauquette
80
+ - [docs] Fix demo using Pro while it's MIT (#9842) @oliviertassinari
81
+ - [docs] Get ready for next docs-infra change @oliviertassinari
82
+ - [docs] Improve the slots documentation `Recommended usage` section (#9892) @flaviendelangle
83
+
84
+ ### Core
85
+
86
+ - [core] Fix font loading issue dev-mode (#9843) @oliviertassinari
87
+ - [core] Fix pipeline (#9894) @LukasTy
88
+ - [core] Fix the link-check script on Windows (#9888) @alexfauquette
89
+ - [core] Fix v7 capitalization (#9878) @oliviertassinari
90
+ - [core] Regen doc (#9902) @flaviendelangle
91
+ - [core] Remove benchmark package (#9413) @LukasTy
92
+ - [core] Stop using the deprecated `JSX` global namespace (#9854) @flaviendelangle
93
+ - [core] Update monorepo (#9846) @flaviendelangle
94
+ - [core] Update tree data API docs (#9827) @cherniavskii
95
+ - [test] Add pickers e2e tests (#9747) @LukasTy
96
+ - [test] Data grid e2e tests follow-up (#9822) @cherniavskii
97
+
6
98
  ## 6.10.2
7
99
 
8
100
  _Jul 27, 2023_
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { DataGridProps } from '../models/props/DataGridProps';
3
3
  import { GridValidRowModel } from '../models/gridRows';
4
4
  interface DataGridComponent {
5
- <R extends GridValidRowModel = any>(props: DataGridProps<R> & React.RefAttributes<HTMLDivElement>): JSX.Element;
5
+ <R extends GridValidRowModel = any>(props: DataGridProps<R> & React.RefAttributes<HTMLDivElement>): React.JSX.Element;
6
6
  propTypes?: any;
7
7
  }
8
8
  export declare const DataGrid: DataGridComponent;
@@ -161,6 +161,7 @@ DataGridRaw.propTypes = {
161
161
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
162
162
  */
163
163
  experimentalFeatures: PropTypes.shape({
164
+ ariaV7: PropTypes.bool,
164
165
  columnGrouping: PropTypes.bool,
165
166
  warnIfFocusStateIsNotSynced: PropTypes.bool
166
167
  }),
@@ -199,7 +200,7 @@ DataGridRaw.propTypes = {
199
200
  /**
200
201
  * Function that returns the element to render in row detail.
201
202
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
202
- * @returns {JSX.Element} The row detail element.
203
+ * @returns {React.JSX.Element} The row detail element.
203
204
  */
204
205
  getDetailPanelContent: PropTypes.func,
205
206
  /**
package/colDef/utils.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare const GLOBAL_API_REF: {
10
10
  };
11
11
  /**
12
12
  * A tagger to determine if the filter is internal or custom user-supplied.
13
- * To be a valid internal filter, the V7 function *must* be defined/redefined at
13
+ * To be a valid internal filter, the v7 function *must* be defined/redefined at
14
14
  * the same time as the legacy one.
15
15
  * https://github.com/mui/mui-x/pull/9254#discussion_r1231095551
16
16
  */
package/colDef/utils.js CHANGED
@@ -8,7 +8,7 @@ export const GLOBAL_API_REF = {
8
8
 
9
9
  /**
10
10
  * A tagger to determine if the filter is internal or custom user-supplied.
11
- * To be a valid internal filter, the V7 function *must* be defined/redefined at
11
+ * To be a valid internal filter, the v7 function *must* be defined/redefined at
12
12
  * the same time as the legacy one.
13
13
  * https://github.com/mui/mui-x/pull/9254#discussion_r1231095551
14
14
  */
@@ -4,7 +4,6 @@ const _excluded = ["changeReason", "unstable_updateValueOnRender"],
4
4
  _excluded2 = ["align", "children", "editCellState", "colIndex", "column", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "isNotVisible", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
5
5
  _excluded3 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "isNotVisible", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
6
6
  _excluded4 = ["changeReason", "unstable_updateValueOnRender"];
7
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
8
7
  import * as React from 'react';
9
8
  import PropTypes from 'prop-types';
10
9
  import clsx from 'clsx';
@@ -156,7 +155,7 @@ const GridCellWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
156
155
  return /*#__PURE__*/React.createElement(CellComponent, cellProps);
157
156
  });
158
157
  const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
159
- var _rootProps$experiment;
158
+ var _rootProps$experiment, _rootProps$experiment2;
160
159
  const {
161
160
  align,
162
161
  children: childrenProp,
@@ -287,6 +286,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
287
286
  children = /*#__PURE__*/_jsx("div", {
288
287
  className: classes.content,
289
288
  title: valueString,
289
+ role: "presentation",
290
290
  children: valueString
291
291
  });
292
292
  }
@@ -299,27 +299,32 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
299
299
  onDragEnter: publish('cellDragEnter', onDragEnter),
300
300
  onDragOver: publish('cellDragOver', onDragOver)
301
301
  };
302
- return /*#__PURE__*/_jsx("div", _extends({
303
- ref: handleRef,
304
- className: clsx(className, classes.root),
305
- role: "cell",
306
- "data-field": field,
307
- "data-colindex": colIndex,
308
- "aria-colindex": colIndex + 1,
309
- "aria-colspan": colSpan,
310
- style: style,
311
- tabIndex: tabIndex,
312
- onClick: publish('cellClick', onClick),
313
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
314
- onMouseOver: publish('cellMouseOver', onMouseOver),
315
- onMouseDown: publishMouseDown('cellMouseDown'),
316
- onMouseUp: publishMouseUp('cellMouseUp'),
317
- onKeyDown: publish('cellKeyDown', onKeyDown),
318
- onKeyUp: publish('cellKeyUp', onKeyUp)
319
- }, draggableEventHandlers, other, {
320
- onFocus: handleFocus,
321
- children: children
322
- }));
302
+ const ariaV7 = (_rootProps$experiment2 = rootProps.experimentalFeatures) == null ? void 0 : _rootProps$experiment2.ariaV7;
303
+ return (
304
+ /*#__PURE__*/
305
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
306
+ _jsx("div", _extends({
307
+ ref: handleRef,
308
+ className: clsx(className, classes.root),
309
+ role: ariaV7 ? 'gridcell' : 'cell',
310
+ "data-field": field,
311
+ "data-colindex": colIndex,
312
+ "aria-colindex": colIndex + 1,
313
+ "aria-colspan": colSpan,
314
+ style: style,
315
+ tabIndex: tabIndex,
316
+ onClick: publish('cellClick', onClick),
317
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
318
+ onMouseOver: publish('cellMouseOver', onMouseOver),
319
+ onMouseDown: publishMouseDown('cellMouseDown'),
320
+ onMouseUp: publishMouseUp('cellMouseUp'),
321
+ onKeyDown: publish('cellKeyDown', onKeyDown),
322
+ onKeyUp: publish('cellKeyUp', onKeyUp)
323
+ }, draggableEventHandlers, other, {
324
+ onFocus: handleFocus,
325
+ children: children
326
+ }))
327
+ );
323
328
  });
324
329
  const MemoizedCellWrapper = fastMemo(GridCellWrapper);
325
330
  process.env.NODE_ENV !== "production" ? GridCellWrapper.propTypes = {
@@ -379,7 +384,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
379
384
  } : void 0;
380
385
  export { MemoizedCellWrapper as GridCellWrapper, GridCell };
381
386
  const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
382
- var _rootProps$experiment2;
387
+ var _rootProps$experiment3, _rootProps$experiment4;
383
388
  const {
384
389
  column,
385
390
  rowId,
@@ -527,7 +532,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
527
532
  return null;
528
533
  }
529
534
  let handleFocus = other.onFocus;
530
- if (process.env.NODE_ENV === 'test' && (_rootProps$experiment2 = rootProps.experimentalFeatures) != null && _rootProps$experiment2.warnIfFocusStateIsNotSynced) {
535
+ if (process.env.NODE_ENV === 'test' && (_rootProps$experiment3 = rootProps.experimentalFeatures) != null && _rootProps$experiment3.warnIfFocusStateIsNotSynced) {
531
536
  handleFocus = event => {
532
537
  const focusedCell = gridFocusCellSelector(apiRef);
533
538
  if ((focusedCell == null ? void 0 : focusedCell.id) === rowId && focusedCell.field === field) {
@@ -565,6 +570,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
565
570
  children = /*#__PURE__*/_jsx("div", {
566
571
  className: classes.content,
567
572
  title: valueString,
573
+ role: "presentation",
568
574
  children: valueString
569
575
  });
570
576
  }
@@ -577,27 +583,32 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
577
583
  onDragEnter: publish('cellDragEnter', onDragEnter),
578
584
  onDragOver: publish('cellDragOver', onDragOver)
579
585
  };
580
- return /*#__PURE__*/_jsx("div", _extends({
581
- ref: handleRef,
582
- className: clsx(className, classNames, classes.root),
583
- role: "cell",
584
- "data-field": field,
585
- "data-colindex": colIndex,
586
- "aria-colindex": colIndex + 1,
587
- "aria-colspan": colSpan,
588
- style: style,
589
- tabIndex: tabIndex,
590
- onClick: publish('cellClick', onClick),
591
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
592
- onMouseOver: publish('cellMouseOver', onMouseOver),
593
- onMouseDown: publishMouseDown('cellMouseDown'),
594
- onMouseUp: publishMouseUp('cellMouseUp'),
595
- onKeyDown: publish('cellKeyDown', onKeyDown),
596
- onKeyUp: publish('cellKeyUp', onKeyUp)
597
- }, draggableEventHandlers, other, {
598
- onFocus: handleFocus,
599
- children: children
600
- }));
586
+ const ariaV7 = (_rootProps$experiment4 = rootProps.experimentalFeatures) == null ? void 0 : _rootProps$experiment4.ariaV7;
587
+ return (
588
+ /*#__PURE__*/
589
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
590
+ _jsx("div", _extends({
591
+ ref: handleRef,
592
+ className: clsx(className, classNames, classes.root),
593
+ role: ariaV7 ? 'gridcell' : 'cell',
594
+ "data-field": field,
595
+ "data-colindex": colIndex,
596
+ "aria-colindex": colIndex + 1,
597
+ "aria-colspan": colSpan,
598
+ style: style,
599
+ tabIndex: tabIndex,
600
+ onClick: publish('cellClick', onClick),
601
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
602
+ onMouseOver: publish('cellMouseOver', onMouseOver),
603
+ onMouseDown: publishMouseDown('cellMouseDown'),
604
+ onMouseUp: publishMouseUp('cellMouseUp'),
605
+ onKeyDown: publish('cellKeyDown', onKeyDown),
606
+ onKeyUp: publish('cellKeyUp', onKeyUp)
607
+ }, draggableEventHandlers, other, {
608
+ onFocus: handleFocus,
609
+ children: children
610
+ }))
611
+ );
601
612
  });
602
613
  process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
603
614
  // ----------------------------- Warning --------------------------------
@@ -42,5 +42,7 @@ export const GridBaseColumnHeaders = /*#__PURE__*/React.forwardRef(function Grid
42
42
  ref: ref,
43
43
  className: clsx(className, classes.root),
44
44
  ownerState: rootProps
45
- }, other));
45
+ }, other, {
46
+ role: "presentation"
47
+ }));
46
48
  });
@@ -75,10 +75,12 @@ const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridG
75
75
  }, other, {
76
76
  children: [/*#__PURE__*/_jsxs("div", _extends({
77
77
  className: classes.draggableContainer,
78
- draggable: isDraggable
78
+ draggable: isDraggable,
79
+ role: "presentation"
79
80
  }, draggableContainerProps, {
80
81
  children: [/*#__PURE__*/_jsxs("div", {
81
82
  className: classes.titleContainer,
83
+ role: "presentation",
82
84
  children: [/*#__PURE__*/_jsx("div", {
83
85
  className: classes.titleContainerContent,
84
86
  children: headerComponent !== undefined ? headerComponent : /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
@@ -1,8 +1,10 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
2
3
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
3
4
  import { styled } from '@mui/system';
4
5
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
5
6
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
7
+ import { useGridAriaAttributes } from '../../hooks/utils/useGridAriaAttributes';
6
8
  import { jsx as _jsx } from "react/jsx-runtime";
7
9
  const useUtilityClasses = ownerState => {
8
10
  const {
@@ -25,12 +27,17 @@ const GridMainContainerRoot = styled('div', {
25
27
  overflow: 'hidden'
26
28
  }));
27
29
  export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
30
+ var _rootProps$experiment;
28
31
  const rootProps = useGridRootProps();
29
32
  const classes = useUtilityClasses(rootProps);
30
- return /*#__PURE__*/_jsx(GridMainContainerRoot, {
33
+ const getAriaAttributes = (_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.ariaV7 // ariaV7 should never change
34
+ ? useGridAriaAttributes : null;
35
+ const ariaAttributes = typeof getAriaAttributes === 'function' ? getAriaAttributes() : null;
36
+ return /*#__PURE__*/_jsx(GridMainContainerRoot, _extends({
31
37
  ref: ref,
32
38
  className: classes.root,
33
- ownerState: rootProps,
39
+ ownerState: rootProps
40
+ }, ariaAttributes, {
34
41
  children: props.children
35
- });
42
+ }));
36
43
  });
@@ -6,14 +6,12 @@ import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, unstable_capitalize as capitalize, unstable_composeClasses as composeClasses } from '@mui/utils';
8
8
  import { GridRootStyles } from './GridRootStyles';
9
- import { gridVisibleColumnDefinitionsSelector } from '../../hooks/features/columns/gridColumnsSelector';
10
9
  import { useGridSelector } from '../../hooks/utils/useGridSelector';
11
10
  import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
12
11
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
13
12
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
14
13
  import { gridDensityValueSelector } from '../../hooks/features/density/densitySelector';
15
- import { gridColumnGroupsHeaderMaxDepthSelector } from '../../hooks/features/columnGrouping/gridColumnGroupsSelector';
16
- import { gridPinnedRowsCountSelector, gridRowCountSelector } from '../../hooks/features/rows/gridRowsSelector';
14
+ import { useGridAriaAttributes } from '../../hooks/utils/useGridAriaAttributes';
17
15
  import { jsx as _jsx } from "react/jsx-runtime";
18
16
  const useUtilityClasses = ownerState => {
19
17
  const {
@@ -27,6 +25,7 @@ const useUtilityClasses = ownerState => {
27
25
  return composeClasses(slots, getDataGridUtilityClass, classes);
28
26
  };
29
27
  const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
28
+ var _rootProps$experiment;
30
29
  const rootProps = useGridRootProps();
31
30
  const {
32
31
  children,
@@ -34,13 +33,12 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
34
33
  } = props,
35
34
  other = _objectWithoutPropertiesLoose(props, _excluded);
36
35
  const apiRef = useGridPrivateApiContext();
37
- const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
38
- const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
39
36
  const densityValue = useGridSelector(apiRef, gridDensityValueSelector);
40
- const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
41
37
  const rootContainerRef = React.useRef(null);
42
38
  const handleRef = useForkRef(rootContainerRef, ref);
43
- const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
39
+ const getAriaAttributes = (_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.ariaV7 // ariaV7 should never change
40
+ ? null : useGridAriaAttributes;
41
+ const ariaAttributes = typeof getAriaAttributes === 'function' ? getAriaAttributes() : null;
44
42
  const ownerState = _extends({}, rootProps, {
45
43
  density: densityValue
46
44
  });
@@ -60,12 +58,8 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
60
58
  return /*#__PURE__*/_jsx(GridRootStyles, _extends({
61
59
  ref: handleRef,
62
60
  className: clsx(className, classes.root),
63
- ownerState: ownerState,
64
- role: "grid",
65
- "aria-colcount": visibleColumns.length,
66
- "aria-rowcount": headerGroupingMaxDepth + 1 + pinnedRowsCount + totalRowCount,
67
- "aria-multiselectable": !rootProps.disableMultipleRowSelection
68
- }, other, {
61
+ ownerState: ownerState
62
+ }, ariaAttributes, other, {
69
63
  children: children
70
64
  }));
71
65
  });
@@ -40,7 +40,7 @@ export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) =>
40
40
  minFirstColumn: number;
41
41
  maxLastColumn: number;
42
42
  } | null;
43
- getColumnGroupHeaders: (params?: GetHeadersParams) => JSX.Element[] | null;
43
+ getColumnGroupHeaders: (params?: GetHeadersParams) => React.JSX.Element[] | null;
44
44
  isDragging: boolean;
45
45
  getRootProps: (other?: {}) => {
46
46
  style: {
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { DEFAULT_GRID_COL_TYPE_KEY } from '../../../colDef';
2
+ import { DEFAULT_GRID_COL_TYPE_KEY, GRID_STRING_COL_DEF } from '../../../colDef';
3
3
  import { gridColumnsStateSelector, gridColumnVisibilityModelSelector } from './gridColumnsSelector';
4
4
  import { clamp } from '../../../utils/utils';
5
5
  import { gridDensityFactorSelector } from '../density/densitySelector';
@@ -127,7 +127,7 @@ export const hydrateColumnsWidth = (rawState, viewportInnerWidth) => {
127
127
  computedWidth = 0;
128
128
  flexColumns.push(newColumn);
129
129
  } else {
130
- computedWidth = clamp(newColumn.width, newColumn.minWidth, newColumn.maxWidth);
130
+ computedWidth = clamp(newColumn.width || GRID_STRING_COL_DEF.width, newColumn.minWidth || GRID_STRING_COL_DEF.minWidth, newColumn.maxWidth || GRID_STRING_COL_DEF.maxWidth);
131
131
  }
132
132
  widthAllocatedBeforeFlex += computedWidth;
133
133
  newColumn.computedWidth = computedWidth;
@@ -33,15 +33,16 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
33
33
  rows?: GridRowEntry<import("../../../models").GridValidRowModel>[] | undefined;
34
34
  rowIndexOffset?: number | undefined;
35
35
  onRowRender?: ((rowId: GridRowId) => void) | undefined;
36
- }) => JSX.Element[] | null;
36
+ }) => React.JSX.Element[] | null;
37
37
  getRootProps: (inputProps?: {
38
38
  style?: object;
39
39
  }) => {
40
40
  style: React.CSSProperties;
41
+ role: string;
41
42
  ref: ((instance: HTMLDivElement | null) => void) | null;
42
- onScroll: (event: React.UIEvent<Element, UIEvent>) => void;
43
- onWheel: (event: React.WheelEvent<Element>) => void;
44
- onTouchMove: (event: React.TouchEvent<Element>) => void;
43
+ onScroll: (event: React.UIEvent) => void;
44
+ onWheel: (event: React.WheelEvent) => void;
45
+ onTouchMove: (event: React.TouchEvent) => void;
45
46
  };
46
47
  getContentProps: ({ style }?: {
47
48
  style?: object | undefined;
@@ -51,9 +52,11 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
51
52
  height: number;
52
53
  minHeight: string;
53
54
  };
55
+ role: string;
54
56
  };
55
57
  getRenderZoneProps: () => {
56
58
  ref: React.RefObject<HTMLDivElement>;
59
+ role: string;
57
60
  };
58
61
  };
59
62
  export {};
@@ -553,15 +553,18 @@ export const useGridVirtualScroller = props => {
553
553
  onWheel: handleWheel,
554
554
  onTouchMove: handleTouchMove
555
555
  }, inputProps, {
556
- style: inputProps.style ? _extends({}, inputProps.style, rootStyle) : rootStyle
556
+ style: inputProps.style ? _extends({}, inputProps.style, rootStyle) : rootStyle,
557
+ role: 'presentation'
557
558
  }),
558
559
  getContentProps: ({
559
560
  style
560
561
  } = {}) => ({
561
- style: style ? _extends({}, style, contentSize) : contentSize
562
+ style: style ? _extends({}, style, contentSize) : contentSize,
563
+ role: 'presentation'
562
564
  }),
563
565
  getRenderZoneProps: () => ({
564
- ref: renderZoneRef
566
+ ref: renderZoneRef,
567
+ role: 'rowgroup'
565
568
  })
566
569
  };
567
570
  };
@@ -0,0 +1,6 @@
1
+ export declare const useGridAriaAttributes: () => {
2
+ role: string;
3
+ 'aria-colcount': number;
4
+ 'aria-rowcount': number;
5
+ 'aria-multiselectable': boolean;
6
+ };
@@ -0,0 +1,25 @@
1
+ import { gridVisibleColumnDefinitionsSelector } from '../features/columns/gridColumnsSelector';
2
+ import { useGridSelector } from './useGridSelector';
3
+ import { useGridRootProps } from './useGridRootProps';
4
+ import { gridColumnGroupsHeaderMaxDepthSelector } from '../features/columnGrouping/gridColumnGroupsSelector';
5
+ import { gridPinnedRowsCountSelector, gridRowCountSelector } from '../features/rows/gridRowsSelector';
6
+ import { useGridPrivateApiContext } from './useGridPrivateApiContext';
7
+ export const useGridAriaAttributes = () => {
8
+ var _rootProps$experiment;
9
+ const apiRef = useGridPrivateApiContext();
10
+ const rootProps = useGridRootProps();
11
+ const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
12
+ const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
13
+ const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
14
+ const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
15
+ let role = 'grid';
16
+ if ((_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.ariaV7 && rootProps.treeData) {
17
+ role = 'treegrid';
18
+ }
19
+ return {
20
+ role,
21
+ 'aria-colcount': visibleColumns.length,
22
+ 'aria-rowcount': headerGroupingMaxDepth + 1 + pinnedRowsCount + totalRowCount,
23
+ 'aria-multiselectable': !rootProps.disableMultipleRowSelection
24
+ };
25
+ };
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.10.2
2
+ * @mui/x-data-grid v6.11.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -163,6 +163,7 @@ DataGridRaw.propTypes = {
163
163
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
164
164
  */
165
165
  experimentalFeatures: PropTypes.shape({
166
+ ariaV7: PropTypes.bool,
166
167
  columnGrouping: PropTypes.bool,
167
168
  warnIfFocusStateIsNotSynced: PropTypes.bool
168
169
  }),
@@ -201,7 +202,7 @@ DataGridRaw.propTypes = {
201
202
  /**
202
203
  * Function that returns the element to render in row detail.
203
204
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
204
- * @returns {JSX.Element} The row detail element.
205
+ * @returns {React.JSX.Element} The row detail element.
205
206
  */
206
207
  getDetailPanelContent: PropTypes.func,
207
208
  /**
@@ -8,7 +8,7 @@ export var GLOBAL_API_REF = {
8
8
 
9
9
  /**
10
10
  * A tagger to determine if the filter is internal or custom user-supplied.
11
- * To be a valid internal filter, the V7 function *must* be defined/redefined at
11
+ * To be a valid internal filter, the v7 function *must* be defined/redefined at
12
12
  * the same time as the legacy one.
13
13
  * https://github.com/mui/mui-x/pull/9254#discussion_r1231095551
14
14
  */