@mui/x-data-grid 7.23.6 → 7.24.1
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 +150 -0
- package/DataGrid/DataGrid.js +4 -5
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/DataGrid/useDataGridComponent.js +1 -1
- package/components/GridHeaders.js +2 -2
- package/components/GridRow.d.ts +5 -9
- package/components/GridRow.js +28 -105
- package/components/GridSkeletonLoadingOverlay.js +18 -18
- package/components/cell/GridCell.d.ts +9 -16
- package/components/cell/GridCell.js +17 -35
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -5
- package/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -5
- package/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/components/containers/GridRoot.d.ts +2 -2
- package/components/containers/GridRoot.js +14 -6
- package/components/containers/GridRootStyles.js +1 -0
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
- package/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/components/virtualization/GridVirtualScroller.js +4 -4
- 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/columnHeaders/useGridColumnHeaders.d.ts +5 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- 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 +4 -2
- 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/density/useGridDensity.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
- package/hooks/features/editing/useGridEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
- 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/gridFilterSelector.js +6 -1
- 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/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -3
- package/hooks/features/listView/useGridListView.d.ts +2 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +3 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +20 -1
- package/hooks/features/pagination/gridPaginationSelector.js +39 -1
- package/hooks/features/pagination/useGridPagination.d.ts +3 -3
- package/hooks/features/pagination/useGridPagination.js +5 -3
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.js +23 -1
- 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/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/gridRowsSelector.js +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +2 -2
- package/hooks/features/rows/useGridRowsMeta.d.ts +2 -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.d.ts +6 -0
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
- 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 +8 -6
- package/hooks/utils/useGridVisibleRows.js +5 -28
- package/index.js +1 -1
- package/internals/constants.d.ts +6 -0
- package/internals/constants.js +8 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/utils/attachPinnedStyle.d.ts +2 -0
- package/internals/utils/attachPinnedStyle.js +9 -0
- package/internals/utils/getPinnedCellOffset.d.ts +3 -3
- package/internals/utils/getPinnedCellOffset.js +6 -7
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/locales/faIR.js +5 -6
- package/locales/urPK.js +9 -10
- package/models/colDef/gridColDef.d.ts +9 -8
- package/models/events/gridEventLookup.d.ts +6 -1
- package/models/gridExport.d.ts +2 -2
- package/models/gridFilterOperator.d.ts +2 -1
- package/models/gridStateCommunity.d.ts +4 -0
- package/models/props/DataGridProps.d.ts +2 -1
- package/modern/DataGrid/DataGrid.js +4 -5
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/components/GridHeaders.js +2 -2
- package/modern/components/GridRow.js +28 -105
- package/modern/components/GridSkeletonLoadingOverlay.js +18 -18
- package/modern/components/cell/GridCell.js +17 -35
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/modern/components/containers/GridRoot.js +14 -6
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/modern/components/virtualization/GridVirtualScroller.js +4 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/modern/hooks/features/filter/gridFilterSelector.js +6 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
- package/modern/hooks/features/pagination/gridPaginationSelector.js +39 -1
- package/modern/hooks/features/pagination/useGridPagination.js +5 -3
- package/modern/hooks/features/pagination/useGridPaginationModel.js +23 -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/rows/gridRowsSelector.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +2 -2
- package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
- package/modern/hooks/utils/useGridApiRef.js +3 -1
- package/modern/hooks/utils/useGridVisibleRows.js +5 -28
- package/modern/index.js +1 -1
- package/modern/internals/constants.js +8 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/attachPinnedStyle.js +9 -0
- package/modern/internals/utils/getPinnedCellOffset.js +6 -7
- package/modern/internals/utils/index.js +2 -1
- package/modern/locales/faIR.js +5 -6
- package/modern/locales/urPK.js +9 -10
- package/modern/utils/cellBorderUtils.js +5 -5
- package/modern/utils/domUtils.js +7 -2
- package/modern/utils/isJSDOM.js +1 -0
- package/modern/utils/rtlFlipSide.js +22 -0
- package/node/DataGrid/DataGrid.js +2 -3
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/components/GridHeaders.js +2 -2
- package/node/components/GridRow.js +27 -104
- package/node/components/GridSkeletonLoadingOverlay.js +17 -17
- package/node/components/cell/GridCell.js +18 -36
- package/node/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- package/node/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/containers/GridRoot.js +14 -6
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/node/components/virtualization/GridVirtualScroller.js +4 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +32 -74
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/node/hooks/features/filter/gridFilterSelector.js +6 -1
- package/node/hooks/features/filter/gridFilterUtils.js +3 -3
- package/node/hooks/features/pagination/gridPaginationSelector.js +41 -3
- package/node/hooks/features/pagination/useGridPagination.js +5 -3
- package/node/hooks/features/pagination/useGridPaginationModel.js +23 -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/rows/gridRowsSelector.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +49 -0
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +94 -52
- package/node/hooks/utils/useGridApiRef.js +3 -1
- package/node/hooks/utils/useGridVisibleRows.js +3 -28
- package/node/index.js +1 -1
- package/node/internals/constants.js +9 -2
- package/node/internals/index.js +12 -0
- package/node/internals/utils/attachPinnedStyle.js +15 -0
- package/node/internals/utils/getPinnedCellOffset.js +6 -7
- package/node/internals/utils/index.js +11 -0
- package/node/locales/faIR.js +5 -6
- package/node/locales/urPK.js +9 -10
- package/node/utils/cellBorderUtils.js +5 -5
- package/node/utils/domUtils.js +7 -2
- package/node/utils/isJSDOM.js +7 -0
- package/node/utils/rtlFlipSide.js +29 -0
- package/package.json +2 -2
- package/utils/cellBorderUtils.d.ts +3 -3
- package/utils/cellBorderUtils.js +5 -5
- package/utils/createSelector.d.ts +3 -3
- package/utils/domUtils.js +7 -2
- package/utils/getPublicApiRef.d.ts +2 -1
- package/utils/isJSDOM.d.ts +1 -0
- package/utils/isJSDOM.js +1 -0
- package/utils/rtlFlipSide.d.ts +2 -0
- package/utils/rtlFlipSide.js +22 -0
|
@@ -2,12 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridRowId, GridEditCellProps } from '../../models';
|
|
3
3
|
import { GridColDef, GridAlignment } from '../../models/colDef/gridColDef';
|
|
4
4
|
import { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
5
|
-
|
|
6
|
-
NONE = 0,
|
|
7
|
-
LEFT = 1,
|
|
8
|
-
RIGHT = 2,
|
|
9
|
-
VIRTUAL = 3
|
|
10
|
-
}
|
|
5
|
+
import { PinnedColumnPosition } from '../../internals/constants';
|
|
11
6
|
export declare const gridPinnedColumnPositionLookup: {
|
|
12
7
|
1: GridPinnedColumnPosition;
|
|
13
8
|
2: GridPinnedColumnPosition;
|
|
@@ -25,11 +20,10 @@ export type GridCellProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
25
20
|
disableDragEvents?: boolean;
|
|
26
21
|
isNotVisible: boolean;
|
|
27
22
|
editCellState: GridEditCellProps<any> | null;
|
|
28
|
-
pinnedOffset
|
|
29
|
-
pinnedPosition:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
gridHasFiller: boolean;
|
|
23
|
+
pinnedOffset?: number;
|
|
24
|
+
pinnedPosition: PinnedColumnPosition;
|
|
25
|
+
showRightBorder: boolean;
|
|
26
|
+
showLeftBorder: boolean;
|
|
33
27
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
34
28
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
35
29
|
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
@@ -58,11 +52,10 @@ declare const MemoizedGridCell: React.ForwardRefExoticComponent<GridCellProps> |
|
|
|
58
52
|
disableDragEvents?: boolean;
|
|
59
53
|
isNotVisible: boolean;
|
|
60
54
|
editCellState: GridEditCellProps<any> | null;
|
|
61
|
-
pinnedOffset
|
|
62
|
-
pinnedPosition:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
gridHasFiller: boolean;
|
|
55
|
+
pinnedOffset?: number;
|
|
56
|
+
pinnedPosition: PinnedColumnPosition;
|
|
57
|
+
showRightBorder: boolean;
|
|
58
|
+
showLeftBorder: boolean;
|
|
66
59
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
67
60
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
68
61
|
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
@@ -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", "editCellState", "align", "children", "colIndex", "width", "className", "style", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "
|
|
3
|
+
const _excluded = ["column", "rowId", "editCellState", "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';
|
|
@@ -16,22 +16,16 @@ import { useGridSelector, objectShallowCompare } from "../../hooks/utils/useGrid
|
|
|
16
16
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
17
17
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
18
18
|
import { gridFocusCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
|
|
19
|
-
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../../utils/cellBorderUtils.js";
|
|
20
19
|
import { GridPinnedColumnPosition } from "../../hooks/features/columns/gridColumnsInterfaces.js";
|
|
20
|
+
import { PinnedColumnPosition } from "../../internals/constants.js";
|
|
21
21
|
import { gridRowSpanningHiddenCellsSelector, gridRowSpanningSpannedCellsSelector } from "../../hooks/features/rows/gridRowSpanningSelectors.js";
|
|
22
|
+
import { attachPinnedStyle } from "../../internals/utils/index.js";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
export let PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
|
|
24
|
-
PinnedPosition[PinnedPosition["NONE"] = 0] = "NONE";
|
|
25
|
-
PinnedPosition[PinnedPosition["LEFT"] = 1] = "LEFT";
|
|
26
|
-
PinnedPosition[PinnedPosition["RIGHT"] = 2] = "RIGHT";
|
|
27
|
-
PinnedPosition[PinnedPosition["VIRTUAL"] = 3] = "VIRTUAL";
|
|
28
|
-
return PinnedPosition;
|
|
29
|
-
}({});
|
|
30
24
|
export const gridPinnedColumnPositionLookup = {
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
25
|
+
[PinnedColumnPosition.LEFT]: GridPinnedColumnPosition.LEFT,
|
|
26
|
+
[PinnedColumnPosition.RIGHT]: GridPinnedColumnPosition.RIGHT,
|
|
27
|
+
[PinnedColumnPosition.NONE]: undefined,
|
|
28
|
+
[PinnedColumnPosition.VIRTUAL]: undefined
|
|
35
29
|
};
|
|
36
30
|
const EMPTY_CELL_PARAMS = {
|
|
37
31
|
id: -1,
|
|
@@ -69,7 +63,7 @@ const useUtilityClasses = ownerState => {
|
|
|
69
63
|
classes
|
|
70
64
|
} = ownerState;
|
|
71
65
|
const slots = {
|
|
72
|
-
root: ['cell', `cell--text${capitalize(align)}`, isSelected && 'selected', isEditable && 'cell--editable', showLeftBorder && 'cell--withLeftBorder', showRightBorder && 'cell--withRightBorder', pinnedPosition ===
|
|
66
|
+
root: ['cell', `cell--text${capitalize(align)}`, isSelected && 'selected', isEditable && 'cell--editable', showLeftBorder && 'cell--withLeftBorder', showRightBorder && 'cell--withRightBorder', pinnedPosition === PinnedColumnPosition.LEFT && 'cell--pinnedLeft', pinnedPosition === PinnedColumnPosition.RIGHT && 'cell--pinnedRight', isSelectionMode && !isEditable && 'cell--selectionMode']
|
|
73
67
|
};
|
|
74
68
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
75
69
|
};
|
|
@@ -92,9 +86,8 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
92
86
|
isNotVisible,
|
|
93
87
|
pinnedOffset,
|
|
94
88
|
pinnedPosition,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
gridHasFiller,
|
|
89
|
+
showRightBorder,
|
|
90
|
+
showLeftBorder,
|
|
98
91
|
onClick,
|
|
99
92
|
onDoubleClick,
|
|
100
93
|
onMouseDown,
|
|
@@ -161,9 +154,6 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
161
154
|
const handleRef = useForkRef(ref, cellRef);
|
|
162
155
|
const focusElementRef = React.useRef(null);
|
|
163
156
|
const isSelectionMode = rootProps.cellSelection ?? false;
|
|
164
|
-
const position = gridPinnedColumnPositionLookup[pinnedPosition];
|
|
165
|
-
const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
|
|
166
|
-
const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
167
157
|
const ownerState = {
|
|
168
158
|
align,
|
|
169
159
|
showLeftBorder,
|
|
@@ -212,18 +202,11 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
212
202
|
border: 0
|
|
213
203
|
};
|
|
214
204
|
}
|
|
215
|
-
const cellStyle = _extends({
|
|
205
|
+
const cellStyle = attachPinnedStyle(_extends({
|
|
216
206
|
'--width': `${width}px`
|
|
217
|
-
}, styleProp);
|
|
218
|
-
const isLeftPinned = pinnedPosition ===
|
|
219
|
-
const isRightPinned = pinnedPosition ===
|
|
220
|
-
if (isLeftPinned || isRightPinned) {
|
|
221
|
-
let side = isLeftPinned ? 'left' : 'right';
|
|
222
|
-
if (isRtl) {
|
|
223
|
-
side = isLeftPinned ? 'right' : 'left';
|
|
224
|
-
}
|
|
225
|
-
cellStyle[side] = pinnedOffset;
|
|
226
|
-
}
|
|
207
|
+
}, styleProp), isRtl, pinnedPosition, pinnedOffset);
|
|
208
|
+
const isLeftPinned = pinnedPosition === PinnedColumnPosition.LEFT;
|
|
209
|
+
const isRightPinned = pinnedPosition === PinnedColumnPosition.RIGHT;
|
|
227
210
|
if (rowSpan > 1) {
|
|
228
211
|
cellStyle.height = `calc(var(--height) * ${rowSpan})`;
|
|
229
212
|
cellStyle.zIndex = 5;
|
|
@@ -353,13 +336,12 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
353
336
|
isValidating: PropTypes.bool,
|
|
354
337
|
value: PropTypes.any
|
|
355
338
|
}),
|
|
356
|
-
gridHasFiller: PropTypes.bool.isRequired,
|
|
357
339
|
isNotVisible: PropTypes.bool.isRequired,
|
|
358
|
-
pinnedOffset: PropTypes.number
|
|
340
|
+
pinnedOffset: PropTypes.number,
|
|
359
341
|
pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]).isRequired,
|
|
360
342
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
361
|
-
|
|
362
|
-
|
|
343
|
+
showLeftBorder: PropTypes.bool.isRequired,
|
|
344
|
+
showRightBorder: PropTypes.bool.isRequired,
|
|
363
345
|
width: PropTypes.number.isRequired
|
|
364
346
|
} : void 0;
|
|
365
347
|
const MemoizedGridCell = fastMemo(GridCell);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PinnedColumnPosition } from '../../internals/constants';
|
|
3
3
|
interface GridColumnGroupHeaderProps {
|
|
4
4
|
groupId: string | null;
|
|
5
5
|
width: number;
|
|
@@ -11,11 +11,11 @@ interface GridColumnGroupHeaderProps {
|
|
|
11
11
|
height: number;
|
|
12
12
|
hasFocus?: boolean;
|
|
13
13
|
tabIndex: 0 | -1;
|
|
14
|
-
pinnedPosition?: GridPinnedColumnPosition;
|
|
15
14
|
style?: React.CSSProperties;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
showLeftBorder: boolean;
|
|
16
|
+
showRightBorder: boolean;
|
|
17
|
+
pinnedPosition: PinnedColumnPosition | undefined;
|
|
18
|
+
pinnedOffset?: number;
|
|
19
19
|
}
|
|
20
20
|
declare function GridColumnGroupHeader(props: GridColumnGroupHeaderProps): React.JSX.Element;
|
|
21
21
|
export { GridColumnGroupHeader };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_useId as useId, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
4
5
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
5
6
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
6
7
|
import { gridColumnGroupsLookupSelector } from "../../hooks/features/columnGrouping/gridColumnGroupsSelector.js";
|
|
@@ -8,7 +9,8 @@ import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
|
8
9
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
9
10
|
import { GridGenericColumnHeaderItem } from "./GridGenericColumnHeaderItem.js";
|
|
10
11
|
import { isEventTargetInPortal } from "../../utils/domUtils.js";
|
|
11
|
-
import {
|
|
12
|
+
import { PinnedColumnPosition } from "../../internals/constants.js";
|
|
13
|
+
import { attachPinnedStyle } from "../../internals/utils/index.js";
|
|
12
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
15
|
const useUtilityClasses = ownerState => {
|
|
14
16
|
const {
|
|
@@ -22,7 +24,7 @@ const useUtilityClasses = ownerState => {
|
|
|
22
24
|
pinnedPosition
|
|
23
25
|
} = ownerState;
|
|
24
26
|
const slots = {
|
|
25
|
-
root: ['columnHeader', headerAlign === 'left' && 'columnHeader--alignLeft', headerAlign === 'center' && 'columnHeader--alignCenter', headerAlign === 'right' && 'columnHeader--alignRight', isDragging && 'columnHeader--moving', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', 'withBorderColor', groupId === null ? 'columnHeader--emptyGroup' : 'columnHeader--filledGroup', pinnedPosition ===
|
|
27
|
+
root: ['columnHeader', headerAlign === 'left' && 'columnHeader--alignLeft', headerAlign === 'center' && 'columnHeader--alignCenter', headerAlign === 'right' && 'columnHeader--alignRight', isDragging && 'columnHeader--moving', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', 'withBorderColor', groupId === null ? 'columnHeader--emptyGroup' : 'columnHeader--filledGroup', pinnedPosition === PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight', isLastColumn && 'columnHeader--last'],
|
|
26
28
|
draggableContainer: ['columnHeaderDraggableContainer'],
|
|
27
29
|
titleContainer: ['columnHeaderTitleContainer', 'withBorderColor'],
|
|
28
30
|
titleContainerContent: ['columnHeaderTitleContainerContent']
|
|
@@ -42,12 +44,10 @@ function GridColumnGroupHeader(props) {
|
|
|
42
44
|
tabIndex,
|
|
43
45
|
isLastColumn,
|
|
44
46
|
pinnedPosition,
|
|
45
|
-
|
|
46
|
-
indexInSection,
|
|
47
|
-
sectionLength,
|
|
48
|
-
gridHasFiller
|
|
47
|
+
pinnedOffset
|
|
49
48
|
} = props;
|
|
50
49
|
const rootProps = useGridRootProps();
|
|
50
|
+
const isRtl = useRtl();
|
|
51
51
|
const headerCellRef = React.useRef(null);
|
|
52
52
|
const apiRef = useGridApiContext();
|
|
53
53
|
const columnGroupsLookup = useGridSelector(apiRef, gridColumnGroupsLookupSelector);
|
|
@@ -72,12 +72,8 @@ function GridColumnGroupHeader(props) {
|
|
|
72
72
|
if (groupId && render) {
|
|
73
73
|
headerComponent = render(renderParams);
|
|
74
74
|
}
|
|
75
|
-
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
76
|
-
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showColumnVerticalBorder, gridHasFiller);
|
|
77
75
|
const ownerState = _extends({}, props, {
|
|
78
76
|
classes: rootProps.classes,
|
|
79
|
-
showLeftBorder,
|
|
80
|
-
showRightBorder,
|
|
81
77
|
headerAlign,
|
|
82
78
|
depth,
|
|
83
79
|
isDragging: false
|
|
@@ -110,6 +106,7 @@ function GridColumnGroupHeader(props) {
|
|
|
110
106
|
onBlur: publish('columnGroupHeaderBlur')
|
|
111
107
|
}), [publish]);
|
|
112
108
|
const headerClassName = typeof group.headerClassName === 'function' ? group.headerClassName(renderParams) : group.headerClassName;
|
|
109
|
+
const style = React.useMemo(() => attachPinnedStyle(_extends({}, props.style), isRtl, pinnedPosition, pinnedOffset), [pinnedPosition, pinnedOffset, props.style, isRtl]);
|
|
113
110
|
return /*#__PURE__*/_jsx(GridGenericColumnHeaderItem, _extends({
|
|
114
111
|
ref: headerCellRef,
|
|
115
112
|
classes: classes,
|
|
@@ -5,8 +5,8 @@ export interface ColumnHeaderFilterIconButtonProps {
|
|
|
5
5
|
counter?: number;
|
|
6
6
|
onClick?: (params: GridColumnHeaderParams, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
7
7
|
}
|
|
8
|
-
declare function
|
|
9
|
-
declare namespace
|
|
8
|
+
declare function GridColumnHeaderFilterIconButtonWrapped(props: ColumnHeaderFilterIconButtonProps): React.JSX.Element | null;
|
|
9
|
+
declare namespace GridColumnHeaderFilterIconButtonWrapped {
|
|
10
10
|
var propTypes: any;
|
|
11
11
|
}
|
|
12
|
-
export { GridColumnHeaderFilterIconButton };
|
|
12
|
+
export { GridColumnHeaderFilterIconButtonWrapped as GridColumnHeaderFilterIconButton };
|
|
@@ -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 };
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridStateColDef } from '../../models/colDef/gridColDef';
|
|
3
3
|
import { GridSortDirection } from '../../models/gridSortModel';
|
|
4
4
|
import { GridColumnHeaderSeparatorProps } from './GridColumnHeaderSeparator';
|
|
5
|
-
import {
|
|
5
|
+
import { PinnedColumnPosition } from '../../internals/constants';
|
|
6
6
|
interface GridColumnHeaderItemProps {
|
|
7
7
|
colIndex: number;
|
|
8
8
|
colDef: GridStateColDef;
|
|
@@ -18,13 +18,13 @@ interface GridColumnHeaderItemProps {
|
|
|
18
18
|
tabIndex: 0 | -1;
|
|
19
19
|
disableReorder?: boolean;
|
|
20
20
|
separatorSide?: GridColumnHeaderSeparatorProps['side'];
|
|
21
|
-
pinnedPosition?:
|
|
21
|
+
pinnedPosition?: PinnedColumnPosition;
|
|
22
|
+
pinnedOffset?: number;
|
|
22
23
|
style?: React.CSSProperties;
|
|
23
|
-
indexInSection: number;
|
|
24
|
-
sectionLength: number;
|
|
25
|
-
gridHasFiller: boolean;
|
|
26
24
|
isLastUnpinned: boolean;
|
|
27
25
|
isSiblingFocused: boolean;
|
|
26
|
+
showLeftBorder: boolean;
|
|
27
|
+
showRightBorder: boolean;
|
|
28
28
|
}
|
|
29
29
|
declare function GridColumnHeaderItem(props: GridColumnHeaderItemProps): React.JSX.Element;
|
|
30
30
|
declare namespace GridColumnHeaderItem {
|
|
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
6
6
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
7
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
7
8
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
8
9
|
import { ColumnHeaderMenuIcon } from "./ColumnHeaderMenuIcon.js";
|
|
9
10
|
import { GridColumnHeaderMenu } from "../menu/columnMenu/GridColumnHeaderMenu.js";
|
|
@@ -11,7 +12,8 @@ import { gridClasses, getDataGridUtilityClass } from "../../constants/gridClasse
|
|
|
11
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
12
13
|
import { GridGenericColumnHeaderItem } from "./GridGenericColumnHeaderItem.js";
|
|
13
14
|
import { isEventTargetInPortal } from "../../utils/domUtils.js";
|
|
14
|
-
import {
|
|
15
|
+
import { PinnedColumnPosition } from "../../internals/constants.js";
|
|
16
|
+
import { attachPinnedStyle } from "../../internals/utils/index.js";
|
|
15
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
18
|
const useUtilityClasses = ownerState => {
|
|
17
19
|
const {
|
|
@@ -31,7 +33,7 @@ const useUtilityClasses = ownerState => {
|
|
|
31
33
|
// todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
|
|
32
34
|
const isColumnNumeric = colDef.type === 'number';
|
|
33
35
|
const slots = {
|
|
34
|
-
root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', colDef.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition ===
|
|
36
|
+
root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', colDef.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition === PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight',
|
|
35
37
|
// TODO: Remove classes below and restore `:has` selectors when they are supported in jsdom
|
|
36
38
|
// See https://github.com/mui/mui-x/pull/14559
|
|
37
39
|
isLastUnpinned && 'columnHeader--lastUnpinned', isSiblingFocused && 'columnHeader--siblingFocused'],
|
|
@@ -56,14 +58,14 @@ function GridColumnHeaderItem(props) {
|
|
|
56
58
|
tabIndex,
|
|
57
59
|
disableReorder,
|
|
58
60
|
separatorSide,
|
|
59
|
-
|
|
61
|
+
showLeftBorder,
|
|
62
|
+
showRightBorder,
|
|
60
63
|
pinnedPosition,
|
|
61
|
-
|
|
62
|
-
sectionLength,
|
|
63
|
-
gridHasFiller
|
|
64
|
+
pinnedOffset
|
|
64
65
|
} = props;
|
|
65
66
|
const apiRef = useGridPrivateApiContext();
|
|
66
67
|
const rootProps = useGridRootProps();
|
|
68
|
+
const isRtl = useRtl();
|
|
67
69
|
const headerCellRef = React.useRef(null);
|
|
68
70
|
const columnMenuId = useId();
|
|
69
71
|
const columnMenuButtonId = useId();
|
|
@@ -74,8 +76,6 @@ function GridColumnHeaderItem(props) {
|
|
|
74
76
|
if (colDef.renderHeader) {
|
|
75
77
|
headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
|
|
76
78
|
}
|
|
77
|
-
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
78
|
-
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showColumnVerticalBorder, gridHasFiller);
|
|
79
79
|
const ownerState = _extends({}, props, {
|
|
80
80
|
classes: rootProps.classes,
|
|
81
81
|
showRightBorder,
|
|
@@ -171,6 +171,7 @@ function GridColumnHeaderItem(props) {
|
|
|
171
171
|
colDef
|
|
172
172
|
}) : colDef.headerClassName;
|
|
173
173
|
const label = colDef.headerName ?? colDef.field;
|
|
174
|
+
const style = React.useMemo(() => attachPinnedStyle(_extends({}, props.style), isRtl, pinnedPosition, pinnedOffset), [pinnedPosition, pinnedOffset, props.style, isRtl]);
|
|
174
175
|
return /*#__PURE__*/_jsx(GridGenericColumnHeaderItem, _extends({
|
|
175
176
|
ref: headerCellRef,
|
|
176
177
|
classes: classes,
|
|
@@ -209,18 +210,18 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
|
|
|
209
210
|
columnMenuOpen: PropTypes.bool.isRequired,
|
|
210
211
|
disableReorder: PropTypes.bool,
|
|
211
212
|
filterItemsCounter: PropTypes.number,
|
|
212
|
-
gridHasFiller: PropTypes.bool.isRequired,
|
|
213
213
|
hasFocus: PropTypes.bool,
|
|
214
214
|
headerHeight: PropTypes.number.isRequired,
|
|
215
|
-
indexInSection: PropTypes.number.isRequired,
|
|
216
215
|
isDragging: PropTypes.bool.isRequired,
|
|
217
216
|
isLast: PropTypes.bool.isRequired,
|
|
218
217
|
isLastUnpinned: PropTypes.bool.isRequired,
|
|
219
218
|
isResizing: PropTypes.bool.isRequired,
|
|
220
219
|
isSiblingFocused: PropTypes.bool.isRequired,
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
pinnedOffset: PropTypes.number,
|
|
221
|
+
pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]),
|
|
223
222
|
separatorSide: PropTypes.oneOf(['left', 'right']),
|
|
223
|
+
showLeftBorder: PropTypes.bool.isRequired,
|
|
224
|
+
showRightBorder: PropTypes.bool.isRequired,
|
|
224
225
|
sortDirection: PropTypes.oneOf(['asc', 'desc']),
|
|
225
226
|
sortIndex: PropTypes.number,
|
|
226
227
|
style: PropTypes.object,
|
|
@@ -8,7 +8,7 @@ import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
|
8
8
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
9
9
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
10
10
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
11
|
-
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
11
|
+
import { objectShallowCompare, useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
12
12
|
import { getCheckboxPropsSelector } from "../../hooks/features/rowSelection/utils.js";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -76,7 +76,7 @@ const GridCellCheckboxForwardRef = forwardRef(function GridCellCheckboxRenderer(
|
|
|
76
76
|
const {
|
|
77
77
|
isIndeterminate,
|
|
78
78
|
isChecked
|
|
79
|
-
} = useGridSelector(apiRef, checkboxPropsSelector);
|
|
79
|
+
} = useGridSelector(apiRef, checkboxPropsSelector, objectShallowCompare);
|
|
80
80
|
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
@@ -7,5 +7,5 @@ export interface GridRootProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
*/
|
|
8
8
|
sx?: SxProps<Theme>;
|
|
9
9
|
}
|
|
10
|
-
declare const
|
|
11
|
-
export { GridRoot };
|
|
10
|
+
declare const MemoizedGridRoot: React.ForwardRefExoticComponent<GridRootProps> | React.ForwardRefExoticComponent<GridRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export { MemoizedGridRoot as GridRoot };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["className"];
|
|
3
|
+
const _excluded = ["className", "children"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, unstable_capitalize as capitalize, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
8
9
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
10
|
import { GridRootStyles } from "./GridRootStyles.js";
|
|
10
11
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
@@ -12,7 +13,9 @@ import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiCon
|
|
|
12
13
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
13
14
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
14
15
|
import { gridDensitySelector } from "../../hooks/features/density/densitySelector.js";
|
|
15
|
-
import {
|
|
16
|
+
import { GridHeader } from "../GridHeader.js";
|
|
17
|
+
import { GridBody, GridFooterPlaceholder } from "../base/index.js";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
19
|
const useUtilityClasses = (ownerState, density) => {
|
|
17
20
|
const {
|
|
18
21
|
autoHeight,
|
|
@@ -27,7 +30,8 @@ const useUtilityClasses = (ownerState, density) => {
|
|
|
27
30
|
const GridRoot = forwardRef(function GridRoot(props, ref) {
|
|
28
31
|
const rootProps = useGridRootProps();
|
|
29
32
|
const {
|
|
30
|
-
className
|
|
33
|
+
className,
|
|
34
|
+
children
|
|
31
35
|
} = props,
|
|
32
36
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
33
37
|
const apiRef = useGridPrivateApiContext();
|
|
@@ -45,11 +49,14 @@ const GridRoot = forwardRef(function GridRoot(props, ref) {
|
|
|
45
49
|
if (!mountedState) {
|
|
46
50
|
return null;
|
|
47
51
|
}
|
|
48
|
-
return /*#__PURE__*/
|
|
52
|
+
return /*#__PURE__*/_jsxs(GridRootStyles, _extends({
|
|
49
53
|
className: clsx(classes.root, className),
|
|
50
54
|
ownerState: ownerState
|
|
51
55
|
}, other, {
|
|
52
|
-
ref: handleRef
|
|
56
|
+
ref: handleRef,
|
|
57
|
+
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
58
|
+
children: children
|
|
59
|
+
}), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
|
|
53
60
|
}));
|
|
54
61
|
});
|
|
55
62
|
process.env.NODE_ENV !== "production" ? GridRoot.propTypes = {
|
|
@@ -62,4 +69,5 @@ process.env.NODE_ENV !== "production" ? GridRoot.propTypes = {
|
|
|
62
69
|
*/
|
|
63
70
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
64
71
|
} : void 0;
|
|
65
|
-
|
|
72
|
+
const MemoizedGridRoot = fastMemo(GridRoot);
|
|
73
|
+
export { MemoizedGridRoot as GridRoot };
|
|
@@ -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,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
4
|
import { GridFilterItem } from '../../../models/gridFilterItem';
|
|
4
5
|
import type { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
@@ -6,6 +7,6 @@ import type { GridApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
|
6
7
|
export type GridFilterInputValueProps<Api extends GridApiCommon = GridApiCommunity> = {
|
|
7
8
|
item: GridFilterItem;
|
|
8
9
|
applyValue: (value: GridFilterItem) => void;
|
|
9
|
-
apiRef:
|
|
10
|
+
apiRef: RefObject<Api>;
|
|
10
11
|
focusElementRef?: React.Ref<any>;
|
|
11
12
|
} & Pick<TextFieldProps, 'color' | 'error' | 'helperText' | 'size' | 'variant'>;
|
|
@@ -46,7 +46,12 @@ const GridToolbarColumnsButton = forwardRef(function GridToolbarColumnsButton(pr
|
|
|
46
46
|
"aria-expanded": isOpen,
|
|
47
47
|
"aria-controls": isOpen ? columnPanelId : undefined,
|
|
48
48
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {}),
|
|
49
|
-
onClick: showColumns
|
|
49
|
+
onClick: showColumns,
|
|
50
|
+
onPointerUp: event => {
|
|
51
|
+
if (preferencePanel.open) {
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
50
55
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
51
56
|
ref: ref,
|
|
52
57
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
@@ -110,7 +110,12 @@ const GridToolbarFilterButton = forwardRef(function GridToolbarFilterButton(prop
|
|
|
110
110
|
}, rootProps.slotProps?.baseBadge, badgeProps, {
|
|
111
111
|
children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {})
|
|
112
112
|
})),
|
|
113
|
-
onClick: toggleFilter
|
|
113
|
+
onClick: toggleFilter,
|
|
114
|
+
onPointerUp: event => {
|
|
115
|
+
if (preferencePanel.open) {
|
|
116
|
+
event.stopPropagation();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
114
119
|
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
115
120
|
ref: ref,
|
|
116
121
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
@@ -22,6 +22,9 @@ const Scrollbar = styled('div')({
|
|
|
22
22
|
position: 'absolute',
|
|
23
23
|
display: 'inline-block',
|
|
24
24
|
zIndex: 6,
|
|
25
|
+
'&:hover': {
|
|
26
|
+
zIndex: 7
|
|
27
|
+
},
|
|
25
28
|
// In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
|
|
26
29
|
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
|
|
27
30
|
// to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
|
|
@@ -103,19 +106,15 @@ const GridVirtualScrollbar = forwardRef(function GridVirtualScrollbar(props, ref
|
|
|
103
106
|
useOnMount(() => {
|
|
104
107
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
105
108
|
const scrollbar = scrollbarRef.current;
|
|
106
|
-
|
|
107
|
-
capture: true
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
const options = {
|
|
110
|
+
capture: true,
|
|
111
|
+
passive: true
|
|
112
|
+
};
|
|
113
|
+
scroller.addEventListener('scroll', onScrollerScroll, options);
|
|
114
|
+
scrollbar.addEventListener('scroll', onScrollbarScroll, options);
|
|
112
115
|
return () => {
|
|
113
|
-
scroller.removeEventListener('scroll', onScrollerScroll,
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
scrollbar.removeEventListener('scroll', onScrollbarScroll, {
|
|
117
|
-
capture: true
|
|
118
|
-
});
|
|
116
|
+
scroller.removeEventListener('scroll', onScrollerScroll, options);
|
|
117
|
+
scrollbar.removeEventListener('scroll', onScrollbarScroll, options);
|
|
119
118
|
};
|
|
120
119
|
});
|
|
121
120
|
React.useEffect(() => {
|
|
@@ -98,11 +98,11 @@ function GridVirtualScroller(props) {
|
|
|
98
98
|
virtualScroller: virtualScroller
|
|
99
99
|
})
|
|
100
100
|
})]
|
|
101
|
-
})), dimensions.
|
|
102
|
-
position: "vertical"
|
|
103
|
-
}, getScrollbarVerticalProps())), dimensions.hasScrollX && !rootProps.unstable_listView && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
101
|
+
})), dimensions.hasScrollX && !rootProps.unstable_listView && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
104
102
|
position: "horizontal"
|
|
105
|
-
}, getScrollbarHorizontalProps())),
|
|
103
|
+
}, getScrollbarHorizontalProps())), dimensions.hasScrollY && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
104
|
+
position: "vertical"
|
|
105
|
+
}, getScrollbarVerticalProps())), props.children]
|
|
106
106
|
}));
|
|
107
107
|
}
|
|
108
108
|
export { GridVirtualScroller };
|