@skyux/flyout 7.0.0-beta.1 → 7.0.0-beta.3
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,124 @@ 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
|
-
|
|
482
|
+
var _a, _b, _c;
|
|
483
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_cleanTemplate).call(this);
|
|
473
484
|
// Emit the closed event on any previously opened flyout instance
|
|
474
|
-
if (this
|
|
475
|
-
this.
|
|
485
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) {
|
|
486
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_notifyClosed).call(this);
|
|
487
|
+
}
|
|
488
|
+
this.config = Object.assign({
|
|
489
|
+
defaultWidth: window.innerWidth / 2,
|
|
490
|
+
minWidth: 320,
|
|
491
|
+
maxWidth: window.innerWidth / 2,
|
|
492
|
+
providers: [],
|
|
493
|
+
}, config);
|
|
494
|
+
if ((config === null || config === void 0 ? void 0 : config.defaultWidth) && !(config === null || config === void 0 ? void 0 : config.maxWidth)) {
|
|
495
|
+
this.config.maxWidth = config === null || config === void 0 ? void 0 : config.defaultWidth;
|
|
476
496
|
}
|
|
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
497
|
this.config.showIterator = this.config.showIterator || false;
|
|
483
498
|
this.config.iteratorNextButtonDisabled =
|
|
484
499
|
this.config.iteratorNextButtonDisabled || false;
|
|
485
500
|
this.config.iteratorPreviousButtonDisabled =
|
|
486
501
|
this.config.iteratorPreviousButtonDisabled || false;
|
|
487
|
-
|
|
502
|
+
this.permalink = (_a = this.config.permalink) !== null && _a !== void 0 ? _a : {};
|
|
503
|
+
this.permalinkLabel =
|
|
504
|
+
this.config.permalink && this.config.permalink.label
|
|
505
|
+
? this.config.permalink.label
|
|
506
|
+
: __classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_getString).call(this, 'skyux_flyout_permalink_button');
|
|
507
|
+
this.primaryAction = (_b = this.config.primaryAction) !== null && _b !== void 0 ? _b : {};
|
|
508
|
+
this.primaryActionLabel =
|
|
509
|
+
this.config.primaryAction && this.config.primaryAction.label
|
|
510
|
+
? this.config.primaryAction.label
|
|
511
|
+
: __classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_getString).call(this, 'skyux_flyout_primary_action_button');
|
|
512
|
+
const factory = __classPrivateFieldGet(this, _SkyFlyoutComponent_resolver, "f").resolveComponentFactory(component);
|
|
488
513
|
const injector = Injector.create({
|
|
489
|
-
parent: this
|
|
514
|
+
parent: __classPrivateFieldGet(this, _SkyFlyoutComponent_injector, "f"),
|
|
490
515
|
providers: this.config.providers,
|
|
491
516
|
});
|
|
492
|
-
const componentRef = this.target.createComponent(factory, undefined, injector);
|
|
493
|
-
|
|
517
|
+
const componentRef = (_c = this.target) === null || _c === void 0 ? void 0 : _c.createComponent(factory, undefined, injector);
|
|
518
|
+
/* safety check */
|
|
519
|
+
/* istanbul ignore if */
|
|
520
|
+
if (!componentRef) {
|
|
521
|
+
throw new Error("Flyout's internal component could not be created");
|
|
522
|
+
}
|
|
523
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_flyoutInstance, __classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_createFlyoutInstance).call(this, componentRef.instance), "f");
|
|
494
524
|
// This is used to ensure we do not render the flyout until we have attached the component.
|
|
495
525
|
// This allows the aria-labelledby to function correctly.
|
|
496
526
|
this.instanceReady = true;
|
|
497
|
-
this.
|
|
527
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_changeDetector, "f").markForCheck();
|
|
498
528
|
// Open the flyout immediately.
|
|
499
529
|
this.messageStream.next({
|
|
500
530
|
type: SkyFlyoutMessageType.Open,
|
|
501
531
|
});
|
|
502
532
|
if (this.config.settingsKey) {
|
|
503
|
-
this
|
|
533
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_uiConfigService, "f")
|
|
504
534
|
.getConfig(this.config.settingsKey)
|
|
505
535
|
.pipe(take(1))
|
|
506
536
|
.subscribe((value) => {
|
|
@@ -511,14 +541,14 @@ class SkyFlyoutComponent {
|
|
|
511
541
|
// Bad data, or config is the default config.
|
|
512
542
|
this.flyoutWidth = this.config.defaultWidth;
|
|
513
543
|
}
|
|
514
|
-
this.
|
|
544
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_checkInitialSize).call(this);
|
|
515
545
|
});
|
|
516
546
|
}
|
|
517
547
|
else {
|
|
518
548
|
this.flyoutWidth = this.config.defaultWidth;
|
|
519
|
-
this.
|
|
549
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_checkInitialSize).call(this);
|
|
520
550
|
}
|
|
521
|
-
return this
|
|
551
|
+
return __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f");
|
|
522
552
|
}
|
|
523
553
|
close() {
|
|
524
554
|
this.messageStream.next({
|
|
@@ -526,11 +556,15 @@ class SkyFlyoutComponent {
|
|
|
526
556
|
});
|
|
527
557
|
}
|
|
528
558
|
invokePrimaryAction() {
|
|
529
|
-
this.primaryAction.callback
|
|
530
|
-
|
|
531
|
-
this.
|
|
559
|
+
if (this.primaryAction.callback) {
|
|
560
|
+
this.primaryAction.callback();
|
|
561
|
+
if (this.primaryAction.closeAfterInvoking) {
|
|
562
|
+
this.close();
|
|
563
|
+
}
|
|
564
|
+
return false;
|
|
532
565
|
}
|
|
533
|
-
|
|
566
|
+
/* istanbul ignore next */
|
|
567
|
+
return true;
|
|
534
568
|
}
|
|
535
569
|
getAnimationState() {
|
|
536
570
|
return this.instanceReady && this.isOpening
|
|
@@ -543,18 +577,18 @@ class SkyFlyoutComponent {
|
|
|
543
577
|
}
|
|
544
578
|
if (event.toState === FLYOUT_CLOSED_STATE) {
|
|
545
579
|
this.isOpen = false;
|
|
546
|
-
this.
|
|
547
|
-
this.
|
|
580
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_notifyClosed).call(this);
|
|
581
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_cleanTemplate).call(this);
|
|
548
582
|
}
|
|
549
583
|
}
|
|
550
584
|
onHeaderGrabHandleMouseDown(event) {
|
|
551
585
|
this.onResizeHandleMouseDown(event);
|
|
552
586
|
}
|
|
553
587
|
onHeaderGrabHandleKeyDown(event) {
|
|
554
|
-
this.
|
|
588
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_handleResizeKeyDown).call(this, event);
|
|
555
589
|
}
|
|
556
590
|
onResizeHandleKeyDown(event) {
|
|
557
|
-
this.
|
|
591
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_handleResizeKeyDown).call(this, event);
|
|
558
592
|
}
|
|
559
593
|
onResizeHandleMouseDown(event) {
|
|
560
594
|
event.preventDefault();
|
|
@@ -563,8 +597,8 @@ class SkyFlyoutComponent {
|
|
|
563
597
|
return;
|
|
564
598
|
}
|
|
565
599
|
this.isDragging = true;
|
|
566
|
-
this
|
|
567
|
-
this.
|
|
600
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, event.clientX, "f");
|
|
601
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_adapter, "f").toggleIframePointerEvents(false);
|
|
568
602
|
fromEvent(document, 'mousemove')
|
|
569
603
|
.pipe(takeWhile(() => {
|
|
570
604
|
return this.isDragging;
|
|
@@ -586,205 +620,199 @@ class SkyFlyoutComponent {
|
|
|
586
620
|
if (!this.isDragging) {
|
|
587
621
|
return;
|
|
588
622
|
}
|
|
589
|
-
const offsetX = event.clientX - this
|
|
623
|
+
const offsetX = event.clientX - __classPrivateFieldGet(this, _SkyFlyoutComponent_xCoord, "f");
|
|
590
624
|
let width = this.flyoutWidth;
|
|
591
625
|
width -= offsetX;
|
|
592
626
|
if (width < this.config.minWidth || width > this.config.maxWidth) {
|
|
593
627
|
return;
|
|
594
628
|
}
|
|
595
|
-
if (window.innerWidth - width < this
|
|
596
|
-
width = window.innerWidth - this
|
|
597
|
-
this
|
|
629
|
+
if (window.innerWidth - width < __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f")) {
|
|
630
|
+
width = window.innerWidth - __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f");
|
|
631
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f"), "f");
|
|
598
632
|
}
|
|
599
633
|
else {
|
|
600
|
-
this
|
|
634
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, event.clientX, "f");
|
|
601
635
|
}
|
|
602
636
|
this.flyoutWidth = width;
|
|
603
|
-
this.
|
|
604
|
-
this.
|
|
637
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, this.flyoutWidth);
|
|
638
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_changeDetector, "f").markForCheck();
|
|
605
639
|
}
|
|
606
640
|
onHandleRelease(event) {
|
|
607
641
|
fromEvent(document, 'click')
|
|
608
642
|
.pipe(take(1))
|
|
609
643
|
.subscribe(() => {
|
|
610
644
|
this.isDragging = false;
|
|
611
|
-
this.
|
|
612
|
-
this.
|
|
645
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_adapter, "f").toggleIframePointerEvents(true);
|
|
646
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
613
647
|
});
|
|
614
648
|
}
|
|
615
649
|
onIteratorPreviousButtonClick() {
|
|
616
|
-
|
|
650
|
+
/* istanbul ignore else */
|
|
651
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) {
|
|
652
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f").iteratorPreviousButtonClick.emit();
|
|
653
|
+
}
|
|
617
654
|
}
|
|
618
655
|
onIteratorNextButtonClick() {
|
|
619
|
-
|
|
656
|
+
/* istanbul ignore else */
|
|
657
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) {
|
|
658
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f").iteratorNextButtonClick.emit();
|
|
659
|
+
}
|
|
620
660
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
661
|
+
}
|
|
662
|
+
_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) {
|
|
663
|
+
const instance = new SkyFlyoutInstance(component);
|
|
664
|
+
instance.hostController
|
|
665
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutComponent_ngUnsubscribe, "f")))
|
|
666
|
+
.subscribe((message) => {
|
|
667
|
+
this.messageStream.next(message);
|
|
668
|
+
});
|
|
669
|
+
return instance;
|
|
670
|
+
}, _SkyFlyoutComponent_handleIncomingMessages = function _SkyFlyoutComponent_handleIncomingMessages(message) {
|
|
671
|
+
var _a, _b, _c, _d, _e;
|
|
672
|
+
switch (message.type) {
|
|
673
|
+
case SkyFlyoutMessageType.Open:
|
|
674
|
+
if (!this.isOpen) {
|
|
675
|
+
this.isOpen = false;
|
|
676
|
+
this.isOpening = true;
|
|
677
|
+
}
|
|
678
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_initFocusTrap).call(this);
|
|
679
|
+
break;
|
|
680
|
+
case SkyFlyoutMessageType.Close:
|
|
681
|
+
if (((_b = (_a = __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) === null || _a === void 0 ? void 0 : _a.beforeClose) === null || _b === void 0 ? void 0 : _b.observers.length) === 0 ||
|
|
682
|
+
((_c = message.data) === null || _c === void 0 ? void 0 : _c.ignoreBeforeClose)) {
|
|
683
|
+
this.isOpen = true;
|
|
684
|
+
this.isOpening = false;
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
(_e = (_d = __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) === null || _d === void 0 ? void 0 : _d.beforeClose) === null || _e === void 0 ? void 0 : _e.next(new SkyFlyoutBeforeCloseHandler(() => {
|
|
688
|
+
this.isOpen = true;
|
|
689
|
+
this.isOpening = false;
|
|
690
|
+
}));
|
|
691
|
+
}
|
|
692
|
+
break;
|
|
693
|
+
case SkyFlyoutMessageType.EnableIteratorNextButton:
|
|
694
|
+
this.config.iteratorNextButtonDisabled = false;
|
|
695
|
+
break;
|
|
696
|
+
case SkyFlyoutMessageType.EnableIteratorPreviousButton:
|
|
697
|
+
this.config.iteratorPreviousButtonDisabled = false;
|
|
698
|
+
break;
|
|
699
|
+
case SkyFlyoutMessageType.DisableIteratorNextButton:
|
|
700
|
+
this.config.iteratorNextButtonDisabled = true;
|
|
701
|
+
break;
|
|
702
|
+
case SkyFlyoutMessageType.DisableIteratorPreviousButton:
|
|
703
|
+
this.config.iteratorPreviousButtonDisabled = true;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_changeDetector, "f").markForCheck();
|
|
707
|
+
}, _SkyFlyoutComponent_notifyClosed = function _SkyFlyoutComponent_notifyClosed() {
|
|
708
|
+
var _a, _b;
|
|
709
|
+
(_a = __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) === null || _a === void 0 ? void 0 : _a.closed.emit();
|
|
710
|
+
(_b = __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutInstance, "f")) === null || _b === void 0 ? void 0 : _b.closed.complete();
|
|
711
|
+
}, _SkyFlyoutComponent_cleanTemplate = function _SkyFlyoutComponent_cleanTemplate() {
|
|
712
|
+
var _a;
|
|
713
|
+
(_a = this.target) === null || _a === void 0 ? void 0 : _a.clear();
|
|
714
|
+
}, _SkyFlyoutComponent_updateBreakpointAndResponsiveClass = function _SkyFlyoutComponent_updateBreakpointAndResponsiveClass(width) {
|
|
715
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutMediaQueryService, "f").setBreakpointForWidth(width);
|
|
716
|
+
const newBreakpiont = __classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutMediaQueryService, "f").current;
|
|
717
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_adapter, "f").setResponsiveClass(__classPrivateFieldGet(this, _SkyFlyoutComponent_elementRef, "f"), newBreakpiont);
|
|
718
|
+
}, _SkyFlyoutComponent_setFullscreen = function _SkyFlyoutComponent_setFullscreen() {
|
|
719
|
+
if (window.innerWidth - __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f") < this.config.minWidth) {
|
|
720
|
+
this.isFullscreen = true;
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
this.isFullscreen = false;
|
|
724
|
+
}
|
|
725
|
+
}, _SkyFlyoutComponent_setUserData = function _SkyFlyoutComponent_setUserData() {
|
|
726
|
+
if (this.config.settingsKey) {
|
|
727
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_uiConfigService, "f")
|
|
728
|
+
.setConfig(this.config.settingsKey, {
|
|
729
|
+
flyoutWidth: this.flyoutWidth,
|
|
730
|
+
})
|
|
731
|
+
.pipe(take(1))
|
|
732
|
+
.subscribe(
|
|
733
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
734
|
+
() => { }, (err) => {
|
|
735
|
+
console.warn('Could not save flyout data.');
|
|
736
|
+
console.warn(err);
|
|
628
737
|
});
|
|
629
|
-
return instance;
|
|
630
738
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
739
|
+
}, _SkyFlyoutComponent_checkInitialSize = function _SkyFlyoutComponent_checkInitialSize() {
|
|
740
|
+
if (this.flyoutWidth < this.config.minWidth) {
|
|
741
|
+
this.flyoutWidth = this.config.minWidth;
|
|
742
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
743
|
+
}
|
|
744
|
+
else if (this.flyoutWidth > this.config.maxWidth) {
|
|
745
|
+
this.flyoutWidth = this.config.maxWidth;
|
|
746
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
747
|
+
}
|
|
748
|
+
// Ensure flyout does not load larger than the window and its buffer
|
|
749
|
+
if (window.innerWidth - this.flyoutWidth < __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f")) {
|
|
750
|
+
this.flyoutWidth = window.innerWidth - __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f");
|
|
751
|
+
__classPrivateFieldSet(this, _SkyFlyoutComponent_xCoord, __classPrivateFieldGet(this, _SkyFlyoutComponent_windowBufferSize, "f"), "f");
|
|
752
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setUserData).call(this);
|
|
753
|
+
}
|
|
754
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_flyoutMediaQueryService, "f").isWidthWithinBreakpiont(window.innerWidth, SkyMediaBreakpoints.xs)) {
|
|
755
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, window.innerWidth);
|
|
756
|
+
}
|
|
757
|
+
else {
|
|
758
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_updateBreakpointAndResponsiveClass).call(this, this.flyoutWidth);
|
|
759
|
+
}
|
|
760
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_setFullscreen).call(this);
|
|
761
|
+
}, _SkyFlyoutComponent_getString = function _SkyFlyoutComponent_getString(key) {
|
|
762
|
+
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
763
|
+
return __classPrivateFieldGet(this, _SkyFlyoutComponent_resourcesService, "f").getStringForLocale({ locale: 'en-US' }, key);
|
|
764
|
+
}, _SkyFlyoutComponent_handleResizeKeyDown = function _SkyFlyoutComponent_handleResizeKeyDown(event) {
|
|
765
|
+
/* istanbul ignore else */
|
|
766
|
+
if (event.key) {
|
|
767
|
+
const keyPressed = event.key.toLowerCase().replace('arrow', '');
|
|
768
|
+
switch (keyPressed) {
|
|
769
|
+
case 'enter':
|
|
770
|
+
case ' ':
|
|
771
|
+
this.resizeKeyControlActive = !this.resizeKeyControlActive;
|
|
640
772
|
break;
|
|
641
|
-
case
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
this.isOpen = true;
|
|
646
|
-
this.isOpening = false;
|
|
647
|
-
}
|
|
648
|
-
else {
|
|
649
|
-
this.flyoutInstance.beforeClose.next(new SkyFlyoutBeforeCloseHandler(() => {
|
|
650
|
-
this.isOpen = true;
|
|
651
|
-
this.isOpening = false;
|
|
652
|
-
}));
|
|
773
|
+
case 'tab':
|
|
774
|
+
/* istanbul ignore else */
|
|
775
|
+
if (this.resizeKeyControlActive) {
|
|
776
|
+
this.resizeKeyControlActive = false;
|
|
653
777
|
}
|
|
654
778
|
break;
|
|
655
|
-
case
|
|
656
|
-
this.
|
|
657
|
-
break;
|
|
658
|
-
case SkyFlyoutMessageType.EnableIteratorPreviousButton:
|
|
659
|
-
this.config.iteratorPreviousButtonDisabled = false;
|
|
660
|
-
break;
|
|
661
|
-
case SkyFlyoutMessageType.DisableIteratorNextButton:
|
|
662
|
-
this.config.iteratorNextButtonDisabled = true;
|
|
663
|
-
break;
|
|
664
|
-
case SkyFlyoutMessageType.DisableIteratorPreviousButton:
|
|
665
|
-
this.config.iteratorPreviousButtonDisabled = true;
|
|
666
|
-
break;
|
|
667
|
-
}
|
|
668
|
-
this.changeDetector.markForCheck();
|
|
669
|
-
}
|
|
670
|
-
notifyClosed() {
|
|
671
|
-
this.flyoutInstance.closed.emit();
|
|
672
|
-
this.flyoutInstance.closed.complete();
|
|
673
|
-
}
|
|
674
|
-
cleanTemplate() {
|
|
675
|
-
this.target.clear();
|
|
676
|
-
}
|
|
677
|
-
updateBreakpointAndResponsiveClass(width) {
|
|
678
|
-
this.flyoutMediaQueryService.setBreakpointForWidth(width);
|
|
679
|
-
const newBreakpiont = this.flyoutMediaQueryService.current;
|
|
680
|
-
this.adapter.setResponsiveClass(this.elementRef, newBreakpiont);
|
|
681
|
-
}
|
|
682
|
-
setFullscreen() {
|
|
683
|
-
if (window.innerWidth - this.windowBufferSize < this.config.minWidth) {
|
|
684
|
-
this.isFullscreen = true;
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
this.isFullscreen = false;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
setUserData() {
|
|
691
|
-
if (this.config.settingsKey) {
|
|
692
|
-
this.uiConfigService
|
|
693
|
-
.setConfig(this.config.settingsKey, {
|
|
694
|
-
flyoutWidth: this.flyoutWidth,
|
|
695
|
-
})
|
|
696
|
-
.pipe(take(1))
|
|
697
|
-
.subscribe(
|
|
698
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
699
|
-
() => { }, (err) => {
|
|
700
|
-
console.warn('Could not save flyout data.');
|
|
701
|
-
console.warn(err);
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
checkInitialSize() {
|
|
706
|
-
if (this.flyoutWidth < this.config.minWidth) {
|
|
707
|
-
this.flyoutWidth = this.config.minWidth;
|
|
708
|
-
this.setUserData();
|
|
709
|
-
}
|
|
710
|
-
else if (this.flyoutWidth > this.config.maxWidth) {
|
|
711
|
-
this.flyoutWidth = this.config.maxWidth;
|
|
712
|
-
this.setUserData();
|
|
713
|
-
}
|
|
714
|
-
// Ensure flyout does not load larger than the window and its buffer
|
|
715
|
-
if (window.innerWidth - this.flyoutWidth < this.windowBufferSize) {
|
|
716
|
-
this.flyoutWidth = window.innerWidth - this.windowBufferSize;
|
|
717
|
-
this.xCoord = this.windowBufferSize;
|
|
718
|
-
this.setUserData();
|
|
719
|
-
}
|
|
720
|
-
if (this.flyoutMediaQueryService.isWidthWithinBreakpiont(window.innerWidth, SkyMediaBreakpoints.xs)) {
|
|
721
|
-
this.updateBreakpointAndResponsiveClass(window.innerWidth);
|
|
722
|
-
}
|
|
723
|
-
else {
|
|
724
|
-
this.updateBreakpointAndResponsiveClass(this.flyoutWidth);
|
|
725
|
-
}
|
|
726
|
-
this.setFullscreen();
|
|
727
|
-
}
|
|
728
|
-
getString(key) {
|
|
729
|
-
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
730
|
-
return this.resourcesService.getStringForLocale({ locale: 'en-US' }, key);
|
|
731
|
-
}
|
|
732
|
-
handleResizeKeyDown(event) {
|
|
733
|
-
/* istanbul ignore else */
|
|
734
|
-
if (event.key) {
|
|
735
|
-
const keyPressed = event.key.toLowerCase().replace('arrow', '');
|
|
736
|
-
switch (keyPressed) {
|
|
737
|
-
case 'enter':
|
|
738
|
-
case ' ':
|
|
739
|
-
this.resizeKeyControlActive = !this.resizeKeyControlActive;
|
|
740
|
-
break;
|
|
741
|
-
case 'tab':
|
|
779
|
+
case 'left':
|
|
780
|
+
if (this.resizeKeyControlActive) {
|
|
742
781
|
/* istanbul ignore else */
|
|
743
|
-
if (this.
|
|
744
|
-
this.
|
|
782
|
+
if (this.flyoutWidth < this.config.maxWidth) {
|
|
783
|
+
this.flyoutWidth = Math.min(this.flyoutWidth + this.widthStep, this.config.maxWidth);
|
|
745
784
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
}
|
|
754
|
-
break;
|
|
755
|
-
case 'right':
|
|
756
|
-
if (this.resizeKeyControlActive) {
|
|
757
|
-
/* istanbul ignore else */
|
|
758
|
-
if (this.flyoutWidth > this.config.minWidth) {
|
|
759
|
-
this.flyoutWidth = Math.max(this.flyoutWidth - this.widthStep, this.config.minWidth);
|
|
760
|
-
}
|
|
785
|
+
}
|
|
786
|
+
break;
|
|
787
|
+
case 'right':
|
|
788
|
+
if (this.resizeKeyControlActive) {
|
|
789
|
+
/* istanbul ignore else */
|
|
790
|
+
if (this.flyoutWidth > this.config.minWidth) {
|
|
791
|
+
this.flyoutWidth = Math.max(this.flyoutWidth - this.widthStep, this.config.minWidth);
|
|
761
792
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
/** Executes a function when the zone is stable. */
|
|
770
|
-
_executeOnStable(fn) {
|
|
771
|
-
if (this._ngZone.isStable) {
|
|
772
|
-
fn();
|
|
773
|
-
}
|
|
774
|
-
else {
|
|
775
|
-
this._ngZone.onStable.pipe(take(1)).subscribe(fn);
|
|
793
|
+
}
|
|
794
|
+
break;
|
|
795
|
+
/* istanbul ignore next */
|
|
796
|
+
default:
|
|
797
|
+
break;
|
|
776
798
|
}
|
|
777
799
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
800
|
+
}, _SkyFlyoutComponent_executeOnStable = function _SkyFlyoutComponent_executeOnStable(fn) {
|
|
801
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutComponent_ngZone, "f").isStable) {
|
|
802
|
+
fn();
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_ngZone, "f").onStable.pipe(take(1)).subscribe(fn);
|
|
806
|
+
}
|
|
807
|
+
}, _SkyFlyoutComponent_initFocusTrap = function _SkyFlyoutComponent_initFocusTrap() {
|
|
808
|
+
this.enableTrapFocusAutoCapture = false;
|
|
809
|
+
this.enableTrapFocus = false;
|
|
810
|
+
// Waiting for zone to be stable will avoid ExpressionChangeAfterCheckedError.
|
|
811
|
+
__classPrivateFieldGet(this, _SkyFlyoutComponent_instances, "m", _SkyFlyoutComponent_executeOnStable).call(this, () => {
|
|
812
|
+
this.enableTrapFocusAutoCapture = true;
|
|
813
|
+
this.enableTrapFocus = true;
|
|
814
|
+
});
|
|
815
|
+
};
|
|
788
816
|
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 });
|
|
789
817
|
SkyFlyoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SkyFlyoutComponent, selector: "sky-flyout", host: { listeners: { "window:resize": "onWindowResize($event)" } }, providers: [
|
|
790
818
|
SkyFlyoutAdapterService,
|
|
@@ -881,34 +909,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
881
909
|
}]
|
|
882
910
|
}] });
|
|
883
911
|
|
|
912
|
+
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;
|
|
884
913
|
/**
|
|
885
914
|
* Launches flyouts and provides a common look and feel.
|
|
886
915
|
* This service dynamically generates the flyout component and appends it directly to the
|
|
887
916
|
* document's `body` element. The `SkyFlyoutInstance` class watches for and triggers flyout events.
|
|
888
917
|
*/
|
|
889
918
|
class SkyFlyoutService {
|
|
890
|
-
constructor(coreAdapter, windowRef, dynamicComponentService, router,
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
this
|
|
895
|
-
this
|
|
896
|
-
this
|
|
897
|
-
this
|
|
898
|
-
this
|
|
899
|
-
this
|
|
900
|
-
this
|
|
901
|
-
this
|
|
902
|
-
this
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
}
|
|
919
|
+
constructor(coreAdapter, windowRef, dynamicComponentService, router, ngZone) {
|
|
920
|
+
_SkyFlyoutService_instances.add(this);
|
|
921
|
+
_SkyFlyoutService_host.set(this, void 0);
|
|
922
|
+
_SkyFlyoutService_removeAfterClosed.set(this, false);
|
|
923
|
+
_SkyFlyoutService_isOpening.set(this, false);
|
|
924
|
+
_SkyFlyoutService_ngUnsubscribe.set(this, new Subject());
|
|
925
|
+
_SkyFlyoutService_coreAdapter.set(this, void 0);
|
|
926
|
+
_SkyFlyoutService_windowRef.set(this, void 0);
|
|
927
|
+
_SkyFlyoutService_dynamicComponentService.set(this, void 0);
|
|
928
|
+
_SkyFlyoutService_router.set(this, void 0);
|
|
929
|
+
_SkyFlyoutService_ngZone.set(this, void 0);
|
|
930
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_coreAdapter, coreAdapter, "f");
|
|
931
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_windowRef, windowRef, "f");
|
|
932
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_dynamicComponentService, dynamicComponentService, "f");
|
|
933
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_router, router, "f");
|
|
934
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_ngZone, ngZone, "f");
|
|
907
935
|
}
|
|
908
936
|
ngOnDestroy() {
|
|
909
|
-
this.
|
|
910
|
-
if (this
|
|
911
|
-
this.
|
|
937
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeListners).call(this);
|
|
938
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
939
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeHostComponent).call(this);
|
|
912
940
|
}
|
|
913
941
|
}
|
|
914
942
|
/**
|
|
@@ -916,8 +944,8 @@ class SkyFlyoutService {
|
|
|
916
944
|
* @param args Arguments used when closing the flyout.
|
|
917
945
|
*/
|
|
918
946
|
close(args) {
|
|
919
|
-
if (this
|
|
920
|
-
this.
|
|
947
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f") && !__classPrivateFieldGet(this, _SkyFlyoutService_isOpening, "f")) {
|
|
948
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_host, "f").instance.messageStream.next({
|
|
921
949
|
type: SkyFlyoutMessageType.Close,
|
|
922
950
|
data: {
|
|
923
951
|
ignoreBeforeClose: args ? args.ignoreBeforeClose : false,
|
|
@@ -932,119 +960,112 @@ class SkyFlyoutService {
|
|
|
932
960
|
*/
|
|
933
961
|
open(component, config) {
|
|
934
962
|
// isOpening flag will prevent close() from firing when open() is also fired.
|
|
935
|
-
this
|
|
936
|
-
this.
|
|
937
|
-
this
|
|
963
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_isOpening, true, "f");
|
|
964
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_windowRef, "f").nativeWindow.setTimeout(() => {
|
|
965
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_isOpening, false, "f");
|
|
938
966
|
});
|
|
939
|
-
if (!this
|
|
940
|
-
this
|
|
941
|
-
this.
|
|
942
|
-
.pipe(takeWhile(() => this
|
|
967
|
+
if (!__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
968
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_host, __classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_createHostComponent).call(this), "f");
|
|
969
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_router, "f").events
|
|
970
|
+
.pipe(takeWhile(() => __classPrivateFieldGet(this, _SkyFlyoutService_host, "f") !== undefined))
|
|
943
971
|
.subscribe((event) => {
|
|
944
972
|
if (event instanceof NavigationStart) {
|
|
945
973
|
this.close();
|
|
946
974
|
// Sanity check - if the host still exists after animations should have completed - remove host
|
|
947
|
-
this.
|
|
948
|
-
if (this
|
|
949
|
-
this.
|
|
975
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_ngZone, "f").onStable.pipe(take(1)).subscribe(() => {
|
|
976
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
977
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeHostComponent).call(this);
|
|
950
978
|
}
|
|
951
979
|
});
|
|
952
980
|
}
|
|
953
981
|
});
|
|
954
982
|
}
|
|
955
|
-
const flyout = this.
|
|
956
|
-
this.
|
|
983
|
+
const flyout = __classPrivateFieldGet(this, _SkyFlyoutService_host, "f").instance.attach(component, config);
|
|
984
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_addListeners).call(this, flyout);
|
|
957
985
|
return flyout;
|
|
958
986
|
}
|
|
959
|
-
createHostComponent() {
|
|
960
|
-
this.host =
|
|
961
|
-
this.dynamicComponentService.createComponent(SkyFlyoutComponent);
|
|
962
|
-
return this.host;
|
|
963
|
-
}
|
|
964
|
-
removeHostComponent() {
|
|
965
|
-
if (this.host) {
|
|
966
|
-
this.dynamicComponentService.removeComponent(this.host);
|
|
967
|
-
this.host = undefined;
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
addListeners(flyout) {
|
|
971
|
-
/* istanbul ignore else */
|
|
972
|
-
if (this.host) {
|
|
973
|
-
const flyoutInstance = this.host.instance;
|
|
974
|
-
let doClose = false;
|
|
975
|
-
/**
|
|
976
|
-
* Handles when to close a flyout.
|
|
977
|
-
* Note: We're using `mouseup` in order to capture the parent of certain targets that will be
|
|
978
|
-
* deleted immediately after being clicked. If we use `click`, the event is fired after the
|
|
979
|
-
* element is removed from the DOM making it impossible to check the parent's z-index
|
|
980
|
-
* relative to the flyout's container.
|
|
981
|
-
*/
|
|
982
|
-
fromEvent(document, 'mouseup')
|
|
983
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
984
|
-
.subscribe((event) => {
|
|
985
|
-
doClose = false;
|
|
986
|
-
if (this.host.instance.isDragging) {
|
|
987
|
-
return;
|
|
988
|
-
}
|
|
989
|
-
if (flyoutInstance.flyoutRef.nativeElement.contains(event.target)) {
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
const isAbove = event.target === document
|
|
993
|
-
? false
|
|
994
|
-
: this.coreAdapter.isTargetAboveElement(event.target, flyoutInstance.flyoutRef.nativeElement);
|
|
995
|
-
/* istanbul ignore else */
|
|
996
|
-
if (!isAbove) {
|
|
997
|
-
doClose = true;
|
|
998
|
-
}
|
|
999
|
-
});
|
|
1000
|
-
/**
|
|
1001
|
-
* Check if we should close the flyout specifically on a `click` event so that we can keep
|
|
1002
|
-
* it open when consumers fire another `click` event on a trigger button. Since the consumer
|
|
1003
|
-
* will likely use a `click` event to open the flyout, we want to wait for that event to fire
|
|
1004
|
-
* before determining if the flyout should be closed.
|
|
1005
|
-
*/
|
|
1006
|
-
fromEvent(document, 'click')
|
|
1007
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1008
|
-
.subscribe(() => {
|
|
1009
|
-
if (doClose) {
|
|
1010
|
-
this.close();
|
|
1011
|
-
}
|
|
1012
|
-
});
|
|
1013
|
-
this.removeAfterClosed = false;
|
|
1014
|
-
flyoutInstance.messageStream
|
|
1015
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1016
|
-
.subscribe((message) => {
|
|
1017
|
-
if (message.type === SkyFlyoutMessageType.Close) {
|
|
1018
|
-
this.removeAfterClosed = true;
|
|
1019
|
-
this.isOpening = false;
|
|
1020
|
-
}
|
|
1021
|
-
});
|
|
1022
|
-
flyout.closed.pipe(take(1)).subscribe(() => {
|
|
1023
|
-
this.removeListners();
|
|
1024
|
-
if (this.removeAfterClosed) {
|
|
1025
|
-
this.removeHostComponent();
|
|
1026
|
-
}
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
removeListners() {
|
|
1031
|
-
this.ngUnsubscribe.next(true);
|
|
1032
|
-
this.ngUnsubscribe.unsubscribe();
|
|
1033
|
-
this.ngUnsubscribe = new Subject();
|
|
1034
|
-
}
|
|
1035
987
|
}
|
|
1036
|
-
|
|
988
|
+
_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() {
|
|
989
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_host, __classPrivateFieldGet(this, _SkyFlyoutService_dynamicComponentService, "f").createComponent(SkyFlyoutComponent), "f");
|
|
990
|
+
return __classPrivateFieldGet(this, _SkyFlyoutService_host, "f");
|
|
991
|
+
}, _SkyFlyoutService_removeHostComponent = function _SkyFlyoutService_removeHostComponent() {
|
|
992
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
993
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_dynamicComponentService, "f").removeComponent(__classPrivateFieldGet(this, _SkyFlyoutService_host, "f"));
|
|
994
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_host, undefined, "f");
|
|
995
|
+
}
|
|
996
|
+
}, _SkyFlyoutService_addListeners = function _SkyFlyoutService_addListeners(flyout) {
|
|
997
|
+
/* istanbul ignore else */
|
|
998
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) {
|
|
999
|
+
const flyoutInstance = __classPrivateFieldGet(this, _SkyFlyoutService_host, "f").instance;
|
|
1000
|
+
let doClose = false;
|
|
1001
|
+
/**
|
|
1002
|
+
* Handles when to close a flyout.
|
|
1003
|
+
* Note: We're using `mouseup` in order to capture the parent of certain targets that will be
|
|
1004
|
+
* deleted immediately after being clicked. If we use `click`, the event is fired after the
|
|
1005
|
+
* element is removed from the DOM making it impossible to check the parent's z-index
|
|
1006
|
+
* relative to the flyout's container.
|
|
1007
|
+
*/
|
|
1008
|
+
fromEvent(document, 'mouseup')
|
|
1009
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f")))
|
|
1010
|
+
.subscribe((event) => {
|
|
1011
|
+
var _a, _b, _c;
|
|
1012
|
+
doClose = false;
|
|
1013
|
+
if ((_a = __classPrivateFieldGet(this, _SkyFlyoutService_host, "f")) === null || _a === void 0 ? void 0 : _a.instance.isDragging) {
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if ((_b = flyoutInstance.flyoutRef) === null || _b === void 0 ? void 0 : _b.nativeElement.contains(event.target)) {
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
const isAbove = event.target === document || !event.target
|
|
1020
|
+
? false
|
|
1021
|
+
: __classPrivateFieldGet(this, _SkyFlyoutService_coreAdapter, "f").isTargetAboveElement(event.target, (_c = flyoutInstance.flyoutRef) === null || _c === void 0 ? void 0 : _c.nativeElement);
|
|
1022
|
+
/* istanbul ignore else */
|
|
1023
|
+
if (!isAbove) {
|
|
1024
|
+
doClose = true;
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
/**
|
|
1028
|
+
* Check if we should close the flyout specifically on a `click` event so that we can keep
|
|
1029
|
+
* it open when consumers fire another `click` event on a trigger button. Since the consumer
|
|
1030
|
+
* will likely use a `click` event to open the flyout, we want to wait for that event to fire
|
|
1031
|
+
* before determining if the flyout should be closed.
|
|
1032
|
+
*/
|
|
1033
|
+
fromEvent(document, 'click')
|
|
1034
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f")))
|
|
1035
|
+
.subscribe(() => {
|
|
1036
|
+
if (doClose) {
|
|
1037
|
+
this.close();
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_removeAfterClosed, false, "f");
|
|
1041
|
+
flyoutInstance.messageStream
|
|
1042
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f")))
|
|
1043
|
+
.subscribe((message) => {
|
|
1044
|
+
if (message.type === SkyFlyoutMessageType.Close) {
|
|
1045
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_removeAfterClosed, true, "f");
|
|
1046
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_isOpening, false, "f");
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
flyout.closed.pipe(take(1)).subscribe(() => {
|
|
1050
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeListners).call(this);
|
|
1051
|
+
if (__classPrivateFieldGet(this, _SkyFlyoutService_removeAfterClosed, "f")) {
|
|
1052
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_instances, "m", _SkyFlyoutService_removeHostComponent).call(this);
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}, _SkyFlyoutService_removeListners = function _SkyFlyoutService_removeListners() {
|
|
1057
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f").next(true);
|
|
1058
|
+
__classPrivateFieldGet(this, _SkyFlyoutService_ngUnsubscribe, "f").unsubscribe();
|
|
1059
|
+
__classPrivateFieldSet(this, _SkyFlyoutService_ngUnsubscribe, new Subject(), "f");
|
|
1060
|
+
};
|
|
1061
|
+
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 });
|
|
1037
1062
|
SkyFlyoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutService, providedIn: 'any' });
|
|
1038
1063
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SkyFlyoutService, decorators: [{
|
|
1039
1064
|
type: Injectable,
|
|
1040
1065
|
args: [{
|
|
1041
1066
|
providedIn: 'any',
|
|
1042
1067
|
}]
|
|
1043
|
-
}], ctorParameters: function () {
|
|
1044
|
-
return [{ type: i1$1.SkyCoreAdapterService }, { type: i1$1.SkyAppWindowRef }, { type: i1$1.SkyDynamicComponentService }, { type: i2$2.Router }, { type: i0.NgZone }, { type: i0.ApplicationRef, decorators: [{
|
|
1045
|
-
type: Optional
|
|
1046
|
-
}] }];
|
|
1047
|
-
} });
|
|
1068
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyCoreAdapterService }, { type: i1$1.SkyAppWindowRef }, { type: i1$1.SkyDynamicComponentService }, { type: i2$2.Router }, { type: i0.NgZone }]; } });
|
|
1048
1069
|
|
|
1049
1070
|
/**
|
|
1050
1071
|
* Generated bundle index. Do not edit.
|