Ƭ BaseJson: TranslationBaseJson & RulesJson & ConstraintsJson & { :type?: string ; altText?: string ; appliedCssClassNames?: string ; buttonType?: string ; constraintMessages?: ConstraintsMessages ; dataRef?: string | null ; enabled?: boolean ; errorMessage?: string ; fieldType?: string ; label?: Label ; lang?: string ; name?: string ; properties?: { [key: string]: any; } ; repeatable?: boolean ; screenReaderText?: string ; tooltip?: string ; viewType?: string ; visible?: boolean }
Type for generic form properties based on adaptive form specification
Ƭ CaptchaJson: FieldJson & { captchaDisplayMode?: CaptchaDisplayMode ; captchaProvider?: string ; captchaSiteKey?: string }
Type for form captcha field properties based on adaptive form specification
Ƭ ChangePayload: Object
Payload of change event
| Name | Type | Description |
|---|---|---|
changes |
{ currentValue: any ; prevValue?: any ; propertyName: string }[] |
List of changes |
eventSource? |
EventSource |
To identify the source(code/ui) of the event |
Ƭ ConstraintsJson: TranslationConstraintsJson & { accept?: string[] ; enforceEnum?: boolean ; exclusiveMaximum?: number | string ; exclusiveMinimum?: number | string ; format?: string ; maxFileSize?: number | string ; maxItems?: number ; maxLength?: number ; maxOccur?: number ; maximum?: number | string ; minItems?: number ; minLength?: number ; minOccur?: number ; minimum?: number | string ; pattern?: string ; required?: boolean ; step?: number ; type?: string ; uniqueItems?: boolean ; validationExpression?: string }
Type for constraint properties based on adaptive form specification
Ƭ ConstraintsMessages: Object
Type for constraint messages based on adaptive form specification
| Name | Type |
|---|---|
accept? |
string |
enum? |
string |
exclusiveMaximum? |
string |
exclusiveMinimum? |
string |
format? |
string |
maxFileSize? |
string |
maxItems? |
string |
maxLength? |
string |
maximum? |
string |
minItems? |
string |
minLength? |
string |
minimum? |
string |
pattern? |
string |
required? |
string |
step? |
string |
type? |
string |
uniqueItems? |
string |
validationExpression? |
string |
Ƭ ContainerJson: BaseJson & { activeChild?: string ; initialItems?: number ; items: (FieldJson | ContainerJson)[] }
Type for form container properties based on adaptive form specification
Ƭ FieldJson: BaseJson & TranslationFieldJson & { checked?: boolean ; default?: any ; displayFormat?: string ; displayValue?: string ; displayValueExpression?: string ; editFormat?: string ; editValue?: string ; emptyValue?: "null" | "undefined" | "" ; readOnly?: boolean ; valid?: boolean ; validationMessage?: string ; validity?: any ; value?: any }
Type for form field properties based on adaptive form specification
Ƭ FieldsetJson: ContainerJson & { readOnly?: boolean ; type?: "array" | "object" }
Type for form fieldset based on adaptive form specification
Ƭ FormCreationMode: "create" | "restore"
Ƭ FormJson: ContainerJson & { action?: string ; adaptiveform?: string ; data?: any ; lang?: string ; metadata?: MetaDataJson ; title?: string }
Type for form model based on adaptive form specification
Ƭ Items<T>: Object
Type for items property based on adaptive form specification
| Name |
|---|
T |
▪ [key: string]: T
Ƭ Label: Object
Type for label based on adaptive form specification
| Name | Type |
|---|---|
richText? |
boolean |
value |
string |
visible? |
boolean |
Ƭ MetaDataJson: Object
Type for form metadata based on adaptive form specification
| Name | Type |
|---|---|
grammar? |
string |
version? |
string |
Ƭ Primitives: string | number | boolean | null | undefined
Type alias for primitive types
Ƭ RulesJson: Object
Type for constraint messages based on adaptive form specification
| Name | Type |
|---|---|
events? |
Items<string[] | string | undefined> |
rules? |
Items<string> |
Ƭ ScriptErrorPayload: Object
Payload of scriptError event
| Name | Type | Description |
|---|---|---|
error |
string |
The error message containing full context (field, expression, error details) |
event? |
string |
Event name (e.g., ‘click’, ‘blur’) or property name (e.g., ‘value’, ‘visible’) |
name? |
string |
Name of the field where the error occurred |
rule? |
string |
The actual rule/expression that failed |
stack? |
string |
Stack trace of the error (only available for execution errors) |
Ƭ State<T>: stateProps & T extends ContainerJson ? T & { items: State<FieldJson | ContainerJson>[] } : T
Generic type for a form object state
| Name |
|---|
T |
Ƭ TranslationJson: TranslationBaseJson & TranslationFieldJson & TranslationConstraintsJson
Type for all properties which can be translated based on adaptive form specification
Ƭ UIChangePayload: Object
Payload of UI change event. This payload is designed to encapsulate the details of changes initiated through UI interactions. It includes the new value of the element and the checked state that triggered the UI change event.
| Name | Type | Description |
|---|---|---|
checked? |
boolean |
The checked state of the element after the UI change. |
value? |
any |
The new value of the element after the UI change. |
• CUSTOM_PROPS_KEY: "properties"
• ConstraintType: Readonly<{ ACCEPT_MISMATCH: "acceptMismatch" = ‘acceptMismatch’; ENUM_MISMATCH: "enumMismatch" = ‘enumMismatch’; EXCLUSIVE_MAXIMUM_MISMATCH: "exclusiveMaximumMismatch" = ‘exclusiveMaximumMismatch’; EXCLUSIVE_MINIMUM_MISMATCH: "exclusiveMinimumMismatch" = ‘exclusiveMinimumMismatch’; EXPRESSION_MISMATCH: "expressionMismatch" = ‘expressionMismatch’; FILE_SIZE_MISMATCH: "fileSizeMismatch" = ‘fileSizeMismatch’; FORMAT_MISMATCH: "formatMismatch" = ‘formatMismatch’; MAX_ITEMS_MISMATCH: "maxItemsMismatch" = ‘maxItemsMismatch’; MIN_ITEMS_MISMATCH: "minItemsMismatch" = ‘minItemsMismatch’; PATTERN_MISMATCH: "patternMismatch" = ‘patternMismatch’; RANGE_OVERFLOW: "rangeOverflow" = ‘rangeOverflow’; RANGE_UNDERFLOW: "rangeUnderflow" = ‘rangeUnderflow’; STEP_MISMATCH: "stepMismatch" = ‘stepMismatch’; TOO_LONG: "tooLong" = ‘tooLong’; TOO_SHORT: "tooShort" = ‘tooShort’; TYPE_MISMATCH: "typeMismatch" = ‘typeMismatch’; UNIQUE_ITEMS_MISMATCH: "uniqueItemsMismatch" = ‘uniqueItemsMismatch’; VALUE_MISSING: "valueMissing" = ‘valueMissing’ }>
ConstraintType is an object containing properties that represent the constraint types as per HTML5 specfication. Once can access these properties using dot notation (for example) (ConstraintType.PATTERN_MISMATCH, ConstraintType.TOO_SHORT, etc.).
• FIELD_TYPE: Object
ADOBE CONFIDENTIAL _______
Copyright 2024 Adobe All Rights Reserved.
NOTICE: All information contained herein is, and remains the property of Adobe and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to Adobe and its suppliers and are protected by all applicable intellectual property laws, including trade secret and copyright laws. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Adobe.
Adobe permits you to use and modify this file solely in accordance with the terms of the Adobe license agreement accompanying it.
| Name | Type |
|---|---|
BUTTON |
string |
CAPTCHA |
string |
CHECKBOX |
string |
CHECKBOX_GROUP |
string |
DATE_INPUT |
string |
DROP_DOWN |
string |
EMAIL |
string |
FILE_INPUT |
string |
FORM |
string |
IMAGE |
string |
MULTILINE_INPUT |
string |
NUMBER_INPUT |
string |
PANEL |
string |
PASSWORD |
string |
PLAIN_TEXT |
string |
RADIO_GROUP |
string |
TELEPHONE |
string |
TEXT_INPUT |
string |
• FunctionRuntime: FunctionRuntimeImpl
• TRANSLATION_ID: "afs:translationIds"
Name of the object which holds all translation specific properties
• TRANSLATION_TOKEN: "##"
Token used while creating translation specific properties from adaptive form specification
• constraintKeys: Readonly<{ accept: "acceptMismatch" = ConstraintType.ACCEPT_MISMATCH; enum: "enumMismatch" = ConstraintType.ENUM_MISMATCH; exclusiveMaximum: "exclusiveMaximumMismatch" = ConstraintType.EXCLUSIVE_MAXIMUM_MISMATCH; exclusiveMinimum: "exclusiveMinimumMismatch" = ConstraintType.EXCLUSIVE_MINIMUM_MISMATCH; format: "formatMismatch" = ConstraintType.FORMAT_MISMATCH; maxFileSize: "fileSizeMismatch" = ConstraintType.FILE_SIZE_MISMATCH; maxItems: "maxItemsMismatch" = ConstraintType.MAX_ITEMS_MISMATCH; maxLength: "tooLong" = ConstraintType.TOO_LONG; maximum: "rangeOverflow" = ConstraintType.RANGE_OVERFLOW; minItems: "minItemsMismatch" = ConstraintType.MIN_ITEMS_MISMATCH; minLength: "tooShort" = ConstraintType.TOO_SHORT; minimum: "rangeUnderflow" = ConstraintType.RANGE_UNDERFLOW; pattern: "patternMismatch" = ConstraintType.PATTERN_MISMATCH; required: "valueMissing" = ConstraintType.VALUE_MISSING; step: "stepMismatch" = ConstraintType.STEP_MISMATCH; type: "typeMismatch" = ConstraintType.TYPE_MISMATCH; uniqueItems: "uniqueItemsMismatch" = ConstraintType.UNIQUE_ITEMS_MISMATCH; validationExpression: "expressionMismatch" = ConstraintType.EXPRESSION_MISMATCH }>
This map consists of key which are constraints based on `adaptive form specification and value which specifies constraint types as per HTML5 specification
• constraintProps: string[]
Constant for all properties which are constraints based on adaptive form specification
• createFormInstance: Object
▸ (formModel, callback?, logLevel?, fModel?): FormModel
Creates form instance using form model definition as per adaptive form specification
| Name | Type | Default value | Description |
|---|---|---|---|
formModel |
any |
undefined |
form model definition |
callback? |
(f: FormModel) => any |
undefined |
a callback that recieves the FormModel instance that gets executed before any event in the Form is executed |
logLevel |
LogLevel |
'error' |
Logging Level for the form. Setting it off will disable the logging |
fModel |
any |
undefined |
existing form model, this is additional optimization to prevent creation of form instance |
| Name | Type |
|---|---|
currentVersion |
Version |
• translationProps: string[]
Constant for all properties which can be translated based on adaptive form specification
▸ Const checkIfConstraintsArePresent(item): boolean
Utility to check if the given form field has any data constraints
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
form field to check |
boolean
true if item has data constraints, false otherwise
▸ checkIfKeyAdded(currentObj, prevObj, objKey): boolean
Checks if the key got added in current object
| Name | Type |
|---|---|
currentObj |
any |
prevObj |
any |
objKey |
string |
boolean
▸ Const createTranslationObject(input, additionalTranslationProps?, bcp47LangTags?): any
Creates translation object with BCP 47 language tags as key and value is a translation object. Key of translation object is generated based on the form hierarchy and it is separated by “##” token to signify that the id is machine generated (ie its not a human generated string)
| Name | Type | Default value | Description |
|---|---|---|---|
input |
any |
undefined |
form model definition |
additionalTranslationProps |
string[] |
[] |
optional properties which needs to be translated, by default, only OOTB properties of form model definition is translated |
bcp47LangTags |
string[] |
[] |
optional additional language tags |
any
translation object for each bcp 47 language tag
▸ Const defaultFieldTypes(schema): string
Returns the default view type for a given form field object based on adaptive form specification
| Name | Type | Description |
|---|---|---|
schema |
any |
schema item for which default view type is to found |
string
default view type
▸ Const exportDataSchema(form): any
Creates a json schema from form model definition
| Name | Type | Description |
|---|---|---|
form |
FormJson |
form model definition |
any
json schema of form model definition
▸ Const extractFileInfo(file): any
Utility to extract FileObject from string or HTML File data type
| Name | Type |
|---|---|
file |
any |
any
list of FileObject
▸ Const fetchForm(url, headers?): Promise<string>
Helper API to fetch form model definition from an AEM instance
| Name | Type | Description |
|---|---|---|
url |
string |
URL of the instance |
headers |
any |
HTTP headers to pass to the aem instance |
Promise<string>
promise which resolves to the form model definition
▸ Const getConstraintTypeMessages(): Object
API to get the constraint type messages
Object
| Name | Type |
|---|---|
acceptMismatch |
"The specified file type not supported." |
enumMismatch |
"Please select a value from the allowed options." |
exclusiveMaximumMismatch |
"Value must be less than ${0}." |
exclusiveMinimumMismatch |
"Value must be greater than ${0}." |
expressionMismatch |
"Please enter a valid value." |
fileSizeMismatch |
"File too large. Reduce size and try again." |
formatMismatch |
"Specify the value in allowed format : ${0}." |
maxItemsMismatch |
"Specify a number of items equal to or less than ${0}." |
minItemsMismatch |
"Specify a number of items equal to or greater than ${0}." |
patternMismatch |
"Please match the format requested." |
rangeOverflow |
"Value must be less than or equal to ${0}." |
rangeUnderflow |
"Value must be greater than or equal to ${0}." |
stepMismatch |
"Please enter a valid value." |
tooLong |
"Please shorten this text to ${0} characters or less." |
tooShort |
"Please lengthen this text to ${0} characters or more." |
typeMismatch |
"Please enter a valid value." |
uniqueItemsMismatch |
"All the items must be unique." |
valueMissing |
"Please fill in this field." |
▸ Const getFileSizeInBytes(str): number
Converts file size in string to bytes based on IEC specification
| Name | Type | Description |
|---|---|---|
str |
any |
file size |
number
file size as bytes (in kb) based on IEC specification
▸ Const getOrElse(input, key, defaultValue?): any
Gets the value for the given key from the input, in case of no value, default is returned
| Name | Type | Default value | Description |
|---|---|---|---|
input |
any |
undefined |
input object |
key |
string | string[] |
undefined |
key to return from input object (key could be comma separated, example, label.value) |
defaultValue |
any |
null |
default value |
any
▸ Const getProperty<P>(data, key, def): P
Get the property value form the json
| Name | Description |
|---|---|
P |
type for the default value |
| Name | Type | Description |
|---|---|---|
data |
any |
object as json |
key |
string |
name of the key |
def |
P |
default value |
P
▸ Const isButton(item): boolean
Checks if the input item provided is a button field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form button, false otherwise
▸ Const isCaptcha(item): boolean
Checks if the input item provided is a captcha field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form captcha, false otherwise
▸ Const isCheckbox(item): boolean
Checks if the input item provided is a form check box field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form check box, false otherwise
▸ Const isCheckboxGroup(item): boolean
Checks if the input item provided is a form check box group field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form check box group, false otherwise
▸ Const isDateField(item): boolean
Checks if the input item provided is a date field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form check box group, false otherwise
▸ Const isDateTimeField(item): boolean
Checks if the input item provided is a date time field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form check box group, false otherwise
▸ Const isEmailInput(item): boolean
Checks if the input item provided is a form check box group field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form check box group, false otherwise
▸ Const isEmpty(value): boolean
Utility to check if the value is empty
| Name | Type | Description |
|---|---|---|
value |
any |
value |
boolean
true if value is empty, false otherwise
▸ Const isFile(item): boolean
Checks if the input item provided is a form file attachment field
| Name | Type | Description |
|---|---|---|
item |
FieldJson | FieldsetJson |
input item it could be Fieldset or Field |
boolean
true if item is a form file attachment, false otherwise
▸ Const isRepeatable(obj): boolean
| Name | Type |
|---|---|
obj |
FieldJson | FieldsetJson |
boolean
▸ Const jsonString(obj): string
Prettifies obj as json string
| Name | Type | Description |
|---|---|---|
obj |
any |
object to prettify |
string
json string
▸ Const propertyChange(propertyName, currentValue, prevValue?): Change
Creates a change event
| Name | Type | Description |
|---|---|---|
propertyName |
string |
name of the form field property |
currentValue |
any |
current value |
prevValue? |
any |
previous value |
Change change event
▸ Const readAttachments(input, excludeUnbound?): Promise<any>
Returns the list of attachments with its data reference.
| Name | Type | Default value | Description |
|---|---|---|---|
input |
ContainerModel |
undefined |
The form model containing items. |
excludeUnbound |
boolean |
false |
- |
Promise<any>
▸ Const registerFunctions(functions): void
| Name | Type |
|---|---|
functions |
Object |
void
▸ Const restoreFormInstance(formModel, data?, __namedParameters?): FormModel
| Name | Type | Default value |
|---|---|---|
formModel |
any |
undefined |
data |
any |
null |
__namedParameters |
Object |
defaultOptions |
__namedParameters.logLevel |
LogLevel |
undefined |
▸ Const sanitizeName(name): string
Sanitizes a name for use in expressions by wrapping it in quotes if it doesn’t follow standard identifier naming conventions (starts with letter, number, underscore, or $, contains only letters, numbers, underscores, dots, and square brackets).
example
sanitizeName(‘fieldName’) // returns ‘fieldName’
sanitizeName(‘field-name’) // returns ‘“field-name”’
sanitizeName(‘123field’) // returns ‘123field’
sanitizeName(‘field name’) // returns ‘“field name”’
| Name | Type | Description |
|---|---|---|
name |
string |
The name to sanitize |
string
The sanitized name (quoted if necessary)
▸ Const setCustomDefaultConstraintTypeMessages(messages): void
API to override the custom default constraint messages
| Name | Type | Description |
|---|---|---|
messages |
Record<string, string> |
messages to override as per {@link defaultConstraintTypeMessages} As an example, // Example usage: setCustomConstraintMessages({ 'pattern': 'Custom pattern mismatch message.', 'minLength': 'Custom too short message.', }); |
void
▸ Const validateFormData(formModel, data): Object
Validates Form model definition with the given data
| Name | Type | Description |
|---|---|---|
formModel |
any |
form model definition |
data |
any |
form data |
Object
| Name | Type |
|---|---|
messages |
any[] |
valid |
boolean |
▸ Const validateFormInstance(formModel, data): boolean
Validates Form model definition with the given data
deprecated use validateFormData
| Name | Type | Description |
|---|---|---|
formModel |
any |
form model definition |
data |
any |
form data |
boolean
true, if form is valid against the given form data, false otherwise