@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.
@@ -1271,18 +1271,11 @@
1271
1271
  isSticky: true,
1272
1272
  placement: parseAffixPlacement(_this.placement),
1273
1273
  };
1274
- // Ensure that we are positioning the vertical alginment correctly. These
1275
- // are the default alignments for all popovers but ensure that we are future proof here.
1274
+ // Ensure vertical alignment is set according to the popover's placement value.
1276
1275
  if (affixOptions.placement === 'left' ||
1277
1276
  affixOptions.placement === 'right') {
1278
1277
  affixOptions.verticalAlignment = 'middle';
1279
1278
  }
1280
- else if (affixOptions.placement === 'above') {
1281
- affixOptions.verticalAlignment = 'bottom';
1282
- }
1283
- else {
1284
- affixOptions.verticalAlignment = 'top';
1285
- }
1286
1279
  _this.affixer.affixTo(_this.caller.nativeElement, affixOptions);
1287
1280
  _this.updateArrowOffset();
1288
1281
  _this.isOpen = true;
@@ -1443,8 +1436,7 @@
1443
1436
  },
1444
1437
  /**
1445
1438
  * Specifies the horizontal alignment of the popover in relation to the trigger element.
1446
- * The `skyPopoverAlignment` property on the popover directive overwrites this property.
1447
- * Options include:`"center"`, `"right"`, and `'"left"`.
1439
+ * The `skyPopoverAlignment` property on the popover directive takes precedence over this property when specified.
1448
1440
  * @default "center"
1449
1441
  */
1450
1442
  set: function (value) {
@@ -1477,8 +1469,7 @@
1477
1469
  },
1478
1470
  /**
1479
1471
  * Specifies the placement of the popover in relation to the trigger element.
1480
- * The `skyPopoverPlacement` property on the popover directive overwrites this property.
1481
- * Options include:`"above"`, `"below"`, `"right"`, and `"left"`.
1472
+ * The `skyPopoverPlacement` property on the popover directive takes precedence over this property when specified.
1482
1473
  * @default "above"
1483
1474
  */
1484
1475
  set: function (value) {
@@ -1620,6 +1611,324 @@
1620
1611
  }]
1621
1612
  }] } });
1622
1613
 
1614
+ /*! *****************************************************************************
1615
+ Copyright (c) Microsoft Corporation.
1616
+
1617
+ Permission to use, copy, modify, and/or distribute this software for any
1618
+ purpose with or without fee is hereby granted.
1619
+
1620
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1621
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1622
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1623
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1624
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1625
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1626
+ PERFORMANCE OF THIS SOFTWARE.
1627
+ ***************************************************************************** */
1628
+ /* global Reflect, Promise */
1629
+ var extendStatics = function (d, b) {
1630
+ extendStatics = Object.setPrototypeOf ||
1631
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1632
+ function (d, b) { for (var p in b)
1633
+ if (Object.prototype.hasOwnProperty.call(b, p))
1634
+ d[p] = b[p]; };
1635
+ return extendStatics(d, b);
1636
+ };
1637
+ function __extends(d, b) {
1638
+ if (typeof b !== "function" && b !== null)
1639
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1640
+ extendStatics(d, b);
1641
+ function __() { this.constructor = d; }
1642
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1643
+ }
1644
+ var __assign = function () {
1645
+ __assign = Object.assign || function __assign(t) {
1646
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1647
+ s = arguments[i];
1648
+ for (var p in s)
1649
+ if (Object.prototype.hasOwnProperty.call(s, p))
1650
+ t[p] = s[p];
1651
+ }
1652
+ return t;
1653
+ };
1654
+ return __assign.apply(this, arguments);
1655
+ };
1656
+ function __rest(s, e) {
1657
+ var t = {};
1658
+ for (var p in s)
1659
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1660
+ t[p] = s[p];
1661
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1662
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1663
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1664
+ t[p[i]] = s[p[i]];
1665
+ }
1666
+ return t;
1667
+ }
1668
+ function __decorate(decorators, target, key, desc) {
1669
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1670
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1671
+ r = Reflect.decorate(decorators, target, key, desc);
1672
+ else
1673
+ for (var i = decorators.length - 1; i >= 0; i--)
1674
+ if (d = decorators[i])
1675
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1676
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1677
+ }
1678
+ function __param(paramIndex, decorator) {
1679
+ return function (target, key) { decorator(target, key, paramIndex); };
1680
+ }
1681
+ function __metadata(metadataKey, metadataValue) {
1682
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1683
+ return Reflect.metadata(metadataKey, metadataValue);
1684
+ }
1685
+ function __awaiter(thisArg, _arguments, P, generator) {
1686
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1687
+ return new (P || (P = Promise))(function (resolve, reject) {
1688
+ function fulfilled(value) { try {
1689
+ step(generator.next(value));
1690
+ }
1691
+ catch (e) {
1692
+ reject(e);
1693
+ } }
1694
+ function rejected(value) { try {
1695
+ step(generator["throw"](value));
1696
+ }
1697
+ catch (e) {
1698
+ reject(e);
1699
+ } }
1700
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1701
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1702
+ });
1703
+ }
1704
+ function __generator(thisArg, body) {
1705
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
1706
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1707
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
1708
+ function verb(n) { return function (v) { return step([n, v]); }; }
1709
+ function step(op) {
1710
+ if (f)
1711
+ throw new TypeError("Generator is already executing.");
1712
+ while (_)
1713
+ try {
1714
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
1715
+ return t;
1716
+ if (y = 0, t)
1717
+ op = [op[0] & 2, t.value];
1718
+ switch (op[0]) {
1719
+ case 0:
1720
+ case 1:
1721
+ t = op;
1722
+ break;
1723
+ case 4:
1724
+ _.label++;
1725
+ return { value: op[1], done: false };
1726
+ case 5:
1727
+ _.label++;
1728
+ y = op[1];
1729
+ op = [0];
1730
+ continue;
1731
+ case 7:
1732
+ op = _.ops.pop();
1733
+ _.trys.pop();
1734
+ continue;
1735
+ default:
1736
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1737
+ _ = 0;
1738
+ continue;
1739
+ }
1740
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
1741
+ _.label = op[1];
1742
+ break;
1743
+ }
1744
+ if (op[0] === 6 && _.label < t[1]) {
1745
+ _.label = t[1];
1746
+ t = op;
1747
+ break;
1748
+ }
1749
+ if (t && _.label < t[2]) {
1750
+ _.label = t[2];
1751
+ _.ops.push(op);
1752
+ break;
1753
+ }
1754
+ if (t[2])
1755
+ _.ops.pop();
1756
+ _.trys.pop();
1757
+ continue;
1758
+ }
1759
+ op = body.call(thisArg, _);
1760
+ }
1761
+ catch (e) {
1762
+ op = [6, e];
1763
+ y = 0;
1764
+ }
1765
+ finally {
1766
+ f = t = 0;
1767
+ }
1768
+ if (op[0] & 5)
1769
+ throw op[1];
1770
+ return { value: op[0] ? op[1] : void 0, done: true };
1771
+ }
1772
+ }
1773
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
1774
+ if (k2 === undefined)
1775
+ k2 = k;
1776
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
1777
+ }) : (function (o, m, k, k2) {
1778
+ if (k2 === undefined)
1779
+ k2 = k;
1780
+ o[k2] = m[k];
1781
+ });
1782
+ function __exportStar(m, o) {
1783
+ for (var p in m)
1784
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
1785
+ __createBinding(o, m, p);
1786
+ }
1787
+ function __values(o) {
1788
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1789
+ if (m)
1790
+ return m.call(o);
1791
+ if (o && typeof o.length === "number")
1792
+ return {
1793
+ next: function () {
1794
+ if (o && i >= o.length)
1795
+ o = void 0;
1796
+ return { value: o && o[i++], done: !o };
1797
+ }
1798
+ };
1799
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1800
+ }
1801
+ function __read(o, n) {
1802
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1803
+ if (!m)
1804
+ return o;
1805
+ var i = m.call(o), r, ar = [], e;
1806
+ try {
1807
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
1808
+ ar.push(r.value);
1809
+ }
1810
+ catch (error) {
1811
+ e = { error: error };
1812
+ }
1813
+ finally {
1814
+ try {
1815
+ if (r && !r.done && (m = i["return"]))
1816
+ m.call(i);
1817
+ }
1818
+ finally {
1819
+ if (e)
1820
+ throw e.error;
1821
+ }
1822
+ }
1823
+ return ar;
1824
+ }
1825
+ /** @deprecated */
1826
+ function __spread() {
1827
+ for (var ar = [], i = 0; i < arguments.length; i++)
1828
+ ar = ar.concat(__read(arguments[i]));
1829
+ return ar;
1830
+ }
1831
+ /** @deprecated */
1832
+ function __spreadArrays() {
1833
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
1834
+ s += arguments[i].length;
1835
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
1836
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
1837
+ r[k] = a[j];
1838
+ return r;
1839
+ }
1840
+ function __spreadArray(to, from, pack) {
1841
+ if (pack || arguments.length === 2)
1842
+ for (var i = 0, l = from.length, ar; i < l; i++) {
1843
+ if (ar || !(i in from)) {
1844
+ if (!ar)
1845
+ ar = Array.prototype.slice.call(from, 0, i);
1846
+ ar[i] = from[i];
1847
+ }
1848
+ }
1849
+ return to.concat(ar || Array.prototype.slice.call(from));
1850
+ }
1851
+ function __await(v) {
1852
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
1853
+ }
1854
+ function __asyncGenerator(thisArg, _arguments, generator) {
1855
+ if (!Symbol.asyncIterator)
1856
+ throw new TypeError("Symbol.asyncIterator is not defined.");
1857
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
1858
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
1859
+ function verb(n) { if (g[n])
1860
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
1861
+ function resume(n, v) { try {
1862
+ step(g[n](v));
1863
+ }
1864
+ catch (e) {
1865
+ settle(q[0][3], e);
1866
+ } }
1867
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
1868
+ function fulfill(value) { resume("next", value); }
1869
+ function reject(value) { resume("throw", value); }
1870
+ function settle(f, v) { if (f(v), q.shift(), q.length)
1871
+ resume(q[0][0], q[0][1]); }
1872
+ }
1873
+ function __asyncDelegator(o) {
1874
+ var i, p;
1875
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
1876
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
1877
+ }
1878
+ function __asyncValues(o) {
1879
+ if (!Symbol.asyncIterator)
1880
+ throw new TypeError("Symbol.asyncIterator is not defined.");
1881
+ var m = o[Symbol.asyncIterator], i;
1882
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
1883
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
1884
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
1885
+ }
1886
+ function __makeTemplateObject(cooked, raw) {
1887
+ if (Object.defineProperty) {
1888
+ Object.defineProperty(cooked, "raw", { value: raw });
1889
+ }
1890
+ else {
1891
+ cooked.raw = raw;
1892
+ }
1893
+ return cooked;
1894
+ }
1895
+ ;
1896
+ var __setModuleDefault = Object.create ? (function (o, v) {
1897
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1898
+ }) : function (o, v) {
1899
+ o["default"] = v;
1900
+ };
1901
+ function __importStar(mod) {
1902
+ if (mod && mod.__esModule)
1903
+ return mod;
1904
+ var result = {};
1905
+ if (mod != null)
1906
+ for (var k in mod)
1907
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
1908
+ __createBinding(result, mod, k);
1909
+ __setModuleDefault(result, mod);
1910
+ return result;
1911
+ }
1912
+ function __importDefault(mod) {
1913
+ return (mod && mod.__esModule) ? mod : { default: mod };
1914
+ }
1915
+ function __classPrivateFieldGet(receiver, state, kind, f) {
1916
+ if (kind === "a" && !f)
1917
+ throw new TypeError("Private accessor was defined without a getter");
1918
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1919
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
1920
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1921
+ }
1922
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
1923
+ if (kind === "m")
1924
+ throw new TypeError("Private method is not writable");
1925
+ if (kind === "a" && !f)
1926
+ throw new TypeError("Private accessor was defined without a setter");
1927
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1928
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
1929
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1930
+ }
1931
+
1623
1932
  /**
1624
1933
  * Specifies the type of message to send to the popover component.
1625
1934
  */
@@ -1644,15 +1953,29 @@
1644
1953
  SkyPopoverMessageType[SkyPopoverMessageType["Focus"] = 3] = "Focus";
1645
1954
  })(exports.SkyPopoverMessageType || (exports.SkyPopoverMessageType = {}));
1646
1955
 
1956
+ var _SkyPopoverDirective_messageStreamSub;
1647
1957
  var SkyPopoverDirective = /** @class */ (function () {
1648
1958
  function SkyPopoverDirective(elementRef) {
1649
1959
  this.elementRef = elementRef;
1650
- /**
1651
- * Provides an observable to send commands to the popover that respect the `SkyPopoverMessage` type.
1652
- */
1653
- this.skyPopoverMessageStream = new rxjs.Subject();
1960
+ this._skyPopoverMessageStream = new rxjs.Subject();
1961
+ _SkyPopoverDirective_messageStreamSub.set(this, void 0);
1654
1962
  this.ngUnsubscribe = new rxjs.Subject();
1963
+ this.subscribeMessageStream();
1655
1964
  }
1965
+ Object.defineProperty(SkyPopoverDirective.prototype, "skyPopoverMessageStream", {
1966
+ get: function () {
1967
+ return this._skyPopoverMessageStream;
1968
+ },
1969
+ /**
1970
+ * Provides an RxJS `Subject` to send commands to the popover that respect the `SkyPopoverMessage` type.
1971
+ */
1972
+ set: function (value) {
1973
+ this._skyPopoverMessageStream = value !== null && value !== void 0 ? value : new rxjs.Subject();
1974
+ this.subscribeMessageStream();
1975
+ },
1976
+ enumerable: false,
1977
+ configurable: true
1978
+ });
1656
1979
  Object.defineProperty(SkyPopoverDirective.prototype, "skyPopoverTrigger", {
1657
1980
  get: function () {
1658
1981
  return this._trigger || 'click';
@@ -1671,6 +1994,7 @@
1671
1994
  };
1672
1995
  SkyPopoverDirective.prototype.ngOnDestroy = function () {
1673
1996
  this.removeEventListeners();
1997
+ this.unsubscribeMessageStream();
1674
1998
  };
1675
1999
  SkyPopoverDirective.prototype.togglePopover = function () {
1676
2000
  if (this.skyPopover.isActive) {
@@ -1696,11 +2020,6 @@
1696
2020
  SkyPopoverDirective.prototype.addEventListeners = function () {
1697
2021
  var _this = this;
1698
2022
  var element = this.elementRef.nativeElement;
1699
- this.skyPopoverMessageStream
1700
- .pipe(operators.takeUntil(this.ngUnsubscribe))
1701
- .subscribe(function (message) {
1702
- _this.handleIncomingMessages(message);
1703
- });
1704
2023
  rxjs.fromEvent(element, 'keydown')
1705
2024
  .pipe(operators.takeUntil(this.ngUnsubscribe))
1706
2025
  .subscribe(function (event) {
@@ -1799,8 +2118,22 @@
1799
2118
  SkyPopoverDirective.prototype.sendMessage = function (messageType) {
1800
2119
  this.skyPopoverMessageStream.next({ type: messageType });
1801
2120
  };
2121
+ SkyPopoverDirective.prototype.subscribeMessageStream = function () {
2122
+ var _this = this;
2123
+ this.unsubscribeMessageStream();
2124
+ __classPrivateFieldSet(this, _SkyPopoverDirective_messageStreamSub, this.skyPopoverMessageStream.subscribe(function (message) {
2125
+ _this.handleIncomingMessages(message);
2126
+ }), "f");
2127
+ };
2128
+ SkyPopoverDirective.prototype.unsubscribeMessageStream = function () {
2129
+ if (__classPrivateFieldGet(this, _SkyPopoverDirective_messageStreamSub, "f")) {
2130
+ __classPrivateFieldGet(this, _SkyPopoverDirective_messageStreamSub, "f").unsubscribe();
2131
+ __classPrivateFieldSet(this, _SkyPopoverDirective_messageStreamSub, undefined, "f");
2132
+ }
2133
+ };
1802
2134
  return SkyPopoverDirective;
1803
2135
  }());
2136
+ _SkyPopoverDirective_messageStreamSub = new WeakMap();
1804
2137
  SkyPopoverDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyPopoverDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1805
2138
  SkyPopoverDirective.ɵdir = i0__namespace.ɵɵ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__namespace });
1806
2139
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyPopoverDirective, decorators: [{