@vaadin/vaadin-select
Advanced tools
Comparing version 2.4.4 to 2.5.0
@@ -13,3 +13,3 @@ { | ||
"name": "@vaadin/vaadin-select", | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"main": "vaadin-select.js", | ||
@@ -40,3 +40,3 @@ "author": "Vaadin Ltd", | ||
"@vaadin/vaadin-themable-mixin": "^1.6.1", | ||
"@vaadin/vaadin-text-field": "^2.8.0", | ||
"@vaadin/vaadin-text-field": "^2.10.0", | ||
"@vaadin/vaadin-list-box": "^1.4.0", | ||
@@ -43,0 +43,0 @@ "@vaadin/vaadin-list-mixin": "^2.5.0", |
@@ -217,6 +217,14 @@ /** | ||
_onKeyDownInside(e: KeyboardEvent): void; | ||
_setInvalid(invalid: boolean): void; | ||
/** | ||
* Returns true if `value` is valid, and sets the `invalid` flag appropriately. | ||
* Override this method to define whether the given `invalid` state should be set. | ||
*/ | ||
_shouldSetInvalid(_invalid: boolean): boolean; | ||
/** | ||
* Validates the field and sets the `invalid` property based on the result. | ||
* | ||
* The method fires a `validated` event with the result of the validation. | ||
* | ||
* @returns True if the value is valid and sets the `invalid` flag appropriately | ||
@@ -223,0 +231,0 @@ */ |
@@ -181,3 +181,3 @@ /** | ||
static get version() { | ||
return '2.4.4'; | ||
return '2.5.0'; | ||
} | ||
@@ -749,8 +749,34 @@ | ||
/** | ||
* Returns true if `value` is valid, and sets the `invalid` flag appropriately. | ||
* @param {boolean} invalid | ||
* @protected | ||
*/ | ||
_setInvalid(invalid) { | ||
if (this._shouldSetInvalid(invalid)) { | ||
this.invalid = invalid; | ||
} | ||
} | ||
/** | ||
* Override this method to define whether the given `invalid` state should be set. | ||
* | ||
* @param {boolean} _invalid | ||
* @return {boolean} | ||
* @protected | ||
*/ | ||
_shouldSetInvalid(_invalid) { | ||
return true; | ||
} | ||
/** | ||
* Validates the field and sets the `invalid` property based on the result. | ||
* | ||
* The method fires a `validated` event with the result of the validation. | ||
* | ||
* @return {boolean} True if the value is valid and sets the `invalid` flag appropriately | ||
*/ | ||
validate() { | ||
return !(this.invalid = !(this.disabled || !this.required || this.value)); | ||
const isValid = !!(this.disabled || !this.required || this.value); | ||
this._setInvalid(!isValid); | ||
this.dispatchEvent(new CustomEvent('validated', {detail: {valid: isValid}})); | ||
return isValid; | ||
} | ||
@@ -763,2 +789,10 @@ | ||
*/ | ||
/** | ||
* Fired whenever the field is validated. | ||
* | ||
* @event validated | ||
* @param {Object} detail | ||
* @param {boolean} detail.valid the result of the validation. | ||
*/ | ||
} | ||
@@ -765,0 +799,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
60975
1210