@vaadin/select 24.2.0-alpha5 → 24.2.0-alpha7
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/vaadin-select-base-mixin.js +27 -9
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "24.2.0-
|
|
3
|
+
"version": "24.2.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
49
49
|
"@polymer/polymer": "^3.2.0",
|
|
50
|
-
"@vaadin/a11y-base": "24.2.0-
|
|
51
|
-
"@vaadin/button": "24.2.0-
|
|
52
|
-
"@vaadin/component-base": "24.2.0-
|
|
53
|
-
"@vaadin/field-base": "24.2.0-
|
|
54
|
-
"@vaadin/input-container": "24.2.0-
|
|
55
|
-
"@vaadin/item": "24.2.0-
|
|
56
|
-
"@vaadin/list-box": "24.2.0-
|
|
57
|
-
"@vaadin/lit-renderer": "24.2.0-
|
|
58
|
-
"@vaadin/overlay": "24.2.0-
|
|
59
|
-
"@vaadin/vaadin-lumo-styles": "24.2.0-
|
|
60
|
-
"@vaadin/vaadin-material-styles": "24.2.0-
|
|
61
|
-
"@vaadin/vaadin-themable-mixin": "24.2.0-
|
|
50
|
+
"@vaadin/a11y-base": "24.2.0-alpha7",
|
|
51
|
+
"@vaadin/button": "24.2.0-alpha7",
|
|
52
|
+
"@vaadin/component-base": "24.2.0-alpha7",
|
|
53
|
+
"@vaadin/field-base": "24.2.0-alpha7",
|
|
54
|
+
"@vaadin/input-container": "24.2.0-alpha7",
|
|
55
|
+
"@vaadin/item": "24.2.0-alpha7",
|
|
56
|
+
"@vaadin/list-box": "24.2.0-alpha7",
|
|
57
|
+
"@vaadin/lit-renderer": "24.2.0-alpha7",
|
|
58
|
+
"@vaadin/overlay": "24.2.0-alpha7",
|
|
59
|
+
"@vaadin/vaadin-lumo-styles": "24.2.0-alpha7",
|
|
60
|
+
"@vaadin/vaadin-material-styles": "24.2.0-alpha7",
|
|
61
|
+
"@vaadin/vaadin-themable-mixin": "24.2.0-alpha7"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"web-types.json",
|
|
71
71
|
"web-types.lit.json"
|
|
72
72
|
],
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "81ecf12d2d59a3e5b467273c37a391e31932dc9c"
|
|
74
74
|
}
|
|
@@ -259,8 +259,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
259
259
|
menuElement.addEventListener(
|
|
260
260
|
'click',
|
|
261
261
|
() => {
|
|
262
|
-
this.
|
|
263
|
-
this.opened = false;
|
|
262
|
+
this.__dispatchChangePending = true;
|
|
264
263
|
},
|
|
265
264
|
true,
|
|
266
265
|
);
|
|
@@ -281,8 +280,10 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
281
280
|
_valueChanged(value, oldValue) {
|
|
282
281
|
this.toggleAttribute('has-value', Boolean(value));
|
|
283
282
|
|
|
284
|
-
//
|
|
285
|
-
|
|
283
|
+
// Skip validation during initialization and when
|
|
284
|
+
// a change event is scheduled, as validation will be
|
|
285
|
+
// triggered by `__dispatchChange()` in that case.
|
|
286
|
+
if (oldValue !== undefined && !this.__dispatchChangePending) {
|
|
286
287
|
this.validate();
|
|
287
288
|
}
|
|
288
289
|
}
|
|
@@ -322,7 +323,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
322
323
|
const currentIdx = selected !== undefined ? selected : -1;
|
|
323
324
|
const newIdx = this._menuElement._searchKey(currentIdx, e.key);
|
|
324
325
|
if (newIdx >= 0) {
|
|
325
|
-
this.
|
|
326
|
+
this.__dispatchChangePending = true;
|
|
326
327
|
|
|
327
328
|
// Announce the value selected with the first letter shortcut
|
|
328
329
|
this._updateAriaLive(true);
|
|
@@ -371,7 +372,12 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
371
372
|
if (this._openedWithFocusRing) {
|
|
372
373
|
this.setAttribute('focus-ring', '');
|
|
373
374
|
}
|
|
374
|
-
|
|
375
|
+
|
|
376
|
+
// Skip validation when a change event is scheduled, as validation
|
|
377
|
+
// will be triggered by `__dispatchChange()` in that case.
|
|
378
|
+
if (!this.__dispatchChangePending) {
|
|
379
|
+
this.validate();
|
|
380
|
+
}
|
|
375
381
|
}
|
|
376
382
|
}
|
|
377
383
|
|
|
@@ -508,10 +514,9 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
508
514
|
if (!this._valueChanging) {
|
|
509
515
|
this._selectedChanging = true;
|
|
510
516
|
this.value = selected.value || '';
|
|
511
|
-
if (this.
|
|
517
|
+
if (this.__dispatchChangePending) {
|
|
512
518
|
this.opened = false;
|
|
513
|
-
this.
|
|
514
|
-
this.__userInteraction = false;
|
|
519
|
+
this.__dispatchChange();
|
|
515
520
|
}
|
|
516
521
|
delete this._selectedChanging;
|
|
517
522
|
}
|
|
@@ -600,4 +605,17 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
600
605
|
listBox.appendChild(this.__createItemElement(item));
|
|
601
606
|
});
|
|
602
607
|
}
|
|
608
|
+
|
|
609
|
+
/** @private */
|
|
610
|
+
async __dispatchChange() {
|
|
611
|
+
// Wait for the update complete to guarantee that value-changed is fired
|
|
612
|
+
// before validated and change events when using the Lit version of the component.
|
|
613
|
+
if (this.updateComplete) {
|
|
614
|
+
await this.updateComplete;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
this.validate();
|
|
618
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
619
|
+
this.__dispatchChangePending = false;
|
|
620
|
+
}
|
|
603
621
|
};
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/select",
|
|
4
|
-
"version": "24.2.0-
|
|
4
|
+
"version": "24.2.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-select",
|
|
11
|
-
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-
|
|
11
|
+
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-text-field) for the styling documentation.\n\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-----------------------------|-----------\n`opened` | Set when the select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
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/select",
|
|
4
|
-
"version": "24.2.0-
|
|
4
|
+
"version": "24.2.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-select",
|
|
19
|
-
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-
|
|
19
|
+
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-text-field) for the styling documentation.\n\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-----------------------------|-----------\n`opened` | Set when the select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha7/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|