@skyux/core 6.16.0 → 6.18.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 +1042 -892
- package/esm2020/lib/modules/adapter-service/adapter.service.mjs +21 -22
- package/esm2020/lib/modules/affix/affix-offset.mjs +1 -1
- package/esm2020/lib/modules/affix/affix.directive.mjs +38 -23
- package/esm2020/lib/modules/affix/affixer.mjs +266 -260
- package/esm2020/lib/modules/affix/dom-utils.mjs +7 -7
- package/esm2020/lib/modules/dock/dock-dom-adapter.service.mjs +48 -44
- package/esm2020/lib/modules/dock/dock-item.mjs +10 -5
- package/esm2020/lib/modules/dock/dock.component.mjs +55 -31
- package/esm2020/lib/modules/dock/dock.service.mjs +40 -36
- package/esm2020/lib/modules/dynamic-component/dynamic-component.service.mjs +37 -22
- package/esm2020/lib/modules/log/log.service.mjs +37 -37
- package/esm2020/lib/modules/media-query/media-query.service.mjs +50 -47
- package/esm2020/lib/modules/mutation/mutation-observer-service.mjs +3 -1
- package/esm2020/lib/modules/numeric/numeric.pipe.mjs +26 -19
- package/esm2020/lib/modules/numeric/numeric.service.mjs +84 -99
- package/esm2020/lib/modules/overlay/overlay-adapter.service.mjs +23 -17
- package/esm2020/lib/modules/overlay/overlay-instance.mjs +18 -9
- package/esm2020/lib/modules/overlay/overlay.component.mjs +79 -55
- package/esm2020/lib/modules/overlay/overlay.service.mjs +55 -49
- package/esm2020/lib/modules/percent-pipe/percent.pipe.mjs +32 -21
- package/esm2020/lib/modules/resize-observer/resize-observer-media-query.service.mjs +38 -46
- package/esm2020/lib/modules/scrollable-host/scrollable-host.service.mjs +66 -67
- package/esm2020/lib/modules/title/title.service.mjs +8 -4
- package/esm2020/lib/modules/trim/trim.directive.mjs +10 -11
- package/esm2020/lib/modules/viewkeeper/viewkeeper-boundary-info.mjs +1 -1
- package/esm2020/lib/modules/viewkeeper/viewkeeper.directive.mjs +75 -60
- package/esm2020/lib/modules/viewkeeper/viewkeeper.mjs +166 -156
- package/esm2020/lib/modules/viewkeeper/viewkeeper.service.mjs +7 -3
- package/esm2020/testing/core-testing.module.mjs +4 -1
- package/esm2020/testing/mock-media-query.service.mjs +4 -1
- package/esm2020/testing/mock-ui-config.service.mjs +4 -1
- package/esm2020/testing/overlay/overlay-harness-filters.mjs +1 -1
- package/esm2020/testing/overlay/overlay-harness.mjs +2 -1
- package/esm2020/testing/shared/component-harness.mjs +4 -1
- package/esm2020/testing/shared/harness-filters.mjs +1 -1
- package/fesm2015/skyux-core-testing.mjs +13 -0
- package/fesm2015/skyux-core-testing.mjs.map +1 -1
- package/fesm2015/skyux-core.mjs +1276 -1151
- package/fesm2015/skyux-core.mjs.map +1 -1
- package/fesm2020/skyux-core-testing.mjs +13 -0
- package/fesm2020/skyux-core-testing.mjs.map +1 -1
- package/fesm2020/skyux-core.mjs +1278 -1150
- package/fesm2020/skyux-core.mjs.map +1 -1
- package/lib/modules/adapter-service/adapter.service.d.ts +3 -5
- package/lib/modules/affix/affix-offset.d.ts +1 -1
- package/lib/modules/affix/affix.directive.d.ts +12 -13
- package/lib/modules/affix/affixer.d.ts +2 -34
- package/lib/modules/affix/dom-utils.d.ts +3 -3
- package/lib/modules/dock/dock-dom-adapter.service.d.ts +2 -9
- package/lib/modules/dock/dock-item.d.ts +1 -1
- package/lib/modules/dock/dock.component.d.ts +2 -10
- package/lib/modules/dock/dock.service.d.ts +2 -5
- package/lib/modules/dynamic-component/dynamic-component.service.d.ts +2 -7
- package/lib/modules/log/log.service.d.ts +2 -6
- package/lib/modules/media-query/media-query.service.d.ts +1 -8
- package/lib/modules/numeric/numeric.pipe.d.ts +2 -8
- package/lib/modules/numeric/numeric.service.d.ts +3 -36
- package/lib/modules/overlay/overlay-adapter.service.d.ts +1 -3
- package/lib/modules/overlay/overlay-instance.d.ts +1 -2
- package/lib/modules/overlay/overlay.component.d.ts +1 -14
- package/lib/modules/overlay/overlay.service.d.ts +1 -7
- package/lib/modules/percent-pipe/percent.pipe.d.ts +2 -9
- package/lib/modules/resize-observer/resize-observer-media-query.service.d.ts +2 -7
- package/lib/modules/scrollable-host/scrollable-host.service.d.ts +2 -11
- package/lib/modules/title/title.service.d.ts +2 -2
- package/lib/modules/trim/trim.directive.d.ts +0 -2
- package/lib/modules/viewkeeper/viewkeeper-boundary-info.d.ts +1 -1
- package/lib/modules/viewkeeper/viewkeeper.d.ts +2 -24
- package/lib/modules/viewkeeper/viewkeeper.directive.d.ts +4 -16
- package/lib/modules/viewkeeper/viewkeeper.service.d.ts +1 -1
- package/package.json +2 -2
- package/testing/core-testing.module.d.ts +3 -0
- package/testing/mock-media-query.service.d.ts +3 -0
- package/testing/mock-ui-config.service.d.ts +3 -0
- package/testing/overlay/overlay-harness-filters.d.ts +1 -0
- package/testing/overlay/overlay-harness.d.ts +1 -0
- package/testing/shared/component-harness.d.ts +3 -0
- package/testing/shared/harness-filters.d.ts +1 -0
package/fesm2015/skyux-core.mjs
CHANGED
@@ -45,7 +45,7 @@ var SkyMediaBreakpoints;
|
|
45
45
|
SkyMediaBreakpoints[SkyMediaBreakpoints["lg"] = 4] = "lg";
|
46
46
|
})(SkyMediaBreakpoints || (SkyMediaBreakpoints = {}));
|
47
47
|
|
48
|
-
var _SkyCoreAdapterService_renderer;
|
48
|
+
var _SkyCoreAdapterService_instances, _SkyCoreAdapterService_renderer, _SkyCoreAdapterService_focusFirstElement, _SkyCoreAdapterService_isVisible;
|
49
49
|
const SKY_TABBABLE_SELECTOR = [
|
50
50
|
'a[href]',
|
51
51
|
'area[href]',
|
@@ -62,6 +62,7 @@ const SKY_TABBABLE_SELECTOR = [
|
|
62
62
|
class SkyCoreAdapterService {
|
63
63
|
constructor(rendererFactory) {
|
64
64
|
this.rendererFactory = rendererFactory;
|
65
|
+
_SkyCoreAdapterService_instances.add(this);
|
65
66
|
_SkyCoreAdapterService_renderer.set(this, void 0);
|
66
67
|
__classPrivateFieldSet(this, _SkyCoreAdapterService_renderer, this.rendererFactory.createRenderer(undefined, null), "f");
|
67
68
|
}
|
@@ -147,7 +148,7 @@ class SkyCoreAdapterService {
|
|
147
148
|
if (containerElement) {
|
148
149
|
const focusableChildren = this.getFocusableChildren(containerElement);
|
149
150
|
// Focus first focusable child if available. Otherwise, set focus on container.
|
150
|
-
if (!this.
|
151
|
+
if (!__classPrivateFieldGet(this, _SkyCoreAdapterService_instances, "m", _SkyCoreAdapterService_focusFirstElement).call(this, focusableChildren) &&
|
151
152
|
focusOnContainerIfNoChildrenFound) {
|
152
153
|
containerElement.focus();
|
153
154
|
}
|
@@ -173,7 +174,7 @@ class SkyCoreAdapterService {
|
|
173
174
|
// Unless ignoreVisibility = true, filter out elements that are not visible.
|
174
175
|
if (!options || !options.ignoreVisibility) {
|
175
176
|
elements = elements.filter((el) => {
|
176
|
-
return this.
|
177
|
+
return __classPrivateFieldGet(this, _SkyCoreAdapterService_instances, "m", _SkyCoreAdapterService_isVisible).call(this, el);
|
177
178
|
});
|
178
179
|
}
|
179
180
|
return elements;
|
@@ -241,26 +242,24 @@ class SkyCoreAdapterService {
|
|
241
242
|
}
|
242
243
|
}
|
243
244
|
}
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
return false;
|
245
|
+
}
|
246
|
+
_SkyCoreAdapterService_renderer = new WeakMap(), _SkyCoreAdapterService_instances = new WeakSet(), _SkyCoreAdapterService_focusFirstElement = function _SkyCoreAdapterService_focusFirstElement(list) {
|
247
|
+
if (list.length > 0) {
|
248
|
+
list[0].focus();
|
249
|
+
return true;
|
250
250
|
}
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
const hasBounds = !!(element.offsetWidth ||
|
258
|
-
element.offsetHeight ||
|
259
|
-
element.getClientRects().length);
|
260
|
-
return hasBounds;
|
251
|
+
return false;
|
252
|
+
}, _SkyCoreAdapterService_isVisible = function _SkyCoreAdapterService_isVisible(element) {
|
253
|
+
const style = window.getComputedStyle(element);
|
254
|
+
const isHidden = style.display === 'none' || style.visibility === 'hidden';
|
255
|
+
if (isHidden) {
|
256
|
+
return false;
|
261
257
|
}
|
262
|
-
|
263
|
-
|
258
|
+
const hasBounds = !!(element.offsetWidth ||
|
259
|
+
element.offsetHeight ||
|
260
|
+
element.getClientRects().length);
|
261
|
+
return hasBounds;
|
262
|
+
};
|
264
263
|
SkyCoreAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
265
264
|
SkyCoreAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreAdapterService, providedIn: 'root' });
|
266
265
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyCoreAdapterService, decorators: [{
|
@@ -305,11 +304,11 @@ function getInversePlacement(placement) {
|
|
305
304
|
* @param element The HTML element.
|
306
305
|
* @param bufferOffset An optional offset to add/subtract to the element's actual offset.
|
307
306
|
*/
|
308
|
-
function getElementOffset(element, bufferOffset
|
309
|
-
const bufferOffsetBottom = bufferOffset.bottom || 0;
|
310
|
-
const bufferOffsetLeft = bufferOffset.left || 0;
|
311
|
-
const bufferOffsetRight = bufferOffset.right || 0;
|
312
|
-
const bufferOffsetTop = bufferOffset.top || 0;
|
307
|
+
function getElementOffset(element, bufferOffset) {
|
308
|
+
const bufferOffsetBottom = (bufferOffset === null || bufferOffset === void 0 ? void 0 : bufferOffset.bottom) || 0;
|
309
|
+
const bufferOffsetLeft = (bufferOffset === null || bufferOffset === void 0 ? void 0 : bufferOffset.left) || 0;
|
310
|
+
const bufferOffsetRight = (bufferOffset === null || bufferOffset === void 0 ? void 0 : bufferOffset.right) || 0;
|
311
|
+
const bufferOffsetTop = (bufferOffset === null || bufferOffset === void 0 ? void 0 : bufferOffset.top) || 0;
|
313
312
|
let top;
|
314
313
|
let left;
|
315
314
|
let right;
|
@@ -341,7 +340,7 @@ function getElementOffset(element, bufferOffset = {}) {
|
|
341
340
|
function getOverflowParents(child) {
|
342
341
|
const bodyElement = window.document.body;
|
343
342
|
const results = [bodyElement];
|
344
|
-
let parentElement = child.parentNode;
|
343
|
+
let parentElement = child === null || child === void 0 ? void 0 : child.parentNode;
|
345
344
|
while (parentElement !== undefined &&
|
346
345
|
parentElement !== bodyElement &&
|
347
346
|
parentElement instanceof HTMLElement) {
|
@@ -377,6 +376,7 @@ function isOffsetPartiallyVisibleWithinParent(parent, offset, bufferOffset) {
|
|
377
376
|
parentOffset.left >= offset.right);
|
378
377
|
}
|
379
378
|
|
379
|
+
var _SkyAffixer_instances, _SkyAffixer_config_get, _SkyAffixer_config_set, _SkyAffixer_affixedElement, _SkyAffixer_baseElement, _SkyAffixer_currentOffset, _SkyAffixer_currentPlacement, _SkyAffixer_offsetChange, _SkyAffixer_offsetChangeObs, _SkyAffixer_overflowParents, _SkyAffixer_overflowScroll, _SkyAffixer_overflowScrollObs, _SkyAffixer_placementChange, _SkyAffixer_placementChangeObs, _SkyAffixer_renderer, _SkyAffixer_resizeListener, _SkyAffixer_scrollListeners, _SkyAffixer__config, _SkyAffixer_affix, _SkyAffixer_getOffset, _SkyAffixer_getPreferredOffset, _SkyAffixer_adjustOffsetToOverflowParent, _SkyAffixer_getImmediateOverflowParent, _SkyAffixer_getAutoFitContextParent, _SkyAffixer_notifyPlacementChange, _SkyAffixer_reset, _SkyAffixer_isNewOffset, _SkyAffixer_isBaseElementVisible, _SkyAffixer_addScrollListeners, _SkyAffixer_addResizeListener, _SkyAffixer_removeResizeListener, _SkyAffixer_removeScrollListeners;
|
380
380
|
const DEFAULT_AFFIX_CONFIG = {
|
381
381
|
autoFitContext: SkyAffixAutoFitContext.OverflowParent,
|
382
382
|
enableAutoFit: false,
|
@@ -386,17 +386,36 @@ const DEFAULT_AFFIX_CONFIG = {
|
|
386
386
|
};
|
387
387
|
class SkyAffixer {
|
388
388
|
constructor(affixedElement, renderer) {
|
389
|
-
this
|
390
|
-
this
|
391
|
-
this
|
392
|
-
this
|
393
|
-
this
|
389
|
+
_SkyAffixer_instances.add(this);
|
390
|
+
_SkyAffixer_affixedElement.set(this, void 0);
|
391
|
+
_SkyAffixer_baseElement.set(this, void 0);
|
392
|
+
_SkyAffixer_currentOffset.set(this, void 0);
|
393
|
+
_SkyAffixer_currentPlacement.set(this, void 0);
|
394
|
+
_SkyAffixer_offsetChange.set(this, void 0);
|
395
|
+
_SkyAffixer_offsetChangeObs.set(this, void 0);
|
396
|
+
_SkyAffixer_overflowParents.set(this, []);
|
397
|
+
_SkyAffixer_overflowScroll.set(this, void 0);
|
398
|
+
_SkyAffixer_overflowScrollObs.set(this, void 0);
|
399
|
+
_SkyAffixer_placementChange.set(this, void 0);
|
400
|
+
_SkyAffixer_placementChangeObs.set(this, void 0);
|
401
|
+
_SkyAffixer_renderer.set(this, void 0);
|
402
|
+
_SkyAffixer_resizeListener.set(this, void 0);
|
403
|
+
_SkyAffixer_scrollListeners.set(this, void 0);
|
404
|
+
_SkyAffixer__config.set(this, DEFAULT_AFFIX_CONFIG);
|
405
|
+
__classPrivateFieldSet(this, _SkyAffixer_affixedElement, affixedElement, "f");
|
406
|
+
__classPrivateFieldSet(this, _SkyAffixer_renderer, renderer, "f");
|
407
|
+
__classPrivateFieldSet(this, _SkyAffixer_offsetChange, new Subject(), "f");
|
408
|
+
__classPrivateFieldSet(this, _SkyAffixer_overflowScroll, new Subject(), "f");
|
409
|
+
__classPrivateFieldSet(this, _SkyAffixer_placementChange, new Subject(), "f");
|
410
|
+
__classPrivateFieldSet(this, _SkyAffixer_offsetChangeObs, __classPrivateFieldGet(this, _SkyAffixer_offsetChange, "f").asObservable(), "f");
|
411
|
+
__classPrivateFieldSet(this, _SkyAffixer_overflowScrollObs, __classPrivateFieldGet(this, _SkyAffixer_overflowScroll, "f").asObservable(), "f");
|
412
|
+
__classPrivateFieldSet(this, _SkyAffixer_placementChangeObs, __classPrivateFieldGet(this, _SkyAffixer_placementChange, "f").asObservable(), "f");
|
394
413
|
}
|
395
414
|
/**
|
396
415
|
* Fires when the affixed element's offset changes.
|
397
416
|
*/
|
398
417
|
get offsetChange() {
|
399
|
-
return this
|
418
|
+
return __classPrivateFieldGet(this, _SkyAffixer_offsetChangeObs, "f");
|
400
419
|
}
|
401
420
|
/**
|
402
421
|
* Fires when the base element's nearest overflow parent is scrolling. This is useful if you need
|
@@ -404,27 +423,14 @@ class SkyAffixer {
|
|
404
423
|
* event listener.
|
405
424
|
*/
|
406
425
|
get overflowScroll() {
|
407
|
-
return this
|
426
|
+
return __classPrivateFieldGet(this, _SkyAffixer_overflowScrollObs, "f");
|
408
427
|
}
|
409
428
|
/**
|
410
429
|
* Fires when the placement value changes. A `null` value indicates that a suitable
|
411
430
|
* placement could not be found.
|
412
431
|
*/
|
413
432
|
get placementChange() {
|
414
|
-
return this
|
415
|
-
}
|
416
|
-
get config() {
|
417
|
-
return this._config;
|
418
|
-
}
|
419
|
-
set config(value) {
|
420
|
-
const merged = Object.assign(Object.assign({}, DEFAULT_AFFIX_CONFIG), value);
|
421
|
-
// Make sure none of the values are undefined.
|
422
|
-
Object.keys(merged).forEach((k) => {
|
423
|
-
if (merged[k] === undefined) {
|
424
|
-
merged[k] = DEFAULT_AFFIX_CONFIG[k];
|
425
|
-
}
|
426
|
-
});
|
427
|
-
this._config = merged;
|
433
|
+
return __classPrivateFieldGet(this, _SkyAffixer_placementChangeObs, "f");
|
428
434
|
}
|
429
435
|
/**
|
430
436
|
* Affixes an element to a base element.
|
@@ -432,292 +438,287 @@ class SkyAffixer {
|
|
432
438
|
* @param config Configuration for the affix action.
|
433
439
|
*/
|
434
440
|
affixTo(baseElement, config) {
|
435
|
-
this.
|
436
|
-
this
|
437
|
-
this
|
438
|
-
this
|
439
|
-
this.
|
440
|
-
if (this.
|
441
|
-
this.
|
442
|
-
this.
|
441
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_reset).call(this);
|
442
|
+
__classPrivateFieldSet(this, _SkyAffixer_instances, config, "a", _SkyAffixer_config_set);
|
443
|
+
__classPrivateFieldSet(this, _SkyAffixer_baseElement, baseElement, "f");
|
444
|
+
__classPrivateFieldSet(this, _SkyAffixer_overflowParents, getOverflowParents(baseElement), "f");
|
445
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_affix).call(this);
|
446
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).isSticky) {
|
447
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_addScrollListeners).call(this);
|
448
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_addResizeListener).call(this);
|
443
449
|
}
|
444
450
|
}
|
451
|
+
getConfig() {
|
452
|
+
return __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get);
|
453
|
+
}
|
445
454
|
/**
|
446
455
|
* Re-runs the affix calculation.
|
447
456
|
*/
|
448
457
|
reaffix() {
|
449
458
|
// Reset current placement to preferred placement.
|
450
|
-
this
|
451
|
-
this.
|
459
|
+
__classPrivateFieldSet(this, _SkyAffixer_currentPlacement, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).placement, "f");
|
460
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_affix).call(this);
|
452
461
|
}
|
453
462
|
/**
|
454
463
|
* Destroys the affixer.
|
455
464
|
*/
|
456
465
|
destroy() {
|
457
|
-
this.
|
458
|
-
this.
|
459
|
-
this.
|
460
|
-
this.
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
if (
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
return
|
511
|
-
}
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
}
|
535
|
-
else {
|
536
|
-
top = baseRect.bottom;
|
537
|
-
switch (verticalAlignment) {
|
538
|
-
case 'top':
|
539
|
-
default:
|
540
|
-
break;
|
541
|
-
case 'middle':
|
542
|
-
top = top - affixedRect.height / 2;
|
543
|
-
break;
|
544
|
-
case 'bottom':
|
545
|
-
top = top - affixedRect.height;
|
546
|
-
break;
|
547
|
-
}
|
548
|
-
}
|
549
|
-
switch (horizontalAlignment) {
|
550
|
-
case 'left':
|
551
|
-
left = baseRect.left;
|
466
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_reset).call(this);
|
467
|
+
__classPrivateFieldGet(this, _SkyAffixer_placementChange, "f").complete();
|
468
|
+
__classPrivateFieldGet(this, _SkyAffixer_offsetChange, "f").complete();
|
469
|
+
__classPrivateFieldGet(this, _SkyAffixer_overflowScroll, "f").complete();
|
470
|
+
}
|
471
|
+
}
|
472
|
+
_SkyAffixer_affixedElement = new WeakMap(), _SkyAffixer_baseElement = new WeakMap(), _SkyAffixer_currentOffset = new WeakMap(), _SkyAffixer_currentPlacement = new WeakMap(), _SkyAffixer_offsetChange = new WeakMap(), _SkyAffixer_offsetChangeObs = new WeakMap(), _SkyAffixer_overflowParents = new WeakMap(), _SkyAffixer_overflowScroll = new WeakMap(), _SkyAffixer_overflowScrollObs = new WeakMap(), _SkyAffixer_placementChange = new WeakMap(), _SkyAffixer_placementChangeObs = new WeakMap(), _SkyAffixer_renderer = new WeakMap(), _SkyAffixer_resizeListener = new WeakMap(), _SkyAffixer_scrollListeners = new WeakMap(), _SkyAffixer__config = new WeakMap(), _SkyAffixer_instances = new WeakSet(), _SkyAffixer_config_get = function _SkyAffixer_config_get() {
|
473
|
+
return __classPrivateFieldGet(this, _SkyAffixer__config, "f");
|
474
|
+
}, _SkyAffixer_config_set = function _SkyAffixer_config_set(value) {
|
475
|
+
const merged = Object.assign(Object.assign({}, DEFAULT_AFFIX_CONFIG), value);
|
476
|
+
// Make sure none of the values are undefined.
|
477
|
+
let key;
|
478
|
+
for (key in merged) {
|
479
|
+
if (merged[key] === undefined) {
|
480
|
+
merged[key] = DEFAULT_AFFIX_CONFIG[key];
|
481
|
+
}
|
482
|
+
}
|
483
|
+
__classPrivateFieldSet(this, _SkyAffixer__config, merged, "f");
|
484
|
+
}, _SkyAffixer_affix = function _SkyAffixer_affix() {
|
485
|
+
const offset = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getOffset).call(this);
|
486
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_isNewOffset).call(this, offset)) {
|
487
|
+
__classPrivateFieldGet(this, _SkyAffixer_renderer, "f").setStyle(__classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f"), 'top', `${offset.top}px`);
|
488
|
+
__classPrivateFieldGet(this, _SkyAffixer_renderer, "f").setStyle(__classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f"), 'left', `${offset.left}px`);
|
489
|
+
__classPrivateFieldGet(this, _SkyAffixer_offsetChange, "f").next({ offset });
|
490
|
+
}
|
491
|
+
}, _SkyAffixer_getOffset = function _SkyAffixer_getOffset() {
|
492
|
+
const parent = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getAutoFitContextParent).call(this);
|
493
|
+
const maxAttempts = 4;
|
494
|
+
let attempts = 0;
|
495
|
+
let isAffixedElementFullyVisible = false;
|
496
|
+
let offset;
|
497
|
+
let placement = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).placement;
|
498
|
+
do {
|
499
|
+
offset = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getPreferredOffset).call(this, placement);
|
500
|
+
isAffixedElementFullyVisible = isOffsetFullyVisibleWithinParent(parent, offset, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitOverflowOffset);
|
501
|
+
if (!__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).enableAutoFit) {
|
502
|
+
break;
|
503
|
+
}
|
504
|
+
if (!isAffixedElementFullyVisible) {
|
505
|
+
placement =
|
506
|
+
attempts % 2 === 0
|
507
|
+
? getInversePlacement(placement)
|
508
|
+
: getNextPlacement(placement);
|
509
|
+
}
|
510
|
+
attempts++;
|
511
|
+
} while (!isAffixedElementFullyVisible && attempts < maxAttempts);
|
512
|
+
if (isAffixedElementFullyVisible) {
|
513
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_isBaseElementVisible).call(this)) {
|
514
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_notifyPlacementChange).call(this, placement);
|
515
|
+
}
|
516
|
+
else {
|
517
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_notifyPlacementChange).call(this, null);
|
518
|
+
}
|
519
|
+
return offset;
|
520
|
+
}
|
521
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).enableAutoFit) {
|
522
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_notifyPlacementChange).call(this, null);
|
523
|
+
}
|
524
|
+
// No suitable placement was found, so revert to preferred placement.
|
525
|
+
return __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getPreferredOffset).call(this, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).placement);
|
526
|
+
}, _SkyAffixer_getPreferredOffset = function _SkyAffixer_getPreferredOffset(placement) {
|
527
|
+
if (!__classPrivateFieldGet(this, _SkyAffixer_baseElement, "f")) {
|
528
|
+
return { top: 0, left: 0, bottom: 0, right: 0 };
|
529
|
+
}
|
530
|
+
const affixedRect = __classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f").getBoundingClientRect();
|
531
|
+
const baseRect = __classPrivateFieldGet(this, _SkyAffixer_baseElement, "f").getBoundingClientRect();
|
532
|
+
const horizontalAlignment = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).horizontalAlignment;
|
533
|
+
const verticalAlignment = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).verticalAlignment;
|
534
|
+
const enableAutoFit = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).enableAutoFit;
|
535
|
+
let top;
|
536
|
+
let left;
|
537
|
+
if (placement === 'above' || placement === 'below') {
|
538
|
+
if (placement === 'above') {
|
539
|
+
top = baseRect.top - affixedRect.height;
|
540
|
+
switch (verticalAlignment) {
|
541
|
+
case 'top':
|
542
|
+
top = top + affixedRect.height;
|
552
543
|
break;
|
553
|
-
case '
|
554
|
-
|
555
|
-
left = baseRect.left + baseRect.width / 2 - affixedRect.width / 2;
|
544
|
+
case 'middle':
|
545
|
+
top = top + affixedRect.height / 2;
|
556
546
|
break;
|
557
|
-
case '
|
558
|
-
|
547
|
+
case 'bottom':
|
548
|
+
default:
|
559
549
|
break;
|
560
550
|
}
|
561
551
|
}
|
562
552
|
else {
|
563
|
-
|
564
|
-
left = baseRect.left - affixedRect.width;
|
565
|
-
}
|
566
|
-
else {
|
567
|
-
left = baseRect.right;
|
568
|
-
}
|
553
|
+
top = baseRect.bottom;
|
569
554
|
switch (verticalAlignment) {
|
570
555
|
case 'top':
|
571
|
-
|
556
|
+
default:
|
572
557
|
break;
|
573
558
|
case 'middle':
|
574
|
-
|
575
|
-
top = baseRect.top + baseRect.height / 2 - affixedRect.height / 2;
|
559
|
+
top = top - affixedRect.height / 2;
|
576
560
|
break;
|
577
561
|
case 'bottom':
|
578
|
-
top =
|
562
|
+
top = top - affixedRect.height;
|
579
563
|
break;
|
580
564
|
}
|
581
565
|
}
|
582
|
-
|
583
|
-
if (enableAutoFit) {
|
584
|
-
offset = this.adjustOffsetToOverflowParent(Object.assign({}, offset), placement);
|
585
|
-
}
|
586
|
-
offset.bottom = offset.top + affixedRect.height;
|
587
|
-
offset.right = offset.left + affixedRect.width;
|
588
|
-
return offset;
|
589
|
-
}
|
590
|
-
/**
|
591
|
-
* Slightly adjust the offset to fit within the scroll parent's boundaries if
|
592
|
-
* the affixed element would otherwise be clipped.
|
593
|
-
*/
|
594
|
-
adjustOffsetToOverflowParent(offset, placement) {
|
595
|
-
const parent = this.getAutoFitContextParent();
|
596
|
-
const parentOffset = getElementOffset(parent, this.config.autoFitOverflowOffset);
|
597
|
-
const affixedRect = this.affixedRect;
|
598
|
-
const baseRect = this.baseRect;
|
599
|
-
// A pixel value representing the leeway between the edge of the overflow parent and the edge
|
600
|
-
// of the base element before it dissapears from view.
|
601
|
-
// If the visible portion of the base element is less than this pixel value, the auto-fit
|
602
|
-
// functionality attempts to find another placement.
|
603
|
-
const defaultPixelTolerance = 40;
|
604
|
-
let pixelTolerance;
|
605
|
-
const originalOffsetTop = offset.top;
|
606
|
-
const originalOffsetLeft = offset.left;
|
607
|
-
switch (placement) {
|
608
|
-
case 'above':
|
609
|
-
case 'below':
|
610
|
-
// Keep the affixed element within the overflow parent.
|
611
|
-
if (offset.left < parentOffset.left) {
|
612
|
-
offset.left = parentOffset.left;
|
613
|
-
}
|
614
|
-
else if (offset.left + affixedRect.width > parentOffset.right) {
|
615
|
-
offset.left = parentOffset.right - affixedRect.width;
|
616
|
-
}
|
617
|
-
// Use a smaller pixel tolerance if the base element width is less than the default.
|
618
|
-
pixelTolerance = Math.min(defaultPixelTolerance, baseRect.width);
|
619
|
-
// Make sure the affixed element never detaches from the base element.
|
620
|
-
if (offset.left + pixelTolerance > baseRect.right ||
|
621
|
-
offset.left + affixedRect.width - pixelTolerance < baseRect.left) {
|
622
|
-
offset.left = originalOffsetLeft;
|
623
|
-
}
|
624
|
-
break;
|
566
|
+
switch (horizontalAlignment) {
|
625
567
|
case 'left':
|
568
|
+
left = baseRect.left;
|
569
|
+
break;
|
570
|
+
case 'center':
|
571
|
+
default:
|
572
|
+
left = baseRect.left + baseRect.width / 2 - affixedRect.width / 2;
|
573
|
+
break;
|
626
574
|
case 'right':
|
627
|
-
|
628
|
-
if (offset.top < parentOffset.top) {
|
629
|
-
offset.top = parentOffset.top;
|
630
|
-
}
|
631
|
-
else if (offset.top + affixedRect.height > parentOffset.bottom) {
|
632
|
-
offset.top = parentOffset.bottom - affixedRect.height;
|
633
|
-
}
|
634
|
-
// Use a smaller pixel tolerance if the base element height is less than the default.
|
635
|
-
pixelTolerance = Math.min(defaultPixelTolerance, baseRect.height);
|
636
|
-
// Make sure the affixed element never detaches from the base element.
|
637
|
-
if (offset.top + pixelTolerance > baseRect.bottom ||
|
638
|
-
offset.top + affixedRect.height - pixelTolerance < baseRect.top) {
|
639
|
-
offset.top = originalOffsetTop;
|
640
|
-
}
|
575
|
+
left = baseRect.right - affixedRect.width;
|
641
576
|
break;
|
642
577
|
}
|
643
|
-
return offset;
|
644
|
-
}
|
645
|
-
getImmediateOverflowParent() {
|
646
|
-
return this.overflowParents[this.overflowParents.length - 1];
|
647
|
-
}
|
648
|
-
getAutoFitContextParent() {
|
649
|
-
const bodyElement = this.overflowParents[0];
|
650
|
-
return this.config.autoFitContext === SkyAffixAutoFitContext.OverflowParent
|
651
|
-
? this.getImmediateOverflowParent()
|
652
|
-
: bodyElement;
|
653
578
|
}
|
654
|
-
|
655
|
-
if (
|
656
|
-
|
657
|
-
this._placementChange.next({
|
658
|
-
placement,
|
659
|
-
});
|
579
|
+
else {
|
580
|
+
if (placement === 'left') {
|
581
|
+
left = baseRect.left - affixedRect.width;
|
660
582
|
}
|
661
|
-
|
662
|
-
|
663
|
-
this.removeScrollListeners();
|
664
|
-
this.removeResizeListener();
|
665
|
-
this._config =
|
666
|
-
this.affixedRect =
|
667
|
-
this.baseElement =
|
668
|
-
this.baseRect =
|
669
|
-
this.currentPlacement =
|
670
|
-
this.currentOffset =
|
671
|
-
this.overflowParents =
|
672
|
-
undefined;
|
673
|
-
}
|
674
|
-
isNewOffset(offset) {
|
675
|
-
if (this.currentOffset === undefined) {
|
676
|
-
this.currentOffset = offset;
|
677
|
-
return true;
|
583
|
+
else {
|
584
|
+
left = baseRect.right;
|
678
585
|
}
|
679
|
-
|
680
|
-
|
681
|
-
|
586
|
+
switch (verticalAlignment) {
|
587
|
+
case 'top':
|
588
|
+
top = baseRect.top;
|
589
|
+
break;
|
590
|
+
case 'middle':
|
591
|
+
default:
|
592
|
+
top = baseRect.top + baseRect.height / 2 - affixedRect.height / 2;
|
593
|
+
break;
|
594
|
+
case 'bottom':
|
595
|
+
top = baseRect.bottom - affixedRect.height;
|
596
|
+
break;
|
682
597
|
}
|
683
|
-
this.currentOffset = offset;
|
684
|
-
return true;
|
685
598
|
}
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
599
|
+
const offset = { top, left, bottom: 0, right: 0 };
|
600
|
+
if (enableAutoFit) {
|
601
|
+
const adjustments = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_adjustOffsetToOverflowParent).call(this, { top, left }, placement, __classPrivateFieldGet(this, _SkyAffixer_baseElement, "f"));
|
602
|
+
offset.top = adjustments.top;
|
603
|
+
offset.left = adjustments.left;
|
604
|
+
}
|
605
|
+
offset.bottom = offset.top + affixedRect.height;
|
606
|
+
offset.right = offset.left + affixedRect.width;
|
607
|
+
return offset;
|
608
|
+
}, _SkyAffixer_adjustOffsetToOverflowParent = function _SkyAffixer_adjustOffsetToOverflowParent(offset, placement, baseElement) {
|
609
|
+
const parent = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getAutoFitContextParent).call(this);
|
610
|
+
const parentOffset = getElementOffset(parent, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitOverflowOffset);
|
611
|
+
const affixedRect = __classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f").getBoundingClientRect();
|
612
|
+
const baseRect = baseElement.getBoundingClientRect();
|
613
|
+
// A pixel value representing the leeway between the edge of the overflow parent and the edge
|
614
|
+
// of the base element before it dissapears from view.
|
615
|
+
// If the visible portion of the base element is less than this pixel value, the auto-fit
|
616
|
+
// functionality attempts to find another placement.
|
617
|
+
const defaultPixelTolerance = 40;
|
618
|
+
let pixelTolerance;
|
619
|
+
const originalOffsetTop = offset.top;
|
620
|
+
const originalOffsetLeft = offset.left;
|
621
|
+
switch (placement) {
|
622
|
+
case 'above':
|
623
|
+
case 'below':
|
624
|
+
// Keep the affixed element within the overflow parent.
|
625
|
+
if (offset.left < parentOffset.left) {
|
626
|
+
offset.left = parentOffset.left;
|
627
|
+
}
|
628
|
+
else if (offset.left + affixedRect.width > parentOffset.right) {
|
629
|
+
offset.left = parentOffset.right - affixedRect.width;
|
630
|
+
}
|
631
|
+
// Use a smaller pixel tolerance if the base element width is less than the default.
|
632
|
+
pixelTolerance = Math.min(defaultPixelTolerance, baseRect.width);
|
633
|
+
// Make sure the affixed element never detaches from the base element.
|
634
|
+
if (offset.left + pixelTolerance > baseRect.right ||
|
635
|
+
offset.left + affixedRect.width - pixelTolerance < baseRect.left) {
|
636
|
+
offset.left = originalOffsetLeft;
|
637
|
+
}
|
638
|
+
break;
|
639
|
+
case 'left':
|
640
|
+
case 'right':
|
641
|
+
// Keep the affixed element within the overflow parent.
|
642
|
+
if (offset.top < parentOffset.top) {
|
643
|
+
offset.top = parentOffset.top;
|
644
|
+
}
|
645
|
+
else if (offset.top + affixedRect.height > parentOffset.bottom) {
|
646
|
+
offset.top = parentOffset.bottom - affixedRect.height;
|
647
|
+
}
|
648
|
+
// Use a smaller pixel tolerance if the base element height is less than the default.
|
649
|
+
pixelTolerance = Math.min(defaultPixelTolerance, baseRect.height);
|
650
|
+
// Make sure the affixed element never detaches from the base element.
|
651
|
+
if (offset.top + pixelTolerance > baseRect.bottom ||
|
652
|
+
offset.top + affixedRect.height - pixelTolerance < baseRect.top) {
|
653
|
+
offset.top = originalOffsetTop;
|
654
|
+
}
|
655
|
+
break;
|
656
|
+
}
|
657
|
+
return offset;
|
658
|
+
}, _SkyAffixer_getImmediateOverflowParent = function _SkyAffixer_getImmediateOverflowParent() {
|
659
|
+
return __classPrivateFieldGet(this, _SkyAffixer_overflowParents, "f")[__classPrivateFieldGet(this, _SkyAffixer_overflowParents, "f").length - 1];
|
660
|
+
}, _SkyAffixer_getAutoFitContextParent = function _SkyAffixer_getAutoFitContextParent() {
|
661
|
+
const bodyElement = __classPrivateFieldGet(this, _SkyAffixer_overflowParents, "f")[0];
|
662
|
+
return __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitContext === SkyAffixAutoFitContext.OverflowParent
|
663
|
+
? __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getImmediateOverflowParent).call(this)
|
664
|
+
: bodyElement;
|
665
|
+
}, _SkyAffixer_notifyPlacementChange = function _SkyAffixer_notifyPlacementChange(placement) {
|
666
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_currentPlacement, "f") !== placement) {
|
667
|
+
__classPrivateFieldSet(this, _SkyAffixer_currentPlacement, placement !== null && placement !== void 0 ? placement : undefined, "f");
|
668
|
+
__classPrivateFieldGet(this, _SkyAffixer_placementChange, "f").next({
|
669
|
+
placement,
|
701
670
|
});
|
702
671
|
}
|
703
|
-
|
704
|
-
|
672
|
+
}, _SkyAffixer_reset = function _SkyAffixer_reset() {
|
673
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_removeScrollListeners).call(this);
|
674
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_removeResizeListener).call(this);
|
675
|
+
__classPrivateFieldSet(this, _SkyAffixer_overflowParents, [], "f");
|
676
|
+
__classPrivateFieldSet(this, _SkyAffixer_instances, __classPrivateFieldSet(this, _SkyAffixer_baseElement, __classPrivateFieldSet(this, _SkyAffixer_currentPlacement, __classPrivateFieldSet(this, _SkyAffixer_currentOffset, undefined, "f"), "f"), "f"), "a", _SkyAffixer_config_set);
|
677
|
+
}, _SkyAffixer_isNewOffset = function _SkyAffixer_isNewOffset(offset) {
|
678
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_currentOffset, "f") === undefined) {
|
679
|
+
__classPrivateFieldSet(this, _SkyAffixer_currentOffset, offset, "f");
|
680
|
+
return true;
|
705
681
|
}
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
this.resizeListener = undefined;
|
710
|
-
}
|
682
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_currentOffset, "f").top === offset.top &&
|
683
|
+
__classPrivateFieldGet(this, _SkyAffixer_currentOffset, "f").left === offset.left) {
|
684
|
+
return false;
|
711
685
|
}
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
this.scrollListeners = undefined;
|
718
|
-
}
|
686
|
+
__classPrivateFieldSet(this, _SkyAffixer_currentOffset, offset, "f");
|
687
|
+
return true;
|
688
|
+
}, _SkyAffixer_isBaseElementVisible = function _SkyAffixer_isBaseElementVisible() {
|
689
|
+
if (!__classPrivateFieldGet(this, _SkyAffixer_baseElement, "f")) {
|
690
|
+
return false;
|
719
691
|
}
|
720
|
-
|
692
|
+
const baseRect = __classPrivateFieldGet(this, _SkyAffixer_baseElement, "f").getBoundingClientRect();
|
693
|
+
return isOffsetPartiallyVisibleWithinParent(__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getImmediateOverflowParent).call(this), {
|
694
|
+
top: baseRect.top,
|
695
|
+
left: baseRect.left,
|
696
|
+
right: baseRect.right,
|
697
|
+
bottom: baseRect.bottom,
|
698
|
+
}, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitOverflowOffset);
|
699
|
+
}, _SkyAffixer_addScrollListeners = function _SkyAffixer_addScrollListeners() {
|
700
|
+
__classPrivateFieldSet(this, _SkyAffixer_scrollListeners, __classPrivateFieldGet(this, _SkyAffixer_overflowParents, "f").map((parentElement) => {
|
701
|
+
const overflow = parentElement === document.body ? 'window' : parentElement;
|
702
|
+
return __classPrivateFieldGet(this, _SkyAffixer_renderer, "f").listen(overflow, 'scroll', () => {
|
703
|
+
__classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_affix).call(this);
|
704
|
+
__classPrivateFieldGet(this, _SkyAffixer_overflowScroll, "f").next();
|
705
|
+
});
|
706
|
+
}), "f");
|
707
|
+
}, _SkyAffixer_addResizeListener = function _SkyAffixer_addResizeListener() {
|
708
|
+
__classPrivateFieldSet(this, _SkyAffixer_resizeListener, fromEvent(window, 'resize').subscribe(() => __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_affix).call(this)), "f");
|
709
|
+
}, _SkyAffixer_removeResizeListener = function _SkyAffixer_removeResizeListener() {
|
710
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_resizeListener, "f")) {
|
711
|
+
__classPrivateFieldGet(this, _SkyAffixer_resizeListener, "f").unsubscribe();
|
712
|
+
__classPrivateFieldSet(this, _SkyAffixer_resizeListener, undefined, "f");
|
713
|
+
}
|
714
|
+
}, _SkyAffixer_removeScrollListeners = function _SkyAffixer_removeScrollListeners() {
|
715
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_scrollListeners, "f")) {
|
716
|
+
// Remove renderer-generated listeners by calling the listener itself.
|
717
|
+
// https://github.com/angular/angular/issues/9368#issuecomment-227199778
|
718
|
+
__classPrivateFieldGet(this, _SkyAffixer_scrollListeners, "f").forEach((listener) => listener());
|
719
|
+
__classPrivateFieldSet(this, _SkyAffixer_scrollListeners, undefined, "f");
|
720
|
+
}
|
721
|
+
};
|
721
722
|
|
722
723
|
var _SkyAffixService_renderer;
|
723
724
|
class SkyAffixService {
|
@@ -743,12 +744,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
743
744
|
}]
|
744
745
|
}], ctorParameters: function () { return [{ type: i0.RendererFactory2 }]; } });
|
745
746
|
|
747
|
+
var _SkyAffixDirective_affixer, _SkyAffixDirective_affixService, _SkyAffixDirective_elementRef, _SkyAffixDirective_ngUnsubscribe;
|
746
748
|
/**
|
747
749
|
* Affixes the host element to a base element.
|
748
750
|
*/
|
749
751
|
class SkyAffixDirective {
|
750
752
|
constructor(elementRef, affixService) {
|
751
|
-
this.affixService = affixService;
|
752
753
|
/**
|
753
754
|
* Fires when the affixed element's offset changes.
|
754
755
|
*/
|
@@ -761,17 +762,25 @@ class SkyAffixDirective {
|
|
761
762
|
* Fires when the placement value changes.
|
762
763
|
*/
|
763
764
|
this.affixPlacementChange = new EventEmitter();
|
764
|
-
this
|
765
|
-
this
|
766
|
-
this
|
767
|
-
|
765
|
+
_SkyAffixDirective_affixer.set(this, void 0);
|
766
|
+
_SkyAffixDirective_affixService.set(this, void 0);
|
767
|
+
_SkyAffixDirective_elementRef.set(this, void 0);
|
768
|
+
_SkyAffixDirective_ngUnsubscribe.set(this, new Subject());
|
769
|
+
__classPrivateFieldSet(this, _SkyAffixDirective_elementRef, elementRef, "f");
|
770
|
+
__classPrivateFieldSet(this, _SkyAffixDirective_affixService, affixService, "f");
|
771
|
+
}
|
772
|
+
ngOnInit() {
|
773
|
+
__classPrivateFieldSet(this, _SkyAffixDirective_affixer, __classPrivateFieldGet(this, _SkyAffixDirective_affixService, "f").createAffixer(__classPrivateFieldGet(this, _SkyAffixDirective_elementRef, "f")), "f");
|
774
|
+
__classPrivateFieldGet(this, _SkyAffixDirective_affixer, "f").offsetChange
|
775
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyAffixDirective_ngUnsubscribe, "f")))
|
768
776
|
.subscribe((change) => this.affixOffsetChange.emit(change));
|
769
|
-
this.
|
770
|
-
.pipe(takeUntil(this
|
777
|
+
__classPrivateFieldGet(this, _SkyAffixDirective_affixer, "f").overflowScroll
|
778
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyAffixDirective_ngUnsubscribe, "f")))
|
771
779
|
.subscribe((change) => this.affixOverflowScroll.emit(change));
|
772
|
-
this.
|
773
|
-
.pipe(takeUntil(this
|
780
|
+
__classPrivateFieldGet(this, _SkyAffixDirective_affixer, "f").placementChange
|
781
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyAffixDirective_ngUnsubscribe, "f")))
|
774
782
|
.subscribe((change) => this.affixPlacementChange.emit(change));
|
783
|
+
this.updateAlignment();
|
775
784
|
}
|
776
785
|
ngOnChanges(changes) {
|
777
786
|
/* istanbul ignore else */
|
@@ -789,22 +798,29 @@ class SkyAffixDirective {
|
|
789
798
|
this.affixOffsetChange.complete();
|
790
799
|
this.affixOverflowScroll.complete();
|
791
800
|
this.affixPlacementChange.complete();
|
792
|
-
this.
|
793
|
-
this.
|
794
|
-
|
801
|
+
__classPrivateFieldGet(this, _SkyAffixDirective_ngUnsubscribe, "f").next();
|
802
|
+
__classPrivateFieldGet(this, _SkyAffixDirective_ngUnsubscribe, "f").complete();
|
803
|
+
/*istanbul ignore else*/
|
804
|
+
if (__classPrivateFieldGet(this, _SkyAffixDirective_affixer, "f")) {
|
805
|
+
__classPrivateFieldGet(this, _SkyAffixDirective_affixer, "f").destroy();
|
806
|
+
__classPrivateFieldSet(this, _SkyAffixDirective_affixer, undefined, "f");
|
807
|
+
}
|
795
808
|
}
|
796
809
|
updateAlignment() {
|
797
|
-
this.
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
810
|
+
if (this.skyAffixTo && __classPrivateFieldGet(this, _SkyAffixDirective_affixer, "f")) {
|
811
|
+
__classPrivateFieldGet(this, _SkyAffixDirective_affixer, "f").affixTo(this.skyAffixTo, {
|
812
|
+
autoFitContext: this.affixAutoFitContext,
|
813
|
+
autoFitOverflowOffset: this.affixAutoFitOverflowOffset,
|
814
|
+
enableAutoFit: this.affixEnableAutoFit,
|
815
|
+
horizontalAlignment: this.affixHorizontalAlignment,
|
816
|
+
isSticky: this.affixIsSticky,
|
817
|
+
placement: this.affixPlacement,
|
818
|
+
verticalAlignment: this.affixVerticalAlignment,
|
819
|
+
});
|
820
|
+
}
|
806
821
|
}
|
807
822
|
}
|
823
|
+
_SkyAffixDirective_affixer = new WeakMap(), _SkyAffixDirective_affixService = new WeakMap(), _SkyAffixDirective_elementRef = new WeakMap(), _SkyAffixDirective_ngUnsubscribe = new WeakMap();
|
808
824
|
SkyAffixDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAffixDirective, deps: [{ token: i0.ElementRef }, { token: SkyAffixService }], target: i0.ɵɵFactoryTarget.Directive });
|
809
825
|
SkyAffixDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyAffixDirective, selector: "[skyAffixTo]", inputs: { skyAffixTo: "skyAffixTo", affixAutoFitContext: "affixAutoFitContext", affixAutoFitOverflowOffset: "affixAutoFitOverflowOffset", affixEnableAutoFit: "affixEnableAutoFit", affixHorizontalAlignment: "affixHorizontalAlignment", affixIsSticky: "affixIsSticky", affixPlacement: "affixPlacement", affixVerticalAlignment: "affixVerticalAlignment" }, outputs: { affixOffsetChange: "affixOffsetChange", affixOverflowScroll: "affixOverflowScroll", affixPlacementChange: "affixPlacementChange" }, usesOnChanges: true, ngImport: i0 });
|
810
826
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAffixDirective, decorators: [{
|
@@ -850,6 +866,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
850
866
|
}]
|
851
867
|
}] });
|
852
868
|
|
869
|
+
var _SkyDockItem_destroyed, _SkyDockItem_destroyedObs;
|
853
870
|
/**
|
854
871
|
* Represents a single item added to the dock.
|
855
872
|
*/
|
@@ -861,22 +878,25 @@ class SkyDockItem {
|
|
861
878
|
constructor(componentInstance, stackOrder) {
|
862
879
|
this.componentInstance = componentInstance;
|
863
880
|
this.stackOrder = stackOrder;
|
864
|
-
this
|
881
|
+
_SkyDockItem_destroyed.set(this, new Subject());
|
882
|
+
_SkyDockItem_destroyedObs.set(this, void 0);
|
883
|
+
__classPrivateFieldSet(this, _SkyDockItem_destroyedObs, __classPrivateFieldGet(this, _SkyDockItem_destroyed, "f").asObservable(), "f");
|
865
884
|
}
|
866
885
|
/**
|
867
886
|
* An event that emits when the item is removed from the dock.
|
868
887
|
*/
|
869
888
|
get destroyed() {
|
870
|
-
return this
|
889
|
+
return __classPrivateFieldGet(this, _SkyDockItem_destroyedObs, "f");
|
871
890
|
}
|
872
891
|
/**
|
873
892
|
* Removes the item from the dock.
|
874
893
|
*/
|
875
894
|
destroy() {
|
876
|
-
this.
|
877
|
-
this.
|
895
|
+
__classPrivateFieldGet(this, _SkyDockItem_destroyed, "f").next();
|
896
|
+
__classPrivateFieldGet(this, _SkyDockItem_destroyed, "f").complete();
|
878
897
|
}
|
879
898
|
}
|
899
|
+
_SkyDockItem_destroyed = new WeakMap(), _SkyDockItem_destroyedObs = new WeakMap();
|
880
900
|
|
881
901
|
/**
|
882
902
|
* The location on the page where the dock component should be rendered.
|
@@ -897,7 +917,9 @@ var SkyDockLocation;
|
|
897
917
|
SkyDockLocation[SkyDockLocation["ElementBottom"] = 2] = "ElementBottom";
|
898
918
|
})(SkyDockLocation || (SkyDockLocation = {}));
|
899
919
|
|
920
|
+
// TODO: Prefix this service with `Sky` in a breaking change.
|
900
921
|
class MutationObserverService {
|
922
|
+
// TODO: Give the `callback` parameter a stricter type in a breaking change.
|
901
923
|
create(callback) {
|
902
924
|
return new MutationObserver(callback);
|
903
925
|
}
|
@@ -911,74 +933,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
911
933
|
}]
|
912
934
|
}] });
|
913
935
|
|
936
|
+
var _SkyDockDomAdapterService_instances, _SkyDockDomAdapterService_currentDockHeight, _SkyDockDomAdapterService_mutationSvc, _SkyDockDomAdapterService_ngUnsubscribe, _SkyDockDomAdapterService_observer, _SkyDockDomAdapterService_renderer, _SkyDockDomAdapterService_styleElement, _SkyDockDomAdapterService_adjustBodyStyles, _SkyDockDomAdapterService_destroyStyleElement;
|
914
937
|
/**
|
915
938
|
* @internal
|
916
939
|
*/
|
917
940
|
class SkyDockDomAdapterService {
|
918
|
-
constructor(
|
919
|
-
this
|
920
|
-
this
|
921
|
-
|
941
|
+
constructor(mutationSvc, rendererFactory) {
|
942
|
+
_SkyDockDomAdapterService_instances.add(this);
|
943
|
+
_SkyDockDomAdapterService_currentDockHeight.set(this, void 0);
|
944
|
+
_SkyDockDomAdapterService_mutationSvc.set(this, void 0);
|
945
|
+
_SkyDockDomAdapterService_ngUnsubscribe.set(this, new Subject());
|
946
|
+
_SkyDockDomAdapterService_observer.set(this, void 0);
|
947
|
+
_SkyDockDomAdapterService_renderer.set(this, void 0);
|
948
|
+
_SkyDockDomAdapterService_styleElement.set(this, void 0);
|
949
|
+
__classPrivateFieldSet(this, _SkyDockDomAdapterService_mutationSvc, mutationSvc, "f");
|
950
|
+
__classPrivateFieldSet(this, _SkyDockDomAdapterService_renderer, rendererFactory.createRenderer(undefined, null), "f");
|
922
951
|
}
|
923
952
|
ngOnDestroy() {
|
924
|
-
if (this
|
925
|
-
this.
|
953
|
+
if (__classPrivateFieldGet(this, _SkyDockDomAdapterService_observer, "f")) {
|
954
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_observer, "f").disconnect();
|
926
955
|
}
|
927
|
-
this.
|
928
|
-
|
929
|
-
|
956
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_ngUnsubscribe, "f").next();
|
957
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_ngUnsubscribe, "f").complete();
|
958
|
+
if (__classPrivateFieldGet(this, _SkyDockDomAdapterService_styleElement, "f")) {
|
959
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_instances, "m", _SkyDockDomAdapterService_destroyStyleElement).call(this);
|
930
960
|
}
|
931
|
-
this
|
932
|
-
this.ngUnsubscribe =
|
933
|
-
this.observer =
|
934
|
-
this.styleElement =
|
935
|
-
undefined;
|
961
|
+
__classPrivateFieldSet(this, _SkyDockDomAdapterService_currentDockHeight, __classPrivateFieldSet(this, _SkyDockDomAdapterService_observer, __classPrivateFieldSet(this, _SkyDockDomAdapterService_styleElement, undefined, "f"), "f"), "f");
|
936
962
|
}
|
937
963
|
setSticky(elementRef) {
|
938
|
-
this.
|
964
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").addClass(elementRef.nativeElement, 'sky-dock-sticky');
|
939
965
|
}
|
940
966
|
setZIndex(zIndex, elementRef) {
|
941
|
-
this.
|
967
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").setStyle(elementRef.nativeElement, 'z-index', zIndex);
|
942
968
|
}
|
943
969
|
unbindDock(elementRef) {
|
944
|
-
this.
|
970
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").addClass(elementRef.nativeElement, 'sky-dock-unbound');
|
945
971
|
}
|
946
972
|
watchDomChanges(elementRef) {
|
947
|
-
this
|
948
|
-
this.
|
949
|
-
});
|
950
|
-
this.
|
973
|
+
__classPrivateFieldSet(this, _SkyDockDomAdapterService_observer, __classPrivateFieldGet(this, _SkyDockDomAdapterService_mutationSvc, "f").create(() => {
|
974
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_instances, "m", _SkyDockDomAdapterService_adjustBodyStyles).call(this, elementRef);
|
975
|
+
}), "f");
|
976
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_observer, "f").observe(elementRef.nativeElement, {
|
951
977
|
attributes: true,
|
952
978
|
childList: true,
|
953
979
|
characterData: true,
|
954
980
|
subtree: true,
|
955
981
|
});
|
956
982
|
fromEvent(window, 'resize')
|
957
|
-
.pipe(debounceTime(250), takeUntil(this
|
958
|
-
.subscribe(() => this.
|
959
|
-
}
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
}
|
983
|
+
.pipe(debounceTime(250), takeUntil(__classPrivateFieldGet(this, _SkyDockDomAdapterService_ngUnsubscribe, "f")))
|
984
|
+
.subscribe(() => __classPrivateFieldGet(this, _SkyDockDomAdapterService_instances, "m", _SkyDockDomAdapterService_adjustBodyStyles).call(this, elementRef));
|
985
|
+
}
|
986
|
+
}
|
987
|
+
_SkyDockDomAdapterService_currentDockHeight = new WeakMap(), _SkyDockDomAdapterService_mutationSvc = new WeakMap(), _SkyDockDomAdapterService_ngUnsubscribe = new WeakMap(), _SkyDockDomAdapterService_observer = new WeakMap(), _SkyDockDomAdapterService_renderer = new WeakMap(), _SkyDockDomAdapterService_styleElement = new WeakMap(), _SkyDockDomAdapterService_instances = new WeakSet(), _SkyDockDomAdapterService_adjustBodyStyles = function _SkyDockDomAdapterService_adjustBodyStyles(elementRef) {
|
988
|
+
const dockHeight = elementRef.nativeElement.getBoundingClientRect().height;
|
989
|
+
if (dockHeight === __classPrivateFieldGet(this, _SkyDockDomAdapterService_currentDockHeight, "f")) {
|
990
|
+
return;
|
991
|
+
}
|
992
|
+
// Create a style element to avoid overwriting any existing inline body styles.
|
993
|
+
const styleElement = __classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").createElement('style');
|
994
|
+
const textNode = __classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").createText(`body { margin-bottom: ${dockHeight}px; }`);
|
995
|
+
// Apply a `data-` attribute to make unit testing easier.
|
996
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").setAttribute(styleElement, 'data-test-selector', 'sky-layout-dock-bottom-styles');
|
997
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").appendChild(styleElement, textNode);
|
998
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").appendChild(document.head, styleElement);
|
999
|
+
if (__classPrivateFieldGet(this, _SkyDockDomAdapterService_styleElement, "f")) {
|
1000
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_instances, "m", _SkyDockDomAdapterService_destroyStyleElement).call(this);
|
1001
|
+
}
|
1002
|
+
__classPrivateFieldSet(this, _SkyDockDomAdapterService_currentDockHeight, dockHeight, "f");
|
1003
|
+
__classPrivateFieldSet(this, _SkyDockDomAdapterService_styleElement, styleElement, "f");
|
1004
|
+
}, _SkyDockDomAdapterService_destroyStyleElement = function _SkyDockDomAdapterService_destroyStyleElement() {
|
1005
|
+
__classPrivateFieldGet(this, _SkyDockDomAdapterService_renderer, "f").removeChild(document.head, __classPrivateFieldGet(this, _SkyDockDomAdapterService_styleElement, "f"));
|
1006
|
+
};
|
982
1007
|
SkyDockDomAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDockDomAdapterService, deps: [{ token: MutationObserverService }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
983
1008
|
SkyDockDomAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDockDomAdapterService });
|
984
1009
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDockDomAdapterService, decorators: [{
|
@@ -998,76 +1023,99 @@ function sortByStackOrder(a, b) {
|
|
998
1023
|
return 0;
|
999
1024
|
}
|
1000
1025
|
|
1026
|
+
var _SkyDockComponent_instances, _SkyDockComponent_changeDetector, _SkyDockComponent_domAdapter, _SkyDockComponent_elementRef, _SkyDockComponent_injector, _SkyDockComponent_itemRefs, _SkyDockComponent_options, _SkyDockComponent_resolver, _SkyDockComponent_sortItemsByStackOrder, _SkyDockComponent_getHighestStackOrder;
|
1001
1027
|
/**
|
1002
1028
|
* @internal
|
1003
1029
|
*/
|
1004
1030
|
class SkyDockComponent {
|
1031
|
+
// TODO: Replace deprecated `ComponentFactoryResolver`.
|
1005
1032
|
constructor(changeDetector, resolver, elementRef, injector, domAdapter) {
|
1006
|
-
this
|
1007
|
-
this
|
1008
|
-
this
|
1009
|
-
this
|
1010
|
-
this
|
1011
|
-
this
|
1033
|
+
_SkyDockComponent_instances.add(this);
|
1034
|
+
_SkyDockComponent_changeDetector.set(this, void 0);
|
1035
|
+
_SkyDockComponent_domAdapter.set(this, void 0);
|
1036
|
+
_SkyDockComponent_elementRef.set(this, void 0);
|
1037
|
+
_SkyDockComponent_injector.set(this, void 0);
|
1038
|
+
_SkyDockComponent_itemRefs.set(this, []);
|
1039
|
+
_SkyDockComponent_options.set(this, void 0);
|
1040
|
+
_SkyDockComponent_resolver.set(this, void 0);
|
1041
|
+
__classPrivateFieldSet(this, _SkyDockComponent_changeDetector, changeDetector, "f");
|
1042
|
+
__classPrivateFieldSet(this, _SkyDockComponent_resolver, resolver, "f");
|
1043
|
+
__classPrivateFieldSet(this, _SkyDockComponent_elementRef, elementRef, "f");
|
1044
|
+
__classPrivateFieldSet(this, _SkyDockComponent_injector, injector, "f");
|
1045
|
+
__classPrivateFieldSet(this, _SkyDockComponent_domAdapter, domAdapter, "f");
|
1012
1046
|
}
|
1013
1047
|
insertComponent(component, config = {}) {
|
1014
|
-
|
1048
|
+
/*istanbul ignore if: untestable*/
|
1049
|
+
if (!this.target) {
|
1050
|
+
throw Error('[SkyDockComponent] Could not insert the component because the target element could not be found.');
|
1051
|
+
}
|
1052
|
+
const factory = __classPrivateFieldGet(this, _SkyDockComponent_resolver, "f").resolveComponentFactory(component);
|
1015
1053
|
const injector = Injector.create({
|
1016
1054
|
providers: config.providers || [],
|
1017
|
-
parent: this
|
1055
|
+
parent: __classPrivateFieldGet(this, _SkyDockComponent_injector, "f"),
|
1018
1056
|
});
|
1019
1057
|
const componentRef = this.target.createComponent(factory, undefined, injector);
|
1020
1058
|
const stackOrder = config.stackOrder !== null && config.stackOrder !== undefined
|
1021
1059
|
? config.stackOrder
|
1022
|
-
: this.
|
1023
|
-
this.
|
1060
|
+
: __classPrivateFieldGet(this, _SkyDockComponent_instances, "m", _SkyDockComponent_getHighestStackOrder).call(this);
|
1061
|
+
__classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f").push({
|
1024
1062
|
componentRef,
|
1025
1063
|
stackOrder,
|
1026
1064
|
});
|
1027
|
-
this.
|
1028
|
-
this.
|
1065
|
+
__classPrivateFieldGet(this, _SkyDockComponent_instances, "m", _SkyDockComponent_sortItemsByStackOrder).call(this);
|
1066
|
+
__classPrivateFieldGet(this, _SkyDockComponent_changeDetector, "f").markForCheck();
|
1029
1067
|
return {
|
1030
1068
|
componentRef,
|
1031
1069
|
stackOrder,
|
1032
1070
|
};
|
1033
1071
|
}
|
1034
1072
|
removeItem(item) {
|
1073
|
+
/*istanbul ignore if: untestable*/
|
1074
|
+
if (!this.target) {
|
1075
|
+
throw Error('[SkyDockComponent] Could not remove the item because the target element could not be found.');
|
1076
|
+
}
|
1035
1077
|
const viewRef = item.componentRef.hostView;
|
1036
1078
|
this.target.remove(this.target.indexOf(viewRef));
|
1037
|
-
const found = this.
|
1038
|
-
|
1079
|
+
const found = __classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f").find((i) => i.componentRef.hostView === viewRef);
|
1080
|
+
if (found) {
|
1081
|
+
__classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f").splice(__classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f").indexOf(found), 1);
|
1082
|
+
}
|
1039
1083
|
}
|
1040
1084
|
setOptions(options) {
|
1041
1085
|
var _a, _b;
|
1042
|
-
this
|
1043
|
-
switch ((_a = this
|
1086
|
+
__classPrivateFieldSet(this, _SkyDockComponent_options, options, "f");
|
1087
|
+
switch ((_a = __classPrivateFieldGet(this, _SkyDockComponent_options, "f")) === null || _a === void 0 ? void 0 : _a.location) {
|
1044
1088
|
case SkyDockLocation.BeforeElement:
|
1045
|
-
this.
|
1089
|
+
__classPrivateFieldGet(this, _SkyDockComponent_domAdapter, "f").unbindDock(__classPrivateFieldGet(this, _SkyDockComponent_elementRef, "f"));
|
1046
1090
|
break;
|
1047
1091
|
case SkyDockLocation.ElementBottom:
|
1048
|
-
this.
|
1092
|
+
__classPrivateFieldGet(this, _SkyDockComponent_domAdapter, "f").setSticky(__classPrivateFieldGet(this, _SkyDockComponent_elementRef, "f"));
|
1049
1093
|
break;
|
1050
1094
|
case SkyDockLocation.BodyBottom:
|
1051
1095
|
default:
|
1052
|
-
this.
|
1096
|
+
__classPrivateFieldGet(this, _SkyDockComponent_domAdapter, "f").watchDomChanges(__classPrivateFieldGet(this, _SkyDockComponent_elementRef, "f"));
|
1053
1097
|
break;
|
1054
1098
|
}
|
1055
|
-
if ((_b = this
|
1056
|
-
this.
|
1099
|
+
if ((_b = __classPrivateFieldGet(this, _SkyDockComponent_options, "f")) === null || _b === void 0 ? void 0 : _b.zIndex) {
|
1100
|
+
__classPrivateFieldGet(this, _SkyDockComponent_domAdapter, "f").setZIndex(__classPrivateFieldGet(this, _SkyDockComponent_options, "f").zIndex, __classPrivateFieldGet(this, _SkyDockComponent_elementRef, "f"));
|
1057
1101
|
}
|
1058
1102
|
}
|
1059
|
-
|
1060
|
-
|
1103
|
+
}
|
1104
|
+
_SkyDockComponent_changeDetector = new WeakMap(), _SkyDockComponent_domAdapter = new WeakMap(), _SkyDockComponent_elementRef = new WeakMap(), _SkyDockComponent_injector = new WeakMap(), _SkyDockComponent_itemRefs = new WeakMap(), _SkyDockComponent_options = new WeakMap(), _SkyDockComponent_resolver = new WeakMap(), _SkyDockComponent_instances = new WeakSet(), _SkyDockComponent_sortItemsByStackOrder = function _SkyDockComponent_sortItemsByStackOrder() {
|
1105
|
+
if (this.target) {
|
1106
|
+
__classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f").sort(sortByStackOrder);
|
1061
1107
|
// Reassign the correct index for each view.
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
if (this.itemRefs.length === 0) {
|
1066
|
-
return 0;
|
1108
|
+
for (let i = 0, len = __classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f").length; i < len; i++) {
|
1109
|
+
const item = __classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f")[i];
|
1110
|
+
this.target.move(item.componentRef.hostView, i);
|
1067
1111
|
}
|
1068
|
-
return this.itemRefs[0].stackOrder + 1;
|
1069
1112
|
}
|
1070
|
-
}
|
1113
|
+
}, _SkyDockComponent_getHighestStackOrder = function _SkyDockComponent_getHighestStackOrder() {
|
1114
|
+
if (__classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f").length === 0) {
|
1115
|
+
return 0;
|
1116
|
+
}
|
1117
|
+
return __classPrivateFieldGet(this, _SkyDockComponent_itemRefs, "f")[0].stackOrder + 1;
|
1118
|
+
};
|
1071
1119
|
SkyDockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDockComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.Injector }, { token: SkyDockDomAdapterService }], target: i0.ɵɵFactoryTarget.Component });
|
1072
1120
|
SkyDockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: SkyDockComponent, selector: "sky-dock", providers: [SkyDockDomAdapterService], viewQueries: [{ propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #target></ng-container>\n", styles: [":host{display:flex;flex-direction:column;width:100%}:host:not(.sky-dock-unbound){position:fixed;left:0;bottom:0;right:0}:host.sky-dock-sticky{position:sticky}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1073
1121
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDockComponent, decorators: [{
|
@@ -1150,20 +1198,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
1150
1198
|
}]
|
1151
1199
|
}] });
|
1152
1200
|
|
1201
|
+
var _SkyDynamicComponentService_instances, _SkyDynamicComponentService_applicationRef, _SkyDynamicComponentService_componentFactoryResolver, _SkyDynamicComponentService_injector, _SkyDynamicComponentService_renderer, _SkyDynamicComponentService_windowRef, _SkyDynamicComponentService_getRootNode;
|
1153
1202
|
/**
|
1154
1203
|
* Angular service for creating and rendering a dynamic component.
|
1155
1204
|
*/
|
1156
1205
|
class SkyDynamicComponentService {
|
1206
|
+
// TODO: Replace deprecated `ComponentFactoryResolver`.
|
1157
1207
|
constructor(componentFactoryResolver, applicationRef, injector, windowRef, rendererFactory) {
|
1158
|
-
this
|
1159
|
-
this
|
1160
|
-
this
|
1161
|
-
this
|
1208
|
+
_SkyDynamicComponentService_instances.add(this);
|
1209
|
+
_SkyDynamicComponentService_applicationRef.set(this, void 0);
|
1210
|
+
_SkyDynamicComponentService_componentFactoryResolver.set(this, void 0);
|
1211
|
+
_SkyDynamicComponentService_injector.set(this, void 0);
|
1212
|
+
_SkyDynamicComponentService_renderer.set(this, void 0);
|
1213
|
+
_SkyDynamicComponentService_windowRef.set(this, void 0);
|
1214
|
+
__classPrivateFieldSet(this, _SkyDynamicComponentService_componentFactoryResolver, componentFactoryResolver, "f");
|
1215
|
+
__classPrivateFieldSet(this, _SkyDynamicComponentService_applicationRef, applicationRef, "f");
|
1216
|
+
__classPrivateFieldSet(this, _SkyDynamicComponentService_injector, injector, "f");
|
1217
|
+
__classPrivateFieldSet(this, _SkyDynamicComponentService_windowRef, windowRef, "f");
|
1162
1218
|
// Based on suggestions from https://github.com/angular/angular/issues/17824
|
1163
1219
|
// for accessing an instance of Renderer2 in a service since Renderer2 can't
|
1164
1220
|
// be injected into a service. Passing undefined for both parameters results
|
1165
1221
|
// in the default renderer which is what we want here.
|
1166
|
-
this
|
1222
|
+
__classPrivateFieldSet(this, _SkyDynamicComponentService_renderer, rendererFactory.createRenderer(undefined, null), "f");
|
1167
1223
|
}
|
1168
1224
|
/**
|
1169
1225
|
* Creates an instance of the specified component and adds it to the specified location
|
@@ -1176,29 +1232,35 @@ class SkyDynamicComponentService {
|
|
1176
1232
|
};
|
1177
1233
|
const injector = Injector.create({
|
1178
1234
|
providers: options.providers || [],
|
1179
|
-
parent: this
|
1235
|
+
parent: __classPrivateFieldGet(this, _SkyDynamicComponentService_injector, "f"),
|
1180
1236
|
});
|
1181
|
-
const componentRef = this
|
1237
|
+
const componentRef = __classPrivateFieldGet(this, _SkyDynamicComponentService_componentFactoryResolver, "f")
|
1182
1238
|
.resolveComponentFactory(componentType)
|
1183
1239
|
.create(injector);
|
1184
|
-
this.
|
1185
|
-
const el = this.
|
1186
|
-
const bodyEl = this.
|
1240
|
+
__classPrivateFieldGet(this, _SkyDynamicComponentService_applicationRef, "f").attachView(componentRef.hostView);
|
1241
|
+
const el = __classPrivateFieldGet(this, _SkyDynamicComponentService_instances, "m", _SkyDynamicComponentService_getRootNode).call(this, componentRef);
|
1242
|
+
const bodyEl = __classPrivateFieldGet(this, _SkyDynamicComponentService_windowRef, "f").nativeWindow.document.body;
|
1187
1243
|
switch (options.location) {
|
1188
1244
|
case SkyDynamicComponentLocation.BeforeElement:
|
1189
|
-
|
1245
|
+
if (!options.referenceEl) {
|
1246
|
+
throw new Error('[SkyDynamicComponentService] Could not create a component at location `SkyDynamicComponentLocation.BeforeElement` because a reference element was not provided.');
|
1247
|
+
}
|
1248
|
+
__classPrivateFieldGet(this, _SkyDynamicComponentService_renderer, "f").insertBefore(options.referenceEl.parentElement, el, options.referenceEl);
|
1190
1249
|
break;
|
1191
1250
|
case SkyDynamicComponentLocation.ElementTop:
|
1192
|
-
|
1251
|
+
if (!options.referenceEl) {
|
1252
|
+
throw new Error('[SkyDynamicComponentService] Could not create a component at location `SkyDynamicComponentLocation.ElementTop` because a reference element was not provided.');
|
1253
|
+
}
|
1254
|
+
__classPrivateFieldGet(this, _SkyDynamicComponentService_renderer, "f").insertBefore(options.referenceEl, el, options.referenceEl.firstChild);
|
1193
1255
|
break;
|
1194
1256
|
case SkyDynamicComponentLocation.ElementBottom:
|
1195
|
-
this.
|
1257
|
+
__classPrivateFieldGet(this, _SkyDynamicComponentService_renderer, "f").appendChild(options.referenceEl, el);
|
1196
1258
|
break;
|
1197
1259
|
case SkyDynamicComponentLocation.BodyTop:
|
1198
|
-
this.
|
1260
|
+
__classPrivateFieldGet(this, _SkyDynamicComponentService_renderer, "f").insertBefore(bodyEl, el, bodyEl.firstChild);
|
1199
1261
|
break;
|
1200
1262
|
default:
|
1201
|
-
this.
|
1263
|
+
__classPrivateFieldGet(this, _SkyDynamicComponentService_renderer, "f").appendChild(bodyEl, el);
|
1202
1264
|
break;
|
1203
1265
|
}
|
1204
1266
|
return componentRef;
|
@@ -1211,15 +1273,15 @@ class SkyDynamicComponentService {
|
|
1211
1273
|
if (!componentRef) {
|
1212
1274
|
return;
|
1213
1275
|
}
|
1214
|
-
this.
|
1276
|
+
__classPrivateFieldGet(this, _SkyDynamicComponentService_applicationRef, "f").detachView(componentRef.hostView);
|
1215
1277
|
componentRef.destroy();
|
1216
1278
|
}
|
1217
|
-
getRootNode(componentRef) {
|
1218
|
-
// Technique for retrieving the component's root node taken from here:
|
1219
|
-
// https://malcoded.com/posts/angular-dynamic-components
|
1220
|
-
return componentRef.hostView.rootNodes[0];
|
1221
|
-
}
|
1222
1279
|
}
|
1280
|
+
_SkyDynamicComponentService_applicationRef = new WeakMap(), _SkyDynamicComponentService_componentFactoryResolver = new WeakMap(), _SkyDynamicComponentService_injector = new WeakMap(), _SkyDynamicComponentService_renderer = new WeakMap(), _SkyDynamicComponentService_windowRef = new WeakMap(), _SkyDynamicComponentService_instances = new WeakSet(), _SkyDynamicComponentService_getRootNode = function _SkyDynamicComponentService_getRootNode(componentRef) {
|
1281
|
+
// Technique for retrieving the component's root node taken from here:
|
1282
|
+
// https://malcoded.com/posts/angular-dynamic-components
|
1283
|
+
return componentRef.hostView.rootNodes[0];
|
1284
|
+
};
|
1223
1285
|
SkyDynamicComponentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDynamicComponentService, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ApplicationRef }, { token: i0.Injector }, { token: SkyAppWindowRef }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1224
1286
|
SkyDynamicComponentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDynamicComponentService, providedIn: 'any' });
|
1225
1287
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDynamicComponentService, decorators: [{
|
@@ -1232,12 +1294,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
1232
1294
|
}]
|
1233
1295
|
}], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }, { type: i0.Injector }, { type: SkyAppWindowRef }, { type: i0.RendererFactory2 }]; } });
|
1234
1296
|
|
1297
|
+
var _SkyDockService_instances, _SkyDockService_dynamicComponentSvc, _SkyDockService_options, _SkyDockService_createDock, _SkyDockService_destroyDock;
|
1235
1298
|
/**
|
1236
1299
|
* This service docks components to specific areas on the page.
|
1237
1300
|
*/
|
1238
1301
|
class SkyDockService {
|
1239
|
-
constructor(
|
1240
|
-
this
|
1302
|
+
constructor(dynamicComponentSvc) {
|
1303
|
+
_SkyDockService_instances.add(this);
|
1304
|
+
_SkyDockService_dynamicComponentSvc.set(this, void 0);
|
1305
|
+
_SkyDockService_options.set(this, void 0);
|
1306
|
+
__classPrivateFieldSet(this, _SkyDockService_dynamicComponentSvc, dynamicComponentSvc, "f");
|
1241
1307
|
}
|
1242
1308
|
/**
|
1243
1309
|
* Returns all docked items.
|
@@ -1251,16 +1317,15 @@ class SkyDockService {
|
|
1251
1317
|
* @param config Options that affect the docking action.
|
1252
1318
|
*/
|
1253
1319
|
insertComponent(component, config) {
|
1254
|
-
|
1255
|
-
this.
|
1256
|
-
|
1257
|
-
const itemRef = SkyDockService.dockRef.instance.insertComponent(component, config);
|
1320
|
+
const dockRef = (SkyDockService.dockRef =
|
1321
|
+
SkyDockService.dockRef || __classPrivateFieldGet(this, _SkyDockService_instances, "m", _SkyDockService_createDock).call(this));
|
1322
|
+
const itemRef = dockRef.instance.insertComponent(component, config);
|
1258
1323
|
const item = new SkyDockItem(itemRef.componentRef.instance, itemRef.stackOrder);
|
1259
1324
|
item.destroyed.subscribe(() => {
|
1260
|
-
|
1325
|
+
dockRef.instance.removeItem(itemRef);
|
1261
1326
|
SkyDockService._items.splice(SkyDockService._items.indexOf(item), 1);
|
1262
1327
|
if (SkyDockService._items.length === 0) {
|
1263
|
-
this.
|
1328
|
+
__classPrivateFieldGet(this, _SkyDockService_instances, "m", _SkyDockService_destroyDock).call(this);
|
1264
1329
|
}
|
1265
1330
|
});
|
1266
1331
|
SkyDockService._items.push(item);
|
@@ -1275,36 +1340,36 @@ class SkyDockService {
|
|
1275
1340
|
* @param options The options for positioning and styling
|
1276
1341
|
*/
|
1277
1342
|
setDockOptions(options) {
|
1278
|
-
this
|
1279
|
-
}
|
1280
|
-
createDock() {
|
1281
|
-
let dockOptions;
|
1282
|
-
if (this.options) {
|
1283
|
-
let dynamicLocation;
|
1284
|
-
switch (this.options.location) {
|
1285
|
-
case SkyDockLocation.BeforeElement:
|
1286
|
-
dynamicLocation = SkyDynamicComponentLocation.BeforeElement;
|
1287
|
-
break;
|
1288
|
-
case SkyDockLocation.ElementBottom:
|
1289
|
-
dynamicLocation = SkyDynamicComponentLocation.ElementBottom;
|
1290
|
-
break;
|
1291
|
-
default:
|
1292
|
-
dynamicLocation = SkyDynamicComponentLocation.BodyTop;
|
1293
|
-
break;
|
1294
|
-
}
|
1295
|
-
dockOptions = {
|
1296
|
-
location: dynamicLocation,
|
1297
|
-
referenceEl: this.options.referenceEl,
|
1298
|
-
};
|
1299
|
-
}
|
1300
|
-
SkyDockService.dockRef = this.dynamicComponentService.createComponent(SkyDockComponent, dockOptions);
|
1301
|
-
SkyDockService.dockRef.instance.setOptions(this.options);
|
1302
|
-
}
|
1303
|
-
destroyDock() {
|
1304
|
-
this.dynamicComponentService.removeComponent(SkyDockService.dockRef);
|
1305
|
-
SkyDockService.dockRef = undefined;
|
1343
|
+
__classPrivateFieldSet(this, _SkyDockService_options, options, "f");
|
1306
1344
|
}
|
1307
1345
|
}
|
1346
|
+
_SkyDockService_dynamicComponentSvc = new WeakMap(), _SkyDockService_options = new WeakMap(), _SkyDockService_instances = new WeakSet(), _SkyDockService_createDock = function _SkyDockService_createDock() {
|
1347
|
+
let dockOptions;
|
1348
|
+
if (__classPrivateFieldGet(this, _SkyDockService_options, "f")) {
|
1349
|
+
let dynamicLocation;
|
1350
|
+
switch (__classPrivateFieldGet(this, _SkyDockService_options, "f").location) {
|
1351
|
+
case SkyDockLocation.BeforeElement:
|
1352
|
+
dynamicLocation = SkyDynamicComponentLocation.BeforeElement;
|
1353
|
+
break;
|
1354
|
+
case SkyDockLocation.ElementBottom:
|
1355
|
+
dynamicLocation = SkyDynamicComponentLocation.ElementBottom;
|
1356
|
+
break;
|
1357
|
+
default:
|
1358
|
+
dynamicLocation = SkyDynamicComponentLocation.BodyTop;
|
1359
|
+
break;
|
1360
|
+
}
|
1361
|
+
dockOptions = {
|
1362
|
+
location: dynamicLocation,
|
1363
|
+
referenceEl: __classPrivateFieldGet(this, _SkyDockService_options, "f").referenceEl,
|
1364
|
+
};
|
1365
|
+
}
|
1366
|
+
const dockRef = __classPrivateFieldGet(this, _SkyDockService_dynamicComponentSvc, "f").createComponent(SkyDockComponent, dockOptions);
|
1367
|
+
dockRef.instance.setOptions(__classPrivateFieldGet(this, _SkyDockService_options, "f"));
|
1368
|
+
return dockRef;
|
1369
|
+
}, _SkyDockService_destroyDock = function _SkyDockService_destroyDock() {
|
1370
|
+
__classPrivateFieldGet(this, _SkyDockService_dynamicComponentSvc, "f").removeComponent(SkyDockService.dockRef);
|
1371
|
+
SkyDockService.dockRef = undefined;
|
1372
|
+
};
|
1308
1373
|
SkyDockService._items = [];
|
1309
1374
|
SkyDockService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDockService, deps: [{ token: SkyDynamicComponentService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1310
1375
|
SkyDockService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyDockService, providedIn: 'any' });
|
@@ -1433,17 +1498,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
1433
1498
|
*/
|
1434
1499
|
const SKY_LOG_LEVEL = new InjectionToken('SkyLogLevel');
|
1435
1500
|
|
1501
|
+
var _SkyLogService_instances, _SkyLogService_applicationLogLevel, _SkyLogService_formatter, _SkyLogService_convertStringToCode, _SkyLogService_canLog, _SkyLogService_logBasedOnLevel;
|
1436
1502
|
/**
|
1437
1503
|
* Logs information to the console based on the application's log level as provided by the `SKY_LOG_LEVEL` injection token. If no token is provided, only `error` logs will be shown.
|
1438
1504
|
* @internal
|
1439
1505
|
*/
|
1440
1506
|
class SkyLogService {
|
1441
1507
|
constructor(formatter, applicationLogLevel) {
|
1442
|
-
this
|
1443
|
-
this
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1508
|
+
_SkyLogService_instances.add(this);
|
1509
|
+
_SkyLogService_applicationLogLevel.set(this, void 0);
|
1510
|
+
_SkyLogService_formatter.set(this, void 0);
|
1511
|
+
__classPrivateFieldSet(this, _SkyLogService_formatter, formatter, "f");
|
1512
|
+
__classPrivateFieldSet(this, _SkyLogService_applicationLogLevel, applicationLogLevel !== null && applicationLogLevel !== void 0 ? applicationLogLevel : 3 /* Error */, "f");
|
1447
1513
|
}
|
1448
1514
|
/**
|
1449
1515
|
* Logs a deprecation warning for a class, property, function, etc. This will be logged as a console warning unless a different log level is given in the the `args` parameter.
|
@@ -1455,17 +1521,17 @@ class SkyLogService {
|
|
1455
1521
|
var _a;
|
1456
1522
|
return __awaiter(this, void 0, void 0, function* () {
|
1457
1523
|
const logLevel = (_a = args === null || args === void 0 ? void 0 : args.logLevel) !== null && _a !== void 0 ? _a : 2 /* Warn */;
|
1458
|
-
name = this.
|
1459
|
-
if (this.
|
1524
|
+
name = __classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_convertStringToCode).call(this, name);
|
1525
|
+
if (__classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_canLog).call(this, logLevel)) {
|
1460
1526
|
const localizedStrings = [];
|
1461
1527
|
if (args === null || args === void 0 ? void 0 : args.deprecationMajorVersion) {
|
1462
|
-
localizedStrings.push(this.
|
1528
|
+
localizedStrings.push(__classPrivateFieldGet(this, _SkyLogService_formatter, "f").formatText('{0} is deprecated starting in SKY UX {1}.', name, args.deprecationMajorVersion.toLocaleString()));
|
1463
1529
|
}
|
1464
1530
|
else {
|
1465
|
-
localizedStrings.push(this.
|
1531
|
+
localizedStrings.push(__classPrivateFieldGet(this, _SkyLogService_formatter, "f").formatText('{0} is deprecated.', name));
|
1466
1532
|
}
|
1467
1533
|
if (args === null || args === void 0 ? void 0 : args.removalMajorVersion) {
|
1468
|
-
localizedStrings.push(this.
|
1534
|
+
localizedStrings.push(__classPrivateFieldGet(this, _SkyLogService_formatter, "f").formatText('We will remove it in version {0}.', args.removalMajorVersion.toLocaleString()));
|
1469
1535
|
}
|
1470
1536
|
else {
|
1471
1537
|
localizedStrings.push('We will remove it in a future major version.');
|
@@ -1474,9 +1540,9 @@ class SkyLogService {
|
|
1474
1540
|
localizedStrings.push(args.replacementRecommendation);
|
1475
1541
|
}
|
1476
1542
|
if (args === null || args === void 0 ? void 0 : args.moreInfoUrl) {
|
1477
|
-
localizedStrings.push(this.
|
1543
|
+
localizedStrings.push(__classPrivateFieldGet(this, _SkyLogService_formatter, "f").formatText('For more information, see {0}.', args.moreInfoUrl));
|
1478
1544
|
}
|
1479
|
-
this.
|
1545
|
+
__classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_logBasedOnLevel).call(this, logLevel, localizedStrings.join(' '));
|
1480
1546
|
}
|
1481
1547
|
return Promise.resolve();
|
1482
1548
|
});
|
@@ -1487,7 +1553,7 @@ class SkyLogService {
|
|
1487
1553
|
* @param params Optional parameters for the error message.
|
1488
1554
|
*/
|
1489
1555
|
error(message, params) {
|
1490
|
-
if (this.
|
1556
|
+
if (__classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_canLog).call(this, 3 /* Error */)) {
|
1491
1557
|
if (params) {
|
1492
1558
|
console.error(message, ...params);
|
1493
1559
|
}
|
@@ -1502,7 +1568,7 @@ class SkyLogService {
|
|
1502
1568
|
* @param params Optional parameters for the informational message.
|
1503
1569
|
*/
|
1504
1570
|
info(message, params) {
|
1505
|
-
if (this.
|
1571
|
+
if (__classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_canLog).call(this, 1 /* Info */)) {
|
1506
1572
|
if (params) {
|
1507
1573
|
console.log(message, ...params);
|
1508
1574
|
}
|
@@ -1517,7 +1583,7 @@ class SkyLogService {
|
|
1517
1583
|
* @param params Optional parameters for the warning message.
|
1518
1584
|
*/
|
1519
1585
|
warn(message, params) {
|
1520
|
-
if (this.
|
1586
|
+
if (__classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_canLog).call(this, 2 /* Warn */)) {
|
1521
1587
|
if (params) {
|
1522
1588
|
console.warn(message, ...params);
|
1523
1589
|
}
|
@@ -1526,29 +1592,27 @@ class SkyLogService {
|
|
1526
1592
|
}
|
1527
1593
|
}
|
1528
1594
|
}
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
return typeString;
|
1595
|
+
}
|
1596
|
+
_SkyLogService_applicationLogLevel = new WeakMap(), _SkyLogService_formatter = new WeakMap(), _SkyLogService_instances = new WeakSet(), _SkyLogService_convertStringToCode = function _SkyLogService_convertStringToCode(typeString) {
|
1597
|
+
if (typeString.charAt(0) !== '`' && typeString.charAt(-1) !== '`') {
|
1598
|
+
typeString = '`' + typeString + '`';
|
1534
1599
|
}
|
1535
|
-
|
1536
|
-
|
1600
|
+
return typeString;
|
1601
|
+
}, _SkyLogService_canLog = function _SkyLogService_canLog(intendedLogLevel) {
|
1602
|
+
return intendedLogLevel >= __classPrivateFieldGet(this, _SkyLogService_applicationLogLevel, "f");
|
1603
|
+
}, _SkyLogService_logBasedOnLevel = function _SkyLogService_logBasedOnLevel(logLevel, message, params) {
|
1604
|
+
switch (logLevel) {
|
1605
|
+
case 1 /* Info */:
|
1606
|
+
this.info(message, params);
|
1607
|
+
break;
|
1608
|
+
case 2 /* Warn */:
|
1609
|
+
this.warn(message, params);
|
1610
|
+
break;
|
1611
|
+
case 3 /* Error */:
|
1612
|
+
this.error(message, params);
|
1613
|
+
break;
|
1537
1614
|
}
|
1538
|
-
|
1539
|
-
switch (logLevel) {
|
1540
|
-
case 1 /* Info */:
|
1541
|
-
this.info(message, params);
|
1542
|
-
break;
|
1543
|
-
case 2 /* Warn */:
|
1544
|
-
this.warn(message, params);
|
1545
|
-
break;
|
1546
|
-
case 3 /* Error */:
|
1547
|
-
this.error(message, params);
|
1548
|
-
break;
|
1549
|
-
}
|
1550
|
-
}
|
1551
|
-
}
|
1615
|
+
};
|
1552
1616
|
SkyLogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyLogService, deps: [{ token: SkyAppFormat }, { token: SKY_LOG_LEVEL, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
1553
1617
|
SkyLogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyLogService, providedIn: 'root' });
|
1554
1618
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyLogService, decorators: [{
|
@@ -1579,12 +1643,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
1579
1643
|
args: [{}]
|
1580
1644
|
}] });
|
1581
1645
|
|
1646
|
+
var _SkyMediaQueryService_instances, _SkyMediaQueryService_currentSubject, _SkyMediaQueryService_currentBreakpoint, _SkyMediaQueryService_breakpoints, _SkyMediaQueryService_mediaQueries, _SkyMediaQueryService_zone, _SkyMediaQueryService_addListeners, _SkyMediaQueryService_removeListeners, _SkyMediaQueryService_notifyBreakpointChange;
|
1647
|
+
const DEFAULT_BREAKPOINT$1 = SkyMediaBreakpoints.md;
|
1582
1648
|
class SkyMediaQueryService {
|
1583
1649
|
constructor(zone) {
|
1584
|
-
this
|
1585
|
-
this
|
1586
|
-
this
|
1587
|
-
this
|
1650
|
+
_SkyMediaQueryService_instances.add(this);
|
1651
|
+
_SkyMediaQueryService_currentSubject.set(this, new BehaviorSubject(DEFAULT_BREAKPOINT$1));
|
1652
|
+
_SkyMediaQueryService_currentBreakpoint.set(this, DEFAULT_BREAKPOINT$1);
|
1653
|
+
_SkyMediaQueryService_breakpoints.set(this, [
|
1588
1654
|
{
|
1589
1655
|
mediaQueryString: SkyMediaQueryService.xs,
|
1590
1656
|
name: SkyMediaBreakpoints.xs,
|
@@ -1601,26 +1667,28 @@ class SkyMediaQueryService {
|
|
1601
1667
|
mediaQueryString: SkyMediaQueryService.lg,
|
1602
1668
|
name: SkyMediaBreakpoints.lg,
|
1603
1669
|
},
|
1604
|
-
];
|
1605
|
-
this
|
1606
|
-
|
1670
|
+
]);
|
1671
|
+
_SkyMediaQueryService_mediaQueries.set(this, []);
|
1672
|
+
_SkyMediaQueryService_zone.set(this, void 0);
|
1673
|
+
__classPrivateFieldSet(this, _SkyMediaQueryService_zone, zone, "f");
|
1674
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_instances, "m", _SkyMediaQueryService_addListeners).call(this);
|
1607
1675
|
}
|
1608
1676
|
/**
|
1609
1677
|
* Returns the current breakpoint.
|
1610
1678
|
*/
|
1611
1679
|
get current() {
|
1612
|
-
return this
|
1680
|
+
return __classPrivateFieldGet(this, _SkyMediaQueryService_currentBreakpoint, "f");
|
1613
1681
|
}
|
1614
1682
|
ngOnDestroy() {
|
1615
|
-
this.
|
1616
|
-
this.
|
1683
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_instances, "m", _SkyMediaQueryService_removeListeners).call(this);
|
1684
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_currentSubject, "f").complete();
|
1617
1685
|
}
|
1618
1686
|
/**
|
1619
1687
|
* Subscribes to screen size changes.
|
1620
1688
|
* @param listener Specifies a function that is called when breakpoints change.
|
1621
1689
|
*/
|
1622
1690
|
subscribe(listener) {
|
1623
|
-
return this.
|
1691
|
+
return __classPrivateFieldGet(this, _SkyMediaQueryService_currentSubject, "f").subscribe({
|
1624
1692
|
next: (breakpoints) => {
|
1625
1693
|
listener(breakpoints);
|
1626
1694
|
},
|
@@ -1630,43 +1698,41 @@ class SkyMediaQueryService {
|
|
1630
1698
|
* @internal
|
1631
1699
|
*/
|
1632
1700
|
destroy() {
|
1633
|
-
this.
|
1634
|
-
this.
|
1635
|
-
}
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
}
|
1648
|
-
};
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
}
|
1658
|
-
}
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
}
|
1669
|
-
}
|
1701
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_instances, "m", _SkyMediaQueryService_removeListeners).call(this);
|
1702
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_currentSubject, "f").complete();
|
1703
|
+
}
|
1704
|
+
}
|
1705
|
+
_SkyMediaQueryService_currentSubject = new WeakMap(), _SkyMediaQueryService_currentBreakpoint = new WeakMap(), _SkyMediaQueryService_breakpoints = new WeakMap(), _SkyMediaQueryService_mediaQueries = new WeakMap(), _SkyMediaQueryService_zone = new WeakMap(), _SkyMediaQueryService_instances = new WeakSet(), _SkyMediaQueryService_addListeners = function _SkyMediaQueryService_addListeners() {
|
1706
|
+
__classPrivateFieldSet(this, _SkyMediaQueryService_mediaQueries, __classPrivateFieldGet(this, _SkyMediaQueryService_breakpoints, "f").map((breakpoint) => {
|
1707
|
+
const mq = matchMedia(breakpoint.mediaQueryString);
|
1708
|
+
const listener = (event) => {
|
1709
|
+
// Run the check outside of Angular's change detection since Angular
|
1710
|
+
// does not wrap matchMedia listeners in NgZone.
|
1711
|
+
// See: https://blog.assaf.co/angular-2-change-detection-zones-and-an-example/
|
1712
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_zone, "f").run(() => {
|
1713
|
+
if (event.matches) {
|
1714
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_instances, "m", _SkyMediaQueryService_notifyBreakpointChange).call(this, breakpoint.name);
|
1715
|
+
}
|
1716
|
+
});
|
1717
|
+
};
|
1718
|
+
mq.addListener(listener);
|
1719
|
+
if (mq.matches) {
|
1720
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_instances, "m", _SkyMediaQueryService_notifyBreakpointChange).call(this, breakpoint.name);
|
1721
|
+
}
|
1722
|
+
return {
|
1723
|
+
mediaQueryList: mq,
|
1724
|
+
listener,
|
1725
|
+
};
|
1726
|
+
}), "f");
|
1727
|
+
}, _SkyMediaQueryService_removeListeners = function _SkyMediaQueryService_removeListeners() {
|
1728
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_mediaQueries, "f").forEach((mediaQuery) => {
|
1729
|
+
mediaQuery.mediaQueryList.removeListener(mediaQuery.listener);
|
1730
|
+
});
|
1731
|
+
__classPrivateFieldSet(this, _SkyMediaQueryService_mediaQueries, [], "f");
|
1732
|
+
}, _SkyMediaQueryService_notifyBreakpointChange = function _SkyMediaQueryService_notifyBreakpointChange(breakpoint) {
|
1733
|
+
__classPrivateFieldSet(this, _SkyMediaQueryService_currentBreakpoint, breakpoint, "f");
|
1734
|
+
__classPrivateFieldGet(this, _SkyMediaQueryService_currentSubject, "f").next(breakpoint);
|
1735
|
+
};
|
1670
1736
|
/**
|
1671
1737
|
* The size for the `xs` breakpoint.
|
1672
1738
|
* @default "(max-width: 767px)"
|
@@ -1825,25 +1891,28 @@ class SkyNumberFormatUtility {
|
|
1825
1891
|
}
|
1826
1892
|
SkyNumberFormatUtility._NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
|
1827
1893
|
|
1894
|
+
var _SkyNumericService_instances, _SkyNumericService_resourcesSvc, _SkyNumericService_symbolIndex, _SkyNumericService_roundNumber, _SkyNumericService_scaleNumberByPowerOfTen, _SkyNumericService_storeShortenSymbol, _SkyNumericService_replaceShortenSymbol, _SkyNumericService_getSymbol;
|
1828
1895
|
class SkyNumericService {
|
1829
|
-
constructor(
|
1830
|
-
this
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
this
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1896
|
+
constructor(resourcesSvc) {
|
1897
|
+
_SkyNumericService_instances.add(this);
|
1898
|
+
/**
|
1899
|
+
* The browser's current locale.
|
1900
|
+
* @internal
|
1901
|
+
*/
|
1902
|
+
this.currentLocale = 'en-US';
|
1903
|
+
/**
|
1904
|
+
* @internal
|
1905
|
+
*/
|
1906
|
+
this.shortSymbol = '';
|
1907
|
+
_SkyNumericService_resourcesSvc.set(this, void 0);
|
1908
|
+
_SkyNumericService_symbolIndex.set(this, void 0);
|
1909
|
+
__classPrivateFieldSet(this, _SkyNumericService_resourcesSvc, resourcesSvc, "f");
|
1910
|
+
__classPrivateFieldSet(this, _SkyNumericService_symbolIndex, [
|
1911
|
+
{ value: 1e12, label: __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_getSymbol).call(this, 'skyux_numeric_trillions_symbol') },
|
1912
|
+
{ value: 1e9, label: __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_getSymbol).call(this, 'skyux_numeric_billions_symbol') },
|
1913
|
+
{ value: 1e6, label: __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_getSymbol).call(this, 'skyux_numeric_millions_symbol') },
|
1914
|
+
{ value: 1e3, label: __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_getSymbol).call(this, 'skyux_numeric_thousands_symbol') },
|
1915
|
+
], "f");
|
1847
1916
|
}
|
1848
1917
|
/**
|
1849
1918
|
* Formats a number based on the provided options.
|
@@ -1856,20 +1925,23 @@ class SkyNumericService {
|
|
1856
1925
|
return '';
|
1857
1926
|
}
|
1858
1927
|
const decimalPlaceRegExp = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
1928
|
+
const locale = options.locale || this.currentLocale;
|
1929
|
+
const digits = options.digits || 0;
|
1859
1930
|
// Get the symbol for the number after rounding, since rounding could push the number
|
1860
1931
|
// into a different symbol range.
|
1861
|
-
let roundedNumber = this.
|
1932
|
+
let roundedNumber = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_roundNumber).call(this, value, digits);
|
1862
1933
|
const roundedNumberAbs = Math.abs(roundedNumber);
|
1863
1934
|
let suffix = '';
|
1864
|
-
for (let i = 0; i < this.
|
1865
|
-
let symbol = this
|
1935
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f").length; i++) {
|
1936
|
+
let symbol = __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f")[i];
|
1866
1937
|
if (options.truncate &&
|
1938
|
+
options.truncateAfter &&
|
1867
1939
|
roundedNumberAbs >= options.truncateAfter &&
|
1868
1940
|
roundedNumberAbs >= symbol.value) {
|
1869
|
-
roundedNumber = this.
|
1941
|
+
roundedNumber = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_roundNumber).call(this, value / symbol.value, digits);
|
1870
1942
|
if (Math.abs(roundedNumber) === 1000 && i > 0) {
|
1871
1943
|
// Rounding caused the number to cross into the range of the next symbol.
|
1872
|
-
symbol = this
|
1944
|
+
symbol = __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f")[i - 1];
|
1873
1945
|
roundedNumber /= 1000;
|
1874
1946
|
}
|
1875
1947
|
suffix = symbol.label;
|
@@ -1877,10 +1949,9 @@ class SkyNumericService {
|
|
1877
1949
|
}
|
1878
1950
|
}
|
1879
1951
|
let output = roundedNumber.toString().replace(decimalPlaceRegExp, '$1') + suffix;
|
1880
|
-
this.
|
1881
|
-
|
1882
|
-
let
|
1883
|
-
let isDecimal;
|
1952
|
+
__classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_storeShortenSymbol).call(this, output);
|
1953
|
+
let digitsFormatted;
|
1954
|
+
let isDecimal = false;
|
1884
1955
|
// Checks the string entered for format. Using toLowerCase to ignore case.
|
1885
1956
|
switch ((_a = options.format) === null || _a === void 0 ? void 0 : _a.toLowerCase()) {
|
1886
1957
|
// In a case where a decimal value was not shortened and
|
@@ -1891,20 +1962,21 @@ class SkyNumericService {
|
|
1891
1962
|
case 'currency':
|
1892
1963
|
isDecimal = value % 1 !== 0;
|
1893
1964
|
if (options.minDigits) {
|
1894
|
-
|
1965
|
+
digitsFormatted = `1.${options.minDigits}-${digits}`;
|
1895
1966
|
}
|
1896
|
-
else if (isDecimal &&
|
1897
|
-
|
1967
|
+
else if (isDecimal && digits >= 2) {
|
1968
|
+
digitsFormatted = `1.2-${digits}`;
|
1898
1969
|
}
|
1899
1970
|
else {
|
1900
|
-
|
1971
|
+
digitsFormatted = `1.0-${digits}`;
|
1901
1972
|
}
|
1902
|
-
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Currency,
|
1973
|
+
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Currency, digitsFormatted, options.iso,
|
1903
1974
|
// Angular 5+ needs a string for this parameter, but Angular 4 needs a boolean.
|
1904
1975
|
// To support both versions we can supply 'symbol' which will evaluate truthy for Angular 4
|
1905
1976
|
// and the appropriate string value for Angular 5+.
|
1906
1977
|
// See: https://angular.io/api/common/CurrencyPipe#parameters
|
1907
1978
|
'symbol', options.currencySign);
|
1979
|
+
// ^^^^^^ Result can't be null since the sanitized input is always a number.
|
1908
1980
|
break;
|
1909
1981
|
// The following is a catch-all to ensure that if
|
1910
1982
|
// anything but currency (or a future option) are entered,
|
@@ -1913,91 +1985,69 @@ class SkyNumericService {
|
|
1913
1985
|
// Ensures localization of the number to ensure comma and
|
1914
1986
|
// decimal separator
|
1915
1987
|
if (options.minDigits) {
|
1916
|
-
|
1988
|
+
digitsFormatted = `1.${options.minDigits}-${digits}`;
|
1917
1989
|
}
|
1918
1990
|
else if (options.truncate) {
|
1919
|
-
|
1991
|
+
digitsFormatted = `1.0-${digits}`;
|
1920
1992
|
}
|
1921
1993
|
else {
|
1922
|
-
|
1994
|
+
digitsFormatted = `1.${digits}-${digits}`;
|
1923
1995
|
}
|
1924
|
-
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Decimal,
|
1996
|
+
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Decimal, digitsFormatted);
|
1997
|
+
// ^^^^^^ Result can't be null since the sanitized input is always a number.
|
1925
1998
|
break;
|
1926
1999
|
}
|
1927
2000
|
if (options.truncate) {
|
1928
|
-
output = this.
|
2001
|
+
output = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_replaceShortenSymbol).call(this, output);
|
1929
2002
|
}
|
1930
2003
|
return output;
|
1931
2004
|
}
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
* are not guaranteed to be represented or rounded correctly
|
1937
|
-
* @param value - value to round
|
1938
|
-
* @param precision - what precision to round with, defaults to 0 decimal places
|
1939
|
-
*/
|
1940
|
-
roundNumber(value, precision = 0) {
|
1941
|
-
if (precision < 0) {
|
1942
|
-
throw new Error('SkyInvalidArgument: precision must be >= 0');
|
1943
|
-
}
|
1944
|
-
/* Sanity check - ignoring coverage but should not ignore if we make this method public */
|
1945
|
-
/* istanbul ignore next */
|
1946
|
-
if (isNaN(value) || value === null) {
|
1947
|
-
return 0;
|
1948
|
-
}
|
1949
|
-
const scaledValue = this.scaleNumberByPowerOfTen(value, precision, true);
|
1950
|
-
const scaledRoundedValue = Math.round(scaledValue);
|
1951
|
-
const unscaledRoundedValue = this.scaleNumberByPowerOfTen(scaledRoundedValue, precision, false);
|
1952
|
-
return unscaledRoundedValue;
|
1953
|
-
}
|
1954
|
-
/**
|
1955
|
-
* Scales a given number by a power of 10
|
1956
|
-
* @param value - value to scale
|
1957
|
-
* @param scalar - 10^scalar
|
1958
|
-
* @param scaleUp - whether to increase or decrease the value
|
1959
|
-
*/
|
1960
|
-
scaleNumberByPowerOfTen(value, scalar, scaleUp) {
|
1961
|
-
const valueStr = value.toString().toLowerCase();
|
1962
|
-
const isExponentFormat = valueStr.includes('e');
|
1963
|
-
if (isExponentFormat) {
|
1964
|
-
const [base, exp] = valueStr.split('e');
|
1965
|
-
const newExp = scaleUp ? Number(exp) + scalar : Number(exp) - scalar;
|
1966
|
-
return Number(`${base}e${newExp}`);
|
1967
|
-
}
|
1968
|
-
else {
|
1969
|
-
const e = scaleUp ? 'e' : 'e-';
|
1970
|
-
return Number(`${value}${e}${scalar}`);
|
1971
|
-
}
|
2005
|
+
}
|
2006
|
+
_SkyNumericService_resourcesSvc = new WeakMap(), _SkyNumericService_symbolIndex = new WeakMap(), _SkyNumericService_instances = new WeakSet(), _SkyNumericService_roundNumber = function _SkyNumericService_roundNumber(value, precision) {
|
2007
|
+
if (precision < 0) {
|
2008
|
+
throw new Error('SkyInvalidArgument: precision must be >= 0');
|
1972
2009
|
}
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
2010
|
+
/* Sanity check - ignoring coverage but should not ignore if we make this method public */
|
2011
|
+
/* istanbul ignore next */
|
2012
|
+
if (isNaN(value) || value === null) {
|
2013
|
+
return 0;
|
2014
|
+
}
|
2015
|
+
const scaledValue = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_scaleNumberByPowerOfTen).call(this, value, precision, true);
|
2016
|
+
const scaledRoundedValue = Math.round(scaledValue);
|
2017
|
+
const unscaledRoundedValue = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_scaleNumberByPowerOfTen).call(this, scaledRoundedValue, precision, false);
|
2018
|
+
return unscaledRoundedValue;
|
2019
|
+
}, _SkyNumericService_scaleNumberByPowerOfTen = function _SkyNumericService_scaleNumberByPowerOfTen(value, scalar, scaleUp) {
|
2020
|
+
const valueStr = value.toString().toLowerCase();
|
2021
|
+
const isExponentFormat = valueStr.includes('e');
|
2022
|
+
if (isExponentFormat) {
|
2023
|
+
const [base, exp] = valueStr.split('e');
|
2024
|
+
const newExp = scaleUp ? Number(exp) + scalar : Number(exp) - scalar;
|
2025
|
+
return Number(`${base}e${newExp}`);
|
1982
2026
|
}
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
2027
|
+
else {
|
2028
|
+
const e = scaleUp ? 'e' : 'e-';
|
2029
|
+
return Number(`${value}${e}${scalar}`);
|
2030
|
+
}
|
2031
|
+
}, _SkyNumericService_storeShortenSymbol = function _SkyNumericService_storeShortenSymbol(value) {
|
2032
|
+
const symbols = __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f").map((s) => s.label);
|
2033
|
+
const regexp = new RegExp(symbols.join('|'), 'ig');
|
2034
|
+
const match = value.match(regexp);
|
2035
|
+
this.shortSymbol = match ? match.toString() : '';
|
2036
|
+
}, _SkyNumericService_replaceShortenSymbol = function _SkyNumericService_replaceShortenSymbol(value) {
|
2037
|
+
const result = /(\d)(?!.*\d)/g.exec(value);
|
2038
|
+
/*istanbul ignore else*/
|
2039
|
+
if (result) {
|
1992
2040
|
const pos = result.index + result.length;
|
1993
2041
|
const output = value.substring(0, pos) + this.shortSymbol + value.substring(pos);
|
1994
2042
|
return output;
|
1995
2043
|
}
|
1996
|
-
|
1997
|
-
|
1998
|
-
return this.resourcesService.getStringForLocale({ locale: 'en_US' }, key);
|
2044
|
+
else {
|
2045
|
+
return value;
|
1999
2046
|
}
|
2000
|
-
}
|
2047
|
+
}, _SkyNumericService_getSymbol = function _SkyNumericService_getSymbol(key) {
|
2048
|
+
// TODO: Need to implement the async `getString` method in a breaking change.
|
2049
|
+
return __classPrivateFieldGet(this, _SkyNumericService_resourcesSvc, "f").getStringForLocale({ locale: 'en_US' }, key);
|
2050
|
+
};
|
2001
2051
|
SkyNumericService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyNumericService, deps: [{ token: i1.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2002
2052
|
SkyNumericService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyNumericService, providedIn: 'any' });
|
2003
2053
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyNumericService, decorators: [{
|
@@ -2007,6 +2057,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2007
2057
|
}]
|
2008
2058
|
}], ctorParameters: function () { return [{ type: i1.SkyLibResourcesService }]; } });
|
2009
2059
|
|
2060
|
+
var _SkyNumericPipe_cacheKey, _SkyNumericPipe_changeDetector, _SkyNumericPipe_formattedValue, _SkyNumericPipe_ngUnsubscribe, _SkyNumericPipe_numericSvc, _SkyNumericPipe_providerLocale;
|
2010
2061
|
/**
|
2011
2062
|
* Shortens numbers to rounded numbers and abbreviation characters such as K for thousands,
|
2012
2063
|
* M for millions, B for billions, and T for trillions. The pipe also formats for currency.
|
@@ -2014,34 +2065,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2014
2065
|
* a space before the two curly brackets closing the pipe or it will not work.
|
2015
2066
|
*/
|
2016
2067
|
class SkyNumericPipe {
|
2017
|
-
constructor(localeProvider,
|
2018
|
-
this
|
2019
|
-
this
|
2020
|
-
this
|
2021
|
-
this
|
2022
|
-
this
|
2068
|
+
constructor(localeProvider, numericSvc, changeDetector) {
|
2069
|
+
_SkyNumericPipe_cacheKey.set(this, void 0);
|
2070
|
+
_SkyNumericPipe_changeDetector.set(this, void 0);
|
2071
|
+
_SkyNumericPipe_formattedValue.set(this, void 0);
|
2072
|
+
_SkyNumericPipe_ngUnsubscribe.set(this, new Subject());
|
2073
|
+
_SkyNumericPipe_numericSvc.set(this, void 0);
|
2074
|
+
_SkyNumericPipe_providerLocale.set(this, void 0);
|
2075
|
+
__classPrivateFieldSet(this, _SkyNumericPipe_numericSvc, numericSvc, "f");
|
2076
|
+
__classPrivateFieldSet(this, _SkyNumericPipe_changeDetector, changeDetector, "f");
|
2077
|
+
localeProvider
|
2023
2078
|
.getLocaleInfo()
|
2024
|
-
.pipe(takeUntil(this
|
2079
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyNumericPipe_ngUnsubscribe, "f")))
|
2025
2080
|
.subscribe((localeInfo) => {
|
2026
|
-
this
|
2027
|
-
|
2028
|
-
this.
|
2081
|
+
__classPrivateFieldSet(this, _SkyNumericPipe_providerLocale, localeInfo.locale, "f");
|
2082
|
+
numericSvc.currentLocale = __classPrivateFieldGet(this, _SkyNumericPipe_providerLocale, "f");
|
2083
|
+
__classPrivateFieldGet(this, _SkyNumericPipe_changeDetector, "f").markForCheck();
|
2029
2084
|
});
|
2030
2085
|
}
|
2031
2086
|
ngOnDestroy() {
|
2032
|
-
this.
|
2033
|
-
this.
|
2087
|
+
__classPrivateFieldGet(this, _SkyNumericPipe_ngUnsubscribe, "f").next();
|
2088
|
+
__classPrivateFieldGet(this, _SkyNumericPipe_ngUnsubscribe, "f").complete();
|
2034
2089
|
}
|
2035
2090
|
/**
|
2036
2091
|
* Formats a number based on the provided options.
|
2037
2092
|
*/
|
2038
2093
|
transform(value, config) {
|
2039
2094
|
const newCacheKey = (config ? JSON.stringify(config, Object.keys(config).sort()) : '') +
|
2040
|
-
`${value}_${(config === null || config === void 0 ? void 0 : config.locale) || this
|
2095
|
+
`${value}_${(config === null || config === void 0 ? void 0 : config.locale) || __classPrivateFieldGet(this, _SkyNumericPipe_providerLocale, "f")}`;
|
2041
2096
|
/* If the value and locale are the same as the last transform then return the previous value
|
2042
2097
|
instead of reformatting. */
|
2043
|
-
if (this
|
2044
|
-
return this
|
2098
|
+
if (__classPrivateFieldGet(this, _SkyNumericPipe_formattedValue, "f") && __classPrivateFieldGet(this, _SkyNumericPipe_cacheKey, "f") === newCacheKey) {
|
2099
|
+
return __classPrivateFieldGet(this, _SkyNumericPipe_formattedValue, "f");
|
2045
2100
|
}
|
2046
2101
|
const options = new NumericOptions();
|
2047
2102
|
// The default number of digits is `1`. When truncate is disabled, set digits
|
@@ -2062,11 +2117,12 @@ class SkyNumericPipe {
|
|
2062
2117
|
}
|
2063
2118
|
Object.assign(options, config);
|
2064
2119
|
// Assign properties for proper result caching.
|
2065
|
-
this
|
2066
|
-
this
|
2067
|
-
return this
|
2120
|
+
__classPrivateFieldSet(this, _SkyNumericPipe_cacheKey, newCacheKey, "f");
|
2121
|
+
__classPrivateFieldSet(this, _SkyNumericPipe_formattedValue, __classPrivateFieldGet(this, _SkyNumericPipe_numericSvc, "f").formatNumber(value, options), "f");
|
2122
|
+
return __classPrivateFieldGet(this, _SkyNumericPipe_formattedValue, "f");
|
2068
2123
|
}
|
2069
2124
|
}
|
2125
|
+
_SkyNumericPipe_cacheKey = new WeakMap(), _SkyNumericPipe_changeDetector = new WeakMap(), _SkyNumericPipe_formattedValue = new WeakMap(), _SkyNumericPipe_ngUnsubscribe = new WeakMap(), _SkyNumericPipe_numericSvc = new WeakMap(), _SkyNumericPipe_providerLocale = new WeakMap();
|
2070
2126
|
SkyNumericPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyNumericPipe, deps: [{ token: i1.SkyAppLocaleProvider }, { token: SkyNumericService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe });
|
2071
2127
|
SkyNumericPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyNumericPipe, name: "skyNumeric", pure: false });
|
2072
2128
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyNumericPipe, decorators: [{
|
@@ -2092,6 +2148,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2092
2148
|
}]
|
2093
2149
|
}] });
|
2094
2150
|
|
2151
|
+
var _SkyOverlayInstance_backdropClick, _SkyOverlayInstance_backdropClickObs, _SkyOverlayInstance_closed, _SkyOverlayInstance_closedObs;
|
2095
2152
|
/**
|
2096
2153
|
* Represents a new overlay instance. It is used to manage the "closed" state of the overlay,
|
2097
2154
|
* and access any public members on the appended content component instance.
|
@@ -2104,29 +2161,35 @@ class SkyOverlayInstance {
|
|
2104
2161
|
config, componentRef) {
|
2105
2162
|
this.config = config;
|
2106
2163
|
this.componentRef = componentRef;
|
2107
|
-
this
|
2108
|
-
this
|
2164
|
+
_SkyOverlayInstance_backdropClick.set(this, void 0);
|
2165
|
+
_SkyOverlayInstance_backdropClickObs.set(this, void 0);
|
2166
|
+
_SkyOverlayInstance_closed.set(this, void 0);
|
2167
|
+
_SkyOverlayInstance_closedObs.set(this, void 0);
|
2109
2168
|
this.id = this.componentRef.instance.id;
|
2110
2169
|
this.componentRef.instance.closed.subscribe(() => {
|
2111
|
-
this.
|
2112
|
-
this.
|
2113
|
-
this.
|
2170
|
+
__classPrivateFieldGet(this, _SkyOverlayInstance_closed, "f").next();
|
2171
|
+
__classPrivateFieldGet(this, _SkyOverlayInstance_closed, "f").complete();
|
2172
|
+
__classPrivateFieldGet(this, _SkyOverlayInstance_backdropClick, "f").complete();
|
2114
2173
|
});
|
2115
2174
|
this.componentRef.instance.backdropClick.subscribe(() => {
|
2116
|
-
this.
|
2175
|
+
__classPrivateFieldGet(this, _SkyOverlayInstance_backdropClick, "f").next();
|
2117
2176
|
});
|
2177
|
+
__classPrivateFieldSet(this, _SkyOverlayInstance_backdropClick, new Subject(), "f");
|
2178
|
+
__classPrivateFieldSet(this, _SkyOverlayInstance_closed, new Subject(), "f");
|
2179
|
+
__classPrivateFieldSet(this, _SkyOverlayInstance_backdropClickObs, __classPrivateFieldGet(this, _SkyOverlayInstance_backdropClick, "f").asObservable(), "f");
|
2180
|
+
__classPrivateFieldSet(this, _SkyOverlayInstance_closedObs, __classPrivateFieldGet(this, _SkyOverlayInstance_closed, "f").asObservable(), "f");
|
2118
2181
|
}
|
2119
2182
|
/**
|
2120
2183
|
* Emits when the overlay is clicked (but not its content).
|
2121
2184
|
*/
|
2122
2185
|
get backdropClick() {
|
2123
|
-
return this
|
2186
|
+
return __classPrivateFieldGet(this, _SkyOverlayInstance_backdropClickObs, "f");
|
2124
2187
|
}
|
2125
2188
|
/**
|
2126
2189
|
* Emits after the overlay is closed.
|
2127
2190
|
*/
|
2128
2191
|
get closed() {
|
2129
|
-
return this
|
2192
|
+
return __classPrivateFieldGet(this, _SkyOverlayInstance_closedObs, "f");
|
2130
2193
|
}
|
2131
2194
|
/**
|
2132
2195
|
* Creates and attaches a component to the overlay.
|
@@ -2146,6 +2209,7 @@ class SkyOverlayInstance {
|
|
2146
2209
|
this.componentRef.instance.attachTemplate(templateRef, context);
|
2147
2210
|
}
|
2148
2211
|
}
|
2212
|
+
_SkyOverlayInstance_backdropClick = new WeakMap(), _SkyOverlayInstance_backdropClickObs = new WeakMap(), _SkyOverlayInstance_closed = new WeakMap(), _SkyOverlayInstance_closedObs = new WeakMap();
|
2149
2213
|
|
2150
2214
|
/**
|
2151
2215
|
* Provides contextual information to each overlay created.
|
@@ -2157,6 +2221,7 @@ class SkyOverlayContext {
|
|
2157
2221
|
}
|
2158
2222
|
}
|
2159
2223
|
|
2224
|
+
var _SkyOverlayComponent_instances, _SkyOverlayComponent_backdropClick, _SkyOverlayComponent_backdropClickObs, _SkyOverlayComponent_changeDetector, _SkyOverlayComponent_closed, _SkyOverlayComponent_closedObs, _SkyOverlayComponent_context, _SkyOverlayComponent_coreAdapter, _SkyOverlayComponent_injector, _SkyOverlayComponent_ngUnsubscribe, _SkyOverlayComponent_resolver, _SkyOverlayComponent_router, _SkyOverlayComponent_routerSubscription, _SkyOverlayComponent_applyConfig, _SkyOverlayComponent_addBackdropClickListener, _SkyOverlayComponent_addRouteListener, _SkyOverlayComponent_removeRouteListener;
|
2160
2225
|
/**
|
2161
2226
|
* Omnibar is 1000.
|
2162
2227
|
* See: https://github.com/blackbaud/auth-client/blob/master/src/omnibar/omnibar.ts#L139
|
@@ -2175,51 +2240,70 @@ let uniqueZIndex = 5000;
|
|
2175
2240
|
* @internal
|
2176
2241
|
*/
|
2177
2242
|
class SkyOverlayComponent {
|
2243
|
+
// TODO: Replace deprecated `ComponentFactoryResolver`.
|
2178
2244
|
constructor(changeDetector, resolver, injector, coreAdapter, context, idSvc, router) {
|
2179
|
-
this
|
2180
|
-
this.resolver = resolver;
|
2181
|
-
this.injector = injector;
|
2182
|
-
this.coreAdapter = coreAdapter;
|
2183
|
-
this.context = context;
|
2184
|
-
this.router = router;
|
2245
|
+
_SkyOverlayComponent_instances.add(this);
|
2185
2246
|
this.wrapperClass = '';
|
2186
2247
|
this.enablePointerEvents = false;
|
2187
2248
|
this.showBackdrop = false;
|
2188
2249
|
this.zIndex = `${++uniqueZIndex}`;
|
2189
|
-
this
|
2190
|
-
this
|
2191
|
-
this
|
2250
|
+
_SkyOverlayComponent_backdropClick.set(this, void 0);
|
2251
|
+
_SkyOverlayComponent_backdropClickObs.set(this, void 0);
|
2252
|
+
_SkyOverlayComponent_changeDetector.set(this, void 0);
|
2253
|
+
_SkyOverlayComponent_closed.set(this, void 0);
|
2254
|
+
_SkyOverlayComponent_closedObs.set(this, void 0);
|
2255
|
+
_SkyOverlayComponent_context.set(this, void 0);
|
2256
|
+
_SkyOverlayComponent_coreAdapter.set(this, void 0);
|
2257
|
+
_SkyOverlayComponent_injector.set(this, void 0);
|
2258
|
+
_SkyOverlayComponent_ngUnsubscribe.set(this, new Subject());
|
2259
|
+
_SkyOverlayComponent_resolver.set(this, void 0);
|
2260
|
+
_SkyOverlayComponent_router.set(this, void 0);
|
2261
|
+
_SkyOverlayComponent_routerSubscription.set(this, void 0);
|
2262
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_changeDetector, changeDetector, "f");
|
2263
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_resolver, resolver, "f");
|
2264
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_injector, injector, "f");
|
2265
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_coreAdapter, coreAdapter, "f");
|
2266
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_context, context, "f");
|
2267
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_router, router, "f");
|
2192
2268
|
this.id = idSvc.generateId();
|
2269
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_backdropClick, new Subject(), "f");
|
2270
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_closed, new Subject(), "f");
|
2271
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_backdropClickObs, __classPrivateFieldGet(this, _SkyOverlayComponent_backdropClick, "f").asObservable(), "f");
|
2272
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_closedObs, __classPrivateFieldGet(this, _SkyOverlayComponent_closed, "f").asObservable(), "f");
|
2193
2273
|
}
|
2194
2274
|
get backdropClick() {
|
2195
|
-
return this
|
2275
|
+
return __classPrivateFieldGet(this, _SkyOverlayComponent_backdropClickObs, "f");
|
2196
2276
|
}
|
2197
2277
|
get closed() {
|
2198
|
-
return this
|
2278
|
+
return __classPrivateFieldGet(this, _SkyOverlayComponent_closedObs, "f");
|
2199
2279
|
}
|
2200
2280
|
ngOnInit() {
|
2201
|
-
this.
|
2281
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_instances, "m", _SkyOverlayComponent_applyConfig).call(this, __classPrivateFieldGet(this, _SkyOverlayComponent_context, "f").config);
|
2202
2282
|
setTimeout(() => {
|
2203
|
-
this.
|
2283
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_instances, "m", _SkyOverlayComponent_addBackdropClickListener).call(this);
|
2204
2284
|
});
|
2205
|
-
if (this.
|
2206
|
-
this.
|
2285
|
+
if (__classPrivateFieldGet(this, _SkyOverlayComponent_context, "f").config.closeOnNavigation) {
|
2286
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_instances, "m", _SkyOverlayComponent_addRouteListener).call(this);
|
2207
2287
|
}
|
2208
2288
|
}
|
2209
2289
|
ngOnDestroy() {
|
2210
|
-
this.
|
2211
|
-
this.
|
2212
|
-
this.
|
2213
|
-
this.
|
2214
|
-
this.
|
2215
|
-
this.
|
2290
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_instances, "m", _SkyOverlayComponent_removeRouteListener).call(this);
|
2291
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_ngUnsubscribe, "f").next();
|
2292
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_ngUnsubscribe, "f").complete();
|
2293
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_backdropClick, "f").complete();
|
2294
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_closed, "f").next();
|
2295
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_closed, "f").complete();
|
2216
2296
|
}
|
2217
2297
|
attachComponent(component, providers = []) {
|
2298
|
+
/*istanbul ignore if: untestable*/
|
2299
|
+
if (!this.targetRef) {
|
2300
|
+
throw new Error('[SkyOverlayComponent] Could not attach the component because the target element could not be found.');
|
2301
|
+
}
|
2218
2302
|
this.targetRef.clear();
|
2219
|
-
const factory = this.
|
2303
|
+
const factory = __classPrivateFieldGet(this, _SkyOverlayComponent_resolver, "f").resolveComponentFactory(component);
|
2220
2304
|
const injector = Injector.create({
|
2221
2305
|
providers,
|
2222
|
-
parent: this
|
2306
|
+
parent: __classPrivateFieldGet(this, _SkyOverlayComponent_injector, "f"),
|
2223
2307
|
});
|
2224
2308
|
const componentRef = this.targetRef.createComponent(factory, undefined, injector);
|
2225
2309
|
// Run an initial change detection cycle after the component has been created.
|
@@ -2227,48 +2311,51 @@ class SkyOverlayComponent {
|
|
2227
2311
|
return componentRef;
|
2228
2312
|
}
|
2229
2313
|
attachTemplate(templateRef, context) {
|
2314
|
+
/*istanbul ignore if: untestable*/
|
2315
|
+
if (!this.targetRef) {
|
2316
|
+
throw new Error('[SkyOverlayComponent] Could not attach the template because the target element could not be found.');
|
2317
|
+
}
|
2230
2318
|
this.targetRef.clear();
|
2231
2319
|
return this.targetRef.createEmbeddedView(templateRef, context);
|
2232
2320
|
}
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2321
|
+
}
|
2322
|
+
_SkyOverlayComponent_backdropClick = new WeakMap(), _SkyOverlayComponent_backdropClickObs = new WeakMap(), _SkyOverlayComponent_changeDetector = new WeakMap(), _SkyOverlayComponent_closed = new WeakMap(), _SkyOverlayComponent_closedObs = new WeakMap(), _SkyOverlayComponent_context = new WeakMap(), _SkyOverlayComponent_coreAdapter = new WeakMap(), _SkyOverlayComponent_injector = new WeakMap(), _SkyOverlayComponent_ngUnsubscribe = new WeakMap(), _SkyOverlayComponent_resolver = new WeakMap(), _SkyOverlayComponent_router = new WeakMap(), _SkyOverlayComponent_routerSubscription = new WeakMap(), _SkyOverlayComponent_instances = new WeakSet(), _SkyOverlayComponent_applyConfig = function _SkyOverlayComponent_applyConfig(config) {
|
2323
|
+
this.wrapperClass = config.wrapperClass || '';
|
2324
|
+
this.showBackdrop = !!config.showBackdrop;
|
2325
|
+
this.enablePointerEvents = !!config.enablePointerEvents;
|
2326
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_changeDetector, "f").markForCheck();
|
2327
|
+
}, _SkyOverlayComponent_addBackdropClickListener = function _SkyOverlayComponent_addBackdropClickListener() {
|
2328
|
+
fromEvent(window.document, 'click')
|
2329
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyOverlayComponent_ngUnsubscribe, "f")))
|
2330
|
+
.subscribe((event) => {
|
2331
|
+
if (event.target && this.overlayContentRef && this.overlayRef) {
|
2243
2332
|
const isChild = this.overlayContentRef.nativeElement.contains(event.target);
|
2244
|
-
const isAbove = this.
|
2333
|
+
const isAbove = __classPrivateFieldGet(this, _SkyOverlayComponent_coreAdapter, "f").isTargetAboveElement(event.target, this.overlayRef.nativeElement);
|
2245
2334
|
/* istanbul ignore else */
|
2246
2335
|
if (!isChild && !isAbove) {
|
2247
|
-
this.
|
2248
|
-
if (this.
|
2249
|
-
this.
|
2336
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_backdropClick, "f").next();
|
2337
|
+
if (__classPrivateFieldGet(this, _SkyOverlayComponent_context, "f").config.enableClose) {
|
2338
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_closed, "f").next();
|
2250
2339
|
}
|
2251
2340
|
}
|
2252
|
-
});
|
2253
|
-
}
|
2254
|
-
addRouteListener() {
|
2255
|
-
/*istanbul ignore else*/
|
2256
|
-
if (this.router) {
|
2257
|
-
this.routerSubscription = this.router.events.subscribe((event) => {
|
2258
|
-
/* istanbul ignore else */
|
2259
|
-
if (event instanceof NavigationStart) {
|
2260
|
-
this._closed.next();
|
2261
|
-
}
|
2262
|
-
});
|
2263
2341
|
}
|
2342
|
+
});
|
2343
|
+
}, _SkyOverlayComponent_addRouteListener = function _SkyOverlayComponent_addRouteListener() {
|
2344
|
+
/*istanbul ignore else*/
|
2345
|
+
if (__classPrivateFieldGet(this, _SkyOverlayComponent_router, "f")) {
|
2346
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_routerSubscription, __classPrivateFieldGet(this, _SkyOverlayComponent_router, "f").events.subscribe((event) => {
|
2347
|
+
/* istanbul ignore else */
|
2348
|
+
if (event instanceof NavigationStart) {
|
2349
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_closed, "f").next();
|
2350
|
+
}
|
2351
|
+
}), "f");
|
2264
2352
|
}
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
}
|
2353
|
+
}, _SkyOverlayComponent_removeRouteListener = function _SkyOverlayComponent_removeRouteListener() {
|
2354
|
+
if (__classPrivateFieldGet(this, _SkyOverlayComponent_routerSubscription, "f")) {
|
2355
|
+
__classPrivateFieldGet(this, _SkyOverlayComponent_routerSubscription, "f").unsubscribe();
|
2356
|
+
__classPrivateFieldSet(this, _SkyOverlayComponent_routerSubscription, undefined, "f");
|
2270
2357
|
}
|
2271
|
-
}
|
2358
|
+
};
|
2272
2359
|
SkyOverlayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyOverlayComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ComponentFactoryResolver }, { token: i0.Injector }, { token: SkyCoreAdapterService }, { token: SkyOverlayContext }, { token: SkyIdService }, { token: i4.Router, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
2273
2360
|
SkyOverlayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: SkyOverlayComponent, selector: "sky-overlay", host: { properties: { "id": "this.id" } }, viewQueries: [{ propertyName: "overlayContentRef", first: true, predicate: ["overlayContentRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "overlayRef", first: true, predicate: ["overlayRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "targetRef", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div\n [class]=\"wrapperClass\"\n [style.zIndex]=\"zIndex\"\n [ngClass]=\"{\n 'enable-pointer-events-pass-through': enablePointerEvents,\n 'sky-overlay': true\n }\"\n #overlayRef\n>\n <div class=\"sky-overlay-content\" #overlayContentRef>\n <ng-template #target> </ng-template>\n </div>\n <div *ngIf=\"showBackdrop\" class=\"sky-overlay-backdrop\"></div>\n</div>\n", styles: [".sky-overlay{position:fixed;top:0;right:0;left:0;bottom:0;width:100%;height:100%;display:flex;pointer-events:auto}.sky-overlay-content{position:relative;z-index:1;display:inline-flex;align-self:start;pointer-events:auto}.sky-overlay-backdrop{background:rgba(0,0,0,.5);top:0;right:0;left:0;bottom:0;width:100%;height:100%;position:absolute}.enable-pointer-events-pass-through,.enable-pointer-events-pass-through .sky-overlay-backdrop{pointer-events:none}.enable-pointer-events-pass-through .sky-overlay-content{pointer-events:auto}\n"], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
2274
2361
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyOverlayComponent, decorators: [{
|
@@ -2314,36 +2401,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2314
2401
|
}]
|
2315
2402
|
}] });
|
2316
2403
|
|
2404
|
+
var _SkyOverlayAdapterService_instances, _SkyOverlayAdapterService_renderer, _SkyOverlayAdapterService_styleElement, _SkyOverlayAdapterService_destroyStyleElement;
|
2317
2405
|
/**
|
2318
2406
|
* @internal
|
2319
2407
|
*/
|
2320
2408
|
class SkyOverlayAdapterService {
|
2321
2409
|
constructor(rendererFactory) {
|
2322
|
-
|
2410
|
+
_SkyOverlayAdapterService_instances.add(this);
|
2411
|
+
_SkyOverlayAdapterService_renderer.set(this, void 0);
|
2412
|
+
_SkyOverlayAdapterService_styleElement.set(this, void 0);
|
2413
|
+
__classPrivateFieldSet(this, _SkyOverlayAdapterService_renderer, rendererFactory.createRenderer(undefined, null), "f");
|
2323
2414
|
}
|
2324
2415
|
restrictBodyScroll() {
|
2325
2416
|
// Create a style element to avoid overwriting any existing inline body styles.
|
2326
|
-
const styleElement = this.
|
2327
|
-
const textNode = this.
|
2417
|
+
const styleElement = __classPrivateFieldGet(this, _SkyOverlayAdapterService_renderer, "f").createElement('style');
|
2418
|
+
const textNode = __classPrivateFieldGet(this, _SkyOverlayAdapterService_renderer, "f").createText('body { overflow: hidden }');
|
2328
2419
|
// Apply a `data-` attribute to make unit testing easier.
|
2329
|
-
this.
|
2330
|
-
this.
|
2331
|
-
this.
|
2332
|
-
if (this
|
2333
|
-
this.
|
2420
|
+
__classPrivateFieldGet(this, _SkyOverlayAdapterService_renderer, "f").setAttribute(styleElement, 'data-test-selector', 'sky-overlay-restrict-scroll-styles');
|
2421
|
+
__classPrivateFieldGet(this, _SkyOverlayAdapterService_renderer, "f").appendChild(styleElement, textNode);
|
2422
|
+
__classPrivateFieldGet(this, _SkyOverlayAdapterService_renderer, "f").appendChild(document.head, styleElement);
|
2423
|
+
if (__classPrivateFieldGet(this, _SkyOverlayAdapterService_styleElement, "f")) {
|
2424
|
+
__classPrivateFieldGet(this, _SkyOverlayAdapterService_instances, "m", _SkyOverlayAdapterService_destroyStyleElement).call(this);
|
2334
2425
|
}
|
2335
|
-
this
|
2426
|
+
__classPrivateFieldSet(this, _SkyOverlayAdapterService_styleElement, styleElement, "f");
|
2336
2427
|
}
|
2337
2428
|
releaseBodyScroll() {
|
2338
|
-
this.
|
2339
|
-
}
|
2340
|
-
destroyStyleElement() {
|
2341
|
-
/* istanbul ignore else */
|
2342
|
-
if (this.styleElement.parentElement === document.head) {
|
2343
|
-
this.renderer.removeChild(document.head, this.styleElement);
|
2344
|
-
}
|
2429
|
+
__classPrivateFieldGet(this, _SkyOverlayAdapterService_instances, "m", _SkyOverlayAdapterService_destroyStyleElement).call(this);
|
2345
2430
|
}
|
2346
2431
|
}
|
2432
|
+
_SkyOverlayAdapterService_renderer = new WeakMap(), _SkyOverlayAdapterService_styleElement = new WeakMap(), _SkyOverlayAdapterService_instances = new WeakSet(), _SkyOverlayAdapterService_destroyStyleElement = function _SkyOverlayAdapterService_destroyStyleElement() {
|
2433
|
+
/* istanbul ignore else */
|
2434
|
+
if (__classPrivateFieldGet(this, _SkyOverlayAdapterService_styleElement, "f") &&
|
2435
|
+
__classPrivateFieldGet(this, _SkyOverlayAdapterService_styleElement, "f").parentElement === document.head) {
|
2436
|
+
__classPrivateFieldGet(this, _SkyOverlayAdapterService_renderer, "f").removeChild(document.head, __classPrivateFieldGet(this, _SkyOverlayAdapterService_styleElement, "f"));
|
2437
|
+
}
|
2438
|
+
};
|
2347
2439
|
SkyOverlayAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyOverlayAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
2348
2440
|
SkyOverlayAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyOverlayAdapterService, providedIn: 'root' });
|
2349
2441
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyOverlayAdapterService, decorators: [{
|
@@ -2353,27 +2445,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2353
2445
|
}]
|
2354
2446
|
}], ctorParameters: function () { return [{ type: i0.RendererFactory2 }]; } });
|
2355
2447
|
|
2448
|
+
var _SkyOverlayService_instances, _SkyOverlayService_adapter, _SkyOverlayService_applicationRef, _SkyOverlayService_componentFactoryResolver, _SkyOverlayService_injector, _SkyOverlayService_createOverlay, _SkyOverlayService_prepareConfig, _SkyOverlayService_destroyOverlay;
|
2356
2449
|
/**
|
2357
2450
|
* This service is used to create new overlays.
|
2358
2451
|
* @dynamic
|
2359
2452
|
*/
|
2360
2453
|
class SkyOverlayService {
|
2454
|
+
// TODO: Replace deprecated `ComponentFactoryResolver`.
|
2361
2455
|
constructor(applicationRef, componentFactoryResolver, injector, adapter) {
|
2362
|
-
this
|
2363
|
-
this
|
2364
|
-
this
|
2365
|
-
this
|
2456
|
+
_SkyOverlayService_instances.add(this);
|
2457
|
+
_SkyOverlayService_adapter.set(this, void 0);
|
2458
|
+
_SkyOverlayService_applicationRef.set(this, void 0);
|
2459
|
+
_SkyOverlayService_componentFactoryResolver.set(this, void 0);
|
2460
|
+
_SkyOverlayService_injector.set(this, void 0);
|
2461
|
+
__classPrivateFieldSet(this, _SkyOverlayService_applicationRef, applicationRef, "f");
|
2462
|
+
__classPrivateFieldSet(this, _SkyOverlayService_componentFactoryResolver, componentFactoryResolver, "f");
|
2463
|
+
__classPrivateFieldSet(this, _SkyOverlayService_injector, injector, "f");
|
2464
|
+
__classPrivateFieldSet(this, _SkyOverlayService_adapter, adapter, "f");
|
2366
2465
|
}
|
2367
2466
|
/**
|
2368
2467
|
* Creates an empty overlay. Use the returned `SkyOverlayInstance` to append content.
|
2369
2468
|
* @param config Configuration for the overlay.
|
2370
2469
|
*/
|
2371
2470
|
create(config) {
|
2372
|
-
const settings = this.
|
2471
|
+
const settings = __classPrivateFieldGet(this, _SkyOverlayService_instances, "m", _SkyOverlayService_prepareConfig).call(this, config);
|
2373
2472
|
if (settings.enableScroll === false) {
|
2374
|
-
this.
|
2473
|
+
__classPrivateFieldGet(this, _SkyOverlayService_adapter, "f").restrictBodyScroll();
|
2375
2474
|
}
|
2376
|
-
const componentRef = this.
|
2475
|
+
const componentRef = __classPrivateFieldGet(this, _SkyOverlayService_instances, "m", _SkyOverlayService_createOverlay).call(this, settings);
|
2377
2476
|
const instance = new SkyOverlayInstance(settings, componentRef);
|
2378
2477
|
instance.closed.subscribe(() => {
|
2379
2478
|
// Only execute the service's close method if the instance still exists.
|
@@ -2390,8 +2489,8 @@ class SkyOverlayService {
|
|
2390
2489
|
* @param instance The instance to close.
|
2391
2490
|
*/
|
2392
2491
|
close(instance) {
|
2393
|
-
this.
|
2394
|
-
this.
|
2492
|
+
__classPrivateFieldGet(this, _SkyOverlayService_instances, "m", _SkyOverlayService_destroyOverlay).call(this, instance);
|
2493
|
+
__classPrivateFieldGet(this, _SkyOverlayService_applicationRef, "f").detachView(instance.componentRef.hostView);
|
2395
2494
|
instance.componentRef.destroy();
|
2396
2495
|
// In some cases, Angular keeps dynamically-generated component's nodes in the DOM during
|
2397
2496
|
// unit tests. This can make querying difficult because the older DOM nodes still exist and
|
@@ -2415,47 +2514,45 @@ class SkyOverlayService {
|
|
2415
2514
|
this.close(SkyOverlayService.overlays[0]);
|
2416
2515
|
}
|
2417
2516
|
}
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
|
2436
|
-
|
2437
|
-
|
2438
|
-
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
if
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2454
|
-
this.adapter.releaseBodyScroll();
|
2455
|
-
}
|
2517
|
+
}
|
2518
|
+
_SkyOverlayService_adapter = new WeakMap(), _SkyOverlayService_applicationRef = new WeakMap(), _SkyOverlayService_componentFactoryResolver = new WeakMap(), _SkyOverlayService_injector = new WeakMap(), _SkyOverlayService_instances = new WeakSet(), _SkyOverlayService_createOverlay = function _SkyOverlayService_createOverlay(config) {
|
2519
|
+
const injector = Injector.create({
|
2520
|
+
parent: __classPrivateFieldGet(this, _SkyOverlayService_injector, "f"),
|
2521
|
+
providers: [
|
2522
|
+
{
|
2523
|
+
provide: SkyOverlayContext,
|
2524
|
+
useValue: new SkyOverlayContext(config),
|
2525
|
+
},
|
2526
|
+
],
|
2527
|
+
});
|
2528
|
+
const componentRef = __classPrivateFieldGet(this, _SkyOverlayService_componentFactoryResolver, "f")
|
2529
|
+
.resolveComponentFactory(SkyOverlayComponent)
|
2530
|
+
.create(injector);
|
2531
|
+
__classPrivateFieldGet(this, _SkyOverlayService_applicationRef, "f").attachView(componentRef.hostView);
|
2532
|
+
const domElem = componentRef.hostView
|
2533
|
+
.rootNodes[0];
|
2534
|
+
document.body.appendChild(domElem);
|
2535
|
+
return componentRef;
|
2536
|
+
}, _SkyOverlayService_prepareConfig = function _SkyOverlayService_prepareConfig(config = {}) {
|
2537
|
+
const defaults = {
|
2538
|
+
closeOnNavigation: true,
|
2539
|
+
enableClose: false,
|
2540
|
+
enablePointerEvents: false,
|
2541
|
+
enableScroll: true,
|
2542
|
+
showBackdrop: false,
|
2543
|
+
wrapperClass: '',
|
2544
|
+
};
|
2545
|
+
return Object.assign(Object.assign({}, defaults), config);
|
2546
|
+
}, _SkyOverlayService_destroyOverlay = function _SkyOverlayService_destroyOverlay(instance) {
|
2547
|
+
SkyOverlayService.overlays.splice(SkyOverlayService.overlays.indexOf(instance), 1);
|
2548
|
+
if (instance.config.enableScroll === false) {
|
2549
|
+
// Only release the body scroll if no other overlay wishes it to be disabled.
|
2550
|
+
const anotherOverlayDisablesScroll = SkyOverlayService.overlays.some((o) => !o.config.enableScroll);
|
2551
|
+
if (!anotherOverlayDisablesScroll) {
|
2552
|
+
__classPrivateFieldGet(this, _SkyOverlayService_adapter, "f").releaseBodyScroll();
|
2456
2553
|
}
|
2457
2554
|
}
|
2458
|
-
}
|
2555
|
+
};
|
2459
2556
|
SkyOverlayService.overlays = [];
|
2460
2557
|
SkyOverlayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyOverlayService, deps: [{ token: i0.ApplicationRef }, { token: i0.ComponentFactoryResolver }, { token: i0.Injector }, { token: SkyOverlayAdapterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2461
2558
|
SkyOverlayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyOverlayService, providedIn: 'root' });
|
@@ -2466,37 +2563,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2466
2563
|
}]
|
2467
2564
|
}], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i0.ComponentFactoryResolver }, { type: i0.Injector }, { type: SkyOverlayAdapterService }]; } });
|
2468
2565
|
|
2566
|
+
var _SkyPercentPipe_instances, _SkyPercentPipe_defaultFormat, _SkyPercentPipe_defaultLocale, _SkyPercentPipe_format, _SkyPercentPipe_formattedValue, _SkyPercentPipe_locale, _SkyPercentPipe_ngUnsubscribe, _SkyPercentPipe_value, _SkyPercentPipe_updateFormattedValue;
|
2469
2567
|
class SkyPercentPipe {
|
2470
2568
|
constructor(localeProvider) {
|
2471
|
-
this
|
2472
|
-
this
|
2473
|
-
this
|
2474
|
-
this
|
2475
|
-
this
|
2569
|
+
_SkyPercentPipe_instances.add(this);
|
2570
|
+
_SkyPercentPipe_defaultFormat.set(this, '1.0-2');
|
2571
|
+
_SkyPercentPipe_defaultLocale.set(this, 'en-US');
|
2572
|
+
_SkyPercentPipe_format.set(this, void 0);
|
2573
|
+
_SkyPercentPipe_formattedValue.set(this, '');
|
2574
|
+
_SkyPercentPipe_locale.set(this, void 0);
|
2575
|
+
_SkyPercentPipe_ngUnsubscribe.set(this, new Subject());
|
2576
|
+
_SkyPercentPipe_value.set(this, void 0);
|
2577
|
+
localeProvider
|
2476
2578
|
.getLocaleInfo()
|
2477
|
-
.pipe(takeUntil(this
|
2579
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyPercentPipe_ngUnsubscribe, "f")))
|
2478
2580
|
.subscribe((localeInfo) => {
|
2479
|
-
this
|
2480
|
-
this.
|
2581
|
+
__classPrivateFieldSet(this, _SkyPercentPipe_defaultLocale, localeInfo.locale, "f");
|
2582
|
+
__classPrivateFieldGet(this, _SkyPercentPipe_instances, "m", _SkyPercentPipe_updateFormattedValue).call(this);
|
2481
2583
|
});
|
2482
2584
|
}
|
2585
|
+
get defaultLocale() {
|
2586
|
+
return __classPrivateFieldGet(this, _SkyPercentPipe_defaultLocale, "f");
|
2587
|
+
}
|
2483
2588
|
ngOnDestroy() {
|
2484
|
-
this.
|
2485
|
-
this.
|
2589
|
+
__classPrivateFieldGet(this, _SkyPercentPipe_ngUnsubscribe, "f").next();
|
2590
|
+
__classPrivateFieldGet(this, _SkyPercentPipe_ngUnsubscribe, "f").complete();
|
2486
2591
|
}
|
2487
2592
|
transform(value, format, locale) {
|
2488
|
-
this
|
2489
|
-
this
|
2490
|
-
this
|
2491
|
-
this.
|
2492
|
-
return this
|
2493
|
-
}
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2593
|
+
__classPrivateFieldSet(this, _SkyPercentPipe_value, value, "f");
|
2594
|
+
__classPrivateFieldSet(this, _SkyPercentPipe_format, format, "f");
|
2595
|
+
__classPrivateFieldSet(this, _SkyPercentPipe_locale, locale, "f");
|
2596
|
+
__classPrivateFieldGet(this, _SkyPercentPipe_instances, "m", _SkyPercentPipe_updateFormattedValue).call(this);
|
2597
|
+
return __classPrivateFieldGet(this, _SkyPercentPipe_formattedValue, "f");
|
2598
|
+
}
|
2599
|
+
}
|
2600
|
+
_SkyPercentPipe_defaultFormat = new WeakMap(), _SkyPercentPipe_defaultLocale = new WeakMap(), _SkyPercentPipe_format = new WeakMap(), _SkyPercentPipe_formattedValue = new WeakMap(), _SkyPercentPipe_locale = new WeakMap(), _SkyPercentPipe_ngUnsubscribe = new WeakMap(), _SkyPercentPipe_value = new WeakMap(), _SkyPercentPipe_instances = new WeakSet(), _SkyPercentPipe_updateFormattedValue = function _SkyPercentPipe_updateFormattedValue() {
|
2601
|
+
const locale = __classPrivateFieldGet(this, _SkyPercentPipe_locale, "f") || __classPrivateFieldGet(this, _SkyPercentPipe_defaultLocale, "f");
|
2602
|
+
const format = __classPrivateFieldGet(this, _SkyPercentPipe_format, "f") || __classPrivateFieldGet(this, _SkyPercentPipe_defaultFormat, "f");
|
2603
|
+
__classPrivateFieldSet(this, _SkyPercentPipe_formattedValue, __classPrivateFieldGet(this, _SkyPercentPipe_value, "f")
|
2604
|
+
? SkyNumberFormatUtility.formatNumber(locale, __classPrivateFieldGet(this, _SkyPercentPipe_value, "f"), SkyIntlNumberFormatStyle.Percent, format)
|
2605
|
+
: '', "f");
|
2606
|
+
};
|
2500
2607
|
SkyPercentPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyPercentPipe, deps: [{ token: i1.SkyAppLocaleProvider }], target: i0.ɵɵFactoryTarget.Pipe });
|
2501
2608
|
SkyPercentPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyPercentPipe, name: "skyPercent", pure: false });
|
2502
2609
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyPercentPipe, decorators: [{
|
@@ -2596,13 +2703,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2596
2703
|
}]
|
2597
2704
|
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
2598
2705
|
|
2599
|
-
var _SkyResizeObserverMediaQueryService_breakpoints,
|
2706
|
+
var _SkyResizeObserverMediaQueryService_instances, _SkyResizeObserverMediaQueryService_breakpoints, _SkyResizeObserverMediaQueryService_currentBreakpoint, _SkyResizeObserverMediaQueryService_currentBreakpointObs, _SkyResizeObserverMediaQueryService_ngUnsubscribe, _SkyResizeObserverMediaQueryService_resizeObserverSvc, _SkyResizeObserverMediaQueryService_target, _SkyResizeObserverMediaQueryService_updateBreakpoint, _SkyResizeObserverMediaQueryService_checkBreakpoint, _SkyResizeObserverMediaQueryService_checkWidth;
|
2707
|
+
const DEFAULT_BREAKPOINT = SkyMediaBreakpoints.md;
|
2600
2708
|
/**
|
2601
2709
|
* Acts like `SkyMediaQueryService` for a container element, emitting the same responsive breakpoints.
|
2602
2710
|
*/
|
2603
2711
|
class SkyResizeObserverMediaQueryService {
|
2604
|
-
constructor(
|
2605
|
-
this
|
2712
|
+
constructor(resizeObserverSvc) {
|
2713
|
+
_SkyResizeObserverMediaQueryService_instances.add(this);
|
2606
2714
|
_SkyResizeObserverMediaQueryService_breakpoints.set(this, [
|
2607
2715
|
{
|
2608
2716
|
check: (width) => width > 0 && width <= 767,
|
@@ -2621,25 +2729,23 @@ class SkyResizeObserverMediaQueryService {
|
|
2621
2729
|
name: SkyMediaBreakpoints.lg,
|
2622
2730
|
},
|
2623
2731
|
]);
|
2624
|
-
|
2625
|
-
|
2732
|
+
_SkyResizeObserverMediaQueryService_currentBreakpoint.set(this, DEFAULT_BREAKPOINT);
|
2733
|
+
_SkyResizeObserverMediaQueryService_currentBreakpointObs.set(this, new ReplaySubject(1));
|
2734
|
+
_SkyResizeObserverMediaQueryService_ngUnsubscribe.set(this, new Subject());
|
2735
|
+
_SkyResizeObserverMediaQueryService_resizeObserverSvc.set(this, void 0);
|
2626
2736
|
_SkyResizeObserverMediaQueryService_target.set(this, void 0);
|
2627
|
-
|
2628
|
-
__classPrivateFieldSet(this, _SkyResizeObserverMediaQueryService_target, undefined, "f");
|
2629
|
-
this.updateBreakpoint(undefined);
|
2630
|
-
});
|
2737
|
+
__classPrivateFieldSet(this, _SkyResizeObserverMediaQueryService_resizeObserverSvc, resizeObserverSvc, "f");
|
2631
2738
|
}
|
2632
2739
|
/**
|
2633
2740
|
* Returns the current breakpoint.
|
2634
2741
|
*/
|
2635
2742
|
get current() {
|
2636
|
-
return this
|
2743
|
+
return __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpoint, "f");
|
2637
2744
|
}
|
2638
2745
|
ngOnDestroy() {
|
2639
|
-
|
2640
|
-
this
|
2641
|
-
__classPrivateFieldGet(this,
|
2642
|
-
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObservable, "f").complete();
|
2746
|
+
this.unobserve();
|
2747
|
+
__classPrivateFieldSet(this, _SkyResizeObserverMediaQueryService_target, undefined, "f");
|
2748
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObs, "f").complete();
|
2643
2749
|
}
|
2644
2750
|
/**
|
2645
2751
|
* @internal
|
@@ -2656,18 +2762,17 @@ class SkyResizeObserverMediaQueryService {
|
|
2656
2762
|
if (__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_target, "f") === element) {
|
2657
2763
|
return this;
|
2658
2764
|
}
|
2659
|
-
|
2765
|
+
this.unobserve();
|
2660
2766
|
}
|
2661
2767
|
__classPrivateFieldSet(this, _SkyResizeObserverMediaQueryService_target, element, "f");
|
2662
|
-
this.
|
2663
|
-
this
|
2768
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_instances, "m", _SkyResizeObserverMediaQueryService_checkWidth).call(this, element);
|
2769
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_resizeObserverSvc, "f")
|
2664
2770
|
.observe(element)
|
2665
|
-
.pipe(takeUntil(__classPrivateFieldGet(this,
|
2771
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_ngUnsubscribe, "f")))
|
2666
2772
|
.subscribe((value) => {
|
2667
|
-
const breakpoint = this.
|
2668
|
-
|
2669
|
-
|
2670
|
-
this.updateBreakpoint(breakpoint);
|
2773
|
+
const breakpoint = __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_instances, "m", _SkyResizeObserverMediaQueryService_checkBreakpoint).call(this, value.contentRect.width);
|
2774
|
+
if (breakpoint && breakpoint !== this.current) {
|
2775
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_instances, "m", _SkyResizeObserverMediaQueryService_updateBreakpoint).call(this, breakpoint);
|
2671
2776
|
}
|
2672
2777
|
});
|
2673
2778
|
return this;
|
@@ -2676,39 +2781,33 @@ class SkyResizeObserverMediaQueryService {
|
|
2676
2781
|
* Stop watching the container element.
|
2677
2782
|
*/
|
2678
2783
|
unobserve() {
|
2679
|
-
__classPrivateFieldGet(this,
|
2784
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_ngUnsubscribe, "f").next();
|
2785
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_ngUnsubscribe, "f").complete();
|
2680
2786
|
}
|
2681
2787
|
/**
|
2682
2788
|
* Subscribes to element size changes that cross breakpoints.
|
2683
2789
|
*/
|
2684
2790
|
subscribe(listener) {
|
2685
|
-
return __classPrivateFieldGet(this,
|
2686
|
-
.pipe(takeUntil(__classPrivateFieldGet(this,
|
2791
|
+
return __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObs, "f")
|
2792
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_ngUnsubscribe, "f")))
|
2687
2793
|
.subscribe((value) => {
|
2688
2794
|
listener(value);
|
2689
2795
|
});
|
2690
2796
|
}
|
2691
|
-
updateBreakpoint(breakpoint) {
|
2692
|
-
this._currentBreakpoint = breakpoint;
|
2693
|
-
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObservable, "f").next(breakpoint);
|
2694
|
-
}
|
2695
|
-
checkBreakpoint(width) {
|
2696
|
-
const breakpoint = __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_breakpoints, "f").find((breakpoint) => breakpoint.check(width));
|
2697
|
-
/* istanbul ignore else */
|
2698
|
-
if (breakpoint) {
|
2699
|
-
return breakpoint.name;
|
2700
|
-
}
|
2701
|
-
}
|
2702
|
-
checkWidth(element) {
|
2703
|
-
const width = element.nativeElement.offsetWidth || 0;
|
2704
|
-
const breakpoint = this.checkBreakpoint(width);
|
2705
|
-
/* istanbul ignore else */
|
2706
|
-
if (breakpoint !== this._currentBreakpoint) {
|
2707
|
-
this.updateBreakpoint(breakpoint);
|
2708
|
-
}
|
2709
|
-
}
|
2710
2797
|
}
|
2711
|
-
_SkyResizeObserverMediaQueryService_breakpoints = new WeakMap(),
|
2798
|
+
_SkyResizeObserverMediaQueryService_breakpoints = new WeakMap(), _SkyResizeObserverMediaQueryService_currentBreakpoint = new WeakMap(), _SkyResizeObserverMediaQueryService_currentBreakpointObs = new WeakMap(), _SkyResizeObserverMediaQueryService_ngUnsubscribe = new WeakMap(), _SkyResizeObserverMediaQueryService_resizeObserverSvc = new WeakMap(), _SkyResizeObserverMediaQueryService_target = new WeakMap(), _SkyResizeObserverMediaQueryService_instances = new WeakSet(), _SkyResizeObserverMediaQueryService_updateBreakpoint = function _SkyResizeObserverMediaQueryService_updateBreakpoint(breakpoint) {
|
2799
|
+
__classPrivateFieldSet(this, _SkyResizeObserverMediaQueryService_currentBreakpoint, breakpoint, "f");
|
2800
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpointObs, "f").next(breakpoint);
|
2801
|
+
}, _SkyResizeObserverMediaQueryService_checkBreakpoint = function _SkyResizeObserverMediaQueryService_checkBreakpoint(width) {
|
2802
|
+
const breakpoint = __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_breakpoints, "f").find((breakpoint) => breakpoint.check(width));
|
2803
|
+
return breakpoint ? breakpoint.name : undefined;
|
2804
|
+
}, _SkyResizeObserverMediaQueryService_checkWidth = function _SkyResizeObserverMediaQueryService_checkWidth(el) {
|
2805
|
+
const width = el.nativeElement.offsetWidth || 0;
|
2806
|
+
const breakpoint = __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_instances, "m", _SkyResizeObserverMediaQueryService_checkBreakpoint).call(this, width);
|
2807
|
+
if (breakpoint && breakpoint !== __classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_currentBreakpoint, "f")) {
|
2808
|
+
__classPrivateFieldGet(this, _SkyResizeObserverMediaQueryService_instances, "m", _SkyResizeObserverMediaQueryService_updateBreakpoint).call(this, breakpoint);
|
2809
|
+
}
|
2810
|
+
};
|
2712
2811
|
SkyResizeObserverMediaQueryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverMediaQueryService, deps: [{ token: SkyResizeObserverService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2713
2812
|
SkyResizeObserverMediaQueryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverMediaQueryService, providedIn: 'any' });
|
2714
2813
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyResizeObserverMediaQueryService, decorators: [{
|
@@ -2718,6 +2817,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2718
2817
|
}]
|
2719
2818
|
}], ctorParameters: function () { return [{ type: SkyResizeObserverService }]; } });
|
2720
2819
|
|
2820
|
+
var _SkyScrollableHostService_instances, _SkyScrollableHostService_mutationObserverSvc, _SkyScrollableHostService_windowRef, _SkyScrollableHostService_findScrollableHost, _SkyScrollableHostService_observeDocumentHiddenElementChanges, _SkyScrollableHostService_observeForScrollableHostChanges, _SkyScrollableHostService_isElementVisible;
|
2721
2821
|
function notifySubscribers(subscribers, item) {
|
2722
2822
|
for (const subscriber of subscribers) {
|
2723
2823
|
subscriber.next(item);
|
@@ -2725,8 +2825,11 @@ function notifySubscribers(subscribers, item) {
|
|
2725
2825
|
}
|
2726
2826
|
class SkyScrollableHostService {
|
2727
2827
|
constructor(mutationObserverSvc, windowRef) {
|
2728
|
-
this
|
2729
|
-
this
|
2828
|
+
_SkyScrollableHostService_instances.add(this);
|
2829
|
+
_SkyScrollableHostService_mutationObserverSvc.set(this, void 0);
|
2830
|
+
_SkyScrollableHostService_windowRef.set(this, void 0);
|
2831
|
+
__classPrivateFieldSet(this, _SkyScrollableHostService_mutationObserverSvc, mutationObserverSvc, "f");
|
2832
|
+
__classPrivateFieldSet(this, _SkyScrollableHostService_windowRef, windowRef, "f");
|
2730
2833
|
}
|
2731
2834
|
/**
|
2732
2835
|
* Returns the given element's current scrollable host
|
@@ -2734,7 +2837,7 @@ class SkyScrollableHostService {
|
|
2734
2837
|
* @returns The current scrollable host
|
2735
2838
|
*/
|
2736
2839
|
getScrollableHost(elementRef) {
|
2737
|
-
return this.
|
2840
|
+
return __classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_findScrollableHost).call(this, elementRef.nativeElement);
|
2738
2841
|
}
|
2739
2842
|
/**
|
2740
2843
|
* Returns an observable which emits the given element's current scrollable host
|
@@ -2748,30 +2851,31 @@ class SkyScrollableHostService {
|
|
2748
2851
|
let documentHiddenElementMutationObserver;
|
2749
2852
|
return new Observable((subscriber) => {
|
2750
2853
|
subscribers.push(subscriber);
|
2751
|
-
let scrollableHost = this.
|
2854
|
+
let scrollableHost = __classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_findScrollableHost).call(this, elementRef.nativeElement);
|
2752
2855
|
// Setup mutation observers only once, for all subscribers.
|
2753
2856
|
if (subscribers.length === 1) {
|
2754
|
-
parentMutationObserver = this.
|
2755
|
-
const newScrollableHost = this.
|
2857
|
+
parentMutationObserver = __classPrivateFieldGet(this, _SkyScrollableHostService_mutationObserverSvc, "f").create(() => {
|
2858
|
+
const newScrollableHost = __classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_findScrollableHost).call(this, elementRef.nativeElement);
|
2756
2859
|
// Reset observer if scrollable host changes.
|
2757
2860
|
if (newScrollableHost !== scrollableHost &&
|
2758
|
-
this.
|
2861
|
+
__classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_isElementVisible).call(this, elementRef)) {
|
2759
2862
|
scrollableHost = newScrollableHost;
|
2760
|
-
this.
|
2761
|
-
notifySubscribers(subscribers, scrollableHost);
|
2762
|
-
}
|
2763
|
-
});
|
2764
|
-
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
2765
|
-
documentHiddenElementMutationObserver = this.mutationObserverSvc.create(() => {
|
2766
|
-
if (scrollableHost && !this.isElementVisible(elementRef)) {
|
2767
|
-
// If the scrollable host is not visible, set it to undefined and unsubscribe from its mutation changes.
|
2768
|
-
// Then, observe the document element so that a new scrollable host can be found.
|
2769
|
-
scrollableHost = undefined;
|
2770
|
-
this.observeForScrollableHostChanges(scrollableHost, parentMutationObserver);
|
2863
|
+
__classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_observeForScrollableHostChanges).call(this, scrollableHost, parentMutationObserver);
|
2771
2864
|
notifySubscribers(subscribers, scrollableHost);
|
2772
2865
|
}
|
2773
2866
|
});
|
2774
|
-
this.
|
2867
|
+
__classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_observeForScrollableHostChanges).call(this, scrollableHost, parentMutationObserver);
|
2868
|
+
documentHiddenElementMutationObserver =
|
2869
|
+
__classPrivateFieldGet(this, _SkyScrollableHostService_mutationObserverSvc, "f").create(() => {
|
2870
|
+
if (scrollableHost && !__classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_isElementVisible).call(this, elementRef)) {
|
2871
|
+
// If the scrollable host is not visible, set it to undefined and unsubscribe from its mutation changes.
|
2872
|
+
// Then, observe the document element so that a new scrollable host can be found.
|
2873
|
+
scrollableHost = undefined;
|
2874
|
+
__classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_observeForScrollableHostChanges).call(this, scrollableHost, parentMutationObserver);
|
2875
|
+
notifySubscribers(subscribers, scrollableHost);
|
2876
|
+
}
|
2877
|
+
});
|
2878
|
+
__classPrivateFieldGet(this, _SkyScrollableHostService_instances, "m", _SkyScrollableHostService_observeDocumentHiddenElementChanges).call(this, documentHiddenElementMutationObserver);
|
2775
2879
|
}
|
2776
2880
|
// Emit the scrollable host to the subscriber.
|
2777
2881
|
subscriber.next(scrollableHost);
|
@@ -2838,56 +2942,49 @@ class SkyScrollableHostService {
|
|
2838
2942
|
});
|
2839
2943
|
});
|
2840
2944
|
}
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
}
|
2856
|
-
style = windowObj.getComputedStyle(parent);
|
2857
|
-
} while (!regex.test(style.overflow) &&
|
2858
|
-
!regex.test(style.overflowY) &&
|
2859
|
-
parent !== bodyObj);
|
2860
|
-
if (parent === bodyObj) {
|
2945
|
+
}
|
2946
|
+
_SkyScrollableHostService_mutationObserverSvc = new WeakMap(), _SkyScrollableHostService_windowRef = new WeakMap(), _SkyScrollableHostService_instances = new WeakSet(), _SkyScrollableHostService_findScrollableHost = function _SkyScrollableHostService_findScrollableHost(element) {
|
2947
|
+
const regex = /(auto|scroll)/;
|
2948
|
+
const windowObj = __classPrivateFieldGet(this, _SkyScrollableHostService_windowRef, "f").nativeWindow;
|
2949
|
+
const bodyObj = windowObj.document.body;
|
2950
|
+
if (!element) {
|
2951
|
+
return windowObj;
|
2952
|
+
}
|
2953
|
+
let style = windowObj.getComputedStyle(element);
|
2954
|
+
let parent = element;
|
2955
|
+
do {
|
2956
|
+
parent = parent.parentNode;
|
2957
|
+
// Return `window` if the parent element has been removed from the DOM.
|
2958
|
+
if (!(parent instanceof HTMLElement)) {
|
2861
2959
|
return windowObj;
|
2862
2960
|
}
|
2863
|
-
|
2864
|
-
}
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
}
|
2961
|
+
style = windowObj.getComputedStyle(parent);
|
2962
|
+
} while (!regex.test(style.overflow) &&
|
2963
|
+
!regex.test(style.overflowY) &&
|
2964
|
+
parent !== bodyObj);
|
2965
|
+
if (parent === bodyObj) {
|
2966
|
+
return windowObj;
|
2967
|
+
}
|
2968
|
+
return parent;
|
2969
|
+
}, _SkyScrollableHostService_observeDocumentHiddenElementChanges = function _SkyScrollableHostService_observeDocumentHiddenElementChanges(mutationObserver) {
|
2970
|
+
mutationObserver.observe(document.documentElement, {
|
2971
|
+
attributes: true,
|
2972
|
+
attributeFilter: ['class', 'style', 'hidden'],
|
2973
|
+
childList: true,
|
2974
|
+
subtree: true,
|
2975
|
+
});
|
2976
|
+
}, _SkyScrollableHostService_observeForScrollableHostChanges = function _SkyScrollableHostService_observeForScrollableHostChanges(element, mutationObserver) {
|
2977
|
+
mutationObserver.disconnect();
|
2978
|
+
const target = element instanceof HTMLElement ? element : document.documentElement;
|
2979
|
+
mutationObserver.observe(target, {
|
2980
|
+
attributes: true,
|
2981
|
+
attributeFilter: ['class', 'style'],
|
2982
|
+
childList: true,
|
2983
|
+
subtree: true,
|
2984
|
+
});
|
2985
|
+
}, _SkyScrollableHostService_isElementVisible = function _SkyScrollableHostService_isElementVisible(elementRef) {
|
2986
|
+
return elementRef.nativeElement.offsetParent;
|
2987
|
+
};
|
2891
2988
|
SkyScrollableHostService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyScrollableHostService, deps: [{ token: MutationObserverService }, { token: SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
|
2892
2989
|
SkyScrollableHostService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyScrollableHostService, providedIn: 'root' });
|
2893
2990
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyScrollableHostService, decorators: [{
|
@@ -2897,12 +2994,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2897
2994
|
}]
|
2898
2995
|
}], ctorParameters: function () { return [{ type: MutationObserverService }, { type: SkyAppWindowRef }]; } });
|
2899
2996
|
|
2997
|
+
var _SkyAppTitleService_title;
|
2900
2998
|
/**
|
2901
2999
|
* Provides a method for setting a formatted title on the current window.
|
2902
3000
|
*/
|
2903
3001
|
class SkyAppTitleService {
|
2904
3002
|
constructor(title) {
|
2905
|
-
this
|
3003
|
+
_SkyAppTitleService_title.set(this, void 0);
|
3004
|
+
__classPrivateFieldSet(this, _SkyAppTitleService_title, title, "f");
|
2906
3005
|
}
|
2907
3006
|
/**
|
2908
3007
|
* Sets the title on the current window.
|
@@ -2910,11 +3009,12 @@ class SkyAppTitleService {
|
|
2910
3009
|
* each part.
|
2911
3010
|
*/
|
2912
3011
|
setTitle(args) {
|
2913
|
-
if (args
|
2914
|
-
this.
|
3012
|
+
if (args === null || args === void 0 ? void 0 : args.titleParts) {
|
3013
|
+
__classPrivateFieldGet(this, _SkyAppTitleService_title, "f").setTitle(args.titleParts.join(' - '));
|
2915
3014
|
}
|
2916
3015
|
}
|
2917
3016
|
}
|
3017
|
+
_SkyAppTitleService_title = new WeakMap();
|
2918
3018
|
SkyAppTitleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAppTitleService, deps: [{ token: i1$1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
2919
3019
|
SkyAppTitleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAppTitleService, providedIn: 'root' });
|
2920
3020
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyAppTitleService, decorators: [{
|
@@ -2924,21 +3024,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
2924
3024
|
}]
|
2925
3025
|
}], ctorParameters: function () { return [{ type: i1$1.Title }]; } });
|
2926
3026
|
|
2927
|
-
var _SkyTrimDirective_instances, _SkyTrimDirective_obs, _SkyTrimDirective_observe, _SkyTrimDirective_disconnect, _SkyTrimDirective_trim;
|
3027
|
+
var _SkyTrimDirective_instances, _SkyTrimDirective_elRef, _SkyTrimDirective_obs, _SkyTrimDirective_observe, _SkyTrimDirective_disconnect, _SkyTrimDirective_trim;
|
2928
3028
|
/**
|
2929
3029
|
* Trims whitespace in each text node that is a direct descendent of the current element.
|
2930
3030
|
*/
|
2931
3031
|
class SkyTrimDirective {
|
2932
3032
|
constructor(elRef, mutationObs) {
|
2933
|
-
this.elRef = elRef;
|
2934
|
-
this.mutationObs = mutationObs;
|
2935
3033
|
_SkyTrimDirective_instances.add(this);
|
3034
|
+
_SkyTrimDirective_elRef.set(this, void 0);
|
2936
3035
|
_SkyTrimDirective_obs.set(this, void 0);
|
2937
|
-
__classPrivateFieldSet(this,
|
3036
|
+
__classPrivateFieldSet(this, _SkyTrimDirective_elRef, elRef, "f");
|
3037
|
+
__classPrivateFieldSet(this, _SkyTrimDirective_obs, mutationObs.create((mutations) => {
|
2938
3038
|
const nodes = [];
|
2939
3039
|
// Only trim white space inside direct descendents of the current element.
|
2940
3040
|
for (const mutation of mutations) {
|
2941
|
-
if (mutation.target.parentNode ===
|
3041
|
+
if (mutation.target.parentNode === elRef.nativeElement) {
|
2942
3042
|
nodes.push(mutation.target);
|
2943
3043
|
}
|
2944
3044
|
}
|
@@ -2947,16 +3047,15 @@ class SkyTrimDirective {
|
|
2947
3047
|
__classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_observe).call(this);
|
2948
3048
|
}
|
2949
3049
|
ngOnInit() {
|
2950
|
-
const el = this.
|
3050
|
+
const el = __classPrivateFieldGet(this, _SkyTrimDirective_elRef, "f").nativeElement;
|
2951
3051
|
__classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_trim).call(this, Array.from(el.childNodes));
|
2952
3052
|
}
|
2953
3053
|
ngOnDestroy() {
|
2954
3054
|
__classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_disconnect).call(this);
|
2955
|
-
__classPrivateFieldSet(this, _SkyTrimDirective_obs, undefined, "f");
|
2956
3055
|
}
|
2957
3056
|
}
|
2958
|
-
_SkyTrimDirective_obs = new WeakMap(), _SkyTrimDirective_instances = new WeakSet(), _SkyTrimDirective_observe = function _SkyTrimDirective_observe() {
|
2959
|
-
__classPrivateFieldGet(this, _SkyTrimDirective_obs, "f").observe(this.
|
3057
|
+
_SkyTrimDirective_elRef = new WeakMap(), _SkyTrimDirective_obs = new WeakMap(), _SkyTrimDirective_instances = new WeakSet(), _SkyTrimDirective_observe = function _SkyTrimDirective_observe() {
|
3058
|
+
__classPrivateFieldGet(this, _SkyTrimDirective_obs, "f").observe(__classPrivateFieldGet(this, _SkyTrimDirective_elRef, "f").nativeElement, {
|
2960
3059
|
characterData: true,
|
2961
3060
|
subtree: true,
|
2962
3061
|
});
|
@@ -2967,7 +3066,7 @@ _SkyTrimDirective_obs = new WeakMap(), _SkyTrimDirective_instances = new WeakSet
|
|
2967
3066
|
// doesn't retrigger the observe callback.
|
2968
3067
|
__classPrivateFieldGet(this, _SkyTrimDirective_instances, "m", _SkyTrimDirective_disconnect).call(this);
|
2969
3068
|
for (const node of nodes) {
|
2970
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
3069
|
+
if (node.nodeType === Node.TEXT_NODE && node.textContent) {
|
2971
3070
|
const textContent = node.textContent;
|
2972
3071
|
const textContentTrimmed = textContent.trim();
|
2973
3072
|
if (textContent !== textContentTrimmed) {
|
@@ -3025,6 +3124,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
3025
3124
|
type: Injectable
|
3026
3125
|
}] });
|
3027
3126
|
|
3127
|
+
var _SkyViewkeeper_instances, _SkyViewkeeper_boundaryEl, _SkyViewkeeper_el, _SkyViewkeeper_id, _SkyViewkeeper_setWidth, _SkyViewkeeper_verticalOffset, _SkyViewkeeper_verticalOffsetEl, _SkyViewkeeper_viewportMarginTop, _SkyViewkeeper_currentElFixedLeft, _SkyViewkeeper_currentElFixedTop, _SkyViewkeeper_currentElFixedWidth, _SkyViewkeeper_isDestroyed, _SkyViewkeeper_scrollableHost, _SkyViewkeeper_syncElPositionHandler, _SkyViewkeeper_getSpacerId, _SkyViewkeeper_unfixEl, _SkyViewkeeper_calculateVerticalOffset, _SkyViewkeeper_shouldFixEl, _SkyViewkeeper_getFixedStyles, _SkyViewkeeper_needsUpdating, _SkyViewkeeper_fixEl, _SkyViewkeeper_getBoundaryInfo;
|
3028
3128
|
const CLS_VIEWKEEPER_FIXED = 'sky-viewkeeper-fixed';
|
3029
3129
|
const EVT_AFTER_VIEWKEEPER_SYNC = 'afterViewkeeperSync';
|
3030
3130
|
let styleEl;
|
@@ -3091,204 +3191,215 @@ function createCustomEvent(name) {
|
|
3091
3191
|
}
|
3092
3192
|
class SkyViewkeeper {
|
3093
3193
|
constructor(options) {
|
3194
|
+
var _a;
|
3195
|
+
_SkyViewkeeper_instances.add(this);
|
3196
|
+
_SkyViewkeeper_boundaryEl.set(this, void 0);
|
3197
|
+
_SkyViewkeeper_el.set(this, void 0);
|
3198
|
+
_SkyViewkeeper_id.set(this, void 0);
|
3199
|
+
_SkyViewkeeper_setWidth.set(this, void 0);
|
3200
|
+
_SkyViewkeeper_verticalOffset.set(this, void 0);
|
3201
|
+
_SkyViewkeeper_verticalOffsetEl.set(this, void 0);
|
3202
|
+
_SkyViewkeeper_viewportMarginTop.set(this, 0);
|
3203
|
+
_SkyViewkeeper_currentElFixedLeft.set(this, void 0);
|
3204
|
+
_SkyViewkeeper_currentElFixedTop.set(this, void 0);
|
3205
|
+
_SkyViewkeeper_currentElFixedWidth.set(this, void 0);
|
3206
|
+
_SkyViewkeeper_isDestroyed.set(this, false);
|
3207
|
+
_SkyViewkeeper_scrollableHost.set(this, void 0);
|
3208
|
+
_SkyViewkeeper_syncElPositionHandler.set(this, void 0);
|
3094
3209
|
options = options || /* istanbul ignore next */ {};
|
3095
|
-
this
|
3096
|
-
this.
|
3097
|
-
this
|
3098
|
-
|
3099
|
-
|
3100
|
-
this
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3210
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_el, options.el, "f");
|
3211
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_boundaryEl, options.boundaryEl, "f");
|
3212
|
+
if (!__classPrivateFieldGet(this, _SkyViewkeeper_el, "f")) {
|
3213
|
+
throw new Error('[SkyViewkeeper] The option `el` is required.');
|
3214
|
+
}
|
3215
|
+
if (!__classPrivateFieldGet(this, _SkyViewkeeper_boundaryEl, "f")) {
|
3216
|
+
throw new Error('[SkyViewkeeper] The option `boundaryEl` is required.');
|
3217
|
+
}
|
3218
|
+
const el = __classPrivateFieldGet(this, _SkyViewkeeper_el, "f");
|
3219
|
+
const boundaryEl = __classPrivateFieldGet(this, _SkyViewkeeper_boundaryEl, "f");
|
3220
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_setWidth, !!options.setWidth, "f");
|
3221
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_id, nextId(), "f");
|
3222
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_scrollableHost, options.scrollableHost, "f");
|
3223
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_verticalOffset, options.verticalOffset || 0, "f");
|
3224
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_verticalOffsetEl, options.verticalOffsetEl, "f");
|
3225
|
+
// Only set viewport margin if the scrollable host is undefined.
|
3226
|
+
if (!__classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f")) {
|
3227
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_viewportMarginTop, (_a = options.viewportMarginTop) !== null && _a !== void 0 ? _a : 0, "f");
|
3228
|
+
}
|
3229
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_syncElPositionHandler, () => this.syncElPosition(el, boundaryEl), "f");
|
3230
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeper_verticalOffsetEl, "f")) {
|
3231
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_verticalOffsetEl, "f").addEventListener(EVT_AFTER_VIEWKEEPER_SYNC, __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"));
|
3232
|
+
}
|
3233
|
+
window.addEventListener('scroll', __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"), true);
|
3234
|
+
window.addEventListener('resize', __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"));
|
3235
|
+
window.addEventListener('orientationchange', __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"));
|
3110
3236
|
ensureStyleEl();
|
3111
|
-
this.syncElPosition();
|
3112
|
-
}
|
3113
|
-
set viewportMarginTop(margin) {
|
3114
|
-
this._viewportMarginTop = margin;
|
3115
|
-
}
|
3116
|
-
get viewportMarginTop() {
|
3117
|
-
if (this.scrollableHost) {
|
3118
|
-
return 0;
|
3119
|
-
}
|
3120
|
-
else {
|
3121
|
-
return this._viewportMarginTop;
|
3122
|
-
}
|
3237
|
+
this.syncElPosition(el, boundaryEl);
|
3123
3238
|
}
|
3124
|
-
syncElPosition() {
|
3125
|
-
const verticalOffset = this.
|
3239
|
+
syncElPosition(el, boundaryEl) {
|
3240
|
+
const verticalOffset = __classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_calculateVerticalOffset).call(this);
|
3126
3241
|
// When the element isn't visible, its size can't be calculated, so don't attempt syncing position in this case.
|
3127
|
-
if (
|
3242
|
+
if (el.offsetWidth === 0 && el.offsetHeight === 0) {
|
3128
3243
|
return;
|
3129
3244
|
}
|
3130
|
-
const boundaryInfo = this.
|
3131
|
-
const fixedStyles = this.
|
3132
|
-
const doFixEl = this.
|
3133
|
-
if (this.
|
3245
|
+
const boundaryInfo = __classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_getBoundaryInfo).call(this, el, boundaryEl);
|
3246
|
+
const fixedStyles = __classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_getFixedStyles).call(this, boundaryInfo, verticalOffset);
|
3247
|
+
const doFixEl = __classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_shouldFixEl).call(this, el, boundaryInfo, verticalOffset);
|
3248
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_needsUpdating).call(this, doFixEl, fixedStyles)) {
|
3134
3249
|
if (doFixEl) {
|
3135
|
-
this.
|
3250
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_fixEl).call(this, el, boundaryInfo, fixedStyles);
|
3136
3251
|
}
|
3137
3252
|
else {
|
3138
|
-
this.
|
3253
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_unfixEl).call(this, el);
|
3139
3254
|
}
|
3140
3255
|
}
|
3141
3256
|
const evt = createCustomEvent(EVT_AFTER_VIEWKEEPER_SYNC);
|
3142
|
-
|
3257
|
+
el.dispatchEvent(evt);
|
3143
3258
|
}
|
3144
3259
|
destroy() {
|
3145
|
-
if (!this
|
3146
|
-
window.removeEventListener('scroll', this
|
3147
|
-
window.removeEventListener('resize', this
|
3148
|
-
window.removeEventListener('orientationchange', this
|
3149
|
-
this
|
3150
|
-
|
3151
|
-
this.verticalOffsetEl.removeEventListener(EVT_AFTER_VIEWKEEPER_SYNC, this.syncElPositionHandler);
|
3260
|
+
if (!__classPrivateFieldGet(this, _SkyViewkeeper_isDestroyed, "f")) {
|
3261
|
+
window.removeEventListener('scroll', __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"), true);
|
3262
|
+
window.removeEventListener('resize', __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"));
|
3263
|
+
window.removeEventListener('orientationchange', __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"));
|
3264
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeper_el, "f")) {
|
3265
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_unfixEl).call(this, __classPrivateFieldGet(this, _SkyViewkeeper_el, "f"));
|
3152
3266
|
}
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
return this.id + '-spacer';
|
3159
|
-
}
|
3160
|
-
unfixEl() {
|
3161
|
-
const spacerEl = document.getElementById(this.getSpacerId());
|
3162
|
-
if (spacerEl) {
|
3163
|
-
spacerEl.parentElement.removeChild(spacerEl);
|
3164
|
-
}
|
3165
|
-
this.el.classList.remove(CLS_VIEWKEEPER_FIXED);
|
3166
|
-
this.currentElFixedLeft =
|
3167
|
-
this.currentElFixedTop =
|
3168
|
-
this.currentElFixedWidth =
|
3169
|
-
undefined;
|
3170
|
-
let width;
|
3171
|
-
if (this.setWidth) {
|
3172
|
-
width = 'auto';
|
3173
|
-
}
|
3174
|
-
setElPosition(this.el, '', '', width, '');
|
3175
|
-
}
|
3176
|
-
calculateVerticalOffset() {
|
3177
|
-
let offset = this.verticalOffset;
|
3178
|
-
if (this.verticalOffsetEl) {
|
3179
|
-
const verticalOffsetElTopStyle = this.verticalOffsetEl.style.top;
|
3180
|
-
const verticalOffsetElTop = parseInt(verticalOffsetElTopStyle, 10) || 0;
|
3181
|
-
offset += this.verticalOffsetEl.offsetHeight + verticalOffsetElTop;
|
3182
|
-
}
|
3183
|
-
else if (this.scrollableHost) {
|
3184
|
-
offset += this.scrollableHost.getBoundingClientRect().top;
|
3267
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeper_verticalOffsetEl, "f")) {
|
3268
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_verticalOffsetEl, "f").removeEventListener(EVT_AFTER_VIEWKEEPER_SYNC, __classPrivateFieldGet(this, _SkyViewkeeper_syncElPositionHandler, "f"));
|
3269
|
+
}
|
3270
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_el, __classPrivateFieldSet(this, _SkyViewkeeper_boundaryEl, __classPrivateFieldSet(this, _SkyViewkeeper_verticalOffsetEl, undefined, "f"), "f"), "f");
|
3271
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_isDestroyed, true, "f");
|
3185
3272
|
}
|
3186
|
-
return offset;
|
3187
3273
|
}
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
const
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3274
|
+
}
|
3275
|
+
_SkyViewkeeper_boundaryEl = new WeakMap(), _SkyViewkeeper_el = new WeakMap(), _SkyViewkeeper_id = new WeakMap(), _SkyViewkeeper_setWidth = new WeakMap(), _SkyViewkeeper_verticalOffset = new WeakMap(), _SkyViewkeeper_verticalOffsetEl = new WeakMap(), _SkyViewkeeper_viewportMarginTop = new WeakMap(), _SkyViewkeeper_currentElFixedLeft = new WeakMap(), _SkyViewkeeper_currentElFixedTop = new WeakMap(), _SkyViewkeeper_currentElFixedWidth = new WeakMap(), _SkyViewkeeper_isDestroyed = new WeakMap(), _SkyViewkeeper_scrollableHost = new WeakMap(), _SkyViewkeeper_syncElPositionHandler = new WeakMap(), _SkyViewkeeper_instances = new WeakSet(), _SkyViewkeeper_getSpacerId = function _SkyViewkeeper_getSpacerId() {
|
3276
|
+
return __classPrivateFieldGet(this, _SkyViewkeeper_id, "f") + '-spacer';
|
3277
|
+
}, _SkyViewkeeper_unfixEl = function _SkyViewkeeper_unfixEl(el) {
|
3278
|
+
const spacerEl = document.getElementById(__classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_getSpacerId).call(this));
|
3279
|
+
/*istanbul ignore else*/
|
3280
|
+
if (spacerEl === null || spacerEl === void 0 ? void 0 : spacerEl.parentElement) {
|
3281
|
+
spacerEl.parentElement.removeChild(spacerEl);
|
3282
|
+
}
|
3283
|
+
el.classList.remove(CLS_VIEWKEEPER_FIXED);
|
3284
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_currentElFixedLeft, __classPrivateFieldSet(this, _SkyViewkeeper_currentElFixedTop, __classPrivateFieldSet(this, _SkyViewkeeper_currentElFixedWidth, undefined, "f"), "f"), "f");
|
3285
|
+
let width = '';
|
3286
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeper_setWidth, "f")) {
|
3287
|
+
width = 'auto';
|
3288
|
+
}
|
3289
|
+
setElPosition(el, '', '', width, '');
|
3290
|
+
}, _SkyViewkeeper_calculateVerticalOffset = function _SkyViewkeeper_calculateVerticalOffset() {
|
3291
|
+
let offset = __classPrivateFieldGet(this, _SkyViewkeeper_verticalOffset, "f");
|
3292
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeper_verticalOffsetEl, "f")) {
|
3293
|
+
const verticalOffsetElTopStyle = __classPrivateFieldGet(this, _SkyViewkeeper_verticalOffsetEl, "f").style.top;
|
3294
|
+
const verticalOffsetElTop = parseInt(verticalOffsetElTopStyle, 10) || 0;
|
3295
|
+
offset += __classPrivateFieldGet(this, _SkyViewkeeper_verticalOffsetEl, "f").offsetHeight + verticalOffsetElTop;
|
3296
|
+
}
|
3297
|
+
else if (__classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f")) {
|
3298
|
+
offset += __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f").getBoundingClientRect().top;
|
3299
|
+
}
|
3300
|
+
return offset;
|
3301
|
+
}, _SkyViewkeeper_shouldFixEl = function _SkyViewkeeper_shouldFixEl(el, boundaryInfo, verticalOffset) {
|
3302
|
+
let anchorTop;
|
3303
|
+
if (boundaryInfo.spacerEl) {
|
3304
|
+
anchorTop = getOffset(boundaryInfo.spacerEl, __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f")).top;
|
3215
3305
|
}
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3306
|
+
else {
|
3307
|
+
anchorTop = getOffset(el, __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f")).top;
|
3308
|
+
}
|
3309
|
+
const doFixEl = boundaryInfo.scrollTop + verticalOffset + __classPrivateFieldGet(this, _SkyViewkeeper_viewportMarginTop, "f") >
|
3310
|
+
anchorTop;
|
3311
|
+
return doFixEl;
|
3312
|
+
}, _SkyViewkeeper_getFixedStyles = function _SkyViewkeeper_getFixedStyles(boundaryInfo, verticalOffset) {
|
3313
|
+
// If the element needs to be fixed, this will calculate its position. The position
|
3314
|
+
// will be 0 (fully visible) unless the user is scrolling the boundary out of view.
|
3315
|
+
// In that case, the element should begin to scroll out of view with the
|
3316
|
+
// rest of the boundary by setting its top position to a negative value.
|
3317
|
+
const elFixedTop = Math.min(boundaryInfo.boundaryBottom -
|
3318
|
+
boundaryInfo.elHeight -
|
3319
|
+
boundaryInfo.scrollTop, verticalOffset);
|
3320
|
+
const elFixedWidth = boundaryInfo.boundaryEl.getBoundingClientRect().width;
|
3321
|
+
const elFixedLeft = boundaryInfo.boundaryOffset.left - boundaryInfo.scrollLeft;
|
3322
|
+
return {
|
3323
|
+
elFixedLeft,
|
3324
|
+
elFixedTop,
|
3325
|
+
elFixedWidth,
|
3326
|
+
};
|
3327
|
+
}, _SkyViewkeeper_needsUpdating = function _SkyViewkeeper_needsUpdating(doFixEl, fixedStyles) {
|
3328
|
+
if ((doFixEl &&
|
3329
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_currentElFixedLeft, "f") === fixedStyles.elFixedLeft &&
|
3330
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_currentElFixedTop, "f") === fixedStyles.elFixedTop &&
|
3331
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_currentElFixedWidth, "f") === fixedStyles.elFixedWidth) ||
|
3332
|
+
(!doFixEl &&
|
3333
|
+
!(__classPrivateFieldGet(this, _SkyViewkeeper_currentElFixedLeft, "f") !== undefined &&
|
3334
|
+
__classPrivateFieldGet(this, _SkyViewkeeper_currentElFixedLeft, "f") !== null))) {
|
3335
|
+
// The element is either currently fixed and its position and width do not need
|
3336
|
+
// to change, or the element is not currently fixed and does not need to be fixed.
|
3337
|
+
// No changes are needed.
|
3338
|
+
return false;
|
3230
3339
|
}
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3340
|
+
return true;
|
3341
|
+
}, _SkyViewkeeper_fixEl = function _SkyViewkeeper_fixEl(el, boundaryInfo, fixedStyles) {
|
3342
|
+
/* istanbul ignore else */
|
3343
|
+
/* sanity check */
|
3344
|
+
if (!boundaryInfo.spacerEl) {
|
3345
|
+
const spacerHeight = boundaryInfo.elHeight;
|
3346
|
+
const spacerEl = document.createElement('div');
|
3347
|
+
spacerEl.id = boundaryInfo.spacerId;
|
3348
|
+
spacerEl.style.height = px(spacerHeight);
|
3349
|
+
/*istanbul ignore else*/
|
3350
|
+
if (el.parentNode) {
|
3240
3351
|
el.parentNode.insertBefore(spacerEl, el.nextSibling);
|
3241
3352
|
}
|
3242
|
-
el.classList.add(CLS_VIEWKEEPER_FIXED);
|
3243
|
-
this.currentElFixedTop = fixedStyles.elFixedTop;
|
3244
|
-
this.currentElFixedLeft = fixedStyles.elFixedLeft;
|
3245
|
-
this.currentElFixedWidth = fixedStyles.elFixedWidth;
|
3246
|
-
let width;
|
3247
|
-
if (this.setWidth) {
|
3248
|
-
width = fixedStyles.elFixedWidth;
|
3249
|
-
}
|
3250
|
-
setElPosition(el, fixedStyles.elFixedLeft, fixedStyles.elFixedTop, width, this.viewportMarginTop);
|
3251
|
-
}
|
3252
|
-
getBoundaryInfo() {
|
3253
|
-
const spacerId = this.getSpacerId();
|
3254
|
-
const spacerEl = document.getElementById(spacerId);
|
3255
|
-
const boundaryEl = this.boundaryEl;
|
3256
|
-
const boundaryOffset = getOffset(boundaryEl, this.scrollableHost);
|
3257
|
-
const boundaryTop = boundaryOffset.top;
|
3258
|
-
const boundaryBottom = boundaryTop + boundaryEl.getBoundingClientRect().height;
|
3259
|
-
const scrollLeft = this.scrollableHost
|
3260
|
-
? this.scrollableHost.scrollLeft
|
3261
|
-
: document.documentElement.scrollLeft;
|
3262
|
-
const scrollTop = this.scrollableHost
|
3263
|
-
? this.scrollableHost.scrollTop
|
3264
|
-
: document.documentElement.scrollTop;
|
3265
|
-
const elHeight = getHeightWithMargin(this.el);
|
3266
|
-
return {
|
3267
|
-
boundaryBottom,
|
3268
|
-
boundaryOffset,
|
3269
|
-
boundaryEl,
|
3270
|
-
elHeight,
|
3271
|
-
scrollLeft,
|
3272
|
-
scrollTop,
|
3273
|
-
spacerId,
|
3274
|
-
spacerEl,
|
3275
|
-
};
|
3276
3353
|
}
|
3277
|
-
|
3354
|
+
el.classList.add(CLS_VIEWKEEPER_FIXED);
|
3355
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_currentElFixedTop, fixedStyles.elFixedTop, "f");
|
3356
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_currentElFixedLeft, fixedStyles.elFixedLeft, "f");
|
3357
|
+
__classPrivateFieldSet(this, _SkyViewkeeper_currentElFixedWidth, fixedStyles.elFixedWidth, "f");
|
3358
|
+
let width = 0;
|
3359
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeper_setWidth, "f")) {
|
3360
|
+
width = fixedStyles.elFixedWidth;
|
3361
|
+
}
|
3362
|
+
setElPosition(el, fixedStyles.elFixedLeft, fixedStyles.elFixedTop, width, __classPrivateFieldGet(this, _SkyViewkeeper_viewportMarginTop, "f"));
|
3363
|
+
}, _SkyViewkeeper_getBoundaryInfo = function _SkyViewkeeper_getBoundaryInfo(el, boundaryEl) {
|
3364
|
+
const spacerId = __classPrivateFieldGet(this, _SkyViewkeeper_instances, "m", _SkyViewkeeper_getSpacerId).call(this);
|
3365
|
+
const spacerEl = document.getElementById(spacerId);
|
3366
|
+
const boundaryOffset = getOffset(boundaryEl, __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f"));
|
3367
|
+
const boundaryTop = boundaryOffset.top;
|
3368
|
+
const boundaryBottom = boundaryTop + boundaryEl.getBoundingClientRect().height;
|
3369
|
+
const scrollLeft = __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f")
|
3370
|
+
? __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f").scrollLeft
|
3371
|
+
: document.documentElement.scrollLeft;
|
3372
|
+
const scrollTop = __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f")
|
3373
|
+
? __classPrivateFieldGet(this, _SkyViewkeeper_scrollableHost, "f").scrollTop
|
3374
|
+
: document.documentElement.scrollTop;
|
3375
|
+
const elHeight = getHeightWithMargin(el);
|
3376
|
+
return {
|
3377
|
+
boundaryBottom,
|
3378
|
+
boundaryOffset,
|
3379
|
+
boundaryEl,
|
3380
|
+
elHeight,
|
3381
|
+
scrollLeft,
|
3382
|
+
scrollTop,
|
3383
|
+
spacerId,
|
3384
|
+
spacerEl,
|
3385
|
+
};
|
3386
|
+
};
|
3278
3387
|
|
3388
|
+
var _SkyViewkeeperService_hostOptions;
|
3279
3389
|
/**
|
3280
3390
|
* Provides methods for creating and destroying viewkeeper instances.
|
3281
3391
|
*/
|
3282
3392
|
class SkyViewkeeperService {
|
3283
3393
|
constructor(hostOptions) {
|
3284
|
-
this
|
3394
|
+
_SkyViewkeeperService_hostOptions.set(this, void 0);
|
3395
|
+
__classPrivateFieldSet(this, _SkyViewkeeperService_hostOptions, hostOptions, "f");
|
3285
3396
|
}
|
3286
3397
|
/**
|
3287
3398
|
*
|
3288
3399
|
* @param options Creates a viewkeeper instance, applying host options where applicable.
|
3289
3400
|
*/
|
3290
3401
|
create(options) {
|
3291
|
-
options = Object.assign({}, this
|
3402
|
+
options = Object.assign({}, __classPrivateFieldGet(this, _SkyViewkeeperService_hostOptions, "f") || {}, options);
|
3292
3403
|
return new SkyViewkeeper(options);
|
3293
3404
|
}
|
3294
3405
|
/**
|
@@ -3299,6 +3410,7 @@ class SkyViewkeeperService {
|
|
3299
3410
|
vk.destroy();
|
3300
3411
|
}
|
3301
3412
|
}
|
3413
|
+
_SkyViewkeeperService_hostOptions = new WeakMap();
|
3302
3414
|
SkyViewkeeperService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyViewkeeperService, deps: [{ token: SkyViewkeeperHostOptions, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
3303
3415
|
SkyViewkeeperService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyViewkeeperService, providedIn: 'root' });
|
3304
3416
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyViewkeeperService, decorators: [{
|
@@ -3312,89 +3424,102 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
3312
3424
|
}] }];
|
3313
3425
|
} });
|
3314
3426
|
|
3427
|
+
var _SkyViewkeeperDirective_instances, _SkyViewkeeperDirective__skyViewkeeper, _SkyViewkeeperDirective_currentViewkeeperEls, _SkyViewkeeperDirective_el, _SkyViewkeeperDirective_mutationObserverSvc, _SkyViewkeeperDirective_observer, _SkyViewkeeperDirective_scrollableHostSvc, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, _SkyViewkeeperDirective_viewkeepers, _SkyViewkeeperDirective_viewkeeperSvc, _SkyViewkeeperDirective_destroyViewkeepers, _SkyViewkeeperDirective_getViewkeeperEls, _SkyViewkeeperDirective_viewkeeperElsChanged, _SkyViewkeeperDirective_detectElements;
|
3315
3428
|
class SkyViewkeeperDirective {
|
3316
|
-
constructor(el, mutationObserverSvc, viewkeeperSvc,
|
3317
|
-
this
|
3318
|
-
this
|
3319
|
-
this
|
3320
|
-
this
|
3321
|
-
this
|
3322
|
-
this
|
3429
|
+
constructor(el, mutationObserverSvc, viewkeeperSvc, scrollableHostSvc) {
|
3430
|
+
_SkyViewkeeperDirective_instances.add(this);
|
3431
|
+
_SkyViewkeeperDirective__skyViewkeeper.set(this, void 0);
|
3432
|
+
_SkyViewkeeperDirective_currentViewkeeperEls.set(this, void 0);
|
3433
|
+
_SkyViewkeeperDirective_el.set(this, void 0);
|
3434
|
+
_SkyViewkeeperDirective_mutationObserverSvc.set(this, void 0);
|
3435
|
+
_SkyViewkeeperDirective_observer.set(this, void 0);
|
3436
|
+
_SkyViewkeeperDirective_scrollableHostSvc.set(this, void 0);
|
3437
|
+
_SkyViewkeeperDirective_scrollableHostWatchUnsubscribe.set(this, void 0);
|
3438
|
+
_SkyViewkeeperDirective_viewkeepers.set(this, []);
|
3439
|
+
_SkyViewkeeperDirective_viewkeeperSvc.set(this, void 0);
|
3440
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_el, el, "f");
|
3441
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_mutationObserverSvc, mutationObserverSvc, "f");
|
3442
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_viewkeeperSvc, viewkeeperSvc, "f");
|
3443
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_scrollableHostSvc, scrollableHostSvc, "f");
|
3323
3444
|
}
|
3324
3445
|
set skyViewkeeper(value) {
|
3325
|
-
this
|
3326
|
-
this.
|
3446
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective__skyViewkeeper, value, "f");
|
3447
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_instances, "m", _SkyViewkeeperDirective_detectElements).call(this);
|
3327
3448
|
}
|
3328
3449
|
get skyViewkeeper() {
|
3329
|
-
return this
|
3450
|
+
return __classPrivateFieldGet(this, _SkyViewkeeperDirective__skyViewkeeper, "f");
|
3330
3451
|
}
|
3331
3452
|
ngOnInit() {
|
3332
|
-
this
|
3333
|
-
this.
|
3453
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_observer, __classPrivateFieldGet(this, _SkyViewkeeperDirective_mutationObserverSvc, "f").create(() => __classPrivateFieldGet(this, _SkyViewkeeperDirective_instances, "m", _SkyViewkeeperDirective_detectElements).call(this)), "f");
|
3454
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_observer, "f").observe(__classPrivateFieldGet(this, _SkyViewkeeperDirective_el, "f").nativeElement, {
|
3334
3455
|
childList: true,
|
3335
3456
|
subtree: true,
|
3336
3457
|
});
|
3337
3458
|
}
|
3338
3459
|
ngOnDestroy() {
|
3339
|
-
|
3340
|
-
this
|
3341
|
-
|
3342
|
-
|
3343
|
-
|
3344
|
-
|
3345
|
-
|
3346
|
-
|
3347
|
-
this.viewkeeperSvc.destroy(viewkeeper);
|
3348
|
-
}
|
3349
|
-
this.viewkeepers = [];
|
3350
|
-
}
|
3351
|
-
getViewkeeperEls() {
|
3352
|
-
let viewkeeperEls;
|
3353
|
-
if (this.skyViewkeeper) {
|
3354
|
-
viewkeeperEls = [];
|
3355
|
-
for (const item of this.skyViewkeeper) {
|
3356
|
-
const matchingEls = Array.from(this.el.nativeElement.querySelectorAll(item));
|
3357
|
-
viewkeeperEls = [...viewkeeperEls, ...matchingEls];
|
3358
|
-
}
|
3460
|
+
/*istanbul ignore else*/
|
3461
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeperDirective_observer, "f")) {
|
3462
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_observer, "f").disconnect();
|
3463
|
+
}
|
3464
|
+
/*istanbul ignore else*/
|
3465
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, "f")) {
|
3466
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, "f").next();
|
3467
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, "f").complete();
|
3359
3468
|
}
|
3360
|
-
|
3469
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_instances, "m", _SkyViewkeeperDirective_destroyViewkeepers).call(this);
|
3470
|
+
}
|
3471
|
+
}
|
3472
|
+
_SkyViewkeeperDirective__skyViewkeeper = new WeakMap(), _SkyViewkeeperDirective_currentViewkeeperEls = new WeakMap(), _SkyViewkeeperDirective_el = new WeakMap(), _SkyViewkeeperDirective_mutationObserverSvc = new WeakMap(), _SkyViewkeeperDirective_observer = new WeakMap(), _SkyViewkeeperDirective_scrollableHostSvc = new WeakMap(), _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe = new WeakMap(), _SkyViewkeeperDirective_viewkeepers = new WeakMap(), _SkyViewkeeperDirective_viewkeeperSvc = new WeakMap(), _SkyViewkeeperDirective_instances = new WeakSet(), _SkyViewkeeperDirective_destroyViewkeepers = function _SkyViewkeeperDirective_destroyViewkeepers() {
|
3473
|
+
for (const viewkeeper of __classPrivateFieldGet(this, _SkyViewkeeperDirective_viewkeepers, "f")) {
|
3474
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_viewkeeperSvc, "f").destroy(viewkeeper);
|
3361
3475
|
}
|
3362
|
-
|
3363
|
-
|
3476
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_viewkeepers, [], "f");
|
3477
|
+
}, _SkyViewkeeperDirective_getViewkeeperEls = function _SkyViewkeeperDirective_getViewkeeperEls() {
|
3478
|
+
let viewkeeperEls = [];
|
3479
|
+
if (this.skyViewkeeper) {
|
3480
|
+
viewkeeperEls = [];
|
3481
|
+
for (const item of this.skyViewkeeper) {
|
3482
|
+
const matchingEls = Array.from(__classPrivateFieldGet(this, _SkyViewkeeperDirective_el, "f").nativeElement.querySelectorAll(item));
|
3483
|
+
viewkeeperEls = [...viewkeeperEls, ...matchingEls];
|
3484
|
+
}
|
3485
|
+
}
|
3486
|
+
return viewkeeperEls;
|
3487
|
+
}, _SkyViewkeeperDirective_viewkeeperElsChanged = function _SkyViewkeeperDirective_viewkeeperElsChanged(viewkeeperEls) {
|
3488
|
+
if (!viewkeeperEls !== !__classPrivateFieldGet(this, _SkyViewkeeperDirective_currentViewkeeperEls, "f")) {
|
3489
|
+
return true;
|
3490
|
+
}
|
3491
|
+
if (viewkeeperEls && __classPrivateFieldGet(this, _SkyViewkeeperDirective_currentViewkeeperEls, "f")) {
|
3492
|
+
if (viewkeeperEls.length !== __classPrivateFieldGet(this, _SkyViewkeeperDirective_currentViewkeeperEls, "f").length) {
|
3364
3493
|
return true;
|
3365
3494
|
}
|
3366
|
-
|
3367
|
-
if (viewkeeperEls
|
3495
|
+
for (let i = 0, n = viewkeeperEls.length; i < n; i++) {
|
3496
|
+
if (viewkeeperEls[i] !== __classPrivateFieldGet(this, _SkyViewkeeperDirective_currentViewkeeperEls, "f")[i]) {
|
3368
3497
|
return true;
|
3369
3498
|
}
|
3370
|
-
for (let i = 0, n = viewkeeperEls.length; i < n; i++) {
|
3371
|
-
if (viewkeeperEls[i] !== this.currentViewkeeperEls[i]) {
|
3372
|
-
return true;
|
3373
|
-
}
|
3374
|
-
}
|
3375
3499
|
}
|
3376
|
-
return false;
|
3377
3500
|
}
|
3378
|
-
|
3379
|
-
|
3380
|
-
|
3381
|
-
|
3382
|
-
|
3383
|
-
|
3384
|
-
|
3385
|
-
|
3386
|
-
|
3387
|
-
|
3388
|
-
|
3389
|
-
|
3390
|
-
|
3391
|
-
|
3501
|
+
return false;
|
3502
|
+
}, _SkyViewkeeperDirective_detectElements = function _SkyViewkeeperDirective_detectElements() {
|
3503
|
+
const viewkeeperEls = __classPrivateFieldGet(this, _SkyViewkeeperDirective_instances, "m", _SkyViewkeeperDirective_getViewkeeperEls).call(this);
|
3504
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeperDirective_instances, "m", _SkyViewkeeperDirective_viewkeeperElsChanged).call(this, viewkeeperEls)) {
|
3505
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, "f")) {
|
3506
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, "f").next();
|
3507
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, "f").complete();
|
3508
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, new Subject(), "f");
|
3509
|
+
}
|
3510
|
+
else {
|
3511
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, new Subject(), "f");
|
3512
|
+
}
|
3513
|
+
if (__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostSvc, "f")) {
|
3514
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostSvc, "f")
|
3515
|
+
.watchScrollableHost(__classPrivateFieldGet(this, _SkyViewkeeperDirective_el, "f"))
|
3516
|
+
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyViewkeeperDirective_scrollableHostWatchUnsubscribe, "f")))
|
3392
3517
|
.subscribe((scrollableHost) => {
|
3393
|
-
this.
|
3518
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_instances, "m", _SkyViewkeeperDirective_destroyViewkeepers).call(this);
|
3394
3519
|
let previousViewkeeperEl;
|
3395
3520
|
for (const viewkeeperEl of viewkeeperEls) {
|
3396
|
-
this.
|
3397
|
-
boundaryEl: this.
|
3521
|
+
__classPrivateFieldGet(this, _SkyViewkeeperDirective_viewkeepers, "f").push(__classPrivateFieldGet(this, _SkyViewkeeperDirective_viewkeeperSvc, "f").create({
|
3522
|
+
boundaryEl: __classPrivateFieldGet(this, _SkyViewkeeperDirective_el, "f").nativeElement,
|
3398
3523
|
scrollableHost: scrollableHost instanceof HTMLElement
|
3399
3524
|
? scrollableHost
|
3400
3525
|
: undefined,
|
@@ -3405,10 +3530,10 @@ class SkyViewkeeperDirective {
|
|
3405
3530
|
previousViewkeeperEl = viewkeeperEl;
|
3406
3531
|
}
|
3407
3532
|
});
|
3408
|
-
this.currentViewkeeperEls = viewkeeperEls;
|
3409
3533
|
}
|
3534
|
+
__classPrivateFieldSet(this, _SkyViewkeeperDirective_currentViewkeeperEls, viewkeeperEls, "f");
|
3410
3535
|
}
|
3411
|
-
}
|
3536
|
+
};
|
3412
3537
|
SkyViewkeeperDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyViewkeeperDirective, deps: [{ token: i0.ElementRef }, { token: MutationObserverService }, { token: SkyViewkeeperService }, { token: SkyScrollableHostService, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
3413
3538
|
SkyViewkeeperDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: SkyViewkeeperDirective, selector: "[skyViewkeeper]", inputs: { skyViewkeeper: "skyViewkeeper" }, ngImport: i0 });
|
3414
3539
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: SkyViewkeeperDirective, decorators: [{
|