@skyux/modals 8.3.0 → 8.4.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 +170 -137
- package/esm2020/lib/modules/modal/modal-adapter.service.mjs +4 -1
- package/esm2020/lib/modules/modal/modal-host.component.mjs +3 -2
- package/esm2020/lib/modules/modal/modal-instance.mjs +29 -4
- package/fesm2015/skyux-modals.mjs +32 -3
- package/fesm2015/skyux-modals.mjs.map +1 -1
- package/fesm2020/skyux-modals.mjs +32 -3
- package/fesm2020/skyux-modals.mjs.map +1 -1
- package/lib/modules/modal/modal-adapter.service.d.ts +1 -0
- package/lib/modules/modal/modal-instance.d.ts +16 -0
- package/package.json +5 -5
|
@@ -179,6 +179,9 @@ class SkyModalAdapterService {
|
|
|
179
179
|
getModalOpener() {
|
|
180
180
|
return __classPrivateFieldGet(this, _SkyModalAdapterService_docRef, "f").activeElement;
|
|
181
181
|
}
|
|
182
|
+
scrollContentToTop(element) {
|
|
183
|
+
element.nativeElement.querySelector('.sky-modal-content').scrollTop = 0;
|
|
184
|
+
}
|
|
182
185
|
/**
|
|
183
186
|
* Hides siblings of modal-host from screen readers
|
|
184
187
|
* @param hostElRef reference to modal-host element
|
|
@@ -412,7 +415,8 @@ class SkyModalHostComponent {
|
|
|
412
415
|
const modalComponentRef = this.target.createComponent(factory, undefined, injector);
|
|
413
416
|
// modal element that was just opened
|
|
414
417
|
const modalElement = modalComponentRef.location;
|
|
415
|
-
modalInstance.
|
|
418
|
+
modalInstance.adapter = __classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f");
|
|
419
|
+
modalInstance.componentRef = modalComponentRef;
|
|
416
420
|
__classPrivateFieldGet(this, _SkyModalHostComponent_instances, "m", _SkyModalHostComponent_registerModalInstance).call(this, modalInstance);
|
|
417
421
|
// hiding all elements at the modal-host level from screen readers when the a modal is opened
|
|
418
422
|
__classPrivateFieldGet(this, _SkyModalHostComponent_adapter, "f").hideHostSiblingsFromScreenReaders(__classPrivateFieldGet(this, _SkyModalHostComponent_elRef, "f"));
|
|
@@ -507,13 +511,15 @@ class SkyModalBeforeCloseHandler {
|
|
|
507
511
|
class SkyModalCloseArgs {
|
|
508
512
|
}
|
|
509
513
|
|
|
510
|
-
var _SkyModalInstance_instances, _SkyModalInstance__beforeClose, _SkyModalInstance__closed, _SkyModalInstance__helpOpened, _SkyModalInstance_closeModal, _SkyModalInstance_notifyClosed;
|
|
514
|
+
var _SkyModalInstance_instances, _SkyModalInstance__beforeClose, _SkyModalInstance__closed, _SkyModalInstance__helpOpened, _SkyModalInstance_adapter, _SkyModalInstance_elementRef, _SkyModalInstance_closeModal, _SkyModalInstance_notifyClosed;
|
|
511
515
|
class SkyModalInstance {
|
|
512
516
|
constructor() {
|
|
513
517
|
_SkyModalInstance_instances.add(this);
|
|
514
518
|
_SkyModalInstance__beforeClose.set(this, new Subject());
|
|
515
519
|
_SkyModalInstance__closed.set(this, new Subject());
|
|
516
520
|
_SkyModalInstance__helpOpened.set(this, new Subject());
|
|
521
|
+
_SkyModalInstance_adapter.set(this, void 0);
|
|
522
|
+
_SkyModalInstance_elementRef.set(this, void 0);
|
|
517
523
|
}
|
|
518
524
|
/**
|
|
519
525
|
* An event that the modal instance emits when it is about to close.
|
|
@@ -543,6 +549,21 @@ class SkyModalInstance {
|
|
|
543
549
|
get helpOpened() {
|
|
544
550
|
return __classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f");
|
|
545
551
|
}
|
|
552
|
+
/**
|
|
553
|
+
* Sets the component adapter for the instance. This is used internally for actions such as scrolling the content.
|
|
554
|
+
* @internal
|
|
555
|
+
*/
|
|
556
|
+
set adapter(value) {
|
|
557
|
+
__classPrivateFieldSet(this, _SkyModalInstance_adapter, value, "f");
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Sets the component ref for the instance. This is used to extract the component instance for the public API and the element ref for internal use.
|
|
561
|
+
* @internal
|
|
562
|
+
*/
|
|
563
|
+
set componentRef(value) {
|
|
564
|
+
this.componentInstance = value.instance;
|
|
565
|
+
__classPrivateFieldSet(this, _SkyModalInstance_elementRef, value.location, "f");
|
|
566
|
+
}
|
|
546
567
|
/**
|
|
547
568
|
* Closes the modal instance.
|
|
548
569
|
* @param result Specifies an object to emit to subscribers of the `closed` event of the
|
|
@@ -575,6 +596,14 @@ class SkyModalInstance {
|
|
|
575
596
|
save(result) {
|
|
576
597
|
__classPrivateFieldGet(this, _SkyModalInstance_instances, "m", _SkyModalInstance_closeModal).call(this, 'save', result);
|
|
577
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* Scrolls the modal content area to the top of its scrollable area.
|
|
601
|
+
*/
|
|
602
|
+
scrollContentToTop() {
|
|
603
|
+
if (__classPrivateFieldGet(this, _SkyModalInstance_adapter, "f") && __classPrivateFieldGet(this, _SkyModalInstance_elementRef, "f")) {
|
|
604
|
+
__classPrivateFieldGet(this, _SkyModalInstance_adapter, "f").scrollContentToTop(__classPrivateFieldGet(this, _SkyModalInstance_elementRef, "f"));
|
|
605
|
+
}
|
|
606
|
+
}
|
|
578
607
|
/**
|
|
579
608
|
* Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open
|
|
580
609
|
* when users click the <i class="fa fa-question-circle" aria-hidden="true"></i> button.
|
|
@@ -586,7 +615,7 @@ class SkyModalInstance {
|
|
|
586
615
|
__classPrivateFieldGet(this, _SkyModalInstance__helpOpened, "f").next(helpKey);
|
|
587
616
|
}
|
|
588
617
|
}
|
|
589
|
-
_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) {
|
|
618
|
+
_SkyModalInstance__beforeClose = new WeakMap(), _SkyModalInstance__closed = new WeakMap(), _SkyModalInstance__helpOpened = new WeakMap(), _SkyModalInstance_adapter = new WeakMap(), _SkyModalInstance_elementRef = new WeakMap(), _SkyModalInstance_instances = new WeakSet(), _SkyModalInstance_closeModal = function _SkyModalInstance_closeModal(type, result, ignoreBeforeClose = false) {
|
|
590
619
|
const args = new SkyModalCloseArgs();
|
|
591
620
|
args.reason = type;
|
|
592
621
|
args.data = result;
|