pukaad-ui-lib 1.139.0 → 1.141.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.vue +5 -2
- 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/input/input-slider.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-slider.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-textarea.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-textarea.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/composables/useConvert.d.ts +5 -0
- package/dist/runtime/composables/useConvert.js +21 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -25,9 +25,11 @@
|
|
|
25
25
|
/>
|
|
26
26
|
</div>
|
|
27
27
|
<div class="text-gray font-body-small flex gap-[4px] items-center">
|
|
28
|
-
<div>
|
|
28
|
+
<div>
|
|
29
|
+
{{ convertDateTorelativeText(props.item.create_at) }}
|
|
30
|
+
</div>
|
|
29
31
|
<div>•</div>
|
|
30
|
-
<div>{{
|
|
32
|
+
<div>{{ convertNumber(props.item.view_count) }} วิว</div>
|
|
31
33
|
</div>
|
|
32
34
|
</div>
|
|
33
35
|
</div>
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
import { useRouter } from "vue-router";
|
|
81
83
|
import { ref, watch } from "vue";
|
|
82
84
|
import { useConvert } from "@/runtime/composables/useConvert";
|
|
85
|
+
const { convertNumber, convertDateTorelativeText } = useConvert();
|
|
83
86
|
const props = defineProps({
|
|
84
87
|
item: { type: Object, required: true },
|
|
85
88
|
isMyProfile: { type: Boolean, required: false, default: false }
|
|
@@ -31,8 +31,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
31
31
|
fullHeight: boolean;
|
|
32
32
|
name: string;
|
|
33
33
|
limit: number;
|
|
34
|
-
accept: string;
|
|
35
34
|
disabledErrorMessage: boolean;
|
|
35
|
+
accept: string;
|
|
36
36
|
labelIcon: string;
|
|
37
37
|
disabledDrop: boolean;
|
|
38
38
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -31,8 +31,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
31
31
|
fullHeight: boolean;
|
|
32
32
|
name: string;
|
|
33
33
|
limit: number;
|
|
34
|
-
accept: string;
|
|
35
34
|
disabledErrorMessage: boolean;
|
|
35
|
+
accept: string;
|
|
36
36
|
labelIcon: string;
|
|
37
37
|
disabledDrop: boolean;
|
|
38
38
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -18,8 +18,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
18
18
|
}>, {
|
|
19
19
|
id: string;
|
|
20
20
|
name: string;
|
|
21
|
-
disabledForgotPassword: boolean;
|
|
22
21
|
new: boolean;
|
|
22
|
+
disabledForgotPassword: boolean;
|
|
23
23
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
24
|
declare const _default: typeof __VLS_export;
|
|
25
25
|
export default _default;
|
|
@@ -18,8 +18,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
18
18
|
}>, {
|
|
19
19
|
id: string;
|
|
20
20
|
name: string;
|
|
21
|
-
disabledForgotPassword: boolean;
|
|
22
21
|
new: boolean;
|
|
22
|
+
disabledForgotPassword: boolean;
|
|
23
23
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
24
|
declare const _default: typeof __VLS_export;
|
|
25
25
|
export default _default;
|
|
@@ -12,9 +12,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
12
12
|
label: string;
|
|
13
13
|
color: InputSliderColor;
|
|
14
14
|
fullWidth: boolean;
|
|
15
|
-
step: number;
|
|
16
15
|
max: number;
|
|
17
16
|
min: number;
|
|
17
|
+
step: number;
|
|
18
18
|
lineHeight: number | string;
|
|
19
19
|
appearance: boolean;
|
|
20
20
|
thumbSize: number | string;
|
|
@@ -12,9 +12,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
12
12
|
label: string;
|
|
13
13
|
color: InputSliderColor;
|
|
14
14
|
fullWidth: boolean;
|
|
15
|
-
step: number;
|
|
16
15
|
max: number;
|
|
17
16
|
min: number;
|
|
17
|
+
step: number;
|
|
18
18
|
lineHeight: number | string;
|
|
19
19
|
appearance: boolean;
|
|
20
20
|
thumbSize: number | string;
|
|
@@ -45,11 +45,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
45
45
|
name: string;
|
|
46
46
|
disabled: boolean;
|
|
47
47
|
limit: number;
|
|
48
|
-
resize: "none" | "both" | "horizontal" | "vertical";
|
|
49
48
|
disabledErrorMessage: boolean;
|
|
50
49
|
disabledBorder: boolean;
|
|
51
50
|
showCounter: boolean;
|
|
52
51
|
readonly: boolean;
|
|
52
|
+
resize: "none" | "both" | "horizontal" | "vertical";
|
|
53
53
|
rows: number;
|
|
54
54
|
heightScroll: boolean;
|
|
55
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -45,11 +45,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
45
45
|
name: string;
|
|
46
46
|
disabled: boolean;
|
|
47
47
|
limit: number;
|
|
48
|
-
resize: "none" | "both" | "horizontal" | "vertical";
|
|
49
48
|
disabledErrorMessage: boolean;
|
|
50
49
|
disabledBorder: boolean;
|
|
51
50
|
showCounter: boolean;
|
|
52
51
|
readonly: boolean;
|
|
52
|
+
resize: "none" | "both" | "horizontal" | "vertical";
|
|
53
53
|
rows: number;
|
|
54
54
|
heightScroll: boolean;
|
|
55
55
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
24
|
onClose?: (() => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
title: string;
|
|
27
|
-
confirmText: string;
|
|
28
27
|
disabledForgotPassword: boolean;
|
|
28
|
+
confirmText: string;
|
|
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
|
onClose?: (() => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
title: string;
|
|
27
|
-
confirmText: string;
|
|
28
27
|
disabledForgotPassword: boolean;
|
|
28
|
+
confirmText: string;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
31
31
|
export default _default;
|
|
@@ -14,5 +14,10 @@ export declare class Convert {
|
|
|
14
14
|
* @example convertDateTime("2024-01-01 12:00") => "1 ม.ค. 2567 12:00"
|
|
15
15
|
*/
|
|
16
16
|
convertDateTime(date: string | Date | null | undefined, format?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Convert date to relative text
|
|
19
|
+
* @example "เมื่อสักครู่", "10 นาทีที่ผ่านมา", "2 ชั่วโมงที่ผ่านมา", "17 ก.พ. 2569, 13:19"
|
|
20
|
+
*/
|
|
21
|
+
convertDateTorelativeText(date: string | Date | null | undefined): string;
|
|
17
22
|
}
|
|
18
23
|
export declare function useConvert(): Convert;
|
|
@@ -39,6 +39,27 @@ export class Convert {
|
|
|
39
39
|
if (!date) return "-";
|
|
40
40
|
return dayjs(date).format(format);
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Convert date to relative text
|
|
44
|
+
* @example "เมื่อสักครู่", "10 นาทีที่ผ่านมา", "2 ชั่วโมงที่ผ่านมา", "17 ก.พ. 2569, 13:19"
|
|
45
|
+
*/
|
|
46
|
+
convertDateTorelativeText(date) {
|
|
47
|
+
if (!date) return "-";
|
|
48
|
+
const target = dayjs(date);
|
|
49
|
+
const now = dayjs();
|
|
50
|
+
const diffMinute = now.diff(target, "minute");
|
|
51
|
+
const diffHour = now.diff(target, "hour");
|
|
52
|
+
if (diffMinute < 1) {
|
|
53
|
+
return "\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E2A\u0E31\u0E01\u0E04\u0E23\u0E39\u0E48";
|
|
54
|
+
}
|
|
55
|
+
if (diffMinute < 60) {
|
|
56
|
+
return `${diffMinute} \u0E19\u0E32\u0E17\u0E35\u0E17\u0E35\u0E48\u0E1C\u0E48\u0E32\u0E19\u0E21\u0E32`;
|
|
57
|
+
}
|
|
58
|
+
if (diffHour < 24) {
|
|
59
|
+
return `${diffHour} \u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07\u0E17\u0E35\u0E48\u0E1C\u0E48\u0E32\u0E19\u0E21\u0E32`;
|
|
60
|
+
}
|
|
61
|
+
return this.convertDateTime(date, "D MMM BBBB, HH:mm");
|
|
62
|
+
}
|
|
42
63
|
}
|
|
43
64
|
const convertInstance = new Convert();
|
|
44
65
|
export function useConvert() {
|