@vaadin/multi-select-combo-box 23.1.0 → 23.1.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/multi-select-combo-box",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@polymer/polymer": "^3.0.0",
|
|
36
|
-
"@vaadin/combo-box": "^23.1.
|
|
37
|
-
"@vaadin/component-base": "^23.1.
|
|
38
|
-
"@vaadin/field-base": "^23.1.
|
|
39
|
-
"@vaadin/input-container": "^23.1.
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "^23.1.
|
|
41
|
-
"@vaadin/vaadin-material-styles": "^23.1.
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "^23.1.
|
|
36
|
+
"@vaadin/combo-box": "^23.1.3",
|
|
37
|
+
"@vaadin/component-base": "^23.1.3",
|
|
38
|
+
"@vaadin/field-base": "^23.1.3",
|
|
39
|
+
"@vaadin/input-container": "^23.1.3",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "^23.1.3",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "^23.1.3",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "^23.1.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@esm-bundle/chai": "^4.3.4",
|
|
46
46
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
47
47
|
"sinon": "^13.0.2"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "3066c296ad0ef652bc49417005523398199f1bf2"
|
|
50
50
|
}
|
|
@@ -50,6 +50,14 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
50
50
|
|
|
51
51
|
static get properties() {
|
|
52
52
|
return {
|
|
53
|
+
/**
|
|
54
|
+
* A subset of items, filtered based on the user input.
|
|
55
|
+
*/
|
|
56
|
+
filteredItems: {
|
|
57
|
+
type: Array,
|
|
58
|
+
notify: true,
|
|
59
|
+
},
|
|
60
|
+
|
|
53
61
|
/**
|
|
54
62
|
* When set to `true`, "loading" attribute is set
|
|
55
63
|
* on the host and the overlay element.
|
|
@@ -78,6 +86,15 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
78
86
|
value: () => [],
|
|
79
87
|
},
|
|
80
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Last input value entered by the user before value is updated.
|
|
91
|
+
* Used to store `filter` property value before clearing it.
|
|
92
|
+
*/
|
|
93
|
+
lastFilter: {
|
|
94
|
+
type: String,
|
|
95
|
+
notify: true,
|
|
96
|
+
},
|
|
97
|
+
|
|
81
98
|
_target: {
|
|
82
99
|
type: Object,
|
|
83
100
|
},
|
|
@@ -175,6 +192,18 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
175
192
|
super._closeOrCommit();
|
|
176
193
|
}
|
|
177
194
|
|
|
195
|
+
/**
|
|
196
|
+
* @protected
|
|
197
|
+
* @override
|
|
198
|
+
*/
|
|
199
|
+
_commitValue() {
|
|
200
|
+
// Store filter value for checking if user input is matching
|
|
201
|
+
// an item which is already selected, to not un-select it.
|
|
202
|
+
this.lastFilter = this.filter;
|
|
203
|
+
|
|
204
|
+
super._commitValue();
|
|
205
|
+
}
|
|
206
|
+
|
|
178
207
|
/**
|
|
179
208
|
* Override method inherited from the combo-box
|
|
180
209
|
* to not update focused item when readonly.
|
|
@@ -305,13 +305,13 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
|
|
|
305
305
|
addEventListener<K extends keyof MultiSelectComboBoxEventMap<TItem>>(
|
|
306
306
|
type: K,
|
|
307
307
|
listener: (this: MultiSelectComboBox<TItem>, ev: MultiSelectComboBoxEventMap<TItem>[K]) => void,
|
|
308
|
-
options?:
|
|
308
|
+
options?: AddEventListenerOptions | boolean,
|
|
309
309
|
): void;
|
|
310
310
|
|
|
311
311
|
removeEventListener<K extends keyof MultiSelectComboBoxEventMap<TItem>>(
|
|
312
312
|
type: K,
|
|
313
313
|
listener: (this: MultiSelectComboBox<TItem>, ev: MultiSelectComboBoxEventMap<TItem>[K]) => void,
|
|
314
|
-
options?:
|
|
314
|
+
options?: EventListenerOptions | boolean,
|
|
315
315
|
): void;
|
|
316
316
|
}
|
|
317
317
|
|
|
@@ -163,6 +163,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
163
163
|
allow-custom-value="[[allowCustomValue]]"
|
|
164
164
|
data-provider="[[dataProvider]]"
|
|
165
165
|
filter="{{filter}}"
|
|
166
|
+
last-filter="{{_lastFilter}}"
|
|
166
167
|
loading="{{loading}}"
|
|
167
168
|
size="{{size}}"
|
|
168
169
|
filtered-items="[[filteredItems]]"
|
|
@@ -173,6 +174,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
173
174
|
on-combo-box-item-selected="_onComboBoxItemSelected"
|
|
174
175
|
on-change="_onComboBoxChange"
|
|
175
176
|
on-custom-value-set="_onCustomValueSet"
|
|
177
|
+
on-filtered-items-changed="_onFilteredItemsChanged"
|
|
176
178
|
>
|
|
177
179
|
<vaadin-multi-select-combo-box-container
|
|
178
180
|
part="input-field"
|
|
@@ -440,6 +442,11 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
440
442
|
value: -1,
|
|
441
443
|
observer: '_focusedChipIndexChanged',
|
|
442
444
|
},
|
|
445
|
+
|
|
446
|
+
/** @private */
|
|
447
|
+
_lastFilter: {
|
|
448
|
+
type: String,
|
|
449
|
+
},
|
|
443
450
|
};
|
|
444
451
|
}
|
|
445
452
|
|
|
@@ -605,6 +612,20 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
605
612
|
}
|
|
606
613
|
}
|
|
607
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Implement two-way binding for the `filteredItems` property
|
|
617
|
+
* that can be set on the internal combo-box element.
|
|
618
|
+
*
|
|
619
|
+
* @param {CustomEvent} event
|
|
620
|
+
* @private
|
|
621
|
+
*/
|
|
622
|
+
_onFilteredItemsChanged(event) {
|
|
623
|
+
const { value } = event.detail;
|
|
624
|
+
if (Array.isArray(value) || value == null) {
|
|
625
|
+
this.filteredItems = value;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
608
629
|
/** @private */
|
|
609
630
|
_readonlyChanged(readonly, oldReadonly) {
|
|
610
631
|
if (readonly || oldReadonly) {
|
|
@@ -728,7 +749,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
728
749
|
const itemsCopy = [...this.selectedItems];
|
|
729
750
|
itemsCopy.splice(itemsCopy.indexOf(item), 1);
|
|
730
751
|
this.__updateSelection(itemsCopy);
|
|
731
|
-
this.
|
|
752
|
+
const itemLabel = this._getItemLabel(item);
|
|
753
|
+
this.__announceItem(itemLabel, false, itemsCopy.length);
|
|
732
754
|
}
|
|
733
755
|
|
|
734
756
|
/** @private */
|
|
@@ -741,8 +763,9 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
741
763
|
let isSelected = false;
|
|
742
764
|
|
|
743
765
|
if (index !== -1) {
|
|
766
|
+
const lastFilter = this._lastFilter;
|
|
744
767
|
// Do not unselect when manually typing and committing an already selected item.
|
|
745
|
-
if (
|
|
768
|
+
if (lastFilter && lastFilter.toLowerCase() === itemLabel.toLowerCase()) {
|
|
746
769
|
this.__clearFilter();
|
|
747
770
|
return;
|
|
748
771
|
}
|
|
@@ -863,6 +886,18 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
863
886
|
announce(this.i18n.cleared);
|
|
864
887
|
}
|
|
865
888
|
|
|
889
|
+
/**
|
|
890
|
+
* Override an event listener from `InputControlMixin` to
|
|
891
|
+
* stop the change event re-targeted from the input.
|
|
892
|
+
*
|
|
893
|
+
* @param {!Event} event
|
|
894
|
+
* @protected
|
|
895
|
+
* @override
|
|
896
|
+
*/
|
|
897
|
+
_onChange(event) {
|
|
898
|
+
event.stopPropagation();
|
|
899
|
+
}
|
|
900
|
+
|
|
866
901
|
/**
|
|
867
902
|
* Override an event listener from `KeyboardMixin`.
|
|
868
903
|
* Do not call `super` in order to override clear
|