@fy-/fws-vue 0.6.9 → 0.7.0
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/components/ui/DefaultNotif.vue +19 -19
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "@heroicons/vue/24/solid";
|
|
14
14
|
import { useEventBus } from "../../composables/event-bus";
|
|
15
15
|
import type { Component } from "vue";
|
|
16
|
-
import
|
|
16
|
+
import ScaleTransition from "./transitions/ScaleTransition.vue";
|
|
17
17
|
interface NotifProps {
|
|
18
18
|
imgSrc?: string;
|
|
19
19
|
imgIcon?: Component;
|
|
@@ -29,32 +29,32 @@ const notif = ref<HTMLElement | null>(null);
|
|
|
29
29
|
const eventBus = useEventBus();
|
|
30
30
|
const currentNotif = ref<NotifProps | null>(null);
|
|
31
31
|
let currentTimeout: any | null = null;
|
|
32
|
-
const onCall = (
|
|
32
|
+
const onCall = (data: NotifProps) => {
|
|
33
33
|
if (currentNotif.value !== null) {
|
|
34
34
|
hideNotif();
|
|
35
35
|
}
|
|
36
|
-
const actualIcon = ref(
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
36
|
+
const actualIcon = ref(data.imgIcon);
|
|
37
|
+
if (data.imgIcon === undefined) {
|
|
38
|
+
if (data.type === "info") {
|
|
39
39
|
actualIcon.value = LightBulbIcon;
|
|
40
|
-
} else if (
|
|
40
|
+
} else if (data.type === "warning") {
|
|
41
41
|
actualIcon.value = ExclamationTriangleIcon;
|
|
42
|
-
} else if (
|
|
42
|
+
} else if (data.type === "success") {
|
|
43
43
|
actualIcon.value = CheckCircleIcon;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
if (!
|
|
47
|
-
|
|
46
|
+
if (!data.time || data.time < 1000) {
|
|
47
|
+
data.time = 5000;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
currentNotif.value = {
|
|
51
|
-
imgSrc:
|
|
51
|
+
imgSrc: data.imgSrc,
|
|
52
52
|
imgIcon: actualIcon.value,
|
|
53
|
-
title:
|
|
54
|
-
content:
|
|
55
|
-
ctaText:
|
|
56
|
-
ctaLink:
|
|
57
|
-
ctaAction:
|
|
53
|
+
title: data.title,
|
|
54
|
+
content: data.content,
|
|
55
|
+
ctaText: data.ctaText,
|
|
56
|
+
ctaLink: data.ctaLink,
|
|
57
|
+
ctaAction: data.ctaAction,
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
currentTimeout = setTimeout(() => {
|
|
@@ -69,14 +69,14 @@ const hideNotif = () => {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
onMounted(() => {
|
|
72
|
-
eventBus.on("
|
|
72
|
+
eventBus.on("SendNotif", onCall);
|
|
73
73
|
});
|
|
74
74
|
onUnmounted(() => {
|
|
75
|
-
eventBus.off("
|
|
75
|
+
eventBus.off("SendNotif", onCall);
|
|
76
76
|
});
|
|
77
77
|
</script>
|
|
78
78
|
<template>
|
|
79
|
-
<
|
|
79
|
+
<ScaleTransition>
|
|
80
80
|
<div
|
|
81
81
|
id="mainNotif"
|
|
82
82
|
ref="notif"
|
|
@@ -156,5 +156,5 @@ onUnmounted(() => {
|
|
|
156
156
|
</button>
|
|
157
157
|
</div>
|
|
158
158
|
</div>
|
|
159
|
-
</
|
|
159
|
+
</ScaleTransition>
|
|
160
160
|
</template>
|