@skyux/modals 8.7.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 (74) hide show
  1. package/esm2022/lib/modules/confirm/confirm.component.mjs +112 -0
  2. package/{esm2020 → esm2022}/lib/modules/confirm/confirm.module.mjs +13 -13
  3. package/esm2022/lib/modules/confirm/confirm.service.mjs +54 -0
  4. package/esm2022/lib/modules/modal/modal-adapter.service.mjs +99 -0
  5. package/esm2022/lib/modules/modal/modal-component-adapter.service.mjs +101 -0
  6. package/{esm2020 → esm2022}/lib/modules/modal/modal-configuration.mjs +4 -4
  7. package/{esm2020 → esm2022}/lib/modules/modal/modal-content.component.mjs +4 -4
  8. package/esm2022/lib/modules/modal/modal-errors.service.mjs +21 -0
  9. package/{esm2020 → esm2022}/lib/modules/modal/modal-footer.component.mjs +4 -4
  10. package/{esm2020 → esm2022}/lib/modules/modal/modal-header.component.mjs +4 -4
  11. package/{esm2020 → esm2022}/lib/modules/modal/modal-host-context.mjs +4 -4
  12. package/esm2022/lib/modules/modal/modal-host.component.mjs +163 -0
  13. package/esm2022/lib/modules/modal/modal-host.service.mjs +62 -0
  14. package/esm2022/lib/modules/modal/modal-instance.mjs +123 -0
  15. package/esm2022/lib/modules/modal/modal-is-dirty.directive.mjs +94 -0
  16. package/esm2022/lib/modules/modal/modal-scroll-shadow.directive.mjs +129 -0
  17. package/esm2022/lib/modules/modal/modal.component.mjs +229 -0
  18. package/{esm2020 → esm2022}/lib/modules/modal/modal.module.mjs +29 -29
  19. package/esm2022/lib/modules/modal/modal.service.mjs +97 -0
  20. package/esm2022/lib/modules/shared/sky-modals-resources.module.mjs +61 -0
  21. package/esm2022/testing/confirm/confirm-button-harness.mjs +46 -0
  22. package/esm2022/testing/confirm/confirm-harness.mjs +90 -0
  23. package/esm2022/testing/modal/modal-harness.mjs +75 -0
  24. package/esm2022/testing/modal-fixture.mjs +143 -0
  25. package/{fesm2020 → fesm2022}/skyux-modals-testing.mjs +60 -73
  26. package/{fesm2020 → fesm2022}/skyux-modals-testing.mjs.map +1 -1
  27. package/fesm2022/skyux-modals.mjs +1502 -0
  28. package/{fesm2015 → fesm2022}/skyux-modals.mjs.map +1 -1
  29. package/lib/modules/modal/modal-is-dirty.directive.d.ts +1 -1
  30. package/lib/modules/modal/modal.component.d.ts +1 -1
  31. package/package.json +16 -24
  32. package/esm2020/lib/modules/confirm/confirm.component.mjs +0 -114
  33. package/esm2020/lib/modules/confirm/confirm.service.mjs +0 -57
  34. package/esm2020/lib/modules/modal/modal-adapter.service.mjs +0 -101
  35. package/esm2020/lib/modules/modal/modal-component-adapter.service.mjs +0 -104
  36. package/esm2020/lib/modules/modal/modal-errors.service.mjs +0 -24
  37. package/esm2020/lib/modules/modal/modal-host.component.mjs +0 -164
  38. package/esm2020/lib/modules/modal/modal-host.service.mjs +0 -65
  39. package/esm2020/lib/modules/modal/modal-instance.mjs +0 -127
  40. package/esm2020/lib/modules/modal/modal-is-dirty.directive.mjs +0 -93
  41. package/esm2020/lib/modules/modal/modal-scroll-shadow.directive.mjs +0 -127
  42. package/esm2020/lib/modules/modal/modal.component.mjs +0 -228
  43. package/esm2020/lib/modules/modal/modal.service.mjs +0 -99
  44. package/esm2020/lib/modules/shared/sky-modals-resources.module.mjs +0 -61
  45. package/esm2020/testing/confirm/confirm-button-harness.mjs +0 -46
  46. package/esm2020/testing/confirm/confirm-harness.mjs +0 -97
  47. package/esm2020/testing/modal/modal-harness.mjs +0 -81
  48. package/esm2020/testing/modal-fixture.mjs +0 -145
  49. package/fesm2015/skyux-modals-testing.mjs +0 -409
  50. package/fesm2015/skyux-modals-testing.mjs.map +0 -1
  51. package/fesm2015/skyux-modals.mjs +0 -1522
  52. package/fesm2020/skyux-modals.mjs +0 -1510
  53. package/fesm2020/skyux-modals.mjs.map +0 -1
  54. /package/{esm2020 → esm2022}/index.mjs +0 -0
  55. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button-action.mjs +0 -0
  56. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button-config.mjs +0 -0
  57. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button-style-type.mjs +0 -0
  58. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-button.mjs +0 -0
  59. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-closed-event-args.mjs +0 -0
  60. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-config-token.mjs +0 -0
  61. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-config.mjs +0 -0
  62. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-instance.mjs +0 -0
  63. /package/{esm2020 → esm2022}/lib/modules/confirm/confirm-type.mjs +0 -0
  64. /package/{esm2020 → esm2022}/lib/modules/modal/modal-before-close-handler.mjs +0 -0
  65. /package/{esm2020 → esm2022}/lib/modules/modal/modal-close-args.mjs +0 -0
  66. /package/{esm2020 → esm2022}/lib/modules/modal/modal-error.mjs +0 -0
  67. /package/{esm2020 → esm2022}/lib/modules/modal/modal-host-context-args.mjs +0 -0
  68. /package/{esm2020 → esm2022}/lib/modules/modal/modal-scroll-shadow-event-args.mjs +0 -0
  69. /package/{esm2020 → esm2022}/lib/modules/modal/modal.interface.mjs +0 -0
  70. /package/{esm2020 → esm2022}/skyux-modals.mjs +0 -0
  71. /package/{esm2020 → esm2022}/testing/confirm/confirm-button-harness-filters.mjs +0 -0
  72. /package/{esm2020 → esm2022}/testing/modal/modal-harness-filters.mjs +0 -0
  73. /package/{esm2020 → esm2022}/testing/public-api.mjs +0 -0
  74. /package/{esm2020 → esm2022}/testing/skyux-modals-testing.mjs +0 -0
@@ -1,1510 +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 () { return [{ type: undefined, decorators: [{
361
- type: Inject,
362
- args: ['SkyModalHostContextArgs']
363
- }] }]; } });
364
-
365
- 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;
366
- /**
367
- * @internal
368
- */
369
- class SkyModalHostComponent {
370
- get modalOpen() {
371
- return SkyModalHostService.openModalCount > 0;
372
- }
373
- get backdropZIndex() {
374
- return SkyModalHostService.backdropZIndex;
375
- }
376
- constructor(resolver, adapter, injector, changeDetector, modalHostContext, elRef, router) {
377
- _SkyModalHostComponent_instances.add(this);
378
- _SkyModalHostComponent_resolver.set(this, void 0);
379
- _SkyModalHostComponent_adapter.set(this, void 0);
380
- _SkyModalHostComponent_injector.set(this, void 0);
381
- _SkyModalHostComponent_router.set(this, void 0);
382
- _SkyModalHostComponent_changeDetector.set(this, void 0);
383
- _SkyModalHostComponent_modalHostContext.set(this, void 0);
384
- _SkyModalHostComponent_elRef.set(this, void 0);
385
- _SkyModalHostComponent_modalInstances.set(this, []);
386
- __classPrivateFieldSet(this, _SkyModalHostComponent_resolver, resolver, "f");
387
- __classPrivateFieldSet(this, _SkyModalHostComponent_adapter, adapter, "f");
388
- __classPrivateFieldSet(this, _SkyModalHostComponent_injector, injector, "f");
389
- __classPrivateFieldSet(this, _SkyModalHostComponent_router, router, "f");
390
- __classPrivateFieldSet(this, _SkyModalHostComponent_changeDetector, changeDetector, "f");
391
- __classPrivateFieldSet(this, _SkyModalHostComponent_modalHostContext, modalHostContext, "f");
392
- __classPrivateFieldSet(this, _SkyModalHostComponent_elRef, elRef, "f");
393
- }
394
- ngOnDestroy() {
395
- // Close all modal instances before disposing of the host container.
396
- __classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_closeAllModalInstances).call(this);
397
- __classPrivateFieldGet(this, _SkyModalHostComponent_modalHostContext, "f").args.teardownCallback();
398
- }
399
- open(modalInstance, component, config) {
400
- /* Ignore coverage as we specify the target element and so the view child should never be undefined unless
401
- * we were to call the `open` method in an early lifecycle hook. */
402
- /* istanbul ignore next */
403
- if (!this.target) {
404
- return;
405
- }
406
- const params = Object.assign({}, config);
407
- const factory = __classPrivateFieldGet(this, _SkyModalHostComponent_resolver, "f").resolveComponentFactory(component);
408
- const hostService = new SkyModalHostService();
409
- hostService.fullPage = !!params.fullPage;
410
- const adapter = __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f");
411
- const modalOpener = adapter.getModalOpener();
412
- let isOpen = true;
413
- params.providers || (params.providers = []);
414
- params.providers.push({
415
- provide: SkyModalHostService,
416
- useValue: hostService,
417
- }, {
418
- provide: SkyModalConfiguration,
419
- useValue: params,
420
- }, {
421
- provide: SkyMediaQueryService,
422
- useExisting: SkyResizeObserverMediaQueryService,
423
- }, {
424
- provide: SKY_STACKING_CONTEXT,
425
- useValue: {
426
- zIndex: new BehaviorSubject(hostService.getModalZIndex())
427
- .asObservable()
428
- .pipe(takeUntil(modalInstance.closed)),
429
- },
430
- });
431
- adapter.setPageScroll(SkyModalHostService.openModalCount > 0);
432
- adapter.toggleFullPageModalClass(SkyModalHostService.fullPageModalCount > 0);
433
- const providers = params.providers || /* istanbul ignore next */ [];
434
- const injector = Injector.create({
435
- providers,
436
- parent: __classPrivateFieldGet(this, _SkyModalHostComponent_injector, "f"),
437
- });
438
- const modalComponentRef = this.target.createComponent(factory, undefined, injector);
439
- // modal element that was just opened
440
- const modalElement = modalComponentRef.location;
441
- modalInstance.adapter = __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f");
442
- modalInstance.componentRef = modalComponentRef;
443
- __classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_registerModalInstance).call(this, modalInstance);
444
- // hiding all elements at the modal-host level from screen readers when the a modal is opened
445
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").hideHostSiblingsFromScreenReaders(__classPrivateFieldGet(this, _SkyModalHostComponent_elRef, "f"));
446
- if (SkyModalHostService.openModalCount > 1 &&
447
- SkyModalHostService.topModal === hostService) {
448
- // hiding the lower modals when more than one modal is opened
449
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").hidePreviousModalFromScreenReaders(modalElement);
450
- }
451
- const closeModal = () => {
452
- // unhide siblings if last modal is closing
453
- if (SkyModalHostService.openModalCount === 1) {
454
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").unhideOrRestoreHostSiblingsFromScreenReaders();
455
- }
456
- else if (SkyModalHostService.topModal === hostService) {
457
- // if there are more than 1 modal then unhide the one behind this one before closing it
458
- __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").unhidePreviousModalFromScreenReaders(modalElement);
459
- }
460
- hostService.destroy();
461
- adapter.setPageScroll(SkyModalHostService.openModalCount > 0);
462
- adapter.toggleFullPageModalClass(SkyModalHostService.fullPageModalCount > 0);
463
- /* istanbul ignore else */
464
- /* sanity check */
465
- if (modalOpener && modalOpener.focus) {
466
- modalOpener.focus();
467
- }
468
- modalComponentRef.destroy();
469
- };
470
- hostService.openHelp.subscribe((helpKey) => {
471
- modalInstance.openHelp(helpKey);
472
- });
473
- hostService.close.subscribe(() => {
474
- modalInstance.close();
475
- });
476
- __classPrivateFieldGet(this, _SkyModalHostComponent_router, "f")?.events.pipe(takeWhile(() => isOpen)).subscribe((event) => {
477
- /* istanbul ignore else */
478
- if (event instanceof NavigationStart) {
479
- modalInstance.close();
480
- }
481
- });
482
- modalInstance.closed.subscribe(() => {
483
- isOpen = false;
484
- __classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_unregisterModalInstance).call(this, modalInstance);
485
- closeModal();
486
- });
487
- // Necessary if the host was created via a consumer's lifecycle hook such as ngOnInit
488
- __classPrivateFieldGet(this, _SkyModalHostComponent_changeDetector, "f").detectChanges();
489
- }
490
- }
491
- _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) {
492
- __classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").push(instance);
493
- }, _SkyModalHostComponent_unregisterModalInstance = function _SkyModalHostComponent_unregisterModalInstance(instance) {
494
- __classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").slice(__classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").indexOf(instance), 1);
495
- }, _SkyModalHostComponent_closeAllModalInstances = function _SkyModalHostComponent_closeAllModalInstances() {
496
- for (const instance of __classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f")) {
497
- instance.close();
498
- }
499
- };
500
- 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 });
501
- 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] });
502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalHostComponent, decorators: [{
503
- type: Component,
504
- 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"] }]
505
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: SkyModalAdapterService }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: SkyModalHostContext }, { type: i0.ElementRef }, { type: i3$1.Router, decorators: [{
506
- type: Optional
507
- }] }]; }, propDecorators: { target: [{
508
- type: ViewChild,
509
- args: ['target', {
510
- read: ViewContainerRef,
511
- static: true,
512
- }]
513
- }] } });
514
-
515
- /**
516
- * @internal
517
- */
518
- const SKY_CONFIRM_CONFIG = new InjectionToken('SkyConfirmConfig');
519
-
520
- /**
521
- * Properties about the modal close action and a method to close the modal.
522
- */
523
- class SkyModalBeforeCloseHandler {
524
- constructor(closeModal, closeArgs) {
525
- this.closeArgs = closeArgs;
526
- this.closeModal = closeModal;
527
- }
528
- }
529
-
530
- /**
531
- * Contains an object with the data passed from users when
532
- * a modal is closed and the reason that the modal was closed.
533
- */
534
- class SkyModalCloseArgs {
535
- }
536
-
537
- var _SkyModalInstance_instances, _SkyModalInstance__beforeClose, _SkyModalInstance__closed, _SkyModalInstance__helpOpened, _SkyModalInstance_adapter, _SkyModalInstance_elementRef, _SkyModalInstance_closeModal, _SkyModalInstance_notifyClosed;
538
- class SkyModalInstance {
539
- constructor() {
540
- _SkyModalInstance_instances.add(this);
541
- _SkyModalInstance__beforeClose.set(this, new Subject());
542
- _SkyModalInstance__closed.set(this, new Subject());
543
- _SkyModalInstance__helpOpened.set(this, new Subject());
544
- _SkyModalInstance_adapter.set(this, void 0);
545
- _SkyModalInstance_elementRef.set(this, void 0);
546
- }
547
- /**
548
- * An event that the modal instance emits when it is about to close.
549
- * It emits a `SkyModalBeforeCloseHandler` object with a `closeModal` method
550
- * that closes the modal. If a subscription exists for this event,
551
- * the modal does not close until the subscriber calls the `closeModal` method.
552
- */
553
- get beforeClose() {
554
- return __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f");
555
- }
556
- /**
557
- * An event that the modal instance emits when it closes.
558
- * It emits a `SkyModalCloseArgs` object with a `data` property that includes
559
- * data passed from users on close or save and a `reason` property that indicates
560
- * whether the modal was saved or closed without saving.
561
- * The `reason` property accepts any string value.
562
- * Common examples include `"cancel"`, `"close"`, and `"save"`.
563
- */
564
- get closed() {
565
- return __classPrivateFieldGet(this, _SkyModalInstance__closed, "f");
566
- }
567
- /**
568
- * An event that the modal instance emits when users click
569
- * the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
570
- * If a `helpKey` parameter was specified, the `helpOpened` event broadcasts the `helpKey`.
571
- */
572
- get helpOpened() {
573
- return __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f");
574
- }
575
- /**
576
- * Sets the component adapter for the instance. This is used internally for actions such as scrolling the content.
577
- * @internal
578
- */
579
- set adapter(value) {
580
- __classPrivateFieldSet(this, _SkyModalInstance_adapter, value, "f");
581
- }
582
- /**
583
- * 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.
584
- * @internal
585
- */
586
- set componentRef(value) {
587
- this.componentInstance = value.instance;
588
- __classPrivateFieldSet(this, _SkyModalInstance_elementRef, value.location, "f");
589
- }
590
- /**
591
- * Closes the modal instance.
592
- * @param result Specifies an object to emit to subscribers of the `closed` event of the
593
- * modal instance. The `SkyModalInstance` provider can be injected into a component's constructor
594
- * so that this `close` function can be called from a button in the `sky-modal-footer`.
595
- * @param reason Specifies the reason for the modal closing, with the default reason of `"close"`.
596
- * @param ignoreBeforeClose Indicates whether to ignore the modal instance's `beforeClose` event.
597
- */
598
- close(result, reason, ignoreBeforeClose) {
599
- if (reason === undefined) {
600
- reason = 'close';
601
- }
602
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, reason, result, ignoreBeforeClose);
603
- }
604
- /**
605
- * Closes the modal instance with `reason="cancel"`.
606
- * @param result Specifies an object to emit to subscribers of the `closed` event of the modal
607
- * instance. The `SkyModalInstance` provider can be injected into a component's constructor so
608
- * that this cancel function can be called from a button in the `sky-modal-footer`.
609
- */
610
- cancel(result) {
611
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'cancel', result);
612
- }
613
- /**
614
- * Closes the modal instance with `reason="save"`.
615
- * @param result Specifies an object to emit to subscribers of the `closed` event of the modal
616
- * instance. The `SkyModalInstance` provider can be injected into a component's constructor so
617
- * that this `save` function can be called from a button in `the sky-modal-footer`.
618
- */
619
- save(result) {
620
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'save', result);
621
- }
622
- /**
623
- * Scrolls the modal content area to the top of its scrollable area.
624
- */
625
- scrollContentToTop() {
626
- if (__classPrivateFieldGet(this, _SkyModalInstance_adapter, "f") && __classPrivateFieldGet(this, _SkyModalInstance_elementRef, "f")) {
627
- __classPrivateFieldGet(this, _SkyModalInstance_adapter, "f").scrollContentToTop(__classPrivateFieldGet(this, _SkyModalInstance_elementRef, "f"));
628
- }
629
- }
630
- /**
631
- * Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open
632
- * when users click the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
633
- * @param helpKey Specifies a string to emit to subscribers of
634
- * the modal instance's `helpOpened` event. Consumers can inject the `SkyModalInstance` provider
635
- * into a component's constructor to call the `openHelp` function in the modal template.
636
- */
637
- openHelp(helpKey) {
638
- __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").next(helpKey);
639
- }
640
- }
641
- _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) {
642
- const args = new SkyModalCloseArgs();
643
- args.reason = type;
644
- args.data = result;
645
- if (__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").observers.length === 0 || ignoreBeforeClose) {
646
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
647
- }
648
- else {
649
- __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").next(new SkyModalBeforeCloseHandler(() => {
650
- __classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
651
- }, args));
652
- }
653
- }, _SkyModalInstance_notifyClosed = function _SkyModalInstance_notifyClosed(args) {
654
- __classPrivateFieldGet(this, _SkyModalInstance__closed, "f").next(args);
655
- __classPrivateFieldGet(this, _SkyModalInstance__closed, "f").complete();
656
- __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").complete();
657
- __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").complete();
658
- };
659
-
660
- var _SkyModalComponentAdapterService_instances, _SkyModalComponentAdapterService_coreAdapter, _SkyModalComponentAdapterService_setFullPageHeight;
661
- /**
662
- * @internal
663
- */
664
- class SkyModalComponentAdapterService {
665
- constructor(coreAdapter) {
666
- _SkyModalComponentAdapterService_instances.add(this);
667
- _SkyModalComponentAdapterService_coreAdapter.set(this, void 0);
668
- __classPrivateFieldSet(this, _SkyModalComponentAdapterService_coreAdapter, coreAdapter, "f");
669
- }
670
- handleWindowChange(modalEl) {
671
- const boundedHeightEl = modalEl.nativeElement.querySelector('.sky-modal');
672
- const fullPageModalEl = modalEl.nativeElement.querySelector('.sky-modal-full-page');
673
- /*
674
- Set modal height equal to max height of window (accounting for padding above and below modal)
675
- */
676
- const newHeight = window.innerHeight - 40;
677
- boundedHeightEl.style.maxHeight = newHeight.toString() + 'px';
678
- if (fullPageModalEl) {
679
- __classPrivateFieldGet(this, _SkyModalComponentAdapterService_instances, "m", _SkyModalComponentAdapterService_setFullPageHeight).call(this, fullPageModalEl);
680
- }
681
- else {
682
- /*
683
- IE11 doesn't handle flex and max-height correctly so we have to explicitly add
684
- max-height to the content that accounts for standard header and footer height.
685
- */
686
- const modalContentEl = modalEl.nativeElement.querySelector('.sky-modal-content');
687
- const contentHeight = newHeight - 114;
688
- modalContentEl.style.maxHeight = contentHeight.toString() + 'px';
689
- }
690
- }
691
- isFocusInFirstItem(event, list) {
692
- /* istanbul ignore next */
693
- /* sanity check */
694
- const eventTarget = event.target || event.srcElement;
695
- return list.length > 0 && eventTarget === list[0];
696
- }
697
- isFocusInLastItem(event, list) {
698
- /* istanbul ignore next */
699
- /* sanity check */
700
- const eventTarget = event.target || event.srcElement;
701
- return list.length > 0 && eventTarget === list[list.length - 1];
702
- }
703
- isModalFocused(event, modalEl) {
704
- /* istanbul ignore next */
705
- /* sanity check */
706
- const eventTarget = event.target || event.srcElement;
707
- return (modalEl &&
708
- eventTarget === modalEl.nativeElement.querySelector('.sky-modal-dialog'));
709
- }
710
- focusLastElement(list) {
711
- if (list.length > 0) {
712
- list[list.length - 1].focus();
713
- return true;
714
- }
715
- return false;
716
- }
717
- focusFirstElement(list) {
718
- if (list.length > 0) {
719
- list[0].focus();
720
- return true;
721
- }
722
- return false;
723
- }
724
- modalContentHasDirectChildViewkeeper(modalContentEl) {
725
- return !!modalContentEl.nativeElement.querySelector('sky-modal-content > .sky-viewkeeper-fixed');
726
- }
727
- modalOpened(modalEl) {
728
- /* istanbul ignore else */
729
- /* handle the case where somehow there is a focused element already in the modal */
730
- if (!(document.activeElement &&
731
- modalEl.nativeElement.contains(document.activeElement))) {
732
- const currentScrollX = window.pageXOffset;
733
- const currentScrollY = window.pageYOffset;
734
- const inputWithAutofocus = modalEl.nativeElement.querySelector('[autofocus]');
735
- if (inputWithAutofocus) {
736
- inputWithAutofocus.focus();
737
- }
738
- else {
739
- __classPrivateFieldGet(this, _SkyModalComponentAdapterService_coreAdapter, "f").getFocusableChildrenAndApplyFocus(modalEl, '.sky-modal-content', true);
740
- }
741
- window.scrollTo(currentScrollX, currentScrollY);
742
- }
743
- }
744
- }
745
- _SkyModalComponentAdapterService_coreAdapter = new WeakMap(), _SkyModalComponentAdapterService_instances = new WeakSet(), _SkyModalComponentAdapterService_setFullPageHeight = function _SkyModalComponentAdapterService_setFullPageHeight(fullPageModalEl) {
746
- const windowHeight = window.innerHeight;
747
- const fullPageModalStyle = getComputedStyle(fullPageModalEl);
748
- const marginTopBottom = parseInt(fullPageModalStyle.marginTop, 10) +
749
- parseInt(fullPageModalStyle.marginBottom, 10);
750
- const fullPageModalHeight = windowHeight - marginTopBottom + 'px';
751
- fullPageModalEl.style.height = fullPageModalHeight;
752
- fullPageModalEl.style.maxHeight = fullPageModalHeight;
753
- };
754
- SkyModalComponentAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, deps: [{ token: i3.SkyCoreAdapterService }], target: i0.ɵɵFactoryTarget.Injectable });
755
- SkyModalComponentAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService });
756
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, decorators: [{
757
- type: Injectable
758
- }], ctorParameters: function () { return [{ type: i3.SkyCoreAdapterService }]; } });
759
-
760
- 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;
761
- /**
762
- * Raises an event when the box shadow for the modal header or footer should be adjusted
763
- * based on the scroll position of the host element.
764
- * @internal
765
- */
766
- class SkyModalScrollShadowDirective {
767
- constructor(elRef, mutationObserverSvc, ngZone, themeSvc) {
768
- _SkyModalScrollShadowDirective_instances.add(this);
769
- this.skyModalScrollShadow = new EventEmitter();
770
- _SkyModalScrollShadowDirective_currentShadow.set(this, void 0);
771
- _SkyModalScrollShadowDirective_currentTheme.set(this, void 0);
772
- _SkyModalScrollShadowDirective_mutationObserver.set(this, void 0);
773
- _SkyModalScrollShadowDirective_ngUnsubscribe.set(this, new Subject());
774
- _SkyModalScrollShadowDirective_elRef.set(this, void 0);
775
- _SkyModalScrollShadowDirective_mutationObserverSvc.set(this, void 0);
776
- _SkyModalScrollShadowDirective_ngZone.set(this, void 0);
777
- _SkyModalScrollShadowDirective_themeSvc.set(this, void 0);
778
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_elRef, elRef, "f");
779
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserverSvc, mutationObserverSvc, "f");
780
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_ngZone, ngZone, "f");
781
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_themeSvc, themeSvc, "f");
782
- }
783
- windowResize() {
784
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
785
- }
786
- scroll() {
787
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
788
- }
789
- ngOnInit() {
790
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_themeSvc, "f")) {
791
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_themeSvc, "f").settingsChange
792
- .pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f")))
793
- .subscribe((themeSettings) => {
794
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_currentTheme, themeSettings.currentSettings.theme, "f");
795
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentTheme, "f") === SkyTheme.presets.modern) {
796
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_initMutationObserver).call(this);
797
- }
798
- else {
799
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_emitShadow).call(this, {
800
- bottomShadow: 'none',
801
- topShadow: 'none',
802
- });
803
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_destroyMutationObserver).call(this);
804
- }
805
- });
806
- }
807
- }
808
- ngOnDestroy() {
809
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f").next();
810
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f").complete();
811
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_destroyMutationObserver).call(this);
812
- }
813
- }
814
- _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() {
815
- if (!__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f")) {
816
- const el = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_elRef, "f").nativeElement;
817
- // MutationObserver is patched by Zone.js and therefore becomes part of the
818
- // Angular change detection cycle, but this can lead to infinite loops in some
819
- // scenarios. This will keep MutationObserver from triggering change detection.
820
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngZone, "f").runOutsideAngular(() => {
821
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserver, __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserverSvc, "f").create(() => {
822
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
823
- }), "f");
824
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f").observe(el, {
825
- attributes: true,
826
- characterData: true,
827
- childList: true,
828
- subtree: true,
829
- });
830
- });
831
- }
832
- }, _SkyModalScrollShadowDirective_destroyMutationObserver = function _SkyModalScrollShadowDirective_destroyMutationObserver() {
833
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f")) {
834
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f").disconnect();
835
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserver, undefined, "f");
836
- }
837
- }, _SkyModalScrollShadowDirective_checkForShadow = function _SkyModalScrollShadowDirective_checkForShadow() {
838
- if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentTheme, "f") === SkyTheme.presets.modern) {
839
- const el = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_elRef, "f").nativeElement;
840
- const topShadow = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_buildShadowStyle).call(this, el.scrollTop);
841
- const bottomShadow = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_buildShadowStyle).call(this, el.scrollHeight - el.scrollTop - el.clientHeight);
842
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_emitShadow).call(this, {
843
- bottomShadow,
844
- topShadow,
845
- });
846
- }
847
- }, _SkyModalScrollShadowDirective_buildShadowStyle = function _SkyModalScrollShadowDirective_buildShadowStyle(pixelsFromEnd) {
848
- // Progressively darken the shadow until the user scrolls 30 pixels from the top or bottom
849
- // of the scrollable element, with a max opacity of 0.3.
850
- const opacity = Math.min(pixelsFromEnd / 30, 1) * 0.3;
851
- return opacity > 0 ? `0px 1px 8px 0px rgba(0, 0, 0, ${opacity})` : 'none';
852
- }, _SkyModalScrollShadowDirective_emitShadow = function _SkyModalScrollShadowDirective_emitShadow(shadow) {
853
- if (!__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f") ||
854
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f").bottomShadow !== shadow.bottomShadow ||
855
- __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f").topShadow !== shadow.topShadow) {
856
- this.skyModalScrollShadow.emit(shadow);
857
- __classPrivateFieldSet(this, _SkyModalScrollShadowDirective_currentShadow, shadow, "f");
858
- }
859
- };
860
- 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 });
861
- 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 });
862
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalScrollShadowDirective, decorators: [{
863
- type: Directive,
864
- args: [{
865
- selector: '[skyModalScrollShadow]',
866
- }]
867
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i3.SkyMutationObserverService }, { type: i0.NgZone }, { type: i2$1.SkyThemeService, decorators: [{
868
- type: Optional
869
- }] }]; }, propDecorators: { skyModalScrollShadow: [{
870
- type: Output
871
- }], windowResize: [{
872
- type: HostListener,
873
- args: ['window:resize']
874
- }], scroll: [{
875
- type: HostListener,
876
- args: ['scroll']
877
- }] } });
878
-
879
- 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;
880
- const ARIA_ROLE_DEFAULT = 'dialog';
881
- /**
882
- * Provides a common look-and-feel for modal content with options to display
883
- * a common modal header, specify body content, and display a common modal footer
884
- * and buttons.
885
- */
886
- class SkyModalComponent {
887
- /**
888
- * A list of form-level errors to display to the user.
889
- */
890
- set formErrors(value) {
891
- __classPrivateFieldGet(this, _SkyModalComponent_errorsSvc, "f").updateErrors(value);
892
- }
893
- /**
894
- * @internal
895
- */
896
- set ariaRole(value) {
897
- this.ariaRoleOrDefault = value || ARIA_ROLE_DEFAULT;
898
- }
899
- /**
900
- * @internal
901
- */
902
- set ariaDescribedBy(id) {
903
- __classPrivateFieldSet(this, _SkyModalComponent__ariaDescribedBy, id, "f");
904
- }
905
- get ariaDescribedBy() {
906
- return __classPrivateFieldGet(this, _SkyModalComponent__ariaDescribedBy, "f");
907
- }
908
- /**
909
- * @internal
910
- */
911
- set ariaLabelledBy(id) {
912
- __classPrivateFieldSet(this, _SkyModalComponent__ariaLabelledBy, id, "f");
913
- }
914
- get ariaLabelledBy() {
915
- return __classPrivateFieldGet(this, _SkyModalComponent__ariaLabelledBy, "f");
916
- }
917
- constructor(hostService, config, elRef, windowRef, componentAdapter, coreAdapter, dockService, mediaQueryService) {
918
- this.ariaRoleOrDefault = ARIA_ROLE_DEFAULT;
919
- this.ariaOwns = null;
920
- this.modalState = 'in';
921
- _SkyModalComponent_hostService.set(this, void 0);
922
- _SkyModalComponent_elRef.set(this, void 0);
923
- _SkyModalComponent_windowRef.set(this, void 0);
924
- _SkyModalComponent_componentAdapter.set(this, void 0);
925
- _SkyModalComponent_coreAdapter.set(this, void 0);
926
- _SkyModalComponent_dockService.set(this, void 0);
927
- _SkyModalComponent_mediaQueryService.set(this, void 0);
928
- _SkyModalComponent_ngUnsubscribe.set(this, new Subject());
929
- _SkyModalComponent__ariaDescribedBy.set(this, void 0);
930
- _SkyModalComponent__ariaLabelledBy.set(this, void 0);
931
- _SkyModalComponent_changeDetector.set(this, inject(ChangeDetectorRef));
932
- _SkyModalComponent_errorsSvc.set(this, inject(SkyModalErrorsService));
933
- _SkyModalComponent_liveAnnouncerSvc.set(this, inject(SkyLiveAnnouncerService));
934
- __classPrivateFieldSet(this, _SkyModalComponent_hostService, hostService, "f");
935
- __classPrivateFieldSet(this, _SkyModalComponent_elRef, elRef, "f");
936
- __classPrivateFieldSet(this, _SkyModalComponent_windowRef, windowRef, "f");
937
- __classPrivateFieldSet(this, _SkyModalComponent_componentAdapter, componentAdapter, "f");
938
- __classPrivateFieldSet(this, _SkyModalComponent_coreAdapter, coreAdapter, "f");
939
- __classPrivateFieldSet(this, _SkyModalComponent_dockService, dockService, "f");
940
- __classPrivateFieldSet(this, _SkyModalComponent_mediaQueryService, mediaQueryService, "f");
941
- this.ariaDescribedBy = config.ariaDescribedBy;
942
- this.ariaLabelledBy = config.ariaLabelledBy;
943
- this.ariaRole = config.ariaRole;
944
- this.helpKey = config.helpKey;
945
- this.tiledBody = config.tiledBody;
946
- this.wrapperClass = config.wrapperClass;
947
- this.size = config.fullPage
948
- ? 'full-page'
949
- : config.size?.toLowerCase() || 'medium';
950
- this.modalZIndex = __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").zIndex;
951
- }
952
- onDocumentKeyUp(event) {
953
- /* istanbul ignore else */
954
- /* sanity check */
955
- if (SkyModalHostService.openModalCount > 0) {
956
- const topModal = SkyModalHostService.topModal;
957
- if (topModal && topModal === __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f")) {
958
- if (event.which === 27) {
959
- // Escape key up
960
- event.preventDefault();
961
- this.closeButtonClick();
962
- }
963
- }
964
- }
965
- }
966
- onDocumentKeyDown(event) {
967
- /* istanbul ignore else */
968
- /* sanity check */
969
- if (SkyModalHostService.openModalCount > 0) {
970
- const topModal = SkyModalHostService.topModal;
971
- if (topModal && topModal === __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f")) {
972
- if (event.which === 9) {
973
- // Tab pressed
974
- let focusChanged = false;
975
- const focusElementList = __classPrivateFieldGet(this, _SkyModalComponent_coreAdapter, "f").getFocusableChildren(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f").nativeElement);
976
- if (event.shiftKey &&
977
- (__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isFocusInFirstItem(event, focusElementList) ||
978
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isModalFocused(event, __classPrivateFieldGet(this, _SkyModalComponent_elRef, "f")))) {
979
- focusChanged =
980
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").focusLastElement(focusElementList);
981
- }
982
- else if (!event.shiftKey &&
983
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isFocusInLastItem(event, focusElementList)) {
984
- focusChanged =
985
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").focusFirstElement(focusElementList);
986
- }
987
- if (focusChanged) {
988
- event.preventDefault();
989
- event.stopPropagation();
990
- }
991
- }
992
- }
993
- }
994
- }
995
- ngOnInit() {
996
- __classPrivateFieldGet(this, _SkyModalComponent_liveAnnouncerSvc, "f").announcerElementChanged
997
- .pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalComponent_ngUnsubscribe, "f")))
998
- .subscribe((element) => {
999
- if (element?.id) {
1000
- this.ariaOwns = element.id;
1001
- __classPrivateFieldGet(this, _SkyModalComponent_changeDetector, "f").markForCheck();
1002
- }
1003
- });
1004
- }
1005
- ngAfterViewInit() {
1006
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").handleWindowChange(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1007
- // Adding a timeout to avoid ExpressionChangedAfterItHasBeenCheckedError.
1008
- // https://stackoverflow.com/questions/40562845
1009
- __classPrivateFieldGet(this, _SkyModalComponent_windowRef, "f").nativeWindow.setTimeout(() => {
1010
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").modalOpened(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1011
- });
1012
- __classPrivateFieldGet(this, _SkyModalComponent_dockService, "f").setDockOptions({
1013
- location: SkyDockLocation.ElementBottom,
1014
- referenceEl: this.modalContentWrapperElement.nativeElement,
1015
- zIndex: 5,
1016
- });
1017
- /* istanbul ignore next */
1018
- if (__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f")) {
1019
- __classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f").observe(this.modalContentWrapperElement);
1020
- }
1021
- }
1022
- ngOnDestroy() {
1023
- /* istanbul ignore next */
1024
- if (__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f")) {
1025
- __classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f").unobserve();
1026
- }
1027
- __classPrivateFieldGet(this, _SkyModalComponent_ngUnsubscribe, "f").next();
1028
- __classPrivateFieldGet(this, _SkyModalComponent_ngUnsubscribe, "f").complete();
1029
- }
1030
- helpButtonClick() {
1031
- if (this.helpKey) {
1032
- __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").onOpenHelp(this.helpKey);
1033
- }
1034
- }
1035
- closeButtonClick() {
1036
- __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").onClose();
1037
- }
1038
- windowResize() {
1039
- __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").handleWindowChange(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1040
- }
1041
- scrollShadowChange(args) {
1042
- this.scrollShadow = args;
1043
- }
1044
- viewkeeperEnabled() {
1045
- return __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").modalContentHasDirectChildViewkeeper(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
1046
- }
1047
- }
1048
- _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();
1049
- 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 });
1050
- 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: [
1051
- SkyModalComponentAdapterService,
1052
- SkyModalErrorsService,
1053
- SkyDockService,
1054
- ], 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" }] });
1055
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponent, decorators: [{
1056
- type: Component,
1057
- args: [{ selector: 'sky-modal', providers: [
1058
- SkyModalComponentAdapterService,
1059
- SkyModalErrorsService,
1060
- SkyDockService,
1061
- ], 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"] }]
1062
- }], ctorParameters: function () { return [{ type: SkyModalHostService }, { type: SkyModalConfiguration }, { type: i0.ElementRef }, { type: i3.SkyAppWindowRef }, { type: SkyModalComponentAdapterService }, { type: i3.SkyCoreAdapterService }, { type: i3.SkyDockService, decorators: [{
1063
- type: Host
1064
- }] }, { type: i3.SkyResizeObserverMediaQueryService, decorators: [{
1065
- type: Optional
1066
- }] }]; }, propDecorators: { wrapperClass: [{
1067
- type: HostBinding,
1068
- args: ['class']
1069
- }], formErrors: [{
1070
- type: Input
1071
- }], ariaRole: [{
1072
- type: Input
1073
- }], tiledBody: [{
1074
- type: Input
1075
- }], ariaDescribedBy: [{
1076
- type: Input
1077
- }], ariaLabelledBy: [{
1078
- type: Input
1079
- }], modalContentWrapperElement: [{
1080
- type: ViewChild,
1081
- args: ['modalContentWrapper', { read: ElementRef }]
1082
- }], onDocumentKeyUp: [{
1083
- type: HostListener,
1084
- args: ['document:keyup', ['$event']]
1085
- }], onDocumentKeyDown: [{
1086
- type: HostListener,
1087
- args: ['document:keydown', ['$event']]
1088
- }] } });
1089
-
1090
- var _SkyConfirmComponent_instances, _SkyConfirmComponent_config, _SkyConfirmComponent_modal, _SkyConfirmComponent_resourcesService, _SkyConfirmComponent_getPresetButtons, _SkyConfirmComponent_getCustomButtons;
1091
- class SkyConfirmComponent {
1092
- constructor(config, modal, resourcesService, idService) {
1093
- _SkyConfirmComponent_instances.add(this);
1094
- this.preserveWhiteSpace = false;
1095
- this.isOkType = false;
1096
- _SkyConfirmComponent_config.set(this, void 0);
1097
- _SkyConfirmComponent_modal.set(this, void 0);
1098
- _SkyConfirmComponent_resourcesService.set(this, void 0);
1099
- __classPrivateFieldSet(this, _SkyConfirmComponent_config, config, "f");
1100
- __classPrivateFieldSet(this, _SkyConfirmComponent_modal, modal, "f");
1101
- __classPrivateFieldSet(this, _SkyConfirmComponent_resourcesService, resourcesService, "f");
1102
- if (config.type === SkyConfirmType.Custom &&
1103
- config.buttons &&
1104
- config.buttons.length > 0) {
1105
- this.buttons = __classPrivateFieldGet(this, _SkyConfirmComponent_instances, "m", _SkyConfirmComponent_getCustomButtons).call(this, config.buttons);
1106
- }
1107
- else {
1108
- __classPrivateFieldGet(this, _SkyConfirmComponent_instances, "m", _SkyConfirmComponent_getPresetButtons).call(this)
1109
- .pipe(take(1))
1110
- .subscribe((buttons) => {
1111
- this.buttons = buttons;
1112
- });
1113
- }
1114
- this.message = config.message;
1115
- this.body = config.body;
1116
- // 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
1117
- this.bodyId = idService.generateId();
1118
- this.preserveWhiteSpace = !!config.preserveWhiteSpace;
1119
- this.isOkType = config.type === SkyConfirmType.OK;
1120
- }
1121
- close(button) {
1122
- const result = {
1123
- action: button.action,
1124
- };
1125
- __classPrivateFieldGet(this, _SkyConfirmComponent_modal, "f").close(result);
1126
- }
1127
- }
1128
- _SkyConfirmComponent_config = new WeakMap(), _SkyConfirmComponent_modal = new WeakMap(), _SkyConfirmComponent_resourcesService = new WeakMap(), _SkyConfirmComponent_instances = new WeakSet(), _SkyConfirmComponent_getPresetButtons = function _SkyConfirmComponent_getPresetButtons() {
1129
- const emitter = new ReplaySubject(1);
1130
- __classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f")
1131
- .getStrings({
1132
- cancel: 'skyux_confirm_dialog_default_cancel_text',
1133
- no: 'skyux_confirm_dialog_default_no_text',
1134
- ok: 'skyux_confirm_dialog_default_ok_text',
1135
- yes: 'skyux_confirm_dialog_default_yes_text',
1136
- })
1137
- .subscribe((values) => {
1138
- const confirmButtons = [];
1139
- switch (__classPrivateFieldGet(this, _SkyConfirmComponent_config, "f").type) {
1140
- case SkyConfirmType.YesNoCancel:
1141
- case SkyConfirmType.YesCancel:
1142
- confirmButtons.push({
1143
- text: values.yes,
1144
- autofocus: true,
1145
- styleType: 'primary',
1146
- action: 'yes',
1147
- });
1148
- if (__classPrivateFieldGet(this, _SkyConfirmComponent_config, "f").type === SkyConfirmType.YesNoCancel) {
1149
- confirmButtons.push({
1150
- text: values.no,
1151
- styleType: 'default',
1152
- action: 'no',
1153
- });
1154
- }
1155
- confirmButtons.push({
1156
- text: values.cancel,
1157
- styleType: 'link',
1158
- action: 'cancel',
1159
- });
1160
- break;
1161
- default:
1162
- confirmButtons.push({
1163
- text: values.ok,
1164
- autofocus: true,
1165
- styleType: 'primary',
1166
- action: 'ok',
1167
- });
1168
- }
1169
- emitter.next(confirmButtons);
1170
- });
1171
- return emitter.asObservable();
1172
- }, _SkyConfirmComponent_getCustomButtons = function _SkyConfirmComponent_getCustomButtons(buttonConfig) {
1173
- return buttonConfig.map((config) => ({
1174
- text: config.text,
1175
- action: config.action,
1176
- styleType: config.styleType || 'default',
1177
- autofocus: config.autofocus || false,
1178
- }));
1179
- };
1180
- 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 });
1181
- 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"] }] });
1182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmComponent, decorators: [{
1183
- type: Component,
1184
- 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"] }]
1185
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1186
- type: Inject,
1187
- args: [SKY_CONFIRM_CONFIG]
1188
- }] }, { type: SkyModalInstance }, { type: i2$2.SkyLibResourcesService }, { type: i3.SkyIdService }]; } });
1189
-
1190
- var _SkyModalService_instances, _SkyModalService_dynamicComponentService, _SkyModalService_getConfigFromParameter, _SkyModalService_createHostComponent;
1191
- /**
1192
- * A service that launches modals.
1193
- * @dynamic
1194
- */
1195
- class SkyModalService {
1196
- constructor(dynamicComponentService) {
1197
- _SkyModalService_instances.add(this);
1198
- _SkyModalService_dynamicComponentService.set(this, void 0);
1199
- __classPrivateFieldSet(this, _SkyModalService_dynamicComponentService, dynamicComponentService, "f");
1200
- }
1201
- /**
1202
- * @internal
1203
- * Removes the modal host from the DOM.
1204
- */
1205
- dispose() {
1206
- if (SkyModalService.host) {
1207
- __classPrivateFieldGet(this, _SkyModalService_dynamicComponentService, "f").removeComponent(SkyModalService.host);
1208
- SkyModalService.host = undefined;
1209
- }
1210
- }
1211
- /**
1212
- * Opens a modal using the specified component.
1213
- * @param component Determines the component to render.
1214
- * @param {SkyModalConfigurationInterface} config Specifies configuration options for the modal.
1215
- */
1216
- open(component, config) {
1217
- const modalInstance = new SkyModalInstance();
1218
- __classPrivateFieldGet(this, _SkyModalService_instances, "m", _SkyModalService_createHostComponent).call(this);
1219
- const params = __classPrivateFieldGet(this, _SkyModalService_instances, "m", _SkyModalService_getConfigFromParameter).call(this, config);
1220
- params.providers || (params.providers = []);
1221
- params.providers.push({
1222
- provide: SkyModalInstance,
1223
- useValue: modalInstance,
1224
- });
1225
- if (SkyModalService.host) {
1226
- SkyModalService.host.instance.open(modalInstance, component, params);
1227
- }
1228
- return modalInstance;
1229
- }
1230
- }
1231
- _SkyModalService_dynamicComponentService = new WeakMap(), _SkyModalService_instances = new WeakSet(), _SkyModalService_getConfigFromParameter = function _SkyModalService_getConfigFromParameter(providersOrConfig) {
1232
- const defaultParams = {
1233
- providers: [],
1234
- fullPage: false,
1235
- size: 'medium',
1236
- tiledBody: false,
1237
- };
1238
- let params = {};
1239
- let method = undefined;
1240
- // Object Literal Lookup for backwards compatibility.
1241
- method = {
1242
- 'providers?': Object.assign({}, defaultParams, {
1243
- providers: providersOrConfig,
1244
- }),
1245
- config: Object.assign({}, defaultParams, providersOrConfig),
1246
- };
1247
- if (Array.isArray(providersOrConfig) === true) {
1248
- params = method['providers?'];
1249
- }
1250
- else {
1251
- params = method['config'];
1252
- }
1253
- return params;
1254
- }, _SkyModalService_createHostComponent = function _SkyModalService_createHostComponent() {
1255
- if (!SkyModalService.host) {
1256
- SkyModalService.host = __classPrivateFieldGet(this, _SkyModalService_dynamicComponentService, "f").createComponent(SkyModalHostComponent, {
1257
- providers: [
1258
- {
1259
- provide: SkyModalHostContext,
1260
- useValue: new SkyModalHostContext({
1261
- teardownCallback: () => {
1262
- this.dispose();
1263
- },
1264
- }),
1265
- },
1266
- ],
1267
- });
1268
- }
1269
- };
1270
- SkyModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalService, deps: [{ token: i3.SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable });
1271
- SkyModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalService, providedIn: 'any' });
1272
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalService, decorators: [{
1273
- type: Injectable,
1274
- args: [{
1275
- // Must be 'any' so that the modal component is created in the context of its module's injector.
1276
- // If set to 'root', the component's dependency injections would only be derived from the root
1277
- // injector and may lose context if the modal was opened from within a lazy-loaded module.
1278
- providedIn: 'any',
1279
- }]
1280
- }], ctorParameters: function () { return [{ type: i3.SkyDynamicComponentService }]; } });
1281
-
1282
- var _SkyConfirmService_modalService;
1283
- /**
1284
- * Launches a dialog.
1285
- */
1286
- class SkyConfirmService {
1287
- constructor(modalService) {
1288
- _SkyConfirmService_modalService.set(this, void 0);
1289
- __classPrivateFieldSet(this, _SkyConfirmService_modalService, modalService, "f");
1290
- }
1291
- /**
1292
- * Opens a dialog using the specified options.
1293
- * @param config Specifies configuration options for the dialog.
1294
- */
1295
- open(config) {
1296
- const modalInstance = __classPrivateFieldGet(this, _SkyConfirmService_modalService, "f").open(SkyConfirmComponent, {
1297
- providers: [
1298
- {
1299
- provide: SKY_CONFIRM_CONFIG,
1300
- useValue: config,
1301
- },
1302
- ],
1303
- });
1304
- const confirmInstance = new SkyConfirmInstance();
1305
- modalInstance.closed.subscribe((args) => {
1306
- let result = args.data;
1307
- // The modal was closed using the ESC key.
1308
- if (result === undefined) {
1309
- result = {
1310
- action: 'cancel',
1311
- };
1312
- }
1313
- confirmInstance.closed.emit(result);
1314
- confirmInstance.closed.complete();
1315
- });
1316
- return confirmInstance;
1317
- }
1318
- }
1319
- _SkyConfirmService_modalService = new WeakMap();
1320
- SkyConfirmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmService, deps: [{ token: SkyModalService }], target: i0.ɵɵFactoryTarget.Injectable });
1321
- SkyConfirmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmService, providedIn: 'any' });
1322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmService, decorators: [{
1323
- type: Injectable,
1324
- args: [{
1325
- // Must be 'any' so that the modal component is created in the context of its module's injector.
1326
- // If set to 'root', the component's dependency injections would only be derived from the root
1327
- // injector and may loose context if the modal was opened from within a lazy-loaded module.
1328
- providedIn: 'any',
1329
- }]
1330
- }], ctorParameters: function () { return [{ type: SkyModalService }]; } });
1331
-
1332
- var _SkyModalIsDirtyDirective_instances, _SkyModalIsDirtyDirective_ngUnsubscribe, _SkyModalIsDirtyDirective_modalInstance, _SkyModalIsDirtyDirective_confirmSvc, _SkyModalIsDirtyDirective_resourcesSvc, _SkyModalIsDirtyDirective_promptIfDirty;
1333
- /**
1334
- * Provides a way to mark a modal as "dirty" and displays a confirmation
1335
- * message when a user closes the modal without saving.
1336
- */
1337
- class SkyModalIsDirtyDirective {
1338
- constructor() {
1339
- _SkyModalIsDirtyDirective_instances.add(this);
1340
- /**
1341
- * Whether the user edited an input on the modal.
1342
- * @required
1343
- */
1344
- this.isDirty = false;
1345
- _SkyModalIsDirtyDirective_ngUnsubscribe.set(this, new Subject());
1346
- _SkyModalIsDirtyDirective_modalInstance.set(this, inject(SkyModalInstance));
1347
- _SkyModalIsDirtyDirective_confirmSvc.set(this, inject(SkyConfirmService));
1348
- _SkyModalIsDirtyDirective_resourcesSvc.set(this, inject(SkyLibResourcesService));
1349
- }
1350
- ngOnInit() {
1351
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_modalInstance, "f").beforeClose
1352
- .pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f")))
1353
- .subscribe((handler) => __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_instances, "m", _SkyModalIsDirtyDirective_promptIfDirty).call(this, handler));
1354
- }
1355
- ngOnDestroy() {
1356
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f").next();
1357
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f").complete();
1358
- }
1359
- }
1360
- _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) {
1361
- if (this.isDirty && handler.closeArgs.reason === 'close') {
1362
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_resourcesSvc, "f")
1363
- .getStrings({
1364
- message: 'skyux_modal_dirty_default_message',
1365
- discardActionText: 'skyux_modal_dirty_default_discard_changes_text',
1366
- keepActionText: 'skyux_modal_dirty_default_keep_working_text',
1367
- })
1368
- .subscribe((textValues) => {
1369
- const discardAction = 'discard';
1370
- const keepAction = 'keep';
1371
- __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_confirmSvc, "f")
1372
- .open({
1373
- message: textValues.message,
1374
- buttons: [
1375
- {
1376
- action: discardAction,
1377
- text: textValues.discardActionText,
1378
- styleType: 'primary',
1379
- },
1380
- {
1381
- action: keepAction,
1382
- text: textValues.keepActionText,
1383
- styleType: 'link',
1384
- },
1385
- ],
1386
- type: SkyConfirmType.Custom,
1387
- })
1388
- .closed.subscribe((args) => {
1389
- if (args.action === discardAction) {
1390
- handler.closeModal();
1391
- }
1392
- });
1393
- });
1394
- }
1395
- else {
1396
- handler.closeModal();
1397
- }
1398
- };
1399
- SkyModalIsDirtyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalIsDirtyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1400
- 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 });
1401
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalIsDirtyDirective, decorators: [{
1402
- type: Directive,
1403
- args: [{
1404
- // Since this is limited to sky-modal, it should be safe to
1405
- // leave off the sky prefix.
1406
- // eslint-disable-next-line @angular-eslint/directive-selector
1407
- selector: 'sky-modal[isDirty]',
1408
- }]
1409
- }], propDecorators: { isDirty: [{
1410
- type: Input
1411
- }, {
1412
- type: HostBinding,
1413
- args: ['attr.data-sky-modal-is-dirty']
1414
- }] } });
1415
-
1416
- class SkyModalModule {
1417
- }
1418
- SkyModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1419
- SkyModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, declarations: [SkyModalComponent,
1420
- SkyModalContentComponent,
1421
- SkyModalFooterComponent,
1422
- SkyModalHeaderComponent,
1423
- SkyModalHostComponent,
1424
- SkyModalIsDirtyDirective,
1425
- SkyModalScrollShadowDirective], imports: [CommonModule,
1426
- RouterModule,
1427
- SkyIconModule,
1428
- SkyIdModule,
1429
- SkyModalsResourcesModule,
1430
- SkyStatusIndicatorModule,
1431
- SkyThemeModule,
1432
- SkyTrimModule], exports: [SkyModalComponent,
1433
- SkyModalContentComponent,
1434
- SkyModalFooterComponent,
1435
- SkyModalHeaderComponent,
1436
- SkyModalIsDirtyDirective] });
1437
- SkyModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, imports: [CommonModule,
1438
- RouterModule,
1439
- SkyIconModule,
1440
- SkyIdModule,
1441
- SkyModalsResourcesModule,
1442
- SkyStatusIndicatorModule,
1443
- SkyThemeModule,
1444
- SkyTrimModule] });
1445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, decorators: [{
1446
- type: NgModule,
1447
- args: [{
1448
- declarations: [
1449
- SkyModalComponent,
1450
- SkyModalContentComponent,
1451
- SkyModalFooterComponent,
1452
- SkyModalHeaderComponent,
1453
- SkyModalHostComponent,
1454
- SkyModalIsDirtyDirective,
1455
- SkyModalScrollShadowDirective,
1456
- ],
1457
- imports: [
1458
- CommonModule,
1459
- RouterModule,
1460
- SkyIconModule,
1461
- SkyIdModule,
1462
- SkyModalsResourcesModule,
1463
- SkyStatusIndicatorModule,
1464
- SkyThemeModule,
1465
- SkyTrimModule,
1466
- ],
1467
- exports: [
1468
- SkyModalComponent,
1469
- SkyModalContentComponent,
1470
- SkyModalFooterComponent,
1471
- SkyModalHeaderComponent,
1472
- SkyModalIsDirtyDirective,
1473
- ],
1474
- }]
1475
- }] });
1476
-
1477
- class SkyConfirmModule {
1478
- }
1479
- SkyConfirmModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1480
- SkyConfirmModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, declarations: [SkyConfirmComponent], imports: [CommonModule,
1481
- SkyIdModule,
1482
- SkyModalModule,
1483
- SkyModalsResourcesModule,
1484
- SkyThemeModule], exports: [SkyConfirmComponent] });
1485
- SkyConfirmModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, imports: [CommonModule,
1486
- SkyIdModule,
1487
- SkyModalModule,
1488
- SkyModalsResourcesModule,
1489
- SkyThemeModule] });
1490
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, decorators: [{
1491
- type: NgModule,
1492
- args: [{
1493
- declarations: [SkyConfirmComponent],
1494
- imports: [
1495
- CommonModule,
1496
- SkyIdModule,
1497
- SkyModalModule,
1498
- SkyModalsResourcesModule,
1499
- SkyThemeModule,
1500
- ],
1501
- exports: [SkyConfirmComponent],
1502
- }]
1503
- }] });
1504
-
1505
- /**
1506
- * Generated bundle index. Do not edit.
1507
- */
1508
-
1509
- 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 };
1510
- //# sourceMappingURL=skyux-modals.mjs.map