mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* [AAE-30864] refactored services to accept injected validators * [AAE-30864] updated documentation, applied pr comments
5.3 KiB
5.3 KiB
Title, Added, Status, Last reviewed
Title | Added | Status | Last reviewed |
---|---|---|---|
Form model | 2025-02-19 | Active | 2025-02-19 |
Form model
Contains the value and metadata for a form.
Properties
Name | Type | Default | Description |
---|---|---|---|
UNSET_TASK_NAME | string | 'Nameless task' | static property |
SAVE_OUTCOME | string | '$save' | static property |
COMPLETE_OUTCOME | string | '$complete' | static property |
START_PROCESS_OUTCOME | string | '$startProcess' | static property |
id | string | number | |
name | string | form name | |
taskId | string | task id | |
confirmMessage | ConfirmMessage | confirmation message | |
taskName | string | FormModel.UNSET_TASK_NAME | task name |
processDefinitionId | string | Process definition id | |
selectedOutcome | string | selected outcome | |
enableFixedSpace | boolean | should fixed space be enabled | |
displayMode | any | which mode should be displayed | |
fieldsCache | FormFieldModel[] | [] | cache for fields |
json | any | json with form configuration | |
nodeId | string | id of node | |
values | FormValues | {} | form values |
tabs | TabModel[] | [] | tabs |
fields | (ContainerModel | FormFieldModel)[] | [] |
outcomes | FormOutcomeModel[] | [] | set of outcomes |
fieldValidators | FormFieldValidator[] | [] | validators for fields |
customFieldTemplates | FormFieldTemplates | {} | custom templates |
theme? | ThemeModel | theme | |
className | string | class name | |
readOnly | false | is form read only | |
isValid | true | is form valid | |
processVariables | ProcessVariableModel[] | [] | process variables |
variables | FormVariableModel[] | [] | variables |
Methods
onFormFieldChanged(field: FormFieldModel)
Triggered when field is changed. Validates field and calls FormServicevalidateForm(): void
Validates entire form and all form fields.validateField(field: FormFieldModel): void
Validates a specific form field, triggers form validation.parseRootFields(json: any): (ContainerModel | FormFieldModel)[]
Activiti supports 3 types of root fields: container|group|dynamic-tableloadData(formValues: FormValues)
Loads external data and overrides field values. Typically used when form definition and form data coming from different sourcescanOverrideFieldValueWithProcessValue(field: FormFieldModel, variableId: string, formValues: FormValues): boolean
Checks if field value can be overriden with process valueisDefined(value: string): boolean
Check if variable is definedgetFormVariable(identifier: string): FormVariableModel
Returns a form variable that matches the identifier.getDefaultFormVariableValue(identifier: string): any
Returns a value of the form variable that matches the identifier. Provides additional conversion of types (date, boolean).getProcessVariableValue(name: string): any
Returns a process variable value. When mapping a process variable with a form variable the mapping is already resolved by the rest API with the name of variables.formVariableName.parseValue(type: string, value: any): any
Parse value data and booleanhasTabs(): boolean
Check if form has tabshasFields(): boolean
Check if there are any fieldshasOutcomes(): boolean
Check if form has outcomesgetFieldById(fieldId: string): FormFieldModel
Find field by idgetFormFields(filterTypes?: string[]): FormFieldModel[]
Get form fieldsprocessFields(fields: (ContainerModel | FormFieldModel)[], formFieldModel: FormFieldModel[]): void
Process fieldsisContainerField(field: ContainerModel | FormFieldModel): field is ContainerModel
Check if it is containerisSectionField(field: ContainerModel | FormFieldModel): field is FormFieldModel
Check if it is sectionhandleSectionField(section: FormFieldModel, formFieldModel: FormFieldModel[]): void
Handle sectionhandleContainerField(container: ContainerModel, formFieldModel: FormFieldModel[]): void
Handle containerhandleSingleField(field: FormFieldModel, formFieldModel: FormFieldModel[]): void
Handle single fieldfilterFieldsByType(fields: FormFieldModel[], types?: string[]): FormFieldModel[]
Filter fields based on typemarkAsInvalid(): void
Set form as invalidparseOutcomes()
Parse outcomes from jsonaddValuesNotPresent(valuesToSetIfNotPresent: FormValues)
Set values if they are not presentisValidDropDown(key: string): boolean
Validates dropdownsetNodeIdValueForViewersLinkedToUploadWidget(linkedUploadWidgetContentSelected: UploadWidgetContentLinkModel)
Set node idchangeFieldVisibility(fieldId: string, visibility: boolean): void
Changes field visibilitychangeFieldDisabled(fieldId: string, disabled: boolean): void
Changes disabled status of fieldchangeFieldRequired(fieldId: string, required: boolean): void
Changes required status of fieldchangeFieldValue(fieldId: string, value: any): void
Changes field valuechangeVariableValue(variableId: string, value: any): void
Changes variable valueloadInjectedFieldValidators(injectedFieldValidators: FormFieldValidator[]): void
Checks it there are any injectedValidators and adds them to the array of field validators.