From 2bd72f71d595ced91abf526bd1db628116e3c939 Mon Sep 17 00:00:00 2001 From: Robert Duda Date: Mon, 3 Apr 2023 13:57:49 +0200 Subject: [PATCH] [AAE-12318] Adjustments for HxP Attach-File widget (#8425) --- .../lib/form/components/widgets/core/form.model.ts | 12 ++++++++++-- .../widgets/core/upload-widget-content-link.model.ts | 6 ++++-- .../src/lib/form/components/form-cloud.component.ts | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/core/src/lib/form/components/widgets/core/form.model.ts b/lib/core/src/lib/form/components/widgets/core/form.model.ts index 27cef65504c..46c459018fb 100644 --- a/lib/core/src/lib/form/components/widgets/core/form.model.ts +++ b/lib/core/src/lib/form/components/widgets/core/form.model.ts @@ -91,7 +91,13 @@ export class FormModel implements ProcessFormModel { processVariables: ProcessVariableModel[] = []; variables: FormVariableModel[] = []; - constructor(json?: any, formValues?: FormValues, readOnly: boolean = false, protected formService?: FormValidationService, enableFixedSpace?: boolean) { + constructor( + json?: any, + formValues?: FormValues, + readOnly: boolean = false, + protected formService?: FormValidationService, + enableFixedSpace?: boolean + ) { this.readOnly = readOnly; this.json = json; @@ -415,8 +421,10 @@ export class FormModel implements ProcessFormModel { } setNodeIdValueForViewersLinkedToUploadWidget(linkedUploadWidgetContentSelected: UploadWidgetContentLinkModel) { + const linkedWidgetType = linkedUploadWidgetContentSelected?.options?.linkedWidgetType ?? 'uploadWidget'; + const subscribedViewers = this.fieldsCache.filter(field => - linkedUploadWidgetContentSelected.uploadWidgetId === field.params['uploadWidget'] + linkedUploadWidgetContentSelected.uploadWidgetId === field.params[linkedWidgetType] ); subscribedViewers.forEach(viewer => { diff --git a/lib/core/src/lib/form/components/widgets/core/upload-widget-content-link.model.ts b/lib/core/src/lib/form/components/widgets/core/upload-widget-content-link.model.ts index 1c6f8e7f958..f5beb6460db 100644 --- a/lib/core/src/lib/form/components/widgets/core/upload-widget-content-link.model.ts +++ b/lib/core/src/lib/form/components/widgets/core/upload-widget-content-link.model.ts @@ -16,11 +16,13 @@ */ import { ContentLinkModel } from './content-link.model'; - +export class UploadWidgetContentLinkModelOptions { + linkedWidgetType: string; +} export class UploadWidgetContentLinkModel extends ContentLinkModel { uploadWidgetId: string; - constructor(obj?: any, uploadWidgetId?: string) { + constructor(obj?: any, uploadWidgetId?: string, public options?: UploadWidgetContentLinkModelOptions) { super(obj); this.uploadWidgetId = uploadWidgetId; } diff --git a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts index 8d37a5533d5..cb2321df0b7 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts @@ -33,7 +33,8 @@ import { FormValues, FormModel, ContentLinkModel, - UploadWidgetContentLinkModel + UploadWidgetContentLinkModel, + FormEvent } from '@alfresco/adf-core'; import { FormCloudService } from '../services/form-cloud.service'; import { TaskVariableCloud } from '../models/task-variable-cloud.model'; @@ -119,6 +120,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges, if (content instanceof UploadWidgetContentLinkModel) { this.form.setNodeIdValueForViewersLinkedToUploadWidget(content); this.onFormDataRefreshed(this.form); + this.formService.formDataRefreshed.next(new FormEvent(this.form)); } else { this.formContentClicked.emit(content); }