@skyux/layout 5.6.2 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/skyux-layout.umd.js +38 -41
- package/documentation.json +14 -11
- package/esm2015/index.js +1 -1
- package/esm2015/index.js.map +1 -1
- package/esm2015/lib/modules/back-to-top/back-to-top-adapter.service.js +33 -38
- package/esm2015/lib/modules/back-to-top/back-to-top-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/back-to-top/back-to-top.directive.js +1 -2
- package/esm2015/lib/modules/back-to-top/back-to-top.directive.js.map +1 -1
- package/esm2015/lib/modules/back-to-top/{back-top-top.module.js → back-to-top.module.js} +1 -1
- package/esm2015/lib/modules/back-to-top/back-to-top.module.js.map +1 -0
- package/esm2015/lib/modules/fluid-grid/column.component.js +3 -0
- package/esm2015/lib/modules/fluid-grid/column.component.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-layout-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-layout-resources.module.js.map +1 -1
- package/fesm2015/skyux-layout.js +40 -43
- package/fesm2015/skyux-layout.js.map +1 -1
- package/index.d.ts +1 -1
- package/lib/modules/back-to-top/back-to-top-adapter.service.d.ts +5 -4
- package/lib/modules/back-to-top/{back-top-top.module.d.ts → back-to-top.module.d.ts} +0 -0
- package/lib/modules/fluid-grid/column.component.d.ts +3 -0
- package/lib/modules/shared/sky-layout-resources.module.d.ts +1 -1
- package/package.json +9 -9
- package/esm2015/lib/modules/back-to-top/back-top-top.module.js.map +0 -1
package/fesm2015/skyux-layout.js
CHANGED
|
@@ -12,8 +12,8 @@ import * as i3$1 from '@skyux/theme';
|
|
|
12
12
|
import { SkyThemeModule } from '@skyux/theme';
|
|
13
13
|
import * as i1 from '@skyux/core';
|
|
14
14
|
import { SkyMediaBreakpoints, SkyDockModule, SkyCoreAdapterService } from '@skyux/core';
|
|
15
|
-
import { Subject,
|
|
16
|
-
import { takeUntil,
|
|
15
|
+
import { Subject, BehaviorSubject, forkJoin } from 'rxjs';
|
|
16
|
+
import { takeUntil, take } from 'rxjs/operators';
|
|
17
17
|
import * as i1$1 from '@skyux/i18n';
|
|
18
18
|
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
19
19
|
import * as i3$2 from '@angular/forms';
|
|
@@ -354,7 +354,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
354
354
|
/**
|
|
355
355
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
356
356
|
* The contents of this file were automatically generated by
|
|
357
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-layout' schematic.
|
|
357
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-layout' schematic.
|
|
358
358
|
* To update this file, simply rerun the command.
|
|
359
359
|
*/
|
|
360
360
|
const RESOURCES = {
|
|
@@ -439,24 +439,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
439
439
|
* @internal
|
|
440
440
|
*/
|
|
441
441
|
class SkyBackToTopDomAdapterService {
|
|
442
|
-
constructor(windowRef) {
|
|
442
|
+
constructor(windowRef, scrollableHostService) {
|
|
443
443
|
this.windowRef = windowRef;
|
|
444
|
+
this.scrollableHostService = scrollableHostService;
|
|
444
445
|
this.ngUnsubscribe = new Subject();
|
|
446
|
+
this.scrollableHostScrollEventUnsubscribe = new Subject();
|
|
445
447
|
}
|
|
446
448
|
ngOnDestroy() {
|
|
447
449
|
this.ngUnsubscribe.next();
|
|
448
450
|
this.ngUnsubscribe.complete();
|
|
451
|
+
this.scrollableHostScrollEventUnsubscribe.next();
|
|
452
|
+
this.scrollableHostScrollEventUnsubscribe.complete();
|
|
449
453
|
}
|
|
450
454
|
/**
|
|
451
455
|
* This event returns a boolean on scroll indicating whether the provided element is in view.
|
|
452
456
|
* @param elementRef The target element reference.
|
|
453
457
|
*/
|
|
454
458
|
elementInViewOnScroll(elementRef) {
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
459
|
+
const scrollableHostObservable = this.scrollableHostService.watchScrollableHostScrollEvents(elementRef);
|
|
460
|
+
const isInitiallyInView = this.isElementScrolledInView(elementRef);
|
|
461
|
+
const returnedObservable = new BehaviorSubject(isInitiallyInView);
|
|
462
|
+
scrollableHostObservable
|
|
463
|
+
.pipe(takeUntil(this.scrollableHostScrollEventUnsubscribe))
|
|
464
|
+
.subscribe(() => {
|
|
465
|
+
const isInView = this.isElementScrolledInView(elementRef);
|
|
466
|
+
returnedObservable.next(isInView);
|
|
467
|
+
});
|
|
468
|
+
return returnedObservable;
|
|
460
469
|
}
|
|
461
470
|
/**
|
|
462
471
|
* Scrolls the window or scrollable parent to the provided element.
|
|
@@ -468,9 +477,8 @@ class SkyBackToTopDomAdapterService {
|
|
|
468
477
|
if (!elementRef || !elementRef.nativeElement) {
|
|
469
478
|
return;
|
|
470
479
|
}
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
if (parent === windowObj) {
|
|
480
|
+
const scrollableHost = this.scrollableHostService.getScrollableHost(elementRef);
|
|
481
|
+
if (scrollableHost instanceof Window) {
|
|
474
482
|
// Scroll to top of window, but account for the body margin that allows for the omnibar if it exists.
|
|
475
483
|
const bodyMarginOffset = parseInt(getComputedStyle(document.body).marginTop, 10);
|
|
476
484
|
const newOffsetTop = elementRef.nativeElement.offsetTop - bodyMarginOffset;
|
|
@@ -478,45 +486,32 @@ class SkyBackToTopDomAdapterService {
|
|
|
478
486
|
}
|
|
479
487
|
else {
|
|
480
488
|
// Scroll to top of parent element.
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
do {
|
|
491
|
-
parent = parent.parentNode;
|
|
492
|
-
style = windowObj.getComputedStyle(parent);
|
|
493
|
-
} while (!regex.test(style.overflow) &&
|
|
494
|
-
!regex.test(style.overflowY) &&
|
|
495
|
-
parent !== bodyObj);
|
|
496
|
-
if (parent === bodyObj) {
|
|
497
|
-
return windowObj;
|
|
498
|
-
}
|
|
499
|
-
return parent;
|
|
500
|
-
}
|
|
501
|
-
isElementScrolledInView(element, parentElement) {
|
|
489
|
+
scrollableHost.scrollTop =
|
|
490
|
+
scrollableHost.offsetTop - elementRef.nativeElement.offsetTop;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
isElementScrolledInView(element) {
|
|
494
|
+
const parentElement = this.scrollableHostService.getScrollableHost(element.nativeElement);
|
|
495
|
+
if (!element.nativeElement.offsetParent) {
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
502
498
|
const buffer = 25;
|
|
503
|
-
const
|
|
504
|
-
const elementRect = element.getBoundingClientRect();
|
|
499
|
+
const elementRect = element.nativeElement.getBoundingClientRect();
|
|
505
500
|
/* istanbul ignore else */
|
|
506
|
-
if (parentElement
|
|
507
|
-
return elementRect.top > -buffer;
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
501
|
+
if (parentElement instanceof HTMLElement) {
|
|
510
502
|
const parentRect = parentElement.getBoundingClientRect();
|
|
511
503
|
return elementRect.top > parentRect.top - buffer;
|
|
512
504
|
}
|
|
505
|
+
else {
|
|
506
|
+
return elementRect.top > -buffer;
|
|
507
|
+
}
|
|
513
508
|
}
|
|
514
509
|
}
|
|
515
|
-
SkyBackToTopDomAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyBackToTopDomAdapterService, deps: [{ token: i1.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
510
|
+
SkyBackToTopDomAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyBackToTopDomAdapterService, deps: [{ token: i1.SkyAppWindowRef }, { token: i1.SkyScrollableHostService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
516
511
|
SkyBackToTopDomAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyBackToTopDomAdapterService });
|
|
517
512
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyBackToTopDomAdapterService, decorators: [{
|
|
518
513
|
type: Injectable
|
|
519
|
-
}], ctorParameters: function () { return [{ type: i1.SkyAppWindowRef }]; } });
|
|
514
|
+
}], ctorParameters: function () { return [{ type: i1.SkyAppWindowRef }, { type: i1.SkyScrollableHostService }]; } });
|
|
520
515
|
|
|
521
516
|
/**
|
|
522
517
|
* Specifies the type of message to send to the back to top component.
|
|
@@ -562,8 +557,7 @@ class SkyBackToTopDirective {
|
|
|
562
557
|
.subscribe((message) => this.handleIncomingMessages(message));
|
|
563
558
|
}
|
|
564
559
|
ngAfterViewInit() {
|
|
565
|
-
|
|
566
|
-
this.elementInView = this.domAdapter.isElementScrolledInView(this.element.nativeElement, scrollableParent);
|
|
560
|
+
this.elementInView = this.domAdapter.isElementScrolledInView(this.element);
|
|
567
561
|
this.handleBackToTopButton(this.elementInView);
|
|
568
562
|
this.setBackToTopListeners();
|
|
569
563
|
}
|
|
@@ -1731,6 +1725,9 @@ var SkyFluidGridGutterSize;
|
|
|
1731
1725
|
SkyFluidGridGutterSize[SkyFluidGridGutterSize["Large"] = 2] = "Large";
|
|
1732
1726
|
})(SkyFluidGridGutterSize || (SkyFluidGridGutterSize = {}));
|
|
1733
1727
|
|
|
1728
|
+
/**
|
|
1729
|
+
* Displays a column within a row of the fluid grid.
|
|
1730
|
+
*/
|
|
1734
1731
|
class SkyColumnComponent {
|
|
1735
1732
|
ngOnChanges(changes) {
|
|
1736
1733
|
/* istanbul ignore else */
|