@mui/x-data-grid 5.7.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +241 -53
- package/DataGrid/DataGrid.d.ts +8 -3
- package/DataGrid/DataGrid.js +28 -5
- package/DataGrid/useDataGridComponent.js +5 -5
- package/DataGrid/useDataGridProps.d.ts +2 -1
- package/LICENSE +21 -0
- package/README.md +6 -4
- package/colDef/gridBooleanColDef.d.ts +1 -1
- package/colDef/gridBooleanOperators.d.ts +1 -1
- package/colDef/gridDateColDef.d.ts +5 -9
- package/colDef/gridDateColDef.js +2 -2
- package/colDef/gridDateOperators.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/colDef/gridNumericColDef.d.ts +1 -1
- package/colDef/gridNumericOperators.d.ts +2 -2
- package/colDef/gridStringColDef.d.ts +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/index.d.ts +1 -0
- package/colDef/index.js +2 -1
- package/components/GridRow.d.ts +4 -0
- package/components/GridRow.js +55 -24
- package/components/base/GridOverlays.js +4 -3
- package/components/cell/GridActionsCell.d.ts +5 -1
- package/components/cell/GridActionsCell.js +170 -21
- package/components/cell/GridActionsCellItem.d.ts +66 -4
- package/components/cell/GridActionsCellItem.js +7 -5
- package/components/cell/GridCell.d.ts +5 -4
- package/components/cell/GridCell.js +30 -9
- package/components/cell/GridEditInputCell.js +3 -3
- package/components/cell/GridEditSingleSelectCell.js +24 -15
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +12 -0
- package/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/components/columnHeaders/GridColumnHeaderItem.js +9 -12
- package/components/columnHeaders/GridColumnHeaders.d.ts +0 -1
- package/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/components/columnHeaders/index.d.ts +1 -0
- package/components/columnHeaders/index.js +1 -0
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +3 -3
- package/components/columnSelection/GridCellCheckboxRenderer.js +22 -5
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +29 -17
- package/components/containers/GridRootStyles.js +36 -1
- package/components/menu/GridMenu.js +1 -0
- package/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +2 -2
- package/components/panel/GridPanel.js +1 -0
- package/components/panel/GridPreferencesPanel.js +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -15
- package/components/panel/filterPanel/GridFilterInputValue.js +22 -15
- package/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +2 -0
- package/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/constants/defaultGridSlotsComponents.js +4 -2
- package/constants/gridClasses.d.ts +35 -3
- package/constants/gridClasses.js +1 -1
- package/constants/gridDetailPanelToggleField.d.ts +1 -0
- package/constants/gridDetailPanelToggleField.js +2 -0
- package/constants/localeTextConstants.js +3 -1
- package/hooks/core/index.d.ts +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +85 -0
- package/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/hooks/core/pipeProcessing/index.d.ts +4 -0
- package/hooks/core/pipeProcessing/index.js +4 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +32 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +108 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +3 -0
- package/{modern/hooks/core/preProcessing/useGridRegisterPreProcessor.js → hooks/core/pipeProcessing/useGridRegisterPipeApplier.js} +2 -6
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +4 -0
- package/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -6
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +27 -16
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/hooks/core/useGridInitialization.js +2 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +0 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +77 -11
- package/hooks/features/columnMenu/useGridColumnMenu.js +2 -1
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +6 -6
- package/hooks/features/columns/gridColumnsUtils.d.ts +22 -4
- package/hooks/features/columns/gridColumnsUtils.js +105 -20
- package/hooks/features/columns/useGridColumnSpanning.d.ts +7 -0
- package/hooks/features/columns/useGridColumnSpanning.js +109 -0
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.js +55 -40
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +5 -4
- package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +40 -17
- package/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +44 -21
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +2 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +3 -9
- package/hooks/features/filter/useGridFilter.js +18 -13
- package/hooks/features/focus/useGridFocus.js +19 -9
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.d.ts +3 -5
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +66 -13
- package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -3
- package/hooks/features/pagination/useGridPage.js +9 -4
- package/hooks/features/pagination/useGridPageSize.js +3 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/hooks/features/rows/gridRowsSelector.d.ts +2 -1
- package/hooks/features/rows/gridRowsSelector.js +1 -0
- package/hooks/features/rows/gridRowsState.d.ts +4 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +8 -0
- package/hooks/features/rows/gridRowsUtils.js +11 -0
- package/hooks/features/rows/index.d.ts +1 -0
- package/hooks/features/rows/index.js +1 -1
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +27 -7
- package/hooks/features/rows/useGridRowsMeta.js +7 -14
- package/hooks/features/scroll/useGridScroll.d.ts +2 -0
- package/hooks/features/scroll/useGridScroll.js +27 -14
- package/hooks/features/selection/gridSelectionSelector.d.ts +1 -3
- package/hooks/features/selection/useGridSelection.d.ts +4 -2
- package/hooks/features/selection/useGridSelection.js +75 -27
- package/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/hooks/features/sorting/gridSortingSelector.d.ts +1 -3
- package/hooks/features/sorting/gridSortingUtils.d.ts +1 -2
- package/hooks/features/sorting/useGridSorting.js +13 -13
- package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +9 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +64 -27
- package/hooks/utils/useGridRootProps.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +4 -6
- package/internals/index.js +3 -3
- package/legacy/DataGrid/DataGrid.js +28 -5
- package/legacy/DataGrid/useDataGridComponent.js +5 -5
- package/legacy/colDef/gridDateColDef.js +2 -2
- package/legacy/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/legacy/colDef/index.js +2 -1
- package/legacy/components/GridRow.js +53 -24
- package/legacy/components/base/GridOverlays.js +4 -3
- package/legacy/components/cell/GridActionsCell.js +188 -27
- package/legacy/components/cell/GridActionsCellItem.js +7 -5
- package/legacy/components/cell/GridCell.js +31 -9
- package/legacy/components/cell/GridEditInputCell.js +3 -3
- package/legacy/components/cell/GridEditSingleSelectCell.js +35 -26
- package/legacy/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +9 -12
- package/legacy/components/columnHeaders/GridColumnHeaders.js +2 -3
- package/legacy/components/columnHeaders/index.js +1 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +23 -5
- package/legacy/components/containers/GridRoot.js +34 -17
- package/legacy/components/containers/GridRootStyles.js +26 -5
- package/legacy/components/menu/GridMenu.js +1 -0
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/legacy/components/panel/GridPanel.js +1 -0
- package/legacy/components/panel/GridPreferencesPanel.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -17
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +22 -17
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/legacy/components/virtualization/GridVirtualScroller.js +2 -0
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/legacy/constants/defaultGridSlotsComponents.js +4 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/gridDetailPanelToggleField.js +2 -0
- package/legacy/constants/localeTextConstants.js +3 -1
- package/legacy/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/legacy/hooks/core/pipeProcessing/index.js +4 -0
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +119 -0
- package/legacy/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeApplier.js} +2 -6
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +27 -0
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/legacy/hooks/core/useGridInitialization.js +2 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +90 -11
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +2 -1
- package/legacy/hooks/features/columns/gridColumnsUtils.js +120 -32
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/legacy/hooks/features/columns/useGridColumns.js +55 -40
- package/legacy/hooks/features/dimensions/useGridDimensions.js +5 -4
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +36 -15
- package/legacy/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +53 -30
- package/legacy/hooks/features/events/useGridEvents.js +2 -0
- package/legacy/hooks/features/filter/useGridFilter.js +18 -13
- package/legacy/hooks/features/focus/useGridFocus.js +19 -9
- package/legacy/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +66 -12
- package/legacy/hooks/features/pagination/useGridPage.js +11 -4
- package/legacy/hooks/features/pagination/useGridPageSize.js +3 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/legacy/hooks/features/rows/gridRowsSelector.js +3 -0
- package/legacy/hooks/features/rows/gridRowsUtils.js +13 -0
- package/legacy/hooks/features/rows/index.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +35 -9
- package/legacy/hooks/features/rows/useGridRowsMeta.js +7 -14
- package/legacy/hooks/features/scroll/useGridScroll.js +27 -14
- package/legacy/hooks/features/selection/useGridSelection.js +77 -27
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +8 -10
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +75 -37
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +3 -3
- package/legacy/locales/arSD.js +3 -1
- package/legacy/locales/bgBG.js +3 -1
- package/legacy/locales/csCZ.js +2 -0
- package/legacy/locales/daDK.js +37 -31
- package/legacy/locales/deDE.js +3 -1
- package/legacy/locales/elGR.js +2 -0
- package/legacy/locales/esES.js +2 -0
- package/legacy/locales/faIR.js +3 -1
- package/legacy/locales/fiFI.js +2 -0
- package/legacy/locales/frFR.js +2 -0
- package/legacy/locales/heIL.js +3 -1
- package/legacy/locales/huHU.js +122 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/itIT.js +2 -0
- package/legacy/locales/jaJP.js +2 -0
- package/legacy/locales/koKR.js +2 -0
- package/legacy/locales/nlNL.js +2 -0
- package/legacy/locales/plPL.js +3 -1
- package/legacy/locales/ptBR.js +3 -1
- package/legacy/locales/ruRU.js +2 -0
- package/legacy/locales/skSK.js +2 -0
- package/legacy/locales/trTR.js +3 -1
- package/legacy/locales/ukUA.js +2 -0
- package/legacy/locales/viVN.js +2 -0
- package/legacy/locales/zhCN.js +2 -0
- package/{modern/hooks/core/preProcessing/gridPreProcessingApi.js → legacy/models/api/gridColumnSpanning.js} +0 -0
- package/legacy/models/colDef/index.js +1 -2
- package/legacy/models/events/gridEvents.js +10 -3
- package/legacy/models/gridColumnSpanning.js +1 -0
- package/legacy/models/gridRows.js +1 -33
- package/legacy/models/index.js +2 -2
- package/legacy/models/params/gridPreferencePanelParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/locales/arSD.js +3 -1
- package/locales/bgBG.js +3 -1
- package/locales/csCZ.js +2 -0
- package/locales/daDK.js +33 -31
- package/locales/deDE.js +3 -1
- package/locales/elGR.js +2 -0
- package/locales/esES.js +2 -0
- package/locales/faIR.js +3 -1
- package/locales/fiFI.js +2 -0
- package/locales/frFR.js +2 -0
- package/locales/heIL.js +3 -1
- package/locales/huHU.d.ts +2 -0
- package/locales/huHU.js +110 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/itIT.js +2 -0
- package/locales/jaJP.js +2 -0
- package/locales/koKR.js +2 -0
- package/locales/nlNL.js +2 -0
- package/locales/plPL.js +3 -1
- package/locales/ptBR.js +3 -1
- package/locales/ruRU.js +2 -0
- package/locales/skSK.js +2 -0
- package/locales/trTR.js +3 -1
- package/locales/ukUA.js +2 -0
- package/locales/viVN.js +2 -0
- package/locales/zhCN.js +2 -0
- package/models/api/gridApiCommon.d.ts +3 -2
- package/models/api/gridColumnSpanning.d.ts +28 -0
- package/models/api/gridColumnSpanning.js +1 -0
- package/models/api/gridEditingApi.d.ts +51 -5
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/api/gridParamsApi.d.ts +5 -5
- package/models/api/gridRowApi.d.ts +8 -2
- package/models/colDef/gridColDef.d.ts +38 -28
- package/models/colDef/index.d.ts +0 -1
- package/models/colDef/index.js +1 -2
- package/models/events/gridEventLookup.d.ts +30 -9
- package/models/events/gridEvents.d.ts +50 -17
- package/models/events/gridEvents.js +10 -3
- package/models/gridCell.d.ts +1 -0
- package/models/gridColumnSpanning.d.ts +12 -0
- package/models/gridColumnSpanning.js +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +3 -2
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/gridRows.d.ts +10 -18
- package/models/gridRows.js +1 -31
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +1 -0
- package/models/gridSortModel.d.ts +3 -4
- package/models/index.d.ts +1 -1
- package/models/index.js +2 -2
- package/models/params/gridCellParams.d.ts +25 -15
- package/models/params/gridColumnHeaderParams.d.ts +3 -2
- package/models/params/gridEditCellParams.d.ts +2 -3
- package/models/params/gridPreferencePanelParams.d.ts +3 -0
- package/models/params/gridPreferencePanelParams.js +1 -0
- package/models/params/gridRowParams.d.ts +12 -8
- package/models/params/gridValueOptionsParams.d.ts +3 -3
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +37 -17
- package/modern/DataGrid/DataGrid.js +28 -5
- package/modern/DataGrid/useDataGridComponent.js +5 -5
- package/modern/colDef/gridDateColDef.js +2 -2
- package/modern/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/modern/colDef/index.js +2 -1
- package/modern/components/GridRow.js +53 -22
- package/modern/components/base/GridOverlays.js +4 -3
- package/modern/components/cell/GridActionsCell.js +168 -21
- package/modern/components/cell/GridActionsCellItem.js +7 -5
- package/modern/components/cell/GridCell.js +30 -9
- package/modern/components/cell/GridEditInputCell.js +3 -3
- package/modern/components/cell/GridEditSingleSelectCell.js +22 -13
- package/modern/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +7 -10
- package/modern/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/modern/components/columnHeaders/index.js +1 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +22 -5
- package/modern/components/containers/GridRoot.js +29 -17
- package/modern/components/containers/GridRootStyles.js +36 -1
- package/modern/components/menu/GridMenu.js +1 -0
- package/modern/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/modern/components/panel/GridPanel.js +1 -0
- package/modern/components/panel/GridPreferencesPanel.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterForm.js +10 -6
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +11 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +20 -13
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +20 -13
- package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +2 -0
- package/modern/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/modern/constants/defaultGridSlotsComponents.js +4 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/gridDetailPanelToggleField.js +2 -0
- package/modern/constants/localeTextConstants.js +3 -1
- package/modern/hooks/core/pipeProcessing/gridPipeProcessingApi.js +1 -0
- package/modern/hooks/core/pipeProcessing/index.js +4 -0
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +108 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +27 -0
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/modern/hooks/core/useGridInitialization.js +2 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +77 -11
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +2 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +105 -20
- package/modern/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/modern/hooks/features/columns/useGridColumns.js +55 -40
- package/modern/hooks/features/dimensions/useGridDimensions.js +5 -4
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +40 -17
- package/modern/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +44 -21
- package/modern/hooks/features/events/useGridEvents.js +2 -0
- package/modern/hooks/features/filter/useGridFilter.js +18 -13
- package/modern/hooks/features/focus/useGridFocus.js +19 -9
- package/modern/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +64 -13
- package/modern/hooks/features/pagination/useGridPage.js +9 -4
- package/modern/hooks/features/pagination/useGridPageSize.js +3 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +11 -0
- package/modern/hooks/features/rows/index.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +25 -5
- package/modern/hooks/features/rows/useGridRowsMeta.js +7 -14
- package/modern/hooks/features/scroll/useGridScroll.js +25 -10
- package/modern/hooks/features/selection/useGridSelection.js +75 -27
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/modern/hooks/features/sorting/useGridSorting.js +13 -13
- package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +64 -23
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -3
- package/modern/locales/arSD.js +3 -1
- package/modern/locales/bgBG.js +3 -1
- package/modern/locales/csCZ.js +2 -0
- package/modern/locales/daDK.js +33 -31
- package/modern/locales/deDE.js +3 -1
- package/modern/locales/elGR.js +2 -0
- package/modern/locales/esES.js +2 -0
- package/modern/locales/faIR.js +3 -1
- package/modern/locales/fiFI.js +2 -0
- package/modern/locales/frFR.js +2 -0
- package/modern/locales/heIL.js +3 -1
- package/modern/locales/huHU.js +110 -0
- package/modern/locales/index.js +1 -0
- package/modern/locales/itIT.js +2 -0
- package/modern/locales/jaJP.js +2 -0
- package/modern/locales/koKR.js +2 -0
- package/modern/locales/nlNL.js +2 -0
- package/modern/locales/plPL.js +3 -1
- package/modern/locales/ptBR.js +3 -1
- package/modern/locales/ruRU.js +2 -0
- package/modern/locales/skSK.js +2 -0
- package/modern/locales/trTR.js +3 -1
- package/modern/locales/ukUA.js +2 -0
- package/modern/locales/viVN.js +2 -0
- package/modern/locales/zhCN.js +2 -0
- package/modern/models/api/gridColumnSpanning.js +1 -0
- package/modern/models/colDef/index.js +1 -2
- package/modern/models/events/gridEvents.js +10 -3
- package/modern/models/gridColumnSpanning.js +1 -0
- package/modern/models/gridRows.js +1 -31
- package/modern/models/index.js +2 -2
- package/modern/models/params/gridPreferencePanelParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/node/DataGrid/DataGrid.js +28 -5
- package/node/DataGrid/useDataGridComponent.js +6 -6
- package/node/colDef/gridDateColDef.js +2 -2
- package/node/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/node/colDef/index.js +13 -0
- package/node/components/GridRow.js +56 -24
- package/node/components/base/GridOverlays.js +3 -2
- package/node/components/cell/GridActionsCell.js +172 -21
- package/node/components/cell/GridActionsCellItem.js +7 -4
- package/node/components/cell/GridCell.js +30 -9
- package/node/components/cell/GridEditInputCell.js +3 -3
- package/node/components/cell/GridEditSingleSelectCell.js +25 -15
- package/node/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +23 -5
- package/node/components/columnHeaders/GridColumnHeaderItem.js +9 -13
- package/node/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/node/components/columnHeaders/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +22 -5
- package/node/components/containers/GridRoot.js +28 -17
- package/node/components/containers/GridRootStyles.js +36 -1
- package/node/components/menu/GridMenu.js +1 -0
- package/node/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/node/components/panel/GridPanel.js +1 -0
- package/node/components/panel/GridPreferencesPanel.js +1 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +15 -10
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +14 -8
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +23 -15
- package/node/components/panel/filterPanel/GridFilterInputValue.js +23 -15
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +2 -0
- package/node/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/node/constants/defaultGridSlotsComponents.js +3 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/gridDetailPanelToggleField.js +9 -0
- package/node/constants/localeTextConstants.js +3 -1
- package/node/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/node/hooks/core/pipeProcessing/index.js +57 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +124 -0
- package/node/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeApplier.js} +4 -7
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +42 -0
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/node/hooks/core/useGridInitialization.js +2 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +81 -11
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +2 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +114 -25
- package/node/hooks/features/columns/useGridColumnSpanning.js +130 -0
- package/node/hooks/features/columns/useGridColumns.js +55 -40
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -4
- package/node/hooks/features/editRows/useGridCellEditing.new.js +42 -17
- package/node/hooks/features/editRows/useGridEditing.new.js +6 -2
- package/node/hooks/features/editRows/useGridRowEditing.new.js +45 -21
- package/node/hooks/features/events/useGridEvents.js +2 -0
- package/node/hooks/features/filter/useGridFilter.js +18 -13
- package/node/hooks/features/focus/useGridFocus.js +19 -9
- package/node/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +69 -13
- package/node/hooks/features/pagination/useGridPage.js +8 -3
- package/node/hooks/features/pagination/useGridPageSize.js +3 -3
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +20 -5
- package/node/hooks/features/rows/gridRowsSelector.js +3 -1
- package/node/hooks/features/rows/gridRowsUtils.js +18 -0
- package/node/hooks/features/rows/index.js +15 -1
- package/node/hooks/features/rows/useGridRows.js +29 -9
- package/node/hooks/features/rows/useGridRowsMeta.js +7 -15
- package/node/hooks/features/scroll/useGridScroll.js +28 -14
- package/node/hooks/features/selection/useGridSelection.js +75 -26
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/node/hooks/features/sorting/useGridSorting.js +13 -13
- package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +69 -27
- package/node/index.js +1 -1
- package/node/internals/index.js +12 -12
- package/node/locales/arSD.js +3 -1
- package/node/locales/bgBG.js +3 -1
- package/node/locales/csCZ.js +2 -0
- package/node/locales/daDK.js +33 -31
- package/node/locales/deDE.js +3 -1
- package/node/locales/elGR.js +2 -0
- package/node/locales/esES.js +2 -0
- package/node/locales/faIR.js +3 -1
- package/node/locales/fiFI.js +2 -0
- package/node/locales/frFR.js +2 -0
- package/node/locales/heIL.js +3 -1
- package/node/locales/huHU.js +120 -0
- package/node/locales/index.js +13 -0
- package/node/locales/itIT.js +2 -0
- package/node/locales/jaJP.js +2 -0
- package/node/locales/koKR.js +2 -0
- package/node/locales/nlNL.js +2 -0
- package/node/locales/plPL.js +3 -1
- package/node/locales/ptBR.js +3 -1
- package/node/locales/ruRU.js +2 -0
- package/node/locales/skSK.js +2 -0
- package/node/locales/trTR.js +3 -1
- package/node/locales/ukUA.js +2 -0
- package/node/locales/viVN.js +2 -0
- package/node/locales/zhCN.js +2 -0
- package/node/models/api/gridColumnSpanning.js +5 -0
- package/node/models/colDef/index.js +0 -13
- package/node/models/events/gridEvents.js +10 -3
- package/node/models/gridColumnSpanning.js +5 -0
- package/node/models/gridRows.js +1 -34
- package/node/models/index.js +13 -13
- package/node/models/params/gridPreferencePanelParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/package.json +4 -4
- package/utils/domUtils.d.ts +2 -2
- package/components/columnHeaders/ColumnHeaderFilterIcon.d.ts +0 -5
- package/hooks/core/preProcessing/gridPreProcessingApi.d.ts +0 -67
- package/hooks/core/preProcessing/index.d.ts +0 -3
- package/hooks/core/preProcessing/index.js +0 -3
- package/hooks/core/preProcessing/useGridPreProcessing.d.ts +0 -6
- package/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/hooks/core/preProcessing/useGridRegisterPreProcessor.d.ts +0 -7
- package/hooks/features/keyboard/useGridKeyboard.d.ts +0 -10
- package/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/legacy/hooks/core/preProcessing/index.js +0 -3
- package/legacy/hooks/core/preProcessing/useGridPreProcessing.js +0 -62
- package/legacy/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/modern/hooks/core/preProcessing/index.js +0 -3
- package/modern/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/modern/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/node/hooks/core/preProcessing/index.js +0 -44
- package/node/hooks/core/preProcessing/useGridPreProcessing.js +0 -72
- package/node/hooks/features/keyboard/useGridKeyboard.js +0 -91
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Implement the Pipeline Pattern
|
|
8
|
+
*
|
|
9
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
10
|
+
*
|
|
11
|
+
* Some plugins contains custom logic to enrich data provided by other plugins or components.
|
|
12
|
+
* For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.
|
|
13
|
+
*
|
|
14
|
+
* =====================================================================================================================
|
|
15
|
+
*
|
|
16
|
+
* The plugin containing the custom logic must use:
|
|
17
|
+
*
|
|
18
|
+
* - `useGridRegisterPipeProcessor` to register their processor.
|
|
19
|
+
*
|
|
20
|
+
* - `apiRef.current.unstable_requestPipeProcessorsApplication` to imperatively re-apply a group.
|
|
21
|
+
* This method should be used in last resort.
|
|
22
|
+
* Most of the time, the application should be triggered by an update on the deps of the processor.
|
|
23
|
+
*
|
|
24
|
+
* =====================================================================================================================
|
|
25
|
+
*
|
|
26
|
+
* The plugin or component that needs to enrich its data must use:
|
|
27
|
+
*
|
|
28
|
+
* - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
|
|
29
|
+
*
|
|
30
|
+
* - `useGridRegisterPipeApplier` to re-apply the whole pipe when requested.
|
|
31
|
+
* The applier will be called when:
|
|
32
|
+
* * a processor is registered.
|
|
33
|
+
* * `apiRef.current.unstable_requestPipeProcessorsApplication` is called for the given group.
|
|
34
|
+
*/
|
|
35
|
+
export const useGridPipeProcessing = apiRef => {
|
|
36
|
+
const processorsCache = React.useRef({});
|
|
37
|
+
const runAppliers = React.useCallback(groupCache => {
|
|
38
|
+
if (!groupCache) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Object.values(groupCache.appliers).forEach(callback => {
|
|
43
|
+
callback();
|
|
44
|
+
});
|
|
45
|
+
}, []);
|
|
46
|
+
const registerPipeProcessor = React.useCallback((group, id, processor) => {
|
|
47
|
+
if (!processorsCache.current[group]) {
|
|
48
|
+
processorsCache.current[group] = {
|
|
49
|
+
processors: {},
|
|
50
|
+
appliers: {}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const groupCache = processorsCache.current[group];
|
|
55
|
+
const oldProcessor = groupCache.processors[id];
|
|
56
|
+
|
|
57
|
+
if (oldProcessor !== processor) {
|
|
58
|
+
groupCache.processors[id] = processor;
|
|
59
|
+
runAppliers(groupCache);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return () => {
|
|
63
|
+
const _processors = processorsCache.current[group].processors,
|
|
64
|
+
otherProcessors = _objectWithoutPropertiesLoose(_processors, [id].map(_toPropertyKey));
|
|
65
|
+
|
|
66
|
+
processorsCache.current[group].processors = otherProcessors;
|
|
67
|
+
};
|
|
68
|
+
}, [runAppliers]);
|
|
69
|
+
const registerPipeApplier = React.useCallback((group, id, applier) => {
|
|
70
|
+
if (!processorsCache.current[group]) {
|
|
71
|
+
processorsCache.current[group] = {
|
|
72
|
+
processors: {},
|
|
73
|
+
appliers: {}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
processorsCache.current[group].appliers[id] = applier;
|
|
78
|
+
return () => {
|
|
79
|
+
const _appliers = processorsCache.current[group].appliers,
|
|
80
|
+
otherAppliers = _objectWithoutPropertiesLoose(_appliers, [id].map(_toPropertyKey));
|
|
81
|
+
|
|
82
|
+
processorsCache.current[group].appliers = otherAppliers;
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
const requestPipeProcessorsApplication = React.useCallback(group => {
|
|
86
|
+
const groupCache = processorsCache.current[group];
|
|
87
|
+
runAppliers(groupCache);
|
|
88
|
+
}, [runAppliers]);
|
|
89
|
+
const applyPipeProcessors = React.useCallback((...args) => {
|
|
90
|
+
const [group, value, context] = args;
|
|
91
|
+
|
|
92
|
+
if (!processorsCache.current[group]) {
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const preProcessors = Object.values(processorsCache.current[group].processors);
|
|
97
|
+
return preProcessors.reduce((acc, preProcessor) => {
|
|
98
|
+
return preProcessor(acc, context);
|
|
99
|
+
}, value);
|
|
100
|
+
}, []);
|
|
101
|
+
const preProcessingApi = {
|
|
102
|
+
unstable_registerPipeProcessor: registerPipeProcessor,
|
|
103
|
+
unstable_registerPipeApplier: registerPipeApplier,
|
|
104
|
+
unstable_requestPipeProcessorsApplication: requestPipeProcessorsApplication,
|
|
105
|
+
unstable_applyPipeProcessors: applyPipeProcessors
|
|
106
|
+
};
|
|
107
|
+
useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');
|
|
108
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
|
+
export declare const useGridRegisterPipeApplier: <Api extends GridApiCommon, G extends keyof import("./gridPipeProcessingApi").GridPipeProcessingLookup>(apiRef: React.MutableRefObject<Api>, group: G, callback: () => void) => void;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from '../../utils/useFirstRender';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Rename `useGridRegisterPipeProcessor`
|
|
6
|
-
*/
|
|
7
|
-
export const useGridRegisterPreProcessor = (apiRef, group, callback) => {
|
|
3
|
+
export const useGridRegisterPipeApplier = (apiRef, group, callback) => {
|
|
8
4
|
const cleanup = React.useRef();
|
|
9
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
10
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
11
|
-
cleanup.current = apiRef.current.
|
|
7
|
+
cleanup.current = apiRef.current.unstable_registerPipeApplier(group, id.current, callback);
|
|
12
8
|
}, [apiRef, callback, group]);
|
|
13
9
|
useFirstRender(() => {
|
|
14
10
|
registerPreProcessor();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
|
+
import { GridPipeProcessor } from './gridPipeProcessingApi';
|
|
4
|
+
export declare const useGridRegisterPipeProcessor: <Api extends GridApiCommon, G extends keyof import("./gridPipeProcessingApi").GridPipeProcessingLookup>(apiRef: React.MutableRefObject<Api>, group: G, callback: GridPipeProcessor<G>) => void;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from '../../utils/useFirstRender';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Rename `useGridRegisterPipeProcessor`
|
|
6
|
-
*/
|
|
7
|
-
export const useGridRegisterPreProcessor = (apiRef, group, callback) => {
|
|
3
|
+
export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
8
4
|
const cleanup = React.useRef();
|
|
9
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
10
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
11
|
-
cleanup.current = apiRef.current.
|
|
7
|
+
cleanup.current = apiRef.current.unstable_registerPipeProcessor(group, id.current, callback);
|
|
12
8
|
}, [apiRef, callback, group]);
|
|
13
9
|
useFirstRender(() => {
|
|
14
10
|
registerPreProcessor();
|
|
@@ -8,30 +8,41 @@ export declare const GRID_STRATEGIES_PROCESSORS: {
|
|
|
8
8
|
/**
|
|
9
9
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
11
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
12
|
+
*
|
|
13
|
+
* Some plugins contains custom logic that must only be applied if the right strategy is active.
|
|
14
|
+
* For instance, the row grouping plugin has a custom filtering algorithm.
|
|
15
|
+
* This algorithm must be applied by the filtering plugin if the row grouping is the current way of grouping rows,
|
|
16
|
+
* but not if the tree data is the current way of grouping rows.
|
|
17
|
+
*
|
|
18
|
+
* =====================================================================================================================
|
|
19
|
+
*
|
|
20
|
+
* The plugin containing the custom logic must use:
|
|
21
|
+
*
|
|
22
|
+
* - `useGridRegisterStrategyProcessor` to register their processor.
|
|
23
|
+
* When the processor of the active strategy changes, it will fire `GridEvents.activeStrategyProcessorChange` to re-apply the processor.
|
|
24
|
+
*
|
|
19
25
|
* - `apiRef.current.unstable_setStrategyAvailability` to tell if their strategy can be used.
|
|
20
26
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* -
|
|
27
|
+
* =====================================================================================================================
|
|
28
|
+
*
|
|
29
|
+
* The plugin or component that needs to apply the custom logic of the current strategy must use:
|
|
30
|
+
*
|
|
31
|
+
* - `apiRef.current.unstable_applyStrategyProcessor` to run the processor of the active strategy for a given processor name.
|
|
26
32
|
*
|
|
27
|
-
* These hooks must use:
|
|
28
|
-
* - `apiRef.current.unstable_applyStrategyProcessor` to run a processor.
|
|
29
33
|
* - `GridEvents.strategyAvailabilityChange` to update something when the active strategy changes.
|
|
30
34
|
* Warning: Be careful not to apply the processor several times.
|
|
31
35
|
* For instance `GridEvents.rowsSet` is fired by `useGridRows` whenever the active strategy changes.
|
|
32
36
|
* So listening to both would most likely run your logic twice.
|
|
33
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes.
|
|
39
|
+
*
|
|
40
|
+
* =====================================================================================================================
|
|
34
41
|
*
|
|
35
42
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
43
|
+
* For now, there is only one strategy group named `rowTree` which customize
|
|
44
|
+
* - row tree creation algorithm.
|
|
45
|
+
* - sorting algorithm.
|
|
46
|
+
* - filtering algorithm.
|
|
36
47
|
*/
|
|
37
48
|
export declare const useGridStrategyProcessing: (apiRef: React.MutableRefObject<GridApiCommunity>) => void;
|
|
@@ -13,31 +13,42 @@ export const GRID_STRATEGIES_PROCESSORS = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
17
|
+
*
|
|
18
|
+
* Some plugins contains custom logic that must only be applied if the right strategy is active.
|
|
19
|
+
* For instance, the row grouping plugin has a custom filtering algorithm.
|
|
20
|
+
* This algorithm must be applied by the filtering plugin if the row grouping is the current way of grouping rows,
|
|
21
|
+
* but not if the tree data is the current way of grouping rows.
|
|
22
|
+
*
|
|
23
|
+
* =====================================================================================================================
|
|
24
|
+
*
|
|
25
|
+
* The plugin containing the custom logic must use:
|
|
26
|
+
*
|
|
27
|
+
* - `useGridRegisterStrategyProcessor` to register their processor.
|
|
28
|
+
* When the processor of the active strategy changes, it will fire `GridEvents.activeStrategyProcessorChange` to re-apply the processor.
|
|
21
29
|
*
|
|
22
|
-
* These plugins must use:
|
|
23
|
-
* - `apiRef.current.unstable_registerStrategyProcessor` to register their processors.
|
|
24
30
|
* - `apiRef.current.unstable_setStrategyAvailability` to tell if their strategy can be used.
|
|
25
31
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* -
|
|
32
|
+
* =====================================================================================================================
|
|
33
|
+
*
|
|
34
|
+
* The plugin or component that needs to apply the custom logic of the current strategy must use:
|
|
35
|
+
*
|
|
36
|
+
* - `apiRef.current.unstable_applyStrategyProcessor` to run the processor of the active strategy for a given processor name.
|
|
31
37
|
*
|
|
32
|
-
* These hooks must use:
|
|
33
|
-
* - `apiRef.current.unstable_applyStrategyProcessor` to run a processor.
|
|
34
38
|
* - `GridEvents.strategyAvailabilityChange` to update something when the active strategy changes.
|
|
35
39
|
* Warning: Be careful not to apply the processor several times.
|
|
36
40
|
* For instance `GridEvents.rowsSet` is fired by `useGridRows` whenever the active strategy changes.
|
|
37
41
|
* So listening to both would most likely run your logic twice.
|
|
38
|
-
*
|
|
42
|
+
*
|
|
43
|
+
* - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes.
|
|
44
|
+
*
|
|
45
|
+
* =====================================================================================================================
|
|
39
46
|
*
|
|
40
47
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
48
|
+
* For now, there is only one strategy group named `rowTree` which customize
|
|
49
|
+
* - row tree creation algorithm.
|
|
50
|
+
* - sorting algorithm.
|
|
51
|
+
* - filtering algorithm.
|
|
41
52
|
*/
|
|
42
53
|
export const useGridStrategyProcessing = apiRef => {
|
|
43
54
|
const availableStrategies = React.useRef(new Map());
|
|
@@ -2,7 +2,7 @@ import { useGridLoggerFactory } from './useGridLoggerFactory';
|
|
|
2
2
|
import { useGridApiInitialization } from './useGridApiInitialization';
|
|
3
3
|
import { useGridErrorHandler } from './useGridErrorHandler';
|
|
4
4
|
import { useGridLocaleText } from './useGridLocaleText';
|
|
5
|
-
import {
|
|
5
|
+
import { useGridPipeProcessing } from './pipeProcessing';
|
|
6
6
|
import { useGridStrategyProcessing } from './strategyProcessing';
|
|
7
7
|
import { useGridStateInitialization } from './useGridStateInitialization';
|
|
8
8
|
/**
|
|
@@ -14,7 +14,7 @@ export const useGridInitialization = (inputApiRef, props) => {
|
|
|
14
14
|
useGridLoggerFactory(apiRef, props);
|
|
15
15
|
useGridErrorHandler(apiRef, props);
|
|
16
16
|
useGridStateInitialization(apiRef, props);
|
|
17
|
-
|
|
17
|
+
useGridPipeProcessing(apiRef);
|
|
18
18
|
useGridStrategyProcessing(apiRef);
|
|
19
19
|
useGridLocaleText(apiRef, props);
|
|
20
20
|
return apiRef;
|
|
@@ -12,7 +12,6 @@ export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) =>
|
|
|
12
12
|
maxLastColumn?: number | undefined;
|
|
13
13
|
} | undefined, other?: {}) => JSX.Element[] | null;
|
|
14
14
|
isDragging: boolean;
|
|
15
|
-
updateInnerPosition: (nextRenderContext: GridRenderContext) => void;
|
|
16
15
|
getRootProps: (other?: {}) => {
|
|
17
16
|
style: {
|
|
18
17
|
minHeight: number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import * as ReactDOM from 'react-dom';
|
|
3
4
|
import { useForkRef } from '@mui/material/utils';
|
|
5
|
+
import { defaultMemoize } from 'reselect';
|
|
4
6
|
import { useGridApiContext } from '../../utils/useGridApiContext';
|
|
5
7
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
6
8
|
import { gridVisibleColumnDefinitionsSelector, gridColumnPositionsSelector } from '../columns/gridColumnsSelector';
|
|
@@ -13,7 +15,15 @@ import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
|
13
15
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
14
16
|
import { GridEvents } from '../../../models/events';
|
|
15
17
|
import { GridColumnHeaderItem } from '../../../components/columnHeaders/GridColumnHeaderItem';
|
|
18
|
+
import { getFirstColumnIndexToRender } from '../columns/gridColumnsUtils';
|
|
19
|
+
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
20
|
+
import { getRenderableIndexes } from '../virtualization/useGridVirtualScroller';
|
|
16
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
|
|
23
|
+
function isUIEvent(event) {
|
|
24
|
+
return !!event.target;
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
export const useGridColumnHeaders = props => {
|
|
18
28
|
const {
|
|
19
29
|
innerRef: innerRefProp,
|
|
@@ -37,18 +47,43 @@ export const useGridColumnHeaders = props => {
|
|
|
37
47
|
const [renderContext, setRenderContext] = React.useState(null);
|
|
38
48
|
const prevRenderContext = React.useRef(renderContext);
|
|
39
49
|
const prevScrollLeft = React.useRef(0);
|
|
50
|
+
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
40
51
|
React.useEffect(() => {
|
|
41
52
|
apiRef.current.columnHeadersContainerElementRef.current.scrollLeft = 0;
|
|
42
|
-
}, [apiRef]);
|
|
53
|
+
}, [apiRef]); // memoize `getFirstColumnIndexToRender`, since it's called on scroll
|
|
54
|
+
|
|
55
|
+
const getFirstColumnIndexToRenderRef = React.useRef(defaultMemoize(getFirstColumnIndexToRender, {
|
|
56
|
+
equalityCheck: (a, b) => ['firstColumnIndex', 'minColumnIndex', 'columnBuffer'].every(key => a[key] === b[key])
|
|
57
|
+
}));
|
|
43
58
|
const updateInnerPosition = React.useCallback(nextRenderContext => {
|
|
44
|
-
const
|
|
59
|
+
const [firstRowToRender, lastRowToRender] = getRenderableIndexes({
|
|
60
|
+
firstIndex: nextRenderContext.firstRowIndex,
|
|
61
|
+
lastIndex: nextRenderContext.lastRowIndex,
|
|
62
|
+
minFirstIndex: 0,
|
|
63
|
+
maxLastIndex: currentPage.rows.length,
|
|
64
|
+
buffer: rootProps.rowBuffer
|
|
65
|
+
});
|
|
66
|
+
const firstColumnToRender = getFirstColumnIndexToRenderRef.current({
|
|
67
|
+
firstColumnIndex: nextRenderContext.firstColumnIndex,
|
|
68
|
+
minColumnIndex,
|
|
69
|
+
columnBuffer: rootProps.columnBuffer,
|
|
70
|
+
firstRowToRender,
|
|
71
|
+
lastRowToRender,
|
|
72
|
+
apiRef,
|
|
73
|
+
visibleRows: currentPage.rows
|
|
74
|
+
});
|
|
45
75
|
const offset = firstColumnToRender > 0 ? prevScrollLeft.current - columnPositions[firstColumnToRender] : prevScrollLeft.current;
|
|
46
76
|
innerRef.current.style.transform = `translate3d(${-offset}px, 0px, 0px)`;
|
|
47
|
-
}, [columnPositions, minColumnIndex, rootProps.columnBuffer]);
|
|
77
|
+
}, [columnPositions, minColumnIndex, rootProps.columnBuffer, apiRef, currentPage.rows, rootProps.rowBuffer]);
|
|
78
|
+
React.useLayoutEffect(() => {
|
|
79
|
+
if (renderContext) {
|
|
80
|
+
updateInnerPosition(renderContext);
|
|
81
|
+
}
|
|
82
|
+
}, [renderContext, updateInnerPosition]);
|
|
48
83
|
const handleScroll = React.useCallback(({
|
|
49
84
|
left,
|
|
50
85
|
renderContext: nextRenderContext = null
|
|
51
|
-
}) => {
|
|
86
|
+
}, event) => {
|
|
52
87
|
var _prevRenderContext$cu, _prevRenderContext$cu2;
|
|
53
88
|
|
|
54
89
|
if (!innerRef.current) {
|
|
@@ -61,15 +96,32 @@ export const useGridColumnHeaders = props => {
|
|
|
61
96
|
return;
|
|
62
97
|
}
|
|
63
98
|
|
|
64
|
-
prevScrollLeft.current = left;
|
|
99
|
+
prevScrollLeft.current = left; // We can only update the position when we guarantee that the render context has been
|
|
100
|
+
// rendered. This is achieved using ReactDOM.flushSync or when the context doesn't change.
|
|
101
|
+
|
|
102
|
+
let canUpdateInnerPosition = false;
|
|
65
103
|
|
|
66
104
|
if (nextRenderContext !== prevRenderContext.current || !prevRenderContext.current) {
|
|
67
|
-
|
|
105
|
+
// ReactDOM.flushSync cannot be called on `scroll` events fired inside effects
|
|
106
|
+
if (isUIEvent(event)) {
|
|
107
|
+
// To prevent flickering, the inner position can only be updated after the new context has
|
|
108
|
+
// been rendered. ReactDOM.flushSync ensures that the state changes will happen before
|
|
109
|
+
// updating the position.
|
|
110
|
+
ReactDOM.flushSync(() => {
|
|
111
|
+
setRenderContext(nextRenderContext);
|
|
112
|
+
});
|
|
113
|
+
canUpdateInnerPosition = true;
|
|
114
|
+
} else {
|
|
115
|
+
setRenderContext(nextRenderContext);
|
|
116
|
+
}
|
|
117
|
+
|
|
68
118
|
prevRenderContext.current = nextRenderContext;
|
|
119
|
+
} else {
|
|
120
|
+
canUpdateInnerPosition = true;
|
|
69
121
|
} // Pass directly the render context to avoid waiting for the next render
|
|
70
122
|
|
|
71
123
|
|
|
72
|
-
if (nextRenderContext) {
|
|
124
|
+
if (nextRenderContext && canUpdateInnerPosition) {
|
|
73
125
|
updateInnerPosition(nextRenderContext);
|
|
74
126
|
}
|
|
75
127
|
}, [updateInnerPosition]);
|
|
@@ -95,7 +147,22 @@ export const useGridColumnHeaders = props => {
|
|
|
95
147
|
}
|
|
96
148
|
|
|
97
149
|
const columns = [];
|
|
98
|
-
const
|
|
150
|
+
const [firstRowToRender, lastRowToRender] = getRenderableIndexes({
|
|
151
|
+
firstIndex: nextRenderContext.firstRowIndex,
|
|
152
|
+
lastIndex: nextRenderContext.lastRowIndex,
|
|
153
|
+
minFirstIndex: 0,
|
|
154
|
+
maxLastIndex: currentPage.rows.length,
|
|
155
|
+
buffer: rootProps.rowBuffer
|
|
156
|
+
});
|
|
157
|
+
const firstColumnToRender = getFirstColumnIndexToRenderRef.current({
|
|
158
|
+
firstColumnIndex: nextRenderContext.firstColumnIndex,
|
|
159
|
+
minColumnIndex: minFirstColumn,
|
|
160
|
+
columnBuffer: rootProps.columnBuffer,
|
|
161
|
+
apiRef,
|
|
162
|
+
firstRowToRender,
|
|
163
|
+
lastRowToRender,
|
|
164
|
+
visibleRows: currentPage.rows
|
|
165
|
+
});
|
|
99
166
|
const lastColumnToRender = Math.min(nextRenderContext.lastColumnIndex + rootProps.columnBuffer, maxLastColumn);
|
|
100
167
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
101
168
|
|
|
@@ -115,11 +182,11 @@ export const useGridColumnHeaders = props => {
|
|
|
115
182
|
column: column,
|
|
116
183
|
colIndex: columnIndex,
|
|
117
184
|
isResizing: resizeCol === column.field,
|
|
118
|
-
isLastColumn: columnIndex ===
|
|
185
|
+
isLastColumn: columnIndex === visibleColumns.length - 1,
|
|
119
186
|
extendRowFullWidth: !rootProps.disableExtendRowFullWidth,
|
|
120
187
|
hasFocus: hasFocus,
|
|
121
188
|
tabIndex: tabIndex
|
|
122
|
-
}, other),
|
|
189
|
+
}, other), column.field));
|
|
123
190
|
}
|
|
124
191
|
|
|
125
192
|
return columns;
|
|
@@ -134,7 +201,6 @@ export const useGridColumnHeaders = props => {
|
|
|
134
201
|
renderContext,
|
|
135
202
|
getColumns,
|
|
136
203
|
isDragging: !!dragCol,
|
|
137
|
-
updateInnerPosition,
|
|
138
204
|
getRootProps: (other = {}) => _extends({
|
|
139
205
|
style: rootStyle
|
|
140
206
|
}, other),
|
|
@@ -79,5 +79,6 @@ export const useGridColumnMenu = apiRef => {
|
|
|
79
79
|
*/
|
|
80
80
|
|
|
81
81
|
useGridApiEventHandler(apiRef, GridEvents.columnResizeStart, hideColumnMenu);
|
|
82
|
-
useGridApiEventHandler(apiRef, GridEvents.
|
|
82
|
+
useGridApiEventHandler(apiRef, GridEvents.virtualScrollerWheel, apiRef.current.hideColumnMenu);
|
|
83
|
+
useGridApiEventHandler(apiRef, GridEvents.virtualScrollerTouchMove, apiRef.current.hideColumnMenu);
|
|
83
84
|
};
|
|
@@ -15,7 +15,9 @@ export interface GridColumnsState {
|
|
|
15
15
|
lookup: GridColumnLookup;
|
|
16
16
|
columnVisibilityModel: GridColumnVisibilityModel;
|
|
17
17
|
}
|
|
18
|
-
export declare type GridColumnDimensions =
|
|
18
|
+
export declare type GridColumnDimensions = {
|
|
19
|
+
[key in GridColumnDimensionProperties]?: number;
|
|
20
|
+
};
|
|
19
21
|
export interface GridColumnsInitialState {
|
|
20
22
|
columnVisibilityModel?: GridColumnVisibilityModel;
|
|
21
23
|
orderedFields?: string[];
|
|
@@ -21,7 +21,7 @@ export declare const gridColumnLookupSelector: import("../../../utils/createSele
|
|
|
21
21
|
* Get the columns as an array.
|
|
22
22
|
* @category Columns
|
|
23
23
|
*/
|
|
24
|
-
export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]>;
|
|
24
|
+
export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]>;
|
|
25
25
|
/**
|
|
26
26
|
* Get the column visibility model, containing the visibility status of each column.
|
|
27
27
|
* If a column is not registered in the model, it is visible.
|
|
@@ -32,7 +32,7 @@ export declare const gridColumnVisibilityModelSelector: import("../../../utils/c
|
|
|
32
32
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
33
33
|
* @category Visible Columns
|
|
34
34
|
*/
|
|
35
|
-
export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]>;
|
|
35
|
+
export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]>;
|
|
36
36
|
/**
|
|
37
37
|
* Get the field of each visible column.
|
|
38
38
|
* @category Visible Columns
|
|
@@ -52,7 +52,7 @@ export declare const gridColumnsTotalWidthSelector: import("../../../utils/creat
|
|
|
52
52
|
* Get the filterable columns as an array.
|
|
53
53
|
* @category Columns
|
|
54
54
|
*/
|
|
55
|
-
export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]>;
|
|
55
|
+
export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]>;
|
|
56
56
|
/**
|
|
57
57
|
* Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
|
|
58
58
|
* @category Columns
|
|
@@ -69,19 +69,19 @@ export declare const allGridColumnsFieldsSelector: import("../../../utils/create
|
|
|
69
69
|
* @deprecated Use `gridColumnDefinitionsSelector` instead.
|
|
70
70
|
* @ignore - do not document.
|
|
71
71
|
*/
|
|
72
|
-
export declare const allGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]> | ((...args: any[]) => any);
|
|
72
|
+
export declare const allGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]> | ((...args: any[]) => any);
|
|
73
73
|
/**
|
|
74
74
|
* @category Visible Columns
|
|
75
75
|
* @deprecated Use `gridVisibleColumnDefinitionsSelector` instead.
|
|
76
76
|
* @ignore - do not document.
|
|
77
77
|
*/
|
|
78
|
-
export declare const visibleGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]> | ((...args: any[]) => any);
|
|
78
|
+
export declare const visibleGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]> | ((...args: any[]) => any);
|
|
79
79
|
/**
|
|
80
80
|
* @category Columns
|
|
81
81
|
* @deprecated Use `gridFilterableColumnDefinitionsSelector` instead.
|
|
82
82
|
* @ignore - do not document.
|
|
83
83
|
*/
|
|
84
|
-
export declare const filterableGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]> | ((...args: any[]) => any);
|
|
84
|
+
export declare const filterableGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]> | ((...args: any[]) => any);
|
|
85
85
|
/**
|
|
86
86
|
* @category Columns
|
|
87
87
|
* @deprecated Use `gridFilterableColumnLookupSelector` instead (not the same return format).
|
|
@@ -4,6 +4,8 @@ import { GridColType, GridColumnTypesRecord } from '../../../models';
|
|
|
4
4
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
5
5
|
import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
6
6
|
import { GridColDef } from '../../../models/colDef/gridColDef';
|
|
7
|
+
import { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
8
|
+
import { GridRowEntry } from '../../../models/gridRows';
|
|
7
9
|
export declare const COLUMNS_DIMENSION_PROPERTIES: readonly ["maxWidth", "minWidth", "width", "flex"];
|
|
8
10
|
export declare type GridColumnDimensionProperties = typeof COLUMNS_DIMENSION_PROPERTIES[number];
|
|
9
11
|
export declare const computeColumnTypes: (customColumnTypes?: GridColumnTypesRecord) => GridColumnTypesRecord;
|
|
@@ -17,7 +19,7 @@ export declare function computeFlexColumnsWidth({ initialFreeSpace, totalFlexUni
|
|
|
17
19
|
totalFlexUnits: number;
|
|
18
20
|
flexColumns: {
|
|
19
21
|
field: GridColDef['field'];
|
|
20
|
-
flex?: number;
|
|
22
|
+
flex?: number | null;
|
|
21
23
|
minWidth?: number;
|
|
22
24
|
maxWidth?: number;
|
|
23
25
|
}[];
|
|
@@ -41,14 +43,30 @@ export declare const applyInitialState: (columnsState: Omit<GridColumnsRawState,
|
|
|
41
43
|
/**
|
|
42
44
|
* @deprecated Should have been internal only, you can inline the logic.
|
|
43
45
|
*/
|
|
44
|
-
export declare const getGridColDef: (columnTypes: GridColumnTypesRecord, type: GridColType | undefined) => import("../../../models").GridColTypeDef
|
|
45
|
-
export declare const createColumnsState: ({ apiRef, columnsToUpsert, initialState,
|
|
46
|
+
export declare const getGridColDef: (columnTypes: GridColumnTypesRecord, type: GridColType | undefined) => import("../../../models").GridColTypeDef<any, any>;
|
|
47
|
+
export declare const createColumnsState: ({ apiRef, columnsToUpsert, initialState, columnTypes, currentColumnVisibilityModel, shouldRegenColumnVisibilityModelFromColumns, keepOnlyColumnsToUpsert, }: {
|
|
46
48
|
columnsToUpsert: GridColDef[];
|
|
47
49
|
initialState: GridColumnsInitialState | undefined;
|
|
48
|
-
|
|
50
|
+
columnTypes: GridColumnTypesRecord;
|
|
49
51
|
currentColumnVisibilityModel?: GridColumnVisibilityModel | undefined;
|
|
50
52
|
shouldRegenColumnVisibilityModelFromColumns: boolean;
|
|
51
53
|
keepOnlyColumnsToUpsert: boolean;
|
|
52
54
|
apiRef: React.MutableRefObject<GridApiCommunity>;
|
|
53
55
|
}) => GridColumnsState;
|
|
54
56
|
export declare const mergeColumnsState: (columnsState: GridColumnsState) => (state: GridStateCommunity) => GridStateCommunity;
|
|
57
|
+
export declare function getFirstNonSpannedColumnToRender({ firstColumnToRender, apiRef, firstRowToRender, lastRowToRender, visibleRows, }: {
|
|
58
|
+
firstColumnToRender: number;
|
|
59
|
+
apiRef: React.MutableRefObject<GridApiCommon>;
|
|
60
|
+
firstRowToRender: number;
|
|
61
|
+
lastRowToRender: number;
|
|
62
|
+
visibleRows: GridRowEntry[];
|
|
63
|
+
}): number;
|
|
64
|
+
export declare function getFirstColumnIndexToRender({ firstColumnIndex, minColumnIndex, columnBuffer, firstRowToRender, lastRowToRender, apiRef, visibleRows, }: {
|
|
65
|
+
firstColumnIndex: number;
|
|
66
|
+
minColumnIndex: number;
|
|
67
|
+
columnBuffer: number;
|
|
68
|
+
apiRef: React.MutableRefObject<GridApiCommon>;
|
|
69
|
+
firstRowToRender: number;
|
|
70
|
+
lastRowToRender: number;
|
|
71
|
+
visibleRows: GridRowEntry[];
|
|
72
|
+
}): number;
|