|
|
|
|
@ -32,7 +32,7 @@ const filteredFiles = computed(() => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const applySearchQuery = throttle(300, () => {
|
|
|
|
|
searchQuery.value = refElemInput.value.value ?? '';
|
|
|
|
|
searchQuery.value = refElemInput.value.value;
|
|
|
|
|
selectedIndex.value = 0;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -52,7 +52,7 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
|
|
const handleSelectedItem = (idx: number) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
selectedIndex.value = idx;
|
|
|
|
|
const el = refElemPopup.value?.querySelector(`.file-search-results > :nth-child(${idx+1} of .item)`);
|
|
|
|
|
const el = refElemPopup.value.querySelector(`.file-search-results > :nth-child(${idx+1} of .item)`);
|
|
|
|
|
el?.scrollIntoView({ block: 'nearest', behavior: 'instant' });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -121,8 +121,8 @@ const updatePosition = () => {
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
const searchPopupId = generateElemId('file-search-popup-');
|
|
|
|
|
refElemPopup.value?.setAttribute('id', searchPopupId);
|
|
|
|
|
refElemInput.value?.setAttribute('aria-controls', searchPopupId);
|
|
|
|
|
refElemPopup.value.setAttribute('id', searchPopupId);
|
|
|
|
|
refElemInput.value.setAttribute('aria-controls', searchPopupId);
|
|
|
|
|
document.addEventListener('click', handleClickOutside);
|
|
|
|
|
window.addEventListener('resize', updatePosition);
|
|
|
|
|
});
|
|
|
|
|
|