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();