Skip to content

Commit

Permalink
Refactor UfeContext to allow passing of data to
Browse files Browse the repository at this point in the history
rendered components
  • Loading branch information
Milan Unger committed Oct 31, 2023
1 parent 5ac0104 commit 9fc620b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web-ui/src/components/ufe-context/ufe-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ export class UfeContext {
// attributes will be propagated to rendered web components
@Prop() attributes: { [key: string]: string}

// if set, then the "data" property will be assigned to the rendered components
@Prop() data: any;
// any data,
@Prop() data: {
[key: string]: any
};

private ufeRegistry: UfeRegistry;

Expand All @@ -36,11 +38,11 @@ export class UfeContext {
<Host>
<slot name="beforeALl"></slot>
{contextElements.map( el => {
el.attributes = Object.assign({}, el.attributes, this.attributes);
const element = this.ufeRegistry.loadAndRenderElement(el, Object.assign({}, this.attributes, this.data));
return (
<context-item>
<slot name="before-each"></slot>
<span innerHTML={this.ufeRegistry.elementHtmlText(el)}></span>
{ element }
<slot name="after-each"></slot>
</context-item>
)
Expand Down

0 comments on commit 9fc620b

Please sign in to comment.