Sammy/t 192 aau whan i select does not include it is (#99)

* feature: add operand list to filters

* feature: implement not include

* feature: add operand on filters

* feature: use filters operand instead of defaults

* test: adapt test with new operands

* refactor: remove useless %% in gql where

* test: test fullname filter

* test: add test for where rendering of filters
This commit is contained in:
Sammy Teillet
2023-05-05 10:25:06 +02:00
committed by GitHub
parent 89dc5b4d60
commit 9cd57083f1
10 changed files with 243 additions and 80 deletions

View File

@ -16,22 +16,29 @@ export type SelectedSortType<SortField = string> = SortType<SortField> & {
order: 'asc' | 'desc';
};
export type FilterType<WhereTemplate, T = Record<string, string>> = {
export type FilterType<WhereTemplate, FilterValue = Record<string, any>> = {
operands: FilterOperandType[];
label: string;
key: string;
icon: ReactNode;
whereTemplate: (operand: FilterOperandType, value: T) => WhereTemplate;
whereTemplate: (
operand: FilterOperandType,
value: FilterValue,
) => WhereTemplate;
searchQuery: DocumentNode;
searchTemplate: (
searchInput: string,
) => People_Bool_Exp | Companies_Bool_Exp | Users_Bool_Exp;
searchResultMapper: (data: any) => { displayValue: string; value: T };
searchResultMapper: (data: any) => {
displayValue: string;
value: FilterValue;
};
};
export type FilterOperandType = {
label: string;
id: string;
keyWord: 'ilike' | 'not_ilike';
keyWord: 'ilike' | 'not_ilike' | 'equal' | 'not_equal';
};
export type SelectedFilterType<WhereTemplate> = FilterType<WhereTemplate> & {