@dataloop-ai/components 0.16.57 → 0.16.60
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/assets/constants.scss +1 -1
- package/src/assets/globals.scss +17 -16
- package/src/components/basic/DlKpi/DlKpi.vue +4 -3
- 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/components/compound/DlToast/api/useToast.ts +40 -3
- package/src/components/compound/DlToast/components/ToastComponent.vue +82 -13
- package/src/components/compound/DlToast/utils/render.ts +2 -2
- package/src/components/essential/DlProgressBar/DlProgressBar.vue +8 -3
- package/src/demos/DlAlertDemo.vue +7 -0
- package/src/demos/DlPopupDemo.vue +26 -3
- package/src/demos/DlRangeDemo.vue +11 -4
- package/src/demos/DlToastDemo.vue +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Constants
|
|
3
3
|
--dl-color-alert-success: #38D079;
|
|
4
4
|
--dl-color-alert-success-background: #E1FFF0;
|
|
5
|
-
--dl-color-alert-warn:
|
|
5
|
+
--dl-color-alert-warn: #FFDA3A;
|
|
6
6
|
--dl-color-alert-warn-background: #FFF7D6;
|
|
7
7
|
--dl-color-alert-error: #FF3434;
|
|
8
8
|
--dl-color-alert-error-background: #FFEAEA ;
|
package/src/assets/globals.scss
CHANGED
|
@@ -155,22 +155,25 @@ body {
|
|
|
155
155
|
--dl-color-panel-background: #FFFFFF;
|
|
156
156
|
--dl-color-side-panel: #18195C;
|
|
157
157
|
--dl-color-shadow: #FFFFFF;
|
|
158
|
-
--dl-color-negative: #FF3434;
|
|
159
|
-
--dl-color-negative-background: #FFEAEA;
|
|
160
|
-
--dl-color-warning: #FFDA3A;
|
|
161
|
-
--dl-color-warning-background: #FFF7D6;
|
|
162
|
-
--dl-color-positive: #039E49;
|
|
163
|
-
--dl-color-positive-background: #E1FFF0;
|
|
164
|
-
--dl-color-info-background: #F3F9FF;
|
|
165
158
|
--dl-color-icon-default: #171723;
|
|
166
159
|
--dl-color-fill-secondary: #FBF8F8;
|
|
167
160
|
--dl-color-fill-third: #FBFBFB;
|
|
168
161
|
--dl-color-link: #20ABFA;
|
|
169
|
-
--dl-color-info: #4E81B3;
|
|
170
162
|
--dl-color-cell-background: #FFFAE2;
|
|
171
163
|
--q-color-positive: #38D079;
|
|
172
164
|
--q-color-warning: #E1B75B;
|
|
173
165
|
|
|
166
|
+
// alert colors
|
|
167
|
+
--dl-color-negative: var(--dl-color-alert-error);
|
|
168
|
+
--dl-color-negative-background: var(--dl-color-alert-error-background);
|
|
169
|
+
--dl-color-warning: var(--dl-color-alert-warn);
|
|
170
|
+
--dl-color-warning-background: var(--dl-color-alert-warn-background);
|
|
171
|
+
--dl-color-positive: var(--dl-color-alert-success);
|
|
172
|
+
--dl-color-positive-background: var(--dl-color-alert-success-background);
|
|
173
|
+
--dl-color-info: var(--dl-color-alert-info);
|
|
174
|
+
--dl-color-info-background: var(--dl-color-alert-info-background);
|
|
175
|
+
|
|
176
|
+
|
|
174
177
|
--dl-color-chart-brush: #EEF1FF;
|
|
175
178
|
|
|
176
179
|
--dl-date-picker-shadow: 0px 3px 6px #101e7326;
|
|
@@ -205,22 +208,20 @@ body {
|
|
|
205
208
|
--dl-color-panel-background: #30363D;
|
|
206
209
|
--dl-color-side-panel: #2A343E;
|
|
207
210
|
--dl-color-shadow: #30363D;
|
|
208
|
-
--dl-color-negative: #FF3434;
|
|
209
|
-
--dl-color-negative-background: #734145;
|
|
210
|
-
--dl-color-warning: #FFDA3A;
|
|
211
|
-
--dl-color-warning-background: #7B7241;
|
|
212
|
-
--dl-color-positive: #00DE93;
|
|
213
|
-
--dl-color-positive-background: #3A644E;
|
|
214
|
-
--dl-color-info-background: #2F3C4B;
|
|
215
211
|
--dl-color-icon-default: #ffffffbf;
|
|
216
212
|
--dl-color-fill-secondary: #FFFFFF1A;
|
|
217
213
|
--dl-color-fill-third: #9E9E9E1A;
|
|
218
214
|
--dl-color-link: #53B2E8;
|
|
219
|
-
--dl-color-info: #92CDF2;
|
|
220
215
|
--dl-color-cell-background: #FFFAE2;
|
|
221
216
|
--q-color-positive: #A1E5B6;
|
|
222
217
|
--q-color-warning: #F8D29A;
|
|
223
218
|
|
|
219
|
+
// alert colors
|
|
220
|
+
--dl-color-negative-background: #734145;
|
|
221
|
+
--dl-color-warning-background: #7B7241;
|
|
222
|
+
--dl-color-positive-background: #3A644E;
|
|
223
|
+
--dl-color-info-background: #4B5A6B;
|
|
224
|
+
|
|
224
225
|
--dl-color-chart-brush: #475077;
|
|
225
226
|
|
|
226
227
|
--dl-date-picker-shadow: 0px 3px 6px #292e3580;
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
>
|
|
44
44
|
<dl-progress-bar
|
|
45
45
|
color="dl-color-darker"
|
|
46
|
+
height="5px"
|
|
46
47
|
:value="progressValue(progress)"
|
|
47
48
|
:show-value="true"
|
|
48
49
|
:show-percentage="true"
|
|
@@ -151,13 +152,13 @@ export default defineComponent({
|
|
|
151
152
|
)
|
|
152
153
|
|
|
153
154
|
const formatCounter = (counter: DlKpiCounterType) => {
|
|
154
|
-
if (
|
|
155
|
+
if (counter === null) {
|
|
155
156
|
return emptyString
|
|
156
157
|
}
|
|
157
158
|
if (typeof counter === 'number') {
|
|
158
159
|
return formatNumberCounter(counter)
|
|
159
160
|
}
|
|
160
|
-
if (
|
|
161
|
+
if (counter.value === null || counter.value === undefined) {
|
|
161
162
|
return emptyString
|
|
162
163
|
}
|
|
163
164
|
if (typeof counter.value === 'number') {
|
|
@@ -197,7 +198,7 @@ export default defineComponent({
|
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
const formatNumberCounter = (amount: number, format = '') => {
|
|
200
|
-
if (
|
|
201
|
+
if (isNaN(amount)) {
|
|
201
202
|
return emptyString
|
|
202
203
|
}
|
|
203
204
|
if (amount === 0) {
|
|
@@ -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
|
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { isVue3 } from 'vue-demi'
|
|
1
2
|
import toastComponent from '../components/ToastComponent.vue'
|
|
2
3
|
import { createComponent } from '../utils/render'
|
|
4
|
+
import { v4 } from 'uuid'
|
|
5
|
+
|
|
6
|
+
const state: { prevToastId: any; toasts: { [key: string]: any } } = {
|
|
7
|
+
prevToastId: null,
|
|
8
|
+
toasts: {}
|
|
9
|
+
}
|
|
3
10
|
|
|
4
11
|
export const useToast = (globalProps = {}) => {
|
|
5
12
|
return {
|
|
@@ -8,16 +15,46 @@ export const useToast = (globalProps = {}) => {
|
|
|
8
15
|
if (typeof options === 'string') message = options
|
|
9
16
|
|
|
10
17
|
const defaultProps = {
|
|
11
|
-
message
|
|
18
|
+
message,
|
|
19
|
+
identifier: v4()
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
const propsData = Object.assign(
|
|
15
23
|
{},
|
|
16
24
|
defaultProps,
|
|
17
25
|
globalProps,
|
|
18
|
-
options
|
|
26
|
+
options,
|
|
27
|
+
{
|
|
28
|
+
remove: () => {
|
|
29
|
+
delete state.toasts[defaultProps.identifier]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
if (state.prevToastId && state.toasts[state.prevToastId]) {
|
|
35
|
+
const toast = state.toasts[state.prevToastId]
|
|
36
|
+
const props = isVue3 ? toast.props : toast.$children[0]
|
|
37
|
+
const similar =
|
|
38
|
+
propsData.message === props.message &&
|
|
39
|
+
propsData.type === props.type
|
|
40
|
+
if (similar) {
|
|
41
|
+
if (isVue3) {
|
|
42
|
+
toast.proxy.updateCount(toast.proxy.count + 1)
|
|
43
|
+
} else {
|
|
44
|
+
toast.$children[0].updateCount(
|
|
45
|
+
toast.$children[0].count + 1
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
state.prevToastId = defaultProps.identifier
|
|
53
|
+
state.toasts[defaultProps.identifier] = createComponent(
|
|
54
|
+
toastComponent,
|
|
55
|
+
propsData,
|
|
56
|
+
document.body
|
|
19
57
|
)
|
|
20
|
-
createComponent(toastComponent, propsData, document.body)
|
|
21
58
|
}
|
|
22
59
|
}
|
|
23
60
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
>
|
|
6
6
|
<div
|
|
7
7
|
v-show="isActive"
|
|
8
|
-
id="DlToastContainer"
|
|
8
|
+
:id="`DlToastContainer-${uuid}`"
|
|
9
9
|
ref="root"
|
|
10
|
-
class="toast-item"
|
|
10
|
+
class="toast-item DlToastContainer"
|
|
11
11
|
:class="[
|
|
12
12
|
`toast-item--${type}`,
|
|
13
13
|
`toast-item--${position}`,
|
|
@@ -21,12 +21,35 @@
|
|
|
21
21
|
:closable="closable"
|
|
22
22
|
:dark-mode="false"
|
|
23
23
|
close-button-position="center"
|
|
24
|
+
style="position: relative"
|
|
24
25
|
@update:model-value="closeToast"
|
|
25
26
|
>
|
|
26
27
|
<span
|
|
27
28
|
class="toast-message"
|
|
28
29
|
data-test="message-text"
|
|
29
30
|
/>
|
|
31
|
+
<dl-badge
|
|
32
|
+
v-if="count"
|
|
33
|
+
with-border
|
|
34
|
+
floating
|
|
35
|
+
align="top"
|
|
36
|
+
:color="badgeColor"
|
|
37
|
+
:text-color="
|
|
38
|
+
type === 'warning'
|
|
39
|
+
? 'var(--dl-color-alert-text)'
|
|
40
|
+
: 'var(--dl-color-text-buttons)'
|
|
41
|
+
"
|
|
42
|
+
style="
|
|
43
|
+
display: grid;
|
|
44
|
+
text-align: center;
|
|
45
|
+
width: fit-content;
|
|
46
|
+
padding: 3px;
|
|
47
|
+
min-width: 1em;
|
|
48
|
+
top: -5px;
|
|
49
|
+
"
|
|
50
|
+
>
|
|
51
|
+
{{ count + 1 }}
|
|
52
|
+
</dl-badge>
|
|
30
53
|
</dl-alert>
|
|
31
54
|
</div>
|
|
32
55
|
</transition>
|
|
@@ -40,14 +63,15 @@ import {
|
|
|
40
63
|
onMounted,
|
|
41
64
|
ref
|
|
42
65
|
} from 'vue-demi'
|
|
43
|
-
import { DlAlert } from '../../../
|
|
66
|
+
import { DlAlert, DlBadge } from '../../../'
|
|
44
67
|
import { Positions, Types } from '../utils/config'
|
|
45
68
|
import { removeElement } from '../utils/render'
|
|
46
69
|
import { Animation } from '../types'
|
|
70
|
+
import { v4 } from 'uuid'
|
|
47
71
|
|
|
48
72
|
export default defineComponent({
|
|
49
73
|
name: 'ToastComponent',
|
|
50
|
-
components: { DlAlert },
|
|
74
|
+
components: { DlAlert, DlBadge },
|
|
51
75
|
props: {
|
|
52
76
|
message: {
|
|
53
77
|
type: String,
|
|
@@ -88,16 +112,22 @@ export default defineComponent({
|
|
|
88
112
|
default: 5
|
|
89
113
|
}
|
|
90
114
|
},
|
|
91
|
-
|
|
115
|
+
emits: ['removed'],
|
|
116
|
+
setup(props: any, { emit }) {
|
|
117
|
+
const uuid = v4()
|
|
92
118
|
const { position, duration, message, collapseCount } = props
|
|
93
119
|
const root = ref(null)
|
|
120
|
+
const count = ref(0)
|
|
94
121
|
let parentTop: HTMLElement = null
|
|
95
122
|
let parentBottom: HTMLElement = null
|
|
96
123
|
const toastParentPosition = ref(null)
|
|
97
124
|
const isActive = ref(false)
|
|
98
125
|
function closeToastMessage(): void {
|
|
99
126
|
isActive.value = false
|
|
100
|
-
setTimeout(() =>
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
emit('removed')
|
|
129
|
+
removeElement(root.value)
|
|
130
|
+
}, 200)
|
|
101
131
|
}
|
|
102
132
|
onBeforeMount(() => {
|
|
103
133
|
setupContainer()
|
|
@@ -157,6 +187,19 @@ export default defineComponent({
|
|
|
157
187
|
showNotice()
|
|
158
188
|
})
|
|
159
189
|
|
|
190
|
+
const timeoutId = ref(null)
|
|
191
|
+
|
|
192
|
+
const setHideTimeout = () => {
|
|
193
|
+
if (timeoutId.value) {
|
|
194
|
+
clearTimeout(timeoutId.value)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
timeoutId.value = setTimeout(() => {
|
|
198
|
+
closeToastMessage()
|
|
199
|
+
timeoutId.value = null
|
|
200
|
+
}, duration * 1000)
|
|
201
|
+
}
|
|
202
|
+
|
|
160
203
|
function showNotice(): void {
|
|
161
204
|
const parent = correctParent.value
|
|
162
205
|
const container = root.value.closest('.dl-toast-container--pending')
|
|
@@ -165,24 +208,50 @@ export default defineComponent({
|
|
|
165
208
|
container?.remove()
|
|
166
209
|
isActive.value = true
|
|
167
210
|
if (duration) {
|
|
168
|
-
|
|
169
|
-
closeToastMessage()
|
|
170
|
-
}, duration * 1000)
|
|
211
|
+
setHideTimeout()
|
|
171
212
|
}
|
|
172
213
|
if (collapseCount && collapseCount < parent.childNodes.length) {
|
|
173
|
-
setTimeout(() =>
|
|
214
|
+
setTimeout(() => {
|
|
215
|
+
emit('removed')
|
|
216
|
+
removeElement(parent.lastElementChild)
|
|
217
|
+
}, 200)
|
|
174
218
|
}
|
|
175
219
|
}
|
|
176
220
|
function closeToast(val: boolean) {
|
|
177
|
-
if (!val)
|
|
221
|
+
if (!val) {
|
|
222
|
+
emit('removed')
|
|
223
|
+
removeElement(root.value)
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const updateCount = (val: number) => {
|
|
228
|
+
count.value = val
|
|
229
|
+
setHideTimeout()
|
|
178
230
|
}
|
|
179
231
|
|
|
232
|
+
const badgeColor = computed(() => {
|
|
233
|
+
switch (props.type) {
|
|
234
|
+
case Types.success:
|
|
235
|
+
return 'var(--dl-color-alert-success)'
|
|
236
|
+
case Types.warning:
|
|
237
|
+
return 'var(--dl-color-alert-warn)'
|
|
238
|
+
case Types.error:
|
|
239
|
+
return 'var(--dl-color-alert-error)'
|
|
240
|
+
case Types.info:
|
|
241
|
+
return 'var(--dl-color-alert-info)'
|
|
242
|
+
}
|
|
243
|
+
})
|
|
244
|
+
|
|
180
245
|
return {
|
|
246
|
+
uuid,
|
|
181
247
|
root,
|
|
182
248
|
transition,
|
|
183
249
|
isActive,
|
|
184
250
|
closeToast,
|
|
185
|
-
correctParent
|
|
251
|
+
correctParent,
|
|
252
|
+
updateCount,
|
|
253
|
+
count,
|
|
254
|
+
badgeColor
|
|
186
255
|
}
|
|
187
256
|
}
|
|
188
257
|
})
|
|
@@ -304,7 +373,7 @@ export default defineComponent({
|
|
|
304
373
|
}
|
|
305
374
|
}
|
|
306
375
|
|
|
307
|
-
|
|
376
|
+
.DlToastContainer {
|
|
308
377
|
--dl-color-negative: var(--dl-color-alert-error);
|
|
309
378
|
--dl-color-negative-background: var(--dl-color-alert-error-background);
|
|
310
379
|
--dl-color-warning: var(--dl-color-alert-warn);
|
|
@@ -30,7 +30,7 @@ if (VueDemi.isVue3) {
|
|
|
30
30
|
const container = document.createElement('div')
|
|
31
31
|
container.classList.add('dl-toast-container--pending')
|
|
32
32
|
parentContainer.appendChild(container)
|
|
33
|
-
renderVue2Component(
|
|
33
|
+
return renderVue2Component(
|
|
34
34
|
ToastComponent,
|
|
35
35
|
props,
|
|
36
36
|
'.dl-toast-container--pending'
|
|
@@ -53,7 +53,7 @@ function renderVue2Component(
|
|
|
53
53
|
props: Object,
|
|
54
54
|
container: string
|
|
55
55
|
) {
|
|
56
|
-
new VueDemi.Vue2({
|
|
56
|
+
return new VueDemi.Vue2({
|
|
57
57
|
render: (h: (arg0: Object, arg1: { props: Object }) => any) =>
|
|
58
58
|
h(component, { props })
|
|
59
59
|
}).$mount(container)
|
|
@@ -85,6 +85,10 @@ export default defineComponent({
|
|
|
85
85
|
type: String,
|
|
86
86
|
default: '100%'
|
|
87
87
|
},
|
|
88
|
+
height: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: '4px'
|
|
91
|
+
},
|
|
88
92
|
summary: {
|
|
89
93
|
type: String,
|
|
90
94
|
default: ''
|
|
@@ -102,6 +106,7 @@ export default defineComponent({
|
|
|
102
106
|
cssVars(): Record<string, string> {
|
|
103
107
|
return {
|
|
104
108
|
'--dl-progress-bar-width': `${this.computedValue}%`,
|
|
109
|
+
'--dl-progress-bar-height': `${this.height}`,
|
|
105
110
|
'--dl-progress-bar-bg': getColor(this.color)
|
|
106
111
|
}
|
|
107
112
|
}
|
|
@@ -109,7 +114,7 @@ export default defineComponent({
|
|
|
109
114
|
})
|
|
110
115
|
</script>
|
|
111
116
|
|
|
112
|
-
<style scoped>
|
|
117
|
+
<style scoped lang="scss">
|
|
113
118
|
.dl-progress-bar-label {
|
|
114
119
|
margin: 0;
|
|
115
120
|
font-size: var(--dl-font-size-body);
|
|
@@ -119,7 +124,7 @@ export default defineComponent({
|
|
|
119
124
|
.dl-progress-bar {
|
|
120
125
|
overflow: hidden;
|
|
121
126
|
width: 100%;
|
|
122
|
-
height:
|
|
127
|
+
height: var(--dl-progress-bar-height);
|
|
123
128
|
border-radius: 2px;
|
|
124
129
|
background-color: var(--dl-color-separator);
|
|
125
130
|
margin: 6px 0;
|
|
@@ -127,7 +132,7 @@ export default defineComponent({
|
|
|
127
132
|
.dl-progress-bar-indicator {
|
|
128
133
|
transition: width 0.5s;
|
|
129
134
|
display: block;
|
|
130
|
-
height:
|
|
135
|
+
height: var(--dl-progress-bar-height);
|
|
131
136
|
border-radius: 2px;
|
|
132
137
|
background-color: var(--dl-progress-bar-bg);
|
|
133
138
|
width: var(--dl-progress-bar-width);
|
|
@@ -39,6 +39,13 @@
|
|
|
39
39
|
>
|
|
40
40
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
|
41
41
|
</DlAlert>
|
|
42
|
+
<DlAlert
|
|
43
|
+
type="success"
|
|
44
|
+
text="Text: Lorem ipsum dolor sit amet, consectetur adipisicing elit. "
|
|
45
|
+
:closable="true"
|
|
46
|
+
>
|
|
47
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
|
48
|
+
</DlAlert>
|
|
42
49
|
</div>
|
|
43
50
|
</template>
|
|
44
51
|
|
|
@@ -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>
|
|
@@ -132,7 +132,7 @@ export default defineComponent({
|
|
|
132
132
|
message: message.value,
|
|
133
133
|
position: position.value,
|
|
134
134
|
type: type.value,
|
|
135
|
-
duration: duration.value,
|
|
135
|
+
duration: Number(duration.value) || 1000,
|
|
136
136
|
classItem: classItem.value,
|
|
137
137
|
closable: closable.value,
|
|
138
138
|
width: width.value,
|