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