pukaad-ui-lib 1.233.0 → 1.235.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/card/card-user-blog.d.vue.ts +2 -2
- package/dist/runtime/components/card/card-user-blog.vue +51 -7
- package/dist/runtime/components/card/card-user-blog.vue.d.ts +2 -2
- package/dist/runtime/components/comment.vue +105 -285
- package/dist/runtime/components/drawer/drawer-post-blog.vue +54 -31
- package/dist/runtime/components/input/input-tag.vue +2 -2
- package/dist/runtime/components/picker/picker-option-menu/picker-option-menu-user.d.vue.ts +2 -2
- package/dist/runtime/components/picker/picker-option-menu/picker-option-menu-user.vue.d.ts +2 -2
- package/dist/runtime/components/ui/alert-dialog/AlertDialogContent.d.vue.ts +4 -4
- package/dist/runtime/components/ui/alert-dialog/AlertDialogContent.vue.d.ts +4 -4
- package/dist/runtime/components/ui/dialog/DialogContent.d.vue.ts +4 -4
- package/dist/runtime/components/ui/dialog/DialogContent.vue.d.ts +4 -4
- package/dist/runtime/components/ui/dialog/DialogScrollContent.d.vue.ts +4 -4
- package/dist/runtime/components/ui/dialog/DialogScrollContent.vue.d.ts +4 -4
- package/dist/runtime/components/ui/dropdown-menu/DropdownMenuContent.d.vue.ts +2 -2
- package/dist/runtime/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +2 -2
- package/dist/runtime/components/ui/dropdown-menu/DropdownMenuSubContent.d.vue.ts +4 -4
- package/dist/runtime/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +4 -4
- package/dist/runtime/components/ui/popover/PopoverContent.d.vue.ts +4 -4
- package/dist/runtime/components/ui/popover/PopoverContent.vue.d.ts +4 -4
- package/dist/runtime/components/ui/select/SelectContent.d.vue.ts +2 -2
- package/dist/runtime/components/ui/select/SelectContent.vue.d.ts +2 -2
- package/dist/runtime/components/ui/sheet/SheetContent.d.vue.ts +4 -4
- package/dist/runtime/components/ui/sheet/SheetContent.vue.d.ts +4 -4
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -24,9 +24,9 @@ type __VLS_Props = {
|
|
|
24
24
|
isMyProfile?: boolean;
|
|
25
25
|
};
|
|
26
26
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
27
|
-
"blog-
|
|
27
|
+
"blog-updated": () => any;
|
|
28
28
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
|
-
"onBlog-
|
|
29
|
+
"onBlog-updated"?: (() => any) | undefined;
|
|
30
30
|
}>, {
|
|
31
31
|
isMyProfile: boolean;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -74,20 +74,34 @@
|
|
|
74
74
|
state="blog"
|
|
75
75
|
/>
|
|
76
76
|
</div>
|
|
77
|
+
|
|
78
|
+
<!-- Edit Blog Drawer -->
|
|
79
|
+
<DrawerPostBlog
|
|
80
|
+
v-if="editBlogItem"
|
|
81
|
+
v-model="isEditDrawerOpen"
|
|
82
|
+
:item="editBlogItem"
|
|
83
|
+
@success="onEditSuccess"
|
|
84
|
+
/>
|
|
77
85
|
</template>
|
|
78
86
|
|
|
79
87
|
<script setup>
|
|
80
88
|
import { useRouter } from "vue-router";
|
|
81
89
|
import { ref, watch } from "vue";
|
|
90
|
+
import { useNuxtApp } from "nuxt/app";
|
|
82
91
|
import { useConvert } from "@/runtime/composables/useConvert";
|
|
92
|
+
import { useApi } from "../../composables/useApi";
|
|
83
93
|
const { convertNumber, convertDateTorelativeText } = useConvert();
|
|
94
|
+
const { $toast } = useNuxtApp();
|
|
95
|
+
const api = useApi();
|
|
84
96
|
const props = defineProps({
|
|
85
97
|
item: { type: Object, required: true },
|
|
86
98
|
isMyProfile: { type: Boolean, required: false, default: false }
|
|
87
99
|
});
|
|
88
100
|
const router = useRouter();
|
|
89
|
-
const emit = defineEmits(["blog-
|
|
101
|
+
const emit = defineEmits(["blog-updated"]);
|
|
90
102
|
const isPinned = ref(props.item.ispinned);
|
|
103
|
+
const isEditDrawerOpen = ref(false);
|
|
104
|
+
const editBlogItem = ref(null);
|
|
91
105
|
watch(
|
|
92
106
|
() => props.item.ispinned,
|
|
93
107
|
(val) => {
|
|
@@ -97,16 +111,46 @@ watch(
|
|
|
97
111
|
const onProfileClick = () => {
|
|
98
112
|
router.push(`/@${props.item.user.path_name}`);
|
|
99
113
|
};
|
|
100
|
-
const onBlogPin = () => {
|
|
101
|
-
|
|
114
|
+
const onBlogPin = async () => {
|
|
115
|
+
try {
|
|
116
|
+
await api(`/blogs/${props.item.id}/pin`, { method: "POST" });
|
|
117
|
+
isPinned.value = true;
|
|
118
|
+
$toast.success("\u0E1B\u0E31\u0E01\u0E2B\u0E21\u0E38\u0E14\u0E1A\u0E17\u0E04\u0E27\u0E32\u0E21\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08");
|
|
119
|
+
} catch (e) {
|
|
120
|
+
$toast.error(e?.data?.message?.description || "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E1B\u0E31\u0E01\u0E2B\u0E21\u0E38\u0E14\u0E44\u0E14\u0E49");
|
|
121
|
+
}
|
|
102
122
|
};
|
|
103
|
-
const onBlogUnpin = () => {
|
|
104
|
-
|
|
123
|
+
const onBlogUnpin = async () => {
|
|
124
|
+
try {
|
|
125
|
+
await api(`/blogs/${props.item.id}/pin`, { method: "DELETE" });
|
|
126
|
+
isPinned.value = false;
|
|
127
|
+
$toast.success("\u0E40\u0E2D\u0E32\u0E2B\u0E21\u0E38\u0E14\u0E2D\u0E2D\u0E01\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08");
|
|
128
|
+
} catch (e) {
|
|
129
|
+
$toast.error(e?.data?.message?.description || "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E2D\u0E32\u0E2B\u0E21\u0E38\u0E14\u0E2D\u0E2D\u0E01\u0E44\u0E14\u0E49");
|
|
130
|
+
}
|
|
105
131
|
};
|
|
106
132
|
const onBlogClick = () => {
|
|
107
133
|
router.push(`/blog/${props.item.id}`);
|
|
108
134
|
};
|
|
109
|
-
const onBlogEdit = () => {
|
|
110
|
-
|
|
135
|
+
const onBlogEdit = async () => {
|
|
136
|
+
try {
|
|
137
|
+
const res = await api(`/blogs/${props.item.id}`, { method: "GET" });
|
|
138
|
+
const blog = res.data;
|
|
139
|
+
const content = blog.content?.ops ?? (Array.isArray(blog.content) ? blog.content : []);
|
|
140
|
+
editBlogItem.value = {
|
|
141
|
+
id: blog.id,
|
|
142
|
+
title: blog.title,
|
|
143
|
+
content,
|
|
144
|
+
tags: blog.tags ?? [],
|
|
145
|
+
disableComment: false,
|
|
146
|
+
coverImage: blog.cover_image_url ? [{ url: blog.cover_image_url }] : []
|
|
147
|
+
};
|
|
148
|
+
isEditDrawerOpen.value = true;
|
|
149
|
+
} catch (e) {
|
|
150
|
+
$toast.error(e?.data?.message?.description || "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E42\u0E2B\u0E25\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E1A\u0E17\u0E04\u0E27\u0E32\u0E21\u0E44\u0E14\u0E49");
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const onEditSuccess = () => {
|
|
154
|
+
emit("blog-updated");
|
|
111
155
|
};
|
|
112
156
|
</script>
|
|
@@ -24,9 +24,9 @@ type __VLS_Props = {
|
|
|
24
24
|
isMyProfile?: boolean;
|
|
25
25
|
};
|
|
26
26
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
27
|
-
"blog-
|
|
27
|
+
"blog-updated": () => any;
|
|
28
28
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
|
-
"onBlog-
|
|
29
|
+
"onBlog-updated"?: (() => any) | undefined;
|
|
30
30
|
}>, {
|
|
31
31
|
isMyProfile: boolean;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|