RelatedViewModelField

Source
import { RelatedViewModelField } from "@prestojs/viewmodel";
RelatedViewModelField<TargetViewModelT,SourceFieldNameT = string>

Examples

Simple usage

Circular References

API

Constructor

new RelatedViewModelField(props)
Source

Arguments:

ArgumentTypeDescription
*
props
An object with the properties below
props.asyncChoicesAsyncChoicesInterface
props.blankboolean
props.blankAsNullboolean
props.cacheViewModelCache
props.choices|[SingleValueT, string][]
props.defaultValuenull|ValueT|
props.formatterPropsRecord
props.helpTextstring
props.labelstring
props.readOnlyboolean
*props.sourceFieldNameSourceFieldNameT
*props.to|TargetViewModelT
props.widgetPropsRecord
props.writeOnlyboolean

Methods

clone()
Source
Returns:Field
format(value)
Source

Arguments:

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

Arguments:

ArgumentTypeDescription
*value1InstanceType
*value2InstanceType
Returns:boolean
normalize(value)
Source

Arguments:

ArgumentTypeDescription
*valueany
Returns:InstanceType
parse(value)
Source

Arguments:

ArgumentTypeDescription
*valuenull|mapped
Returns:null|InstanceType
resolveViewModel()
Source
Returns:Promise
toJS(value)
Source

Arguments:

ArgumentTypeDescription
*valueInstanceType
Returns:Record
toString()
Source
Returns:string

Properties

_isResolvingDeps

Source
boolean

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

many

Source
boolean

name

Source
string

readOnly

Source
boolean

sourceField

Source
Field

sourceFieldName

Source
SourceFieldNameT
TargetViewModelT

value

Source
undefined|ValueT

widgetProps

Source
Record

writeOnly

Source
boolean

Static Properties

fieldClassName

Source
string