@skyux/core 5.6.0 → 5.7.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.
Files changed (27) hide show
  1. package/bundles/skyux-core.umd.js +63 -41
  2. package/documentation.json +499 -954
  3. package/esm2015/lib/modules/affix/affixer.js.map +1 -1
  4. package/esm2015/lib/modules/dock/dock.service.js +18 -15
  5. package/esm2015/lib/modules/dock/dock.service.js.map +1 -1
  6. package/esm2015/lib/modules/log/log.service.js +1 -0
  7. package/esm2015/lib/modules/log/log.service.js.map +1 -1
  8. package/esm2015/lib/modules/numeric/numeric.options.js +1 -1
  9. package/esm2015/lib/modules/numeric/numeric.options.js.map +1 -1
  10. package/esm2015/lib/modules/numeric/numeric.service.js +4 -3
  11. package/esm2015/lib/modules/numeric/numeric.service.js.map +1 -1
  12. package/esm2015/lib/modules/scrollable-host/scrollable-host.service.js +35 -14
  13. package/esm2015/lib/modules/scrollable-host/scrollable-host.service.js.map +1 -1
  14. package/esm2015/lib/modules/shared/number-format/number-format-utility.js +0 -2
  15. package/esm2015/lib/modules/shared/number-format/number-format-utility.js.map +1 -1
  16. package/esm2015/lib/modules/shared/sky-core-resources.module.js +1 -1
  17. package/esm2015/lib/modules/shared/sky-core-resources.module.js.map +1 -1
  18. package/esm2015/lib/modules/viewkeeper/viewkeeper.js +3 -6
  19. package/esm2015/lib/modules/viewkeeper/viewkeeper.js.map +1 -1
  20. package/fesm2015/skyux-core.js +63 -42
  21. package/fesm2015/skyux-core.js.map +1 -1
  22. package/lib/modules/dock/dock.service.d.ts +2 -2
  23. package/lib/modules/numeric/numeric.options.d.ts +1 -1
  24. package/lib/modules/scrollable-host/scrollable-host.service.d.ts +2 -1
  25. package/lib/modules/shared/number-format/number-format-utility.d.ts +0 -1
  26. package/lib/modules/shared/sky-core-resources.module.d.ts +1 -1
  27. package/package.json +11 -10
@@ -1304,14 +1304,13 @@
1304
1304
  var SkyDockService = /** @class */ (function () {
1305
1305
  function SkyDockService(dynamicComponentService) {
1306
1306
  this.dynamicComponentService = dynamicComponentService;
1307
- this._items = [];
1308
1307
  }
1309
1308
  Object.defineProperty(SkyDockService.prototype, "items", {
1310
1309
  /**
1311
1310
  * Returns all docked items.
1312
1311
  */
1313
1312
  get: function () {
1314
- return this._items;
1313
+ return SkyDockService._items;
1315
1314
  },
1316
1315
  enumerable: false,
1317
1316
  configurable: true
@@ -1323,20 +1322,20 @@
1323
1322
  */
1324
1323
  SkyDockService.prototype.insertComponent = function (component, config) {
1325
1324
  var _this = this;
1326
- if (!this.dockRef) {
1325
+ if (!SkyDockService.dockRef) {
1327
1326
  this.createDock();
1328
1327
  }
1329
- var itemRef = this.dockRef.instance.insertComponent(component, config);
1328
+ var itemRef = SkyDockService.dockRef.instance.insertComponent(component, config);
1330
1329
  var item = new SkyDockItem(itemRef.componentRef.instance, itemRef.stackOrder);
1331
1330
  item.destroyed.subscribe(function () {
1332
- _this.dockRef.instance.removeItem(itemRef);
1333
- _this._items.splice(_this._items.indexOf(item), 1);
1334
- if (_this._items.length === 0) {
1331
+ SkyDockService.dockRef.instance.removeItem(itemRef);
1332
+ SkyDockService._items.splice(SkyDockService._items.indexOf(item), 1);
1333
+ if (SkyDockService._items.length === 0) {
1335
1334
  _this.destroyDock();
1336
1335
  }
1337
1336
  });
1338
- this._items.push(item);
1339
- this._items.sort(sortByStackOrder);
1337
+ SkyDockService._items.push(item);
1338
+ SkyDockService._items.sort(sortByStackOrder);
1340
1339
  return item;
1341
1340
  };
1342
1341
  /**
@@ -1369,21 +1368,25 @@
1369
1368
  referenceEl: this.options.referenceEl,
1370
1369
  };
1371
1370
  }
1372
- this.dockRef = this.dynamicComponentService.createComponent(SkyDockComponent, dockOptions);
1373
- this.dockRef.instance.setOptions(this.options);
1371
+ SkyDockService.dockRef = this.dynamicComponentService.createComponent(SkyDockComponent, dockOptions);
1372
+ SkyDockService.dockRef.instance.setOptions(this.options);
1374
1373
  };
1375
1374
  SkyDockService.prototype.destroyDock = function () {
1376
- this.dynamicComponentService.removeComponent(this.dockRef);
1377
- this.dockRef = undefined;
1375
+ this.dynamicComponentService.removeComponent(SkyDockService.dockRef);
1376
+ SkyDockService.dockRef = undefined;
1378
1377
  };
1379
1378
  return SkyDockService;
1380
1379
  }());
1380
+ SkyDockService._items = [];
1381
1381
  SkyDockService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyDockService, deps: [{ token: SkyDynamicComponentService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1382
- SkyDockService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyDockService, providedIn: 'root' });
1382
+ SkyDockService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyDockService, providedIn: 'any' });
1383
1383
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyDockService, decorators: [{
1384
1384
  type: i0.Injectable,
1385
1385
  args: [{
1386
- providedIn: 'root',
1386
+ // Must be 'any' so that the dock component is created in the context of its module's injector.
1387
+ // If set to 'root', the component's dependency injections would only be derived from the root
1388
+ // injector and may loose context if the dock was opened from within a lazy-loaded module.
1389
+ providedIn: 'any',
1387
1390
  }]
1388
1391
  }], ctorParameters: function () { return [{ type: SkyDynamicComponentService }]; } });
1389
1392
 
@@ -1511,6 +1514,7 @@
1511
1514
  }
1512
1515
  /*istanbul ignore else */
1513
1516
  if (window.console) {
1517
+ // eslint-disable-next-line prefer-spread,prefer-rest-params
1514
1518
  window.console.warn.apply(window.console, arguments);
1515
1519
  }
1516
1520
  };
@@ -1668,7 +1672,7 @@
1668
1672
  /**
1669
1673
  * NOTICE: DO NOT MODIFY THIS FILE!
1670
1674
  * The contents of this file were automatically generated by
1671
- * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-core' schematic.
1675
+ * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-core' schematic.
1672
1676
  * To update this file, simply rerun the command.
1673
1677
  */
1674
1678
  var RESOURCES = {
@@ -1747,7 +1751,7 @@
1747
1751
  this.iso = 'USD';
1748
1752
  /**
1749
1753
  * Indicates whether to shorten numbers to rounded numbers and abbreviation characters
1750
- * such as K for thousands, M for millions, B for billions, and T for trillion.
1754
+ * such as K for thousands, M for millions, B for billions, and T for trillions.
1751
1755
  */
1752
1756
  this.truncate = true;
1753
1757
  /**
@@ -2094,7 +2098,6 @@
2094
2098
  // See: https://github.com/ng-packagr/ng-packagr/issues/641
2095
2099
  // @dynamic
2096
2100
  var SkyNumberFormatUtility = /** @class */ (function () {
2097
- /* istanbul ignore next */
2098
2101
  function SkyNumberFormatUtility() {
2099
2102
  }
2100
2103
  SkyNumberFormatUtility.formatNumber = function (locale, value, style, digits, currency, currencyAsSymbol, currencySign) {
@@ -2211,6 +2214,7 @@
2211
2214
  this.storeShortenSymbol(output);
2212
2215
  var locale = options.locale || this.currentLocale;
2213
2216
  var digits;
2217
+ var isDecimal;
2214
2218
  // Checks the string entered for format. Using toLowerCase to ignore case.
2215
2219
  switch ((_a = options.format) === null || _a === void 0 ? void 0 : _a.toLowerCase()) {
2216
2220
  // In a case where a decimal value was not shortened and
@@ -2219,7 +2223,7 @@
2219
2223
  // Note: This will need to be reviewed if we support currencies with
2220
2224
  // three decimal digits.
2221
2225
  case 'currency':
2222
- var isDecimal = value % 1 !== 0;
2226
+ isDecimal = value % 1 !== 0;
2223
2227
  if (options.minDigits) {
2224
2228
  digits = "1." + options.minDigits + "-" + options.digits;
2225
2229
  }
@@ -2229,12 +2233,12 @@
2229
2233
  else {
2230
2234
  digits = "1.0-" + options.digits;
2231
2235
  }
2236
+ output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), i1.SkyIntlNumberFormatStyle.Currency, digits, options.iso,
2232
2237
  // Angular 5+ needs a string for this parameter, but Angular 4 needs a boolean.
2233
2238
  // To support both versions we can supply 'symbol' which will evaluate truthy for Angular 4
2234
2239
  // and the appropriate string value for Angular 5+.
2235
2240
  // See: https://angular.io/api/common/CurrencyPipe#parameters
2236
- var symbolDisplay = 'symbol';
2237
- output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), i1.SkyIntlNumberFormatStyle.Currency, digits, options.iso, symbolDisplay, options.currencySign);
2241
+ 'symbol', options.currencySign);
2238
2242
  break;
2239
2243
  // The following is a catch-all to ensure that if
2240
2244
  // anything but currency (or a future option) are entered,
@@ -2939,20 +2943,30 @@
2939
2943
  SkyScrollableHostService.prototype.watchScrollableHost = function (elementRef) {
2940
2944
  var _this = this;
2941
2945
  var subscribers = [];
2942
- var mutationObserver;
2946
+ var parentMutationObserver;
2947
+ var documentHiddenElementMutationObserver;
2943
2948
  return new rxjs.Observable(function (subscriber) {
2944
2949
  subscribers.push(subscriber);
2945
2950
  var scrollableHost = _this.findScrollableHost(elementRef.nativeElement);
2946
2951
  if (subscribers.length === 1) {
2947
- mutationObserver = _this.mutationObserverSvc.create(function () {
2952
+ parentMutationObserver = _this.mutationObserverSvc.create(function () {
2948
2953
  var newScrollableHost = _this.findScrollableHost(elementRef.nativeElement);
2949
- if (newScrollableHost !== scrollableHost) {
2954
+ if (newScrollableHost !== scrollableHost &&
2955
+ elementRef.nativeElement.offsetParent) {
2950
2956
  scrollableHost = newScrollableHost;
2951
- _this.observeForScrollableHostChanges(scrollableHost, mutationObserver);
2957
+ _this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
2958
+ notifySubscribers(subscribers, scrollableHost);
2959
+ }
2960
+ });
2961
+ _this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
2962
+ documentHiddenElementMutationObserver = _this.mutationObserverSvc.create(function () {
2963
+ if (!elementRef.nativeElement.offsetParent) {
2964
+ scrollableHost = undefined;
2965
+ _this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
2952
2966
  notifySubscribers(subscribers, scrollableHost);
2953
2967
  }
2954
2968
  });
2955
- _this.observeForScrollableHostChanges(scrollableHost, mutationObserver);
2969
+ _this.observeDocumentHiddenElementChanges(documentHiddenElementMutationObserver);
2956
2970
  }
2957
2971
  subscriber.next(scrollableHost);
2958
2972
  subscriber.add(function () {
@@ -2963,7 +2977,8 @@
2963
2977
  subscribers.splice(subIndex, 1);
2964
2978
  }
2965
2979
  if (subscribers.length === 0) {
2966
- mutationObserver.disconnect();
2980
+ documentHiddenElementMutationObserver.disconnect();
2981
+ parentMutationObserver.disconnect();
2967
2982
  }
2968
2983
  });
2969
2984
  });
@@ -2972,7 +2987,7 @@
2972
2987
  * Returns an observable which emits whenever the element's scrollable host emits a scroll event. The observable will always emit the scroll events from the elements current scrollable host and will update based on any scrollable host changes. The observable will also emit once whenever the scrollable host changes.
2973
2988
  * @param elementRef The element whose scrollable host scroll events are being requested
2974
2989
  * @param completionObservable An observable which alerts the internal observers that they should complete
2975
- * @returns An observable which emits the scroll events from the given element's scrollable host
2990
+ * @returns An observable which emits when the elements scrollable host is scrolled or is changed
2976
2991
  */
2977
2992
  SkyScrollableHostService.prototype.watchScrollableHostScrollEvents = function (elementRef) {
2978
2993
  var _this = this;
@@ -2992,11 +3007,13 @@
2992
3007
  }
2993
3008
  scrollableHost = newScrollableHost;
2994
3009
  newScrollableHostObservable = new rxjs.Subject();
2995
- scrollEventSubscription = rxjs.fromEvent(newScrollableHost, 'scroll')
2996
- .pipe(operators.takeUntil(newScrollableHostObservable))
2997
- .subscribe(function () {
2998
- notifySubscribers(subscribers);
2999
- });
3010
+ if (newScrollableHost) {
3011
+ scrollEventSubscription = rxjs.fromEvent(newScrollableHost, 'scroll')
3012
+ .pipe(operators.takeUntil(newScrollableHostObservable))
3013
+ .subscribe(function () {
3014
+ notifySubscribers(subscribers);
3015
+ });
3016
+ }
3000
3017
  });
3001
3018
  }
3002
3019
  subscriber.add(function () {
@@ -3039,12 +3056,20 @@
3039
3056
  }
3040
3057
  return parent;
3041
3058
  };
3059
+ SkyScrollableHostService.prototype.observeDocumentHiddenElementChanges = function (mutationObserver) {
3060
+ mutationObserver.observe(document.documentElement, {
3061
+ attributes: true,
3062
+ attributeFilter: ['class', 'style', 'hidden'],
3063
+ childList: true,
3064
+ subtree: true,
3065
+ });
3066
+ };
3042
3067
  SkyScrollableHostService.prototype.observeForScrollableHostChanges = function (element, mutationObserver) {
3043
3068
  mutationObserver.disconnect();
3044
3069
  if (element instanceof HTMLElement) {
3045
3070
  mutationObserver.observe(element, {
3046
3071
  attributes: true,
3047
- attributeFilter: ['class', 'style.overflow', 'style.overflow-y'],
3072
+ attributeFilter: ['class', 'style'],
3048
3073
  childList: true,
3049
3074
  subtree: true,
3050
3075
  });
@@ -3052,7 +3077,7 @@
3052
3077
  else {
3053
3078
  mutationObserver.observe(document.documentElement, {
3054
3079
  attributes: true,
3055
- attributeFilter: ['class', 'style.overflow', 'style.overflow-y'],
3080
+ attributeFilter: ['class', 'style'],
3056
3081
  childList: true,
3057
3082
  subtree: true,
3058
3083
  });
@@ -3284,25 +3309,22 @@
3284
3309
  };
3285
3310
  SkyViewkeeper.prototype.shouldFixEl = function (boundaryInfo, verticalOffset) {
3286
3311
  var anchorTop;
3287
- var doFixEl;
3288
3312
  if (boundaryInfo.spacerEl) {
3289
3313
  anchorTop = getOffset(boundaryInfo.spacerEl, this.scrollableHost).top;
3290
3314
  }
3291
3315
  else {
3292
3316
  anchorTop = getOffset(this.el, this.scrollableHost).top;
3293
3317
  }
3294
- doFixEl =
3295
- boundaryInfo.scrollTop + verticalOffset + this.viewportMarginTop >
3296
- anchorTop;
3318
+ var doFixEl = boundaryInfo.scrollTop + verticalOffset + this.viewportMarginTop >
3319
+ anchorTop;
3297
3320
  return doFixEl;
3298
3321
  };
3299
3322
  SkyViewkeeper.prototype.getFixedStyles = function (boundaryInfo, verticalOffset) {
3300
- var elFixedTop;
3301
3323
  // If the element needs to be fixed, this will calculate its position. The position
3302
3324
  // will be 0 (fully visible) unless the user is scrolling the boundary out of view.
3303
3325
  // In that case, the element should begin to scroll out of view with the
3304
3326
  // rest of the boundary by setting its top position to a negative value.
3305
- elFixedTop = Math.min(boundaryInfo.boundaryBottom -
3327
+ var elFixedTop = Math.min(boundaryInfo.boundaryBottom -
3306
3328
  boundaryInfo.elHeight -
3307
3329
  boundaryInfo.scrollTop, verticalOffset);
3308
3330
  var elFixedWidth = boundaryInfo.boundaryEl.getBoundingClientRect().width;