BaseViewModel

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

API

Constructor

new BaseViewModel(data)
Source

Arguments:

ArgumentTypeDescription
*dataRecord<string, any>

Methods

clone<CloneFieldNames>(?fieldNames)
Source

Arguments:

ArgumentTypeDescription
fieldNamesstring|string[][]|CloneFieldNames[]
fieldPathIntersection(records)
Source

Arguments:

ArgumentTypeDescription
*recordsViewModelInterface[]
Returns:string|string[][]
isEqual(record)
Source

Arguments:

ArgumentTypeDescription
*recordnull|ViewModelInterface
Returns:boolean
toJS()
Source
Returns:Record<string, any>

Properties

_assignedFieldPaths

Source
ViewModelFieldPaths

_assignedFields

Source
string[]

_assignedFieldsDeep

Source
string[]

_data

Source
Object

_key

Source
PkFieldType

Static Methods

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

Arguments:

ArgumentTypeDescription
*newFieldsT
newOptions
getField(fieldName)
Source

Arguments:

ArgumentTypeDescription
*fieldNamestring|string[]
Returns:Field

Static Properties

allFieldNames

Source
string[]

fieldNames

Source
string[]

fields

Source
FieldMappingType

label

Source
string

labelPlural

Source
string

pkFieldName

Source
string

pkFieldNames

Source
string[]

relationFieldNames

Source
string[]