@vaadin/multi-select-combo-box 24.2.0-alpha1 → 24.2.0-alpha11
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 +14 -14
- package/src/lit/renderer-directives.d.ts +2 -2
- package/src/vaadin-multi-select-combo-box-internal.js +33 -20
- package/src/vaadin-multi-select-combo-box.d.ts +9 -1
- package/src/vaadin-multi-select-combo-box.js +5 -1
- package/web-types.json +27 -1
- package/web-types.lit.json +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/multi-select-combo-box",
|
|
3
|
-
"version": "24.2.0-
|
|
3
|
+
"version": "24.2.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/a11y-base": "24.2.0-
|
|
41
|
-
"@vaadin/combo-box": "24.2.0-
|
|
42
|
-
"@vaadin/component-base": "24.2.0-
|
|
43
|
-
"@vaadin/field-base": "24.2.0-
|
|
44
|
-
"@vaadin/input-container": "24.2.0-
|
|
45
|
-
"@vaadin/item": "24.2.0-
|
|
46
|
-
"@vaadin/lit-renderer": "24.2.0-
|
|
47
|
-
"@vaadin/overlay": "24.2.0-
|
|
48
|
-
"@vaadin/vaadin-lumo-styles": "24.2.0-
|
|
49
|
-
"@vaadin/vaadin-material-styles": "24.2.0-
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "24.2.0-
|
|
40
|
+
"@vaadin/a11y-base": "24.2.0-alpha11",
|
|
41
|
+
"@vaadin/combo-box": "24.2.0-alpha11",
|
|
42
|
+
"@vaadin/component-base": "24.2.0-alpha11",
|
|
43
|
+
"@vaadin/field-base": "24.2.0-alpha11",
|
|
44
|
+
"@vaadin/input-container": "24.2.0-alpha11",
|
|
45
|
+
"@vaadin/item": "24.2.0-alpha11",
|
|
46
|
+
"@vaadin/lit-renderer": "24.2.0-alpha11",
|
|
47
|
+
"@vaadin/overlay": "24.2.0-alpha11",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "24.2.0-alpha11",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "24.2.0-alpha11",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "24.2.0-alpha11"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
54
|
-
"@vaadin/testing-helpers": "^0.
|
|
54
|
+
"@vaadin/testing-helpers": "^0.5.0",
|
|
55
55
|
"lit": "^2.0.0",
|
|
56
56
|
"sinon": "^13.0.2"
|
|
57
57
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "a958207d5f6a09ca0e2dcf9f62194b3f92c8766a"
|
|
63
63
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import type { TemplateResult } from 'lit';
|
|
7
6
|
import type { DirectiveResult } from 'lit/directive.js';
|
|
8
7
|
import type { ComboBoxItemModel } from '@vaadin/combo-box/src/vaadin-combo-box.js';
|
|
8
|
+
import type { LitRendererResult } from '@vaadin/lit-renderer';
|
|
9
9
|
import { LitRendererDirective } from '@vaadin/lit-renderer';
|
|
10
10
|
import type { MultiSelectComboBox } from '../vaadin-multi-select-combo-box.js';
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ export type MultiSelectComboBoxLitRenderer<TItem> = (
|
|
|
13
13
|
item: TItem,
|
|
14
14
|
model: ComboBoxItemModel<TItem>,
|
|
15
15
|
comboBox: MultiSelectComboBox<TItem>,
|
|
16
|
-
) =>
|
|
16
|
+
) => LitRendererResult;
|
|
17
17
|
|
|
18
18
|
export class MultiSelectComboBoxRendererDirective<TItem> extends LitRendererDirective<
|
|
19
19
|
MultiSelectComboBox,
|
|
@@ -160,33 +160,44 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
160
160
|
* @override
|
|
161
161
|
*/
|
|
162
162
|
_onEnter(event) {
|
|
163
|
-
this.
|
|
163
|
+
if (this.opened) {
|
|
164
|
+
// Do not submit the surrounding form.
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
// Do not trigger global listeners.
|
|
167
|
+
event.stopPropagation();
|
|
168
|
+
|
|
169
|
+
if (this.readonly) {
|
|
170
|
+
this.close();
|
|
171
|
+
} else {
|
|
172
|
+
// Keep selected item focused after committing on Enter.
|
|
173
|
+
const focusedItem = this.filteredItems[this._focusedIndex];
|
|
174
|
+
this._commitValue();
|
|
175
|
+
this._focusedIndex = this.filteredItems.indexOf(focusedItem);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
164
180
|
|
|
165
181
|
super._onEnter(event);
|
|
166
182
|
}
|
|
167
183
|
|
|
168
184
|
/**
|
|
185
|
+
* Override Escape handler to not clear
|
|
186
|
+
* selected items when readonly.
|
|
187
|
+
* @param {!Event} event
|
|
169
188
|
* @protected
|
|
170
189
|
* @override
|
|
171
190
|
*/
|
|
172
|
-
|
|
191
|
+
_onEscape(event) {
|
|
173
192
|
if (this.readonly) {
|
|
174
|
-
|
|
193
|
+
event.stopPropagation();
|
|
194
|
+
if (this.opened) {
|
|
195
|
+
this.close();
|
|
196
|
+
}
|
|
175
197
|
return;
|
|
176
198
|
}
|
|
177
199
|
|
|
178
|
-
|
|
179
|
-
this.__enterPressed = null;
|
|
180
|
-
|
|
181
|
-
// Keep selected item focused after committing on Enter.
|
|
182
|
-
const focusedItem = this.filteredItems[this._focusedIndex];
|
|
183
|
-
this._commitValue();
|
|
184
|
-
this._focusedIndex = this.filteredItems.indexOf(focusedItem);
|
|
185
|
-
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
super._closeOrCommit();
|
|
200
|
+
super._onEscape(event);
|
|
190
201
|
}
|
|
191
202
|
|
|
192
203
|
/**
|
|
@@ -232,18 +243,20 @@ class MultiSelectComboBoxInternal extends ComboBoxDataProviderMixin(ComboBoxMixi
|
|
|
232
243
|
/**
|
|
233
244
|
* Override method inherited from the combo-box
|
|
234
245
|
* to close dropdown on blur when readonly.
|
|
235
|
-
* @param {
|
|
246
|
+
* @param {boolean} focused
|
|
236
247
|
* @protected
|
|
237
248
|
* @override
|
|
238
249
|
*/
|
|
239
|
-
|
|
250
|
+
_setFocused(focused) {
|
|
240
251
|
// Disable combo-box logic that updates selectedItem
|
|
241
252
|
// based on the overlay focused index on input blur
|
|
242
|
-
|
|
253
|
+
if (!focused) {
|
|
254
|
+
this._ignoreCommitValue = true;
|
|
255
|
+
}
|
|
243
256
|
|
|
244
|
-
super.
|
|
257
|
+
super._setFocused(focused);
|
|
245
258
|
|
|
246
|
-
if (this.readonly && !this._closeOnBlurIsPrevented) {
|
|
259
|
+
if (!focused && this.readonly && !this._closeOnBlurIsPrevented) {
|
|
247
260
|
this.close();
|
|
248
261
|
}
|
|
249
262
|
}
|
|
@@ -16,13 +16,13 @@ import type { ControllerMixinClass } from '@vaadin/component-base/src/controller
|
|
|
16
16
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
17
17
|
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
18
18
|
import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
|
|
19
|
+
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
19
20
|
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
|
|
20
21
|
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
|
|
21
22
|
import type { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
|
|
22
23
|
import type { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
23
24
|
import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
|
|
24
25
|
import type { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
|
|
25
|
-
import type { SlotStylesMixinClass } from '@vaadin/field-base/src/slot-styles-mixin.js';
|
|
26
26
|
import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
|
|
27
27
|
import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
28
28
|
import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
@@ -53,6 +53,11 @@ export type MultiSelectComboBoxChangeEvent<TItem> = Event & {
|
|
|
53
53
|
*/
|
|
54
54
|
export type MultiSelectComboBoxCustomValueSetEvent = CustomEvent<string>;
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Fired when the `dirty` property changes.
|
|
58
|
+
*/
|
|
59
|
+
export type MultiSelectComboBoxDirtyChangedEvent = CustomEvent<{ value: boolean }>;
|
|
60
|
+
|
|
56
61
|
/**
|
|
57
62
|
* Fired when the `filter` property changes.
|
|
58
63
|
*/
|
|
@@ -78,6 +83,8 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
|
|
|
78
83
|
|
|
79
84
|
'custom-value-set': MultiSelectComboBoxCustomValueSetEvent;
|
|
80
85
|
|
|
86
|
+
'dirty-changed': MultiSelectComboBoxDirtyChangedEvent;
|
|
87
|
+
|
|
81
88
|
'filter-changed': MultiSelectComboBoxFilterChangedEvent;
|
|
82
89
|
|
|
83
90
|
'invalid-changed': MultiSelectComboBoxInvalidChangedEvent;
|
|
@@ -159,6 +166,7 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
|
|
|
159
166
|
* @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
|
|
160
167
|
* @fires {CustomEvent} filter-changed - Fired when the `filter` property changes.
|
|
161
168
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
169
|
+
* @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes.
|
|
162
170
|
* @fires {CustomEvent} selected-items-changed - Fired when the `selectedItems` property changes.
|
|
163
171
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
164
172
|
*/
|
|
@@ -527,6 +527,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
527
527
|
this._tooltipController = new TooltipController(this);
|
|
528
528
|
this.addController(this._tooltipController);
|
|
529
529
|
this._tooltipController.setPosition('top');
|
|
530
|
+
this._tooltipController.setAriaTarget(this.inputElement);
|
|
530
531
|
this._tooltipController.setShouldShow((target) => !target.opened);
|
|
531
532
|
|
|
532
533
|
this._inputField = this.shadowRoot.querySelector('[part="input-field"]');
|
|
@@ -616,7 +617,9 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
616
617
|
_setFocused(focused) {
|
|
617
618
|
super._setFocused(focused);
|
|
618
619
|
|
|
619
|
-
|
|
620
|
+
// Do not validate when focusout is caused by document
|
|
621
|
+
// losing focus, which happens on browser tab switch.
|
|
622
|
+
if (!focused && document.hasFocus()) {
|
|
620
623
|
this._focusedChipIndex = -1;
|
|
621
624
|
this.validate();
|
|
622
625
|
}
|
|
@@ -810,6 +813,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
810
813
|
|
|
811
814
|
/** @private */
|
|
812
815
|
__updateSelection(selectedItems) {
|
|
816
|
+
this.dirty = true;
|
|
813
817
|
this.selectedItems = selectedItems;
|
|
814
818
|
|
|
815
819
|
this.validate();
|
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.2.0-
|
|
4
|
+
"version": "24.2.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -120,6 +120,17 @@
|
|
|
120
120
|
]
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
|
+
{
|
|
124
|
+
"name": "dirty",
|
|
125
|
+
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
126
|
+
"value": {
|
|
127
|
+
"type": [
|
|
128
|
+
"boolean",
|
|
129
|
+
"null",
|
|
130
|
+
"undefined"
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
123
134
|
{
|
|
124
135
|
"name": "clear-button-visible",
|
|
125
136
|
"description": "Set to true to display the clear icon which clears the input.",
|
|
@@ -431,6 +442,17 @@
|
|
|
431
442
|
]
|
|
432
443
|
}
|
|
433
444
|
},
|
|
445
|
+
{
|
|
446
|
+
"name": "dirty",
|
|
447
|
+
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
448
|
+
"value": {
|
|
449
|
+
"type": [
|
|
450
|
+
"boolean",
|
|
451
|
+
"null",
|
|
452
|
+
"undefined"
|
|
453
|
+
]
|
|
454
|
+
}
|
|
455
|
+
},
|
|
434
456
|
{
|
|
435
457
|
"name": "clearButtonVisible",
|
|
436
458
|
"description": "Set to true to display the clear icon which clears the input.",
|
|
@@ -722,6 +744,10 @@
|
|
|
722
744
|
{
|
|
723
745
|
"name": "invalid-changed",
|
|
724
746
|
"description": "Fired when the `invalid` property changes."
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"name": "dirty-changed",
|
|
750
|
+
"description": "Fired when the `dirty` property changes."
|
|
725
751
|
}
|
|
726
752
|
]
|
|
727
753
|
}
|
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.2.0-
|
|
4
|
+
"version": "24.2.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -47,6 +47,13 @@
|
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
"name": "?dirty",
|
|
52
|
+
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
50
57
|
{
|
|
51
58
|
"name": "?clearButtonVisible",
|
|
52
59
|
"description": "Set to true to display the clear icon which clears the input.",
|
|
@@ -298,6 +305,13 @@
|
|
|
298
305
|
"value": {
|
|
299
306
|
"kind": "expression"
|
|
300
307
|
}
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "@dirty-changed",
|
|
311
|
+
"description": "Fired when the `dirty` property changes.",
|
|
312
|
+
"value": {
|
|
313
|
+
"kind": "expression"
|
|
314
|
+
}
|
|
301
315
|
}
|
|
302
316
|
]
|
|
303
317
|
}
|