pukaad-ui-lib 1.430.0 → 1.430.1
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/dist/module.json +1 -1
- package/dist/runtime/components/drawer/drawer-notification.vue +3 -9
- package/dist/runtime/components/input/input-address.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-address.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-file.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-file.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-password.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-password.vue.d.ts +1 -1
- package/dist/runtime/components/modal/modal-password-confirmed.d.vue.ts +1 -1
- package/dist/runtime/components/modal/modal-password-confirmed.vue.d.ts +1 -1
- package/dist/runtime/components/modal/modal-password-verify.d.vue.ts +1 -1
- package/dist/runtime/components/modal/modal-password-verify.vue.d.ts +1 -1
- package/dist/runtime/composables/store-notification.js +13 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -67,18 +67,12 @@
|
|
|
67
67
|
<div class="flex flex-col gap-[4px]">
|
|
68
68
|
<div class="font-body-medium">
|
|
69
69
|
<span
|
|
70
|
-
v-if="item.actor"
|
|
70
|
+
v-if="item.actor && !isGrouped(item)"
|
|
71
71
|
class="font-body-medium-prominent"
|
|
72
72
|
>
|
|
73
73
|
{{ item.actor.name }}
|
|
74
74
|
</span>
|
|
75
75
|
{{ item.message }}
|
|
76
|
-
<span
|
|
77
|
-
v-if="item.grouped_count && item.grouped_count > 1"
|
|
78
|
-
class="text-gray font-body-small"
|
|
79
|
-
>
|
|
80
|
-
({{ item.grouped_count }} คน)
|
|
81
|
-
</span>
|
|
82
76
|
</div>
|
|
83
77
|
<div class="text-gray font-body-small">
|
|
84
78
|
{{ formatRelativeTime(item.created_at) }}
|
|
@@ -201,8 +195,7 @@ const markAsRead = async (item) => {
|
|
|
201
195
|
try {
|
|
202
196
|
await api(`/notifications/${item.id}/read`, { method: "PATCH" });
|
|
203
197
|
item.is_read = true;
|
|
204
|
-
|
|
205
|
-
notificationStore.setUnreadCount(totalUnread);
|
|
198
|
+
notificationStore.fetchUnreadCount();
|
|
206
199
|
} catch {
|
|
207
200
|
}
|
|
208
201
|
};
|
|
@@ -219,6 +212,7 @@ const onClickNotification = (item) => {
|
|
|
219
212
|
markAsRead(item);
|
|
220
213
|
emit("select", item);
|
|
221
214
|
};
|
|
215
|
+
const isGrouped = (item) => !!item.grouped_count && item.grouped_count > 1;
|
|
222
216
|
const formatRelativeTime = (dateStr) => {
|
|
223
217
|
const now = /* @__PURE__ */ new Date();
|
|
224
218
|
const date = new Date(dateStr);
|
|
@@ -50,10 +50,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
50
50
|
name: string;
|
|
51
51
|
required: boolean;
|
|
52
52
|
placeholder: string;
|
|
53
|
+
gap: string;
|
|
53
54
|
labelDetail: string;
|
|
54
55
|
placeholderDetail: string;
|
|
55
56
|
requiredDetail: boolean;
|
|
56
|
-
gap: string;
|
|
57
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
58
58
|
declare const _default: typeof __VLS_export;
|
|
59
59
|
export default _default;
|
|
@@ -50,10 +50,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
50
50
|
name: string;
|
|
51
51
|
required: boolean;
|
|
52
52
|
placeholder: string;
|
|
53
|
+
gap: string;
|
|
53
54
|
labelDetail: string;
|
|
54
55
|
placeholderDetail: string;
|
|
55
56
|
requiredDetail: boolean;
|
|
56
|
-
gap: string;
|
|
57
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
58
58
|
declare const _default: typeof __VLS_export;
|
|
59
59
|
export default _default;
|
|
@@ -37,8 +37,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
37
37
|
fullHeight: boolean;
|
|
38
38
|
fullWidth: boolean;
|
|
39
39
|
limit: number;
|
|
40
|
-
disabledErrorMessage: boolean;
|
|
41
40
|
accept: string;
|
|
41
|
+
disabledErrorMessage: boolean;
|
|
42
42
|
labelIcon: string;
|
|
43
43
|
disabledDrop: boolean;
|
|
44
44
|
column: boolean;
|
|
@@ -37,8 +37,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
37
37
|
fullHeight: boolean;
|
|
38
38
|
fullWidth: boolean;
|
|
39
39
|
limit: number;
|
|
40
|
-
disabledErrorMessage: boolean;
|
|
41
40
|
accept: string;
|
|
41
|
+
disabledErrorMessage: boolean;
|
|
42
42
|
labelIcon: string;
|
|
43
43
|
disabledDrop: boolean;
|
|
44
44
|
column: boolean;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
22
22
|
}>, {
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
|
-
new: boolean;
|
|
26
25
|
disabledForgotPassword: boolean;
|
|
26
|
+
new: boolean;
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
28
|
declare const _default: typeof __VLS_export;
|
|
29
29
|
export default _default;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
22
22
|
}>, {
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
|
-
new: boolean;
|
|
26
25
|
disabledForgotPassword: boolean;
|
|
26
|
+
new: boolean;
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
28
|
declare const _default: typeof __VLS_export;
|
|
29
29
|
export default _default;
|
|
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
24
|
}) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
title: string;
|
|
27
|
-
disabledForgotPassword: boolean;
|
|
28
27
|
confirmText: string;
|
|
28
|
+
disabledForgotPassword: boolean;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
31
31
|
export default _default;
|
|
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
24
|
}) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
title: string;
|
|
27
|
-
disabledForgotPassword: boolean;
|
|
28
27
|
confirmText: string;
|
|
28
|
+
disabledForgotPassword: boolean;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
31
31
|
export default _default;
|
|
@@ -32,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
32
32
|
}>, {
|
|
33
33
|
title: string;
|
|
34
34
|
mode: "login" | "secure";
|
|
35
|
-
disabledForgotPassword: boolean;
|
|
36
35
|
confirmText: string;
|
|
36
|
+
disabledForgotPassword: boolean;
|
|
37
37
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const _default: typeof __VLS_export;
|
|
39
39
|
export default _default;
|
|
@@ -32,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
32
32
|
}>, {
|
|
33
33
|
title: string;
|
|
34
34
|
mode: "login" | "secure";
|
|
35
|
-
disabledForgotPassword: boolean;
|
|
36
35
|
confirmText: string;
|
|
36
|
+
disabledForgotPassword: boolean;
|
|
37
37
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const _default: typeof __VLS_export;
|
|
39
39
|
export default _default;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { defineStore } from "pinia";
|
|
2
|
-
import { ref } from "vue";
|
|
2
|
+
import { ref, watch } from "vue";
|
|
3
|
+
import { useDocumentVisibility } from "@vueuse/core";
|
|
3
4
|
import { useApi } from "./useApi.js";
|
|
4
5
|
import { useRealtime } from "./useRealtime.js";
|
|
5
6
|
export const useNotificationStore = defineStore("notification", () => {
|
|
6
7
|
const api = useApi();
|
|
7
|
-
const { onEvent, offEvent } = useRealtime();
|
|
8
|
+
const { onEvent, offEvent, isConnected } = useRealtime();
|
|
9
|
+
const visibility = useDocumentVisibility();
|
|
8
10
|
const unreadCount = ref(0);
|
|
9
11
|
const isOpenDrawer = ref(false);
|
|
12
|
+
const isListening = ref(false);
|
|
10
13
|
const fetchUnreadCount = async () => {
|
|
11
14
|
try {
|
|
12
15
|
const response = await api(
|
|
@@ -31,10 +34,18 @@ export const useNotificationStore = defineStore("notification", () => {
|
|
|
31
34
|
};
|
|
32
35
|
const initRealtime = () => {
|
|
33
36
|
onEvent("notification", onNotificationEvent);
|
|
37
|
+
isListening.value = true;
|
|
34
38
|
};
|
|
35
39
|
const closeRealtime = () => {
|
|
36
40
|
offEvent("notification", onNotificationEvent);
|
|
41
|
+
isListening.value = false;
|
|
37
42
|
};
|
|
43
|
+
watch([isConnected, visibility], ([connected, vis], [wasConnected, prevVis]) => {
|
|
44
|
+
if (!isListening.value) return;
|
|
45
|
+
const reconnected = connected && !wasConnected;
|
|
46
|
+
const becameVisible = vis === "visible" && prevVis !== "visible";
|
|
47
|
+
if (reconnected || becameVisible) fetchUnreadCount();
|
|
48
|
+
});
|
|
38
49
|
const setUnreadCount = (count) => {
|
|
39
50
|
unreadCount.value = count;
|
|
40
51
|
};
|