mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-22 15:11: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(): 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-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): booleanChecks if field value can be overriden with process valueisDefined(value: string): booleanCheck if variable is definedgetFormVariable(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 booleanhasTabs(): booleanCheck if form has tabshasFields(): booleanCheck if there are any fieldshasOutcomes(): booleanCheck if form has outcomesgetFieldById(fieldId: string): FormFieldModelFind field by idgetFormFields(filterTypes?: string[]): FormFieldModel[]Get form fieldsprocessFields(fields: (ContainerModel | FormFieldModel)[], formFieldModel: FormFieldModel[]): voidProcess fieldsisContainerField(field: ContainerModel | FormFieldModel): field is ContainerModelCheck if it is containerisSectionField(field: ContainerModel | FormFieldModel): field is FormFieldModelCheck if it is sectionhandleSectionField(section: FormFieldModel, formFieldModel: FormFieldModel[]): voidHandle sectionhandleContainerField(container: ContainerModel, formFieldModel: FormFieldModel[]): voidHandle containerhandleSingleField(field: FormFieldModel, formFieldModel: FormFieldModel[]): voidHandle single fieldfilterFieldsByType(fields: FormFieldModel[], types?: string[]): FormFieldModel[]Filter fields based on typemarkAsInvalid(): voidSet form as invalidparseOutcomes()Parse outcomes from jsonaddValuesNotPresent(valuesToSetIfNotPresent: FormValues)Set values if they are not presentisValidDropDown(key: string): booleanValidates dropdownsetNodeIdValueForViewersLinkedToUploadWidget(linkedUploadWidgetContentSelected: UploadWidgetContentLinkModel)Set node idchangeFieldVisibility(fieldId: string, visibility: boolean): voidChanges field visibilitychangeFieldDisabled(fieldId: string, disabled: boolean): voidChanges disabled status of fieldchangeFieldRequired(fieldId: string, required: boolean): voidChanges required status of fieldchangeFieldValue(fieldId: string, value: any): voidChanges field valuechangeVariableValue(variableId: string, value: any): voidChanges variable valueloadInjectedFieldValidators(injectedFieldValidators: FormFieldValidator[]): voidChecks it there are any injectedValidators and adds them to the array of field validators.