import { Component , OnInit , ViewChild } from '@angular/core' ; import { LoggerService } from '../services/log4ts/logger.service' ; import { WorksheetComponent } from '../worksheet/worksheet.component' ; @ Component ( { selector : 'app-layout' , templateUrl : './layout.component.html' , styleUrls : [ './layout.component.css' ] } ) export class LayoutComponent implements OnInit { @ ViewChild ( WorksheetComponent ) private worksheet : WorksheetComponent ; public worksheetHeight : number ; private ribbonHeight : number ; constructor ( private logger ) { logger . info ( 'LayoutComponent: logger.info' ) ; } ; ngOnInit ( ) { this . ribbonHeight = document . getElementById ( 'ribbon-tabs-container' ) . clientHeight ; this . worksheetHeight = window . innerHeight - this . ribbonHeight ; } onResize ( event ) { this . ribbonHeight = document . getElementById ( 'ribbon-tabs-container' ) . clientHeight ; this . worksheetHeight = event . target . innerHeight - this . ribbonHeight ; } ribbonClicked ( event ) { const methodName = event . methodName ; if ( this . worksheet [ methodName ] ) { if ( event . hasOwnProperty ( 'param1' ) ) { const param1 = event . param1 ; this . worksheet [ methodName ] ( param1 ) ; } else { this . worksheet [ methodName ] ( ) ; } } } }