@vaadin/multi-select-combo-box 25.1.0-beta1 → 25.1.0-beta3
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/custom-elements.json +789 -499
- package/package.json +16 -16
- package/src/vaadin-multi-select-combo-box-mixin.js +71 -54
- package/web-types.json +45 -12
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/multi-select-combo-box",
|
|
3
|
-
"version": "25.1.0-
|
|
3
|
+
"version": "25.1.0-beta3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,29 +37,29 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/a11y-base": "25.1.0-
|
|
41
|
-
"@vaadin/combo-box": "25.1.0-
|
|
42
|
-
"@vaadin/component-base": "25.1.0-
|
|
43
|
-
"@vaadin/field-base": "25.1.0-
|
|
44
|
-
"@vaadin/input-container": "25.1.0-
|
|
45
|
-
"@vaadin/item": "25.1.0-
|
|
46
|
-
"@vaadin/lit-renderer": "25.1.0-
|
|
47
|
-
"@vaadin/overlay": "25.1.0-
|
|
48
|
-
"@vaadin/vaadin-themable-mixin": "25.1.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.1.0-beta3",
|
|
41
|
+
"@vaadin/combo-box": "25.1.0-beta3",
|
|
42
|
+
"@vaadin/component-base": "25.1.0-beta3",
|
|
43
|
+
"@vaadin/field-base": "25.1.0-beta3",
|
|
44
|
+
"@vaadin/input-container": "25.1.0-beta3",
|
|
45
|
+
"@vaadin/item": "25.1.0-beta3",
|
|
46
|
+
"@vaadin/lit-renderer": "25.1.0-beta3",
|
|
47
|
+
"@vaadin/overlay": "25.1.0-beta3",
|
|
48
|
+
"@vaadin/vaadin-themable-mixin": "25.1.0-beta3",
|
|
49
49
|
"lit": "^3.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@vaadin/aura": "25.1.0-
|
|
53
|
-
"@vaadin/chai-plugins": "25.1.0-
|
|
54
|
-
"@vaadin/test-runner-commands": "25.1.0-
|
|
52
|
+
"@vaadin/aura": "25.1.0-beta3",
|
|
53
|
+
"@vaadin/chai-plugins": "25.1.0-beta3",
|
|
54
|
+
"@vaadin/test-runner-commands": "25.1.0-beta3",
|
|
55
55
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
56
|
-
"@vaadin/vaadin-lumo-styles": "25.1.0-
|
|
57
|
-
"sinon": "^21.0.
|
|
56
|
+
"@vaadin/vaadin-lumo-styles": "25.1.0-beta3",
|
|
57
|
+
"sinon": "^21.0.2"
|
|
58
58
|
},
|
|
59
59
|
"customElements": "custom-elements.json",
|
|
60
60
|
"web-types": [
|
|
61
61
|
"web-types.json",
|
|
62
62
|
"web-types.lit.json"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "4251850231a42298fda23b83928da588831cdb5d"
|
|
65
65
|
}
|
|
@@ -239,7 +239,7 @@ export const MultiSelectComboBoxMixin = (superClass) =>
|
|
|
239
239
|
* total: '{count} items selected',
|
|
240
240
|
* }
|
|
241
241
|
* ```
|
|
242
|
-
* @
|
|
242
|
+
* @type {!MultiSelectComboBoxI18n}
|
|
243
243
|
*/
|
|
244
244
|
get i18n() {
|
|
245
245
|
return super.i18n;
|
|
@@ -872,6 +872,11 @@ export const MultiSelectComboBoxMixin = (superClass) =>
|
|
|
872
872
|
return chip;
|
|
873
873
|
}
|
|
874
874
|
|
|
875
|
+
/** @private */
|
|
876
|
+
__getWrapperWidth() {
|
|
877
|
+
return this._inputField.$.wrapper.clientWidth;
|
|
878
|
+
}
|
|
879
|
+
|
|
875
880
|
/** @private */
|
|
876
881
|
__getOverflowWidth() {
|
|
877
882
|
const chip = this._overflow;
|
|
@@ -905,82 +910,94 @@ export const MultiSelectComboBoxMixin = (superClass) =>
|
|
|
905
910
|
chip.remove();
|
|
906
911
|
});
|
|
907
912
|
|
|
908
|
-
|
|
913
|
+
if (this.selectedItems.length === 0) {
|
|
914
|
+
this._overflowItems = [];
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// When auto expanding vertically, create all chips without overflow
|
|
919
|
+
if (this.autoExpandVertically) {
|
|
920
|
+
this.selectedItems.forEach((item) => {
|
|
921
|
+
this.appendChild(this.__createChip(item));
|
|
922
|
+
});
|
|
923
|
+
this._overflowItems = [];
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
909
926
|
|
|
910
|
-
// Detect available remaining width for chips
|
|
911
|
-
const totalWidth = this._inputField.$.wrapper.clientWidth;
|
|
912
927
|
const inputWidth = parseInt(getComputedStyle(this.inputElement).flexBasis);
|
|
913
928
|
|
|
914
|
-
|
|
929
|
+
if (this.autoExpandHorizontally) {
|
|
930
|
+
this._overflowItems = this.__updateChipsHorizontalExpand(this.selectedItems, inputWidth);
|
|
931
|
+
} else {
|
|
932
|
+
this._overflowItems = this.__updateChipsDefault(this.selectedItems, inputWidth);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
915
935
|
|
|
916
|
-
|
|
917
|
-
|
|
936
|
+
/** @private */
|
|
937
|
+
__updateChipsHorizontalExpand(items, inputWidth) {
|
|
938
|
+
// Add all chips to make the field fully expand
|
|
939
|
+
const chips = items.map((item) => {
|
|
940
|
+
const chip = this.__createChip(item);
|
|
941
|
+
this.appendChild(chip);
|
|
942
|
+
return chip;
|
|
943
|
+
});
|
|
944
|
+
|
|
945
|
+
if (this.__getWrapperWidth() - this.$.chips.clientWidth >= inputWidth) {
|
|
946
|
+
return [];
|
|
918
947
|
}
|
|
919
948
|
|
|
920
|
-
|
|
949
|
+
// Remove chips from the end until there is enough width for the input element to fit,
|
|
950
|
+
// keeping at least one chip visible
|
|
951
|
+
const overflowWidth = this.__getOverflowWidth();
|
|
952
|
+
let visibleCount = chips.length;
|
|
921
953
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
this.insertBefore(chip, refNode);
|
|
929
|
-
refNode = chip;
|
|
930
|
-
chips.unshift(chip);
|
|
954
|
+
while (visibleCount > 1) {
|
|
955
|
+
visibleCount -= 1;
|
|
956
|
+
chips[visibleCount].remove();
|
|
957
|
+
|
|
958
|
+
if (this.__getWrapperWidth() - this.$.chips.clientWidth >= inputWidth + overflowWidth) {
|
|
959
|
+
break;
|
|
931
960
|
}
|
|
961
|
+
}
|
|
932
962
|
|
|
933
|
-
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
// Always show at least last item as a chip
|
|
939
|
-
while (chips.length > 1) {
|
|
940
|
-
const lastChip = chips.pop();
|
|
941
|
-
lastChip.remove();
|
|
942
|
-
overflowItems.unshift(items.pop());
|
|
943
|
-
|
|
944
|
-
// Remove chips until there is enough width for the input element to fit
|
|
945
|
-
const neededWidth = overflowItems.length > 0 ? inputWidth + this.__getOverflowWidth() : inputWidth;
|
|
946
|
-
if (this._inputField.$.wrapper.clientWidth - this.$.chips.clientWidth >= neededWidth) {
|
|
947
|
-
break;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
963
|
+
if (visibleCount === 1) {
|
|
964
|
+
const chipMinWidth = parseInt(getComputedStyle(this).getPropertyValue('--_chip-min-width'));
|
|
965
|
+
const remainingWidth = this.__getWrapperWidth() - inputWidth - overflowWidth;
|
|
966
|
+
chips[0].style.maxWidth = `${Math.max(chipMinWidth, remainingWidth)}px`;
|
|
967
|
+
}
|
|
950
968
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
}
|
|
954
|
-
}
|
|
969
|
+
return items.slice(visibleCount);
|
|
970
|
+
}
|
|
955
971
|
|
|
956
|
-
|
|
957
|
-
|
|
972
|
+
/** @private */
|
|
973
|
+
__updateChipsDefault(items, inputWidth) {
|
|
974
|
+
let remainingWidth = this.__getWrapperWidth() - inputWidth;
|
|
975
|
+
|
|
976
|
+
if (items.length > 1) {
|
|
977
|
+
remainingWidth -= this.__getOverflowWidth();
|
|
958
978
|
}
|
|
959
979
|
|
|
960
|
-
|
|
980
|
+
const chipMinWidth = parseInt(getComputedStyle(this).getPropertyValue('--_chip-min-width'));
|
|
981
|
+
|
|
982
|
+
// Add chips from the end until remaining width is exceeded
|
|
961
983
|
for (let i = items.length - 1, refNode = null; i >= 0; i--) {
|
|
962
984
|
const chip = this.__createChip(items[i]);
|
|
963
985
|
this.insertBefore(chip, refNode);
|
|
964
986
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
chip.remove();
|
|
972
|
-
break;
|
|
973
|
-
}
|
|
987
|
+
if (this.$.chips.clientWidth > remainingWidth) {
|
|
988
|
+
// If there is no more space for chips, or if there is at least one
|
|
989
|
+
// chip already shown, collapse all remaining chips to the overflow
|
|
990
|
+
if (remainingWidth < chipMinWidth || refNode !== null) {
|
|
991
|
+
chip.remove();
|
|
992
|
+
return items.slice(0, i + 1);
|
|
974
993
|
}
|
|
975
|
-
|
|
976
|
-
chip.style.maxWidth = `${remainingWidth}px`;
|
|
977
994
|
}
|
|
978
995
|
|
|
979
|
-
|
|
996
|
+
chip.style.maxWidth = `${remainingWidth}px`;
|
|
980
997
|
refNode = chip;
|
|
981
998
|
}
|
|
982
999
|
|
|
983
|
-
|
|
1000
|
+
return [];
|
|
984
1001
|
}
|
|
985
1002
|
|
|
986
1003
|
/** @private */
|
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": "25.1.0-
|
|
4
|
+
"version": "25.1.0-beta3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -147,7 +147,9 @@
|
|
|
147
147
|
"description": "Filtering string the user has typed into the input field.",
|
|
148
148
|
"value": {
|
|
149
149
|
"type": [
|
|
150
|
-
"string"
|
|
150
|
+
"string",
|
|
151
|
+
"null",
|
|
152
|
+
"undefined"
|
|
151
153
|
]
|
|
152
154
|
}
|
|
153
155
|
},
|
|
@@ -162,6 +164,17 @@
|
|
|
162
164
|
]
|
|
163
165
|
}
|
|
164
166
|
},
|
|
167
|
+
{
|
|
168
|
+
"name": "i18n",
|
|
169
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
|
|
170
|
+
"value": {
|
|
171
|
+
"type": [
|
|
172
|
+
"Object",
|
|
173
|
+
"null",
|
|
174
|
+
"undefined"
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
},
|
|
165
178
|
{
|
|
166
179
|
"name": "invalid",
|
|
167
180
|
"description": "Set to true when the field is invalid.",
|
|
@@ -189,7 +202,9 @@
|
|
|
189
202
|
"description": "Path for label of the item. If `items` is an array of objects, the\n`itemLabelPath` is used to fetch the displayed string label for each\nitem.\n\nThe item label is also used for matching items when processing user\ninput, i.e., for filtering and selecting items.",
|
|
190
203
|
"value": {
|
|
191
204
|
"type": [
|
|
192
|
-
"string"
|
|
205
|
+
"string",
|
|
206
|
+
"null",
|
|
207
|
+
"undefined"
|
|
193
208
|
]
|
|
194
209
|
}
|
|
195
210
|
},
|
|
@@ -198,7 +213,9 @@
|
|
|
198
213
|
"description": "Path for the value of the item. If `items` is an array of objects, the\n`itemValuePath:` is used to fetch the string value for the selected\nitem.\n\nThe item value is used in the `value` property of the combo box,\nto provide the form value.",
|
|
199
214
|
"value": {
|
|
200
215
|
"type": [
|
|
201
|
-
"string"
|
|
216
|
+
"string",
|
|
217
|
+
"null",
|
|
218
|
+
"undefined"
|
|
202
219
|
]
|
|
203
220
|
}
|
|
204
221
|
},
|
|
@@ -262,7 +279,9 @@
|
|
|
262
279
|
"description": "True if the dropdown is open, false otherwise.",
|
|
263
280
|
"value": {
|
|
264
281
|
"type": [
|
|
265
|
-
"boolean"
|
|
282
|
+
"boolean",
|
|
283
|
+
"null",
|
|
284
|
+
"undefined"
|
|
266
285
|
]
|
|
267
286
|
}
|
|
268
287
|
},
|
|
@@ -271,7 +290,9 @@
|
|
|
271
290
|
"description": "Number of items fetched at a time from the dataprovider.",
|
|
272
291
|
"value": {
|
|
273
292
|
"type": [
|
|
274
|
-
"number"
|
|
293
|
+
"number",
|
|
294
|
+
"null",
|
|
295
|
+
"undefined"
|
|
275
296
|
]
|
|
276
297
|
}
|
|
277
298
|
},
|
|
@@ -325,6 +346,7 @@
|
|
|
325
346
|
"value": {
|
|
326
347
|
"type": [
|
|
327
348
|
"number",
|
|
349
|
+
"null",
|
|
328
350
|
"undefined"
|
|
329
351
|
]
|
|
330
352
|
}
|
|
@@ -512,7 +534,9 @@
|
|
|
512
534
|
"description": "Filtering string the user has typed into the input field.",
|
|
513
535
|
"value": {
|
|
514
536
|
"type": [
|
|
515
|
-
"string"
|
|
537
|
+
"string",
|
|
538
|
+
"null",
|
|
539
|
+
"undefined"
|
|
516
540
|
]
|
|
517
541
|
}
|
|
518
542
|
},
|
|
@@ -543,7 +567,7 @@
|
|
|
543
567
|
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n```js\n{\n // Screen reader announcement on clear button click.\n cleared: 'Selection cleared',\n // Screen reader announcement when a chip is focused.\n focused: ' focused. Press Backspace to remove',\n // Screen reader announcement when item is selected.\n selected: 'added to selection',\n // Screen reader announcement when item is deselected.\n deselected: 'removed from selection',\n // Screen reader announcement of the selected items count.\n // {count} is replaced with the actual count of items.\n total: '{count} items selected',\n}\n```",
|
|
544
568
|
"value": {
|
|
545
569
|
"type": [
|
|
546
|
-
"
|
|
570
|
+
"?"
|
|
547
571
|
]
|
|
548
572
|
}
|
|
549
573
|
},
|
|
@@ -596,7 +620,9 @@
|
|
|
596
620
|
"description": "Path for label of the item. If `items` is an array of objects, the\n`itemLabelPath` is used to fetch the displayed string label for each\nitem.\n\nThe item label is also used for matching items when processing user\ninput, i.e., for filtering and selecting items.",
|
|
597
621
|
"value": {
|
|
598
622
|
"type": [
|
|
599
|
-
"string"
|
|
623
|
+
"string",
|
|
624
|
+
"null",
|
|
625
|
+
"undefined"
|
|
600
626
|
]
|
|
601
627
|
}
|
|
602
628
|
},
|
|
@@ -616,7 +642,9 @@
|
|
|
616
642
|
"description": "Path for the value of the item. If `items` is an array of objects, the\n`itemValuePath:` is used to fetch the string value for the selected\nitem.\n\nThe item value is used in the `value` property of the combo box,\nto provide the form value.",
|
|
617
643
|
"value": {
|
|
618
644
|
"type": [
|
|
619
|
-
"string"
|
|
645
|
+
"string",
|
|
646
|
+
"null",
|
|
647
|
+
"undefined"
|
|
620
648
|
]
|
|
621
649
|
}
|
|
622
650
|
},
|
|
@@ -680,7 +708,9 @@
|
|
|
680
708
|
"description": "True if the dropdown is open, false otherwise.",
|
|
681
709
|
"value": {
|
|
682
710
|
"type": [
|
|
683
|
-
"boolean"
|
|
711
|
+
"boolean",
|
|
712
|
+
"null",
|
|
713
|
+
"undefined"
|
|
684
714
|
]
|
|
685
715
|
}
|
|
686
716
|
},
|
|
@@ -689,7 +719,9 @@
|
|
|
689
719
|
"description": "Number of items fetched at a time from the dataprovider.",
|
|
690
720
|
"value": {
|
|
691
721
|
"type": [
|
|
692
|
-
"number"
|
|
722
|
+
"number",
|
|
723
|
+
"null",
|
|
724
|
+
"undefined"
|
|
693
725
|
]
|
|
694
726
|
}
|
|
695
727
|
},
|
|
@@ -765,6 +797,7 @@
|
|
|
765
797
|
"value": {
|
|
766
798
|
"type": [
|
|
767
799
|
"number",
|
|
800
|
+
"null",
|
|
768
801
|
"undefined"
|
|
769
802
|
]
|
|
770
803
|
}
|
package/web-types.lit.json
CHANGED