Skip to content

Commit 63cbb48

Browse files
committed
Merge remote-tracking branch 'origin/master' into cosy-compact-refactoring
2 parents 112de5d + 964dbc2 commit 63cbb48

File tree

6 files changed

+66
-32
lines changed

6 files changed

+66
-32
lines changed

packages/main/src/ComboBox.hbs

+28-28
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,6 @@
44
aria-expanded="{{open}}"
55
>
66

7-
<input id="ui5-combobox-input"
8-
.value="{{_tempValue}}"
9-
inner-input
10-
placeholder="{{placeholder}}"
11-
?disabled={{disabled}}
12-
?readonly={{readonly}}
13-
?required={{required}}
14-
value-state="{{valueState}}"
15-
@input="{{_input}}"
16-
@change="{{_inputChange}}"
17-
@keydown="{{_keydown}}"
18-
@focusin="{{_focusin}}"
19-
@focusout="{{_focusout}}"
20-
aria-autocomplete="both"
21-
/>
22-
23-
{{#unless readonly}}
24-
<ui5-icon
25-
name="slim-arrow-down"
26-
slot="icon"
27-
tabindex="-1"
28-
input-icon
29-
?pressed="{{_iconPressed}}"
30-
@click="{{_arrowClick}}"
31-
dir="{{dir}}"
32-
></ui5-icon>
33-
{{/unless}}
34-
357
<ui5-popover
368
class="ui5-combobox-popover"
379
style={{styles.popover}}
@@ -40,6 +12,7 @@
4012
no-padding="true"
4113
placement-type="Bottom"
4214
initial-focus="ui5-combobox-input"
15+
tabindex="-1"
4316
@ui5-afterOpen={{_afterOpenPopover}}
4417
@ui5-afterClose={{_afterClosePopover}}
4518
>
@@ -68,4 +41,31 @@
6841
</ui5-list>
6942
</ui5-popover>
7043

44+
<input id="ui5-combobox-input"
45+
.value="{{_tempValue}}"
46+
inner-input
47+
placeholder="{{placeholder}}"
48+
?disabled={{disabled}}
49+
?readonly={{readonly}}
50+
?required={{required}}
51+
value-state="{{valueState}}"
52+
@input="{{_input}}"
53+
@change="{{_inputChange}}"
54+
@keydown="{{_keydown}}"
55+
@focusin="{{_focusin}}"
56+
@focusout="{{_focusout}}"
57+
aria-autocomplete="both"
58+
/>
59+
60+
{{#unless readonly}}
61+
<ui5-icon
62+
name="slim-arrow-down"
63+
slot="icon"
64+
tabindex="-1"
65+
input-icon
66+
?pressed="{{_iconPressed}}"
67+
@click="{{_arrowClick}}"
68+
dir="{{dir}}"
69+
></ui5-icon>
70+
{{/unless}}
7171
</div>

packages/main/src/ComboBox.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
22
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
33
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
4+
import "@ui5/webcomponents-icons/dist/icons/slim-arrow-down.js";
45
import { isBackSpace, isDelete, isShow } from "@ui5/webcomponents-base/dist/events/PseudoEvents.js";
56
import * as Filters from "./ComboBoxFilters.js";
67

@@ -11,6 +12,8 @@ import ComboBoxItem from "./ComboBoxItem.js";
1112
import Icon from "./Icon.js";
1213
import Popover from "./Popover.js";
1314
import List from "./List.js";
15+
import BusyIndicator from "./BusyIndicator.js";
16+
import StandardListItem from "./StandardListItem.js";
1417

1518
const metadata = {
1619
tag: "ui5-combobox",
@@ -253,19 +256,35 @@ class ComboBox extends UI5Element {
253256

254257
this._filteredItems = [];
255258
this._initialRendering = true;
259+
260+
this.addEventListener("focusout", () => {
261+
if (this.popover) {
262+
this.popover.close();
263+
}
264+
});
256265
}
257266

258267
onBeforeRendering() {
259268
const domValue = this._initialRendering ? this.value : this.filterValue;
260269

261270
this._filteredItems = this._filterItems(domValue);
262271

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+
263278
if (this._autocomplete && domValue !== "") {
264279
this._autoCompleteValue(domValue);
265280
} else {
266281
this._tempValue = domValue;
267282
}
268283

284+
if (this.popover && document.activeElement === this && !this._filteredItems.length) {
285+
this.popover.close();
286+
}
287+
269288
this._selectMatchingItem();
270289
this._initialRendering = false;
271290
}
@@ -358,7 +377,7 @@ class ComboBox extends UI5Element {
358377
this._tempValue = current;
359378
}
360379

361-
if (matchingItems.length) {
380+
if (matchingItems.length && (currentValue !== this._tempValue)) {
362381
setTimeout(() => {
363382
this.inner.setSelectionRange(currentValue.length, this._tempValue.length);
364383
}, 0);
@@ -428,6 +447,8 @@ class ComboBox extends UI5Element {
428447
Icon.define(),
429448
Popover.define(),
430449
List.define(),
450+
BusyIndicator.define(),
451+
StandardListItem.define(),
431452
]);
432453

433454
super.define(...params);

packages/main/src/Popover.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ class Popover extends UI5Element {
343343
removeOpenedPopover(this);
344344
}
345345

346-
this.resetFocus();
346+
if (!this._prevetFocusRestore) {
347+
this.resetFocus();
348+
}
347349

348350
this.hide();
349351
this.fireEvent("afterClose", {});

packages/main/src/themes/ListItem.css

+7
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@
101101

102102
.ui5-li-img {
103103
width: var(--_ui5_list_item_img_size);
104+
min-width: var(--_ui5_list_item_img_size);
104105
height: var(--_ui5_list_item_img_size);
106+
min-height: var(--_ui5_list_item_img_size);
105107
margin: var(--_ui5_list_item_img_margin);
106108
}
107109

@@ -127,6 +129,11 @@
127129
align-items: center;
128130
}
129131

132+
.ui5-li-multisel-cb,
133+
.ui5-li-singlesel-radiobtn {
134+
flex-shrink: 0;
135+
}
136+
130137
:host() ui5-checkbox.ui5-li-singlesel-radiobtn {
131138
margin-right: var(--_ui5_list_item_cb_margin_right);
132139
}

packages/main/src/themes/ListItemBase.css

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
pointer-events: none;
5757
}
5858

59+
:host([active][focused]) .ui5-li-root.ui5-li--focusable:after {
60+
border-color: var(--sapContent_ContrastFocusColor);
61+
}
62+
5963
.ui5-li-content {
6064
max-width: 100%;
6165
min-height: 1px; /* IE specific: fixes vertical centering with flex */

packages/main/test/pages/List.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h2>ui5-list</h2>
1717

1818
<ui5-list header-text="API: GroupHeaderListItem" mode="MultiSelect">
1919
<ui5-li-groupheader>New Items</ui5-li-groupheader>
20-
<ui5-li image="./img/HT-1000.jpg" icon="navigation-right-arrow" info="Available">Laptop HP</ui5-li>
20+
<ui5-li image="./img/HT-1000.jpg" icon="navigation-right-arrow" info="Available">Voluptate do eu cupidatat elit est culpa. Reprehenderit eiusmod voluptate ex est dolor nostrud Lorem Lorem do nisi laborum veniam. Sint do non culpa aute occaecat labore ipsum veniam minim tempor est. Duis pariatur aute culpa irure ad excepteur pariatur culpa culpa ea duis occaecat aute irure. Ipsum velit culpa non exercitation ex laboris deserunt in eu non officia in. Laborum sunt aliqua labore cupidatat sunt labore.</ui5-li>
2121
<ui5-li image="./img/HT-1010.jpg" icon="navigation-right-arrow" info="Re-stock" description="#12331232131" info-state="Error">Laptop Lenovo</ui5-li>
2222
<ui5-li image="./img/HT-1022.jpg" icon="navigation-right-arrow" info="Re-stock" description="#12331232131" info-state="Error">IPhone 3</ui5-li>
2323

@@ -86,7 +86,7 @@ <h2>ui5-list</h2>
8686
<br/><br/>
8787

8888
<ui5-list id="myList3" mode="SingleSelectBegin" header-text="API: mode='SingleSelectBegin'">
89-
<ui5-li id="country1" >Argentina</ui5-li>
89+
<ui5-li id="country1" >Dolor dolor ipsum culpa proident esse quis quis incididunt. Sunt duis eu ad deserunt dolor sunt Lorem incididunt est irure qui dolore minim consectetur. Voluptate minim veniam aliqua aute et consectetur magna commodo sit. Duis fugiat esse culpa ea velit sit excepteur duis deserunt aliquip minim laborum. Amet aliquip excepteur esse aute ut dolore labore.</ui5-li>
9090
<ui5-li id="country2" selected>Bulgaria</ui5-li>
9191
<ui5-li id="country3" >China</ui5-li>
9292
</ui5-list>

0 commit comments

Comments
 (0)