diff --git a/utils/modal/full-screen-modal/full-screen-modal.component.ts b/utils/modal/full-screen-modal/full-screen-modal.component.ts index bd04aeee..e7e010fd 100644 --- a/utils/modal/full-screen-modal/full-screen-modal.component.ts +++ b/utils/modal/full-screen-modal/full-screen-modal.component.ts @@ -12,6 +12,7 @@ import { import {fromEvent, Subscription} from 'rxjs'; import {delay} from "rxjs/operators"; import {HelperFunctions} from "../../HelperFunctions.class"; +import {LayoutService} from "../../../dashboard/sharedComponents/sidebar/layout.service"; declare var UIkit; declare var ResizeObserver; @@ -24,12 +25,13 @@ declare var ResizeObserver;
-

{{title}}

+

{{title}}

+

{{title}}

@@ -64,6 +66,7 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy { title: string; okButton: boolean = false; okButtonText = 'OK'; + isMobile: boolean = false; @Input() okButtonDisabled = false; @Output() @@ -76,8 +79,9 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy { observer: any; headerHeight: number; bodyHeight: number; + private subscriptions: any[] = []; - constructor(private cdr: ChangeDetectorRef) { + constructor(private cdr: ChangeDetectorRef, private layoutService: LayoutService) { } @HostListener('window:resize', ['$event']) @@ -88,6 +92,9 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy { ngOnInit() { FullScreenModalComponent.FS_MODAL_COUNTER++; this.id = 'fs-modal-' + FullScreenModalComponent.FS_MODAL_COUNTER; + this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { + this.isMobile = isMobile; + })) } ngAfterViewInit() { @@ -104,7 +111,7 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy { /* Height = Viewport - header - (Body padding) */ changeHeight() { if(typeof window !== "undefined" && this.header) { - this.bodyHeight = window.innerHeight - this.header.nativeElement.clientHeight - 80; + this.bodyHeight = window.innerHeight - this.header.nativeElement.clientHeight - (this.isMobile?40:80); this.cdr.detectChanges(); } } @@ -122,7 +129,11 @@ export class FullScreenModalComponent implements AfterViewInit, OnDestroy { } } } - + this.subscriptions.forEach(subscription => { + if(subscription instanceof Subscription) { + subscription.unsubscribe(); + } + }) } get isOpen() {