From 8e3bd154ed5ca3576c41d808f6c3882c8daa41a5 Mon Sep 17 00:00:00 2001
From: tomasz hanaj <12088991+tomaszhanaj@users.noreply.github.com>
Date: Wed, 5 Feb 2025 15:18:11 +0100
Subject: [PATCH] AAE-30336 Screens updates (#10619)
* [AAE-30336] updated interface and removed buttons
* [AAE-30336] added fullscreen support for dynamic component
* [AAE-30336] fullscreen feature and css fix
* [AAE-30336] fixed wrong subscription, removed obsolete code
* [AAE-30336] removed obsolete variable
* [AAE-30336] updated unit test and model
* [AAE-30336] updated documentation and comments
---
.../components/screen-cloud.component.md | 108 ++++++++++++++++++
.../user-task-cloud-buttons.component.md | 51 +++++++++
.../components/user-task-cloud.component.md | 103 +++++++++++++++++
.../screen-cloud/screen-cloud.component.html | 7 +-
.../screen-cloud.component.spec.ts | 38 +++---
.../screen-cloud/screen-cloud.component.ts | 65 ++++++++++-
.../screen-cloud.model.ts} | 11 +-
.../src/lib/screen/public-api.ts | 18 +++
.../user-task-cloud-buttons.component.ts | 2 +
.../user-task-cloud.component.html | 19 +--
.../user-task-cloud.component.ts | 6 +
lib/process-services-cloud/src/public-api.ts | 1 +
12 files changed, 397 insertions(+), 32 deletions(-)
create mode 100644 docs/process-services-cloud/components/screen-cloud.component.md
create mode 100644 docs/process-services-cloud/components/user-task-cloud-buttons.component.md
create mode 100644 docs/process-services-cloud/components/user-task-cloud.component.md
rename lib/process-services-cloud/src/lib/screen/{components/screen-cloud/screen-cloud.interface.ts => models/screen-cloud.model.ts} (79%)
create mode 100644 lib/process-services-cloud/src/lib/screen/public-api.ts
diff --git a/docs/process-services-cloud/components/screen-cloud.component.md b/docs/process-services-cloud/components/screen-cloud.component.md
new file mode 100644
index 0000000000..845cf71a47
--- /dev/null
+++ b/docs/process-services-cloud/components/screen-cloud.component.md
@@ -0,0 +1,108 @@
+---
+Title: Screen Cloud Component
+Added: 2025-02-05
+Status: Active
+Last reviewed: 2025-02-05
+---
+
+# Screen Cloud Component
+
+Provides space for a dynamic component. Dynamic component should implement interface UserTaskCustomUi.
+Dynamic component must be registered with service that extends ScreenRenderingService. Key for component
+is a string taken from property formKey stored in xml. In component this value is stored in property screenId.
+To register component use method register, example:
+
+```typescript
+import { ScreenRenderingService } from '@alfresco/adf-process-services-cloud';
+
+export class YourService extends ScreenRenderingService {
+
+ constructor() {
+ super();
+ this.register(
+ {
+ [formKeyThatIdentifiesDynamicComponent]: () => DynamicComponent
+ },
+ true
+ );
+ }
+}
+```
+
+## Basic Usage
+
+```html
+
+```
+
+## Class members
+
+### Properties
+
+| Name | Type | Default value | Description |
+|---------------------------|---------------------------------------|---------------|---------------------------------------------------|
+| appName | `string` | "" | App id to fetch corresponding form and values. |
+| canClaimTask | `boolean` | | Boolean informing if a task can be claimed. |
+| canUnclaimTask | `boolean` | | Boolean informing if a task can be unclaimed. |
+| processInstanceId | `string` | | Process Instance Id to fetch corresponding data. |
+| readOnly | `boolean` | false | Toggle readonly state of the task. |
+| showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. |
+| screenId | `string` | | Screen id to create dynamic component |
+| taskId | `string` | | Task id to fetch corresponding form and values. |
+| taskName | `string` | | Name of the task. |
+
+
+### Events
+
+| Name | Type | Description |
+|--------------------|------------------------|--------------------------------------------|
+| cancelTask | `EventEmitter` | Emitted when the task is cancelled. |
+| error | `EventEmitter` | Emitted when any error occurs. |
+| taskSaved | `EventEmitter` | Emitted when the task is saved. |
+| claimTask | `EventEmitter` | Emitted when the task is claimed. |
+| taskCompleted | `EventEmitter` | Emitted when the task is completed. |
+| unclaimTask | `EventEmitter` | Emitted when the task is unclaimed. |
+
+
+#### Enabling fullscreen display for the dynamic component
+
+Dynamic component must implement logic for method switchToDisplayMode.
+
+**MyView.component.html**
+
+```html
+
+
+
+```
diff --git a/docs/process-services-cloud/components/user-task-cloud-buttons.component.md b/docs/process-services-cloud/components/user-task-cloud-buttons.component.md
new file mode 100644
index 0000000000..18940ff085
--- /dev/null
+++ b/docs/process-services-cloud/components/user-task-cloud-buttons.component.md
@@ -0,0 +1,51 @@
+---
+Title: User Task Cloud Buttons Component
+Added: 2025-02-05
+Status: Active
+Last reviewed: 2025-02-05
+---
+
+# User Task Cloud Buttons Component
+
+Provides reusable component with buttons related to tasks. It contains three buttons: cancel, claim, unclaim.
+Visibility of each button is controlled by input property.
+
+## Basic Usage
+
+```html
+
+```
+
+## Class members
+
+### Properties
+
+| Name | Type | Default value | Description |
+|---------------------------|---------------------------------------|---------------|---------------------------------------------------|
+| appName | `string` | "" | App id to fetch corresponding form and values. |
+| canClaimTask | `boolean` | | Boolean informing if a task can be claimed. |
+| canUnclaimTask | `boolean` | | Boolean informing if a task can be unclaimed. |
+| taskId | `string` | | Task id to fetch corresponding form and values. |
+| showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. |
+
+
+### Events
+
+| Name | Type | Description |
+|--------------------|------------------------|--------------------------------------------|
+| cancelClick | `EventEmitter` | Emitted when the task is cancelled. |
+| error | `EventEmitter` | Emitted when any error occurs. |
+| claimTask | `EventEmitter` | Emitted when the task is claimed. |
+| unclaimTask | `EventEmitter` | Emitted when the task is unclaimed. |
+
+
diff --git a/docs/process-services-cloud/components/user-task-cloud.component.md b/docs/process-services-cloud/components/user-task-cloud.component.md
new file mode 100644
index 0000000000..a3d5e89f5a
--- /dev/null
+++ b/docs/process-services-cloud/components/user-task-cloud.component.md
@@ -0,0 +1,103 @@
+---
+Title: User Task Cloud Component
+Added: 2025-02-05
+Status: Active
+Last reviewed: 2025-02-05
+---
+
+# User Task Cloud Component
+
+Based on property taskDetails: TaskDetailsCloudModel shows a form or a screen.
+
+## Basic Usage
+
+```html
+
+```
+
+## Class members
+
+### Properties
+
+| Name | Type | Default value | Description |
+|---------------------------|---------------------------------------|---------------|---------------------------------------------------|
+| appName | `string` | "" | App id to fetch corresponding form and values. |
+| readOnly | `boolean` | false | Toggle readonly state of the task. |
+| fieldValidators | `FormFieldValidator[]` | | Allows to provide additional validators to the form field. |
+| showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. |
+| showCompleteButton | `boolean` | true | Toggle rendering of the `Complete` button. |
+| showTitle | `boolean` | true | Toggle rendering of the form title. |
+| showValidationIcon | `boolean` | true | Toggle rendering of the `Validation` icon. |
+| taskId | `string` | | Task id to fetch corresponding form and values. |
+| displayModeConfigurations | `FormCloudDisplayModeConfiguration[]` | | The available display configurations for the form |
+
+### Events
+
+| Name | Type | Description |
+|--------------------|---------------------------------------------------|--------------------------------------------------------------------------------------------------------|
+| cancelClick | `EventEmitter` | Emitted when the cancel button is clicked. |
+| error | `EventEmitter` | Emitted when any error occurs. |
+| executeOutcome | `EventEmitter` | Emitted when any outcome is executed. Default behaviour can be prevented via `event.preventDefault()`. |
+| formContentClicked | `EventEmitter` | Emitted when form content is clicked. |
+| formSaved | `EventEmitter` | Emitted when the form is saved. |
+| onTaskLoaded | `EventEmitter` | Emitted when a task is loaded. |
+| taskClaimed | `EventEmitter` | Emitted when the task is claimed. |
+| taskCompleted | `EventEmitter` | Emitted when the task is completed. |
+| taskUnclaimed | `EventEmitter` | Emitted when the task is unclaimed. |
+ |
+
+#### Enabling fullscreen display for the form of the task
+
+Provide a `displayModeConfiguration` array object containing the fullscreen configuration. You can use the configuration provided in the [`DisplayModeService`](../../../lib/process-services-cloud/src/lib/form/services/display-mode.service.ts) as a static member `DisplayModeService.IMPLEMENTED_DISPLAY_MODE_CONFIGURATIONS`, or configure your own if you want to customise the options for the fullscreen display mode.
+
+**MyView.component.html**
+
+```html
+
+
+
+
+```
+
+**MyView.component.ts**
+
+```ts
+import { DisplayModeService } from '@alfresco/adf-process-services-cloud';
+
+export class MyView {
+
+ get displayConfigurations() {
+ return DisplayModeService.IMPLEMENTED_DISPLAY_MODE_CONFIGURATIONS;
+ }
+
+}
+```
+
+When the `displayModeConfigurations` contains the configuration for the fullscreen display, in the header of the form, a button to switch to fullscreen is displayed. Keep in mind that the header of the form is visible only if any of the parameters `showTitle`, `showRefreshButton`or `showValidationIcon` is `true`, but it is also possible to switch to the fullscreen display using a button that you can place wherever you want as shown in the previous example.
+
+## See also
+
+- [Form component](./form-cloud.component.md)
+- [Form field model](../../core/models/form-field.model.md)
+- [Form cloud service](../services/form-cloud.service.md)
diff --git a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.html b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.html
index 9da96ce9ae..fc5e43296f 100644
--- a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.html
+++ b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.html
@@ -1,8 +1,5 @@
-
-
+
+
-
-
-
diff --git a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts
index f8693b68e7..e0ec11d45a 100644
--- a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts
+++ b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts
@@ -17,7 +17,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { By } from '@angular/platform-browser';
import { ScreenRenderingService } from '../../../services/public-api';
import { TaskScreenCloudComponent } from './screen-cloud.component';
@@ -36,37 +36,45 @@ import { TaskScreenCloudComponent } from './screen-cloud.component';
})
class TestComponent {
@Input() taskId = '';
+ @Input() screenId = '';
@Output() taskCompleted = new EventEmitter();
+ displayMode: string;
onComplete() {
this.taskCompleted.emit();
}
+ switchToDisplayMode(newDisplayMode?: string) {
+ this.displayMode = newDisplayMode;
+ }
}
@Component({
selector: 'adf-cloud-test-actions-component',
- template: `
-
-