All files / components/upp-application upp-application.ts

0% Statements 0/36
0% Branches 0/14
0% Functions 0/8
0% Lines 0/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96                                                                                                                                                                                               
import { Component, AfterViewInit, OnDestroy } from '@angular/core';
import { Input } from '@angular/core';
import { ViewChild } from '@angular/core';
import { IonNav } from '@ionic/angular';
 
import { platformService } from '@unpispas/upp-base';
import { viewService } from '@unpispas/upp-base';
 
@Component({
    selector: 'upp-application',
    templateUrl: './upp-application.html',
    styleUrls: ['./upp-application.scss'],
})
export class UppApplicationComponent implements AfterViewInit, OnDestroy {
    @Input() menu: 'show' | 'hide' = 'hide';
 
    @ViewChild('ionnav', {static: false}) _ionnav: IonNav | null = null;
    private _ionnav_observer: MutationObserver | null = null;
 
    get HasMenu(){
        return this.menu == 'show';
    }
 
    get Ready(){
        return this.platform.IsReady;
    }
 
    constructor(private platform: platformService, public view: viewService){
        // nothing to do
    }
 
    ngAfterViewInit(): void {
        this.platform.ready().then(
        () => {
            this.platform._theme = this.view.Theme || 'light';
        });
 
        // avoid accesibility error for ionic element
        Iif (this._ionnav) {
            setTimeout(() => {
                const _element = (this._ionnav as any)?.el as HTMLElement;
                Iif (_element){
                    this._ionnav_observer = new MutationObserver(() => {
                        Iif (_element.getAttribute('aria-hidden') === 'true') {
                            (document.activeElement as HTMLElement)?.blur();
                        }
                    });    
 
                    this._ionnav_observer.observe(_element, { attributes: true, attributeFilter: ['aria-hidden'] });    
                }
            }, 100);
        }
    }
 
    ngOnDestroy(): void {
        Iif (this._ionnav_observer){
            this._ionnav_observer.disconnect();
            this._ionnav_observer = null;
        }
    }
}
 
@Component({
    selector: 'upp-application-menu',
    template: `
        <ng-content></ng-content>
    `,
    styleUrls: ['./upp-application.scss']
})
export class UppApplicationMenuComponent {
    // nothing to do
}
 
@Component({
    selector: 'upp-application-main',
    template: `
        <ng-content></ng-content>
    `,
    styleUrls: ['./upp-application.scss']
})
export class UppApplicationMainComponent {
    // nothing to do
}
 
@Component({
    selector: 'upp-application-page',
    template: `
        <ng-content></ng-content>
    `,
    styleUrls: ['./upp-application.scss']
})
export class UppApplicationPageComponent {
    // nothing to do
}