@angular/cdk 21.0.0-next.9 → 21.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_adev_assets/cdk_drag_drop.json +13 -12
- package/_adev_assets/cdk_testing.json +9 -9
- package/_adev_assets/cdk_testing_protractor.json +1 -1
- package/_adev_assets/cdk_testing_selenium_webdriver.json +1 -1
- package/_adev_assets/cdk_testing_testbed.json +1 -1
- package/fesm2022/_a11y-module-chunk.mjs +755 -869
- package/fesm2022/_a11y-module-chunk.mjs.map +1 -1
- package/fesm2022/_activedescendant-key-manager-chunk.mjs +8 -8
- package/fesm2022/_activedescendant-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_array-chunk.mjs +1 -1
- package/fesm2022/_array-chunk.mjs.map +1 -1
- package/fesm2022/_breakpoints-observer-chunk.mjs +149 -152
- package/fesm2022/_breakpoints-observer-chunk.mjs.map +1 -1
- package/fesm2022/_css-pixel-value-chunk.mjs +4 -5
- package/fesm2022/_css-pixel-value-chunk.mjs.map +1 -1
- package/fesm2022/_data-source-chunk.mjs +2 -8
- package/fesm2022/_data-source-chunk.mjs.map +1 -1
- package/fesm2022/_directionality-chunk.mjs +54 -54
- package/fesm2022/_directionality-chunk.mjs.map +1 -1
- package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs +25 -36
- package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs.map +1 -1
- package/fesm2022/_element-chunk.mjs +6 -17
- package/fesm2022/_element-chunk.mjs.map +1 -1
- package/fesm2022/_fake-event-detection-chunk.mjs +3 -17
- package/fesm2022/_fake-event-detection-chunk.mjs.map +1 -1
- package/fesm2022/_focus-key-manager-chunk.mjs +10 -14
- package/fesm2022/_focus-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_focus-monitor-chunk.mjs +376 -566
- package/fesm2022/_focus-monitor-chunk.mjs.map +1 -1
- package/fesm2022/_id-generator-chunk.mjs +37 -27
- package/fesm2022/_id-generator-chunk.mjs.map +1 -1
- package/fesm2022/_keycodes-chunk.mjs +9 -9
- package/fesm2022/_keycodes-chunk.mjs.map +1 -1
- package/fesm2022/_list-key-manager-chunk.mjs +248 -336
- package/fesm2022/_list-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_overlay-module-chunk.mjs +2535 -2947
- package/fesm2022/_overlay-module-chunk.mjs.map +1 -1
- package/fesm2022/_passive-listeners-chunk.mjs +10 -22
- package/fesm2022/_passive-listeners-chunk.mjs.map +1 -1
- package/fesm2022/_platform-chunk.mjs +42 -65
- package/fesm2022/_platform-chunk.mjs.map +1 -1
- package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs +78 -134
- package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs.map +1 -1
- package/fesm2022/_scrolling-chunk.mjs +44 -85
- package/fesm2022/_scrolling-chunk.mjs.map +1 -1
- package/fesm2022/_selection-model-chunk.mjs +138 -209
- package/fesm2022/_selection-model-chunk.mjs.map +1 -1
- package/fesm2022/_shadow-dom-chunk.mjs +21 -35
- package/fesm2022/_shadow-dom-chunk.mjs.map +1 -1
- package/fesm2022/_style-loader-chunk.mjs +50 -37
- package/fesm2022/_style-loader-chunk.mjs.map +1 -1
- package/fesm2022/_test-environment-chunk.mjs +2 -14
- package/fesm2022/_test-environment-chunk.mjs.map +1 -1
- package/fesm2022/_tree-key-manager-chunk.mjs +229 -308
- package/fesm2022/_tree-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_typeahead-chunk.mjs +52 -74
- package/fesm2022/_typeahead-chunk.mjs.map +1 -1
- package/fesm2022/_unique-selection-dispatcher-chunk.mjs +43 -40
- package/fesm2022/_unique-selection-dispatcher-chunk.mjs.map +1 -1
- package/fesm2022/a11y.mjs +351 -449
- package/fesm2022/a11y.mjs.map +1 -1
- package/fesm2022/accordion.mjs +254 -192
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/bidi.mjs +121 -64
- package/fesm2022/bidi.mjs.map +1 -1
- package/fesm2022/cdk.mjs +1 -2
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/clipboard.mjs +208 -186
- package/fesm2022/clipboard.mjs.map +1 -1
- package/fesm2022/coercion-private.mjs +4 -8
- package/fesm2022/coercion-private.mjs.map +1 -1
- package/fesm2022/coercion.mjs +11 -29
- package/fesm2022/coercion.mjs.map +1 -1
- package/fesm2022/dialog.mjs +660 -808
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +3347 -4286
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/keycodes.mjs +4 -8
- package/fesm2022/keycodes.mjs.map +1 -1
- package/fesm2022/layout.mjs +44 -26
- package/fesm2022/layout.mjs.map +1 -1
- package/fesm2022/listbox.mjs +841 -895
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +1942 -1858
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/observers-private.mjs +88 -106
- package/fesm2022/observers-private.mjs.map +1 -1
- package/fesm2022/observers.mjs +262 -184
- package/fesm2022/observers.mjs.map +1 -1
- package/fesm2022/overlay.mjs +72 -68
- package/fesm2022/overlay.mjs.map +1 -1
- package/fesm2022/platform.mjs +43 -54
- package/fesm2022/platform.mjs.map +1 -1
- package/fesm2022/portal.mjs +402 -560
- package/fesm2022/portal.mjs.map +1 -1
- package/fesm2022/private.mjs +38 -10
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +1323 -1400
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/stepper.mjs +758 -590
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +2327 -2319
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/testing-selenium-webdriver.mjs +252 -325
- package/fesm2022/testing-selenium-webdriver.mjs.map +1 -1
- package/fesm2022/testing-testbed.mjs +592 -709
- package/fesm2022/testing-testbed.mjs.map +1 -1
- package/fesm2022/testing.mjs +368 -889
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/text-field.mjs +459 -388
- package/fesm2022/text-field.mjs.map +1 -1
- package/fesm2022/tree.mjs +1483 -1731
- package/fesm2022/tree.mjs.map +1 -1
- package/overlay/_index.scss +30 -0
- package/overlay-prebuilt.css +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/types/_overlay-module-chunk.d.ts +69 -7
- package/types/_portal-directives-chunk.d.ts +2 -18
- package/types/a11y.d.ts +3 -1
- package/types/accordion.d.ts +3 -1
- package/types/dialog.d.ts +1 -1
- package/types/overlay.d.ts +1 -1
- package/types/portal.d.ts +1 -1
package/fesm2022/portal.mjs
CHANGED
|
@@ -1,614 +1,456 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { ElementRef, NgModuleRef, EnvironmentInjector, createComponent, Injector, inject, TemplateRef, ViewContainerRef, Directive, DOCUMENT, EventEmitter, Input, Output, NgModule } from '@angular/core';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Throws an exception when attempting to attach a null portal to a host.
|
|
6
|
-
* @docs-private
|
|
7
|
-
*/
|
|
8
4
|
function throwNullPortalError() {
|
|
9
|
-
|
|
5
|
+
throw Error('Must provide a portal to attach');
|
|
10
6
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Throws an exception when attempting to attach a portal to a host that is already attached.
|
|
13
|
-
* @docs-private
|
|
14
|
-
*/
|
|
15
7
|
function throwPortalAlreadyAttachedError() {
|
|
16
|
-
|
|
8
|
+
throw Error('Host already has a portal attached');
|
|
17
9
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Throws an exception when attempting to attach a portal to an already-disposed host.
|
|
20
|
-
* @docs-private
|
|
21
|
-
*/
|
|
22
10
|
function throwPortalOutletAlreadyDisposedError() {
|
|
23
|
-
|
|
11
|
+
throw Error('This PortalOutlet has already been disposed');
|
|
24
12
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Throws an exception when attempting to attach an unknown portal type.
|
|
27
|
-
* @docs-private
|
|
28
|
-
*/
|
|
29
13
|
function throwUnknownPortalTypeError() {
|
|
30
|
-
|
|
31
|
-
'a ComponentPortal or a TemplatePortal.');
|
|
14
|
+
throw Error('Attempting to attach an unknown Portal type. BasePortalOutlet accepts either ' + 'a ComponentPortal or a TemplatePortal.');
|
|
32
15
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Throws an exception when attempting to attach a portal to a null host.
|
|
35
|
-
* @docs-private
|
|
36
|
-
*/
|
|
37
16
|
function throwNullPortalOutletError() {
|
|
38
|
-
|
|
17
|
+
throw Error('Attempting to attach a portal to a null PortalOutlet');
|
|
39
18
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Throws an exception when attempting to detach a portal that is not attached.
|
|
42
|
-
* @docs-private
|
|
43
|
-
*/
|
|
44
19
|
function throwNoPortalAttachedError() {
|
|
45
|
-
|
|
20
|
+
throw Error('Attempting to detach a portal that is not attached to a host');
|
|
46
21
|
}
|
|
47
22
|
|
|
48
|
-
/**
|
|
49
|
-
* A `Portal` is something that you want to render somewhere else.
|
|
50
|
-
* It can be attach to / detached from a `PortalOutlet`.
|
|
51
|
-
*/
|
|
52
23
|
class Portal {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
this._attachedHost = host;
|
|
65
|
-
return host.attach(this);
|
|
66
|
-
}
|
|
67
|
-
/** Detach this portal from its host */
|
|
68
|
-
detach() {
|
|
69
|
-
let host = this._attachedHost;
|
|
70
|
-
if (host != null) {
|
|
71
|
-
this._attachedHost = null;
|
|
72
|
-
host.detach();
|
|
73
|
-
}
|
|
74
|
-
else if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
75
|
-
throwNoPortalAttachedError();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/** Whether this portal is attached to a host. */
|
|
79
|
-
get isAttached() {
|
|
80
|
-
return this._attachedHost != null;
|
|
24
|
+
_attachedHost;
|
|
25
|
+
attach(host) {
|
|
26
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
27
|
+
if (host == null) {
|
|
28
|
+
throwNullPortalOutletError();
|
|
29
|
+
}
|
|
30
|
+
if (host.hasAttached()) {
|
|
31
|
+
throwPortalAlreadyAttachedError();
|
|
32
|
+
}
|
|
81
33
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
34
|
+
this._attachedHost = host;
|
|
35
|
+
return host.attach(this);
|
|
36
|
+
}
|
|
37
|
+
detach() {
|
|
38
|
+
let host = this._attachedHost;
|
|
39
|
+
if (host != null) {
|
|
40
|
+
this._attachedHost = null;
|
|
41
|
+
host.detach();
|
|
42
|
+
} else if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
43
|
+
throwNoPortalAttachedError();
|
|
88
44
|
}
|
|
45
|
+
}
|
|
46
|
+
get isAttached() {
|
|
47
|
+
return this._attachedHost != null;
|
|
48
|
+
}
|
|
49
|
+
setAttachedHost(host) {
|
|
50
|
+
this._attachedHost = host;
|
|
51
|
+
}
|
|
89
52
|
}
|
|
90
|
-
/**
|
|
91
|
-
* A `ComponentPortal` is a portal that instantiates some Component upon attachment.
|
|
92
|
-
*/
|
|
93
53
|
class ComponentPortal extends Portal {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
viewContainerRef;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
* List of DOM nodes that should be projected through `<ng-content>` of the attached component.
|
|
106
|
-
*/
|
|
107
|
-
projectableNodes;
|
|
108
|
-
constructor(component, viewContainerRef, injector, projectableNodes) {
|
|
109
|
-
super();
|
|
110
|
-
this.component = component;
|
|
111
|
-
this.viewContainerRef = viewContainerRef;
|
|
112
|
-
this.injector = injector;
|
|
113
|
-
this.projectableNodes = projectableNodes;
|
|
114
|
-
}
|
|
54
|
+
component;
|
|
55
|
+
viewContainerRef;
|
|
56
|
+
injector;
|
|
57
|
+
projectableNodes;
|
|
58
|
+
constructor(component, viewContainerRef, injector, projectableNodes) {
|
|
59
|
+
super();
|
|
60
|
+
this.component = component;
|
|
61
|
+
this.viewContainerRef = viewContainerRef;
|
|
62
|
+
this.injector = injector;
|
|
63
|
+
this.projectableNodes = projectableNodes;
|
|
64
|
+
}
|
|
115
65
|
}
|
|
116
|
-
/**
|
|
117
|
-
* A `TemplatePortal` is a portal that represents some embedded template (TemplateRef).
|
|
118
|
-
*/
|
|
119
66
|
class TemplatePortal extends Portal {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
templateRef
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Attach the portal to the provided `PortalOutlet`.
|
|
144
|
-
* When a context is provided it will override the `context` property of the `TemplatePortal`
|
|
145
|
-
* instance.
|
|
146
|
-
*/
|
|
147
|
-
attach(host, context = this.context) {
|
|
148
|
-
this.context = context;
|
|
149
|
-
return super.attach(host);
|
|
150
|
-
}
|
|
151
|
-
detach() {
|
|
152
|
-
this.context = undefined;
|
|
153
|
-
return super.detach();
|
|
154
|
-
}
|
|
67
|
+
templateRef;
|
|
68
|
+
viewContainerRef;
|
|
69
|
+
context;
|
|
70
|
+
injector;
|
|
71
|
+
constructor(templateRef, viewContainerRef, context, injector) {
|
|
72
|
+
super();
|
|
73
|
+
this.templateRef = templateRef;
|
|
74
|
+
this.viewContainerRef = viewContainerRef;
|
|
75
|
+
this.context = context;
|
|
76
|
+
this.injector = injector;
|
|
77
|
+
}
|
|
78
|
+
get origin() {
|
|
79
|
+
return this.templateRef.elementRef;
|
|
80
|
+
}
|
|
81
|
+
attach(host, context = this.context) {
|
|
82
|
+
this.context = context;
|
|
83
|
+
return super.attach(host);
|
|
84
|
+
}
|
|
85
|
+
detach() {
|
|
86
|
+
this.context = undefined;
|
|
87
|
+
return super.detach();
|
|
88
|
+
}
|
|
155
89
|
}
|
|
156
|
-
/**
|
|
157
|
-
* A `DomPortal` is a portal whose DOM element will be taken from its current position
|
|
158
|
-
* in the DOM and moved into a portal outlet, when it is attached. On detach, the content
|
|
159
|
-
* will be restored to its original position.
|
|
160
|
-
*/
|
|
161
90
|
class DomPortal extends Portal {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
91
|
+
element;
|
|
92
|
+
constructor(element) {
|
|
93
|
+
super();
|
|
94
|
+
this.element = element instanceof ElementRef ? element.nativeElement : element;
|
|
95
|
+
}
|
|
168
96
|
}
|
|
169
|
-
/**
|
|
170
|
-
* Partial implementation of PortalOutlet that handles attaching
|
|
171
|
-
* ComponentPortal and TemplatePortal.
|
|
172
|
-
*/
|
|
173
97
|
class BasePortalOutlet {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
98
|
+
_attachedPortal;
|
|
99
|
+
_disposeFn;
|
|
100
|
+
_isDisposed = false;
|
|
101
|
+
hasAttached() {
|
|
102
|
+
return !!this._attachedPortal;
|
|
103
|
+
}
|
|
104
|
+
attach(portal) {
|
|
105
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
106
|
+
if (!portal) {
|
|
107
|
+
throwNullPortalError();
|
|
108
|
+
}
|
|
109
|
+
if (this.hasAttached()) {
|
|
110
|
+
throwPortalAlreadyAttachedError();
|
|
111
|
+
}
|
|
112
|
+
if (this._isDisposed) {
|
|
113
|
+
throwPortalOutletAlreadyDisposedError();
|
|
114
|
+
}
|
|
183
115
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (this._isDisposed) {
|
|
194
|
-
throwPortalOutletAlreadyDisposedError();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
if (portal instanceof ComponentPortal) {
|
|
198
|
-
this._attachedPortal = portal;
|
|
199
|
-
return this.attachComponentPortal(portal);
|
|
200
|
-
}
|
|
201
|
-
else if (portal instanceof TemplatePortal) {
|
|
202
|
-
this._attachedPortal = portal;
|
|
203
|
-
return this.attachTemplatePortal(portal);
|
|
204
|
-
// @breaking-change 10.0.0 remove null check for `this.attachDomPortal`.
|
|
205
|
-
}
|
|
206
|
-
else if (this.attachDomPortal && portal instanceof DomPortal) {
|
|
207
|
-
this._attachedPortal = portal;
|
|
208
|
-
return this.attachDomPortal(portal);
|
|
209
|
-
}
|
|
210
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
211
|
-
throwUnknownPortalTypeError();
|
|
212
|
-
}
|
|
116
|
+
if (portal instanceof ComponentPortal) {
|
|
117
|
+
this._attachedPortal = portal;
|
|
118
|
+
return this.attachComponentPortal(portal);
|
|
119
|
+
} else if (portal instanceof TemplatePortal) {
|
|
120
|
+
this._attachedPortal = portal;
|
|
121
|
+
return this.attachTemplatePortal(portal);
|
|
122
|
+
} else if (this.attachDomPortal && portal instanceof DomPortal) {
|
|
123
|
+
this._attachedPortal = portal;
|
|
124
|
+
return this.attachDomPortal(portal);
|
|
213
125
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
/** Detaches a previously attached portal. */
|
|
217
|
-
detach() {
|
|
218
|
-
if (this._attachedPortal) {
|
|
219
|
-
this._attachedPortal.setAttachedHost(null);
|
|
220
|
-
this._attachedPortal = null;
|
|
221
|
-
}
|
|
222
|
-
this._invokeDisposeFn();
|
|
126
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
127
|
+
throwUnknownPortalTypeError();
|
|
223
128
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
this._isDisposed = true;
|
|
129
|
+
}
|
|
130
|
+
attachDomPortal = null;
|
|
131
|
+
detach() {
|
|
132
|
+
if (this._attachedPortal) {
|
|
133
|
+
this._attachedPortal.setAttachedHost(null);
|
|
134
|
+
this._attachedPortal = null;
|
|
231
135
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
136
|
+
this._invokeDisposeFn();
|
|
137
|
+
}
|
|
138
|
+
dispose() {
|
|
139
|
+
if (this.hasAttached()) {
|
|
140
|
+
this.detach();
|
|
235
141
|
}
|
|
236
|
-
_invokeDisposeFn()
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
142
|
+
this._invokeDisposeFn();
|
|
143
|
+
this._isDisposed = true;
|
|
144
|
+
}
|
|
145
|
+
setDisposeFn(fn) {
|
|
146
|
+
this._disposeFn = fn;
|
|
147
|
+
}
|
|
148
|
+
_invokeDisposeFn() {
|
|
149
|
+
if (this._disposeFn) {
|
|
150
|
+
this._disposeFn();
|
|
151
|
+
this._disposeFn = null;
|
|
241
152
|
}
|
|
153
|
+
}
|
|
242
154
|
}
|
|
243
155
|
|
|
244
|
-
/**
|
|
245
|
-
* A PortalOutlet for attaching portals to an arbitrary DOM element outside of the Angular
|
|
246
|
-
* application context.
|
|
247
|
-
*/
|
|
248
156
|
class DomPortalOutlet extends BasePortalOutlet {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && !this._appRef) {
|
|
291
|
-
throw Error('Cannot attach component portal to outlet without an ApplicationRef.');
|
|
292
|
-
}
|
|
293
|
-
const appRef = this._appRef;
|
|
294
|
-
const elementInjector = portal.injector || this._defaultInjector || Injector.NULL;
|
|
295
|
-
const environmentInjector = elementInjector.get(EnvironmentInjector, appRef.injector);
|
|
296
|
-
componentRef = createComponent(portal.component, {
|
|
297
|
-
elementInjector,
|
|
298
|
-
environmentInjector,
|
|
299
|
-
projectableNodes: portal.projectableNodes || undefined,
|
|
300
|
-
});
|
|
301
|
-
appRef.attachView(componentRef.hostView);
|
|
302
|
-
this.setDisposeFn(() => {
|
|
303
|
-
// Verify that the ApplicationRef has registered views before trying to detach a host view.
|
|
304
|
-
// This check also protects the `detachView` from being called on a destroyed ApplicationRef.
|
|
305
|
-
if (appRef.viewCount > 0) {
|
|
306
|
-
appRef.detachView(componentRef.hostView);
|
|
307
|
-
}
|
|
308
|
-
componentRef.destroy();
|
|
309
|
-
});
|
|
157
|
+
outletElement;
|
|
158
|
+
_appRef;
|
|
159
|
+
_defaultInjector;
|
|
160
|
+
constructor(outletElement, _appRef, _defaultInjector) {
|
|
161
|
+
super();
|
|
162
|
+
this.outletElement = outletElement;
|
|
163
|
+
this._appRef = _appRef;
|
|
164
|
+
this._defaultInjector = _defaultInjector;
|
|
165
|
+
}
|
|
166
|
+
attachComponentPortal(portal) {
|
|
167
|
+
let componentRef;
|
|
168
|
+
if (portal.viewContainerRef) {
|
|
169
|
+
const injector = portal.injector || portal.viewContainerRef.injector;
|
|
170
|
+
const ngModuleRef = injector.get(NgModuleRef, null, {
|
|
171
|
+
optional: true
|
|
172
|
+
}) || undefined;
|
|
173
|
+
componentRef = portal.viewContainerRef.createComponent(portal.component, {
|
|
174
|
+
index: portal.viewContainerRef.length,
|
|
175
|
+
injector,
|
|
176
|
+
ngModuleRef,
|
|
177
|
+
projectableNodes: portal.projectableNodes || undefined
|
|
178
|
+
});
|
|
179
|
+
this.setDisposeFn(() => componentRef.destroy());
|
|
180
|
+
} else {
|
|
181
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && !this._appRef) {
|
|
182
|
+
throw Error('Cannot attach component portal to outlet without an ApplicationRef.');
|
|
183
|
+
}
|
|
184
|
+
const appRef = this._appRef;
|
|
185
|
+
const elementInjector = portal.injector || this._defaultInjector || Injector.NULL;
|
|
186
|
+
const environmentInjector = elementInjector.get(EnvironmentInjector, appRef.injector);
|
|
187
|
+
componentRef = createComponent(portal.component, {
|
|
188
|
+
elementInjector,
|
|
189
|
+
environmentInjector,
|
|
190
|
+
projectableNodes: portal.projectableNodes || undefined
|
|
191
|
+
});
|
|
192
|
+
appRef.attachView(componentRef.hostView);
|
|
193
|
+
this.setDisposeFn(() => {
|
|
194
|
+
if (appRef.viewCount > 0) {
|
|
195
|
+
appRef.detachView(componentRef.hostView);
|
|
310
196
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
this.outletElement.appendChild(this._getComponentRootNode(componentRef));
|
|
314
|
-
this._attachedPortal = portal;
|
|
315
|
-
return componentRef;
|
|
197
|
+
componentRef.destroy();
|
|
198
|
+
});
|
|
316
199
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
});
|
|
342
|
-
this._attachedPortal = portal;
|
|
343
|
-
// TODO(jelbourn): Return locals from view.
|
|
344
|
-
return viewRef;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Attaches a DOM portal by transferring its content into the outlet.
|
|
348
|
-
* @param portal Portal to be attached.
|
|
349
|
-
* @deprecated To be turned into a method.
|
|
350
|
-
* @breaking-change 10.0.0
|
|
351
|
-
*/
|
|
352
|
-
attachDomPortal = (portal) => {
|
|
353
|
-
const element = portal.element;
|
|
354
|
-
if (!element.parentNode && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
355
|
-
throw Error('DOM portal content must be attached to a parent node.');
|
|
356
|
-
}
|
|
357
|
-
// Anchor used to save the element's previous position so
|
|
358
|
-
// that we can restore it when the portal is detached.
|
|
359
|
-
const anchorNode = this.outletElement.ownerDocument.createComment('dom-portal');
|
|
360
|
-
element.parentNode.insertBefore(anchorNode, element);
|
|
361
|
-
this.outletElement.appendChild(element);
|
|
362
|
-
this._attachedPortal = portal;
|
|
363
|
-
super.setDisposeFn(() => {
|
|
364
|
-
// We can't use `replaceWith` here because IE doesn't support it.
|
|
365
|
-
if (anchorNode.parentNode) {
|
|
366
|
-
anchorNode.parentNode.replaceChild(element, anchorNode);
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
};
|
|
370
|
-
/**
|
|
371
|
-
* Clears out a portal from the DOM.
|
|
372
|
-
*/
|
|
373
|
-
dispose() {
|
|
374
|
-
super.dispose();
|
|
375
|
-
this.outletElement.remove();
|
|
376
|
-
}
|
|
377
|
-
/** Gets the root HTMLElement for an instantiated component. */
|
|
378
|
-
_getComponentRootNode(componentRef) {
|
|
379
|
-
return componentRef.hostView.rootNodes[0];
|
|
200
|
+
this.outletElement.appendChild(this._getComponentRootNode(componentRef));
|
|
201
|
+
this._attachedPortal = portal;
|
|
202
|
+
return componentRef;
|
|
203
|
+
}
|
|
204
|
+
attachTemplatePortal(portal) {
|
|
205
|
+
let viewContainer = portal.viewContainerRef;
|
|
206
|
+
let viewRef = viewContainer.createEmbeddedView(portal.templateRef, portal.context, {
|
|
207
|
+
injector: portal.injector
|
|
208
|
+
});
|
|
209
|
+
viewRef.rootNodes.forEach(rootNode => this.outletElement.appendChild(rootNode));
|
|
210
|
+
viewRef.detectChanges();
|
|
211
|
+
this.setDisposeFn(() => {
|
|
212
|
+
let index = viewContainer.indexOf(viewRef);
|
|
213
|
+
if (index !== -1) {
|
|
214
|
+
viewContainer.remove(index);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
this._attachedPortal = portal;
|
|
218
|
+
return viewRef;
|
|
219
|
+
}
|
|
220
|
+
attachDomPortal = portal => {
|
|
221
|
+
const element = portal.element;
|
|
222
|
+
if (!element.parentNode && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
223
|
+
throw Error('DOM portal content must be attached to a parent node.');
|
|
380
224
|
}
|
|
225
|
+
const anchorNode = this.outletElement.ownerDocument.createComment('dom-portal');
|
|
226
|
+
element.parentNode.insertBefore(anchorNode, element);
|
|
227
|
+
this.outletElement.appendChild(element);
|
|
228
|
+
this._attachedPortal = portal;
|
|
229
|
+
super.setDisposeFn(() => {
|
|
230
|
+
if (anchorNode.parentNode) {
|
|
231
|
+
anchorNode.parentNode.replaceChild(element, anchorNode);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
dispose() {
|
|
236
|
+
super.dispose();
|
|
237
|
+
this.outletElement.remove();
|
|
238
|
+
}
|
|
239
|
+
_getComponentRootNode(componentRef) {
|
|
240
|
+
return componentRef.hostView.rootNodes[0];
|
|
241
|
+
}
|
|
381
242
|
}
|
|
382
243
|
|
|
383
|
-
/**
|
|
384
|
-
* Directive version of a `TemplatePortal`. Because the directive *is* a TemplatePortal,
|
|
385
|
-
* the directive instance itself can be attached to a host, enabling declarative use of portals.
|
|
386
|
-
*/
|
|
387
244
|
class CdkPortal extends TemplatePortal {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
245
|
+
constructor() {
|
|
246
|
+
const templateRef = inject(TemplateRef);
|
|
247
|
+
const viewContainerRef = inject(ViewContainerRef);
|
|
248
|
+
super(templateRef, viewContainerRef);
|
|
249
|
+
}
|
|
250
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
251
|
+
minVersion: "12.0.0",
|
|
252
|
+
version: "20.2.0-next.2",
|
|
253
|
+
ngImport: i0,
|
|
254
|
+
type: CdkPortal,
|
|
255
|
+
deps: [],
|
|
256
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
257
|
+
});
|
|
258
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
259
|
+
minVersion: "14.0.0",
|
|
260
|
+
version: "20.2.0-next.2",
|
|
261
|
+
type: CdkPortal,
|
|
262
|
+
isStandalone: true,
|
|
263
|
+
selector: "[cdkPortal]",
|
|
264
|
+
exportAs: ["cdkPortal"],
|
|
265
|
+
usesInheritance: true,
|
|
266
|
+
ngImport: i0
|
|
267
|
+
});
|
|
395
268
|
}
|
|
396
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
{
|
|
411
|
-
provide: CdkPortal,
|
|
412
|
-
useExisting: TemplatePortalDirective,
|
|
413
|
-
},
|
|
414
|
-
], exportAs: ["cdkPortal"], usesInheritance: true, ngImport: i0 });
|
|
415
|
-
}
|
|
416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TemplatePortalDirective, decorators: [{
|
|
417
|
-
type: Directive,
|
|
418
|
-
args: [{
|
|
419
|
-
selector: '[cdk-portal], [portal]',
|
|
420
|
-
exportAs: 'cdkPortal',
|
|
421
|
-
providers: [
|
|
422
|
-
{
|
|
423
|
-
provide: CdkPortal,
|
|
424
|
-
useExisting: TemplatePortalDirective,
|
|
425
|
-
},
|
|
426
|
-
],
|
|
427
|
-
}]
|
|
428
|
-
}] });
|
|
429
|
-
/**
|
|
430
|
-
* Directive version of a PortalOutlet. Because the directive *is* a PortalOutlet, portals can be
|
|
431
|
-
* directly attached to it, enabling declarative use.
|
|
432
|
-
*
|
|
433
|
-
* Usage:
|
|
434
|
-
* `<ng-template [cdkPortalOutlet]="greeting"></ng-template>`
|
|
435
|
-
*/
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
270
|
+
minVersion: "12.0.0",
|
|
271
|
+
version: "20.2.0-next.2",
|
|
272
|
+
ngImport: i0,
|
|
273
|
+
type: CdkPortal,
|
|
274
|
+
decorators: [{
|
|
275
|
+
type: Directive,
|
|
276
|
+
args: [{
|
|
277
|
+
selector: '[cdkPortal]',
|
|
278
|
+
exportAs: 'cdkPortal'
|
|
279
|
+
}]
|
|
280
|
+
}],
|
|
281
|
+
ctorParameters: () => []
|
|
282
|
+
});
|
|
436
283
|
class CdkPortalOutlet extends BasePortalOutlet {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
284
|
+
_moduleRef = inject(NgModuleRef, {
|
|
285
|
+
optional: true
|
|
286
|
+
});
|
|
287
|
+
_document = inject(DOCUMENT);
|
|
288
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
289
|
+
_isInitialized = false;
|
|
290
|
+
_attachedRef;
|
|
291
|
+
constructor() {
|
|
292
|
+
super();
|
|
293
|
+
}
|
|
294
|
+
get portal() {
|
|
295
|
+
return this._attachedPortal;
|
|
296
|
+
}
|
|
297
|
+
set portal(portal) {
|
|
298
|
+
if (this.hasAttached() && !portal && !this._isInitialized) {
|
|
299
|
+
return;
|
|
450
300
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
// run. This handles the cases where the user might do something like `<div cdkPortalOutlet>`
|
|
454
|
-
// and attach a portal programmatically in the parent component. When Angular does the first CD
|
|
455
|
-
// round, it will fire the setter with empty string, causing the user's content to be cleared.
|
|
456
|
-
if (this.hasAttached() && !portal && !this._isInitialized) {
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (this.hasAttached()) {
|
|
460
|
-
super.detach();
|
|
461
|
-
}
|
|
462
|
-
if (portal) {
|
|
463
|
-
super.attach(portal);
|
|
464
|
-
}
|
|
465
|
-
this._attachedPortal = portal || null;
|
|
301
|
+
if (this.hasAttached()) {
|
|
302
|
+
super.detach();
|
|
466
303
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
/** Component or view reference that is attached to the portal. */
|
|
470
|
-
get attachedRef() {
|
|
471
|
-
return this._attachedRef;
|
|
304
|
+
if (portal) {
|
|
305
|
+
super.attach(portal);
|
|
472
306
|
}
|
|
473
|
-
|
|
474
|
-
|
|
307
|
+
this._attachedPortal = portal || null;
|
|
308
|
+
}
|
|
309
|
+
attached = new EventEmitter();
|
|
310
|
+
get attachedRef() {
|
|
311
|
+
return this._attachedRef;
|
|
312
|
+
}
|
|
313
|
+
ngOnInit() {
|
|
314
|
+
this._isInitialized = true;
|
|
315
|
+
}
|
|
316
|
+
ngOnDestroy() {
|
|
317
|
+
super.dispose();
|
|
318
|
+
this._attachedRef = this._attachedPortal = null;
|
|
319
|
+
}
|
|
320
|
+
attachComponentPortal(portal) {
|
|
321
|
+
portal.setAttachedHost(this);
|
|
322
|
+
const viewContainerRef = portal.viewContainerRef != null ? portal.viewContainerRef : this._viewContainerRef;
|
|
323
|
+
const ref = viewContainerRef.createComponent(portal.component, {
|
|
324
|
+
index: viewContainerRef.length,
|
|
325
|
+
injector: portal.injector || viewContainerRef.injector,
|
|
326
|
+
projectableNodes: portal.projectableNodes || undefined,
|
|
327
|
+
ngModuleRef: this._moduleRef || undefined
|
|
328
|
+
});
|
|
329
|
+
if (viewContainerRef !== this._viewContainerRef) {
|
|
330
|
+
this._getRootNode().appendChild(ref.hostView.rootNodes[0]);
|
|
475
331
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
// If we're using a view container that's different from the injected one (e.g. when the portal
|
|
498
|
-
// specifies its own) we need to move the component into the outlet, otherwise it'll be rendered
|
|
499
|
-
// inside of the alternate view container.
|
|
500
|
-
if (viewContainerRef !== this._viewContainerRef) {
|
|
501
|
-
this._getRootNode().appendChild(ref.hostView.rootNodes[0]);
|
|
502
|
-
}
|
|
503
|
-
super.setDisposeFn(() => ref.destroy());
|
|
504
|
-
this._attachedPortal = portal;
|
|
505
|
-
this._attachedRef = ref;
|
|
506
|
-
this.attached.emit(ref);
|
|
507
|
-
return ref;
|
|
332
|
+
super.setDisposeFn(() => ref.destroy());
|
|
333
|
+
this._attachedPortal = portal;
|
|
334
|
+
this._attachedRef = ref;
|
|
335
|
+
this.attached.emit(ref);
|
|
336
|
+
return ref;
|
|
337
|
+
}
|
|
338
|
+
attachTemplatePortal(portal) {
|
|
339
|
+
portal.setAttachedHost(this);
|
|
340
|
+
const viewRef = this._viewContainerRef.createEmbeddedView(portal.templateRef, portal.context, {
|
|
341
|
+
injector: portal.injector
|
|
342
|
+
});
|
|
343
|
+
super.setDisposeFn(() => this._viewContainerRef.clear());
|
|
344
|
+
this._attachedPortal = portal;
|
|
345
|
+
this._attachedRef = viewRef;
|
|
346
|
+
this.attached.emit(viewRef);
|
|
347
|
+
return viewRef;
|
|
348
|
+
}
|
|
349
|
+
attachDomPortal = portal => {
|
|
350
|
+
const element = portal.element;
|
|
351
|
+
if (!element.parentNode && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
352
|
+
throw Error('DOM portal content must be attached to a parent node.');
|
|
508
353
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
};
|
|
549
|
-
/** Gets the root node of the portal outlet. */
|
|
550
|
-
_getRootNode() {
|
|
551
|
-
const nativeElement = this._viewContainerRef.element.nativeElement;
|
|
552
|
-
// The directive could be set on a template which will result in a comment
|
|
553
|
-
// node being the root. Use the comment's parent node if that is the case.
|
|
554
|
-
return (nativeElement.nodeType === nativeElement.ELEMENT_NODE
|
|
555
|
-
? nativeElement
|
|
556
|
-
: nativeElement.parentNode);
|
|
557
|
-
}
|
|
558
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkPortalOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
559
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: CdkPortalOutlet, isStandalone: true, selector: "[cdkPortalOutlet]", inputs: { portal: ["cdkPortalOutlet", "portal"] }, outputs: { attached: "attached" }, exportAs: ["cdkPortalOutlet"], usesInheritance: true, ngImport: i0 });
|
|
560
|
-
}
|
|
561
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: CdkPortalOutlet, decorators: [{
|
|
562
|
-
type: Directive,
|
|
563
|
-
args: [{
|
|
564
|
-
selector: '[cdkPortalOutlet]',
|
|
565
|
-
exportAs: 'cdkPortalOutlet',
|
|
566
|
-
}]
|
|
567
|
-
}], ctorParameters: () => [], propDecorators: { portal: [{
|
|
568
|
-
type: Input,
|
|
569
|
-
args: ['cdkPortalOutlet']
|
|
570
|
-
}], attached: [{
|
|
571
|
-
type: Output
|
|
572
|
-
}] } });
|
|
573
|
-
/**
|
|
574
|
-
* @deprecated Use `CdkPortalOutlet` instead.
|
|
575
|
-
* @breaking-change 9.0.0
|
|
576
|
-
*/
|
|
577
|
-
class PortalHostDirective extends CdkPortalOutlet {
|
|
578
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: PortalHostDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
579
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: PortalHostDirective, isStandalone: true, selector: "[cdkPortalHost], [portalHost]", inputs: { portal: ["cdkPortalHost", "portal"] }, providers: [
|
|
580
|
-
{
|
|
581
|
-
provide: CdkPortalOutlet,
|
|
582
|
-
useExisting: PortalHostDirective,
|
|
583
|
-
},
|
|
584
|
-
], exportAs: ["cdkPortalHost"], usesInheritance: true, ngImport: i0 });
|
|
354
|
+
const anchorNode = this._document.createComment('dom-portal');
|
|
355
|
+
portal.setAttachedHost(this);
|
|
356
|
+
element.parentNode.insertBefore(anchorNode, element);
|
|
357
|
+
this._getRootNode().appendChild(element);
|
|
358
|
+
this._attachedPortal = portal;
|
|
359
|
+
super.setDisposeFn(() => {
|
|
360
|
+
if (anchorNode.parentNode) {
|
|
361
|
+
anchorNode.parentNode.replaceChild(element, anchorNode);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
_getRootNode() {
|
|
366
|
+
const nativeElement = this._viewContainerRef.element.nativeElement;
|
|
367
|
+
return nativeElement.nodeType === nativeElement.ELEMENT_NODE ? nativeElement : nativeElement.parentNode;
|
|
368
|
+
}
|
|
369
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
370
|
+
minVersion: "12.0.0",
|
|
371
|
+
version: "20.2.0-next.2",
|
|
372
|
+
ngImport: i0,
|
|
373
|
+
type: CdkPortalOutlet,
|
|
374
|
+
deps: [],
|
|
375
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
376
|
+
});
|
|
377
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
378
|
+
minVersion: "14.0.0",
|
|
379
|
+
version: "20.2.0-next.2",
|
|
380
|
+
type: CdkPortalOutlet,
|
|
381
|
+
isStandalone: true,
|
|
382
|
+
selector: "[cdkPortalOutlet]",
|
|
383
|
+
inputs: {
|
|
384
|
+
portal: ["cdkPortalOutlet", "portal"]
|
|
385
|
+
},
|
|
386
|
+
outputs: {
|
|
387
|
+
attached: "attached"
|
|
388
|
+
},
|
|
389
|
+
exportAs: ["cdkPortalOutlet"],
|
|
390
|
+
usesInheritance: true,
|
|
391
|
+
ngImport: i0
|
|
392
|
+
});
|
|
585
393
|
}
|
|
586
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
394
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
395
|
+
minVersion: "12.0.0",
|
|
396
|
+
version: "20.2.0-next.2",
|
|
397
|
+
ngImport: i0,
|
|
398
|
+
type: CdkPortalOutlet,
|
|
399
|
+
decorators: [{
|
|
400
|
+
type: Directive,
|
|
401
|
+
args: [{
|
|
402
|
+
selector: '[cdkPortalOutlet]',
|
|
403
|
+
exportAs: 'cdkPortalOutlet'
|
|
404
|
+
}]
|
|
405
|
+
}],
|
|
406
|
+
ctorParameters: () => [],
|
|
407
|
+
propDecorators: {
|
|
408
|
+
portal: [{
|
|
409
|
+
type: Input,
|
|
410
|
+
args: ['cdkPortalOutlet']
|
|
411
|
+
}],
|
|
412
|
+
attached: [{
|
|
413
|
+
type: Output
|
|
414
|
+
}]
|
|
415
|
+
}
|
|
416
|
+
});
|
|
600
417
|
class PortalModule {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
418
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
419
|
+
minVersion: "12.0.0",
|
|
420
|
+
version: "20.2.0-next.2",
|
|
421
|
+
ngImport: i0,
|
|
422
|
+
type: PortalModule,
|
|
423
|
+
deps: [],
|
|
424
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
425
|
+
});
|
|
426
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
427
|
+
minVersion: "14.0.0",
|
|
428
|
+
version: "20.2.0-next.2",
|
|
429
|
+
ngImport: i0,
|
|
430
|
+
type: PortalModule,
|
|
431
|
+
imports: [CdkPortal, CdkPortalOutlet],
|
|
432
|
+
exports: [CdkPortal, CdkPortalOutlet]
|
|
433
|
+
});
|
|
434
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
435
|
+
minVersion: "12.0.0",
|
|
436
|
+
version: "20.2.0-next.2",
|
|
437
|
+
ngImport: i0,
|
|
438
|
+
type: PortalModule
|
|
439
|
+
});
|
|
604
440
|
}
|
|
605
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
441
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
442
|
+
minVersion: "12.0.0",
|
|
443
|
+
version: "20.2.0-next.2",
|
|
444
|
+
ngImport: i0,
|
|
445
|
+
type: PortalModule,
|
|
446
|
+
decorators: [{
|
|
447
|
+
type: NgModule,
|
|
448
|
+
args: [{
|
|
449
|
+
imports: [CdkPortal, CdkPortalOutlet],
|
|
450
|
+
exports: [CdkPortal, CdkPortalOutlet]
|
|
451
|
+
}]
|
|
452
|
+
}]
|
|
453
|
+
});
|
|
612
454
|
|
|
613
|
-
export { BasePortalOutlet, CdkPortal, CdkPortalOutlet, ComponentPortal, DomPortal, DomPortalOutlet, Portal,
|
|
455
|
+
export { BasePortalOutlet, CdkPortal, CdkPortalOutlet, ComponentPortal, DomPortal, DomPortalOutlet, Portal, PortalModule, TemplatePortal };
|
|
614
456
|
//# sourceMappingURL=portal.mjs.map
|