@skyux/modals 8.6.0 → 9.0.0-alpha.0

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 (75) hide show
  1. package/documentation.json +4 -4
  2. package/esm2022/lib/modules/confirm/confirm.component.mjs +112 -0
  3. package/{esm2020 → esm2022}/lib/modules/confirm/confirm.module.mjs +13 -13
  4. package/esm2022/lib/modules/confirm/confirm.service.mjs +54 -0
  5. package/esm2022/lib/modules/modal/modal-adapter.service.mjs +99 -0
  6. package/esm2022/lib/modules/modal/modal-component-adapter.service.mjs +101 -0
  7. package/{esm2020 → esm2022}/lib/modules/modal/modal-configuration.mjs +4 -4
  8. package/{esm2020 → esm2022}/lib/modules/modal/modal-content.component.mjs +4 -4
  9. package/esm2022/lib/modules/modal/modal-errors.service.mjs +21 -0
  10. package/{esm2020 → esm2022}/lib/modules/modal/modal-footer.component.mjs +4 -4
  11. package/{esm2020 → esm2022}/lib/modules/modal/modal-header.component.mjs +4 -4
  12. package/{esm2020 → esm2022}/lib/modules/modal/modal-host-context.mjs +4 -4
  13. package/esm2022/lib/modules/modal/modal-host.component.mjs +163 -0
  14. package/esm2022/lib/modules/modal/modal-host.service.mjs +62 -0
  15. package/esm2022/lib/modules/modal/modal-instance.mjs +123 -0
  16. package/esm2022/lib/modules/modal/modal-is-dirty.directive.mjs +94 -0
  17. package/esm2022/lib/modules/modal/modal-scroll-shadow.directive.mjs +129 -0
  18. package/esm2022/lib/modules/modal/modal.component.mjs +229 -0
  19. package/{esm2020 → esm2022}/lib/modules/modal/modal.module.mjs +29 -29
  20. package/esm2022/lib/modules/modal/modal.service.mjs +97 -0
  21. package/esm2022/lib/modules/shared/sky-modals-resources.module.mjs +61 -0
  22. package/esm2022/testing/confirm/confirm-button-harness.mjs +46 -0
  23. package/esm2022/testing/confirm/confirm-harness.mjs +90 -0
  24. package/esm2022/testing/modal/modal-harness.mjs +75 -0
  25. package/esm2022/testing/modal-fixture.mjs +143 -0
  26. package/{fesm2020 → fesm2022}/skyux-modals-testing.mjs +60 -73
  27. package/{fesm2020 → fesm2022}/skyux-modals-testing.mjs.map +1 -1
  28. package/fesm2022/skyux-modals.mjs +1502 -0
  29. package/{fesm2015 → fesm2022}/skyux-modals.mjs.map +1 -1
  30. package/lib/modules/modal/modal-is-dirty.directive.d.ts +1 -1
  31. package/lib/modules/modal/modal.component.d.ts +1 -1
  32. package/package.json +16 -24
  33. package/esm2020/lib/modules/confirm/confirm.component.mjs +0 -114
  34. package/esm2020/lib/modules/confirm/confirm.service.mjs +0 -57
  35. package/esm2020/lib/modules/modal/modal-adapter.service.mjs +0 -101
  36. package/esm2020/lib/modules/modal/modal-component-adapter.service.mjs +0 -104
  37. package/esm2020/lib/modules/modal/modal-errors.service.mjs +0 -24
  38. package/esm2020/lib/modules/modal/modal-host.component.mjs +0 -164
  39. package/esm2020/lib/modules/modal/modal-host.service.mjs +0 -65
  40. package/esm2020/lib/modules/modal/modal-instance.mjs +0 -127
  41. package/esm2020/lib/modules/modal/modal-is-dirty.directive.mjs +0 -93
  42. package/esm2020/lib/modules/modal/modal-scroll-shadow.directive.mjs +0 -127
  43. package/esm2020/lib/modules/modal/modal.component.mjs +0 -228
  44. package/esm2020/lib/modules/modal/modal.service.mjs +0 -99
  45. package/esm2020/lib/modules/shared/sky-modals-resources.module.mjs +0 -61
  46. package/esm2020/testing/confirm/confirm-button-harness.mjs +0 -46
  47. package/esm2020/testing/confirm/confirm-harness.mjs +0 -97
  48. package/esm2020/testing/modal/modal-harness.mjs +0 -81
  49. package/esm2020/testing/modal-fixture.mjs +0 -145
  50. package/fesm2015/skyux-modals-testing.mjs +0 -409
  51. package/fesm2015/skyux-modals-testing.mjs.map +0 -1
  52. package/fesm2015/skyux-modals.mjs +0 -1522
  53. package/fesm2020/skyux-modals.mjs +0 -1510
  54. package/fesm2020/skyux-modals.mjs.map +0 -1
  55. /package/{esm2020 → esm2022}/index.mjs +0 -0
  56. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button-action.mjs +0 -0
  57. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button-config.mjs +0 -0
  58. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button-style-type.mjs +0 -0
  59. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button.mjs +0 -0
  60. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-closed-event-args.mjs +0 -0
  61. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-config-token.mjs +0 -0
  62. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-config.mjs +0 -0
  63. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-instance.mjs +0 -0
  64. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-type.mjs +0 -0
  65. /package/{esm2020 → esm2022}/lib/modules/modal/modal-before-close-handler.mjs +0 -0
  66. /package/{esm2020 → esm2022}/lib/modules/modal/modal-close-args.mjs +0 -0
  67. /package/{esm2020 → esm2022}/lib/modules/modal/modal-error.mjs +0 -0
  68. /package/{esm2020 → esm2022}/lib/modules/modal/modal-host-context-args.mjs +0 -0
  69. /package/{esm2020 → esm2022}/lib/modules/modal/modal-scroll-shadow-event-args.mjs +0 -0
  70. /package/{esm2020 → esm2022}/lib/modules/modal/modal.interface.mjs +0 -0
  71. /package/{esm2020 → esm2022}/skyux-modals.mjs +0 -0
  72. /package/{esm2020 → esm2022}/testing/confirm/confirm-button-harness-filters.mjs +0 -0
  73. /package/{esm2020 → esm2022}/testing/modal/modal-harness-filters.mjs +0 -0
  74. /package/{esm2020 → esm2022}/testing/public-api.mjs +0 -0
  75. /package/{esm2020 → esm2022}/testing/skyux-modals-testing.mjs +0 -0
@@ -1,1522 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, NgModule, Component, ViewEncapsulation, Injectable, inject, Inject, Injector, ViewContainerRef, Optional, ViewChild, InjectionToken, Directive, Output, HostListener, ChangeDetectorRef, ElementRef, Host, HostBinding, Input } from '@angular/core';
3
- import * as i1 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import * as i3 from '@skyux/core';
6
- import { SkyMediaQueryService, SkyResizeObserverMediaQueryService, SKY_STACKING_CONTEXT, SkyLiveAnnouncerService, SkyDockLocation, SkyDockService, SkyIdModule, SkyTrimModule } from '@skyux/core';
7
- import * as i2$1 from '@skyux/theme';
8
- import { SkyTheme, SkyThemeModule } from '@skyux/theme';
9
- import * as i3$1 from '@angular/router';
10
- import { NavigationStart, RouterModule } from '@angular/router';
11
- import * as i2 from '@skyux/indicators';
12
- import { SkyIconModule, SkyStatusIndicatorModule } from '@skyux/indicators';
13
- import * as i2$2 from '@skyux/i18n';
14
- import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS, SkyLibResourcesService } from '@skyux/i18n';
15
- import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
16
- import { BehaviorSubject, Subject, ReplaySubject } from 'rxjs';
17
- import { takeUntil, takeWhile, take } from 'rxjs/operators';
18
-
19
- class SkyConfirmInstance {
20
- constructor() {
21
- /**
22
- * Fires when users select an action to close the dialog. This event
23
- * returns a `SkyConfirmCloseEventArgs` object with information about the button that
24
- * users select. It returns the `'cancel'` action when users press the <kbd>Escape</kbd> key.
25
- */
26
- this.closed = new EventEmitter();
27
- }
28
- }
29
-
30
- var SkyConfirmType;
31
- (function (SkyConfirmType) {
32
- /**
33
- * Allows you to define your own buttons using the `buttons` property of `SkyConfirmConfig`.
34
- */
35
- SkyConfirmType[SkyConfirmType["Custom"] = 0] = "Custom";
36
- /**
37
- * Displays one button with an **OK** label and an `'ok'` action.
38
- */
39
- SkyConfirmType[SkyConfirmType["OK"] = 1] = "OK";
40
- /**
41
- * Displays two buttons with **Yes** and **Cancel** labels.
42
- * @deprecated Use the `Custom` type to follow the guidance that labels
43
- * should clearly indicate the actions that occur when users select buttons.
44
- */
45
- SkyConfirmType[SkyConfirmType["YesCancel"] = 2] = "YesCancel";
46
- /**
47
- * Displays three buttons with **Yes**, **No**, and **Cancel** labels.
48
- * @deprecated Use the `Custom` type to follow the guidance that labels
49
- * should clearly indicate the actions that occur when users select buttons.
50
- */
51
- SkyConfirmType[SkyConfirmType["YesNoCancel"] = 3] = "YesNoCancel";
52
- })(SkyConfirmType || (SkyConfirmType = {}));
53
-
54
- /**
55
- * NOTICE: DO NOT MODIFY THIS FILE!
56
- * The contents of this file were automatically generated by
57
- * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-modals' schematic.
58
- * To update this file, simply rerun the command.
59
- */
60
- const RESOURCES = {
61
- 'EN-US': {
62
- skyux_confirm_dialog_default_ok_text: { message: 'OK' },
63
- skyux_confirm_dialog_default_yes_text: { message: 'Yes' },
64
- skyux_confirm_dialog_default_no_text: { message: 'No' },
65
- skyux_confirm_dialog_default_cancel_text: { message: 'Cancel' },
66
- skyux_modal_close: { message: 'Close modal' },
67
- skyux_modal_open_help: { message: 'Open Help' },
68
- skyux_modal_footer_cancel_button: { message: 'Cancel' },
69
- skyux_modal_footer_primary_button: { message: 'Save' },
70
- skyux_modal_dirty_default_message: {
71
- message: 'Are you sure you want to discard your changes?',
72
- },
73
- skyux_modal_dirty_default_discard_changes_text: {
74
- message: 'Discard changes',
75
- },
76
- skyux_modal_dirty_default_keep_working_text: { message: 'Keep working' },
77
- },
78
- };
79
- class SkyModalsResourcesProvider {
80
- getString(localeInfo, name) {
81
- return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
82
- }
83
- }
84
- /**
85
- * Import into any component library module that needs to use resource strings.
86
- */
87
- class SkyModalsResourcesModule {
88
- }
89
- SkyModalsResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
90
- SkyModalsResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyModalsResourcesModule, exports: [SkyI18nModule] });
91
- SkyModalsResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalsResourcesModule, providers: [
92
- {
93
- provide: SKY_LIB_RESOURCES_PROVIDERS,
94
- useClass: SkyModalsResourcesProvider,
95
- multi: true,
96
- },
97
- ], imports: [SkyI18nModule] });
98
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalsResourcesModule, decorators: [{
99
- type: NgModule,
100
- args: [{
101
- exports: [SkyI18nModule],
102
- providers: [
103
- {
104
- provide: SKY_LIB_RESOURCES_PROVIDERS,
105
- useClass: SkyModalsResourcesProvider,
106
- multi: true,
107
- },
108
- ],
109
- }]
110
- }] });
111
-
112
- /**
113
- * Specifies content to display in the modal's body.
114
- */
115
- class SkyModalContentComponent {
116
- }
117
- SkyModalContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
118
- SkyModalContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SkyModalContentComponent, selector: "sky-modal-content", ngImport: i0, template: "<ng-content></ng-content>\n", styles: ["sky-modal-content{display:block;min-height:100%}.sky-theme-modern sky-modal-content{padding:10px 30px 30px}\n"], encapsulation: i0.ViewEncapsulation.None });
119
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalContentComponent, decorators: [{
120
- type: Component,
121
- args: [{ selector: 'sky-modal-content', encapsulation: ViewEncapsulation.None, template: "<ng-content></ng-content>\n", styles: ["sky-modal-content{display:block;min-height:100%}.sky-theme-modern sky-modal-content{padding:10px 30px 30px}\n"] }]
122
- }] });
123
-
124
- var _SkyModalErrorsService_formErrors;
125
- /**
126
- * @internal
127
- */
128
- class SkyModalErrorsService {
129
- constructor() {
130
- _SkyModalErrorsService_formErrors.set(this, new BehaviorSubject(undefined));
131
- this.formErrors = __classPrivateFieldGet(this, _SkyModalErrorsService_formErrors, "f").asObservable();
132
- }
133
- updateErrors(value) {
134
- __classPrivateFieldGet(this, _SkyModalErrorsService_formErrors, "f").next(value);
135
- }
136
- }
137
- _SkyModalErrorsService_formErrors = new WeakMap();
138
- SkyModalErrorsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalErrorsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
139
- SkyModalErrorsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalErrorsService });
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalErrorsService, decorators: [{
141
- type: Injectable
142
- }], ctorParameters: function () { return []; } });
143
-
144
- /**
145
- * Specifies content to display in the modal's footer.
146
- */
147
- class SkyModalFooterComponent {
148
- constructor() {
149
- this.errorsSvc = inject(SkyModalErrorsService);
150
- }
151
- }
152
- SkyModalFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
153
- SkyModalFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SkyModalFooterComponent, selector: "sky-modal-footer", ngImport: i0, template: "<div class=\"sky-modal-footer-container sky-padding-even-large\">\n <div aria-live=\"polite\">\n <div\n *ngIf=\"errorsSvc.formErrors | async as formErrors\"\n class=\"sky-modal-footer-errors sky-margin-stacked-lg\"\n >\n <sky-status-indicator\n *ngFor=\"let formError of formErrors\"\n [ngClass]=\"{\n 'sky-margin-stacked-lg':\n formErrors.indexOf(formError) < formErrors.length - 1,\n 'footer-error': true\n }\"\n descriptionType=\"error\"\n indicatorType=\"danger\"\n >\n {{ formError.message }}\n </sky-status-indicator>\n </div>\n </div>\n <ng-content></ng-content>\n</div>\n", styles: [".sky-modal-footer-container{background-color:#fff;border-top:1px solid #e2e3e4}.sky-modal-footer-container .sky-btn-link:first-child{margin-left:-12px}.sky-modal-footer-container .sky-btn+.sky-btn{margin-left:10px}.sky-modal-footer-container .sky-btn+.sky-btn-link{margin-left:-2px}.sky-modal-footer-container .sky-modal-footer-errors{max-height:100px;overflow-y:auto}.sky-modal-footer-container .sky-modal-footer-errors .footer-error{display:block}.sky-theme-modern .sky-modal-footer-container{border-top:none;padding:20px 30px}.sky-theme-modern .sky-modal-footer-container .sky-btn-link:first-child{margin-left:0}.sky-theme-modern .sky-modal-footer-container .sky-btn+.sky-btn-link{margin-left:var(--sky-compat-modal-footer-adjacent-btn-btn-link-margin, 10px)}.sky-theme-modern-dark .sky-modal-footer-container{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.λ10, selector: "sky-status-indicator", inputs: ["indicatorType", "descriptionType", "customDescription"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
154
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalFooterComponent, decorators: [{
155
- type: Component,
156
- args: [{ selector: 'sky-modal-footer', encapsulation: ViewEncapsulation.None, template: "<div class=\"sky-modal-footer-container sky-padding-even-large\">\n <div aria-live=\"polite\">\n <div\n *ngIf=\"errorsSvc.formErrors | async as formErrors\"\n class=\"sky-modal-footer-errors sky-margin-stacked-lg\"\n >\n <sky-status-indicator\n *ngFor=\"let formError of formErrors\"\n [ngClass]=\"{\n 'sky-margin-stacked-lg':\n formErrors.indexOf(formError) < formErrors.length - 1,\n 'footer-error': true\n }\"\n descriptionType=\"error\"\n indicatorType=\"danger\"\n >\n {{ formError.message }}\n </sky-status-indicator>\n </div>\n </div>\n <ng-content></ng-content>\n</div>\n", styles: [".sky-modal-footer-container{background-color:#fff;border-top:1px solid #e2e3e4}.sky-modal-footer-container .sky-btn-link:first-child{margin-left:-12px}.sky-modal-footer-container .sky-btn+.sky-btn{margin-left:10px}.sky-modal-footer-container .sky-btn+.sky-btn-link{margin-left:-2px}.sky-modal-footer-container .sky-modal-footer-errors{max-height:100px;overflow-y:auto}.sky-modal-footer-container .sky-modal-footer-errors .footer-error{display:block}.sky-theme-modern .sky-modal-footer-container{border-top:none;padding:20px 30px}.sky-theme-modern .sky-modal-footer-container .sky-btn-link:first-child{margin-left:0}.sky-theme-modern .sky-modal-footer-container .sky-btn+.sky-btn-link{margin-left:var(--sky-compat-modal-footer-adjacent-btn-btn-link-margin, 10px)}.sky-theme-modern-dark .sky-modal-footer-container{background-color:transparent}\n"] }]
157
- }] });
158
-
159
- /**
160
- * Specifies a header for the modal.
161
- */
162
- class SkyModalHeaderComponent {
163
- }
164
- SkyModalHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
165
- SkyModalHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SkyModalHeaderComponent, selector: "sky-modal-header", ngImport: i0, template: "<h2\n class=\"sky-font-emphasized\"\n [skyThemeClass]=\"{\n 'sky-font-heading-4': 'default',\n 'sky-font-display-3': 'modern'\n }\"\n skyTrim\n>\n <ng-content></ng-content>\n</h2>\n<span class=\"sky-control-help-container\" skyTrim\n ><ng-content select=\".sky-control-help\"></ng-content\n></span>\n", styles: ["h2{margin:0;line-height:1.2;display:inline}:host-context(.sky-theme-modern.sky-theme-mode-dark) h2{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark h2{color:#fbfcfe}\n"], dependencies: [{ kind: "directive", type: i2$1.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { kind: "directive", type: i3.λ4, selector: "[skyTrim]" }] });
166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHeaderComponent, decorators: [{
167
- type: Component,
168
- args: [{ selector: 'sky-modal-header', template: "<h2\n class=\"sky-font-emphasized\"\n [skyThemeClass]=\"{\n 'sky-font-heading-4': 'default',\n 'sky-font-display-3': 'modern'\n }\"\n skyTrim\n>\n <ng-content></ng-content>\n</h2>\n<span class=\"sky-control-help-container\" skyTrim\n ><ng-content select=\".sky-control-help\"></ng-content\n></span>\n", styles: ["h2{margin:0;line-height:1.2;display:inline}:host-context(.sky-theme-modern.sky-theme-mode-dark) h2{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark h2{color:#fbfcfe}\n"] }]
169
- }] });
170
-
171
- var _SkyModalAdapterService_instances, _SkyModalAdapterService_docRef, _SkyModalAdapterService_bodyEl, _SkyModalAdapterService_windowRef, _SkyModalAdapterService_hostSiblingAriaHiddenCache, _SkyModalAdapterService_addClassToBody, _SkyModalAdapterService_removeClassFromBody;
172
- /**
173
- * @internal
174
- */
175
- class SkyModalAdapterService {
176
- constructor(windowRef) {
177
- _SkyModalAdapterService_instances.add(this);
178
- _SkyModalAdapterService_docRef.set(this, void 0);
179
- _SkyModalAdapterService_bodyEl.set(this, void 0);
180
- _SkyModalAdapterService_windowRef.set(this, void 0);
181
- _SkyModalAdapterService_hostSiblingAriaHiddenCache.set(this, new Map());
182
- __classPrivateFieldSet(this, _SkyModalAdapterService_windowRef, windowRef, "f");
183
- __classPrivateFieldSet(this, _SkyModalAdapterService_docRef, __classPrivateFieldGet(this, _SkyModalAdapterService_windowRef, "f").nativeWindow.document, "f");
184
- __classPrivateFieldSet(this, _SkyModalAdapterService_bodyEl, __classPrivateFieldGet(this, _SkyModalAdapterService_windowRef, "f").nativeWindow.document.body, "f");
185
- }
186
- toggleFullPageModalClass(isAddFull) {
187
- if (isAddFull) {
188
- __classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_addClassToBody).call(this, SkyModalAdapterService.MODAL_BODY_FULL_CLASS);
189
- }
190
- else {
191
- __classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_removeClassFromBody).call(this, SkyModalAdapterService.MODAL_BODY_FULL_CLASS);
192
- }
193
- }
194
- setPageScroll(isAdd) {
195
- if (isAdd) {
196
- __classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_addClassToBody).call(this, SkyModalAdapterService.MODAL_BODY_CLASS);
197
- }
198
- else {
199
- __classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_removeClassFromBody).call(this, SkyModalAdapterService.MODAL_BODY_CLASS);
200
- }
201
- }
202
- getModalOpener() {
203
- return __classPrivateFieldGet(this, _SkyModalAdapterService_docRef, "f").activeElement;
204
- }
205
- scrollContentToTop(element) {
206
- element.nativeElement.querySelector('.sky-modal-content').scrollTop = 0;
207
- }
208
- /**
209
- * Hides siblings of modal-host from screen readers
210
- * @param hostElRef reference to modal-host element
211
- */
212
- hideHostSiblingsFromScreenReaders(hostElRef) {
213
- const hostElement = hostElRef.nativeElement;
214
- const hostSiblings = hostElement.parentElement.children;
215
- for (let i = 0; i < hostSiblings.length; i++) {
216
- const element = hostSiblings[i];
217
- if (element !== hostElement &&
218
- !element.hasAttribute('aria-live') &&
219
- element.nodeName.toLowerCase() !== 'script' &&
220
- element.nodeName.toLowerCase() !== 'style') {
221
- // preserve previous aria-hidden status of elements outside of modal host
222
- __classPrivateFieldGet(this, _SkyModalAdapterService_hostSiblingAriaHiddenCache, "f").set(element, element.getAttribute('aria-hidden'));
223
- element.setAttribute('aria-hidden', 'true');
224
- }
225
- }
226
- }
227
- /**
228
- * Restores modal-host siblings to screen reader status prior to modals being opened
229
- */
230
- unhideOrRestoreHostSiblingsFromScreenReaders() {
231
- __classPrivateFieldGet(this, _SkyModalAdapterService_hostSiblingAriaHiddenCache, "f").forEach((previousValue, element) => {
232
- // if element had aria-hidden status prior, restore status
233
- if (element.parentElement) {
234
- if (previousValue) {
235
- element.setAttribute('aria-hidden', previousValue);
236
- }
237
- else {
238
- element.removeAttribute('aria-hidden');
239
- }
240
- }
241
- });
242
- __classPrivateFieldGet(this, _SkyModalAdapterService_hostSiblingAriaHiddenCache, "f").clear();
243
- }
244
- hidePreviousModalFromScreenReaders(topModal) {
245
- if (topModal && topModal.nativeElement.previousElementSibling) {
246
- topModal.nativeElement.previousElementSibling.setAttribute('aria-hidden', 'true');
247
- }
248
- }
249
- unhidePreviousModalFromScreenReaders(topModal) {
250
- if (topModal && topModal.nativeElement.previousElementSibling) {
251
- topModal.nativeElement.previousElementSibling.removeAttribute('aria-hidden');
252
- }
253
- }
254
- }
255
- _SkyModalAdapterService_docRef = new WeakMap(), _SkyModalAdapterService_bodyEl = new WeakMap(), _SkyModalAdapterService_windowRef = new WeakMap(), _SkyModalAdapterService_hostSiblingAriaHiddenCache = new WeakMap(), _SkyModalAdapterService_instances = new WeakSet(), _SkyModalAdapterService_addClassToBody = function _SkyModalAdapterService_addClassToBody(className) {
256
- __classPrivateFieldGet(this, _SkyModalAdapterService_bodyEl, "f").classList.add(className);
257
- }, _SkyModalAdapterService_removeClassFromBody = function _SkyModalAdapterService_removeClassFromBody(className) {
258
- __classPrivateFieldGet(this, _SkyModalAdapterService_bodyEl, "f").classList.remove(className);
259
- };
260
- SkyModalAdapterService.MODAL_BODY_FULL_CLASS = 'sky-modal-body-full-page';
261
- SkyModalAdapterService.MODAL_BODY_CLASS = 'sky-modal-body-open';
262
- SkyModalAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalAdapterService, deps: [{ token: i3.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
263
- SkyModalAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalAdapterService });
264
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalAdapterService, decorators: [{
265
- type: Injectable
266
- }], ctorParameters: function () { return [{ type: i3.SkyAppWindowRef }]; } });
267
-
268
- /**
269
- * @internal
270
- */
271
- class SkyModalConfiguration {
272
- constructor() {
273
- this.size = 'medium';
274
- }
275
- }
276
- SkyModalConfiguration.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
277
- SkyModalConfiguration.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalConfiguration, providedIn: 'any' });
278
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalConfiguration, decorators: [{
279
- type: Injectable,
280
- args: [{
281
- providedIn: 'any',
282
- }]
283
- }], ctorParameters: function () { return []; } });
284
-
285
- var _SkyModalHostService_instances, _SkyModalHostService_calculateZIndex;
286
- const BASE_Z_INDEX = 1040;
287
- const modalHosts = [];
288
- /**
289
- * @internal
290
- * @dynamic
291
- */
292
- class SkyModalHostService {
293
- static get openModalCount() {
294
- return modalHosts.length;
295
- }
296
- static get fullPageModalCount() {
297
- const fullPageModals = modalHosts.filter((modal) => modal.fullPage);
298
- return fullPageModals.length;
299
- }
300
- static get backdropZIndex() {
301
- return BASE_Z_INDEX + modalHosts.length * 10;
302
- }
303
- static get topModal() {
304
- return modalHosts[modalHosts.length - 1];
305
- }
306
- constructor() {
307
- _SkyModalHostService_instances.add(this);
308
- this.close = new Subject();
309
- this.fullPage = false;
310
- this.openHelp = new Subject();
311
- this.zIndex = __classPrivateFieldGet(this, _SkyModalHostService_instances, "m", _SkyModalHostService_calculateZIndex).call(this);
312
- modalHosts.push(this);
313
- }
314
- getModalZIndex() {
315
- return this.zIndex;
316
- }
317
- onClose() {
318
- this.close.next();
319
- }
320
- onOpenHelp(helpKey) {
321
- this.openHelp.next(helpKey);
322
- }
323
- destroy() {
324
- modalHosts.splice(modalHosts.indexOf(this), 1);
325
- }
326
- }
327
- _SkyModalHostService_instances = new WeakSet(), _SkyModalHostService_calculateZIndex = function _SkyModalHostService_calculateZIndex() {
328
- const zIndexArray = modalHosts.map((hostService) => hostService.zIndex);
329
- if (zIndexArray.length === 0) {
330
- return BASE_Z_INDEX + 11;
331
- }
332
- else {
333
- const currentMaxZIndex = Math.max(...zIndexArray);
334
- return currentMaxZIndex + 10;
335
- }
336
- };
337
- SkyModalHostService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
338
- SkyModalHostService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostService, providedIn: 'root' });
339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostService, decorators: [{
340
- type: Injectable,
341
- args: [{
342
- providedIn: 'root',
343
- }]
344
- }], ctorParameters: function () { return []; } });
345
-
346
- /**
347
- * Provided by the modal service to give the modal host
348
- * component additional context and features.
349
- * @internal
350
- */
351
- class SkyModalHostContext {
352
- constructor(args) {
353
- this.args = args;
354
- }
355
- }
356
- SkyModalHostContext.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostContext, deps: [{ token: 'SkyModalHostContextArgs' }], target: i0.ɵɵFactoryTarget.Injectable });
357
- SkyModalHostContext.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostContext });
358
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostContext, decorators: [{
359
- type: Injectable
360
- }], ctorParameters: function () {
361
- return [{ type: undefined, decorators: [{
362
- type: Inject,
363
- args: ['SkyModalHostContextArgs']
364
- }] }];
365
- } });
366
-
367
- var _SkyModalHostComponent_instances, _SkyModalHostComponent_resolver, _SkyModalHostComponent_adapter, _SkyModalHostComponent_injector, _SkyModalHostComponent_router, _SkyModalHostComponent_changeDetector, _SkyModalHostComponent_modalHostContext, _SkyModalHostComponent_elRef, _SkyModalHostComponent_modalInstances, _SkyModalHostComponent_registerModalInstance, _SkyModalHostComponent_unregisterModalInstance, _SkyModalHostComponent_closeAllModalInstances;
368
- /**
369
- * @internal
370
- */
371
- class SkyModalHostComponent {
372
- get modalOpen() {
373
- return SkyModalHostService.openModalCount > 0;
374
- }
375
- get backdropZIndex() {
376
- return SkyModalHostService.backdropZIndex;
377
- }
378
- constructor(resolver, adapter, injector, changeDetector, modalHostContext, elRef, router) {
379
- _SkyModalHostComponent_instances.add(this);
380
- _SkyModalHostComponent_resolver.set(this, void 0);
381
- _SkyModalHostComponent_adapter.set(this, void 0);
382
- _SkyModalHostComponent_injector.set(this, void 0);
383
- _SkyModalHostComponent_router.set(this, void 0);
384
- _SkyModalHostComponent_changeDetector.set(this, void 0);
385
- _SkyModalHostComponent_modalHostContext.set(this, void 0);
386
- _SkyModalHostComponent_elRef.set(this, void 0);
387
- _SkyModalHostComponent_modalInstances.set(this, []);
388
- __classPrivateFieldSet(this, _SkyModalHostComponent_resolver, resolver, "f");
389
- __classPrivateFieldSet(this, _SkyModalHostComponent_adapter, adapter, "f");
390
- __classPrivateFieldSet(this, _SkyModalHostComponent_injector, injector, "f");
391
- __classPrivateFieldSet(this, _SkyModalHostComponent_router, router, "f");
392
- __classPrivateFieldSet(this, _SkyModalHostComponent_changeDetector, changeDetector, "f");
393
- __classPrivateFieldSet(this, _SkyModalHostComponent_modalHostContext, modalHostContext, "f");
394
- __classPrivateFieldSet(this, _SkyModalHostComponent_elRef, elRef, "f");
395
- }
396
- ngOnDestroy() {
397
- // Close all modal instances before disposing of the host container.
398
- __classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_closeAllModalInstances).call(this);
399
- __classPrivateFieldGet(this, _SkyModalHostComponent_modalHostContext, "f").args.teardownCallback();
400
- }
401
- open(modalInstance, component, config) {
402
- var _a;
403
- /* Ignore coverage as we specify the target element and so the view child should never be undefined unless
404
- * we were to call the `open` method in an early lifecycle hook. */
405
- /* istanbul ignore next */
406
- if (!this.target) {
407
- return;
408
- }
409
- const params = Object.assign({}, config);
410
- const factory = __classPrivateFieldGet(this, _SkyModalHostComponent_resolver, "f").resolveComponentFactory(component);
411
- const hostService = new SkyModalHostService();
412
- hostService.fullPage = !!params.fullPage;
413
- const adapter = __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f");
414
- const modalOpener = adapter.getModalOpener();
415
- let isOpen = true;
416
- params.providers || (params.providers = []);
417
- params.providers.push({
418
- provide: SkyModalHostService,
419
- useValue: hostService,
420
- }, {
421
- provide: SkyModalConfiguration,
422
- useValue: params,
423
- }, {
424
- provide: SkyMediaQueryService,
425
- useExisting: SkyResizeObserverMediaQueryService,
426
- }, {
427
- provide: SKY_STACKING_CONTEXT,
428
- useValue: {
429
- zIndex: new BehaviorSubject(hostService.getModalZIndex())
430
- .asObservable()
431
- .pipe(takeUntil(modalInstance.closed)),
432
- },
433
- });
434
- adapter.setPageScroll(SkyModalHostService.openModalCount > 0);
435
- adapter.toggleFullPageModalClass(SkyModalHostService.fullPageModalCount > 0);
436
- const providers = params.providers || /* istanbul ignore next */ [];
437
- const injector = Injector.create({
438
- providers,
439
- parent: __classPrivateFieldGet(this, _SkyModalHostComponent_injector, "f"),
440
- });
441
- const modalComponentRef = this.target.createComponent(factory, undefined, injector);
442
- // modal element that was just opened
443
- const modalElement = modalComponentRef.location;
444
- modalInstance.adapter = __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f");
445
- modalInstance.componentRef = modalComponentRef;
446
- __classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_registerModalInstance).call(this, modalInstance);
447
- // hiding all elements at the modal-host level from screen readers when the a modal is opened
448
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").hideHostSiblingsFromScreenReaders(__classPrivateFieldGet(this, _SkyModalHostComponent_elRef, "f"));
449
- if (SkyModalHostService.openModalCount > 1 &&
450
- SkyModalHostService.topModal === hostService) {
451
- // hiding the lower modals when more than one modal is opened
452
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").hidePreviousModalFromScreenReaders(modalElement);
453
- }
454
- const closeModal = () => {
455
- // unhide siblings if last modal is closing
456
- if (SkyModalHostService.openModalCount === 1) {
457
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").unhideOrRestoreHostSiblingsFromScreenReaders();
458
- }
459
- else if (SkyModalHostService.topModal === hostService) {
460
- // if there are more than 1 modal then unhide the one behind this one before closing it
461
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").unhidePreviousModalFromScreenReaders(modalElement);
462
- }
463
- hostService.destroy();
464
- adapter.setPageScroll(SkyModalHostService.openModalCount > 0);
465
- adapter.toggleFullPageModalClass(SkyModalHostService.fullPageModalCount > 0);
466
- /* istanbul ignore else */
467
- /* sanity check */
468
- if (modalOpener && modalOpener.focus) {
469
- modalOpener.focus();
470
- }
471
- modalComponentRef.destroy();
472
- };
473
- hostService.openHelp.subscribe((helpKey) => {
474
- modalInstance.openHelp(helpKey);
475
- });
476
- hostService.close.subscribe(() => {
477
- modalInstance.close();
478
- });
479
- (_a = __classPrivateFieldGet(this, _SkyModalHostComponent_router, "f")) === null || _a === void 0 ? void 0 : _a.events.pipe(takeWhile(() => isOpen)).subscribe((event) => {
480
- /* istanbul ignore else */
481
- if (event instanceof NavigationStart) {
482
- modalInstance.close();
483
- }
484
- });
485
- modalInstance.closed.subscribe(() => {
486
- isOpen = false;
487
- __classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_unregisterModalInstance).call(this, modalInstance);
488
- closeModal();
489
- });
490
- // Necessary if the host was created via a consumer's lifecycle hook such as ngOnInit
491
- __classPrivateFieldGet(this, _SkyModalHostComponent_changeDetector, "f").detectChanges();
492
- }
493
- }
494
- _SkyModalHostComponent_resolver = new WeakMap(), _SkyModalHostComponent_adapter = new WeakMap(), _SkyModalHostComponent_injector = new WeakMap(), _SkyModalHostComponent_router = new WeakMap(), _SkyModalHostComponent_changeDetector = new WeakMap(), _SkyModalHostComponent_modalHostContext = new WeakMap(), _SkyModalHostComponent_elRef = new WeakMap(), _SkyModalHostComponent_modalInstances = new WeakMap(), _SkyModalHostComponent_instances = new WeakSet(), _SkyModalHostComponent_registerModalInstance = function _SkyModalHostComponent_registerModalInstance(instance) {
495
- __classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").push(instance);
496
- }, _SkyModalHostComponent_unregisterModalInstance = function _SkyModalHostComponent_unregisterModalInstance(instance) {
497
- __classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").slice(__classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").indexOf(instance), 1);
498
- }, _SkyModalHostComponent_closeAllModalInstances = function _SkyModalHostComponent_closeAllModalInstances() {
499
- for (const instance of __classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f")) {
500
- instance.close();
501
- }
502
- };
503
- SkyModalHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: SkyModalAdapterService }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: SkyModalHostContext }, { token: i0.ElementRef }, { token: i3$1.Router, optional: true }], target: i0.ɵɵFactoryTarget.Component });
504
- SkyModalHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SkyModalHostComponent, selector: "sky-modal-host", viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div\n class=\"sky-modal-host-backdrop\"\n [hidden]=\"!modalOpen\"\n [ngStyle]=\"{\n zIndex: backdropZIndex\n }\"\n></div>\n<div #target></div>\n", styles: [".sky-modal-host-backdrop{background-color:#00000080;position:fixed;inset:0}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], viewProviders: [SkyModalAdapterService] });
505
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostComponent, decorators: [{
506
- type: Component,
507
- args: [{ selector: 'sky-modal-host', viewProviders: [SkyModalAdapterService], template: "<div\n class=\"sky-modal-host-backdrop\"\n [hidden]=\"!modalOpen\"\n [ngStyle]=\"{\n zIndex: backdropZIndex\n }\"\n></div>\n<div #target></div>\n", styles: [".sky-modal-host-backdrop{background-color:#00000080;position:fixed;inset:0}\n"] }]
508
- }], ctorParameters: function () {
509
- return [{ type: i0.ComponentFactoryResolver }, { type: SkyModalAdapterService }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: SkyModalHostContext }, { type: i0.ElementRef }, { type: i3$1.Router, decorators: [{
510
- type: Optional
511
- }] }];
512
- }, propDecorators: { target: [{
513
- type: ViewChild,
514
- args: ['target', {
515
- read: ViewContainerRef,
516
- static: true,
517
- }]
518
- }] } });
519
-
520
- /**
521
- * @internal
522
- */
523
- const SKY_CONFIRM_CONFIG = new InjectionToken('SkyConfirmConfig');
524
-
525
- /**
526
- * Properties about the modal close action and a method to close the modal.
527
- */
528
- class SkyModalBeforeCloseHandler {
529
- constructor(closeModal, closeArgs) {
530
- this.closeArgs = closeArgs;
531
- this.closeModal = closeModal;
532
- }
533
- }
534
-
535
- /**
536
- * Contains an object with the data passed from users when
537
- * a modal is closed and the reason that the modal was closed.
538
- */
539
- class SkyModalCloseArgs {
540
- }
541
-
542
- var _SkyModalInstance_instances, _SkyModalInstance__beforeClose, _SkyModalInstance__closed, _SkyModalInstance__helpOpened, _SkyModalInstance_adapter, _SkyModalInstance_elementRef, _SkyModalInstance_closeModal, _SkyModalInstance_notifyClosed;
543
- class SkyModalInstance {
544
- constructor() {
545
- _SkyModalInstance_instances.add(this);
546
- _SkyModalInstance__beforeClose.set(this, new Subject());
547
- _SkyModalInstance__closed.set(this, new Subject());
548
- _SkyModalInstance__helpOpened.set(this, new Subject());
549
- _SkyModalInstance_adapter.set(this, void 0);
550
- _SkyModalInstance_elementRef.set(this, void 0);
551
- }
552
- /**
553
- * An event that the modal instance emits when it is about to close.
554
- * It emits a `SkyModalBeforeCloseHandler` object with a `closeModal` method
555
- * that closes the modal. If a subscription exists for this event,
556
- * the modal does not close until the subscriber calls the `closeModal` method.
557
- */
558
- get beforeClose() {
559
- return __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f");
560
- }
561
- /**
562
- * An event that the modal instance emits when it closes.
563
- * It emits a `SkyModalCloseArgs` object with a `data` property that includes
564
- * data passed from users on close or save and a `reason` property that indicates
565
- * whether the modal was saved or closed without saving.
566
- * The `reason` property accepts any string value.
567
- * Common examples include `"cancel"`, `"close"`, and `"save"`.
568
- */
569
- get closed() {
570
- return __classPrivateFieldGet(this, _SkyModalInstance__closed, "f");
571
- }
572
- /**
573
- * An event that the modal instance emits when users click
574
- * the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
575
- * If a `helpKey` parameter was specified, the `helpOpened` event broadcasts the `helpKey`.
576
- */
577
- get helpOpened() {
578
- return __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f");
579
- }
580
- /**
581
- * Sets the component adapter for the instance. This is used internally for actions such as scrolling the content.
582
- * @internal
583
- */
584
- set adapter(value) {
585
- __classPrivateFieldSet(this, _SkyModalInstance_adapter, value, "f");
586
- }
587
- /**
588
- * Sets the component ref for the instance. This is used to extract the component instance for the public API and the element ref for internal use.
589
- * @internal
590
- */
591
- set componentRef(value) {
592
- this.componentInstance = value.instance;
593
- __classPrivateFieldSet(this, _SkyModalInstance_elementRef, value.location, "f");
594
- }
595
- /**
596
- * Closes the modal instance.
597
- * @param result Specifies an object to emit to subscribers of the `closed` event of the
598
- * modal instance. The `SkyModalInstance` provider can be injected into a component's constructor
599
- * so that this `close` function can be called from a button in the `sky-modal-footer`.
600
- * @param reason Specifies the reason for the modal closing, with the default reason of `"close"`.
601
- * @param ignoreBeforeClose Indicates whether to ignore the modal instance's `beforeClose` event.
602
- */
603
- close(result, reason, ignoreBeforeClose) {
604
- if (reason === undefined) {
605
- reason = 'close';
606
- }
607
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, reason, result, ignoreBeforeClose);
608
- }
609
- /**
610
- * Closes the modal instance with `reason="cancel"`.
611
- * @param result Specifies an object to emit to subscribers of the `closed` event of the modal
612
- * instance. The `SkyModalInstance` provider can be injected into a component's constructor so
613
- * that this cancel function can be called from a button in the `sky-modal-footer`.
614
- */
615
- cancel(result) {
616
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'cancel', result);
617
- }
618
- /**
619
- * Closes the modal instance with `reason="save"`.
620
- * @param result Specifies an object to emit to subscribers of the `closed` event of the modal
621
- * instance. The `SkyModalInstance` provider can be injected into a component's constructor so
622
- * that this `save` function can be called from a button in `the sky-modal-footer`.
623
- */
624
- save(result) {
625
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'save', result);
626
- }
627
- /**
628
- * Scrolls the modal content area to the top of its scrollable area.
629
- */
630
- scrollContentToTop() {
631
- if (__classPrivateFieldGet(this, _SkyModalInstance_adapter, "f") && __classPrivateFieldGet(this, _SkyModalInstance_elementRef, "f")) {
632
- __classPrivateFieldGet(this, _SkyModalInstance_adapter, "f").scrollContentToTop(__classPrivateFieldGet(this, _SkyModalInstance_elementRef, "f"));
633
- }
634
- }
635
- /**
636
- * Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open
637
- * when users click the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
638
- * @param helpKey Specifies a string to emit to subscribers of
639
- * the modal instance's `helpOpened` event. Consumers can inject the `SkyModalInstance` provider
640
- * into a component's constructor to call the `openHelp` function in the modal template.
641
- */
642
- openHelp(helpKey) {
643
- __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").next(helpKey);
644
- }
645
- }
646
- _SkyModalInstance__beforeClose = new WeakMap(), _SkyModalInstance__closed = new WeakMap(), _SkyModalInstance__helpOpened = new WeakMap(), _SkyModalInstance_adapter = new WeakMap(), _SkyModalInstance_elementRef = new WeakMap(), _SkyModalInstance_instances = new WeakSet(), _SkyModalInstance_closeModal = function _SkyModalInstance_closeModal(type, result, ignoreBeforeClose = false) {
647
- const args = new SkyModalCloseArgs();
648
- args.reason = type;
649
- args.data = result;
650
- if (__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").observers.length === 0 || ignoreBeforeClose) {
651
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
652
- }
653
- else {
654
- __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").next(new SkyModalBeforeCloseHandler(() => {
655
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
656
- }, args));
657
- }
658
- }, _SkyModalInstance_notifyClosed = function _SkyModalInstance_notifyClosed(args) {
659
- __classPrivateFieldGet(this, _SkyModalInstance__closed, "f").next(args);
660
- __classPrivateFieldGet(this, _SkyModalInstance__closed, "f").complete();
661
- __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").complete();
662
- __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").complete();
663
- };
664
-
665
- var _SkyModalComponentAdapterService_instances, _SkyModalComponentAdapterService_coreAdapter, _SkyModalComponentAdapterService_setFullPageHeight;
666
- /**
667
- * @internal
668
- */
669
- class SkyModalComponentAdapterService {
670
- constructor(coreAdapter) {
671
- _SkyModalComponentAdapterService_instances.add(this);
672
- _SkyModalComponentAdapterService_coreAdapter.set(this, void 0);
673
- __classPrivateFieldSet(this, _SkyModalComponentAdapterService_coreAdapter, coreAdapter, "f");
674
- }
675
- handleWindowChange(modalEl) {
676
- const boundedHeightEl = modalEl.nativeElement.querySelector('.sky-modal');
677
- const fullPageModalEl = modalEl.nativeElement.querySelector('.sky-modal-full-page');
678
- /*
679
- Set modal height equal to max height of window (accounting for padding above and below modal)
680
- */
681
- const newHeight = window.innerHeight - 40;
682
- boundedHeightEl.style.maxHeight = newHeight.toString() + 'px';
683
- if (fullPageModalEl) {
684
- __classPrivateFieldGet(this, _SkyModalComponentAdapterService_instances, "m", _SkyModalComponentAdapterService_setFullPageHeight).call(this, fullPageModalEl);
685
- }
686
- else {
687
- /*
688
- IE11 doesn't handle flex and max-height correctly so we have to explicitly add
689
- max-height to the content that accounts for standard header and footer height.
690
- */
691
- const modalContentEl = modalEl.nativeElement.querySelector('.sky-modal-content');
692
- const contentHeight = newHeight - 114;
693
- modalContentEl.style.maxHeight = contentHeight.toString() + 'px';
694
- }
695
- }
696
- isFocusInFirstItem(event, list) {
697
- /* istanbul ignore next */
698
- /* sanity check */
699
- const eventTarget = event.target || event.srcElement;
700
- return list.length > 0 && eventTarget === list[0];
701
- }
702
- isFocusInLastItem(event, list) {
703
- /* istanbul ignore next */
704
- /* sanity check */
705
- const eventTarget = event.target || event.srcElement;
706
- return list.length > 0 && eventTarget === list[list.length - 1];
707
- }
708
- isModalFocused(event, modalEl) {
709
- /* istanbul ignore next */
710
- /* sanity check */
711
- const eventTarget = event.target || event.srcElement;
712
- return (modalEl &&
713
- eventTarget === modalEl.nativeElement.querySelector('.sky-modal-dialog'));
714
- }
715
- focusLastElement(list) {
716
- if (list.length > 0) {
717
- list[list.length - 1].focus();
718
- return true;
719
- }
720
- return false;
721
- }
722
- focusFirstElement(list) {
723
- if (list.length > 0) {
724
- list[0].focus();
725
- return true;
726
- }
727
- return false;
728
- }
729
- modalContentHasDirectChildViewkeeper(modalContentEl) {
730
- return !!modalContentEl.nativeElement.querySelector('sky-modal-content > .sky-viewkeeper-fixed');
731
- }
732
- modalOpened(modalEl) {
733
- /* istanbul ignore else */
734
- /* handle the case where somehow there is a focused element already in the modal */
735
- if (!(document.activeElement &&
736
- modalEl.nativeElement.contains(document.activeElement))) {
737
- const currentScrollX = window.pageXOffset;
738
- const currentScrollY = window.pageYOffset;
739
- const inputWithAutofocus = modalEl.nativeElement.querySelector('[autofocus]');
740
- if (inputWithAutofocus) {
741
- inputWithAutofocus.focus();
742
- }
743
- else {
744
- __classPrivateFieldGet(this, _SkyModalComponentAdapterService_coreAdapter, "f").getFocusableChildrenAndApplyFocus(modalEl, '.sky-modal-content', true);
745
- }
746
- window.scrollTo(currentScrollX, currentScrollY);
747
- }
748
- }
749
- }
750
- _SkyModalComponentAdapterService_coreAdapter = new WeakMap(), _SkyModalComponentAdapterService_instances = new WeakSet(), _SkyModalComponentAdapterService_setFullPageHeight = function _SkyModalComponentAdapterService_setFullPageHeight(fullPageModalEl) {
751
- const windowHeight = window.innerHeight;
752
- const fullPageModalStyle = getComputedStyle(fullPageModalEl);
753
- const marginTopBottom = parseInt(fullPageModalStyle.marginTop, 10) +
754
- parseInt(fullPageModalStyle.marginBottom, 10);
755
- const fullPageModalHeight = windowHeight - marginTopBottom + 'px';
756
- fullPageModalEl.style.height = fullPageModalHeight;
757
- fullPageModalEl.style.maxHeight = fullPageModalHeight;
758
- };
759
- SkyModalComponentAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, deps: [{ token: i3.SkyCoreAdapterService }], target: i0.ɵɵFactoryTarget.Injectable });
760
- SkyModalComponentAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService });
761
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, decorators: [{
762
- type: Injectable
763
- }], ctorParameters: function () { return [{ type: i3.SkyCoreAdapterService }]; } });
764
-
765
- var _SkyModalScrollShadowDirective_instances, _SkyModalScrollShadowDirective_currentShadow, _SkyModalScrollShadowDirective_currentTheme, _SkyModalScrollShadowDirective_mutationObserver, _SkyModalScrollShadowDirective_ngUnsubscribe, _SkyModalScrollShadowDirective_elRef, _SkyModalScrollShadowDirective_mutationObserverSvc, _SkyModalScrollShadowDirective_ngZone, _SkyModalScrollShadowDirective_themeSvc, _SkyModalScrollShadowDirective_initMutationObserver, _SkyModalScrollShadowDirective_destroyMutationObserver, _SkyModalScrollShadowDirective_checkForShadow, _SkyModalScrollShadowDirective_buildShadowStyle, _SkyModalScrollShadowDirective_emitShadow;
766
- /**
767
- * Raises an event when the box shadow for the modal header or footer should be adjusted
768
- * based on the scroll position of the host element.
769
- * @internal
770
- */
771
- class SkyModalScrollShadowDirective {
772
- constructor(elRef, mutationObserverSvc, ngZone, themeSvc) {
773
- _SkyModalScrollShadowDirective_instances.add(this);
774
- this.skyModalScrollShadow = new EventEmitter();
775
- _SkyModalScrollShadowDirective_currentShadow.set(this, void 0);
776
- _SkyModalScrollShadowDirective_currentTheme.set(this, void 0);
777
- _SkyModalScrollShadowDirective_mutationObserver.set(this, void 0);
778
- _SkyModalScrollShadowDirective_ngUnsubscribe.set(this, new Subject());
779
- _SkyModalScrollShadowDirective_elRef.set(this, void 0);
780
- _SkyModalScrollShadowDirective_mutationObserverSvc.set(this, void 0);
781
- _SkyModalScrollShadowDirective_ngZone.set(this, void 0);
782
- _SkyModalScrollShadowDirective_themeSvc.set(this, void 0);
783
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_elRef, elRef, "f");
784
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserverSvc, mutationObserverSvc, "f");
785
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_ngZone, ngZone, "f");
786
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_themeSvc, themeSvc, "f");
787
- }
788
- windowResize() {
789
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
790
- }
791
- scroll() {
792
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
793
- }
794
- ngOnInit() {
795
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_themeSvc, "f")) {
796
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_themeSvc, "f").settingsChange
797
- .pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f")))
798
- .subscribe((themeSettings) => {
799
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_currentTheme, themeSettings.currentSettings.theme, "f");
800
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentTheme, "f") === SkyTheme.presets.modern) {
801
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_initMutationObserver).call(this);
802
- }
803
- else {
804
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_emitShadow).call(this, {
805
- bottomShadow: 'none',
806
- topShadow: 'none',
807
- });
808
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_destroyMutationObserver).call(this);
809
- }
810
- });
811
- }
812
- }
813
- ngOnDestroy() {
814
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f").next();
815
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f").complete();
816
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_destroyMutationObserver).call(this);
817
- }
818
- }
819
- _SkyModalScrollShadowDirective_currentShadow = new WeakMap(), _SkyModalScrollShadowDirective_currentTheme = new WeakMap(), _SkyModalScrollShadowDirective_mutationObserver = new WeakMap(), _SkyModalScrollShadowDirective_ngUnsubscribe = new WeakMap(), _SkyModalScrollShadowDirective_elRef = new WeakMap(), _SkyModalScrollShadowDirective_mutationObserverSvc = new WeakMap(), _SkyModalScrollShadowDirective_ngZone = new WeakMap(), _SkyModalScrollShadowDirective_themeSvc = new WeakMap(), _SkyModalScrollShadowDirective_instances = new WeakSet(), _SkyModalScrollShadowDirective_initMutationObserver = function _SkyModalScrollShadowDirective_initMutationObserver() {
820
- if (!__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f")) {
821
- const el = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_elRef, "f").nativeElement;
822
- // MutationObserver is patched by Zone.js and therefore becomes part of the
823
- // Angular change detection cycle, but this can lead to infinite loops in some
824
- // scenarios. This will keep MutationObserver from triggering change detection.
825
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngZone, "f").runOutsideAngular(() => {
826
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserver, __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserverSvc, "f").create(() => {
827
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
828
- }), "f");
829
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f").observe(el, {
830
- attributes: true,
831
- characterData: true,
832
- childList: true,
833
- subtree: true,
834
- });
835
- });
836
- }
837
- }, _SkyModalScrollShadowDirective_destroyMutationObserver = function _SkyModalScrollShadowDirective_destroyMutationObserver() {
838
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f")) {
839
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f").disconnect();
840
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserver, undefined, "f");
841
- }
842
- }, _SkyModalScrollShadowDirective_checkForShadow = function _SkyModalScrollShadowDirective_checkForShadow() {
843
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentTheme, "f") === SkyTheme.presets.modern) {
844
- const el = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_elRef, "f").nativeElement;
845
- const topShadow = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_buildShadowStyle).call(this, el.scrollTop);
846
- const bottomShadow = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_buildShadowStyle).call(this, el.scrollHeight - el.scrollTop - el.clientHeight);
847
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_emitShadow).call(this, {
848
- bottomShadow,
849
- topShadow,
850
- });
851
- }
852
- }, _SkyModalScrollShadowDirective_buildShadowStyle = function _SkyModalScrollShadowDirective_buildShadowStyle(pixelsFromEnd) {
853
- // Progressively darken the shadow until the user scrolls 30 pixels from the top or bottom
854
- // of the scrollable element, with a max opacity of 0.3.
855
- const opacity = Math.min(pixelsFromEnd / 30, 1) * 0.3;
856
- return opacity > 0 ? `0px 1px 8px 0px rgba(0, 0, 0, ${opacity})` : 'none';
857
- }, _SkyModalScrollShadowDirective_emitShadow = function _SkyModalScrollShadowDirective_emitShadow(shadow) {
858
- if (!__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f") ||
859
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f").bottomShadow !== shadow.bottomShadow ||
860
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f").topShadow !== shadow.topShadow) {
861
- this.skyModalScrollShadow.emit(shadow);
862
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_currentShadow, shadow, "f");
863
- }
864
- };
865
- SkyModalScrollShadowDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalScrollShadowDirective, deps: [{ token: i0.ElementRef }, { token: i3.SkyMutationObserverService }, { token: i0.NgZone }, { token: i2$1.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
866
- SkyModalScrollShadowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SkyModalScrollShadowDirective, selector: "[skyModalScrollShadow]", outputs: { skyModalScrollShadow: "skyModalScrollShadow" }, host: { listeners: { "window:resize": "windowResize()", "scroll": "scroll()" } }, ngImport: i0 });
867
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalScrollShadowDirective, decorators: [{
868
- type: Directive,
869
- args: [{
870
- selector: '[skyModalScrollShadow]',
871
- }]
872
- }], ctorParameters: function () {
873
- return [{ type: i0.ElementRef }, { type: i3.SkyMutationObserverService }, { type: i0.NgZone }, { type: i2$1.SkyThemeService, decorators: [{
874
- type: Optional
875
- }] }];
876
- }, propDecorators: { skyModalScrollShadow: [{
877
- type: Output
878
- }], windowResize: [{
879
- type: HostListener,
880
- args: ['window:resize']
881
- }], scroll: [{
882
- type: HostListener,
883
- args: ['scroll']
884
- }] } });
885
-
886
- var _SkyModalComponent_hostService, _SkyModalComponent_elRef, _SkyModalComponent_windowRef, _SkyModalComponent_componentAdapter, _SkyModalComponent_coreAdapter, _SkyModalComponent_dockService, _SkyModalComponent_mediaQueryService, _SkyModalComponent_ngUnsubscribe, _SkyModalComponent__ariaDescribedBy, _SkyModalComponent__ariaLabelledBy, _SkyModalComponent_changeDetector, _SkyModalComponent_errorsSvc, _SkyModalComponent_liveAnnouncerSvc;
887
- const ARIA_ROLE_DEFAULT = 'dialog';
888
- /**
889
- * Provides a common look-and-feel for modal content with options to display
890
- * a common modal header, specify body content, and display a common modal footer
891
- * and buttons.
892
- */
893
- class SkyModalComponent {
894
- /**
895
- * A list of form-level errors to display to the user.
896
- */
897
- set formErrors(value) {
898
- __classPrivateFieldGet(this, _SkyModalComponent_errorsSvc, "f").updateErrors(value);
899
- }
900
- /**
901
- * @internal
902
- */
903
- set ariaRole(value) {
904
- this.ariaRoleOrDefault = value || ARIA_ROLE_DEFAULT;
905
- }
906
- /**
907
- * @internal
908
- */
909
- set ariaDescribedBy(id) {
910
- __classPrivateFieldSet(this, _SkyModalComponent__ariaDescribedBy, id, "f");
911
- }
912
- get ariaDescribedBy() {
913
- return __classPrivateFieldGet(this, _SkyModalComponent__ariaDescribedBy, "f");
914
- }
915
- /**
916
- * @internal
917
- */
918
- set ariaLabelledBy(id) {
919
- __classPrivateFieldSet(this, _SkyModalComponent__ariaLabelledBy, id, "f");
920
- }
921
- get ariaLabelledBy() {
922
- return __classPrivateFieldGet(this, _SkyModalComponent__ariaLabelledBy, "f");
923
- }
924
- constructor(hostService, config, elRef, windowRef, componentAdapter, coreAdapter, dockService, mediaQueryService) {
925
- var _a;
926
- this.ariaRoleOrDefault = ARIA_ROLE_DEFAULT;
927
- this.ariaOwns = null;
928
- this.modalState = 'in';
929
- _SkyModalComponent_hostService.set(this, void 0);
930
- _SkyModalComponent_elRef.set(this, void 0);
931
- _SkyModalComponent_windowRef.set(this, void 0);
932
- _SkyModalComponent_componentAdapter.set(this, void 0);
933
- _SkyModalComponent_coreAdapter.set(this, void 0);
934
- _SkyModalComponent_dockService.set(this, void 0);
935
- _SkyModalComponent_mediaQueryService.set(this, void 0);
936
- _SkyModalComponent_ngUnsubscribe.set(this, new Subject());
937
- _SkyModalComponent__ariaDescribedBy.set(this, void 0);
938
- _SkyModalComponent__ariaLabelledBy.set(this, void 0);
939
- _SkyModalComponent_changeDetector.set(this, inject(ChangeDetectorRef));
940
- _SkyModalComponent_errorsSvc.set(this, inject(SkyModalErrorsService));
941
- _SkyModalComponent_liveAnnouncerSvc.set(this, inject(SkyLiveAnnouncerService));
942
- __classPrivateFieldSet(this, _SkyModalComponent_hostService, hostService, "f");
943
- __classPrivateFieldSet(this, _SkyModalComponent_elRef, elRef, "f");
944
- __classPrivateFieldSet(this, _SkyModalComponent_windowRef, windowRef, "f");
945
- __classPrivateFieldSet(this, _SkyModalComponent_componentAdapter, componentAdapter, "f");
946
- __classPrivateFieldSet(this, _SkyModalComponent_coreAdapter, coreAdapter, "f");
947
- __classPrivateFieldSet(this, _SkyModalComponent_dockService, dockService, "f");
948
- __classPrivateFieldSet(this, _SkyModalComponent_mediaQueryService, mediaQueryService, "f");
949
- this.ariaDescribedBy = config.ariaDescribedBy;
950
- this.ariaLabelledBy = config.ariaLabelledBy;
951
- this.ariaRole = config.ariaRole;
952
- this.helpKey = config.helpKey;
953
- this.tiledBody = config.tiledBody;
954
- this.wrapperClass = config.wrapperClass;
955
- this.size = config.fullPage
956
- ? 'full-page'
957
- : ((_a = config.size) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || 'medium';
958
- this.modalZIndex = __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").zIndex;
959
- }
960
- onDocumentKeyUp(event) {
961
- /* istanbul ignore else */
962
- /* sanity check */
963
- if (SkyModalHostService.openModalCount > 0) {
964
- const topModal = SkyModalHostService.topModal;
965
- if (topModal && topModal === __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f")) {
966
- if (event.which === 27) {
967
- // Escape key up
968
- event.preventDefault();
969
- this.closeButtonClick();
970
- }
971
- }
972
- }
973
- }
974
- onDocumentKeyDown(event) {
975
- /* istanbul ignore else */
976
- /* sanity check */
977
- if (SkyModalHostService.openModalCount > 0) {
978
- const topModal = SkyModalHostService.topModal;
979
- if (topModal && topModal === __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f")) {
980
- if (event.which === 9) {
981
- // Tab pressed
982
- let focusChanged = false;
983
- const focusElementList = __classPrivateFieldGet(this, _SkyModalComponent_coreAdapter, "f").getFocusableChildren(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f").nativeElement);
984
- if (event.shiftKey &&
985
- (__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isFocusInFirstItem(event, focusElementList) ||
986
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isModalFocused(event, __classPrivateFieldGet(this, _SkyModalComponent_elRef, "f")))) {
987
- focusChanged =
988
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").focusLastElement(focusElementList);
989
- }
990
- else if (!event.shiftKey &&
991
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isFocusInLastItem(event, focusElementList)) {
992
- focusChanged =
993
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").focusFirstElement(focusElementList);
994
- }
995
- if (focusChanged) {
996
- event.preventDefault();
997
- event.stopPropagation();
998
- }
999
- }
1000
- }
1001
- }
1002
- }
1003
- ngOnInit() {
1004
- __classPrivateFieldGet(this, _SkyModalComponent_liveAnnouncerSvc, "f").announcerElementChanged
1005
- .pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalComponent_ngUnsubscribe, "f")))
1006
- .subscribe((element) => {
1007
- if (element === null || element === void 0 ? void 0 : element.id) {
1008
- this.ariaOwns = element.id;
1009
- __classPrivateFieldGet(this, _SkyModalComponent_changeDetector, "f").markForCheck();
1010
- }
1011
- });
1012
- }
1013
- ngAfterViewInit() {
1014
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").handleWindowChange(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1015
- // Adding a timeout to avoid ExpressionChangedAfterItHasBeenCheckedError.
1016
- // https://stackoverflow.com/questions/40562845
1017
- __classPrivateFieldGet(this, _SkyModalComponent_windowRef, "f").nativeWindow.setTimeout(() => {
1018
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").modalOpened(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1019
- });
1020
- __classPrivateFieldGet(this, _SkyModalComponent_dockService, "f").setDockOptions({
1021
- location: SkyDockLocation.ElementBottom,
1022
- referenceEl: this.modalContentWrapperElement.nativeElement,
1023
- zIndex: 5,
1024
- });
1025
- /* istanbul ignore next */
1026
- if (__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f")) {
1027
- __classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f").observe(this.modalContentWrapperElement);
1028
- }
1029
- }
1030
- ngOnDestroy() {
1031
- /* istanbul ignore next */
1032
- if (__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f")) {
1033
- __classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f").unobserve();
1034
- }
1035
- __classPrivateFieldGet(this, _SkyModalComponent_ngUnsubscribe, "f").next();
1036
- __classPrivateFieldGet(this, _SkyModalComponent_ngUnsubscribe, "f").complete();
1037
- }
1038
- helpButtonClick() {
1039
- if (this.helpKey) {
1040
- __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").onOpenHelp(this.helpKey);
1041
- }
1042
- }
1043
- closeButtonClick() {
1044
- __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").onClose();
1045
- }
1046
- windowResize() {
1047
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").handleWindowChange(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1048
- }
1049
- scrollShadowChange(args) {
1050
- this.scrollShadow = args;
1051
- }
1052
- viewkeeperEnabled() {
1053
- return __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").modalContentHasDirectChildViewkeeper(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1054
- }
1055
- }
1056
- _SkyModalComponent_hostService = new WeakMap(), _SkyModalComponent_elRef = new WeakMap(), _SkyModalComponent_windowRef = new WeakMap(), _SkyModalComponent_componentAdapter = new WeakMap(), _SkyModalComponent_coreAdapter = new WeakMap(), _SkyModalComponent_dockService = new WeakMap(), _SkyModalComponent_mediaQueryService = new WeakMap(), _SkyModalComponent_ngUnsubscribe = new WeakMap(), _SkyModalComponent__ariaDescribedBy = new WeakMap(), _SkyModalComponent__ariaLabelledBy = new WeakMap(), _SkyModalComponent_changeDetector = new WeakMap(), _SkyModalComponent_errorsSvc = new WeakMap(), _SkyModalComponent_liveAnnouncerSvc = new WeakMap();
1057
- SkyModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponent, deps: [{ token: SkyModalHostService }, { token: SkyModalConfiguration }, { token: i0.ElementRef }, { token: i3.SkyAppWindowRef }, { token: SkyModalComponentAdapterService }, { token: i3.SkyCoreAdapterService }, { token: i3.SkyDockService, host: true }, { token: i3.SkyResizeObserverMediaQueryService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1058
- SkyModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SkyModalComponent, selector: "sky-modal", inputs: { formErrors: "formErrors", ariaRole: "ariaRole", tiledBody: "tiledBody", ariaDescribedBy: "ariaDescribedBy", ariaLabelledBy: "ariaLabelledBy" }, host: { listeners: { "document:keyup": "onDocumentKeyUp($event)", "document:keydown": "onDocumentKeyDown($event)" }, properties: { "class": "this.wrapperClass" } }, providers: [
1059
- SkyModalComponentAdapterService,
1060
- SkyModalErrorsService,
1061
- SkyDockService,
1062
- ], viewQueries: [{ propertyName: "modalContentWrapperElement", first: true, predicate: ["modalContentWrapper"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n class=\"sky-modal-dialog\"\n aria-modal=\"true\"\n [attr.aria-describedby]=\"ariaDescribedBy || modalContentId.id\"\n [attr.aria-labelledby]=\"ariaLabelledBy || headerId.id\"\n [attr.aria-owns]=\"ariaOwns\"\n [attr.role]=\"ariaRoleOrDefault\"\n (window:resize)=\"windowResize()\"\n>\n <div\n class=\"sky-modal sky-shadow sky-box sky-elevation-16 sky-modal-{{ size }}\"\n tabindex=\"-1\"\n [ngClass]=\"{\n 'sky-modal-tiled': tiledBody,\n 'sky-modal-viewkeeper': viewkeeperEnabled()\n }\"\n [ngStyle]=\"{\n zIndex: modalZIndex\n }\"\n >\n <div\n class=\"sky-modal-header\"\n [hidden]=\"!headerContent || !headerContent.children || headerContent.children.length &lt; 1\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.topShadow\n }\"\n >\n <div\n class=\"sky-modal-header-content\"\n skyId\n [ngClass]=\"{\n 'sky-font-heading-2': size === 'full-page'\n }\"\n #headerContent\n #headerId=\"skyId\"\n >\n <ng-content select=\"sky-modal-header\"></ng-content>\n </div>\n <div class=\"sky-modal-header-buttons\">\n <button\n *ngIf=\"helpKey\"\n class=\"sky-btn sky-modal-btn-help\"\n name=\"help-button\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_modal_open_help' | skyLibResources\"\n (click)=\"helpButtonClick()\"\n >\n <sky-icon icon=\"question-circle\"></sky-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"sky-btn sky-modal-btn-close\"\n [attr.aria-label]=\"'skyux_modal_close' | skyLibResources\"\n (click)=\"closeButtonClick()\"\n >\n <sky-icon icon=\"close\"></sky-icon>\n </button>\n </div>\n </div>\n <div\n class=\"sky-modal-content sky-padding-even-large\"\n role=\"region\"\n tabindex=\"0\"\n skyId\n [attr.aria-labelledby]=\"headerId.id\"\n (skyModalScrollShadow)=\"scrollShadowChange($event)\"\n #modalContentId=\"skyId\"\n #modalContentWrapper\n >\n <ng-content select=\"sky-modal-content\"></ng-content>\n </div>\n <div\n class=\"sky-modal-footer\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.bottomShadow\n }\"\n >\n <ng-content select=\"sky-modal-footer\"></ng-content>\n </div>\n </div>\n</div>\n", styles: [".sky-modal{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;position:fixed;width:auto;left:0;right:0;top:20px;margin:10px;display:flex;flex-direction:column;overflow:hidden}.sky-modal:focus{outline:none}@media (min-width: 768px){.sky-modal:not(.sky-modal-large){margin:0 auto}.sky-modal-small{width:300px}.sky-modal-small .sky-modal-content,.sky-modal-small .sky-modal-header,.sky-modal-small .sky-modal-footer{max-width:300px}.sky-modal-medium{width:600px}.sky-modal-medium .sky-modal-content,.sky-modal-medium .sky-modal-header,.sky-modal-medium .sky-modal-footer{max-width:600px}}@media (min-width: 920px){.sky-modal-large{margin:0 auto;width:900px}.sky-modal-large .sky-modal-content,.sky-modal-large .sky-modal-header,.sky-modal-large .sky-modal-footer{max-width:900px}}.sky-modal-content{background-color:#fff;--sky-background-color-page-default: #fff}.sky-modal-content:focus{outline-style:dotted;outline-width:thin;outline-offset:-1px}.sky-modal-tiled .sky-modal-content{background-color:#eeeeef;--sky-background-color-page-default: $sky-background-color-neutral-light}.sky-modal-tiled .sky-modal-content ::ng-deep .sky-tile-title{font-family:BLKB Sans,Helvetica Neue,Arial,sans-serif;color:var(--sky-text-color-deemphasized);font-weight:300;font-size:19px}.sky-modal-header{padding:9px 3px 9px 15px;background-color:#fff;display:flex;align-items:baseline;border-bottom:1px solid #e2e3e4}.sky-modal-header-buttons{flex-shrink:.0001}.sky-modal-header-buttons .sky-btn{border:none;color:#cdcfd2;cursor:pointer}.sky-modal-header-buttons .sky-btn:hover{color:#979ba2;transition:color .15s}.sky-modal-header-content{flex-grow:1}.sky-modal-header{flex-shrink:0;z-index:2}.sky-modal-content{overflow-y:auto}.sky-modal-footer{flex-shrink:0;z-index:2}.sky-modal-full-page{width:100%;top:0;margin:0}.sky-modal-full-page .sky-modal-header-buttons sky-icon[icon=close]{font-size:20px}.sky-modal-full-page .sky-modal-content{flex-grow:1}:host ::ng-deep .sky-sectioned-form{min-height:460px;margin:-15px}.sky-modal-content>::ng-deep sky-dock{bottom:-15px;margin-left:-15px;margin-bottom:-15px;padding-top:15px;width:calc(100% + 30px)}:host-context(.sky-theme-modern) .sky-modal-header{border:none;padding:20px 30px}:host-context(.sky-theme-modern) .sky-modal-btn-help,:host-context(.sky-theme-modern) .sky-modal-btn-close{display:none}:host-context(.sky-theme-modern) .sky-modal-content{padding:0}:host-context(.sky-theme-modern) .sky-modal-full-page{width:calc(100% - 60px);margin:30px}:host-context(.sky-theme-modern) .sky-modal-content>::ng-deep sky-dock{bottom:0;margin-left:initial;margin-bottom:initial;padding-top:initial;width:100%}:host-context(.sky-theme-modern) .sky-modal-viewkeeper .sky-modal-header{box-shadow:none!important}:host-context(.sky-theme-modern) .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed{box-shadow:0 4px 8px -4px #0000004d}:host-context(.sky-theme-modern) .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed>sky-toolbar .sky-toolbar-container{background-color:#fff;--sky-background-color-page-default: #fff;padding-left:30px;padding-right:30px}.sky-theme-modern .sky-modal-header{border:none;padding:20px 30px}.sky-theme-modern .sky-modal-btn-help,.sky-theme-modern .sky-modal-btn-close{display:none}.sky-theme-modern .sky-modal-content{padding:0}.sky-theme-modern .sky-modal-full-page{width:calc(100% - 60px);margin:30px}.sky-theme-modern .sky-modal-content>::ng-deep sky-dock{bottom:0;margin-left:initial;margin-bottom:initial;padding-top:initial;width:100%}.sky-theme-modern .sky-modal-viewkeeper .sky-modal-header{box-shadow:none!important}.sky-theme-modern .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed{box-shadow:0 4px 8px -4px #0000004d}.sky-theme-modern .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed>sky-toolbar .sky-toolbar-container{background-color:#fff;--sky-background-color-page-default: #fff;padding-left:30px;padding-right:30px}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal{border-color:#121212}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal-header{color:#fbfcfe}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal-header,:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal-content{background-color:transparent;--sky-background-color-page-default: $sky-theme-modern-mode-dark-background-color-page-default}.sky-theme-modern.sky-theme-mode-dark .sky-modal{border-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-modal-header{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-modal-header,.sky-theme-modern.sky-theme-mode-dark .sky-modal-content{background-color:transparent;--sky-background-color-page-default: $sky-theme-modern-mode-dark-background-color-page-default}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i3.λ2, selector: "[skyId]", exportAs: ["skyId"] }, { kind: "directive", type: SkyModalScrollShadowDirective, selector: "[skyModalScrollShadow]", outputs: ["skyModalScrollShadow"] }, { kind: "pipe", type: i2$2.SkyLibResourcesPipe, name: "skyLibResources" }] });
1063
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponent, decorators: [{
1064
- type: Component,
1065
- args: [{ selector: 'sky-modal', providers: [
1066
- SkyModalComponentAdapterService,
1067
- SkyModalErrorsService,
1068
- SkyDockService,
1069
- ], template: "<div\n class=\"sky-modal-dialog\"\n aria-modal=\"true\"\n [attr.aria-describedby]=\"ariaDescribedBy || modalContentId.id\"\n [attr.aria-labelledby]=\"ariaLabelledBy || headerId.id\"\n [attr.aria-owns]=\"ariaOwns\"\n [attr.role]=\"ariaRoleOrDefault\"\n (window:resize)=\"windowResize()\"\n>\n <div\n class=\"sky-modal sky-shadow sky-box sky-elevation-16 sky-modal-{{ size }}\"\n tabindex=\"-1\"\n [ngClass]=\"{\n 'sky-modal-tiled': tiledBody,\n 'sky-modal-viewkeeper': viewkeeperEnabled()\n }\"\n [ngStyle]=\"{\n zIndex: modalZIndex\n }\"\n >\n <div\n class=\"sky-modal-header\"\n [hidden]=\"!headerContent || !headerContent.children || headerContent.children.length &lt; 1\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.topShadow\n }\"\n >\n <div\n class=\"sky-modal-header-content\"\n skyId\n [ngClass]=\"{\n 'sky-font-heading-2': size === 'full-page'\n }\"\n #headerContent\n #headerId=\"skyId\"\n >\n <ng-content select=\"sky-modal-header\"></ng-content>\n </div>\n <div class=\"sky-modal-header-buttons\">\n <button\n *ngIf=\"helpKey\"\n class=\"sky-btn sky-modal-btn-help\"\n name=\"help-button\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_modal_open_help' | skyLibResources\"\n (click)=\"helpButtonClick()\"\n >\n <sky-icon icon=\"question-circle\"></sky-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"sky-btn sky-modal-btn-close\"\n [attr.aria-label]=\"'skyux_modal_close' | skyLibResources\"\n (click)=\"closeButtonClick()\"\n >\n <sky-icon icon=\"close\"></sky-icon>\n </button>\n </div>\n </div>\n <div\n class=\"sky-modal-content sky-padding-even-large\"\n role=\"region\"\n tabindex=\"0\"\n skyId\n [attr.aria-labelledby]=\"headerId.id\"\n (skyModalScrollShadow)=\"scrollShadowChange($event)\"\n #modalContentId=\"skyId\"\n #modalContentWrapper\n >\n <ng-content select=\"sky-modal-content\"></ng-content>\n </div>\n <div\n class=\"sky-modal-footer\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.bottomShadow\n }\"\n >\n <ng-content select=\"sky-modal-footer\"></ng-content>\n </div>\n </div>\n</div>\n", styles: [".sky-modal{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;position:fixed;width:auto;left:0;right:0;top:20px;margin:10px;display:flex;flex-direction:column;overflow:hidden}.sky-modal:focus{outline:none}@media (min-width: 768px){.sky-modal:not(.sky-modal-large){margin:0 auto}.sky-modal-small{width:300px}.sky-modal-small .sky-modal-content,.sky-modal-small .sky-modal-header,.sky-modal-small .sky-modal-footer{max-width:300px}.sky-modal-medium{width:600px}.sky-modal-medium .sky-modal-content,.sky-modal-medium .sky-modal-header,.sky-modal-medium .sky-modal-footer{max-width:600px}}@media (min-width: 920px){.sky-modal-large{margin:0 auto;width:900px}.sky-modal-large .sky-modal-content,.sky-modal-large .sky-modal-header,.sky-modal-large .sky-modal-footer{max-width:900px}}.sky-modal-content{background-color:#fff;--sky-background-color-page-default: #fff}.sky-modal-content:focus{outline-style:dotted;outline-width:thin;outline-offset:-1px}.sky-modal-tiled .sky-modal-content{background-color:#eeeeef;--sky-background-color-page-default: $sky-background-color-neutral-light}.sky-modal-tiled .sky-modal-content ::ng-deep .sky-tile-title{font-family:BLKB Sans,Helvetica Neue,Arial,sans-serif;color:var(--sky-text-color-deemphasized);font-weight:300;font-size:19px}.sky-modal-header{padding:9px 3px 9px 15px;background-color:#fff;display:flex;align-items:baseline;border-bottom:1px solid #e2e3e4}.sky-modal-header-buttons{flex-shrink:.0001}.sky-modal-header-buttons .sky-btn{border:none;color:#cdcfd2;cursor:pointer}.sky-modal-header-buttons .sky-btn:hover{color:#979ba2;transition:color .15s}.sky-modal-header-content{flex-grow:1}.sky-modal-header{flex-shrink:0;z-index:2}.sky-modal-content{overflow-y:auto}.sky-modal-footer{flex-shrink:0;z-index:2}.sky-modal-full-page{width:100%;top:0;margin:0}.sky-modal-full-page .sky-modal-header-buttons sky-icon[icon=close]{font-size:20px}.sky-modal-full-page .sky-modal-content{flex-grow:1}:host ::ng-deep .sky-sectioned-form{min-height:460px;margin:-15px}.sky-modal-content>::ng-deep sky-dock{bottom:-15px;margin-left:-15px;margin-bottom:-15px;padding-top:15px;width:calc(100% + 30px)}:host-context(.sky-theme-modern) .sky-modal-header{border:none;padding:20px 30px}:host-context(.sky-theme-modern) .sky-modal-btn-help,:host-context(.sky-theme-modern) .sky-modal-btn-close{display:none}:host-context(.sky-theme-modern) .sky-modal-content{padding:0}:host-context(.sky-theme-modern) .sky-modal-full-page{width:calc(100% - 60px);margin:30px}:host-context(.sky-theme-modern) .sky-modal-content>::ng-deep sky-dock{bottom:0;margin-left:initial;margin-bottom:initial;padding-top:initial;width:100%}:host-context(.sky-theme-modern) .sky-modal-viewkeeper .sky-modal-header{box-shadow:none!important}:host-context(.sky-theme-modern) .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed{box-shadow:0 4px 8px -4px #0000004d}:host-context(.sky-theme-modern) .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed>sky-toolbar .sky-toolbar-container{background-color:#fff;--sky-background-color-page-default: #fff;padding-left:30px;padding-right:30px}.sky-theme-modern .sky-modal-header{border:none;padding:20px 30px}.sky-theme-modern .sky-modal-btn-help,.sky-theme-modern .sky-modal-btn-close{display:none}.sky-theme-modern .sky-modal-content{padding:0}.sky-theme-modern .sky-modal-full-page{width:calc(100% - 60px);margin:30px}.sky-theme-modern .sky-modal-content>::ng-deep sky-dock{bottom:0;margin-left:initial;margin-bottom:initial;padding-top:initial;width:100%}.sky-theme-modern .sky-modal-viewkeeper .sky-modal-header{box-shadow:none!important}.sky-theme-modern .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed{box-shadow:0 4px 8px -4px #0000004d}.sky-theme-modern .sky-modal-viewkeeper .sky-modal-content ::ng-deep sky-modal-content>.sky-viewkeeper-fixed>sky-toolbar .sky-toolbar-container{background-color:#fff;--sky-background-color-page-default: #fff;padding-left:30px;padding-right:30px}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal{border-color:#121212}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal-header{color:#fbfcfe}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal-header,:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-modal-content{background-color:transparent;--sky-background-color-page-default: $sky-theme-modern-mode-dark-background-color-page-default}.sky-theme-modern.sky-theme-mode-dark .sky-modal{border-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-modal-header{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-modal-header,.sky-theme-modern.sky-theme-mode-dark .sky-modal-content{background-color:transparent;--sky-background-color-page-default: $sky-theme-modern-mode-dark-background-color-page-default}\n"] }]
1070
- }], ctorParameters: function () {
1071
- return [{ type: SkyModalHostService }, { type: SkyModalConfiguration }, { type: i0.ElementRef }, { type: i3.SkyAppWindowRef }, { type: SkyModalComponentAdapterService }, { type: i3.SkyCoreAdapterService }, { type: i3.SkyDockService, decorators: [{
1072
- type: Host
1073
- }] }, { type: i3.SkyResizeObserverMediaQueryService, decorators: [{
1074
- type: Optional
1075
- }] }];
1076
- }, propDecorators: { wrapperClass: [{
1077
- type: HostBinding,
1078
- args: ['class']
1079
- }], formErrors: [{
1080
- type: Input
1081
- }], ariaRole: [{
1082
- type: Input
1083
- }], tiledBody: [{
1084
- type: Input
1085
- }], ariaDescribedBy: [{
1086
- type: Input
1087
- }], ariaLabelledBy: [{
1088
- type: Input
1089
- }], modalContentWrapperElement: [{
1090
- type: ViewChild,
1091
- args: ['modalContentWrapper', { read: ElementRef }]
1092
- }], onDocumentKeyUp: [{
1093
- type: HostListener,
1094
- args: ['document:keyup', ['$event']]
1095
- }], onDocumentKeyDown: [{
1096
- type: HostListener,
1097
- args: ['document:keydown', ['$event']]
1098
- }] } });
1099
-
1100
- var _SkyConfirmComponent_instances, _SkyConfirmComponent_config, _SkyConfirmComponent_modal, _SkyConfirmComponent_resourcesService, _SkyConfirmComponent_getPresetButtons, _SkyConfirmComponent_getCustomButtons;
1101
- class SkyConfirmComponent {
1102
- constructor(config, modal, resourcesService, idService) {
1103
- _SkyConfirmComponent_instances.add(this);
1104
- this.preserveWhiteSpace = false;
1105
- this.isOkType = false;
1106
- _SkyConfirmComponent_config.set(this, void 0);
1107
- _SkyConfirmComponent_modal.set(this, void 0);
1108
- _SkyConfirmComponent_resourcesService.set(this, void 0);
1109
- __classPrivateFieldSet(this, _SkyConfirmComponent_config, config, "f");
1110
- __classPrivateFieldSet(this, _SkyConfirmComponent_modal, modal, "f");
1111
- __classPrivateFieldSet(this, _SkyConfirmComponent_resourcesService, resourcesService, "f");
1112
- if (config.type === SkyConfirmType.Custom &&
1113
- config.buttons &&
1114
- config.buttons.length > 0) {
1115
- this.buttons = __classPrivateFieldGet(this, _SkyConfirmComponent_instances, "m", _SkyConfirmComponent_getCustomButtons).call(this, config.buttons);
1116
- }
1117
- else {
1118
- __classPrivateFieldGet(this, _SkyConfirmComponent_instances, "m", _SkyConfirmComponent_getPresetButtons).call(this)
1119
- .pipe(take(1))
1120
- .subscribe((buttons) => {
1121
- this.buttons = buttons;
1122
- });
1123
- }
1124
- this.message = config.message;
1125
- this.body = config.body;
1126
- // Using the service here instead of the directive due to the confirm component's "body" container being conditional and thus a template variable being unavailable at an outer scope
1127
- this.bodyId = idService.generateId();
1128
- this.preserveWhiteSpace = !!config.preserveWhiteSpace;
1129
- this.isOkType = config.type === SkyConfirmType.OK;
1130
- }
1131
- close(button) {
1132
- const result = {
1133
- action: button.action,
1134
- };
1135
- __classPrivateFieldGet(this, _SkyConfirmComponent_modal, "f").close(result);
1136
- }
1137
- }
1138
- _SkyConfirmComponent_config = new WeakMap(), _SkyConfirmComponent_modal = new WeakMap(), _SkyConfirmComponent_resourcesService = new WeakMap(), _SkyConfirmComponent_instances = new WeakSet(), _SkyConfirmComponent_getPresetButtons = function _SkyConfirmComponent_getPresetButtons() {
1139
- const emitter = new ReplaySubject(1);
1140
- __classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f")
1141
- .getStrings({
1142
- cancel: 'skyux_confirm_dialog_default_cancel_text',
1143
- no: 'skyux_confirm_dialog_default_no_text',
1144
- ok: 'skyux_confirm_dialog_default_ok_text',
1145
- yes: 'skyux_confirm_dialog_default_yes_text',
1146
- })
1147
- .subscribe((values) => {
1148
- const confirmButtons = [];
1149
- switch (__classPrivateFieldGet(this, _SkyConfirmComponent_config, "f").type) {
1150
- case SkyConfirmType.YesNoCancel:
1151
- case SkyConfirmType.YesCancel:
1152
- confirmButtons.push({
1153
- text: values.yes,
1154
- autofocus: true,
1155
- styleType: 'primary',
1156
- action: 'yes',
1157
- });
1158
- if (__classPrivateFieldGet(this, _SkyConfirmComponent_config, "f").type === SkyConfirmType.YesNoCancel) {
1159
- confirmButtons.push({
1160
- text: values.no,
1161
- styleType: 'default',
1162
- action: 'no',
1163
- });
1164
- }
1165
- confirmButtons.push({
1166
- text: values.cancel,
1167
- styleType: 'link',
1168
- action: 'cancel',
1169
- });
1170
- break;
1171
- default:
1172
- confirmButtons.push({
1173
- text: values.ok,
1174
- autofocus: true,
1175
- styleType: 'primary',
1176
- action: 'ok',
1177
- });
1178
- }
1179
- emitter.next(confirmButtons);
1180
- });
1181
- return emitter.asObservable();
1182
- }, _SkyConfirmComponent_getCustomButtons = function _SkyConfirmComponent_getCustomButtons(buttonConfig) {
1183
- return buttonConfig.map((config) => ({
1184
- text: config.text,
1185
- action: config.action,
1186
- styleType: config.styleType || 'default',
1187
- autofocus: config.autofocus || false,
1188
- }));
1189
- };
1190
- SkyConfirmComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmComponent, deps: [{ token: SKY_CONFIRM_CONFIG }, { token: SkyModalInstance }, { token: i2$2.SkyLibResourcesService }, { token: i3.SkyIdService }], target: i0.ɵɵFactoryTarget.Component });
1191
- SkyConfirmComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SkyConfirmComponent, selector: "sky-confirm", ngImport: i0, template: "<div class=\"sky-confirm\" [ngClass]=\"{ 'sky-confirm-type-ok': isOkType }\">\n <sky-modal\n ariaRole=\"alertdialog\"\n [ariaLabelledBy]=\"confirmMessage.id\"\n [ariaDescribedBy]=\"body ? bodyId : undefined\"\n >\n <sky-modal-content class=\"sky-confirm-content\">\n <!--\n The following \"magic comment\" keeps Prettier from adding line breaks\n inside the div and causing leading and trailing whitespace when\n `preserveWhiteSpace` is `true`.\n https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting\n -->\n <!-- display: inline -->\n <div\n class=\"sky-confirm-message\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n [skyThemeClass]=\"{\n 'sky-font-display-4': 'default',\n 'sky-font-heading-1 sky-font-display-3': 'modern'\n }\"\n skyId\n #confirmMessage=\"skyId\"\n >{{ message }}</div\n >\n\n <!--\n The following \"magic comment\" keeps Prettier from adding line breaks\n inside the div and causing leading and trailing whitespace when\n `preserveWhiteSpace` is `true`.\n https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting\n -->\n <!-- display: inline -->\n <div\n *ngIf=\"body\"\n class=\"sky-confirm-body\"\n [id]=\"bodyId\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n >{{ body }}</div\n >\n\n <div class=\"sky-confirm-buttons\">\n <button\n *ngFor=\"let button of buttons\"\n type=\"button\"\n class=\"sky-btn\"\n [ngClass]=\"'sky-btn-' + button.styleType\"\n [skyThemeClass]=\"{\n 'sky-margin-inline-sm': 'modern',\n 'sky-margin-inline-compact': 'default'\n }\"\n (click)=\"close(button)\"\n [attr.autofocus]=\"button.autofocus ? 'autofocus' : null\"\n >\n {{ button.text }}\n </button>\n </div>\n </sky-modal-content>\n </sky-modal>\n</div>\n", styles: [".sky-confirm{--sky-confirm-body-margin-top: var(--sky-margin-stacked-sm);--sky-confirm-buttons-margin-top: var(--sky-margin-stacked-xl);--sky-confirm-content-padding: 0;--sky-confirm-message-padding-bottom: 0}:host-context(.sky-theme-modern) .sky-confirm{--sky-confirm-body-margin-top: 0;--sky-confirm-buttons-margin-top: var(--sky-margin-stacked-lg);--sky-confirm-content-padding: var(--sky-margin-stacked-lg) var(--sky-margin-inline-xl);--sky-confirm-message-padding-bottom: var(--sky-margin-stacked-lg)}.sky-theme-modern .sky-confirm{--sky-confirm-body-margin-top: 0;--sky-confirm-buttons-margin-top: var(--sky-margin-stacked-lg);--sky-confirm-content-padding: var(--sky-margin-stacked-lg) var(--sky-margin-inline-xl);--sky-confirm-message-padding-bottom: var(--sky-margin-stacked-lg)}.sky-confirm-content{padding:var(--sky-confirm-content-padding)}.sky-confirm-message{margin-top:var(--sky-margin-stacked-xs);padding-bottom:var(--sky-confirm-message-padding-bottom)}.sky-confirm-body{margin-top:var(--sky-confirm-body-margin-top)}.sky-confirm-buttons{margin-top:var(--sky-confirm-buttons-margin-top)}.sky-confirm-preserve-white-space{white-space:pre-wrap}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.λ2, selector: "[skyId]", exportAs: ["skyId"] }, { kind: "component", type: SkyModalComponent, selector: "sky-modal", inputs: ["formErrors", "ariaRole", "tiledBody", "ariaDescribedBy", "ariaLabelledBy"] }, { kind: "component", type: SkyModalContentComponent, selector: "sky-modal-content" }, { kind: "directive", type: i2$1.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }] });
1192
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmComponent, decorators: [{
1193
- type: Component,
1194
- args: [{ selector: 'sky-confirm', template: "<div class=\"sky-confirm\" [ngClass]=\"{ 'sky-confirm-type-ok': isOkType }\">\n <sky-modal\n ariaRole=\"alertdialog\"\n [ariaLabelledBy]=\"confirmMessage.id\"\n [ariaDescribedBy]=\"body ? bodyId : undefined\"\n >\n <sky-modal-content class=\"sky-confirm-content\">\n <!--\n The following \"magic comment\" keeps Prettier from adding line breaks\n inside the div and causing leading and trailing whitespace when\n `preserveWhiteSpace` is `true`.\n https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting\n -->\n <!-- display: inline -->\n <div\n class=\"sky-confirm-message\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n [skyThemeClass]=\"{\n 'sky-font-display-4': 'default',\n 'sky-font-heading-1 sky-font-display-3': 'modern'\n }\"\n skyId\n #confirmMessage=\"skyId\"\n >{{ message }}</div\n >\n\n <!--\n The following \"magic comment\" keeps Prettier from adding line breaks\n inside the div and causing leading and trailing whitespace when\n `preserveWhiteSpace` is `true`.\n https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting\n -->\n <!-- display: inline -->\n <div\n *ngIf=\"body\"\n class=\"sky-confirm-body\"\n [id]=\"bodyId\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n >{{ body }}</div\n >\n\n <div class=\"sky-confirm-buttons\">\n <button\n *ngFor=\"let button of buttons\"\n type=\"button\"\n class=\"sky-btn\"\n [ngClass]=\"'sky-btn-' + button.styleType\"\n [skyThemeClass]=\"{\n 'sky-margin-inline-sm': 'modern',\n 'sky-margin-inline-compact': 'default'\n }\"\n (click)=\"close(button)\"\n [attr.autofocus]=\"button.autofocus ? 'autofocus' : null\"\n >\n {{ button.text }}\n </button>\n </div>\n </sky-modal-content>\n </sky-modal>\n</div>\n", styles: [".sky-confirm{--sky-confirm-body-margin-top: var(--sky-margin-stacked-sm);--sky-confirm-buttons-margin-top: var(--sky-margin-stacked-xl);--sky-confirm-content-padding: 0;--sky-confirm-message-padding-bottom: 0}:host-context(.sky-theme-modern) .sky-confirm{--sky-confirm-body-margin-top: 0;--sky-confirm-buttons-margin-top: var(--sky-margin-stacked-lg);--sky-confirm-content-padding: var(--sky-margin-stacked-lg) var(--sky-margin-inline-xl);--sky-confirm-message-padding-bottom: var(--sky-margin-stacked-lg)}.sky-theme-modern .sky-confirm{--sky-confirm-body-margin-top: 0;--sky-confirm-buttons-margin-top: var(--sky-margin-stacked-lg);--sky-confirm-content-padding: var(--sky-margin-stacked-lg) var(--sky-margin-inline-xl);--sky-confirm-message-padding-bottom: var(--sky-margin-stacked-lg)}.sky-confirm-content{padding:var(--sky-confirm-content-padding)}.sky-confirm-message{margin-top:var(--sky-margin-stacked-xs);padding-bottom:var(--sky-confirm-message-padding-bottom)}.sky-confirm-body{margin-top:var(--sky-confirm-body-margin-top)}.sky-confirm-buttons{margin-top:var(--sky-confirm-buttons-margin-top)}.sky-confirm-preserve-white-space{white-space:pre-wrap}\n"] }]
1195
- }], ctorParameters: function () {
1196
- return [{ type: undefined, decorators: [{
1197
- type: Inject,
1198
- args: [SKY_CONFIRM_CONFIG]
1199
- }] }, { type: SkyModalInstance }, { type: i2$2.SkyLibResourcesService }, { type: i3.SkyIdService }];
1200
- } });
1201
-
1202
- var _SkyModalService_instances, _SkyModalService_dynamicComponentService, _SkyModalService_getConfigFromParameter, _SkyModalService_createHostComponent;
1203
- /**
1204
- * A service that launches modals.
1205
- * @dynamic
1206
- */
1207
- class SkyModalService {
1208
- constructor(dynamicComponentService) {
1209
- _SkyModalService_instances.add(this);
1210
- _SkyModalService_dynamicComponentService.set(this, void 0);
1211
- __classPrivateFieldSet(this, _SkyModalService_dynamicComponentService, dynamicComponentService, "f");
1212
- }
1213
- /**
1214
- * @internal
1215
- * Removes the modal host from the DOM.
1216
- */
1217
- dispose() {
1218
- if (SkyModalService.host) {
1219
- __classPrivateFieldGet(this, _SkyModalService_dynamicComponentService, "f").removeComponent(SkyModalService.host);
1220
- SkyModalService.host = undefined;
1221
- }
1222
- }
1223
- /**
1224
- * Opens a modal using the specified component.
1225
- * @param component Determines the component to render.
1226
- * @param {SkyModalConfigurationInterface} config Specifies configuration options for the modal.
1227
- */
1228
- open(component, config) {
1229
- const modalInstance = new SkyModalInstance();
1230
- __classPrivateFieldGet(this, _SkyModalService_instances, "m", _SkyModalService_createHostComponent).call(this);
1231
- const params = __classPrivateFieldGet(this, _SkyModalService_instances, "m", _SkyModalService_getConfigFromParameter).call(this, config);
1232
- params.providers || (params.providers = []);
1233
- params.providers.push({
1234
- provide: SkyModalInstance,
1235
- useValue: modalInstance,
1236
- });
1237
- if (SkyModalService.host) {
1238
- SkyModalService.host.instance.open(modalInstance, component, params);
1239
- }
1240
- return modalInstance;
1241
- }
1242
- }
1243
- _SkyModalService_dynamicComponentService = new WeakMap(), _SkyModalService_instances = new WeakSet(), _SkyModalService_getConfigFromParameter = function _SkyModalService_getConfigFromParameter(providersOrConfig) {
1244
- const defaultParams = {
1245
- providers: [],
1246
- fullPage: false,
1247
- size: 'medium',
1248
- tiledBody: false,
1249
- };
1250
- let params = {};
1251
- let method = undefined;
1252
- // Object Literal Lookup for backwards compatibility.
1253
- method = {
1254
- 'providers?': Object.assign({}, defaultParams, {
1255
- providers: providersOrConfig,
1256
- }),
1257
- config: Object.assign({}, defaultParams, providersOrConfig),
1258
- };
1259
- if (Array.isArray(providersOrConfig) === true) {
1260
- params = method['providers?'];
1261
- }
1262
- else {
1263
- params = method['config'];
1264
- }
1265
- return params;
1266
- }, _SkyModalService_createHostComponent = function _SkyModalService_createHostComponent() {
1267
- if (!SkyModalService.host) {
1268
- SkyModalService.host = __classPrivateFieldGet(this, _SkyModalService_dynamicComponentService, "f").createComponent(SkyModalHostComponent, {
1269
- providers: [
1270
- {
1271
- provide: SkyModalHostContext,
1272
- useValue: new SkyModalHostContext({
1273
- teardownCallback: () => {
1274
- this.dispose();
1275
- },
1276
- }),
1277
- },
1278
- ],
1279
- });
1280
- }
1281
- };
1282
- SkyModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalService, deps: [{ token: i3.SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable });
1283
- SkyModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalService, providedIn: 'any' });
1284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalService, decorators: [{
1285
- type: Injectable,
1286
- args: [{
1287
- // Must be 'any' so that the modal component is created in the context of its module's injector.
1288
- // If set to 'root', the component's dependency injections would only be derived from the root
1289
- // injector and may lose context if the modal was opened from within a lazy-loaded module.
1290
- providedIn: 'any',
1291
- }]
1292
- }], ctorParameters: function () { return [{ type: i3.SkyDynamicComponentService }]; } });
1293
-
1294
- var _SkyConfirmService_modalService;
1295
- /**
1296
- * Launches a dialog.
1297
- */
1298
- class SkyConfirmService {
1299
- constructor(modalService) {
1300
- _SkyConfirmService_modalService.set(this, void 0);
1301
- __classPrivateFieldSet(this, _SkyConfirmService_modalService, modalService, "f");
1302
- }
1303
- /**
1304
- * Opens a dialog using the specified options.
1305
- * @param config Specifies configuration options for the dialog.
1306
- */
1307
- open(config) {
1308
- const modalInstance = __classPrivateFieldGet(this, _SkyConfirmService_modalService, "f").open(SkyConfirmComponent, {
1309
- providers: [
1310
- {
1311
- provide: SKY_CONFIRM_CONFIG,
1312
- useValue: config,
1313
- },
1314
- ],
1315
- });
1316
- const confirmInstance = new SkyConfirmInstance();
1317
- modalInstance.closed.subscribe((args) => {
1318
- let result = args.data;
1319
- // The modal was closed using the ESC key.
1320
- if (result === undefined) {
1321
- result = {
1322
- action: 'cancel',
1323
- };
1324
- }
1325
- confirmInstance.closed.emit(result);
1326
- confirmInstance.closed.complete();
1327
- });
1328
- return confirmInstance;
1329
- }
1330
- }
1331
- _SkyConfirmService_modalService = new WeakMap();
1332
- SkyConfirmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmService, deps: [{ token: SkyModalService }], target: i0.ɵɵFactoryTarget.Injectable });
1333
- SkyConfirmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmService, providedIn: 'any' });
1334
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmService, decorators: [{
1335
- type: Injectable,
1336
- args: [{
1337
- // Must be 'any' so that the modal component is created in the context of its module's injector.
1338
- // If set to 'root', the component's dependency injections would only be derived from the root
1339
- // injector and may loose context if the modal was opened from within a lazy-loaded module.
1340
- providedIn: 'any',
1341
- }]
1342
- }], ctorParameters: function () { return [{ type: SkyModalService }]; } });
1343
-
1344
- var _SkyModalIsDirtyDirective_instances, _SkyModalIsDirtyDirective_ngUnsubscribe, _SkyModalIsDirtyDirective_modalInstance, _SkyModalIsDirtyDirective_confirmSvc, _SkyModalIsDirtyDirective_resourcesSvc, _SkyModalIsDirtyDirective_promptIfDirty;
1345
- /**
1346
- * Provides a way to mark a modal as "dirty" and displays a confirmation
1347
- * message when a user closes the modal without saving.
1348
- */
1349
- class SkyModalIsDirtyDirective {
1350
- constructor() {
1351
- _SkyModalIsDirtyDirective_instances.add(this);
1352
- /**
1353
- * Whether the user edited an input on the modal.
1354
- * @required
1355
- */
1356
- this.isDirty = false;
1357
- _SkyModalIsDirtyDirective_ngUnsubscribe.set(this, new Subject());
1358
- _SkyModalIsDirtyDirective_modalInstance.set(this, inject(SkyModalInstance));
1359
- _SkyModalIsDirtyDirective_confirmSvc.set(this, inject(SkyConfirmService));
1360
- _SkyModalIsDirtyDirective_resourcesSvc.set(this, inject(SkyLibResourcesService));
1361
- }
1362
- ngOnInit() {
1363
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_modalInstance, "f").beforeClose
1364
- .pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f")))
1365
- .subscribe((handler) => __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_instances, "m", _SkyModalIsDirtyDirective_promptIfDirty).call(this, handler));
1366
- }
1367
- ngOnDestroy() {
1368
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f").next();
1369
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f").complete();
1370
- }
1371
- }
1372
- _SkyModalIsDirtyDirective_ngUnsubscribe = new WeakMap(), _SkyModalIsDirtyDirective_modalInstance = new WeakMap(), _SkyModalIsDirtyDirective_confirmSvc = new WeakMap(), _SkyModalIsDirtyDirective_resourcesSvc = new WeakMap(), _SkyModalIsDirtyDirective_instances = new WeakSet(), _SkyModalIsDirtyDirective_promptIfDirty = function _SkyModalIsDirtyDirective_promptIfDirty(handler) {
1373
- if (this.isDirty && handler.closeArgs.reason === 'close') {
1374
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_resourcesSvc, "f")
1375
- .getStrings({
1376
- message: 'skyux_modal_dirty_default_message',
1377
- discardActionText: 'skyux_modal_dirty_default_discard_changes_text',
1378
- keepActionText: 'skyux_modal_dirty_default_keep_working_text',
1379
- })
1380
- .subscribe((textValues) => {
1381
- const discardAction = 'discard';
1382
- const keepAction = 'keep';
1383
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_confirmSvc, "f")
1384
- .open({
1385
- message: textValues.message,
1386
- buttons: [
1387
- {
1388
- action: discardAction,
1389
- text: textValues.discardActionText,
1390
- styleType: 'primary',
1391
- },
1392
- {
1393
- action: keepAction,
1394
- text: textValues.keepActionText,
1395
- styleType: 'link',
1396
- },
1397
- ],
1398
- type: SkyConfirmType.Custom,
1399
- })
1400
- .closed.subscribe((args) => {
1401
- if (args.action === discardAction) {
1402
- handler.closeModal();
1403
- }
1404
- });
1405
- });
1406
- }
1407
- else {
1408
- handler.closeModal();
1409
- }
1410
- };
1411
- SkyModalIsDirtyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalIsDirtyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1412
- SkyModalIsDirtyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: SkyModalIsDirtyDirective, selector: "sky-modal[isDirty]", inputs: { isDirty: "isDirty" }, host: { properties: { "attr.data-sky-modal-is-dirty": "this.isDirty" } }, ngImport: i0 });
1413
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalIsDirtyDirective, decorators: [{
1414
- type: Directive,
1415
- args: [{
1416
- // Since this is limited to sky-modal, it should be safe to
1417
- // leave off the sky prefix.
1418
- // eslint-disable-next-line @angular-eslint/directive-selector
1419
- selector: 'sky-modal[isDirty]',
1420
- }]
1421
- }], propDecorators: { isDirty: [{
1422
- type: Input
1423
- }, {
1424
- type: HostBinding,
1425
- args: ['attr.data-sky-modal-is-dirty']
1426
- }] } });
1427
-
1428
- class SkyModalModule {
1429
- }
1430
- SkyModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1431
- SkyModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, declarations: [SkyModalComponent,
1432
- SkyModalContentComponent,
1433
- SkyModalFooterComponent,
1434
- SkyModalHeaderComponent,
1435
- SkyModalHostComponent,
1436
- SkyModalIsDirtyDirective,
1437
- SkyModalScrollShadowDirective], imports: [CommonModule,
1438
- RouterModule,
1439
- SkyIconModule,
1440
- SkyIdModule,
1441
- SkyModalsResourcesModule,
1442
- SkyStatusIndicatorModule,
1443
- SkyThemeModule,
1444
- SkyTrimModule], exports: [SkyModalComponent,
1445
- SkyModalContentComponent,
1446
- SkyModalFooterComponent,
1447
- SkyModalHeaderComponent,
1448
- SkyModalIsDirtyDirective] });
1449
- SkyModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, imports: [CommonModule,
1450
- RouterModule,
1451
- SkyIconModule,
1452
- SkyIdModule,
1453
- SkyModalsResourcesModule,
1454
- SkyStatusIndicatorModule,
1455
- SkyThemeModule,
1456
- SkyTrimModule] });
1457
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, decorators: [{
1458
- type: NgModule,
1459
- args: [{
1460
- declarations: [
1461
- SkyModalComponent,
1462
- SkyModalContentComponent,
1463
- SkyModalFooterComponent,
1464
- SkyModalHeaderComponent,
1465
- SkyModalHostComponent,
1466
- SkyModalIsDirtyDirective,
1467
- SkyModalScrollShadowDirective,
1468
- ],
1469
- imports: [
1470
- CommonModule,
1471
- RouterModule,
1472
- SkyIconModule,
1473
- SkyIdModule,
1474
- SkyModalsResourcesModule,
1475
- SkyStatusIndicatorModule,
1476
- SkyThemeModule,
1477
- SkyTrimModule,
1478
- ],
1479
- exports: [
1480
- SkyModalComponent,
1481
- SkyModalContentComponent,
1482
- SkyModalFooterComponent,
1483
- SkyModalHeaderComponent,
1484
- SkyModalIsDirtyDirective,
1485
- ],
1486
- }]
1487
- }] });
1488
-
1489
- class SkyConfirmModule {
1490
- }
1491
- SkyConfirmModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1492
- SkyConfirmModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, declarations: [SkyConfirmComponent], imports: [CommonModule,
1493
- SkyIdModule,
1494
- SkyModalModule,
1495
- SkyModalsResourcesModule,
1496
- SkyThemeModule], exports: [SkyConfirmComponent] });
1497
- SkyConfirmModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, imports: [CommonModule,
1498
- SkyIdModule,
1499
- SkyModalModule,
1500
- SkyModalsResourcesModule,
1501
- SkyThemeModule] });
1502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, decorators: [{
1503
- type: NgModule,
1504
- args: [{
1505
- declarations: [SkyConfirmComponent],
1506
- imports: [
1507
- CommonModule,
1508
- SkyIdModule,
1509
- SkyModalModule,
1510
- SkyModalsResourcesModule,
1511
- SkyThemeModule,
1512
- ],
1513
- exports: [SkyConfirmComponent],
1514
- }]
1515
- }] });
1516
-
1517
- /**
1518
- * Generated bundle index. Do not edit.
1519
- */
1520
-
1521
- export { SkyConfirmInstance, SkyConfirmModule, SkyConfirmService, SkyConfirmType, SkyModalBeforeCloseHandler, SkyModalCloseArgs, SkyModalConfiguration, SkyModalErrorsService, SkyModalHostService, SkyModalInstance, SkyModalModule, SkyModalService, SkyConfirmComponent as λ1, SkyModalContentComponent as λ2, SkyModalFooterComponent as λ3, SkyModalHeaderComponent as λ4, SkyModalComponent as λ5, SkyModalIsDirtyDirective as λ6 };
1522
- //# sourceMappingURL=skyux-modals.mjs.map