@mui/x-data-grid 7.0.0-beta.6 → 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 +117 -1
- 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/GridRow.d.ts +1 -1
- package/components/GridRow.js +4 -19
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- package/components/cell/GridCell.d.ts +7 -0
- package/components/cell/GridCell.js +11 -3
- 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 -20
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +6 -1
- 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/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 +4 -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/scroll/useGridScroll.js +1 -1
- 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/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 +1 -1
- package/internals/index.js +1 -1
- 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 +3 -3
- package/models/api/gridCoreApi.d.ts +1 -5
- 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 +4 -19
- package/modern/components/GridScrollArea.js +150 -0
- package/modern/components/cell/GridCell.js +11 -3
- 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 -20
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- 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 +4 -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/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- 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 +1 -1
- 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/utils/cellBorderUtils.js +8 -0
- 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 +3 -18
- package/node/components/GridScrollArea.js +158 -0
- package/node/components/cell/GridCell.js +12 -4
- 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 -20
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +6 -1
- package/node/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- 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 +4 -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/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- 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 -8
- 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/utils/cellBorderUtils.js +16 -0
- package/node/utils/domUtils.js +155 -0
- package/package.json +1 -1
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- 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
|
@@ -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?.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 */
|
|
@@ -520,20 +515,16 @@ export const GridRootStyles = styled('div', {
|
|
|
520
515
|
[`.${c.withBorderColor}`]: {
|
|
521
516
|
borderColor
|
|
522
517
|
},
|
|
523
|
-
[`& .${c['cell--withLeftBorder']}`]: {
|
|
518
|
+
[`& .${c['cell--withLeftBorder']}, & .${c['columnHeader--withLeftBorder']}`]: {
|
|
524
519
|
borderLeftColor: 'var(--DataGrid-rowBorderColor)',
|
|
525
520
|
borderLeftWidth: '1px',
|
|
526
521
|
borderLeftStyle: 'solid'
|
|
527
522
|
},
|
|
528
|
-
[`& .${c['cell--withRightBorder']}`]: {
|
|
523
|
+
[`& .${c['cell--withRightBorder']}, & .${c['columnHeader--withRightBorder']}`]: {
|
|
529
524
|
borderRightColor: 'var(--DataGrid-rowBorderColor)',
|
|
530
525
|
borderRightWidth: '1px',
|
|
531
526
|
borderRightStyle: 'solid'
|
|
532
527
|
},
|
|
533
|
-
[`& .${c['columnHeader--withRightBorder']}`]: {
|
|
534
|
-
borderRightWidth: '1px',
|
|
535
|
-
borderRightStyle: 'solid'
|
|
536
|
-
},
|
|
537
528
|
[`& .${c['cell--flex']}`]: {
|
|
538
529
|
display: 'flex',
|
|
539
530
|
alignItems: 'center',
|
|
@@ -634,12 +625,13 @@ export const GridRootStyles = styled('div', {
|
|
|
634
625
|
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
635
626
|
},
|
|
636
627
|
[`&.${c['scrollbarFiller--pinnedRight']}`]: {
|
|
637
|
-
backgroundColor: 'var(--DataGrid-pinnedBackground)'
|
|
638
|
-
},
|
|
639
|
-
[`&.${c['scrollbarFiller--pinnedRight']}:not(.${c['scrollbarFiller--header']})`]: {
|
|
628
|
+
backgroundColor: 'var(--DataGrid-pinnedBackground)',
|
|
640
629
|
position: 'sticky',
|
|
641
630
|
right: 0
|
|
642
631
|
}
|
|
632
|
+
},
|
|
633
|
+
[`& .${c.filler}`]: {
|
|
634
|
+
flex: 1
|
|
643
635
|
}
|
|
644
636
|
});
|
|
645
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';
|
|
@@ -66,7 +67,11 @@ function GridVirtualScroller(props) {
|
|
|
66
67
|
return /*#__PURE__*/_jsxs(Container, _extends({
|
|
67
68
|
className: classes.root
|
|
68
69
|
}, getContainerProps(), {
|
|
69
|
-
children: [/*#__PURE__*/
|
|
70
|
+
children: [/*#__PURE__*/_jsx(GridScrollArea, {
|
|
71
|
+
scrollDirection: "left"
|
|
72
|
+
}), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
73
|
+
scrollDirection: "right"
|
|
74
|
+
}), /*#__PURE__*/_jsxs(Scroller, _extends({
|
|
70
75
|
className: classes.scroller
|
|
71
76
|
}, getScrollerProps(), {
|
|
72
77
|
ownerState: rootProps,
|
|
@@ -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
|
});
|
|
@@ -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']);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
4
3
|
import { styled, useTheme } from '@mui/material/styles';
|
|
5
4
|
import { useGridSelector } from '../../utils';
|
|
6
5
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
@@ -13,16 +12,11 @@ import { computeOffsetLeft } from '../virtualization/useGridVirtualScroller';
|
|
|
13
12
|
import { GridColumnGroupHeader } from '../../../components/columnHeaders/GridColumnGroupHeader';
|
|
14
13
|
import { GridPinnedColumnPosition, gridColumnPositionsSelector, gridVisiblePinnedColumnDefinitionsSelector } from '../columns';
|
|
15
14
|
import { GridScrollbarFillerCell as ScrollbarFiller } from '../../../components/GridScrollbarFillerCell';
|
|
15
|
+
import { getPinnedCellOffset } from '../../../internals/utils/getPinnedCellOffset';
|
|
16
|
+
import { GridColumnHeaderSeparatorSides } from '../../../components/columnHeaders/GridColumnHeaderSeparator';
|
|
16
17
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
const SpaceFiller = styled('div')({
|
|
20
|
-
/* GridRootStyles conflict */
|
|
21
|
-
'&&&': {
|
|
22
|
-
padding: 0,
|
|
23
|
-
width: 'calc(var(--DataGrid-width) - var(--DataGrid-columnsTotalWidth))'
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
20
|
export const GridColumnHeaderRow = styled('div', {
|
|
27
21
|
name: 'MuiDataGrid',
|
|
28
22
|
slot: 'ColumnHeaderRow',
|
|
@@ -33,7 +27,6 @@ export const GridColumnHeaderRow = styled('div', {
|
|
|
33
27
|
});
|
|
34
28
|
export const useGridColumnHeaders = props => {
|
|
35
29
|
const {
|
|
36
|
-
innerRef: innerRefProp,
|
|
37
30
|
visibleColumns,
|
|
38
31
|
sortColumnLookup,
|
|
39
32
|
filterColumnLookup,
|
|
@@ -53,20 +46,30 @@ export const useGridColumnHeaders = props => {
|
|
|
53
46
|
const theme = useTheme();
|
|
54
47
|
const rootProps = useGridRootProps();
|
|
55
48
|
const hasVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
56
|
-
const innerRef = React.useRef(null);
|
|
57
|
-
const handleInnerRef = useForkRef(innerRefProp, innerRef);
|
|
58
49
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
59
50
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
60
51
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
61
52
|
const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
62
53
|
const offsetLeft = computeOffsetLeft(columnPositions, renderContext, theme.direction, pinnedColumns.left.length);
|
|
63
54
|
React.useEffect(() => {
|
|
64
|
-
apiRef.current.
|
|
55
|
+
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
65
56
|
}, [apiRef]);
|
|
66
57
|
const handleColumnResizeStart = React.useCallback(params => setResizeCol(params.field), []);
|
|
67
58
|
const handleColumnResizeStop = React.useCallback(() => setResizeCol(''), []);
|
|
68
59
|
const handleColumnReorderStart = React.useCallback(params => setDragCol(params.field), []);
|
|
69
60
|
const handleColumnReorderStop = React.useCallback(() => setDragCol(''), []);
|
|
61
|
+
const leftRenderContext = React.useMemo(() => {
|
|
62
|
+
return pinnedColumns.left.length ? {
|
|
63
|
+
firstColumnIndex: 0,
|
|
64
|
+
lastColumnIndex: pinnedColumns.left.length
|
|
65
|
+
} : null;
|
|
66
|
+
}, [pinnedColumns.left.length]);
|
|
67
|
+
const rightRenderContext = React.useMemo(() => {
|
|
68
|
+
return pinnedColumns.right.length ? {
|
|
69
|
+
firstColumnIndex: visibleColumns.length - pinnedColumns.right.length,
|
|
70
|
+
lastColumnIndex: visibleColumns.length
|
|
71
|
+
} : null;
|
|
72
|
+
}, [pinnedColumns.right.length, visibleColumns.length]);
|
|
70
73
|
useGridApiEventHandler(apiRef, 'columnResizeStart', handleColumnResizeStart);
|
|
71
74
|
useGridApiEventHandler(apiRef, 'columnResizeStop', handleColumnResizeStop);
|
|
72
75
|
useGridApiEventHandler(apiRef, 'columnHeaderDragStart', handleColumnReorderStart);
|
|
@@ -99,8 +102,9 @@ export const useGridColumnHeaders = props => {
|
|
|
99
102
|
style: {
|
|
100
103
|
width: leftOffsetWidth
|
|
101
104
|
}
|
|
102
|
-
}), children, isNotPinned && /*#__PURE__*/_jsx(
|
|
103
|
-
|
|
105
|
+
}), children, isNotPinned && /*#__PURE__*/_jsx("div", {
|
|
106
|
+
role: "presentation",
|
|
107
|
+
className: gridClasses.filler
|
|
104
108
|
}), hasScrollbarFiller && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
105
109
|
header: true,
|
|
106
110
|
borderTop: borderTop,
|
|
@@ -108,6 +112,27 @@ export const useGridColumnHeaders = props => {
|
|
|
108
112
|
})]
|
|
109
113
|
});
|
|
110
114
|
};
|
|
115
|
+
const getCellOffsetStyle = ({
|
|
116
|
+
pinnedPosition,
|
|
117
|
+
columnIndex,
|
|
118
|
+
computedWidth
|
|
119
|
+
}) => {
|
|
120
|
+
let style;
|
|
121
|
+
if (pinnedPosition === 'left' || pinnedPosition === 'right') {
|
|
122
|
+
const pinnedOffset = getPinnedCellOffset(pinnedPosition, computedWidth, columnIndex, columnPositions, dimensions);
|
|
123
|
+
if (pinnedPosition === 'left') {
|
|
124
|
+
style = {
|
|
125
|
+
left: pinnedOffset
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (pinnedPosition === 'right') {
|
|
129
|
+
style = {
|
|
130
|
+
right: pinnedOffset
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return style;
|
|
135
|
+
};
|
|
111
136
|
const getColumnHeaders = (params, other = {}) => {
|
|
112
137
|
const {
|
|
113
138
|
renderedColumns,
|
|
@@ -121,6 +146,12 @@ export const useGridColumnHeaders = props => {
|
|
|
121
146
|
const tabIndex = columnHeaderTabIndexState !== null && columnHeaderTabIndexState.field === colDef.field || isFirstColumn && !hasOtherElementInTabSequence ? 0 : -1;
|
|
122
147
|
const hasFocus = columnHeaderFocus !== null && columnHeaderFocus.field === colDef.field;
|
|
123
148
|
const open = columnMenuState.open && columnMenuState.field === colDef.field;
|
|
149
|
+
const pinnedPosition = params?.position;
|
|
150
|
+
const style = getCellOffsetStyle({
|
|
151
|
+
pinnedPosition,
|
|
152
|
+
columnIndex,
|
|
153
|
+
computedWidth: colDef.computedWidth
|
|
154
|
+
});
|
|
124
155
|
columns.push( /*#__PURE__*/_jsx(GridColumnHeaderItem, _extends({}, sortColumnLookup[colDef.field], {
|
|
125
156
|
columnMenuOpen: open,
|
|
126
157
|
filterItemsCounter: filterColumnLookup[colDef.field] && filterColumnLookup[colDef.field].length,
|
|
@@ -130,118 +161,174 @@ export const useGridColumnHeaders = props => {
|
|
|
130
161
|
colIndex: columnIndex,
|
|
131
162
|
isResizing: resizeCol === colDef.field,
|
|
132
163
|
hasFocus: hasFocus,
|
|
133
|
-
tabIndex: tabIndex
|
|
164
|
+
tabIndex: tabIndex,
|
|
165
|
+
pinnedPosition: pinnedPosition,
|
|
166
|
+
style: style,
|
|
167
|
+
indexInSection: i,
|
|
168
|
+
sectionLength: renderedColumns.length
|
|
134
169
|
}, other), colDef.field));
|
|
135
170
|
}
|
|
136
|
-
return
|
|
171
|
+
return getFillers(params, columns, 0);
|
|
172
|
+
};
|
|
173
|
+
const getColumnHeadersRow = () => {
|
|
174
|
+
return /*#__PURE__*/_jsxs(GridColumnHeaderRow, {
|
|
137
175
|
role: "row",
|
|
138
176
|
"aria-rowindex": headerGroupingMaxDepth + 1,
|
|
139
177
|
ownerState: rootProps,
|
|
140
|
-
children:
|
|
178
|
+
children: [leftRenderContext && getColumnHeaders({
|
|
179
|
+
position: GridPinnedColumnPosition.LEFT,
|
|
180
|
+
renderContext: leftRenderContext,
|
|
181
|
+
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
182
|
+
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
183
|
+
}, {
|
|
184
|
+
disableReorder: true
|
|
185
|
+
}), getColumnHeaders({
|
|
186
|
+
renderContext,
|
|
187
|
+
minFirstColumn: pinnedColumns.left.length,
|
|
188
|
+
maxLastColumn: visibleColumns.length - pinnedColumns.right.length
|
|
189
|
+
}), rightRenderContext && getColumnHeaders({
|
|
190
|
+
position: GridPinnedColumnPosition.RIGHT,
|
|
191
|
+
renderContext: rightRenderContext,
|
|
192
|
+
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
193
|
+
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
194
|
+
}, {
|
|
195
|
+
disableReorder: true,
|
|
196
|
+
separatorSide: GridColumnHeaderSeparatorSides.Left
|
|
197
|
+
})]
|
|
141
198
|
});
|
|
142
199
|
};
|
|
143
|
-
const getColumnGroupHeaders =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
200
|
+
const getColumnGroupHeaders = ({
|
|
201
|
+
depth,
|
|
202
|
+
params
|
|
203
|
+
}) => {
|
|
147
204
|
const columnsToRender = getColumnsToRender(params);
|
|
148
205
|
if (columnsToRender.renderedColumns.length === 0) {
|
|
149
206
|
return null;
|
|
150
207
|
}
|
|
151
208
|
const {
|
|
209
|
+
renderedColumns,
|
|
152
210
|
firstColumnToRender,
|
|
153
211
|
lastColumnToRender
|
|
154
212
|
} = columnsToRender;
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const visibleColumnGroupHeader = rowStructure.slice(firstGroupIndex, lastGroupIndex + 1).map(groupStructure => {
|
|
172
|
-
return _extends({}, groupStructure, {
|
|
173
|
-
columnFields: groupStructure.columnFields.filter(field => columnVisibility[field] !== false)
|
|
174
|
-
});
|
|
175
|
-
}).filter(groupStructure => groupStructure.columnFields.length > 0);
|
|
176
|
-
const firstVisibleColumnIndex = visibleColumnGroupHeader[0].columnFields.indexOf(firstColumnFieldToRender);
|
|
177
|
-
const hiddenGroupColumns = visibleColumnGroupHeader[0].columnFields.slice(0, firstVisibleColumnIndex);
|
|
178
|
-
const leftOverflow = hiddenGroupColumns.reduce((acc, field) => {
|
|
179
|
-
const column = apiRef.current.getColumn(field);
|
|
180
|
-
return acc + (column.computedWidth ?? 0);
|
|
181
|
-
}, 0);
|
|
182
|
-
let columnIndex = firstColumnToRender;
|
|
183
|
-
const elements = visibleColumnGroupHeader.map(({
|
|
184
|
-
groupId,
|
|
185
|
-
columnFields
|
|
186
|
-
}) => {
|
|
187
|
-
const hasFocus = columnGroupHeaderFocus !== null && columnGroupHeaderFocus.depth === depth && columnFields.includes(columnGroupHeaderFocus.field);
|
|
188
|
-
const tabIndex = columnGroupHeaderTabIndexState !== null && columnGroupHeaderTabIndexState.depth === depth && columnFields.includes(columnGroupHeaderTabIndexState.field) ? 0 : -1;
|
|
189
|
-
const headerInfo = {
|
|
190
|
-
groupId,
|
|
191
|
-
width: columnFields.reduce((acc, field) => acc + apiRef.current.getColumn(field).computedWidth, 0),
|
|
192
|
-
fields: columnFields,
|
|
193
|
-
colIndex: columnIndex,
|
|
194
|
-
hasFocus,
|
|
195
|
-
tabIndex
|
|
196
|
-
};
|
|
197
|
-
columnIndex += columnFields.length;
|
|
198
|
-
return headerInfo;
|
|
199
|
-
});
|
|
200
|
-
headerToRender.push({
|
|
201
|
-
leftOverflow,
|
|
202
|
-
elements
|
|
213
|
+
const rowStructure = columnGroupsHeaderStructure[depth];
|
|
214
|
+
const firstColumnFieldToRender = visibleColumns[firstColumnToRender].field;
|
|
215
|
+
const firstGroupToRender = apiRef.current.getColumnGroupPath(firstColumnFieldToRender)[depth] ?? null;
|
|
216
|
+
const firstGroupIndex = rowStructure.findIndex(({
|
|
217
|
+
groupId,
|
|
218
|
+
columnFields
|
|
219
|
+
}) => groupId === firstGroupToRender && columnFields.includes(firstColumnFieldToRender));
|
|
220
|
+
const lastColumnFieldToRender = visibleColumns[lastColumnToRender - 1].field;
|
|
221
|
+
const lastGroupToRender = apiRef.current.getColumnGroupPath(lastColumnFieldToRender)[depth] ?? null;
|
|
222
|
+
const lastGroupIndex = rowStructure.findIndex(({
|
|
223
|
+
groupId,
|
|
224
|
+
columnFields
|
|
225
|
+
}) => groupId === lastGroupToRender && columnFields.includes(lastColumnFieldToRender));
|
|
226
|
+
const visibleColumnGroupHeader = rowStructure.slice(firstGroupIndex, lastGroupIndex + 1).map(groupStructure => {
|
|
227
|
+
return _extends({}, groupStructure, {
|
|
228
|
+
columnFields: groupStructure.columnFields.filter(field => columnVisibility[field] !== false)
|
|
203
229
|
});
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
230
|
+
}).filter(groupStructure => groupStructure.columnFields.length > 0);
|
|
231
|
+
const firstVisibleColumnIndex = visibleColumnGroupHeader[0].columnFields.indexOf(firstColumnFieldToRender);
|
|
232
|
+
const hiddenGroupColumns = visibleColumnGroupHeader[0].columnFields.slice(0, firstVisibleColumnIndex);
|
|
233
|
+
const leftOverflow = hiddenGroupColumns.reduce((acc, field) => {
|
|
234
|
+
const column = apiRef.current.getColumn(field);
|
|
235
|
+
return acc + (column.computedWidth ?? 0);
|
|
236
|
+
}, 0);
|
|
237
|
+
let columnIndex = firstColumnToRender;
|
|
238
|
+
const children = visibleColumnGroupHeader.map(({
|
|
239
|
+
groupId,
|
|
240
|
+
columnFields
|
|
241
|
+
}, index) => {
|
|
242
|
+
const hasFocus = columnGroupHeaderFocus !== null && columnGroupHeaderFocus.depth === depth && columnFields.includes(columnGroupHeaderFocus.field);
|
|
243
|
+
const tabIndex = columnGroupHeaderTabIndexState !== null && columnGroupHeaderTabIndexState.depth === depth && columnFields.includes(columnGroupHeaderTabIndexState.field) ? 0 : -1;
|
|
244
|
+
const headerInfo = {
|
|
207
245
|
groupId,
|
|
208
|
-
width,
|
|
209
|
-
fields,
|
|
210
|
-
colIndex,
|
|
246
|
+
width: columnFields.reduce((acc, field) => acc + apiRef.current.getColumn(field).computedWidth, 0),
|
|
247
|
+
fields: columnFields,
|
|
248
|
+
colIndex: columnIndex,
|
|
211
249
|
hasFocus,
|
|
212
250
|
tabIndex
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
depth: depthIndex,
|
|
220
|
-
isLastColumn: colIndex === visibleColumns.length - fields.length,
|
|
221
|
-
maxDepth: headerToRender.length,
|
|
222
|
-
height: dimensions.headerHeight,
|
|
223
|
-
hasFocus: hasFocus,
|
|
224
|
-
tabIndex: tabIndex
|
|
225
|
-
}, groupIndex);
|
|
251
|
+
};
|
|
252
|
+
const pinnedPosition = params.position;
|
|
253
|
+
const style = getCellOffsetStyle({
|
|
254
|
+
pinnedPosition,
|
|
255
|
+
columnIndex,
|
|
256
|
+
computedWidth: headerInfo.width
|
|
226
257
|
});
|
|
227
|
-
|
|
258
|
+
columnIndex += columnFields.length;
|
|
259
|
+
let indexInSection = index;
|
|
260
|
+
if (pinnedPosition === 'left') {
|
|
261
|
+
// Group headers can expand to multiple columns, we need to adjust the index
|
|
262
|
+
indexInSection = columnIndex - 1;
|
|
263
|
+
}
|
|
264
|
+
return /*#__PURE__*/_jsx(GridColumnGroupHeader, {
|
|
265
|
+
groupId: groupId,
|
|
266
|
+
width: headerInfo.width,
|
|
267
|
+
fields: headerInfo.fields,
|
|
268
|
+
colIndex: headerInfo.colIndex,
|
|
269
|
+
depth: depth,
|
|
270
|
+
isLastColumn: headerInfo.colIndex === visibleColumns.length - headerInfo.fields.length,
|
|
271
|
+
maxDepth: headerGroupingMaxDepth,
|
|
272
|
+
height: dimensions.headerHeight,
|
|
273
|
+
hasFocus: hasFocus,
|
|
274
|
+
tabIndex: tabIndex,
|
|
275
|
+
pinnedPosition: pinnedPosition,
|
|
276
|
+
style: style,
|
|
277
|
+
indexInSection: indexInSection,
|
|
278
|
+
sectionLength: renderedColumns.length
|
|
279
|
+
}, index);
|
|
280
|
+
});
|
|
281
|
+
return getFillers(params, children, leftOverflow);
|
|
282
|
+
};
|
|
283
|
+
const getColumnGroupHeadersRows = () => {
|
|
284
|
+
if (headerGroupingMaxDepth === 0) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
const headerRows = [];
|
|
288
|
+
for (let depth = 0; depth < headerGroupingMaxDepth; depth += 1) {
|
|
289
|
+
headerRows.push( /*#__PURE__*/_jsxs(GridColumnHeaderRow, {
|
|
228
290
|
role: "row",
|
|
229
|
-
"aria-rowindex":
|
|
291
|
+
"aria-rowindex": depth + 1,
|
|
230
292
|
ownerState: rootProps,
|
|
231
|
-
children:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
293
|
+
children: [leftRenderContext && getColumnGroupHeaders({
|
|
294
|
+
depth,
|
|
295
|
+
params: {
|
|
296
|
+
position: GridPinnedColumnPosition.LEFT,
|
|
297
|
+
renderContext: leftRenderContext,
|
|
298
|
+
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
299
|
+
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
300
|
+
}
|
|
301
|
+
}), getColumnGroupHeaders({
|
|
302
|
+
depth,
|
|
303
|
+
params: {
|
|
304
|
+
renderContext
|
|
305
|
+
}
|
|
306
|
+
}), rightRenderContext && getColumnGroupHeaders({
|
|
307
|
+
depth,
|
|
308
|
+
params: {
|
|
309
|
+
position: GridPinnedColumnPosition.RIGHT,
|
|
310
|
+
renderContext: rightRenderContext,
|
|
311
|
+
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
312
|
+
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
313
|
+
}
|
|
314
|
+
})]
|
|
315
|
+
}, depth));
|
|
316
|
+
}
|
|
317
|
+
return headerRows;
|
|
235
318
|
};
|
|
236
319
|
return {
|
|
237
320
|
renderContext,
|
|
321
|
+
leftRenderContext,
|
|
322
|
+
rightRenderContext,
|
|
323
|
+
pinnedColumns,
|
|
324
|
+
visibleColumns,
|
|
325
|
+
getCellOffsetStyle,
|
|
238
326
|
getFillers,
|
|
239
|
-
|
|
327
|
+
getColumnHeadersRow,
|
|
240
328
|
getColumnsToRender,
|
|
241
|
-
|
|
329
|
+
getColumnGroupHeadersRows,
|
|
242
330
|
isDragging: !!dragCol,
|
|
243
331
|
getInnerProps: () => ({
|
|
244
|
-
ref: handleInnerRef,
|
|
245
332
|
role: 'rowgroup'
|
|
246
333
|
})
|
|
247
334
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|