import { Component , Input } from '@angular/core' ; import { CmdbObject } from '../../../../models/cmdb-object' ; import { RenderResult } from '../../../../models/cmdb-render' ; @ Component ( { selector : 'cmdb-object-references-type-column' , templateUrl : './object-references-type-column.component.html' , styleUrls : [ './object-references-type-column.component.scss' ] } ) export class ObjectReferencesTypeColumnComponent { public isSectionRef : boolean = false ; public isFieldRef : boolean = false ; /**
     * ID of the referenced object.
     */ @ Input ( ) public objectID : number ; /**
     * Reference object
     */ public renderResult : CmdbObject | RenderResult ; /**
     * Reference object setter
     */ @ Input ( 'object' ) public set Object ( obj ) { if ( obj ) { this . renderResult = obj ; this . isSectionRef = this . refTypeIsInFields ( obj . fields , 'ref-section-field' ) ; this . isFieldRef = this . refTypeIsInFields ( obj . fields , 'ref' ) ; } } param fields param type private private refTypeIsInFields ( fields , type ) { return fields . find ( f => f . type === type && f . value === this . objectID ) !== undefined ; } }