@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
|
@@ -13,7 +13,6 @@ import { useRunOnce } from "../../utils/useRunOnce.js";
|
|
|
13
13
|
import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from "../columns/gridColumnsSelector.js";
|
|
14
14
|
import { gridDimensionsSelector } from "../dimensions/gridDimensionsSelectors.js";
|
|
15
15
|
import { gridPinnedRowsSelector } from "../rows/gridRowsSelector.js";
|
|
16
|
-
import { gridFocusCellSelector, gridTabIndexCellSelector } from "../focus/gridFocusStateSelector.js";
|
|
17
16
|
import { useGridVisibleRows, getVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
18
17
|
import { useGridApiEventHandler } from "../../utils/index.js";
|
|
19
18
|
import * as platform from "../../../utils/platform.js";
|
|
@@ -26,6 +25,7 @@ import { EMPTY_RENDER_CONTEXT } from "./useGridVirtualization.js";
|
|
|
26
25
|
import { gridRowSpanningHiddenCellsOriginMapSelector } from "../rows/gridRowSpanningSelectors.js";
|
|
27
26
|
import { gridListColumnSelector } from "../listView/gridListViewSelectors.js";
|
|
28
27
|
import { minimalContentHeight } from "../rows/gridRowsUtils.js";
|
|
28
|
+
import { gridFocusedVirtualCellSelector } from "./gridFocusedVirtualCellSelector.js";
|
|
29
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
30
|
const MINIMUM_COLUMN_WIDTH = 50;
|
|
31
31
|
var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
|
|
@@ -73,12 +73,9 @@ export const useGridVirtualScroller = () => {
|
|
|
73
73
|
const hasBottomPinnedRows = pinnedRows.bottom.length > 0;
|
|
74
74
|
const [panels, setPanels] = React.useState(EMPTY_DETAIL_PANELS);
|
|
75
75
|
const isRtl = useRtl();
|
|
76
|
-
const cellFocus = useGridSelector(apiRef, gridFocusCellSelector);
|
|
77
|
-
const cellTabIndex = useGridSelector(apiRef, gridTabIndexCellSelector);
|
|
78
76
|
const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
|
|
79
77
|
const selectedRowsLookup = useGridSelector(apiRef, selectedIdsLookupSelector);
|
|
80
78
|
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
81
|
-
const gridRootRef = apiRef.current.rootElementRef;
|
|
82
79
|
const mainRef = apiRef.current.mainElementRef;
|
|
83
80
|
const scrollerRef = apiRef.current.virtualScrollerRef;
|
|
84
81
|
const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
|
|
@@ -86,6 +83,8 @@ export const useGridVirtualScroller = () => {
|
|
|
86
83
|
const contentHeight = dimensions.contentSize.height;
|
|
87
84
|
const columnsTotalWidth = dimensions.columnsTotalWidth;
|
|
88
85
|
const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
|
|
86
|
+
const isRenderContextReady = React.useRef(false);
|
|
87
|
+
const previousSize = React.useRef(null);
|
|
89
88
|
const mainRefCallback = React.useCallback(node => {
|
|
90
89
|
mainRef.current = node;
|
|
91
90
|
if (!node) {
|
|
@@ -93,7 +92,10 @@ export const useGridVirtualScroller = () => {
|
|
|
93
92
|
}
|
|
94
93
|
const initialRect = node.getBoundingClientRect();
|
|
95
94
|
let lastSize = roundDimensions(initialRect);
|
|
96
|
-
|
|
95
|
+
if (!previousSize.current || lastSize.width !== previousSize.current.width && lastSize.height !== previousSize.current.height) {
|
|
96
|
+
previousSize.current = lastSize;
|
|
97
|
+
apiRef.current.publishEvent('resize', lastSize);
|
|
98
|
+
}
|
|
97
99
|
if (typeof ResizeObserver === 'undefined') {
|
|
98
100
|
return undefined;
|
|
99
101
|
}
|
|
@@ -134,17 +136,15 @@ export const useGridVirtualScroller = () => {
|
|
|
134
136
|
* work that's not necessary. Thus we store the context at the start of the scroll in `frozenContext`, and the rows
|
|
135
137
|
* that are part of this old context will keep their same render context as to avoid re-rendering.
|
|
136
138
|
*/
|
|
137
|
-
const scrollPosition = React.useRef(EMPTY_SCROLL_POSITION);
|
|
139
|
+
const scrollPosition = React.useRef(rootProps.initialState?.scroll ?? EMPTY_SCROLL_POSITION);
|
|
140
|
+
const ignoreNextScrollEvent = React.useRef(false);
|
|
138
141
|
const previousContextScrollPosition = React.useRef(EMPTY_SCROLL_POSITION);
|
|
139
142
|
const previousRowContext = React.useRef(EMPTY_RENDER_CONTEXT);
|
|
140
143
|
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
144
|
+
const focusedVirtualCell = useGridSelector(apiRef, gridFocusedVirtualCellSelector);
|
|
141
145
|
const scrollTimeout = useTimeout();
|
|
142
146
|
const frozenContext = React.useRef(undefined);
|
|
143
147
|
const scrollCache = useLazyRef(() => createScrollCache(isRtl, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
|
|
144
|
-
const focusedCell = {
|
|
145
|
-
rowIndex: React.useMemo(() => cellFocus ? currentPage.rows.findIndex(row => row.id === cellFocus.id) : -1, [cellFocus, currentPage.rows]),
|
|
146
|
-
columnIndex: React.useMemo(() => cellFocus ? visibleColumns.findIndex(column => column.field === cellFocus.field) : -1, [cellFocus, visibleColumns])
|
|
147
|
-
};
|
|
148
148
|
const updateRenderContext = React.useCallback(nextRenderContext => {
|
|
149
149
|
if (areRenderContextsEqual(nextRenderContext, apiRef.current.state.virtualization.renderContext)) {
|
|
150
150
|
return;
|
|
@@ -228,6 +228,10 @@ export const useGridVirtualScroller = () => {
|
|
|
228
228
|
updateRenderContext(nextRenderContext);
|
|
229
229
|
};
|
|
230
230
|
const handleScroll = useEventCallback(event => {
|
|
231
|
+
if (ignoreNextScrollEvent.current) {
|
|
232
|
+
ignoreNextScrollEvent.current = false;
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
231
235
|
const {
|
|
232
236
|
scrollTop,
|
|
233
237
|
scrollLeft
|
|
@@ -286,14 +290,14 @@ export const useGridVirtualScroller = () => {
|
|
|
286
290
|
const lastRowToRender = Math.min(baseRenderContext.lastRowIndex, rowModels.length);
|
|
287
291
|
const rowIndexes = params.rows ? range(0, params.rows.length) : range(firstRowToRender, lastRowToRender);
|
|
288
292
|
let virtualRowIndex = -1;
|
|
289
|
-
if (!isPinnedSection &&
|
|
290
|
-
if (
|
|
291
|
-
|
|
292
|
-
|
|
293
|
+
if (!isPinnedSection && focusedVirtualCell) {
|
|
294
|
+
if (focusedVirtualCell.rowIndex < firstRowToRender) {
|
|
295
|
+
rowIndexes.unshift(focusedVirtualCell.rowIndex);
|
|
296
|
+
virtualRowIndex = focusedVirtualCell.rowIndex;
|
|
293
297
|
}
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
298
|
+
if (focusedVirtualCell.rowIndex > lastRowToRender) {
|
|
299
|
+
rowIndexes.push(focusedVirtualCell.rowIndex);
|
|
300
|
+
virtualRowIndex = focusedVirtualCell.rowIndex;
|
|
297
301
|
}
|
|
298
302
|
}
|
|
299
303
|
const rows = [];
|
|
@@ -333,7 +337,6 @@ export const useGridVirtualScroller = () => {
|
|
|
333
337
|
});
|
|
334
338
|
}
|
|
335
339
|
}
|
|
336
|
-
const hasFocus = cellFocus?.id === id;
|
|
337
340
|
const baseRowHeight = !apiRef.current.rowHasAutoHeight(id) ? apiRef.current.unstable_getRowHeight(id) : 'auto';
|
|
338
341
|
let isSelected;
|
|
339
342
|
if (selectedRowsLookup[id] == null) {
|
|
@@ -358,19 +361,16 @@ export const useGridVirtualScroller = () => {
|
|
|
358
361
|
isLastVisible = isLastVisibleInSection;
|
|
359
362
|
}
|
|
360
363
|
}
|
|
361
|
-
const isVirtualRow = rowIndexInPage === virtualRowIndex;
|
|
362
|
-
const isNotVisible = isVirtualRow;
|
|
363
|
-
let tabbableCell = null;
|
|
364
|
-
if (cellTabIndex !== null && cellTabIndex.id === id) {
|
|
365
|
-
const cellParams = apiRef.current.getCellParams(id, cellTabIndex.field);
|
|
366
|
-
tabbableCell = cellParams.cellMode === 'view' ? cellTabIndex.field : null;
|
|
367
|
-
}
|
|
368
364
|
let currentRenderContext = baseRenderContext;
|
|
369
365
|
if (!isPinnedSection && frozenContext.current && rowIndexInPage >= frozenContext.current.firstRowIndex && rowIndexInPage < frozenContext.current.lastRowIndex) {
|
|
370
366
|
currentRenderContext = frozenContext.current;
|
|
371
367
|
}
|
|
368
|
+
const isVirtualFocusRow = rowIndexInPage === virtualRowIndex;
|
|
369
|
+
const isVirtualFocusColumn = focusedVirtualCell?.rowIndex === rowIndex;
|
|
372
370
|
const offsetLeft = computeOffsetLeft(columnPositions, currentRenderContext, pinnedColumns.left.length);
|
|
373
371
|
const showBottomBorder = isLastVisibleInSection && params.position === 'top';
|
|
372
|
+
const firstColumnIndex = currentRenderContext.firstColumnIndex;
|
|
373
|
+
const lastColumnIndex = currentRenderContext.lastColumnIndex;
|
|
374
374
|
rows.push(/*#__PURE__*/_jsx(rootProps.slots.row, _extends({
|
|
375
375
|
row: model,
|
|
376
376
|
rowId: id,
|
|
@@ -378,19 +378,21 @@ export const useGridVirtualScroller = () => {
|
|
|
378
378
|
selected: isSelected,
|
|
379
379
|
offsetTop: params.rows ? undefined : rowsMeta.positions[rowIndexInPage],
|
|
380
380
|
offsetLeft: offsetLeft,
|
|
381
|
-
|
|
381
|
+
columnsTotalWidth: dimensions.columnsTotalWidth,
|
|
382
382
|
rowHeight: baseRowHeight,
|
|
383
|
-
tabbableCell: tabbableCell,
|
|
384
383
|
pinnedColumns: pinnedColumns,
|
|
385
384
|
visibleColumns: visibleColumns,
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
firstColumnIndex: firstColumnIndex,
|
|
386
|
+
lastColumnIndex: lastColumnIndex,
|
|
387
|
+
focusedColumnIndex: isVirtualFocusColumn ? focusedVirtualCell.columnIndex : undefined,
|
|
388
388
|
isFirstVisible: isFirstVisible,
|
|
389
389
|
isLastVisible: isLastVisible,
|
|
390
|
-
isNotVisible:
|
|
391
|
-
showBottomBorder: showBottomBorder
|
|
390
|
+
isNotVisible: isVirtualFocusRow,
|
|
391
|
+
showBottomBorder: showBottomBorder,
|
|
392
|
+
scrollbarWidth: dimensions.hasScrollY ? dimensions.scrollbarSize : 0,
|
|
393
|
+
gridHasFiller: dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width
|
|
392
394
|
}, rowProps), id));
|
|
393
|
-
if (
|
|
395
|
+
if (isVirtualFocusRow) {
|
|
394
396
|
return;
|
|
395
397
|
}
|
|
396
398
|
const panel = panels.get(id);
|
|
@@ -421,18 +423,21 @@ export const useGridVirtualScroller = () => {
|
|
|
421
423
|
}
|
|
422
424
|
return size;
|
|
423
425
|
}, [columnsTotalWidth, contentHeight, needsHorizontalScrollbar]);
|
|
424
|
-
React.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
useEnhancedEffect(() => {
|
|
428
|
-
// TODO a scroll reset should not be necessary
|
|
429
|
-
if (enabledForColumns) {
|
|
430
|
-
scrollerRef.current.scrollLeft = 0;
|
|
426
|
+
const onContentSizeApplied = React.useCallback(node => {
|
|
427
|
+
if (!node) {
|
|
428
|
+
return;
|
|
431
429
|
}
|
|
432
|
-
|
|
433
|
-
|
|
430
|
+
apiRef.current.publishEvent('virtualScrollerContentSizeChange', {
|
|
431
|
+
columnsTotalWidth,
|
|
432
|
+
contentHeight
|
|
433
|
+
});
|
|
434
|
+
}, [apiRef, columnsTotalWidth, contentHeight]);
|
|
435
|
+
useEnhancedEffect(() => {
|
|
436
|
+
if (!isRenderContextReady.current) {
|
|
437
|
+
return;
|
|
434
438
|
}
|
|
435
|
-
|
|
439
|
+
apiRef.current.updateRenderContext?.();
|
|
440
|
+
}, [apiRef, enabledForColumns, enabledForRows]);
|
|
436
441
|
useEnhancedEffect(() => {
|
|
437
442
|
if (listView) {
|
|
438
443
|
scrollerRef.current.scrollLeft = 0;
|
|
@@ -447,6 +452,53 @@ export const useGridVirtualScroller = () => {
|
|
|
447
452
|
left: scrollPosition.current.left,
|
|
448
453
|
renderContext: initialRenderContext
|
|
449
454
|
});
|
|
455
|
+
isRenderContextReady.current = true;
|
|
456
|
+
if (rootProps.initialState?.scroll && scrollerRef.current) {
|
|
457
|
+
const scroller = scrollerRef.current;
|
|
458
|
+
const {
|
|
459
|
+
top,
|
|
460
|
+
left
|
|
461
|
+
} = rootProps.initialState.scroll;
|
|
462
|
+
|
|
463
|
+
// On initial mount, if we have columns available, we can restore the horizontal scroll immediately, but we need to skip the resulting scroll event, otherwise we would recalculate the render context at position top=0, left=restoredValue, but the initial render context is already calculated based on the initial value of scrollPosition ref.
|
|
464
|
+
const isScrollRestored = {
|
|
465
|
+
top: !(top > 0),
|
|
466
|
+
left: !(left > 0)
|
|
467
|
+
};
|
|
468
|
+
if (!isScrollRestored.left && columnsTotalWidth) {
|
|
469
|
+
scroller.scrollLeft = left;
|
|
470
|
+
ignoreNextScrollEvent.current = true;
|
|
471
|
+
isScrollRestored.left = true;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// For the sake of completeness, but I'm not sure if contentHeight is ever available at this point. Maybe when virtualisation is disabled?
|
|
475
|
+
if (!isScrollRestored.top && contentHeight) {
|
|
476
|
+
scroller.scrollTop = top;
|
|
477
|
+
ignoreNextScrollEvent.current = true;
|
|
478
|
+
isScrollRestored.top = true;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// To restore the vertical scroll, we need to wait until the rows are available in the DOM (otherwise there's nowhere to scroll), but before paint to avoid reflows
|
|
482
|
+
if (!isScrollRestored.top || !isScrollRestored.left) {
|
|
483
|
+
const unsubscribeContentSizeChange = apiRef.current.subscribeEvent('virtualScrollerContentSizeChange', params => {
|
|
484
|
+
if (!isScrollRestored.left && params.columnsTotalWidth) {
|
|
485
|
+
scroller.scrollLeft = left;
|
|
486
|
+
ignoreNextScrollEvent.current = true;
|
|
487
|
+
isScrollRestored.left = true;
|
|
488
|
+
}
|
|
489
|
+
if (!isScrollRestored.top && params.contentHeight) {
|
|
490
|
+
scroller.scrollTop = top;
|
|
491
|
+
ignoreNextScrollEvent.current = true;
|
|
492
|
+
isScrollRestored.top = true;
|
|
493
|
+
}
|
|
494
|
+
if (isScrollRestored.left && isScrollRestored.top) {
|
|
495
|
+
unsubscribeContentSizeChange();
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
return unsubscribeContentSizeChange;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return undefined;
|
|
450
502
|
});
|
|
451
503
|
apiRef.current.register('private', {
|
|
452
504
|
updateRenderContext: forceUpdateRenderContext
|
|
@@ -474,7 +526,8 @@ export const useGridVirtualScroller = () => {
|
|
|
474
526
|
}),
|
|
475
527
|
getContentProps: () => ({
|
|
476
528
|
style: contentSize,
|
|
477
|
-
role: 'presentation'
|
|
529
|
+
role: 'presentation',
|
|
530
|
+
ref: onContentSizeApplied
|
|
478
531
|
}),
|
|
479
532
|
getRenderZoneProps: () => ({
|
|
480
533
|
role: 'rowgroup'
|
|
@@ -24,7 +24,7 @@ export function createUseGridApiEventHandler(registryContainer) {
|
|
|
24
24
|
}
|
|
25
25
|
const [objectRetainedByReact] = React.useState(new ObjectToBeRetainedByReact());
|
|
26
26
|
const subscription = React.useRef(null);
|
|
27
|
-
const handlerRef = React.useRef();
|
|
27
|
+
const handlerRef = React.useRef(null);
|
|
28
28
|
handlerRef.current = handler;
|
|
29
29
|
const cleanupTokenRef = React.useRef(null);
|
|
30
30
|
if (!subscription.current && handlerRef.current) {
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { gridExpandedSortedRowEntriesSelector } from "../features/filter/gridFilterSelector.js";
|
|
1
|
+
import { gridVisibleRowsSelector } from "../features/pagination/gridPaginationSelector.js";
|
|
2
|
+
import { useGridSelector } from "./index.js";
|
|
4
3
|
export const getVisibleRows = (apiRef, props) => {
|
|
5
|
-
|
|
6
|
-
let range;
|
|
7
|
-
if (props.pagination && props.paginationMode === 'client') {
|
|
8
|
-
range = gridPaginationRowRangeSelector(apiRef);
|
|
9
|
-
rows = gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef);
|
|
10
|
-
} else {
|
|
11
|
-
rows = gridExpandedSortedRowEntriesSelector(apiRef);
|
|
12
|
-
if (rows.length === 0) {
|
|
13
|
-
range = null;
|
|
14
|
-
} else {
|
|
15
|
-
range = {
|
|
16
|
-
firstRowIndex: 0,
|
|
17
|
-
lastRowIndex: rows.length - 1
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
rows,
|
|
23
|
-
range
|
|
24
|
-
};
|
|
4
|
+
return gridVisibleRowsSelector(apiRef);
|
|
25
5
|
};
|
|
26
6
|
|
|
27
7
|
/**
|
|
@@ -31,10 +11,7 @@ export const getVisibleRows = (apiRef, props) => {
|
|
|
31
11
|
* - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
|
|
32
12
|
* - If the row tree is flat, it only contains up to `state.pageSize` rows.
|
|
33
13
|
*/
|
|
14
|
+
|
|
34
15
|
export const useGridVisibleRows = (apiRef, props) => {
|
|
35
|
-
|
|
36
|
-
return React.useMemo(() => ({
|
|
37
|
-
rows: response.rows,
|
|
38
|
-
range: response.range
|
|
39
|
-
}), [response.rows, response.range]);
|
|
16
|
+
return useGridSelector(apiRef, gridVisibleRowsSelector);
|
|
40
17
|
};
|
package/modern/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export const GRID_TREE_DATA_GROUPING_FIELD = '__tree_data_group__';
|
|
2
2
|
export const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
|
|
3
|
-
export const GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
3
|
+
export const GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
4
|
+
export let PinnedColumnPosition = /*#__PURE__*/function (PinnedColumnPosition) {
|
|
5
|
+
PinnedColumnPosition[PinnedColumnPosition["NONE"] = 0] = "NONE";
|
|
6
|
+
PinnedColumnPosition[PinnedColumnPosition["LEFT"] = 1] = "LEFT";
|
|
7
|
+
PinnedColumnPosition[PinnedColumnPosition["RIGHT"] = 2] = "RIGHT";
|
|
8
|
+
PinnedColumnPosition[PinnedColumnPosition["VIRTUAL"] = 3] = "VIRTUAL";
|
|
9
|
+
return PinnedColumnPosition;
|
|
10
|
+
}({});
|
|
@@ -61,6 +61,7 @@ export { useGridVisibleRows, getVisibleRows } from "../hooks/utils/useGridVisibl
|
|
|
61
61
|
export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
|
62
62
|
export { getColumnsToExport, defaultGetRowsToExport } from "../hooks/features/export/utils.js";
|
|
63
63
|
export * from "../utils/createControllablePromise.js";
|
|
64
|
+
export * from "../utils/rtlFlipSide.js";
|
|
64
65
|
export { createSelector, createSelectorV8, createSelectorMemoized, createSelectorMemoizedV8 } from "../utils/createSelector.js";
|
|
65
66
|
export { useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
|
|
66
67
|
export { gridRowGroupsToFetchSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { rtlFlipSide } from "../../utils/rtlFlipSide.js";
|
|
2
|
+
export function attachPinnedStyle(style, isRtl, pinnedPosition, pinnedOffset) {
|
|
3
|
+
const side = rtlFlipSide(pinnedPosition, isRtl);
|
|
4
|
+
if (!side || pinnedOffset === undefined) {
|
|
5
|
+
return style;
|
|
6
|
+
}
|
|
7
|
+
style[side] = pinnedOffset;
|
|
8
|
+
return style;
|
|
9
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const getPinnedCellOffset = (pinnedPosition, computedWidth, columnIndex, columnPositions,
|
|
3
|
-
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
1
|
+
import { PinnedColumnPosition } from "../constants.js";
|
|
2
|
+
export const getPinnedCellOffset = (pinnedPosition, computedWidth, columnIndex, columnPositions, columnsTotalWidth, scrollbarWidth) => {
|
|
4
3
|
let pinnedOffset;
|
|
5
4
|
switch (pinnedPosition) {
|
|
6
|
-
case
|
|
5
|
+
case PinnedColumnPosition.LEFT:
|
|
7
6
|
pinnedOffset = columnPositions[columnIndex];
|
|
8
7
|
break;
|
|
9
|
-
case
|
|
10
|
-
pinnedOffset =
|
|
8
|
+
case PinnedColumnPosition.RIGHT:
|
|
9
|
+
pinnedOffset = columnsTotalWidth - columnPositions[columnIndex] - computedWidth + scrollbarWidth;
|
|
11
10
|
break;
|
|
12
11
|
default:
|
|
13
|
-
pinnedOffset =
|
|
12
|
+
pinnedOffset = undefined;
|
|
14
13
|
break;
|
|
15
14
|
}
|
|
16
15
|
return pinnedOffset;
|
package/modern/locales/urPK.js
CHANGED
|
@@ -30,12 +30,11 @@ const urPKGrid = {
|
|
|
30
30
|
toolbarExportPrint: 'پرنٹ کریں',
|
|
31
31
|
toolbarExportExcel: 'ایکسل کے طور پر ڈاوٴنلوڈ کریں',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
columnsManagementSearchTitle: 'تلاش',
|
|
34
|
+
columnsManagementNoColumns: 'کوئی کالم نہیں',
|
|
35
|
+
columnsManagementShowHideAllText: 'تمام دکھائیں/چھپائیں',
|
|
36
|
+
columnsManagementReset: 'ریسیٹ',
|
|
37
|
+
columnsManagementDeleteIconLabel: 'کلئیر',
|
|
39
38
|
// Filter panel text
|
|
40
39
|
filterPanelAddFilter: 'نیا فلٹر',
|
|
41
40
|
filterPanelRemoveAll: 'سارے ختم کریں',
|
|
@@ -49,9 +48,9 @@ const urPKGrid = {
|
|
|
49
48
|
filterPanelInputPlaceholder: 'ویلیو کو فلٹر کریں',
|
|
50
49
|
// Filter operators text
|
|
51
50
|
filterOperatorContains: 'شامل ہے',
|
|
52
|
-
|
|
51
|
+
filterOperatorDoesNotContain: 'موجود نہیں ہے',
|
|
53
52
|
filterOperatorEquals: 'برابر ہے',
|
|
54
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: 'برابر نہیں ہے',
|
|
55
54
|
filterOperatorStartsWith: 'شروع ہوتا ہے',
|
|
56
55
|
filterOperatorEndsWith: 'ختم ہوتا ہے',
|
|
57
56
|
filterOperatorIs: 'ہے',
|
|
@@ -71,9 +70,9 @@ const urPKGrid = {
|
|
|
71
70
|
'filterOperator<=': '<=',
|
|
72
71
|
// Header filter operators text
|
|
73
72
|
headerFilterOperatorContains: 'شامل ہے',
|
|
74
|
-
|
|
73
|
+
headerFilterOperatorDoesNotContain: 'موجود نہیں ہے',
|
|
75
74
|
headerFilterOperatorEquals: 'برابر ہے',
|
|
76
|
-
|
|
75
|
+
headerFilterOperatorDoesNotEqual: 'برابر نہیں ہے',
|
|
77
76
|
headerFilterOperatorStartsWith: 'شروع ہوتا ہے',
|
|
78
77
|
headerFilterOperatorEndsWith: 'ختم ہوتا ہے',
|
|
79
78
|
headerFilterOperatorIs: 'ہے',
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PinnedColumnPosition } from "../internals/constants.js";
|
|
2
2
|
export const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectionLength, showCellVerticalBorderRootProp, gridHasFiller) => {
|
|
3
3
|
const isSectionLastCell = indexInSection === sectionLength - 1;
|
|
4
|
-
if (pinnedPosition ===
|
|
4
|
+
if (pinnedPosition === PinnedColumnPosition.LEFT && isSectionLastCell) {
|
|
5
5
|
return true;
|
|
6
6
|
}
|
|
7
7
|
if (showCellVerticalBorderRootProp) {
|
|
8
|
-
if (pinnedPosition ===
|
|
8
|
+
if (pinnedPosition === PinnedColumnPosition.LEFT) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
|
11
|
-
if (pinnedPosition ===
|
|
11
|
+
if (pinnedPosition === PinnedColumnPosition.RIGHT) {
|
|
12
12
|
return !isSectionLastCell;
|
|
13
13
|
}
|
|
14
14
|
// pinnedPosition === undefined, middle section
|
|
@@ -17,5 +17,5 @@ export const shouldCellShowRightBorder = (pinnedPosition, indexInSection, sectio
|
|
|
17
17
|
return false;
|
|
18
18
|
};
|
|
19
19
|
export const shouldCellShowLeftBorder = (pinnedPosition, indexInSection) => {
|
|
20
|
-
return pinnedPosition ===
|
|
20
|
+
return pinnedPosition === PinnedColumnPosition.RIGHT && indexInSection === 0;
|
|
21
21
|
};
|
package/modern/utils/domUtils.js
CHANGED
|
@@ -153,7 +153,7 @@ const findPinnedHeaders = ({
|
|
|
153
153
|
const elements = [];
|
|
154
154
|
api.columnHeadersContainerRef.current.querySelectorAll(`.${gridClasses[position === 'left' ? 'columnHeader--pinnedLeft' : 'columnHeader--pinnedRight']}`).forEach(element => {
|
|
155
155
|
const currentColIndex = parseCellColIndex(element);
|
|
156
|
-
if (currentColIndex !== null && filterFn(currentColIndex)) {
|
|
156
|
+
if (currentColIndex !== null && filterFn(currentColIndex, element)) {
|
|
157
157
|
elements.push(element);
|
|
158
158
|
}
|
|
159
159
|
});
|
|
@@ -174,7 +174,12 @@ export function findRightPinnedHeadersBeforeCol(api, col, isRtl) {
|
|
|
174
174
|
api,
|
|
175
175
|
position: isRtl ? 'left' : 'right',
|
|
176
176
|
colIndex,
|
|
177
|
-
filterFn: index =>
|
|
177
|
+
filterFn: (index, element) => {
|
|
178
|
+
if (element.classList.contains(gridClasses['columnHeader--last'])) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
return isRtl ? index > colIndex : index < colIndex;
|
|
182
|
+
}
|
|
178
183
|
});
|
|
179
184
|
}
|
|
180
185
|
export function findGridHeader(api, field) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PinnedColumnPosition } from "../internals/constants.js";
|
|
2
|
+
export const rtlFlipSide = (position, isRtl) => {
|
|
3
|
+
if (!position) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
if (!isRtl) {
|
|
7
|
+
if (position === PinnedColumnPosition.LEFT) {
|
|
8
|
+
return 'left';
|
|
9
|
+
}
|
|
10
|
+
if (position === PinnedColumnPosition.RIGHT) {
|
|
11
|
+
return 'right';
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
if (position === PinnedColumnPosition.LEFT) {
|
|
15
|
+
return 'right';
|
|
16
|
+
}
|
|
17
|
+
if (position === PinnedColumnPosition.RIGHT) {
|
|
18
|
+
return 'left';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
@@ -41,13 +41,12 @@ const DataGridRaw = (0, _forwardRef.forwardRef)(function DataGrid(inProps, ref)
|
|
|
41
41
|
privateApiRef: privateApiRef,
|
|
42
42
|
configuration: configuration,
|
|
43
43
|
props: props,
|
|
44
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridRoot, (0, _extends2.default)({
|
|
45
45
|
className: props.className,
|
|
46
46
|
style: props.style,
|
|
47
47
|
sx: props.sx
|
|
48
48
|
}, props.forwardedProps, props.slotProps?.root, {
|
|
49
|
-
ref: ref
|
|
50
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridHeader, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridBody, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridFooterPlaceholder, {})]
|
|
49
|
+
ref: ref
|
|
51
50
|
}))
|
|
52
51
|
});
|
|
53
52
|
});
|
|
@@ -50,6 +50,7 @@ const useDataGridComponent = (inputApiRef, props) => {
|
|
|
50
50
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridDimensions.dimensionsStateInitializer, apiRef, props);
|
|
51
51
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowSelection.rowSelectionStateInitializer, apiRef, props);
|
|
52
52
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumns.columnsStateInitializer, apiRef, props);
|
|
53
|
+
(0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
|
|
53
54
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRows.rowsStateInitializer, apiRef, props);
|
|
54
55
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridEditing.editingStateInitializer, apiRef, props);
|
|
55
56
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridFocus.focusStateInitializer, apiRef, props);
|
|
@@ -59,7 +60,6 @@ const useDataGridComponent = (inputApiRef, props) => {
|
|
|
59
60
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowSpanning.rowSpanningStateInitializer, apiRef, props);
|
|
60
61
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridDensity.densityStateInitializer, apiRef, props);
|
|
61
62
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnResize.columnResizeStateInitializer, apiRef, props);
|
|
62
|
-
(0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
|
|
63
63
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowsMeta.rowsMetaStateInitializer, apiRef, props);
|
|
64
64
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnMenu.columnMenuStateInitializer, apiRef, props);
|
|
65
65
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnGrouping.columnGroupsStateInitializer, apiRef, props);
|
|
@@ -26,7 +26,7 @@ function GridHeaders() {
|
|
|
26
26
|
const filterColumnLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridFilterActiveItemsLookupSelector);
|
|
27
27
|
const sortColumnLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridSortingSelector.gridSortColumnLookupSelector);
|
|
28
28
|
const columnHeaderTabIndexState = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridTabIndexColumnHeaderSelector);
|
|
29
|
-
const
|
|
29
|
+
const hasNoCellTabIndexState = (0, _useGridSelector.useGridSelector)(apiRef, () => (0, _gridFocusStateSelector.gridTabIndexCellSelector)(apiRef) === null);
|
|
30
30
|
const columnGroupHeaderTabIndexState = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridTabIndexColumnGroupHeaderSelector);
|
|
31
31
|
const columnHeaderFocus = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridFocusColumnHeaderSelector);
|
|
32
32
|
const columnGroupHeaderFocus = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusStateSelector.gridFocusColumnGroupHeaderSelector);
|
|
@@ -34,7 +34,7 @@ function GridHeaders() {
|
|
|
34
34
|
const columnMenuState = (0, _useGridSelector.useGridSelector)(apiRef, _columnMenuSelector.gridColumnMenuSelector);
|
|
35
35
|
const columnVisibility = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridColumnVisibilityModelSelector);
|
|
36
36
|
const columnGroupsHeaderStructure = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnGroupsSelector.gridColumnGroupsHeaderStructureSelector);
|
|
37
|
-
const hasOtherElementInTabSequence = !(columnGroupHeaderTabIndexState === null && columnHeaderTabIndexState === null &&
|
|
37
|
+
const hasOtherElementInTabSequence = !(columnGroupHeaderTabIndexState === null && columnHeaderTabIndexState === null && hasNoCellTabIndexState);
|
|
38
38
|
const columnsContainerRef = apiRef.current.columnHeadersContainerRef;
|
|
39
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnHeaders, (0, _extends2.default)({
|
|
40
40
|
ref: columnsContainerRef,
|