@tekkare/auriga 0.1.182 → 0.1.183
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/dist/module.json
CHANGED
|
@@ -123,10 +123,23 @@ export default defineComponent({
|
|
|
123
123
|
const optionIndex = ref(0);
|
|
124
124
|
function selectOption(isDown) {
|
|
125
125
|
if (isDown) {
|
|
126
|
-
optionIndex.value = optionIndex.value === filterSuggestions.value.length ?
|
|
126
|
+
optionIndex.value = optionIndex.value === filterSuggestions.value.length ? filterSuggestions.value.length : optionIndex.value + 1;
|
|
127
127
|
} else {
|
|
128
128
|
optionIndex.value = optionIndex.value === 0 ? filterSuggestions.value.length : optionIndex.value - 1;
|
|
129
129
|
}
|
|
130
|
+
const suggContainer = document.querySelector(".search_suggestions");
|
|
131
|
+
const selectedOption = suggContainer?.querySelectorAll("p")[optionIndex.value - 1];
|
|
132
|
+
if (selectedOption) {
|
|
133
|
+
const containerHeight = suggContainer?.clientHeight;
|
|
134
|
+
const containerScrollTop = suggContainer?.scrollTop;
|
|
135
|
+
const optionTop = selectedOption?.offsetTop;
|
|
136
|
+
const optionHeight = selectedOption?.offsetHeight * 2;
|
|
137
|
+
if (optionTop < containerScrollTop) {
|
|
138
|
+
suggContainer.scrollTop = optionTop;
|
|
139
|
+
} else if (optionTop + optionHeight > containerHeight + containerScrollTop) {
|
|
140
|
+
suggContainer.scrollTop = optionTop + optionHeight - containerHeight;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
130
143
|
}
|
|
131
144
|
watch(
|
|
132
145
|
() => searchValue.value,
|