UNPKG

2.99 kBTypeScriptView Raw
1import { ApplicationRef, ComponentFactoryResolver, ComponentRef, ElementRef, EmbeddedViewRef, EventEmitter, Injector, NgZone, Renderer2, StaticProvider, TemplateRef, Type, ViewContainerRef } from '@angular/core';
2import { PositioningOptions, PositioningService } from 'ngx-bootstrap/positioning';
3import { ListenOptions } from './listen-options.model';
4export declare class ComponentLoader<T> {
5 private _viewContainerRef;
6 private _renderer;
7 private _elementRef;
8 private _injector;
9 private _componentFactoryResolver;
10 private _ngZone;
11 private _applicationRef;
12 private _posService;
13 onBeforeShow: EventEmitter<any>;
14 onShown: EventEmitter<any>;
15 onBeforeHide: EventEmitter<any>;
16 onHidden: EventEmitter<any>;
17 instance?: T;
18 _componentRef?: ComponentRef<T>;
19 _inlineViewRef?: EmbeddedViewRef<T>;
20 private _providers;
21 private _componentFactory?;
22 private _zoneSubscription?;
23 private _contentRef?;
24 private _innerComponent?;
25 private _unregisterListenersFn?;
26 private _isHiding;
27 /**
28 * Placement of a component. Accepts: "top", "bottom", "left", "right"
29 */
30 private attachment?;
31 /**
32 * A selector specifying the element the popover should be appended to.
33 */
34 private container;
35 /**
36 * A selector used if container element was not found
37 */
38 private containerDefaultSelector;
39 /**
40 * Specifies events that should trigger. Supports a space separated list of
41 * event names.
42 */
43 private triggers?;
44 private _listenOpts;
45 private _globalListener;
46 /**
47 * Do not use this directly, it should be instanced via
48 * `ComponentLoadFactory.attach`
49 * @internal
50 */
51 constructor(_viewContainerRef: ViewContainerRef | undefined, _renderer: Renderer2 | undefined, _elementRef: ElementRef | undefined, _injector: Injector, _componentFactoryResolver: ComponentFactoryResolver, _ngZone: NgZone, _applicationRef: ApplicationRef, _posService: PositioningService);
52 get isShown(): boolean;
53 attach(compType: Type<T>): ComponentLoader<T>;
54 to(container?: string | ElementRef): ComponentLoader<T>;
55 position(opts?: PositioningOptions): ComponentLoader<T>;
56 provide(provider: StaticProvider): ComponentLoader<T>;
57 show(opts?: {
58 content?: string | TemplateRef<unknown>;
59 context?: unknown;
60 initialState?: unknown;
61 [key: string]: unknown;
62 id?: number | string;
63 }): ComponentRef<T> | undefined;
64 hide(id?: number | string): ComponentLoader<T>;
65 toggle(): void;
66 dispose(): void;
67 listen(listenOpts: ListenOptions): ComponentLoader<T>;
68 _removeGlobalListener(): void;
69 attachInline(vRef: ViewContainerRef | undefined, template: TemplateRef<any> | undefined): ComponentLoader<T>;
70 _registerOutsideClick(): void;
71 getInnerComponent(): ComponentRef<T> | undefined;
72 private _subscribePositioning;
73 private _unsubscribePositioning;
74 private _getContentRef;
75}