import { LookupMode, LookupResponse } from 'fastapi-rtk/api-types'; import { APILookupParams } from 'fastapi-rtk/contexts'; import { InfiniteData, QueryKey, UseInfiniteQueryOptions } from '@tanstack/react-query'; export interface LookupOption { value: string; label: string; } export interface UseLookupOptionsParams { /** The column whose `/_lookup/{column}` route supplies the options; without one nothing is fetched. */ column?: string; /** Fetches one page of the column's lookup, usually `useApi().lookup`; without one nothing is fetched. */ lookup?: (column: string, params: APILookupParams) => Promise; /** The react-query props for the search query, spread over its defaults. */ infiniteQueryProps?: Partial, QueryKey, number>>; /** The form or filter the lookup serves. */ mode: LookupMode; /** The column is a relation, so selected ids get their labels from the route; a plain value is its own label. */ relation?: boolean; /** The selected values. */ values: (string | number)[]; }