BaseViewModel

Source
import { BaseViewModel } from "@prestojs/viewmodel";
BaseViewModel<FieldMappingType,PkFieldType,AssignedFieldNames = string>

API

Constructor

new BaseViewModel(data)

Arguments:

ArgumentTypeDescription
*datamapped

Methods

clone<CloneFieldNames>(?fieldNames)

Arguments:

ArgumentTypeDescription
fieldNames(Extract|ValueOf)[]|CloneFieldNames[]
fieldPathIntersection(records)

Arguments:

ArgumentTypeDescription
*recordsViewModelInterface[]
Returns:(Extract|ValueOf)[]
isEqual(record)

Arguments:

ArgumentTypeDescription
*recordnull|Field
Returns:boolean
toJS()
Returns:mapped

Properties

_assignedFieldPaths

Source
ViewModelFieldPaths

_assignedFields

Source
string[]

_assignedFieldsDeep

Source
string[]

_data

Source
Object
mapped

_key

Source
Object|mapped

Static Methods

augment<T,AugmentPkFieldType = PkFieldType|any|any>(newFields,?newOptions)

Arguments:

ArgumentTypeDescription
*newFieldsT
newOptionsPartial
getField(fieldName)

Arguments:

ArgumentTypeDescription
*fieldNameExtract|ValueOf
Returns:Field

Static Properties

allFieldNames

Source
Extract[]

fieldNames

Source
Extract[]

fields

Source
FieldMappingType

label

Source
string

labelPlural

Source
string

pkFieldName

Source
string

pkFieldNames

Source
string[]

relationFieldNames

Source
string[]