@mui/x-data-grid 7.0.0-beta.5 → 7.0.0-beta.7
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 +252 -50
- package/DataGrid/DataGrid.js +44 -0
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +3 -2
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +6 -17
- package/components/GridHeaders.js +1 -4
- package/components/GridPagination.js +2 -7
- package/components/GridPinnedRows.d.ts +1 -2
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +9 -26
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- package/components/cell/GridCell.d.ts +7 -2
- package/components/cell/GridCell.js +14 -10
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/components/containers/GridRootStyles.js +12 -22
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +11 -4
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/constants/gridClasses.d.ts +6 -32
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +22 -20
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +23 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -99
- package/hooks/features/columnResize/columnResizeSelector.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/hooks/features/columnResize/columnResizeState.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeState.js +1 -0
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +44 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/hooks/features/columnResize/index.d.ts +3 -0
- package/hooks/features/columnResize/index.js +3 -0
- package/hooks/features/columnResize/useGridColumnResize.d.ts +10 -0
- package/hooks/features/columnResize/useGridColumnResize.js +563 -0
- package/hooks/features/columns/gridColumnsUtils.js +4 -1
- package/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/hooks/features/editing/useGridCellEditing.js +21 -2
- package/hooks/features/export/useGridPrintExport.js +8 -7
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +1 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +6 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +30 -7
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +19 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/hooks/features/pagination/useGridPagination.d.ts +1 -6
- package/hooks/features/pagination/useGridPagination.js +9 -157
- package/hooks/features/pagination/useGridPaginationModel.d.ts +11 -0
- package/hooks/features/pagination/useGridPaginationModel.js +170 -0
- package/hooks/features/pagination/useGridRowCount.d.ts +8 -0
- package/hooks/features/pagination/useGridRowCount.js +97 -0
- package/hooks/features/rows/useGridParamsApi.js +6 -10
- package/hooks/features/scroll/useGridScroll.js +1 -1
- package/hooks/features/sorting/useGridSorting.js +2 -2
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +6 -0
- package/hooks/utils/useLazyRef.d.ts +1 -2
- package/hooks/utils/useLazyRef.js +1 -11
- package/hooks/utils/useOnMount.d.ts +1 -2
- package/hooks/utils/useOnMount.js +1 -7
- package/hooks/utils/useTimeout.d.ts +1 -11
- package/hooks/utils/useTimeout.js +1 -36
- package/index.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/internals/utils/getPinnedCellOffset.d.ts +3 -0
- package/internals/utils/getPinnedCellOffset.js +17 -0
- package/joy/joySlots.js +13 -52
- package/locales/jaJP.js +3 -4
- package/material/index.js +0 -2
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridCoreApi.d.ts +1 -5
- package/models/api/gridInfiniteLoaderApi.d.ts +6 -0
- package/models/api/gridInfiniteLoaderApi.js +1 -0
- package/models/events/gridEventLookup.d.ts +6 -0
- package/models/gridHeaderFilteringModel.d.ts +1 -0
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/params/gridScrollParams.d.ts +5 -3
- package/models/props/DataGridProps.d.ts +35 -1
- package/modern/DataGrid/DataGrid.js +44 -0
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +3 -2
- package/modern/components/GridColumnHeaders.js +6 -17
- package/modern/components/GridHeaders.js +1 -4
- package/modern/components/GridPagination.js +2 -4
- package/modern/components/GridRow.js +9 -26
- package/modern/components/GridScrollArea.js +150 -0
- package/modern/components/cell/GridCell.js +14 -10
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/modern/components/containers/GridRootStyles.js +12 -22
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +11 -4
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +22 -20
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +184 -97
- package/modern/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/modern/hooks/features/columnResize/columnResizeState.js +1 -0
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/modern/hooks/features/columnResize/index.js +3 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +4 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +21 -2
- package/modern/hooks/features/export/useGridPrintExport.js +8 -7
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/modern/hooks/features/pagination/useGridPagination.js +8 -149
- package/modern/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/modern/hooks/features/pagination/useGridRowCount.js +94 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +6 -10
- package/modern/hooks/features/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +2 -2
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +5 -0
- package/modern/hooks/utils/useLazyRef.js +1 -11
- package/modern/hooks/utils/useOnMount.js +1 -7
- package/modern/hooks/utils/useTimeout.js +1 -36
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/internals/utils/getPinnedCellOffset.js +17 -0
- package/modern/joy/joySlots.js +11 -50
- package/modern/locales/jaJP.js +3 -4
- package/modern/material/index.js +0 -2
- package/modern/models/api/gridInfiniteLoaderApi.js +1 -0
- package/modern/utils/cellBorderUtils.js +8 -0
- package/modern/utils/createSelector.js +12 -20
- package/modern/utils/domUtils.js +144 -0
- package/node/DataGrid/DataGrid.js +44 -0
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +3 -2
- package/node/components/GridColumnHeaders.js +6 -16
- package/node/components/GridHeaders.js +1 -4
- package/node/components/GridPagination.js +1 -3
- package/node/components/GridRow.js +8 -25
- package/node/components/GridScrollArea.js +158 -0
- package/node/components/cell/GridCell.js +15 -11
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/node/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/node/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/node/components/containers/GridRootStyles.js +12 -22
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +11 -4
- package/node/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +22 -20
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +190 -103
- package/node/hooks/features/columnResize/columnResizeSelector.js +10 -0
- package/node/hooks/features/columnResize/columnResizeState.js +5 -0
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +16 -0
- package/node/hooks/features/columnResize/index.js +38 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +564 -0
- package/node/hooks/features/columns/gridColumnsUtils.js +4 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -5
- package/node/hooks/features/editing/useGridCellEditing.js +21 -2
- package/node/hooks/features/export/useGridPrintExport.js +8 -7
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +4 -1
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/node/hooks/features/pagination/useGridPagination.js +9 -153
- package/node/hooks/features/pagination/useGridPaginationModel.js +176 -0
- package/node/hooks/features/pagination/useGridRowCount.js +103 -0
- package/node/hooks/features/rows/useGridParamsApi.js +6 -10
- package/node/hooks/features/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/sorting/useGridSorting.js +2 -2
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +5 -0
- package/node/hooks/utils/useLazyRef.js +7 -13
- package/node/hooks/utils/useOnMount.js +8 -10
- package/node/hooks/utils/useTimeout.js +7 -37
- package/node/index.js +1 -1
- package/node/internals/index.js +15 -15
- package/node/internals/utils/getPinnedCellOffset.js +24 -0
- package/node/joy/joySlots.js +11 -50
- package/node/locales/jaJP.js +3 -4
- package/node/material/index.js +0 -2
- package/node/models/api/gridInfiniteLoaderApi.js +5 -0
- package/node/utils/cellBorderUtils.js +16 -0
- package/node/utils/createSelector.js +14 -23
- package/node/utils/domUtils.js +155 -0
- package/package.json +2 -2
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- package/utils/createSelector.d.ts +0 -1
- package/utils/createSelector.js +12 -22
- package/utils/domUtils.d.ts +14 -1
- package/utils/domUtils.js +147 -0
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +0 -8
- package/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/node/components/columnHeaders/GridColumnHeadersInner.js +0 -67
|
@@ -8,17 +8,20 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
9
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
10
10
|
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
11
|
+
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from '../../utils/cellBorderUtils';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const useUtilityClasses = ownerState => {
|
|
13
14
|
const {
|
|
14
15
|
classes,
|
|
15
16
|
headerAlign,
|
|
16
17
|
isDragging,
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
showLeftBorder,
|
|
19
|
+
showRightBorder,
|
|
20
|
+
groupId,
|
|
21
|
+
pinnedPosition
|
|
19
22
|
} = ownerState;
|
|
20
23
|
const slots = {
|
|
21
|
-
root: ['columnHeader', headerAlign === 'left' && 'columnHeader--alignLeft', headerAlign === 'center' && 'columnHeader--alignCenter', headerAlign === 'right' && 'columnHeader--alignRight', isDragging && 'columnHeader--moving',
|
|
24
|
+
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 === 'left' && 'columnHeader--pinnedLeft', pinnedPosition === 'right' && 'columnHeader--pinnedRight'],
|
|
22
25
|
draggableContainer: ['columnHeaderDraggableContainer'],
|
|
23
26
|
titleContainer: ['columnHeaderTitleContainer', 'withBorderColor'],
|
|
24
27
|
titleContainerContent: ['columnHeaderTitleContainerContent']
|
|
@@ -37,7 +40,11 @@ function GridColumnGroupHeader(props) {
|
|
|
37
40
|
colIndex,
|
|
38
41
|
hasFocus,
|
|
39
42
|
tabIndex,
|
|
40
|
-
isLastColumn
|
|
43
|
+
isLastColumn,
|
|
44
|
+
pinnedPosition,
|
|
45
|
+
style,
|
|
46
|
+
indexInSection,
|
|
47
|
+
sectionLength
|
|
41
48
|
} = props;
|
|
42
49
|
const rootProps = useGridRootProps();
|
|
43
50
|
const headerCellRef = React.useRef(null);
|
|
@@ -64,10 +71,12 @@ function GridColumnGroupHeader(props) {
|
|
|
64
71
|
if (groupId && render) {
|
|
65
72
|
headerComponent = render(renderParams);
|
|
66
73
|
}
|
|
67
|
-
const
|
|
74
|
+
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
75
|
+
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
|
|
68
76
|
const ownerState = _extends({}, props, {
|
|
69
77
|
classes: rootProps.classes,
|
|
70
|
-
|
|
78
|
+
showLeftBorder,
|
|
79
|
+
showRightBorder,
|
|
71
80
|
headerAlign,
|
|
72
81
|
depth,
|
|
73
82
|
isDragging: false
|
|
@@ -118,12 +127,13 @@ function GridColumnGroupHeader(props) {
|
|
|
118
127
|
width: width,
|
|
119
128
|
columnMenuIconButton: null,
|
|
120
129
|
columnTitleIconButtons: null,
|
|
121
|
-
resizable:
|
|
130
|
+
resizable: true,
|
|
122
131
|
label: label,
|
|
123
132
|
"aria-colspan": fields.length
|
|
124
133
|
// The fields are wrapped between |-...-| to avoid confusion between fields "id" and "id2" when using selector data-fields~=
|
|
125
134
|
,
|
|
126
|
-
"data-fields": `|-${fields.join('-|-')}
|
|
135
|
+
"data-fields": `|-${fields.join('-|-')}-|`,
|
|
136
|
+
style: style
|
|
127
137
|
}, mouseEventsHandlers));
|
|
128
138
|
}
|
|
129
139
|
export { GridColumnGroupHeader };
|
|
@@ -2,6 +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 { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
5
6
|
interface GridColumnHeaderItemProps {
|
|
6
7
|
colIndex: number;
|
|
7
8
|
colDef: GridStateColDef;
|
|
@@ -16,6 +17,10 @@ interface GridColumnHeaderItemProps {
|
|
|
16
17
|
tabIndex: 0 | -1;
|
|
17
18
|
disableReorder?: boolean;
|
|
18
19
|
separatorSide?: GridColumnHeaderSeparatorProps['side'];
|
|
20
|
+
pinnedPosition?: GridPinnedColumnPosition;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
indexInSection: number;
|
|
23
|
+
sectionLength: number;
|
|
19
24
|
}
|
|
20
25
|
declare function GridColumnHeaderItem(props: GridColumnHeaderItemProps): React.JSX.Element;
|
|
21
26
|
declare namespace GridColumnHeaderItem {
|
|
@@ -11,6 +11,7 @@ import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
13
13
|
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
14
|
+
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from '../../utils/cellBorderUtils';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const useUtilityClasses = ownerState => {
|
|
@@ -20,14 +21,16 @@ const useUtilityClasses = ownerState => {
|
|
|
20
21
|
isDragging,
|
|
21
22
|
sortDirection,
|
|
22
23
|
showRightBorder,
|
|
23
|
-
|
|
24
|
+
showLeftBorder,
|
|
25
|
+
filterItemsCounter,
|
|
26
|
+
pinnedPosition
|
|
24
27
|
} = ownerState;
|
|
25
28
|
const isColumnSorted = sortDirection != null;
|
|
26
29
|
const isColumnFiltered = filterItemsCounter != null && filterItemsCounter > 0;
|
|
27
30
|
// todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
|
|
28
31
|
const isColumnNumeric = colDef.type === 'number';
|
|
29
32
|
const slots = {
|
|
30
|
-
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'],
|
|
33
|
+
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 === 'left' && 'columnHeader--pinnedLeft', pinnedPosition === 'right' && 'columnHeader--pinnedRight'],
|
|
31
34
|
draggableContainer: ['columnHeaderDraggableContainer'],
|
|
32
35
|
titleContainer: ['columnHeaderTitleContainer'],
|
|
33
36
|
titleContainerContent: ['columnHeaderTitleContainerContent']
|
|
@@ -48,7 +51,11 @@ function GridColumnHeaderItem(props) {
|
|
|
48
51
|
hasFocus,
|
|
49
52
|
tabIndex,
|
|
50
53
|
disableReorder,
|
|
51
|
-
separatorSide
|
|
54
|
+
separatorSide,
|
|
55
|
+
style,
|
|
56
|
+
pinnedPosition,
|
|
57
|
+
indexInSection,
|
|
58
|
+
sectionLength
|
|
52
59
|
} = props;
|
|
53
60
|
const apiRef = useGridPrivateApiContext();
|
|
54
61
|
const rootProps = useGridRootProps();
|
|
@@ -62,9 +69,12 @@ function GridColumnHeaderItem(props) {
|
|
|
62
69
|
if (colDef.renderHeader) {
|
|
63
70
|
headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
|
|
64
71
|
}
|
|
72
|
+
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
73
|
+
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
|
|
65
74
|
const ownerState = _extends({}, props, {
|
|
66
75
|
classes: rootProps.classes,
|
|
67
|
-
showRightBorder
|
|
76
|
+
showRightBorder,
|
|
77
|
+
showLeftBorder
|
|
68
78
|
});
|
|
69
79
|
const classes = useUtilityClasses(ownerState);
|
|
70
80
|
const publish = React.useCallback(eventName => event => {
|
|
@@ -144,7 +154,7 @@ function GridColumnHeaderItem(props) {
|
|
|
144
154
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
145
155
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
146
156
|
elementToFocus == null || elementToFocus.focus();
|
|
147
|
-
apiRef.current.
|
|
157
|
+
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
148
158
|
}
|
|
149
159
|
}, [apiRef, hasFocus]);
|
|
150
160
|
const headerClassName = typeof colDef.headerClassName === 'function' ? colDef.headerClassName({
|
|
@@ -176,7 +186,8 @@ function GridColumnHeaderItem(props) {
|
|
|
176
186
|
"data-field": colDef.field,
|
|
177
187
|
columnMenu: columnMenu,
|
|
178
188
|
draggableContainerProps: draggableEventHandlers,
|
|
179
|
-
columnHeaderSeparatorProps: columnHeaderSeparatorProps
|
|
189
|
+
columnHeaderSeparatorProps: columnHeaderSeparatorProps,
|
|
190
|
+
style: style
|
|
180
191
|
}, mouseEventsHandlers));
|
|
181
192
|
}
|
|
182
193
|
process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
|
|
@@ -191,11 +202,15 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
|
|
|
191
202
|
filterItemsCounter: PropTypes.number,
|
|
192
203
|
hasFocus: PropTypes.bool,
|
|
193
204
|
headerHeight: PropTypes.number.isRequired,
|
|
205
|
+
indexInSection: PropTypes.number.isRequired,
|
|
194
206
|
isDragging: PropTypes.bool.isRequired,
|
|
195
207
|
isResizing: PropTypes.bool.isRequired,
|
|
208
|
+
pinnedPosition: PropTypes.oneOf(['left', 'right']),
|
|
209
|
+
sectionLength: PropTypes.number.isRequired,
|
|
196
210
|
separatorSide: PropTypes.oneOf(['left', 'right']),
|
|
197
211
|
sortDirection: PropTypes.oneOf(['asc', 'desc']),
|
|
198
212
|
sortIndex: PropTypes.number,
|
|
213
|
+
style: PropTypes.object,
|
|
199
214
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired
|
|
200
215
|
} : void 0;
|
|
201
216
|
const Memoized = fastMemo(GridColumnHeaderItem);
|
|
@@ -26,6 +26,7 @@ interface GridGenericColumnHeaderItemProps extends Pick<GridStateColDef, 'header
|
|
|
26
26
|
label: string;
|
|
27
27
|
draggableContainerProps?: Partial<React.HTMLProps<HTMLDivElement>>;
|
|
28
28
|
columnHeaderSeparatorProps?: Partial<GridColumnHeaderSeparatorProps>;
|
|
29
|
+
style?: React.CSSProperties;
|
|
29
30
|
}
|
|
30
31
|
declare const GridGenericColumnHeaderItem: React.ForwardRefExoticComponent<GridGenericColumnHeaderItemProps & React.RefAttributes<unknown>>;
|
|
31
32
|
export { GridGenericColumnHeaderItem };
|
|
@@ -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 = ["classes", "columnMenuOpen", "colIndex", "height", "isResizing", "sortDirection", "hasFocus", "tabIndex", "separatorSide", "isDraggable", "headerComponent", "description", "elementId", "width", "columnMenuIconButton", "columnMenu", "columnTitleIconButtons", "headerClassName", "label", "resizable", "draggableContainerProps", "columnHeaderSeparatorProps"];
|
|
3
|
+
const _excluded = ["classes", "columnMenuOpen", "colIndex", "height", "isResizing", "sortDirection", "hasFocus", "tabIndex", "separatorSide", "isDraggable", "headerComponent", "description", "elementId", "width", "columnMenuIconButton", "columnMenu", "columnTitleIconButtons", "headerClassName", "label", "resizable", "draggableContainerProps", "columnHeaderSeparatorProps", "style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
@@ -32,7 +32,8 @@ const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridG
|
|
|
32
32
|
label,
|
|
33
33
|
resizable,
|
|
34
34
|
draggableContainerProps,
|
|
35
|
-
columnHeaderSeparatorProps
|
|
35
|
+
columnHeaderSeparatorProps,
|
|
36
|
+
style
|
|
36
37
|
} = props,
|
|
37
38
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
39
|
const apiRef = useGridPrivateApiContext();
|
|
@@ -55,18 +56,18 @@ const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridG
|
|
|
55
56
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
56
57
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
57
58
|
elementToFocus == null || elementToFocus.focus();
|
|
58
|
-
apiRef.current.
|
|
59
|
+
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
59
60
|
}
|
|
60
61
|
}, [apiRef, hasFocus]);
|
|
61
62
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
62
63
|
ref: handleRef,
|
|
63
64
|
className: clsx(classes.root, headerClassName),
|
|
64
|
-
style: {
|
|
65
|
+
style: _extends({}, style, {
|
|
65
66
|
height,
|
|
66
67
|
width,
|
|
67
68
|
minWidth: width,
|
|
68
69
|
maxWidth: width
|
|
69
|
-
},
|
|
70
|
+
}),
|
|
70
71
|
role: "columnheader",
|
|
71
72
|
tabIndex: tabIndex,
|
|
72
73
|
"aria-colindex": colIndex + 1,
|
|
@@ -307,14 +307,6 @@ export const GridRootStyles = styled('div', {
|
|
|
307
307
|
borderBottomStyle: 'solid',
|
|
308
308
|
boxSizing: 'border-box'
|
|
309
309
|
},
|
|
310
|
-
[`& .${c['columnHeader--filledGroup']}.${c['columnHeader--showColumnBorder']} .${c.columnHeaderTitleContainer}`]: {
|
|
311
|
-
borderBottom: `none`
|
|
312
|
-
},
|
|
313
|
-
[`& .${c['columnHeader--filledGroup']}.${c['columnHeader--showColumnBorder']}`]: {
|
|
314
|
-
borderBottomWidth: '1px',
|
|
315
|
-
borderBottomStyle: 'solid',
|
|
316
|
-
boxSizing: 'border-box'
|
|
317
|
-
},
|
|
318
310
|
[`& .${c.sortIcon}, & .${c.filterIcon}`]: {
|
|
319
311
|
fontSize: 'inherit'
|
|
320
312
|
},
|
|
@@ -338,6 +330,12 @@ export const GridRootStyles = styled('div', {
|
|
|
338
330
|
[`& .${c['columnHeader--moving']}`]: {
|
|
339
331
|
backgroundColor: (t.vars || t).palette.action.hover
|
|
340
332
|
},
|
|
333
|
+
[`& .${c['columnHeader--pinnedLeft']}, & .${c['columnHeader--pinnedRight']}`]: {
|
|
334
|
+
position: 'sticky',
|
|
335
|
+
zIndex: 4,
|
|
336
|
+
// Should be above the column separator
|
|
337
|
+
background: 'var(--DataGrid-pinnedBackground)'
|
|
338
|
+
},
|
|
341
339
|
[`& .${c.columnSeparator}`]: {
|
|
342
340
|
visibility: 'hidden',
|
|
343
341
|
position: 'absolute',
|
|
@@ -428,9 +426,6 @@ export const GridRootStyles = styled('div', {
|
|
|
428
426
|
[`& .${c['container--top']}, & .${c['container--bottom']}`]: {
|
|
429
427
|
'[role=row]': {
|
|
430
428
|
background: 'var(--DataGrid-containerBackground)'
|
|
431
|
-
},
|
|
432
|
-
[`.${c.pinnedColumnHeaders} [role=row]`]: {
|
|
433
|
-
background: 'var(--DataGrid-pinnedBackground)'
|
|
434
429
|
}
|
|
435
430
|
},
|
|
436
431
|
/* Cell styles */
|
|
@@ -441,8 +436,6 @@ export const GridRootStyles = styled('div', {
|
|
|
441
436
|
lineHeight: 'calc(var(--height) - 1px)',
|
|
442
437
|
// -1px for the border
|
|
443
438
|
|
|
444
|
-
'--width': '0px',
|
|
445
|
-
'--height': '0px',
|
|
446
439
|
boxSizing: 'border-box',
|
|
447
440
|
borderTop: `1px solid var(--rowBorderColor)`,
|
|
448
441
|
overflow: 'hidden',
|
|
@@ -522,20 +515,16 @@ export const GridRootStyles = styled('div', {
|
|
|
522
515
|
[`.${c.withBorderColor}`]: {
|
|
523
516
|
borderColor
|
|
524
517
|
},
|
|
525
|
-
[`& .${c['cell--withLeftBorder']}`]: {
|
|
518
|
+
[`& .${c['cell--withLeftBorder']}, & .${c['columnHeader--withLeftBorder']}`]: {
|
|
526
519
|
borderLeftColor: 'var(--DataGrid-rowBorderColor)',
|
|
527
520
|
borderLeftWidth: '1px',
|
|
528
521
|
borderLeftStyle: 'solid'
|
|
529
522
|
},
|
|
530
|
-
[`& .${c['cell--withRightBorder']}`]: {
|
|
523
|
+
[`& .${c['cell--withRightBorder']}, & .${c['columnHeader--withRightBorder']}`]: {
|
|
531
524
|
borderRightColor: 'var(--DataGrid-rowBorderColor)',
|
|
532
525
|
borderRightWidth: '1px',
|
|
533
526
|
borderRightStyle: 'solid'
|
|
534
527
|
},
|
|
535
|
-
[`& .${c['columnHeader--withRightBorder']}`]: {
|
|
536
|
-
borderRightWidth: '1px',
|
|
537
|
-
borderRightStyle: 'solid'
|
|
538
|
-
},
|
|
539
528
|
[`& .${c['cell--flex']}`]: {
|
|
540
529
|
display: 'flex',
|
|
541
530
|
alignItems: 'center',
|
|
@@ -636,12 +625,13 @@ export const GridRootStyles = styled('div', {
|
|
|
636
625
|
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
637
626
|
},
|
|
638
627
|
[`&.${c['scrollbarFiller--pinnedRight']}`]: {
|
|
639
|
-
backgroundColor: 'var(--DataGrid-pinnedBackground)'
|
|
640
|
-
},
|
|
641
|
-
[`&.${c['scrollbarFiller--pinnedRight']}:not(.${c['scrollbarFiller--header']})`]: {
|
|
628
|
+
backgroundColor: 'var(--DataGrid-pinnedBackground)',
|
|
642
629
|
position: 'sticky',
|
|
643
630
|
right: 0
|
|
644
631
|
}
|
|
632
|
+
},
|
|
633
|
+
[`& .${c.filler}`]: {
|
|
634
|
+
flex: 1
|
|
645
635
|
}
|
|
646
636
|
});
|
|
647
637
|
return gridStyle;
|
|
@@ -35,6 +35,8 @@ const ScrollbarVertical = styled(Scrollbar)({
|
|
|
35
35
|
height: 'calc(var(--DataGrid-hasScrollY) * (100% - var(--DataGrid-topContainerHeight) - var(--DataGrid-bottomContainerHeight) - var(--DataGrid-hasScrollX) * var(--DataGrid-scrollbarSize)))',
|
|
36
36
|
overflowY: 'auto',
|
|
37
37
|
overflowX: 'hidden',
|
|
38
|
+
// Disable focus-visible style, it's a scrollbar.
|
|
39
|
+
outline: 0,
|
|
38
40
|
'& > div': {
|
|
39
41
|
width: 'var(--size)'
|
|
40
42
|
},
|
|
@@ -46,6 +48,8 @@ const ScrollbarHorizontal = styled(Scrollbar)({
|
|
|
46
48
|
height: 'var(--size)',
|
|
47
49
|
overflowY: 'hidden',
|
|
48
50
|
overflowX: 'auto',
|
|
51
|
+
// Disable focus-visible style, it's a scrollbar.
|
|
52
|
+
outline: 0,
|
|
49
53
|
'& > div': {
|
|
50
54
|
height: 'var(--size)'
|
|
51
55
|
},
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { styled } from '@mui/system';
|
|
4
4
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
5
|
+
import { GridScrollArea } from '../GridScrollArea';
|
|
5
6
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
6
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
7
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
@@ -59,12 +60,18 @@ function GridVirtualScroller(props) {
|
|
|
59
60
|
getContentProps,
|
|
60
61
|
getRenderZoneProps,
|
|
61
62
|
getScrollbarVerticalProps,
|
|
62
|
-
getScrollbarHorizontalProps
|
|
63
|
+
getScrollbarHorizontalProps,
|
|
64
|
+
getRows
|
|
63
65
|
} = virtualScroller;
|
|
66
|
+
const rows = getRows();
|
|
64
67
|
return /*#__PURE__*/_jsxs(Container, _extends({
|
|
65
68
|
className: classes.root
|
|
66
69
|
}, getContainerProps(), {
|
|
67
|
-
children: [/*#__PURE__*/
|
|
70
|
+
children: [/*#__PURE__*/_jsx(GridScrollArea, {
|
|
71
|
+
scrollDirection: "left"
|
|
72
|
+
}), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
73
|
+
scrollDirection: "right"
|
|
74
|
+
}), /*#__PURE__*/_jsxs(Scroller, _extends({
|
|
68
75
|
className: classes.scroller
|
|
69
76
|
}, getScrollerProps(), {
|
|
70
77
|
ownerState: rootProps,
|
|
@@ -75,11 +82,11 @@ function GridVirtualScroller(props) {
|
|
|
75
82
|
})]
|
|
76
83
|
}), /*#__PURE__*/_jsx(GridOverlays, {}), /*#__PURE__*/_jsx(Content, _extends({}, getContentProps(), {
|
|
77
84
|
children: /*#__PURE__*/_jsxs(RenderZone, _extends({}, getRenderZoneProps(), {
|
|
78
|
-
children: [
|
|
85
|
+
children: [rows, /*#__PURE__*/_jsx(rootProps.slots.detailPanels, {
|
|
79
86
|
virtualScroller: virtualScroller
|
|
80
87
|
})]
|
|
81
88
|
}))
|
|
82
|
-
})), /*#__PURE__*/_jsx(SpaceFiller, {}), /*#__PURE__*/_jsx(BottomContainer, {
|
|
89
|
+
})), rows.length > 0 && /*#__PURE__*/_jsx(SpaceFiller, {}), /*#__PURE__*/_jsx(BottomContainer, {
|
|
83
90
|
children: /*#__PURE__*/_jsx(rootProps.slots.pinnedRows, {
|
|
84
91
|
position: "bottom",
|
|
85
92
|
virtualScroller: virtualScroller
|
|
@@ -38,6 +38,7 @@ function GridVirtualScrollerFiller() {
|
|
|
38
38
|
viewportOuterSize,
|
|
39
39
|
minimumSize,
|
|
40
40
|
hasScrollX,
|
|
41
|
+
hasScrollY,
|
|
41
42
|
scrollbarSize,
|
|
42
43
|
leftPinnedWidth,
|
|
43
44
|
rightPinnedWidth
|
|
@@ -62,7 +63,7 @@ function GridVirtualScrollerFiller() {
|
|
|
62
63
|
}), /*#__PURE__*/_jsx(Main, {}), rightPinnedWidth > 0 && /*#__PURE__*/_jsx(PinnedRight, {
|
|
63
64
|
className: gridClasses['filler--pinnedRight'],
|
|
64
65
|
style: {
|
|
65
|
-
width: rightPinnedWidth
|
|
66
|
+
width: rightPinnedWidth + (hasScrollY ? scrollbarSize : 0)
|
|
66
67
|
}
|
|
67
68
|
})]
|
|
68
69
|
});
|
|
@@ -148,14 +148,12 @@ export interface GridClasses {
|
|
|
148
148
|
* Styles applied to the column header if the column has a filter applied to it.
|
|
149
149
|
*/
|
|
150
150
|
'columnHeader--filtered': string;
|
|
151
|
+
'columnHeader--pinnedLeft': string;
|
|
152
|
+
'columnHeader--pinnedRight': string;
|
|
151
153
|
/**
|
|
152
154
|
* Styles applied to the column header element.
|
|
153
155
|
*/
|
|
154
156
|
columnHeader: string;
|
|
155
|
-
/**
|
|
156
|
-
* Styles applied to the column group header element.
|
|
157
|
-
*/
|
|
158
|
-
columnGroupHeader: string;
|
|
159
157
|
/**
|
|
160
158
|
* Styles applied to the header checkbox cell element.
|
|
161
159
|
*/
|
|
@@ -168,10 +166,6 @@ export interface GridClasses {
|
|
|
168
166
|
* Styles applied to the row's draggable placeholder element inside the special row reorder cell.
|
|
169
167
|
*/
|
|
170
168
|
rowReorderCellPlaceholder: string;
|
|
171
|
-
/**
|
|
172
|
-
* Styles applied to the column headers wrapper if a column is being dragged.
|
|
173
|
-
*/
|
|
174
|
-
columnHeaderDropZone: string;
|
|
175
169
|
/**
|
|
176
170
|
* Styles applied to the column header's title element;
|
|
177
171
|
*/
|
|
@@ -192,22 +186,10 @@ export interface GridClasses {
|
|
|
192
186
|
* Styles applied to the empty column group header cell.
|
|
193
187
|
*/
|
|
194
188
|
'columnHeader--emptyGroup': string;
|
|
195
|
-
/**
|
|
196
|
-
* Styles applied to the column group header cell when show column border.
|
|
197
|
-
*/
|
|
198
|
-
'columnHeader--showColumnBorder': string;
|
|
199
189
|
/**
|
|
200
190
|
* Styles applied to the column headers.
|
|
201
191
|
*/
|
|
202
192
|
columnHeaders: string;
|
|
203
|
-
/**
|
|
204
|
-
* Styles applied to the column headers's inner element.
|
|
205
|
-
*/
|
|
206
|
-
columnHeadersInner: string;
|
|
207
|
-
/**
|
|
208
|
-
* Styles applied to the column headers's inner element if there is a horizontal scrollbar.
|
|
209
|
-
*/
|
|
210
|
-
'columnHeadersInner--scrollable': string;
|
|
211
193
|
/**
|
|
212
194
|
* Styles applied to the column header separator if the column is resizable.
|
|
213
195
|
*/
|
|
@@ -302,14 +284,17 @@ export interface GridClasses {
|
|
|
302
284
|
editBooleanCell: string;
|
|
303
285
|
/**
|
|
304
286
|
* Styles applied to the filler row.
|
|
287
|
+
* @ignore - do not document.
|
|
305
288
|
*/
|
|
306
289
|
filler: string;
|
|
307
290
|
/**
|
|
308
291
|
* Styles applied to the filler row pinned left section.
|
|
292
|
+
* @ignore - do not document.
|
|
309
293
|
*/
|
|
310
294
|
'filler--pinnedLeft': string;
|
|
311
295
|
/**
|
|
312
296
|
* Styles applied to the filler row pinned right section.
|
|
297
|
+
* @ignore - do not document.
|
|
313
298
|
*/
|
|
314
299
|
'filler--pinnedRight': string;
|
|
315
300
|
/**
|
|
@@ -420,18 +405,6 @@ export interface GridClasses {
|
|
|
420
405
|
* Styles applied to the pinned columns.
|
|
421
406
|
*/
|
|
422
407
|
pinnedColumns: string;
|
|
423
|
-
/**
|
|
424
|
-
* Styles applied to the pinned column headers.
|
|
425
|
-
*/
|
|
426
|
-
pinnedColumnHeaders: string;
|
|
427
|
-
/**
|
|
428
|
-
* Styles applied to the left pinned column headers.
|
|
429
|
-
*/
|
|
430
|
-
'pinnedColumnHeaders--left': string;
|
|
431
|
-
/**
|
|
432
|
-
* Styles applied to the right pinned column headers.
|
|
433
|
-
*/
|
|
434
|
-
'pinnedColumnHeaders--right': string;
|
|
435
408
|
/**
|
|
436
409
|
* Styles applied to the root element.
|
|
437
410
|
*/
|
|
@@ -582,6 +555,7 @@ export interface GridClasses {
|
|
|
582
555
|
* Styles applied the column header if `showColumnVerticalBorder={true}`.
|
|
583
556
|
*/
|
|
584
557
|
'columnHeader--withRightBorder': string;
|
|
558
|
+
'columnHeader--withLeftBorder': string;
|
|
585
559
|
/**
|
|
586
560
|
* Styles applied to the root of the grouping column of the tree data.
|
|
587
561
|
*/
|
package/constants/gridClasses.js
CHANGED
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', '
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridCellIndexCoordinates, GridScrollParams, GridColDef, GridCellCoordinates, GridCellParams, GridEditMode } from '../../../models';
|
|
3
3
|
import { GridInitialStateCommunity } from '../../../models/gridStateCommunity';
|
|
4
4
|
import { GridExportStateParams, GridRestoreStatePreProcessingContext, GridRestoreStatePreProcessingValue } from '../../features/statePersistence/gridStatePersistenceInterface';
|
|
5
|
-
import { GridHydrateColumnsValue } from '../../features/columns/gridColumnsInterfaces';
|
|
5
|
+
import { GridHydrateColumnsValue, GridPinnedColumnPosition } from '../../features/columns/gridColumnsInterfaces';
|
|
6
6
|
import { GridRowEntry, GridRowId } from '../../../models/gridRows';
|
|
7
7
|
import { GridHydrateRowsValue } from '../../features/rows/gridRowsInterfaces';
|
|
8
8
|
import { GridPreferencePanelsValue } from '../../features/preferencesPanel';
|
|
@@ -75,6 +75,10 @@ export interface GridPipeProcessingLookup {
|
|
|
75
75
|
editMode: GridEditMode;
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
|
+
isColumnPinned: {
|
|
79
|
+
value: GridPinnedColumnPosition | false;
|
|
80
|
+
context: string;
|
|
81
|
+
};
|
|
78
82
|
}
|
|
79
83
|
export type GridPipeProcessor<P extends GridPipeProcessorGroup> = (value: GridPipeProcessingLookup[P]['value'], context: GridPipeProcessingLookup[P] extends {
|
|
80
84
|
context: any;
|
|
@@ -32,7 +32,7 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
|
32
32
|
* * `apiRef.current.requestPipeProcessorsApplication` is called for the given group.
|
|
33
33
|
*/
|
|
34
34
|
export const useGridPipeProcessing = apiRef => {
|
|
35
|
-
const
|
|
35
|
+
const cache = React.useRef({});
|
|
36
36
|
const isRunning = React.useRef(false);
|
|
37
37
|
const runAppliers = React.useCallback(groupCache => {
|
|
38
38
|
if (isRunning.current || !groupCache) {
|
|
@@ -45,52 +45,54 @@ export const useGridPipeProcessing = apiRef => {
|
|
|
45
45
|
isRunning.current = false;
|
|
46
46
|
}, []);
|
|
47
47
|
const registerPipeProcessor = React.useCallback((group, id, processor) => {
|
|
48
|
-
if (!
|
|
49
|
-
|
|
48
|
+
if (!cache.current[group]) {
|
|
49
|
+
cache.current[group] = {
|
|
50
50
|
processors: new Map(),
|
|
51
|
+
processorsAsArray: [],
|
|
51
52
|
appliers: {}
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
const groupCache =
|
|
55
|
+
const groupCache = cache.current[group];
|
|
55
56
|
const oldProcessor = groupCache.processors.get(id);
|
|
56
57
|
if (oldProcessor !== processor) {
|
|
57
58
|
groupCache.processors.set(id, processor);
|
|
59
|
+
groupCache.processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
58
60
|
runAppliers(groupCache);
|
|
59
61
|
}
|
|
60
62
|
return () => {
|
|
61
|
-
|
|
63
|
+
cache.current[group].processors.delete(id);
|
|
64
|
+
cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values());
|
|
62
65
|
};
|
|
63
66
|
}, [runAppliers]);
|
|
64
67
|
const registerPipeApplier = React.useCallback((group, id, applier) => {
|
|
65
|
-
if (!
|
|
66
|
-
|
|
68
|
+
if (!cache.current[group]) {
|
|
69
|
+
cache.current[group] = {
|
|
67
70
|
processors: new Map(),
|
|
71
|
+
processorsAsArray: [],
|
|
68
72
|
appliers: {}
|
|
69
73
|
};
|
|
70
74
|
}
|
|
71
|
-
|
|
75
|
+
cache.current[group].appliers[id] = applier;
|
|
72
76
|
return () => {
|
|
73
|
-
const _appliers =
|
|
77
|
+
const _appliers = cache.current[group].appliers,
|
|
74
78
|
otherAppliers = _objectWithoutPropertiesLoose(_appliers, [id].map(_toPropertyKey));
|
|
75
|
-
|
|
79
|
+
cache.current[group].appliers = otherAppliers;
|
|
76
80
|
};
|
|
77
81
|
}, []);
|
|
78
82
|
const requestPipeProcessorsApplication = React.useCallback(group => {
|
|
79
|
-
|
|
80
|
-
runAppliers(groupCache);
|
|
83
|
+
runAppliers(cache.current[group]);
|
|
81
84
|
}, [runAppliers]);
|
|
82
85
|
const applyPipeProcessors = React.useCallback((...args) => {
|
|
83
86
|
const [group, value, context] = args;
|
|
84
|
-
if (!
|
|
87
|
+
if (!cache.current[group]) {
|
|
85
88
|
return value;
|
|
86
89
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}, value);
|
|
90
|
+
const processors = cache.current[group].processorsAsArray;
|
|
91
|
+
let result = value;
|
|
92
|
+
for (let i = 0; i < processors.length; i += 1) {
|
|
93
|
+
result = processors[i](result, context);
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
94
96
|
}, []);
|
|
95
97
|
const preProcessingPrivateApi = {
|
|
96
98
|
registerPipeProcessor,
|