{"version":3,"file":"types.js","names":[],"sources":["../../../src/fields/Relationship/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientConfig,\n CollectionSlug,\n FilterOptionsResult,\n LabelFunction,\n StaticDescription,\n StaticLabel,\n ValueWithRelation,\n} from 'payload'\n\nexport type Option = {\n allowEdit: boolean\n label: string\n options?: Option[]\n relationTo?: string\n value: number | string\n}\n\nexport type OptionGroup = {\n label: string\n options: Option[]\n}\n\nexport type MonomorphicRelationValue = number | string\n\nexport type Value =\n | MonomorphicRelationValue\n | MonomorphicRelationValue[]\n | ValueWithRelation\n | ValueWithRelation[]\n\ntype CLEAR = {\n exemptValues?: ValueWithRelation | ValueWithRelation[]\n type: 'CLEAR'\n}\n\ntype UPDATE = {\n collection: ClientCollectionConfig\n config: ClientConfig\n doc: any\n i18n: I18nClient\n type: 'UPDATE'\n}\n\ntype ADD = {\n collection: ClientCollectionConfig\n config: ClientConfig\n docs: any[]\n i18n: I18nClient\n ids?: (number | string)[]\n sort?: boolean\n type: 'ADD'\n}\n\ntype REMOVE = {\n collection: ClientCollectionConfig\n config: ClientConfig\n i18n: I18nClient\n id: string\n type: 'REMOVE'\n}\n\nexport type Action = ADD | CLEAR | REMOVE | UPDATE\n\nexport type HasManyValueUnion =\n | {\n hasMany: false\n value?: ValueWithRelation\n }\n | {\n hasMany: true\n value?: ValueWithRelation[]\n }\n\nexport type UpdateResults = (\n args: {\n filterOptions?: FilterOptionsResult\n lastFullyLoadedRelation?: number\n lastLoadedPage: Record\n onSuccess?: () => void\n search?: string\n sort?: boolean\n } & HasManyValueUnion,\n) => void\n\nexport type RelationshipInputProps = {\n readonly AfterInput?: React.ReactNode\n readonly allowCreate?: boolean\n readonly allowEdit?: boolean\n readonly appearance?: 'drawer' | 'select'\n readonly BeforeInput?: React.ReactNode\n readonly className?: string\n readonly Description?: React.ReactNode\n readonly description?: StaticDescription\n readonly Error?: React.ReactNode\n readonly filterOptions?: FilterOptionsResult\n readonly formatDisplayedOptions?: (options: OptionGroup[]) => Option[] | OptionGroup[]\n readonly isSortable?: boolean\n readonly Label?: React.ReactNode\n readonly label?: StaticLabel\n readonly localized?: boolean\n readonly maxResultsPerRequest?: number\n readonly maxRows?: number\n readonly minRows?: number\n readonly path: string\n readonly placeholder?: LabelFunction | string\n readonly readOnly?: boolean\n readonly relationTo: string[]\n readonly required?: boolean\n readonly showError?: boolean\n readonly sortOptions?: Partial>\n readonly style?: React.CSSProperties\n} & SharedRelationshipInputProps\n\ntype SharedRelationshipInputProps =\n | {\n readonly hasMany: false\n readonly initialValue?: null | ValueWithRelation\n readonly onChange: (value: ValueWithRelation) => void\n readonly value?: null | ValueWithRelation\n }\n | {\n readonly hasMany: true\n readonly initialValue?: null | ValueWithRelation[]\n readonly onChange: (value: ValueWithRelation[]) => void\n readonly value?: null | ValueWithRelation[]\n }\n"],"mappings":"AAuFA","ignoreList":[]}