@mui/x-data-grid 7.0.0-beta.3 → 7.0.0-beta.5
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 +357 -22
- package/DataGrid/DataGrid.js +2 -0
- package/colDef/gridActionsColDef.js +1 -0
- package/colDef/gridBooleanColDef.js +1 -0
- package/colDef/gridBooleanOperators.js +1 -1
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/components/GridRow.d.ts +7 -9
- package/components/GridRow.js +36 -47
- package/components/GridScrollbarFillerCell.js +6 -21
- package/components/cell/GridCell.d.ts +2 -1
- package/components/cell/GridCell.js +17 -15
- package/components/cell/GridSkeletonCell.d.ts +3 -2
- package/components/cell/GridSkeletonCell.js +14 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +7 -6
- package/components/columnsManagement/GridColumnsManagement.js +1 -1
- package/components/containers/GridRootStyles.js +59 -21
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/components/virtualization/GridBottomContainer.js +1 -1
- package/components/virtualization/GridTopContainer.js +1 -1
- package/components/virtualization/GridVirtualScroller.js +2 -2
- package/components/virtualization/GridVirtualScrollerRenderZone.js +9 -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.js +11 -8
- package/hooks/features/columns/gridColumnsSelector.d.ts +6 -0
- package/hooks/features/columns/gridColumnsSelector.js +8 -1
- package/hooks/features/columns/useGridColumns.js +4 -0
- package/hooks/features/editing/useGridCellEditing.js +3 -4
- package/hooks/features/editing/useGridRowEditing.js +4 -6
- package/hooks/features/filter/useGridFilter.js +2 -2
- package/hooks/features/rows/useGridRows.js +8 -4
- package/hooks/features/rows/useGridRowsMeta.js +5 -13
- package/hooks/features/sorting/gridSortingUtils.js +9 -1
- package/hooks/features/sorting/useGridSorting.js +1 -2
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +0 -9
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -7
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +82 -138
- package/hooks/features/virtualization/useGridVirtualization.d.ts +0 -8
- package/hooks/features/virtualization/useGridVirtualization.js +1 -6
- package/hooks/utils/useTimeout.d.ts +5 -3
- package/hooks/utils/useTimeout.js +13 -5
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/models/colDef/gridColDef.d.ts +13 -0
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/colDef/gridActionsColDef.js +1 -0
- package/modern/colDef/gridBooleanColDef.js +1 -0
- package/modern/colDef/gridBooleanOperators.js +1 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/modern/components/GridRow.js +35 -46
- package/modern/components/GridScrollbarFillerCell.js +6 -21
- package/modern/components/cell/GridCell.js +17 -15
- package/modern/components/cell/GridSkeletonCell.js +14 -6
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +7 -6
- package/modern/components/columnsManagement/GridColumnsManagement.js +1 -1
- package/modern/components/containers/GridRootStyles.js +59 -21
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/modern/components/virtualization/GridBottomContainer.js +1 -1
- package/modern/components/virtualization/GridTopContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +2 -2
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +8 -3
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -8
- package/modern/hooks/features/columns/gridColumnsSelector.js +8 -1
- package/modern/hooks/features/columns/useGridColumns.js +2 -0
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +4 -6
- package/modern/hooks/features/filter/useGridFilter.js +2 -2
- package/modern/hooks/features/rows/useGridRows.js +8 -4
- package/modern/hooks/features/rows/useGridRowsMeta.js +5 -13
- package/modern/hooks/features/sorting/gridSortingUtils.js +9 -1
- package/modern/hooks/features/sorting/useGridSorting.js +1 -2
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -7
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +80 -136
- package/modern/hooks/features/virtualization/useGridVirtualization.js +1 -6
- package/modern/hooks/utils/useTimeout.js +13 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/utils/keyboardUtils.js +20 -11
- package/modern/utils/utils.js +9 -0
- package/node/DataGrid/DataGrid.js +1 -0
- package/node/colDef/gridActionsColDef.js +1 -0
- package/node/colDef/gridBooleanColDef.js +1 -0
- package/node/colDef/gridBooleanOperators.js +1 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/node/components/GridRow.js +35 -46
- package/node/components/GridScrollbarFillerCell.js +5 -20
- package/node/components/cell/GridCell.js +17 -15
- package/node/components/cell/GridSkeletonCell.js +15 -7
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +7 -6
- package/node/components/columnsManagement/GridColumnsManagement.js +1 -1
- package/node/components/containers/GridRootStyles.js +59 -21
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/node/components/virtualization/GridBottomContainer.js +1 -1
- package/node/components/virtualization/GridTopContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +2 -2
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +7 -2
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -5
- package/node/hooks/features/columns/gridColumnsSelector.js +9 -2
- package/node/hooks/features/columns/useGridColumns.js +2 -0
- package/node/hooks/features/editing/useGridCellEditing.js +2 -3
- package/node/hooks/features/editing/useGridRowEditing.js +3 -5
- package/node/hooks/features/filter/useGridFilter.js +2 -2
- package/node/hooks/features/rows/useGridRows.js +8 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +5 -13
- package/node/hooks/features/sorting/gridSortingUtils.js +9 -1
- package/node/hooks/features/sorting/useGridSorting.js +1 -2
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +1 -8
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +81 -136
- package/node/hooks/features/virtualization/useGridVirtualization.js +2 -7
- package/node/hooks/utils/useTimeout.js +13 -4
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/utils/keyboardUtils.js +25 -20
- package/node/utils/utils.js +12 -1
- package/package.json +1 -1
- package/utils/keyboardUtils.d.ts +7 -6
- package/utils/keyboardUtils.js +20 -11
- package/utils/utils.d.ts +4 -0
- package/utils/utils.js +9 -0
- 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,466 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
7
|
-
import { useGridLogger } from '../../utils/useGridLogger';
|
|
8
|
-
import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowsDataRowIdToIdLookupSelector, gridRowMaximumTreeDepthSelector } from './gridRowsSelector';
|
|
9
|
-
import { useTimeout } from '../../utils/useTimeout';
|
|
10
|
-
import { GridSignature, useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
11
|
-
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
12
|
-
import { gridSortedRowIdsSelector } from '../sorting/gridSortingSelector';
|
|
13
|
-
import { gridFilteredRowsLookupSelector } from '../filter/gridFilterSelector';
|
|
14
|
-
import { getTreeNodeDescendants, createRowsInternalCache, getRowsStateFromCache, isAutoGeneratedRow, GRID_ROOT_GROUP_ID, GRID_ID_AUTOGENERATED, updateCacheWithNewRows, getTopLevelRowCount, getRowIdFromRowModel } from './gridRowsUtils';
|
|
15
|
-
import { useGridRegisterPipeApplier } from '../../core/pipeProcessing';
|
|
16
|
-
export var rowsStateInitializer = function rowsStateInitializer(state, props, apiRef) {
|
|
17
|
-
apiRef.current.caches.rows = createRowsInternalCache({
|
|
18
|
-
rows: props.rows,
|
|
19
|
-
getRowId: props.getRowId,
|
|
20
|
-
loading: props.loading,
|
|
21
|
-
rowCount: props.rowCount
|
|
22
|
-
});
|
|
23
|
-
return _extends({}, state, {
|
|
24
|
-
rows: getRowsStateFromCache({
|
|
25
|
-
apiRef: apiRef,
|
|
26
|
-
rowCountProp: props.rowCount,
|
|
27
|
-
loadingProp: props.loading,
|
|
28
|
-
previousTree: null,
|
|
29
|
-
previousTreeDepths: null
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
export var useGridRows = function useGridRows(apiRef, props) {
|
|
34
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
35
|
-
try {
|
|
36
|
-
// Freeze the `rows` prop so developers have a fast failure if they try to use Array.prototype.push().
|
|
37
|
-
Object.freeze(props.rows);
|
|
38
|
-
} catch (error) {
|
|
39
|
-
// Sometimes, it's impossible to freeze, so we give up on it.
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
var logger = useGridLogger(apiRef, 'useGridRows');
|
|
43
|
-
var currentPage = useGridVisibleRows(apiRef, props);
|
|
44
|
-
var lastUpdateMs = React.useRef(Date.now());
|
|
45
|
-
var timeout = useTimeout();
|
|
46
|
-
var getRow = React.useCallback(function (id) {
|
|
47
|
-
var model = gridRowsLookupSelector(apiRef)[id];
|
|
48
|
-
if (model) {
|
|
49
|
-
return model;
|
|
50
|
-
}
|
|
51
|
-
var node = apiRef.current.getRowNode(id);
|
|
52
|
-
if (node && isAutoGeneratedRow(node)) {
|
|
53
|
-
return _defineProperty({}, GRID_ID_AUTOGENERATED, id);
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
}, [apiRef]);
|
|
57
|
-
var getRowIdProp = props.getRowId;
|
|
58
|
-
var getRowId = React.useCallback(function (row) {
|
|
59
|
-
if (GRID_ID_AUTOGENERATED in row) {
|
|
60
|
-
return row[GRID_ID_AUTOGENERATED];
|
|
61
|
-
}
|
|
62
|
-
if (getRowIdProp) {
|
|
63
|
-
return getRowIdProp(row);
|
|
64
|
-
}
|
|
65
|
-
return row.id;
|
|
66
|
-
}, [getRowIdProp]);
|
|
67
|
-
var lookup = React.useMemo(function () {
|
|
68
|
-
return currentPage.rows.reduce(function (acc, _ref2, index) {
|
|
69
|
-
var id = _ref2.id;
|
|
70
|
-
acc[id] = index;
|
|
71
|
-
return acc;
|
|
72
|
-
}, {});
|
|
73
|
-
}, [currentPage.rows]);
|
|
74
|
-
var throttledRowsChange = React.useCallback(function (_ref3) {
|
|
75
|
-
var cache = _ref3.cache,
|
|
76
|
-
throttle = _ref3.throttle;
|
|
77
|
-
var run = function run() {
|
|
78
|
-
lastUpdateMs.current = Date.now();
|
|
79
|
-
apiRef.current.setState(function (state) {
|
|
80
|
-
return _extends({}, state, {
|
|
81
|
-
rows: getRowsStateFromCache({
|
|
82
|
-
apiRef: apiRef,
|
|
83
|
-
rowCountProp: props.rowCount,
|
|
84
|
-
loadingProp: props.loading,
|
|
85
|
-
previousTree: gridRowTreeSelector(apiRef),
|
|
86
|
-
previousTreeDepths: gridRowTreeDepthsSelector(apiRef)
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
apiRef.current.publishEvent('rowsSet');
|
|
91
|
-
apiRef.current.forceUpdate();
|
|
92
|
-
};
|
|
93
|
-
timeout.clear();
|
|
94
|
-
apiRef.current.caches.rows = cache;
|
|
95
|
-
if (!throttle) {
|
|
96
|
-
run();
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
var throttleRemainingTimeMs = props.throttleRowsMs - (Date.now() - lastUpdateMs.current);
|
|
100
|
-
if (throttleRemainingTimeMs > 0) {
|
|
101
|
-
timeout.start(throttleRemainingTimeMs, run);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
run();
|
|
105
|
-
}, [props.throttleRowsMs, props.rowCount, props.loading, apiRef, timeout]);
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* API METHODS
|
|
109
|
-
*/
|
|
110
|
-
var setRows = React.useCallback(function (rows) {
|
|
111
|
-
logger.debug("Updating all rows, new length ".concat(rows.length));
|
|
112
|
-
var cache = createRowsInternalCache({
|
|
113
|
-
rows: rows,
|
|
114
|
-
getRowId: props.getRowId,
|
|
115
|
-
loading: props.loading,
|
|
116
|
-
rowCount: props.rowCount
|
|
117
|
-
});
|
|
118
|
-
var prevCache = apiRef.current.caches.rows;
|
|
119
|
-
cache.rowsBeforePartialUpdates = prevCache.rowsBeforePartialUpdates;
|
|
120
|
-
throttledRowsChange({
|
|
121
|
-
cache: cache,
|
|
122
|
-
throttle: true
|
|
123
|
-
});
|
|
124
|
-
}, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
|
|
125
|
-
var updateRows = React.useCallback(function (updates) {
|
|
126
|
-
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
127
|
-
throw new Error(['MUI X: You cannot update several rows at once in `apiRef.current.updateRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
128
|
-
}
|
|
129
|
-
var nonPinnedRowsUpdates = [];
|
|
130
|
-
updates.forEach(function (update) {
|
|
131
|
-
var id = getRowIdFromRowModel(update, props.getRowId, 'A row was provided without id when calling updateRows():');
|
|
132
|
-
var rowNode = apiRef.current.getRowNode(id);
|
|
133
|
-
if ((rowNode == null ? void 0 : rowNode.type) === 'pinnedRow') {
|
|
134
|
-
// @ts-ignore because otherwise `release:build` doesn't work
|
|
135
|
-
var pinnedRowsCache = apiRef.current.caches.pinnedRows;
|
|
136
|
-
var prevModel = pinnedRowsCache.idLookup[id];
|
|
137
|
-
if (prevModel) {
|
|
138
|
-
pinnedRowsCache.idLookup[id] = _extends({}, prevModel, update);
|
|
139
|
-
}
|
|
140
|
-
} else {
|
|
141
|
-
nonPinnedRowsUpdates.push(update);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
var cache = updateCacheWithNewRows({
|
|
145
|
-
updates: nonPinnedRowsUpdates,
|
|
146
|
-
getRowId: props.getRowId,
|
|
147
|
-
previousCache: apiRef.current.caches.rows
|
|
148
|
-
});
|
|
149
|
-
throttledRowsChange({
|
|
150
|
-
cache: cache,
|
|
151
|
-
throttle: true
|
|
152
|
-
});
|
|
153
|
-
}, [props.signature, props.getRowId, throttledRowsChange, apiRef]);
|
|
154
|
-
var getRowModels = React.useCallback(function () {
|
|
155
|
-
var dataRows = gridDataRowIdsSelector(apiRef);
|
|
156
|
-
var idRowsLookup = gridRowsLookupSelector(apiRef);
|
|
157
|
-
return new Map(dataRows.map(function (id) {
|
|
158
|
-
var _idRowsLookup$id;
|
|
159
|
-
return [id, (_idRowsLookup$id = idRowsLookup[id]) != null ? _idRowsLookup$id : {}];
|
|
160
|
-
}));
|
|
161
|
-
}, [apiRef]);
|
|
162
|
-
var getRowsCount = React.useCallback(function () {
|
|
163
|
-
return gridRowCountSelector(apiRef);
|
|
164
|
-
}, [apiRef]);
|
|
165
|
-
var getAllRowIds = React.useCallback(function () {
|
|
166
|
-
return gridDataRowIdsSelector(apiRef);
|
|
167
|
-
}, [apiRef]);
|
|
168
|
-
var getRowIndexRelativeToVisibleRows = React.useCallback(function (id) {
|
|
169
|
-
return lookup[id];
|
|
170
|
-
}, [lookup]);
|
|
171
|
-
var setRowChildrenExpansion = React.useCallback(function (id, isExpanded) {
|
|
172
|
-
var currentNode = apiRef.current.getRowNode(id);
|
|
173
|
-
if (!currentNode) {
|
|
174
|
-
throw new Error("MUI X: No row with id #".concat(id, " found."));
|
|
175
|
-
}
|
|
176
|
-
if (currentNode.type !== 'group') {
|
|
177
|
-
throw new Error('MUI X: Only group nodes can be expanded or collapsed.');
|
|
178
|
-
}
|
|
179
|
-
var newNode = _extends({}, currentNode, {
|
|
180
|
-
childrenExpanded: isExpanded
|
|
181
|
-
});
|
|
182
|
-
apiRef.current.setState(function (state) {
|
|
183
|
-
return _extends({}, state, {
|
|
184
|
-
rows: _extends({}, state.rows, {
|
|
185
|
-
tree: _extends({}, state.rows.tree, _defineProperty({}, id, newNode))
|
|
186
|
-
})
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
apiRef.current.forceUpdate();
|
|
190
|
-
apiRef.current.publishEvent('rowExpansionChange', newNode);
|
|
191
|
-
}, [apiRef]);
|
|
192
|
-
var getRowNode = React.useCallback(function (id) {
|
|
193
|
-
var _ref4;
|
|
194
|
-
return (_ref4 = gridRowTreeSelector(apiRef)[id]) != null ? _ref4 : null;
|
|
195
|
-
}, [apiRef]);
|
|
196
|
-
var getRowGroupChildren = React.useCallback(function (_ref5) {
|
|
197
|
-
var _ref5$skipAutoGenerat = _ref5.skipAutoGeneratedRows,
|
|
198
|
-
skipAutoGeneratedRows = _ref5$skipAutoGenerat === void 0 ? true : _ref5$skipAutoGenerat,
|
|
199
|
-
groupId = _ref5.groupId,
|
|
200
|
-
applySorting = _ref5.applySorting,
|
|
201
|
-
applyFiltering = _ref5.applyFiltering;
|
|
202
|
-
var tree = gridRowTreeSelector(apiRef);
|
|
203
|
-
var children;
|
|
204
|
-
if (applySorting) {
|
|
205
|
-
var groupNode = tree[groupId];
|
|
206
|
-
if (!groupNode) {
|
|
207
|
-
return [];
|
|
208
|
-
}
|
|
209
|
-
var sortedRowIds = gridSortedRowIdsSelector(apiRef);
|
|
210
|
-
children = [];
|
|
211
|
-
var startIndex = sortedRowIds.findIndex(function (id) {
|
|
212
|
-
return id === groupId;
|
|
213
|
-
}) + 1;
|
|
214
|
-
for (var index = startIndex; index < sortedRowIds.length && tree[sortedRowIds[index]].depth > groupNode.depth; index += 1) {
|
|
215
|
-
var id = sortedRowIds[index];
|
|
216
|
-
if (!skipAutoGeneratedRows || !isAutoGeneratedRow(tree[id])) {
|
|
217
|
-
children.push(id);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
children = getTreeNodeDescendants(tree, groupId, skipAutoGeneratedRows);
|
|
222
|
-
}
|
|
223
|
-
if (applyFiltering) {
|
|
224
|
-
var filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
225
|
-
children = children.filter(function (childId) {
|
|
226
|
-
return filteredRowsLookup[childId] !== false;
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
return children;
|
|
230
|
-
}, [apiRef]);
|
|
231
|
-
var setRowIndex = React.useCallback(function (rowId, targetIndex) {
|
|
232
|
-
var node = apiRef.current.getRowNode(rowId);
|
|
233
|
-
if (!node) {
|
|
234
|
-
throw new Error("MUI X: No row with id #".concat(rowId, " found."));
|
|
235
|
-
}
|
|
236
|
-
if (node.parent !== GRID_ROOT_GROUP_ID) {
|
|
237
|
-
throw new Error("MUI X: The row reordering do not support reordering of grouped rows yet.");
|
|
238
|
-
}
|
|
239
|
-
if (node.type !== 'leaf') {
|
|
240
|
-
throw new Error("MUI X: The row reordering do not support reordering of footer or grouping rows.");
|
|
241
|
-
}
|
|
242
|
-
apiRef.current.setState(function (state) {
|
|
243
|
-
var group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
|
|
244
|
-
var allRows = group.children;
|
|
245
|
-
var oldIndex = allRows.findIndex(function (row) {
|
|
246
|
-
return row === rowId;
|
|
247
|
-
});
|
|
248
|
-
if (oldIndex === -1 || oldIndex === targetIndex) {
|
|
249
|
-
return state;
|
|
250
|
-
}
|
|
251
|
-
logger.debug("Moving row ".concat(rowId, " to index ").concat(targetIndex));
|
|
252
|
-
var updatedRows = _toConsumableArray(allRows);
|
|
253
|
-
updatedRows.splice(targetIndex, 0, updatedRows.splice(oldIndex, 1)[0]);
|
|
254
|
-
return _extends({}, state, {
|
|
255
|
-
rows: _extends({}, state.rows, {
|
|
256
|
-
tree: _extends({}, state.rows.tree, _defineProperty({}, GRID_ROOT_GROUP_ID, _extends({}, group, {
|
|
257
|
-
children: updatedRows
|
|
258
|
-
})))
|
|
259
|
-
})
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
apiRef.current.publishEvent('rowsSet');
|
|
263
|
-
}, [apiRef, logger]);
|
|
264
|
-
var replaceRows = React.useCallback(function (firstRowToRender, newRows) {
|
|
265
|
-
if (props.signature === GridSignature.DataGrid && newRows.length > 1) {
|
|
266
|
-
throw new Error(['MUI X: You cannot replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
267
|
-
}
|
|
268
|
-
if (newRows.length === 0) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
var treeDepth = gridRowMaximumTreeDepthSelector(apiRef);
|
|
272
|
-
if (treeDepth > 1) {
|
|
273
|
-
throw new Error('`apiRef.current.unstable_replaceRows` is not compatible with tree data and row grouping');
|
|
274
|
-
}
|
|
275
|
-
var tree = _extends({}, gridRowTreeSelector(apiRef));
|
|
276
|
-
var dataRowIdToModelLookup = _extends({}, gridRowsLookupSelector(apiRef));
|
|
277
|
-
var dataRowIdToIdLookup = _extends({}, gridRowsDataRowIdToIdLookupSelector(apiRef));
|
|
278
|
-
var rootGroup = tree[GRID_ROOT_GROUP_ID];
|
|
279
|
-
var rootGroupChildren = _toConsumableArray(rootGroup.children);
|
|
280
|
-
for (var i = 0; i < newRows.length; i += 1) {
|
|
281
|
-
var rowModel = newRows[i];
|
|
282
|
-
var rowId = getRowIdFromRowModel(rowModel, props.getRowId, 'A row was provided without id when calling replaceRows().');
|
|
283
|
-
var _rootGroupChildren$sp = rootGroupChildren.splice(firstRowToRender + i, 1, rowId),
|
|
284
|
-
_rootGroupChildren$sp2 = _slicedToArray(_rootGroupChildren$sp, 1),
|
|
285
|
-
replacedRowId = _rootGroupChildren$sp2[0];
|
|
286
|
-
delete dataRowIdToModelLookup[replacedRowId];
|
|
287
|
-
delete dataRowIdToIdLookup[replacedRowId];
|
|
288
|
-
delete tree[replacedRowId];
|
|
289
|
-
var rowTreeNodeConfig = {
|
|
290
|
-
id: rowId,
|
|
291
|
-
depth: 0,
|
|
292
|
-
parent: GRID_ROOT_GROUP_ID,
|
|
293
|
-
type: 'leaf',
|
|
294
|
-
groupingKey: null
|
|
295
|
-
};
|
|
296
|
-
dataRowIdToModelLookup[rowId] = rowModel;
|
|
297
|
-
dataRowIdToIdLookup[rowId] = rowId;
|
|
298
|
-
tree[rowId] = rowTreeNodeConfig;
|
|
299
|
-
}
|
|
300
|
-
tree[GRID_ROOT_GROUP_ID] = _extends({}, rootGroup, {
|
|
301
|
-
children: rootGroupChildren
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// Removes potential remaining skeleton rows from the dataRowIds.
|
|
305
|
-
var dataRowIds = rootGroupChildren.filter(function (childId) {
|
|
306
|
-
var _tree$childId;
|
|
307
|
-
return ((_tree$childId = tree[childId]) == null ? void 0 : _tree$childId.type) === 'leaf';
|
|
308
|
-
});
|
|
309
|
-
apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
|
|
310
|
-
apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
|
|
311
|
-
apiRef.current.setState(function (state) {
|
|
312
|
-
return _extends({}, state, {
|
|
313
|
-
rows: _extends({}, state.rows, {
|
|
314
|
-
dataRowIdToModelLookup: dataRowIdToModelLookup,
|
|
315
|
-
dataRowIdToIdLookup: dataRowIdToIdLookup,
|
|
316
|
-
dataRowIds: dataRowIds,
|
|
317
|
-
tree: tree
|
|
318
|
-
})
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
apiRef.current.publishEvent('rowsSet');
|
|
322
|
-
}, [apiRef, props.signature, props.getRowId]);
|
|
323
|
-
var rowApi = {
|
|
324
|
-
getRow: getRow,
|
|
325
|
-
getRowId: getRowId,
|
|
326
|
-
getRowModels: getRowModels,
|
|
327
|
-
getRowsCount: getRowsCount,
|
|
328
|
-
getAllRowIds: getAllRowIds,
|
|
329
|
-
setRows: setRows,
|
|
330
|
-
updateRows: updateRows,
|
|
331
|
-
getRowNode: getRowNode,
|
|
332
|
-
getRowIndexRelativeToVisibleRows: getRowIndexRelativeToVisibleRows,
|
|
333
|
-
unstable_replaceRows: replaceRows
|
|
334
|
-
};
|
|
335
|
-
var rowProApi = {
|
|
336
|
-
setRowIndex: setRowIndex,
|
|
337
|
-
setRowChildrenExpansion: setRowChildrenExpansion,
|
|
338
|
-
getRowGroupChildren: getRowGroupChildren
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* EVENTS
|
|
343
|
-
*/
|
|
344
|
-
var groupRows = React.useCallback(function () {
|
|
345
|
-
logger.info("Row grouping pre-processing have changed, regenerating the row tree");
|
|
346
|
-
var cache;
|
|
347
|
-
if (apiRef.current.caches.rows.rowsBeforePartialUpdates === props.rows) {
|
|
348
|
-
// The `props.rows` did not change since the last row grouping
|
|
349
|
-
// We can use the current rows cache which contains the partial updates done recently.
|
|
350
|
-
cache = _extends({}, apiRef.current.caches.rows, {
|
|
351
|
-
updates: {
|
|
352
|
-
type: 'full',
|
|
353
|
-
rows: gridDataRowIdsSelector(apiRef)
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
} else {
|
|
357
|
-
// The `props.rows` has changed since the last row grouping
|
|
358
|
-
// We must use the new `props.rows` on the new grouping
|
|
359
|
-
// This occurs because this event is triggered before the `useEffect` on the rows when both the grouping pre-processing and the rows changes on the same render
|
|
360
|
-
cache = createRowsInternalCache({
|
|
361
|
-
rows: props.rows,
|
|
362
|
-
getRowId: props.getRowId,
|
|
363
|
-
loading: props.loading,
|
|
364
|
-
rowCount: props.rowCount
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
throttledRowsChange({
|
|
368
|
-
cache: cache,
|
|
369
|
-
throttle: false
|
|
370
|
-
});
|
|
371
|
-
}, [logger, apiRef, props.rows, props.getRowId, props.loading, props.rowCount, throttledRowsChange]);
|
|
372
|
-
var handleStrategyProcessorChange = React.useCallback(function (methodName) {
|
|
373
|
-
if (methodName === 'rowTreeCreation') {
|
|
374
|
-
groupRows();
|
|
375
|
-
}
|
|
376
|
-
}, [groupRows]);
|
|
377
|
-
var handleStrategyActivityChange = React.useCallback(function () {
|
|
378
|
-
// `rowTreeCreation` is the only processor ran when `strategyAvailabilityChange` is fired.
|
|
379
|
-
// All the other processors listen to `rowsSet` which will be published by the `groupRows` method below.
|
|
380
|
-
if (apiRef.current.getActiveStrategy('rowTree') !== gridRowGroupingNameSelector(apiRef)) {
|
|
381
|
-
groupRows();
|
|
382
|
-
}
|
|
383
|
-
}, [apiRef, groupRows]);
|
|
384
|
-
useGridApiEventHandler(apiRef, 'activeStrategyProcessorChange', handleStrategyProcessorChange);
|
|
385
|
-
useGridApiEventHandler(apiRef, 'strategyAvailabilityChange', handleStrategyActivityChange);
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* APPLIERS
|
|
389
|
-
*/
|
|
390
|
-
var applyHydrateRowsProcessor = React.useCallback(function () {
|
|
391
|
-
apiRef.current.setState(function (state) {
|
|
392
|
-
var response = apiRef.current.unstable_applyPipeProcessors('hydrateRows', {
|
|
393
|
-
tree: gridRowTreeSelector(state, apiRef.current.instanceId),
|
|
394
|
-
treeDepths: gridRowTreeDepthsSelector(state, apiRef.current.instanceId),
|
|
395
|
-
dataRowIds: gridDataRowIdsSelector(state, apiRef.current.instanceId),
|
|
396
|
-
dataRowIdToModelLookup: gridRowsLookupSelector(state, apiRef.current.instanceId),
|
|
397
|
-
dataRowIdToIdLookup: gridRowsDataRowIdToIdLookupSelector(state, apiRef.current.instanceId)
|
|
398
|
-
});
|
|
399
|
-
return _extends({}, state, {
|
|
400
|
-
rows: _extends({}, state.rows, response, {
|
|
401
|
-
totalTopLevelRowCount: getTopLevelRowCount({
|
|
402
|
-
tree: response.tree,
|
|
403
|
-
rowCountProp: props.rowCount
|
|
404
|
-
})
|
|
405
|
-
})
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
apiRef.current.publishEvent('rowsSet');
|
|
409
|
-
apiRef.current.forceUpdate();
|
|
410
|
-
}, [apiRef, props.rowCount]);
|
|
411
|
-
useGridRegisterPipeApplier(apiRef, 'hydrateRows', applyHydrateRowsProcessor);
|
|
412
|
-
useGridApiMethod(apiRef, rowApi, 'public');
|
|
413
|
-
useGridApiMethod(apiRef, rowProApi, props.signature === GridSignature.DataGrid ? 'private' : 'public');
|
|
414
|
-
|
|
415
|
-
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useGridRows`
|
|
416
|
-
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
417
|
-
var isFirstRender = React.useRef(true);
|
|
418
|
-
React.useEffect(function () {
|
|
419
|
-
if (isFirstRender.current) {
|
|
420
|
-
isFirstRender.current = false;
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
var areNewRowsAlreadyInState = apiRef.current.caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
424
|
-
var isNewLoadingAlreadyInState = apiRef.current.caches.rows.loadingPropBeforePartialUpdates === props.loading;
|
|
425
|
-
var isNewRowCountAlreadyInState = apiRef.current.caches.rows.rowCountPropBeforePartialUpdates === props.rowCount;
|
|
426
|
-
|
|
427
|
-
// The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
428
|
-
if (areNewRowsAlreadyInState) {
|
|
429
|
-
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
430
|
-
if (!isNewLoadingAlreadyInState) {
|
|
431
|
-
apiRef.current.setState(function (state) {
|
|
432
|
-
return _extends({}, state, {
|
|
433
|
-
rows: _extends({}, state.rows, {
|
|
434
|
-
loading: props.loading
|
|
435
|
-
})
|
|
436
|
-
});
|
|
437
|
-
});
|
|
438
|
-
apiRef.current.caches.rows.loadingPropBeforePartialUpdates = props.loading;
|
|
439
|
-
apiRef.current.forceUpdate();
|
|
440
|
-
}
|
|
441
|
-
if (!isNewRowCountAlreadyInState) {
|
|
442
|
-
apiRef.current.setState(function (state) {
|
|
443
|
-
return _extends({}, state, {
|
|
444
|
-
rows: _extends({}, state.rows, {
|
|
445
|
-
totalRowCount: Math.max(props.rowCount || 0, state.rows.totalRowCount),
|
|
446
|
-
totalTopLevelRowCount: Math.max(props.rowCount || 0, state.rows.totalTopLevelRowCount)
|
|
447
|
-
})
|
|
448
|
-
});
|
|
449
|
-
});
|
|
450
|
-
apiRef.current.caches.rows.rowCountPropBeforePartialUpdates = props.rowCount;
|
|
451
|
-
apiRef.current.forceUpdate();
|
|
452
|
-
}
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
logger.debug("Updating all rows, new length ".concat(props.rows.length));
|
|
456
|
-
throttledRowsChange({
|
|
457
|
-
cache: createRowsInternalCache({
|
|
458
|
-
rows: props.rows,
|
|
459
|
-
getRowId: props.getRowId,
|
|
460
|
-
loading: props.loading,
|
|
461
|
-
rowCount: props.rowCount
|
|
462
|
-
}),
|
|
463
|
-
throttle: false
|
|
464
|
-
});
|
|
465
|
-
}, [props.rows, props.rowCount, props.getRowId, props.loading, logger, throttledRowsChange, apiRef]);
|
|
466
|
-
};
|