Renamed prefixes in angular.json
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma
2019-11-04 13:43:46 +01:00
parent c32214f544
commit cec43a636c
183 changed files with 4 additions and 4 deletions

View File

@@ -0,0 +1,3 @@
<div class="selected-item-container">
<ng-template fm-map-widget-host></ng-template>
</div>

View File

@@ -0,0 +1,14 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss";
.row {
border-bottom: 1px solid gray('500');
user-select: none;
}
.row:hover {
background-color: gray('100');
}

View File

@@ -0,0 +1,40 @@
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
import { IItem } from '@farmmaps/common';
import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
@Component({
selector: 'fm-map-selected-item-container',
templateUrl: './selected-item-container.component.html',
styleUrls: ['./selected-item-container.component.scss']
})
export class SelectedItemContainerComponent {
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractSelectedItemComponent) public selectedItemComponents: AbstractSelectedItemComponent[] ) {
}
@Input() item: IItem;
@ViewChild(WidgetHostDirective) 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) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.selectedItemComponents[i]['constructor'] as any);
}
}
const viewContainerRef = this.widgetHost.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractSelectedItemComponent>componentRef.instance).item = this.item;
}
ngOnChanges(changes: SimpleChanges) {
if (changes["item"] && changes["item"].currentValue) {
this.loadComponent();
}
}
}