@vaadin/multi-select-combo-box 24.6.10 → 24.6.11

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.6.10",
3
+ "version": "24.6.11",
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.6.10",
43
- "@vaadin/combo-box": "~24.6.10",
44
- "@vaadin/component-base": "~24.6.10",
45
- "@vaadin/field-base": "~24.6.10",
46
- "@vaadin/input-container": "~24.6.10",
47
- "@vaadin/item": "~24.6.10",
48
- "@vaadin/lit-renderer": "~24.6.10",
49
- "@vaadin/overlay": "~24.6.10",
50
- "@vaadin/vaadin-lumo-styles": "~24.6.10",
51
- "@vaadin/vaadin-material-styles": "~24.6.10",
52
- "@vaadin/vaadin-themable-mixin": "~24.6.10",
42
+ "@vaadin/a11y-base": "~24.6.11",
43
+ "@vaadin/combo-box": "~24.6.11",
44
+ "@vaadin/component-base": "~24.6.11",
45
+ "@vaadin/field-base": "~24.6.11",
46
+ "@vaadin/input-container": "~24.6.11",
47
+ "@vaadin/item": "~24.6.11",
48
+ "@vaadin/lit-renderer": "~24.6.11",
49
+ "@vaadin/overlay": "~24.6.11",
50
+ "@vaadin/vaadin-lumo-styles": "~24.6.11",
51
+ "@vaadin/vaadin-material-styles": "~24.6.11",
52
+ "@vaadin/vaadin-themable-mixin": "~24.6.11",
53
53
  "lit": "^3.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@vaadin/chai-plugins": "~24.6.10",
57
- "@vaadin/test-runner-commands": "~24.6.10",
56
+ "@vaadin/chai-plugins": "~24.6.11",
57
+ "@vaadin/test-runner-commands": "~24.6.11",
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": "f2c6d256a6ebbff15c6c2b8b72b7ed0311acb1a9"
65
+ "gitHead": "7e0e209cea336dfd4970a1a1ccb34f92a3b8c20d"
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');
@@ -889,14 +904,17 @@ export const MultiSelectComboBoxMixin = (superClass) =>
889
904
  }
890
905
 
891
906
  // When auto expanding vertically, no need to measure remaining width
892
- if (!this.autoExpandVertically && this.$.chips.clientWidth > remainingWidth) {
893
- // Always show at least last selected item as a chip
894
- if (refNode === null) {
895
- chip.style.maxWidth = `${Math.max(chipMinWidth, remainingWidth)}px`;
896
- } else {
897
- chip.remove();
898
- break;
907
+ if (!this.autoExpandVertically) {
908
+ if (this.$.chips.clientWidth > remainingWidth) {
909
+ // If there is no more space for chips, or if there is at least one
910
+ // chip already shown, collapse all remaining chips to the overflow
911
+ if (remainingWidth < chipMinWidth || refNode !== null) {
912
+ chip.remove();
913
+ break;
914
+ }
899
915
  }
916
+
917
+ chip.style.maxWidth = `${remainingWidth}px`;
900
918
  }
901
919
 
902
920
  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.6.10",
4
+ "version": "24.6.11",
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.6.10",
4
+ "version": "24.6.11",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {