@fy-/fws-vue 2.1.47 → 2.1.48
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.
|
@@ -62,9 +62,7 @@ function onCall(data: NotifProps) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// Set the new notification
|
|
65
|
-
currentNotif.value = {
|
|
66
|
-
...data,
|
|
67
|
-
}
|
|
65
|
+
currentNotif.value = { ...data }
|
|
68
66
|
|
|
69
67
|
// (A) Hide the notification after the specified time
|
|
70
68
|
hideTimeout = setTimeout(() => hideNotif(), data.time)
|
|
@@ -74,7 +72,8 @@ function onCall(data: NotifProps) {
|
|
|
74
72
|
progressInterval = setInterval(() => {
|
|
75
73
|
if (currentNotif.value && data.time) {
|
|
76
74
|
// update progress based on a 100ms tick
|
|
77
|
-
progress.value +=
|
|
75
|
+
progress.value += 100 / (data.time / 100)
|
|
76
|
+
// if progress hits or exceeds 100, hide
|
|
78
77
|
if (progress.value >= 100) {
|
|
79
78
|
hideNotif()
|
|
80
79
|
}
|
|
@@ -82,9 +81,7 @@ function onCall(data: NotifProps) {
|
|
|
82
81
|
}, 100)
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
/**
|
|
86
|
-
* Clears everything related to the current notification
|
|
87
|
-
*/
|
|
84
|
+
/** Clears everything related to the current notification */
|
|
88
85
|
function hideNotif() {
|
|
89
86
|
currentNotif.value = null
|
|
90
87
|
progress.value = 0
|
|
@@ -99,16 +96,12 @@ function hideNotif() {
|
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
98
|
|
|
102
|
-
/**
|
|
103
|
-
* Setup: Listen to the global event bus
|
|
104
|
-
*/
|
|
99
|
+
/** Setup: Listen to the global event bus */
|
|
105
100
|
onMounted(() => {
|
|
106
101
|
eventBus.on('SendNotif', onCall)
|
|
107
102
|
})
|
|
108
103
|
|
|
109
|
-
/**
|
|
110
|
-
* Cleanup: remove event listeners
|
|
111
|
-
*/
|
|
104
|
+
/** Cleanup: remove event listeners */
|
|
112
105
|
onUnmounted(() => {
|
|
113
106
|
eventBus.off('SendNotif', onCall)
|
|
114
107
|
})
|
|
@@ -132,7 +125,7 @@ onUnmounted(() => {
|
|
|
132
125
|
currentNotif.type === 'secret',
|
|
133
126
|
}"
|
|
134
127
|
>
|
|
135
|
-
<!-- PROGRESS BAR
|
|
128
|
+
<!-- PROGRESS BAR at top (4px) -->
|
|
136
129
|
<div class="absolute top-0 left-0 w-full h-[4px] bg-gray-200">
|
|
137
130
|
<div
|
|
138
131
|
class="h-full bg-current transition-[width]"
|
|
@@ -171,7 +164,6 @@ onUnmounted(() => {
|
|
|
171
164
|
aria-label="Close"
|
|
172
165
|
@click="hideNotif"
|
|
173
166
|
>
|
|
174
|
-
<!-- i18n example, or plain text like "Dismiss" -->
|
|
175
167
|
{{ $t("dismiss_cta") }}
|
|
176
168
|
</button>
|
|
177
169
|
</div>
|