pukaad-ui-lib 1.199.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.199.0",
4
+ "version": "1.201.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -10,11 +10,16 @@ interface ProfileData {
10
10
  interface CommentData {
11
11
  id: string | number;
12
12
  content: string;
13
- createdAt: string;
14
- likeCount: number;
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="props.currentUser?.profile_image?.image_url || 'https://avatar.iran.liara.run/public?random=1'"
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')">เข้าสู่ระบบ</a>เพื่อแสดงความคิดเห็น
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="emit('profileClick', comment.profileData?.profile_path?.path_name)"
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="comment.profileData?.profile_image?.image_url"
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="emit('profileClick', comment.profileData?.profile_path?.path_name)"
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
- {{ comment.profileData?.profile_name || "\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E0A\u0E37\u0E48\u0E2D" }}
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="comment.isLiked ? 'primary' : 'black'"
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 || 0 }}</div>
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="showRepliesStates[commentIndex] = !showRepliesStates[commentIndex]"
162
+ @click="
163
+ showRepliesStates[commentIndex] = !showRepliesStates[commentIndex]
164
+ "
143
165
  >
144
- <div>การตอบกลับ {{ comment.comment_reply.length }} รายการ</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="showRepliesStates[commentIndex] && comment.comment_reply"
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="reply.profileData?.profile_image?.image_url"
195
+ :src="
196
+ reply.profileData?.profile_image?.image_url || reply.user?.avatar
197
+ "
169
198
  class="cursor-pointer"
170
- @click="emit('profileClick', reply.profileData?.profile_path?.path_name)"
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="emit('profileClick', reply.profileData?.profile_path?.path_name)"
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
- {{ reply.profileData?.profile_name || "\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E0A\u0E37\u0E48\u0E2D" }}
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 || 0 }}</div>
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="props.currentUser?.profile_image?.image_url || 'https://avatar.iran.liara.run/public?random=1'"
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
- replyText.value = comment.profileData?.profile_name ? `@${comment.profileData.profile_name} ` : "";
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: string;
14
- likeCount: number;
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;
@@ -267,7 +267,7 @@ const saveProfileName = async (values, { setErrors }) => {
267
267
  console.error("Update profile error:", error);
268
268
  if (error.response?.status === 429) {
269
269
  setErrors({
270
- profileName: error.response?._data?.message || "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E0A\u0E37\u0E48\u0E2D\u0E44\u0E14\u0E49\u0E43\u0E19\u0E15\u0E2D\u0E19\u0E19\u0E35\u0E49 \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E20\u0E32\u0E22\u0E2B\u0E25\u0E31\u0E07"
270
+ profileName: error.response?._data?.message.description || "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E0A\u0E37\u0E48\u0E2D\u0E44\u0E14\u0E49\u0E43\u0E19\u0E15\u0E2D\u0E19\u0E19\u0E35\u0E49 \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E20\u0E32\u0E22\u0E2B\u0E25\u0E31\u0E07"
271
271
  });
272
272
  } else {
273
273
  $toast.error(error.message || "\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E43\u0E19\u0E01\u0E32\u0E23\u0E2D\u0E31\u0E1B\u0E40\u0E14\u0E15\u0E42\u0E1B\u0E23\u0E44\u0E1F\u0E25\u0E4C");
@@ -152,7 +152,7 @@ const menu = [
152
152
  }
153
153
  },
154
154
  {
155
- label: "\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E1B\u0E23\u0E30\u0E01\u0E32\u0E28\u0E19\u0E35\u0E49",
155
+ label: "\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E40\u0E19\u0E37\u0E49\u0E2D\u0E2B\u0E32\u0E19\u0E35\u0E49",
156
156
  name: "report-announce",
157
157
  icon: "fa6-regular:flag",
158
158
  action: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.199.0",
3
+ "version": "1.201.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",