import { Injector, TemplateRef, ViewRef, ViewContainerRef, RendererFactory2, ComponentRef, ComponentFactoryResolver } from '@angular/core'; import { ConnectionPosition } from './position.interface'; /** * Class that allows for inserting Text or TemplateRef. */ export declare class ContentRef { nodes: any[]; viewRef?: ViewRef | undefined; _componentRef?: ComponentRef | undefined; constructor(nodes: any[], viewRef?: ViewRef | undefined, _componentRef?: ComponentRef | undefined); } export declare class DynamicComponentService { private _injector; private rendererFactory; private _componentFactoryResolver; /** It’s not a good idea to inject Renderer2 in Service. so create it in constructor */ private _renderer; /** created component reference */ private _componentRef; /** places a new component as the content */ private _contentRef; /** places a new component at this container */ private _viewContainerRef; /** Subscription to viewport resize events. */ private _resizeSubscription; /** attachment element's calculated position */ originPos: ConnectionPosition; /** overlay element's calculated position */ overlayPos: ConnectionPosition; /** overlay element's original position such as 'bottom-top' */ placement: string; constructor(_injector: Injector, rendererFactory: RendererFactory2, _componentFactoryResolver: ComponentFactoryResolver); /** * create the given component or text to DOM element using the ComponentFactoryResolver. * * @param { any } type * @param { string | TemplateRef } content * @param { Element } hostDomElement * @param { any } context * @return { ComponentRef } _componentRef */ createDynamicComponent(viewContainerRef: ViewContainerRef, type: any, content: string | TemplateRef, hostDomElement?: Element, context?: any): ComponentRef; /** * dispose the created component and remove from the body and unsubscribe event */ dispose(): void; /** * get content from given content * @param { string | TemplateRef } content * @param { any } context * @return { ContentRef } */ private _getContentRef; /** * get component's root node for appending given element * @param { string | TemplateRef } content * @return { HTMLElement } */ getComponentRootNode(_componentRef: ComponentRef): HTMLElement; }