|
|
|
@ -15,11 +15,10 @@ import { |
|
|
|
inject, |
|
|
|
Injector, |
|
|
|
Input, |
|
|
|
OnChanges, |
|
|
|
Optional, |
|
|
|
OnChanges, Optional, |
|
|
|
SimpleChanges, |
|
|
|
SkipSelf, |
|
|
|
ViewChild, |
|
|
|
ViewChild |
|
|
|
} from '@angular/core'; |
|
|
|
import { |
|
|
|
ControlContainer, |
|
|
|
@ -94,6 +93,7 @@ export class ExtensibleFormPropComponent implements OnChanges, AfterViewInit { |
|
|
|
@Input() data!: PropData; |
|
|
|
@Input() prop!: FormProp; |
|
|
|
@Input() first?: boolean; |
|
|
|
@Input() isFirstGroup?: boolean; |
|
|
|
@ViewChild('field') private fieldRef!: ElementRef<HTMLElement>; |
|
|
|
|
|
|
|
injectorForCustomComponent?: Injector; |
|
|
|
@ -124,10 +124,10 @@ export class ExtensibleFormPropComponent implements OnChanges, AfterViewInit { |
|
|
|
search = (text$: Observable<string>) => |
|
|
|
text$ |
|
|
|
? text$.pipe( |
|
|
|
debounceTime(300), |
|
|
|
distinctUntilChanged(), |
|
|
|
switchMap(text => this.prop?.options?.(this.data, text) || of([])), |
|
|
|
) |
|
|
|
debounceTime(300), |
|
|
|
distinctUntilChanged(), |
|
|
|
switchMap(text => this.prop?.options?.(this.data, text) || of([])), |
|
|
|
) |
|
|
|
: of([]); |
|
|
|
|
|
|
|
typeaheadFormatter = (option: ABP.Option<any>) => option.key; |
|
|
|
@ -154,9 +154,8 @@ export class ExtensibleFormPropComponent implements OnChanges, AfterViewInit { |
|
|
|
} |
|
|
|
|
|
|
|
ngAfterViewInit() { |
|
|
|
if (this.first && this.fieldRef) { |
|
|
|
if (this.isFirstGroup && this.first && this.fieldRef) { |
|
|
|
this.fieldRef.nativeElement.focus(); |
|
|
|
this.cdRef.detectChanges(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|