@vaadin/combo-box 25.2.0-alpha1 → 25.2.0-alpha10
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/custom-elements.json +591 -3
- package/package.json +14 -14
- package/src/vaadin-combo-box-mixin.js +1 -40
- package/src/vaadin-combo-box-scroll-to-index-mixin.d.ts +28 -0
- package/src/vaadin-combo-box-scroll-to-index-mixin.js +103 -0
- package/src/vaadin-combo-box-scroller-mixin.js +19 -0
- package/src/vaadin-combo-box.d.ts +4 -0
- package/src/vaadin-combo-box.js +9 -3
- package/web-types.json +66 -190
- package/web-types.lit.json +66 -73
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/combo-box",
|
|
4
|
-
"version": "25.2.0-
|
|
4
|
+
"version": "25.2.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,117 +16,75 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-combo-box",
|
|
19
|
-
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-
|
|
19
|
+
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-combo-box#property-items) property on the element.\n\n```html\n<vaadin-combo-box id=\"combo-box\"></vaadin-combo-box>\n```\n```js\ndocument.querySelector('#combo-box').items = ['apple', 'orange', 'banana'];\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Item rendering\n\nTo customize the content of the `<vaadin-combo-box-item>` elements placed in the dropdown, use\n[`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-combo-box#property-renderer) property which accepts a function.\nThe renderer function is called with `root`, `comboBox`, and `model` as arguments.\n\nGenerate DOM content by using `model` object properties if needed, and append it to the `root`\nelement. The `comboBox` reference is provided to access the combo-box element state. Do not\nset combo-box properties in a `renderer` function.\n\n```js\nconst comboBox = document.querySelector('#combo-box');\ncomboBox.items = [{'label': 'Hydrogen', 'value': 'H'}];\ncomboBox.renderer = (root, comboBox, model) => {\n const item = model.item;\n root.innerHTML = `${model.index}: ${item.label} <b>${item.value}</b>`;\n};\n```\n\nRenderer is called on the opening of the combo-box and each time the related model is updated.\nBefore creating new content, it is recommended to check if there is already an existing DOM\nelement in `root` from a previous renderer call for reusing it. Even though combo-box uses\ninfinite scrolling, reducing DOM operations might improve performance.\n\nThe following properties are available in the `model` argument:\n\nProperty | Type | Description\n-----------|------------------|-------------\n`index` | Number | Index of the item in the `items` array\n`item` | String or Object | The item reference\n`selected` | Boolean | True when item is selected\n`focused` | Boolean | True when item is focused\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively use the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-combo-box#property-dataProvider) function property.\nThe `<vaadin-combo-box>` calls this function lazily, only when it needs more data\nto be displayed.\n\n__Note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```js\ncomboBox.dataProvider = async (params, callback) => {\n const API = 'https://demo.vaadin.com/demo-data/1.0/filtered-countries';\n const { filter, page, pageSize } = params;\n const index = page * pageSize;\n\n const res = await fetch(`${API}?index=${index}&count=${pageSize}&filter=${filter}`);\n if (res.ok) {\n const { result, size } = await res.json();\n callback(result, size);\n }\n};\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n`loader` | The loading indicator shown while loading items\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`loading` | Set when loading items from the data provider\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha10/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
23
|
-
"name": "
|
|
24
|
-
"description": "
|
|
25
|
-
"value": {
|
|
26
|
-
"kind": "expression"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "?autofocus",
|
|
31
|
-
"description": "Specify that this control should have input focus when the page loads.",
|
|
32
|
-
"value": {
|
|
33
|
-
"kind": "expression"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": "?autoOpenDisabled",
|
|
38
|
-
"description": "Set true to prevent the overlay from opening automatically.",
|
|
39
|
-
"value": {
|
|
40
|
-
"kind": "expression"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"name": "?autoselect",
|
|
45
|
-
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
46
|
-
"value": {
|
|
47
|
-
"kind": "expression"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": "?clearButtonVisible",
|
|
52
|
-
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
53
|
-
"value": {
|
|
54
|
-
"kind": "expression"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "?disabled",
|
|
59
|
-
"description": "If true, the user cannot interact with this element.",
|
|
60
|
-
"value": {
|
|
61
|
-
"kind": "expression"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "?invalid",
|
|
66
|
-
"description": "Set to true when the field is invalid.",
|
|
23
|
+
"name": ".accessibleName",
|
|
24
|
+
"description": "String used to label the component to screen reader users.",
|
|
67
25
|
"value": {
|
|
68
26
|
"kind": "expression"
|
|
69
27
|
}
|
|
70
28
|
},
|
|
71
29
|
{
|
|
72
|
-
"name": "
|
|
73
|
-
"description": "
|
|
30
|
+
"name": ".accessibleNameRef",
|
|
31
|
+
"description": "Id of the element used as label of the component to screen reader users.",
|
|
74
32
|
"value": {
|
|
75
33
|
"kind": "expression"
|
|
76
34
|
}
|
|
77
35
|
},
|
|
78
36
|
{
|
|
79
|
-
"name": "?
|
|
80
|
-
"description": "
|
|
37
|
+
"name": "?allowCustomValue",
|
|
38
|
+
"description": "If `true`, the user can input a value that is not present in the items list.\n`value` property will be set to the input value in this case.\nAlso, when `value` is set programmatically, the input value will be set\nto reflect that value.",
|
|
81
39
|
"value": {
|
|
82
40
|
"kind": "expression"
|
|
83
41
|
}
|
|
84
42
|
},
|
|
85
43
|
{
|
|
86
|
-
"name": "
|
|
87
|
-
"description": "
|
|
44
|
+
"name": ".allowedCharPattern",
|
|
45
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
88
46
|
"value": {
|
|
89
47
|
"kind": "expression"
|
|
90
48
|
}
|
|
91
49
|
},
|
|
92
50
|
{
|
|
93
|
-
"name": "?
|
|
94
|
-
"description": "
|
|
51
|
+
"name": "?autofocus",
|
|
52
|
+
"description": "Specify that this control should have input focus when the page loads.",
|
|
95
53
|
"value": {
|
|
96
54
|
"kind": "expression"
|
|
97
55
|
}
|
|
98
56
|
},
|
|
99
57
|
{
|
|
100
|
-
"name": "?
|
|
101
|
-
"description": "
|
|
58
|
+
"name": "?autoOpenDisabled",
|
|
59
|
+
"description": "Set true to prevent the overlay from opening automatically.",
|
|
102
60
|
"value": {
|
|
103
61
|
"kind": "expression"
|
|
104
62
|
}
|
|
105
63
|
},
|
|
106
64
|
{
|
|
107
|
-
"name": "
|
|
108
|
-
"description": "
|
|
65
|
+
"name": "?autoselect",
|
|
66
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
109
67
|
"value": {
|
|
110
68
|
"kind": "expression"
|
|
111
69
|
}
|
|
112
70
|
},
|
|
113
71
|
{
|
|
114
|
-
"name": "
|
|
115
|
-
"description": "
|
|
72
|
+
"name": "?clearButtonVisible",
|
|
73
|
+
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
116
74
|
"value": {
|
|
117
75
|
"kind": "expression"
|
|
118
76
|
}
|
|
119
77
|
},
|
|
120
78
|
{
|
|
121
|
-
"name": ".
|
|
122
|
-
"description": "
|
|
79
|
+
"name": ".dataProvider",
|
|
80
|
+
"description": "Function that provides items lazily. Receives arguments `params`, `callback`\n\n`params.page` Requested page index\n\n`params.pageSize` Current page size\n\n`params.filter` Currently applied filter\n\n`callback(items, size)` Callback function with arguments:\n - `items` Current page of items\n - `size` Total number of items.",
|
|
123
81
|
"value": {
|
|
124
82
|
"kind": "expression"
|
|
125
83
|
}
|
|
126
84
|
},
|
|
127
85
|
{
|
|
128
|
-
"name": "
|
|
129
|
-
"description": "
|
|
86
|
+
"name": "?disabled",
|
|
87
|
+
"description": "If true, the user cannot interact with this element.",
|
|
130
88
|
"value": {
|
|
131
89
|
"kind": "expression"
|
|
132
90
|
}
|
|
@@ -159,6 +117,13 @@
|
|
|
159
117
|
"kind": "expression"
|
|
160
118
|
}
|
|
161
119
|
},
|
|
120
|
+
{
|
|
121
|
+
"name": "?invalid",
|
|
122
|
+
"description": "Set to true when the field is invalid.",
|
|
123
|
+
"value": {
|
|
124
|
+
"kind": "expression"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
162
127
|
{
|
|
163
128
|
"name": ".itemClassNameGenerator",
|
|
164
129
|
"description": "A function used to generate CSS class names for dropdown\nitems based on the item. The return value should be the\ngenerated class name as a string, or multiple class names\nseparated by whitespace characters.",
|
|
@@ -208,6 +173,20 @@
|
|
|
208
173
|
"kind": "expression"
|
|
209
174
|
}
|
|
210
175
|
},
|
|
176
|
+
{
|
|
177
|
+
"name": "?loading",
|
|
178
|
+
"description": "When set to `true`, \"loading\" attribute is added to host and the overlay element.",
|
|
179
|
+
"value": {
|
|
180
|
+
"kind": "expression"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "?manualValidation",
|
|
185
|
+
"description": "Set to true to enable manual validation mode. This mode disables automatic\nconstraint validation, allowing you to control the validation process yourself.\nYou can still trigger constraint validation manually with the `validate()` method\nor use `checkValidity()` to assess the component's validity without affecting\nthe invalid state. In manual validation mode, you can also manipulate\nthe `invalid` property directly through your application logic without conflicts\nwith the component's internal validation.",
|
|
186
|
+
"value": {
|
|
187
|
+
"kind": "expression"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
211
190
|
{
|
|
212
191
|
"name": ".name",
|
|
213
192
|
"description": "The name of this field.",
|
|
@@ -215,6 +194,13 @@
|
|
|
215
194
|
"kind": "expression"
|
|
216
195
|
}
|
|
217
196
|
},
|
|
197
|
+
{
|
|
198
|
+
"name": "?opened",
|
|
199
|
+
"description": "True if the dropdown is open, false otherwise.",
|
|
200
|
+
"value": {
|
|
201
|
+
"kind": "expression"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
218
204
|
{
|
|
219
205
|
"name": ".pageSize",
|
|
220
206
|
"description": "Number of items fetched at a time from the dataprovider.",
|
|
@@ -236,6 +222,13 @@
|
|
|
236
222
|
"kind": "expression"
|
|
237
223
|
}
|
|
238
224
|
},
|
|
225
|
+
{
|
|
226
|
+
"name": "?readonly",
|
|
227
|
+
"description": "When present, it specifies that the field is read-only.",
|
|
228
|
+
"value": {
|
|
229
|
+
"kind": "expression"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
239
232
|
{
|
|
240
233
|
"name": ".renderer",
|
|
241
234
|
"description": "Custom function for rendering the content of every item.\nReceives three arguments:\n\n- `root` The `<vaadin-combo-box-item>` internal container DOM element.\n- `comboBox` The reference to the `<vaadin-combo-box>` element.\n- `model` The object with the properties related with the rendered\n item, contains:\n - `model.index` The index of the rendered item.\n - `model.item` The item.",
|
|
@@ -243,6 +236,13 @@
|
|
|
243
236
|
"kind": "expression"
|
|
244
237
|
}
|
|
245
238
|
},
|
|
239
|
+
{
|
|
240
|
+
"name": "?required",
|
|
241
|
+
"description": "Specifies that the user must fill in a value.",
|
|
242
|
+
"value": {
|
|
243
|
+
"kind": "expression"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
246
|
{
|
|
247
247
|
"name": ".selectedItem",
|
|
248
248
|
"description": "The selected item from the `items` array.",
|
|
@@ -292,13 +292,6 @@
|
|
|
292
292
|
"kind": "expression"
|
|
293
293
|
}
|
|
294
294
|
},
|
|
295
|
-
{
|
|
296
|
-
"name": "@input",
|
|
297
|
-
"description": "Fired when the value is changed by the user: on every typing keystroke,\nand the value is cleared using the clear button.",
|
|
298
|
-
"value": {
|
|
299
|
-
"kind": "expression"
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
295
|
{
|
|
303
296
|
"name": "@invalid-changed",
|
|
304
297
|
"description": "Fired when the `invalid` property changes.",
|
|
@@ -315,7 +308,7 @@
|
|
|
315
308
|
},
|
|
316
309
|
{
|
|
317
310
|
"name": "@selected-item-changed",
|
|
318
|
-
"description": "Fired when
|
|
311
|
+
"description": "Fired when the `selectedItem` property changes.",
|
|
319
312
|
"value": {
|
|
320
313
|
"kind": "expression"
|
|
321
314
|
}
|
|
@@ -343,7 +336,7 @@
|
|
|
343
336
|
},
|
|
344
337
|
{
|
|
345
338
|
"name": "@value-changed",
|
|
346
|
-
"description": "Fired when the value changes.",
|
|
339
|
+
"description": "Fired when the `value` property changes.",
|
|
347
340
|
"value": {
|
|
348
341
|
"kind": "expression"
|
|
349
342
|
}
|