From a8ae3d3b4e23a17304886f299484768020f00f47 Mon Sep 17 00:00:00 2001 From: David Olson <157068235+DavidOlson-Hyland@users.noreply.github.com> Date: Thu, 12 Mar 2026 11:51:02 -0500 Subject: [PATCH] AAE-42908 Evaluate expressions for rich-text-display list types (#11726) --- .../display-rich-text.widget.spec.ts | 106 ++++++++++++++++++ .../display-rich-text.widget.ts | 8 +- 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts index 414b4ca337..e09adc40d9 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts @@ -467,5 +467,111 @@ describe('DisplayRichTextWidgetComponent', () => { done(); }, 100); }); + + describe('list block type', () => { + it('should resolve expressions in unordered list blocks', () => { + const form = new FormModel({ + fields: [ + { + id: 'richText1', + type: 'display-rich-text', + value: { + time: 1658154611110, + blocks: [ + { + id: '1', + type: 'list', + data: { + style: 'unordered', + items: [{ content: 'Hello ${field.name}', items: [] }] + } + } + ], + version: 1 + } + }, + { id: 'name', type: 'text', value: 'Yngwie' } + ] + }); + + widget.field = form.getFieldById('richText1'); + fixture.detectChanges(); + + expect(widget.field.value.blocks[0].data.items[0].content).toBe('Hello Yngwie'); + }); + + it('should resolve expressions in ordered list blocks', () => { + const form = new FormModel({ + fields: [ + { + id: 'richText1', + type: 'display-rich-text', + value: { + time: 1658154611110, + blocks: [ + { + id: '1', + type: 'list', + data: { + style: 'ordered', + items: [ + { content: 'First: ${field.firstName}', items: [] }, + { content: 'Last: ${field.lastName}', items: [] } + ] + } + } + ], + version: 1 + } + }, + { id: 'firstName', type: 'text', value: 'Mike' }, + { id: 'lastName', type: 'text', value: 'Watt' } + ] + }); + + widget.field = form.getFieldById('richText1'); + fixture.detectChanges(); + + expect(widget.field.value.blocks[0].data.items[0].content).toBe('First: Mike'); + expect(widget.field.value.blocks[0].data.items[1].content).toBe('Last: Watt'); + }); + + it('should resolve expressions in checklists', () => { + const form = new FormModel({ + fields: [ + { + id: 'richText1', + type: 'display-rich-text', + value: { + time: 1658154611110, + blocks: [ + { + id: '1', + type: 'paragraph', + data: { text: 'Hello ${field.name}' } + }, + { + id: '2', + type: 'list', + data: { + style: 'checklist', + items: [{ content: 'Item for ${field.name}', items: [] }] + } + } + ], + version: 1 + } + }, + { id: 'name', type: 'text', value: 'Yngwie' } + ] + }); + + widget.field = form.getFieldById('richText1'); + fixture.detectChanges(); + + expect(widget.field.value.blocks[0].data.text).toBe('Hello Yngwie'); + expect(widget.field.value.blocks[1].data.items[0].content).toBe('Item for Yngwie'); + }); + }); }); }); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.ts index cf6f4a6193..c21dc32019 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.ts @@ -90,7 +90,13 @@ export class DisplayRichTextWidgetComponent extends BaseDisplayTextWidgetCompone private applyExpressionsToBlocks(value: any): void { for (const block of value.blocks) { - block.data.text = this.resolveExpressions(block.data.text, true); + if (block.type === 'list') { + for (const item of block.data.items) { + item.content = this.resolveExpressions(item.content, true); + } + } else { + block.data.text = this.resolveExpressions(block.data.text, true); + } } this.field.value = value; }