import { AfterViewInit , ChangeDetectorRef , Component , ElementRef , ViewChild , ViewEncapsulation , } from '@angular/core' ; import { HsConfig , HsEventBusService , HsLayoutService } from 'hslayers-ng' ; import { HsMapHostDirective } from './map-host.directive' ; @ Component ( { selector : 'hs-mat-layout' , templateUrl : './layout.component.html' , styleUrls : [ './layout.component.scss' ] , encapsulation : ViewEncapsulation . None , } ) export class HsMatLayoutComponent implements AfterViewInit { @ ViewChild ( 'hslayout' ) hslayout : ElementRef ; @ ViewChild ( HsMapHostDirective , { static : true } ) mapHost : HsMapHostDirective ; panelVisible ( which , scope ? ) { return this . HsLayoutService . panelVisible ( which , scope ) ; } panelEnabled ( which , status ? ) { return this . HsLayoutService . panelEnabled ( which , status ) ; } panelSpaceWidth ( ) { return this . HsLayoutService . panelSpaceWidth ( ) ; } constructor ( public HsConfig , public HsLayoutService , public HsEventBusService , private elementRef , private cdr ) { this . HsLayoutService . layoutElement = elementRef . nativeElement ; } ngOnInit ( ) { this . HsLayoutService . contentWrapper = this . elementRef . nativeElement . querySelector ( '.hs-content-wrapper' ) ; if ( this . HsConfig . sidebarPosition === 'left' ) { this . HsLayoutService . contentWrapper . classList . add ( 'flex-reverse' ) ; this . HsLayoutService . sidebarRight = false ; } else if ( this . HsConfig . sidebarPosition != 'invisible' ) { this . HsConfig . sidebarPosition = 'right' ; } } ngAfterViewInit ( ) { this . HsLayoutService . layoutElement = this . hslayout . nativeElement ; const hsapp = this . elementRef . nativeElement . parentElement ; this . HsEventBusService . layoutLoads . next ( { element : this . elementRef . nativeElement , innerElement : '.hs-map-space' , } ) ; this . HsLayoutService . mapSpaceRef . next ( this . mapHost . viewContainerRef ) ; this . cdr . detectChanges ( ) ; } }