import { Component , OnDestroy , OnInit } from '@angular/core' ; import { ConfigEditBaseComponent } from '../config.edit' ; import { ReplaySubject } from 'rxjs' ; import { FormControl , Validators } from '@angular/forms' ; @ Component ( { selector : 'cmdb-section-field-edit' , templateUrl : './section-field-edit.component.html' } ) export class SectionFieldEditComponent extends ConfigEditBaseComponent implements OnInit , OnDestroy { protected protected subscriber : ReplaySubject < void > = new ReplaySubject < void > ( ) ; /**
     * Name form control.
     */ public nameControl : FormControl = new FormControl ( '' , Validators . required ) ; /**
     * Label form control.
     */ public labelControl : FormControl = new FormControl ( '' , Validators . required ) ; public constructor ( ) { super ( ) ; } public ngOnInit ( ) { this . form . addControl ( 'name' , this . nameControl ) ; this . form . addControl ( 'label' , this . labelControl ) ; this . disableControlOnEdit ( this . nameControl ) ; this . patchData ( this . data , this . form ) ; } public ngOnDestroy ( ) { this . subscriber . next ( ) ; this . subscriber . complete ( ) ; } }