@mui/x-data-grid 8.0.0-alpha.6 → 8.0.0-alpha.8
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 +242 -1
- 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 +26 -78
- package/components/GridSkeletonLoadingOverlay.js +18 -18
- package/components/cell/GridActionsCellItem.d.ts +16 -9
- package/components/cell/GridActionsCellItem.js +2 -0
- 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/GridColumnHeaderFilterIconButton.js +0 -1
- 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/columnsManagement/GridColumnsManagement.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.d.ts +1 -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 +40 -37
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.js +2 -2
- 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 +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +9 -2
- 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 +4 -4
- 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/editing/useGridCellEditing.d.ts +1 -1
- package/hooks/features/editing/useGridCellEditing.js +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 +2 -2
- 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.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 +21 -2
- 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 +1 -1
- 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 +2 -1
- 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 +2 -0
- 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 +2 -0
- 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/gridCoreApi.d.ts +7 -7
- package/models/api/gridDensityApi.d.ts +1 -1
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +8 -8
- package/models/events/gridEventLookup.d.ts +6 -1
- package/models/gridBaseSlots.d.ts +32 -2
- package/models/gridExport.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +12 -8
- 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 +26 -78
- package/modern/components/GridSkeletonLoadingOverlay.js +18 -18
- package/modern/components/cell/GridActionsCellItem.js +2 -0
- 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/GridColumnHeaderFilterIconButton.js +0 -1
- 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/columnsManagement/GridColumnsManagement.js +2 -2
- package/modern/components/containers/GridRoot.js +14 -6
- package/modern/components/containers/GridRootStyles.js +7 -0
- 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 +40 -37
- package/modern/components/toolbar/GridToolbarQuickFilter.js +2 -2
- 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/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 +4 -4
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +2 -2
- 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/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 +2 -0
- 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 +2 -0
- 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/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 +25 -77
- package/node/components/GridSkeletonLoadingOverlay.js +17 -17
- package/node/components/cell/GridActionsCellItem.js +1 -1
- 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/GridColumnHeaderFilterIconButton.js +0 -1
- 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/columnsManagement/GridColumnsManagement.js +2 -2
- package/node/components/containers/GridRoot.js +14 -6
- package/node/components/containers/GridRootStyles.js +7 -0
- 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 +39 -36
- package/node/components/toolbar/GridToolbarQuickFilter.js +2 -2
- 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/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 +4 -4
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +2 -2
- 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/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 +2 -0
- 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 +2 -0
- 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/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 +1 -1
- 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
|
@@ -18,6 +18,7 @@ var _gridEditRowModel = require("../models/gridEditRowModel");
|
|
|
18
18
|
var _gridClasses = require("../constants/gridClasses");
|
|
19
19
|
var _composeGridClasses = require("../utils/composeGridClasses");
|
|
20
20
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
21
|
+
var _cellBorderUtils = require("../utils/cellBorderUtils");
|
|
21
22
|
var _gridColumnsSelector = require("../hooks/features/columns/gridColumnsSelector");
|
|
22
23
|
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
23
24
|
var _useGridVisibleRows = require("../hooks/utils/useGridVisibleRows");
|
|
@@ -28,14 +29,12 @@ var _constants = require("../internals/constants");
|
|
|
28
29
|
var _gridSortingSelector = require("../hooks/features/sorting/gridSortingSelector");
|
|
29
30
|
var _gridRowsSelector = require("../hooks/features/rows/gridRowsSelector");
|
|
30
31
|
var _gridEditingSelectors = require("../hooks/features/editing/gridEditingSelectors");
|
|
31
|
-
var _GridCell = require("./cell/GridCell");
|
|
32
32
|
var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
33
33
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
34
34
|
var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
|
|
35
35
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
36
|
-
var _hooks = require("../hooks");
|
|
37
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
38
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "
|
|
37
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
39
38
|
const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
40
39
|
const {
|
|
41
40
|
selected,
|
|
@@ -48,13 +47,16 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
48
47
|
visibleColumns,
|
|
49
48
|
pinnedColumns,
|
|
50
49
|
offsetLeft,
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
columnsTotalWidth,
|
|
51
|
+
firstColumnIndex,
|
|
52
|
+
lastColumnIndex,
|
|
53
53
|
focusedColumnIndex,
|
|
54
54
|
isFirstVisible,
|
|
55
55
|
isLastVisible,
|
|
56
56
|
isNotVisible,
|
|
57
57
|
showBottomBorder,
|
|
58
|
+
scrollbarWidth,
|
|
59
|
+
gridHasFiller,
|
|
58
60
|
onClick,
|
|
59
61
|
onDoubleClick,
|
|
60
62
|
onMouseEnter,
|
|
@@ -74,14 +76,11 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
74
76
|
const editRowsState = (0, _useGridSelector.useGridSelector)(apiRef, _gridEditingSelectors.gridEditRowsStateSelector);
|
|
75
77
|
const handleRef = (0, _utils.unstable_useForkRef)(ref, refProp);
|
|
76
78
|
const rowNode = apiRef.current.getRowNode(rowId);
|
|
77
|
-
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
78
|
-
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
79
79
|
const editing = apiRef.current.getRowMode(rowId) === _gridEditRowModel.GridRowModes.Edit;
|
|
80
80
|
const editable = rootProps.editMode === _gridEditRowModel.GridEditModes.Row;
|
|
81
|
-
const hasColumnVirtualization = (0, _useGridSelector.useGridSelector)(apiRef, _hooks.gridVirtualizationColumnEnabledSelector);
|
|
82
81
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
83
|
-
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex <
|
|
84
|
-
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >=
|
|
82
|
+
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < firstColumnIndex;
|
|
83
|
+
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= lastColumnIndex;
|
|
85
84
|
const classes = (0, _composeGridClasses.composeGridClasses)(rootProps.classes, {
|
|
86
85
|
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', showBottomBorder && 'row--borderBottom', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
87
86
|
});
|
|
@@ -197,14 +196,14 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
197
196
|
});
|
|
198
197
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
199
198
|
}
|
|
200
|
-
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition =
|
|
199
|
+
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = _constants.PinnedColumnPosition.NONE) => {
|
|
201
200
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
202
201
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
203
202
|
return null;
|
|
204
203
|
}
|
|
205
204
|
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
206
205
|
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
207
|
-
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(
|
|
206
|
+
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
|
|
208
207
|
if (rowNode?.type === 'skeletonRow') {
|
|
209
208
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
|
|
210
209
|
type: column.type,
|
|
@@ -223,7 +222,9 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
223
222
|
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
224
223
|
const canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
|
|
225
224
|
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
226
|
-
const cellIsNotVisible = pinnedPosition ===
|
|
225
|
+
const cellIsNotVisible = pinnedPosition === _constants.PinnedColumnPosition.VIRTUAL;
|
|
226
|
+
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, indexInSection);
|
|
227
|
+
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
227
228
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.cell, (0, _extends2.default)({
|
|
228
229
|
column: column,
|
|
229
230
|
width: width,
|
|
@@ -236,9 +237,8 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
236
237
|
isNotVisible: cellIsNotVisible,
|
|
237
238
|
pinnedOffset: pinnedOffset,
|
|
238
239
|
pinnedPosition: pinnedPosition,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
gridHasFiller: gridHasFiller
|
|
240
|
+
showLeftBorder: showLeftBorder,
|
|
241
|
+
showRightBorder: showRightBorder
|
|
242
242
|
}, slotProps?.cell), column.field);
|
|
243
243
|
};
|
|
244
244
|
|
|
@@ -249,25 +249,16 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
249
249
|
}
|
|
250
250
|
const leftCells = pinnedColumns.left.map((column, i) => {
|
|
251
251
|
const indexRelativeToAllColumns = i;
|
|
252
|
-
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.left.length,
|
|
252
|
+
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.left.length, _constants.PinnedColumnPosition.LEFT);
|
|
253
253
|
});
|
|
254
254
|
const rightCells = pinnedColumns.right.map((column, i) => {
|
|
255
255
|
const indexRelativeToAllColumns = visibleColumns.length - pinnedColumns.right.length + i;
|
|
256
|
-
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.right.length,
|
|
256
|
+
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.right.length, _constants.PinnedColumnPosition.RIGHT);
|
|
257
257
|
});
|
|
258
258
|
const middleColumnsLength = visibleColumns.length - pinnedColumns.left.length - pinnedColumns.right.length;
|
|
259
259
|
const cells = [];
|
|
260
260
|
if (hasVirtualFocusCellLeft) {
|
|
261
|
-
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength,
|
|
262
|
-
}
|
|
263
|
-
let firstColumnIndex;
|
|
264
|
-
let lastColumnIndex;
|
|
265
|
-
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
266
|
-
firstColumnIndex = 0;
|
|
267
|
-
lastColumnIndex = visibleColumns.length;
|
|
268
|
-
} else {
|
|
269
|
-
firstColumnIndex = renderContext.firstColumnIndex;
|
|
270
|
-
lastColumnIndex = renderContext.lastColumnIndex;
|
|
261
|
+
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, _constants.PinnedColumnPosition.VIRTUAL));
|
|
271
262
|
}
|
|
272
263
|
for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
|
|
273
264
|
const column = visibleColumns[i];
|
|
@@ -278,7 +269,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
278
269
|
cells.push(getCell(column, indexInSection, i, middleColumnsLength));
|
|
279
270
|
}
|
|
280
271
|
if (hasVirtualFocusCellRight) {
|
|
281
|
-
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength,
|
|
272
|
+
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, _constants.PinnedColumnPosition.VIRTUAL));
|
|
282
273
|
}
|
|
283
274
|
const eventHandlers = row ? {
|
|
284
275
|
onClick: publishClick,
|
|
@@ -315,48 +306,14 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
315
306
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
316
307
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
317
308
|
// ----------------------------------------------------------------------
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
columnsTotalWidth: _propTypes.default.number.isRequired,
|
|
321
|
-
contentSize: _propTypes.default.shape({
|
|
322
|
-
height: _propTypes.default.number.isRequired,
|
|
323
|
-
width: _propTypes.default.number.isRequired
|
|
324
|
-
}).isRequired,
|
|
325
|
-
groupHeaderHeight: _propTypes.default.number.isRequired,
|
|
326
|
-
hasScrollX: _propTypes.default.bool.isRequired,
|
|
327
|
-
hasScrollY: _propTypes.default.bool.isRequired,
|
|
328
|
-
headerFilterHeight: _propTypes.default.number.isRequired,
|
|
329
|
-
headerHeight: _propTypes.default.number.isRequired,
|
|
330
|
-
headersTotalHeight: _propTypes.default.number.isRequired,
|
|
331
|
-
isReady: _propTypes.default.bool.isRequired,
|
|
332
|
-
leftPinnedWidth: _propTypes.default.number.isRequired,
|
|
333
|
-
minimumSize: _propTypes.default.shape({
|
|
334
|
-
height: _propTypes.default.number.isRequired,
|
|
335
|
-
width: _propTypes.default.number.isRequired
|
|
336
|
-
}).isRequired,
|
|
337
|
-
rightPinnedWidth: _propTypes.default.number.isRequired,
|
|
338
|
-
root: _propTypes.default.shape({
|
|
339
|
-
height: _propTypes.default.number.isRequired,
|
|
340
|
-
width: _propTypes.default.number.isRequired
|
|
341
|
-
}).isRequired,
|
|
342
|
-
rowHeight: _propTypes.default.number.isRequired,
|
|
343
|
-
rowWidth: _propTypes.default.number.isRequired,
|
|
344
|
-
scrollbarSize: _propTypes.default.number.isRequired,
|
|
345
|
-
topContainerHeight: _propTypes.default.number.isRequired,
|
|
346
|
-
viewportInnerSize: _propTypes.default.shape({
|
|
347
|
-
height: _propTypes.default.number.isRequired,
|
|
348
|
-
width: _propTypes.default.number.isRequired
|
|
349
|
-
}).isRequired,
|
|
350
|
-
viewportOuterSize: _propTypes.default.shape({
|
|
351
|
-
height: _propTypes.default.number.isRequired,
|
|
352
|
-
width: _propTypes.default.number.isRequired
|
|
353
|
-
}).isRequired
|
|
354
|
-
}).isRequired,
|
|
309
|
+
columnsTotalWidth: _propTypes.default.number.isRequired,
|
|
310
|
+
firstColumnIndex: _propTypes.default.number.isRequired,
|
|
355
311
|
/**
|
|
356
312
|
* Determines which cell has focus.
|
|
357
313
|
* If `null`, no cell in this row has focus.
|
|
358
314
|
*/
|
|
359
315
|
focusedColumnIndex: _propTypes.default.number,
|
|
316
|
+
gridHasFiller: _propTypes.default.bool.isRequired,
|
|
360
317
|
/**
|
|
361
318
|
* Index of the row in the whole sorted and filtered dataset.
|
|
362
319
|
* If some rows above have expanded children, this index also take those children into account.
|
|
@@ -365,6 +322,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
365
322
|
isFirstVisible: _propTypes.default.bool.isRequired,
|
|
366
323
|
isLastVisible: _propTypes.default.bool.isRequired,
|
|
367
324
|
isNotVisible: _propTypes.default.bool.isRequired,
|
|
325
|
+
lastColumnIndex: _propTypes.default.number.isRequired,
|
|
368
326
|
offsetLeft: _propTypes.default.number.isRequired,
|
|
369
327
|
offsetTop: _propTypes.default.number,
|
|
370
328
|
onClick: _propTypes.default.func,
|
|
@@ -372,22 +330,12 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
372
330
|
onMouseEnter: _propTypes.default.func,
|
|
373
331
|
onMouseLeave: _propTypes.default.func,
|
|
374
332
|
pinnedColumns: _propTypes.default.object.isRequired,
|
|
375
|
-
renderContext: _propTypes.default.shape({
|
|
376
|
-
firstColumnIndex: _propTypes.default.number.isRequired,
|
|
377
|
-
firstRowIndex: _propTypes.default.number.isRequired,
|
|
378
|
-
lastColumnIndex: _propTypes.default.number.isRequired,
|
|
379
|
-
lastRowIndex: _propTypes.default.number.isRequired
|
|
380
|
-
}).isRequired,
|
|
381
333
|
row: _propTypes.default.object.isRequired,
|
|
382
334
|
rowHeight: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]).isRequired,
|
|
383
335
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
336
|
+
scrollbarWidth: _propTypes.default.number.isRequired,
|
|
384
337
|
selected: _propTypes.default.bool.isRequired,
|
|
385
338
|
showBottomBorder: _propTypes.default.bool.isRequired,
|
|
386
|
-
/**
|
|
387
|
-
* Determines which cell should be tabbable by having tabIndex=0.
|
|
388
|
-
* If `null`, no cell in this row is in the tab sequence.
|
|
389
|
-
*/
|
|
390
|
-
tabbableCell: _propTypes.default.string,
|
|
391
339
|
visibleColumns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired
|
|
392
340
|
} : void 0;
|
|
393
341
|
const MemoizedGridRow = exports.GridRow = (0, _fastMemo.fastMemo)(GridRow);
|
|
@@ -12,15 +12,19 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
12
12
|
var _system = require("@mui/system");
|
|
13
13
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
15
16
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
17
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
17
18
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
18
19
|
var _hooks = require("../hooks");
|
|
20
|
+
var _constants = require("../internals/constants");
|
|
19
21
|
var _gridClasses = require("../constants/gridClasses");
|
|
20
22
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
21
23
|
var _cellBorderUtils = require("../utils/cellBorderUtils");
|
|
22
24
|
var _domUtils = require("../utils/domUtils");
|
|
23
25
|
var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
26
|
+
var _rtlFlipSide = require("../utils/rtlFlipSide");
|
|
27
|
+
var _utils = require("../internals/utils");
|
|
24
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
29
|
const SkeletonOverlay = (0, _system.styled)('div', {
|
|
26
30
|
name: 'MuiDataGrid',
|
|
@@ -48,6 +52,7 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
48
52
|
const {
|
|
49
53
|
slots
|
|
50
54
|
} = rootProps;
|
|
55
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
51
56
|
const classes = useUtilityClasses({
|
|
52
57
|
classes: rootProps.classes
|
|
53
58
|
});
|
|
@@ -63,18 +68,12 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
63
68
|
const allVisibleColumns = (0, _hooks.useGridSelector)(apiRef, _hooks.gridVisibleColumnDefinitionsSelector);
|
|
64
69
|
const columns = React.useMemo(() => allVisibleColumns.slice(0, inViewportCount), [allVisibleColumns, inViewportCount]);
|
|
65
70
|
const pinnedColumns = (0, _hooks.useGridSelector)(apiRef, _hooks.gridVisiblePinnedColumnDefinitionsSelector);
|
|
66
|
-
const getPinnedStyle = React.useCallback((computedWidth, index, position) => {
|
|
67
|
-
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(position, computedWidth, index, positions, dimensions);
|
|
68
|
-
return {
|
|
69
|
-
[position]: pinnedOffset
|
|
70
|
-
};
|
|
71
|
-
}, [dimensions, positions]);
|
|
72
71
|
const getPinnedPosition = React.useCallback(field => {
|
|
73
72
|
if (pinnedColumns.left.findIndex(col => col.field === field) !== -1) {
|
|
74
|
-
return
|
|
73
|
+
return _constants.PinnedColumnPosition.LEFT;
|
|
75
74
|
}
|
|
76
75
|
if (pinnedColumns.right.findIndex(col => col.field === field) !== -1) {
|
|
77
|
-
return
|
|
76
|
+
return _constants.PinnedColumnPosition.RIGHT;
|
|
78
77
|
}
|
|
79
78
|
return undefined;
|
|
80
79
|
}, [pinnedColumns.left, pinnedColumns.right]);
|
|
@@ -85,13 +84,15 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
85
84
|
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
86
85
|
const column = columns[colIndex];
|
|
87
86
|
const pinnedPosition = getPinnedPosition(column.field);
|
|
88
|
-
const isPinnedLeft = pinnedPosition ===
|
|
89
|
-
const isPinnedRight = pinnedPosition ===
|
|
90
|
-
const
|
|
87
|
+
const isPinnedLeft = pinnedPosition === _constants.PinnedColumnPosition.LEFT;
|
|
88
|
+
const isPinnedRight = pinnedPosition === _constants.PinnedColumnPosition.RIGHT;
|
|
89
|
+
const pinnedSide = (0, _rtlFlipSide.rtlFlipSide)(pinnedPosition, isRtl);
|
|
90
|
+
const sectionLength = pinnedSide ? pinnedColumns[pinnedSide].length // pinned section
|
|
91
91
|
: columns.length - pinnedColumns.left.length - pinnedColumns.right.length; // middle section
|
|
92
|
-
const sectionIndex =
|
|
92
|
+
const sectionIndex = pinnedSide ? pinnedColumns[pinnedSide].findIndex(col => col.field === column.field) // pinned section
|
|
93
93
|
: colIndex - pinnedColumns.left.length; // middle section
|
|
94
|
-
const
|
|
94
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
95
|
+
const pinnedStyle = (0, _utils.attachPinnedStyle)({}, isRtl, pinnedPosition, (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, column.computedWidth, colIndex, positions, dimensions.columnsTotalWidth, scrollbarWidth));
|
|
95
96
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
96
97
|
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
97
98
|
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, sectionIndex);
|
|
@@ -105,7 +106,6 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
105
106
|
width: emptyCellWidth,
|
|
106
107
|
empty: true
|
|
107
108
|
}, `skeleton-filler-column-${i}`);
|
|
108
|
-
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
109
109
|
const hasScrollbarFiller = isLastColumn && scrollbarWidth !== 0;
|
|
110
110
|
if (hasFillerBefore) {
|
|
111
111
|
rowCells.push(emptyCell);
|
|
@@ -137,7 +137,7 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
137
137
|
}, `skeleton-row-${i}`));
|
|
138
138
|
}
|
|
139
139
|
return array;
|
|
140
|
-
}, [slots, columns, pinnedColumns, skeletonRowsCount, rootProps.showCellVerticalBorder, dimensions
|
|
140
|
+
}, [slots, columns, pinnedColumns, skeletonRowsCount, rootProps.showCellVerticalBorder, dimensions, positions, getPinnedPosition, isRtl]);
|
|
141
141
|
|
|
142
142
|
// Sync the column resize of the overlay columns with the grid
|
|
143
143
|
const handleColumnResize = params => {
|
|
@@ -151,8 +151,8 @@ const GridSkeletonLoadingOverlay = exports.GridSkeletonLoadingOverlay = (0, _for
|
|
|
151
151
|
}
|
|
152
152
|
const resizedColIndex = columns.findIndex(col => col.field === colDef.field);
|
|
153
153
|
const pinnedPosition = getPinnedPosition(colDef.field);
|
|
154
|
-
const isPinnedLeft = pinnedPosition ===
|
|
155
|
-
const isPinnedRight = pinnedPosition ===
|
|
154
|
+
const isPinnedLeft = pinnedPosition === _constants.PinnedColumnPosition.LEFT;
|
|
155
|
+
const isPinnedRight = pinnedPosition === _constants.PinnedColumnPosition.RIGHT;
|
|
156
156
|
const currentWidth = getComputedStyle(cells[0]).getPropertyValue('--width');
|
|
157
157
|
const delta = parseInt(currentWidth, 10) - width;
|
|
158
158
|
if (cells) {
|
|
@@ -14,7 +14,7 @@ var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
|
14
14
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
const _excluded = ["label", "icon", "showInMenu", "onClick"],
|
|
17
|
-
_excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
|
|
17
|
+
_excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"]; // FIXME(v8:romgrk): Make parametric
|
|
18
18
|
const GridActionsCellItem = exports.GridActionsCellItem = (0, _forwardRef.forwardRef)((props, ref) => {
|
|
19
19
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
20
20
|
if (!props.showInMenu) {
|
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.gridPinnedColumnPositionLookup = exports.
|
|
8
|
+
exports.gridPinnedColumnPositionLookup = exports.GridCell = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -22,24 +22,18 @@ var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
|
22
22
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
23
23
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
24
24
|
var _gridFocusStateSelector = require("../../hooks/features/focus/gridFocusStateSelector");
|
|
25
|
-
var _cellBorderUtils = require("../../utils/cellBorderUtils");
|
|
26
25
|
var _gridColumnsInterfaces = require("../../hooks/features/columns/gridColumnsInterfaces");
|
|
26
|
+
var _constants = require("../../internals/constants");
|
|
27
27
|
var _gridRowSpanningSelectors = require("../../hooks/features/rows/gridRowSpanningSelectors");
|
|
28
|
+
var _utils2 = require("../../internals/utils");
|
|
28
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
-
const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "
|
|
30
|
+
const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "showRightBorder", "showLeftBorder", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
30
31
|
_excluded2 = ["changeReason", "unstable_updateValueOnRender"];
|
|
31
|
-
let PinnedPosition = exports.PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
|
|
32
|
-
PinnedPosition[PinnedPosition["NONE"] = 0] = "NONE";
|
|
33
|
-
PinnedPosition[PinnedPosition["LEFT"] = 1] = "LEFT";
|
|
34
|
-
PinnedPosition[PinnedPosition["RIGHT"] = 2] = "RIGHT";
|
|
35
|
-
PinnedPosition[PinnedPosition["VIRTUAL"] = 3] = "VIRTUAL";
|
|
36
|
-
return PinnedPosition;
|
|
37
|
-
}({});
|
|
38
32
|
const gridPinnedColumnPositionLookup = exports.gridPinnedColumnPositionLookup = {
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
33
|
+
[_constants.PinnedColumnPosition.LEFT]: _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT,
|
|
34
|
+
[_constants.PinnedColumnPosition.RIGHT]: _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT,
|
|
35
|
+
[_constants.PinnedColumnPosition.NONE]: undefined,
|
|
36
|
+
[_constants.PinnedColumnPosition.VIRTUAL]: undefined
|
|
43
37
|
};
|
|
44
38
|
const EMPTY_CELL_PARAMS = {
|
|
45
39
|
id: -1,
|
|
@@ -77,7 +71,7 @@ const useUtilityClasses = ownerState => {
|
|
|
77
71
|
classes
|
|
78
72
|
} = ownerState;
|
|
79
73
|
const slots = {
|
|
80
|
-
root: ['cell', `cell--text${(0, _utils.unstable_capitalize)(align)}`, isSelected && 'selected', isEditable && 'cell--editable', showLeftBorder && 'cell--withLeftBorder', showRightBorder && 'cell--withRightBorder', pinnedPosition ===
|
|
74
|
+
root: ['cell', `cell--text${(0, _utils.unstable_capitalize)(align)}`, isSelected && 'selected', isEditable && 'cell--editable', showLeftBorder && 'cell--withLeftBorder', showRightBorder && 'cell--withRightBorder', pinnedPosition === _constants.PinnedColumnPosition.LEFT && 'cell--pinnedLeft', pinnedPosition === _constants.PinnedColumnPosition.RIGHT && 'cell--pinnedRight', isSelectionMode && !isEditable && 'cell--selectionMode']
|
|
81
75
|
};
|
|
82
76
|
return (0, _utils.unstable_composeClasses)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
83
77
|
};
|
|
@@ -100,9 +94,8 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
100
94
|
isNotVisible,
|
|
101
95
|
pinnedOffset,
|
|
102
96
|
pinnedPosition,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
gridHasFiller,
|
|
97
|
+
showRightBorder,
|
|
98
|
+
showLeftBorder,
|
|
106
99
|
onClick,
|
|
107
100
|
onDoubleClick,
|
|
108
101
|
onMouseDown,
|
|
@@ -169,9 +162,6 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
169
162
|
const handleRef = (0, _utils.unstable_useForkRef)(ref, cellRef);
|
|
170
163
|
const focusElementRef = React.useRef(null);
|
|
171
164
|
const isSelectionMode = rootProps.cellSelection ?? false;
|
|
172
|
-
const position = gridPinnedColumnPositionLookup[pinnedPosition];
|
|
173
|
-
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(position, sectionIndex);
|
|
174
|
-
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
175
165
|
const ownerState = {
|
|
176
166
|
align,
|
|
177
167
|
showLeftBorder,
|
|
@@ -220,18 +210,11 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
220
210
|
border: 0
|
|
221
211
|
};
|
|
222
212
|
}
|
|
223
|
-
const cellStyle = (0, _extends2.default)({
|
|
213
|
+
const cellStyle = (0, _utils2.attachPinnedStyle)((0, _extends2.default)({
|
|
224
214
|
'--width': `${width}px`
|
|
225
|
-
}, styleProp);
|
|
226
|
-
const isLeftPinned = pinnedPosition ===
|
|
227
|
-
const isRightPinned = pinnedPosition ===
|
|
228
|
-
if (isLeftPinned || isRightPinned) {
|
|
229
|
-
let side = isLeftPinned ? 'left' : 'right';
|
|
230
|
-
if (isRtl) {
|
|
231
|
-
side = isLeftPinned ? 'right' : 'left';
|
|
232
|
-
}
|
|
233
|
-
cellStyle[side] = pinnedOffset;
|
|
234
|
-
}
|
|
215
|
+
}, styleProp), isRtl, pinnedPosition, pinnedOffset);
|
|
216
|
+
const isLeftPinned = pinnedPosition === _constants.PinnedColumnPosition.LEFT;
|
|
217
|
+
const isRightPinned = pinnedPosition === _constants.PinnedColumnPosition.RIGHT;
|
|
235
218
|
if (rowSpan > 1) {
|
|
236
219
|
cellStyle.height = `calc(var(--height) * ${rowSpan})`;
|
|
237
220
|
cellStyle.zIndex = 5;
|
|
@@ -361,13 +344,12 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
361
344
|
isValidating: _propTypes.default.bool,
|
|
362
345
|
value: _propTypes.default.any
|
|
363
346
|
}),
|
|
364
|
-
gridHasFiller: _propTypes.default.bool.isRequired,
|
|
365
347
|
isNotVisible: _propTypes.default.bool.isRequired,
|
|
366
|
-
pinnedOffset: _propTypes.default.number
|
|
348
|
+
pinnedOffset: _propTypes.default.number,
|
|
367
349
|
pinnedPosition: _propTypes.default.oneOf([0, 1, 2, 3]).isRequired,
|
|
368
350
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
369
|
-
|
|
370
|
-
|
|
351
|
+
showLeftBorder: _propTypes.default.bool.isRequired,
|
|
352
|
+
showRightBorder: _propTypes.default.bool.isRequired,
|
|
371
353
|
width: _propTypes.default.number.isRequired
|
|
372
354
|
} : void 0;
|
|
373
355
|
const MemoizedGridCell = exports.GridCell = (0, _fastMemo.fastMemo)(GridCell);
|
|
@@ -44,7 +44,7 @@ function GridEditDateCell(props) {
|
|
|
44
44
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
45
45
|
const isDateTime = colDef.type === 'dateTime';
|
|
46
46
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
47
|
-
const inputRef = React.useRef();
|
|
47
|
+
const inputRef = React.useRef(null);
|
|
48
48
|
const valueTransformed = React.useMemo(() => {
|
|
49
49
|
let parsedDate;
|
|
50
50
|
if (valueProp == null) {
|
|
@@ -55,7 +55,7 @@ const GridEditInputCell = exports.GridEditInputCell = (0, _forwardRef.forwardRef
|
|
|
55
55
|
} = props,
|
|
56
56
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
57
57
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
58
|
-
const inputRef = React.useRef();
|
|
58
|
+
const inputRef = React.useRef(null);
|
|
59
59
|
const [valueState, setValueState] = React.useState(value);
|
|
60
60
|
const classes = useUtilityClasses(rootProps);
|
|
61
61
|
const handleChange = React.useCallback(async event => {
|
|
@@ -39,8 +39,8 @@ function GridEditSingleSelectCell(props) {
|
|
|
39
39
|
} = props,
|
|
40
40
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
41
41
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
42
|
-
const ref = React.useRef();
|
|
43
|
-
const inputRef = React.useRef();
|
|
42
|
+
const ref = React.useRef(null);
|
|
43
|
+
const inputRef = React.useRef(null);
|
|
44
44
|
const [open, setOpen] = React.useState(initialOpen);
|
|
45
45
|
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
46
46
|
const isSelectNative = baseSelectProps.native ?? false;
|
|
@@ -9,6 +9,7 @@ exports.GridColumnGroupHeader = GridColumnGroupHeader;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _utils = require("@mui/utils");
|
|
12
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
12
13
|
var _gridClasses = require("../../constants/gridClasses");
|
|
13
14
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
14
15
|
var _gridColumnGroupsSelector = require("../../hooks/features/columnGrouping/gridColumnGroupsSelector");
|
|
@@ -16,7 +17,8 @@ var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
|
16
17
|
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
17
18
|
var _GridGenericColumnHeaderItem = require("./GridGenericColumnHeaderItem");
|
|
18
19
|
var _domUtils = require("../../utils/domUtils");
|
|
19
|
-
var
|
|
20
|
+
var _constants = require("../../internals/constants");
|
|
21
|
+
var _utils2 = require("../../internals/utils");
|
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
23
|
const useUtilityClasses = ownerState => {
|
|
22
24
|
const {
|
|
@@ -30,7 +32,7 @@ const useUtilityClasses = ownerState => {
|
|
|
30
32
|
pinnedPosition
|
|
31
33
|
} = ownerState;
|
|
32
34
|
const slots = {
|
|
33
|
-
root: ['columnHeader', headerAlign === 'left' && 'columnHeader--alignLeft', headerAlign === 'center' && 'columnHeader--alignCenter', headerAlign === 'right' && 'columnHeader--alignRight', isDragging && 'columnHeader--moving', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', 'withBorderColor', groupId === null ? 'columnHeader--emptyGroup' : 'columnHeader--filledGroup', pinnedPosition ===
|
|
35
|
+
root: ['columnHeader', headerAlign === 'left' && 'columnHeader--alignLeft', headerAlign === 'center' && 'columnHeader--alignCenter', headerAlign === 'right' && 'columnHeader--alignRight', isDragging && 'columnHeader--moving', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', 'withBorderColor', groupId === null ? 'columnHeader--emptyGroup' : 'columnHeader--filledGroup', pinnedPosition === _constants.PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === _constants.PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight', isLastColumn && 'columnHeader--last'],
|
|
34
36
|
draggableContainer: ['columnHeaderDraggableContainer'],
|
|
35
37
|
titleContainer: ['columnHeaderTitleContainer', 'withBorderColor'],
|
|
36
38
|
titleContainerContent: ['columnHeaderTitleContainerContent']
|
|
@@ -50,12 +52,10 @@ function GridColumnGroupHeader(props) {
|
|
|
50
52
|
tabIndex,
|
|
51
53
|
isLastColumn,
|
|
52
54
|
pinnedPosition,
|
|
53
|
-
|
|
54
|
-
indexInSection,
|
|
55
|
-
sectionLength,
|
|
56
|
-
gridHasFiller
|
|
55
|
+
pinnedOffset
|
|
57
56
|
} = props;
|
|
58
57
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
58
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
59
59
|
const headerCellRef = React.useRef(null);
|
|
60
60
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
61
61
|
const columnGroupsLookup = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnGroupsSelector.gridColumnGroupsLookupSelector);
|
|
@@ -80,12 +80,8 @@ function GridColumnGroupHeader(props) {
|
|
|
80
80
|
if (groupId && render) {
|
|
81
81
|
headerComponent = render(renderParams);
|
|
82
82
|
}
|
|
83
|
-
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, indexInSection);
|
|
84
|
-
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, indexInSection, sectionLength, rootProps.showColumnVerticalBorder, gridHasFiller);
|
|
85
83
|
const ownerState = (0, _extends2.default)({}, props, {
|
|
86
84
|
classes: rootProps.classes,
|
|
87
|
-
showLeftBorder,
|
|
88
|
-
showRightBorder,
|
|
89
85
|
headerAlign,
|
|
90
86
|
depth,
|
|
91
87
|
isDragging: false
|
|
@@ -118,6 +114,7 @@ function GridColumnGroupHeader(props) {
|
|
|
118
114
|
onBlur: publish('columnGroupHeaderBlur')
|
|
119
115
|
}), [publish]);
|
|
120
116
|
const headerClassName = typeof group.headerClassName === 'function' ? group.headerClassName(renderParams) : group.headerClassName;
|
|
117
|
+
const style = React.useMemo(() => (0, _utils2.attachPinnedStyle)((0, _extends2.default)({}, props.style), isRtl, pinnedPosition, pinnedOffset), [pinnedPosition, pinnedOffset, props.style, isRtl]);
|
|
121
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridGenericColumnHeaderItem.GridGenericColumnHeaderItem, (0, _extends2.default)({
|
|
122
119
|
ref: headerCellRef,
|
|
123
120
|
classes: classes,
|
|
@@ -65,7 +65,6 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
65
65
|
const iconButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, (0, _extends2.default)({
|
|
66
66
|
id: labelId,
|
|
67
67
|
onClick: toggleFilter,
|
|
68
|
-
color: "default",
|
|
69
68
|
"aria-label": apiRef.current.getLocaleText('columnHeaderFiltersLabel'),
|
|
70
69
|
size: "small",
|
|
71
70
|
tabIndex: -1,
|
|
@@ -12,6 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
14
|
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
15
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
15
16
|
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
16
17
|
var _ColumnHeaderMenuIcon = require("./ColumnHeaderMenuIcon");
|
|
17
18
|
var _GridColumnHeaderMenu = require("../menu/columnMenu/GridColumnHeaderMenu");
|
|
@@ -19,7 +20,8 @@ var _gridClasses = require("../../constants/gridClasses");
|
|
|
19
20
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
20
21
|
var _GridGenericColumnHeaderItem = require("./GridGenericColumnHeaderItem");
|
|
21
22
|
var _domUtils = require("../../utils/domUtils");
|
|
22
|
-
var
|
|
23
|
+
var _constants = require("../../internals/constants");
|
|
24
|
+
var _utils2 = require("../../internals/utils");
|
|
23
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
26
|
const useUtilityClasses = ownerState => {
|
|
25
27
|
const {
|
|
@@ -39,7 +41,7 @@ const useUtilityClasses = ownerState => {
|
|
|
39
41
|
// todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
|
|
40
42
|
const isColumnNumeric = colDef.type === 'number';
|
|
41
43
|
const slots = {
|
|
42
|
-
root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', colDef.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition ===
|
|
44
|
+
root: ['columnHeader', colDef.headerAlign === 'left' && 'columnHeader--alignLeft', colDef.headerAlign === 'center' && 'columnHeader--alignCenter', colDef.headerAlign === 'right' && 'columnHeader--alignRight', colDef.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', 'withBorderColor', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', pinnedPosition === _constants.PinnedColumnPosition.LEFT && 'columnHeader--pinnedLeft', pinnedPosition === _constants.PinnedColumnPosition.RIGHT && 'columnHeader--pinnedRight',
|
|
43
45
|
// TODO: Remove classes below and restore `:has` selectors when they are supported in jsdom
|
|
44
46
|
// See https://github.com/mui/mui-x/pull/14559
|
|
45
47
|
isLastUnpinned && 'columnHeader--lastUnpinned', isSiblingFocused && 'columnHeader--siblingFocused'],
|
|
@@ -64,14 +66,14 @@ function GridColumnHeaderItem(props) {
|
|
|
64
66
|
tabIndex,
|
|
65
67
|
disableReorder,
|
|
66
68
|
separatorSide,
|
|
67
|
-
|
|
69
|
+
showLeftBorder,
|
|
70
|
+
showRightBorder,
|
|
68
71
|
pinnedPosition,
|
|
69
|
-
|
|
70
|
-
sectionLength,
|
|
71
|
-
gridHasFiller
|
|
72
|
+
pinnedOffset
|
|
72
73
|
} = props;
|
|
73
74
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
74
75
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
76
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
75
77
|
const headerCellRef = React.useRef(null);
|
|
76
78
|
const columnMenuId = (0, _utils.unstable_useId)();
|
|
77
79
|
const columnMenuButtonId = (0, _utils.unstable_useId)();
|
|
@@ -82,8 +84,6 @@ function GridColumnHeaderItem(props) {
|
|
|
82
84
|
if (colDef.renderHeader) {
|
|
83
85
|
headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
|
|
84
86
|
}
|
|
85
|
-
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, indexInSection);
|
|
86
|
-
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, indexInSection, sectionLength, rootProps.showColumnVerticalBorder, gridHasFiller);
|
|
87
87
|
const ownerState = (0, _extends2.default)({}, props, {
|
|
88
88
|
classes: rootProps.classes,
|
|
89
89
|
showRightBorder,
|
|
@@ -179,6 +179,7 @@ function GridColumnHeaderItem(props) {
|
|
|
179
179
|
colDef
|
|
180
180
|
}) : colDef.headerClassName;
|
|
181
181
|
const label = colDef.headerName ?? colDef.field;
|
|
182
|
+
const style = React.useMemo(() => (0, _utils2.attachPinnedStyle)((0, _extends2.default)({}, props.style), isRtl, pinnedPosition, pinnedOffset), [pinnedPosition, pinnedOffset, props.style, isRtl]);
|
|
182
183
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridGenericColumnHeaderItem.GridGenericColumnHeaderItem, (0, _extends2.default)({
|
|
183
184
|
ref: headerCellRef,
|
|
184
185
|
classes: classes,
|
|
@@ -217,18 +218,18 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
|
|
|
217
218
|
columnMenuOpen: _propTypes.default.bool.isRequired,
|
|
218
219
|
disableReorder: _propTypes.default.bool,
|
|
219
220
|
filterItemsCounter: _propTypes.default.number,
|
|
220
|
-
gridHasFiller: _propTypes.default.bool.isRequired,
|
|
221
221
|
hasFocus: _propTypes.default.bool,
|
|
222
222
|
headerHeight: _propTypes.default.number.isRequired,
|
|
223
|
-
indexInSection: _propTypes.default.number.isRequired,
|
|
224
223
|
isDragging: _propTypes.default.bool.isRequired,
|
|
225
224
|
isLast: _propTypes.default.bool.isRequired,
|
|
226
225
|
isLastUnpinned: _propTypes.default.bool.isRequired,
|
|
227
226
|
isResizing: _propTypes.default.bool.isRequired,
|
|
228
227
|
isSiblingFocused: _propTypes.default.bool.isRequired,
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
pinnedOffset: _propTypes.default.number,
|
|
229
|
+
pinnedPosition: _propTypes.default.oneOf([0, 1, 2, 3]),
|
|
231
230
|
separatorSide: _propTypes.default.oneOf(['left', 'right']),
|
|
231
|
+
showLeftBorder: _propTypes.default.bool.isRequired,
|
|
232
|
+
showRightBorder: _propTypes.default.bool.isRequired,
|
|
232
233
|
sortDirection: _propTypes.default.oneOf(['asc', 'desc']),
|
|
233
234
|
sortIndex: _propTypes.default.number,
|
|
234
235
|
style: _propTypes.default.object,
|