Skip to content

Commit 95a610c

Browse files
author
Jicheng Lu
committed
fix select search
1 parent 98e665b commit 95a610c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/common/Select.svelte

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
$: {
8080
innerOptions = verifySelectedOptions(innerOptions, selectedValues);
8181
refOptions = verifySelectedOptions(innerOptions, selectedValues);
82+
applySearchFilter();
8283
changeDisplayText();
8384
}
8485
@@ -109,6 +110,7 @@
109110
} else {
110111
innerOptions = verifySelectedOptions(options, selectedValues);
111112
refOptions = verifySelectedOptions(options, selectedValues);
113+
applySearchFilter();
112114
changeDisplayText();
113115
}
114116
}
@@ -162,18 +164,20 @@
162164
/** @param {any} e */
163165
function changeSearchValue(e) {
164166
searchValue = e.target.value || '';
167+
applySearchFilter();
168+
verifySelectAll();
169+
}
170+
171+
function applySearchFilter() {
165172
const innerValue = searchValue.toLowerCase();
166173
167174
if (searchValue) {
168175
innerOptions = [...refOptions.filter(x => x.label.toLowerCase().includes(innerValue))];
169176
} else {
170177
innerOptions = [...refOptions];
171178
}
172-
173-
verifySelectAll();
174179
}
175180
176-
177181
/**
178182
* @param {any} e
179183
* @param {any} option

0 commit comments

Comments
 (0)