@vaadin/field-base
Advanced tools
Comparing version 23.2.0-alpha6 to 23.2.0-beta1
{ | ||
"name": "@vaadin/field-base", | ||
"version": "23.2.0-alpha6", | ||
"version": "23.2.0-beta1", | ||
"publishConfig": { | ||
@@ -35,3 +35,3 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "23.2.0-alpha6", | ||
"@vaadin/component-base": "23.2.0-beta1", | ||
"lit": "^2.0.0" | ||
@@ -44,3 +44,3 @@ }, | ||
}, | ||
"gitHead": "61f1fb56953434e97d34a8819640064301dd3d8a" | ||
"gitHead": "82ff7254f27a1a089367e4dd005f63879e33c188" | ||
} |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
@@ -71,4 +71,4 @@ /** | ||
this._boundOnInput = this._onInput.bind(this); | ||
this._boundOnChange = this.__onChange.bind(this); | ||
this._boundOnInput = this.__onInput.bind(this); | ||
this._boundOnChange = this._onChange.bind(this); | ||
} | ||
@@ -152,2 +152,18 @@ | ||
/** | ||
* An input event listener used to update `_hasInputValue` property. | ||
* Do not override this method. | ||
* | ||
* @param {Event} event | ||
* @private | ||
*/ | ||
__onInput(event) { | ||
// In the case a custom web component is passed as `inputElement`, | ||
// the actual native input element, on which the event occurred, | ||
// can be inside shadow trees. | ||
const target = event.composedPath()[0]; | ||
this._hasInputValue = target.value.length > 0; | ||
this._onInput(event); | ||
} | ||
/** | ||
* An input event listener used to update the field value. | ||
@@ -159,5 +175,9 @@ * | ||
_onInput(event) { | ||
// In the case a custom web component is passed as `inputElement`, | ||
// the actual native input element, on which the event occurred, | ||
// can be inside shadow trees. | ||
const target = event.composedPath()[0]; | ||
// Ignore fake input events e.g. used by clear button. | ||
this.__userInput = event.isTrusted; | ||
this.value = event.target.value; | ||
this.value = target.value; | ||
this.__userInput = false; | ||
@@ -175,14 +195,2 @@ } | ||
/** | ||
* A change event listener used to update `_hasInputValue` property. | ||
* Do not override this method. | ||
* | ||
* @param {Event} event | ||
* @private | ||
*/ | ||
__onChange(event) { | ||
this._hasInputValue = event.target.value.length > 0; | ||
this._onChange(event); | ||
} | ||
/** | ||
* Toggle the has-value attribute based on the value property. | ||
@@ -189,0 +197,0 @@ * @param {boolean} hasValue |
118753
3305
+ Added@vaadin/component-base@23.2.0-beta1(transitive)
- Removed@vaadin/component-base@23.2.0-alpha6(transitive)