@mui/x-data-grid 6.0.0-beta.4 → 6.0.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 +204 -29
- package/DataGrid/DataGrid.js +10 -2
- package/DataGrid/useDataGridProps.js +25 -18
- package/colDef/gridSingleSelectColDef.js +13 -4
- package/components/GridColumnHeaders.d.ts +7 -0
- package/components/GridColumnHeaders.js +108 -0
- package/components/GridFooter.d.ts +1 -1
- package/components/GridFooter.js +2 -2
- package/components/GridHeader.js +2 -2
- package/components/GridLoadingOverlay.d.ts +1 -1
- package/components/GridNoResultsOverlay.d.ts +1 -1
- package/components/GridNoRowsOverlay.d.ts +1 -1
- package/components/GridRow.d.ts +13 -7
- package/components/GridRow.js +49 -31
- package/components/GridRowCount.d.ts +1 -1
- package/components/GridRowCount.js +4 -6
- package/components/GridScrollArea.js +4 -3
- package/components/GridSelectedRowCount.d.ts +1 -1
- package/components/GridSelectedRowCount.js +4 -6
- package/components/base/GridBody.d.ts +1 -4
- package/components/base/GridBody.js +43 -5
- package/components/base/GridFooterPlaceholder.js +2 -2
- package/components/base/GridOverlays.js +7 -7
- package/components/cell/GridActionsCell.js +4 -4
- package/components/cell/GridActionsCellItem.js +3 -3
- package/components/cell/GridBooleanCell.js +1 -1
- package/components/cell/GridCell.d.ts +2 -5
- package/components/cell/GridCell.js +14 -12
- package/components/cell/GridEditBooleanCell.js +3 -3
- package/components/cell/GridEditInputCell.js +3 -6
- package/components/cell/GridEditSingleSelectCell.d.ts +2 -8
- package/components/cell/GridEditSingleSelectCell.js +32 -16
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +4 -4
- package/components/columnHeaders/GridBaseColumnHeaders.d.ts +7 -0
- package/{modern/components/columnHeaders/GridColumnHeaders.js → components/columnHeaders/GridBaseColumnHeaders.js} +14 -20
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +6 -6
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +7 -7
- package/components/columnHeaders/GridColumnHeaderTitle.js +10 -14
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeadersInner.js +6 -6
- package/components/columnHeaders/GridIconButtonContainer.js +4 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +3 -3
- package/components/columnSelection/GridHeaderCheckbox.js +3 -3
- package/components/containers/GridFooterContainer.d.ts +1 -1
- package/components/containers/GridFooterContainer.js +10 -15
- package/components/containers/GridMainContainer.js +3 -5
- package/components/containers/GridOverlay.d.ts +1 -2
- package/components/containers/GridOverlay.js +7 -11
- package/components/containers/GridRoot.js +4 -5
- package/components/containers/GridRootStyles.d.ts +5 -1
- package/components/containers/GridRootStyles.js +7 -3
- package/components/containers/GridToolbarContainer.d.ts +1 -1
- package/components/containers/GridToolbarContainer.js +4 -6
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/menu/GridMenu.js +5 -7
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -2
- package/components/panel/GridColumnsPanel.js +16 -18
- package/components/panel/GridPanel.d.ts +6 -2
- package/components/panel/GridPanel.js +4 -0
- package/components/panel/GridPanelContent.d.ts +1 -1
- package/components/panel/GridPanelContent.js +4 -6
- package/components/panel/GridPanelFooter.d.ts +1 -1
- package/components/panel/GridPanelFooter.js +4 -6
- package/components/panel/GridPanelHeader.d.ts +1 -1
- package/components/panel/GridPanelHeader.js +4 -6
- package/components/panel/GridPanelWrapper.js +3 -5
- package/components/panel/GridPreferencesPanel.js +4 -4
- package/components/panel/filterPanel/GridFilterForm.js +50 -45
- package/components/panel/filterPanel/GridFilterInputBoolean.js +14 -11
- package/components/panel/filterPanel/GridFilterInputDate.js +4 -5
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +28 -20
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +3 -3
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +2 -8
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +53 -25
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -5
- package/components/panel/filterPanel/GridFilterPanel.d.ts +5 -3
- package/components/panel/filterPanel/GridFilterPanel.js +35 -11
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -2
- package/components/panel/filterPanel/filterPanelUtils.js +3 -9
- package/components/toolbar/GridToolbarColumnsButton.js +4 -4
- package/components/toolbar/GridToolbarDensitySelector.js +9 -9
- package/components/toolbar/GridToolbarExportContainer.js +4 -4
- package/components/toolbar/GridToolbarFilterButton.js +9 -11
- package/components/toolbar/GridToolbarQuickFilter.js +8 -7
- package/components/virtualization/GridVirtualScroller.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +4 -6
- package/components/virtualization/GridVirtualScrollerContent.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollerContent.js +4 -4
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.js +4 -6
- package/constants/defaultGridSlotsComponents.js +5 -54
- package/constants/localeTextConstants.js +1 -0
- package/hooks/core/useGridLocaleText.js +2 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +22 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +19 -26
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.js +5 -5
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +5 -5
- package/hooks/features/statePersistence/gridStatePersistenceInterface.d.ts +2 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +36 -19
- package/index.d.ts +3 -0
- package/index.js +5 -1
- package/internals/index.d.ts +4 -1
- package/internals/index.js +3 -2
- package/internals/utils/computeSlots.d.ts +6 -0
- package/internals/utils/computeSlots.js +17 -0
- package/internals/utils/index.d.ts +2 -0
- package/internals/utils/index.js +2 -0
- package/internals/utils/slotsMigration.d.ts +4 -0
- package/internals/utils/slotsMigration.js +13 -0
- package/legacy/DataGrid/DataGrid.js +10 -2
- package/legacy/DataGrid/useDataGridProps.js +21 -20
- package/legacy/colDef/gridSingleSelectColDef.js +13 -4
- package/legacy/components/GridColumnHeaders.js +106 -0
- package/legacy/components/GridFooter.js +2 -2
- package/legacy/components/GridHeader.js +2 -2
- package/legacy/components/GridRow.js +47 -31
- package/legacy/components/GridRowCount.js +4 -6
- package/legacy/components/GridScrollArea.js +4 -3
- package/legacy/components/GridSelectedRowCount.js +4 -6
- package/legacy/components/base/GridBody.js +43 -5
- package/legacy/components/base/GridFooterPlaceholder.js +2 -2
- package/legacy/components/base/GridOverlays.js +7 -7
- package/legacy/components/cell/GridActionsCell.js +4 -4
- package/legacy/components/cell/GridActionsCellItem.js +3 -3
- package/legacy/components/cell/GridBooleanCell.js +2 -2
- package/legacy/components/cell/GridCell.js +14 -12
- package/legacy/components/cell/GridEditBooleanCell.js +3 -3
- package/legacy/components/cell/GridEditInputCell.js +3 -6
- package/legacy/components/cell/GridEditSingleSelectCell.js +40 -23
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +4 -4
- package/legacy/components/columnHeaders/{GridColumnHeaders.js → GridBaseColumnHeaders.js} +14 -19
- package/legacy/components/columnHeaders/GridColumnHeaderFilterIconButton.js +6 -6
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/legacy/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/legacy/components/columnHeaders/GridColumnHeaderSortIcon.js +7 -7
- package/legacy/components/columnHeaders/GridColumnHeaderTitle.js +12 -17
- package/legacy/components/columnHeaders/GridColumnHeadersInner.js +6 -6
- package/legacy/components/columnHeaders/GridIconButtonContainer.js +4 -6
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +3 -3
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +3 -3
- package/legacy/components/containers/GridFooterContainer.js +10 -15
- package/legacy/components/containers/GridMainContainer.js +3 -5
- package/legacy/components/containers/GridOverlay.js +12 -17
- package/legacy/components/containers/GridRoot.js +5 -6
- package/legacy/components/containers/GridRootStyles.js +7 -3
- package/legacy/components/containers/GridToolbarContainer.js +4 -6
- package/legacy/components/index.js +1 -1
- package/legacy/components/menu/GridMenu.js +5 -7
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -1
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -1
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -1
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -2
- package/legacy/components/panel/GridColumnsPanel.js +16 -20
- package/legacy/components/panel/GridPanel.js +4 -0
- package/legacy/components/panel/GridPanelContent.js +4 -6
- package/legacy/components/panel/GridPanelFooter.js +4 -6
- package/legacy/components/panel/GridPanelHeader.js +4 -6
- package/legacy/components/panel/GridPanelWrapper.js +3 -5
- package/legacy/components/panel/GridPreferencesPanel.js +4 -4
- package/legacy/components/panel/filterPanel/GridFilterForm.js +50 -45
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +14 -11
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -5
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +32 -26
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +3 -3
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +52 -27
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -5
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +36 -10
- package/legacy/components/panel/filterPanel/filterPanelUtils.js +3 -9
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +4 -4
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +9 -9
- package/legacy/components/toolbar/GridToolbarExportContainer.js +4 -4
- package/legacy/components/toolbar/GridToolbarFilterButton.js +9 -11
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +8 -7
- package/legacy/components/virtualization/GridVirtualScroller.js +4 -6
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +4 -4
- package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +4 -6
- package/legacy/constants/defaultGridSlotsComponents.js +5 -54
- package/legacy/constants/localeTextConstants.js +1 -0
- package/legacy/hooks/core/useGridLocaleText.js +2 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +19 -26
- package/legacy/hooks/features/columns/useGridColumns.js +5 -5
- package/legacy/hooks/features/filter/useGridFilter.js +5 -5
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +34 -17
- package/legacy/index.js +5 -1
- package/legacy/internals/index.js +3 -2
- package/legacy/internals/utils/computeSlots.js +16 -0
- package/legacy/internals/utils/index.js +2 -0
- package/legacy/internals/utils/slotsMigration.js +14 -0
- package/legacy/locales/arSD.js +15 -19
- package/legacy/locales/beBY.js +1 -0
- package/legacy/locales/bgBG.js +1 -0
- package/legacy/locales/csCZ.js +25 -32
- package/legacy/locales/daDK.js +1 -0
- package/legacy/locales/deDE.js +1 -0
- package/legacy/locales/elGR.js +1 -0
- package/legacy/locales/esES.js +2 -1
- package/legacy/locales/faIR.js +1 -0
- package/legacy/locales/fiFI.js +1 -0
- package/legacy/locales/frFR.js +1 -0
- package/legacy/locales/heIL.js +1 -0
- package/legacy/locales/huHU.js +1 -0
- package/legacy/locales/itIT.js +1 -0
- package/legacy/locales/jaJP.js +1 -0
- package/legacy/locales/koKR.js +1 -0
- package/legacy/locales/nbNO.js +1 -0
- package/legacy/locales/nlNL.js +1 -0
- package/legacy/locales/plPL.js +1 -0
- package/legacy/locales/ptBR.js +1 -0
- package/legacy/locales/roRO.js +1 -0
- package/legacy/locales/ruRU.js +1 -0
- package/legacy/locales/skSK.js +1 -0
- package/legacy/locales/svSE.js +1 -0
- package/legacy/locales/trTR.js +1 -0
- package/legacy/locales/ukUA.js +1 -0
- package/legacy/locales/urPK.js +1 -0
- package/legacy/locales/viVN.js +1 -0
- package/legacy/locales/zhCN.js +1 -0
- package/legacy/locales/zhTW.js +1 -0
- package/legacy/material/components/MUISelectOption.js +14 -0
- package/legacy/{components/columnHeaders → material/icons}/GridColumnUnsortedIcon.js +1 -1
- package/legacy/{components → material}/icons/index.js +7 -1
- package/legacy/material/index.js +65 -0
- package/legacy/models/gridFilterItem.js +2 -0
- package/legacy/models/params/gridRowParams.js +4 -0
- package/locales/arSD.js +15 -19
- package/locales/beBY.js +1 -0
- package/locales/bgBG.js +1 -0
- package/locales/csCZ.js +24 -31
- package/locales/daDK.js +1 -0
- package/locales/deDE.js +1 -0
- package/locales/elGR.js +1 -0
- package/locales/esES.js +2 -1
- package/locales/faIR.js +1 -0
- package/locales/fiFI.js +1 -0
- package/locales/frFR.js +1 -0
- package/locales/heIL.js +1 -0
- package/locales/huHU.js +1 -0
- package/locales/itIT.js +1 -0
- package/locales/jaJP.js +1 -0
- package/locales/koKR.js +1 -0
- package/locales/nbNO.js +1 -0
- package/locales/nlNL.js +1 -0
- package/locales/plPL.js +1 -0
- package/locales/ptBR.js +1 -0
- package/locales/roRO.js +1 -0
- package/locales/ruRU.js +1 -0
- package/locales/skSK.js +1 -0
- package/locales/svSE.js +1 -0
- package/locales/trTR.js +1 -0
- package/locales/ukUA.js +1 -0
- package/locales/urPK.js +1 -0
- package/locales/viVN.js +1 -0
- package/locales/zhCN.js +1 -0
- package/locales/zhTW.js +1 -0
- package/material/components/MUISelectOption.d.ts +3 -0
- package/material/components/MUISelectOption.js +16 -0
- package/{components/columnHeaders → material/icons}/GridColumnUnsortedIcon.js +1 -1
- package/{components → material}/icons/index.d.ts +6 -0
- package/{components → material}/icons/index.js +7 -1
- package/material/index.d.ts +57 -0
- package/material/index.js +65 -0
- package/material/package.json +6 -0
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +19 -1
- package/models/gridExport.d.ts +4 -0
- package/models/gridFilterItem.d.ts +2 -0
- package/models/gridFilterItem.js +2 -0
- package/models/gridFilterModel.d.ts +2 -0
- package/models/gridFilterOperator.d.ts +2 -0
- package/models/gridIconSlotsComponent.d.ts +22 -2
- package/models/gridSlotsComponent.d.ts +18 -1
- package/models/gridSlotsComponentsProps.d.ts +103 -23
- package/models/params/gridRowParams.d.ts +6 -0
- package/models/params/gridRowParams.js +4 -0
- package/models/props/DataGridProps.d.ts +13 -2
- package/modern/DataGrid/DataGrid.js +10 -2
- package/modern/DataGrid/useDataGridProps.js +21 -17
- package/modern/colDef/gridSingleSelectColDef.js +13 -4
- package/modern/components/GridColumnHeaders.js +108 -0
- package/modern/components/GridFooter.js +1 -1
- package/modern/components/GridHeader.js +1 -1
- package/modern/components/GridRow.js +49 -28
- package/modern/components/GridRowCount.js +4 -6
- package/modern/components/GridScrollArea.js +4 -3
- package/modern/components/GridSelectedRowCount.js +4 -6
- package/modern/components/base/GridBody.js +43 -5
- package/modern/components/base/GridFooterPlaceholder.js +1 -1
- package/modern/components/base/GridOverlays.js +4 -4
- package/modern/components/cell/GridActionsCell.js +3 -3
- package/modern/components/cell/GridActionsCellItem.js +2 -2
- package/modern/components/cell/GridBooleanCell.js +1 -1
- package/modern/components/cell/GridCell.js +14 -12
- package/modern/components/cell/GridEditBooleanCell.js +2 -2
- package/modern/components/cell/GridEditInputCell.js +3 -6
- package/modern/components/cell/GridEditSingleSelectCell.js +30 -15
- package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/{components/columnHeaders/GridColumnHeaders.js → modern/components/columnHeaders/GridBaseColumnHeaders.js} +14 -20
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +5 -5
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -4
- package/modern/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +6 -6
- package/modern/components/columnHeaders/GridColumnHeaderTitle.js +9 -13
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +6 -6
- package/modern/components/columnHeaders/GridIconButtonContainer.js +4 -6
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/modern/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/modern/components/containers/GridFooterContainer.js +10 -15
- package/modern/components/containers/GridMainContainer.js +3 -5
- package/modern/components/containers/GridOverlay.js +7 -11
- package/modern/components/containers/GridRoot.js +4 -5
- package/modern/components/containers/GridRootStyles.js +7 -3
- package/modern/components/containers/GridToolbarContainer.js +4 -6
- package/modern/components/index.js +1 -1
- package/modern/components/menu/GridMenu.js +4 -6
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -1
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -1
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -1
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -2
- package/modern/components/panel/GridColumnsPanel.js +14 -16
- package/modern/components/panel/GridPanel.js +4 -0
- package/modern/components/panel/GridPanelContent.js +4 -6
- package/modern/components/panel/GridPanelFooter.js +4 -6
- package/modern/components/panel/GridPanelHeader.js +4 -6
- package/modern/components/panel/GridPanelWrapper.js +3 -5
- package/modern/components/panel/GridPreferencesPanel.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +49 -44
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +13 -10
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +24 -17
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +52 -24
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +3 -4
- package/modern/components/panel/filterPanel/GridFilterPanel.js +34 -10
- package/modern/components/panel/filterPanel/filterPanelUtils.js +3 -9
- package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -3
- package/modern/components/toolbar/GridToolbarDensitySelector.js +8 -8
- package/modern/components/toolbar/GridToolbarExportContainer.js +3 -3
- package/modern/components/toolbar/GridToolbarFilterButton.js +8 -10
- package/modern/components/toolbar/GridToolbarQuickFilter.js +7 -6
- package/modern/components/virtualization/GridVirtualScroller.js +4 -6
- package/modern/components/virtualization/GridVirtualScrollerContent.js +4 -4
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +4 -6
- package/modern/constants/defaultGridSlotsComponents.js +5 -54
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/hooks/core/useGridLocaleText.js +2 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +19 -26
- package/modern/hooks/features/columns/useGridColumns.js +3 -3
- package/modern/hooks/features/filter/useGridFilter.js +3 -3
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +34 -18
- package/modern/index.js +5 -1
- package/modern/internals/index.js +3 -2
- package/modern/internals/utils/computeSlots.js +17 -0
- package/modern/internals/utils/index.js +2 -0
- package/modern/internals/utils/slotsMigration.js +13 -0
- package/modern/locales/arSD.js +15 -19
- package/modern/locales/beBY.js +1 -0
- package/modern/locales/bgBG.js +1 -0
- package/modern/locales/csCZ.js +24 -31
- package/modern/locales/daDK.js +1 -0
- package/modern/locales/deDE.js +1 -0
- package/modern/locales/elGR.js +1 -0
- package/modern/locales/esES.js +2 -1
- package/modern/locales/faIR.js +1 -0
- package/modern/locales/fiFI.js +1 -0
- package/modern/locales/frFR.js +1 -0
- package/modern/locales/heIL.js +1 -0
- package/modern/locales/huHU.js +1 -0
- package/modern/locales/itIT.js +1 -0
- package/modern/locales/jaJP.js +1 -0
- package/modern/locales/koKR.js +1 -0
- package/modern/locales/nbNO.js +1 -0
- package/modern/locales/nlNL.js +1 -0
- package/modern/locales/plPL.js +1 -0
- package/modern/locales/ptBR.js +1 -0
- package/modern/locales/roRO.js +1 -0
- package/modern/locales/ruRU.js +1 -0
- package/modern/locales/skSK.js +1 -0
- package/modern/locales/svSE.js +1 -0
- package/modern/locales/trTR.js +1 -0
- package/modern/locales/ukUA.js +1 -0
- package/modern/locales/urPK.js +1 -0
- package/modern/locales/viVN.js +1 -0
- package/modern/locales/zhCN.js +1 -0
- package/modern/locales/zhTW.js +1 -0
- package/modern/material/components/MUISelectOption.js +16 -0
- package/modern/{components/columnHeaders → material/icons}/GridColumnUnsortedIcon.js +1 -1
- package/modern/{components → material}/icons/index.js +7 -1
- package/modern/material/index.js +65 -0
- package/modern/models/gridFilterItem.js +2 -0
- package/modern/models/params/gridRowParams.js +4 -0
- package/node/DataGrid/DataGrid.js +10 -2
- package/node/DataGrid/useDataGridProps.js +21 -17
- package/node/colDef/gridSingleSelectColDef.js +12 -3
- package/node/components/GridColumnHeaders.js +116 -0
- package/node/components/GridFooter.js +1 -1
- package/node/components/GridHeader.js +1 -1
- package/node/components/GridRow.js +49 -28
- package/node/components/GridRowCount.js +5 -7
- package/node/components/GridScrollArea.js +5 -4
- package/node/components/GridSelectedRowCount.js +5 -7
- package/node/components/base/GridBody.js +43 -5
- package/node/components/base/GridFooterPlaceholder.js +1 -1
- package/node/components/base/GridOverlays.js +6 -6
- package/node/components/cell/GridActionsCell.js +3 -3
- package/node/components/cell/GridActionsCellItem.js +2 -2
- package/node/components/cell/GridBooleanCell.js +1 -1
- package/node/components/cell/GridCell.js +14 -11
- package/node/components/cell/GridEditBooleanCell.js +2 -2
- package/node/components/cell/GridEditInputCell.js +3 -6
- package/node/components/cell/GridEditSingleSelectCell.js +28 -14
- package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +3 -3
- package/node/components/columnHeaders/{GridColumnHeaders.js → GridBaseColumnHeaders.js} +17 -23
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +5 -5
- package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -4
- package/node/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +6 -6
- package/node/components/columnHeaders/GridColumnHeaderTitle.js +10 -14
- package/node/components/columnHeaders/GridColumnHeadersInner.js +7 -7
- package/node/components/columnHeaders/GridIconButtonContainer.js +5 -7
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/node/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/node/components/containers/GridFooterContainer.js +11 -16
- package/node/components/containers/GridMainContainer.js +4 -6
- package/node/components/containers/GridOverlay.js +8 -12
- package/node/components/containers/GridRoot.js +4 -5
- package/node/components/containers/GridRootStyles.js +7 -3
- package/node/components/containers/GridToolbarContainer.js +5 -7
- package/node/components/index.js +1 -1
- package/node/components/menu/GridMenu.js +4 -6
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -2
- package/node/components/panel/GridColumnsPanel.js +14 -16
- package/node/components/panel/GridPanel.js +4 -0
- package/node/components/panel/GridPanelContent.js +5 -7
- package/node/components/panel/GridPanelFooter.js +5 -7
- package/node/components/panel/GridPanelHeader.js +5 -7
- package/node/components/panel/GridPanelWrapper.js +3 -5
- package/node/components/panel/GridPreferencesPanel.js +3 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +48 -44
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +13 -10
- package/node/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +23 -16
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +50 -23
- package/node/components/panel/filterPanel/GridFilterInputValue.js +3 -4
- package/node/components/panel/filterPanel/GridFilterPanel.js +34 -10
- package/node/components/panel/filterPanel/filterPanelUtils.js +3 -10
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -3
- package/node/components/toolbar/GridToolbarDensitySelector.js +8 -8
- package/node/components/toolbar/GridToolbarExportContainer.js +3 -3
- package/node/components/toolbar/GridToolbarFilterButton.js +8 -10
- package/node/components/toolbar/GridToolbarQuickFilter.js +7 -6
- package/node/components/virtualization/GridVirtualScroller.js +5 -7
- package/node/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +5 -7
- package/node/constants/defaultGridSlotsComponents.js +4 -53
- package/node/constants/localeTextConstants.js +1 -0
- package/node/hooks/core/useGridLocaleText.js +2 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +21 -28
- package/node/hooks/features/columns/useGridColumns.js +3 -3
- package/node/hooks/features/filter/useGridFilter.js +3 -3
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +33 -16
- package/node/index.js +9 -1
- package/node/internals/index.js +94 -4
- package/node/internals/utils/computeSlots.js +23 -0
- package/node/internals/utils/index.js +27 -0
- package/node/internals/utils/slotsMigration.js +21 -0
- package/node/locales/arSD.js +15 -19
- package/node/locales/beBY.js +1 -0
- package/node/locales/bgBG.js +1 -0
- package/node/locales/csCZ.js +24 -31
- package/node/locales/daDK.js +1 -0
- package/node/locales/deDE.js +1 -0
- package/node/locales/elGR.js +1 -0
- package/node/locales/esES.js +2 -1
- package/node/locales/faIR.js +1 -0
- package/node/locales/fiFI.js +1 -0
- package/node/locales/frFR.js +1 -0
- package/node/locales/heIL.js +1 -0
- package/node/locales/huHU.js +1 -0
- package/node/locales/itIT.js +1 -0
- package/node/locales/jaJP.js +1 -0
- package/node/locales/koKR.js +1 -0
- package/node/locales/nbNO.js +1 -0
- package/node/locales/nlNL.js +1 -0
- package/node/locales/plPL.js +1 -0
- package/node/locales/ptBR.js +1 -0
- package/node/locales/roRO.js +1 -0
- package/node/locales/ruRU.js +1 -0
- package/node/locales/skSK.js +1 -0
- package/node/locales/svSE.js +1 -0
- package/node/locales/trTR.js +1 -0
- package/node/locales/ukUA.js +1 -0
- package/node/locales/urPK.js +1 -0
- package/node/locales/viVN.js +1 -0
- package/node/locales/zhCN.js +1 -0
- package/node/locales/zhTW.js +1 -0
- package/node/{components/DataGridColumnHeaders.js → material/components/MUISelectOption.js} +13 -35
- package/node/{components/columnHeaders → material/icons}/GridColumnUnsortedIcon.js +1 -1
- package/node/{components → material}/icons/index.js +10 -2
- package/node/material/index.js +73 -0
- package/node/models/gridFilterItem.js +2 -0
- package/node/models/params/gridRowParams.js +4 -0
- package/package.json +1 -1
- package/components/DataGridColumnHeaders.d.ts +0 -6
- package/components/DataGridColumnHeaders.js +0 -38
- package/components/columnHeaders/GridColumnHeaders.d.ts +0 -7
- package/legacy/components/DataGridColumnHeaders.js +0 -36
- package/modern/components/DataGridColumnHeaders.js +0 -38
- /package/{components/columnHeaders → material/icons}/GridColumnUnsortedIcon.d.ts +0 -0
|
@@ -10,9 +10,6 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _utils = require("@mui/utils");
|
|
13
|
-
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
14
|
-
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
15
|
-
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
16
13
|
var _styles = require("@mui/material/styles");
|
|
17
14
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
18
15
|
var _gridColumnsSelector = require("../../../hooks/features/columns/gridColumnsSelector");
|
|
@@ -51,7 +48,7 @@ const GridFilterFormRoot = (0, _styles.styled)('div', {
|
|
|
51
48
|
display: 'flex',
|
|
52
49
|
padding: theme.spacing(1)
|
|
53
50
|
}));
|
|
54
|
-
const FilterFormDeleteIcon = (0, _styles.styled)(
|
|
51
|
+
const FilterFormDeleteIcon = (0, _styles.styled)('div', {
|
|
55
52
|
name: 'MuiDataGrid',
|
|
56
53
|
slot: 'FilterFormDeleteIcon',
|
|
57
54
|
overridesResolver: (_, styles) => styles.filterFormDeleteIcon
|
|
@@ -63,7 +60,7 @@ const FilterFormDeleteIcon = (0, _styles.styled)(_FormControl.default, {
|
|
|
63
60
|
marginRight: theme.spacing(0.5),
|
|
64
61
|
marginBottom: theme.spacing(0.2)
|
|
65
62
|
}));
|
|
66
|
-
const FilterFormLogicOperatorInput = (0, _styles.styled)(
|
|
63
|
+
const FilterFormLogicOperatorInput = (0, _styles.styled)('div', {
|
|
67
64
|
name: 'MuiDataGrid',
|
|
68
65
|
slot: 'FilterFormLogicOperatorInput',
|
|
69
66
|
overridesResolver: (_, styles) => styles.filterFormLogicOperatorInput
|
|
@@ -72,21 +69,21 @@ const FilterFormLogicOperatorInput = (0, _styles.styled)(_FormControl.default, {
|
|
|
72
69
|
marginRight: 5,
|
|
73
70
|
justifyContent: 'end'
|
|
74
71
|
});
|
|
75
|
-
const FilterFormColumnInput = (0, _styles.styled)(
|
|
72
|
+
const FilterFormColumnInput = (0, _styles.styled)('div', {
|
|
76
73
|
name: 'MuiDataGrid',
|
|
77
74
|
slot: 'FilterFormColumnInput',
|
|
78
75
|
overridesResolver: (_, styles) => styles.filterFormColumnInput
|
|
79
76
|
})({
|
|
80
77
|
width: 150
|
|
81
78
|
});
|
|
82
|
-
const FilterFormOperatorInput = (0, _styles.styled)(
|
|
79
|
+
const FilterFormOperatorInput = (0, _styles.styled)('div', {
|
|
83
80
|
name: 'MuiDataGrid',
|
|
84
81
|
slot: 'FilterFormOperatorInput',
|
|
85
82
|
overridesResolver: (_, styles) => styles.filterFormOperatorInput
|
|
86
83
|
})({
|
|
87
84
|
width: 120
|
|
88
85
|
});
|
|
89
|
-
const FilterFormValueInput = (0, _styles.styled)(
|
|
86
|
+
const FilterFormValueInput = (0, _styles.styled)('div', {
|
|
90
87
|
name: 'MuiDataGrid',
|
|
91
88
|
slot: 'FilterFormValueInput',
|
|
92
89
|
overridesResolver: (_, styles) => styles.filterFormValueInput
|
|
@@ -134,17 +131,15 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
134
131
|
const operatorSelectId = (0, _utils.unstable_useId)();
|
|
135
132
|
const operatorSelectLabelId = (0, _utils.unstable_useId)();
|
|
136
133
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
137
|
-
const
|
|
138
|
-
classes: rootProps.classes
|
|
139
|
-
};
|
|
140
|
-
const classes = useUtilityClasses(ownerState);
|
|
134
|
+
const classes = useUtilityClasses(rootProps);
|
|
141
135
|
const valueRef = React.useRef(null);
|
|
142
136
|
const filterSelectorRef = React.useRef(null);
|
|
143
137
|
const hasLogicOperatorColumn = hasMultipleFilters && logicOperators.length > 0;
|
|
144
|
-
const baseFormControlProps = rootProps.
|
|
145
|
-
const baseSelectProps = rootProps.
|
|
138
|
+
const baseFormControlProps = rootProps.slotProps?.baseFormControl || {};
|
|
139
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
146
140
|
const isBaseSelectNative = baseSelectProps.native ?? true;
|
|
147
|
-
const
|
|
141
|
+
const baseInputLabelProps = rootProps.slotProps?.baseInputLabel || {};
|
|
142
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
148
143
|
const {
|
|
149
144
|
InputComponentProps
|
|
150
145
|
} = valueInputProps,
|
|
@@ -235,33 +230,36 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
235
230
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GridFilterFormRoot, (0, _extends2.default)({
|
|
236
231
|
ref: ref,
|
|
237
232
|
className: classes.root,
|
|
238
|
-
"data-id": item.id
|
|
233
|
+
"data-id": item.id,
|
|
234
|
+
ownerState: rootProps
|
|
239
235
|
}, other, {
|
|
240
236
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormDeleteIcon, (0, _extends2.default)({
|
|
241
237
|
variant: "standard",
|
|
242
|
-
as: rootProps.
|
|
238
|
+
as: rootProps.slots.baseFormControl
|
|
243
239
|
}, baseFormControlProps, deleteIconProps, {
|
|
244
240
|
className: (0, _clsx.default)(classes.deleteIcon, baseFormControlProps.className, deleteIconProps.className),
|
|
245
|
-
|
|
241
|
+
ownerState: rootProps,
|
|
242
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, (0, _extends2.default)({
|
|
246
243
|
"aria-label": apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
|
|
247
244
|
title: apiRef.current.getLocaleText('filterPanelDeleteIconLabel'),
|
|
248
245
|
onClick: handleDeleteFilter,
|
|
249
246
|
size: "small"
|
|
250
|
-
}, rootProps.
|
|
251
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
247
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
248
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.filterPanelDeleteIcon, {
|
|
252
249
|
fontSize: "small"
|
|
253
250
|
})
|
|
254
251
|
}))
|
|
255
252
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormLogicOperatorInput, (0, _extends2.default)({
|
|
256
253
|
variant: "standard",
|
|
257
|
-
as: rootProps.
|
|
254
|
+
as: rootProps.slots.baseFormControl
|
|
258
255
|
}, baseFormControlProps, logicOperatorInputProps, {
|
|
259
256
|
sx: (0, _extends2.default)({
|
|
260
257
|
display: hasLogicOperatorColumn ? 'flex' : 'none',
|
|
261
258
|
visibility: showMultiFilterOperators ? 'visible' : 'hidden'
|
|
262
259
|
}, baseFormControlProps.sx || {}, logicOperatorInputProps.sx || {}),
|
|
263
260
|
className: (0, _clsx.default)(classes.logicOperatorInput, baseFormControlProps.className, logicOperatorInputProps.className),
|
|
264
|
-
|
|
261
|
+
ownerState: rootProps,
|
|
262
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
265
263
|
inputProps: {
|
|
266
264
|
'aria-label': apiRef.current.getLocaleText('filterPanelLogicOperator')
|
|
267
265
|
},
|
|
@@ -269,44 +267,48 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
269
267
|
onChange: changeLogicOperator,
|
|
270
268
|
disabled: !!disableMultiFilterOperator || logicOperators.length === 1,
|
|
271
269
|
native: isBaseSelectNative
|
|
272
|
-
}, rootProps.
|
|
273
|
-
children: logicOperators.map(logicOperator => /*#__PURE__*/(0,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
270
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
271
|
+
children: logicOperators.map(logicOperator => /*#__PURE__*/(0, React.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
272
|
+
native: isBaseSelectNative,
|
|
273
|
+
key: logicOperator.toString(),
|
|
274
|
+
value: logicOperator.toString()
|
|
275
|
+
}), apiRef.current.getLocaleText(getLogicOperatorLocaleKey(logicOperator))))
|
|
277
276
|
}))
|
|
278
277
|
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(FilterFormColumnInput, (0, _extends2.default)({
|
|
279
278
|
variant: "standard",
|
|
280
|
-
as: rootProps.
|
|
279
|
+
as: rootProps.slots.baseFormControl
|
|
281
280
|
}, baseFormControlProps, columnInputProps, {
|
|
282
281
|
className: (0, _clsx.default)(classes.columnInput, baseFormControlProps.className, columnInputProps.className),
|
|
283
|
-
|
|
282
|
+
ownerState: rootProps,
|
|
283
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputLabel, (0, _extends2.default)({}, baseInputLabelProps, {
|
|
284
284
|
htmlFor: columnSelectId,
|
|
285
285
|
id: columnSelectLabelId,
|
|
286
286
|
children: apiRef.current.getLocaleText('filterPanelColumns')
|
|
287
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
287
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
288
288
|
labelId: columnSelectLabelId,
|
|
289
289
|
id: columnSelectId,
|
|
290
290
|
label: apiRef.current.getLocaleText('filterPanelColumns'),
|
|
291
291
|
value: item.field || '',
|
|
292
292
|
onChange: changeColumn,
|
|
293
293
|
native: isBaseSelectNative
|
|
294
|
-
}, rootProps.
|
|
295
|
-
children: sortedFilteredColumns.map(col => /*#__PURE__*/(0,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
294
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
295
|
+
children: sortedFilteredColumns.map(col => /*#__PURE__*/(0, React.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
296
|
+
native: isBaseSelectNative,
|
|
297
|
+
key: col.field,
|
|
298
|
+
value: col.field
|
|
299
|
+
}), getColumnLabel(col)))
|
|
299
300
|
}))]
|
|
300
301
|
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(FilterFormOperatorInput, (0, _extends2.default)({
|
|
301
302
|
variant: "standard",
|
|
302
|
-
as: rootProps.
|
|
303
|
+
as: rootProps.slots.baseFormControl
|
|
303
304
|
}, baseFormControlProps, operatorInputProps, {
|
|
304
305
|
className: (0, _clsx.default)(classes.operatorInput, baseFormControlProps.className, operatorInputProps.className),
|
|
305
|
-
|
|
306
|
+
ownerState: rootProps,
|
|
307
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputLabel, (0, _extends2.default)({}, baseInputLabelProps, {
|
|
306
308
|
htmlFor: operatorSelectId,
|
|
307
309
|
id: operatorSelectLabelId,
|
|
308
310
|
children: apiRef.current.getLocaleText('filterPanelOperator')
|
|
309
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
311
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
310
312
|
labelId: operatorSelectLabelId,
|
|
311
313
|
label: apiRef.current.getLocaleText('filterPanelOperator'),
|
|
312
314
|
id: operatorSelectId,
|
|
@@ -314,17 +316,19 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
314
316
|
onChange: changeOperator,
|
|
315
317
|
native: isBaseSelectNative,
|
|
316
318
|
inputRef: filterSelectorRef
|
|
317
|
-
}, rootProps.
|
|
318
|
-
children: currentColumn?.filterOperators?.map(operator => /*#__PURE__*/(0,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
320
|
+
children: currentColumn?.filterOperators?.map(operator => /*#__PURE__*/(0, React.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
321
|
+
native: isBaseSelectNative,
|
|
322
|
+
key: operator.value,
|
|
323
|
+
value: operator.value
|
|
324
|
+
}), operator.label || apiRef.current.getLocaleText(`filterOperator${(0, _utils.unstable_capitalize)(operator.value)}`)))
|
|
322
325
|
}))]
|
|
323
326
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormValueInput, (0, _extends2.default)({
|
|
324
327
|
variant: "standard",
|
|
325
|
-
as: rootProps.
|
|
328
|
+
as: rootProps.slots.baseFormControl
|
|
326
329
|
}, baseFormControlProps, valueInputPropsOther, {
|
|
327
330
|
className: (0, _clsx.default)(classes.valueInput, baseFormControlProps.className, valueInputPropsOther.className),
|
|
331
|
+
ownerState: rootProps,
|
|
328
332
|
children: currentOperator?.InputComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(currentOperator.InputComponent, (0, _extends2.default)({
|
|
329
333
|
apiRef: apiRef,
|
|
330
334
|
item: item,
|
|
@@ -8,7 +8,6 @@ exports.GridFilterInputBoolean = GridFilterInputBoolean;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
12
11
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
13
|
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
@@ -24,9 +23,9 @@ function GridFilterInputBoolean(props) {
|
|
|
24
23
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
25
24
|
const [filterValueState, setFilterValueState] = React.useState(item.value || '');
|
|
26
25
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
27
|
-
const baseSelectProps = rootProps.
|
|
26
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
28
27
|
const isSelectNative = baseSelectProps.native ?? true;
|
|
29
|
-
const
|
|
28
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
30
29
|
const onFilterChange = React.useCallback(event => {
|
|
31
30
|
const value = event.target.value;
|
|
32
31
|
setFilterValueState(value);
|
|
@@ -37,7 +36,8 @@ function GridFilterInputBoolean(props) {
|
|
|
37
36
|
React.useEffect(() => {
|
|
38
37
|
setFilterValueState(item.value || '');
|
|
39
38
|
}, [item.value]);
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(rootProps.
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(rootProps.slots.baseTextField, (0, _extends2.default)({
|
|
40
|
+
// TODO: use baseSelect slot
|
|
41
41
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
42
42
|
value: filterValueState,
|
|
43
43
|
onChange: onFilterChange,
|
|
@@ -46,21 +46,24 @@ function GridFilterInputBoolean(props) {
|
|
|
46
46
|
SelectProps: (0, _extends2.default)({
|
|
47
47
|
native: isSelectNative,
|
|
48
48
|
displayEmpty: true
|
|
49
|
-
}, rootProps.
|
|
49
|
+
}, rootProps.slotProps?.baseSelect),
|
|
50
50
|
InputLabelProps: {
|
|
51
51
|
shrink: true
|
|
52
52
|
},
|
|
53
53
|
inputRef: focusElementRef
|
|
54
|
-
}, others, rootProps.
|
|
55
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
54
|
+
}, others, rootProps.slotProps?.baseTextField, {
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
56
|
+
native: isSelectNative,
|
|
56
57
|
value: "",
|
|
57
58
|
children: apiRef.current.getLocaleText('filterValueAny')
|
|
58
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
59
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
60
|
+
native: isSelectNative,
|
|
59
61
|
value: "true",
|
|
60
62
|
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
61
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
63
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
64
|
+
native: isSelectNative,
|
|
62
65
|
value: "false",
|
|
63
66
|
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
64
|
-
})]
|
|
67
|
+
}))]
|
|
65
68
|
}));
|
|
66
69
|
}
|
|
@@ -11,7 +11,6 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
-
var _icons = require("../../icons");
|
|
15
14
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
16
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
16
|
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "InputProps"];
|
|
@@ -55,7 +54,7 @@ function GridFilterInputDate(props) {
|
|
|
55
54
|
const itemValue = item.value ?? '';
|
|
56
55
|
setFilterValueState(String(itemValue));
|
|
57
56
|
}, [item.value]);
|
|
58
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({
|
|
59
58
|
id: id,
|
|
60
59
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
61
60
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -68,13 +67,13 @@ function GridFilterInputDate(props) {
|
|
|
68
67
|
},
|
|
69
68
|
inputRef: focusElementRef,
|
|
70
69
|
InputProps: (0, _extends2.default)({}, applying ? {
|
|
71
|
-
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
70
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.loadIcon, {})
|
|
72
71
|
} : {}, InputProps, {
|
|
73
72
|
inputProps: (0, _extends2.default)({
|
|
74
73
|
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31'
|
|
75
74
|
}, InputProps?.inputProps)
|
|
76
75
|
})
|
|
77
|
-
}, other, rootProps.
|
|
76
|
+
}, other, rootProps.slotProps?.baseTextField));
|
|
78
77
|
}
|
|
79
78
|
process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
80
79
|
// ----------------------------- Warning --------------------------------
|
|
@@ -15,10 +15,9 @@ var _utils = require("@mui/utils");
|
|
|
15
15
|
var _filterPanelUtils = require("./filterPanelUtils");
|
|
16
16
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant", "getOptionLabel"];
|
|
18
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant", "getOptionLabel", "getOptionValue"];
|
|
19
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
const isOptionEqualToValue = (option, value) => (0, _filterPanelUtils.getValueFromOption)(option) === (0, _filterPanelUtils.getValueFromOption)(value);
|
|
22
21
|
const filter = (0, _Autocomplete.createFilterOptions)();
|
|
23
22
|
function GridFilterInputMultipleSingleSelect(props) {
|
|
24
23
|
const {
|
|
@@ -31,7 +30,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
31
30
|
helperText,
|
|
32
31
|
size,
|
|
33
32
|
variant = 'standard',
|
|
34
|
-
getOptionLabel
|
|
33
|
+
getOptionLabel: getOptionLabelProp,
|
|
34
|
+
getOptionValue: getOptionValueProp
|
|
35
35
|
} = props,
|
|
36
36
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
37
37
|
const TextFieldProps = {
|
|
@@ -50,6 +50,9 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
50
50
|
resolvedColumn = column;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
const getOptionValue = getOptionValueProp || resolvedColumn?.getOptionValue;
|
|
54
|
+
const getOptionLabel = getOptionLabelProp || resolvedColumn?.getOptionLabel;
|
|
55
|
+
const isOptionEqualToValue = React.useCallback((option, value) => getOptionValue(option) === getOptionValue(value), [getOptionValue]);
|
|
53
56
|
const resolvedValueOptions = React.useMemo(() => {
|
|
54
57
|
if (!resolvedColumn?.valueOptions) {
|
|
55
58
|
return [];
|
|
@@ -62,8 +65,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
62
65
|
return resolvedColumn.valueOptions;
|
|
63
66
|
}, [resolvedColumn]);
|
|
64
67
|
const resolvedFormattedValueOptions = React.useMemo(() => {
|
|
65
|
-
return resolvedValueOptions?.map(
|
|
66
|
-
}, [resolvedValueOptions]);
|
|
68
|
+
return resolvedValueOptions?.map(getOptionValue);
|
|
69
|
+
}, [resolvedValueOptions, getOptionValue]);
|
|
67
70
|
|
|
68
71
|
// The value is computed from the item.value and used directly
|
|
69
72
|
// If it was done by a useEffect/useState, the Autocomplete could receive incoherent value and options
|
|
@@ -73,10 +76,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
73
76
|
}
|
|
74
77
|
if (resolvedValueOptions !== undefined) {
|
|
75
78
|
const itemValueIndexes = item.value.map(element => {
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
const index = resolvedFormattedValueOptions?.findIndex(formatedOption => formatedOption === formattedElement) || 0;
|
|
79
|
-
return index;
|
|
79
|
+
// Gets the index matching between values and valueOptions
|
|
80
|
+
return resolvedFormattedValueOptions?.findIndex(formatedOption => formatedOption === element);
|
|
80
81
|
});
|
|
81
82
|
return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
|
|
82
83
|
}
|
|
@@ -86,15 +87,15 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
86
87
|
if (!Array.isArray(item.value) || filteredValues.length !== item.value.length) {
|
|
87
88
|
// Updates the state if the filter value has been cleaned by the component
|
|
88
89
|
applyValue((0, _extends2.default)({}, item, {
|
|
89
|
-
value: filteredValues.map(
|
|
90
|
+
value: filteredValues.map(getOptionValue)
|
|
90
91
|
}));
|
|
91
92
|
}
|
|
92
|
-
}, [item, filteredValues, applyValue]);
|
|
93
|
+
}, [item, filteredValues, applyValue, getOptionValue]);
|
|
93
94
|
const handleChange = React.useCallback((event, value) => {
|
|
94
95
|
applyValue((0, _extends2.default)({}, item, {
|
|
95
|
-
value:
|
|
96
|
+
value: value.map(getOptionValue)
|
|
96
97
|
}));
|
|
97
|
-
}, [applyValue, item]);
|
|
98
|
+
}, [applyValue, item, getOptionValue]);
|
|
98
99
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, (0, _extends2.default)({
|
|
99
100
|
multiple: true,
|
|
100
101
|
options: resolvedValueOptions,
|
|
@@ -111,7 +112,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
111
112
|
}, getTagProps({
|
|
112
113
|
index
|
|
113
114
|
})))),
|
|
114
|
-
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
115
|
+
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({}, params, {
|
|
115
116
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
116
117
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
117
118
|
InputLabelProps: (0, _extends2.default)({}, params.InputLabelProps, {
|
|
@@ -119,7 +120,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
119
120
|
}),
|
|
120
121
|
inputRef: focusElementRef,
|
|
121
122
|
type: "singleSelect"
|
|
122
|
-
}, TextFieldProps, rootProps.
|
|
123
|
+
}, TextFieldProps, rootProps.slotProps?.baseTextField))
|
|
123
124
|
}, other));
|
|
124
125
|
}
|
|
125
126
|
process.env.NODE_ENV !== "production" ? GridFilterInputMultipleSingleSelect.propTypes = {
|
|
@@ -133,11 +134,17 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleSingleSelect.prop
|
|
|
133
134
|
applyValue: _propTypes.default.func.isRequired,
|
|
134
135
|
focusElementRef: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
135
136
|
/**
|
|
136
|
-
* Used to determine the
|
|
137
|
+
* Used to determine the label displayed for a given value option.
|
|
137
138
|
* @param {ValueOptions} value The current value option.
|
|
138
139
|
* @returns {string} The text to be displayed.
|
|
139
140
|
*/
|
|
140
141
|
getOptionLabel: _propTypes.default.func,
|
|
142
|
+
/**
|
|
143
|
+
* Used to determine the value used for a value option.
|
|
144
|
+
* @param {ValueOptions} value The current value option.
|
|
145
|
+
* @returns {string} The value to be used.
|
|
146
|
+
*/
|
|
147
|
+
getOptionValue: _propTypes.default.func,
|
|
141
148
|
item: _propTypes.default.shape({
|
|
142
149
|
field: _propTypes.default.string.isRequired,
|
|
143
150
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -71,7 +71,7 @@ function GridFilterInputMultipleValue(props) {
|
|
|
71
71
|
}, getTagProps({
|
|
72
72
|
index
|
|
73
73
|
})))),
|
|
74
|
-
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
74
|
+
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({}, params, {
|
|
75
75
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
76
76
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
77
77
|
InputLabelProps: (0, _extends2.default)({}, params.InputLabelProps, {
|
|
@@ -79,7 +79,7 @@ function GridFilterInputMultipleValue(props) {
|
|
|
79
79
|
}),
|
|
80
80
|
inputRef: focusElementRef,
|
|
81
81
|
type: type || 'text'
|
|
82
|
-
}, TextFieldProps, rootProps.
|
|
82
|
+
}, TextFieldProps, rootProps.slotProps?.baseTextField))
|
|
83
83
|
}, other));
|
|
84
84
|
}
|
|
85
85
|
process.env.NODE_ENV !== "production" ? GridFilterInputMultipleValue.propTypes = {
|
|
@@ -5,33 +5,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.GridFilterInputSingleSelect = GridFilterInputSingleSelect;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
8
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _utils = require("@mui/utils");
|
|
13
|
-
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
14
13
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
15
14
|
var _filterPanelUtils = require("./filterPanelUtils");
|
|
16
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel"];
|
|
16
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue"];
|
|
18
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
19
|
const renderSingleSelectOptions = ({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
column: {
|
|
21
|
+
valueOptions,
|
|
22
|
+
field
|
|
23
|
+
},
|
|
24
|
+
OptionComponent,
|
|
25
|
+
getOptionLabel,
|
|
26
|
+
getOptionValue,
|
|
27
|
+
isSelectNative,
|
|
28
|
+
baseSelectOptionProps
|
|
29
|
+
}) => {
|
|
24
30
|
const iterableColumnValues = typeof valueOptions === 'function' ? ['', ...valueOptions({
|
|
25
31
|
field
|
|
26
32
|
})] : ['', ...(valueOptions || [])];
|
|
27
33
|
return iterableColumnValues.map(option => {
|
|
28
|
-
const
|
|
29
|
-
const value = isOptionTypeObject ? option.value : option;
|
|
34
|
+
const value = getOptionValue(option);
|
|
30
35
|
const label = getOptionLabel(option);
|
|
31
|
-
return /*#__PURE__*/(0,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
return /*#__PURE__*/(0, React.createElement)(OptionComponent, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
37
|
+
native: isSelectNative,
|
|
38
|
+
key: value,
|
|
39
|
+
value: value
|
|
40
|
+
}), label);
|
|
35
41
|
});
|
|
36
42
|
};
|
|
37
43
|
function GridFilterInputSingleSelect(props) {
|
|
@@ -41,14 +47,16 @@ function GridFilterInputSingleSelect(props) {
|
|
|
41
47
|
type,
|
|
42
48
|
apiRef,
|
|
43
49
|
focusElementRef,
|
|
44
|
-
getOptionLabel
|
|
50
|
+
getOptionLabel: getOptionLabelProp,
|
|
51
|
+
getOptionValue: getOptionValueProp
|
|
45
52
|
} = props,
|
|
46
53
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
47
54
|
const [filterValueState, setFilterValueState] = React.useState(item.value ?? '');
|
|
48
55
|
const id = (0, _utils.unstable_useId)();
|
|
49
56
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
50
|
-
const baseSelectProps = rootProps.
|
|
57
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
51
58
|
const isSelectNative = baseSelectProps.native ?? true;
|
|
59
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
52
60
|
let resolvedColumn = null;
|
|
53
61
|
if (item.field) {
|
|
54
62
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -56,6 +64,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
56
64
|
resolvedColumn = column;
|
|
57
65
|
}
|
|
58
66
|
}
|
|
67
|
+
const getOptionValue = getOptionValueProp || resolvedColumn?.getOptionValue;
|
|
68
|
+
const getOptionLabel = getOptionLabelProp || resolvedColumn?.getOptionLabel;
|
|
59
69
|
const currentValueOptions = React.useMemo(() => {
|
|
60
70
|
if (!resolvedColumn) {
|
|
61
71
|
return undefined;
|
|
@@ -68,17 +78,17 @@ function GridFilterInputSingleSelect(props) {
|
|
|
68
78
|
let value = event.target.value;
|
|
69
79
|
|
|
70
80
|
// NativeSelect casts the value to a string.
|
|
71
|
-
value = (0, _filterPanelUtils.getValueFromValueOptions)(value, currentValueOptions);
|
|
81
|
+
value = (0, _filterPanelUtils.getValueFromValueOptions)(value, currentValueOptions, getOptionValue);
|
|
72
82
|
setFilterValueState(String(value));
|
|
73
83
|
applyValue((0, _extends2.default)({}, item, {
|
|
74
84
|
value
|
|
75
85
|
}));
|
|
76
|
-
}, [applyValue, item
|
|
86
|
+
}, [currentValueOptions, getOptionValue, applyValue, item]);
|
|
77
87
|
React.useEffect(() => {
|
|
78
88
|
let itemValue;
|
|
79
89
|
if (currentValueOptions !== undefined) {
|
|
80
90
|
// sanitize if valueOptions are provided
|
|
81
|
-
itemValue = (0, _filterPanelUtils.getValueFromValueOptions)(item.value, currentValueOptions);
|
|
91
|
+
itemValue = (0, _filterPanelUtils.getValueFromValueOptions)(item.value, currentValueOptions, getOptionValue);
|
|
82
92
|
if (itemValue !== item.value) {
|
|
83
93
|
applyValue((0, _extends2.default)({}, item, {
|
|
84
94
|
value: itemValue
|
|
@@ -90,11 +100,15 @@ function GridFilterInputSingleSelect(props) {
|
|
|
90
100
|
}
|
|
91
101
|
itemValue = itemValue ?? '';
|
|
92
102
|
setFilterValueState(String(itemValue));
|
|
93
|
-
}, [item, currentValueOptions, applyValue]);
|
|
103
|
+
}, [item, currentValueOptions, applyValue, getOptionValue]);
|
|
94
104
|
if (!(0, _filterPanelUtils.isSingleSelectColDef)(resolvedColumn)) {
|
|
95
105
|
return null;
|
|
96
106
|
}
|
|
97
|
-
|
|
107
|
+
if (!(0, _filterPanelUtils.isSingleSelectColDef)(resolvedColumn)) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({
|
|
111
|
+
// TODO: use baseSelect slot
|
|
98
112
|
id: id,
|
|
99
113
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
100
114
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -109,9 +123,16 @@ function GridFilterInputSingleSelect(props) {
|
|
|
109
123
|
select: true,
|
|
110
124
|
SelectProps: (0, _extends2.default)({
|
|
111
125
|
native: isSelectNative
|
|
112
|
-
}, rootProps.
|
|
113
|
-
}, others, rootProps.
|
|
114
|
-
children: renderSingleSelectOptions(
|
|
126
|
+
}, rootProps.slotProps?.baseSelect)
|
|
127
|
+
}, others, rootProps.slotProps?.baseTextField, {
|
|
128
|
+
children: renderSingleSelectOptions({
|
|
129
|
+
column: resolvedColumn,
|
|
130
|
+
OptionComponent: rootProps.slots.baseSelectOption,
|
|
131
|
+
getOptionLabel,
|
|
132
|
+
getOptionValue,
|
|
133
|
+
isSelectNative,
|
|
134
|
+
baseSelectOptionProps
|
|
135
|
+
})
|
|
115
136
|
}));
|
|
116
137
|
}
|
|
117
138
|
process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
|
|
@@ -125,11 +146,17 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
125
146
|
applyValue: _propTypes.default.func.isRequired,
|
|
126
147
|
focusElementRef: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
127
148
|
/**
|
|
128
|
-
* Used to determine the
|
|
149
|
+
* Used to determine the label displayed for a given value option.
|
|
129
150
|
* @param {ValueOptions} value The current value option.
|
|
130
151
|
* @returns {string} The text to be displayed.
|
|
131
152
|
*/
|
|
132
153
|
getOptionLabel: _propTypes.default.func,
|
|
154
|
+
/**
|
|
155
|
+
* Used to determine the value used for a value option.
|
|
156
|
+
* @param {ValueOptions} value The current value option.
|
|
157
|
+
* @returns {string} The value to be used.
|
|
158
|
+
*/
|
|
159
|
+
getOptionValue: _propTypes.default.func,
|
|
133
160
|
item: _propTypes.default.shape({
|
|
134
161
|
field: _propTypes.default.string.isRequired,
|
|
135
162
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -11,7 +11,6 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
-
var _icons = require("../../icons");
|
|
15
14
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
16
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
16
|
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
@@ -57,9 +56,9 @@ function GridFilterInputValue(props) {
|
|
|
57
56
|
setFilterValueState(String(itemValue));
|
|
58
57
|
}, [item.value]);
|
|
59
58
|
const InputProps = applying ? {
|
|
60
|
-
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
59
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.loadIcon, {})
|
|
61
60
|
} : others.InputProps;
|
|
62
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({
|
|
63
62
|
id: id,
|
|
64
63
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
65
64
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -72,7 +71,7 @@ function GridFilterInputValue(props) {
|
|
|
72
71
|
shrink: true
|
|
73
72
|
},
|
|
74
73
|
inputRef: focusElementRef
|
|
75
|
-
}, others, rootProps.
|
|
74
|
+
}, others, rootProps.slotProps?.baseTextField));
|
|
76
75
|
}
|
|
77
76
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
78
77
|
// ----------------------------- Warning --------------------------------
|