@skyux/modals 8.2.6 → 8.3.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 +463 -222
- package/esm2020/index.mjs +2 -1
- package/esm2020/lib/modules/modal/modal-is-dirty.directive.mjs +93 -0
- package/esm2020/lib/modules/modal/modal.module.mjs +7 -2
- package/esm2020/lib/modules/shared/sky-modals-resources.module.mjs +8 -1
- package/esm2020/testing/modal/modal-harness.mjs +9 -1
- package/fesm2015/skyux-modals-testing.mjs +10 -0
- package/fesm2015/skyux-modals-testing.mjs.map +1 -1
- package/fesm2015/skyux-modals.mjs +411 -316
- package/fesm2015/skyux-modals.mjs.map +1 -1
- package/fesm2020/skyux-modals-testing.mjs +8 -0
- package/fesm2020/skyux-modals-testing.mjs.map +1 -1
- package/fesm2020/skyux-modals.mjs +411 -316
- package/fesm2020/skyux-modals.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/modules/modal/modal-is-dirty.directive.d.ts +18 -0
- package/lib/modules/modal/modal.module.d.ts +9 -8
- package/package.json +5 -5
- package/testing/modal/modal-harness.d.ts +4 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, NgModule, Component, ViewEncapsulation, Injectable, Inject, Injector, ViewContainerRef, Optional, ViewChild, Directive, Output, HostListener, inject, ChangeDetectorRef, ElementRef, Host, HostBinding, Input
|
|
2
|
+
import { EventEmitter, NgModule, Component, ViewEncapsulation, Injectable, Inject, Injector, ViewContainerRef, Optional, ViewChild, InjectionToken, Directive, Output, HostListener, inject, ChangeDetectorRef, ElementRef, Host, HostBinding, Input } from '@angular/core';
|
|
3
3
|
import * as i4 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i3 from '@skyux/core';
|
|
@@ -11,7 +11,7 @@ import { NavigationStart, RouterModule } from '@angular/router';
|
|
|
11
11
|
import * as i6 from '@skyux/indicators';
|
|
12
12
|
import { SkyIconModule } from '@skyux/indicators';
|
|
13
13
|
import * as i2$1 from '@skyux/i18n';
|
|
14
|
-
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
14
|
+
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS, SkyLibResourcesService } from '@skyux/i18n';
|
|
15
15
|
import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
|
|
16
16
|
import { Subject, BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
17
17
|
import { takeUntil, takeWhile, take } from 'rxjs/operators';
|
|
@@ -67,6 +67,13 @@ const RESOURCES = {
|
|
|
67
67
|
skyux_modal_open_help: { message: 'Open Help' },
|
|
68
68
|
skyux_modal_footer_cancel_button: { message: 'Cancel' },
|
|
69
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' },
|
|
70
77
|
},
|
|
71
78
|
};
|
|
72
79
|
class SkyModalsResourcesProvider {
|
|
@@ -483,6 +490,226 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
483
490
|
}]
|
|
484
491
|
}] } });
|
|
485
492
|
|
|
493
|
+
/**
|
|
494
|
+
* @internal
|
|
495
|
+
*/
|
|
496
|
+
const SKY_CONFIRM_CONFIG = new InjectionToken('SkyConfirmConfig');
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Properties about the modal close action and a method to close the modal.
|
|
500
|
+
*/
|
|
501
|
+
class SkyModalBeforeCloseHandler {
|
|
502
|
+
constructor(closeModal, closeArgs) {
|
|
503
|
+
this.closeArgs = closeArgs;
|
|
504
|
+
this.closeModal = closeModal;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Contains an object with the data passed from users when
|
|
510
|
+
* a modal is closed and the reason that the modal was closed.
|
|
511
|
+
*/
|
|
512
|
+
class SkyModalCloseArgs {
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
var _SkyModalInstance_instances, _SkyModalInstance__beforeClose, _SkyModalInstance__closed, _SkyModalInstance__helpOpened, _SkyModalInstance_closeModal, _SkyModalInstance_notifyClosed;
|
|
516
|
+
class SkyModalInstance {
|
|
517
|
+
constructor() {
|
|
518
|
+
_SkyModalInstance_instances.add(this);
|
|
519
|
+
_SkyModalInstance__beforeClose.set(this, new Subject());
|
|
520
|
+
_SkyModalInstance__closed.set(this, new Subject());
|
|
521
|
+
_SkyModalInstance__helpOpened.set(this, new Subject());
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* An event that the modal instance emits when it is about to close.
|
|
525
|
+
* It emits a `SkyModalBeforeCloseHandler` object with a `closeModal` method
|
|
526
|
+
* that closes the modal. If a subscription exists for this event,
|
|
527
|
+
* the modal does not close until the subscriber calls the `closeModal` method.
|
|
528
|
+
*/
|
|
529
|
+
get beforeClose() {
|
|
530
|
+
return __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f");
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* An event that the modal instance emits when it closes.
|
|
534
|
+
* It emits a `SkyModalCloseArgs` object with a `data` property that includes
|
|
535
|
+
* data passed from users on close or save and a `reason` property that indicates
|
|
536
|
+
* whether the modal was saved or closed without saving.
|
|
537
|
+
* The `reason` property accepts any string value.
|
|
538
|
+
* Common examples include `"cancel"`, `"close"`, and `"save"`.
|
|
539
|
+
*/
|
|
540
|
+
get closed() {
|
|
541
|
+
return __classPrivateFieldGet(this, _SkyModalInstance__closed, "f");
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* An event that the modal instance emits when users click
|
|
545
|
+
* the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
|
|
546
|
+
* If a `helpKey` parameter was specified, the `helpOpened` event broadcasts the `helpKey`.
|
|
547
|
+
*/
|
|
548
|
+
get helpOpened() {
|
|
549
|
+
return __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f");
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Closes the modal instance.
|
|
553
|
+
* @param result Specifies an object to emit to subscribers of the `closed` event of the
|
|
554
|
+
* modal instance. The `SkyModalInstance` provider can be injected into a component's constructor
|
|
555
|
+
* so that this `close` function can be called from a button in the `sky-modal-footer`.
|
|
556
|
+
* @param reason Specifies the reason for the modal closing, with the default reason of `"close"`.
|
|
557
|
+
* @param ignoreBeforeClose Indicates whether to ignore the modal instance's `beforeClose` event.
|
|
558
|
+
*/
|
|
559
|
+
close(result, reason, ignoreBeforeClose) {
|
|
560
|
+
if (reason === undefined) {
|
|
561
|
+
reason = 'close';
|
|
562
|
+
}
|
|
563
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, reason, result, ignoreBeforeClose);
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Closes the modal instance with `reason="cancel"`.
|
|
567
|
+
* @param result Specifies an object to emit to subscribers of the `closed` event of the modal
|
|
568
|
+
* instance. The `SkyModalInstance` provider can be injected into a component's constructor so
|
|
569
|
+
* that this cancel function can be called from a button in the `sky-modal-footer`.
|
|
570
|
+
*/
|
|
571
|
+
cancel(result) {
|
|
572
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'cancel', result);
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Closes the modal instance with `reason="save"`.
|
|
576
|
+
* @param result Specifies an object to emit to subscribers of the `closed` event of the modal
|
|
577
|
+
* instance. The `SkyModalInstance` provider can be injected into a component's constructor so
|
|
578
|
+
* that this `save` function can be called from a button in `the sky-modal-footer`.
|
|
579
|
+
*/
|
|
580
|
+
save(result) {
|
|
581
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'save', result);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open
|
|
585
|
+
* when users click the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
|
|
586
|
+
* @param helpKey Specifies a string to emit to subscribers of
|
|
587
|
+
* the modal instance's `helpOpened` event. Consumers can inject the `SkyModalInstance` provider
|
|
588
|
+
* into a component's constructor to call the `openHelp` function in the modal template.
|
|
589
|
+
*/
|
|
590
|
+
openHelp(helpKey) {
|
|
591
|
+
__classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").next(helpKey);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
_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) {
|
|
595
|
+
const args = new SkyModalCloseArgs();
|
|
596
|
+
args.reason = type;
|
|
597
|
+
args.data = result;
|
|
598
|
+
if (__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").observers.length === 0 || ignoreBeforeClose) {
|
|
599
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").next(new SkyModalBeforeCloseHandler(() => {
|
|
603
|
+
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
|
|
604
|
+
}, args));
|
|
605
|
+
}
|
|
606
|
+
}, _SkyModalInstance_notifyClosed = function _SkyModalInstance_notifyClosed(args) {
|
|
607
|
+
__classPrivateFieldGet(this, _SkyModalInstance__closed, "f").next(args);
|
|
608
|
+
__classPrivateFieldGet(this, _SkyModalInstance__closed, "f").complete();
|
|
609
|
+
__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").complete();
|
|
610
|
+
__classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").complete();
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
var _SkyModalComponentAdapterService_instances, _SkyModalComponentAdapterService_coreAdapter, _SkyModalComponentAdapterService_setFullPageHeight;
|
|
614
|
+
/**
|
|
615
|
+
* @internal
|
|
616
|
+
*/
|
|
617
|
+
class SkyModalComponentAdapterService {
|
|
618
|
+
constructor(coreAdapter) {
|
|
619
|
+
_SkyModalComponentAdapterService_instances.add(this);
|
|
620
|
+
_SkyModalComponentAdapterService_coreAdapter.set(this, void 0);
|
|
621
|
+
__classPrivateFieldSet(this, _SkyModalComponentAdapterService_coreAdapter, coreAdapter, "f");
|
|
622
|
+
}
|
|
623
|
+
handleWindowChange(modalEl) {
|
|
624
|
+
const boundedHeightEl = modalEl.nativeElement.querySelector('.sky-modal');
|
|
625
|
+
const fullPageModalEl = modalEl.nativeElement.querySelector('.sky-modal-full-page');
|
|
626
|
+
/*
|
|
627
|
+
Set modal height equal to max height of window (accounting for padding above and below modal)
|
|
628
|
+
*/
|
|
629
|
+
const newHeight = window.innerHeight - 40;
|
|
630
|
+
boundedHeightEl.style.maxHeight = newHeight.toString() + 'px';
|
|
631
|
+
if (fullPageModalEl) {
|
|
632
|
+
__classPrivateFieldGet(this, _SkyModalComponentAdapterService_instances, "m", _SkyModalComponentAdapterService_setFullPageHeight).call(this, fullPageModalEl);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
/*
|
|
636
|
+
IE11 doesn't handle flex and max-height correctly so we have to explicitly add
|
|
637
|
+
max-height to the content that accounts for standard header and footer height.
|
|
638
|
+
*/
|
|
639
|
+
const modalContentEl = modalEl.nativeElement.querySelector('.sky-modal-content');
|
|
640
|
+
const contentHeight = newHeight - 114;
|
|
641
|
+
modalContentEl.style.maxHeight = contentHeight.toString() + 'px';
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
isFocusInFirstItem(event, list) {
|
|
645
|
+
/* istanbul ignore next */
|
|
646
|
+
/* sanity check */
|
|
647
|
+
const eventTarget = event.target || event.srcElement;
|
|
648
|
+
return list.length > 0 && eventTarget === list[0];
|
|
649
|
+
}
|
|
650
|
+
isFocusInLastItem(event, list) {
|
|
651
|
+
/* istanbul ignore next */
|
|
652
|
+
/* sanity check */
|
|
653
|
+
const eventTarget = event.target || event.srcElement;
|
|
654
|
+
return list.length > 0 && eventTarget === list[list.length - 1];
|
|
655
|
+
}
|
|
656
|
+
isModalFocused(event, modalEl) {
|
|
657
|
+
/* istanbul ignore next */
|
|
658
|
+
/* sanity check */
|
|
659
|
+
const eventTarget = event.target || event.srcElement;
|
|
660
|
+
return (modalEl &&
|
|
661
|
+
eventTarget === modalEl.nativeElement.querySelector('.sky-modal-dialog'));
|
|
662
|
+
}
|
|
663
|
+
focusLastElement(list) {
|
|
664
|
+
if (list.length > 0) {
|
|
665
|
+
list[list.length - 1].focus();
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
focusFirstElement(list) {
|
|
671
|
+
if (list.length > 0) {
|
|
672
|
+
list[0].focus();
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
modalContentHasDirectChildViewkeeper(modalContentEl) {
|
|
678
|
+
return !!modalContentEl.nativeElement.querySelector('sky-modal-content > .sky-viewkeeper-fixed');
|
|
679
|
+
}
|
|
680
|
+
modalOpened(modalEl) {
|
|
681
|
+
/* istanbul ignore else */
|
|
682
|
+
/* handle the case where somehow there is a focused element already in the modal */
|
|
683
|
+
if (!(document.activeElement &&
|
|
684
|
+
modalEl.nativeElement.contains(document.activeElement))) {
|
|
685
|
+
const currentScrollX = window.pageXOffset;
|
|
686
|
+
const currentScrollY = window.pageYOffset;
|
|
687
|
+
const inputWithAutofocus = modalEl.nativeElement.querySelector('[autofocus]');
|
|
688
|
+
if (inputWithAutofocus) {
|
|
689
|
+
inputWithAutofocus.focus();
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
__classPrivateFieldGet(this, _SkyModalComponentAdapterService_coreAdapter, "f").getFocusableChildrenAndApplyFocus(modalEl, '.sky-modal-content', true);
|
|
693
|
+
}
|
|
694
|
+
window.scrollTo(currentScrollX, currentScrollY);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
_SkyModalComponentAdapterService_coreAdapter = new WeakMap(), _SkyModalComponentAdapterService_instances = new WeakSet(), _SkyModalComponentAdapterService_setFullPageHeight = function _SkyModalComponentAdapterService_setFullPageHeight(fullPageModalEl) {
|
|
699
|
+
const windowHeight = window.innerHeight;
|
|
700
|
+
const fullPageModalStyle = getComputedStyle(fullPageModalEl);
|
|
701
|
+
const marginTopBottom = parseInt(fullPageModalStyle.marginTop, 10) +
|
|
702
|
+
parseInt(fullPageModalStyle.marginBottom, 10);
|
|
703
|
+
const fullPageModalHeight = windowHeight - marginTopBottom + 'px';
|
|
704
|
+
fullPageModalEl.style.height = fullPageModalHeight;
|
|
705
|
+
fullPageModalEl.style.maxHeight = fullPageModalHeight;
|
|
706
|
+
};
|
|
707
|
+
SkyModalComponentAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, deps: [{ token: i3.SkyCoreAdapterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
708
|
+
SkyModalComponentAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService });
|
|
709
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, decorators: [{
|
|
710
|
+
type: Injectable
|
|
711
|
+
}], ctorParameters: function () { return [{ type: i3.SkyCoreAdapterService }]; } });
|
|
712
|
+
|
|
486
713
|
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;
|
|
487
714
|
/**
|
|
488
715
|
* Raises an event when the box shadow for the modal header or footer should be adjusted
|
|
@@ -604,119 +831,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
604
831
|
args: ['scroll']
|
|
605
832
|
}] } });
|
|
606
833
|
|
|
607
|
-
var
|
|
834
|
+
var _SkyModalComponent_hostService, _SkyModalComponent_elRef, _SkyModalComponent_windowRef, _SkyModalComponent_componentAdapter, _SkyModalComponent_coreAdapter, _SkyModalComponent_dockService, _SkyModalComponent_mediaQueryService, _SkyModalComponent_ngUnsubscribe, _SkyModalComponent__ariaDescribedBy, _SkyModalComponent__ariaLabelledBy, _SkyModalComponent_changeDetector, _SkyModalComponent_liveAnnouncerSvc;
|
|
835
|
+
const ARIA_ROLE_DEFAULT = 'dialog';
|
|
608
836
|
/**
|
|
609
|
-
*
|
|
837
|
+
* Provides a common look-and-feel for modal content with options to display
|
|
838
|
+
* a common modal header, specify body content, and display a common modal footer
|
|
839
|
+
* and buttons.
|
|
610
840
|
*/
|
|
611
|
-
class
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
handleWindowChange(modalEl) {
|
|
618
|
-
const boundedHeightEl = modalEl.nativeElement.querySelector('.sky-modal');
|
|
619
|
-
const fullPageModalEl = modalEl.nativeElement.querySelector('.sky-modal-full-page');
|
|
620
|
-
/*
|
|
621
|
-
Set modal height equal to max height of window (accounting for padding above and below modal)
|
|
622
|
-
*/
|
|
623
|
-
const newHeight = window.innerHeight - 40;
|
|
624
|
-
boundedHeightEl.style.maxHeight = newHeight.toString() + 'px';
|
|
625
|
-
if (fullPageModalEl) {
|
|
626
|
-
__classPrivateFieldGet(this, _SkyModalComponentAdapterService_instances, "m", _SkyModalComponentAdapterService_setFullPageHeight).call(this, fullPageModalEl);
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
/*
|
|
630
|
-
IE11 doesn't handle flex and max-height correctly so we have to explicitly add
|
|
631
|
-
max-height to the content that accounts for standard header and footer height.
|
|
632
|
-
*/
|
|
633
|
-
const modalContentEl = modalEl.nativeElement.querySelector('.sky-modal-content');
|
|
634
|
-
const contentHeight = newHeight - 114;
|
|
635
|
-
modalContentEl.style.maxHeight = contentHeight.toString() + 'px';
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
isFocusInFirstItem(event, list) {
|
|
639
|
-
/* istanbul ignore next */
|
|
640
|
-
/* sanity check */
|
|
641
|
-
const eventTarget = event.target || event.srcElement;
|
|
642
|
-
return list.length > 0 && eventTarget === list[0];
|
|
643
|
-
}
|
|
644
|
-
isFocusInLastItem(event, list) {
|
|
645
|
-
/* istanbul ignore next */
|
|
646
|
-
/* sanity check */
|
|
647
|
-
const eventTarget = event.target || event.srcElement;
|
|
648
|
-
return list.length > 0 && eventTarget === list[list.length - 1];
|
|
649
|
-
}
|
|
650
|
-
isModalFocused(event, modalEl) {
|
|
651
|
-
/* istanbul ignore next */
|
|
652
|
-
/* sanity check */
|
|
653
|
-
const eventTarget = event.target || event.srcElement;
|
|
654
|
-
return (modalEl &&
|
|
655
|
-
eventTarget === modalEl.nativeElement.querySelector('.sky-modal-dialog'));
|
|
656
|
-
}
|
|
657
|
-
focusLastElement(list) {
|
|
658
|
-
if (list.length > 0) {
|
|
659
|
-
list[list.length - 1].focus();
|
|
660
|
-
return true;
|
|
661
|
-
}
|
|
662
|
-
return false;
|
|
663
|
-
}
|
|
664
|
-
focusFirstElement(list) {
|
|
665
|
-
if (list.length > 0) {
|
|
666
|
-
list[0].focus();
|
|
667
|
-
return true;
|
|
668
|
-
}
|
|
669
|
-
return false;
|
|
670
|
-
}
|
|
671
|
-
modalContentHasDirectChildViewkeeper(modalContentEl) {
|
|
672
|
-
return !!modalContentEl.nativeElement.querySelector('sky-modal-content > .sky-viewkeeper-fixed');
|
|
673
|
-
}
|
|
674
|
-
modalOpened(modalEl) {
|
|
675
|
-
/* istanbul ignore else */
|
|
676
|
-
/* handle the case where somehow there is a focused element already in the modal */
|
|
677
|
-
if (!(document.activeElement &&
|
|
678
|
-
modalEl.nativeElement.contains(document.activeElement))) {
|
|
679
|
-
const currentScrollX = window.pageXOffset;
|
|
680
|
-
const currentScrollY = window.pageYOffset;
|
|
681
|
-
const inputWithAutofocus = modalEl.nativeElement.querySelector('[autofocus]');
|
|
682
|
-
if (inputWithAutofocus) {
|
|
683
|
-
inputWithAutofocus.focus();
|
|
684
|
-
}
|
|
685
|
-
else {
|
|
686
|
-
__classPrivateFieldGet(this, _SkyModalComponentAdapterService_coreAdapter, "f").getFocusableChildrenAndApplyFocus(modalEl, '.sky-modal-content', true);
|
|
687
|
-
}
|
|
688
|
-
window.scrollTo(currentScrollX, currentScrollY);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
_SkyModalComponentAdapterService_coreAdapter = new WeakMap(), _SkyModalComponentAdapterService_instances = new WeakSet(), _SkyModalComponentAdapterService_setFullPageHeight = function _SkyModalComponentAdapterService_setFullPageHeight(fullPageModalEl) {
|
|
693
|
-
const windowHeight = window.innerHeight;
|
|
694
|
-
const fullPageModalStyle = getComputedStyle(fullPageModalEl);
|
|
695
|
-
const marginTopBottom = parseInt(fullPageModalStyle.marginTop, 10) +
|
|
696
|
-
parseInt(fullPageModalStyle.marginBottom, 10);
|
|
697
|
-
const fullPageModalHeight = windowHeight - marginTopBottom + 'px';
|
|
698
|
-
fullPageModalEl.style.height = fullPageModalHeight;
|
|
699
|
-
fullPageModalEl.style.maxHeight = fullPageModalHeight;
|
|
700
|
-
};
|
|
701
|
-
SkyModalComponentAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, deps: [{ token: i3.SkyCoreAdapterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
702
|
-
SkyModalComponentAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService });
|
|
703
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalComponentAdapterService, decorators: [{
|
|
704
|
-
type: Injectable
|
|
705
|
-
}], ctorParameters: function () { return [{ type: i3.SkyCoreAdapterService }]; } });
|
|
706
|
-
|
|
707
|
-
var _SkyModalComponent_hostService, _SkyModalComponent_elRef, _SkyModalComponent_windowRef, _SkyModalComponent_componentAdapter, _SkyModalComponent_coreAdapter, _SkyModalComponent_dockService, _SkyModalComponent_mediaQueryService, _SkyModalComponent_ngUnsubscribe, _SkyModalComponent__ariaDescribedBy, _SkyModalComponent__ariaLabelledBy, _SkyModalComponent_changeDetector, _SkyModalComponent_liveAnnouncerSvc;
|
|
708
|
-
const ARIA_ROLE_DEFAULT = 'dialog';
|
|
709
|
-
/**
|
|
710
|
-
* Provides a common look-and-feel for modal content with options to display
|
|
711
|
-
* a common modal header, specify body content, and display a common modal footer
|
|
712
|
-
* and buttons.
|
|
713
|
-
*/
|
|
714
|
-
class SkyModalComponent {
|
|
715
|
-
/**
|
|
716
|
-
* @internal
|
|
717
|
-
*/
|
|
718
|
-
set ariaRole(value) {
|
|
719
|
-
this.ariaRoleOrDefault = value || ARIA_ROLE_DEFAULT;
|
|
841
|
+
class SkyModalComponent {
|
|
842
|
+
/**
|
|
843
|
+
* @internal
|
|
844
|
+
*/
|
|
845
|
+
set ariaRole(value) {
|
|
846
|
+
this.ariaRoleOrDefault = value || ARIA_ROLE_DEFAULT;
|
|
720
847
|
}
|
|
721
848
|
/**
|
|
722
849
|
* @internal
|
|
@@ -901,180 +1028,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
901
1028
|
args: ['document:keydown', ['$event']]
|
|
902
1029
|
}] } });
|
|
903
1030
|
|
|
904
|
-
class SkyModalModule {
|
|
905
|
-
}
|
|
906
|
-
SkyModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
907
|
-
SkyModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, declarations: [SkyModalComponent,
|
|
908
|
-
SkyModalContentComponent,
|
|
909
|
-
SkyModalFooterComponent,
|
|
910
|
-
SkyModalHeaderComponent,
|
|
911
|
-
SkyModalHostComponent,
|
|
912
|
-
SkyModalScrollShadowDirective], imports: [CommonModule,
|
|
913
|
-
RouterModule,
|
|
914
|
-
SkyIconModule,
|
|
915
|
-
SkyIdModule,
|
|
916
|
-
SkyModalsResourcesModule,
|
|
917
|
-
SkyThemeModule,
|
|
918
|
-
SkyTrimModule], exports: [SkyModalComponent,
|
|
919
|
-
SkyModalContentComponent,
|
|
920
|
-
SkyModalFooterComponent,
|
|
921
|
-
SkyModalHeaderComponent] });
|
|
922
|
-
SkyModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, imports: [CommonModule,
|
|
923
|
-
RouterModule,
|
|
924
|
-
SkyIconModule,
|
|
925
|
-
SkyIdModule,
|
|
926
|
-
SkyModalsResourcesModule,
|
|
927
|
-
SkyThemeModule,
|
|
928
|
-
SkyTrimModule] });
|
|
929
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, decorators: [{
|
|
930
|
-
type: NgModule,
|
|
931
|
-
args: [{
|
|
932
|
-
declarations: [
|
|
933
|
-
SkyModalComponent,
|
|
934
|
-
SkyModalContentComponent,
|
|
935
|
-
SkyModalFooterComponent,
|
|
936
|
-
SkyModalHeaderComponent,
|
|
937
|
-
SkyModalHostComponent,
|
|
938
|
-
SkyModalScrollShadowDirective,
|
|
939
|
-
],
|
|
940
|
-
imports: [
|
|
941
|
-
CommonModule,
|
|
942
|
-
RouterModule,
|
|
943
|
-
SkyIconModule,
|
|
944
|
-
SkyIdModule,
|
|
945
|
-
SkyModalsResourcesModule,
|
|
946
|
-
SkyThemeModule,
|
|
947
|
-
SkyTrimModule,
|
|
948
|
-
],
|
|
949
|
-
exports: [
|
|
950
|
-
SkyModalComponent,
|
|
951
|
-
SkyModalContentComponent,
|
|
952
|
-
SkyModalFooterComponent,
|
|
953
|
-
SkyModalHeaderComponent,
|
|
954
|
-
],
|
|
955
|
-
}]
|
|
956
|
-
}] });
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* @internal
|
|
960
|
-
*/
|
|
961
|
-
const SKY_CONFIRM_CONFIG = new InjectionToken('SkyConfirmConfig');
|
|
962
|
-
|
|
963
|
-
/**
|
|
964
|
-
* Properties about the modal close action and a method to close the modal.
|
|
965
|
-
*/
|
|
966
|
-
class SkyModalBeforeCloseHandler {
|
|
967
|
-
constructor(closeModal, closeArgs) {
|
|
968
|
-
this.closeArgs = closeArgs;
|
|
969
|
-
this.closeModal = closeModal;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
/**
|
|
974
|
-
* Contains an object with the data passed from users when
|
|
975
|
-
* a modal is closed and the reason that the modal was closed.
|
|
976
|
-
*/
|
|
977
|
-
class SkyModalCloseArgs {
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
var _SkyModalInstance_instances, _SkyModalInstance__beforeClose, _SkyModalInstance__closed, _SkyModalInstance__helpOpened, _SkyModalInstance_closeModal, _SkyModalInstance_notifyClosed;
|
|
981
|
-
class SkyModalInstance {
|
|
982
|
-
constructor() {
|
|
983
|
-
_SkyModalInstance_instances.add(this);
|
|
984
|
-
_SkyModalInstance__beforeClose.set(this, new Subject());
|
|
985
|
-
_SkyModalInstance__closed.set(this, new Subject());
|
|
986
|
-
_SkyModalInstance__helpOpened.set(this, new Subject());
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* An event that the modal instance emits when it is about to close.
|
|
990
|
-
* It emits a `SkyModalBeforeCloseHandler` object with a `closeModal` method
|
|
991
|
-
* that closes the modal. If a subscription exists for this event,
|
|
992
|
-
* the modal does not close until the subscriber calls the `closeModal` method.
|
|
993
|
-
*/
|
|
994
|
-
get beforeClose() {
|
|
995
|
-
return __classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f");
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* An event that the modal instance emits when it closes.
|
|
999
|
-
* It emits a `SkyModalCloseArgs` object with a `data` property that includes
|
|
1000
|
-
* data passed from users on close or save and a `reason` property that indicates
|
|
1001
|
-
* whether the modal was saved or closed without saving.
|
|
1002
|
-
* The `reason` property accepts any string value.
|
|
1003
|
-
* Common examples include `"cancel"`, `"close"`, and `"save"`.
|
|
1004
|
-
*/
|
|
1005
|
-
get closed() {
|
|
1006
|
-
return __classPrivateFieldGet(this, _SkyModalInstance__closed, "f");
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* An event that the modal instance emits when users click
|
|
1010
|
-
* the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
|
|
1011
|
-
* If a `helpKey` parameter was specified, the `helpOpened` event broadcasts the `helpKey`.
|
|
1012
|
-
*/
|
|
1013
|
-
get helpOpened() {
|
|
1014
|
-
return __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f");
|
|
1015
|
-
}
|
|
1016
|
-
/**
|
|
1017
|
-
* Closes the modal instance.
|
|
1018
|
-
* @param result Specifies an object to emit to subscribers of the `closed` event of the
|
|
1019
|
-
* modal instance. The `SkyModalInstance` provider can be injected into a component's constructor
|
|
1020
|
-
* so that this `close` function can be called from a button in the `sky-modal-footer`.
|
|
1021
|
-
* @param reason Specifies the reason for the modal closing, with the default reason of `"close"`.
|
|
1022
|
-
* @param ignoreBeforeClose Indicates whether to ignore the modal instance's `beforeClose` event.
|
|
1023
|
-
*/
|
|
1024
|
-
close(result, reason, ignoreBeforeClose) {
|
|
1025
|
-
if (reason === undefined) {
|
|
1026
|
-
reason = 'close';
|
|
1027
|
-
}
|
|
1028
|
-
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, reason, result, ignoreBeforeClose);
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* Closes the modal instance with `reason="cancel"`.
|
|
1032
|
-
* @param result Specifies an object to emit to subscribers of the `closed` event of the modal
|
|
1033
|
-
* instance. The `SkyModalInstance` provider can be injected into a component's constructor so
|
|
1034
|
-
* that this cancel function can be called from a button in the `sky-modal-footer`.
|
|
1035
|
-
*/
|
|
1036
|
-
cancel(result) {
|
|
1037
|
-
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'cancel', result);
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Closes the modal instance with `reason="save"`.
|
|
1041
|
-
* @param result Specifies an object to emit to subscribers of the `closed` event of the modal
|
|
1042
|
-
* instance. The `SkyModalInstance` provider can be injected into a component's constructor so
|
|
1043
|
-
* that this `save` function can be called from a button in `the sky-modal-footer`.
|
|
1044
|
-
*/
|
|
1045
|
-
save(result) {
|
|
1046
|
-
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'save', result);
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open
|
|
1050
|
-
* when users click the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
|
|
1051
|
-
* @param helpKey Specifies a string to emit to subscribers of
|
|
1052
|
-
* the modal instance's `helpOpened` event. Consumers can inject the `SkyModalInstance` provider
|
|
1053
|
-
* into a component's constructor to call the `openHelp` function in the modal template.
|
|
1054
|
-
*/
|
|
1055
|
-
openHelp(helpKey) {
|
|
1056
|
-
__classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").next(helpKey);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
_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) {
|
|
1060
|
-
const args = new SkyModalCloseArgs();
|
|
1061
|
-
args.reason = type;
|
|
1062
|
-
args.data = result;
|
|
1063
|
-
if (__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").observers.length === 0 || ignoreBeforeClose) {
|
|
1064
|
-
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
|
|
1065
|
-
}
|
|
1066
|
-
else {
|
|
1067
|
-
__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").next(new SkyModalBeforeCloseHandler(() => {
|
|
1068
|
-
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_notifyClosed).call(this, args);
|
|
1069
|
-
}, args));
|
|
1070
|
-
}
|
|
1071
|
-
}, _SkyModalInstance_notifyClosed = function _SkyModalInstance_notifyClosed(args) {
|
|
1072
|
-
__classPrivateFieldGet(this, _SkyModalInstance__closed, "f").next(args);
|
|
1073
|
-
__classPrivateFieldGet(this, _SkyModalInstance__closed, "f").complete();
|
|
1074
|
-
__classPrivateFieldGet(this, _SkyModalInstance__beforeClose, "f").complete();
|
|
1075
|
-
__classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").complete();
|
|
1076
|
-
};
|
|
1077
|
-
|
|
1078
1031
|
var _SkyConfirmComponent_instances, _SkyConfirmComponent_config, _SkyConfirmComponent_modal, _SkyConfirmComponent_resourcesService, _SkyConfirmComponent_getPresetButtons, _SkyConfirmComponent_getCustomButtons;
|
|
1079
1032
|
class SkyConfirmComponent {
|
|
1080
1033
|
constructor(config, modal, resourcesService, idService) {
|
|
@@ -1177,34 +1130,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1177
1130
|
}] }, { type: SkyModalInstance }, { type: i2$1.SkyLibResourcesService }, { type: i3.SkyIdService }];
|
|
1178
1131
|
} });
|
|
1179
1132
|
|
|
1180
|
-
class SkyConfirmModule {
|
|
1181
|
-
}
|
|
1182
|
-
SkyConfirmModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1183
|
-
SkyConfirmModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, declarations: [SkyConfirmComponent], imports: [CommonModule,
|
|
1184
|
-
SkyIdModule,
|
|
1185
|
-
SkyModalModule,
|
|
1186
|
-
SkyModalsResourcesModule,
|
|
1187
|
-
SkyThemeModule], exports: [SkyConfirmComponent] });
|
|
1188
|
-
SkyConfirmModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, imports: [CommonModule,
|
|
1189
|
-
SkyIdModule,
|
|
1190
|
-
SkyModalModule,
|
|
1191
|
-
SkyModalsResourcesModule,
|
|
1192
|
-
SkyThemeModule] });
|
|
1193
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, decorators: [{
|
|
1194
|
-
type: NgModule,
|
|
1195
|
-
args: [{
|
|
1196
|
-
declarations: [SkyConfirmComponent],
|
|
1197
|
-
imports: [
|
|
1198
|
-
CommonModule,
|
|
1199
|
-
SkyIdModule,
|
|
1200
|
-
SkyModalModule,
|
|
1201
|
-
SkyModalsResourcesModule,
|
|
1202
|
-
SkyThemeModule,
|
|
1203
|
-
],
|
|
1204
|
-
exports: [SkyConfirmComponent],
|
|
1205
|
-
}]
|
|
1206
|
-
}] });
|
|
1207
|
-
|
|
1208
1133
|
var _SkyModalService_instances, _SkyModalService_dynamicComponentService, _SkyModalService_getConfigFromParameter, _SkyModalService_createHostComponent;
|
|
1209
1134
|
/**
|
|
1210
1135
|
* A service that launches modals.
|
|
@@ -1347,9 +1272,179 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1347
1272
|
}]
|
|
1348
1273
|
}], ctorParameters: function () { return [{ type: SkyModalService }]; } });
|
|
1349
1274
|
|
|
1275
|
+
var _SkyModalIsDirtyDirective_instances, _SkyModalIsDirtyDirective_ngUnsubscribe, _SkyModalIsDirtyDirective_modalInstance, _SkyModalIsDirtyDirective_confirmSvc, _SkyModalIsDirtyDirective_resourcesSvc, _SkyModalIsDirtyDirective_promptIfDirty;
|
|
1276
|
+
/**
|
|
1277
|
+
* Provides a way to mark a modal as "dirty" and displays a confirmation
|
|
1278
|
+
* message when a user closes the modal without saving.
|
|
1279
|
+
*/
|
|
1280
|
+
class SkyModalIsDirtyDirective {
|
|
1281
|
+
constructor() {
|
|
1282
|
+
_SkyModalIsDirtyDirective_instances.add(this);
|
|
1283
|
+
/**
|
|
1284
|
+
* Whether the user edited an input on the modal.
|
|
1285
|
+
* @required
|
|
1286
|
+
*/
|
|
1287
|
+
this.isDirty = false;
|
|
1288
|
+
_SkyModalIsDirtyDirective_ngUnsubscribe.set(this, new Subject());
|
|
1289
|
+
_SkyModalIsDirtyDirective_modalInstance.set(this, inject(SkyModalInstance));
|
|
1290
|
+
_SkyModalIsDirtyDirective_confirmSvc.set(this, inject(SkyConfirmService));
|
|
1291
|
+
_SkyModalIsDirtyDirective_resourcesSvc.set(this, inject(SkyLibResourcesService));
|
|
1292
|
+
}
|
|
1293
|
+
ngOnInit() {
|
|
1294
|
+
__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_modalInstance, "f").beforeClose
|
|
1295
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f")))
|
|
1296
|
+
.subscribe((handler) => __classPrivateFieldGet(this, _SkyModalIsDirtyDirective_instances, "m", _SkyModalIsDirtyDirective_promptIfDirty).call(this, handler));
|
|
1297
|
+
}
|
|
1298
|
+
ngOnDestroy() {
|
|
1299
|
+
__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f").next();
|
|
1300
|
+
__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_ngUnsubscribe, "f").complete();
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
_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) {
|
|
1304
|
+
if (this.isDirty && handler.closeArgs.reason === 'close') {
|
|
1305
|
+
__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_resourcesSvc, "f")
|
|
1306
|
+
.getStrings({
|
|
1307
|
+
message: 'skyux_modal_dirty_default_message',
|
|
1308
|
+
discardActionText: 'skyux_modal_dirty_default_discard_changes_text',
|
|
1309
|
+
keepActionText: 'skyux_modal_dirty_default_keep_working_text',
|
|
1310
|
+
})
|
|
1311
|
+
.subscribe((textValues) => {
|
|
1312
|
+
const discardAction = 'discard';
|
|
1313
|
+
const keepAction = 'keep';
|
|
1314
|
+
__classPrivateFieldGet(this, _SkyModalIsDirtyDirective_confirmSvc, "f")
|
|
1315
|
+
.open({
|
|
1316
|
+
message: textValues.message,
|
|
1317
|
+
buttons: [
|
|
1318
|
+
{
|
|
1319
|
+
action: discardAction,
|
|
1320
|
+
text: textValues.discardActionText,
|
|
1321
|
+
styleType: 'primary',
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
action: keepAction,
|
|
1325
|
+
text: textValues.keepActionText,
|
|
1326
|
+
styleType: 'link',
|
|
1327
|
+
},
|
|
1328
|
+
],
|
|
1329
|
+
type: SkyConfirmType.Custom,
|
|
1330
|
+
})
|
|
1331
|
+
.closed.subscribe((args) => {
|
|
1332
|
+
if (args.action === discardAction) {
|
|
1333
|
+
handler.closeModal();
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
else {
|
|
1339
|
+
handler.closeModal();
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
SkyModalIsDirtyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalIsDirtyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1343
|
+
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 });
|
|
1344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalIsDirtyDirective, decorators: [{
|
|
1345
|
+
type: Directive,
|
|
1346
|
+
args: [{
|
|
1347
|
+
// Since this is limited to sky-modal, it should be safe to
|
|
1348
|
+
// leave off the sky prefix.
|
|
1349
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1350
|
+
selector: 'sky-modal[isDirty]',
|
|
1351
|
+
}]
|
|
1352
|
+
}], propDecorators: { isDirty: [{
|
|
1353
|
+
type: Input
|
|
1354
|
+
}, {
|
|
1355
|
+
type: HostBinding,
|
|
1356
|
+
args: ['attr.data-sky-modal-is-dirty']
|
|
1357
|
+
}] } });
|
|
1358
|
+
|
|
1359
|
+
class SkyModalModule {
|
|
1360
|
+
}
|
|
1361
|
+
SkyModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1362
|
+
SkyModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, declarations: [SkyModalComponent,
|
|
1363
|
+
SkyModalContentComponent,
|
|
1364
|
+
SkyModalFooterComponent,
|
|
1365
|
+
SkyModalHeaderComponent,
|
|
1366
|
+
SkyModalHostComponent,
|
|
1367
|
+
SkyModalIsDirtyDirective,
|
|
1368
|
+
SkyModalScrollShadowDirective], imports: [CommonModule,
|
|
1369
|
+
RouterModule,
|
|
1370
|
+
SkyIconModule,
|
|
1371
|
+
SkyIdModule,
|
|
1372
|
+
SkyModalsResourcesModule,
|
|
1373
|
+
SkyThemeModule,
|
|
1374
|
+
SkyTrimModule], exports: [SkyModalComponent,
|
|
1375
|
+
SkyModalContentComponent,
|
|
1376
|
+
SkyModalFooterComponent,
|
|
1377
|
+
SkyModalHeaderComponent,
|
|
1378
|
+
SkyModalIsDirtyDirective] });
|
|
1379
|
+
SkyModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, imports: [CommonModule,
|
|
1380
|
+
RouterModule,
|
|
1381
|
+
SkyIconModule,
|
|
1382
|
+
SkyIdModule,
|
|
1383
|
+
SkyModalsResourcesModule,
|
|
1384
|
+
SkyThemeModule,
|
|
1385
|
+
SkyTrimModule] });
|
|
1386
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyModalModule, decorators: [{
|
|
1387
|
+
type: NgModule,
|
|
1388
|
+
args: [{
|
|
1389
|
+
declarations: [
|
|
1390
|
+
SkyModalComponent,
|
|
1391
|
+
SkyModalContentComponent,
|
|
1392
|
+
SkyModalFooterComponent,
|
|
1393
|
+
SkyModalHeaderComponent,
|
|
1394
|
+
SkyModalHostComponent,
|
|
1395
|
+
SkyModalIsDirtyDirective,
|
|
1396
|
+
SkyModalScrollShadowDirective,
|
|
1397
|
+
],
|
|
1398
|
+
imports: [
|
|
1399
|
+
CommonModule,
|
|
1400
|
+
RouterModule,
|
|
1401
|
+
SkyIconModule,
|
|
1402
|
+
SkyIdModule,
|
|
1403
|
+
SkyModalsResourcesModule,
|
|
1404
|
+
SkyThemeModule,
|
|
1405
|
+
SkyTrimModule,
|
|
1406
|
+
],
|
|
1407
|
+
exports: [
|
|
1408
|
+
SkyModalComponent,
|
|
1409
|
+
SkyModalContentComponent,
|
|
1410
|
+
SkyModalFooterComponent,
|
|
1411
|
+
SkyModalHeaderComponent,
|
|
1412
|
+
SkyModalIsDirtyDirective,
|
|
1413
|
+
],
|
|
1414
|
+
}]
|
|
1415
|
+
}] });
|
|
1416
|
+
|
|
1417
|
+
class SkyConfirmModule {
|
|
1418
|
+
}
|
|
1419
|
+
SkyConfirmModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1420
|
+
SkyConfirmModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, declarations: [SkyConfirmComponent], imports: [CommonModule,
|
|
1421
|
+
SkyIdModule,
|
|
1422
|
+
SkyModalModule,
|
|
1423
|
+
SkyModalsResourcesModule,
|
|
1424
|
+
SkyThemeModule], exports: [SkyConfirmComponent] });
|
|
1425
|
+
SkyConfirmModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, imports: [CommonModule,
|
|
1426
|
+
SkyIdModule,
|
|
1427
|
+
SkyModalModule,
|
|
1428
|
+
SkyModalsResourcesModule,
|
|
1429
|
+
SkyThemeModule] });
|
|
1430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SkyConfirmModule, decorators: [{
|
|
1431
|
+
type: NgModule,
|
|
1432
|
+
args: [{
|
|
1433
|
+
declarations: [SkyConfirmComponent],
|
|
1434
|
+
imports: [
|
|
1435
|
+
CommonModule,
|
|
1436
|
+
SkyIdModule,
|
|
1437
|
+
SkyModalModule,
|
|
1438
|
+
SkyModalsResourcesModule,
|
|
1439
|
+
SkyThemeModule,
|
|
1440
|
+
],
|
|
1441
|
+
exports: [SkyConfirmComponent],
|
|
1442
|
+
}]
|
|
1443
|
+
}] });
|
|
1444
|
+
|
|
1350
1445
|
/**
|
|
1351
1446
|
* Generated bundle index. Do not edit.
|
|
1352
1447
|
*/
|
|
1353
1448
|
|
|
1354
|
-
export { SkyConfirmInstance, SkyConfirmModule, SkyConfirmService, SkyConfirmType, SkyModalBeforeCloseHandler, SkyModalCloseArgs, SkyModalConfiguration, SkyModalHostService, SkyModalInstance, SkyModalModule, SkyModalService, SkyConfirmComponent as λ1, SkyModalContentComponent as λ2, SkyModalFooterComponent as λ3, SkyModalHeaderComponent as λ4, SkyModalComponent as λ5 };
|
|
1449
|
+
export { SkyConfirmInstance, SkyConfirmModule, SkyConfirmService, SkyConfirmType, SkyModalBeforeCloseHandler, SkyModalCloseArgs, SkyModalConfiguration, SkyModalHostService, SkyModalInstance, SkyModalModule, SkyModalService, SkyConfirmComponent as λ1, SkyModalContentComponent as λ2, SkyModalFooterComponent as λ3, SkyModalHeaderComponent as λ4, SkyModalComponent as λ5, SkyModalIsDirtyDirective as λ6 };
|
|
1355
1450
|
//# sourceMappingURL=skyux-modals.mjs.map
|