From e1ff44ed3c010229caed029de513850d6c426c19 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Fri, 20 Dec 2019 09:18:00 +0100 Subject: [PATCH] AW-784 Reapply from Farmmaps commits - 6f79b625: AW-738 changed selected-item-container to allow forSourceTask annotation. --- .../selected-item-container.component.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts b/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts index 7dd0d2d..5bece46 100644 --- a/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item-container/selected-item-container.component.ts @@ -19,12 +19,20 @@ export class SelectedItemContainerComponent { @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective; loadComponent() { - var componentFactory: ComponentFactory = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default - for (var i = 0; i < this.selectedItemComponents.length; i++) { - if (this.selectedItemComponents[i]['forItemType'] == this.item.itemType) { + let componentFactory: ComponentFactory = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default + for (let i = 0; i < this.selectedItemComponents.length; i++) { + let hasSourceTask = this.selectedItemComponents[i]['forSourceTask'] != null && + this.selectedItemComponents[i]['forSourceTask'] != undefined; + + if (this.selectedItemComponents[i]['forItemType'] == this.item.itemType && + hasSourceTask && this.selectedItemComponents[i]['forSourceTask'] == this.item.sourceTask) { + + componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.selectedItemComponents[i]['constructor'] as any); + break; + } else if (this.selectedItemComponents[i]['forItemType'] == this.item.itemType) { componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.selectedItemComponents[i]['constructor'] as any); } - } + } const viewContainerRef = this.widgetHost.viewContainerRef; viewContainerRef.clear();