@mui/x-data-grid 5.8.0 → 5.11.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 +333 -66
- package/DataGrid/DataGrid.js +36 -2
- package/DataGrid/useDataGridComponent.js +3 -1
- package/DataGrid/useDataGridProps.js +2 -1
- package/LICENSE +21 -0
- package/README.md +7 -5
- package/colDef/gridActionsColDef.js +2 -1
- package/colDef/gridBooleanColDef.js +2 -1
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/colDef/gridDateColDef.js +4 -2
- package/colDef/gridNumericColDef.js +3 -2
- package/colDef/gridNumericOperators.d.ts +2 -0
- package/colDef/gridNumericOperators.js +11 -0
- package/colDef/gridSingleSelectColDef.js +3 -2
- package/colDef/gridSingleSelectOperators.d.ts +3 -0
- package/colDef/gridSingleSelectOperators.js +52 -0
- package/colDef/gridStringColDef.js +3 -2
- package/colDef/gridStringOperators.d.ts +2 -0
- package/colDef/gridStringOperators.js +12 -0
- package/components/GridFooter.d.ts +4 -2
- package/components/GridFooter.js +11 -2
- package/components/GridRow.d.ts +4 -0
- package/components/GridRow.js +58 -28
- package/components/GridRowCount.d.ts +4 -1
- package/components/GridRowCount.js +1 -0
- package/components/GridScrollArea.js +3 -4
- package/components/GridSelectedRowCount.d.ts +4 -1
- package/components/GridSelectedRowCount.js +2 -1
- package/components/base/GridBody.js +1 -2
- package/components/base/GridOverlays.js +5 -5
- package/components/cell/GridActionsCell.d.ts +5 -1
- package/components/cell/GridActionsCell.js +179 -21
- package/components/cell/GridActionsCellItem.d.ts +66 -4
- package/components/cell/GridActionsCellItem.js +7 -5
- package/components/cell/GridCell.d.ts +1 -0
- package/components/cell/GridCell.js +36 -15
- package/components/cell/GridEditBooleanCell.d.ts +15 -3
- package/components/cell/GridEditBooleanCell.js +101 -6
- package/components/cell/GridEditDateCell.d.ts +16 -4
- package/components/cell/GridEditDateCell.js +99 -5
- package/components/cell/GridEditInputCell.d.ts +11 -5
- package/components/cell/GridEditInputCell.js +30 -6
- package/components/cell/GridEditSingleSelectCell.d.ts +12 -4
- package/components/cell/GridEditSingleSelectCell.js +50 -18
- package/components/cell/index.d.ts +2 -0
- package/components/cell/index.js +2 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +19 -23
- package/components/columnHeaders/GridColumnHeaders.d.ts +2 -1
- package/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +2 -0
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +3 -3
- package/components/columnSelection/GridCellCheckboxRenderer.js +22 -6
- package/components/columnSelection/GridHeaderCheckbox.js +4 -5
- package/components/containers/GridFooterContainer.d.ts +8 -2
- package/components/containers/GridFooterContainer.js +11 -2
- package/components/containers/GridRootStyles.js +36 -1
- package/components/containers/GridToolbarContainer.d.ts +8 -2
- package/components/containers/GridToolbarContainer.js +12 -2
- package/components/menu/GridMenu.js +1 -0
- package/components/panel/GridPanel.js +1 -0
- package/components/panel/GridPanelContent.d.ts +8 -1
- package/components/panel/GridPanelContent.js +13 -2
- package/components/panel/GridPanelFooter.d.ts +8 -1
- package/components/panel/GridPanelFooter.js +13 -2
- package/components/panel/GridPanelHeader.d.ts +8 -1
- package/components/panel/GridPanelHeader.js +13 -2
- 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/GridToolbar.d.ts +12 -2
- package/components/toolbar/GridToolbar.js +30 -7
- package/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/components/toolbar/GridToolbarExport.d.ts +5 -4
- package/components/toolbar/GridToolbarExport.js +15 -20
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.d.ts +20 -0
- package/components/toolbar/GridToolbarQuickFilter.js +88 -0
- package/components/toolbar/index.d.ts +3 -1
- package/components/toolbar/index.js +3 -2
- package/components/virtualization/GridVirtualScroller.d.ts +4 -1
- package/components/virtualization/GridVirtualScroller.js +2 -0
- package/components/virtualization/GridVirtualScrollerContent.d.ts +4 -1
- package/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +4 -1
- package/constants/defaultGridSlotsComponents.js +3 -2
- package/constants/gridClasses.d.ts +20 -0
- package/constants/gridClasses.js +1 -1
- package/constants/gridDetailPanelToggleField.d.ts +1 -0
- package/constants/gridDetailPanelToggleField.js +2 -0
- package/constants/localeTextConstants.js +8 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +39 -15
- package/hooks/core/pipeProcessing/index.d.ts +1 -0
- package/hooks/core/pipeProcessing/index.js +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +8 -3
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +3 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +0 -3
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +4 -4
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
- package/hooks/core/useGridApiInitialization.js +3 -3
- package/hooks/core/useGridErrorHandler.js +1 -2
- package/hooks/core/useGridStateInitialization.js +1 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +0 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +81 -16
- package/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +19 -1
- package/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/hooks/features/columns/useGridColumnSpanning.d.ts +7 -0
- package/hooks/features/columns/useGridColumnSpanning.js +108 -0
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.js +30 -25
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +10 -11
- package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +151 -42
- package/hooks/features/editRows/useGridCellEditing.old.js +20 -21
- package/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/hooks/features/editRows/useGridEditing.old.js +4 -5
- package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +145 -57
- package/hooks/features/editRows/useGridRowEditing.old.js +21 -22
- package/hooks/features/events/useGridEvents.js +17 -18
- package/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/hooks/features/export/useGridCsvExport.js +23 -16
- package/hooks/features/export/useGridPrintExport.js +22 -0
- package/hooks/features/export/utils.d.ts +3 -1
- package/hooks/features/export/utils.js +13 -0
- package/hooks/features/filter/gridFilterState.d.ts +1 -2
- package/hooks/features/filter/gridFilterState.js +3 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +8 -0
- package/hooks/features/filter/gridFilterUtils.js +84 -2
- package/hooks/features/filter/useGridFilter.js +32 -15
- package/hooks/features/focus/useGridFocus.d.ts +1 -1
- package/hooks/features/focus/useGridFocus.js +48 -42
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +43 -12
- package/hooks/features/pagination/useGridPage.js +3 -4
- package/hooks/features/pagination/useGridPageSize.js +2 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
- package/hooks/features/rows/gridRowsSelector.d.ts +2 -0
- package/hooks/features/rows/gridRowsSelector.js +2 -0
- package/hooks/features/rows/gridRowsState.d.ts +7 -7
- package/hooks/features/rows/gridRowsUtils.d.ts +2 -1
- package/hooks/features/rows/gridRowsUtils.js +25 -1
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +121 -61
- package/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/hooks/features/scroll/useGridScroll.d.ts +2 -0
- package/hooks/features/scroll/useGridScroll.js +31 -4
- package/hooks/features/selection/useGridSelection.d.ts +1 -1
- package/hooks/features/selection/useGridSelection.js +15 -11
- package/hooks/features/sorting/useGridSorting.js +17 -18
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +9 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +68 -32
- package/hooks/utils/useGridApiEventHandler.d.ts +4 -1
- package/hooks/utils/useGridApiEventHandler.js +22 -9
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/hooks/utils/useGridSelector.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/internals/index.d.ts +5 -1
- package/internals/index.js +6 -2
- package/legacy/DataGrid/DataGrid.js +36 -2
- package/legacy/DataGrid/useDataGridComponent.js +3 -1
- package/legacy/DataGrid/useDataGridProps.js +2 -1
- package/legacy/colDef/gridActionsColDef.js +2 -1
- package/legacy/colDef/gridBooleanColDef.js +2 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/legacy/colDef/gridDateColDef.js +4 -2
- package/legacy/colDef/gridNumericColDef.js +3 -2
- package/legacy/colDef/gridNumericOperators.js +28 -18
- package/legacy/colDef/gridSingleSelectColDef.js +3 -2
- package/legacy/colDef/gridSingleSelectOperators.js +55 -6
- package/legacy/colDef/gridStringColDef.js +3 -2
- package/legacy/colDef/gridStringOperators.js +25 -14
- package/legacy/components/GridFooter.js +11 -2
- package/legacy/components/GridRow.js +56 -28
- package/legacy/components/GridRowCount.js +1 -0
- package/legacy/components/GridScrollArea.js +3 -4
- package/legacy/components/GridSelectedRowCount.js +2 -1
- package/legacy/components/base/GridBody.js +1 -2
- package/legacy/components/base/GridOverlays.js +5 -5
- package/legacy/components/cell/GridActionsCell.js +197 -27
- package/legacy/components/cell/GridActionsCellItem.js +7 -5
- package/legacy/components/cell/GridCell.js +37 -15
- package/legacy/components/cell/GridEditBooleanCell.js +132 -11
- package/legacy/components/cell/GridEditDateCell.js +148 -42
- package/legacy/components/cell/GridEditInputCell.js +62 -13
- package/legacy/components/cell/GridEditSingleSelectCell.js +65 -28
- package/legacy/components/cell/index.js +2 -0
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +19 -23
- package/legacy/components/columnHeaders/GridColumnHeaders.js +2 -3
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +23 -6
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +4 -5
- package/legacy/components/containers/GridFooterContainer.js +11 -2
- package/legacy/components/containers/GridRootStyles.js +26 -5
- package/legacy/components/containers/GridToolbarContainer.js +12 -2
- package/legacy/components/menu/GridMenu.js +1 -0
- package/legacy/components/panel/GridPanel.js +1 -0
- package/legacy/components/panel/GridPanelContent.js +13 -2
- package/legacy/components/panel/GridPanelFooter.js +13 -2
- package/legacy/components/panel/GridPanelHeader.js +13 -2
- 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/GridToolbar.js +31 -6
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/legacy/components/toolbar/GridToolbarExport.js +18 -19
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +103 -0
- package/legacy/components/toolbar/index.js +3 -2
- package/legacy/components/virtualization/GridVirtualScroller.js +2 -0
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/legacy/constants/defaultGridSlotsComponents.js +3 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/gridDetailPanelToggleField.js +2 -0
- package/legacy/constants/localeTextConstants.js +8 -1
- package/legacy/hooks/core/pipeProcessing/index.js +2 -1
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +60 -24
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
- package/legacy/hooks/core/useGridApiInitialization.js +3 -3
- package/legacy/hooks/core/useGridErrorHandler.js +1 -2
- package/legacy/hooks/core/useGridStateInitialization.js +1 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +94 -16
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
- package/legacy/hooks/features/columns/gridColumnsUtils.js +79 -22
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +106 -0
- package/legacy/hooks/features/columns/useGridColumns.js +30 -25
- package/legacy/hooks/features/dimensions/useGridDimensions.js +10 -11
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +225 -89
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +20 -21
- package/legacy/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/legacy/hooks/features/editRows/useGridEditing.old.js +4 -5
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +157 -65
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +20 -21
- package/legacy/hooks/features/events/useGridEvents.js +17 -18
- package/legacy/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/legacy/hooks/features/export/useGridCsvExport.js +24 -17
- package/legacy/hooks/features/export/useGridPrintExport.js +22 -0
- package/legacy/hooks/features/export/utils.js +14 -0
- package/legacy/hooks/features/filter/gridFilterState.js +3 -1
- package/legacy/hooks/features/filter/gridFilterUtils.js +96 -2
- package/legacy/hooks/features/filter/useGridFilter.js +32 -15
- package/legacy/hooks/features/focus/useGridFocus.js +50 -44
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +43 -11
- package/legacy/hooks/features/pagination/useGridPage.js +3 -4
- package/legacy/hooks/features/pagination/useGridPageSize.js +2 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
- package/legacy/hooks/features/rows/gridRowsSelector.js +6 -0
- package/legacy/hooks/features/rows/gridRowsUtils.js +27 -1
- package/legacy/hooks/features/rows/useGridRows.js +131 -61
- package/legacy/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/legacy/hooks/features/scroll/useGridScroll.js +31 -4
- package/legacy/hooks/features/selection/useGridSelection.js +15 -11
- package/legacy/hooks/features/sorting/useGridSorting.js +12 -15
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +79 -42
- package/legacy/hooks/utils/useGridApiEventHandler.js +20 -9
- package/legacy/hooks/utils/useGridNativeEventListener.js +1 -2
- package/legacy/hooks/utils/useGridSelector.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +6 -2
- package/legacy/locales/arSD.js +8 -1
- package/legacy/locales/bgBG.js +8 -1
- package/legacy/locales/csCZ.js +7 -0
- package/legacy/locales/daDK.js +8 -1
- package/legacy/locales/deDE.js +10 -3
- package/legacy/locales/elGR.js +7 -0
- package/legacy/locales/esES.js +7 -0
- package/legacy/locales/faIR.js +8 -1
- package/legacy/locales/fiFI.js +7 -0
- package/legacy/locales/frFR.js +7 -0
- package/legacy/locales/heIL.js +8 -1
- package/legacy/locales/huHU.js +127 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/itIT.js +7 -0
- package/legacy/locales/jaJP.js +7 -0
- package/legacy/locales/koKR.js +7 -0
- package/legacy/locales/nlNL.js +7 -0
- package/legacy/locales/plPL.js +8 -1
- package/legacy/locales/ptBR.js +8 -1
- package/legacy/locales/ruRU.js +7 -0
- package/legacy/locales/skSK.js +7 -0
- package/legacy/locales/trTR.js +8 -1
- package/legacy/locales/ukUA.js +7 -0
- package/legacy/locales/viVN.js +7 -0
- package/legacy/locales/zhCN.js +7 -0
- package/legacy/models/api/gridColumnSpanning.js +1 -0
- package/legacy/models/events/gridEvents.js +10 -3
- package/legacy/models/gridColumnSpanning.js +1 -0
- package/legacy/models/index.js +4 -3
- package/legacy/utils/createSelector.js +18 -2
- package/legacy/utils/exportAs.js +1 -1
- package/locales/arSD.js +8 -1
- package/locales/bgBG.js +8 -1
- package/locales/csCZ.js +7 -0
- package/locales/daDK.js +8 -1
- package/locales/deDE.js +10 -3
- package/locales/elGR.js +7 -0
- package/locales/esES.js +7 -0
- package/locales/faIR.js +8 -1
- package/locales/fiFI.js +7 -0
- package/locales/frFR.js +7 -0
- package/locales/heIL.js +8 -1
- package/locales/huHU.d.ts +2 -0
- package/locales/huHU.js +115 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/itIT.js +7 -0
- package/locales/jaJP.js +7 -0
- package/locales/koKR.js +7 -0
- package/locales/nlNL.js +7 -0
- package/locales/plPL.js +8 -1
- package/locales/ptBR.js +8 -1
- package/locales/ruRU.js +7 -0
- package/locales/skSK.js +7 -0
- package/locales/trTR.js +8 -1
- package/locales/ukUA.js +7 -0
- package/locales/viVN.js +7 -0
- package/locales/zhCN.js +7 -0
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridColumnSpanning.d.ts +28 -0
- package/models/api/gridColumnSpanning.js +1 -0
- package/models/api/gridCoreApi.d.ts +10 -0
- package/models/api/gridEditingApi.d.ts +72 -7
- package/models/api/gridFilterApi.d.ts +5 -0
- package/models/api/gridFocusApi.d.ts +1 -0
- package/models/api/gridLocaleTextApi.d.ts +5 -0
- package/models/api/gridRowApi.d.ts +34 -0
- package/models/api/index.d.ts +1 -1
- package/models/colDef/gridColDef.d.ts +18 -0
- package/models/events/gridEventLookup.d.ts +296 -11
- package/models/events/gridEvents.d.ts +10 -258
- package/models/events/gridEvents.js +10 -3
- package/models/gridColumnSpanning.d.ts +12 -0
- package/models/gridColumnSpanning.js +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/gridExport.d.ts +29 -2
- package/models/gridFilterModel.d.ts +11 -0
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +0 -2
- package/models/index.d.ts +1 -1
- package/models/index.js +4 -3
- package/models/params/gridCellParams.d.ts +12 -2
- package/models/params/gridRowParams.d.ts +5 -0
- package/models/props/DataGridProps.d.ts +57 -29
- package/modern/DataGrid/DataGrid.js +36 -2
- package/modern/DataGrid/useDataGridComponent.js +3 -1
- package/modern/DataGrid/useDataGridProps.js +2 -1
- package/modern/colDef/gridActionsColDef.js +2 -1
- package/modern/colDef/gridBooleanColDef.js +2 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/modern/colDef/gridDateColDef.js +4 -2
- package/modern/colDef/gridNumericColDef.js +3 -2
- package/modern/colDef/gridNumericOperators.js +11 -0
- package/modern/colDef/gridSingleSelectColDef.js +3 -2
- package/modern/colDef/gridSingleSelectOperators.js +52 -0
- package/modern/colDef/gridStringColDef.js +3 -2
- package/modern/colDef/gridStringOperators.js +12 -0
- package/modern/components/GridFooter.js +11 -2
- package/modern/components/GridRow.js +56 -26
- package/modern/components/GridRowCount.js +1 -0
- package/modern/components/GridScrollArea.js +3 -4
- package/modern/components/GridSelectedRowCount.js +2 -1
- package/modern/components/base/GridBody.js +1 -2
- package/modern/components/base/GridOverlays.js +5 -5
- package/modern/components/cell/GridActionsCell.js +179 -21
- package/modern/components/cell/GridActionsCellItem.js +7 -5
- package/modern/components/cell/GridCell.js +36 -15
- package/modern/components/cell/GridEditBooleanCell.js +101 -6
- package/modern/components/cell/GridEditDateCell.js +99 -5
- package/modern/components/cell/GridEditInputCell.js +30 -6
- package/modern/components/cell/GridEditSingleSelectCell.js +48 -16
- package/modern/components/cell/index.js +2 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +19 -23
- package/modern/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +22 -6
- package/modern/components/columnSelection/GridHeaderCheckbox.js +4 -5
- package/modern/components/containers/GridFooterContainer.js +11 -2
- package/modern/components/containers/GridRootStyles.js +36 -1
- package/modern/components/containers/GridToolbarContainer.js +12 -2
- package/modern/components/menu/GridMenu.js +1 -0
- package/modern/components/panel/GridPanel.js +1 -0
- package/modern/components/panel/GridPanelContent.js +13 -2
- package/modern/components/panel/GridPanelFooter.js +13 -2
- package/modern/components/panel/GridPanelHeader.js +13 -2
- 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/GridToolbar.js +30 -7
- package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/modern/components/toolbar/GridToolbarExport.js +15 -20
- package/modern/components/toolbar/GridToolbarQuickFilter.js +86 -0
- package/modern/components/toolbar/index.js +3 -2
- package/modern/components/virtualization/GridVirtualScroller.js +2 -0
- package/modern/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/modern/constants/defaultGridSlotsComponents.js +3 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/gridDetailPanelToggleField.js +2 -0
- package/modern/constants/localeTextConstants.js +8 -1
- package/modern/hooks/core/pipeProcessing/index.js +2 -1
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
- package/modern/hooks/core/useGridApiInitialization.js +3 -3
- package/modern/hooks/core/useGridErrorHandler.js +1 -2
- package/modern/hooks/core/useGridStateInitialization.js +1 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +81 -16
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +3 -3
- package/modern/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/modern/hooks/features/columns/useGridColumnSpanning.js +106 -0
- package/modern/hooks/features/columns/useGridColumns.js +30 -25
- package/modern/hooks/features/dimensions/useGridDimensions.js +10 -11
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +149 -42
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +20 -21
- package/modern/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/modern/hooks/features/editRows/useGridEditing.old.js +4 -5
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +143 -57
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +21 -22
- package/modern/hooks/features/events/useGridEvents.js +17 -18
- package/modern/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/modern/hooks/features/export/useGridCsvExport.js +21 -16
- package/modern/hooks/features/export/useGridPrintExport.js +20 -0
- package/modern/hooks/features/export/utils.js +13 -0
- package/modern/hooks/features/filter/gridFilterState.js +3 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +80 -2
- package/modern/hooks/features/filter/useGridFilter.js +32 -15
- package/modern/hooks/features/focus/useGridFocus.js +48 -42
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +41 -12
- package/modern/hooks/features/pagination/useGridPage.js +3 -4
- package/modern/hooks/features/pagination/useGridPageSize.js +2 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
- package/modern/hooks/features/rows/gridRowsSelector.js +2 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +23 -1
- package/modern/hooks/features/rows/useGridRows.js +121 -61
- package/modern/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/modern/hooks/features/scroll/useGridScroll.js +29 -4
- package/modern/hooks/features/selection/useGridSelection.js +15 -11
- package/modern/hooks/features/sorting/useGridSorting.js +17 -18
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +68 -28
- package/modern/hooks/utils/useGridApiEventHandler.js +20 -9
- package/modern/hooks/utils/useGridNativeEventListener.js +1 -2
- package/modern/hooks/utils/useGridSelector.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +6 -2
- package/modern/locales/arSD.js +8 -1
- package/modern/locales/bgBG.js +8 -1
- package/modern/locales/csCZ.js +7 -0
- package/modern/locales/daDK.js +8 -1
- package/modern/locales/deDE.js +10 -3
- package/modern/locales/elGR.js +7 -0
- package/modern/locales/esES.js +7 -0
- package/modern/locales/faIR.js +8 -1
- package/modern/locales/fiFI.js +7 -0
- package/modern/locales/frFR.js +7 -0
- package/modern/locales/heIL.js +8 -1
- package/modern/locales/huHU.js +115 -0
- package/modern/locales/index.js +1 -0
- package/modern/locales/itIT.js +7 -0
- package/modern/locales/jaJP.js +7 -0
- package/modern/locales/koKR.js +7 -0
- package/modern/locales/nlNL.js +7 -0
- package/modern/locales/plPL.js +8 -1
- package/modern/locales/ptBR.js +8 -1
- package/modern/locales/ruRU.js +7 -0
- package/modern/locales/skSK.js +7 -0
- package/modern/locales/trTR.js +8 -1
- package/modern/locales/ukUA.js +7 -0
- package/modern/locales/viVN.js +7 -0
- package/modern/locales/zhCN.js +7 -0
- package/modern/models/api/gridColumnSpanning.js +1 -0
- package/modern/models/events/gridEvents.js +10 -3
- package/modern/models/gridColumnSpanning.js +1 -0
- package/modern/models/index.js +4 -3
- package/modern/utils/createSelector.js +20 -2
- package/modern/utils/exportAs.js +1 -1
- package/node/DataGrid/DataGrid.js +36 -2
- package/node/DataGrid/useDataGridComponent.js +4 -1
- package/node/DataGrid/useDataGridProps.js +2 -1
- package/node/colDef/gridActionsColDef.js +2 -1
- package/node/colDef/gridBooleanColDef.js +2 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/node/colDef/gridDateColDef.js +4 -2
- package/node/colDef/gridNumericColDef.js +2 -1
- package/node/colDef/gridNumericOperators.js +15 -1
- package/node/colDef/gridSingleSelectColDef.js +2 -1
- package/node/colDef/gridSingleSelectOperators.js +56 -1
- package/node/colDef/gridStringColDef.js +2 -1
- package/node/colDef/gridStringOperators.js +16 -1
- package/node/components/GridFooter.js +10 -1
- package/node/components/GridRow.js +59 -29
- package/node/components/GridRowCount.js +1 -0
- package/node/components/GridScrollArea.js +3 -5
- package/node/components/GridSelectedRowCount.js +2 -1
- package/node/components/base/GridBody.js +1 -3
- package/node/components/base/GridOverlays.js +4 -5
- package/node/components/cell/GridActionsCell.js +181 -21
- package/node/components/cell/GridActionsCellItem.js +7 -4
- package/node/components/cell/GridCell.js +35 -14
- package/node/components/cell/GridEditBooleanCell.js +100 -5
- package/node/components/cell/GridEditDateCell.js +98 -4
- package/node/components/cell/GridEditInputCell.js +30 -6
- package/node/components/cell/GridEditSingleSelectCell.js +50 -18
- package/node/components/cell/index.js +26 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +19 -24
- package/node/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +22 -7
- package/node/components/columnSelection/GridHeaderCheckbox.js +4 -6
- package/node/components/containers/GridFooterContainer.js +10 -1
- package/node/components/containers/GridRootStyles.js +36 -1
- package/node/components/containers/GridToolbarContainer.js +11 -1
- package/node/components/menu/GridMenu.js +1 -0
- package/node/components/panel/GridPanel.js +1 -0
- package/node/components/panel/GridPanelContent.js +11 -1
- package/node/components/panel/GridPanelFooter.js +11 -1
- package/node/components/panel/GridPanelHeader.js +11 -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/GridToolbar.js +32 -7
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/toolbar/GridToolbarExport.js +14 -19
- package/node/components/toolbar/GridToolbarQuickFilter.js +111 -0
- package/node/components/toolbar/index.js +42 -11
- package/node/components/virtualization/GridVirtualScroller.js +2 -0
- package/node/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/node/constants/defaultGridSlotsComponents.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/gridDetailPanelToggleField.js +9 -0
- package/node/constants/localeTextConstants.js +8 -1
- package/node/hooks/core/pipeProcessing/index.js +13 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +51 -20
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +42 -0
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -3
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -8
- package/node/hooks/core/useGridApiInitialization.js +3 -4
- package/node/hooks/core/useGridErrorHandler.js +1 -3
- package/node/hooks/core/useGridStateInitialization.js +1 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +85 -17
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +3 -4
- package/node/hooks/features/columns/gridColumnsUtils.js +65 -9
- package/node/hooks/features/columns/useGridColumnSpanning.js +128 -0
- package/node/hooks/features/columns/useGridColumns.js +29 -25
- package/node/hooks/features/dimensions/useGridDimensions.js +10 -12
- package/node/hooks/features/editRows/useGridCellEditing.new.js +151 -42
- package/node/hooks/features/editRows/useGridCellEditing.old.js +20 -22
- package/node/hooks/features/editRows/useGridEditing.new.js +6 -2
- package/node/hooks/features/editRows/useGridEditing.old.js +4 -6
- package/node/hooks/features/editRows/useGridRowEditing.new.js +143 -57
- package/node/hooks/features/editRows/useGridRowEditing.old.js +21 -23
- package/node/hooks/features/events/useGridEvents.js +17 -19
- package/node/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/node/hooks/features/export/useGridCsvExport.js +26 -17
- package/node/hooks/features/export/useGridPrintExport.js +25 -0
- package/node/hooks/features/export/utils.js +19 -2
- package/node/hooks/features/filter/gridFilterState.js +3 -1
- package/node/hooks/features/filter/gridFilterUtils.js +92 -3
- package/node/hooks/features/filter/useGridFilter.js +33 -16
- package/node/hooks/features/focus/useGridFocus.js +48 -43
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +44 -13
- package/node/hooks/features/pagination/useGridPage.js +3 -5
- package/node/hooks/features/pagination/useGridPageSize.js +2 -4
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -8
- package/node/hooks/features/rows/gridRowsSelector.js +5 -1
- package/node/hooks/features/rows/gridRowsUtils.js +29 -1
- package/node/hooks/features/rows/useGridRows.js +122 -61
- package/node/hooks/features/rows/useGridRowsMeta.js +6 -14
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/node/hooks/features/scroll/useGridScroll.js +32 -3
- package/node/hooks/features/selection/useGridSelection.js +16 -12
- package/node/hooks/features/sorting/useGridSorting.js +17 -19
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +73 -33
- package/node/hooks/utils/useGridApiEventHandler.js +22 -10
- package/node/hooks/utils/useGridNativeEventListener.js +1 -3
- package/node/hooks/utils/useGridSelector.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +47 -3
- package/node/locales/arSD.js +8 -1
- package/node/locales/bgBG.js +8 -1
- package/node/locales/csCZ.js +7 -0
- package/node/locales/daDK.js +8 -1
- package/node/locales/deDE.js +10 -3
- package/node/locales/elGR.js +7 -0
- package/node/locales/esES.js +7 -0
- package/node/locales/faIR.js +8 -1
- package/node/locales/fiFI.js +7 -0
- package/node/locales/frFR.js +7 -0
- package/node/locales/heIL.js +8 -1
- package/node/locales/huHU.js +125 -0
- package/node/locales/index.js +13 -0
- package/node/locales/itIT.js +7 -0
- package/node/locales/jaJP.js +7 -0
- package/node/locales/koKR.js +7 -0
- package/node/locales/nlNL.js +7 -0
- package/node/locales/plPL.js +8 -1
- package/node/locales/ptBR.js +8 -1
- package/node/locales/ruRU.js +7 -0
- package/node/locales/skSK.js +7 -0
- package/node/locales/trTR.js +8 -1
- package/node/locales/ukUA.js +7 -0
- package/node/locales/viVN.js +7 -0
- package/node/locales/zhCN.js +7 -0
- package/node/models/api/gridColumnSpanning.js +5 -0
- package/node/models/events/gridEvents.js +10 -3
- package/node/models/gridColumnSpanning.js +5 -0
- package/node/models/index.js +0 -13
- package/node/utils/createSelector.js +25 -4
- package/node/utils/exportAs.js +1 -1
- package/package.json +4 -4
- package/utils/createSelector.d.ts +2 -1
- package/utils/createSelector.js +20 -2
- package/utils/domUtils.d.ts +2 -2
- package/utils/exportAs.d.ts +2 -2
- package/utils/exportAs.js +1 -1
|
@@ -66,6 +66,7 @@ process.env.NODE_ENV !== "production" ? GridSelectedRowCount.propTypes = {
|
|
|
66
66
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
67
67
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
68
68
|
// ----------------------------------------------------------------------
|
|
69
|
-
selectedRowCount: PropTypes.number.isRequired
|
|
69
|
+
selectedRowCount: PropTypes.number.isRequired,
|
|
70
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
70
71
|
} : void 0;
|
|
71
72
|
export { GridSelectedRowCount };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { GridEvents } from '../../models/events';
|
|
4
3
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
5
4
|
import { GridMainContainer } from '../containers/GridMainContainer';
|
|
6
5
|
import { GridAutoSizer } from '../GridAutoSizer';
|
|
@@ -46,7 +45,7 @@ function GridBody(props) {
|
|
|
46
45
|
apiRef.current.renderingZoneRef = renderingZoneRef; // TODO remove, nobody should have access to internal parts of the virtualization
|
|
47
46
|
|
|
48
47
|
const handleResize = React.useCallback(size => {
|
|
49
|
-
apiRef.current.publishEvent(
|
|
48
|
+
apiRef.current.publishEvent('resize', size);
|
|
50
49
|
}, [apiRef]);
|
|
51
50
|
return /*#__PURE__*/_jsxs(GridMainContainer, {
|
|
52
51
|
children: [/*#__PURE__*/_jsx(GridOverlays, {}), /*#__PURE__*/_jsx(ColumnHeadersComponent, {
|
|
@@ -3,11 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
4
4
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
5
5
|
import { gridVisibleRowCountSelector } from '../../hooks/features/filter/gridFilterSelector';
|
|
6
|
-
import { gridRowCountSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
6
|
+
import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
7
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { gridDensityHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
10
|
-
import { GridEvents } from '../../models/events';
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
|
|
13
12
|
function GridOverlayWrapper(props) {
|
|
@@ -27,7 +26,7 @@ function GridOverlayWrapper(props) {
|
|
|
27
26
|
setViewportInnerSize((_apiRef$current$getRo3 = (_apiRef$current$getRo4 = apiRef.current.getRootDimensions()) == null ? void 0 : _apiRef$current$getRo4.viewportInnerSize) != null ? _apiRef$current$getRo3 : null);
|
|
28
27
|
}, [apiRef]);
|
|
29
28
|
useEnhancedEffect(() => {
|
|
30
|
-
return apiRef.current.subscribeEvent(
|
|
29
|
+
return apiRef.current.subscribeEvent('viewportInnerSizeChange', handleViewportSizeChange);
|
|
31
30
|
}, [apiRef, handleViewportSizeChange]);
|
|
32
31
|
let height = (_viewportInnerSize$he = viewportInnerSize == null ? void 0 : viewportInnerSize.height) != null ? _viewportInnerSize$he : 0;
|
|
33
32
|
|
|
@@ -55,8 +54,9 @@ export function GridOverlays() {
|
|
|
55
54
|
const rootProps = useGridRootProps();
|
|
56
55
|
const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
57
56
|
const visibleRowCount = useGridSelector(apiRef, gridVisibleRowCountSelector);
|
|
58
|
-
const
|
|
59
|
-
const
|
|
57
|
+
const loading = useGridSelector(apiRef, gridRowsLoadingSelector);
|
|
58
|
+
const showNoRowsOverlay = !loading && totalRowCount === 0;
|
|
59
|
+
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
60
60
|
let overlay = null;
|
|
61
61
|
|
|
62
62
|
if (showNoRowsOverlay) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
3
3
|
import { GridMenuProps } from '../menu/GridMenu';
|
|
4
|
-
|
|
4
|
+
interface GridActionsCellProps extends Omit<GridRenderCellParams, 'value' | 'formattedValue'> {
|
|
5
|
+
value?: GridRenderCellParams['value'];
|
|
6
|
+
formattedValue?: GridRenderCellParams['formattedValue'];
|
|
7
|
+
position?: GridMenuProps['position'];
|
|
8
|
+
}
|
|
5
9
|
declare const GridActionsCell: {
|
|
6
10
|
(props: GridActionsCellProps): JSX.Element;
|
|
7
11
|
propTypes: any;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["colDef", "id", "api", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "getValue", "tabIndex", "position", "focusElementRef"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import IconButton from '@mui/material/IconButton';
|
|
@@ -7,26 +9,33 @@ import { unstable_useId as useId } from '@mui/material/utils';
|
|
|
7
9
|
import { gridClasses } from '../../constants/gridClasses';
|
|
8
10
|
import { GridMenu } from '../menu/GridMenu';
|
|
9
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
10
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
15
|
|
|
13
16
|
const hasActions = colDef => typeof colDef.getActions === 'function';
|
|
14
17
|
|
|
15
18
|
const GridActionsCell = props => {
|
|
19
|
+
const {
|
|
20
|
+
colDef,
|
|
21
|
+
id,
|
|
22
|
+
hasFocus,
|
|
23
|
+
tabIndex,
|
|
24
|
+
position = 'bottom-end',
|
|
25
|
+
focusElementRef
|
|
26
|
+
} = props,
|
|
27
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
28
|
+
|
|
29
|
+
const [focusedButtonIndex, setFocusedButtonIndex] = React.useState(-1);
|
|
16
30
|
const [open, setOpen] = React.useState(false);
|
|
31
|
+
const apiRef = useGridApiContext();
|
|
32
|
+
const rootRef = React.useRef(null);
|
|
17
33
|
const buttonRef = React.useRef(null);
|
|
34
|
+
const ignoreCallToFocus = React.useRef(false);
|
|
18
35
|
const touchRippleRefs = React.useRef({});
|
|
19
36
|
const menuId = useId();
|
|
20
37
|
const buttonId = useId();
|
|
21
38
|
const rootProps = useGridRootProps();
|
|
22
|
-
const {
|
|
23
|
-
colDef,
|
|
24
|
-
id,
|
|
25
|
-
api,
|
|
26
|
-
hasFocus,
|
|
27
|
-
position = 'bottom-end'
|
|
28
|
-
} = props; // TODO apply the rest to the root element
|
|
29
|
-
|
|
30
39
|
React.useLayoutEffect(() => {
|
|
31
40
|
if (!hasFocus) {
|
|
32
41
|
Object.entries(touchRippleRefs.current).forEach(([index, ref]) => {
|
|
@@ -36,56 +45,153 @@ const GridActionsCell = props => {
|
|
|
36
45
|
});
|
|
37
46
|
}
|
|
38
47
|
}, [hasFocus]);
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
if (focusedButtonIndex < 0 || !rootRef.current) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (focusedButtonIndex >= rootRef.current.children.length) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const child = rootRef.current.children[focusedButtonIndex];
|
|
58
|
+
child.focus();
|
|
59
|
+
}, [focusedButtonIndex]);
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
if (!hasFocus) {
|
|
62
|
+
setFocusedButtonIndex(-1);
|
|
63
|
+
ignoreCallToFocus.current = false;
|
|
64
|
+
}
|
|
65
|
+
}, [hasFocus]);
|
|
66
|
+
React.useImperativeHandle(focusElementRef, () => ({
|
|
67
|
+
focus() {
|
|
68
|
+
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
69
|
+
if (!ignoreCallToFocus.current) {
|
|
70
|
+
setFocusedButtonIndex(0);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}), []);
|
|
39
75
|
|
|
40
76
|
if (!hasActions(colDef)) {
|
|
41
77
|
throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
|
|
42
78
|
}
|
|
43
79
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const hideMenu = () => setOpen(false);
|
|
47
|
-
|
|
48
|
-
const options = colDef.getActions(api.getRowParams(id));
|
|
80
|
+
const options = colDef.getActions(apiRef.current.getRowParams(id));
|
|
49
81
|
const iconButtons = options.filter(option => !option.props.showInMenu);
|
|
50
82
|
const menuButtons = options.filter(option => option.props.showInMenu);
|
|
83
|
+
const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
|
|
84
|
+
React.useEffect(() => {
|
|
85
|
+
if (focusedButtonIndex >= numberOfButtons) {
|
|
86
|
+
setFocusedButtonIndex(numberOfButtons - 1);
|
|
87
|
+
}
|
|
88
|
+
}, [focusedButtonIndex, numberOfButtons]);
|
|
89
|
+
|
|
90
|
+
const showMenu = () => {
|
|
91
|
+
setOpen(true);
|
|
92
|
+
setFocusedButtonIndex(numberOfButtons - 1);
|
|
93
|
+
ignoreCallToFocus.current = true;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const hideMenu = () => {
|
|
97
|
+
setOpen(false);
|
|
98
|
+
};
|
|
51
99
|
|
|
52
100
|
const handleTouchRippleRef = index => instance => {
|
|
53
101
|
touchRippleRefs.current[index] = instance;
|
|
54
102
|
};
|
|
55
103
|
|
|
56
|
-
|
|
104
|
+
const handleButtonClick = (index, onClick) => event => {
|
|
105
|
+
setFocusedButtonIndex(index);
|
|
106
|
+
ignoreCallToFocus.current = true;
|
|
107
|
+
|
|
108
|
+
if (onClick) {
|
|
109
|
+
onClick(event);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const handleRootKeyDown = event => {
|
|
114
|
+
if (numberOfButtons <= 1) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let newIndex = focusedButtonIndex;
|
|
119
|
+
|
|
120
|
+
if (event.key === 'ArrowRight') {
|
|
121
|
+
newIndex += 1;
|
|
122
|
+
} else if (event.key === 'ArrowLeft') {
|
|
123
|
+
newIndex -= 1;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
127
|
+
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (newIndex !== focusedButtonIndex) {
|
|
131
|
+
event.preventDefault(); // Prevent scrolling
|
|
132
|
+
|
|
133
|
+
event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
|
|
134
|
+
|
|
135
|
+
setFocusedButtonIndex(newIndex);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const handleListKeyDown = event => {
|
|
140
|
+
if (event.key === 'Tab') {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
|
|
145
|
+
hideMenu();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return /*#__PURE__*/_jsxs("div", _extends({
|
|
150
|
+
role: "menu",
|
|
151
|
+
ref: rootRef,
|
|
152
|
+
tabIndex: -1,
|
|
57
153
|
className: gridClasses.actionsCell,
|
|
154
|
+
onKeyDown: handleRootKeyDown
|
|
155
|
+
}, other, {
|
|
58
156
|
children: [iconButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
59
157
|
key: index,
|
|
60
|
-
touchRippleRef: handleTouchRippleRef(index)
|
|
61
|
-
|
|
158
|
+
touchRippleRef: handleTouchRippleRef(index),
|
|
159
|
+
onClick: handleButtonClick(index, button.props.onClick),
|
|
160
|
+
tabIndex: focusedButtonIndex === index ? tabIndex : -1
|
|
161
|
+
})), menuButtons.length > 0 && buttonId && /*#__PURE__*/_jsx(IconButton, {
|
|
62
162
|
ref: buttonRef,
|
|
63
163
|
id: buttonId,
|
|
64
|
-
"aria-label":
|
|
164
|
+
"aria-label": apiRef.current.getLocaleText('actionsCellMore'),
|
|
65
165
|
"aria-controls": menuId,
|
|
66
166
|
"aria-expanded": open ? 'true' : undefined,
|
|
67
167
|
"aria-haspopup": "true",
|
|
168
|
+
role: "menuitem",
|
|
68
169
|
size: "small",
|
|
69
170
|
onClick: showMenu,
|
|
171
|
+
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
172
|
+
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1,
|
|
70
173
|
children: /*#__PURE__*/_jsx(rootProps.components.MoreActionsIcon, {
|
|
71
174
|
fontSize: "small"
|
|
72
175
|
})
|
|
73
176
|
}), menuButtons.length > 0 && /*#__PURE__*/_jsx(GridMenu, {
|
|
74
|
-
id: menuId,
|
|
75
177
|
onClickAway: hideMenu,
|
|
76
178
|
onClick: hideMenu,
|
|
77
179
|
open: open,
|
|
78
180
|
target: buttonRef.current,
|
|
79
181
|
position: position,
|
|
80
|
-
"aria-labelledby": buttonId,
|
|
81
182
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
183
|
+
id: menuId,
|
|
82
184
|
className: gridClasses.menuList,
|
|
185
|
+
onKeyDown: handleListKeyDown,
|
|
186
|
+
"aria-labelledby": buttonId,
|
|
187
|
+
variant: "menu",
|
|
188
|
+
autoFocusItem: true,
|
|
83
189
|
children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
84
190
|
key: index
|
|
85
191
|
}))
|
|
86
192
|
})
|
|
87
193
|
})]
|
|
88
|
-
});
|
|
194
|
+
}));
|
|
89
195
|
};
|
|
90
196
|
|
|
91
197
|
process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
@@ -100,11 +206,42 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
100
206
|
*/
|
|
101
207
|
api: PropTypes.any.isRequired,
|
|
102
208
|
|
|
209
|
+
/**
|
|
210
|
+
* The mode of the cell.
|
|
211
|
+
*/
|
|
212
|
+
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
213
|
+
|
|
103
214
|
/**
|
|
104
215
|
* The column of the row that the current cell belongs to.
|
|
105
216
|
*/
|
|
106
217
|
colDef: PropTypes.object.isRequired,
|
|
107
218
|
|
|
219
|
+
/**
|
|
220
|
+
* The column field of the cell that triggered the event.
|
|
221
|
+
*/
|
|
222
|
+
field: PropTypes.string.isRequired,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* A ref allowing to set imperative focus.
|
|
226
|
+
* It can be passed to the element that should receive focus.
|
|
227
|
+
* @ignore - do not document.
|
|
228
|
+
*/
|
|
229
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
230
|
+
current: PropTypes.shape({
|
|
231
|
+
focus: PropTypes.func.isRequired
|
|
232
|
+
})
|
|
233
|
+
})]),
|
|
234
|
+
formattedValue: PropTypes.any,
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Get the cell value of a row and field.
|
|
238
|
+
* @param {GridRowId} id The row id.
|
|
239
|
+
* @param {string} field The field.
|
|
240
|
+
* @returns {any} The cell value.
|
|
241
|
+
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
242
|
+
*/
|
|
243
|
+
getValue: PropTypes.func.isRequired,
|
|
244
|
+
|
|
108
245
|
/**
|
|
109
246
|
* If true, the cell is the active element.
|
|
110
247
|
*/
|
|
@@ -114,7 +251,28 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
114
251
|
* The grid row id.
|
|
115
252
|
*/
|
|
116
253
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
117
|
-
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* If true, the cell is editable.
|
|
257
|
+
*/
|
|
258
|
+
isEditable: PropTypes.bool,
|
|
259
|
+
position: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* The row model of the row that the current cell belongs to.
|
|
263
|
+
*/
|
|
264
|
+
row: PropTypes.object.isRequired,
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* The node of the row that the current cell belongs to.
|
|
268
|
+
*/
|
|
269
|
+
rowNode: PropTypes.object.isRequired,
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* the tabIndex value.
|
|
273
|
+
*/
|
|
274
|
+
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
275
|
+
value: PropTypes.any
|
|
118
276
|
} : void 0;
|
|
119
277
|
export { GridActionsCell };
|
|
120
278
|
export const renderActionsCell = params => /*#__PURE__*/_jsx(GridActionsCell, _extends({}, params));
|
|
@@ -10,8 +10,70 @@ export declare type GridActionsCellItemProps = {
|
|
|
10
10
|
} & IconButtonProps) | ({
|
|
11
11
|
showInMenu: true;
|
|
12
12
|
} & MenuItemProps));
|
|
13
|
-
declare const GridActionsCellItem: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Pick<{
|
|
14
|
+
label: string;
|
|
15
|
+
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
showInMenu?: false | undefined;
|
|
18
|
+
icon: React.ReactElement;
|
|
19
|
+
} & {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
classes?: Partial<import("@mui/material/IconButton").IconButtonClasses> | undefined;
|
|
22
|
+
color?: "inherit" | "default" | "warning" | "error" | "success" | "info" | "primary" | "secondary" | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
disableFocusRipple?: boolean | undefined;
|
|
25
|
+
edge?: false | "end" | "start" | undefined;
|
|
26
|
+
size?: "medium" | "large" | "small" | undefined;
|
|
27
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
28
|
+
} & Omit<{
|
|
29
|
+
action?: React.Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
30
|
+
centerRipple?: boolean | undefined;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
33
|
+
disabled?: boolean | undefined;
|
|
34
|
+
disableRipple?: boolean | undefined;
|
|
35
|
+
disableTouchRipple?: boolean | undefined;
|
|
36
|
+
focusRipple?: boolean | undefined;
|
|
37
|
+
focusVisibleClassName?: string | undefined;
|
|
38
|
+
LinkComponent?: React.ElementType<any> | undefined;
|
|
39
|
+
onFocusVisible?: React.FocusEventHandler<any> | undefined;
|
|
40
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
41
|
+
tabIndex?: number | undefined;
|
|
42
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
43
|
+
touchRippleRef?: React.Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
44
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
45
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
46
|
+
}, "color" | "size" | "disabled" | "children" | "action" | "tabIndex" | "sx" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge">, "hidden" | "color" | "size" | "icon" | "translate" | "disabled" | "form" | "label" | "slot" | "title" | "children" | "key" | "action" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "type" | "value" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "showInMenu"> | Pick<{
|
|
47
|
+
label: string;
|
|
48
|
+
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
49
|
+
} & {
|
|
50
|
+
showInMenu: true;
|
|
51
|
+
} & {
|
|
52
|
+
autoFocus?: boolean | undefined;
|
|
53
|
+
classes?: Partial<import("@mui/material/MenuItem").MenuItemClasses> | undefined;
|
|
54
|
+
dense?: boolean | undefined;
|
|
55
|
+
disabled?: boolean | undefined;
|
|
56
|
+
disableGutters?: boolean | undefined;
|
|
57
|
+
divider?: boolean | undefined;
|
|
58
|
+
selected?: boolean | undefined;
|
|
59
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
60
|
+
} & Omit<{
|
|
61
|
+
action?: React.Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
62
|
+
centerRipple?: boolean | undefined;
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
65
|
+
disabled?: boolean | undefined;
|
|
66
|
+
disableRipple?: boolean | undefined;
|
|
67
|
+
disableTouchRipple?: boolean | undefined;
|
|
68
|
+
focusRipple?: boolean | undefined;
|
|
69
|
+
focusVisibleClassName?: string | undefined;
|
|
70
|
+
LinkComponent?: React.ElementType<any> | undefined;
|
|
71
|
+
onFocusVisible?: React.FocusEventHandler<any> | undefined;
|
|
72
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
73
|
+
tabIndex?: number | undefined;
|
|
74
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
75
|
+
touchRippleRef?: React.Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
76
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof React.LiHTMLAttributes<HTMLLIElement>> & {
|
|
77
|
+
ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
|
|
78
|
+
}, "dense" | "disabled" | "children" | "action" | "autoFocus" | "tabIndex" | "selected" | "sx" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters">, "hidden" | "color" | "dense" | "icon" | "translate" | "disabled" | "label" | "slot" | "title" | "children" | "key" | "action" | "autoFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "selected" | "value" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "divider" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters" | "showInMenu">) & React.RefAttributes<HTMLButtonElement>>;
|
|
17
79
|
export { GridActionsCellItem };
|
|
@@ -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
|
-
const GridActionsCellItem = props => {
|
|
11
|
+
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
13
12
|
const {
|
|
14
13
|
label,
|
|
15
14
|
icon,
|
|
@@ -26,7 +25,9 @@ const GridActionsCellItem = props => {
|
|
|
26
25
|
|
|
27
26
|
if (!showInMenu) {
|
|
28
27
|
return /*#__PURE__*/_jsx(IconButton, _extends({
|
|
28
|
+
ref: ref,
|
|
29
29
|
size: "small",
|
|
30
|
+
role: "menuitem",
|
|
30
31
|
"aria-label": label
|
|
31
32
|
}, other, {
|
|
32
33
|
onClick: handleClick,
|
|
@@ -36,14 +37,15 @@ const GridActionsCellItem = props => {
|
|
|
36
37
|
}));
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
40
|
+
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
41
|
+
ref: ref
|
|
42
|
+
}, other, {
|
|
40
43
|
onClick: onClick,
|
|
41
44
|
children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
42
45
|
children: icon
|
|
43
46
|
}), label]
|
|
44
47
|
}));
|
|
45
|
-
};
|
|
46
|
-
|
|
48
|
+
});
|
|
47
49
|
process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
|
|
48
50
|
// ----------------------------- Warning --------------------------------
|
|
49
51
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -17,6 +17,7 @@ export interface GridCellProps<V = any, F = V> {
|
|
|
17
17
|
cellMode?: GridCellMode;
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
tabIndex: 0 | -1;
|
|
20
|
+
colSpan?: number;
|
|
20
21
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
21
22
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
22
23
|
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["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
|
+
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"];
|
|
4
4
|
|
|
5
5
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
6
6
|
import * as React from 'react';
|
|
@@ -9,7 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
10
10
|
import { ownerDocument, capitalize } from '@mui/material/utils';
|
|
11
11
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
12
|
-
import {
|
|
12
|
+
import { GridCellModes } from '../../models';
|
|
13
13
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
14
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
15
15
|
import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
@@ -66,6 +66,7 @@ function GridCell(props) {
|
|
|
66
66
|
width,
|
|
67
67
|
className,
|
|
68
68
|
showRightBorder,
|
|
69
|
+
colSpan,
|
|
69
70
|
onClick,
|
|
70
71
|
onDoubleClick,
|
|
71
72
|
onMouseDown,
|
|
@@ -78,6 +79,7 @@ function GridCell(props) {
|
|
|
78
79
|
|
|
79
80
|
const valueToRender = formattedValue == null ? value : formattedValue;
|
|
80
81
|
const cellRef = React.useRef(null);
|
|
82
|
+
const focusElementRef = React.useRef(null);
|
|
81
83
|
const apiRef = useGridApiContext();
|
|
82
84
|
const rootProps = useGridRootProps();
|
|
83
85
|
const ownerState = {
|
|
@@ -128,7 +130,7 @@ function GridCell(props) {
|
|
|
128
130
|
|
|
129
131
|
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
130
132
|
const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
131
|
-
const elementToFocus = focusableElement || cellRef.current;
|
|
133
|
+
const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
|
|
132
134
|
|
|
133
135
|
if (doesSupportPreventScroll()) {
|
|
134
136
|
elementToFocus.focus({
|
|
@@ -162,6 +164,26 @@ function GridCell(props) {
|
|
|
162
164
|
};
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
const column = apiRef.current.getColumn(field);
|
|
168
|
+
const managesOwnFocus = column.type === 'actions';
|
|
169
|
+
|
|
170
|
+
const renderChildren = () => {
|
|
171
|
+
if (children == null) {
|
|
172
|
+
return /*#__PURE__*/_jsx("div", {
|
|
173
|
+
className: classes.content,
|
|
174
|
+
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
179
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
180
|
+
focusElementRef
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return children;
|
|
185
|
+
};
|
|
186
|
+
|
|
165
187
|
return /*#__PURE__*/_jsx("div", _extends({
|
|
166
188
|
ref: cellRef,
|
|
167
189
|
className: clsx(className, classes.root),
|
|
@@ -169,21 +191,19 @@ function GridCell(props) {
|
|
|
169
191
|
"data-field": field,
|
|
170
192
|
"data-colindex": colIndex,
|
|
171
193
|
"aria-colindex": colIndex + 1,
|
|
194
|
+
"aria-colspan": colSpan,
|
|
172
195
|
style: style,
|
|
173
|
-
tabIndex: cellMode === 'view' || !isEditable ? tabIndex : -1,
|
|
174
|
-
onClick: publish(
|
|
175
|
-
onDoubleClick: publish(
|
|
176
|
-
onMouseDown: publish(
|
|
177
|
-
onMouseUp: publishMouseUp(
|
|
178
|
-
onKeyDown: publish(
|
|
179
|
-
onDragEnter: publish(
|
|
180
|
-
onDragOver: publish(
|
|
196
|
+
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
197
|
+
onClick: publish('cellClick', onClick),
|
|
198
|
+
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
199
|
+
onMouseDown: publish('cellMouseDown', onMouseDown),
|
|
200
|
+
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
201
|
+
onKeyDown: publish('cellKeyDown', onKeyDown),
|
|
202
|
+
onDragEnter: publish('cellDragEnter', onDragEnter),
|
|
203
|
+
onDragOver: publish('cellDragOver', onDragOver)
|
|
181
204
|
}, other, {
|
|
182
205
|
onFocus: handleFocus,
|
|
183
|
-
children:
|
|
184
|
-
className: classes.content,
|
|
185
|
-
children: valueToRender == null ? void 0 : valueToRender.toString()
|
|
186
|
-
})
|
|
206
|
+
children: renderChildren()
|
|
187
207
|
}));
|
|
188
208
|
}
|
|
189
209
|
|
|
@@ -197,6 +217,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
197
217
|
children: PropTypes.node,
|
|
198
218
|
className: PropTypes.string,
|
|
199
219
|
colIndex: PropTypes.number.isRequired,
|
|
220
|
+
colSpan: PropTypes.number,
|
|
200
221
|
field: PropTypes.string.isRequired,
|
|
201
222
|
formattedValue: PropTypes.any,
|
|
202
223
|
hasFocus: PropTypes.bool,
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridRenderEditCellParams } from '../../models/params/gridCellParams';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export interface GridEditBooleanCellProps extends GridRenderEditCellParams, Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, 'id' | 'tabIndex'> {
|
|
4
|
+
/**
|
|
5
|
+
* Callback called when the value is changed by the user.
|
|
6
|
+
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
7
|
+
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
8
|
+
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
9
|
+
*/
|
|
10
|
+
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: boolean) => Promise<void> | void;
|
|
11
|
+
}
|
|
12
|
+
declare function GridEditBooleanCell(props: GridEditBooleanCellProps): JSX.Element;
|
|
13
|
+
declare namespace GridEditBooleanCell {
|
|
14
|
+
var propTypes: any;
|
|
15
|
+
}
|
|
16
|
+
export { GridEditBooleanCell };
|
|
17
|
+
export declare const renderEditBooleanCell: (params: GridEditBooleanCellProps) => JSX.Element;
|