mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1769] Added JSDocs to services (#2937)
* [ADF-1769] Added JSDocs to services * Removed JSDoc return directives from doc comments
This commit is contained in:
committed by
Eugenio Romano
parent
b3955b3f6c
commit
68ded23c9a
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
Implements the folder menu actions for the Document List component.
|
Implements the folder menu actions for the Document List component.
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
- `getHandler(key: string): ContentActionHandler`
|
||||||
|
Gets the handler function for an action.
|
||||||
|
- `key` - Identifier for the action
|
||||||
|
- `setHandler(key: string, handler: ContentActionHandler): boolean`
|
||||||
|
Sets a new handler function for an action.
|
||||||
|
- `key` - Identifier for the action
|
||||||
|
- `handler` - The new handler function
|
||||||
|
- `canExecuteAction(obj: any): boolean`
|
||||||
|
Checks if an action is available for a particular item.
|
||||||
|
- `obj` - Item to check
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
This service implements the built-in actions that can be applied to a folder
|
This service implements the built-in actions that can be applied to a folder
|
||||||
|
@@ -4,14 +4,19 @@ Maps an APS form field type string onto the corresponding form widget component
|
|||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
`getComponentTypeResolver(fieldType: string, defaultValue: Type<{}> = UnknownWidgetComponent): ComponentTypeResolver`<br/>
|
- `getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction`
|
||||||
Gets the currently active ComponentTypeResolver function for a field type.
|
Gets the currently active ComponentTypeResolver function for a field type.
|
||||||
|
- `type` - The type whose resolver you want
|
||||||
`setComponentTypeResolver(fieldType: string, resolver: ComponentTypeResolver, override: boolean = false)`<br/>
|
- `defaultValue` - Default type returned for types that are not yet mapped
|
||||||
Sets or optionally replaces a ComponentTypeResolver function for a field type.
|
- `setComponentTypeResolver(type: string, resolver: DynamicComponentResolveFunction, override: boolean = false)`
|
||||||
|
Sets or optionally replaces a ComponentTypeResolver function for a field type.
|
||||||
`resolveComponentType(field: FormFieldModel, defaultValue: Type<{}> = UnknownWidgetComponent): Type<{}>`<br/>
|
- `type` - The type whose resolver you want to set
|
||||||
Finds the component type that is needed to render a form field.
|
- `resolver` - The new resolver function
|
||||||
|
- `override` - The new resolver will only replace an existing one if this parameter is true
|
||||||
|
- `resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}>`
|
||||||
|
Finds the component type that is needed to render a form field.
|
||||||
|
- `model` - \[Form field model](form-field.model.md) for the field to render
|
||||||
|
- `defaultValue` - Default type returned for field types that are not yet mapped.
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
|
@@ -46,26 +46,108 @@ class MyComponent {
|
|||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
| Name | Params | Returns | Description |
|
- `parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel`
|
||||||
| ---- | ------ | ------- | ----------- |
|
Parses JSON data to create a corresponding Form model.
|
||||||
| createFormFromANode | (formName: string) | Observable\\<any> | Create a Form with a fields for each metadata properties |
|
- `json` - JSON to create the form
|
||||||
| createForm | (formName: string) | Observable\\<any> | Create a Form |
|
- `data` - (Optional) Values for the form fields
|
||||||
| addFieldsToAForm | (formId: string, formModel: FormDefinitionModel) | Observable\\<any> | Add Fileds to A form |
|
- `readOnly` - Should the form fields be read-only?
|
||||||
| searchFrom | (name: string) | Observable\\<any> | Search For A Form by name |
|
- `createFormFromANode(formName: string): Observable<any>`
|
||||||
| getForms | n/a | Observable\\<any> | Get All the forms |
|
Create a Form with a field for each metadata property.
|
||||||
| getProcessDefinitions | n/a | Observable\\<any> | Get Process Definitions |
|
- `formName` - Name of the new form
|
||||||
| getTasks | n/a | Observable\\<any> | Get All the Tasks |
|
- `createForm(formName: string): Observable<any>`
|
||||||
| getTask | (taskId: string) | Observable\\<any> | Get Task |
|
Create a Form.
|
||||||
| saveTaskForm | (taskId: string, formValues: FormValues) | Observable\\<any> | Save Task Form |
|
- `formName` - Name of the new form
|
||||||
| completeTaskForm | (taskId: string, formValues: FormValues, outcome?: string) | Observable\\<any> | Complete Task Form |
|
- `saveForm(formId: string, formModel: FormDefinitionModel): Observable<any>`
|
||||||
| getTaskForm | (taskId: string) | Observable\\<any> | Get Form related to a taskId |
|
Saves a form.
|
||||||
| getFormDefinitionById | (formId: string) | Observable\\<any> | Get Form Definition |
|
- `formId` - ID of the form to save
|
||||||
| getFormDefinitionByName | (name: string) | Observable\\<any> | Returns form definition by a given name. |
|
- `formModel` - Model data for the form
|
||||||
| getStartFormInstance | (processId: string) | Observable\\<any> | Get start form instance for a given processId |
|
- `addFieldsToAForm(formId: string, formModel: FormDefinitionModel): Observable<any>`
|
||||||
| getStartFormDefinition | (processId: string) | Observable\\<any> | Get start form definition for a given process |
|
|
||||||
| getRestFieldValues | (taskId: string, field: string) | Observable\\<any> | |
|
- `formId` - ID of the form
|
||||||
| getRestFieldValuesByProcessId | (processDefinitionId: string, field: string) | Observable\\<any> | |
|
- `formModel` - Form definition
|
||||||
| getRestFieldValuesColumnByProcessId | (processDefinitionId: string, field: string, column?: string) | Observable\\<any> | |
|
- `searchFrom(name: string): Observable<any>`
|
||||||
| getRestFieldValuesColumn | (taskId: string, field: string, column?: string) | Observable\\<any> | |
|
Search for a form by name.
|
||||||
| getWorkflowGroups\\ | (filter: string, groupId?: string) | Observable\\<GroupModel\[]> | |
|
- `name` - The form name to search for
|
||||||
| getWorkflowUsers\\ | (filter: string, groupId?: string) | Observable\\<GroupUserModel\[]> | |
|
- `getForms(): Observable<any>`
|
||||||
|
Gets all the forms.
|
||||||
|
|
||||||
|
- `getProcessDefinitions(): Observable<any>`
|
||||||
|
Get Process Definitions
|
||||||
|
|
||||||
|
- `getProcessVarablesById(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 Task Form.
|
||||||
|
- `taskId` - Task Id
|
||||||
|
- `formValues` - Form Values
|
||||||
|
- `completeTaskForm(taskId: string, formValues: FormValues, outcome?: string): Observable<any>`
|
||||||
|
Complete Task Form
|
||||||
|
- `taskId` - Task Id
|
||||||
|
- `formValues` - Form Values
|
||||||
|
- `outcome` - (Optional) Form Outcome
|
||||||
|
- `getTaskForm(taskId: string): Observable<any>`
|
||||||
|
Get Form related to a taskId
|
||||||
|
- `taskId` - Task Id
|
||||||
|
- `getFormDefinitionById(formId: string): Observable<any>`
|
||||||
|
Get Form 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 processId
|
||||||
|
- `processId` - Process definition ID
|
||||||
|
- `getProcessIntance(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 process
|
||||||
|
- `processId` - Process definition ID
|
||||||
|
- `getRestFieldValues(taskId: string, field: string): Observable<any>`
|
||||||
|
Gets values of fields populated by a REST backend.
|
||||||
|
- `taskId` - Task identifier
|
||||||
|
- `field` - Field identifier
|
||||||
|
- `getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable<any>`
|
||||||
|
Gets values of fields populated by a REST backend using a process ID.
|
||||||
|
- `processDefinitionId` - Process identifier
|
||||||
|
- `field` - 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 identifier
|
||||||
|
- `field` - Field identifier
|
||||||
|
- `column` - (Optional) Column identifier
|
||||||
|
- `getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable<any>`
|
||||||
|
Gets column values of fields populated by a REST backend.
|
||||||
|
- `taskId` - Task identifier
|
||||||
|
- `field` - Field identifier
|
||||||
|
- `column` - (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 users
|
||||||
|
- `groupId` - (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 groups
|
||||||
|
- `groupId` - (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
|
||||||
|
@@ -4,8 +4,11 @@ Adds HTML to a string to highlight chosen sections.
|
|||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
`public highlight(text: string, search: string, wrapperClass: string = 'highlight'): HightlightTransformResult`<br/>
|
- `highlight(text: string, search: string, wrapperClass: string = 'highlight'): HightlightTransformResult`
|
||||||
Searches for `search` string(s) within `text` and highlights all occurrences.
|
Searches for `search` string(s) within `text` and highlights all occurrences.
|
||||||
|
- `text` - Text to search within
|
||||||
|
- `search` - Text pattern to search for
|
||||||
|
- `wrapperClass` - CSS class used to provide highlighting style
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
|
@@ -4,26 +4,39 @@ Accesses and manipulates ACS document nodes using their node IDs.
|
|||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
`getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
- `getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||||
Gets the stored information about a node.
|
Gets the stored information about a node.
|
||||||
|
- `nodeId` - ID of the target node
|
||||||
`getNodeChildren(nodeId: string, options: any = {}): Observable<NodePaging>`<br/>
|
- `options` - Optional parameters supported by JSAPI
|
||||||
Gets the items contained in a folder node.
|
- `getNodeChildren(nodeId: string, options: any = {}): Observable<NodePaging>`
|
||||||
|
Gets the items contained in a folder node.
|
||||||
`createNode(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
- `nodeId` - ID of the target node
|
||||||
Creates a new document node inside a folder.
|
- `options` - Optional parameters supported by JSAPI
|
||||||
|
- `createNode(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||||
`createFolder(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
Creates a new document node inside a folder.
|
||||||
Creates a new folder node inside a parent folder.
|
- `parentNodeId` - ID of the parent folder node
|
||||||
|
- `nodeBody` - Data for the new node
|
||||||
`updateNode(nodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`<br/>
|
- `options` - Optional parameters supported by JSAPI
|
||||||
Updates the information about a node.
|
- `createFolder(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||||
|
Creates a new folder node inside a parent folder.
|
||||||
`deleteNode(nodeId: string, options: any = {}): Observable<void>`<br/>
|
- `parentNodeId` - ID of the parent folder node
|
||||||
Moves a node to the "trashcan".
|
- `nodeBody` - Data for the new folder
|
||||||
|
- `options` - Optional parameters supported by JSAPI
|
||||||
`restoreNode(nodeId: string): Observable<MinimalNodeEntryEntity>`<br/>
|
- `updateNode(nodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity>`
|
||||||
Restores a node previously moved to the "trashcan".
|
Updates the information about a node.
|
||||||
|
- `nodeId` - ID of the target node
|
||||||
|
- `nodeBody` - New data for the node
|
||||||
|
- `options` - Optional parameters supported by JSAPI
|
||||||
|
- `deleteNode(nodeId: string, options: any = {}): Observable<void>`
|
||||||
|
Moves a node to the trashcan.
|
||||||
|
- `nodeId` - ID of the target node
|
||||||
|
- `options` - Optional parameters supported by JSAPI
|
||||||
|
- `restoreNode(nodeId: string): Observable<MinimalNodeEntryEntity>`
|
||||||
|
Restores a node previously moved to the trashcan.
|
||||||
|
- `nodeId` - ID of the node to restore
|
||||||
|
- `handleError(error: any): Observable<any>`
|
||||||
|
Reports an error.
|
||||||
|
- `error` - Object representing the error
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
|
@@ -41,6 +41,10 @@ export class FolderActionsService {
|
|||||||
this.setupActionHandlers();
|
this.setupActionHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the handler function for an action.
|
||||||
|
* @param key Identifier for the action
|
||||||
|
*/
|
||||||
getHandler(key: string): ContentActionHandler {
|
getHandler(key: string): ContentActionHandler {
|
||||||
if (key) {
|
if (key) {
|
||||||
let lkey = key.toLowerCase();
|
let lkey = key.toLowerCase();
|
||||||
@@ -49,6 +53,11 @@ export class FolderActionsService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new handler function for an action.
|
||||||
|
* @param key Identifier for the action
|
||||||
|
* @param handler The new handler function
|
||||||
|
*/
|
||||||
setHandler(key: string, handler: ContentActionHandler): boolean {
|
setHandler(key: string, handler: ContentActionHandler): boolean {
|
||||||
if (key) {
|
if (key) {
|
||||||
let lkey = key.toLowerCase();
|
let lkey = key.toLowerCase();
|
||||||
@@ -58,6 +67,10 @@ export class FolderActionsService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if an action is available for a particular item.
|
||||||
|
* @param obj Item to check
|
||||||
|
*/
|
||||||
canExecuteAction(obj: any): boolean {
|
canExecuteAction(obj: any): boolean {
|
||||||
return this.documentListService && obj && obj.entry.isFolder === true;
|
return this.documentListService && obj && obj.entry.isFolder === true;
|
||||||
}
|
}
|
||||||
|
@@ -90,6 +90,12 @@ export class FormService {
|
|||||||
return this.apiService.getInstance().activiti.groupsApi;
|
return this.apiService.getInstance().activiti.groupsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses JSON data to create a corresponding Form model.
|
||||||
|
* @param json JSON to create the form
|
||||||
|
* @param data Values for the form fields
|
||||||
|
* @param readOnly Should the form fields be read-only?
|
||||||
|
*/
|
||||||
parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel {
|
parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel {
|
||||||
if (json) {
|
if (json) {
|
||||||
let form = new FormModel(json, data, readOnly, this);
|
let form = new FormModel(json, data, readOnly, this);
|
||||||
@@ -108,7 +114,8 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Form with a fields for each metadata properties
|
* Create a Form with a field for each metadata property.
|
||||||
|
* @param formName Name of the new form
|
||||||
*/
|
*/
|
||||||
createFormFromANode(formName: string): Observable<any> {
|
createFormFromANode(formName: string): Observable<any> {
|
||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
@@ -129,7 +136,8 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Form
|
* Create a Form.
|
||||||
|
* @param formName Name of the new form
|
||||||
*/
|
*/
|
||||||
createForm(formName: string): Observable<any> {
|
createForm(formName: string): Observable<any> {
|
||||||
let dataModel = {
|
let dataModel = {
|
||||||
@@ -144,6 +152,11 @@ export class FormService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a form.
|
||||||
|
* @param formId ID of the form to save
|
||||||
|
* @param formModel Model data for the form
|
||||||
|
*/
|
||||||
saveForm(formId: string, formModel: FormDefinitionModel): Observable<any> {
|
saveForm(formId: string, formModel: FormDefinitionModel): Observable<any> {
|
||||||
return Observable.fromPromise(
|
return Observable.fromPromise(
|
||||||
this.editorApi.saveForm(formId, formModel)
|
this.editorApi.saveForm(formId, formModel)
|
||||||
@@ -152,7 +165,9 @@ export class FormService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated in 1.7.0, use saveForm API instead
|
* @deprecated in 1.7.0, use saveForm API instead
|
||||||
* Add Fileds to A form
|
* Add Fields to A form
|
||||||
|
* @param formId ID of the form
|
||||||
|
* @param formModel Form definition
|
||||||
*/
|
*/
|
||||||
addFieldsToAForm(formId: string, formModel: FormDefinitionModel): Observable<any> {
|
addFieldsToAForm(formId: string, formModel: FormDefinitionModel): Observable<any> {
|
||||||
this.logService.log('addFieldsToAForm is deprecated in 1.7.0, use saveForm API instead');
|
this.logService.log('addFieldsToAForm is deprecated in 1.7.0, use saveForm API instead');
|
||||||
@@ -162,7 +177,8 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search For A Form by name
|
* Search for a form by name.
|
||||||
|
* @param name The form name to search for
|
||||||
*/
|
*/
|
||||||
searchFrom(name: string): Observable<any> {
|
searchFrom(name: string): Observable<any> {
|
||||||
let opts = {
|
let opts = {
|
||||||
@@ -179,7 +195,7 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get All the forms
|
* Gets all the forms.
|
||||||
*/
|
*/
|
||||||
getForms(): Observable<any> {
|
getForms(): Observable<any> {
|
||||||
let opts = {
|
let opts = {
|
||||||
@@ -200,6 +216,10 @@ export class FormService {
|
|||||||
.catch(err => this.handleError(err));
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get instance variables for a process.
|
||||||
|
* @param processInstanceId ID of the target process
|
||||||
|
*/
|
||||||
getProcessVarablesById(processInstanceId: string): Observable<any[]> {
|
getProcessVarablesById(processInstanceId: string): Observable<any[]> {
|
||||||
return Observable.fromPromise(this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId))
|
return Observable.fromPromise(this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId))
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
@@ -207,7 +227,7 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get All the Tasks
|
* Gets all the tasks.
|
||||||
*/
|
*/
|
||||||
getTasks(): Observable<any> {
|
getTasks(): Observable<any> {
|
||||||
return Observable.fromPromise(this.taskApi.listTasks({}))
|
return Observable.fromPromise(this.taskApi.listTasks({}))
|
||||||
@@ -216,7 +236,7 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Task
|
* Gets a task.
|
||||||
* @param taskId Task Id
|
* @param taskId Task Id
|
||||||
*/
|
*/
|
||||||
getTask(taskId: string): Observable<any> {
|
getTask(taskId: string): Observable<any> {
|
||||||
@@ -226,7 +246,7 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save Task Form
|
* Save Task Form.
|
||||||
* @param taskId Task Id
|
* @param taskId Task Id
|
||||||
* @param formValues Form Values
|
* @param formValues Form Values
|
||||||
*/
|
*/
|
||||||
@@ -275,8 +295,8 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns form definition by a given name.
|
* Returns form definition with a given name.
|
||||||
* @param name
|
* @param name The form name
|
||||||
*/
|
*/
|
||||||
getFormDefinitionByName(name: string): Observable<any> {
|
getFormDefinitionByName(name: string): Observable<any> {
|
||||||
let opts = {
|
let opts = {
|
||||||
@@ -301,6 +321,10 @@ export class FormService {
|
|||||||
.catch(err => this.handleError(err));
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a process instance.
|
||||||
|
* @param processId ID of the process to get
|
||||||
|
*/
|
||||||
getProcessIntance(processId: string): Observable<any> {
|
getProcessIntance(processId: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.processApi.getProcessInstance(processId))
|
return Observable.fromPromise(this.processApi.getProcessInstance(processId))
|
||||||
.map(this.toJson)
|
.map(this.toJson)
|
||||||
@@ -318,26 +342,57 @@ export class FormService {
|
|||||||
.catch(err => this.handleError(err));
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets values of fields populated by a REST backend.
|
||||||
|
* @param taskId Task identifier
|
||||||
|
* @param field Field identifier
|
||||||
|
*/
|
||||||
getRestFieldValues(taskId: string, field: string): Observable<any> {
|
getRestFieldValues(taskId: string, field: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.taskApi.getRestFieldValues(taskId, field)).catch(err => this.handleError(err));
|
return Observable.fromPromise(this.taskApi.getRestFieldValues(taskId, field)).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets values of fields populated by a REST backend using a process ID.
|
||||||
|
* @param processDefinitionId Process identifier
|
||||||
|
* @param field Field identifier
|
||||||
|
*/
|
||||||
getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable<any> {
|
getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.processApi.getRestFieldValues(processDefinitionId, field)).catch(err => this.handleError(err));
|
return Observable.fromPromise(this.processApi.getRestFieldValues(processDefinitionId, field)).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets column values of fields populated by a REST backend using a process ID.
|
||||||
|
* @param processDefinitionId Process identifier
|
||||||
|
* @param field Field identifier
|
||||||
|
* @param column Column identifier
|
||||||
|
*/
|
||||||
getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string): Observable<any> {
|
getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.processApi.getRestTableFieldValues(processDefinitionId, field, column)).catch(err => this.handleError(err));
|
return Observable.fromPromise(this.processApi.getRestTableFieldValues(processDefinitionId, field, column)).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets column values of fields populated by a REST backend.
|
||||||
|
* @param taskId Task identifier
|
||||||
|
* @param field Field identifier
|
||||||
|
* @param column Column identifier
|
||||||
|
*/
|
||||||
getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable<any> {
|
getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable<any> {
|
||||||
return Observable.fromPromise(this.taskApi.getRestFieldValuesColumn(taskId, field, column)).catch(err => this.handleError(err));
|
return Observable.fromPromise(this.taskApi.getRestFieldValuesColumn(taskId, field, column)).catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a URL for the profile picture of a user.
|
||||||
|
* @param userId ID of the target user
|
||||||
|
*/
|
||||||
getUserProfileImageApi(userId: number): string {
|
getUserProfileImageApi(userId: number): string {
|
||||||
return this.apiService.getInstance().activiti.userApi.getUserProfilePictureUrl(userId);
|
return this.apiService.getInstance().activiti.userApi.getUserProfilePictureUrl(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of workflow users.
|
||||||
|
* @param filter Filter to select specific users
|
||||||
|
* @param groupId Group ID for the search
|
||||||
|
*/
|
||||||
getWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]> {
|
getWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]> {
|
||||||
let option: any = {filter: filter};
|
let option: any = {filter: filter};
|
||||||
if (groupId) {
|
if (groupId) {
|
||||||
@@ -354,6 +409,11 @@ export class FormService {
|
|||||||
.catch(err => this.handleError(err));
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of groups in a workflow.
|
||||||
|
* @param filter Filter to select specific groups
|
||||||
|
* @param groupId Group ID for the search
|
||||||
|
*/
|
||||||
getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]> {
|
getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]> {
|
||||||
let option: any = {filter: filter};
|
let option: any = {filter: filter};
|
||||||
if (groupId) {
|
if (groupId) {
|
||||||
@@ -364,6 +424,10 @@ export class FormService {
|
|||||||
.catch(err => this.handleError(err));
|
.catch(err => this.handleError(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ID of a form.
|
||||||
|
* @param res Object representing a form
|
||||||
|
*/
|
||||||
getFormId(res: any): string {
|
getFormId(res: any): string {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
@@ -374,6 +438,10 @@ export class FormService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a JSON representation of form data.
|
||||||
|
* @param res Object representing form data
|
||||||
|
*/
|
||||||
toJson(res: any) {
|
toJson(res: any) {
|
||||||
if (res) {
|
if (res) {
|
||||||
return res || {};
|
return res || {};
|
||||||
@@ -381,6 +449,10 @@ export class FormService {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a JSON array representation of form data.
|
||||||
|
* @param res Object representing form data
|
||||||
|
*/
|
||||||
toJsonArray(res: any) {
|
toJsonArray(res: any) {
|
||||||
if (res) {
|
if (res) {
|
||||||
return res.data || [];
|
return res.data || [];
|
||||||
@@ -388,6 +460,10 @@ export class FormService {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reports an error message.
|
||||||
|
* @param error Data object with optional `message` and `status` fields for the error
|
||||||
|
*/
|
||||||
handleError(error: any): Observable<any> {
|
handleError(error: any): Observable<any> {
|
||||||
let errMsg = FormService.UNKNOWN_ERROR_MESSAGE;
|
let errMsg = FormService.UNKNOWN_ERROR_MESSAGE;
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@@ -31,6 +31,11 @@ export abstract class DynamicComponentMapper {
|
|||||||
protected defaultValue: Type<{}> = undefined;
|
protected defaultValue: Type<{}> = undefined;
|
||||||
protected types: { [key: string]: DynamicComponentResolveFunction } = {};
|
protected types: { [key: string]: DynamicComponentResolveFunction } = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the currently active ComponentTypeResolver function for a field type.
|
||||||
|
* @param type The type whose resolver you want
|
||||||
|
* @param defaultValue Default type returned for types that are not yet mapped
|
||||||
|
*/
|
||||||
getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction {
|
getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction {
|
||||||
if (type) {
|
if (type) {
|
||||||
return this.types[type] || DynamicComponentResolver.fromType(defaultValue);
|
return this.types[type] || DynamicComponentResolver.fromType(defaultValue);
|
||||||
@@ -38,6 +43,12 @@ export abstract class DynamicComponentMapper {
|
|||||||
return DynamicComponentResolver.fromType(defaultValue);
|
return DynamicComponentResolver.fromType(defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets or optionally replaces a ComponentTypeResolver function for a field type.
|
||||||
|
* @param type The type whose resolver you want to set
|
||||||
|
* @param resolver The new resolver function
|
||||||
|
* @param override The new resolver will only replace an existing one if this parameter is true
|
||||||
|
*/
|
||||||
setComponentTypeResolver(type: string, resolver: DynamicComponentResolveFunction, override: boolean = false) {
|
setComponentTypeResolver(type: string, resolver: DynamicComponentResolveFunction, override: boolean = false) {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
throw new Error(`type is null or not defined`);
|
throw new Error(`type is null or not defined`);
|
||||||
@@ -55,6 +66,11 @@ export abstract class DynamicComponentMapper {
|
|||||||
this.types[type] = resolver;
|
this.types[type] = resolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the component type that is needed to render a form field.
|
||||||
|
* @param model [Form field model](form-field.model.md) for the field to render
|
||||||
|
* @param defaultValue Default type returned for field types that are not yet mapped.
|
||||||
|
*/
|
||||||
resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}> {
|
resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}> {
|
||||||
if (model) {
|
if (model) {
|
||||||
let resolver = this.getComponentTypeResolver(model.type, defaultValue);
|
let resolver = this.getComponentTypeResolver(model.type, defaultValue);
|
||||||
|
@@ -21,6 +21,12 @@ export interface HightlightTransformResult {
|
|||||||
}
|
}
|
||||||
export class HighlightTransformService {
|
export class HighlightTransformService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches for `search` string(s) within `text` and highlights all occurrences.
|
||||||
|
* @param text Text to search within
|
||||||
|
* @param search Text pattern to search for
|
||||||
|
* @param wrapperClass CSS class used to provide highlighting style
|
||||||
|
*/
|
||||||
public highlight(text: string, search: string, wrapperClass: string = 'highlight'): HightlightTransformResult {
|
public highlight(text: string, search: string, wrapperClass: string = 'highlight'): HightlightTransformResult {
|
||||||
let isMatching = false,
|
let isMatching = false,
|
||||||
result = text;
|
result = text;
|
||||||
|
@@ -38,6 +38,11 @@ export class NodesApiService {
|
|||||||
return entity.entry;
|
return entity.entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the stored information about a node.
|
||||||
|
* @param nodeId ID of the target node
|
||||||
|
* @param options Optional parameters supported by JSAPI
|
||||||
|
*/
|
||||||
getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
||||||
const { nodesApi, handleError, getEntryFromEntity } = this;
|
const { nodesApi, handleError, getEntryFromEntity } = this;
|
||||||
const defaults = {
|
const defaults = {
|
||||||
@@ -53,6 +58,11 @@ export class NodesApiService {
|
|||||||
.catch(handleError);
|
.catch(handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the items contained in a folder node.
|
||||||
|
* @param nodeId ID of the target node
|
||||||
|
* @param options Optional parameters supported by JSAPI
|
||||||
|
*/
|
||||||
getNodeChildren(nodeId: string, options: any = {}): Observable<NodePaging> {
|
getNodeChildren(nodeId: string, options: any = {}): Observable<NodePaging> {
|
||||||
const { nodesApi, handleError } = this;
|
const { nodesApi, handleError } = this;
|
||||||
const defaults = {
|
const defaults = {
|
||||||
@@ -69,6 +79,12 @@ export class NodesApiService {
|
|||||||
.catch(handleError);
|
.catch(handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new document node inside a folder.
|
||||||
|
* @param parentNodeId ID of the parent folder node
|
||||||
|
* @param nodeBody Data for the new node
|
||||||
|
* @param options Optional parameters supported by JSAPI
|
||||||
|
*/
|
||||||
createNode(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
createNode(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
||||||
const { nodesApi, handleError, getEntryFromEntity } = this;
|
const { nodesApi, handleError, getEntryFromEntity } = this;
|
||||||
const promise = nodesApi
|
const promise = nodesApi
|
||||||
@@ -78,11 +94,23 @@ export class NodesApiService {
|
|||||||
return Observable.fromPromise(promise).catch(handleError);
|
return Observable.fromPromise(promise).catch(handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new folder node inside a parent folder.
|
||||||
|
* @param parentNodeId ID of the parent folder node
|
||||||
|
* @param nodeBody Data for the new folder
|
||||||
|
* @param options Optional parameters supported by JSAPI
|
||||||
|
*/
|
||||||
createFolder(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
createFolder(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
||||||
const body = Object.assign({ nodeType: 'cm:folder' }, nodeBody);
|
const body = Object.assign({ nodeType: 'cm:folder' }, nodeBody);
|
||||||
return this.createNode(parentNodeId, body, options);
|
return this.createNode(parentNodeId, body, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the information about a node.
|
||||||
|
* @param nodeId ID of the target node
|
||||||
|
* @param nodeBody New data for the node
|
||||||
|
* @param options Optional parameters supported by JSAPI
|
||||||
|
*/
|
||||||
updateNode(nodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
updateNode(nodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
|
||||||
const { nodesApi, handleError, getEntryFromEntity } = this;
|
const { nodesApi, handleError, getEntryFromEntity } = this;
|
||||||
const promise = nodesApi
|
const promise = nodesApi
|
||||||
@@ -92,6 +120,11 @@ export class NodesApiService {
|
|||||||
return Observable.fromPromise(promise).catch(handleError);
|
return Observable.fromPromise(promise).catch(handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves a node to the trashcan.
|
||||||
|
* @param nodeId ID of the target node
|
||||||
|
* @param options Optional parameters supported by JSAPI
|
||||||
|
*/
|
||||||
deleteNode(nodeId: string, options: any = {}): Observable<void> {
|
deleteNode(nodeId: string, options: any = {}): Observable<void> {
|
||||||
const { nodesApi, handleError } = this;
|
const { nodesApi, handleError } = this;
|
||||||
const promise = nodesApi
|
const promise = nodesApi
|
||||||
@@ -102,6 +135,10 @@ export class NodesApiService {
|
|||||||
.catch(handleError);
|
.catch(handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restores a node previously moved to the trashcan.
|
||||||
|
* @param nodeId ID of the node to restore
|
||||||
|
*/
|
||||||
restoreNode(nodeId: string): Observable<MinimalNodeEntryEntity> {
|
restoreNode(nodeId: string): Observable<MinimalNodeEntryEntity> {
|
||||||
const { nodesApi, handleError, getEntryFromEntity } = this;
|
const { nodesApi, handleError, getEntryFromEntity } = this;
|
||||||
const promise = nodesApi
|
const promise = nodesApi
|
||||||
@@ -113,6 +150,10 @@ export class NodesApiService {
|
|||||||
.catch(handleError);
|
.catch(handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reports an error.
|
||||||
|
* @param error Object representing the error
|
||||||
|
*/
|
||||||
handleError(error: any): Observable<any> {
|
handleError(error: any): Observable<any> {
|
||||||
return Observable.throw(error);
|
return Observable.throw(error);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user