@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
|
@@ -1,17 +1,17 @@
|
|
|
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 { isEnterKey } from '../../../utils/keyboardUtils';
|
|
5
4
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
6
5
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
7
6
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
8
7
|
import { gridColumnLookupSelector } from '../columns/gridColumnsSelector';
|
|
9
8
|
import { gridSortedRowEntriesSelector, gridSortedRowIdsSelector, gridSortModelSelector } from './gridSortingSelector';
|
|
10
|
-
import {
|
|
9
|
+
import { GRID_ROOT_GROUP_ID, gridRowTreeSelector } from '../rows';
|
|
11
10
|
import { useFirstRender } from '../../utils/useFirstRender';
|
|
12
11
|
import { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from '../../core/strategyProcessing';
|
|
13
12
|
import { buildAggregatedSortingApplier, mergeStateWithSortModel, getNextGridSortDirection, sanitizeSortModel } from './gridSortingUtils';
|
|
14
13
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
14
|
+
import { getTreeNodeDescendants } from '../rows/gridRowsUtils';
|
|
15
15
|
export const sortingStateInitializer = (state, props) => {
|
|
16
16
|
var _ref, _props$sortModel, _props$initialState, _props$initialState$s;
|
|
17
17
|
|
|
@@ -82,11 +82,11 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
82
82
|
|
|
83
83
|
const applySorting = React.useCallback(() => {
|
|
84
84
|
apiRef.current.setState(state => {
|
|
85
|
-
if (props.sortingMode ===
|
|
85
|
+
if (props.sortingMode === 'server') {
|
|
86
86
|
logger.debug('Skipping sorting rows as sortingMode = server');
|
|
87
87
|
return _extends({}, state, {
|
|
88
88
|
sorting: _extends({}, state.sorting, {
|
|
89
|
-
sortedRows:
|
|
89
|
+
sortedRows: getTreeNodeDescendants(gridRowTreeSelector(apiRef), GRID_ROOT_GROUP_ID, false)
|
|
90
90
|
})
|
|
91
91
|
});
|
|
92
92
|
}
|
|
@@ -190,38 +190,14 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
190
190
|
}, [apiRef, props.disableMultipleColumnsSorting]);
|
|
191
191
|
const flatSortingMethod = React.useCallback(params => {
|
|
192
192
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
193
|
+
const rootGroupNode = rowTree[GRID_ROOT_GROUP_ID];
|
|
194
|
+
const sortedChildren = params.sortRowList ? params.sortRowList(rootGroupNode.children.map(childId => rowTree[childId])) : [...rootGroupNode.children];
|
|
193
195
|
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
const footerRowIds = [];
|
|
197
|
-
gridRowIdsSelector(apiRef).forEach(rowId => {
|
|
198
|
-
if (rowTree[rowId].isPinned) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (rowTree[rowId].position === 'footer') {
|
|
203
|
-
footerRowIds.push(rowId);
|
|
204
|
-
} else {
|
|
205
|
-
bodyRowIds.push(rowId);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
return [...bodyRowIds, ...footerRowIds];
|
|
196
|
+
if (rootGroupNode.footerId != null) {
|
|
197
|
+
sortedChildren.push(rootGroupNode.footerId);
|
|
209
198
|
}
|
|
210
199
|
|
|
211
|
-
|
|
212
|
-
const footerRowIds = [];
|
|
213
|
-
Object.values(rowTree).forEach(rowNode => {
|
|
214
|
-
if (rowNode.isPinned) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (rowNode.position === 'footer') {
|
|
219
|
-
footerRowIds.push(rowNode.id);
|
|
220
|
-
} else {
|
|
221
|
-
bodyRows.push(rowNode);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
return [...params.sortRowList(bodyRows), ...footerRowIds];
|
|
200
|
+
return sortedChildren;
|
|
225
201
|
}, [apiRef]);
|
|
226
202
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
227
203
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
@@ -45,6 +45,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
45
45
|
alignItems?: import("csstype").Property.AlignItems | undefined;
|
|
46
46
|
alignSelf?: import("csstype").Property.AlignSelf | undefined;
|
|
47
47
|
alignTracks?: import("csstype").Property.AlignTracks | undefined;
|
|
48
|
+
animationComposition?: import("csstype").Property.AnimationComposition | undefined;
|
|
48
49
|
animationDelay?: import("csstype").Property.AnimationDelay<string & {}> | undefined;
|
|
49
50
|
animationDirection?: import("csstype").Property.AnimationDirection | undefined;
|
|
50
51
|
animationDuration?: import("csstype").Property.AnimationDuration<string & {}> | undefined;
|
|
@@ -240,6 +241,8 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
240
241
|
maskRepeat?: import("csstype").Property.MaskRepeat | undefined;
|
|
241
242
|
maskSize?: import("csstype").Property.MaskSize<string | number> | undefined;
|
|
242
243
|
maskType?: import("csstype").Property.MaskType | undefined;
|
|
244
|
+
mathDepth?: import("csstype").Property.MathDepth | undefined;
|
|
245
|
+
mathShift?: import("csstype").Property.MathShift | undefined;
|
|
243
246
|
mathStyle?: import("csstype").Property.MathStyle | undefined;
|
|
244
247
|
maxBlockSize?: import("csstype").Property.MaxBlockSize<string | number> | undefined;
|
|
245
248
|
maxHeight?: import("csstype").Property.MaxHeight<string | number> | undefined;
|
|
@@ -357,7 +360,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
357
360
|
textDecorationSkipInk?: import("csstype").Property.TextDecorationSkipInk | undefined;
|
|
358
361
|
textDecorationStyle?: import("csstype").Property.TextDecorationStyle | undefined;
|
|
359
362
|
textDecorationThickness?: import("csstype").Property.TextDecorationThickness<string | number> | undefined;
|
|
360
|
-
textDecorationWidth?: import("csstype").Property.TextDecorationThickness<string | number> | undefined;
|
|
361
363
|
textEmphasisColor?: import("csstype").Property.TextEmphasisColor | undefined;
|
|
362
364
|
textEmphasisPosition?: import("csstype").Property.TextEmphasisPosition | undefined;
|
|
363
365
|
textEmphasisStyle?: import("csstype").Property.TextEmphasisStyle | undefined;
|
|
@@ -465,7 +467,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
465
467
|
MozBoxSizing?: import("csstype").Property.BoxSizing | undefined;
|
|
466
468
|
MozColumnCount?: import("csstype").Property.ColumnCount | undefined;
|
|
467
469
|
MozColumnFill?: import("csstype").Property.ColumnFill | undefined;
|
|
468
|
-
MozColumnGap?: import("csstype").Property.ColumnGap<string | number> | undefined;
|
|
469
470
|
MozColumnRuleColor?: import("csstype").Property.ColumnRuleColor | undefined;
|
|
470
471
|
MozColumnRuleStyle?: import("csstype").Property.ColumnRuleStyle | undefined;
|
|
471
472
|
MozColumnRuleWidth?: import("csstype").Property.ColumnRuleWidth<string | number> | undefined;
|
|
@@ -499,7 +500,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
499
500
|
MozWindowDragging?: import("csstype").Property.MozWindowDragging | undefined;
|
|
500
501
|
MozWindowShadow?: import("csstype").Property.MozWindowShadow | undefined;
|
|
501
502
|
msAccelerator?: import("csstype").Property.MsAccelerator | undefined;
|
|
502
|
-
msAlignSelf?: import("csstype").Property.AlignSelf | undefined;
|
|
503
503
|
msBlockProgression?: import("csstype").Property.MsBlockProgression | undefined;
|
|
504
504
|
msContentZoomChaining?: import("csstype").Property.MsContentZoomChaining | undefined;
|
|
505
505
|
msContentZoomLimitMax?: import("csstype").Property.MsContentZoomLimitMax | undefined;
|
|
@@ -520,7 +520,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
520
520
|
msHyphenateLimitZone?: import("csstype").Property.MsHyphenateLimitZone<string | number> | undefined;
|
|
521
521
|
msHyphens?: import("csstype").Property.Hyphens | undefined;
|
|
522
522
|
msImeAlign?: import("csstype").Property.MsImeAlign | undefined;
|
|
523
|
-
msJustifySelf?: import("csstype").Property.JustifySelf | undefined;
|
|
524
523
|
msLineBreak?: import("csstype").Property.LineBreak | undefined;
|
|
525
524
|
msOrder?: import("csstype").Property.Order | undefined;
|
|
526
525
|
msOverflowStyle?: import("csstype").Property.MsOverflowStyle | undefined;
|
|
@@ -543,6 +542,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
543
542
|
msScrollbarFaceColor?: import("csstype").Property.MsScrollbarFaceColor | undefined;
|
|
544
543
|
msScrollbarHighlightColor?: import("csstype").Property.MsScrollbarHighlightColor | undefined;
|
|
545
544
|
msScrollbarShadowColor?: import("csstype").Property.MsScrollbarShadowColor | undefined;
|
|
545
|
+
msScrollbarTrackColor?: import("csstype").Property.MsScrollbarTrackColor | undefined;
|
|
546
546
|
msTextAutospace?: import("csstype").Property.MsTextAutospace | undefined;
|
|
547
547
|
msTextCombineHorizontal?: import("csstype").Property.TextCombineUpright | undefined;
|
|
548
548
|
msTextOverflow?: import("csstype").Property.TextOverflow | undefined;
|
|
@@ -592,7 +592,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
592
592
|
WebkitClipPath?: import("csstype").Property.ClipPath | undefined;
|
|
593
593
|
WebkitColumnCount?: import("csstype").Property.ColumnCount | undefined;
|
|
594
594
|
WebkitColumnFill?: import("csstype").Property.ColumnFill | undefined;
|
|
595
|
-
WebkitColumnGap?: import("csstype").Property.ColumnGap<string | number> | undefined;
|
|
596
595
|
WebkitColumnRuleColor?: import("csstype").Property.ColumnRuleColor | undefined;
|
|
597
596
|
WebkitColumnRuleStyle?: import("csstype").Property.ColumnRuleStyle | undefined;
|
|
598
597
|
WebkitColumnRuleWidth?: import("csstype").Property.ColumnRuleWidth<string | number> | undefined;
|
|
@@ -721,7 +720,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
721
720
|
scrollSnapPointsY?: import("csstype").Property.ScrollSnapPointsY | undefined;
|
|
722
721
|
scrollSnapTypeX?: import("csstype").Property.ScrollSnapTypeX | undefined;
|
|
723
722
|
scrollSnapTypeY?: import("csstype").Property.ScrollSnapTypeY | undefined;
|
|
724
|
-
scrollbarTrackColor?: import("csstype").Property.MsScrollbarTrackColor | undefined;
|
|
725
723
|
KhtmlBoxAlign?: import("csstype").Property.BoxAlign | undefined;
|
|
726
724
|
KhtmlBoxDirection?: import("csstype").Property.BoxDirection | undefined;
|
|
727
725
|
KhtmlBoxFlex?: import("csstype").Property.BoxFlex | undefined;
|
|
@@ -768,7 +766,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
768
766
|
MozTextDecorationStyle?: import("csstype").Property.TextDecorationStyle | undefined;
|
|
769
767
|
MozUserInput?: import("csstype").Property.MozUserInput | undefined;
|
|
770
768
|
msImeMode?: import("csstype").Property.ImeMode | undefined;
|
|
771
|
-
msScrollbarTrackColor?: import("csstype").Property.MsScrollbarTrackColor | undefined;
|
|
772
769
|
OAnimation?: import("csstype").Property.Animation<string & {}> | undefined;
|
|
773
770
|
OAnimationDelay?: import("csstype").Property.AnimationDelay<string & {}> | undefined;
|
|
774
771
|
OAnimationDirection?: import("csstype").Property.AnimationDirection | undefined;
|
|
@@ -8,7 +8,6 @@ import { useGridApiContext } from '../../utils/useGridApiContext';
|
|
|
8
8
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
9
9
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
10
10
|
import { gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector } from '../columns/gridColumnsSelector';
|
|
11
|
-
import { gridDensityRowHeightSelector } from '../density/densitySelector';
|
|
12
11
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
|
|
13
12
|
import { gridEditRowsStateSelector } from '../editRows/gridEditRowsSelector';
|
|
14
13
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
@@ -16,7 +15,8 @@ import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
|
16
15
|
import { clamp } from '../../../utils/utils';
|
|
17
16
|
import { selectedIdsLookupSelector } from '../selection/gridSelectionSelector';
|
|
18
17
|
import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
|
|
19
|
-
import { getFirstNonSpannedColumnToRender } from '../columns/gridColumnsUtils';
|
|
18
|
+
import { getFirstNonSpannedColumnToRender } from '../columns/gridColumnsUtils';
|
|
19
|
+
import { getMinimalContentHeight } from '../rows/gridRowsUtils'; // Uses binary search to avoid looping through all possible positions
|
|
20
20
|
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
export function binarySearch(offset, positions, sliceStart = 0, sliceEnd = positions.length) {
|
|
@@ -69,7 +69,6 @@ export const useGridVirtualScroller = props => {
|
|
|
69
69
|
} = props;
|
|
70
70
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
71
71
|
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
72
|
-
const rowHeight = useGridSelector(apiRef, gridDensityRowHeightSelector);
|
|
73
72
|
const cellFocus = useGridSelector(apiRef, gridFocusCellSelector);
|
|
74
73
|
const cellTabIndex = useGridSelector(apiRef, gridTabIndexCellSelector);
|
|
75
74
|
const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
|
|
@@ -91,16 +90,16 @@ export const useGridVirtualScroller = props => {
|
|
|
91
90
|
var _currentPage$range, _currentPage$range2;
|
|
92
91
|
|
|
93
92
|
const lastMeasuredIndexRelativeToAllRows = apiRef.current.unstable_getLastMeasuredRowIndex();
|
|
94
|
-
|
|
95
|
-
const lastMeasuredIndex = Math.max(0, lastMeasuredIndexRelativeToCurrentPage);
|
|
96
|
-
let allRowsMeasured = lastMeasuredIndex === Infinity;
|
|
93
|
+
let allRowsMeasured = lastMeasuredIndexRelativeToAllRows === Infinity;
|
|
97
94
|
|
|
98
|
-
if ((_currentPage$
|
|
95
|
+
if ((_currentPage$range = currentPage.range) != null && _currentPage$range.lastRowIndex && !allRowsMeasured) {
|
|
99
96
|
// Check if all rows in this page are already measured
|
|
100
|
-
allRowsMeasured =
|
|
97
|
+
allRowsMeasured = lastMeasuredIndexRelativeToAllRows >= currentPage.range.lastRowIndex;
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
const lastMeasuredIndexRelativeToCurrentPage = clamp(lastMeasuredIndexRelativeToAllRows - (((_currentPage$range2 = currentPage.range) == null ? void 0 : _currentPage$range2.firstRowIndex) || 0), 0, rowsMeta.positions.length);
|
|
101
|
+
|
|
102
|
+
if (allRowsMeasured || rowsMeta.positions[lastMeasuredIndexRelativeToCurrentPage] >= offset) {
|
|
104
103
|
// If all rows were measured (when no row has "auto" as height) or all rows before the offset
|
|
105
104
|
// were measured, then use a binary search because it's faster.
|
|
106
105
|
return binarySearch(offset, rowsMeta.positions);
|
|
@@ -110,7 +109,7 @@ export const useGridVirtualScroller = props => {
|
|
|
110
109
|
// Inspired by https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/utils/CellSizeAndPositionManager.js
|
|
111
110
|
|
|
112
111
|
|
|
113
|
-
return exponentialSearch(offset, rowsMeta.positions,
|
|
112
|
+
return exponentialSearch(offset, rowsMeta.positions, lastMeasuredIndexRelativeToCurrentPage);
|
|
114
113
|
}, [apiRef, (_currentPage$range3 = currentPage.range) == null ? void 0 : _currentPage$range3.firstRowIndex, (_currentPage$range4 = currentPage.range) == null ? void 0 : _currentPage$range4.lastRowIndex, rowsMeta.positions]);
|
|
115
114
|
const computeRenderContext = React.useCallback(() => {
|
|
116
115
|
if (disableVirtualization) {
|
|
@@ -420,19 +419,14 @@ export const useGridVirtualScroller = props => {
|
|
|
420
419
|
height,
|
|
421
420
|
minHeight: shouldExtendContent ? '100%' : 'auto'
|
|
422
421
|
};
|
|
423
|
-
|
|
424
|
-
if (rootProps.autoHeight && currentPage.rows.length === 0) {
|
|
425
|
-
size.height = 2 * rowHeight; // Give room to show the overlay when there's no row.
|
|
426
|
-
}
|
|
427
|
-
|
|
428
422
|
return size;
|
|
429
|
-
}, [rootRef, columnsTotalWidth, rowsMeta.currentPageTotalHeight,
|
|
423
|
+
}, [rootRef, columnsTotalWidth, rowsMeta.currentPageTotalHeight, needsHorizontalScrollbar]);
|
|
430
424
|
React.useEffect(() => {
|
|
431
425
|
apiRef.current.publishEvent('virtualScrollerContentSizeChange');
|
|
432
426
|
}, [apiRef, contentSize]);
|
|
433
427
|
|
|
434
428
|
if (rootProps.autoHeight && currentPage.rows.length === 0) {
|
|
435
|
-
contentSize.height =
|
|
429
|
+
contentSize.height = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
|
|
436
430
|
}
|
|
437
431
|
|
|
438
432
|
const rootStyle = {};
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ export { useGridEditing as useGridEditing_new, editingStateInitializer as editin
|
|
|
30
30
|
export { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old, } from '../hooks/features/editRows/useGridEditing.old';
|
|
31
31
|
export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
32
32
|
export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
|
|
33
|
-
export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridPinnedRowsState, } from '../hooks/features/rows/
|
|
33
|
+
export type { GridRowTreeCreationParams, GridRowTreeCreationValue, GridHydrateRowsValue, GridRowsPartialUpdates, GridRowsPartialUpdateAction, GridTreeDepths, GridRowTreeUpdatedGroupsManager, GridRowTreeUpdateGroupAction, GridPinnedRowsState, } from '../hooks/features/rows/gridRowsInterfaces';
|
|
34
|
+
export { getTreeNodeDescendants, buildRootGroup } from '../hooks/features/rows/gridRowsUtils';
|
|
34
35
|
export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/rows/useGridRowsMeta';
|
|
35
36
|
export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
36
37
|
export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
|
package/internals/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export { useGridEditing as useGridEditing_new, editingStateInitializer as editin
|
|
|
26
26
|
export { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old } from '../hooks/features/editRows/useGridEditing.old';
|
|
27
27
|
export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
28
28
|
export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
|
|
29
|
+
export { getTreeNodeDescendants, buildRootGroup } from '../hooks/features/rows/gridRowsUtils';
|
|
29
30
|
export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/rows/useGridRowsMeta';
|
|
30
31
|
export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
31
32
|
export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useThemeProps } from '@mui/material/styles';
|
|
5
5
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT } from '../constants';
|
|
6
|
-
import { GridDensityTypes, GridEditModes
|
|
6
|
+
import { GridDensityTypes, GridEditModes } from '../models';
|
|
7
7
|
var DATA_GRID_FORCED_PROPS = {
|
|
8
8
|
apiRef: undefined,
|
|
9
9
|
disableMultipleColumnsFiltering: true,
|
|
@@ -44,7 +44,7 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
44
44
|
disableVirtualization: false,
|
|
45
45
|
disableIgnoreModificationsIfProcessingProps: false,
|
|
46
46
|
editMode: GridEditModes.Cell,
|
|
47
|
-
filterMode:
|
|
47
|
+
filterMode: 'client',
|
|
48
48
|
headerHeight: 56,
|
|
49
49
|
hideFooter: false,
|
|
50
50
|
hideFooterPagination: false,
|
|
@@ -53,14 +53,14 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
53
53
|
logger: console,
|
|
54
54
|
logLevel: process.env.NODE_ENV === 'production' ? 'error' : 'warn',
|
|
55
55
|
pagination: false,
|
|
56
|
-
paginationMode:
|
|
56
|
+
paginationMode: 'client',
|
|
57
57
|
rowHeight: 52,
|
|
58
58
|
rowsPerPageOptions: [25, 50, 100],
|
|
59
59
|
rowSpacingType: 'margin',
|
|
60
60
|
showCellRightBorder: false,
|
|
61
61
|
showColumnRightBorder: false,
|
|
62
62
|
sortingOrder: ['asc', 'desc', null],
|
|
63
|
-
sortingMode:
|
|
63
|
+
sortingMode: 'client',
|
|
64
64
|
throttleRowsMs: 0,
|
|
65
65
|
disableColumnReorder: false,
|
|
66
66
|
disableColumnResize: false,
|
|
@@ -6,7 +6,9 @@ import { GridVirtualScroller } from './virtualization/GridVirtualScroller';
|
|
|
6
6
|
import { GridVirtualScrollerContent } from './virtualization/GridVirtualScrollerContent';
|
|
7
7
|
import { GridVirtualScrollerRenderZone } from './virtualization/GridVirtualScrollerRenderZone';
|
|
8
8
|
import { useGridVirtualScroller } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
9
|
+
import { GridOverlays } from './base/GridOverlays';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
12
|
var DataGridVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGridVirtualScroller(props, ref) {
|
|
11
13
|
var className = props.className,
|
|
12
14
|
disableVirtualization = props.disableVirtualization,
|
|
@@ -21,14 +23,14 @@ var DataGridVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGridVir
|
|
|
21
23
|
getRenderZoneProps = _useGridVirtualScroll.getRenderZoneProps,
|
|
22
24
|
getRows = _useGridVirtualScroll.getRows;
|
|
23
25
|
|
|
24
|
-
return /*#__PURE__*/
|
|
26
|
+
return /*#__PURE__*/_jsxs(GridVirtualScroller, _extends({
|
|
25
27
|
className: className
|
|
26
28
|
}, getRootProps(other), {
|
|
27
|
-
children: /*#__PURE__*/_jsx(GridVirtualScrollerContent, _extends({}, getContentProps(), {
|
|
29
|
+
children: [/*#__PURE__*/_jsx(GridOverlays, {}), /*#__PURE__*/_jsx(GridVirtualScrollerContent, _extends({}, getContentProps(), {
|
|
28
30
|
children: /*#__PURE__*/_jsx(GridVirtualScrollerRenderZone, _extends({}, getRenderZoneProps(), {
|
|
29
31
|
children: getRows()
|
|
30
32
|
}))
|
|
31
|
-
}))
|
|
33
|
+
}))]
|
|
32
34
|
}));
|
|
33
35
|
});
|
|
34
36
|
export { DataGridVirtualScroller };
|
|
@@ -54,8 +54,7 @@ export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginatio
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
return /*#__PURE__*/_jsx(GridPaginationRoot, _extends({
|
|
57
|
-
ref: ref
|
|
58
|
-
,
|
|
57
|
+
ref: ref,
|
|
59
58
|
component: "div",
|
|
60
59
|
count: paginationState.rowCount,
|
|
61
60
|
page: paginationState.page <= lastPage ? paginationState.page : lastPage,
|
|
@@ -7,7 +7,7 @@ var _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowH
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
10
|
+
import { unstable_composeClasses as composeClasses, useForkRef } from '@mui/material';
|
|
11
11
|
import { GridEditModes, GridRowModes, GridCellModes } from '../models/gridEditRowModel';
|
|
12
12
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
13
13
|
import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
|
|
@@ -20,7 +20,7 @@ import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelection
|
|
|
20
20
|
import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
21
21
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
22
22
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
23
|
-
import {
|
|
23
|
+
import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
24
24
|
import { gridDensityHeaderGroupingMaxDepthSelector } from '../hooks/features/density/densitySelector';
|
|
25
25
|
import { randomNumberBetween } from '../utils/utils';
|
|
26
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -55,7 +55,7 @@ var EmptyCell = function EmptyCell(_ref) {
|
|
|
55
55
|
}); // TODO change to .MuiDataGrid-emptyCell or .MuiDataGrid-rowFiller
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
function GridRow(props) {
|
|
58
|
+
var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
59
59
|
var _apiRef$current$getRo;
|
|
60
60
|
|
|
61
61
|
var selected = props.selected,
|
|
@@ -88,8 +88,9 @@ function GridRow(props) {
|
|
|
88
88
|
var currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
89
89
|
var columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
90
90
|
var sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
91
|
-
var treeDepth = useGridSelector(apiRef,
|
|
91
|
+
var treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
92
92
|
var headerGroupingMaxDepth = useGridSelector(apiRef, gridDensityHeaderGroupingMaxDepthSelector);
|
|
93
|
+
var handleRef = useForkRef(ref, refProp);
|
|
93
94
|
var ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
94
95
|
|
|
95
96
|
var _ref2 = (_apiRef$current$getRo = apiRef.current.getRootDimensions()) != null ? _apiRef$current$getRo : {
|
|
@@ -344,6 +345,7 @@ function GridRow(props) {
|
|
|
344
345
|
}
|
|
345
346
|
|
|
346
347
|
var randomNumber = randomNumberBetween(10000, 20, 80);
|
|
348
|
+
var rowType = apiRef.current.getRowNode(rowId).type;
|
|
347
349
|
var cells = [];
|
|
348
350
|
|
|
349
351
|
for (var i = 0; i < renderedColumns.length; i += 1) {
|
|
@@ -355,7 +357,7 @@ function GridRow(props) {
|
|
|
355
357
|
var cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
356
358
|
|
|
357
359
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
358
|
-
if (
|
|
360
|
+
if (rowType !== 'skeletonRow') {
|
|
359
361
|
var _cellColSpanInfo$cell = cellColSpanInfo.cellProps,
|
|
360
362
|
colSpan = _cellColSpanInfo$cell.colSpan,
|
|
361
363
|
width = _cellColSpanInfo$cell.width;
|
|
@@ -387,7 +389,7 @@ function GridRow(props) {
|
|
|
387
389
|
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
388
390
|
} : null;
|
|
389
391
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
390
|
-
ref:
|
|
392
|
+
ref: handleRef,
|
|
391
393
|
"data-id": rowId,
|
|
392
394
|
"data-rowindex": index,
|
|
393
395
|
role: "row",
|
|
@@ -400,8 +402,7 @@ function GridRow(props) {
|
|
|
400
402
|
width: emptyCellWidth
|
|
401
403
|
})]
|
|
402
404
|
}));
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
+
});
|
|
405
406
|
process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
406
407
|
// ----------------------------- Warning --------------------------------
|
|
407
408
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
5
5
|
import { GridMainContainer } from '../containers/GridMainContainer';
|
|
6
6
|
import { GridAutoSizer } from '../GridAutoSizer';
|
|
7
|
-
import { GridOverlays } from './GridOverlays';
|
|
8
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
10
9
|
import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
@@ -55,7 +54,7 @@ function GridBody(props) {
|
|
|
55
54
|
apiRef.current.publishEvent('resize', size);
|
|
56
55
|
}, [apiRef]);
|
|
57
56
|
return /*#__PURE__*/_jsxs(GridMainContainer, {
|
|
58
|
-
children: [/*#__PURE__*/_jsx(
|
|
57
|
+
children: [/*#__PURE__*/_jsx(ColumnHeadersComponent, {
|
|
59
58
|
ref: columnsContainerRef,
|
|
60
59
|
innerRef: columnHeadersRef
|
|
61
60
|
}), /*#__PURE__*/_jsx(GridAutoSizer, {
|
|
@@ -2,20 +2,57 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
7
|
+
import clsx from 'clsx';
|
|
5
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
6
9
|
import { gridVisibleRowCountSelector } from '../../hooks/features/filter/gridFilterSelector';
|
|
7
10
|
import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
8
11
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
9
12
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
|
-
import {
|
|
13
|
+
import { getMinimalContentHeight } from '../../hooks/features/rows/gridRowsUtils';
|
|
14
|
+
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
var GridOverlayWrapperRoot = styled('div', {
|
|
17
|
+
name: 'MuiDataGrid',
|
|
18
|
+
slot: 'OverlayWrapper',
|
|
19
|
+
overridesResolver: function overridesResolver(props, styles) {
|
|
20
|
+
return styles.overlayWrapper;
|
|
21
|
+
}
|
|
22
|
+
})({
|
|
23
|
+
position: 'sticky',
|
|
24
|
+
// To stay in place while scrolling
|
|
25
|
+
top: 0,
|
|
26
|
+
left: 0,
|
|
27
|
+
width: 0,
|
|
28
|
+
// To stay above the content instead of shifting it down
|
|
29
|
+
height: 0,
|
|
30
|
+
// To stay above the content instead of shifting it down
|
|
31
|
+
zIndex: 4 // Should be above pinned columns, pinned rows and detail panel
|
|
32
|
+
|
|
33
|
+
});
|
|
34
|
+
var GridOverlayWrapperInner = styled('div', {
|
|
35
|
+
name: 'MuiDataGrid',
|
|
36
|
+
slot: 'OverlayWrapperInner',
|
|
37
|
+
overridesResolver: function overridesResolver(props, styles) {
|
|
38
|
+
return styles.overlayWrapperInner;
|
|
39
|
+
}
|
|
40
|
+
})({});
|
|
41
|
+
|
|
42
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
43
|
+
var classes = ownerState.classes;
|
|
44
|
+
var slots = {
|
|
45
|
+
root: ['overlayWrapper'],
|
|
46
|
+
inner: ['overlayWrapperInner']
|
|
47
|
+
};
|
|
48
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
49
|
+
};
|
|
12
50
|
|
|
13
51
|
function GridOverlayWrapper(props) {
|
|
14
52
|
var _viewportInnerSize$he, _viewportInnerSize$wi;
|
|
15
53
|
|
|
16
54
|
var apiRef = useGridApiContext();
|
|
17
55
|
var rootProps = useGridRootProps();
|
|
18
|
-
var totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
|
|
19
56
|
|
|
20
57
|
var _React$useState = React.useState(function () {
|
|
21
58
|
var _apiRef$current$getRo, _apiRef$current$getRo2;
|
|
@@ -37,22 +74,27 @@ function GridOverlayWrapper(props) {
|
|
|
37
74
|
var height = (_viewportInnerSize$he = viewportInnerSize == null ? void 0 : viewportInnerSize.height) != null ? _viewportInnerSize$he : 0;
|
|
38
75
|
|
|
39
76
|
if (rootProps.autoHeight && height === 0) {
|
|
40
|
-
height =
|
|
77
|
+
height = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
|
|
41
78
|
}
|
|
42
79
|
|
|
80
|
+
var classes = useUtilityClasses(_extends({}, props, {
|
|
81
|
+
classes: rootProps.classes
|
|
82
|
+
}));
|
|
83
|
+
|
|
43
84
|
if (!viewportInnerSize) {
|
|
44
85
|
return null;
|
|
45
86
|
}
|
|
46
87
|
|
|
47
|
-
return /*#__PURE__*/_jsx(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
88
|
+
return /*#__PURE__*/_jsx(GridOverlayWrapperRoot, {
|
|
89
|
+
className: clsx(classes.root),
|
|
90
|
+
children: /*#__PURE__*/_jsx(GridOverlayWrapperInner, _extends({
|
|
91
|
+
className: clsx(classes.inner),
|
|
92
|
+
style: {
|
|
93
|
+
height: height,
|
|
94
|
+
width: (_viewportInnerSize$wi = viewportInnerSize == null ? void 0 : viewportInnerSize.width) != null ? _viewportInnerSize$wi : 0
|
|
95
|
+
}
|
|
96
|
+
}, props))
|
|
97
|
+
});
|
|
56
98
|
}
|
|
57
99
|
|
|
58
100
|
export function GridOverlays() {
|
|
@@ -7,6 +7,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
|
7
7
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
10
|
+
import { isAutoGeneratedRow } from '../../hooks/features/rows/gridRowsUtils';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
|
|
12
13
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -141,7 +142,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
141
142
|
var GridBooleanCell = /*#__PURE__*/React.memo(GridBooleanCellRaw);
|
|
142
143
|
export { GridBooleanCell };
|
|
143
144
|
export var renderBooleanCell = function renderBooleanCell(params) {
|
|
144
|
-
if (params.rowNode
|
|
145
|
+
if (isAutoGeneratedRow(params.rowNode)) {
|
|
145
146
|
return '';
|
|
146
147
|
}
|
|
147
148
|
|
|
@@ -82,17 +82,12 @@ var GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCell
|
|
|
82
82
|
}
|
|
83
83
|
}, [apiRef, props]);
|
|
84
84
|
|
|
85
|
-
if (rowNode.
|
|
85
|
+
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
var isSelectable = apiRef.current.isRowSelectable(id);
|
|
90
90
|
var label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
91
|
-
|
|
92
|
-
if (rowNode.isPinned) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
91
|
return /*#__PURE__*/_jsx(rootProps.components.BaseCheckbox, _extends({
|
|
97
92
|
ref: handleRef,
|
|
98
93
|
tabIndex: tabIndex,
|
|
@@ -27,13 +27,8 @@ var GridOverlayRoot = styled('div', {
|
|
|
27
27
|
})(function (_ref) {
|
|
28
28
|
var theme = _ref.theme;
|
|
29
29
|
return {
|
|
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',
|
|
@@ -264,7 +264,8 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
|
|
|
264
264
|
}, [currentOperator]);
|
|
265
265
|
return /*#__PURE__*/_jsxs(GridFilterFormRoot, _extends({
|
|
266
266
|
ref: ref,
|
|
267
|
-
className: classes.root
|
|
267
|
+
className: classes.root,
|
|
268
|
+
"data-id": item.id
|
|
268
269
|
}, other, {
|
|
269
270
|
children: [/*#__PURE__*/_jsx(FilterFormDeleteIcon, _extends({
|
|
270
271
|
variant: "standard",
|
|
@@ -75,8 +75,10 @@ var GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolbar
|
|
|
75
75
|
children: [apiRef.current.getLocaleText('toolbarFiltersTooltipActive')(activeFilters.length), /*#__PURE__*/_jsx(GridToolbarFilterListRoot, {
|
|
76
76
|
className: classes.root,
|
|
77
77
|
children: activeFilters.map(function (item, index) {
|
|
78
|
+
var _item$value;
|
|
79
|
+
|
|
78
80
|
return _extends({}, lookup[item.columnField] && /*#__PURE__*/_jsx("li", {
|
|
79
|
-
children: "".concat(lookup[item.columnField].headerName || item.columnField, "\n ").concat(getOperatorLabel(item), "\n ").concat(item.value)
|
|
81
|
+
children: "".concat(lookup[item.columnField].headerName || item.columnField, "\n ").concat(getOperatorLabel(item), "\n ").concat((_item$value = item.value) != null ? _item$value : '')
|
|
80
82
|
}, index));
|
|
81
83
|
})
|
|
82
84
|
})]
|
|
@@ -283,7 +283,7 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
283
283
|
|
|
284
284
|
var columnsToRender = getColumnsToRender(params);
|
|
285
285
|
|
|
286
|
-
if (columnsToRender == null) {
|
|
286
|
+
if (columnsToRender == null || columnsToRender.renderedColumns.length === 0) {
|
|
287
287
|
return null;
|
|
288
288
|
}
|
|
289
289
|
|