@mui/x-data-grid 6.4.0 → 6.6.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 +134 -2
- package/DataGrid/DataGrid.js +10 -3
- package/DataGrid/useDataGridProps.js +5 -12
- package/README.md +2 -2
- package/colDef/gridNumericOperators.js +0 -6
- package/components/GridColumnHeaders.js +4 -9
- package/components/GridHeader.d.ts +2 -2
- package/components/base/GridBody.d.ts +1 -1
- package/components/base/GridFooterPlaceholder.d.ts +2 -2
- package/components/base/GridOverlays.d.ts +2 -2
- package/components/cell/GridActionsCell.d.ts +3 -3
- package/components/cell/GridActionsCell.js +3 -3
- package/components/cell/GridBooleanCell.d.ts +1 -1
- package/components/cell/GridEditBooleanCell.d.ts +2 -2
- package/components/cell/GridEditDateCell.d.ts +2 -2
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditInputCell.js +4 -1
- package/components/cell/GridEditSingleSelectCell.d.ts +3 -3
- package/components/cell/GridEditSingleSelectCell.js +5 -5
- package/components/cell/GridSkeletonCell.d.ts +1 -1
- package/components/columnHeaders/ColumnHeaderMenuIcon.d.ts +1 -1
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +2 -2
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +13 -4
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +2 -2
- package/components/columnHeaders/GridColumnHeaderSeparator.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderTitle.d.ts +1 -1
- package/components/containers/GridRoot.js +1 -3
- package/components/index.d.ts +0 -1
- package/components/index.js +1 -2
- package/components/menu/GridMenu.d.ts +1 -1
- package/components/menu/columnMenu/GridColumnHeaderMenu.d.ts +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.d.ts +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.d.ts +2 -2
- package/components/panel/GridColumnsPanel.d.ts +2 -2
- package/components/panel/GridPanelContent.d.ts +1 -1
- package/components/panel/GridPanelFooter.d.ts +1 -1
- package/components/panel/GridPanelHeader.d.ts +1 -1
- package/components/panel/GridPreferencesPanel.js +3 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +15 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +9 -2
- package/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +9 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +56 -32
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +11 -4
- package/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/components/panel/filterPanel/GridFilterPanel.d.ts +2 -1
- package/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/components/panel/filterPanel/index.d.ts +3 -1
- package/components/panel/filterPanel/index.js +2 -1
- package/components/toolbar/GridToolbarColumnsButton.js +11 -6
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExport.d.ts +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/components/toolbar/GridToolbarFilterButton.js +11 -4
- package/components/toolbar/GridToolbarQuickFilter.d.ts +2 -2
- package/constants/localeTextConstants.js +26 -0
- package/context/GridContextProvider.d.ts +1 -1
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +10 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +10 -3
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editing/useGridEditing.js +0 -3
- package/hooks/features/filter/gridFilterSelector.d.ts +2 -2
- package/hooks/features/filter/gridFilterSelector.js +2 -2
- package/hooks/features/filter/gridFilterState.d.ts +6 -6
- package/hooks/features/filter/gridFilterState.js +6 -0
- package/hooks/features/filter/useGridFilter.js +29 -9
- package/hooks/features/focus/gridFocusState.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/hooks/features/focus/useGridFocus.js +55 -9
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +4 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/hooks/features/headerFiltering/index.d.ts +1 -0
- package/hooks/features/headerFiltering/index.js +1 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +6 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +91 -0
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +2 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/hooks/features/preferencesPanel/gridPreferencePanelState.d.ts +2 -0
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/hooks/features/rows/useGridRows.js +16 -1
- package/hooks/features/rows/useGridRowsMeta.js +11 -12
- package/index.js +1 -1
- package/internals/index.d.ts +6 -1
- package/internals/index.js +4 -0
- package/internals/utils/index.d.ts +1 -0
- package/internals/utils/index.js +2 -1
- package/internals/utils/useProps.d.ts +8 -0
- package/internals/utils/useProps.js +33 -0
- package/legacy/DataGrid/DataGrid.js +10 -3
- package/legacy/DataGrid/useDataGridProps.js +8 -8
- package/legacy/colDef/gridNumericOperators.js +0 -6
- package/legacy/components/GridColumnHeaders.js +4 -9
- package/legacy/components/cell/GridActionsCell.js +3 -3
- package/legacy/components/cell/GridEditInputCell.js +4 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +5 -5
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/legacy/components/columnHeaders/GridColumnHeaderFilterIconButton.js +13 -4
- package/legacy/components/containers/GridRoot.js +1 -3
- package/legacy/components/index.js +1 -2
- package/legacy/components/panel/GridPreferencesPanel.js +3 -1
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +79 -35
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +26 -5
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +55 -31
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +28 -5
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/legacy/components/panel/filterPanel/index.js +2 -1
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +11 -5
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/legacy/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/legacy/components/toolbar/GridToolbarFilterButton.js +11 -4
- package/legacy/constants/localeTextConstants.js +26 -0
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +5 -5
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/legacy/hooks/features/editing/useGridEditing.js +0 -3
- package/legacy/hooks/features/filter/gridFilterSelector.js +4 -4
- package/legacy/hooks/features/filter/gridFilterState.js +6 -0
- package/legacy/hooks/features/filter/useGridFilter.js +29 -9
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +10 -0
- package/legacy/hooks/features/focus/useGridFocus.js +58 -9
- package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +11 -0
- package/legacy/hooks/features/headerFiltering/index.js +1 -0
- package/legacy/hooks/features/headerFiltering/useGridHeaderFiltering.js +93 -0
- package/legacy/hooks/features/index.js +2 -1
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/legacy/hooks/features/rows/useGridRows.js +16 -1
- package/legacy/hooks/features/rows/useGridRowsMeta.js +12 -20
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +4 -0
- package/legacy/internals/utils/index.js +2 -1
- package/legacy/internals/utils/useProps.js +33 -0
- package/legacy/locales/arSD.js +28 -0
- package/legacy/locales/beBY.js +28 -0
- package/legacy/locales/bgBG.js +28 -0
- package/legacy/locales/csCZ.js +36 -8
- package/legacy/locales/daDK.js +28 -0
- package/legacy/locales/deDE.js +28 -0
- package/legacy/locales/elGR.js +27 -0
- package/legacy/locales/esES.js +28 -0
- package/legacy/locales/faIR.js +28 -0
- package/legacy/locales/fiFI.js +28 -0
- package/legacy/locales/frFR.js +26 -0
- package/legacy/locales/heIL.js +30 -2
- package/legacy/locales/huHU.js +28 -0
- package/legacy/locales/itIT.js +28 -0
- package/legacy/locales/jaJP.js +28 -0
- package/legacy/locales/koKR.js +28 -0
- package/legacy/locales/nbNO.js +28 -0
- package/legacy/locales/nlNL.js +26 -0
- package/legacy/locales/plPL.js +28 -0
- package/legacy/locales/ptBR.js +28 -0
- package/legacy/locales/roRO.js +28 -0
- package/legacy/locales/ruRU.js +28 -0
- package/legacy/locales/skSK.js +28 -0
- package/legacy/locales/svSE.js +28 -0
- package/legacy/locales/trTR.js +28 -0
- package/legacy/locales/ukUA.js +28 -0
- package/legacy/locales/urPK.js +28 -0
- package/legacy/locales/viVN.js +27 -0
- package/legacy/locales/zhCN.js +28 -0
- package/legacy/locales/zhTW.js +28 -0
- package/legacy/material/index.js +2 -0
- package/legacy/models/api/gridHeaderFilteringApi.js +1 -0
- package/legacy/models/gridFilterItem.js +1 -1
- package/legacy/models/gridHeaderFilteringModel.js +1 -0
- package/legacy/models/index.js +0 -1
- package/locales/arSD.js +28 -0
- package/locales/beBY.js +28 -0
- package/locales/bgBG.js +28 -0
- package/locales/csCZ.js +36 -8
- package/locales/daDK.js +28 -0
- package/locales/deDE.js +28 -0
- package/locales/elGR.js +27 -0
- package/locales/esES.js +28 -0
- package/locales/faIR.js +28 -0
- package/locales/fiFI.js +28 -0
- package/locales/frFR.js +26 -0
- package/locales/heIL.js +30 -2
- package/locales/huHU.js +28 -0
- package/locales/itIT.js +28 -0
- package/locales/jaJP.js +28 -0
- package/locales/koKR.js +28 -0
- package/locales/nbNO.js +28 -0
- package/locales/nlNL.js +26 -0
- package/locales/plPL.js +28 -0
- package/locales/ptBR.js +28 -0
- package/locales/roRO.js +28 -0
- package/locales/ruRU.js +28 -0
- package/locales/skSK.js +28 -0
- package/locales/svSE.js +28 -0
- package/locales/trTR.js +28 -0
- package/locales/ukUA.js +28 -0
- package/locales/urPK.js +28 -0
- package/locales/viVN.js +27 -0
- package/locales/zhCN.js +28 -0
- package/locales/zhTW.js +28 -0
- package/material/components/MUISelectOption.d.ts +2 -2
- package/material/index.d.ts +3 -66
- package/material/index.js +2 -0
- package/models/api/gridApiCommon.d.ts +3 -2
- package/models/api/gridCoreApi.d.ts +4 -0
- package/models/api/gridFilterApi.d.ts +3 -1
- package/models/api/gridFocusApi.d.ts +6 -0
- package/models/api/gridHeaderFilteringApi.d.ts +30 -0
- package/models/api/gridHeaderFilteringApi.js +1 -0
- package/models/api/gridLocaleTextApi.d.ts +25 -0
- package/models/api/gridPreferencesPanelApi.d.ts +3 -1
- package/models/events/gridEventLookup.d.ts +27 -1
- package/models/gridFilterItem.d.ts +1 -1
- package/models/gridFilterItem.js +1 -1
- package/models/gridFilterOperator.d.ts +5 -1
- package/models/gridHeaderFilteringModel.d.ts +5 -0
- package/models/gridHeaderFilteringModel.js +1 -0
- package/models/gridSlotsComponent.d.ts +16 -4
- package/models/gridStateCommunity.d.ts +4 -0
- package/models/index.d.ts +1 -1
- package/models/index.js +0 -1
- package/models/props/DataGridProps.d.ts +5 -0
- package/modern/DataGrid/DataGrid.js +10 -3
- package/modern/DataGrid/useDataGridProps.js +5 -12
- package/modern/colDef/gridNumericOperators.js +0 -6
- package/modern/components/GridColumnHeaders.js +4 -9
- package/modern/components/cell/GridActionsCell.js +3 -3
- package/modern/components/cell/GridEditInputCell.js +4 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +5 -5
- package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +13 -4
- package/modern/components/containers/GridRoot.js +1 -3
- package/modern/components/index.js +1 -2
- package/modern/components/panel/GridPreferencesPanel.js +3 -1
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +80 -36
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +56 -32
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/modern/components/panel/filterPanel/index.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.js +11 -6
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/modern/components/toolbar/GridToolbarFilterButton.js +11 -4
- package/modern/constants/localeTextConstants.js +26 -0
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/modern/hooks/features/editing/useGridEditing.js +0 -3
- package/modern/hooks/features/filter/gridFilterSelector.js +2 -2
- package/modern/hooks/features/filter/gridFilterState.js +6 -0
- package/modern/hooks/features/filter/useGridFilter.js +29 -9
- package/modern/hooks/features/focus/gridFocusStateSelector.js +6 -0
- package/modern/hooks/features/focus/useGridFocus.js +55 -9
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +5 -0
- package/modern/hooks/features/headerFiltering/index.js +1 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +90 -0
- package/modern/hooks/features/index.js +2 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/modern/hooks/features/rows/useGridRows.js +16 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +11 -12
- package/modern/index.js +1 -1
- package/modern/internals/index.js +4 -0
- package/modern/internals/utils/index.js +2 -1
- package/modern/internals/utils/useProps.js +32 -0
- package/modern/locales/arSD.js +28 -0
- package/modern/locales/beBY.js +28 -0
- package/modern/locales/bgBG.js +28 -0
- package/modern/locales/csCZ.js +36 -8
- package/modern/locales/daDK.js +28 -0
- package/modern/locales/deDE.js +28 -0
- package/modern/locales/elGR.js +27 -0
- package/modern/locales/esES.js +28 -0
- package/modern/locales/faIR.js +28 -0
- package/modern/locales/fiFI.js +28 -0
- package/modern/locales/frFR.js +26 -0
- package/modern/locales/heIL.js +30 -2
- package/modern/locales/huHU.js +28 -0
- package/modern/locales/itIT.js +28 -0
- package/modern/locales/jaJP.js +28 -0
- package/modern/locales/koKR.js +28 -0
- package/modern/locales/nbNO.js +28 -0
- package/modern/locales/nlNL.js +26 -0
- package/modern/locales/plPL.js +28 -0
- package/modern/locales/ptBR.js +28 -0
- package/modern/locales/roRO.js +28 -0
- package/modern/locales/ruRU.js +28 -0
- package/modern/locales/skSK.js +28 -0
- package/modern/locales/svSE.js +28 -0
- package/modern/locales/trTR.js +28 -0
- package/modern/locales/ukUA.js +28 -0
- package/modern/locales/urPK.js +28 -0
- package/modern/locales/viVN.js +27 -0
- package/modern/locales/zhCN.js +28 -0
- package/modern/locales/zhTW.js +28 -0
- package/modern/material/index.js +2 -0
- package/modern/models/api/gridHeaderFilteringApi.js +1 -0
- package/modern/models/gridFilterItem.js +1 -1
- package/modern/models/gridHeaderFilteringModel.js +1 -0
- package/modern/models/index.js +0 -1
- package/node/DataGrid/DataGrid.js +10 -3
- package/node/DataGrid/useDataGridProps.js +4 -11
- package/node/colDef/gridNumericOperators.js +0 -6
- package/node/components/GridColumnHeaders.js +3 -8
- package/node/components/cell/GridActionsCell.js +3 -3
- package/node/components/cell/GridEditInputCell.js +4 -1
- package/node/components/cell/GridEditSingleSelectCell.js +5 -5
- package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +12 -3
- package/node/components/containers/GridRoot.js +1 -3
- package/node/components/index.js +0 -11
- package/node/components/panel/GridPreferencesPanel.js +3 -1
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +78 -35
- package/node/components/panel/filterPanel/GridFilterInputDate.js +27 -6
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +56 -32
- package/node/components/panel/filterPanel/GridFilterInputValue.js +29 -6
- package/node/components/panel/filterPanel/GridFilterPanel.js +2 -1
- package/node/components/panel/filterPanel/index.js +26 -8
- package/node/components/toolbar/GridToolbarColumnsButton.js +11 -6
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/node/components/toolbar/GridToolbarExportContainer.js +7 -7
- package/node/components/toolbar/GridToolbarFilterButton.js +10 -3
- package/node/constants/localeTextConstants.js +26 -0
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +2 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/node/hooks/features/editing/useGridEditing.js +0 -3
- package/node/hooks/features/filter/gridFilterSelector.js +2 -2
- package/node/hooks/features/filter/gridFilterState.js +6 -0
- package/node/hooks/features/filter/useGridFilter.js +30 -10
- package/node/hooks/features/focus/gridFocusStateSelector.js +9 -1
- package/node/hooks/features/focus/useGridFocus.js +55 -9
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +15 -0
- package/node/hooks/features/headerFiltering/index.js +16 -0
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +101 -0
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +113 -4
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +4 -2
- package/node/hooks/features/rows/useGridRows.js +16 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +11 -12
- package/node/index.js +1 -1
- package/node/internals/index.js +46 -0
- package/node/internals/utils/index.js +11 -0
- package/node/internals/utils/useProps.js +41 -0
- package/node/locales/arSD.js +28 -0
- package/node/locales/beBY.js +28 -0
- package/node/locales/bgBG.js +28 -0
- package/node/locales/csCZ.js +36 -8
- package/node/locales/daDK.js +28 -0
- package/node/locales/deDE.js +28 -0
- package/node/locales/elGR.js +27 -0
- package/node/locales/esES.js +28 -0
- package/node/locales/faIR.js +28 -0
- package/node/locales/fiFI.js +28 -0
- package/node/locales/frFR.js +26 -0
- package/node/locales/heIL.js +30 -2
- package/node/locales/huHU.js +28 -0
- package/node/locales/itIT.js +28 -0
- package/node/locales/jaJP.js +28 -0
- package/node/locales/koKR.js +28 -0
- package/node/locales/nbNO.js +28 -0
- package/node/locales/nlNL.js +26 -0
- package/node/locales/plPL.js +28 -0
- package/node/locales/ptBR.js +28 -0
- package/node/locales/roRO.js +28 -0
- package/node/locales/ruRU.js +28 -0
- package/node/locales/skSK.js +28 -0
- package/node/locales/svSE.js +28 -0
- package/node/locales/trTR.js +28 -0
- package/node/locales/ukUA.js +28 -0
- package/node/locales/urPK.js +28 -0
- package/node/locales/viVN.js +27 -0
- package/node/locales/zhCN.js +28 -0
- package/node/locales/zhTW.js +28 -0
- package/node/material/index.js +2 -0
- package/node/models/api/gridHeaderFilteringApi.js +5 -0
- package/node/models/gridFilterItem.js +1 -1
- package/node/models/gridHeaderFilteringModel.js +5 -0
- package/node/models/index.js +0 -11
- package/package.json +4 -4
- package/components/GridScrollArea.d.ts +0 -10
- package/components/GridScrollArea.js +0 -117
- package/legacy/components/GridScrollArea.js +0 -119
- package/legacy/lib/createDetectElementResize/index.js +0 -145
- package/lib/createDetectElementResize/index.d.ts +0 -18
- package/lib/createDetectElementResize/index.js +0 -145
- package/lib/createDetectElementResize/types.d.ts +0 -9
- package/modern/components/GridScrollArea.js +0 -117
- package/modern/lib/createDetectElementResize/index.js +0 -145
- package/node/components/GridScrollArea.js +0 -126
- package/node/lib/createDetectElementResize/index.js +0 -151
|
@@ -19,11 +19,21 @@ export const filterStateInitializer = (state, props, apiRef) => {
|
|
|
19
19
|
return _extends({}, state, {
|
|
20
20
|
filter: {
|
|
21
21
|
filterModel: sanitizeFilterModel(filterModel, props.disableMultipleColumnsFiltering, apiRef),
|
|
22
|
-
visibleRowsLookup: {},
|
|
23
22
|
filteredDescendantCountLookup: {}
|
|
24
|
-
}
|
|
23
|
+
},
|
|
24
|
+
visibleRowsLookup: {}
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
+
const getVisibleRowsLookup = params => {
|
|
28
|
+
// For flat tree, the `visibleRowsLookup` and the `filteredRowsLookup` are equals since no row is collapsed.
|
|
29
|
+
return params.filteredRowsLookup;
|
|
30
|
+
};
|
|
31
|
+
function getVisibleRowsLookupState(apiRef, state) {
|
|
32
|
+
return apiRef.current.applyStrategyProcessor('visibleRowsLookupCreation', {
|
|
33
|
+
tree: state.rows.tree,
|
|
34
|
+
filteredRowsLookup: state.filter.filteredRowsLookup
|
|
35
|
+
});
|
|
36
|
+
}
|
|
27
37
|
|
|
28
38
|
/**
|
|
29
39
|
* @requires useGridColumns (method, event)
|
|
@@ -47,9 +57,13 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
47
57
|
isRowMatchingFilters,
|
|
48
58
|
filterModel: filterModel ?? getDefaultGridFilterModel()
|
|
49
59
|
});
|
|
50
|
-
|
|
60
|
+
const newState = _extends({}, state, {
|
|
51
61
|
filter: _extends({}, state.filter, filteringResult)
|
|
52
62
|
});
|
|
63
|
+
const visibleRowsLookupState = getVisibleRowsLookupState(apiRef, newState);
|
|
64
|
+
return _extends({}, newState, {
|
|
65
|
+
visibleRowsLookup: visibleRowsLookupState
|
|
66
|
+
});
|
|
53
67
|
});
|
|
54
68
|
apiRef.current.publishEvent('filteredRowsSet');
|
|
55
69
|
}, [props.filterMode, apiRef]);
|
|
@@ -105,7 +119,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
105
119
|
items
|
|
106
120
|
}), 'deleteFilterItem');
|
|
107
121
|
}, [apiRef]);
|
|
108
|
-
const showFilterPanel = React.useCallback(targetColumnField => {
|
|
122
|
+
const showFilterPanel = React.useCallback((targetColumnField, panelId, labelId) => {
|
|
109
123
|
logger.debug('Displaying filter panel');
|
|
110
124
|
if (targetColumnField) {
|
|
111
125
|
const filterModel = gridFilterModelSelector(apiRef);
|
|
@@ -150,7 +164,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
150
164
|
items: newFilterItems
|
|
151
165
|
}));
|
|
152
166
|
}
|
|
153
|
-
apiRef.current.showPreferences(GridPreferencePanelsValue.filters);
|
|
167
|
+
apiRef.current.showPreferences(GridPreferencePanelsValue.filters, panelId, labelId);
|
|
154
168
|
}, [apiRef, logger, props.disableMultipleColumnsFiltering]);
|
|
155
169
|
const hideFilterPanel = React.useCallback(() => {
|
|
156
170
|
logger.debug('Hiding filter panel');
|
|
@@ -256,13 +270,10 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
256
270
|
}
|
|
257
271
|
return {
|
|
258
272
|
filteredRowsLookup,
|
|
259
|
-
// For flat tree, the `visibleRowsLookup` and the `filteredRowsLookup` are equals since no row is collapsed.
|
|
260
|
-
visibleRowsLookup: filteredRowsLookup,
|
|
261
273
|
filteredDescendantCountLookup: {}
|
|
262
274
|
};
|
|
263
275
|
}
|
|
264
276
|
return {
|
|
265
|
-
visibleRowsLookup: {},
|
|
266
277
|
filteredRowsLookup: {},
|
|
267
278
|
filteredDescendantCountLookup: {}
|
|
268
279
|
};
|
|
@@ -272,6 +283,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
272
283
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
273
284
|
useGridRegisterPipeProcessor(apiRef, 'preferencePanel', preferencePanelPreProcessing);
|
|
274
285
|
useGridRegisterStrategyProcessor(apiRef, GRID_DEFAULT_STRATEGY, 'filtering', flatFilteringMethod);
|
|
286
|
+
useGridRegisterStrategyProcessor(apiRef, GRID_DEFAULT_STRATEGY, 'visibleRowsLookupCreation', getVisibleRowsLookup);
|
|
275
287
|
|
|
276
288
|
/**
|
|
277
289
|
* EVENTS
|
|
@@ -292,13 +304,21 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
292
304
|
apiRef.current.unstable_applyFilters();
|
|
293
305
|
}
|
|
294
306
|
}, [apiRef]);
|
|
307
|
+
const updateVisibleRowsLookupState = React.useCallback(() => {
|
|
308
|
+
apiRef.current.setState(state => {
|
|
309
|
+
return _extends({}, state, {
|
|
310
|
+
visibleRowsLookup: getVisibleRowsLookupState(apiRef, state)
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
apiRef.current.forceUpdate();
|
|
314
|
+
}, [apiRef]);
|
|
295
315
|
|
|
296
316
|
// Do not call `apiRef.current.forceUpdate` to avoid re-render before updating the sorted rows.
|
|
297
317
|
// Otherwise, the state is not consistent during the render
|
|
298
318
|
useGridApiEventHandler(apiRef, 'rowsSet', updateFilteredRows);
|
|
299
|
-
useGridApiEventHandler(apiRef, 'rowExpansionChange', apiRef.current.unstable_applyFilters);
|
|
300
319
|
useGridApiEventHandler(apiRef, 'columnsChange', handleColumnsChange);
|
|
301
320
|
useGridApiEventHandler(apiRef, 'activeStrategyProcessorChange', handleStrategyProcessorChange);
|
|
321
|
+
useGridApiEventHandler(apiRef, 'rowExpansionChange', updateVisibleRowsLookupState);
|
|
302
322
|
|
|
303
323
|
/**
|
|
304
324
|
* 1ST RENDER
|
|
@@ -3,11 +3,17 @@ export const gridFocusStateSelector = state => state.focus;
|
|
|
3
3
|
export const gridFocusCellSelector = createSelector(gridFocusStateSelector, focusState => focusState.cell);
|
|
4
4
|
export const gridFocusColumnHeaderSelector = createSelector(gridFocusStateSelector, focusState => focusState.columnHeader);
|
|
5
5
|
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const unstable_gridFocusColumnHeaderFilterSelector = createSelector(gridFocusStateSelector, focusState => focusState.columnHeaderFilter);
|
|
8
|
+
|
|
6
9
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
10
|
export const unstable_gridFocusColumnGroupHeaderSelector = createSelector(gridFocusStateSelector, focusState => focusState.columnGroupHeader);
|
|
8
11
|
export const gridTabIndexStateSelector = state => state.tabIndex;
|
|
9
12
|
export const gridTabIndexCellSelector = createSelector(gridTabIndexStateSelector, state => state.cell);
|
|
10
13
|
export const gridTabIndexColumnHeaderSelector = createSelector(gridTabIndexStateSelector, state => state.columnHeader);
|
|
11
14
|
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
+
export const unstable_gridTabIndexColumnHeaderFilterSelector = createSelector(gridTabIndexStateSelector, state => state.columnHeaderFilter);
|
|
17
|
+
|
|
12
18
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
19
|
export const unstable_gridTabIndexColumnGroupHeaderSelector = createSelector(gridTabIndexStateSelector, state => state.columnGroupHeader);
|
|
@@ -9,15 +9,18 @@ import { gridFocusCellSelector, unstable_gridFocusColumnGroupHeaderSelector } fr
|
|
|
9
9
|
import { gridVisibleColumnDefinitionsSelector } from '../columns/gridColumnsSelector';
|
|
10
10
|
import { getVisibleRows } from '../../utils/useGridVisibleRows';
|
|
11
11
|
import { clamp } from '../../../utils/utils';
|
|
12
|
+
import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
|
|
12
13
|
export const focusStateInitializer = state => _extends({}, state, {
|
|
13
14
|
focus: {
|
|
14
15
|
cell: null,
|
|
15
16
|
columnHeader: null,
|
|
17
|
+
columnHeaderFilter: null,
|
|
16
18
|
columnGroupHeader: null
|
|
17
19
|
},
|
|
18
20
|
tabIndex: {
|
|
19
21
|
cell: null,
|
|
20
22
|
columnHeader: null,
|
|
23
|
+
columnHeaderFilter: null,
|
|
21
24
|
columnGroupHeader: null
|
|
22
25
|
}
|
|
23
26
|
});
|
|
@@ -52,6 +55,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
52
55
|
field
|
|
53
56
|
},
|
|
54
57
|
columnHeader: null,
|
|
58
|
+
columnHeaderFilter: null,
|
|
55
59
|
columnGroupHeader: null
|
|
56
60
|
},
|
|
57
61
|
focus: {
|
|
@@ -60,6 +64,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
60
64
|
field
|
|
61
65
|
},
|
|
62
66
|
columnHeader: null,
|
|
67
|
+
columnHeaderFilter: null,
|
|
63
68
|
columnGroupHeader: null
|
|
64
69
|
}
|
|
65
70
|
});
|
|
@@ -87,6 +92,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
87
92
|
columnHeader: {
|
|
88
93
|
field
|
|
89
94
|
},
|
|
95
|
+
columnHeaderFilter: null,
|
|
90
96
|
cell: null,
|
|
91
97
|
columnGroupHeader: null
|
|
92
98
|
},
|
|
@@ -94,6 +100,33 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
94
100
|
columnHeader: {
|
|
95
101
|
field
|
|
96
102
|
},
|
|
103
|
+
columnHeaderFilter: null,
|
|
104
|
+
cell: null,
|
|
105
|
+
columnGroupHeader: null
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
apiRef.current.forceUpdate();
|
|
110
|
+
}, [apiRef, logger, publishCellFocusOut]);
|
|
111
|
+
const setColumnHeaderFilterFocus = React.useCallback((field, event = {}) => {
|
|
112
|
+
const cell = gridFocusCellSelector(apiRef);
|
|
113
|
+
publishCellFocusOut(cell, event);
|
|
114
|
+
apiRef.current.setState(state => {
|
|
115
|
+
logger.debug(`Focusing on column header filter with colIndex=${field}`);
|
|
116
|
+
return _extends({}, state, {
|
|
117
|
+
tabIndex: {
|
|
118
|
+
columnHeader: null,
|
|
119
|
+
columnHeaderFilter: {
|
|
120
|
+
field
|
|
121
|
+
},
|
|
122
|
+
cell: null,
|
|
123
|
+
columnGroupHeader: null
|
|
124
|
+
},
|
|
125
|
+
focus: {
|
|
126
|
+
columnHeader: null,
|
|
127
|
+
columnHeaderFilter: {
|
|
128
|
+
field
|
|
129
|
+
},
|
|
97
130
|
cell: null,
|
|
98
131
|
columnGroupHeader: null
|
|
99
132
|
}
|
|
@@ -114,6 +147,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
114
147
|
depth
|
|
115
148
|
},
|
|
116
149
|
columnHeader: null,
|
|
150
|
+
columnHeaderFilter: null,
|
|
117
151
|
cell: null
|
|
118
152
|
},
|
|
119
153
|
focus: {
|
|
@@ -122,6 +156,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
122
156
|
depth
|
|
123
157
|
},
|
|
124
158
|
columnHeader: null,
|
|
159
|
+
columnHeaderFilter: null,
|
|
125
160
|
cell: null
|
|
126
161
|
}
|
|
127
162
|
});
|
|
@@ -131,8 +166,16 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
131
166
|
const getColumnGroupHeaderFocus = React.useCallback(() => unstable_gridFocusColumnGroupHeaderSelector(apiRef), [apiRef]);
|
|
132
167
|
const moveFocusToRelativeCell = React.useCallback((id, field, direction) => {
|
|
133
168
|
let columnIndexToFocus = apiRef.current.getColumnIndex(field);
|
|
134
|
-
let rowIndexToFocus = apiRef.current.getRowIndexRelativeToVisibleRows(id);
|
|
135
169
|
const visibleColumns = gridVisibleColumnDefinitionsSelector(apiRef);
|
|
170
|
+
const currentPage = getVisibleRows(apiRef, {
|
|
171
|
+
pagination: props.pagination,
|
|
172
|
+
paginationMode: props.paginationMode
|
|
173
|
+
});
|
|
174
|
+
const pinnedRows = gridPinnedRowsSelector(apiRef);
|
|
175
|
+
|
|
176
|
+
// Include pinned rows as well
|
|
177
|
+
const currentPageRows = [].concat(pinnedRows.top || [], currentPage.rows, pinnedRows.bottom || []);
|
|
178
|
+
let rowIndexToFocus = currentPageRows.findIndex(row => row.id === id);
|
|
136
179
|
if (direction === 'right') {
|
|
137
180
|
columnIndexToFocus += 1;
|
|
138
181
|
} else if (direction === 'left') {
|
|
@@ -140,14 +183,10 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
140
183
|
} else {
|
|
141
184
|
rowIndexToFocus += 1;
|
|
142
185
|
}
|
|
143
|
-
const currentPage = getVisibleRows(apiRef, {
|
|
144
|
-
pagination: props.pagination,
|
|
145
|
-
paginationMode: props.paginationMode
|
|
146
|
-
});
|
|
147
186
|
if (columnIndexToFocus >= visibleColumns.length) {
|
|
148
187
|
// Go to next row if we are after the last column
|
|
149
188
|
rowIndexToFocus += 1;
|
|
150
|
-
if (rowIndexToFocus <
|
|
189
|
+
if (rowIndexToFocus < currentPageRows.length) {
|
|
151
190
|
// Go to first column of the next row if there's one more row
|
|
152
191
|
columnIndexToFocus = 0;
|
|
153
192
|
}
|
|
@@ -159,8 +198,11 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
159
198
|
columnIndexToFocus = visibleColumns.length - 1;
|
|
160
199
|
}
|
|
161
200
|
}
|
|
162
|
-
rowIndexToFocus = clamp(rowIndexToFocus, 0,
|
|
163
|
-
const rowToFocus =
|
|
201
|
+
rowIndexToFocus = clamp(rowIndexToFocus, 0, currentPageRows.length - 1);
|
|
202
|
+
const rowToFocus = currentPageRows[rowIndexToFocus];
|
|
203
|
+
if (!rowToFocus) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
164
206
|
const colSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowToFocus.id, columnIndexToFocus);
|
|
165
207
|
if (colSpanInfo && colSpanInfo.spannedByColSpan) {
|
|
166
208
|
if (direction === 'left' || direction === 'below') {
|
|
@@ -214,6 +256,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
214
256
|
focus: {
|
|
215
257
|
cell: null,
|
|
216
258
|
columnHeader: null,
|
|
259
|
+
columnHeaderFilter: null,
|
|
217
260
|
columnGroupHeader: null
|
|
218
261
|
}
|
|
219
262
|
}));
|
|
@@ -252,6 +295,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
252
295
|
focus: {
|
|
253
296
|
cell: null,
|
|
254
297
|
columnHeader: null,
|
|
298
|
+
columnHeaderFilter: null,
|
|
255
299
|
columnGroupHeader: null
|
|
256
300
|
}
|
|
257
301
|
}));
|
|
@@ -280,6 +324,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
280
324
|
focus: {
|
|
281
325
|
cell: null,
|
|
282
326
|
columnHeader: null,
|
|
327
|
+
columnHeaderFilter: null,
|
|
283
328
|
columnGroupHeader: null
|
|
284
329
|
}
|
|
285
330
|
}));
|
|
@@ -287,7 +332,8 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
287
332
|
}, [apiRef]);
|
|
288
333
|
const focusApi = {
|
|
289
334
|
setCellFocus,
|
|
290
|
-
setColumnHeaderFocus
|
|
335
|
+
setColumnHeaderFocus,
|
|
336
|
+
setColumnHeaderFilterFocus
|
|
291
337
|
};
|
|
292
338
|
const focusPrivateApi = {
|
|
293
339
|
moveFocusToRelativeCell,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { createSelector } from '../../../utils/createSelector';
|
|
3
|
+
export const unstable_gridHeaderFilteringStateSelector = state => state.headerFiltering;
|
|
4
|
+
export const unstable_gridHeaderFilteringEditFieldSelector = createSelector(unstable_gridHeaderFilteringStateSelector, headerFilteringState => headerFilteringState.editing);
|
|
5
|
+
export const unstable_gridHeaderFilteringMenuSelector = createSelector(unstable_gridHeaderFilteringStateSelector, headerFilteringState => headerFilteringState.menuOpen);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridHeaderFilteringSelectors';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
4
|
+
import { useGridLogger } from '../../utils';
|
|
5
|
+
import { gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnFieldsSelector } from '../columns/gridColumnsSelector';
|
|
6
|
+
export const headerFilteringStateInitializer = state => _extends({}, state, {
|
|
7
|
+
headerFiltering: {
|
|
8
|
+
editing: null,
|
|
9
|
+
menuOpen: null
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
export const useGridHeaderFiltering = (apiRef, props) => {
|
|
13
|
+
const logger = useGridLogger(apiRef, 'useGridHeaderFiltering');
|
|
14
|
+
const setHeaderFilterState = React.useCallback(headerFilterState => {
|
|
15
|
+
apiRef.current.setState(state => {
|
|
16
|
+
// Safety check to avoid MIT users from using it
|
|
17
|
+
// This hook should ultimately be moved to the Pro package
|
|
18
|
+
if (props.signature === 'DataGrid') {
|
|
19
|
+
return state;
|
|
20
|
+
}
|
|
21
|
+
return _extends({}, state, {
|
|
22
|
+
headerFiltering: {
|
|
23
|
+
editing: headerFilterState.editing ?? null,
|
|
24
|
+
menuOpen: headerFilterState.menuOpen ?? null
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
apiRef.current.forceUpdate();
|
|
29
|
+
}, [apiRef, props.signature]);
|
|
30
|
+
const startHeaderFilterEditMode = React.useCallback(field => {
|
|
31
|
+
logger.debug(`Starting edit mode on header filter for field: ${field}`);
|
|
32
|
+
apiRef.current.setHeaderFilterState({
|
|
33
|
+
editing: field
|
|
34
|
+
});
|
|
35
|
+
}, [apiRef, logger]);
|
|
36
|
+
const stopHeaderFilterEditMode = React.useCallback(() => {
|
|
37
|
+
logger.debug(`Stopping edit mode on header filter`);
|
|
38
|
+
apiRef.current.setHeaderFilterState({
|
|
39
|
+
editing: null
|
|
40
|
+
});
|
|
41
|
+
}, [apiRef, logger]);
|
|
42
|
+
const showHeaderFilterMenu = React.useCallback(field => {
|
|
43
|
+
logger.debug(`Opening header filter menu for field: ${field}`);
|
|
44
|
+
apiRef.current.setHeaderFilterState({
|
|
45
|
+
menuOpen: field
|
|
46
|
+
});
|
|
47
|
+
}, [apiRef, logger]);
|
|
48
|
+
const hideHeaderFilterMenu = React.useCallback(() => {
|
|
49
|
+
logger.debug(`Hiding header filter menu for active field`);
|
|
50
|
+
let fieldToFocus = apiRef.current.state.headerFiltering.menuOpen;
|
|
51
|
+
if (fieldToFocus) {
|
|
52
|
+
const columnLookup = gridColumnLookupSelector(apiRef);
|
|
53
|
+
const columnVisibilityModel = gridColumnVisibilityModelSelector(apiRef);
|
|
54
|
+
const orderedFields = gridColumnFieldsSelector(apiRef);
|
|
55
|
+
|
|
56
|
+
// If the column was removed from the grid, we need to find the closest visible field
|
|
57
|
+
if (!columnLookup[fieldToFocus]) {
|
|
58
|
+
fieldToFocus = orderedFields[0];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// If the field to focus is hidden, we need to find the closest visible field
|
|
62
|
+
if (columnVisibilityModel[fieldToFocus] === false) {
|
|
63
|
+
// contains visible column fields + the field that was just hidden
|
|
64
|
+
const visibleOrderedFields = orderedFields.filter(field => {
|
|
65
|
+
if (field === fieldToFocus) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return columnVisibilityModel[field] !== false;
|
|
69
|
+
});
|
|
70
|
+
const fieldIndex = visibleOrderedFields.indexOf(fieldToFocus);
|
|
71
|
+
fieldToFocus = visibleOrderedFields[fieldIndex + 1] || visibleOrderedFields[fieldIndex - 1];
|
|
72
|
+
}
|
|
73
|
+
apiRef.current.setHeaderFilterState({
|
|
74
|
+
menuOpen: null
|
|
75
|
+
});
|
|
76
|
+
apiRef.current.setColumnHeaderFilterFocus(fieldToFocus);
|
|
77
|
+
}
|
|
78
|
+
}, [apiRef, logger]);
|
|
79
|
+
const headerFilterPrivateApi = {
|
|
80
|
+
setHeaderFilterState
|
|
81
|
+
};
|
|
82
|
+
const headerFilterApi = {
|
|
83
|
+
startHeaderFilterEditMode,
|
|
84
|
+
stopHeaderFilterEditMode,
|
|
85
|
+
showHeaderFilterMenu,
|
|
86
|
+
hideHeaderFilterMenu
|
|
87
|
+
};
|
|
88
|
+
useGridApiMethod(apiRef, headerFilterApi, 'public');
|
|
89
|
+
useGridApiMethod(apiRef, headerFilterPrivateApi, 'private');
|
|
90
|
+
};
|
|
@@ -14,6 +14,7 @@ import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
|
|
|
14
14
|
import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
|
|
15
15
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
|
|
16
16
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
17
|
+
import { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
|
|
17
18
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
18
19
|
function enrichPageRowsWithPinnedRows(apiRef, rows) {
|
|
19
20
|
const pinnedRows = gridPinnedRowsSelector(apiRef) || {};
|
|
@@ -68,6 +69,9 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
68
69
|
const initialCurrentPageRows = useGridVisibleRows(apiRef, props).rows;
|
|
69
70
|
const theme = useTheme();
|
|
70
71
|
const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
|
|
72
|
+
const headerFilteringEnabled =
|
|
73
|
+
// @ts-expect-error // TODO move relevant code to the `DataGridPro`
|
|
74
|
+
props.signature !== 'DataGrid' && props.unstable_headerFilters;
|
|
71
75
|
|
|
72
76
|
/**
|
|
73
77
|
* @param {number} colIndex Index of the column to focus
|
|
@@ -104,6 +108,14 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
104
108
|
const field = apiRef.current.getVisibleColumns()[colIndex].field;
|
|
105
109
|
apiRef.current.setColumnHeaderFocus(field, event);
|
|
106
110
|
}, [apiRef, logger]);
|
|
111
|
+
const goToHeaderFilter = React.useCallback((colIndex, event) => {
|
|
112
|
+
logger.debug(`Navigating to header filter col ${colIndex}`);
|
|
113
|
+
apiRef.current.scrollToIndexes({
|
|
114
|
+
colIndex
|
|
115
|
+
});
|
|
116
|
+
const field = apiRef.current.getVisibleColumns()[colIndex].field;
|
|
117
|
+
apiRef.current.setColumnHeaderFilterFocus(field, event);
|
|
118
|
+
}, [apiRef, logger]);
|
|
107
119
|
const goToGroupHeader = React.useCallback((colIndex, depth, event) => {
|
|
108
120
|
logger.debug(`Navigating to header col ${colIndex}`);
|
|
109
121
|
apiRef.current.scrollToIndexes({
|
|
@@ -115,7 +127,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
115
127
|
apiRef.current.setColumnGroupHeaderFocus(field, depth, event);
|
|
116
128
|
}, [apiRef, logger]);
|
|
117
129
|
const getRowIdFromIndex = React.useCallback(rowIndex => {
|
|
118
|
-
return currentPageRows[rowIndex].id;
|
|
130
|
+
return currentPageRows?.[rowIndex].id;
|
|
119
131
|
}, [currentPageRows]);
|
|
120
132
|
const handleColumnHeaderKeyDown = React.useCallback((params, event) => {
|
|
121
133
|
const headerTitleNode = event.currentTarget.querySelector(`.${gridClasses.columnHeaderTitleContainerContent}`);
|
|
@@ -141,7 +153,11 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
141
153
|
case 'ArrowDown':
|
|
142
154
|
{
|
|
143
155
|
if (firstRowIndexInPage !== null) {
|
|
144
|
-
|
|
156
|
+
if (headerFilteringEnabled) {
|
|
157
|
+
goToHeaderFilter(colIndexBefore, event);
|
|
158
|
+
} else {
|
|
159
|
+
goToCell(colIndexBefore, getRowIdFromIndex(firstRowIndexInPage));
|
|
160
|
+
}
|
|
145
161
|
}
|
|
146
162
|
break;
|
|
147
163
|
}
|
|
@@ -215,7 +231,97 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
215
231
|
if (shouldPreventDefault) {
|
|
216
232
|
event.preventDefault();
|
|
217
233
|
}
|
|
218
|
-
}, [apiRef, currentPageRows.length,
|
|
234
|
+
}, [apiRef, currentPageRows.length, headerFilteringEnabled, goToHeaderFilter, goToCell, getRowIdFromIndex, theme.direction, goToHeader, goToGroupHeader]);
|
|
235
|
+
const handleHeaderFilterKeyDown = React.useCallback((params, event) => {
|
|
236
|
+
const dimensions = apiRef.current.getRootDimensions();
|
|
237
|
+
if (!dimensions) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const isEditing = unstable_gridHeaderFilteringEditFieldSelector(apiRef) === params.field;
|
|
241
|
+
const isHeaderMenuOpen = unstable_gridHeaderFilteringMenuSelector(apiRef) === params.field;
|
|
242
|
+
if (isEditing || isHeaderMenuOpen || !isNavigationKey(event.key)) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const viewportPageSize = apiRef.current.getViewportPageSize();
|
|
246
|
+
const colIndexBefore = params.field ? apiRef.current.getColumnIndex(params.field) : 0;
|
|
247
|
+
const firstRowIndexInPage = 0;
|
|
248
|
+
const lastRowIndexInPage = currentPageRows.length - 1;
|
|
249
|
+
const firstColIndex = 0;
|
|
250
|
+
const lastColIndex = gridVisibleColumnDefinitionsSelector(apiRef).length - 1;
|
|
251
|
+
let shouldPreventDefault = true;
|
|
252
|
+
switch (event.key) {
|
|
253
|
+
case 'ArrowDown':
|
|
254
|
+
{
|
|
255
|
+
const rowId = getRowIdFromIndex(firstRowIndexInPage);
|
|
256
|
+
if (firstRowIndexInPage !== null && rowId != null) {
|
|
257
|
+
goToCell(colIndexBefore, rowId);
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
case 'ArrowRight':
|
|
262
|
+
{
|
|
263
|
+
const rightColIndex = getRightColumnIndex({
|
|
264
|
+
currentColIndex: colIndexBefore,
|
|
265
|
+
firstColIndex,
|
|
266
|
+
lastColIndex,
|
|
267
|
+
direction: theme.direction
|
|
268
|
+
});
|
|
269
|
+
if (rightColIndex !== null) {
|
|
270
|
+
goToHeaderFilter(rightColIndex, event);
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case 'ArrowLeft':
|
|
275
|
+
{
|
|
276
|
+
const leftColIndex = getLeftColumnIndex({
|
|
277
|
+
currentColIndex: colIndexBefore,
|
|
278
|
+
firstColIndex,
|
|
279
|
+
lastColIndex,
|
|
280
|
+
direction: theme.direction
|
|
281
|
+
});
|
|
282
|
+
if (leftColIndex !== null) {
|
|
283
|
+
goToHeaderFilter(leftColIndex, event);
|
|
284
|
+
} else {
|
|
285
|
+
apiRef.current.setColumnHeaderFilterFocus(params.field, event);
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
case 'ArrowUp':
|
|
290
|
+
{
|
|
291
|
+
goToHeader(colIndexBefore, event);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case 'PageDown':
|
|
295
|
+
{
|
|
296
|
+
if (firstRowIndexInPage !== null && lastRowIndexInPage !== null) {
|
|
297
|
+
goToCell(colIndexBefore, getRowIdFromIndex(Math.min(firstRowIndexInPage + viewportPageSize, lastRowIndexInPage)));
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case 'Home':
|
|
302
|
+
{
|
|
303
|
+
goToHeaderFilter(firstColIndex, event);
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
case 'End':
|
|
307
|
+
{
|
|
308
|
+
goToHeaderFilter(lastColIndex, event);
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case ' ':
|
|
312
|
+
{
|
|
313
|
+
// prevent Space event from scrolling
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
default:
|
|
317
|
+
{
|
|
318
|
+
shouldPreventDefault = false;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (shouldPreventDefault) {
|
|
322
|
+
event.preventDefault();
|
|
323
|
+
}
|
|
324
|
+
}, [apiRef, currentPageRows.length, goToHeaderFilter, theme.direction, goToHeader, goToCell, getRowIdFromIndex]);
|
|
219
325
|
const focusedColumnGroup = useGridSelector(apiRef, unstable_gridFocusColumnGroupHeaderSelector);
|
|
220
326
|
const handleColumnGroupHeaderKeyDown = React.useCallback((params, event) => {
|
|
221
327
|
const dimensions = apiRef.current.getRootDimensions();
|
|
@@ -350,6 +456,8 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
350
456
|
{
|
|
351
457
|
if (rowIndexBefore > firstRowIndexInPage) {
|
|
352
458
|
goToCell(colIndexBefore, getRowIdFromIndex(rowIndexBefore - 1));
|
|
459
|
+
} else if (headerFilteringEnabled) {
|
|
460
|
+
goToHeaderFilter(colIndexBefore, event);
|
|
353
461
|
} else {
|
|
354
462
|
goToHeader(colIndexBefore, event);
|
|
355
463
|
}
|
|
@@ -450,7 +558,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
450
558
|
if (shouldPreventDefault) {
|
|
451
559
|
event.preventDefault();
|
|
452
560
|
}
|
|
453
|
-
}, [apiRef, currentPageRows, theme.direction, getRowIdFromIndex,
|
|
561
|
+
}, [apiRef, currentPageRows, theme.direction, goToCell, getRowIdFromIndex, headerFilteringEnabled, goToHeaderFilter, goToHeader]);
|
|
454
562
|
const checkIfCanStartEditing = React.useCallback((initialValue, {
|
|
455
563
|
event
|
|
456
564
|
}) => {
|
|
@@ -462,6 +570,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
462
570
|
}, []);
|
|
463
571
|
useGridRegisterPipeProcessor(apiRef, 'canStartEditing', checkIfCanStartEditing);
|
|
464
572
|
useGridApiEventHandler(apiRef, 'columnHeaderKeyDown', handleColumnHeaderKeyDown);
|
|
573
|
+
useGridApiEventHandler(apiRef, 'headerFilterKeyDown', handleHeaderFilterKeyDown);
|
|
465
574
|
useGridApiEventHandler(apiRef, 'columnGroupHeaderKeyDown', handleColumnGroupHeaderKeyDown);
|
|
466
575
|
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
467
576
|
};
|
|
@@ -48,13 +48,15 @@ export const useGridPreferencesPanel = (apiRef, props) => {
|
|
|
48
48
|
const hidePreferencesDelayed = React.useCallback(() => {
|
|
49
49
|
hideTimeout.current = setTimeout(hidePreferences, 100);
|
|
50
50
|
}, [hidePreferences]);
|
|
51
|
-
const showPreferences = React.useCallback(newValue => {
|
|
51
|
+
const showPreferences = React.useCallback((newValue, panelId, labelId) => {
|
|
52
52
|
logger.debug('Opening Preferences Panel');
|
|
53
53
|
doNotHidePanel();
|
|
54
54
|
apiRef.current.setState(state => _extends({}, state, {
|
|
55
55
|
preferencePanel: _extends({}, state.preferencePanel, {
|
|
56
56
|
open: true,
|
|
57
|
-
openedPanelValue: newValue
|
|
57
|
+
openedPanelValue: newValue,
|
|
58
|
+
panelId,
|
|
59
|
+
labelId
|
|
58
60
|
})
|
|
59
61
|
}));
|
|
60
62
|
apiRef.current.publishEvent('preferencePanelOpen', {
|
|
@@ -115,8 +115,23 @@ export const useGridRows = (apiRef, props) => {
|
|
|
115
115
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
116
116
|
throw new Error(["MUI: You can't 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'));
|
|
117
117
|
}
|
|
118
|
+
const nonPinnedRowsUpdates = [];
|
|
119
|
+
updates.forEach(update => {
|
|
120
|
+
const id = getRowIdFromRowModel(update, props.getRowId, 'A row was provided without id when calling updateRows():');
|
|
121
|
+
const rowNode = apiRef.current.getRowNode(id);
|
|
122
|
+
if (rowNode?.type === 'pinnedRow') {
|
|
123
|
+
// @ts-ignore because otherwise `release:build` doesn't work
|
|
124
|
+
const pinnedRowsCache = apiRef.current.caches.pinnedRows;
|
|
125
|
+
const prevModel = pinnedRowsCache.idLookup[id];
|
|
126
|
+
if (prevModel) {
|
|
127
|
+
pinnedRowsCache.idLookup[id] = _extends({}, prevModel, update);
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
nonPinnedRowsUpdates.push(update);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
118
133
|
const cache = updateCacheWithNewRows({
|
|
119
|
-
updates,
|
|
134
|
+
updates: nonPinnedRowsUpdates,
|
|
120
135
|
getRowId: props.getRowId,
|
|
121
136
|
previousCache: apiRef.current.caches.rows
|
|
122
137
|
});
|
|
@@ -104,17 +104,14 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
104
104
|
} else {
|
|
105
105
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
106
106
|
}
|
|
107
|
-
const
|
|
107
|
+
const initialHeights = {};
|
|
108
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
109
|
+
for (const key in sizes) {
|
|
108
110
|
if (/^base[A-Z]/.test(key)) {
|
|
109
|
-
|
|
111
|
+
initialHeights[key] = sizes[key];
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// We use an object to make simple to check if a height is already added or not
|
|
115
|
-
const initialHeights = _extends({}, existingBaseSizes, {
|
|
116
|
-
baseCenter: baseRowHeight
|
|
117
|
-
});
|
|
113
|
+
}
|
|
114
|
+
initialHeights.baseCenter = baseRowHeight;
|
|
118
115
|
if (getRowSpacing) {
|
|
119
116
|
const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
120
117
|
const spacing = getRowSpacing(_extends({}, row, {
|
|
@@ -135,13 +132,15 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
135
132
|
let maximumBaseSize = 0;
|
|
136
133
|
let otherSizes = 0;
|
|
137
134
|
const processedSizes = calculateRowProcessedSizes(row);
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
/* eslint-disable-next-line no-restricted-syntax, guard-for-in */
|
|
136
|
+
for (const key in processedSizes) {
|
|
137
|
+
const value = processedSizes[key];
|
|
138
|
+
if (/^base[A-Z]/.test(key)) {
|
|
140
139
|
maximumBaseSize = value > maximumBaseSize ? value : maximumBaseSize;
|
|
141
140
|
} else {
|
|
142
141
|
otherSizes += value;
|
|
143
142
|
}
|
|
144
|
-
}
|
|
143
|
+
}
|
|
145
144
|
return acc + maximumBaseSize + otherSizes;
|
|
146
145
|
}, 0);
|
|
147
146
|
pinnedRows?.top?.forEach(row => {
|
package/modern/index.js
CHANGED