adata-ui 2.1.40-beta.12 → 2.1.40-beta.13
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.
|
@@ -30,17 +30,33 @@ watch(percent, (value) => {
|
|
|
30
30
|
displayPercent.value = value
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const usageLevel = computed<'normal' | 'warning' | 'critical'>(() => {
|
|
34
|
+
if (percent.value < 20) return 'critical'
|
|
35
|
+
if (percent.value < 40) return 'warning'
|
|
36
|
+
return 'normal'
|
|
37
|
+
})
|
|
34
38
|
|
|
35
|
-
const barColorClass = computed(() =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
const barColorClass = computed(() => {
|
|
40
|
+
switch (usageLevel.value) {
|
|
41
|
+
case 'critical':
|
|
42
|
+
return 'bg-red-500 dark:bg-red-400'
|
|
43
|
+
case 'warning':
|
|
44
|
+
return 'bg-yellow-500 dark:bg-yellow-400'
|
|
45
|
+
default:
|
|
46
|
+
return 'bg-blue-600 dark:bg-blue-500'
|
|
47
|
+
}
|
|
48
|
+
})
|
|
40
49
|
|
|
41
|
-
const valueColorClass = computed(() =>
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
const valueColorClass = computed(() => {
|
|
51
|
+
switch (usageLevel.value) {
|
|
52
|
+
case 'critical':
|
|
53
|
+
return 'text-red-600 dark:text-red-400'
|
|
54
|
+
case 'warning':
|
|
55
|
+
return 'text-yellow-600 dark:text-yellow-400'
|
|
56
|
+
default:
|
|
57
|
+
return 'text-gray-900 dark:text-gray-100'
|
|
58
|
+
}
|
|
59
|
+
})
|
|
44
60
|
</script>
|
|
45
61
|
|
|
46
62
|
<template>
|
|
@@ -20,6 +20,8 @@ const props = withDefaults(defineProps<{
|
|
|
20
20
|
swipeToClose?: boolean
|
|
21
21
|
swipeThreshold?: number
|
|
22
22
|
showDragHandle?: boolean
|
|
23
|
+
dataTestId?: string
|
|
24
|
+
iconXMarkTestId?: string
|
|
23
25
|
}>(), {
|
|
24
26
|
size: 'md',
|
|
25
27
|
closeOnOverlay: true,
|
|
@@ -34,6 +36,8 @@ const props = withDefaults(defineProps<{
|
|
|
34
36
|
swipeToClose: true,
|
|
35
37
|
swipeThreshold: 65,
|
|
36
38
|
showDragHandle: true,
|
|
39
|
+
dataTestId: undefined,
|
|
40
|
+
iconXMarkTestId: undefined,
|
|
37
41
|
})
|
|
38
42
|
|
|
39
43
|
const emit = defineEmits<{
|
|
@@ -286,6 +290,7 @@ function onTouchEnd() {
|
|
|
286
290
|
ref="contentRef"
|
|
287
291
|
:class="contentBaseClass"
|
|
288
292
|
:style="sizeStyle"
|
|
293
|
+
:data-test-id="dataTestId"
|
|
289
294
|
@mousedown.stop
|
|
290
295
|
>
|
|
291
296
|
<div
|
|
@@ -316,6 +321,7 @@ function onTouchEnd() {
|
|
|
316
321
|
v-if="!hideClose"
|
|
317
322
|
type="button"
|
|
318
323
|
class="ml-auto rounded-sm p-1 transition hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-gray-200"
|
|
324
|
+
:data-test-id="iconXMarkTestId"
|
|
319
325
|
@click="closeIfAllowed"
|
|
320
326
|
>
|
|
321
327
|
<a-icon-x-mark class="size-4" />
|