@dataloop-ai/components 0.16.57 → 0.16.58
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 +1 -1
- package/src/components/basic/DlPopup/DlPopup.vue +15 -14
- package/src/components/basic/DlPopup/components/PopupHeader.vue +10 -10
- package/src/components/compound/DlRange/DlRange.vue +3 -9
- package/src/components/compound/DlRange/utils.ts +3 -4
- package/src/demos/DlPopupDemo.vue +26 -3
- package/src/demos/DlRangeDemo.vue +11 -4
package/package.json
CHANGED
|
@@ -20,12 +20,14 @@
|
|
|
20
20
|
@move="movePopup"
|
|
21
21
|
/>
|
|
22
22
|
<popup-header
|
|
23
|
-
v-if="
|
|
23
|
+
v-if="
|
|
24
|
+
hasHeaderSlot || hasCloseButtonSlot || withCloseButton
|
|
25
|
+
"
|
|
24
26
|
:title="title"
|
|
25
27
|
:additional-info="additionalInfo"
|
|
26
28
|
:subtitle="subtitle"
|
|
27
29
|
:with-close-button="withCloseButton"
|
|
28
|
-
@
|
|
30
|
+
@close-button-click="handleCloseClick"
|
|
29
31
|
>
|
|
30
32
|
<template
|
|
31
33
|
v-if="hasHeaderSlot"
|
|
@@ -34,10 +36,10 @@
|
|
|
34
36
|
<slot name="header" />
|
|
35
37
|
</template>
|
|
36
38
|
<template
|
|
37
|
-
v-if="
|
|
38
|
-
#
|
|
39
|
+
v-if="hasCloseButtonSlot"
|
|
40
|
+
#close-button
|
|
39
41
|
>
|
|
40
|
-
<slot name="
|
|
42
|
+
<slot name="close-button" />
|
|
41
43
|
</template>
|
|
42
44
|
</popup-header>
|
|
43
45
|
<div class="popup-content">
|
|
@@ -146,7 +148,6 @@ export default defineComponent({
|
|
|
146
148
|
withCloseButton: { type: Boolean, default: false },
|
|
147
149
|
preventHide: { type: Boolean, default: false },
|
|
148
150
|
disableCloseByEsc: { type: Boolean, default: false },
|
|
149
|
-
hideOnClickOutside: { type: Boolean, default: false },
|
|
150
151
|
self: {
|
|
151
152
|
type: String,
|
|
152
153
|
default: 'top middle',
|
|
@@ -169,7 +170,7 @@ export default defineComponent({
|
|
|
169
170
|
draggable: Boolean
|
|
170
171
|
},
|
|
171
172
|
emits: [
|
|
172
|
-
'
|
|
173
|
+
'close-button-click',
|
|
173
174
|
'show',
|
|
174
175
|
'before-show',
|
|
175
176
|
'hide',
|
|
@@ -205,8 +206,8 @@ export default defineComponent({
|
|
|
205
206
|
|
|
206
207
|
const hasHeaderSlot = computed(() => slots.header !== undefined)
|
|
207
208
|
|
|
208
|
-
const
|
|
209
|
-
() => slots['
|
|
209
|
+
const hasCloseButtonSlot = computed(
|
|
210
|
+
() => slots['close-button'] !== undefined
|
|
210
211
|
)
|
|
211
212
|
|
|
212
213
|
const { hide } = useModelToggle({
|
|
@@ -230,7 +231,7 @@ export default defineComponent({
|
|
|
230
231
|
innerRef,
|
|
231
232
|
onClickOutside: (e: AnchorEvent) =>
|
|
232
233
|
handleClickOutside(e, {
|
|
233
|
-
persistent:
|
|
234
|
+
persistent: props.persistent,
|
|
234
235
|
showing: showing.value,
|
|
235
236
|
fn: hide
|
|
236
237
|
})
|
|
@@ -421,11 +422,11 @@ export default defineComponent({
|
|
|
421
422
|
)
|
|
422
423
|
}
|
|
423
424
|
|
|
424
|
-
function
|
|
425
|
+
function handleCloseClick(e: Event) {
|
|
425
426
|
if (!props.preventHide) {
|
|
426
427
|
hide(e as AnchorEvent)
|
|
427
428
|
}
|
|
428
|
-
proxy.$emit('
|
|
429
|
+
proxy.$emit('close-button-click', e)
|
|
429
430
|
}
|
|
430
431
|
|
|
431
432
|
onBeforeUnmount(anchorCleanup as any)
|
|
@@ -438,8 +439,8 @@ export default defineComponent({
|
|
|
438
439
|
portalIsAccessible,
|
|
439
440
|
anchorEl,
|
|
440
441
|
showing,
|
|
441
|
-
|
|
442
|
-
|
|
442
|
+
handleCloseClick,
|
|
443
|
+
hasCloseButtonSlot,
|
|
443
444
|
hasFooterSlot,
|
|
444
445
|
movePopup,
|
|
445
446
|
hasHeaderSlot,
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
</span>
|
|
28
28
|
<span
|
|
29
29
|
v-if="withCloseButton"
|
|
30
|
-
class="
|
|
31
|
-
@click="
|
|
30
|
+
class="close-button"
|
|
31
|
+
@click="handleClick"
|
|
32
32
|
>
|
|
33
33
|
<slot
|
|
34
|
-
v-if="
|
|
35
|
-
name="
|
|
34
|
+
v-if="hasCloseButtonSlot"
|
|
35
|
+
name="close-button"
|
|
36
36
|
/>
|
|
37
37
|
<dl-icon
|
|
38
38
|
v-else
|
|
@@ -61,13 +61,13 @@ export default defineComponent({
|
|
|
61
61
|
additionalInfo: { type: String, default: '' },
|
|
62
62
|
withCloseButton: { type: Boolean, default: false }
|
|
63
63
|
},
|
|
64
|
-
emits: ['
|
|
64
|
+
emits: ['close-button-click'],
|
|
65
65
|
computed: {
|
|
66
66
|
hasHeaderSlot(): boolean {
|
|
67
67
|
return this.$slots.header !== undefined
|
|
68
68
|
},
|
|
69
|
-
|
|
70
|
-
return this.$slots['
|
|
69
|
+
hasCloseButtonSlot(): boolean {
|
|
70
|
+
return this.$slots['close-button'] !== undefined
|
|
71
71
|
},
|
|
72
72
|
hasAdditionalInfo(): boolean {
|
|
73
73
|
return this.additionalInfo !== ''
|
|
@@ -81,8 +81,8 @@ export default defineComponent({
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
methods: {
|
|
84
|
-
|
|
85
|
-
this.$emit('
|
|
84
|
+
handleClick(e: Event) {
|
|
85
|
+
this.$emit('close-button-click', e)
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
})
|
|
@@ -107,7 +107,7 @@ export default defineComponent({
|
|
|
107
107
|
color: var(--dl-color-darker);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
.
|
|
110
|
+
.close-button {
|
|
111
111
|
display: flex;
|
|
112
112
|
justify-content: center;
|
|
113
113
|
align-items: center;
|
|
@@ -177,14 +177,8 @@ export default defineComponent({
|
|
|
177
177
|
normalizeModel()
|
|
178
178
|
|
|
179
179
|
const initialValue = {
|
|
180
|
-
min:
|
|
181
|
-
|
|
182
|
-
? props.min
|
|
183
|
-
: between(props.modelValue.min, props.min, props.max),
|
|
184
|
-
max:
|
|
185
|
-
props.modelValue.max === null
|
|
186
|
-
? props.max
|
|
187
|
-
: between(props.modelValue.max, props.min, props.max)
|
|
180
|
+
min: props.min,
|
|
181
|
+
max: props.max
|
|
188
182
|
}
|
|
189
183
|
|
|
190
184
|
const modelMinRatio = computed(() =>
|
|
@@ -402,7 +396,7 @@ export default defineComponent({
|
|
|
402
396
|
|
|
403
397
|
model.value.min = initialValue.min!
|
|
404
398
|
model.value.max = initialValue.max!
|
|
405
|
-
|
|
399
|
+
updateValue()
|
|
406
400
|
}
|
|
407
401
|
|
|
408
402
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash'
|
|
1
2
|
import { between, includes, KEY_CODE } from '../../../utils'
|
|
2
3
|
import { Dragging, dragType } from '../DlSlider/useSlider'
|
|
3
4
|
|
|
@@ -12,12 +13,10 @@ export function updateValue(
|
|
|
12
13
|
emitFn: (...args: any[]) => any,
|
|
13
14
|
change?: boolean
|
|
14
15
|
) {
|
|
15
|
-
|
|
16
|
-
emitFn('update:model-value', { ...state })
|
|
17
|
-
}
|
|
16
|
+
emitFn('update:model-value', cloneDeep(state))
|
|
18
17
|
|
|
19
18
|
if (change === true) {
|
|
20
|
-
emitFn('change',
|
|
19
|
+
emitFn('change', cloneDeep(state))
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
additional-info="Some additional information"
|
|
7
7
|
subtitle="Some text for better explanation."
|
|
8
8
|
with-close-button
|
|
9
|
-
@
|
|
9
|
+
@close-button-click="handleClear"
|
|
10
10
|
>
|
|
11
11
|
<dl-text-area
|
|
12
12
|
v-model="text"
|
|
@@ -15,12 +15,36 @@
|
|
|
15
15
|
placeholder="Type your text"
|
|
16
16
|
width="203px"
|
|
17
17
|
/>
|
|
18
|
-
<template #
|
|
18
|
+
<template #footer>
|
|
19
|
+
<dl-button fluid>
|
|
20
|
+
Save
|
|
21
|
+
</dl-button>
|
|
22
|
+
</template>
|
|
23
|
+
</dl-popup>
|
|
24
|
+
</dl-button>
|
|
25
|
+
<div />
|
|
26
|
+
<dl-button label="Open Popup persistent">
|
|
27
|
+
<dl-popup
|
|
28
|
+
title="Edit Item Description"
|
|
29
|
+
additional-info="Some additional information"
|
|
30
|
+
subtitle="Some text for better explanation."
|
|
31
|
+
with-close-button
|
|
32
|
+
persistent
|
|
33
|
+
>
|
|
34
|
+
<dl-text-area
|
|
35
|
+
v-model="text"
|
|
36
|
+
:max-length="100"
|
|
37
|
+
show-counter
|
|
38
|
+
placeholder="Type your text"
|
|
39
|
+
width="203px"
|
|
40
|
+
/>
|
|
41
|
+
<template #close-button>
|
|
19
42
|
<dl-button
|
|
20
43
|
flat
|
|
21
44
|
style="padding-bottom: 0; padding-top: 0"
|
|
22
45
|
label="clear"
|
|
23
46
|
size="m"
|
|
47
|
+
@click="handleClear"
|
|
24
48
|
/>
|
|
25
49
|
</template>
|
|
26
50
|
<template #footer>
|
|
@@ -30,7 +54,6 @@
|
|
|
30
54
|
</template>
|
|
31
55
|
</dl-popup>
|
|
32
56
|
</dl-button>
|
|
33
|
-
<div />
|
|
34
57
|
</div>
|
|
35
58
|
</template>
|
|
36
59
|
<script lang="ts">
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
v-model="value"
|
|
5
5
|
width="500px"
|
|
6
6
|
:min="0"
|
|
7
|
-
:max="
|
|
8
|
-
:step="
|
|
7
|
+
:max="1"
|
|
8
|
+
:step="0.1"
|
|
9
9
|
text="Range"
|
|
10
|
-
:snap="true"
|
|
11
10
|
:readonly="readonly"
|
|
12
11
|
:disabled="disabled"
|
|
13
12
|
name="range"
|
|
@@ -20,6 +19,9 @@
|
|
|
20
19
|
Disable: {{ disabled }}
|
|
21
20
|
</button>
|
|
22
21
|
</div>
|
|
22
|
+
<div>
|
|
23
|
+
{{ value }}
|
|
24
|
+
</div>
|
|
23
25
|
</div>
|
|
24
26
|
</template>
|
|
25
27
|
|
|
@@ -34,11 +36,16 @@ export default defineComponent({
|
|
|
34
36
|
},
|
|
35
37
|
data() {
|
|
36
38
|
return {
|
|
37
|
-
value: { min: 0, max:
|
|
39
|
+
value: { min: 0, max: 0.5 },
|
|
38
40
|
disabled: false,
|
|
39
41
|
readonly: false
|
|
40
42
|
}
|
|
41
43
|
},
|
|
44
|
+
watch: {
|
|
45
|
+
value(val) {
|
|
46
|
+
console.log('value changed: ', val)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
42
49
|
template: 'dl-range-demo'
|
|
43
50
|
})
|
|
44
51
|
</script>
|