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