1 | import { ComponentRef, Injector, ViewContainerRef } from '@angular/core';
|
2 | export interface ComponentType<T> {
|
3 | new (...args: any[]): T;
|
4 | }
|
5 |
|
6 |
|
7 |
|
8 | export declare class ComponentPortal<T> {
|
9 | private _attachedHost?;
|
10 |
|
11 | component: ComponentType<T>;
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 | viewContainerRef: ViewContainerRef;
|
18 |
|
19 | injector: Injector;
|
20 | constructor(component: ComponentType<T>, injector: Injector);
|
21 | /** Attach this portal to a host. */
|
22 | attach(host: BasePortalHost, newestOnTop: boolean): ComponentRef<any>;
|
23 | /** Detach this portal from its host */
|
24 | detach(): void;
|
25 | /** Whether this portal is attached to a host. */
|
26 | get isAttached(): boolean;
|
27 | /**
|
28 | * Sets the PortalHost reference without performing `attach()`. This is used directly by
|
29 | * the PortalHost when it is performing an `attach()` or `detach()`.
|
30 | */
|
31 | setAttachedHost(host?: BasePortalHost): void;
|
32 | }
|
33 | /**
|
34 | * Partial implementation of PortalHost that only deals with attaching a
|
35 | * ComponentPortal
|
36 | */
|
37 | export declare abstract class BasePortalHost {
|
38 |
|
39 | private _attachedPortal?;
|
40 |
|
41 | private _disposeFn?;
|
42 | attach(portal: ComponentPortal<any>, newestOnTop: boolean): ComponentRef<any>;
|
43 | abstract attachComponentPortal<T>(portal: ComponentPortal<T>, newestOnTop: boolean): ComponentRef<T>;
|
44 | detach(): void;
|
45 | setDisposeFn(fn: () => void): void;
|
46 | }
|