@@ -19,18 +19,19 @@ const DEBOUNCE_TIME = 200;
1919 templateUrl : './cascader.component.html' ,
2020 styleUrls : [ './cascader.component.scss' ] ,
2121 providers : [
22- {
23- provide : NG_VALUE_ACCESSOR ,
24- useExisting : forwardRef ( ( ) => CascaderComponent ) ,
25- multi : true
26- } ,
27- CascaderService
22+ {
23+ provide : NG_VALUE_ACCESSOR ,
24+ useExisting : forwardRef ( ( ) => CascaderComponent ) ,
25+ multi : true
26+ } ,
27+ CascaderService
2828 ] ,
2929 preserveWhitespaces : false
30- } )
30+ } )
3131export class CascaderComponent implements OnInit , OnDestroy , OnChanges , ControlValueAccessor {
3232 @ViewChild ( 'mainDropdown' ) mainDropdown : DropDownDirective ;
3333 @ViewChild ( 'innerInput' ) innerInput : ElementRef ;
34+ @ViewChild ( 'outerInput' ) outerInput : ElementRef ;
3435 @ViewChild ( DropDownAppendToBodyComponent , { static : false } ) dropdownComp : DropDownAppendToBodyComponent ;
3536 @Input ( ) options : CascaderItem [ ] = [ ] ;
3637 @Input ( ) width = 200 ;
@@ -370,6 +371,10 @@ export class CascaderComponent implements OnInit, OnDestroy, OnChanges, ControlV
370371 }
371372 }
372373
374+ if ( isOpen && ! this . multiple && this . allowSearch ) {
375+ this . outerInput ?. nativeElement . focus ( ) ;
376+ }
377+
373378 if ( ! isOpen && this . allowSearch ) {
374379 if ( ! this . cascaderSrv . currentValue . length ) {
375380 this . showTextValue = null ;
0 commit comments