@vaadin/vaadin-combo-box 5.4.12 → 5.5.1
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.
|
|
13
|
+
"version": "5.5.1",
|
|
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
|
}
|
|
@@ -122,6 +122,11 @@ interface ComboBoxMixin {
|
|
|
122
122
|
*/
|
|
123
123
|
selectedItem: ComboBoxItem|string|null|undefined;
|
|
124
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Whether the input element has a non-empty value.
|
|
127
|
+
*/
|
|
128
|
+
_hasInputValue: boolean|null|undefined;
|
|
129
|
+
|
|
125
130
|
/**
|
|
126
131
|
* Path for label of the item. If `items` is an array of objects, the
|
|
127
132
|
* `itemLabelPath` is used to fetch the displayed string label for each
|
|
@@ -201,10 +206,19 @@ interface ComboBoxMixin {
|
|
|
201
206
|
* Filtering and items handling
|
|
202
207
|
*/
|
|
203
208
|
_inputValueChanged(e: Event): void;
|
|
209
|
+
_inputElementValueChanged(inputElementValue: any): void;
|
|
204
210
|
_revertInputValue(): void;
|
|
211
|
+
_setInvalid(invalid: boolean): void;
|
|
205
212
|
|
|
206
213
|
/**
|
|
207
|
-
*
|
|
214
|
+
* Override this method to define whether the given `invalid` state should be set.
|
|
215
|
+
*/
|
|
216
|
+
_shouldSetInvalid(_invalid: boolean): boolean;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Validates the field and sets the `invalid` property based on the result.
|
|
220
|
+
*
|
|
221
|
+
* The method fires a `validated` event with the result of the validation.
|
|
208
222
|
*
|
|
209
223
|
* @returns True if the value is valid and sets the `invalid` flag appropriately
|
|
210
224
|
*/
|
|
@@ -166,6 +166,16 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
|
|
|
166
166
|
notify: true
|
|
167
167
|
},
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Whether the input element has a non-empty value.
|
|
171
|
+
* @protected
|
|
172
|
+
*/
|
|
173
|
+
_hasInputValue: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
value: false,
|
|
176
|
+
observer: '_hasInputValueChanged',
|
|
177
|
+
},
|
|
178
|
+
|
|
169
179
|
/**
|
|
170
180
|
* Path for label of the item. If `items` is an array of objects, the
|
|
171
181
|
* `itemLabelPath` is used to fetch the displayed string label for each
|
|
@@ -261,7 +271,8 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
|
|
|
261
271
|
'_templateOrRendererChanged(_itemTemplate, renderer)',
|
|
262
272
|
'_loadingChanged(loading)',
|
|
263
273
|
'_selectedItemChanged(selectedItem, itemValuePath, itemLabelPath)',
|
|
264
|
-
'_toggleElementChanged(_toggleElement)'
|
|
274
|
+
'_toggleElementChanged(_toggleElement)',
|
|
275
|
+
'_inputElementValueChanged(_inputElementValue)'
|
|
265
276
|
];
|
|
266
277
|
}
|
|
267
278
|
|
|
@@ -632,6 +643,7 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
|
|
|
632
643
|
this.selectedItem = null;
|
|
633
644
|
|
|
634
645
|
if (this.allowCustomValue) {
|
|
646
|
+
this._inputElementValue = '';
|
|
635
647
|
this.value = '';
|
|
636
648
|
}
|
|
637
649
|
|
|
@@ -758,11 +770,17 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
|
|
|
758
770
|
_inputValueChanged(e) {
|
|
759
771
|
// Handle only input events from our inputElement.
|
|
760
772
|
if (e.composedPath().indexOf(this.inputElement) !== -1) {
|
|
761
|
-
|
|
773
|
+
if (!e.__fromClearButton) {
|
|
774
|
+
this._inputElementValue = this.inputElement[this._propertyForValue];
|
|
775
|
+
}
|
|
762
776
|
this._filterFromInput(e);
|
|
763
777
|
}
|
|
764
778
|
}
|
|
765
779
|
|
|
780
|
+
_inputElementValueChanged(inputElementValue) {
|
|
781
|
+
this._hasInputValue = inputElementValue != null ? inputElementValue.length > 0 : false;
|
|
782
|
+
}
|
|
783
|
+
|
|
766
784
|
/** @private */
|
|
767
785
|
_filterFromInput(e) {
|
|
768
786
|
if (!this.opened && !e.__fromClearButton && !this.autoOpenDisabled) {
|
|
@@ -1090,12 +1108,49 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
|
|
|
1090
1108
|
}
|
|
1091
1109
|
|
|
1092
1110
|
/**
|
|
1093
|
-
*
|
|
1111
|
+
* Observer to notify about the change of private property.
|
|
1112
|
+
*
|
|
1113
|
+
* @private
|
|
1114
|
+
*/
|
|
1115
|
+
_hasInputValueChanged(hasValue, oldHasValue) {
|
|
1116
|
+
if (hasValue || oldHasValue) {
|
|
1117
|
+
this.dispatchEvent(new CustomEvent('has-input-value-changed'));
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* @param {boolean} invalid
|
|
1123
|
+
* @protected
|
|
1124
|
+
*/
|
|
1125
|
+
_setInvalid(invalid) {
|
|
1126
|
+
if (this._shouldSetInvalid(invalid)) {
|
|
1127
|
+
this.invalid = invalid;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Override this method to define whether the given `invalid` state should be set.
|
|
1133
|
+
*
|
|
1134
|
+
* @param {boolean} _invalid
|
|
1135
|
+
* @return {boolean}
|
|
1136
|
+
* @protected
|
|
1137
|
+
*/
|
|
1138
|
+
_shouldSetInvalid(_invalid) {
|
|
1139
|
+
return true;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Validates the field and sets the `invalid` property based on the result.
|
|
1144
|
+
*
|
|
1145
|
+
* The method fires a `validated` event with the result of the validation.
|
|
1094
1146
|
*
|
|
1095
1147
|
* @return {boolean} True if the value is valid and sets the `invalid` flag appropriately
|
|
1096
1148
|
*/
|
|
1097
1149
|
validate() {
|
|
1098
|
-
|
|
1150
|
+
const isValid = this.checkValidity();
|
|
1151
|
+
this._setInvalid(!isValid);
|
|
1152
|
+
this.dispatchEvent(new CustomEvent('validated', {detail: {valid: isValid}}));
|
|
1153
|
+
return isValid;
|
|
1099
1154
|
}
|
|
1100
1155
|
|
|
1101
1156
|
/**
|
|
@@ -1206,4 +1261,12 @@ export const ComboBoxMixin = subclass => class VaadinComboBoxMixinElement extend
|
|
|
1206
1261
|
* To comply with https://developer.mozilla.org/en-US/docs/Web/Events/change
|
|
1207
1262
|
* @event change
|
|
1208
1263
|
*/
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Fired whenever the field is validated.
|
|
1267
|
+
*
|
|
1268
|
+
* @event validated
|
|
1269
|
+
* @param {Object} detail
|
|
1270
|
+
* @param {boolean} detail.valid the result of the validation.
|
|
1271
|
+
*/
|
|
1209
1272
|
};
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -203,7 +203,7 @@ class ComboBoxElement extends
|
|
|
203
203
|
}
|
|
204
204
|
</style>
|
|
205
205
|
|
|
206
|
-
<vaadin-text-field part="text-field" id="input" pattern="[[pattern]]" prevent-invalid-input="[[preventInvalidInput]]" value="
|
|
206
|
+
<vaadin-text-field part="text-field" id="input" pattern="[[pattern]]" prevent-invalid-input="[[preventInvalidInput]]" value="[[_inputElementValue]]" autocomplete="off" invalid="[[invalid]]" label="[[label]]" name="[[name]]" placeholder="[[placeholder]]" required="[[required]]" disabled="[[disabled]]" readonly="[[readonly]]" helper-text="[[helperText]]" error-message="[[errorMessage]]" autocapitalize="none" autofocus="[[autofocus]]" on-change="_stopPropagation" on-input="_inputValueChanged" clear-button-visible="[[clearButtonVisible]]" theme\$="[[theme]]">
|
|
207
207
|
<slot name="prefix" slot="prefix"></slot>
|
|
208
208
|
<slot name="helper" slot="helper">[[helperText]]</slot>
|
|
209
209
|
|
|
@@ -229,7 +229,7 @@ class ComboBoxElement extends
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
static get version() {
|
|
232
|
-
return '5.
|
|
232
|
+
return '5.5.1';
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
static get properties() {
|