sprintify-ui 0.8.5 → 0.8.7
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
|
@@ -689,17 +689,40 @@ function nextSequence() {
|
|
|
689
689
|
return sequence.value++;
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
+
let warningNoRowKeyFoundShown = false;
|
|
693
|
+
|
|
692
694
|
function getRowKey(row: Row): string {
|
|
695
|
+
|
|
693
696
|
if (row.id) {
|
|
694
697
|
return row.id;
|
|
695
698
|
}
|
|
699
|
+
|
|
696
700
|
if (row.key) {
|
|
697
701
|
return row.key;
|
|
698
702
|
}
|
|
703
|
+
|
|
699
704
|
if (row.uuid) {
|
|
700
705
|
return row.uuid;
|
|
701
706
|
}
|
|
702
|
-
|
|
707
|
+
|
|
708
|
+
if (!warningNoRowKeyFoundShown) {
|
|
709
|
+
console.warn('%cNo unique key found for items provided to BaseDataTable.%cPlease provide a unique key for each row (id, key or uuid) for faster rendering', 'font-weight: bold', 'font-weight: normal');
|
|
710
|
+
warningNoRowKeyFoundShown = true;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// if no key is found, hash a simplified version of the row object
|
|
714
|
+
// We use a simplified version to avoid hashing functions, objects, etc. for performance reasons
|
|
715
|
+
|
|
716
|
+
const simpleRow = {} as Record<string, string | number | boolean>;
|
|
717
|
+
|
|
718
|
+
for (const key in row) {
|
|
719
|
+
const value = row[key];
|
|
720
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
721
|
+
simpleRow[key] = value;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
return objectHash(simpleRow);
|
|
703
726
|
}
|
|
704
727
|
|
|
705
728
|
provide('addColumn', addColumn);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<li
|
|
2
|
+
<li
|
|
3
|
+
ref="baseTabItemRef"
|
|
4
|
+
class="[&:first-child_a]:pl-0 [&:last-child_a]:pr-0"
|
|
5
|
+
>
|
|
3
6
|
<RouterLink
|
|
4
7
|
v-slot="{ href, navigate, isActive, isExactActive }"
|
|
5
8
|
:to="to"
|
|
@@ -36,6 +39,7 @@
|
|
|
36
39
|
</template>
|
|
37
40
|
|
|
38
41
|
<script lang="ts" setup>
|
|
42
|
+
import { useElementBounding } from '@vueuse/core';
|
|
39
43
|
import { NavigationFailure, RouteLocationRaw } from 'vue-router';
|
|
40
44
|
|
|
41
45
|
const props = withDefaults(
|
|
@@ -51,6 +55,7 @@ const props = withDefaults(
|
|
|
51
55
|
);
|
|
52
56
|
|
|
53
57
|
const size = inject('tabs:size', ref<'xs' | 'sm' | 'md' | 'lg'>('md'));
|
|
58
|
+
const animate = inject('tabs:animate', () => { });
|
|
54
59
|
|
|
55
60
|
function onClick(navigate: () => Promise<void | NavigationFailure>) {
|
|
56
61
|
if (props.disabled) {
|
|
@@ -64,6 +69,18 @@ function isActiveInternal(isActive: boolean, isExactActive: boolean) {
|
|
|
64
69
|
return props.activeStrategy == 'default' ? isActive : isExactActive;
|
|
65
70
|
}
|
|
66
71
|
|
|
72
|
+
const baseTabItemRef = ref<HTMLElement | null>(null);
|
|
73
|
+
|
|
74
|
+
const { x, y, width } = useElementBounding(baseTabItemRef);
|
|
75
|
+
|
|
76
|
+
watch(
|
|
77
|
+
() => x.value + '-' + y.value + '-' + width.value,
|
|
78
|
+
() => {
|
|
79
|
+
animate();
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
|
|
67
84
|
const sizeClassOuter = computed(() => {
|
|
68
85
|
switch (size.value) {
|
|
69
86
|
case 'xs':
|
|
@@ -21,7 +21,14 @@ const Template = (args) => ({
|
|
|
21
21
|
BaseCounter,
|
|
22
22
|
},
|
|
23
23
|
setup() {
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
const label = ref('Home');
|
|
26
|
+
|
|
27
|
+
setInterval(() => {
|
|
28
|
+
label.value = Math.random().toString(36).substring(7);
|
|
29
|
+
}, 1000);
|
|
30
|
+
|
|
31
|
+
return { args, label };
|
|
25
32
|
},
|
|
26
33
|
template: `
|
|
27
34
|
<div class="bg-slate-100 py-10">
|
|
@@ -29,7 +36,7 @@ const Template = (args) => ({
|
|
|
29
36
|
<BaseTabs v-bind="args">
|
|
30
37
|
<BaseTabItem to="/" v-slot="{active}">
|
|
31
38
|
<div class="flex items-center">
|
|
32
|
-
<span class="mr-1">
|
|
39
|
+
<span class="mr-1">{{ label }}</span>
|
|
33
40
|
<BaseCounter
|
|
34
41
|
:size="['lg', 'md'].includes(args.size) ? 'sm' : 'xs'"
|
|
35
42
|
:color="active ? 'primary' : 'light'"
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<script lang="ts" setup>
|
|
28
|
+
import { debounce } from 'lodash';
|
|
29
|
+
|
|
28
30
|
const props = withDefaults(
|
|
29
31
|
defineProps<{
|
|
30
32
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
@@ -52,6 +54,12 @@ provide(
|
|
|
52
54
|
computed(() => props.size)
|
|
53
55
|
);
|
|
54
56
|
|
|
57
|
+
provide(
|
|
58
|
+
'tabs:animate',
|
|
59
|
+
debounce(animateLine, 100)
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
|
|
55
63
|
function getActiveTab(): HTMLElement | null {
|
|
56
64
|
|
|
57
65
|
if (!scrollable.value) {
|