@finema/core 1.4.220 → 2.1.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 (307) hide show
  1. package/README.md +79 -60
  2. package/dist/module.d.mts +4 -24
  3. package/dist/module.json +4 -3
  4. package/dist/module.mjs +75 -213
  5. package/dist/runtime/components/App.vue +27 -0
  6. package/dist/runtime/components/App.vue.d.ts +12 -0
  7. package/dist/runtime/components/DevToolsWindow/index.vue +312 -0
  8. package/dist/runtime/components/DevToolsWindow/index.vue.d.ts +2 -0
  9. package/dist/runtime/components/Dialog/index.vue +77 -110
  10. package/dist/runtime/components/Dialog/index.vue.d.ts +10 -0
  11. package/dist/runtime/components/Empty.vue +33 -18
  12. package/dist/runtime/components/Empty.vue.d.ts +12 -0
  13. package/dist/runtime/components/FlexDeck/Base.vue +154 -159
  14. package/dist/runtime/components/FlexDeck/Base.vue.d.ts +63 -0
  15. package/dist/runtime/components/FlexDeck/index.vue +67 -68
  16. package/dist/runtime/components/FlexDeck/index.vue.d.ts +43 -0
  17. package/dist/runtime/components/Form/FieldWrapper.vue +35 -23
  18. package/dist/runtime/components/Form/FieldWrapper.vue.d.ts +16 -0
  19. package/dist/runtime/components/Form/Fields.vue +92 -230
  20. package/dist/runtime/components/Form/Fields.vue.d.ts +14 -0
  21. package/dist/runtime/components/Form/InputCheckbox/index.vue +53 -28
  22. package/dist/runtime/components/Form/InputCheckbox/index.vue.d.ts +3 -0
  23. package/dist/runtime/components/Form/InputCheckbox/types.d.ts +5 -1
  24. package/dist/runtime/components/Form/InputDateTime/date_time_field.types.d.ts +1 -1
  25. package/dist/runtime/components/Form/InputDateTime/index.vue +97 -68
  26. package/dist/runtime/components/Form/InputDateTime/index.vue.d.ts +4 -0
  27. package/dist/runtime/components/Form/InputNumber/index.vue +61 -27
  28. package/dist/runtime/components/Form/InputNumber/index.vue.d.ts +5 -0
  29. package/dist/runtime/components/Form/InputNumber/types.d.ts +10 -5
  30. package/dist/runtime/components/Form/InputSelect/index.vue +95 -55
  31. package/dist/runtime/components/Form/InputSelect/index.vue.d.ts +5 -0
  32. package/dist/runtime/components/Form/InputSelect/types.d.ts +14 -8
  33. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +108 -54
  34. package/dist/runtime/components/Form/InputSelectMultiple/index.vue.d.ts +3 -0
  35. package/dist/runtime/components/Form/InputSelectMultiple/types.d.ts +9 -8
  36. package/dist/runtime/components/Form/InputText/index.vue +135 -68
  37. package/dist/runtime/components/Form/InputText/index.vue.d.ts +5 -0
  38. package/dist/runtime/components/Form/InputText/types.d.ts +4 -3
  39. package/dist/runtime/components/Form/InputTextarea/index.vue +57 -25
  40. package/dist/runtime/components/Form/InputTextarea/index.vue.d.ts +3 -0
  41. package/dist/runtime/components/Form/InputTextarea/types.d.ts +7 -2
  42. package/dist/runtime/components/Form/InputToggle/index.vue +51 -27
  43. package/dist/runtime/components/Form/InputToggle/index.vue.d.ts +3 -0
  44. package/dist/runtime/components/Form/InputToggle/types.d.ts +5 -1
  45. package/dist/runtime/components/Form/index.vue +5 -6
  46. package/dist/runtime/components/Form/index.vue.d.ts +12 -0
  47. package/dist/runtime/components/Form/types.d.ts +13 -27
  48. package/dist/runtime/components/Image.vue +51 -36
  49. package/dist/runtime/components/Image.vue.d.ts +13 -0
  50. package/dist/runtime/components/Loader.vue +29 -27
  51. package/dist/runtime/components/Loader.vue.d.ts +22 -0
  52. package/dist/runtime/components/{LogItem.vue → Log/LogItem.vue} +44 -41
  53. package/dist/runtime/components/Log/LogItem.vue.d.ts +6 -0
  54. package/dist/runtime/components/Log/index.vue +28 -0
  55. package/dist/runtime/components/Log/index.vue.d.ts +7 -0
  56. package/dist/runtime/components/Table/Base.vue +166 -161
  57. package/dist/runtime/components/Table/Base.vue.d.ts +47 -0
  58. package/dist/runtime/components/Table/ColumnDate.vue +14 -16
  59. package/dist/runtime/components/Table/ColumnDate.vue.d.ts +8 -0
  60. package/dist/runtime/components/Table/ColumnDateTime.vue +16 -18
  61. package/dist/runtime/components/Table/ColumnDateTime.vue.d.ts +8 -0
  62. package/dist/runtime/components/Table/ColumnImage.vue +16 -15
  63. package/dist/runtime/components/Table/ColumnImage.vue.d.ts +8 -0
  64. package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
  65. package/dist/runtime/components/Table/ColumnNumber.vue.d.ts +8 -0
  66. package/dist/runtime/components/Table/ColumnText.vue +24 -29
  67. package/dist/runtime/components/Table/ColumnText.vue.d.ts +8 -0
  68. package/dist/runtime/components/Table/Simple.vue +69 -70
  69. package/dist/runtime/components/Table/Simple.vue.d.ts +24 -0
  70. package/dist/runtime/components/Table/index.vue +178 -65
  71. package/dist/runtime/components/Table/index.vue.d.ts +25 -0
  72. package/dist/runtime/components/Table/types.d.ts +14 -18
  73. package/dist/runtime/components/Table/{types.mjs → types.js} +1 -0
  74. package/dist/runtime/components/TeleportSafe.vue +42 -40
  75. package/dist/runtime/components/TeleportSafe.vue.d.ts +16 -0
  76. package/dist/runtime/composables/loaderList.d.ts +2 -2
  77. package/dist/runtime/composables/loaderList.js +51 -0
  78. package/dist/runtime/composables/loaderObject.d.ts +1 -1
  79. package/dist/runtime/composables/loaderObject.js +50 -0
  80. package/dist/runtime/composables/loaderPage.d.ts +10 -11
  81. package/dist/runtime/composables/loaderPage.js +243 -0
  82. package/dist/runtime/composables/useApp.d.ts +4 -9
  83. package/dist/runtime/composables/{useApp.mjs → useApp.js} +0 -12
  84. package/dist/runtime/composables/useConfig.d.ts +3 -3
  85. package/dist/runtime/composables/useConfig.js +12 -0
  86. package/dist/runtime/composables/useDialog.d.ts +1 -7
  87. package/dist/runtime/composables/useDialog.js +53 -0
  88. package/dist/runtime/composables/useFlexDeck.d.ts +1 -1
  89. package/dist/runtime/composables/{useFlexDeck.mjs → useFlexDeck.js} +5 -5
  90. package/dist/runtime/composables/useForm.d.ts +5 -2
  91. package/dist/runtime/composables/useForm.js +37 -0
  92. package/dist/runtime/composables/useNotification.d.ts +6 -22
  93. package/dist/runtime/composables/{useNotification.mjs → useNotification.js} +5 -21
  94. package/dist/runtime/composables/useTable.d.ts +12 -11
  95. package/dist/runtime/composables/{useTable.mjs → useTable.js} +3 -8
  96. package/dist/runtime/composables/useUpload.d.ts +2 -2
  97. package/dist/runtime/composables/{useUpload.mjs → useUpload.js} +1 -1
  98. package/dist/runtime/helpers/apiBaseHelper.d.ts +29 -0
  99. package/dist/runtime/helpers/apiBaseHelper.js +63 -0
  100. package/dist/runtime/helpers/apiListHelper.d.ts +4 -6
  101. package/dist/runtime/helpers/apiListHelper.js +50 -0
  102. package/dist/runtime/helpers/apiObjectHelper.d.ts +19 -20
  103. package/dist/runtime/helpers/apiObjectHelper.js +51 -0
  104. package/dist/runtime/helpers/apiPageHelper.d.ts +44 -44
  105. package/dist/runtime/helpers/apiPageHelper.js +287 -0
  106. package/dist/runtime/helpers/componentHelper.d.ts +11 -12
  107. package/dist/runtime/helpers/{componentHelper.mjs → componentHelper.js} +2 -7
  108. package/dist/runtime/i18n/valibot.d.ts +69 -0
  109. package/dist/runtime/i18n/valibot.js +72 -0
  110. package/dist/runtime/plugin.d.ts +1 -1
  111. package/dist/runtime/plugin.js +12 -0
  112. package/dist/runtime/server/tsconfig.json +3 -0
  113. package/dist/runtime/theme/button.d.ts +5 -0
  114. package/dist/runtime/theme/button.js +1 -0
  115. package/dist/runtime/theme/dialog.d.ts +31 -0
  116. package/dist/runtime/theme/dialog.js +21 -0
  117. package/dist/runtime/theme/empty.d.ts +7 -0
  118. package/dist/runtime/theme/empty.js +7 -0
  119. package/dist/runtime/theme/form.d.ts +18 -0
  120. package/dist/runtime/theme/form.js +16 -0
  121. package/dist/runtime/theme/index.d.ts +10 -0
  122. package/dist/runtime/theme/index.js +10 -0
  123. package/dist/runtime/theme/input.d.ts +8 -0
  124. package/dist/runtime/theme/input.js +4 -0
  125. package/dist/runtime/theme/inputNumber.d.ts +8 -0
  126. package/dist/runtime/theme/inputNumber.js +4 -0
  127. package/dist/runtime/theme/loader.d.ts +28 -0
  128. package/dist/runtime/theme/loader.js +18 -0
  129. package/dist/runtime/theme/selectMenu.d.ts +17 -0
  130. package/dist/runtime/theme/selectMenu.js +18 -0
  131. package/dist/runtime/theme/table.d.ts +10 -0
  132. package/dist/runtime/theme/table.js +10 -0
  133. package/dist/runtime/theme/textarea.d.ts +5 -0
  134. package/dist/runtime/theme/textarea.js +1 -0
  135. package/dist/runtime/types/lib.d.ts +1 -1
  136. package/dist/runtime/utils/ArrayHelper.d.ts +1 -1
  137. package/dist/runtime/utils/{ArrayHelper.mjs → ArrayHelper.js} +1 -1
  138. package/dist/runtime/utils/ObjectHelper.d.ts +3 -3
  139. package/dist/runtime/utils/{ObjectHelper.mjs → ObjectHelper.js} +3 -3
  140. package/dist/runtime/utils/ParamHelper.d.ts +1 -1
  141. package/dist/runtime/utils/{ParamHelper.mjs → ParamHelper.js} +1 -1
  142. package/dist/types.d.mts +2 -15
  143. package/package.json +91 -100
  144. package/dist/module.cjs +0 -5
  145. package/dist/module.d.ts +0 -50
  146. package/dist/runtime/components/Alert.vue +0 -48
  147. package/dist/runtime/components/Avatar.vue +0 -27
  148. package/dist/runtime/components/Badge.vue +0 -11
  149. package/dist/runtime/components/Breadcrumb.vue +0 -44
  150. package/dist/runtime/components/Button/Group.vue +0 -37
  151. package/dist/runtime/components/Button/index.vue +0 -75
  152. package/dist/runtime/components/Card.vue +0 -38
  153. package/dist/runtime/components/Core.vue +0 -45
  154. package/dist/runtime/components/Dropdown/index.vue +0 -70
  155. package/dist/runtime/components/Dropdown/types.d.ts +0 -2
  156. package/dist/runtime/components/Dropdown/types.mjs +0 -17
  157. package/dist/runtime/components/Form/InputDateTimeRange/date_range_time_field.types.d.ts +0 -17
  158. package/dist/runtime/components/Form/InputDateTimeRange/index.vue +0 -91
  159. package/dist/runtime/components/Form/InputRadio/index.vue +0 -27
  160. package/dist/runtime/components/Form/InputRadio/types.d.ts +0 -8
  161. package/dist/runtime/components/Form/InputStatic/index.vue +0 -16
  162. package/dist/runtime/components/Form/InputStatic/types.d.ts +0 -4
  163. package/dist/runtime/components/Form/InputTags/index.vue +0 -141
  164. package/dist/runtime/components/Form/InputTags/types.d.ts +0 -11
  165. package/dist/runtime/components/Form/InputTextarea/types.mjs +0 -0
  166. package/dist/runtime/components/Form/InputToggle/types.mjs +0 -0
  167. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +0 -206
  168. package/dist/runtime/components/Form/InputUploadDropzone/types.d.ts +0 -11
  169. package/dist/runtime/components/Form/InputUploadDropzone/types.mjs +0 -0
  170. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +0 -362
  171. package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.d.ts +0 -23
  172. package/dist/runtime/components/Form/InputUploadDropzoneAuto/types.mjs +0 -0
  173. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemUpload.vue +0 -241
  174. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/ItemView.vue +0 -110
  175. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +0 -171
  176. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.d.ts +0 -23
  177. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/types.mjs +0 -0
  178. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemUpload.vue +0 -161
  179. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/ItemView.vue +0 -64
  180. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/index.vue +0 -178
  181. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/types.d.ts +0 -21
  182. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/types.mjs +0 -0
  183. package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +0 -95
  184. package/dist/runtime/components/Form/InputUploadFileClassic/types.d.ts +0 -13
  185. package/dist/runtime/components/Form/InputUploadFileClassic/types.mjs +0 -0
  186. package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +0 -151
  187. package/dist/runtime/components/Form/InputUploadFileClassicAuto/types.d.ts +0 -18
  188. package/dist/runtime/components/Form/InputUploadFileClassicAuto/types.mjs +0 -0
  189. package/dist/runtime/components/Form/InputUploadImageAuto/index.vue +0 -219
  190. package/dist/runtime/components/Form/InputUploadImageAuto/types.d.ts +0 -20
  191. package/dist/runtime/components/Form/InputUploadImageAuto/types.mjs +0 -0
  192. package/dist/runtime/components/Form/InputWYSIWYG/UploadImageForm.vue +0 -55
  193. package/dist/runtime/components/Form/InputWYSIWYG/index.vue +0 -230
  194. package/dist/runtime/components/Form/InputWYSIWYG/types.d.ts +0 -19
  195. package/dist/runtime/components/Form/InputWYSIWYG/types.mjs +0 -0
  196. package/dist/runtime/components/Icon.vue +0 -23
  197. package/dist/runtime/components/Log.vue +0 -22
  198. package/dist/runtime/components/Modal/index.vue +0 -146
  199. package/dist/runtime/components/OTPInput.vue +0 -127
  200. package/dist/runtime/components/QRCode.vue +0 -22
  201. package/dist/runtime/components/SimplePagination.vue +0 -96
  202. package/dist/runtime/components/Slideover/index.vue +0 -110
  203. package/dist/runtime/components/Tabs/index.vue +0 -64
  204. package/dist/runtime/composables/loaderList.mjs +0 -52
  205. package/dist/runtime/composables/loaderObject.mjs +0 -52
  206. package/dist/runtime/composables/loaderPage.mjs +0 -229
  207. package/dist/runtime/composables/useConfig.mjs +0 -9
  208. package/dist/runtime/composables/useDialog.mjs +0 -81
  209. package/dist/runtime/composables/useForm.mjs +0 -18
  210. package/dist/runtime/core.config.d.ts +0 -14
  211. package/dist/runtime/core.config.mjs +0 -14
  212. package/dist/runtime/helpers/apiListHelper.mjs +0 -44
  213. package/dist/runtime/helpers/apiObjectHelper.mjs +0 -46
  214. package/dist/runtime/helpers/apiPageHelper.mjs +0 -270
  215. package/dist/runtime/plugin.mjs +0 -149
  216. package/dist/runtime/types/common.mjs +0 -0
  217. package/dist/runtime/types/config.d.ts +0 -1
  218. package/dist/runtime/types/config.mjs +0 -0
  219. package/dist/runtime/types/lib.mjs +0 -0
  220. package/dist/runtime/ui.config/alert.d.ts +0 -3
  221. package/dist/runtime/ui.config/alert.mjs +0 -6
  222. package/dist/runtime/ui.config/badge.d.ts +0 -3
  223. package/dist/runtime/ui.config/badge.mjs +0 -1
  224. package/dist/runtime/ui.config/breadcrumb.d.ts +0 -1
  225. package/dist/runtime/ui.config/breadcrumb.mjs +0 -7
  226. package/dist/runtime/ui.config/button.d.ts +0 -3
  227. package/dist/runtime/ui.config/button.mjs +0 -8
  228. package/dist/runtime/ui.config/buttonGroup.d.ts +0 -3
  229. package/dist/runtime/ui.config/buttonGroup.mjs +0 -1
  230. package/dist/runtime/ui.config/card.d.ts +0 -1
  231. package/dist/runtime/ui.config/card.mjs +0 -2
  232. package/dist/runtime/ui.config/checkbox.d.ts +0 -3
  233. package/dist/runtime/ui.config/checkbox.mjs +0 -1
  234. package/dist/runtime/ui.config/formGroup.d.ts +0 -3
  235. package/dist/runtime/ui.config/formGroup.mjs +0 -5
  236. package/dist/runtime/ui.config/icon.d.ts +0 -3
  237. package/dist/runtime/ui.config/icon.mjs +0 -3
  238. package/dist/runtime/ui.config/index.d.ts +0 -16
  239. package/dist/runtime/ui.config/index.mjs +0 -16
  240. package/dist/runtime/ui.config/input.d.ts +0 -3
  241. package/dist/runtime/ui.config/input.mjs +0 -5
  242. package/dist/runtime/ui.config/modal.d.ts +0 -1
  243. package/dist/runtime/ui.config/modal.mjs +0 -34
  244. package/dist/runtime/ui.config/notification.d.ts +0 -11
  245. package/dist/runtime/ui.config/notification.mjs +0 -13
  246. package/dist/runtime/ui.config/notifications.d.ts +0 -3
  247. package/dist/runtime/ui.config/notifications.mjs +0 -3
  248. package/dist/runtime/ui.config/pagination.d.ts +0 -3
  249. package/dist/runtime/ui.config/pagination.mjs +0 -37
  250. package/dist/runtime/ui.config/select.d.ts +0 -3
  251. package/dist/runtime/ui.config/select.mjs +0 -5
  252. package/dist/runtime/ui.config/selectMenu.d.ts +0 -3
  253. package/dist/runtime/ui.config/selectMenu.mjs +0 -5
  254. package/dist/runtime/ui.config/slideover.d.ts +0 -1
  255. package/dist/runtime/ui.config/slideover.mjs +0 -16
  256. package/dist/runtime/ui.config/table.d.ts +0 -3
  257. package/dist/runtime/ui.config/table.mjs +0 -47
  258. package/dist/runtime/ui.config/tabs.d.ts +0 -3
  259. package/dist/runtime/ui.config/tabs.mjs +0 -4
  260. package/dist/runtime/ui.config/tags.d.ts +0 -25
  261. package/dist/runtime/ui.config/tags.mjs +0 -25
  262. package/dist/runtime/ui.config/textarea.d.ts +0 -3
  263. package/dist/runtime/ui.config/textarea.mjs +0 -5
  264. package/dist/runtime/ui.config/toggle.d.ts +0 -3
  265. package/dist/runtime/ui.config/toggle.mjs +0 -5
  266. package/dist/runtime/ui.config/uploadDropzoneImage.d.ts +0 -83
  267. package/dist/runtime/ui.config/uploadDropzoneImage.mjs +0 -26
  268. package/dist/runtime/ui.config/uploadFileDropzone.d.ts +0 -61
  269. package/dist/runtime/ui.config/uploadFileDropzone.mjs +0 -61
  270. package/dist/runtime/ui.config/uploadFileInputClassicAuto.d.ts +0 -8
  271. package/dist/runtime/ui.config/uploadFileInputClassicAuto.mjs +0 -8
  272. package/dist/runtime/ui.config/uploadImage.d.ts +0 -34
  273. package/dist/runtime/ui.config/uploadImage.mjs +0 -36
  274. package/dist/runtime/ui.css +0 -1
  275. package/dist/runtime/utils/ArrayHelper.spec.d.ts +0 -1
  276. package/dist/runtime/utils/ArrayHelper.spec.mjs +0 -112
  277. package/dist/runtime/utils/FileHelper.spec.d.ts +0 -1
  278. package/dist/runtime/utils/FileHelper.spec.mjs +0 -14
  279. package/dist/runtime/utils/ObjectHelper.spec.d.ts +0 -1
  280. package/dist/runtime/utils/ObjectHelper.spec.mjs +0 -52
  281. package/dist/runtime/utils/ParamHelper.spec.d.ts +0 -1
  282. package/dist/runtime/utils/ParamHelper.spec.mjs +0 -78
  283. package/dist/runtime/utils/StringHelper.spec.d.ts +0 -1
  284. package/dist/runtime/utils/StringHelper.spec.mjs +0 -76
  285. package/dist/runtime/utils/TimeHelper.spec.d.ts +0 -1
  286. package/dist/runtime/utils/TimeHelper.spec.mjs +0 -79
  287. package/dist/runtime/utils/TimeHelper.thai.spec.d.ts +0 -1
  288. package/dist/runtime/utils/TimeHelper.thai.spec.mjs +0 -31
  289. package/dist/types.d.ts +0 -16
  290. package/dist/runtime/components/FlexDeck/{types.mjs → types.js} +0 -0
  291. package/dist/runtime/components/Form/InputCheckbox/{types.mjs → types.js} +0 -0
  292. package/dist/runtime/components/Form/InputDateTime/{date_time_field.types.mjs → date_time_field.types.js} +0 -0
  293. package/dist/runtime/components/Form/{InputDateTimeRange/date_range_time_field.types.mjs → InputNumber/types.js} +0 -0
  294. package/dist/runtime/components/Form/{InputNumber/types.mjs → InputSelect/types.js} +0 -0
  295. package/dist/runtime/components/Form/{InputRadio/types.mjs → InputSelectMultiple/types.js} +0 -0
  296. package/dist/runtime/components/Form/{InputSelect/types.mjs → InputText/types.js} +0 -0
  297. package/dist/runtime/components/Form/{InputSelectMultiple/types.mjs → InputTextarea/types.js} +0 -0
  298. package/dist/runtime/components/Form/{InputStatic/types.mjs → InputToggle/types.js} +0 -0
  299. package/dist/runtime/components/Form/{types.mjs → types.js} +0 -0
  300. package/dist/runtime/composables/{useWatch.mjs → useWatch.js} +0 -0
  301. package/dist/runtime/lib/{Requester.mjs → Requester.js} +0 -0
  302. package/dist/runtime/{components/Form/InputTags/types.mjs → types/common.js} +0 -0
  303. package/dist/runtime/{components/Form/InputText/types.mjs → types/lib.js} +0 -0
  304. package/dist/runtime/utils/{FileHelper.mjs → FileHelper.js} +0 -0
  305. package/dist/runtime/utils/{StringHelper.mjs → StringHelper.js} +0 -0
  306. package/dist/runtime/utils/{TimeHelper.mjs → TimeHelper.js} +1 -1
  307. /package/dist/runtime/utils/{lodash.mjs → lodash.js} +0 -0
@@ -1,14 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { FileHelper } from "./FileHelper.mjs";
3
- describe("FileHelper", () => {
4
- describe("dataURLtoFile", () => {
5
- it("should convert a data URL to a File", async () => {
6
- const dataUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==";
7
- const filename = "test.png";
8
- const file = await FileHelper.dataURLtoFile(dataUrl, filename);
9
- expect(file).toBeInstanceOf(File);
10
- expect(file.name).toBe(filename);
11
- expect(file.type).toBe("image/png");
12
- });
13
- });
14
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,52 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { ObjectHelper } from "./ObjectHelper.mjs";
3
- describe("ObjectHelper", () => {
4
- describe("createOption", () => {
5
- it("should create an option object with the provided value and label", () => {
6
- const value = "value1";
7
- const label = "Label 1";
8
- const option = ObjectHelper.createOption(value, label);
9
- expect(option).toEqual({ value, label });
10
- });
11
- it("should create an option object with an empty label if not provided", () => {
12
- const value = "value1";
13
- const option = ObjectHelper.createOption(value);
14
- expect(option).toEqual({ value, label: "" });
15
- });
16
- });
17
- describe("toOption", () => {
18
- it("should create an option object from the provided data", () => {
19
- const data = { id: 1, name: "Option 1" };
20
- const option = ObjectHelper.toOption(data);
21
- expect(option).toEqual({ value: 1, label: "Option 1" });
22
- });
23
- it("should use the provided value and label attributes", () => {
24
- const data = { code: "CODE1", description: "Description 1" };
25
- const option = ObjectHelper.toOption(data, "code", "description");
26
- expect(option).toEqual({ value: "CODE1", label: "Description 1" });
27
- });
28
- });
29
- describe("toErrorStatus", () => {
30
- it("should create an error status object from the provided error", () => {
31
- const error = {
32
- response: {
33
- status: 400,
34
- request: {
35
- response: JSON.stringify({ code: "INVALID_REQUEST", message: "Invalid request" })
36
- }
37
- }
38
- };
39
- const status = ObjectHelper.toErrorStatus({}, error);
40
- expect(status.isError).toBe(true);
41
- expect(status.isSuccess).toBe(false);
42
- expect(status.errorData).toEqual({ code: "INVALID_REQUEST", message: "Invalid request" });
43
- });
44
- it("should create a network error status if the error response status is missing", () => {
45
- const error = {};
46
- const status = ObjectHelper.toErrorStatus({}, error);
47
- expect(status.isError).toBe(true);
48
- expect(status.isSuccess).toBe(false);
49
- expect(status.errorData).toEqual({ code: "NETWORK_ERROR", message: "Network error" });
50
- });
51
- });
52
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,78 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { ParamHelper } from "./ParamHelper.mjs";
3
- describe("ParamHelper", () => {
4
- describe("getParams", () => {
5
- it("should merge params from opts and reqOptions", () => {
6
- const opts = { params: { page: 1, limit: 10 } };
7
- const reqOptions = { params: { sort: "name" } };
8
- const result = ParamHelper.getParams(opts, reqOptions);
9
- expect(result).toEqual({ page: 1, limit: 10, sort: "name" });
10
- });
11
- it("should return reqOptions.params if opts.params is not provided", () => {
12
- const opts = {};
13
- const reqOptions = { params: { sort: "name" } };
14
- const result = ParamHelper.getParams(opts, reqOptions);
15
- expect(result).toEqual({ sort: "name" });
16
- });
17
- });
18
- describe("getBoolTrue", () => {
19
- it("should return true for truthy values", () => {
20
- expect(ParamHelper.getBoolTrue(true)).toBe(true);
21
- expect(ParamHelper.getBoolTrue(1)).toBe(true);
22
- expect(ParamHelper.getBoolTrue("true")).toBe(true);
23
- });
24
- it("should return false for falsy values", () => {
25
- expect(ParamHelper.getBoolTrue(false)).toBe(false);
26
- expect(ParamHelper.getBoolTrue(0)).toBe(false);
27
- expect(ParamHelper.getBoolTrue("false")).toBe(false);
28
- });
29
- it("should return true for null value", () => {
30
- expect(ParamHelper.getBoolTrue(null)).toBe(true);
31
- });
32
- });
33
- describe("getBoolFalse", () => {
34
- it("should return false for falsy values", () => {
35
- expect(ParamHelper.getBoolFalse(false)).toBe(false);
36
- expect(ParamHelper.getBoolFalse(0)).toBe(false);
37
- expect(ParamHelper.getBoolFalse("false")).toBe(false);
38
- });
39
- it("should return true for truthy values", () => {
40
- expect(ParamHelper.getBoolFalse(true)).toBe(true);
41
- expect(ParamHelper.getBoolFalse(1)).toBe(true);
42
- expect(ParamHelper.getBoolFalse("true")).toBe(true);
43
- });
44
- it("should return false for null value", () => {
45
- expect(ParamHelper.getBoolFalse(null)).toBe(false);
46
- });
47
- });
48
- describe("isNotFoundError", () => {
49
- it('should return true if the error code is "NOT_FOUND"', () => {
50
- const error = { code: "NOT_FOUND" };
51
- expect(ParamHelper.isNotFoundError(error)).toBe(true);
52
- });
53
- it('should return false if the error code is not "NOT_FOUND"', () => {
54
- const error = { code: "INTERNAL_SERVER_ERROR" };
55
- expect(ParamHelper.isNotFoundError(error)).toBe(false);
56
- });
57
- });
58
- describe("isChangeWithFalse", () => {
59
- it("should return true if the value changes from true to false", () => {
60
- expect(ParamHelper.isChangeWithFalse(false, true)).toBe(true);
61
- });
62
- it("should return false if the value does not change or changes to true", () => {
63
- expect(ParamHelper.isChangeWithFalse(true, true)).toBe(false);
64
- expect(ParamHelper.isChangeWithFalse(false, false)).toBe(false);
65
- expect(ParamHelper.isChangeWithFalse(true, false)).toBe(false);
66
- });
67
- });
68
- describe("isChangeWithTrue", () => {
69
- it("should return true if the value changes from false to true", () => {
70
- expect(ParamHelper.isChangeWithTrue(true, false)).toBe(true);
71
- });
72
- it("should return false if the value does not change or changes to false", () => {
73
- expect(ParamHelper.isChangeWithTrue(false, false)).toBe(false);
74
- expect(ParamHelper.isChangeWithTrue(true, true)).toBe(false);
75
- expect(ParamHelper.isChangeWithTrue(false, true)).toBe(false);
76
- });
77
- });
78
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,76 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { StringHelper } from "./StringHelper.mjs";
3
- describe("StringHelper", () => {
4
- describe("genString", () => {
5
- it("should generate a random string of the specified length", () => {
6
- const length = 10;
7
- const result = StringHelper.genString(length);
8
- expect(result).toHaveLength(length);
9
- expect(typeof result).toBe("string");
10
- });
11
- it("should generate a random string of default length if not specified", () => {
12
- const result = StringHelper.genString();
13
- expect(result).toHaveLength(5);
14
- expect(typeof result).toBe("string");
15
- });
16
- });
17
- describe("withComma", () => {
18
- it("should format a number with comma separator", () => {
19
- expect(StringHelper.withComma(1e3)).toBe("1,000");
20
- expect(StringHelper.withComma(1234.56)).toBe("1,234.56");
21
- });
22
- it('should return "0" for null or undefined values', () => {
23
- expect(StringHelper.withComma(void 0)).toBe("0");
24
- });
25
- });
26
- describe("withFixed", () => {
27
- it("should format a number with comma separator and fixed decimal places", () => {
28
- expect(StringHelper.withFixed(1e3)).toBe("1,000");
29
- expect(StringHelper.withFixed(1234.56)).toBe("1,234.56");
30
- });
31
- it('should return "0" for null or undefined values', () => {
32
- expect(StringHelper.withFixed(void 0)).toBe("0");
33
- });
34
- });
35
- describe("split", () => {
36
- it("should split a string into an array based on the specified separator", () => {
37
- const str = "apple,banana,orange";
38
- const separator = ",";
39
- const result = StringHelper.split(str, separator);
40
- expect(result).toEqual(["apple", "banana", "orange"]);
41
- });
42
- it("should return an empty array for null or undefined string", () => {
43
- expect(StringHelper.split(null, ",")).toEqual([]);
44
- expect(StringHelper.split(void 0, ",")).toEqual([]);
45
- });
46
- });
47
- describe("joinURL", () => {
48
- it("should join the provided URL parts", () => {
49
- const result = StringHelper.joinURL("https://example.com", "path", "to", "resource");
50
- expect(result).toBe("https://example.com/path/to/resource");
51
- });
52
- });
53
- describe("truncate", () => {
54
- it("should truncate a string if it exceeds the specified length", () => {
55
- const str = "This is a long string that needs to be truncated";
56
- const result = StringHelper.truncate(str, 20);
57
- expect(result).toBe("This is a long strin...");
58
- });
59
- it("should return the original string if it does not exceed the specified length", () => {
60
- const str = "Short string";
61
- const result = StringHelper.truncate(str, 20);
62
- expect(result).toBe("Short string");
63
- });
64
- });
65
- describe("getError", () => {
66
- it("should return the error message from the errorData", () => {
67
- const errorData = { code: "ERROR_CODE", message: "Error message" };
68
- const result = StringHelper.getError(errorData);
69
- expect(result).toBe("Error message");
70
- });
71
- it("should return the default error message if the errorData is empty", () => {
72
- const result = StringHelper.getError({}, "Default error message");
73
- expect(result).toBe("Default error message");
74
- });
75
- });
76
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,79 +0,0 @@
1
- import { assert, describe, it, vi } from "vitest";
2
- import { TimeHelper } from "./TimeHelper.mjs";
3
- vi.mock("#core/composables/useConfig", () => ({
4
- useCoreConfig: () => ({
5
- date_format: "yyyy-MM-dd",
6
- date_time_format: "yyyy-MM-dd HH:mm",
7
- date_format_system: "yyyy-MM-dd",
8
- date_time_format_system: "yyyy-MM-dd HH:mm",
9
- time_format: "HH:mm",
10
- is_thai_year: false,
11
- time_zone: "Asia/Bangkok"
12
- })
13
- }));
14
- describe("TimeHelper", async () => {
15
- it("toUTC should convert time to UTC format", () => {
16
- const inputTime = "2023-12-19 12:00";
17
- const expectedOutput = "2023-12-19 05:00";
18
- const result = TimeHelper.toUTC(inputTime);
19
- assert.equal(result, expectedOutput);
20
- });
21
- it("toUTC should convert time to UTC format 2", () => {
22
- const inputTime = "2023-01-16T22:01:00Z";
23
- const expectedOutput = "2023-01-16 22:01";
24
- const result = TimeHelper.toUTC(inputTime);
25
- assert.equal(result, expectedOutput);
26
- });
27
- it("toLocal should convert time to local format", () => {
28
- const inputTime = "2023-01-16T22:00:00Z";
29
- const expectedOutput = "2023-01-17 05:00";
30
- const result = TimeHelper.toLocal(inputTime);
31
- assert.equal(result, expectedOutput);
32
- });
33
- it("[thai year ]toLocal should convert time to local format", () => {
34
- const inputTime = "2023-12-19 12:00";
35
- const expectedOutput = "2023-12-19 12:00";
36
- const result = TimeHelper.toLocal(inputTime);
37
- assert.equal(result, expectedOutput);
38
- });
39
- it("getCurrentDate should return the current date in yyyy-MM-dd format", () => {
40
- const expectedOutputRegex = /^\d{4}-\d{2}-\d{2}$/;
41
- const result = TimeHelper.getCurrentDate();
42
- assert.match(result, expectedOutputRegex);
43
- });
44
- it("getDateFormTime should convert time to date format", () => {
45
- const inputTime = "2023-12-19 12:00";
46
- const expectedOutput = "2023-12-19";
47
- const result = TimeHelper.getDateFormTime(inputTime);
48
- assert.equal(result, expectedOutput);
49
- });
50
- it("getDateFormTimeWithLocal should convert time to date format with local time", () => {
51
- const inputTime = "2023-12-19 12:00";
52
- const expectedOutputRegex = /^\d{4}-\d{2}-\d{2}$/;
53
- const result = TimeHelper.getDateFormTimeWithLocal(inputTime);
54
- assert.match(result, expectedOutputRegex);
55
- });
56
- it("getISODateTimeFormTime should convert time to ISO date-time format", () => {
57
- const inputTime = "2023-12-19 14:30";
58
- const expectedOutput = "2023-12-19T14:30:00+07:00";
59
- const result = TimeHelper.getISODateTimeFormTime(inputTime);
60
- assert.equal(result, expectedOutput);
61
- });
62
- it("getDateTimeFormTime should convert time to date-time format", () => {
63
- const inputTime = "2023-12-19 12:00";
64
- const expectedOutputRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/;
65
- const result = TimeHelper.getDateTimeFormTime(inputTime);
66
- assert.match(result, expectedOutputRegex);
67
- });
68
- it("getTimeFormTime should convert time to time format", () => {
69
- const inputTime = "2023-12-19 12:00";
70
- const expectedOutputRegex = /^\d{2}:\d{2}$/;
71
- const result = TimeHelper.getTimeFormTime(inputTime);
72
- assert.match(result, expectedOutputRegex);
73
- });
74
- it("getCurrentDateTime should return the current date and time in yyyy-MM-dd HH:mm format", () => {
75
- const expectedOutputRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/;
76
- const result = TimeHelper.getCurrentDateTime();
77
- assert.match(result, expectedOutputRegex);
78
- });
79
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- import { assert, describe, it, vi } from "vitest";
2
- import { TimeHelper } from "./TimeHelper.mjs";
3
- vi.mock("#core/composables/useConfig", () => ({
4
- useCoreConfig: () => ({
5
- date_format: "yyyy-MM-dd",
6
- date_time_format: "yyyy-MM-dd HH:mm",
7
- time_format: "HH:mm",
8
- is_thai_year: true,
9
- time_zone: "Asia/Bangkok"
10
- })
11
- }));
12
- describe("TimeHelper", async () => {
13
- it("displayDate", () => {
14
- const inputTime = "2023-12-19 12:00";
15
- const expectedOutput = "2566-12-19";
16
- const result = TimeHelper.displayDate(inputTime);
17
- assert.equal(result, expectedOutput);
18
- });
19
- it("displayDateTime", () => {
20
- const inputTime = "2023-12-19 12:00";
21
- const expectedOutput = "2566-12-19 12:00";
22
- const result = TimeHelper.displayDateTime(inputTime);
23
- assert.equal(result, expectedOutput);
24
- });
25
- it("displayDateTime - iso", () => {
26
- const inputTime = "2023-01-16T22:00:00Z";
27
- const expectedOutput = "2566-01-17 05:00";
28
- const result = TimeHelper.displayDateTime(inputTime);
29
- assert.equal(result, expectedOutput);
30
- });
31
- });
package/dist/types.d.ts DELETED
@@ -1,16 +0,0 @@
1
-
2
- import type { ModuleOptions } from './module'
3
-
4
-
5
- declare module '@nuxt/schema' {
6
- interface NuxtConfig { ['core']?: Partial<ModuleOptions> }
7
- interface NuxtOptions { ['core']?: ModuleOptions }
8
- }
9
-
10
- declare module 'nuxt/schema' {
11
- interface NuxtConfig { ['core']?: Partial<ModuleOptions> }
12
- interface NuxtOptions { ['core']?: ModuleOptions }
13
- }
14
-
15
-
16
- export type { core } from './module'
File without changes
@@ -1,7 +1,7 @@
1
1
  import { addYears, format, formatISO, isDate, isValid, parse } from "date-fns";
2
2
  import * as locales from "date-fns/locale";
3
- import { useCoreConfig } from "#core/composables/useConfig";
4
3
  import { formatInTimeZone } from "date-fns-tz";
4
+ import { useCoreConfig } from "#core/composables/useConfig";
5
5
  const dateFormat = useCoreConfig().date_format_system;
6
6
  const dateFormatDisplay = useCoreConfig().date_format;
7
7
  const dateTimeFormat = useCoreConfig().date_time_format_system;
File without changes