@vaadin/multi-select-combo-box 24.7.6 → 24.7.8

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.7.6",
3
+ "version": "24.7.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,22 +39,22 @@
39
39
  "dependencies": {
40
40
  "@open-wc/dedupe-mixin": "^1.3.0",
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/a11y-base": "~24.7.6",
43
- "@vaadin/combo-box": "~24.7.6",
44
- "@vaadin/component-base": "~24.7.6",
45
- "@vaadin/field-base": "~24.7.6",
46
- "@vaadin/input-container": "~24.7.6",
47
- "@vaadin/item": "~24.7.6",
48
- "@vaadin/lit-renderer": "~24.7.6",
49
- "@vaadin/overlay": "~24.7.6",
50
- "@vaadin/vaadin-lumo-styles": "~24.7.6",
51
- "@vaadin/vaadin-material-styles": "~24.7.6",
52
- "@vaadin/vaadin-themable-mixin": "~24.7.6",
42
+ "@vaadin/a11y-base": "~24.7.8",
43
+ "@vaadin/combo-box": "~24.7.8",
44
+ "@vaadin/component-base": "~24.7.8",
45
+ "@vaadin/field-base": "~24.7.8",
46
+ "@vaadin/input-container": "~24.7.8",
47
+ "@vaadin/item": "~24.7.8",
48
+ "@vaadin/lit-renderer": "~24.7.8",
49
+ "@vaadin/overlay": "~24.7.8",
50
+ "@vaadin/vaadin-lumo-styles": "~24.7.8",
51
+ "@vaadin/vaadin-material-styles": "~24.7.8",
52
+ "@vaadin/vaadin-themable-mixin": "~24.7.8",
53
53
  "lit": "^3.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@vaadin/chai-plugins": "~24.7.6",
57
- "@vaadin/test-runner-commands": "~24.7.6",
56
+ "@vaadin/chai-plugins": "~24.7.8",
57
+ "@vaadin/test-runner-commands": "~24.7.8",
58
58
  "@vaadin/testing-helpers": "^1.1.0",
59
59
  "sinon": "^18.0.0"
60
60
  },
@@ -62,5 +62,5 @@
62
62
  "web-types.json",
63
63
  "web-types.lit.json"
64
64
  ],
65
- "gitHead": "8f068b8203af4f336fee5220ae15a94090079d43"
65
+ "gitHead": "03387032412d4256e3defd4d5d654b8494e55d7b"
66
66
  }
@@ -758,11 +758,26 @@ export const MultiSelectComboBoxMixin = (superClass) =>
758
758
  __updateTopGroup(selectedItemsOnTop, selectedItems, opened) {
759
759
  if (!selectedItemsOnTop) {
760
760
  this._topGroup = [];
761
- } else if (!opened) {
761
+ } else if (!opened || this.__needToSyncTopGroup()) {
762
762
  this._topGroup = [...selectedItems];
763
763
  }
764
764
  }
765
765
 
766
+ /** @private */
767
+ __needToSyncTopGroup() {
768
+ // Only sync for object items
769
+ if (!this.itemIdPath) {
770
+ return false;
771
+ }
772
+ return (
773
+ this._topGroup &&
774
+ this._topGroup.some((item) => {
775
+ const selectedItem = this.selectedItems[this._findIndex(item, this.selectedItems, this.itemIdPath)];
776
+ return selectedItem && item !== selectedItem;
777
+ })
778
+ );
779
+ }
780
+
766
781
  /** @private */
767
782
  __createChip(item) {
768
783
  const chip = document.createElement('vaadin-multi-select-combo-box-chip');
@@ -877,14 +892,17 @@ export const MultiSelectComboBoxMixin = (superClass) =>
877
892
  this.insertBefore(chip, refNode);
878
893
 
879
894
  // When auto expanding vertically, no need to measure remaining width
880
- if (!this.autoExpandVertically && this.$.chips.clientWidth > remainingWidth) {
881
- // Always show at least last selected item as a chip
882
- if (refNode === null) {
883
- chip.style.maxWidth = `${Math.max(chipMinWidth, remainingWidth)}px`;
884
- } else {
885
- chip.remove();
886
- break;
895
+ if (!this.autoExpandVertically) {
896
+ if (this.$.chips.clientWidth > remainingWidth) {
897
+ // If there is no more space for chips, or if there is at least one
898
+ // chip already shown, collapse all remaining chips to the overflow
899
+ if (remainingWidth < chipMinWidth || refNode !== null) {
900
+ chip.remove();
901
+ break;
902
+ }
887
903
  }
904
+
905
+ chip.style.maxWidth = `${remainingWidth}px`;
888
906
  }
889
907
 
890
908
  items.pop();
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.7.6",
4
+ "version": "24.7.8",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -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.7.6",
4
+ "version": "24.7.8",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {