@vaadin/vaadin-combo-box 5.4.12 → 5.4.13

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 CHANGED
@@ -10,7 +10,7 @@
10
10
  "repository": "vaadin/vaadin-combo-box",
11
11
  "homepage": "https://vaadin.com/components",
12
12
  "name": "@vaadin/vaadin-combo-box",
13
- "version": "5.4.12",
13
+ "version": "5.4.13",
14
14
  "main": "vaadin-combo-box.js",
15
15
  "author": "Vaadin Ltd",
16
16
  "license": "Apache-2.0",
@@ -45,10 +45,6 @@
45
45
  "@vaadin/vaadin-item": "^2.3.0",
46
46
  "@vaadin/vaadin-element-mixin": "^2.4.1"
47
47
  },
48
- "scripts": {
49
- "generate-typings": "gen-typescript-declarations --outDir . --verify",
50
- "test": "wct --npm"
51
- },
52
48
  "devDependencies": {
53
49
  "@web-padawan/gen-typescript-declarations": "^1.6.2",
54
50
  "web-component-tester": "6.9.2",
@@ -60,5 +56,9 @@
60
56
  "wct-browser-legacy": "^1.0.1",
61
57
  "@vaadin/vaadin-demo-helpers": "^3.1.0",
62
58
  "@vaadin/vaadin-dialog": "^2.5.0"
59
+ },
60
+ "scripts": {
61
+ "generate-typings": "gen-typescript-declarations --outDir . --verify",
62
+ "test": "wct --npm"
63
63
  }
64
64
  }
@@ -85,6 +85,11 @@ declare class ComboBoxLightElement extends
85
85
  ready(): void;
86
86
  connectedCallback(): void;
87
87
  disconnectedCallback(): void;
88
+
89
+ /**
90
+ * Returns true if the current input value satisfies all constraints (if any).
91
+ */
92
+ checkValidity(): boolean;
88
93
  }
89
94
 
90
95
  declare global {
@@ -132,6 +132,17 @@ class ComboBoxLightElement extends
132
132
  return this.getRootNode().activeElement === this.inputElement;
133
133
  }
134
134
 
135
+ /**
136
+ * Returns true if the current input value satisfies all constraints (if any).
137
+ * @return {boolean}
138
+ */
139
+ checkValidity() {
140
+ if (this.inputElement && this.inputElement.validate) {
141
+ return this.inputElement.validate();
142
+ }
143
+ return super.checkValidity();
144
+ }
145
+
135
146
  /** @protected */
136
147
  connectedCallback() {
137
148
  super.connectedCallback();
@@ -912,6 +912,7 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
912
912
  /** @private */
913
913
  _detectAndDispatchChange() {
914
914
  if (this.value !== this._lastCommittedValue) {
915
+ this.validate();
915
916
  this.dispatchEvent(new CustomEvent('change', {bubbles: true}));
916
917
  this._lastCommittedValue = this.value;
917
918
  }
@@ -1076,6 +1077,7 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
1076
1077
  }
1077
1078
  if (!this.readonly && !this._closeOnBlurIsPrevented) {
1078
1079
  this._closeOrCommit();
1080
+ this.validate();
1079
1081
  }
1080
1082
  }
1081
1083
 
@@ -1105,8 +1107,8 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
1105
1107
  * @return {boolean | undefined}
1106
1108
  */
1107
1109
  checkValidity() {
1108
- if (this.inputElement.validate) {
1109
- return this.inputElement.validate();
1110
+ if (this.inputElement.checkValidity) {
1111
+ return this.inputElement.checkValidity();
1110
1112
  }
1111
1113
  }
1112
1114
 
@@ -229,7 +229,7 @@ class ComboBoxElement extends
229
229
  }
230
230
 
231
231
  static get version() {
232
- return '5.4.12';
232
+ return '5.4.13';
233
233
  }
234
234
 
235
235
  static get properties() {
@@ -351,6 +351,13 @@ class ComboBoxElement extends
351
351
  ready() {
352
352
  super.ready();
353
353
 
354
+ // Disable the internal text-field's validation to prevent it from overriding
355
+ // the invalid state that was propagated to the text-field from the combo-box.
356
+ this.inputElement.validate = () => {};
357
+ // Restore the internal text-field's invalid state in case
358
+ // it got overridden before the validation was disabled above.
359
+ this.inputElement.invalid = this.invalid;
360
+
354
361
  this._nativeInput = this.inputElement.focusElement;
355
362
  this._toggleElement = this.$.toggleButton;
356
363
  this._clearElement = this.inputElement.shadowRoot.querySelector('[part="clear-button"]');