sprintify-ui 0.8.49 → 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.
@@ -15,7 +15,7 @@ declare function __VLS_template(): {
15
15
  }): any;
16
16
  };
17
17
  refs: {
18
- drawer: HTMLDivElement;
18
+ drawerRef: HTMLDivElement;
19
19
  footer: HTMLDivElement;
20
20
  };
21
21
  attrs: Partial<{}>;
@@ -1,5 +1,5 @@
1
1
  import { PropType } from 'vue';
2
- import { Collection, DataIteratorSection, DataTableQuery } from '@/types';
2
+ import { Collection, DataIteratorSection, DataTableQuery, PaginatedCollection, ResourceCollection } from '@/types';
3
3
  import { ActionItem } from '@/types';
4
4
  type Direction = 'asc' | 'desc';
5
5
  import { Size } from '@/utils/sizes';
@@ -123,6 +123,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
123
123
  search?: string | undefined;
124
124
  filter?: Record<string, any> | undefined;
125
125
  }>;
126
+ data: import("vue").ComputedRef<ResourceCollection | Collection | PaginatedCollection | null | undefined>;
126
127
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
127
128
  click: (...args: any[]) => void;
128
129
  delete: (...args: any[]) => void;
@@ -1,5 +1,5 @@
1
1
  import { PropType } from 'vue';
2
- import { Collection, CollectionItem, DataIteratorSection, DataTableQuery, RowAction } from '@/types';
2
+ import { Collection, CollectionItem, DataIteratorSection, DataTableQuery, PaginatedCollection, ResourceCollection, RowAction } from '@/types';
3
3
  import { RouteLocationRaw } from 'vue-router';
4
4
  import { ActionItem } from '@/types';
5
5
  import { Size } from '@/utils/sizes';
@@ -232,6 +232,7 @@ declare function __VLS_template(): {
232
232
  search?: string | undefined;
233
233
  filter?: Record<string, any> | undefined;
234
234
  }>;
235
+ data: import("vue").ComputedRef<ResourceCollection | Collection | PaginatedCollection | null | undefined>;
235
236
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
236
237
  click: (...args: any[]) => void;
237
238
  delete: (...args: any[]) => void;
@@ -357,7 +358,7 @@ declare function __VLS_template(): {
357
358
  "onUpdate:query"?: ((...args: any[]) => any) | undefined;
358
359
  "onWill-scroll-top"?: ((...args: any[]) => any) | undefined;
359
360
  onFetch?: ((...args: any[]) => any) | undefined;
360
- }>, "fetch" | "fetchWithLoading" | "fetchWithoutLoading" | "scrollIntoView" | "query" | ("search" | "size" | "url" | "actions" | "items" | "urlQuery" | "defaultQuery" | "searchable" | "historyMode" | "layout" | "sections" | "scrollTopOnFetch" | "filtersPosition" | "perPage")> & import("vue").ShallowUnwrapRef<{
361
+ }>, "data" | "fetch" | "fetchWithLoading" | "fetchWithoutLoading" | "scrollIntoView" | "query" | ("search" | "size" | "url" | "actions" | "items" | "urlQuery" | "defaultQuery" | "searchable" | "historyMode" | "layout" | "sections" | "scrollTopOnFetch" | "filtersPosition" | "perPage")> & import("vue").ShallowUnwrapRef<{
361
362
  fetch: () => void;
362
363
  fetchWithLoading: () => void;
363
364
  fetchWithoutLoading: () => void;
@@ -375,6 +376,7 @@ declare function __VLS_template(): {
375
376
  search?: string | undefined;
376
377
  filter?: Record<string, any> | undefined;
377
378
  }>;
379
+ data: import("vue").ComputedRef<ResourceCollection | Collection | PaginatedCollection | null | undefined>;
378
380
  }> & {} & import("vue").ComponentCustomProperties & {} & {
379
381
  $slots: Partial<Record<string, (_: {
380
382
  query: DataTableQuery;
@@ -1083,6 +1085,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
1083
1085
  fetch: typeof fetch;
1084
1086
  fetchWithoutLoading: typeof fetchWithoutLoading;
1085
1087
  query: import("vue").ComputedRef<DataTableQuery | null>;
1088
+ data: import("vue").ComputedRef<ResourceCollection | Collection | PaginatedCollection | undefined>;
1086
1089
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
1087
1090
  delete: (...args: any[]) => void;
1088
1091
  "update:checked-rows": (...args: any[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.8.49",
3
+ "version": "0.8.51",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="relative w-full overflow-hidden">
3
3
  <div
4
- ref="drawer"
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 drawer = ref<HTMLDivElement | null>(null);
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
- drawer.value,
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 (!drawer.value) {
278
+ if (!drawerRef.value) {
279
279
  return;
280
280
  }
281
281
 
282
- const option = drawer.value.querySelector(
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 = drawer.value.clientHeight;
290
+ const dropdownHeight = drawerRef.value.clientHeight;
291
291
  const offsetTop = option.offsetTop;
292
292
  const optionHeight = option.clientHeight;
293
293
 
294
- drawer.value.scrollTop = offsetTop - dropdownHeight / 2 + optionHeight / 2;
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
- checkFocusIndex();
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
- checkFocusIndex();
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
- checkFocusIndex();
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) {
@@ -944,5 +944,6 @@ defineExpose({
944
944
  fetchWithoutLoading: () => fetchWithoutLoading(true),
945
945
  scrollIntoView: scrollIntoViewAction,
946
946
  query,
947
+ data: computed(() => dataInternal.value),
947
948
  });
948
949
  </script>
@@ -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-32" />
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') }}
@@ -859,5 +859,6 @@ defineExpose({
859
859
  fetch,
860
860
  fetchWithoutLoading,
861
861
  query: dataIteratorQuery,
862
+ data: computed(() => dataIteratorRef.value?.data ?? undefined),
862
863
  });
863
864
  </script>