@vaadin/multi-select-combo-box 24.4.0-alpha2 → 24.4.0-alpha4
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/multi-select-combo-box",
|
|
3
|
-
"version": "24.4.0-
|
|
3
|
+
"version": "24.4.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/a11y-base": "24.4.0-
|
|
42
|
-
"@vaadin/combo-box": "24.4.0-
|
|
43
|
-
"@vaadin/component-base": "24.4.0-
|
|
44
|
-
"@vaadin/field-base": "24.4.0-
|
|
45
|
-
"@vaadin/input-container": "24.4.0-
|
|
46
|
-
"@vaadin/item": "24.4.0-
|
|
47
|
-
"@vaadin/lit-renderer": "24.4.0-
|
|
48
|
-
"@vaadin/overlay": "24.4.0-
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "24.4.0-
|
|
50
|
-
"@vaadin/vaadin-material-styles": "24.4.0-
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "24.4.0-
|
|
41
|
+
"@vaadin/a11y-base": "24.4.0-alpha4",
|
|
42
|
+
"@vaadin/combo-box": "24.4.0-alpha4",
|
|
43
|
+
"@vaadin/component-base": "24.4.0-alpha4",
|
|
44
|
+
"@vaadin/field-base": "24.4.0-alpha4",
|
|
45
|
+
"@vaadin/input-container": "24.4.0-alpha4",
|
|
46
|
+
"@vaadin/item": "24.4.0-alpha4",
|
|
47
|
+
"@vaadin/lit-renderer": "24.4.0-alpha4",
|
|
48
|
+
"@vaadin/overlay": "24.4.0-alpha4",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.4.0-alpha4",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.4.0-alpha4",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.4.0-alpha4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"web-types.json",
|
|
61
61
|
"web-types.lit.json"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "3f23b333c5e4dd06f3c6a6b2505a0efcd0814b05"
|
|
64
64
|
}
|
|
@@ -60,6 +60,14 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
60
60
|
notify: true,
|
|
61
61
|
},
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* When true, filter string isn't cleared after selecting an item.
|
|
65
|
+
*/
|
|
66
|
+
keepFilter: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
value: false,
|
|
69
|
+
},
|
|
70
|
+
|
|
63
71
|
/**
|
|
64
72
|
* When set to `true`, "loading" attribute is set
|
|
65
73
|
* on the host and the overlay element.
|
|
@@ -236,7 +244,7 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
236
244
|
|
|
237
245
|
if (this.readonly) {
|
|
238
246
|
this.close();
|
|
239
|
-
} else {
|
|
247
|
+
} else if (this._hasValidInputValue()) {
|
|
240
248
|
// Keep selected item focused after committing on Enter.
|
|
241
249
|
const focusedItem = this._dropdownItems[this._focusedIndex];
|
|
242
250
|
this._commitValue();
|
|
@@ -268,6 +276,30 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
268
276
|
super._onEscape(event);
|
|
269
277
|
}
|
|
270
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Override from combo-box to ignore requests to clear the filter if the
|
|
281
|
+
* keepFilter option is enabled. Exceptions are when the dropdown is closed,
|
|
282
|
+
* so the filter is still cleared on cancel and focus out.
|
|
283
|
+
* @protected
|
|
284
|
+
* @override
|
|
285
|
+
*/
|
|
286
|
+
_clearFilter() {
|
|
287
|
+
if (!this.keepFilter || !this.opened) {
|
|
288
|
+
super._clearFilter();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Override method from combo-box to always clear the filter when reverting
|
|
294
|
+
* the input value, regardless of the keepFilter option.
|
|
295
|
+
* @override
|
|
296
|
+
* @protected
|
|
297
|
+
*/
|
|
298
|
+
_revertInputValueToValue() {
|
|
299
|
+
super._revertInputValueToValue();
|
|
300
|
+
this.filter = '';
|
|
301
|
+
}
|
|
302
|
+
|
|
271
303
|
/**
|
|
272
304
|
* @protected
|
|
273
305
|
* @override
|
|
@@ -274,6 +274,12 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
|
|
|
274
274
|
*/
|
|
275
275
|
i18n: MultiSelectComboBoxI18n;
|
|
276
276
|
|
|
277
|
+
/**
|
|
278
|
+
* When true, filter string isn't cleared after selecting an item.
|
|
279
|
+
* @attr {boolean} keep-filter
|
|
280
|
+
*/
|
|
281
|
+
keepFilter: boolean;
|
|
282
|
+
|
|
277
283
|
/**
|
|
278
284
|
* True when loading items from the data provider, false otherwise.
|
|
279
285
|
*/
|
|
@@ -183,6 +183,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
183
183
|
top-group="[[_topGroup]]"
|
|
184
184
|
opened="{{opened}}"
|
|
185
185
|
renderer="[[renderer]]"
|
|
186
|
+
keep-filter="[[keepFilter]]"
|
|
186
187
|
theme$="[[_theme]]"
|
|
187
188
|
on-combo-box-item-selected="_onComboBoxItemSelected"
|
|
188
189
|
on-change="_onComboBoxChange"
|
|
@@ -342,6 +343,14 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
342
343
|
},
|
|
343
344
|
},
|
|
344
345
|
|
|
346
|
+
/**
|
|
347
|
+
* When true, filter string isn't cleared after selecting an item.
|
|
348
|
+
*/
|
|
349
|
+
keepFilter: {
|
|
350
|
+
type: Boolean,
|
|
351
|
+
value: false,
|
|
352
|
+
},
|
|
353
|
+
|
|
345
354
|
/**
|
|
346
355
|
* True when loading items from the data provider, false otherwise.
|
|
347
356
|
*/
|
|
@@ -824,10 +833,27 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
824
833
|
return selectedItems.indexOf(item);
|
|
825
834
|
}
|
|
826
835
|
|
|
827
|
-
/**
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
836
|
+
/**
|
|
837
|
+
* Clear the internal combo box value and filter. Filter will not be cleared
|
|
838
|
+
* when the `keepFilter` option is enabled. Using `force` can enforce clearing
|
|
839
|
+
* the filter.
|
|
840
|
+
* @param {boolean} force overrides the keepFilter option
|
|
841
|
+
* @private
|
|
842
|
+
*/
|
|
843
|
+
__clearInternalValue(force = false) {
|
|
844
|
+
if (!this.keepFilter || force) {
|
|
845
|
+
// Clear both combo box value and filter.
|
|
846
|
+
this.filter = '';
|
|
847
|
+
this.$.comboBox.clear();
|
|
848
|
+
} else {
|
|
849
|
+
// Only clear combo box value. This effectively resets _lastCommittedValue
|
|
850
|
+
// which allows toggling the same item multiple times via keyboard.
|
|
851
|
+
this.$.comboBox.clear();
|
|
852
|
+
// Restore input to the filter value. Needed when items are
|
|
853
|
+
// navigated with keyboard, which overrides the input value
|
|
854
|
+
// with the item label.
|
|
855
|
+
this._inputElementValue = this.filter;
|
|
856
|
+
}
|
|
831
857
|
}
|
|
832
858
|
|
|
833
859
|
/** @private */
|
|
@@ -859,7 +885,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
859
885
|
const lastFilter = this._lastFilter;
|
|
860
886
|
// Do not unselect when manually typing and committing an already selected item.
|
|
861
887
|
if (lastFilter && lastFilter.toLowerCase() === itemLabel.toLowerCase()) {
|
|
862
|
-
this.
|
|
888
|
+
this.__clearInternalValue();
|
|
863
889
|
return;
|
|
864
890
|
}
|
|
865
891
|
|
|
@@ -872,7 +898,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
872
898
|
this.__updateSelection(itemsCopy);
|
|
873
899
|
|
|
874
900
|
// Suppress `value-changed` event.
|
|
875
|
-
this.
|
|
901
|
+
this.__clearInternalValue();
|
|
876
902
|
|
|
877
903
|
this.__announceItem(itemLabel, isSelected, itemsCopy.length);
|
|
878
904
|
}
|
|
@@ -1232,7 +1258,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1232
1258
|
// Stop the original event
|
|
1233
1259
|
event.stopPropagation();
|
|
1234
1260
|
|
|
1235
|
-
this.
|
|
1261
|
+
this.__clearInternalValue(true);
|
|
1236
1262
|
|
|
1237
1263
|
this.dispatchEvent(
|
|
1238
1264
|
new CustomEvent('custom-value-set', {
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/multi-select-combo-box",
|
|
4
|
-
"version": "24.4.0-
|
|
4
|
+
"version": "24.4.0-alpha4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -263,6 +263,17 @@
|
|
|
263
263
|
]
|
|
264
264
|
}
|
|
265
265
|
},
|
|
266
|
+
{
|
|
267
|
+
"name": "keep-filter",
|
|
268
|
+
"description": "When true, filter string isn't cleared after selecting an item.",
|
|
269
|
+
"value": {
|
|
270
|
+
"type": [
|
|
271
|
+
"boolean",
|
|
272
|
+
"null",
|
|
273
|
+
"undefined"
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
},
|
|
266
277
|
{
|
|
267
278
|
"name": "loading",
|
|
268
279
|
"description": "True when loading items from the data provider, false otherwise.",
|
|
@@ -627,6 +638,17 @@
|
|
|
627
638
|
]
|
|
628
639
|
}
|
|
629
640
|
},
|
|
641
|
+
{
|
|
642
|
+
"name": "keepFilter",
|
|
643
|
+
"description": "When true, filter string isn't cleared after selecting an item.",
|
|
644
|
+
"value": {
|
|
645
|
+
"type": [
|
|
646
|
+
"boolean",
|
|
647
|
+
"null",
|
|
648
|
+
"undefined"
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
},
|
|
630
652
|
{
|
|
631
653
|
"name": "loading",
|
|
632
654
|
"description": "True when loading items from the data provider, false otherwise.",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/multi-select-combo-box",
|
|
4
|
-
"version": "24.4.0-
|
|
4
|
+
"version": "24.4.0-alpha4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -89,6 +89,13 @@
|
|
|
89
89
|
"kind": "expression"
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"name": "?keepFilter",
|
|
94
|
+
"description": "When true, filter string isn't cleared after selecting an item.",
|
|
95
|
+
"value": {
|
|
96
|
+
"kind": "expression"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
92
99
|
{
|
|
93
100
|
"name": "?loading",
|
|
94
101
|
"description": "True when loading items from the data provider, false otherwise.",
|