@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
|
@@ -4,11 +4,10 @@ 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';
|
|
11
|
-
import { GridEvents } from '../../models/events';
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
12
|
|
|
14
13
|
function GridOverlayWrapper(props) {
|
|
@@ -33,7 +32,7 @@ function GridOverlayWrapper(props) {
|
|
|
33
32
|
setViewportInnerSize((_apiRef$current$getRo3 = (_apiRef$current$getRo4 = apiRef.current.getRootDimensions()) == null ? void 0 : _apiRef$current$getRo4.viewportInnerSize) != null ? _apiRef$current$getRo3 : null);
|
|
34
33
|
}, [apiRef]);
|
|
35
34
|
useEnhancedEffect(function () {
|
|
36
|
-
return apiRef.current.subscribeEvent(
|
|
35
|
+
return apiRef.current.subscribeEvent('viewportInnerSizeChange', handleViewportSizeChange);
|
|
37
36
|
}, [apiRef, handleViewportSizeChange]);
|
|
38
37
|
var height = (_viewportInnerSize$he = viewportInnerSize == null ? void 0 : viewportInnerSize.height) != null ? _viewportInnerSize$he : 0;
|
|
39
38
|
|
|
@@ -61,8 +60,9 @@ export function GridOverlays() {
|
|
|
61
60
|
var rootProps = useGridRootProps();
|
|
62
61
|
var totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
63
62
|
var visibleRowCount = useGridSelector(apiRef, gridVisibleRowCountSelector);
|
|
64
|
-
var
|
|
65
|
-
var
|
|
63
|
+
var loading = useGridSelector(apiRef, gridRowsLoadingSelector);
|
|
64
|
+
var showNoRowsOverlay = !loading && totalRowCount === 0;
|
|
65
|
+
var showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
66
66
|
var overlay = null;
|
|
67
67
|
|
|
68
68
|
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,62 @@ var GridActionsCell = function GridActionsCell(props) {
|
|
|
46
68
|
});
|
|
47
69
|
}
|
|
48
70
|
}, [hasFocus]);
|
|
71
|
+
React.useEffect(function () {
|
|
72
|
+
if (focusedButtonIndex < 0 || !rootRef.current) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (focusedButtonIndex >= rootRef.current.children.length) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var child = rootRef.current.children[focusedButtonIndex];
|
|
81
|
+
child.focus();
|
|
82
|
+
}, [focusedButtonIndex]);
|
|
83
|
+
React.useEffect(function () {
|
|
84
|
+
if (!hasFocus) {
|
|
85
|
+
setFocusedButtonIndex(-1);
|
|
86
|
+
ignoreCallToFocus.current = false;
|
|
87
|
+
}
|
|
88
|
+
}, [hasFocus]);
|
|
89
|
+
React.useImperativeHandle(focusElementRef, function () {
|
|
90
|
+
return {
|
|
91
|
+
focus: function focus() {
|
|
92
|
+
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
93
|
+
if (!ignoreCallToFocus.current) {
|
|
94
|
+
setFocusedButtonIndex(0);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}, []);
|
|
49
99
|
|
|
50
100
|
if (!hasActions(colDef)) {
|
|
51
101
|
throw new Error('MUI: Missing the `getActions` property in the `GridColDef`.');
|
|
52
102
|
}
|
|
53
103
|
|
|
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));
|
|
104
|
+
var options = colDef.getActions(apiRef.current.getRowParams(id));
|
|
63
105
|
var iconButtons = options.filter(function (option) {
|
|
64
106
|
return !option.props.showInMenu;
|
|
65
107
|
});
|
|
66
108
|
var menuButtons = options.filter(function (option) {
|
|
67
109
|
return option.props.showInMenu;
|
|
68
110
|
});
|
|
111
|
+
var numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
|
|
112
|
+
React.useEffect(function () {
|
|
113
|
+
if (focusedButtonIndex >= numberOfButtons) {
|
|
114
|
+
setFocusedButtonIndex(numberOfButtons - 1);
|
|
115
|
+
}
|
|
116
|
+
}, [focusedButtonIndex, numberOfButtons]);
|
|
117
|
+
|
|
118
|
+
var showMenu = function showMenu() {
|
|
119
|
+
setOpen(true);
|
|
120
|
+
setFocusedButtonIndex(numberOfButtons - 1);
|
|
121
|
+
ignoreCallToFocus.current = true;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var hideMenu = function hideMenu() {
|
|
125
|
+
setOpen(false);
|
|
126
|
+
};
|
|
69
127
|
|
|
70
128
|
var handleTouchRippleRef = function handleTouchRippleRef(index) {
|
|
71
129
|
return function (instance) {
|
|
@@ -73,35 +131,95 @@ var GridActionsCell = function GridActionsCell(props) {
|
|
|
73
131
|
};
|
|
74
132
|
};
|
|
75
133
|
|
|
76
|
-
|
|
134
|
+
var handleButtonClick = function handleButtonClick(index, onClick) {
|
|
135
|
+
return function (event) {
|
|
136
|
+
setFocusedButtonIndex(index);
|
|
137
|
+
ignoreCallToFocus.current = true;
|
|
138
|
+
|
|
139
|
+
if (onClick) {
|
|
140
|
+
onClick(event);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var handleRootKeyDown = function handleRootKeyDown(event) {
|
|
146
|
+
if (numberOfButtons <= 1) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
var newIndex = focusedButtonIndex;
|
|
151
|
+
|
|
152
|
+
if (event.key === 'ArrowRight') {
|
|
153
|
+
newIndex += 1;
|
|
154
|
+
} else if (event.key === 'ArrowLeft') {
|
|
155
|
+
newIndex -= 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
159
|
+
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (newIndex !== focusedButtonIndex) {
|
|
163
|
+
event.preventDefault(); // Prevent scrolling
|
|
164
|
+
|
|
165
|
+
event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
|
|
166
|
+
|
|
167
|
+
setFocusedButtonIndex(newIndex);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
var handleListKeyDown = function handleListKeyDown(event) {
|
|
172
|
+
if (event.key === 'Tab') {
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
|
|
177
|
+
hideMenu();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return /*#__PURE__*/_jsxs("div", _extends({
|
|
182
|
+
role: "menu",
|
|
183
|
+
ref: rootRef,
|
|
184
|
+
tabIndex: -1,
|
|
77
185
|
className: gridClasses.actionsCell,
|
|
186
|
+
onKeyDown: handleRootKeyDown
|
|
187
|
+
}, other, {
|
|
78
188
|
children: [iconButtons.map(function (button, index) {
|
|
79
189
|
return /*#__PURE__*/React.cloneElement(button, {
|
|
80
190
|
key: index,
|
|
81
|
-
touchRippleRef: handleTouchRippleRef(index)
|
|
191
|
+
touchRippleRef: handleTouchRippleRef(index),
|
|
192
|
+
onClick: handleButtonClick(index, button.props.onClick),
|
|
193
|
+
tabIndex: focusedButtonIndex === index ? tabIndex : -1
|
|
82
194
|
});
|
|
83
|
-
}), menuButtons.length > 0 && /*#__PURE__*/_jsx(IconButton, {
|
|
195
|
+
}), menuButtons.length > 0 && buttonId && /*#__PURE__*/_jsx(IconButton, {
|
|
84
196
|
ref: buttonRef,
|
|
85
197
|
id: buttonId,
|
|
86
|
-
"aria-label":
|
|
198
|
+
"aria-label": apiRef.current.getLocaleText('actionsCellMore'),
|
|
87
199
|
"aria-controls": menuId,
|
|
88
200
|
"aria-expanded": open ? 'true' : undefined,
|
|
89
201
|
"aria-haspopup": "true",
|
|
202
|
+
role: "menuitem",
|
|
90
203
|
size: "small",
|
|
91
204
|
onClick: showMenu,
|
|
205
|
+
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
206
|
+
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1,
|
|
92
207
|
children: /*#__PURE__*/_jsx(rootProps.components.MoreActionsIcon, {
|
|
93
208
|
fontSize: "small"
|
|
94
209
|
})
|
|
95
210
|
}), menuButtons.length > 0 && /*#__PURE__*/_jsx(GridMenu, {
|
|
96
|
-
id: menuId,
|
|
97
211
|
onClickAway: hideMenu,
|
|
98
212
|
onClick: hideMenu,
|
|
99
213
|
open: open,
|
|
100
214
|
target: buttonRef.current,
|
|
101
215
|
position: position,
|
|
102
|
-
"aria-labelledby": buttonId,
|
|
103
216
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
217
|
+
id: menuId,
|
|
104
218
|
className: gridClasses.menuList,
|
|
219
|
+
onKeyDown: handleListKeyDown,
|
|
220
|
+
"aria-labelledby": buttonId,
|
|
221
|
+
variant: "menu",
|
|
222
|
+
autoFocusItem: true,
|
|
105
223
|
children: menuButtons.map(function (button, index) {
|
|
106
224
|
return /*#__PURE__*/React.cloneElement(button, {
|
|
107
225
|
key: index
|
|
@@ -109,7 +227,7 @@ var GridActionsCell = function GridActionsCell(props) {
|
|
|
109
227
|
})
|
|
110
228
|
})
|
|
111
229
|
})]
|
|
112
|
-
});
|
|
230
|
+
}));
|
|
113
231
|
};
|
|
114
232
|
|
|
115
233
|
process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
@@ -124,11 +242,42 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
124
242
|
*/
|
|
125
243
|
api: PropTypes.any.isRequired,
|
|
126
244
|
|
|
245
|
+
/**
|
|
246
|
+
* The mode of the cell.
|
|
247
|
+
*/
|
|
248
|
+
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
249
|
+
|
|
127
250
|
/**
|
|
128
251
|
* The column of the row that the current cell belongs to.
|
|
129
252
|
*/
|
|
130
253
|
colDef: PropTypes.object.isRequired,
|
|
131
254
|
|
|
255
|
+
/**
|
|
256
|
+
* The column field of the cell that triggered the event.
|
|
257
|
+
*/
|
|
258
|
+
field: PropTypes.string.isRequired,
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* A ref allowing to set imperative focus.
|
|
262
|
+
* It can be passed to the element that should receive focus.
|
|
263
|
+
* @ignore - do not document.
|
|
264
|
+
*/
|
|
265
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
266
|
+
current: PropTypes.shape({
|
|
267
|
+
focus: PropTypes.func.isRequired
|
|
268
|
+
})
|
|
269
|
+
})]),
|
|
270
|
+
formattedValue: PropTypes.any,
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Get the cell value of a row and field.
|
|
274
|
+
* @param {GridRowId} id The row id.
|
|
275
|
+
* @param {string} field The field.
|
|
276
|
+
* @returns {any} The cell value.
|
|
277
|
+
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
278
|
+
*/
|
|
279
|
+
getValue: PropTypes.func.isRequired,
|
|
280
|
+
|
|
132
281
|
/**
|
|
133
282
|
* If true, the cell is the active element.
|
|
134
283
|
*/
|
|
@@ -138,7 +287,28 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
138
287
|
* The grid row id.
|
|
139
288
|
*/
|
|
140
289
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
141
|
-
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* If true, the cell is editable.
|
|
293
|
+
*/
|
|
294
|
+
isEditable: PropTypes.bool,
|
|
295
|
+
position: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* The row model of the row that the current cell belongs to.
|
|
299
|
+
*/
|
|
300
|
+
row: PropTypes.object.isRequired,
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* The node of the row that the current cell belongs to.
|
|
304
|
+
*/
|
|
305
|
+
rowNode: PropTypes.object.isRequired,
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* the tabIndex value.
|
|
309
|
+
*/
|
|
310
|
+
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
311
|
+
value: PropTypes.any
|
|
142
312
|
} : void 0;
|
|
143
313
|
export { GridActionsCell };
|
|
144
314
|
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';
|
|
@@ -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';
|
|
@@ -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,21 +194,19 @@ 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,
|
|
176
|
-
onClick: publish(
|
|
177
|
-
onDoubleClick: publish(
|
|
178
|
-
onMouseDown: publish(
|
|
179
|
-
onMouseUp: publishMouseUp(
|
|
180
|
-
onKeyDown: publish(
|
|
181
|
-
onDragEnter: publish(
|
|
182
|
-
onDragOver: publish(
|
|
199
|
+
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
200
|
+
onClick: publish('cellClick', onClick),
|
|
201
|
+
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
202
|
+
onMouseDown: publish('cellMouseDown', onMouseDown),
|
|
203
|
+
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
204
|
+
onKeyDown: publish('cellKeyDown', onKeyDown),
|
|
205
|
+
onDragEnter: publish('cellDragEnter', onDragEnter),
|
|
206
|
+
onDragOver: publish('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,6 +220,7 @@ 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
225
|
formattedValue: PropTypes.any,
|
|
204
226
|
hasFocus: PropTypes.bool,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error"];
|
|
5
|
+
var _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange"];
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
7
|
import * as React from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
6
9
|
import clsx from 'clsx';
|
|
7
10
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
8
11
|
import { unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
@@ -18,7 +21,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
18
21
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
19
22
|
};
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
function GridEditBooleanCell(props) {
|
|
22
25
|
var _rootProps$components;
|
|
23
26
|
|
|
24
27
|
var idProp = props.id,
|
|
@@ -38,6 +41,7 @@ export function GridEditBooleanCell(props) {
|
|
|
38
41
|
isValidating = props.isValidating,
|
|
39
42
|
isProcessingProps = props.isProcessingProps,
|
|
40
43
|
error = props.error,
|
|
44
|
+
onValueChange = props.onValueChange,
|
|
41
45
|
other = _objectWithoutProperties(props, _excluded);
|
|
42
46
|
|
|
43
47
|
var inputRef = React.useRef(null);
|
|
@@ -53,15 +57,44 @@ export function GridEditBooleanCell(props) {
|
|
|
53
57
|
classes: rootProps.classes
|
|
54
58
|
};
|
|
55
59
|
var classes = useUtilityClasses(ownerState);
|
|
56
|
-
var handleChange = React.useCallback(function (
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
var handleChange = React.useCallback( /*#__PURE__*/function () {
|
|
61
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
62
|
+
var newValue;
|
|
63
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
64
|
+
while (1) {
|
|
65
|
+
switch (_context.prev = _context.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
newValue = event.target.checked;
|
|
68
|
+
|
|
69
|
+
if (!onValueChange) {
|
|
70
|
+
_context.next = 4;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_context.next = 4;
|
|
75
|
+
return onValueChange(event, newValue);
|
|
76
|
+
|
|
77
|
+
case 4:
|
|
78
|
+
setValueState(newValue);
|
|
79
|
+
_context.next = 7;
|
|
80
|
+
return api.setEditCellValue({
|
|
81
|
+
id: idProp,
|
|
82
|
+
field: field,
|
|
83
|
+
value: newValue
|
|
84
|
+
}, event);
|
|
85
|
+
|
|
86
|
+
case 7:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, _callee);
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
return function (_x) {
|
|
95
|
+
return _ref.apply(this, arguments);
|
|
96
|
+
};
|
|
97
|
+
}(), [api, field, idProp, onValueChange]);
|
|
65
98
|
React.useEffect(function () {
|
|
66
99
|
setValueState(value);
|
|
67
100
|
}, [value]);
|
|
@@ -83,6 +116,94 @@ export function GridEditBooleanCell(props) {
|
|
|
83
116
|
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseCheckbox))
|
|
84
117
|
}));
|
|
85
118
|
}
|
|
119
|
+
|
|
120
|
+
process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
121
|
+
// ----------------------------- Warning --------------------------------
|
|
122
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
123
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
124
|
+
// ----------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* GridApi that let you manipulate the grid.
|
|
128
|
+
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
|
|
129
|
+
*/
|
|
130
|
+
api: PropTypes.any.isRequired,
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The mode of the cell.
|
|
134
|
+
*/
|
|
135
|
+
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The column of the row that the current cell belongs to.
|
|
139
|
+
*/
|
|
140
|
+
colDef: PropTypes.object.isRequired,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The column field of the cell that triggered the event.
|
|
144
|
+
*/
|
|
145
|
+
field: PropTypes.string.isRequired,
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The cell value formatted with the column valueFormatter.
|
|
149
|
+
*/
|
|
150
|
+
formattedValue: PropTypes.any,
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Get the cell value of a row and field.
|
|
154
|
+
* @param {GridRowId} id The row id.
|
|
155
|
+
* @param {string} field The field.
|
|
156
|
+
* @returns {any} The cell value.
|
|
157
|
+
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
158
|
+
*/
|
|
159
|
+
getValue: PropTypes.func.isRequired,
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* If true, the cell is the active element.
|
|
163
|
+
*/
|
|
164
|
+
hasFocus: PropTypes.bool.isRequired,
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The grid row id.
|
|
168
|
+
*/
|
|
169
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* If true, the cell is editable.
|
|
173
|
+
*/
|
|
174
|
+
isEditable: PropTypes.bool,
|
|
175
|
+
isProcessingProps: PropTypes.bool,
|
|
176
|
+
isValidating: PropTypes.bool,
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Callback called when the value is changed by the user.
|
|
180
|
+
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
181
|
+
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
182
|
+
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
183
|
+
*/
|
|
184
|
+
onValueChange: PropTypes.func,
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The row model of the row that the current cell belongs to.
|
|
188
|
+
*/
|
|
189
|
+
row: PropTypes.object.isRequired,
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The node of the row that the current cell belongs to.
|
|
193
|
+
*/
|
|
194
|
+
rowNode: PropTypes.object.isRequired,
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* the tabIndex value.
|
|
198
|
+
*/
|
|
199
|
+
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The cell value, but if the column has valueGetter, use getValue.
|
|
203
|
+
*/
|
|
204
|
+
value: PropTypes.any
|
|
205
|
+
} : void 0;
|
|
206
|
+
export { GridEditBooleanCell };
|
|
86
207
|
export var renderEditBooleanCell = function renderEditBooleanCell(params) {
|
|
87
208
|
return /*#__PURE__*/_jsx(GridEditBooleanCell, _extends({}, params));
|
|
88
209
|
};
|