@mui/x-data-grid 8.0.0-beta.1 → 8.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/DataGrid/DataGrid.js +2 -0
  3. package/components/GridRow.js +3 -8
  4. package/components/GridShadowScrollArea.js +43 -35
  5. package/components/cell/GridBooleanCell.d.ts +1 -2
  6. package/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  7. package/components/cell/GridEditSingleSelectCell.js +1 -1
  8. package/components/containers/GridToolbarContainer.js +5 -3
  9. package/components/quickFilter/QuickFilter.d.ts +26 -3
  10. package/components/quickFilter/QuickFilter.js +103 -19
  11. package/components/quickFilter/QuickFilterClear.js +10 -4
  12. package/components/quickFilter/QuickFilterContext.d.ts +4 -1
  13. package/components/quickFilter/QuickFilterControl.js +36 -10
  14. package/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  15. package/components/quickFilter/QuickFilterTrigger.js +211 -0
  16. package/components/quickFilter/index.d.ts +2 -1
  17. package/components/quickFilter/index.js +11 -0
  18. package/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  19. package/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  20. package/components/toolbar/GridToolbarExport.d.ts +3 -4
  21. package/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  22. package/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  23. package/components/toolbar/GridToolbarFilterButton.js +1 -4
  24. package/components/toolbar/GridToolbarQuickFilter.js +101 -41
  25. package/components/toolbarV8/GridToolbar.js +22 -19
  26. package/components/toolbarV8/Toolbar.d.ts +1 -1
  27. package/components/toolbarV8/Toolbar.js +76 -23
  28. package/components/toolbarV8/ToolbarButton.js +34 -14
  29. package/components/toolbarV8/ToolbarContext.d.ts +4 -2
  30. package/constants/gridClasses.d.ts +12 -0
  31. package/constants/gridClasses.js +1 -1
  32. package/esm/DataGrid/DataGrid.js +2 -0
  33. package/esm/components/GridRow.js +4 -9
  34. package/esm/components/GridShadowScrollArea.js +43 -35
  35. package/esm/components/cell/GridBooleanCell.d.ts +1 -2
  36. package/esm/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  37. package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
  38. package/esm/components/containers/GridToolbarContainer.js +5 -3
  39. package/esm/components/quickFilter/QuickFilter.d.ts +26 -3
  40. package/esm/components/quickFilter/QuickFilter.js +101 -17
  41. package/esm/components/quickFilter/QuickFilterClear.js +10 -4
  42. package/esm/components/quickFilter/QuickFilterContext.d.ts +4 -1
  43. package/esm/components/quickFilter/QuickFilterControl.js +36 -10
  44. package/esm/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  45. package/esm/components/quickFilter/QuickFilterTrigger.js +204 -0
  46. package/esm/components/quickFilter/index.d.ts +2 -1
  47. package/esm/components/quickFilter/index.js +2 -1
  48. package/esm/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  49. package/esm/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  50. package/esm/components/toolbar/GridToolbarExport.d.ts +3 -4
  51. package/esm/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  52. package/esm/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  53. package/esm/components/toolbar/GridToolbarFilterButton.js +1 -4
  54. package/esm/components/toolbar/GridToolbarQuickFilter.js +102 -44
  55. package/esm/components/toolbarV8/GridToolbar.js +22 -19
  56. package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
  57. package/esm/components/toolbarV8/Toolbar.js +75 -22
  58. package/esm/components/toolbarV8/ToolbarButton.js +34 -14
  59. package/esm/components/toolbarV8/ToolbarContext.d.ts +4 -2
  60. package/esm/constants/gridClasses.d.ts +12 -0
  61. package/esm/constants/gridClasses.js +1 -1
  62. package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  63. package/esm/hooks/features/columns/useGridColumns.js +0 -1
  64. package/esm/hooks/features/dimensions/useGridDimensions.js +1 -1
  65. package/esm/hooks/features/filter/useGridFilter.js +1 -1
  66. package/esm/hooks/features/pagination/useGridPaginationModel.js +1 -1
  67. package/esm/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
  68. package/esm/index.js +1 -1
  69. package/esm/locales/deDE.js +13 -13
  70. package/esm/models/props/DataGridProps.d.ts +6 -2
  71. package/esm/utils/utils.d.ts +0 -27
  72. package/esm/utils/utils.js +0 -122
  73. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +2 -2
  74. package/hooks/features/columns/useGridColumns.js +0 -1
  75. package/hooks/features/dimensions/useGridDimensions.js +2 -2
  76. package/hooks/features/filter/useGridFilter.js +3 -3
  77. package/hooks/features/pagination/useGridPaginationModel.js +2 -2
  78. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -0
  79. package/index.js +1 -1
  80. package/locales/deDE.js +13 -13
  81. package/models/props/DataGridProps.d.ts +6 -2
  82. package/modern/DataGrid/DataGrid.js +2 -0
  83. package/modern/components/GridRow.js +4 -9
  84. package/modern/components/GridShadowScrollArea.js +43 -35
  85. package/modern/components/cell/GridBooleanCell.d.ts +1 -2
  86. package/modern/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  87. package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
  88. package/modern/components/containers/GridToolbarContainer.js +5 -3
  89. package/modern/components/quickFilter/QuickFilter.d.ts +26 -3
  90. package/modern/components/quickFilter/QuickFilter.js +101 -17
  91. package/modern/components/quickFilter/QuickFilterClear.js +10 -4
  92. package/modern/components/quickFilter/QuickFilterContext.d.ts +4 -1
  93. package/modern/components/quickFilter/QuickFilterControl.js +36 -10
  94. package/modern/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  95. package/modern/components/quickFilter/QuickFilterTrigger.js +204 -0
  96. package/modern/components/quickFilter/index.d.ts +2 -1
  97. package/modern/components/quickFilter/index.js +2 -1
  98. package/modern/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  99. package/modern/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  100. package/modern/components/toolbar/GridToolbarExport.d.ts +3 -4
  101. package/modern/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  102. package/modern/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  103. package/modern/components/toolbar/GridToolbarFilterButton.js +1 -4
  104. package/modern/components/toolbar/GridToolbarQuickFilter.js +102 -44
  105. package/modern/components/toolbarV8/GridToolbar.js +22 -19
  106. package/modern/components/toolbarV8/Toolbar.d.ts +1 -1
  107. package/modern/components/toolbarV8/Toolbar.js +75 -22
  108. package/modern/components/toolbarV8/ToolbarButton.js +34 -14
  109. package/modern/components/toolbarV8/ToolbarContext.d.ts +4 -2
  110. package/modern/constants/gridClasses.d.ts +12 -0
  111. package/modern/constants/gridClasses.js +1 -1
  112. package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  113. package/modern/hooks/features/columns/useGridColumns.js +0 -1
  114. package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
  115. package/modern/hooks/features/filter/useGridFilter.js +1 -1
  116. package/modern/hooks/features/pagination/useGridPaginationModel.js +1 -1
  117. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
  118. package/modern/index.js +1 -1
  119. package/modern/locales/deDE.js +13 -13
  120. package/modern/models/props/DataGridProps.d.ts +6 -2
  121. package/modern/utils/utils.d.ts +0 -27
  122. package/modern/utils/utils.js +0 -122
  123. package/package.json +2 -2
  124. package/tsconfig.build.tsbuildinfo +1 -1
  125. package/utils/utils.d.ts +0 -27
  126. package/utils/utils.js +0 -123
@@ -13,7 +13,7 @@ import { useGridRootProps } from "../../utils/useGridRootProps.js";
13
13
  import { useGridSelector } from "../../utils/useGridSelector.js";
14
14
  import { useRunOnce } from "../../utils/useRunOnce.js";
15
15
  import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from "../columns/gridColumnsSelector.js";
16
- import { gridPinnedRowsSelector } from "../rows/gridRowsSelector.js";
16
+ import { gridPinnedRowsSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.js";
17
17
  import { useGridVisibleRows, getVisibleRows } from "../../utils/useGridVisibleRows.js";
18
18
  import { useGridApiOptionHandler } from "../../utils/index.js";
19
19
  import * as platform from "../../../utils/platform.js";
@@ -259,6 +259,7 @@ export const useGridVirtualScroller = () => {
259
259
  if (!params.rows && !currentPage.range) {
260
260
  return [];
261
261
  }
262
+ const rowTree = gridRowTreeSelector(apiRef);
262
263
  let baseRenderContext = renderContext;
263
264
  if (params.renderContext) {
264
265
  baseRenderContext = params.renderContext;
@@ -304,6 +305,16 @@ export const useGridVirtualScroller = () => {
304
305
  id,
305
306
  model
306
307
  } = rowModels[rowIndexInPage];
308
+
309
+ // In certain cases, the state might already be updated and `currentPage.rows` (which sets `rowModels`)
310
+ // contains stale data.
311
+ // In that case, skip any further row processing.
312
+ // See:
313
+ // - https://github.com/mui/mui-x/issues/16638
314
+ // - https://github.com/mui/mui-x/issues/17022
315
+ if (!rowTree[id]) {
316
+ return;
317
+ }
307
318
  const rowIndex = (currentPage?.range?.firstRowIndex || 0) + rowIndexOffset + rowIndexInPage;
308
319
 
309
320
  // NOTE: This is an expensive feature, the colSpan code could be optimized.
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.0.0-beta.1
2
+ * @mui/x-data-grid v8.0.0-beta.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -108,7 +108,7 @@ const deDEGrid = {
108
108
  filterValueFalse: 'Nein',
109
109
  // Column menu text
110
110
  columnMenuLabel: 'Menü',
111
- // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
111
+ columnMenuAriaLabel: columnName => `${columnName} Spaltenmenü`,
112
112
  columnMenuShowColumns: 'Zeige alle Spalten',
113
113
  columnMenuManageColumns: 'Spalten verwalten',
114
114
  columnMenuFilter: 'Filter',
@@ -155,18 +155,18 @@ const deDEGrid = {
155
155
  collapseDetailPanel: 'Zuklappen',
156
156
  // Pagination
157
157
  paginationRowsPerPage: 'Zeilen pro Seite:',
158
- // paginationDisplayedRows: ({
159
- // from,
160
- // to,
161
- // count,
162
- // estimated
163
- // }) => {
164
- // if (!estimated) {
165
- // return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
166
- // }
167
- // const estimatedLabel = estimated && estimated > to ? `around ${estimated}` : `more than ${to}`;
168
- // return `${from}–${to} of ${count !== -1 ? count : estimatedLabel}`;
169
- // },
158
+ paginationDisplayedRows: ({
159
+ from,
160
+ to,
161
+ count,
162
+ estimated
163
+ }) => {
164
+ if (!estimated) {
165
+ return `${from}–${to} von ${count !== -1 ? count : `mehr als ${to}`}`;
166
+ }
167
+ const estimatedLabel = estimated && estimated > to ? `ungefähr ${estimated}` : `mehr als ${to}`;
168
+ return `${from}–${to} von ${count !== -1 ? count : estimatedLabel}`;
169
+ },
170
170
  paginationItemAriaLabel: type => {
171
171
  if (type === 'first') {
172
172
  return 'Zur ersten Seite';
@@ -2,7 +2,6 @@ import * as React from 'react';
2
2
  import { RefObject } from '@mui/x-internals/types';
3
3
  import { SxProps } from '@mui/system';
4
4
  import { Theme } from '@mui/material/styles';
5
- import { CommonProps } from '@mui/material/OverridableComponent';
6
5
  import { GridDensity } from "../gridDensity.js";
7
6
  import { GridEditMode } from "../gridEditRowModel.js";
8
7
  import { GridFeatureMode } from "../gridFeatureMode.js";
@@ -29,6 +28,10 @@ import type { GridAutosizeOptions } from '../../hooks/features/columnResize';
29
28
  import type { GridDataSource, GridDataSourceCache } from '../gridDataSource';
30
29
  import type { GridRowSelectionPropagation } from '../gridRowSelectionModel';
31
30
  import type { GridGetRowsError, GridUpdateRowError } from '../../hooks/features/dataSource/gridDataSourceError';
31
+ type CommonProps = {
32
+ className?: string;
33
+ style?: React.CSSProperties;
34
+ };
32
35
  export interface GridExperimentalFeatures {
33
36
  /**
34
37
  * Emits a warning if the cell receives focus without also syncing the focus state.
@@ -853,4 +856,5 @@ export interface DataGridPremiumSharedPropsWithDefaultValue {
853
856
  /**
854
857
  * The props of the Data Grid component after the pre-processing phase.
855
858
  */
856
- export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {}
859
+ export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {}
860
+ export {};
@@ -12,33 +12,6 @@ export declare const clamp: (value: number, min: number, max: number) => number;
12
12
  * Create an array containing the range [from, to[
13
13
  */
14
14
  export declare function range(from: number, to: number): number[];
15
- /**
16
- * Based on `fast-deep-equal`
17
- *
18
- * MIT License
19
- *
20
- * Copyright (c) 2017 Evgeny Poberezkin
21
- *
22
- * Permission is hereby granted, free of charge, to any person obtaining a copy
23
- * of this software and associated documentation files (the "Software"), to deal
24
- * in the Software without restriction, including without limitation the rights
25
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
- * copies of the Software, and to permit persons to whom the Software is
27
- * furnished to do so, subject to the following conditions:
28
- *
29
- * The above copyright notice and this permission notice shall be included in all
30
- * copies or substantial portions of the Software.
31
- *
32
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
- * SOFTWARE.
39
- * We only type the public interface to avoid dozens of `as` in the function.
40
- */
41
- export declare function isDeepEqual<T>(actual: any, expected: T): actual is T;
42
15
  /**
43
16
  * Create a random number generator from a seed. The seed
44
17
  * ensures that the random number generator produces the
@@ -39,128 +39,6 @@ export function range(from, to) {
39
39
  }).map((_, i) => from + i);
40
40
  }
41
41
 
42
- /**
43
- * Based on `fast-deep-equal`
44
- *
45
- * MIT License
46
- *
47
- * Copyright (c) 2017 Evgeny Poberezkin
48
- *
49
- * Permission is hereby granted, free of charge, to any person obtaining a copy
50
- * of this software and associated documentation files (the "Software"), to deal
51
- * in the Software without restriction, including without limitation the rights
52
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
- * copies of the Software, and to permit persons to whom the Software is
54
- * furnished to do so, subject to the following conditions:
55
- *
56
- * The above copyright notice and this permission notice shall be included in all
57
- * copies or substantial portions of the Software.
58
- *
59
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
- * SOFTWARE.
66
- * We only type the public interface to avoid dozens of `as` in the function.
67
- */
68
-
69
- export function isDeepEqual(a, b) {
70
- if (a === b) {
71
- return true;
72
- }
73
- if (a && b && typeof a === 'object' && typeof b === 'object') {
74
- if (a.constructor !== b.constructor) {
75
- return false;
76
- }
77
- if (Array.isArray(a)) {
78
- const length = a.length;
79
- if (length !== b.length) {
80
- return false;
81
- }
82
- for (let i = 0; i < length; i += 1) {
83
- if (!isDeepEqual(a[i], b[i])) {
84
- return false;
85
- }
86
- }
87
- return true;
88
- }
89
- if (a instanceof Map && b instanceof Map) {
90
- if (a.size !== b.size) {
91
- return false;
92
- }
93
- const entriesA = Array.from(a.entries());
94
- for (let i = 0; i < entriesA.length; i += 1) {
95
- if (!b.has(entriesA[i][0])) {
96
- return false;
97
- }
98
- }
99
- for (let i = 0; i < entriesA.length; i += 1) {
100
- const entryA = entriesA[i];
101
- if (!isDeepEqual(entryA[1], b.get(entryA[0]))) {
102
- return false;
103
- }
104
- }
105
- return true;
106
- }
107
- if (a instanceof Set && b instanceof Set) {
108
- if (a.size !== b.size) {
109
- return false;
110
- }
111
- const entries = Array.from(a.entries());
112
- for (let i = 0; i < entries.length; i += 1) {
113
- if (!b.has(entries[i][0])) {
114
- return false;
115
- }
116
- }
117
- return true;
118
- }
119
- if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
120
- const length = a.length;
121
- if (length !== b.length) {
122
- return false;
123
- }
124
- for (let i = 0; i < length; i += 1) {
125
- if (a[i] !== b[i]) {
126
- return false;
127
- }
128
- }
129
- return true;
130
- }
131
- if (a.constructor === RegExp) {
132
- return a.source === b.source && a.flags === b.flags;
133
- }
134
- if (a.valueOf !== Object.prototype.valueOf) {
135
- return a.valueOf() === b.valueOf();
136
- }
137
- if (a.toString !== Object.prototype.toString) {
138
- return a.toString() === b.toString();
139
- }
140
- const keys = Object.keys(a);
141
- const length = keys.length;
142
- if (length !== Object.keys(b).length) {
143
- return false;
144
- }
145
- for (let i = 0; i < length; i += 1) {
146
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
147
- return false;
148
- }
149
- }
150
- for (let i = 0; i < length; i += 1) {
151
- const key = keys[i];
152
- if (!isDeepEqual(a[key], b[key])) {
153
- return false;
154
- }
155
- }
156
- return true;
157
- }
158
-
159
- // true if both NaN, false otherwise
160
- // eslint-disable-next-line no-self-compare
161
- return a !== a && b !== b;
162
- }
163
-
164
42
  // Pseudo random number. See https://stackoverflow.com/a/47593316
165
43
  function mulberry32(a) {
166
44
  return () => {
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.unwrapGroupingColumnModel = exports.getColumnGroupsHeaderStructure = void 0;
7
+ var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
7
8
  var _gridColumnGrouping = require("../../../models/gridColumnGrouping");
8
- var _utils = require("../../../utils/utils");
9
9
  // This is the recurrence function that help writing `unwrapGroupingColumnModel()`
10
10
  const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
11
11
  if ((0, _gridColumnGrouping.isLeaf)(columnGroupNode)) {
@@ -45,7 +45,7 @@ const getColumnGroupsHeaderStructure = (orderedColumns, unwrappedGroupingModel,
45
45
  const getParents = field => unwrappedGroupingModel[field] ?? [];
46
46
  const groupingHeaderStructure = [];
47
47
  const maxDepth = Math.max(...orderedColumns.map(field => getParents(field).length));
48
- const haveSameParents = (field1, field2, depth) => (0, _utils.isDeepEqual)(getParents(field1).slice(0, depth + 1), getParents(field2).slice(0, depth + 1));
48
+ const haveSameParents = (field1, field2, depth) => (0, _isDeepEqual.isDeepEqual)(getParents(field1).slice(0, depth + 1), getParents(field2).slice(0, depth + 1));
49
49
  const haveDifferentContainers = (field1, field2) => {
50
50
  if (pinnedFields?.left && pinnedFields.left.includes(field1) && !pinnedFields.left.includes(field2)) {
51
51
  return true;
@@ -55,7 +55,6 @@ function useGridColumns(apiRef, props) {
55
55
  logger.debug('Updating columns state.');
56
56
  apiRef.current.setState(mergeColumnsState(columnsState));
57
57
  apiRef.current.publishEvent('columnsChange', columnsState.orderedFields);
58
- apiRef.current.updateRenderContext?.();
59
58
  }, [logger, apiRef]);
60
59
 
61
60
  /**
@@ -13,6 +13,7 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
13
13
  var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
14
14
  var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
15
15
  var _throttle = require("@mui/x-internals/throttle");
16
+ var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
16
17
  var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
17
18
  var _useGridApiMethod = require("../../utils/useGridApiMethod");
18
19
  var _createSelector = require("../../../utils/createSelector");
@@ -29,7 +30,6 @@ var _gridColumnsUtils = require("../columns/gridColumnsUtils");
29
30
  var _dataGridPropsDefaultValues = require("../../../constants/dataGridPropsDefaultValues");
30
31
  var _roundToDecimalPlaces = require("../../../utils/roundToDecimalPlaces");
31
32
  var _isJSDOM = require("../../../utils/isJSDOM");
32
- var _utils2 = require("../../../utils/utils");
33
33
  const EMPTY_SIZE = {
34
34
  width: 0,
35
35
  height: 0
@@ -201,7 +201,7 @@ function useGridDimensions(apiRef, props) {
201
201
  bottomContainerHeight
202
202
  };
203
203
  const prevDimensions = apiRef.current.state.dimensions;
204
- if ((0, _utils2.isDeepEqual)(prevDimensions, newDimensions)) {
204
+ if ((0, _isDeepEqual.isDeepEqual)(prevDimensions, newDimensions)) {
205
205
  return;
206
206
  }
207
207
  setDimensions(newDimensions);
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _reselect = require("reselect");
12
12
  var _utils = require("@mui/utils");
13
+ var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
13
14
  var _useLazyRef = require("../../utils/useLazyRef");
14
15
  var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
15
16
  var _useGridApiMethod = require("../../utils/useGridApiMethod");
@@ -23,7 +24,6 @@ var _rows = require("../rows");
23
24
  var _pipeProcessing = require("../../core/pipeProcessing");
24
25
  var _strategyProcessing = require("../../core/strategyProcessing");
25
26
  var _gridFilterUtils = require("./gridFilterUtils");
26
- var _utils2 = require("../../../utils/utils");
27
27
  var _jsxRuntime = require("react/jsx-runtime");
28
28
  const filterStateInitializer = (state, props, apiRef) => {
29
29
  const filterModel = props.filterModel ?? props.initialState?.filter?.filterModel ?? (0, _gridFilterState.getDefaultGridFilterModel)();
@@ -187,7 +187,7 @@ const useGridFilter = (apiRef, props) => {
187
187
  }, [apiRef]);
188
188
  const setQuickFilterValues = React.useCallback(values => {
189
189
  const filterModel = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
190
- if ((0, _utils2.isDeepEqual)(filterModel.quickFilterValues, values)) {
190
+ if ((0, _isDeepEqual.isDeepEqual)(filterModel.quickFilterValues, values)) {
191
191
  return;
192
192
  }
193
193
  apiRef.current.setFilterModel((0, _extends2.default)({}, filterModel, {
@@ -246,7 +246,7 @@ const useGridFilter = (apiRef, props) => {
246
246
  // Always export if the model has been initialized
247
247
  props.initialState?.filter?.filterModel != null ||
248
248
  // Export if the model is not equal to the default value
249
- !(0, _utils2.isDeepEqual)(filterModelToExport, (0, _gridFilterState.getDefaultGridFilterModel)());
249
+ !(0, _isDeepEqual.isDeepEqual)(filterModelToExport, (0, _gridFilterState.getDefaultGridFilterModel)());
250
250
  if (!shouldExportFilterModel) {
251
251
  return prevState;
252
252
  }
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.useGridPaginationModel = exports.getDerivedPaginationModel = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
+ var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
11
12
  var _gridFilterSelector = require("../filter/gridFilterSelector");
12
13
  var _density = require("../density");
13
14
  var _utils = require("../../utils");
14
- var _utils2 = require("../../../utils/utils");
15
15
  var _pipeProcessing = require("../../core/pipeProcessing");
16
16
  var _gridPaginationSelector = require("./gridPaginationSelector");
17
17
  var _gridPaginationUtils = require("./gridPaginationUtils");
@@ -193,7 +193,7 @@ const useGridPaginationModel = (apiRef, props) => {
193
193
  // replace items with the active items
194
194
  items: (0, _gridFilterSelector.gridFilterActiveItemsSelector)(apiRef)
195
195
  });
196
- if ((0, _utils2.isDeepEqual)(currentActiveFilters, previousFilterModel.current)) {
196
+ if ((0, _isDeepEqual.isDeepEqual)(currentActiveFilters, previousFilterModel.current)) {
197
197
  return;
198
198
  }
199
199
  previousFilterModel.current = currentActiveFilters;
@@ -270,6 +270,7 @@ const useGridVirtualScroller = () => {
270
270
  if (!params.rows && !currentPage.range) {
271
271
  return [];
272
272
  }
273
+ const rowTree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
273
274
  let baseRenderContext = renderContext;
274
275
  if (params.renderContext) {
275
276
  baseRenderContext = params.renderContext;
@@ -315,6 +316,16 @@ const useGridVirtualScroller = () => {
315
316
  id,
316
317
  model
317
318
  } = rowModels[rowIndexInPage];
319
+
320
+ // In certain cases, the state might already be updated and `currentPage.rows` (which sets `rowModels`)
321
+ // contains stale data.
322
+ // In that case, skip any further row processing.
323
+ // See:
324
+ // - https://github.com/mui/mui-x/issues/16638
325
+ // - https://github.com/mui/mui-x/issues/17022
326
+ if (!rowTree[id]) {
327
+ return;
328
+ }
318
329
  const rowIndex = (currentPage?.range?.firstRowIndex || 0) + rowIndexOffset + rowIndexInPage;
319
330
 
320
331
  // NOTE: This is an expensive feature, the colSpan code could be optimized.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.0.0-beta.1
2
+ * @mui/x-data-grid v8.0.0-beta.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/locales/deDE.js CHANGED
@@ -114,7 +114,7 @@ const deDEGrid = {
114
114
  filterValueFalse: 'Nein',
115
115
  // Column menu text
116
116
  columnMenuLabel: 'Menü',
117
- // columnMenuAriaLabel: (columnName: string) => `${columnName} column menu`,
117
+ columnMenuAriaLabel: columnName => `${columnName} Spaltenmenü`,
118
118
  columnMenuShowColumns: 'Zeige alle Spalten',
119
119
  columnMenuManageColumns: 'Spalten verwalten',
120
120
  columnMenuFilter: 'Filter',
@@ -161,18 +161,18 @@ const deDEGrid = {
161
161
  collapseDetailPanel: 'Zuklappen',
162
162
  // Pagination
163
163
  paginationRowsPerPage: 'Zeilen pro Seite:',
164
- // paginationDisplayedRows: ({
165
- // from,
166
- // to,
167
- // count,
168
- // estimated
169
- // }) => {
170
- // if (!estimated) {
171
- // return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
172
- // }
173
- // const estimatedLabel = estimated && estimated > to ? `around ${estimated}` : `more than ${to}`;
174
- // return `${from}–${to} of ${count !== -1 ? count : estimatedLabel}`;
175
- // },
164
+ paginationDisplayedRows: ({
165
+ from,
166
+ to,
167
+ count,
168
+ estimated
169
+ }) => {
170
+ if (!estimated) {
171
+ return `${from}–${to} von ${count !== -1 ? count : `mehr als ${to}`}`;
172
+ }
173
+ const estimatedLabel = estimated && estimated > to ? `ungefähr ${estimated}` : `mehr als ${to}`;
174
+ return `${from}–${to} von ${count !== -1 ? count : estimatedLabel}`;
175
+ },
176
176
  paginationItemAriaLabel: type => {
177
177
  if (type === 'first') {
178
178
  return 'Zur ersten Seite';
@@ -2,7 +2,6 @@ import * as React from 'react';
2
2
  import { RefObject } from '@mui/x-internals/types';
3
3
  import { SxProps } from '@mui/system';
4
4
  import { Theme } from '@mui/material/styles';
5
- import { CommonProps } from '@mui/material/OverridableComponent';
6
5
  import { GridDensity } from "../gridDensity.js";
7
6
  import { GridEditMode } from "../gridEditRowModel.js";
8
7
  import { GridFeatureMode } from "../gridFeatureMode.js";
@@ -29,6 +28,10 @@ import type { GridAutosizeOptions } from '../../hooks/features/columnResize';
29
28
  import type { GridDataSource, GridDataSourceCache } from '../gridDataSource';
30
29
  import type { GridRowSelectionPropagation } from '../gridRowSelectionModel';
31
30
  import type { GridGetRowsError, GridUpdateRowError } from '../../hooks/features/dataSource/gridDataSourceError';
31
+ type CommonProps = {
32
+ className?: string;
33
+ style?: React.CSSProperties;
34
+ };
32
35
  export interface GridExperimentalFeatures {
33
36
  /**
34
37
  * Emits a warning if the cell receives focus without also syncing the focus state.
@@ -853,4 +856,5 @@ export interface DataGridPremiumSharedPropsWithDefaultValue {
853
856
  /**
854
857
  * The props of the Data Grid component after the pre-processing phase.
855
858
  */
856
- export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {}
859
+ export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {}
860
+ export {};
@@ -110,6 +110,7 @@ DataGridRaw.propTypes = {
110
110
  * Override or extend the styles applied to the component.
111
111
  */
112
112
  classes: PropTypes.object,
113
+ className: PropTypes.string,
113
114
  /**
114
115
  * The character used to separate cell values when copying to the clipboard.
115
116
  * @default '\t'
@@ -769,6 +770,7 @@ DataGridRaw.propTypes = {
769
770
  field: PropTypes.string.isRequired,
770
771
  sort: PropTypes.oneOf(['asc', 'desc'])
771
772
  })),
773
+ style: PropTypes.object,
772
774
  /**
773
775
  * The system prop that allows defining system overrides as well as additional CSS styles.
774
776
  */
@@ -23,7 +23,7 @@ import { GRID_CHECKBOX_SELECTION_COL_DEF } from "../colDef/gridCheckboxSelection
23
23
  import { GRID_ACTIONS_COLUMN_TYPE } from "../colDef/gridActionsColDef.js";
24
24
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD, PinnedColumnPosition } from "../internals/constants.js";
25
25
  import { gridSortModelSelector } from "../hooks/features/sorting/gridSortingSelector.js";
26
- import { gridRowMaximumTreeDepthSelector } from "../hooks/features/rows/gridRowsSelector.js";
26
+ import { gridRowMaximumTreeDepthSelector, gridRowNodeSelector } from "../hooks/features/rows/gridRowsSelector.js";
27
27
  import { gridEditRowsStateSelector, gridRowIsEditingSelector } from "../hooks/features/editing/gridEditingSelectors.js";
28
28
  import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFillerCell.js";
29
29
  import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
@@ -79,7 +79,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
79
79
  const rowReordering = rootProps.rowReordering;
80
80
  const isRowReorderingEnabled = useGridSelector(apiRef, isRowReorderingEnabledSelector, rowReordering);
81
81
  const handleRef = useForkRef(ref, refProp);
82
- const rowNode = apiRef.current.getRowNode(rowId);
82
+ const rowNode = gridRowNodeSelector(apiRef, rowId);
83
83
  const editing = useGridSelector(apiRef, gridRowIsEditingSelector, {
84
84
  rowId,
85
85
  editMode: rootProps.editMode
@@ -192,7 +192,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
192
192
  return rowStyle;
193
193
  }, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
194
194
  const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
195
- const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
195
+ const ariaAttributes = getRowAriaAttributes(rowNode, index);
196
196
  if (typeof rootProps.getRowClassName === 'function') {
197
197
  const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
198
198
  const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
@@ -202,11 +202,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
202
202
  });
203
203
  rowClassNames.push(rootProps.getRowClassName(rowParams));
204
204
  }
205
-
206
- /* Start of rendering */
207
- if (!rowNode) {
208
- return null;
209
- }
210
205
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
211
206
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
212
207
  if (cellColSpanInfo?.spannedByColSpan) {
@@ -215,7 +210,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
215
210
  const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
216
211
  const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
217
212
  const pinnedOffset = getPinnedCellOffset(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
218
- if (rowNode?.type === 'skeletonRow') {
213
+ if (rowNode.type === 'skeletonRow') {
219
214
  return /*#__PURE__*/_jsx(slots.skeletonCell, {
220
215
  type: column.type,
221
216
  width: width,
@@ -17,48 +17,56 @@ const detectScroll = keyframes({
17
17
  '--scrollable': '" "'
18
18
  }
19
19
  });
20
+
21
+ // This `styled()` function invokes keyframes. `styled-components` only supports keyframes
22
+ // in string templates. Do not convert these styles in JS object as it will break.
20
23
  const ShadowScrollArea = styled('div', {
21
24
  name: 'MuiDataGrid',
22
25
  slot: 'ShadowScrollArea'
23
- })({
24
- flex: 1,
25
- display: 'flex',
26
- flexDirection: 'column',
27
- animation: detectScroll,
28
- animationTimeline: '--scroll-timeline',
29
- animationFillMode: 'none',
30
- boxSizing: 'border-box',
31
- overflow: 'auto',
32
- scrollTimeline: '--scroll-timeline block',
33
- '&::before, &::after': {
34
- content: '""',
35
- flexShrink: 0,
36
- display: 'block',
37
- position: 'sticky',
38
- left: 0,
39
- width: '100%',
40
- height: '4px',
41
- animation: `${reveal} linear both`,
42
- animationTimeline: '--scroll-timeline',
26
+ })`
27
+ flex: 1;
28
+ display: flex;
29
+ flex-direction: column;
30
+ animation: ${detectScroll};
31
+ animation-timeline: --scroll-timeline;
32
+ animation-fill-mode: none;
33
+ box-sizing: border-box;
34
+ overflow: auto;
35
+ scroll-timeline: --scroll-timeline block;
36
+
37
+ &::before,
38
+ &::after {
39
+ content: '';
40
+ flex-shrink: 0;
41
+ display: block;
42
+ position: sticky;
43
+ left: 0;
44
+ width: 100%;
45
+ height: 4px;
46
+ animation: ${reveal} linear both;
47
+ animation-timeline: --scroll-timeline;
48
+
43
49
  // Custom property toggle trick:
44
50
  // - Detects if the element is scrollable
45
51
  // - https://css-tricks.com/the-css-custom-property-toggle-trick/
46
- '--visibility-scrollable': 'var(--scrollable) visible',
47
- '--visibility-not-scrollable': 'hidden',
48
- visibility: 'var(--visibility-scrollable, var(--visibility-not-scrollable))'
49
- },
50
- '&::before': {
51
- top: 0,
52
- background: 'linear-gradient(to bottom, rgba(0,0,0,0.05) 0, transparent 100%)',
53
- animationRange: '0 4px'
54
- },
55
- '&::after': {
56
- bottom: 0,
57
- background: 'linear-gradient(to top, rgba(0,0,0,0.05) 0, transparent 100%)',
58
- animationDirection: 'reverse',
59
- animationRange: 'calc(100% - 4px) 100%'
52
+ --visibility-scrollable: var(--scrollable) visible;
53
+ --visibility-not-scrollable: hidden;
54
+ visibility: var(--visibility-scrollable, var(--visibility-not-scrollable));
60
55
  }
61
- });
56
+
57
+ &::before {
58
+ top: 0;
59
+ background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0, transparent 100%);
60
+ animation-range: 0 4px;
61
+ }
62
+
63
+ &::after {
64
+ bottom: 0;
65
+ background: linear-gradient(to top, rgba(0, 0, 0, 0.05) 0, transparent 100%);
66
+ animation-direction: reverse;
67
+ animation-range: calc(100% - 4px) 100%;
68
+ }
69
+ `;
62
70
 
63
71
  /**
64
72
  * Adds scroll shadows above and below content in a scrollable container.
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
- import { SvgIconProps } from '@mui/material/SvgIcon';
3
2
  import type { GridColDef } from '../../models/colDef/gridColDef';
4
3
  import type { GridRenderCellParams } from '../../models/params/gridCellParams';
5
- interface GridBooleanCellProps extends GridRenderCellParams, Omit<SvgIconProps, 'tabIndex' | 'id'> {
4
+ interface GridBooleanCellProps extends GridRenderCellParams {
6
5
  hideDescendantCount?: boolean;
7
6
  }
8
7
  declare function GridBooleanCellRaw(props: GridBooleanCellProps): React.JSX.Element | null;