@mui/x-data-grid 5.10.0 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +325 -10
- package/DataGrid/DataGrid.js +61 -2
- package/DataGrid/useDataGridProps.js +2 -1
- package/README.md +4 -5
- package/colDef/gridActionsColDef.js +2 -1
- package/colDef/gridBooleanColDef.js +2 -1
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/colDef/gridDateColDef.js +4 -2
- package/colDef/gridNumericColDef.js +3 -2
- package/colDef/gridNumericOperators.d.ts +2 -0
- package/colDef/gridNumericOperators.js +11 -0
- package/colDef/gridSingleSelectColDef.js +3 -2
- package/colDef/gridSingleSelectOperators.d.ts +3 -0
- package/colDef/gridSingleSelectOperators.js +52 -0
- package/colDef/gridStringColDef.js +3 -2
- package/colDef/gridStringOperators.d.ts +2 -0
- package/colDef/gridStringOperators.js +12 -0
- package/components/GridFooter.d.ts +4 -2
- package/components/GridFooter.js +11 -2
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +55 -17
- package/components/GridRowCount.d.ts +4 -1
- package/components/GridRowCount.js +1 -0
- package/components/GridScrollArea.js +3 -4
- package/components/GridSelectedRowCount.d.ts +4 -1
- package/components/GridSelectedRowCount.js +2 -1
- package/components/base/GridBody.js +1 -2
- package/components/base/GridOverlays.js +2 -3
- package/components/cell/GridActionsCell.js +13 -4
- package/components/cell/GridActionsCellItem.d.ts +1 -1
- package/components/cell/GridCell.d.ts +2 -1
- package/components/cell/GridCell.js +17 -12
- package/components/cell/GridEditBooleanCell.d.ts +15 -3
- package/components/cell/GridEditBooleanCell.js +101 -6
- package/components/cell/GridEditDateCell.d.ts +16 -4
- package/components/cell/GridEditDateCell.js +99 -5
- package/components/cell/GridEditInputCell.d.ts +11 -5
- package/components/cell/GridEditInputCell.js +29 -5
- package/components/cell/GridEditSingleSelectCell.d.ts +12 -4
- package/components/cell/GridEditSingleSelectCell.js +28 -5
- package/components/cell/index.d.ts +2 -0
- package/components/cell/index.js +2 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +19 -19
- package/components/columnHeaders/GridColumnHeaders.d.ts +2 -0
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +2 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/components/columnSelection/GridHeaderCheckbox.js +4 -5
- package/components/containers/GridFooterContainer.d.ts +8 -2
- package/components/containers/GridFooterContainer.js +11 -2
- package/components/containers/GridRoot.js +25 -5
- package/components/containers/GridRootStyles.js +4 -2
- package/components/containers/GridToolbarContainer.d.ts +8 -2
- package/components/containers/GridToolbarContainer.js +12 -2
- package/components/menu/GridMenu.js +9 -2
- package/components/panel/GridColumnsPanel.js +10 -2
- package/components/panel/GridPanelContent.d.ts +8 -1
- package/components/panel/GridPanelContent.js +13 -2
- package/components/panel/GridPanelFooter.d.ts +8 -1
- package/components/panel/GridPanelFooter.js +13 -2
- package/components/panel/GridPanelHeader.d.ts +8 -1
- package/components/panel/GridPanelHeader.js +13 -2
- package/components/panel/GridPanelWrapper.d.ts +1 -1
- package/components/panel/GridPanelWrapper.js +3 -3
- package/components/panel/filterPanel/GridFilterForm.d.ts +61 -4
- package/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -5
- package/components/panel/filterPanel/GridFilterPanel.js +24 -6
- package/components/toolbar/GridToolbar.d.ts +12 -2
- package/components/toolbar/GridToolbar.js +30 -7
- package/components/toolbar/GridToolbarExport.d.ts +5 -4
- package/components/toolbar/GridToolbarExport.js +15 -20
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.d.ts +20 -0
- package/components/toolbar/GridToolbarQuickFilter.js +87 -0
- package/components/toolbar/index.d.ts +3 -1
- package/components/toolbar/index.js +3 -2
- package/components/virtualization/GridVirtualScroller.d.ts +4 -1
- package/components/virtualization/GridVirtualScrollerContent.d.ts +4 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +4 -1
- package/constants/defaultGridSlotsComponents.js +3 -2
- package/constants/gridClasses.d.ts +16 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +5 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +11 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -9
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +4 -4
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
- package/hooks/core/useGridApiInitialization.js +3 -3
- package/hooks/core/useGridErrorHandler.js +1 -2
- package/hooks/core/useGridStateInitialization.js +1 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -6
- package/hooks/features/columnMenu/useGridColumnMenu.js +3 -4
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -0
- package/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/hooks/features/columns/useGridColumns.js +20 -23
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +8 -9
- package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +140 -32
- package/hooks/features/editRows/useGridCellEditing.old.js +20 -21
- package/hooks/features/editRows/useGridEditing.old.js +4 -5
- package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +128 -42
- package/hooks/features/editRows/useGridRowEditing.old.js +21 -22
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +19 -18
- package/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/hooks/features/export/useGridCsvExport.js +23 -16
- package/hooks/features/export/useGridPrintExport.js +22 -0
- package/hooks/features/export/utils.d.ts +3 -1
- package/hooks/features/export/utils.js +13 -0
- package/hooks/features/filter/gridFilterState.d.ts +1 -2
- package/hooks/features/filter/gridFilterState.js +3 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +17 -1
- package/hooks/features/filter/gridFilterUtils.js +85 -4
- package/hooks/features/filter/useGridFilter.js +25 -13
- package/hooks/features/focus/useGridFocus.d.ts +1 -1
- package/hooks/features/focus/useGridFocus.js +29 -33
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -5
- package/hooks/features/pagination/useGridPage.js +3 -4
- package/hooks/features/pagination/useGridPageSize.js +2 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -0
- package/hooks/features/rows/gridRowsSelector.js +1 -0
- package/hooks/features/rows/gridRowsState.d.ts +16 -11
- package/hooks/features/rows/gridRowsUtils.d.ts +14 -1
- package/hooks/features/rows/gridRowsUtils.js +79 -1
- package/hooks/features/rows/useGridRows.js +130 -129
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +107 -43
- package/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/hooks/features/scroll/useGridScroll.js +6 -1
- package/hooks/features/selection/useGridSelection.d.ts +1 -1
- package/hooks/features/selection/useGridSelection.js +13 -10
- package/hooks/features/sorting/useGridSorting.js +8 -9
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +33 -14
- package/hooks/utils/useGridApiEventHandler.d.ts +4 -1
- package/hooks/utils/useGridApiEventHandler.js +22 -9
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/hooks/utils/useGridSelector.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/internals/index.d.ts +5 -1
- package/internals/index.js +5 -2
- package/legacy/DataGrid/DataGrid.js +61 -2
- package/legacy/DataGrid/useDataGridProps.js +2 -1
- package/legacy/colDef/gridActionsColDef.js +2 -1
- package/legacy/colDef/gridBooleanColDef.js +2 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/legacy/colDef/gridDateColDef.js +4 -2
- package/legacy/colDef/gridNumericColDef.js +3 -2
- package/legacy/colDef/gridNumericOperators.js +28 -18
- package/legacy/colDef/gridSingleSelectColDef.js +3 -2
- package/legacy/colDef/gridSingleSelectOperators.js +55 -6
- package/legacy/colDef/gridStringColDef.js +3 -2
- package/legacy/colDef/gridStringOperators.js +25 -14
- package/legacy/components/GridFooter.js +11 -2
- package/legacy/components/GridRow.js +60 -17
- package/legacy/components/GridRowCount.js +1 -0
- package/legacy/components/GridScrollArea.js +3 -4
- package/legacy/components/GridSelectedRowCount.js +2 -1
- package/legacy/components/base/GridBody.js +1 -2
- package/legacy/components/base/GridOverlays.js +2 -3
- package/legacy/components/cell/GridActionsCell.js +13 -4
- package/legacy/components/cell/GridCell.js +17 -12
- package/legacy/components/cell/GridEditBooleanCell.js +132 -11
- package/legacy/components/cell/GridEditDateCell.js +148 -42
- package/legacy/components/cell/GridEditInputCell.js +61 -12
- package/legacy/components/cell/GridEditSingleSelectCell.js +41 -13
- package/legacy/components/cell/index.js +2 -0
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +21 -19
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +4 -5
- package/legacy/components/containers/GridFooterContainer.js +11 -2
- package/legacy/components/containers/GridRoot.js +23 -5
- package/legacy/components/containers/GridRootStyles.js +3 -2
- package/legacy/components/containers/GridToolbarContainer.js +12 -2
- package/legacy/components/menu/GridMenu.js +9 -2
- package/legacy/components/panel/GridColumnsPanel.js +12 -2
- package/legacy/components/panel/GridPanelContent.js +13 -2
- package/legacy/components/panel/GridPanelFooter.js +13 -2
- package/legacy/components/panel/GridPanelHeader.js +13 -2
- package/legacy/components/panel/GridPanelWrapper.js +3 -3
- package/legacy/components/panel/filterPanel/GridFilterForm.js +89 -8
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +25 -6
- package/legacy/components/toolbar/GridToolbar.js +31 -6
- package/legacy/components/toolbar/GridToolbarExport.js +18 -19
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +102 -0
- package/legacy/components/toolbar/index.js +3 -2
- package/legacy/constants/defaultGridSlotsComponents.js +3 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +5 -0
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -10
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
- package/legacy/hooks/core/useGridApiInitialization.js +3 -3
- package/legacy/hooks/core/useGridErrorHandler.js +1 -2
- package/legacy/hooks/core/useGridStateInitialization.js +1 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -6
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +3 -4
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/legacy/hooks/features/columns/useGridColumns.js +20 -23
- package/legacy/hooks/features/dimensions/useGridDimensions.js +8 -9
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +220 -83
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +20 -21
- package/legacy/hooks/features/editRows/useGridEditing.old.js +4 -5
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +132 -42
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +20 -21
- package/legacy/hooks/features/events/useGridEvents.js +19 -18
- package/legacy/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/legacy/hooks/features/export/useGridCsvExport.js +24 -17
- package/legacy/hooks/features/export/useGridPrintExport.js +22 -0
- package/legacy/hooks/features/export/utils.js +14 -0
- package/legacy/hooks/features/filter/gridFilterState.js +3 -1
- package/legacy/hooks/features/filter/gridFilterUtils.js +97 -4
- package/legacy/hooks/features/filter/useGridFilter.js +25 -13
- package/legacy/hooks/features/focus/useGridFocus.js +31 -35
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -5
- package/legacy/hooks/features/pagination/useGridPage.js +3 -4
- package/legacy/hooks/features/pagination/useGridPageSize.js +2 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
- package/legacy/hooks/features/rows/gridRowsSelector.js +3 -0
- package/legacy/hooks/features/rows/gridRowsUtils.js +82 -1
- package/legacy/hooks/features/rows/useGridRows.js +140 -132
- package/legacy/hooks/features/rows/useGridRowsMeta.js +104 -41
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/legacy/hooks/features/scroll/useGridScroll.js +6 -1
- package/legacy/hooks/features/selection/useGridSelection.js +13 -10
- package/legacy/hooks/features/sorting/useGridSorting.js +8 -9
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +52 -29
- package/legacy/hooks/utils/useGridApiEventHandler.js +20 -9
- package/legacy/hooks/utils/useGridNativeEventListener.js +1 -2
- package/legacy/hooks/utils/useGridSelector.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +5 -2
- package/legacy/locales/arSD.js +5 -0
- package/legacy/locales/bgBG.js +5 -0
- package/legacy/locales/csCZ.js +5 -0
- package/legacy/locales/daDK.js +5 -0
- package/legacy/locales/deDE.js +10 -5
- package/legacy/locales/elGR.js +5 -0
- package/legacy/locales/esES.js +5 -0
- package/legacy/locales/faIR.js +5 -0
- package/legacy/locales/fiFI.js +5 -0
- package/legacy/locales/frFR.js +5 -0
- package/legacy/locales/heIL.js +10 -5
- package/legacy/locales/huHU.js +5 -0
- package/legacy/locales/itIT.js +5 -0
- package/legacy/locales/jaJP.js +5 -0
- package/legacy/locales/koKR.js +5 -0
- package/legacy/locales/nbNO.js +127 -0
- package/legacy/locales/nlNL.js +5 -0
- package/legacy/locales/plPL.js +5 -0
- package/legacy/locales/ptBR.js +5 -0
- package/legacy/locales/ruRU.js +5 -0
- package/legacy/locales/skSK.js +5 -0
- package/legacy/locales/trTR.js +8 -3
- package/legacy/locales/ukUA.js +5 -0
- package/legacy/locales/viVN.js +5 -0
- package/legacy/locales/zhCN.js +5 -0
- package/legacy/models/events/gridEvents.js +4 -0
- package/legacy/models/gridApiCaches.js +1 -0
- package/legacy/models/index.js +4 -3
- package/legacy/models/params/gridMenuParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/legacy/utils/createSelector.js +18 -2
- package/legacy/utils/exportAs.js +1 -1
- package/locales/arSD.js +5 -0
- package/locales/bgBG.js +5 -0
- package/locales/csCZ.js +5 -0
- package/locales/daDK.js +5 -0
- package/locales/deDE.js +10 -5
- package/locales/elGR.js +5 -0
- package/locales/esES.js +5 -0
- package/locales/faIR.js +5 -0
- package/locales/fiFI.js +5 -0
- package/locales/frFR.js +5 -0
- package/locales/heIL.js +10 -5
- package/locales/huHU.js +5 -0
- package/locales/itIT.js +5 -0
- package/locales/jaJP.js +5 -0
- package/locales/koKR.js +5 -0
- package/locales/nbNO.d.ts +2 -0
- package/locales/nbNO.js +115 -0
- package/locales/nlNL.js +5 -0
- package/locales/plPL.js +5 -0
- package/locales/ptBR.js +5 -0
- package/locales/ruRU.js +5 -0
- package/locales/skSK.js +5 -0
- package/locales/trTR.js +8 -3
- package/locales/ukUA.js +5 -0
- package/locales/viVN.js +5 -0
- package/locales/zhCN.js +5 -0
- package/models/api/gridCoreApi.d.ts +6 -0
- package/models/api/gridEditingApi.d.ts +23 -4
- package/models/api/gridFilterApi.d.ts +5 -0
- package/models/api/gridFocusApi.d.ts +1 -0
- package/models/api/gridLocaleTextApi.d.ts +4 -0
- package/models/api/gridRowApi.d.ts +28 -0
- package/models/api/gridRowsMetaApi.d.ts +24 -0
- package/models/api/index.d.ts +1 -1
- package/models/colDef/gridColDef.d.ts +16 -3
- package/models/events/gridEventLookup.d.ts +286 -4
- package/models/events/gridEvents.d.ts +5 -278
- package/models/events/gridEvents.js +4 -0
- package/models/gridApiCaches.d.ts +6 -0
- package/models/gridApiCaches.js +1 -0
- package/models/gridExport.d.ts +29 -2
- package/models/gridFilterModel.d.ts +11 -0
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +0 -2
- package/models/index.d.ts +1 -1
- package/models/index.js +4 -3
- package/models/params/gridMenuParams.d.ts +7 -0
- package/models/params/gridMenuParams.js +1 -0
- package/models/params/gridRowParams.d.ts +1 -1
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +79 -29
- package/modern/DataGrid/DataGrid.js +61 -2
- package/modern/DataGrid/useDataGridProps.js +2 -1
- package/modern/colDef/gridActionsColDef.js +2 -1
- package/modern/colDef/gridBooleanColDef.js +2 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/modern/colDef/gridDateColDef.js +4 -2
- package/modern/colDef/gridNumericColDef.js +3 -2
- package/modern/colDef/gridNumericOperators.js +11 -0
- package/modern/colDef/gridSingleSelectColDef.js +3 -2
- package/modern/colDef/gridSingleSelectOperators.js +52 -0
- package/modern/colDef/gridStringColDef.js +3 -2
- package/modern/colDef/gridStringOperators.js +12 -0
- package/modern/components/GridFooter.js +11 -2
- package/modern/components/GridRow.js +55 -17
- package/modern/components/GridRowCount.js +1 -0
- package/modern/components/GridScrollArea.js +3 -4
- package/modern/components/GridSelectedRowCount.js +2 -1
- package/modern/components/base/GridBody.js +1 -2
- package/modern/components/base/GridOverlays.js +2 -3
- package/modern/components/cell/GridActionsCell.js +14 -3
- package/modern/components/cell/GridCell.js +17 -12
- package/modern/components/cell/GridEditBooleanCell.js +101 -6
- package/modern/components/cell/GridEditDateCell.js +99 -5
- package/modern/components/cell/GridEditInputCell.js +29 -5
- package/modern/components/cell/GridEditSingleSelectCell.js +28 -5
- package/modern/components/cell/index.js +2 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +19 -19
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +4 -5
- package/modern/components/containers/GridFooterContainer.js +11 -2
- package/modern/components/containers/GridRoot.js +25 -3
- package/modern/components/containers/GridRootStyles.js +4 -2
- package/modern/components/containers/GridToolbarContainer.js +12 -2
- package/modern/components/menu/GridMenu.js +9 -2
- package/modern/components/panel/GridColumnsPanel.js +10 -2
- package/modern/components/panel/GridPanelContent.js +13 -2
- package/modern/components/panel/GridPanelFooter.js +13 -2
- package/modern/components/panel/GridPanelHeader.js +13 -2
- package/modern/components/panel/GridPanelWrapper.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/modern/components/panel/filterPanel/GridFilterPanel.js +24 -6
- package/modern/components/toolbar/GridToolbar.js +30 -7
- package/modern/components/toolbar/GridToolbarExport.js +15 -20
- package/modern/components/toolbar/GridToolbarQuickFilter.js +85 -0
- package/modern/components/toolbar/index.js +3 -2
- package/modern/constants/defaultGridSlotsComponents.js +3 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +5 -0
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -9
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -7
- package/modern/hooks/core/useGridApiInitialization.js +3 -3
- package/modern/hooks/core/useGridErrorHandler.js +1 -2
- package/modern/hooks/core/useGridStateInitialization.js +1 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -6
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +3 -4
- package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/modern/hooks/features/columns/useGridColumns.js +19 -22
- package/modern/hooks/features/dimensions/useGridDimensions.js +8 -9
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +138 -32
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +20 -21
- package/modern/hooks/features/editRows/useGridEditing.old.js +4 -5
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +126 -42
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +21 -22
- package/modern/hooks/features/events/useGridEvents.js +19 -18
- package/modern/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/modern/hooks/features/export/useGridCsvExport.js +21 -16
- package/modern/hooks/features/export/useGridPrintExport.js +20 -0
- package/modern/hooks/features/export/utils.js +13 -0
- package/modern/hooks/features/filter/gridFilterState.js +3 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +81 -4
- package/modern/hooks/features/filter/useGridFilter.js +25 -13
- package/modern/hooks/features/focus/useGridFocus.js +29 -33
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -5
- package/modern/hooks/features/pagination/useGridPage.js +3 -4
- package/modern/hooks/features/pagination/useGridPageSize.js +2 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -6
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +77 -1
- package/modern/hooks/features/rows/useGridRows.js +130 -129
- package/modern/hooks/features/rows/useGridRowsMeta.js +105 -37
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/modern/hooks/features/scroll/useGridScroll.js +6 -1
- package/modern/hooks/features/selection/useGridSelection.js +13 -10
- package/modern/hooks/features/sorting/useGridSorting.js +8 -9
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +33 -14
- package/modern/hooks/utils/useGridApiEventHandler.js +20 -9
- package/modern/hooks/utils/useGridNativeEventListener.js +1 -2
- package/modern/hooks/utils/useGridSelector.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +5 -2
- package/modern/locales/arSD.js +5 -0
- package/modern/locales/bgBG.js +5 -0
- package/modern/locales/csCZ.js +5 -0
- package/modern/locales/daDK.js +5 -0
- package/modern/locales/deDE.js +10 -5
- package/modern/locales/elGR.js +5 -0
- package/modern/locales/esES.js +5 -0
- package/modern/locales/faIR.js +5 -0
- package/modern/locales/fiFI.js +5 -0
- package/modern/locales/frFR.js +5 -0
- package/modern/locales/heIL.js +10 -5
- package/modern/locales/huHU.js +5 -0
- package/modern/locales/itIT.js +5 -0
- package/modern/locales/jaJP.js +5 -0
- package/modern/locales/koKR.js +5 -0
- package/modern/locales/nbNO.js +115 -0
- package/modern/locales/nlNL.js +5 -0
- package/modern/locales/plPL.js +5 -0
- package/modern/locales/ptBR.js +5 -0
- package/modern/locales/ruRU.js +5 -0
- package/modern/locales/skSK.js +5 -0
- package/modern/locales/trTR.js +8 -3
- package/modern/locales/ukUA.js +5 -0
- package/modern/locales/viVN.js +5 -0
- package/modern/locales/zhCN.js +5 -0
- package/modern/models/events/gridEvents.js +4 -0
- package/modern/models/gridApiCaches.js +1 -0
- package/modern/models/index.js +4 -3
- package/modern/models/params/gridMenuParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/modern/utils/createSelector.js +20 -2
- package/modern/utils/exportAs.js +1 -1
- package/node/DataGrid/DataGrid.js +61 -2
- package/node/DataGrid/useDataGridProps.js +2 -1
- package/node/colDef/gridActionsColDef.js +2 -1
- package/node/colDef/gridBooleanColDef.js +2 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/node/colDef/gridDateColDef.js +4 -2
- package/node/colDef/gridNumericColDef.js +2 -1
- package/node/colDef/gridNumericOperators.js +15 -1
- package/node/colDef/gridSingleSelectColDef.js +2 -1
- package/node/colDef/gridSingleSelectOperators.js +56 -1
- package/node/colDef/gridStringColDef.js +2 -1
- package/node/colDef/gridStringOperators.js +16 -1
- package/node/components/GridFooter.js +10 -1
- package/node/components/GridRow.js +57 -18
- package/node/components/GridRowCount.js +1 -0
- package/node/components/GridScrollArea.js +3 -5
- package/node/components/GridSelectedRowCount.js +2 -1
- package/node/components/base/GridBody.js +1 -3
- package/node/components/base/GridOverlays.js +2 -4
- package/node/components/cell/GridActionsCell.js +13 -4
- package/node/components/cell/GridCell.js +16 -11
- package/node/components/cell/GridEditBooleanCell.js +100 -5
- package/node/components/cell/GridEditDateCell.js +98 -4
- package/node/components/cell/GridEditInputCell.js +29 -5
- package/node/components/cell/GridEditSingleSelectCell.js +28 -6
- package/node/components/cell/index.js +26 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +19 -20
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -4
- package/node/components/columnSelection/GridHeaderCheckbox.js +4 -6
- package/node/components/containers/GridFooterContainer.js +10 -1
- package/node/components/containers/GridRoot.js +24 -3
- package/node/components/containers/GridRootStyles.js +4 -2
- package/node/components/containers/GridToolbarContainer.js +11 -1
- package/node/components/menu/GridMenu.js +10 -2
- package/node/components/panel/GridColumnsPanel.js +10 -2
- package/node/components/panel/GridPanelContent.js +11 -1
- package/node/components/panel/GridPanelFooter.js +11 -1
- package/node/components/panel/GridPanelHeader.js +11 -1
- package/node/components/panel/GridPanelWrapper.js +5 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +91 -9
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +26 -6
- package/node/components/toolbar/GridToolbar.js +32 -7
- package/node/components/toolbar/GridToolbarExport.js +14 -19
- package/node/components/toolbar/GridToolbarQuickFilter.js +109 -0
- package/node/components/toolbar/index.js +42 -11
- package/node/constants/defaultGridSlotsComponents.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +5 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +10 -8
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +6 -8
- package/node/hooks/core/useGridApiInitialization.js +3 -4
- package/node/hooks/core/useGridErrorHandler.js +1 -3
- package/node/hooks/core/useGridStateInitialization.js +1 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -7
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +3 -5
- package/node/hooks/features/columns/useGridColumnSpanning.js +1 -3
- package/node/hooks/features/columns/useGridColumns.js +20 -24
- package/node/hooks/features/dimensions/useGridDimensions.js +8 -10
- package/node/hooks/features/editRows/useGridCellEditing.new.js +140 -32
- package/node/hooks/features/editRows/useGridCellEditing.old.js +20 -22
- package/node/hooks/features/editRows/useGridEditing.old.js +4 -6
- package/node/hooks/features/editRows/useGridRowEditing.new.js +128 -43
- package/node/hooks/features/editRows/useGridRowEditing.old.js +21 -23
- package/node/hooks/features/events/useGridEvents.js +19 -19
- package/node/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/node/hooks/features/export/useGridCsvExport.js +26 -17
- package/node/hooks/features/export/useGridPrintExport.js +25 -0
- package/node/hooks/features/export/utils.js +19 -2
- package/node/hooks/features/filter/gridFilterState.js +3 -1
- package/node/hooks/features/filter/gridFilterUtils.js +93 -3
- package/node/hooks/features/filter/useGridFilter.js +25 -13
- package/node/hooks/features/focus/useGridFocus.js +29 -34
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +4 -6
- package/node/hooks/features/pagination/useGridPage.js +3 -5
- package/node/hooks/features/pagination/useGridPageSize.js +2 -4
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -8
- package/node/hooks/features/rows/gridRowsSelector.js +3 -1
- package/node/hooks/features/rows/gridRowsUtils.js +95 -1
- package/node/hooks/features/rows/useGridRows.js +132 -127
- package/node/hooks/features/rows/useGridRowsMeta.js +107 -43
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +2 -0
- package/node/hooks/features/scroll/useGridScroll.js +6 -1
- package/node/hooks/features/selection/useGridSelection.js +13 -11
- package/node/hooks/features/sorting/useGridSorting.js +8 -10
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +33 -15
- package/node/hooks/utils/useGridApiEventHandler.js +22 -10
- package/node/hooks/utils/useGridNativeEventListener.js +1 -3
- package/node/hooks/utils/useGridSelector.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +39 -3
- package/node/locales/arSD.js +5 -0
- package/node/locales/bgBG.js +5 -0
- package/node/locales/csCZ.js +5 -0
- package/node/locales/daDK.js +5 -0
- package/node/locales/deDE.js +10 -5
- package/node/locales/elGR.js +5 -0
- package/node/locales/esES.js +5 -0
- package/node/locales/faIR.js +5 -0
- package/node/locales/fiFI.js +5 -0
- package/node/locales/frFR.js +5 -0
- package/node/locales/heIL.js +10 -5
- package/node/locales/huHU.js +5 -0
- package/node/locales/itIT.js +5 -0
- package/node/locales/jaJP.js +5 -0
- package/node/locales/koKR.js +5 -0
- package/node/locales/nbNO.js +125 -0
- package/node/locales/nlNL.js +5 -0
- package/node/locales/plPL.js +5 -0
- package/node/locales/ptBR.js +5 -0
- package/node/locales/ruRU.js +5 -0
- package/node/locales/skSK.js +5 -0
- package/node/locales/trTR.js +8 -3
- package/node/locales/ukUA.js +5 -0
- package/node/locales/viVN.js +5 -0
- package/node/locales/zhCN.js +5 -0
- package/node/models/events/gridEvents.js +4 -0
- package/node/models/gridApiCaches.js +5 -0
- package/node/models/index.js +0 -13
- package/node/models/params/gridMenuParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/node/utils/createSelector.js +25 -4
- package/node/utils/exportAs.js +1 -1
- package/package.json +5 -4
- package/utils/createSelector.d.ts +2 -1
- package/utils/createSelector.js +20 -2
- package/utils/exportAs.d.ts +2 -2
- package/utils/exportAs.js +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GridFilterItem } from '../../../models/gridFilterItem';
|
|
2
1
|
import { GridFilterModel } from '../../../models/gridFilterModel';
|
|
3
2
|
import { GridRowId } from '../../../models/gridRows';
|
|
4
3
|
export declare const getDefaultGridFilterModel: () => GridFilterModel;
|
|
@@ -32,7 +31,7 @@ export interface GridFilterInitialState {
|
|
|
32
31
|
* @param {GridRowId} rowId The id of the row we want to filter.
|
|
33
32
|
* @param {(filterItem: GridFilterItem) => boolean} shouldApplyItem An optional callback to allow the filtering engine to only apply some items.
|
|
34
33
|
*/
|
|
35
|
-
export declare type GridAggregatedFilterItemApplier = (rowId: GridRowId, shouldApplyItem?: (
|
|
34
|
+
export declare type GridAggregatedFilterItemApplier = (rowId: GridRowId, shouldApplyItem?: (columnField: string) => boolean) => boolean;
|
|
36
35
|
export interface GridFilteringMethodParams {
|
|
37
36
|
isRowMatchingFilters: GridAggregatedFilterItemApplier | null;
|
|
38
37
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { GridLinkOperator } from '../../../models/gridFilterItem';
|
|
2
2
|
export const getDefaultGridFilterModel = () => ({
|
|
3
3
|
items: [],
|
|
4
|
-
linkOperator: GridLinkOperator.And
|
|
4
|
+
linkOperator: GridLinkOperator.And,
|
|
5
|
+
quickFilterValues: [],
|
|
6
|
+
quickFilterLogicOperator: GridLinkOperator.And
|
|
5
7
|
});
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridFilterModel } from '../../../models';
|
|
2
|
+
import { GridFilterItem, GridFilterModel } from '../../../models';
|
|
3
3
|
import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
4
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
5
5
|
import { GridAggregatedFilterItemApplier } from './gridFilterState';
|
|
6
|
+
/**
|
|
7
|
+
* Adds default values to the optional fields of a filter items.
|
|
8
|
+
* @param {GridFilterItem} item The raw filter item.
|
|
9
|
+
* @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
10
|
+
* @return {GridFilterItem} The clean filter item with an uniq ID and an always-defined operatorValue.
|
|
11
|
+
* TODO: Make the typing reflect the different between GridFilterInputItem and GridFilterItem.
|
|
12
|
+
*/
|
|
13
|
+
export declare const cleanFilterItem: (item: GridFilterItem, apiRef: React.MutableRefObject<GridApiCommunity>) => GridFilterItem;
|
|
6
14
|
export declare const sanitizeFilterModel: (model: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridApiCommunity>) => GridFilterModel;
|
|
7
15
|
export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridApiCommunity>) => (state: GridStateCommunity) => GridStateCommunity;
|
|
8
16
|
/**
|
|
@@ -11,4 +19,12 @@ export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, d
|
|
|
11
19
|
* @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
12
20
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
13
21
|
*/
|
|
22
|
+
export declare const buildAggregatedFilterItemsApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridApiCommunity>) => GridAggregatedFilterItemApplier | null;
|
|
23
|
+
/**
|
|
24
|
+
* Generates a method to easily check if a row is matching the current quick filter.
|
|
25
|
+
* @param {any[]} values The model with which we want to filter the rows.
|
|
26
|
+
* @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
27
|
+
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
28
|
+
*/
|
|
29
|
+
export declare const buildAggregatedQuickFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridApiCommunity>) => GridAggregatedFilterItemApplier | null;
|
|
14
30
|
export declare const buildAggregatedFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridApiCommunity>) => GridAggregatedFilterItemApplier | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { GridLinkOperator } from '../../../models';
|
|
3
3
|
import { buildWarning } from '../../../utils/warning';
|
|
4
|
+
import { gridColumnFieldsSelector } from '../columns';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -9,7 +10,7 @@ import { buildWarning } from '../../../utils/warning';
|
|
|
9
10
|
* @return {GridFilterItem} The clean filter item with an uniq ID and an always-defined operatorValue.
|
|
10
11
|
* TODO: Make the typing reflect the different between GridFilterInputItem and GridFilterItem.
|
|
11
12
|
*/
|
|
12
|
-
const cleanFilterItem = (item, apiRef) => {
|
|
13
|
+
export const cleanFilterItem = (item, apiRef) => {
|
|
13
14
|
const cleanItem = _extends({}, item);
|
|
14
15
|
|
|
15
16
|
if (cleanItem.id == null) {
|
|
@@ -24,7 +25,6 @@ const cleanFilterItem = (item, apiRef) => {
|
|
|
24
25
|
|
|
25
26
|
return cleanItem;
|
|
26
27
|
};
|
|
27
|
-
|
|
28
28
|
const filterModelDisableMultiColumnsFilteringWarning = buildWarning(['MUI: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
|
|
29
29
|
const filterModelMissingItemIdWarning = buildWarning("MUI: The 'id' field is required on `filterModel.items` when you use multiple filters.", 'error');
|
|
30
30
|
const filterModelMissingItemOperatorWarning = buildWarning(['MUI: One of your filtering item have no `operatorValue` provided.', 'This property will become required on `@mui/x-data-grid@6.X`.']);
|
|
@@ -76,7 +76,7 @@ export const mergeStateWithFilterModel = (filterModel, disableMultipleColumnsFil
|
|
|
76
76
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
77
77
|
*/
|
|
78
78
|
|
|
79
|
-
export const
|
|
79
|
+
export const buildAggregatedFilterItemsApplier = (filterModel, apiRef) => {
|
|
80
80
|
const {
|
|
81
81
|
items,
|
|
82
82
|
linkOperator = GridLinkOperator.And
|
|
@@ -144,7 +144,7 @@ export const buildAggregatedFilterApplier = (filterModel, apiRef) => {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
return (rowId, shouldApplyFilter) => {
|
|
147
|
-
const filteredAppliers = shouldApplyFilter ? appliers.filter(applier => shouldApplyFilter(applier.item)) : appliers; // Return `false` as soon as we have a failing filter
|
|
147
|
+
const filteredAppliers = shouldApplyFilter ? appliers.filter(applier => shouldApplyFilter(applier.item.columnField)) : appliers; // Return `false` as soon as we have a failing filter
|
|
148
148
|
|
|
149
149
|
if (linkOperator === GridLinkOperator.And) {
|
|
150
150
|
return filteredAppliers.every(applier => applier.fn(rowId));
|
|
@@ -153,4 +153,85 @@ export const buildAggregatedFilterApplier = (filterModel, apiRef) => {
|
|
|
153
153
|
|
|
154
154
|
return filteredAppliers.some(applier => applier.fn(rowId));
|
|
155
155
|
};
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Generates a method to easily check if a row is matching the current quick filter.
|
|
159
|
+
* @param {any[]} values The model with which we want to filter the rows.
|
|
160
|
+
* @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
161
|
+
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
165
|
+
const {
|
|
166
|
+
quickFilterValues = [],
|
|
167
|
+
quickFilterLogicOperator = GridLinkOperator.And
|
|
168
|
+
} = filterModel;
|
|
169
|
+
|
|
170
|
+
if (quickFilterValues.length === 0) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const columnsFields = gridColumnFieldsSelector(apiRef);
|
|
175
|
+
const appliersPerColumnField = {};
|
|
176
|
+
columnsFields.forEach(field => {
|
|
177
|
+
const column = apiRef.current.getColumn(field);
|
|
178
|
+
const getApplyQuickFilterFn = column == null ? void 0 : column.getApplyQuickFilterFn;
|
|
179
|
+
|
|
180
|
+
if (!getApplyQuickFilterFn) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
appliersPerColumnField[field] = quickFilterValues.map(value => getApplyQuickFilterFn(value, column, apiRef));
|
|
185
|
+
}); // If some value does not have an applier we ignore them
|
|
186
|
+
|
|
187
|
+
const sanitizedQuickFilterValues = quickFilterValues.filter((value, index) => Object.keys(appliersPerColumnField).some(field => appliersPerColumnField[field][index] != null));
|
|
188
|
+
return (rowId, shouldApplyFilter) => {
|
|
189
|
+
const usedCellParams = {};
|
|
190
|
+
Object.keys(appliersPerColumnField).forEach(columnField => {
|
|
191
|
+
if (!shouldApplyFilter || shouldApplyFilter(columnField)) {
|
|
192
|
+
usedCellParams[columnField] = apiRef.current.getCellParams(rowId, columnField);
|
|
193
|
+
}
|
|
194
|
+
}); // Return `false` as soon as we have a quick filter value that does not match any column
|
|
195
|
+
|
|
196
|
+
if (quickFilterLogicOperator === GridLinkOperator.And) {
|
|
197
|
+
return sanitizedQuickFilterValues.every((value, index) => Object.keys(appliersPerColumnField).some(field => {
|
|
198
|
+
var _appliersPerColumnFie, _appliersPerColumnFie2;
|
|
199
|
+
|
|
200
|
+
if (appliersPerColumnField[field][index] == null) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return (_appliersPerColumnFie = (_appliersPerColumnFie2 = appliersPerColumnField[field])[index]) == null ? void 0 : _appliersPerColumnFie.call(_appliersPerColumnFie2, usedCellParams[field]);
|
|
205
|
+
}));
|
|
206
|
+
} // Return `true` as soon as we have have a quick filter value that match any column
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
return sanitizedQuickFilterValues.some((value, index) => Object.keys(appliersPerColumnField).some(field => {
|
|
210
|
+
var _appliersPerColumnFie3, _appliersPerColumnFie4;
|
|
211
|
+
|
|
212
|
+
if (appliersPerColumnField[field][index] == null) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return (_appliersPerColumnFie3 = (_appliersPerColumnFie4 = appliersPerColumnField[field])[index]) == null ? void 0 : _appliersPerColumnFie3.call(_appliersPerColumnFie4, usedCellParams[field]);
|
|
217
|
+
}));
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
export const buildAggregatedFilterApplier = (filterModel, apiRef) => {
|
|
221
|
+
const isRowMatchingFilterItems = buildAggregatedFilterItemsApplier(filterModel, apiRef);
|
|
222
|
+
const isRowMatchingQuickFilter = buildAggregatedQuickFilterApplier(filterModel, apiRef);
|
|
223
|
+
|
|
224
|
+
if (isRowMatchingFilterItems == null && isRowMatchingQuickFilter == null) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (isRowMatchingFilterItems == null) {
|
|
229
|
+
return isRowMatchingQuickFilter;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (isRowMatchingQuickFilter == null) {
|
|
233
|
+
return isRowMatchingFilterItems;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return (rowId, shouldApplyFilter) => isRowMatchingFilterItems(rowId, shouldApplyFilter) && isRowMatchingQuickFilter(rowId, shouldApplyFilter);
|
|
156
237
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { GridEvents } from '../../../models/events';
|
|
4
3
|
import { GridFeatureModeConstant } from '../../../models/gridFeatureMode';
|
|
5
4
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
6
5
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
@@ -13,7 +12,8 @@ import { useFirstRender } from '../../utils/useFirstRender';
|
|
|
13
12
|
import { gridRowIdsSelector } from '../rows';
|
|
14
13
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
15
14
|
import { GRID_DEFAULT_STRATEGY, useGridRegisterStrategyProcessor } from '../../core/strategyProcessing';
|
|
16
|
-
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel } from './gridFilterUtils';
|
|
15
|
+
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem } from './gridFilterUtils';
|
|
16
|
+
import { isDeepEqual } from '../../../utils/utils';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
export const filterStateInitializer = (state, props, apiRef) => {
|
|
19
19
|
var _ref, _props$filterModel, _props$initialState, _props$initialState$f;
|
|
@@ -42,7 +42,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
42
42
|
propModel: props.filterModel,
|
|
43
43
|
propOnChange: props.onFilterModelChange,
|
|
44
44
|
stateSelector: gridFilterModelSelector,
|
|
45
|
-
changeEvent:
|
|
45
|
+
changeEvent: 'filterModelChange'
|
|
46
46
|
});
|
|
47
47
|
const updateFilteredRows = React.useCallback(() => {
|
|
48
48
|
apiRef.current.setState(state => {
|
|
@@ -55,7 +55,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
55
55
|
filter: _extends({}, state.filter, filteringResult)
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
-
apiRef.current.publishEvent(
|
|
58
|
+
apiRef.current.publishEvent('filteredRowsSet');
|
|
59
59
|
}, [props.filterMode, apiRef]);
|
|
60
60
|
/**
|
|
61
61
|
* API METHODS
|
|
@@ -104,13 +104,13 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
104
104
|
if (filterItemOnTarget) {
|
|
105
105
|
newFilterItems = filterItemsWithValue;
|
|
106
106
|
} else if (props.disableMultipleColumnsFiltering) {
|
|
107
|
-
newFilterItems = [{
|
|
107
|
+
newFilterItems = [cleanFilterItem({
|
|
108
108
|
columnField: targetColumnField
|
|
109
|
-
}];
|
|
109
|
+
}, apiRef)];
|
|
110
110
|
} else {
|
|
111
|
-
newFilterItems = [...filterItemsWithValue, {
|
|
111
|
+
newFilterItems = [...filterItemsWithValue, cleanFilterItem({
|
|
112
112
|
columnField: targetColumnField
|
|
113
|
-
}];
|
|
113
|
+
}, apiRef)];
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
apiRef.current.setFilterModel(_extends({}, filterModel, {
|
|
@@ -135,6 +135,17 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
135
135
|
linkOperator
|
|
136
136
|
}));
|
|
137
137
|
}, [apiRef]);
|
|
138
|
+
const setQuickFilterValues = React.useCallback(values => {
|
|
139
|
+
const filterModel = gridFilterModelSelector(apiRef);
|
|
140
|
+
|
|
141
|
+
if (isDeepEqual(filterModel.quickFilterValues, values)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
apiRef.current.setFilterModel(_extends({}, filterModel, {
|
|
146
|
+
quickFilterValues: [...values]
|
|
147
|
+
}));
|
|
148
|
+
}, [apiRef]);
|
|
138
149
|
const setFilterModel = React.useCallback(model => {
|
|
139
150
|
const currentModel = gridFilterModelSelector(apiRef);
|
|
140
151
|
|
|
@@ -156,7 +167,8 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
156
167
|
setFilterModel,
|
|
157
168
|
showFilterPanel,
|
|
158
169
|
hideFilterPanel,
|
|
159
|
-
getVisibleRowModels
|
|
170
|
+
getVisibleRowModels,
|
|
171
|
+
setQuickFilterValues
|
|
160
172
|
};
|
|
161
173
|
useGridApiMethod(apiRef, filterApi, 'GridFilterApi');
|
|
162
174
|
/**
|
|
@@ -251,10 +263,10 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
251
263
|
}, [apiRef]); // Do not call `apiRef.current.forceUpdate` to avoid re-render before updating the sorted rows.
|
|
252
264
|
// Otherwise, the state is not consistent during the render
|
|
253
265
|
|
|
254
|
-
useGridApiEventHandler(apiRef,
|
|
255
|
-
useGridApiEventHandler(apiRef,
|
|
256
|
-
useGridApiEventHandler(apiRef,
|
|
257
|
-
useGridApiEventHandler(apiRef,
|
|
266
|
+
useGridApiEventHandler(apiRef, 'rowsSet', updateFilteredRows);
|
|
267
|
+
useGridApiEventHandler(apiRef, 'rowExpansionChange', apiRef.current.unstable_applyFilters);
|
|
268
|
+
useGridApiEventHandler(apiRef, 'columnsChange', handleColumnsChange);
|
|
269
|
+
useGridApiEventHandler(apiRef, 'activeStrategyProcessorChange', handleStrategyProcessorChange);
|
|
258
270
|
/**
|
|
259
271
|
* 1ST RENDER
|
|
260
272
|
*/
|
|
@@ -8,4 +8,4 @@ export declare const focusStateInitializer: GridStateInitializer;
|
|
|
8
8
|
* @requires useGridRows (method)
|
|
9
9
|
* @requires useGridEditing (event)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridFocus: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, '
|
|
11
|
+
export declare const useGridFocus: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ownerDocument } from '@mui/material/utils';
|
|
4
|
-
import { GridEvents } from '../../../models/events';
|
|
5
4
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
5
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
7
6
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
@@ -30,14 +29,9 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
30
29
|
const logger = useGridLogger(apiRef, 'useGridFocus');
|
|
31
30
|
const lastClickedCell = React.useRef(null);
|
|
32
31
|
const setCellFocus = React.useCallback((id, field) => {
|
|
33
|
-
// The row might have been deleted
|
|
34
|
-
if (!apiRef.current.getRow(id)) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
32
|
const focusedCell = gridFocusCellSelector(apiRef);
|
|
39
33
|
|
|
40
|
-
if ((focusedCell == null ? void 0 : focusedCell.id) === id && focusedCell.field === field) {
|
|
34
|
+
if ((focusedCell == null ? void 0 : focusedCell.id) === id && (focusedCell == null ? void 0 : focusedCell.field) === field) {
|
|
41
35
|
return;
|
|
42
36
|
}
|
|
43
37
|
|
|
@@ -60,14 +54,19 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
60
54
|
}
|
|
61
55
|
});
|
|
62
56
|
});
|
|
63
|
-
apiRef.current.forceUpdate();
|
|
64
|
-
|
|
57
|
+
apiRef.current.forceUpdate(); // The row might have been deleted
|
|
58
|
+
|
|
59
|
+
if (!apiRef.current.getRow(id)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
apiRef.current.publishEvent('cellFocusIn', apiRef.current.getCellParams(id, field));
|
|
65
64
|
}, [apiRef, logger]);
|
|
66
65
|
const setColumnHeaderFocus = React.useCallback((field, event = {}) => {
|
|
67
66
|
const cell = gridFocusCellSelector(apiRef);
|
|
68
67
|
|
|
69
68
|
if (cell) {
|
|
70
|
-
apiRef.current.publishEvent(
|
|
69
|
+
apiRef.current.publishEvent('cellFocusOut', apiRef.current.getCellParams(cell.id, cell.field), event);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
apiRef.current.setState(state => {
|
|
@@ -196,7 +195,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
196
195
|
// Publishes an event to notify that the focus was lost
|
|
197
196
|
|
|
198
197
|
|
|
199
|
-
apiRef.current.publishEvent(
|
|
198
|
+
apiRef.current.publishEvent('cellFocusOut', apiRef.current.getCellParams(focusedCell.id, focusedCell.field), event);
|
|
200
199
|
|
|
201
200
|
if (cellParams) {
|
|
202
201
|
apiRef.current.setCellFocus(cellParams.id, cellParams.field);
|
|
@@ -221,27 +220,23 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
221
220
|
apiRef.current.setCellFocus(params.id, params.field);
|
|
222
221
|
}
|
|
223
222
|
}, [apiRef]);
|
|
223
|
+
const handleRowSet = React.useCallback(() => {
|
|
224
|
+
const cell = gridFocusCellSelector(apiRef); // If the focused cell is in a row which does not exist anymore, then remove the focus
|
|
225
|
+
|
|
226
|
+
if (cell && !apiRef.current.getRow(cell.id)) {
|
|
227
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
228
|
+
focus: {
|
|
229
|
+
cell: null,
|
|
230
|
+
columnHeader: null
|
|
231
|
+
}
|
|
232
|
+
}));
|
|
233
|
+
}
|
|
234
|
+
}, [apiRef]);
|
|
224
235
|
useGridApiMethod(apiRef, {
|
|
225
236
|
setCellFocus,
|
|
226
237
|
setColumnHeaderFocus,
|
|
227
238
|
unstable_moveFocusToRelativeCell: moveFocusToRelativeCell
|
|
228
239
|
}, 'GridFocusApi');
|
|
229
|
-
React.useEffect(() => {
|
|
230
|
-
const cell = gridFocusCellSelector(apiRef);
|
|
231
|
-
|
|
232
|
-
if (cell) {
|
|
233
|
-
const updatedRow = apiRef.current.getRow(cell.id);
|
|
234
|
-
|
|
235
|
-
if (!updatedRow) {
|
|
236
|
-
apiRef.current.setState(state => _extends({}, state, {
|
|
237
|
-
focus: {
|
|
238
|
-
cell: null,
|
|
239
|
-
columnHeader: null
|
|
240
|
-
}
|
|
241
|
-
}));
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, [apiRef, props.rows]);
|
|
245
240
|
React.useEffect(() => {
|
|
246
241
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
247
242
|
doc.addEventListener('click', handleDocumentClick);
|
|
@@ -249,10 +244,11 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
249
244
|
doc.removeEventListener('click', handleDocumentClick);
|
|
250
245
|
};
|
|
251
246
|
}, [apiRef, handleDocumentClick]);
|
|
252
|
-
useGridApiEventHandler(apiRef,
|
|
253
|
-
useGridApiEventHandler(apiRef,
|
|
254
|
-
useGridApiEventHandler(apiRef,
|
|
255
|
-
useGridApiEventHandler(apiRef,
|
|
256
|
-
useGridApiEventHandler(apiRef,
|
|
257
|
-
useGridApiEventHandler(apiRef,
|
|
247
|
+
useGridApiEventHandler(apiRef, 'columnHeaderBlur', handleBlur);
|
|
248
|
+
useGridApiEventHandler(apiRef, 'cellDoubleClick', handleCellDoubleClick);
|
|
249
|
+
useGridApiEventHandler(apiRef, 'cellMouseUp', handleCellMouseUp);
|
|
250
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
251
|
+
useGridApiEventHandler(apiRef, 'cellModeChange', handleCellModeChange);
|
|
252
|
+
useGridApiEventHandler(apiRef, 'columnHeaderFocus', handleColumnHeaderFocus);
|
|
253
|
+
useGridApiEventHandler(apiRef, 'rowsSet', handleRowSet);
|
|
258
254
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridEvents } from '../../../models/events';
|
|
3
2
|
import { gridVisibleColumnDefinitionsSelector } from '../columns/gridColumnsSelector';
|
|
4
3
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
5
4
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
@@ -316,10 +315,10 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
316
315
|
const cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
317
316
|
|
|
318
317
|
if (cellParams.cellMode !== GridCellModes.Edit && isNavigationKey(event.key)) {
|
|
319
|
-
apiRef.current.publishEvent(
|
|
318
|
+
apiRef.current.publishEvent('cellNavigationKeyDown', cellParams, event);
|
|
320
319
|
}
|
|
321
320
|
}, [apiRef]);
|
|
322
|
-
useGridApiEventHandler(apiRef,
|
|
323
|
-
useGridApiEventHandler(apiRef,
|
|
324
|
-
useGridApiEventHandler(apiRef,
|
|
321
|
+
useGridApiEventHandler(apiRef, 'cellNavigationKeyDown', handleCellNavigationKeyDown);
|
|
322
|
+
useGridApiEventHandler(apiRef, 'columnHeaderKeyDown', handleColumnHeaderKeyDown);
|
|
323
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
325
324
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridLogger, useGridSelector, useGridApiMethod, useGridApiEventHandler } from '../../utils';
|
|
4
|
-
import { GridEvents } from '../../../models/events';
|
|
5
4
|
import { gridVisibleTopLevelRowCountSelector } from '../filter';
|
|
6
5
|
import { gridPageSelector, gridPageSizeSelector } from './gridPaginationSelector';
|
|
7
6
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
@@ -45,7 +44,7 @@ export const useGridPage = (apiRef, props) => {
|
|
|
45
44
|
propModel: props.page,
|
|
46
45
|
propOnChange: props.onPageChange,
|
|
47
46
|
stateSelector: gridPageSelector,
|
|
48
|
-
changeEvent:
|
|
47
|
+
changeEvent: 'pageChange'
|
|
49
48
|
});
|
|
50
49
|
/**
|
|
51
50
|
* API METHODS
|
|
@@ -114,8 +113,8 @@ export const useGridPage = (apiRef, props) => {
|
|
|
114
113
|
rowIndex: gridPageSelector(apiRef) * gridPageSizeSelector(apiRef)
|
|
115
114
|
});
|
|
116
115
|
|
|
117
|
-
useGridApiEventHandler(apiRef,
|
|
118
|
-
useGridApiEventHandler(apiRef,
|
|
116
|
+
useGridApiEventHandler(apiRef, 'pageSizeChange', handlePageSizeChange);
|
|
117
|
+
useGridApiEventHandler(apiRef, 'pageChange', handlePageChange);
|
|
119
118
|
/**
|
|
120
119
|
* EFFECTS
|
|
121
120
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { GridEvents } from '../../../models/events';
|
|
4
3
|
import { useGridLogger, useGridApiMethod, useGridApiEventHandler, useGridSelector } from '../../utils';
|
|
5
4
|
import { gridPageSizeSelector } from './gridPaginationSelector';
|
|
6
5
|
import { gridDensityRowHeightSelector } from '../density';
|
|
@@ -27,7 +26,7 @@ export const useGridPageSize = (apiRef, props) => {
|
|
|
27
26
|
propModel: props.pageSize,
|
|
28
27
|
propOnChange: props.onPageSizeChange,
|
|
29
28
|
stateSelector: gridPageSizeSelector,
|
|
30
|
-
changeEvent:
|
|
29
|
+
changeEvent: 'pageSizeChange'
|
|
31
30
|
});
|
|
32
31
|
/**
|
|
33
32
|
* API METHODS
|
|
@@ -100,7 +99,7 @@ export const useGridPageSize = (apiRef, props) => {
|
|
|
100
99
|
const maximumPageSizeWithoutScrollBar = Math.floor(dimensions.viewportInnerSize.height / rowHeight);
|
|
101
100
|
apiRef.current.setPageSize(maximumPageSizeWithoutScrollBar);
|
|
102
101
|
}, [apiRef, props.autoPageSize, rowHeight]);
|
|
103
|
-
useGridApiEventHandler(apiRef,
|
|
102
|
+
useGridApiEventHandler(apiRef, 'viewportInnerSizeChange', handleUpdateAutoPageSize);
|
|
104
103
|
/**
|
|
105
104
|
* EFFECTS
|
|
106
105
|
*/
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { GridEvents } from '../../../models/events';
|
|
4
3
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
5
4
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
6
5
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
7
6
|
import { gridPreferencePanelStateSelector } from './gridPreferencePanelSelector';
|
|
8
|
-
import { useGridSelector } from '../../utils/useGridSelector';
|
|
9
7
|
export const preferencePanelStateInitializer = (state, props) => {
|
|
10
8
|
var _props$initialState$p, _props$initialState;
|
|
11
9
|
|
|
@@ -21,7 +19,6 @@ export const preferencePanelStateInitializer = (state, props) => {
|
|
|
21
19
|
|
|
22
20
|
export const useGridPreferencesPanel = apiRef => {
|
|
23
21
|
const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');
|
|
24
|
-
const preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
25
22
|
const hideTimeout = React.useRef();
|
|
26
23
|
const immediateTimeout = React.useRef();
|
|
27
24
|
/**
|
|
@@ -30,9 +27,10 @@ export const useGridPreferencesPanel = apiRef => {
|
|
|
30
27
|
|
|
31
28
|
const hidePreferences = React.useCallback(() => {
|
|
32
29
|
logger.debug('Hiding Preferences Panel');
|
|
30
|
+
const preferencePanelState = gridPreferencePanelStateSelector(apiRef.current.state);
|
|
33
31
|
|
|
34
32
|
if (preferencePanelState.openedPanelValue) {
|
|
35
|
-
apiRef.current.publishEvent(
|
|
33
|
+
apiRef.current.publishEvent('preferencePanelClose', {
|
|
36
34
|
openedPanelValue: preferencePanelState.openedPanelValue
|
|
37
35
|
});
|
|
38
36
|
}
|
|
@@ -43,7 +41,7 @@ export const useGridPreferencesPanel = apiRef => {
|
|
|
43
41
|
}
|
|
44
42
|
}));
|
|
45
43
|
apiRef.current.forceUpdate();
|
|
46
|
-
}, [apiRef, logger
|
|
44
|
+
}, [apiRef, logger]); // This is to prevent the preferences from closing when you open a select box or another panel,
|
|
47
45
|
// The issue is in MUI core V4 => Fixed in V5
|
|
48
46
|
|
|
49
47
|
const doNotHidePanel = React.useCallback(() => {
|
|
@@ -63,7 +61,7 @@ export const useGridPreferencesPanel = apiRef => {
|
|
|
63
61
|
openedPanelValue: newValue
|
|
64
62
|
})
|
|
65
63
|
}));
|
|
66
|
-
apiRef.current.publishEvent(
|
|
64
|
+
apiRef.current.publishEvent('preferencePanelOpen', {
|
|
67
65
|
openedPanelValue: newValue
|
|
68
66
|
});
|
|
69
67
|
apiRef.current.forceUpdate();
|
|
@@ -4,6 +4,7 @@ export declare const gridRowCountSelector: import("../../../utils/createSelector
|
|
|
4
4
|
export declare const gridRowsLoadingSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, boolean | undefined>;
|
|
5
5
|
export declare const gridTopLevelRowCountSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, number>;
|
|
6
6
|
export declare const gridRowsLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowsLookup<any>>;
|
|
7
|
+
export declare const gridRowsIdToIdLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, Record<string, import("../../..").GridRowId>>;
|
|
7
8
|
export declare const gridRowTreeSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig>;
|
|
8
9
|
export declare const gridRowGroupingNameSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, string>;
|
|
9
10
|
export declare const gridRowTreeDepthSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, number>;
|
|
@@ -4,6 +4,7 @@ export const gridRowCountSelector = createSelector(gridRowsStateSelector, rows =
|
|
|
4
4
|
export const gridRowsLoadingSelector = createSelector(gridRowsStateSelector, rows => rows.loading);
|
|
5
5
|
export const gridTopLevelRowCountSelector = createSelector(gridRowsStateSelector, rows => rows.totalTopLevelRowCount);
|
|
6
6
|
export const gridRowsLookupSelector = createSelector(gridRowsStateSelector, rows => rows.idRowsLookup);
|
|
7
|
+
export const gridRowsIdToIdLookupSelector = createSelector(gridRowsStateSelector, rows => rows.idToIdLookup);
|
|
7
8
|
export const gridRowTreeSelector = createSelector(gridRowsStateSelector, rows => rows.tree);
|
|
8
9
|
export const gridRowGroupingNameSelector = createSelector(gridRowsStateSelector, rows => rows.groupingName);
|
|
9
10
|
export const gridRowTreeDepthSelector = createSelector(gridRowsStateSelector, rows => rows.treeDepth);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { GridRowId, GridRowsLookup, GridRowTreeConfig } from '../../../models/gridRows';
|
|
2
|
+
import type { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
3
|
export interface GridRowTreeCreationParams {
|
|
4
4
|
ids: GridRowId[];
|
|
5
5
|
idRowsLookup: GridRowsLookup;
|
|
6
|
+
idToIdLookup: Record<string, GridRowId>;
|
|
6
7
|
previousTree: GridRowTreeConfig | null;
|
|
7
8
|
}
|
|
8
9
|
export interface GridRowTreeCreationValue {
|
|
@@ -15,20 +16,18 @@ export interface GridRowTreeCreationValue {
|
|
|
15
16
|
treeDepth: number;
|
|
16
17
|
ids: GridRowId[];
|
|
17
18
|
idRowsLookup: GridRowsLookup;
|
|
19
|
+
idToIdLookup: Record<string, GridRowId>;
|
|
18
20
|
}
|
|
19
|
-
export
|
|
20
|
-
export interface GridRowsInternalCacheState {
|
|
21
|
-
value: GridRowInternalCacheValue;
|
|
21
|
+
export interface GridRowsInternalCache extends Omit<GridRowTreeCreationParams, 'previousTree'> {
|
|
22
22
|
/**
|
|
23
23
|
* The rows as they were the last time all the rows have been updated at once
|
|
24
24
|
* It is used to avoid processing several time the same set of rows
|
|
25
25
|
*/
|
|
26
|
-
rowsBeforePartialUpdates:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
lastUpdateMs: number;
|
|
26
|
+
rowsBeforePartialUpdates: DataGridProcessedProps['rows'];
|
|
27
|
+
/**
|
|
28
|
+
* The value of the `loading` prop since the last time that the rows state was updated.
|
|
29
|
+
*/
|
|
30
|
+
loadingPropBeforePartialUpdates: DataGridProcessedProps['loading'];
|
|
32
31
|
}
|
|
33
32
|
export interface GridRowsState extends GridRowTreeCreationValue {
|
|
34
33
|
/**
|
|
@@ -45,4 +44,10 @@ export interface GridRowsState extends GridRowTreeCreationValue {
|
|
|
45
44
|
* It does not count the expanded children rows.
|
|
46
45
|
*/
|
|
47
46
|
totalTopLevelRowCount: number;
|
|
47
|
+
/**
|
|
48
|
+
* Tree returned by the `rowTreeCreation` strategy processor.
|
|
49
|
+
* It is used to re-apply the `hydrateRows` pipe processor without having to recreate the tree.
|
|
50
|
+
*/
|
|
51
|
+
groupingResponseBeforeRowHydration: GridRowTreeCreationValue;
|
|
48
52
|
}
|
|
53
|
+
export declare type GridHydrateRowsValue = GridRowTreeCreationValue;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridRowId, GridRowIdGetter, GridRowModel, GridRowTreeConfig } from '../../../models';
|
|
3
|
+
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
|
+
import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
5
|
+
import { GridRowsInternalCache, GridRowsState } from './gridRowsState';
|
|
2
6
|
/**
|
|
3
7
|
* A helper function to check if the id provided is valid.
|
|
4
8
|
* @param {GridRowId} id Id as [[GridRowId]].
|
|
@@ -6,3 +10,12 @@ import { GridRowId, GridRowModel } from '../../../models';
|
|
|
6
10
|
* @param {string} detailErrorMessage A custom error message to display for invalid IDs
|
|
7
11
|
*/
|
|
8
12
|
export declare function checkGridRowIdIsValid(id: GridRowId, row: GridRowModel | Partial<GridRowModel>, detailErrorMessage?: string): void;
|
|
13
|
+
export declare const getRowIdFromRowModel: (rowModel: GridRowModel, getRowId?: GridRowIdGetter<any> | undefined, detailErrorMessage?: string | undefined) => GridRowId;
|
|
14
|
+
export declare const createRowsInternalCache: ({ rows, getRowId, loading, }: Pick<DataGridProcessedProps, 'rows' | 'getRowId' | 'loading'>) => GridRowsInternalCache;
|
|
15
|
+
export declare const getRowsStateFromCache: ({ apiRef, previousTree, rowCountProp, loadingProp, }: {
|
|
16
|
+
apiRef: React.MutableRefObject<GridApiCommunity>;
|
|
17
|
+
previousTree: GridRowTreeConfig | null;
|
|
18
|
+
rowCountProp: number | undefined;
|
|
19
|
+
loadingProp: boolean | undefined;
|
|
20
|
+
}) => GridRowsState;
|
|
21
|
+
export declare const getTreeNodeDescendants: (tree: GridRowTreeConfig, parentId: GridRowId, skipAutoGeneratedRows: boolean) => GridRowId[];
|