|
|
|
@ -23,8 +23,7 @@ import { |
|
|
|
OnInit, |
|
|
|
ViewChild, |
|
|
|
ViewEncapsulation, |
|
|
|
Injector, |
|
|
|
AfterViewInit |
|
|
|
Injector |
|
|
|
} from '@angular/core'; |
|
|
|
import { |
|
|
|
ControlValueAccessor, |
|
|
|
@ -52,7 +51,7 @@ import { ResourcesService } from '@core/services/resources.service'; |
|
|
|
], |
|
|
|
encapsulation: ViewEncapsulation.None |
|
|
|
}) |
|
|
|
export class UnitInputComponent implements ControlValueAccessor, OnInit, AfterViewInit { |
|
|
|
export class UnitInputComponent implements ControlValueAccessor, OnInit { |
|
|
|
|
|
|
|
@HostBinding('style.display') get hostDisplay() {return 'flex';}; |
|
|
|
|
|
|
|
@ -88,7 +87,7 @@ export class UnitInputComponent implements ControlValueAccessor, OnInit, AfterVi |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
this.unitsFormControl = this.fb.control('', []); |
|
|
|
this.unitsFormControl = this.fb.control('', this.required ? [Validators.required] : []); |
|
|
|
this.filteredUnits = this.unitsFormControl.valueChanges |
|
|
|
.pipe( |
|
|
|
tap(value => { |
|
|
|
@ -99,12 +98,6 @@ export class UnitInputComponent implements ControlValueAccessor, OnInit, AfterVi |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
ngAfterViewInit() { |
|
|
|
if (this.required) { |
|
|
|
this.unitsFormControl.setValidators([Validators.required]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
writeValue(symbol?: string): void { |
|
|
|
this.searchText = ''; |
|
|
|
this.modelValue = symbol; |
|
|
|
|