@mui/x-data-grid 8.0.0-alpha.2 → 8.0.0-alpha.4

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 (138) hide show
  1. package/CHANGELOG.md +376 -0
  2. package/DataGrid/DataGrid.js +5 -13
  3. package/README.md +1 -1
  4. package/components/GridRow.js +1 -1
  5. package/components/cell/GridActionsCell.js +8 -1
  6. package/components/cell/GridCell.js +1 -1
  7. package/components/columnSelection/GridHeaderCheckbox.js +4 -1
  8. package/components/panel/GridColumnsPanel.js +1 -2
  9. package/components/panel/GridPanelContent.js +7 -3
  10. package/components/panel/GridPanelFooter.d.ts +1 -1
  11. package/components/panel/GridPanelFooter.js +4 -3
  12. package/components/panel/filterPanel/GridFilterForm.js +15 -15
  13. package/constants/dataGridPropsDefaultValues.js +1 -2
  14. package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +25 -9
  15. package/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +5 -1
  16. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +3 -6
  17. package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
  18. package/hooks/core/useGridStateInitialization.js +3 -3
  19. package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
  20. package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
  21. package/hooks/features/columnResize/useGridColumnResize.js +2 -1
  22. package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
  23. package/hooks/features/density/densitySelector.d.ts +1 -1
  24. package/hooks/features/editing/useGridCellEditing.js +3 -3
  25. package/hooks/features/editing/useGridRowEditing.js +3 -3
  26. package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
  27. package/hooks/features/filter/useGridFilter.js +1 -1
  28. package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
  29. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
  30. package/hooks/features/overlays/useGridOverlays.js +3 -1
  31. package/hooks/features/pagination/gridPaginationSelector.d.ts +15 -9
  32. package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
  33. package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  34. package/hooks/features/rowSelection/utils.d.ts +1 -1
  35. package/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
  36. package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -8
  37. package/hooks/features/rows/gridRowsSelector.d.ts +23 -13
  38. package/hooks/features/rows/gridRowsSelector.js +0 -1
  39. package/hooks/features/rows/gridRowsUtils.js +0 -9
  40. package/hooks/features/rows/index.d.ts +1 -1
  41. package/hooks/features/rows/index.js +1 -1
  42. package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
  43. package/hooks/features/rows/useGridRowSpanning.js +16 -8
  44. package/hooks/features/rows/useGridRows.js +16 -18
  45. package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
  46. package/hooks/features/sorting/gridSortingSelector.d.ts +10 -5
  47. package/hooks/features/sorting/gridSortingSelector.js +11 -0
  48. package/hooks/features/sorting/index.d.ts +2 -1
  49. package/hooks/features/sorting/index.js +1 -1
  50. package/hooks/features/sorting/useGridSorting.js +1 -1
  51. package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
  52. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  53. package/hooks/utils/useGridSelector.d.ts +4 -6
  54. package/hooks/utils/useGridSelector.js +6 -44
  55. package/index.js +1 -1
  56. package/internals/index.d.ts +3 -3
  57. package/internals/index.js +3 -3
  58. package/locales/heIL.js +14 -16
  59. package/locales/roRO.js +18 -20
  60. package/locales/trTR.js +12 -14
  61. package/models/api/gridStateApi.d.ts +1 -1
  62. package/models/controlStateItem.d.ts +2 -2
  63. package/models/events/gridEventLookup.d.ts +1 -0
  64. package/models/gridDataSource.d.ts +1 -1
  65. package/models/props/DataGridProps.d.ts +1 -9
  66. package/modern/DataGrid/DataGrid.js +5 -13
  67. package/modern/components/GridRow.js +1 -1
  68. package/modern/components/cell/GridActionsCell.js +8 -1
  69. package/modern/components/cell/GridCell.js +1 -1
  70. package/modern/components/columnSelection/GridHeaderCheckbox.js +4 -1
  71. package/modern/components/panel/GridColumnsPanel.js +1 -2
  72. package/modern/components/panel/GridPanelContent.js +7 -3
  73. package/modern/components/panel/GridPanelFooter.js +4 -3
  74. package/modern/components/panel/filterPanel/GridFilterForm.js +15 -15
  75. package/modern/constants/dataGridPropsDefaultValues.js +1 -2
  76. package/modern/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +5 -1
  77. package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
  78. package/modern/hooks/core/useGridStateInitialization.js +3 -3
  79. package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
  80. package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
  81. package/modern/hooks/features/editing/useGridRowEditing.js +3 -3
  82. package/modern/hooks/features/filter/useGridFilter.js +1 -1
  83. package/modern/hooks/features/overlays/useGridOverlays.js +3 -1
  84. package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  85. package/modern/hooks/features/rows/gridRowsSelector.js +0 -1
  86. package/modern/hooks/features/rows/gridRowsUtils.js +0 -9
  87. package/modern/hooks/features/rows/index.js +1 -1
  88. package/modern/hooks/features/rows/useGridRowSpanning.js +16 -8
  89. package/modern/hooks/features/rows/useGridRows.js +16 -18
  90. package/modern/hooks/features/sorting/gridSortingSelector.js +11 -0
  91. package/modern/hooks/features/sorting/index.js +1 -1
  92. package/modern/hooks/features/sorting/useGridSorting.js +1 -1
  93. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  94. package/modern/hooks/utils/useGridSelector.js +6 -44
  95. package/modern/index.js +1 -1
  96. package/modern/internals/index.js +3 -3
  97. package/modern/locales/heIL.js +14 -16
  98. package/modern/locales/roRO.js +18 -20
  99. package/modern/locales/trTR.js +12 -14
  100. package/modern/utils/createSelector.js +1 -120
  101. package/node/DataGrid/DataGrid.js +5 -13
  102. package/node/components/GridRow.js +1 -1
  103. package/node/components/cell/GridActionsCell.js +8 -1
  104. package/node/components/cell/GridCell.js +1 -1
  105. package/node/components/columnSelection/GridHeaderCheckbox.js +4 -1
  106. package/node/components/panel/GridColumnsPanel.js +1 -2
  107. package/node/components/panel/GridPanelContent.js +7 -3
  108. package/node/components/panel/GridPanelFooter.js +5 -4
  109. package/node/components/panel/filterPanel/GridFilterForm.js +15 -15
  110. package/node/constants/dataGridPropsDefaultValues.js +1 -2
  111. package/node/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +7 -1
  112. package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
  113. package/node/hooks/core/useGridStateInitialization.js +3 -3
  114. package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
  115. package/node/hooks/features/editing/useGridCellEditing.js +2 -2
  116. package/node/hooks/features/editing/useGridRowEditing.js +2 -2
  117. package/node/hooks/features/filter/useGridFilter.js +1 -1
  118. package/node/hooks/features/overlays/useGridOverlays.js +3 -1
  119. package/node/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  120. package/node/hooks/features/rows/gridRowsSelector.js +1 -2
  121. package/node/hooks/features/rows/gridRowsUtils.js +0 -9
  122. package/node/hooks/features/rows/index.js +0 -7
  123. package/node/hooks/features/rows/useGridRowSpanning.js +16 -8
  124. package/node/hooks/features/rows/useGridRows.js +15 -17
  125. package/node/hooks/features/sorting/gridSortingSelector.js +12 -1
  126. package/node/hooks/features/sorting/index.js +24 -16
  127. package/node/hooks/features/sorting/useGridSorting.js +1 -1
  128. package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  129. package/node/hooks/utils/useGridSelector.js +8 -47
  130. package/node/index.js +1 -1
  131. package/node/internals/index.js +15 -22
  132. package/node/locales/heIL.js +14 -16
  133. package/node/locales/roRO.js +18 -20
  134. package/node/locales/trTR.js +12 -14
  135. package/node/utils/createSelector.js +4 -125
  136. package/package.json +1 -1
  137. package/utils/createSelector.d.ts +4 -16
  138. package/utils/createSelector.js +1 -120
@@ -3,7 +3,7 @@ import type { DataGridProcessedProps } from '../../../models/props/DataGridProps
3
3
  import type { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
4
4
  import type { GridRowSelectionPropagation } from '../../../models/gridRowSelectionModel';
5
5
  export declare const ROW_SELECTION_PROPAGATION_DEFAULT: GridRowSelectionPropagation;
6
- export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity, {
6
+ export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: boolean): import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity, Record<GridRowId, GridRowId>, {
7
7
  isIndeterminate: boolean;
8
8
  isChecked: boolean;
9
9
  }>;
@@ -1,4 +1,4 @@
1
1
  import { GridStateCommunity } from '../../../models/gridStateCommunity';
2
- export declare const gridRowSpanningHiddenCellsSelector: import("../../..").OutputSelector<GridStateCommunity, Record<import("../../..").GridRowId, Record<string, boolean>>>;
3
- export declare const gridRowSpanningSpannedCellsSelector: import("../../..").OutputSelector<GridStateCommunity, Record<import("../../..").GridRowId, Record<string, number>>>;
4
- export declare const gridRowSpanningHiddenCellsOriginMapSelector: import("../../..").OutputSelector<GridStateCommunity, Record<number, Record<string, number>>>;
2
+ export declare const gridRowSpanningHiddenCellsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridRowSpanning").GridRowSpanningState, Record<import("../../..").GridRowId, Record<string, boolean>>>;
3
+ export declare const gridRowSpanningSpannedCellsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridRowSpanning").GridRowSpanningState, Record<import("../../..").GridRowId, Record<string, number>>>;
4
+ export declare const gridRowSpanningHiddenCellsOriginMapSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridRowSpanning").GridRowSpanningState, Record<number, Record<string, number>>>;
@@ -18,10 +18,6 @@ export interface GridRowsInternalCache {
18
18
  * Lookup containing the latest model at all time (even those not stored in the state yet).
19
19
  */
20
20
  dataRowIdToModelLookup: GridRowIdToModelLookup;
21
- /**
22
- * Lookup containing the latest ids at all time (even those not stored in the state yet).
23
- */
24
- dataRowIdToIdLookup: GridRowIdToIdLookup;
25
21
  /**
26
22
  * List of updates (partial or full) applied since the last time the state was synced with the cache.
27
23
  * It is used to build the tree.
@@ -59,7 +55,6 @@ export interface GridRowsState {
59
55
  */
60
56
  totalTopLevelRowCount: number;
61
57
  dataRowIdToModelLookup: GridRowIdToModelLookup;
62
- dataRowIdToIdLookup: GridRowIdToIdLookup;
63
58
  additionalRowGroups?: {
64
59
  pinnedRows?: GridPinnedRowsState;
65
60
  };
@@ -74,7 +69,6 @@ export interface GridRowTreeCreationParams {
74
69
  previousTree: GridRowTreeConfig | null;
75
70
  previousTreeDepths: GridTreeDepths | null;
76
71
  updates: GridRowsPartialUpdates | GridRowsFullUpdate;
77
- dataRowIdToIdLookup: GridRowIdToIdLookup;
78
72
  dataRowIdToModelLookup: GridRowIdToModelLookup;
79
73
  previousGroupsToFetch?: GridRowId[];
80
74
  }
@@ -91,10 +85,9 @@ export type GridRowTreeUpdatedGroupsManager = {
91
85
  export type GridRowTreeCreationValue = Pick<GridRowsState, 'groupingName' | 'tree' | 'treeDepths' | 'dataRowIds' | 'groupsToFetch'> & {
92
86
  updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
93
87
  };
94
- export type GridHydrateRowsValue = Pick<GridRowsState, 'tree' | 'treeDepths' | 'dataRowIds' | 'dataRowIdToIdLookup' | 'dataRowIdToModelLookup' | 'additionalRowGroups'>;
88
+ export type GridHydrateRowsValue = Pick<GridRowsState, 'tree' | 'treeDepths' | 'dataRowIds' | 'dataRowIdToModelLookup' | 'additionalRowGroups'>;
95
89
  export type GridRowsPartialUpdateAction = 'insert' | 'modify' | 'remove';
96
90
  export type GridRowIdToModelLookup<R extends GridValidRowModel = GridValidRowModel> = Record<string, R>;
97
- export type GridRowIdToIdLookup = Record<string, GridRowId>;
98
91
  export type GridTreeDepths = {
99
92
  [depth: number]: number;
100
93
  };
@@ -1,25 +1,26 @@
1
1
  import { GridStateCommunity } from '../../../models/gridStateCommunity';
2
- export declare const gridRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
3
- export declare const gridRowsLoadingSelector: import("../../..").OutputSelector<GridStateCommunity, boolean | undefined>;
4
- export declare const gridTopLevelRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
5
- export declare const gridRowsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowIdToModelLookup<import("../../..").GridValidRowModel>>;
6
- export declare const gridRowsDataRowIdToIdLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowIdToIdLookup>;
7
- export declare const gridRowTreeSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig>;
8
- export declare const gridRowGroupsToFetchSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[] | undefined>;
9
- export declare const gridRowGroupingNameSelector: import("../../..").OutputSelector<GridStateCommunity, string>;
10
- export declare const gridRowTreeDepthsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridTreeDepths>;
11
- export declare const gridRowMaximumTreeDepthSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
12
- export declare const gridDataRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
2
+ export declare const gridRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, number>;
3
+ export declare const gridRowsLoadingSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, boolean | undefined>;
4
+ export declare const gridTopLevelRowCountSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, number>;
5
+ export declare const gridRowsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("./gridRowsInterfaces").GridRowIdToModelLookup<import("../../..").GridValidRowModel>>;
6
+ export declare const gridRowTreeSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("../../..").GridRowTreeConfig>;
7
+ export declare const gridRowGroupsToFetchSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("../../..").GridRowId[] | undefined>;
8
+ export declare const gridRowGroupingNameSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, string>;
9
+ export declare const gridRowTreeDepthsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("./gridRowsInterfaces").GridTreeDepths>;
10
+ export declare const gridRowMaximumTreeDepthSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, number>;
11
+ export declare const gridDataRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, import("../../..").GridRowId[]>;
13
12
  /**
14
13
  * @ignore - do not document.
15
14
  */
16
- export declare const gridAdditionalRowGroupsSelector: import("../../..").OutputSelector<GridStateCommunity, {
15
+ export declare const gridAdditionalRowGroupsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowsState, {
17
16
  pinnedRows?: import("./gridRowsInterfaces").GridPinnedRowsState;
18
17
  } | undefined>;
19
18
  /**
20
19
  * @ignore - do not document.
21
20
  */
22
21
  export declare const gridPinnedRowsSelector: import("../../..").OutputSelector<GridStateCommunity, {
22
+ pinnedRows?: import("./gridRowsInterfaces").GridPinnedRowsState;
23
+ } | undefined, {
23
24
  bottom: {
24
25
  id: import("../../..").GridRowId;
25
26
  model: import("../../..").GridValidRowModel;
@@ -32,4 +33,13 @@ export declare const gridPinnedRowsSelector: import("../../..").OutputSelector<G
32
33
  /**
33
34
  * @ignore - do not document.
34
35
  */
35
- export declare const gridPinnedRowsCountSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
36
+ export declare const gridPinnedRowsCountSelector: import("../../..").OutputSelector<GridStateCommunity, {
37
+ bottom: {
38
+ id: import("../../..").GridRowId;
39
+ model: import("../../..").GridValidRowModel;
40
+ }[];
41
+ top: {
42
+ id: import("../../..").GridRowId;
43
+ model: import("../../..").GridValidRowModel;
44
+ }[];
45
+ }, number>;
@@ -6,7 +6,6 @@ export const gridTopLevelRowCountSelector = createSelector(gridRowsStateSelector
6
6
 
7
7
  // TODO rows v6: Rename
8
8
  export const gridRowsLookupSelector = createSelector(gridRowsStateSelector, rows => rows.dataRowIdToModelLookup);
9
- export const gridRowsDataRowIdToIdLookupSelector = createSelector(gridRowsStateSelector, rows => rows.dataRowIdToIdLookup);
10
9
  export const gridRowTreeSelector = createSelector(gridRowsStateSelector, rows => rows.tree);
11
10
  export const gridRowGroupsToFetchSelector = createSelector(gridRowsStateSelector, rows => rows.groupsToFetch);
12
11
  export const gridRowGroupingNameSelector = createSelector(gridRowsStateSelector, rows => rows.groupingName);
@@ -42,12 +42,10 @@ export const createRowsInternalCache = ({
42
42
  rows: []
43
43
  };
44
44
  const dataRowIdToModelLookup = {};
45
- const dataRowIdToIdLookup = {};
46
45
  for (let i = 0; i < rows.length; i += 1) {
47
46
  const model = rows[i];
48
47
  const id = getRowIdFromRowModel(model, getRowId);
49
48
  dataRowIdToModelLookup[id] = model;
50
- dataRowIdToIdLookup[id] = id;
51
49
  updates.rows.push(id);
52
50
  }
53
51
  return {
@@ -55,7 +53,6 @@ export const createRowsInternalCache = ({
55
53
  loadingPropBeforePartialUpdates: loading,
56
54
  rowCountPropBeforePartialUpdates: rowCount,
57
55
  updates,
58
- dataRowIdToIdLookup,
59
56
  dataRowIdToModelLookup
60
57
  };
61
58
  };
@@ -87,7 +84,6 @@ export const getRowsStateFromCache = ({
87
84
  previousTree,
88
85
  previousTreeDepths,
89
86
  updates: cache.updates,
90
- dataRowIdToIdLookup: cache.dataRowIdToIdLookup,
91
87
  dataRowIdToModelLookup: cache.dataRowIdToModelLookup,
92
88
  previousGroupsToFetch
93
89
  });
@@ -96,7 +92,6 @@ export const getRowsStateFromCache = ({
96
92
  const groupingParamsWithHydrateRows = apiRef.current.unstable_applyPipeProcessors('hydrateRows', {
97
93
  tree: unProcessedTree,
98
94
  treeDepths: unProcessedTreeDepths,
99
- dataRowIdToIdLookup: cache.dataRowIdToIdLookup,
100
95
  dataRowIds: unProcessedDataRowIds,
101
96
  dataRowIdToModelLookup: cache.dataRowIdToModelLookup
102
97
  });
@@ -177,7 +172,6 @@ export const updateCacheWithNewRows = ({
177
172
  groupKeys
178
173
  };
179
174
  const dataRowIdToModelLookup = _extends({}, previousCache.dataRowIdToModelLookup);
180
- const dataRowIdToIdLookup = _extends({}, previousCache.dataRowIdToIdLookup);
181
175
  const alreadyAppliedActionsToRemove = {
182
176
  insert: {},
183
177
  modify: {},
@@ -210,7 +204,6 @@ export const updateCacheWithNewRows = ({
210
204
  // Remove the data row from the lookups and add it to the "delete" update.
211
205
  partialUpdates.actions.remove.push(id);
212
206
  delete dataRowIdToModelLookup[id];
213
- delete dataRowIdToIdLookup[id];
214
207
  return;
215
208
  }
216
209
  const oldRow = dataRowIdToModelLookup[id];
@@ -250,7 +243,6 @@ export const updateCacheWithNewRows = ({
250
243
 
251
244
  // Update the data row lookups.
252
245
  dataRowIdToModelLookup[id] = partialRow;
253
- dataRowIdToIdLookup[id] = id;
254
246
  });
255
247
  const actionTypeWithActionsToRemove = Object.keys(alreadyAppliedActionsToRemove);
256
248
  for (let i = 0; i < actionTypeWithActionsToRemove.length; i += 1) {
@@ -262,7 +254,6 @@ export const updateCacheWithNewRows = ({
262
254
  }
263
255
  return {
264
256
  dataRowIdToModelLookup,
265
- dataRowIdToIdLookup,
266
257
  updates: partialUpdates,
267
258
  rowsBeforePartialUpdates: previousCache.rowsBeforePartialUpdates,
268
259
  loadingPropBeforePartialUpdates: previousCache.loadingPropBeforePartialUpdates,
@@ -1,5 +1,5 @@
1
1
  export * from './gridRowsMetaSelector';
2
2
  export * from './gridRowsMetaState';
3
- export { gridRowCountSelector, gridRowsLoadingSelector, gridTopLevelRowCountSelector, gridRowsLookupSelector, gridRowsDataRowIdToIdLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridRowMaximumTreeDepthSelector, gridDataRowIdsSelector, } from './gridRowsSelector';
3
+ export { gridRowCountSelector, gridRowsLoadingSelector, gridTopLevelRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridRowMaximumTreeDepthSelector, gridDataRowIdsSelector, } from './gridRowsSelector';
4
4
  export type { GridRowsState, GridRowIdToModelLookup } from './gridRowsInterfaces';
5
5
  export { GRID_ROOT_GROUP_ID, checkGridRowIdIsValid, isAutogeneratedRow } from './gridRowsUtils';
@@ -1,4 +1,4 @@
1
1
  export * from "./gridRowsMetaSelector.js";
2
2
  export * from "./gridRowsMetaState.js";
3
- export { gridRowCountSelector, gridRowsLoadingSelector, gridTopLevelRowCountSelector, gridRowsLookupSelector, gridRowsDataRowIdToIdLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridRowMaximumTreeDepthSelector, gridDataRowIdsSelector } from "./gridRowsSelector.js";
3
+ export { gridRowCountSelector, gridRowsLoadingSelector, gridTopLevelRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridRowMaximumTreeDepthSelector, gridDataRowIdsSelector } from "./gridRowsSelector.js";
4
4
  export { GRID_ROOT_GROUP_ID, checkGridRowIdIsValid, isAutogeneratedRow } from "./gridRowsUtils.js";
@@ -24,4 +24,4 @@ export type RowRange = {
24
24
  * @requires filterStateInitializer (method) - should be initialized before
25
25
  */
26
26
  export declare const rowSpanningStateInitializer: GridStateInitializer;
27
- export declare const useGridRowSpanning: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "unstable_rowSpanning" | "pagination" | "paginationMode">) => void;
27
+ export declare const useGridRowSpanning: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rowSpanning" | "pagination" | "paginationMode">) => void;
@@ -6,6 +6,7 @@ import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSele
6
6
  import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
7
7
  import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
8
8
  import { useGridSelector } from "../../utils/useGridSelector.js";
9
+ import { gridRowTreeSelector } from "./gridRowsSelector.js";
9
10
  import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
10
11
  import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
11
12
  const EMPTY_STATE = {
@@ -35,7 +36,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
35
36
  if (skippedFields.has(colDef.field)) {
36
37
  return;
37
38
  }
38
- for (let index = rangeToProcess.firstRowIndex; index <= rangeToProcess.lastRowIndex; index += 1) {
39
+ for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
39
40
  const row = visibleRows[index];
40
41
  if (hiddenCells[row.id]?.[colDef.field]) {
41
42
  continue;
@@ -129,7 +130,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
129
130
  * @requires filterStateInitializer (method) - should be initialized before
130
131
  */
131
132
  export const rowSpanningStateInitializer = (state, props, apiRef) => {
132
- if (props.unstable_rowSpanning) {
133
+ if (props.rowSpanning) {
133
134
  const rowIds = state.rows.dataRowIds || [];
134
135
  const orderedFields = state.columns.orderedFields || [];
135
136
  const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
@@ -142,7 +143,7 @@ export const rowSpanningStateInitializer = (state, props, apiRef) => {
142
143
  }
143
144
  const rangeToProcess = {
144
145
  firstRowIndex: 0,
145
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(rowIds.length - 1, 0))
146
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
146
147
  };
147
148
  const rows = rowIds.map(id => ({
148
149
  id,
@@ -173,10 +174,11 @@ export const useGridRowSpanning = (apiRef, props) => {
173
174
  } = useGridVisibleRows(apiRef, props);
174
175
  const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
175
176
  const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
177
+ const tree = useGridSelector(apiRef, gridRowTreeSelector);
176
178
  const processedRange = useLazyRef(() => {
177
179
  return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
178
180
  firstRowIndex: 0,
179
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(apiRef.current.state.rows.dataRowIds.length - 1, 0))
181
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
180
182
  } : EMPTY_RANGE;
181
183
  });
182
184
  const lastRange = React.useRef(EMPTY_RANGE);
@@ -188,7 +190,7 @@ export const useGridRowSpanning = (apiRef, props) => {
188
190
  // - The `paginationModel` is updated
189
191
  // - The rows are updated
190
192
  (resetState = true) => {
191
- if (!props.unstable_rowSpanning) {
193
+ if (!props.rowSpanning) {
192
194
  if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
193
195
  apiRef.current.setState(state => _extends({}, state, {
194
196
  rowSpanning: EMPTY_STATE
@@ -204,7 +206,7 @@ export const useGridRowSpanning = (apiRef, props) => {
204
206
  }
205
207
  const rangeToProcess = getUnprocessedRange({
206
208
  firstRowIndex: renderContext.firstRowIndex,
207
- lastRowIndex: Math.min(renderContext.lastRowIndex - 1, range.lastRowIndex)
209
+ lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
208
210
  }, processedRange.current);
209
211
  if (rangeToProcess === null) {
210
212
  return;
@@ -233,15 +235,21 @@ export const useGridRowSpanning = (apiRef, props) => {
233
235
  }
234
236
  });
235
237
  });
236
- }, [apiRef, props.unstable_rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
238
+ }, [apiRef, props.rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
237
239
  const prevRenderContext = React.useRef(renderContext);
238
240
  const isFirstRender = React.useRef(true);
239
241
  const shouldResetState = React.useRef(false);
242
+ const previousTree = React.useRef(tree);
240
243
  React.useEffect(() => {
241
244
  const firstRender = isFirstRender.current;
242
245
  if (isFirstRender.current) {
243
246
  isFirstRender.current = false;
244
247
  }
248
+ if (tree !== previousTree.current) {
249
+ previousTree.current = tree;
250
+ updateRowSpanningState(true);
251
+ return;
252
+ }
245
253
  if (range && lastRange.current && isRowRangeUpdated(range, lastRange.current)) {
246
254
  lastRange.current = range;
247
255
  shouldResetState.current = true;
@@ -255,5 +263,5 @@ export const useGridRowSpanning = (apiRef, props) => {
255
263
  return;
256
264
  }
257
265
  updateRowSpanningState();
258
- }, [updateRowSpanningState, renderContext, range, lastRange]);
266
+ }, [updateRowSpanningState, renderContext, range, lastRange, tree]);
259
267
  };
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import useLazyRef from '@mui/utils/useLazyRef';
4
4
  import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
5
5
  import { useGridLogger } from "../../utils/useGridLogger.js";
6
- import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowsDataRowIdToIdLookupSelector, gridRowMaximumTreeDepthSelector, gridRowGroupsToFetchSelector } from "./gridRowsSelector.js";
6
+ import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowMaximumTreeDepthSelector, gridRowGroupsToFetchSelector } from "./gridRowsSelector.js";
7
7
  import { useTimeout } from "../../utils/useTimeout.js";
8
8
  import { GridSignature, useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
9
9
  import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
@@ -11,6 +11,7 @@ import { gridSortedRowIdsSelector } from "../sorting/gridSortingSelector.js";
11
11
  import { gridFilteredRowsLookupSelector } from "../filter/gridFilterSelector.js";
12
12
  import { getTreeNodeDescendants, createRowsInternalCache, getRowsStateFromCache, isAutogeneratedRowNode, GRID_ROOT_GROUP_ID, GRID_ID_AUTOGENERATED, updateCacheWithNewRows, getTopLevelRowCount, getRowIdFromRowModel, computeRowsUpdates } from "./gridRowsUtils.js";
13
13
  import { useGridRegisterPipeApplier } from "../../core/pipeProcessing/index.js";
14
+ import { GridStrategyGroup } from "../../core/strategyProcessing/index.js";
14
15
  export const rowsStateInitializer = (state, props, apiRef) => {
15
16
  const isDataSourceAvailable = !!props.unstable_dataSource;
16
17
  apiRef.current.caches.rows = createRowsInternalCache({
@@ -238,7 +239,7 @@ export const useGridRows = (apiRef, props) => {
238
239
  throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
239
240
  }
240
241
  apiRef.current.setState(state => {
241
- const group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
242
+ const group = gridRowTreeSelector(state, undefined, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
242
243
  const allRows = group.children;
243
244
  const oldIndex = allRows.findIndex(row => row === rowId);
244
245
  if (oldIndex === -1 || oldIndex === targetIndex) {
@@ -272,7 +273,6 @@ export const useGridRows = (apiRef, props) => {
272
273
  }
273
274
  const tree = _extends({}, gridRowTreeSelector(apiRef));
274
275
  const dataRowIdToModelLookup = _extends({}, gridRowsLookupSelector(apiRef));
275
- const dataRowIdToIdLookup = _extends({}, gridRowsDataRowIdToIdLookupSelector(apiRef));
276
276
  const rootGroup = tree[GRID_ROOT_GROUP_ID];
277
277
  const rootGroupChildren = [...rootGroup.children];
278
278
  const seenIds = new Set();
@@ -282,7 +282,6 @@ export const useGridRows = (apiRef, props) => {
282
282
  const [removedRowId] = rootGroupChildren.splice(firstRowToRender + i, 1, rowId);
283
283
  if (!seenIds.has(removedRowId)) {
284
284
  delete dataRowIdToModelLookup[removedRowId];
285
- delete dataRowIdToIdLookup[removedRowId];
286
285
  delete tree[removedRowId];
287
286
  }
288
287
  const rowTreeNodeConfig = {
@@ -293,7 +292,6 @@ export const useGridRows = (apiRef, props) => {
293
292
  groupingKey: null
294
293
  };
295
294
  dataRowIdToModelLookup[rowId] = rowModel;
296
- dataRowIdToIdLookup[rowId] = rowId;
297
295
  tree[rowId] = rowTreeNodeConfig;
298
296
  seenIds.add(rowId);
299
297
  }
@@ -304,17 +302,17 @@ export const useGridRows = (apiRef, props) => {
304
302
  // Removes potential remaining skeleton rows from the dataRowIds.
305
303
  const dataRowIds = rootGroupChildren.filter(childId => tree[childId]?.type === 'leaf');
306
304
  apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
307
- apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
308
305
  apiRef.current.setState(state => _extends({}, state, {
309
306
  rows: _extends({}, state.rows, {
307
+ loading: props.loading,
308
+ totalRowCount: Math.max(props.rowCount || 0, rootGroupChildren.length),
310
309
  dataRowIdToModelLookup,
311
- dataRowIdToIdLookup,
312
310
  dataRowIds,
313
311
  tree
314
312
  })
315
313
  }));
316
314
  apiRef.current.publishEvent('rowsSet');
317
- }, [apiRef, props.signature, props.getRowId]);
315
+ }, [apiRef, props.signature, props.getRowId, props.loading, props.rowCount]);
318
316
  const rowApi = {
319
317
  getRow,
320
318
  setLoading,
@@ -381,7 +379,7 @@ export const useGridRows = (apiRef, props) => {
381
379
  const handleStrategyActivityChange = React.useCallback(() => {
382
380
  // `rowTreeCreation` is the only processor ran when `strategyAvailabilityChange` is fired.
383
381
  // All the other processors listen to `rowsSet` which will be published by the `groupRows` method below.
384
- if (apiRef.current.getActiveStrategy('rowTree') !== gridRowGroupingNameSelector(apiRef)) {
382
+ if (apiRef.current.getActiveStrategy(GridStrategyGroup.RowTree) !== gridRowGroupingNameSelector(apiRef)) {
385
383
  groupRows();
386
384
  }
387
385
  }, [apiRef, groupRows]);
@@ -394,11 +392,10 @@ export const useGridRows = (apiRef, props) => {
394
392
  const applyHydrateRowsProcessor = React.useCallback(() => {
395
393
  apiRef.current.setState(state => {
396
394
  const response = apiRef.current.unstable_applyPipeProcessors('hydrateRows', {
397
- tree: gridRowTreeSelector(state, apiRef.current.instanceId),
398
- treeDepths: gridRowTreeDepthsSelector(state, apiRef.current.instanceId),
399
- dataRowIds: gridDataRowIdsSelector(state, apiRef.current.instanceId),
400
- dataRowIdToModelLookup: gridRowsLookupSelector(state, apiRef.current.instanceId),
401
- dataRowIdToIdLookup: gridRowsDataRowIdToIdLookupSelector(state, apiRef.current.instanceId)
395
+ tree: gridRowTreeSelector(state, undefined, apiRef.current.instanceId),
396
+ treeDepths: gridRowTreeDepthsSelector(state, undefined, apiRef.current.instanceId),
397
+ dataRowIds: gridDataRowIdsSelector(state, undefined, apiRef.current.instanceId),
398
+ dataRowIdToModelLookup: gridRowsLookupSelector(state, undefined, apiRef.current.instanceId)
402
399
  });
403
400
  return _extends({}, state, {
404
401
  rows: _extends({}, state.rows, response, {
@@ -430,7 +427,8 @@ export const useGridRows = (apiRef, props) => {
430
427
  isRowCountPropUpdated = true;
431
428
  lastRowCount.current = props.rowCount;
432
429
  }
433
- const areNewRowsAlreadyInState = apiRef.current.caches.rows.rowsBeforePartialUpdates === props.rows;
430
+ const currentRows = props.unstable_dataSource ? Array.from(apiRef.current.getRowModels().values()) : props.rows;
431
+ const areNewRowsAlreadyInState = apiRef.current.caches.rows.rowsBeforePartialUpdates === currentRows;
434
432
  const isNewLoadingAlreadyInState = apiRef.current.caches.rows.loadingPropBeforePartialUpdates === props.loading;
435
433
  const isNewRowCountAlreadyInState = apiRef.current.caches.rows.rowCountPropBeforePartialUpdates === props.rowCount;
436
434
 
@@ -460,15 +458,15 @@ export const useGridRows = (apiRef, props) => {
460
458
  return;
461
459
  }
462
460
  }
463
- logger.debug(`Updating all rows, new length ${props.rows?.length}`);
461
+ logger.debug(`Updating all rows, new length ${currentRows?.length}`);
464
462
  throttledRowsChange({
465
463
  cache: createRowsInternalCache({
466
- rows: props.rows,
464
+ rows: currentRows,
467
465
  getRowId: props.getRowId,
468
466
  loading: props.loading,
469
467
  rowCount: props.rowCount
470
468
  }),
471
469
  throttle: false
472
470
  });
473
- }, [props.rows, props.rowCount, props.getRowId, props.loading, logger, throttledRowsChange, apiRef]);
471
+ }, [props.rows, props.rowCount, props.getRowId, props.loading, props.unstable_dataSource, logger, throttledRowsChange, apiRef]);
474
472
  };
@@ -7,4 +7,4 @@ export declare const rowsMetaStateInitializer: GridStateInitializer;
7
7
  * @requires useGridPageSize (method)
8
8
  * @requires useGridPage (method)
9
9
  */
10
- export declare const useGridRowsMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "getRowHeight" | "getEstimatedRowHeight" | "getRowSpacing" | "pagination" | "paginationMode" | "rowHeight" | "rowPositionsDebounceMs">) => void;
10
+ export declare const useGridRowsMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "getRowHeight" | "getEstimatedRowHeight" | "getRowSpacing" | "pagination" | "paginationMode" | "rowHeight">) => void;
@@ -1,21 +1,21 @@
1
1
  import { GridSortDirection, GridSortModel } from '../../../models/gridSortModel';
2
2
  import type { GridStateCommunity } from '../../../models/gridStateCommunity';
3
- import type { GridValidRowModel, GridRowEntry } from '../../../models/gridRows';
3
+ import type { GridValidRowModel, GridRowEntry, GridRowId } from '../../../models/gridRows';
4
4
  /**
5
5
  * Get the id of the rows after the sorting process.
6
6
  * @category Sorting
7
7
  */
8
- export declare const gridSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
8
+ export declare const gridSortedRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridSortingState").GridSortingState, GridRowId[]>;
9
9
  /**
10
10
  * Get the id and the model of the rows after the sorting process.
11
11
  * @category Sorting
12
12
  */
13
- export declare const gridSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, GridRowEntry<GridValidRowModel>[]>;
13
+ export declare const gridSortedRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig, GridRowEntry<GridValidRowModel>[]>;
14
14
  /**
15
15
  * Get the current sorting model.
16
16
  * @category Sorting
17
17
  */
18
- export declare const gridSortModelSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortModel>;
18
+ export declare const gridSortModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridSortingState").GridSortingState, GridSortModel>;
19
19
  export type GridSortColumnLookup = Record<string, {
20
20
  sortDirection: GridSortDirection;
21
21
  sortIndex?: number;
@@ -24,4 +24,9 @@ export type GridSortColumnLookup = Record<string, {
24
24
  * @category Sorting
25
25
  * @ignore - do not document.
26
26
  */
27
- export declare const gridSortColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortColumnLookup>;
27
+ export declare const gridSortColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridSortModel, GridSortColumnLookup>;
28
+ /**
29
+ * @category Sorting
30
+ * @ignore - do not document.
31
+ */
32
+ export declare const gridSortedRowIndexLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridRowId[], Record<GridRowId, number>>;
@@ -55,4 +55,15 @@ export const gridSortColumnLookupSelector = createSelectorMemoized(gridSortModel
55
55
  return res;
56
56
  }, {});
57
57
  return result;
58
+ });
59
+
60
+ /**
61
+ * @category Sorting
62
+ * @ignore - do not document.
63
+ */
64
+ export const gridSortedRowIndexLookupSelector = createSelectorMemoized(gridSortedRowIdsSelector, sortedIds => {
65
+ return sortedIds.reduce((acc, id, index) => {
66
+ acc[id] = index;
67
+ return acc;
68
+ }, Object.create(null));
58
69
  });
@@ -1,3 +1,4 @@
1
- export * from './gridSortingSelector';
1
+ export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector, } from './gridSortingSelector';
2
+ export type { GridSortColumnLookup } from './gridSortingSelector';
2
3
  export type { GridSortingState, GridSortingInitialState } from './gridSortingState';
3
4
  export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator, } from './gridSortingUtils';
@@ -1,2 +1,2 @@
1
- export * from "./gridSortingSelector.js";
1
+ export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector } from "./gridSortingSelector.js";
2
2
  export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator } from "./gridSortingUtils.js";
@@ -88,7 +88,7 @@ export const useGridSorting = (apiRef, props) => {
88
88
  })
89
89
  });
90
90
  }
91
- const sortModel = gridSortModelSelector(state, apiRef.current.instanceId);
91
+ const sortModel = gridSortModelSelector(state, undefined, apiRef.current.instanceId);
92
92
  const sortRowList = buildAggregatedSortingApplier(sortModel, apiRef);
93
93
  const sortedRows = apiRef.current.applyStrategyProcessor('sorting', {
94
94
  sortRowList
@@ -10,27 +10,27 @@ export declare const gridVirtualizationSelector: (state: GridStateCommunity) =>
10
10
  * @category Virtualization
11
11
  * @deprecated Use `gridVirtualizationColumnEnabledSelector` and `gridVirtualizationRowEnabledSelector`
12
12
  */
13
- export declare const gridVirtualizationEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
13
+ export declare const gridVirtualizationEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, boolean>;
14
14
  /**
15
15
  * Get the enabled state for column virtualization
16
16
  * @category Virtualization
17
17
  */
18
- export declare const gridVirtualizationColumnEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
18
+ export declare const gridVirtualizationColumnEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, boolean>;
19
19
  /**
20
20
  * Get the enabled state for row virtualization
21
21
  * @category Virtualization
22
22
  */
23
- export declare const gridVirtualizationRowEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
23
+ export declare const gridVirtualizationRowEnabledSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, boolean>;
24
24
  /**
25
25
  * Get the render context
26
26
  * @category Virtualization
27
27
  * @ignore - do not document.
28
28
  */
29
- export declare const gridRenderContextSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRenderContext>;
29
+ export declare const gridRenderContextSelector: import("../../..").OutputSelector<GridStateCommunity, import("./useGridVirtualization").GridVirtualizationState, import("../../..").GridRenderContext>;
30
30
  /**
31
31
  * Get the render context, with only columns filled in.
32
32
  * This is cached, so it can be used to only re-render when the column interval changes.
33
33
  * @category Virtualization
34
34
  * @ignore - do not document.
35
35
  */
36
- export declare const gridRenderContextColumnsSelector: import("../../..").OutputSelector<GridStateCommunity, GridColumnsRenderContext>;
36
+ export declare const gridRenderContextColumnsSelector: import("../../..").OutputSelector<GridStateCommunity, number, GridColumnsRenderContext>;
@@ -92,10 +92,7 @@ export const useGridVirtualScroller = () => {
92
92
  return undefined;
93
93
  }
94
94
  const initialRect = node.getBoundingClientRect();
95
- let lastSize = {
96
- width: initialRect.width,
97
- height: initialRect.height
98
- };
95
+ let lastSize = roundDimensions(initialRect);
99
96
  apiRef.current.publishEvent('resize', lastSize);
100
97
  if (typeof ResizeObserver === 'undefined') {
101
98
  return undefined;
@@ -105,10 +102,7 @@ export const useGridVirtualScroller = () => {
105
102
  if (!entry) {
106
103
  return;
107
104
  }
108
- const newSize = {
109
- width: entry.contentRect.width,
110
- height: entry.contentRect.height
111
- };
105
+ const newSize = roundDimensions(entry.contentRect);
112
106
  if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
113
107
  return;
114
108
  }
@@ -784,4 +778,13 @@ function bufferForDirection(isRtl, direction, rowBufferPx, columnBufferPx, verti
784
778
  // eslint unable to figure out enum exhaustiveness
785
779
  throw new Error('unreachable');
786
780
  }
781
+ }
782
+
783
+ // Round to avoid issues with subpixel rendering
784
+ // https://github.com/mui/mui-x/issues/15721
785
+ function roundDimensions(dimensions) {
786
+ return {
787
+ width: Math.round(dimensions.width * 10) / 10,
788
+ height: Math.round(dimensions.height * 10) / 10
789
+ };
787
790
  }
@@ -1,10 +1,8 @@
1
1
  import * as React from 'react';
2
- import { fastObjectShallowCompare } from '@mui/x-internals/fastObjectShallowCompare';
3
2
  import type { GridApiCommon } from '../../models/api/gridApiCommon';
4
- import type { OutputSelector, OutputSelectorV8 } from '../../utils/createSelector';
5
- type Selector<Api extends GridApiCommon, Args, T> = ((state: Api['state']) => T) | OutputSelectorV8<Api['state'], Args, T>;
6
- export declare const objectShallowCompare: typeof fastObjectShallowCompare;
3
+ import type { OutputSelector } from '../../utils/createSelector';
4
+ type Selector<Api extends GridApiCommon, Args, T> = ((state: Api['state']) => T) | OutputSelector<Api['state'], Args, T>;
5
+ export declare const objectShallowCompare: (a: unknown, b: unknown) => boolean;
7
6
  export declare const argsEqual: (prev: any, curr: any) => boolean;
8
- export declare const useGridSelector: <Api extends GridApiCommon, T>(apiRef: React.MutableRefObject<Api>, selector: ((state: Api["state"]) => T) | OutputSelector<Api["state"], T>, equals?: (a: T, b: T) => boolean) => T;
9
- export declare const useGridSelectorV8: <Api extends GridApiCommon, Args, T>(apiRef: React.MutableRefObject<Api>, selector: Selector<Api, Args, T>, args?: Args, equals?: <U = T>(a: U, b: U) => boolean) => T;
7
+ export declare const useGridSelector: <Api extends GridApiCommon, Args, T>(apiRef: React.MutableRefObject<Api>, selector: Selector<Api, Args, T>, args?: Args, equals?: <U = T>(a: U, b: U) => boolean) => T;
10
8
  export {};