Merge branch 'develop' into stats-profile
This commit is contained in:
commit
3b45f2ccb5
|
@ -13,7 +13,6 @@ import {
|
||||||
import {LayoutService, SidebarItem} from "../sidebar/layout.service";
|
import {LayoutService, SidebarItem} from "../sidebar/layout.service";
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
declare var ResizeObserver;
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: '[page-content]',
|
selector: '[page-content]',
|
||||||
|
@ -99,11 +98,9 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
if (typeof document !== "undefined") {
|
if (typeof document !== "undefined") {
|
||||||
this.observeStickyFooter();
|
|
||||||
if (this.shouldSticky && typeof document !== 'undefined') {
|
if (this.shouldSticky && typeof document !== 'undefined') {
|
||||||
this.sticky.header = UIkit.sticky((this.headerSticky ? this.header.nativeElement : this.actions.nativeElement), {
|
this.initHeader();
|
||||||
offset: this.offset
|
this.observeStickyHeader();
|
||||||
});
|
|
||||||
this.subscriptions.push(UIkit.util.on(document, 'active', '#' + this.sticky.header.$el.id, () => {
|
this.subscriptions.push(UIkit.util.on(document, 'active', '#' + this.sticky.header.$el.id, () => {
|
||||||
this.isStickyActive = true;
|
this.isStickyActive = true;
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
|
@ -116,6 +113,7 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
if (this.sticky_footer) {
|
if (this.sticky_footer) {
|
||||||
let footer_offset = this.calcStickyFooterOffset(this.sticky_footer.nativeElement);
|
let footer_offset = this.calcStickyFooterOffset(this.sticky_footer.nativeElement);
|
||||||
this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {bottom: true, offset: footer_offset});
|
this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {bottom: true, offset: footer_offset});
|
||||||
|
this.observeStickyFooter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,12 +122,23 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
this.subscriptions.forEach(subscription => {
|
this.subscriptions.forEach(subscription => {
|
||||||
if (typeof ResizeObserver !== "undefined" && subscription instanceof ResizeObserver) {
|
if (typeof ResizeObserver !== "undefined" && subscription instanceof ResizeObserver) {
|
||||||
subscription.disconnect();
|
subscription.disconnect();
|
||||||
} else if (typeof ResizeObserver !== "undefined" && subscription instanceof IntersectionObserver) {
|
} else if (typeof IntersectionObserver !== "undefined" && subscription instanceof IntersectionObserver) {
|
||||||
subscription.disconnect();
|
subscription.disconnect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initHeader() {
|
||||||
|
this.sticky.header = UIkit.sticky((this.headerSticky ? this.header.nativeElement : this.actions.nativeElement), {
|
||||||
|
offset: this.offset
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
initFooter() {
|
||||||
|
let footer_offset = this.calcStickyFooterOffset(this.sticky_footer.nativeElement);
|
||||||
|
this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {bottom: true, offset: footer_offset});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workaround for sticky not update bug when sidebar is toggled.
|
* Workaround for sticky not update bug when sidebar is toggled.
|
||||||
|
@ -200,14 +209,25 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
headerObs.observe(this.header.nativeElement);
|
headerObs.observe(this.header.nativeElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private observeStickyHeader() {
|
||||||
|
if (this.sticky.header) {
|
||||||
|
let resizeObs= new ResizeObserver(entries => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
this.initHeader();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
this.subscriptions.push(resizeObs);
|
||||||
|
resizeObs.observe(this.sticky.header.$el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private observeStickyFooter() {
|
private observeStickyFooter() {
|
||||||
if (this.sticky_footer) {
|
if (this.sticky_footer) {
|
||||||
let resizeObs = new ResizeObserver(entries => {
|
let resizeObs = new ResizeObserver(entries => {
|
||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sticky.footer.offset = this.calcStickyFooterOffset(entry.target);
|
this.initFooter();
|
||||||
this.cdr.detectChanges();
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue