Skip to content

Commit

Permalink
fix: add arrIncludes for multi select filter
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrojcm committed Mar 31, 2024
1 parent 59c99c2 commit c195d79
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ export const MRT_FilterTextInput = <TData extends MRT_RowData>({
<Badge
className={classes['filter-chip-badge']}
onClick={handleClearEmptyFilterChip}
rightSection={ClearButton}
size="lg"
>
{filterChipLabel}
Expand All @@ -271,6 +270,7 @@ export const MRT_FilterTextInput = <TData extends MRT_RowData>({
) : isMultiSelectFilter ? (
<MultiSelect
{...commonProps}
clearable
searchable
{...multiSelectProps}
className={clsx(className, multiSelectProps.className)}
Expand All @@ -287,6 +287,7 @@ export const MRT_FilterTextInput = <TData extends MRT_RowData>({
}}
rightSection={filterValue?.toString()?.length ? ClearButton : undefined}
style={commonProps.style}
value={Array.isArray(commonProps?.value) ? commonProps.value : []}
/>
) : isSelectFilter ? (
<Select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ export const mrtFilterOptions = (
option: 'notEmpty',
symbol: '!∅',
},
{
divider: false,
label: localization.filterArrIncludes,
option: 'arrIncludes',
symbol: '∈',
},
{
divider: false,
label: localization.filterArrIncludesAll,
option: 'arrIncludesAll',
symbol: '=',
},
];

const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,18 @@ export const EnableFilterModes = () => (
},
{
accessorKey: 'state',
columnFilterModeOptions: [
'empty',
'notEmpty',
'arrIncludes',
'arrIncludesAll',
'arrIncludesSome',
],
filterVariant: 'multi-select',
header: 'State',
mantineFilterMultiSelectProps: {
data: Array.from(new Set(data.map((d) => d.state))),
},
},
]}
data={data}
Expand Down

0 comments on commit c195d79

Please sign in to comment.