@vaadin/multi-select-combo-box 24.6.0-alpha9 → 24.6.0-beta1
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 +16 -15
- package/src/vaadin-lit-multi-select-combo-box-chip.js +79 -0
- package/src/vaadin-lit-multi-select-combo-box-container.js +66 -0
- package/src/vaadin-lit-multi-select-combo-box-internal.js +56 -0
- package/src/vaadin-lit-multi-select-combo-box-item.js +50 -0
- package/src/vaadin-lit-multi-select-combo-box-overlay.js +64 -0
- package/src/vaadin-lit-multi-select-combo-box-scroller.js +96 -0
- package/src/vaadin-lit-multi-select-combo-box.d.ts +1 -0
- package/src/vaadin-lit-multi-select-combo-box.js +146 -0
- package/src/vaadin-multi-select-combo-box-chip.js +6 -27
- package/src/vaadin-multi-select-combo-box-internal-mixin.js +425 -0
- package/src/vaadin-multi-select-combo-box-internal.js +3 -399
- package/src/vaadin-multi-select-combo-box-mixin.d.ts +253 -0
- package/src/vaadin-multi-select-combo-box-mixin.js +1150 -0
- package/src/vaadin-multi-select-combo-box-styles.d.ts +10 -0
- package/src/vaadin-multi-select-combo-box-styles.js +73 -0
- package/src/vaadin-multi-select-combo-box.d.ts +5 -213
- package/src/vaadin-multi-select-combo-box.js +5 -1139
- package/theme/lumo/vaadin-lit-multi-select-combo-box.d.ts +3 -0
- package/theme/lumo/vaadin-lit-multi-select-combo-box.js +3 -0
- package/theme/material/vaadin-lit-multi-select-combo-box.d.ts +3 -0
- package/theme/material/vaadin-lit-multi-select-combo-box.js +3 -0
- package/vaadin-lit-multi-select-combo-box.d.ts +1 -0
- package/vaadin-lit-multi-select-combo-box.js +2 -0
- package/web-types.json +5 -5
- package/web-types.lit.json +8 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/multi-select-combo-box",
|
|
3
|
-
"version": "24.6.0-
|
|
3
|
+
"version": "24.6.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,28 +37,29 @@
|
|
|
37
37
|
"polymer"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
41
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/a11y-base": "24.6.0-
|
|
42
|
-
"@vaadin/combo-box": "24.6.0-
|
|
43
|
-
"@vaadin/component-base": "24.6.0-
|
|
44
|
-
"@vaadin/field-base": "24.6.0-
|
|
45
|
-
"@vaadin/input-container": "24.6.0-
|
|
46
|
-
"@vaadin/item": "24.6.0-
|
|
47
|
-
"@vaadin/lit-renderer": "24.6.0-
|
|
48
|
-
"@vaadin/overlay": "24.6.0-
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "24.6.0-
|
|
50
|
-
"@vaadin/vaadin-material-styles": "24.6.0-
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "24.6.0-
|
|
42
|
+
"@vaadin/a11y-base": "24.6.0-beta1",
|
|
43
|
+
"@vaadin/combo-box": "24.6.0-beta1",
|
|
44
|
+
"@vaadin/component-base": "24.6.0-beta1",
|
|
45
|
+
"@vaadin/field-base": "24.6.0-beta1",
|
|
46
|
+
"@vaadin/input-container": "24.6.0-beta1",
|
|
47
|
+
"@vaadin/item": "24.6.0-beta1",
|
|
48
|
+
"@vaadin/lit-renderer": "24.6.0-beta1",
|
|
49
|
+
"@vaadin/overlay": "24.6.0-beta1",
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "24.6.0-beta1",
|
|
51
|
+
"@vaadin/vaadin-material-styles": "24.6.0-beta1",
|
|
52
|
+
"@vaadin/vaadin-themable-mixin": "24.6.0-beta1",
|
|
53
|
+
"lit": "^3.0.0"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"@vaadin/chai-plugins": "24.6.0-
|
|
56
|
+
"@vaadin/chai-plugins": "24.6.0-beta1",
|
|
55
57
|
"@vaadin/testing-helpers": "^1.0.0",
|
|
56
|
-
"lit": "^3.0.0",
|
|
57
58
|
"sinon": "^18.0.0"
|
|
58
59
|
},
|
|
59
60
|
"web-types": [
|
|
60
61
|
"web-types.json",
|
|
61
62
|
"web-types.lit.json"
|
|
62
63
|
],
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "ab28efb0dcf2cd1ef72100e2e8f32232fa49aacc"
|
|
64
65
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
+
import { multiSelectComboBoxChip } from './vaadin-multi-select-combo-box-styles.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* LitElement based version of `<vaadin-multi-select-combo-box-chip>` web component.
|
|
14
|
+
*
|
|
15
|
+
* ## Disclaimer
|
|
16
|
+
*
|
|
17
|
+
* This component is an experiment and not yet a part of Vaadin platform.
|
|
18
|
+
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
19
|
+
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
20
|
+
*/
|
|
21
|
+
class MultiSelectComboBoxChip extends ThemableMixin(PolylitMixin(LitElement)) {
|
|
22
|
+
static get is() {
|
|
23
|
+
return 'vaadin-multi-select-combo-box-chip';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static get styles() {
|
|
27
|
+
return multiSelectComboBoxChip;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static get properties() {
|
|
31
|
+
return {
|
|
32
|
+
disabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
reflectToAttribute: true,
|
|
35
|
+
sync: true,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
readonly: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
reflectToAttribute: true,
|
|
41
|
+
sync: true,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
label: {
|
|
45
|
+
type: String,
|
|
46
|
+
sync: true,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
item: {
|
|
50
|
+
type: Object,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @protected */
|
|
56
|
+
render() {
|
|
57
|
+
return html`
|
|
58
|
+
<div part="label">${this.label}</div>
|
|
59
|
+
<div part="remove-button" @click="${this._onRemoveClick}"></div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @private */
|
|
64
|
+
_onRemoveClick(event) {
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
|
|
67
|
+
this.dispatchEvent(
|
|
68
|
+
new CustomEvent('item-removed', {
|
|
69
|
+
detail: {
|
|
70
|
+
item: this.item,
|
|
71
|
+
},
|
|
72
|
+
bubbles: true,
|
|
73
|
+
composed: true,
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
defineCustomElement(MultiSelectComboBoxChip);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css, html } from 'lit';
|
|
7
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
+
import { InputContainer } from '@vaadin/input-container/src/vaadin-lit-input-container.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
|
|
12
|
+
*
|
|
13
|
+
* @customElement
|
|
14
|
+
* @extends InputContainer
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
class MultiSelectComboBoxContainer extends InputContainer {
|
|
18
|
+
static get is() {
|
|
19
|
+
return 'vaadin-multi-select-combo-box-container';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static get styles() {
|
|
23
|
+
return [
|
|
24
|
+
super.styles,
|
|
25
|
+
css`
|
|
26
|
+
#wrapper {
|
|
27
|
+
display: flex;
|
|
28
|
+
width: 100%;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([auto-expand-vertically]) #wrapper {
|
|
33
|
+
flex-wrap: wrap;
|
|
34
|
+
}
|
|
35
|
+
`,
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static get properties() {
|
|
40
|
+
return {
|
|
41
|
+
/**
|
|
42
|
+
* Set to true to not collapse selected items chips into the overflow
|
|
43
|
+
* chip and instead always expand vertically, causing input field to
|
|
44
|
+
* wrap into multiple lines when width is limited.
|
|
45
|
+
* @attr {boolean} auto-expand-vertically
|
|
46
|
+
*/
|
|
47
|
+
autoExpandVertically: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
reflectToAttribute: true,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @protected */
|
|
55
|
+
render() {
|
|
56
|
+
return html`
|
|
57
|
+
<div id="wrapper">
|
|
58
|
+
<slot name="prefix"></slot>
|
|
59
|
+
<slot></slot>
|
|
60
|
+
</div>
|
|
61
|
+
<slot name="suffix"></slot>
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
defineCustomElement(MultiSelectComboBoxContainer);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import './vaadin-lit-multi-select-combo-box-item.js';
|
|
7
|
+
import './vaadin-lit-multi-select-combo-box-overlay.js';
|
|
8
|
+
import './vaadin-lit-multi-select-combo-box-scroller.js';
|
|
9
|
+
import { css, html, LitElement } from 'lit';
|
|
10
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
12
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
+
import { MultiSelectComboBoxInternalMixin } from './vaadin-multi-select-combo-box-internal-mixin.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
|
|
18
|
+
*
|
|
19
|
+
* @customElement
|
|
20
|
+
* @extends HTMLElement
|
|
21
|
+
* @mixes MultiSelectComboBoxInternalMixin
|
|
22
|
+
* @mixes ThemableMixin
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
class MultiSelectComboBoxInternal extends MultiSelectComboBoxInternalMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
26
|
+
static get is() {
|
|
27
|
+
return 'vaadin-multi-select-combo-box-internal';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static get styles() {
|
|
31
|
+
return css`
|
|
32
|
+
:host([opened]) {
|
|
33
|
+
pointer-events: auto;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @protected */
|
|
39
|
+
render() {
|
|
40
|
+
return html`
|
|
41
|
+
<slot></slot>
|
|
42
|
+
|
|
43
|
+
<vaadin-multi-select-combo-box-overlay
|
|
44
|
+
id="overlay"
|
|
45
|
+
.opened="${this._overlayOpened}"
|
|
46
|
+
?loading="${this.loading}"
|
|
47
|
+
theme="${ifDefined(this._theme)}"
|
|
48
|
+
.positionTarget="${this._target}"
|
|
49
|
+
no-vertical-overlap
|
|
50
|
+
.restoreFocusNode="${this.inputElement}"
|
|
51
|
+
></vaadin-multi-select-combo-box-overlay>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
defineCustomElement(MultiSelectComboBoxInternal);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
|
+
import { ComboBoxItemMixin } from '@vaadin/combo-box/src/vaadin-combo-box-item-mixin.js';
|
|
8
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* LitElement based version of `<vaadin-multi-select-combo-box-item>` web component.
|
|
15
|
+
*
|
|
16
|
+
* ## Disclaimer
|
|
17
|
+
*
|
|
18
|
+
* This component is an experiment and not yet a part of Vaadin platform.
|
|
19
|
+
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
20
|
+
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
21
|
+
*/
|
|
22
|
+
export class MultiSelectComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
23
|
+
static get is() {
|
|
24
|
+
return 'vaadin-multi-select-combo-box-item';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static get styles() {
|
|
28
|
+
return css`
|
|
29
|
+
:host {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([hidden]) {
|
|
34
|
+
display: none !important;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** @protected */
|
|
40
|
+
render() {
|
|
41
|
+
return html`
|
|
42
|
+
<span part="checkmark" aria-hidden="true"></span>
|
|
43
|
+
<div part="content">
|
|
44
|
+
<slot></slot>
|
|
45
|
+
</div>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
defineCustomElement(MultiSelectComboBoxItem);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
|
+
import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
|
|
8
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
+
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
12
|
+
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
13
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
+
|
|
15
|
+
const multiSelectComboBoxOverlayStyles = css`
|
|
16
|
+
#overlay {
|
|
17
|
+
width: var(
|
|
18
|
+
--vaadin-multi-select-combo-box-overlay-width,
|
|
19
|
+
var(--_vaadin-multi-select-combo-box-overlay-default-width, auto)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[part='content'] {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
height: 100%;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
|
|
32
|
+
*
|
|
33
|
+
* @customElement
|
|
34
|
+
* @extends HTMLElement
|
|
35
|
+
* @mixes ComboBoxOverlayMixin
|
|
36
|
+
* @mixes DirMixin
|
|
37
|
+
* @mixes OverlayMixin
|
|
38
|
+
* @mixes ThemableMixin
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
class MultiSelectComboBoxOverlay extends ComboBoxOverlayMixin(
|
|
42
|
+
OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
|
|
43
|
+
) {
|
|
44
|
+
static get is() {
|
|
45
|
+
return 'vaadin-multi-select-combo-box-overlay';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static get styles() {
|
|
49
|
+
return [overlayStyles, multiSelectComboBoxOverlayStyles];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @protected */
|
|
53
|
+
render() {
|
|
54
|
+
return html`
|
|
55
|
+
<div id="backdrop" part="backdrop" hidden></div>
|
|
56
|
+
<div part="overlay" id="overlay">
|
|
57
|
+
<div part="loader"></div>
|
|
58
|
+
<div part="content" id="content"><slot></slot></div>
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
defineCustomElement(MultiSelectComboBoxOverlay);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
|
+
import { ComboBoxPlaceholder } from '@vaadin/combo-box/src/vaadin-combo-box-placeholder.js';
|
|
8
|
+
import { ComboBoxScrollerMixin } from '@vaadin/combo-box/src/vaadin-combo-box-scroller-mixin.js';
|
|
9
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
|
|
14
|
+
*
|
|
15
|
+
* @customElement
|
|
16
|
+
* @extends HTMLElement
|
|
17
|
+
* @mixes ComboBoxScrollerMixin
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
export class MultiSelectComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElement)) {
|
|
21
|
+
static get is() {
|
|
22
|
+
return 'vaadin-multi-select-combo-box-scroller';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static get styles() {
|
|
26
|
+
return css`
|
|
27
|
+
:host {
|
|
28
|
+
display: block;
|
|
29
|
+
min-height: 1px;
|
|
30
|
+
overflow: auto;
|
|
31
|
+
|
|
32
|
+
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
33
|
+
transform: translate3d(0, 0, 0);
|
|
34
|
+
|
|
35
|
+
/* Enable momentum scrolling on iOS */
|
|
36
|
+
-webkit-overflow-scrolling: touch;
|
|
37
|
+
|
|
38
|
+
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
39
|
+
box-shadow: 0 0 0 white;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#selector {
|
|
43
|
+
border-width: var(--_vaadin-multi-select-combo-box-items-container-border-width);
|
|
44
|
+
border-style: var(--_vaadin-multi-select-combo-box-items-container-border-style);
|
|
45
|
+
border-color: var(--_vaadin-multi-select-combo-box-items-container-border-color, transparent);
|
|
46
|
+
position: relative;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @protected */
|
|
52
|
+
render() {
|
|
53
|
+
return html`
|
|
54
|
+
<div id="selector">
|
|
55
|
+
<slot></slot>
|
|
56
|
+
</div>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @protected */
|
|
61
|
+
ready() {
|
|
62
|
+
super.ready();
|
|
63
|
+
|
|
64
|
+
this.setAttribute('aria-multiselectable', 'true');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @protected
|
|
69
|
+
* @override
|
|
70
|
+
*/
|
|
71
|
+
_isItemSelected(item, _selectedItem, itemIdPath) {
|
|
72
|
+
if (item instanceof ComboBoxPlaceholder) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (this.owner.readonly) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return this.owner._findIndex(item, this.owner.selectedItems, itemIdPath) > -1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {HTMLElement} el
|
|
85
|
+
* @param {number} index
|
|
86
|
+
* @protected
|
|
87
|
+
* @override
|
|
88
|
+
*/
|
|
89
|
+
_updateElement(el, index) {
|
|
90
|
+
super._updateElement(el, index);
|
|
91
|
+
|
|
92
|
+
el.toggleAttribute('readonly', this.owner.readonly);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
defineCustomElement(MultiSelectComboBoxScroller);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vaadin-multi-select-combo-box.js';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import './vaadin-lit-multi-select-combo-box-chip.js';
|
|
7
|
+
import './vaadin-lit-multi-select-combo-box-container.js';
|
|
8
|
+
import './vaadin-lit-multi-select-combo-box-internal.js';
|
|
9
|
+
import { html, LitElement } from 'lit';
|
|
10
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
|
+
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
12
|
+
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
13
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
14
|
+
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
15
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
16
|
+
import { MultiSelectComboBoxMixin } from './vaadin-multi-select-combo-box-mixin.js';
|
|
17
|
+
import { multiSelectComboBox } from './vaadin-multi-select-combo-box-styles.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* LitElement based version of `<vaadin-multi-select-combo-box>` web component.
|
|
21
|
+
*
|
|
22
|
+
* ## Disclaimer
|
|
23
|
+
*
|
|
24
|
+
* This component is an experiment and not yet a part of Vaadin platform.
|
|
25
|
+
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
26
|
+
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
27
|
+
*/
|
|
28
|
+
class MultiSelectComboBox extends MultiSelectComboBoxMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
29
|
+
static get is() {
|
|
30
|
+
return 'vaadin-multi-select-combo-box';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static get styles() {
|
|
34
|
+
return [inputFieldShared, multiSelectComboBox];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @protected */
|
|
38
|
+
render() {
|
|
39
|
+
return html`
|
|
40
|
+
<div class="vaadin-multi-select-combo-box-container">
|
|
41
|
+
<div part="label">
|
|
42
|
+
<slot name="label"></slot>
|
|
43
|
+
<span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<vaadin-multi-select-combo-box-internal
|
|
47
|
+
id="comboBox"
|
|
48
|
+
.filteredItems="${this.filteredItems}"
|
|
49
|
+
.items="${this.items}"
|
|
50
|
+
.itemIdPath="${this.itemIdPath}"
|
|
51
|
+
.itemLabelPath="${this.itemLabelPath}"
|
|
52
|
+
.itemValuePath="${this.itemValuePath}"
|
|
53
|
+
.disabled="${this.disabled}"
|
|
54
|
+
.readonly="${this.readonly}"
|
|
55
|
+
.autoOpenDisabled="${this.autoOpenDisabled}"
|
|
56
|
+
.allowCustomValue="${this.allowCustomValue}"
|
|
57
|
+
.overlayClass="${this.overlayClass}"
|
|
58
|
+
.dataProvider="${this.dataProvider}"
|
|
59
|
+
.filter="${this.filter}"
|
|
60
|
+
.lastFilter="${this._lastFilter}"
|
|
61
|
+
.loading="${this.loading}"
|
|
62
|
+
.size="${this.size}"
|
|
63
|
+
.selectedItems="${this.selectedItems}"
|
|
64
|
+
.selectedItemsOnTop="${this.selectedItemsOnTop}"
|
|
65
|
+
.itemClassNameGenerator="${this.itemClassNameGenerator}"
|
|
66
|
+
.topGroup="${this._topGroup}"
|
|
67
|
+
.opened="${this.opened}"
|
|
68
|
+
.renderer="${this.renderer}"
|
|
69
|
+
.keepFilter="${this.keepFilter}"
|
|
70
|
+
theme="${ifDefined(this._theme)}"
|
|
71
|
+
@combo-box-item-selected="${this._onComboBoxItemSelected}"
|
|
72
|
+
@change="${this._onComboBoxChange}"
|
|
73
|
+
@custom-value-set="${this._onCustomValueSet}"
|
|
74
|
+
@filtered-items-changed="${this._onFilteredItemsChanged}"
|
|
75
|
+
@filter-changed="${this._onComboBoxFilterChanged}"
|
|
76
|
+
@last-filter-changed="${this._onComboBoxLastFilterChanged}"
|
|
77
|
+
@loading-changed="${this._onComboBoxLoadingChanged}"
|
|
78
|
+
@opened-changed="${this._onComboBoxOpenedChanged}"
|
|
79
|
+
@size-changed="${this._onComboBoxSizeChanged}"
|
|
80
|
+
>
|
|
81
|
+
<vaadin-multi-select-combo-box-container
|
|
82
|
+
part="input-field"
|
|
83
|
+
.autoExpandVertically="${this.autoExpandVertically}"
|
|
84
|
+
.readonly="${this.readonly}"
|
|
85
|
+
.disabled="${this.disabled}"
|
|
86
|
+
.invalid="${this.invalid}"
|
|
87
|
+
theme="${ifDefined(this._theme)}"
|
|
88
|
+
>
|
|
89
|
+
<slot name="overflow" slot="prefix"></slot>
|
|
90
|
+
<div id="chips" part="chips" slot="prefix">
|
|
91
|
+
<slot name="chip"></slot>
|
|
92
|
+
</div>
|
|
93
|
+
<slot name="input"></slot>
|
|
94
|
+
<div
|
|
95
|
+
id="clearButton"
|
|
96
|
+
part="clear-button"
|
|
97
|
+
slot="suffix"
|
|
98
|
+
@touchend="${this._onClearButtonTouchend}"
|
|
99
|
+
aria-hidden="true"
|
|
100
|
+
></div>
|
|
101
|
+
<div id="toggleButton" class="toggle-button" part="toggle-button" slot="suffix" aria-hidden="true"></div>
|
|
102
|
+
</vaadin-multi-select-combo-box-container>
|
|
103
|
+
</vaadin-multi-select-combo-box-internal>
|
|
104
|
+
|
|
105
|
+
<div part="helper-text">
|
|
106
|
+
<slot name="helper"></slot>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<div part="error-message">
|
|
110
|
+
<slot name="error-message"></slot>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<slot name="tooltip"></slot>
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** @private */
|
|
119
|
+
_onComboBoxFilterChanged(event) {
|
|
120
|
+
this.filter = event.detail.value;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** @private */
|
|
124
|
+
_onComboBoxLoadingChanged(event) {
|
|
125
|
+
this.loading = event.detail.value;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** @private */
|
|
129
|
+
_onComboBoxLastFilterChanged(event) {
|
|
130
|
+
this._lastFilter = event.detail.value;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** @private */
|
|
134
|
+
_onComboBoxOpenedChanged(event) {
|
|
135
|
+
this.opened = event.detail.value;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** @private */
|
|
139
|
+
_onComboBoxSizeChanged(event) {
|
|
140
|
+
this.size = event.detail.value;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
defineCustomElement(MultiSelectComboBox);
|
|
145
|
+
|
|
146
|
+
export { MultiSelectComboBox };
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
+
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
+
import { multiSelectComboBoxChip } from './vaadin-multi-select-combo-box-styles.js';
|
|
10
|
+
|
|
11
|
+
registerStyles('vaadin-multi-select-combo-box-chip', multiSelectComboBoxChip, {
|
|
12
|
+
moduleId: 'vaadin-multi-select-combo-box-chip',
|
|
13
|
+
});
|
|
9
14
|
|
|
10
15
|
/**
|
|
11
16
|
* An element used by `<vaadin-multi-select-combo-box>` to display selected items.
|
|
@@ -54,32 +59,6 @@ class MultiSelectComboBoxChip extends ThemableMixin(PolymerElement) {
|
|
|
54
59
|
|
|
55
60
|
static get template() {
|
|
56
61
|
return html`
|
|
57
|
-
<style>
|
|
58
|
-
:host {
|
|
59
|
-
display: inline-flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
align-self: center;
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
box-sizing: border-box;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
[part='label'] {
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
text-overflow: ellipsis;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:host([hidden]),
|
|
72
|
-
:host(:is([readonly], [disabled], [slot='overflow'])) [part='remove-button'] {
|
|
73
|
-
display: none !important;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@media (forced-colors: active) {
|
|
77
|
-
:host {
|
|
78
|
-
outline: 1px solid;
|
|
79
|
-
outline-offset: -1px;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
</style>
|
|
83
62
|
<div part="label">[[label]]</div>
|
|
84
63
|
<div part="remove-button" on-click="_onRemoveClick"></div>
|
|
85
64
|
`;
|