Defines the interface for form model
WithState
<FormJson
>
↳ FormModel
• Readonly
:type: string
Custom widget type show to the user for capturing the data.
• _eventSource: EventSource
• Optional
accept: string
[]
• activeChild: null
| BaseModel
• activeField: FieldModel
• Readonly
changeEventBehaviour: "deps"
| "self"
• Optional
Readonly
data: any
Form data
• Optional
Readonly
dataRef: null
| string
To map the field’s value to a property in the data model.
• Optional
Readonly
default: any
Default value of the Field.
• Optional
description: string
Extra description to be shown to the user to aid in form filling experience. It can be rich text.
• Optional
enabled: boolean
Whether the field is enabled and takes part in rules, events etc.
• Optional
enforceEnum: boolean
• Optional
enum: any
[]
• Optional
enumNames: string
[]
• Optional
events: Object
Events is a dictionary of eventName to the actions to perform.
▪ [key: string
]: string
• Optional
exclusiveMaximum: number
ContainerModel.exclusiveMaximum
• Optional
exclusiveMinimum: number
ContainerModel.exclusiveMinimum
• Readonly
fieldType: string
Type of field to capture the user data.
• Optional
format: string
• Readonly
fragment: string
• Readonly
id: string
Id of the form.
• Readonly
index: number
The index of the Field within its parent.
• Readonly
isContainer: boolean
Whether the form field is container or not
• isFragment: boolean
• items: (FieldModel
| FieldsetModel
)[]
Defines the children/items of the container
• Optional
label: Label
Label to be used for the field.
• Optional
Readonly
lang: string
language of the field
• Readonly
logger: Logger
• Optional
maxFileSize: string
| number
• Optional
maxItems: number
• Optional
maxLength: number
• Optional
maxOccur: number
• Optional
maximum: number
• Optional
Readonly
metadata: MetaDataJson
Form metadata
• Optional
minItems: number
• Optional
minLength: number
• Optional
minOccur: number
• Optional
minimum: number
• Optional
Readonly
name: string
Name of the form field.
• parent: ContainerModel
Defines the parent of the container
• Optional
pattern: string
• Optional
placeholder: string
The placeholder to show on the widget.
• properties: Object
Custom properties of the form field.
▪ [key: string
]: any
• Readonly
qualifiedName: string
• Optional
readOnly: boolean
Whether the field should be readOnly to end user or not.
• Optional
Readonly
repeatable: boolean
Field is repeatable or not
• Optional
required: boolean
• Optional
rules: Object
Rules that modify the property of the object dynamically. The rules are evaluated whenever the dependency changes.
▪ [key: string
]: string
• Readonly
specVersion: Version
• Optional
step: number
• Readonly
title: string
Form title.
• Optional
type: string
• Optional
uniqueItems: boolean
• Optional
valid: boolean
The current validation state of the Field. The property is always computed after merging the Data Model with the Form
• Optional
validationExpression: string
ContainerModel.validationExpression
• value: any
The current value of the Field. The property is serialized in the Data Model.
• Optional
visible: boolean
Whether the field should be visible to author or not.
▸ exportData(): any
Exports the form data
any
▸ fieldAdded(field
): void
Name | Type |
---|---|
field |
FieldModel | FieldsetModel |
void
▸ getElement(id
): FormModel
| FieldModel
| FieldsetModel
Get form element model based on the id of the form element
Name | Type | Description |
---|---|---|
id |
string |
id of the form element |
FormModel
| FieldModel
| FieldsetModel
▸ getState(): any
state of the form object
any
WithState.getState
▸ importData(data
): any
Imports the given form data
Name | Type | Description |
---|---|---|
data |
any |
form data |
any
▸ indexOf(f
): number
Returns the index of the child item or the child container
Name | Type | Description |
---|---|---|
f |
FieldModel | FieldsetModel |
child item |
number
index
of the item
▸ isTransparent(): boolean
boolean
▸ reset(): any
Resets the form model
any
▸ resolveQualifiedName(qualifiedName
): null
| FieldModel
| FieldsetModel
Resolves a form element by its qualified name.
see
FieldModel
see
FieldsetModel
Name | Type | Description |
---|---|---|
qualifiedName |
string |
The qualified name to resolve. |
null
| FieldModel
| FieldsetModel
The resolved form element, or null if not found.
▸ syncDataAndFormModel(a?
): any
Name | Type |
---|---|
a? |
default | default |
any
ContainerModel.syncDataAndFormModel
▸ validate(): ValidationError
[]
Validates the given form field
list of validation errors
▸ visit(callBack
): void
visits each element in the form
Name | Type | Description |
---|---|---|
callBack |
(field : FieldModel | FieldsetModel ) => void |
a function which is invoked on each form element (including container type elements) visited |
void