@skyux/flyout 7.0.0-beta.2 → 7.0.0-beta.4
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/documentation.json +162 -175
- package/esm2020/lib/modules/flyout/flyout-adapter.service.mjs +19 -11
- package/esm2020/lib/modules/flyout/flyout-instance.mjs +22 -18
- package/esm2020/lib/modules/flyout/flyout-iterator.component.mjs +13 -12
- package/esm2020/lib/modules/flyout/flyout-media-query.service.mjs +11 -12
- package/esm2020/lib/modules/flyout/flyout.component.mjs +267 -249
- package/esm2020/lib/modules/flyout/flyout.service.mjs +110 -115
- package/esm2020/lib/modules/flyout/types/flyout-config-internal.mjs +2 -0
- package/fesm2015/skyux-flyout.mjs +436 -415
- package/fesm2015/skyux-flyout.mjs.map +1 -1
- package/fesm2020/skyux-flyout.mjs +432 -412
- package/fesm2020/skyux-flyout.mjs.map +1 -1
- package/lib/modules/flyout/flyout-adapter.service.d.ts +2 -4
- package/lib/modules/flyout/flyout-instance.d.ts +2 -7
- package/lib/modules/flyout/flyout-iterator.component.d.ts +3 -5
- package/lib/modules/flyout/flyout-media-query.service.d.ts +2 -3
- package/lib/modules/flyout/flyout.component.d.ts +13 -39
- package/lib/modules/flyout/flyout.service.d.ts +4 -17
- package/lib/modules/flyout/types/flyout-config-internal.d.ts +26 -0
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, NgModule, Component, Input, Output, Injectable, Injector, ElementRef, ViewContainerRef, ChangeDetectionStrategy, ViewChild, HostListener
|
|
3
|
-
import { Subject,
|
|
3
|
+
import { EventEmitter, NgModule, Component, Input, Output, Injectable, Injector, ElementRef, ViewContainerRef, ChangeDetectionStrategy, ViewChild, HostListener } from '@angular/core';
|
|
4
|
+
import { Subject, ReplaySubject, fromEvent } from 'rxjs';
|
|
4
5
|
import * as i5 from '@angular/cdk/a11y';
|
|
5
6
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
6
7
|
import * as i6 from '@angular/common';
|
|
@@ -34,11 +35,12 @@ var SkyFlyoutMessageType;
|
|
|
34
35
|
SkyFlyoutMessageType[SkyFlyoutMessageType["DisableIteratorPreviousButton"] = 5] = "DisableIteratorPreviousButton";
|
|
35
36
|
})(SkyFlyoutMessageType || (SkyFlyoutMessageType = {}));
|
|
36
37
|
|
|
38
|
+
var _SkyFlyoutInstance__beforeClose, _SkyFlyoutInstance__iteratorNextButtonClick, _SkyFlyoutInstance__iteratorPreviousButtonClick, _SkyFlyoutInstance__iteratorNextButtonDisabled, _SkyFlyoutInstance__iteratorPreviousButtonDisabled, _SkyFlyoutInstance__hostController;
|
|
37
39
|
/**
|
|
38
40
|
* Represents a single displayed flyout.
|
|
39
41
|
*/
|
|
40
42
|
class SkyFlyoutInstance {
|
|
41
|
-
constructor() {
|
|
43
|
+
constructor(componentInstance) {
|
|
42
44
|
/**
|
|
43
45
|
* An event that the flyout instance emits when it closes.
|
|
44
46
|
*/
|
|
@@ -48,12 +50,13 @@ class SkyFlyoutInstance {
|
|
|
48
50
|
* @default true
|
|
49
51
|
*/
|
|
50
52
|
this.isOpen = true;
|
|
51
|
-
this
|
|
52
|
-
this
|
|
53
|
-
this
|
|
54
|
-
this
|
|
55
|
-
this
|
|
56
|
-
this
|
|
53
|
+
_SkyFlyoutInstance__beforeClose.set(this, new Subject());
|
|
54
|
+
_SkyFlyoutInstance__iteratorNextButtonClick.set(this, new EventEmitter());
|
|
55
|
+
_SkyFlyoutInstance__iteratorPreviousButtonClick.set(this, new EventEmitter());
|
|
56
|
+
_SkyFlyoutInstance__iteratorNextButtonDisabled.set(this, false);
|
|
57
|
+
_SkyFlyoutInstance__iteratorPreviousButtonDisabled.set(this, false);
|
|
58
|
+
_SkyFlyoutInstance__hostController.set(this, new Subject());
|
|
59
|
+
this.componentInstance = componentInstance;
|
|
57
60
|
this.closed.subscribe(() => {
|
|
58
61
|
this.isOpen = false;
|
|
59
62
|
});
|
|
@@ -64,33 +67,33 @@ class SkyFlyoutInstance {
|
|
|
64
67
|
* the modal does not close until the subscriber calls the handler's `closeModal` method.
|
|
65
68
|
*/
|
|
66
69
|
get beforeClose() {
|
|
67
|
-
return this
|
|
70
|
+
return __classPrivateFieldGet(this, _SkyFlyoutInstance__beforeClose, "f");
|
|
68
71
|
}
|
|
69
72
|
/**
|
|
70
73
|
* Used to communicate with the host component.
|
|
71
74
|
* @internal
|
|
72
75
|
*/
|
|
73
76
|
get hostController() {
|
|
74
|
-
return this
|
|
77
|
+
return __classPrivateFieldGet(this, _SkyFlyoutInstance__hostController, "f");
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
77
80
|
* An event that the flyout instance emits when users click the next iterator button.
|
|
78
81
|
*/
|
|
79
82
|
get iteratorNextButtonClick() {
|
|
80
|
-
return this
|
|
83
|
+
return __classPrivateFieldGet(this, _SkyFlyoutInstance__iteratorNextButtonClick, "f");
|
|
81
84
|
}
|
|
82
85
|
/**
|
|
83
86
|
* An event that the flyout instance emits when users click the previous iterator button.
|
|
84
87
|
*/
|
|
85
88
|
get iteratorPreviousButtonClick() {
|
|
86
|
-
return this
|
|
89
|
+
return __classPrivateFieldGet(this, _SkyFlyoutInstance__iteratorPreviousButtonClick, "f");
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
89
92
|
* Disables the next iterator button.
|
|
90
93
|
* @default false
|
|
91
94
|
*/
|
|
92
95
|
set iteratorNextButtonDisabled(newValue) {
|
|
93
|
-
this
|
|
96
|
+
__classPrivateFieldSet(this, _SkyFlyoutInstance__iteratorNextButtonDisabled, newValue, "f");
|
|
94
97
|
if (newValue) {
|
|
95
98
|
this.hostController.next({
|
|
96
99
|
type: SkyFlyoutMessageType.DisableIteratorNextButton,
|
|
@@ -103,14 +106,14 @@ class SkyFlyoutInstance {
|
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
get iteratorNextButtonDisabled() {
|
|
106
|
-
return this
|
|
109
|
+
return __classPrivateFieldGet(this, _SkyFlyoutInstance__iteratorNextButtonDisabled, "f");
|
|
107
110
|
}
|
|
108
111
|
/**
|
|
109
112
|
* Disables the previous iterator button.
|
|
110
113
|
* @default false
|
|
111
114
|
*/
|
|
112
115
|
set iteratorPreviousButtonDisabled(newValue) {
|
|
113
|
-
this
|
|
116
|
+
__classPrivateFieldSet(this, _SkyFlyoutInstance__iteratorPreviousButtonDisabled, newValue, "f");
|
|
114
117
|
if (newValue) {
|
|
115
118
|
this.hostController.next({
|
|
116
119
|
type: SkyFlyoutMessageType.DisableIteratorPreviousButton,
|
|
@@ -123,7 +126,7 @@ class SkyFlyoutInstance {
|
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
128
|
get iteratorPreviousButtonDisabled() {
|
|
126
|
-
return this
|
|
129
|
+
return __classPrivateFieldGet(this, _SkyFlyoutInstance__iteratorPreviousButtonDisabled, "f");
|
|
127
130
|
}
|
|
128
131
|
/**
|
|
129
132
|
* Closes the flyout instance and emits its `closed` event.
|
|
@@ -134,11 +137,12 @@ class SkyFlyoutInstance {
|
|
|
134
137
|
type: SkyFlyoutMessageType.Close,
|
|
135
138
|
data: { ignoreBeforeClose: args ? args.ignoreBeforeClose : false },
|
|
136
139
|
});
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
140
|
+
__classPrivateFieldGet(this, _SkyFlyoutInstance__iteratorPreviousButtonClick, "f").complete();
|
|
141
|
+
__classPrivateFieldGet(this, _SkyFlyoutInstance__iteratorNextButtonClick, "f").complete();
|
|
139
142
|
this.hostController.complete();
|
|
140
143
|
}
|
|
141
144
|
}
|
|
145
|
+
_SkyFlyoutInstance__beforeClose = new WeakMap(), _SkyFlyoutInstance__iteratorNextButtonClick = new WeakMap(), _SkyFlyoutInstance__iteratorPreviousButtonClick = new WeakMap(), _SkyFlyoutInstance__iteratorNextButtonDisabled = new WeakMap(), _SkyFlyoutInstance__iteratorPreviousButtonDisabled = new WeakMap(), _SkyFlyoutInstance__hostController = new WeakMap();
|
|
142
146
|
|
|
143
147
|
/**
|
|
144
148
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
@@ -191,40 +195,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
191
195
|
}]
|
|
192
196
|
}] });
|
|
193
197
|
|
|
198
|
+
var _SkyFlyoutIteratorComponent_ngUnsubscribe, _SkyFlyoutIteratorComponent__nextButtonClick, _SkyFlyoutIteratorComponent__previousButtonClick;
|
|
194
199
|
/**
|
|
195
200
|
* @internal
|
|
196
201
|
*/
|
|
197
202
|
class SkyFlyoutIteratorComponent {
|
|
198
203
|
constructor() {
|
|
199
|
-
this
|
|
200
|
-
this
|
|
201
|
-
this
|
|
204
|
+
_SkyFlyoutIteratorComponent_ngUnsubscribe.set(this, new Subject());
|
|
205
|
+
_SkyFlyoutIteratorComponent__nextButtonClick.set(this, new EventEmitter());
|
|
206
|
+
_SkyFlyoutIteratorComponent__previousButtonClick.set(this, new EventEmitter());
|
|
202
207
|
}
|
|
203
208
|
get previousButtonClick() {
|
|
204
|
-
return this
|
|
209
|
+
return __classPrivateFieldGet(this, _SkyFlyoutIteratorComponent__previousButtonClick, "f");
|
|
205
210
|
}
|
|
206
211
|
get nextButtonClick() {
|
|
207
|
-
return this
|
|
212
|
+
return __classPrivateFieldGet(this, _SkyFlyoutIteratorComponent__nextButtonClick, "f");
|
|
208
213
|
}
|
|
209
214
|
ngOnDestroy() {
|
|
210
|
-
this.
|
|
211
|
-
this.
|
|
212
|
-
this._previousButtonClick.complete();
|
|
213
|
-
this._nextButtonClick.complete();
|
|
215
|
+
__classPrivateFieldGet(this, _SkyFlyoutIteratorComponent_ngUnsubscribe, "f").next();
|
|
216
|
+
__classPrivateFieldGet(this, _SkyFlyoutIteratorComponent_ngUnsubscribe, "f").complete();
|
|
214
217
|
}
|
|
215
218
|
onIteratorPreviousClick() {
|
|
216
219
|
/* istanbul ignore else */
|
|
217
220
|
if (!this.previousButtonDisabled) {
|
|
218
|
-
this.
|
|
221
|
+
__classPrivateFieldGet(this, _SkyFlyoutIteratorComponent__previousButtonClick, "f").emit();
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
224
|
onIteratorNextClick() {
|
|
222
225
|
/* istanbul ignore else */
|
|
223
226
|
if (!this.nextButtonDisabled) {
|
|
224
|
-
this.
|
|
227
|
+
__classPrivateFieldGet(this, _SkyFlyoutIteratorComponent__nextButtonClick, "f").emit();
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
}
|
|
231
|
+
_SkyFlyoutIteratorComponent_ngUnsubscribe = new WeakMap(), _SkyFlyoutIteratorComponent__nextButtonClick = new WeakMap(), _SkyFlyoutIteratorComponent__previousButtonClick = new WeakMap();
|
|
228
232
|
SkyFlyoutIteratorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutIteratorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
229
233
|
SkyFlyoutIteratorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyFlyoutIteratorComponent, selector: "sky-flyout-iterator", inputs: { nextButtonDisabled: "nextButtonDisabled", previousButtonDisabled: "previousButtonDisabled" }, outputs: { previousButtonClick: "previousButtonClick", nextButtonClick: "nextButtonClick" }, ngImport: i0, template: "<div id=\"iterators\" class=\"sky-flyout-iterators\">\n <button\n class=\"sky-btn\"\n [attr.aria-label]=\"\n 'skyux_flyout_iterator_previous_button' | skyLibResources\n \"\n [disabled]=\"previousButtonDisabled\"\n [skyThemeClass]=\"{\n 'sky-btn-default sky-margin-inline-compact': 'default',\n 'sky-btn-icon-borderless sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onIteratorPreviousClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-up\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"chevron-up\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n <button\n class=\"sky-btn\"\n [attr.aria-label]=\"'skyux_flyout_iterator_next_button' | skyLibResources\"\n [disabled]=\"nextButtonDisabled\"\n [skyThemeClass]=\"{\n 'sky-btn-default sky-margin-inline-compact': 'default',\n 'sky-btn-icon-borderless sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onIteratorNextClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-down\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"chevron-down\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n</div>\n", styles: [":host-context(.sky-theme-modern) .sky-flyout-iterators{display:inline}.sky-theme-modern .sky-flyout-iterators{display:inline}\n"], dependencies: [{ kind: "component", type: i1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i2.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { kind: "directive", type: i2.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "pipe", type: i2$1.SkyLibResourcesPipe, name: "skyLibResources" }] });
|
|
230
234
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutIteratorComponent, decorators: [{
|
|
@@ -240,28 +244,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
240
244
|
type: Output
|
|
241
245
|
}] } });
|
|
242
246
|
|
|
247
|
+
var _SkyFlyoutAdapterService_renderer, _SkyFlyoutAdapterService_windowRef;
|
|
243
248
|
/**
|
|
244
249
|
* @internal
|
|
245
250
|
*/
|
|
246
251
|
class SkyFlyoutAdapterService {
|
|
247
252
|
constructor(rendererFactory, windowRef) {
|
|
248
|
-
this
|
|
249
|
-
this
|
|
250
|
-
this
|
|
253
|
+
_SkyFlyoutAdapterService_renderer.set(this, void 0);
|
|
254
|
+
_SkyFlyoutAdapterService_windowRef.set(this, void 0);
|
|
255
|
+
__classPrivateFieldSet(this, _SkyFlyoutAdapterService_windowRef, windowRef, "f");
|
|
256
|
+
__classPrivateFieldSet(this, _SkyFlyoutAdapterService_renderer, rendererFactory.createRenderer(undefined, null), "f");
|
|
251
257
|
}
|
|
252
258
|
adjustHeaderForHelp(header) {
|
|
253
|
-
const windowObj = this.
|
|
259
|
+
const windowObj = __classPrivateFieldGet(this, _SkyFlyoutAdapterService_windowRef, "f").nativeWindow;
|
|
254
260
|
const helpWidget = windowObj.document.getElementById('bb-help-invoker');
|
|
255
261
|
if (helpWidget) {
|
|
256
|
-
this.
|
|
262
|
+
__classPrivateFieldGet(this, _SkyFlyoutAdapterService_renderer, "f").addClass(header.nativeElement, 'sky-flyout-help-shim');
|
|
257
263
|
}
|
|
258
264
|
}
|
|
259
265
|
setResponsiveClass(element, breakpoint) {
|
|
266
|
+
/* istanbul ignore if */
|
|
267
|
+
if (!breakpoint) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
260
270
|
const nativeEl = element.nativeElement;
|
|
261
|
-
this.
|
|
262
|
-
this.
|
|
263
|
-
this.
|
|
264
|
-
this.
|
|
271
|
+
__classPrivateFieldGet(this, _SkyFlyoutAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-xs');
|
|
272
|
+
__classPrivateFieldGet(this, _SkyFlyoutAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-sm');
|
|
273
|
+
__classPrivateFieldGet(this, _SkyFlyoutAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-md');
|
|
274
|
+
__classPrivateFieldGet(this, _SkyFlyoutAdapterService_renderer, "f").removeClass(nativeEl, 'sky-responsive-container-lg');
|
|
265
275
|
let newClass;
|
|
266
276
|
switch (breakpoint) {
|
|
267
277
|
case SkyMediaBreakpoints.xs: {
|
|
@@ -281,7 +291,7 @@ class SkyFlyoutAdapterService {
|
|
|
281
291
|
break;
|
|
282
292
|
}
|
|
283
293
|
}
|
|
284
|
-
this.
|
|
294
|
+
__classPrivateFieldGet(this, _SkyFlyoutAdapterService_renderer, "f").addClass(nativeEl, newClass);
|
|
285
295
|
}
|
|
286
296
|
toggleIframePointerEvents(enable) {
|
|
287
297
|
// When iframes are present on the page, they may interfere with dragging
|
|
@@ -294,26 +304,24 @@ class SkyFlyoutAdapterService {
|
|
|
294
304
|
}
|
|
295
305
|
}
|
|
296
306
|
}
|
|
307
|
+
_SkyFlyoutAdapterService_renderer = new WeakMap(), _SkyFlyoutAdapterService_windowRef = new WeakMap();
|
|
297
308
|
SkyFlyoutAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutAdapterService, deps: [{ token: i0.RendererFactory2 }, { token: i1$1.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
298
309
|
SkyFlyoutAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutAdapterService });
|
|
299
310
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutAdapterService, decorators: [{
|
|
300
311
|
type: Injectable
|
|
301
312
|
}], ctorParameters: function () { return [{ type: i0.RendererFactory2 }, { type: i1$1.SkyAppWindowRef }]; } });
|
|
302
313
|
|
|
314
|
+
var _SkyFlyoutMediaQueryService_currentSubject;
|
|
303
315
|
/**
|
|
304
316
|
* @internal
|
|
305
317
|
*/
|
|
306
318
|
class SkyFlyoutMediaQueryService {
|
|
307
319
|
constructor() {
|
|
308
|
-
this
|
|
309
|
-
this
|
|
310
|
-
this.currentSubject.next(this._current);
|
|
311
|
-
}
|
|
312
|
-
get current() {
|
|
313
|
-
return this._current;
|
|
320
|
+
_SkyFlyoutMediaQueryService_currentSubject.set(this, void 0);
|
|
321
|
+
__classPrivateFieldSet(this, _SkyFlyoutMediaQueryService_currentSubject, new ReplaySubject(1), "f");
|
|
314
322
|
}
|
|
315
323
|
subscribe(listener) {
|
|
316
|
-
return this.
|
|
324
|
+
return __classPrivateFieldGet(this, _SkyFlyoutMediaQueryService_currentSubject, "f").subscribe({
|
|
317
325
|
next: (breakpoints) => {
|
|
318
326
|
listener(breakpoints);
|
|
319
327
|
},
|
|
@@ -333,8 +341,8 @@ class SkyFlyoutMediaQueryService {
|
|
|
333
341
|
else {
|
|
334
342
|
breakpoint = SkyMediaBreakpoints.lg;
|
|
335
343
|
}
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
344
|
+
this.current = breakpoint;
|
|
345
|
+
__classPrivateFieldGet(this, _SkyFlyoutMediaQueryService_currentSubject, "f").next(this.current);
|
|
338
346
|
}
|
|
339
347
|
isWidthWithinBreakpiont(width, breakpoint) {
|
|
340
348
|
const xsBreakpointMaxPixels = 767;
|
|
@@ -359,9 +367,10 @@ class SkyFlyoutMediaQueryService {
|
|
|
359
367
|
}
|
|
360
368
|
}
|
|
361
369
|
destroy() {
|
|
362
|
-
this.
|
|
370
|
+
__classPrivateFieldGet(this, _SkyFlyoutMediaQueryService_currentSubject, "f").complete();
|
|
363
371
|
}
|
|
364
372
|
}
|
|
373
|
+
_SkyFlyoutMediaQueryService_currentSubject = new WeakMap();
|
|
365
374
|
SkyFlyoutMediaQueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutMediaQueryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
366
375
|
SkyFlyoutMediaQueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutMediaQueryService });
|
|
367
376
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutMediaQueryService, decorators: [{
|
|
@@ -377,6 +386,7 @@ class SkyFlyoutBeforeCloseHandler {
|
|
|
377
386
|
}
|
|
378
387
|
}
|
|
379
388
|
|
|
389
|
+
var _SkyFlyoutComponent_instances, _SkyFlyoutComponent_xCoord, _SkyFlyoutComponent_windowBufferSize, _SkyFlyoutComponent_flyoutInstance, _SkyFlyoutComponent_ngUnsubscribe, _SkyFlyoutComponent__messageStream, _SkyFlyoutComponent_adapter, _SkyFlyoutComponent_changeDetector, _SkyFlyoutComponent_injector, _SkyFlyoutComponent_resolver, _SkyFlyoutComponent_resourcesService, _SkyFlyoutComponent_flyoutMediaQueryService, _SkyFlyoutComponent_elementRef, _SkyFlyoutComponent_uiConfigService, _SkyFlyoutComponent_ngZone, _SkyFlyoutComponent_createFlyoutInstance, _SkyFlyoutComponent_handleIncomingMessages, _SkyFlyoutComponent_notifyClosed, _SkyFlyoutComponent_cleanTemplate, _SkyFlyoutComponent_updateBreakpointAndResponsiveClass, _SkyFlyoutComponent_setFullscreen, _SkyFlyoutComponent_setUserData, _SkyFlyoutComponent_checkInitialSize, _SkyFlyoutComponent_getString, _SkyFlyoutComponent_handleResizeKeyDown, _SkyFlyoutComponent_executeOnStable, _SkyFlyoutComponent_initFocusTrap;
|
|
380
390
|
const FLYOUT_OPEN_STATE = 'flyoutOpen';
|
|
381
391
|
const FLYOUT_CLOSED_STATE = 'flyoutClosed';
|
|
382
392
|
let nextId = 0;
|
|
@@ -384,16 +394,16 @@ let nextId = 0;
|
|
|
384
394
|
* @internal
|
|
385
395
|
*/
|
|
386
396
|
class SkyFlyoutComponent {
|
|
387
|
-
constructor(adapter, changeDetector, injector, resolver, resourcesService, flyoutMediaQueryService, elementRef, uiConfigService,
|
|
388
|
-
this
|
|
389
|
-
this.
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
this.
|
|
396
|
-
this.
|
|
397
|
+
constructor(adapter, changeDetector, injector, resolver, resourcesService, flyoutMediaQueryService, elementRef, uiConfigService, ngZone) {
|
|
398
|
+
_SkyFlyoutComponent_instances.add(this);
|
|
399
|
+
this.config = {
|
|
400
|
+
defaultWidth: window.innerWidth / 2,
|
|
401
|
+
minWidth: 320,
|
|
402
|
+
maxWidth: window.innerWidth / 2,
|
|
403
|
+
providers: [],
|
|
404
|
+
};
|
|
405
|
+
this.enableTrapFocus = false;
|
|
406
|
+
this.enableTrapFocusAutoCapture = false;
|
|
397
407
|
this.flyoutId = `sky-flyout-${++nextId}`;
|
|
398
408
|
this.flyoutState = FLYOUT_CLOSED_STATE;
|
|
399
409
|
this.isOpen = false;
|
|
@@ -403,104 +413,123 @@ class SkyFlyoutComponent {
|
|
|
403
413
|
this.isDragging = false;
|
|
404
414
|
this.isFullscreen = false;
|
|
405
415
|
this.resizeKeyControlActive = false;
|
|
406
|
-
this
|
|
407
|
-
this
|
|
416
|
+
_SkyFlyoutComponent_xCoord.set(this, 0);
|
|
417
|
+
_SkyFlyoutComponent_windowBufferSize.set(this, 20);
|
|
418
|
+
this.permalink = {};
|
|
419
|
+
this.permalinkLabel = '';
|
|
420
|
+
this.primaryAction = {};
|
|
421
|
+
this.primaryActionLabel = '';
|
|
408
422
|
/**
|
|
409
423
|
* @internal
|
|
410
424
|
*/
|
|
411
425
|
this.widthStep = 10;
|
|
412
|
-
this
|
|
413
|
-
this
|
|
426
|
+
_SkyFlyoutComponent_flyoutInstance.set(this, void 0);
|
|
427
|
+
_SkyFlyoutComponent_ngUnsubscribe.set(this, new Subject());
|
|
428
|
+
_SkyFlyoutComponent__messageStream.set(this, new Subject());
|
|
429
|
+
_SkyFlyoutComponent_adapter.set(this, void 0);
|
|
430
|
+
_SkyFlyoutComponent_changeDetector.set(this, void 0);
|
|
431
|
+
_SkyFlyoutComponent_injector.set(this, void 0);
|
|
432
|
+
_SkyFlyoutComponent_resolver.set(this, void 0);
|
|
433
|
+
_SkyFlyoutComponent_resourcesService.set(this, void 0);
|
|
434
|
+
_SkyFlyoutComponent_flyoutMediaQueryService.set(this, void 0);
|
|
435
|
+
_SkyFlyoutComponent_elementRef.set(this, void 0);
|
|
436
|
+
_SkyFlyoutComponent_uiConfigService.set(this, void 0);
|
|
437
|
+
_SkyFlyoutComponent_ngZone.set(this, void 0);
|
|
438
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_adapter, adapter, "f");
|
|
439
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_changeDetector, changeDetector, "f");
|
|
440
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_injector, injector, "f");
|
|
441
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_resolver, resolver, "f");
|
|
442
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_resourcesService, resourcesService, "f");
|
|
443
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_flyoutMediaQueryService, flyoutMediaQueryService, "f");
|
|
444
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_elementRef, elementRef, "f");
|
|
445
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_uiConfigService, uiConfigService, "f");
|
|
446
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_ngZone, ngZone, "f");
|
|
414
447
|
// All commands flow through the message stream.
|
|
415
448
|
this.messageStream
|
|
416
|
-
.pipe(takeUntil(this
|
|
449
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutComponent_ngUnsubscribe, "f")))
|
|
417
450
|
.subscribe((message) => {
|
|
418
|
-
this.
|
|
451
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_handleIncomingMessages).call(this, message);
|
|
419
452
|
});
|
|
420
453
|
}
|
|
421
454
|
get messageStream() {
|
|
422
|
-
return this
|
|
423
|
-
}
|
|
424
|
-
get permalink() {
|
|
425
|
-
const permalink = this.config.permalink;
|
|
426
|
-
if (permalink) {
|
|
427
|
-
return permalink;
|
|
428
|
-
}
|
|
429
|
-
return {};
|
|
430
|
-
}
|
|
431
|
-
get permalinkLabel() {
|
|
432
|
-
if (this.permalink.label) {
|
|
433
|
-
return this.permalink.label;
|
|
434
|
-
}
|
|
435
|
-
return this.getString('skyux_flyout_permalink_button');
|
|
436
|
-
}
|
|
437
|
-
get primaryAction() {
|
|
438
|
-
const primaryAction = this.config.primaryAction;
|
|
439
|
-
if (primaryAction) {
|
|
440
|
-
return primaryAction;
|
|
441
|
-
}
|
|
442
|
-
return {};
|
|
443
|
-
}
|
|
444
|
-
get primaryActionLabel() {
|
|
445
|
-
if (this.config.primaryAction && this.config.primaryAction.label) {
|
|
446
|
-
return this.config.primaryAction.label;
|
|
447
|
-
}
|
|
448
|
-
return this.getString('skyux_flyout_primary_action_button');
|
|
455
|
+
return __classPrivateFieldGet(this, _SkyFlyoutComponent__messageStream, "f");
|
|
449
456
|
}
|
|
450
457
|
ngOnInit() {
|
|
451
|
-
|
|
458
|
+
/* istanbul ignore else */
|
|
459
|
+
if (this.flyoutHeader) {
|
|
460
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_adapter, "f").adjustHeaderForHelp(this.flyoutHeader);
|
|
461
|
+
}
|
|
452
462
|
}
|
|
453
463
|
ngOnDestroy() {
|
|
454
|
-
this.
|
|
455
|
-
this.
|
|
464
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_ngUnsubscribe, "f").next();
|
|
465
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_ngUnsubscribe, "f").complete();
|
|
456
466
|
}
|
|
457
467
|
onWindowResize(event) {
|
|
458
|
-
if (this.
|
|
459
|
-
this.
|
|
468
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutMediaQueryService, "f").isWidthWithinBreakpiont(event.target.innerWidth, SkyMediaBreakpoints.xs)) {
|
|
469
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, event.target.innerWidth);
|
|
460
470
|
}
|
|
461
471
|
else {
|
|
462
|
-
this.
|
|
472
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, this.flyoutWidth);
|
|
463
473
|
}
|
|
464
|
-
this.
|
|
465
|
-
if (event.target.innerWidth - this.flyoutWidth < this
|
|
466
|
-
this.flyoutWidth = event.target.innerWidth - this
|
|
467
|
-
this
|
|
468
|
-
this.
|
|
474
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setFullscreen).call(this);
|
|
475
|
+
if (event.target.innerWidth - this.flyoutWidth < __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f")) {
|
|
476
|
+
this.flyoutWidth = event.target.innerWidth - __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f");
|
|
477
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f"), "f");
|
|
478
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
469
479
|
}
|
|
470
480
|
}
|
|
471
481
|
attach(component, config) {
|
|
472
|
-
this.
|
|
482
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_cleanTemplate).call(this);
|
|
473
483
|
// Emit the closed event on any previously opened flyout instance
|
|
474
|
-
if (this
|
|
475
|
-
this.
|
|
484
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) {
|
|
485
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_notifyClosed).call(this);
|
|
486
|
+
}
|
|
487
|
+
this.config = Object.assign({
|
|
488
|
+
defaultWidth: window.innerWidth / 2,
|
|
489
|
+
minWidth: 320,
|
|
490
|
+
maxWidth: window.innerWidth / 2,
|
|
491
|
+
providers: [],
|
|
492
|
+
}, config);
|
|
493
|
+
if (config?.defaultWidth && !config?.maxWidth) {
|
|
494
|
+
this.config.maxWidth = config?.defaultWidth;
|
|
476
495
|
}
|
|
477
|
-
this.config = Object.assign({ providers: [] }, config);
|
|
478
|
-
this.config.defaultWidth =
|
|
479
|
-
this.config.defaultWidth || window.innerWidth / 2;
|
|
480
|
-
this.config.minWidth = this.config.minWidth || 320;
|
|
481
|
-
this.config.maxWidth = this.config.maxWidth || this.config.defaultWidth;
|
|
482
496
|
this.config.showIterator = this.config.showIterator || false;
|
|
483
497
|
this.config.iteratorNextButtonDisabled =
|
|
484
498
|
this.config.iteratorNextButtonDisabled || false;
|
|
485
499
|
this.config.iteratorPreviousButtonDisabled =
|
|
486
500
|
this.config.iteratorPreviousButtonDisabled || false;
|
|
487
|
-
|
|
501
|
+
this.permalink = this.config.permalink ?? {};
|
|
502
|
+
this.permalinkLabel =
|
|
503
|
+
this.config.permalink && this.config.permalink.label
|
|
504
|
+
? this.config.permalink.label
|
|
505
|
+
: __classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_getString).call(this, 'skyux_flyout_permalink_button');
|
|
506
|
+
this.primaryAction = this.config.primaryAction ?? {};
|
|
507
|
+
this.primaryActionLabel =
|
|
508
|
+
this.config.primaryAction && this.config.primaryAction.label
|
|
509
|
+
? this.config.primaryAction.label
|
|
510
|
+
: __classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_getString).call(this, 'skyux_flyout_primary_action_button');
|
|
511
|
+
const factory = __classPrivateFieldGet(this, _SkyFlyoutComponent_resolver, "f").resolveComponentFactory(component);
|
|
488
512
|
const injector = Injector.create({
|
|
489
|
-
parent: this
|
|
513
|
+
parent: __classPrivateFieldGet(this, _SkyFlyoutComponent_injector, "f"),
|
|
490
514
|
providers: this.config.providers,
|
|
491
515
|
});
|
|
492
|
-
const componentRef = this.target
|
|
493
|
-
|
|
516
|
+
const componentRef = this.target?.createComponent(factory, undefined, injector);
|
|
517
|
+
/* safety check */
|
|
518
|
+
/* istanbul ignore if */
|
|
519
|
+
if (!componentRef) {
|
|
520
|
+
throw new Error("Flyout's internal component could not be created");
|
|
521
|
+
}
|
|
522
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_flyoutInstance, __classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_createFlyoutInstance).call(this, componentRef.instance), "f");
|
|
494
523
|
// This is used to ensure we do not render the flyout until we have attached the component.
|
|
495
524
|
// This allows the aria-labelledby to function correctly.
|
|
496
525
|
this.instanceReady = true;
|
|
497
|
-
this.
|
|
526
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_changeDetector, "f").markForCheck();
|
|
498
527
|
// Open the flyout immediately.
|
|
499
528
|
this.messageStream.next({
|
|
500
529
|
type: SkyFlyoutMessageType.Open,
|
|
501
530
|
});
|
|
502
531
|
if (this.config.settingsKey) {
|
|
503
|
-
this
|
|
532
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_uiConfigService, "f")
|
|
504
533
|
.getConfig(this.config.settingsKey)
|
|
505
534
|
.pipe(take(1))
|
|
506
535
|
.subscribe((value) => {
|
|
@@ -511,14 +540,14 @@ class SkyFlyoutComponent {
|
|
|
511
540
|
// Bad data, or config is the default config.
|
|
512
541
|
this.flyoutWidth = this.config.defaultWidth;
|
|
513
542
|
}
|
|
514
|
-
this.
|
|
543
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_checkInitialSize).call(this);
|
|
515
544
|
});
|
|
516
545
|
}
|
|
517
546
|
else {
|
|
518
547
|
this.flyoutWidth = this.config.defaultWidth;
|
|
519
|
-
this.
|
|
548
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_checkInitialSize).call(this);
|
|
520
549
|
}
|
|
521
|
-
return this
|
|
550
|
+
return __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f");
|
|
522
551
|
}
|
|
523
552
|
close() {
|
|
524
553
|
this.messageStream.next({
|
|
@@ -526,11 +555,15 @@ class SkyFlyoutComponent {
|
|
|
526
555
|
});
|
|
527
556
|
}
|
|
528
557
|
invokePrimaryAction() {
|
|
529
|
-
this.primaryAction.callback
|
|
530
|
-
|
|
531
|
-
this.
|
|
558
|
+
if (this.primaryAction.callback) {
|
|
559
|
+
this.primaryAction.callback();
|
|
560
|
+
if (this.primaryAction.closeAfterInvoking) {
|
|
561
|
+
this.close();
|
|
562
|
+
}
|
|
563
|
+
return false;
|
|
532
564
|
}
|
|
533
|
-
|
|
565
|
+
/* istanbul ignore next */
|
|
566
|
+
return true;
|
|
534
567
|
}
|
|
535
568
|
getAnimationState() {
|
|
536
569
|
return this.instanceReady && this.isOpening
|
|
@@ -543,18 +576,18 @@ class SkyFlyoutComponent {
|
|
|
543
576
|
}
|
|
544
577
|
if (event.toState === FLYOUT_CLOSED_STATE) {
|
|
545
578
|
this.isOpen = false;
|
|
546
|
-
this.
|
|
547
|
-
this.
|
|
579
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_notifyClosed).call(this);
|
|
580
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_cleanTemplate).call(this);
|
|
548
581
|
}
|
|
549
582
|
}
|
|
550
583
|
onHeaderGrabHandleMouseDown(event) {
|
|
551
584
|
this.onResizeHandleMouseDown(event);
|
|
552
585
|
}
|
|
553
586
|
onHeaderGrabHandleKeyDown(event) {
|
|
554
|
-
this.
|
|
587
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_handleResizeKeyDown).call(this, event);
|
|
555
588
|
}
|
|
556
589
|
onResizeHandleKeyDown(event) {
|
|
557
|
-
this.
|
|
590
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_handleResizeKeyDown).call(this, event);
|
|
558
591
|
}
|
|
559
592
|
onResizeHandleMouseDown(event) {
|
|
560
593
|
event.preventDefault();
|
|
@@ -563,8 +596,8 @@ class SkyFlyoutComponent {
|
|
|
563
596
|
return;
|
|
564
597
|
}
|
|
565
598
|
this.isDragging = true;
|
|
566
|
-
this
|
|
567
|
-
this.
|
|
599
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, event.clientX, "f");
|
|
600
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_adapter, "f").toggleIframePointerEvents(false);
|
|
568
601
|
fromEvent(document, 'mousemove')
|
|
569
602
|
.pipe(takeWhile(() => {
|
|
570
603
|
return this.isDragging;
|
|
@@ -586,204 +619,197 @@ class SkyFlyoutComponent {
|
|
|
586
619
|
if (!this.isDragging) {
|
|
587
620
|
return;
|
|
588
621
|
}
|
|
589
|
-
const offsetX = event.clientX - this
|
|
622
|
+
const offsetX = event.clientX - __classPrivateFieldGet(this, _SkyFlyoutComponent_xCoord, "f");
|
|
590
623
|
let width = this.flyoutWidth;
|
|
591
624
|
width -= offsetX;
|
|
592
625
|
if (width < this.config.minWidth || width > this.config.maxWidth) {
|
|
593
626
|
return;
|
|
594
627
|
}
|
|
595
|
-
if (window.innerWidth - width < this
|
|
596
|
-
width = window.innerWidth - this
|
|
597
|
-
this
|
|
628
|
+
if (window.innerWidth - width < __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f")) {
|
|
629
|
+
width = window.innerWidth - __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f");
|
|
630
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f"), "f");
|
|
598
631
|
}
|
|
599
632
|
else {
|
|
600
|
-
this
|
|
633
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, event.clientX, "f");
|
|
601
634
|
}
|
|
602
635
|
this.flyoutWidth = width;
|
|
603
|
-
this.
|
|
604
|
-
this.
|
|
636
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, this.flyoutWidth);
|
|
637
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_changeDetector, "f").markForCheck();
|
|
605
638
|
}
|
|
606
639
|
onHandleRelease(event) {
|
|
607
640
|
fromEvent(document, 'click')
|
|
608
641
|
.pipe(take(1))
|
|
609
642
|
.subscribe(() => {
|
|
610
643
|
this.isDragging = false;
|
|
611
|
-
this.
|
|
612
|
-
this.
|
|
644
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_adapter, "f").toggleIframePointerEvents(true);
|
|
645
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
613
646
|
});
|
|
614
647
|
}
|
|
615
648
|
onIteratorPreviousButtonClick() {
|
|
616
|
-
|
|
649
|
+
/* istanbul ignore else */
|
|
650
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) {
|
|
651
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f").iteratorPreviousButtonClick.emit();
|
|
652
|
+
}
|
|
617
653
|
}
|
|
618
654
|
onIteratorNextButtonClick() {
|
|
619
|
-
|
|
655
|
+
/* istanbul ignore else */
|
|
656
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) {
|
|
657
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f").iteratorNextButtonClick.emit();
|
|
658
|
+
}
|
|
620
659
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
660
|
+
}
|
|
661
|
+
_SkyFlyoutComponent_xCoord = new WeakMap(), _SkyFlyoutComponent_windowBufferSize = new WeakMap(), _SkyFlyoutComponent_flyoutInstance = new WeakMap(), _SkyFlyoutComponent_ngUnsubscribe = new WeakMap(), _SkyFlyoutComponent__messageStream = new WeakMap(), _SkyFlyoutComponent_adapter = new WeakMap(), _SkyFlyoutComponent_changeDetector = new WeakMap(), _SkyFlyoutComponent_injector = new WeakMap(), _SkyFlyoutComponent_resolver = new WeakMap(), _SkyFlyoutComponent_resourcesService = new WeakMap(), _SkyFlyoutComponent_flyoutMediaQueryService = new WeakMap(), _SkyFlyoutComponent_elementRef = new WeakMap(), _SkyFlyoutComponent_uiConfigService = new WeakMap(), _SkyFlyoutComponent_ngZone = new WeakMap(), _SkyFlyoutComponent_instances = new WeakSet(), _SkyFlyoutComponent_createFlyoutInstance = function _SkyFlyoutComponent_createFlyoutInstance(component) {
|
|
662
|
+
const instance = new SkyFlyoutInstance(component);
|
|
663
|
+
instance.hostController
|
|
664
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutComponent_ngUnsubscribe, "f")))
|
|
665
|
+
.subscribe((message) => {
|
|
666
|
+
this.messageStream.next(message);
|
|
667
|
+
});
|
|
668
|
+
return instance;
|
|
669
|
+
}, _SkyFlyoutComponent_handleIncomingMessages = function _SkyFlyoutComponent_handleIncomingMessages(message) {
|
|
670
|
+
switch (message.type) {
|
|
671
|
+
case SkyFlyoutMessageType.Open:
|
|
672
|
+
if (!this.isOpen) {
|
|
673
|
+
this.isOpen = false;
|
|
674
|
+
this.isOpening = true;
|
|
675
|
+
}
|
|
676
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_initFocusTrap).call(this);
|
|
677
|
+
break;
|
|
678
|
+
case SkyFlyoutMessageType.Close:
|
|
679
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")?.beforeClose?.observers
|
|
680
|
+
.length === 0 ||
|
|
681
|
+
message.data?.ignoreBeforeClose) {
|
|
682
|
+
this.isOpen = true;
|
|
683
|
+
this.isOpening = false;
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")?.beforeClose?.next(new SkyFlyoutBeforeCloseHandler(() => {
|
|
687
|
+
this.isOpen = true;
|
|
688
|
+
this.isOpening = false;
|
|
689
|
+
}));
|
|
690
|
+
}
|
|
691
|
+
break;
|
|
692
|
+
case SkyFlyoutMessageType.EnableIteratorNextButton:
|
|
693
|
+
this.config.iteratorNextButtonDisabled = false;
|
|
694
|
+
break;
|
|
695
|
+
case SkyFlyoutMessageType.EnableIteratorPreviousButton:
|
|
696
|
+
this.config.iteratorPreviousButtonDisabled = false;
|
|
697
|
+
break;
|
|
698
|
+
case SkyFlyoutMessageType.DisableIteratorNextButton:
|
|
699
|
+
this.config.iteratorNextButtonDisabled = true;
|
|
700
|
+
break;
|
|
701
|
+
case SkyFlyoutMessageType.DisableIteratorPreviousButton:
|
|
702
|
+
this.config.iteratorPreviousButtonDisabled = true;
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_changeDetector, "f").markForCheck();
|
|
706
|
+
}, _SkyFlyoutComponent_notifyClosed = function _SkyFlyoutComponent_notifyClosed() {
|
|
707
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")?.closed.emit();
|
|
708
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")?.closed.complete();
|
|
709
|
+
}, _SkyFlyoutComponent_cleanTemplate = function _SkyFlyoutComponent_cleanTemplate() {
|
|
710
|
+
this.target?.clear();
|
|
711
|
+
}, _SkyFlyoutComponent_updateBreakpointAndResponsiveClass = function _SkyFlyoutComponent_updateBreakpointAndResponsiveClass(width) {
|
|
712
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutMediaQueryService, "f").setBreakpointForWidth(width);
|
|
713
|
+
const newBreakpiont = __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutMediaQueryService, "f").current;
|
|
714
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_adapter, "f").setResponsiveClass(__classPrivateFieldGet(this, _SkyFlyoutComponent_elementRef, "f"), newBreakpiont);
|
|
715
|
+
}, _SkyFlyoutComponent_setFullscreen = function _SkyFlyoutComponent_setFullscreen() {
|
|
716
|
+
if (window.innerWidth - __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f") < this.config.minWidth) {
|
|
717
|
+
this.isFullscreen = true;
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
this.isFullscreen = false;
|
|
721
|
+
}
|
|
722
|
+
}, _SkyFlyoutComponent_setUserData = function _SkyFlyoutComponent_setUserData() {
|
|
723
|
+
if (this.config.settingsKey) {
|
|
724
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_uiConfigService, "f")
|
|
725
|
+
.setConfig(this.config.settingsKey, {
|
|
726
|
+
flyoutWidth: this.flyoutWidth,
|
|
727
|
+
})
|
|
728
|
+
.pipe(take(1))
|
|
729
|
+
.subscribe(
|
|
730
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
731
|
+
() => { }, (err) => {
|
|
732
|
+
console.warn('Could not save flyout data.');
|
|
733
|
+
console.warn(err);
|
|
628
734
|
});
|
|
629
|
-
return instance;
|
|
630
735
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
736
|
+
}, _SkyFlyoutComponent_checkInitialSize = function _SkyFlyoutComponent_checkInitialSize() {
|
|
737
|
+
if (this.flyoutWidth < this.config.minWidth) {
|
|
738
|
+
this.flyoutWidth = this.config.minWidth;
|
|
739
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
740
|
+
}
|
|
741
|
+
else if (this.flyoutWidth > this.config.maxWidth) {
|
|
742
|
+
this.flyoutWidth = this.config.maxWidth;
|
|
743
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
744
|
+
}
|
|
745
|
+
// Ensure flyout does not load larger than the window and its buffer
|
|
746
|
+
if (window.innerWidth - this.flyoutWidth < __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f")) {
|
|
747
|
+
this.flyoutWidth = window.innerWidth - __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f");
|
|
748
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f"), "f");
|
|
749
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
750
|
+
}
|
|
751
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutMediaQueryService, "f").isWidthWithinBreakpiont(window.innerWidth, SkyMediaBreakpoints.xs)) {
|
|
752
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, window.innerWidth);
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, this.flyoutWidth);
|
|
756
|
+
}
|
|
757
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setFullscreen).call(this);
|
|
758
|
+
}, _SkyFlyoutComponent_getString = function _SkyFlyoutComponent_getString(key) {
|
|
759
|
+
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
760
|
+
return __classPrivateFieldGet(this, _SkyFlyoutComponent_resourcesService, "f").getStringForLocale({ locale: 'en-US' }, key);
|
|
761
|
+
}, _SkyFlyoutComponent_handleResizeKeyDown = function _SkyFlyoutComponent_handleResizeKeyDown(event) {
|
|
762
|
+
/* istanbul ignore else */
|
|
763
|
+
if (event.key) {
|
|
764
|
+
const keyPressed = event.key.toLowerCase().replace('arrow', '');
|
|
765
|
+
switch (keyPressed) {
|
|
766
|
+
case 'enter':
|
|
767
|
+
case ' ':
|
|
768
|
+
this.resizeKeyControlActive = !this.resizeKeyControlActive;
|
|
639
769
|
break;
|
|
640
|
-
case
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
this.isOpen = true;
|
|
645
|
-
this.isOpening = false;
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
this.flyoutInstance.beforeClose.next(new SkyFlyoutBeforeCloseHandler(() => {
|
|
649
|
-
this.isOpen = true;
|
|
650
|
-
this.isOpening = false;
|
|
651
|
-
}));
|
|
770
|
+
case 'tab':
|
|
771
|
+
/* istanbul ignore else */
|
|
772
|
+
if (this.resizeKeyControlActive) {
|
|
773
|
+
this.resizeKeyControlActive = false;
|
|
652
774
|
}
|
|
653
775
|
break;
|
|
654
|
-
case
|
|
655
|
-
this.
|
|
656
|
-
break;
|
|
657
|
-
case SkyFlyoutMessageType.EnableIteratorPreviousButton:
|
|
658
|
-
this.config.iteratorPreviousButtonDisabled = false;
|
|
659
|
-
break;
|
|
660
|
-
case SkyFlyoutMessageType.DisableIteratorNextButton:
|
|
661
|
-
this.config.iteratorNextButtonDisabled = true;
|
|
662
|
-
break;
|
|
663
|
-
case SkyFlyoutMessageType.DisableIteratorPreviousButton:
|
|
664
|
-
this.config.iteratorPreviousButtonDisabled = true;
|
|
665
|
-
break;
|
|
666
|
-
}
|
|
667
|
-
this.changeDetector.markForCheck();
|
|
668
|
-
}
|
|
669
|
-
notifyClosed() {
|
|
670
|
-
this.flyoutInstance.closed.emit();
|
|
671
|
-
this.flyoutInstance.closed.complete();
|
|
672
|
-
}
|
|
673
|
-
cleanTemplate() {
|
|
674
|
-
this.target.clear();
|
|
675
|
-
}
|
|
676
|
-
updateBreakpointAndResponsiveClass(width) {
|
|
677
|
-
this.flyoutMediaQueryService.setBreakpointForWidth(width);
|
|
678
|
-
const newBreakpiont = this.flyoutMediaQueryService.current;
|
|
679
|
-
this.adapter.setResponsiveClass(this.elementRef, newBreakpiont);
|
|
680
|
-
}
|
|
681
|
-
setFullscreen() {
|
|
682
|
-
if (window.innerWidth - this.windowBufferSize < this.config.minWidth) {
|
|
683
|
-
this.isFullscreen = true;
|
|
684
|
-
}
|
|
685
|
-
else {
|
|
686
|
-
this.isFullscreen = false;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
setUserData() {
|
|
690
|
-
if (this.config.settingsKey) {
|
|
691
|
-
this.uiConfigService
|
|
692
|
-
.setConfig(this.config.settingsKey, {
|
|
693
|
-
flyoutWidth: this.flyoutWidth,
|
|
694
|
-
})
|
|
695
|
-
.pipe(take(1))
|
|
696
|
-
.subscribe(
|
|
697
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
698
|
-
() => { }, (err) => {
|
|
699
|
-
console.warn('Could not save flyout data.');
|
|
700
|
-
console.warn(err);
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
checkInitialSize() {
|
|
705
|
-
if (this.flyoutWidth < this.config.minWidth) {
|
|
706
|
-
this.flyoutWidth = this.config.minWidth;
|
|
707
|
-
this.setUserData();
|
|
708
|
-
}
|
|
709
|
-
else if (this.flyoutWidth > this.config.maxWidth) {
|
|
710
|
-
this.flyoutWidth = this.config.maxWidth;
|
|
711
|
-
this.setUserData();
|
|
712
|
-
}
|
|
713
|
-
// Ensure flyout does not load larger than the window and its buffer
|
|
714
|
-
if (window.innerWidth - this.flyoutWidth < this.windowBufferSize) {
|
|
715
|
-
this.flyoutWidth = window.innerWidth - this.windowBufferSize;
|
|
716
|
-
this.xCoord = this.windowBufferSize;
|
|
717
|
-
this.setUserData();
|
|
718
|
-
}
|
|
719
|
-
if (this.flyoutMediaQueryService.isWidthWithinBreakpiont(window.innerWidth, SkyMediaBreakpoints.xs)) {
|
|
720
|
-
this.updateBreakpointAndResponsiveClass(window.innerWidth);
|
|
721
|
-
}
|
|
722
|
-
else {
|
|
723
|
-
this.updateBreakpointAndResponsiveClass(this.flyoutWidth);
|
|
724
|
-
}
|
|
725
|
-
this.setFullscreen();
|
|
726
|
-
}
|
|
727
|
-
getString(key) {
|
|
728
|
-
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
729
|
-
return this.resourcesService.getStringForLocale({ locale: 'en-US' }, key);
|
|
730
|
-
}
|
|
731
|
-
handleResizeKeyDown(event) {
|
|
732
|
-
/* istanbul ignore else */
|
|
733
|
-
if (event.key) {
|
|
734
|
-
const keyPressed = event.key.toLowerCase().replace('arrow', '');
|
|
735
|
-
switch (keyPressed) {
|
|
736
|
-
case 'enter':
|
|
737
|
-
case ' ':
|
|
738
|
-
this.resizeKeyControlActive = !this.resizeKeyControlActive;
|
|
739
|
-
break;
|
|
740
|
-
case 'tab':
|
|
776
|
+
case 'left':
|
|
777
|
+
if (this.resizeKeyControlActive) {
|
|
741
778
|
/* istanbul ignore else */
|
|
742
|
-
if (this.
|
|
743
|
-
this.
|
|
779
|
+
if (this.flyoutWidth < this.config.maxWidth) {
|
|
780
|
+
this.flyoutWidth = Math.min(this.flyoutWidth + this.widthStep, this.config.maxWidth);
|
|
744
781
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
break;
|
|
754
|
-
case 'right':
|
|
755
|
-
if (this.resizeKeyControlActive) {
|
|
756
|
-
/* istanbul ignore else */
|
|
757
|
-
if (this.flyoutWidth > this.config.minWidth) {
|
|
758
|
-
this.flyoutWidth = Math.max(this.flyoutWidth - this.widthStep, this.config.minWidth);
|
|
759
|
-
}
|
|
782
|
+
}
|
|
783
|
+
break;
|
|
784
|
+
case 'right':
|
|
785
|
+
if (this.resizeKeyControlActive) {
|
|
786
|
+
/* istanbul ignore else */
|
|
787
|
+
if (this.flyoutWidth > this.config.minWidth) {
|
|
788
|
+
this.flyoutWidth = Math.max(this.flyoutWidth - this.widthStep, this.config.minWidth);
|
|
760
789
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
/** Executes a function when the zone is stable. */
|
|
769
|
-
_executeOnStable(fn) {
|
|
770
|
-
if (this._ngZone.isStable) {
|
|
771
|
-
fn();
|
|
772
|
-
}
|
|
773
|
-
else {
|
|
774
|
-
this._ngZone.onStable.pipe(take(1)).subscribe(fn);
|
|
790
|
+
}
|
|
791
|
+
break;
|
|
792
|
+
/* istanbul ignore next */
|
|
793
|
+
default:
|
|
794
|
+
break;
|
|
775
795
|
}
|
|
776
796
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
797
|
+
}, _SkyFlyoutComponent_executeOnStable = function _SkyFlyoutComponent_executeOnStable(fn) {
|
|
798
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_ngZone, "f").isStable) {
|
|
799
|
+
fn();
|
|
800
|
+
}
|
|
801
|
+
else {
|
|
802
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_ngZone, "f").onStable.pipe(take(1)).subscribe(fn);
|
|
803
|
+
}
|
|
804
|
+
}, _SkyFlyoutComponent_initFocusTrap = function _SkyFlyoutComponent_initFocusTrap() {
|
|
805
|
+
this.enableTrapFocusAutoCapture = false;
|
|
806
|
+
this.enableTrapFocus = false;
|
|
807
|
+
// Waiting for zone to be stable will avoid ExpressionChangeAfterCheckedError.
|
|
808
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_executeOnStable).call(this, () => {
|
|
809
|
+
this.enableTrapFocusAutoCapture = true;
|
|
810
|
+
this.enableTrapFocus = true;
|
|
811
|
+
});
|
|
812
|
+
};
|
|
787
813
|
SkyFlyoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutComponent, deps: [{ token: SkyFlyoutAdapterService }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }, { token: i2$1.SkyLibResourcesService }, { token: SkyFlyoutMediaQueryService }, { token: i0.ElementRef }, { token: i1$1.SkyUIConfigService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
788
814
|
SkyFlyoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyFlyoutComponent, selector: "sky-flyout", host: { listeners: { "window:resize": "onWindowResize($event)" } }, providers: [
|
|
789
815
|
SkyFlyoutAdapterService,
|
|
@@ -880,34 +906,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
880
906
|
}]
|
|
881
907
|
}] });
|
|
882
908
|
|
|
909
|
+
var _SkyFlyoutService_instances, _SkyFlyoutService_host, _SkyFlyoutService_removeAfterClosed, _SkyFlyoutService_isOpening, _SkyFlyoutService_ngUnsubscribe, _SkyFlyoutService_coreAdapter, _SkyFlyoutService_windowRef, _SkyFlyoutService_dynamicComponentService, _SkyFlyoutService_router, _SkyFlyoutService_ngZone, _SkyFlyoutService_createHostComponent, _SkyFlyoutService_removeHostComponent, _SkyFlyoutService_addListeners, _SkyFlyoutService_removeListners;
|
|
883
910
|
/**
|
|
884
911
|
* Launches flyouts and provides a common look and feel.
|
|
885
912
|
* This service dynamically generates the flyout component and appends it directly to the
|
|
886
913
|
* document's `body` element. The `SkyFlyoutInstance` class watches for and triggers flyout events.
|
|
887
914
|
*/
|
|
888
915
|
class SkyFlyoutService {
|
|
889
|
-
constructor(coreAdapter, windowRef, dynamicComponentService, router,
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
this
|
|
894
|
-
this
|
|
895
|
-
this
|
|
896
|
-
this
|
|
897
|
-
this
|
|
898
|
-
this
|
|
899
|
-
this
|
|
900
|
-
this
|
|
901
|
-
this
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}
|
|
916
|
+
constructor(coreAdapter, windowRef, dynamicComponentService, router, ngZone) {
|
|
917
|
+
_SkyFlyoutService_instances.add(this);
|
|
918
|
+
_SkyFlyoutService_host.set(this, void 0);
|
|
919
|
+
_SkyFlyoutService_removeAfterClosed.set(this, false);
|
|
920
|
+
_SkyFlyoutService_isOpening.set(this, false);
|
|
921
|
+
_SkyFlyoutService_ngUnsubscribe.set(this, new Subject());
|
|
922
|
+
_SkyFlyoutService_coreAdapter.set(this, void 0);
|
|
923
|
+
_SkyFlyoutService_windowRef.set(this, void 0);
|
|
924
|
+
_SkyFlyoutService_dynamicComponentService.set(this, void 0);
|
|
925
|
+
_SkyFlyoutService_router.set(this, void 0);
|
|
926
|
+
_SkyFlyoutService_ngZone.set(this, void 0);
|
|
927
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_coreAdapter, coreAdapter, "f");
|
|
928
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_windowRef, windowRef, "f");
|
|
929
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_dynamicComponentService, dynamicComponentService, "f");
|
|
930
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_router, router, "f");
|
|
931
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_ngZone, ngZone, "f");
|
|
906
932
|
}
|
|
907
933
|
ngOnDestroy() {
|
|
908
|
-
this.
|
|
909
|
-
if (this
|
|
910
|
-
this.
|
|
934
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeListners).call(this);
|
|
935
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
936
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeHostComponent).call(this);
|
|
911
937
|
}
|
|
912
938
|
}
|
|
913
939
|
/**
|
|
@@ -915,8 +941,8 @@ class SkyFlyoutService {
|
|
|
915
941
|
* @param args Arguments used when closing the flyout.
|
|
916
942
|
*/
|
|
917
943
|
close(args) {
|
|
918
|
-
if (this
|
|
919
|
-
this.
|
|
944
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f") && !__classPrivateFieldGet(this, _SkyFlyoutService_isOpening, "f")) {
|
|
945
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_host, "f").instance.messageStream.next({
|
|
920
946
|
type: SkyFlyoutMessageType.Close,
|
|
921
947
|
data: {
|
|
922
948
|
ignoreBeforeClose: args ? args.ignoreBeforeClose : false,
|
|
@@ -931,117 +957,111 @@ class SkyFlyoutService {
|
|
|
931
957
|
*/
|
|
932
958
|
open(component, config) {
|
|
933
959
|
// isOpening flag will prevent close() from firing when open() is also fired.
|
|
934
|
-
this
|
|
935
|
-
this.
|
|
936
|
-
this
|
|
960
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_isOpening, true, "f");
|
|
961
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_windowRef, "f").nativeWindow.setTimeout(() => {
|
|
962
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_isOpening, false, "f");
|
|
937
963
|
});
|
|
938
|
-
if (!this
|
|
939
|
-
this
|
|
940
|
-
this.
|
|
941
|
-
.pipe(takeWhile(() => this
|
|
964
|
+
if (!__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
965
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_host, __classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_createHostComponent).call(this), "f");
|
|
966
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_router, "f").events
|
|
967
|
+
.pipe(takeWhile(() => __classPrivateFieldGet(this, _SkyFlyoutService_host, "f") !== undefined))
|
|
942
968
|
.subscribe((event) => {
|
|
943
969
|
if (event instanceof NavigationStart) {
|
|
944
970
|
this.close();
|
|
945
971
|
// Sanity check - if the host still exists after animations should have completed - remove host
|
|
946
|
-
this.
|
|
947
|
-
if (this
|
|
948
|
-
this.
|
|
972
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_ngZone, "f").onStable.pipe(take(1)).subscribe(() => {
|
|
973
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
974
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeHostComponent).call(this);
|
|
949
975
|
}
|
|
950
976
|
});
|
|
951
977
|
}
|
|
952
978
|
});
|
|
953
979
|
}
|
|
954
|
-
const flyout = this.
|
|
955
|
-
this.
|
|
980
|
+
const flyout = __classPrivateFieldGet(this, _SkyFlyoutService_host, "f").instance.attach(component, config);
|
|
981
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_addListeners).call(this, flyout);
|
|
956
982
|
return flyout;
|
|
957
983
|
}
|
|
958
|
-
createHostComponent() {
|
|
959
|
-
this.host =
|
|
960
|
-
this.dynamicComponentService.createComponent(SkyFlyoutComponent);
|
|
961
|
-
return this.host;
|
|
962
|
-
}
|
|
963
|
-
removeHostComponent() {
|
|
964
|
-
if (this.host) {
|
|
965
|
-
this.dynamicComponentService.removeComponent(this.host);
|
|
966
|
-
this.host = undefined;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
addListeners(flyout) {
|
|
970
|
-
/* istanbul ignore else */
|
|
971
|
-
if (this.host) {
|
|
972
|
-
const flyoutInstance = this.host.instance;
|
|
973
|
-
let doClose = false;
|
|
974
|
-
/**
|
|
975
|
-
* Handles when to close a flyout.
|
|
976
|
-
* Note: We're using `mouseup` in order to capture the parent of certain targets that will be
|
|
977
|
-
* deleted immediately after being clicked. If we use `click`, the event is fired after the
|
|
978
|
-
* element is removed from the DOM making it impossible to check the parent's z-index
|
|
979
|
-
* relative to the flyout's container.
|
|
980
|
-
*/
|
|
981
|
-
fromEvent(document, 'mouseup')
|
|
982
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
983
|
-
.subscribe((event) => {
|
|
984
|
-
doClose = false;
|
|
985
|
-
if (this.host.instance.isDragging) {
|
|
986
|
-
return;
|
|
987
|
-
}
|
|
988
|
-
if (flyoutInstance.flyoutRef.nativeElement.contains(event.target)) {
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
const isAbove = event.target === document
|
|
992
|
-
? false
|
|
993
|
-
: this.coreAdapter.isTargetAboveElement(event.target, flyoutInstance.flyoutRef.nativeElement);
|
|
994
|
-
/* istanbul ignore else */
|
|
995
|
-
if (!isAbove) {
|
|
996
|
-
doClose = true;
|
|
997
|
-
}
|
|
998
|
-
});
|
|
999
|
-
/**
|
|
1000
|
-
* Check if we should close the flyout specifically on a `click` event so that we can keep
|
|
1001
|
-
* it open when consumers fire another `click` event on a trigger button. Since the consumer
|
|
1002
|
-
* will likely use a `click` event to open the flyout, we want to wait for that event to fire
|
|
1003
|
-
* before determining if the flyout should be closed.
|
|
1004
|
-
*/
|
|
1005
|
-
fromEvent(document, 'click')
|
|
1006
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1007
|
-
.subscribe(() => {
|
|
1008
|
-
if (doClose) {
|
|
1009
|
-
this.close();
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
this.removeAfterClosed = false;
|
|
1013
|
-
flyoutInstance.messageStream
|
|
1014
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1015
|
-
.subscribe((message) => {
|
|
1016
|
-
if (message.type === SkyFlyoutMessageType.Close) {
|
|
1017
|
-
this.removeAfterClosed = true;
|
|
1018
|
-
this.isOpening = false;
|
|
1019
|
-
}
|
|
1020
|
-
});
|
|
1021
|
-
flyout.closed.pipe(take(1)).subscribe(() => {
|
|
1022
|
-
this.removeListners();
|
|
1023
|
-
if (this.removeAfterClosed) {
|
|
1024
|
-
this.removeHostComponent();
|
|
1025
|
-
}
|
|
1026
|
-
});
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
removeListners() {
|
|
1030
|
-
this.ngUnsubscribe.next(true);
|
|
1031
|
-
this.ngUnsubscribe.unsubscribe();
|
|
1032
|
-
this.ngUnsubscribe = new Subject();
|
|
1033
|
-
}
|
|
1034
984
|
}
|
|
1035
|
-
|
|
985
|
+
_SkyFlyoutService_host = new WeakMap(), _SkyFlyoutService_removeAfterClosed = new WeakMap(), _SkyFlyoutService_isOpening = new WeakMap(), _SkyFlyoutService_ngUnsubscribe = new WeakMap(), _SkyFlyoutService_coreAdapter = new WeakMap(), _SkyFlyoutService_windowRef = new WeakMap(), _SkyFlyoutService_dynamicComponentService = new WeakMap(), _SkyFlyoutService_router = new WeakMap(), _SkyFlyoutService_ngZone = new WeakMap(), _SkyFlyoutService_instances = new WeakSet(), _SkyFlyoutService_createHostComponent = function _SkyFlyoutService_createHostComponent() {
|
|
986
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_host, __classPrivateFieldGet(this, _SkyFlyoutService_dynamicComponentService, "f").createComponent(SkyFlyoutComponent), "f");
|
|
987
|
+
return __classPrivateFieldGet(this, _SkyFlyoutService_host, "f");
|
|
988
|
+
}, _SkyFlyoutService_removeHostComponent = function _SkyFlyoutService_removeHostComponent() {
|
|
989
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
990
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_dynamicComponentService, "f").removeComponent(__classPrivateFieldGet(this, _SkyFlyoutService_host, "f"));
|
|
991
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_host, undefined, "f");
|
|
992
|
+
}
|
|
993
|
+
}, _SkyFlyoutService_addListeners = function _SkyFlyoutService_addListeners(flyout) {
|
|
994
|
+
/* istanbul ignore else */
|
|
995
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
996
|
+
const flyoutInstance = __classPrivateFieldGet(this, _SkyFlyoutService_host, "f").instance;
|
|
997
|
+
let doClose = false;
|
|
998
|
+
/**
|
|
999
|
+
* Handles when to close a flyout.
|
|
1000
|
+
* Note: We're using `mouseup` in order to capture the parent of certain targets that will be
|
|
1001
|
+
* deleted immediately after being clicked. If we use `click`, the event is fired after the
|
|
1002
|
+
* element is removed from the DOM making it impossible to check the parent's z-index
|
|
1003
|
+
* relative to the flyout's container.
|
|
1004
|
+
*/
|
|
1005
|
+
fromEvent(document, 'mouseup')
|
|
1006
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f")))
|
|
1007
|
+
.subscribe((event) => {
|
|
1008
|
+
doClose = false;
|
|
1009
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")?.instance.isDragging) {
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
if (flyoutInstance.flyoutRef?.nativeElement.contains(event.target)) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
const isAbove = event.target === document || !event.target
|
|
1016
|
+
? false
|
|
1017
|
+
: __classPrivateFieldGet(this, _SkyFlyoutService_coreAdapter, "f").isTargetAboveElement(event.target, flyoutInstance.flyoutRef?.nativeElement);
|
|
1018
|
+
/* istanbul ignore else */
|
|
1019
|
+
if (!isAbove) {
|
|
1020
|
+
doClose = true;
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
/**
|
|
1024
|
+
* Check if we should close the flyout specifically on a `click` event so that we can keep
|
|
1025
|
+
* it open when consumers fire another `click` event on a trigger button. Since the consumer
|
|
1026
|
+
* will likely use a `click` event to open the flyout, we want to wait for that event to fire
|
|
1027
|
+
* before determining if the flyout should be closed.
|
|
1028
|
+
*/
|
|
1029
|
+
fromEvent(document, 'click')
|
|
1030
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f")))
|
|
1031
|
+
.subscribe(() => {
|
|
1032
|
+
if (doClose) {
|
|
1033
|
+
this.close();
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_removeAfterClosed, false, "f");
|
|
1037
|
+
flyoutInstance.messageStream
|
|
1038
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f")))
|
|
1039
|
+
.subscribe((message) => {
|
|
1040
|
+
if (message.type === SkyFlyoutMessageType.Close) {
|
|
1041
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_removeAfterClosed, true, "f");
|
|
1042
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_isOpening, false, "f");
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
flyout.closed.pipe(take(1)).subscribe(() => {
|
|
1046
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeListners).call(this);
|
|
1047
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_removeAfterClosed, "f")) {
|
|
1048
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeHostComponent).call(this);
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
}, _SkyFlyoutService_removeListners = function _SkyFlyoutService_removeListners() {
|
|
1053
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f").next(true);
|
|
1054
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f").unsubscribe();
|
|
1055
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_ngUnsubscribe, new Subject(), "f");
|
|
1056
|
+
};
|
|
1057
|
+
SkyFlyoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutService, deps: [{ token: i1$1.SkyCoreAdapterService }, { token: i1$1.SkyAppWindowRef }, { token: i1$1.SkyDynamicComponentService }, { token: i2$2.Router }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1036
1058
|
SkyFlyoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutService, providedIn: 'any' });
|
|
1037
1059
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutService, decorators: [{
|
|
1038
1060
|
type: Injectable,
|
|
1039
1061
|
args: [{
|
|
1040
1062
|
providedIn: 'any',
|
|
1041
1063
|
}]
|
|
1042
|
-
}], ctorParameters: function () { return [{ type: i1$1.SkyCoreAdapterService }, { type: i1$1.SkyAppWindowRef }, { type: i1$1.SkyDynamicComponentService }, { type: i2$2.Router }, { type: i0.NgZone }
|
|
1043
|
-
type: Optional
|
|
1044
|
-
}] }]; } });
|
|
1064
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyCoreAdapterService }, { type: i1$1.SkyAppWindowRef }, { type: i1$1.SkyDynamicComponentService }, { type: i2$2.Router }, { type: i0.NgZone }]; } });
|
|
1045
1065
|
|
|
1046
1066
|
/**
|
|
1047
1067
|
* Generated bundle index. Do not edit.
|