@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,110 +0,0 @@
1
- <template>
2
- <div :class="[ui.base, ui.background.default]">
3
- <div :class="[ui.onPreview.wrapper]">
4
- <div :class="[ui.onPreview.previewImgWrapper]">
5
- <div v-if="isImageFromPath(selectedFile.path)" class="size-full overflow-hidden">
6
- <img
7
- :src="selectedFile.url"
8
- :class="[ui.onPreview.previewImgClass]"
9
- alt="image-preview"
10
- />
11
- </div>
12
- <div v-else>
13
- <Icon
14
- :name="ui.onPreview.previewFileIcon || ui.default.filePreviewIcon"
15
- :class="[ui.onPreview.previewFileClass]"
16
- />
17
- </div>
18
- </div>
19
- <div :class="[ui.onPreview.textWrapper]">
20
- <div class="truncate">
21
- <h1 class="truncate font-bold" :title="selectedFile?.name">
22
- {{ StringHelper.truncate(selectedFile?.name, 40) }}
23
- </h1>
24
- <p class="truncate text-sm font-light text-gray-400">
25
- {{
26
- fileAllocate.isSelectedFileUseMb.value
27
- ? `${fileAllocate.selectedFileSizeMb.value} MB`
28
- : `${fileAllocate.selectedFileSizeKb.value} KB`
29
- }}
30
- </p>
31
- </div>
32
- <div :class="[ui.action.wrapper]">
33
- <Icon
34
- v-if="isImageFromPath(selectedFile.path) || isVideoFromPath(selectedFile.path)"
35
- :name="ui.action.previewIcon"
36
- :class="[ui.action.iconClass]"
37
- title="ดูตัวอย่าง"
38
- @click="() => (isPreviewOpen = true)"
39
- />
40
- <a
41
- v-if="isPDFFromPath(selectedFile.path)"
42
- :href="selectedFile.url"
43
- target="_blank"
44
- class="flex"
45
- >
46
- <Icon :name="ui.action.previewIcon" :class="[ui.action.iconClass]" title="ดูตัวอย่าง" />
47
- </a>
48
- <Icon
49
- :name="ui.action.downloadIcon"
50
- :class="[ui.action.iconClass]"
51
- title="ดาวน์โหลดไฟล์"
52
- @click="handleDownloadFile"
53
- />
54
- <Icon
55
- :name="ui.action.deleteIcon"
56
- :class="[ui.action.iconClass]"
57
- title="ลบไฟล์"
58
- @click="handleDeleteFile"
59
- />
60
- <Modal v-model="isPreviewOpen" :title="selectedFile?.name">
61
- <img
62
- v-if="isImageFromPath(selectedFile.path)"
63
- :src="selectedFile.url"
64
- alt="image-preview"
65
- class="mx-auto max-w-full rounded-lg"
66
- />
67
- <video
68
- v-else-if="isVideoFromPath(selectedFile.path)"
69
- :src="selectedFile.url"
70
- controls
71
- class="mx-auto max-w-full"
72
- />
73
- </Modal>
74
- </div>
75
- </div>
76
- </div>
77
- </div>
78
- </template>
79
- <script lang="ts" setup>
80
- import {
81
- downloadFileFromURL,
82
- isImageFromPath,
83
- isPDFFromPath,
84
- isVideoFromPath,
85
- useFileSize,
86
- } from '#core/helpers/componentHelper'
87
- import { type uploadFileDropzone } from '#core/ui.config'
88
- import type { IUploadDropzoneAutoMultipleProps } from '#core/components/Form/InputUploadDropzoneAutoMultiple/types'
89
- import { ref, StringHelper } from '#imports'
90
- import type { IFileValue } from '#core/components/Form/types'
91
-
92
- const emits = defineEmits(['delete'])
93
- const props = defineProps<
94
- {
95
- ui: typeof uploadFileDropzone
96
- selectedFile: IFileValue
97
- } & IUploadDropzoneAutoMultipleProps
98
- >()
99
-
100
- const isPreviewOpen = ref<boolean>(false)
101
- const fileAllocate = useFileSize(props.selectedFile.size)
102
-
103
- const handleDeleteFile = () => {
104
- emits('delete')
105
- }
106
-
107
- const handleDownloadFile = () => {
108
- downloadFileFromURL(props.selectedFile.url, props.selectedFile.name)
109
- }
110
- </script>
@@ -1,171 +0,0 @@
1
- <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div class="space-y-3">
4
- <div
5
- v-if="!isReadonly"
6
- ref="dropzoneRef"
7
- :class="[
8
- ui.base,
9
- {
10
- [ui.disabled]: isDisabled,
11
- [ui.background.default]: !isOverDropZone && !isDisabled,
12
- [ui.background.dragover]: isOverDropZone && !isDisabled,
13
- },
14
- ]"
15
- >
16
- <input
17
- ref="fileInputRef"
18
- type="file"
19
- class="hidden"
20
- :name="name"
21
- :accept="acceptFile"
22
- :disabled="isDisabled"
23
- multiple
24
- @change="handleChange"
25
- />
26
- <div :class="[ui.wrapper]">
27
- <div :class="[ui.placeholderWrapper]">
28
- <Icon :name="ui.default.uploadIcon" :class="[ui.labelIcon]" />
29
- <div :class="[ui.labelWrapper]">
30
- <p class="text-primary cursor-pointer" @click="handleOpenFile">
31
- {{ selectFileLabel }}
32
- </p>
33
- <p>{{ selectFileSubLabel }}</p>
34
- </div>
35
- <p v-if="placeholder" :class="[ui.placeholder]">{{ placeholder }}</p>
36
- </div>
37
- </div>
38
- </div>
39
- <ItemView
40
- v-for="(file, index) in value"
41
- :key="file.url"
42
- v-bind="$props"
43
- :ui="ui"
44
- :selected-file="file"
45
- @delete="handleDeleteFileView(index)"
46
- />
47
- <ItemUpload
48
- v-for="(file, index) in selectedFiles"
49
- :key="file.key"
50
- v-bind="$props"
51
- :ui="ui"
52
- :selected-file="file.file"
53
- @success="handleSuccess(index, $event)"
54
- @delete="handleDeleteFile(index)"
55
- @error="handleError(index, $event)"
56
- />
57
- </div>
58
- </FieldWrapper>
59
- </template>
60
-
61
- <script lang="ts" setup>
62
- import { useDropZone } from '@vueuse/core'
63
- import { type IUploadDropzoneAutoMultipleProps } from './types'
64
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
65
- import { useFieldHOC } from '#core/composables/useForm'
66
- import { _get, computed, ref, toRef, useUI, useUiConfig, StringHelper, ArrayHelper } from '#imports'
67
- import { uploadFileDropzone } from '#core/ui.config'
68
- import ItemView from './ItemView.vue'
69
- import ItemUpload from './ItemUpload.vue'
70
- import type { IFileValue } from '#core/components/Form/types'
71
-
72
- const config = useUiConfig<typeof uploadFileDropzone>(uploadFileDropzone, 'uploadFileDropzone')
73
- const props = withDefaults(defineProps<IUploadDropzoneAutoMultipleProps>(), {
74
- bodyKey: 'file',
75
- responseURL: 'url',
76
- responsePath: 'path',
77
- selectFileLabel: 'คลิกเพื่อเลือกไฟล์',
78
- selectFileSubLabel: 'หรือ ลากและวางที่นี่',
79
- retryLabel: 'ลองอีกครั้ง',
80
- uploadingLabel: 'กำลังอัพโหลด...',
81
- uploadFailedLabel: 'อัพโหลดล้มเหลว, กรุณาลองอีกครั้ง',
82
- })
83
-
84
- const emits = defineEmits(['change', 'success', 'delete'])
85
- const selectedFiles = ref<Array<{ file: File; key: string }>>([])
86
- const { wrapperProps, handleChange: onChange, setErrors, value } = useFieldHOC<IFileValue[]>(props)
87
-
88
- const { ui } = useUI('uploadFileDropzone', toRef(props, 'ui'), config)
89
-
90
- const fileInputRef = ref<HTMLInputElement | null>()
91
- const dropzoneRef = ref<HTMLDivElement>()
92
-
93
- const acceptFile = computed(() =>
94
- typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
95
- )
96
-
97
- const onDrop = (files: File[] | null) => {
98
- if (props.isDisabled || files?.length === 0 || !files) return
99
-
100
- for (const file of files) {
101
- selectedFiles.value = [
102
- {
103
- file,
104
- key: StringHelper.genString(),
105
- },
106
- ...selectedFiles.value,
107
- ]
108
-
109
- emits('change', value.value)
110
- }
111
- }
112
-
113
- const { isOverDropZone } = useDropZone(dropzoneRef as unknown as HTMLElement, {
114
- onDrop,
115
- })
116
-
117
- const handleChange = (e: Event) => {
118
- if (props.isDisabled) return
119
-
120
- for (const file of (e.target as HTMLInputElement).files ?? []) {
121
- selectedFiles.value = [
122
- {
123
- file,
124
- key: StringHelper.genString(),
125
- },
126
- ...selectedFiles.value,
127
- ]
128
-
129
- emits('change', value.value)
130
- }
131
-
132
- fileInputRef.value?.value && (fileInputRef.value.value = '')
133
- }
134
-
135
- const handleOpenFile = () => {
136
- fileInputRef.value?.click()
137
- }
138
-
139
- const handleDeleteFile = (index: number) => {
140
- const updatedValue = [...selectedFiles.value]
141
-
142
- updatedValue.splice(index, 1)
143
- selectedFiles.value = updatedValue
144
- }
145
-
146
- const handleDeleteFileView = (index: number) => {
147
- const updatedValue = [...value.value]
148
-
149
- updatedValue.splice(index, 1)
150
- value.value = updatedValue
151
- emits('delete')
152
- }
153
-
154
- const handleError = (index: number, error: any) => {}
155
-
156
- const handleSuccess = (index: number, res: any) => {
157
- value.value = [
158
- {
159
- url: _get(res, props.responseURL),
160
- path: _get(res, props.responsePath),
161
- name: res.name,
162
- size: res.size,
163
- },
164
- ...ArrayHelper.toArray(value.value),
165
- ]
166
-
167
- selectedFiles.value.splice(index, 1)
168
- emits('change', value.value)
169
- emits('success', value.value)
170
- }
171
- </script>
@@ -1,23 +0,0 @@
1
- import { type AxiosRequestConfig } from 'axios';
2
- import { type IFieldProps, type IFileValue, type IFormFieldBase, type INPUT_TYPES } from '../types';
3
- export interface IUploadDropzoneAutoMultipleProps extends IFieldProps {
4
- requestOptions: Omit<AxiosRequestConfig, 'baseURL'> & {
5
- baseURL: string;
6
- };
7
- uploadPathURL?: string;
8
- selectFileLabel?: string;
9
- selectFileSubLabel?: string;
10
- uploadingLabel?: string;
11
- uploadFailedLabel?: string;
12
- retryLabel?: string;
13
- accept?: string[] | string;
14
- bodyKey?: string;
15
- responseURL?: string;
16
- responsePath?: string;
17
- maxSize?: number;
18
- }
19
- export type IUploadDropzoneAutoMultipleField = IFormFieldBase<INPUT_TYPES.UPLOAD_DROPZONE_AUTO_MULTIPLE, IUploadDropzoneAutoMultipleProps, {
20
- change: (value: IFileValue[] | undefined) => void;
21
- success: (res: any) => void;
22
- delete: () => void;
23
- }>;
@@ -1,161 +0,0 @@
1
- <template>
2
- <div :class="[ui.imageItem.wrapper]">
3
- <div v-if="isAddingBtn" class="w-full">
4
- <div :class="[ui.action.addingWrapper]" @click="$emit('add')">
5
- <Icon :name="ui.action.addingIcon" :class="[ui.action.addingBtnClass]" />
6
- <p :class="[ui.action.addingTextClass]">{{ uploadAddLabel }}</p>
7
- </div>
8
- </div>
9
-
10
- <!-- Loading State -->
11
- <div v-if="selectedFile && upload.status.value.isLoading" class="w-full">
12
- <div :class="[ui.imageItem.onLoading.wrapper]">
13
- <div :class="[ui.imageItem.onLoading.percentClass]">{{ percent }}%</div>
14
- <UProgress :value="percent" />
15
- </div>
16
- </div>
17
-
18
- <!-- Success State -->
19
- <div v-if="selectedFile && upload.status.value.isSuccess" class="w-full">
20
- <div :class="[ui.imageItem.onPreview.wrapper]">
21
- <img
22
- :class="[ui.imageItem.onPreview.previewImgClass]"
23
- :src="upload.data.value[responseURL!]"
24
- alt="img"
25
- />
26
- <div :class="[ui.imageItem.onPreview.previewActionWrapper]">
27
- <Icon
28
- title="ลบไฟล์"
29
- :name="ui.action.deleteIcon"
30
- :class="[ui.imageItem.onPreview.actionBtnClass]"
31
- @click="handleDeleteFile"
32
- />
33
- </div>
34
- </div>
35
-
36
- <div :class="[ui.imageItem.onPreview.previewTextWrapper]">
37
- <p :class="[ui.imageItem.onPreview.previewText]">{{ selectedFile.name }}</p>
38
- </div>
39
- </div>
40
-
41
- <!-- Failed State -->
42
- <div v-if="selectedFile && upload.status.value.isError" class="w-full">
43
- <div :class="[ui.imageItem.onFailed.wrapper]">
44
- <img
45
- :class="[ui.imageItem.onFailed.failedImgClass]"
46
- :src="generateURL(selectedFile)"
47
- alt="img"
48
- />
49
- <div :class="[ui.imageItem.onFailed.failedActionWrapper]">
50
- <Icon
51
- title="ลบไฟล์"
52
- :name="ui.action.deleteIcon"
53
- :class="[ui.imageItem.onFailed.actionBtnClass]"
54
- @click="handleDeleteFile"
55
- />
56
- </div>
57
- </div>
58
- </div>
59
- </div>
60
- </template>
61
-
62
- <script lang="ts" setup>
63
- import {
64
- checkFileType,
65
- checkMaxSize,
66
- generateURL,
67
- useFileAllocate,
68
- useFileProgress,
69
- } from '#core/helpers/componentHelper'
70
- import { type uploadFileDropzoneImage } from '#core/ui.config'
71
- import type { IUploadDropzoneImageAutoMultipleProps } from '#core/components/Form/InputUploadDropzoneImageAutoMultiple/types'
72
- import { type IUploadRequest, onMounted, ref, toRef, useUploadLoader, useWatchTrue } from '#imports'
73
- import i18next from 'i18next'
74
-
75
- const emits = defineEmits(['success', 'error', 'delete', 'add'])
76
- const props = defineProps<
77
- {
78
- ui: typeof uploadFileDropzoneImage
79
- selectedFile?: File
80
- isAddingBtn?: boolean
81
- } & IUploadDropzoneImageAutoMultipleProps
82
- >()
83
-
84
- const request: IUploadRequest = {
85
- pathURL: props.uploadPathURL,
86
- requestOptions: props.requestOptions,
87
- }
88
-
89
- const upload = useUploadLoader(request)
90
- const errMsg = ref<string>('')
91
-
92
- const { onUploadProgress, onDownloadProgress, percent } = useFileProgress()
93
- const fileAllocate = useFileAllocate(toRef(props.selectedFile), props)
94
-
95
- const handleDeleteFile = () => {
96
- emits('delete')
97
- }
98
-
99
- const handleCheckFileCondition = (file: File | undefined): boolean => {
100
- if (!file) return false
101
-
102
- const fileType = checkFileType(file, fileAllocate.acceptFile.value ?? '')
103
-
104
- if (!fileType) {
105
- errMsg.value = i18next.t('custom:invalid_file_type')
106
-
107
- return false
108
- }
109
-
110
- const maxSize = checkMaxSize(file, fileAllocate.acceptFileSizeKb.value)
111
-
112
- if (!maxSize) {
113
- if (fileAllocate.isAcceptFileUseMb.value) {
114
- errMsg.value = i18next.t('custom:invalid_file_size_mb', {
115
- size: fileAllocate.acceptFileSizeMb.value,
116
- })
117
- } else {
118
- errMsg.value = i18next.t('custom:invalid_file_size_kb', {
119
- size: fileAllocate.acceptFileSizeKb.value,
120
- })
121
- }
122
-
123
- return false
124
- }
125
-
126
- errMsg.value = ''
127
-
128
- return true
129
- }
130
-
131
- onMounted(() => {
132
- if (props.isAddingBtn) return
133
-
134
- const result = handleCheckFileCondition(props.selectedFile)
135
-
136
- if (result) {
137
- const formData = new FormData()
138
-
139
- formData.append(props.bodyKey!, props.selectedFile!)
140
- upload.run(formData, { data: { onUploadProgress, onDownloadProgress } })
141
- }
142
- })
143
-
144
- useWatchTrue(
145
- () => upload.status.value.isSuccess,
146
- () => {
147
- emits('success', {
148
- ...upload.data.value,
149
- name: props.selectedFile?.name,
150
- size: +(props.selectedFile?.size || 0),
151
- })
152
- }
153
- )
154
-
155
- useWatchTrue(
156
- () => upload.status.value.isError,
157
- () => {
158
- emits('error', upload.status.value.errorData)
159
- }
160
- )
161
- </script>
@@ -1,64 +0,0 @@
1
- <template>
2
- <div :class="[ui.imageItem.wrapper]">
3
- <div class="w-full">
4
- <div :class="[ui.imageItem.onPreview.wrapper]">
5
- <img :class="[ui.imageItem.onPreview.previewImgClass]" :src="selectedFile.url" alt="img" />
6
- <div :class="[ui.imageItem.onPreview.previewActionWrapper]">
7
- <Icon
8
- title="ดูตัวอย่าง"
9
- :name="ui.action.previewIcon"
10
- :class="[ui.imageItem.onPreview.actionBtnClass]"
11
- @click="() => (isPreviewOpen = true)"
12
- />
13
- <Icon
14
- title="ลบไฟล์"
15
- :name="ui.action.deleteIcon"
16
- :class="[ui.imageItem.onPreview.actionBtnClass]"
17
- @click="handleDeleteFile"
18
- />
19
- <Modal v-model="isPreviewOpen" size="xl">
20
- <div class="absolute -top-8 left-0 flex w-full justify-between text-gray-600">
21
- <p v-if="selectedFile?.name">{{ selectedFile?.name }}</p>
22
- <Icon
23
- name="i-heroicons-x-mark"
24
- class="size-6 cursor-pointer hover:text-gray-400"
25
- @click="() => (isPreviewOpen = false)"
26
- />
27
- </div>
28
- <img
29
- :src="selectedFile.url"
30
- alt="image-preview"
31
- class="mx-auto max-w-full rounded-lg"
32
- />
33
- </Modal>
34
- </div>
35
- </div>
36
-
37
- <div :class="[ui.imageItem.onPreview.previewTextWrapper]">
38
- <p :class="[ui.imageItem.onPreview.previewText]">{{ selectedFile.name }}</p>
39
- </div>
40
- </div>
41
- </div>
42
- </template>
43
-
44
- <script lang="ts" setup>
45
- import { type uploadFileDropzoneImage } from '#core/ui.config'
46
- import type { IUploadDropzoneImageAutoMultipleProps } from '#core/components/Form/InputUploadDropzoneImageAutoMultiple/types'
47
- import { ref } from '#imports'
48
- import type { IFileValue } from '#core/components/Form/types'
49
-
50
- const emits = defineEmits(['delete'])
51
-
52
- defineProps<
53
- {
54
- ui: typeof uploadFileDropzoneImage
55
- selectedFile: IFileValue
56
- } & IUploadDropzoneImageAutoMultipleProps
57
- >()
58
-
59
- const isPreviewOpen = ref<boolean>(false)
60
-
61
- const handleDeleteFile = () => {
62
- emits('delete')
63
- }
64
- </script>