File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
packages/autocomplete/src Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 124
124
export let selectOnExactMatch = true ;
125
125
export let showMenuWithNoInput = true ;
126
126
export let noMatchesActionDisabled = true ;
127
+ export let resetTextWhenSelected = false ;
127
128
export let search: (input : string ) => Promise <any [] | false > = async (
128
129
input : string
129
130
) => {
164
165
let matches: any [] = [];
165
166
let focusedIndex = - 1 ;
166
167
let focusedItem: SMUIListItemAccessor | undefined = undefined ;
168
+ let resetText: boolean = false ;
167
169
168
170
$ : menuOpen =
169
171
focused &&
202
204
loading = false ;
203
205
})();
204
206
207
+ if (resetText ) {
208
+ text = ' ' ;
209
+ resetText = false ;
210
+ }
205
211
previousText = text ;
206
212
}
207
213
210
216
// If the value changes from outside, update the text.
211
217
text = getOptionLabel (value );
212
218
previousValue = value ;
219
+ if (resetTextWhenSelected ) {
220
+ resetText = true ; // We will set text = '' in the reactive block `$: if (previousText !== text)`
221
+ }
213
222
} else if (combobox ) {
214
223
// If the text changes, update value if we're a combobox.
215
224
value = text ;
You can’t perform that action at this time.
0 commit comments