From 8cead561a3a23fe33947051961fc224ee697439e Mon Sep 17 00:00:00 2001 From: Kenan Yusuf Date: Mon, 25 Nov 2024 12:47:01 +0000 Subject: [PATCH] [DataGrid] Fix order of spread props on toolbar items (#15556) --- .../toolbar/GridToolbarColumnsButton.tsx | 4 ++-- .../toolbar/GridToolbarDensitySelector.tsx | 4 ++-- .../toolbar/GridToolbarExportContainer.tsx | 4 ++-- .../toolbar/GridToolbarFilterButton.tsx | 19 +++++++++++++++---- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/packages/x-data-grid/src/components/toolbar/GridToolbarColumnsButton.tsx b/packages/x-data-grid/src/components/toolbar/GridToolbarColumnsButton.tsx index 67a176845fac..bc5568608b26 100644 --- a/packages/x-data-grid/src/components/toolbar/GridToolbarColumnsButton.tsx +++ b/packages/x-data-grid/src/components/toolbar/GridToolbarColumnsButton.tsx @@ -57,8 +57,8 @@ const GridToolbarColumnsButton = React.forwardRef } - {...buttonProps} onClick={showColumns} {...rootProps.slotProps?.baseButton} + {...buttonProps} > {apiRef.current.getLocaleText('toolbarColumns')} diff --git a/packages/x-data-grid/src/components/toolbar/GridToolbarDensitySelector.tsx b/packages/x-data-grid/src/components/toolbar/GridToolbarDensitySelector.tsx index 5e185987fa16..243382bccc81 100644 --- a/packages/x-data-grid/src/components/toolbar/GridToolbarDensitySelector.tsx +++ b/packages/x-data-grid/src/components/toolbar/GridToolbarDensitySelector.tsx @@ -112,8 +112,8 @@ const GridToolbarDensitySelector = React.forwardRef< {apiRef.current.getLocaleText('toolbarDensity')} diff --git a/packages/x-data-grid/src/components/toolbar/GridToolbarExportContainer.tsx b/packages/x-data-grid/src/components/toolbar/GridToolbarExportContainer.tsx index 2c00e4ba0b8b..e56ea330eafb 100644 --- a/packages/x-data-grid/src/components/toolbar/GridToolbarExportContainer.tsx +++ b/packages/x-data-grid/src/components/toolbar/GridToolbarExportContainer.tsx @@ -60,8 +60,8 @@ const GridToolbarExportContainer = React.forwardRef< {apiRef.current.getLocaleText('toolbarExport')} diff --git a/packages/x-data-grid/src/components/toolbar/GridToolbarFilterButton.tsx b/packages/x-data-grid/src/components/toolbar/GridToolbarFilterButton.tsx index 5f7bbb6f473f..29a4a8c637f6 100644 --- a/packages/x-data-grid/src/components/toolbar/GridToolbarFilterButton.tsx +++ b/packages/x-data-grid/src/components/toolbar/GridToolbarFilterButton.tsx @@ -8,6 +8,7 @@ import { } from '@mui/utils'; import { ButtonProps } from '@mui/material/Button'; import { TooltipProps } from '@mui/material/Tooltip'; +import { BadgeProps } from '@mui/material/Badge'; import { gridColumnLookupSelector } from '../../hooks/features/columns/gridColumnsSelector'; import { useGridSelector } from '../../hooks/utils/useGridSelector'; import { gridFilterActiveItemsSelector } from '../../hooks/features/filter/gridFilterSelector'; @@ -46,7 +47,11 @@ export interface GridToolbarFilterButtonProps { * The props used for each slot inside. * @default {} */ - slotProps?: { button?: Partial; tooltip?: Partial }; + slotProps?: { + button?: Partial; + tooltip?: Partial; + badge?: Partial; + }; } const GridToolbarFilterButton = React.forwardRef( @@ -54,6 +59,7 @@ const GridToolbarFilterButton = React.forwardRef + } - {...buttonProps} onClick={toggleFilter} {...rootProps.slotProps?.baseButton} + {...buttonProps} > {apiRef.current.getLocaleText('toolbarFilters')}