pukaad-ui-lib 1.89.0 → 1.91.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.89.0",
4
+ "version": "1.91.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -81,7 +81,6 @@ const module$1 = defineNuxtModule({
81
81
  addPlugin(resolver.resolve("./runtime/plugins/loadingPage"));
82
82
  addPlugin(resolver.resolve("./runtime/plugins/alert"));
83
83
  addPlugin(resolver.resolve("./runtime/plugins/toast"));
84
- addPlugin(resolver.resolve("./runtime/plugins/convert"));
85
84
  addPlugin(resolver.resolve("./runtime/plugins/quill.client"));
86
85
  _nuxt.hook("nitro:config", (nitroConfig) => {
87
86
  nitroConfig.publicAssets ||= [];
@@ -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;
@@ -0,0 +1,28 @@
1
+ export declare class Convert {
2
+ /**
3
+ * Convert date to Thai Buddhist Era
4
+ * @example convertDate("2026-01-20") => "20 มกราคม 2569"
5
+ */
6
+ convertDate(date: string | Date | null | undefined): string;
7
+ /**
8
+ * Convert datetime to Thai Buddhist Era with comma separator
9
+ * @example convertDateTime("2026-01-20T13:30:00") => "20 มกราคม 2569, 13:30 น."
10
+ */
11
+ convertDateTime(date: string | Date | null | undefined): string;
12
+ /**
13
+ * Convert date to short format
14
+ * @example convertShortDate("2026-01-20") => "20/01/69"
15
+ */
16
+ convertShortDate(date: string | Date | null | undefined): string;
17
+ /**
18
+ * Convert time only
19
+ * @example convertTime("2026-01-20T13:30:00") => "13:30 น."
20
+ */
21
+ convertTime(date: string | Date | null | undefined): string;
22
+ /**
23
+ * Convert number to Thai format
24
+ * @example convertNumber(1500000) => "1.5 ล้าน"
25
+ */
26
+ convertNumber(num: number): string;
27
+ }
28
+ export declare function useConvert(): Convert;
@@ -0,0 +1,71 @@
1
+ import dayjs from "#dayjs";
2
+ const djs = dayjs;
3
+ export class Convert {
4
+ /**
5
+ * Convert date to Thai Buddhist Era
6
+ * @example convertDate("2026-01-20") => "20 มกราคม 2569"
7
+ */
8
+ convertDate(date) {
9
+ if (!date) return "-";
10
+ const d = djs(date);
11
+ if (!d.isValid()) return "-";
12
+ return d.format("D MMMM BBBB");
13
+ }
14
+ /**
15
+ * Convert datetime to Thai Buddhist Era with comma separator
16
+ * @example convertDateTime("2026-01-20T13:30:00") => "20 มกราคม 2569, 13:30 น."
17
+ */
18
+ convertDateTime(date) {
19
+ if (!date) return "-";
20
+ const d = djs(date);
21
+ if (!d.isValid()) return "-";
22
+ return d.format("D MMMM BBBB, HH:mm \u0E19.");
23
+ }
24
+ /**
25
+ * Convert date to short format
26
+ * @example convertShortDate("2026-01-20") => "20/01/69"
27
+ */
28
+ convertShortDate(date) {
29
+ if (!date) return "-";
30
+ const d = djs(date);
31
+ if (!d.isValid()) return "-";
32
+ return d.format("DD/MM/BB");
33
+ }
34
+ /**
35
+ * Convert time only
36
+ * @example convertTime("2026-01-20T13:30:00") => "13:30 น."
37
+ */
38
+ convertTime(date) {
39
+ if (!date) return "-";
40
+ const d = djs(date);
41
+ if (!d.isValid()) return "-";
42
+ return d.format("HH:mm \u0E19.");
43
+ }
44
+ /**
45
+ * Convert number to Thai format
46
+ * @example convertNumber(1500000) => "1.5 ล้าน"
47
+ */
48
+ convertNumber(num) {
49
+ if (num >= 1e6) {
50
+ const value = Math.floor(num / 1e6 * 10) / 10;
51
+ return value.toString().replace(/\.0$/, "") + " \u0E25\u0E49\u0E32\u0E19";
52
+ }
53
+ if (num >= 1e5) {
54
+ const value = Math.floor(num / 1e5 * 10) / 10;
55
+ return value.toString().replace(/\.0$/, "") + " \u0E41\u0E2A\u0E19";
56
+ }
57
+ if (num >= 1e4) {
58
+ const value = Math.floor(num / 1e4 * 10) / 10;
59
+ return value.toString().replace(/\.0$/, "") + " \u0E2B\u0E21\u0E37\u0E48\u0E19";
60
+ }
61
+ if (num >= 1e3) {
62
+ const value = Math.floor(num / 1e3 * 10) / 10;
63
+ return value.toString().replace(/\.0$/, "") + " \u0E1E\u0E31\u0E19";
64
+ }
65
+ return num.toString();
66
+ }
67
+ }
68
+ const convertInstance = new Convert();
69
+ export function useConvert() {
70
+ return convertInstance;
71
+ }
@@ -1,5 +1,5 @@
1
- import "dayjs/locale/th";
2
1
  export declare class Convert {
2
+ private getDayjs;
3
3
  /**
4
4
  * Convert date to Thai Buddhist Era
5
5
  * @example convertDate("2026-01-20") => "20 มกราคม 2569"
@@ -1,17 +1,17 @@
1
- import { defineNuxtPlugin } from "nuxt/app";
2
- import dayjs from "dayjs";
3
- import * as buddhistEraPlugin from "dayjs/plugin/buddhistEra";
4
- import "dayjs/locale/th";
5
- const buddhistEra = buddhistEraPlugin.default || buddhistEraPlugin;
6
- dayjs.extend(buddhistEra);
7
- dayjs.locale("th");
1
+ import { defineNuxtPlugin, useNuxtApp } from "nuxt/app";
8
2
  export class Convert {
3
+ getDayjs() {
4
+ const nuxtApp = useNuxtApp();
5
+ return nuxtApp.$dayjs || null;
6
+ }
9
7
  /**
10
8
  * Convert date to Thai Buddhist Era
11
9
  * @example convertDate("2026-01-20") => "20 มกราคม 2569"
12
10
  */
13
11
  convertDate(date) {
14
12
  if (!date) return "-";
13
+ const dayjs = this.getDayjs();
14
+ if (!dayjs) return "-";
15
15
  const d = dayjs(date);
16
16
  if (!d.isValid()) return "-";
17
17
  return d.format("D MMMM BBBB");
@@ -22,6 +22,8 @@ export class Convert {
22
22
  */
23
23
  convertDateTime(date) {
24
24
  if (!date) return "-";
25
+ const dayjs = this.getDayjs();
26
+ if (!dayjs) return "-";
25
27
  const d = dayjs(date);
26
28
  if (!d.isValid()) return "-";
27
29
  return d.format("D MMMM BBBB, HH:mm \u0E19.");
@@ -32,6 +34,8 @@ export class Convert {
32
34
  */
33
35
  convertShortDate(date) {
34
36
  if (!date) return "-";
37
+ const dayjs = this.getDayjs();
38
+ if (!dayjs) return "-";
35
39
  const d = dayjs(date);
36
40
  if (!d.isValid()) return "-";
37
41
  return d.format("DD/MM/BB");
@@ -42,6 +46,8 @@ export class Convert {
42
46
  */
43
47
  convertTime(date) {
44
48
  if (!date) return "-";
49
+ const dayjs = this.getDayjs();
50
+ if (!dayjs) return "-";
45
51
  const d = dayjs(date);
46
52
  if (!d.isValid()) return "-";
47
53
  return d.format("HH:mm \u0E19.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.89.0",
3
+ "version": "1.91.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",