@@ -78,6 +78,7 @@ import {
78
78
} from './utils' ;
79
79
80
80
export const DEFAULT_SUGGEST_DEBOUNCE_TIME = 300 ;
81
+ export const DEFAULT_SUGGEST_DRILLDOWN_CHARACTER = ':' ;
81
82
82
83
/**
83
84
* A form compatible `dropdown` packing `lazy-loading` and `virtual-scroll`.
@@ -111,7 +112,7 @@ export class UiSuggestComponent extends UiSuggestMatFormFieldDirective
111
112
AfterViewInit {
112
113
113
114
get inDrillDownMode ( ) {
114
- return ! ! this . drillDown && this . inputControl . value . includes ( ':' ) ;
115
+ return ! ! this . drillDown && this . inputControl . value . includes ( this . drillDownCharacter ) ;
115
116
}
116
117
117
118
/**
@@ -151,6 +152,12 @@ export class UiSuggestComponent extends UiSuggestMatFormFieldDirective
151
152
this . _drillDown = ! ! value ;
152
153
}
153
154
155
+ /**
156
+ * Divider character for drilldown logic
157
+ */
158
+ @Input ( )
159
+ drillDownCharacter = DEFAULT_SUGGEST_DRILLDOWN_CHARACTER ;
160
+
154
161
/**
155
162
* Configure if the component is `readonly`.
156
163
*
@@ -929,9 +936,18 @@ export class UiSuggestComponent extends UiSuggestMatFormFieldDirective
929
936
* @param [closeAfterSelect=true] If the dropdown should close after the value is selected.
930
937
* @param [refocus=true] If the search input should regain focus after selection.
931
938
*/
939
+ // eslint-disable-next-line complexity
932
940
updateValue ( inputValue : ISuggestValue | string , closeAfterSelect = true , refocus = true ) {
933
- const value = toSuggestValue ( inputValue , this . _isOnCustomValueIndex ) ;
941
+ let value = toSuggestValue ( inputValue , this . _isOnCustomValueIndex ) ;
934
942
if ( value . loading !== VirtualScrollItemStatus . loaded ) { return ; }
943
+
944
+ if ( this . inDrillDownMode ) {
945
+ value = {
946
+ ...value ,
947
+ text : `${ this . inputControl . value } ${ value . text } ` ,
948
+ } ;
949
+ }
950
+
935
951
const isExpandable = this . searchable && this . drillDown && ! ! value . expandable ;
936
952
937
953
if ( isExpandable ) {
0 commit comments