sprintify-ui 0.8.50 → 0.8.51
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="relative w-full overflow-hidden">
|
|
3
3
|
<div
|
|
4
|
-
ref="
|
|
4
|
+
ref="drawerRef"
|
|
5
5
|
data-scroll-lock-scrollable
|
|
6
6
|
class="max-h-[214px] w-full overflow-y-auto"
|
|
7
7
|
>
|
|
@@ -160,7 +160,7 @@ const props = defineProps({
|
|
|
160
160
|
|
|
161
161
|
const emit = defineEmits(['scrollBottom', 'select']);
|
|
162
162
|
|
|
163
|
-
const
|
|
163
|
+
const drawerRef = ref<HTMLDivElement | null>(null);
|
|
164
164
|
|
|
165
165
|
let mouseIsMoving = false;
|
|
166
166
|
|
|
@@ -266,7 +266,7 @@ function onKeydown(event: KeyboardEvent) {
|
|
|
266
266
|
|
|
267
267
|
onMounted(() => {
|
|
268
268
|
useInfiniteScroll(
|
|
269
|
-
|
|
269
|
+
drawerRef.value,
|
|
270
270
|
() => {
|
|
271
271
|
emit('scrollBottom');
|
|
272
272
|
},
|
|
@@ -275,11 +275,11 @@ onMounted(() => {
|
|
|
275
275
|
});
|
|
276
276
|
|
|
277
277
|
function scrollToFocus() {
|
|
278
|
-
if (!
|
|
278
|
+
if (!drawerRef.value) {
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
const option =
|
|
282
|
+
const option = drawerRef.value.querySelector(
|
|
283
283
|
`[data-index="${focusIndex.value}"]`
|
|
284
284
|
) as HTMLElement | null;
|
|
285
285
|
|
|
@@ -287,11 +287,11 @@ function scrollToFocus() {
|
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
const dropdownHeight =
|
|
290
|
+
const dropdownHeight = drawerRef.value.clientHeight;
|
|
291
291
|
const offsetTop = option.offsetTop;
|
|
292
292
|
const optionHeight = option.clientHeight;
|
|
293
293
|
|
|
294
|
-
|
|
294
|
+
drawerRef.value.scrollTop = offsetTop - dropdownHeight / 2 + optionHeight / 2;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
// Validate focus index
|
|
@@ -299,7 +299,11 @@ function scrollToFocus() {
|
|
|
299
299
|
watch(
|
|
300
300
|
() => props.options,
|
|
301
301
|
() => {
|
|
302
|
-
|
|
302
|
+
focusIndex.value = Math.max(
|
|
303
|
+
0,
|
|
304
|
+
Math.min(focusIndex.value, props.options.length - 1)
|
|
305
|
+
);
|
|
306
|
+
scrollToFocus();
|
|
303
307
|
},
|
|
304
308
|
{ immediate: true }
|
|
305
309
|
);
|
|
@@ -309,7 +313,14 @@ watch(
|
|
|
309
313
|
watch(
|
|
310
314
|
() => props.selected,
|
|
311
315
|
() => {
|
|
312
|
-
|
|
316
|
+
if (selectedIndex.value !== null && selectedIndex.value < props.options.length) {
|
|
317
|
+
focusIndex.value = selectedIndex.value;
|
|
318
|
+
scrollToFocus();
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
focusIndex.value = 0;
|
|
323
|
+
scrollToFocus();
|
|
313
324
|
},
|
|
314
325
|
{ immediate: true }
|
|
315
326
|
);
|
|
@@ -319,21 +330,10 @@ watch(
|
|
|
319
330
|
watch(
|
|
320
331
|
() => props.keywords,
|
|
321
332
|
() => {
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
function checkFocusIndex() {
|
|
327
|
-
|
|
328
|
-
if (selectedIndex.value !== null && selectedIndex.value < props.options.length) {
|
|
329
|
-
focusIndex.value = selectedIndex.value;
|
|
333
|
+
focusIndex.value = 0;
|
|
330
334
|
scrollToFocus();
|
|
331
|
-
return;
|
|
332
335
|
}
|
|
333
|
-
|
|
334
|
-
focusIndex.value = 0;
|
|
335
|
-
scrollToFocus();
|
|
336
|
-
}
|
|
336
|
+
);
|
|
337
337
|
|
|
338
338
|
const onOptionMouseEnter = (index: number) => {
|
|
339
339
|
if (mouseIsMoving) {
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
class="flex items-center justify-center py-16"
|
|
163
163
|
>
|
|
164
164
|
<div class="flex flex-col items-center">
|
|
165
|
-
<BaseEmptyState class="w-
|
|
165
|
+
<BaseEmptyState class="w-24" />
|
|
166
166
|
|
|
167
167
|
<p class="mt-3 text-center text-sm text-slate-600">
|
|
168
168
|
{{ t('sui.nothing_found') }}
|