@vaadin/multi-select-combo-box 24.3.0-alpha7 → 24.3.0-alpha9
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 +13 -13
- package/src/vaadin-multi-select-combo-box-internal.js +10 -13
- package/src/vaadin-multi-select-combo-box.d.ts +1 -0
- package/src/vaadin-multi-select-combo-box.js +11 -2
- package/theme/lumo/vaadin-multi-select-combo-box-styles.js +4 -0
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/multi-select-combo-box",
|
|
3
|
-
"version": "24.3.0-
|
|
3
|
+
"version": "24.3.0-alpha9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/a11y-base": "24.3.0-
|
|
41
|
-
"@vaadin/combo-box": "24.3.0-
|
|
42
|
-
"@vaadin/component-base": "24.3.0-
|
|
43
|
-
"@vaadin/field-base": "24.3.0-
|
|
44
|
-
"@vaadin/input-container": "24.3.0-
|
|
45
|
-
"@vaadin/item": "24.3.0-
|
|
46
|
-
"@vaadin/lit-renderer": "24.3.0-
|
|
47
|
-
"@vaadin/overlay": "24.3.0-
|
|
48
|
-
"@vaadin/vaadin-lumo-styles": "24.3.0-
|
|
49
|
-
"@vaadin/vaadin-material-styles": "24.3.0-
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "24.3.0-
|
|
40
|
+
"@vaadin/a11y-base": "24.3.0-alpha9",
|
|
41
|
+
"@vaadin/combo-box": "24.3.0-alpha9",
|
|
42
|
+
"@vaadin/component-base": "24.3.0-alpha9",
|
|
43
|
+
"@vaadin/field-base": "24.3.0-alpha9",
|
|
44
|
+
"@vaadin/input-container": "24.3.0-alpha9",
|
|
45
|
+
"@vaadin/item": "24.3.0-alpha9",
|
|
46
|
+
"@vaadin/lit-renderer": "24.3.0-alpha9",
|
|
47
|
+
"@vaadin/overlay": "24.3.0-alpha9",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "24.3.0-alpha9",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "24.3.0-alpha9",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "24.3.0-alpha9"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "ea39f40613cb73b237d08d4c48b890ee7d1844cb"
|
|
63
63
|
}
|
|
@@ -165,25 +165,22 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
165
165
|
* @override
|
|
166
166
|
*/
|
|
167
167
|
_setDropdownItems(items) {
|
|
168
|
-
if (this.readonly || !this.groupSelectedItems) {
|
|
168
|
+
if (this.filter || this.readonly || !this.groupSelectedItems) {
|
|
169
169
|
this._dropdownItems = items;
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
if (this.topGroup) {
|
|
174
|
-
|
|
175
|
-
const filteredItems =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (this.topGroup.some((selectedItem) => this._getItemValue(item) === this._getItemValue(selectedItem))) {
|
|
179
|
-
filteredTopItems.push(item);
|
|
180
|
-
} else {
|
|
181
|
-
filteredItems.push(item);
|
|
182
|
-
}
|
|
183
|
-
});
|
|
173
|
+
if (items && items.length && this.topGroup && this.topGroup.length) {
|
|
174
|
+
// Filter out items included to the top group.
|
|
175
|
+
const filteredItems = items.filter(
|
|
176
|
+
(item) => !this.topGroup.some((selectedItem) => this._getItemValue(item) === this._getItemValue(selectedItem)),
|
|
177
|
+
);
|
|
184
178
|
|
|
185
|
-
this._dropdownItems =
|
|
179
|
+
this._dropdownItems = this.topGroup.concat(filteredItems);
|
|
180
|
+
return;
|
|
186
181
|
}
|
|
182
|
+
|
|
183
|
+
this._dropdownItems = items;
|
|
187
184
|
}
|
|
188
185
|
|
|
189
186
|
/** @private */
|
|
@@ -146,6 +146,7 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
|
|
|
146
146
|
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
147
147
|
* `--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`
|
|
148
148
|
* `--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
|
|
149
|
+
* `--vaadin-multi-select-combo-box-chip-min-width` | Min width of the chip | `50px`
|
|
149
150
|
* `--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`
|
|
150
151
|
*
|
|
151
152
|
* ### Internal components
|
|
@@ -23,6 +23,7 @@ import { css, registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixi
|
|
|
23
23
|
const multiSelectComboBox = css`
|
|
24
24
|
:host {
|
|
25
25
|
--input-min-width: var(--vaadin-multi-select-combo-box-input-min-width, 4em);
|
|
26
|
+
--_chip-min-width: var(--vaadin-multi-select-combo-box-chip-min-width, 50px);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
#chips {
|
|
@@ -111,6 +112,7 @@ registerStyles('vaadin-multi-select-combo-box', [inputFieldShared, multiSelectCo
|
|
|
111
112
|
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
112
113
|
* `--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`
|
|
113
114
|
* `--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
|
|
115
|
+
* `--vaadin-multi-select-combo-box-chip-min-width` | Min width of the chip | `50px`
|
|
114
116
|
* `--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`
|
|
115
117
|
*
|
|
116
118
|
* ### Internal components
|
|
@@ -942,6 +944,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
942
944
|
remainingWidth -= this.__getOverflowWidth();
|
|
943
945
|
}
|
|
944
946
|
|
|
947
|
+
const chipMinWidth = parseInt(getComputedStyle(this).getPropertyValue('--_chip-min-width'));
|
|
948
|
+
|
|
945
949
|
// Add chips until remaining width is exceeded
|
|
946
950
|
for (let i = items.length - 1, refNode = null; i >= 0; i--) {
|
|
947
951
|
const chip = this.__createChip(items[i]);
|
|
@@ -949,8 +953,13 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
949
953
|
|
|
950
954
|
// If all the chips are visible, no need to measure remaining width
|
|
951
955
|
if (!this.allChipsVisible && this.$.chips.clientWidth > remainingWidth) {
|
|
952
|
-
chip
|
|
953
|
-
|
|
956
|
+
// Always show at least last selected item as a chip
|
|
957
|
+
if (refNode === null) {
|
|
958
|
+
chip.style.maxWidth = `${Math.max(chipMinWidth, remainingWidth)}px`;
|
|
959
|
+
} else {
|
|
960
|
+
chip.remove();
|
|
961
|
+
break;
|
|
962
|
+
}
|
|
954
963
|
}
|
|
955
964
|
|
|
956
965
|
items.pop();
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/multi-select-combo-box",
|
|
4
|
-
"version": "24.3.0-
|
|
4
|
+
"version": "24.3.0-alpha9",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-multi-select-combo-box",
|
|
11
|
-
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps slotted chips for selected items\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------------|-----------------\n`disabled` | Set to a disabled element\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`loading` | Set when loading items from the data provider\n`opened` | Set when the dropdown is open\n`readonly` | Set to a readonly element\n\nThe following custom CSS properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------------------|----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n`--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`\n\n### Internal components\n\nIn addition to `<vaadin-multi-select-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.\n- `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.\n- `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.\n\nNote: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is\npropagated to these components.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
11
|
+
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps slotted chips for selected items\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------------|-----------------\n`disabled` | Set to a disabled element\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`loading` | Set when loading items from the data provider\n`opened` | Set when the dropdown is open\n`readonly` | Set to a readonly element\n\nThe following custom CSS properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------------------|----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n`--vaadin-multi-select-combo-box-chip-min-width` | Min width of the chip | `50px`\n`--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`\n\n### Internal components\n\nIn addition to `<vaadin-multi-select-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.\n- `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.\n- `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.\n\nNote: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is\npropagated to these components.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
package/web-types.lit.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.3.0-
|
|
4
|
+
"version": "24.3.0-alpha9",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-multi-select-combo-box",
|
|
19
|
-
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps slotted chips for selected items\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------------|-----------------\n`disabled` | Set to a disabled element\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`loading` | Set when loading items from the data provider\n`opened` | Set when the dropdown is open\n`readonly` | Set to a readonly element\n\nThe following custom CSS properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------------------|----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n`--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`\n\n### Internal components\n\nIn addition to `<vaadin-multi-select-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.\n- `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.\n- `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.\n\nNote: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is\npropagated to these components.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
19
|
+
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps slotted chips for selected items\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------------|-----------------\n`disabled` | Set to a disabled element\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`loading` | Set when loading items from the data provider\n`opened` | Set when the dropdown is open\n`readonly` | Set to a readonly element\n\nThe following custom CSS properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------------------|----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n`--vaadin-multi-select-combo-box-chip-min-width` | Min width of the chip | `50px`\n`--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`\n\n### Internal components\n\nIn addition to `<vaadin-multi-select-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.\n- `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.\n- `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.\n\nNote: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is\npropagated to these components.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|