@dataloop-ai/components 0.18.129 → 0.18.131
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
|
@@ -78,6 +78,7 @@ import { CalendarDate, Calendar } from './models'
|
|
|
78
78
|
import { defineComponent, PropType } from 'vue-demi'
|
|
79
79
|
import { DateInterval } from './types'
|
|
80
80
|
import { v4 } from 'uuid'
|
|
81
|
+
import moment from 'moment'
|
|
81
82
|
|
|
82
83
|
const HOVER_TIMEOUT = 700
|
|
83
84
|
|
|
@@ -193,8 +194,12 @@ export default defineComponent({
|
|
|
193
194
|
},
|
|
194
195
|
updateModelValue(value: DateInterval) {
|
|
195
196
|
if (this.disabled) return
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
const valueToUse = value
|
|
198
|
+
if (value && moment(value.from).isSame(value.to)) {
|
|
199
|
+
valueToUse.to = moment(value.from).endOf('day').toDate()
|
|
200
|
+
}
|
|
201
|
+
this.$emit('update:model-value', valueToUse)
|
|
202
|
+
this.$emit('change', valueToUse)
|
|
198
203
|
},
|
|
199
204
|
|
|
200
205
|
updateDateInterval(value: DateInterval) {
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="dl-ellipsis"
|
|
4
|
+
:class="multiline ? 'dl-ellipsis__multiline' : ''"
|
|
5
|
+
:style="cssVars"
|
|
6
|
+
>
|
|
7
|
+
<p
|
|
8
|
+
v-if="multiline"
|
|
9
|
+
ref="dlEllipsisRef"
|
|
10
|
+
class="dl-ellipsis__multiline-text"
|
|
11
|
+
>
|
|
12
|
+
{{ fullText }}
|
|
13
|
+
</p>
|
|
3
14
|
<span
|
|
15
|
+
v-if="!multiline"
|
|
4
16
|
ref="dlEllipsisRef"
|
|
5
17
|
class="dl-ellipsis__left"
|
|
6
18
|
>
|
|
@@ -11,14 +23,14 @@
|
|
|
11
23
|
<span v-else>{{ leftText }}</span>
|
|
12
24
|
</span>
|
|
13
25
|
<span
|
|
14
|
-
v-if="rightText"
|
|
26
|
+
v-if="!multiline && rightText"
|
|
15
27
|
class="dl-ellipsis__right"
|
|
16
28
|
>
|
|
17
29
|
{{ rightText }}
|
|
18
30
|
</span>
|
|
19
31
|
<dl-tooltip
|
|
20
32
|
v-if="shouldShowTooltip"
|
|
21
|
-
:max-width="'
|
|
33
|
+
:max-width="'30vw'"
|
|
22
34
|
:self="tooltipPosition"
|
|
23
35
|
:anchor="tooltipPosition"
|
|
24
36
|
:offset="tooltipOffset"
|
|
@@ -33,7 +45,13 @@
|
|
|
33
45
|
</template>
|
|
34
46
|
|
|
35
47
|
<script lang="ts">
|
|
36
|
-
import {
|
|
48
|
+
import {
|
|
49
|
+
defineComponent,
|
|
50
|
+
ref,
|
|
51
|
+
computed,
|
|
52
|
+
onMounted,
|
|
53
|
+
getCurrentInstance
|
|
54
|
+
} from 'vue-demi'
|
|
37
55
|
import { DlTooltip } from '../../shared'
|
|
38
56
|
import { useSizeObserver } from '../../../hooks/use-size-observer'
|
|
39
57
|
|
|
@@ -79,6 +97,21 @@ export default defineComponent({
|
|
|
79
97
|
tooltipOffset: {
|
|
80
98
|
type: Array,
|
|
81
99
|
default: () => [0, 25]
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Allows to display multiline text
|
|
103
|
+
*/
|
|
104
|
+
multiline: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: false
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* Number of lines to display
|
|
110
|
+
* must be used with multiline
|
|
111
|
+
*/
|
|
112
|
+
maxLines: {
|
|
113
|
+
type: Number,
|
|
114
|
+
default: 3
|
|
82
115
|
}
|
|
83
116
|
},
|
|
84
117
|
// TODO: fix type issue here
|
|
@@ -110,6 +143,18 @@ export default defineComponent({
|
|
|
110
143
|
)
|
|
111
144
|
const fullText = computed(() => props.text)
|
|
112
145
|
|
|
146
|
+
const cssVars = computed<Record<string, string | number>>(() => {
|
|
147
|
+
return {
|
|
148
|
+
'--max-lines': props.maxLines
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
onMounted(() => {
|
|
153
|
+
const vm = getCurrentInstance()
|
|
154
|
+
// @ts-ignore
|
|
155
|
+
window.vm = vm
|
|
156
|
+
})
|
|
157
|
+
|
|
113
158
|
return {
|
|
114
159
|
hasDefaultSlot,
|
|
115
160
|
leftText,
|
|
@@ -117,7 +162,8 @@ export default defineComponent({
|
|
|
117
162
|
shouldShowTooltip,
|
|
118
163
|
fullText,
|
|
119
164
|
dlEllipsisRef,
|
|
120
|
-
hasEllipsis
|
|
165
|
+
hasEllipsis,
|
|
166
|
+
cssVars
|
|
121
167
|
}
|
|
122
168
|
}
|
|
123
169
|
})
|
|
@@ -138,5 +184,32 @@ export default defineComponent({
|
|
|
138
184
|
flex: 1 0 auto;
|
|
139
185
|
overflow: hidden;
|
|
140
186
|
}
|
|
187
|
+
|
|
188
|
+
&__multiline {
|
|
189
|
+
/* Set the number of lines to display */
|
|
190
|
+
display: -webkit-box;
|
|
191
|
+
/* Enable text ellipsis */
|
|
192
|
+
overflow: hidden;
|
|
193
|
+
/* Allow text to break into multiple lines */
|
|
194
|
+
-webkit-box-orient: vertical;
|
|
195
|
+
/* Enable vertical scrolling if necessary */
|
|
196
|
+
overflow-y: auto;
|
|
197
|
+
/* Hide the horizontal scrollbar */
|
|
198
|
+
overflow-x: hidden;
|
|
199
|
+
|
|
200
|
+
&-text {
|
|
201
|
+
/* Set the number of lines to display */
|
|
202
|
+
display: -webkit-box;
|
|
203
|
+
-webkit-line-clamp: var(
|
|
204
|
+
--max-lines,
|
|
205
|
+
3
|
|
206
|
+
); /* Adjust this value as needed */
|
|
207
|
+
/* Enable text ellipsis */
|
|
208
|
+
overflow: hidden;
|
|
209
|
+
/* Allow text to break into multiple lines */
|
|
210
|
+
-webkit-box-orient: vertical;
|
|
211
|
+
white-space: normal;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
141
214
|
}
|
|
142
215
|
</style>
|
|
@@ -27,6 +27,19 @@
|
|
|
27
27
|
:split-position="0.2"
|
|
28
28
|
/>
|
|
29
29
|
</div>
|
|
30
|
+
<div style="white-space: nowrap; width: 350px; max-height: 600px">
|
|
31
|
+
<p style="font-weight: bold">
|
|
32
|
+
Ellipsis with paragraph
|
|
33
|
+
</p>
|
|
34
|
+
<dl-ellipsis
|
|
35
|
+
:text="`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \
|
|
36
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. \
|
|
37
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. \
|
|
38
|
+
Excepteur sint occaecat cupidatat non proident, \
|
|
39
|
+
sunt in culpa qui officia deserunt mollit anim id est laborum.`"
|
|
40
|
+
multiline
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
30
43
|
</div>
|
|
31
44
|
</template>
|
|
32
45
|
|