pukaad-ui-lib 1.464.0 → 1.466.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.
Files changed (41) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/card/card-blog.d.vue.ts +3 -1
  3. package/dist/runtime/components/card/card-blog.vue +2 -7
  4. package/dist/runtime/components/card/card-blog.vue.d.ts +3 -1
  5. package/dist/runtime/components/card/card-profile/card-profile-header.d.vue.ts +1 -1
  6. package/dist/runtime/components/card/card-profile/card-profile-header.vue.d.ts +1 -1
  7. package/dist/runtime/components/card/card-reaction.d.vue.ts +1 -1
  8. package/dist/runtime/components/card/card-reaction.vue.d.ts +1 -1
  9. package/dist/runtime/components/card/card-recommend/card-recommend-place.vue +2 -2
  10. package/dist/runtime/components/card/card-review.d.vue.ts +4 -4
  11. package/dist/runtime/components/card/card-review.vue.d.ts +4 -4
  12. package/dist/runtime/components/card/card-user/card-user-item.d.vue.ts +23 -3
  13. package/dist/runtime/components/card/card-user/card-user-item.vue +35 -7
  14. package/dist/runtime/components/card/card-user/card-user-item.vue.d.ts +23 -3
  15. package/dist/runtime/components/card/card.vue +1 -1
  16. package/dist/runtime/components/chat/chat-conversation-item.d.vue.ts +1 -1
  17. package/dist/runtime/components/chat/chat-conversation-item.vue.d.ts +1 -1
  18. package/dist/runtime/components/drawer/drawer-post-review.vue +5 -5
  19. package/dist/runtime/components/filter/filter-list-chip.vue +8 -4
  20. package/dist/runtime/components/image/image-cropper.d.vue.ts +1 -1
  21. package/dist/runtime/components/image/image-cropper.vue.d.ts +1 -1
  22. package/dist/runtime/components/input/input-address.d.vue.ts +1 -1
  23. package/dist/runtime/components/input/input-address.vue.d.ts +1 -1
  24. package/dist/runtime/components/input/input-autocomplete.d.vue.ts +1 -1
  25. package/dist/runtime/components/input/input-autocomplete.vue.d.ts +1 -1
  26. package/dist/runtime/components/input/input-birth-date.d.vue.ts +1 -1
  27. package/dist/runtime/components/input/input-birth-date.vue.d.ts +1 -1
  28. package/dist/runtime/components/input/input-date-picker.d.vue.ts +1 -1
  29. package/dist/runtime/components/input/input-date-picker.vue.d.ts +1 -1
  30. package/dist/runtime/components/input/input-localized-name.d.vue.ts +1 -1
  31. package/dist/runtime/components/input/input-localized-name.vue.d.ts +1 -1
  32. package/dist/runtime/components/input/input-rating.vue +1 -1
  33. package/dist/runtime/components/input/input-tag-modal.d.vue.ts +1 -1
  34. package/dist/runtime/components/input/input-tag-modal.vue.d.ts +1 -1
  35. package/dist/runtime/components/input/input-tag.d.vue.ts +1 -1
  36. package/dist/runtime/components/input/input-tag.vue.d.ts +1 -1
  37. package/dist/runtime/components/modal/modal-report.vue +24 -1
  38. package/dist/runtime/components/preview/preview-blog.d.vue.ts +39 -0
  39. package/dist/runtime/components/preview/preview-blog.vue +203 -0
  40. package/dist/runtime/components/preview/preview-blog.vue.d.ts +39 -0
  41. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.464.0",
4
+ "version": "1.466.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -26,20 +26,22 @@ type __VLS_Props = {
26
26
  disabledMenu?: boolean;
27
27
  };
28
28
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
29
+ click: (id: string) => any;
29
30
  "blog-edit": () => any;
30
31
  "blog-pinned": (id: string) => any;
31
32
  "blog-unpinned": (id: string) => any;
32
33
  "blog-updated": (id: string, data: any) => any;
33
34
  "blog-deleted": (id: string) => any;
34
35
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
+ onClick?: ((id: string) => any) | undefined;
35
37
  "onBlog-edit"?: (() => any) | undefined;
36
38
  "onBlog-pinned"?: ((id: string) => any) | undefined;
37
39
  "onBlog-unpinned"?: ((id: string) => any) | undefined;
38
40
  "onBlog-updated"?: ((id: string, data: any) => any) | undefined;
39
41
  "onBlog-deleted"?: ((id: string) => any) | undefined;
40
42
  }>, {
41
- isMyProfile: boolean;
42
43
  disabledMenu: boolean;
44
+ isMyProfile: boolean;
43
45
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
44
46
  declare const _default: typeof __VLS_export;
45
47
  export default _default;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="flex gap-[16px] cursor-pointer items-start" @click="onClick">
2
+ <div class="flex gap-[16px] cursor-pointer items-start" @click="$emit('click', props.item.id)">
3
3
  <Image v-if="displayImage" :src="displayImage" :width="227" :height="128" class="rounded-[4px]"
4
4
  fit="cover" />
5
5
  <div class="flex flex-col gap-[4px] w-full">
@@ -52,10 +52,8 @@
52
52
 
53
53
  <script setup>
54
54
  import { useConvert } from "#pukaad-ui/runtime/composables/useConvert";
55
- import { useRouter } from "vue-router";
56
55
  import { computed, ref, watch, onMounted, onBeforeUnmount } from "vue";
57
56
  const { convertNumber, convertDateToRelativeText } = useConvert();
58
- const router = useRouter();
59
57
  const props = defineProps({
60
58
  item: { type: Object, required: true },
61
59
  isMyProfile: { type: Boolean, required: false, default: false },
@@ -89,7 +87,7 @@ const displayDescription = computed(() => {
89
87
  if (props.item.description) return props.item.description;
90
88
  return extractTextFromDelta(props.item.content);
91
89
  });
92
- const emit = defineEmits(["blog-edit", "blog-pinned", "blog-unpinned", "blog-updated", "blog-deleted"]);
90
+ const emit = defineEmits(["click", "blog-edit", "blog-pinned", "blog-unpinned", "blog-updated", "blog-deleted"]);
93
91
  const isPinned = ref(props.item.is_pinned);
94
92
  watch(
95
93
  () => props.item.is_pinned,
@@ -97,7 +95,4 @@ watch(
97
95
  isPinned.value = !!val;
98
96
  }
99
97
  );
100
- const onClick = () => {
101
- router.push(`/blog/${props.item.id}`);
102
- };
103
98
  </script>
@@ -26,20 +26,22 @@ type __VLS_Props = {
26
26
  disabledMenu?: boolean;
27
27
  };
28
28
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
29
+ click: (id: string) => any;
29
30
  "blog-edit": () => any;
30
31
  "blog-pinned": (id: string) => any;
31
32
  "blog-unpinned": (id: string) => any;
32
33
  "blog-updated": (id: string, data: any) => any;
33
34
  "blog-deleted": (id: string) => any;
34
35
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
+ onClick?: ((id: string) => any) | undefined;
35
37
  "onBlog-edit"?: (() => any) | undefined;
36
38
  "onBlog-pinned"?: ((id: string) => any) | undefined;
37
39
  "onBlog-unpinned"?: ((id: string) => any) | undefined;
38
40
  "onBlog-updated"?: ((id: string, data: any) => any) | undefined;
39
41
  "onBlog-deleted"?: ((id: string) => any) | undefined;
40
42
  }>, {
41
- isMyProfile: boolean;
42
43
  disabledMenu: boolean;
44
+ isMyProfile: boolean;
43
45
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
44
46
  declare const _default: typeof __VLS_export;
45
47
  export default _default;
@@ -7,8 +7,8 @@ declare const __VLS_export: import("vue").DefineComponent<CardProfileAboutProps,
7
7
  onFollow?: ((isFollowing: boolean) => any) | undefined;
8
8
  }>, {
9
9
  type: "article" | "media" | "sale-info";
10
- disabledPadding: boolean;
11
10
  preview: boolean;
11
+ disabledPadding: boolean;
12
12
  optionMenuButtonType: "solid" | "text";
13
13
  actionsHidden: boolean;
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -7,8 +7,8 @@ declare const __VLS_export: import("vue").DefineComponent<CardProfileAboutProps,
7
7
  onFollow?: ((isFollowing: boolean) => any) | undefined;
8
8
  }>, {
9
9
  type: "article" | "media" | "sale-info";
10
- disabledPadding: boolean;
11
10
  preview: boolean;
11
+ disabledPadding: boolean;
12
12
  optionMenuButtonType: "solid" | "text";
13
13
  actionsHidden: boolean;
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -25,6 +25,7 @@ type __VLS_Props = {
25
25
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
26
26
  disabled: boolean;
27
27
  id: string;
28
+ state: string;
28
29
  itemCount: Count;
29
30
  itemActive: Reacted;
30
31
  padding: string | number;
@@ -32,7 +33,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
32
33
  disabledDividerTop: boolean;
33
34
  disabledDividerBottom: boolean;
34
35
  iconSize: number | string;
35
- state: string;
36
36
  loginPath: string;
37
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
38
  declare const _default: typeof __VLS_export;
@@ -25,6 +25,7 @@ type __VLS_Props = {
25
25
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
26
26
  disabled: boolean;
27
27
  id: string;
28
+ state: string;
28
29
  itemCount: Count;
29
30
  itemActive: Reacted;
30
31
  padding: string | number;
@@ -32,7 +33,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
32
33
  disabledDividerTop: boolean;
33
34
  disabledDividerBottom: boolean;
34
35
  iconSize: number | string;
35
- state: string;
36
36
  loginPath: string;
37
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
38
  declare const _default: typeof __VLS_export;
@@ -16,7 +16,7 @@
16
16
  <div
17
17
  v-for="item in props.items"
18
18
  :key="item.id"
19
- class="flex items-center gap-[16px] cursor-pointer"
19
+ class="flex items-center gap-[8px] cursor-pointer"
20
20
  @click="handleClickCard(item)"
21
21
  >
22
22
  <Image
@@ -41,7 +41,7 @@
41
41
  {{ item.title }}
42
42
  </div>
43
43
  <div class="flex items-center gap-[4px] text-gray font-body-small">
44
- <InputRating v-model="item.rating" readonly :rating-size="10" />
44
+ <InputRating v-model="item.rating" readonly :size="16" />
45
45
  {{ $convert.convertNumber(item.review_count) }}
46
46
  </div>
47
47
  </div>
@@ -37,16 +37,16 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
37
37
  }>, {
38
38
  item: CardReviewProps;
39
39
  disabledMenu: boolean;
40
- isProfile: boolean;
41
- disabledLike: boolean;
42
- allowReply: boolean;
43
- replyAvatar: string;
44
40
  place: {
45
41
  id: string | number;
46
42
  name?: string;
47
43
  address?: string;
48
44
  cover?: string;
49
45
  };
46
+ isProfile: boolean;
47
+ disabledLike: boolean;
48
+ allowReply: boolean;
49
+ replyAvatar: string;
50
50
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
51
  declare const _default: typeof __VLS_export;
52
52
  export default _default;
@@ -37,16 +37,16 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
37
37
  }>, {
38
38
  item: CardReviewProps;
39
39
  disabledMenu: boolean;
40
- isProfile: boolean;
41
- disabledLike: boolean;
42
- allowReply: boolean;
43
- replyAvatar: string;
44
40
  place: {
45
41
  id: string | number;
46
42
  name?: string;
47
43
  address?: string;
48
44
  cover?: string;
49
45
  };
46
+ isProfile: boolean;
47
+ disabledLike: boolean;
48
+ allowReply: boolean;
49
+ replyAvatar: string;
50
50
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
51
  declare const _default: typeof __VLS_export;
52
52
  export default _default;
@@ -9,13 +9,33 @@ export interface User {
9
9
  is_my_profile?: boolean;
10
10
  profile_verify?: boolean;
11
11
  }
12
+ type __VLS_Props = {
13
+ /** ไม่พาไปหน้าโปรไฟล์ /@:id ตอนกดการ์ด (แอปที่ไม่มีหน้านี้) */
14
+ disabledLink?: boolean;
15
+ /** ซ่อนปุ่มติดตาม (เช่นรายการผู้ติดตามของ business ที่มีแค่เมนู ⋮) */
16
+ hideFollow?: boolean;
17
+ };
12
18
  type __VLS_ModelProps = {
13
19
  modelValue?: User;
14
20
  };
15
- declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
22
+ declare var __VLS_19: {};
23
+ type __VLS_Slots = {} & {
24
+ actions?: (props: typeof __VLS_19) => any;
25
+ };
26
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
27
  "update:modelValue": (value: User) => any;
17
- }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
28
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
18
29
  "onUpdate:modelValue"?: ((value: User) => any) | undefined;
19
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ }>, {
31
+ disabledLink: boolean;
32
+ hideFollow: boolean;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
35
  declare const _default: typeof __VLS_export;
21
36
  export default _default;
37
+ type __VLS_WithSlots<T, S> = T & {
38
+ new (): {
39
+ $slots: S;
40
+ };
41
+ };
@@ -1,16 +1,31 @@
1
1
  <template>
2
- <div class="flex gap-[16px] items-center justify-between cursor-pointer transition-colors" @click="onClickCard">
3
- <div class="flex gap-[8px]">
2
+ <div
3
+ class="flex gap-[16px] items-center justify-between cursor-pointer transition-colors"
4
+ @click="onClickCard"
5
+ >
6
+ <div class="flex flex-1 min-w-0 gap-[8px]">
4
7
  <Avatar :src="modelValue?.avatar" :alt="modelValue?.name" :size="40" />
5
- <div class="flex flex-col gap-[4px]">
8
+ <div class="flex flex-col flex-1 min-w-0 gap-[4px]">
6
9
  <div class="font-body-large-prominent flex items-center gap-[4px]">
7
10
  {{ modelValue?.name }}
11
+ <Icon
12
+ v-if="modelValue?.profile_verify"
13
+ name="pukaad-verify"
14
+ :size="16"
15
+ class="shrink-0"
16
+ />
8
17
  </div>
9
18
  <div class="flex flex-col gap-[4px] font-body-small text-gray">
10
19
  <div class="flex items-center gap-[4px]">
11
- <div>ผู้ติดตาม {{ $convert.convertNumber(modelValue?.follower_count || 0) }}</div>
20
+ <div>
21
+ ผู้ติดตาม
22
+ {{ $convert.convertNumber(modelValue?.follower_count || 0) }}
23
+ </div>
12
24
  <div>•</div>
13
- <div>กำลังเผยแพร่ {{ $convert.convertNumber(modelValue?.public_count || 0) }}</div>
25
+ <div>
26
+ กำลังเผยแพร่
27
+ {{ $convert.convertNumber(modelValue?.public_count || 0) }}
28
+ </div>
14
29
  </div>
15
30
  <div v-if="modelValue?.description" class="line-clamp-2">
16
31
  {{ modelValue?.description }}
@@ -18,10 +33,18 @@
18
33
  </div>
19
34
  </div>
20
35
  </div>
21
- <Button v-if="!modelValue?.is_my_profile" :variant="modelValue?.is_following ? 'default' : 'outline'"
22
- :color="modelValue?.is_following ? 'default' : 'primary'" @click.stop="onFollowToggle">
36
+ <Button
37
+ v-if="!modelValue?.is_my_profile && !hideFollow"
38
+ :variant="modelValue?.is_following ? 'default' : 'outline'"
39
+ :color="modelValue?.is_following ? 'default' : 'primary'"
40
+ @click.stop="onFollowToggle"
41
+ >
23
42
  {{ modelValue?.is_following ? "\u0E15\u0E34\u0E14\u0E15\u0E32\u0E21\u0E41\u0E25\u0E49\u0E27" : "\u0E15\u0E34\u0E14\u0E15\u0E32\u0E21" }}
24
43
  </Button>
44
+ <!-- เช่นเมนู ⋮ ของแต่ละแอป — กดแล้วไม่เปิดโปรไฟล์ -->
45
+ <div v-if="$slots.actions" class="shrink-0" @click.stop>
46
+ <slot name="actions" />
47
+ </div>
25
48
  </div>
26
49
  </template>
27
50
 
@@ -29,11 +52,16 @@
29
52
  import { ref } from "vue";
30
53
  import { useRouter } from "vue-router";
31
54
  import { useApi } from "../../../composables/useApi";
55
+ const props = defineProps({
56
+ disabledLink: { type: Boolean, required: false, default: false },
57
+ hideFollow: { type: Boolean, required: false, default: false }
58
+ });
32
59
  const modelValue = defineModel({ type: Object, ...{
33
60
  default: () => ({})
34
61
  } });
35
62
  const router = useRouter();
36
63
  const onClickCard = () => {
64
+ if (props.disabledLink) return;
37
65
  if (modelValue.value?.id) {
38
66
  router.push(`/@${modelValue.value.id}`);
39
67
  }
@@ -9,13 +9,33 @@ export interface User {
9
9
  is_my_profile?: boolean;
10
10
  profile_verify?: boolean;
11
11
  }
12
+ type __VLS_Props = {
13
+ /** ไม่พาไปหน้าโปรไฟล์ /@:id ตอนกดการ์ด (แอปที่ไม่มีหน้านี้) */
14
+ disabledLink?: boolean;
15
+ /** ซ่อนปุ่มติดตาม (เช่นรายการผู้ติดตามของ business ที่มีแค่เมนู ⋮) */
16
+ hideFollow?: boolean;
17
+ };
12
18
  type __VLS_ModelProps = {
13
19
  modelValue?: User;
14
20
  };
15
- declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
22
+ declare var __VLS_19: {};
23
+ type __VLS_Slots = {} & {
24
+ actions?: (props: typeof __VLS_19) => any;
25
+ };
26
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
27
  "update:modelValue": (value: User) => any;
17
- }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
28
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
18
29
  "onUpdate:modelValue"?: ((value: User) => any) | undefined;
19
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ }>, {
31
+ disabledLink: boolean;
32
+ hideFollow: boolean;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
35
  declare const _default: typeof __VLS_export;
21
36
  export default _default;
37
+ type __VLS_WithSlots<T, S> = T & {
38
+ new (): {
39
+ $slots: S;
40
+ };
41
+ };
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <ShadCard
3
3
  v-slot="slotScope"
4
- :class="props.variant === 'outline' && 'border-[1px] border-mecury'"
4
+ :class="props.variant === 'outline' && 'border-[1px] border-mercury'"
5
5
  >
6
6
  <ShadCardHeader
7
7
  v-if="$slots.header || props.title || props.description"
@@ -26,13 +26,13 @@ declare const __VLS_export: import("vue").DefineComponent<ChatConversationItemPr
26
26
  name: string;
27
27
  avatar: string | null;
28
28
  muted: boolean;
29
- disabledMenu: boolean;
30
29
  preview: string;
31
30
  to: string;
32
31
  active: boolean;
33
32
  typing: boolean;
34
33
  unreadCount: number;
35
34
  pinned: boolean;
35
+ disabledMenu: boolean;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
37
  declare const _default: typeof __VLS_export;
38
38
  export default _default;
@@ -26,13 +26,13 @@ declare const __VLS_export: import("vue").DefineComponent<ChatConversationItemPr
26
26
  name: string;
27
27
  avatar: string | null;
28
28
  muted: boolean;
29
- disabledMenu: boolean;
30
29
  preview: string;
31
30
  to: string;
32
31
  active: boolean;
33
32
  typing: boolean;
34
33
  unreadCount: number;
35
34
  pinned: boolean;
35
+ disabledMenu: boolean;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
37
  declare const _default: typeof __VLS_export;
38
38
  export default _default;
@@ -14,7 +14,7 @@
14
14
  >
15
15
  <div
16
16
  v-if="form.coverImage"
17
- class="w-[178px] h-[100px] rounded-[8px] overflow-hidden flex-shrink-0"
17
+ class="w-[178px] h-[100px] rounded-[4px] overflow-hidden flex-shrink-0"
18
18
  >
19
19
  <Image
20
20
  :src="form.coverImage"
@@ -30,7 +30,7 @@
30
30
  </div>
31
31
 
32
32
  <div class="flex items-center justify-center py-[16px]">
33
- <InputRating v-model="form.rating" :size="28" />
33
+ <InputRating v-model="form.rating" :size="40" />
34
34
  </div>
35
35
 
36
36
  <InputTextarea
@@ -44,8 +44,8 @@
44
44
 
45
45
  <div class="flex flex-col gap-[8px]">
46
46
  <div class="flex flex-col gap-[4px]">
47
- <div class="text-gray font-body-large">เพิ่มภาพถ่าย</div>
48
- <div class="text-gray font-body-small">อัปโหลด 9 รายการ</div>
47
+ <div class="text-gray font-body-large-prominent">เพิ่มภาพถ่าย</div>
48
+ <div class="text-gray font-body-small">สูงสุด 9 รายการ</div>
49
49
  </div>
50
50
  <InputFile
51
51
  :limit="9"
@@ -55,7 +55,7 @@
55
55
  />
56
56
  <div class="flex flex-col text-gray font-body-small">
57
57
  <div>รองรับไฟล์ *.jpg *.jpeg *.png *.webp *.bmp *.gif</div>
58
- <div>ขนาดไฟล์สูงสุด 30 mb</div>
58
+ <div>ขนาดไฟล์ไม่เกิน 30 mb</div>
59
59
  </div>
60
60
  </div>
61
61
  </div>
@@ -1,12 +1,16 @@
1
1
  <template>
2
- <div v-if="hasSelectedChips" class="flex gap-[8px] flex-wrap">
3
- <Chip v-for="(chip, index) in selectedChips" :key="index" color="outline"
4
- class="border-primary bg-info text-primary">
2
+ <div v-if="hasSelectedChips" class="flex gap-[8px] flex-wrap items-center">
3
+ <Chip
4
+ v-for="(chip, index) in selectedChips"
5
+ :key="index"
6
+ color="bright"
7
+ class="text-black"
8
+ >
5
9
  {{ chip.label }}
6
10
  </Chip>
7
11
 
8
12
  <Button variant="text" @click="clearAll">
9
- <div class="px-[12px] py-[8px]"> ล้างตัวกรอง</div>
13
+ <div class="px-[12px] py-[6px]">ล้างตัวกรอง</div>
10
14
  </Button>
11
15
  </div>
12
16
  </template>
@@ -65,12 +65,12 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
65
65
  src: string;
66
66
  center: boolean;
67
67
  background: boolean;
68
- modal: boolean;
69
68
  crossorigin: "" | "anonymous" | "use-credentials";
70
69
  responsive: boolean;
71
70
  restore: boolean;
72
71
  checkCrossOrigin: boolean;
73
72
  checkOrientation: boolean;
73
+ modal: boolean;
74
74
  guides: boolean;
75
75
  highlight: boolean;
76
76
  autoCrop: boolean;
@@ -65,12 +65,12 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
65
65
  src: string;
66
66
  center: boolean;
67
67
  background: boolean;
68
- modal: boolean;
69
68
  crossorigin: "" | "anonymous" | "use-credentials";
70
69
  responsive: boolean;
71
70
  restore: boolean;
72
71
  checkCrossOrigin: boolean;
73
72
  checkOrientation: boolean;
73
+ modal: boolean;
74
74
  guides: boolean;
75
75
  highlight: boolean;
76
76
  autoCrop: boolean;
@@ -50,8 +50,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  label: string;
51
51
  name: string;
52
52
  required: boolean;
53
- layout: "vertical" | "horizontal";
54
53
  placeholder: string;
54
+ layout: "vertical" | "horizontal";
55
55
  labelDetail: string;
56
56
  placeholderDetail: string;
57
57
  requiredDetail: boolean;
@@ -50,8 +50,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  label: string;
51
51
  name: string;
52
52
  required: boolean;
53
- layout: "vertical" | "horizontal";
54
53
  placeholder: string;
54
+ layout: "vertical" | "horizontal";
55
55
  labelDetail: string;
56
56
  placeholderDetail: string;
57
57
  requiredDetail: boolean;
@@ -69,9 +69,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
69
69
  name: string;
70
70
  required: boolean;
71
71
  description: string;
72
- options: AutocompleteOption[] | string[] | number[];
73
72
  labelKey: string;
74
73
  placeholder: string;
74
+ options: AutocompleteOption[] | string[] | number[];
75
75
  limit: number;
76
76
  disabledErrorMessage: boolean;
77
77
  disabledBorder: boolean;
@@ -69,9 +69,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
69
69
  name: string;
70
70
  required: boolean;
71
71
  description: string;
72
- options: AutocompleteOption[] | string[] | number[];
73
72
  labelKey: string;
74
73
  placeholder: string;
74
+ options: AutocompleteOption[] | string[] | number[];
75
75
  limit: number;
76
76
  disabledErrorMessage: boolean;
77
77
  disabledBorder: boolean;
@@ -30,9 +30,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
30
30
  id: string;
31
31
  name: string;
32
32
  required: boolean;
33
- layout: "month-and-year" | "month-only" | "year-only";
34
33
  locale: string;
35
34
  placeholder: string;
35
+ layout: "month-and-year" | "month-only" | "year-only";
36
36
  disabledErrorMessage: boolean;
37
37
  dateFormat: string;
38
38
  minAge: number;
@@ -30,9 +30,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
30
30
  id: string;
31
31
  name: string;
32
32
  required: boolean;
33
- layout: "month-and-year" | "month-only" | "year-only";
34
33
  locale: string;
35
34
  placeholder: string;
35
+ layout: "month-and-year" | "month-only" | "year-only";
36
36
  disabledErrorMessage: boolean;
37
37
  dateFormat: string;
38
38
  minAge: number;
@@ -44,9 +44,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
44
44
  id: string;
45
45
  name: string;
46
46
  required: boolean;
47
- layout: "month-and-year" | "month-only" | "year-only";
48
47
  locale: string;
49
48
  placeholder: string;
49
+ layout: "month-and-year" | "month-only" | "year-only";
50
50
  disabledErrorMessage: boolean;
51
51
  dateFormat: string;
52
52
  showTime: boolean;
@@ -44,9 +44,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
44
44
  id: string;
45
45
  name: string;
46
46
  required: boolean;
47
- layout: "month-and-year" | "month-only" | "year-only";
48
47
  locale: string;
49
48
  placeholder: string;
49
+ layout: "month-and-year" | "month-only" | "year-only";
50
50
  disabledErrorMessage: boolean;
51
51
  dateFormat: string;
52
52
  showTime: boolean;
@@ -11,8 +11,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
11
11
  label: string;
12
12
  name: string;
13
13
  modelValue: LocalizedNameItem[];
14
- options: InputSelectItem[];
15
14
  placeholder: string;
15
+ options: InputSelectItem[];
16
16
  removable: boolean;
17
17
  limit: number;
18
18
  showCounter: boolean;
@@ -11,8 +11,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
11
11
  label: string;
12
12
  name: string;
13
13
  modelValue: LocalizedNameItem[];
14
- options: InputSelectItem[];
15
14
  placeholder: string;
15
+ options: InputSelectItem[];
16
16
  removable: boolean;
17
17
  limit: number;
18
18
  showCounter: boolean;
@@ -16,7 +16,7 @@ const props = defineProps({
16
16
  size: { type: Number, required: false, default: 24 },
17
17
  borderSize: { type: Number, required: false, default: 0 },
18
18
  borderColor: { type: String, required: false, default: "#fbc02d" },
19
- backgroundColor: { type: String, required: false, default: "#c4c4c4" },
19
+ backgroundColor: { type: String, required: false, default: "#e0e0e0" },
20
20
  activeColor: { type: String, required: false, default: "#fbc02d" },
21
21
  modelValue: { type: Number, required: false, default: 0 }
22
22
  });
@@ -40,9 +40,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
40
40
  id: string;
41
41
  name: string;
42
42
  required: boolean;
43
- options: InputTagModalOption[];
44
43
  labelKey: string;
45
44
  placeholder: string;
45
+ options: InputTagModalOption[];
46
46
  disabledErrorMessage: boolean;
47
47
  valueKey: string;
48
48
  searchPlaceholder: string;
@@ -40,9 +40,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
40
40
  id: string;
41
41
  name: string;
42
42
  required: boolean;
43
- options: InputTagModalOption[];
44
43
  labelKey: string;
45
44
  placeholder: string;
45
+ options: InputTagModalOption[];
46
46
  disabledErrorMessage: boolean;
47
47
  valueKey: string;
48
48
  searchPlaceholder: string;
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  "onUpdate:modelValue"?: ((value: SelectedTag[]) => any) | undefined;
27
27
  }>, {
28
28
  name: string;
29
- state: "user" | "admin";
30
29
  placeholder: string;
30
+ state: "user" | "admin";
31
31
  limit: number;
32
32
  profileScope: "personal" | "business";
33
33
  ignore: string[];
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  "onUpdate:modelValue"?: ((value: SelectedTag[]) => any) | undefined;
27
27
  }>, {
28
28
  name: string;
29
- state: "user" | "admin";
30
29
  placeholder: string;
30
+ state: "user" | "admin";
31
31
  limit: number;
32
32
  profileScope: "personal" | "business";
33
33
  ignore: string[];
@@ -82,13 +82,33 @@ const chatOptions = [
82
82
  { label: "\u0E41\u0E2D\u0E1A\u0E2D\u0E49\u0E32\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E1A\u0E38\u0E04\u0E04\u0E25\u0E2B\u0E23\u0E37\u0E2D\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08\u0E2D\u0E37\u0E48\u0E19", value: "impersonation" },
83
83
  { label: "\u0E2D\u0E37\u0E48\u0E19\u0E46", value: "other" }
84
84
  ];
85
+ const profileOptions = [
86
+ { label: "\u0E40\u0E19\u0E37\u0E49\u0E2D\u0E2B\u0E32\u0E44\u0E21\u0E48\u0E40\u0E01\u0E35\u0E48\u0E22\u0E27\u0E02\u0E49\u0E2D\u0E07", value: "irrelevant" },
87
+ { label: "\u0E2B\u0E22\u0E32\u0E1A\u0E04\u0E32\u0E22 / \u0E44\u0E21\u0E48\u0E40\u0E2B\u0E21\u0E32\u0E30\u0E2A\u0E21", value: "inappropriate" },
88
+ { label: "\u0E25\u0E32\u0E21\u0E01\u0E2D\u0E19\u0E32\u0E08\u0E32\u0E23", value: "obscene" },
89
+ { label: "\u0E04\u0E27\u0E32\u0E21\u0E23\u0E38\u0E19\u0E41\u0E23\u0E07", value: "violence" },
90
+ { label: "\u0E02\u0E21\u0E02\u0E39\u0E48 \u0E04\u0E38\u0E01\u0E04\u0E32\u0E21", value: "harassment" },
91
+ { label: "\u0E01\u0E25\u0E31\u0E48\u0E19\u0E41\u0E01\u0E25\u0E49\u0E07", value: "bullying" },
92
+ { label: "\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E04\u0E27\u0E32\u0E21\u0E40\u0E01\u0E25\u0E35\u0E22\u0E14\u0E0A\u0E31\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E02\u0E31\u0E14\u0E41\u0E22\u0E49\u0E07", value: "hate_speech" },
93
+ { label: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E0B\u0E49\u0E33\u0E2B\u0E23\u0E37\u0E2D\u0E2A\u0E41\u0E1B\u0E21", value: "spam" },
94
+ { label: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E40\u0E17\u0E47\u0E08", value: "false_information" },
95
+ { label: "\u0E25\u0E30\u0E40\u0E21\u0E34\u0E14\u0E17\u0E23\u0E31\u0E1E\u0E22\u0E4C\u0E2A\u0E34\u0E19\u0E17\u0E32\u0E07\u0E1B\u0E31\u0E0D\u0E0D\u0E32", value: "intellectual_property" },
96
+ { label: "\u0E25\u0E30\u0E40\u0E21\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E15\u0E01\u0E25\u0E07\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19", value: "terms_violation" },
97
+ { label: "\u0E1C\u0E34\u0E14\u0E01\u0E0E\u0E2B\u0E21\u0E32\u0E22", value: "illegal" },
98
+ { label: "\u0E2A\u0E48\u0E07\u0E1C\u0E25\u0E01\u0E23\u0E30\u0E17\u0E1A\u0E15\u0E48\u0E2D\u0E1A\u0E38\u0E04\u0E04\u0E25", value: "personal_impact" },
99
+ { label: "\u0E40\u0E02\u0E49\u0E32\u0E02\u0E48\u0E32\u0E22\u0E2B\u0E25\u0E2D\u0E01\u0E25\u0E27\u0E07", value: "scam" },
100
+ { label: "\u0E2D\u0E37\u0E48\u0E19\u0E46", value: "other" }
101
+ ];
85
102
  const title = computed(() => {
86
103
  if (props.state === "place-edit") return "\u0E41\u0E08\u0E49\u0E07\u0E41\u0E01\u0E49\u0E44\u0E02\u0E2A\u0E16\u0E32\u0E19\u0E17\u0E35\u0E48\u0E19\u0E35\u0E49";
87
104
  if (props.state === "media") return "\u0E41\u0E08\u0E49\u0E07\u0E41\u0E01\u0E49\u0E44\u0E02\u0E2A\u0E37\u0E48\u0E2D\u0E19\u0E35\u0E49";
88
105
  if (props.state === "chat") return "\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E41\u0E0A\u0E17\u0E19\u0E35\u0E49";
106
+ if (props.state === "profile") return "\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E42\u0E1B\u0E23\u0E44\u0E1F\u0E25\u0E4C\u0E19\u0E35\u0E49";
89
107
  return "";
90
108
  });
91
- const placeholderText = computed(() => "\u0E04\u0E33\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07");
109
+ const placeholderText = computed(
110
+ () => props.state === "profile" ? "\u0E04\u0E33\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E01\u0E32\u0E23\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19" : "\u0E04\u0E33\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07"
111
+ );
92
112
  const modelValue = defineModel({ type: Boolean, ...{
93
113
  default: false
94
114
  } });
@@ -106,6 +126,9 @@ const currentOptions = computed(() => {
106
126
  if (props.state === "chat") {
107
127
  return chatOptions;
108
128
  }
129
+ if (props.state === "profile") {
130
+ return profileOptions;
131
+ }
109
132
  return [];
110
133
  });
111
134
  const items = computed(() => {
@@ -0,0 +1,39 @@
1
+ export type PreviewBlogState = "personal" | "office" | "business";
2
+ export interface PreviewBlogData {
3
+ id?: string;
4
+ title?: string;
5
+ content?: {
6
+ ops?: {
7
+ insert: unknown;
8
+ attributes?: Record<string, unknown>;
9
+ }[];
10
+ };
11
+ tags?: {
12
+ id: string;
13
+ name: string;
14
+ }[];
15
+ like_count?: number;
16
+ view_count?: number;
17
+ share_count?: number;
18
+ created_at?: string;
19
+ author?: {
20
+ id: string;
21
+ name: string;
22
+ avatar: string | null;
23
+ is_verified?: boolean;
24
+ };
25
+ }
26
+ type __VLS_Props = {
27
+ blogId: string | number;
28
+ /** เลือก endpoint ตามแอปที่เปิดพรีวิว */
29
+ state?: PreviewBlogState;
30
+ };
31
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ exit: () => any;
33
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
34
+ onExit?: (() => any) | undefined;
35
+ }>, {
36
+ state: PreviewBlogState;
37
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const _default: typeof __VLS_export;
39
+ export default _default;
@@ -0,0 +1,203 @@
1
+ <template>
2
+ <!-- Figma: Preview Business Blog (2806:184735) — หน้าตาเดียวกับหน้าบล็อกจริง แต่กดอะไรไม่ได้ -->
3
+ <div class="h-screen w-full overflow-hidden bg-white flex flex-col">
4
+ <!-- Figma: Navbar Preview (new tab) — Property 1=Admin -->
5
+ <div class="shrink-0 w-full bg-cloud">
6
+ <div class="max-w-[1280px] mx-auto flex justify-end p-[16px]">
7
+ <Button variant="outline" class="rounded-[6px]" @click="emit('exit')">
8
+ ออกจากพรีวิว
9
+ </Button>
10
+ </div>
11
+ </div>
12
+
13
+ <!-- เลื่อนในกล่องนี้ ไม่พึ่ง scroll ของหน้า (บางแอปล็อก html/body ไว้) -->
14
+ <div class="flex-1 overflow-y-auto">
15
+ <div class="flex justify-center px-[16px] pt-[16px] pb-[16px]">
16
+ <div class="w-[844px] flex flex-col gap-[16px]">
17
+ <div class="flex flex-col">
18
+ <div class="flex flex-col gap-[16px] p-[16px]">
19
+ <div class="flex items-start gap-[16px]">
20
+ <div class="flex-1 min-w-0 font-display-small-prominent break-words">
21
+ {{ blogData.title }}
22
+ </div>
23
+ <!-- พรีวิว = ดูหน้าตาได้แต่กดไม่ได้ -->
24
+ <Button circle size="icon-sm" class="shrink-0" inert>
25
+ <Icon name="lucide:ellipsis-vertical" />
26
+ </Button>
27
+ </div>
28
+
29
+ <!-- Figma: Profile Detail Announce/Blog (Your_Business, Blog) -->
30
+ <div v-if="blogData.author" class="flex items-center gap-[8px]">
31
+ <Avatar :src="blogData.author.avatar ?? ''" :size="40" />
32
+ <div class="flex items-center gap-[8px] min-w-0 font-body-large">
33
+ <div class="flex items-center gap-[4px] min-w-0">
34
+ <div class="font-body-large-prominent truncate">
35
+ {{ blogData.author.name }}
36
+ </div>
37
+ <Icon
38
+ v-if="blogData.author.is_verified"
39
+ name="pukaad-verify"
40
+ :size="16"
41
+ class="shrink-0"
42
+ />
43
+ </div>
44
+ <template v-if="blogData.created_at">
45
+ <div class="text-gray">•</div>
46
+ <div class="text-gray shrink-0">
47
+ {{ convertDateToRelativeText(blogData.created_at) }}
48
+ </div>
49
+ </template>
50
+ </div>
51
+ </div>
52
+
53
+ <!-- eslint-disable-next-line vue/no-v-html -->
54
+ <div class="[&_img]:max-w-full [&_img]:h-auto" v-html="blogHtml" />
55
+
56
+ <div v-if="blogData.tags?.length" class="flex flex-wrap gap-[8px]">
57
+ <Chip v-for="tag in blogData.tags" :key="tag.id" color="bright">
58
+ {{ tag.name }}
59
+ </Chip>
60
+ </div>
61
+ </div>
62
+
63
+ <!-- Figma: Toolbar - Announce/Blog (Property 1=Blog) — ถูกใจ / ยอดวิว / แชร์ -->
64
+ <CardReaction
65
+ :item-count="{
66
+ liked: blogData.like_count ?? 0,
67
+ viewed: blogData.view_count ?? 0,
68
+ shared: blogData.share_count ?? 0
69
+ }"
70
+ disabled
71
+ />
72
+ </div>
73
+
74
+ <!-- ส่งรายการเข้าไปเอง (ไม่ใช้ fetchFn) เพราะ fetchFn โหลดหน้าถัดไปจาก window scroll -->
75
+ <Comment
76
+ :comments="comments"
77
+ :comment-count="commentTotal"
78
+ :current-user="previewUser"
79
+ readonly
80
+ />
81
+
82
+ <div ref="sentinel" class="h-[1px]" />
83
+ <div v-if="isLoadingComments" class="flex justify-center py-[16px]">
84
+ <Icon
85
+ name="lucide:loader-circle"
86
+ :size="40"
87
+ class="animate-spin text-cloud"
88
+ />
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </template>
95
+
96
+ <script setup>
97
+ import { computed, onMounted, ref, useTemplateRef, watch } from "vue";
98
+ import { useElementVisibility } from "@vueuse/core";
99
+ import { QuillDeltaToHtmlConverter } from "quill-delta-to-html";
100
+ import { useApi } from "#pukaad-ui/runtime/composables/useApi";
101
+ import { useConvert } from "#pukaad-ui/runtime/composables/useConvert";
102
+ const props = defineProps({
103
+ blogId: { type: [String, Number], required: true },
104
+ state: { type: String, required: false, default: "personal" }
105
+ });
106
+ const emit = defineEmits(["exit"]);
107
+ const api = useApi();
108
+ const { convertDateToRelativeText } = useConvert();
109
+ const endpointMap = {
110
+ personal: "/blogs",
111
+ office: "/blogs",
112
+ business: "/blogs"
113
+ };
114
+ const endpoint = computed(() => endpointMap[props.state]);
115
+ const blogData = ref({});
116
+ const comments = ref([]);
117
+ const commentTotal = ref(0);
118
+ const commentPage = ref(1);
119
+ const commentTotalPages = ref(1);
120
+ const commentPageSize = 20;
121
+ const isLoadingComments = ref(false);
122
+ const hasMoreComments = computed(
123
+ () => commentPage.value < commentTotalPages.value
124
+ );
125
+ const previewUser = { id: "", name: "", avatar: "" };
126
+ const blogHtml = computed(() => {
127
+ const ops = blogData.value.content?.ops;
128
+ if (!ops?.length) return "";
129
+ return new QuillDeltaToHtmlConverter(ops, { inlineStyles: true }).convert();
130
+ });
131
+ const fetchBlogData = async () => {
132
+ try {
133
+ const res = await api(
134
+ `${endpoint.value}/${props.blogId}`
135
+ );
136
+ blogData.value = res.data ?? {};
137
+ } catch (err) {
138
+ console.error(err);
139
+ }
140
+ };
141
+ const toCommentUser = (profile) => ({
142
+ id: profile?.profile_path?.path_name ?? "",
143
+ name: profile?.profile_name ?? "\u0E44\u0E21\u0E48\u0E17\u0E23\u0E32\u0E1A\u0E0A\u0E37\u0E48\u0E2D",
144
+ avatar: profile?.profile_image?.image_url ?? ""
145
+ });
146
+ const toCommentItem = (raw) => ({
147
+ id: String(raw.id ?? ""),
148
+ user: toCommentUser(raw.profileData),
149
+ content: raw.content ?? "",
150
+ created_at: raw.created_at ?? "",
151
+ like_count: raw.like_count ?? 0,
152
+ is_liked: raw.is_liked ?? false,
153
+ reply_count: raw.reply_count ?? 0,
154
+ reply: (raw.comment_reply ?? []).map((r) => ({
155
+ id: String(r.id ?? ""),
156
+ user: toCommentUser(r.profileData),
157
+ reply_to: r.reply_to ? toCommentUser(r.reply_to) : void 0,
158
+ content: r.content ?? "",
159
+ created_at: r.created_at ?? "",
160
+ like_count: r.like_count ?? 0,
161
+ is_liked: r.is_liked ?? false
162
+ }))
163
+ });
164
+ let commentRequestId = 0;
165
+ const fetchComments = async (page = 1) => {
166
+ if (page > 1 && isLoadingComments.value) return;
167
+ const requestId = ++commentRequestId;
168
+ isLoadingComments.value = true;
169
+ try {
170
+ const res = await api(`/blogs/${props.blogId}/comments`, {
171
+ query: {
172
+ limit: commentPageSize,
173
+ offset: (page - 1) * commentPageSize
174
+ }
175
+ });
176
+ if (requestId !== commentRequestId) return;
177
+ const items = (res.data ?? []).map(toCommentItem);
178
+ comments.value = page === 1 ? items : [...comments.value, ...items];
179
+ commentTotal.value = res.meta?.total_comments ?? 0;
180
+ commentTotalPages.value = res.meta?.total_pages ?? 1;
181
+ commentPage.value = page;
182
+ } catch (err) {
183
+ console.error(err);
184
+ if (requestId === commentRequestId && page === 1) comments.value = [];
185
+ } finally {
186
+ if (requestId === commentRequestId) isLoadingComments.value = false;
187
+ }
188
+ };
189
+ const loadAll = () => {
190
+ fetchBlogData();
191
+ fetchComments(1);
192
+ };
193
+ const sentinel = useTemplateRef("sentinel");
194
+ const isSentinelVisible = useElementVisibility(sentinel);
195
+ watch(
196
+ [isSentinelVisible, hasMoreComments, isLoadingComments],
197
+ ([visible, more, loading]) => {
198
+ if (visible && more && !loading) fetchComments(commentPage.value + 1);
199
+ }
200
+ );
201
+ watch(() => [props.blogId, props.state], loadAll);
202
+ onMounted(loadAll);
203
+ </script>
@@ -0,0 +1,39 @@
1
+ export type PreviewBlogState = "personal" | "office" | "business";
2
+ export interface PreviewBlogData {
3
+ id?: string;
4
+ title?: string;
5
+ content?: {
6
+ ops?: {
7
+ insert: unknown;
8
+ attributes?: Record<string, unknown>;
9
+ }[];
10
+ };
11
+ tags?: {
12
+ id: string;
13
+ name: string;
14
+ }[];
15
+ like_count?: number;
16
+ view_count?: number;
17
+ share_count?: number;
18
+ created_at?: string;
19
+ author?: {
20
+ id: string;
21
+ name: string;
22
+ avatar: string | null;
23
+ is_verified?: boolean;
24
+ };
25
+ }
26
+ type __VLS_Props = {
27
+ blogId: string | number;
28
+ /** เลือก endpoint ตามแอปที่เปิดพรีวิว */
29
+ state?: PreviewBlogState;
30
+ };
31
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ exit: () => any;
33
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
34
+ onExit?: (() => any) | undefined;
35
+ }>, {
36
+ state: PreviewBlogState;
37
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const _default: typeof __VLS_export;
39
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.464.0",
3
+ "version": "1.466.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",