AW-784 Reapply from Farmmaps commits

- 6f79b625: AW-738 changed selected-item-container to allow forSourceTask annotation.
This commit is contained in:
Peter (extern) 2019-12-20 09:18:00 +01:00
parent 709c76a851
commit e1ff44ed3c

View File

@ -19,12 +19,20 @@ export class SelectedItemContainerComponent {
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() {
var componentFactory: ComponentFactory<AbstractSelectedItemComponent> = 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<AbstractSelectedItemComponent> = 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();