@vaadin/combo-box 24.4.0-alpha9 → 24.4.0-dev.4b20a0c55
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/README.md +0 -1
- package/package.json +13 -13
- package/src/vaadin-combo-box-data-provider-mixin.js +111 -120
- package/src/vaadin-combo-box-light-mixin.d.ts +26 -0
- package/src/vaadin-combo-box-light-mixin.js +140 -0
- package/src/vaadin-combo-box-light.d.ts +2 -7
- package/src/vaadin-combo-box-light.js +3 -127
- package/src/vaadin-combo-box-mixin.js +7 -7
- package/src/vaadin-combo-box-scroller-mixin.js +1 -0
- package/theme/lumo/vaadin-combo-box-item-styles.js +2 -4
- package/theme/lumo/vaadin-combo-box-item-styles.d.ts +0 -5
- package/theme/lumo/vaadin-combo-box-light.d.ts +0 -3
- package/theme/lumo/vaadin-combo-box-overlay-styles.d.ts +0 -6
- package/theme/lumo/vaadin-combo-box-styles.d.ts +0 -2
- package/theme/lumo/vaadin-combo-box.d.ts +0 -4
- package/theme/material/vaadin-combo-box-item-styles.d.ts +0 -5
- package/theme/material/vaadin-combo-box-light.d.ts +0 -3
- package/theme/material/vaadin-combo-box-overlay-styles.d.ts +0 -4
- package/theme/material/vaadin-combo-box-styles.d.ts +0 -3
- package/theme/material/vaadin-combo-box.d.ts +0 -4
- package/web-types.json +0 -1188
- package/web-types.lit.json +0 -573
|
@@ -6,14 +6,10 @@
|
|
|
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 { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
10
|
-
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
11
9
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
12
10
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
|
-
import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
|
|
14
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
|
-
import {
|
|
16
|
-
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
12
|
+
import { ComboBoxLightMixin } from './vaadin-combo-box-light-mixin.js';
|
|
17
13
|
|
|
18
14
|
/**
|
|
19
15
|
* `<vaadin-combo-box-light>` is a customizable version of the `<vaadin-combo-box>` providing
|
|
@@ -63,12 +59,10 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
|
63
59
|
*
|
|
64
60
|
* @customElement
|
|
65
61
|
* @extends HTMLElement
|
|
66
|
-
* @mixes
|
|
67
|
-
* @mixes ComboBoxMixin
|
|
62
|
+
* @mixes ComboBoxLightMixin
|
|
68
63
|
* @mixes ThemableMixin
|
|
69
|
-
* @mixes ValidateMixin
|
|
70
64
|
*/
|
|
71
|
-
class ComboBoxLight extends
|
|
65
|
+
class ComboBoxLight extends ComboBoxLightMixin(ThemableMixin(PolymerElement)) {
|
|
72
66
|
static get is() {
|
|
73
67
|
return 'vaadin-combo-box-light';
|
|
74
68
|
}
|
|
@@ -94,124 +88,6 @@ class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixi
|
|
|
94
88
|
></vaadin-combo-box-overlay>
|
|
95
89
|
`;
|
|
96
90
|
}
|
|
97
|
-
|
|
98
|
-
static get properties() {
|
|
99
|
-
return {
|
|
100
|
-
/**
|
|
101
|
-
* Name of the two-way data-bindable property representing the
|
|
102
|
-
* value of the custom input field.
|
|
103
|
-
* @attr {string} attr-for-value
|
|
104
|
-
* @type {string}
|
|
105
|
-
*/
|
|
106
|
-
attrForValue: {
|
|
107
|
-
type: String,
|
|
108
|
-
value: 'value',
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
115
|
-
* @protected
|
|
116
|
-
* @return {!HTMLElement}
|
|
117
|
-
*/
|
|
118
|
-
get clearElement() {
|
|
119
|
-
return this.querySelector('.clear-button');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Override this getter from `InputMixin` to allow using
|
|
124
|
-
* an arbitrary property name instead of `value`
|
|
125
|
-
* for accessing the input element's value.
|
|
126
|
-
*
|
|
127
|
-
* @protected
|
|
128
|
-
* @override
|
|
129
|
-
* @return {string}
|
|
130
|
-
*/
|
|
131
|
-
get _inputElementValueProperty() {
|
|
132
|
-
return dashToCamelCase(this.attrForValue);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* @protected
|
|
137
|
-
* @override
|
|
138
|
-
* @return {HTMLInputElement | undefined}
|
|
139
|
-
*/
|
|
140
|
-
get _nativeInput() {
|
|
141
|
-
const input = this.inputElement;
|
|
142
|
-
|
|
143
|
-
if (input) {
|
|
144
|
-
// Support `<input class="input">`
|
|
145
|
-
if (input instanceof HTMLInputElement) {
|
|
146
|
-
return input;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Support `<input>` in light DOM (e.g. `vaadin-text-field`)
|
|
150
|
-
const slottedInput = input.querySelector('input');
|
|
151
|
-
if (slottedInput) {
|
|
152
|
-
return slottedInput;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (input.shadowRoot) {
|
|
156
|
-
// Support `<input>` in Shadow DOM (e.g. `mwc-textfield`)
|
|
157
|
-
const shadowInput = input.shadowRoot.querySelector('input');
|
|
158
|
-
if (shadowInput) {
|
|
159
|
-
return shadowInput;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/** @protected */
|
|
168
|
-
ready() {
|
|
169
|
-
super.ready();
|
|
170
|
-
|
|
171
|
-
this._toggleElement = this.querySelector('.toggle-button');
|
|
172
|
-
|
|
173
|
-
// Wait until the slotted input DOM is ready
|
|
174
|
-
afterNextRender(this, () => {
|
|
175
|
-
this._setInputElement(this.querySelector('vaadin-text-field,.input'));
|
|
176
|
-
this._revertInputValue();
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Returns true if the current input value satisfies all constraints (if any).
|
|
182
|
-
* @return {boolean}
|
|
183
|
-
*/
|
|
184
|
-
checkValidity() {
|
|
185
|
-
if (this.inputElement && this.inputElement.validate) {
|
|
186
|
-
return this.inputElement.validate();
|
|
187
|
-
}
|
|
188
|
-
return super.checkValidity();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/** @protected */
|
|
192
|
-
_isClearButton(event) {
|
|
193
|
-
return (
|
|
194
|
-
super._isClearButton(event) ||
|
|
195
|
-
(event.type === 'input' && !event.isTrusted) || // Fake input event dispatched by clear button
|
|
196
|
-
event.composedPath()[0].getAttribute('part') === 'clear-button'
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @protected
|
|
202
|
-
* @override
|
|
203
|
-
*/
|
|
204
|
-
_shouldRemoveFocus(event) {
|
|
205
|
-
const isBlurringControlButtons = event.target === this._toggleElement || event.target === this.clearElement;
|
|
206
|
-
const isFocusingInputElement = event.relatedTarget && event.relatedTarget === this._nativeInput;
|
|
207
|
-
|
|
208
|
-
// prevent closing the overlay when moving focus from clear or toggle buttons to the internal input
|
|
209
|
-
if (isBlurringControlButtons && isFocusingInputElement) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return super._shouldRemoveFocus(event);
|
|
214
|
-
}
|
|
215
91
|
}
|
|
216
92
|
|
|
217
93
|
defineCustomElement(ComboBoxLight);
|
|
@@ -259,7 +259,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
259
259
|
static get observers() {
|
|
260
260
|
return [
|
|
261
261
|
'_selectedItemChanged(selectedItem, itemValuePath, itemLabelPath)',
|
|
262
|
-
'_openedOrItemsChanged(opened, _dropdownItems, loading)',
|
|
262
|
+
'_openedOrItemsChanged(opened, _dropdownItems, loading, _keepOverlayOpened)',
|
|
263
263
|
'_updateScroller(_scroller, _dropdownItems, opened, loading, selectedItem, itemIdPath, _focusedIndex, renderer, theme)',
|
|
264
264
|
];
|
|
265
265
|
}
|
|
@@ -487,10 +487,10 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
/** @private */
|
|
490
|
-
_openedOrItemsChanged(opened, items, loading) {
|
|
490
|
+
_openedOrItemsChanged(opened, items, loading, keepOverlayOpened) {
|
|
491
491
|
// Close the overlay if there are no items to display.
|
|
492
492
|
// See https://github.com/vaadin/vaadin-combo-box/pull/964
|
|
493
|
-
this._overlayOpened = !!(opened && (loading || (items && items.length)));
|
|
493
|
+
this._overlayOpened = !!(opened && (keepOverlayOpened || loading || (items && items.length)));
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
/** @private */
|
|
@@ -542,7 +542,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
if (opened) {
|
|
545
|
-
this._openedWithFocusRing = this.hasAttribute('focus-ring');
|
|
546
545
|
// For touch devices, we don't want to popup virtual keyboard
|
|
547
546
|
// unless input element is explicitly focused by the user.
|
|
548
547
|
if (!this._isInputFocused() && !isTouch) {
|
|
@@ -554,9 +553,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
554
553
|
this._overlayElement.restoreFocusOnClose = true;
|
|
555
554
|
} else {
|
|
556
555
|
this._onClosed();
|
|
557
|
-
if (this._openedWithFocusRing && this._isInputFocused()) {
|
|
558
|
-
this.setAttribute('focus-ring', '');
|
|
559
|
-
}
|
|
560
556
|
}
|
|
561
557
|
|
|
562
558
|
const input = this._nativeInput;
|
|
@@ -1130,6 +1126,10 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
1130
1126
|
this.items = oldItems;
|
|
1131
1127
|
});
|
|
1132
1128
|
|
|
1129
|
+
if (this.dataProvider) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
1133
|
if (items) {
|
|
1134
1134
|
this.filteredItems = items.slice(0);
|
|
1135
1135
|
} else if (oldItems) {
|
|
@@ -13,10 +13,8 @@ const comboBoxItem = css`
|
|
|
13
13
|
--_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
:
|
|
18
|
-
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
|
|
19
|
-
}
|
|
16
|
+
:host([focused]:not([disabled])) {
|
|
17
|
+
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
|
|
20
18
|
}
|
|
21
19
|
`;
|
|
22
20
|
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
4
|
-
declare const comboBoxOverlay: import("lit").CSSResult;
|
|
5
|
-
declare const comboBoxLoader: import("lit").CSSResult;
|
|
6
|
-
export { comboBoxLoader, comboBoxOverlay };
|