@vaadin/vaadin-select 2.4.4 → 2.5.0
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 +2 -2
- package/src/vaadin-select.d.ts +9 -1
- package/src/vaadin-select.js +37 -3
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"repository": "vaadin/vaadin-select",
|
|
11
11
|
"homepage": "https://vaadin.com/components",
|
|
12
12
|
"name": "@vaadin/vaadin-select",
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.5.0",
|
|
14
14
|
"main": "vaadin-select.js",
|
|
15
15
|
"author": "Vaadin Ltd",
|
|
16
16
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@polymer/iron-resizable-behavior": "^3.0.0",
|
|
37
37
|
"@vaadin/vaadin-control-state-mixin": "^2.2.1",
|
|
38
38
|
"@vaadin/vaadin-themable-mixin": "^1.6.1",
|
|
39
|
-
"@vaadin/vaadin-text-field": "^2.
|
|
39
|
+
"@vaadin/vaadin-text-field": "^2.10.0",
|
|
40
40
|
"@vaadin/vaadin-list-box": "^1.4.0",
|
|
41
41
|
"@vaadin/vaadin-list-mixin": "^2.5.0",
|
|
42
42
|
"@vaadin/vaadin-item": "^2.3.0",
|
package/src/vaadin-select.d.ts
CHANGED
|
@@ -214,9 +214,17 @@ declare class SelectElement extends
|
|
|
214
214
|
notifyResize(): void;
|
|
215
215
|
_onKeyDown(e: KeyboardEvent): void;
|
|
216
216
|
_onKeyDownInside(e: KeyboardEvent): void;
|
|
217
|
+
_setInvalid(invalid: boolean): void;
|
|
217
218
|
|
|
218
219
|
/**
|
|
219
|
-
*
|
|
220
|
+
* Override this method to define whether the given `invalid` state should be set.
|
|
221
|
+
*/
|
|
222
|
+
_shouldSetInvalid(_invalid: boolean): boolean;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Validates the field and sets the `invalid` property based on the result.
|
|
226
|
+
*
|
|
227
|
+
* The method fires a `validated` event with the result of the validation.
|
|
220
228
|
*
|
|
221
229
|
* @returns True if the value is valid and sets the `invalid` flag appropriately
|
|
222
230
|
*/
|
package/src/vaadin-select.js
CHANGED
|
@@ -178,7 +178,7 @@ class SelectElement extends
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
static get version() {
|
|
181
|
-
return '2.
|
|
181
|
+
return '2.5.0';
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
static get properties() {
|
|
@@ -745,12 +745,38 @@ class SelectElement extends
|
|
|
745
745
|
}
|
|
746
746
|
|
|
747
747
|
/**
|
|
748
|
-
*
|
|
748
|
+
* @param {boolean} invalid
|
|
749
|
+
* @protected
|
|
750
|
+
*/
|
|
751
|
+
_setInvalid(invalid) {
|
|
752
|
+
if (this._shouldSetInvalid(invalid)) {
|
|
753
|
+
this.invalid = invalid;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Override this method to define whether the given `invalid` state should be set.
|
|
759
|
+
*
|
|
760
|
+
* @param {boolean} _invalid
|
|
761
|
+
* @return {boolean}
|
|
762
|
+
* @protected
|
|
763
|
+
*/
|
|
764
|
+
_shouldSetInvalid(_invalid) {
|
|
765
|
+
return true;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Validates the field and sets the `invalid` property based on the result.
|
|
770
|
+
*
|
|
771
|
+
* The method fires a `validated` event with the result of the validation.
|
|
749
772
|
*
|
|
750
773
|
* @return {boolean} True if the value is valid and sets the `invalid` flag appropriately
|
|
751
774
|
*/
|
|
752
775
|
validate() {
|
|
753
|
-
|
|
776
|
+
const isValid = !!(this.disabled || !this.required || this.value);
|
|
777
|
+
this._setInvalid(!isValid);
|
|
778
|
+
this.dispatchEvent(new CustomEvent('validated', {detail: {valid: isValid}}));
|
|
779
|
+
return isValid;
|
|
754
780
|
}
|
|
755
781
|
|
|
756
782
|
/**
|
|
@@ -758,6 +784,14 @@ class SelectElement extends
|
|
|
758
784
|
*
|
|
759
785
|
* @event change
|
|
760
786
|
*/
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Fired whenever the field is validated.
|
|
790
|
+
*
|
|
791
|
+
* @event validated
|
|
792
|
+
* @param {Object} detail
|
|
793
|
+
* @param {boolean} detail.valid the result of the validation.
|
|
794
|
+
*/
|
|
761
795
|
}
|
|
762
796
|
|
|
763
797
|
customElements.define(SelectElement.is, SelectElement);
|