@mui/x-data-grid 7.24.0 → 7.25.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.d.ts +2 -1
- package/components/GridRow.d.ts +0 -1
- package/components/GridRow.js +25 -19
- package/components/cell/GridCell.d.ts +9 -6
- package/components/cell/GridCell.js +29 -52
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/components/containers/GridRootStyles.js +135 -37
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
- package/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/components/toolbar/GridToolbarFilterButton.js +8 -2
- 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 +18 -5
- package/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/context/GridContextProvider.d.ts +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
- package/hooks/core/useGridApiInitialization.d.ts +2 -2
- package/hooks/core/useGridInitialization.d.ts +2 -2
- package/hooks/core/useGridIsRtl.d.ts +2 -2
- package/hooks/core/useGridLocaleText.d.ts +2 -2
- package/hooks/core/useGridLoggerFactory.d.ts +2 -2
- package/hooks/core/useGridRefs.d.ts +2 -2
- package/hooks/core/useGridStateInitialization.d.ts +2 -2
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +4 -4
- package/hooks/features/columns/useGridColumnSpanning.d.ts +2 -2
- package/hooks/features/columns/useGridColumns.d.ts +2 -2
- package/hooks/features/columns/useGridColumns.js +7 -3
- package/hooks/features/density/useGridDensity.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +7 -11
- package/hooks/features/editing/gridEditingSelectors.d.ts +6 -0
- package/hooks/features/editing/gridEditingSelectors.js +7 -1
- package/hooks/features/editing/index.d.ts +1 -1
- package/hooks/features/editing/index.js +1 -1
- package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.js +5 -6
- package/hooks/features/events/useGridEvents.d.ts +2 -2
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -1
- package/hooks/features/export/useGridCsvExport.d.ts +2 -2
- package/hooks/features/export/useGridPrintExport.d.ts +2 -2
- package/hooks/features/export/utils.d.ts +2 -2
- package/hooks/features/filter/gridFilterUtils.d.ts +7 -7
- package/hooks/features/filter/gridFilterUtils.js +3 -3
- package/hooks/features/filter/useGridFilter.d.ts +2 -2
- package/hooks/features/focus/useGridFocus.d.ts +2 -2
- package/hooks/features/focus/useGridFocus.js +3 -2
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -4
- package/hooks/features/keyboardNavigation/utils.js +0 -5
- package/hooks/features/listView/useGridListView.d.ts +2 -2
- package/hooks/features/listView/useGridListView.js +2 -1
- package/hooks/features/pagination/useGridPagination.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/hooks/features/preferencesPanel/index.d.ts +1 -1
- package/hooks/features/preferencesPanel/index.js +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
- package/hooks/features/rowSelection/utils.d.ts +3 -2
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
- package/hooks/features/rows/useGridParamsApi.js +33 -14
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
- package/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +7 -8
- package/hooks/features/rows/useGridRowsMeta.d.ts +2 -2
- package/hooks/features/rows/useGridRowsMeta.js +3 -2
- package/hooks/features/rows/useGridRowsPreProcessors.d.ts +2 -2
- package/hooks/features/scroll/useGridScroll.d.ts +2 -2
- package/hooks/features/sorting/gridSortingUtils.d.ts +3 -3
- package/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/hooks/features/sorting/useGridSorting.d.ts +2 -2
- package/hooks/features/statePersistence/useGridStatePersistence.d.ts +2 -2
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +9 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
- package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/hooks/utils/useGridApiContext.d.ts +2 -2
- package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
- package/hooks/utils/useGridApiMethod.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +2 -2
- package/hooks/utils/useGridApiRef.js +3 -1
- package/hooks/utils/useGridInitializeState.d.ts +3 -3
- package/hooks/utils/useGridLogger.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
- package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
- package/hooks/utils/useGridSelector.d.ts +3 -3
- package/hooks/utils/useGridVisibleRows.d.ts +3 -3
- package/index.js +1 -1
- package/locales/faIR.js +5 -6
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +29 -2
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/colDef/gridColDef.d.ts +9 -8
- package/models/gridExport.d.ts +2 -2
- package/models/gridFilterOperator.d.ts +2 -1
- package/models/props/DataGridProps.d.ts +2 -1
- package/modern/DataGrid/DataGrid.js +1 -7
- package/modern/components/GridRow.js +25 -19
- package/modern/components/cell/GridCell.js +29 -52
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/modern/components/containers/GridRootStyles.js +135 -37
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/modern/components/virtualization/GridMainContainer.js +10 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/modern/components/virtualization/GridVirtualScroller.js +18 -5
- package/modern/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/columns/useGridColumns.js +7 -3
- package/modern/hooks/features/dimensions/useGridDimensions.js +7 -11
- package/modern/hooks/features/editing/gridEditingSelectors.js +7 -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 +5 -6
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
- 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/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/modern/hooks/features/preferencesPanel/index.js +1 -1
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- 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 +3 -2
- package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +32 -53
- package/modern/hooks/utils/useGridApiRef.js +3 -1
- package/modern/index.js +1 -1
- package/modern/locales/faIR.js +5 -6
- package/modern/models/api/index.js +0 -1
- package/modern/utils/isJSDOM.js +1 -0
- package/modern/utils/roundToDecimalPlaces.js +3 -0
- package/modern/utils/utils.js +6 -1
- package/node/DataGrid/DataGrid.js +1 -7
- package/node/components/GridRow.js +22 -16
- package/node/components/cell/GridCell.js +27 -50
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- package/node/components/containers/GridRootStyles.js +135 -37
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/toolbar/GridToolbarColumnsButton.js +8 -2
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/node/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +8 -2
- package/node/components/virtualization/GridMainContainer.js +10 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/node/components/virtualization/GridVirtualScroller.js +18 -5
- package/node/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/node/hooks/features/columns/useGridColumns.js +7 -3
- package/node/hooks/features/dimensions/useGridDimensions.js +9 -13
- package/node/hooks/features/editing/gridEditingSelectors.js +8 -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 +3 -4
- package/node/hooks/features/filter/gridFilterUtils.js +3 -3
- 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/preferencesPanel/gridPreferencePanelSelector.js +9 -2
- package/node/hooks/features/preferencesPanel/index.js +11 -10
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- 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 +5 -4
- package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +34 -55
- package/node/hooks/utils/useGridApiRef.js +3 -1
- package/node/index.js +1 -1
- package/node/locales/faIR.js +5 -6
- package/node/models/api/index.js +0 -11
- package/node/utils/isJSDOM.js +7 -0
- package/node/utils/roundToDecimalPlaces.js +9 -0
- package/node/utils/utils.js +8 -1
- package/package.json +2 -2
- package/utils/createSelector.d.ts +3 -3
- package/utils/getPublicApiRef.d.ts +2 -1
- package/utils/isJSDOM.d.ts +1 -0
- package/utils/isJSDOM.js +1 -0
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["column", "rowId", "
|
|
3
|
+
const _excluded = ["column", "row", "rowId", "rowNode", "align", "children", "colIndex", "width", "className", "style", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "showRightBorder", "showLeftBorder", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
4
4
|
_excluded2 = ["changeReason", "unstable_updateValueOnRender"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -12,13 +12,14 @@ import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
|
12
12
|
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
13
13
|
import { getDataGridUtilityClass, gridClasses } from "../../constants/gridClasses.js";
|
|
14
14
|
import { GridCellModes } from "../../models/index.js";
|
|
15
|
-
import { useGridSelector,
|
|
16
|
-
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
15
|
+
import { useGridSelector, useGridSelectorV8 } from "../../hooks/utils/useGridSelector.js";
|
|
17
16
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
18
|
-
import { gridFocusCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
|
|
17
|
+
import { gridFocusCellSelector, gridTabIndexCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
|
|
19
18
|
import { GridPinnedColumnPosition } from "../../hooks/features/columns/gridColumnsInterfaces.js";
|
|
20
19
|
import { PinnedColumnPosition } from "../../internals/constants.js";
|
|
21
20
|
import { gridRowSpanningHiddenCellsSelector, gridRowSpanningSpannedCellsSelector } from "../../hooks/features/rows/gridRowSpanningSelectors.js";
|
|
21
|
+
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
22
|
+
import { gridEditCellStateSelector } from "../../hooks/features/editing/gridEditingSelectors.js";
|
|
22
23
|
import { attachPinnedStyle } from "../../internals/utils/index.js";
|
|
23
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
25
|
export const gridPinnedColumnPositionLookup = {
|
|
@@ -27,30 +28,6 @@ export const gridPinnedColumnPositionLookup = {
|
|
|
27
28
|
[PinnedColumnPosition.NONE]: undefined,
|
|
28
29
|
[PinnedColumnPosition.VIRTUAL]: undefined
|
|
29
30
|
};
|
|
30
|
-
const EMPTY_CELL_PARAMS = {
|
|
31
|
-
id: -1,
|
|
32
|
-
field: '__unset__',
|
|
33
|
-
row: {},
|
|
34
|
-
rowNode: {
|
|
35
|
-
id: -1,
|
|
36
|
-
depth: 0,
|
|
37
|
-
type: 'leaf',
|
|
38
|
-
parent: -1,
|
|
39
|
-
groupingKey: null
|
|
40
|
-
},
|
|
41
|
-
colDef: {
|
|
42
|
-
type: 'string',
|
|
43
|
-
field: '__unset__',
|
|
44
|
-
computedWidth: 0
|
|
45
|
-
},
|
|
46
|
-
cellMode: GridCellModes.View,
|
|
47
|
-
hasFocus: false,
|
|
48
|
-
tabIndex: -1,
|
|
49
|
-
value: null,
|
|
50
|
-
formattedValue: '__unset__',
|
|
51
|
-
isEditable: false,
|
|
52
|
-
api: {}
|
|
53
|
-
};
|
|
54
31
|
const useUtilityClasses = ownerState => {
|
|
55
32
|
const {
|
|
56
33
|
align,
|
|
@@ -74,8 +51,9 @@ let warnedOnce = false;
|
|
|
74
51
|
const GridCell = forwardRef(function GridCell(props, ref) {
|
|
75
52
|
const {
|
|
76
53
|
column,
|
|
54
|
+
row,
|
|
77
55
|
rowId,
|
|
78
|
-
|
|
56
|
+
rowNode,
|
|
79
57
|
align,
|
|
80
58
|
colIndex,
|
|
81
59
|
width,
|
|
@@ -99,22 +77,29 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
99
77
|
onDragOver
|
|
100
78
|
} = props,
|
|
101
79
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
102
|
-
const apiRef =
|
|
80
|
+
const apiRef = useGridPrivateApiContext();
|
|
103
81
|
const rootProps = useGridRootProps();
|
|
104
82
|
const isRtl = useRtl();
|
|
105
83
|
const field = column.field;
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
84
|
+
const editCellState = useGridSelectorV8(apiRef, gridEditCellStateSelector, {
|
|
85
|
+
rowId,
|
|
86
|
+
field
|
|
87
|
+
});
|
|
88
|
+
const cellMode = editCellState ? GridCellModes.Edit : GridCellModes.View;
|
|
89
|
+
const cellParams = apiRef.current.getCellParamsForRow(rowId, field, row, {
|
|
90
|
+
colDef: column,
|
|
91
|
+
cellMode,
|
|
92
|
+
rowNode: rowNode,
|
|
93
|
+
tabIndex: useGridSelector(apiRef, () => {
|
|
94
|
+
const cellTabIndex = gridTabIndexCellSelector(apiRef);
|
|
95
|
+
return cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === rowId ? 0 : -1;
|
|
96
|
+
}),
|
|
97
|
+
hasFocus: useGridSelector(apiRef, () => {
|
|
98
|
+
const focus = gridFocusCellSelector(apiRef);
|
|
99
|
+
return focus?.id === rowId && focus.field === field;
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
cellParams.api = apiRef.current;
|
|
118
103
|
const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
|
|
119
104
|
id: rowId,
|
|
120
105
|
field
|
|
@@ -122,7 +107,6 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
122
107
|
const hiddenCells = useGridSelector(apiRef, gridRowSpanningHiddenCellsSelector);
|
|
123
108
|
const spannedCells = useGridSelector(apiRef, gridRowSpanningSpannedCellsSelector);
|
|
124
109
|
const {
|
|
125
|
-
cellMode,
|
|
126
110
|
hasFocus,
|
|
127
111
|
isEditable = false,
|
|
128
112
|
value
|
|
@@ -244,9 +228,6 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
244
228
|
}, style)
|
|
245
229
|
});
|
|
246
230
|
}
|
|
247
|
-
if (cellParams === EMPTY_CELL_PARAMS) {
|
|
248
|
-
return null;
|
|
249
|
-
}
|
|
250
231
|
let handleFocus = other.onFocus;
|
|
251
232
|
if (process.env.NODE_ENV === 'test' && rootProps.experimentalFeatures?.warnIfFocusStateIsNotSynced) {
|
|
252
233
|
handleFocus = event => {
|
|
@@ -330,16 +311,12 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
330
311
|
colSpan: PropTypes.number,
|
|
331
312
|
column: PropTypes.object.isRequired,
|
|
332
313
|
disableDragEvents: PropTypes.bool,
|
|
333
|
-
editCellState: PropTypes.shape({
|
|
334
|
-
changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
335
|
-
isProcessingProps: PropTypes.bool,
|
|
336
|
-
isValidating: PropTypes.bool,
|
|
337
|
-
value: PropTypes.any
|
|
338
|
-
}),
|
|
339
314
|
isNotVisible: PropTypes.bool.isRequired,
|
|
340
315
|
pinnedOffset: PropTypes.number,
|
|
341
316
|
pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]).isRequired,
|
|
317
|
+
row: PropTypes.object.isRequired,
|
|
342
318
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
319
|
+
rowNode: PropTypes.object.isRequired,
|
|
343
320
|
showLeftBorder: PropTypes.bool.isRequired,
|
|
344
321
|
showRightBorder: PropTypes.bool.isRequired,
|
|
345
322
|
width: PropTypes.number.isRequired
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
5
|
-
import {
|
|
6
|
-
import { gridPreferencePanelStateSelector } from "../../hooks/features/preferencesPanel/gridPreferencePanelSelector.js";
|
|
5
|
+
import { useGridSelectorV8 } from "../../hooks/utils/useGridSelector.js";
|
|
6
|
+
import { gridPreferencePanelSelectorWithLabel, gridPreferencePanelStateSelector } from "../../hooks/features/preferencesPanel/gridPreferencePanelSelector.js";
|
|
7
7
|
import { GridPreferencePanelsValue } from "../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js";
|
|
8
8
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
9
9
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
@@ -19,6 +19,21 @@ const useUtilityClasses = ownerState => {
|
|
|
19
19
|
};
|
|
20
20
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
21
21
|
};
|
|
22
|
+
function GridColumnHeaderFilterIconButtonWrapped(props) {
|
|
23
|
+
if (!props.counter) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/_jsx(GridColumnHeaderFilterIconButton, _extends({}, props));
|
|
27
|
+
}
|
|
28
|
+
process.env.NODE_ENV !== "production" ? GridColumnHeaderFilterIconButtonWrapped.propTypes = {
|
|
29
|
+
// ----------------------------- Warning --------------------------------
|
|
30
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
31
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
32
|
+
// ----------------------------------------------------------------------
|
|
33
|
+
counter: PropTypes.number,
|
|
34
|
+
field: PropTypes.string.isRequired,
|
|
35
|
+
onClick: PropTypes.func
|
|
36
|
+
} : void 0;
|
|
22
37
|
function GridColumnHeaderFilterIconButton(props) {
|
|
23
38
|
const {
|
|
24
39
|
counter,
|
|
@@ -31,8 +46,8 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
31
46
|
classes: rootProps.classes
|
|
32
47
|
});
|
|
33
48
|
const classes = useUtilityClasses(ownerState);
|
|
34
|
-
const preferencePanel = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
35
49
|
const labelId = useId();
|
|
50
|
+
const isOpen = useGridSelectorV8(apiRef, gridPreferencePanelSelectorWithLabel, labelId);
|
|
36
51
|
const panelId = useId();
|
|
37
52
|
const toggleFilter = React.useCallback(event => {
|
|
38
53
|
event.preventDefault();
|
|
@@ -53,7 +68,6 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
53
68
|
if (!counter) {
|
|
54
69
|
return null;
|
|
55
70
|
}
|
|
56
|
-
const open = preferencePanel.open && preferencePanel.labelId === labelId;
|
|
57
71
|
const iconButton = /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
58
72
|
id: labelId,
|
|
59
73
|
onClick: toggleFilter,
|
|
@@ -62,8 +76,8 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
62
76
|
size: "small",
|
|
63
77
|
tabIndex: -1,
|
|
64
78
|
"aria-haspopup": "menu",
|
|
65
|
-
"aria-expanded":
|
|
66
|
-
"aria-controls":
|
|
79
|
+
"aria-expanded": isOpen,
|
|
80
|
+
"aria-controls": isOpen ? panelId : undefined
|
|
67
81
|
}, rootProps.slotProps?.baseIconButton, {
|
|
68
82
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnFilteredIcon, {
|
|
69
83
|
className: classes.icon,
|
|
@@ -92,4 +106,4 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderFilterIconButton.propTyp
|
|
|
92
106
|
field: PropTypes.string.isRequired,
|
|
93
107
|
onClick: PropTypes.func
|
|
94
108
|
} : void 0;
|
|
95
|
-
export { GridColumnHeaderFilterIconButton };
|
|
109
|
+
export { GridColumnHeaderFilterIconButtonWrapped as GridColumnHeaderFilterIconButton };
|
|
@@ -38,50 +38,76 @@ const ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-wa
|
|
|
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,75 +116,151 @@ 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
|
}) => {
|
|
@@ -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'
|
|
@@ -91,7 +91,8 @@ const GridPanel = forwardRef((props, ref) => {
|
|
|
91
91
|
}, other, {
|
|
92
92
|
ref: ref,
|
|
93
93
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
94
|
-
mouseEvent: "
|
|
94
|
+
mouseEvent: "onPointerUp",
|
|
95
|
+
touchEvent: false,
|
|
95
96
|
onClickAway: handleClickAway,
|
|
96
97
|
children: /*#__PURE__*/_jsx(GridPaperRoot, {
|
|
97
98
|
className: classes.paper,
|
|
@@ -45,9 +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
|
-
onClick: showColumns
|
|
48
|
+
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
50
49
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
50
|
+
onPointerUp: event => {
|
|
51
|
+
if (preferencePanel.open) {
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
}
|
|
54
|
+
buttonProps.onPointerUp?.(event);
|
|
55
|
+
},
|
|
56
|
+
onClick: showColumns,
|
|
51
57
|
ref: ref,
|
|
52
58
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
53
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,9 +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
|
-
}))
|
|
113
|
-
onClick: toggleFilter
|
|
112
|
+
}))
|
|
114
113
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
114
|
+
onClick: toggleFilter,
|
|
115
|
+
onPointerUp: event => {
|
|
116
|
+
if (preferencePanel.open) {
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
}
|
|
119
|
+
buttonProps.onPointerUp?.(event);
|
|
120
|
+
},
|
|
115
121
|
ref: ref,
|
|
116
122
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
117
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.dimensions.rightPinnedWidth > 0 && 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);
|