@mui/x-data-grid 7.23.5 → 7.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +159 -0
- package/DataGrid/DataGrid.js +4 -5
- package/DataGrid/useDataGridComponent.d.ts +1 -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/GridActionsCellItem.d.ts +3 -3
- package/components/cell/GridCell.d.ts +9 -16
- package/components/cell/GridCell.js +17 -35
- package/components/cell/GridEditDateCell.js +1 -1
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/cell/GridEditSingleSelectCell.js +2 -2
- package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -5
- package/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -5
- package/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/components/columnSelection/GridCellCheckboxRenderer.js +4 -3
- package/components/columnSelection/GridHeaderCheckbox.js +6 -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.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +7 -10
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/components/virtualization/GridVirtualScroller.js +4 -4
- package/context/GridContextProvider.d.ts +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +1 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +1 -1
- package/hooks/core/useGridApiInitialization.d.ts +1 -1
- package/hooks/core/useGridApiInitialization.js +2 -2
- package/hooks/core/useGridInitialization.d.ts +1 -1
- package/hooks/core/useGridIsRtl.d.ts +1 -1
- package/hooks/core/useGridLocaleText.d.ts +1 -1
- package/hooks/core/useGridLoggerFactory.d.ts +1 -1
- package/hooks/core/useGridRefs.d.ts +1 -1
- package/hooks/core/useGridStateInitialization.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +8 -6
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -3
- package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/hooks/features/editing/useGridCellEditing.d.ts +1 -1
- package/hooks/features/editing/useGridEditing.d.ts +1 -1
- package/hooks/features/editing/useGridRowEditing.d.ts +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/export/serializers/csvSerializer.d.ts +1 -1
- package/hooks/features/export/useGridCsvExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.js +1 -1
- package/hooks/features/export/utils.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.js +6 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +6 -6
- package/hooks/features/filter/gridFilterUtils.js +3 -3
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/focus/useGridFocus.d.ts +1 -1
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/utils.d.ts +2 -2
- package/hooks/features/listView/useGridListView.d.ts +1 -1
- 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 +2 -2
- package/hooks/features/pagination/useGridPagination.js +5 -3
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationModel.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationModel.js +23 -1
- package/hooks/features/pagination/useGridRowCount.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +1 -1
- package/hooks/features/rowSelection/utils.d.ts +2 -2
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsSelector.js +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +3 -3
- package/hooks/features/rows/useGridParamsApi.d.ts +1 -1
- package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
- package/hooks/features/rows/useGridRows.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +2 -2
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/rows/useGridRowsPreProcessors.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/sorting/gridSortingUtils.d.ts +2 -2
- package/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/statePersistence/useGridStatePersistence.d.ts +1 -1
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +6 -0
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +5 -4
- package/hooks/features/virtualization/useGridVirtualScroller.js +96 -43
- package/hooks/features/virtualization/useGridVirtualization.d.ts +1 -1
- package/hooks/utils/useGridApiContext.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +3 -3
- package/hooks/utils/useGridApiEventHandler.js +1 -1
- package/hooks/utils/useGridApiMethod.d.ts +1 -1
- package/hooks/utils/useGridApiRef.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.d.ts +2 -2
- package/hooks/utils/useGridLogger.d.ts +1 -1
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
- package/hooks/utils/useGridSelector.d.ts +2 -2
- package/hooks/utils/useGridVisibleRows.d.ts +7 -5
- 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/urPK.js +9 -10
- package/models/api/gridCoreApi.d.ts +7 -7
- package/models/api/gridDensityApi.d.ts +1 -1
- package/models/colDef/gridColDef.d.ts +8 -8
- package/models/events/gridEventLookup.d.ts +6 -1
- package/models/gridExport.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/gridStateCommunity.d.ts +4 -0
- package/models/props/DataGridProps.d.ts +1 -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/cell/GridEditDateCell.js +1 -1
- package/modern/components/cell/GridEditInputCell.js +1 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -2
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +4 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +6 -2
- package/modern/components/containers/GridRoot.js +14 -6
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +7 -10
- package/modern/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/modern/components/virtualization/GridVirtualScroller.js +4 -4
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
- package/modern/hooks/core/useGridApiInitialization.js +2 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/modern/hooks/features/columnResize/useGridColumnResize.js +8 -6
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/useGridPrintExport.js +1 -1
- 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/useGridPreferencesPanel.js +2 -2
- 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 +96 -43
- package/modern/hooks/utils/useGridApiEventHandler.js +1 -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/urPK.js +9 -10
- package/modern/utils/cellBorderUtils.js +5 -5
- package/modern/utils/domUtils.js +7 -2
- 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/cell/GridEditDateCell.js +1 -1
- package/node/components/cell/GridEditInputCell.js +1 -1
- package/node/components/cell/GridEditSingleSelectCell.js +2 -2
- package/node/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/node/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +3 -2
- package/node/components/columnSelection/GridHeaderCheckbox.js +6 -2
- package/node/components/containers/GridRoot.js +14 -6
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/panel/filterPanel/GridFilterInputValue.js +7 -10
- package/node/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/node/components/virtualization/GridVirtualScroller.js +4 -4
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +1 -1
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +1 -1
- package/node/hooks/core/useGridApiInitialization.js +2 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +32 -74
- package/node/hooks/features/columnResize/useGridColumnResize.js +8 -6
- package/node/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/useGridPrintExport.js +1 -1
- 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/useGridPreferencesPanel.js +2 -2
- 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 +96 -43
- package/node/hooks/utils/useGridApiEventHandler.js +1 -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/urPK.js +9 -10
- package/node/utils/cellBorderUtils.js +5 -5
- package/node/utils/domUtils.js +7 -2
- 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 +2 -2
- package/utils/domUtils.js +7 -2
- package/utils/getPublicApiRef.d.ts +1 -1
- package/utils/rtlFlipSide.d.ts +2 -0
- package/utils/rtlFlipSide.js +22 -0
|
@@ -22,17 +22,17 @@ function GridFilterInputValue(props) {
|
|
|
22
22
|
} = props,
|
|
23
23
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
24
24
|
const filterTimeout = useTimeout();
|
|
25
|
-
const [filterValueState, setFilterValueState] = React.useState(sanitizeFilterItemValue(item.value
|
|
25
|
+
const [filterValueState, setFilterValueState] = React.useState(sanitizeFilterItemValue(item.value));
|
|
26
26
|
const [applying, setIsApplying] = React.useState(false);
|
|
27
27
|
const id = useId();
|
|
28
28
|
const rootProps = useGridRootProps();
|
|
29
29
|
const onFilterChange = React.useCallback(event => {
|
|
30
|
-
const value = sanitizeFilterItemValue(event.target.value
|
|
30
|
+
const value = sanitizeFilterItemValue(event.target.value);
|
|
31
31
|
setFilterValueState(value);
|
|
32
32
|
setIsApplying(true);
|
|
33
33
|
filterTimeout.start(rootProps.filterDebounceMs, () => {
|
|
34
34
|
const newItem = _extends({}, item, {
|
|
35
|
-
value,
|
|
35
|
+
value: type === 'number' && !Number.isNaN(Number(value)) ? Number(value) : value,
|
|
36
36
|
fromInput: id
|
|
37
37
|
});
|
|
38
38
|
applyValue(newItem);
|
|
@@ -42,14 +42,14 @@ function GridFilterInputValue(props) {
|
|
|
42
42
|
React.useEffect(() => {
|
|
43
43
|
const itemPlusTag = item;
|
|
44
44
|
if (itemPlusTag.fromInput !== id || item.value == null) {
|
|
45
|
-
setFilterValueState(sanitizeFilterItemValue(item.value
|
|
45
|
+
setFilterValueState(sanitizeFilterItemValue(item.value));
|
|
46
46
|
}
|
|
47
|
-
}, [id, item
|
|
47
|
+
}, [id, item]);
|
|
48
48
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
49
49
|
id: id,
|
|
50
50
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
51
51
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
52
|
-
value: filterValueState
|
|
52
|
+
value: filterValueState ?? '',
|
|
53
53
|
onChange: onFilterChange,
|
|
54
54
|
variant: variant,
|
|
55
55
|
type: type || 'text',
|
|
@@ -71,13 +71,10 @@ function GridFilterInputValue(props) {
|
|
|
71
71
|
inputRef: focusElementRef
|
|
72
72
|
}, others, rootProps.slotProps?.baseTextField));
|
|
73
73
|
}
|
|
74
|
-
function sanitizeFilterItemValue(value
|
|
74
|
+
function sanitizeFilterItemValue(value) {
|
|
75
75
|
if (value == null || value === '') {
|
|
76
76
|
return undefined;
|
|
77
77
|
}
|
|
78
|
-
if (type === 'number') {
|
|
79
|
-
return Number(value);
|
|
80
|
-
}
|
|
81
78
|
return String(value);
|
|
82
79
|
}
|
|
83
80
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
@@ -6,6 +6,6 @@ import type { GridApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
|
6
6
|
export type GridFilterInputValueProps<Api extends GridApiCommon = GridApiCommunity> = {
|
|
7
7
|
item: GridFilterItem;
|
|
8
8
|
applyValue: (value: GridFilterItem) => void;
|
|
9
|
-
apiRef: React.
|
|
9
|
+
apiRef: React.RefObject<Api>;
|
|
10
10
|
focusElementRef?: React.Ref<any>;
|
|
11
11
|
} & Pick<TextFieldProps, 'color' | 'error' | 'helperText' | 'size' | 'variant'>;
|
|
@@ -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 };
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
|
|
3
3
|
import { GridConfiguration } from '../models/configuration/gridConfiguration';
|
|
4
4
|
type GridContextProviderProps = {
|
|
5
|
-
privateApiRef: React.
|
|
5
|
+
privateApiRef: React.RefObject<GridPrivateApiCommunity>;
|
|
6
6
|
configuration: GridConfiguration;
|
|
7
7
|
props: {};
|
|
8
8
|
children: React.ReactNode;
|
|
@@ -29,4 +29,4 @@ import { GridPrivateApiCommon } from '../../../models/api/gridApiCommon';
|
|
|
29
29
|
* * a processor is registered.
|
|
30
30
|
* * `apiRef.current.requestPipeProcessorsApplication` is called for the given group.
|
|
31
31
|
*/
|
|
32
|
-
export declare const useGridPipeProcessing: (apiRef: React.
|
|
32
|
+
export declare const useGridPipeProcessing: (apiRef: React.RefObject<GridPrivateApiCommon>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
3
|
import { GridPipeProcessorGroup } from './gridPipeProcessingApi';
|
|
4
|
-
export declare const useGridRegisterPipeApplier: <PrivateApi extends GridPrivateApiCommon, G extends GridPipeProcessorGroup>(apiRef: React.
|
|
4
|
+
export declare const useGridRegisterPipeApplier: <PrivateApi extends GridPrivateApiCommon, G extends GridPipeProcessorGroup>(apiRef: React.RefObject<PrivateApi>, group: G, callback: () => void) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from "../../utils/useFirstRender.js";
|
|
3
3
|
export const useGridRegisterPipeApplier = (apiRef, group, callback) => {
|
|
4
|
-
const cleanup = React.useRef();
|
|
4
|
+
const cleanup = React.useRef(null);
|
|
5
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
6
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
7
7
|
cleanup.current = apiRef.current.registerPipeApplier(group, id.current, callback);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
3
|
import { GridPipeProcessorGroup, GridPipeProcessor } from './gridPipeProcessingApi';
|
|
4
|
-
export declare const useGridRegisterPipeProcessor: <PrivateApi extends GridPrivateApiCommon, G extends GridPipeProcessorGroup>(apiRef: React.
|
|
4
|
+
export declare const useGridRegisterPipeProcessor: <PrivateApi extends GridPrivateApiCommon, G extends GridPipeProcessorGroup>(apiRef: React.RefObject<PrivateApi>, group: G, callback: GridPipeProcessor<G>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from "../../utils/useFirstRender.js";
|
|
3
3
|
export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
4
|
-
const cleanup = React.useRef();
|
|
4
|
+
const cleanup = React.useRef(null);
|
|
5
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
6
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
7
7
|
cleanup.current = apiRef.current.registerPipeProcessor(group, id.current, callback);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
3
|
import { GridStrategyProcessorName, GridStrategyProcessor } from './gridStrategyProcessingApi';
|
|
4
|
-
export declare const useGridRegisterStrategyProcessor: <Api extends GridPrivateApiCommon, G extends GridStrategyProcessorName>(apiRef: React.
|
|
4
|
+
export declare const useGridRegisterStrategyProcessor: <Api extends GridPrivateApiCommon, G extends GridStrategyProcessorName>(apiRef: React.RefObject<Api>, strategyName: string, group: G, processor: GridStrategyProcessor<G>) => void;
|
|
@@ -45,4 +45,4 @@ export declare const GRID_STRATEGIES_PROCESSORS: {
|
|
|
45
45
|
* - sorting algorithm.
|
|
46
46
|
* - filtering algorithm.
|
|
47
47
|
*/
|
|
48
|
-
export declare const useGridStrategyProcessing: (apiRef: React.
|
|
48
|
+
export declare const useGridStrategyProcessing: (apiRef: React.RefObject<GridPrivateApiCommon>) => void;
|
|
@@ -2,4 +2,4 @@ import * as React from 'react';
|
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
3
|
import type { GridApiCommon, GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
4
4
|
export declare function unwrapPrivateAPI<PrivateApi extends GridPrivateApiCommon, Api extends GridApiCommon>(publicApi: Api): PrivateApi;
|
|
5
|
-
export declare function useGridApiInitialization<PrivateApi extends GridPrivateApiCommon, Api extends GridApiCommon>(inputApiRef: React.
|
|
5
|
+
export declare function useGridApiInitialization<PrivateApi extends GridPrivateApiCommon, Api extends GridApiCommon>(inputApiRef: React.RefObject<Api> | undefined, props: Pick<DataGridProcessedProps, 'signature'>): React.RefObject<PrivateApi>;
|
|
@@ -68,8 +68,8 @@ function createPublicAPI(privateApiRef) {
|
|
|
68
68
|
return publicApi;
|
|
69
69
|
}
|
|
70
70
|
export function useGridApiInitialization(inputApiRef, props) {
|
|
71
|
-
const publicApiRef = React.useRef();
|
|
72
|
-
const privateApiRef = React.useRef();
|
|
71
|
+
const publicApiRef = React.useRef(null);
|
|
72
|
+
const privateApiRef = React.useRef(null);
|
|
73
73
|
if (!privateApiRef.current) {
|
|
74
74
|
privateApiRef.current = createPrivateAPI(publicApiRef);
|
|
75
75
|
}
|
|
@@ -4,4 +4,4 @@ import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
|
4
4
|
/**
|
|
5
5
|
* Initialize the technical pieces of the DataGrid (logger, state, ...) that any DataGrid implementation needs
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridInitialization: <PrivateApi extends GridPrivateApiCommon, Api extends GridApiCommon>(inputApiRef: React.
|
|
7
|
+
export declare const useGridInitialization: <PrivateApi extends GridPrivateApiCommon, Api extends GridApiCommon>(inputApiRef: React.RefObject<Api> | undefined, props: DataGridProcessedProps) => React.RefObject<PrivateApi>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
|
-
export declare const useGridIsRtl: (apiRef: React.
|
|
3
|
+
export declare const useGridIsRtl: (apiRef: React.RefObject<GridPrivateApiCommon>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
4
|
-
export declare const useGridLocaleText: (apiRef: React.
|
|
4
|
+
export declare const useGridLocaleText: (apiRef: React.RefObject<GridPrivateApiCommon>, props: Pick<DataGridProcessedProps, "localeText">) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
4
|
-
export declare const useGridLoggerFactory: (apiRef: React.
|
|
4
|
+
export declare const useGridLoggerFactory: (apiRef: React.RefObject<GridPrivateApiCommon>, props: Pick<DataGridProcessedProps, "logger" | "logLevel">) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
|
-
export declare const useGridRefs: <PrivateApi extends GridPrivateApiCommon>(apiRef: React.
|
|
3
|
+
export declare const useGridRefs: <PrivateApi extends GridPrivateApiCommon>(apiRef: React.RefObject<PrivateApi>) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
|
-
export declare const useGridStateInitialization: <PrivateApi extends GridPrivateApiCommon>(apiRef: React.
|
|
3
|
+
export declare const useGridStateInitialization: <PrivateApi extends GridPrivateApiCommon>(apiRef: React.RefObject<PrivateApi>) => void;
|
|
@@ -5,4 +5,4 @@ import type { DataGridProcessedProps } from '../../../models/props/DataGridProps
|
|
|
5
5
|
* @requires useGridCsvExport (method)
|
|
6
6
|
* @requires useGridSelection (method)
|
|
7
7
|
*/
|
|
8
|
-
export declare const useGridClipboard: (apiRef: React.
|
|
8
|
+
export declare const useGridClipboard: (apiRef: React.RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "ignoreValueFormatterDuringExport" | "onClipboardCopy" | "clipboardCopyCellDelimiter">) => void;
|
|
@@ -7,4 +7,4 @@ export declare const columnGroupsStateInitializer: GridStateInitializer<Pick<Dat
|
|
|
7
7
|
* @requires useGridColumns (method, event)
|
|
8
8
|
* @requires useGridParamsApi (method)
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridColumnGrouping: (apiRef: React.
|
|
10
|
+
export declare const useGridColumnGrouping: (apiRef: React.RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "columnGroupingModel">) => void;
|
|
@@ -6,8 +6,9 @@ import { GridSortColumnLookup } from '../sorting';
|
|
|
6
6
|
import { GridFilterActiveItemsLookup } from '../filter';
|
|
7
7
|
import { GridColumnGroupIdentifier, GridColumnIdentifier } from '../focus';
|
|
8
8
|
import { GridColumnMenuState } from '../columnMenu';
|
|
9
|
-
import {
|
|
9
|
+
import { GridColumnVisibilityModel, gridColumnPositionsSelector } from '../columns';
|
|
10
10
|
import { GridGroupingStructure } from '../columnGrouping/gridColumnGroupsInterfaces';
|
|
11
|
+
import { PinnedColumnPosition } from '../../../internals/constants';
|
|
11
12
|
export interface UseGridColumnHeadersProps {
|
|
12
13
|
visibleColumns: GridStateColDef[];
|
|
13
14
|
sortColumnLookup: GridSortColumnLookup;
|
|
@@ -23,7 +24,7 @@ export interface UseGridColumnHeadersProps {
|
|
|
23
24
|
hasOtherElementInTabSequence: boolean;
|
|
24
25
|
}
|
|
25
26
|
export interface GetHeadersParams {
|
|
26
|
-
position?:
|
|
27
|
+
position?: PinnedColumnPosition;
|
|
27
28
|
renderContext?: GridColumnsRenderContext;
|
|
28
29
|
maxLastColumn?: number;
|
|
29
30
|
}
|
|
@@ -46,11 +47,7 @@ export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) =>
|
|
|
46
47
|
right: GridStateColDef[];
|
|
47
48
|
};
|
|
48
49
|
visibleColumns: GridStateColDef[];
|
|
49
|
-
|
|
50
|
-
pinnedPosition?: GridPinnedColumnPosition;
|
|
51
|
-
columnIndex: number;
|
|
52
|
-
computedWidth: number;
|
|
53
|
-
}) => React.CSSProperties | undefined;
|
|
50
|
+
columnPositions: number[];
|
|
54
51
|
getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderBottom?: boolean) => React.JSX.Element;
|
|
55
52
|
getColumnHeadersRow: () => React.JSX.Element;
|
|
56
53
|
getColumnsToRender: (params?: GetHeadersParams) => {
|
|
@@ -59,6 +56,7 @@ export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) =>
|
|
|
59
56
|
lastColumnToRender: number;
|
|
60
57
|
};
|
|
61
58
|
getColumnGroupHeadersRows: () => React.JSX.Element[] | null;
|
|
59
|
+
getPinnedCellOffset: (pinnedPosition: PinnedColumnPosition | undefined, computedWidth: number, columnIndex: number, columnPositions: ReturnType<typeof gridColumnPositionsSelector>, columnsTotalWidth: number, scrollbarWidth: number) => number | undefined;
|
|
62
60
|
isDragging: boolean;
|
|
63
61
|
getInnerProps: () => {
|
|
64
62
|
role: string;
|
|
@@ -2,22 +2,23 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
|
-
import { useRtl } from '@mui/system/RtlProvider';
|
|
6
5
|
import { useGridSelector } from "../../utils/index.js";
|
|
7
6
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
8
7
|
import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
|
|
9
8
|
import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
10
9
|
import { GridColumnHeaderItem } from "../../../components/columnHeaders/GridColumnHeaderItem.js";
|
|
11
10
|
import { gridDimensionsSelector } from "../dimensions/index.js";
|
|
12
|
-
import { gridRenderContextColumnsSelector
|
|
11
|
+
import { gridRenderContextColumnsSelector } from "../virtualization/index.js";
|
|
13
12
|
import { computeOffsetLeft } from "../virtualization/useGridVirtualScroller.js";
|
|
14
13
|
import { GridColumnGroupHeader } from "../../../components/columnHeaders/GridColumnGroupHeader.js";
|
|
15
|
-
import {
|
|
14
|
+
import { gridColumnPositionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnLookupSelector } from "../columns/index.js";
|
|
16
15
|
import { gridColumnGroupsUnwrappedModelSelector } from "../columnGrouping/gridColumnGroupsSelector.js";
|
|
17
16
|
import { GridScrollbarFillerCell as ScrollbarFiller } from "../../../components/GridScrollbarFillerCell.js";
|
|
18
17
|
import { getPinnedCellOffset } from "../../../internals/utils/getPinnedCellOffset.js";
|
|
19
18
|
import { GridColumnHeaderSeparatorSides } from "../../../components/columnHeaders/GridColumnHeaderSeparator.js";
|
|
20
19
|
import { gridClasses } from "../../../constants/gridClasses.js";
|
|
20
|
+
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../../../utils/cellBorderUtils.js";
|
|
21
|
+
import { PinnedColumnPosition } from "../../../internals/constants.js";
|
|
21
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
23
|
export const GridColumnHeaderRow = styled('div', {
|
|
23
24
|
name: 'MuiDataGrid',
|
|
@@ -44,10 +45,8 @@ export const useGridColumnHeaders = props => {
|
|
|
44
45
|
const [dragCol, setDragCol] = React.useState('');
|
|
45
46
|
const [resizeCol, setResizeCol] = React.useState('');
|
|
46
47
|
const apiRef = useGridPrivateApiContext();
|
|
47
|
-
const isRtl = useRtl();
|
|
48
48
|
const rootProps = useGridRootProps();
|
|
49
49
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
50
|
-
const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
51
50
|
const columnGroupsModel = useGridSelector(apiRef, gridColumnGroupsUnwrappedModelSelector);
|
|
52
51
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
53
52
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
@@ -84,18 +83,10 @@ export const useGridColumnHeaders = props => {
|
|
|
84
83
|
// Helper for computation common between getColumnHeaders and getColumnGroupHeaders
|
|
85
84
|
const getColumnsToRender = params => {
|
|
86
85
|
const {
|
|
87
|
-
renderContext: currentContext = renderContext
|
|
88
|
-
maxLastColumn = visibleColumns.length
|
|
86
|
+
renderContext: currentContext = renderContext
|
|
89
87
|
} = params || {};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
93
|
-
firstColumnToRender = 0;
|
|
94
|
-
lastColumnToRender = maxLastColumn;
|
|
95
|
-
} else {
|
|
96
|
-
firstColumnToRender = currentContext.firstColumnIndex;
|
|
97
|
-
lastColumnToRender = currentContext.lastColumnIndex;
|
|
98
|
-
}
|
|
88
|
+
const firstColumnToRender = currentContext.firstColumnIndex;
|
|
89
|
+
const lastColumnToRender = currentContext.lastColumnIndex;
|
|
99
90
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
100
91
|
return {
|
|
101
92
|
renderedColumns,
|
|
@@ -104,7 +95,7 @@ export const useGridColumnHeaders = props => {
|
|
|
104
95
|
};
|
|
105
96
|
};
|
|
106
97
|
const getFillers = (params, children, leftOverflow, borderBottom = false) => {
|
|
107
|
-
const isPinnedRight = params?.position ===
|
|
98
|
+
const isPinnedRight = params?.position === PinnedColumnPosition.RIGHT;
|
|
108
99
|
const isNotPinned = params?.position === undefined;
|
|
109
100
|
const hasScrollbarFiller = pinnedColumns.right.length > 0 && isPinnedRight || pinnedColumns.right.length === 0 && isNotPinned;
|
|
110
101
|
const leftOffsetWidth = offsetLeft - leftOverflow;
|
|
@@ -125,33 +116,6 @@ export const useGridColumnHeaders = props => {
|
|
|
125
116
|
})]
|
|
126
117
|
});
|
|
127
118
|
};
|
|
128
|
-
const getCellOffsetStyle = ({
|
|
129
|
-
pinnedPosition,
|
|
130
|
-
columnIndex,
|
|
131
|
-
computedWidth
|
|
132
|
-
}) => {
|
|
133
|
-
let style;
|
|
134
|
-
const isLeftPinned = pinnedPosition === GridPinnedColumnPosition.LEFT;
|
|
135
|
-
const isRightPinned = pinnedPosition === GridPinnedColumnPosition.RIGHT;
|
|
136
|
-
if (isLeftPinned || isRightPinned) {
|
|
137
|
-
const pinnedOffset = getPinnedCellOffset(pinnedPosition, computedWidth, columnIndex, columnPositions, dimensions);
|
|
138
|
-
let side = isLeftPinned ? 'left' : 'right';
|
|
139
|
-
if (isRtl) {
|
|
140
|
-
side = isLeftPinned ? 'right' : 'left';
|
|
141
|
-
}
|
|
142
|
-
if (pinnedPosition === 'left') {
|
|
143
|
-
style = {
|
|
144
|
-
[side]: pinnedOffset
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
if (pinnedPosition === 'right') {
|
|
148
|
-
style = {
|
|
149
|
-
[side]: pinnedOffset
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return style;
|
|
154
|
-
};
|
|
155
119
|
const getColumnHeaders = (params, other = {}) => {
|
|
156
120
|
const {
|
|
157
121
|
renderedColumns,
|
|
@@ -166,14 +130,15 @@ export const useGridColumnHeaders = props => {
|
|
|
166
130
|
const hasFocus = columnHeaderFocus !== null && columnHeaderFocus.field === colDef.field;
|
|
167
131
|
const open = columnMenuState.open && columnMenuState.field === colDef.field;
|
|
168
132
|
const pinnedPosition = params?.position;
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
computedWidth: colDef.computedWidth
|
|
173
|
-
});
|
|
174
|
-
const siblingWithBorderingSeparator = pinnedPosition === GridPinnedColumnPosition.RIGHT ? renderedColumns[i - 1] : renderedColumns[i + 1];
|
|
133
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
134
|
+
const pinnedOffset = getPinnedCellOffset(pinnedPosition, colDef.computedWidth, columnIndex, columnPositions, dimensions.columnsTotalWidth, scrollbarWidth);
|
|
135
|
+
const siblingWithBorderingSeparator = pinnedPosition === PinnedColumnPosition.RIGHT ? renderedColumns[i - 1] : renderedColumns[i + 1];
|
|
175
136
|
const isSiblingFocused = siblingWithBorderingSeparator ? columnHeaderFocus !== null && columnHeaderFocus.field === siblingWithBorderingSeparator.field : false;
|
|
176
137
|
const isLastUnpinned = columnIndex + 1 === columnPositions.length - pinnedColumns.right.length;
|
|
138
|
+
const indexInSection = i;
|
|
139
|
+
const sectionLength = renderedColumns.length;
|
|
140
|
+
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
141
|
+
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
177
142
|
columns.push(/*#__PURE__*/_jsx(GridColumnHeaderItem, _extends({}, sortColumnLookup[colDef.field], {
|
|
178
143
|
columnMenuOpen: open,
|
|
179
144
|
filterItemsCounter: filterColumnLookup[colDef.field] && filterColumnLookup[colDef.field].length,
|
|
@@ -186,12 +151,11 @@ export const useGridColumnHeaders = props => {
|
|
|
186
151
|
hasFocus: hasFocus,
|
|
187
152
|
tabIndex: tabIndex,
|
|
188
153
|
pinnedPosition: pinnedPosition,
|
|
189
|
-
|
|
190
|
-
indexInSection: i,
|
|
191
|
-
sectionLength: renderedColumns.length,
|
|
192
|
-
gridHasFiller: gridHasFiller,
|
|
154
|
+
pinnedOffset: pinnedOffset,
|
|
193
155
|
isLastUnpinned: isLastUnpinned,
|
|
194
|
-
isSiblingFocused: isSiblingFocused
|
|
156
|
+
isSiblingFocused: isSiblingFocused,
|
|
157
|
+
showLeftBorder: showLeftBorder,
|
|
158
|
+
showRightBorder: showRightBorder
|
|
195
159
|
}, other), colDef.field));
|
|
196
160
|
}
|
|
197
161
|
return getFillers(params, columns, 0);
|
|
@@ -203,18 +167,15 @@ export const useGridColumnHeaders = props => {
|
|
|
203
167
|
ownerState: rootProps,
|
|
204
168
|
className: gridClasses['row--borderBottom'],
|
|
205
169
|
children: [leftRenderContext && getColumnHeaders({
|
|
206
|
-
position:
|
|
207
|
-
renderContext: leftRenderContext
|
|
208
|
-
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
170
|
+
position: PinnedColumnPosition.LEFT,
|
|
171
|
+
renderContext: leftRenderContext
|
|
209
172
|
}, {
|
|
210
173
|
disableReorder: true
|
|
211
174
|
}), getColumnHeaders({
|
|
212
|
-
renderContext
|
|
213
|
-
maxLastColumn: visibleColumns.length - pinnedColumns.right.length
|
|
175
|
+
renderContext
|
|
214
176
|
}), rightRenderContext && getColumnHeaders({
|
|
215
|
-
position:
|
|
216
|
-
renderContext: rightRenderContext
|
|
217
|
-
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
177
|
+
position: PinnedColumnPosition.RIGHT,
|
|
178
|
+
renderContext: rightRenderContext
|
|
218
179
|
}, {
|
|
219
180
|
disableReorder: true,
|
|
220
181
|
separatorSide: GridColumnHeaderSeparatorSides.Left
|
|
@@ -273,14 +234,11 @@ export const useGridColumnHeaders = props => {
|
|
|
273
234
|
tabIndex
|
|
274
235
|
};
|
|
275
236
|
const pinnedPosition = params.position;
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
columnIndex,
|
|
279
|
-
computedWidth: headerInfo.width
|
|
280
|
-
});
|
|
237
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
238
|
+
const pinnedOffset = getPinnedCellOffset(pinnedPosition, headerInfo.width, columnIndex, columnPositions, dimensions.columnsTotalWidth, scrollbarWidth);
|
|
281
239
|
columnIndex += columnFields.length;
|
|
282
240
|
let indexInSection = index;
|
|
283
|
-
if (pinnedPosition ===
|
|
241
|
+
if (pinnedPosition === PinnedColumnPosition.LEFT) {
|
|
284
242
|
// Group headers can expand to multiple columns, we need to adjust the index
|
|
285
243
|
indexInSection = columnIndex - 1;
|
|
286
244
|
}
|
|
@@ -296,10 +254,9 @@ export const useGridColumnHeaders = props => {
|
|
|
296
254
|
hasFocus: hasFocus,
|
|
297
255
|
tabIndex: tabIndex,
|
|
298
256
|
pinnedPosition: pinnedPosition,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
gridHasFiller: gridHasFiller
|
|
257
|
+
pinnedOffset: pinnedOffset,
|
|
258
|
+
showLeftBorder: shouldCellShowLeftBorder(pinnedPosition, indexInSection),
|
|
259
|
+
showRightBorder: shouldCellShowRightBorder(pinnedPosition, indexInSection, visibleColumnGroupHeader.length, rootProps.showCellVerticalBorder, gridHasFiller)
|
|
303
260
|
}, index);
|
|
304
261
|
});
|
|
305
262
|
return getFillers(params, children, leftOverflow);
|
|
@@ -317,7 +274,7 @@ export const useGridColumnHeaders = props => {
|
|
|
317
274
|
children: [leftRenderContext && getColumnGroupHeaders({
|
|
318
275
|
depth,
|
|
319
276
|
params: {
|
|
320
|
-
position:
|
|
277
|
+
position: PinnedColumnPosition.LEFT,
|
|
321
278
|
renderContext: leftRenderContext,
|
|
322
279
|
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
323
280
|
}
|
|
@@ -329,7 +286,7 @@ export const useGridColumnHeaders = props => {
|
|
|
329
286
|
}), rightRenderContext && getColumnGroupHeaders({
|
|
330
287
|
depth,
|
|
331
288
|
params: {
|
|
332
|
-
position:
|
|
289
|
+
position: PinnedColumnPosition.RIGHT,
|
|
333
290
|
renderContext: rightRenderContext,
|
|
334
291
|
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
335
292
|
}
|
|
@@ -344,11 +301,12 @@ export const useGridColumnHeaders = props => {
|
|
|
344
301
|
rightRenderContext,
|
|
345
302
|
pinnedColumns,
|
|
346
303
|
visibleColumns,
|
|
347
|
-
|
|
304
|
+
columnPositions,
|
|
348
305
|
getFillers,
|
|
349
306
|
getColumnHeadersRow,
|
|
350
307
|
getColumnsToRender,
|
|
351
308
|
getColumnGroupHeadersRows,
|
|
309
|
+
getPinnedCellOffset,
|
|
352
310
|
isDragging: !!dragCol,
|
|
353
311
|
getInnerProps: () => ({
|
|
354
312
|
role: 'rowgroup'
|
|
@@ -6,4 +6,4 @@ export declare const columnMenuStateInitializer: GridStateInitializer;
|
|
|
6
6
|
* @requires useGridColumnResize (event)
|
|
7
7
|
* @requires useGridInfiniteLoader (event)
|
|
8
8
|
*/
|
|
9
|
-
export declare const useGridColumnMenu: (apiRef: React.
|
|
9
|
+
export declare const useGridColumnMenu: (apiRef: React.RefObject<GridPrivateApiCommunity>) => void;
|
|
@@ -7,4 +7,4 @@ export declare const columnResizeStateInitializer: GridStateInitializer;
|
|
|
7
7
|
* @requires useGridColumns (method, event)
|
|
8
8
|
* TODO: improve experience for last column
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridColumnResize: (apiRef: React.
|
|
10
|
+
export declare const useGridColumnResize: (apiRef: React.RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "autosizeOptions" | "autosizeOnMount" | "disableAutosize" | "onColumnResize" | "onColumnWidthChange" | "disableVirtualization">) => void;
|
|
@@ -70,7 +70,7 @@ function preventClick(event) {
|
|
|
70
70
|
* is disabled.
|
|
71
71
|
*/
|
|
72
72
|
function useColumnVirtualizationDisabled(apiRef) {
|
|
73
|
-
const promise = React.useRef();
|
|
73
|
+
const promise = React.useRef(undefined);
|
|
74
74
|
const selector = () => gridVirtualizationColumnEnabledSelector(apiRef);
|
|
75
75
|
const value = useGridSelector(apiRef, selector);
|
|
76
76
|
React.useEffect(() => {
|
|
@@ -184,17 +184,19 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
184
184
|
// To improve accessibility, the separator has padding on both sides.
|
|
185
185
|
// Clicking inside the padding area should be treated as a click in the separator.
|
|
186
186
|
// This ref stores the offset between the click and the separator.
|
|
187
|
-
const initialOffsetToSeparator = React.useRef();
|
|
188
|
-
const resizeDirection = React.useRef();
|
|
187
|
+
const initialOffsetToSeparator = React.useRef(null);
|
|
188
|
+
const resizeDirection = React.useRef(null);
|
|
189
189
|
const stopResizeEventTimeout = useTimeout();
|
|
190
|
-
const touchId = React.useRef();
|
|
190
|
+
const touchId = React.useRef(undefined);
|
|
191
191
|
const updateWidth = newWidth => {
|
|
192
192
|
logger.debug(`Updating width to ${newWidth} for col ${refs.colDef.field}`);
|
|
193
193
|
const prevWidth = refs.columnHeaderElement.offsetWidth;
|
|
194
194
|
const widthDiff = newWidth - prevWidth;
|
|
195
195
|
const columnWidthDiff = newWidth - refs.initialColWidth;
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
if (columnWidthDiff > 0) {
|
|
197
|
+
const newTotalWidth = refs.initialTotalWidth + columnWidthDiff;
|
|
198
|
+
apiRef.current.rootElementRef?.current?.style.setProperty('--DataGrid-rowWidth', `${newTotalWidth}px`);
|
|
199
|
+
}
|
|
198
200
|
refs.colDef.computedWidth = newWidth;
|
|
199
201
|
refs.colDef.width = newWidth;
|
|
200
202
|
refs.colDef.flex = 0;
|
|
@@ -44,13 +44,13 @@ export declare const createColumnsState: ({ apiRef, columnsToUpsert, initialStat
|
|
|
44
44
|
initialState: GridColumnsInitialState | undefined;
|
|
45
45
|
columnVisibilityModel?: GridColumnVisibilityModel;
|
|
46
46
|
keepOnlyColumnsToUpsert: boolean;
|
|
47
|
-
apiRef: React.
|
|
47
|
+
apiRef: React.RefObject<GridApiCommunity>;
|
|
48
48
|
}) => GridColumnsState;
|
|
49
49
|
export declare function getFirstNonSpannedColumnToRender({ firstColumnToRender, apiRef, firstRowToRender, lastRowToRender, visibleRows, }: {
|
|
50
50
|
firstColumnToRender: number;
|
|
51
|
-
apiRef: React.
|
|
51
|
+
apiRef: React.RefObject<GridApiCommon>;
|
|
52
52
|
firstRowToRender: number;
|
|
53
53
|
lastRowToRender: number;
|
|
54
54
|
visibleRows: GridRowEntry[];
|
|
55
55
|
}): number;
|
|
56
|
-
export declare function getTotalHeaderHeight(apiRef: React.
|
|
56
|
+
export declare function getTotalHeaderHeight(apiRef: React.RefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columnHeaderHeight' | 'headerFilterHeight' | 'unstable_listView' | 'columnGroupHeaderHeight'>): number;
|
|
@@ -4,4 +4,4 @@ import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
|
4
4
|
* @requires useGridColumns (method, event)
|
|
5
5
|
* @requires useGridParamsApi (method)
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridColumnSpanning: (apiRef: React.
|
|
7
|
+
export declare const useGridColumnSpanning: (apiRef: React.RefObject<GridPrivateApiCommunity>) => void;
|
|
@@ -8,4 +8,4 @@ export declare const columnsStateInitializer: GridStateInitializer<Pick<DataGrid
|
|
|
8
8
|
* @requires useGridDimensions (method, event) - can be after
|
|
9
9
|
* TODO: Impossible priority - useGridParamsApi also needs to be after useGridColumns
|
|
10
10
|
*/
|
|
11
|
-
export declare function useGridColumns(apiRef: React.
|
|
11
|
+
export declare function useGridColumns(apiRef: React.RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState' | 'columns' | 'columnVisibilityModel' | 'onColumnVisibilityModelChange' | 'slots' | 'slotProps' | 'disableColumnSelector' | 'signature'>): void;
|