Presto
GitHub
Getting Started
Packages
View Model
BaseViewModel
isViewModelClass
isViewModelInstance
viewModelFactory
Async Choices
AsyncChoices
AsyncChoicesInterface
useAsyncChoices
Caching
useViewModelCache
ViewModelCache
Errors
InvalidFieldError
MissingFieldsError
Fields
BooleanField
CharField
DateField
DateRangeField
DateTimeField
DateTimeRangeField
DecimalField
DecimalRangeField
EmailField
Field
FileField
FloatField
FloatRangeField
ImageField
IntegerField
IntegerRangeField
JsonField
ListField
ManyRelatedViewModelField
NumberField
PasswordField
RangeField
RelatedViewModelField
TextField
TimeField
URLField
Utils
normalizeFields
ViewModelFieldPaths
Final Form
REST
Routing
UI
UI ANTD
Util
On this page
Usage overview
Arguments
viewModelFactory
Source
import { viewModelFactory } from "@prestojs/viewmodel";
viewModelFactory
<
FieldMappingType
,
PkFieldNameT
>
(
fields
,
options
)
Source
Arguments:
Argument
Type
Description
*
fields
FieldMappingType
*
options
An object with the properties below
options.baseClass
Class
*
options.pkFieldName
string|string[]
Returns:
ViewModelClass