@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
|
@@ -9,16 +9,19 @@ 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 var focusStateInitializer = function focusStateInitializer(state) {
|
|
13
14
|
return _extends({}, state, {
|
|
14
15
|
focus: {
|
|
15
16
|
cell: null,
|
|
16
17
|
columnHeader: null,
|
|
18
|
+
columnHeaderFilter: null,
|
|
17
19
|
columnGroupHeader: null
|
|
18
20
|
},
|
|
19
21
|
tabIndex: {
|
|
20
22
|
cell: null,
|
|
21
23
|
columnHeader: null,
|
|
24
|
+
columnHeaderFilter: null,
|
|
22
25
|
columnGroupHeader: null
|
|
23
26
|
}
|
|
24
27
|
});
|
|
@@ -54,6 +57,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
54
57
|
field: field
|
|
55
58
|
},
|
|
56
59
|
columnHeader: null,
|
|
60
|
+
columnHeaderFilter: null,
|
|
57
61
|
columnGroupHeader: null
|
|
58
62
|
},
|
|
59
63
|
focus: {
|
|
@@ -62,6 +66,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
62
66
|
field: field
|
|
63
67
|
},
|
|
64
68
|
columnHeader: null,
|
|
69
|
+
columnHeaderFilter: null,
|
|
65
70
|
columnGroupHeader: null
|
|
66
71
|
}
|
|
67
72
|
});
|
|
@@ -90,6 +95,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
90
95
|
columnHeader: {
|
|
91
96
|
field: field
|
|
92
97
|
},
|
|
98
|
+
columnHeaderFilter: null,
|
|
93
99
|
cell: null,
|
|
94
100
|
columnGroupHeader: null
|
|
95
101
|
},
|
|
@@ -97,6 +103,34 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
97
103
|
columnHeader: {
|
|
98
104
|
field: field
|
|
99
105
|
},
|
|
106
|
+
columnHeaderFilter: null,
|
|
107
|
+
cell: null,
|
|
108
|
+
columnGroupHeader: null
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
apiRef.current.forceUpdate();
|
|
113
|
+
}, [apiRef, logger, publishCellFocusOut]);
|
|
114
|
+
var setColumnHeaderFilterFocus = React.useCallback(function (field) {
|
|
115
|
+
var event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
116
|
+
var cell = gridFocusCellSelector(apiRef);
|
|
117
|
+
publishCellFocusOut(cell, event);
|
|
118
|
+
apiRef.current.setState(function (state) {
|
|
119
|
+
logger.debug("Focusing on column header filter with colIndex=".concat(field));
|
|
120
|
+
return _extends({}, state, {
|
|
121
|
+
tabIndex: {
|
|
122
|
+
columnHeader: null,
|
|
123
|
+
columnHeaderFilter: {
|
|
124
|
+
field: field
|
|
125
|
+
},
|
|
126
|
+
cell: null,
|
|
127
|
+
columnGroupHeader: null
|
|
128
|
+
},
|
|
129
|
+
focus: {
|
|
130
|
+
columnHeader: null,
|
|
131
|
+
columnHeaderFilter: {
|
|
132
|
+
field: field
|
|
133
|
+
},
|
|
100
134
|
cell: null,
|
|
101
135
|
columnGroupHeader: null
|
|
102
136
|
}
|
|
@@ -118,6 +152,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
118
152
|
depth: depth
|
|
119
153
|
},
|
|
120
154
|
columnHeader: null,
|
|
155
|
+
columnHeaderFilter: null,
|
|
121
156
|
cell: null
|
|
122
157
|
},
|
|
123
158
|
focus: {
|
|
@@ -126,6 +161,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
126
161
|
depth: depth
|
|
127
162
|
},
|
|
128
163
|
columnHeader: null,
|
|
164
|
+
columnHeaderFilter: null,
|
|
129
165
|
cell: null
|
|
130
166
|
}
|
|
131
167
|
});
|
|
@@ -137,8 +173,18 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
137
173
|
}, [apiRef]);
|
|
138
174
|
var moveFocusToRelativeCell = React.useCallback(function (id, field, direction) {
|
|
139
175
|
var columnIndexToFocus = apiRef.current.getColumnIndex(field);
|
|
140
|
-
var rowIndexToFocus = apiRef.current.getRowIndexRelativeToVisibleRows(id);
|
|
141
176
|
var visibleColumns = gridVisibleColumnDefinitionsSelector(apiRef);
|
|
177
|
+
var currentPage = getVisibleRows(apiRef, {
|
|
178
|
+
pagination: props.pagination,
|
|
179
|
+
paginationMode: props.paginationMode
|
|
180
|
+
});
|
|
181
|
+
var pinnedRows = gridPinnedRowsSelector(apiRef);
|
|
182
|
+
|
|
183
|
+
// Include pinned rows as well
|
|
184
|
+
var currentPageRows = [].concat(pinnedRows.top || [], currentPage.rows, pinnedRows.bottom || []);
|
|
185
|
+
var rowIndexToFocus = currentPageRows.findIndex(function (row) {
|
|
186
|
+
return row.id === id;
|
|
187
|
+
});
|
|
142
188
|
if (direction === 'right') {
|
|
143
189
|
columnIndexToFocus += 1;
|
|
144
190
|
} else if (direction === 'left') {
|
|
@@ -146,14 +192,10 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
146
192
|
} else {
|
|
147
193
|
rowIndexToFocus += 1;
|
|
148
194
|
}
|
|
149
|
-
var currentPage = getVisibleRows(apiRef, {
|
|
150
|
-
pagination: props.pagination,
|
|
151
|
-
paginationMode: props.paginationMode
|
|
152
|
-
});
|
|
153
195
|
if (columnIndexToFocus >= visibleColumns.length) {
|
|
154
196
|
// Go to next row if we are after the last column
|
|
155
197
|
rowIndexToFocus += 1;
|
|
156
|
-
if (rowIndexToFocus <
|
|
198
|
+
if (rowIndexToFocus < currentPageRows.length) {
|
|
157
199
|
// Go to first column of the next row if there's one more row
|
|
158
200
|
columnIndexToFocus = 0;
|
|
159
201
|
}
|
|
@@ -165,8 +207,11 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
165
207
|
columnIndexToFocus = visibleColumns.length - 1;
|
|
166
208
|
}
|
|
167
209
|
}
|
|
168
|
-
rowIndexToFocus = clamp(rowIndexToFocus, 0,
|
|
169
|
-
var rowToFocus =
|
|
210
|
+
rowIndexToFocus = clamp(rowIndexToFocus, 0, currentPageRows.length - 1);
|
|
211
|
+
var rowToFocus = currentPageRows[rowIndexToFocus];
|
|
212
|
+
if (!rowToFocus) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
170
215
|
var colSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowToFocus.id, columnIndexToFocus);
|
|
171
216
|
if (colSpanInfo && colSpanInfo.spannedByColSpan) {
|
|
172
217
|
if (direction === 'left' || direction === 'below') {
|
|
@@ -218,6 +263,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
218
263
|
focus: {
|
|
219
264
|
cell: null,
|
|
220
265
|
columnHeader: null,
|
|
266
|
+
columnHeaderFilter: null,
|
|
221
267
|
columnGroupHeader: null
|
|
222
268
|
}
|
|
223
269
|
});
|
|
@@ -258,6 +304,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
258
304
|
focus: {
|
|
259
305
|
cell: null,
|
|
260
306
|
columnHeader: null,
|
|
307
|
+
columnHeaderFilter: null,
|
|
261
308
|
columnGroupHeader: null
|
|
262
309
|
}
|
|
263
310
|
});
|
|
@@ -288,6 +335,7 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
288
335
|
focus: {
|
|
289
336
|
cell: null,
|
|
290
337
|
columnHeader: null,
|
|
338
|
+
columnHeaderFilter: null,
|
|
291
339
|
columnGroupHeader: null
|
|
292
340
|
}
|
|
293
341
|
});
|
|
@@ -296,7 +344,8 @@ export var useGridFocus = function useGridFocus(apiRef, props) {
|
|
|
296
344
|
}, [apiRef]);
|
|
297
345
|
var focusApi = {
|
|
298
346
|
setCellFocus: setCellFocus,
|
|
299
|
-
setColumnHeaderFocus: setColumnHeaderFocus
|
|
347
|
+
setColumnHeaderFocus: setColumnHeaderFocus,
|
|
348
|
+
setColumnHeaderFilterFocus: setColumnHeaderFilterFocus
|
|
300
349
|
};
|
|
301
350
|
var focusPrivateApi = {
|
|
302
351
|
moveFocusToRelativeCell: moveFocusToRelativeCell,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { createSelector } from '../../../utils/createSelector';
|
|
3
|
+
export var unstable_gridHeaderFilteringStateSelector = function unstable_gridHeaderFilteringStateSelector(state) {
|
|
4
|
+
return state.headerFiltering;
|
|
5
|
+
};
|
|
6
|
+
export var unstable_gridHeaderFilteringEditFieldSelector = createSelector(unstable_gridHeaderFilteringStateSelector, function (headerFilteringState) {
|
|
7
|
+
return headerFilteringState.editing;
|
|
8
|
+
});
|
|
9
|
+
export var unstable_gridHeaderFilteringMenuSelector = createSelector(unstable_gridHeaderFilteringStateSelector, function (headerFilteringState) {
|
|
10
|
+
return headerFilteringState.menuOpen;
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridHeaderFilteringSelectors';
|
|
@@ -0,0 +1,93 @@
|
|
|
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 var headerFilteringStateInitializer = function headerFilteringStateInitializer(state) {
|
|
7
|
+
return _extends({}, state, {
|
|
8
|
+
headerFiltering: {
|
|
9
|
+
editing: null,
|
|
10
|
+
menuOpen: null
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export var useGridHeaderFiltering = function useGridHeaderFiltering(apiRef, props) {
|
|
15
|
+
var logger = useGridLogger(apiRef, 'useGridHeaderFiltering');
|
|
16
|
+
var setHeaderFilterState = React.useCallback(function (headerFilterState) {
|
|
17
|
+
apiRef.current.setState(function (state) {
|
|
18
|
+
var _headerFilterState$ed, _headerFilterState$me;
|
|
19
|
+
// Safety check to avoid MIT users from using it
|
|
20
|
+
// This hook should ultimately be moved to the Pro package
|
|
21
|
+
if (props.signature === 'DataGrid') {
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
return _extends({}, state, {
|
|
25
|
+
headerFiltering: {
|
|
26
|
+
editing: (_headerFilterState$ed = headerFilterState.editing) != null ? _headerFilterState$ed : null,
|
|
27
|
+
menuOpen: (_headerFilterState$me = headerFilterState.menuOpen) != null ? _headerFilterState$me : null
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
apiRef.current.forceUpdate();
|
|
32
|
+
}, [apiRef, props.signature]);
|
|
33
|
+
var startHeaderFilterEditMode = React.useCallback(function (field) {
|
|
34
|
+
logger.debug("Starting edit mode on header filter for field: ".concat(field));
|
|
35
|
+
apiRef.current.setHeaderFilterState({
|
|
36
|
+
editing: field
|
|
37
|
+
});
|
|
38
|
+
}, [apiRef, logger]);
|
|
39
|
+
var stopHeaderFilterEditMode = React.useCallback(function () {
|
|
40
|
+
logger.debug("Stopping edit mode on header filter");
|
|
41
|
+
apiRef.current.setHeaderFilterState({
|
|
42
|
+
editing: null
|
|
43
|
+
});
|
|
44
|
+
}, [apiRef, logger]);
|
|
45
|
+
var showHeaderFilterMenu = React.useCallback(function (field) {
|
|
46
|
+
logger.debug("Opening header filter menu for field: ".concat(field));
|
|
47
|
+
apiRef.current.setHeaderFilterState({
|
|
48
|
+
menuOpen: field
|
|
49
|
+
});
|
|
50
|
+
}, [apiRef, logger]);
|
|
51
|
+
var hideHeaderFilterMenu = React.useCallback(function () {
|
|
52
|
+
logger.debug("Hiding header filter menu for active field");
|
|
53
|
+
var fieldToFocus = apiRef.current.state.headerFiltering.menuOpen;
|
|
54
|
+
if (fieldToFocus) {
|
|
55
|
+
var columnLookup = gridColumnLookupSelector(apiRef);
|
|
56
|
+
var columnVisibilityModel = gridColumnVisibilityModelSelector(apiRef);
|
|
57
|
+
var orderedFields = gridColumnFieldsSelector(apiRef);
|
|
58
|
+
|
|
59
|
+
// If the column was removed from the grid, we need to find the closest visible field
|
|
60
|
+
if (!columnLookup[fieldToFocus]) {
|
|
61
|
+
fieldToFocus = orderedFields[0];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// If the field to focus is hidden, we need to find the closest visible field
|
|
65
|
+
if (columnVisibilityModel[fieldToFocus] === false) {
|
|
66
|
+
// contains visible column fields + the field that was just hidden
|
|
67
|
+
var visibleOrderedFields = orderedFields.filter(function (field) {
|
|
68
|
+
if (field === fieldToFocus) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
return columnVisibilityModel[field] !== false;
|
|
72
|
+
});
|
|
73
|
+
var fieldIndex = visibleOrderedFields.indexOf(fieldToFocus);
|
|
74
|
+
fieldToFocus = visibleOrderedFields[fieldIndex + 1] || visibleOrderedFields[fieldIndex - 1];
|
|
75
|
+
}
|
|
76
|
+
apiRef.current.setHeaderFilterState({
|
|
77
|
+
menuOpen: null
|
|
78
|
+
});
|
|
79
|
+
apiRef.current.setColumnHeaderFilterFocus(fieldToFocus);
|
|
80
|
+
}
|
|
81
|
+
}, [apiRef, logger]);
|
|
82
|
+
var headerFilterPrivateApi = {
|
|
83
|
+
setHeaderFilterState: setHeaderFilterState
|
|
84
|
+
};
|
|
85
|
+
var headerFilterApi = {
|
|
86
|
+
startHeaderFilterEditMode: startHeaderFilterEditMode,
|
|
87
|
+
stopHeaderFilterEditMode: stopHeaderFilterEditMode,
|
|
88
|
+
showHeaderFilterMenu: showHeaderFilterMenu,
|
|
89
|
+
hideHeaderFilterMenu: hideHeaderFilterMenu
|
|
90
|
+
};
|
|
91
|
+
useGridApiMethod(apiRef, headerFilterApi, 'public');
|
|
92
|
+
useGridApiMethod(apiRef, headerFilterPrivateApi, 'private');
|
|
93
|
+
};
|
|
@@ -15,6 +15,7 @@ import { gridPinnedRowsSelector } from '../rows/gridRowsSelector';
|
|
|
15
15
|
import { unstable_gridFocusColumnGroupHeaderSelector } from '../focus';
|
|
16
16
|
import { gridColumnGroupsHeaderMaxDepthSelector } from '../columnGrouping/gridColumnGroupsSelector';
|
|
17
17
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
18
|
+
import { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../headerFiltering/gridHeaderFilteringSelectors';
|
|
18
19
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
19
20
|
function enrichPageRowsWithPinnedRows(apiRef, rows) {
|
|
20
21
|
var pinnedRows = gridPinnedRowsSelector(apiRef) || {};
|
|
@@ -69,6 +70,9 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
69
70
|
var currentPageRows = React.useMemo(function () {
|
|
70
71
|
return enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows);
|
|
71
72
|
}, [apiRef, initialCurrentPageRows]);
|
|
73
|
+
var headerFilteringEnabled =
|
|
74
|
+
// @ts-expect-error // TODO move relevant code to the `DataGridPro`
|
|
75
|
+
props.signature !== 'DataGrid' && props.unstable_headerFilters;
|
|
72
76
|
|
|
73
77
|
/**
|
|
74
78
|
* @param {number} colIndex Index of the column to focus
|
|
@@ -108,6 +112,14 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
108
112
|
var field = apiRef.current.getVisibleColumns()[colIndex].field;
|
|
109
113
|
apiRef.current.setColumnHeaderFocus(field, event);
|
|
110
114
|
}, [apiRef, logger]);
|
|
115
|
+
var goToHeaderFilter = React.useCallback(function (colIndex, event) {
|
|
116
|
+
logger.debug("Navigating to header filter col ".concat(colIndex));
|
|
117
|
+
apiRef.current.scrollToIndexes({
|
|
118
|
+
colIndex: colIndex
|
|
119
|
+
});
|
|
120
|
+
var field = apiRef.current.getVisibleColumns()[colIndex].field;
|
|
121
|
+
apiRef.current.setColumnHeaderFilterFocus(field, event);
|
|
122
|
+
}, [apiRef, logger]);
|
|
111
123
|
var goToGroupHeader = React.useCallback(function (colIndex, depth, event) {
|
|
112
124
|
logger.debug("Navigating to header col ".concat(colIndex));
|
|
113
125
|
apiRef.current.scrollToIndexes({
|
|
@@ -117,7 +129,7 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
117
129
|
apiRef.current.setColumnGroupHeaderFocus(field, depth, event);
|
|
118
130
|
}, [apiRef, logger]);
|
|
119
131
|
var getRowIdFromIndex = React.useCallback(function (rowIndex) {
|
|
120
|
-
return currentPageRows[rowIndex].id;
|
|
132
|
+
return currentPageRows == null ? void 0 : currentPageRows[rowIndex].id;
|
|
121
133
|
}, [currentPageRows]);
|
|
122
134
|
var handleColumnHeaderKeyDown = React.useCallback(function (params, event) {
|
|
123
135
|
var headerTitleNode = event.currentTarget.querySelector(".".concat(gridClasses.columnHeaderTitleContainerContent));
|
|
@@ -143,7 +155,11 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
143
155
|
case 'ArrowDown':
|
|
144
156
|
{
|
|
145
157
|
if (firstRowIndexInPage !== null) {
|
|
146
|
-
|
|
158
|
+
if (headerFilteringEnabled) {
|
|
159
|
+
goToHeaderFilter(colIndexBefore, event);
|
|
160
|
+
} else {
|
|
161
|
+
goToCell(colIndexBefore, getRowIdFromIndex(firstRowIndexInPage));
|
|
162
|
+
}
|
|
147
163
|
}
|
|
148
164
|
break;
|
|
149
165
|
}
|
|
@@ -217,7 +233,97 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
217
233
|
if (shouldPreventDefault) {
|
|
218
234
|
event.preventDefault();
|
|
219
235
|
}
|
|
220
|
-
}, [apiRef, currentPageRows.length,
|
|
236
|
+
}, [apiRef, currentPageRows.length, headerFilteringEnabled, goToHeaderFilter, goToCell, getRowIdFromIndex, theme.direction, goToHeader, goToGroupHeader]);
|
|
237
|
+
var handleHeaderFilterKeyDown = React.useCallback(function (params, event) {
|
|
238
|
+
var dimensions = apiRef.current.getRootDimensions();
|
|
239
|
+
if (!dimensions) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
var isEditing = unstable_gridHeaderFilteringEditFieldSelector(apiRef) === params.field;
|
|
243
|
+
var isHeaderMenuOpen = unstable_gridHeaderFilteringMenuSelector(apiRef) === params.field;
|
|
244
|
+
if (isEditing || isHeaderMenuOpen || !isNavigationKey(event.key)) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
var viewportPageSize = apiRef.current.getViewportPageSize();
|
|
248
|
+
var colIndexBefore = params.field ? apiRef.current.getColumnIndex(params.field) : 0;
|
|
249
|
+
var firstRowIndexInPage = 0;
|
|
250
|
+
var lastRowIndexInPage = currentPageRows.length - 1;
|
|
251
|
+
var firstColIndex = 0;
|
|
252
|
+
var lastColIndex = gridVisibleColumnDefinitionsSelector(apiRef).length - 1;
|
|
253
|
+
var shouldPreventDefault = true;
|
|
254
|
+
switch (event.key) {
|
|
255
|
+
case 'ArrowDown':
|
|
256
|
+
{
|
|
257
|
+
var rowId = getRowIdFromIndex(firstRowIndexInPage);
|
|
258
|
+
if (firstRowIndexInPage !== null && rowId != null) {
|
|
259
|
+
goToCell(colIndexBefore, rowId);
|
|
260
|
+
}
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case 'ArrowRight':
|
|
264
|
+
{
|
|
265
|
+
var rightColIndex = getRightColumnIndex({
|
|
266
|
+
currentColIndex: colIndexBefore,
|
|
267
|
+
firstColIndex: firstColIndex,
|
|
268
|
+
lastColIndex: lastColIndex,
|
|
269
|
+
direction: theme.direction
|
|
270
|
+
});
|
|
271
|
+
if (rightColIndex !== null) {
|
|
272
|
+
goToHeaderFilter(rightColIndex, event);
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
case 'ArrowLeft':
|
|
277
|
+
{
|
|
278
|
+
var leftColIndex = getLeftColumnIndex({
|
|
279
|
+
currentColIndex: colIndexBefore,
|
|
280
|
+
firstColIndex: firstColIndex,
|
|
281
|
+
lastColIndex: lastColIndex,
|
|
282
|
+
direction: theme.direction
|
|
283
|
+
});
|
|
284
|
+
if (leftColIndex !== null) {
|
|
285
|
+
goToHeaderFilter(leftColIndex, event);
|
|
286
|
+
} else {
|
|
287
|
+
apiRef.current.setColumnHeaderFilterFocus(params.field, event);
|
|
288
|
+
}
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
case 'ArrowUp':
|
|
292
|
+
{
|
|
293
|
+
goToHeader(colIndexBefore, event);
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
case 'PageDown':
|
|
297
|
+
{
|
|
298
|
+
if (firstRowIndexInPage !== null && lastRowIndexInPage !== null) {
|
|
299
|
+
goToCell(colIndexBefore, getRowIdFromIndex(Math.min(firstRowIndexInPage + viewportPageSize, lastRowIndexInPage)));
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
case 'Home':
|
|
304
|
+
{
|
|
305
|
+
goToHeaderFilter(firstColIndex, event);
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
case 'End':
|
|
309
|
+
{
|
|
310
|
+
goToHeaderFilter(lastColIndex, event);
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case ' ':
|
|
314
|
+
{
|
|
315
|
+
// prevent Space event from scrolling
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
default:
|
|
319
|
+
{
|
|
320
|
+
shouldPreventDefault = false;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (shouldPreventDefault) {
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
}
|
|
326
|
+
}, [apiRef, currentPageRows.length, goToHeaderFilter, theme.direction, goToHeader, goToCell, getRowIdFromIndex]);
|
|
221
327
|
var focusedColumnGroup = useGridSelector(apiRef, unstable_gridFocusColumnGroupHeaderSelector);
|
|
222
328
|
var handleColumnGroupHeaderKeyDown = React.useCallback(function (params, event) {
|
|
223
329
|
var dimensions = apiRef.current.getRootDimensions();
|
|
@@ -350,6 +456,8 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
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 var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
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
|
var checkIfCanStartEditing = React.useCallback(function (initialValue, _ref3) {
|
|
455
563
|
var event = _ref3.event;
|
|
456
564
|
if (event.key === ' ') {
|
|
@@ -461,6 +569,7 @@ export var useGridKeyboardNavigation = function useGridKeyboardNavigation(apiRef
|
|
|
461
569
|
}, []);
|
|
462
570
|
useGridRegisterPipeProcessor(apiRef, 'canStartEditing', checkIfCanStartEditing);
|
|
463
571
|
useGridApiEventHandler(apiRef, 'columnHeaderKeyDown', handleColumnHeaderKeyDown);
|
|
572
|
+
useGridApiEventHandler(apiRef, 'headerFilterKeyDown', handleHeaderFilterKeyDown);
|
|
464
573
|
useGridApiEventHandler(apiRef, 'columnGroupHeaderKeyDown', handleColumnGroupHeaderKeyDown);
|
|
465
574
|
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
466
575
|
};
|
|
@@ -56,14 +56,16 @@ export var useGridPreferencesPanel = function useGridPreferencesPanel(apiRef, pr
|
|
|
56
56
|
var hidePreferencesDelayed = React.useCallback(function () {
|
|
57
57
|
hideTimeout.current = setTimeout(hidePreferences, 100);
|
|
58
58
|
}, [hidePreferences]);
|
|
59
|
-
var showPreferences = React.useCallback(function (newValue) {
|
|
59
|
+
var showPreferences = React.useCallback(function (newValue, panelId, labelId) {
|
|
60
60
|
logger.debug('Opening Preferences Panel');
|
|
61
61
|
doNotHidePanel();
|
|
62
62
|
apiRef.current.setState(function (state) {
|
|
63
63
|
return _extends({}, state, {
|
|
64
64
|
preferencePanel: _extends({}, state.preferencePanel, {
|
|
65
65
|
open: true,
|
|
66
|
-
openedPanelValue: newValue
|
|
66
|
+
openedPanelValue: newValue,
|
|
67
|
+
panelId: panelId,
|
|
68
|
+
labelId: labelId
|
|
67
69
|
})
|
|
68
70
|
});
|
|
69
71
|
});
|
|
@@ -120,8 +120,23 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
120
120
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
121
121
|
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'));
|
|
122
122
|
}
|
|
123
|
+
var nonPinnedRowsUpdates = [];
|
|
124
|
+
updates.forEach(function (update) {
|
|
125
|
+
var id = getRowIdFromRowModel(update, props.getRowId, 'A row was provided without id when calling updateRows():');
|
|
126
|
+
var rowNode = apiRef.current.getRowNode(id);
|
|
127
|
+
if ((rowNode == null ? void 0 : rowNode.type) === 'pinnedRow') {
|
|
128
|
+
// @ts-ignore because otherwise `release:build` doesn't work
|
|
129
|
+
var pinnedRowsCache = apiRef.current.caches.pinnedRows;
|
|
130
|
+
var prevModel = pinnedRowsCache.idLookup[id];
|
|
131
|
+
if (prevModel) {
|
|
132
|
+
pinnedRowsCache.idLookup[id] = _extends({}, prevModel, update);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
nonPinnedRowsUpdates.push(update);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
123
138
|
var cache = updateCacheWithNewRows({
|
|
124
|
-
updates:
|
|
139
|
+
updates: nonPinnedRowsUpdates,
|
|
125
140
|
getRowId: props.getRowId,
|
|
126
141
|
previousCache: apiRef.current.caches.rows
|
|
127
142
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { unstable_debounce as debounce, unstable_capitalize as capitalize } from '@mui/utils';
|
|
@@ -105,20 +104,14 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
105
104
|
} else {
|
|
106
105
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
107
106
|
}
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
acc[key] = size;
|
|
107
|
+
var initialHeights = {};
|
|
108
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
109
|
+
for (var _key in sizes) {
|
|
110
|
+
if (/^base[A-Z]/.test(_key)) {
|
|
111
|
+
initialHeights[_key] = sizes[_key];
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// We use an object to make simple to check if a height is already added or not
|
|
119
|
-
var initialHeights = _extends({}, existingBaseSizes, {
|
|
120
|
-
baseCenter: baseRowHeight
|
|
121
|
-
});
|
|
113
|
+
}
|
|
114
|
+
initialHeights.baseCenter = baseRowHeight;
|
|
122
115
|
if (getRowSpacing) {
|
|
123
116
|
var _spacing$top, _spacing$bottom;
|
|
124
117
|
var indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
@@ -140,16 +133,15 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
140
133
|
var maximumBaseSize = 0;
|
|
141
134
|
var otherSizes = 0;
|
|
142
135
|
var processedSizes = calculateRowProcessedSizes(row);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (/^base[A-Z]/.test(size)) {
|
|
136
|
+
/* eslint-disable-next-line no-restricted-syntax, guard-for-in */
|
|
137
|
+
for (var _key2 in processedSizes) {
|
|
138
|
+
var value = processedSizes[_key2];
|
|
139
|
+
if (/^base[A-Z]/.test(_key2)) {
|
|
148
140
|
maximumBaseSize = value > maximumBaseSize ? value : maximumBaseSize;
|
|
149
141
|
} else {
|
|
150
142
|
otherSizes += value;
|
|
151
143
|
}
|
|
152
|
-
}
|
|
144
|
+
}
|
|
153
145
|
return acc + maximumBaseSize + otherSizes;
|
|
154
146
|
}, 0);
|
|
155
147
|
pinnedRows == null ? void 0 : (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.forEach(function (row) {
|
package/legacy/index.js
CHANGED
|
@@ -4,13 +4,16 @@ export { GridVirtualScrollerRenderZone } from '../components/virtualization/Grid
|
|
|
4
4
|
export { GridBaseColumnHeaders } from '../components/columnHeaders/GridBaseColumnHeaders';
|
|
5
5
|
export { GridColumnHeadersInner } from '../components/columnHeaders/GridColumnHeadersInner';
|
|
6
6
|
export { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
|
|
7
|
+
export { getGridFilter } from '../components/panel/filterPanel/GridFilterPanel';
|
|
7
8
|
export { useGridRegisterPipeProcessor } from '../hooks/core/pipeProcessing';
|
|
8
9
|
export { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from '../hooks/core/strategyProcessing';
|
|
9
10
|
export { useGridInitialization } from '../hooks/core/useGridInitialization';
|
|
10
11
|
export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
|
|
11
12
|
export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
13
|
+
export { unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector } from '../hooks/features/headerFiltering/gridHeaderFilteringSelectors';
|
|
12
14
|
export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
13
15
|
export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
16
|
+
export { getTotalHeaderHeight } from '../hooks/features/columns/gridColumnsUtils';
|
|
14
17
|
export { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
15
18
|
export { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
16
19
|
export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
|
|
@@ -32,6 +35,7 @@ export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/row
|
|
|
32
35
|
export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
33
36
|
export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
|
|
34
37
|
export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
38
|
+
export { headerFilteringStateInitializer, useGridHeaderFiltering } from '../hooks/features/headerFiltering/useGridHeaderFiltering';
|
|
35
39
|
export { calculatePinnedRowsHeight } from '../hooks/features/rows/gridRowsUtils';
|
|
36
40
|
export { useGridRowSelection, rowSelectionStateInitializer } from '../hooks/features/rowSelection/useGridRowSelection';
|
|
37
41
|
export { useGridRowSelectionPreProcessors } from '../hooks/features/rowSelection/useGridRowSelectionPreProcessors';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
var _excluded = ["components", "componentsProps"];
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
/** Gathers props for the root element into a single `.forwardedProps` field */
|
|
5
|
+
function groupForwardedProps(props) {
|
|
6
|
+
var _props$forwardedProps;
|
|
7
|
+
var keys = Object.keys(props);
|
|
8
|
+
if (!keys.some(function (key) {
|
|
9
|
+
return key.startsWith('aria-') || key.startsWith('data-');
|
|
10
|
+
})) {
|
|
11
|
+
return props;
|
|
12
|
+
}
|
|
13
|
+
var newProps = {};
|
|
14
|
+
var forwardedProps = (_props$forwardedProps = props.forwardedProps) != null ? _props$forwardedProps : {};
|
|
15
|
+
for (var i = 0; i < keys.length; i += 1) {
|
|
16
|
+
var _key = keys[i];
|
|
17
|
+
if (_key.startsWith('aria-') || _key.startsWith('data-')) {
|
|
18
|
+
forwardedProps[_key] = props[_key];
|
|
19
|
+
} else {
|
|
20
|
+
newProps[_key] = props[_key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
newProps.forwardedProps = forwardedProps;
|
|
24
|
+
return newProps;
|
|
25
|
+
}
|
|
26
|
+
export function useProps(allProps) {
|
|
27
|
+
return React.useMemo(function () {
|
|
28
|
+
var components = allProps.components,
|
|
29
|
+
componentsProps = allProps.componentsProps,
|
|
30
|
+
themedProps = _objectWithoutProperties(allProps, _excluded);
|
|
31
|
+
return [components, componentsProps, groupForwardedProps(themedProps)];
|
|
32
|
+
}, [allProps]);
|
|
33
|
+
}
|