@vaadin/select 23.1.1 → 23.1.4
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 +15 -15
- package/src/vaadin-select.d.ts +6 -10
- package/src/vaadin-select.js +16 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.2.0",
|
|
39
|
-
"@vaadin/button": "^23.1.
|
|
40
|
-
"@vaadin/component-base": "^23.1.
|
|
41
|
-
"@vaadin/field-base": "^23.1.
|
|
42
|
-
"@vaadin/input-container": "^23.1.
|
|
43
|
-
"@vaadin/item": "^23.1.
|
|
44
|
-
"@vaadin/list-box": "^23.1.
|
|
45
|
-
"@vaadin/lit-renderer": "^23.1.
|
|
46
|
-
"@vaadin/vaadin-list-mixin": "^23.1.
|
|
47
|
-
"@vaadin/vaadin-lumo-styles": "^23.1.
|
|
48
|
-
"@vaadin/vaadin-material-styles": "^23.1.
|
|
49
|
-
"@vaadin/vaadin-overlay": "^23.1.
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "^23.1.
|
|
39
|
+
"@vaadin/button": "^23.1.4",
|
|
40
|
+
"@vaadin/component-base": "^23.1.4",
|
|
41
|
+
"@vaadin/field-base": "^23.1.4",
|
|
42
|
+
"@vaadin/input-container": "^23.1.4",
|
|
43
|
+
"@vaadin/item": "^23.1.4",
|
|
44
|
+
"@vaadin/list-box": "^23.1.4",
|
|
45
|
+
"@vaadin/lit-renderer": "^23.1.4",
|
|
46
|
+
"@vaadin/vaadin-list-mixin": "^23.1.4",
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "^23.1.4",
|
|
48
|
+
"@vaadin/vaadin-material-styles": "^23.1.4",
|
|
49
|
+
"@vaadin/vaadin-overlay": "^23.1.4",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "^23.1.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
54
|
-
"@vaadin/polymer-legacy-adapter": "^23.1.
|
|
54
|
+
"@vaadin/polymer-legacy-adapter": "^23.1.4",
|
|
55
55
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
56
56
|
"lit": "^2.0.0",
|
|
57
57
|
"sinon": "^13.0.2"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "0a82302064f1276a000f0cbd810076539407d133"
|
|
60
60
|
}
|
package/src/vaadin-select.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
7
|
import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
|
|
8
8
|
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
9
|
+
import { DelegateStateMixin } from '@vaadin/field-base/src/delegate-state-mixin.js';
|
|
9
10
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
|
|
@@ -164,7 +165,9 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
|
|
|
164
165
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
165
166
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
166
167
|
*/
|
|
167
|
-
declare class Select extends DelegateFocusMixin(
|
|
168
|
+
declare class Select extends DelegateFocusMixin(
|
|
169
|
+
DelegateStateMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(HTMLElement))))),
|
|
170
|
+
) {
|
|
168
171
|
/**
|
|
169
172
|
* An array containing items that will be rendered as the options of the select.
|
|
170
173
|
*
|
|
@@ -245,23 +248,16 @@ declare class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixi
|
|
|
245
248
|
*/
|
|
246
249
|
requestContentUpdate(): void;
|
|
247
250
|
|
|
248
|
-
/**
|
|
249
|
-
* Returns true if `value` is valid, and sets the `invalid` flag appropriately.
|
|
250
|
-
*
|
|
251
|
-
* @returns True if the value is valid and sets the `invalid` flag appropriately
|
|
252
|
-
*/
|
|
253
|
-
validate(): boolean;
|
|
254
|
-
|
|
255
251
|
addEventListener<K extends keyof SelectEventMap>(
|
|
256
252
|
type: K,
|
|
257
253
|
listener: (this: Select, ev: SelectEventMap[K]) => void,
|
|
258
|
-
options?:
|
|
254
|
+
options?: AddEventListenerOptions | boolean,
|
|
259
255
|
): void;
|
|
260
256
|
|
|
261
257
|
removeEventListener<K extends keyof SelectEventMap>(
|
|
262
258
|
type: K,
|
|
263
259
|
listener: (this: Select, ev: SelectEventMap[K]) => void,
|
|
264
|
-
options?:
|
|
260
|
+
options?: EventListenerOptions | boolean,
|
|
265
261
|
): void;
|
|
266
262
|
}
|
|
267
263
|
|
package/src/vaadin-select.js
CHANGED
|
@@ -14,6 +14,7 @@ import { MediaQueryController } from '@vaadin/component-base/src/media-query-con
|
|
|
14
14
|
import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
|
|
15
15
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
16
16
|
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
17
|
+
import { DelegateStateMixin } from '@vaadin/field-base/src/delegate-state-mixin.js';
|
|
17
18
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
18
19
|
import { fieldShared } from '@vaadin/field-base/src/styles/field-shared-styles.js';
|
|
19
20
|
import { inputFieldContainer } from '@vaadin/field-base/src/styles/input-field-container-styles.js';
|
|
@@ -131,8 +132,11 @@ registerStyles('vaadin-select', [fieldShared, inputFieldContainer], { moduleId:
|
|
|
131
132
|
* @mixes SlotMixin
|
|
132
133
|
* @mixes FieldMixin
|
|
133
134
|
* @mixes DelegateFocusMixin
|
|
135
|
+
* @mixes DelegateStateMixin
|
|
134
136
|
*/
|
|
135
|
-
class Select extends DelegateFocusMixin(
|
|
137
|
+
class Select extends DelegateFocusMixin(
|
|
138
|
+
DelegateStateMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(PolymerElement))))),
|
|
139
|
+
) {
|
|
136
140
|
static get is() {
|
|
137
141
|
return 'vaadin-select';
|
|
138
142
|
}
|
|
@@ -302,10 +306,13 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
302
306
|
};
|
|
303
307
|
}
|
|
304
308
|
|
|
309
|
+
static get delegateAttrs() {
|
|
310
|
+
return [...super.delegateAttrs, 'invalid'];
|
|
311
|
+
}
|
|
312
|
+
|
|
305
313
|
static get observers() {
|
|
306
314
|
return [
|
|
307
315
|
'_updateAriaExpanded(opened)',
|
|
308
|
-
'_updateAriaRequired(required)',
|
|
309
316
|
'_updateSelectedItem(value, _items, placeholder)',
|
|
310
317
|
'_rendererChanged(renderer, _overlayElement)',
|
|
311
318
|
];
|
|
@@ -345,11 +352,11 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
345
352
|
if (this._valueButton) {
|
|
346
353
|
this._valueButton.setAttribute('aria-labelledby', `${this._labelId} ${this._fieldId}`);
|
|
347
354
|
|
|
348
|
-
this._updateAriaRequired(this.required);
|
|
349
355
|
this._updateAriaExpanded(this.opened);
|
|
350
356
|
|
|
351
357
|
this._setFocusElement(this._valueButton);
|
|
352
358
|
this.ariaTarget = this._valueButton;
|
|
359
|
+
this.stateTarget = this._valueButton;
|
|
353
360
|
|
|
354
361
|
this._valueButton.addEventListener('keydown', this._boundOnKeyDown);
|
|
355
362
|
}
|
|
@@ -568,13 +575,6 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
568
575
|
}
|
|
569
576
|
}
|
|
570
577
|
|
|
571
|
-
/** @private */
|
|
572
|
-
_updateAriaRequired(required) {
|
|
573
|
-
if (this._valueButton) {
|
|
574
|
-
this._valueButton.setAttribute('aria-required', required ? 'true' : 'false');
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
578
|
/** @private */
|
|
579
579
|
_updateAriaLive(ariaLive) {
|
|
580
580
|
if (this._valueButton) {
|
|
@@ -673,8 +673,9 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
673
673
|
/** @private */
|
|
674
674
|
_updateSelectedItem(value, items) {
|
|
675
675
|
if (items) {
|
|
676
|
+
const valueAsString = value == null ? value : value.toString();
|
|
676
677
|
this._menuElement.selected = items.reduce((prev, item, idx) => {
|
|
677
|
-
return prev === undefined && item.value ===
|
|
678
|
+
return prev === undefined && item.value === valueAsString ? idx : prev;
|
|
678
679
|
}, undefined);
|
|
679
680
|
if (!this._selectedChanging) {
|
|
680
681
|
this._valueChanging = true;
|
|
@@ -710,12 +711,12 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
710
711
|
}
|
|
711
712
|
|
|
712
713
|
/**
|
|
713
|
-
* Returns true if
|
|
714
|
+
* Returns true if the current value satisfies all constraints (if any)
|
|
714
715
|
*
|
|
715
|
-
* @return {boolean}
|
|
716
|
+
* @return {boolean}
|
|
716
717
|
*/
|
|
717
|
-
|
|
718
|
-
return
|
|
718
|
+
checkValidity() {
|
|
719
|
+
return this.disabled || !this.required || !!this.value;
|
|
719
720
|
}
|
|
720
721
|
|
|
721
722
|
/**
|