ketekny-ui-kit 1.0.111 → 1.0.112
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
|
@@ -19,6 +19,12 @@ export default {
|
|
|
19
19
|
theme: { type: String, default: 'dark' },
|
|
20
20
|
},
|
|
21
21
|
emits: ['select', 'toggle', 'toggle-favorite'],
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
showLabelTooltip: false,
|
|
25
|
+
resizeObserver: null,
|
|
26
|
+
}
|
|
27
|
+
},
|
|
22
28
|
computed: {
|
|
23
29
|
hasChildren() {
|
|
24
30
|
return Array.isArray(this.item.children) && this.item.children.length > 0
|
|
@@ -54,12 +60,39 @@ export default {
|
|
|
54
60
|
}
|
|
55
61
|
},
|
|
56
62
|
},
|
|
63
|
+
mounted() {
|
|
64
|
+
this.$nextTick(() => {
|
|
65
|
+
this.updateLabelTooltip()
|
|
66
|
+
if (typeof ResizeObserver !== 'undefined' && this.$refs.labelText) {
|
|
67
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
68
|
+
this.updateLabelTooltip()
|
|
69
|
+
})
|
|
70
|
+
this.resizeObserver.observe(this.$refs.labelText)
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
updated() {
|
|
75
|
+
this.$nextTick(() => {
|
|
76
|
+
this.updateLabelTooltip()
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
beforeUnmount() {
|
|
80
|
+
this.resizeObserver?.disconnect?.()
|
|
81
|
+
},
|
|
57
82
|
methods: {
|
|
58
83
|
containsActive(node) {
|
|
59
84
|
if (node.id === this.activeId) return true
|
|
60
85
|
if (!node.children) return false
|
|
61
86
|
return node.children.some((child) => this.containsActive(child))
|
|
62
87
|
},
|
|
88
|
+
updateLabelTooltip() {
|
|
89
|
+
const labelEl = this.$refs.labelText
|
|
90
|
+
if (!labelEl || this.isCollapsedTop) {
|
|
91
|
+
this.showLabelTooltip = false
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
this.showLabelTooltip = labelEl.scrollWidth > labelEl.clientWidth
|
|
95
|
+
},
|
|
63
96
|
handleClick() {
|
|
64
97
|
if (this.hasChildren && !this.isCollapsedTop) {
|
|
65
98
|
this.$emit('toggle', this.item.id)
|
|
@@ -127,7 +160,11 @@ export default {
|
|
|
127
160
|
/>
|
|
128
161
|
|
|
129
162
|
<template v-if="!isCollapsedTop">
|
|
130
|
-
<span
|
|
163
|
+
<span
|
|
164
|
+
ref="labelText"
|
|
165
|
+
class="flex-1 truncate"
|
|
166
|
+
v-tooltip.right="showLabelTooltip ? item.label : null"
|
|
167
|
+
>{{ item.label }}</span>
|
|
131
168
|
|
|
132
169
|
<span
|
|
133
170
|
v-if="item.badge != null"
|