|  |  | @ -9,7 +9,7 @@ import { | 
			
		
	
		
			
				
					|  |  |  |   OnInit, | 
			
		
	
		
			
				
					|  |  |  |   ViewChild | 
			
		
	
		
			
				
					|  |  |  | } from '@angular/core'; | 
			
		
	
		
			
				
					|  |  |  | import { FormControl, NgControl, Validators } from '@angular/forms'; | 
			
		
	
		
			
				
					|  |  |  | import { FormControl, NgControl } from '@angular/forms'; | 
			
		
	
		
			
				
					|  |  |  | import { | 
			
		
	
		
			
				
					|  |  |  |   MatAutocomplete, | 
			
		
	
		
			
				
					|  |  |  |   MatAutocompleteSelectedEvent | 
			
		
	
	
		
			
				
					|  |  | @ -25,7 +25,8 @@ import { | 
			
		
	
		
			
				
					|  |  |  |   debounceTime, | 
			
		
	
		
			
				
					|  |  |  |   distinctUntilChanged, | 
			
		
	
		
			
				
					|  |  |  |   filter, | 
			
		
	
		
			
				
					|  |  |  |   switchMap | 
			
		
	
		
			
				
					|  |  |  |   switchMap, | 
			
		
	
		
			
				
					|  |  |  |   takeUntil | 
			
		
	
		
			
				
					|  |  |  | } from 'rxjs/operators'; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import { AbstractMatFormField } from './abstract-mat-form-field'; | 
			
		
	
	
		
			
				
					|  |  | @ -76,12 +77,18 @@ export class SymbolAutocompleteComponent | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   public ngOnInit() { | 
			
		
	
		
			
				
					|  |  |  |     super.required = this.ngControl.control?.hasValidator(Validators.required); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     if (this.disabled) { | 
			
		
	
		
			
				
					|  |  |  |       this.control.disable(); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     this.control.valueChanges | 
			
		
	
		
			
				
					|  |  |  |       .pipe(takeUntil(this.unsubscribeSubject)) | 
			
		
	
		
			
				
					|  |  |  |       .subscribe(() => { | 
			
		
	
		
			
				
					|  |  |  |         if (super.value) { | 
			
		
	
		
			
				
					|  |  |  |           super.value.dataSource = null; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |       }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     this.control.valueChanges | 
			
		
	
		
			
				
					|  |  |  |       .pipe( | 
			
		
	
		
			
				
					|  |  |  |         debounceTime(400), | 
			
		
	
	
		
			
				
					|  |  | @ -89,6 +96,7 @@ export class SymbolAutocompleteComponent | 
			
		
	
		
			
				
					|  |  |  |         filter((query) => { | 
			
		
	
		
			
				
					|  |  |  |           return isString(query) && query.length > 1; | 
			
		
	
		
			
				
					|  |  |  |         }), | 
			
		
	
		
			
				
					|  |  |  |         takeUntil(this.unsubscribeSubject), | 
			
		
	
		
			
				
					|  |  |  |         tap(() => { | 
			
		
	
		
			
				
					|  |  |  |           this.isLoading = true; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -136,11 +144,6 @@ export class SymbolAutocompleteComponent | 
			
		
	
		
			
				
					|  |  |  |   public ngDoCheck() { | 
			
		
	
		
			
				
					|  |  |  |     if (this.ngControl) { | 
			
		
	
		
			
				
					|  |  |  |       this.validateRequired(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       if (this.control.touched) { | 
			
		
	
		
			
				
					|  |  |  |         this.validateSelection(); | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       this.errorState = this.ngControl.invalid && this.ngControl.touched; | 
			
		
	
		
			
				
					|  |  |  |       this.stateChanges.next(); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
	
		
			
				
					|  |  | @ -173,13 +176,4 @@ export class SymbolAutocompleteComponent | 
			
		
	
		
			
				
					|  |  |  |       this.ngControl.control.setErrors({ invalidData: true }); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   private validateSelection() { | 
			
		
	
		
			
				
					|  |  |  |     const error = | 
			
		
	
		
			
				
					|  |  |  |       !this.isValueInOptions(this.input?.value) || | 
			
		
	
		
			
				
					|  |  |  |       this.input?.value !== super.value?.symbol; | 
			
		
	
		
			
				
					|  |  |  |     if (error) { | 
			
		
	
		
			
				
					|  |  |  |       this.ngControl.control.setErrors({ invalidData: true }); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |   } | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |