From 988b10bc051c10d6a10a58b12232a99f22678091 Mon Sep 17 00:00:00 2001 From: Rajat Date: Thu, 5 Sep 2024 13:59:31 +0530 Subject: [PATCH 1/4] fix: pass disabled InputComponent for isEmpty and isNotEmpty filter operator --- packages/x-data-grid/src/colDef/gridDateOperators.ts | 4 ++++ packages/x-data-grid/src/colDef/gridNumericOperators.ts | 4 ++++ packages/x-data-grid/src/colDef/gridStringOperators.ts | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/packages/x-data-grid/src/colDef/gridDateOperators.ts b/packages/x-data-grid/src/colDef/gridDateOperators.ts index fb05f45fa824e..d4575bc0db051 100644 --- a/packages/x-data-grid/src/colDef/gridDateOperators.ts +++ b/packages/x-data-grid/src/colDef/gridDateOperators.ts @@ -109,6 +109,8 @@ export const getGridDateOperators = (showTime?: boolean): GridFilterOperator Date: Fri, 6 Sep 2024 12:02:29 +0530 Subject: [PATCH 2/4] fix: filter rendering issue for isEmpty and isNotEmpt yfilter operators --- .../headerFiltering/GridHeaderFilterCell.tsx | 22 +++++++++++++++++-- .../src/colDef/gridDateOperators.ts | 4 ---- .../src/colDef/gridNumericOperators.ts | 4 ---- .../src/colDef/gridStringOperators.ts | 4 ---- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx b/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx index 1d22e87939585..f36d3801ed72a 100644 --- a/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx +++ b/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx @@ -15,6 +15,11 @@ import { gridVisibleColumnFieldsSelector, getDataGridUtilityClass, useGridSelector, + GridFilterInputValue, + GridFilterInputDate, + GridFilterInputBoolean, + GridColType, + GridFilterInputSingleSelect, gridFilterModelSelector, gridFilterableColumnLookupSelector, GridPinnedColumnPosition, @@ -86,7 +91,18 @@ const useUtilityClasses = (ownerState: OwnerState) => { const dateSx = { [`& input[value=""]:not(:focus)`]: { color: 'transparent' }, }; - +const defaultInputComponents: { + [key in GridColType]: React.JSXElementConstructor | null; +} = { + string: GridFilterInputValue, + number: GridFilterInputValue, + date: GridFilterInputDate, + dateTime: GridFilterInputDate, + boolean: GridFilterInputBoolean, + singleSelect: GridFilterInputSingleSelect, + actions: null, + custom: null, +}; const GridHeaderFilterCell = React.forwardRef( (props, ref) => { const { @@ -147,7 +163,9 @@ const GridHeaderFilterCell = React.forwardRef { diff --git a/packages/x-data-grid/src/colDef/gridDateOperators.ts b/packages/x-data-grid/src/colDef/gridDateOperators.ts index d4575bc0db051..fb05f45fa824e 100644 --- a/packages/x-data-grid/src/colDef/gridDateOperators.ts +++ b/packages/x-data-grid/src/colDef/gridDateOperators.ts @@ -109,8 +109,6 @@ export const getGridDateOperators = (showTime?: boolean): GridFilterOperator Date: Fri, 6 Sep 2024 14:58:24 +0500 Subject: [PATCH 3/4] CI From 74d04b2825e241b4743e4bb65fcbc4b73e6d280d Mon Sep 17 00:00:00 2001 From: Bilal Shafi Date: Fri, 6 Sep 2024 15:12:38 +0500 Subject: [PATCH 4/4] Lint --- .../src/components/headerFiltering/GridHeaderFilterCell.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx b/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx index f36d3801ed72a..58ba0623f1bd2 100644 --- a/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx +++ b/packages/x-data-grid-pro/src/components/headerFiltering/GridHeaderFilterCell.tsx @@ -91,9 +91,7 @@ const useUtilityClasses = (ownerState: OwnerState) => { const dateSx = { [`& input[value=""]:not(:focus)`]: { color: 'transparent' }, }; -const defaultInputComponents: { - [key in GridColType]: React.JSXElementConstructor | null; -} = { +const defaultInputComponents: { [key in GridColType]: React.JSXElementConstructor | null } = { string: GridFilterInputValue, number: GridFilterInputValue, date: GridFilterInputDate,