@andersbakken/fisk-scheduler-ui 0.0.56 → 0.0.57
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/.angular/cache/18.2.21/ui/.tsbuildinfo +1 -1
- package/.angular/cache/18.2.21/ui/angular-compiler.db +0 -0
- package/.angular/cache/18.2.21/ui/angular-compiler.db-lock +0 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common.js +201 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common_http.js +85 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_common_http.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_core.js +932 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_core.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_forms.js +134 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_forms.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_button.js +33 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_button.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_card.js +567 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_card.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_checkbox.js +782 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_checkbox.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_core.js +98 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_core.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_dialog.js +1829 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_dialog.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_form-field.js +45 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_form-field.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_input.js +1014 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_input.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_list.js +2169 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_list.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_select.js +1529 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_select.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_snack-bar.js +940 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_snack-bar.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_tabs.js +2962 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_tabs.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser.js +84 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser_animations.js +4136 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser_animations.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_router.js +5700 -0
- package/.angular/cache/18.2.21/ui/vite/deps/@angular_router.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/_metadata.json +172 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-2ZKE2YDD.js +1222 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-2ZKE2YDD.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-3OV72XIM.js +64 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-3OV72XIM.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-57TVY4HY.js +2218 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-57TVY4HY.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-A5IWFVHJ.js +2374 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-A5IWFVHJ.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-DJ6HHZ3S.js +1940 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-DJ6HHZ3S.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-FE6XYTIJ.js +126 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-FE6XYTIJ.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-ITHJLHIY.js +5795 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-ITHJLHIY.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-MFI342ZJ.js +512 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-MFI342ZJ.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NPVZU53R.js +6511 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NPVZU53R.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NSRJEU3V.js +27918 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-NSRJEU3V.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-R2N6IWJV.js +5116 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-R2N6IWJV.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-TO3SXVFJ.js +2840 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-TO3SXVFJ.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WFLMTRZP.js +379 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WFLMTRZP.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WQ5YUVUS.js +1534 -0
- package/.angular/cache/18.2.21/ui/vite/deps/chunk-WQ5YUVUS.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/ngx-color-picker.js +2925 -0
- package/.angular/cache/18.2.21/ui/vite/deps/ngx-color-picker.js.map +7 -0
- package/.angular/cache/18.2.21/ui/vite/deps/seedrandom.js +703 -0
- package/.angular/cache/18.2.21/ui/vite/deps/seedrandom.js.map +7 -0
- package/README.md +16 -0
- package/dist/ui/browser/index.html +1 -1
- package/dist/ui/browser/main-6SIZHY3G.js +17 -0
- package/package.json +3 -1
- package/scripts/mock-scheduler.js +350 -0
- package/scripts/test-live-model.js +286 -0
- package/dist/ui/browser/main-WR7FX6UH.js +0 -16
|
@@ -0,0 +1,2840 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DomPortalOutlet,
|
|
3
|
+
PortalModule,
|
|
4
|
+
ScrollDispatcher,
|
|
5
|
+
ScrollingModule,
|
|
6
|
+
TemplatePortal,
|
|
7
|
+
ViewportRuler
|
|
8
|
+
} from "./chunk-57TVY4HY.js";
|
|
9
|
+
import {
|
|
10
|
+
BidiModule,
|
|
11
|
+
Directionality,
|
|
12
|
+
ESCAPE,
|
|
13
|
+
Platform,
|
|
14
|
+
_getEventTarget,
|
|
15
|
+
_isTestEnvironment,
|
|
16
|
+
coerceArray,
|
|
17
|
+
coerceCssPixelValue,
|
|
18
|
+
hasModifierKey,
|
|
19
|
+
supportsScrollBehavior
|
|
20
|
+
} from "./chunk-ITHJLHIY.js";
|
|
21
|
+
import {
|
|
22
|
+
DOCUMENT,
|
|
23
|
+
Location
|
|
24
|
+
} from "./chunk-R2N6IWJV.js";
|
|
25
|
+
import {
|
|
26
|
+
ANIMATION_MODULE_TYPE,
|
|
27
|
+
ApplicationRef,
|
|
28
|
+
ComponentFactoryResolver$1,
|
|
29
|
+
Directive,
|
|
30
|
+
ElementRef,
|
|
31
|
+
EnvironmentInjector,
|
|
32
|
+
EventEmitter,
|
|
33
|
+
Inject,
|
|
34
|
+
Injectable,
|
|
35
|
+
InjectionToken,
|
|
36
|
+
Injector,
|
|
37
|
+
Input,
|
|
38
|
+
NgModule,
|
|
39
|
+
NgZone,
|
|
40
|
+
Optional,
|
|
41
|
+
Output,
|
|
42
|
+
Subject,
|
|
43
|
+
Subscription,
|
|
44
|
+
TemplateRef,
|
|
45
|
+
ViewContainerRef,
|
|
46
|
+
afterNextRender,
|
|
47
|
+
afterRender,
|
|
48
|
+
booleanAttribute,
|
|
49
|
+
filter,
|
|
50
|
+
inject,
|
|
51
|
+
merge,
|
|
52
|
+
setClassMetadata,
|
|
53
|
+
takeUntil,
|
|
54
|
+
takeWhile,
|
|
55
|
+
untracked,
|
|
56
|
+
ɵɵInputTransformsFeature,
|
|
57
|
+
ɵɵNgOnChangesFeature,
|
|
58
|
+
ɵɵdefineDirective,
|
|
59
|
+
ɵɵdefineInjectable,
|
|
60
|
+
ɵɵdefineInjector,
|
|
61
|
+
ɵɵdefineNgModule,
|
|
62
|
+
ɵɵdirectiveInject,
|
|
63
|
+
ɵɵinject
|
|
64
|
+
} from "./chunk-NSRJEU3V.js";
|
|
65
|
+
import {
|
|
66
|
+
__spreadProps,
|
|
67
|
+
__spreadValues
|
|
68
|
+
} from "./chunk-3OV72XIM.js";
|
|
69
|
+
|
|
70
|
+
// node_modules/@angular/cdk/fesm2022/overlay.mjs
|
|
71
|
+
var scrollBehaviorSupported = supportsScrollBehavior();
|
|
72
|
+
var BlockScrollStrategy = class {
|
|
73
|
+
constructor(_viewportRuler, document) {
|
|
74
|
+
this._viewportRuler = _viewportRuler;
|
|
75
|
+
this._previousHTMLStyles = {
|
|
76
|
+
top: "",
|
|
77
|
+
left: ""
|
|
78
|
+
};
|
|
79
|
+
this._isEnabled = false;
|
|
80
|
+
this._document = document;
|
|
81
|
+
}
|
|
82
|
+
/** Attaches this scroll strategy to an overlay. */
|
|
83
|
+
attach() {
|
|
84
|
+
}
|
|
85
|
+
/** Blocks page-level scroll while the attached overlay is open. */
|
|
86
|
+
enable() {
|
|
87
|
+
if (this._canBeEnabled()) {
|
|
88
|
+
const root = this._document.documentElement;
|
|
89
|
+
this._previousScrollPosition = this._viewportRuler.getViewportScrollPosition();
|
|
90
|
+
this._previousHTMLStyles.left = root.style.left || "";
|
|
91
|
+
this._previousHTMLStyles.top = root.style.top || "";
|
|
92
|
+
root.style.left = coerceCssPixelValue(-this._previousScrollPosition.left);
|
|
93
|
+
root.style.top = coerceCssPixelValue(-this._previousScrollPosition.top);
|
|
94
|
+
root.classList.add("cdk-global-scrollblock");
|
|
95
|
+
this._isEnabled = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** Unblocks page-level scroll while the attached overlay is open. */
|
|
99
|
+
disable() {
|
|
100
|
+
if (this._isEnabled) {
|
|
101
|
+
const html = this._document.documentElement;
|
|
102
|
+
const body = this._document.body;
|
|
103
|
+
const htmlStyle = html.style;
|
|
104
|
+
const bodyStyle = body.style;
|
|
105
|
+
const previousHtmlScrollBehavior = htmlStyle.scrollBehavior || "";
|
|
106
|
+
const previousBodyScrollBehavior = bodyStyle.scrollBehavior || "";
|
|
107
|
+
this._isEnabled = false;
|
|
108
|
+
htmlStyle.left = this._previousHTMLStyles.left;
|
|
109
|
+
htmlStyle.top = this._previousHTMLStyles.top;
|
|
110
|
+
html.classList.remove("cdk-global-scrollblock");
|
|
111
|
+
if (scrollBehaviorSupported) {
|
|
112
|
+
htmlStyle.scrollBehavior = bodyStyle.scrollBehavior = "auto";
|
|
113
|
+
}
|
|
114
|
+
window.scroll(this._previousScrollPosition.left, this._previousScrollPosition.top);
|
|
115
|
+
if (scrollBehaviorSupported) {
|
|
116
|
+
htmlStyle.scrollBehavior = previousHtmlScrollBehavior;
|
|
117
|
+
bodyStyle.scrollBehavior = previousBodyScrollBehavior;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
_canBeEnabled() {
|
|
122
|
+
const html = this._document.documentElement;
|
|
123
|
+
if (html.classList.contains("cdk-global-scrollblock") || this._isEnabled) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const body = this._document.body;
|
|
127
|
+
const viewport = this._viewportRuler.getViewportSize();
|
|
128
|
+
return body.scrollHeight > viewport.height || body.scrollWidth > viewport.width;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
function getMatScrollStrategyAlreadyAttachedError() {
|
|
132
|
+
return Error(`Scroll strategy has already been attached.`);
|
|
133
|
+
}
|
|
134
|
+
var CloseScrollStrategy = class {
|
|
135
|
+
constructor(_scrollDispatcher, _ngZone, _viewportRuler, _config) {
|
|
136
|
+
this._scrollDispatcher = _scrollDispatcher;
|
|
137
|
+
this._ngZone = _ngZone;
|
|
138
|
+
this._viewportRuler = _viewportRuler;
|
|
139
|
+
this._config = _config;
|
|
140
|
+
this._scrollSubscription = null;
|
|
141
|
+
this._detach = () => {
|
|
142
|
+
this.disable();
|
|
143
|
+
if (this._overlayRef.hasAttached()) {
|
|
144
|
+
this._ngZone.run(() => this._overlayRef.detach());
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/** Attaches this scroll strategy to an overlay. */
|
|
149
|
+
attach(overlayRef) {
|
|
150
|
+
if (this._overlayRef && (typeof ngDevMode === "undefined" || ngDevMode)) {
|
|
151
|
+
throw getMatScrollStrategyAlreadyAttachedError();
|
|
152
|
+
}
|
|
153
|
+
this._overlayRef = overlayRef;
|
|
154
|
+
}
|
|
155
|
+
/** Enables the closing of the attached overlay on scroll. */
|
|
156
|
+
enable() {
|
|
157
|
+
if (this._scrollSubscription) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const stream = this._scrollDispatcher.scrolled(0).pipe(filter((scrollable) => {
|
|
161
|
+
return !scrollable || !this._overlayRef.overlayElement.contains(scrollable.getElementRef().nativeElement);
|
|
162
|
+
}));
|
|
163
|
+
if (this._config && this._config.threshold && this._config.threshold > 1) {
|
|
164
|
+
this._initialScrollPosition = this._viewportRuler.getViewportScrollPosition().top;
|
|
165
|
+
this._scrollSubscription = stream.subscribe(() => {
|
|
166
|
+
const scrollPosition = this._viewportRuler.getViewportScrollPosition().top;
|
|
167
|
+
if (Math.abs(scrollPosition - this._initialScrollPosition) > this._config.threshold) {
|
|
168
|
+
this._detach();
|
|
169
|
+
} else {
|
|
170
|
+
this._overlayRef.updatePosition();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
this._scrollSubscription = stream.subscribe(this._detach);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** Disables the closing the attached overlay on scroll. */
|
|
178
|
+
disable() {
|
|
179
|
+
if (this._scrollSubscription) {
|
|
180
|
+
this._scrollSubscription.unsubscribe();
|
|
181
|
+
this._scrollSubscription = null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
detach() {
|
|
185
|
+
this.disable();
|
|
186
|
+
this._overlayRef = null;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var NoopScrollStrategy = class {
|
|
190
|
+
/** Does nothing, as this scroll strategy is a no-op. */
|
|
191
|
+
enable() {
|
|
192
|
+
}
|
|
193
|
+
/** Does nothing, as this scroll strategy is a no-op. */
|
|
194
|
+
disable() {
|
|
195
|
+
}
|
|
196
|
+
/** Does nothing, as this scroll strategy is a no-op. */
|
|
197
|
+
attach() {
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
function isElementScrolledOutsideView(element, scrollContainers) {
|
|
201
|
+
return scrollContainers.some((containerBounds) => {
|
|
202
|
+
const outsideAbove = element.bottom < containerBounds.top;
|
|
203
|
+
const outsideBelow = element.top > containerBounds.bottom;
|
|
204
|
+
const outsideLeft = element.right < containerBounds.left;
|
|
205
|
+
const outsideRight = element.left > containerBounds.right;
|
|
206
|
+
return outsideAbove || outsideBelow || outsideLeft || outsideRight;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function isElementClippedByScrolling(element, scrollContainers) {
|
|
210
|
+
return scrollContainers.some((scrollContainerRect) => {
|
|
211
|
+
const clippedAbove = element.top < scrollContainerRect.top;
|
|
212
|
+
const clippedBelow = element.bottom > scrollContainerRect.bottom;
|
|
213
|
+
const clippedLeft = element.left < scrollContainerRect.left;
|
|
214
|
+
const clippedRight = element.right > scrollContainerRect.right;
|
|
215
|
+
return clippedAbove || clippedBelow || clippedLeft || clippedRight;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
var RepositionScrollStrategy = class {
|
|
219
|
+
constructor(_scrollDispatcher, _viewportRuler, _ngZone, _config) {
|
|
220
|
+
this._scrollDispatcher = _scrollDispatcher;
|
|
221
|
+
this._viewportRuler = _viewportRuler;
|
|
222
|
+
this._ngZone = _ngZone;
|
|
223
|
+
this._config = _config;
|
|
224
|
+
this._scrollSubscription = null;
|
|
225
|
+
}
|
|
226
|
+
/** Attaches this scroll strategy to an overlay. */
|
|
227
|
+
attach(overlayRef) {
|
|
228
|
+
if (this._overlayRef && (typeof ngDevMode === "undefined" || ngDevMode)) {
|
|
229
|
+
throw getMatScrollStrategyAlreadyAttachedError();
|
|
230
|
+
}
|
|
231
|
+
this._overlayRef = overlayRef;
|
|
232
|
+
}
|
|
233
|
+
/** Enables repositioning of the attached overlay on scroll. */
|
|
234
|
+
enable() {
|
|
235
|
+
if (!this._scrollSubscription) {
|
|
236
|
+
const throttle = this._config ? this._config.scrollThrottle : 0;
|
|
237
|
+
this._scrollSubscription = this._scrollDispatcher.scrolled(throttle).subscribe(() => {
|
|
238
|
+
this._overlayRef.updatePosition();
|
|
239
|
+
if (this._config && this._config.autoClose) {
|
|
240
|
+
const overlayRect = this._overlayRef.overlayElement.getBoundingClientRect();
|
|
241
|
+
const {
|
|
242
|
+
width,
|
|
243
|
+
height
|
|
244
|
+
} = this._viewportRuler.getViewportSize();
|
|
245
|
+
const parentRects = [{
|
|
246
|
+
width,
|
|
247
|
+
height,
|
|
248
|
+
bottom: height,
|
|
249
|
+
right: width,
|
|
250
|
+
top: 0,
|
|
251
|
+
left: 0
|
|
252
|
+
}];
|
|
253
|
+
if (isElementScrolledOutsideView(overlayRect, parentRects)) {
|
|
254
|
+
this.disable();
|
|
255
|
+
this._ngZone.run(() => this._overlayRef.detach());
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/** Disables repositioning of the attached overlay on scroll. */
|
|
262
|
+
disable() {
|
|
263
|
+
if (this._scrollSubscription) {
|
|
264
|
+
this._scrollSubscription.unsubscribe();
|
|
265
|
+
this._scrollSubscription = null;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
detach() {
|
|
269
|
+
this.disable();
|
|
270
|
+
this._overlayRef = null;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
var ScrollStrategyOptions = class _ScrollStrategyOptions {
|
|
274
|
+
constructor(_scrollDispatcher, _viewportRuler, _ngZone, document) {
|
|
275
|
+
this._scrollDispatcher = _scrollDispatcher;
|
|
276
|
+
this._viewportRuler = _viewportRuler;
|
|
277
|
+
this._ngZone = _ngZone;
|
|
278
|
+
this.noop = () => new NoopScrollStrategy();
|
|
279
|
+
this.close = (config) => new CloseScrollStrategy(this._scrollDispatcher, this._ngZone, this._viewportRuler, config);
|
|
280
|
+
this.block = () => new BlockScrollStrategy(this._viewportRuler, this._document);
|
|
281
|
+
this.reposition = (config) => new RepositionScrollStrategy(this._scrollDispatcher, this._viewportRuler, this._ngZone, config);
|
|
282
|
+
this._document = document;
|
|
283
|
+
}
|
|
284
|
+
static {
|
|
285
|
+
this.ɵfac = function ScrollStrategyOptions_Factory(__ngFactoryType__) {
|
|
286
|
+
return new (__ngFactoryType__ || _ScrollStrategyOptions)(ɵɵinject(ScrollDispatcher), ɵɵinject(ViewportRuler), ɵɵinject(NgZone), ɵɵinject(DOCUMENT));
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
static {
|
|
290
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
291
|
+
token: _ScrollStrategyOptions,
|
|
292
|
+
factory: _ScrollStrategyOptions.ɵfac,
|
|
293
|
+
providedIn: "root"
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
(() => {
|
|
298
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ScrollStrategyOptions, [{
|
|
299
|
+
type: Injectable,
|
|
300
|
+
args: [{
|
|
301
|
+
providedIn: "root"
|
|
302
|
+
}]
|
|
303
|
+
}], () => [{
|
|
304
|
+
type: ScrollDispatcher
|
|
305
|
+
}, {
|
|
306
|
+
type: ViewportRuler
|
|
307
|
+
}, {
|
|
308
|
+
type: NgZone
|
|
309
|
+
}, {
|
|
310
|
+
type: void 0,
|
|
311
|
+
decorators: [{
|
|
312
|
+
type: Inject,
|
|
313
|
+
args: [DOCUMENT]
|
|
314
|
+
}]
|
|
315
|
+
}], null);
|
|
316
|
+
})();
|
|
317
|
+
var OverlayConfig = class {
|
|
318
|
+
constructor(config) {
|
|
319
|
+
this.scrollStrategy = new NoopScrollStrategy();
|
|
320
|
+
this.panelClass = "";
|
|
321
|
+
this.hasBackdrop = false;
|
|
322
|
+
this.backdropClass = "cdk-overlay-dark-backdrop";
|
|
323
|
+
this.disposeOnNavigation = false;
|
|
324
|
+
if (config) {
|
|
325
|
+
const configKeys = Object.keys(config);
|
|
326
|
+
for (const key of configKeys) {
|
|
327
|
+
if (config[key] !== void 0) {
|
|
328
|
+
this[key] = config[key];
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
var ConnectedOverlayPositionChange = class {
|
|
335
|
+
constructor(connectionPair, scrollableViewProperties) {
|
|
336
|
+
this.connectionPair = connectionPair;
|
|
337
|
+
this.scrollableViewProperties = scrollableViewProperties;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
function validateVerticalPosition(property, value) {
|
|
341
|
+
if (value !== "top" && value !== "bottom" && value !== "center") {
|
|
342
|
+
throw Error(`ConnectedPosition: Invalid ${property} "${value}". Expected "top", "bottom" or "center".`);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function validateHorizontalPosition(property, value) {
|
|
346
|
+
if (value !== "start" && value !== "end" && value !== "center") {
|
|
347
|
+
throw Error(`ConnectedPosition: Invalid ${property} "${value}". Expected "start", "end" or "center".`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
var BaseOverlayDispatcher = class _BaseOverlayDispatcher {
|
|
351
|
+
constructor(document) {
|
|
352
|
+
this._attachedOverlays = [];
|
|
353
|
+
this._document = document;
|
|
354
|
+
}
|
|
355
|
+
ngOnDestroy() {
|
|
356
|
+
this.detach();
|
|
357
|
+
}
|
|
358
|
+
/** Add a new overlay to the list of attached overlay refs. */
|
|
359
|
+
add(overlayRef) {
|
|
360
|
+
this.remove(overlayRef);
|
|
361
|
+
this._attachedOverlays.push(overlayRef);
|
|
362
|
+
}
|
|
363
|
+
/** Remove an overlay from the list of attached overlay refs. */
|
|
364
|
+
remove(overlayRef) {
|
|
365
|
+
const index = this._attachedOverlays.indexOf(overlayRef);
|
|
366
|
+
if (index > -1) {
|
|
367
|
+
this._attachedOverlays.splice(index, 1);
|
|
368
|
+
}
|
|
369
|
+
if (this._attachedOverlays.length === 0) {
|
|
370
|
+
this.detach();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
static {
|
|
374
|
+
this.ɵfac = function BaseOverlayDispatcher_Factory(__ngFactoryType__) {
|
|
375
|
+
return new (__ngFactoryType__ || _BaseOverlayDispatcher)(ɵɵinject(DOCUMENT));
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
static {
|
|
379
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
380
|
+
token: _BaseOverlayDispatcher,
|
|
381
|
+
factory: _BaseOverlayDispatcher.ɵfac,
|
|
382
|
+
providedIn: "root"
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
(() => {
|
|
387
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BaseOverlayDispatcher, [{
|
|
388
|
+
type: Injectable,
|
|
389
|
+
args: [{
|
|
390
|
+
providedIn: "root"
|
|
391
|
+
}]
|
|
392
|
+
}], () => [{
|
|
393
|
+
type: void 0,
|
|
394
|
+
decorators: [{
|
|
395
|
+
type: Inject,
|
|
396
|
+
args: [DOCUMENT]
|
|
397
|
+
}]
|
|
398
|
+
}], null);
|
|
399
|
+
})();
|
|
400
|
+
var OverlayKeyboardDispatcher = class _OverlayKeyboardDispatcher extends BaseOverlayDispatcher {
|
|
401
|
+
constructor(document, _ngZone) {
|
|
402
|
+
super(document);
|
|
403
|
+
this._ngZone = _ngZone;
|
|
404
|
+
this._keydownListener = (event) => {
|
|
405
|
+
const overlays = this._attachedOverlays;
|
|
406
|
+
for (let i = overlays.length - 1; i > -1; i--) {
|
|
407
|
+
if (overlays[i]._keydownEvents.observers.length > 0) {
|
|
408
|
+
const keydownEvents = overlays[i]._keydownEvents;
|
|
409
|
+
if (this._ngZone) {
|
|
410
|
+
this._ngZone.run(() => keydownEvents.next(event));
|
|
411
|
+
} else {
|
|
412
|
+
keydownEvents.next(event);
|
|
413
|
+
}
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/** Add a new overlay to the list of attached overlay refs. */
|
|
420
|
+
add(overlayRef) {
|
|
421
|
+
super.add(overlayRef);
|
|
422
|
+
if (!this._isAttached) {
|
|
423
|
+
if (this._ngZone) {
|
|
424
|
+
this._ngZone.runOutsideAngular(() => this._document.body.addEventListener("keydown", this._keydownListener));
|
|
425
|
+
} else {
|
|
426
|
+
this._document.body.addEventListener("keydown", this._keydownListener);
|
|
427
|
+
}
|
|
428
|
+
this._isAttached = true;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/** Detaches the global keyboard event listener. */
|
|
432
|
+
detach() {
|
|
433
|
+
if (this._isAttached) {
|
|
434
|
+
this._document.body.removeEventListener("keydown", this._keydownListener);
|
|
435
|
+
this._isAttached = false;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
static {
|
|
439
|
+
this.ɵfac = function OverlayKeyboardDispatcher_Factory(__ngFactoryType__) {
|
|
440
|
+
return new (__ngFactoryType__ || _OverlayKeyboardDispatcher)(ɵɵinject(DOCUMENT), ɵɵinject(NgZone, 8));
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
static {
|
|
444
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
445
|
+
token: _OverlayKeyboardDispatcher,
|
|
446
|
+
factory: _OverlayKeyboardDispatcher.ɵfac,
|
|
447
|
+
providedIn: "root"
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
(() => {
|
|
452
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayKeyboardDispatcher, [{
|
|
453
|
+
type: Injectable,
|
|
454
|
+
args: [{
|
|
455
|
+
providedIn: "root"
|
|
456
|
+
}]
|
|
457
|
+
}], () => [{
|
|
458
|
+
type: void 0,
|
|
459
|
+
decorators: [{
|
|
460
|
+
type: Inject,
|
|
461
|
+
args: [DOCUMENT]
|
|
462
|
+
}]
|
|
463
|
+
}, {
|
|
464
|
+
type: NgZone,
|
|
465
|
+
decorators: [{
|
|
466
|
+
type: Optional
|
|
467
|
+
}]
|
|
468
|
+
}], null);
|
|
469
|
+
})();
|
|
470
|
+
var OverlayOutsideClickDispatcher = class _OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {
|
|
471
|
+
constructor(document, _platform, _ngZone) {
|
|
472
|
+
super(document);
|
|
473
|
+
this._platform = _platform;
|
|
474
|
+
this._ngZone = _ngZone;
|
|
475
|
+
this._cursorStyleIsSet = false;
|
|
476
|
+
this._pointerDownListener = (event) => {
|
|
477
|
+
this._pointerDownEventTarget = _getEventTarget(event);
|
|
478
|
+
};
|
|
479
|
+
this._clickListener = (event) => {
|
|
480
|
+
const target = _getEventTarget(event);
|
|
481
|
+
const origin = event.type === "click" && this._pointerDownEventTarget ? this._pointerDownEventTarget : target;
|
|
482
|
+
this._pointerDownEventTarget = null;
|
|
483
|
+
const overlays = this._attachedOverlays.slice();
|
|
484
|
+
for (let i = overlays.length - 1; i > -1; i--) {
|
|
485
|
+
const overlayRef = overlays[i];
|
|
486
|
+
if (overlayRef._outsidePointerEvents.observers.length < 1 || !overlayRef.hasAttached()) {
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
if (containsPierceShadowDom(overlayRef.overlayElement, target) || containsPierceShadowDom(overlayRef.overlayElement, origin)) {
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
const outsidePointerEvents = overlayRef._outsidePointerEvents;
|
|
493
|
+
if (this._ngZone) {
|
|
494
|
+
this._ngZone.run(() => outsidePointerEvents.next(event));
|
|
495
|
+
} else {
|
|
496
|
+
outsidePointerEvents.next(event);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
/** Add a new overlay to the list of attached overlay refs. */
|
|
502
|
+
add(overlayRef) {
|
|
503
|
+
super.add(overlayRef);
|
|
504
|
+
if (!this._isAttached) {
|
|
505
|
+
const body = this._document.body;
|
|
506
|
+
if (this._ngZone) {
|
|
507
|
+
this._ngZone.runOutsideAngular(() => this._addEventListeners(body));
|
|
508
|
+
} else {
|
|
509
|
+
this._addEventListeners(body);
|
|
510
|
+
}
|
|
511
|
+
if (this._platform.IOS && !this._cursorStyleIsSet) {
|
|
512
|
+
this._cursorOriginalValue = body.style.cursor;
|
|
513
|
+
body.style.cursor = "pointer";
|
|
514
|
+
this._cursorStyleIsSet = true;
|
|
515
|
+
}
|
|
516
|
+
this._isAttached = true;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
/** Detaches the global keyboard event listener. */
|
|
520
|
+
detach() {
|
|
521
|
+
if (this._isAttached) {
|
|
522
|
+
const body = this._document.body;
|
|
523
|
+
body.removeEventListener("pointerdown", this._pointerDownListener, true);
|
|
524
|
+
body.removeEventListener("click", this._clickListener, true);
|
|
525
|
+
body.removeEventListener("auxclick", this._clickListener, true);
|
|
526
|
+
body.removeEventListener("contextmenu", this._clickListener, true);
|
|
527
|
+
if (this._platform.IOS && this._cursorStyleIsSet) {
|
|
528
|
+
body.style.cursor = this._cursorOriginalValue;
|
|
529
|
+
this._cursorStyleIsSet = false;
|
|
530
|
+
}
|
|
531
|
+
this._isAttached = false;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
_addEventListeners(body) {
|
|
535
|
+
body.addEventListener("pointerdown", this._pointerDownListener, true);
|
|
536
|
+
body.addEventListener("click", this._clickListener, true);
|
|
537
|
+
body.addEventListener("auxclick", this._clickListener, true);
|
|
538
|
+
body.addEventListener("contextmenu", this._clickListener, true);
|
|
539
|
+
}
|
|
540
|
+
static {
|
|
541
|
+
this.ɵfac = function OverlayOutsideClickDispatcher_Factory(__ngFactoryType__) {
|
|
542
|
+
return new (__ngFactoryType__ || _OverlayOutsideClickDispatcher)(ɵɵinject(DOCUMENT), ɵɵinject(Platform), ɵɵinject(NgZone, 8));
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
static {
|
|
546
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
547
|
+
token: _OverlayOutsideClickDispatcher,
|
|
548
|
+
factory: _OverlayOutsideClickDispatcher.ɵfac,
|
|
549
|
+
providedIn: "root"
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
(() => {
|
|
554
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayOutsideClickDispatcher, [{
|
|
555
|
+
type: Injectable,
|
|
556
|
+
args: [{
|
|
557
|
+
providedIn: "root"
|
|
558
|
+
}]
|
|
559
|
+
}], () => [{
|
|
560
|
+
type: void 0,
|
|
561
|
+
decorators: [{
|
|
562
|
+
type: Inject,
|
|
563
|
+
args: [DOCUMENT]
|
|
564
|
+
}]
|
|
565
|
+
}, {
|
|
566
|
+
type: Platform
|
|
567
|
+
}, {
|
|
568
|
+
type: NgZone,
|
|
569
|
+
decorators: [{
|
|
570
|
+
type: Optional
|
|
571
|
+
}]
|
|
572
|
+
}], null);
|
|
573
|
+
})();
|
|
574
|
+
function containsPierceShadowDom(parent, child) {
|
|
575
|
+
const supportsShadowRoot = typeof ShadowRoot !== "undefined" && ShadowRoot;
|
|
576
|
+
let current = child;
|
|
577
|
+
while (current) {
|
|
578
|
+
if (current === parent) {
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
current = supportsShadowRoot && current instanceof ShadowRoot ? current.host : current.parentNode;
|
|
582
|
+
}
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
var OverlayContainer = class _OverlayContainer {
|
|
586
|
+
constructor(document, _platform) {
|
|
587
|
+
this._platform = _platform;
|
|
588
|
+
this._document = document;
|
|
589
|
+
}
|
|
590
|
+
ngOnDestroy() {
|
|
591
|
+
this._containerElement?.remove();
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* This method returns the overlay container element. It will lazily
|
|
595
|
+
* create the element the first time it is called to facilitate using
|
|
596
|
+
* the container in non-browser environments.
|
|
597
|
+
* @returns the container element
|
|
598
|
+
*/
|
|
599
|
+
getContainerElement() {
|
|
600
|
+
if (!this._containerElement) {
|
|
601
|
+
this._createContainer();
|
|
602
|
+
}
|
|
603
|
+
return this._containerElement;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Create the overlay container element, which is simply a div
|
|
607
|
+
* with the 'cdk-overlay-container' class on the document body.
|
|
608
|
+
*/
|
|
609
|
+
_createContainer() {
|
|
610
|
+
const containerClass = "cdk-overlay-container";
|
|
611
|
+
if (this._platform.isBrowser || _isTestEnvironment()) {
|
|
612
|
+
const oppositePlatformContainers = this._document.querySelectorAll(`.${containerClass}[platform="server"], .${containerClass}[platform="test"]`);
|
|
613
|
+
for (let i = 0; i < oppositePlatformContainers.length; i++) {
|
|
614
|
+
oppositePlatformContainers[i].remove();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const container = this._document.createElement("div");
|
|
618
|
+
container.classList.add(containerClass);
|
|
619
|
+
if (_isTestEnvironment()) {
|
|
620
|
+
container.setAttribute("platform", "test");
|
|
621
|
+
} else if (!this._platform.isBrowser) {
|
|
622
|
+
container.setAttribute("platform", "server");
|
|
623
|
+
}
|
|
624
|
+
this._document.body.appendChild(container);
|
|
625
|
+
this._containerElement = container;
|
|
626
|
+
}
|
|
627
|
+
static {
|
|
628
|
+
this.ɵfac = function OverlayContainer_Factory(__ngFactoryType__) {
|
|
629
|
+
return new (__ngFactoryType__ || _OverlayContainer)(ɵɵinject(DOCUMENT), ɵɵinject(Platform));
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
static {
|
|
633
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
634
|
+
token: _OverlayContainer,
|
|
635
|
+
factory: _OverlayContainer.ɵfac,
|
|
636
|
+
providedIn: "root"
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
(() => {
|
|
641
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayContainer, [{
|
|
642
|
+
type: Injectable,
|
|
643
|
+
args: [{
|
|
644
|
+
providedIn: "root"
|
|
645
|
+
}]
|
|
646
|
+
}], () => [{
|
|
647
|
+
type: void 0,
|
|
648
|
+
decorators: [{
|
|
649
|
+
type: Inject,
|
|
650
|
+
args: [DOCUMENT]
|
|
651
|
+
}]
|
|
652
|
+
}, {
|
|
653
|
+
type: Platform
|
|
654
|
+
}], null);
|
|
655
|
+
})();
|
|
656
|
+
var OverlayRef = class {
|
|
657
|
+
constructor(_portalOutlet, _host, _pane, _config, _ngZone, _keyboardDispatcher, _document, _location, _outsideClickDispatcher, _animationsDisabled = false, _injector) {
|
|
658
|
+
this._portalOutlet = _portalOutlet;
|
|
659
|
+
this._host = _host;
|
|
660
|
+
this._pane = _pane;
|
|
661
|
+
this._config = _config;
|
|
662
|
+
this._ngZone = _ngZone;
|
|
663
|
+
this._keyboardDispatcher = _keyboardDispatcher;
|
|
664
|
+
this._document = _document;
|
|
665
|
+
this._location = _location;
|
|
666
|
+
this._outsideClickDispatcher = _outsideClickDispatcher;
|
|
667
|
+
this._animationsDisabled = _animationsDisabled;
|
|
668
|
+
this._injector = _injector;
|
|
669
|
+
this._backdropElement = null;
|
|
670
|
+
this._backdropClick = new Subject();
|
|
671
|
+
this._attachments = new Subject();
|
|
672
|
+
this._detachments = new Subject();
|
|
673
|
+
this._locationChanges = Subscription.EMPTY;
|
|
674
|
+
this._backdropClickHandler = (event) => this._backdropClick.next(event);
|
|
675
|
+
this._backdropTransitionendHandler = (event) => {
|
|
676
|
+
this._disposeBackdrop(event.target);
|
|
677
|
+
};
|
|
678
|
+
this._keydownEvents = new Subject();
|
|
679
|
+
this._outsidePointerEvents = new Subject();
|
|
680
|
+
this._renders = new Subject();
|
|
681
|
+
if (_config.scrollStrategy) {
|
|
682
|
+
this._scrollStrategy = _config.scrollStrategy;
|
|
683
|
+
this._scrollStrategy.attach(this);
|
|
684
|
+
}
|
|
685
|
+
this._positionStrategy = _config.positionStrategy;
|
|
686
|
+
this._afterRenderRef = untracked(() => afterRender(() => {
|
|
687
|
+
this._renders.next();
|
|
688
|
+
}, {
|
|
689
|
+
injector: this._injector
|
|
690
|
+
}));
|
|
691
|
+
}
|
|
692
|
+
/** The overlay's HTML element */
|
|
693
|
+
get overlayElement() {
|
|
694
|
+
return this._pane;
|
|
695
|
+
}
|
|
696
|
+
/** The overlay's backdrop HTML element. */
|
|
697
|
+
get backdropElement() {
|
|
698
|
+
return this._backdropElement;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Wrapper around the panel element. Can be used for advanced
|
|
702
|
+
* positioning where a wrapper with specific styling is
|
|
703
|
+
* required around the overlay pane.
|
|
704
|
+
*/
|
|
705
|
+
get hostElement() {
|
|
706
|
+
return this._host;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Attaches content, given via a Portal, to the overlay.
|
|
710
|
+
* If the overlay is configured to have a backdrop, it will be created.
|
|
711
|
+
*
|
|
712
|
+
* @param portal Portal instance to which to attach the overlay.
|
|
713
|
+
* @returns The portal attachment result.
|
|
714
|
+
*/
|
|
715
|
+
attach(portal) {
|
|
716
|
+
if (!this._host.parentElement && this._previousHostParent) {
|
|
717
|
+
this._previousHostParent.appendChild(this._host);
|
|
718
|
+
}
|
|
719
|
+
const attachResult = this._portalOutlet.attach(portal);
|
|
720
|
+
if (this._positionStrategy) {
|
|
721
|
+
this._positionStrategy.attach(this);
|
|
722
|
+
}
|
|
723
|
+
this._updateStackingOrder();
|
|
724
|
+
this._updateElementSize();
|
|
725
|
+
this._updateElementDirection();
|
|
726
|
+
if (this._scrollStrategy) {
|
|
727
|
+
this._scrollStrategy.enable();
|
|
728
|
+
}
|
|
729
|
+
this._afterNextRenderRef?.destroy();
|
|
730
|
+
this._afterNextRenderRef = afterNextRender(() => {
|
|
731
|
+
if (this.hasAttached()) {
|
|
732
|
+
this.updatePosition();
|
|
733
|
+
}
|
|
734
|
+
}, {
|
|
735
|
+
injector: this._injector
|
|
736
|
+
});
|
|
737
|
+
this._togglePointerEvents(true);
|
|
738
|
+
if (this._config.hasBackdrop) {
|
|
739
|
+
this._attachBackdrop();
|
|
740
|
+
}
|
|
741
|
+
if (this._config.panelClass) {
|
|
742
|
+
this._toggleClasses(this._pane, this._config.panelClass, true);
|
|
743
|
+
}
|
|
744
|
+
this._attachments.next();
|
|
745
|
+
this._keyboardDispatcher.add(this);
|
|
746
|
+
if (this._config.disposeOnNavigation) {
|
|
747
|
+
this._locationChanges = this._location.subscribe(() => this.dispose());
|
|
748
|
+
}
|
|
749
|
+
this._outsideClickDispatcher.add(this);
|
|
750
|
+
if (typeof attachResult?.onDestroy === "function") {
|
|
751
|
+
attachResult.onDestroy(() => {
|
|
752
|
+
if (this.hasAttached()) {
|
|
753
|
+
this._ngZone.runOutsideAngular(() => Promise.resolve().then(() => this.detach()));
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
return attachResult;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Detaches an overlay from a portal.
|
|
761
|
+
* @returns The portal detachment result.
|
|
762
|
+
*/
|
|
763
|
+
detach() {
|
|
764
|
+
if (!this.hasAttached()) {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
this.detachBackdrop();
|
|
768
|
+
this._togglePointerEvents(false);
|
|
769
|
+
if (this._positionStrategy && this._positionStrategy.detach) {
|
|
770
|
+
this._positionStrategy.detach();
|
|
771
|
+
}
|
|
772
|
+
if (this._scrollStrategy) {
|
|
773
|
+
this._scrollStrategy.disable();
|
|
774
|
+
}
|
|
775
|
+
const detachmentResult = this._portalOutlet.detach();
|
|
776
|
+
this._detachments.next();
|
|
777
|
+
this._keyboardDispatcher.remove(this);
|
|
778
|
+
this._detachContentWhenEmpty();
|
|
779
|
+
this._locationChanges.unsubscribe();
|
|
780
|
+
this._outsideClickDispatcher.remove(this);
|
|
781
|
+
return detachmentResult;
|
|
782
|
+
}
|
|
783
|
+
/** Cleans up the overlay from the DOM. */
|
|
784
|
+
dispose() {
|
|
785
|
+
const isAttached = this.hasAttached();
|
|
786
|
+
if (this._positionStrategy) {
|
|
787
|
+
this._positionStrategy.dispose();
|
|
788
|
+
}
|
|
789
|
+
this._disposeScrollStrategy();
|
|
790
|
+
this._disposeBackdrop(this._backdropElement);
|
|
791
|
+
this._locationChanges.unsubscribe();
|
|
792
|
+
this._keyboardDispatcher.remove(this);
|
|
793
|
+
this._portalOutlet.dispose();
|
|
794
|
+
this._attachments.complete();
|
|
795
|
+
this._backdropClick.complete();
|
|
796
|
+
this._keydownEvents.complete();
|
|
797
|
+
this._outsidePointerEvents.complete();
|
|
798
|
+
this._outsideClickDispatcher.remove(this);
|
|
799
|
+
this._host?.remove();
|
|
800
|
+
this._afterNextRenderRef?.destroy();
|
|
801
|
+
this._previousHostParent = this._pane = this._host = null;
|
|
802
|
+
if (isAttached) {
|
|
803
|
+
this._detachments.next();
|
|
804
|
+
}
|
|
805
|
+
this._detachments.complete();
|
|
806
|
+
this._afterRenderRef.destroy();
|
|
807
|
+
this._renders.complete();
|
|
808
|
+
}
|
|
809
|
+
/** Whether the overlay has attached content. */
|
|
810
|
+
hasAttached() {
|
|
811
|
+
return this._portalOutlet.hasAttached();
|
|
812
|
+
}
|
|
813
|
+
/** Gets an observable that emits when the backdrop has been clicked. */
|
|
814
|
+
backdropClick() {
|
|
815
|
+
return this._backdropClick;
|
|
816
|
+
}
|
|
817
|
+
/** Gets an observable that emits when the overlay has been attached. */
|
|
818
|
+
attachments() {
|
|
819
|
+
return this._attachments;
|
|
820
|
+
}
|
|
821
|
+
/** Gets an observable that emits when the overlay has been detached. */
|
|
822
|
+
detachments() {
|
|
823
|
+
return this._detachments;
|
|
824
|
+
}
|
|
825
|
+
/** Gets an observable of keydown events targeted to this overlay. */
|
|
826
|
+
keydownEvents() {
|
|
827
|
+
return this._keydownEvents;
|
|
828
|
+
}
|
|
829
|
+
/** Gets an observable of pointer events targeted outside this overlay. */
|
|
830
|
+
outsidePointerEvents() {
|
|
831
|
+
return this._outsidePointerEvents;
|
|
832
|
+
}
|
|
833
|
+
/** Gets the current overlay configuration, which is immutable. */
|
|
834
|
+
getConfig() {
|
|
835
|
+
return this._config;
|
|
836
|
+
}
|
|
837
|
+
/** Updates the position of the overlay based on the position strategy. */
|
|
838
|
+
updatePosition() {
|
|
839
|
+
if (this._positionStrategy) {
|
|
840
|
+
this._positionStrategy.apply();
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
/** Switches to a new position strategy and updates the overlay position. */
|
|
844
|
+
updatePositionStrategy(strategy) {
|
|
845
|
+
if (strategy === this._positionStrategy) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
if (this._positionStrategy) {
|
|
849
|
+
this._positionStrategy.dispose();
|
|
850
|
+
}
|
|
851
|
+
this._positionStrategy = strategy;
|
|
852
|
+
if (this.hasAttached()) {
|
|
853
|
+
strategy.attach(this);
|
|
854
|
+
this.updatePosition();
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
/** Update the size properties of the overlay. */
|
|
858
|
+
updateSize(sizeConfig) {
|
|
859
|
+
this._config = __spreadValues(__spreadValues({}, this._config), sizeConfig);
|
|
860
|
+
this._updateElementSize();
|
|
861
|
+
}
|
|
862
|
+
/** Sets the LTR/RTL direction for the overlay. */
|
|
863
|
+
setDirection(dir) {
|
|
864
|
+
this._config = __spreadProps(__spreadValues({}, this._config), {
|
|
865
|
+
direction: dir
|
|
866
|
+
});
|
|
867
|
+
this._updateElementDirection();
|
|
868
|
+
}
|
|
869
|
+
/** Add a CSS class or an array of classes to the overlay pane. */
|
|
870
|
+
addPanelClass(classes) {
|
|
871
|
+
if (this._pane) {
|
|
872
|
+
this._toggleClasses(this._pane, classes, true);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
/** Remove a CSS class or an array of classes from the overlay pane. */
|
|
876
|
+
removePanelClass(classes) {
|
|
877
|
+
if (this._pane) {
|
|
878
|
+
this._toggleClasses(this._pane, classes, false);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Returns the layout direction of the overlay panel.
|
|
883
|
+
*/
|
|
884
|
+
getDirection() {
|
|
885
|
+
const direction = this._config.direction;
|
|
886
|
+
if (!direction) {
|
|
887
|
+
return "ltr";
|
|
888
|
+
}
|
|
889
|
+
return typeof direction === "string" ? direction : direction.value;
|
|
890
|
+
}
|
|
891
|
+
/** Switches to a new scroll strategy. */
|
|
892
|
+
updateScrollStrategy(strategy) {
|
|
893
|
+
if (strategy === this._scrollStrategy) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
this._disposeScrollStrategy();
|
|
897
|
+
this._scrollStrategy = strategy;
|
|
898
|
+
if (this.hasAttached()) {
|
|
899
|
+
strategy.attach(this);
|
|
900
|
+
strategy.enable();
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
/** Updates the text direction of the overlay panel. */
|
|
904
|
+
_updateElementDirection() {
|
|
905
|
+
this._host.setAttribute("dir", this.getDirection());
|
|
906
|
+
}
|
|
907
|
+
/** Updates the size of the overlay element based on the overlay config. */
|
|
908
|
+
_updateElementSize() {
|
|
909
|
+
if (!this._pane) {
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
const style = this._pane.style;
|
|
913
|
+
style.width = coerceCssPixelValue(this._config.width);
|
|
914
|
+
style.height = coerceCssPixelValue(this._config.height);
|
|
915
|
+
style.minWidth = coerceCssPixelValue(this._config.minWidth);
|
|
916
|
+
style.minHeight = coerceCssPixelValue(this._config.minHeight);
|
|
917
|
+
style.maxWidth = coerceCssPixelValue(this._config.maxWidth);
|
|
918
|
+
style.maxHeight = coerceCssPixelValue(this._config.maxHeight);
|
|
919
|
+
}
|
|
920
|
+
/** Toggles the pointer events for the overlay pane element. */
|
|
921
|
+
_togglePointerEvents(enablePointer) {
|
|
922
|
+
this._pane.style.pointerEvents = enablePointer ? "" : "none";
|
|
923
|
+
}
|
|
924
|
+
/** Attaches a backdrop for this overlay. */
|
|
925
|
+
_attachBackdrop() {
|
|
926
|
+
const showingClass = "cdk-overlay-backdrop-showing";
|
|
927
|
+
this._backdropElement = this._document.createElement("div");
|
|
928
|
+
this._backdropElement.classList.add("cdk-overlay-backdrop");
|
|
929
|
+
if (this._animationsDisabled) {
|
|
930
|
+
this._backdropElement.classList.add("cdk-overlay-backdrop-noop-animation");
|
|
931
|
+
}
|
|
932
|
+
if (this._config.backdropClass) {
|
|
933
|
+
this._toggleClasses(this._backdropElement, this._config.backdropClass, true);
|
|
934
|
+
}
|
|
935
|
+
this._host.parentElement.insertBefore(this._backdropElement, this._host);
|
|
936
|
+
this._backdropElement.addEventListener("click", this._backdropClickHandler);
|
|
937
|
+
if (!this._animationsDisabled && typeof requestAnimationFrame !== "undefined") {
|
|
938
|
+
this._ngZone.runOutsideAngular(() => {
|
|
939
|
+
requestAnimationFrame(() => {
|
|
940
|
+
if (this._backdropElement) {
|
|
941
|
+
this._backdropElement.classList.add(showingClass);
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
});
|
|
945
|
+
} else {
|
|
946
|
+
this._backdropElement.classList.add(showingClass);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Updates the stacking order of the element, moving it to the top if necessary.
|
|
951
|
+
* This is required in cases where one overlay was detached, while another one,
|
|
952
|
+
* that should be behind it, was destroyed. The next time both of them are opened,
|
|
953
|
+
* the stacking will be wrong, because the detached element's pane will still be
|
|
954
|
+
* in its original DOM position.
|
|
955
|
+
*/
|
|
956
|
+
_updateStackingOrder() {
|
|
957
|
+
if (this._host.nextSibling) {
|
|
958
|
+
this._host.parentNode.appendChild(this._host);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
/** Detaches the backdrop (if any) associated with the overlay. */
|
|
962
|
+
detachBackdrop() {
|
|
963
|
+
const backdropToDetach = this._backdropElement;
|
|
964
|
+
if (!backdropToDetach) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
if (this._animationsDisabled) {
|
|
968
|
+
this._disposeBackdrop(backdropToDetach);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
backdropToDetach.classList.remove("cdk-overlay-backdrop-showing");
|
|
972
|
+
this._ngZone.runOutsideAngular(() => {
|
|
973
|
+
backdropToDetach.addEventListener("transitionend", this._backdropTransitionendHandler);
|
|
974
|
+
});
|
|
975
|
+
backdropToDetach.style.pointerEvents = "none";
|
|
976
|
+
this._backdropTimeout = this._ngZone.runOutsideAngular(() => setTimeout(() => {
|
|
977
|
+
this._disposeBackdrop(backdropToDetach);
|
|
978
|
+
}, 500));
|
|
979
|
+
}
|
|
980
|
+
/** Toggles a single CSS class or an array of classes on an element. */
|
|
981
|
+
_toggleClasses(element, cssClasses, isAdd) {
|
|
982
|
+
const classes = coerceArray(cssClasses || []).filter((c) => !!c);
|
|
983
|
+
if (classes.length) {
|
|
984
|
+
isAdd ? element.classList.add(...classes) : element.classList.remove(...classes);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
/** Detaches the overlay content next time the zone stabilizes. */
|
|
988
|
+
_detachContentWhenEmpty() {
|
|
989
|
+
this._ngZone.runOutsideAngular(() => {
|
|
990
|
+
const subscription = this._renders.pipe(takeUntil(merge(this._attachments, this._detachments))).subscribe(() => {
|
|
991
|
+
if (!this._pane || !this._host || this._pane.children.length === 0) {
|
|
992
|
+
if (this._pane && this._config.panelClass) {
|
|
993
|
+
this._toggleClasses(this._pane, this._config.panelClass, false);
|
|
994
|
+
}
|
|
995
|
+
if (this._host && this._host.parentElement) {
|
|
996
|
+
this._previousHostParent = this._host.parentElement;
|
|
997
|
+
this._host.remove();
|
|
998
|
+
}
|
|
999
|
+
subscription.unsubscribe();
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
/** Disposes of a scroll strategy. */
|
|
1005
|
+
_disposeScrollStrategy() {
|
|
1006
|
+
const scrollStrategy = this._scrollStrategy;
|
|
1007
|
+
if (scrollStrategy) {
|
|
1008
|
+
scrollStrategy.disable();
|
|
1009
|
+
if (scrollStrategy.detach) {
|
|
1010
|
+
scrollStrategy.detach();
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
/** Removes a backdrop element from the DOM. */
|
|
1015
|
+
_disposeBackdrop(backdrop) {
|
|
1016
|
+
if (backdrop) {
|
|
1017
|
+
backdrop.removeEventListener("click", this._backdropClickHandler);
|
|
1018
|
+
backdrop.removeEventListener("transitionend", this._backdropTransitionendHandler);
|
|
1019
|
+
backdrop.remove();
|
|
1020
|
+
if (this._backdropElement === backdrop) {
|
|
1021
|
+
this._backdropElement = null;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
if (this._backdropTimeout) {
|
|
1025
|
+
clearTimeout(this._backdropTimeout);
|
|
1026
|
+
this._backdropTimeout = void 0;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
var boundingBoxClass = "cdk-overlay-connected-position-bounding-box";
|
|
1031
|
+
var cssUnitPattern = /([A-Za-z%]+)$/;
|
|
1032
|
+
var FlexibleConnectedPositionStrategy = class {
|
|
1033
|
+
/** Ordered list of preferred positions, from most to least desirable. */
|
|
1034
|
+
get positions() {
|
|
1035
|
+
return this._preferredPositions;
|
|
1036
|
+
}
|
|
1037
|
+
constructor(connectedTo, _viewportRuler, _document, _platform, _overlayContainer) {
|
|
1038
|
+
this._viewportRuler = _viewportRuler;
|
|
1039
|
+
this._document = _document;
|
|
1040
|
+
this._platform = _platform;
|
|
1041
|
+
this._overlayContainer = _overlayContainer;
|
|
1042
|
+
this._lastBoundingBoxSize = {
|
|
1043
|
+
width: 0,
|
|
1044
|
+
height: 0
|
|
1045
|
+
};
|
|
1046
|
+
this._isPushed = false;
|
|
1047
|
+
this._canPush = true;
|
|
1048
|
+
this._growAfterOpen = false;
|
|
1049
|
+
this._hasFlexibleDimensions = true;
|
|
1050
|
+
this._positionLocked = false;
|
|
1051
|
+
this._viewportMargin = 0;
|
|
1052
|
+
this._scrollables = [];
|
|
1053
|
+
this._preferredPositions = [];
|
|
1054
|
+
this._positionChanges = new Subject();
|
|
1055
|
+
this._resizeSubscription = Subscription.EMPTY;
|
|
1056
|
+
this._offsetX = 0;
|
|
1057
|
+
this._offsetY = 0;
|
|
1058
|
+
this._appliedPanelClasses = [];
|
|
1059
|
+
this.positionChanges = this._positionChanges;
|
|
1060
|
+
this.setOrigin(connectedTo);
|
|
1061
|
+
}
|
|
1062
|
+
/** Attaches this position strategy to an overlay. */
|
|
1063
|
+
attach(overlayRef) {
|
|
1064
|
+
if (this._overlayRef && overlayRef !== this._overlayRef && (typeof ngDevMode === "undefined" || ngDevMode)) {
|
|
1065
|
+
throw Error("This position strategy is already attached to an overlay");
|
|
1066
|
+
}
|
|
1067
|
+
this._validatePositions();
|
|
1068
|
+
overlayRef.hostElement.classList.add(boundingBoxClass);
|
|
1069
|
+
this._overlayRef = overlayRef;
|
|
1070
|
+
this._boundingBox = overlayRef.hostElement;
|
|
1071
|
+
this._pane = overlayRef.overlayElement;
|
|
1072
|
+
this._isDisposed = false;
|
|
1073
|
+
this._isInitialRender = true;
|
|
1074
|
+
this._lastPosition = null;
|
|
1075
|
+
this._resizeSubscription.unsubscribe();
|
|
1076
|
+
this._resizeSubscription = this._viewportRuler.change().subscribe(() => {
|
|
1077
|
+
this._isInitialRender = true;
|
|
1078
|
+
this.apply();
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Updates the position of the overlay element, using whichever preferred position relative
|
|
1083
|
+
* to the origin best fits on-screen.
|
|
1084
|
+
*
|
|
1085
|
+
* The selection of a position goes as follows:
|
|
1086
|
+
* - If any positions fit completely within the viewport as-is,
|
|
1087
|
+
* choose the first position that does so.
|
|
1088
|
+
* - If flexible dimensions are enabled and at least one satisfies the given minimum width/height,
|
|
1089
|
+
* choose the position with the greatest available size modified by the positions' weight.
|
|
1090
|
+
* - If pushing is enabled, take the position that went off-screen the least and push it
|
|
1091
|
+
* on-screen.
|
|
1092
|
+
* - If none of the previous criteria were met, use the position that goes off-screen the least.
|
|
1093
|
+
* @docs-private
|
|
1094
|
+
*/
|
|
1095
|
+
apply() {
|
|
1096
|
+
if (this._isDisposed || !this._platform.isBrowser) {
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
if (!this._isInitialRender && this._positionLocked && this._lastPosition) {
|
|
1100
|
+
this.reapplyLastPosition();
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
this._clearPanelClasses();
|
|
1104
|
+
this._resetOverlayElementStyles();
|
|
1105
|
+
this._resetBoundingBoxStyles();
|
|
1106
|
+
this._viewportRect = this._getNarrowedViewportRect();
|
|
1107
|
+
this._originRect = this._getOriginRect();
|
|
1108
|
+
this._overlayRect = this._pane.getBoundingClientRect();
|
|
1109
|
+
this._containerRect = this._overlayContainer.getContainerElement().getBoundingClientRect();
|
|
1110
|
+
const originRect = this._originRect;
|
|
1111
|
+
const overlayRect = this._overlayRect;
|
|
1112
|
+
const viewportRect = this._viewportRect;
|
|
1113
|
+
const containerRect = this._containerRect;
|
|
1114
|
+
const flexibleFits = [];
|
|
1115
|
+
let fallback;
|
|
1116
|
+
for (let pos of this._preferredPositions) {
|
|
1117
|
+
let originPoint = this._getOriginPoint(originRect, containerRect, pos);
|
|
1118
|
+
let overlayPoint = this._getOverlayPoint(originPoint, overlayRect, pos);
|
|
1119
|
+
let overlayFit = this._getOverlayFit(overlayPoint, overlayRect, viewportRect, pos);
|
|
1120
|
+
if (overlayFit.isCompletelyWithinViewport) {
|
|
1121
|
+
this._isPushed = false;
|
|
1122
|
+
this._applyPosition(pos, originPoint);
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
if (this._canFitWithFlexibleDimensions(overlayFit, overlayPoint, viewportRect)) {
|
|
1126
|
+
flexibleFits.push({
|
|
1127
|
+
position: pos,
|
|
1128
|
+
origin: originPoint,
|
|
1129
|
+
overlayRect,
|
|
1130
|
+
boundingBoxRect: this._calculateBoundingBoxRect(originPoint, pos)
|
|
1131
|
+
});
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
if (!fallback || fallback.overlayFit.visibleArea < overlayFit.visibleArea) {
|
|
1135
|
+
fallback = {
|
|
1136
|
+
overlayFit,
|
|
1137
|
+
overlayPoint,
|
|
1138
|
+
originPoint,
|
|
1139
|
+
position: pos,
|
|
1140
|
+
overlayRect
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
if (flexibleFits.length) {
|
|
1145
|
+
let bestFit = null;
|
|
1146
|
+
let bestScore = -1;
|
|
1147
|
+
for (const fit of flexibleFits) {
|
|
1148
|
+
const score = fit.boundingBoxRect.width * fit.boundingBoxRect.height * (fit.position.weight || 1);
|
|
1149
|
+
if (score > bestScore) {
|
|
1150
|
+
bestScore = score;
|
|
1151
|
+
bestFit = fit;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
this._isPushed = false;
|
|
1155
|
+
this._applyPosition(bestFit.position, bestFit.origin);
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
if (this._canPush) {
|
|
1159
|
+
this._isPushed = true;
|
|
1160
|
+
this._applyPosition(fallback.position, fallback.originPoint);
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
this._applyPosition(fallback.position, fallback.originPoint);
|
|
1164
|
+
}
|
|
1165
|
+
detach() {
|
|
1166
|
+
this._clearPanelClasses();
|
|
1167
|
+
this._lastPosition = null;
|
|
1168
|
+
this._previousPushAmount = null;
|
|
1169
|
+
this._resizeSubscription.unsubscribe();
|
|
1170
|
+
}
|
|
1171
|
+
/** Cleanup after the element gets destroyed. */
|
|
1172
|
+
dispose() {
|
|
1173
|
+
if (this._isDisposed) {
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (this._boundingBox) {
|
|
1177
|
+
extendStyles(this._boundingBox.style, {
|
|
1178
|
+
top: "",
|
|
1179
|
+
left: "",
|
|
1180
|
+
right: "",
|
|
1181
|
+
bottom: "",
|
|
1182
|
+
height: "",
|
|
1183
|
+
width: "",
|
|
1184
|
+
alignItems: "",
|
|
1185
|
+
justifyContent: ""
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
if (this._pane) {
|
|
1189
|
+
this._resetOverlayElementStyles();
|
|
1190
|
+
}
|
|
1191
|
+
if (this._overlayRef) {
|
|
1192
|
+
this._overlayRef.hostElement.classList.remove(boundingBoxClass);
|
|
1193
|
+
}
|
|
1194
|
+
this.detach();
|
|
1195
|
+
this._positionChanges.complete();
|
|
1196
|
+
this._overlayRef = this._boundingBox = null;
|
|
1197
|
+
this._isDisposed = true;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* This re-aligns the overlay element with the trigger in its last calculated position,
|
|
1201
|
+
* even if a position higher in the "preferred positions" list would now fit. This
|
|
1202
|
+
* allows one to re-align the panel without changing the orientation of the panel.
|
|
1203
|
+
*/
|
|
1204
|
+
reapplyLastPosition() {
|
|
1205
|
+
if (this._isDisposed || !this._platform.isBrowser) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const lastPosition = this._lastPosition;
|
|
1209
|
+
if (lastPosition) {
|
|
1210
|
+
this._originRect = this._getOriginRect();
|
|
1211
|
+
this._overlayRect = this._pane.getBoundingClientRect();
|
|
1212
|
+
this._viewportRect = this._getNarrowedViewportRect();
|
|
1213
|
+
this._containerRect = this._overlayContainer.getContainerElement().getBoundingClientRect();
|
|
1214
|
+
const originPoint = this._getOriginPoint(this._originRect, this._containerRect, lastPosition);
|
|
1215
|
+
this._applyPosition(lastPosition, originPoint);
|
|
1216
|
+
} else {
|
|
1217
|
+
this.apply();
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Sets the list of Scrollable containers that host the origin element so that
|
|
1222
|
+
* on reposition we can evaluate if it or the overlay has been clipped or outside view. Every
|
|
1223
|
+
* Scrollable must be an ancestor element of the strategy's origin element.
|
|
1224
|
+
*/
|
|
1225
|
+
withScrollableContainers(scrollables) {
|
|
1226
|
+
this._scrollables = scrollables;
|
|
1227
|
+
return this;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Adds new preferred positions.
|
|
1231
|
+
* @param positions List of positions options for this overlay.
|
|
1232
|
+
*/
|
|
1233
|
+
withPositions(positions) {
|
|
1234
|
+
this._preferredPositions = positions;
|
|
1235
|
+
if (positions.indexOf(this._lastPosition) === -1) {
|
|
1236
|
+
this._lastPosition = null;
|
|
1237
|
+
}
|
|
1238
|
+
this._validatePositions();
|
|
1239
|
+
return this;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Sets a minimum distance the overlay may be positioned to the edge of the viewport.
|
|
1243
|
+
* @param margin Required margin between the overlay and the viewport edge in pixels.
|
|
1244
|
+
*/
|
|
1245
|
+
withViewportMargin(margin) {
|
|
1246
|
+
this._viewportMargin = margin;
|
|
1247
|
+
return this;
|
|
1248
|
+
}
|
|
1249
|
+
/** Sets whether the overlay's width and height can be constrained to fit within the viewport. */
|
|
1250
|
+
withFlexibleDimensions(flexibleDimensions = true) {
|
|
1251
|
+
this._hasFlexibleDimensions = flexibleDimensions;
|
|
1252
|
+
return this;
|
|
1253
|
+
}
|
|
1254
|
+
/** Sets whether the overlay can grow after the initial open via flexible width/height. */
|
|
1255
|
+
withGrowAfterOpen(growAfterOpen = true) {
|
|
1256
|
+
this._growAfterOpen = growAfterOpen;
|
|
1257
|
+
return this;
|
|
1258
|
+
}
|
|
1259
|
+
/** Sets whether the overlay can be pushed on-screen if none of the provided positions fit. */
|
|
1260
|
+
withPush(canPush = true) {
|
|
1261
|
+
this._canPush = canPush;
|
|
1262
|
+
return this;
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Sets whether the overlay's position should be locked in after it is positioned
|
|
1266
|
+
* initially. When an overlay is locked in, it won't attempt to reposition itself
|
|
1267
|
+
* when the position is re-applied (e.g. when the user scrolls away).
|
|
1268
|
+
* @param isLocked Whether the overlay should locked in.
|
|
1269
|
+
*/
|
|
1270
|
+
withLockedPosition(isLocked = true) {
|
|
1271
|
+
this._positionLocked = isLocked;
|
|
1272
|
+
return this;
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Sets the origin, relative to which to position the overlay.
|
|
1276
|
+
* Using an element origin is useful for building components that need to be positioned
|
|
1277
|
+
* relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
|
|
1278
|
+
* used for cases like contextual menus which open relative to the user's pointer.
|
|
1279
|
+
* @param origin Reference to the new origin.
|
|
1280
|
+
*/
|
|
1281
|
+
setOrigin(origin) {
|
|
1282
|
+
this._origin = origin;
|
|
1283
|
+
return this;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Sets the default offset for the overlay's connection point on the x-axis.
|
|
1287
|
+
* @param offset New offset in the X axis.
|
|
1288
|
+
*/
|
|
1289
|
+
withDefaultOffsetX(offset) {
|
|
1290
|
+
this._offsetX = offset;
|
|
1291
|
+
return this;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Sets the default offset for the overlay's connection point on the y-axis.
|
|
1295
|
+
* @param offset New offset in the Y axis.
|
|
1296
|
+
*/
|
|
1297
|
+
withDefaultOffsetY(offset) {
|
|
1298
|
+
this._offsetY = offset;
|
|
1299
|
+
return this;
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Configures that the position strategy should set a `transform-origin` on some elements
|
|
1303
|
+
* inside the overlay, depending on the current position that is being applied. This is
|
|
1304
|
+
* useful for the cases where the origin of an animation can change depending on the
|
|
1305
|
+
* alignment of the overlay.
|
|
1306
|
+
* @param selector CSS selector that will be used to find the target
|
|
1307
|
+
* elements onto which to set the transform origin.
|
|
1308
|
+
*/
|
|
1309
|
+
withTransformOriginOn(selector) {
|
|
1310
|
+
this._transformOriginSelector = selector;
|
|
1311
|
+
return this;
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
|
|
1315
|
+
*/
|
|
1316
|
+
_getOriginPoint(originRect, containerRect, pos) {
|
|
1317
|
+
let x;
|
|
1318
|
+
if (pos.originX == "center") {
|
|
1319
|
+
x = originRect.left + originRect.width / 2;
|
|
1320
|
+
} else {
|
|
1321
|
+
const startX = this._isRtl() ? originRect.right : originRect.left;
|
|
1322
|
+
const endX = this._isRtl() ? originRect.left : originRect.right;
|
|
1323
|
+
x = pos.originX == "start" ? startX : endX;
|
|
1324
|
+
}
|
|
1325
|
+
if (containerRect.left < 0) {
|
|
1326
|
+
x -= containerRect.left;
|
|
1327
|
+
}
|
|
1328
|
+
let y;
|
|
1329
|
+
if (pos.originY == "center") {
|
|
1330
|
+
y = originRect.top + originRect.height / 2;
|
|
1331
|
+
} else {
|
|
1332
|
+
y = pos.originY == "top" ? originRect.top : originRect.bottom;
|
|
1333
|
+
}
|
|
1334
|
+
if (containerRect.top < 0) {
|
|
1335
|
+
y -= containerRect.top;
|
|
1336
|
+
}
|
|
1337
|
+
return {
|
|
1338
|
+
x,
|
|
1339
|
+
y
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
|
|
1344
|
+
* origin point to which the overlay should be connected.
|
|
1345
|
+
*/
|
|
1346
|
+
_getOverlayPoint(originPoint, overlayRect, pos) {
|
|
1347
|
+
let overlayStartX;
|
|
1348
|
+
if (pos.overlayX == "center") {
|
|
1349
|
+
overlayStartX = -overlayRect.width / 2;
|
|
1350
|
+
} else if (pos.overlayX === "start") {
|
|
1351
|
+
overlayStartX = this._isRtl() ? -overlayRect.width : 0;
|
|
1352
|
+
} else {
|
|
1353
|
+
overlayStartX = this._isRtl() ? 0 : -overlayRect.width;
|
|
1354
|
+
}
|
|
1355
|
+
let overlayStartY;
|
|
1356
|
+
if (pos.overlayY == "center") {
|
|
1357
|
+
overlayStartY = -overlayRect.height / 2;
|
|
1358
|
+
} else {
|
|
1359
|
+
overlayStartY = pos.overlayY == "top" ? 0 : -overlayRect.height;
|
|
1360
|
+
}
|
|
1361
|
+
return {
|
|
1362
|
+
x: originPoint.x + overlayStartX,
|
|
1363
|
+
y: originPoint.y + overlayStartY
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
/** Gets how well an overlay at the given point will fit within the viewport. */
|
|
1367
|
+
_getOverlayFit(point, rawOverlayRect, viewport, position) {
|
|
1368
|
+
const overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
|
1369
|
+
let {
|
|
1370
|
+
x,
|
|
1371
|
+
y
|
|
1372
|
+
} = point;
|
|
1373
|
+
let offsetX = this._getOffset(position, "x");
|
|
1374
|
+
let offsetY = this._getOffset(position, "y");
|
|
1375
|
+
if (offsetX) {
|
|
1376
|
+
x += offsetX;
|
|
1377
|
+
}
|
|
1378
|
+
if (offsetY) {
|
|
1379
|
+
y += offsetY;
|
|
1380
|
+
}
|
|
1381
|
+
let leftOverflow = 0 - x;
|
|
1382
|
+
let rightOverflow = x + overlay.width - viewport.width;
|
|
1383
|
+
let topOverflow = 0 - y;
|
|
1384
|
+
let bottomOverflow = y + overlay.height - viewport.height;
|
|
1385
|
+
let visibleWidth = this._subtractOverflows(overlay.width, leftOverflow, rightOverflow);
|
|
1386
|
+
let visibleHeight = this._subtractOverflows(overlay.height, topOverflow, bottomOverflow);
|
|
1387
|
+
let visibleArea = visibleWidth * visibleHeight;
|
|
1388
|
+
return {
|
|
1389
|
+
visibleArea,
|
|
1390
|
+
isCompletelyWithinViewport: overlay.width * overlay.height === visibleArea,
|
|
1391
|
+
fitsInViewportVertically: visibleHeight === overlay.height,
|
|
1392
|
+
fitsInViewportHorizontally: visibleWidth == overlay.width
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Whether the overlay can fit within the viewport when it may resize either its width or height.
|
|
1397
|
+
* @param fit How well the overlay fits in the viewport at some position.
|
|
1398
|
+
* @param point The (x, y) coordinates of the overlay at some position.
|
|
1399
|
+
* @param viewport The geometry of the viewport.
|
|
1400
|
+
*/
|
|
1401
|
+
_canFitWithFlexibleDimensions(fit, point, viewport) {
|
|
1402
|
+
if (this._hasFlexibleDimensions) {
|
|
1403
|
+
const availableHeight = viewport.bottom - point.y;
|
|
1404
|
+
const availableWidth = viewport.right - point.x;
|
|
1405
|
+
const minHeight = getPixelValue(this._overlayRef.getConfig().minHeight);
|
|
1406
|
+
const minWidth = getPixelValue(this._overlayRef.getConfig().minWidth);
|
|
1407
|
+
const verticalFit = fit.fitsInViewportVertically || minHeight != null && minHeight <= availableHeight;
|
|
1408
|
+
const horizontalFit = fit.fitsInViewportHorizontally || minWidth != null && minWidth <= availableWidth;
|
|
1409
|
+
return verticalFit && horizontalFit;
|
|
1410
|
+
}
|
|
1411
|
+
return false;
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Gets the point at which the overlay can be "pushed" on-screen. If the overlay is larger than
|
|
1415
|
+
* the viewport, the top-left corner will be pushed on-screen (with overflow occurring on the
|
|
1416
|
+
* right and bottom).
|
|
1417
|
+
*
|
|
1418
|
+
* @param start Starting point from which the overlay is pushed.
|
|
1419
|
+
* @param rawOverlayRect Dimensions of the overlay.
|
|
1420
|
+
* @param scrollPosition Current viewport scroll position.
|
|
1421
|
+
* @returns The point at which to position the overlay after pushing. This is effectively a new
|
|
1422
|
+
* originPoint.
|
|
1423
|
+
*/
|
|
1424
|
+
_pushOverlayOnScreen(start, rawOverlayRect, scrollPosition) {
|
|
1425
|
+
if (this._previousPushAmount && this._positionLocked) {
|
|
1426
|
+
return {
|
|
1427
|
+
x: start.x + this._previousPushAmount.x,
|
|
1428
|
+
y: start.y + this._previousPushAmount.y
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
const overlay = getRoundedBoundingClientRect(rawOverlayRect);
|
|
1432
|
+
const viewport = this._viewportRect;
|
|
1433
|
+
const overflowRight = Math.max(start.x + overlay.width - viewport.width, 0);
|
|
1434
|
+
const overflowBottom = Math.max(start.y + overlay.height - viewport.height, 0);
|
|
1435
|
+
const overflowTop = Math.max(viewport.top - scrollPosition.top - start.y, 0);
|
|
1436
|
+
const overflowLeft = Math.max(viewport.left - scrollPosition.left - start.x, 0);
|
|
1437
|
+
let pushX = 0;
|
|
1438
|
+
let pushY = 0;
|
|
1439
|
+
if (overlay.width <= viewport.width) {
|
|
1440
|
+
pushX = overflowLeft || -overflowRight;
|
|
1441
|
+
} else {
|
|
1442
|
+
pushX = start.x < this._viewportMargin ? viewport.left - scrollPosition.left - start.x : 0;
|
|
1443
|
+
}
|
|
1444
|
+
if (overlay.height <= viewport.height) {
|
|
1445
|
+
pushY = overflowTop || -overflowBottom;
|
|
1446
|
+
} else {
|
|
1447
|
+
pushY = start.y < this._viewportMargin ? viewport.top - scrollPosition.top - start.y : 0;
|
|
1448
|
+
}
|
|
1449
|
+
this._previousPushAmount = {
|
|
1450
|
+
x: pushX,
|
|
1451
|
+
y: pushY
|
|
1452
|
+
};
|
|
1453
|
+
return {
|
|
1454
|
+
x: start.x + pushX,
|
|
1455
|
+
y: start.y + pushY
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Applies a computed position to the overlay and emits a position change.
|
|
1460
|
+
* @param position The position preference
|
|
1461
|
+
* @param originPoint The point on the origin element where the overlay is connected.
|
|
1462
|
+
*/
|
|
1463
|
+
_applyPosition(position, originPoint) {
|
|
1464
|
+
this._setTransformOrigin(position);
|
|
1465
|
+
this._setOverlayElementStyles(originPoint, position);
|
|
1466
|
+
this._setBoundingBoxStyles(originPoint, position);
|
|
1467
|
+
if (position.panelClass) {
|
|
1468
|
+
this._addPanelClasses(position.panelClass);
|
|
1469
|
+
}
|
|
1470
|
+
if (this._positionChanges.observers.length) {
|
|
1471
|
+
const scrollVisibility = this._getScrollVisibility();
|
|
1472
|
+
if (position !== this._lastPosition || !this._lastScrollVisibility || !compareScrollVisibility(this._lastScrollVisibility, scrollVisibility)) {
|
|
1473
|
+
const changeEvent = new ConnectedOverlayPositionChange(position, scrollVisibility);
|
|
1474
|
+
this._positionChanges.next(changeEvent);
|
|
1475
|
+
}
|
|
1476
|
+
this._lastScrollVisibility = scrollVisibility;
|
|
1477
|
+
}
|
|
1478
|
+
this._lastPosition = position;
|
|
1479
|
+
this._isInitialRender = false;
|
|
1480
|
+
}
|
|
1481
|
+
/** Sets the transform origin based on the configured selector and the passed-in position. */
|
|
1482
|
+
_setTransformOrigin(position) {
|
|
1483
|
+
if (!this._transformOriginSelector) {
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
const elements = this._boundingBox.querySelectorAll(this._transformOriginSelector);
|
|
1487
|
+
let xOrigin;
|
|
1488
|
+
let yOrigin = position.overlayY;
|
|
1489
|
+
if (position.overlayX === "center") {
|
|
1490
|
+
xOrigin = "center";
|
|
1491
|
+
} else if (this._isRtl()) {
|
|
1492
|
+
xOrigin = position.overlayX === "start" ? "right" : "left";
|
|
1493
|
+
} else {
|
|
1494
|
+
xOrigin = position.overlayX === "start" ? "left" : "right";
|
|
1495
|
+
}
|
|
1496
|
+
for (let i = 0; i < elements.length; i++) {
|
|
1497
|
+
elements[i].style.transformOrigin = `${xOrigin} ${yOrigin}`;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Gets the position and size of the overlay's sizing container.
|
|
1502
|
+
*
|
|
1503
|
+
* This method does no measuring and applies no styles so that we can cheaply compute the
|
|
1504
|
+
* bounds for all positions and choose the best fit based on these results.
|
|
1505
|
+
*/
|
|
1506
|
+
_calculateBoundingBoxRect(origin, position) {
|
|
1507
|
+
const viewport = this._viewportRect;
|
|
1508
|
+
const isRtl = this._isRtl();
|
|
1509
|
+
let height, top, bottom;
|
|
1510
|
+
if (position.overlayY === "top") {
|
|
1511
|
+
top = origin.y;
|
|
1512
|
+
height = viewport.height - top + this._viewportMargin;
|
|
1513
|
+
} else if (position.overlayY === "bottom") {
|
|
1514
|
+
bottom = viewport.height - origin.y + this._viewportMargin * 2;
|
|
1515
|
+
height = viewport.height - bottom + this._viewportMargin;
|
|
1516
|
+
} else {
|
|
1517
|
+
const smallestDistanceToViewportEdge = Math.min(viewport.bottom - origin.y + viewport.top, origin.y);
|
|
1518
|
+
const previousHeight = this._lastBoundingBoxSize.height;
|
|
1519
|
+
height = smallestDistanceToViewportEdge * 2;
|
|
1520
|
+
top = origin.y - smallestDistanceToViewportEdge;
|
|
1521
|
+
if (height > previousHeight && !this._isInitialRender && !this._growAfterOpen) {
|
|
1522
|
+
top = origin.y - previousHeight / 2;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
const isBoundedByRightViewportEdge = position.overlayX === "start" && !isRtl || position.overlayX === "end" && isRtl;
|
|
1526
|
+
const isBoundedByLeftViewportEdge = position.overlayX === "end" && !isRtl || position.overlayX === "start" && isRtl;
|
|
1527
|
+
let width, left, right;
|
|
1528
|
+
if (isBoundedByLeftViewportEdge) {
|
|
1529
|
+
right = viewport.width - origin.x + this._viewportMargin * 2;
|
|
1530
|
+
width = origin.x - this._viewportMargin;
|
|
1531
|
+
} else if (isBoundedByRightViewportEdge) {
|
|
1532
|
+
left = origin.x;
|
|
1533
|
+
width = viewport.right - origin.x;
|
|
1534
|
+
} else {
|
|
1535
|
+
const smallestDistanceToViewportEdge = Math.min(viewport.right - origin.x + viewport.left, origin.x);
|
|
1536
|
+
const previousWidth = this._lastBoundingBoxSize.width;
|
|
1537
|
+
width = smallestDistanceToViewportEdge * 2;
|
|
1538
|
+
left = origin.x - smallestDistanceToViewportEdge;
|
|
1539
|
+
if (width > previousWidth && !this._isInitialRender && !this._growAfterOpen) {
|
|
1540
|
+
left = origin.x - previousWidth / 2;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return {
|
|
1544
|
+
top,
|
|
1545
|
+
left,
|
|
1546
|
+
bottom,
|
|
1547
|
+
right,
|
|
1548
|
+
width,
|
|
1549
|
+
height
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
|
|
1554
|
+
* origin's connection point and stretches to the bounds of the viewport.
|
|
1555
|
+
*
|
|
1556
|
+
* @param origin The point on the origin element where the overlay is connected.
|
|
1557
|
+
* @param position The position preference
|
|
1558
|
+
*/
|
|
1559
|
+
_setBoundingBoxStyles(origin, position) {
|
|
1560
|
+
const boundingBoxRect = this._calculateBoundingBoxRect(origin, position);
|
|
1561
|
+
if (!this._isInitialRender && !this._growAfterOpen) {
|
|
1562
|
+
boundingBoxRect.height = Math.min(boundingBoxRect.height, this._lastBoundingBoxSize.height);
|
|
1563
|
+
boundingBoxRect.width = Math.min(boundingBoxRect.width, this._lastBoundingBoxSize.width);
|
|
1564
|
+
}
|
|
1565
|
+
const styles = {};
|
|
1566
|
+
if (this._hasExactPosition()) {
|
|
1567
|
+
styles.top = styles.left = "0";
|
|
1568
|
+
styles.bottom = styles.right = styles.maxHeight = styles.maxWidth = "";
|
|
1569
|
+
styles.width = styles.height = "100%";
|
|
1570
|
+
} else {
|
|
1571
|
+
const maxHeight = this._overlayRef.getConfig().maxHeight;
|
|
1572
|
+
const maxWidth = this._overlayRef.getConfig().maxWidth;
|
|
1573
|
+
styles.height = coerceCssPixelValue(boundingBoxRect.height);
|
|
1574
|
+
styles.top = coerceCssPixelValue(boundingBoxRect.top);
|
|
1575
|
+
styles.bottom = coerceCssPixelValue(boundingBoxRect.bottom);
|
|
1576
|
+
styles.width = coerceCssPixelValue(boundingBoxRect.width);
|
|
1577
|
+
styles.left = coerceCssPixelValue(boundingBoxRect.left);
|
|
1578
|
+
styles.right = coerceCssPixelValue(boundingBoxRect.right);
|
|
1579
|
+
if (position.overlayX === "center") {
|
|
1580
|
+
styles.alignItems = "center";
|
|
1581
|
+
} else {
|
|
1582
|
+
styles.alignItems = position.overlayX === "end" ? "flex-end" : "flex-start";
|
|
1583
|
+
}
|
|
1584
|
+
if (position.overlayY === "center") {
|
|
1585
|
+
styles.justifyContent = "center";
|
|
1586
|
+
} else {
|
|
1587
|
+
styles.justifyContent = position.overlayY === "bottom" ? "flex-end" : "flex-start";
|
|
1588
|
+
}
|
|
1589
|
+
if (maxHeight) {
|
|
1590
|
+
styles.maxHeight = coerceCssPixelValue(maxHeight);
|
|
1591
|
+
}
|
|
1592
|
+
if (maxWidth) {
|
|
1593
|
+
styles.maxWidth = coerceCssPixelValue(maxWidth);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
this._lastBoundingBoxSize = boundingBoxRect;
|
|
1597
|
+
extendStyles(this._boundingBox.style, styles);
|
|
1598
|
+
}
|
|
1599
|
+
/** Resets the styles for the bounding box so that a new positioning can be computed. */
|
|
1600
|
+
_resetBoundingBoxStyles() {
|
|
1601
|
+
extendStyles(this._boundingBox.style, {
|
|
1602
|
+
top: "0",
|
|
1603
|
+
left: "0",
|
|
1604
|
+
right: "0",
|
|
1605
|
+
bottom: "0",
|
|
1606
|
+
height: "",
|
|
1607
|
+
width: "",
|
|
1608
|
+
alignItems: "",
|
|
1609
|
+
justifyContent: ""
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
/** Resets the styles for the overlay pane so that a new positioning can be computed. */
|
|
1613
|
+
_resetOverlayElementStyles() {
|
|
1614
|
+
extendStyles(this._pane.style, {
|
|
1615
|
+
top: "",
|
|
1616
|
+
left: "",
|
|
1617
|
+
bottom: "",
|
|
1618
|
+
right: "",
|
|
1619
|
+
position: "",
|
|
1620
|
+
transform: ""
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
/** Sets positioning styles to the overlay element. */
|
|
1624
|
+
_setOverlayElementStyles(originPoint, position) {
|
|
1625
|
+
const styles = {};
|
|
1626
|
+
const hasExactPosition = this._hasExactPosition();
|
|
1627
|
+
const hasFlexibleDimensions = this._hasFlexibleDimensions;
|
|
1628
|
+
const config = this._overlayRef.getConfig();
|
|
1629
|
+
if (hasExactPosition) {
|
|
1630
|
+
const scrollPosition = this._viewportRuler.getViewportScrollPosition();
|
|
1631
|
+
extendStyles(styles, this._getExactOverlayY(position, originPoint, scrollPosition));
|
|
1632
|
+
extendStyles(styles, this._getExactOverlayX(position, originPoint, scrollPosition));
|
|
1633
|
+
} else {
|
|
1634
|
+
styles.position = "static";
|
|
1635
|
+
}
|
|
1636
|
+
let transformString = "";
|
|
1637
|
+
let offsetX = this._getOffset(position, "x");
|
|
1638
|
+
let offsetY = this._getOffset(position, "y");
|
|
1639
|
+
if (offsetX) {
|
|
1640
|
+
transformString += `translateX(${offsetX}px) `;
|
|
1641
|
+
}
|
|
1642
|
+
if (offsetY) {
|
|
1643
|
+
transformString += `translateY(${offsetY}px)`;
|
|
1644
|
+
}
|
|
1645
|
+
styles.transform = transformString.trim();
|
|
1646
|
+
if (config.maxHeight) {
|
|
1647
|
+
if (hasExactPosition) {
|
|
1648
|
+
styles.maxHeight = coerceCssPixelValue(config.maxHeight);
|
|
1649
|
+
} else if (hasFlexibleDimensions) {
|
|
1650
|
+
styles.maxHeight = "";
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
if (config.maxWidth) {
|
|
1654
|
+
if (hasExactPosition) {
|
|
1655
|
+
styles.maxWidth = coerceCssPixelValue(config.maxWidth);
|
|
1656
|
+
} else if (hasFlexibleDimensions) {
|
|
1657
|
+
styles.maxWidth = "";
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
extendStyles(this._pane.style, styles);
|
|
1661
|
+
}
|
|
1662
|
+
/** Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing. */
|
|
1663
|
+
_getExactOverlayY(position, originPoint, scrollPosition) {
|
|
1664
|
+
let styles = {
|
|
1665
|
+
top: "",
|
|
1666
|
+
bottom: ""
|
|
1667
|
+
};
|
|
1668
|
+
let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
|
|
1669
|
+
if (this._isPushed) {
|
|
1670
|
+
overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
|
|
1671
|
+
}
|
|
1672
|
+
if (position.overlayY === "bottom") {
|
|
1673
|
+
const documentHeight = this._document.documentElement.clientHeight;
|
|
1674
|
+
styles.bottom = `${documentHeight - (overlayPoint.y + this._overlayRect.height)}px`;
|
|
1675
|
+
} else {
|
|
1676
|
+
styles.top = coerceCssPixelValue(overlayPoint.y);
|
|
1677
|
+
}
|
|
1678
|
+
return styles;
|
|
1679
|
+
}
|
|
1680
|
+
/** Gets the exact left/right for the overlay when not using flexible sizing or when pushing. */
|
|
1681
|
+
_getExactOverlayX(position, originPoint, scrollPosition) {
|
|
1682
|
+
let styles = {
|
|
1683
|
+
left: "",
|
|
1684
|
+
right: ""
|
|
1685
|
+
};
|
|
1686
|
+
let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
|
|
1687
|
+
if (this._isPushed) {
|
|
1688
|
+
overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
|
|
1689
|
+
}
|
|
1690
|
+
let horizontalStyleProperty;
|
|
1691
|
+
if (this._isRtl()) {
|
|
1692
|
+
horizontalStyleProperty = position.overlayX === "end" ? "left" : "right";
|
|
1693
|
+
} else {
|
|
1694
|
+
horizontalStyleProperty = position.overlayX === "end" ? "right" : "left";
|
|
1695
|
+
}
|
|
1696
|
+
if (horizontalStyleProperty === "right") {
|
|
1697
|
+
const documentWidth = this._document.documentElement.clientWidth;
|
|
1698
|
+
styles.right = `${documentWidth - (overlayPoint.x + this._overlayRect.width)}px`;
|
|
1699
|
+
} else {
|
|
1700
|
+
styles.left = coerceCssPixelValue(overlayPoint.x);
|
|
1701
|
+
}
|
|
1702
|
+
return styles;
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Gets the view properties of the trigger and overlay, including whether they are clipped
|
|
1706
|
+
* or completely outside the view of any of the strategy's scrollables.
|
|
1707
|
+
*/
|
|
1708
|
+
_getScrollVisibility() {
|
|
1709
|
+
const originBounds = this._getOriginRect();
|
|
1710
|
+
const overlayBounds = this._pane.getBoundingClientRect();
|
|
1711
|
+
const scrollContainerBounds = this._scrollables.map((scrollable) => {
|
|
1712
|
+
return scrollable.getElementRef().nativeElement.getBoundingClientRect();
|
|
1713
|
+
});
|
|
1714
|
+
return {
|
|
1715
|
+
isOriginClipped: isElementClippedByScrolling(originBounds, scrollContainerBounds),
|
|
1716
|
+
isOriginOutsideView: isElementScrolledOutsideView(originBounds, scrollContainerBounds),
|
|
1717
|
+
isOverlayClipped: isElementClippedByScrolling(overlayBounds, scrollContainerBounds),
|
|
1718
|
+
isOverlayOutsideView: isElementScrolledOutsideView(overlayBounds, scrollContainerBounds)
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
/** Subtracts the amount that an element is overflowing on an axis from its length. */
|
|
1722
|
+
_subtractOverflows(length, ...overflows) {
|
|
1723
|
+
return overflows.reduce((currentValue, currentOverflow) => {
|
|
1724
|
+
return currentValue - Math.max(currentOverflow, 0);
|
|
1725
|
+
}, length);
|
|
1726
|
+
}
|
|
1727
|
+
/** Narrows the given viewport rect by the current _viewportMargin. */
|
|
1728
|
+
_getNarrowedViewportRect() {
|
|
1729
|
+
const width = this._document.documentElement.clientWidth;
|
|
1730
|
+
const height = this._document.documentElement.clientHeight;
|
|
1731
|
+
const scrollPosition = this._viewportRuler.getViewportScrollPosition();
|
|
1732
|
+
return {
|
|
1733
|
+
top: scrollPosition.top + this._viewportMargin,
|
|
1734
|
+
left: scrollPosition.left + this._viewportMargin,
|
|
1735
|
+
right: scrollPosition.left + width - this._viewportMargin,
|
|
1736
|
+
bottom: scrollPosition.top + height - this._viewportMargin,
|
|
1737
|
+
width: width - 2 * this._viewportMargin,
|
|
1738
|
+
height: height - 2 * this._viewportMargin
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
/** Whether the we're dealing with an RTL context */
|
|
1742
|
+
_isRtl() {
|
|
1743
|
+
return this._overlayRef.getDirection() === "rtl";
|
|
1744
|
+
}
|
|
1745
|
+
/** Determines whether the overlay uses exact or flexible positioning. */
|
|
1746
|
+
_hasExactPosition() {
|
|
1747
|
+
return !this._hasFlexibleDimensions || this._isPushed;
|
|
1748
|
+
}
|
|
1749
|
+
/** Retrieves the offset of a position along the x or y axis. */
|
|
1750
|
+
_getOffset(position, axis) {
|
|
1751
|
+
if (axis === "x") {
|
|
1752
|
+
return position.offsetX == null ? this._offsetX : position.offsetX;
|
|
1753
|
+
}
|
|
1754
|
+
return position.offsetY == null ? this._offsetY : position.offsetY;
|
|
1755
|
+
}
|
|
1756
|
+
/** Validates that the current position match the expected values. */
|
|
1757
|
+
_validatePositions() {
|
|
1758
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) {
|
|
1759
|
+
if (!this._preferredPositions.length) {
|
|
1760
|
+
throw Error("FlexibleConnectedPositionStrategy: At least one position is required.");
|
|
1761
|
+
}
|
|
1762
|
+
this._preferredPositions.forEach((pair) => {
|
|
1763
|
+
validateHorizontalPosition("originX", pair.originX);
|
|
1764
|
+
validateVerticalPosition("originY", pair.originY);
|
|
1765
|
+
validateHorizontalPosition("overlayX", pair.overlayX);
|
|
1766
|
+
validateVerticalPosition("overlayY", pair.overlayY);
|
|
1767
|
+
});
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
/** Adds a single CSS class or an array of classes on the overlay panel. */
|
|
1771
|
+
_addPanelClasses(cssClasses) {
|
|
1772
|
+
if (this._pane) {
|
|
1773
|
+
coerceArray(cssClasses).forEach((cssClass) => {
|
|
1774
|
+
if (cssClass !== "" && this._appliedPanelClasses.indexOf(cssClass) === -1) {
|
|
1775
|
+
this._appliedPanelClasses.push(cssClass);
|
|
1776
|
+
this._pane.classList.add(cssClass);
|
|
1777
|
+
}
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
/** Clears the classes that the position strategy has applied from the overlay panel. */
|
|
1782
|
+
_clearPanelClasses() {
|
|
1783
|
+
if (this._pane) {
|
|
1784
|
+
this._appliedPanelClasses.forEach((cssClass) => {
|
|
1785
|
+
this._pane.classList.remove(cssClass);
|
|
1786
|
+
});
|
|
1787
|
+
this._appliedPanelClasses = [];
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
/** Returns the DOMRect of the current origin. */
|
|
1791
|
+
_getOriginRect() {
|
|
1792
|
+
const origin = this._origin;
|
|
1793
|
+
if (origin instanceof ElementRef) {
|
|
1794
|
+
return origin.nativeElement.getBoundingClientRect();
|
|
1795
|
+
}
|
|
1796
|
+
if (origin instanceof Element) {
|
|
1797
|
+
return origin.getBoundingClientRect();
|
|
1798
|
+
}
|
|
1799
|
+
const width = origin.width || 0;
|
|
1800
|
+
const height = origin.height || 0;
|
|
1801
|
+
return {
|
|
1802
|
+
top: origin.y,
|
|
1803
|
+
bottom: origin.y + height,
|
|
1804
|
+
left: origin.x,
|
|
1805
|
+
right: origin.x + width,
|
|
1806
|
+
height,
|
|
1807
|
+
width
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
function extendStyles(destination, source) {
|
|
1812
|
+
for (let key in source) {
|
|
1813
|
+
if (source.hasOwnProperty(key)) {
|
|
1814
|
+
destination[key] = source[key];
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
return destination;
|
|
1818
|
+
}
|
|
1819
|
+
function getPixelValue(input) {
|
|
1820
|
+
if (typeof input !== "number" && input != null) {
|
|
1821
|
+
const [value, units] = input.split(cssUnitPattern);
|
|
1822
|
+
return !units || units === "px" ? parseFloat(value) : null;
|
|
1823
|
+
}
|
|
1824
|
+
return input || null;
|
|
1825
|
+
}
|
|
1826
|
+
function getRoundedBoundingClientRect(clientRect) {
|
|
1827
|
+
return {
|
|
1828
|
+
top: Math.floor(clientRect.top),
|
|
1829
|
+
right: Math.floor(clientRect.right),
|
|
1830
|
+
bottom: Math.floor(clientRect.bottom),
|
|
1831
|
+
left: Math.floor(clientRect.left),
|
|
1832
|
+
width: Math.floor(clientRect.width),
|
|
1833
|
+
height: Math.floor(clientRect.height)
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
function compareScrollVisibility(a, b) {
|
|
1837
|
+
if (a === b) {
|
|
1838
|
+
return true;
|
|
1839
|
+
}
|
|
1840
|
+
return a.isOriginClipped === b.isOriginClipped && a.isOriginOutsideView === b.isOriginOutsideView && a.isOverlayClipped === b.isOverlayClipped && a.isOverlayOutsideView === b.isOverlayOutsideView;
|
|
1841
|
+
}
|
|
1842
|
+
var wrapperClass = "cdk-global-overlay-wrapper";
|
|
1843
|
+
var GlobalPositionStrategy = class {
|
|
1844
|
+
constructor() {
|
|
1845
|
+
this._cssPosition = "static";
|
|
1846
|
+
this._topOffset = "";
|
|
1847
|
+
this._bottomOffset = "";
|
|
1848
|
+
this._alignItems = "";
|
|
1849
|
+
this._xPosition = "";
|
|
1850
|
+
this._xOffset = "";
|
|
1851
|
+
this._width = "";
|
|
1852
|
+
this._height = "";
|
|
1853
|
+
this._isDisposed = false;
|
|
1854
|
+
}
|
|
1855
|
+
attach(overlayRef) {
|
|
1856
|
+
const config = overlayRef.getConfig();
|
|
1857
|
+
this._overlayRef = overlayRef;
|
|
1858
|
+
if (this._width && !config.width) {
|
|
1859
|
+
overlayRef.updateSize({
|
|
1860
|
+
width: this._width
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
if (this._height && !config.height) {
|
|
1864
|
+
overlayRef.updateSize({
|
|
1865
|
+
height: this._height
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
overlayRef.hostElement.classList.add(wrapperClass);
|
|
1869
|
+
this._isDisposed = false;
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* Sets the top position of the overlay. Clears any previously set vertical position.
|
|
1873
|
+
* @param value New top offset.
|
|
1874
|
+
*/
|
|
1875
|
+
top(value = "") {
|
|
1876
|
+
this._bottomOffset = "";
|
|
1877
|
+
this._topOffset = value;
|
|
1878
|
+
this._alignItems = "flex-start";
|
|
1879
|
+
return this;
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Sets the left position of the overlay. Clears any previously set horizontal position.
|
|
1883
|
+
* @param value New left offset.
|
|
1884
|
+
*/
|
|
1885
|
+
left(value = "") {
|
|
1886
|
+
this._xOffset = value;
|
|
1887
|
+
this._xPosition = "left";
|
|
1888
|
+
return this;
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Sets the bottom position of the overlay. Clears any previously set vertical position.
|
|
1892
|
+
* @param value New bottom offset.
|
|
1893
|
+
*/
|
|
1894
|
+
bottom(value = "") {
|
|
1895
|
+
this._topOffset = "";
|
|
1896
|
+
this._bottomOffset = value;
|
|
1897
|
+
this._alignItems = "flex-end";
|
|
1898
|
+
return this;
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Sets the right position of the overlay. Clears any previously set horizontal position.
|
|
1902
|
+
* @param value New right offset.
|
|
1903
|
+
*/
|
|
1904
|
+
right(value = "") {
|
|
1905
|
+
this._xOffset = value;
|
|
1906
|
+
this._xPosition = "right";
|
|
1907
|
+
return this;
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Sets the overlay to the start of the viewport, depending on the overlay direction.
|
|
1911
|
+
* This will be to the left in LTR layouts and to the right in RTL.
|
|
1912
|
+
* @param offset Offset from the edge of the screen.
|
|
1913
|
+
*/
|
|
1914
|
+
start(value = "") {
|
|
1915
|
+
this._xOffset = value;
|
|
1916
|
+
this._xPosition = "start";
|
|
1917
|
+
return this;
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Sets the overlay to the end of the viewport, depending on the overlay direction.
|
|
1921
|
+
* This will be to the right in LTR layouts and to the left in RTL.
|
|
1922
|
+
* @param offset Offset from the edge of the screen.
|
|
1923
|
+
*/
|
|
1924
|
+
end(value = "") {
|
|
1925
|
+
this._xOffset = value;
|
|
1926
|
+
this._xPosition = "end";
|
|
1927
|
+
return this;
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Sets the overlay width and clears any previously set width.
|
|
1931
|
+
* @param value New width for the overlay
|
|
1932
|
+
* @deprecated Pass the `width` through the `OverlayConfig`.
|
|
1933
|
+
* @breaking-change 8.0.0
|
|
1934
|
+
*/
|
|
1935
|
+
width(value = "") {
|
|
1936
|
+
if (this._overlayRef) {
|
|
1937
|
+
this._overlayRef.updateSize({
|
|
1938
|
+
width: value
|
|
1939
|
+
});
|
|
1940
|
+
} else {
|
|
1941
|
+
this._width = value;
|
|
1942
|
+
}
|
|
1943
|
+
return this;
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Sets the overlay height and clears any previously set height.
|
|
1947
|
+
* @param value New height for the overlay
|
|
1948
|
+
* @deprecated Pass the `height` through the `OverlayConfig`.
|
|
1949
|
+
* @breaking-change 8.0.0
|
|
1950
|
+
*/
|
|
1951
|
+
height(value = "") {
|
|
1952
|
+
if (this._overlayRef) {
|
|
1953
|
+
this._overlayRef.updateSize({
|
|
1954
|
+
height: value
|
|
1955
|
+
});
|
|
1956
|
+
} else {
|
|
1957
|
+
this._height = value;
|
|
1958
|
+
}
|
|
1959
|
+
return this;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Centers the overlay horizontally with an optional offset.
|
|
1963
|
+
* Clears any previously set horizontal position.
|
|
1964
|
+
*
|
|
1965
|
+
* @param offset Overlay offset from the horizontal center.
|
|
1966
|
+
*/
|
|
1967
|
+
centerHorizontally(offset = "") {
|
|
1968
|
+
this.left(offset);
|
|
1969
|
+
this._xPosition = "center";
|
|
1970
|
+
return this;
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* Centers the overlay vertically with an optional offset.
|
|
1974
|
+
* Clears any previously set vertical position.
|
|
1975
|
+
*
|
|
1976
|
+
* @param offset Overlay offset from the vertical center.
|
|
1977
|
+
*/
|
|
1978
|
+
centerVertically(offset = "") {
|
|
1979
|
+
this.top(offset);
|
|
1980
|
+
this._alignItems = "center";
|
|
1981
|
+
return this;
|
|
1982
|
+
}
|
|
1983
|
+
/**
|
|
1984
|
+
* Apply the position to the element.
|
|
1985
|
+
* @docs-private
|
|
1986
|
+
*/
|
|
1987
|
+
apply() {
|
|
1988
|
+
if (!this._overlayRef || !this._overlayRef.hasAttached()) {
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
const styles = this._overlayRef.overlayElement.style;
|
|
1992
|
+
const parentStyles = this._overlayRef.hostElement.style;
|
|
1993
|
+
const config = this._overlayRef.getConfig();
|
|
1994
|
+
const {
|
|
1995
|
+
width,
|
|
1996
|
+
height,
|
|
1997
|
+
maxWidth,
|
|
1998
|
+
maxHeight
|
|
1999
|
+
} = config;
|
|
2000
|
+
const shouldBeFlushHorizontally = (width === "100%" || width === "100vw") && (!maxWidth || maxWidth === "100%" || maxWidth === "100vw");
|
|
2001
|
+
const shouldBeFlushVertically = (height === "100%" || height === "100vh") && (!maxHeight || maxHeight === "100%" || maxHeight === "100vh");
|
|
2002
|
+
const xPosition = this._xPosition;
|
|
2003
|
+
const xOffset = this._xOffset;
|
|
2004
|
+
const isRtl = this._overlayRef.getConfig().direction === "rtl";
|
|
2005
|
+
let marginLeft = "";
|
|
2006
|
+
let marginRight = "";
|
|
2007
|
+
let justifyContent = "";
|
|
2008
|
+
if (shouldBeFlushHorizontally) {
|
|
2009
|
+
justifyContent = "flex-start";
|
|
2010
|
+
} else if (xPosition === "center") {
|
|
2011
|
+
justifyContent = "center";
|
|
2012
|
+
if (isRtl) {
|
|
2013
|
+
marginRight = xOffset;
|
|
2014
|
+
} else {
|
|
2015
|
+
marginLeft = xOffset;
|
|
2016
|
+
}
|
|
2017
|
+
} else if (isRtl) {
|
|
2018
|
+
if (xPosition === "left" || xPosition === "end") {
|
|
2019
|
+
justifyContent = "flex-end";
|
|
2020
|
+
marginLeft = xOffset;
|
|
2021
|
+
} else if (xPosition === "right" || xPosition === "start") {
|
|
2022
|
+
justifyContent = "flex-start";
|
|
2023
|
+
marginRight = xOffset;
|
|
2024
|
+
}
|
|
2025
|
+
} else if (xPosition === "left" || xPosition === "start") {
|
|
2026
|
+
justifyContent = "flex-start";
|
|
2027
|
+
marginLeft = xOffset;
|
|
2028
|
+
} else if (xPosition === "right" || xPosition === "end") {
|
|
2029
|
+
justifyContent = "flex-end";
|
|
2030
|
+
marginRight = xOffset;
|
|
2031
|
+
}
|
|
2032
|
+
styles.position = this._cssPosition;
|
|
2033
|
+
styles.marginLeft = shouldBeFlushHorizontally ? "0" : marginLeft;
|
|
2034
|
+
styles.marginTop = shouldBeFlushVertically ? "0" : this._topOffset;
|
|
2035
|
+
styles.marginBottom = this._bottomOffset;
|
|
2036
|
+
styles.marginRight = shouldBeFlushHorizontally ? "0" : marginRight;
|
|
2037
|
+
parentStyles.justifyContent = justifyContent;
|
|
2038
|
+
parentStyles.alignItems = shouldBeFlushVertically ? "flex-start" : this._alignItems;
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Cleans up the DOM changes from the position strategy.
|
|
2042
|
+
* @docs-private
|
|
2043
|
+
*/
|
|
2044
|
+
dispose() {
|
|
2045
|
+
if (this._isDisposed || !this._overlayRef) {
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
const styles = this._overlayRef.overlayElement.style;
|
|
2049
|
+
const parent = this._overlayRef.hostElement;
|
|
2050
|
+
const parentStyles = parent.style;
|
|
2051
|
+
parent.classList.remove(wrapperClass);
|
|
2052
|
+
parentStyles.justifyContent = parentStyles.alignItems = styles.marginTop = styles.marginBottom = styles.marginLeft = styles.marginRight = styles.position = "";
|
|
2053
|
+
this._overlayRef = null;
|
|
2054
|
+
this._isDisposed = true;
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
var OverlayPositionBuilder = class _OverlayPositionBuilder {
|
|
2058
|
+
constructor(_viewportRuler, _document, _platform, _overlayContainer) {
|
|
2059
|
+
this._viewportRuler = _viewportRuler;
|
|
2060
|
+
this._document = _document;
|
|
2061
|
+
this._platform = _platform;
|
|
2062
|
+
this._overlayContainer = _overlayContainer;
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* Creates a global position strategy.
|
|
2066
|
+
*/
|
|
2067
|
+
global() {
|
|
2068
|
+
return new GlobalPositionStrategy();
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Creates a flexible position strategy.
|
|
2072
|
+
* @param origin Origin relative to which to position the overlay.
|
|
2073
|
+
*/
|
|
2074
|
+
flexibleConnectedTo(origin) {
|
|
2075
|
+
return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer);
|
|
2076
|
+
}
|
|
2077
|
+
static {
|
|
2078
|
+
this.ɵfac = function OverlayPositionBuilder_Factory(__ngFactoryType__) {
|
|
2079
|
+
return new (__ngFactoryType__ || _OverlayPositionBuilder)(ɵɵinject(ViewportRuler), ɵɵinject(DOCUMENT), ɵɵinject(Platform), ɵɵinject(OverlayContainer));
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
static {
|
|
2083
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
2084
|
+
token: _OverlayPositionBuilder,
|
|
2085
|
+
factory: _OverlayPositionBuilder.ɵfac,
|
|
2086
|
+
providedIn: "root"
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
(() => {
|
|
2091
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayPositionBuilder, [{
|
|
2092
|
+
type: Injectable,
|
|
2093
|
+
args: [{
|
|
2094
|
+
providedIn: "root"
|
|
2095
|
+
}]
|
|
2096
|
+
}], () => [{
|
|
2097
|
+
type: ViewportRuler
|
|
2098
|
+
}, {
|
|
2099
|
+
type: void 0,
|
|
2100
|
+
decorators: [{
|
|
2101
|
+
type: Inject,
|
|
2102
|
+
args: [DOCUMENT]
|
|
2103
|
+
}]
|
|
2104
|
+
}, {
|
|
2105
|
+
type: Platform
|
|
2106
|
+
}, {
|
|
2107
|
+
type: OverlayContainer
|
|
2108
|
+
}], null);
|
|
2109
|
+
})();
|
|
2110
|
+
var nextUniqueId = 0;
|
|
2111
|
+
var Overlay = class _Overlay {
|
|
2112
|
+
constructor(scrollStrategies, _overlayContainer, _componentFactoryResolver, _positionBuilder, _keyboardDispatcher, _injector, _ngZone, _document, _directionality, _location, _outsideClickDispatcher, _animationsModuleType) {
|
|
2113
|
+
this.scrollStrategies = scrollStrategies;
|
|
2114
|
+
this._overlayContainer = _overlayContainer;
|
|
2115
|
+
this._componentFactoryResolver = _componentFactoryResolver;
|
|
2116
|
+
this._positionBuilder = _positionBuilder;
|
|
2117
|
+
this._keyboardDispatcher = _keyboardDispatcher;
|
|
2118
|
+
this._injector = _injector;
|
|
2119
|
+
this._ngZone = _ngZone;
|
|
2120
|
+
this._document = _document;
|
|
2121
|
+
this._directionality = _directionality;
|
|
2122
|
+
this._location = _location;
|
|
2123
|
+
this._outsideClickDispatcher = _outsideClickDispatcher;
|
|
2124
|
+
this._animationsModuleType = _animationsModuleType;
|
|
2125
|
+
}
|
|
2126
|
+
/**
|
|
2127
|
+
* Creates an overlay.
|
|
2128
|
+
* @param config Configuration applied to the overlay.
|
|
2129
|
+
* @returns Reference to the created overlay.
|
|
2130
|
+
*/
|
|
2131
|
+
create(config) {
|
|
2132
|
+
const host = this._createHostElement();
|
|
2133
|
+
const pane = this._createPaneElement(host);
|
|
2134
|
+
const portalOutlet = this._createPortalOutlet(pane);
|
|
2135
|
+
const overlayConfig = new OverlayConfig(config);
|
|
2136
|
+
overlayConfig.direction = overlayConfig.direction || this._directionality.value;
|
|
2137
|
+
return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._keyboardDispatcher, this._document, this._location, this._outsideClickDispatcher, this._animationsModuleType === "NoopAnimations", this._injector.get(EnvironmentInjector));
|
|
2138
|
+
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Gets a position builder that can be used, via fluent API,
|
|
2141
|
+
* to construct and configure a position strategy.
|
|
2142
|
+
* @returns An overlay position builder.
|
|
2143
|
+
*/
|
|
2144
|
+
position() {
|
|
2145
|
+
return this._positionBuilder;
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Creates the DOM element for an overlay and appends it to the overlay container.
|
|
2149
|
+
* @returns Newly-created pane element
|
|
2150
|
+
*/
|
|
2151
|
+
_createPaneElement(host) {
|
|
2152
|
+
const pane = this._document.createElement("div");
|
|
2153
|
+
pane.id = `cdk-overlay-${nextUniqueId++}`;
|
|
2154
|
+
pane.classList.add("cdk-overlay-pane");
|
|
2155
|
+
host.appendChild(pane);
|
|
2156
|
+
return pane;
|
|
2157
|
+
}
|
|
2158
|
+
/**
|
|
2159
|
+
* Creates the host element that wraps around an overlay
|
|
2160
|
+
* and can be used for advanced positioning.
|
|
2161
|
+
* @returns Newly-create host element.
|
|
2162
|
+
*/
|
|
2163
|
+
_createHostElement() {
|
|
2164
|
+
const host = this._document.createElement("div");
|
|
2165
|
+
this._overlayContainer.getContainerElement().appendChild(host);
|
|
2166
|
+
return host;
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* Create a DomPortalOutlet into which the overlay content can be loaded.
|
|
2170
|
+
* @param pane The DOM element to turn into a portal outlet.
|
|
2171
|
+
* @returns A portal outlet for the given DOM element.
|
|
2172
|
+
*/
|
|
2173
|
+
_createPortalOutlet(pane) {
|
|
2174
|
+
if (!this._appRef) {
|
|
2175
|
+
this._appRef = this._injector.get(ApplicationRef);
|
|
2176
|
+
}
|
|
2177
|
+
return new DomPortalOutlet(pane, this._componentFactoryResolver, this._appRef, this._injector, this._document);
|
|
2178
|
+
}
|
|
2179
|
+
static {
|
|
2180
|
+
this.ɵfac = function Overlay_Factory(__ngFactoryType__) {
|
|
2181
|
+
return new (__ngFactoryType__ || _Overlay)(ɵɵinject(ScrollStrategyOptions), ɵɵinject(OverlayContainer), ɵɵinject(ComponentFactoryResolver$1), ɵɵinject(OverlayPositionBuilder), ɵɵinject(OverlayKeyboardDispatcher), ɵɵinject(Injector), ɵɵinject(NgZone), ɵɵinject(DOCUMENT), ɵɵinject(Directionality), ɵɵinject(Location), ɵɵinject(OverlayOutsideClickDispatcher), ɵɵinject(ANIMATION_MODULE_TYPE, 8));
|
|
2182
|
+
};
|
|
2183
|
+
}
|
|
2184
|
+
static {
|
|
2185
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
2186
|
+
token: _Overlay,
|
|
2187
|
+
factory: _Overlay.ɵfac,
|
|
2188
|
+
providedIn: "root"
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2191
|
+
};
|
|
2192
|
+
(() => {
|
|
2193
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Overlay, [{
|
|
2194
|
+
type: Injectable,
|
|
2195
|
+
args: [{
|
|
2196
|
+
providedIn: "root"
|
|
2197
|
+
}]
|
|
2198
|
+
}], () => [{
|
|
2199
|
+
type: ScrollStrategyOptions
|
|
2200
|
+
}, {
|
|
2201
|
+
type: OverlayContainer
|
|
2202
|
+
}, {
|
|
2203
|
+
type: ComponentFactoryResolver$1
|
|
2204
|
+
}, {
|
|
2205
|
+
type: OverlayPositionBuilder
|
|
2206
|
+
}, {
|
|
2207
|
+
type: OverlayKeyboardDispatcher
|
|
2208
|
+
}, {
|
|
2209
|
+
type: Injector
|
|
2210
|
+
}, {
|
|
2211
|
+
type: NgZone
|
|
2212
|
+
}, {
|
|
2213
|
+
type: void 0,
|
|
2214
|
+
decorators: [{
|
|
2215
|
+
type: Inject,
|
|
2216
|
+
args: [DOCUMENT]
|
|
2217
|
+
}]
|
|
2218
|
+
}, {
|
|
2219
|
+
type: Directionality
|
|
2220
|
+
}, {
|
|
2221
|
+
type: Location
|
|
2222
|
+
}, {
|
|
2223
|
+
type: OverlayOutsideClickDispatcher
|
|
2224
|
+
}, {
|
|
2225
|
+
type: void 0,
|
|
2226
|
+
decorators: [{
|
|
2227
|
+
type: Inject,
|
|
2228
|
+
args: [ANIMATION_MODULE_TYPE]
|
|
2229
|
+
}, {
|
|
2230
|
+
type: Optional
|
|
2231
|
+
}]
|
|
2232
|
+
}], null);
|
|
2233
|
+
})();
|
|
2234
|
+
var defaultPositionList = [{
|
|
2235
|
+
originX: "start",
|
|
2236
|
+
originY: "bottom",
|
|
2237
|
+
overlayX: "start",
|
|
2238
|
+
overlayY: "top"
|
|
2239
|
+
}, {
|
|
2240
|
+
originX: "start",
|
|
2241
|
+
originY: "top",
|
|
2242
|
+
overlayX: "start",
|
|
2243
|
+
overlayY: "bottom"
|
|
2244
|
+
}, {
|
|
2245
|
+
originX: "end",
|
|
2246
|
+
originY: "top",
|
|
2247
|
+
overlayX: "end",
|
|
2248
|
+
overlayY: "bottom"
|
|
2249
|
+
}, {
|
|
2250
|
+
originX: "end",
|
|
2251
|
+
originY: "bottom",
|
|
2252
|
+
overlayX: "end",
|
|
2253
|
+
overlayY: "top"
|
|
2254
|
+
}];
|
|
2255
|
+
var CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY = new InjectionToken("cdk-connected-overlay-scroll-strategy", {
|
|
2256
|
+
providedIn: "root",
|
|
2257
|
+
factory: () => {
|
|
2258
|
+
const overlay = inject(Overlay);
|
|
2259
|
+
return () => overlay.scrollStrategies.reposition();
|
|
2260
|
+
}
|
|
2261
|
+
});
|
|
2262
|
+
var CdkOverlayOrigin = class _CdkOverlayOrigin {
|
|
2263
|
+
constructor(elementRef) {
|
|
2264
|
+
this.elementRef = elementRef;
|
|
2265
|
+
}
|
|
2266
|
+
static {
|
|
2267
|
+
this.ɵfac = function CdkOverlayOrigin_Factory(__ngFactoryType__) {
|
|
2268
|
+
return new (__ngFactoryType__ || _CdkOverlayOrigin)(ɵɵdirectiveInject(ElementRef));
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
static {
|
|
2272
|
+
this.ɵdir = ɵɵdefineDirective({
|
|
2273
|
+
type: _CdkOverlayOrigin,
|
|
2274
|
+
selectors: [["", "cdk-overlay-origin", ""], ["", "overlay-origin", ""], ["", "cdkOverlayOrigin", ""]],
|
|
2275
|
+
exportAs: ["cdkOverlayOrigin"],
|
|
2276
|
+
standalone: true
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
};
|
|
2280
|
+
(() => {
|
|
2281
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkOverlayOrigin, [{
|
|
2282
|
+
type: Directive,
|
|
2283
|
+
args: [{
|
|
2284
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
2285
|
+
exportAs: "cdkOverlayOrigin",
|
|
2286
|
+
standalone: true
|
|
2287
|
+
}]
|
|
2288
|
+
}], () => [{
|
|
2289
|
+
type: ElementRef
|
|
2290
|
+
}], null);
|
|
2291
|
+
})();
|
|
2292
|
+
var CdkConnectedOverlay = class _CdkConnectedOverlay {
|
|
2293
|
+
/** The offset in pixels for the overlay connection point on the x-axis */
|
|
2294
|
+
get offsetX() {
|
|
2295
|
+
return this._offsetX;
|
|
2296
|
+
}
|
|
2297
|
+
set offsetX(offsetX) {
|
|
2298
|
+
this._offsetX = offsetX;
|
|
2299
|
+
if (this._position) {
|
|
2300
|
+
this._updatePositionStrategy(this._position);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
/** The offset in pixels for the overlay connection point on the y-axis */
|
|
2304
|
+
get offsetY() {
|
|
2305
|
+
return this._offsetY;
|
|
2306
|
+
}
|
|
2307
|
+
set offsetY(offsetY) {
|
|
2308
|
+
this._offsetY = offsetY;
|
|
2309
|
+
if (this._position) {
|
|
2310
|
+
this._updatePositionStrategy(this._position);
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
/** Whether the overlay should be disposed of when the user goes backwards/forwards in history. */
|
|
2314
|
+
get disposeOnNavigation() {
|
|
2315
|
+
return this._disposeOnNavigation;
|
|
2316
|
+
}
|
|
2317
|
+
set disposeOnNavigation(value) {
|
|
2318
|
+
this._disposeOnNavigation = value;
|
|
2319
|
+
}
|
|
2320
|
+
// TODO(jelbourn): inputs for size, scroll behavior, animation, etc.
|
|
2321
|
+
constructor(_overlay, templateRef, viewContainerRef, scrollStrategyFactory, _dir) {
|
|
2322
|
+
this._overlay = _overlay;
|
|
2323
|
+
this._dir = _dir;
|
|
2324
|
+
this._backdropSubscription = Subscription.EMPTY;
|
|
2325
|
+
this._attachSubscription = Subscription.EMPTY;
|
|
2326
|
+
this._detachSubscription = Subscription.EMPTY;
|
|
2327
|
+
this._positionSubscription = Subscription.EMPTY;
|
|
2328
|
+
this._disposeOnNavigation = false;
|
|
2329
|
+
this._ngZone = inject(NgZone);
|
|
2330
|
+
this.viewportMargin = 0;
|
|
2331
|
+
this.open = false;
|
|
2332
|
+
this.disableClose = false;
|
|
2333
|
+
this.hasBackdrop = false;
|
|
2334
|
+
this.lockPosition = false;
|
|
2335
|
+
this.flexibleDimensions = false;
|
|
2336
|
+
this.growAfterOpen = false;
|
|
2337
|
+
this.push = false;
|
|
2338
|
+
this.backdropClick = new EventEmitter();
|
|
2339
|
+
this.positionChange = new EventEmitter();
|
|
2340
|
+
this.attach = new EventEmitter();
|
|
2341
|
+
this.detach = new EventEmitter();
|
|
2342
|
+
this.overlayKeydown = new EventEmitter();
|
|
2343
|
+
this.overlayOutsideClick = new EventEmitter();
|
|
2344
|
+
this._templatePortal = new TemplatePortal(templateRef, viewContainerRef);
|
|
2345
|
+
this._scrollStrategyFactory = scrollStrategyFactory;
|
|
2346
|
+
this.scrollStrategy = this._scrollStrategyFactory();
|
|
2347
|
+
}
|
|
2348
|
+
/** The associated overlay reference. */
|
|
2349
|
+
get overlayRef() {
|
|
2350
|
+
return this._overlayRef;
|
|
2351
|
+
}
|
|
2352
|
+
/** The element's layout direction. */
|
|
2353
|
+
get dir() {
|
|
2354
|
+
return this._dir ? this._dir.value : "ltr";
|
|
2355
|
+
}
|
|
2356
|
+
ngOnDestroy() {
|
|
2357
|
+
this._attachSubscription.unsubscribe();
|
|
2358
|
+
this._detachSubscription.unsubscribe();
|
|
2359
|
+
this._backdropSubscription.unsubscribe();
|
|
2360
|
+
this._positionSubscription.unsubscribe();
|
|
2361
|
+
if (this._overlayRef) {
|
|
2362
|
+
this._overlayRef.dispose();
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
ngOnChanges(changes) {
|
|
2366
|
+
if (this._position) {
|
|
2367
|
+
this._updatePositionStrategy(this._position);
|
|
2368
|
+
this._overlayRef.updateSize({
|
|
2369
|
+
width: this.width,
|
|
2370
|
+
minWidth: this.minWidth,
|
|
2371
|
+
height: this.height,
|
|
2372
|
+
minHeight: this.minHeight
|
|
2373
|
+
});
|
|
2374
|
+
if (changes["origin"] && this.open) {
|
|
2375
|
+
this._position.apply();
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
if (changes["open"]) {
|
|
2379
|
+
this.open ? this._attachOverlay() : this._detachOverlay();
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
/** Creates an overlay */
|
|
2383
|
+
_createOverlay() {
|
|
2384
|
+
if (!this.positions || !this.positions.length) {
|
|
2385
|
+
this.positions = defaultPositionList;
|
|
2386
|
+
}
|
|
2387
|
+
const overlayRef = this._overlayRef = this._overlay.create(this._buildConfig());
|
|
2388
|
+
this._attachSubscription = overlayRef.attachments().subscribe(() => this.attach.emit());
|
|
2389
|
+
this._detachSubscription = overlayRef.detachments().subscribe(() => this.detach.emit());
|
|
2390
|
+
overlayRef.keydownEvents().subscribe((event) => {
|
|
2391
|
+
this.overlayKeydown.next(event);
|
|
2392
|
+
if (event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)) {
|
|
2393
|
+
event.preventDefault();
|
|
2394
|
+
this._detachOverlay();
|
|
2395
|
+
}
|
|
2396
|
+
});
|
|
2397
|
+
this._overlayRef.outsidePointerEvents().subscribe((event) => {
|
|
2398
|
+
const origin = this._getOriginElement();
|
|
2399
|
+
const target = _getEventTarget(event);
|
|
2400
|
+
if (!origin || origin !== target && !origin.contains(target)) {
|
|
2401
|
+
this.overlayOutsideClick.next(event);
|
|
2402
|
+
}
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
/** Builds the overlay config based on the directive's inputs */
|
|
2406
|
+
_buildConfig() {
|
|
2407
|
+
const positionStrategy = this._position = this.positionStrategy || this._createPositionStrategy();
|
|
2408
|
+
const overlayConfig = new OverlayConfig({
|
|
2409
|
+
direction: this._dir,
|
|
2410
|
+
positionStrategy,
|
|
2411
|
+
scrollStrategy: this.scrollStrategy,
|
|
2412
|
+
hasBackdrop: this.hasBackdrop,
|
|
2413
|
+
disposeOnNavigation: this.disposeOnNavigation
|
|
2414
|
+
});
|
|
2415
|
+
if (this.width || this.width === 0) {
|
|
2416
|
+
overlayConfig.width = this.width;
|
|
2417
|
+
}
|
|
2418
|
+
if (this.height || this.height === 0) {
|
|
2419
|
+
overlayConfig.height = this.height;
|
|
2420
|
+
}
|
|
2421
|
+
if (this.minWidth || this.minWidth === 0) {
|
|
2422
|
+
overlayConfig.minWidth = this.minWidth;
|
|
2423
|
+
}
|
|
2424
|
+
if (this.minHeight || this.minHeight === 0) {
|
|
2425
|
+
overlayConfig.minHeight = this.minHeight;
|
|
2426
|
+
}
|
|
2427
|
+
if (this.backdropClass) {
|
|
2428
|
+
overlayConfig.backdropClass = this.backdropClass;
|
|
2429
|
+
}
|
|
2430
|
+
if (this.panelClass) {
|
|
2431
|
+
overlayConfig.panelClass = this.panelClass;
|
|
2432
|
+
}
|
|
2433
|
+
return overlayConfig;
|
|
2434
|
+
}
|
|
2435
|
+
/** Updates the state of a position strategy, based on the values of the directive inputs. */
|
|
2436
|
+
_updatePositionStrategy(positionStrategy) {
|
|
2437
|
+
const positions = this.positions.map((currentPosition) => ({
|
|
2438
|
+
originX: currentPosition.originX,
|
|
2439
|
+
originY: currentPosition.originY,
|
|
2440
|
+
overlayX: currentPosition.overlayX,
|
|
2441
|
+
overlayY: currentPosition.overlayY,
|
|
2442
|
+
offsetX: currentPosition.offsetX || this.offsetX,
|
|
2443
|
+
offsetY: currentPosition.offsetY || this.offsetY,
|
|
2444
|
+
panelClass: currentPosition.panelClass || void 0
|
|
2445
|
+
}));
|
|
2446
|
+
return positionStrategy.setOrigin(this._getOrigin()).withPositions(positions).withFlexibleDimensions(this.flexibleDimensions).withPush(this.push).withGrowAfterOpen(this.growAfterOpen).withViewportMargin(this.viewportMargin).withLockedPosition(this.lockPosition).withTransformOriginOn(this.transformOriginSelector);
|
|
2447
|
+
}
|
|
2448
|
+
/** Returns the position strategy of the overlay to be set on the overlay config */
|
|
2449
|
+
_createPositionStrategy() {
|
|
2450
|
+
const strategy = this._overlay.position().flexibleConnectedTo(this._getOrigin());
|
|
2451
|
+
this._updatePositionStrategy(strategy);
|
|
2452
|
+
return strategy;
|
|
2453
|
+
}
|
|
2454
|
+
_getOrigin() {
|
|
2455
|
+
if (this.origin instanceof CdkOverlayOrigin) {
|
|
2456
|
+
return this.origin.elementRef;
|
|
2457
|
+
} else {
|
|
2458
|
+
return this.origin;
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
_getOriginElement() {
|
|
2462
|
+
if (this.origin instanceof CdkOverlayOrigin) {
|
|
2463
|
+
return this.origin.elementRef.nativeElement;
|
|
2464
|
+
}
|
|
2465
|
+
if (this.origin instanceof ElementRef) {
|
|
2466
|
+
return this.origin.nativeElement;
|
|
2467
|
+
}
|
|
2468
|
+
if (typeof Element !== "undefined" && this.origin instanceof Element) {
|
|
2469
|
+
return this.origin;
|
|
2470
|
+
}
|
|
2471
|
+
return null;
|
|
2472
|
+
}
|
|
2473
|
+
/** Attaches the overlay and subscribes to backdrop clicks if backdrop exists */
|
|
2474
|
+
_attachOverlay() {
|
|
2475
|
+
if (!this._overlayRef) {
|
|
2476
|
+
this._createOverlay();
|
|
2477
|
+
} else {
|
|
2478
|
+
this._overlayRef.getConfig().hasBackdrop = this.hasBackdrop;
|
|
2479
|
+
}
|
|
2480
|
+
if (!this._overlayRef.hasAttached()) {
|
|
2481
|
+
this._overlayRef.attach(this._templatePortal);
|
|
2482
|
+
}
|
|
2483
|
+
if (this.hasBackdrop) {
|
|
2484
|
+
this._backdropSubscription = this._overlayRef.backdropClick().subscribe((event) => {
|
|
2485
|
+
this.backdropClick.emit(event);
|
|
2486
|
+
});
|
|
2487
|
+
} else {
|
|
2488
|
+
this._backdropSubscription.unsubscribe();
|
|
2489
|
+
}
|
|
2490
|
+
this._positionSubscription.unsubscribe();
|
|
2491
|
+
if (this.positionChange.observers.length > 0) {
|
|
2492
|
+
this._positionSubscription = this._position.positionChanges.pipe(takeWhile(() => this.positionChange.observers.length > 0)).subscribe((position) => {
|
|
2493
|
+
this._ngZone.run(() => this.positionChange.emit(position));
|
|
2494
|
+
if (this.positionChange.observers.length === 0) {
|
|
2495
|
+
this._positionSubscription.unsubscribe();
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
/** Detaches the overlay and unsubscribes to backdrop clicks if backdrop exists */
|
|
2501
|
+
_detachOverlay() {
|
|
2502
|
+
if (this._overlayRef) {
|
|
2503
|
+
this._overlayRef.detach();
|
|
2504
|
+
}
|
|
2505
|
+
this._backdropSubscription.unsubscribe();
|
|
2506
|
+
this._positionSubscription.unsubscribe();
|
|
2507
|
+
}
|
|
2508
|
+
static {
|
|
2509
|
+
this.ɵfac = function CdkConnectedOverlay_Factory(__ngFactoryType__) {
|
|
2510
|
+
return new (__ngFactoryType__ || _CdkConnectedOverlay)(ɵɵdirectiveInject(Overlay), ɵɵdirectiveInject(TemplateRef), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY), ɵɵdirectiveInject(Directionality, 8));
|
|
2511
|
+
};
|
|
2512
|
+
}
|
|
2513
|
+
static {
|
|
2514
|
+
this.ɵdir = ɵɵdefineDirective({
|
|
2515
|
+
type: _CdkConnectedOverlay,
|
|
2516
|
+
selectors: [["", "cdk-connected-overlay", ""], ["", "connected-overlay", ""], ["", "cdkConnectedOverlay", ""]],
|
|
2517
|
+
inputs: {
|
|
2518
|
+
origin: [0, "cdkConnectedOverlayOrigin", "origin"],
|
|
2519
|
+
positions: [0, "cdkConnectedOverlayPositions", "positions"],
|
|
2520
|
+
positionStrategy: [0, "cdkConnectedOverlayPositionStrategy", "positionStrategy"],
|
|
2521
|
+
offsetX: [0, "cdkConnectedOverlayOffsetX", "offsetX"],
|
|
2522
|
+
offsetY: [0, "cdkConnectedOverlayOffsetY", "offsetY"],
|
|
2523
|
+
width: [0, "cdkConnectedOverlayWidth", "width"],
|
|
2524
|
+
height: [0, "cdkConnectedOverlayHeight", "height"],
|
|
2525
|
+
minWidth: [0, "cdkConnectedOverlayMinWidth", "minWidth"],
|
|
2526
|
+
minHeight: [0, "cdkConnectedOverlayMinHeight", "minHeight"],
|
|
2527
|
+
backdropClass: [0, "cdkConnectedOverlayBackdropClass", "backdropClass"],
|
|
2528
|
+
panelClass: [0, "cdkConnectedOverlayPanelClass", "panelClass"],
|
|
2529
|
+
viewportMargin: [0, "cdkConnectedOverlayViewportMargin", "viewportMargin"],
|
|
2530
|
+
scrollStrategy: [0, "cdkConnectedOverlayScrollStrategy", "scrollStrategy"],
|
|
2531
|
+
open: [0, "cdkConnectedOverlayOpen", "open"],
|
|
2532
|
+
disableClose: [0, "cdkConnectedOverlayDisableClose", "disableClose"],
|
|
2533
|
+
transformOriginSelector: [0, "cdkConnectedOverlayTransformOriginOn", "transformOriginSelector"],
|
|
2534
|
+
hasBackdrop: [2, "cdkConnectedOverlayHasBackdrop", "hasBackdrop", booleanAttribute],
|
|
2535
|
+
lockPosition: [2, "cdkConnectedOverlayLockPosition", "lockPosition", booleanAttribute],
|
|
2536
|
+
flexibleDimensions: [2, "cdkConnectedOverlayFlexibleDimensions", "flexibleDimensions", booleanAttribute],
|
|
2537
|
+
growAfterOpen: [2, "cdkConnectedOverlayGrowAfterOpen", "growAfterOpen", booleanAttribute],
|
|
2538
|
+
push: [2, "cdkConnectedOverlayPush", "push", booleanAttribute],
|
|
2539
|
+
disposeOnNavigation: [2, "cdkConnectedOverlayDisposeOnNavigation", "disposeOnNavigation", booleanAttribute]
|
|
2540
|
+
},
|
|
2541
|
+
outputs: {
|
|
2542
|
+
backdropClick: "backdropClick",
|
|
2543
|
+
positionChange: "positionChange",
|
|
2544
|
+
attach: "attach",
|
|
2545
|
+
detach: "detach",
|
|
2546
|
+
overlayKeydown: "overlayKeydown",
|
|
2547
|
+
overlayOutsideClick: "overlayOutsideClick"
|
|
2548
|
+
},
|
|
2549
|
+
exportAs: ["cdkConnectedOverlay"],
|
|
2550
|
+
standalone: true,
|
|
2551
|
+
features: [ɵɵInputTransformsFeature, ɵɵNgOnChangesFeature]
|
|
2552
|
+
});
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2555
|
+
(() => {
|
|
2556
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkConnectedOverlay, [{
|
|
2557
|
+
type: Directive,
|
|
2558
|
+
args: [{
|
|
2559
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
2560
|
+
exportAs: "cdkConnectedOverlay",
|
|
2561
|
+
standalone: true
|
|
2562
|
+
}]
|
|
2563
|
+
}], () => [{
|
|
2564
|
+
type: Overlay
|
|
2565
|
+
}, {
|
|
2566
|
+
type: TemplateRef
|
|
2567
|
+
}, {
|
|
2568
|
+
type: ViewContainerRef
|
|
2569
|
+
}, {
|
|
2570
|
+
type: void 0,
|
|
2571
|
+
decorators: [{
|
|
2572
|
+
type: Inject,
|
|
2573
|
+
args: [CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY]
|
|
2574
|
+
}]
|
|
2575
|
+
}, {
|
|
2576
|
+
type: Directionality,
|
|
2577
|
+
decorators: [{
|
|
2578
|
+
type: Optional
|
|
2579
|
+
}]
|
|
2580
|
+
}], {
|
|
2581
|
+
origin: [{
|
|
2582
|
+
type: Input,
|
|
2583
|
+
args: ["cdkConnectedOverlayOrigin"]
|
|
2584
|
+
}],
|
|
2585
|
+
positions: [{
|
|
2586
|
+
type: Input,
|
|
2587
|
+
args: ["cdkConnectedOverlayPositions"]
|
|
2588
|
+
}],
|
|
2589
|
+
positionStrategy: [{
|
|
2590
|
+
type: Input,
|
|
2591
|
+
args: ["cdkConnectedOverlayPositionStrategy"]
|
|
2592
|
+
}],
|
|
2593
|
+
offsetX: [{
|
|
2594
|
+
type: Input,
|
|
2595
|
+
args: ["cdkConnectedOverlayOffsetX"]
|
|
2596
|
+
}],
|
|
2597
|
+
offsetY: [{
|
|
2598
|
+
type: Input,
|
|
2599
|
+
args: ["cdkConnectedOverlayOffsetY"]
|
|
2600
|
+
}],
|
|
2601
|
+
width: [{
|
|
2602
|
+
type: Input,
|
|
2603
|
+
args: ["cdkConnectedOverlayWidth"]
|
|
2604
|
+
}],
|
|
2605
|
+
height: [{
|
|
2606
|
+
type: Input,
|
|
2607
|
+
args: ["cdkConnectedOverlayHeight"]
|
|
2608
|
+
}],
|
|
2609
|
+
minWidth: [{
|
|
2610
|
+
type: Input,
|
|
2611
|
+
args: ["cdkConnectedOverlayMinWidth"]
|
|
2612
|
+
}],
|
|
2613
|
+
minHeight: [{
|
|
2614
|
+
type: Input,
|
|
2615
|
+
args: ["cdkConnectedOverlayMinHeight"]
|
|
2616
|
+
}],
|
|
2617
|
+
backdropClass: [{
|
|
2618
|
+
type: Input,
|
|
2619
|
+
args: ["cdkConnectedOverlayBackdropClass"]
|
|
2620
|
+
}],
|
|
2621
|
+
panelClass: [{
|
|
2622
|
+
type: Input,
|
|
2623
|
+
args: ["cdkConnectedOverlayPanelClass"]
|
|
2624
|
+
}],
|
|
2625
|
+
viewportMargin: [{
|
|
2626
|
+
type: Input,
|
|
2627
|
+
args: ["cdkConnectedOverlayViewportMargin"]
|
|
2628
|
+
}],
|
|
2629
|
+
scrollStrategy: [{
|
|
2630
|
+
type: Input,
|
|
2631
|
+
args: ["cdkConnectedOverlayScrollStrategy"]
|
|
2632
|
+
}],
|
|
2633
|
+
open: [{
|
|
2634
|
+
type: Input,
|
|
2635
|
+
args: ["cdkConnectedOverlayOpen"]
|
|
2636
|
+
}],
|
|
2637
|
+
disableClose: [{
|
|
2638
|
+
type: Input,
|
|
2639
|
+
args: ["cdkConnectedOverlayDisableClose"]
|
|
2640
|
+
}],
|
|
2641
|
+
transformOriginSelector: [{
|
|
2642
|
+
type: Input,
|
|
2643
|
+
args: ["cdkConnectedOverlayTransformOriginOn"]
|
|
2644
|
+
}],
|
|
2645
|
+
hasBackdrop: [{
|
|
2646
|
+
type: Input,
|
|
2647
|
+
args: [{
|
|
2648
|
+
alias: "cdkConnectedOverlayHasBackdrop",
|
|
2649
|
+
transform: booleanAttribute
|
|
2650
|
+
}]
|
|
2651
|
+
}],
|
|
2652
|
+
lockPosition: [{
|
|
2653
|
+
type: Input,
|
|
2654
|
+
args: [{
|
|
2655
|
+
alias: "cdkConnectedOverlayLockPosition",
|
|
2656
|
+
transform: booleanAttribute
|
|
2657
|
+
}]
|
|
2658
|
+
}],
|
|
2659
|
+
flexibleDimensions: [{
|
|
2660
|
+
type: Input,
|
|
2661
|
+
args: [{
|
|
2662
|
+
alias: "cdkConnectedOverlayFlexibleDimensions",
|
|
2663
|
+
transform: booleanAttribute
|
|
2664
|
+
}]
|
|
2665
|
+
}],
|
|
2666
|
+
growAfterOpen: [{
|
|
2667
|
+
type: Input,
|
|
2668
|
+
args: [{
|
|
2669
|
+
alias: "cdkConnectedOverlayGrowAfterOpen",
|
|
2670
|
+
transform: booleanAttribute
|
|
2671
|
+
}]
|
|
2672
|
+
}],
|
|
2673
|
+
push: [{
|
|
2674
|
+
type: Input,
|
|
2675
|
+
args: [{
|
|
2676
|
+
alias: "cdkConnectedOverlayPush",
|
|
2677
|
+
transform: booleanAttribute
|
|
2678
|
+
}]
|
|
2679
|
+
}],
|
|
2680
|
+
disposeOnNavigation: [{
|
|
2681
|
+
type: Input,
|
|
2682
|
+
args: [{
|
|
2683
|
+
alias: "cdkConnectedOverlayDisposeOnNavigation",
|
|
2684
|
+
transform: booleanAttribute
|
|
2685
|
+
}]
|
|
2686
|
+
}],
|
|
2687
|
+
backdropClick: [{
|
|
2688
|
+
type: Output
|
|
2689
|
+
}],
|
|
2690
|
+
positionChange: [{
|
|
2691
|
+
type: Output
|
|
2692
|
+
}],
|
|
2693
|
+
attach: [{
|
|
2694
|
+
type: Output
|
|
2695
|
+
}],
|
|
2696
|
+
detach: [{
|
|
2697
|
+
type: Output
|
|
2698
|
+
}],
|
|
2699
|
+
overlayKeydown: [{
|
|
2700
|
+
type: Output
|
|
2701
|
+
}],
|
|
2702
|
+
overlayOutsideClick: [{
|
|
2703
|
+
type: Output
|
|
2704
|
+
}]
|
|
2705
|
+
});
|
|
2706
|
+
})();
|
|
2707
|
+
function CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
|
|
2708
|
+
return () => overlay.scrollStrategies.reposition();
|
|
2709
|
+
}
|
|
2710
|
+
var CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER = {
|
|
2711
|
+
provide: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY,
|
|
2712
|
+
deps: [Overlay],
|
|
2713
|
+
useFactory: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY
|
|
2714
|
+
};
|
|
2715
|
+
var OverlayModule = class _OverlayModule {
|
|
2716
|
+
static {
|
|
2717
|
+
this.ɵfac = function OverlayModule_Factory(__ngFactoryType__) {
|
|
2718
|
+
return new (__ngFactoryType__ || _OverlayModule)();
|
|
2719
|
+
};
|
|
2720
|
+
}
|
|
2721
|
+
static {
|
|
2722
|
+
this.ɵmod = ɵɵdefineNgModule({
|
|
2723
|
+
type: _OverlayModule,
|
|
2724
|
+
imports: [BidiModule, PortalModule, ScrollingModule, CdkConnectedOverlay, CdkOverlayOrigin],
|
|
2725
|
+
exports: [CdkConnectedOverlay, CdkOverlayOrigin, ScrollingModule]
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2728
|
+
static {
|
|
2729
|
+
this.ɵinj = ɵɵdefineInjector({
|
|
2730
|
+
providers: [Overlay, CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER],
|
|
2731
|
+
imports: [BidiModule, PortalModule, ScrollingModule, ScrollingModule]
|
|
2732
|
+
});
|
|
2733
|
+
}
|
|
2734
|
+
};
|
|
2735
|
+
(() => {
|
|
2736
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(OverlayModule, [{
|
|
2737
|
+
type: NgModule,
|
|
2738
|
+
args: [{
|
|
2739
|
+
imports: [BidiModule, PortalModule, ScrollingModule, CdkConnectedOverlay, CdkOverlayOrigin],
|
|
2740
|
+
exports: [CdkConnectedOverlay, CdkOverlayOrigin, ScrollingModule],
|
|
2741
|
+
providers: [Overlay, CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER]
|
|
2742
|
+
}]
|
|
2743
|
+
}], null, null);
|
|
2744
|
+
})();
|
|
2745
|
+
var FullscreenOverlayContainer = class _FullscreenOverlayContainer extends OverlayContainer {
|
|
2746
|
+
constructor(_document, platform) {
|
|
2747
|
+
super(_document, platform);
|
|
2748
|
+
}
|
|
2749
|
+
ngOnDestroy() {
|
|
2750
|
+
super.ngOnDestroy();
|
|
2751
|
+
if (this._fullScreenEventName && this._fullScreenListener) {
|
|
2752
|
+
this._document.removeEventListener(this._fullScreenEventName, this._fullScreenListener);
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
_createContainer() {
|
|
2756
|
+
super._createContainer();
|
|
2757
|
+
this._adjustParentForFullscreenChange();
|
|
2758
|
+
this._addFullscreenChangeListener(() => this._adjustParentForFullscreenChange());
|
|
2759
|
+
}
|
|
2760
|
+
_adjustParentForFullscreenChange() {
|
|
2761
|
+
if (!this._containerElement) {
|
|
2762
|
+
return;
|
|
2763
|
+
}
|
|
2764
|
+
const fullscreenElement = this.getFullscreenElement();
|
|
2765
|
+
const parent = fullscreenElement || this._document.body;
|
|
2766
|
+
parent.appendChild(this._containerElement);
|
|
2767
|
+
}
|
|
2768
|
+
_addFullscreenChangeListener(fn) {
|
|
2769
|
+
const eventName = this._getEventName();
|
|
2770
|
+
if (eventName) {
|
|
2771
|
+
if (this._fullScreenListener) {
|
|
2772
|
+
this._document.removeEventListener(eventName, this._fullScreenListener);
|
|
2773
|
+
}
|
|
2774
|
+
this._document.addEventListener(eventName, fn);
|
|
2775
|
+
this._fullScreenListener = fn;
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
_getEventName() {
|
|
2779
|
+
if (!this._fullScreenEventName) {
|
|
2780
|
+
const _document = this._document;
|
|
2781
|
+
if (_document.fullscreenEnabled) {
|
|
2782
|
+
this._fullScreenEventName = "fullscreenchange";
|
|
2783
|
+
} else if (_document.webkitFullscreenEnabled) {
|
|
2784
|
+
this._fullScreenEventName = "webkitfullscreenchange";
|
|
2785
|
+
} else if (_document.mozFullScreenEnabled) {
|
|
2786
|
+
this._fullScreenEventName = "mozfullscreenchange";
|
|
2787
|
+
} else if (_document.msFullscreenEnabled) {
|
|
2788
|
+
this._fullScreenEventName = "MSFullscreenChange";
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
return this._fullScreenEventName;
|
|
2792
|
+
}
|
|
2793
|
+
/**
|
|
2794
|
+
* When the page is put into fullscreen mode, a specific element is specified.
|
|
2795
|
+
* Only that element and its children are visible when in fullscreen mode.
|
|
2796
|
+
*/
|
|
2797
|
+
getFullscreenElement() {
|
|
2798
|
+
const _document = this._document;
|
|
2799
|
+
return _document.fullscreenElement || _document.webkitFullscreenElement || _document.mozFullScreenElement || _document.msFullscreenElement || null;
|
|
2800
|
+
}
|
|
2801
|
+
static {
|
|
2802
|
+
this.ɵfac = function FullscreenOverlayContainer_Factory(__ngFactoryType__) {
|
|
2803
|
+
return new (__ngFactoryType__ || _FullscreenOverlayContainer)(ɵɵinject(DOCUMENT), ɵɵinject(Platform));
|
|
2804
|
+
};
|
|
2805
|
+
}
|
|
2806
|
+
static {
|
|
2807
|
+
this.ɵprov = ɵɵdefineInjectable({
|
|
2808
|
+
token: _FullscreenOverlayContainer,
|
|
2809
|
+
factory: _FullscreenOverlayContainer.ɵfac,
|
|
2810
|
+
providedIn: "root"
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
2814
|
+
(() => {
|
|
2815
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FullscreenOverlayContainer, [{
|
|
2816
|
+
type: Injectable,
|
|
2817
|
+
args: [{
|
|
2818
|
+
providedIn: "root"
|
|
2819
|
+
}]
|
|
2820
|
+
}], () => [{
|
|
2821
|
+
type: void 0,
|
|
2822
|
+
decorators: [{
|
|
2823
|
+
type: Inject,
|
|
2824
|
+
args: [DOCUMENT]
|
|
2825
|
+
}]
|
|
2826
|
+
}, {
|
|
2827
|
+
type: Platform
|
|
2828
|
+
}], null);
|
|
2829
|
+
})();
|
|
2830
|
+
|
|
2831
|
+
export {
|
|
2832
|
+
OverlayConfig,
|
|
2833
|
+
OverlayContainer,
|
|
2834
|
+
OverlayRef,
|
|
2835
|
+
Overlay,
|
|
2836
|
+
CdkOverlayOrigin,
|
|
2837
|
+
CdkConnectedOverlay,
|
|
2838
|
+
OverlayModule
|
|
2839
|
+
};
|
|
2840
|
+
//# sourceMappingURL=chunk-TO3SXVFJ.js.map
|