@dataloop-ai/components 0.16.61 → 0.16.63
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,7 +19,7 @@
|
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script lang="ts">
|
|
22
|
-
import { defineComponent, ref, computed } from 'vue-demi'
|
|
22
|
+
import { defineComponent, ref, computed, toRef } from 'vue-demi'
|
|
23
23
|
import DlTooltip from '../../essential/DlTooltip/DlTooltip.vue'
|
|
24
24
|
import { useSizeObserver } from '../../../hooks/use-size-observer'
|
|
25
25
|
|
|
@@ -29,15 +29,33 @@ export default defineComponent({
|
|
|
29
29
|
DlTooltip
|
|
30
30
|
},
|
|
31
31
|
props: {
|
|
32
|
+
/**
|
|
33
|
+
* Text to be displayed
|
|
34
|
+
*/
|
|
32
35
|
text: {
|
|
33
36
|
type: String,
|
|
34
37
|
required: true
|
|
35
38
|
},
|
|
36
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Allows to split the text in two parts
|
|
41
|
+
*/
|
|
42
|
+
split: {
|
|
37
43
|
type: Boolean,
|
|
38
44
|
default: false,
|
|
39
45
|
required: false
|
|
40
46
|
},
|
|
47
|
+
/**
|
|
48
|
+
* Position of the split in the text, % of the text length
|
|
49
|
+
*/
|
|
50
|
+
splitPosition: {
|
|
51
|
+
type: Number,
|
|
52
|
+
required: false,
|
|
53
|
+
default: 0.5,
|
|
54
|
+
validator: (value: number) => value >= 0 && value <= 1
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Tooltip to be displayed when the text is truncated
|
|
58
|
+
*/
|
|
41
59
|
tooltip: {
|
|
42
60
|
type: Boolean,
|
|
43
61
|
default: true,
|
|
@@ -45,20 +63,26 @@ export default defineComponent({
|
|
|
45
63
|
}
|
|
46
64
|
},
|
|
47
65
|
setup(props) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
66
|
+
const { text, split } = props
|
|
67
|
+
|
|
68
|
+
const splitPositionsRef = toRef(props, 'splitPosition')
|
|
69
|
+
splitPositionsRef.value = Math.min(
|
|
70
|
+
Math.max(splitPositionsRef.value, 1),
|
|
71
|
+
0
|
|
72
|
+
)
|
|
52
73
|
|
|
74
|
+
const dlEllipsisRef = ref(null)
|
|
53
75
|
const splitIndex = computed(() =>
|
|
54
|
-
|
|
55
|
-
? Math.round(
|
|
56
|
-
:
|
|
76
|
+
split
|
|
77
|
+
? Math.round(text.length * splitPositionsRef.value)
|
|
78
|
+
: text.length
|
|
57
79
|
)
|
|
58
80
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
const leftText = computed(() => text.slice(0, splitIndex.value))
|
|
82
|
+
const rightText = computed(() => text.slice(splitIndex.value))
|
|
83
|
+
|
|
84
|
+
const { hasEllipsis } = useSizeObserver(dlEllipsisRef)
|
|
85
|
+
const fullText = computed(() => text)
|
|
62
86
|
|
|
63
87
|
return {
|
|
64
88
|
leftText,
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
:style="{
|
|
16
16
|
width: Number(width) ? `${width}px` : width,
|
|
17
17
|
height: Number(height) ? `${height}px` : height,
|
|
18
|
-
transform: `translate(${draggableOptions.draggableX}px, ${draggableOptions.draggableY}px)
|
|
18
|
+
transform: `translate(${draggableOptions.draggableX}px, ${draggableOptions.draggableY}px)`,
|
|
19
|
+
maxHeight: !fullscreen && !fullHeight ? '90vh' : ''
|
|
19
20
|
}"
|
|
20
21
|
:class="{
|
|
21
22
|
'dialog-wrapper--fullscreen': fullscreen,
|
|
@@ -226,7 +227,6 @@ export default defineComponent({
|
|
|
226
227
|
display: flex;
|
|
227
228
|
flex-direction: column;
|
|
228
229
|
z-index: var(--dl-z-index-menu);
|
|
229
|
-
max-height: 90vh;
|
|
230
230
|
|
|
231
231
|
&--fullscreen {
|
|
232
232
|
margin: 0;
|
|
@@ -267,7 +267,7 @@ export default defineComponent({
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
.content {
|
|
270
|
-
padding: 10px 16px 30px 16px;
|
|
270
|
+
padding: var(--dl-dialog-box-content-padding, 10px 16px 30px 16px);
|
|
271
271
|
overflow: auto;
|
|
272
272
|
height: 100%;
|
|
273
273
|
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
v-model="draggable"
|
|
5
5
|
left-label="Draggable"
|
|
6
6
|
/>
|
|
7
|
+
<dl-switch
|
|
8
|
+
v-model="fullscreen"
|
|
9
|
+
left-label="Full screen"
|
|
10
|
+
/>
|
|
11
|
+
<dl-switch
|
|
12
|
+
v-model="fullHeight"
|
|
13
|
+
left-label="Full height"
|
|
14
|
+
/>
|
|
7
15
|
<dl-button @click="openModal">
|
|
8
16
|
Open modal
|
|
9
17
|
</dl-button>
|
|
@@ -11,6 +19,8 @@
|
|
|
11
19
|
ref="modalOne"
|
|
12
20
|
v-model="isOpenedFirstModal"
|
|
13
21
|
:draggable="draggable"
|
|
22
|
+
:full-height="fullHeight"
|
|
23
|
+
:fullscreen="fullscreen"
|
|
14
24
|
>
|
|
15
25
|
<template #header>
|
|
16
26
|
<dl-dialog-box-header
|
|
@@ -136,6 +146,8 @@ export default defineComponent({
|
|
|
136
146
|
const modalOne = ref<any>(null)
|
|
137
147
|
const modalTwo = ref<any>(null)
|
|
138
148
|
const draggable = ref(true)
|
|
149
|
+
const fullscreen = ref(false)
|
|
150
|
+
const fullHeight = ref(false)
|
|
139
151
|
const isOpenedFirstModal = ref(false)
|
|
140
152
|
|
|
141
153
|
const openModal = () => {
|
|
@@ -178,7 +190,9 @@ export default defineComponent({
|
|
|
178
190
|
modalOne,
|
|
179
191
|
modalTwo,
|
|
180
192
|
isOpenedFirstModal,
|
|
181
|
-
draggable
|
|
193
|
+
draggable,
|
|
194
|
+
fullscreen,
|
|
195
|
+
fullHeight
|
|
182
196
|
}
|
|
183
197
|
}
|
|
184
198
|
})
|
|
@@ -14,7 +14,17 @@
|
|
|
14
14
|
</p>
|
|
15
15
|
<dl-ellipsis
|
|
16
16
|
text="Lorem ipsum dolor sit amet consectetur adipisicing elit. "
|
|
17
|
-
|
|
17
|
+
split
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<div style="white-space: nowrap; width: 350px">
|
|
21
|
+
<p style="font-weight: bold">
|
|
22
|
+
Ellipsis at the 20%
|
|
23
|
+
</p>
|
|
24
|
+
<dl-ellipsis
|
|
25
|
+
text="Lorem ipsum dolor sit amet consectetur adipisicing elit. "
|
|
26
|
+
split
|
|
27
|
+
:split-position="0.2"
|
|
18
28
|
/>
|
|
19
29
|
</div>
|
|
20
30
|
</div>
|