File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -251,10 +251,18 @@ function onOptionSelected(selectedOption: NeComboboxOption) {
251
251
}
252
252
253
253
function selectSingleOptionFromModelValue() {
254
- const optionFound = props . options .find ((option ) => option .id === props .modelValue )
254
+ const optionFound = allOptions . value .find ((option ) => option .id === props .modelValue )
255
255
256
256
if (optionFound ) {
257
257
selected .value = optionFound
258
+ } else if (props .acceptUserInput && props .modelValue ) {
259
+ const userInputOption = {
260
+ id: props .modelValue as string ,
261
+ label: props .modelValue as string ,
262
+ description: props .userInputLabel
263
+ }
264
+ userInputOptions .value .push (userInputOption )
265
+ selected .value = userInputOption
258
266
}
259
267
}
260
268
@@ -267,6 +275,9 @@ function selectMultipleOptionsFromModelValue() {
267
275
if (optionFound ) {
268
276
selectedList .push (optionFound )
269
277
} else if (props .acceptUserInput ) {
278
+ if (! selectedOption .description ) {
279
+ selectedOption .description = props .userInputLabel
280
+ }
270
281
userInputOptions .value .push (selectedOption )
271
282
selectedList .push (selectedOption )
272
283
}
You can’t perform that action at this time.
0 commit comments