{"version":3,"file":"types.js","names":[],"sources":["../../../src/elements/WhereBuilder/types.ts"],"sourcesContent":["import type {\n ClientField,\n Operator,\n ResolvedFilterOptions,\n SanitizedCollectionConfig,\n Where,\n} from 'payload'\n\nexport type WhereBuilderProps = {\n readonly collectionPluralLabel: SanitizedCollectionConfig['labels']['plural']\n readonly collectionSlug: SanitizedCollectionConfig['slug']\n readonly fields?: ClientField[]\n readonly renderedFilters?: Map\n readonly resolvedFilterOptions?: Map\n}\n\nexport type Value = Date | number | number[] | string | string[]\n\nexport type ReducedField = {\n field: ClientField\n label: React.ReactNode\n operators: {\n label: string\n value: Operator\n }[]\n plainTextLabel?: string\n value: Value\n}\n\nexport type Relation = 'and' | 'or'\n\nexport type ADD = {\n andIndex?: number\n field: string\n orIndex?: number\n relation?: Relation\n type: 'add'\n}\n\nexport type REMOVE = {\n andIndex: number\n orIndex: number\n type: 'remove'\n}\n\nexport type UPDATE = {\n andIndex: number\n field?: string\n operator?: string\n orIndex: number\n type: 'update'\n value?: unknown\n}\n\nexport type Action = ADD | REMOVE | UPDATE\n\nexport type State = {\n or: Where[]\n}\n\nexport type AddCondition = ({\n andIndex,\n field,\n orIndex,\n relation,\n}: {\n andIndex: number\n field: ReducedField\n orIndex: number\n relation: 'and' | 'or'\n}) => Promise | void\n\nexport type UpdateCondition = ({\n type,\n andIndex,\n field,\n operator,\n orIndex,\n value,\n}: {\n andIndex: number\n field: ReducedField\n operator: string\n orIndex: number\n type: 'field' | 'operator' | 'value'\n value: Value\n}) => Promise | void\n\nexport type RemoveCondition = ({\n andIndex,\n orIndex,\n}: {\n andIndex: number\n orIndex: number\n}) => Promise | void\n"],"mappings":"AAwFA","ignoreList":[]}