@skyux/popovers 5.8.4 → 5.9.2

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.
@@ -13,6 +13,7 @@ import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } fro
13
13
  import { Subject, fromEvent } from 'rxjs';
14
14
  import { takeUntil } from 'rxjs/operators';
15
15
  import { trigger, state, style, transition, animate } from '@angular/animations';
16
+ import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
16
17
 
17
18
  /**
18
19
  * Specifies the type of message to send.
@@ -1151,18 +1152,11 @@ class SkyPopoverContentComponent {
1151
1152
  isSticky: true,
1152
1153
  placement: parseAffixPlacement(this.placement),
1153
1154
  };
1154
- // Ensure that we are positioning the vertical alginment correctly. These
1155
- // are the default alignments for all popovers but ensure that we are future proof here.
1155
+ // Ensure vertical alignment is set according to the popover's placement value.
1156
1156
  if (affixOptions.placement === 'left' ||
1157
1157
  affixOptions.placement === 'right') {
1158
1158
  affixOptions.verticalAlignment = 'middle';
1159
1159
  }
1160
- else if (affixOptions.placement === 'above') {
1161
- affixOptions.verticalAlignment = 'bottom';
1162
- }
1163
- else {
1164
- affixOptions.verticalAlignment = 'top';
1165
- }
1166
1160
  this.affixer.affixTo(this.caller.nativeElement, affixOptions);
1167
1161
  this.updateArrowOffset();
1168
1162
  this.isOpen = true;
@@ -1314,8 +1308,7 @@ class SkyPopoverComponent {
1314
1308
  }
1315
1309
  /**
1316
1310
  * Specifies the horizontal alignment of the popover in relation to the trigger element.
1317
- * The `skyPopoverAlignment` property on the popover directive overwrites this property.
1318
- * Options include:`"center"`, `"right"`, and `'"left"`.
1311
+ * The `skyPopoverAlignment` property on the popover directive takes precedence over this property when specified.
1319
1312
  * @default "center"
1320
1313
  */
1321
1314
  set alignment(value) {
@@ -1340,8 +1333,7 @@ class SkyPopoverComponent {
1340
1333
  }
1341
1334
  /**
1342
1335
  * Specifies the placement of the popover in relation to the trigger element.
1343
- * The `skyPopoverPlacement` property on the popover directive overwrites this property.
1344
- * Options include:`"above"`, `"below"`, `"right"`, and `"left"`.
1336
+ * The `skyPopoverPlacement` property on the popover directive takes precedence over this property when specified.
1345
1337
  * @default "above"
1346
1338
  */
1347
1339
  set placement(value) {
@@ -1505,14 +1497,24 @@ var SkyPopoverMessageType;
1505
1497
  SkyPopoverMessageType[SkyPopoverMessageType["Focus"] = 3] = "Focus";
1506
1498
  })(SkyPopoverMessageType || (SkyPopoverMessageType = {}));
1507
1499
 
1500
+ var _SkyPopoverDirective_messageStreamSub;
1508
1501
  class SkyPopoverDirective {
1509
1502
  constructor(elementRef) {
1510
1503
  this.elementRef = elementRef;
1511
- /**
1512
- * Provides an observable to send commands to the popover that respect the `SkyPopoverMessage` type.
1513
- */
1514
- this.skyPopoverMessageStream = new Subject();
1504
+ this._skyPopoverMessageStream = new Subject();
1505
+ _SkyPopoverDirective_messageStreamSub.set(this, void 0);
1515
1506
  this.ngUnsubscribe = new Subject();
1507
+ this.subscribeMessageStream();
1508
+ }
1509
+ /**
1510
+ * Provides an RxJS `Subject` to send commands to the popover that respect the `SkyPopoverMessage` type.
1511
+ */
1512
+ set skyPopoverMessageStream(value) {
1513
+ this._skyPopoverMessageStream = value !== null && value !== void 0 ? value : new Subject();
1514
+ this.subscribeMessageStream();
1515
+ }
1516
+ get skyPopoverMessageStream() {
1517
+ return this._skyPopoverMessageStream;
1516
1518
  }
1517
1519
  /**
1518
1520
  * Specifies the user action that displays the popover.
@@ -1528,6 +1530,7 @@ class SkyPopoverDirective {
1528
1530
  }
1529
1531
  ngOnDestroy() {
1530
1532
  this.removeEventListeners();
1533
+ this.unsubscribeMessageStream();
1531
1534
  }
1532
1535
  togglePopover() {
1533
1536
  if (this.skyPopover.isActive) {
@@ -1552,11 +1555,6 @@ class SkyPopoverDirective {
1552
1555
  }
1553
1556
  addEventListeners() {
1554
1557
  const element = this.elementRef.nativeElement;
1555
- this.skyPopoverMessageStream
1556
- .pipe(takeUntil(this.ngUnsubscribe))
1557
- .subscribe((message) => {
1558
- this.handleIncomingMessages(message);
1559
- });
1560
1558
  fromEvent(element, 'keydown')
1561
1559
  .pipe(takeUntil(this.ngUnsubscribe))
1562
1560
  .subscribe((event) => {
@@ -1655,7 +1653,20 @@ class SkyPopoverDirective {
1655
1653
  sendMessage(messageType) {
1656
1654
  this.skyPopoverMessageStream.next({ type: messageType });
1657
1655
  }
1656
+ subscribeMessageStream() {
1657
+ this.unsubscribeMessageStream();
1658
+ __classPrivateFieldSet(this, _SkyPopoverDirective_messageStreamSub, this.skyPopoverMessageStream.subscribe((message) => {
1659
+ this.handleIncomingMessages(message);
1660
+ }), "f");
1661
+ }
1662
+ unsubscribeMessageStream() {
1663
+ if (__classPrivateFieldGet(this, _SkyPopoverDirective_messageStreamSub, "f")) {
1664
+ __classPrivateFieldGet(this, _SkyPopoverDirective_messageStreamSub, "f").unsubscribe();
1665
+ __classPrivateFieldSet(this, _SkyPopoverDirective_messageStreamSub, undefined, "f");
1666
+ }
1667
+ }
1658
1668
  }
1669
+ _SkyPopoverDirective_messageStreamSub = new WeakMap();
1659
1670
  SkyPopoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyPopoverDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1660
1671
  SkyPopoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyPopoverDirective, selector: "[skyPopover]", inputs: { skyPopover: "skyPopover", skyPopoverAlignment: "skyPopoverAlignment", skyPopoverMessageStream: "skyPopoverMessageStream", skyPopoverPlacement: "skyPopoverPlacement", skyPopoverTrigger: "skyPopoverTrigger" }, ngImport: i0 });
1661
1672
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyPopoverDirective, decorators: [{