AsyncChoices

Source
import { AsyncChoices } from "@prestojs/viewmodel";
AsyncChoices<ItemType,ValueType>

Examples

Usage with SelectAsyncChoicesWidget and Endpoint

Multi-select, parseValues

Advanced usage with useAsyncChoices

API

Constructor

new AsyncChoices(options)
Source

Arguments:

ArgumentTypeDescription
*
options
An object with the properties below
options.getChoices
options.getLabel
options.getMissingLabel
options.getValue
*options.list
options.multipleboolean
options.parseValue
*options.retrieve
options.useListProps
options.useResolveItems
options.useRetrieveProps

Methods

getChoices(items)
Source

Arguments:

ArgumentTypeDescription
*itemsItemType[]
Returns:(|[string, []])[]
getLabel(item)
Source

Arguments:

ArgumentTypeDescription
*itemItemType
Returns:ReactNode
getMissingLabel(value)
Source

Arguments:

ArgumentTypeDescription
*valueValueType
Returns:ReactNode
getValue(item)
Source

Arguments:

ArgumentTypeDescription
*itemItemType
Returns:ValueType
list(params)
Source

Arguments:

ArgumentTypeDescription
*paramsRecord
Returns:Promise
parseValue(value)
Source

Arguments:

ArgumentTypeDescription
*valueany
Returns:any
retrieve(value,?deps)
Source

Arguments:

ArgumentTypeDescription
*valueValueType|ValueType[]
depsany
Returns:Promise
useListProps(args)
Source

Arguments:

ArgumentTypeDescription
*argsany
Returns:any
useResolveItems<T>(items)
Source

Arguments:

ArgumentTypeDescription
*itemsT
Returns:T
useRetrieveProps(args)
Source

Arguments:

ArgumentTypeDescription
*argsany
Returns:any

Properties

multiple

Source
boolean

options

Source
An object with these properties:
PropertyTypeDescription
getChoices
getLabel
getMissingLabel
getValue
*list
multipleboolean
parseValue
*retrieve
useListProps
useResolveItems
useRetrieveProps