@skyux/flyout 5.7.2 → 6.0.0-beta.2

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.
Files changed (59) hide show
  1. package/documentation.json +2 -2
  2. package/esm2020/index.mjs +14 -0
  3. package/esm2020/lib/modules/flyout/flyout-adapter.service.mjs +64 -0
  4. package/esm2020/lib/modules/flyout/flyout-instance.mjs +109 -0
  5. package/esm2020/lib/modules/flyout/flyout-iterator.component.mjs +55 -0
  6. package/esm2020/lib/modules/flyout/flyout-media-query.service.mjs +72 -0
  7. package/esm2020/lib/modules/flyout/flyout.component.mjs +499 -0
  8. package/esm2020/lib/modules/flyout/flyout.module.mjs +55 -0
  9. package/esm2020/lib/modules/flyout/flyout.service.mjs +169 -0
  10. package/esm2020/lib/modules/flyout/types/flyout-action.mjs +2 -0
  11. package/esm2020/lib/modules/flyout/types/flyout-before-close-handler.mjs +9 -0
  12. package/esm2020/lib/modules/flyout/types/flyout-close-args.mjs +2 -0
  13. package/esm2020/lib/modules/flyout/types/flyout-config.mjs +2 -0
  14. package/esm2020/lib/modules/flyout/types/flyout-message-type.mjs +13 -0
  15. package/esm2020/lib/modules/flyout/types/flyout-message.mjs +2 -0
  16. package/esm2020/lib/modules/flyout/types/flyout-permalink.mjs +2 -0
  17. package/esm2020/lib/modules/shared/sky-flyout-resources.module.mjs +54 -0
  18. package/esm2020/skyux-flyout.mjs +5 -0
  19. package/fesm2015/skyux-flyout.mjs +1065 -0
  20. package/fesm2015/skyux-flyout.mjs.map +1 -0
  21. package/{fesm2015/skyux-flyout.js → fesm2020/skyux-flyout.mjs} +30 -44
  22. package/fesm2020/skyux-flyout.mjs.map +1 -0
  23. package/package.json +34 -18
  24. package/bundles/skyux-flyout.umd.js +0 -1179
  25. package/esm2015/index.js +0 -14
  26. package/esm2015/index.js.map +0 -1
  27. package/esm2015/lib/modules/flyout/flyout-adapter.service.js +0 -64
  28. package/esm2015/lib/modules/flyout/flyout-adapter.service.js.map +0 -1
  29. package/esm2015/lib/modules/flyout/flyout-instance.js +0 -109
  30. package/esm2015/lib/modules/flyout/flyout-instance.js.map +0 -1
  31. package/esm2015/lib/modules/flyout/flyout-iterator.component.js +0 -59
  32. package/esm2015/lib/modules/flyout/flyout-iterator.component.js.map +0 -1
  33. package/esm2015/lib/modules/flyout/flyout-media-query.service.js +0 -72
  34. package/esm2015/lib/modules/flyout/flyout-media-query.service.js.map +0 -1
  35. package/esm2015/lib/modules/flyout/flyout.component.js +0 -508
  36. package/esm2015/lib/modules/flyout/flyout.component.js.map +0 -1
  37. package/esm2015/lib/modules/flyout/flyout.module.js +0 -56
  38. package/esm2015/lib/modules/flyout/flyout.module.js.map +0 -1
  39. package/esm2015/lib/modules/flyout/flyout.service.js +0 -169
  40. package/esm2015/lib/modules/flyout/flyout.service.js.map +0 -1
  41. package/esm2015/lib/modules/flyout/types/flyout-action.js +0 -2
  42. package/esm2015/lib/modules/flyout/types/flyout-action.js.map +0 -1
  43. package/esm2015/lib/modules/flyout/types/flyout-before-close-handler.js +0 -9
  44. package/esm2015/lib/modules/flyout/types/flyout-before-close-handler.js.map +0 -1
  45. package/esm2015/lib/modules/flyout/types/flyout-close-args.js +0 -2
  46. package/esm2015/lib/modules/flyout/types/flyout-close-args.js.map +0 -1
  47. package/esm2015/lib/modules/flyout/types/flyout-config.js +0 -2
  48. package/esm2015/lib/modules/flyout/types/flyout-config.js.map +0 -1
  49. package/esm2015/lib/modules/flyout/types/flyout-message-type.js +0 -13
  50. package/esm2015/lib/modules/flyout/types/flyout-message-type.js.map +0 -1
  51. package/esm2015/lib/modules/flyout/types/flyout-message.js +0 -2
  52. package/esm2015/lib/modules/flyout/types/flyout-message.js.map +0 -1
  53. package/esm2015/lib/modules/flyout/types/flyout-permalink.js +0 -2
  54. package/esm2015/lib/modules/flyout/types/flyout-permalink.js.map +0 -1
  55. package/esm2015/lib/modules/shared/sky-flyout-resources.module.js +0 -54
  56. package/esm2015/lib/modules/shared/sky-flyout-resources.module.js.map +0 -1
  57. package/esm2015/skyux-flyout.js +0 -5
  58. package/esm2015/skyux-flyout.js.map +0 -1
  59. package/fesm2015/skyux-flyout.js.map +0 -1
@@ -0,0 +1,1065 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, NgModule, Component, Input, Output, Injectable, Injector, ElementRef, ViewContainerRef, ChangeDetectionStrategy, ViewChild, HostListener, Optional } from '@angular/core';
3
+ import { Subject, BehaviorSubject, fromEvent } from 'rxjs';
4
+ import * as i9 from '@angular/cdk/a11y';
5
+ import { A11yModule } from '@angular/cdk/a11y';
6
+ import * as i7 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+ import { FormsModule } from '@angular/forms';
9
+ import * as i2$2 from '@angular/router';
10
+ import { RouterModule, NavigationStart } from '@angular/router';
11
+ import * as i2$1 from '@skyux/i18n';
12
+ import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
13
+ import * as i1 from '@skyux/indicators';
14
+ import { SkyIconModule } from '@skyux/indicators';
15
+ import * as i10 from '@skyux/router';
16
+ import { SkyHrefModule } from '@skyux/router';
17
+ import * as i2 from '@skyux/theme';
18
+ import { SkyThemeModule } from '@skyux/theme';
19
+ import { trigger, state, style, transition, animate } from '@angular/animations';
20
+ import * as i1$1 from '@skyux/core';
21
+ import { SkyMediaBreakpoints, SkyMediaQueryService } from '@skyux/core';
22
+ import { takeUntil, take, takeWhile } from 'rxjs/operators';
23
+
24
+ /**
25
+ * @internal
26
+ */
27
+ var SkyFlyoutMessageType;
28
+ (function (SkyFlyoutMessageType) {
29
+ SkyFlyoutMessageType[SkyFlyoutMessageType["Open"] = 0] = "Open";
30
+ SkyFlyoutMessageType[SkyFlyoutMessageType["Close"] = 1] = "Close";
31
+ SkyFlyoutMessageType[SkyFlyoutMessageType["EnableIteratorNextButton"] = 2] = "EnableIteratorNextButton";
32
+ SkyFlyoutMessageType[SkyFlyoutMessageType["EnableIteratorPreviousButton"] = 3] = "EnableIteratorPreviousButton";
33
+ SkyFlyoutMessageType[SkyFlyoutMessageType["DisableIteratorNextButton"] = 4] = "DisableIteratorNextButton";
34
+ SkyFlyoutMessageType[SkyFlyoutMessageType["DisableIteratorPreviousButton"] = 5] = "DisableIteratorPreviousButton";
35
+ })(SkyFlyoutMessageType || (SkyFlyoutMessageType = {}));
36
+
37
+ /**
38
+ * Represents a single displayed flyout.
39
+ */
40
+ class SkyFlyoutInstance {
41
+ constructor() {
42
+ /**
43
+ * An event that the flyout instance emits when it closes.
44
+ */
45
+ this.closed = new EventEmitter();
46
+ /**
47
+ * A `boolean` value that returns `true` if the flyout is open.
48
+ * @default true
49
+ */
50
+ this.isOpen = true;
51
+ this._beforeClose = new Subject();
52
+ this._iteratorNextButtonClick = new EventEmitter();
53
+ this._iteratorPreviousButtonClick = new EventEmitter();
54
+ this._iteratorNextButtonDisabled = false;
55
+ this._iteratorPreviousButtonDisabled = false;
56
+ this._hostController = new Subject();
57
+ this.closed.subscribe(() => {
58
+ this.isOpen = false;
59
+ });
60
+ }
61
+ /**
62
+ * An event that the modal instance emits when it is about to close.
63
+ * If a subscription exists for this event,
64
+ * the modal does not close until the subscriber calls the handler's `closeModal` method.
65
+ */
66
+ get beforeClose() {
67
+ return this._beforeClose;
68
+ }
69
+ /**
70
+ * Used to communicate with the host component.
71
+ * @internal
72
+ */
73
+ get hostController() {
74
+ return this._hostController;
75
+ }
76
+ /**
77
+ * An event that the flyout instance emits when users click the next iterator button.
78
+ */
79
+ get iteratorNextButtonClick() {
80
+ return this._iteratorNextButtonClick;
81
+ }
82
+ /**
83
+ * An event that the flyout instance emits when users click the previous iterator button.
84
+ */
85
+ get iteratorPreviousButtonClick() {
86
+ return this._iteratorPreviousButtonClick;
87
+ }
88
+ /**
89
+ * Disables the next iterator button.
90
+ * @default false
91
+ */
92
+ set iteratorNextButtonDisabled(newValue) {
93
+ this._iteratorNextButtonDisabled = newValue;
94
+ if (newValue) {
95
+ this.hostController.next({
96
+ type: SkyFlyoutMessageType.DisableIteratorNextButton,
97
+ });
98
+ }
99
+ else {
100
+ this.hostController.next({
101
+ type: SkyFlyoutMessageType.EnableIteratorNextButton,
102
+ });
103
+ }
104
+ }
105
+ get iteratorNextButtonDisabled() {
106
+ return this._iteratorNextButtonDisabled;
107
+ }
108
+ /**
109
+ * Disables the previous iterator button.
110
+ * @default false
111
+ */
112
+ set iteratorPreviousButtonDisabled(newValue) {
113
+ this._iteratorPreviousButtonDisabled = newValue;
114
+ if (newValue) {
115
+ this.hostController.next({
116
+ type: SkyFlyoutMessageType.DisableIteratorPreviousButton,
117
+ });
118
+ }
119
+ else {
120
+ this.hostController.next({
121
+ type: SkyFlyoutMessageType.EnableIteratorPreviousButton,
122
+ });
123
+ }
124
+ }
125
+ get iteratorPreviousButtonDisabled() {
126
+ return this._iteratorPreviousButtonDisabled;
127
+ }
128
+ /**
129
+ * Closes the flyout instance and emits its `closed` event.
130
+ * @param args Arguments used when closing the flyout.
131
+ */
132
+ close(args) {
133
+ this.hostController.next({
134
+ type: SkyFlyoutMessageType.Close,
135
+ data: { ignoreBeforeClose: args ? args.ignoreBeforeClose : false },
136
+ });
137
+ this._iteratorPreviousButtonClick.complete();
138
+ this._iteratorNextButtonClick.complete();
139
+ this.hostController.complete();
140
+ }
141
+ }
142
+
143
+ /**
144
+ * NOTICE: DO NOT MODIFY THIS FILE!
145
+ * The contents of this file were automatically generated by
146
+ * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-flyout' schematic.
147
+ * To update this file, simply rerun the command.
148
+ */
149
+ const RESOURCES = {
150
+ 'EN-US': {
151
+ skyux_flyout_close: { message: 'Close flyout' },
152
+ skyux_flyout_iterator_previous_button: { message: 'Previous' },
153
+ skyux_flyout_iterator_next_button: { message: 'Next' },
154
+ skyux_flyout_permalink_button: { message: 'View record' },
155
+ skyux_flyout_primary_action_button: { message: 'Create list' },
156
+ skyux_flyout_resize_handle: {
157
+ message: 'Resize the flyout window. Press the enter or space key to activate, then use left arrow key to expand the flyout window and right arrow key to shrink the flyout window. Press the enter, space, or tab key to deactivate.',
158
+ },
159
+ },
160
+ };
161
+ class SkyFlyoutResourcesProvider {
162
+ getString(localeInfo, name) {
163
+ return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
164
+ }
165
+ }
166
+ /**
167
+ * Import into any component library module that needs to use resource strings.
168
+ */
169
+ class SkyFlyoutResourcesModule {
170
+ }
171
+ SkyFlyoutResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
172
+ SkyFlyoutResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutResourcesModule, exports: [SkyI18nModule] });
173
+ SkyFlyoutResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutResourcesModule, providers: [
174
+ {
175
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
176
+ useClass: SkyFlyoutResourcesProvider,
177
+ multi: true,
178
+ },
179
+ ], imports: [SkyI18nModule] });
180
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutResourcesModule, decorators: [{
181
+ type: NgModule,
182
+ args: [{
183
+ exports: [SkyI18nModule],
184
+ providers: [
185
+ {
186
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
187
+ useClass: SkyFlyoutResourcesProvider,
188
+ multi: true,
189
+ },
190
+ ],
191
+ }]
192
+ }] });
193
+
194
+ /**
195
+ * @internal
196
+ */
197
+ class SkyFlyoutIteratorComponent {
198
+ constructor() {
199
+ this.ngUnsubscribe = new Subject();
200
+ this._nextButtonClick = new EventEmitter();
201
+ this._previousButtonClick = new EventEmitter();
202
+ }
203
+ get previousButtonClick() {
204
+ return this._previousButtonClick;
205
+ }
206
+ get nextButtonClick() {
207
+ return this._nextButtonClick;
208
+ }
209
+ ngOnDestroy() {
210
+ this.ngUnsubscribe.next();
211
+ this.ngUnsubscribe.complete();
212
+ this._previousButtonClick.complete();
213
+ this._nextButtonClick.complete();
214
+ }
215
+ onIteratorPreviousClick() {
216
+ /* istanbul ignore else */
217
+ if (!this.previousButtonDisabled) {
218
+ this._previousButtonClick.emit();
219
+ }
220
+ }
221
+ onIteratorNextClick() {
222
+ /* istanbul ignore else */
223
+ if (!this.nextButtonDisabled) {
224
+ this._nextButtonClick.emit();
225
+ }
226
+ }
227
+ }
228
+ SkyFlyoutIteratorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutIteratorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
229
+ SkyFlyoutIteratorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", 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"], components: [{ type: i1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i2.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { type: i2.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }], pipes: { "skyLibResources": i2$1.SkyLibResourcesPipe } });
230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutIteratorComponent, decorators: [{
231
+ type: Component,
232
+ args: [{ selector: 'sky-flyout-iterator', 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"] }]
233
+ }], propDecorators: { nextButtonDisabled: [{
234
+ type: Input
235
+ }], previousButtonDisabled: [{
236
+ type: Input
237
+ }], previousButtonClick: [{
238
+ type: Output
239
+ }], nextButtonClick: [{
240
+ type: Output
241
+ }] } });
242
+
243
+ /**
244
+ * @internal
245
+ */
246
+ class SkyFlyoutAdapterService {
247
+ constructor(rendererFactory, windowRef) {
248
+ this.rendererFactory = rendererFactory;
249
+ this.windowRef = windowRef;
250
+ this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
251
+ }
252
+ adjustHeaderForHelp(header) {
253
+ const windowObj = this.windowRef.nativeWindow;
254
+ const helpWidget = windowObj.document.getElementById('bb-help-invoker');
255
+ if (helpWidget) {
256
+ this.renderer.addClass(header.nativeElement, 'sky-flyout-help-shim');
257
+ }
258
+ }
259
+ setResponsiveClass(element, breakpoint) {
260
+ const nativeEl = element.nativeElement;
261
+ this.renderer.removeClass(nativeEl, 'sky-responsive-container-xs');
262
+ this.renderer.removeClass(nativeEl, 'sky-responsive-container-sm');
263
+ this.renderer.removeClass(nativeEl, 'sky-responsive-container-md');
264
+ this.renderer.removeClass(nativeEl, 'sky-responsive-container-lg');
265
+ let newClass;
266
+ switch (breakpoint) {
267
+ case SkyMediaBreakpoints.xs: {
268
+ newClass = 'sky-responsive-container-xs';
269
+ break;
270
+ }
271
+ case SkyMediaBreakpoints.sm: {
272
+ newClass = 'sky-responsive-container-sm';
273
+ break;
274
+ }
275
+ case SkyMediaBreakpoints.md: {
276
+ newClass = 'sky-responsive-container-md';
277
+ break;
278
+ }
279
+ default: {
280
+ newClass = 'sky-responsive-container-lg';
281
+ break;
282
+ }
283
+ }
284
+ this.renderer.addClass(nativeEl, newClass);
285
+ }
286
+ toggleIframePointerEvents(enable) {
287
+ // When iframes are present on the page, they may interfere with dragging
288
+ // temporarily disable pointer events in iframes when dragging starts.
289
+ // When re-enabling we set to the empty string as it will remove the element styling
290
+ // and fall back to any css originally given to iframe
291
+ const iframes = document.querySelectorAll('iframe');
292
+ for (let i = 0; i < iframes.length; i++) {
293
+ iframes[i].style.pointerEvents = enable ? '' : 'none';
294
+ }
295
+ }
296
+ }
297
+ SkyFlyoutAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutAdapterService, deps: [{ token: i0.RendererFactory2 }, { token: i1$1.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
298
+ SkyFlyoutAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutAdapterService });
299
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutAdapterService, decorators: [{
300
+ type: Injectable
301
+ }], ctorParameters: function () { return [{ type: i0.RendererFactory2 }, { type: i1$1.SkyAppWindowRef }]; } });
302
+
303
+ /**
304
+ * @internal
305
+ */
306
+ class SkyFlyoutMediaQueryService {
307
+ constructor() {
308
+ this.currentSubject = new BehaviorSubject(this.current);
309
+ this._current = SkyMediaBreakpoints.xs;
310
+ this.currentSubject.next(this._current);
311
+ }
312
+ get current() {
313
+ return this._current;
314
+ }
315
+ subscribe(listener) {
316
+ return this.currentSubject.subscribe({
317
+ next: (breakpoints) => {
318
+ listener(breakpoints);
319
+ },
320
+ });
321
+ }
322
+ setBreakpointForWidth(width) {
323
+ let breakpoint;
324
+ if (this.isWidthWithinBreakpiont(width, SkyMediaBreakpoints.xs)) {
325
+ breakpoint = SkyMediaBreakpoints.xs;
326
+ }
327
+ else if (this.isWidthWithinBreakpiont(width, SkyMediaBreakpoints.sm)) {
328
+ breakpoint = SkyMediaBreakpoints.sm;
329
+ }
330
+ else if (this.isWidthWithinBreakpiont(width, SkyMediaBreakpoints.md)) {
331
+ breakpoint = SkyMediaBreakpoints.md;
332
+ }
333
+ else {
334
+ breakpoint = SkyMediaBreakpoints.lg;
335
+ }
336
+ this._current = breakpoint;
337
+ this.currentSubject.next(this._current);
338
+ }
339
+ isWidthWithinBreakpiont(width, breakpoint) {
340
+ const xsBreakpointMaxPixels = 767;
341
+ const smBreakpointMinPixels = 768;
342
+ const smBreakpointMaxPixels = 991;
343
+ const mdBreakpointMinPixels = 992;
344
+ const mdBreakpointMaxPixels = 1199;
345
+ const lgBreakpointMinPixels = 1200;
346
+ switch (breakpoint) {
347
+ case SkyMediaBreakpoints.xs: {
348
+ return width <= xsBreakpointMaxPixels;
349
+ }
350
+ case SkyMediaBreakpoints.sm: {
351
+ return width >= smBreakpointMinPixels && width <= smBreakpointMaxPixels;
352
+ }
353
+ case SkyMediaBreakpoints.md: {
354
+ return width >= mdBreakpointMinPixels && width <= mdBreakpointMaxPixels;
355
+ }
356
+ default: {
357
+ return width >= lgBreakpointMinPixels;
358
+ }
359
+ }
360
+ }
361
+ destroy() {
362
+ this.currentSubject.complete();
363
+ }
364
+ }
365
+ SkyFlyoutMediaQueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutMediaQueryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
366
+ SkyFlyoutMediaQueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutMediaQueryService });
367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutMediaQueryService, decorators: [{
368
+ type: Injectable
369
+ }], ctorParameters: function () { return []; } });
370
+
371
+ /**
372
+ * Handler for notifying the flyout when it is appropriate to close the flyout. This will be returned from the flyout instance's `beforeClose` observable.
373
+ */
374
+ class SkyFlyoutBeforeCloseHandler {
375
+ constructor(closeFlyoutFunction) {
376
+ this.closeFlyout = closeFlyoutFunction;
377
+ }
378
+ }
379
+
380
+ const FLYOUT_OPEN_STATE = 'flyoutOpen';
381
+ const FLYOUT_CLOSED_STATE = 'flyoutClosed';
382
+ let nextId = 0;
383
+ /**
384
+ * @internal
385
+ */
386
+ class SkyFlyoutComponent {
387
+ constructor(adapter, changeDetector, injector, resolver, resourcesService, flyoutMediaQueryService, elementRef, uiConfigService, _ngZone) {
388
+ this.adapter = adapter;
389
+ this.changeDetector = changeDetector;
390
+ this.injector = injector;
391
+ this.resolver = resolver;
392
+ this.resourcesService = resourcesService;
393
+ this.flyoutMediaQueryService = flyoutMediaQueryService;
394
+ this.elementRef = elementRef;
395
+ this.uiConfigService = uiConfigService;
396
+ this._ngZone = _ngZone;
397
+ this.flyoutId = `sky-flyout-${++nextId}`;
398
+ this.flyoutState = FLYOUT_CLOSED_STATE;
399
+ this.isOpen = false;
400
+ this.isOpening = false;
401
+ this.flyoutWidth = 0;
402
+ this.instanceReady = false;
403
+ this.isDragging = false;
404
+ this.isFullscreen = false;
405
+ this.resizeKeyControlActive = false;
406
+ this.xCoord = 0;
407
+ this.windowBufferSize = 20;
408
+ /**
409
+ * @internal
410
+ */
411
+ this.widthStep = 10;
412
+ this.ngUnsubscribe = new Subject();
413
+ this._messageStream = new Subject();
414
+ // All commands flow through the message stream.
415
+ this.messageStream
416
+ .pipe(takeUntil(this.ngUnsubscribe))
417
+ .subscribe((message) => {
418
+ this.handleIncomingMessages(message);
419
+ });
420
+ }
421
+ get messageStream() {
422
+ return this._messageStream;
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');
449
+ }
450
+ ngOnInit() {
451
+ this.adapter.adjustHeaderForHelp(this.flyoutHeader);
452
+ }
453
+ ngOnDestroy() {
454
+ this.ngUnsubscribe.next();
455
+ this.ngUnsubscribe.complete();
456
+ }
457
+ onWindowResize(event) {
458
+ if (this.flyoutMediaQueryService.isWidthWithinBreakpiont(event.target.innerWidth, SkyMediaBreakpoints.xs)) {
459
+ this.updateBreakpointAndResponsiveClass(event.target.innerWidth);
460
+ }
461
+ else {
462
+ this.updateBreakpointAndResponsiveClass(this.flyoutWidth);
463
+ }
464
+ this.setFullscreen();
465
+ if (event.target.innerWidth - this.flyoutWidth < this.windowBufferSize) {
466
+ this.flyoutWidth = event.target.innerWidth - this.windowBufferSize;
467
+ this.xCoord = this.windowBufferSize;
468
+ this.setUserData();
469
+ }
470
+ }
471
+ attach(component, config) {
472
+ this.cleanTemplate();
473
+ // Emit the closed event on any previously opened flyout instance
474
+ if (this.flyoutInstance) {
475
+ this.notifyClosed();
476
+ }
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
+ this.config.showIterator = this.config.showIterator || false;
483
+ this.config.iteratorNextButtonDisabled =
484
+ this.config.iteratorNextButtonDisabled || false;
485
+ this.config.iteratorPreviousButtonDisabled =
486
+ this.config.iteratorPreviousButtonDisabled || false;
487
+ const factory = this.resolver.resolveComponentFactory(component);
488
+ const injector = Injector.create({
489
+ parent: this.injector,
490
+ providers: this.config.providers,
491
+ });
492
+ const componentRef = this.target.createComponent(factory, undefined, injector);
493
+ this.flyoutInstance = this.createFlyoutInstance(componentRef.instance);
494
+ // This is used to ensure we do not render the flyout until we have attached the component.
495
+ // This allows the aria-labelledby to function correctly.
496
+ this.instanceReady = true;
497
+ this.changeDetector.markForCheck();
498
+ // Open the flyout immediately.
499
+ this.messageStream.next({
500
+ type: SkyFlyoutMessageType.Open,
501
+ });
502
+ if (this.config.settingsKey) {
503
+ this.uiConfigService
504
+ .getConfig(this.config.settingsKey)
505
+ .pipe(take(1))
506
+ .subscribe((value) => {
507
+ if (value && value.flyoutWidth) {
508
+ this.flyoutWidth = value.flyoutWidth;
509
+ }
510
+ else {
511
+ // Bad data, or config is the default config.
512
+ this.flyoutWidth = this.config.defaultWidth;
513
+ }
514
+ this.checkInitialSize();
515
+ });
516
+ }
517
+ else {
518
+ this.flyoutWidth = this.config.defaultWidth;
519
+ this.checkInitialSize();
520
+ }
521
+ return this.flyoutInstance;
522
+ }
523
+ close() {
524
+ this.messageStream.next({
525
+ type: SkyFlyoutMessageType.Close,
526
+ });
527
+ }
528
+ invokePrimaryAction() {
529
+ this.primaryAction.callback();
530
+ if (this.primaryAction.closeAfterInvoking) {
531
+ this.close();
532
+ }
533
+ return false;
534
+ }
535
+ getAnimationState() {
536
+ return this.instanceReady && this.isOpening
537
+ ? FLYOUT_OPEN_STATE
538
+ : FLYOUT_CLOSED_STATE;
539
+ }
540
+ animationDone(event) {
541
+ if (event.toState === FLYOUT_OPEN_STATE) {
542
+ this.isOpen = true;
543
+ }
544
+ if (event.toState === FLYOUT_CLOSED_STATE) {
545
+ this.isOpen = false;
546
+ this.notifyClosed();
547
+ this.cleanTemplate();
548
+ }
549
+ }
550
+ onHeaderGrabHandleMouseDown(event) {
551
+ this.onResizeHandleMouseDown(event);
552
+ }
553
+ onHeaderGrabHandleKeyDown(event) {
554
+ this.handleResizeKeyDown(event);
555
+ }
556
+ onResizeHandleKeyDown(event) {
557
+ this.handleResizeKeyDown(event);
558
+ }
559
+ onResizeHandleMouseDown(event) {
560
+ event.preventDefault();
561
+ event.stopPropagation();
562
+ if (this.isFullscreen) {
563
+ return;
564
+ }
565
+ this.isDragging = true;
566
+ this.xCoord = event.clientX;
567
+ this.adapter.toggleIframePointerEvents(false);
568
+ fromEvent(document, 'mousemove')
569
+ .pipe(takeWhile(() => {
570
+ return this.isDragging;
571
+ }))
572
+ .subscribe((moveEvent) => {
573
+ this.onMouseMove(moveEvent);
574
+ });
575
+ fromEvent(document, 'mouseup')
576
+ .pipe(takeWhile(() => {
577
+ return this.isDragging;
578
+ }))
579
+ .subscribe((mouseUpEvent) => {
580
+ this.onHandleRelease(mouseUpEvent);
581
+ });
582
+ }
583
+ onMouseMove(event) {
584
+ /* Sanity check */
585
+ /* istanbul ignore if */
586
+ if (!this.isDragging) {
587
+ return;
588
+ }
589
+ const offsetX = event.clientX - this.xCoord;
590
+ let width = this.flyoutWidth;
591
+ width -= offsetX;
592
+ if (width < this.config.minWidth || width > this.config.maxWidth) {
593
+ return;
594
+ }
595
+ if (window.innerWidth - width < this.windowBufferSize) {
596
+ width = window.innerWidth - this.windowBufferSize;
597
+ this.xCoord = this.windowBufferSize;
598
+ }
599
+ else {
600
+ this.xCoord = event.clientX;
601
+ }
602
+ this.flyoutWidth = width;
603
+ this.updateBreakpointAndResponsiveClass(this.flyoutWidth);
604
+ this.changeDetector.markForCheck();
605
+ }
606
+ onHandleRelease(event) {
607
+ fromEvent(document, 'click')
608
+ .pipe(take(1))
609
+ .subscribe(() => {
610
+ this.isDragging = false;
611
+ this.adapter.toggleIframePointerEvents(true);
612
+ this.setUserData();
613
+ });
614
+ }
615
+ onIteratorPreviousButtonClick() {
616
+ this.flyoutInstance.iteratorPreviousButtonClick.emit();
617
+ }
618
+ onIteratorNextButtonClick() {
619
+ this.flyoutInstance.iteratorNextButtonClick.emit();
620
+ }
621
+ createFlyoutInstance(component) {
622
+ const instance = new SkyFlyoutInstance();
623
+ instance.componentInstance = component;
624
+ instance.hostController
625
+ .pipe(takeUntil(this.ngUnsubscribe))
626
+ .subscribe((message) => {
627
+ this.messageStream.next(message);
628
+ });
629
+ return instance;
630
+ }
631
+ handleIncomingMessages(message) {
632
+ var _a;
633
+ /* tslint:disable-next-line:switch-default */
634
+ switch (message.type) {
635
+ case SkyFlyoutMessageType.Open:
636
+ if (!this.isOpen) {
637
+ this.isOpen = false;
638
+ this.isOpening = true;
639
+ }
640
+ this.initFocusTrap();
641
+ break;
642
+ case SkyFlyoutMessageType.Close:
643
+ if (this.flyoutInstance.beforeClose.observers.length ===
644
+ 0 ||
645
+ ((_a = message.data) === null || _a === void 0 ? void 0 : _a.ignoreBeforeClose)) {
646
+ this.isOpen = true;
647
+ this.isOpening = false;
648
+ }
649
+ else {
650
+ this.flyoutInstance.beforeClose.next(new SkyFlyoutBeforeCloseHandler(() => {
651
+ this.isOpen = true;
652
+ this.isOpening = false;
653
+ }));
654
+ }
655
+ break;
656
+ case SkyFlyoutMessageType.EnableIteratorNextButton:
657
+ this.config.iteratorNextButtonDisabled = false;
658
+ break;
659
+ case SkyFlyoutMessageType.EnableIteratorPreviousButton:
660
+ this.config.iteratorPreviousButtonDisabled = false;
661
+ break;
662
+ case SkyFlyoutMessageType.DisableIteratorNextButton:
663
+ this.config.iteratorNextButtonDisabled = true;
664
+ break;
665
+ case SkyFlyoutMessageType.DisableIteratorPreviousButton:
666
+ this.config.iteratorPreviousButtonDisabled = true;
667
+ break;
668
+ }
669
+ this.changeDetector.markForCheck();
670
+ }
671
+ notifyClosed() {
672
+ this.flyoutInstance.closed.emit();
673
+ this.flyoutInstance.closed.complete();
674
+ }
675
+ cleanTemplate() {
676
+ this.target.clear();
677
+ }
678
+ updateBreakpointAndResponsiveClass(width) {
679
+ this.flyoutMediaQueryService.setBreakpointForWidth(width);
680
+ const newBreakpiont = this.flyoutMediaQueryService.current;
681
+ this.adapter.setResponsiveClass(this.elementRef, newBreakpiont);
682
+ }
683
+ setFullscreen() {
684
+ if (window.innerWidth - this.windowBufferSize < this.config.minWidth) {
685
+ this.isFullscreen = true;
686
+ }
687
+ else {
688
+ this.isFullscreen = false;
689
+ }
690
+ }
691
+ setUserData() {
692
+ if (this.config.settingsKey) {
693
+ this.uiConfigService
694
+ .setConfig(this.config.settingsKey, {
695
+ flyoutWidth: this.flyoutWidth,
696
+ })
697
+ .pipe(take(1))
698
+ .subscribe(
699
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
700
+ () => { }, (err) => {
701
+ console.warn('Could not save flyout data.');
702
+ console.warn(err);
703
+ });
704
+ }
705
+ }
706
+ checkInitialSize() {
707
+ if (this.flyoutWidth < this.config.minWidth) {
708
+ this.flyoutWidth = this.config.minWidth;
709
+ this.setUserData();
710
+ }
711
+ else if (this.flyoutWidth > this.config.maxWidth) {
712
+ this.flyoutWidth = this.config.maxWidth;
713
+ this.setUserData();
714
+ }
715
+ // Ensure flyout does not load larger than the window and its buffer
716
+ if (window.innerWidth - this.flyoutWidth < this.windowBufferSize) {
717
+ this.flyoutWidth = window.innerWidth - this.windowBufferSize;
718
+ this.xCoord = this.windowBufferSize;
719
+ this.setUserData();
720
+ }
721
+ if (this.flyoutMediaQueryService.isWidthWithinBreakpiont(window.innerWidth, SkyMediaBreakpoints.xs)) {
722
+ this.updateBreakpointAndResponsiveClass(window.innerWidth);
723
+ }
724
+ else {
725
+ this.updateBreakpointAndResponsiveClass(this.flyoutWidth);
726
+ }
727
+ this.setFullscreen();
728
+ }
729
+ getString(key) {
730
+ // TODO: Need to implement the async `getString` method in a breaking change.
731
+ return this.resourcesService.getStringForLocale({ locale: 'en-US' }, key);
732
+ }
733
+ handleResizeKeyDown(event) {
734
+ /* istanbul ignore else */
735
+ if (event.key) {
736
+ const keyPressed = event.key.toLowerCase().replace('arrow', '');
737
+ switch (keyPressed) {
738
+ case 'enter':
739
+ case ' ':
740
+ this.resizeKeyControlActive = !this.resizeKeyControlActive;
741
+ break;
742
+ case 'tab':
743
+ /* istanbul ignore else */
744
+ if (this.resizeKeyControlActive) {
745
+ this.resizeKeyControlActive = false;
746
+ }
747
+ break;
748
+ case 'left':
749
+ if (this.resizeKeyControlActive) {
750
+ /* istanbul ignore else */
751
+ if (this.flyoutWidth < this.config.maxWidth) {
752
+ this.flyoutWidth = Math.min(this.flyoutWidth + this.widthStep, this.config.maxWidth);
753
+ }
754
+ }
755
+ break;
756
+ case 'right':
757
+ if (this.resizeKeyControlActive) {
758
+ /* istanbul ignore else */
759
+ if (this.flyoutWidth > this.config.minWidth) {
760
+ this.flyoutWidth = Math.max(this.flyoutWidth - this.widthStep, this.config.minWidth);
761
+ }
762
+ }
763
+ break;
764
+ /* istanbul ignore next */
765
+ default:
766
+ break;
767
+ }
768
+ }
769
+ }
770
+ /** Executes a function when the zone is stable. */
771
+ _executeOnStable(fn) {
772
+ if (this._ngZone.isStable) {
773
+ fn();
774
+ }
775
+ else {
776
+ this._ngZone.onStable.pipe(take(1)).subscribe(fn);
777
+ }
778
+ }
779
+ initFocusTrap() {
780
+ this.enableTrapFocusAutoCapture = false;
781
+ this.enableTrapFocus = false;
782
+ // Waiting for zone to be stable will avoid ExpressionChangeAfterCheckedError.
783
+ this._executeOnStable(() => {
784
+ this.enableTrapFocusAutoCapture = true;
785
+ this.enableTrapFocus = true;
786
+ });
787
+ }
788
+ }
789
+ SkyFlyoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", 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 });
790
+ SkyFlyoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyFlyoutComponent, selector: "sky-flyout", host: { listeners: { "window:resize": "onWindowResize($event)" } }, providers: [
791
+ SkyFlyoutAdapterService,
792
+ SkyFlyoutMediaQueryService,
793
+ { provide: SkyMediaQueryService, useExisting: SkyFlyoutMediaQueryService },
794
+ ], viewQueries: [{ propertyName: "flyoutRef", first: true, predicate: ["flyoutRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "flyoutCloseButton", first: true, predicate: ["flyoutCloseButton"], descendants: true, read: ElementRef, static: true }, { propertyName: "flyoutContent", first: true, predicate: ["flyoutContent"], descendants: true, read: ElementRef, static: true }, { propertyName: "flyoutHeader", first: true, predicate: ["flyoutHeader"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div\n class=\"sky-flyout\"\n tabindex=\"-1\"\n [attr.role]=\"config?.ariaRole ? config.ariaRole : 'dialog'\"\n [attr.aria-describedby]=\"config?.ariaDescribedBy\"\n [attr.aria-label]=\"config?.ariaLabel\"\n [attr.aria-labelledby]=\"config?.ariaLabelledBy\"\n [attr.aria-modal]=\"\n config?.ariaRole === 'dialog' || !config?.ariaRole ? true : false\n \"\n [attr.hidden]=\"!instanceReady ? true : undefined\"\n [id]=\"flyoutId\"\n [ngClass]=\"{\n 'sky-flyout-hidden': !isOpen && !isOpening,\n 'sky-flyout-fullscreen': isFullscreen\n }\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-elevation-8': 'modern'\n }\"\n (@flyoutState.done)=\"animationDone($event)\"\n [@flyoutState]=\"getAnimationState()\"\n [style.width.px]=\"flyoutWidth\"\n #flyoutRef\n [cdkTrapFocus]=\"enableTrapFocus\"\n [cdkTrapFocusAutoCapture]=\"enableTrapFocusAutoCapture\"\n>\n <div\n class=\"sky-flyout-header\"\n [skyThemeClass]=\"{\n 'sky-padding-squish-large': 'default'\n }\"\n #flyoutHeader\n >\n <div class=\"sky-flyout-header-content\">\n <button\n *skyThemeIf=\"'modern'\"\n class=\"sky-btn sky-btn-icon-borderless sky-margin-inline-sm sky-flyout-header-grab-handle\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n (keydown)=\"onHeaderGrabHandleKeyDown($event)\"\n (mousedown)=\"onHeaderGrabHandleMouseDown($event)\"\n >\n <sky-icon icon=\"tile-drag\" iconType=\"skyux\" size=\"lg\"> </sky-icon>\n </button>\n\n <sky-flyout-iterator\n *ngIf=\"config.showIterator\"\n [nextButtonDisabled]=\"config.iteratorNextButtonDisabled\"\n [previousButtonDisabled]=\"config.iteratorPreviousButtonDisabled\"\n (nextButtonClick)=\"onIteratorNextButtonClick()\"\n (previousButtonClick)=\"onIteratorPreviousButtonClick()\"\n >\n </sky-flyout-iterator>\n </div>\n <div class=\"sky-flyout-header-buttons\">\n <ng-container *ngTemplateOutlet=\"permalinkTemplate\"> </ng-container>\n <ng-container *ngTemplateOutlet=\"primaryActionTemplate\"> </ng-container>\n <button\n class=\"sky-btn sky-flyout-btn-close sky-label-icon-theme-default\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_flyout_close' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"close()\"\n #flyoutCloseButton\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"close\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n <div class=\"sky-flyout-content\" #flyoutContent>\n <div #target></div>\n </div>\n <div\n class=\"sky-flyout-resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n type=\"range\"\n [attr.aria-controls]=\"flyoutId\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n [attr.aria-valuemax]=\"config.maxWidth\"\n [attr.aria-valuemin]=\"config.minWidth\"\n [attr.aria-valuenow]=\"flyoutWidth\"\n (keydown)=\"onResizeHandleKeyDown($event)\"\n (mousedown)=\"onResizeHandleMouseDown($event)\"\n ></div>\n</div>\n\n<ng-template #permalinkTemplate>\n <ng-template [ngIf]=\"permalink\">\n <ng-template [ngIf]=\"permalink.url\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [skyHref]=\"permalink.url\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n <ng-template [ngIf]=\"permalink.route\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [routerLink]=\"permalink.route.commands\"\n [fragment]=\"permalink.route.extras?.fragment\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n [queryParams]=\"permalink.route.extras?.queryParams\"\n [queryParamsHandling]=\"permalink.route.extras?.queryParamsHandling\"\n [state]=\"permalink.route.extras?.state\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n </ng-template>\n</ng-template>\n\n<ng-template #primaryActionTemplate>\n <ng-template [ngIf]=\"primaryAction && primaryAction.callback\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-flyout-btn-primary-action sky-margin-inline-default\"\n (click)=\"invokePrimaryAction()\"\n >\n {{ primaryActionLabel }}\n </button>\n </ng-template>\n</ng-template>\n", styles: [".sky-flyout{position:fixed;right:0;top:0;bottom:0;height:100%;background-color:#fff;border-left:6px solid #0974a1;z-index:1001}.sky-flyout:focus{outline:none}.sky-flyout.sky-flyout-fullscreen{min-width:100%;max-width:100%}.sky-flyout.sky-flyout-fullscreen .sky-flyout-resize-handle{cursor:initial}.sky-flyout.sky-flyout-hidden{visibility:hidden}.sky-flyout .sky-flyout-input-aria-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0 0 0 0);outline:none}.sky-flyout-resize-handle{-webkit-appearance:none;-moz-appearance:none;height:100%;width:14px;position:absolute;left:-10px;cursor:ew-resize;padding:0;border:0;background:transparent;display:block;top:0;bottom:0;direction:rtl}.sky-flyout-resize-handle::-moz-range-thumb,.sky-flyout-resize-handle::-moz-range-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-ms-thumb,.sky-flyout-resize-handle::-ms-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-header{border-bottom:1px solid #cdcfd2;width:100%;background:#eeeeef;height:50px;display:flex;align-items:flex-start}.sky-flyout-header-content{flex-grow:1}.sky-flyout-btn-permalink:hover{text-decoration:none}.sky-flyout-help-shim{padding-right:8px}@media (min-width: 768px){.sky-flyout-help-shim{padding-right:50px}}.sky-flyout-content{overflow-y:auto;height:calc(100% - 50px)}:host-context(.sky-theme-modern) .sky-flyout{border-left:0}:host-context(.sky-theme-modern) .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}:host-context(.sky-theme-modern) .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}.sky-theme-modern .sky-flyout{border-left:0}.sky-theme-modern .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}.sky-theme-modern .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout{background:#000}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout-header{background:#000}.sky-theme-modern.sky-theme-mode-dark .sky-flyout,.sky-theme-modern.sky-theme-mode-dark .sky-flyout-header{background:#000}\n"], components: [{ type: i1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: SkyFlyoutIteratorComponent, selector: "sky-flyout-iterator", inputs: ["nextButtonDisabled", "previousButtonDisabled"], outputs: ["previousButtonClick", "nextButtonClick"] }], directives: [{ type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { type: i9.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { type: i2.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i10.λ1, selector: "[skyHref]", inputs: ["skyHref", "skyHrefElse"] }, { type: i2$2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }], pipes: { "skyLibResources": i2$1.SkyLibResourcesPipe }, animations: [
795
+ trigger('flyoutState', [
796
+ state(FLYOUT_OPEN_STATE, style({ transform: 'initial' })),
797
+ state(FLYOUT_CLOSED_STATE, style({ transform: 'translateX(100%)' })),
798
+ transition('void => *', [
799
+ style({ transform: 'translateX(100%)' }),
800
+ animate(250),
801
+ ]),
802
+ transition(`* <=> *`, animate('250ms ease-in')),
803
+ ]),
804
+ ], changeDetection: i0.ChangeDetectionStrategy.Default });
805
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutComponent, decorators: [{
806
+ type: Component,
807
+ args: [{ selector: 'sky-flyout', providers: [
808
+ SkyFlyoutAdapterService,
809
+ SkyFlyoutMediaQueryService,
810
+ { provide: SkyMediaQueryService, useExisting: SkyFlyoutMediaQueryService },
811
+ ], animations: [
812
+ trigger('flyoutState', [
813
+ state(FLYOUT_OPEN_STATE, style({ transform: 'initial' })),
814
+ state(FLYOUT_CLOSED_STATE, style({ transform: 'translateX(100%)' })),
815
+ transition('void => *', [
816
+ style({ transform: 'translateX(100%)' }),
817
+ animate(250),
818
+ ]),
819
+ transition(`* <=> *`, animate('250ms ease-in')),
820
+ ]),
821
+ ], changeDetection: ChangeDetectionStrategy.Default, template: "<div\n class=\"sky-flyout\"\n tabindex=\"-1\"\n [attr.role]=\"config?.ariaRole ? config.ariaRole : 'dialog'\"\n [attr.aria-describedby]=\"config?.ariaDescribedBy\"\n [attr.aria-label]=\"config?.ariaLabel\"\n [attr.aria-labelledby]=\"config?.ariaLabelledBy\"\n [attr.aria-modal]=\"\n config?.ariaRole === 'dialog' || !config?.ariaRole ? true : false\n \"\n [attr.hidden]=\"!instanceReady ? true : undefined\"\n [id]=\"flyoutId\"\n [ngClass]=\"{\n 'sky-flyout-hidden': !isOpen && !isOpening,\n 'sky-flyout-fullscreen': isFullscreen\n }\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-elevation-8': 'modern'\n }\"\n (@flyoutState.done)=\"animationDone($event)\"\n [@flyoutState]=\"getAnimationState()\"\n [style.width.px]=\"flyoutWidth\"\n #flyoutRef\n [cdkTrapFocus]=\"enableTrapFocus\"\n [cdkTrapFocusAutoCapture]=\"enableTrapFocusAutoCapture\"\n>\n <div\n class=\"sky-flyout-header\"\n [skyThemeClass]=\"{\n 'sky-padding-squish-large': 'default'\n }\"\n #flyoutHeader\n >\n <div class=\"sky-flyout-header-content\">\n <button\n *skyThemeIf=\"'modern'\"\n class=\"sky-btn sky-btn-icon-borderless sky-margin-inline-sm sky-flyout-header-grab-handle\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n (keydown)=\"onHeaderGrabHandleKeyDown($event)\"\n (mousedown)=\"onHeaderGrabHandleMouseDown($event)\"\n >\n <sky-icon icon=\"tile-drag\" iconType=\"skyux\" size=\"lg\"> </sky-icon>\n </button>\n\n <sky-flyout-iterator\n *ngIf=\"config.showIterator\"\n [nextButtonDisabled]=\"config.iteratorNextButtonDisabled\"\n [previousButtonDisabled]=\"config.iteratorPreviousButtonDisabled\"\n (nextButtonClick)=\"onIteratorNextButtonClick()\"\n (previousButtonClick)=\"onIteratorPreviousButtonClick()\"\n >\n </sky-flyout-iterator>\n </div>\n <div class=\"sky-flyout-header-buttons\">\n <ng-container *ngTemplateOutlet=\"permalinkTemplate\"> </ng-container>\n <ng-container *ngTemplateOutlet=\"primaryActionTemplate\"> </ng-container>\n <button\n class=\"sky-btn sky-flyout-btn-close sky-label-icon-theme-default\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_flyout_close' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"close()\"\n #flyoutCloseButton\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"close\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n <div class=\"sky-flyout-content\" #flyoutContent>\n <div #target></div>\n </div>\n <div\n class=\"sky-flyout-resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n type=\"range\"\n [attr.aria-controls]=\"flyoutId\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n [attr.aria-valuemax]=\"config.maxWidth\"\n [attr.aria-valuemin]=\"config.minWidth\"\n [attr.aria-valuenow]=\"flyoutWidth\"\n (keydown)=\"onResizeHandleKeyDown($event)\"\n (mousedown)=\"onResizeHandleMouseDown($event)\"\n ></div>\n</div>\n\n<ng-template #permalinkTemplate>\n <ng-template [ngIf]=\"permalink\">\n <ng-template [ngIf]=\"permalink.url\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [skyHref]=\"permalink.url\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n <ng-template [ngIf]=\"permalink.route\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [routerLink]=\"permalink.route.commands\"\n [fragment]=\"permalink.route.extras?.fragment\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n [queryParams]=\"permalink.route.extras?.queryParams\"\n [queryParamsHandling]=\"permalink.route.extras?.queryParamsHandling\"\n [state]=\"permalink.route.extras?.state\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n </ng-template>\n</ng-template>\n\n<ng-template #primaryActionTemplate>\n <ng-template [ngIf]=\"primaryAction && primaryAction.callback\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-flyout-btn-primary-action sky-margin-inline-default\"\n (click)=\"invokePrimaryAction()\"\n >\n {{ primaryActionLabel }}\n </button>\n </ng-template>\n</ng-template>\n", styles: [".sky-flyout{position:fixed;right:0;top:0;bottom:0;height:100%;background-color:#fff;border-left:6px solid #0974a1;z-index:1001}.sky-flyout:focus{outline:none}.sky-flyout.sky-flyout-fullscreen{min-width:100%;max-width:100%}.sky-flyout.sky-flyout-fullscreen .sky-flyout-resize-handle{cursor:initial}.sky-flyout.sky-flyout-hidden{visibility:hidden}.sky-flyout .sky-flyout-input-aria-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0 0 0 0);outline:none}.sky-flyout-resize-handle{-webkit-appearance:none;-moz-appearance:none;height:100%;width:14px;position:absolute;left:-10px;cursor:ew-resize;padding:0;border:0;background:transparent;display:block;top:0;bottom:0;direction:rtl}.sky-flyout-resize-handle::-moz-range-thumb,.sky-flyout-resize-handle::-moz-range-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-ms-thumb,.sky-flyout-resize-handle::-ms-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-header{border-bottom:1px solid #cdcfd2;width:100%;background:#eeeeef;height:50px;display:flex;align-items:flex-start}.sky-flyout-header-content{flex-grow:1}.sky-flyout-btn-permalink:hover{text-decoration:none}.sky-flyout-help-shim{padding-right:8px}@media (min-width: 768px){.sky-flyout-help-shim{padding-right:50px}}.sky-flyout-content{overflow-y:auto;height:calc(100% - 50px)}:host-context(.sky-theme-modern) .sky-flyout{border-left:0}:host-context(.sky-theme-modern) .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}:host-context(.sky-theme-modern) .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}.sky-theme-modern .sky-flyout{border-left:0}.sky-theme-modern .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}.sky-theme-modern .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout{background:#000}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout-header{background:#000}.sky-theme-modern.sky-theme-mode-dark .sky-flyout,.sky-theme-modern.sky-theme-mode-dark .sky-flyout-header{background:#000}\n"] }]
822
+ }], ctorParameters: function () { return [{ type: SkyFlyoutAdapterService }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }, { type: i2$1.SkyLibResourcesService }, { type: SkyFlyoutMediaQueryService }, { type: i0.ElementRef }, { type: i1$1.SkyUIConfigService }, { type: i0.NgZone }]; }, propDecorators: { flyoutRef: [{
823
+ type: ViewChild,
824
+ args: ['flyoutRef', {
825
+ read: ElementRef,
826
+ static: true,
827
+ }]
828
+ }], target: [{
829
+ type: ViewChild,
830
+ args: ['target', {
831
+ read: ViewContainerRef,
832
+ static: true,
833
+ }]
834
+ }], flyoutCloseButton: [{
835
+ type: ViewChild,
836
+ args: ['flyoutCloseButton', {
837
+ read: ElementRef,
838
+ static: true,
839
+ }]
840
+ }], flyoutContent: [{
841
+ type: ViewChild,
842
+ args: ['flyoutContent', {
843
+ read: ElementRef,
844
+ static: true,
845
+ }]
846
+ }], flyoutHeader: [{
847
+ type: ViewChild,
848
+ args: ['flyoutHeader', {
849
+ read: ElementRef,
850
+ static: true,
851
+ }]
852
+ }], onWindowResize: [{
853
+ type: HostListener,
854
+ args: ['window:resize', ['$event']]
855
+ }] } });
856
+
857
+ class SkyFlyoutModule {
858
+ }
859
+ SkyFlyoutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
860
+ SkyFlyoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutModule, declarations: [SkyFlyoutComponent, SkyFlyoutIteratorComponent], imports: [A11yModule,
861
+ CommonModule,
862
+ FormsModule,
863
+ RouterModule,
864
+ SkyI18nModule,
865
+ SkyIconModule,
866
+ SkyFlyoutResourcesModule,
867
+ SkyThemeModule,
868
+ SkyHrefModule], exports: [SkyFlyoutComponent] });
869
+ SkyFlyoutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutModule, imports: [[
870
+ A11yModule,
871
+ CommonModule,
872
+ FormsModule,
873
+ RouterModule,
874
+ SkyI18nModule,
875
+ SkyIconModule,
876
+ SkyFlyoutResourcesModule,
877
+ SkyThemeModule,
878
+ SkyHrefModule,
879
+ ]] });
880
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutModule, decorators: [{
881
+ type: NgModule,
882
+ args: [{
883
+ declarations: [SkyFlyoutComponent, SkyFlyoutIteratorComponent],
884
+ imports: [
885
+ A11yModule,
886
+ CommonModule,
887
+ FormsModule,
888
+ RouterModule,
889
+ SkyI18nModule,
890
+ SkyIconModule,
891
+ SkyFlyoutResourcesModule,
892
+ SkyThemeModule,
893
+ SkyHrefModule,
894
+ ],
895
+ exports: [SkyFlyoutComponent],
896
+ }]
897
+ }] });
898
+
899
+ /**
900
+ * Launches flyouts and provides a common look and feel.
901
+ * This service dynamically generates the flyout component and appends it directly to the
902
+ * document's `body` element. The `SkyFlyoutInstance` class watches for and triggers flyout events.
903
+ */
904
+ class SkyFlyoutService {
905
+ constructor(coreAdapter, windowRef, dynamicComponentService, router, _ngZone,
906
+ // NOTE: This used to be used for an `applicationRef.tick` which has since been removed.
907
+ // We can not remove this due to it being a breaking change for those manually constructing the service.
908
+ applicationRef) {
909
+ this.coreAdapter = coreAdapter;
910
+ this.windowRef = windowRef;
911
+ this.dynamicComponentService = dynamicComponentService;
912
+ this.router = router;
913
+ this._ngZone = _ngZone;
914
+ this.applicationRef = applicationRef;
915
+ this.removeAfterClosed = false;
916
+ this.isOpening = false;
917
+ this.ngUnsubscribe = new Subject();
918
+ }
919
+ ngOnDestroy() {
920
+ this.removeListners();
921
+ if (this.host) {
922
+ this.removeHostComponent();
923
+ }
924
+ }
925
+ /**
926
+ * Closes the flyout. This method also removes the flyout's HTML elements from the DOM.
927
+ * @param args Arguments used when closing the flyout.
928
+ */
929
+ close(args) {
930
+ if (this.host && !this.isOpening) {
931
+ this.host.instance.messageStream.next({
932
+ type: SkyFlyoutMessageType.Close,
933
+ data: {
934
+ ignoreBeforeClose: args ? args.ignoreBeforeClose : false,
935
+ },
936
+ });
937
+ }
938
+ }
939
+ /**
940
+ * Opens a flyout and displays the specified component.
941
+ * @param component Specifies the component to render.
942
+ * @param config Specifies the flyout configuration passed to the specified component's constructor.
943
+ */
944
+ open(component, config) {
945
+ // isOpening flag will prevent close() from firing when open() is also fired.
946
+ this.isOpening = true;
947
+ this.windowRef.nativeWindow.setTimeout(() => {
948
+ this.isOpening = false;
949
+ });
950
+ if (!this.host) {
951
+ this.host = this.createHostComponent();
952
+ this.router.events
953
+ .pipe(takeWhile(() => this.host !== undefined))
954
+ .subscribe((event) => {
955
+ if (event instanceof NavigationStart) {
956
+ this.close();
957
+ // Sanity check - if the host still exists after animations should have completed - remove host
958
+ this._ngZone.onStable.pipe(take(1)).subscribe(() => {
959
+ if (this.host) {
960
+ this.removeHostComponent();
961
+ }
962
+ });
963
+ }
964
+ });
965
+ }
966
+ const flyout = this.host.instance.attach(component, config);
967
+ this.addListeners(flyout);
968
+ return flyout;
969
+ }
970
+ createHostComponent() {
971
+ this.host =
972
+ this.dynamicComponentService.createComponent(SkyFlyoutComponent);
973
+ return this.host;
974
+ }
975
+ removeHostComponent() {
976
+ if (this.host) {
977
+ this.dynamicComponentService.removeComponent(this.host);
978
+ this.host = undefined;
979
+ }
980
+ }
981
+ addListeners(flyout) {
982
+ /* istanbul ignore else */
983
+ if (this.host) {
984
+ const flyoutInstance = this.host.instance;
985
+ let doClose = false;
986
+ /**
987
+ * Handles when to close a flyout.
988
+ * Note: We're using `mouseup` in order to capture the parent of certain targets that will be
989
+ * deleted immediately after being clicked. If we use `click`, the event is fired after the
990
+ * element is removed from the DOM making it impossible to check the parent's z-index
991
+ * relative to the flyout's container.
992
+ */
993
+ fromEvent(document, 'mouseup')
994
+ .pipe(takeUntil(this.ngUnsubscribe))
995
+ .subscribe((event) => {
996
+ doClose = false;
997
+ if (this.host.instance.isDragging) {
998
+ return;
999
+ }
1000
+ if (flyoutInstance.flyoutRef.nativeElement.contains(event.target)) {
1001
+ return;
1002
+ }
1003
+ const isAbove = event.target === document
1004
+ ? false
1005
+ : this.coreAdapter.isTargetAboveElement(event.target, flyoutInstance.flyoutRef.nativeElement);
1006
+ /* istanbul ignore else */
1007
+ if (!isAbove) {
1008
+ doClose = true;
1009
+ }
1010
+ });
1011
+ /**
1012
+ * Check if we should close the flyout specifically on a `click` event so that we can keep
1013
+ * it open when consumers fire another `click` event on a trigger button. Since the consumer
1014
+ * will likely use a `click` event to open the flyout, we want to wait for that event to fire
1015
+ * before determining if the flyout should be closed.
1016
+ */
1017
+ fromEvent(document, 'click')
1018
+ .pipe(takeUntil(this.ngUnsubscribe))
1019
+ .subscribe(() => {
1020
+ if (doClose) {
1021
+ this.close();
1022
+ }
1023
+ });
1024
+ this.removeAfterClosed = false;
1025
+ flyoutInstance.messageStream
1026
+ .pipe(takeUntil(this.ngUnsubscribe))
1027
+ .subscribe((message) => {
1028
+ if (message.type === SkyFlyoutMessageType.Close) {
1029
+ this.removeAfterClosed = true;
1030
+ this.isOpening = false;
1031
+ }
1032
+ });
1033
+ flyout.closed.pipe(take(1)).subscribe(() => {
1034
+ this.removeListners();
1035
+ if (this.removeAfterClosed) {
1036
+ this.removeHostComponent();
1037
+ }
1038
+ });
1039
+ }
1040
+ }
1041
+ removeListners() {
1042
+ this.ngUnsubscribe.next(true);
1043
+ this.ngUnsubscribe.unsubscribe();
1044
+ this.ngUnsubscribe = new Subject();
1045
+ }
1046
+ }
1047
+ SkyFlyoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutService, deps: [{ token: i1$1.SkyCoreAdapterService }, { token: i1$1.SkyAppWindowRef }, { token: i1$1.SkyDynamicComponentService }, { token: i2$2.Router }, { token: i0.NgZone }, { token: i0.ApplicationRef, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1048
+ SkyFlyoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutService, providedIn: 'any' });
1049
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFlyoutService, decorators: [{
1050
+ type: Injectable,
1051
+ args: [{
1052
+ providedIn: 'any',
1053
+ }]
1054
+ }], ctorParameters: function () {
1055
+ return [{ type: i1$1.SkyCoreAdapterService }, { type: i1$1.SkyAppWindowRef }, { type: i1$1.SkyDynamicComponentService }, { type: i2$2.Router }, { type: i0.NgZone }, { type: i0.ApplicationRef, decorators: [{
1056
+ type: Optional
1057
+ }] }];
1058
+ } });
1059
+
1060
+ /**
1061
+ * Generated bundle index. Do not edit.
1062
+ */
1063
+
1064
+ export { SkyFlyoutBeforeCloseHandler, SkyFlyoutInstance, SkyFlyoutMessageType, SkyFlyoutModule, SkyFlyoutService, SkyFlyoutComponent as λ1 };
1065
+ //# sourceMappingURL=skyux-flyout.mjs.map