@vaadin/multi-select-combo-box 23.1.1 → 23.1.4
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.4",
|
|
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.4",
|
|
37
|
+
"@vaadin/component-base": "^23.1.4",
|
|
38
|
+
"@vaadin/field-base": "^23.1.4",
|
|
39
|
+
"@vaadin/input-container": "^23.1.4",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "^23.1.4",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "^23.1.4",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "^23.1.4"
|
|
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": "0a82302064f1276a000f0cbd810076539407d133"
|
|
50
50
|
}
|
|
@@ -86,6 +86,15 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
86
86
|
value: () => [],
|
|
87
87
|
},
|
|
88
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
|
+
|
|
89
98
|
_target: {
|
|
90
99
|
type: Object,
|
|
91
100
|
},
|
|
@@ -183,6 +192,18 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
183
192
|
super._closeOrCommit();
|
|
184
193
|
}
|
|
185
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
|
+
|
|
186
207
|
/**
|
|
187
208
|
* Override method inherited from the combo-box
|
|
188
209
|
* to not update focused item when readonly.
|
|
@@ -294,6 +294,11 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
|
|
|
294
294
|
*/
|
|
295
295
|
clearCache(): void;
|
|
296
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Clears the selected items.
|
|
299
|
+
*/
|
|
300
|
+
clear(): void;
|
|
301
|
+
|
|
297
302
|
/**
|
|
298
303
|
* Requests an update for the content of items.
|
|
299
304
|
* While performing the update, it invokes the renderer (passed in the `renderer` property) once an item.
|
|
@@ -305,13 +310,13 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
|
|
|
305
310
|
addEventListener<K extends keyof MultiSelectComboBoxEventMap<TItem>>(
|
|
306
311
|
type: K,
|
|
307
312
|
listener: (this: MultiSelectComboBox<TItem>, ev: MultiSelectComboBoxEventMap<TItem>[K]) => void,
|
|
308
|
-
options?:
|
|
313
|
+
options?: AddEventListenerOptions | boolean,
|
|
309
314
|
): void;
|
|
310
315
|
|
|
311
316
|
removeEventListener<K extends keyof MultiSelectComboBoxEventMap<TItem>>(
|
|
312
317
|
type: K,
|
|
313
318
|
listener: (this: MultiSelectComboBox<TItem>, ev: MultiSelectComboBoxEventMap<TItem>[K]) => void,
|
|
314
|
-
options?:
|
|
319
|
+
options?: EventListenerOptions | boolean,
|
|
315
320
|
): void;
|
|
316
321
|
}
|
|
317
322
|
|
|
@@ -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]]"
|
|
@@ -195,7 +196,13 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
195
196
|
></vaadin-multi-select-combo-box-chip>
|
|
196
197
|
<div id="chips" part="chips" slot="prefix"></div>
|
|
197
198
|
<slot name="input"></slot>
|
|
198
|
-
<div
|
|
199
|
+
<div
|
|
200
|
+
id="clearButton"
|
|
201
|
+
part="clear-button"
|
|
202
|
+
slot="suffix"
|
|
203
|
+
on-touchend="_onClearButtonTouchend"
|
|
204
|
+
aria-hidden="true"
|
|
205
|
+
></div>
|
|
199
206
|
<div id="toggleButton" class="toggle-button" part="toggle-button" slot="suffix" aria-hidden="true"></div>
|
|
200
207
|
</vaadin-multi-select-combo-box-container>
|
|
201
208
|
</vaadin-multi-select-combo-box-internal>
|
|
@@ -441,6 +448,11 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
441
448
|
value: -1,
|
|
442
449
|
observer: '_focusedChipIndexChanged',
|
|
443
450
|
},
|
|
451
|
+
|
|
452
|
+
/** @private */
|
|
453
|
+
_lastFilter: {
|
|
454
|
+
type: String,
|
|
455
|
+
},
|
|
444
456
|
};
|
|
445
457
|
}
|
|
446
458
|
|
|
@@ -490,6 +502,15 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
490
502
|
return this.required && !this.readonly ? this._hasValue : true;
|
|
491
503
|
}
|
|
492
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Clears the selected items.
|
|
507
|
+
*/
|
|
508
|
+
clear() {
|
|
509
|
+
this.__updateSelection([]);
|
|
510
|
+
|
|
511
|
+
announce(this.i18n.cleared);
|
|
512
|
+
}
|
|
513
|
+
|
|
493
514
|
/**
|
|
494
515
|
* Clears the cached pages and reloads data from data provider when needed.
|
|
495
516
|
*/
|
|
@@ -614,7 +635,10 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
614
635
|
* @private
|
|
615
636
|
*/
|
|
616
637
|
_onFilteredItemsChanged(event) {
|
|
617
|
-
|
|
638
|
+
const { value } = event.detail;
|
|
639
|
+
if (Array.isArray(value) || value == null) {
|
|
640
|
+
this.filteredItems = value;
|
|
641
|
+
}
|
|
618
642
|
}
|
|
619
643
|
|
|
620
644
|
/** @private */
|
|
@@ -740,7 +764,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
740
764
|
const itemsCopy = [...this.selectedItems];
|
|
741
765
|
itemsCopy.splice(itemsCopy.indexOf(item), 1);
|
|
742
766
|
this.__updateSelection(itemsCopy);
|
|
743
|
-
this.
|
|
767
|
+
const itemLabel = this._getItemLabel(item);
|
|
768
|
+
this.__announceItem(itemLabel, false, itemsCopy.length);
|
|
744
769
|
}
|
|
745
770
|
|
|
746
771
|
/** @private */
|
|
@@ -753,8 +778,9 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
753
778
|
let isSelected = false;
|
|
754
779
|
|
|
755
780
|
if (index !== -1) {
|
|
781
|
+
const lastFilter = this._lastFilter;
|
|
756
782
|
// Do not unselect when manually typing and committing an already selected item.
|
|
757
|
-
if (
|
|
783
|
+
if (lastFilter && lastFilter.toLowerCase() === itemLabel.toLowerCase()) {
|
|
758
784
|
this.__clearFilter();
|
|
759
785
|
return;
|
|
760
786
|
}
|
|
@@ -862,6 +888,14 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
862
888
|
this._overflowItems = items;
|
|
863
889
|
}
|
|
864
890
|
|
|
891
|
+
/** @private */
|
|
892
|
+
_onClearButtonTouchend(event) {
|
|
893
|
+
// Cancel the following click and focus events
|
|
894
|
+
event.preventDefault();
|
|
895
|
+
|
|
896
|
+
this.clear();
|
|
897
|
+
}
|
|
898
|
+
|
|
865
899
|
/**
|
|
866
900
|
* Override method inherited from `InputControlMixin` and clear items.
|
|
867
901
|
* @protected
|
|
@@ -870,9 +904,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
870
904
|
_onClearButtonClick(event) {
|
|
871
905
|
event.stopPropagation();
|
|
872
906
|
|
|
873
|
-
this.
|
|
874
|
-
|
|
875
|
-
announce(this.i18n.cleared);
|
|
907
|
+
this.clear();
|
|
876
908
|
}
|
|
877
909
|
|
|
878
910
|
/**
|