* fix after rebase * new release strategy for ng next Signed-off-by: eromano <eugenioromano16@gmail.com> * peer dep Signed-off-by: eromano <eugenioromano16@gmail.com> * Angular 14 fix unit test and storybook Signed-off-by: eromano <eugenioromano16@gmail.com> fix after rebase Signed-off-by: eromano <eugenioromano16@gmail.com> update pkg.json Signed-off-by: eromano <eugenioromano16@gmail.com> missing dep Signed-off-by: eromano <eugenioromano16@gmail.com> Fix mistake and missing code Dream....build only affected libs Add utility run commands * Use nx command to run affected tests * Fix nx test core fix content tests Run unit with watch false core test fixes reduce test warnings Fix process cloud unit Fix adf unit test Fix lint process cloud Disable lint next line Use right core path Fix insights unit fix linting insights Fix process-services unit fix the extensions test report fix test warnings Fix content unit Fix bunch of content unit * Produce an adf alpha of 14 * hopefully fixing the content * Push back the npm publish * Remove flaky unit * Fix linting * Make the branch as root * Get rid of angualar13 * Remove the travis depth * Fixing version for npm * Enabling cache for unit and build * Fix scss for core and paths Copy i18 and asset by using ng-packager Export the theming alias and fix path Use ng-package to copy assets process-services-cloud Use ng-package to copy assets process-services Use ng-package to copy assets content-services Use ng-package to copy assets insights * feat: fix api secondary entry point * fix storybook rebase * Move dist under dist/libs from lib/dist * Fix the webstyle * Use only necessary nrwl deps and improve lint * Fix unit for libs * Convert lint.sh to targets - improve performance * Use latest of angular * Align alfresco-js-api Signed-off-by: eromano <eugenioromano16@gmail.com> Co-authored-by: eromano <eugenioromano16@gmail.com> Co-authored-by: Mikolaj Serwicki <mikolaj.serwicki@hyland.com> Co-authored-by: Tomasz <tomasz.gnyp@hyland.com>
9.6 KiB
Title, Added, Status
Title | Added | Status |
---|---|---|
Form service | v2.0.0 | Active |
Form service
Implements Process Services form methods
Basic Usage
import { FormService, FormEvent, FormFieldEvent } from '@alfresco/adf-core';
@Component(...)
class MyComponent {
constructor(formService: FormService) {
formService.formLoaded.subscribe(
(e: FormEvent) => {
console.log(`Form loaded: ${e.form.id}`);
}
);
formService.formFieldValueChanged.subscribe(
(e: FormFieldEvent) => {
console.log(`Field value changed. Form: ${e.form.id}, Field: ${e.field.id}, Value: ${e.field.value}`);
}
);
}
}
Events
Name | Args Type | Description |
---|---|---|
formLoaded | FormEvent |
Raised when form has been loaded or reloaded |
formFieldValueChanged | FormFieldEvent |
Raised when input values change |
taskCompleted | FormEvent |
Raised when a task is completed successfully |
taskCompletedError | FormErrorEvent |
Raised when a task is completed unsuccessfully |
taskSaved | FormEvent |
Raised when a task is saved successfully |
taskSavedError | FormErrorEvent |
Raised when a task is saved unsuccessfully |
executeOutcome | FormOutcomeEvent |
Raised when a form outcome is executed |
formEvents | Event | You can subscribe to this event to listen : ( click, blur, change, focus, focusin, focusout, input, invalid, select) of any elements in the form , see doc below |
validateForm | ValidateFormEvent |
Raised each time a form is validated. You can use it to provide custom validation or prevent default behaviour. |
validateFormField | ValidateFormFieldEvent |
Raised each time a form field is validated. You can use it to provide custom validation or prevent default behaviour. |
Methods
-
parseForm(json: any, data?:
FormValues,
readOnly: boolean = false):
FormModel
Parses JSON data to create a correspondingForm
model.json
- JSON to create the formdata
- (Optional) Values for the form fieldsreadOnly
- Should the form fields be read-only?
-
createFormFromANode(formName: string):
Observable
<any>
Create aForm
with a field for each metadata property.formName
- Name of the new form
-
createForm(formName: string):
Observable
<any>
Create aForm
.formName
- Name of the new form
-
saveForm(formId: string, formModel: FormDefinitionModel):
Observable
<any>
Saves a form.formId
- ID of the form to saveformModel
-Model
data for the form
-
searchFrom(name: string):
Observable
<any>
Search for a form by name.name
- The form name to search for
-
getForms():
Observable
<any>
Gets all the forms. -
getProcessDefinitions():
Observable
<any>
Get Process Definitions -
getProcessVariablesById(processInstanceId: string):
Observable
<any[]>
Get instance variables for a process.processInstanceId
- ID of the target process
-
getTasks():
Observable
<any>
Gets all the tasks. -
getTask(taskId: string):
Observable
<any>
Gets a task.taskId
- Task Id
-
saveTaskForm(taskId: string, formValues: FormValues):
Observable
<any>
Save TaskForm
.taskId
- Task IdformValues
-Form
Values
-
completeTaskForm(taskId: string, formValues:
FormValues,
outcome?: string):
Observable
<any>
Complete TaskForm
-
getTaskForm(taskId: string):
Observable
<any>
GetForm
related to a taskIdtaskId
- Task Id
-
getFormDefinitionById(formId: string):
Observable
<any>
GetForm
Definition
formId
-Form
Id
-
getFormDefinitionByName(name: string):
Observable
<any>
Returns form definition with a given name.name
- The form name
-
getStartFormInstance(processId: string):
Observable
<any>
Get start form instance for a given processIdprocessId
- Process definition ID
-
getProcessInstance(processId: string):
Observable
<any>
Gets a process instance.processId
- ID of the process to get
-
getStartFormDefinition(processId: string):
Observable
<any>
Get start form definition for a given processprocessId
- Process definition ID
-
getRestFieldValues(taskId: string, field: string):
Observable
<any>
Gets values of fields populated by a REST backend.taskId
- Task identifierfield
- Field identifier
-
getRestFieldValuesByProcessId(processDefinitionId: string, field: string):
Observable
<any>
Gets values of fields populated by a REST backend using a process ID.processDefinitionId
- Process identifierfield
- Field identifier
-
getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string):
Observable
<any>
Gets column values of fields populated by a REST backend using a process ID.processDefinitionId
- Process identifierfield
- Field identifiercolumn
- (Optional) Column identifier
-
getRestFieldValuesColumn(taskId: string, field: string, column?: string):
Observable
<any>
Gets column values of fields populated by a REST backend.taskId
- Task identifierfield
- Field identifiercolumn
- (Optional) Column identifier
-
getUserProfileImageApi(userId: number): string
Returns a URL for the profile picture of a user.userId
- ID of the target user
-
getWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]>
Gets a list of workflow users.filter
- Filter to select specific usersgroupId
- (Optional) Group ID for the search
-
getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]>
Gets a list of groups in a workflow.filter
- Filter to select specific groupsgroupId
- (Optional) Group ID for the search
-
getFormId(res: any): string
Gets the ID of a form.res
- Object representing a form
-
toJson(res: any): any
Creates a JSON representation of form data.res
- Object representing form data
-
toJsonArray(res: any): any
Creates a JSON array representation of form data.res
- Object representing form data
-
handleError(error: any):
Observable
<any>
Reports an error message.error
- Data object with optional `message` and `status` fields for the error