pukaad-ui-lib 1.200.0 → 1.201.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/dist/module.json +1 -1
- package/dist/runtime/components/comments/CommentSection.d.vue.ts +11 -2
- package/dist/runtime/components/comments/CommentSection.vue +71 -27
- package/dist/runtime/components/comments/CommentSection.vue.d.ts +11 -2
- package/dist/runtime/components/image/image-cropper.d.vue.ts +2 -2
- package/dist/runtime/components/image/image-cropper.vue.d.ts +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -10,11 +10,16 @@ interface ProfileData {
|
|
|
10
10
|
interface CommentData {
|
|
11
11
|
id: string | number;
|
|
12
12
|
content: string;
|
|
13
|
-
createdAt
|
|
14
|
-
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
created_at?: string;
|
|
15
|
+
likeCount?: number;
|
|
16
|
+
like_count?: number;
|
|
15
17
|
isLiked?: boolean;
|
|
18
|
+
is_like?: boolean;
|
|
16
19
|
profileData?: ProfileData;
|
|
20
|
+
user?: any;
|
|
17
21
|
comment_reply?: CommentData[];
|
|
22
|
+
reply?: CommentData[];
|
|
18
23
|
}
|
|
19
24
|
type __VLS_Props = {
|
|
20
25
|
comments: CommentData[];
|
|
@@ -26,12 +31,16 @@ type __VLS_Props = {
|
|
|
26
31
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
32
|
submit: (text: string) => any;
|
|
28
33
|
reply: (commentId: string | number, text: string) => any;
|
|
34
|
+
"like-comment": (comment: CommentData) => any;
|
|
35
|
+
"like-reply": (reply: CommentData) => any;
|
|
29
36
|
like: (comment: CommentData) => any;
|
|
30
37
|
profileClick: (pathName: string) => any;
|
|
31
38
|
login: () => any;
|
|
32
39
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
33
40
|
onSubmit?: ((text: string) => any) | undefined;
|
|
34
41
|
onReply?: ((commentId: string | number, text: string) => any) | undefined;
|
|
42
|
+
"onLike-comment"?: ((comment: CommentData) => any) | undefined;
|
|
43
|
+
"onLike-reply"?: ((reply: CommentData) => any) | undefined;
|
|
35
44
|
onLike?: ((comment: CommentData) => any) | undefined;
|
|
36
45
|
onProfileClick?: ((pathName: string) => any) | undefined;
|
|
37
46
|
onLogin?: (() => any) | undefined;
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
<div class="flex gap-[16px] items-center">
|
|
20
20
|
<Avatar
|
|
21
21
|
:size="30"
|
|
22
|
-
:src="
|
|
22
|
+
:src="
|
|
23
|
+
props.currentUser?.profile_image?.image_url || props.currentUser?.avatar
|
|
24
|
+
"
|
|
23
25
|
/>
|
|
24
26
|
<div class="w-auto flex-1" @click="isButtonComment = true">
|
|
25
27
|
<InputTextarea
|
|
@@ -61,7 +63,9 @@
|
|
|
61
63
|
</form>
|
|
62
64
|
</div>
|
|
63
65
|
<div v-else class="bg-bright p-4 rounded-lg text-center text-gray">
|
|
64
|
-
กรุณา<a class="text-primary cursor-pointer px-1" @click="emit('login')"
|
|
66
|
+
กรุณา<a class="text-primary cursor-pointer px-1" @click="emit('login')"
|
|
67
|
+
>เข้าสู่ระบบ</a
|
|
68
|
+
>เพื่อแสดงความคิดเห็น
|
|
65
69
|
</div>
|
|
66
70
|
|
|
67
71
|
<!-- Comments List -->
|
|
@@ -79,11 +83,18 @@
|
|
|
79
83
|
<div class="flex gap-[8px]">
|
|
80
84
|
<div
|
|
81
85
|
class="cursor-pointer"
|
|
82
|
-
@click="
|
|
86
|
+
@click="
|
|
87
|
+
emit(
|
|
88
|
+
'profileClick',
|
|
89
|
+
comment.profileData?.profile_path?.path_name || comment.user?.path_name || comment.user?.id
|
|
90
|
+
)
|
|
91
|
+
"
|
|
83
92
|
>
|
|
84
93
|
<Avatar
|
|
85
94
|
:size="30"
|
|
86
|
-
:src="
|
|
95
|
+
:src="
|
|
96
|
+
comment.profileData?.profile_image?.image_url || comment.user?.avatar
|
|
97
|
+
"
|
|
87
98
|
/>
|
|
88
99
|
</div>
|
|
89
100
|
|
|
@@ -95,9 +106,16 @@
|
|
|
95
106
|
>
|
|
96
107
|
<div
|
|
97
108
|
class="font-body-large-prominent cursor-pointer"
|
|
98
|
-
@click="
|
|
109
|
+
@click="
|
|
110
|
+
emit(
|
|
111
|
+
'profileClick',
|
|
112
|
+
comment.profileData?.profile_path?.path_name || comment.user?.path_name || comment.user?.id
|
|
113
|
+
)
|
|
114
|
+
"
|
|
99
115
|
>
|
|
100
|
-
{{
|
|
116
|
+
{{
|
|
117
|
+
comment.profileData?.profile_name || comment.user?.name || "\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E0A\u0E37\u0E48\u0E2D"
|
|
118
|
+
}}
|
|
101
119
|
</div>
|
|
102
120
|
|
|
103
121
|
<div class="font-body-large max-w-[768px] break-words">
|
|
@@ -111,19 +129,21 @@
|
|
|
111
129
|
<div
|
|
112
130
|
class="flex gap-[16px] ps-[38px] items-center text-gray font-body-large"
|
|
113
131
|
>
|
|
114
|
-
<div>{{ comment.createdAt }}</div>
|
|
132
|
+
<div>{{ comment.createdAt || comment.created_at }}</div>
|
|
115
133
|
|
|
116
134
|
<div class="flex gap-[4px]">
|
|
117
135
|
<Button
|
|
118
136
|
disabled-padding
|
|
119
137
|
prepend-icon="fa6-regular:thumbs-up"
|
|
120
138
|
variant="text"
|
|
121
|
-
:color="
|
|
139
|
+
:color="
|
|
140
|
+
comment.isLiked ?? comment.is_like ? 'primary' : 'black'
|
|
141
|
+
"
|
|
122
142
|
:icon-size="20"
|
|
123
143
|
:loading="likeLoadingStates[comment.id]"
|
|
124
|
-
@click="emit('like', comment)"
|
|
144
|
+
@click="emit('like-comment', comment)"
|
|
125
145
|
/>
|
|
126
|
-
<div>{{ comment.likeCount
|
|
146
|
+
<div>{{ comment.likeCount ?? comment.like_count ?? 0 }}</div>
|
|
127
147
|
</div>
|
|
128
148
|
|
|
129
149
|
<div
|
|
@@ -137,11 +157,16 @@
|
|
|
137
157
|
|
|
138
158
|
<!-- Toggle Replies -->
|
|
139
159
|
<div
|
|
140
|
-
v-if="comment.comment_reply?.length"
|
|
160
|
+
v-if="comment.comment_reply?.length || comment.reply?.length"
|
|
141
161
|
class="flex gap-[8px] ps-[38px] items-center text-primary font-body-large cursor-pointer w-fit"
|
|
142
|
-
@click="
|
|
162
|
+
@click="
|
|
163
|
+
showRepliesStates[commentIndex] = !showRepliesStates[commentIndex]
|
|
164
|
+
"
|
|
143
165
|
>
|
|
144
|
-
<div
|
|
166
|
+
<div>
|
|
167
|
+
การตอบกลับ
|
|
168
|
+
{{ comment.comment_reply?.length || comment.reply?.length }} รายการ
|
|
169
|
+
</div>
|
|
145
170
|
<Icon
|
|
146
171
|
:name="
|
|
147
172
|
showRepliesStates[commentIndex] ? 'heroicons:chevron-up-solid' : 'heroicons:chevron-down-solid'
|
|
@@ -153,11 +178,13 @@
|
|
|
153
178
|
|
|
154
179
|
<!-- Replies -->
|
|
155
180
|
<div
|
|
156
|
-
v-if="
|
|
181
|
+
v-if="
|
|
182
|
+
showRepliesStates[commentIndex] && (comment.comment_reply || comment.reply)
|
|
183
|
+
"
|
|
157
184
|
class="flex flex-col gap-[16px]"
|
|
158
185
|
>
|
|
159
186
|
<div
|
|
160
|
-
v-for="(reply, replyIndex) in comment.comment_reply"
|
|
187
|
+
v-for="(reply, replyIndex) in comment.comment_reply || comment.reply"
|
|
161
188
|
:key="reply.id"
|
|
162
189
|
class="ps-[38px] flex flex-col gap-[4px]"
|
|
163
190
|
>
|
|
@@ -165,9 +192,16 @@
|
|
|
165
192
|
<div>
|
|
166
193
|
<Avatar
|
|
167
194
|
:size="30"
|
|
168
|
-
:src="
|
|
195
|
+
:src="
|
|
196
|
+
reply.profileData?.profile_image?.image_url || reply.user?.avatar
|
|
197
|
+
"
|
|
169
198
|
class="cursor-pointer"
|
|
170
|
-
@click="
|
|
199
|
+
@click="
|
|
200
|
+
emit(
|
|
201
|
+
'profileClick',
|
|
202
|
+
reply.profileData?.profile_path?.path_name || reply.user?.path_name || reply.user?.id
|
|
203
|
+
)
|
|
204
|
+
"
|
|
171
205
|
/>
|
|
172
206
|
</div>
|
|
173
207
|
|
|
@@ -179,9 +213,16 @@
|
|
|
179
213
|
>
|
|
180
214
|
<div
|
|
181
215
|
class="font-body-large-prominent cursor-pointer"
|
|
182
|
-
@click="
|
|
216
|
+
@click="
|
|
217
|
+
emit(
|
|
218
|
+
'profileClick',
|
|
219
|
+
reply.profileData?.profile_path?.path_name || reply.user?.path_name || reply.user?.id
|
|
220
|
+
)
|
|
221
|
+
"
|
|
183
222
|
>
|
|
184
|
-
{{
|
|
223
|
+
{{
|
|
224
|
+
reply.profileData?.profile_name || reply.user?.name || "\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E0A\u0E37\u0E48\u0E2D"
|
|
225
|
+
}}
|
|
185
226
|
</div>
|
|
186
227
|
|
|
187
228
|
<div class="font-body-large max-w-[768px] break-words">
|
|
@@ -195,19 +236,19 @@
|
|
|
195
236
|
<div
|
|
196
237
|
class="flex gap-[16px] ps-[38px] items-center text-gray font-body-large"
|
|
197
238
|
>
|
|
198
|
-
<div>{{ reply.createdAt }}</div>
|
|
239
|
+
<div>{{ reply.createdAt || reply.created_at }}</div>
|
|
199
240
|
|
|
200
241
|
<div class="flex gap-[4px]">
|
|
201
242
|
<Button
|
|
202
243
|
disabled-padding
|
|
203
244
|
prepend-icon="fa6-regular:thumbs-up"
|
|
204
245
|
variant="text"
|
|
205
|
-
:color="reply.isLiked ? 'primary' : 'black'"
|
|
246
|
+
:color="reply.isLiked ?? reply.is_like ? 'primary' : 'black'"
|
|
206
247
|
:icon-size="20"
|
|
207
248
|
:loading="likeLoadingStates[reply.id]"
|
|
208
|
-
@click="emit('like', reply)"
|
|
249
|
+
@click="emit('like-reply', reply)"
|
|
209
250
|
/>
|
|
210
|
-
<div>{{ reply.likeCount
|
|
251
|
+
<div>{{ reply.likeCount ?? reply.like_count ?? 0 }}</div>
|
|
211
252
|
</div>
|
|
212
253
|
</div>
|
|
213
254
|
</div>
|
|
@@ -221,7 +262,9 @@
|
|
|
221
262
|
<div class="flex gap-[16px]">
|
|
222
263
|
<Avatar
|
|
223
264
|
:size="30"
|
|
224
|
-
:src="
|
|
265
|
+
:src="
|
|
266
|
+
props.currentUser?.profile_image?.image_url || props.currentUser?.avatar || 'https://avatar.iran.liara.run/public?random=1'
|
|
267
|
+
"
|
|
225
268
|
/>
|
|
226
269
|
|
|
227
270
|
<div class="w-auto flex-1">
|
|
@@ -231,7 +274,7 @@
|
|
|
231
274
|
resize="none"
|
|
232
275
|
rows="1"
|
|
233
276
|
full-width
|
|
234
|
-
:placeholder="`\u0E15\u0E2D\u0E1A\u0E01\u0E25\u0E31\u0E1A ${comment.profileData?.profile_name}...`"
|
|
277
|
+
:placeholder="`\u0E15\u0E2D\u0E1A\u0E01\u0E25\u0E31\u0E1A ${comment.profileData?.profile_name || comment.user?.name || '\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E0A\u0E37\u0E48\u0E2D'}...`"
|
|
235
278
|
/>
|
|
236
279
|
</div>
|
|
237
280
|
</div>
|
|
@@ -275,7 +318,7 @@ const props = defineProps({
|
|
|
275
318
|
isSubmitting: { type: Boolean, required: false },
|
|
276
319
|
isLoggedIn: { type: Boolean, required: false }
|
|
277
320
|
});
|
|
278
|
-
const emit = defineEmits(["submit", "reply", "like", "profileClick", "login"]);
|
|
321
|
+
const emit = defineEmits(["submit", "reply", "like", "like-comment", "like-reply", "profileClick", "login"]);
|
|
279
322
|
const commentText = ref("");
|
|
280
323
|
const replyText = ref("");
|
|
281
324
|
const replyingTo = ref(null);
|
|
@@ -297,7 +340,8 @@ const handleLocalReply = (comment) => {
|
|
|
297
340
|
};
|
|
298
341
|
const openReplyForm = async (comment) => {
|
|
299
342
|
replyingTo.value = comment.id;
|
|
300
|
-
|
|
343
|
+
const targetName = comment.profileData?.profile_name || comment.user?.name;
|
|
344
|
+
replyText.value = targetName ? `@${targetName} ` : "";
|
|
301
345
|
await nextTick();
|
|
302
346
|
replyInput.value?.focus();
|
|
303
347
|
};
|
|
@@ -10,11 +10,16 @@ interface ProfileData {
|
|
|
10
10
|
interface CommentData {
|
|
11
11
|
id: string | number;
|
|
12
12
|
content: string;
|
|
13
|
-
createdAt
|
|
14
|
-
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
created_at?: string;
|
|
15
|
+
likeCount?: number;
|
|
16
|
+
like_count?: number;
|
|
15
17
|
isLiked?: boolean;
|
|
18
|
+
is_like?: boolean;
|
|
16
19
|
profileData?: ProfileData;
|
|
20
|
+
user?: any;
|
|
17
21
|
comment_reply?: CommentData[];
|
|
22
|
+
reply?: CommentData[];
|
|
18
23
|
}
|
|
19
24
|
type __VLS_Props = {
|
|
20
25
|
comments: CommentData[];
|
|
@@ -26,12 +31,16 @@ type __VLS_Props = {
|
|
|
26
31
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
32
|
submit: (text: string) => any;
|
|
28
33
|
reply: (commentId: string | number, text: string) => any;
|
|
34
|
+
"like-comment": (comment: CommentData) => any;
|
|
35
|
+
"like-reply": (reply: CommentData) => any;
|
|
29
36
|
like: (comment: CommentData) => any;
|
|
30
37
|
profileClick: (pathName: string) => any;
|
|
31
38
|
login: () => any;
|
|
32
39
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
33
40
|
onSubmit?: ((text: string) => any) | undefined;
|
|
34
41
|
onReply?: ((commentId: string | number, text: string) => any) | undefined;
|
|
42
|
+
"onLike-comment"?: ((comment: CommentData) => any) | undefined;
|
|
43
|
+
"onLike-reply"?: ((reply: CommentData) => any) | undefined;
|
|
35
44
|
onLike?: ((comment: CommentData) => any) | undefined;
|
|
36
45
|
onProfileClick?: ((pathName: string) => any) | undefined;
|
|
37
46
|
onLogin?: (() => any) | undefined;
|
|
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
|
|
|
64
64
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
|
|
65
65
|
src: string;
|
|
66
66
|
center: boolean;
|
|
67
|
+
background: boolean;
|
|
68
|
+
modal: boolean;
|
|
67
69
|
responsive: boolean;
|
|
68
70
|
restore: boolean;
|
|
69
71
|
checkCrossOrigin: boolean;
|
|
70
72
|
checkOrientation: boolean;
|
|
71
73
|
crossorigin: "" | "anonymous" | "use-credentials";
|
|
72
|
-
modal: boolean;
|
|
73
74
|
guides: boolean;
|
|
74
75
|
highlight: boolean;
|
|
75
|
-
background: boolean;
|
|
76
76
|
autoCrop: boolean;
|
|
77
77
|
movable: boolean;
|
|
78
78
|
rotatable: boolean;
|
|
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
|
|
|
64
64
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
|
|
65
65
|
src: string;
|
|
66
66
|
center: boolean;
|
|
67
|
+
background: boolean;
|
|
68
|
+
modal: boolean;
|
|
67
69
|
responsive: boolean;
|
|
68
70
|
restore: boolean;
|
|
69
71
|
checkCrossOrigin: boolean;
|
|
70
72
|
checkOrientation: boolean;
|
|
71
73
|
crossorigin: "" | "anonymous" | "use-credentials";
|
|
72
|
-
modal: boolean;
|
|
73
74
|
guides: boolean;
|
|
74
75
|
highlight: boolean;
|
|
75
|
-
background: boolean;
|
|
76
76
|
autoCrop: boolean;
|
|
77
77
|
movable: boolean;
|
|
78
78
|
rotatable: boolean;
|