@alfresco/adf-process-services-cloud 8.4.0-21831030013 → 8.4.0-21865971694

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable, EventEmitter, DestroyRef, Output, Input, ContentChild, Directive, InjectionToken, Inject, ViewEncapsulation, Component, NgModule, effect, ViewChild, Optional, ChangeDetectorRef, HostListener, ViewContainerRef, ChangeDetectionStrategy, input, output, signal, SecurityContext } from '@angular/core';
3
3
  import * as i2 from '@alfresco/adf-core';
4
- import { AppConfigService, JwtHelperService, TranslationService, DataTableSchema, UserPreferenceValues, CustomEmptyContentTemplateDirective, ObjectDataTableAdapter, ColumnsSelectorComponent, MainMenuDataTableTemplateDirective, EmptyContentComponent, NoContentTemplateDirective, LoadingContentTemplateDirective, DataTableComponent, AdfDateFnsAdapter, MOMENT_DATE_FORMATS, IconModule, UserPreferencesService, DateFnsUtils, ADF_DATE_FORMATS, FullNamePipe, InitialUsernamePipe, FormService, FormModel, FormBaseComponent, WidgetVisibilityService, UploadWidgetContentLinkModel, FormEvent, FormOutcomeModel, ConfirmDialogComponent, FormOutcomeEvent, FormatSpacePipe, FormRendererComponent, ToolbarDividerComponent, ToolbarComponent, WidgetComponent, ThumbnailService, NotificationService, ErrorWidgetComponent, LocalizedDatePipe, UploadDirective, ContentLinkModel, ErrorMessageModel, DEFAULT_DATE_FORMAT, FormFieldEvent, FormFieldTypes, SelectFilterInputComponent, DynamicComponentMapper, CardViewTextItemModel, CardViewSelectItemModel, CardViewDatetimeItemModel, CardViewDateItemModel, CardViewArrayItemModel, CardViewComponent, CustomLoadingContentTemplateDirective, isOutcomeButtonVisible, InplaceFormInputComponent, BaseViewerWidgetComponent, ObjectDataColumn, ObjectDataRow, FormBaseModule, FormRenderingService, provideTranslations } from '@alfresco/adf-core';
4
+ import { AppConfigService, JwtHelperService, TranslationService, DataTableSchema, UserPreferenceValues, CustomEmptyContentTemplateDirective, ObjectDataTableAdapter, ColumnsSelectorComponent, MainMenuDataTableTemplateDirective, EmptyContentComponent, NoContentTemplateDirective, LoadingContentTemplateDirective, DataTableComponent, AdfDateFnsAdapter, MOMENT_DATE_FORMATS, IconModule, UserPreferencesService, DateFnsUtils, ADF_DATE_FORMATS, FullNamePipe, InitialUsernamePipe, FormService, FormModel, FormBaseComponent, WidgetVisibilityService, UploadWidgetContentLinkModel, FormEvent, FormOutcomeModel, ConfirmDialogComponent, FormOutcomeEvent, FormatSpacePipe, FormRendererComponent, ToolbarDividerComponent, ToolbarComponent, WidgetComponent, ThumbnailService, NotificationService, ErrorWidgetComponent, LocalizedDatePipe, UploadDirective, ContentLinkModel, ErrorMessageModel, DEFAULT_DATE_FORMAT, FormFieldEvent, FormFieldTypes, SelectFilterInputComponent, DynamicComponentMapper, CardViewTextItemModel, CardViewSelectItemModel, CardViewDatetimeItemModel, CardViewDateItemModel, CardViewArrayItemModel, CardViewComponent, CustomLoadingContentTemplateDirective, isOutcomeButtonVisible, InplaceFormInputComponent, BaseViewerWidgetComponent, BaseDisplayTextWidgetComponent, ObjectDataColumn, ObjectDataRow, FormBaseModule, FormRenderingService, provideTranslations } from '@alfresco/adf-core';
5
5
  import { from, EMPTY, Subject, throwError, of, BehaviorSubject, combineLatest, firstValueFrom, forkJoin, catchError as catchError$1 } from 'rxjs';
6
6
  import { map, take, tap, filter, switchMap, debounceTime, finalize, mergeMap, distinctUntilChanged, expand, reduce, mapTo, catchError, concatMap } from 'rxjs/operators';
7
7
  import * as i1$4 from '@alfresco/adf-content-services';
@@ -8197,16 +8197,10 @@ class DropdownCloudWidgetComponent extends WidgetComponent {
8197
8197
  value = this.field?.value;
8198
8198
  }
8199
8199
  else if (this.field?.value && typeof this.field?.value === 'object') {
8200
- const obj = this.field.value;
8201
- if (obj.id === DEFAULT_OPTION.id || obj.id === '' || obj.id === undefined) {
8202
- value = null;
8203
- }
8204
- else {
8205
- value = { id: obj.id, name: obj.name };
8206
- }
8200
+ value = { id: this.field?.value.id, name: this.field?.value.name };
8207
8201
  }
8208
- else if (this.field.value === null || this.field.value === undefined || this.field.value === '') {
8209
- value = null;
8202
+ else if (this.field.value === null) {
8203
+ value = this.field.value;
8210
8204
  }
8211
8205
  else {
8212
8206
  value = { id: this.field?.value, name: '' };
@@ -8508,10 +8502,6 @@ class DropdownCloudWidgetComponent extends WidgetComponent {
8508
8502
  return event.field.type === FormFieldTypes.DROPDOWN;
8509
8503
  }
8510
8504
  setOptionValue(option, field) {
8511
- if (option == null) {
8512
- field.value = undefined;
8513
- return;
8514
- }
8515
8505
  if (Array.isArray(option) || field.hasMultipleValues) {
8516
8506
  field.value = option;
8517
8507
  return;
@@ -14391,13 +14381,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
14391
14381
  const RICH_TEXT_PARSER_TOKEN = new InjectionToken('RichTextParserService', {
14392
14382
  factory: () => new RichTextParserService()
14393
14383
  });
14394
- class DisplayRichTextWidgetComponent extends WidgetComponent {
14384
+ class DisplayRichTextWidgetComponent extends BaseDisplayTextWidgetComponent {
14395
14385
  constructor() {
14396
14386
  super(...arguments);
14397
14387
  this.richTextParserService = inject(RICH_TEXT_PARSER_TOKEN);
14398
14388
  this.sanitizer = inject(DomSanitizer);
14399
14389
  }
14400
14390
  ngOnInit() {
14391
+ this.parseAndSanitize();
14392
+ // Re-parse when field changes (after expressions are evaluated)
14393
+ this.fieldChangedSubscription = this.fieldChanged.subscribe(() => {
14394
+ this.parseAndSanitize();
14395
+ });
14396
+ }
14397
+ ngOnDestroy() {
14398
+ this.fieldChangedSubscription?.unsubscribe();
14399
+ }
14400
+ storeOriginalValue() {
14401
+ if (this.field) {
14402
+ this.originalFieldValue = JSON.stringify(this.field.value);
14403
+ }
14404
+ }
14405
+ evaluateExpressions() {
14406
+ if (!this.field) {
14407
+ return;
14408
+ }
14409
+ const value = JSON.parse(JSON.stringify(this.field.value));
14410
+ this.applyExpressionsToBlocks(value);
14411
+ }
14412
+ reevaluateExpressions() {
14413
+ if (!this.field || !this.originalFieldValue) {
14414
+ return;
14415
+ }
14416
+ const value = JSON.parse(this.originalFieldValue);
14417
+ this.applyExpressionsToBlocks(value);
14418
+ }
14419
+ applyExpressionsToBlocks(value) {
14420
+ for (const block of value.blocks) {
14421
+ block.data.text = this.resolveExpressions(block.data.text);
14422
+ }
14423
+ this.field.value = value;
14424
+ }
14425
+ parseAndSanitize() {
14401
14426
  this.parsedHTML = this.richTextParserService.parse(this.field.value);
14402
14427
  if (this.parsedHTML instanceof Error) {
14403
14428
  throw this.parsedHTML;