import { Injectable } from '@angular/core' ; import { Observable , Subject } from 'rxjs' ; import { ObMasterLayoutConfig } from '../master-layout.config' ; import { ObEMasterLayoutEventValues , ObIMasterLayoutEvent } from '../master-layout.model' ; @ Injectable ( { providedIn : 'root' } ) export class ObMasterLayoutComponentService { readonly configEvents$ : Observable < ObIMasterLayoutEvent > ; private readonly _events = new Subject < ObIMasterLayoutEvent > ( ) ; private _isMenuOpened = false ; private _hasCover = this . config . layout . hasCover ; private _hasOffCanvas = this . config . layout . hasOffCanvas ; private _hasMainNavigation = this . config . layout . hasMainNavigation ; private _hasLayout = this . config . layout . hasLayout ; private _hasMaxWidth = this . config . layout . hasMaxWidth ; constructor ( private readonly config ) { this . configEvents$ = this . _events . asObservable ( ) ; } get isMenuOpened ( ) { return this . _isMenuOpened ; } set isMenuOpened ( value ) { this . _isMenuOpened = value ; this . _events . next ( { name : ObEMasterLayoutEventValues . IS_MENU_OPENED , value } ) ; } get hasCover ( ) : boolean { return this . _hasCover ; } set hasCover ( value ) { this . _hasCover = value ; this . _events . next ( { name : ObEMasterLayoutEventValues . LAYOUT_HAS_COVER , value } ) ; } get hasOffCanvas ( ) : boolean { return this . _hasOffCanvas ; } set hasOffCanvas ( value ) { this . _hasOffCanvas = value ; this . _events . next ( { name : ObEMasterLayoutEventValues . LAYOUT_HAS_OFF_CANVAS , value } ) ; } get hasMainNavigation ( ) : boolean { return this . _hasMainNavigation ; } set hasMainNavigation ( value ) { this . _hasMainNavigation = value ; this . _events . next ( { name : ObEMasterLayoutEventValues . LAYOUT_HAS_MAIN_NAVIGATION , value } ) ; } get hasLayout ( ) : boolean { return this . _hasLayout ; } set hasLayout ( value ) { this . _hasLayout = value ; this . _events . next ( { name : ObEMasterLayoutEventValues . LAYOUT_HAS_DEFAULT_LAYOUT , value } ) ; } get hasMaxWidth ( ) : boolean { return this . _hasMaxWidth ; } set hasMaxWidth ( value ) { this . _hasMaxWidth = value ; this . _events . next ( { name : ObEMasterLayoutEventValues . LAYOUT_HAS_MAX_WIDTH , value } ) ; } }