@vaadin/combo-box
Advanced tools
Comparing version 23.0.0-alpha4 to 23.0.0-alpha5
{ | ||
"name": "@vaadin/combo-box", | ||
"version": "23.0.0-alpha4", | ||
"version": "23.0.0-alpha5", | ||
"publishConfig": { | ||
@@ -37,21 +37,21 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "23.0.0-alpha4", | ||
"@vaadin/field-base": "23.0.0-alpha4", | ||
"@vaadin/input-container": "23.0.0-alpha4", | ||
"@vaadin/item": "23.0.0-alpha4", | ||
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha4", | ||
"@vaadin/vaadin-material-styles": "23.0.0-alpha4", | ||
"@vaadin/vaadin-overlay": "23.0.0-alpha4", | ||
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha4" | ||
"@vaadin/component-base": "23.0.0-alpha5", | ||
"@vaadin/field-base": "23.0.0-alpha5", | ||
"@vaadin/input-container": "23.0.0-alpha5", | ||
"@vaadin/item": "23.0.0-alpha5", | ||
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha5", | ||
"@vaadin/vaadin-material-styles": "23.0.0-alpha5", | ||
"@vaadin/vaadin-overlay": "23.0.0-alpha5", | ||
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha5" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/dialog": "23.0.0-alpha4", | ||
"@vaadin/polymer-legacy-adapter": "23.0.0-alpha4", | ||
"@vaadin/dialog": "23.0.0-alpha5", | ||
"@vaadin/polymer-legacy-adapter": "23.0.0-alpha5", | ||
"@vaadin/testing-helpers": "^0.3.2", | ||
"@vaadin/text-field": "23.0.0-alpha4", | ||
"@vaadin/text-field": "23.0.0-alpha5", | ||
"lit": "^2.0.0", | ||
"sinon": "^9.2.0" | ||
}, | ||
"gitHead": "81e2deee5147bb7c1f4884760f4598613306f1fb" | ||
"gitHead": "74f9294964eb8552d96578c14af6ad214f5257bc" | ||
} |
@@ -316,2 +316,4 @@ /** | ||
this.$.dropdown._scroller.requestContentUpdate(); | ||
this._getItemElements().forEach((item) => { | ||
@@ -418,2 +420,7 @@ item.requestContentUpdate(); | ||
this._clear(); | ||
// De-select dropdown item | ||
if (this.opened) { | ||
this.requestContentUpdate(); | ||
} | ||
} | ||
@@ -700,13 +707,16 @@ | ||
const toLowerCase = (item) => item && item.toLowerCase && item.toLowerCase(); | ||
const itemsMatchedByLabel = | ||
(this.filteredItems && | ||
this.filteredItems.filter( | ||
(item) => toLowerCase(this._getItemLabel(item)) === toLowerCase(this._inputElementValue) | ||
)) || | ||
[]; | ||
// Try to find an item whose label matches the input value. A matching item is searched from | ||
// the filteredItems array (if available) and the selectedItem (if available). | ||
const itemMatchingByLabel = [...(this.filteredItems || []), this.selectedItem].find((item) => { | ||
return toLowerCase(this._getItemLabel(item)) === toLowerCase(this._inputElementValue); | ||
}); | ||
if ( | ||
this.allowCustomValue && | ||
// to prevent a repetitive input value being saved after pressing ESC and Tab. | ||
!itemsMatchedByLabel.length | ||
!itemMatchingByLabel | ||
) { | ||
// An item matching by label was not found, but custom values are allowed. | ||
// Dispatch a custom-value-set event with the input value. | ||
const e = new CustomEvent('custom-value-set', { | ||
@@ -724,5 +734,7 @@ detail: this._inputElementValue, | ||
} | ||
} else if (!this.allowCustomValue && !this.opened && itemsMatchedByLabel.length > 0) { | ||
this.value = this._getItemValue(itemsMatchedByLabel[0]); | ||
} else if (!this.allowCustomValue && !this.opened && itemMatchingByLabel) { | ||
// An item matching by label was found, select it. | ||
this.value = this._getItemValue(itemMatchingByLabel); | ||
} else { | ||
// Revert the input value | ||
this._inputElementValue = this.selectedItem ? this._getItemLabel(this.selectedItem) : this.value || ''; | ||
@@ -941,6 +953,10 @@ } | ||
this._focusedIndex = | ||
this.opened || this.autoOpenDisabled | ||
? this.$.dropdown.indexOfLabel(this.filter) | ||
: this._indexOfValue(this.value, this.filteredItems); | ||
const filterIndex = this.$.dropdown.indexOfLabel(this.filter); | ||
if (this.opened) { | ||
this._focusedIndex = filterIndex; | ||
} else { | ||
// Pre-select item matching the filter to focus it later when overlay opens | ||
const valueIndex = this._indexOfValue(this.value, this.filteredItems); | ||
this._focusedIndex = filterIndex === -1 ? valueIndex : filterIndex; | ||
} | ||
@@ -947,0 +963,0 @@ // see https://github.com/vaadin/web-components/issues/2615 |
@@ -139,4 +139,4 @@ /** | ||
__openedChanged(opened) { | ||
if (this.__virtualizer && opened) { | ||
this.__virtualizer.update(); | ||
if (opened) { | ||
this.requestContentUpdate(); | ||
} | ||
@@ -167,2 +167,8 @@ } | ||
requestContentUpdate() { | ||
if (this.__virtualizer) { | ||
this.__virtualizer.update(); | ||
} | ||
} | ||
scrollIntoView(index) { | ||
@@ -237,3 +243,3 @@ if (!(this.opened && index >= 0)) { | ||
this.setAttribute('aria-setsize', items.length); | ||
this.__virtualizer.update(); | ||
this.requestContentUpdate(); | ||
} | ||
@@ -245,3 +251,3 @@ } | ||
if (this.__virtualizer && !loading) { | ||
setTimeout(() => this.__virtualizer.update()); | ||
setTimeout(() => this.requestContentUpdate()); | ||
} | ||
@@ -253,3 +259,3 @@ } | ||
if (this.__virtualizer && index >= 0) { | ||
this.__virtualizer.update(); | ||
this.requestContentUpdate(); | ||
this.scrollIntoView(index); | ||
@@ -261,4 +267,4 @@ } | ||
__rendererChanged(renderer, oldRenderer) { | ||
if (this.__virtualizer && (renderer || oldRenderer)) { | ||
this.__virtualizer.update(); | ||
if (renderer || oldRenderer) { | ||
this.requestContentUpdate(); | ||
} | ||
@@ -265,0 +271,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132080
3347
25
0
+ Added@vaadin/component-base@23.0.0-alpha5(transitive)
+ Added@vaadin/field-base@23.0.0-alpha5(transitive)
+ Added@vaadin/icon@23.0.0-alpha5(transitive)
+ Added@vaadin/input-container@23.0.0-alpha5(transitive)
+ Added@vaadin/item@23.0.0-alpha5(transitive)
+ Added@vaadin/vaadin-lumo-styles@23.0.0-alpha5(transitive)
+ Added@vaadin/vaadin-material-styles@23.0.0-alpha5(transitive)
+ Added@vaadin/vaadin-overlay@23.0.0-alpha5(transitive)
+ Added@vaadin/vaadin-themable-mixin@23.0.0-alpha5(transitive)
- Removed@vaadin/component-base@23.0.0-alpha4(transitive)
- Removed@vaadin/field-base@23.0.0-alpha4(transitive)
- Removed@vaadin/icon@23.0.0-alpha4(transitive)
- Removed@vaadin/input-container@23.0.0-alpha4(transitive)
- Removed@vaadin/item@23.0.0-alpha4(transitive)
- Removed@vaadin/vaadin-lumo-styles@23.0.0-alpha4(transitive)
- Removed@vaadin/vaadin-material-styles@23.0.0-alpha4(transitive)
- Removed@vaadin/vaadin-overlay@23.0.0-alpha4(transitive)
- Removed@vaadin/vaadin-themable-mixin@23.0.0-alpha4(transitive)
Updated@vaadin/item@23.0.0-alpha5