@mui/x-data-grid 7.0.0-beta.2 → 7.0.0-beta.4
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 +298 -23
- package/DataGrid/DataGrid.js +0 -6
- package/colDef/gridActionsColDef.js +1 -0
- package/colDef/gridBooleanColDef.js +1 -0
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/components/GridRow.d.ts +3 -1
- package/components/GridRow.js +10 -2
- package/components/GridScrollbarFillerCell.js +6 -21
- package/components/cell/GridCell.js +10 -12
- package/components/columnSelection/GridCellCheckboxRenderer.js +1 -2
- package/components/containers/GridRootStyles.js +51 -23
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -4
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- package/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
- package/constants/gridClasses.d.ts +24 -8
- package/constants/gridClasses.js +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -5
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -48
- package/hooks/features/editing/useGridCellEditing.js +3 -4
- package/hooks/features/editing/useGridRowEditing.js +3 -4
- package/hooks/features/sorting/useGridSorting.js +1 -2
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +9 -0
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +7 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +19 -16
- package/hooks/features/virtualization/useGridVirtualization.d.ts +8 -0
- package/hooks/features/virtualization/useGridVirtualization.js +6 -1
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/models/colDef/gridColDef.d.ts +6 -0
- package/models/events/gridEventLookup.d.ts +1 -8
- package/models/props/DataGridProps.d.ts +0 -6
- package/modern/DataGrid/DataGrid.js +0 -6
- package/modern/colDef/gridActionsColDef.js +1 -0
- package/modern/colDef/gridBooleanColDef.js +1 -0
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/modern/components/GridRow.js +10 -2
- package/modern/components/GridScrollbarFillerCell.js +6 -21
- package/modern/components/cell/GridCell.js +10 -12
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -2
- package/modern/components/containers/GridRootStyles.js +51 -23
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -4
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -48
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -4
- package/modern/hooks/features/sorting/useGridSorting.js +1 -2
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +7 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +18 -14
- package/modern/hooks/features/virtualization/useGridVirtualization.js +6 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/utils/keyboardUtils.js +20 -11
- package/node/DataGrid/DataGrid.js +0 -6
- package/node/colDef/gridActionsColDef.js +1 -0
- package/node/colDef/gridBooleanColDef.js +1 -0
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/node/components/GridRow.js +10 -2
- package/node/components/GridScrollbarFillerCell.js +5 -20
- package/node/components/cell/GridCell.js +10 -12
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -2
- package/node/components/containers/GridRootStyles.js +51 -23
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -4
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +45 -47
- package/node/hooks/features/editing/useGridCellEditing.js +2 -3
- package/node/hooks/features/editing/useGridRowEditing.js +2 -3
- package/node/hooks/features/sorting/useGridSorting.js +1 -2
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +8 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -13
- package/node/hooks/features/virtualization/useGridVirtualization.js +7 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/utils/keyboardUtils.js +25 -20
- package/package.json +3 -3
- package/utils/keyboardUtils.d.ts +7 -6
- package/utils/keyboardUtils.js +20 -11
- package/legacy/DataGrid/DataGrid.js +0 -670
- package/legacy/DataGrid/index.js +0 -2
- package/legacy/DataGrid/useDataGridComponent.js +0 -81
- package/legacy/DataGrid/useDataGridProps.js +0 -98
- package/legacy/colDef/gridActionsColDef.js +0 -18
- package/legacy/colDef/gridBooleanColDef.js +0 -42
- package/legacy/colDef/gridBooleanOperators.js +0 -16
- package/legacy/colDef/gridCheckboxSelectionColDef.js +0 -33
- package/legacy/colDef/gridDateColDef.js +0 -62
- package/legacy/colDef/gridDateOperators.js +0 -115
- package/legacy/colDef/gridDefaultColumnTypes.js +0 -19
- package/legacy/colDef/gridNumericColDef.js +0 -19
- package/legacy/colDef/gridNumericOperators.js +0 -145
- package/legacy/colDef/gridSingleSelectColDef.js +0 -64
- package/legacy/colDef/gridSingleSelectOperators.js +0 -46
- package/legacy/colDef/gridStringColDef.js +0 -27
- package/legacy/colDef/gridStringOperators.js +0 -112
- package/legacy/colDef/index.js +0 -13
- package/legacy/components/GridApiContext.js +0 -5
- package/legacy/components/GridColumnHeaders.js +0 -94
- package/legacy/components/GridDetailPanels.js +0 -4
- package/legacy/components/GridFooter.js +0 -42
- package/legacy/components/GridHeader.js +0 -13
- package/legacy/components/GridHeaders.js +0 -53
- package/legacy/components/GridLoadingOverlay.js +0 -21
- package/legacy/components/GridNoResultsOverlay.js +0 -14
- package/legacy/components/GridNoRowsOverlay.js +0 -23
- package/legacy/components/GridPagination.js +0 -85
- package/legacy/components/GridPinnedRows.js +0 -4
- package/legacy/components/GridRow.js +0 -457
- package/legacy/components/GridRowCount.js +0 -63
- package/legacy/components/GridScrollbarFillerCell.js +0 -34
- package/legacy/components/GridSelectedRowCount.js +0 -66
- package/legacy/components/base/GridBody.js +0 -2
- package/legacy/components/base/GridFooterPlaceholder.js +0 -12
- package/legacy/components/base/GridOverlays.js +0 -122
- package/legacy/components/base/index.js +0 -3
- package/legacy/components/cell/GridActionsCell.js +0 -294
- package/legacy/components/cell/GridActionsCellItem.js +0 -69
- package/legacy/components/cell/GridBooleanCell.js +0 -121
- package/legacy/components/cell/GridCell.js +0 -350
- package/legacy/components/cell/GridEditBooleanCell.js +0 -174
- package/legacy/components/cell/GridEditDateCell.js +0 -230
- package/legacy/components/cell/GridEditInputCell.js +0 -198
- package/legacy/components/cell/GridEditSingleSelectCell.js +0 -231
- package/legacy/components/cell/GridSkeletonCell.js +0 -52
- package/legacy/components/cell/index.js +0 -9
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +0 -59
- package/legacy/components/columnHeaders/GridBaseColumnHeaders.js +0 -41
- package/legacy/components/columnHeaders/GridColumnGroupHeader.js +0 -132
- package/legacy/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -93
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +0 -212
- package/legacy/components/columnHeaders/GridColumnHeaderSeparator.js +0 -71
- package/legacy/components/columnHeaders/GridColumnHeaderSortIcon.js +0 -79
- package/legacy/components/columnHeaders/GridColumnHeaderTitle.js +0 -84
- package/legacy/components/columnHeaders/GridColumnHeadersInner.js +0 -55
- package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -107
- package/legacy/components/columnHeaders/GridIconButtonContainer.js +0 -41
- package/legacy/components/columnHeaders/index.js +0 -5
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -160
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -134
- package/legacy/components/columnSelection/index.js +0 -2
- package/legacy/components/columnsManagement/GridColumnsManagement.js +0 -307
- package/legacy/components/columnsManagement/index.js +0 -1
- package/legacy/components/columnsManagement/utils.js +0 -22
- package/legacy/components/containers/GridFooterContainer.js +0 -50
- package/legacy/components/containers/GridOverlay.js +0 -52
- package/legacy/components/containers/GridRoot.js +0 -79
- package/legacy/components/containers/GridRootStyles.js +0 -398
- package/legacy/components/containers/GridToolbarContainer.js +0 -59
- package/legacy/components/containers/index.js +0 -4
- package/legacy/components/index.js +0 -19
- package/legacy/components/menu/GridMenu.js +0 -132
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +0 -61
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +0 -81
- package/legacy/components/menu/columnMenu/GridColumnMenuContainer.js +0 -56
- package/legacy/components/menu/columnMenu/GridColumnMenuItemProps.js +0 -1
- package/legacy/components/menu/columnMenu/GridColumnMenuProps.js +0 -1
- package/legacy/components/menu/columnMenu/index.js +0 -9
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.js +0 -21
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +0 -41
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +0 -60
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +0 -41
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +0 -80
- package/legacy/components/menu/columnMenu/menuItems/index.js +0 -5
- package/legacy/components/menu/index.js +0 -2
- package/legacy/components/panel/GridColumnsPanel.js +0 -22
- package/legacy/components/panel/GridPanel.js +0 -137
- package/legacy/components/panel/GridPanelContent.js +0 -49
- package/legacy/components/panel/GridPanelFooter.js +0 -50
- package/legacy/components/panel/GridPanelHeader.js +0 -48
- package/legacy/components/panel/GridPanelWrapper.js +0 -64
- package/legacy/components/panel/GridPreferencesPanel.js +0 -26
- package/legacy/components/panel/filterPanel/GridFilterForm.js +0 -528
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +0 -115
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +0 -121
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -116
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -102
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +0 -146
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +0 -104
- package/legacy/components/panel/filterPanel/GridFilterInputValueProps.js +0 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +0 -264
- package/legacy/components/panel/filterPanel/filterPanelUtils.js +0 -22
- package/legacy/components/panel/filterPanel/index.js +0 -9
- package/legacy/components/panel/index.js +0 -7
- package/legacy/components/reexportable.js +0 -1
- package/legacy/components/toolbar/GridToolbar.js +0 -64
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -68
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -142
- package/legacy/components/toolbar/GridToolbarExport.js +0 -80
- package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -105
- package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -136
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +0 -164
- package/legacy/components/toolbar/index.js +0 -7
- package/legacy/components/virtualization/GridBottomContainer.js +0 -25
- package/legacy/components/virtualization/GridMainContainer.js +0 -20
- package/legacy/components/virtualization/GridTopContainer.js +0 -35
- package/legacy/components/virtualization/GridVirtualScrollbar.js +0 -129
- package/legacy/components/virtualization/GridVirtualScroller.js +0 -93
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +0 -35
- package/legacy/components/virtualization/GridVirtualScrollerFiller.js +0 -70
- package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +0 -42
- package/legacy/constants/defaultGridSlotsComponents.js +0 -33
- package/legacy/constants/envConstants.js +0 -19
- package/legacy/constants/gridClasses.js +0 -5
- package/legacy/constants/gridDetailPanelToggleField.js +0 -2
- package/legacy/constants/index.js +0 -3
- package/legacy/constants/localeTextConstants.js +0 -158
- package/legacy/context/GridContextProvider.js +0 -21
- package/legacy/context/GridRootPropsContext.js +0 -6
- package/legacy/context/index.js +0 -1
- package/legacy/hooks/core/gridCoreSelector.js +0 -7
- package/legacy/hooks/core/index.js +0 -1
- package/legacy/hooks/core/pipeProcessing/gridPipeProcessingApi.js +0 -1
- package/legacy/hooks/core/pipeProcessing/index.js +0 -4
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +0 -114
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +0 -26
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -26
- package/legacy/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +0 -1
- package/legacy/hooks/core/strategyProcessing/index.js +0 -3
- package/legacy/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.js +0 -18
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +0 -116
- package/legacy/hooks/core/useGridApiInitialization.js +0 -124
- package/legacy/hooks/core/useGridInitialization.js +0 -26
- package/legacy/hooks/core/useGridLocaleText.js +0 -12
- package/legacy/hooks/core/useGridLoggerFactory.js +0 -51
- package/legacy/hooks/core/useGridRefs.js +0 -13
- package/legacy/hooks/core/useGridStateInitialization.js +0 -106
- package/legacy/hooks/core/useGridTheme.js +0 -21
- package/legacy/hooks/features/clipboard/useGridClipboard.js +0 -92
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +0 -1
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +0 -24
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +0 -92
- package/legacy/hooks/features/columnGrouping/index.js +0 -2
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +0 -140
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +0 -275
- package/legacy/hooks/features/columnMenu/columnMenuInterfaces.js +0 -1
- package/legacy/hooks/features/columnMenu/columnMenuSelector.js +0 -3
- package/legacy/hooks/features/columnMenu/index.js +0 -2
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +0 -108
- package/legacy/hooks/features/columnMenu/useGridColumnMenuSlots.js +0 -71
- package/legacy/hooks/features/columns/gridColumnsInterfaces.js +0 -9
- package/legacy/hooks/features/columns/gridColumnsSelector.js +0 -174
- package/legacy/hooks/features/columns/gridColumnsUtils.js +0 -338
- package/legacy/hooks/features/columns/index.js +0 -2
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +0 -105
- package/legacy/hooks/features/columns/useGridColumns.js +0 -319
- package/legacy/hooks/features/density/densitySelector.js +0 -10
- package/legacy/hooks/features/density/densityState.js +0 -1
- package/legacy/hooks/features/density/index.js +0 -2
- package/legacy/hooks/features/density/useGridDensity.js +0 -48
- package/legacy/hooks/features/dimensions/gridDimensionsApi.js +0 -1
- package/legacy/hooks/features/dimensions/gridDimensionsSelectors.js +0 -3
- package/legacy/hooks/features/dimensions/index.js +0 -2
- package/legacy/hooks/features/dimensions/useGridDimensions.js +0 -302
- package/legacy/hooks/features/editing/gridEditingSelectors.js +0 -4
- package/legacy/hooks/features/editing/useGridCellEditing.js +0 -456
- package/legacy/hooks/features/editing/useGridEditing.js +0 -145
- package/legacy/hooks/features/editing/useGridRowEditing.js +0 -567
- package/legacy/hooks/features/events/useGridEvents.js +0 -23
- package/legacy/hooks/features/export/serializers/csvSerializer.js +0 -155
- package/legacy/hooks/features/export/useGridCsvExport.js +0 -75
- package/legacy/hooks/features/export/useGridPrintExport.js +0 -313
- package/legacy/hooks/features/export/utils.js +0 -49
- package/legacy/hooks/features/filter/gridFilterSelector.js +0 -165
- package/legacy/hooks/features/filter/gridFilterState.js +0 -20
- package/legacy/hooks/features/filter/gridFilterUtils.js +0 -330
- package/legacy/hooks/features/filter/index.js +0 -2
- package/legacy/hooks/features/filter/useGridFilter.js +0 -378
- package/legacy/hooks/features/focus/gridFocusState.js +0 -1
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +0 -31
- package/legacy/hooks/features/focus/index.js +0 -2
- package/legacy/hooks/features/focus/useGridFocus.js +0 -408
- package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +0 -10
- package/legacy/hooks/features/headerFiltering/index.js +0 -1
- package/legacy/hooks/features/headerFiltering/useGridHeaderFiltering.js +0 -93
- package/legacy/hooks/features/index.js +0 -16
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +0 -565
- package/legacy/hooks/features/pagination/gridPaginationInterfaces.js +0 -1
- package/legacy/hooks/features/pagination/gridPaginationSelector.js +0 -115
- package/legacy/hooks/features/pagination/gridPaginationUtils.js +0 -31
- package/legacy/hooks/features/pagination/index.js +0 -2
- package/legacy/hooks/features/pagination/useGridPagination.js +0 -175
- package/legacy/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +0 -3
- package/legacy/hooks/features/preferencesPanel/gridPreferencePanelState.js +0 -1
- package/legacy/hooks/features/preferencesPanel/gridPreferencePanelsValue.js +0 -6
- package/legacy/hooks/features/preferencesPanel/index.js +0 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +0 -125
- package/legacy/hooks/features/rowSelection/gridRowSelectionSelector.js +0 -19
- package/legacy/hooks/features/rowSelection/index.js +0 -1
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +0 -419
- package/legacy/hooks/features/rowSelection/useGridRowSelectionPreProcessors.js +0 -45
- package/legacy/hooks/features/rowSelection/utils.js +0 -8
- package/legacy/hooks/features/rows/gridRowsInterfaces.js +0 -1
- package/legacy/hooks/features/rows/gridRowsMetaSelector.js +0 -3
- package/legacy/hooks/features/rows/gridRowsMetaState.js +0 -1
- package/legacy/hooks/features/rows/gridRowsSelector.js +0 -90
- package/legacy/hooks/features/rows/gridRowsUtils.js +0 -294
- package/legacy/hooks/features/rows/index.js +0 -4
- package/legacy/hooks/features/rows/useGridParamsApi.js +0 -142
- package/legacy/hooks/features/rows/useGridRows.js +0 -466
- package/legacy/hooks/features/rows/useGridRowsMeta.js +0 -236
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +0 -82
- package/legacy/hooks/features/scroll/useGridScroll.js +0 -133
- package/legacy/hooks/features/sorting/gridSortingSelector.js +0 -56
- package/legacy/hooks/features/sorting/gridSortingState.js +0 -1
- package/legacy/hooks/features/sorting/gridSortingUtils.js +0 -154
- package/legacy/hooks/features/sorting/index.js +0 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +0 -276
- package/legacy/hooks/features/statePersistence/gridStatePersistenceInterface.js +0 -1
- package/legacy/hooks/features/statePersistence/index.js +0 -1
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +0 -25
- package/legacy/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -52
- package/legacy/hooks/features/virtualization/index.js +0 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +0 -643
- package/legacy/hooks/features/virtualization/useGridVirtualization.js +0 -58
- package/legacy/hooks/index.js +0 -3
- package/legacy/hooks/utils/index.js +0 -9
- package/legacy/hooks/utils/useFirstRender.js +0 -8
- package/legacy/hooks/utils/useGridApiContext.js +0 -9
- package/legacy/hooks/utils/useGridApiEventHandler.js +0 -105
- package/legacy/hooks/utils/useGridApiMethod.js +0 -11
- package/legacy/hooks/utils/useGridApiRef.js +0 -7
- package/legacy/hooks/utils/useGridAriaAttributes.js +0 -25
- package/legacy/hooks/utils/useGridInitializeState.js +0 -8
- package/legacy/hooks/utils/useGridLogger.js +0 -10
- package/legacy/hooks/utils/useGridNativeEventListener.js +0 -32
- package/legacy/hooks/utils/useGridPrivateApiContext.js +0 -12
- package/legacy/hooks/utils/useGridRootProps.js +0 -9
- package/legacy/hooks/utils/useGridSelector.js +0 -54
- package/legacy/hooks/utils/useGridVisibleRows.js +0 -42
- package/legacy/hooks/utils/useLazyRef.js +0 -11
- package/legacy/hooks/utils/useOnMount.js +0 -7
- package/legacy/hooks/utils/useResizeObserver.js +0 -36
- package/legacy/hooks/utils/useRunOnce.js +0 -18
- package/legacy/hooks/utils/useTimeout.js +0 -38
- package/legacy/index.js +0 -38
- package/legacy/internals/index.js +0 -68
- package/legacy/internals/utils/computeSlots.js +0 -17
- package/legacy/internals/utils/index.js +0 -3
- package/legacy/internals/utils/propValidation.js +0 -21
- package/legacy/internals/utils/useProps.js +0 -32
- package/legacy/joy/icons.js +0 -432
- package/legacy/joy/index.js +0 -2
- package/legacy/joy/joySlots.js +0 -420
- package/legacy/locales/arSD.js +0 -160
- package/legacy/locales/beBY.js +0 -184
- package/legacy/locales/bgBG.js +0 -160
- package/legacy/locales/coreLocales.js +0 -62
- package/legacy/locales/csCZ.js +0 -181
- package/legacy/locales/daDK.js +0 -160
- package/legacy/locales/deDE.js +0 -160
- package/legacy/locales/elGR.js +0 -160
- package/legacy/locales/enUS.js +0 -4
- package/legacy/locales/esES.js +0 -160
- package/legacy/locales/faIR.js +0 -160
- package/legacy/locales/fiFI.js +0 -160
- package/legacy/locales/frFR.js +0 -160
- package/legacy/locales/heIL.js +0 -160
- package/legacy/locales/hrHR.js +0 -160
- package/legacy/locales/huHU.js +0 -160
- package/legacy/locales/index.js +0 -35
- package/legacy/locales/itIT.js +0 -160
- package/legacy/locales/jaJP.js +0 -160
- package/legacy/locales/koKR.js +0 -162
- package/legacy/locales/nbNO.js +0 -162
- package/legacy/locales/nlNL.js +0 -160
- package/legacy/locales/plPL.js +0 -163
- package/legacy/locales/ptBR.js +0 -160
- package/legacy/locales/ptPT.js +0 -160
- package/legacy/locales/roRO.js +0 -160
- package/legacy/locales/ruRU.js +0 -181
- package/legacy/locales/skSK.js +0 -181
- package/legacy/locales/svSE.js +0 -160
- package/legacy/locales/trTR.js +0 -161
- package/legacy/locales/ukUA.js +0 -182
- package/legacy/locales/urPK.js +0 -160
- package/legacy/locales/viVN.js +0 -160
- package/legacy/locales/zhCN.js +0 -160
- package/legacy/locales/zhHK.js +0 -160
- package/legacy/locales/zhTW.js +0 -160
- package/legacy/material/components/MUISelectOption.js +0 -14
- package/legacy/material/icons/GridColumnUnsortedIcon.js +0 -16
- package/legacy/material/icons/index.js +0 -89
- package/legacy/material/index.js +0 -69
- package/legacy/models/api/gridApiCommon.js +0 -1
- package/legacy/models/api/gridApiCommunity.js +0 -1
- package/legacy/models/api/gridCallbackDetails.js +0 -1
- package/legacy/models/api/gridColumnApi.js +0 -1
- package/legacy/models/api/gridColumnGroupingApi.js +0 -1
- package/legacy/models/api/gridColumnMenuApi.js +0 -1
- package/legacy/models/api/gridColumnSpanning.js +0 -1
- package/legacy/models/api/gridCoreApi.js +0 -1
- package/legacy/models/api/gridCsvExportApi.js +0 -1
- package/legacy/models/api/gridDensityApi.js +0 -1
- package/legacy/models/api/gridEditingApi.js +0 -1
- package/legacy/models/api/gridFilterApi.js +0 -1
- package/legacy/models/api/gridFocusApi.js +0 -1
- package/legacy/models/api/gridHeaderFilteringApi.js +0 -1
- package/legacy/models/api/gridLocaleTextApi.js +0 -1
- package/legacy/models/api/gridLoggerApi.js +0 -1
- package/legacy/models/api/gridParamsApi.js +0 -1
- package/legacy/models/api/gridPreferencesPanelApi.js +0 -1
- package/legacy/models/api/gridPrintExportApi.js +0 -1
- package/legacy/models/api/gridRowApi.js +0 -1
- package/legacy/models/api/gridRowSelectionApi.js +0 -1
- package/legacy/models/api/gridRowsMetaApi.js +0 -1
- package/legacy/models/api/gridScrollApi.js +0 -1
- package/legacy/models/api/gridSortApi.js +0 -1
- package/legacy/models/api/gridStateApi.js +0 -1
- package/legacy/models/api/gridVirtualizationApi.js +0 -1
- package/legacy/models/api/index.js +0 -16
- package/legacy/models/colDef/gridColDef.js +0 -1
- package/legacy/models/colDef/gridColType.js +0 -1
- package/legacy/models/colDef/gridColumnTypesRecord.js +0 -1
- package/legacy/models/colDef/index.js +0 -6
- package/legacy/models/controlStateItem.js +0 -1
- package/legacy/models/cursorCoordinates.js +0 -1
- package/legacy/models/elementSize.js +0 -1
- package/legacy/models/events/gridEventListener.js +0 -1
- package/legacy/models/events/gridEventLookup.js +0 -1
- package/legacy/models/events/gridEventPublisher.js +0 -1
- package/legacy/models/events/index.js +0 -3
- package/legacy/models/gridApiCaches.js +0 -1
- package/legacy/models/gridCell.js +0 -1
- package/legacy/models/gridCellClass.js +0 -1
- package/legacy/models/gridColumnGrouping.js +0 -11
- package/legacy/models/gridColumnHeaderClass.js +0 -1
- package/legacy/models/gridColumnSpanning.js +0 -1
- package/legacy/models/gridDensity.js +0 -1
- package/legacy/models/gridEditRowModel.js +0 -16
- package/legacy/models/gridExport.js +0 -1
- package/legacy/models/gridFeatureMode.js +0 -1
- package/legacy/models/gridFilterItem.js +0 -11
- package/legacy/models/gridFilterModel.js +0 -1
- package/legacy/models/gridFilterOperator.js +0 -1
- package/legacy/models/gridHeaderFilteringModel.js +0 -1
- package/legacy/models/gridIconSlotsComponent.js +0 -1
- package/legacy/models/gridPaginationProps.js +0 -1
- package/legacy/models/gridRenderContextProps.js +0 -1
- package/legacy/models/gridRowSelectionModel.js +0 -1
- package/legacy/models/gridRows.js +0 -1
- package/legacy/models/gridSlotsComponent.js +0 -1
- package/legacy/models/gridSlotsComponentsProps.js +0 -1
- package/legacy/models/gridSortModel.js +0 -1
- package/legacy/models/gridStateCommunity.js +0 -1
- package/legacy/models/index.js +0 -29
- package/legacy/models/logger.js +0 -1
- package/legacy/models/muiEvent.js +0 -1
- package/legacy/models/params/gridCellParams.js +0 -1
- package/legacy/models/params/gridColumnGroupHeaderParams.js +0 -1
- package/legacy/models/params/gridColumnHeaderParams.js +0 -1
- package/legacy/models/params/gridColumnOrderChangeParams.js +0 -1
- package/legacy/models/params/gridColumnResizeParams.js +0 -1
- package/legacy/models/params/gridEditCellParams.js +0 -27
- package/legacy/models/params/gridHeaderSelectionCheckboxParams.js +0 -1
- package/legacy/models/params/gridMenuParams.js +0 -1
- package/legacy/models/params/gridPreferencePanelParams.js +0 -1
- package/legacy/models/params/gridRowParams.js +0 -44
- package/legacy/models/params/gridRowSelectionCheckboxParams.js +0 -1
- package/legacy/models/params/gridScrollParams.js +0 -1
- package/legacy/models/params/gridValueOptionsParams.js +0 -1
- package/legacy/models/params/index.js +0 -13
- package/legacy/models/props/DataGridProps.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -4
- package/legacy/themeAugmentation/overrides.js +0 -1
- package/legacy/themeAugmentation/props.js +0 -1
- package/legacy/utils/EventManager.js +0 -91
- package/legacy/utils/Store.js +0 -34
- package/legacy/utils/cleanupTracking/CleanupTracking.js +0 -1
- package/legacy/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -29
- package/legacy/utils/cleanupTracking/TimerBasedCleanupTracking.js +0 -52
- package/legacy/utils/createControllablePromise.js +0 -11
- package/legacy/utils/createSelector.js +0 -120
- package/legacy/utils/doesSupportPreventScroll.js +0 -13
- package/legacy/utils/domUtils.js +0 -49
- package/legacy/utils/exportAs.js +0 -40
- package/legacy/utils/fastMemo.js +0 -5
- package/legacy/utils/fastObjectShallowCompare.js +0 -32
- package/legacy/utils/getGridLocalization.js +0 -15
- package/legacy/utils/getPublicApiRef.js +0 -5
- package/legacy/utils/index.js +0 -1
- package/legacy/utils/keyboardUtils.js +0 -60
- package/legacy/utils/utils.js +0 -189
- package/legacy/utils/warning.js +0 -25
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "style", "gridHasScrollX", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
4
|
-
_excluded2 = ["changeReason", "unstable_updateValueOnRender"];
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import clsx from 'clsx';
|
|
8
|
-
import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_ownerDocument as ownerDocument, unstable_capitalize as capitalize } from '@mui/utils';
|
|
9
|
-
import { fastMemo } from '../../utils/fastMemo';
|
|
10
|
-
import { doesSupportPreventScroll } from '../../utils/doesSupportPreventScroll';
|
|
11
|
-
import { getDataGridUtilityClass, gridClasses } from '../../constants/gridClasses';
|
|
12
|
-
import { GridCellModes } from '../../models';
|
|
13
|
-
import { useGridSelector, objectShallowCompare } from '../../hooks/utils/useGridSelector';
|
|
14
|
-
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
15
|
-
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
16
|
-
import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
17
|
-
import { MissingRowIdError } from '../../hooks/features/rows/useGridParamsApi';
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
export var PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
|
|
20
|
-
PinnedPosition[PinnedPosition["NONE"] = 0] = "NONE";
|
|
21
|
-
PinnedPosition[PinnedPosition["LEFT"] = 1] = "LEFT";
|
|
22
|
-
PinnedPosition[PinnedPosition["RIGHT"] = 2] = "RIGHT";
|
|
23
|
-
return PinnedPosition;
|
|
24
|
-
}({});
|
|
25
|
-
var EMPTY_CELL_PARAMS = {
|
|
26
|
-
id: -1,
|
|
27
|
-
field: '__unset__',
|
|
28
|
-
row: {},
|
|
29
|
-
rowNode: {
|
|
30
|
-
id: -1,
|
|
31
|
-
depth: 0,
|
|
32
|
-
type: 'leaf',
|
|
33
|
-
parent: -1,
|
|
34
|
-
groupingKey: null
|
|
35
|
-
},
|
|
36
|
-
colDef: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
field: '__unset__',
|
|
39
|
-
computedWidth: 0
|
|
40
|
-
},
|
|
41
|
-
cellMode: GridCellModes.View,
|
|
42
|
-
hasFocus: false,
|
|
43
|
-
tabIndex: -1,
|
|
44
|
-
value: null,
|
|
45
|
-
formattedValue: '__unset__',
|
|
46
|
-
isEditable: false,
|
|
47
|
-
api: {}
|
|
48
|
-
};
|
|
49
|
-
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
50
|
-
var align = ownerState.align,
|
|
51
|
-
showLeftBorder = ownerState.showLeftBorder,
|
|
52
|
-
showRightBorder = ownerState.showRightBorder,
|
|
53
|
-
pinnedPosition = ownerState.pinnedPosition,
|
|
54
|
-
isEditable = ownerState.isEditable,
|
|
55
|
-
isSelected = ownerState.isSelected,
|
|
56
|
-
isSelectionMode = ownerState.isSelectionMode,
|
|
57
|
-
classes = ownerState.classes;
|
|
58
|
-
var slots = {
|
|
59
|
-
root: ['cell', "cell--text".concat(capitalize(align)), isSelected && 'selected', isEditable && 'cell--editable', showLeftBorder && 'cell--withLeftBorder', showRightBorder && 'cell--withRightBorder', pinnedPosition === PinnedPosition.LEFT && 'cell--pinnedLeft', pinnedPosition === PinnedPosition.RIGHT && 'cell--pinnedRight', isSelectionMode && !isEditable && 'cell--selectionMode'],
|
|
60
|
-
content: ['cellContent']
|
|
61
|
-
};
|
|
62
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
63
|
-
};
|
|
64
|
-
var warnedOnce = false;
|
|
65
|
-
|
|
66
|
-
// TODO(v7): Removing the wrapper will break the docs performance visualization demo.
|
|
67
|
-
|
|
68
|
-
var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
69
|
-
var _getActions, _ref, _rootProps$cellSelect, _rootProps$experiment;
|
|
70
|
-
var column = props.column,
|
|
71
|
-
rowId = props.rowId,
|
|
72
|
-
editCellState = props.editCellState,
|
|
73
|
-
align = props.align,
|
|
74
|
-
childrenProp = props.children,
|
|
75
|
-
colIndex = props.colIndex,
|
|
76
|
-
height = props.height,
|
|
77
|
-
width = props.width,
|
|
78
|
-
className = props.className,
|
|
79
|
-
styleProp = props.style,
|
|
80
|
-
gridHasScrollX = props.gridHasScrollX,
|
|
81
|
-
colSpan = props.colSpan,
|
|
82
|
-
disableDragEvents = props.disableDragEvents,
|
|
83
|
-
isNotVisible = props.isNotVisible,
|
|
84
|
-
pinnedOffset = props.pinnedOffset,
|
|
85
|
-
pinnedPosition = props.pinnedPosition,
|
|
86
|
-
sectionIndex = props.sectionIndex,
|
|
87
|
-
sectionLength = props.sectionLength,
|
|
88
|
-
onClick = props.onClick,
|
|
89
|
-
onDoubleClick = props.onDoubleClick,
|
|
90
|
-
onMouseDown = props.onMouseDown,
|
|
91
|
-
onMouseUp = props.onMouseUp,
|
|
92
|
-
onMouseOver = props.onMouseOver,
|
|
93
|
-
onKeyDown = props.onKeyDown,
|
|
94
|
-
onKeyUp = props.onKeyUp,
|
|
95
|
-
onDragEnter = props.onDragEnter,
|
|
96
|
-
onDragOver = props.onDragOver,
|
|
97
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
98
|
-
var apiRef = useGridApiContext();
|
|
99
|
-
var rootProps = useGridRootProps();
|
|
100
|
-
var field = column.field;
|
|
101
|
-
var cellParamsWithAPI = useGridSelector(apiRef, function () {
|
|
102
|
-
// This is required because `.getCellParams` tries to get the `state.rows.tree` entry
|
|
103
|
-
// associated with `rowId`/`fieldId`, but this selector runs after the state has been
|
|
104
|
-
// updated, while `rowId`/`fieldId` reference an entry in the old state.
|
|
105
|
-
try {
|
|
106
|
-
var cellParams = apiRef.current.getCellParams(rowId, field);
|
|
107
|
-
var result = cellParams;
|
|
108
|
-
result.api = apiRef.current;
|
|
109
|
-
return result;
|
|
110
|
-
} catch (e) {
|
|
111
|
-
if (e instanceof MissingRowIdError) {
|
|
112
|
-
return EMPTY_CELL_PARAMS;
|
|
113
|
-
}
|
|
114
|
-
throw e;
|
|
115
|
-
}
|
|
116
|
-
}, objectShallowCompare);
|
|
117
|
-
var isSelected = useGridSelector(apiRef, function () {
|
|
118
|
-
return apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
|
|
119
|
-
id: rowId,
|
|
120
|
-
field: field
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
var cellMode = cellParamsWithAPI.cellMode,
|
|
124
|
-
hasFocus = cellParamsWithAPI.hasFocus,
|
|
125
|
-
_cellParamsWithAPI$is = cellParamsWithAPI.isEditable,
|
|
126
|
-
isEditable = _cellParamsWithAPI$is === void 0 ? false : _cellParamsWithAPI$is,
|
|
127
|
-
value = cellParamsWithAPI.value,
|
|
128
|
-
formattedValue = cellParamsWithAPI.formattedValue;
|
|
129
|
-
var canManageOwnFocus = column.type === 'actions' && ((_getActions = (_ref = column).getActions) == null ? void 0 : _getActions.call(_ref, apiRef.current.getRowParams(rowId)).some(function (action) {
|
|
130
|
-
return !action.props.disabled;
|
|
131
|
-
}));
|
|
132
|
-
var tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
133
|
-
var rootClasses = rootProps.classes,
|
|
134
|
-
getCellClassName = rootProps.getCellClassName;
|
|
135
|
-
var classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
|
|
136
|
-
id: rowId,
|
|
137
|
-
field: field
|
|
138
|
-
});
|
|
139
|
-
if (column.cellClassName) {
|
|
140
|
-
classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParamsWithAPI) : column.cellClassName);
|
|
141
|
-
}
|
|
142
|
-
if (getCellClassName) {
|
|
143
|
-
classNames.push(getCellClassName(cellParamsWithAPI));
|
|
144
|
-
}
|
|
145
|
-
var valueToRender = formattedValue == null ? value : formattedValue;
|
|
146
|
-
var cellRef = React.useRef(null);
|
|
147
|
-
var handleRef = useForkRef(ref, cellRef);
|
|
148
|
-
var focusElementRef = React.useRef(null);
|
|
149
|
-
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
150
|
-
var isSelectionMode = (_rootProps$cellSelect = rootProps.cellSelection) != null ? _rootProps$cellSelect : false;
|
|
151
|
-
var isSectionLastCell = sectionIndex === sectionLength - 1;
|
|
152
|
-
var showLeftBorder = pinnedPosition === PinnedPosition.RIGHT && sectionIndex === 0;
|
|
153
|
-
var showRightBorder = rootProps.showCellVerticalBorder && (pinnedPosition !== PinnedPosition.LEFT ? !isSectionLastCell : true) || pinnedPosition === PinnedPosition.LEFT && isSectionLastCell;
|
|
154
|
-
var ownerState = {
|
|
155
|
-
align: align,
|
|
156
|
-
showLeftBorder: showLeftBorder,
|
|
157
|
-
showRightBorder: showRightBorder,
|
|
158
|
-
isEditable: isEditable,
|
|
159
|
-
classes: rootProps.classes,
|
|
160
|
-
pinnedPosition: pinnedPosition,
|
|
161
|
-
isSelected: isSelected,
|
|
162
|
-
isSelectionMode: isSelectionMode
|
|
163
|
-
};
|
|
164
|
-
var classes = useUtilityClasses(ownerState);
|
|
165
|
-
var publishMouseUp = React.useCallback(function (eventName) {
|
|
166
|
-
return function (event) {
|
|
167
|
-
var params = apiRef.current.getCellParams(rowId, field || '');
|
|
168
|
-
apiRef.current.publishEvent(eventName, params, event);
|
|
169
|
-
if (onMouseUp) {
|
|
170
|
-
onMouseUp(event);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
}, [apiRef, field, onMouseUp, rowId]);
|
|
174
|
-
var publishMouseDown = React.useCallback(function (eventName) {
|
|
175
|
-
return function (event) {
|
|
176
|
-
var params = apiRef.current.getCellParams(rowId, field || '');
|
|
177
|
-
apiRef.current.publishEvent(eventName, params, event);
|
|
178
|
-
if (onMouseDown) {
|
|
179
|
-
onMouseDown(event);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}, [apiRef, field, onMouseDown, rowId]);
|
|
183
|
-
var publish = React.useCallback(function (eventName, propHandler) {
|
|
184
|
-
return function (event) {
|
|
185
|
-
// The row might have been deleted during the click
|
|
186
|
-
if (!apiRef.current.getRow(rowId)) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
var params = apiRef.current.getCellParams(rowId, field || '');
|
|
190
|
-
apiRef.current.publishEvent(eventName, params, event);
|
|
191
|
-
if (propHandler) {
|
|
192
|
-
propHandler(event);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
}, [apiRef, field, rowId]);
|
|
196
|
-
var style = React.useMemo(function () {
|
|
197
|
-
if (isNotVisible) {
|
|
198
|
-
return {
|
|
199
|
-
padding: 0,
|
|
200
|
-
opacity: 0,
|
|
201
|
-
width: 0,
|
|
202
|
-
border: 0
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
var cellStyle = _extends({
|
|
206
|
-
'--width': "".concat(width, "px"),
|
|
207
|
-
'--height': typeof height === 'number' ? "".concat(height, "px") : height
|
|
208
|
-
}, styleProp);
|
|
209
|
-
if (pinnedPosition === PinnedPosition.LEFT) {
|
|
210
|
-
cellStyle.left = pinnedOffset;
|
|
211
|
-
}
|
|
212
|
-
if (pinnedPosition === PinnedPosition.RIGHT) {
|
|
213
|
-
cellStyle.right = pinnedOffset;
|
|
214
|
-
}
|
|
215
|
-
return cellStyle;
|
|
216
|
-
}, [width, height, isNotVisible, styleProp, pinnedOffset, pinnedPosition]);
|
|
217
|
-
React.useEffect(function () {
|
|
218
|
-
if (!hasFocus || cellMode === GridCellModes.Edit) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
var doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
222
|
-
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
223
|
-
var focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
224
|
-
var elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
|
|
225
|
-
if (doesSupportPreventScroll()) {
|
|
226
|
-
elementToFocus.focus({
|
|
227
|
-
preventScroll: true
|
|
228
|
-
});
|
|
229
|
-
} else {
|
|
230
|
-
var scrollPosition = apiRef.current.getScrollPosition();
|
|
231
|
-
elementToFocus.focus();
|
|
232
|
-
apiRef.current.scroll(scrollPosition);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}, [hasFocus, cellMode, apiRef]);
|
|
236
|
-
if (cellParamsWithAPI === EMPTY_CELL_PARAMS) {
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
|
-
var handleFocus = other.onFocus;
|
|
240
|
-
if (process.env.NODE_ENV === 'test' && (_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.warnIfFocusStateIsNotSynced) {
|
|
241
|
-
handleFocus = function handleFocus(event) {
|
|
242
|
-
var focusedCell = gridFocusCellSelector(apiRef);
|
|
243
|
-
if ((focusedCell == null ? void 0 : focusedCell.id) === rowId && focusedCell.field === field) {
|
|
244
|
-
if (typeof other.onFocus === 'function') {
|
|
245
|
-
other.onFocus(event);
|
|
246
|
-
}
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
if (!warnedOnce) {
|
|
250
|
-
console.warn(["MUI X: The cell with id=".concat(rowId, " and field=").concat(field, " received focus."), "According to the state, the focus should be at id=".concat(focusedCell == null ? void 0 : focusedCell.id, ", field=").concat(focusedCell == null ? void 0 : focusedCell.field, "."), "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
|
|
251
|
-
warnedOnce = true;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
var children;
|
|
256
|
-
if (editCellState == null && column.renderCell) {
|
|
257
|
-
children = column.renderCell(cellParamsWithAPI);
|
|
258
|
-
classNames.push(gridClasses['cell--withRenderer']);
|
|
259
|
-
classNames.push(rootClasses == null ? void 0 : rootClasses['cell--withRenderer']);
|
|
260
|
-
}
|
|
261
|
-
if (editCellState != null && column.renderEditCell) {
|
|
262
|
-
var updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
|
|
263
|
-
|
|
264
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
265
|
-
var changeReason = editCellState.changeReason,
|
|
266
|
-
unstable_updateValueOnRender = editCellState.unstable_updateValueOnRender,
|
|
267
|
-
editCellStateRest = _objectWithoutProperties(editCellState, _excluded2);
|
|
268
|
-
var params = _extends({}, cellParamsWithAPI, {
|
|
269
|
-
row: updatedRow
|
|
270
|
-
}, editCellStateRest);
|
|
271
|
-
children = column.renderEditCell(params);
|
|
272
|
-
classNames.push(gridClasses['cell--editing']);
|
|
273
|
-
classNames.push(rootClasses == null ? void 0 : rootClasses['cell--editing']);
|
|
274
|
-
}
|
|
275
|
-
if (children === undefined) {
|
|
276
|
-
var valueString = valueToRender == null ? void 0 : valueToRender.toString();
|
|
277
|
-
children = /*#__PURE__*/_jsx("div", {
|
|
278
|
-
className: classes.content,
|
|
279
|
-
title: valueString,
|
|
280
|
-
role: "presentation",
|
|
281
|
-
children: valueString
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
if ( /*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
|
|
285
|
-
children = /*#__PURE__*/React.cloneElement(children, {
|
|
286
|
-
focusElementRef: focusElementRef
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
var draggableEventHandlers = disableDragEvents ? null : {
|
|
290
|
-
onDragEnter: publish('cellDragEnter', onDragEnter),
|
|
291
|
-
onDragOver: publish('cellDragOver', onDragOver)
|
|
292
|
-
};
|
|
293
|
-
return /*#__PURE__*/_jsx("div", _extends({
|
|
294
|
-
ref: handleRef,
|
|
295
|
-
className: clsx(className, classNames, classes.root),
|
|
296
|
-
role: "gridcell",
|
|
297
|
-
"data-field": field,
|
|
298
|
-
"data-colindex": colIndex,
|
|
299
|
-
"aria-colindex": colIndex + 1,
|
|
300
|
-
"aria-colspan": colSpan,
|
|
301
|
-
style: style,
|
|
302
|
-
tabIndex: tabIndex,
|
|
303
|
-
onClick: publish('cellClick', onClick),
|
|
304
|
-
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
305
|
-
onMouseOver: publish('cellMouseOver', onMouseOver),
|
|
306
|
-
onMouseDown: publishMouseDown('cellMouseDown'),
|
|
307
|
-
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
308
|
-
onKeyDown: publish('cellKeyDown', onKeyDown),
|
|
309
|
-
onKeyUp: publish('cellKeyUp', onKeyUp)
|
|
310
|
-
}, draggableEventHandlers, other, {
|
|
311
|
-
onFocus: handleFocus,
|
|
312
|
-
children: children
|
|
313
|
-
}));
|
|
314
|
-
});
|
|
315
|
-
process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
316
|
-
// ----------------------------- Warning --------------------------------
|
|
317
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
318
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
319
|
-
// ----------------------------------------------------------------------
|
|
320
|
-
align: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
|
|
321
|
-
className: PropTypes.string,
|
|
322
|
-
colIndex: PropTypes.number.isRequired,
|
|
323
|
-
colSpan: PropTypes.number,
|
|
324
|
-
column: PropTypes.object.isRequired,
|
|
325
|
-
disableDragEvents: PropTypes.bool,
|
|
326
|
-
editCellState: PropTypes.shape({
|
|
327
|
-
changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
328
|
-
isProcessingProps: PropTypes.bool,
|
|
329
|
-
isValidating: PropTypes.bool,
|
|
330
|
-
value: PropTypes.any
|
|
331
|
-
}),
|
|
332
|
-
gridHasScrollX: PropTypes.bool.isRequired,
|
|
333
|
-
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
334
|
-
isNotVisible: PropTypes.bool.isRequired,
|
|
335
|
-
onClick: PropTypes.func,
|
|
336
|
-
onDoubleClick: PropTypes.func,
|
|
337
|
-
onDragEnter: PropTypes.func,
|
|
338
|
-
onDragOver: PropTypes.func,
|
|
339
|
-
onKeyDown: PropTypes.func,
|
|
340
|
-
onMouseDown: PropTypes.func,
|
|
341
|
-
onMouseUp: PropTypes.func,
|
|
342
|
-
pinnedOffset: PropTypes.number.isRequired,
|
|
343
|
-
pinnedPosition: PropTypes.oneOf([0, 1, 2]).isRequired,
|
|
344
|
-
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
345
|
-
sectionIndex: PropTypes.number.isRequired,
|
|
346
|
-
sectionLength: PropTypes.number.isRequired,
|
|
347
|
-
width: PropTypes.number.isRequired
|
|
348
|
-
} : void 0;
|
|
349
|
-
var MemoizedGridCell = fastMemo(GridCell);
|
|
350
|
-
export { MemoizedGridCell as GridCell };
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange"];
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
import * as React from 'react';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import clsx from 'clsx';
|
|
10
|
-
import { unstable_composeClasses as composeClasses, unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
11
|
-
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
12
|
-
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
|
-
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
16
|
-
var classes = ownerState.classes;
|
|
17
|
-
var slots = {
|
|
18
|
-
root: ['editBooleanCell']
|
|
19
|
-
};
|
|
20
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
21
|
-
};
|
|
22
|
-
function GridEditBooleanCell(props) {
|
|
23
|
-
var _rootProps$slotProps;
|
|
24
|
-
var idProp = props.id,
|
|
25
|
-
value = props.value,
|
|
26
|
-
formattedValue = props.formattedValue,
|
|
27
|
-
api = props.api,
|
|
28
|
-
field = props.field,
|
|
29
|
-
row = props.row,
|
|
30
|
-
rowNode = props.rowNode,
|
|
31
|
-
colDef = props.colDef,
|
|
32
|
-
cellMode = props.cellMode,
|
|
33
|
-
isEditable = props.isEditable,
|
|
34
|
-
tabIndex = props.tabIndex,
|
|
35
|
-
className = props.className,
|
|
36
|
-
hasFocus = props.hasFocus,
|
|
37
|
-
isValidating = props.isValidating,
|
|
38
|
-
isProcessingProps = props.isProcessingProps,
|
|
39
|
-
error = props.error,
|
|
40
|
-
onValueChange = props.onValueChange,
|
|
41
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
42
|
-
var apiRef = useGridApiContext();
|
|
43
|
-
var inputRef = React.useRef(null);
|
|
44
|
-
var id = useId();
|
|
45
|
-
var _React$useState = React.useState(value),
|
|
46
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
47
|
-
valueState = _React$useState2[0],
|
|
48
|
-
setValueState = _React$useState2[1];
|
|
49
|
-
var rootProps = useGridRootProps();
|
|
50
|
-
var ownerState = {
|
|
51
|
-
classes: rootProps.classes
|
|
52
|
-
};
|
|
53
|
-
var classes = useUtilityClasses(ownerState);
|
|
54
|
-
var handleChange = React.useCallback( /*#__PURE__*/function () {
|
|
55
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
56
|
-
var newValue;
|
|
57
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58
|
-
while (1) switch (_context.prev = _context.next) {
|
|
59
|
-
case 0:
|
|
60
|
-
newValue = event.target.checked;
|
|
61
|
-
if (!onValueChange) {
|
|
62
|
-
_context.next = 4;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
_context.next = 4;
|
|
66
|
-
return onValueChange(event, newValue);
|
|
67
|
-
case 4:
|
|
68
|
-
setValueState(newValue);
|
|
69
|
-
_context.next = 7;
|
|
70
|
-
return apiRef.current.setEditCellValue({
|
|
71
|
-
id: idProp,
|
|
72
|
-
field: field,
|
|
73
|
-
value: newValue
|
|
74
|
-
}, event);
|
|
75
|
-
case 7:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}, _callee);
|
|
80
|
-
}));
|
|
81
|
-
return function (_x) {
|
|
82
|
-
return _ref.apply(this, arguments);
|
|
83
|
-
};
|
|
84
|
-
}(), [apiRef, field, idProp, onValueChange]);
|
|
85
|
-
React.useEffect(function () {
|
|
86
|
-
setValueState(value);
|
|
87
|
-
}, [value]);
|
|
88
|
-
useEnhancedEffect(function () {
|
|
89
|
-
if (hasFocus) {
|
|
90
|
-
inputRef.current.focus();
|
|
91
|
-
}
|
|
92
|
-
}, [hasFocus]);
|
|
93
|
-
return /*#__PURE__*/_jsx("label", _extends({
|
|
94
|
-
htmlFor: id,
|
|
95
|
-
className: clsx(classes.root, className)
|
|
96
|
-
}, other, {
|
|
97
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
98
|
-
id: id,
|
|
99
|
-
inputRef: inputRef,
|
|
100
|
-
checked: Boolean(valueState),
|
|
101
|
-
onChange: handleChange,
|
|
102
|
-
size: "small"
|
|
103
|
-
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseCheckbox))
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
107
|
-
// ----------------------------- Warning --------------------------------
|
|
108
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
109
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
110
|
-
// ----------------------------------------------------------------------
|
|
111
|
-
/**
|
|
112
|
-
* GridApi that let you manipulate the grid.
|
|
113
|
-
*/
|
|
114
|
-
api: PropTypes.object.isRequired,
|
|
115
|
-
/**
|
|
116
|
-
* The mode of the cell.
|
|
117
|
-
*/
|
|
118
|
-
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
119
|
-
changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
120
|
-
/**
|
|
121
|
-
* The column of the row that the current cell belongs to.
|
|
122
|
-
*/
|
|
123
|
-
colDef: PropTypes.object.isRequired,
|
|
124
|
-
/**
|
|
125
|
-
* The column field of the cell that triggered the event.
|
|
126
|
-
*/
|
|
127
|
-
field: PropTypes.string.isRequired,
|
|
128
|
-
/**
|
|
129
|
-
* The cell value formatted with the column valueFormatter.
|
|
130
|
-
*/
|
|
131
|
-
formattedValue: PropTypes.any,
|
|
132
|
-
/**
|
|
133
|
-
* If true, the cell is the active element.
|
|
134
|
-
*/
|
|
135
|
-
hasFocus: PropTypes.bool.isRequired,
|
|
136
|
-
/**
|
|
137
|
-
* The grid row id.
|
|
138
|
-
*/
|
|
139
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
140
|
-
/**
|
|
141
|
-
* If true, the cell is editable.
|
|
142
|
-
*/
|
|
143
|
-
isEditable: PropTypes.bool,
|
|
144
|
-
isProcessingProps: PropTypes.bool,
|
|
145
|
-
isValidating: PropTypes.bool,
|
|
146
|
-
/**
|
|
147
|
-
* Callback called when the value is changed by the user.
|
|
148
|
-
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
149
|
-
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
150
|
-
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
151
|
-
*/
|
|
152
|
-
onValueChange: PropTypes.func,
|
|
153
|
-
/**
|
|
154
|
-
* The row model of the row that the current cell belongs to.
|
|
155
|
-
*/
|
|
156
|
-
row: PropTypes.any.isRequired,
|
|
157
|
-
/**
|
|
158
|
-
* The node of the row that the current cell belongs to.
|
|
159
|
-
*/
|
|
160
|
-
rowNode: PropTypes.object.isRequired,
|
|
161
|
-
/**
|
|
162
|
-
* the tabIndex value.
|
|
163
|
-
*/
|
|
164
|
-
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
165
|
-
/**
|
|
166
|
-
* The cell value.
|
|
167
|
-
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
168
|
-
*/
|
|
169
|
-
value: PropTypes.any
|
|
170
|
-
} : void 0;
|
|
171
|
-
export { GridEditBooleanCell };
|
|
172
|
-
export var renderEditBooleanCell = function renderEditBooleanCell(params) {
|
|
173
|
-
return /*#__PURE__*/_jsx(GridEditBooleanCell, _extends({}, params));
|
|
174
|
-
};
|