@vaadin/vaadin-combo-box 5.5.2 → 5.5.3

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.5.2",
13
+ "version": "5.5.3",
14
14
  "main": "vaadin-combo-box.js",
15
15
  "author": "Vaadin Ltd",
16
16
  "license": "Apache-2.0",
@@ -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();
@@ -930,6 +930,7 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
930
930
  /** @private */
931
931
  _detectAndDispatchChange() {
932
932
  if (this.value !== this._lastCommittedValue) {
933
+ this.validate();
933
934
  this.dispatchEvent(new CustomEvent('change', {bubbles: true}));
934
935
  this._lastCommittedValue = this.value;
935
936
  }
@@ -1094,6 +1095,7 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
1094
1095
  }
1095
1096
  if (!this.readonly && !this._closeOnBlurIsPrevented) {
1096
1097
  this._closeOrCommit();
1098
+ this.validate();
1097
1099
  }
1098
1100
  }
1099
1101
 
@@ -1160,8 +1162,8 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
1160
1162
  * @return {boolean | undefined}
1161
1163
  */
1162
1164
  checkValidity() {
1163
- if (this.inputElement.validate) {
1164
- return this.inputElement.validate();
1165
+ if (this.inputElement.checkValidity) {
1166
+ return this.inputElement.checkValidity();
1165
1167
  }
1166
1168
  }
1167
1169
 
@@ -229,7 +229,7 @@ class ComboBoxElement extends
229
229
  }
230
230
 
231
231
  static get version() {
232
- return '5.5.2';
232
+ return '5.5.3';
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"]');