Add all filters to tables + make column width fixed (#133)

* Add additional filters on companies and people page

* Make colunn width fixed

* Remove duplicate declaration of Unknown type
This commit is contained in:
Charles Bochet
2023-05-21 22:47:18 +02:00
committed by GitHub
parent 3370499ad8
commit 67353eda8e
13 changed files with 214 additions and 86 deletions

View File

@ -12,6 +12,8 @@ export type AnyEntity = {
__typename: string;
} & Record<string, any>;
export type UnknownType = void;
export type GqlType<T> = T extends Company
? GraphqlQueryCompany
: T extends Person

View File

@ -1,10 +1,13 @@
import { ReactNode } from 'react';
import { SearchConfigType } from '../search/interface';
import { AnyEntity, BoolExpType } from '../entities/generic.interface';
import {
AnyEntity,
BoolExpType,
UnknownType,
} from '../entities/generic.interface';
export type FilterableFieldsType = AnyEntity;
export type FilterWhereRelationType = AnyEntity;
type UnknownType = void;
export type FilterWhereType = FilterWhereRelationType | string | UnknownType;
export type FilterConfigType<

View File

@ -1,29 +1,25 @@
import { DocumentNode } from 'graphql';
import { ReactNode } from 'react';
import {
Companies_Bool_Exp,
People_Bool_Exp,
Users_Bool_Exp,
} from '../../generated/graphql';
import { AnyEntity, GqlType } from '../entities/generic.interface';
type UnknownType = void;
AnyEntity,
BoolExpType,
GqlType,
UnknownType,
} from '../entities/generic.interface';
export type SearchConfigType<
SearchType extends AnyEntity | UnknownType = AnyEntity,
> = SearchType extends AnyEntity
SearchType extends AnyEntity | UnknownType = UnknownType,
> = SearchType extends UnknownType
? {
query: DocumentNode;
template: (
searchInput: string,
) => People_Bool_Exp | Companies_Bool_Exp | Users_Bool_Exp;
template: (searchInput: string) => any;
resultMapper: (data: any) => any;
}
: {
query: DocumentNode;
template: (searchInput: string) => BoolExpType<SearchType>;
resultMapper: (data: GqlType<SearchType>) => {
value: SearchType;
render: (value: SearchType) => ReactNode;
};
}
: {
query: DocumentNode;
template: (searchInput: string) => any;
resultMapper: (data: any) => any;
};