1
0

97399 Implemented basic working tooltip on top level community list

This commit is contained in:
Koen Pauwels
2022-12-16 11:41:09 +01:00
parent e4f483c308
commit a40d93a941
10 changed files with 154 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
import { ComponentFactoryResolver, ComponentRef, Directive, Input, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
import { PlacementArray } from '@ng-bootstrap/ng-bootstrap/util/positioning';
import { ContextHelpWrapperComponent, PlacementDir } from './context-help-wrapper/context-help-wrapper.component';
@Directive({
selector: '[dsContextHelp]'
})
export class ContextHelpDirective implements OnInit {
@Input('dsContextHelp') content: string;
@Input('dsTooltipPlacement') tooltipPlacement: PlacementArray;
// @Input('iconPlacement') iconPlacement: PlacementDir;
protected wrapper: ComponentRef<ContextHelpWrapperComponent>;
constructor(
private templateRef: TemplateRef<any>,
private viewContainerRef: ViewContainerRef,
private componentFactoryResolver: ComponentFactoryResolver
){}
ngOnInit() {
const factory
= this.componentFactoryResolver.resolveComponentFactory(ContextHelpWrapperComponent);
this.wrapper = this.viewContainerRef.createComponent(factory);
this.wrapper.instance.templateRef = this.templateRef;
this.wrapper.instance.content = this.content;
this.wrapper.instance.tooltipPlacement = this.tooltipPlacement;
}
}