@vaadin/combo-box 22.0.3 → 22.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/combo-box",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
35
35
|
"@polymer/iron-resizable-behavior": "^3.0.0",
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "^22.0.
|
|
38
|
-
"@vaadin/field-base": "^22.0.
|
|
39
|
-
"@vaadin/input-container": "^22.0.
|
|
40
|
-
"@vaadin/item": "^22.0.
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "^22.0.
|
|
42
|
-
"@vaadin/vaadin-material-styles": "^22.0.
|
|
43
|
-
"@vaadin/vaadin-overlay": "^22.0.
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "^22.0.
|
|
37
|
+
"@vaadin/component-base": "^22.0.4",
|
|
38
|
+
"@vaadin/field-base": "^22.0.4",
|
|
39
|
+
"@vaadin/input-container": "^22.0.4",
|
|
40
|
+
"@vaadin/item": "^22.0.4",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.4",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "^22.0.4",
|
|
43
|
+
"@vaadin/vaadin-overlay": "^22.0.4",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
|
-
"@vaadin/dialog": "^22.0.
|
|
49
|
-
"@vaadin/polymer-legacy-adapter": "^22.0.
|
|
48
|
+
"@vaadin/dialog": "^22.0.4",
|
|
49
|
+
"@vaadin/polymer-legacy-adapter": "^22.0.4",
|
|
50
50
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
51
|
-
"@vaadin/text-field": "^22.0.
|
|
51
|
+
"@vaadin/text-field": "^22.0.4",
|
|
52
52
|
"lit": "^2.0.0",
|
|
53
53
|
"sinon": "^9.2.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "55891f68d4da41e846e06dfe51dceba1665e41ce"
|
|
56
56
|
}
|
|
@@ -305,6 +305,8 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
this.$.dropdown._scroller.requestContentUpdate();
|
|
309
|
+
|
|
308
310
|
this._getItemElements().forEach((item) => {
|
|
309
311
|
item.requestContentUpdate();
|
|
310
312
|
});
|
|
@@ -404,6 +406,11 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
404
406
|
_handleClearButtonClick(event) {
|
|
405
407
|
event.preventDefault();
|
|
406
408
|
this._clear();
|
|
409
|
+
|
|
410
|
+
// De-select dropdown item
|
|
411
|
+
if (this.opened) {
|
|
412
|
+
this.requestContentUpdate();
|
|
413
|
+
}
|
|
407
414
|
}
|
|
408
415
|
|
|
409
416
|
/** @private */
|
|
@@ -687,17 +694,20 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
687
694
|
}
|
|
688
695
|
} else {
|
|
689
696
|
const toLowerCase = (item) => item && item.toLowerCase && item.toLowerCase();
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
697
|
+
|
|
698
|
+
// Try to find an item whose label matches the input value. A matching item is searched from
|
|
699
|
+
// the filteredItems array (if available) and the selectedItem (if available).
|
|
700
|
+
const itemMatchingByLabel = [...(this.filteredItems || []), this.selectedItem].find((item) => {
|
|
701
|
+
return toLowerCase(this._getItemLabel(item)) === toLowerCase(this._inputElementValue);
|
|
702
|
+
});
|
|
703
|
+
|
|
696
704
|
if (
|
|
697
705
|
this.allowCustomValue &&
|
|
698
706
|
// to prevent a repetitive input value being saved after pressing ESC and Tab.
|
|
699
|
-
!
|
|
707
|
+
!itemMatchingByLabel
|
|
700
708
|
) {
|
|
709
|
+
// An item matching by label was not found, but custom values are allowed.
|
|
710
|
+
// Dispatch a custom-value-set event with the input value.
|
|
701
711
|
const e = new CustomEvent('custom-value-set', {
|
|
702
712
|
detail: this._inputElementValue,
|
|
703
713
|
composed: true,
|
|
@@ -710,9 +720,11 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
710
720
|
this._selectItemForValue(customValue);
|
|
711
721
|
this.value = customValue;
|
|
712
722
|
}
|
|
713
|
-
} else if (!this.allowCustomValue && !this.opened &&
|
|
714
|
-
|
|
723
|
+
} else if (!this.allowCustomValue && !this.opened && itemMatchingByLabel) {
|
|
724
|
+
// An item matching by label was found, select it.
|
|
725
|
+
this.value = this._getItemValue(itemMatchingByLabel);
|
|
715
726
|
} else {
|
|
727
|
+
// Revert the input value
|
|
716
728
|
this._inputElementValue = this.selectedItem ? this._getItemLabel(this.selectedItem) : this.value || '';
|
|
717
729
|
}
|
|
718
730
|
}
|
|
@@ -136,8 +136,8 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
__openedChanged(opened) {
|
|
139
|
-
if (
|
|
140
|
-
this.
|
|
139
|
+
if (opened) {
|
|
140
|
+
this.requestContentUpdate();
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -163,6 +163,12 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
requestContentUpdate() {
|
|
167
|
+
if (this.__virtualizer) {
|
|
168
|
+
this.__virtualizer.update();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
166
172
|
scrollIntoView(index) {
|
|
167
173
|
if (!(this.opened && index >= 0)) {
|
|
168
174
|
return;
|
|
@@ -233,29 +239,29 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
233
239
|
this.__virtualizer.flush();
|
|
234
240
|
// Ensure the total count of items is properly announced.
|
|
235
241
|
this.setAttribute('aria-setsize', items.length);
|
|
236
|
-
this.
|
|
242
|
+
this.requestContentUpdate();
|
|
237
243
|
}
|
|
238
244
|
}
|
|
239
245
|
|
|
240
246
|
/** @private */
|
|
241
247
|
__loadingChanged(loading) {
|
|
242
248
|
if (this.__virtualizer && !loading) {
|
|
243
|
-
setTimeout(() => this.
|
|
249
|
+
setTimeout(() => this.requestContentUpdate());
|
|
244
250
|
}
|
|
245
251
|
}
|
|
246
252
|
|
|
247
253
|
/** @private */
|
|
248
254
|
__focusedIndexChanged(index) {
|
|
249
255
|
if (this.__virtualizer && index >= 0) {
|
|
250
|
-
this.
|
|
256
|
+
this.requestContentUpdate();
|
|
251
257
|
this.scrollIntoView(index);
|
|
252
258
|
}
|
|
253
259
|
}
|
|
254
260
|
|
|
255
261
|
/** @private */
|
|
256
262
|
__rendererChanged(renderer, oldRenderer) {
|
|
257
|
-
if (
|
|
258
|
-
this.
|
|
263
|
+
if (renderer || oldRenderer) {
|
|
264
|
+
this.requestContentUpdate();
|
|
259
265
|
}
|
|
260
266
|
}
|
|
261
267
|
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -183,8 +183,8 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
183
183
|
>
|
|
184
184
|
<slot name="prefix" slot="prefix"></slot>
|
|
185
185
|
<slot name="input"></slot>
|
|
186
|
-
<div id="clearButton" part="clear-button" slot="suffix"></div>
|
|
187
|
-
<div id="toggleButton" part="toggle-button" slot="suffix"></div>
|
|
186
|
+
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
187
|
+
<div id="toggleButton" part="toggle-button" slot="suffix" aria-hidden="true"></div>
|
|
188
188
|
</vaadin-input-container>
|
|
189
189
|
|
|
190
190
|
<div part="helper-text">
|