@mui/x-data-grid 8.0.0-alpha.5 → 8.0.0-alpha.6
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 +79 -0
- package/DataGrid/DataGrid.js +4 -3
- package/components/GridColumnHeaders.d.ts +1 -1
- package/components/GridColumnHeaders.js +4 -4
- package/components/GridFooter.d.ts +2 -1
- package/components/GridFooter.js +4 -4
- package/components/GridLoadingOverlay.d.ts +1 -1
- package/components/GridLoadingOverlay.js +10 -8
- package/components/GridNoResultsOverlay.d.ts +2 -1
- package/components/GridNoResultsOverlay.js +4 -4
- package/components/GridNoRowsOverlay.d.ts +2 -1
- package/components/GridNoRowsOverlay.js +4 -4
- package/components/GridPagination.d.ts +1 -1
- package/components/GridPagination.js +5 -3
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +3 -2
- package/components/GridRowCount.d.ts +1 -1
- package/components/GridRowCount.js +3 -2
- package/components/GridSelectedRowCount.d.ts +4 -1
- package/components/GridSelectedRowCount.js +3 -2
- package/components/GridSkeletonLoadingOverlay.d.ts +1 -1
- package/components/GridSkeletonLoadingOverlay.js +4 -3
- package/components/cell/GridActionsCellItem.d.ts +1 -1
- package/components/cell/GridActionsCellItem.js +3 -2
- package/components/cell/GridCell.d.ts +1 -1
- package/components/cell/GridCell.js +3 -2
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditInputCell.js +72 -3
- package/components/cell/GridSkeletonCell.js +1 -2
- package/components/columnHeaders/GridBaseColumnHeaders.d.ts +1 -1
- package/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -1
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/components/columnHeaders/GridIconButtonContainer.d.ts +1 -1
- package/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
- package/components/columnSelection/GridCellCheckboxRenderer.js +5 -3
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/columnSelection/GridHeaderCheckbox.js +5 -3
- package/components/containers/GridFooterContainer.d.ts +1 -1
- package/components/containers/GridFooterContainer.js +5 -3
- package/components/containers/GridOverlay.d.ts +1 -1
- package/components/containers/GridOverlay.js +5 -3
- package/components/containers/GridRoot.d.ts +1 -1
- package/components/containers/GridRoot.js +5 -3
- package/components/containers/GridToolbarContainer.d.ts +1 -1
- package/components/containers/GridToolbarContainer.js +3 -2
- package/components/menu/columnMenu/GridColumnMenu.d.ts +2 -2
- package/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/components/menu/columnMenu/GridColumnMenuContainer.d.ts +1 -1
- package/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +3 -2
- package/components/panel/GridPanelWrapper.d.ts +1 -1
- package/components/panel/GridPanelWrapper.js +5 -3
- package/components/panel/filterPanel/GridFilterForm.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +9 -9
- package/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/components/panel/filterPanel/GridFilterPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/components/panel/filterPanel/index.d.ts +2 -1
- package/components/panel/filterPanel/index.js +1 -1
- package/components/toolbar/GridToolbar.d.ts +1 -1
- package/components/toolbar/GridToolbar.js +4 -4
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/components/toolbar/GridToolbarExport.d.ts +1 -1
- package/components/toolbar/GridToolbarExport.js +2 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/components/virtualization/GridMainContainer.d.ts +3 -1
- package/components/virtualization/GridMainContainer.js +3 -2
- package/components/virtualization/GridVirtualScrollbar.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/components/virtualization/GridVirtualScrollerContent.d.ts +2 -0
- package/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +2 -0
- package/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/hooks/features/rows/useGridRowSpanning.js +76 -87
- package/index.js +1 -1
- package/locales/nlNL.js +5 -6
- package/material/index.js +6 -0
- package/models/gridBaseSlots.d.ts +15 -0
- package/models/gridSlotsComponent.d.ts +16 -1
- package/models/gridSlotsComponentsProps.d.ts +14 -1
- package/modern/DataGrid/DataGrid.js +4 -3
- package/modern/components/GridColumnHeaders.js +4 -4
- package/modern/components/GridFooter.js +4 -4
- package/modern/components/GridLoadingOverlay.js +10 -8
- package/modern/components/GridNoResultsOverlay.js +4 -4
- package/modern/components/GridNoRowsOverlay.js +4 -4
- package/modern/components/GridPagination.js +5 -3
- package/modern/components/GridRow.js +3 -2
- package/modern/components/GridRowCount.js +3 -2
- package/modern/components/GridSelectedRowCount.js +3 -2
- package/modern/components/GridSkeletonLoadingOverlay.js +4 -3
- package/modern/components/cell/GridActionsCellItem.js +3 -2
- package/modern/components/cell/GridCell.js +3 -2
- package/modern/components/cell/GridEditInputCell.js +72 -3
- package/modern/components/cell/GridSkeletonCell.js +1 -2
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/modern/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/modern/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +5 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +5 -3
- package/modern/components/containers/GridFooterContainer.js +5 -3
- package/modern/components/containers/GridOverlay.js +5 -3
- package/modern/components/containers/GridRoot.js +5 -3
- package/modern/components/containers/GridToolbarContainer.js +3 -2
- package/modern/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/modern/components/panel/GridPanel.js +3 -2
- package/modern/components/panel/GridPanelWrapper.js +5 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +9 -9
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/modern/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/modern/components/panel/filterPanel/index.js +1 -1
- package/modern/components/toolbar/GridToolbar.js +4 -4
- package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/modern/components/toolbar/GridToolbarExport.js +2 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/modern/components/virtualization/GridMainContainer.js +3 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/modern/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/modern/hooks/features/rows/useGridRowSpanning.js +76 -87
- package/modern/index.js +1 -1
- package/modern/locales/nlNL.js +5 -6
- package/modern/material/index.js +6 -0
- package/modern/utils/utils.js +6 -1
- package/node/DataGrid/DataGrid.js +4 -3
- package/node/components/GridColumnHeaders.js +4 -4
- package/node/components/GridFooter.js +4 -4
- package/node/components/GridLoadingOverlay.js +10 -8
- package/node/components/GridNoResultsOverlay.js +4 -4
- package/node/components/GridNoRowsOverlay.js +4 -4
- package/node/components/GridPagination.js +5 -3
- package/node/components/GridRow.js +3 -2
- package/node/components/GridRowCount.js +3 -2
- package/node/components/GridSelectedRowCount.js +3 -2
- package/node/components/GridSkeletonLoadingOverlay.js +4 -3
- package/node/components/cell/GridActionsCellItem.js +3 -2
- package/node/components/cell/GridCell.js +3 -2
- package/node/components/cell/GridEditInputCell.js +72 -3
- package/node/components/cell/GridSkeletonCell.js +1 -2
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/node/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/node/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +5 -3
- package/node/components/columnSelection/GridHeaderCheckbox.js +5 -3
- package/node/components/containers/GridFooterContainer.js +5 -3
- package/node/components/containers/GridOverlay.js +5 -3
- package/node/components/containers/GridRoot.js +5 -3
- package/node/components/containers/GridToolbarContainer.js +3 -2
- package/node/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/node/components/panel/GridPanel.js +3 -2
- package/node/components/panel/GridPanelWrapper.js +5 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +10 -11
- package/node/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/node/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/node/components/panel/filterPanel/index.js +7 -11
- package/node/components/toolbar/GridToolbar.js +4 -4
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/node/components/toolbar/GridToolbarExport.js +2 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/node/components/virtualization/GridMainContainer.js +3 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/node/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/node/hooks/features/rows/useGridRowSpanning.js +74 -85
- package/node/index.js +1 -1
- package/node/locales/nlNL.js +5 -6
- package/node/material/index.js +6 -0
- package/node/utils/utils.js +8 -1
- package/package.json +2 -2
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +6 -1
|
@@ -13,10 +13,10 @@ var _constants = require("../../../internals/constants");
|
|
|
13
13
|
var _gridColumnsSelector = require("../columns/gridColumnsSelector");
|
|
14
14
|
var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
|
|
15
15
|
var _gridVirtualizationSelectors = require("../virtualization/gridVirtualizationSelectors");
|
|
16
|
-
var _useGridSelector = require("../../utils/useGridSelector");
|
|
17
|
-
var _gridRowsSelector = require("./gridRowsSelector");
|
|
18
16
|
var _gridRowSpanningUtils = require("./gridRowSpanningUtils");
|
|
19
17
|
var _gridCheckboxSelectionColDef = require("../../../colDef/gridCheckboxSelectionColDef");
|
|
18
|
+
var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
|
|
19
|
+
var _utils = require("../../../utils/utils");
|
|
20
20
|
const EMPTY_STATE = {
|
|
21
21
|
spannedCells: {},
|
|
22
22
|
hiddenCells: {},
|
|
@@ -61,8 +61,8 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
61
61
|
const backwardsHiddenCells = [];
|
|
62
62
|
if (index === rangeToProcess.firstRowIndex) {
|
|
63
63
|
let prevIndex = index - 1;
|
|
64
|
-
|
|
65
|
-
while (prevIndex >= range.firstRowIndex && (0, _gridRowSpanningUtils.getCellValue)(prevRowEntry.model, colDef, apiRef) === cellValue) {
|
|
64
|
+
let prevRowEntry = visibleRows[prevIndex];
|
|
65
|
+
while (prevIndex >= range.firstRowIndex && prevRowEntry && (0, _gridRowSpanningUtils.getCellValue)(prevRowEntry.model, colDef, apiRef) === cellValue) {
|
|
66
66
|
const currentRow = visibleRows[prevIndex + 1];
|
|
67
67
|
if (hiddenCells[currentRow.id]) {
|
|
68
68
|
hiddenCells[currentRow.id][colDef.field] = true;
|
|
@@ -76,6 +76,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
76
76
|
spannedRowId = prevRowEntry.id;
|
|
77
77
|
spannedRowIndex = prevIndex;
|
|
78
78
|
prevIndex -= 1;
|
|
79
|
+
prevRowEntry = visibleRows[prevIndex];
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
backwardsHiddenCells.forEach(hiddenCellIndex => {
|
|
@@ -138,75 +139,59 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
138
139
|
* @requires filterStateInitializer (method) - should be initialized before
|
|
139
140
|
*/
|
|
140
141
|
const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
141
|
-
if (props.rowSpanning) {
|
|
142
|
-
const rowIds = state.rows.dataRowIds || [];
|
|
143
|
-
const orderedFields = state.columns.orderedFields || [];
|
|
144
|
-
const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
|
|
145
|
-
const columnsLookup = state.columns.lookup;
|
|
146
|
-
const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
|
|
147
|
-
if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
|
|
148
|
-
return (0, _extends2.default)({}, state, {
|
|
149
|
-
rowSpanning: EMPTY_STATE
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
const rangeToProcess = {
|
|
153
|
-
firstRowIndex: 0,
|
|
154
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
155
|
-
};
|
|
156
|
-
const rows = rowIds.map(id => ({
|
|
157
|
-
id,
|
|
158
|
-
model: dataRowIdToModelLookup[id]
|
|
159
|
-
}));
|
|
160
|
-
const colDefs = orderedFields.map(field => columnsLookup[field]);
|
|
161
|
-
const {
|
|
162
|
-
spannedCells,
|
|
163
|
-
hiddenCells,
|
|
164
|
-
hiddenCellOriginMap
|
|
165
|
-
} = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
|
|
142
|
+
if (!props.rowSpanning) {
|
|
166
143
|
return (0, _extends2.default)({}, state, {
|
|
167
|
-
rowSpanning:
|
|
168
|
-
spannedCells,
|
|
169
|
-
hiddenCells,
|
|
170
|
-
hiddenCellOriginMap
|
|
171
|
-
}
|
|
144
|
+
rowSpanning: EMPTY_STATE
|
|
172
145
|
});
|
|
173
146
|
}
|
|
147
|
+
const rowIds = state.rows.dataRowIds || [];
|
|
148
|
+
const orderedFields = state.columns.orderedFields || [];
|
|
149
|
+
const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
|
|
150
|
+
const columnsLookup = state.columns.lookup;
|
|
151
|
+
const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
|
|
152
|
+
if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
|
|
153
|
+
return (0, _extends2.default)({}, state, {
|
|
154
|
+
rowSpanning: EMPTY_STATE
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
const rangeToProcess = {
|
|
158
|
+
firstRowIndex: 0,
|
|
159
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
160
|
+
};
|
|
161
|
+
const rows = rowIds.map(id => ({
|
|
162
|
+
id,
|
|
163
|
+
model: dataRowIdToModelLookup[id]
|
|
164
|
+
}));
|
|
165
|
+
const colDefs = orderedFields.map(field => columnsLookup[field]);
|
|
166
|
+
const {
|
|
167
|
+
spannedCells,
|
|
168
|
+
hiddenCells,
|
|
169
|
+
hiddenCellOriginMap
|
|
170
|
+
} = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
|
|
174
171
|
return (0, _extends2.default)({}, state, {
|
|
175
|
-
rowSpanning:
|
|
172
|
+
rowSpanning: {
|
|
173
|
+
spannedCells,
|
|
174
|
+
hiddenCells,
|
|
175
|
+
hiddenCellOriginMap
|
|
176
|
+
}
|
|
176
177
|
});
|
|
177
178
|
};
|
|
178
179
|
exports.rowSpanningStateInitializer = rowSpanningStateInitializer;
|
|
179
180
|
const useGridRowSpanning = (apiRef, props) => {
|
|
180
|
-
const {
|
|
181
|
-
range,
|
|
182
|
-
rows: visibleRows
|
|
183
|
-
} = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
|
|
184
|
-
const renderContext = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridRenderContextSelector);
|
|
185
|
-
const colDefs = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector);
|
|
186
|
-
const tree = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowTreeSelector);
|
|
187
181
|
const processedRange = (0, _useLazyRef.default)(() => {
|
|
188
182
|
return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
|
|
189
183
|
firstRowIndex: 0,
|
|
190
184
|
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
|
|
191
185
|
} : EMPTY_RANGE;
|
|
192
186
|
});
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
(resetState = true) => {
|
|
202
|
-
if (!props.rowSpanning) {
|
|
203
|
-
if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
|
|
204
|
-
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
205
|
-
rowSpanning: EMPTY_STATE
|
|
206
|
-
}));
|
|
207
|
-
}
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
187
|
+
const updateRowSpanningState = React.useCallback((renderContext, resetState = false) => {
|
|
188
|
+
const {
|
|
189
|
+
range,
|
|
190
|
+
rows: visibleRows
|
|
191
|
+
} = (0, _useGridVisibleRows.getVisibleRows)(apiRef, {
|
|
192
|
+
pagination: props.pagination,
|
|
193
|
+
paginationMode: props.paginationMode
|
|
194
|
+
});
|
|
210
195
|
if (range === null || !(0, _gridRowSpanningUtils.isRowContextInitialized)(renderContext)) {
|
|
211
196
|
return;
|
|
212
197
|
}
|
|
@@ -220,6 +205,7 @@ const useGridRowSpanning = (apiRef, props) => {
|
|
|
220
205
|
if (rangeToProcess === null) {
|
|
221
206
|
return;
|
|
222
207
|
}
|
|
208
|
+
const colDefs = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
223
209
|
const {
|
|
224
210
|
spannedCells,
|
|
225
211
|
hiddenCells,
|
|
@@ -232,7 +218,8 @@ const useGridRowSpanning = (apiRef, props) => {
|
|
|
232
218
|
const currentSpannedCellsCount = Object.keys(apiRef.current.state.rowSpanning.spannedCells).length;
|
|
233
219
|
const currentHiddenCellsCount = Object.keys(apiRef.current.state.rowSpanning.hiddenCells).length;
|
|
234
220
|
const shouldUpdateState = resetState || newSpannedCellsCount !== currentSpannedCellsCount || newHiddenCellsCount !== currentHiddenCellsCount;
|
|
235
|
-
|
|
221
|
+
const hasNoSpannedCells = newSpannedCellsCount === 0 && currentSpannedCellsCount === 0;
|
|
222
|
+
if (!shouldUpdateState || hasNoSpannedCells) {
|
|
236
223
|
return;
|
|
237
224
|
}
|
|
238
225
|
apiRef.current.setState(state => {
|
|
@@ -244,34 +231,36 @@ const useGridRowSpanning = (apiRef, props) => {
|
|
|
244
231
|
}
|
|
245
232
|
});
|
|
246
233
|
});
|
|
247
|
-
}, [apiRef, props.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (
|
|
258
|
-
previousTree.current = tree;
|
|
259
|
-
updateRowSpanningState(true);
|
|
234
|
+
}, [apiRef, processedRange, props.pagination, props.paginationMode]);
|
|
235
|
+
|
|
236
|
+
// Reset events trigger a full re-computation of the row spanning state:
|
|
237
|
+
// - The `unstable_rowSpanning` prop is updated (feature flag)
|
|
238
|
+
// - The filtering is applied
|
|
239
|
+
// - The sorting is applied
|
|
240
|
+
// - The `paginationModel` is updated
|
|
241
|
+
// - The rows are updated
|
|
242
|
+
const resetRowSpanningState = React.useCallback(() => {
|
|
243
|
+
const renderContext = (0, _gridVirtualizationSelectors.gridRenderContextSelector)(apiRef);
|
|
244
|
+
if (!(0, _gridRowSpanningUtils.isRowContextInitialized)(renderContext)) {
|
|
260
245
|
return;
|
|
261
246
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
247
|
+
updateRowSpanningState(renderContext, true);
|
|
248
|
+
}, [apiRef, updateRowSpanningState]);
|
|
249
|
+
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'renderedRowsIntervalChange', (0, _utils.runIf)(props.rowSpanning, updateRowSpanningState));
|
|
250
|
+
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'sortedRowsSet', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
|
|
251
|
+
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'paginationModelChange', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
|
|
252
|
+
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'filteredRowsSet', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
|
|
253
|
+
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnsChange', (0, _utils.runIf)(props.rowSpanning, resetRowSpanningState));
|
|
254
|
+
React.useEffect(() => {
|
|
255
|
+
if (!props.rowSpanning) {
|
|
256
|
+
if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
|
|
257
|
+
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
258
|
+
rowSpanning: EMPTY_STATE
|
|
259
|
+
}));
|
|
270
260
|
}
|
|
271
|
-
|
|
272
|
-
|
|
261
|
+
} else if (apiRef.current.state.rowSpanning === EMPTY_STATE) {
|
|
262
|
+
resetRowSpanningState();
|
|
273
263
|
}
|
|
274
|
-
|
|
275
|
-
}, [updateRowSpanningState, renderContext, range, lastRange, tree]);
|
|
264
|
+
}, [apiRef, resetRowSpanningState, props.rowSpanning]);
|
|
276
265
|
};
|
|
277
266
|
exports.useGridRowSpanning = useGridRowSpanning;
|
package/node/index.js
CHANGED
package/node/locales/nlNL.js
CHANGED
|
@@ -51,8 +51,7 @@ const nlNLGrid = {
|
|
|
51
51
|
columnsManagementNoColumns: 'Geen kolommen',
|
|
52
52
|
columnsManagementShowHideAllText: 'Toon/Verberg Alle',
|
|
53
53
|
columnsManagementReset: 'Reset',
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
columnsManagementDeleteIconLabel: 'Verwijderen',
|
|
56
55
|
// Filter panel text
|
|
57
56
|
filterPanelAddFilter: 'Filter toevoegen',
|
|
58
57
|
filterPanelRemoveAll: 'Alles verwijderen',
|
|
@@ -66,9 +65,9 @@ const nlNLGrid = {
|
|
|
66
65
|
filterPanelInputPlaceholder: 'Filter waarde',
|
|
67
66
|
// Filter operators text
|
|
68
67
|
filterOperatorContains: 'bevat',
|
|
69
|
-
|
|
68
|
+
filterOperatorDoesNotContain: 'bevat niet',
|
|
70
69
|
filterOperatorEquals: 'gelijk aan',
|
|
71
|
-
|
|
70
|
+
filterOperatorDoesNotEqual: 'niet gelijk aan',
|
|
72
71
|
filterOperatorStartsWith: 'begint met',
|
|
73
72
|
filterOperatorEndsWith: 'eindigt met',
|
|
74
73
|
filterOperatorIs: 'is',
|
|
@@ -88,9 +87,9 @@ const nlNLGrid = {
|
|
|
88
87
|
'filterOperator<=': '<=',
|
|
89
88
|
// Header filter operators text
|
|
90
89
|
headerFilterOperatorContains: 'Bevat',
|
|
91
|
-
|
|
90
|
+
headerFilterOperatorDoesNotContain: 'Bevat niet',
|
|
92
91
|
headerFilterOperatorEquals: 'Gelijk aan',
|
|
93
|
-
|
|
92
|
+
headerFilterOperatorDoesNotEqual: 'Niet gelijk aan',
|
|
94
93
|
headerFilterOperatorStartsWith: 'Begint met',
|
|
95
94
|
headerFilterOperatorEndsWith: 'Eindigt met',
|
|
96
95
|
headerFilterOperatorIs: 'Is',
|
package/node/material/index.js
CHANGED
|
@@ -11,7 +11,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
13
13
|
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
14
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
14
15
|
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
16
|
+
var _LinearProgress = _interopRequireDefault(require("@mui/material/LinearProgress"));
|
|
15
17
|
var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
|
|
16
18
|
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
17
19
|
var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
@@ -26,6 +28,7 @@ var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
|
26
28
|
var _Popper = _interopRequireDefault(require("@mui/material/Popper"));
|
|
27
29
|
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
28
30
|
var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
|
|
31
|
+
var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
29
32
|
var _GridColumnUnsortedIcon = require("./icons/GridColumnUnsortedIcon");
|
|
30
33
|
var _icons = require("./icons");
|
|
31
34
|
var _MUISelectOption = _interopRequireDefault(require("./components/MUISelectOption"));
|
|
@@ -71,7 +74,9 @@ const iconSlots = {
|
|
|
71
74
|
const baseSlots = {
|
|
72
75
|
baseBadge: _Badge.default,
|
|
73
76
|
baseCheckbox: _Checkbox.default,
|
|
77
|
+
baseCircularProgress: _CircularProgress.default,
|
|
74
78
|
baseDivider: _Divider.default,
|
|
79
|
+
baseLinearProgress: _LinearProgress.default,
|
|
75
80
|
baseMenuList: _MenuList.default,
|
|
76
81
|
baseMenuItem: BaseMenuItem,
|
|
77
82
|
baseTextField: _TextField.default,
|
|
@@ -84,6 +89,7 @@ const baseSlots = {
|
|
|
84
89
|
basePopper: _Popper.default,
|
|
85
90
|
baseInputLabel: _InputLabel.default,
|
|
86
91
|
baseSelectOption: _MUISelectOption.default,
|
|
92
|
+
baseSkeleton: _Skeleton.default,
|
|
87
93
|
baseChip: _Chip.default
|
|
88
94
|
};
|
|
89
95
|
const materialSlots = (0, _extends2.default)({}, baseSlots, iconSlots);
|
package/node/utils/utils.js
CHANGED
|
@@ -14,6 +14,7 @@ exports.isNumber = isNumber;
|
|
|
14
14
|
exports.isObject = isObject;
|
|
15
15
|
exports.localStorageAvailable = localStorageAvailable;
|
|
16
16
|
exports.range = range;
|
|
17
|
+
exports.runIf = void 0;
|
|
17
18
|
function isNumber(value) {
|
|
18
19
|
return typeof value === 'number' && !Number.isNaN(value);
|
|
19
20
|
}
|
|
@@ -213,4 +214,10 @@ function deepClone(obj) {
|
|
|
213
214
|
* of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
|
|
214
215
|
* that hint disables checks on all values instead of just one.
|
|
215
216
|
*/
|
|
216
|
-
function eslintUseValue(_) {}
|
|
217
|
+
function eslintUseValue(_) {}
|
|
218
|
+
const runIf = (condition, fn) => params => {
|
|
219
|
+
if (condition) {
|
|
220
|
+
fn(params);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
exports.runIf = runIf;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.6",
|
|
4
4
|
"description": "The Community plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"reselect": "^5.1.1",
|
|
45
|
-
"@mui/x-internals": "8.0.0-alpha.
|
|
45
|
+
"@mui/x-internals": "8.0.0-alpha.6"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@emotion/react": "^11.9.0",
|
package/utils/utils.d.ts
CHANGED
|
@@ -54,3 +54,4 @@ export declare function deepClone(obj: Record<string, any>): any;
|
|
|
54
54
|
* that hint disables checks on all values instead of just one.
|
|
55
55
|
*/
|
|
56
56
|
export declare function eslintUseValue(_: any): void;
|
|
57
|
+
export declare const runIf: (condition: boolean, fn: Function) => (params: unknown) => void;
|
package/utils/utils.js
CHANGED
|
@@ -196,4 +196,9 @@ export function deepClone(obj) {
|
|
|
196
196
|
* of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
|
|
197
197
|
* that hint disables checks on all values instead of just one.
|
|
198
198
|
*/
|
|
199
|
-
export function eslintUseValue(_) {}
|
|
199
|
+
export function eslintUseValue(_) {}
|
|
200
|
+
export const runIf = (condition, fn) => params => {
|
|
201
|
+
if (condition) {
|
|
202
|
+
fn(params);
|
|
203
|
+
}
|
|
204
|
+
};
|