-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathportal-directives.d-DbeNrI5D.d.ts
executable file
·211 lines (208 loc) · 9.61 KB
/
portal-directives.d-DbeNrI5D.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import * as i0 from '@angular/core';
import { ComponentRef, ViewContainerRef, Injector, EmbeddedViewRef, TemplateRef, ElementRef, OnInit, OnDestroy, EventEmitter } from '@angular/core';
/** Interface that can be used to generically type a class. */
interface ComponentType<T> {
new (...args: any[]): T;
}
/**
* A `Portal` is something that you want to render somewhere else.
* It can be attach to / detached from a `PortalOutlet`.
*/
declare abstract class Portal<T> {
private _attachedHost;
/** Attach this portal to a host. */
attach(host: PortalOutlet): T;
/** Detach this portal from its host */
detach(): void;
/** Whether this portal is attached to a host. */
get isAttached(): boolean;
/**
* Sets the PortalOutlet reference without performing `attach()`. This is used directly by
* the PortalOutlet when it is performing an `attach()` or `detach()`.
*/
setAttachedHost(host: PortalOutlet | null): void;
}
/**
* A `ComponentPortal` is a portal that instantiates some Component upon attachment.
*/
declare class ComponentPortal<T> extends Portal<ComponentRef<T>> {
/** The type of the component that will be instantiated for attachment. */
component: ComponentType<T>;
/**
* Where the attached component should live in Angular's *logical* component tree.
* This is different from where the component *renders*, which is determined by the PortalOutlet.
* The origin is necessary when the host is outside of the Angular application context.
*/
viewContainerRef?: ViewContainerRef | null;
/** Injector used for the instantiation of the component. */
injector?: Injector | null;
/**
* List of DOM nodes that should be projected through `<ng-content>` of the attached component.
*/
projectableNodes?: Node[][] | null;
constructor(component: ComponentType<T>, viewContainerRef?: ViewContainerRef | null, injector?: Injector | null, projectableNodes?: Node[][] | null);
}
/**
* A `TemplatePortal` is a portal that represents some embedded template (TemplateRef).
*/
declare class TemplatePortal<C = any> extends Portal<EmbeddedViewRef<C>> {
/** The embedded template that will be used to instantiate an embedded View in the host. */
templateRef: TemplateRef<C>;
/** Reference to the ViewContainer into which the template will be stamped out. */
viewContainerRef: ViewContainerRef;
/** Contextual data to be passed in to the embedded view. */
context?: C | undefined;
/** The injector to use for the embedded view. */
injector?: Injector | undefined;
constructor(
/** The embedded template that will be used to instantiate an embedded View in the host. */
templateRef: TemplateRef<C>,
/** Reference to the ViewContainer into which the template will be stamped out. */
viewContainerRef: ViewContainerRef,
/** Contextual data to be passed in to the embedded view. */
context?: C | undefined,
/** The injector to use for the embedded view. */
injector?: Injector | undefined);
get origin(): ElementRef;
/**
* Attach the portal to the provided `PortalOutlet`.
* When a context is provided it will override the `context` property of the `TemplatePortal`
* instance.
*/
attach(host: PortalOutlet, context?: C | undefined): EmbeddedViewRef<C>;
detach(): void;
}
/**
* A `DomPortal` is a portal whose DOM element will be taken from its current position
* in the DOM and moved into a portal outlet, when it is attached. On detach, the content
* will be restored to its original position.
*/
declare class DomPortal<T = HTMLElement> extends Portal<T> {
/** DOM node hosting the portal's content. */
readonly element: T;
constructor(element: T | ElementRef<T>);
}
/** A `PortalOutlet` is a space that can contain a single `Portal`. */
interface PortalOutlet {
/** Attaches a portal to this outlet. */
attach(portal: Portal<any>): any;
/** Detaches the currently attached portal from this outlet. */
detach(): any;
/** Performs cleanup before the outlet is destroyed. */
dispose(): void;
/** Whether there is currently a portal attached to this outlet. */
hasAttached(): boolean;
}
/**
* Partial implementation of PortalOutlet that handles attaching
* ComponentPortal and TemplatePortal.
*/
declare abstract class BasePortalOutlet implements PortalOutlet {
/** The portal currently attached to the host. */
protected _attachedPortal: Portal<any> | null;
/** A function that will permanently dispose this host. */
private _disposeFn;
/** Whether this host has already been permanently disposed. */
private _isDisposed;
/** Whether this host has an attached portal. */
hasAttached(): boolean;
attach<T>(portal: ComponentPortal<T>): ComponentRef<T>;
attach<T>(portal: TemplatePortal<T>): EmbeddedViewRef<T>;
attach(portal: any): any;
abstract attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
abstract attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
readonly attachDomPortal: null | ((portal: DomPortal) => any);
/** Detaches a previously attached portal. */
detach(): void;
/** Permanently dispose of this portal host. */
dispose(): void;
/** @docs-private */
setDisposeFn(fn: () => void): void;
private _invokeDisposeFn;
}
/**
* Directive version of a `TemplatePortal`. Because the directive *is* a TemplatePortal,
* the directive instance itself can be attached to a host, enabling declarative use of portals.
*/
declare class CdkPortal extends TemplatePortal {
constructor(...args: unknown[]);
static ɵfac: i0.ɵɵFactoryDeclaration<CdkPortal, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkPortal, "[cdkPortal]", ["cdkPortal"], {}, {}, never, never, true, never>;
}
/**
* @deprecated Use `CdkPortal` instead.
* @breaking-change 9.0.0
*/
declare class TemplatePortalDirective extends CdkPortal {
static ɵfac: i0.ɵɵFactoryDeclaration<TemplatePortalDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplatePortalDirective, "[cdk-portal], [portal]", ["cdkPortal"], {}, {}, never, never, true, never>;
}
/**
* Possible attached references to the CdkPortalOutlet.
*/
type CdkPortalOutletAttachedRef = ComponentRef<any> | EmbeddedViewRef<any> | null;
/**
* Directive version of a PortalOutlet. Because the directive *is* a PortalOutlet, portals can be
* directly attached to it, enabling declarative use.
*
* Usage:
* `<ng-template [cdkPortalOutlet]="greeting"></ng-template>`
*/
declare class CdkPortalOutlet extends BasePortalOutlet implements OnInit, OnDestroy {
private _moduleRef;
private _document;
private _viewContainerRef;
/** Whether the portal component is initialized. */
private _isInitialized;
/** Reference to the currently-attached component/view ref. */
private _attachedRef;
constructor(...args: unknown[]);
/** Portal associated with the Portal outlet. */
get portal(): Portal<any> | null;
set portal(portal: Portal<any> | null | undefined | '');
/** Emits when a portal is attached to the outlet. */
readonly attached: EventEmitter<CdkPortalOutletAttachedRef>;
/** Component or view reference that is attached to the portal. */
get attachedRef(): CdkPortalOutletAttachedRef;
ngOnInit(): void;
ngOnDestroy(): void;
/**
* Attach the given ComponentPortal to this PortalOutlet.
*
* @param portal Portal to be attached to the portal outlet.
* @returns Reference to the created component.
*/
attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
/**
* Attach the given TemplatePortal to this PortalHost as an embedded View.
* @param portal Portal to be attached.
* @returns Reference to the created embedded view.
*/
attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
/**
* Attaches the given DomPortal to this PortalHost by moving all of the portal content into it.
* @param portal Portal to be attached.
* @deprecated To be turned into a method.
* @breaking-change 10.0.0
*/
attachDomPortal: (portal: DomPortal) => void;
/** Gets the root node of the portal outlet. */
private _getRootNode;
static ɵfac: i0.ɵɵFactoryDeclaration<CdkPortalOutlet, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkPortalOutlet, "[cdkPortalOutlet]", ["cdkPortalOutlet"], { "portal": { "alias": "cdkPortalOutlet"; "required": false; }; }, { "attached": "attached"; }, never, never, true, never>;
}
/**
* @deprecated Use `CdkPortalOutlet` instead.
* @breaking-change 9.0.0
*/
declare class PortalHostDirective extends CdkPortalOutlet {
static ɵfac: i0.ɵɵFactoryDeclaration<PortalHostDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<PortalHostDirective, "[cdkPortalHost], [portalHost]", ["cdkPortalHost"], { "portal": { "alias": "cdkPortalHost"; "required": false; }; }, {}, never, never, true, never>;
}
declare class PortalModule {
static ɵfac: i0.ɵɵFactoryDeclaration<PortalModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<PortalModule, never, [typeof CdkPortal, typeof CdkPortalOutlet, typeof TemplatePortalDirective, typeof PortalHostDirective], [typeof CdkPortal, typeof CdkPortalOutlet, typeof TemplatePortalDirective, typeof PortalHostDirective]>;
static ɵinj: i0.ɵɵInjectorDeclaration<PortalModule>;
}
export { BasePortalOutlet as B, ComponentPortal as C, DomPortal as D, Portal as P, TemplatePortal as T, CdkPortal as c, TemplatePortalDirective as d, CdkPortalOutlet as f, PortalHostDirective as g, PortalModule as h };
export type { ComponentType as a, PortalOutlet as b, CdkPortalOutletAttachedRef as e };