From 3ee16b68a26719faca097cfd40a530596ff9e2b6 Mon Sep 17 00:00:00 2001 From: Jean Dessane Date: Mon, 14 Nov 2022 18:13:16 +0100 Subject: [PATCH] fix(SelectFilter): all value --- src/filter/SelectFilter/SelectFilter.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/filter/SelectFilter/SelectFilter.tsx b/src/filter/SelectFilter/SelectFilter.tsx index ae404f8c..e916448b 100644 --- a/src/filter/SelectFilter/SelectFilter.tsx +++ b/src/filter/SelectFilter/SelectFilter.tsx @@ -7,10 +7,10 @@ import { Column } from '../../index' export const SelectFilter = React.forwardRef( (props, ref) => { - const { options, multi = false, column, ...other } = props + const { options, multi = false, column, allValue = 'all', ...other } = props const defaultValue = React.useMemo( - () => (multi || !other.canSelectAll ? undefined : 'all'), - [multi, other.canSelectAll] + () => (multi || !other.canSelectAll ? undefined : allValue), + [multi, other.canSelectAll, allValue] ) const filter = column.filterValue const handleChange = column.setFilter @@ -25,8 +25,8 @@ export const SelectFilter = React.forwardRef( () => multi || !other.canSelectAll ? options - : [{ value: 'all', label: 'Tout' }, ...options], - [options, multi, other.canSelectAll] + : [{ value: allValue, label: 'Tout' }, ...options], + [options, multi, other.canSelectAll, allValue] ) return ( @@ -49,4 +49,6 @@ export const SelectFilter = React.forwardRef( export interface SelectFilterProps extends SelectProps { column: Column + /** @default all */ + allValue?: any }