@vaadin/field-base
Advanced tools
Comparing version 23.2.0-beta2 to 23.2.0-beta3
{ | ||
"name": "@vaadin/field-base", | ||
"version": "23.2.0-beta2", | ||
"version": "23.2.0-beta3", | ||
"publishConfig": { | ||
@@ -35,3 +35,3 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "23.2.0-beta2", | ||
"@vaadin/component-base": "23.2.0-beta3", | ||
"lit": "^2.0.0" | ||
@@ -44,3 +44,3 @@ }, | ||
}, | ||
"gitHead": "42864949ade7e573ac534a64ecdd97fab32a87fc" | ||
"gitHead": "3389e7d2dd4c94c6354817d4dc8c8d2db48c7137" | ||
} |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { addValueToAttribute, removeValueFromAttribute } from './utils.js'; | ||
import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js'; | ||
@@ -9,0 +9,0 @@ /** |
@@ -82,5 +82,6 @@ /** | ||
_constraintsChanged(...constraints) { | ||
// Prevent marking field as invalid when setting required state | ||
// or any other constraint before a user has entered the value. | ||
if (!this.invalid) { | ||
// Validate the field on constraint change only if it has a value. | ||
// The exception is the case when the field is invalid. In that case, | ||
// let the method reset `invalid` when the last constraint is removed. | ||
if (!this.invalid && !this._hasValue) { | ||
return; | ||
@@ -87,0 +88,0 @@ } |
@@ -32,2 +32,8 @@ /** | ||
/** | ||
* Indicates whether the value is different from the default one. | ||
* Override if the `value` property has a type other than `string`. | ||
*/ | ||
protected readonly _hasValue: boolean; | ||
/** | ||
* Clear the value of the field. | ||
@@ -51,5 +57,5 @@ */ | ||
protected _toggleHasValue(value: boolean): void; | ||
protected _toggleHasValue(hasValue: boolean): void; | ||
protected _valueChanged(value?: string, oldValue?: string): void; | ||
} |
@@ -193,2 +193,3 @@ /** | ||
* Toggle the has-value attribute based on the value property. | ||
* | ||
* @param {boolean} hasValue | ||
@@ -208,3 +209,3 @@ * @protected | ||
_valueChanged(newVal, oldVal) { | ||
this._toggleHasValue(newVal !== '' && newVal != null); | ||
this._toggleHasValue(this._hasValue); | ||
@@ -224,3 +225,13 @@ // Setting initial value to empty string, do nothing. | ||
} | ||
/** | ||
* Indicates whether the value is different from the default one. | ||
* Override if the `value` property has a type other than `string`. | ||
* | ||
* @protected | ||
*/ | ||
get _hasValue() { | ||
return this.value != null && this.value !== ''; | ||
} | ||
}, | ||
); |
117366
57
3256
+ Added@vaadin/component-base@23.2.0-beta3(transitive)
- Removed@vaadin/component-base@23.2.0-beta2(transitive)