@vaadin/combo-box 23.0.7 → 23.0.10
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-combo-box-data-provider-mixin.d.ts +2 -2
- package/src/vaadin-combo-box-data-provider-mixin.js +9 -9
- package/src/vaadin-combo-box-dropdown.js +14 -14
- package/src/vaadin-combo-box-item.js +4 -4
- package/src/vaadin-combo-box-light.d.ts +3 -3
- package/src/vaadin-combo-box-light.js +2 -2
- package/src/vaadin-combo-box-mixin.d.ts +2 -2
- package/src/vaadin-combo-box-mixin.js +19 -18
- package/src/vaadin-combo-box-overlay.js +1 -1
- package/src/vaadin-combo-box-scroller.js +18 -16
- package/src/vaadin-combo-box.d.ts +3 -3
- package/src/vaadin-combo-box.js +4 -4
- package/theme/lumo/vaadin-combo-box-dropdown-styles.js +1 -1
- package/theme/lumo/vaadin-combo-box-item-styles.js +1 -1
- package/theme/material/vaadin-combo-box-dropdown-styles.js +1 -1
- package/theme/material/vaadin-combo-box-item-styles.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/combo-box",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "^23.0.
|
|
38
|
-
"@vaadin/field-base": "^23.0.
|
|
39
|
-
"@vaadin/input-container": "^23.0.
|
|
40
|
-
"@vaadin/item": "^23.0.
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "^23.0.
|
|
42
|
-
"@vaadin/vaadin-material-styles": "^23.0.
|
|
43
|
-
"@vaadin/vaadin-overlay": "^23.0.
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "^23.0.
|
|
37
|
+
"@vaadin/component-base": "^23.0.10",
|
|
38
|
+
"@vaadin/field-base": "^23.0.10",
|
|
39
|
+
"@vaadin/input-container": "^23.0.10",
|
|
40
|
+
"@vaadin/item": "^23.0.10",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "^23.0.10",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "^23.0.10",
|
|
43
|
+
"@vaadin/vaadin-overlay": "^23.0.10",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "^23.0.10"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
|
-
"@vaadin/dialog": "^23.0.
|
|
49
|
-
"@vaadin/polymer-legacy-adapter": "^23.0.
|
|
48
|
+
"@vaadin/dialog": "^23.0.10",
|
|
49
|
+
"@vaadin/polymer-legacy-adapter": "^23.0.10",
|
|
50
50
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
51
|
-
"@vaadin/text-field": "^23.0.
|
|
51
|
+
"@vaadin/text-field": "^23.0.10",
|
|
52
52
|
"lit": "^2.0.0",
|
|
53
53
|
"sinon": "^9.2.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "e8402a55ce0e823ae6da5c97486998cfd931b1d3"
|
|
56
56
|
}
|
|
@@ -15,11 +15,11 @@ export interface ComboBoxDataProviderParams {
|
|
|
15
15
|
|
|
16
16
|
export type ComboBoxDataProvider<TItem> = (
|
|
17
17
|
params: ComboBoxDataProviderParams,
|
|
18
|
-
callback: ComboBoxDataProviderCallback<TItem
|
|
18
|
+
callback: ComboBoxDataProviderCallback<TItem>,
|
|
19
19
|
) => void;
|
|
20
20
|
|
|
21
21
|
export declare function ComboBoxDataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
22
|
-
base: T
|
|
22
|
+
base: T,
|
|
23
23
|
): T & Constructor<ComboBoxDataProviderMixinClass<TItem>>;
|
|
24
24
|
|
|
25
25
|
export declare class ComboBoxDataProviderMixinClass<TItem> {
|
|
@@ -20,7 +20,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
|
|
|
20
20
|
pageSize: {
|
|
21
21
|
type: Number,
|
|
22
22
|
value: 50,
|
|
23
|
-
observer: '_pageSizeChanged'
|
|
23
|
+
observer: '_pageSizeChanged',
|
|
24
24
|
},
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -29,7 +29,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
|
|
|
29
29
|
*/
|
|
30
30
|
size: {
|
|
31
31
|
type: Number,
|
|
32
|
-
observer: '_sizeChanged'
|
|
32
|
+
observer: '_sizeChanged',
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -48,20 +48,20 @@ export const ComboBoxDataProviderMixin = (superClass) =>
|
|
|
48
48
|
*/
|
|
49
49
|
dataProvider: {
|
|
50
50
|
type: Object,
|
|
51
|
-
observer: '_dataProviderChanged'
|
|
51
|
+
observer: '_dataProviderChanged',
|
|
52
52
|
},
|
|
53
53
|
|
|
54
54
|
/** @private */
|
|
55
55
|
_pendingRequests: {
|
|
56
56
|
value: () => {
|
|
57
57
|
return {};
|
|
58
|
-
}
|
|
58
|
+
},
|
|
59
59
|
},
|
|
60
60
|
|
|
61
61
|
/** @private */
|
|
62
62
|
__placeHolder: {
|
|
63
|
-
value: new ComboBoxPlaceholder()
|
|
64
|
-
}
|
|
63
|
+
value: new ComboBoxPlaceholder(),
|
|
64
|
+
},
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -70,7 +70,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
|
|
|
70
70
|
'_dataProviderFilterChanged(filter, dataProvider)',
|
|
71
71
|
'_dataProviderClearFilter(dataProvider, opened, value)',
|
|
72
72
|
'_warnDataProviderValue(dataProvider, value)',
|
|
73
|
-
'_ensureFirstPage(opened)'
|
|
73
|
+
'_ensureFirstPage(opened)',
|
|
74
74
|
];
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -171,7 +171,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
|
|
|
171
171
|
const params = {
|
|
172
172
|
page,
|
|
173
173
|
pageSize: this.pageSize,
|
|
174
|
-
filter: this.filter
|
|
174
|
+
filter: this.filter,
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
const callback = (items, size) => {
|
|
@@ -282,7 +282,7 @@ export const ComboBoxDataProviderMixin = (superClass) =>
|
|
|
282
282
|
'Nothing to display in the text field. This usually happens when ' +
|
|
283
283
|
'setting an initial `value` before any items are returned from ' +
|
|
284
284
|
'the `dataProvider` callback. Consider setting `selectedItem` ' +
|
|
285
|
-
'instead of `value`'
|
|
285
|
+
'instead of `value`',
|
|
286
286
|
);
|
|
287
287
|
}
|
|
288
288
|
}
|
|
@@ -48,7 +48,7 @@ export class ComboBoxDropdown extends PolymerElement {
|
|
|
48
48
|
*/
|
|
49
49
|
positionTarget: {
|
|
50
50
|
type: Object,
|
|
51
|
-
observer: '_positionTargetChanged'
|
|
51
|
+
observer: '_positionTargetChanged',
|
|
52
52
|
},
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -62,7 +62,7 @@ export class ComboBoxDropdown extends PolymerElement {
|
|
|
62
62
|
loading: {
|
|
63
63
|
type: Boolean,
|
|
64
64
|
value: false,
|
|
65
|
-
reflectToAttribute: true
|
|
65
|
+
reflectToAttribute: true,
|
|
66
66
|
},
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -71,31 +71,31 @@ export class ComboBoxDropdown extends PolymerElement {
|
|
|
71
71
|
theme: String,
|
|
72
72
|
|
|
73
73
|
_selectedItem: {
|
|
74
|
-
type: Object
|
|
74
|
+
type: Object,
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
_items: {
|
|
78
|
-
type: Array
|
|
78
|
+
type: Array,
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
_focusedIndex: {
|
|
82
82
|
type: Number,
|
|
83
|
-
value: -1
|
|
83
|
+
value: -1,
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
focusedItem: {
|
|
87
87
|
type: String,
|
|
88
|
-
computed: '_getFocusedItem(_focusedIndex)'
|
|
88
|
+
computed: '_getFocusedItem(_focusedIndex)',
|
|
89
89
|
},
|
|
90
90
|
|
|
91
91
|
_itemLabelPath: {
|
|
92
92
|
type: String,
|
|
93
|
-
value: 'label'
|
|
93
|
+
value: 'label',
|
|
94
94
|
},
|
|
95
95
|
|
|
96
96
|
_itemValuePath: {
|
|
97
97
|
type: String,
|
|
98
|
-
value: 'value'
|
|
98
|
+
value: 'value',
|
|
99
99
|
},
|
|
100
100
|
|
|
101
101
|
_scroller: Object,
|
|
@@ -104,15 +104,15 @@ export class ComboBoxDropdown extends PolymerElement {
|
|
|
104
104
|
|
|
105
105
|
_overlayOpened: {
|
|
106
106
|
type: Boolean,
|
|
107
|
-
observer: '_openedChanged'
|
|
108
|
-
}
|
|
107
|
+
observer: '_openedChanged',
|
|
108
|
+
},
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
static get observers() {
|
|
113
113
|
return [
|
|
114
114
|
'_openedOrItemsChanged(opened, _items, loading)',
|
|
115
|
-
'__updateScroller(_scroller, _items, opened, loading, _selectedItem, _itemIdPath, _focusedIndex, renderer, theme)'
|
|
115
|
+
'__updateScroller(_scroller, _items, opened, loading, _selectedItem, _itemIdPath, _focusedIndex, renderer, theme)',
|
|
116
116
|
];
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -174,8 +174,8 @@ export class ComboBoxDropdown extends PolymerElement {
|
|
|
174
174
|
_fireTouchAction(sourceEvent) {
|
|
175
175
|
this.dispatchEvent(
|
|
176
176
|
new CustomEvent('vaadin-overlay-touch-action', {
|
|
177
|
-
detail: { sourceEvent: sourceEvent }
|
|
178
|
-
})
|
|
177
|
+
detail: { sourceEvent: sourceEvent },
|
|
178
|
+
}),
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -265,7 +265,7 @@ export class ComboBoxDropdown extends PolymerElement {
|
|
|
265
265
|
itemIdPath,
|
|
266
266
|
focusedIndex,
|
|
267
267
|
renderer,
|
|
268
|
-
theme
|
|
268
|
+
theme,
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
}
|
|
@@ -79,7 +79,7 @@ export class ComboBoxItem extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
79
79
|
selected: {
|
|
80
80
|
type: Boolean,
|
|
81
81
|
value: false,
|
|
82
|
-
reflectToAttribute: true
|
|
82
|
+
reflectToAttribute: true,
|
|
83
83
|
},
|
|
84
84
|
|
|
85
85
|
/**
|
|
@@ -88,7 +88,7 @@ export class ComboBoxItem extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
88
88
|
focused: {
|
|
89
89
|
type: Boolean,
|
|
90
90
|
value: false,
|
|
91
|
-
reflectToAttribute: true
|
|
91
|
+
reflectToAttribute: true,
|
|
92
92
|
},
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -99,7 +99,7 @@ export class ComboBoxItem extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
99
99
|
/**
|
|
100
100
|
* Saved instance of a custom renderer function.
|
|
101
101
|
*/
|
|
102
|
-
_oldRenderer: Function
|
|
102
|
+
_oldRenderer: Function,
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -133,7 +133,7 @@ export class ComboBoxItem extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
133
133
|
index: this.index,
|
|
134
134
|
item: this.item,
|
|
135
135
|
focused: this.focused,
|
|
136
|
-
selected: this.selected
|
|
136
|
+
selected: this.selected,
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
this.renderer(this, this._comboBox, model);
|
|
@@ -13,7 +13,7 @@ import { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';
|
|
|
13
13
|
export {
|
|
14
14
|
ComboBoxDataProvider,
|
|
15
15
|
ComboBoxDataProviderCallback,
|
|
16
|
-
ComboBoxDataProviderParams
|
|
16
|
+
ComboBoxDataProviderParams,
|
|
17
17
|
} from './vaadin-combo-box-data-provider-mixin.js';
|
|
18
18
|
export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
|
|
19
19
|
|
|
@@ -126,13 +126,13 @@ declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
|
|
|
126
126
|
addEventListener<K extends keyof ComboBoxLightEventMap<TItem>>(
|
|
127
127
|
type: K,
|
|
128
128
|
listener: (this: ComboBoxLight<TItem>, ev: ComboBoxLightEventMap<TItem>[K]) => void,
|
|
129
|
-
options?: boolean | AddEventListenerOptions
|
|
129
|
+
options?: boolean | AddEventListenerOptions,
|
|
130
130
|
): void;
|
|
131
131
|
|
|
132
132
|
removeEventListener<K extends keyof ComboBoxLightEventMap<TItem>>(
|
|
133
133
|
type: K,
|
|
134
134
|
listener: (this: ComboBoxLight<TItem>, ev: ComboBoxLightEventMap<TItem>[K]) => void,
|
|
135
|
-
options?: boolean | EventListenerOptions
|
|
135
|
+
options?: boolean | EventListenerOptions,
|
|
136
136
|
): void;
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -19,11 +19,11 @@ export interface ComboBoxItemModel<TItem> {
|
|
|
19
19
|
export type ComboBoxRenderer<TItem> = (
|
|
20
20
|
root: HTMLElement,
|
|
21
21
|
comboBox: ComboBox<TItem>,
|
|
22
|
-
model: ComboBoxItemModel<TItem
|
|
22
|
+
model: ComboBoxItemModel<TItem>,
|
|
23
23
|
) => void;
|
|
24
24
|
|
|
25
25
|
export declare function ComboBoxMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
26
|
-
base: T
|
|
26
|
+
base: T,
|
|
27
27
|
): T &
|
|
28
28
|
Constructor<ComboBoxMixinClass<TItem>> &
|
|
29
29
|
Constructor<DisabledMixinClass> &
|
|
@@ -29,7 +29,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
29
29
|
notify: true,
|
|
30
30
|
value: false,
|
|
31
31
|
reflectToAttribute: true,
|
|
32
|
-
observer: '_openedChanged'
|
|
32
|
+
observer: '_openedChanged',
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -37,7 +37,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
37
37
|
* @attr {boolean} auto-open-disabled
|
|
38
38
|
*/
|
|
39
39
|
autoOpenDisabled: {
|
|
40
|
-
type: Boolean
|
|
40
|
+
type: Boolean,
|
|
41
41
|
},
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -47,7 +47,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
47
47
|
readonly: {
|
|
48
48
|
type: Boolean,
|
|
49
49
|
value: false,
|
|
50
|
-
reflectToAttribute: true
|
|
50
|
+
reflectToAttribute: true,
|
|
51
51
|
},
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -71,7 +71,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
71
71
|
*/
|
|
72
72
|
items: {
|
|
73
73
|
type: Array,
|
|
74
|
-
observer: '_itemsChanged'
|
|
74
|
+
observer: '_itemsChanged',
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
/**
|
|
@@ -84,7 +84,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
84
84
|
*/
|
|
85
85
|
allowCustomValue: {
|
|
86
86
|
type: Boolean,
|
|
87
|
-
value: false
|
|
87
|
+
value: false,
|
|
88
88
|
},
|
|
89
89
|
|
|
90
90
|
/**
|
|
@@ -94,7 +94,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
94
94
|
* @type {!Array<!ComboBoxItem | string> | undefined}
|
|
95
95
|
*/
|
|
96
96
|
filteredItems: {
|
|
97
|
-
type: Array
|
|
97
|
+
type: Array,
|
|
98
98
|
},
|
|
99
99
|
|
|
100
100
|
/**
|
|
@@ -111,7 +111,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
111
111
|
type: Boolean,
|
|
112
112
|
value: false,
|
|
113
113
|
reflectToAttribute: true,
|
|
114
|
-
observer: '_loadingChanged'
|
|
114
|
+
observer: '_loadingChanged',
|
|
115
115
|
},
|
|
116
116
|
|
|
117
117
|
/**
|
|
@@ -121,7 +121,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
121
121
|
_focusedIndex: {
|
|
122
122
|
type: Number,
|
|
123
123
|
observer: '_focusedIndexChanged',
|
|
124
|
-
value: -1
|
|
124
|
+
value: -1,
|
|
125
125
|
},
|
|
126
126
|
|
|
127
127
|
/**
|
|
@@ -131,7 +131,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
131
131
|
filter: {
|
|
132
132
|
type: String,
|
|
133
133
|
value: '',
|
|
134
|
-
notify: true
|
|
134
|
+
notify: true,
|
|
135
135
|
},
|
|
136
136
|
|
|
137
137
|
/**
|
|
@@ -140,7 +140,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
140
140
|
*/
|
|
141
141
|
selectedItem: {
|
|
142
142
|
type: Object,
|
|
143
|
-
notify: true
|
|
143
|
+
notify: true,
|
|
144
144
|
},
|
|
145
145
|
|
|
146
146
|
/**
|
|
@@ -156,7 +156,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
156
156
|
itemLabelPath: {
|
|
157
157
|
type: String,
|
|
158
158
|
value: 'label',
|
|
159
|
-
observer: '_itemLabelPathChanged'
|
|
159
|
+
observer: '_itemLabelPathChanged',
|
|
160
160
|
},
|
|
161
161
|
|
|
162
162
|
/**
|
|
@@ -171,7 +171,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
171
171
|
*/
|
|
172
172
|
itemValuePath: {
|
|
173
173
|
type: String,
|
|
174
|
-
value: 'value'
|
|
174
|
+
value: 'value',
|
|
175
175
|
},
|
|
176
176
|
|
|
177
177
|
/**
|
|
@@ -189,14 +189,14 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
189
189
|
*/
|
|
190
190
|
_toggleElement: {
|
|
191
191
|
type: Object,
|
|
192
|
-
observer: '_toggleElementChanged'
|
|
192
|
+
observer: '_toggleElementChanged',
|
|
193
193
|
},
|
|
194
194
|
|
|
195
195
|
/** @private */
|
|
196
196
|
_closeOnBlurIsPrevented: Boolean,
|
|
197
197
|
|
|
198
198
|
/** @private */
|
|
199
|
-
__restoreFocusOnClose: Boolean
|
|
199
|
+
__restoreFocusOnClose: Boolean,
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
|
|
@@ -205,7 +205,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
205
205
|
'_filterChanged(filter, itemValuePath, itemLabelPath)',
|
|
206
206
|
'_itemsOrPathsChanged(items.*, itemValuePath, itemLabelPath)',
|
|
207
207
|
'_filteredItemsChanged(filteredItems.*, itemValuePath, itemLabelPath)',
|
|
208
|
-
'_selectedItemChanged(selectedItem, itemValuePath, itemLabelPath)'
|
|
208
|
+
'_selectedItemChanged(selectedItem, itemValuePath, itemLabelPath)',
|
|
209
209
|
];
|
|
210
210
|
}
|
|
211
211
|
|
|
@@ -742,7 +742,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
742
742
|
detail: customValue,
|
|
743
743
|
composed: true,
|
|
744
744
|
cancelable: true,
|
|
745
|
-
bubbles: true
|
|
745
|
+
bubbles: true,
|
|
746
746
|
});
|
|
747
747
|
this.dispatchEvent(e);
|
|
748
748
|
if (!e.defaultPrevented) {
|
|
@@ -976,10 +976,11 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
976
976
|
this._selectItemForValue(this.value);
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
-
|
|
979
|
+
const inputValue = this._inputElementValue;
|
|
980
|
+
if (inputValue === undefined || inputValue === this._getItemLabel(this.selectedItem)) {
|
|
980
981
|
// When the input element value is the same as the current value or not defined,
|
|
981
982
|
// set the focused index to the item that matches the value.
|
|
982
|
-
this._focusedIndex = this.
|
|
983
|
+
this._focusedIndex = this.$.dropdown.indexOfLabel(this._getItemLabel(this.selectedItem));
|
|
983
984
|
} else {
|
|
984
985
|
// When the user filled in something that is different from the current value = filtering is enabled,
|
|
985
986
|
// set the focused index to the item that matches the filter query.
|
|
@@ -56,7 +56,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
56
56
|
*/
|
|
57
57
|
items: {
|
|
58
58
|
type: Array,
|
|
59
|
-
observer: '__itemsChanged'
|
|
59
|
+
observer: '__itemsChanged',
|
|
60
60
|
},
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -65,7 +65,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
65
65
|
*/
|
|
66
66
|
focusedIndex: {
|
|
67
67
|
type: Number,
|
|
68
|
-
observer: '__focusedIndexChanged'
|
|
68
|
+
observer: '__focusedIndexChanged',
|
|
69
69
|
},
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -73,7 +73,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
73
73
|
*/
|
|
74
74
|
loading: {
|
|
75
75
|
type: Boolean,
|
|
76
|
-
observer: '__loadingChanged'
|
|
76
|
+
observer: '__loadingChanged',
|
|
77
77
|
},
|
|
78
78
|
|
|
79
79
|
/**
|
|
@@ -82,35 +82,35 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
82
82
|
*/
|
|
83
83
|
opened: {
|
|
84
84
|
type: Boolean,
|
|
85
|
-
observer: '__openedChanged'
|
|
85
|
+
observer: '__openedChanged',
|
|
86
86
|
},
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* The selected item from the `items` array.
|
|
90
90
|
*/
|
|
91
91
|
selectedItem: {
|
|
92
|
-
type: Object
|
|
92
|
+
type: Object,
|
|
93
93
|
},
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Path for the id of the item, used to detect whether the item is selected.
|
|
97
97
|
*/
|
|
98
98
|
itemIdPath: {
|
|
99
|
-
type: String
|
|
99
|
+
type: String,
|
|
100
100
|
},
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* Reference to the combo-box, used by the item elements.
|
|
104
104
|
*/
|
|
105
105
|
comboBox: {
|
|
106
|
-
type: Object
|
|
106
|
+
type: Object,
|
|
107
107
|
},
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Function used to set a label for every combo-box item.
|
|
111
111
|
*/
|
|
112
112
|
getItemLabel: {
|
|
113
|
-
type: Object
|
|
113
|
+
type: Object,
|
|
114
114
|
},
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -118,15 +118,15 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
118
118
|
*/
|
|
119
119
|
renderer: {
|
|
120
120
|
type: Object,
|
|
121
|
-
observer: '__rendererChanged'
|
|
121
|
+
observer: '__rendererChanged',
|
|
122
122
|
},
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Used to propagate the `theme` attribute from the host element.
|
|
126
126
|
*/
|
|
127
127
|
theme: {
|
|
128
|
-
type: String
|
|
129
|
-
}
|
|
128
|
+
type: String,
|
|
129
|
+
},
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -159,7 +159,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
159
159
|
updateElement: this.__updateElement.bind(this),
|
|
160
160
|
elementsContainer: this,
|
|
161
161
|
scrollTarget: this,
|
|
162
|
-
scrollContainer: this.$.selector
|
|
162
|
+
scrollContainer: this.$.selector,
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -193,7 +193,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
193
193
|
|
|
194
194
|
// Sometimes the item is partly below the bottom edge, detect and adjust.
|
|
195
195
|
const lastPhysicalItem = [...this.children].find(
|
|
196
|
-
(el) => !el.hidden && el.index === this.__virtualizer.lastVisibleIndex
|
|
196
|
+
(el) => !el.hidden && el.index === this.__virtualizer.lastVisibleIndex,
|
|
197
197
|
);
|
|
198
198
|
if (!lastPhysicalItem || index !== lastPhysicalItem.index) {
|
|
199
199
|
return;
|
|
@@ -259,7 +259,9 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
259
259
|
this.requestContentUpdate();
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
// Do not jump back to the previously focused item while loading
|
|
263
|
+
// when requesting next page from the data provider on scroll.
|
|
264
|
+
if (index >= 0 && !this.loading) {
|
|
263
265
|
this.scrollIntoView(index);
|
|
264
266
|
}
|
|
265
267
|
}
|
|
@@ -294,7 +296,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
294
296
|
label: this.getItemLabel(item),
|
|
295
297
|
selected: this.__isItemSelected(item, this.selectedItem, this.itemIdPath),
|
|
296
298
|
renderer: this.renderer,
|
|
297
|
-
focused: this.__isItemFocused(focusedIndex, index)
|
|
299
|
+
focused: this.__isItemFocused(focusedIndex, index),
|
|
298
300
|
});
|
|
299
301
|
|
|
300
302
|
el.id = `${this.__hostTagName}-item-${index}`;
|
|
@@ -355,7 +357,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
355
357
|
__requestItemByIndex(item, index) {
|
|
356
358
|
if (item instanceof ComboBoxPlaceholder && index !== undefined) {
|
|
357
359
|
this.dispatchEvent(
|
|
358
|
-
new CustomEvent('index-requested', { detail: { index, currentScrollerPos: this._oldScrollerPosition } })
|
|
360
|
+
new CustomEvent('index-requested', { detail: { index, currentScrollerPos: this._oldScrollerPosition } }),
|
|
359
361
|
);
|
|
360
362
|
}
|
|
361
363
|
|
|
@@ -24,7 +24,7 @@ import { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';
|
|
|
24
24
|
export {
|
|
25
25
|
ComboBoxDataProvider,
|
|
26
26
|
ComboBoxDataProviderCallback,
|
|
27
|
-
ComboBoxDataProviderParams
|
|
27
|
+
ComboBoxDataProviderParams,
|
|
28
28
|
} from './vaadin-combo-box-data-provider-mixin.js';
|
|
29
29
|
export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
|
|
30
30
|
|
|
@@ -212,13 +212,13 @@ declare class ComboBox<TItem = ComboBoxDefaultItem> extends HTMLElement {
|
|
|
212
212
|
addEventListener<K extends keyof ComboBoxEventMap<TItem>>(
|
|
213
213
|
type: K,
|
|
214
214
|
listener: (this: ComboBox<TItem>, ev: ComboBoxEventMap<TItem>[K]) => void,
|
|
215
|
-
options?: boolean | AddEventListenerOptions
|
|
215
|
+
options?: boolean | AddEventListenerOptions,
|
|
216
216
|
): void;
|
|
217
217
|
|
|
218
218
|
removeEventListener<K extends keyof ComboBoxEventMap<TItem>>(
|
|
219
219
|
type: K,
|
|
220
220
|
listener: (this: ComboBox<TItem>, ev: ComboBoxEventMap<TItem>[K]) => void,
|
|
221
|
-
options?: boolean | EventListenerOptions
|
|
221
|
+
options?: boolean | EventListenerOptions,
|
|
222
222
|
): void;
|
|
223
223
|
}
|
|
224
224
|
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -154,7 +154,7 @@ registerStyles('vaadin-combo-box', inputFieldShared, { moduleId: 'vaadin-combo-b
|
|
|
154
154
|
* @mixes ComboBoxMixin
|
|
155
155
|
*/
|
|
156
156
|
class ComboBox extends ComboBoxDataProviderMixin(
|
|
157
|
-
ComboBoxMixin(PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(PolymerElement)))))
|
|
157
|
+
ComboBoxMixin(PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(PolymerElement))))),
|
|
158
158
|
) {
|
|
159
159
|
static get is() {
|
|
160
160
|
return 'vaadin-combo-box';
|
|
@@ -218,8 +218,8 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
218
218
|
* @protected
|
|
219
219
|
*/
|
|
220
220
|
_positionTarget: {
|
|
221
|
-
type: Object
|
|
222
|
-
}
|
|
221
|
+
type: Object,
|
|
222
|
+
},
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -242,7 +242,7 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
242
242
|
this._setFocusElement(input);
|
|
243
243
|
this.stateTarget = input;
|
|
244
244
|
this.ariaTarget = input;
|
|
245
|
-
})
|
|
245
|
+
}),
|
|
246
246
|
);
|
|
247
247
|
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
248
248
|
this._positionTarget = this.shadowRoot.querySelector('[part="input-field"]');
|