@dataloop-ai/components 0.18.98 → 0.18.100
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
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
>
|
|
28
28
|
<div
|
|
29
29
|
ref="dlChipRef"
|
|
30
|
-
class="dl-chip--ellipsis"
|
|
30
|
+
:class="{ 'dl-chip--ellipsis': overflow }"
|
|
31
31
|
>
|
|
32
32
|
<slot>
|
|
33
33
|
{{ hasLabel ? label : null }}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
51
|
<script lang="ts">
|
|
52
|
-
import { PropType, defineComponent, ref } from 'vue-demi'
|
|
52
|
+
import { PropType, defineComponent, ref, watch } from 'vue-demi'
|
|
53
53
|
import { DlTooltip } from '../../shared'
|
|
54
54
|
import { DlIcon } from '../../essential'
|
|
55
55
|
import { useSizeObserver } from '../../../hooks/use-size-observer'
|
|
@@ -92,11 +92,16 @@ export default defineComponent({
|
|
|
92
92
|
overflow: { type: Boolean, default: false },
|
|
93
93
|
fit: { type: Boolean, default: false }
|
|
94
94
|
},
|
|
95
|
-
emits: ['remove'],
|
|
96
|
-
setup() {
|
|
95
|
+
emits: ['remove', 'ellipsis'],
|
|
96
|
+
setup(props, ctx) {
|
|
97
97
|
const isVisible = ref(true)
|
|
98
98
|
const dlChipRef = ref(null)
|
|
99
|
-
const
|
|
99
|
+
const label = ref(props.label)
|
|
100
|
+
const { hasEllipsis } = useSizeObserver(dlChipRef, label)
|
|
101
|
+
|
|
102
|
+
watch(hasEllipsis, () => {
|
|
103
|
+
ctx.emit('ellipsis', hasEllipsis.value)
|
|
104
|
+
})
|
|
100
105
|
|
|
101
106
|
return {
|
|
102
107
|
isVisible,
|
|
@@ -283,7 +283,7 @@ export default defineComponent({
|
|
|
283
283
|
rowsArr = tableRows.value
|
|
284
284
|
) => {
|
|
285
285
|
(rowsArr as DlTableRow[]).some((o) => {
|
|
286
|
-
if (
|
|
286
|
+
if (getRowKey.value(o) === name) {
|
|
287
287
|
if (isVue2) {
|
|
288
288
|
set(o, 'expanded', isExpanded)
|
|
289
289
|
} else {
|
|
@@ -1,22 +1,36 @@
|
|
|
1
|
-
import { onBeforeUnmount, onMounted, ref, Ref } from 'vue-demi'
|
|
1
|
+
import { onBeforeUnmount, onMounted, ref, Ref, watch } from 'vue-demi'
|
|
2
2
|
import { isEllipsisActive } from '../utils/is-ellipsis-active'
|
|
3
3
|
import { get } from 'lodash'
|
|
4
4
|
|
|
5
|
-
export function useSizeObserver(elRef: Ref,
|
|
5
|
+
export function useSizeObserver(elRef: Ref, ...refsToWatch: any[]) {
|
|
6
|
+
const entryLevel = 'target'
|
|
6
7
|
const widthRef = ref(0)
|
|
7
8
|
const heightRef = ref(0)
|
|
8
9
|
const hasEllipsis = ref(false)
|
|
9
10
|
const borderBoxSize = ref(null)
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const calcEllipsis = (el: HTMLElement) => {
|
|
12
|
+
hasEllipsis.value = isEllipsisActive(el)
|
|
13
|
+
}
|
|
14
|
+
const resizeObserver = new ResizeObserver(
|
|
15
|
+
(entries: ResizeObserverEntry[]) => {
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
hasEllipsis.value = isEllipsisActive(get(entry, entryLevel))
|
|
18
|
+
widthRef.value = entry.contentRect.width
|
|
19
|
+
heightRef.value = entry.contentRect.height
|
|
20
|
+
borderBoxSize.value = entry.borderBoxSize
|
|
21
|
+
}
|
|
16
22
|
}
|
|
17
|
-
|
|
23
|
+
)
|
|
18
24
|
|
|
19
25
|
onMounted(() => elRef.value && resizeObserver.observe(elRef.value))
|
|
26
|
+
watch(elRef, () => {
|
|
27
|
+
elRef.value && calcEllipsis(elRef.value)
|
|
28
|
+
})
|
|
29
|
+
for (const ref of refsToWatch) {
|
|
30
|
+
watch(ref, () => {
|
|
31
|
+
elRef.value && calcEllipsis(elRef.value)
|
|
32
|
+
})
|
|
33
|
+
}
|
|
20
34
|
onBeforeUnmount(() => elRef.value && resizeObserver.unobserve(elRef.value))
|
|
21
35
|
|
|
22
36
|
return {
|