@alfresco/adf-process-services-cloud 9.2.0-35244306307 → 9.2.0-35271819200
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.
|
@@ -8238,6 +8238,14 @@ const resolveRichTextExpressions = (value, resolve, options = {}) => {
|
|
|
8238
8238
|
});
|
|
8239
8239
|
return resolvedValue;
|
|
8240
8240
|
};
|
|
8241
|
+
const hasResolvableRichTextExpressions = (value, hasExpressions) => {
|
|
8242
|
+
let resolvable = false;
|
|
8243
|
+
resolveRichTextExpressions(value, (content) => {
|
|
8244
|
+
resolvable = resolvable || hasExpressions(content);
|
|
8245
|
+
return content;
|
|
8246
|
+
});
|
|
8247
|
+
return resolvable;
|
|
8248
|
+
};
|
|
8241
8249
|
|
|
8242
8250
|
/*!
|
|
8243
8251
|
* @license
|
|
@@ -8256,6 +8264,7 @@ const resolveRichTextExpressions = (value, resolve, options = {}) => {
|
|
|
8256
8264
|
* limitations under the License.
|
|
8257
8265
|
*/
|
|
8258
8266
|
const isSubmissionRow = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
8267
|
+
const isExpressionTemplate = (authoredValue, expressions) => hasResolvableRichTextExpressions(authoredValue, (content) => expressions.hasExpressions(content));
|
|
8259
8268
|
const getExpressionEvaluationEnabled$ = (settings) => isObservable(settings)
|
|
8260
8269
|
? settings.pipe(map((value) => value?.enableExpressionEvaluation ?? false))
|
|
8261
8270
|
: of(settings?.enableExpressionEvaluation ?? false);
|
|
@@ -8266,7 +8275,10 @@ const materializeSubmissionValues = (form, options, expressions) => {
|
|
|
8266
8275
|
}
|
|
8267
8276
|
for (const field of form.getFormFields([FormFieldTypes.DISPLAY_RICH_TEXT])) {
|
|
8268
8277
|
const { authoredValue, parent } = field;
|
|
8269
|
-
if (
|
|
8278
|
+
if (parent?.isTemplate) {
|
|
8279
|
+
continue;
|
|
8280
|
+
}
|
|
8281
|
+
if (!isExpressionTemplate(authoredValue, expressions)) {
|
|
8270
8282
|
continue;
|
|
8271
8283
|
}
|
|
8272
8284
|
const materializedValue = resolveRichTextExpressions(authoredValue, (content) => expressions.resolveExpressions(form, content, true), {
|
|
@@ -15367,8 +15379,10 @@ const RICH_TEXT_PARSER_TOKEN = new InjectionToken('RichTextParserService', {
|
|
|
15367
15379
|
class DisplayRichTextWidgetComponent extends BaseDisplayTextWidgetComponent {
|
|
15368
15380
|
constructor() {
|
|
15369
15381
|
super(...arguments);
|
|
15382
|
+
this.parsedHTML = null;
|
|
15370
15383
|
this.richTextParserService = inject(RICH_TEXT_PARSER_TOKEN);
|
|
15371
15384
|
this.sanitizer = inject(DomSanitizer);
|
|
15385
|
+
this.expressions = inject(FormExpressionService);
|
|
15372
15386
|
}
|
|
15373
15387
|
ngOnInit() {
|
|
15374
15388
|
this.parseAndSanitize();
|
|
@@ -15381,43 +15395,31 @@ class DisplayRichTextWidgetComponent extends BaseDisplayTextWidgetComponent {
|
|
|
15381
15395
|
this.fieldChangedSubscription?.unsubscribe();
|
|
15382
15396
|
}
|
|
15383
15397
|
storeOriginalValue() {
|
|
15384
|
-
|
|
15385
|
-
const authoredValue = this.field.authoredValue;
|
|
15386
|
-
if (authoredValue !== undefined) {
|
|
15387
|
-
this.originalFieldValue = JSON.stringify(authoredValue);
|
|
15388
|
-
}
|
|
15389
|
-
}
|
|
15398
|
+
this.originalFieldValue = this.getAuthoredExpressionTemplate();
|
|
15390
15399
|
}
|
|
15391
15400
|
evaluateExpressions() {
|
|
15392
|
-
|
|
15393
|
-
return;
|
|
15394
|
-
}
|
|
15395
|
-
const authoredValue = this.field.authoredValue;
|
|
15396
|
-
if (authoredValue !== undefined) {
|
|
15397
|
-
this.applyExpressionsToBlocks(authoredValue);
|
|
15398
|
-
}
|
|
15401
|
+
this.renderAuthoredExpressionTemplate();
|
|
15399
15402
|
}
|
|
15400
15403
|
reevaluateExpressions() {
|
|
15404
|
+
this.renderAuthoredExpressionTemplate();
|
|
15405
|
+
}
|
|
15406
|
+
getAuthoredExpressionTemplate() {
|
|
15407
|
+
const authoredValue = this.field?.authoredValue ?? null;
|
|
15408
|
+
const isExpressionTemplate = hasResolvableRichTextExpressions(authoredValue, (content) => this.expressions.hasExpressions(content));
|
|
15409
|
+
return isExpressionTemplate ? JSON.stringify(authoredValue) : undefined;
|
|
15410
|
+
}
|
|
15411
|
+
renderAuthoredExpressionTemplate() {
|
|
15401
15412
|
if (!this.field || !this.originalFieldValue) {
|
|
15402
15413
|
return;
|
|
15403
15414
|
}
|
|
15404
|
-
|
|
15405
|
-
this.applyExpressionsToBlocks(value);
|
|
15406
|
-
}
|
|
15407
|
-
applyExpressionsToBlocks(value) {
|
|
15408
|
-
this.field.value = resolveRichTextExpressions(value, (content) => this.resolveExpressions(content, true));
|
|
15415
|
+
this.field.value = resolveRichTextExpressions(JSON.parse(this.originalFieldValue), (content) => this.resolveExpressions(content, true));
|
|
15409
15416
|
}
|
|
15410
15417
|
parseAndSanitize() {
|
|
15411
|
-
|
|
15412
|
-
if (
|
|
15413
|
-
throw
|
|
15414
|
-
}
|
|
15415
|
-
else {
|
|
15416
|
-
this.sanitizeHtmlContent();
|
|
15418
|
+
const parsedValue = this.richTextParserService.parse(this.field.value);
|
|
15419
|
+
if (parsedValue instanceof Error) {
|
|
15420
|
+
throw parsedValue;
|
|
15417
15421
|
}
|
|
15418
|
-
|
|
15419
|
-
sanitizeHtmlContent() {
|
|
15420
|
-
this.parsedHTML = this.sanitizer.sanitize(SecurityContext.HTML, this.parsedHTML);
|
|
15422
|
+
this.parsedHTML = this.sanitizer.sanitize(SecurityContext.HTML, parsedValue);
|
|
15421
15423
|
}
|
|
15422
15424
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.31", ngImport: i0, type: DisplayRichTextWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
15423
15425
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.31", type: DisplayRichTextWidgetComponent, isStandalone: true, selector: "display-rich-text", host: { listeners: { "click": "event($event)", "blur": "event($event)", "change": "event($event)", "focus": "event($event)", "focusin": "event($event)", "focusout": "event($event)", "input": "event($event)", "invalid": "event($event)", "select": "event($event)" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"adf-display-rich-text-widget\">\n <div class=\"adf-display-rich-text-widget-parsed-html\" [innerHTML]=\"parsedHTML\"></div>\n</div>\n", styles: [".adf-display-rich-text-widget pre{min-height:100px;white-space:pre;word-wrap:normal;overflow-x:auto;resize:vertical;width:100%}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|