@dataloop-ai/components 0.19.134 → 0.19.135
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
|
@@ -8,6 +8,8 @@ export function useSizeObserver(elRef: Ref, ...refsToWatch: any[]) {
|
|
|
8
8
|
const heightRef = ref(0)
|
|
9
9
|
const hasEllipsis = ref(false)
|
|
10
10
|
const borderBoxSize = ref(null)
|
|
11
|
+
const disposing = ref(false)
|
|
12
|
+
|
|
11
13
|
const calcEllipsis = (el: HTMLElement) => {
|
|
12
14
|
hasEllipsis.value = isEllipsisActive(el)
|
|
13
15
|
}
|
|
@@ -22,16 +24,36 @@ export function useSizeObserver(elRef: Ref, ...refsToWatch: any[]) {
|
|
|
22
24
|
}
|
|
23
25
|
)
|
|
24
26
|
|
|
25
|
-
onMounted(() => elRef.value && resizeObserver.observe(elRef.value))
|
|
26
27
|
watch(elRef, () => {
|
|
27
|
-
|
|
28
|
+
if (disposing.value) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
if (elRef.value) {
|
|
32
|
+
calcEllipsis(elRef.value)
|
|
33
|
+
}
|
|
28
34
|
})
|
|
29
35
|
for (const ref of refsToWatch) {
|
|
30
36
|
watch(ref, () => {
|
|
31
|
-
|
|
37
|
+
if (disposing.value) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
if (elRef.value) {
|
|
41
|
+
calcEllipsis(elRef.value)
|
|
42
|
+
}
|
|
32
43
|
})
|
|
33
44
|
}
|
|
34
|
-
|
|
45
|
+
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
if (elRef.value) {
|
|
48
|
+
resizeObserver.observe(elRef.value)
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
onBeforeUnmount(() => {
|
|
52
|
+
disposing.value = true
|
|
53
|
+
if (elRef.value) {
|
|
54
|
+
resizeObserver.unobserve(elRef.value)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
35
57
|
|
|
36
58
|
return {
|
|
37
59
|
widthRef,
|