@mui/x-data-grid 6.0.0-alpha.0 → 6.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +209 -0
- package/DataGrid/useDataGridProps.js +4 -4
- package/components/DataGridVirtualScroller.js +5 -3
- package/components/GridPagination.d.ts +43 -1
- package/components/GridPagination.js +1 -2
- package/components/GridRow.d.ts +1 -4
- package/components/GridRow.js +9 -8
- package/components/base/GridBody.js +1 -2
- package/components/base/GridOverlays.js +52 -12
- package/components/cell/GridBooleanCell.js +2 -1
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
- package/components/columnSelection/GridCellCheckboxRenderer.js +1 -6
- package/components/containers/GridOverlay.js +0 -5
- package/components/panel/filterPanel/GridFilterForm.js +2 -1
- package/components/toolbar/GridToolbarFilterButton.js +8 -4
- package/constants/gridClasses.d.ts +8 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +1 -1
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +18 -9
- package/hooks/features/editRows/useGridEditing.new.js +3 -2
- package/hooks/features/editRows/useGridEditing.old.js +2 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +18 -9
- package/hooks/features/export/useGridPrintExport.js +31 -17
- package/hooks/features/export/utils.js +1 -5
- package/hooks/features/filter/gridFilterSelector.js +2 -2
- package/hooks/features/filter/useGridFilter.js +6 -6
- package/hooks/features/pagination/gridPaginationSelector.js +2 -2
- package/hooks/features/rows/gridRowsInterfaces.d.ts +106 -0
- package/hooks/features/rows/{gridRowsState.js → gridRowsInterfaces.js} +0 -0
- package/hooks/features/rows/gridRowsSelector.d.ts +17 -7
- package/hooks/features/rows/gridRowsSelector.js +38 -6
- package/hooks/features/rows/gridRowsUtils.d.ts +16 -4
- package/hooks/features/rows/gridRowsUtils.js +222 -39
- package/hooks/features/rows/index.d.ts +3 -3
- package/hooks/features/rows/index.js +2 -2
- package/hooks/features/rows/useGridRows.js +161 -124
- package/hooks/features/rows/useGridRowsPreProcessors.js +78 -26
- package/hooks/features/selection/useGridSelection.js +2 -2
- package/hooks/features/sorting/gridSortingSelector.js +9 -4
- package/hooks/features/sorting/gridSortingState.d.ts +2 -2
- package/hooks/features/sorting/useGridSorting.js +9 -33
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +4 -7
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -17
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +1 -0
- package/legacy/DataGrid/useDataGridProps.js +4 -4
- package/legacy/components/DataGridVirtualScroller.js +5 -3
- package/legacy/components/GridPagination.js +1 -2
- package/legacy/components/GridRow.js +9 -8
- package/legacy/components/base/GridBody.js +1 -2
- package/legacy/components/base/GridOverlays.js +54 -12
- package/legacy/components/cell/GridBooleanCell.js +2 -1
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -6
- package/legacy/components/containers/GridOverlay.js +0 -5
- package/legacy/components/panel/filterPanel/GridFilterForm.js +2 -1
- package/legacy/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +18 -9
- package/legacy/hooks/features/editRows/useGridEditing.new.js +3 -2
- package/legacy/hooks/features/editRows/useGridEditing.old.js +2 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +18 -9
- package/legacy/hooks/features/export/useGridPrintExport.js +33 -20
- package/legacy/hooks/features/export/utils.js +1 -3
- package/legacy/hooks/features/filter/gridFilterSelector.js +2 -2
- package/legacy/hooks/features/filter/useGridFilter.js +6 -6
- package/legacy/hooks/features/pagination/gridPaginationSelector.js +2 -2
- package/legacy/hooks/features/rows/{gridRowsState.js → gridRowsInterfaces.js} +0 -0
- package/legacy/hooks/features/rows/gridRowsSelector.js +52 -9
- package/legacy/hooks/features/rows/gridRowsUtils.js +238 -46
- package/legacy/hooks/features/rows/index.js +2 -2
- package/legacy/hooks/features/rows/useGridRows.js +163 -134
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +81 -26
- package/legacy/hooks/features/selection/useGridSelection.js +2 -2
- package/legacy/hooks/features/sorting/gridSortingSelector.js +5 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +11 -33
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +11 -17
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/models/gridFeatureMode.js +1 -4
- package/models/api/gridParamsApi.d.ts +2 -2
- package/models/api/gridRowApi.d.ts +7 -5
- package/models/events/gridEventLookup.d.ts +3 -3
- package/models/gridApiCaches.d.ts +1 -1
- package/models/gridFeatureMode.d.ts +0 -4
- package/models/gridFeatureMode.js +1 -4
- package/models/gridRows.d.ts +100 -30
- package/models/gridSortModel.d.ts +2 -2
- package/models/params/gridCellParams.d.ts +7 -11
- package/modern/DataGrid/useDataGridProps.js +4 -4
- package/modern/components/DataGridVirtualScroller.js +5 -3
- package/modern/components/GridPagination.js +1 -2
- package/modern/components/GridRow.js +9 -8
- package/modern/components/base/GridBody.js +1 -2
- package/modern/components/base/GridOverlays.js +52 -12
- package/modern/components/cell/GridBooleanCell.js +2 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -6
- package/modern/components/containers/GridOverlay.js +0 -5
- package/modern/components/panel/filterPanel/GridFilterForm.js +2 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +1 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +18 -9
- package/modern/hooks/features/editRows/useGridEditing.new.js +3 -2
- package/modern/hooks/features/editRows/useGridEditing.old.js +2 -1
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +18 -9
- package/modern/hooks/features/export/useGridPrintExport.js +30 -16
- package/modern/hooks/features/export/utils.js +1 -1
- package/modern/hooks/features/filter/gridFilterSelector.js +2 -2
- package/modern/hooks/features/filter/useGridFilter.js +6 -6
- package/modern/hooks/features/pagination/gridPaginationSelector.js +2 -2
- package/modern/hooks/features/rows/{gridRowsState.js → gridRowsInterfaces.js} +0 -0
- package/modern/hooks/features/rows/gridRowsSelector.js +28 -6
- package/modern/hooks/features/rows/gridRowsUtils.js +220 -37
- package/modern/hooks/features/rows/index.js +2 -2
- package/modern/hooks/features/rows/useGridRows.js +158 -121
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +78 -26
- package/modern/hooks/features/selection/useGridSelection.js +2 -2
- package/modern/hooks/features/sorting/gridSortingSelector.js +3 -2
- package/modern/hooks/features/sorting/useGridSorting.js +9 -33
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +10 -16
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/models/gridFeatureMode.js +1 -4
- package/node/DataGrid/useDataGridProps.js +3 -3
- package/node/components/DataGridVirtualScroller.js +5 -3
- package/node/components/GridPagination.js +1 -2
- package/node/components/GridRow.js +9 -7
- package/node/components/base/GridBody.js +1 -3
- package/node/components/base/GridOverlays.js +57 -12
- package/node/components/cell/GridBooleanCell.js +3 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -6
- package/node/components/containers/GridOverlay.js +0 -5
- package/node/components/panel/filterPanel/GridFilterForm.js +2 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +8 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/node/hooks/features/editRows/useGridCellEditing.new.js +20 -10
- package/node/hooks/features/editRows/useGridEditing.new.js +4 -2
- package/node/hooks/features/editRows/useGridEditing.old.js +3 -1
- package/node/hooks/features/editRows/useGridRowEditing.new.js +20 -10
- package/node/hooks/features/export/useGridPrintExport.js +31 -17
- package/node/hooks/features/export/utils.js +1 -5
- package/node/hooks/features/filter/gridFilterSelector.js +1 -1
- package/node/hooks/features/filter/useGridFilter.js +5 -6
- package/node/hooks/features/pagination/gridPaginationSelector.js +1 -1
- package/node/hooks/features/rows/{gridRowsState.js → gridRowsInterfaces.js} +0 -0
- package/node/hooks/features/rows/gridRowsSelector.js +43 -10
- package/node/hooks/features/rows/gridRowsUtils.js +239 -40
- package/node/hooks/features/rows/index.js +23 -9
- package/node/hooks/features/rows/useGridRows.js +161 -122
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +81 -26
- package/node/hooks/features/selection/useGridSelection.js +2 -2
- package/node/hooks/features/sorting/gridSortingSelector.js +9 -4
- package/node/hooks/features/sorting/useGridSorting.js +9 -33
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -17
- package/node/index.js +1 -1
- package/node/internals/index.js +14 -2
- package/node/models/gridFeatureMode.js +1 -7
- package/package.json +1 -1
- package/themeAugmentation/props.d.ts +2 -2
- package/hooks/features/rows/gridRowsState.d.ts +0 -60
|
@@ -79,17 +79,12 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
79
79
|
}
|
|
80
80
|
}, [apiRef, props]);
|
|
81
81
|
|
|
82
|
-
if (rowNode.
|
|
82
|
+
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
83
83
|
return null;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
const isSelectable = apiRef.current.isRowSelectable(id);
|
|
87
87
|
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
88
|
-
|
|
89
|
-
if (rowNode.isPinned) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
88
|
return /*#__PURE__*/_jsx(rootProps.components.BaseCheckbox, _extends({
|
|
94
89
|
ref: handleRef,
|
|
95
90
|
tabIndex: tabIndex,
|
|
@@ -27,13 +27,8 @@ const GridOverlayRoot = styled('div', {
|
|
|
27
27
|
})(({
|
|
28
28
|
theme
|
|
29
29
|
}) => ({
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
top: 0,
|
|
32
|
-
zIndex: 4,
|
|
33
|
-
// should be above pinned columns, pinned rows and detail panel
|
|
34
30
|
width: '100%',
|
|
35
31
|
height: '100%',
|
|
36
|
-
pointerEvents: 'none',
|
|
37
32
|
display: 'flex',
|
|
38
33
|
alignSelf: 'center',
|
|
39
34
|
alignItems: 'center',
|
|
@@ -235,7 +235,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
235
235
|
}), [currentOperator]);
|
|
236
236
|
return /*#__PURE__*/_jsxs(GridFilterFormRoot, _extends({
|
|
237
237
|
ref: ref,
|
|
238
|
-
className: classes.root
|
|
238
|
+
className: classes.root,
|
|
239
|
+
"data-id": item.id
|
|
239
240
|
}, other, {
|
|
240
241
|
children: [/*#__PURE__*/_jsx(FilterFormDeleteIcon, _extends({
|
|
241
242
|
variant: "standard",
|
|
@@ -70,11 +70,15 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
70
70
|
return /*#__PURE__*/_jsxs("div", {
|
|
71
71
|
children: [apiRef.current.getLocaleText('toolbarFiltersTooltipActive')(activeFilters.length), /*#__PURE__*/_jsx(GridToolbarFilterListRoot, {
|
|
72
72
|
className: classes.root,
|
|
73
|
-
children: activeFilters.map((item, index) =>
|
|
74
|
-
|
|
73
|
+
children: activeFilters.map((item, index) => {
|
|
74
|
+
var _item$value;
|
|
75
|
+
|
|
76
|
+
return _extends({}, lookup[item.columnField] && /*#__PURE__*/_jsx("li", {
|
|
77
|
+
children: `${lookup[item.columnField].headerName || item.columnField}
|
|
75
78
|
${getOperatorLabel(item)}
|
|
76
|
-
${item.value}`
|
|
77
|
-
|
|
79
|
+
${(_item$value = item.value) != null ? _item$value : ''}`
|
|
80
|
+
}, index));
|
|
81
|
+
})
|
|
78
82
|
})]
|
|
79
83
|
});
|
|
80
84
|
}, [apiRef, preferencePanel.open, activeFilters, lookup, classes]);
|
|
@@ -315,6 +315,14 @@ export interface GridClasses {
|
|
|
315
315
|
* Styles applied to the menu list element.
|
|
316
316
|
*/
|
|
317
317
|
menuList: string;
|
|
318
|
+
/**
|
|
319
|
+
* Styles applied to the overlay wrapper element.
|
|
320
|
+
*/
|
|
321
|
+
overlayWrapper: string;
|
|
322
|
+
/**
|
|
323
|
+
* Styles applied to the overlay wrapper inner element.
|
|
324
|
+
*/
|
|
325
|
+
overlayWrapperInner: string;
|
|
318
326
|
/**
|
|
319
327
|
* Styles applied to the overlay element.
|
|
320
328
|
*/
|
|
@@ -4,7 +4,7 @@ import { GridInitialStateCommunity } from '../../../models/gridStateCommunity';
|
|
|
4
4
|
import { GridExportStateParams, GridRestoreStatePreProcessingContext, GridRestoreStatePreProcessingValue } from '../../features/statePersistence/gridStatePersistenceInterface';
|
|
5
5
|
import { GridHydrateColumnsValue } from '../../features/columns/gridColumnsInterfaces';
|
|
6
6
|
import { GridRowEntry, GridRowId } from '../../../models/gridRows';
|
|
7
|
-
import { GridHydrateRowsValue } from '../../features/rows/
|
|
7
|
+
import { GridHydrateRowsValue } from '../../features/rows/gridRowsInterfaces';
|
|
8
8
|
import { GridPreferencePanelsValue } from '../../features/preferencesPanel';
|
|
9
9
|
export declare type GridPipeProcessorGroup = keyof GridPipeProcessingLookup;
|
|
10
10
|
export interface GridPipeProcessingLookup {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridRowTreeCreationParams, GridRowTreeCreationValue } from '../../features/rows/
|
|
1
|
+
import { GridRowTreeCreationParams, GridRowTreeCreationValue } from '../../features/rows/gridRowsInterfaces';
|
|
2
2
|
import { GridFilteringMethodParams, GridFilteringMethodValue } from '../../features/filter/gridFilterState';
|
|
3
3
|
import { GridSortingMethodParams, GridSortingMethodValue } from '../../features/sorting/gridSortingState';
|
|
4
4
|
export declare type GridStrategyProcessorName = keyof GridStrategyProcessingLookup;
|
|
@@ -238,7 +238,7 @@ export const useGridColumnHeaders = props => {
|
|
|
238
238
|
|
|
239
239
|
const columnsToRender = getColumnsToRender(params);
|
|
240
240
|
|
|
241
|
-
if (columnsToRender == null) {
|
|
241
|
+
if (columnsToRender == null || columnsToRender.renderedColumns.length === 0) {
|
|
242
242
|
return null;
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -4,13 +4,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
const _excluded = ["id", "field"],
|
|
5
5
|
_excluded2 = ["id", "field"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
+
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
7
8
|
import { useGridApiEventHandler, useGridApiOptionHandler, GridSignature } from '../../utils/useGridApiEventHandler';
|
|
8
9
|
import { GridEditModes, GridCellModes } from '../../../models/gridEditRowModel';
|
|
9
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
10
11
|
import { gridEditRowsStateSelector } from './gridEditRowsSelector';
|
|
11
12
|
import { isPrintableKey } from '../../../utils/keyboardUtils';
|
|
12
13
|
import { buildWarning } from '../../../utils/warning';
|
|
13
|
-
import {
|
|
14
|
+
import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
|
|
14
15
|
import { deepClone } from '../../../utils/utils';
|
|
15
16
|
import { GridCellEditStartReasons, GridCellEditStopReasons } from '../../../models/params/gridEditCellParams';
|
|
16
17
|
const missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see http://mui.com/components/data-grid/editing/#persistence.'], 'error');
|
|
@@ -103,6 +104,10 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
103
104
|
} else if (params.isEditable) {
|
|
104
105
|
let reason;
|
|
105
106
|
|
|
107
|
+
if (event.key === ' ' && event.shiftKey) {
|
|
108
|
+
return; // Shift + Space is used to select the row
|
|
109
|
+
}
|
|
110
|
+
|
|
106
111
|
if (isPrintableKey(event)) {
|
|
107
112
|
reason = GridCellEditStartReasons.printableKeyDown;
|
|
108
113
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
@@ -185,7 +190,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
185
190
|
const isEditing = editingState[id] && editingState[id][field];
|
|
186
191
|
return isEditing ? GridCellModes.Edit : GridCellModes.View;
|
|
187
192
|
}, [apiRef]);
|
|
188
|
-
const updateCellModesModel =
|
|
193
|
+
const updateCellModesModel = useEventCallback(newModel => {
|
|
189
194
|
const isNewModelDifferentFromProp = newModel !== props.cellModesModel;
|
|
190
195
|
|
|
191
196
|
if (onCellModesModelChange && isNewModelDifferentFromProp) {
|
|
@@ -202,7 +207,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
202
207
|
setCellModesModel(newModel);
|
|
203
208
|
cellModesModelRef.current = newModel;
|
|
204
209
|
apiRef.current.publishEvent('cellModesModelChange', newModel);
|
|
205
|
-
}
|
|
210
|
+
});
|
|
206
211
|
const updateFieldInCellModesModel = React.useCallback((id, field, newProps) => {
|
|
207
212
|
// We use the ref because it always contain the up-to-date value, different from the state
|
|
208
213
|
// that needs a rerender to reflect the new value
|
|
@@ -261,7 +266,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
261
266
|
mode: GridCellModes.Edit
|
|
262
267
|
}, other));
|
|
263
268
|
}, [throwIfNotEditable, throwIfNotInMode, updateFieldInCellModesModel]);
|
|
264
|
-
const updateStateToStartCellEditMode =
|
|
269
|
+
const updateStateToStartCellEditMode = useEventCallback(params => {
|
|
265
270
|
const {
|
|
266
271
|
id,
|
|
267
272
|
field,
|
|
@@ -274,7 +279,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
274
279
|
};
|
|
275
280
|
updateOrDeleteFieldState(id, field, newProps);
|
|
276
281
|
apiRef.current.setCellFocus(id, field);
|
|
277
|
-
}
|
|
282
|
+
});
|
|
278
283
|
const stopCellEditMode = React.useCallback(params => {
|
|
279
284
|
const {
|
|
280
285
|
id,
|
|
@@ -287,7 +292,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
287
292
|
mode: GridCellModes.View
|
|
288
293
|
}, other));
|
|
289
294
|
}, [throwIfNotInMode, updateFieldInCellModesModel]);
|
|
290
|
-
const updateStateToStopCellEditMode =
|
|
295
|
+
const updateStateToStopCellEditMode = useEventCallback(async params => {
|
|
291
296
|
const {
|
|
292
297
|
id,
|
|
293
298
|
field,
|
|
@@ -332,7 +337,11 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
332
337
|
|
|
333
338
|
if (processRowUpdate) {
|
|
334
339
|
const handleError = errorThrown => {
|
|
335
|
-
prevCellModesModel.current[id][field].mode = GridCellModes.Edit;
|
|
340
|
+
prevCellModesModel.current[id][field].mode = GridCellModes.Edit; // Revert the mode in the cellModesModel prop back to "edit"
|
|
341
|
+
|
|
342
|
+
updateFieldInCellModesModel(id, field, {
|
|
343
|
+
mode: GridCellModes.Edit
|
|
344
|
+
});
|
|
336
345
|
|
|
337
346
|
if (onProcessRowUpdateError) {
|
|
338
347
|
onProcessRowUpdateError(errorThrown);
|
|
@@ -354,7 +363,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
354
363
|
apiRef.current.updateRows([rowUpdate]);
|
|
355
364
|
finishCellEditMode();
|
|
356
365
|
}
|
|
357
|
-
}
|
|
366
|
+
});
|
|
358
367
|
const setCellEditingEditCellValue = React.useCallback(async params => {
|
|
359
368
|
var _editingState$id, _editingState$id$fiel;
|
|
360
369
|
|
|
@@ -442,7 +451,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
442
451
|
}
|
|
443
452
|
}, [cellModesModelProp, updateCellModesModel]);
|
|
444
453
|
React.useEffect(() => {
|
|
445
|
-
const idToIdLookup =
|
|
454
|
+
const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef); // Update the ref here because updateStateToStopCellEditMode may change it later
|
|
446
455
|
|
|
447
456
|
const copyOfPrevCellModes = prevCellModesModel.current;
|
|
448
457
|
prevCellModesModel.current = deepClone(cellModesModel); // Do a deep-clone because the attributes might be changed later
|
|
@@ -5,6 +5,7 @@ import { useGridCellEditing } from './useGridCellEditing.new';
|
|
|
5
5
|
import { GridCellModes, GridEditModes } from '../../../models/gridEditRowModel';
|
|
6
6
|
import { useGridRowEditing } from './useGridRowEditing.new';
|
|
7
7
|
import { gridEditRowsStateSelector } from './gridEditRowsSelector';
|
|
8
|
+
import { isAutoGeneratedRow } from '../rows/gridRowsUtils';
|
|
8
9
|
export const editingStateInitializer = state => _extends({}, state, {
|
|
9
10
|
editRows: {}
|
|
10
11
|
});
|
|
@@ -16,7 +17,7 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
16
17
|
isCellEditable: isCellEditableProp
|
|
17
18
|
} = props;
|
|
18
19
|
const isCellEditable = React.useCallback(params => {
|
|
19
|
-
if (params.rowNode
|
|
20
|
+
if (isAutoGeneratedRow(params.rowNode)) {
|
|
20
21
|
return false;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -32,7 +33,7 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
32
33
|
return isCellEditableProp(params);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
if (params.rowNode.
|
|
36
|
+
if (params.rowNode.type === 'pinnedRow') {
|
|
36
37
|
return false;
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -7,6 +7,7 @@ import { useGridLogger } from '../../utils/useGridLogger';
|
|
|
7
7
|
import { gridEditRowsStateSelector } from './gridEditRowsSelector';
|
|
8
8
|
import { useCellEditing } from './useGridCellEditing.old';
|
|
9
9
|
import { useGridRowEditing } from './useGridRowEditing.old';
|
|
10
|
+
import { isAutoGeneratedRow } from '../rows/gridRowsUtils';
|
|
10
11
|
export const editingStateInitializer = state => _extends({}, state, {
|
|
11
12
|
editRows: {}
|
|
12
13
|
});
|
|
@@ -30,7 +31,7 @@ export function useGridEditing(apiRef, props) {
|
|
|
30
31
|
stateSelector: gridEditRowsStateSelector,
|
|
31
32
|
changeEvent: 'editRowsModelChange'
|
|
32
33
|
});
|
|
33
|
-
const isCellEditable = React.useCallback(params => !params.rowNode
|
|
34
|
+
const isCellEditable = React.useCallback(params => !isAutoGeneratedRow(params.rowNode) && params.rowNode.type !== 'pinnedRow' && !!params.colDef.editable && !!params.colDef.renderEditCell && (!props.isCellEditable || props.isCellEditable(params)), // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
35
|
[props.isCellEditable]);
|
|
35
36
|
|
|
36
37
|
const maybeDebounce = (id, field, debounceMs, callback) => {
|
|
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
const _excluded = ["id"],
|
|
5
5
|
_excluded2 = ["id"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
+
import { unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
7
8
|
import { useGridApiEventHandler, useGridApiOptionHandler, GridSignature } from '../../utils/useGridApiEventHandler';
|
|
8
9
|
import { GridEditModes, GridRowModes } from '../../../models/gridEditRowModel';
|
|
9
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -11,7 +12,7 @@ import { gridEditRowsStateSelector } from './gridEditRowsSelector';
|
|
|
11
12
|
import { isPrintableKey } from '../../../utils/keyboardUtils';
|
|
12
13
|
import { gridColumnFieldsSelector } from '../columns/gridColumnsSelector';
|
|
13
14
|
import { buildWarning } from '../../../utils/warning';
|
|
14
|
-
import {
|
|
15
|
+
import { gridRowsDataRowIdToIdLookupSelector } from '../rows/gridRowsSelector';
|
|
15
16
|
import { deepClone } from '../../../utils/utils';
|
|
16
17
|
import { GridRowEditStopReasons, GridRowEditStartReasons } from '../../../models/params/gridRowParams';
|
|
17
18
|
const missingOnProcessRowUpdateErrorWarning = buildWarning(['MUI: A call to `processRowUpdate` threw an error which was not handled because `onProcessRowUpdateError` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError` prop, e.g. `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see http://mui.com/components/data-grid/editing/#persistence.'], 'error');
|
|
@@ -160,6 +161,10 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
160
161
|
} else if (params.isEditable) {
|
|
161
162
|
let reason;
|
|
162
163
|
|
|
164
|
+
if (event.key === ' ' && event.shiftKey) {
|
|
165
|
+
return; // Shift + Space is used to select the row
|
|
166
|
+
}
|
|
167
|
+
|
|
163
168
|
if (isPrintableKey(event)) {
|
|
164
169
|
reason = GridRowEditStartReasons.printableKeyDown;
|
|
165
170
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
@@ -252,7 +257,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
252
257
|
const isEditing = editingState[id] && Object.keys(editingState[id]).length > 0;
|
|
253
258
|
return isEditing ? GridRowModes.Edit : GridRowModes.View;
|
|
254
259
|
}, [apiRef, props.editMode]);
|
|
255
|
-
const updateRowModesModel =
|
|
260
|
+
const updateRowModesModel = useEventCallback(newModel => {
|
|
256
261
|
const isNewModelDifferentFromProp = newModel !== props.rowModesModel;
|
|
257
262
|
|
|
258
263
|
if (onRowModesModelChange && isNewModelDifferentFromProp) {
|
|
@@ -269,7 +274,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
269
274
|
setRowModesModel(newModel);
|
|
270
275
|
rowModesModelRef.current = newModel;
|
|
271
276
|
apiRef.current.publishEvent('rowModesModelChange', newModel);
|
|
272
|
-
}
|
|
277
|
+
});
|
|
273
278
|
const updateRowInRowModesModel = React.useCallback((id, newProps) => {
|
|
274
279
|
const newModel = _extends({}, rowModesModelRef.current);
|
|
275
280
|
|
|
@@ -330,7 +335,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
330
335
|
mode: GridRowModes.Edit
|
|
331
336
|
}, other));
|
|
332
337
|
}, [throwIfNotInMode, updateRowInRowModesModel]);
|
|
333
|
-
const updateStateToStartRowEditMode =
|
|
338
|
+
const updateStateToStartRowEditMode = useEventCallback(params => {
|
|
334
339
|
const {
|
|
335
340
|
id,
|
|
336
341
|
fieldToFocus,
|
|
@@ -357,7 +362,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
357
362
|
if (fieldToFocus) {
|
|
358
363
|
apiRef.current.setCellFocus(id, fieldToFocus);
|
|
359
364
|
}
|
|
360
|
-
}
|
|
365
|
+
});
|
|
361
366
|
const stopRowEditMode = React.useCallback(params => {
|
|
362
367
|
const {
|
|
363
368
|
id
|
|
@@ -369,7 +374,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
369
374
|
mode: GridRowModes.View
|
|
370
375
|
}, other));
|
|
371
376
|
}, [throwIfNotInMode, updateRowInRowModesModel]);
|
|
372
|
-
const updateStateToStopRowEditMode =
|
|
377
|
+
const updateStateToStopRowEditMode = useEventCallback(params => {
|
|
373
378
|
const {
|
|
374
379
|
id,
|
|
375
380
|
ignoreModifications,
|
|
@@ -416,7 +421,11 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
416
421
|
|
|
417
422
|
if (processRowUpdate) {
|
|
418
423
|
const handleError = errorThrown => {
|
|
419
|
-
prevRowModesModel.current[id].mode = GridRowModes.Edit;
|
|
424
|
+
prevRowModesModel.current[id].mode = GridRowModes.Edit; // Revert the mode in the rowModesModel prop back to "edit"
|
|
425
|
+
|
|
426
|
+
updateRowInRowModesModel(id, {
|
|
427
|
+
mode: GridRowModes.Edit
|
|
428
|
+
});
|
|
420
429
|
|
|
421
430
|
if (onProcessRowUpdateError) {
|
|
422
431
|
onProcessRowUpdateError(errorThrown);
|
|
@@ -437,7 +446,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
437
446
|
apiRef.current.updateRows([rowUpdate]);
|
|
438
447
|
finishRowEditMode();
|
|
439
448
|
}
|
|
440
|
-
}
|
|
449
|
+
});
|
|
441
450
|
const setRowEditingEditCellValue = React.useCallback(params => {
|
|
442
451
|
const {
|
|
443
452
|
id,
|
|
@@ -591,7 +600,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
591
600
|
}
|
|
592
601
|
}, [rowModesModelProp, updateRowModesModel]);
|
|
593
602
|
React.useEffect(() => {
|
|
594
|
-
const idToIdLookup =
|
|
603
|
+
const idToIdLookup = gridRowsDataRowIdToIdLookupSelector(apiRef); // Update the ref here because updateStateToStopRowEditMode may change it later
|
|
595
604
|
|
|
596
605
|
const copyOfPrevRowModesModel = prevRowModesModel.current;
|
|
597
606
|
prevRowModesModel.current = deepClone(rowModesModel); // Do a deep-clone because the attributes might be changed later
|
|
@@ -13,6 +13,14 @@ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
|
13
13
|
import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
|
|
16
|
+
function raf() {
|
|
17
|
+
return new Promise(resolve => {
|
|
18
|
+
requestAnimationFrame(() => {
|
|
19
|
+
resolve();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
25
|
* @requires useGridColumns (state)
|
|
18
26
|
* @requires useGridFilter (state)
|
|
@@ -30,6 +38,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
30
38
|
// the new state needs to be in place before the grid can be sized correctly
|
|
31
39
|
|
|
32
40
|
const updateGridColumnsForPrint = React.useCallback((fields, allColumns) => new Promise(resolve => {
|
|
41
|
+
// TODO remove unused Promise
|
|
33
42
|
if (!fields && !allColumns) {
|
|
34
43
|
resolve();
|
|
35
44
|
return;
|
|
@@ -49,12 +58,10 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
49
58
|
});
|
|
50
59
|
apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
|
|
51
60
|
resolve();
|
|
52
|
-
}), [apiRef]);
|
|
61
|
+
}), [apiRef]); // TODO move outside of this scope and remove React.useCallback
|
|
62
|
+
|
|
53
63
|
const buildPrintWindow = React.useCallback(title => {
|
|
54
64
|
const iframeEl = document.createElement('iframe');
|
|
55
|
-
iframeEl.id = 'grid-print-window'; // Without this 'onload' event won't fire in some browsers
|
|
56
|
-
|
|
57
|
-
iframeEl.src = window.location.href;
|
|
58
65
|
iframeEl.style.position = 'absolute';
|
|
59
66
|
iframeEl.style.width = '0px';
|
|
60
67
|
iframeEl.style.height = '0px';
|
|
@@ -62,18 +69,15 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
62
69
|
return iframeEl;
|
|
63
70
|
}, []);
|
|
64
71
|
const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
|
|
65
|
-
var
|
|
72
|
+
var _querySelector, _querySelector2;
|
|
66
73
|
|
|
67
74
|
const normalizeOptions = _extends({
|
|
68
75
|
copyStyles: true,
|
|
69
76
|
hideToolbar: false,
|
|
70
77
|
hideFooter: false
|
|
71
|
-
}, options);
|
|
72
|
-
// `onload` callback. This ensures that it is only called once.
|
|
78
|
+
}, options);
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
printWindow.onload = null;
|
|
76
|
-
const printDoc = printWindow.contentDocument || ((_printWindow$contentW = printWindow.contentWindow) == null ? void 0 : _printWindow$contentW.document);
|
|
80
|
+
const printDoc = printWindow.contentDocument;
|
|
77
81
|
|
|
78
82
|
if (!printDoc) {
|
|
79
83
|
return;
|
|
@@ -113,10 +117,12 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
113
117
|
} // Expand container height to accommodate all rows
|
|
114
118
|
|
|
115
119
|
|
|
116
|
-
gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; //
|
|
120
|
+
gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
|
|
121
|
+
// prevents us to do it
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
const container = document.createElement('div');
|
|
124
|
+
container.appendChild(gridClone);
|
|
125
|
+
printDoc.body.innerHTML = container.innerHTML;
|
|
120
126
|
const defaultPageStyle = typeof normalizeOptions.pageStyle === 'function' ? normalizeOptions.pageStyle() : normalizeOptions.pageStyle;
|
|
121
127
|
|
|
122
128
|
if (typeof defaultPageStyle === 'string') {
|
|
@@ -210,17 +216,25 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
210
216
|
|
|
211
217
|
await updateGridColumnsForPrint(options == null ? void 0 : options.fields, options == null ? void 0 : options.allColumns);
|
|
212
218
|
apiRef.current.unstable_disableVirtualization();
|
|
219
|
+
await raf(); // wait for the state changes to take action
|
|
220
|
+
|
|
213
221
|
const printWindow = buildPrintWindow(options == null ? void 0 : options.fileName);
|
|
214
|
-
doc.current.body.appendChild(printWindow);
|
|
215
222
|
|
|
216
223
|
if (process.env.NODE_ENV === 'test') {
|
|
217
|
-
// In test env, run the all pipeline without waiting for loading
|
|
224
|
+
doc.current.body.appendChild(printWindow); // In test env, run the all pipeline without waiting for loading
|
|
225
|
+
|
|
218
226
|
handlePrintWindowLoad(printWindow, options);
|
|
219
227
|
handlePrintWindowAfterPrint(printWindow);
|
|
220
228
|
} else {
|
|
221
|
-
printWindow.onload = () =>
|
|
229
|
+
printWindow.onload = () => {
|
|
230
|
+
handlePrintWindowLoad(printWindow, options);
|
|
231
|
+
|
|
232
|
+
printWindow.contentWindow.onafterprint = () => {
|
|
233
|
+
handlePrintWindowAfterPrint(printWindow);
|
|
234
|
+
};
|
|
235
|
+
};
|
|
222
236
|
|
|
223
|
-
|
|
237
|
+
doc.current.body.appendChild(printWindow);
|
|
224
238
|
}
|
|
225
239
|
}, [props, logger, apiRef, buildPrintWindow, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
226
240
|
const printExportApi = {
|
|
@@ -22,11 +22,7 @@ export const defaultGetRowsToExport = ({
|
|
|
22
22
|
const filteredSortedRowIds = gridFilteredSortedRowIdsSelector(apiRef);
|
|
23
23
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
24
24
|
const selectedRows = apiRef.current.getSelectedRows();
|
|
25
|
-
const bodyRows = filteredSortedRowIds.filter(id =>
|
|
26
|
-
var _rowTree$id$position;
|
|
27
|
-
|
|
28
|
-
return ((_rowTree$id$position = rowTree[id].position) != null ? _rowTree$id$position : 'body') === 'body';
|
|
29
|
-
});
|
|
25
|
+
const bodyRows = filteredSortedRowIds.filter(id => rowTree[id].type !== 'footer');
|
|
30
26
|
const pinnedRows = gridPinnedRowsSelector(apiRef);
|
|
31
27
|
const topPinnedRowsIds = (pinnedRows == null ? void 0 : (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.map(row => row.id)) || [];
|
|
32
28
|
const bottomPinnedRowsIds = (pinnedRows == null ? void 0 : (_pinnedRows$bottom = pinnedRows.bottom) == null ? void 0 : _pinnedRows$bottom.map(row => row.id)) || [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSelector } from '../../../utils/createSelector';
|
|
2
2
|
import { gridSortedRowEntriesSelector } from '../sorting/gridSortingSelector';
|
|
3
3
|
import { gridColumnLookupSelector } from '../columns/gridColumnsSelector';
|
|
4
|
-
import {
|
|
4
|
+
import { gridRowMaximumTreeDepthSelector, gridRowTreeSelector } from '../rows/gridRowsSelector';
|
|
5
5
|
/**
|
|
6
6
|
* @category Filtering
|
|
7
7
|
*/
|
|
@@ -78,7 +78,7 @@ export const gridVisibleRowsSelector = gridVisibleSortedRowIdsSelector;
|
|
|
78
78
|
* @category Filtering
|
|
79
79
|
*/
|
|
80
80
|
|
|
81
|
-
export const gridVisibleSortedTopLevelRowEntriesSelector = createSelector(gridVisibleSortedRowEntriesSelector, gridRowTreeSelector,
|
|
81
|
+
export const gridVisibleSortedTopLevelRowEntriesSelector = createSelector(gridVisibleSortedRowEntriesSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, (visibleSortedRows, rowTree, rowTreeDepth) => {
|
|
82
82
|
if (rowTreeDepth < 2) {
|
|
83
83
|
return visibleSortedRows;
|
|
84
84
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { GridFeatureModeConstant } from '../../../models/gridFeatureMode';
|
|
4
3
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
5
4
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
5
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
@@ -9,7 +8,7 @@ import { GridPreferencePanelsValue } from '../preferencesPanel/gridPreferencePan
|
|
|
9
8
|
import { getDefaultGridFilterModel } from './gridFilterState';
|
|
10
9
|
import { gridFilterModelSelector, gridVisibleSortedRowEntriesSelector } from './gridFilterSelector';
|
|
11
10
|
import { useFirstRender } from '../../utils/useFirstRender';
|
|
12
|
-
import {
|
|
11
|
+
import { GRID_ROOT_GROUP_ID, gridRowTreeSelector } from '../rows';
|
|
13
12
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
14
13
|
import { GRID_DEFAULT_STRATEGY, useGridRegisterStrategyProcessor } from '../../core/strategyProcessing';
|
|
15
14
|
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem, passFilterLogic } from './gridFilterUtils';
|
|
@@ -47,7 +46,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
47
46
|
const updateFilteredRows = React.useCallback(() => {
|
|
48
47
|
apiRef.current.setState(state => {
|
|
49
48
|
const filterModel = gridFilterModelSelector(state, apiRef.current.instanceId);
|
|
50
|
-
const isRowMatchingFilters = props.filterMode ===
|
|
49
|
+
const isRowMatchingFilters = props.filterMode === 'client' ? buildAggregatedFilterApplier(filterModel, apiRef) : null;
|
|
51
50
|
const filteringResult = apiRef.current.unstable_applyStrategyProcessor('filtering', {
|
|
52
51
|
isRowMatchingFilters,
|
|
53
52
|
filterModel: filterModel != null ? filterModel : getDefaultGridFilterModel()
|
|
@@ -256,8 +255,9 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
256
255
|
return initialValue;
|
|
257
256
|
}, [props.components.FilterPanel, (_props$componentsProp2 = props.componentsProps) == null ? void 0 : _props$componentsProp2.filterPanel]);
|
|
258
257
|
const flatFilteringMethod = React.useCallback(params => {
|
|
259
|
-
if (props.filterMode ===
|
|
260
|
-
const
|
|
258
|
+
if (props.filterMode === 'client' && params.isRowMatchingFilters) {
|
|
259
|
+
const tree = gridRowTreeSelector(apiRef);
|
|
260
|
+
const rowIds = tree[GRID_ROOT_GROUP_ID].children;
|
|
261
261
|
const filteredRowsLookup = {};
|
|
262
262
|
|
|
263
263
|
for (let i = 0; i < rowIds.length; i += 1) {
|
|
@@ -279,7 +279,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
279
279
|
|
|
280
280
|
return {
|
|
281
281
|
filteredRowsLookup,
|
|
282
|
-
// For flat tree, the `visibleRowsLookup` and the `filteredRowsLookup` since no row is collapsed.
|
|
282
|
+
// For flat tree, the `visibleRowsLookup` and the `filteredRowsLookup` are equals since no row is collapsed.
|
|
283
283
|
visibleRowsLookup: filteredRowsLookup,
|
|
284
284
|
filteredDescendantCountLookup: {}
|
|
285
285
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSelector } from '../../../utils/createSelector';
|
|
2
2
|
import { gridVisibleSortedRowEntriesSelector, gridVisibleSortedRowIdsSelector, gridVisibleSortedTopLevelRowEntriesSelector } from '../filter/gridFilterSelector';
|
|
3
|
-
import {
|
|
3
|
+
import { gridRowMaximumTreeDepthSelector, gridRowTreeSelector } from '../rows/gridRowsSelector';
|
|
4
4
|
/**
|
|
5
5
|
* @category Pagination
|
|
6
6
|
* @ignore - do not document.
|
|
@@ -30,7 +30,7 @@ export const gridPageCountSelector = createSelector(gridPaginationSelector, pagi
|
|
|
30
30
|
* @category Pagination
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
export const gridPaginationRowRangeSelector = createSelector(gridPaginationSelector, gridRowTreeSelector,
|
|
33
|
+
export const gridPaginationRowRangeSelector = createSelector(gridPaginationSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, gridVisibleSortedRowEntriesSelector, gridVisibleSortedTopLevelRowEntriesSelector, (pagination, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {
|
|
34
34
|
const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;
|
|
35
35
|
const topLevelFirstRowIndex = Math.min(pagination.pageSize * pagination.page, visibleTopLevelRowCount - 1);
|
|
36
36
|
const topLevelLastRowIndex = Math.min(topLevelFirstRowIndex + pagination.pageSize - 1, visibleTopLevelRowCount - 1); // The range contains no element
|