Field

Source
import { Field } from "@prestojs/viewmodel";
Field<ValueT,ParsableValueT = ValueT,SingleValueT = ValueT>

API

Constructor

new Field(?options)

Arguments:

ArgumentTypeDescription
options
An object with the properties below
options.asyncChoicesAsyncChoicesInterface
options.blankboolean
options.blankAsNullboolean
options.choices|[SingleValueT, string][]
options.defaultValuenull|ValueT|
options.formatterPropsRecord
options.helpTextstring
options.labelstring
options.readOnlyboolean
options.widgetPropsRecord
options.writeOnlyboolean

Methods

clone()
Returns:Field
contributeToClass(viewModel)

Arguments:

ArgumentTypeDescription
*viewModelViewModelConstructor
Returns:void
format(value)

Arguments:

ArgumentTypeDescription
*valueValueT
Returns:any
getFormatterProps()
Returns:{[fieldName: string]: any }
getWidgetProps()
Returns:{[fieldName: string]: any }
isEqual(value1,value2)

Arguments:

ArgumentTypeDescription
*value1ValueT
*value2ValueT
Returns:boolean
normalize(value)

Arguments:

ArgumentTypeDescription
*valueParsableValueT
Returns:null|ValueT
parse(value)

Arguments:

ArgumentTypeDescription
*valuenull|ParsableValueT
Returns:null|ValueT
toJS(value)

Arguments:

ArgumentTypeDescription
*valueValueT
Returns:null|string|number|Record
toString()
Returns:string

Properties

blank

Source
boolean

blankAsNull

Source
boolean

boundRecord

Source
undefined|ViewModelInterface

choices

Source

defaultValue

Source
undefined|null|ValueT|Promise

formatterProps

Source
Record

helpText

Source
string

isBound

Source
boolean

label

Source
string

name

Source
string

readOnly

Source
boolean

value

Source
undefined|ValueT

widgetProps

Source
Record

writeOnly

Source
boolean

Static Properties

fieldClassName

Source
null|string