@vaadin/multi-select-combo-box 23.1.2 → 23.1.5

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.2",
3
+ "version": "23.1.5",
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.2",
37
- "@vaadin/component-base": "^23.1.2",
38
- "@vaadin/field-base": "^23.1.2",
39
- "@vaadin/input-container": "^23.1.2",
40
- "@vaadin/vaadin-lumo-styles": "^23.1.2",
41
- "@vaadin/vaadin-material-styles": "^23.1.2",
42
- "@vaadin/vaadin-themable-mixin": "^23.1.2"
36
+ "@vaadin/combo-box": "^23.1.5",
37
+ "@vaadin/component-base": "^23.1.5",
38
+ "@vaadin/field-base": "^23.1.5",
39
+ "@vaadin/input-container": "^23.1.5",
40
+ "@vaadin/vaadin-lumo-styles": "^23.1.5",
41
+ "@vaadin/vaadin-material-styles": "^23.1.5",
42
+ "@vaadin/vaadin-themable-mixin": "^23.1.5"
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": "6fb205c6e9a761feadfb779dd5d7af96d3102e56"
49
+ "gitHead": "326938919a54353231af25d341ba6076c249afee"
50
50
  }
@@ -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?: boolean | AddEventListenerOptions,
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?: boolean | EventListenerOptions,
319
+ options?: EventListenerOptions | boolean,
315
320
  ): void;
316
321
  }
317
322
 
@@ -196,7 +196,13 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
196
196
  ></vaadin-multi-select-combo-box-chip>
197
197
  <div id="chips" part="chips" slot="prefix"></div>
198
198
  <slot name="input"></slot>
199
- <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
199
+ <div
200
+ id="clearButton"
201
+ part="clear-button"
202
+ slot="suffix"
203
+ on-touchend="_onClearButtonTouchend"
204
+ aria-hidden="true"
205
+ ></div>
200
206
  <div id="toggleButton" class="toggle-button" part="toggle-button" slot="suffix" aria-hidden="true"></div>
201
207
  </vaadin-multi-select-combo-box-container>
202
208
  </vaadin-multi-select-combo-box-internal>
@@ -496,6 +502,15 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
496
502
  return this.required && !this.readonly ? this._hasValue : true;
497
503
  }
498
504
 
505
+ /**
506
+ * Clears the selected items.
507
+ */
508
+ clear() {
509
+ this.__updateSelection([]);
510
+
511
+ announce(this.i18n.cleared);
512
+ }
513
+
499
514
  /**
500
515
  * Clears the cached pages and reloads data from data provider when needed.
501
516
  */
@@ -749,7 +764,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
749
764
  const itemsCopy = [...this.selectedItems];
750
765
  itemsCopy.splice(itemsCopy.indexOf(item), 1);
751
766
  this.__updateSelection(itemsCopy);
752
- this.__announceItem(item, false, itemsCopy.length);
767
+ const itemLabel = this._getItemLabel(item);
768
+ this.__announceItem(itemLabel, false, itemsCopy.length);
753
769
  }
754
770
 
755
771
  /** @private */
@@ -872,6 +888,14 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
872
888
  this._overflowItems = items;
873
889
  }
874
890
 
891
+ /** @private */
892
+ _onClearButtonTouchend(event) {
893
+ // Cancel the following click and focus events
894
+ event.preventDefault();
895
+
896
+ this.clear();
897
+ }
898
+
875
899
  /**
876
900
  * Override method inherited from `InputControlMixin` and clear items.
877
901
  * @protected
@@ -880,9 +904,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
880
904
  _onClearButtonClick(event) {
881
905
  event.stopPropagation();
882
906
 
883
- this.__updateSelection([]);
884
-
885
- announce(this.i18n.cleared);
907
+ this.clear();
886
908
  }
887
909
 
888
910
  /**