@vaadin/combo-box 22.0.1 → 23.0.0-alpha3
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 -14
- package/src/vaadin-combo-box-data-provider-mixin.d.ts +1 -1
- package/src/vaadin-combo-box-data-provider-mixin.js +2 -3
- package/src/vaadin-combo-box-dropdown.js +5 -12
- package/src/vaadin-combo-box-item.js +5 -3
- package/src/vaadin-combo-box-light.d.ts +10 -1
- package/src/vaadin-combo-box-light.js +4 -3
- package/src/vaadin-combo-box-mixin.d.ts +1 -1
- package/src/vaadin-combo-box-mixin.js +33 -30
- package/src/vaadin-combo-box-overlay.js +1 -1
- package/src/vaadin-combo-box-placeholder.js +1 -1
- package/src/vaadin-combo-box-scroller.js +3 -4
- package/src/vaadin-combo-box.d.ts +10 -1
- package/src/vaadin-combo-box.js +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/combo-box",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0-alpha3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,25 +32,24 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
35
|
-
"@polymer/iron-resizable-behavior": "^3.0.0",
|
|
36
35
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "
|
|
38
|
-
"@vaadin/field-base": "
|
|
39
|
-
"@vaadin/input-container": "
|
|
40
|
-
"@vaadin/item": "
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
42
|
-
"@vaadin/vaadin-material-styles": "
|
|
43
|
-
"@vaadin/vaadin-overlay": "
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
36
|
+
"@vaadin/component-base": "23.0.0-alpha3",
|
|
37
|
+
"@vaadin/field-base": "23.0.0-alpha3",
|
|
38
|
+
"@vaadin/input-container": "23.0.0-alpha3",
|
|
39
|
+
"@vaadin/item": "23.0.0-alpha3",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha3",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "23.0.0-alpha3",
|
|
42
|
+
"@vaadin/vaadin-overlay": "23.0.0-alpha3",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha3"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
|
-
"@vaadin/dialog": "
|
|
49
|
-
"@vaadin/polymer-legacy-adapter": "
|
|
47
|
+
"@vaadin/dialog": "23.0.0-alpha3",
|
|
48
|
+
"@vaadin/polymer-legacy-adapter": "23.0.0-alpha3",
|
|
50
49
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
51
|
-
"@vaadin/text-field": "
|
|
50
|
+
"@vaadin/text-field": "23.0.0-alpha3",
|
|
52
51
|
"lit": "^2.0.0",
|
|
53
52
|
"sinon": "^9.2.0"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "490037919a9e054cc002c1b3be0c94a1603e1a44"
|
|
56
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';
|
|
@@ -158,9 +158,8 @@ export const ComboBoxDataProviderMixin = (superClass) =>
|
|
|
158
158
|
const loadedItem = this.filteredItems[page * this.pageSize];
|
|
159
159
|
if (loadedItem !== undefined) {
|
|
160
160
|
return loadedItem instanceof ComboBoxPlaceholder;
|
|
161
|
-
} else {
|
|
162
|
-
return this.size === undefined;
|
|
163
161
|
}
|
|
162
|
+
return this.size === undefined;
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
/** @private */
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-combo-box-item.js';
|
|
7
7
|
import './vaadin-combo-box-overlay.js';
|
|
8
8
|
import './vaadin-combo-box-scroller.js';
|
|
9
|
-
import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
|
|
10
|
-
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
|
|
11
9
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
12
10
|
|
|
13
11
|
/**
|
|
@@ -16,7 +14,7 @@ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
|
16
14
|
* @extends HTMLElement
|
|
17
15
|
* @private
|
|
18
16
|
*/
|
|
19
|
-
export class ComboBoxDropdown extends
|
|
17
|
+
export class ComboBoxDropdown extends PolymerElement {
|
|
20
18
|
static get is() {
|
|
21
19
|
return 'vaadin-combo-box-dropdown';
|
|
22
20
|
}
|
|
@@ -31,6 +29,8 @@ export class ComboBoxDropdown extends mixinBehaviors(IronResizableBehavior, Poly
|
|
|
31
29
|
theme$="[[theme]]"
|
|
32
30
|
position-target="[[positionTarget]]"
|
|
33
31
|
no-vertical-overlap
|
|
32
|
+
restore-focus-on-close="[[restoreFocusOnClose]]"
|
|
33
|
+
restore-focus-node="[[restoreFocusNode]]"
|
|
34
34
|
></vaadin-combo-box-overlay>
|
|
35
35
|
`;
|
|
36
36
|
}
|
|
@@ -171,14 +171,6 @@ export class ComboBoxDropdown extends mixinBehaviors(IronResizableBehavior, Poly
|
|
|
171
171
|
this._overlayOpened = false;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
notifyResize() {
|
|
175
|
-
super.notifyResize();
|
|
176
|
-
|
|
177
|
-
if (this.positionTarget && this.opened) {
|
|
178
|
-
this._setOverlayWidth();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
174
|
_fireTouchAction(sourceEvent) {
|
|
183
175
|
this.dispatchEvent(
|
|
184
176
|
new CustomEvent('vaadin-overlay-touch-action', {
|
|
@@ -262,6 +254,7 @@ export class ComboBoxDropdown extends mixinBehaviors(IronResizableBehavior, Poly
|
|
|
262
254
|
}
|
|
263
255
|
}
|
|
264
256
|
|
|
257
|
+
// eslint-disable-next-line max-params
|
|
265
258
|
__updateScroller(scroller, items, opened, loading, selectedItem, itemIdPath, focusedIndex, renderer, theme) {
|
|
266
259
|
if (scroller) {
|
|
267
260
|
scroller.setProperties({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
@@ -140,7 +140,7 @@ export class ComboBoxItem extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/** @private */
|
|
143
|
-
__rendererOrItemChanged(renderer, index, item
|
|
143
|
+
__rendererOrItemChanged(renderer, index, item) {
|
|
144
144
|
if (item === undefined || index === undefined) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
@@ -161,7 +161,9 @@ export class ComboBoxItem extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
161
161
|
|
|
162
162
|
/** @private */
|
|
163
163
|
__updateLabel(label, renderer) {
|
|
164
|
-
if (renderer)
|
|
164
|
+
if (renderer) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
165
167
|
|
|
166
168
|
this.textContent = label;
|
|
167
169
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
@@ -17,6 +17,13 @@ export {
|
|
|
17
17
|
} from './vaadin-combo-box-data-provider-mixin.js';
|
|
18
18
|
export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Fired when the user commits a value change.
|
|
22
|
+
*/
|
|
23
|
+
export type ComboBoxLightChangeEvent<TItem> = Event & {
|
|
24
|
+
target: ComboBoxLight<TItem>;
|
|
25
|
+
};
|
|
26
|
+
|
|
20
27
|
/**
|
|
21
28
|
* Fired when the user sets a custom value.
|
|
22
29
|
*/
|
|
@@ -48,6 +55,8 @@ export type ComboBoxLightFilterChangedEvent = CustomEvent<{ value: string }>;
|
|
|
48
55
|
export type ComboBoxLightSelectedItemChangedEvent<TItem> = CustomEvent<{ value: TItem | null | undefined }>;
|
|
49
56
|
|
|
50
57
|
export interface ComboBoxLightEventMap<TItem> extends HTMLElementEventMap {
|
|
58
|
+
change: ComboBoxLightChangeEvent<TItem>;
|
|
59
|
+
|
|
51
60
|
'custom-value-set': ComboBoxLightCustomValueSetEvent;
|
|
52
61
|
|
|
53
62
|
'opened-changed': ComboBoxLightOpenedChangedEvent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-combo-box-dropdown.js';
|
|
@@ -79,6 +79,8 @@ class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ThemableMixi
|
|
|
79
79
|
id="dropdown"
|
|
80
80
|
opened="[[opened]]"
|
|
81
81
|
position-target="[[inputElement]]"
|
|
82
|
+
restore-focus-on-close="[[__restoreFocusOnClose]]"
|
|
83
|
+
restore-focus-node="[[inputElement]]"
|
|
82
84
|
renderer="[[renderer]]"
|
|
83
85
|
_focused-index="[[_focusedIndex]]"
|
|
84
86
|
_item-id-path="[[itemIdPath]]"
|
|
@@ -133,9 +135,8 @@ class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ThemableMixi
|
|
|
133
135
|
checkValidity() {
|
|
134
136
|
if (this.inputElement.validate) {
|
|
135
137
|
return this.inputElement.validate();
|
|
136
|
-
} else {
|
|
137
|
-
return super.checkValidity();
|
|
138
138
|
}
|
|
139
|
+
return super.checkValidity();
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
/**
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
7
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
8
|
import { DisabledMixin } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
8
9
|
import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
9
10
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
10
11
|
import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
|
|
12
|
+
import { VirtualKeyboardController } from '@vaadin/field-base/src/virtual-keyboard-controller.js';
|
|
11
13
|
import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* @polymerMixin
|
|
17
|
+
* @param {function(new:HTMLElement)} subclass
|
|
15
18
|
*/
|
|
16
19
|
export const ComboBoxMixin = (subclass) =>
|
|
17
|
-
class VaadinComboBoxMixinElement extends KeyboardMixin(InputMixin(DisabledMixin(subclass))) {
|
|
20
|
+
class VaadinComboBoxMixinElement extends ControllerMixin(KeyboardMixin(InputMixin(DisabledMixin(subclass)))) {
|
|
18
21
|
static get properties() {
|
|
19
22
|
return {
|
|
20
23
|
/**
|
|
@@ -190,7 +193,10 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
190
193
|
},
|
|
191
194
|
|
|
192
195
|
/** @private */
|
|
193
|
-
_closeOnBlurIsPrevented: Boolean
|
|
196
|
+
_closeOnBlurIsPrevented: Boolean,
|
|
197
|
+
|
|
198
|
+
/** @private */
|
|
199
|
+
__restoreFocusOnClose: Boolean
|
|
194
200
|
};
|
|
195
201
|
}
|
|
196
202
|
|
|
@@ -292,6 +298,8 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
292
298
|
this.addEventListener('touchstart', bringToFrontListener);
|
|
293
299
|
|
|
294
300
|
processTemplates(this);
|
|
301
|
+
|
|
302
|
+
this.addController(new VirtualKeyboardController(this));
|
|
295
303
|
}
|
|
296
304
|
|
|
297
305
|
/**
|
|
@@ -364,6 +372,8 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
364
372
|
if (!this.hasAttribute('focused') && !isTouch) {
|
|
365
373
|
this.focus();
|
|
366
374
|
}
|
|
375
|
+
|
|
376
|
+
this.__restoreFocusOnClose = true;
|
|
367
377
|
} else {
|
|
368
378
|
this._onClosed();
|
|
369
379
|
if (this._openedWithFocusRing && this.hasAttribute('focused')) {
|
|
@@ -435,23 +445,25 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
435
445
|
* @override
|
|
436
446
|
*/
|
|
437
447
|
_onKeyDown(e) {
|
|
438
|
-
if (e.
|
|
448
|
+
if (e.key === 'Tab') {
|
|
449
|
+
this.__restoreFocusOnClose = false;
|
|
450
|
+
} else if (e.key === 'ArrowDown') {
|
|
439
451
|
this._closeOnBlurIsPrevented = true;
|
|
440
452
|
this._onArrowDown();
|
|
441
453
|
this._closeOnBlurIsPrevented = false;
|
|
442
454
|
|
|
443
455
|
// prevent caret from moving
|
|
444
456
|
e.preventDefault();
|
|
445
|
-
} else if (e.
|
|
457
|
+
} else if (e.key === 'ArrowUp') {
|
|
446
458
|
this._closeOnBlurIsPrevented = true;
|
|
447
459
|
this._onArrowUp();
|
|
448
460
|
this._closeOnBlurIsPrevented = false;
|
|
449
461
|
|
|
450
462
|
// prevent caret from moving
|
|
451
463
|
e.preventDefault();
|
|
452
|
-
} else if (e.
|
|
464
|
+
} else if (e.key === 'Enter') {
|
|
453
465
|
this._onEnter(e);
|
|
454
|
-
} else if (e.
|
|
466
|
+
} else if (e.key === 'Escape') {
|
|
455
467
|
this._onEscape(e);
|
|
456
468
|
}
|
|
457
469
|
}
|
|
@@ -581,25 +593,23 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
581
593
|
// The clear button is visible and the overlay is closed, so clear the value.
|
|
582
594
|
this._clear();
|
|
583
595
|
}
|
|
584
|
-
} else {
|
|
596
|
+
} else if (this.opened) {
|
|
585
597
|
// Auto-open is enabled
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
e.stopPropagation();
|
|
598
|
+
// The overlay is open
|
|
599
|
+
e.stopPropagation();
|
|
589
600
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
} else if (this.clearButtonVisible && !!this.value) {
|
|
599
|
-
e.stopPropagation();
|
|
600
|
-
// The clear button is visible and the overlay is closed, so clear the value.
|
|
601
|
-
this._clear();
|
|
601
|
+
if (this._focusedIndex > -1) {
|
|
602
|
+
// An item is focused, revert the input to the filtered value
|
|
603
|
+
this._focusedIndex = -1;
|
|
604
|
+
this._revertInputValue();
|
|
605
|
+
} else {
|
|
606
|
+
// No item is focused, cancel the change and close the overlay
|
|
607
|
+
this.cancel();
|
|
602
608
|
}
|
|
609
|
+
} else if (this.clearButtonVisible && !!this.value) {
|
|
610
|
+
e.stopPropagation();
|
|
611
|
+
// The clear button is visible and the overlay is closed, so clear the value.
|
|
612
|
+
this._clear();
|
|
603
613
|
}
|
|
604
614
|
}
|
|
605
615
|
|
|
@@ -643,8 +653,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
643
653
|
|
|
644
654
|
/** @private */
|
|
645
655
|
_onOpened() {
|
|
646
|
-
setTimeout(() => this._resizeDropdown(), 1);
|
|
647
|
-
|
|
648
656
|
// Defer scroll position adjustment to improve performance.
|
|
649
657
|
requestAnimationFrame(() => {
|
|
650
658
|
this.$.dropdown.adjustScrollPosition();
|
|
@@ -820,11 +828,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
820
828
|
}
|
|
821
829
|
}
|
|
822
830
|
|
|
823
|
-
/** @private */
|
|
824
|
-
_resizeDropdown() {
|
|
825
|
-
this.$.dropdown.notifyResize();
|
|
826
|
-
}
|
|
827
|
-
|
|
828
831
|
/** @private */
|
|
829
832
|
_selectedItemChanged(selectedItem) {
|
|
830
833
|
if (selectedItem === null || selectedItem === undefined) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
@@ -221,9 +221,8 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
221
221
|
return false;
|
|
222
222
|
} else if (itemIdPath && item !== undefined && selectedItem !== undefined) {
|
|
223
223
|
return this.get(itemIdPath, item) === this.get(itemIdPath, selectedItem);
|
|
224
|
-
} else {
|
|
225
|
-
return item === selectedItem;
|
|
226
224
|
}
|
|
225
|
+
return item === selectedItem;
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
/** @private */
|
|
@@ -288,7 +287,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
288
287
|
el.id = `${this.__hostTagName}-item-${index}`;
|
|
289
288
|
el.setAttribute('role', this.__getAriaRole(index));
|
|
290
289
|
el.setAttribute('aria-selected', this.__getAriaSelected(focusedIndex, index));
|
|
291
|
-
el.setAttribute('aria-posinset', index);
|
|
290
|
+
el.setAttribute('aria-posinset', index + 1);
|
|
292
291
|
|
|
293
292
|
if (this.theme) {
|
|
294
293
|
el.setAttribute('theme', this.theme);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
@@ -28,6 +28,13 @@ export {
|
|
|
28
28
|
} from './vaadin-combo-box-data-provider-mixin.js';
|
|
29
29
|
export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Fired when the user commits a value change.
|
|
33
|
+
*/
|
|
34
|
+
export type ComboBoxChangeEvent<TItem> = Event & {
|
|
35
|
+
target: ComboBox<TItem>;
|
|
36
|
+
};
|
|
37
|
+
|
|
31
38
|
/**
|
|
32
39
|
* Fired when the user sets a custom value.
|
|
33
40
|
*/
|
|
@@ -59,6 +66,8 @@ export type ComboBoxFilterChangedEvent = CustomEvent<{ value: string }>;
|
|
|
59
66
|
export type ComboBoxSelectedItemChangedEvent<TItem> = CustomEvent<{ value: TItem | null | undefined }>;
|
|
60
67
|
|
|
61
68
|
export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
|
|
69
|
+
change: ComboBoxChangeEvent<TItem>;
|
|
70
|
+
|
|
62
71
|
'custom-value-set': ComboBoxCustomValueSetEvent;
|
|
63
72
|
|
|
64
73
|
'opened-changed': ComboBoxOpenedChangedEvent;
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2015 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
@@ -201,6 +201,8 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
201
201
|
opened="[[opened]]"
|
|
202
202
|
renderer="[[renderer]]"
|
|
203
203
|
position-target="[[_positionTarget]]"
|
|
204
|
+
restore-focus-on-close="[[__restoreFocusOnClose]]"
|
|
205
|
+
restore-focus-node="[[inputElement]]"
|
|
204
206
|
_focused-index="[[_focusedIndex]]"
|
|
205
207
|
_item-id-path="[[itemIdPath]]"
|
|
206
208
|
_item-label-path="[[itemLabelPath]]"
|
|
@@ -242,7 +244,7 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
242
244
|
this.ariaTarget = input;
|
|
243
245
|
})
|
|
244
246
|
);
|
|
245
|
-
this.addController(new LabelledInputController(this.inputElement, this.
|
|
247
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
246
248
|
this._positionTarget = this.shadowRoot.querySelector('[part="input-field"]');
|
|
247
249
|
this._toggleElement = this.$.toggleButton;
|
|
248
250
|
}
|