import { ChangeDetectionStrategy , Component , HostBinding , Input , OnDestroy , OnInit , ViewEncapsulation } from '@angular/core' ; import { ProgressSpinnerService } from '../progress-spinner.service' ; import { ReplaySubject } from 'rxjs' ; import { takeUntil } from 'rxjs/operators' ; import { ProgressSpinner } from './progress-spinner.types' ; @ Component ( { selector : 'cmdb-progress-spinner' , templateUrl : './progress-spinner.component.html' , styleUrls : [ './progress-spinner.component.scss' ] , encapsulation : ViewEncapsulation . Emulated } ) export class ProgressSpinnerComponent implements OnInit , OnDestroy { private subscriber : ReplaySubject < void > = new ReplaySubject < void > ( ) ; /**
     * Reference name for ProgressSpinnerService.
     */ @ Input ( ) public ref : string = 'app' ; /**
     * Z Index value.
     */ @ Input ( ) public zIndex : number = 4000 ; /**
     * Fullscreen enabled
     */ @ Input ( ) public fullScreen : boolean = false ; /**
     * Fullscreen enabled
     */ @ Input ( ) public text : boolean = true ; public spinner : ProgressSpinner ; constructor ( private spinnerService ) { } public ngOnInit ( ) { this . spinnerService . getSpinner ( this . ref ) . pipe ( takeUntil ( this . subscriber ) ) . subscribe ( ( spinner ) => { this . spinner = spinner ; } ) ; } public ngOnDestroy ( ) { this . subscriber . next ( ) ; this . subscriber . complete ( ) ; } }