@vaadin/multi-select-combo-box 23.2.0-alpha2 → 23.2.0-dev.48e5e3967

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.2.0-alpha2",
3
+ "version": "23.2.0-dev.48e5e3967",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,19 +35,19 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/combo-box": "23.2.0-alpha2",
39
- "@vaadin/component-base": "23.2.0-alpha2",
40
- "@vaadin/field-base": "23.2.0-alpha2",
41
- "@vaadin/input-container": "23.2.0-alpha2",
42
- "@vaadin/lit-renderer": "23.2.0-alpha2",
43
- "@vaadin/vaadin-lumo-styles": "23.2.0-alpha2",
44
- "@vaadin/vaadin-material-styles": "23.2.0-alpha2",
45
- "@vaadin/vaadin-themable-mixin": "23.2.0-alpha2"
38
+ "@vaadin/combo-box": "23.2.0-dev.48e5e3967",
39
+ "@vaadin/component-base": "23.2.0-dev.48e5e3967",
40
+ "@vaadin/field-base": "23.2.0-dev.48e5e3967",
41
+ "@vaadin/input-container": "23.2.0-dev.48e5e3967",
42
+ "@vaadin/lit-renderer": "23.2.0-dev.48e5e3967",
43
+ "@vaadin/vaadin-lumo-styles": "23.2.0-dev.48e5e3967",
44
+ "@vaadin/vaadin-material-styles": "23.2.0-dev.48e5e3967",
45
+ "@vaadin/vaadin-themable-mixin": "23.2.0-dev.48e5e3967"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
49
49
  "@vaadin/testing-helpers": "^0.3.2",
50
50
  "sinon": "^13.0.2"
51
51
  },
52
- "gitHead": "c9b8113d0fa9a602f8b9cb915c1826355af2e8df"
52
+ "gitHead": "961bc4ae5b707c3c02f12b99819b3c12c9b478aa"
53
53
  }
@@ -87,6 +87,15 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
87
87
  value: () => [],
88
88
  },
89
89
 
90
+ /**
91
+ * Last input value entered by the user before value is updated.
92
+ * Used to store `filter` property value before clearing it.
93
+ */
94
+ lastFilter: {
95
+ type: String,
96
+ notify: true,
97
+ },
98
+
90
99
  _target: {
91
100
  type: Object,
92
101
  },
@@ -195,6 +204,18 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
195
204
  super._closeOrCommit();
196
205
  }
197
206
 
207
+ /**
208
+ * @protected
209
+ * @override
210
+ */
211
+ _commitValue() {
212
+ // Store filter value for checking if user input is matching
213
+ // an item which is already selected, to not un-select it.
214
+ this.lastFilter = this.filter;
215
+
216
+ super._commitValue();
217
+ }
218
+
198
219
  /**
199
220
  * Override method inherited from the combo-box
200
221
  * to not update focused item when readonly.
@@ -131,6 +131,7 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
131
131
  * Custom property | Description | Default
132
132
  * -----------------------------------------------------|----------------------------|--------
133
133
  * `--vaadin-field-default-width` | Default width of the field | `12em`
134
+ * `--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`
134
135
  * `--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
135
136
  * `--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`
136
137
  *
@@ -109,6 +109,7 @@ registerStyles('vaadin-multi-select-combo-box', [inputFieldShared, multiSelectCo
109
109
  * Custom property | Description | Default
110
110
  * -----------------------------------------------------|----------------------------|--------
111
111
  * `--vaadin-field-default-width` | Default width of the field | `12em`
112
+ * `--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`
112
113
  * `--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
113
114
  * `--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`
114
115
  *
@@ -163,6 +164,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
163
164
  allow-custom-value="[[allowCustomValue]]"
164
165
  data-provider="[[dataProvider]]"
165
166
  filter="{{filter}}"
167
+ last-filter="{{_lastFilter}}"
166
168
  loading="{{loading}}"
167
169
  size="{{size}}"
168
170
  filtered-items="[[__effectiveFilteredItems]]"
@@ -453,6 +455,11 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
453
455
  value: -1,
454
456
  observer: '_focusedChipIndexChanged',
455
457
  },
458
+
459
+ /** @private */
460
+ _lastFilter: {
461
+ type: String,
462
+ },
456
463
  };
457
464
  }
458
465
 
@@ -768,8 +775,9 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
768
775
  let isSelected = false;
769
776
 
770
777
  if (index !== -1) {
778
+ const lastFilter = this._lastFilter;
771
779
  // Do not unselect when manually typing and committing an already selected item.
772
- if (this.filter.toLowerCase() === itemLabel.toLowerCase()) {
780
+ if (lastFilter && lastFilter.toLowerCase() === itemLabel.toLowerCase()) {
773
781
  this.__clearFilter();
774
782
  return;
775
783
  }