import { OmniFilterPrimitiveType } from "./omni-filter" export type OmniFilterOption = PrimitiveOmniFilterOption | ReferenceOmniFilterOption type PrimitiveOmniFilterOption = { api: string optionApi?: string label: string type: OmniFilterPrimitiveType fullObj?: boolean resolveOptions?: OptionsResolver | MenuOption[] resolveOptionLabel?: ReferenceLabelResolver resolveBulkAdd?: BulkAddResolver dontRefreshOnSearch?: boolean } export type FieldValue = string | number | (string | number)[] | RangeFilter export type ReferenceOmniFilterOption = { api: string optionApi?: string label: string type: 'reference' fullObj?: boolean resolveOptions?: OptionsResolver | MenuOption[] resolveOptionLabel?: ReferenceLabelResolver resolveBulkAdd?: BulkAddResolver dontRefreshOnSearch?: boolean } export type OptionsResolver = (searchQuery: string) => Promise export type ReferenceLabelResolver = (filterValue: string | number) => Promise export type BulkAddResolver = (searchQueries: string[]) => Promise export type OmniFilter = { field: OmniFilterField | null, operator: OmniFilterOperator | null, value: FieldValue | null, } export type OmniFilterMap = { [key: string]: OmniFilter } export type OmniFilterSet = { [key: string]: OmniFilterOption } export type OmniFilterField = {id: string, option: OmniFilterOption} export type OmniFilterValue = FieldValue | AndFilter export type OmniFilterValueType = 'string' | 'text' | 'date' | 'reference' | 'number' | 'bool' | 'date-bounds' | 'string-bounds' | 'number-bounds' export type OmniFilterOperatorDefinition = { operator: OmniFilterOperator label: string valueTypes: OmniFilterValueType[] fieldType: 'single' | 'multi' | 'range' supportsOptions: boolean } export type GQLFiltersObject = { [key: string]: GQLFiltersObject | FilterInstruction } export type FilterManagerFilters = { and: FilterDefinition[] } export type FilterDefinition = { [key: string]: FilterInstruction } export type LegacyOmniFilterOperator = | 'is' | 'isNot' | 'in' | 'notIn' | 'like' | 'notLike' | 'iLike' | 'notILike' export type OmniFilterOperator = | 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'notContains' | 'anyOf' | 'notAnyOf' | 'between' | 'notBetween' | 'startsWith' | 'endsWith' | 'notStartsWith' | 'notEndsWith' | 'dateEq' | 'dateNeq' | 'dateGt' | 'dateGte' | 'dateLt' | 'dateLte' export type AndFilter = { and: T[] } export type FilterInstruction = IsFilterInstruction | IsNotFilterInstruction | EqualToFilterInstruction | NotEqualToFilterInstruction | GreaterThanFilterInstruction | GreaterThanOrEqualToFilterInstruction | LessThanFilterInstruction | LessThanOrEqualToFilterInstruction | InFilterInstruction | NotInFilterInstruction | AnyOfFilterInstruction | NotAnyOfFilterInstruction | BetweenFilterInstruction | NotBetweenFilterInstruction | LikeFilterInstruction | NotLikeFilterInstruction | ILikeFilterInstruction | NotILikeFilterInstruction | StartsWithFilterInstruction | EndsWithFilterInstruction export type IsFilterInstruction = { eq: string | AndFilter } export type IsNotFilterInstruction = { neq: string | AndFilter } export type EqualToFilterInstruction = { eq: string | AndFilter } export type NotEqualToFilterInstruction = { neq: string | AndFilter } export type GreaterThanFilterInstruction = { gt: string | AndFilter } export type GreaterThanOrEqualToFilterInstruction = { gte: string | AndFilter } export type LessThanFilterInstruction = { lt: string | AndFilter } export type LessThanOrEqualToFilterInstruction = { lte: string | AndFilter } export type InFilterInstruction = { in: string[] | AndFilter } export type NotInFilterInstruction = { notIn: string[] | AndFilter } export type AnyOfFilterInstruction = { anyOf: string[] | AndFilter } export type NotAnyOfFilterInstruction = { notAnyOf: string[] | AndFilter } export type BetweenFilterInstruction = { between: RangeFilter | AndFilter } export type NotBetweenFilterInstruction = { notBetween: RangeFilter | AndFilter } export type LikeFilterInstruction = { like: string | AndFilter } export type NotLikeFilterInstruction = { notLike: string | AndFilter } export type ILikeFilterInstruction = { iLike: string | AndFilter } export type NotILikeFilterInstruction = { notILike: string | AndFilter } export type StartsWithFilterInstruction = { startsWith: string | AndFilter } export type EndsWithFilterInstruction = { endsWith: string | AndFilter } export type RangeFilter = { lower: string | null upper: string | null } export type CompatibilityObject = { and: { [key: string]: any }[] } export type FocusMode = | 'none' | 'input' | 'filter' | 'segment' | 'cursor' export type MenuOption = { id: string label: string filterValue?: any } export type StickyObject = { [key: string]: { [key: string]: OmniFilterValue } } export type BaseFilter = { id: string operator: OmniFilterOperator }