@mui/x-data-grid 7.0.0-alpha.7 → 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 +554 -51
- package/DataGrid/DataGrid.js +15 -27
- package/DataGrid/useDataGridComponent.js +2 -1
- package/DataGrid/useDataGridProps.js +1 -0
- package/README.md +1 -1
- package/colDef/gridDateColDef.js +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/GridPagination.d.ts +4 -4
- package/components/GridPagination.js +1 -1
- 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/GridActionsCell.js +1 -1
- package/components/cell/GridActionsCellItem.d.ts +6 -6
- package/components/cell/GridCell.d.ts +15 -21
- package/components/cell/GridCell.js +68 -373
- 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.d.ts +3 -3
- package/components/panel/GridPanel.js +3 -4
- package/components/panel/filterPanel/GridFilterForm.d.ts +6 -4
- package/components/panel/filterPanel/GridFilterForm.js +32 -15
- 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/toolbar/GridToolbarQuickFilter.d.ts +4 -0
- package/components/toolbar/GridToolbarQuickFilter.js +4 -0
- 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/useGridLoggerFactory.js +2 -2
- 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/gridColumnGroupsUtils.js +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +13 -18
- 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/editing/useGridCellEditing.js +4 -4
- package/hooks/features/editing/useGridRowEditing.js +4 -4
- package/hooks/features/export/serializers/csvSerializer.js +3 -3
- package/hooks/features/export/useGridPrintExport.js +1 -1
- package/hooks/features/filter/gridFilterUtils.js +5 -5
- 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/gridPaginationUtils.js +2 -2
- package/hooks/features/pagination/useGridPagination.js +3 -5
- package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- 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 +6 -6
- package/hooks/features/rows/useGridRows.js +7 -7
- package/hooks/features/rows/useGridRowsMeta.js +9 -6
- package/hooks/features/scroll/useGridScroll.js +8 -10
- package/hooks/features/sorting/gridSortingUtils.js +5 -3
- 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/useGridApiContext.js +1 -1
- package/hooks/utils/useGridAriaAttributes.js +1 -2
- package/hooks/utils/useGridNativeEventListener.js +4 -9
- package/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/hooks/utils/useGridRootProps.js +1 -1
- package/hooks/utils/useGridSelector.js +1 -1
- 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.d.ts +0 -1
- package/index.js +1 -2
- package/internals/index.d.ts +13 -9
- package/internals/index.js +9 -7
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/internals/utils/propValidation.d.ts +4 -0
- package/internals/utils/propValidation.js +19 -0
- package/legacy/DataGrid/DataGrid.js +20 -29
- package/legacy/DataGrid/useDataGridComponent.js +2 -1
- package/legacy/DataGrid/useDataGridProps.js +1 -0
- package/legacy/colDef/gridDateColDef.js +1 -1
- package/legacy/components/GridColumnHeaders.js +3 -11
- package/legacy/components/GridDetailPanels.js +4 -0
- package/legacy/components/GridHeaders.js +53 -0
- package/legacy/components/GridPagination.js +1 -1
- 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/GridActionsCell.js +1 -1
- package/legacy/components/cell/GridCell.js +70 -378
- 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 +31 -14
- 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/toolbar/GridToolbarQuickFilter.js +4 -0
- 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/useGridLoggerFactory.js +2 -2
- package/legacy/hooks/core/useGridRefs.js +13 -0
- package/legacy/hooks/core/useGridTheme.js +21 -0
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +13 -18
- 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/editing/useGridCellEditing.js +4 -4
- package/legacy/hooks/features/editing/useGridRowEditing.js +4 -4
- package/legacy/hooks/features/export/serializers/csvSerializer.js +3 -3
- package/legacy/hooks/features/export/useGridPrintExport.js +1 -1
- package/legacy/hooks/features/filter/gridFilterUtils.js +5 -5
- 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/gridPaginationUtils.js +2 -2
- package/legacy/hooks/features/pagination/useGridPagination.js +3 -5
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/legacy/hooks/features/rows/gridRowsSelector.js +5 -5
- package/legacy/hooks/features/rows/gridRowsUtils.js +6 -6
- package/legacy/hooks/features/rows/useGridParamsApi.js +4 -5
- package/legacy/hooks/features/rows/useGridRows.js +7 -7
- package/legacy/hooks/features/rows/useGridRowsMeta.js +9 -6
- package/legacy/hooks/features/scroll/useGridScroll.js +8 -10
- package/legacy/hooks/features/sorting/gridSortingUtils.js +5 -3
- 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/useGridApiContext.js +1 -1
- package/legacy/hooks/utils/useGridAriaAttributes.js +1 -2
- package/legacy/hooks/utils/useGridNativeEventListener.js +4 -9
- package/legacy/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/legacy/hooks/utils/useGridRootProps.js +1 -1
- package/legacy/hooks/utils/useGridSelector.js +1 -1
- package/legacy/hooks/utils/useResizeObserver.js +36 -0
- package/legacy/hooks/utils/useRunOnce.js +18 -0
- package/legacy/index.js +1 -2
- package/legacy/internals/index.js +9 -7
- package/legacy/internals/utils/index.js +2 -1
- package/legacy/internals/utils/propValidation.js +21 -0
- 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/createSelector.js +1 -1
- package/legacy/utils/exportAs.js +1 -1
- 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 +7 -12
- package/modern/DataGrid/DataGrid.js +15 -27
- package/modern/DataGrid/useDataGridComponent.js +2 -1
- package/modern/DataGrid/useDataGridProps.js +1 -0
- package/modern/colDef/gridDateColDef.js +1 -1
- package/modern/components/GridColumnHeaders.js +3 -11
- package/modern/components/GridDetailPanels.js +4 -0
- package/modern/components/GridHeaders.js +53 -0
- package/modern/components/GridPagination.js +1 -1
- 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/GridActionsCell.js +1 -1
- package/modern/components/cell/GridCell.js +66 -370
- 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 +31 -14
- 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/toolbar/GridToolbarQuickFilter.js +4 -0
- 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/useGridLoggerFactory.js +2 -2
- package/modern/hooks/core/useGridRefs.js +13 -0
- package/modern/hooks/core/useGridTheme.js +19 -0
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +11 -16
- 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/editing/useGridCellEditing.js +4 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +4 -4
- package/modern/hooks/features/export/serializers/csvSerializer.js +3 -3
- package/modern/hooks/features/export/useGridPrintExport.js +1 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +5 -5
- 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/gridPaginationUtils.js +2 -2
- package/modern/hooks/features/pagination/useGridPagination.js +3 -5
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/modern/hooks/features/rows/gridRowsSelector.js +2 -2
- package/modern/hooks/features/rows/gridRowsUtils.js +6 -6
- package/modern/hooks/features/rows/useGridRows.js +7 -7
- package/modern/hooks/features/rows/useGridRowsMeta.js +9 -6
- package/modern/hooks/features/scroll/useGridScroll.js +8 -9
- package/modern/hooks/features/sorting/gridSortingUtils.js +5 -3
- 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/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridAriaAttributes.js +1 -1
- package/modern/hooks/utils/useGridNativeEventListener.js +3 -9
- package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/modern/hooks/utils/useGridRootProps.js +1 -1
- package/modern/hooks/utils/useGridSelector.js +1 -1
- package/modern/hooks/utils/useResizeObserver.js +36 -0
- package/modern/hooks/utils/useRunOnce.js +18 -0
- package/modern/index.js +1 -2
- package/modern/internals/index.js +9 -7
- package/modern/internals/utils/index.js +2 -1
- package/modern/internals/utils/propValidation.js +19 -0
- 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/createSelector.js +1 -1
- package/modern/utils/exportAs.js +1 -1
- package/modern/utils/utils.js +10 -1
- package/node/DataGrid/DataGrid.js +15 -27
- package/node/DataGrid/useDataGridComponent.js +1 -0
- package/node/DataGrid/useDataGridProps.js +1 -0
- package/node/colDef/gridDateColDef.js +1 -1
- package/node/components/GridColumnHeaders.js +3 -11
- package/node/components/GridDetailPanels.js +10 -0
- package/node/components/GridHeaders.js +60 -0
- package/node/components/GridPagination.js +1 -1
- 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/GridActionsCell.js +1 -1
- package/node/components/cell/GridCell.js +67 -370
- 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 +30 -13
- 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/toolbar/GridToolbarQuickFilter.js +4 -0
- 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/useGridLoggerFactory.js +2 -2
- package/node/hooks/core/useGridRefs.js +22 -0
- package/node/hooks/core/useGridTheme.js +29 -0
- package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +11 -16
- 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/editing/useGridCellEditing.js +4 -4
- package/node/hooks/features/editing/useGridRowEditing.js +4 -4
- package/node/hooks/features/export/serializers/csvSerializer.js +3 -3
- package/node/hooks/features/export/useGridPrintExport.js +1 -1
- package/node/hooks/features/filter/gridFilterUtils.js +5 -5
- 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/gridPaginationUtils.js +2 -2
- package/node/hooks/features/pagination/useGridPagination.js +3 -5
- package/node/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/node/hooks/features/rows/gridRowsSelector.js +2 -2
- package/node/hooks/features/rows/gridRowsUtils.js +6 -6
- package/node/hooks/features/rows/useGridRows.js +7 -7
- package/node/hooks/features/rows/useGridRowsMeta.js +7 -5
- package/node/hooks/features/scroll/useGridScroll.js +8 -9
- package/node/hooks/features/sorting/gridSortingUtils.js +5 -3
- 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/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridAriaAttributes.js +1 -1
- package/node/hooks/utils/useGridNativeEventListener.js +3 -9
- package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/hooks/utils/useGridSelector.js +1 -1
- package/node/hooks/utils/useResizeObserver.js +44 -0
- package/node/hooks/utils/useRunOnce.js +27 -0
- package/node/index.js +1 -13
- package/node/internals/index.js +86 -71
- package/node/internals/utils/index.js +11 -0
- package/node/internals/utils/propValidation.js +26 -0
- 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/createSelector.js +1 -1
- package/node/utils/exportAs.js +1 -1
- package/node/utils/utils.js +11 -1
- package/package.json +6 -6
- package/utils/createSelector.js +1 -1
- package/utils/exportAs.js +1 -1
- 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
|
@@ -12,7 +12,7 @@ import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
|
12
12
|
import { isNavigationKey } from '../../../utils/keyboardUtils';
|
|
13
13
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
14
14
|
import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
|
|
15
|
-
import {
|
|
15
|
+
import { gridFocusColumnGroupHeaderSelector } from '../focus';
|
|
16
16
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
|
|
17
17
|
import { gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
|
|
18
18
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
@@ -140,10 +140,6 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
140
140
|
// There is one exception for the checkBoxHeader
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
var dimensions = apiRef.current.getRootDimensions();
|
|
144
|
-
if (!dimensions) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
143
|
var viewportPageSize = apiRef.current.getViewportPageSize();
|
|
148
144
|
var colIndexBefore = params.field ? apiRef.current.getColumnIndex(params.field) : 0;
|
|
149
145
|
var firstRowIndexInPage = currentPageRows.length > 0 ? 0 : null;
|
|
@@ -236,10 +232,6 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
236
232
|
}
|
|
237
233
|
}, [apiRef, currentPageRows.length, headerFilteringEnabled, goToHeaderFilter, goToCell, getRowIdFromIndex, theme.direction, goToHeader, goToGroupHeader]);
|
|
238
234
|
var handleHeaderFilterKeyDown = React.useCallback(function (params, event) {
|
|
239
|
-
var dimensions = apiRef.current.getRootDimensions();
|
|
240
|
-
if (!dimensions) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
235
|
var isEditing = gridHeaderFilteringEditFieldSelector(apiRef) === params.field;
|
|
244
236
|
var isHeaderMenuOpen = gridHeaderFilteringMenuSelector(apiRef) === params.field;
|
|
245
237
|
if (isEditing || isHeaderMenuOpen || !isNavigationKey(event.key)) {
|
|
@@ -326,11 +318,7 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
326
318
|
}
|
|
327
319
|
}, [apiRef, currentPageRows.length, goToHeaderFilter, theme.direction, goToHeader, goToCell, getRowIdFromIndex]);
|
|
328
320
|
var handleColumnGroupHeaderKeyDown = React.useCallback(function (params, event) {
|
|
329
|
-
var
|
|
330
|
-
if (!dimensions) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
var focusedColumnGroup = unstable_gridFocusColumnGroupHeaderSelector(apiRef);
|
|
321
|
+
var focusedColumnGroup = gridFocusColumnGroupHeaderSelector(apiRef);
|
|
334
322
|
if (focusedColumnGroup === null) {
|
|
335
323
|
return;
|
|
336
324
|
}
|
|
@@ -429,8 +417,7 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
429
417
|
if (!canUpdateFocus) {
|
|
430
418
|
return;
|
|
431
419
|
}
|
|
432
|
-
|
|
433
|
-
if (currentPageRows.length === 0 || !dimensions) {
|
|
420
|
+
if (currentPageRows.length === 0) {
|
|
434
421
|
return;
|
|
435
422
|
}
|
|
436
423
|
var direction = theme.direction;
|
|
@@ -10,7 +10,7 @@ export var getPageCount = function getPageCount(rowCount, pageSize) {
|
|
|
10
10
|
}
|
|
11
11
|
return 0;
|
|
12
12
|
};
|
|
13
|
-
export var noRowCountInServerMode = buildWarning(["MUI: the 'rowCount' prop is undefined while using paginationMode='server'", 'For more detail, see http://mui.com/components/data-grid/pagination/#basic-implementation'], 'error');
|
|
13
|
+
export var noRowCountInServerMode = buildWarning(["MUI X: the 'rowCount' prop is undefined while using paginationMode='server'", 'For more detail, see http://mui.com/components/data-grid/pagination/#basic-implementation'], 'error');
|
|
14
14
|
export var getDefaultGridPaginationModel = function getDefaultGridPaginationModel(autoPageSize) {
|
|
15
15
|
return {
|
|
16
16
|
page: 0,
|
|
@@ -26,6 +26,6 @@ export var getValidPage = function getValidPage(page) {
|
|
|
26
26
|
};
|
|
27
27
|
export var throwIfPageSizeExceedsTheLimit = function throwIfPageSizeExceedsTheLimit(pageSize, signatureProp) {
|
|
28
28
|
if (signatureProp === GridSignature.DataGrid && pageSize > MAX_PAGE_SIZE) {
|
|
29
|
-
throw new Error(['MUI: `pageSize` cannot exceed 100 in the MIT version of the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
29
|
+
throw new Error(['MUI X: `pageSize` cannot exceed 100 in the MIT version of the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -5,7 +5,6 @@ import { gridDensityFactorSelector } from '../density';
|
|
|
5
5
|
import { useGridLogger, useGridSelector, useGridApiMethod, useGridApiEventHandler } from '../../utils';
|
|
6
6
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
7
7
|
import { gridPaginationModelSelector } from './gridPaginationSelector';
|
|
8
|
-
import { calculatePinnedRowsHeight } from '../rows/gridRowsUtils';
|
|
9
8
|
import { getPageCount, noRowCountInServerMode, defaultPageSize, throwIfPageSizeExceedsTheLimit, getDefaultGridPaginationModel, getValidPage } from './gridPaginationUtils';
|
|
10
9
|
export var paginationStateInitializer = function paginationStateInitializer(state, props) {
|
|
11
10
|
var _props$paginationMode, _props$initialState;
|
|
@@ -146,12 +145,11 @@ export var useGridPagination = function useGridPagination(apiRef, props) {
|
|
|
146
145
|
apiRef.current.forceUpdate();
|
|
147
146
|
};
|
|
148
147
|
var handleUpdateAutoPageSize = React.useCallback(function () {
|
|
149
|
-
|
|
150
|
-
if (!props.autoPageSize || !dimensions) {
|
|
148
|
+
if (!props.autoPageSize) {
|
|
151
149
|
return;
|
|
152
150
|
}
|
|
153
|
-
var
|
|
154
|
-
var maximumPageSizeWithoutScrollBar = Math.floor(
|
|
151
|
+
var dimensions = apiRef.current.getRootDimensions();
|
|
152
|
+
var maximumPageSizeWithoutScrollBar = Math.floor(dimensions.viewportInnerSize.height / rowHeight);
|
|
155
153
|
apiRef.current.setPageSize(maximumPageSizeWithoutScrollBar);
|
|
156
154
|
}, [apiRef, props.autoPageSize, rowHeight]);
|
|
157
155
|
useGridApiEventHandler(apiRef, 'viewportInnerSizeChange', handleUpdateAutoPageSize);
|
|
@@ -101,7 +101,7 @@ export var useGridRowSelection = function useGridRowSelection(apiRef, props) {
|
|
|
101
101
|
*/
|
|
102
102
|
var setRowSelectionModel = React.useCallback(function (model) {
|
|
103
103
|
if (props.signature === GridSignature.DataGrid && !canHaveMultipleSelection && Array.isArray(model) && model.length > 1) {
|
|
104
|
-
throw new Error(['MUI: `rowSelectionModel` can only contain 1 item in DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
|
|
104
|
+
throw new Error(['MUI X: `rowSelectionModel` can only contain 1 item in DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
|
|
105
105
|
}
|
|
106
106
|
var currentModel = gridRowSelectionStateSelector(apiRef.current.state);
|
|
107
107
|
if (currentModel !== model) {
|
|
@@ -61,23 +61,23 @@ export var gridAdditionalRowGroupsSelector = createSelector(gridRowsStateSelecto
|
|
|
61
61
|
* @ignore - do not document.
|
|
62
62
|
*/
|
|
63
63
|
export var gridPinnedRowsSelector = createSelectorMemoized(gridAdditionalRowGroupsSelector, function (additionalRowGroups) {
|
|
64
|
-
var _rawPinnedRows$bottom, _rawPinnedRows$top;
|
|
64
|
+
var _rawPinnedRows$bottom, _rawPinnedRows$bottom2, _rawPinnedRows$top$ma, _rawPinnedRows$top;
|
|
65
65
|
var rawPinnedRows = additionalRowGroups == null ? void 0 : additionalRowGroups.pinnedRows;
|
|
66
66
|
return {
|
|
67
|
-
bottom: rawPinnedRows == null || (_rawPinnedRows$
|
|
67
|
+
bottom: (_rawPinnedRows$bottom = rawPinnedRows == null || (_rawPinnedRows$bottom2 = rawPinnedRows.bottom) == null ? void 0 : _rawPinnedRows$bottom2.map(function (rowEntry) {
|
|
68
68
|
var _rowEntry$model;
|
|
69
69
|
return {
|
|
70
70
|
id: rowEntry.id,
|
|
71
71
|
model: (_rowEntry$model = rowEntry.model) != null ? _rowEntry$model : {}
|
|
72
72
|
};
|
|
73
|
-
}),
|
|
74
|
-
top: rawPinnedRows == null || (_rawPinnedRows$top = rawPinnedRows.top) == null ? void 0 : _rawPinnedRows$top.map(function (rowEntry) {
|
|
73
|
+
})) != null ? _rawPinnedRows$bottom : [],
|
|
74
|
+
top: (_rawPinnedRows$top$ma = rawPinnedRows == null || (_rawPinnedRows$top = rawPinnedRows.top) == null ? void 0 : _rawPinnedRows$top.map(function (rowEntry) {
|
|
75
75
|
var _rowEntry$model2;
|
|
76
76
|
return {
|
|
77
77
|
id: rowEntry.id,
|
|
78
78
|
model: (_rowEntry$model2 = rowEntry.model) != null ? _rowEntry$model2 : {}
|
|
79
79
|
};
|
|
80
|
-
})
|
|
80
|
+
})) != null ? _rawPinnedRows$top$ma : []
|
|
81
81
|
};
|
|
82
82
|
});
|
|
83
83
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import { gridPinnedRowsSelector } from './gridRowsSelector';
|
|
4
|
-
import {
|
|
4
|
+
import { gridDimensionsSelector } from '../dimensions';
|
|
5
5
|
export var GRID_ROOT_GROUP_ID = "auto-generated-group-node-root";
|
|
6
6
|
export var GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
|
|
7
7
|
export var buildRootGroup = function buildRootGroup() {
|
|
@@ -28,7 +28,7 @@ export var buildRootGroup = function buildRootGroup() {
|
|
|
28
28
|
export function checkGridRowIdIsValid(id, row) {
|
|
29
29
|
var detailErrorMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'A row was provided without id in the rows prop:';
|
|
30
30
|
if (id == null) {
|
|
31
|
-
throw new Error(['MUI: The data grid component requires all rows to have a unique `id` property.', 'Alternatively, you can use the `getRowId` prop to specify a custom id for each row.', detailErrorMessage, JSON.stringify(row)].join('\n'));
|
|
31
|
+
throw new Error(['MUI X: The data grid component requires all rows to have a unique `id` property.', 'Alternatively, you can use the `getRowId` prop to specify a custom id for each row.', detailErrorMessage, JSON.stringify(row)].join('\n'));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
export var getRowIdFromRowModel = function getRowIdFromRowModel(rowModel, getRowId, detailErrorMessage) {
|
|
@@ -148,7 +148,7 @@ export var updateCacheWithNewRows = function updateCacheWithNewRows(_ref4) {
|
|
|
148
148
|
getRowId = _ref4.getRowId,
|
|
149
149
|
updates = _ref4.updates;
|
|
150
150
|
if (previousCache.updates.type === 'full') {
|
|
151
|
-
throw new Error('MUI: Unable to prepare a partial update if a full update is not applied yet');
|
|
151
|
+
throw new Error('MUI X: Unable to prepare a partial update if a full update is not applied yet.');
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// Remove duplicate updates.
|
|
@@ -285,7 +285,7 @@ export function calculatePinnedRowsHeight(apiRef) {
|
|
|
285
285
|
bottom: bottomPinnedRowsHeight
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
export function getMinimalContentHeight(apiRef
|
|
289
|
-
var
|
|
290
|
-
return "var(--DataGrid-overlayHeight, ".concat(2 *
|
|
288
|
+
export function getMinimalContentHeight(apiRef) {
|
|
289
|
+
var dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
290
|
+
return "var(--DataGrid-overlayHeight, ".concat(2 * dimensions.rowHeight, "px)");
|
|
291
291
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
4
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
6
|
import _wrapNativeSuper from "@babel/runtime/helpers/esm/wrapNativeSuper";
|
|
7
|
-
function
|
|
8
|
-
function _isNativeReflectConstruct() {
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { getGridCellElement, getGridColumnHeaderElement, getGridRowElement } from '../../../utils/domUtils';
|
|
11
11
|
import { GRID_ID_AUTOGENERATED } from './gridRowsUtils';
|
|
@@ -13,10 +13,9 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
|
13
13
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
|
|
14
14
|
export var MissingRowIdError = /*#__PURE__*/function (_Error) {
|
|
15
15
|
_inherits(MissingRowIdError, _Error);
|
|
16
|
-
var _super = _createSuper(MissingRowIdError);
|
|
17
16
|
function MissingRowIdError() {
|
|
18
17
|
_classCallCheck(this, MissingRowIdError);
|
|
19
|
-
return
|
|
18
|
+
return _callSuper(this, MissingRowIdError, arguments);
|
|
20
19
|
}
|
|
21
20
|
return _createClass(MissingRowIdError);
|
|
22
21
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
@@ -124,7 +124,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
124
124
|
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
|
|
125
125
|
var updateRows = React.useCallback(function (updates) {
|
|
126
126
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
127
|
-
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
127
|
+
throw new Error(["MUI X: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
128
128
|
}
|
|
129
129
|
var nonPinnedRowsUpdates = [];
|
|
130
130
|
updates.forEach(function (update) {
|
|
@@ -171,10 +171,10 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
171
171
|
var setRowChildrenExpansion = React.useCallback(function (id, isExpanded) {
|
|
172
172
|
var currentNode = apiRef.current.getRowNode(id);
|
|
173
173
|
if (!currentNode) {
|
|
174
|
-
throw new Error("MUI: No row with id #".concat(id, " found"));
|
|
174
|
+
throw new Error("MUI X: No row with id #".concat(id, " found."));
|
|
175
175
|
}
|
|
176
176
|
if (currentNode.type !== 'group') {
|
|
177
|
-
throw new Error('MUI: Only group nodes can be expanded or collapsed');
|
|
177
|
+
throw new Error('MUI X: Only group nodes can be expanded or collapsed.');
|
|
178
178
|
}
|
|
179
179
|
var newNode = _extends({}, currentNode, {
|
|
180
180
|
childrenExpanded: isExpanded
|
|
@@ -231,13 +231,13 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
231
231
|
var setRowIndex = React.useCallback(function (rowId, targetIndex) {
|
|
232
232
|
var node = apiRef.current.getRowNode(rowId);
|
|
233
233
|
if (!node) {
|
|
234
|
-
throw new Error("MUI: No row with id #".concat(rowId, " found"));
|
|
234
|
+
throw new Error("MUI X: No row with id #".concat(rowId, " found."));
|
|
235
235
|
}
|
|
236
236
|
if (node.parent !== GRID_ROOT_GROUP_ID) {
|
|
237
|
-
throw new Error("MUI: The row reordering do not support reordering of grouped rows yet");
|
|
237
|
+
throw new Error("MUI X: The row reordering do not support reordering of grouped rows yet.");
|
|
238
238
|
}
|
|
239
239
|
if (node.type !== 'leaf') {
|
|
240
|
-
throw new Error("MUI: The row reordering do not support reordering of footer or grouping rows");
|
|
240
|
+
throw new Error("MUI X: The row reordering do not support reordering of footer or grouping rows.");
|
|
241
241
|
}
|
|
242
242
|
apiRef.current.setState(function (state) {
|
|
243
243
|
var group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
|
|
@@ -263,7 +263,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
263
263
|
}, [apiRef, logger]);
|
|
264
264
|
var replaceRows = React.useCallback(function (firstRowToRender, newRows) {
|
|
265
265
|
if (props.signature === GridSignature.DataGrid && newRows.length > 1) {
|
|
266
|
-
throw new Error(["MUI: You can't replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
266
|
+
throw new Error(["MUI X: You can't replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
267
267
|
}
|
|
268
268
|
if (newRows.length === 0) {
|
|
269
269
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { unstable_debounce as debounce
|
|
3
|
+
import { unstable_debounce as debounce } from '@mui/utils';
|
|
4
4
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
5
5
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
6
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
@@ -11,6 +11,9 @@ import { gridSortModelSelector } from '../sorting/gridSortingSelector';
|
|
|
11
11
|
import { useGridRegisterPipeApplier } from '../../core/pipeProcessing';
|
|
12
12
|
import { gridPinnedRowsSelector } from './gridRowsSelector';
|
|
13
13
|
import { DATA_GRID_PROPS_DEFAULT_VALUES } from '../../../DataGrid/useDataGridProps';
|
|
14
|
+
|
|
15
|
+
// TODO: I think the row heights can now be encoded as a single `size` instead of `sizes.baseXxxx`
|
|
16
|
+
|
|
14
17
|
export var rowsMetaStateInitializer = function rowsMetaStateInitializer(state) {
|
|
15
18
|
return _extends({}, state, {
|
|
16
19
|
rowsMeta: {
|
|
@@ -30,8 +33,8 @@ var getValidRowHeight = function getValidRowHeight(rowHeightProp, defaultRowHeig
|
|
|
30
33
|
}
|
|
31
34
|
return defaultRowHeight;
|
|
32
35
|
};
|
|
33
|
-
var rowHeightWarning = ["MUI: The `rowHeight` prop should be a number greater than 0.", "The default value will be used instead."].join('\n');
|
|
34
|
-
var getRowHeightWarning = ["MUI: The `getRowHeight` prop should return a number greater than 0 or 'auto'.", "The default value will be used instead."].join('\n');
|
|
36
|
+
var rowHeightWarning = ["MUI X: The `rowHeight` prop should be a number greater than 0.", "The default value will be used instead."].join('\n');
|
|
37
|
+
var getRowHeightWarning = ["MUI X: The `getRowHeight` prop should return a number greater than 0 or 'auto'.", "The default value will be used instead."].join('\n');
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
40
|
* @requires useGridPageSize (method)
|
|
@@ -180,15 +183,15 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
180
183
|
var debouncedHydrateRowsMeta = React.useMemo(function () {
|
|
181
184
|
return debounce(hydrateRowsMeta, props.rowPositionsDebounceMs);
|
|
182
185
|
}, [hydrateRowsMeta, props.rowPositionsDebounceMs]);
|
|
183
|
-
var storeMeasuredRowHeight = React.useCallback(function (id, height
|
|
186
|
+
var storeMeasuredRowHeight = React.useCallback(function (id, height) {
|
|
184
187
|
if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
|
|
185
188
|
return;
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
// Only trigger hydration if the value is different, otherwise we trigger a loop
|
|
189
|
-
var needsHydration = rowsHeightLookup.current[id].sizes
|
|
192
|
+
var needsHydration = rowsHeightLookup.current[id].sizes.baseCenter !== height;
|
|
190
193
|
rowsHeightLookup.current[id].needsFirstMeasurement = false;
|
|
191
|
-
rowsHeightLookup.current[id].sizes
|
|
194
|
+
rowsHeightLookup.current[id].sizes.baseCenter = height;
|
|
192
195
|
if (needsHydration) {
|
|
193
196
|
debouncedHydrateRowsMeta();
|
|
194
197
|
}
|
|
@@ -9,7 +9,7 @@ import { gridRowCountSelector } from '../rows/gridRowsSelector';
|
|
|
9
9
|
import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
|
|
10
10
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
11
11
|
import { gridExpandedSortedRowEntriesSelector } from '../filter/gridFilterSelector';
|
|
12
|
-
import {
|
|
12
|
+
import { gridDimensionsSelector } from '../dimensions';
|
|
13
13
|
|
|
14
14
|
// Logic copied from https://www.w3.org/TR/wai-aria-practices/examples/listbox/js/listbox.js
|
|
15
15
|
// Similar to https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
@@ -48,6 +48,7 @@ export var useGridScroll = function useGridScroll(apiRef, props) {
|
|
|
48
48
|
var virtualScrollerRef = apiRef.current.virtualScrollerRef;
|
|
49
49
|
var visibleSortedRows = useGridSelector(apiRef, gridExpandedSortedRowEntriesSelector);
|
|
50
50
|
var scrollToIndexes = React.useCallback(function (params) {
|
|
51
|
+
var dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
51
52
|
var totalRowCount = gridRowCountSelector(apiRef);
|
|
52
53
|
var visibleColumns = gridVisibleColumnDefinitionsSelector(apiRef);
|
|
53
54
|
var scrollToHeader = params.rowIndex == null;
|
|
@@ -56,7 +57,7 @@ export var useGridScroll = function useGridScroll(apiRef, props) {
|
|
|
56
57
|
}
|
|
57
58
|
logger.debug("Scrolling to cell at row ".concat(params.rowIndex, ", col: ").concat(params.colIndex, " "));
|
|
58
59
|
var scrollCoordinates = {};
|
|
59
|
-
if (params.colIndex
|
|
60
|
+
if (params.colIndex !== undefined) {
|
|
60
61
|
var columnPositions = gridColumnPositionsSelector(apiRef);
|
|
61
62
|
var cellWidth;
|
|
62
63
|
if (typeof params.rowIndex !== 'undefined') {
|
|
@@ -72,23 +73,20 @@ export var useGridScroll = function useGridScroll(apiRef, props) {
|
|
|
72
73
|
}
|
|
73
74
|
// When using RTL, `scrollLeft` becomes negative, so we must ensure that we only compare values.
|
|
74
75
|
scrollCoordinates.left = scrollIntoView({
|
|
75
|
-
clientHeight:
|
|
76
|
+
clientHeight: dimensions.viewportInnerSize.width,
|
|
76
77
|
scrollTop: Math.abs(virtualScrollerRef.current.scrollLeft),
|
|
77
78
|
offsetHeight: cellWidth,
|
|
78
79
|
offsetTop: columnPositions[params.colIndex]
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
|
-
if (params.rowIndex
|
|
82
|
-
var _querySelector, _querySelector2;
|
|
82
|
+
if (params.rowIndex !== undefined) {
|
|
83
83
|
var rowsMeta = gridRowsMetaSelector(apiRef.current.state);
|
|
84
84
|
var page = gridPageSelector(apiRef);
|
|
85
85
|
var pageSize = gridPageSizeSelector(apiRef);
|
|
86
86
|
var elementIndex = !props.pagination ? params.rowIndex : params.rowIndex - page * pageSize;
|
|
87
87
|
var targetOffsetHeight = rowsMeta.positions[elementIndex + 1] ? rowsMeta.positions[elementIndex + 1] - rowsMeta.positions[elementIndex] : rowsMeta.currentPageTotalHeight - rowsMeta.positions[elementIndex];
|
|
88
|
-
var topPinnedRowsHeight = ((_querySelector = virtualScrollerRef.current.querySelector(".".concat(gridClasses['pinnedRows--top']))) == null ? void 0 : _querySelector.clientHeight) || 0;
|
|
89
|
-
var bottomPinnedRowsHeight = ((_querySelector2 = virtualScrollerRef.current.querySelector(".".concat(gridClasses['pinnedRows--bottom']))) == null ? void 0 : _querySelector2.clientHeight) || 0;
|
|
90
88
|
scrollCoordinates.top = scrollIntoView({
|
|
91
|
-
clientHeight:
|
|
89
|
+
clientHeight: dimensions.viewportInnerSize.height,
|
|
92
90
|
scrollTop: virtualScrollerRef.current.scrollTop,
|
|
93
91
|
offsetHeight: targetOffsetHeight,
|
|
94
92
|
offsetTop: rowsMeta.positions[elementIndex]
|
|
@@ -102,13 +100,13 @@ export var useGridScroll = function useGridScroll(apiRef, props) {
|
|
|
102
100
|
return false;
|
|
103
101
|
}, [logger, apiRef, virtualScrollerRef, props.pagination, visibleSortedRows]);
|
|
104
102
|
var scroll = React.useCallback(function (params) {
|
|
105
|
-
if (virtualScrollerRef.current && params.left
|
|
103
|
+
if (virtualScrollerRef.current && params.left !== undefined && colRef.current) {
|
|
106
104
|
var direction = theme.direction === 'rtl' ? -1 : 1;
|
|
107
105
|
colRef.current.scrollLeft = params.left;
|
|
108
106
|
virtualScrollerRef.current.scrollLeft = direction * params.left;
|
|
109
107
|
logger.debug("Scrolling left: ".concat(params.left));
|
|
110
108
|
}
|
|
111
|
-
if (virtualScrollerRef.current && params.top
|
|
109
|
+
if (virtualScrollerRef.current && params.top !== undefined) {
|
|
112
110
|
virtualScrollerRef.current.scrollTop = params.top;
|
|
113
111
|
logger.debug("Scrolling top: ".concat(params.top));
|
|
114
112
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { buildWarning } from '../../../utils/warning';
|
|
3
|
-
var sortModelDisableMultiColumnsSortingWarning = buildWarning(['MUI: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
|
|
3
|
+
var sortModelDisableMultiColumnsSortingWarning = buildWarning(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
|
|
4
4
|
export var sanitizeSortModel = function sanitizeSortModel(model, disableMultipleColumnsSorting) {
|
|
5
5
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
6
|
-
|
|
6
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
+
sortModelDisableMultiColumnsSortingWarning();
|
|
8
|
+
}
|
|
7
9
|
return [model[0]];
|
|
8
10
|
}
|
|
9
11
|
return model;
|
|
@@ -29,7 +31,7 @@ var isDesc = function isDesc(direction) {
|
|
|
29
31
|
*/
|
|
30
32
|
var parseSortItem = function parseSortItem(sortItem, apiRef) {
|
|
31
33
|
var column = apiRef.current.getColumn(sortItem.field);
|
|
32
|
-
if (!column) {
|
|
34
|
+
if (!column || sortItem.sort === null) {
|
|
33
35
|
return null;
|
|
34
36
|
}
|
|
35
37
|
var comparator = isDesc(sortItem.sort) ? function () {
|
|
@@ -65,7 +65,7 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
|
|
|
65
65
|
if (existing) {
|
|
66
66
|
var _col$sortingOrder;
|
|
67
67
|
var nextSort = directionOverride === undefined ? getNextGridSortDirection((_col$sortingOrder = col.sortingOrder) != null ? _col$sortingOrder : props.sortingOrder, existing.sort) : directionOverride;
|
|
68
|
-
return nextSort
|
|
68
|
+
return nextSort === undefined ? undefined : _extends({}, existing, {
|
|
69
69
|
sort: nextSort
|
|
70
70
|
});
|
|
71
71
|
}
|
|
@@ -75,7 +75,7 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
|
|
|
75
75
|
};
|
|
76
76
|
}, [apiRef, props.sortingOrder]);
|
|
77
77
|
var addColumnMenuItem = React.useCallback(function (columnMenuItems, colDef) {
|
|
78
|
-
if (colDef == null || colDef.sortable === false) {
|
|
78
|
+
if (colDef == null || colDef.sortable === false || props.disableColumnSorting) {
|
|
79
79
|
return columnMenuItems;
|
|
80
80
|
}
|
|
81
81
|
var sortingOrder = colDef.sortingOrder || props.sortingOrder;
|
|
@@ -85,7 +85,7 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
|
|
|
85
85
|
return [].concat(_toConsumableArray(columnMenuItems), ['columnMenuSortItem']);
|
|
86
86
|
}
|
|
87
87
|
return columnMenuItems;
|
|
88
|
-
}, [props.sortingOrder]);
|
|
88
|
+
}, [props.sortingOrder, props.disableColumnSorting]);
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* API METHODS
|
|
@@ -125,9 +125,6 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
|
|
|
125
125
|
}, [apiRef, logger, props.disableMultipleColumnsSorting]);
|
|
126
126
|
var sortColumn = React.useCallback(function (field, direction, allowMultipleSorting) {
|
|
127
127
|
var column = apiRef.current.getColumn(field);
|
|
128
|
-
if (!column.sortable) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
128
|
var sortItem = createSortItem(column, direction);
|
|
132
129
|
var sortModel;
|
|
133
130
|
if (!allowMultipleSorting || props.disableMultipleColumnsSorting) {
|
|
@@ -217,17 +214,25 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
|
|
|
217
214
|
* EVENTS
|
|
218
215
|
*/
|
|
219
216
|
var handleColumnHeaderClick = React.useCallback(function (_ref2, event) {
|
|
220
|
-
var field = _ref2.field
|
|
217
|
+
var field = _ref2.field,
|
|
218
|
+
colDef = _ref2.colDef;
|
|
219
|
+
if (!colDef.sortable || props.disableColumnSorting) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
221
222
|
var allowMultipleSorting = event.shiftKey || event.metaKey || event.ctrlKey;
|
|
222
223
|
sortColumn(field, undefined, allowMultipleSorting);
|
|
223
|
-
}, [sortColumn]);
|
|
224
|
+
}, [sortColumn, props.disableColumnSorting]);
|
|
224
225
|
var handleColumnHeaderKeyDown = React.useCallback(function (_ref3, event) {
|
|
225
|
-
var field = _ref3.field
|
|
226
|
+
var field = _ref3.field,
|
|
227
|
+
colDef = _ref3.colDef;
|
|
228
|
+
if (!colDef.sortable || props.disableColumnSorting) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
226
231
|
// Ctrl + Enter opens the column menu
|
|
227
232
|
if (isEnterKey(event.key) && !event.ctrlKey && !event.metaKey) {
|
|
228
233
|
sortColumn(field, undefined, event.shiftKey);
|
|
229
234
|
}
|
|
230
|
-
}, [sortColumn]);
|
|
235
|
+
}, [sortColumn, props.disableColumnSorting]);
|
|
231
236
|
var handleColumnsChange = React.useCallback(function () {
|
|
232
237
|
// When the columns change we check that the sorted columns are still part of the dataset
|
|
233
238
|
var sortModel = gridSortModelSelector(apiRef);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSelector } from '../../../utils/createSelector';
|
|
1
|
+
import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
|
|
2
2
|
/**
|
|
3
3
|
* Get the columns state
|
|
4
4
|
* @category Virtualization
|
|
@@ -21,4 +21,32 @@ export var gridVirtualizationEnabledSelector = createSelector(gridVirtualization
|
|
|
21
21
|
*/
|
|
22
22
|
export var gridVirtualizationColumnEnabledSelector = createSelector(gridVirtualizationSelector, function (state) {
|
|
23
23
|
return state.enabledForColumns;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the render context
|
|
28
|
+
* @category Virtualization
|
|
29
|
+
* @ignore - do not document.
|
|
30
|
+
*/
|
|
31
|
+
export var gridRenderContextSelector = createSelector(gridVirtualizationSelector, function (state) {
|
|
32
|
+
return state.renderContext;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the render context, with only columns filled in.
|
|
37
|
+
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
38
|
+
* @category Virtualization
|
|
39
|
+
* @ignore - do not document.
|
|
40
|
+
*/
|
|
41
|
+
export var gridRenderContextColumnsSelector = createSelectorMemoized(function (state) {
|
|
42
|
+
return state.virtualization.renderContext.firstColumnIndex;
|
|
43
|
+
}, function (state) {
|
|
44
|
+
return state.virtualization.renderContext.lastColumnIndex;
|
|
45
|
+
}, function (firstColumnIndex, lastColumnIndex) {
|
|
46
|
+
return {
|
|
47
|
+
firstRowIndex: -1,
|
|
48
|
+
lastRowIndex: -1,
|
|
49
|
+
firstColumnIndex: firstColumnIndex,
|
|
50
|
+
lastColumnIndex: lastColumnIndex
|
|
51
|
+
};
|
|
24
52
|
});
|