@skyux/core 4.7.0 → 4.9.1
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/CHANGELOG.md +17 -0
- package/bundles/skyux-core.umd.js +246 -39
- package/bundles/skyux-core.umd.js.map +1 -1
- package/bundles/skyux-core.umd.min.js +1 -1
- package/bundles/skyux-core.umd.min.js.map +1 -1
- package/esm2015/modules/dock/dock-dom-adapter.service.js +60 -3
- package/esm2015/modules/dock/dock.component.js +13 -4
- package/esm2015/modules/numeric/numeric.options.js +6 -1
- package/esm2015/modules/numeric/numeric.service.js +2 -2
- package/esm2015/modules/scrollable-host/scrollable-host.module.js +16 -0
- package/esm2015/modules/scrollable-host/scrollable-host.service.js +89 -0
- package/esm2015/modules/shared/number-format/number-format-utility.js +4 -3
- package/esm2015/modules/viewkeeper/viewkeeper-host-options.js +1 -1
- package/esm2015/modules/viewkeeper/viewkeeper-options.js +1 -1
- package/esm2015/modules/viewkeeper/viewkeeper.directive.js +35 -16
- package/esm2015/modules/viewkeeper/viewkeeper.js +27 -11
- package/esm2015/modules/viewkeeper/viewkeeper.module.js +5 -1
- package/esm2015/public_api.js +2 -1
- package/esm2015/skyux-core.js +2 -1
- package/esm5/modules/dock/dock-dom-adapter.service.js +61 -3
- package/esm5/modules/dock/dock.component.js +13 -4
- package/esm5/modules/numeric/numeric.options.js +6 -1
- package/esm5/modules/numeric/numeric.service.js +2 -2
- package/esm5/modules/scrollable-host/scrollable-host.module.js +19 -0
- package/esm5/modules/scrollable-host/scrollable-host.service.js +91 -0
- package/esm5/modules/shared/number-format/number-format-utility.js +4 -3
- package/esm5/modules/viewkeeper/viewkeeper-host-options.js +1 -1
- package/esm5/modules/viewkeeper/viewkeeper-options.js +1 -1
- package/esm5/modules/viewkeeper/viewkeeper.directive.js +45 -25
- package/esm5/modules/viewkeeper/viewkeeper.js +31 -11
- package/esm5/modules/viewkeeper/viewkeeper.module.js +5 -1
- package/esm5/public_api.js +2 -1
- package/esm5/skyux-core.js +2 -1
- package/fesm2015/skyux-core.js +226 -32
- package/fesm2015/skyux-core.js.map +1 -1
- package/fesm5/skyux-core.js +246 -41
- package/fesm5/skyux-core.js.map +1 -1
- package/modules/dock/dock-dom-adapter.service.d.ts +14 -3
- package/modules/numeric/numeric.options.d.ts +5 -0
- package/modules/scrollable-host/scrollable-host.module.d.ts +2 -0
- package/modules/scrollable-host/scrollable-host.service.d.ts +13 -0
- package/modules/shared/number-format/number-format-utility.d.ts +1 -1
- package/modules/viewkeeper/viewkeeper-host-options.d.ts +1 -0
- package/modules/viewkeeper/viewkeeper-options.d.ts +5 -0
- package/modules/viewkeeper/viewkeeper.d.ts +4 -1
- package/modules/viewkeeper/viewkeeper.directive.d.ts +4 -1
- package/package.json +2 -2
- package/public_api.d.ts +1 -0
- package/skyux-core.d.ts +1 -0
- package/skyux-core.metadata.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# 4.9.1 (2021-12-06)
|
2
|
+
|
3
|
+
- Fixed the viewkeeper directive to ignore the viewport margin when attaching to a scrollable host. [#279](https://github.com/blackbaud/skyux-core/pull/279)
|
4
|
+
|
5
|
+
# 4.9.0 (2021-11-02)
|
6
|
+
|
7
|
+
- Added the `SkyScrollableHostService` to be able to get and watch for an element's scrollable host. [#269](https://github.com/blackbaud/skyux-core/pull/269)
|
8
|
+
- Updated the viewkeeper directive to watch for scrollable hosts when positioning elements. [#269](https://github.com/blackbaud/skyux-core/pull/269)
|
9
|
+
|
10
|
+
# 4.8.1 (2021-09-29)
|
11
|
+
|
12
|
+
- Fixed the dock component to properly position elements when docked to the bottom of the screen and the `body` element does not fill the entire height of the viewport. [#258](https://github.com/blackbaud/skyux-core/pull/258)
|
13
|
+
|
14
|
+
# 4.8.0 (2021-09-10)
|
15
|
+
|
16
|
+
- Updated the `SkyNumericPipe` to format currency values using the ["accounting" currency sign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#parameters). [#251](https://github.com/blackbaud/skyux-core/pull/251) (Thanks [@Blackbaud-TomMaszk](https://github.com/Blackbaud-TomMaszk)!)
|
17
|
+
|
1
18
|
# 4.7.0 (2021-09-08)
|
2
19
|
|
3
20
|
- Added the ability to place an element at the bottom of another element or before another element when using the dock service and the dynamic component service. [#250](https://github.com/blackbaud/skyux-core/pull/250)
|
@@ -1313,16 +1313,71 @@
|
|
1313
1313
|
* @internal
|
1314
1314
|
*/
|
1315
1315
|
var SkyDockDomAdapterService = /** @class */ (function () {
|
1316
|
-
function SkyDockDomAdapterService(rendererFactory) {
|
1316
|
+
function SkyDockDomAdapterService(mutationService, rendererFactory) {
|
1317
|
+
this.mutationService = mutationService;
|
1318
|
+
this.ngUnsubscribe = new rxjs.Subject();
|
1317
1319
|
this.renderer = rendererFactory.createRenderer(undefined, undefined);
|
1318
1320
|
}
|
1321
|
+
SkyDockDomAdapterService.prototype.ngOnDestroy = function () {
|
1322
|
+
if (this.observer) {
|
1323
|
+
this.observer.disconnect();
|
1324
|
+
}
|
1325
|
+
this.ngUnsubscribe.next();
|
1326
|
+
if (this.styleElement) {
|
1327
|
+
this.destroyStyleElement();
|
1328
|
+
}
|
1329
|
+
this.currentDockHeight =
|
1330
|
+
this.ngUnsubscribe =
|
1331
|
+
this.observer =
|
1332
|
+
this.styleElement = undefined;
|
1333
|
+
};
|
1334
|
+
SkyDockDomAdapterService.prototype.setSticky = function (elementRef) {
|
1335
|
+
this.renderer.addClass(elementRef.nativeElement, 'sky-dock-sticky');
|
1336
|
+
};
|
1319
1337
|
SkyDockDomAdapterService.prototype.setZIndex = function (zIndex, elementRef) {
|
1320
1338
|
this.renderer.setStyle(elementRef.nativeElement, 'z-index', zIndex);
|
1321
1339
|
};
|
1322
1340
|
SkyDockDomAdapterService.prototype.unbindDock = function (elementRef) {
|
1323
1341
|
this.renderer.addClass(elementRef.nativeElement, 'sky-dock-unbound');
|
1324
1342
|
};
|
1343
|
+
SkyDockDomAdapterService.prototype.watchDomChanges = function (elementRef) {
|
1344
|
+
var _this = this;
|
1345
|
+
this.observer = this.mutationService.create(function () {
|
1346
|
+
_this.adjustBodyStyles(elementRef);
|
1347
|
+
});
|
1348
|
+
this.observer.observe(elementRef.nativeElement, {
|
1349
|
+
attributes: true,
|
1350
|
+
childList: true,
|
1351
|
+
characterData: true,
|
1352
|
+
subtree: true
|
1353
|
+
});
|
1354
|
+
rxjs.fromEvent(window, 'resize')
|
1355
|
+
.pipe(operators.debounceTime(250), operators.takeUntil(this.ngUnsubscribe))
|
1356
|
+
.subscribe(function () { return _this.adjustBodyStyles(elementRef); });
|
1357
|
+
};
|
1358
|
+
SkyDockDomAdapterService.prototype.adjustBodyStyles = function (elementRef) {
|
1359
|
+
var dockHeight = elementRef.nativeElement.getBoundingClientRect().height;
|
1360
|
+
if (dockHeight === this.currentDockHeight) {
|
1361
|
+
return;
|
1362
|
+
}
|
1363
|
+
// Create a style element to avoid overwriting any existing inline body styles.
|
1364
|
+
var styleElement = this.renderer.createElement('style');
|
1365
|
+
var textNode = this.renderer.createText("body { margin-bottom: " + dockHeight + "px; }");
|
1366
|
+
// Apply a `data-` attribute to make unit testing easier.
|
1367
|
+
this.renderer.setAttribute(styleElement, 'data-test-selector', 'sky-layout-dock-bottom-styles');
|
1368
|
+
this.renderer.appendChild(styleElement, textNode);
|
1369
|
+
this.renderer.appendChild(document.head, styleElement);
|
1370
|
+
if (this.styleElement) {
|
1371
|
+
this.destroyStyleElement();
|
1372
|
+
}
|
1373
|
+
this.currentDockHeight = dockHeight;
|
1374
|
+
this.styleElement = styleElement;
|
1375
|
+
};
|
1376
|
+
SkyDockDomAdapterService.prototype.destroyStyleElement = function () {
|
1377
|
+
this.renderer.removeChild(document.head, this.styleElement);
|
1378
|
+
};
|
1325
1379
|
SkyDockDomAdapterService.ctorParameters = function () { return [
|
1380
|
+
{ type: MutationObserverService },
|
1326
1381
|
{ type: core.RendererFactory2 }
|
1327
1382
|
]; };
|
1328
1383
|
SkyDockDomAdapterService = __decorate([
|
@@ -1387,8 +1442,17 @@
|
|
1387
1442
|
SkyDockComponent.prototype.setOptions = function (options) {
|
1388
1443
|
var _a, _b;
|
1389
1444
|
this.options = options;
|
1390
|
-
|
1391
|
-
|
1445
|
+
switch ((_a = this.options) === null || _a === void 0 ? void 0 : _a.location) {
|
1446
|
+
case exports.SkyDockLocation.BeforeElement:
|
1447
|
+
this.domAdapter.unbindDock(this.elementRef);
|
1448
|
+
break;
|
1449
|
+
case exports.SkyDockLocation.ElementBottom:
|
1450
|
+
this.domAdapter.setSticky(this.elementRef);
|
1451
|
+
break;
|
1452
|
+
case exports.SkyDockLocation.BodyBottom:
|
1453
|
+
default:
|
1454
|
+
this.domAdapter.watchDomChanges(this.elementRef);
|
1455
|
+
break;
|
1392
1456
|
}
|
1393
1457
|
if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.zIndex) {
|
1394
1458
|
this.domAdapter.setZIndex(this.options.zIndex, this.elementRef);
|
@@ -1427,7 +1491,7 @@
|
|
1427
1491
|
SkyDockDomAdapterService
|
1428
1492
|
],
|
1429
1493
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
1430
|
-
styles: [":host{display:flex;flex-direction:column;width:100%}:host:not(.sky-dock-unbound){position:
|
1494
|
+
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:-webkit-sticky;position:sticky}"]
|
1431
1495
|
})
|
1432
1496
|
], SkyDockComponent);
|
1433
1497
|
return SkyDockComponent;
|
@@ -1835,7 +1899,7 @@
|
|
1835
1899
|
/* istanbul ignore next */
|
1836
1900
|
function SkyNumberFormatUtility() {
|
1837
1901
|
}
|
1838
|
-
SkyNumberFormatUtility.formatNumber = function (locale, value, style, digits, currency, currencyAsSymbol) {
|
1902
|
+
SkyNumberFormatUtility.formatNumber = function (locale, value, style, digits, currency, currencyAsSymbol, currencySign) {
|
1839
1903
|
if (currency === void 0) { currency = null; }
|
1840
1904
|
if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
|
1841
1905
|
if (value == null) {
|
@@ -1878,7 +1942,8 @@
|
|
1878
1942
|
minimumFractionDigits: minFraction,
|
1879
1943
|
maximumFractionDigits: maxFraction,
|
1880
1944
|
currency: currency,
|
1881
|
-
currencyAsSymbol: currencyAsSymbol
|
1945
|
+
currencyAsSymbol: currencyAsSymbol,
|
1946
|
+
currencySign: currencySign
|
1882
1947
|
});
|
1883
1948
|
};
|
1884
1949
|
SkyNumberFormatUtility._NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
|
@@ -1967,7 +2032,7 @@
|
|
1967
2032
|
// and the appropriate string value for Angular 5+.
|
1968
2033
|
// See: https://angular.io/api/common/CurrencyPipe#parameters
|
1969
2034
|
var symbolDisplay = 'symbol';
|
1970
|
-
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), i18n.SkyIntlNumberFormatStyle.Currency, digits, options.iso, symbolDisplay);
|
2035
|
+
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), i18n.SkyIntlNumberFormatStyle.Currency, digits, options.iso, symbolDisplay, options.currencySign);
|
1971
2036
|
break;
|
1972
2037
|
// The following is a catch-all to ensure that if
|
1973
2038
|
// anything but currency (or a future option) are entered,
|
@@ -2086,6 +2151,11 @@
|
|
2086
2151
|
* @default "number"
|
2087
2152
|
*/
|
2088
2153
|
this.format = 'number';
|
2154
|
+
/**
|
2155
|
+
* Specifies the format of the currency`.
|
2156
|
+
* @default "standard"
|
2157
|
+
*/
|
2158
|
+
this.currencySign = 'standard';
|
2089
2159
|
/**
|
2090
2160
|
* Specifies the ISO4217 currency code to use for currency formatting. If you do not specify a
|
2091
2161
|
* currency code, the component uses the browser's culture to determine the currency unless your
|
@@ -2673,6 +2743,87 @@
|
|
2673
2743
|
return SkyPercentPipeModule;
|
2674
2744
|
}());
|
2675
2745
|
|
2746
|
+
var SkyScrollableHostService = /** @class */ (function () {
|
2747
|
+
function SkyScrollableHostService(mutationObserverSvc, windowRef) {
|
2748
|
+
this.mutationObserverSvc = mutationObserverSvc;
|
2749
|
+
this.windowRef = windowRef;
|
2750
|
+
}
|
2751
|
+
SkyScrollableHostService.prototype.getScrollabeHost = function (elementRef) {
|
2752
|
+
return this.findScrollableHost(elementRef.nativeElement);
|
2753
|
+
};
|
2754
|
+
SkyScrollableHostService.prototype.watchScrollableHost = function (elementRef, completionObservable) {
|
2755
|
+
var _this = this;
|
2756
|
+
var scrollableHost = this.findScrollableHost(elementRef.nativeElement);
|
2757
|
+
var behaviorSubject = new rxjs.BehaviorSubject(scrollableHost);
|
2758
|
+
var mutationObserver = this.mutationObserverSvc.create(function () {
|
2759
|
+
var newScrollableHost = _this.findScrollableHost(elementRef.nativeElement);
|
2760
|
+
if (newScrollableHost !== scrollableHost) {
|
2761
|
+
scrollableHost = newScrollableHost;
|
2762
|
+
_this.observeForScrollableHostChanges(scrollableHost, mutationObserver);
|
2763
|
+
behaviorSubject.next(scrollableHost);
|
2764
|
+
}
|
2765
|
+
});
|
2766
|
+
this.observeForScrollableHostChanges(scrollableHost, mutationObserver);
|
2767
|
+
completionObservable.pipe(operators.take(1)).subscribe(function () {
|
2768
|
+
mutationObserver.disconnect();
|
2769
|
+
});
|
2770
|
+
return behaviorSubject;
|
2771
|
+
};
|
2772
|
+
SkyScrollableHostService.prototype.findScrollableHost = function (element) {
|
2773
|
+
var regex = /(auto|scroll)/;
|
2774
|
+
var windowObj = this.windowRef.nativeWindow;
|
2775
|
+
var bodyObj = windowObj.document.body;
|
2776
|
+
/* Sanity check */
|
2777
|
+
if (!element) {
|
2778
|
+
return windowObj;
|
2779
|
+
}
|
2780
|
+
var style = windowObj.getComputedStyle(element);
|
2781
|
+
var parent = element;
|
2782
|
+
do {
|
2783
|
+
parent = parent.parentNode;
|
2784
|
+
/* Sanity check for if this function is called for an element which has been removed from the DOM */
|
2785
|
+
if (!(parent instanceof HTMLElement)) {
|
2786
|
+
return windowObj;
|
2787
|
+
}
|
2788
|
+
style = windowObj.getComputedStyle(parent);
|
2789
|
+
} while (!regex.test(style.overflow) &&
|
2790
|
+
!regex.test(style.overflowY) &&
|
2791
|
+
parent !== bodyObj);
|
2792
|
+
if (parent === bodyObj) {
|
2793
|
+
return windowObj;
|
2794
|
+
}
|
2795
|
+
return parent;
|
2796
|
+
};
|
2797
|
+
SkyScrollableHostService.prototype.observeForScrollableHostChanges = function (element, mutationObserver) {
|
2798
|
+
mutationObserver.disconnect();
|
2799
|
+
if (element instanceof HTMLElement) {
|
2800
|
+
mutationObserver.observe(element, {
|
2801
|
+
attributes: true,
|
2802
|
+
attributeFilter: ['class', 'style.overflow', 'style.overflow-y'],
|
2803
|
+
subtree: true
|
2804
|
+
});
|
2805
|
+
}
|
2806
|
+
else {
|
2807
|
+
mutationObserver.observe(document.documentElement, {
|
2808
|
+
attributes: true,
|
2809
|
+
attributeFilter: ['class', 'style.overflow', 'style.overflow-y'],
|
2810
|
+
subtree: true
|
2811
|
+
});
|
2812
|
+
}
|
2813
|
+
};
|
2814
|
+
SkyScrollableHostService.ctorParameters = function () { return [
|
2815
|
+
{ type: MutationObserverService },
|
2816
|
+
{ type: SkyAppWindowRef }
|
2817
|
+
]; };
|
2818
|
+
SkyScrollableHostService.ɵprov = core.ɵɵdefineInjectable({ factory: function SkyScrollableHostService_Factory() { return new SkyScrollableHostService(core.ɵɵinject(MutationObserverService), core.ɵɵinject(SkyAppWindowRef)); }, token: SkyScrollableHostService, providedIn: "root" });
|
2819
|
+
SkyScrollableHostService = __decorate([
|
2820
|
+
core.Injectable({
|
2821
|
+
providedIn: 'root'
|
2822
|
+
})
|
2823
|
+
], SkyScrollableHostService);
|
2824
|
+
return SkyScrollableHostService;
|
2825
|
+
}());
|
2826
|
+
|
2676
2827
|
/**
|
2677
2828
|
* Provides a method for setting a formatted title on the current window.
|
2678
2829
|
*/
|
@@ -2740,11 +2891,12 @@
|
|
2740
2891
|
nextIdIndex = (nextIdIndex || 0) + 1;
|
2741
2892
|
return 'viewkeeper-' + nextIdIndex;
|
2742
2893
|
}
|
2743
|
-
function getOffset(el) {
|
2894
|
+
function getOffset(el, scrollableHost) {
|
2744
2895
|
var rect = el.getBoundingClientRect();
|
2896
|
+
var parent = scrollableHost ? scrollableHost : document.documentElement;
|
2745
2897
|
return {
|
2746
|
-
top: rect.top +
|
2747
|
-
left: rect.left +
|
2898
|
+
top: rect.top + parent.scrollTop,
|
2899
|
+
left: rect.left + parent.scrollLeft
|
2748
2900
|
};
|
2749
2901
|
}
|
2750
2902
|
function px(value) {
|
@@ -2781,6 +2933,7 @@
|
|
2781
2933
|
this.id = nextId();
|
2782
2934
|
this.el = options.el;
|
2783
2935
|
this.boundaryEl = options.boundaryEl;
|
2936
|
+
this.scrollableHost = options.scrollableHost;
|
2784
2937
|
this.verticalOffset = options.verticalOffset || 0;
|
2785
2938
|
this.verticalOffsetEl = options.verticalOffsetEl;
|
2786
2939
|
this.viewportMarginTop = options.viewportMarginTop || 0;
|
@@ -2788,12 +2941,27 @@
|
|
2788
2941
|
if (this.verticalOffsetEl) {
|
2789
2942
|
this.verticalOffsetEl.addEventListener(EVT_AFTER_VIEWKEEPER_SYNC, this.syncElPositionHandler);
|
2790
2943
|
}
|
2791
|
-
window.addEventListener('scroll', this.syncElPositionHandler);
|
2944
|
+
window.addEventListener('scroll', this.syncElPositionHandler, true);
|
2792
2945
|
window.addEventListener('resize', this.syncElPositionHandler);
|
2793
2946
|
window.addEventListener('orientationchange', this.syncElPositionHandler);
|
2794
2947
|
ensureStyleEl();
|
2795
2948
|
this.syncElPosition();
|
2796
2949
|
}
|
2950
|
+
Object.defineProperty(SkyViewkeeper.prototype, "viewportMarginTop", {
|
2951
|
+
get: function () {
|
2952
|
+
if (this.scrollableHost) {
|
2953
|
+
return 0;
|
2954
|
+
}
|
2955
|
+
else {
|
2956
|
+
return this._viewportMarginTop;
|
2957
|
+
}
|
2958
|
+
},
|
2959
|
+
set: function (margin) {
|
2960
|
+
this._viewportMarginTop = margin;
|
2961
|
+
},
|
2962
|
+
enumerable: true,
|
2963
|
+
configurable: true
|
2964
|
+
});
|
2797
2965
|
SkyViewkeeper.prototype.syncElPosition = function () {
|
2798
2966
|
var verticalOffset = this.calculateVerticalOffset();
|
2799
2967
|
// When the element isn't visible, its size can't be calculated, so don't attempt syncing position in this case.
|
@@ -2816,7 +2984,7 @@
|
|
2816
2984
|
};
|
2817
2985
|
SkyViewkeeper.prototype.destroy = function () {
|
2818
2986
|
if (!this.isDestroyed) {
|
2819
|
-
window.removeEventListener('scroll', this.syncElPositionHandler);
|
2987
|
+
window.removeEventListener('scroll', this.syncElPositionHandler, true);
|
2820
2988
|
window.removeEventListener('resize', this.syncElPositionHandler);
|
2821
2989
|
window.removeEventListener('orientationchange', this.syncElPositionHandler);
|
2822
2990
|
this.unfixEl();
|
@@ -2854,16 +3022,19 @@
|
|
2854
3022
|
var verticalOffsetElTop = parseInt(verticalOffsetElTopStyle, 10) || 0;
|
2855
3023
|
offset += (this.verticalOffsetEl.offsetHeight + verticalOffsetElTop);
|
2856
3024
|
}
|
3025
|
+
else if (this.scrollableHost) {
|
3026
|
+
offset += this.scrollableHost.getBoundingClientRect().top;
|
3027
|
+
}
|
2857
3028
|
return offset;
|
2858
3029
|
};
|
2859
3030
|
SkyViewkeeper.prototype.shouldFixEl = function (boundaryInfo, verticalOffset) {
|
2860
3031
|
var anchorTop;
|
2861
3032
|
var doFixEl;
|
2862
3033
|
if (boundaryInfo.spacerEl) {
|
2863
|
-
anchorTop = getOffset(boundaryInfo.spacerEl).top;
|
3034
|
+
anchorTop = getOffset(boundaryInfo.spacerEl, this.scrollableHost).top;
|
2864
3035
|
}
|
2865
3036
|
else {
|
2866
|
-
anchorTop = getOffset(this.el).top;
|
3037
|
+
anchorTop = getOffset(this.el, this.scrollableHost).top;
|
2867
3038
|
}
|
2868
3039
|
doFixEl = boundaryInfo.scrollTop + verticalOffset + this.viewportMarginTop > anchorTop;
|
2869
3040
|
return doFixEl;
|
@@ -2922,11 +3093,11 @@
|
|
2922
3093
|
var spacerId = this.getSpacerId();
|
2923
3094
|
var spacerEl = document.getElementById(spacerId);
|
2924
3095
|
var boundaryEl = this.boundaryEl;
|
2925
|
-
var boundaryOffset = getOffset(boundaryEl);
|
3096
|
+
var boundaryOffset = getOffset(boundaryEl, this.scrollableHost);
|
2926
3097
|
var boundaryTop = boundaryOffset.top;
|
2927
3098
|
var boundaryBottom = boundaryTop + boundaryEl.getBoundingClientRect().height;
|
2928
|
-
var scrollLeft = document.documentElement.scrollLeft;
|
2929
|
-
var scrollTop = document.documentElement.scrollTop;
|
3099
|
+
var scrollLeft = this.scrollableHost ? this.scrollableHost.scrollLeft : document.documentElement.scrollLeft;
|
3100
|
+
var scrollTop = this.scrollableHost ? this.scrollableHost.scrollTop : document.documentElement.scrollTop;
|
2930
3101
|
var elHeight = getHeightWithMargin(this.el);
|
2931
3102
|
return {
|
2932
3103
|
boundaryBottom: boundaryBottom,
|
@@ -2975,11 +3146,13 @@
|
|
2975
3146
|
}());
|
2976
3147
|
|
2977
3148
|
var SkyViewkeeperDirective = /** @class */ (function () {
|
2978
|
-
function SkyViewkeeperDirective(el, mutationObserverSvc, viewkeeperSvc) {
|
3149
|
+
function SkyViewkeeperDirective(el, mutationObserverSvc, viewkeeperSvc, scrollableHostService) {
|
2979
3150
|
this.el = el;
|
2980
3151
|
this.mutationObserverSvc = mutationObserverSvc;
|
2981
3152
|
this.viewkeeperSvc = viewkeeperSvc;
|
3153
|
+
this.scrollableHostService = scrollableHostService;
|
2982
3154
|
this.viewkeepers = [];
|
3155
|
+
this.scrollableHostWatchUnsubscribe = undefined;
|
2983
3156
|
}
|
2984
3157
|
Object.defineProperty(SkyViewkeeperDirective.prototype, "skyViewkeeper", {
|
2985
3158
|
get: function () {
|
@@ -3060,37 +3233,51 @@
|
|
3060
3233
|
return false;
|
3061
3234
|
};
|
3062
3235
|
SkyViewkeeperDirective.prototype.detectElements = function () {
|
3063
|
-
var
|
3236
|
+
var _this = this;
|
3064
3237
|
var viewkeeperEls = this.getViewkeeperEls();
|
3065
3238
|
if (this.viewkeeperElsChanged(viewkeeperEls)) {
|
3066
|
-
this.
|
3067
|
-
|
3068
|
-
|
3069
|
-
for (var viewkeeperEls_1 = __values(viewkeeperEls), viewkeeperEls_1_1 = viewkeeperEls_1.next(); !viewkeeperEls_1_1.done; viewkeeperEls_1_1 = viewkeeperEls_1.next()) {
|
3070
|
-
var viewkeeperEl = viewkeeperEls_1_1.value;
|
3071
|
-
this.viewkeepers.push(this.viewkeeperSvc.create({
|
3072
|
-
boundaryEl: this.el.nativeElement,
|
3073
|
-
el: viewkeeperEl,
|
3074
|
-
setWidth: true,
|
3075
|
-
verticalOffsetEl: previousViewkeeperEl
|
3076
|
-
}));
|
3077
|
-
previousViewkeeperEl = viewkeeperEl;
|
3078
|
-
}
|
3239
|
+
if (this.scrollableHostWatchUnsubscribe) {
|
3240
|
+
this.scrollableHostWatchUnsubscribe.next();
|
3241
|
+
this.scrollableHostWatchUnsubscribe = new rxjs.Subject();
|
3079
3242
|
}
|
3080
|
-
|
3081
|
-
|
3243
|
+
else {
|
3244
|
+
this.scrollableHostWatchUnsubscribe = new rxjs.Subject();
|
3245
|
+
}
|
3246
|
+
this.scrollableHostService.watchScrollableHost(this.el, this.scrollableHostWatchUnsubscribe)
|
3247
|
+
.pipe(operators.takeUntil(this.scrollableHostWatchUnsubscribe))
|
3248
|
+
.subscribe(function (scrollableHost) {
|
3249
|
+
var e_3, _a;
|
3250
|
+
_this.destroyViewkeepers();
|
3251
|
+
var previousViewkeeperEl;
|
3082
3252
|
try {
|
3083
|
-
|
3253
|
+
for (var viewkeeperEls_1 = __values(viewkeeperEls), viewkeeperEls_1_1 = viewkeeperEls_1.next(); !viewkeeperEls_1_1.done; viewkeeperEls_1_1 = viewkeeperEls_1.next()) {
|
3254
|
+
var viewkeeperEl = viewkeeperEls_1_1.value;
|
3255
|
+
_this.viewkeepers.push(_this.viewkeeperSvc.create({
|
3256
|
+
boundaryEl: _this.el.nativeElement,
|
3257
|
+
scrollableHost: scrollableHost instanceof HTMLElement ? scrollableHost : undefined,
|
3258
|
+
el: viewkeeperEl,
|
3259
|
+
setWidth: true,
|
3260
|
+
verticalOffsetEl: previousViewkeeperEl
|
3261
|
+
}));
|
3262
|
+
previousViewkeeperEl = viewkeeperEl;
|
3263
|
+
}
|
3084
3264
|
}
|
3085
|
-
|
3086
|
-
|
3265
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
3266
|
+
finally {
|
3267
|
+
try {
|
3268
|
+
if (viewkeeperEls_1_1 && !viewkeeperEls_1_1.done && (_a = viewkeeperEls_1.return)) _a.call(viewkeeperEls_1);
|
3269
|
+
}
|
3270
|
+
finally { if (e_3) throw e_3.error; }
|
3271
|
+
}
|
3272
|
+
});
|
3087
3273
|
this.currentViewkeeperEls = viewkeeperEls;
|
3088
3274
|
}
|
3089
3275
|
};
|
3090
3276
|
SkyViewkeeperDirective.ctorParameters = function () { return [
|
3091
3277
|
{ type: core.ElementRef },
|
3092
3278
|
{ type: MutationObserverService },
|
3093
|
-
{ type: SkyViewkeeperService }
|
3279
|
+
{ type: SkyViewkeeperService },
|
3280
|
+
{ type: SkyScrollableHostService, decorators: [{ type: core.Optional }] }
|
3094
3281
|
]; };
|
3095
3282
|
__decorate([
|
3096
3283
|
core.Input()
|
@@ -3098,11 +3285,26 @@
|
|
3098
3285
|
SkyViewkeeperDirective = __decorate([
|
3099
3286
|
core.Directive({
|
3100
3287
|
selector: '[skyViewkeeper]'
|
3101
|
-
})
|
3288
|
+
}),
|
3289
|
+
__param(3, core.Optional())
|
3102
3290
|
], SkyViewkeeperDirective);
|
3103
3291
|
return SkyViewkeeperDirective;
|
3104
3292
|
}());
|
3105
3293
|
|
3294
|
+
var SkyScrollableHostModule = /** @class */ (function () {
|
3295
|
+
function SkyScrollableHostModule() {
|
3296
|
+
}
|
3297
|
+
SkyScrollableHostModule = __decorate([
|
3298
|
+
core.NgModule({
|
3299
|
+
providers: [
|
3300
|
+
MutationObserverService,
|
3301
|
+
SkyAppWindowRef
|
3302
|
+
]
|
3303
|
+
})
|
3304
|
+
], SkyScrollableHostModule);
|
3305
|
+
return SkyScrollableHostModule;
|
3306
|
+
}());
|
3307
|
+
|
3106
3308
|
var SkyViewkeeperModule = /** @class */ (function () {
|
3107
3309
|
function SkyViewkeeperModule() {
|
3108
3310
|
}
|
@@ -3111,6 +3313,9 @@
|
|
3111
3313
|
declarations: [
|
3112
3314
|
SkyViewkeeperDirective
|
3113
3315
|
],
|
3316
|
+
imports: [
|
3317
|
+
SkyScrollableHostModule
|
3318
|
+
],
|
3114
3319
|
exports: [
|
3115
3320
|
SkyViewkeeperDirective
|
3116
3321
|
],
|
@@ -3151,6 +3356,7 @@
|
|
3151
3356
|
exports.SkyOverlayService = SkyOverlayService;
|
3152
3357
|
exports.SkyPercentPipe = SkyPercentPipe;
|
3153
3358
|
exports.SkyPercentPipeModule = SkyPercentPipeModule;
|
3359
|
+
exports.SkyScrollableHostService = SkyScrollableHostService;
|
3154
3360
|
exports.SkyUIConfigService = SkyUIConfigService;
|
3155
3361
|
exports.SkyViewkeeperHostOptions = SkyViewkeeperHostOptions;
|
3156
3362
|
exports.SkyViewkeeperModule = SkyViewkeeperModule;
|
@@ -3166,6 +3372,7 @@
|
|
3166
3372
|
exports.ɵh = SkyOverlayContext;
|
3167
3373
|
exports.ɵi = SkyOverlayAdapterService;
|
3168
3374
|
exports.ɵj = SkyViewkeeperDirective;
|
3375
|
+
exports.ɵk = SkyScrollableHostModule;
|
3169
3376
|
|
3170
3377
|
Object.defineProperty(exports, '__esModule', { value: true });
|
3171
3378
|
|