@mui/x-data-grid 7.0.0-alpha.8 → 7.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 +379 -2
- package/DataGrid/DataGrid.js +6 -6
- package/DataGrid/useDataGridComponent.js +2 -1
- package/DataGrid/useDataGridProps.js +1 -0
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +3 -2
- package/components/GridColumnHeaders.js +3 -11
- package/components/GridDetailPanels.d.ts +5 -0
- package/components/GridDetailPanels.js +4 -0
- package/components/GridHeaders.d.ts +4 -0
- package/components/GridHeaders.js +53 -0
- package/components/GridPinnedRows.d.ts +7 -0
- package/components/GridPinnedRows.js +4 -0
- package/components/GridRow.d.ts +7 -4
- package/components/GridRow.js +260 -97
- package/components/GridScrollbarFillerCell.d.ts +7 -0
- package/components/GridScrollbarFillerCell.js +39 -0
- package/components/base/GridBody.d.ts +2 -13
- package/components/base/GridBody.js +2 -116
- package/components/base/GridOverlays.js +10 -21
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridCell.d.ts +15 -21
- package/components/cell/GridCell.js +67 -372
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +2 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +7 -3
- package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -0
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
- package/components/columnHeaders/GridColumnHeadersInner.js +1 -2
- package/components/containers/GridRoot.js +18 -15
- package/components/containers/GridRootStyles.js +307 -204
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/components/panel/GridPanel.js +3 -4
- package/components/panel/filterPanel/GridFilterForm.d.ts +6 -4
- package/components/panel/filterPanel/GridFilterForm.js +31 -14
- package/components/panel/filterPanel/GridFilterPanel.js +46 -20
- package/components/toolbar/GridToolbarColumnsButton.d.ts +13 -1
- package/components/toolbar/GridToolbarColumnsButton.js +40 -22
- package/components/toolbar/GridToolbarDensitySelector.d.ts +13 -1
- package/components/toolbar/GridToolbarDensitySelector.js +40 -22
- package/components/toolbar/GridToolbarExport.d.ts +10 -1
- package/components/toolbar/GridToolbarExport.js +6 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +15 -1
- package/components/toolbar/GridToolbarExportContainer.js +41 -23
- package/components/toolbar/GridToolbarFilterButton.d.ts +5 -4
- package/components/toolbar/GridToolbarFilterButton.js +6 -10
- package/components/virtualization/GridBottomContainer.d.ts +2 -0
- package/components/virtualization/GridBottomContainer.js +25 -0
- package/components/{containers → virtualization}/GridMainContainer.d.ts +2 -0
- package/components/virtualization/GridMainContainer.js +20 -0
- package/components/virtualization/GridTopContainer.d.ts +2 -0
- package/components/virtualization/GridTopContainer.js +35 -0
- package/components/virtualization/GridVirtualScrollbar.d.ts +7 -0
- package/components/virtualization/GridVirtualScrollbar.js +131 -0
- package/components/virtualization/GridVirtualScroller.d.ts +4 -4
- package/components/virtualization/GridVirtualScroller.js +69 -16
- package/components/virtualization/GridVirtualScrollerFiller.d.ts +4 -0
- package/components/virtualization/GridVirtualScrollerFiller.js +71 -0
- package/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
- package/constants/defaultGridSlotsComponents.js +6 -2
- package/constants/gridClasses.d.ts +60 -8
- package/constants/gridClasses.js +1 -1
- package/hooks/core/gridCoreSelector.d.ts +6 -0
- package/hooks/core/gridCoreSelector.js +5 -0
- package/hooks/core/useGridInitialization.js +4 -0
- package/hooks/core/useGridRefs.d.ts +3 -0
- package/hooks/core/useGridRefs.js +13 -0
- package/hooks/core/useGridTheme.d.ts +3 -0
- package/hooks/core/useGridTheme.js +19 -0
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +7 -14
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +13 -18
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +68 -162
- package/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +17 -0
- package/hooks/features/columns/gridColumnsInterfaces.js +9 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +14 -1
- package/hooks/features/columns/gridColumnsSelector.js +52 -0
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -5
- package/hooks/features/columns/gridColumnsUtils.js +10 -12
- package/hooks/features/columns/index.d.ts +2 -2
- package/hooks/features/columns/index.js +2 -1
- package/hooks/features/columns/useGridColumnSpanning.js +62 -61
- package/hooks/features/columns/useGridColumns.js +20 -23
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +60 -11
- package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +2 -0
- package/hooks/features/dimensions/gridDimensionsSelectors.js +1 -0
- package/hooks/features/dimensions/index.d.ts +2 -0
- package/hooks/features/dimensions/index.js +1 -0
- package/hooks/features/dimensions/useGridDimensions.d.ts +7 -1
- package/hooks/features/dimensions/useGridDimensions.js +216 -148
- package/hooks/features/export/serializers/csvSerializer.js +2 -2
- package/hooks/features/filter/useGridFilter.js +3 -3
- package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -2
- package/hooks/features/focus/gridFocusStateSelector.js +2 -6
- package/hooks/features/focus/useGridFocus.js +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +3 -16
- package/hooks/features/pagination/useGridPagination.js +3 -5
- package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -0
- package/hooks/features/rows/gridRowsSelector.d.ts +2 -2
- package/hooks/features/rows/gridRowsSelector.js +5 -5
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +4 -4
- package/hooks/features/rows/useGridRowsMeta.js +7 -4
- package/hooks/features/scroll/useGridScroll.js +8 -10
- package/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.js +15 -10
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +14 -0
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +22 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +27 -42
- package/hooks/features/virtualization/useGridVirtualScroller.js +441 -438
- package/hooks/features/virtualization/useGridVirtualization.d.ts +8 -0
- package/hooks/features/virtualization/useGridVirtualization.js +8 -1
- package/hooks/utils/index.d.ts +3 -0
- package/hooks/utils/index.js +4 -1
- package/hooks/utils/useGridAriaAttributes.js +1 -2
- package/hooks/utils/useGridNativeEventListener.js +4 -9
- package/hooks/utils/useResizeObserver.d.ts +2 -0
- package/hooks/utils/useResizeObserver.js +36 -0
- package/hooks/utils/useRunOnce.d.ts +5 -0
- package/hooks/utils/useRunOnce.js +18 -0
- package/index.js +1 -1
- package/internals/index.d.ts +12 -9
- package/internals/index.js +9 -7
- package/legacy/DataGrid/DataGrid.js +6 -6
- package/legacy/DataGrid/useDataGridComponent.js +2 -1
- package/legacy/DataGrid/useDataGridProps.js +1 -0
- package/legacy/components/GridColumnHeaders.js +3 -11
- package/legacy/components/GridDetailPanels.js +4 -0
- package/legacy/components/GridHeaders.js +53 -0
- package/legacy/components/GridPinnedRows.js +4 -0
- package/legacy/components/GridRow.js +258 -98
- package/legacy/components/GridScrollbarFillerCell.js +36 -0
- package/legacy/components/base/GridBody.js +2 -114
- package/legacy/components/base/GridOverlays.js +10 -25
- package/legacy/components/cell/GridCell.js +69 -377
- package/legacy/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +7 -3
- package/legacy/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
- package/legacy/components/columnHeaders/GridColumnHeadersInner.js +1 -2
- package/legacy/components/containers/GridRoot.js +18 -15
- package/legacy/components/containers/GridRootStyles.js +215 -137
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/legacy/components/panel/GridPanel.js +3 -4
- package/legacy/components/panel/filterPanel/GridFilterForm.js +30 -13
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +49 -20
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +40 -21
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +40 -21
- package/legacy/components/toolbar/GridToolbarExport.js +6 -1
- package/legacy/components/toolbar/GridToolbarExportContainer.js +40 -21
- package/legacy/components/toolbar/GridToolbarFilterButton.js +6 -10
- package/legacy/components/virtualization/GridBottomContainer.js +25 -0
- package/legacy/components/virtualization/GridMainContainer.js +20 -0
- package/legacy/components/virtualization/GridTopContainer.js +35 -0
- package/legacy/components/virtualization/GridVirtualScrollbar.js +129 -0
- package/legacy/components/virtualization/GridVirtualScroller.js +67 -16
- package/legacy/components/virtualization/GridVirtualScrollerFiller.js +70 -0
- package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
- package/legacy/constants/defaultGridSlotsComponents.js +6 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/core/gridCoreSelector.js +7 -0
- package/legacy/hooks/core/useGridInitialization.js +4 -0
- package/legacy/hooks/core/useGridRefs.js +13 -0
- package/legacy/hooks/core/useGridTheme.js +21 -0
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +7 -14
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +69 -181
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
- package/legacy/hooks/features/columns/gridColumnsInterfaces.js +9 -1
- package/legacy/hooks/features/columns/gridColumnsSelector.js +62 -0
- package/legacy/hooks/features/columns/gridColumnsUtils.js +10 -16
- package/legacy/hooks/features/columns/index.js +2 -1
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +60 -59
- package/legacy/hooks/features/columns/useGridColumns.js +22 -23
- package/legacy/hooks/features/dimensions/gridDimensionsSelectors.js +3 -0
- package/legacy/hooks/features/dimensions/index.js +1 -0
- package/legacy/hooks/features/dimensions/useGridDimensions.js +226 -151
- package/legacy/hooks/features/export/serializers/csvSerializer.js +2 -2
- package/legacy/hooks/features/filter/useGridFilter.js +3 -3
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +2 -6
- package/legacy/hooks/features/focus/useGridFocus.js +3 -3
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +3 -16
- package/legacy/hooks/features/pagination/useGridPagination.js +3 -5
- package/legacy/hooks/features/rows/gridRowsSelector.js +5 -5
- package/legacy/hooks/features/rows/gridRowsUtils.js +4 -4
- package/legacy/hooks/features/rows/useGridRowsMeta.js +7 -4
- package/legacy/hooks/features/scroll/useGridScroll.js +8 -10
- package/legacy/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/legacy/hooks/features/sorting/useGridSorting.js +15 -10
- package/legacy/hooks/features/virtualization/gridVirtualizationSelectors.js +29 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +490 -483
- package/legacy/hooks/features/virtualization/useGridVirtualization.js +8 -1
- package/legacy/hooks/utils/index.js +4 -1
- package/legacy/hooks/utils/useGridAriaAttributes.js +1 -2
- package/legacy/hooks/utils/useGridNativeEventListener.js +4 -9
- package/legacy/hooks/utils/useResizeObserver.js +36 -0
- package/legacy/hooks/utils/useRunOnce.js +18 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +9 -7
- package/legacy/locales/hrHR.js +161 -0
- package/legacy/locales/index.js +4 -1
- package/legacy/locales/ptPT.js +161 -0
- package/legacy/locales/zhHK.js +161 -0
- package/legacy/models/index.js +0 -1
- package/legacy/models/params/index.js +1 -2
- package/legacy/utils/utils.js +10 -1
- package/locales/hrHR.d.ts +1 -0
- package/locales/hrHR.js +149 -0
- package/locales/index.d.ts +3 -0
- package/locales/index.js +4 -1
- package/locales/ptPT.d.ts +1 -0
- package/locales/ptPT.js +149 -0
- package/locales/zhHK.d.ts +1 -0
- package/locales/zhHK.js +149 -0
- package/models/api/gridColumnGroupingApi.d.ts +2 -2
- package/models/api/gridCoreApi.d.ts +16 -16
- package/models/api/gridRowsMetaApi.d.ts +1 -1
- package/models/api/gridVirtualizationApi.d.ts +2 -3
- package/models/events/gridEventLookup.d.ts +3 -3
- package/models/gridFilterModel.d.ts +1 -1
- package/models/gridSlotsComponent.d.ts +16 -2
- package/models/gridStateCommunity.d.ts +5 -1
- package/models/index.d.ts +0 -1
- package/models/index.js +0 -1
- package/models/params/index.d.ts +0 -1
- package/models/params/index.js +1 -2
- package/models/props/DataGridProps.d.ts +6 -11
- package/modern/DataGrid/DataGrid.js +6 -6
- package/modern/DataGrid/useDataGridComponent.js +2 -1
- package/modern/DataGrid/useDataGridProps.js +1 -0
- package/modern/components/GridColumnHeaders.js +3 -11
- package/modern/components/GridDetailPanels.js +4 -0
- package/modern/components/GridHeaders.js +53 -0
- package/modern/components/GridPinnedRows.js +4 -0
- package/modern/components/GridRow.js +258 -96
- package/modern/components/GridScrollbarFillerCell.js +39 -0
- package/modern/components/base/GridBody.js +2 -116
- package/modern/components/base/GridOverlays.js +10 -16
- package/modern/components/cell/GridCell.js +65 -369
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +7 -3
- package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +1 -1
- package/modern/components/containers/GridRoot.js +18 -14
- package/modern/components/containers/GridRootStyles.js +307 -204
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/modern/components/panel/GridPanel.js +3 -4
- package/modern/components/panel/filterPanel/GridFilterForm.js +30 -13
- package/modern/components/panel/filterPanel/GridFilterPanel.js +46 -20
- package/modern/components/toolbar/GridToolbarColumnsButton.js +38 -21
- package/modern/components/toolbar/GridToolbarDensitySelector.js +38 -21
- package/modern/components/toolbar/GridToolbarExport.js +6 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +39 -22
- package/modern/components/toolbar/GridToolbarFilterButton.js +6 -10
- package/modern/components/virtualization/GridBottomContainer.js +25 -0
- package/modern/components/virtualization/GridMainContainer.js +20 -0
- package/modern/components/virtualization/GridTopContainer.js +35 -0
- package/modern/components/virtualization/GridVirtualScrollbar.js +131 -0
- package/modern/components/virtualization/GridVirtualScroller.js +69 -16
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +71 -0
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
- package/modern/constants/defaultGridSlotsComponents.js +6 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/core/gridCoreSelector.js +5 -0
- package/modern/hooks/core/useGridInitialization.js +4 -0
- package/modern/hooks/core/useGridRefs.js +13 -0
- package/modern/hooks/core/useGridTheme.js +19 -0
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +5 -12
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +67 -160
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
- package/modern/hooks/features/columns/gridColumnsInterfaces.js +9 -1
- package/modern/hooks/features/columns/gridColumnsSelector.js +51 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +10 -12
- package/modern/hooks/features/columns/index.js +2 -1
- package/modern/hooks/features/columns/useGridColumnSpanning.js +62 -61
- package/modern/hooks/features/columns/useGridColumns.js +19 -21
- package/modern/hooks/features/dimensions/gridDimensionsSelectors.js +1 -0
- package/modern/hooks/features/dimensions/index.js +1 -0
- package/modern/hooks/features/dimensions/useGridDimensions.js +214 -146
- package/modern/hooks/features/export/serializers/csvSerializer.js +2 -2
- package/modern/hooks/features/filter/useGridFilter.js +3 -3
- package/modern/hooks/features/focus/gridFocusStateSelector.js +2 -6
- package/modern/hooks/features/focus/useGridFocus.js +3 -3
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +3 -16
- package/modern/hooks/features/pagination/useGridPagination.js +3 -5
- package/modern/hooks/features/rows/gridRowsSelector.js +2 -2
- package/modern/hooks/features/rows/gridRowsUtils.js +4 -4
- package/modern/hooks/features/rows/useGridRowsMeta.js +7 -4
- package/modern/hooks/features/scroll/useGridScroll.js +8 -9
- package/modern/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +15 -10
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +22 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +435 -432
- package/modern/hooks/features/virtualization/useGridVirtualization.js +8 -1
- package/modern/hooks/utils/index.js +4 -1
- package/modern/hooks/utils/useGridAriaAttributes.js +1 -1
- package/modern/hooks/utils/useGridNativeEventListener.js +3 -9
- package/modern/hooks/utils/useResizeObserver.js +36 -0
- package/modern/hooks/utils/useRunOnce.js +18 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +9 -7
- package/modern/locales/hrHR.js +149 -0
- package/modern/locales/index.js +4 -1
- package/modern/locales/ptPT.js +149 -0
- package/modern/locales/zhHK.js +149 -0
- package/modern/models/index.js +0 -1
- package/modern/models/params/index.js +1 -2
- package/modern/utils/utils.js +10 -1
- package/node/DataGrid/DataGrid.js +6 -6
- package/node/DataGrid/useDataGridComponent.js +1 -0
- package/node/DataGrid/useDataGridProps.js +1 -0
- package/node/components/GridColumnHeaders.js +3 -11
- package/node/components/GridDetailPanels.js +10 -0
- package/node/components/GridHeaders.js +60 -0
- package/node/components/GridPinnedRows.js +10 -0
- package/node/components/GridRow.js +256 -94
- package/node/components/GridScrollbarFillerCell.js +47 -0
- package/node/components/base/GridBody.js +7 -118
- package/node/components/base/GridOverlays.js +9 -15
- package/node/components/cell/GridCell.js +66 -369
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -6
- package/node/components/columnHeaders/GridColumnHeaderItem.js +8 -4
- package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +5 -2
- package/node/components/columnHeaders/GridColumnHeadersInner.js +1 -1
- package/node/components/containers/GridRoot.js +17 -14
- package/node/components/containers/GridRootStyles.js +175 -72
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +1 -1
- package/node/components/panel/GridPanel.js +3 -4
- package/node/components/panel/filterPanel/GridFilterForm.js +29 -12
- package/node/components/panel/filterPanel/GridFilterPanel.js +45 -19
- package/node/components/toolbar/GridToolbarColumnsButton.js +36 -20
- package/node/components/toolbar/GridToolbarDensitySelector.js +36 -20
- package/node/components/toolbar/GridToolbarExport.js +6 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +37 -21
- package/node/components/toolbar/GridToolbarFilterButton.js +6 -10
- package/node/components/virtualization/GridBottomContainer.js +34 -0
- package/node/components/{containers → virtualization}/GridMainContainer.js +7 -29
- package/node/components/virtualization/GridTopContainer.js +44 -0
- package/node/components/virtualization/GridVirtualScrollbar.js +138 -0
- package/node/components/virtualization/GridVirtualScroller.js +69 -17
- package/node/components/virtualization/GridVirtualScrollerFiller.js +77 -0
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +2 -1
- package/node/constants/defaultGridSlotsComponents.js +5 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/core/gridCoreSelector.js +12 -0
- package/node/hooks/core/useGridInitialization.js +4 -0
- package/node/hooks/core/useGridRefs.js +22 -0
- package/node/hooks/core/useGridTheme.js +29 -0
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +5 -12
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +65 -159
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +28 -23
- package/node/hooks/features/columns/gridColumnsInterfaces.js +11 -1
- package/node/hooks/features/columns/gridColumnsSelector.js +52 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +10 -13
- package/node/hooks/features/columns/index.js +22 -61
- package/node/hooks/features/columns/useGridColumnSpanning.js +62 -61
- package/node/hooks/features/columns/useGridColumns.js +20 -22
- package/node/hooks/features/dimensions/gridDimensionsSelectors.js +8 -0
- package/node/hooks/features/dimensions/index.js +11 -0
- package/node/hooks/features/dimensions/useGridDimensions.js +215 -144
- package/node/hooks/features/export/serializers/csvSerializer.js +2 -2
- package/node/hooks/features/filter/useGridFilter.js +2 -2
- package/node/hooks/features/focus/gridFocusStateSelector.js +3 -7
- package/node/hooks/features/focus/useGridFocus.js +2 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -15
- package/node/hooks/features/pagination/useGridPagination.js +3 -5
- package/node/hooks/features/rows/gridRowsSelector.js +2 -2
- package/node/hooks/features/rows/gridRowsUtils.js +4 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +5 -3
- package/node/hooks/features/scroll/useGridScroll.js +8 -9
- package/node/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/node/hooks/features/sorting/useGridSorting.js +15 -10
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +22 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +434 -431
- package/node/hooks/features/virtualization/useGridVirtualization.js +9 -1
- package/node/hooks/utils/index.js +36 -0
- package/node/hooks/utils/useGridAriaAttributes.js +1 -1
- package/node/hooks/utils/useGridNativeEventListener.js +3 -9
- package/node/hooks/utils/useResizeObserver.js +44 -0
- package/node/hooks/utils/useRunOnce.js +27 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +86 -71
- package/node/locales/hrHR.js +155 -0
- package/node/locales/index.js +33 -0
- package/node/locales/ptPT.js +155 -0
- package/node/locales/zhHK.js +155 -0
- package/node/models/index.js +0 -11
- package/node/models/params/index.js +0 -11
- package/node/utils/utils.js +11 -1
- package/package.json +6 -6
- package/utils/utils.d.ts +6 -0
- package/utils/utils.js +10 -1
- package/components/DataGridVirtualScroller.d.ts +0 -3
- package/components/DataGridVirtualScroller.js +0 -35
- package/components/containers/GridMainContainer.js +0 -43
- package/legacy/components/DataGridVirtualScroller.js +0 -32
- package/legacy/components/containers/GridMainContainer.js +0 -45
- package/legacy/models/gridRootContainerRef.js +0 -1
- package/legacy/models/params/gridRenderedRowsIntervalChangeParams.js +0 -1
- package/models/gridRootContainerRef.d.ts +0 -5
- package/models/gridRootContainerRef.js +0 -1
- package/models/params/gridRenderedRowsIntervalChangeParams.d.ts +0 -10
- package/models/params/gridRenderedRowsIntervalChangeParams.js +0 -1
- package/modern/components/DataGridVirtualScroller.js +0 -35
- package/modern/components/containers/GridMainContainer.js +0 -42
- package/modern/models/gridRootContainerRef.js +0 -1
- package/modern/models/params/gridRenderedRowsIntervalChangeParams.js +0 -1
- package/node/components/DataGridVirtualScroller.js +0 -42
- package/node/models/gridRootContainerRef.js +0 -5
- package/node/models/params/gridRenderedRowsIntervalChangeParams.js +0 -5
package/components/GridRow.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridRowId, GridRowModel } from '../models/gridRows';
|
|
3
|
-
import {
|
|
3
|
+
import type { GridPinnedColumns } from '../hooks/features/columns';
|
|
4
|
+
import type { GridStateColDef } from '../models/colDef/gridColDef';
|
|
5
|
+
import { type GridDimensions } from '../hooks/features/dimensions';
|
|
4
6
|
export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
7
|
rowId: GridRowId;
|
|
6
8
|
selected: boolean;
|
|
@@ -10,12 +12,12 @@ export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
10
12
|
*/
|
|
11
13
|
index: number;
|
|
12
14
|
rowHeight: number | 'auto';
|
|
13
|
-
|
|
15
|
+
dimensions: GridDimensions;
|
|
14
16
|
firstColumnToRender: number;
|
|
15
17
|
lastColumnToRender: number;
|
|
16
18
|
visibleColumns: GridStateColDef[];
|
|
17
19
|
renderedColumns: GridStateColDef[];
|
|
18
|
-
|
|
20
|
+
pinnedColumns: GridPinnedColumns;
|
|
19
21
|
/**
|
|
20
22
|
* Determines which cell has focus.
|
|
21
23
|
* If `null`, no cell in this row has focus.
|
|
@@ -27,7 +29,8 @@ export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
27
29
|
*/
|
|
28
30
|
tabbableCell: string | null;
|
|
29
31
|
row?: GridRowModel;
|
|
30
|
-
|
|
32
|
+
isFirstVisible: boolean;
|
|
33
|
+
isLastVisible: boolean;
|
|
31
34
|
focusedCellColumnIndexNotInRange?: number;
|
|
32
35
|
isNotVisible?: boolean;
|
|
33
36
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
package/components/GridRow.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["selected", "
|
|
3
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "pinnedColumns", "dimensions", "firstColumnToRender", "lastColumnToRender", "isFirstVisible", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -10,7 +10,7 @@ import { GridEditModes, GridRowModes, GridCellModes } from '../models/gridEditRo
|
|
|
10
10
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
11
11
|
import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
|
|
12
12
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
13
|
-
import {
|
|
13
|
+
import { gridColumnPositionsSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
14
14
|
import { useGridSelector, objectShallowCompare } from '../hooks/utils/useGridSelector';
|
|
15
15
|
import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
16
16
|
import { findParentElementFromClassName, isEventTargetInPortal } from '../utils/domUtils';
|
|
@@ -20,9 +20,10 @@ import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelTogg
|
|
|
20
20
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
21
21
|
import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
22
22
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
23
|
-
import { randomNumberBetween } from '../utils/utils';
|
|
24
|
-
import { GridCellWrapper, GridCellV7 } from './cell/GridCell';
|
|
25
23
|
import { gridEditRowsStateSelector } from '../hooks/features/editing/gridEditingSelectors';
|
|
24
|
+
import { randomNumberBetween } from '../utils/utils';
|
|
25
|
+
import { PinnedPosition } from './cell/GridCell';
|
|
26
|
+
import { GridScrollbarFillerCell as ScrollbarFiller } from './GridScrollbarFillerCell';
|
|
26
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
29
|
const useUtilityClasses = ownerState => {
|
|
@@ -30,12 +31,15 @@ const useUtilityClasses = ownerState => {
|
|
|
30
31
|
editable,
|
|
31
32
|
editing,
|
|
32
33
|
selected,
|
|
34
|
+
isFirstVisible,
|
|
33
35
|
isLastVisible,
|
|
34
36
|
rowHeight,
|
|
35
37
|
classes
|
|
36
38
|
} = ownerState;
|
|
37
39
|
const slots = {
|
|
38
|
-
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
40
|
+
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight'],
|
|
41
|
+
pinnedLeft: ['pinnedLeft'],
|
|
42
|
+
pinnedRight: ['pinnedRight']
|
|
39
43
|
};
|
|
40
44
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
41
45
|
};
|
|
@@ -45,30 +49,30 @@ function EmptyCell({
|
|
|
45
49
|
if (!width) {
|
|
46
50
|
return null;
|
|
47
51
|
}
|
|
48
|
-
const style = {
|
|
49
|
-
width
|
|
50
|
-
};
|
|
51
52
|
return /*#__PURE__*/_jsx("div", {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
role: "presentation",
|
|
54
|
+
className: clsx(gridClasses.cell, gridClasses.cellEmpty),
|
|
55
|
+
style: {
|
|
56
|
+
'--width': `${width}px`
|
|
57
|
+
}
|
|
58
|
+
});
|
|
55
59
|
}
|
|
56
60
|
const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
57
61
|
const {
|
|
58
62
|
selected,
|
|
59
|
-
hovered,
|
|
60
63
|
rowId,
|
|
61
64
|
row,
|
|
62
65
|
index,
|
|
63
66
|
style: styleProp,
|
|
64
|
-
position,
|
|
65
67
|
rowHeight,
|
|
66
68
|
className,
|
|
67
69
|
visibleColumns,
|
|
68
70
|
renderedColumns,
|
|
69
|
-
|
|
71
|
+
pinnedColumns,
|
|
72
|
+
dimensions,
|
|
70
73
|
firstColumnToRender,
|
|
71
|
-
|
|
74
|
+
isFirstVisible,
|
|
75
|
+
isLastVisible,
|
|
72
76
|
focusedCellColumnIndexNotInRange,
|
|
73
77
|
isNotVisible,
|
|
74
78
|
focusedCell,
|
|
@@ -84,17 +88,19 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
84
88
|
const ref = React.useRef(null);
|
|
85
89
|
const rootProps = useGridRootProps();
|
|
86
90
|
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
87
|
-
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
88
91
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
89
92
|
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
90
93
|
const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
94
|
+
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
91
95
|
const editRowsState = useGridSelector(apiRef, gridEditRowsStateSelector);
|
|
92
96
|
const handleRef = useForkRef(ref, refProp);
|
|
97
|
+
const rowNode = apiRef.current.getRowNode(rowId);
|
|
98
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
93
99
|
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
94
100
|
|
|
95
101
|
const ownerState = {
|
|
96
102
|
selected,
|
|
97
|
-
|
|
103
|
+
isFirstVisible,
|
|
98
104
|
isLastVisible,
|
|
99
105
|
classes: rootProps.classes,
|
|
100
106
|
editing: apiRef.current.getRowMode(rowId) === GridRowModes.Edit,
|
|
@@ -105,9 +111,9 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
105
111
|
React.useLayoutEffect(() => {
|
|
106
112
|
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
107
113
|
// Fallback for IE
|
|
108
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight
|
|
114
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
109
115
|
}
|
|
110
|
-
}, [apiRef, rowHeight, rowId
|
|
116
|
+
}, [apiRef, rowHeight, rowId]);
|
|
111
117
|
React.useLayoutEffect(() => {
|
|
112
118
|
if (currentPage.range) {
|
|
113
119
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -129,11 +135,11 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
129
135
|
const resizeObserver = new ResizeObserver(entries => {
|
|
130
136
|
const [entry] = entries;
|
|
131
137
|
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
132
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height
|
|
138
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
133
139
|
});
|
|
134
140
|
resizeObserver.observe(rootElement);
|
|
135
141
|
return () => resizeObserver.disconnect();
|
|
136
|
-
}, [apiRef, currentPage.range, index, rowHeight, rowId
|
|
142
|
+
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
137
143
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
138
144
|
// Ignore portal
|
|
139
145
|
if (isEventTargetInPortal(event)) {
|
|
@@ -189,51 +195,13 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
189
195
|
slotProps,
|
|
190
196
|
disableColumnReorder
|
|
191
197
|
} = rootProps;
|
|
192
|
-
const CellComponent = slots.cell === GridCellV7 ? GridCellV7 : GridCellWrapper;
|
|
193
198
|
const rowReordering = rootProps.rowReordering;
|
|
194
|
-
const getCell = (column, cellProps) => {
|
|
195
|
-
var _editRowsState$rowId$, _editRowsState$rowId;
|
|
196
|
-
// when the cell is a reorder cell we are not allowing to reorder the col
|
|
197
|
-
// fixes https://github.com/mui/mui-x/issues/11126
|
|
198
|
-
const isReorderCell = column.field === '__reorder__';
|
|
199
|
-
const isEditingRows = Object.keys(editRowsState).length > 0;
|
|
200
|
-
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
201
|
-
const canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
|
|
202
|
-
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
203
|
-
const editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
|
|
204
|
-
let cellIsNotVisible = false;
|
|
205
|
-
if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
|
|
206
|
-
cellIsNotVisible = true;
|
|
207
|
-
}
|
|
208
|
-
return /*#__PURE__*/_jsx(CellComponent, _extends({
|
|
209
|
-
column: column,
|
|
210
|
-
width: cellProps.width,
|
|
211
|
-
rowId: rowId,
|
|
212
|
-
height: rowHeight,
|
|
213
|
-
showRightBorder: cellProps.showRightBorder,
|
|
214
|
-
align: column.align || 'left',
|
|
215
|
-
colIndex: cellProps.indexRelativeToAllColumns,
|
|
216
|
-
colSpan: cellProps.colSpan,
|
|
217
|
-
disableDragEvents: disableDragEvents,
|
|
218
|
-
editCellState: editCellState,
|
|
219
|
-
isNotVisible: cellIsNotVisible
|
|
220
|
-
}, slotProps == null ? void 0 : slotProps.cell), column.field);
|
|
221
|
-
};
|
|
222
199
|
const sizes = useGridSelector(apiRef, () => _extends({}, apiRef.current.unstable_getRowInternalSizes(rowId)), objectShallowCompare);
|
|
223
200
|
let minHeight = rowHeight;
|
|
224
201
|
if (minHeight === 'auto' && sizes) {
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
if (!isBaseHeight) {
|
|
229
|
-
return acc;
|
|
230
|
-
}
|
|
231
|
-
numberOfBaseSizes += 1;
|
|
232
|
-
if (size > acc) {
|
|
233
|
-
return size;
|
|
234
|
-
}
|
|
235
|
-
return acc;
|
|
236
|
-
}, 0);
|
|
202
|
+
var _sizes$baseCenter;
|
|
203
|
+
const numberOfBaseSizes = 1;
|
|
204
|
+
const maximumSize = (_sizes$baseCenter = sizes.baseCenter) != null ? _sizes$baseCenter : 0;
|
|
237
205
|
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
238
206
|
minHeight = maximumSize;
|
|
239
207
|
}
|
|
@@ -279,11 +247,89 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
279
247
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
280
248
|
}
|
|
281
249
|
const randomNumber = randomNumberBetween(10000, 20, 80);
|
|
282
|
-
const
|
|
250
|
+
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedPosition.NONE) => {
|
|
251
|
+
var _editRowsState$rowId$, _editRowsState$rowId;
|
|
252
|
+
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
253
|
+
if (!cellColSpanInfo || cellColSpanInfo.spannedByColSpan) {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
let pinnedOffset;
|
|
257
|
+
// FIXME: Why is the switch check exhaustiveness not validated with typescript-eslint?
|
|
258
|
+
// eslint-disable-next-line default-case
|
|
259
|
+
switch (pinnedPosition) {
|
|
260
|
+
case PinnedPosition.LEFT:
|
|
261
|
+
pinnedOffset = columnPositions[indexRelativeToAllColumns];
|
|
262
|
+
break;
|
|
263
|
+
case PinnedPosition.RIGHT:
|
|
264
|
+
pinnedOffset = dimensions.columnsTotalWidth - columnPositions[indexRelativeToAllColumns] - column.computedWidth + scrollbarWidth;
|
|
265
|
+
break;
|
|
266
|
+
case PinnedPosition.NONE:
|
|
267
|
+
pinnedOffset = 0;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
if ((rowNode == null ? void 0 : rowNode.type) === 'skeletonRow') {
|
|
271
|
+
const {
|
|
272
|
+
width
|
|
273
|
+
} = cellColSpanInfo.cellProps;
|
|
274
|
+
const contentWidth = Math.round(randomNumber());
|
|
275
|
+
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
276
|
+
width: width,
|
|
277
|
+
contentWidth: contentWidth,
|
|
278
|
+
field: column.field,
|
|
279
|
+
align: column.align
|
|
280
|
+
}, column.field);
|
|
281
|
+
}
|
|
282
|
+
const {
|
|
283
|
+
colSpan,
|
|
284
|
+
width
|
|
285
|
+
} = cellColSpanInfo.cellProps;
|
|
286
|
+
const editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
|
|
287
|
+
|
|
288
|
+
// when the cell is a reorder cell we are not allowing to reorder the col
|
|
289
|
+
// fixes https://github.com/mui/mui-x/issues/11126
|
|
290
|
+
const isReorderCell = column.field === '__reorder__';
|
|
291
|
+
const isEditingRows = Object.keys(editRowsState).length > 0;
|
|
292
|
+
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
293
|
+
const canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
|
|
294
|
+
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
295
|
+
let cellIsNotVisible = false;
|
|
296
|
+
if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
|
|
297
|
+
cellIsNotVisible = true;
|
|
298
|
+
}
|
|
299
|
+
return /*#__PURE__*/_jsx(slots.cell, _extends({
|
|
300
|
+
column: column,
|
|
301
|
+
width: width,
|
|
302
|
+
rowId: rowId,
|
|
303
|
+
height: rowHeight,
|
|
304
|
+
align: column.align || 'left',
|
|
305
|
+
colIndex: indexRelativeToAllColumns,
|
|
306
|
+
colSpan: colSpan,
|
|
307
|
+
disableDragEvents: disableDragEvents,
|
|
308
|
+
editCellState: editCellState,
|
|
309
|
+
isNotVisible: cellIsNotVisible
|
|
310
|
+
}, slotProps == null ? void 0 : slotProps.cell, {
|
|
311
|
+
pinnedOffset: pinnedOffset,
|
|
312
|
+
pinnedPosition: pinnedPosition,
|
|
313
|
+
sectionIndex: indexInSection,
|
|
314
|
+
sectionLength: sectionLength,
|
|
315
|
+
gridHasScrollX: dimensions.hasScrollX
|
|
316
|
+
}), column.field);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
/* Start of rendering */
|
|
320
|
+
|
|
283
321
|
if (!rowNode) {
|
|
284
322
|
return null;
|
|
285
323
|
}
|
|
286
|
-
const
|
|
324
|
+
const leftCells = pinnedColumns.left.map((column, i) => {
|
|
325
|
+
const indexRelativeToAllColumns = i;
|
|
326
|
+
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.left.length, PinnedPosition.LEFT);
|
|
327
|
+
});
|
|
328
|
+
const rightCells = pinnedColumns.right.map((column, i) => {
|
|
329
|
+
const indexRelativeToAllColumns = visibleColumns.length - pinnedColumns.right.length + i;
|
|
330
|
+
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.right.length, PinnedPosition.RIGHT);
|
|
331
|
+
});
|
|
332
|
+
const middleColumnsLength = visibleColumns.length - pinnedColumns.left.length - pinnedColumns.right.length;
|
|
287
333
|
const cells = [];
|
|
288
334
|
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
289
335
|
const column = renderedColumns[i];
|
|
@@ -295,35 +341,9 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
295
341
|
indexRelativeToAllColumns -= 1;
|
|
296
342
|
}
|
|
297
343
|
}
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
if (rowType !== 'skeletonRow') {
|
|
301
|
-
const {
|
|
302
|
-
colSpan,
|
|
303
|
-
width
|
|
304
|
-
} = cellColSpanInfo.cellProps;
|
|
305
|
-
const cellProps = {
|
|
306
|
-
width,
|
|
307
|
-
colSpan,
|
|
308
|
-
showRightBorder: rootProps.showCellVerticalBorder,
|
|
309
|
-
indexRelativeToAllColumns
|
|
310
|
-
};
|
|
311
|
-
cells.push(getCell(column, cellProps));
|
|
312
|
-
} else {
|
|
313
|
-
const {
|
|
314
|
-
width
|
|
315
|
-
} = cellColSpanInfo.cellProps;
|
|
316
|
-
const contentWidth = Math.round(randomNumber());
|
|
317
|
-
cells.push( /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
318
|
-
width: width,
|
|
319
|
-
contentWidth: contentWidth,
|
|
320
|
-
field: column.field,
|
|
321
|
-
align: column.align
|
|
322
|
-
}, column.field));
|
|
323
|
-
}
|
|
324
|
-
}
|
|
344
|
+
const indexInSection = indexRelativeToAllColumns - pinnedColumns.left.length;
|
|
345
|
+
cells.push(getCell(column, indexInSection, indexRelativeToAllColumns, middleColumnsLength));
|
|
325
346
|
}
|
|
326
|
-
const emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
327
347
|
const eventHandlers = row ? {
|
|
328
348
|
onClick: publishClick,
|
|
329
349
|
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
@@ -332,18 +352,27 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
332
352
|
onMouseOut: publish('rowMouseOut', onMouseOut),
|
|
333
353
|
onMouseOver: publish('rowMouseOver', onMouseOver)
|
|
334
354
|
} : null;
|
|
355
|
+
const expandedWidth = dimensions.viewportOuterSize.width - dimensions.columnsTotalWidth - scrollbarWidth;
|
|
356
|
+
const emptyCellWidth = Math.max(0, expandedWidth);
|
|
335
357
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
336
358
|
ref: handleRef,
|
|
337
359
|
"data-id": rowId,
|
|
338
360
|
"data-rowindex": index,
|
|
339
361
|
role: "row",
|
|
340
|
-
className: clsx(...rowClassNames, classes.root, className
|
|
362
|
+
className: clsx(...rowClassNames, classes.root, className),
|
|
341
363
|
"aria-rowindex": ariaRowIndex,
|
|
342
364
|
"aria-selected": selected,
|
|
343
365
|
style: style
|
|
344
366
|
}, eventHandlers, other, {
|
|
345
|
-
children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
367
|
+
children: [leftCells, cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
346
368
|
width: emptyCellWidth
|
|
369
|
+
}), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
370
|
+
role: "presentation",
|
|
371
|
+
style: {
|
|
372
|
+
flex: '1'
|
|
373
|
+
}
|
|
374
|
+
}), rightCells, scrollbarWidth !== 0 && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
375
|
+
pinnedRight: pinnedColumns.right.length > 0
|
|
347
376
|
})]
|
|
348
377
|
}));
|
|
349
378
|
});
|
|
@@ -352,7 +381,41 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
352
381
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
353
382
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
354
383
|
// ----------------------------------------------------------------------
|
|
355
|
-
|
|
384
|
+
dimensions: PropTypes.shape({
|
|
385
|
+
bottomContainerHeight: PropTypes.number.isRequired,
|
|
386
|
+
columnsTotalWidth: PropTypes.number.isRequired,
|
|
387
|
+
contentSize: PropTypes.shape({
|
|
388
|
+
height: PropTypes.number.isRequired,
|
|
389
|
+
width: PropTypes.number.isRequired
|
|
390
|
+
}).isRequired,
|
|
391
|
+
hasScrollX: PropTypes.bool.isRequired,
|
|
392
|
+
hasScrollY: PropTypes.bool.isRequired,
|
|
393
|
+
headerHeight: PropTypes.number.isRequired,
|
|
394
|
+
headersTotalHeight: PropTypes.number.isRequired,
|
|
395
|
+
isReady: PropTypes.bool.isRequired,
|
|
396
|
+
leftPinnedWidth: PropTypes.number.isRequired,
|
|
397
|
+
minimumSize: PropTypes.shape({
|
|
398
|
+
height: PropTypes.number.isRequired,
|
|
399
|
+
width: PropTypes.number.isRequired
|
|
400
|
+
}).isRequired,
|
|
401
|
+
rightPinnedWidth: PropTypes.number.isRequired,
|
|
402
|
+
root: PropTypes.shape({
|
|
403
|
+
height: PropTypes.number.isRequired,
|
|
404
|
+
width: PropTypes.number.isRequired
|
|
405
|
+
}).isRequired,
|
|
406
|
+
rowHeight: PropTypes.number.isRequired,
|
|
407
|
+
rowWidth: PropTypes.number.isRequired,
|
|
408
|
+
scrollbarSize: PropTypes.number.isRequired,
|
|
409
|
+
topContainerHeight: PropTypes.number.isRequired,
|
|
410
|
+
viewportInnerSize: PropTypes.shape({
|
|
411
|
+
height: PropTypes.number.isRequired,
|
|
412
|
+
width: PropTypes.number.isRequired
|
|
413
|
+
}).isRequired,
|
|
414
|
+
viewportOuterSize: PropTypes.shape({
|
|
415
|
+
height: PropTypes.number.isRequired,
|
|
416
|
+
width: PropTypes.number.isRequired
|
|
417
|
+
}).isRequired
|
|
418
|
+
}).isRequired,
|
|
356
419
|
firstColumnToRender: PropTypes.number.isRequired,
|
|
357
420
|
/**
|
|
358
421
|
* Determines which cell has focus.
|
|
@@ -365,14 +428,114 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
365
428
|
* If some rows above have expanded children, this index also take those children into account.
|
|
366
429
|
*/
|
|
367
430
|
index: PropTypes.number.isRequired,
|
|
368
|
-
|
|
431
|
+
isFirstVisible: PropTypes.bool.isRequired,
|
|
432
|
+
isLastVisible: PropTypes.bool.isRequired,
|
|
369
433
|
isNotVisible: PropTypes.bool,
|
|
370
434
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
371
435
|
onClick: PropTypes.func,
|
|
372
436
|
onDoubleClick: PropTypes.func,
|
|
373
437
|
onMouseEnter: PropTypes.func,
|
|
374
438
|
onMouseLeave: PropTypes.func,
|
|
375
|
-
|
|
439
|
+
pinnedColumns: PropTypes.shape({
|
|
440
|
+
left: PropTypes.arrayOf(PropTypes.shape({
|
|
441
|
+
align: PropTypes.oneOf(['center', 'left', 'right']),
|
|
442
|
+
cellClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
443
|
+
colSpan: PropTypes.oneOfType([PropTypes.func, PropTypes.number]),
|
|
444
|
+
computedWidth: PropTypes.number.isRequired,
|
|
445
|
+
description: PropTypes.string,
|
|
446
|
+
disableColumnMenu: PropTypes.bool,
|
|
447
|
+
disableExport: PropTypes.bool,
|
|
448
|
+
disableReorder: PropTypes.bool,
|
|
449
|
+
editable: PropTypes.bool,
|
|
450
|
+
field: PropTypes.string.isRequired,
|
|
451
|
+
filterable: PropTypes.bool,
|
|
452
|
+
filterOperators: PropTypes.arrayOf(PropTypes.shape({
|
|
453
|
+
getApplyFilterFn: PropTypes.func.isRequired,
|
|
454
|
+
getValueAsString: PropTypes.func,
|
|
455
|
+
headerLabel: PropTypes.string,
|
|
456
|
+
InputComponent: PropTypes.elementType,
|
|
457
|
+
InputComponentProps: PropTypes.object,
|
|
458
|
+
label: PropTypes.string,
|
|
459
|
+
requiresFilterValue: PropTypes.bool,
|
|
460
|
+
value: PropTypes.string.isRequired
|
|
461
|
+
})),
|
|
462
|
+
flex: PropTypes.number,
|
|
463
|
+
getApplyQuickFilterFn: PropTypes.func,
|
|
464
|
+
groupable: PropTypes.bool,
|
|
465
|
+
hasBeenResized: PropTypes.bool,
|
|
466
|
+
headerAlign: PropTypes.oneOf(['center', 'left', 'right']),
|
|
467
|
+
headerClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
468
|
+
headerName: PropTypes.string,
|
|
469
|
+
hideable: PropTypes.bool,
|
|
470
|
+
hideSortIcons: PropTypes.bool,
|
|
471
|
+
maxWidth: PropTypes.number,
|
|
472
|
+
minWidth: PropTypes.number,
|
|
473
|
+
pinnable: PropTypes.bool,
|
|
474
|
+
preProcessEditCellProps: PropTypes.func,
|
|
475
|
+
renderCell: PropTypes.func,
|
|
476
|
+
renderEditCell: PropTypes.func,
|
|
477
|
+
renderHeader: PropTypes.func,
|
|
478
|
+
resizable: PropTypes.bool,
|
|
479
|
+
sortable: PropTypes.bool,
|
|
480
|
+
sortComparator: PropTypes.func,
|
|
481
|
+
sortingOrder: PropTypes.arrayOf(PropTypes.oneOf(['asc', 'desc'])),
|
|
482
|
+
type: PropTypes.oneOf(['actions', 'boolean', 'custom', 'date', 'dateTime', 'number', 'singleSelect', 'string']),
|
|
483
|
+
valueFormatter: PropTypes.func,
|
|
484
|
+
valueGetter: PropTypes.func,
|
|
485
|
+
valueParser: PropTypes.func,
|
|
486
|
+
valueSetter: PropTypes.func,
|
|
487
|
+
width: PropTypes.number
|
|
488
|
+
})).isRequired,
|
|
489
|
+
right: PropTypes.arrayOf(PropTypes.shape({
|
|
490
|
+
align: PropTypes.oneOf(['center', 'left', 'right']),
|
|
491
|
+
cellClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
492
|
+
colSpan: PropTypes.oneOfType([PropTypes.func, PropTypes.number]),
|
|
493
|
+
computedWidth: PropTypes.number.isRequired,
|
|
494
|
+
description: PropTypes.string,
|
|
495
|
+
disableColumnMenu: PropTypes.bool,
|
|
496
|
+
disableExport: PropTypes.bool,
|
|
497
|
+
disableReorder: PropTypes.bool,
|
|
498
|
+
editable: PropTypes.bool,
|
|
499
|
+
field: PropTypes.string.isRequired,
|
|
500
|
+
filterable: PropTypes.bool,
|
|
501
|
+
filterOperators: PropTypes.arrayOf(PropTypes.shape({
|
|
502
|
+
getApplyFilterFn: PropTypes.func.isRequired,
|
|
503
|
+
getValueAsString: PropTypes.func,
|
|
504
|
+
headerLabel: PropTypes.string,
|
|
505
|
+
InputComponent: PropTypes.elementType,
|
|
506
|
+
InputComponentProps: PropTypes.object,
|
|
507
|
+
label: PropTypes.string,
|
|
508
|
+
requiresFilterValue: PropTypes.bool,
|
|
509
|
+
value: PropTypes.string.isRequired
|
|
510
|
+
})),
|
|
511
|
+
flex: PropTypes.number,
|
|
512
|
+
getApplyQuickFilterFn: PropTypes.func,
|
|
513
|
+
groupable: PropTypes.bool,
|
|
514
|
+
hasBeenResized: PropTypes.bool,
|
|
515
|
+
headerAlign: PropTypes.oneOf(['center', 'left', 'right']),
|
|
516
|
+
headerClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
517
|
+
headerName: PropTypes.string,
|
|
518
|
+
hideable: PropTypes.bool,
|
|
519
|
+
hideSortIcons: PropTypes.bool,
|
|
520
|
+
maxWidth: PropTypes.number,
|
|
521
|
+
minWidth: PropTypes.number,
|
|
522
|
+
pinnable: PropTypes.bool,
|
|
523
|
+
preProcessEditCellProps: PropTypes.func,
|
|
524
|
+
renderCell: PropTypes.func,
|
|
525
|
+
renderEditCell: PropTypes.func,
|
|
526
|
+
renderHeader: PropTypes.func,
|
|
527
|
+
resizable: PropTypes.bool,
|
|
528
|
+
sortable: PropTypes.bool,
|
|
529
|
+
sortComparator: PropTypes.func,
|
|
530
|
+
sortingOrder: PropTypes.arrayOf(PropTypes.oneOf(['asc', 'desc'])),
|
|
531
|
+
type: PropTypes.oneOf(['actions', 'boolean', 'custom', 'date', 'dateTime', 'number', 'singleSelect', 'string']),
|
|
532
|
+
valueFormatter: PropTypes.func,
|
|
533
|
+
valueGetter: PropTypes.func,
|
|
534
|
+
valueParser: PropTypes.func,
|
|
535
|
+
valueSetter: PropTypes.func,
|
|
536
|
+
width: PropTypes.number
|
|
537
|
+
})).isRequired
|
|
538
|
+
}).isRequired,
|
|
376
539
|
renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
377
540
|
row: PropTypes.object,
|
|
378
541
|
rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { getDataGridUtilityClass as getClassName } from '../constants';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const classes = {
|
|
7
|
+
root: getClassName('scrollbarFiller'),
|
|
8
|
+
header: getClassName('scrollbarFiller--header'),
|
|
9
|
+
borderTop: getClassName('scrollbarFiller--borderTop'),
|
|
10
|
+
pinnedRight: getClassName('scrollbarFiller--pinnedRight')
|
|
11
|
+
};
|
|
12
|
+
const Style = styled('div')({
|
|
13
|
+
minWidth: 'calc(var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize))',
|
|
14
|
+
alignSelf: 'stretch',
|
|
15
|
+
[`&.${classes.borderTop}`]: {
|
|
16
|
+
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
17
|
+
},
|
|
18
|
+
[`&.${classes.pinnedRight}`]: {
|
|
19
|
+
backgroundColor: 'var(--DataGrid-pinnedBackground)'
|
|
20
|
+
},
|
|
21
|
+
[`&.${classes.pinnedRight}:not(.${classes.header})`]: {
|
|
22
|
+
position: 'sticky',
|
|
23
|
+
right: 0
|
|
24
|
+
},
|
|
25
|
+
[`&:not(.${classes.header}):not(.${classes.pinnedRight})`]: {
|
|
26
|
+
transform: 'translate3d(var(--DataGrid-offsetLeft), 0, 0)'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
function GridScrollbarFillerCell({
|
|
30
|
+
header,
|
|
31
|
+
borderTop = true,
|
|
32
|
+
pinnedRight
|
|
33
|
+
}) {
|
|
34
|
+
return /*#__PURE__*/_jsx(Style, {
|
|
35
|
+
role: "presentation",
|
|
36
|
+
className: clsx(classes.root, header && classes.header, borderTop && classes.borderTop, pinnedRight && classes.pinnedRight)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export { GridScrollbarFillerCell };
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
ColumnHeadersProps?: Record<string, any>;
|
|
5
|
-
VirtualScrollerComponent: React.JSXElementConstructor<React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
-
ref: React.Ref<HTMLDivElement>;
|
|
7
|
-
}>;
|
|
8
|
-
}
|
|
9
|
-
declare function GridBody(props: GridBodyProps): React.JSX.Element;
|
|
10
|
-
declare namespace GridBody {
|
|
11
|
-
var propTypes: any;
|
|
12
|
-
}
|
|
13
|
-
export { GridBody };
|
|
1
|
+
import { GridVirtualScroller } from '../virtualization/GridVirtualScroller';
|
|
2
|
+
export { GridVirtualScroller as GridBody };
|