@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.
- package/CHANGELOG.md +92 -0
- package/DataGrid/DataGrid.d.ts +1 -1
- package/DataGrid/DataGrid.js +2 -1
- package/colDef/utils.d.ts +1 -1
- package/colDef/utils.js +1 -1
- package/components/cell/GridCell.js +57 -46
- package/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
- package/components/containers/GridMainContainer.js +10 -3
- package/components/containers/GridRoot.js +7 -13
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +7 -4
- package/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
- package/hooks/utils/useGridAriaAttributes.d.ts +6 -0
- package/hooks/utils/useGridAriaAttributes.js +25 -0
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +2 -1
- package/legacy/colDef/utils.js +1 -1
- package/legacy/components/cell/GridCell.js +57 -46
- package/legacy/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
- package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
- package/legacy/components/containers/GridMainContainer.js +10 -3
- package/legacy/components/containers/GridRoot.js +7 -13
- package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
- package/legacy/hooks/utils/useGridAriaAttributes.js +25 -0
- package/legacy/index.js +1 -1
- package/legacy/locales/fiFI.js +28 -30
- package/legacy/locales/heIL.js +26 -29
- package/legacy/locales/itIT.js +34 -38
- package/locales/fiFI.js +28 -30
- package/locales/heIL.js +26 -29
- package/locales/itIT.js +34 -38
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +7 -1
- package/modern/DataGrid/DataGrid.js +2 -1
- package/modern/colDef/utils.js +1 -1
- package/modern/components/cell/GridCell.js +54 -43
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
- package/modern/components/containers/GridMainContainer.js +9 -3
- package/modern/components/containers/GridRoot.js +6 -13
- package/modern/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
- package/modern/hooks/utils/useGridAriaAttributes.js +24 -0
- package/modern/index.js +1 -1
- package/modern/locales/fiFI.js +28 -30
- package/modern/locales/heIL.js +26 -29
- package/modern/locales/itIT.js +34 -38
- package/node/DataGrid/DataGrid.js +2 -1
- package/node/colDef/utils.js +1 -1
- package/node/components/cell/GridCell.js +54 -43
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
- package/node/components/containers/GridMainContainer.js +10 -3
- package/node/components/containers/GridRoot.js +6 -13
- package/node/hooks/features/columns/gridColumnsUtils.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +6 -3
- package/node/hooks/utils/useGridAriaAttributes.js +31 -0
- package/node/index.js +1 -1
- package/node/locales/fiFI.js +28 -30
- package/node/locales/heIL.js +26 -29
- package/node/locales/itIT.js +34 -38
- 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
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
'filterOperator=': '=',
|
|
64
|
+
'filterOperator!=': '!=',
|
|
65
|
+
'filterOperator>': '>',
|
|
66
|
+
'filterOperator>=': '>=',
|
|
67
|
+
'filterOperator<': '<',
|
|
68
|
+
'filterOperator<=': '<=',
|
|
70
69
|
// Header filter operators text
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
|
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
|
/**
|
package/modern/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
|
|
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
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
"
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
"
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
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 --------------------------------
|
|
@@ -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
|
-
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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