@mui/x-data-grid 6.10.1 → 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 (84) hide show
  1. package/CHANGELOG.md +156 -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/GridRow.d.ts +2 -0
  7. package/components/GridRow.js +50 -22
  8. package/components/cell/GridCell.d.ts +2 -2
  9. package/components/cell/GridCell.js +95 -60
  10. package/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  11. package/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  12. package/components/containers/GridMainContainer.js +10 -3
  13. package/components/containers/GridRoot.js +7 -13
  14. package/components/containers/GridRootStyles.js +1 -0
  15. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
  16. package/hooks/features/columns/gridColumnsUtils.js +2 -2
  17. package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  18. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +7 -4
  19. package/hooks/features/virtualization/useGridVirtualScroller.js +75 -8
  20. package/hooks/utils/useGridAriaAttributes.d.ts +6 -0
  21. package/hooks/utils/useGridAriaAttributes.js +25 -0
  22. package/index.js +1 -1
  23. package/internals/index.d.ts +1 -1
  24. package/internals/index.js +1 -1
  25. package/legacy/DataGrid/DataGrid.js +2 -1
  26. package/legacy/colDef/utils.js +1 -1
  27. package/legacy/components/GridRow.js +47 -21
  28. package/legacy/components/cell/GridCell.js +95 -60
  29. package/legacy/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  30. package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  31. package/legacy/components/containers/GridMainContainer.js +10 -3
  32. package/legacy/components/containers/GridRoot.js +7 -13
  33. package/legacy/components/containers/GridRootStyles.js +1 -0
  34. package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
  35. package/legacy/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  36. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +79 -8
  37. package/legacy/hooks/utils/useGridAriaAttributes.js +25 -0
  38. package/legacy/index.js +1 -1
  39. package/legacy/internals/index.js +1 -1
  40. package/legacy/locales/fiFI.js +29 -31
  41. package/legacy/locales/heIL.js +26 -29
  42. package/legacy/locales/itIT.js +34 -38
  43. package/locales/fiFI.js +29 -31
  44. package/locales/heIL.js +26 -29
  45. package/locales/itIT.js +34 -38
  46. package/models/gridFilterOperator.d.ts +1 -1
  47. package/models/props/DataGridProps.d.ts +7 -1
  48. package/modern/DataGrid/DataGrid.js +2 -1
  49. package/modern/colDef/utils.js +1 -1
  50. package/modern/components/GridRow.js +50 -22
  51. package/modern/components/cell/GridCell.js +92 -57
  52. package/modern/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  53. package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  54. package/modern/components/containers/GridMainContainer.js +9 -3
  55. package/modern/components/containers/GridRoot.js +6 -13
  56. package/modern/components/containers/GridRootStyles.js +1 -0
  57. package/modern/hooks/features/columns/gridColumnsUtils.js +2 -2
  58. package/modern/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  59. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +75 -8
  60. package/modern/hooks/utils/useGridAriaAttributes.js +24 -0
  61. package/modern/index.js +1 -1
  62. package/modern/internals/index.js +1 -1
  63. package/modern/locales/fiFI.js +29 -31
  64. package/modern/locales/heIL.js +26 -29
  65. package/modern/locales/itIT.js +34 -38
  66. package/node/DataGrid/DataGrid.js +2 -1
  67. package/node/colDef/utils.js +1 -1
  68. package/node/components/GridRow.js +50 -22
  69. package/node/components/cell/GridCell.js +92 -57
  70. package/node/components/columnHeaders/GridBaseColumnHeaders.js +3 -1
  71. package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
  72. package/node/components/containers/GridMainContainer.js +10 -3
  73. package/node/components/containers/GridRoot.js +6 -13
  74. package/node/components/containers/GridRootStyles.js +1 -0
  75. package/node/hooks/features/columns/gridColumnsUtils.js +1 -1
  76. package/node/hooks/features/rowSelection/useGridRowSelection.js +1 -1
  77. package/node/hooks/features/virtualization/useGridVirtualScroller.js +75 -8
  78. package/node/hooks/utils/useGridAriaAttributes.js +31 -0
  79. package/node/index.js +1 -1
  80. package/node/internals/index.js +7 -0
  81. package/node/locales/fiFI.js +29 -31
  82. package/node/locales/heIL.js +26 -29
  83. package/node/locales/itIT.js +34 -38
  84. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,162 @@
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
+
98
+ ## 6.10.2
99
+
100
+ _Jul 27, 2023_
101
+
102
+ We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
103
+
104
+ - 🚀 Improve scatter charts performance
105
+ - 📚 Redesigned component API documentation and side navigation
106
+ - 🐞 Bugfixes
107
+
108
+ ### Data Grid
109
+
110
+ #### `@mui/x-data-grid@v6.10.2`
111
+
112
+ - [DataGrid] Fix quick filter & aggregation error (#9729) @romgrk
113
+ - [DataGrid] Fix row click propagation causing error in nested grid (#9741) @cherniavskii
114
+ - [DataGrid] Keep focused cell in the DOM (#7357) @yaredtsy
115
+ - [l10n] Improve Finnish (fi-FI) locale (#9746) @sambbaahh
116
+
117
+ #### `@mui/x-data-grid-pro@v6.10.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
118
+
119
+ Same changes as in `@mui/x-data-grid@v6.10.2`.
120
+
121
+ #### `@mui/x-data-grid-premium@v6.10.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link)
122
+
123
+ Same changes as in `@mui/x-data-grid-pro@v6.10.2`, plus:
124
+
125
+ - [DataGridPremium] Allow to customize grouping cell offset (#9417) @cherniavskii
126
+
127
+ ### Date Pickers
128
+
129
+ #### `@mui/x-date-pickers@v6.10.2`
130
+
131
+ - [pickers] Remove the `endOfDate` from `DigitalClock` timeOptions (#9800) @noraleonte
132
+
133
+ #### `@mui/x-date-pickers-pro@v6.10.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
134
+
135
+ Same changes as in `@mui/x-date-pickers@v6.10.2`.
136
+
137
+ ### Charts / `@mui/x-charts@v6.0.0-alpha.5`
138
+
139
+ - [charts] Improve JSDoc for axis-related props (#9779) @flaviendelangle
140
+ - [charts] Improve performances of Scatter component (#9527) @flaviendelangle
141
+
142
+ ### Docs
143
+
144
+ - [docs] Add `pnpm` in more places @oliviertassinari
145
+ - [docs] Add `pnpm` installation instructions for MUI X (#9707) @richbustos
146
+ - [docs] Align pickers "uncontrolled vs controlled" sections (#9772) @LukasTy
147
+ - [docs] Apply style guide to the data grid Layout page (#9673) @richbustos
148
+ - [docs] Differentiate between packages in `slotProps` docs (#9668) @cherniavskii
149
+ - [docs] Fix charts width in axis pages (#9801) @alexfauquette
150
+ - [docs] Fix wrong prop name in the Editing page (#9753) @m4theushw
151
+ - [docs] New component API page and side nav design (#9187) @alexfauquette
152
+ - [docs] Update overview page with up to date information about the plans (#9512) @joserodolfofreitas
153
+
154
+ ### Core
155
+
156
+ - [core] Use PR charts version in preview (#9787) @alexfauquette
157
+ - [license] Allow overriding the license on specific parts of the page (#9717) @Janpot
158
+ - [license] Throw in dev mode after 30 days (#9701) @oliviertassinari
159
+ - [license] Only throw in dev mode (#9803) @oliviertassinari
160
+ - [test] Fail the CI when new unexpected files are created (#9728) @oliviertassinari
161
+
6
162
  ## 6.10.1
7
163
 
8
164
  _Jul 20, 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
  */
@@ -28,6 +28,8 @@ export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
28
28
  tabbableCell: string | null;
29
29
  row?: GridRowModel;
30
30
  isLastVisible?: boolean;
31
+ focusedCellColumnIndexNotInRange?: number;
32
+ isNotVisible?: boolean;
31
33
  onClick?: React.MouseEventHandler<HTMLDivElement>;
32
34
  onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
33
35
  onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
3
+ const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -64,10 +64,14 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
64
64
  position,
65
65
  rowHeight,
66
66
  className,
67
+ visibleColumns,
67
68
  renderedColumns,
68
69
  containerWidth,
69
70
  firstColumnToRender,
70
71
  isLastVisible = false,
72
+ focusedCellColumnIndexNotInRange,
73
+ isNotVisible,
74
+ focusedCell,
71
75
  onClick,
72
76
  onDoubleClick,
73
77
  onMouseEnter,
@@ -173,7 +177,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
173
177
 
174
178
  // User clicked a button from the "actions" column type
175
179
  const column = apiRef.current.getColumn(field);
176
- if (column.type === GRID_ACTIONS_COLUMN_TYPE) {
180
+ if ((column == null ? void 0 : column.type) === GRID_ACTIONS_COLUMN_TYPE) {
177
181
  return;
178
182
  }
179
183
  }
@@ -190,6 +194,10 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
190
194
  var _editRowsState$rowId$, _editRowsState$rowId;
191
195
  const disableDragEvents = disableColumnReorder && column.disableReorder || !rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
192
196
  const editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
197
+ let cellIsNotVisible = false;
198
+ if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
199
+ cellIsNotVisible = true;
200
+ }
193
201
  return /*#__PURE__*/_jsx(CellComponent, _extends({
194
202
  column: column,
195
203
  width: cellProps.width,
@@ -200,7 +208,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
200
208
  colIndex: cellProps.indexRelativeToAllColumns,
201
209
  colSpan: cellProps.colSpan,
202
210
  disableDragEvents: disableDragEvents,
203
- editCellState: editCellState
211
+ editCellState: editCellState,
212
+ isNotVisible: cellIsNotVisible
204
213
  }, slotProps == null ? void 0 : slotProps.cell), column.field);
205
214
  };
206
215
  const sizes = useGridSelector(apiRef, () => _extends({}, apiRef.current.unstable_getRowInternalSizes(rowId)), objectShallowCompare);
@@ -222,25 +231,35 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
222
231
  minHeight = maximumSize;
223
232
  }
224
233
  }
225
- const style = _extends({}, styleProp, {
226
- maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
227
- // max-height doesn't support "auto"
228
- minHeight
229
- });
230
- if (sizes != null && sizes.spacingTop) {
231
- const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
232
- style[property] = sizes.spacingTop;
233
- }
234
- if (sizes != null && sizes.spacingBottom) {
235
- const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
236
- let propertyValue = style[property];
237
- // avoid overriding existing value
238
- if (typeof propertyValue !== 'number') {
239
- propertyValue = parseInt(propertyValue || '0', 10);
234
+ const style = React.useMemo(() => {
235
+ if (isNotVisible) {
236
+ return {
237
+ opacity: 0,
238
+ width: 0,
239
+ height: 0
240
+ };
240
241
  }
241
- propertyValue += sizes.spacingBottom;
242
- style[property] = propertyValue;
243
- }
242
+ const rowStyle = _extends({}, styleProp, {
243
+ maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
244
+ // max-height doesn't support "auto"
245
+ minHeight
246
+ });
247
+ if (sizes != null && sizes.spacingTop) {
248
+ const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
249
+ rowStyle[property] = sizes.spacingTop;
250
+ }
251
+ if (sizes != null && sizes.spacingBottom) {
252
+ const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
253
+ let propertyValue = rowStyle[property];
254
+ // avoid overriding existing value
255
+ if (typeof propertyValue !== 'number') {
256
+ propertyValue = parseInt(propertyValue || '0', 10);
257
+ }
258
+ propertyValue += sizes.spacingBottom;
259
+ rowStyle[property] = propertyValue;
260
+ }
261
+ return rowStyle;
262
+ }, [isNotVisible, rowHeight, styleProp, minHeight, sizes, rootProps.rowSpacingType]);
244
263
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
245
264
  if (typeof rootProps.getRowClassName === 'function') {
246
265
  var _currentPage$range;
@@ -261,7 +280,14 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
261
280
  const cells = [];
262
281
  for (let i = 0; i < renderedColumns.length; i += 1) {
263
282
  const column = renderedColumns[i];
264
- const indexRelativeToAllColumns = firstColumnToRender + i;
283
+ let indexRelativeToAllColumns = firstColumnToRender + i;
284
+ if (focusedCellColumnIndexNotInRange !== undefined && focusedCell) {
285
+ if (visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
286
+ indexRelativeToAllColumns = focusedCellColumnIndexNotInRange;
287
+ } else {
288
+ indexRelativeToAllColumns -= 1;
289
+ }
290
+ }
265
291
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
266
292
  if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
267
293
  if (rowType !== 'skeletonRow') {
@@ -324,12 +350,14 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
324
350
  * If `null`, no cell in this row has focus.
325
351
  */
326
352
  focusedCell: PropTypes.string,
353
+ focusedCellColumnIndexNotInRange: PropTypes.number,
327
354
  /**
328
355
  * Index of the row in the whole sorted and filtered dataset.
329
356
  * If some rows above have expanded children, this index also take those children into account.
330
357
  */
331
358
  index: PropTypes.number.isRequired,
332
359
  isLastVisible: PropTypes.bool,
360
+ isNotVisible: PropTypes.bool,
333
361
  lastColumnToRender: PropTypes.number.isRequired,
334
362
  onClick: PropTypes.func,
335
363
  onDoubleClick: PropTypes.func,
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { GridRowId, GridCellMode } from '../../models';
2
+ import { GridRowId, GridCellMode, GridEditCellProps } from '../../models';
3
3
  import { GridColDef, GridAlignment } from '../../models/colDef/gridColDef';
4
- import { GridEditCellProps } from '../../models/gridEditRowModel';
5
4
  type GridCellV7Props = {
6
5
  align: GridAlignment;
7
6
  className?: string;
@@ -13,6 +12,7 @@ type GridCellV7Props = {
13
12
  width: number;
14
13
  colSpan?: number;
15
14
  disableDragEvents?: boolean;
15
+ isNotVisible?: boolean;
16
16
  editCellState: GridEditCellProps<any> | null;
17
17
  onClick?: React.MouseEventHandler<HTMLDivElement>;
18
18
  onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
@@ -1,10 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["changeReason", "unstable_updateValueOnRender"],
4
- _excluded2 = ["align", "children", "editCellState", "colIndex", "column", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
5
- _excluded3 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
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
+ _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,
@@ -177,6 +176,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
177
176
  showRightBorder,
178
177
  colSpan,
179
178
  disableDragEvents,
179
+ isNotVisible,
180
180
  onClick,
181
181
  onDoubleClick,
182
182
  onMouseDown,
@@ -227,13 +227,23 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
227
227
  propHandler(event);
228
228
  }
229
229
  }, [apiRef, field, rowId]);
230
- const style = {
231
- minWidth: width,
232
- maxWidth: width,
233
- minHeight: height,
234
- maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
235
- };
230
+ const style = React.useMemo(() => {
231
+ if (isNotVisible) {
232
+ return {
233
+ padding: 0,
234
+ opacity: 0,
235
+ width: 0
236
+ };
237
+ }
238
+ const cellStyle = {
239
+ minWidth: width,
240
+ maxWidth: width,
241
+ minHeight: height,
242
+ maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
243
+ };
236
244
 
245
+ return cellStyle;
246
+ }, [width, height, isNotVisible]);
237
247
  React.useEffect(() => {
238
248
  if (!hasFocus || cellMode === GridCellModes.Edit) {
239
249
  return;
@@ -276,6 +286,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
276
286
  children = /*#__PURE__*/_jsx("div", {
277
287
  className: classes.content,
278
288
  title: valueString,
289
+ role: "presentation",
279
290
  children: valueString
280
291
  });
281
292
  }
@@ -288,27 +299,32 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
288
299
  onDragEnter: publish('cellDragEnter', onDragEnter),
289
300
  onDragOver: publish('cellDragOver', onDragOver)
290
301
  };
291
- return /*#__PURE__*/_jsx("div", _extends({
292
- ref: handleRef,
293
- className: clsx(className, classes.root),
294
- role: "cell",
295
- "data-field": field,
296
- "data-colindex": colIndex,
297
- "aria-colindex": colIndex + 1,
298
- "aria-colspan": colSpan,
299
- style: style,
300
- tabIndex: tabIndex,
301
- onClick: publish('cellClick', onClick),
302
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
303
- onMouseOver: publish('cellMouseOver', onMouseOver),
304
- onMouseDown: publishMouseDown('cellMouseDown'),
305
- onMouseUp: publishMouseUp('cellMouseUp'),
306
- onKeyDown: publish('cellKeyDown', onKeyDown),
307
- onKeyUp: publish('cellKeyUp', onKeyUp)
308
- }, draggableEventHandlers, other, {
309
- onFocus: handleFocus,
310
- children: children
311
- }));
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
+ );
312
328
  });
313
329
  const MemoizedCellWrapper = fastMemo(GridCellWrapper);
314
330
  process.env.NODE_ENV !== "production" ? GridCellWrapper.propTypes = {
@@ -353,6 +369,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
353
369
  isValidating: PropTypes.bool,
354
370
  value: PropTypes.any
355
371
  }),
372
+ isNotVisible: PropTypes.bool,
356
373
  height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
357
374
  onClick: PropTypes.func,
358
375
  onDoubleClick: PropTypes.func,
@@ -367,7 +384,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
367
384
  } : void 0;
368
385
  export { MemoizedCellWrapper as GridCellWrapper, GridCell };
369
386
  const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
370
- var _rootProps$experiment2;
387
+ var _rootProps$experiment3, _rootProps$experiment4;
371
388
  const {
372
389
  column,
373
390
  rowId,
@@ -380,6 +397,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
380
397
  showRightBorder,
381
398
  colSpan,
382
399
  disableDragEvents,
400
+ isNotVisible,
383
401
  onClick,
384
402
  onDoubleClick,
385
403
  onMouseDown,
@@ -474,13 +492,23 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
474
492
  propHandler(event);
475
493
  }
476
494
  }, [apiRef, field, rowId]);
477
- const style = {
478
- minWidth: width,
479
- maxWidth: width,
480
- minHeight: height,
481
- maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
482
- };
495
+ const style = React.useMemo(() => {
496
+ if (isNotVisible) {
497
+ return {
498
+ padding: 0,
499
+ opacity: 0,
500
+ width: 0
501
+ };
502
+ }
503
+ const cellStyle = {
504
+ minWidth: width,
505
+ maxWidth: width,
506
+ minHeight: height,
507
+ maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
508
+ };
483
509
 
510
+ return cellStyle;
511
+ }, [width, height, isNotVisible]);
484
512
  React.useEffect(() => {
485
513
  if (!hasFocus || cellMode === GridCellModes.Edit) {
486
514
  return;
@@ -504,7 +532,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
504
532
  return null;
505
533
  }
506
534
  let handleFocus = other.onFocus;
507
- 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) {
508
536
  handleFocus = event => {
509
537
  const focusedCell = gridFocusCellSelector(apiRef);
510
538
  if ((focusedCell == null ? void 0 : focusedCell.id) === rowId && focusedCell.field === field) {
@@ -542,6 +570,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
542
570
  children = /*#__PURE__*/_jsx("div", {
543
571
  className: classes.content,
544
572
  title: valueString,
573
+ role: "presentation",
545
574
  children: valueString
546
575
  });
547
576
  }
@@ -554,27 +583,32 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
554
583
  onDragEnter: publish('cellDragEnter', onDragEnter),
555
584
  onDragOver: publish('cellDragOver', onDragOver)
556
585
  };
557
- return /*#__PURE__*/_jsx("div", _extends({
558
- ref: handleRef,
559
- className: clsx(className, classNames, classes.root),
560
- role: "cell",
561
- "data-field": field,
562
- "data-colindex": colIndex,
563
- "aria-colindex": colIndex + 1,
564
- "aria-colspan": colSpan,
565
- style: style,
566
- tabIndex: tabIndex,
567
- onClick: publish('cellClick', onClick),
568
- onDoubleClick: publish('cellDoubleClick', onDoubleClick),
569
- onMouseOver: publish('cellMouseOver', onMouseOver),
570
- onMouseDown: publishMouseDown('cellMouseDown'),
571
- onMouseUp: publishMouseUp('cellMouseUp'),
572
- onKeyDown: publish('cellKeyDown', onKeyDown),
573
- onKeyUp: publish('cellKeyUp', onKeyUp)
574
- }, draggableEventHandlers, other, {
575
- onFocus: handleFocus,
576
- children: children
577
- }));
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
+ );
578
612
  });
579
613
  process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
580
614
  // ----------------------------- Warning --------------------------------
@@ -594,6 +628,7 @@ process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
594
628
  value: PropTypes.any
595
629
  }),
596
630
  height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
631
+ isNotVisible: PropTypes.bool,
597
632
  onClick: PropTypes.func,
598
633
  onDoubleClick: PropTypes.func,
599
634
  onDragEnter: PropTypes.func,
@@ -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, {