1
1
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js" ;
2
2
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js" ;
3
3
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js" ;
4
+ import "@ui5/webcomponents-icons/dist/icons/slim-arrow-down.js" ;
4
5
import { isBackSpace , isDelete , isShow } from "@ui5/webcomponents-base/dist/events/PseudoEvents.js" ;
5
6
import * as Filters from "./ComboBoxFilters.js" ;
6
7
@@ -11,6 +12,8 @@ import ComboBoxItem from "./ComboBoxItem.js";
11
12
import Icon from "./Icon.js" ;
12
13
import Popover from "./Popover.js" ;
13
14
import List from "./List.js" ;
15
+ import BusyIndicator from "./BusyIndicator.js" ;
16
+ import StandardListItem from "./StandardListItem.js" ;
14
17
15
18
const metadata = {
16
19
tag : "ui5-combobox" ,
@@ -253,19 +256,35 @@ class ComboBox extends UI5Element {
253
256
254
257
this . _filteredItems = [ ] ;
255
258
this . _initialRendering = true ;
259
+
260
+ this . addEventListener ( "focusout" , ( ) => {
261
+ if ( this . popover ) {
262
+ this . popover . close ( ) ;
263
+ }
264
+ } ) ;
256
265
}
257
266
258
267
onBeforeRendering ( ) {
259
268
const domValue = this . _initialRendering ? this . value : this . filterValue ;
260
269
261
270
this . _filteredItems = this . _filterItems ( domValue ) ;
262
271
272
+ // prevent popover focus restore
273
+ // TODO: fix that once popovers are fixed to static area
274
+ if ( this . popover ) {
275
+ this . popover . _prevetFocusRestore = true ;
276
+ }
277
+
263
278
if ( this . _autocomplete && domValue !== "" ) {
264
279
this . _autoCompleteValue ( domValue ) ;
265
280
} else {
266
281
this . _tempValue = domValue ;
267
282
}
268
283
284
+ if ( this . popover && document . activeElement === this && ! this . _filteredItems . length ) {
285
+ this . popover . close ( ) ;
286
+ }
287
+
269
288
this . _selectMatchingItem ( ) ;
270
289
this . _initialRendering = false ;
271
290
}
@@ -358,7 +377,7 @@ class ComboBox extends UI5Element {
358
377
this . _tempValue = current ;
359
378
}
360
379
361
- if ( matchingItems . length ) {
380
+ if ( matchingItems . length && ( currentValue !== this . _tempValue ) ) {
362
381
setTimeout ( ( ) => {
363
382
this . inner . setSelectionRange ( currentValue . length , this . _tempValue . length ) ;
364
383
} , 0 ) ;
@@ -428,6 +447,8 @@ class ComboBox extends UI5Element {
428
447
Icon . define ( ) ,
429
448
Popover . define ( ) ,
430
449
List . define ( ) ,
450
+ BusyIndicator . define ( ) ,
451
+ StandardListItem . define ( ) ,
431
452
] ) ;
432
453
433
454
super . define ( ...params ) ;
0 commit comments