@mui/x-data-grid 8.0.0-alpha.7 → 8.0.0-alpha.9
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 +551 -3
- package/DataGrid/DataGrid.js +4 -5
- package/DataGrid/useDataGridComponent.d.ts +2 -1
- package/DataGrid/useDataGridComponent.js +1 -1
- package/components/GridApiContext.js +2 -0
- package/components/GridConfigurationContext.js +2 -0
- package/components/GridHeaders.js +2 -2
- package/components/GridRow.d.ts +5 -9
- package/components/GridRow.js +28 -78
- package/components/GridScrollArea.js +2 -0
- package/components/GridSkeletonLoadingOverlay.js +18 -18
- package/components/cell/GridCell.d.ts +9 -16
- package/components/cell/GridCell.js +17 -35
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -5
- package/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -5
- package/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/components/containers/GridRoot.d.ts +2 -2
- package/components/containers/GridRoot.js +14 -6
- package/components/containers/GridRootStyles.js +7 -0
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +32 -29
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputValue.js +34 -28
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
- package/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/components/virtualization/GridVirtualScroller.js +4 -4
- package/constants/gridClasses.d.ts +12 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +1 -0
- package/context/GridContextProvider.d.ts +2 -1
- package/context/GridRootPropsContext.js +2 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
- package/hooks/core/useGridApiInitialization.d.ts +2 -2
- package/hooks/core/useGridInitialization.d.ts +2 -2
- package/hooks/core/useGridIsRtl.d.ts +2 -2
- package/hooks/core/useGridLocaleText.d.ts +2 -2
- package/hooks/core/useGridLoggerFactory.d.ts +2 -2
- package/hooks/core/useGridRefs.d.ts +2 -2
- package/hooks/core/useGridStateInitialization.d.ts +2 -2
- package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
- package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +4 -4
- package/hooks/features/columns/useGridColumnSpanning.d.ts +2 -2
- package/hooks/features/columns/useGridColumns.d.ts +2 -2
- package/hooks/features/density/useGridDensity.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/events/useGridEvents.d.ts +2 -2
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -1
- package/hooks/features/export/useGridCsvExport.d.ts +2 -2
- package/hooks/features/export/useGridPrintExport.d.ts +2 -2
- package/hooks/features/export/utils.d.ts +2 -2
- package/hooks/features/filter/gridFilterSelector.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.js +6 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +7 -7
- package/hooks/features/filter/gridFilterUtils.js +3 -3
- package/hooks/features/filter/useGridFilter.d.ts +2 -2
- package/hooks/features/focus/useGridFocus.d.ts +2 -2
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -3
- package/hooks/features/listView/useGridListView.d.ts +2 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +3 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +21 -2
- package/hooks/features/pagination/gridPaginationSelector.js +39 -1
- package/hooks/features/pagination/useGridPagination.d.ts +3 -3
- package/hooks/features/pagination/useGridPagination.js +5 -3
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridPaginationModel.js +23 -1
- package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
- package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
- package/hooks/features/preferencesPanel/index.d.ts +1 -1
- package/hooks/features/preferencesPanel/index.js +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
- package/hooks/features/rowSelection/utils.d.ts +3 -2
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
- package/hooks/features/rows/gridRowsSelector.js +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +2 -2
- package/hooks/features/rows/useGridRowsMeta.d.ts +2 -2
- package/hooks/features/rows/useGridRowsPreProcessors.d.ts +2 -2
- package/hooks/features/scroll/useGridScroll.d.ts +2 -2
- package/hooks/features/sorting/gridSortingUtils.d.ts +3 -3
- package/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/hooks/features/sorting/useGridSorting.d.ts +2 -2
- package/hooks/features/statePersistence/useGridStatePersistence.d.ts +2 -2
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +6 -0
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
- package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
- package/hooks/utils/useGridApiContext.d.ts +2 -2
- package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
- package/hooks/utils/useGridApiMethod.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +2 -2
- package/hooks/utils/useGridApiRef.js +3 -1
- package/hooks/utils/useGridInitializeState.d.ts +3 -3
- package/hooks/utils/useGridLogger.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
- package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
- package/hooks/utils/useGridSelector.d.ts +2 -2
- package/hooks/utils/useGridVisibleRows.d.ts +8 -6
- package/hooks/utils/useGridVisibleRows.js +5 -28
- package/index.js +1 -1
- package/internals/constants.d.ts +6 -0
- package/internals/constants.js +8 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/utils/attachPinnedStyle.d.ts +2 -0
- package/internals/utils/attachPinnedStyle.js +9 -0
- package/internals/utils/getPinnedCellOffset.d.ts +3 -3
- package/internals/utils/getPinnedCellOffset.js +6 -7
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/locales/arSD.js +2 -0
- package/locales/beBY.js +1 -0
- package/locales/bgBG.js +2 -0
- package/locales/csCZ.js +2 -0
- package/locales/daDK.js +2 -0
- package/locales/deDE.js +2 -0
- package/locales/elGR.js +2 -0
- package/locales/esES.js +2 -0
- package/locales/faIR.js +7 -6
- package/locales/fiFI.js +2 -0
- package/locales/frFR.js +2 -0
- package/locales/heIL.js +2 -0
- package/locales/hrHR.js +2 -0
- package/locales/huHU.js +2 -0
- package/locales/isIS.js +2 -0
- package/locales/itIT.js +2 -0
- package/locales/jaJP.js +2 -0
- package/locales/koKR.js +2 -0
- package/locales/nbNO.js +2 -0
- package/locales/nlNL.js +2 -0
- package/locales/nnNO.js +2 -0
- package/locales/plPL.js +2 -0
- package/locales/ptBR.js +2 -0
- package/locales/ptPT.js +2 -0
- package/locales/roRO.js +2 -0
- package/locales/ruRU.js +2 -0
- package/locales/skSK.js +2 -0
- package/locales/svSE.js +2 -0
- package/locales/trTR.js +2 -0
- package/locales/ukUA.js +2 -0
- package/locales/urPK.js +11 -10
- package/locales/viVN.js +2 -0
- package/locales/zhCN.js +2 -0
- package/locales/zhHK.js +2 -0
- package/locales/zhTW.js +2 -0
- package/material/index.js +2 -1
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +9 -8
- package/models/events/gridEventLookup.d.ts +6 -1
- package/models/gridExport.d.ts +2 -2
- package/models/gridFilterOperator.d.ts +2 -1
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +4 -0
- package/models/props/DataGridProps.d.ts +2 -1
- package/modern/DataGrid/DataGrid.js +4 -5
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/components/GridApiContext.js +2 -0
- package/modern/components/GridConfigurationContext.js +2 -0
- package/modern/components/GridHeaders.js +2 -2
- package/modern/components/GridRow.js +28 -78
- package/modern/components/GridScrollArea.js +2 -0
- package/modern/components/GridSkeletonLoadingOverlay.js +18 -18
- package/modern/components/cell/GridCell.js +17 -35
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/modern/components/containers/GridRoot.js +14 -6
- package/modern/components/containers/GridRootStyles.js +7 -0
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +32 -29
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +34 -28
- package/modern/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/modern/components/virtualization/GridVirtualScroller.js +4 -4
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/context/GridRootPropsContext.js +2 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.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/gridPreferencePanelSelector.js +8 -1
- package/modern/hooks/features/preferencesPanel/index.js +1 -1
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +2 -2
- package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
- package/modern/hooks/utils/useGridApiRef.js +3 -1
- package/modern/hooks/utils/useGridVisibleRows.js +5 -28
- package/modern/index.js +1 -1
- package/modern/internals/constants.js +8 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/attachPinnedStyle.js +9 -0
- package/modern/internals/utils/getPinnedCellOffset.js +6 -7
- package/modern/internals/utils/index.js +2 -1
- package/modern/locales/arSD.js +2 -0
- package/modern/locales/beBY.js +1 -0
- package/modern/locales/bgBG.js +2 -0
- package/modern/locales/csCZ.js +2 -0
- package/modern/locales/daDK.js +2 -0
- package/modern/locales/deDE.js +2 -0
- package/modern/locales/elGR.js +2 -0
- package/modern/locales/esES.js +2 -0
- package/modern/locales/faIR.js +7 -6
- package/modern/locales/fiFI.js +2 -0
- package/modern/locales/frFR.js +2 -0
- package/modern/locales/heIL.js +2 -0
- package/modern/locales/hrHR.js +2 -0
- package/modern/locales/huHU.js +2 -0
- package/modern/locales/isIS.js +2 -0
- package/modern/locales/itIT.js +2 -0
- package/modern/locales/jaJP.js +2 -0
- package/modern/locales/koKR.js +2 -0
- package/modern/locales/nbNO.js +2 -0
- package/modern/locales/nlNL.js +2 -0
- package/modern/locales/nnNO.js +2 -0
- package/modern/locales/plPL.js +2 -0
- package/modern/locales/ptBR.js +2 -0
- package/modern/locales/ptPT.js +2 -0
- package/modern/locales/roRO.js +2 -0
- package/modern/locales/ruRU.js +2 -0
- package/modern/locales/skSK.js +2 -0
- package/modern/locales/svSE.js +2 -0
- package/modern/locales/trTR.js +2 -0
- package/modern/locales/ukUA.js +2 -0
- package/modern/locales/urPK.js +11 -10
- package/modern/locales/viVN.js +2 -0
- package/modern/locales/zhCN.js +2 -0
- package/modern/locales/zhHK.js +2 -0
- package/modern/locales/zhTW.js +2 -0
- package/modern/material/index.js +2 -1
- package/modern/utils/cellBorderUtils.js +5 -5
- package/modern/utils/domUtils.js +7 -2
- package/modern/utils/isJSDOM.js +1 -0
- package/modern/utils/rtlFlipSide.js +22 -0
- package/node/DataGrid/DataGrid.js +2 -3
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/components/GridApiContext.js +1 -0
- package/node/components/GridConfigurationContext.js +1 -0
- package/node/components/GridHeaders.js +2 -2
- package/node/components/GridRow.js +26 -77
- package/node/components/GridScrollArea.js +1 -0
- package/node/components/GridSkeletonLoadingOverlay.js +17 -17
- package/node/components/cell/GridCell.js +18 -36
- package/node/components/columnHeaders/GridColumnGroupHeader.js +7 -10
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +19 -5
- package/node/components/columnHeaders/GridColumnHeaderItem.js +13 -12
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/containers/GridRoot.js +14 -6
- package/node/components/containers/GridRootStyles.js +7 -0
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +12 -16
- package/node/components/panel/filterPanel/GridFilterInputDate.js +31 -28
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +13 -17
- package/node/components/panel/filterPanel/GridFilterInputValue.js +33 -27
- package/node/components/toolbar/GridToolbarColumnsButton.js +6 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +6 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +11 -12
- package/node/components/virtualization/GridVirtualScroller.js +4 -4
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +1 -0
- package/node/context/GridRootPropsContext.js +1 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +32 -74
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.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/gridPreferencePanelSelector.js +9 -2
- package/node/hooks/features/preferencesPanel/index.js +11 -10
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
- package/node/hooks/features/rows/gridRowsSelector.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +49 -0
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +94 -52
- package/node/hooks/utils/useGridApiRef.js +3 -1
- package/node/hooks/utils/useGridVisibleRows.js +3 -28
- package/node/index.js +1 -1
- package/node/internals/constants.js +9 -2
- package/node/internals/index.js +12 -0
- package/node/internals/utils/attachPinnedStyle.js +15 -0
- package/node/internals/utils/getPinnedCellOffset.js +6 -7
- package/node/internals/utils/index.js +11 -0
- package/node/locales/arSD.js +2 -0
- package/node/locales/beBY.js +1 -0
- package/node/locales/bgBG.js +2 -0
- package/node/locales/csCZ.js +2 -0
- package/node/locales/daDK.js +2 -0
- package/node/locales/deDE.js +2 -0
- package/node/locales/elGR.js +2 -0
- package/node/locales/esES.js +2 -0
- package/node/locales/faIR.js +7 -6
- package/node/locales/fiFI.js +2 -0
- package/node/locales/frFR.js +2 -0
- package/node/locales/heIL.js +2 -0
- package/node/locales/hrHR.js +2 -0
- package/node/locales/huHU.js +2 -0
- package/node/locales/isIS.js +2 -0
- package/node/locales/itIT.js +2 -0
- package/node/locales/jaJP.js +2 -0
- package/node/locales/koKR.js +2 -0
- package/node/locales/nbNO.js +2 -0
- package/node/locales/nlNL.js +2 -0
- package/node/locales/nnNO.js +2 -0
- package/node/locales/plPL.js +2 -0
- package/node/locales/ptBR.js +2 -0
- package/node/locales/ptPT.js +2 -0
- package/node/locales/roRO.js +2 -0
- package/node/locales/ruRU.js +2 -0
- package/node/locales/skSK.js +2 -0
- package/node/locales/svSE.js +2 -0
- package/node/locales/trTR.js +2 -0
- package/node/locales/ukUA.js +2 -0
- package/node/locales/urPK.js +11 -10
- package/node/locales/viVN.js +2 -0
- package/node/locales/zhCN.js +2 -0
- package/node/locales/zhHK.js +2 -0
- package/node/locales/zhTW.js +2 -0
- package/node/material/index.js +2 -1
- package/node/utils/cellBorderUtils.js +5 -5
- package/node/utils/domUtils.js +7 -2
- package/node/utils/isJSDOM.js +7 -0
- package/node/utils/rtlFlipSide.js +29 -0
- package/package.json +2 -2
- package/utils/cellBorderUtils.d.ts +3 -3
- package/utils/cellBorderUtils.js +5 -5
- package/utils/createSelector.d.ts +2 -2
- package/utils/domUtils.js +7 -2
- package/utils/getPublicApiRef.d.ts +2 -1
- package/utils/isJSDOM.d.ts +1 -0
- package/utils/isJSDOM.js +1 -0
- package/utils/rtlFlipSide.d.ts +2 -0
- package/utils/rtlFlipSide.js +22 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
3
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
4
|
import { GridStateInitializer } from '../../utils/useGridInitializeState';
|
|
@@ -7,4 +7,4 @@ export declare const sortingStateInitializer: GridStateInitializer<Pick<DataGrid
|
|
|
7
7
|
* @requires useGridRows (event)
|
|
8
8
|
* @requires useGridColumns (event)
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridSorting: (apiRef:
|
|
10
|
+
export declare const useGridSorting: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "initialState" | "sortModel" | "onSortModelChange" | "sortingOrder" | "sortingMode" | "disableColumnSorting" | "disableMultipleColumnsSorting">) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
|
-
export declare const useGridStatePersistence: (apiRef:
|
|
3
|
+
export declare const useGridStatePersistence: (apiRef: RefObject<GridPrivateApiCommunity>) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const gridFocusedVirtualCellSelector: import("../../..").OutputSelector<import("../../../models/gridStateCommunity").GridStateCommunity, import("../../..").GridCellCoordinates | null, {
|
|
2
|
+
rowIndex: number;
|
|
3
|
+
columnIndex: number;
|
|
4
|
+
id?: import("../../..").GridRowId | undefined;
|
|
5
|
+
field?: string | undefined;
|
|
6
|
+
} | null>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createSelector } from 'reselect';
|
|
3
|
+
import { createSelectorMemoized } from "../../../utils/createSelector.js";
|
|
4
|
+
import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSelector.js";
|
|
5
|
+
import { gridRenderContextSelector } from "./gridVirtualizationSelectors.js";
|
|
6
|
+
import { gridFocusCellSelector } from "../focus/index.js";
|
|
7
|
+
import { gridVisibleRowsSelector } from "../pagination/index.js";
|
|
8
|
+
import { gridRowsLookupSelector } from "../rows/index.js";
|
|
9
|
+
const gridIsFocusedCellOutOfContex = createSelector(gridFocusCellSelector, gridRenderContextSelector, gridVisibleRowsSelector, gridVisibleColumnDefinitionsSelector, gridRowsLookupSelector, (focusedCell, renderContext, currentPage, visibleColumns, rows) => {
|
|
10
|
+
if (!focusedCell) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const row = rows[focusedCell.id];
|
|
14
|
+
if (!row) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const rowIndex = currentPage.rowToIndexMap.get(row);
|
|
18
|
+
const columnIndex = visibleColumns.slice(renderContext.firstColumnIndex, renderContext.lastColumnIndex).findIndex(column => column.field === focusedCell.field);
|
|
19
|
+
const isInRenderContext = rowIndex !== undefined && columnIndex !== -1 && rowIndex >= renderContext.firstRowIndex && rowIndex <= renderContext.lastRowIndex;
|
|
20
|
+
return !isInRenderContext;
|
|
21
|
+
});
|
|
22
|
+
export const gridFocusedVirtualCellSelector = createSelectorMemoized(gridIsFocusedCellOutOfContex, gridVisibleColumnDefinitionsSelector, gridVisibleRowsSelector, gridRowsLookupSelector, gridFocusCellSelector, (isFocusedCellOutOfRenderContext, visibleColumns, currentPage, rows, focusedCell) => {
|
|
23
|
+
if (!isFocusedCellOutOfRenderContext) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const row = rows[focusedCell.id];
|
|
27
|
+
if (!row) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const rowIndex = currentPage.rowToIndexMap.get(row);
|
|
31
|
+
if (rowIndex === undefined) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const columnIndex = visibleColumns.findIndex(column => column.field === focusedCell.field);
|
|
35
|
+
if (columnIndex === -1) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return _extends({}, focusedCell, {
|
|
39
|
+
rowIndex,
|
|
40
|
+
columnIndex
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPinnedRowsPosition } from '../rows/gridRowsInterfaces';
|
|
3
|
-
import type
|
|
3
|
+
import { type GridRenderContext, type GridColumnsRenderContext, type GridRowEntry, type GridRowId } from '../../../models';
|
|
4
4
|
export type VirtualScroller = ReturnType<typeof useGridVirtualScroller>;
|
|
5
5
|
export declare const EMPTY_DETAIL_PANELS: Readonly<Map<GridRowId, React.ReactNode>>;
|
|
6
6
|
export declare const useGridVirtualScroller: () => {
|
|
@@ -26,6 +26,7 @@ export declare const useGridVirtualScroller: () => {
|
|
|
26
26
|
getContentProps: () => {
|
|
27
27
|
style: React.CSSProperties;
|
|
28
28
|
role: string;
|
|
29
|
+
ref: (node: HTMLDivElement | null) => void;
|
|
29
30
|
};
|
|
30
31
|
getRenderZoneProps: () => {
|
|
31
32
|
role: string;
|
|
@@ -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,8 @@ 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
|
+
import { isJSDOM } from "../../../utils/isJSDOM.js";
|
|
29
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
31
|
const MINIMUM_COLUMN_WIDTH = 50;
|
|
31
32
|
var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
|
|
@@ -45,14 +46,6 @@ const createScrollCache = (isRtl, rowBufferPx, columnBufferPx, verticalBuffer, h
|
|
|
45
46
|
direction: ScrollDirection.NONE,
|
|
46
47
|
buffer: bufferForDirection(isRtl, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
|
|
47
48
|
});
|
|
48
|
-
let isJSDOM = false;
|
|
49
|
-
try {
|
|
50
|
-
if (typeof window !== 'undefined') {
|
|
51
|
-
isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
52
|
-
}
|
|
53
|
-
} catch (_) {
|
|
54
|
-
/* ignore */
|
|
55
|
-
}
|
|
56
49
|
export const useGridVirtualScroller = () => {
|
|
57
50
|
const apiRef = useGridPrivateApiContext();
|
|
58
51
|
const rootProps = useGridRootProps();
|
|
@@ -73,12 +66,9 @@ export const useGridVirtualScroller = () => {
|
|
|
73
66
|
const hasBottomPinnedRows = pinnedRows.bottom.length > 0;
|
|
74
67
|
const [panels, setPanels] = React.useState(EMPTY_DETAIL_PANELS);
|
|
75
68
|
const isRtl = useRtl();
|
|
76
|
-
const cellFocus = useGridSelector(apiRef, gridFocusCellSelector);
|
|
77
|
-
const cellTabIndex = useGridSelector(apiRef, gridTabIndexCellSelector);
|
|
78
69
|
const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
|
|
79
70
|
const selectedRowsLookup = useGridSelector(apiRef, selectedIdsLookupSelector);
|
|
80
71
|
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
81
|
-
const gridRootRef = apiRef.current.rootElementRef;
|
|
82
72
|
const mainRef = apiRef.current.mainElementRef;
|
|
83
73
|
const scrollerRef = apiRef.current.virtualScrollerRef;
|
|
84
74
|
const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
|
|
@@ -86,6 +76,7 @@ export const useGridVirtualScroller = () => {
|
|
|
86
76
|
const contentHeight = dimensions.contentSize.height;
|
|
87
77
|
const columnsTotalWidth = dimensions.columnsTotalWidth;
|
|
88
78
|
const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
|
|
79
|
+
const isRenderContextReady = React.useRef(false);
|
|
89
80
|
const previousSize = React.useRef(null);
|
|
90
81
|
const mainRefCallback = React.useCallback(node => {
|
|
91
82
|
mainRef.current = node;
|
|
@@ -138,17 +129,15 @@ export const useGridVirtualScroller = () => {
|
|
|
138
129
|
* work that's not necessary. Thus we store the context at the start of the scroll in `frozenContext`, and the rows
|
|
139
130
|
* that are part of this old context will keep their same render context as to avoid re-rendering.
|
|
140
131
|
*/
|
|
141
|
-
const scrollPosition = React.useRef(EMPTY_SCROLL_POSITION);
|
|
132
|
+
const scrollPosition = React.useRef(rootProps.initialState?.scroll ?? EMPTY_SCROLL_POSITION);
|
|
133
|
+
const ignoreNextScrollEvent = React.useRef(false);
|
|
142
134
|
const previousContextScrollPosition = React.useRef(EMPTY_SCROLL_POSITION);
|
|
143
135
|
const previousRowContext = React.useRef(EMPTY_RENDER_CONTEXT);
|
|
144
136
|
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
137
|
+
const focusedVirtualCell = useGridSelector(apiRef, gridFocusedVirtualCellSelector);
|
|
145
138
|
const scrollTimeout = useTimeout();
|
|
146
139
|
const frozenContext = React.useRef(undefined);
|
|
147
140
|
const scrollCache = useLazyRef(() => createScrollCache(isRtl, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
|
|
148
|
-
const focusedCell = {
|
|
149
|
-
rowIndex: React.useMemo(() => cellFocus ? currentPage.rows.findIndex(row => row.id === cellFocus.id) : -1, [cellFocus, currentPage.rows]),
|
|
150
|
-
columnIndex: React.useMemo(() => cellFocus ? visibleColumns.findIndex(column => column.field === cellFocus.field) : -1, [cellFocus, visibleColumns])
|
|
151
|
-
};
|
|
152
141
|
const updateRenderContext = React.useCallback(nextRenderContext => {
|
|
153
142
|
if (areRenderContextsEqual(nextRenderContext, apiRef.current.state.virtualization.renderContext)) {
|
|
154
143
|
return;
|
|
@@ -232,6 +221,10 @@ export const useGridVirtualScroller = () => {
|
|
|
232
221
|
updateRenderContext(nextRenderContext);
|
|
233
222
|
};
|
|
234
223
|
const handleScroll = useEventCallback(event => {
|
|
224
|
+
if (ignoreNextScrollEvent.current) {
|
|
225
|
+
ignoreNextScrollEvent.current = false;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
235
228
|
const {
|
|
236
229
|
scrollTop,
|
|
237
230
|
scrollLeft
|
|
@@ -290,14 +283,14 @@ export const useGridVirtualScroller = () => {
|
|
|
290
283
|
const lastRowToRender = Math.min(baseRenderContext.lastRowIndex, rowModels.length);
|
|
291
284
|
const rowIndexes = params.rows ? range(0, params.rows.length) : range(firstRowToRender, lastRowToRender);
|
|
292
285
|
let virtualRowIndex = -1;
|
|
293
|
-
if (!isPinnedSection &&
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
286
|
+
if (!isPinnedSection && focusedVirtualCell) {
|
|
287
|
+
if (focusedVirtualCell.rowIndex < firstRowToRender) {
|
|
288
|
+
rowIndexes.unshift(focusedVirtualCell.rowIndex);
|
|
289
|
+
virtualRowIndex = focusedVirtualCell.rowIndex;
|
|
297
290
|
}
|
|
298
|
-
if (
|
|
299
|
-
|
|
300
|
-
|
|
291
|
+
if (focusedVirtualCell.rowIndex > lastRowToRender) {
|
|
292
|
+
rowIndexes.push(focusedVirtualCell.rowIndex);
|
|
293
|
+
virtualRowIndex = focusedVirtualCell.rowIndex;
|
|
301
294
|
}
|
|
302
295
|
}
|
|
303
296
|
const rows = [];
|
|
@@ -337,7 +330,6 @@ export const useGridVirtualScroller = () => {
|
|
|
337
330
|
});
|
|
338
331
|
}
|
|
339
332
|
}
|
|
340
|
-
const hasFocus = cellFocus?.id === id;
|
|
341
333
|
const baseRowHeight = !apiRef.current.rowHasAutoHeight(id) ? apiRef.current.unstable_getRowHeight(id) : 'auto';
|
|
342
334
|
let isSelected;
|
|
343
335
|
if (selectedRowsLookup[id] == null) {
|
|
@@ -362,19 +354,16 @@ export const useGridVirtualScroller = () => {
|
|
|
362
354
|
isLastVisible = isLastVisibleInSection;
|
|
363
355
|
}
|
|
364
356
|
}
|
|
365
|
-
const isVirtualRow = rowIndexInPage === virtualRowIndex;
|
|
366
|
-
const isNotVisible = isVirtualRow;
|
|
367
|
-
let tabbableCell = null;
|
|
368
|
-
if (cellTabIndex !== null && cellTabIndex.id === id) {
|
|
369
|
-
const cellParams = apiRef.current.getCellParams(id, cellTabIndex.field);
|
|
370
|
-
tabbableCell = cellParams.cellMode === 'view' ? cellTabIndex.field : null;
|
|
371
|
-
}
|
|
372
357
|
let currentRenderContext = baseRenderContext;
|
|
373
358
|
if (!isPinnedSection && frozenContext.current && rowIndexInPage >= frozenContext.current.firstRowIndex && rowIndexInPage < frozenContext.current.lastRowIndex) {
|
|
374
359
|
currentRenderContext = frozenContext.current;
|
|
375
360
|
}
|
|
361
|
+
const isVirtualFocusRow = rowIndexInPage === virtualRowIndex;
|
|
362
|
+
const isVirtualFocusColumn = focusedVirtualCell?.rowIndex === rowIndex;
|
|
376
363
|
const offsetLeft = computeOffsetLeft(columnPositions, currentRenderContext, pinnedColumns.left.length);
|
|
377
364
|
const showBottomBorder = isLastVisibleInSection && params.position === 'top';
|
|
365
|
+
const firstColumnIndex = currentRenderContext.firstColumnIndex;
|
|
366
|
+
const lastColumnIndex = currentRenderContext.lastColumnIndex;
|
|
378
367
|
rows.push(/*#__PURE__*/_jsx(rootProps.slots.row, _extends({
|
|
379
368
|
row: model,
|
|
380
369
|
rowId: id,
|
|
@@ -382,19 +371,21 @@ export const useGridVirtualScroller = () => {
|
|
|
382
371
|
selected: isSelected,
|
|
383
372
|
offsetTop: params.rows ? undefined : rowsMeta.positions[rowIndexInPage],
|
|
384
373
|
offsetLeft: offsetLeft,
|
|
385
|
-
|
|
374
|
+
columnsTotalWidth: dimensions.columnsTotalWidth,
|
|
386
375
|
rowHeight: baseRowHeight,
|
|
387
|
-
tabbableCell: tabbableCell,
|
|
388
376
|
pinnedColumns: pinnedColumns,
|
|
389
377
|
visibleColumns: visibleColumns,
|
|
390
|
-
|
|
391
|
-
|
|
378
|
+
firstColumnIndex: firstColumnIndex,
|
|
379
|
+
lastColumnIndex: lastColumnIndex,
|
|
380
|
+
focusedColumnIndex: isVirtualFocusColumn ? focusedVirtualCell.columnIndex : undefined,
|
|
392
381
|
isFirstVisible: isFirstVisible,
|
|
393
382
|
isLastVisible: isLastVisible,
|
|
394
|
-
isNotVisible:
|
|
395
|
-
showBottomBorder: showBottomBorder
|
|
383
|
+
isNotVisible: isVirtualFocusRow,
|
|
384
|
+
showBottomBorder: showBottomBorder,
|
|
385
|
+
scrollbarWidth: dimensions.hasScrollY ? dimensions.scrollbarSize : 0,
|
|
386
|
+
gridHasFiller: dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width
|
|
396
387
|
}, rowProps), id));
|
|
397
|
-
if (
|
|
388
|
+
if (isVirtualFocusRow) {
|
|
398
389
|
return;
|
|
399
390
|
}
|
|
400
391
|
const panel = panels.get(id);
|
|
@@ -425,18 +416,21 @@ export const useGridVirtualScroller = () => {
|
|
|
425
416
|
}
|
|
426
417
|
return size;
|
|
427
418
|
}, [columnsTotalWidth, contentHeight, needsHorizontalScrollbar]);
|
|
428
|
-
React.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
useEnhancedEffect(() => {
|
|
432
|
-
// TODO a scroll reset should not be necessary
|
|
433
|
-
if (enabledForColumns) {
|
|
434
|
-
scrollerRef.current.scrollLeft = 0;
|
|
419
|
+
const onContentSizeApplied = React.useCallback(node => {
|
|
420
|
+
if (!node) {
|
|
421
|
+
return;
|
|
435
422
|
}
|
|
436
|
-
|
|
437
|
-
|
|
423
|
+
apiRef.current.publishEvent('virtualScrollerContentSizeChange', {
|
|
424
|
+
columnsTotalWidth,
|
|
425
|
+
contentHeight
|
|
426
|
+
});
|
|
427
|
+
}, [apiRef, columnsTotalWidth, contentHeight]);
|
|
428
|
+
useEnhancedEffect(() => {
|
|
429
|
+
if (!isRenderContextReady.current) {
|
|
430
|
+
return;
|
|
438
431
|
}
|
|
439
|
-
|
|
432
|
+
apiRef.current.updateRenderContext?.();
|
|
433
|
+
}, [apiRef, enabledForColumns, enabledForRows]);
|
|
440
434
|
useEnhancedEffect(() => {
|
|
441
435
|
if (listView) {
|
|
442
436
|
scrollerRef.current.scrollLeft = 0;
|
|
@@ -451,6 +445,53 @@ export const useGridVirtualScroller = () => {
|
|
|
451
445
|
left: scrollPosition.current.left,
|
|
452
446
|
renderContext: initialRenderContext
|
|
453
447
|
});
|
|
448
|
+
isRenderContextReady.current = true;
|
|
449
|
+
if (rootProps.initialState?.scroll && scrollerRef.current) {
|
|
450
|
+
const scroller = scrollerRef.current;
|
|
451
|
+
const {
|
|
452
|
+
top,
|
|
453
|
+
left
|
|
454
|
+
} = rootProps.initialState.scroll;
|
|
455
|
+
|
|
456
|
+
// 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.
|
|
457
|
+
const isScrollRestored = {
|
|
458
|
+
top: !(top > 0),
|
|
459
|
+
left: !(left > 0)
|
|
460
|
+
};
|
|
461
|
+
if (!isScrollRestored.left && columnsTotalWidth) {
|
|
462
|
+
scroller.scrollLeft = left;
|
|
463
|
+
ignoreNextScrollEvent.current = true;
|
|
464
|
+
isScrollRestored.left = true;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// For the sake of completeness, but I'm not sure if contentHeight is ever available at this point. Maybe when virtualisation is disabled?
|
|
468
|
+
if (!isScrollRestored.top && contentHeight) {
|
|
469
|
+
scroller.scrollTop = top;
|
|
470
|
+
ignoreNextScrollEvent.current = true;
|
|
471
|
+
isScrollRestored.top = true;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// 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
|
|
475
|
+
if (!isScrollRestored.top || !isScrollRestored.left) {
|
|
476
|
+
const unsubscribeContentSizeChange = apiRef.current.subscribeEvent('virtualScrollerContentSizeChange', params => {
|
|
477
|
+
if (!isScrollRestored.left && params.columnsTotalWidth) {
|
|
478
|
+
scroller.scrollLeft = left;
|
|
479
|
+
ignoreNextScrollEvent.current = true;
|
|
480
|
+
isScrollRestored.left = true;
|
|
481
|
+
}
|
|
482
|
+
if (!isScrollRestored.top && params.contentHeight) {
|
|
483
|
+
scroller.scrollTop = top;
|
|
484
|
+
ignoreNextScrollEvent.current = true;
|
|
485
|
+
isScrollRestored.top = true;
|
|
486
|
+
}
|
|
487
|
+
if (isScrollRestored.left && isScrollRestored.top) {
|
|
488
|
+
unsubscribeContentSizeChange();
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
return unsubscribeContentSizeChange;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return undefined;
|
|
454
495
|
});
|
|
455
496
|
apiRef.current.register('private', {
|
|
456
497
|
updateRenderContext: forceUpdateRenderContext
|
|
@@ -478,7 +519,8 @@ export const useGridVirtualScroller = () => {
|
|
|
478
519
|
}),
|
|
479
520
|
getContentProps: () => ({
|
|
480
521
|
style: contentSize,
|
|
481
|
-
role: 'presentation'
|
|
522
|
+
role: 'presentation',
|
|
523
|
+
ref: onContentSizeApplied
|
|
482
524
|
}),
|
|
483
525
|
getRenderZoneProps: () => ({
|
|
484
526
|
role: 'rowgroup'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridRenderContext } from '../../../models';
|
|
3
3
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
4
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
@@ -17,5 +17,5 @@ export declare const EMPTY_RENDER_CONTEXT: {
|
|
|
17
17
|
lastColumnIndex: number;
|
|
18
18
|
};
|
|
19
19
|
export declare const virtualizationStateInitializer: GridStateInitializer<RootProps>;
|
|
20
|
-
export declare function useGridVirtualization(apiRef:
|
|
20
|
+
export declare function useGridVirtualization(apiRef: RefObject<GridPrivateApiCommunity>, props: RootProps): void;
|
|
21
21
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import { GridApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
|
-
export declare function useGridApiContext<Api extends GridApiCommon = GridApiCommunity>():
|
|
4
|
+
export declare function useGridApiContext<Api extends GridApiCommon = GridApiCommunity>(): RefObject<Api>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { EventListenerOptions } from '@mui/x-internals/EventManager';
|
|
3
3
|
import { GridEventListener, GridEvents } from '../../models/events';
|
|
4
4
|
import { CleanupTracking } from '../../utils/cleanupTracking/CleanupTracking';
|
|
@@ -15,8 +15,8 @@ declare enum GridSignature {
|
|
|
15
15
|
interface RegistryContainer {
|
|
16
16
|
registry: CleanupTracking | null;
|
|
17
17
|
}
|
|
18
|
-
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends GridEvents>(apiRef:
|
|
18
|
+
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends GridEvents>(apiRef: RefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
19
19
|
export declare const unstable_resetCleanupTracking: () => void;
|
|
20
|
-
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends GridEvents>(apiRef:
|
|
21
|
-
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef:
|
|
20
|
+
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends GridEvents>(apiRef: RefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
21
|
+
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef: RefObject<Api>, eventName: E, handler?: GridEventListener<E>): void;
|
|
22
22
|
export { GridSignature };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
type GetPublicApiType<PrivateApi> = PrivateApi extends {
|
|
4
4
|
getPublicApi: () => infer PublicApi;
|
|
5
5
|
} ? PublicApi : never;
|
|
6
|
-
export declare function useGridApiMethod<PrivateApi extends GridPrivateApiCommon, PublicApi extends GetPublicApiType<PrivateApi>, PrivateOnlyApi extends Omit<PrivateApi, keyof PublicApi>, V extends 'public' | 'private', T extends V extends 'public' ? Partial<PublicApi> : Partial<PrivateOnlyApi>>(privateApiRef:
|
|
6
|
+
export declare function useGridApiMethod<PrivateApi extends GridPrivateApiCommon, PublicApi extends GetPublicApiType<PrivateApi>, PrivateOnlyApi extends Omit<PrivateApi, keyof PublicApi>, V extends 'public' | 'private', T extends V extends 'public' ? Partial<PublicApi> : Partial<PrivateOnlyApi>>(privateApiRef: RefObject<PrivateApi>, apiMethods: T, visibility: V): void;
|
|
7
7
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridApiCommon } from '../../models';
|
|
3
3
|
import { GridApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
4
|
/**
|
|
5
5
|
* Hook that instantiate a [[GridApiRef]].
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() =>
|
|
7
|
+
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() => RefObject<Api>;
|
|
@@ -2,4 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Hook that instantiate a [[GridApiRef]].
|
|
4
4
|
*/
|
|
5
|
-
export const useGridApiRef = () =>
|
|
5
|
+
export const useGridApiRef = () =>
|
|
6
|
+
// TODO v8: initialize with null (see https://github.com/mui/mui-x/issues/16135#issuecomment-2589395230 and https://github.com/mui/mui-x/issues/16000#issuecomment-2567820735)
|
|
7
|
+
React.useRef({});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import { GridPrivateApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
4
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
5
5
|
type DeepPartial<T> = {
|
|
6
6
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
7
7
|
};
|
|
8
|
-
export type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity> = (state: DeepPartial<PrivateApi['state']>, props: P, privateApiRef:
|
|
9
|
-
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef:
|
|
8
|
+
export type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity> = (state: DeepPartial<PrivateApi['state']>, props: P, privateApiRef: RefObject<PrivateApi>) => DeepPartial<PrivateApi['state']>;
|
|
9
|
+
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: RefObject<PrivateApi>, props: P) => void;
|
|
10
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { Logger } from '../../models/logger';
|
|
3
3
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
4
|
-
export declare function useGridLogger<PrivateApi extends GridPrivateApiCommon>(privateApiRef:
|
|
4
|
+
export declare function useGridLogger<PrivateApi extends GridPrivateApiCommon>(privateApiRef: RefObject<PrivateApi>, name: string): Logger;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
|
-
export declare const useGridNativeEventListener: <PrivateApi extends GridPrivateApiCommon, K extends keyof HTMLElementEventMap>(apiRef:
|
|
4
|
+
export declare const useGridNativeEventListener: <PrivateApi extends GridPrivateApiCommon, K extends keyof HTMLElementEventMap>(apiRef: RefObject<PrivateApi>, ref: React.RefObject<HTMLDivElement | null> | (() => HTMLElement | undefined | null), eventName: K, handler?: (event: HTMLElementEventMap[K]) => any, options?: AddEventListenerOptions) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
3
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
4
|
import { GridPrivateApiCommunity } from '../../models/api/gridApiCommunity';
|
|
4
5
|
export declare const GridPrivateApiContext: React.Context<unknown>;
|
|
5
|
-
export declare function useGridPrivateApiContext<PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>():
|
|
6
|
+
export declare function useGridPrivateApiContext<PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(): RefObject<PrivateApi>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import type { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
3
3
|
import type { OutputSelector } from '../../utils/createSelector';
|
|
4
4
|
type Selector<Api extends GridApiCommon, Args, T> = ((state: Api['state']) => T) | OutputSelector<Api['state'], Args, T>;
|
|
5
5
|
export declare const objectShallowCompare: (a: unknown, b: unknown) => boolean;
|
|
6
6
|
export declare const argsEqual: (prev: any, curr: any) => boolean;
|
|
7
|
-
export declare const useGridSelector: <Api extends GridApiCommon, Args, T>(apiRef:
|
|
7
|
+
export declare const useGridSelector: <Api extends GridApiCommon, Args, T>(apiRef: RefObject<Api>, selector: Selector<Api, Args, T>, args?: Args, equals?: <U = T>(a: U, b: U) => boolean) => T;
|
|
8
8
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
|
-
import type { GridApiCommon
|
|
4
|
-
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef:
|
|
5
|
-
rows: GridRowEntry<import("../..").GridValidRowModel>[];
|
|
3
|
+
import type { GridApiCommon } from '../../models';
|
|
4
|
+
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: RefObject<Api>, props?: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
5
|
+
rows: import("../..").GridRowEntry<import("../..").GridValidRowModel>[];
|
|
6
6
|
range: {
|
|
7
7
|
firstRowIndex: number;
|
|
8
8
|
lastRowIndex: number;
|
|
9
9
|
} | null;
|
|
10
|
+
rowToIndexMap: Map<import("../..").GridValidRowModel, number>;
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Computes the list of rows that are reachable by scroll.
|
|
@@ -15,10 +16,11 @@ export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.R
|
|
|
15
16
|
* - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
|
|
16
17
|
* - If the row tree is flat, it only contains up to `state.pageSize` rows.
|
|
17
18
|
*/
|
|
18
|
-
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef:
|
|
19
|
-
rows: GridRowEntry<import("../..").GridValidRowModel>[];
|
|
19
|
+
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef: RefObject<Api>, props?: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
20
|
+
rows: import("../..").GridRowEntry<import("../..").GridValidRowModel>[];
|
|
20
21
|
range: {
|
|
21
22
|
firstRowIndex: number;
|
|
22
23
|
lastRowIndex: number;
|
|
23
24
|
} | null;
|
|
25
|
+
rowToIndexMap: Map<import("../..").GridValidRowModel, number>;
|
|
24
26
|
};
|
|
@@ -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/index.js
CHANGED
package/internals/constants.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export declare const GRID_TREE_DATA_GROUPING_FIELD = "__tree_data_group__";
|
|
2
2
|
export declare const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = "__row_group_by_columns_group__";
|
|
3
3
|
export declare const GRID_DETAIL_PANEL_TOGGLE_FIELD = "__detail_panel_toggle__";
|
|
4
|
+
export declare enum PinnedColumnPosition {
|
|
5
|
+
NONE = 0,
|
|
6
|
+
LEFT = 1,
|
|
7
|
+
RIGHT = 2,
|
|
8
|
+
VIRTUAL = 3
|
|
9
|
+
}
|
package/internals/constants.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
|
+
}({});
|
package/internals/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ export type * from '../models/props/DataGridProps';
|
|
|
77
77
|
export type * from '../models/gridDataSource';
|
|
78
78
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
79
79
|
export * from '../utils/createControllablePromise';
|
|
80
|
+
export * from '../utils/rtlFlipSide';
|
|
80
81
|
export { createSelector, createSelectorMemoized } from '../utils/createSelector';
|
|
81
82
|
export { gridRowGroupsToFetchSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
82
83
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal, } from '../utils/domUtils';
|
package/internals/index.js
CHANGED
|
@@ -62,6 +62,7 @@ export { useGridVisibleRows, getVisibleRows } from "../hooks/utils/useGridVisibl
|
|
|
62
62
|
export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
|
63
63
|
export { getColumnsToExport, defaultGetRowsToExport } from "../hooks/features/export/utils.js";
|
|
64
64
|
export * from "../utils/createControllablePromise.js";
|
|
65
|
+
export * from "../utils/rtlFlipSide.js";
|
|
65
66
|
export { createSelector, createSelectorMemoized } from "../utils/createSelector.js";
|
|
66
67
|
export { gridRowGroupsToFetchSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
67
68
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from "../utils/domUtils.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,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
export declare const getPinnedCellOffset: (pinnedPosition:
|
|
1
|
+
import { PinnedColumnPosition } from '../constants';
|
|
2
|
+
import { gridColumnPositionsSelector } from '../../hooks/features/columns';
|
|
3
|
+
export declare const getPinnedCellOffset: (pinnedPosition: PinnedColumnPosition | undefined, computedWidth: number, columnIndex: number, columnPositions: ReturnType<typeof gridColumnPositionsSelector>, columnsTotalWidth: number, scrollbarWidth: number) => number | undefined;
|