mirror of
				https://github.com/Alfresco/alfresco-ng2-components.git
				synced 2025-10-29 15:21:39 +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 FormService
- validateForm(): voidValidates entire form and all form fields.
- validateField(field: FormFieldModel): voidValidates a specific form field, triggers form validation.
- parseRootFields(json: any): (ContainerModel | FormFieldModel)[]Activiti supports 3 types of root fields: container|group|dynamic-table
- loadData(formValues: FormValues)Loads external data and overrides field values. Typically used when form definition and form data coming from different sources
- canOverrideFieldValueWithProcessValue(field: FormFieldModel, variableId: string, formValues: FormValues): booleanChecks if field value can be overriden with process value
- isDefined(value: string): booleanCheck if variable is defined
- getFormVariable(identifier: string): FormVariableModelReturns a form variable that matches the identifier.
- getDefaultFormVariableValue(identifier: string): anyReturns a value of the form variable that matches the identifier. Provides additional conversion of types (date, boolean).
- getProcessVariableValue(name: string): anyReturns 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): anyParse value data and boolean
- hasTabs(): booleanCheck if form has tabs
- hasFields(): booleanCheck if there are any fields
- hasOutcomes(): booleanCheck if form has outcomes
- getFieldById(fieldId: string): FormFieldModelFind field by id
- getFormFields(filterTypes?: string[]): FormFieldModel[]Get form fields
- processFields(fields: (ContainerModel | FormFieldModel)[], formFieldModel: FormFieldModel[]): voidProcess fields
- isContainerField(field: ContainerModel | FormFieldModel): field is ContainerModelCheck if it is container
- isSectionField(field: ContainerModel | FormFieldModel): field is FormFieldModelCheck if it is section
- handleSectionField(section: FormFieldModel, formFieldModel: FormFieldModel[]): voidHandle section
- handleContainerField(container: ContainerModel, formFieldModel: FormFieldModel[]): voidHandle container
- handleSingleField(field: FormFieldModel, formFieldModel: FormFieldModel[]): voidHandle single field
- filterFieldsByType(fields: FormFieldModel[], types?: string[]): FormFieldModel[]Filter fields based on type
- markAsInvalid(): voidSet form as invalid
- parseOutcomes()Parse outcomes from json
- addValuesNotPresent(valuesToSetIfNotPresent: FormValues)Set values if they are not present
- isValidDropDown(key: string): booleanValidates dropdown
- setNodeIdValueForViewersLinkedToUploadWidget(linkedUploadWidgetContentSelected: UploadWidgetContentLinkModel)Set node id
- changeFieldVisibility(fieldId: string, visibility: boolean): voidChanges field visibility
- changeFieldDisabled(fieldId: string, disabled: boolean): voidChanges disabled status of field
- changeFieldRequired(fieldId: string, required: boolean): voidChanges required status of field
- changeFieldValue(fieldId: string, value: any): voidChanges field value
- changeVariableValue(variableId: string, value: any): voidChanges variable value
- loadInjectedFieldValidators(injectedFieldValidators: FormFieldValidator[]): voidChecks it there are any injectedValidators and adds them to the array of field validators.