@mui/x-data-grid 8.9.1 → 8.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +217 -8
- package/DataGrid/DataGrid.js +5 -0
- package/DataGrid/useDataGridComponent.js +2 -0
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/components/GridDetailPanels.d.ts +2 -2
- package/components/GridFooter.js +1 -1
- package/components/GridPagination.js +4 -3
- package/components/GridPinnedRows.d.ts +2 -2
- package/components/GridRow.js +8 -1
- package/components/cell/GridCell.js +7 -5
- package/components/cell/GridEditSingleSelectCell.js +1 -1
- package/components/columnsManagement/GridColumnsManagement.d.ts +6 -0
- package/components/columnsManagement/GridColumnsManagement.js +17 -5
- package/components/containers/GridRootStyles.d.ts +1 -1
- package/components/toolbarV8/Toolbar.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +5 -5
- package/constants/dataGridPropsDefaultValues.js +1 -0
- package/esm/DataGrid/DataGrid.js +5 -0
- package/esm/DataGrid/useDataGridComponent.js +2 -0
- package/esm/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/esm/components/GridDetailPanels.d.ts +2 -2
- package/esm/components/GridFooter.js +1 -1
- package/esm/components/GridPagination.js +3 -2
- package/esm/components/GridPinnedRows.d.ts +2 -2
- package/esm/components/GridRow.js +8 -1
- package/esm/components/cell/GridCell.js +7 -5
- package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
- package/esm/components/columnsManagement/GridColumnsManagement.d.ts +6 -0
- package/esm/components/columnsManagement/GridColumnsManagement.js +17 -5
- package/esm/components/containers/GridRootStyles.d.ts +1 -1
- package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/components/virtualization/GridVirtualScroller.js +5 -5
- package/esm/constants/dataGridPropsDefaultValues.js +1 -0
- package/esm/hooks/core/useGridVirtualizer.d.ts +9 -0
- package/esm/hooks/core/useGridVirtualizer.js +223 -0
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -2
- package/esm/hooks/features/columns/useGridColumnSpanning.js +5 -90
- package/esm/hooks/features/dataSource/models.d.ts +11 -2
- package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +9 -2
- package/esm/hooks/features/dimensions/useGridDimensions.js +18 -188
- package/esm/hooks/features/editing/useGridRowEditing.js +4 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -1
- package/esm/hooks/features/keyboardNavigation/utils.d.ts +3 -3
- package/esm/hooks/features/keyboardNavigation/utils.js +5 -5
- package/esm/hooks/features/pivoting/gridPivotingInterfaces.d.ts +0 -1
- package/esm/hooks/features/pivoting/gridPivotingSelectors.d.ts +1 -4
- package/esm/hooks/features/pivoting/gridPivotingSelectors.js +1 -2
- package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +9 -0
- package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.js +1 -0
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +5 -0
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +3 -0
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/esm/hooks/features/rowSelection/utils.js +5 -0
- package/esm/hooks/features/rows/gridRowsMetaInterfaces.d.ts +2 -8
- package/esm/hooks/features/rows/gridRowsMetaState.d.ts +2 -18
- package/esm/hooks/features/rows/useGridRowAriaAttributes.js +3 -1
- package/esm/hooks/features/rows/useGridRowSpanning.d.ts +2 -12
- package/esm/hooks/features/rows/useGridRowSpanning.js +54 -85
- package/esm/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/esm/hooks/features/rows/useGridRowsMeta.js +17 -187
- package/esm/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +1 -1
- package/esm/hooks/features/virtualization/index.d.ts +1 -0
- package/esm/hooks/features/virtualization/index.js +1 -0
- package/esm/hooks/features/virtualization/useGridVirtualization.d.ts +5 -16
- package/esm/hooks/features/virtualization/useGridVirtualization.js +41 -22
- package/esm/hooks/utils/index.d.ts +1 -1
- package/esm/hooks/utils/index.js +1 -1
- package/esm/hooks/utils/useFirstRender.d.ts +1 -1
- package/esm/hooks/utils/useFirstRender.js +1 -8
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +3 -1
- package/esm/internals/index.js +2 -1
- package/esm/internals/utils/getPinnedCellOffset.js +5 -0
- package/esm/locales/frFR.js +18 -21
- package/esm/locales/heIL.js +12 -12
- package/esm/locales/nnNO.js +96 -107
- package/esm/locales/plPL.js +22 -24
- package/esm/material/index.js +2 -2
- package/esm/models/api/gridApiCommon.d.ts +4 -1
- package/esm/models/api/gridColumnSpanning.d.ts +5 -11
- package/esm/models/gridStateCommunity.d.ts +2 -0
- package/esm/models/props/DataGridProps.d.ts +5 -0
- package/esm/utils/roundToDecimalPlaces.d.ts +1 -1
- package/esm/utils/roundToDecimalPlaces.js +1 -3
- package/hooks/core/useGridVirtualizer.d.ts +9 -0
- package/hooks/core/useGridVirtualizer.js +231 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -3
- package/hooks/features/columns/useGridColumnSpanning.js +5 -91
- package/hooks/features/dataSource/models.d.ts +11 -2
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.js +10 -3
- package/hooks/features/dimensions/useGridDimensions.js +18 -188
- package/hooks/features/editing/useGridRowEditing.js +4 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -1
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -3
- package/hooks/features/keyboardNavigation/utils.js +5 -5
- package/hooks/features/pivoting/gridPivotingInterfaces.d.ts +0 -1
- package/hooks/features/pivoting/gridPivotingSelectors.d.ts +1 -4
- package/hooks/features/pivoting/gridPivotingSelectors.js +2 -3
- package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +9 -0
- package/hooks/features/rowReorder/gridRowReorderInterfaces.js +5 -0
- package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +5 -0
- package/hooks/features/rowReorder/gridRowReorderSelector.js +9 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/hooks/features/rowSelection/utils.js +5 -0
- package/hooks/features/rows/gridRowsMetaInterfaces.d.ts +2 -8
- package/hooks/features/rows/gridRowsMetaState.d.ts +2 -18
- package/hooks/features/rows/useGridRowAriaAttributes.js +3 -1
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -12
- package/hooks/features/rows/useGridRowSpanning.js +54 -85
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +15 -186
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +1 -1
- package/hooks/features/virtualization/index.d.ts +1 -0
- package/hooks/features/virtualization/index.js +12 -0
- package/hooks/features/virtualization/useGridVirtualization.d.ts +5 -16
- package/hooks/features/virtualization/useGridVirtualization.js +42 -24
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +12 -12
- package/hooks/utils/useFirstRender.d.ts +1 -1
- package/hooks/utils/useFirstRender.js +11 -11
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +12 -11
- package/internals/utils/getPinnedCellOffset.js +5 -0
- package/locales/frFR.js +18 -21
- package/locales/heIL.js +12 -12
- package/locales/nnNO.js +96 -107
- package/locales/plPL.js +22 -24
- package/material/index.js +2 -2
- package/models/api/gridApiCommon.d.ts +4 -1
- package/models/api/gridColumnSpanning.d.ts +5 -11
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/props/DataGridProps.d.ts +5 -0
- package/package.json +5 -6
- package/utils/roundToDecimalPlaces.d.ts +1 -1
- package/utils/roundToDecimalPlaces.js +7 -4
- package/esm/hooks/features/rows/gridRowSpanningSelectors.d.ts +0 -10
- package/esm/hooks/features/rows/gridRowSpanningSelectors.js +0 -5
- package/esm/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -56
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +0 -843
- package/esm/hooks/utils/useRunOnce.d.ts +0 -5
- package/esm/hooks/utils/useRunOnce.js +0 -18
- package/esm/utils/platform.d.ts +0 -1
- package/esm/utils/platform.js +0 -2
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +0 -10
- package/hooks/features/rows/gridRowSpanningSelectors.js +0 -11
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -56
- package/hooks/features/virtualization/useGridVirtualScroller.js +0 -854
- package/hooks/utils/useRunOnce.d.ts +0 -5
- package/hooks/utils/useRunOnce.js +0 -27
- package/utils/platform.d.ts +0 -1
- package/utils/platform.js +0 -8
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import
|
|
6
|
-
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "../../../internals/constants.js";
|
|
5
|
+
import { Rowspan } from '@mui/x-virtualizer/features';
|
|
7
6
|
import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSelector.js";
|
|
8
7
|
import { getVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
9
8
|
import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
|
|
10
9
|
import { getUnprocessedRange, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
|
|
11
|
-
import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
|
|
12
10
|
import { useGridEvent } from "../../utils/useGridEvent.js";
|
|
13
11
|
import { runIf } from "../../../utils/utils.js";
|
|
14
12
|
import { gridPageSizeSelector } from "../pagination/index.js";
|
|
15
13
|
import { gridDataRowIdsSelector } from "./gridRowsSelector.js";
|
|
16
|
-
const
|
|
14
|
+
const EMPTY_CACHES = {
|
|
17
15
|
spannedCells: {},
|
|
18
16
|
hiddenCells: {},
|
|
19
17
|
hiddenCellOriginMap: {}
|
|
@@ -22,27 +20,31 @@ const EMPTY_RANGE = {
|
|
|
22
20
|
firstRowIndex: 0,
|
|
23
21
|
lastRowIndex: 0
|
|
24
22
|
};
|
|
25
|
-
const
|
|
23
|
+
const EMPTY_STATE = {
|
|
24
|
+
caches: EMPTY_CACHES,
|
|
25
|
+
processedRange: EMPTY_RANGE
|
|
26
|
+
};
|
|
27
|
+
|
|
26
28
|
/**
|
|
27
29
|
* Default number of rows to process during state initialization to avoid flickering.
|
|
28
30
|
* Number `20` is arbitrarily chosen to be large enough to cover most of the cases without
|
|
29
31
|
* compromising performance.
|
|
30
32
|
*/
|
|
31
33
|
const DEFAULT_ROWS_TO_PROCESS = 20;
|
|
32
|
-
const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToProcess, resetState
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToProcess, resetState) => {
|
|
35
|
+
const virtualizer = apiRef.current.virtualizer;
|
|
36
|
+
const previousState = resetState ? EMPTY_STATE : Rowspan.selectors.state(virtualizer.store.state);
|
|
37
|
+
const spannedCells = _extends({}, previousState.caches.spannedCells);
|
|
38
|
+
const hiddenCells = _extends({}, previousState.caches.hiddenCells);
|
|
39
|
+
const hiddenCellOriginMap = _extends({}, previousState.caches.hiddenCellOriginMap);
|
|
40
|
+
const processedRange = {
|
|
41
|
+
firstRowIndex: Math.min(previousState.processedRange.firstRowIndex, rangeToProcess.firstRowIndex),
|
|
42
|
+
lastRowIndex: Math.max(previousState.processedRange.lastRowIndex, rangeToProcess.lastRowIndex)
|
|
43
|
+
};
|
|
44
|
+
colDefs.forEach((colDef, columnIndex) => {
|
|
43
45
|
for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
|
|
44
46
|
const row = visibleRows[index];
|
|
45
|
-
if (hiddenCells[row.id]?.[
|
|
47
|
+
if (hiddenCells[row.id]?.[columnIndex]) {
|
|
46
48
|
continue;
|
|
47
49
|
}
|
|
48
50
|
const cellValue = getCellValue(row.model, colDef, apiRef);
|
|
@@ -61,10 +63,10 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
61
63
|
while (prevIndex >= range.firstRowIndex && prevRowEntry && getCellValue(prevRowEntry.model, colDef, apiRef) === cellValue) {
|
|
62
64
|
const currentRow = visibleRows[prevIndex + 1];
|
|
63
65
|
if (hiddenCells[currentRow.id]) {
|
|
64
|
-
hiddenCells[currentRow.id][
|
|
66
|
+
hiddenCells[currentRow.id][columnIndex] = true;
|
|
65
67
|
} else {
|
|
66
68
|
hiddenCells[currentRow.id] = {
|
|
67
|
-
[
|
|
69
|
+
[columnIndex]: true
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
backwardsHiddenCells.push(index);
|
|
@@ -77,10 +79,10 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
77
79
|
}
|
|
78
80
|
backwardsHiddenCells.forEach(hiddenCellIndex => {
|
|
79
81
|
if (hiddenCellOriginMap[hiddenCellIndex]) {
|
|
80
|
-
hiddenCellOriginMap[hiddenCellIndex][
|
|
82
|
+
hiddenCellOriginMap[hiddenCellIndex][columnIndex] = spannedRowIndex;
|
|
81
83
|
} else {
|
|
82
84
|
hiddenCellOriginMap[hiddenCellIndex] = {
|
|
83
|
-
[
|
|
85
|
+
[columnIndex]: spannedRowIndex
|
|
84
86
|
};
|
|
85
87
|
}
|
|
86
88
|
});
|
|
@@ -90,17 +92,17 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
90
92
|
while (relativeIndex <= range.lastRowIndex && visibleRows[relativeIndex] && getCellValue(visibleRows[relativeIndex].model, colDef, apiRef) === cellValue) {
|
|
91
93
|
const currentRow = visibleRows[relativeIndex];
|
|
92
94
|
if (hiddenCells[currentRow.id]) {
|
|
93
|
-
hiddenCells[currentRow.id][
|
|
95
|
+
hiddenCells[currentRow.id][columnIndex] = true;
|
|
94
96
|
} else {
|
|
95
97
|
hiddenCells[currentRow.id] = {
|
|
96
|
-
[
|
|
98
|
+
[columnIndex]: true
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
if (hiddenCellOriginMap[relativeIndex]) {
|
|
100
|
-
hiddenCellOriginMap[relativeIndex][
|
|
102
|
+
hiddenCellOriginMap[relativeIndex][columnIndex] = spannedRowIndex;
|
|
101
103
|
} else {
|
|
102
104
|
hiddenCellOriginMap[relativeIndex] = {
|
|
103
|
-
[
|
|
105
|
+
[columnIndex]: spannedRowIndex
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
relativeIndex += 1;
|
|
@@ -108,23 +110,21 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
108
110
|
}
|
|
109
111
|
if (rowSpan > 0) {
|
|
110
112
|
if (spannedCells[spannedRowId]) {
|
|
111
|
-
spannedCells[spannedRowId][
|
|
113
|
+
spannedCells[spannedRowId][columnIndex] = rowSpan + 1;
|
|
112
114
|
} else {
|
|
113
115
|
spannedCells[spannedRowId] = {
|
|
114
|
-
[
|
|
116
|
+
[columnIndex]: rowSpan + 1
|
|
115
117
|
};
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
|
-
processedRange = {
|
|
120
|
-
firstRowIndex: Math.min(processedRange.firstRowIndex, rangeToProcess.firstRowIndex),
|
|
121
|
-
lastRowIndex: Math.max(processedRange.lastRowIndex, rangeToProcess.lastRowIndex)
|
|
122
|
-
};
|
|
123
121
|
});
|
|
124
122
|
return {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
caches: {
|
|
124
|
+
spannedCells,
|
|
125
|
+
hiddenCells,
|
|
126
|
+
hiddenCellOriginMap
|
|
127
|
+
},
|
|
128
128
|
processedRange
|
|
129
129
|
};
|
|
130
130
|
};
|
|
@@ -174,71 +174,42 @@ export const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
|
174
174
|
model: dataRowIdToModelLookup[id]
|
|
175
175
|
}));
|
|
176
176
|
const colDefs = orderedFields.map(field => columnsLookup[field]);
|
|
177
|
-
const
|
|
178
|
-
spannedCells,
|
|
179
|
-
hiddenCells,
|
|
180
|
-
hiddenCellOriginMap
|
|
181
|
-
} = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
|
|
177
|
+
const rowSpanning = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true);
|
|
182
178
|
return _extends({}, state, {
|
|
183
|
-
rowSpanning
|
|
184
|
-
spannedCells,
|
|
185
|
-
hiddenCells,
|
|
186
|
-
hiddenCellOriginMap
|
|
187
|
-
}
|
|
179
|
+
rowSpanning
|
|
188
180
|
});
|
|
189
181
|
};
|
|
190
182
|
export const useGridRowSpanning = (apiRef, props) => {
|
|
191
|
-
const
|
|
192
|
-
return apiRef.current.state.rowSpanning !== EMPTY_STATE ? getInitialRangeToProcess(props, apiRef) : EMPTY_RANGE;
|
|
193
|
-
});
|
|
183
|
+
const store = apiRef.current.virtualizer.store;
|
|
194
184
|
const updateRowSpanningState = React.useCallback((renderContext, resetState = false) => {
|
|
195
185
|
const {
|
|
196
186
|
range,
|
|
197
187
|
rows: visibleRows
|
|
198
|
-
} = getVisibleRows(apiRef
|
|
199
|
-
pagination: props.pagination,
|
|
200
|
-
paginationMode: props.paginationMode
|
|
201
|
-
});
|
|
188
|
+
} = getVisibleRows(apiRef);
|
|
202
189
|
if (range === null || !isRowContextInitialized(renderContext)) {
|
|
203
190
|
return;
|
|
204
191
|
}
|
|
205
|
-
|
|
206
|
-
processedRange.current = EMPTY_RANGE;
|
|
207
|
-
}
|
|
192
|
+
const previousState = resetState ? EMPTY_STATE : Rowspan.selectors.state(store.state);
|
|
208
193
|
const rangeToProcess = getUnprocessedRange({
|
|
209
194
|
firstRowIndex: renderContext.firstRowIndex,
|
|
210
|
-
lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
|
|
211
|
-
}, processedRange
|
|
195
|
+
lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex - range.firstRowIndex + 1)
|
|
196
|
+
}, previousState.processedRange);
|
|
212
197
|
if (rangeToProcess === null) {
|
|
213
198
|
return;
|
|
214
199
|
}
|
|
215
200
|
const colDefs = gridVisibleColumnDefinitionsSelector(apiRef);
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const newSpannedCellsCount = Object.keys(spannedCells).length;
|
|
224
|
-
const newHiddenCellsCount = Object.keys(hiddenCells).length;
|
|
225
|
-
const currentSpannedCellsCount = Object.keys(apiRef.current.state.rowSpanning.spannedCells).length;
|
|
226
|
-
const currentHiddenCellsCount = Object.keys(apiRef.current.state.rowSpanning.hiddenCells).length;
|
|
227
|
-
const shouldUpdateState = resetState || newSpannedCellsCount !== currentSpannedCellsCount || newHiddenCellsCount !== currentHiddenCellsCount;
|
|
228
|
-
const hasNoSpannedCells = newSpannedCellsCount === 0 && currentSpannedCellsCount === 0;
|
|
201
|
+
const newState = computeRowSpanningState(apiRef, colDefs, visibleRows, range, rangeToProcess, resetState);
|
|
202
|
+
const newSpannedCellsCount = Object.keys(newState.caches.spannedCells).length;
|
|
203
|
+
const newHiddenCellsCount = Object.keys(newState.caches.hiddenCells).length;
|
|
204
|
+
const previousSpannedCellsCount = Object.keys(previousState.caches.spannedCells).length;
|
|
205
|
+
const previousHiddenCellsCount = Object.keys(previousState.caches.hiddenCells).length;
|
|
206
|
+
const shouldUpdateState = resetState || newSpannedCellsCount !== previousSpannedCellsCount || newHiddenCellsCount !== previousHiddenCellsCount;
|
|
207
|
+
const hasNoSpannedCells = newSpannedCellsCount === 0 && previousSpannedCellsCount === 0;
|
|
229
208
|
if (!shouldUpdateState || hasNoSpannedCells) {
|
|
230
209
|
return;
|
|
231
210
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
rowSpanning: {
|
|
235
|
-
spannedCells,
|
|
236
|
-
hiddenCells,
|
|
237
|
-
hiddenCellOriginMap
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
}, [apiRef, processedRange, props.pagination, props.paginationMode]);
|
|
211
|
+
store.set('rowSpanning', newState);
|
|
212
|
+
}, [apiRef, store]);
|
|
242
213
|
|
|
243
214
|
// Reset events trigger a full re-computation of the row spanning state:
|
|
244
215
|
// - The `unstable_rowSpanning` prop is updated (feature flag)
|
|
@@ -260,13 +231,11 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
260
231
|
useGridEvent(apiRef, 'columnsChange', runIf(props.rowSpanning, resetRowSpanningState));
|
|
261
232
|
React.useEffect(() => {
|
|
262
233
|
if (!props.rowSpanning) {
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
rowSpanning: EMPTY_STATE
|
|
266
|
-
}));
|
|
234
|
+
if (store.state.rowSpanning !== EMPTY_STATE) {
|
|
235
|
+
store.set('rowSpanning', EMPTY_STATE);
|
|
267
236
|
}
|
|
268
|
-
} else if (
|
|
237
|
+
} else if (store.state.rowSpanning.caches === EMPTY_CACHES) {
|
|
269
238
|
resetRowSpanningState();
|
|
270
239
|
}
|
|
271
|
-
}, [apiRef, resetRowSpanningState, props.rowSpanning]);
|
|
240
|
+
}, [apiRef, store, resetRowSpanningState, props.rowSpanning]);
|
|
272
241
|
};
|
|
@@ -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: RefObject<GridPrivateApiCommunity>,
|
|
10
|
+
export declare const useGridRowsMeta: (apiRef: RefObject<GridPrivateApiCommunity>, _props: Pick<DataGridProcessedProps, "getRowHeight" | "getEstimatedRowHeight" | "getRowSpacing" | "pagination" | "paginationMode" | "rowHeight">) => void;
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import useLazyRef from '@mui/utils/useLazyRef';
|
|
4
|
-
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
|
-
import { ResizeObserver } from "../../../utils/ResizeObserver.js";
|
|
6
|
-
import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
7
|
-
import { eslintUseValue } from "../../../utils/utils.js";
|
|
8
2
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
9
|
-
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
10
|
-
import { gridDensityFactorSelector } from "../density/densitySelector.js";
|
|
11
3
|
import { gridPaginationSelector } from "../pagination/gridPaginationSelector.js";
|
|
12
4
|
import { useGridRegisterPipeApplier } from "../../core/pipeProcessing/index.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { getValidRowHeight, getRowHeightWarning } from "./gridRowsUtils.js";
|
|
16
|
-
import { gridFocusedVirtualCellSelector } from "../virtualization/gridFocusedVirtualCellSelector.js";
|
|
17
|
-
/* eslint-disable no-underscore-dangle */
|
|
18
|
-
|
|
5
|
+
import { gridRowCountSelector } from "./gridRowsSelector.js";
|
|
6
|
+
import { gridRowHeightSelector } from "../dimensions/gridDimensionsSelectors.js";
|
|
19
7
|
export const rowsMetaStateInitializer = (state, props, apiRef) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
// FIXME: This should be handled in the virtualizer eventually, but there are interdependencies
|
|
9
|
+
// between state initializers that need to be untangled carefully.
|
|
10
|
+
|
|
23
11
|
const baseRowHeight = gridRowHeightSelector(apiRef);
|
|
24
12
|
const dataRowCount = gridRowCountSelector(apiRef);
|
|
25
13
|
const pagination = gridPaginationSelector(apiRef);
|
|
@@ -40,178 +28,20 @@ export const rowsMetaStateInitializer = (state, props, apiRef) => {
|
|
|
40
28
|
* @requires useGridPageSize (method)
|
|
41
29
|
* @requires useGridPage (method)
|
|
42
30
|
*/
|
|
43
|
-
export const useGridRowsMeta = (apiRef,
|
|
31
|
+
export const useGridRowsMeta = (apiRef, _props) => {
|
|
32
|
+
const virtualizer = apiRef.current.virtualizer;
|
|
44
33
|
const {
|
|
45
|
-
getRowHeight
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
56
|
-
const rowHeight = useGridSelector(apiRef, gridRowHeightSelector);
|
|
57
|
-
const getRowHeightEntry = rowId => {
|
|
58
|
-
let entry = heightCache.get(rowId);
|
|
59
|
-
if (entry === undefined) {
|
|
60
|
-
entry = {
|
|
61
|
-
content: rowHeight,
|
|
62
|
-
spacingTop: 0,
|
|
63
|
-
spacingBottom: 0,
|
|
64
|
-
detail: 0,
|
|
65
|
-
autoHeight: false,
|
|
66
|
-
needsFirstMeasurement: true
|
|
67
|
-
};
|
|
68
|
-
heightCache.set(rowId, entry);
|
|
69
|
-
}
|
|
70
|
-
return entry;
|
|
71
|
-
};
|
|
72
|
-
const processHeightEntry = React.useCallback(row => {
|
|
73
|
-
// HACK: rowHeight trails behind the most up-to-date value just enough to
|
|
74
|
-
// mess the initial rowsMeta hydration :/
|
|
75
|
-
const baseRowHeight = gridDimensionsSelector(apiRef).rowHeight;
|
|
76
|
-
eslintUseValue(rowHeight);
|
|
77
|
-
const entry = apiRef.current.getRowHeightEntry(row.id);
|
|
78
|
-
if (!getRowHeightProp) {
|
|
79
|
-
entry.content = baseRowHeight;
|
|
80
|
-
entry.needsFirstMeasurement = false;
|
|
81
|
-
} else {
|
|
82
|
-
const rowHeightFromUser = getRowHeightProp(_extends({}, row, {
|
|
83
|
-
densityFactor
|
|
84
|
-
}));
|
|
85
|
-
if (rowHeightFromUser === 'auto') {
|
|
86
|
-
if (entry.needsFirstMeasurement) {
|
|
87
|
-
const estimatedRowHeight = getEstimatedRowHeight ? getEstimatedRowHeight(_extends({}, row, {
|
|
88
|
-
densityFactor
|
|
89
|
-
})) : baseRowHeight;
|
|
90
|
-
|
|
91
|
-
// If the row was not measured yet use the estimated row height
|
|
92
|
-
entry.content = estimatedRowHeight ?? baseRowHeight;
|
|
93
|
-
}
|
|
94
|
-
hasRowWithAutoHeight.current = true;
|
|
95
|
-
entry.autoHeight = true;
|
|
96
|
-
} else {
|
|
97
|
-
// Default back to base rowHeight if getRowHeight returns invalid value.
|
|
98
|
-
entry.content = getValidRowHeight(rowHeightFromUser, baseRowHeight, getRowHeightWarning);
|
|
99
|
-
entry.needsFirstMeasurement = false;
|
|
100
|
-
entry.autoHeight = false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (getRowSpacing) {
|
|
104
|
-
const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
105
|
-
const spacing = getRowSpacing(_extends({}, row, {
|
|
106
|
-
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
107
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
108
|
-
indexRelativeToCurrentPage
|
|
109
|
-
}));
|
|
110
|
-
entry.spacingTop = spacing.top ?? 0;
|
|
111
|
-
entry.spacingBottom = spacing.bottom ?? 0;
|
|
112
|
-
} else {
|
|
113
|
-
entry.spacingTop = 0;
|
|
114
|
-
entry.spacingBottom = 0;
|
|
115
|
-
}
|
|
116
|
-
apiRef.current.unstable_applyPipeProcessors('rowHeight', entry, row);
|
|
117
|
-
return entry;
|
|
118
|
-
}, [apiRef, currentPage.rows, getRowHeightProp, getEstimatedRowHeight, rowHeight, getRowSpacing, densityFactor]);
|
|
119
|
-
const hydrateRowsMeta = React.useCallback(() => {
|
|
120
|
-
hasRowWithAutoHeight.current = false;
|
|
121
|
-
const pinnedTopRowsTotalHeight = pinnedRows.top.reduce((acc, row) => {
|
|
122
|
-
const entry = processHeightEntry(row);
|
|
123
|
-
return acc + entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
|
|
124
|
-
}, 0);
|
|
125
|
-
const pinnedBottomRowsTotalHeight = pinnedRows.bottom.reduce((acc, row) => {
|
|
126
|
-
const entry = processHeightEntry(row);
|
|
127
|
-
return acc + entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
|
|
128
|
-
}, 0);
|
|
129
|
-
const positions = [];
|
|
130
|
-
const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
|
|
131
|
-
positions.push(acc);
|
|
132
|
-
const entry = processHeightEntry(row);
|
|
133
|
-
const total = entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
|
|
134
|
-
return acc + total;
|
|
135
|
-
}, 0);
|
|
136
|
-
if (!hasRowWithAutoHeight.current) {
|
|
137
|
-
// No row has height=auto, so all rows are already measured
|
|
138
|
-
lastMeasuredRowIndex.current = Infinity;
|
|
139
|
-
}
|
|
140
|
-
const didHeightsChange = pinnedTopRowsTotalHeight !== apiRef.current.state.rowsMeta.pinnedTopRowsTotalHeight || pinnedBottomRowsTotalHeight !== apiRef.current.state.rowsMeta.pinnedBottomRowsTotalHeight || currentPageTotalHeight !== apiRef.current.state.rowsMeta.currentPageTotalHeight;
|
|
141
|
-
const rowsMeta = {
|
|
142
|
-
currentPageTotalHeight,
|
|
143
|
-
positions,
|
|
144
|
-
pinnedTopRowsTotalHeight,
|
|
145
|
-
pinnedBottomRowsTotalHeight
|
|
146
|
-
};
|
|
147
|
-
apiRef.current.setState(state => {
|
|
148
|
-
return _extends({}, state, {
|
|
149
|
-
rowsMeta
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
if (didHeightsChange) {
|
|
153
|
-
apiRef.current.updateDimensions();
|
|
154
|
-
}
|
|
155
|
-
isHeightMetaValid.current = true;
|
|
156
|
-
}, [apiRef, pinnedRows, currentPage.rows, processHeightEntry]);
|
|
157
|
-
const getRowHeight = rowId => {
|
|
158
|
-
return heightCache.get(rowId)?.content ?? rowHeight;
|
|
159
|
-
};
|
|
160
|
-
const storeRowHeightMeasurement = (id, height) => {
|
|
161
|
-
const entry = apiRef.current.getRowHeightEntry(id);
|
|
162
|
-
const didChange = entry.content !== height;
|
|
163
|
-
entry.needsFirstMeasurement = false;
|
|
164
|
-
entry.content = height;
|
|
165
|
-
isHeightMetaValid.current &&= !didChange;
|
|
166
|
-
};
|
|
167
|
-
const rowHasAutoHeight = id => {
|
|
168
|
-
return heightCache.get(id)?.autoHeight ?? false;
|
|
169
|
-
};
|
|
170
|
-
const getLastMeasuredRowIndex = () => {
|
|
171
|
-
return lastMeasuredRowIndex.current;
|
|
172
|
-
};
|
|
173
|
-
const setLastMeasuredRowIndex = index => {
|
|
174
|
-
if (hasRowWithAutoHeight.current && index > lastMeasuredRowIndex.current) {
|
|
175
|
-
lastMeasuredRowIndex.current = index;
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
const resetRowHeights = () => {
|
|
179
|
-
heightCache.clear();
|
|
180
|
-
hydrateRowsMeta();
|
|
181
|
-
};
|
|
182
|
-
const resizeObserver = useLazyRef(() => new ResizeObserver(entries => {
|
|
183
|
-
for (let i = 0; i < entries.length; i += 1) {
|
|
184
|
-
const entry = entries[i];
|
|
185
|
-
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
186
|
-
const rowId = entry.target.__mui_id;
|
|
187
|
-
const focusedVirtualRowId = gridFocusedVirtualCellSelector(apiRef)?.id;
|
|
188
|
-
if (focusedVirtualRowId === rowId && height === 0) {
|
|
189
|
-
// Focused virtual row has 0 height.
|
|
190
|
-
// We don't want to store it to avoid scroll jumping.
|
|
191
|
-
// https://github.com/mui/mui-x/issues/14726
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
195
|
-
}
|
|
196
|
-
if (!isHeightMetaValid.current) {
|
|
197
|
-
// Avoids "ResizeObserver loop completed with undelivered notifications" error
|
|
198
|
-
requestAnimationFrame(() => {
|
|
199
|
-
apiRef.current.requestPipeProcessorsApplication('rowHeight');
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
})).current;
|
|
203
|
-
const observeRowHeight = (element, rowId) => {
|
|
204
|
-
element.__mui_id = rowId;
|
|
205
|
-
resizeObserver.observe(element);
|
|
206
|
-
return () => resizeObserver.unobserve(element);
|
|
207
|
-
};
|
|
34
|
+
getRowHeight,
|
|
35
|
+
setLastMeasuredRowIndex,
|
|
36
|
+
storeRowHeightMeasurement,
|
|
37
|
+
resetRowHeights,
|
|
38
|
+
hydrateRowsMeta,
|
|
39
|
+
observeRowHeight,
|
|
40
|
+
rowHasAutoHeight,
|
|
41
|
+
getRowHeightEntry,
|
|
42
|
+
getLastMeasuredRowIndex
|
|
43
|
+
} = virtualizer.api.rowsMeta;
|
|
208
44
|
useGridRegisterPipeApplier(apiRef, 'rowHeight', hydrateRowsMeta);
|
|
209
|
-
|
|
210
|
-
// The effect is used to build the rows meta data - currentPageTotalHeight and positions.
|
|
211
|
-
// Because of variable row height this is needed for the virtualization
|
|
212
|
-
useEnhancedEffect(() => {
|
|
213
|
-
hydrateRowsMeta();
|
|
214
|
-
}, [hydrateRowsMeta]);
|
|
215
45
|
const rowsMetaApi = {
|
|
216
46
|
unstable_getRowHeight: getRowHeight,
|
|
217
47
|
unstable_setLastMeasuredRowIndex: setLastMeasuredRowIndex,
|
|
@@ -34,7 +34,7 @@ export declare const gridVirtualizationRowEnabledSelector: (args_0: import("reac
|
|
|
34
34
|
*/
|
|
35
35
|
export declare const gridRenderContextSelector: (args_0: import("react").RefObject<{
|
|
36
36
|
state: GridStateCommunity;
|
|
37
|
-
} | null>) => import("@mui/x-
|
|
37
|
+
} | null>) => import("@mui/x-virtualizer/models").RenderContext;
|
|
38
38
|
/**
|
|
39
39
|
* Get the render context, with only columns filled in.
|
|
40
40
|
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import {
|
|
2
|
+
import { Virtualization } from '@mui/x-virtualizer';
|
|
3
3
|
import { GridPrivateApiCommunity } from "../../../models/api/gridApiCommunity.js";
|
|
4
|
-
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
5
4
|
import { GridStateInitializer } from "../../utils/useGridInitializeState.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
enabledForColumns: boolean;
|
|
10
|
-
enabledForRows: boolean;
|
|
11
|
-
renderContext: GridRenderContext;
|
|
12
|
-
};
|
|
13
|
-
export declare const EMPTY_RENDER_CONTEXT: {
|
|
14
|
-
firstRowIndex: number;
|
|
15
|
-
lastRowIndex: number;
|
|
16
|
-
firstColumnIndex: number;
|
|
17
|
-
lastColumnIndex: number;
|
|
18
|
-
};
|
|
5
|
+
import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
|
|
6
|
+
type RootProps = DataGridProcessedProps;
|
|
7
|
+
export type GridVirtualizationState = { [K in keyof Virtualization.State['virtualization']]: Virtualization.State['virtualization'][K] };
|
|
19
8
|
export declare const virtualizationStateInitializer: GridStateInitializer<RootProps>;
|
|
20
|
-
export declare function useGridVirtualization(apiRef: RefObject<GridPrivateApiCommunity>,
|
|
9
|
+
export declare function useGridVirtualization(apiRef: RefObject<GridPrivateApiCommunity>, rootProps: RootProps): void;
|
|
21
10
|
export {};
|
|
@@ -2,47 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import { EMPTY_RENDER_CONTEXT } from '@mui/x-virtualizer';
|
|
6
|
+
import { isJSDOM } from "../../../utils/isJSDOM.js";
|
|
5
7
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { useGridEventPriority } from "../../utils/index.js";
|
|
9
|
+
const HAS_LAYOUT = !isJSDOM;
|
|
10
|
+
|
|
11
|
+
// HACK: Typescript doesn't use the alias name ("GridVirtualizationState") and changes
|
|
12
|
+
// the autogenerated docs result, but this would otherwise be just:
|
|
13
|
+
// export type GridVirtualizationState = VirtualizationState;
|
|
14
|
+
|
|
15
|
+
// XXX: We want to use the virtualizer as the source of truth for its state, but this needs to
|
|
16
|
+
// stay because some parts of the grid require the `virtualization` state during initialization.
|
|
12
17
|
export const virtualizationStateInitializer = (state, props) => {
|
|
13
18
|
const {
|
|
14
19
|
disableVirtualization,
|
|
15
20
|
autoHeight
|
|
16
21
|
} = props;
|
|
17
22
|
const virtualization = {
|
|
18
|
-
enabled: !disableVirtualization,
|
|
19
|
-
enabledForColumns: !disableVirtualization,
|
|
20
|
-
enabledForRows: !disableVirtualization && !autoHeight,
|
|
23
|
+
enabled: !disableVirtualization && HAS_LAYOUT,
|
|
24
|
+
enabledForColumns: !disableVirtualization && HAS_LAYOUT,
|
|
25
|
+
enabledForRows: !disableVirtualization && !autoHeight && HAS_LAYOUT,
|
|
21
26
|
renderContext: EMPTY_RENDER_CONTEXT
|
|
22
27
|
};
|
|
23
28
|
return _extends({}, state, {
|
|
24
29
|
virtualization
|
|
25
30
|
});
|
|
26
31
|
};
|
|
27
|
-
export function useGridVirtualization(apiRef,
|
|
32
|
+
export function useGridVirtualization(apiRef, rootProps) {
|
|
33
|
+
const {
|
|
34
|
+
virtualizer
|
|
35
|
+
} = apiRef.current;
|
|
36
|
+
const {
|
|
37
|
+
autoHeight,
|
|
38
|
+
disableVirtualization
|
|
39
|
+
} = rootProps;
|
|
40
|
+
|
|
28
41
|
/*
|
|
29
42
|
* API METHODS
|
|
30
43
|
*/
|
|
31
44
|
|
|
32
45
|
const setVirtualization = enabled => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
46
|
+
enabled &&= HAS_LAYOUT;
|
|
47
|
+
virtualizer.store.set('virtualization', _extends({}, virtualizer.store.state.virtualization, {
|
|
48
|
+
enabled,
|
|
49
|
+
enabledForColumns: enabled,
|
|
50
|
+
enabledForRows: enabled && !autoHeight
|
|
39
51
|
}));
|
|
40
52
|
};
|
|
41
53
|
const setColumnVirtualization = enabled => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
54
|
+
enabled &&= HAS_LAYOUT;
|
|
55
|
+
virtualizer.store.set('virtualization', _extends({}, virtualizer.store.state.virtualization, {
|
|
56
|
+
enabledForColumns: enabled
|
|
46
57
|
}));
|
|
47
58
|
};
|
|
48
59
|
const api = {
|
|
@@ -50,14 +61,22 @@ export function useGridVirtualization(apiRef, props) {
|
|
|
50
61
|
unstable_setColumnVirtualization: setColumnVirtualization
|
|
51
62
|
};
|
|
52
63
|
useGridApiMethod(apiRef, api, 'public');
|
|
64
|
+
const forceUpdateRenderContext = virtualizer.api.forceUpdateRenderContext;
|
|
65
|
+
apiRef.current.register('private', {
|
|
66
|
+
updateRenderContext: forceUpdateRenderContext
|
|
67
|
+
});
|
|
53
68
|
|
|
54
69
|
/*
|
|
55
70
|
* EFFECTS
|
|
56
71
|
*/
|
|
57
72
|
|
|
73
|
+
useGridEventPriority(apiRef, 'sortedRowsSet', forceUpdateRenderContext);
|
|
74
|
+
useGridEventPriority(apiRef, 'paginationModelChange', forceUpdateRenderContext);
|
|
75
|
+
useGridEventPriority(apiRef, 'columnsChange', forceUpdateRenderContext);
|
|
76
|
+
|
|
58
77
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
59
78
|
React.useEffect(() => {
|
|
60
|
-
setVirtualization(!
|
|
61
|
-
}, [
|
|
79
|
+
setVirtualization(!rootProps.disableVirtualization);
|
|
80
|
+
}, [disableVirtualization, autoHeight]);
|
|
62
81
|
/* eslint-enable react-hooks/exhaustive-deps */
|
|
63
82
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from '@mui/x-internals/useRunOnce';
|
|
1
2
|
export { useGridEvent, useGridEventPriority, unstable_resetCleanupTracking } from "./useGridEvent.js";
|
|
2
3
|
export * from "./useGridApiMethod.js";
|
|
3
4
|
export * from "./useGridLogger.js";
|
|
@@ -5,6 +6,5 @@ export { useGridSelector } from "./useGridSelector.js";
|
|
|
5
6
|
export * from "./useGridNativeEventListener.js";
|
|
6
7
|
export * from "./useFirstRender.js";
|
|
7
8
|
export * from "./useOnMount.js";
|
|
8
|
-
export * from "./useRunOnce.js";
|
|
9
9
|
export * from "./useRunOncePerLoop.js";
|
|
10
10
|
export type { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
package/esm/hooks/utils/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from '@mui/x-internals/useRunOnce';
|
|
1
2
|
export { useGridEvent, useGridEventPriority, unstable_resetCleanupTracking } from "./useGridEvent.js";
|
|
2
3
|
export * from "./useGridApiMethod.js";
|
|
3
4
|
export * from "./useGridLogger.js";
|
|
@@ -5,5 +6,4 @@ export { useGridSelector } from "./useGridSelector.js";
|
|
|
5
6
|
export * from "./useGridNativeEventListener.js";
|
|
6
7
|
export * from "./useFirstRender.js";
|
|
7
8
|
export * from "./useOnMount.js";
|
|
8
|
-
export * from "./useRunOnce.js";
|
|
9
9
|
export * from "./useRunOncePerLoop.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from '@mui/x-internals/useFirstRender';
|