@mui/x-data-grid 7.24.1 → 7.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +148 -0
- package/DataGrid/DataGrid.js +1 -7
- package/DataGrid/useDataGridComponent.js +2 -2
- package/components/GridRow.d.ts +0 -1
- package/components/GridRow.js +32 -20
- package/components/GridScrollArea.d.ts +5 -2
- package/components/GridScrollArea.js +32 -25
- package/components/GridSkeletonLoadingOverlay.js +2 -1
- package/components/cell/GridCell.d.ts +9 -6
- package/components/cell/GridCell.js +29 -52
- package/components/containers/GridRoot.js +11 -9
- package/components/containers/GridRootStyles.js +138 -40
- package/components/toolbar/GridToolbarColumnsButton.js +5 -4
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/components/toolbar/GridToolbarFilterButton.js +4 -3
- package/components/virtualization/GridMainContainer.d.ts +10 -0
- package/components/virtualization/GridMainContainer.js +10 -2
- package/components/virtualization/GridVirtualScrollbar.d.ts +4 -0
- package/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/components/virtualization/GridVirtualScroller.js +36 -16
- package/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/hooks/core/useGridStateInitialization.js +3 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +0 -5
- package/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/hooks/features/columns/useGridColumns.js +7 -3
- package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +16 -0
- package/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
- package/hooks/features/dimensions/index.d.ts +1 -1
- package/hooks/features/dimensions/index.js +1 -2
- package/hooks/features/dimensions/useGridDimensions.js +102 -77
- package/hooks/features/editing/gridEditingSelectors.d.ts +10 -0
- package/hooks/features/editing/gridEditingSelectors.js +12 -1
- package/hooks/features/editing/index.d.ts +1 -1
- package/hooks/features/editing/index.js +1 -1
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridRowEditing.js +8 -9
- package/hooks/features/filter/gridFilterState.d.ts +5 -0
- package/hooks/features/filter/gridFilterState.js +5 -0
- package/hooks/features/filter/useGridFilter.js +6 -13
- package/hooks/features/focus/useGridFocus.js +3 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/hooks/features/keyboardNavigation/utils.d.ts +1 -2
- package/hooks/features/keyboardNavigation/utils.js +0 -5
- package/hooks/features/listView/useGridListView.js +2 -1
- package/hooks/features/pagination/useGridPagination.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +4 -4
- package/hooks/features/rowSelection/utils.js +1 -1
- package/hooks/features/rows/gridRowsMetaState.d.ts +8 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +0 -4
- package/hooks/features/rows/gridRowsUtils.js +0 -16
- package/hooks/features/rows/useGridParamsApi.d.ts +1 -1
- package/hooks/features/rows/useGridParamsApi.js +33 -14
- package/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/hooks/features/rows/useGridRows.js +7 -8
- package/hooks/features/rows/useGridRowsMeta.js +36 -19
- package/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +15 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +74 -72
- package/hooks/utils/useGridSelector.d.ts +8 -1
- package/hooks/utils/useGridSelector.js +42 -8
- package/hooks/utils/useIsSSR.d.ts +1 -0
- package/hooks/utils/useIsSSR.js +5 -0
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +29 -2
- package/models/api/gridStateApi.d.ts +1 -0
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +6 -0
- package/modern/DataGrid/DataGrid.js +1 -7
- package/modern/DataGrid/useDataGridComponent.js +2 -2
- package/modern/components/GridRow.js +32 -20
- package/modern/components/GridScrollArea.js +32 -25
- package/modern/components/GridSkeletonLoadingOverlay.js +2 -1
- package/modern/components/cell/GridCell.js +29 -52
- package/modern/components/containers/GridRoot.js +11 -9
- package/modern/components/containers/GridRootStyles.js +138 -40
- package/modern/components/toolbar/GridToolbarColumnsButton.js +5 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +4 -3
- package/modern/components/virtualization/GridMainContainer.js +10 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/modern/components/virtualization/GridVirtualScroller.js +36 -16
- package/modern/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/modern/hooks/core/useGridStateInitialization.js +3 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/modern/hooks/features/columns/useGridColumns.js +7 -3
- package/modern/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
- package/modern/hooks/features/dimensions/index.js +1 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +102 -77
- package/modern/hooks/features/editing/gridEditingSelectors.js +12 -1
- package/modern/hooks/features/editing/index.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +8 -9
- package/modern/hooks/features/filter/gridFilterState.js +5 -0
- package/modern/hooks/features/filter/useGridFilter.js +6 -13
- package/modern/hooks/features/focus/useGridFocus.js +3 -2
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/modern/hooks/features/keyboardNavigation/utils.js +0 -5
- package/modern/hooks/features/listView/useGridListView.js +2 -1
- package/modern/hooks/features/pagination/useGridPagination.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +4 -4
- package/modern/hooks/features/rowSelection/utils.js +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +0 -16
- package/modern/hooks/features/rows/useGridParamsApi.js +33 -14
- package/modern/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/modern/hooks/features/rows/useGridRows.js +7 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +36 -19
- package/modern/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +74 -72
- package/modern/hooks/utils/useGridSelector.js +42 -8
- package/modern/hooks/utils/useIsSSR.js +5 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/models/api/index.js +0 -1
- package/modern/utils/roundToDecimalPlaces.js +3 -0
- package/modern/utils/utils.js +6 -1
- package/node/DataGrid/DataGrid.js +1 -7
- package/node/DataGrid/useDataGridComponent.js +2 -2
- package/node/components/GridRow.js +28 -17
- package/node/components/GridScrollArea.js +31 -24
- package/node/components/GridSkeletonLoadingOverlay.js +2 -1
- package/node/components/cell/GridCell.js +27 -50
- package/node/components/containers/GridRoot.js +10 -8
- package/node/components/containers/GridRootStyles.js +138 -40
- package/node/components/toolbar/GridToolbarColumnsButton.js +5 -4
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/node/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +4 -3
- package/node/components/virtualization/GridMainContainer.js +10 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/node/components/virtualization/GridVirtualScroller.js +36 -16
- package/node/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/node/hooks/core/useGridStateInitialization.js +3 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/node/hooks/features/columns/gridColumnsSelector.js +1 -13
- package/node/hooks/features/columns/useGridColumns.js +7 -3
- package/node/hooks/features/dimensions/gridDimensionsSelectors.js +38 -2
- package/node/hooks/features/dimensions/index.js +13 -11
- package/node/hooks/features/dimensions/useGridDimensions.js +99 -74
- package/node/hooks/features/editing/gridEditingSelectors.js +12 -2
- package/node/hooks/features/editing/index.js +7 -11
- package/node/hooks/features/editing/useGridCellEditing.js +2 -2
- package/node/hooks/features/editing/useGridRowEditing.js +6 -7
- package/node/hooks/features/filter/gridFilterState.js +6 -1
- package/node/hooks/features/filter/useGridFilter.js +5 -12
- package/node/hooks/features/focus/useGridFocus.js +3 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -15
- package/node/hooks/features/keyboardNavigation/utils.js +0 -6
- package/node/hooks/features/listView/useGridListView.js +2 -1
- package/node/hooks/features/pagination/useGridPagination.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- package/node/hooks/features/rowSelection/utils.js +1 -1
- package/node/hooks/features/rows/gridRowsUtils.js +0 -17
- package/node/hooks/features/rows/useGridParamsApi.js +33 -14
- package/node/hooks/features/rows/useGridRowSpanning.js +92 -89
- package/node/hooks/features/rows/useGridRows.js +7 -8
- package/node/hooks/features/rows/useGridRowsMeta.js +36 -19
- package/node/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +73 -71
- package/node/hooks/utils/useGridSelector.js +42 -8
- package/node/hooks/utils/useIsSSR.js +12 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +20 -7
- package/node/models/api/index.js +0 -11
- package/node/utils/roundToDecimalPlaces.js +9 -0
- package/node/utils/utils.js +8 -1
- package/package.json +3 -2
- package/utils/roundToDecimalPlaces.d.ts +1 -0
- package/utils/roundToDecimalPlaces.js +3 -0
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +6 -1
|
@@ -3,7 +3,6 @@ import { alpha, styled, darken, lighten, decomposeColor, recomposeColor } from '
|
|
|
3
3
|
import { gridClasses as c } from "../../constants/gridClasses.js";
|
|
4
4
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
5
5
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
6
|
-
import { gridDimensionsSelector } from "../../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
7
6
|
function getBorderColor(theme) {
|
|
8
7
|
if (theme.vars) {
|
|
9
8
|
return theme.vars.palette.TableCell.border;
|
|
@@ -35,53 +34,80 @@ const separatorIconDragStyles = {
|
|
|
35
34
|
// Emotion thinks it knows better than us which selector we should use.
|
|
36
35
|
// https://github.com/emotion-js/emotion/issues/1105#issuecomment-1722524968
|
|
37
36
|
const ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
|
|
37
|
+
const shouldShowBorderTopRightRadiusSelector = state => state.dimensions.hasScrollX && (!state.dimensions.hasScrollY || state.dimensions.scrollbarSize === 0);
|
|
38
38
|
export const GridRootStyles = styled('div', {
|
|
39
39
|
name: 'MuiDataGrid',
|
|
40
40
|
slot: 'Root',
|
|
41
|
-
overridesResolver: (props, styles) => [
|
|
41
|
+
overridesResolver: (props, styles) => [
|
|
42
|
+
// Root overrides
|
|
43
|
+
styles.root, {
|
|
42
44
|
[`&.${c.autoHeight}`]: styles.autoHeight
|
|
43
45
|
}, {
|
|
44
|
-
[`&.${c.
|
|
46
|
+
[`&.${c.autosizing}`]: styles.autosizing
|
|
45
47
|
}, {
|
|
46
|
-
[`&.${c['
|
|
48
|
+
[`&.${c['root--densityStandard']}`]: styles['root--densityStandard']
|
|
47
49
|
}, {
|
|
48
|
-
[`&.${c['
|
|
50
|
+
[`&.${c['root--densityComfortable']}`]: styles['root--densityComfortable']
|
|
49
51
|
}, {
|
|
50
|
-
[`&.${c['
|
|
52
|
+
[`&.${c['root--densityCompact']}`]: styles['root--densityCompact']
|
|
51
53
|
}, {
|
|
52
|
-
[`&.${c
|
|
54
|
+
[`&.${c['root--disableUserSelection']}`]: styles['root--disableUserSelection']
|
|
53
55
|
}, {
|
|
54
|
-
[`&.${c['root--
|
|
56
|
+
[`&.${c['root--noToolbar']}`]: styles['root--noToolbar']
|
|
55
57
|
}, {
|
|
56
|
-
[`&.${c.
|
|
58
|
+
[`&.${c.withVerticalBorder}`]: styles.withVerticalBorder
|
|
59
|
+
},
|
|
60
|
+
// Child element overrides
|
|
61
|
+
// - Only declare overrides here for class names that are not applied to `styled` components.
|
|
62
|
+
// - For `styled` components, declare overrides in the component itself.
|
|
63
|
+
{
|
|
64
|
+
[`& .${c.actionsCell}`]: styles.actionsCell
|
|
57
65
|
}, {
|
|
58
|
-
[`& .${c.
|
|
66
|
+
[`& .${c.booleanCell}`]: styles.booleanCell
|
|
59
67
|
}, {
|
|
60
68
|
[`& .${c.cell}`]: styles.cell
|
|
69
|
+
}, {
|
|
70
|
+
[`& .${c['cell--editable']}`]: styles['cell--editable']
|
|
61
71
|
}, {
|
|
62
72
|
[`& .${c['cell--editing']}`]: styles['cell--editing']
|
|
63
73
|
}, {
|
|
64
|
-
[`& .${c['cell--
|
|
74
|
+
[`& .${c['cell--flex']}`]: styles['cell--flex']
|
|
65
75
|
}, {
|
|
66
|
-
[`& .${c['cell--
|
|
76
|
+
[`& .${c['cell--pinnedLeft']}`]: styles['cell--pinnedLeft']
|
|
67
77
|
}, {
|
|
68
|
-
[`& .${c['cell--
|
|
69
|
-
}, {
|
|
70
|
-
[`& .${c['cell--rangeTop']}`]: styles['cell--rangeTop']
|
|
78
|
+
[`& .${c['cell--pinnedRight']}`]: styles['cell--pinnedRight']
|
|
71
79
|
}, {
|
|
72
80
|
[`& .${c['cell--rangeBottom']}`]: styles['cell--rangeBottom']
|
|
73
81
|
}, {
|
|
74
82
|
[`& .${c['cell--rangeLeft']}`]: styles['cell--rangeLeft']
|
|
75
83
|
}, {
|
|
76
84
|
[`& .${c['cell--rangeRight']}`]: styles['cell--rangeRight']
|
|
85
|
+
}, {
|
|
86
|
+
[`& .${c['cell--rangeTop']}`]: styles['cell--rangeTop']
|
|
87
|
+
}, {
|
|
88
|
+
[`& .${c['cell--selectionMode']}`]: styles['cell--selectionMode']
|
|
89
|
+
}, {
|
|
90
|
+
[`& .${c['cell--textCenter']}`]: styles['cell--textCenter']
|
|
91
|
+
}, {
|
|
92
|
+
[`& .${c['cell--textLeft']}`]: styles['cell--textLeft']
|
|
93
|
+
}, {
|
|
94
|
+
[`& .${c['cell--textRight']}`]: styles['cell--textRight']
|
|
95
|
+
}, {
|
|
96
|
+
[`& .${c['cell--withLeftBorder']}`]: styles['cell--withLeftBorder']
|
|
77
97
|
}, {
|
|
78
98
|
[`& .${c['cell--withRightBorder']}`]: styles['cell--withRightBorder']
|
|
79
99
|
}, {
|
|
80
100
|
[`& .${c.cellCheckbox}`]: styles.cellCheckbox
|
|
101
|
+
}, {
|
|
102
|
+
[`& .${c.cellEmpty}`]: styles.cellEmpty
|
|
103
|
+
}, {
|
|
104
|
+
[`& .${c.cellOffsetLeft}`]: styles.cellOffsetLeft
|
|
81
105
|
}, {
|
|
82
106
|
[`& .${c.cellSkeleton}`]: styles.cellSkeleton
|
|
83
107
|
}, {
|
|
84
108
|
[`& .${c.checkboxInput}`]: styles.checkboxInput
|
|
109
|
+
}, {
|
|
110
|
+
[`& .${c.columnHeader}`]: styles.columnHeader
|
|
85
111
|
}, {
|
|
86
112
|
[`& .${c['columnHeader--alignCenter']}`]: styles['columnHeader--alignCenter']
|
|
87
113
|
}, {
|
|
@@ -90,80 +116,156 @@ export const GridRootStyles = styled('div', {
|
|
|
90
116
|
[`& .${c['columnHeader--alignRight']}`]: styles['columnHeader--alignRight']
|
|
91
117
|
}, {
|
|
92
118
|
[`& .${c['columnHeader--dragging']}`]: styles['columnHeader--dragging']
|
|
119
|
+
}, {
|
|
120
|
+
[`& .${c['columnHeader--emptyGroup']}`]: styles['columnHeader--emptyGroup']
|
|
121
|
+
}, {
|
|
122
|
+
[`& .${c['columnHeader--filledGroup']}`]: styles['columnHeader--filledGroup']
|
|
123
|
+
}, {
|
|
124
|
+
[`& .${c['columnHeader--filtered']}`]: styles['columnHeader--filtered']
|
|
125
|
+
}, {
|
|
126
|
+
[`& .${c['columnHeader--last']}`]: styles['columnHeader--last']
|
|
127
|
+
}, {
|
|
128
|
+
[`& .${c['columnHeader--lastUnpinned']}`]: styles['columnHeader--lastUnpinned']
|
|
93
129
|
}, {
|
|
94
130
|
[`& .${c['columnHeader--moving']}`]: styles['columnHeader--moving']
|
|
95
131
|
}, {
|
|
96
132
|
[`& .${c['columnHeader--numeric']}`]: styles['columnHeader--numeric']
|
|
133
|
+
}, {
|
|
134
|
+
[`& .${c['columnHeader--pinnedLeft']}`]: styles['columnHeader--pinnedLeft']
|
|
135
|
+
}, {
|
|
136
|
+
[`& .${c['columnHeader--pinnedRight']}`]: styles['columnHeader--pinnedRight']
|
|
137
|
+
}, {
|
|
138
|
+
[`& .${c['columnHeader--siblingFocused']}`]: styles['columnHeader--siblingFocused']
|
|
97
139
|
}, {
|
|
98
140
|
[`& .${c['columnHeader--sortable']}`]: styles['columnHeader--sortable']
|
|
99
141
|
}, {
|
|
100
142
|
[`& .${c['columnHeader--sorted']}`]: styles['columnHeader--sorted']
|
|
101
143
|
}, {
|
|
102
|
-
[`& .${c['columnHeader--
|
|
103
|
-
}, {
|
|
104
|
-
[`& .${c.columnHeader}`]: styles.columnHeader
|
|
144
|
+
[`& .${c['columnHeader--withLeftBorder']}`]: styles['columnHeader--withLeftBorder']
|
|
105
145
|
}, {
|
|
106
|
-
[`& .${c
|
|
146
|
+
[`& .${c['columnHeader--withRightBorder']}`]: styles['columnHeader--withRightBorder']
|
|
107
147
|
}, {
|
|
108
148
|
[`& .${c.columnHeaderCheckbox}`]: styles.columnHeaderCheckbox
|
|
109
149
|
}, {
|
|
110
150
|
[`& .${c.columnHeaderDraggableContainer}`]: styles.columnHeaderDraggableContainer
|
|
111
151
|
}, {
|
|
112
152
|
[`& .${c.columnHeaderTitleContainer}`]: styles.columnHeaderTitleContainer
|
|
153
|
+
}, {
|
|
154
|
+
[`& .${c.columnHeaderTitleContainerContent}`]: styles.columnHeaderTitleContainerContent
|
|
155
|
+
}, {
|
|
156
|
+
[`& .${c.columnSeparator}`]: styles.columnSeparator
|
|
113
157
|
}, {
|
|
114
158
|
[`& .${c['columnSeparator--resizable']}`]: styles['columnSeparator--resizable']
|
|
115
159
|
}, {
|
|
116
160
|
[`& .${c['columnSeparator--resizing']}`]: styles['columnSeparator--resizing']
|
|
117
161
|
}, {
|
|
118
|
-
[`& .${c
|
|
162
|
+
[`& .${c['columnSeparator--sideLeft']}`]: styles['columnSeparator--sideLeft']
|
|
163
|
+
}, {
|
|
164
|
+
[`& .${c['columnSeparator--sideRight']}`]: styles['columnSeparator--sideRight']
|
|
165
|
+
}, {
|
|
166
|
+
[`& .${c['container--bottom']}`]: styles['container--bottom']
|
|
167
|
+
}, {
|
|
168
|
+
[`& .${c['container--top']}`]: styles['container--top']
|
|
169
|
+
}, {
|
|
170
|
+
[`& .${c.detailPanelToggleCell}`]: styles.detailPanelToggleCell
|
|
171
|
+
}, {
|
|
172
|
+
[`& .${c['detailPanelToggleCell--expanded']}`]: styles['detailPanelToggleCell--expanded']
|
|
173
|
+
}, {
|
|
174
|
+
[`& .${c.editBooleanCell}`]: styles.editBooleanCell
|
|
119
175
|
}, {
|
|
120
176
|
[`& .${c.filterIcon}`]: styles.filterIcon
|
|
177
|
+
}, {
|
|
178
|
+
[`& .${c['filler--borderBottom']}`]: styles['filler--borderBottom']
|
|
179
|
+
}, {
|
|
180
|
+
[`& .${c['filler--pinnedLeft']}`]: styles['filler--pinnedLeft']
|
|
181
|
+
}, {
|
|
182
|
+
[`& .${c['filler--pinnedRight']}`]: styles['filler--pinnedRight']
|
|
183
|
+
}, {
|
|
184
|
+
[`& .${c.groupingCriteriaCell}`]: styles.groupingCriteriaCell
|
|
185
|
+
}, {
|
|
186
|
+
[`& .${c.groupingCriteriaCellLoadingContainer}`]: styles.groupingCriteriaCellLoadingContainer
|
|
187
|
+
}, {
|
|
188
|
+
[`& .${c.groupingCriteriaCellToggle}`]: styles.groupingCriteriaCellToggle
|
|
189
|
+
}, {
|
|
190
|
+
[`& .${c.headerFilterRow}`]: styles.headerFilterRow
|
|
121
191
|
}, {
|
|
122
192
|
[`& .${c.iconSeparator}`]: styles.iconSeparator
|
|
123
193
|
}, {
|
|
124
194
|
[`& .${c.menuIcon}`]: styles.menuIcon
|
|
125
195
|
}, {
|
|
126
196
|
[`& .${c.menuIconButton}`]: styles.menuIconButton
|
|
197
|
+
}, {
|
|
198
|
+
[`& .${c.menuList}`]: styles.menuList
|
|
127
199
|
}, {
|
|
128
200
|
[`& .${c.menuOpen}`]: styles.menuOpen
|
|
129
201
|
}, {
|
|
130
|
-
[`& .${c.
|
|
202
|
+
[`& .${c.overlayWrapperInner}`]: styles.overlayWrapperInner
|
|
131
203
|
}, {
|
|
132
|
-
[`& .${c
|
|
204
|
+
[`& .${c.pinnedRows}`]: styles.pinnedRows
|
|
133
205
|
}, {
|
|
134
|
-
[`& .${c['
|
|
206
|
+
[`& .${c['pinnedRows--bottom']}`]: styles['pinnedRows--bottom']
|
|
135
207
|
}, {
|
|
136
|
-
[`& .${c['
|
|
208
|
+
[`& .${c['pinnedRows--top']}`]: styles['pinnedRows--top']
|
|
137
209
|
}, {
|
|
138
210
|
[`& .${c.row}`]: styles.row
|
|
139
211
|
}, {
|
|
140
|
-
[`& .${c
|
|
212
|
+
[`& .${c['row--borderBottom']}`]: styles['row--borderBottom']
|
|
213
|
+
}, {
|
|
214
|
+
[`& .${c['row--detailPanelExpanded']}`]: styles['row--detailPanelExpanded']
|
|
215
|
+
}, {
|
|
216
|
+
[`& .${c['row--dragging']}`]: styles['row--dragging']
|
|
217
|
+
}, {
|
|
218
|
+
[`& .${c['row--dynamicHeight']}`]: styles['row--dynamicHeight']
|
|
219
|
+
}, {
|
|
220
|
+
[`& .${c['row--editable']}`]: styles['row--editable']
|
|
221
|
+
}, {
|
|
222
|
+
[`& .${c['row--editing']}`]: styles['row--editing']
|
|
223
|
+
}, {
|
|
224
|
+
[`& .${c['row--firstVisible']}`]: styles['row--firstVisible']
|
|
225
|
+
}, {
|
|
226
|
+
[`& .${c['row--lastVisible']}`]: styles['row--lastVisible']
|
|
141
227
|
}, {
|
|
142
228
|
[`& .${c.rowReorderCell}`]: styles.rowReorderCell
|
|
143
229
|
}, {
|
|
144
230
|
[`& .${c['rowReorderCell--draggable']}`]: styles['rowReorderCell--draggable']
|
|
145
231
|
}, {
|
|
146
|
-
[`& .${c.
|
|
232
|
+
[`& .${c.rowReorderCellContainer}`]: styles.rowReorderCellContainer
|
|
147
233
|
}, {
|
|
148
|
-
[`& .${c.
|
|
234
|
+
[`& .${c.rowReorderCellPlaceholder}`]: styles.rowReorderCellPlaceholder
|
|
149
235
|
}, {
|
|
150
|
-
[`& .${c.
|
|
236
|
+
[`& .${c.rowSkeleton}`]: styles.rowSkeleton
|
|
151
237
|
}, {
|
|
152
|
-
[`& .${c.
|
|
238
|
+
[`& .${c.scrollbar}`]: styles.scrollbar
|
|
153
239
|
}, {
|
|
154
|
-
[`& .${c
|
|
240
|
+
[`& .${c['scrollbar--horizontal']}`]: styles['scrollbar--horizontal']
|
|
155
241
|
}, {
|
|
156
|
-
[`& .${c
|
|
242
|
+
[`& .${c['scrollbar--vertical']}`]: styles['scrollbar--vertical']
|
|
157
243
|
}, {
|
|
158
|
-
[`& .${c.
|
|
244
|
+
[`& .${c.scrollbarFiller}`]: styles.scrollbarFiller
|
|
159
245
|
}, {
|
|
160
|
-
[`& .${c['
|
|
161
|
-
},
|
|
246
|
+
[`& .${c['scrollbarFiller--borderBottom']}`]: styles['scrollbarFiller--borderBottom']
|
|
247
|
+
}, {
|
|
248
|
+
[`& .${c['scrollbarFiller--borderTop']}`]: styles['scrollbarFiller--borderTop']
|
|
249
|
+
}, {
|
|
250
|
+
[`& .${c['scrollbarFiller--header']}`]: styles['scrollbarFiller--header']
|
|
251
|
+
}, {
|
|
252
|
+
[`& .${c['scrollbarFiller--pinnedRight']}`]: styles['scrollbarFiller--pinnedRight']
|
|
253
|
+
}, {
|
|
254
|
+
[`& .${c.sortIcon}`]: styles.sortIcon
|
|
255
|
+
}, {
|
|
256
|
+
[`& .${c.treeDataGroupingCell}`]: styles.treeDataGroupingCell
|
|
257
|
+
}, {
|
|
258
|
+
[`& .${c.treeDataGroupingCellLoadingContainer}`]: styles.treeDataGroupingCellLoadingContainer
|
|
259
|
+
}, {
|
|
260
|
+
[`& .${c.treeDataGroupingCellToggle}`]: styles.treeDataGroupingCellToggle
|
|
261
|
+
}, {
|
|
262
|
+
[`& .${c.withBorderColor}`]: styles.withBorderColor
|
|
263
|
+
}]
|
|
162
264
|
})(({
|
|
163
265
|
theme: t
|
|
164
266
|
}) => {
|
|
165
267
|
const apiRef = useGridPrivateApiContext();
|
|
166
|
-
const
|
|
268
|
+
const shouldShowBorderTopRightRadius = useGridSelector(apiRef, shouldShowBorderTopRightRadiusSelector);
|
|
167
269
|
const borderColor = getBorderColor(t);
|
|
168
270
|
const radius = t.shape.borderRadius;
|
|
169
271
|
const containerBackground = t.vars ? t.vars.palette.background.default : t.mixins.MuiDataGrid?.containerBackground ?? t.palette.background.default;
|
|
@@ -255,10 +357,6 @@ export const GridRootStyles = styled('div', {
|
|
|
255
357
|
overflow: 'visible !important'
|
|
256
358
|
},
|
|
257
359
|
'@media (hover: hover)': {
|
|
258
|
-
[`& .${c.iconButtonContainer}`]: {
|
|
259
|
-
width: '0 !important',
|
|
260
|
-
visibility: 'hidden !important'
|
|
261
|
-
},
|
|
262
360
|
[`& .${c.menuIcon}`]: {
|
|
263
361
|
width: '0 !important',
|
|
264
362
|
visibility: 'hidden !important'
|
|
@@ -319,7 +417,7 @@ export const GridRootStyles = styled('div', {
|
|
|
319
417
|
borderTopLeftRadius: 'calc(var(--unstable_DataGrid-radius) - 1px)'
|
|
320
418
|
},
|
|
321
419
|
[`&.${c['root--noToolbar']} [aria-rowindex="1"] .${c['columnHeader--last']}`]: {
|
|
322
|
-
borderTopRightRadius:
|
|
420
|
+
borderTopRightRadius: shouldShowBorderTopRightRadius ? 'calc(var(--unstable_DataGrid-radius) - 1px)' : undefined
|
|
323
421
|
},
|
|
324
422
|
[`& .${c.columnHeaderCheckbox}, & .${c.cellCheckbox}`]: {
|
|
325
423
|
padding: 0,
|
|
@@ -45,14 +45,15 @@ const GridToolbarColumnsButton = forwardRef(function GridToolbarColumnsButton(pr
|
|
|
45
45
|
"aria-haspopup": "menu",
|
|
46
46
|
"aria-expanded": isOpen,
|
|
47
47
|
"aria-controls": isOpen ? columnPanelId : undefined,
|
|
48
|
-
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
49
|
-
|
|
48
|
+
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
49
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
50
50
|
onPointerUp: event => {
|
|
51
51
|
if (preferencePanel.open) {
|
|
52
52
|
event.stopPropagation();
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
buttonProps.onPointerUp?.(event);
|
|
55
|
+
},
|
|
56
|
+
onClick: showColumns,
|
|
56
57
|
ref: ref,
|
|
57
58
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
58
59
|
}))
|
|
@@ -94,9 +94,9 @@ const GridToolbarDensitySelector = forwardRef(function GridToolbarDensitySelecto
|
|
|
94
94
|
"aria-haspopup": "menu",
|
|
95
95
|
"aria-expanded": open,
|
|
96
96
|
"aria-controls": open ? densityMenuId : undefined,
|
|
97
|
-
id: densityButtonId
|
|
98
|
-
onClick: handleDensitySelectorOpen
|
|
97
|
+
id: densityButtonId
|
|
99
98
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
99
|
+
onClick: handleDensitySelectorOpen,
|
|
100
100
|
ref: handleRef,
|
|
101
101
|
children: apiRef.current.getLocaleText('toolbarDensity')
|
|
102
102
|
}))
|
|
@@ -52,9 +52,9 @@ const GridToolbarExportContainer = forwardRef(function GridToolbarExportContaine
|
|
|
52
52
|
"aria-label": apiRef.current.getLocaleText('toolbarExportLabel'),
|
|
53
53
|
"aria-haspopup": "menu",
|
|
54
54
|
"aria-controls": open ? exportMenuId : undefined,
|
|
55
|
-
id: exportButtonId
|
|
56
|
-
onClick: handleMenuOpen
|
|
55
|
+
id: exportButtonId
|
|
57
56
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
57
|
+
onClick: handleMenuOpen,
|
|
58
58
|
ref: handleRef,
|
|
59
59
|
children: apiRef.current.getLocaleText('toolbarExport')
|
|
60
60
|
}))
|
|
@@ -109,14 +109,15 @@ const GridToolbarFilterButton = forwardRef(function GridToolbarFilterButton(prop
|
|
|
109
109
|
color: "primary"
|
|
110
110
|
}, rootProps.slotProps?.baseBadge, badgeProps, {
|
|
111
111
|
children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {})
|
|
112
|
-
}))
|
|
112
|
+
}))
|
|
113
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
113
114
|
onClick: toggleFilter,
|
|
114
115
|
onPointerUp: event => {
|
|
115
116
|
if (preferencePanel.open) {
|
|
116
117
|
event.stopPropagation();
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
buttonProps.onPointerUp?.(event);
|
|
120
|
+
},
|
|
120
121
|
ref: ref,
|
|
121
122
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
122
123
|
}))
|
|
@@ -14,7 +14,12 @@ const GridPanelAnchor = styled('div')({
|
|
|
14
14
|
const Element = styled('div', {
|
|
15
15
|
name: 'MuiDataGrid',
|
|
16
16
|
slot: 'Main',
|
|
17
|
-
overridesResolver: (props, styles) =>
|
|
17
|
+
overridesResolver: (props, styles) => {
|
|
18
|
+
const {
|
|
19
|
+
ownerState
|
|
20
|
+
} = props;
|
|
21
|
+
return [styles.main, ownerState.hasPinnedRight && styles['main--hasPinnedRight'], ownerState.loadingOverlayVariant === 'skeleton' && styles['main--hasSkeletonLoadingOverlay']];
|
|
22
|
+
}
|
|
18
23
|
})({
|
|
19
24
|
flexGrow: 1,
|
|
20
25
|
position: 'relative',
|
|
@@ -23,11 +28,14 @@ const Element = styled('div', {
|
|
|
23
28
|
flexDirection: 'column'
|
|
24
29
|
});
|
|
25
30
|
export const GridMainContainer = forwardRef((props, ref) => {
|
|
31
|
+
const {
|
|
32
|
+
ownerState
|
|
33
|
+
} = props;
|
|
26
34
|
const rootProps = useGridRootProps();
|
|
27
35
|
const configuration = useGridConfiguration();
|
|
28
36
|
const ariaAttributes = configuration.hooks.useGridAriaAttributes();
|
|
29
37
|
return /*#__PURE__*/_jsxs(Element, _extends({
|
|
30
|
-
ownerState:
|
|
38
|
+
ownerState: ownerState,
|
|
31
39
|
className: props.className,
|
|
32
40
|
tabIndex: -1
|
|
33
41
|
}, ariaAttributes, rootProps.slotProps?.main, {
|
|
@@ -67,26 +67,27 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
67
67
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
68
68
|
const propertyDimension = props.position === 'vertical' ? 'height' : 'width';
|
|
69
69
|
const propertyScroll = props.position === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
|
70
|
+
const propertyScrollPosition = props.position === 'vertical' ? 'top' : 'left';
|
|
70
71
|
const hasScroll = props.position === 'vertical' ? dimensions.hasScrollX : dimensions.hasScrollY;
|
|
71
72
|
const contentSize = dimensions.minimumSize[propertyDimension] + (hasScroll ? dimensions.scrollbarSize : 0);
|
|
72
73
|
const scrollbarSize = props.position === 'vertical' ? dimensions.viewportInnerSize.height : dimensions.viewportOuterSize.width;
|
|
73
74
|
const scrollbarInnerSize = scrollbarSize * (contentSize / dimensions.viewportOuterSize[propertyDimension]);
|
|
74
75
|
const onScrollerScroll = useEventCallback(() => {
|
|
75
|
-
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
76
76
|
const scrollbar = scrollbarRef.current;
|
|
77
|
+
const scrollPosition = props.scrollPosition.current;
|
|
77
78
|
if (!scrollbar) {
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
|
-
if (
|
|
81
|
+
if (scrollPosition[propertyScrollPosition] === lastPosition.current) {
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
|
-
lastPosition.current =
|
|
84
|
+
lastPosition.current = scrollPosition[propertyScrollPosition];
|
|
84
85
|
if (isLocked.current) {
|
|
85
86
|
isLocked.current = false;
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
isLocked.current = true;
|
|
89
|
-
const value =
|
|
90
|
+
const value = scrollPosition[propertyScrollPosition] / contentSize;
|
|
90
91
|
scrollbar[propertyScroll] = value * scrollbarInnerSize;
|
|
91
92
|
});
|
|
92
93
|
const onScrollbarScroll = useEventCallback(() => {
|
|
@@ -107,7 +108,6 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
107
108
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
108
109
|
const scrollbar = scrollbarRef.current;
|
|
109
110
|
const options = {
|
|
110
|
-
capture: true,
|
|
111
111
|
passive: true
|
|
112
112
|
};
|
|
113
113
|
scroller.addEventListener('scroll', onScrollerScroll, options);
|
|
@@ -2,12 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { styled } from '@mui/system';
|
|
4
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { gridHasBottomFillerSelector, gridHasScrollXSelector, gridHasScrollYSelector } from "../../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
5
6
|
import { GridScrollArea } from "../GridScrollArea.js";
|
|
6
7
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
7
8
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
8
9
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
9
10
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
10
|
-
import { gridDimensionsSelector } from "../../hooks/features/dimensions/index.js";
|
|
11
11
|
import { useGridVirtualScroller } from "../../hooks/features/virtualization/useGridVirtualScroller.js";
|
|
12
12
|
import { useGridOverlays } from "../../hooks/features/overlays/useGridOverlays.js";
|
|
13
13
|
import { GridOverlays as Overlays } from "../base/GridOverlays.js";
|
|
@@ -20,20 +20,28 @@ import { GridVirtualScrollerFiller as SpaceFiller } from "./GridVirtualScrollerF
|
|
|
20
20
|
import { GridVirtualScrollerRenderZone as RenderZone } from "./GridVirtualScrollerRenderZone.js";
|
|
21
21
|
import { GridVirtualScrollbar as Scrollbar } from "./GridVirtualScrollbar.js";
|
|
22
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
const useUtilityClasses =
|
|
23
|
+
const useUtilityClasses = ownerState => {
|
|
24
24
|
const {
|
|
25
|
-
classes
|
|
25
|
+
classes,
|
|
26
|
+
hasScrollX,
|
|
27
|
+
hasPinnedRight,
|
|
28
|
+
loadingOverlayVariant
|
|
26
29
|
} = ownerState;
|
|
27
30
|
const slots = {
|
|
28
|
-
root: ['main',
|
|
29
|
-
scroller: ['virtualScroller',
|
|
31
|
+
root: ['main', hasPinnedRight && 'main--hasPinnedRight', loadingOverlayVariant === 'skeleton' && 'main--hasSkeletonLoadingOverlay'],
|
|
32
|
+
scroller: ['virtualScroller', hasScrollX && 'virtualScroller--hasScrollX']
|
|
30
33
|
};
|
|
31
34
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
32
35
|
};
|
|
33
36
|
const Scroller = styled('div', {
|
|
34
37
|
name: 'MuiDataGrid',
|
|
35
38
|
slot: 'VirtualScroller',
|
|
36
|
-
overridesResolver: (props, styles) =>
|
|
39
|
+
overridesResolver: (props, styles) => {
|
|
40
|
+
const {
|
|
41
|
+
ownerState
|
|
42
|
+
} = props;
|
|
43
|
+
return [styles.virtualScroller, ownerState.hasScrollX && styles['virtualScroller--hasScrollX']];
|
|
44
|
+
}
|
|
37
45
|
})({
|
|
38
46
|
position: 'relative',
|
|
39
47
|
height: '100%',
|
|
@@ -51,12 +59,22 @@ const Scroller = styled('div', {
|
|
|
51
59
|
// See https://github.com/mui/mui-x/issues/10547
|
|
52
60
|
zIndex: 0
|
|
53
61
|
});
|
|
62
|
+
const hasPinnedRightSelector = state => state.dimensions.rightPinnedWidth > 0;
|
|
54
63
|
function GridVirtualScroller(props) {
|
|
55
64
|
const apiRef = useGridApiContext();
|
|
56
65
|
const rootProps = useGridRootProps();
|
|
57
|
-
const
|
|
66
|
+
const hasScrollY = useGridSelector(apiRef, gridHasScrollYSelector);
|
|
67
|
+
const hasScrollX = useGridSelector(apiRef, gridHasScrollXSelector);
|
|
68
|
+
const hasPinnedRight = useGridSelector(apiRef, hasPinnedRightSelector);
|
|
69
|
+
const hasBottomFiller = useGridSelector(apiRef, gridHasBottomFillerSelector);
|
|
58
70
|
const overlaysProps = useGridOverlays();
|
|
59
|
-
const
|
|
71
|
+
const ownerState = {
|
|
72
|
+
classes: rootProps.classes,
|
|
73
|
+
hasScrollX,
|
|
74
|
+
hasPinnedRight,
|
|
75
|
+
loadingOverlayVariant: overlaysProps.loadingOverlayVariant
|
|
76
|
+
};
|
|
77
|
+
const classes = useUtilityClasses(ownerState);
|
|
60
78
|
const virtualScroller = useGridVirtualScroller();
|
|
61
79
|
const {
|
|
62
80
|
getContainerProps,
|
|
@@ -65,20 +83,22 @@ function GridVirtualScroller(props) {
|
|
|
65
83
|
getRenderZoneProps,
|
|
66
84
|
getScrollbarVerticalProps,
|
|
67
85
|
getScrollbarHorizontalProps,
|
|
68
|
-
getRows
|
|
86
|
+
getRows,
|
|
87
|
+
getScrollAreaProps
|
|
69
88
|
} = virtualScroller;
|
|
70
89
|
const rows = getRows();
|
|
71
90
|
return /*#__PURE__*/_jsxs(Container, _extends({
|
|
72
91
|
className: classes.root
|
|
73
92
|
}, getContainerProps(), {
|
|
74
|
-
|
|
93
|
+
ownerState: ownerState,
|
|
94
|
+
children: [/*#__PURE__*/_jsx(GridScrollArea, _extends({
|
|
75
95
|
scrollDirection: "left"
|
|
76
|
-
}), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
96
|
+
}, getScrollAreaProps())), /*#__PURE__*/_jsx(GridScrollArea, _extends({
|
|
77
97
|
scrollDirection: "right"
|
|
78
|
-
}), /*#__PURE__*/_jsxs(Scroller, _extends({
|
|
98
|
+
}, getScrollAreaProps())), /*#__PURE__*/_jsxs(Scroller, _extends({
|
|
79
99
|
className: classes.scroller
|
|
80
100
|
}, getScrollerProps(), {
|
|
81
|
-
ownerState:
|
|
101
|
+
ownerState: ownerState,
|
|
82
102
|
children: [/*#__PURE__*/_jsxs(TopContainer, {
|
|
83
103
|
children: [!rootProps.unstable_listView && /*#__PURE__*/_jsx(GridHeaders, {}), /*#__PURE__*/_jsx(rootProps.slots.pinnedRows, {
|
|
84
104
|
position: "top",
|
|
@@ -90,7 +110,7 @@ function GridVirtualScroller(props) {
|
|
|
90
110
|
virtualScroller: virtualScroller
|
|
91
111
|
})]
|
|
92
112
|
}))
|
|
93
|
-
})), /*#__PURE__*/_jsx(SpaceFiller, {
|
|
113
|
+
})), hasBottomFiller && /*#__PURE__*/_jsx(SpaceFiller, {
|
|
94
114
|
rowsLength: rows.length
|
|
95
115
|
}), /*#__PURE__*/_jsx(BottomContainer, {
|
|
96
116
|
children: /*#__PURE__*/_jsx(rootProps.slots.pinnedRows, {
|
|
@@ -98,9 +118,9 @@ function GridVirtualScroller(props) {
|
|
|
98
118
|
virtualScroller: virtualScroller
|
|
99
119
|
})
|
|
100
120
|
})]
|
|
101
|
-
})),
|
|
121
|
+
})), hasScrollX && !rootProps.unstable_listView && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
102
122
|
position: "horizontal"
|
|
103
|
-
}, getScrollbarHorizontalProps())),
|
|
123
|
+
}, getScrollbarHorizontalProps())), hasScrollY && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
104
124
|
position: "vertical"
|
|
105
125
|
}, getScrollbarVerticalProps())), props.children]
|
|
106
126
|
}));
|
|
@@ -19,14 +19,23 @@ const useUtilityClasses = (props, overflowedContent) => {
|
|
|
19
19
|
const VirtualScrollerContentRoot = styled('div', {
|
|
20
20
|
name: 'MuiDataGrid',
|
|
21
21
|
slot: 'VirtualScrollerContent',
|
|
22
|
-
overridesResolver: (props, styles) =>
|
|
22
|
+
overridesResolver: (props, styles) => {
|
|
23
|
+
const {
|
|
24
|
+
ownerState
|
|
25
|
+
} = props;
|
|
26
|
+
return [styles.virtualScrollerContent, ownerState.overflowedContent && styles['virtualScrollerContent--overflowed']];
|
|
27
|
+
}
|
|
23
28
|
})({});
|
|
24
29
|
const GridVirtualScrollerContent = forwardRef(function GridVirtualScrollerContent(props, ref) {
|
|
25
30
|
const rootProps = useGridRootProps();
|
|
26
31
|
const overflowedContent = !rootProps.autoHeight && props.style?.minHeight === 'auto';
|
|
27
32
|
const classes = useUtilityClasses(rootProps, overflowedContent);
|
|
33
|
+
const ownerState = {
|
|
34
|
+
classes: rootProps.classes,
|
|
35
|
+
overflowedContent
|
|
36
|
+
};
|
|
28
37
|
return /*#__PURE__*/_jsx(VirtualScrollerContentRoot, _extends({}, props, {
|
|
29
|
-
ownerState:
|
|
38
|
+
ownerState: ownerState,
|
|
30
39
|
className: clsx(classes.root, props.className),
|
|
31
40
|
ref: ref
|
|
32
41
|
}));
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from "../../utils/useFirstRender.js";
|
|
3
|
-
export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
3
|
+
export const useGridRegisterPipeProcessor = (apiRef, group, callback, enabled = true) => {
|
|
4
4
|
const cleanup = React.useRef(null);
|
|
5
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
6
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
7
7
|
cleanup.current = apiRef.current.registerPipeProcessor(group, id.current, callback);
|
|
8
8
|
}, [apiRef, callback, group]);
|
|
9
9
|
useFirstRender(() => {
|
|
10
|
-
|
|
10
|
+
if (enabled) {
|
|
11
|
+
registerPreProcessor();
|
|
12
|
+
}
|
|
11
13
|
});
|
|
12
14
|
const isFirstRender = React.useRef(true);
|
|
13
15
|
React.useEffect(() => {
|
|
14
16
|
if (isFirstRender.current) {
|
|
15
17
|
isFirstRender.current = false;
|
|
16
|
-
} else {
|
|
18
|
+
} else if (enabled) {
|
|
17
19
|
registerPreProcessor();
|
|
18
20
|
}
|
|
19
21
|
return () => {
|
|
@@ -22,5 +24,5 @@ export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
|
22
24
|
cleanup.current = null;
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
|
-
}, [registerPreProcessor]);
|
|
27
|
+
}, [registerPreProcessor, enabled]);
|
|
26
28
|
};
|
|
@@ -4,7 +4,6 @@ import { useGridApiMethod } from "../utils/index.js";
|
|
|
4
4
|
import { isFunction } from "../../utils/utils.js";
|
|
5
5
|
export const useGridStateInitialization = apiRef => {
|
|
6
6
|
const controlStateMapRef = React.useRef({});
|
|
7
|
-
const [, rawForceUpdate] = React.useState();
|
|
8
7
|
const registerControlState = React.useCallback(controlStateItem => {
|
|
9
8
|
controlStateMapRef.current[controlStateItem.stateId] = controlStateItem;
|
|
10
9
|
}, []);
|
|
@@ -79,7 +78,9 @@ export const useGridStateInitialization = apiRef => {
|
|
|
79
78
|
});
|
|
80
79
|
}, reason);
|
|
81
80
|
}, [apiRef]);
|
|
82
|
-
const forceUpdate = React.useCallback(() =>
|
|
81
|
+
const forceUpdate = React.useCallback(() => {
|
|
82
|
+
// @deprecated - do nothing
|
|
83
|
+
}, []);
|
|
83
84
|
const publicStateApi = {
|
|
84
85
|
setState,
|
|
85
86
|
forceUpdate
|