@skyux/modals 6.12.0 → 6.15.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.
- package/documentation.json +340 -529
- package/esm2020/lib/modules/confirm/confirm-config-token.mjs +6 -0
- package/esm2020/lib/modules/confirm/confirm.component.mjs +103 -97
- package/esm2020/lib/modules/confirm/confirm.service.mjs +9 -5
- package/esm2020/lib/modules/modal/modal-adapter.service.mjs +20 -15
- package/esm2020/lib/modules/modal/modal-close-args.mjs +1 -1
- package/esm2020/lib/modules/modal/modal-component-adapter.service.mjs +17 -13
- package/esm2020/lib/modules/modal/modal-host-context-args.mjs +2 -0
- package/esm2020/lib/modules/modal/modal-host-context.mjs +9 -6
- package/esm2020/lib/modules/modal/modal-host.component.mjs +41 -14
- package/esm2020/lib/modules/modal/modal-host.service.mjs +21 -15
- package/esm2020/lib/modules/modal/modal-instance.mjs +31 -29
- package/esm2020/lib/modules/modal/modal-scroll-shadow.directive.mjs +71 -65
- package/esm2020/lib/modules/modal/modal.component.mjs +59 -74
- package/esm2020/lib/modules/modal/modal.service.mjs +50 -42
- package/esm2020/testing/modal-fixture.mjs +60 -84
- package/fesm2015/skyux-modals-testing.mjs +60 -83
- package/fesm2015/skyux-modals-testing.mjs.map +1 -1
- package/fesm2015/skyux-modals.mjs +412 -368
- package/fesm2015/skyux-modals.mjs.map +1 -1
- package/fesm2020/skyux-modals-testing.mjs +60 -83
- package/fesm2020/skyux-modals-testing.mjs.map +1 -1
- package/fesm2020/skyux-modals.mjs +409 -368
- package/fesm2020/skyux-modals.mjs.map +1 -1
- package/lib/modules/confirm/confirm-config-token.d.ts +6 -0
- package/lib/modules/confirm/confirm.component.d.ts +6 -12
- package/lib/modules/confirm/confirm.service.d.ts +1 -1
- package/lib/modules/modal/modal-adapter.service.d.ts +1 -5
- package/lib/modules/modal/modal-close-args.d.ts +1 -1
- package/lib/modules/modal/modal-component-adapter.service.d.ts +1 -2
- package/lib/modules/modal/modal-host-context-args.d.ts +7 -0
- package/lib/modules/modal/modal-host-context.d.ts +3 -2
- package/lib/modules/modal/modal-host.component.d.ts +1 -6
- package/lib/modules/modal/modal-host.service.d.ts +2 -2
- package/lib/modules/modal/modal-instance.d.ts +1 -5
- package/lib/modules/modal/modal-scroll-shadow.directive.d.ts +1 -13
- package/lib/modules/modal/modal.component.d.ts +12 -23
- package/lib/modules/modal/modal.service.d.ts +1 -3
- package/package.json +5 -6
- package/testing/modal-fixture.d.ts +6 -8
- package/esm2020/lib/modules/confirm/confirm-modal-context.mjs +0 -6
- package/esm2020/lib/modules/modal/modal-state-animation.mjs +0 -8
- package/lib/modules/confirm/confirm-modal-context.d.ts +0 -13
- package/lib/modules/modal/modal-state-animation.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, NgModule, Component, ViewEncapsulation, Injectable, Injector, ViewContainerRef, ViewChild, Directive, Optional, Output, HostListener, ElementRef, Host, HostBinding, Input } from '@angular/core';
|
|
2
|
+
import { EventEmitter, NgModule, Component, ViewEncapsulation, Injectable, Inject, Injector, ViewContainerRef, ViewChild, Directive, Optional, Output, HostListener, ElementRef, Host, HostBinding, Input, InjectionToken } from '@angular/core';
|
|
3
3
|
import * as i6 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@skyux/theme';
|
|
@@ -8,14 +8,13 @@ import * as i2$1 from '@angular/router';
|
|
|
8
8
|
import { NavigationStart, RouterModule } from '@angular/router';
|
|
9
9
|
import * as i5 from '@skyux/indicators';
|
|
10
10
|
import { SkyIconModule } from '@skyux/indicators';
|
|
11
|
-
import * as
|
|
11
|
+
import * as i2$2 from '@skyux/i18n';
|
|
12
12
|
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
13
13
|
import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
|
|
14
14
|
import * as i3 from '@skyux/core';
|
|
15
15
|
import { SkyMediaQueryService, SkyResizeObserverMediaQueryService, SkyDockLocation, SkyDockService } from '@skyux/core';
|
|
16
16
|
import { takeWhile, takeUntil } from 'rxjs/operators';
|
|
17
17
|
import { Subject, BehaviorSubject, zip } from 'rxjs';
|
|
18
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
19
18
|
|
|
20
19
|
class SkyConfirmInstance {
|
|
21
20
|
constructor() {
|
|
@@ -139,41 +138,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
139
138
|
args: [{ selector: 'sky-modal-header', template: "<h1\n class=\"sky-emphasized\"\n [skyThemeClass]=\"{\n 'sky-font-display-3': 'modern'\n }\"\n>\n <ng-content></ng-content>\n</h1>\n", styles: ["h1{margin:0;line-height:1.2}:host-context(.sky-theme-modern.sky-theme-mode-dark) h1{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark h1{color:#fbfcfe}\n"] }]
|
|
140
139
|
}] });
|
|
141
140
|
|
|
141
|
+
var _SkyModalAdapterService_instances, _SkyModalAdapterService_docRef, _SkyModalAdapterService_bodyEl, _SkyModalAdapterService_windowRef, _SkyModalAdapterService_addClassToBody, _SkyModalAdapterService_removeClassFromBody;
|
|
142
142
|
/**
|
|
143
143
|
* @internal
|
|
144
144
|
*/
|
|
145
145
|
class SkyModalAdapterService {
|
|
146
146
|
constructor(windowRef) {
|
|
147
|
-
this
|
|
148
|
-
this
|
|
149
|
-
this
|
|
147
|
+
_SkyModalAdapterService_instances.add(this);
|
|
148
|
+
_SkyModalAdapterService_docRef.set(this, void 0);
|
|
149
|
+
_SkyModalAdapterService_bodyEl.set(this, void 0);
|
|
150
|
+
_SkyModalAdapterService_windowRef.set(this, void 0);
|
|
151
|
+
__classPrivateFieldSet(this, _SkyModalAdapterService_windowRef, windowRef, "f");
|
|
152
|
+
__classPrivateFieldSet(this, _SkyModalAdapterService_docRef, __classPrivateFieldGet(this, _SkyModalAdapterService_windowRef, "f").nativeWindow.document, "f");
|
|
153
|
+
__classPrivateFieldSet(this, _SkyModalAdapterService_bodyEl, __classPrivateFieldGet(this, _SkyModalAdapterService_windowRef, "f").nativeWindow.document.body, "f");
|
|
150
154
|
}
|
|
151
155
|
toggleFullPageModalClass(isAddFull) {
|
|
152
156
|
if (isAddFull) {
|
|
153
|
-
this.
|
|
157
|
+
__classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_addClassToBody).call(this, SkyModalAdapterService.MODAL_BODY_FULL_CLASS);
|
|
154
158
|
}
|
|
155
159
|
else {
|
|
156
|
-
this.
|
|
160
|
+
__classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_removeClassFromBody).call(this, SkyModalAdapterService.MODAL_BODY_FULL_CLASS);
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
setPageScroll(isAdd) {
|
|
160
164
|
if (isAdd) {
|
|
161
|
-
this.
|
|
165
|
+
__classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_addClassToBody).call(this, SkyModalAdapterService.MODAL_BODY_CLASS);
|
|
162
166
|
}
|
|
163
167
|
else {
|
|
164
|
-
this.
|
|
168
|
+
__classPrivateFieldGet(this, _SkyModalAdapterService_instances, "m", _SkyModalAdapterService_removeClassFromBody).call(this, SkyModalAdapterService.MODAL_BODY_CLASS);
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
getModalOpener() {
|
|
168
|
-
return this.
|
|
169
|
-
}
|
|
170
|
-
addClassToBody(className) {
|
|
171
|
-
this.bodyEl.classList.add(className);
|
|
172
|
-
}
|
|
173
|
-
removeClassFromBody(className) {
|
|
174
|
-
this.bodyEl.classList.remove(className);
|
|
172
|
+
return __classPrivateFieldGet(this, _SkyModalAdapterService_docRef, "f").activeElement;
|
|
175
173
|
}
|
|
176
174
|
}
|
|
175
|
+
_SkyModalAdapterService_docRef = new WeakMap(), _SkyModalAdapterService_bodyEl = new WeakMap(), _SkyModalAdapterService_windowRef = new WeakMap(), _SkyModalAdapterService_instances = new WeakSet(), _SkyModalAdapterService_addClassToBody = function _SkyModalAdapterService_addClassToBody(className) {
|
|
176
|
+
__classPrivateFieldGet(this, _SkyModalAdapterService_bodyEl, "f").classList.add(className);
|
|
177
|
+
}, _SkyModalAdapterService_removeClassFromBody = function _SkyModalAdapterService_removeClassFromBody(className) {
|
|
178
|
+
__classPrivateFieldGet(this, _SkyModalAdapterService_bodyEl, "f").classList.remove(className);
|
|
179
|
+
};
|
|
177
180
|
SkyModalAdapterService.MODAL_BODY_FULL_CLASS = 'sky-modal-body-full-page';
|
|
178
181
|
SkyModalAdapterService.MODAL_BODY_CLASS = 'sky-modal-body-open';
|
|
179
182
|
SkyModalAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalAdapterService, deps: [{ token: i3.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -205,16 +208,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
205
208
|
* @internal
|
|
206
209
|
*/
|
|
207
210
|
class SkyModalHostContext {
|
|
208
|
-
constructor(
|
|
209
|
-
this.
|
|
211
|
+
constructor(args) {
|
|
212
|
+
this.args = args;
|
|
210
213
|
}
|
|
211
214
|
}
|
|
212
|
-
SkyModalHostContext.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostContext, deps:
|
|
215
|
+
SkyModalHostContext.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostContext, deps: [{ token: 'SkyModalHostContextArgs' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
213
216
|
SkyModalHostContext.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostContext });
|
|
214
217
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostContext, decorators: [{
|
|
215
218
|
type: Injectable
|
|
216
|
-
}], ctorParameters: function () { return [{ type: undefined
|
|
219
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
220
|
+
type: Inject,
|
|
221
|
+
args: ['SkyModalHostContextArgs']
|
|
222
|
+
}] }]; } });
|
|
217
223
|
|
|
224
|
+
const BASE_Z_INDEX = 1040;
|
|
225
|
+
const modalHosts = [];
|
|
218
226
|
/**
|
|
219
227
|
* @internal
|
|
220
228
|
* @dynamic
|
|
@@ -224,29 +232,24 @@ class SkyModalHostService {
|
|
|
224
232
|
this.close = new EventEmitter();
|
|
225
233
|
this.fullPage = false;
|
|
226
234
|
this.openHelp = new EventEmitter();
|
|
227
|
-
|
|
235
|
+
this.zIndex = this.calculateZIndex();
|
|
236
|
+
modalHosts.push(this);
|
|
228
237
|
}
|
|
229
238
|
static get openModalCount() {
|
|
230
|
-
return
|
|
239
|
+
return modalHosts.length;
|
|
231
240
|
}
|
|
232
241
|
static get fullPageModalCount() {
|
|
233
|
-
const fullPageModals =
|
|
242
|
+
const fullPageModals = modalHosts.filter((modal) => modal.fullPage);
|
|
234
243
|
return fullPageModals.length;
|
|
235
244
|
}
|
|
236
|
-
static get BASE_Z_INDEX() {
|
|
237
|
-
return 1040;
|
|
238
|
-
}
|
|
239
245
|
static get backdropZIndex() {
|
|
240
|
-
return
|
|
241
|
-
SkyModalHostService.modalHosts.length * 10);
|
|
246
|
+
return BASE_Z_INDEX + modalHosts.length * 10;
|
|
242
247
|
}
|
|
243
248
|
static get topModal() {
|
|
244
|
-
return
|
|
249
|
+
return modalHosts[modalHosts.length - 1];
|
|
245
250
|
}
|
|
246
251
|
getModalZIndex() {
|
|
247
|
-
|
|
248
|
-
zIndex += (SkyModalHostService.modalHosts.indexOf(this) + 1) * 10;
|
|
249
|
-
return zIndex;
|
|
252
|
+
return this.zIndex;
|
|
250
253
|
}
|
|
251
254
|
onClose() {
|
|
252
255
|
this.close.emit();
|
|
@@ -255,10 +258,19 @@ class SkyModalHostService {
|
|
|
255
258
|
this.openHelp.emit(helpKey);
|
|
256
259
|
}
|
|
257
260
|
destroy() {
|
|
258
|
-
|
|
261
|
+
modalHosts.splice(modalHosts.indexOf(this), 1);
|
|
262
|
+
}
|
|
263
|
+
calculateZIndex() {
|
|
264
|
+
const zIndexArray = modalHosts.map((hostService) => hostService.zIndex);
|
|
265
|
+
if (zIndexArray.length === 0) {
|
|
266
|
+
return BASE_Z_INDEX + 11;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
const currentMaxZIndex = Math.max(...zIndexArray);
|
|
270
|
+
return currentMaxZIndex + 10;
|
|
271
|
+
}
|
|
259
272
|
}
|
|
260
273
|
}
|
|
261
|
-
SkyModalHostService.modalHosts = [];
|
|
262
274
|
SkyModalHostService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
263
275
|
SkyModalHostService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostService, providedIn: 'root' });
|
|
264
276
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostService, decorators: [{
|
|
@@ -268,18 +280,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
268
280
|
}]
|
|
269
281
|
}], ctorParameters: function () { return []; } });
|
|
270
282
|
|
|
271
|
-
var _SkyModalHostComponent_modalHostContext;
|
|
283
|
+
var _SkyModalHostComponent_instances, _SkyModalHostComponent_resolver, _SkyModalHostComponent_adapter, _SkyModalHostComponent_injector, _SkyModalHostComponent_router, _SkyModalHostComponent_changeDetector, _SkyModalHostComponent_modalHostContext, _SkyModalHostComponent_modalInstances, _SkyModalHostComponent_registerModalInstance, _SkyModalHostComponent_unregisterModalInstance, _SkyModalHostComponent_closeAllModalInstances;
|
|
272
284
|
/**
|
|
273
285
|
* @internal
|
|
274
286
|
*/
|
|
275
287
|
class SkyModalHostComponent {
|
|
276
288
|
constructor(resolver, adapter, injector, router, changeDetector, modalHostContext) {
|
|
277
|
-
this
|
|
278
|
-
this
|
|
279
|
-
this
|
|
280
|
-
this
|
|
281
|
-
this
|
|
289
|
+
_SkyModalHostComponent_instances.add(this);
|
|
290
|
+
_SkyModalHostComponent_resolver.set(this, void 0);
|
|
291
|
+
_SkyModalHostComponent_adapter.set(this, void 0);
|
|
292
|
+
_SkyModalHostComponent_injector.set(this, void 0);
|
|
293
|
+
_SkyModalHostComponent_router.set(this, void 0);
|
|
294
|
+
_SkyModalHostComponent_changeDetector.set(this, void 0);
|
|
282
295
|
_SkyModalHostComponent_modalHostContext.set(this, void 0);
|
|
296
|
+
_SkyModalHostComponent_modalInstances.set(this, []);
|
|
297
|
+
__classPrivateFieldSet(this, _SkyModalHostComponent_resolver, resolver, "f");
|
|
298
|
+
__classPrivateFieldSet(this, _SkyModalHostComponent_adapter, adapter, "f");
|
|
299
|
+
__classPrivateFieldSet(this, _SkyModalHostComponent_injector, injector, "f");
|
|
300
|
+
__classPrivateFieldSet(this, _SkyModalHostComponent_router, router, "f");
|
|
301
|
+
__classPrivateFieldSet(this, _SkyModalHostComponent_changeDetector, changeDetector, "f");
|
|
283
302
|
__classPrivateFieldSet(this, _SkyModalHostComponent_modalHostContext, modalHostContext, "f");
|
|
284
303
|
}
|
|
285
304
|
get modalOpen() {
|
|
@@ -289,16 +308,25 @@ class SkyModalHostComponent {
|
|
|
289
308
|
return SkyModalHostService.backdropZIndex;
|
|
290
309
|
}
|
|
291
310
|
ngOnDestroy() {
|
|
292
|
-
|
|
311
|
+
// Close all modal instances before disposing of the host container.
|
|
312
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_closeAllModalInstances).call(this);
|
|
313
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_modalHostContext, "f").args.teardownCallback();
|
|
293
314
|
}
|
|
294
315
|
open(modalInstance, component, config) {
|
|
316
|
+
/* Ignore coverage as we specify the target element and so the view child should never be undefined unless
|
|
317
|
+
* we were to call the `open` method in an early lifecycle hook. */
|
|
318
|
+
/* istanbul ignore next */
|
|
319
|
+
if (!this.target) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
295
322
|
const params = Object.assign({}, config);
|
|
296
|
-
const factory = this.
|
|
323
|
+
const factory = __classPrivateFieldGet(this, _SkyModalHostComponent_resolver, "f").resolveComponentFactory(component);
|
|
297
324
|
const hostService = new SkyModalHostService();
|
|
298
325
|
hostService.fullPage = !!params.fullPage;
|
|
299
|
-
const adapter = this
|
|
326
|
+
const adapter = __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f");
|
|
300
327
|
const modalOpener = adapter.getModalOpener();
|
|
301
328
|
let isOpen = true;
|
|
329
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
302
330
|
params.providers.push({
|
|
303
331
|
provide: SkyModalHostService,
|
|
304
332
|
useValue: hostService,
|
|
@@ -311,15 +339,17 @@ class SkyModalHostComponent {
|
|
|
311
339
|
provide: SkyMediaQueryService,
|
|
312
340
|
useExisting: SkyResizeObserverMediaQueryService,
|
|
313
341
|
});
|
|
342
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
314
343
|
adapter.setPageScroll(SkyModalHostService.openModalCount > 0);
|
|
315
344
|
adapter.toggleFullPageModalClass(SkyModalHostService.fullPageModalCount > 0);
|
|
316
345
|
const providers = params.providers || /* istanbul ignore next */ [];
|
|
317
346
|
const injector = Injector.create({
|
|
318
347
|
providers,
|
|
319
|
-
parent: this
|
|
348
|
+
parent: __classPrivateFieldGet(this, _SkyModalHostComponent_injector, "f"),
|
|
320
349
|
});
|
|
321
350
|
const modalComponentRef = this.target.createComponent(factory, undefined, injector);
|
|
322
351
|
modalInstance.componentInstance = modalComponentRef.instance;
|
|
352
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_registerModalInstance).call(this, modalInstance);
|
|
323
353
|
function closeModal() {
|
|
324
354
|
hostService.destroy();
|
|
325
355
|
adapter.setPageScroll(SkyModalHostService.openModalCount > 0);
|
|
@@ -337,7 +367,7 @@ class SkyModalHostComponent {
|
|
|
337
367
|
hostService.close.subscribe(() => {
|
|
338
368
|
modalInstance.close();
|
|
339
369
|
});
|
|
340
|
-
this.
|
|
370
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_router, "f").events.pipe(takeWhile(() => isOpen)).subscribe((event) => {
|
|
341
371
|
/* istanbul ignore else */
|
|
342
372
|
if (event instanceof NavigationStart) {
|
|
343
373
|
modalInstance.close();
|
|
@@ -345,13 +375,22 @@ class SkyModalHostComponent {
|
|
|
345
375
|
});
|
|
346
376
|
modalInstance.closed.subscribe(() => {
|
|
347
377
|
isOpen = false;
|
|
378
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_unregisterModalInstance).call(this, modalInstance);
|
|
348
379
|
closeModal();
|
|
349
380
|
});
|
|
350
381
|
// Necessary if the host was created via a consumer's lifecycle hook such as ngOnInit
|
|
351
|
-
this.
|
|
382
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_changeDetector, "f").detectChanges();
|
|
352
383
|
}
|
|
353
384
|
}
|
|
354
|
-
_SkyModalHostComponent_modalHostContext = new WeakMap()
|
|
385
|
+
_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_modalInstances = new WeakMap(), _SkyModalHostComponent_instances = new WeakSet(), _SkyModalHostComponent_registerModalInstance = function _SkyModalHostComponent_registerModalInstance(instance) {
|
|
386
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").push(instance);
|
|
387
|
+
}, _SkyModalHostComponent_unregisterModalInstance = function _SkyModalHostComponent_unregisterModalInstance(instance) {
|
|
388
|
+
__classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").slice(__classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f").indexOf(instance), 1);
|
|
389
|
+
}, _SkyModalHostComponent_closeAllModalInstances = function _SkyModalHostComponent_closeAllModalInstances() {
|
|
390
|
+
for (const instance of __classPrivateFieldGet(this, _SkyModalHostComponent_modalInstances, "f")) {
|
|
391
|
+
instance.close();
|
|
392
|
+
}
|
|
393
|
+
};
|
|
355
394
|
SkyModalHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: SkyModalAdapterService }, { token: i0.Injector }, { token: i2$1.Router }, { token: i0.ChangeDetectorRef }, { token: SkyModalHostContext }], target: i0.ɵɵFactoryTarget.Component });
|
|
356
395
|
SkyModalHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", 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;top:0;left:0;bottom:0;right:0}\n"], directives: [{ type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], viewProviders: [SkyModalAdapterService] });
|
|
357
396
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalHostComponent, decorators: [{
|
|
@@ -365,6 +404,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
365
404
|
}]
|
|
366
405
|
}] } });
|
|
367
406
|
|
|
407
|
+
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;
|
|
368
408
|
/**
|
|
369
409
|
* Raises an event when the box shadow for the modal header or footer should be adjusted
|
|
370
410
|
* based on the scroll position of the host element.
|
|
@@ -372,94 +412,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
372
412
|
*/
|
|
373
413
|
class SkyModalScrollShadowDirective {
|
|
374
414
|
constructor(elRef, mutationObserverSvc, ngZone, themeSvc) {
|
|
375
|
-
this
|
|
376
|
-
this.mutationObserverSvc = mutationObserverSvc;
|
|
377
|
-
this.ngZone = ngZone;
|
|
378
|
-
this.themeSvc = themeSvc;
|
|
415
|
+
_SkyModalScrollShadowDirective_instances.add(this);
|
|
379
416
|
this.skyModalScrollShadow = new EventEmitter();
|
|
380
|
-
this
|
|
417
|
+
_SkyModalScrollShadowDirective_currentShadow.set(this, void 0);
|
|
418
|
+
_SkyModalScrollShadowDirective_currentTheme.set(this, void 0);
|
|
419
|
+
_SkyModalScrollShadowDirective_mutationObserver.set(this, void 0);
|
|
420
|
+
_SkyModalScrollShadowDirective_ngUnsubscribe.set(this, new Subject());
|
|
421
|
+
_SkyModalScrollShadowDirective_elRef.set(this, void 0);
|
|
422
|
+
_SkyModalScrollShadowDirective_mutationObserverSvc.set(this, void 0);
|
|
423
|
+
_SkyModalScrollShadowDirective_ngZone.set(this, void 0);
|
|
424
|
+
_SkyModalScrollShadowDirective_themeSvc.set(this, void 0);
|
|
425
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_elRef, elRef, "f");
|
|
426
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserverSvc, mutationObserverSvc, "f");
|
|
427
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_ngZone, ngZone, "f");
|
|
428
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_themeSvc, themeSvc, "f");
|
|
381
429
|
}
|
|
382
430
|
windowResize() {
|
|
383
|
-
this.
|
|
431
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
|
|
384
432
|
}
|
|
385
433
|
scroll() {
|
|
386
|
-
this.
|
|
434
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
|
|
387
435
|
}
|
|
388
436
|
ngOnInit() {
|
|
389
|
-
if (this
|
|
390
|
-
this.
|
|
391
|
-
.pipe(takeUntil(this
|
|
437
|
+
if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_themeSvc, "f")) {
|
|
438
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_themeSvc, "f").settingsChange
|
|
439
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f")))
|
|
392
440
|
.subscribe((themeSettings) => {
|
|
393
|
-
this
|
|
394
|
-
if (this
|
|
395
|
-
this.
|
|
441
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_currentTheme, themeSettings.currentSettings.theme, "f");
|
|
442
|
+
if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentTheme, "f") === SkyTheme.presets.modern) {
|
|
443
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_initMutationObserver).call(this);
|
|
396
444
|
}
|
|
397
445
|
else {
|
|
398
|
-
this.
|
|
446
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_emitShadow).call(this, {
|
|
399
447
|
bottomShadow: 'none',
|
|
400
448
|
topShadow: 'none',
|
|
401
449
|
});
|
|
402
|
-
this.
|
|
450
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_destroyMutationObserver).call(this);
|
|
403
451
|
}
|
|
404
452
|
});
|
|
405
453
|
}
|
|
406
454
|
}
|
|
407
455
|
ngOnDestroy() {
|
|
408
|
-
this.
|
|
409
|
-
this.
|
|
410
|
-
this.
|
|
411
|
-
}
|
|
412
|
-
initMutationObserver() {
|
|
413
|
-
if (!this.mutationObserver) {
|
|
414
|
-
const el = this.elRef.nativeElement;
|
|
415
|
-
// MutationObserver is patched by Zone.js and therefore becomes part of the
|
|
416
|
-
// Angular change detection cycle, but this can lead to infinite loops in some
|
|
417
|
-
// secnarios. This will keep MutationObserver from triggering change detection.
|
|
418
|
-
this.ngZone.runOutsideAngular(() => {
|
|
419
|
-
this.mutationObserver = this.mutationObserverSvc.create(() => {
|
|
420
|
-
this.checkForShadow();
|
|
421
|
-
});
|
|
422
|
-
this.mutationObserver.observe(el, {
|
|
423
|
-
attributes: true,
|
|
424
|
-
characterData: true,
|
|
425
|
-
childList: true,
|
|
426
|
-
subtree: true,
|
|
427
|
-
});
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
destroyMutationObserver() {
|
|
432
|
-
if (this.mutationObserver) {
|
|
433
|
-
this.mutationObserver.disconnect();
|
|
434
|
-
this.mutationObserver = undefined;
|
|
435
|
-
}
|
|
456
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f").next();
|
|
457
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngUnsubscribe, "f").complete();
|
|
458
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_destroyMutationObserver).call(this);
|
|
436
459
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
460
|
+
}
|
|
461
|
+
_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() {
|
|
462
|
+
if (!__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f")) {
|
|
463
|
+
const el = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_elRef, "f").nativeElement;
|
|
464
|
+
// MutationObserver is patched by Zone.js and therefore becomes part of the
|
|
465
|
+
// Angular change detection cycle, but this can lead to infinite loops in some
|
|
466
|
+
// secnarios. This will keep MutationObserver from triggering change detection.
|
|
467
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_ngZone, "f").runOutsideAngular(() => {
|
|
468
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserver, __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserverSvc, "f").create(() => {
|
|
469
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_checkForShadow).call(this);
|
|
470
|
+
}), "f");
|
|
471
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f").observe(el, {
|
|
472
|
+
attributes: true,
|
|
473
|
+
characterData: true,
|
|
474
|
+
childList: true,
|
|
475
|
+
subtree: true,
|
|
445
476
|
});
|
|
446
|
-
}
|
|
477
|
+
});
|
|
447
478
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
479
|
+
}, _SkyModalScrollShadowDirective_destroyMutationObserver = function _SkyModalScrollShadowDirective_destroyMutationObserver() {
|
|
480
|
+
if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f")) {
|
|
481
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_mutationObserver, "f").disconnect();
|
|
482
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_mutationObserver, undefined, "f");
|
|
483
|
+
}
|
|
484
|
+
}, _SkyModalScrollShadowDirective_checkForShadow = function _SkyModalScrollShadowDirective_checkForShadow() {
|
|
485
|
+
if (__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentTheme, "f") === SkyTheme.presets.modern) {
|
|
486
|
+
const el = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_elRef, "f").nativeElement;
|
|
487
|
+
const topShadow = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_buildShadowStyle).call(this, el.scrollTop);
|
|
488
|
+
const bottomShadow = __classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_buildShadowStyle).call(this, el.scrollHeight - el.scrollTop - el.clientHeight);
|
|
489
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_instances, "m", _SkyModalScrollShadowDirective_emitShadow).call(this, {
|
|
490
|
+
bottomShadow,
|
|
491
|
+
topShadow,
|
|
492
|
+
});
|
|
461
493
|
}
|
|
462
|
-
}
|
|
494
|
+
}, _SkyModalScrollShadowDirective_buildShadowStyle = function _SkyModalScrollShadowDirective_buildShadowStyle(pixelsFromEnd) {
|
|
495
|
+
// Progressively darken the shadow until the user scrolls 30 pixels from the top or bottom
|
|
496
|
+
// of the scrollable element, with a max opacity of 0.3.
|
|
497
|
+
const opacity = Math.min(pixelsFromEnd / 30, 1) * 0.3;
|
|
498
|
+
return opacity > 0 ? `0px 1px 8px 0px rgba(0, 0, 0, ${opacity})` : 'none';
|
|
499
|
+
}, _SkyModalScrollShadowDirective_emitShadow = function _SkyModalScrollShadowDirective_emitShadow(shadow) {
|
|
500
|
+
if (!__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f") ||
|
|
501
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f").bottomShadow !== shadow.bottomShadow ||
|
|
502
|
+
__classPrivateFieldGet(this, _SkyModalScrollShadowDirective_currentShadow, "f").topShadow !== shadow.topShadow) {
|
|
503
|
+
this.skyModalScrollShadow.emit(shadow);
|
|
504
|
+
__classPrivateFieldSet(this, _SkyModalScrollShadowDirective_currentShadow, shadow, "f");
|
|
505
|
+
}
|
|
506
|
+
};
|
|
463
507
|
SkyModalScrollShadowDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalScrollShadowDirective, deps: [{ token: i0.ElementRef }, { token: i3.MutationObserverService }, { token: i0.NgZone }, { token: i2.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
464
508
|
SkyModalScrollShadowDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyModalScrollShadowDirective, selector: "[skyModalScrollShadow]", outputs: { skyModalScrollShadow: "skyModalScrollShadow" }, host: { listeners: { "window:resize": "windowResize()", "scroll": "scroll()" } }, ngImport: i0 });
|
|
465
509
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalScrollShadowDirective, decorators: [{
|
|
@@ -479,12 +523,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
479
523
|
args: ['scroll']
|
|
480
524
|
}] } });
|
|
481
525
|
|
|
526
|
+
var _SkyModalComponentAdapterService_instances, _SkyModalComponentAdapterService_coreAdapter, _SkyModalComponentAdapterService_setFullPageHeight;
|
|
482
527
|
/**
|
|
483
528
|
* @internal
|
|
484
529
|
*/
|
|
485
530
|
class SkyModalComponentAdapterService {
|
|
486
531
|
constructor(coreAdapter) {
|
|
487
|
-
this
|
|
532
|
+
_SkyModalComponentAdapterService_instances.add(this);
|
|
533
|
+
_SkyModalComponentAdapterService_coreAdapter.set(this, void 0);
|
|
534
|
+
__classPrivateFieldSet(this, _SkyModalComponentAdapterService_coreAdapter, coreAdapter, "f");
|
|
488
535
|
}
|
|
489
536
|
handleWindowChange(modalEl) {
|
|
490
537
|
const boundedHeightEl = modalEl.nativeElement.querySelector('.sky-modal');
|
|
@@ -495,7 +542,7 @@ class SkyModalComponentAdapterService {
|
|
|
495
542
|
const newHeight = window.innerHeight - 40;
|
|
496
543
|
boundedHeightEl.style.maxHeight = newHeight.toString() + 'px';
|
|
497
544
|
if (fullPageModalEl) {
|
|
498
|
-
this.
|
|
545
|
+
__classPrivateFieldGet(this, _SkyModalComponentAdapterService_instances, "m", _SkyModalComponentAdapterService_setFullPageHeight).call(this, fullPageModalEl);
|
|
499
546
|
}
|
|
500
547
|
else {
|
|
501
548
|
/*
|
|
@@ -555,35 +602,30 @@ class SkyModalComponentAdapterService {
|
|
|
555
602
|
inputWithAutofocus.focus();
|
|
556
603
|
}
|
|
557
604
|
else {
|
|
558
|
-
this.
|
|
605
|
+
__classPrivateFieldGet(this, _SkyModalComponentAdapterService_coreAdapter, "f").getFocusableChildrenAndApplyFocus(modalEl, '.sky-modal-content', true);
|
|
559
606
|
}
|
|
560
607
|
window.scrollTo(currentScrollX, currentScrollY);
|
|
561
608
|
}
|
|
562
609
|
}
|
|
563
|
-
setFullPageHeight(fullPageModalEl) {
|
|
564
|
-
const windowHeight = window.innerHeight;
|
|
565
|
-
const fullPageModalStyle = getComputedStyle(fullPageModalEl);
|
|
566
|
-
const marginTopBottom = parseInt(fullPageModalStyle.marginTop, 10) +
|
|
567
|
-
parseInt(fullPageModalStyle.marginBottom, 10);
|
|
568
|
-
const fullPageModalHeight = windowHeight - marginTopBottom + 'px';
|
|
569
|
-
fullPageModalEl.style.height = fullPageModalHeight;
|
|
570
|
-
fullPageModalEl.style.maxHeight = fullPageModalHeight;
|
|
571
|
-
}
|
|
572
610
|
}
|
|
611
|
+
_SkyModalComponentAdapterService_coreAdapter = new WeakMap(), _SkyModalComponentAdapterService_instances = new WeakSet(), _SkyModalComponentAdapterService_setFullPageHeight = function _SkyModalComponentAdapterService_setFullPageHeight(fullPageModalEl) {
|
|
612
|
+
const windowHeight = window.innerHeight;
|
|
613
|
+
const fullPageModalStyle = getComputedStyle(fullPageModalEl);
|
|
614
|
+
const marginTopBottom = parseInt(fullPageModalStyle.marginTop, 10) +
|
|
615
|
+
parseInt(fullPageModalStyle.marginBottom, 10);
|
|
616
|
+
const fullPageModalHeight = windowHeight - marginTopBottom + 'px';
|
|
617
|
+
fullPageModalEl.style.height = fullPageModalHeight;
|
|
618
|
+
fullPageModalEl.style.maxHeight = fullPageModalHeight;
|
|
619
|
+
};
|
|
573
620
|
SkyModalComponentAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalComponentAdapterService, deps: [{ token: i3.SkyCoreAdapterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
574
621
|
SkyModalComponentAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalComponentAdapterService });
|
|
575
622
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalComponentAdapterService, decorators: [{
|
|
576
623
|
type: Injectable
|
|
577
624
|
}], ctorParameters: function () { return [{ type: i3.SkyCoreAdapterService }]; } });
|
|
578
625
|
|
|
579
|
-
|
|
580
|
-
state('in', style({ opacity: '1.0' })),
|
|
581
|
-
state('out', style({ opacity: '0.0' })),
|
|
582
|
-
transition('void => *', [style({ opacity: '0.0' }), animate(150)]),
|
|
583
|
-
transition('* => void', [animate(150, style({ opacity: '0.0' }))]),
|
|
584
|
-
]);
|
|
585
|
-
|
|
626
|
+
var _SkyModalComponent_hostService, _SkyModalComponent_elRef, _SkyModalComponent_windowRef, _SkyModalComponent_componentAdapter, _SkyModalComponent_coreAdapter, _SkyModalComponent_dockService, _SkyModalComponent_mediaQueryService, _SkyModalComponent__ariaRole;
|
|
586
627
|
let skyModalUniqueIdentifier = 0;
|
|
628
|
+
const ARIA_ROLE_DEFAULT = 'dialog';
|
|
587
629
|
/**
|
|
588
630
|
* Provides a common look-and-feel for modal content with options to display
|
|
589
631
|
* a common modal header, specify body content, and display a common modal footer
|
|
@@ -591,69 +633,54 @@ let skyModalUniqueIdentifier = 0;
|
|
|
591
633
|
*/
|
|
592
634
|
class SkyModalComponent {
|
|
593
635
|
constructor(hostService, config, elRef, windowRef, componentAdapter, coreAdapter, dockService, mediaQueryService) {
|
|
594
|
-
this.
|
|
595
|
-
this.config = config;
|
|
596
|
-
this.elRef = elRef;
|
|
597
|
-
this.windowRef = windowRef;
|
|
598
|
-
this.componentAdapter = componentAdapter;
|
|
599
|
-
this.coreAdapter = coreAdapter;
|
|
600
|
-
this.dockService = dockService;
|
|
601
|
-
this.mediaQueryService = mediaQueryService;
|
|
636
|
+
this.ariaRoleOrDefault = ARIA_ROLE_DEFAULT;
|
|
602
637
|
this.modalState = 'in';
|
|
603
638
|
this.modalContentId = 'sky-modal-content-id-' + skyModalUniqueIdentifier.toString();
|
|
604
639
|
this.modalHeaderId = 'sky-modal-header-id-' + skyModalUniqueIdentifier.toString();
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
640
|
+
_SkyModalComponent_hostService.set(this, void 0);
|
|
641
|
+
_SkyModalComponent_elRef.set(this, void 0);
|
|
642
|
+
_SkyModalComponent_windowRef.set(this, void 0);
|
|
643
|
+
_SkyModalComponent_componentAdapter.set(this, void 0);
|
|
644
|
+
_SkyModalComponent_coreAdapter.set(this, void 0);
|
|
645
|
+
_SkyModalComponent_dockService.set(this, void 0);
|
|
646
|
+
_SkyModalComponent_mediaQueryService.set(this, void 0);
|
|
647
|
+
_SkyModalComponent__ariaRole.set(this, void 0);
|
|
648
|
+
__classPrivateFieldSet(this, _SkyModalComponent_hostService, hostService, "f");
|
|
649
|
+
__classPrivateFieldSet(this, _SkyModalComponent_elRef, elRef, "f");
|
|
650
|
+
__classPrivateFieldSet(this, _SkyModalComponent_windowRef, windowRef, "f");
|
|
651
|
+
__classPrivateFieldSet(this, _SkyModalComponent_componentAdapter, componentAdapter, "f");
|
|
652
|
+
__classPrivateFieldSet(this, _SkyModalComponent_coreAdapter, coreAdapter, "f");
|
|
653
|
+
__classPrivateFieldSet(this, _SkyModalComponent_dockService, dockService, "f");
|
|
654
|
+
__classPrivateFieldSet(this, _SkyModalComponent_mediaQueryService, mediaQueryService, "f");
|
|
655
|
+
this.ariaDescribedBy = config.ariaDescribedBy || this.modalContentId;
|
|
656
|
+
this.ariaLabelledBy = config.ariaLabelledBy || this.modalHeaderId;
|
|
657
|
+
this.ariaRole = config.ariaRole;
|
|
658
|
+
this.helpKey = config.helpKey;
|
|
659
|
+
this.tiledBody = config.tiledBody;
|
|
660
|
+
this.wrapperClass = config.wrapperClass;
|
|
661
|
+
this.size = config.fullPage
|
|
662
|
+
? 'full-page'
|
|
663
|
+
: config.size?.toLowerCase() || 'medium';
|
|
664
|
+
this.modalZIndex = __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").zIndex;
|
|
665
|
+
}
|
|
666
|
+
// Ignoring coverage as we only use the setter internally and do not export the class externally for users to be able to use the getter.
|
|
667
|
+
// istanbul ignore next
|
|
609
668
|
/**
|
|
610
669
|
* @internal
|
|
611
670
|
*/
|
|
612
671
|
get ariaRole() {
|
|
613
|
-
return this
|
|
672
|
+
return __classPrivateFieldGet(this, _SkyModalComponent__ariaRole, "f");
|
|
614
673
|
}
|
|
615
674
|
set ariaRole(value) {
|
|
616
|
-
this
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* @internal
|
|
620
|
-
*/
|
|
621
|
-
set tiledBody(value) {
|
|
622
|
-
this.config.tiledBody = value;
|
|
623
|
-
}
|
|
624
|
-
get modalZIndex() {
|
|
625
|
-
return this.hostService.getModalZIndex();
|
|
626
|
-
}
|
|
627
|
-
get modalFullPage() {
|
|
628
|
-
return this.config.fullPage;
|
|
629
|
-
}
|
|
630
|
-
get isSmallSize() {
|
|
631
|
-
return !this.modalFullPage && this.isSizeEqual(this.config.size, 'small');
|
|
632
|
-
}
|
|
633
|
-
get isMediumSize() {
|
|
634
|
-
return !this.modalFullPage && !(this.isSmallSize || this.isLargeSize);
|
|
635
|
-
}
|
|
636
|
-
get isLargeSize() {
|
|
637
|
-
return !this.modalFullPage && this.isSizeEqual(this.config.size, 'large');
|
|
638
|
-
}
|
|
639
|
-
get isTiledBody() {
|
|
640
|
-
return this.config.tiledBody;
|
|
641
|
-
}
|
|
642
|
-
get ariaDescribedBy() {
|
|
643
|
-
return this.config.ariaDescribedBy || this.modalContentId;
|
|
644
|
-
}
|
|
645
|
-
get ariaLabelledBy() {
|
|
646
|
-
return this.config.ariaLabelledBy || this.modalHeaderId;
|
|
647
|
-
}
|
|
648
|
-
get helpKey() {
|
|
649
|
-
return this.config.helpKey;
|
|
675
|
+
__classPrivateFieldSet(this, _SkyModalComponent__ariaRole, value, "f");
|
|
676
|
+
this.ariaRoleOrDefault = value || ARIA_ROLE_DEFAULT;
|
|
650
677
|
}
|
|
651
678
|
onDocumentKeyUp(event) {
|
|
652
679
|
/* istanbul ignore else */
|
|
653
680
|
/* sanity check */
|
|
654
681
|
if (SkyModalHostService.openModalCount > 0) {
|
|
655
682
|
const topModal = SkyModalHostService.topModal;
|
|
656
|
-
if (topModal && topModal === this
|
|
683
|
+
if (topModal && topModal === __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f")) {
|
|
657
684
|
if (event.which === 27) {
|
|
658
685
|
// Escape key up
|
|
659
686
|
event.preventDefault();
|
|
@@ -667,21 +694,21 @@ class SkyModalComponent {
|
|
|
667
694
|
/* sanity check */
|
|
668
695
|
if (SkyModalHostService.openModalCount > 0) {
|
|
669
696
|
const topModal = SkyModalHostService.topModal;
|
|
670
|
-
if (topModal && topModal === this
|
|
697
|
+
if (topModal && topModal === __classPrivateFieldGet(this, _SkyModalComponent_hostService, "f")) {
|
|
671
698
|
if (event.which === 9) {
|
|
672
699
|
// Tab pressed
|
|
673
700
|
let focusChanged = false;
|
|
674
|
-
const focusElementList = this.
|
|
701
|
+
const focusElementList = __classPrivateFieldGet(this, _SkyModalComponent_coreAdapter, "f").getFocusableChildren(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f").nativeElement);
|
|
675
702
|
if (event.shiftKey &&
|
|
676
|
-
(this.
|
|
677
|
-
this.
|
|
703
|
+
(__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isFocusInFirstItem(event, focusElementList) ||
|
|
704
|
+
__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isModalFocused(event, __classPrivateFieldGet(this, _SkyModalComponent_elRef, "f")))) {
|
|
678
705
|
focusChanged =
|
|
679
|
-
this.
|
|
706
|
+
__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").focusLastElement(focusElementList);
|
|
680
707
|
}
|
|
681
708
|
else if (!event.shiftKey &&
|
|
682
|
-
this.
|
|
709
|
+
__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").isFocusInLastItem(event, focusElementList)) {
|
|
683
710
|
focusChanged =
|
|
684
|
-
this.
|
|
711
|
+
__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").focusFirstElement(focusElementList);
|
|
685
712
|
}
|
|
686
713
|
if (focusChanged) {
|
|
687
714
|
event.preventDefault();
|
|
@@ -693,52 +720,50 @@ class SkyModalComponent {
|
|
|
693
720
|
}
|
|
694
721
|
ngAfterViewInit() {
|
|
695
722
|
skyModalUniqueIdentifier++;
|
|
696
|
-
this.
|
|
723
|
+
__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").handleWindowChange(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
|
|
697
724
|
// Adding a timeout to avoid ExpressionChangedAfterItHasBeenCheckedError.
|
|
698
725
|
// https://stackoverflow.com/questions/40562845
|
|
699
|
-
this.
|
|
700
|
-
this.
|
|
726
|
+
__classPrivateFieldGet(this, _SkyModalComponent_windowRef, "f").nativeWindow.setTimeout(() => {
|
|
727
|
+
__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").modalOpened(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
|
|
701
728
|
});
|
|
702
|
-
this.
|
|
729
|
+
__classPrivateFieldGet(this, _SkyModalComponent_dockService, "f").setDockOptions({
|
|
703
730
|
location: SkyDockLocation.ElementBottom,
|
|
704
731
|
referenceEl: this.modalContentWrapperElement.nativeElement,
|
|
705
732
|
zIndex: 5,
|
|
706
733
|
});
|
|
707
734
|
/* istanbul ignore next */
|
|
708
|
-
if (this
|
|
709
|
-
this.
|
|
735
|
+
if (__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f")) {
|
|
736
|
+
__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f").observe(this.modalContentWrapperElement);
|
|
710
737
|
}
|
|
711
738
|
}
|
|
712
739
|
ngOnDestroy() {
|
|
713
740
|
/* istanbul ignore next */
|
|
714
|
-
if (this
|
|
715
|
-
this.
|
|
741
|
+
if (__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f")) {
|
|
742
|
+
__classPrivateFieldGet(this, _SkyModalComponent_mediaQueryService, "f").unobserve();
|
|
716
743
|
}
|
|
717
744
|
}
|
|
718
745
|
helpButtonClick() {
|
|
719
|
-
this.
|
|
746
|
+
__classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").onOpenHelp(this.helpKey);
|
|
720
747
|
}
|
|
721
748
|
closeButtonClick() {
|
|
722
|
-
this.
|
|
749
|
+
__classPrivateFieldGet(this, _SkyModalComponent_hostService, "f").onClose();
|
|
723
750
|
}
|
|
724
751
|
windowResize() {
|
|
725
|
-
this.
|
|
752
|
+
__classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").handleWindowChange(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
|
|
726
753
|
}
|
|
727
754
|
scrollShadowChange(args) {
|
|
728
755
|
this.scrollShadow = args;
|
|
729
756
|
}
|
|
730
757
|
viewkeeperEnabled() {
|
|
731
|
-
return this.
|
|
732
|
-
}
|
|
733
|
-
isSizeEqual(actualSize, size) {
|
|
734
|
-
return actualSize && actualSize.toLowerCase() === size;
|
|
758
|
+
return __classPrivateFieldGet(this, _SkyModalComponent_componentAdapter, "f").modalContentHasDirectChildViewkeeper(__classPrivateFieldGet(this, _SkyModalComponent_elRef, "f"));
|
|
735
759
|
}
|
|
736
760
|
}
|
|
761
|
+
_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__ariaRole = new WeakMap();
|
|
737
762
|
SkyModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", 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 });
|
|
738
|
-
SkyModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: SkyModalComponent, selector: "sky-modal", inputs: { ariaRole: "ariaRole", tiledBody: "tiledBody" }, host: { listeners: { "document:keyup": "onDocumentKeyUp($event)", "document:keydown": "onDocumentKeyDown($event)" }, properties: { "class": "this.wrapperClass" } }, providers: [SkyModalComponentAdapterService, SkyDockService], viewQueries: [{ propertyName: "modalContentWrapperElement", first: true, predicate: ["modalContentWrapper"], descendants: true, read: ElementRef }], ngImport: i0, template: "
|
|
763
|
+
SkyModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: SkyModalComponent, selector: "sky-modal", inputs: { ariaRole: "ariaRole", tiledBody: "tiledBody" }, host: { listeners: { "document:keyup": "onDocumentKeyUp($event)", "document:keydown": "onDocumentKeyDown($event)" }, properties: { "class": "this.wrapperClass" } }, providers: [SkyModalComponentAdapterService, SkyDockService], 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\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\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 < 1\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.topShadow\n }\"\n >\n <div\n class=\"sky-modal-header-content\"\n [attr.id]=\"modalHeaderId\"\n [ngClass]=\"{\n 'sky-section-heading': size === 'full-page'\n }\"\n #headerContent\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 [attr.aria-labelledby]=\"modalHeaderId\"\n [attr.id]=\"modalContentId\"\n (skyModalScrollShadow)=\"scrollShadowChange($event)\"\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-modal-content:focus{outline-style:dotted;outline-width:thin;outline-offset:-1px}.sky-modal-tiled .sky-modal-content{background-color:#eeeeef}.sky-modal-tiled .sky-modal-content ::ng-deep .sky-tile-title{font-family:BLKB Sans,Helvetica Neue,Arial,sans-serif;color:#686c73;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-footer ::ng-deep sky-tabset-nav-button+sky-tabset-nav-button{margin-left:10px}.sky-modal-footer ::ng-deep sky-tabset-nav-button+.sky-btn{margin-left:10px}.sky-modal-footer ::ng-deep .sky-btn+.sky-btn{margin-left:10px}.sky-modal-footer ::ng-deep .sky-btn+.sky-btn-link{margin-left:-2px}.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;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;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-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}\n"], components: [{ type: i5.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: SkyModalScrollShadowDirective, selector: "[skyModalScrollShadow]", outputs: ["skyModalScrollShadow"] }], pipes: { "skyLibResources": i2$2.SkyLibResourcesPipe } });
|
|
739
764
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalComponent, decorators: [{
|
|
740
765
|
type: Component,
|
|
741
|
-
args: [{ selector: 'sky-modal',
|
|
766
|
+
args: [{ selector: 'sky-modal', providers: [SkyModalComponentAdapterService, SkyDockService], template: "<div\n class=\"sky-modal-dialog\"\n aria-modal=\"true\"\n [attr.aria-describedby]=\"ariaDescribedBy\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\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 < 1\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.topShadow\n }\"\n >\n <div\n class=\"sky-modal-header-content\"\n [attr.id]=\"modalHeaderId\"\n [ngClass]=\"{\n 'sky-section-heading': size === 'full-page'\n }\"\n #headerContent\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 [attr.aria-labelledby]=\"modalHeaderId\"\n [attr.id]=\"modalContentId\"\n (skyModalScrollShadow)=\"scrollShadowChange($event)\"\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-modal-content:focus{outline-style:dotted;outline-width:thin;outline-offset:-1px}.sky-modal-tiled .sky-modal-content{background-color:#eeeeef}.sky-modal-tiled .sky-modal-content ::ng-deep .sky-tile-title{font-family:BLKB Sans,Helvetica Neue,Arial,sans-serif;color:#686c73;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-footer ::ng-deep sky-tabset-nav-button+sky-tabset-nav-button{margin-left:10px}.sky-modal-footer ::ng-deep sky-tabset-nav-button+.sky-btn{margin-left:10px}.sky-modal-footer ::ng-deep .sky-btn+.sky-btn{margin-left:10px}.sky-modal-footer ::ng-deep .sky-btn+.sky-btn-link{margin-left:-2px}.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;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;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-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}\n"] }]
|
|
742
767
|
}], ctorParameters: function () { return [{ type: SkyModalHostService }, { type: SkyModalConfiguration }, { type: i0.ElementRef }, { type: i3.SkyAppWindowRef }, { type: SkyModalComponentAdapterService }, { type: i3.SkyCoreAdapterService }, { type: i3.SkyDockService, decorators: [{
|
|
743
768
|
type: Host
|
|
744
769
|
}] }, { type: i3.SkyResizeObserverMediaQueryService, decorators: [{
|
|
@@ -828,11 +853,13 @@ class SkyModalBeforeCloseHandler {
|
|
|
828
853
|
class SkyModalCloseArgs {
|
|
829
854
|
}
|
|
830
855
|
|
|
856
|
+
var _SkyModalInstance_instances, _SkyModalInstance__beforeClose, _SkyModalInstance__closed, _SkyModalInstance__helpOpened, _SkyModalInstance_closeModal, _SkyModalInstance_notifyClosed;
|
|
831
857
|
class SkyModalInstance {
|
|
832
858
|
constructor() {
|
|
833
|
-
|
|
834
|
-
this
|
|
835
|
-
this
|
|
859
|
+
_SkyModalInstance_instances.add(this);
|
|
860
|
+
_SkyModalInstance__beforeClose.set(this, new Subject());
|
|
861
|
+
_SkyModalInstance__closed.set(this, new Subject());
|
|
862
|
+
_SkyModalInstance__helpOpened.set(this, new Subject());
|
|
836
863
|
}
|
|
837
864
|
/**
|
|
838
865
|
* An event that the modal instance emits when it is about to close.
|
|
@@ -841,7 +868,7 @@ class SkyModalInstance {
|
|
|
841
868
|
* the modal does not close until the subscriber calls the `closeModal` method.
|
|
842
869
|
*/
|
|
843
870
|
get beforeClose() {
|
|
844
|
-
return this
|
|
871
|
+
return __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f");
|
|
845
872
|
}
|
|
846
873
|
/**
|
|
847
874
|
* An event that the modal instance emits when it closes.
|
|
@@ -852,7 +879,7 @@ class SkyModalInstance {
|
|
|
852
879
|
* Common examples include `"cancel"`, `"close"`, and `"save"`.
|
|
853
880
|
*/
|
|
854
881
|
get closed() {
|
|
855
|
-
return this
|
|
882
|
+
return __classPrivateFieldGet(this, _SkyModalInstance__closed, "f");
|
|
856
883
|
}
|
|
857
884
|
/**
|
|
858
885
|
* An event that the modal instance emits when users click
|
|
@@ -860,7 +887,7 @@ class SkyModalInstance {
|
|
|
860
887
|
* If a `helpKey` parameter was specified, the `helpOpened` event broadcasts the `helpKey`.
|
|
861
888
|
*/
|
|
862
889
|
get helpOpened() {
|
|
863
|
-
return this
|
|
890
|
+
return __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f");
|
|
864
891
|
}
|
|
865
892
|
/**
|
|
866
893
|
* Closes the modal instance.
|
|
@@ -874,7 +901,7 @@ class SkyModalInstance {
|
|
|
874
901
|
if (reason === undefined) {
|
|
875
902
|
reason = 'close';
|
|
876
903
|
}
|
|
877
|
-
this.
|
|
904
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, reason, result, ignoreBeforeClose);
|
|
878
905
|
}
|
|
879
906
|
/**
|
|
880
907
|
* Closes the modal instance with `reason="cancel"`.
|
|
@@ -883,7 +910,7 @@ class SkyModalInstance {
|
|
|
883
910
|
* that this cancel function can be called from a button in the `sky-modal-footer`.
|
|
884
911
|
*/
|
|
885
912
|
cancel(result) {
|
|
886
|
-
this.
|
|
913
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'cancel', result);
|
|
887
914
|
}
|
|
888
915
|
/**
|
|
889
916
|
* Closes the modal instance with `reason="save"`.
|
|
@@ -892,7 +919,7 @@ class SkyModalInstance {
|
|
|
892
919
|
* that this `save` function can be called from a button in `the sky-modal-footer`.
|
|
893
920
|
*/
|
|
894
921
|
save(result) {
|
|
895
|
-
this.
|
|
922
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'save', result);
|
|
896
923
|
}
|
|
897
924
|
/**
|
|
898
925
|
* Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open
|
|
@@ -902,141 +929,145 @@ class SkyModalInstance {
|
|
|
902
929
|
* into a component's constructor to call the `openHelp` function in the modal template.
|
|
903
930
|
*/
|
|
904
931
|
openHelp(helpKey) {
|
|
905
|
-
this.
|
|
906
|
-
}
|
|
907
|
-
closeModal(type, result, ignoreBeforeClose = false) {
|
|
908
|
-
const args = new SkyModalCloseArgs();
|
|
909
|
-
args.reason = type;
|
|
910
|
-
args.data = result;
|
|
911
|
-
if (this._beforeClose.observers.length === 0 || ignoreBeforeClose) {
|
|
912
|
-
this.notifyClosed(args);
|
|
913
|
-
}
|
|
914
|
-
else {
|
|
915
|
-
this._beforeClose.next(new SkyModalBeforeCloseHandler(() => {
|
|
916
|
-
this.notifyClosed(args);
|
|
917
|
-
}, args));
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
notifyClosed(args) {
|
|
921
|
-
this._closed.next(args);
|
|
922
|
-
this._closed.complete();
|
|
923
|
-
this._beforeClose.complete();
|
|
924
|
-
this._helpOpened.complete();
|
|
932
|
+
__classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").next(helpKey);
|
|
925
933
|
}
|
|
926
934
|
}
|
|
935
|
+
_SkyModalInstance__beforeClose = new WeakMap(), _SkyModalInstance__closed = new WeakMap(), _SkyModalInstance__helpOpened = new WeakMap(), _SkyModalInstance_instances = new WeakSet(), _SkyModalInstance_closeModal = function _SkyModalInstance_closeModal(type, result, ignoreBeforeClose = false) {
|
|
936
|
+
const args = new SkyModalCloseArgs();
|
|
937
|
+
args.reason = type;
|
|
938
|
+
args.data = result;
|
|
939
|
+
if (__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").observers.length === 0 || ignoreBeforeClose) {
|
|
940
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").next(new SkyModalBeforeCloseHandler(() => {
|
|
944
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
|
|
945
|
+
}, args));
|
|
946
|
+
}
|
|
947
|
+
}, _SkyModalInstance_notifyClosed = function _SkyModalInstance_notifyClosed(args) {
|
|
948
|
+
__classPrivateFieldGet(this, _SkyModalInstance__closed, "f").next(args);
|
|
949
|
+
__classPrivateFieldGet(this, _SkyModalInstance__closed, "f").complete();
|
|
950
|
+
__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").complete();
|
|
951
|
+
__classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").complete();
|
|
952
|
+
};
|
|
927
953
|
|
|
928
954
|
/**
|
|
929
955
|
* @internal
|
|
930
956
|
*/
|
|
931
|
-
|
|
932
|
-
}
|
|
957
|
+
const SKY_CONFIRM_CONFIG = new InjectionToken('SkyConfirmConfig');
|
|
933
958
|
|
|
959
|
+
var _SkyConfirmComponent_instances, _SkyConfirmComponent_config, _SkyConfirmComponent_modal, _SkyConfirmComponent_resourcesService, _SkyConfirmComponent_getPresetButtons, _SkyConfirmComponent_getCustomButtons;
|
|
934
960
|
class SkyConfirmComponent {
|
|
935
961
|
constructor(config, modal, resourcesService) {
|
|
936
|
-
this
|
|
937
|
-
this.modal = modal;
|
|
938
|
-
this.resourcesService = resourcesService;
|
|
962
|
+
_SkyConfirmComponent_instances.add(this);
|
|
939
963
|
this.preserveWhiteSpace = false;
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
964
|
+
_SkyConfirmComponent_config.set(this, void 0);
|
|
965
|
+
_SkyConfirmComponent_modal.set(this, void 0);
|
|
966
|
+
_SkyConfirmComponent_resourcesService.set(this, void 0);
|
|
967
|
+
__classPrivateFieldSet(this, _SkyConfirmComponent_config, config, "f");
|
|
968
|
+
__classPrivateFieldSet(this, _SkyConfirmComponent_modal, modal, "f");
|
|
969
|
+
__classPrivateFieldSet(this, _SkyConfirmComponent_resourcesService, resourcesService, "f");
|
|
970
|
+
if (config.type === SkyConfirmType.Custom &&
|
|
971
|
+
config.buttons &&
|
|
972
|
+
config.buttons.length > 0) {
|
|
973
|
+
this.buttons = __classPrivateFieldGet(this, _SkyConfirmComponent_instances, "m", _SkyConfirmComponent_getCustomButtons).call(this, config.buttons);
|
|
945
974
|
}
|
|
946
975
|
else {
|
|
947
|
-
this.
|
|
976
|
+
__classPrivateFieldGet(this, _SkyConfirmComponent_instances, "m", _SkyConfirmComponent_getPresetButtons).call(this).subscribe((buttons) => {
|
|
948
977
|
this.buttons = buttons;
|
|
949
978
|
});
|
|
950
979
|
}
|
|
951
|
-
this.message =
|
|
952
|
-
this.body =
|
|
953
|
-
this.preserveWhiteSpace =
|
|
980
|
+
this.message = config.message;
|
|
981
|
+
this.body = config.body;
|
|
982
|
+
this.preserveWhiteSpace = !!config.preserveWhiteSpace;
|
|
954
983
|
}
|
|
955
984
|
close(button) {
|
|
956
985
|
const result = {
|
|
957
986
|
action: button.action,
|
|
958
987
|
};
|
|
959
|
-
this.
|
|
960
|
-
}
|
|
961
|
-
getPresetButtons() {
|
|
962
|
-
const emitter = new BehaviorSubject([]);
|
|
963
|
-
switch (this.config.type) {
|
|
964
|
-
default:
|
|
965
|
-
case SkyConfirmType.OK:
|
|
966
|
-
this.resourcesService
|
|
967
|
-
.getString('skyux_confirm_dialog_default_ok_text')
|
|
968
|
-
.subscribe((value) => {
|
|
969
|
-
emitter.next([
|
|
970
|
-
{
|
|
971
|
-
text: value,
|
|
972
|
-
autofocus: true,
|
|
973
|
-
styleType: 'primary',
|
|
974
|
-
action: 'ok',
|
|
975
|
-
},
|
|
976
|
-
]);
|
|
977
|
-
});
|
|
978
|
-
break;
|
|
979
|
-
case SkyConfirmType.YesNoCancel:
|
|
980
|
-
zip(this.resourcesService.getString('skyux_confirm_dialog_default_yes_text'), this.resourcesService.getString('skyux_confirm_dialog_default_no_text'), this.resourcesService.getString('skyux_confirm_dialog_default_cancel_text')).subscribe((values) => {
|
|
981
|
-
emitter.next([
|
|
982
|
-
{
|
|
983
|
-
text: values[0],
|
|
984
|
-
autofocus: true,
|
|
985
|
-
styleType: 'primary',
|
|
986
|
-
action: 'yes',
|
|
987
|
-
},
|
|
988
|
-
{
|
|
989
|
-
text: values[1],
|
|
990
|
-
styleType: 'default',
|
|
991
|
-
action: 'no',
|
|
992
|
-
},
|
|
993
|
-
{
|
|
994
|
-
text: values[2],
|
|
995
|
-
styleType: 'link',
|
|
996
|
-
action: 'cancel',
|
|
997
|
-
},
|
|
998
|
-
]);
|
|
999
|
-
});
|
|
1000
|
-
break;
|
|
1001
|
-
case SkyConfirmType.YesCancel:
|
|
1002
|
-
zip(this.resourcesService.getString('skyux_confirm_dialog_default_yes_text'), this.resourcesService.getString('skyux_confirm_dialog_default_cancel_text')).subscribe((values) => {
|
|
1003
|
-
emitter.next([
|
|
1004
|
-
{
|
|
1005
|
-
text: values[0],
|
|
1006
|
-
autofocus: true,
|
|
1007
|
-
styleType: 'primary',
|
|
1008
|
-
action: 'yes',
|
|
1009
|
-
},
|
|
1010
|
-
{
|
|
1011
|
-
text: values[1],
|
|
1012
|
-
styleType: 'link',
|
|
1013
|
-
action: 'cancel',
|
|
1014
|
-
},
|
|
1015
|
-
]);
|
|
1016
|
-
});
|
|
1017
|
-
break;
|
|
1018
|
-
}
|
|
1019
|
-
return emitter;
|
|
1020
|
-
}
|
|
1021
|
-
getCustomButtons(buttonConfig) {
|
|
1022
|
-
const buttons = [];
|
|
1023
|
-
buttonConfig.forEach((config) => {
|
|
1024
|
-
buttons.push({
|
|
1025
|
-
text: config.text,
|
|
1026
|
-
action: config.action,
|
|
1027
|
-
styleType: config.styleType || 'default',
|
|
1028
|
-
autofocus: config.autofocus || false,
|
|
1029
|
-
});
|
|
1030
|
-
});
|
|
1031
|
-
return buttons;
|
|
988
|
+
__classPrivateFieldGet(this, _SkyConfirmComponent_modal, "f").close(result);
|
|
1032
989
|
}
|
|
1033
990
|
}
|
|
1034
|
-
|
|
991
|
+
_SkyConfirmComponent_config = new WeakMap(), _SkyConfirmComponent_modal = new WeakMap(), _SkyConfirmComponent_resourcesService = new WeakMap(), _SkyConfirmComponent_instances = new WeakSet(), _SkyConfirmComponent_getPresetButtons = function _SkyConfirmComponent_getPresetButtons() {
|
|
992
|
+
const emitter = new BehaviorSubject([]);
|
|
993
|
+
switch (__classPrivateFieldGet(this, _SkyConfirmComponent_config, "f").type) {
|
|
994
|
+
default:
|
|
995
|
+
case SkyConfirmType.OK:
|
|
996
|
+
__classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f")
|
|
997
|
+
.getString('skyux_confirm_dialog_default_ok_text')
|
|
998
|
+
.subscribe((value) => {
|
|
999
|
+
emitter.next([
|
|
1000
|
+
{
|
|
1001
|
+
text: value,
|
|
1002
|
+
autofocus: true,
|
|
1003
|
+
styleType: 'primary',
|
|
1004
|
+
action: 'ok',
|
|
1005
|
+
},
|
|
1006
|
+
]);
|
|
1007
|
+
});
|
|
1008
|
+
break;
|
|
1009
|
+
case SkyConfirmType.YesNoCancel:
|
|
1010
|
+
zip(__classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f").getString('skyux_confirm_dialog_default_yes_text'), __classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f").getString('skyux_confirm_dialog_default_no_text'), __classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f").getString('skyux_confirm_dialog_default_cancel_text')).subscribe((values) => {
|
|
1011
|
+
emitter.next([
|
|
1012
|
+
{
|
|
1013
|
+
text: values[0],
|
|
1014
|
+
autofocus: true,
|
|
1015
|
+
styleType: 'primary',
|
|
1016
|
+
action: 'yes',
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
text: values[1],
|
|
1020
|
+
styleType: 'default',
|
|
1021
|
+
action: 'no',
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
text: values[2],
|
|
1025
|
+
styleType: 'link',
|
|
1026
|
+
action: 'cancel',
|
|
1027
|
+
},
|
|
1028
|
+
]);
|
|
1029
|
+
});
|
|
1030
|
+
break;
|
|
1031
|
+
case SkyConfirmType.YesCancel:
|
|
1032
|
+
zip(__classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f").getString('skyux_confirm_dialog_default_yes_text'), __classPrivateFieldGet(this, _SkyConfirmComponent_resourcesService, "f").getString('skyux_confirm_dialog_default_cancel_text')).subscribe((values) => {
|
|
1033
|
+
emitter.next([
|
|
1034
|
+
{
|
|
1035
|
+
text: values[0],
|
|
1036
|
+
autofocus: true,
|
|
1037
|
+
styleType: 'primary',
|
|
1038
|
+
action: 'yes',
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
text: values[1],
|
|
1042
|
+
styleType: 'link',
|
|
1043
|
+
action: 'cancel',
|
|
1044
|
+
},
|
|
1045
|
+
]);
|
|
1046
|
+
});
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
return emitter;
|
|
1050
|
+
}, _SkyConfirmComponent_getCustomButtons = function _SkyConfirmComponent_getCustomButtons(buttonConfig) {
|
|
1051
|
+
const buttons = [];
|
|
1052
|
+
buttonConfig.forEach((config) => {
|
|
1053
|
+
buttons.push({
|
|
1054
|
+
text: config.text,
|
|
1055
|
+
action: config.action,
|
|
1056
|
+
styleType: config.styleType || 'default',
|
|
1057
|
+
autofocus: config.autofocus || false,
|
|
1058
|
+
});
|
|
1059
|
+
});
|
|
1060
|
+
return buttons;
|
|
1061
|
+
};
|
|
1062
|
+
SkyConfirmComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyConfirmComponent, deps: [{ token: SKY_CONFIRM_CONFIG }, { token: SkyModalInstance }, { token: i2$2.SkyLibResourcesService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1035
1063
|
SkyConfirmComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: SkyConfirmComponent, selector: "sky-confirm", ngImport: i0, template: "<div class=\"sky-confirm\">\n <sky-modal ariaRole=\"alertdialog\">\n <sky-modal-content class=\"sky-confirm-content\">\n <div\n class=\"sky-confirm-message\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n [skyThemeClass]=\"{\n 'sky-emphasized': 'default',\n 'sky-font-heading-1 sky-font-display-3': 'modern'\n }\"\n >\n {{ message }}\n </div>\n\n <div\n *ngIf=\"body\"\n class=\"sky-confirm-body\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n >\n {{ body }}\n </div>\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-message{margin-top:5px}.sky-confirm-body{margin-top:10px}.sky-confirm-buttons{margin-top:20px}.sky-confirm-preserve-white-space{white-space:pre-wrap}:host-context(.sky-theme-modern) .sky-confirm-content{padding:20px 30px}:host-context(.sky-theme-modern) .sky-confirm-message{padding-bottom:20px}:host-context(.sky-theme-modern) .sky-confirm-body{margin:0}.sky-theme-modern .sky-confirm-content{padding:20px 30px}.sky-theme-modern .sky-confirm-message{padding-bottom:20px}.sky-theme-modern .sky-confirm-body{margin:0}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-confirm-message{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-confirm-message{color:#fbfcfe}\n"], components: [{ type: SkyModalComponent, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: SkyModalContentComponent, selector: "sky-modal-content" }], directives: [{ type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
1036
1064
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyConfirmComponent, decorators: [{
|
|
1037
1065
|
type: Component,
|
|
1038
1066
|
args: [{ selector: 'sky-confirm', template: "<div class=\"sky-confirm\">\n <sky-modal ariaRole=\"alertdialog\">\n <sky-modal-content class=\"sky-confirm-content\">\n <div\n class=\"sky-confirm-message\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n [skyThemeClass]=\"{\n 'sky-emphasized': 'default',\n 'sky-font-heading-1 sky-font-display-3': 'modern'\n }\"\n >\n {{ message }}\n </div>\n\n <div\n *ngIf=\"body\"\n class=\"sky-confirm-body\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n >\n {{ body }}\n </div>\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-message{margin-top:5px}.sky-confirm-body{margin-top:10px}.sky-confirm-buttons{margin-top:20px}.sky-confirm-preserve-white-space{white-space:pre-wrap}:host-context(.sky-theme-modern) .sky-confirm-content{padding:20px 30px}:host-context(.sky-theme-modern) .sky-confirm-message{padding-bottom:20px}:host-context(.sky-theme-modern) .sky-confirm-body{margin:0}.sky-theme-modern .sky-confirm-content{padding:20px 30px}.sky-theme-modern .sky-confirm-message{padding-bottom:20px}.sky-theme-modern .sky-confirm-body{margin:0}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-confirm-message{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-confirm-message{color:#fbfcfe}\n"] }]
|
|
1039
|
-
}], ctorParameters: function () { return [{ type:
|
|
1067
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1068
|
+
type: Inject,
|
|
1069
|
+
args: [SKY_CONFIRM_CONFIG]
|
|
1070
|
+
}] }, { type: SkyModalInstance }, { type: i2$2.SkyLibResourcesService, decorators: [{
|
|
1040
1071
|
type: Optional
|
|
1041
1072
|
}] }]; } });
|
|
1042
1073
|
|
|
@@ -1067,14 +1098,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
1067
1098
|
}]
|
|
1068
1099
|
}] });
|
|
1069
1100
|
|
|
1101
|
+
var _SkyModalService_instances, _SkyModalService_dynamicComponentService, _SkyModalService_getConfigFromParameter, _SkyModalService_createHostComponent;
|
|
1070
1102
|
/**
|
|
1071
1103
|
* A service that launches modals.
|
|
1072
1104
|
* @dynamic
|
|
1073
1105
|
*/
|
|
1074
1106
|
class SkyModalService {
|
|
1075
|
-
// TODO:
|
|
1107
|
+
// TODO: Make `dynamicComponentService` required. It is optional today to maintain binary compatibility for consumers when they construct
|
|
1108
|
+
// the service for unit testing.
|
|
1076
1109
|
constructor(dynamicComponentService) {
|
|
1077
|
-
this
|
|
1110
|
+
_SkyModalService_instances.add(this);
|
|
1111
|
+
_SkyModalService_dynamicComponentService.set(this, void 0);
|
|
1112
|
+
__classPrivateFieldSet(this, _SkyModalService_dynamicComponentService, dynamicComponentService, "f");
|
|
1078
1113
|
}
|
|
1079
1114
|
/**
|
|
1080
1115
|
* @internal
|
|
@@ -1082,7 +1117,7 @@ class SkyModalService {
|
|
|
1082
1117
|
*/
|
|
1083
1118
|
dispose() {
|
|
1084
1119
|
if (SkyModalService.host) {
|
|
1085
|
-
this.
|
|
1120
|
+
__classPrivateFieldGet(this, _SkyModalService_dynamicComponentService, "f").removeComponent(SkyModalService.host);
|
|
1086
1121
|
SkyModalService.host = undefined;
|
|
1087
1122
|
}
|
|
1088
1123
|
}
|
|
@@ -1093,54 +1128,57 @@ class SkyModalService {
|
|
|
1093
1128
|
*/
|
|
1094
1129
|
open(component, config) {
|
|
1095
1130
|
const modalInstance = new SkyModalInstance();
|
|
1096
|
-
this.
|
|
1097
|
-
const params = this.
|
|
1131
|
+
__classPrivateFieldGet(this, _SkyModalService_instances, "m", _SkyModalService_createHostComponent).call(this);
|
|
1132
|
+
const params = __classPrivateFieldGet(this, _SkyModalService_instances, "m", _SkyModalService_getConfigFromParameter).call(this, config);
|
|
1133
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
1098
1134
|
params.providers.push({
|
|
1099
1135
|
provide: SkyModalInstance,
|
|
1100
1136
|
useValue: modalInstance,
|
|
1101
1137
|
});
|
|
1102
1138
|
SkyModalService.host.instance.open(modalInstance, component, params);
|
|
1139
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
1103
1140
|
return modalInstance;
|
|
1104
1141
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1142
|
+
}
|
|
1143
|
+
_SkyModalService_dynamicComponentService = new WeakMap(), _SkyModalService_instances = new WeakSet(), _SkyModalService_getConfigFromParameter = function _SkyModalService_getConfigFromParameter(providersOrConfig) {
|
|
1144
|
+
const defaultParams = {
|
|
1145
|
+
providers: [],
|
|
1146
|
+
fullPage: false,
|
|
1147
|
+
size: 'medium',
|
|
1148
|
+
tiledBody: false,
|
|
1149
|
+
};
|
|
1150
|
+
let params = {};
|
|
1151
|
+
let method = undefined;
|
|
1152
|
+
// Object Literal Lookup for backwards compatability.
|
|
1153
|
+
method = {
|
|
1154
|
+
'providers?': Object.assign({}, defaultParams, {
|
|
1155
|
+
providers: providersOrConfig,
|
|
1156
|
+
}),
|
|
1157
|
+
config: Object.assign({}, defaultParams, providersOrConfig),
|
|
1158
|
+
};
|
|
1159
|
+
if (Array.isArray(providersOrConfig) === true) {
|
|
1160
|
+
params = method['providers?'];
|
|
1161
|
+
}
|
|
1162
|
+
else {
|
|
1163
|
+
params = method['config'];
|
|
1164
|
+
}
|
|
1165
|
+
return params;
|
|
1166
|
+
}, _SkyModalService_createHostComponent = function _SkyModalService_createHostComponent() {
|
|
1167
|
+
if (!SkyModalService.host) {
|
|
1168
|
+
SkyModalService.host = __classPrivateFieldGet(this, _SkyModalService_dynamicComponentService, "f").createComponent(SkyModalHostComponent, {
|
|
1169
|
+
providers: [
|
|
1170
|
+
{
|
|
1171
|
+
provide: SkyModalHostContext,
|
|
1172
|
+
useValue: new SkyModalHostContext({
|
|
1173
|
+
teardownCallback: () => {
|
|
1136
1174
|
this.dispose();
|
|
1137
|
-
}
|
|
1138
|
-
},
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
}
|
|
1175
|
+
},
|
|
1176
|
+
}),
|
|
1177
|
+
},
|
|
1178
|
+
],
|
|
1179
|
+
});
|
|
1142
1180
|
}
|
|
1143
|
-
}
|
|
1181
|
+
};
|
|
1144
1182
|
SkyModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalService, deps: [{ token: i3.SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1145
1183
|
SkyModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalService, providedIn: 'any' });
|
|
1146
1184
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyModalService, decorators: [{
|
|
@@ -1153,22 +1191,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
1153
1191
|
}]
|
|
1154
1192
|
}], ctorParameters: function () { return [{ type: i3.SkyDynamicComponentService }]; } });
|
|
1155
1193
|
|
|
1194
|
+
var _SkyConfirmService_modalService;
|
|
1156
1195
|
/**
|
|
1157
1196
|
* Launches a dialog.
|
|
1158
1197
|
*/
|
|
1159
1198
|
class SkyConfirmService {
|
|
1160
1199
|
constructor(modalService) {
|
|
1161
|
-
this
|
|
1200
|
+
_SkyConfirmService_modalService.set(this, void 0);
|
|
1201
|
+
__classPrivateFieldSet(this, _SkyConfirmService_modalService, modalService, "f");
|
|
1162
1202
|
}
|
|
1163
1203
|
/**
|
|
1164
1204
|
* Opens a dialog using the specified options.
|
|
1165
1205
|
* @param config Specifies configuration options for the dialog.
|
|
1166
1206
|
*/
|
|
1167
1207
|
open(config) {
|
|
1168
|
-
const modalInstance = this.
|
|
1208
|
+
const modalInstance = __classPrivateFieldGet(this, _SkyConfirmService_modalService, "f").open(SkyConfirmComponent, {
|
|
1169
1209
|
providers: [
|
|
1170
1210
|
{
|
|
1171
|
-
provide:
|
|
1211
|
+
provide: SKY_CONFIRM_CONFIG,
|
|
1172
1212
|
useValue: config,
|
|
1173
1213
|
},
|
|
1174
1214
|
],
|
|
@@ -1188,6 +1228,7 @@ class SkyConfirmService {
|
|
|
1188
1228
|
return confirmInstance;
|
|
1189
1229
|
}
|
|
1190
1230
|
}
|
|
1231
|
+
_SkyConfirmService_modalService = new WeakMap();
|
|
1191
1232
|
SkyConfirmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyConfirmService, deps: [{ token: SkyModalService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1192
1233
|
SkyConfirmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyConfirmService, providedIn: 'any' });
|
|
1193
1234
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyConfirmService, decorators: [{
|