File tree Expand file tree Collapse file tree 4 files changed +103
-5
lines changed Expand file tree Collapse file tree 4 files changed +103
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
---
4
4
5
- <vscode-multi-select filter =" startsWith" id =" combobox-example" combobox >
5
+ <p >
6
+ <label for =" search-method" >Search method:</label >
7
+ <select name =" search-method-selector" id =" search-method-selector" >
8
+ <option value =" contains" >contains</option >
9
+ <option value =" fuzzy" >fuzzy</option >
10
+ <option value =" startsWith" >startsWith</option >
11
+ <option value =" startsWithPerTerm" >startsWithPerTerm</option >
12
+ </select >
13
+ </p >
14
+
15
+ <vscode-multi-select id =" combobox-example" combobox >
6
16
<vscode-option>Afghanistan</vscode-option>
7
17
<vscode-option>Albania</vscode-option>
8
18
<vscode-option>Algeria</vscode-option>
199
209
<vscode-option>Zambia</vscode-option>
200
210
<vscode-option>Zimbabwe</vscode-option>
201
211
</vscode-multi-select>
212
+
213
+ <script >
214
+ import type { SearchMethod } from "@vscode-elements/elements/dist/includes/vscode-select/types";
215
+ import type { VscodeMultiSelect } from "@vscode-elements/elements/dist/vscode-multi-select";
216
+
217
+ const cb = document.querySelector<VscodeMultiSelect>("#combobox-example");
218
+ const sl = document.querySelector<HTMLSelectElement>(
219
+ "#search-method-selector"
220
+ );
221
+
222
+ sl?.addEventListener("change", () => {
223
+ cb!.filter = sl?.options[sl.selectedIndex].value as SearchMethod;
224
+ });
225
+
226
+ cb!.filter = sl?.options[sl.selectedIndex].value as SearchMethod;
227
+ </script >
Original file line number Diff line number Diff line change 1
1
---
2
+
2
3
---
3
- <vscode-single-select filter =" startsWithPerTerm" combobox >
4
+
5
+ <p >
6
+ <label for =" search-method" >Search method:</label >
7
+ <select name =" search-method-selector" id =" search-method-selector" >
8
+ <option value =" contains" >contains</option >
9
+ <option value =" fuzzy" >fuzzy</option >
10
+ <option value =" startsWith" >startsWith</option >
11
+ <option value =" startsWithPerTerm" >startsWithPerTerm</option >
12
+ </select >
13
+ </p >
14
+
15
+ <vscode-single-select id =" combobox-example" combobox >
4
16
<vscode-option>Afghanistan</vscode-option>
5
17
<vscode-option>Albania</vscode-option>
6
18
<vscode-option>Algeria</vscode-option>
196
208
<vscode-option>Yemen</vscode-option>
197
209
<vscode-option>Zambia</vscode-option>
198
210
<vscode-option>Zimbabwe</vscode-option>
199
- </vscode-single-select>
211
+ </vscode-single-select>
212
+
213
+ <script >
214
+ import type { SearchMethod } from "@vscode-elements/elements/dist/includes/vscode-select/types";
215
+ import type { VscodeSingleSelect } from "@vscode-elements/elements/dist/vscode-single-select";
216
+
217
+ const cb = document.querySelector<VscodeSingleSelect>("#combobox-example");
218
+ const sl = document.querySelector<HTMLSelectElement>(
219
+ "#search-method-selector"
220
+ );
221
+
222
+ sl?.addEventListener("change", () => {
223
+ cb!.filter = sl?.options[sl.selectedIndex].value as SearchMethod;
224
+ });
225
+
226
+ cb!.filter = sl?.options[sl.selectedIndex].value as SearchMethod;
227
+ </script >
Original file line number Diff line number Diff line change @@ -48,12 +48,34 @@ import Imports from "@components/examples/multi-select/Imports.astro";
48
48
<ComboboxExample />
49
49
<Fragment slot = " html" >
50
50
``` html
51
- <vscode-multi-select filter =" startsWith" id =" combobox-example" combobox >
51
+ <p >
52
+ <label for =" search-method" >Search method:</label >
53
+ <select name =" search-method-selector" id =" search-method-selector" >
54
+ <option value =" contains" >contains</option >
55
+ <option value =" fuzzy" >fuzzy</option >
56
+ <option value =" startsWith" >startsWith</option >
57
+ <option value =" startsWithPerTerm" >startsWithPerTerm</option >
58
+ </select >
59
+ </p >
60
+
61
+ <vscode-multi-select id =" combobox-example" combobox >
52
62
<vscode-option >Afghanistan</vscode-option >
53
63
<vscode-option >Albania</vscode-option >
54
64
<vscode-option >Algeria</vscode-option >
55
65
...
56
66
</vscode-multi-select >
57
67
```
58
68
</Fragment >
69
+ <Fragment slot = " js" >
70
+ ``` javascript
71
+ const cb = document .querySelector (" #combobox-example" );
72
+ const sl = document .querySelector (" #search-method-selector" );
73
+
74
+ sl .addEventListener (" change" , () => {
75
+ cb .filter = sl .options [sl .selectedIndex ].value ;
76
+ });
77
+
78
+ cb .filter = sl .options [sl .selectedIndex ].value ;
79
+ ```
80
+ </Fragment >
59
81
</Demo >
Original file line number Diff line number Diff line change @@ -42,11 +42,33 @@ import Imports from "@components/examples/single-select/Imports.astro";
42
42
<ComboboxExample />
43
43
<Fragment slot = " html" >
44
44
``` html
45
- <vscode-single-select filter =" fuzzy" combobox >
45
+ <p >
46
+ <label for =" search-method" >Search method:</label >
47
+ <select name =" search-method-selector" id =" search-method-selector" >
48
+ <option value =" contains" >contains</option >
49
+ <option value =" fuzzy" >fuzzy</option >
50
+ <option value =" startsWith" >startsWith</option >
51
+ <option value =" startsWithPerTerm" >startsWithPerTerm</option >
52
+ </select >
53
+ </p >
54
+
55
+ <vscode-single-select id =" combobox-example" combobox >
46
56
<vscode-option >Afghanistan</vscode-option >
47
57
<vscode-option >Albania</vscode-option >
48
58
...
49
59
</vscode-single-select >
50
60
```
51
61
</Fragment >
62
+ <Fragment slot = " js" >
63
+ ``` javascript
64
+ const cb = document .querySelector (" #combobox-example" );
65
+ const sl = document .querySelector (" #search-method-selector" );
66
+
67
+ sl .addEventListener (" change" , () => {
68
+ cb .filter = sl .options [sl .selectedIndex ].value ;
69
+ });
70
+
71
+ cb .filter = sl .options [sl .selectedIndex ].value ;
72
+ ```
73
+ </Fragment >
52
74
</Demo >
You can’t perform that action at this time.
0 commit comments