@vaadin/multi-select-combo-box 23.1.0-rc1 → 23.1.0-rc2

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.0-rc1",
3
+ "version": "23.1.0-rc2",
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.0-rc1",
37
- "@vaadin/component-base": "23.1.0-rc1",
38
- "@vaadin/field-base": "23.1.0-rc1",
39
- "@vaadin/input-container": "23.1.0-rc1",
40
- "@vaadin/vaadin-lumo-styles": "23.1.0-rc1",
41
- "@vaadin/vaadin-material-styles": "23.1.0-rc1",
42
- "@vaadin/vaadin-themable-mixin": "23.1.0-rc1"
36
+ "@vaadin/combo-box": "23.1.0-rc2",
37
+ "@vaadin/component-base": "23.1.0-rc2",
38
+ "@vaadin/field-base": "23.1.0-rc2",
39
+ "@vaadin/input-container": "23.1.0-rc2",
40
+ "@vaadin/vaadin-lumo-styles": "23.1.0-rc2",
41
+ "@vaadin/vaadin-material-styles": "23.1.0-rc2",
42
+ "@vaadin/vaadin-themable-mixin": "23.1.0-rc2"
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": "5ecb85e16e938df827fefca4bd2a665a1e29913e"
49
+ "gitHead": "154c6782c42145fed21e443559fbe2d781ad3ec7"
50
50
  }
@@ -239,6 +239,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
239
239
  */
240
240
  itemLabelPath: {
241
241
  type: String,
242
+ value: 'label',
242
243
  },
243
244
 
244
245
  /**
@@ -248,6 +249,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
248
249
  */
249
250
  itemValuePath: {
250
251
  type: String,
252
+ value: 'value',
251
253
  },
252
254
 
253
255
  /**
@@ -602,7 +604,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
602
604
 
603
605
  // Use placeholder for announcing items
604
606
  if (this._hasValue) {
605
- const tmpPlaceholder = selectedItems.map((item) => this._getItemLabel(item, this.itemLabelPath)).join(', ');
607
+ const tmpPlaceholder = this._mergeItemLabels(selectedItems);
606
608
  this.__tmpA11yPlaceholder = tmpPlaceholder;
607
609
  this.placeholder = tmpPlaceholder;
608
610
  } else {
@@ -627,8 +629,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
627
629
  }
628
630
 
629
631
  /** @private */
630
- _getItemLabel(item, itemLabelPath) {
631
- return item && Object.prototype.hasOwnProperty.call(item, itemLabelPath) ? item[itemLabelPath] : item;
632
+ _getItemLabel(item) {
633
+ return item && Object.prototype.hasOwnProperty.call(item, this.itemLabelPath) ? item[this.itemLabelPath] : item;
632
634
  }
633
635
 
634
636
  /** @private */
@@ -651,7 +653,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
651
653
 
652
654
  /** @private */
653
655
  _getOverflowTitle(items) {
654
- return items.map((item) => this._getItemLabel(item, this.itemLabelPath)).join(', ');
656
+ return this._mergeItemLabels(items);
655
657
  }
656
658
 
657
659
  /** @private */
@@ -659,6 +661,11 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
659
661
  return length === 0;
660
662
  }
661
663
 
664
+ /** @private */
665
+ _mergeItemLabels(items) {
666
+ return items.map((item) => this._getItemLabel(item)).join(', ');
667
+ }
668
+
662
669
  /** @private */
663
670
  _findIndex(item, selectedItems, itemIdPath) {
664
671
  if (itemIdPath && item) {
@@ -699,7 +706,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
699
706
  const itemsCopy = [...this.selectedItems];
700
707
 
701
708
  const index = this._findIndex(item, itemsCopy, this.itemIdPath);
702
- const itemLabel = this._getItemLabel(item, this.itemLabelPath);
709
+ const itemLabel = this._getItemLabel(item);
703
710
 
704
711
  let isSelected = false;
705
712
 
@@ -743,7 +750,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
743
750
  chip.disabled = this.disabled;
744
751
  chip.readonly = this.readonly;
745
752
 
746
- const label = this._getItemLabel(item, this.itemLabelPath);
753
+ const label = this._getItemLabel(item);
747
754
  chip.label = label;
748
755
  chip.setAttribute('title', label);
749
756
 
@@ -946,7 +953,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
946
953
  // Announce focused chip
947
954
  if (focusedIndex > -1) {
948
955
  const item = chips[focusedIndex].item;
949
- const itemLabel = this._getItemLabel(item, this.itemLabelPath);
956
+ const itemLabel = this._getItemLabel(item);
950
957
  announce(`${itemLabel} ${this.i18n.focused}`);
951
958
  }
952
959
  }