UNPKG

1.88 kBTypeScriptView Raw
1import { ElementRef, ComponentRef, Type, TemplateRef, EventEmitter, Provider } from '@angular/core';
2import { PositioningOptions } from '../positioning';
3export interface ListenOptions {
4 target?: ElementRef;
5 triggers?: string;
6 show?: Function;
7 hide?: Function;
8 toggle?: Function;
9}
10export declare class ComponentLoader<T> {
11 onBeforeShow: EventEmitter<any>;
12 onShown: EventEmitter<any>;
13 onBeforeHide: EventEmitter<any>;
14 onHidden: EventEmitter<any>;
15 instance: T;
16 _componentRef: ComponentRef<T>;
17 private _providers;
18 private _componentFactory;
19 private _elementRef;
20 private _zoneSubscription;
21 private _contentRef;
22 private _viewContainerRef;
23 private _injector;
24 private _renderer;
25 private _ngZone;
26 private _componentFactoryResolver;
27 private _posService;
28 private _unregisterListenersFn;
29 readonly isShown: boolean;
30 /**
31 * Placement of a component. Accepts: "top", "bottom", "left", "right"
32 */
33 private attachment;
34 /**
35 * A selector specifying the element the popover should be appended to.
36 * Currently only supports "body".
37 */
38 private container;
39 /**
40 * Specifies events that should trigger. Supports a space separated list of
41 * event names.
42 */
43 private triggers;
44 attach(compType: Type<T>): ComponentLoader<T>;
45 to(container?: string): ComponentLoader<T>;
46 position(opts?: PositioningOptions): ComponentLoader<T>;
47 provide(provider: Provider): ComponentLoader<T>;
48 show(opts?: {
49 content?: string | TemplateRef<any>;
50 [key: string]: any;
51 }): ComponentRef<T>;
52 hide(): ComponentLoader<T>;
53 toggle(): void;
54 dispose(): void;
55 listen(listenOpts: ListenOptions): ComponentLoader<T>;
56 private _subscribePositioning();
57 private _unsubscribePositioning();
58 private _getContentRef(content);
59}