@mui/x-data-grid 8.0.0-beta.0 → 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 (135) hide show
  1. package/CHANGELOG.md +171 -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/columnSelection/GridHeaderCheckbox.js +2 -2
  9. package/components/containers/GridToolbarContainer.js +5 -3
  10. package/components/quickFilter/QuickFilter.d.ts +26 -3
  11. package/components/quickFilter/QuickFilter.js +103 -19
  12. package/components/quickFilter/QuickFilterClear.js +10 -4
  13. package/components/quickFilter/QuickFilterContext.d.ts +4 -1
  14. package/components/quickFilter/QuickFilterControl.js +36 -10
  15. package/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  16. package/components/quickFilter/QuickFilterTrigger.js +211 -0
  17. package/components/quickFilter/index.d.ts +2 -1
  18. package/components/quickFilter/index.js +11 -0
  19. package/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  20. package/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  21. package/components/toolbar/GridToolbarExport.d.ts +3 -4
  22. package/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  23. package/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  24. package/components/toolbar/GridToolbarFilterButton.js +1 -4
  25. package/components/toolbar/GridToolbarQuickFilter.js +101 -41
  26. package/components/toolbarV8/GridToolbar.js +22 -19
  27. package/components/toolbarV8/Toolbar.d.ts +1 -1
  28. package/components/toolbarV8/Toolbar.js +76 -23
  29. package/components/toolbarV8/ToolbarButton.js +34 -14
  30. package/components/toolbarV8/ToolbarContext.d.ts +4 -2
  31. package/constants/gridClasses.d.ts +12 -0
  32. package/constants/gridClasses.js +1 -1
  33. package/esm/DataGrid/DataGrid.js +2 -0
  34. package/esm/components/GridRow.js +4 -9
  35. package/esm/components/GridShadowScrollArea.js +43 -35
  36. package/esm/components/cell/GridBooleanCell.d.ts +1 -2
  37. package/esm/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  38. package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
  39. package/esm/components/columnSelection/GridHeaderCheckbox.js +2 -2
  40. package/esm/components/containers/GridToolbarContainer.js +5 -3
  41. package/esm/components/quickFilter/QuickFilter.d.ts +26 -3
  42. package/esm/components/quickFilter/QuickFilter.js +101 -17
  43. package/esm/components/quickFilter/QuickFilterClear.js +10 -4
  44. package/esm/components/quickFilter/QuickFilterContext.d.ts +4 -1
  45. package/esm/components/quickFilter/QuickFilterControl.js +36 -10
  46. package/esm/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  47. package/esm/components/quickFilter/QuickFilterTrigger.js +204 -0
  48. package/esm/components/quickFilter/index.d.ts +2 -1
  49. package/esm/components/quickFilter/index.js +2 -1
  50. package/esm/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  51. package/esm/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  52. package/esm/components/toolbar/GridToolbarExport.d.ts +3 -4
  53. package/esm/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  54. package/esm/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  55. package/esm/components/toolbar/GridToolbarFilterButton.js +1 -4
  56. package/esm/components/toolbar/GridToolbarQuickFilter.js +102 -44
  57. package/esm/components/toolbarV8/GridToolbar.js +22 -19
  58. package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
  59. package/esm/components/toolbarV8/Toolbar.js +75 -22
  60. package/esm/components/toolbarV8/ToolbarButton.js +34 -14
  61. package/esm/components/toolbarV8/ToolbarContext.d.ts +4 -2
  62. package/esm/constants/gridClasses.d.ts +12 -0
  63. package/esm/constants/gridClasses.js +1 -1
  64. package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  65. package/esm/hooks/features/columns/useGridColumns.js +0 -1
  66. package/esm/hooks/features/dimensions/useGridDimensions.js +1 -1
  67. package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
  68. package/esm/hooks/features/filter/useGridFilter.js +1 -1
  69. package/esm/hooks/features/pagination/useGridPaginationModel.js +1 -1
  70. package/esm/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
  71. package/esm/index.js +1 -1
  72. package/esm/locales/deDE.js +13 -13
  73. package/esm/material/index.js +1 -2
  74. package/esm/models/props/DataGridProps.d.ts +6 -2
  75. package/esm/utils/utils.d.ts +0 -27
  76. package/esm/utils/utils.js +0 -122
  77. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +2 -2
  78. package/hooks/features/columns/useGridColumns.js +0 -1
  79. package/hooks/features/dimensions/useGridDimensions.js +2 -2
  80. package/hooks/features/editing/useGridRowEditing.js +1 -1
  81. package/hooks/features/filter/useGridFilter.js +3 -3
  82. package/hooks/features/pagination/useGridPaginationModel.js +2 -2
  83. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -0
  84. package/index.js +1 -1
  85. package/locales/deDE.js +13 -13
  86. package/material/index.js +1 -2
  87. package/models/props/DataGridProps.d.ts +6 -2
  88. package/modern/DataGrid/DataGrid.js +2 -0
  89. package/modern/components/GridRow.js +4 -9
  90. package/modern/components/GridShadowScrollArea.js +43 -35
  91. package/modern/components/cell/GridBooleanCell.d.ts +1 -2
  92. package/modern/components/cell/GridEditSingleSelectCell.d.ts +4 -4
  93. package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
  94. package/modern/components/columnSelection/GridHeaderCheckbox.js +2 -2
  95. package/modern/components/containers/GridToolbarContainer.js +5 -3
  96. package/modern/components/quickFilter/QuickFilter.d.ts +26 -3
  97. package/modern/components/quickFilter/QuickFilter.js +101 -17
  98. package/modern/components/quickFilter/QuickFilterClear.js +10 -4
  99. package/modern/components/quickFilter/QuickFilterContext.d.ts +4 -1
  100. package/modern/components/quickFilter/QuickFilterControl.js +36 -10
  101. package/modern/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
  102. package/modern/components/quickFilter/QuickFilterTrigger.js +204 -0
  103. package/modern/components/quickFilter/index.d.ts +2 -1
  104. package/modern/components/quickFilter/index.js +2 -1
  105. package/modern/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
  106. package/modern/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
  107. package/modern/components/toolbar/GridToolbarExport.d.ts +3 -4
  108. package/modern/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
  109. package/modern/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
  110. package/modern/components/toolbar/GridToolbarFilterButton.js +1 -4
  111. package/modern/components/toolbar/GridToolbarQuickFilter.js +102 -44
  112. package/modern/components/toolbarV8/GridToolbar.js +22 -19
  113. package/modern/components/toolbarV8/Toolbar.d.ts +1 -1
  114. package/modern/components/toolbarV8/Toolbar.js +75 -22
  115. package/modern/components/toolbarV8/ToolbarButton.js +34 -14
  116. package/modern/components/toolbarV8/ToolbarContext.d.ts +4 -2
  117. package/modern/constants/gridClasses.d.ts +12 -0
  118. package/modern/constants/gridClasses.js +1 -1
  119. package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
  120. package/modern/hooks/features/columns/useGridColumns.js +0 -1
  121. package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
  122. package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
  123. package/modern/hooks/features/filter/useGridFilter.js +1 -1
  124. package/modern/hooks/features/pagination/useGridPaginationModel.js +1 -1
  125. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
  126. package/modern/index.js +1 -1
  127. package/modern/locales/deDE.js +13 -13
  128. package/modern/material/index.js +1 -2
  129. package/modern/models/props/DataGridProps.d.ts +6 -2
  130. package/modern/utils/utils.d.ts +0 -27
  131. package/modern/utils/utils.js +0 -122
  132. package/package.json +2 -2
  133. package/tsconfig.build.tsbuildinfo +1 -1
  134. package/utils/utils.d.ts +0 -27
  135. package/utils/utils.js +0 -123
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["render", "className"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { styled } from '@mui/material/styles';
6
+ import { styled } from '@mui/system';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import clsx from 'clsx';
9
9
  import { forwardRef } from '@mui/x-internals/forwardRef';
@@ -31,6 +31,8 @@ const ToolbarRoot = styled('div', {
31
31
  alignItems: 'center',
32
32
  gap: vars.spacing(0.25),
33
33
  padding: vars.spacing(0.75),
34
+ minHeight: 52,
35
+ boxSizing: 'border-box',
34
36
  borderBottom: `1px solid ${vars.colors.border.base}`
35
37
  });
36
38
 
@@ -56,44 +58,95 @@ const Toolbar = forwardRef(function Toolbar(props, ref) {
56
58
  const classes = useUtilityClasses(rootProps);
57
59
  const [focusableItemId, setFocusableItemId] = React.useState(null);
58
60
  const [items, setItems] = React.useState([]);
59
- const registerItem = React.useCallback(item => {
60
- setItems(prevItems => [...prevItems, item]);
61
+ const registerItem = React.useCallback((id, itemRef) => {
62
+ setItems(prevItems => [...prevItems, {
63
+ id,
64
+ ref: itemRef
65
+ }]);
61
66
  }, []);
62
- const unregisterItem = React.useCallback(item => {
63
- setItems(prevItems => prevItems.filter(i => i !== item));
64
- if (focusableItemId === item) {
67
+ const unregisterItem = React.useCallback(id => {
68
+ setItems(prevItems => prevItems.filter(i => i.id !== id));
69
+ if (focusableItemId === id) {
65
70
  setFocusableItemId(null);
66
71
  }
67
72
  }, [focusableItemId]);
73
+ const findEnabledItem = React.useCallback((startIndex, step, wrap = true) => {
74
+ let index = startIndex;
75
+ const itemCount = items.length;
76
+
77
+ // Look for enabled items in the specified direction
78
+ for (let i = 0; i < itemCount; i += 1) {
79
+ index += step;
80
+
81
+ // Handle wrapping around the ends
82
+ if (index >= itemCount) {
83
+ if (!wrap) {
84
+ return -1;
85
+ }
86
+ index = 0;
87
+ } else if (index < 0) {
88
+ if (!wrap) {
89
+ return -1;
90
+ }
91
+ index = itemCount - 1;
92
+ }
93
+
94
+ // Return if we found an enabled item
95
+ if (!items[index].ref.current?.disabled && items[index].ref.current?.ariaDisabled !== 'true') {
96
+ return index;
97
+ }
98
+ }
99
+
100
+ // If we've checked all items and found none enabled
101
+ return -1;
102
+ }, [items]);
68
103
  const onItemKeyDown = React.useCallback(event => {
69
104
  if (!focusableItemId) {
70
105
  return;
71
106
  }
107
+ const currentIndex = items.findIndex(item => item.id === focusableItemId);
108
+ let newIndex = -1;
72
109
  if (event.key === 'ArrowRight') {
73
110
  event.preventDefault();
74
- const nextIndex = items.indexOf(focusableItemId) + 1;
75
- setFocusableItemId(items[nextIndex < items.length ? nextIndex : 0]);
76
- }
77
- if (event.key === 'ArrowLeft') {
111
+ newIndex = findEnabledItem(currentIndex, 1);
112
+ } else if (event.key === 'ArrowLeft') {
78
113
  event.preventDefault();
79
- const prevIndex = items.indexOf(focusableItemId) - 1;
80
- setFocusableItemId(items[prevIndex < 0 ? items.length - 1 : prevIndex]);
81
- }
82
- if (event.key === 'Home') {
114
+ newIndex = findEnabledItem(currentIndex, -1);
115
+ } else if (event.key === 'Home') {
83
116
  event.preventDefault();
84
- setFocusableItemId(items[0]);
85
- }
86
- if (event.key === 'End') {
117
+ newIndex = findEnabledItem(-1, 1, false);
118
+ } else if (event.key === 'End') {
87
119
  event.preventDefault();
88
- setFocusableItemId(items[items.length - 1]);
120
+ newIndex = findEnabledItem(items.length, -1, false);
121
+ }
122
+ if (newIndex >= 0 && newIndex < items.length) {
123
+ const item = items[newIndex];
124
+ setFocusableItemId(item.id);
125
+ item.ref.current?.focus();
126
+ }
127
+ }, [items, focusableItemId, findEnabledItem]);
128
+ const onItemFocus = React.useCallback(id => {
129
+ if (focusableItemId !== id) {
130
+ setFocusableItemId(id);
131
+ }
132
+ }, [focusableItemId]);
133
+ const onItemDisabled = React.useCallback(id => {
134
+ const currentIndex = items.findIndex(item => item.id === id);
135
+ const newIndex = findEnabledItem(currentIndex, 1);
136
+ if (newIndex >= 0 && newIndex < items.length) {
137
+ const item = items[newIndex];
138
+ setFocusableItemId(item.id);
139
+ item.ref.current?.focus();
89
140
  }
90
- }, [items, focusableItemId]);
141
+ }, [items, findEnabledItem]);
91
142
  const contextValue = React.useMemo(() => ({
92
143
  focusableItemId,
93
144
  registerItem,
94
145
  unregisterItem,
95
- onItemKeyDown
96
- }), [registerItem, unregisterItem, focusableItemId, onItemKeyDown]);
146
+ onItemKeyDown,
147
+ onItemFocus,
148
+ onItemDisabled
149
+ }), [focusableItemId, registerItem, unregisterItem, onItemKeyDown, onItemFocus, onItemDisabled]);
97
150
  const element = useGridComponentRenderer(ToolbarRoot, render, _extends({
98
151
  role: 'toolbar',
99
152
  'aria-orientation': 'horizontal',
@@ -104,7 +157,7 @@ const Toolbar = forwardRef(function Toolbar(props, ref) {
104
157
  }));
105
158
  React.useEffect(() => {
106
159
  if (items.length > 0) {
107
- setFocusableItemId(items[0]);
160
+ setFocusableItemId(items[0].id);
108
161
  }
109
162
  }, [items]);
110
163
  return /*#__PURE__*/_jsx(ToolbarContext.Provider, {
@@ -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 = ["render"];
3
+ const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_useForkRef as useForkRef } from '@mui/utils';
@@ -24,7 +24,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  */
25
25
  const ToolbarButton = forwardRef(function ToolbarButton(props, ref) {
26
26
  const {
27
- render
27
+ render,
28
+ onKeyDown,
29
+ onFocus,
30
+ disabled,
31
+ 'aria-disabled': ariaDisabled
28
32
  } = props,
29
33
  other = _objectWithoutPropertiesLoose(props, _excluded);
30
34
  const id = useId();
@@ -35,28 +39,44 @@ const ToolbarButton = forwardRef(function ToolbarButton(props, ref) {
35
39
  focusableItemId,
36
40
  registerItem,
37
41
  unregisterItem,
38
- onItemKeyDown
42
+ onItemKeyDown,
43
+ onItemFocus,
44
+ onItemDisabled
39
45
  } = useToolbarContext();
46
+ const handleKeyDown = event => {
47
+ onItemKeyDown(event);
48
+ onKeyDown?.(event);
49
+ };
50
+ const handleFocus = event => {
51
+ onItemFocus(id);
52
+ onFocus?.(event);
53
+ };
40
54
  React.useEffect(() => {
41
- registerItem(id);
55
+ registerItem(id, buttonRef);
42
56
  return () => unregisterItem(id);
43
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
44
58
  }, []);
45
- const isInitialFocus = React.useRef(true);
59
+ const previousDisabled = React.useRef(disabled);
46
60
  React.useEffect(() => {
47
- // Do not focus the item on initial render
48
- if (focusableItemId && isInitialFocus.current) {
49
- isInitialFocus.current = false;
50
- return;
61
+ if (previousDisabled.current !== disabled && disabled === true) {
62
+ onItemDisabled(id, disabled);
51
63
  }
52
- if (focusableItemId === id) {
53
- buttonRef.current?.focus();
64
+ previousDisabled.current = disabled;
65
+ }, [disabled, id, onItemDisabled]);
66
+ const previousAriaDisabled = React.useRef(ariaDisabled);
67
+ React.useEffect(() => {
68
+ if (previousAriaDisabled.current !== ariaDisabled && ariaDisabled === true) {
69
+ onItemDisabled(id, true);
54
70
  }
55
- }, [focusableItemId, id]);
71
+ previousAriaDisabled.current = ariaDisabled;
72
+ }, [ariaDisabled, id, onItemDisabled]);
56
73
  const element = useGridComponentRenderer(rootProps.slots.baseIconButton, render, _extends({}, rootProps.slotProps?.baseIconButton, {
57
- tabIndex: focusableItemId === id ? 0 : -1,
58
- onKeyDown: onItemKeyDown
74
+ tabIndex: focusableItemId === id ? 0 : -1
59
75
  }, other, {
76
+ disabled,
77
+ 'aria-disabled': ariaDisabled,
78
+ onKeyDown: handleKeyDown,
79
+ onFocus: handleFocus,
60
80
  ref: handleRef
61
81
  }));
62
82
  return /*#__PURE__*/_jsx(React.Fragment, {
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
2
  export interface ToolbarContextValue {
3
3
  focusableItemId: string | null;
4
- registerItem: (itemId: string) => void;
5
- unregisterItem: (itemId: string) => void;
4
+ registerItem: (id: string, ref: React.RefObject<HTMLButtonElement | null>) => void;
5
+ unregisterItem: (id: string) => void;
6
6
  onItemKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
7
+ onItemFocus: (id: string) => void;
8
+ onItemDisabled: (id: string, disabled: boolean) => void;
7
9
  }
8
10
  export declare const ToolbarContext: React.Context<ToolbarContextValue | undefined>;
9
11
  export declare function useToolbarContext(): ToolbarContextValue;
@@ -631,6 +631,18 @@ export interface GridClasses {
631
631
  * Styles applied to the toolbar prompt control send button element.
632
632
  */
633
633
  toolbarPromptControlSendButton: string;
634
+ /**
635
+ * Styles applied to the toolbar quick filter root element.
636
+ */
637
+ toolbarQuickFilter: string;
638
+ /**
639
+ * Styles applied to the toolbar quick filter trigger element.
640
+ */
641
+ toolbarQuickFilterTrigger: string;
642
+ /**
643
+ * Styles applied to the toolbar quick filter control element.
644
+ */
645
+ toolbarQuickFilterControl: string;
634
646
  /**
635
647
  * Styles applied the grid if `showColumnVerticalBorder={true}`.
636
648
  */
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
2
2
  export function getDataGridUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiDataGrid', slot);
4
4
  }
5
- export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'shadowScrollArea', 'toolbarContainer', 'toolbarFilterList', 'toolbarPromptControl', 'toolbarPromptControl--recording', 'toolbarPromptControlRecordingIndicator', 'toolbarPromptControlRecordButton', 'toolbarPromptControlSendButton', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom']);
5
+ export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'shadowScrollArea', 'toolbarContainer', 'toolbarFilterList', 'toolbarPromptControl', 'toolbarPromptControl--recording', 'toolbarPromptControlRecordingIndicator', 'toolbarPromptControlRecordButton', 'toolbarPromptControlSendButton', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom']);
@@ -1,5 +1,5 @@
1
+ import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
1
2
  import { isLeaf } from "../../../models/gridColumnGrouping.js";
2
- import { isDeepEqual } from "../../../utils/utils.js";
3
3
  // This is the recurrence function that help writing `unwrapGroupingColumnModel()`
4
4
  const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
5
5
  if (isLeaf(columnGroupNode)) {
@@ -45,7 +45,6 @@ export function useGridColumns(apiRef, props) {
45
45
  logger.debug('Updating columns state.');
46
46
  apiRef.current.setState(mergeColumnsState(columnsState));
47
47
  apiRef.current.publishEvent('columnsChange', columnsState.orderedFields);
48
- apiRef.current.updateRenderContext?.();
49
48
  }, [logger, apiRef]);
50
49
 
51
50
  /**
@@ -4,6 +4,7 @@ import useEventCallback from '@mui/utils/useEventCallback';
4
4
  import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
5
5
  import ownerDocument from '@mui/utils/ownerDocument';
6
6
  import { throttle } from '@mui/x-internals/throttle';
7
+ import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
7
8
  import { useGridApiOptionHandler } from "../../utils/useGridApiEventHandler.js";
8
9
  import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
9
10
  import { createSelector } from "../../../utils/createSelector.js";
@@ -20,7 +21,6 @@ import { getTotalHeaderHeight } from "../columns/gridColumnsUtils.js";
20
21
  import { DATA_GRID_PROPS_DEFAULT_VALUES } from "../../../constants/dataGridPropsDefaultValues.js";
21
22
  import { roundToDecimalPlaces } from "../../../utils/roundToDecimalPlaces.js";
22
23
  import { isJSDOM } from "../../../utils/isJSDOM.js";
23
- import { isDeepEqual } from "../../../utils/utils.js";
24
24
  const EMPTY_SIZE = {
25
25
  width: 0,
26
26
  height: 0
@@ -405,7 +405,7 @@ export const useGridRowEditing = (apiRef, props) => {
405
405
  });
406
406
  return;
407
407
  }
408
- const rowUpdate = apiRef.current.getRowWithUpdatedValuesFromRowEditing(row.id);
408
+ const rowUpdate = apiRef.current.getRowWithUpdatedValuesFromRowEditing(id);
409
409
  if (processRowUpdate) {
410
410
  const handleError = errorThrown => {
411
411
  // The row might have been deleted
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { lruMemoize } from 'reselect';
4
4
  import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
5
+ import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
5
6
  import { useLazyRef } from "../../utils/useLazyRef.js";
6
7
  import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
7
8
  import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
@@ -15,7 +16,6 @@ import { gridRowsLookupSelector } from "../rows/index.js";
15
16
  import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.js";
16
17
  import { GRID_DEFAULT_STRATEGY, useGridRegisterStrategyProcessor } from "../../core/strategyProcessing/index.js";
17
18
  import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem, passFilterLogic, shouldQuickFilterExcludeHiddenColumns } from "./gridFilterUtils.js";
18
- import { isDeepEqual } from "../../../utils/utils.js";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  export const filterStateInitializer = (state, props, apiRef) => {
21
21
  const filterModel = props.filterModel ?? props.initialState?.filter?.filterModel ?? getDefaultGridFilterModel();
@@ -1,9 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
3
4
  import { gridFilterModelSelector, gridFilterActiveItemsSelector } from "../filter/gridFilterSelector.js";
4
5
  import { gridDensityFactorSelector } from "../density/index.js";
5
6
  import { useGridLogger, useGridSelector, useGridApiMethod, useGridApiEventHandler } from "../../utils/index.js";
6
- import { isDeepEqual } from "../../../utils/utils.js";
7
7
  import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.js";
8
8
  import { gridPageCountSelector, gridPaginationModelSelector } from "./gridPaginationSelector.js";
9
9
  import { getPageCount, defaultPageSize, throwIfPageSizeExceedsTheLimit, getDefaultGridPaginationModel, getValidPage } from "./gridPaginationUtils.js";
@@ -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.0
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';
@@ -38,7 +38,7 @@ import MUIInputAdornment, { inputAdornmentClasses } from '@mui/material/InputAdo
38
38
  import MUITooltip from '@mui/material/Tooltip';
39
39
  import MUIPagination, { tablePaginationClasses } from '@mui/material/TablePagination';
40
40
  import MUIPopper from '@mui/material/Popper';
41
- import MUIClickAwayListener from '@mui/material/ClickAwayListener';
41
+ import ClickAwayListener from '@mui/material/ClickAwayListener';
42
42
  import MUIGrow from '@mui/material/Grow';
43
43
  import MUIPaper from '@mui/material/Paper';
44
44
  import MUIInputLabel from '@mui/material/InputLabel';
@@ -50,7 +50,6 @@ import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
50
50
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
51
51
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
52
52
  export { useMaterialCSSVariables } from "./variables.js";
53
- const ClickAwayListener = forwardRef(MUIClickAwayListener);
54
53
  const InputAdornment = styled(MUIInputAdornment)({
55
54
  [`&.${inputAdornmentClasses.positionEnd} .${iconButtonClasses.sizeSmall}`]: {
56
55
  marginRight: '-7px'
@@ -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 () => {