@mui/x-data-grid 7.0.0-beta.3 → 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 +226 -15
- package/colDef/gridActionsColDef.js +1 -0
- package/colDef/gridBooleanColDef.js +1 -0
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- 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 +50 -19
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/constants/gridClasses.d.ts +24 -8
- package/constants/gridClasses.js +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +1 -1
- 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/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/modern/colDef/gridActionsColDef.js +1 -0
- package/modern/colDef/gridBooleanColDef.js +1 -0
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
- 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 +50 -19
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
- 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/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/utils/keyboardUtils.js +20 -11
- package/node/colDef/gridActionsColDef.js +1 -0
- package/node/colDef/gridBooleanColDef.js +1 -0
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
- 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 +50 -19
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- 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/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/utils/keyboardUtils.js +25 -20
- package/package.json +1 -1
- package/utils/keyboardUtils.d.ts +7 -6
- package/utils/keyboardUtils.js +20 -11
- package/legacy/DataGrid/DataGrid.js +0 -664
- 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 -465
- 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 -395
- 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 -118
- 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 -149
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +0 -106
- 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 -49
- 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 -272
- 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 -61
- package/legacy/hooks/features/virtualization/index.js +0 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +0 -646
- package/legacy/hooks/features/virtualization/useGridVirtualization.js +0 -63
- 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,419 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { GridSignature, useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
5
|
-
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
|
-
import { useGridLogger } from '../../utils/useGridLogger';
|
|
7
|
-
import { gridRowsLookupSelector } from '../rows/gridRowsSelector';
|
|
8
|
-
import { gridRowSelectionStateSelector, selectedGridRowsSelector, selectedIdsLookupSelector } from './gridRowSelectionSelector';
|
|
9
|
-
import { gridPaginatedVisibleSortedGridRowIdsSelector } from '../pagination';
|
|
10
|
-
import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
|
|
11
|
-
import { gridExpandedSortedRowIdsSelector } from '../filter/gridFilterSelector';
|
|
12
|
-
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
|
|
13
|
-
import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
14
|
-
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
15
|
-
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
16
|
-
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
17
|
-
import { gridClasses } from '../../../constants/gridClasses';
|
|
18
|
-
import { isEventTargetInPortal } from '../../../utils/domUtils';
|
|
19
|
-
import { isMultipleRowSelectionEnabled } from './utils';
|
|
20
|
-
var getSelectionModelPropValue = function getSelectionModelPropValue(selectionModelProp, prevSelectionModel) {
|
|
21
|
-
if (selectionModelProp == null) {
|
|
22
|
-
return selectionModelProp;
|
|
23
|
-
}
|
|
24
|
-
if (Array.isArray(selectionModelProp)) {
|
|
25
|
-
return selectionModelProp;
|
|
26
|
-
}
|
|
27
|
-
if (prevSelectionModel && prevSelectionModel[0] === selectionModelProp) {
|
|
28
|
-
return prevSelectionModel;
|
|
29
|
-
}
|
|
30
|
-
return [selectionModelProp];
|
|
31
|
-
};
|
|
32
|
-
export var rowSelectionStateInitializer = function rowSelectionStateInitializer(state, props) {
|
|
33
|
-
var _getSelectionModelPro;
|
|
34
|
-
return _extends({}, state, {
|
|
35
|
-
rowSelection: props.rowSelection ? (_getSelectionModelPro = getSelectionModelPropValue(props.rowSelectionModel)) != null ? _getSelectionModelPro : [] : []
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @requires useGridRows (state, method) - can be after
|
|
41
|
-
* @requires useGridParamsApi (method) - can be after
|
|
42
|
-
* @requires useGridFocus (state) - can be after
|
|
43
|
-
* @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)
|
|
44
|
-
*/
|
|
45
|
-
export var useGridRowSelection = function useGridRowSelection(apiRef, props) {
|
|
46
|
-
var logger = useGridLogger(apiRef, 'useGridSelection');
|
|
47
|
-
var runIfRowSelectionIsEnabled = function runIfRowSelectionIsEnabled(callback) {
|
|
48
|
-
return function () {
|
|
49
|
-
if (props.rowSelection) {
|
|
50
|
-
callback.apply(void 0, arguments);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
var propRowSelectionModel = React.useMemo(function () {
|
|
55
|
-
return getSelectionModelPropValue(props.rowSelectionModel, gridRowSelectionStateSelector(apiRef.current.state));
|
|
56
|
-
}, [apiRef, props.rowSelectionModel]);
|
|
57
|
-
var lastRowToggled = React.useRef(null);
|
|
58
|
-
apiRef.current.registerControlState({
|
|
59
|
-
stateId: 'rowSelection',
|
|
60
|
-
propModel: propRowSelectionModel,
|
|
61
|
-
propOnChange: props.onRowSelectionModelChange,
|
|
62
|
-
stateSelector: gridRowSelectionStateSelector,
|
|
63
|
-
changeEvent: 'rowSelectionChange'
|
|
64
|
-
});
|
|
65
|
-
var checkboxSelection = props.checkboxSelection,
|
|
66
|
-
disableRowSelectionOnClick = props.disableRowSelectionOnClick,
|
|
67
|
-
propIsRowSelectable = props.isRowSelectable;
|
|
68
|
-
var canHaveMultipleSelection = isMultipleRowSelectionEnabled(props);
|
|
69
|
-
var visibleRows = useGridVisibleRows(apiRef, props);
|
|
70
|
-
var expandMouseRowRangeSelection = React.useCallback(function (id) {
|
|
71
|
-
var _lastRowToggled$curre;
|
|
72
|
-
var endId = id;
|
|
73
|
-
var startId = (_lastRowToggled$curre = lastRowToggled.current) != null ? _lastRowToggled$curre : id;
|
|
74
|
-
var isSelected = apiRef.current.isRowSelected(id);
|
|
75
|
-
if (isSelected) {
|
|
76
|
-
var visibleRowIds = gridExpandedSortedRowIdsSelector(apiRef);
|
|
77
|
-
var startIndex = visibleRowIds.findIndex(function (rowId) {
|
|
78
|
-
return rowId === startId;
|
|
79
|
-
});
|
|
80
|
-
var endIndex = visibleRowIds.findIndex(function (rowId) {
|
|
81
|
-
return rowId === endId;
|
|
82
|
-
});
|
|
83
|
-
if (startIndex === endIndex) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (startIndex > endIndex) {
|
|
87
|
-
endId = visibleRowIds[endIndex + 1];
|
|
88
|
-
} else {
|
|
89
|
-
endId = visibleRowIds[endIndex - 1];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
lastRowToggled.current = id;
|
|
93
|
-
apiRef.current.selectRowRange({
|
|
94
|
-
startId: startId,
|
|
95
|
-
endId: endId
|
|
96
|
-
}, !isSelected);
|
|
97
|
-
}, [apiRef]);
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* API METHODS
|
|
101
|
-
*/
|
|
102
|
-
var setRowSelectionModel = React.useCallback(function (model) {
|
|
103
|
-
if (props.signature === GridSignature.DataGrid && !canHaveMultipleSelection && Array.isArray(model) && model.length > 1) {
|
|
104
|
-
throw new Error(['MUI X: `rowSelectionModel` can only contain 1 item in DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
|
|
105
|
-
}
|
|
106
|
-
var currentModel = gridRowSelectionStateSelector(apiRef.current.state);
|
|
107
|
-
if (currentModel !== model) {
|
|
108
|
-
logger.debug("Setting selection model");
|
|
109
|
-
apiRef.current.setState(function (state) {
|
|
110
|
-
return _extends({}, state, {
|
|
111
|
-
rowSelection: props.rowSelection ? model : []
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
apiRef.current.forceUpdate();
|
|
115
|
-
}
|
|
116
|
-
}, [apiRef, logger, props.rowSelection, props.signature, canHaveMultipleSelection]);
|
|
117
|
-
var isRowSelected = React.useCallback(function (id) {
|
|
118
|
-
return gridRowSelectionStateSelector(apiRef.current.state).includes(id);
|
|
119
|
-
}, [apiRef]);
|
|
120
|
-
var isRowSelectable = React.useCallback(function (id) {
|
|
121
|
-
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
var rowNode = apiRef.current.getRowNode(id);
|
|
125
|
-
if ((rowNode == null ? void 0 : rowNode.type) === 'footer' || (rowNode == null ? void 0 : rowNode.type) === 'pinnedRow') {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return true;
|
|
129
|
-
}, [apiRef, propIsRowSelectable]);
|
|
130
|
-
var getSelectedRows = React.useCallback(function () {
|
|
131
|
-
return selectedGridRowsSelector(apiRef);
|
|
132
|
-
}, [apiRef]);
|
|
133
|
-
var selectRow = React.useCallback(function (id) {
|
|
134
|
-
var isSelected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
135
|
-
var resetSelection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
136
|
-
if (!apiRef.current.isRowSelectable(id)) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
lastRowToggled.current = id;
|
|
140
|
-
if (resetSelection) {
|
|
141
|
-
logger.debug("Setting selection for row ".concat(id));
|
|
142
|
-
apiRef.current.setRowSelectionModel(isSelected ? [id] : []);
|
|
143
|
-
} else {
|
|
144
|
-
logger.debug("Toggling selection for row ".concat(id));
|
|
145
|
-
var selection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
146
|
-
var newSelection = selection.filter(function (el) {
|
|
147
|
-
return el !== id;
|
|
148
|
-
});
|
|
149
|
-
if (isSelected) {
|
|
150
|
-
newSelection.push(id);
|
|
151
|
-
}
|
|
152
|
-
var isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;
|
|
153
|
-
if (isSelectionValid) {
|
|
154
|
-
apiRef.current.setRowSelectionModel(newSelection);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
158
|
-
var selectRows = React.useCallback(function (ids) {
|
|
159
|
-
var isSelected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
160
|
-
var resetSelection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
161
|
-
logger.debug("Setting selection for several rows");
|
|
162
|
-
var selectableIds = ids.filter(function (id) {
|
|
163
|
-
return apiRef.current.isRowSelectable(id);
|
|
164
|
-
});
|
|
165
|
-
var newSelection;
|
|
166
|
-
if (resetSelection) {
|
|
167
|
-
newSelection = isSelected ? selectableIds : [];
|
|
168
|
-
} else {
|
|
169
|
-
// We clone the existing object to avoid mutating the same object returned by the selector to others part of the project
|
|
170
|
-
var selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));
|
|
171
|
-
selectableIds.forEach(function (id) {
|
|
172
|
-
if (isSelected) {
|
|
173
|
-
selectionLookup[id] = id;
|
|
174
|
-
} else {
|
|
175
|
-
delete selectionLookup[id];
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
newSelection = Object.values(selectionLookup);
|
|
179
|
-
}
|
|
180
|
-
var isSelectionValid = newSelection.length < 2 || canHaveMultipleSelection;
|
|
181
|
-
if (isSelectionValid) {
|
|
182
|
-
apiRef.current.setRowSelectionModel(newSelection);
|
|
183
|
-
}
|
|
184
|
-
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
185
|
-
var selectRowRange = React.useCallback(function (_ref) {
|
|
186
|
-
var startId = _ref.startId,
|
|
187
|
-
endId = _ref.endId;
|
|
188
|
-
var isSelected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
189
|
-
var resetSelection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
190
|
-
if (!apiRef.current.getRow(startId) || !apiRef.current.getRow(endId)) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
logger.debug("Expanding selection from row ".concat(startId, " to row ").concat(endId));
|
|
194
|
-
|
|
195
|
-
// Using rows from all pages allow to select a range across several pages
|
|
196
|
-
var allPagesRowIds = gridExpandedSortedRowIdsSelector(apiRef);
|
|
197
|
-
var startIndex = allPagesRowIds.indexOf(startId);
|
|
198
|
-
var endIndex = allPagesRowIds.indexOf(endId);
|
|
199
|
-
var _ref2 = startIndex > endIndex ? [endIndex, startIndex] : [startIndex, endIndex],
|
|
200
|
-
_ref3 = _slicedToArray(_ref2, 2),
|
|
201
|
-
start = _ref3[0],
|
|
202
|
-
end = _ref3[1];
|
|
203
|
-
var rowsBetweenStartAndEnd = allPagesRowIds.slice(start, end + 1);
|
|
204
|
-
apiRef.current.selectRows(rowsBetweenStartAndEnd, isSelected, resetSelection);
|
|
205
|
-
}, [apiRef, logger]);
|
|
206
|
-
var selectionPublicApi = {
|
|
207
|
-
selectRow: selectRow,
|
|
208
|
-
setRowSelectionModel: setRowSelectionModel,
|
|
209
|
-
getSelectedRows: getSelectedRows,
|
|
210
|
-
isRowSelected: isRowSelected,
|
|
211
|
-
isRowSelectable: isRowSelectable
|
|
212
|
-
};
|
|
213
|
-
var selectionPrivateApi = {
|
|
214
|
-
selectRows: selectRows,
|
|
215
|
-
selectRowRange: selectRowRange
|
|
216
|
-
};
|
|
217
|
-
useGridApiMethod(apiRef, selectionPublicApi, 'public');
|
|
218
|
-
useGridApiMethod(apiRef, selectionPrivateApi, props.signature === GridSignature.DataGrid ? 'private' : 'public');
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* EVENTS
|
|
222
|
-
*/
|
|
223
|
-
var removeOutdatedSelection = React.useCallback(function () {
|
|
224
|
-
if (props.keepNonExistentRowsSelected) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
var currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
228
|
-
var rowsLookup = gridRowsLookupSelector(apiRef);
|
|
229
|
-
|
|
230
|
-
// We clone the existing object to avoid mutating the same object returned by the selector to others part of the project
|
|
231
|
-
var selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));
|
|
232
|
-
var hasChanged = false;
|
|
233
|
-
currentSelection.forEach(function (id) {
|
|
234
|
-
if (!rowsLookup[id]) {
|
|
235
|
-
delete selectionLookup[id];
|
|
236
|
-
hasChanged = true;
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
if (hasChanged) {
|
|
240
|
-
apiRef.current.setRowSelectionModel(Object.values(selectionLookup));
|
|
241
|
-
}
|
|
242
|
-
}, [apiRef, props.keepNonExistentRowsSelected]);
|
|
243
|
-
var handleSingleRowSelection = React.useCallback(function (id, event) {
|
|
244
|
-
var hasCtrlKey = event.metaKey || event.ctrlKey;
|
|
245
|
-
|
|
246
|
-
// multiple selection is only allowed if:
|
|
247
|
-
// - it is a checkboxSelection
|
|
248
|
-
// - it is a keyboard selection
|
|
249
|
-
// - Ctrl is pressed
|
|
250
|
-
|
|
251
|
-
var isMultipleSelectionDisabled = !checkboxSelection && !hasCtrlKey && !isKeyboardEvent(event);
|
|
252
|
-
var resetSelection = !canHaveMultipleSelection || isMultipleSelectionDisabled;
|
|
253
|
-
var isSelected = apiRef.current.isRowSelected(id);
|
|
254
|
-
if (resetSelection) {
|
|
255
|
-
apiRef.current.selectRow(id, !isMultipleSelectionDisabled ? !isSelected : true, true);
|
|
256
|
-
} else {
|
|
257
|
-
apiRef.current.selectRow(id, !isSelected, false);
|
|
258
|
-
}
|
|
259
|
-
}, [apiRef, canHaveMultipleSelection, checkboxSelection]);
|
|
260
|
-
var handleRowClick = React.useCallback(function (params, event) {
|
|
261
|
-
var _closest;
|
|
262
|
-
if (disableRowSelectionOnClick) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
var field = (_closest = event.target.closest(".".concat(gridClasses.cell))) == null ? void 0 : _closest.getAttribute('data-field');
|
|
266
|
-
if (field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {
|
|
267
|
-
// click on checkbox should not trigger row selection
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (field === GRID_DETAIL_PANEL_TOGGLE_FIELD) {
|
|
271
|
-
// click to open the detail panel should not select the row
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
if (field) {
|
|
275
|
-
var column = apiRef.current.getColumn(field);
|
|
276
|
-
if ((column == null ? void 0 : column.type) === GRID_ACTIONS_COLUMN_TYPE) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
var rowNode = apiRef.current.getRowNode(params.id);
|
|
281
|
-
if (rowNode.type === 'pinnedRow') {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (event.shiftKey && canHaveMultipleSelection) {
|
|
285
|
-
expandMouseRowRangeSelection(params.id);
|
|
286
|
-
} else {
|
|
287
|
-
handleSingleRowSelection(params.id, event);
|
|
288
|
-
}
|
|
289
|
-
}, [disableRowSelectionOnClick, canHaveMultipleSelection, apiRef, expandMouseRowRangeSelection, handleSingleRowSelection]);
|
|
290
|
-
var preventSelectionOnShift = React.useCallback(function (params, event) {
|
|
291
|
-
if (canHaveMultipleSelection && event.shiftKey) {
|
|
292
|
-
var _window$getSelection;
|
|
293
|
-
(_window$getSelection = window.getSelection()) == null || _window$getSelection.removeAllRanges();
|
|
294
|
-
}
|
|
295
|
-
}, [canHaveMultipleSelection]);
|
|
296
|
-
var handleRowSelectionCheckboxChange = React.useCallback(function (params, event) {
|
|
297
|
-
if (canHaveMultipleSelection && event.nativeEvent.shiftKey) {
|
|
298
|
-
expandMouseRowRangeSelection(params.id);
|
|
299
|
-
} else {
|
|
300
|
-
apiRef.current.selectRow(params.id, params.value, !canHaveMultipleSelection);
|
|
301
|
-
}
|
|
302
|
-
}, [apiRef, expandMouseRowRangeSelection, canHaveMultipleSelection]);
|
|
303
|
-
var handleHeaderSelectionCheckboxChange = React.useCallback(function (params) {
|
|
304
|
-
var shouldLimitSelectionToCurrentPage = props.checkboxSelectionVisibleOnly && props.pagination;
|
|
305
|
-
var rowsToBeSelected = shouldLimitSelectionToCurrentPage ? gridPaginatedVisibleSortedGridRowIdsSelector(apiRef) : gridExpandedSortedRowIdsSelector(apiRef);
|
|
306
|
-
apiRef.current.selectRows(rowsToBeSelected, params.value);
|
|
307
|
-
}, [apiRef, props.checkboxSelectionVisibleOnly, props.pagination]);
|
|
308
|
-
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
309
|
-
// Get the most recent cell mode because it may have been changed by another listener
|
|
310
|
-
if (apiRef.current.getCellMode(params.id, params.field) === GridCellModes.Edit) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// Ignore portal
|
|
315
|
-
// Do not apply shortcuts if the focus is not on the cell root component
|
|
316
|
-
if (isEventTargetInPortal(event)) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (isNavigationKey(event.key) && event.shiftKey) {
|
|
320
|
-
// The cell that has focus after the keyboard navigation
|
|
321
|
-
var focusCell = gridFocusCellSelector(apiRef);
|
|
322
|
-
if (focusCell && focusCell.id !== params.id) {
|
|
323
|
-
event.preventDefault();
|
|
324
|
-
var isNextRowSelected = apiRef.current.isRowSelected(focusCell.id);
|
|
325
|
-
if (!canHaveMultipleSelection) {
|
|
326
|
-
apiRef.current.selectRow(focusCell.id, !isNextRowSelected, true);
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
var newRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(focusCell.id);
|
|
330
|
-
var previousRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(params.id);
|
|
331
|
-
var start;
|
|
332
|
-
var end;
|
|
333
|
-
if (newRowIndex > previousRowIndex) {
|
|
334
|
-
if (isNextRowSelected) {
|
|
335
|
-
// We are navigating to the bottom of the page and adding selected rows
|
|
336
|
-
start = previousRowIndex;
|
|
337
|
-
end = newRowIndex - 1;
|
|
338
|
-
} else {
|
|
339
|
-
// We are navigating to the bottom of the page and removing selected rows
|
|
340
|
-
start = previousRowIndex;
|
|
341
|
-
end = newRowIndex;
|
|
342
|
-
}
|
|
343
|
-
} else {
|
|
344
|
-
// eslint-disable-next-line no-lonely-if
|
|
345
|
-
if (isNextRowSelected) {
|
|
346
|
-
// We are navigating to the top of the page and removing selected rows
|
|
347
|
-
start = newRowIndex + 1;
|
|
348
|
-
end = previousRowIndex;
|
|
349
|
-
} else {
|
|
350
|
-
// We are navigating to the top of the page and adding selected rows
|
|
351
|
-
start = newRowIndex;
|
|
352
|
-
end = previousRowIndex;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
var rowsBetweenStartAndEnd = visibleRows.rows.slice(start, end + 1).map(function (row) {
|
|
356
|
-
return row.id;
|
|
357
|
-
});
|
|
358
|
-
apiRef.current.selectRows(rowsBetweenStartAndEnd, !isNextRowSelected);
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (event.key === ' ' && event.shiftKey) {
|
|
363
|
-
event.preventDefault();
|
|
364
|
-
handleSingleRowSelection(params.id, event);
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
if (event.key === 'a' && (event.ctrlKey || event.metaKey)) {
|
|
368
|
-
event.preventDefault();
|
|
369
|
-
selectRows(apiRef.current.getAllRowIds(), true);
|
|
370
|
-
}
|
|
371
|
-
}, [apiRef, handleSingleRowSelection, selectRows, visibleRows.rows, canHaveMultipleSelection]);
|
|
372
|
-
useGridApiEventHandler(apiRef, 'sortedRowsSet', runIfRowSelectionIsEnabled(removeOutdatedSelection));
|
|
373
|
-
useGridApiEventHandler(apiRef, 'rowClick', runIfRowSelectionIsEnabled(handleRowClick));
|
|
374
|
-
useGridApiEventHandler(apiRef, 'rowSelectionCheckboxChange', runIfRowSelectionIsEnabled(handleRowSelectionCheckboxChange));
|
|
375
|
-
useGridApiEventHandler(apiRef, 'headerSelectionCheckboxChange', handleHeaderSelectionCheckboxChange);
|
|
376
|
-
useGridApiEventHandler(apiRef, 'cellMouseDown', runIfRowSelectionIsEnabled(preventSelectionOnShift));
|
|
377
|
-
useGridApiEventHandler(apiRef, 'cellKeyDown', runIfRowSelectionIsEnabled(handleCellKeyDown));
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* EFFECTS
|
|
381
|
-
*/
|
|
382
|
-
React.useEffect(function () {
|
|
383
|
-
if (propRowSelectionModel !== undefined) {
|
|
384
|
-
apiRef.current.setRowSelectionModel(propRowSelectionModel);
|
|
385
|
-
}
|
|
386
|
-
}, [apiRef, propRowSelectionModel, props.rowSelection]);
|
|
387
|
-
React.useEffect(function () {
|
|
388
|
-
if (!props.rowSelection) {
|
|
389
|
-
apiRef.current.setRowSelectionModel([]);
|
|
390
|
-
}
|
|
391
|
-
}, [apiRef, props.rowSelection]);
|
|
392
|
-
var isStateControlled = propRowSelectionModel != null;
|
|
393
|
-
React.useEffect(function () {
|
|
394
|
-
if (isStateControlled || !props.rowSelection) {
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// props.isRowSelectable changed
|
|
399
|
-
var currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
400
|
-
if (isRowSelectable) {
|
|
401
|
-
var newSelection = currentSelection.filter(function (id) {
|
|
402
|
-
return isRowSelectable(id);
|
|
403
|
-
});
|
|
404
|
-
if (newSelection.length < currentSelection.length) {
|
|
405
|
-
apiRef.current.setRowSelectionModel(newSelection);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}, [apiRef, isRowSelectable, isStateControlled, props.rowSelection]);
|
|
409
|
-
React.useEffect(function () {
|
|
410
|
-
if (!props.rowSelection || isStateControlled) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
var currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
414
|
-
if (!canHaveMultipleSelection && currentSelection.length > 1) {
|
|
415
|
-
// See https://github.com/mui/mui-x/issues/8455
|
|
416
|
-
apiRef.current.setRowSelectionModel([]);
|
|
417
|
-
}
|
|
418
|
-
}, [apiRef, canHaveMultipleSelection, checkboxSelection, isStateControlled, props.rowSelection]);
|
|
419
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
5
|
-
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
6
|
-
import { getDataGridUtilityClass } from '../../../constants';
|
|
7
|
-
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_CHECKBOX_SELECTION_FIELD } from '../../../colDef';
|
|
8
|
-
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
9
|
-
var classes = ownerState.classes;
|
|
10
|
-
return React.useMemo(function () {
|
|
11
|
-
var slots = {
|
|
12
|
-
cellCheckbox: ['cellCheckbox'],
|
|
13
|
-
columnHeaderCheckbox: ['columnHeaderCheckbox']
|
|
14
|
-
};
|
|
15
|
-
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
16
|
-
}, [classes]);
|
|
17
|
-
};
|
|
18
|
-
export var useGridRowSelectionPreProcessors = function useGridRowSelectionPreProcessors(apiRef, props) {
|
|
19
|
-
var ownerState = {
|
|
20
|
-
classes: props.classes
|
|
21
|
-
};
|
|
22
|
-
var classes = useUtilityClasses(ownerState);
|
|
23
|
-
var updateSelectionColumn = React.useCallback(function (columnsState) {
|
|
24
|
-
var selectionColumn = _extends({}, GRID_CHECKBOX_SELECTION_COL_DEF, {
|
|
25
|
-
cellClassName: classes.cellCheckbox,
|
|
26
|
-
headerClassName: classes.columnHeaderCheckbox,
|
|
27
|
-
headerName: apiRef.current.getLocaleText('checkboxSelectionHeaderName')
|
|
28
|
-
});
|
|
29
|
-
var shouldHaveSelectionColumn = props.checkboxSelection;
|
|
30
|
-
var haveSelectionColumn = columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] != null;
|
|
31
|
-
if (shouldHaveSelectionColumn && !haveSelectionColumn) {
|
|
32
|
-
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = selectionColumn;
|
|
33
|
-
columnsState.orderedFields = [GRID_CHECKBOX_SELECTION_FIELD].concat(_toConsumableArray(columnsState.orderedFields));
|
|
34
|
-
} else if (!shouldHaveSelectionColumn && haveSelectionColumn) {
|
|
35
|
-
delete columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD];
|
|
36
|
-
columnsState.orderedFields = columnsState.orderedFields.filter(function (field) {
|
|
37
|
-
return field !== GRID_CHECKBOX_SELECTION_FIELD;
|
|
38
|
-
});
|
|
39
|
-
} else if (shouldHaveSelectionColumn && haveSelectionColumn) {
|
|
40
|
-
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = _extends({}, selectionColumn, columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD]);
|
|
41
|
-
}
|
|
42
|
-
return columnsState;
|
|
43
|
-
}, [apiRef, classes, props.checkboxSelection]);
|
|
44
|
-
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateSelectionColumn);
|
|
45
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { GridSignature } from '../../utils/useGridApiEventHandler';
|
|
2
|
-
export function isMultipleRowSelectionEnabled(props) {
|
|
3
|
-
if (props.signature === GridSignature.DataGrid) {
|
|
4
|
-
// DataGrid Community has multiple row selection enabled only if checkbox selection is enabled.
|
|
5
|
-
return props.checkboxSelection && props.disableMultipleRowSelection !== true;
|
|
6
|
-
}
|
|
7
|
-
return !props.disableMultipleRowSelection;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
|
|
3
|
-
var gridRowsStateSelector = function gridRowsStateSelector(state) {
|
|
4
|
-
return state.rows;
|
|
5
|
-
};
|
|
6
|
-
export var gridRowCountSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
7
|
-
return rows.totalRowCount;
|
|
8
|
-
});
|
|
9
|
-
export var gridRowsLoadingSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
10
|
-
return rows.loading;
|
|
11
|
-
});
|
|
12
|
-
export var gridTopLevelRowCountSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
13
|
-
return rows.totalTopLevelRowCount;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// TODO rows v6: Rename
|
|
17
|
-
export var gridRowsLookupSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
18
|
-
return rows.dataRowIdToModelLookup;
|
|
19
|
-
});
|
|
20
|
-
export var gridRowsDataRowIdToIdLookupSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
21
|
-
return rows.dataRowIdToIdLookup;
|
|
22
|
-
});
|
|
23
|
-
export var gridRowTreeSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
24
|
-
return rows.tree;
|
|
25
|
-
});
|
|
26
|
-
export var gridRowGroupingNameSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
27
|
-
return rows.groupingName;
|
|
28
|
-
});
|
|
29
|
-
export var gridRowTreeDepthsSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
30
|
-
return rows.treeDepths;
|
|
31
|
-
});
|
|
32
|
-
export var gridRowMaximumTreeDepthSelector = createSelectorMemoized(gridRowsStateSelector, function (rows) {
|
|
33
|
-
var entries = Object.entries(rows.treeDepths);
|
|
34
|
-
if (entries.length === 0) {
|
|
35
|
-
return 1;
|
|
36
|
-
}
|
|
37
|
-
return entries.filter(function (_ref) {
|
|
38
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
39
|
-
nodeCount = _ref2[1];
|
|
40
|
-
return nodeCount > 0;
|
|
41
|
-
}).map(function (_ref3) {
|
|
42
|
-
var _ref4 = _slicedToArray(_ref3, 1),
|
|
43
|
-
depth = _ref4[0];
|
|
44
|
-
return Number(depth);
|
|
45
|
-
}).sort(function (a, b) {
|
|
46
|
-
return b - a;
|
|
47
|
-
})[0] + 1;
|
|
48
|
-
});
|
|
49
|
-
export var gridDataRowIdsSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
50
|
-
return rows.dataRowIds;
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @ignore - do not document.
|
|
55
|
-
*/
|
|
56
|
-
export var gridAdditionalRowGroupsSelector = createSelector(gridRowsStateSelector, function (rows) {
|
|
57
|
-
return rows == null ? void 0 : rows.additionalRowGroups;
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @ignore - do not document.
|
|
62
|
-
*/
|
|
63
|
-
export var gridPinnedRowsSelector = createSelectorMemoized(gridAdditionalRowGroupsSelector, function (additionalRowGroups) {
|
|
64
|
-
var _rawPinnedRows$bottom, _rawPinnedRows$bottom2, _rawPinnedRows$top$ma, _rawPinnedRows$top;
|
|
65
|
-
var rawPinnedRows = additionalRowGroups == null ? void 0 : additionalRowGroups.pinnedRows;
|
|
66
|
-
return {
|
|
67
|
-
bottom: (_rawPinnedRows$bottom = rawPinnedRows == null || (_rawPinnedRows$bottom2 = rawPinnedRows.bottom) == null ? void 0 : _rawPinnedRows$bottom2.map(function (rowEntry) {
|
|
68
|
-
var _rowEntry$model;
|
|
69
|
-
return {
|
|
70
|
-
id: rowEntry.id,
|
|
71
|
-
model: (_rowEntry$model = rowEntry.model) != null ? _rowEntry$model : {}
|
|
72
|
-
};
|
|
73
|
-
})) != null ? _rawPinnedRows$bottom : [],
|
|
74
|
-
top: (_rawPinnedRows$top$ma = rawPinnedRows == null || (_rawPinnedRows$top = rawPinnedRows.top) == null ? void 0 : _rawPinnedRows$top.map(function (rowEntry) {
|
|
75
|
-
var _rowEntry$model2;
|
|
76
|
-
return {
|
|
77
|
-
id: rowEntry.id,
|
|
78
|
-
model: (_rowEntry$model2 = rowEntry.model) != null ? _rowEntry$model2 : {}
|
|
79
|
-
};
|
|
80
|
-
})) != null ? _rawPinnedRows$top$ma : []
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @ignore - do not document.
|
|
86
|
-
*/
|
|
87
|
-
export var gridPinnedRowsCountSelector = createSelector(gridPinnedRowsSelector, function (pinnedRows) {
|
|
88
|
-
var _pinnedRows$top, _pinnedRows$bottom;
|
|
89
|
-
return ((pinnedRows == null || (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.length) || 0) + ((pinnedRows == null || (_pinnedRows$bottom = pinnedRows.bottom) == null ? void 0 : _pinnedRows$bottom.length) || 0);
|
|
90
|
-
});
|