@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/locales/fiFI.js CHANGED
@@ -37,7 +37,7 @@ const fiFIGrid = {
37
37
  columnsPanelHideAllButton: 'Piilota kaikki',
38
38
  // Filter panel text
39
39
  filterPanelAddFilter: 'Lisää suodatin',
40
- // filterPanelRemoveAll: 'Remove all',
40
+ filterPanelRemoveAll: 'Poista kaikki',
41
41
  filterPanelDeleteIconLabel: 'Poista',
42
42
  filterPanelLogicOperator: 'Logiikkaoperaattori',
43
43
  filterPanelOperator: 'Operaattorit',
@@ -48,7 +48,7 @@ const fiFIGrid = {
48
48
  filterPanelInputPlaceholder: 'Suodattimen arvo',
49
49
  // Filter operators text
50
50
  filterOperatorContains: 'sisältää',
51
- filterOperatorEquals: 'on yhtä suuri',
51
+ filterOperatorEquals: 'on yhtä suuri kuin',
52
52
  filterOperatorStartsWith: 'alkaa',
53
53
  filterOperatorEndsWith: 'päättyy',
54
54
  filterOperatorIs: 'on',
@@ -59,35 +59,33 @@ const fiFIGrid = {
59
59
  filterOperatorOnOrBefore: 'on sama tai ennen',
60
60
  filterOperatorIsEmpty: 'on tyhjä',
61
61
  filterOperatorIsNotEmpty: 'ei ole tyhjä',
62
- filterOperatorIsAnyOf: 'mikä tahansa seuraavista',
63
- // 'filterOperator=': '=',
64
- // 'filterOperator!=': '!=',
65
- // 'filterOperator>': '>',
66
- // 'filterOperator>=': '>=',
67
- // 'filterOperator<': '<',
68
- // 'filterOperator<=': '<=',
69
-
62
+ filterOperatorIsAnyOf: 'on mikä tahansa seuraavista',
63
+ 'filterOperator=': '=',
64
+ 'filterOperator!=': '!=',
65
+ 'filterOperator>': '>',
66
+ 'filterOperator>=': '>=',
67
+ 'filterOperator<': '<',
68
+ 'filterOperator<=': '<=',
70
69
  // Header filter operators text
71
- // headerFilterOperatorContains: 'Contains',
72
- // headerFilterOperatorEquals: 'Equals',
73
- // headerFilterOperatorStartsWith: 'Starts with',
74
- // headerFilterOperatorEndsWith: 'Ends with',
75
- // headerFilterOperatorIs: 'Is',
76
- // headerFilterOperatorNot: 'Is not',
77
- // headerFilterOperatorAfter: 'Is after',
78
- // headerFilterOperatorOnOrAfter: 'Is on or after',
79
- // headerFilterOperatorBefore: 'Is before',
80
- // headerFilterOperatorOnOrBefore: 'Is on or before',
81
- // headerFilterOperatorIsEmpty: 'Is empty',
82
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
83
- // headerFilterOperatorIsAnyOf: 'Is any of',
84
- // 'headerFilterOperator=': 'Equals',
85
- // 'headerFilterOperator!=': 'Not equals',
86
- // 'headerFilterOperator>': 'Greater than',
87
- // 'headerFilterOperator>=': 'Greater than or equal to',
88
- // 'headerFilterOperator<': 'Less than',
89
- // 'headerFilterOperator<=': 'Less than or equal to',
90
-
70
+ headerFilterOperatorContains: 'Sisältää',
71
+ headerFilterOperatorEquals: 'On yhtä suuri kuin',
72
+ headerFilterOperatorStartsWith: 'Alkaa',
73
+ headerFilterOperatorEndsWith: 'Päättyy',
74
+ headerFilterOperatorIs: 'On',
75
+ headerFilterOperatorNot: 'Ei ole',
76
+ headerFilterOperatorAfter: 'On jälkeen',
77
+ headerFilterOperatorOnOrAfter: 'On sama tai jälkeen',
78
+ headerFilterOperatorBefore: 'On ennen',
79
+ headerFilterOperatorOnOrBefore: 'On sama tai ennen',
80
+ headerFilterOperatorIsEmpty: 'On tyhjä',
81
+ headerFilterOperatorIsNotEmpty: 'Ei ole tyhjä',
82
+ headerFilterOperatorIsAnyOf: 'On mikä tahansa seuraavista',
83
+ 'headerFilterOperator=': 'On yhtä suuri kuin',
84
+ 'headerFilterOperator!=': 'Ei ole yhtä suuri kuin',
85
+ 'headerFilterOperator>': 'Enemmän kuin',
86
+ 'headerFilterOperator>=': 'Enemmän tai yhtä paljon kuin',
87
+ 'headerFilterOperator<': 'Vähemmän kuin',
88
+ 'headerFilterOperator<=': 'Vähemmän tai yhtä paljon kuin',
91
89
  // Filter values text
92
90
  filterValueAny: 'mikä tahansa',
93
91
  filterValueTrue: 'tosi',
package/locales/heIL.js CHANGED
@@ -68,26 +68,25 @@ const heILGrid = {
68
68
  // 'filterOperator<=': '<=',
69
69
 
70
70
  // Header filter operators text
71
- // headerFilterOperatorContains: 'Contains',
72
- // headerFilterOperatorEquals: 'Equals',
73
- // headerFilterOperatorStartsWith: 'Starts with',
74
- // headerFilterOperatorEndsWith: 'Ends with',
75
- // headerFilterOperatorIs: 'Is',
76
- // headerFilterOperatorNot: 'Is not',
77
- // headerFilterOperatorAfter: 'Is after',
78
- // headerFilterOperatorOnOrAfter: 'Is on or after',
79
- // headerFilterOperatorBefore: 'Is before',
80
- // headerFilterOperatorOnOrBefore: 'Is on or before',
81
- // headerFilterOperatorIsEmpty: 'Is empty',
82
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
83
- // headerFilterOperatorIsAnyOf: 'Is any of',
84
- // 'headerFilterOperator=': 'Equals',
85
- // 'headerFilterOperator!=': 'Not equals',
86
- // 'headerFilterOperator>': 'Greater than',
87
- // 'headerFilterOperator>=': 'Greater than or equal to',
88
- // 'headerFilterOperator<': 'Less than',
89
- // 'headerFilterOperator<=': 'Less than or equal to',
90
-
71
+ headerFilterOperatorContains: 'מכיל',
72
+ headerFilterOperatorEquals: 'שווה',
73
+ headerFilterOperatorStartsWith: 'מתחיל ב-',
74
+ headerFilterOperatorEndsWith: 'נגמר ב-',
75
+ headerFilterOperatorIs: 'הינו',
76
+ headerFilterOperatorNot: 'אינו',
77
+ headerFilterOperatorAfter: 'אחרי',
78
+ headerFilterOperatorOnOrAfter: 'ב- או אחרי',
79
+ headerFilterOperatorBefore: 'לפני',
80
+ headerFilterOperatorOnOrBefore: 'ב- או לפני',
81
+ headerFilterOperatorIsEmpty: 'ריק',
82
+ headerFilterOperatorIsNotEmpty: 'אינו ריק',
83
+ headerFilterOperatorIsAnyOf: 'הוא אחד מ-',
84
+ 'headerFilterOperator=': 'שווה',
85
+ 'headerFilterOperator!=': 'אינו שווה',
86
+ 'headerFilterOperator>': 'גדול מ-',
87
+ 'headerFilterOperator>=': 'גדול שווה ל-',
88
+ 'headerFilterOperator<': 'קטן מ-',
89
+ 'headerFilterOperator<=': 'קטן שווה ל-',
91
90
  // Filter values text
92
91
  filterValueAny: 'כל ערך',
93
92
  filterValueTrue: 'כן',
@@ -140,15 +139,13 @@ const heILGrid = {
140
139
  expandDetailPanel: 'הרחב',
141
140
  collapseDetailPanel: 'כווץ',
142
141
  // Row reordering text
143
- rowReorderingHeaderName: 'סידור שורות'
144
-
142
+ rowReorderingHeaderName: 'סידור שורות',
145
143
  // Aggregation
146
- // aggregationMenuItemHeader: 'Aggregation',
147
- // aggregationFunctionLabelSum: 'sum',
148
- // aggregationFunctionLabelAvg: 'avg',
149
- // aggregationFunctionLabelMin: 'min',
150
- // aggregationFunctionLabelMax: 'max',
151
- // aggregationFunctionLabelSize: 'size',
144
+ aggregationMenuItemHeader: 'צבירה',
145
+ aggregationFunctionLabelSum: 'סכום',
146
+ aggregationFunctionLabelAvg: 'ממוצע',
147
+ aggregationFunctionLabelMin: 'מינימום',
148
+ aggregationFunctionLabelMax: 'מקסימום',
149
+ aggregationFunctionLabelSize: 'גודל'
152
150
  };
153
-
154
151
  export const heIL = getGridLocalization(heILGrid, heILCore);
package/locales/itIT.js CHANGED
@@ -37,7 +37,7 @@ const itITGrid = {
37
37
  columnsPanelHideAllButton: 'Nascondi tutto',
38
38
  // Filter panel text
39
39
  filterPanelAddFilter: 'Aggiungi un filtro',
40
- // filterPanelRemoveAll: 'Remove all',
40
+ filterPanelRemoveAll: 'Rimuovi filtri',
41
41
  filterPanelDeleteIconLabel: 'Rimuovi',
42
42
  filterPanelLogicOperator: 'Operatore logico',
43
43
  filterPanelOperator: 'Operatori',
@@ -60,34 +60,32 @@ const itITGrid = {
60
60
  filterOperatorIsEmpty: 'è vuoto',
61
61
  filterOperatorIsNotEmpty: 'non è vuoto',
62
62
  filterOperatorIsAnyOf: 'è uno tra',
63
- // 'filterOperator=': '=',
64
- // 'filterOperator!=': '!=',
65
- // 'filterOperator>': '>',
66
- // 'filterOperator>=': '>=',
67
- // 'filterOperator<': '<',
68
- // 'filterOperator<=': '<=',
69
-
63
+ 'filterOperator=': '=',
64
+ 'filterOperator!=': '!=',
65
+ 'filterOperator>': '>',
66
+ 'filterOperator>=': '>=',
67
+ 'filterOperator<': '<',
68
+ 'filterOperator<=': '<=',
70
69
  // Header filter operators text
71
- // headerFilterOperatorContains: 'Contains',
72
- // headerFilterOperatorEquals: 'Equals',
73
- // headerFilterOperatorStartsWith: 'Starts with',
74
- // headerFilterOperatorEndsWith: 'Ends with',
75
- // headerFilterOperatorIs: 'Is',
76
- // headerFilterOperatorNot: 'Is not',
77
- // headerFilterOperatorAfter: 'Is after',
78
- // headerFilterOperatorOnOrAfter: 'Is on or after',
79
- // headerFilterOperatorBefore: 'Is before',
80
- // headerFilterOperatorOnOrBefore: 'Is on or before',
81
- // headerFilterOperatorIsEmpty: 'Is empty',
82
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
83
- // headerFilterOperatorIsAnyOf: 'Is any of',
84
- // 'headerFilterOperator=': 'Equals',
85
- // 'headerFilterOperator!=': 'Not equals',
86
- // 'headerFilterOperator>': 'Greater than',
87
- // 'headerFilterOperator>=': 'Greater than or equal to',
88
- // 'headerFilterOperator<': 'Less than',
89
- // 'headerFilterOperator<=': 'Less than or equal to',
90
-
70
+ headerFilterOperatorContains: 'Contiene',
71
+ headerFilterOperatorEquals: 'uguale a',
72
+ headerFilterOperatorStartsWith: 'comincia per',
73
+ headerFilterOperatorEndsWith: 'termina per',
74
+ headerFilterOperatorIs: 'uguale a',
75
+ headerFilterOperatorNot: 'diversa da',
76
+ headerFilterOperatorAfter: 'dopo il',
77
+ headerFilterOperatorOnOrAfter: 'a partire dal',
78
+ headerFilterOperatorBefore: 'prima del',
79
+ headerFilterOperatorOnOrBefore: 'fino al',
80
+ headerFilterOperatorIsEmpty: 'è vuoto',
81
+ headerFilterOperatorIsNotEmpty: 'non è vuoto',
82
+ headerFilterOperatorIsAnyOf: 'è uno tra',
83
+ 'headerFilterOperator=': 'uguale a',
84
+ 'headerFilterOperator!=': 'diverso da',
85
+ 'headerFilterOperator>': 'maggiore di',
86
+ 'headerFilterOperator>=': 'maggiore o uguale a',
87
+ 'headerFilterOperator<': 'minore di',
88
+ 'headerFilterOperator<=': 'minore o uguale a',
91
89
  // Filter values text
92
90
  filterValueAny: 'qualunque',
93
91
  filterValueTrue: 'vero',
@@ -95,7 +93,7 @@ const itITGrid = {
95
93
  // Column menu text
96
94
  columnMenuLabel: 'Menu',
97
95
  columnMenuShowColumns: 'Mostra le colonne',
98
- // columnMenuManageColumns: 'Manage columns',
96
+ columnMenuManageColumns: 'Gestisci colonne',
99
97
  columnMenuFilter: 'Filtra',
100
98
  columnMenuHideColumn: 'Nascondi',
101
99
  columnMenuUnsort: "Annulla l'ordinamento",
@@ -139,15 +137,13 @@ const itITGrid = {
139
137
  expandDetailPanel: 'Espandi',
140
138
  collapseDetailPanel: 'Comprimi',
141
139
  // Row reordering text
142
- rowReorderingHeaderName: 'Riordinamento righe'
143
-
140
+ rowReorderingHeaderName: 'Riordinamento righe',
144
141
  // Aggregation
145
- // aggregationMenuItemHeader: 'Aggregation',
146
- // aggregationFunctionLabelSum: 'sum',
147
- // aggregationFunctionLabelAvg: 'avg',
148
- // aggregationFunctionLabelMin: 'min',
149
- // aggregationFunctionLabelMax: 'max',
150
- // aggregationFunctionLabelSize: 'size',
142
+ aggregationMenuItemHeader: 'aggregazione',
143
+ aggregationFunctionLabelSum: 'somma',
144
+ aggregationFunctionLabelAvg: 'media',
145
+ aggregationFunctionLabelMin: 'minimo',
146
+ aggregationFunctionLabelMax: 'massimo',
147
+ aggregationFunctionLabelSize: 'numero di elementi'
151
148
  };
152
-
153
149
  export const itIT = getGridLocalization(itITGrid, itITCore);
@@ -38,7 +38,7 @@ export interface GridFilterOperator<R extends GridValidRowModel = any, V = any,
38
38
  /**
39
39
  * The callback that generates a filtering function for a given filter item and column.
40
40
  * This function can return `null` to skip filtering for this item and column.
41
- * This function uses the more performant V7 API.
41
+ * This function uses the more performant v7 API.
42
42
  * @param {GridFilterItem} filterItem The filter item with which we want to filter the column.
43
43
  * @param {GridColDef} column The column from which we want to filter the rows.
44
44
  * @returns {null | ApplyFilterFnV7} The function to call to check if a row pass this filter item or not.
@@ -35,6 +35,12 @@ export interface GridExperimentalFeatures {
35
35
  * Only works if NODE_ENV=test.
36
36
  */
37
37
  warnIfFocusStateIsNotSynced: boolean;
38
+ /**
39
+ * Enables accessibility improvements that will be enabled by default in v7.
40
+ * If you rely on the v6 ARIA attributes (e.g. for CSS selectors), this might be a breaking change.
41
+ * @default false
42
+ */
43
+ ariaV7: boolean;
38
44
  }
39
45
  /**
40
46
  * The props users can give to the `DataGrid` component.
@@ -391,7 +397,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
391
397
  /**
392
398
  * Function that returns the element to render in row detail.
393
399
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
394
- * @returns {JSX.Element} The row detail element.
400
+ * @returns {React.JSX.Element} The row detail element.
395
401
  */
396
402
  getDetailPanelContent?: (params: GridRowParams<R>) => React.ReactNode;
397
403
  /**
@@ -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
  /**
@@ -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';
@@ -286,6 +285,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
286
285
  children = /*#__PURE__*/_jsx("div", {
287
286
  className: classes.content,
288
287
  title: valueString,
288
+ role: "presentation",
289
289
  children: valueString
290
290
  });
291
291
  }
@@ -298,27 +298,32 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
298
298
  onDragEnter: publish('cellDragEnter', onDragEnter),
299
299
  onDragOver: publish('cellDragOver', onDragOver)
300
300
  };
301
- return /*#__PURE__*/_jsx("div", _extends({
302
- ref: handleRef,
303
- className: clsx(className, classes.root),
304
- role: "cell",
305
- "data-field": field,
306
- "data-colindex": colIndex,
307
- "aria-colindex": colIndex + 1,
308
- "aria-colspan": colSpan,
309
- style: style,
310
- tabIndex: tabIndex,
311
- onClick: publish('cellClick', onClick),
312
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
313
- onMouseOver: publish('cellMouseOver', onMouseOver),
314
- onMouseDown: publishMouseDown('cellMouseDown'),
315
- onMouseUp: publishMouseUp('cellMouseUp'),
316
- onKeyDown: publish('cellKeyDown', onKeyDown),
317
- onKeyUp: publish('cellKeyUp', onKeyUp)
318
- }, draggableEventHandlers, other, {
319
- onFocus: handleFocus,
320
- children: children
321
- }));
301
+ const ariaV7 = rootProps.experimentalFeatures?.ariaV7;
302
+ return (
303
+ /*#__PURE__*/
304
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
305
+ _jsx("div", _extends({
306
+ ref: handleRef,
307
+ className: clsx(className, classes.root),
308
+ role: ariaV7 ? 'gridcell' : 'cell',
309
+ "data-field": field,
310
+ "data-colindex": colIndex,
311
+ "aria-colindex": colIndex + 1,
312
+ "aria-colspan": colSpan,
313
+ style: style,
314
+ tabIndex: tabIndex,
315
+ onClick: publish('cellClick', onClick),
316
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
317
+ onMouseOver: publish('cellMouseOver', onMouseOver),
318
+ onMouseDown: publishMouseDown('cellMouseDown'),
319
+ onMouseUp: publishMouseUp('cellMouseUp'),
320
+ onKeyDown: publish('cellKeyDown', onKeyDown),
321
+ onKeyUp: publish('cellKeyUp', onKeyUp)
322
+ }, draggableEventHandlers, other, {
323
+ onFocus: handleFocus,
324
+ children: children
325
+ }))
326
+ );
322
327
  });
323
328
  const MemoizedCellWrapper = fastMemo(GridCellWrapper);
324
329
  process.env.NODE_ENV !== "production" ? GridCellWrapper.propTypes = {
@@ -563,6 +568,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
563
568
  children = /*#__PURE__*/_jsx("div", {
564
569
  className: classes.content,
565
570
  title: valueString,
571
+ role: "presentation",
566
572
  children: valueString
567
573
  });
568
574
  }
@@ -575,27 +581,32 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
575
581
  onDragEnter: publish('cellDragEnter', onDragEnter),
576
582
  onDragOver: publish('cellDragOver', onDragOver)
577
583
  };
578
- return /*#__PURE__*/_jsx("div", _extends({
579
- ref: handleRef,
580
- className: clsx(className, classNames, classes.root),
581
- role: "cell",
582
- "data-field": field,
583
- "data-colindex": colIndex,
584
- "aria-colindex": colIndex + 1,
585
- "aria-colspan": colSpan,
586
- style: style,
587
- tabIndex: tabIndex,
588
- onClick: publish('cellClick', onClick),
589
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
590
- onMouseOver: publish('cellMouseOver', onMouseOver),
591
- onMouseDown: publishMouseDown('cellMouseDown'),
592
- onMouseUp: publishMouseUp('cellMouseUp'),
593
- onKeyDown: publish('cellKeyDown', onKeyDown),
594
- onKeyUp: publish('cellKeyUp', onKeyUp)
595
- }, draggableEventHandlers, other, {
596
- onFocus: handleFocus,
597
- children: children
598
- }));
584
+ const ariaV7 = rootProps.experimentalFeatures?.ariaV7;
585
+ return (
586
+ /*#__PURE__*/
587
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
588
+ _jsx("div", _extends({
589
+ ref: handleRef,
590
+ className: clsx(className, classNames, classes.root),
591
+ role: ariaV7 ? 'gridcell' : 'cell',
592
+ "data-field": field,
593
+ "data-colindex": colIndex,
594
+ "aria-colindex": colIndex + 1,
595
+ "aria-colspan": colSpan,
596
+ style: style,
597
+ tabIndex: tabIndex,
598
+ onClick: publish('cellClick', onClick),
599
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
600
+ onMouseOver: publish('cellMouseOver', onMouseOver),
601
+ onMouseDown: publishMouseDown('cellMouseDown'),
602
+ onMouseUp: publishMouseUp('cellMouseUp'),
603
+ onKeyDown: publish('cellKeyDown', onKeyDown),
604
+ onKeyUp: publish('cellKeyUp', onKeyUp)
605
+ }, draggableEventHandlers, other, {
606
+ onFocus: handleFocus,
607
+ children: children
608
+ }))
609
+ );
599
610
  });
600
611
  process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
601
612
  // ----------------------------- 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 {
@@ -27,10 +29,14 @@ const GridMainContainerRoot = styled('div', {
27
29
  export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
28
30
  const rootProps = useGridRootProps();
29
31
  const classes = useUtilityClasses(rootProps);
30
- return /*#__PURE__*/_jsx(GridMainContainerRoot, {
32
+ const getAriaAttributes = rootProps.experimentalFeatures?.ariaV7 // ariaV7 should never change
33
+ ? useGridAriaAttributes : null;
34
+ const ariaAttributes = typeof getAriaAttributes === 'function' ? getAriaAttributes() : null;
35
+ return /*#__PURE__*/_jsx(GridMainContainerRoot, _extends({
31
36
  ref: ref,
32
37
  className: classes.root,
33
- ownerState: rootProps,
38
+ ownerState: rootProps
39
+ }, ariaAttributes, {
34
40
  children: props.children
35
- });
41
+ }));
36
42
  });
@@ -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 {
@@ -34,13 +32,12 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
34
32
  } = props,
35
33
  other = _objectWithoutPropertiesLoose(props, _excluded);
36
34
  const apiRef = useGridPrivateApiContext();
37
- const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
38
- const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
39
35
  const densityValue = useGridSelector(apiRef, gridDensityValueSelector);
40
- const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
41
36
  const rootContainerRef = React.useRef(null);
42
37
  const handleRef = useForkRef(rootContainerRef, ref);
43
- const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
38
+ const getAriaAttributes = rootProps.experimentalFeatures?.ariaV7 // ariaV7 should never change
39
+ ? null : useGridAriaAttributes;
40
+ const ariaAttributes = typeof getAriaAttributes === 'function' ? getAriaAttributes() : null;
44
41
  const ownerState = _extends({}, rootProps, {
45
42
  density: densityValue
46
43
  });
@@ -60,12 +57,8 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
60
57
  return /*#__PURE__*/_jsx(GridRootStyles, _extends({
61
58
  ref: handleRef,
62
59
  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, {
60
+ ownerState: ownerState
61
+ }, ariaAttributes, other, {
69
62
  children: children
70
63
  }));
71
64
  });
@@ -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;
@@ -549,15 +549,18 @@ export const useGridVirtualScroller = props => {
549
549
  onWheel: handleWheel,
550
550
  onTouchMove: handleTouchMove
551
551
  }, inputProps, {
552
- style: inputProps.style ? _extends({}, inputProps.style, rootStyle) : rootStyle
552
+ style: inputProps.style ? _extends({}, inputProps.style, rootStyle) : rootStyle,
553
+ role: 'presentation'
553
554
  }),
554
555
  getContentProps: ({
555
556
  style
556
557
  } = {}) => ({
557
- style: style ? _extends({}, style, contentSize) : contentSize
558
+ style: style ? _extends({}, style, contentSize) : contentSize,
559
+ role: 'presentation'
558
560
  }),
559
561
  getRenderZoneProps: () => ({
560
- ref: renderZoneRef
562
+ ref: renderZoneRef,
563
+ role: 'rowgroup'
561
564
  })
562
565
  };
563
566
  };
@@ -0,0 +1,24 @@
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
+ const apiRef = useGridPrivateApiContext();
9
+ const rootProps = useGridRootProps();
10
+ const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
11
+ const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
12
+ const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
13
+ const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
14
+ let role = 'grid';
15
+ if (rootProps.experimentalFeatures?.ariaV7 && rootProps.treeData) {
16
+ role = 'treegrid';
17
+ }
18
+ return {
19
+ role,
20
+ 'aria-colcount': visibleColumns.length,
21
+ 'aria-rowcount': headerGroupingMaxDepth + 1 + pinnedRowsCount + totalRowCount,
22
+ 'aria-multiselectable': !rootProps.disableMultipleRowSelection
23
+ };
24
+ };
package/modern/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