@dataloop-ai/components 0.15.3 → 0.15.5
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
|
@@ -41,7 +41,15 @@
|
|
|
41
41
|
|
|
42
42
|
<script lang="ts">
|
|
43
43
|
import { v4 } from 'uuid'
|
|
44
|
-
import {
|
|
44
|
+
import {
|
|
45
|
+
computed,
|
|
46
|
+
defineComponent,
|
|
47
|
+
nextTick,
|
|
48
|
+
onMounted,
|
|
49
|
+
ref,
|
|
50
|
+
Ref,
|
|
51
|
+
watch
|
|
52
|
+
} from 'vue-demi'
|
|
45
53
|
import { getColor, includes } from '../utils'
|
|
46
54
|
import { DlIcon } from './'
|
|
47
55
|
|
|
@@ -138,32 +146,29 @@ export default defineComponent({
|
|
|
138
146
|
)
|
|
139
147
|
|
|
140
148
|
function normalizeStyles(fluid?: boolean) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
iconStyle.value = iconS
|
|
166
|
-
rootStyle.value = rootS
|
|
149
|
+
nextTick(() => {
|
|
150
|
+
const { height } = (
|
|
151
|
+
rootRef as Ref<HTMLElement | null>
|
|
152
|
+
).value!.getBoundingClientRect()
|
|
153
|
+
const iconS: Record<string, any> = {
|
|
154
|
+
display: 'flex'
|
|
155
|
+
}
|
|
156
|
+
const rootS: Record<string, any> = {
|
|
157
|
+
backgroundColor: getColor(typeToBackgroundMap[type])
|
|
158
|
+
}
|
|
159
|
+
if (height > 36) {
|
|
160
|
+
iconS.alignSelf = 'flex-start'
|
|
161
|
+
} else {
|
|
162
|
+
iconS.alignSelf = 'center'
|
|
163
|
+
}
|
|
164
|
+
if (fluid === true) {
|
|
165
|
+
rootS.width = '100%'
|
|
166
|
+
} else {
|
|
167
|
+
rootS.width = 'fit-content'
|
|
168
|
+
}
|
|
169
|
+
iconStyle.value = iconS
|
|
170
|
+
rootStyle.value = rootS
|
|
171
|
+
})
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
function handleClose() {
|
|
@@ -199,7 +204,7 @@ export default defineComponent({
|
|
|
199
204
|
> div {
|
|
200
205
|
display: flex;
|
|
201
206
|
flex-direction: row;
|
|
202
|
-
padding: 10px
|
|
207
|
+
padding: 10px 16px;
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
.text {
|
|
@@ -82,7 +82,7 @@ import { getColor } from '../utils'
|
|
|
82
82
|
import { v4 } from 'uuid'
|
|
83
83
|
import { stopAndPrevent } from '../utils'
|
|
84
84
|
|
|
85
|
-
const ValueTypes = [Array, Boolean, String, Number, Object, Function]
|
|
85
|
+
const ValueTypes = [Array, Boolean, String, Number, Object, Function, null]
|
|
86
86
|
|
|
87
87
|
export default defineComponent({
|
|
88
88
|
name: 'DlCheckbox',
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
<tr
|
|
3
3
|
:class="trClasses"
|
|
4
4
|
v-bind="$attrs"
|
|
5
|
-
v-on="
|
|
5
|
+
v-on="listeners"
|
|
6
6
|
>
|
|
7
7
|
<slot />
|
|
8
8
|
</tr>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script lang="ts">
|
|
12
|
-
import { defineComponent } from 'vue-demi'
|
|
12
|
+
import { defineComponent, isVue2 } from 'vue-demi'
|
|
13
13
|
|
|
14
14
|
export default defineComponent({
|
|
15
15
|
name: 'DlTr',
|
|
@@ -18,6 +18,14 @@ export default defineComponent({
|
|
|
18
18
|
noHover: Boolean
|
|
19
19
|
},
|
|
20
20
|
computed: {
|
|
21
|
+
listeners(): any {
|
|
22
|
+
if (isVue2) {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
return this.$listeners
|
|
25
|
+
} else {
|
|
26
|
+
return this.$attrs
|
|
27
|
+
}
|
|
28
|
+
},
|
|
21
29
|
trClasses(): string {
|
|
22
30
|
let classes = 'dl-tr'
|
|
23
31
|
|
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
`v-toast__item--${position}`,
|
|
13
13
|
classItem
|
|
14
14
|
]"
|
|
15
|
+
:style="{ width }"
|
|
15
16
|
>
|
|
16
17
|
<dl-alert
|
|
17
18
|
:type="type"
|
|
18
19
|
:closable="closable"
|
|
20
|
+
fluid
|
|
19
21
|
@update:model-value="(val) => closeToast(val)"
|
|
20
22
|
>
|
|
21
23
|
<span
|
|
@@ -29,11 +31,11 @@
|
|
|
29
31
|
|
|
30
32
|
<script lang="ts">
|
|
31
33
|
import {
|
|
34
|
+
computed,
|
|
32
35
|
defineComponent,
|
|
33
|
-
ref,
|
|
34
36
|
onBeforeMount,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
onMounted,
|
|
38
|
+
ref
|
|
37
39
|
} from 'vue-demi'
|
|
38
40
|
import DlAlert from '../../DlAlert.vue'
|
|
39
41
|
import { Positions, Types } from '../utils/config'
|
|
@@ -59,6 +61,10 @@ export default defineComponent({
|
|
|
59
61
|
type: String,
|
|
60
62
|
default: ''
|
|
61
63
|
},
|
|
64
|
+
width: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'auto'
|
|
67
|
+
},
|
|
62
68
|
duration: {
|
|
63
69
|
type: Number,
|
|
64
70
|
default: 10
|
|
@@ -183,18 +189,16 @@ export default defineComponent({
|
|
|
183
189
|
overflow: hidden;
|
|
184
190
|
z-index: 1052;
|
|
185
191
|
pointer-events: none;
|
|
186
|
-
&__text {
|
|
187
|
-
min-width: 300px;
|
|
188
|
-
max-width: 800px;
|
|
189
|
-
}
|
|
190
192
|
&__item {
|
|
191
193
|
display: inline-flex;
|
|
192
194
|
align-items: center;
|
|
193
195
|
pointer-events: auto;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
min-width: 400px;
|
|
197
|
+
max-width: 900px;
|
|
198
|
+
margin: 5px;
|
|
196
199
|
cursor: pointer;
|
|
197
200
|
animation-duration: 150ms;
|
|
201
|
+
|
|
198
202
|
&.v-toast__item--top,
|
|
199
203
|
&.v-toast__item--bottom {
|
|
200
204
|
align-self: center;
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
v-model="classItem"
|
|
16
16
|
title="Custom class for toast item"
|
|
17
17
|
/>
|
|
18
|
+
<dl-text-input
|
|
19
|
+
v-model="width"
|
|
20
|
+
title="Custom width for toast item"
|
|
21
|
+
/>
|
|
18
22
|
</div>
|
|
19
23
|
<div class="flex">
|
|
20
24
|
<div>
|
|
@@ -95,6 +99,7 @@ import DlTextInput from '../components/DlTextInput.vue'
|
|
|
95
99
|
import DlRadio from '../components/DlRadio.vue'
|
|
96
100
|
import DlTextArea from '../components/DlTextArea.vue'
|
|
97
101
|
import DlSwitch from '../components/DlSwitch.vue'
|
|
102
|
+
|
|
98
103
|
export default defineComponent({
|
|
99
104
|
name: 'DlToast',
|
|
100
105
|
components: {
|
|
@@ -113,6 +118,7 @@ export default defineComponent({
|
|
|
113
118
|
const position = ref('bottom')
|
|
114
119
|
const closable = ref(true)
|
|
115
120
|
const classItem = ref('demo-toast')
|
|
121
|
+
const width = ref('auto')
|
|
116
122
|
function showToastMessage() {
|
|
117
123
|
DlToast.open({
|
|
118
124
|
message: message.value,
|
|
@@ -120,7 +126,8 @@ export default defineComponent({
|
|
|
120
126
|
type: type.value,
|
|
121
127
|
duration: duration.value,
|
|
122
128
|
classItem: classItem.value,
|
|
123
|
-
closable: closable.value
|
|
129
|
+
closable: closable.value,
|
|
130
|
+
width: width.value
|
|
124
131
|
})
|
|
125
132
|
}
|
|
126
133
|
return {
|
|
@@ -130,7 +137,8 @@ export default defineComponent({
|
|
|
130
137
|
type,
|
|
131
138
|
position,
|
|
132
139
|
classItem,
|
|
133
|
-
closable
|
|
140
|
+
closable,
|
|
141
|
+
width
|
|
134
142
|
}
|
|
135
143
|
}
|
|
136
144
|
})
|