@vaadin/combo-box 25.3.0-dev.3a3c2d7d2a → 25.3.0
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 +158 -38
- package/package.json +14 -14
- package/src/vaadin-combo-box-base-mixin.js +65 -13
- package/src/vaadin-combo-box-data-provider-mixin.js +15 -9
- package/src/vaadin-combo-box-focus-index-mixin.js +5 -0
- package/src/vaadin-combo-box-item-mixin.js +1 -1
- package/src/vaadin-combo-box-item.js +4 -3
- package/src/vaadin-combo-box-items-mixin.d.ts +45 -0
- package/src/vaadin-combo-box-items-mixin.js +167 -4
- package/src/vaadin-combo-box-mixin.d.ts +0 -17
- package/src/vaadin-combo-box-mixin.js +7 -112
- package/src/vaadin-combo-box-overlay-mixin.js +10 -13
- package/src/vaadin-combo-box-overlay.js +4 -1
- package/src/vaadin-combo-box-placeholder.d.ts +20 -0
- package/src/vaadin-combo-box-scroller-mixin.d.ts +1 -6
- package/src/vaadin-combo-box-scroller-mixin.js +7 -19
- package/src/vaadin-combo-box-scroller.js +3 -1
- package/src/vaadin-combo-box.d.ts +43 -8
- package/src/vaadin-combo-box.js +43 -8
- package/web-types.json +47 -13
- package/web-types.lit.json +20 -6
package/custom-elements.json
CHANGED
|
@@ -519,6 +519,16 @@
|
|
|
519
519
|
"description": "A subset of items, filtered based on the user input. Filtered items\ncan be assigned directly to omit the internal filtering functionality.\nThe items can be of either `String` or `Object` type.",
|
|
520
520
|
"attribute": "filtered-items"
|
|
521
521
|
},
|
|
522
|
+
{
|
|
523
|
+
"kind": "field",
|
|
524
|
+
"name": "itemIdPath",
|
|
525
|
+
"privacy": "public",
|
|
526
|
+
"type": {
|
|
527
|
+
"text": "string"
|
|
528
|
+
},
|
|
529
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
530
|
+
"attribute": "item-id-path"
|
|
531
|
+
},
|
|
522
532
|
{
|
|
523
533
|
"kind": "field",
|
|
524
534
|
"name": "itemLabelGenerator",
|
|
@@ -582,6 +592,16 @@
|
|
|
582
592
|
"module": "src/vaadin-combo-box-base-mixin.js"
|
|
583
593
|
}
|
|
584
594
|
},
|
|
595
|
+
{
|
|
596
|
+
"kind": "field",
|
|
597
|
+
"name": "partialMatchMode",
|
|
598
|
+
"privacy": "public",
|
|
599
|
+
"type": {
|
|
600
|
+
"text": "string"
|
|
601
|
+
},
|
|
602
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
603
|
+
"attribute": "partial-match-mode"
|
|
604
|
+
},
|
|
585
605
|
{
|
|
586
606
|
"kind": "field",
|
|
587
607
|
"name": "readonly",
|
|
@@ -596,6 +616,11 @@
|
|
|
596
616
|
"module": "src/vaadin-combo-box-base-mixin.js"
|
|
597
617
|
}
|
|
598
618
|
},
|
|
619
|
+
{
|
|
620
|
+
"kind": "method",
|
|
621
|
+
"name": "requestContentUpdate",
|
|
622
|
+
"description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested."
|
|
623
|
+
},
|
|
599
624
|
{
|
|
600
625
|
"kind": "field",
|
|
601
626
|
"name": "value",
|
|
@@ -644,6 +669,14 @@
|
|
|
644
669
|
"description": "Filtering string the user has typed into the input field.",
|
|
645
670
|
"fieldName": "filter"
|
|
646
671
|
},
|
|
672
|
+
{
|
|
673
|
+
"name": "item-id-path",
|
|
674
|
+
"type": {
|
|
675
|
+
"text": "string"
|
|
676
|
+
},
|
|
677
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
678
|
+
"fieldName": "itemIdPath"
|
|
679
|
+
},
|
|
647
680
|
{
|
|
648
681
|
"name": "item-label-path",
|
|
649
682
|
"type": {
|
|
@@ -672,6 +705,14 @@
|
|
|
672
705
|
"module": "src/vaadin-combo-box-base-mixin.js"
|
|
673
706
|
}
|
|
674
707
|
},
|
|
708
|
+
{
|
|
709
|
+
"name": "partial-match-mode",
|
|
710
|
+
"type": {
|
|
711
|
+
"text": "string"
|
|
712
|
+
},
|
|
713
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
714
|
+
"fieldName": "partialMatchMode"
|
|
715
|
+
},
|
|
675
716
|
{
|
|
676
717
|
"name": "readonly",
|
|
677
718
|
"type": {
|
|
@@ -864,8 +905,12 @@
|
|
|
864
905
|
"type": {
|
|
865
906
|
"text": "string"
|
|
866
907
|
},
|
|
867
|
-
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin
|
|
868
|
-
"attribute": "item-id-path"
|
|
908
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
909
|
+
"attribute": "item-id-path",
|
|
910
|
+
"inheritedFrom": {
|
|
911
|
+
"name": "ComboBoxItemsMixin",
|
|
912
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
913
|
+
}
|
|
869
914
|
},
|
|
870
915
|
{
|
|
871
916
|
"kind": "field",
|
|
@@ -970,6 +1015,20 @@
|
|
|
970
1015
|
"module": "src/vaadin-combo-box-base-mixin.js"
|
|
971
1016
|
}
|
|
972
1017
|
},
|
|
1018
|
+
{
|
|
1019
|
+
"kind": "field",
|
|
1020
|
+
"name": "partialMatchMode",
|
|
1021
|
+
"privacy": "public",
|
|
1022
|
+
"type": {
|
|
1023
|
+
"text": "string"
|
|
1024
|
+
},
|
|
1025
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
1026
|
+
"attribute": "partial-match-mode",
|
|
1027
|
+
"inheritedFrom": {
|
|
1028
|
+
"name": "ComboBoxItemsMixin",
|
|
1029
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
1030
|
+
}
|
|
1031
|
+
},
|
|
973
1032
|
{
|
|
974
1033
|
"kind": "field",
|
|
975
1034
|
"name": "readonly",
|
|
@@ -997,7 +1056,11 @@
|
|
|
997
1056
|
{
|
|
998
1057
|
"kind": "method",
|
|
999
1058
|
"name": "requestContentUpdate",
|
|
1000
|
-
"description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested."
|
|
1059
|
+
"description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested.",
|
|
1060
|
+
"inheritedFrom": {
|
|
1061
|
+
"name": "ComboBoxItemsMixin",
|
|
1062
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
1063
|
+
}
|
|
1001
1064
|
},
|
|
1002
1065
|
{
|
|
1003
1066
|
"kind": "field",
|
|
@@ -1144,8 +1207,12 @@
|
|
|
1144
1207
|
"type": {
|
|
1145
1208
|
"text": "string"
|
|
1146
1209
|
},
|
|
1147
|
-
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin
|
|
1148
|
-
"fieldName": "itemIdPath"
|
|
1210
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
1211
|
+
"fieldName": "itemIdPath",
|
|
1212
|
+
"inheritedFrom": {
|
|
1213
|
+
"name": "ComboBoxItemsMixin",
|
|
1214
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
1215
|
+
}
|
|
1149
1216
|
},
|
|
1150
1217
|
{
|
|
1151
1218
|
"name": "item-label-path",
|
|
@@ -1203,6 +1270,18 @@
|
|
|
1203
1270
|
"module": "src/vaadin-combo-box-base-mixin.js"
|
|
1204
1271
|
}
|
|
1205
1272
|
},
|
|
1273
|
+
{
|
|
1274
|
+
"name": "partial-match-mode",
|
|
1275
|
+
"type": {
|
|
1276
|
+
"text": "string"
|
|
1277
|
+
},
|
|
1278
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
1279
|
+
"fieldName": "partialMatchMode",
|
|
1280
|
+
"inheritedFrom": {
|
|
1281
|
+
"name": "ComboBoxItemsMixin",
|
|
1282
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1206
1285
|
{
|
|
1207
1286
|
"name": "readonly",
|
|
1208
1287
|
"type": {
|
|
@@ -1525,16 +1604,6 @@
|
|
|
1525
1604
|
"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.",
|
|
1526
1605
|
"attribute": "item-class-name-generator"
|
|
1527
1606
|
},
|
|
1528
|
-
{
|
|
1529
|
-
"kind": "field",
|
|
1530
|
-
"name": "itemIdPath",
|
|
1531
|
-
"privacy": "public",
|
|
1532
|
-
"type": {
|
|
1533
|
-
"text": "string"
|
|
1534
|
-
},
|
|
1535
|
-
"description": "Path for the id of the item, used to detect whether the item is selected.",
|
|
1536
|
-
"attribute": "item-id-path"
|
|
1537
|
-
},
|
|
1538
1607
|
{
|
|
1539
1608
|
"kind": "field",
|
|
1540
1609
|
"name": "items",
|
|
@@ -1655,14 +1724,6 @@
|
|
|
1655
1724
|
"description": "Index of an item that has focus outline and is scrolled into view.\nThe actual focus still remains in the input field.",
|
|
1656
1725
|
"fieldName": "focusedIndex"
|
|
1657
1726
|
},
|
|
1658
|
-
{
|
|
1659
|
-
"name": "item-id-path",
|
|
1660
|
-
"type": {
|
|
1661
|
-
"text": "string"
|
|
1662
|
-
},
|
|
1663
|
-
"description": "Path for the id of the item, used to detect whether the item is selected.",
|
|
1664
|
-
"fieldName": "itemIdPath"
|
|
1665
|
-
},
|
|
1666
1727
|
{
|
|
1667
1728
|
"name": "items",
|
|
1668
1729
|
"type": {
|
|
@@ -1720,9 +1781,23 @@
|
|
|
1720
1781
|
"declarations": [
|
|
1721
1782
|
{
|
|
1722
1783
|
"kind": "class",
|
|
1723
|
-
"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`](#/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\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`](#/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`](#/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
|
|
1784
|
+
"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`](#/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\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`](#/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`](#/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 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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-combo-box-overlay-max-height` |\n| `--vaadin-combo-box-overlay-width` |\n| `--vaadin-field-default-width` |\n| `--vaadin-input-field-background` |\n| `--vaadin-input-field-border-color` |\n| `--vaadin-input-field-border-radius` |\n| `--vaadin-input-field-border-width` |\n| `--vaadin-input-field-bottom-end-radius` |\n| `--vaadin-input-field-bottom-start-radius` |\n| `--vaadin-input-field-button-text-color` |\n| `--vaadin-input-field-container-gap` |\n| `--vaadin-input-field-disabled-background` |\n| `--vaadin-input-field-disabled-text-color` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-gap` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-label-color` |\n| `--vaadin-input-field-label-font-size` |\n| `--vaadin-input-field-label-font-weight` |\n| `--vaadin-input-field-label-line-height` |\n| `--vaadin-input-field-padding` |\n| `--vaadin-input-field-placeholder-color` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n| `--vaadin-input-field-top-end-radius` |\n| `--vaadin-input-field-top-start-radius` |\n| `--vaadin-input-field-value-color` |\n| `--vaadin-input-field-value-font-size` |\n| `--vaadin-input-field-value-font-weight` |\n| `--vaadin-input-field-value-line-height` |\n| `--vaadin-item-overlay-padding` |\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>`](#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
1724
1785
|
"name": "ComboBox",
|
|
1725
1786
|
"members": [
|
|
1787
|
+
{
|
|
1788
|
+
"kind": "field",
|
|
1789
|
+
"name": "accessibleDescriptionRef",
|
|
1790
|
+
"privacy": "public",
|
|
1791
|
+
"type": {
|
|
1792
|
+
"text": "string"
|
|
1793
|
+
},
|
|
1794
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
1795
|
+
"attribute": "accessible-description-ref",
|
|
1796
|
+
"inheritedFrom": {
|
|
1797
|
+
"name": "FieldMixin",
|
|
1798
|
+
"package": "@vaadin/field-base/src/field-mixin.js"
|
|
1799
|
+
}
|
|
1800
|
+
},
|
|
1726
1801
|
{
|
|
1727
1802
|
"kind": "field",
|
|
1728
1803
|
"name": "accessibleName",
|
|
@@ -1730,7 +1805,7 @@
|
|
|
1730
1805
|
"type": {
|
|
1731
1806
|
"text": "string"
|
|
1732
1807
|
},
|
|
1733
|
-
"description": "String used to label the component
|
|
1808
|
+
"description": "String used to label the component for screen reader users.",
|
|
1734
1809
|
"attribute": "accessible-name",
|
|
1735
1810
|
"inheritedFrom": {
|
|
1736
1811
|
"name": "FieldMixin",
|
|
@@ -1744,7 +1819,7 @@
|
|
|
1744
1819
|
"type": {
|
|
1745
1820
|
"text": "string"
|
|
1746
1821
|
},
|
|
1747
|
-
"description": "
|
|
1822
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
1748
1823
|
"attribute": "accessible-name-ref",
|
|
1749
1824
|
"inheritedFrom": {
|
|
1750
1825
|
"name": "FieldMixin",
|
|
@@ -1860,7 +1935,7 @@
|
|
|
1860
1935
|
"type": {
|
|
1861
1936
|
"text": "boolean"
|
|
1862
1937
|
},
|
|
1863
|
-
"description": "Set to true to display the clear icon which clears the input.\
|
|
1938
|
+
"description": "Set to true to display the clear icon which clears the input.\nThis also enables clearing the input when pressing Esc key.",
|
|
1864
1939
|
"attribute": "clear-button-visible",
|
|
1865
1940
|
"inheritedFrom": {
|
|
1866
1941
|
"name": "ClearButtonMixin",
|
|
@@ -2004,11 +2079,11 @@
|
|
|
2004
2079
|
"type": {
|
|
2005
2080
|
"text": "string"
|
|
2006
2081
|
},
|
|
2007
|
-
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin
|
|
2082
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
2008
2083
|
"attribute": "item-id-path",
|
|
2009
2084
|
"inheritedFrom": {
|
|
2010
|
-
"name": "
|
|
2011
|
-
"module": "src/vaadin-combo-box-mixin.js"
|
|
2085
|
+
"name": "ComboBoxItemsMixin",
|
|
2086
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
2012
2087
|
}
|
|
2013
2088
|
},
|
|
2014
2089
|
{
|
|
@@ -2160,6 +2235,20 @@
|
|
|
2160
2235
|
"module": "src/vaadin-combo-box-data-provider-mixin.js"
|
|
2161
2236
|
}
|
|
2162
2237
|
},
|
|
2238
|
+
{
|
|
2239
|
+
"kind": "field",
|
|
2240
|
+
"name": "partialMatchMode",
|
|
2241
|
+
"privacy": "public",
|
|
2242
|
+
"type": {
|
|
2243
|
+
"text": "string"
|
|
2244
|
+
},
|
|
2245
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
2246
|
+
"attribute": "partial-match-mode",
|
|
2247
|
+
"inheritedFrom": {
|
|
2248
|
+
"name": "ComboBoxItemsMixin",
|
|
2249
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
2250
|
+
}
|
|
2251
|
+
},
|
|
2163
2252
|
{
|
|
2164
2253
|
"kind": "field",
|
|
2165
2254
|
"name": "pattern",
|
|
@@ -2221,8 +2310,8 @@
|
|
|
2221
2310
|
"name": "requestContentUpdate",
|
|
2222
2311
|
"description": "Requests an update for the content of items.\nWhile performing the update, it invokes the renderer (passed in the `renderer` property) once an item.\n\nIt is not guaranteed that the update happens immediately (synchronously) after it is requested.",
|
|
2223
2312
|
"inheritedFrom": {
|
|
2224
|
-
"name": "
|
|
2225
|
-
"module": "src/vaadin-combo-box-mixin.js"
|
|
2313
|
+
"name": "ComboBoxItemsMixin",
|
|
2314
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
2226
2315
|
}
|
|
2227
2316
|
},
|
|
2228
2317
|
{
|
|
@@ -2399,12 +2488,24 @@
|
|
|
2399
2488
|
}
|
|
2400
2489
|
],
|
|
2401
2490
|
"attributes": [
|
|
2491
|
+
{
|
|
2492
|
+
"name": "accessible-description-ref",
|
|
2493
|
+
"type": {
|
|
2494
|
+
"text": "string"
|
|
2495
|
+
},
|
|
2496
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
2497
|
+
"fieldName": "accessibleDescriptionRef",
|
|
2498
|
+
"inheritedFrom": {
|
|
2499
|
+
"name": "FieldMixin",
|
|
2500
|
+
"package": "@vaadin/field-base/src/field-mixin.js"
|
|
2501
|
+
}
|
|
2502
|
+
},
|
|
2402
2503
|
{
|
|
2403
2504
|
"name": "accessible-name",
|
|
2404
2505
|
"type": {
|
|
2405
2506
|
"text": "string"
|
|
2406
2507
|
},
|
|
2407
|
-
"description": "String used to label the component
|
|
2508
|
+
"description": "String used to label the component for screen reader users.",
|
|
2408
2509
|
"fieldName": "accessibleName",
|
|
2409
2510
|
"inheritedFrom": {
|
|
2410
2511
|
"name": "FieldMixin",
|
|
@@ -2416,7 +2517,7 @@
|
|
|
2416
2517
|
"type": {
|
|
2417
2518
|
"text": "string"
|
|
2418
2519
|
},
|
|
2419
|
-
"description": "
|
|
2520
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
2420
2521
|
"fieldName": "accessibleNameRef",
|
|
2421
2522
|
"inheritedFrom": {
|
|
2422
2523
|
"name": "FieldMixin",
|
|
@@ -2488,7 +2589,7 @@
|
|
|
2488
2589
|
"type": {
|
|
2489
2590
|
"text": "boolean"
|
|
2490
2591
|
},
|
|
2491
|
-
"description": "Set to true to display the clear icon which clears the input.\
|
|
2592
|
+
"description": "Set to true to display the clear icon which clears the input.\nThis also enables clearing the input when pressing Esc key.",
|
|
2492
2593
|
"fieldName": "clearButtonVisible",
|
|
2493
2594
|
"inheritedFrom": {
|
|
2494
2595
|
"name": "ClearButtonMixin",
|
|
@@ -2572,11 +2673,11 @@
|
|
|
2572
2673
|
"type": {
|
|
2573
2674
|
"text": "string"
|
|
2574
2675
|
},
|
|
2575
|
-
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin
|
|
2676
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
2576
2677
|
"fieldName": "itemIdPath",
|
|
2577
2678
|
"inheritedFrom": {
|
|
2578
|
-
"name": "
|
|
2579
|
-
"module": "src/vaadin-combo-box-mixin.js"
|
|
2679
|
+
"name": "ComboBoxItemsMixin",
|
|
2680
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
2580
2681
|
}
|
|
2581
2682
|
},
|
|
2582
2683
|
{
|
|
@@ -2675,6 +2776,18 @@
|
|
|
2675
2776
|
"module": "src/vaadin-combo-box-data-provider-mixin.js"
|
|
2676
2777
|
}
|
|
2677
2778
|
},
|
|
2779
|
+
{
|
|
2780
|
+
"name": "partial-match-mode",
|
|
2781
|
+
"type": {
|
|
2782
|
+
"text": "string"
|
|
2783
|
+
},
|
|
2784
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
2785
|
+
"fieldName": "partialMatchMode",
|
|
2786
|
+
"inheritedFrom": {
|
|
2787
|
+
"name": "ComboBoxItemsMixin",
|
|
2788
|
+
"module": "src/vaadin-combo-box-items-mixin.js"
|
|
2789
|
+
}
|
|
2790
|
+
},
|
|
2678
2791
|
{
|
|
2679
2792
|
"name": "pattern",
|
|
2680
2793
|
"type": {
|
|
@@ -2759,6 +2872,13 @@
|
|
|
2759
2872
|
"module": "src/vaadin-combo-box-data-provider-mixin.js"
|
|
2760
2873
|
}
|
|
2761
2874
|
},
|
|
2875
|
+
{
|
|
2876
|
+
"type": {
|
|
2877
|
+
"text": "string"
|
|
2878
|
+
},
|
|
2879
|
+
"description": "The theme variants to apply to the component.",
|
|
2880
|
+
"name": "theme"
|
|
2881
|
+
},
|
|
2762
2882
|
{
|
|
2763
2883
|
"name": "title",
|
|
2764
2884
|
"type": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/combo-box",
|
|
3
|
-
"version": "25.3.0
|
|
3
|
+
"version": "25.3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@vaadin/a11y-base": "25.3.0
|
|
40
|
-
"@vaadin/component-base": "25.3.0
|
|
41
|
-
"@vaadin/field-base": "25.3.0
|
|
42
|
-
"@vaadin/input-container": "25.3.0
|
|
43
|
-
"@vaadin/item": "25.3.0
|
|
44
|
-
"@vaadin/lit-renderer": "25.3.0
|
|
45
|
-
"@vaadin/overlay": "25.3.0
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0
|
|
39
|
+
"@vaadin/a11y-base": "~25.3.0",
|
|
40
|
+
"@vaadin/component-base": "~25.3.0",
|
|
41
|
+
"@vaadin/field-base": "~25.3.0",
|
|
42
|
+
"@vaadin/input-container": "~25.3.0",
|
|
43
|
+
"@vaadin/item": "~25.3.0",
|
|
44
|
+
"@vaadin/lit-renderer": "~25.3.0",
|
|
45
|
+
"@vaadin/overlay": "~25.3.0",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "~25.3.0",
|
|
47
47
|
"lit": "^3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@vaadin/aura": "25.3.0
|
|
51
|
-
"@vaadin/chai-plugins": "25.3.0
|
|
52
|
-
"@vaadin/test-runner-commands": "25.3.0
|
|
50
|
+
"@vaadin/aura": "~25.3.0",
|
|
51
|
+
"@vaadin/chai-plugins": "~25.3.0",
|
|
52
|
+
"@vaadin/test-runner-commands": "~25.3.0",
|
|
53
53
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0
|
|
54
|
+
"@vaadin/vaadin-lumo-styles": "~25.3.0",
|
|
55
55
|
"sinon": "^22.0.0"
|
|
56
56
|
},
|
|
57
57
|
"customElements": "custom-elements.json",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "4133747243c03bf544f6e82cc2ec9f295aaccd65"
|
|
63
63
|
}
|
|
@@ -8,8 +8,8 @@ import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
|
8
8
|
import { isElementFocused, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
9
9
|
import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
10
10
|
import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
11
|
+
import { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
|
|
11
12
|
import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
|
|
12
|
-
import { VirtualKeyboardController } from '@vaadin/field-base/src/virtual-keyboard-controller.js';
|
|
13
13
|
import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';
|
|
14
14
|
|
|
15
15
|
export const ComboBoxBaseMixin = (superClass) =>
|
|
@@ -168,8 +168,24 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
168
168
|
if (this.clearElement) {
|
|
169
169
|
this.clearElement.addEventListener('mousedown', this._boundOnClearButtonMouseDown);
|
|
170
170
|
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** @protected */
|
|
174
|
+
updated(props) {
|
|
175
|
+
super.updated(props);
|
|
176
|
+
|
|
177
|
+
// Note: `loading` is only declared by components that support a data provider.
|
|
178
|
+
if (props.has('opened') || props.has('_dropdownItems') || props.has('loading')) {
|
|
179
|
+
// Close the overlay if there are no items to display.
|
|
180
|
+
// See https://github.com/vaadin/vaadin-combo-box/pull/964
|
|
181
|
+
this._overlayOpened = this.opened && (!!this.loading || this._hasDropdownItems);
|
|
182
|
+
}
|
|
171
183
|
|
|
172
|
-
|
|
184
|
+
// Update the scroller only once the overlay is actually opened, so that the
|
|
185
|
+
// virtualizer does not measure and render items while the overlay is hidden.
|
|
186
|
+
if (['_overlayOpened', '_dropdownItems', '_focusedIndex', '_theme'].some((prop) => props.has(prop))) {
|
|
187
|
+
this._updateScroller();
|
|
188
|
+
}
|
|
173
189
|
}
|
|
174
190
|
|
|
175
191
|
/** @protected */
|
|
@@ -212,6 +228,12 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
212
228
|
this._overlayOpened = e.detail.value;
|
|
213
229
|
});
|
|
214
230
|
|
|
231
|
+
// Finish close lifecycle only after the overlay closing animation completes.
|
|
232
|
+
overlay.addEventListener('vaadin-overlay-closed', () => {
|
|
233
|
+
this._scroller.items = [];
|
|
234
|
+
this._onOverlayClosed();
|
|
235
|
+
});
|
|
236
|
+
|
|
215
237
|
this._overlayElement = overlay;
|
|
216
238
|
}
|
|
217
239
|
|
|
@@ -244,6 +266,29 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
244
266
|
this.appendChild(scroller);
|
|
245
267
|
}
|
|
246
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Update the scroller to reflect the dropdown items, the focused item
|
|
271
|
+
* and whether the overlay is opened.
|
|
272
|
+
* @protected
|
|
273
|
+
*/
|
|
274
|
+
_updateScroller() {
|
|
275
|
+
const opened = this._overlayOpened;
|
|
276
|
+
|
|
277
|
+
if (opened) {
|
|
278
|
+
this._scroller.style.maxHeight =
|
|
279
|
+
getComputedStyle(this).getPropertyValue(`--${this._tagNamePrefix}-overlay-max-height`) || '65vh';
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const isClosing = this.hasAttribute('closing');
|
|
283
|
+
|
|
284
|
+
this._scroller.setProperties({
|
|
285
|
+
items: opened || isClosing ? this._dropdownItems : [],
|
|
286
|
+
opened,
|
|
287
|
+
focusedIndex: this._focusedIndex,
|
|
288
|
+
theme: this._theme,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
247
292
|
/**
|
|
248
293
|
* @type {boolean}
|
|
249
294
|
* @protected
|
|
@@ -258,7 +303,6 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
258
303
|
this._onOpened();
|
|
259
304
|
} else if (wasOpened && this._hasDropdownItems) {
|
|
260
305
|
this.close();
|
|
261
|
-
this._onOverlayClosed();
|
|
262
306
|
}
|
|
263
307
|
}
|
|
264
308
|
|
|
@@ -283,11 +327,7 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
283
327
|
}
|
|
284
328
|
|
|
285
329
|
const item = this._getItemElements().find((el) => el.index === index);
|
|
286
|
-
|
|
287
|
-
input.setAttribute('aria-activedescendant', item.id);
|
|
288
|
-
} else {
|
|
289
|
-
input.removeAttribute('aria-activedescendant');
|
|
290
|
-
}
|
|
330
|
+
setOrRemoveAttribute(input, 'aria-activedescendant', item?.id);
|
|
291
331
|
}
|
|
292
332
|
|
|
293
333
|
/** @private */
|
|
@@ -320,11 +360,7 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
320
360
|
if (input) {
|
|
321
361
|
input.setAttribute('aria-expanded', !!opened);
|
|
322
362
|
|
|
323
|
-
|
|
324
|
-
input.setAttribute('aria-controls', this._scroller.id);
|
|
325
|
-
} else {
|
|
326
|
-
input.removeAttribute('aria-controls');
|
|
327
|
-
}
|
|
363
|
+
setOrRemoveAttribute(input, 'aria-controls', opened && this._scroller.id);
|
|
328
364
|
}
|
|
329
365
|
}
|
|
330
366
|
|
|
@@ -451,6 +487,18 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
451
487
|
return item ? item.toString() : '';
|
|
452
488
|
}
|
|
453
489
|
|
|
490
|
+
/**
|
|
491
|
+
* Returns true when both items refer to the same item.
|
|
492
|
+
* Override to provide logic for item id path.
|
|
493
|
+
* @param {unknown} item
|
|
494
|
+
* @param {unknown} other
|
|
495
|
+
* @return {boolean}
|
|
496
|
+
* @protected
|
|
497
|
+
*/
|
|
498
|
+
_isSameItem(item, other) {
|
|
499
|
+
return item === other;
|
|
500
|
+
}
|
|
501
|
+
|
|
454
502
|
/** @private */
|
|
455
503
|
_onArrowDown() {
|
|
456
504
|
if (this.opened) {
|
|
@@ -708,6 +756,10 @@ export const ComboBoxBaseMixin = (superClass) =>
|
|
|
708
756
|
// Stop this private event from leaking outside.
|
|
709
757
|
e.stopPropagation();
|
|
710
758
|
|
|
759
|
+
if (this.hasAttribute('closing')) {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
|
|
711
763
|
if (e.detail.item instanceof ComboBoxPlaceholder) {
|
|
712
764
|
// Placeholder items should not be selectable.
|
|
713
765
|
return;
|