@vaadin/multi-select-combo-box 24.4.0-rc1 → 24.5.0-alpha1

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.4.0-rc1",
3
+ "version": "24.5.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,17 +38,17 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/a11y-base": "24.4.0-rc1",
42
- "@vaadin/combo-box": "24.4.0-rc1",
43
- "@vaadin/component-base": "24.4.0-rc1",
44
- "@vaadin/field-base": "24.4.0-rc1",
45
- "@vaadin/input-container": "24.4.0-rc1",
46
- "@vaadin/item": "24.4.0-rc1",
47
- "@vaadin/lit-renderer": "24.4.0-rc1",
48
- "@vaadin/overlay": "24.4.0-rc1",
49
- "@vaadin/vaadin-lumo-styles": "24.4.0-rc1",
50
- "@vaadin/vaadin-material-styles": "24.4.0-rc1",
51
- "@vaadin/vaadin-themable-mixin": "24.4.0-rc1"
41
+ "@vaadin/a11y-base": "24.5.0-alpha1",
42
+ "@vaadin/combo-box": "24.5.0-alpha1",
43
+ "@vaadin/component-base": "24.5.0-alpha1",
44
+ "@vaadin/field-base": "24.5.0-alpha1",
45
+ "@vaadin/input-container": "24.5.0-alpha1",
46
+ "@vaadin/item": "24.5.0-alpha1",
47
+ "@vaadin/lit-renderer": "24.5.0-alpha1",
48
+ "@vaadin/overlay": "24.5.0-alpha1",
49
+ "@vaadin/vaadin-lumo-styles": "24.5.0-alpha1",
50
+ "@vaadin/vaadin-material-styles": "24.5.0-alpha1",
51
+ "@vaadin/vaadin-themable-mixin": "24.5.0-alpha1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@esm-bundle/chai": "^4.3.4",
@@ -60,5 +60,5 @@
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "a81e3b927d44c56613fa4e1307494a2acc81005f"
63
+ "gitHead": "57806caac5468532a3b4e3dbdda730cd0fca193a"
64
64
  }
@@ -231,6 +231,14 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
231
231
  */
232
232
  items: TItem[] | undefined;
233
233
 
234
+ /**
235
+ * A function used to generate CSS class names for dropdown
236
+ * items and selected chips based on the item. The return
237
+ * value should be the generated class name as a string, or
238
+ * multiple class names separated by whitespace characters.
239
+ */
240
+ itemClassNameGenerator: (item: TItem) => string;
241
+
234
242
  /**
235
243
  * The item property used for a visual representation of the item.
236
244
  * @attr {string} item-label-path
@@ -180,6 +180,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
180
180
  filtered-items="[[filteredItems]]"
181
181
  selected-items="[[selectedItems]]"
182
182
  selected-items-on-top="[[selectedItemsOnTop]]"
183
+ item-class-name-generator="[[itemClassNameGenerator]]"
183
184
  top-group="[[_topGroup]]"
184
185
  opened="{{opened}}"
185
186
  renderer="[[renderer]]"
@@ -279,6 +280,17 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
279
280
  type: Array,
280
281
  },
281
282
 
283
+ /**
284
+ * A function used to generate CSS class names for dropdown
285
+ * items and selected chips based on the item. The return
286
+ * value should be the generated class name as a string, or
287
+ * multiple class names separated by whitespace characters.
288
+ */
289
+ itemClassNameGenerator: {
290
+ type: Object,
291
+ observer: '__itemClassNameGeneratorChanged',
292
+ },
293
+
282
294
  /**
283
295
  * The item property used for a visual representation of the item.
284
296
  * @attr {string} item-label-path
@@ -761,6 +773,13 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
761
773
  }
762
774
  }
763
775
 
776
+ /** @private */
777
+ __itemClassNameGeneratorChanged(generator, oldGenerator) {
778
+ if (generator || oldGenerator) {
779
+ this.__updateChips();
780
+ }
781
+ }
782
+
764
783
  /** @private */
765
784
  _pageSizeChanged(pageSize, oldPageSize) {
766
785
  if (Math.floor(pageSize) !== pageSize || pageSize <= 0) {
@@ -934,6 +953,10 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
934
953
  chip.label = label;
935
954
  chip.setAttribute('title', label);
936
955
 
956
+ if (typeof this.itemClassNameGenerator === 'function') {
957
+ chip.className = this.itemClassNameGenerator(item);
958
+ }
959
+
937
960
  chip.addEventListener('item-removed', (e) => this._onItemRemoved(e));
938
961
  chip.addEventListener('mousedown', (e) => this._preventBlur(e));
939
962
 
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.4.0-rc1",
4
+ "version": "24.5.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -596,6 +596,17 @@
596
596
  ]
597
597
  }
598
598
  },
599
+ {
600
+ "name": "itemClassNameGenerator",
601
+ "description": "A function used to generate CSS class names for dropdown\nitems and selected chips based on the item. The return\nvalue should be the generated class name as a string, or\nmultiple class names separated by whitespace characters.",
602
+ "value": {
603
+ "type": [
604
+ "Object",
605
+ "null",
606
+ "undefined"
607
+ ]
608
+ }
609
+ },
599
610
  {
600
611
  "name": "itemLabelPath",
601
612
  "description": "The item property used for a visual representation of the item.",
@@ -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.4.0-rc1",
4
+ "version": "24.5.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -194,6 +194,13 @@
194
194
  "kind": "expression"
195
195
  }
196
196
  },
197
+ {
198
+ "name": ".itemClassNameGenerator",
199
+ "description": "A function used to generate CSS class names for dropdown\nitems and selected chips based on the item. The return\nvalue should be the generated class name as a string, or\nmultiple class names separated by whitespace characters.",
200
+ "value": {
201
+ "kind": "expression"
202
+ }
203
+ },
197
204
  {
198
205
  "name": ".itemLabelPath",
199
206
  "description": "The item property used for a visual representation of the item.",