@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
|
@@ -41,6 +41,8 @@ var _gridCheckboxSelectionColDef = require("../colDef/gridCheckboxSelectionColDe
|
|
|
41
41
|
|
|
42
42
|
var _gridActionsColDef = require("../colDef/gridActionsColDef");
|
|
43
43
|
|
|
44
|
+
var _gridDetailPanelToggleField = require("../constants/gridDetailPanelToggleField");
|
|
45
|
+
|
|
44
46
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
45
47
|
|
|
46
48
|
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
@@ -87,6 +89,7 @@ function GridRow(props) {
|
|
|
87
89
|
const {
|
|
88
90
|
selected,
|
|
89
91
|
rowId,
|
|
92
|
+
row,
|
|
90
93
|
index,
|
|
91
94
|
style: styleProp,
|
|
92
95
|
rowHeight,
|
|
@@ -157,7 +160,12 @@ function GridRow(props) {
|
|
|
157
160
|
} // User opened a detail panel
|
|
158
161
|
|
|
159
162
|
|
|
160
|
-
if (field ===
|
|
163
|
+
if (field === _gridDetailPanelToggleField.GRID_DETAIL_PANEL_TOGGLE_FIELD) {
|
|
164
|
+
return;
|
|
165
|
+
} // User reorders a row
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
if (field === '__reorder__') {
|
|
161
169
|
return;
|
|
162
170
|
} // User is editing a cell
|
|
163
171
|
|
|
@@ -198,7 +206,8 @@ function GridRow(props) {
|
|
|
198
206
|
const indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
|
|
199
207
|
const rowParams = (0, _extends2.default)({}, apiRef.current.getRowParams(rowId), {
|
|
200
208
|
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
201
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1
|
|
209
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
210
|
+
indexRelativeToCurrentPage
|
|
202
211
|
});
|
|
203
212
|
rowClassName = rootProps.getRowClassName(rowParams);
|
|
204
213
|
}
|
|
@@ -206,8 +215,6 @@ function GridRow(props) {
|
|
|
206
215
|
const cells = [];
|
|
207
216
|
|
|
208
217
|
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
209
|
-
var _rootProps$components;
|
|
210
|
-
|
|
211
218
|
const column = renderedColumns[i];
|
|
212
219
|
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
213
220
|
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
@@ -236,7 +243,16 @@ function GridRow(props) {
|
|
|
236
243
|
if (editCellState != null && column.renderEditCell) {
|
|
237
244
|
var _rootProps$classes2;
|
|
238
245
|
|
|
239
|
-
|
|
246
|
+
let updatedRow = row;
|
|
247
|
+
|
|
248
|
+
if (apiRef.current.unstable_getRowWithUpdatedValues) {
|
|
249
|
+
// Only the new editing API has this method
|
|
250
|
+
updatedRow = apiRef.current.unstable_getRowWithUpdatedValues(rowId, column.field);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const params = (0, _extends2.default)({}, cellParams, {
|
|
254
|
+
row: updatedRow
|
|
255
|
+
}, editCellState, {
|
|
240
256
|
api: apiRef.current
|
|
241
257
|
});
|
|
242
258
|
content = column.renderEditCell(params); // TODO move to GridCell
|
|
@@ -251,24 +267,35 @@ function GridRow(props) {
|
|
|
251
267
|
|
|
252
268
|
const hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
|
|
253
269
|
const tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
271
|
+
|
|
272
|
+
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
273
|
+
var _rootProps$components;
|
|
274
|
+
|
|
275
|
+
const {
|
|
276
|
+
colSpan,
|
|
277
|
+
width
|
|
278
|
+
} = cellColSpanInfo.cellProps;
|
|
279
|
+
cells.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.Cell, (0, _extends2.default)({
|
|
280
|
+
value: cellParams.value,
|
|
281
|
+
field: column.field,
|
|
282
|
+
width: width,
|
|
283
|
+
rowId: rowId,
|
|
284
|
+
height: rowHeight,
|
|
285
|
+
showRightBorder: showRightBorder,
|
|
286
|
+
formattedValue: cellParams.formattedValue,
|
|
287
|
+
align: column.align || 'left',
|
|
288
|
+
cellMode: cellParams.cellMode,
|
|
289
|
+
colIndex: indexRelativeToAllColumns,
|
|
290
|
+
isEditable: cellParams.isEditable,
|
|
291
|
+
hasFocus: hasFocus,
|
|
292
|
+
tabIndex: tabIndex,
|
|
293
|
+
className: (0, _clsx.default)(classNames),
|
|
294
|
+
colSpan: colSpan
|
|
295
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
296
|
+
children: content
|
|
297
|
+
}), column.field));
|
|
298
|
+
}
|
|
272
299
|
}
|
|
273
300
|
|
|
274
301
|
const emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
@@ -302,11 +329,16 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
302
329
|
containerWidth: _propTypes.default.number.isRequired,
|
|
303
330
|
editRowsState: _propTypes.default.object.isRequired,
|
|
304
331
|
firstColumnToRender: _propTypes.default.number.isRequired,
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Index of the row in the whole sorted and filtered dataset.
|
|
335
|
+
* If some rows above have expanded children, this index also take those children into account.
|
|
336
|
+
*/
|
|
305
337
|
index: _propTypes.default.number.isRequired,
|
|
306
338
|
isLastVisible: _propTypes.default.bool,
|
|
307
339
|
lastColumnToRender: _propTypes.default.number.isRequired,
|
|
308
340
|
renderedColumns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
309
|
-
row: _propTypes.default.
|
|
341
|
+
row: _propTypes.default.any.isRequired,
|
|
310
342
|
rowHeight: _propTypes.default.number.isRequired,
|
|
311
343
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
312
344
|
selected: _propTypes.default.bool.isRequired,
|
|
@@ -78,8 +78,9 @@ function GridOverlays() {
|
|
|
78
78
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
79
79
|
const totalRowCount = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowCountSelector);
|
|
80
80
|
const visibleRowCount = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridVisibleRowCountSelector);
|
|
81
|
-
const
|
|
82
|
-
const
|
|
81
|
+
const loading = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowsLoadingSelector);
|
|
82
|
+
const showNoRowsOverlay = !loading && totalRowCount === 0;
|
|
83
|
+
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
83
84
|
let overlay = null;
|
|
84
85
|
|
|
85
86
|
if (showNoRowsOverlay) {
|
|
@@ -9,6 +9,8 @@ exports.renderActionsCell = exports.GridActionsCell = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
12
14
|
var React = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -25,8 +27,12 @@ var _GridMenu = require("../menu/GridMenu");
|
|
|
25
27
|
|
|
26
28
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
27
29
|
|
|
30
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
31
|
+
|
|
28
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
33
|
|
|
34
|
+
const _excluded = ["colDef", "id", "api", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "getValue", "tabIndex", "position", "focusElementRef"];
|
|
35
|
+
|
|
30
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
37
|
|
|
32
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -34,20 +40,25 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
40
|
const hasActions = colDef => typeof colDef.getActions === 'function';
|
|
35
41
|
|
|
36
42
|
const GridActionsCell = props => {
|
|
43
|
+
const {
|
|
44
|
+
colDef,
|
|
45
|
+
id,
|
|
46
|
+
hasFocus,
|
|
47
|
+
tabIndex,
|
|
48
|
+
position = 'bottom-end',
|
|
49
|
+
focusElementRef
|
|
50
|
+
} = props,
|
|
51
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
52
|
+
const [focusedButtonIndex, setFocusedButtonIndex] = React.useState(-1);
|
|
37
53
|
const [open, setOpen] = React.useState(false);
|
|
54
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
55
|
+
const rootRef = React.useRef(null);
|
|
38
56
|
const buttonRef = React.useRef(null);
|
|
57
|
+
const ignoreCallToFocus = React.useRef(false);
|
|
39
58
|
const touchRippleRefs = React.useRef({});
|
|
40
59
|
const menuId = (0, _utils.unstable_useId)();
|
|
41
60
|
const buttonId = (0, _utils.unstable_useId)();
|
|
42
61
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
43
|
-
const {
|
|
44
|
-
colDef,
|
|
45
|
-
id,
|
|
46
|
-
api,
|
|
47
|
-
hasFocus,
|
|
48
|
-
position = 'bottom-end'
|
|
49
|
-
} = props; // TODO apply the rest to the root element
|
|
50
|
-
|
|
51
62
|
React.useLayoutEffect(() => {
|
|
52
63
|
if (!hasFocus) {
|
|
53
64
|
Object.entries(touchRippleRefs.current).forEach(([index, ref]) => {
|
|
@@ -57,56 +68,144 @@ const GridActionsCell = props => {
|
|
|
57
68
|
});
|
|
58
69
|
}
|
|
59
70
|
}, [hasFocus]);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
if (focusedButtonIndex >= 0) {
|
|
73
|
+
var _rootRef$current;
|
|
74
|
+
|
|
75
|
+
const child = (_rootRef$current = rootRef.current) == null ? void 0 : _rootRef$current.children[focusedButtonIndex];
|
|
76
|
+
child.focus();
|
|
77
|
+
}
|
|
78
|
+
}, [focusedButtonIndex]);
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
if (!hasFocus) {
|
|
81
|
+
setFocusedButtonIndex(-1);
|
|
82
|
+
ignoreCallToFocus.current = false;
|
|
83
|
+
}
|
|
84
|
+
}, [hasFocus]);
|
|
85
|
+
React.useImperativeHandle(focusElementRef, () => ({
|
|
86
|
+
focus() {
|
|
87
|
+
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
88
|
+
if (!ignoreCallToFocus.current) {
|
|
89
|
+
setFocusedButtonIndex(0);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}), []);
|
|
60
94
|
|
|
61
95
|
if (!hasActions(colDef)) {
|
|
62
96
|
throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
|
|
63
97
|
}
|
|
64
98
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const hideMenu = () => setOpen(false);
|
|
68
|
-
|
|
69
|
-
const options = colDef.getActions(api.getRowParams(id));
|
|
99
|
+
const options = colDef.getActions(apiRef.current.getRowParams(id));
|
|
70
100
|
const iconButtons = options.filter(option => !option.props.showInMenu);
|
|
71
101
|
const menuButtons = options.filter(option => option.props.showInMenu);
|
|
102
|
+
const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
|
|
103
|
+
|
|
104
|
+
const showMenu = () => {
|
|
105
|
+
setOpen(true);
|
|
106
|
+
setFocusedButtonIndex(numberOfButtons - 1);
|
|
107
|
+
ignoreCallToFocus.current = true;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const hideMenu = () => {
|
|
111
|
+
setOpen(false);
|
|
112
|
+
};
|
|
72
113
|
|
|
73
114
|
const handleTouchRippleRef = index => instance => {
|
|
74
115
|
touchRippleRefs.current[index] = instance;
|
|
75
116
|
};
|
|
76
117
|
|
|
77
|
-
|
|
118
|
+
const handleButtonClick = (index, onClick) => event => {
|
|
119
|
+
setFocusedButtonIndex(index);
|
|
120
|
+
ignoreCallToFocus.current = true;
|
|
121
|
+
|
|
122
|
+
if (onClick) {
|
|
123
|
+
onClick(event);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const handleRootKeyDown = event => {
|
|
128
|
+
if (numberOfButtons <= 1) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let newIndex = focusedButtonIndex;
|
|
133
|
+
|
|
134
|
+
if (event.key === 'ArrowRight') {
|
|
135
|
+
newIndex += 1;
|
|
136
|
+
} else if (event.key === 'ArrowLeft') {
|
|
137
|
+
newIndex -= 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
141
|
+
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (newIndex !== focusedButtonIndex) {
|
|
145
|
+
event.preventDefault(); // Prevent scrolling
|
|
146
|
+
|
|
147
|
+
event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
|
|
148
|
+
|
|
149
|
+
setFocusedButtonIndex(newIndex);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const handleListKeyDown = event => {
|
|
154
|
+
if (event.key === 'Tab') {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
|
|
159
|
+
hideMenu();
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
164
|
+
role: "menu",
|
|
165
|
+
ref: rootRef,
|
|
166
|
+
tabIndex: -1,
|
|
78
167
|
className: _gridClasses.gridClasses.actionsCell,
|
|
168
|
+
onKeyDown: handleRootKeyDown
|
|
169
|
+
}, other, {
|
|
79
170
|
children: [iconButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
80
171
|
key: index,
|
|
81
|
-
touchRippleRef: handleTouchRippleRef(index)
|
|
82
|
-
|
|
172
|
+
touchRippleRef: handleTouchRippleRef(index),
|
|
173
|
+
onClick: handleButtonClick(index, button.props.onClick),
|
|
174
|
+
tabIndex: focusedButtonIndex === index ? tabIndex : -1
|
|
175
|
+
})), menuButtons.length > 0 && buttonId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
83
176
|
ref: buttonRef,
|
|
84
177
|
id: buttonId,
|
|
85
|
-
"aria-label":
|
|
178
|
+
"aria-label": apiRef.current.getLocaleText('actionsCellMore'),
|
|
86
179
|
"aria-controls": menuId,
|
|
87
180
|
"aria-expanded": open ? 'true' : undefined,
|
|
88
181
|
"aria-haspopup": "true",
|
|
182
|
+
role: "menuitem",
|
|
89
183
|
size: "small",
|
|
90
184
|
onClick: showMenu,
|
|
185
|
+
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
186
|
+
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1,
|
|
91
187
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.MoreActionsIcon, {
|
|
92
188
|
fontSize: "small"
|
|
93
189
|
})
|
|
94
190
|
}), menuButtons.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridMenu.GridMenu, {
|
|
95
|
-
id: menuId,
|
|
96
191
|
onClickAway: hideMenu,
|
|
97
192
|
onClick: hideMenu,
|
|
98
193
|
open: open,
|
|
99
194
|
target: buttonRef.current,
|
|
100
195
|
position: position,
|
|
101
|
-
"aria-labelledby": buttonId,
|
|
102
196
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuList.default, {
|
|
197
|
+
id: menuId,
|
|
103
198
|
className: _gridClasses.gridClasses.menuList,
|
|
199
|
+
onKeyDown: handleListKeyDown,
|
|
200
|
+
"aria-labelledby": buttonId,
|
|
201
|
+
variant: "menu",
|
|
202
|
+
autoFocusItem: true,
|
|
104
203
|
children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
105
204
|
key: index
|
|
106
205
|
}))
|
|
107
206
|
})
|
|
108
207
|
})]
|
|
109
|
-
});
|
|
208
|
+
}));
|
|
110
209
|
};
|
|
111
210
|
|
|
112
211
|
exports.GridActionsCell = GridActionsCell;
|
|
@@ -122,11 +221,42 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
122
221
|
*/
|
|
123
222
|
api: _propTypes.default.any.isRequired,
|
|
124
223
|
|
|
224
|
+
/**
|
|
225
|
+
* The mode of the cell.
|
|
226
|
+
*/
|
|
227
|
+
cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
|
|
228
|
+
|
|
125
229
|
/**
|
|
126
230
|
* The column of the row that the current cell belongs to.
|
|
127
231
|
*/
|
|
128
232
|
colDef: _propTypes.default.object.isRequired,
|
|
129
233
|
|
|
234
|
+
/**
|
|
235
|
+
* The column field of the cell that triggered the event.
|
|
236
|
+
*/
|
|
237
|
+
field: _propTypes.default.string.isRequired,
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* A ref allowing to set imperative focus.
|
|
241
|
+
* It can be passed to the element that should receive focus.
|
|
242
|
+
* @ignore - do not document.
|
|
243
|
+
*/
|
|
244
|
+
focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
245
|
+
current: _propTypes.default.shape({
|
|
246
|
+
focus: _propTypes.default.func.isRequired
|
|
247
|
+
})
|
|
248
|
+
})]),
|
|
249
|
+
formattedValue: _propTypes.default.any,
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Get the cell value of a row and field.
|
|
253
|
+
* @param {GridRowId} id The row id.
|
|
254
|
+
* @param {string} field The field.
|
|
255
|
+
* @returns {any} The cell value.
|
|
256
|
+
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
257
|
+
*/
|
|
258
|
+
getValue: _propTypes.default.func.isRequired,
|
|
259
|
+
|
|
130
260
|
/**
|
|
131
261
|
* If true, the cell is the active element.
|
|
132
262
|
*/
|
|
@@ -136,7 +266,28 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
136
266
|
* The grid row id.
|
|
137
267
|
*/
|
|
138
268
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
139
|
-
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* If true, the cell is editable.
|
|
272
|
+
*/
|
|
273
|
+
isEditable: _propTypes.default.bool,
|
|
274
|
+
position: _propTypes.default.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* The row model of the row that the current cell belongs to.
|
|
278
|
+
*/
|
|
279
|
+
row: _propTypes.default.object.isRequired,
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* The node of the row that the current cell belongs to.
|
|
283
|
+
*/
|
|
284
|
+
rowNode: _propTypes.default.object.isRequired,
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* the tabIndex value.
|
|
288
|
+
*/
|
|
289
|
+
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
290
|
+
value: _propTypes.default.any
|
|
140
291
|
} : void 0;
|
|
141
292
|
|
|
142
293
|
const renderActionsCell = params => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridActionsCell, (0, _extends2.default)({}, params));
|
|
@@ -29,7 +29,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
29
|
|
|
30
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
31
|
|
|
32
|
-
const GridActionsCellItem = props => {
|
|
32
|
+
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
33
33
|
const {
|
|
34
34
|
label,
|
|
35
35
|
icon,
|
|
@@ -46,7 +46,9 @@ const GridActionsCellItem = props => {
|
|
|
46
46
|
|
|
47
47
|
if (!showInMenu) {
|
|
48
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, (0, _extends2.default)({
|
|
49
|
+
ref: ref,
|
|
49
50
|
size: "small",
|
|
51
|
+
role: "menuitem",
|
|
50
52
|
"aria-label": label
|
|
51
53
|
}, other, {
|
|
52
54
|
onClick: handleClick,
|
|
@@ -56,14 +58,15 @@ const GridActionsCellItem = props => {
|
|
|
56
58
|
}));
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, (0, _extends2.default)({
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, (0, _extends2.default)({
|
|
62
|
+
ref: ref
|
|
63
|
+
}, other, {
|
|
60
64
|
onClick: onClick,
|
|
61
65
|
children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
62
66
|
children: icon
|
|
63
67
|
}), label]
|
|
64
68
|
}));
|
|
65
|
-
};
|
|
66
|
-
|
|
69
|
+
});
|
|
67
70
|
exports.GridActionsCellItem = GridActionsCellItem;
|
|
68
71
|
process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
|
|
69
72
|
// ----------------------------- Warning --------------------------------
|
|
@@ -33,7 +33,7 @@ var _gridFocusStateSelector = require("../../hooks/features/focus/gridFocusState
|
|
|
33
33
|
|
|
34
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
35
|
|
|
36
|
-
const _excluded = ["align", "children", "colIndex", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
|
|
36
|
+
const _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
|
|
37
37
|
|
|
38
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
39
|
|
|
@@ -91,6 +91,7 @@ function GridCell(props) {
|
|
|
91
91
|
width,
|
|
92
92
|
className,
|
|
93
93
|
showRightBorder,
|
|
94
|
+
colSpan,
|
|
94
95
|
onClick,
|
|
95
96
|
onDoubleClick,
|
|
96
97
|
onMouseDown,
|
|
@@ -102,6 +103,7 @@ function GridCell(props) {
|
|
|
102
103
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
103
104
|
const valueToRender = formattedValue == null ? value : formattedValue;
|
|
104
105
|
const cellRef = React.useRef(null);
|
|
106
|
+
const focusElementRef = React.useRef(null);
|
|
105
107
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
106
108
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
107
109
|
const ownerState = {
|
|
@@ -152,7 +154,7 @@ function GridCell(props) {
|
|
|
152
154
|
|
|
153
155
|
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
154
156
|
const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
155
|
-
const elementToFocus = focusableElement || cellRef.current;
|
|
157
|
+
const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
|
|
156
158
|
|
|
157
159
|
if (doesSupportPreventScroll()) {
|
|
158
160
|
elementToFocus.focus({
|
|
@@ -186,6 +188,26 @@ function GridCell(props) {
|
|
|
186
188
|
};
|
|
187
189
|
}
|
|
188
190
|
|
|
191
|
+
const column = apiRef.current.getColumn(field);
|
|
192
|
+
const managesOwnFocus = column.type === 'actions';
|
|
193
|
+
|
|
194
|
+
const renderChildren = () => {
|
|
195
|
+
if (children == null) {
|
|
196
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
197
|
+
className: classes.content,
|
|
198
|
+
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
203
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
204
|
+
focusElementRef
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return children;
|
|
209
|
+
};
|
|
210
|
+
|
|
189
211
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({
|
|
190
212
|
ref: cellRef,
|
|
191
213
|
className: (0, _clsx.default)(className, classes.root),
|
|
@@ -193,8 +215,9 @@ function GridCell(props) {
|
|
|
193
215
|
"data-field": field,
|
|
194
216
|
"data-colindex": colIndex,
|
|
195
217
|
"aria-colindex": colIndex + 1,
|
|
218
|
+
"aria-colspan": colSpan,
|
|
196
219
|
style: style,
|
|
197
|
-
tabIndex: cellMode === 'view' || !isEditable ? tabIndex : -1,
|
|
220
|
+
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
198
221
|
onClick: publish(_models.GridEvents.cellClick, onClick),
|
|
199
222
|
onDoubleClick: publish(_models.GridEvents.cellDoubleClick, onDoubleClick),
|
|
200
223
|
onMouseDown: publish(_models.GridEvents.cellMouseDown, onMouseDown),
|
|
@@ -204,10 +227,7 @@ function GridCell(props) {
|
|
|
204
227
|
onDragOver: publish(_models.GridEvents.cellDragOver, onDragOver)
|
|
205
228
|
}, other, {
|
|
206
229
|
onFocus: handleFocus,
|
|
207
|
-
children:
|
|
208
|
-
className: classes.content,
|
|
209
|
-
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
210
|
-
})
|
|
230
|
+
children: renderChildren()
|
|
211
231
|
}));
|
|
212
232
|
}
|
|
213
233
|
|
|
@@ -221,8 +241,9 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
221
241
|
children: _propTypes.default.node,
|
|
222
242
|
className: _propTypes.default.string,
|
|
223
243
|
colIndex: _propTypes.default.number.isRequired,
|
|
244
|
+
colSpan: _propTypes.default.number,
|
|
224
245
|
field: _propTypes.default.string.isRequired,
|
|
225
|
-
formattedValue: _propTypes.default.
|
|
246
|
+
formattedValue: _propTypes.default.any,
|
|
226
247
|
hasFocus: _propTypes.default.bool,
|
|
227
248
|
height: _propTypes.default.number.isRequired,
|
|
228
249
|
isEditable: _propTypes.default.bool,
|
|
@@ -236,6 +257,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
236
257
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
237
258
|
showRightBorder: _propTypes.default.bool,
|
|
238
259
|
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
239
|
-
value: _propTypes.default.
|
|
260
|
+
value: _propTypes.default.any,
|
|
240
261
|
width: _propTypes.default.number.isRequired
|
|
241
262
|
} : void 0;
|
|
@@ -145,13 +145,13 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
145
145
|
/**
|
|
146
146
|
* The cell value formatted with the column valueFormatter.
|
|
147
147
|
*/
|
|
148
|
-
formattedValue: _propTypes.default.any
|
|
148
|
+
formattedValue: _propTypes.default.any,
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* Get the cell value of a row and field.
|
|
152
152
|
* @param {GridRowId} id The row id.
|
|
153
153
|
* @param {string} field The field.
|
|
154
|
-
* @returns {
|
|
154
|
+
* @returns {any} The cell value.
|
|
155
155
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
156
156
|
*/
|
|
157
157
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -176,7 +176,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
176
176
|
/**
|
|
177
177
|
* The row model of the row that the current cell belongs to.
|
|
178
178
|
*/
|
|
179
|
-
row: _propTypes.default.
|
|
179
|
+
row: _propTypes.default.object.isRequired,
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* The node of the row that the current cell belongs to.
|