@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,219 +0,0 @@
1
- <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div :class="[ui.base]">
4
- <input
5
- ref="fileInputRef"
6
- type="file"
7
- class="hidden"
8
- :name="name"
9
- :accept="acceptFile"
10
- :disabled="isDisabled"
11
- @change="handleChange"
12
- />
13
-
14
- <div :class="[ui.imageItem.wrapper]">
15
- <div v-if="!selectedFile && !value" class="w-full">
16
- <div :class="[ui.action.addingWrapper]" @click="handleOpenFile">
17
- <Icon :name="ui.action.addingIcon" :class="[ui.action.addingBtnClass]" />
18
- <p :class="[ui.action.addingTextClass]">{{ uploadAddLabel }}</p>
19
- </div>
20
- </div>
21
-
22
- <!-- Loading State -->
23
- <div v-if="selectedFile && upload.status.value.isLoading" class="w-full">
24
- <div :class="[ui.imageItem.onLoading.wrapper]">
25
- <div :class="[ui.imageItem.onLoading.percentClass]">{{ percent }}%</div>
26
- <UProgress :value="percent" />
27
- </div>
28
- </div>
29
-
30
- <!-- Success State -->
31
- <div v-if="(selectedFile && upload.status.value.isSuccess) || value" class="w-full">
32
- <div :class="[ui.imageItem.onPreview.wrapper]">
33
- <img :class="[ui.imageItem.onPreview.previewImgClass]" :src="value?.url" alt="img" />
34
- <div :class="[ui.imageItem.onPreview.previewActionWrapper]">
35
- <Icon
36
- title="ดูตัวอย่าง"
37
- :name="ui.action.previewIcon"
38
- :class="[ui.imageItem.onPreview.actionBtnClass]"
39
- @click="() => (isPreviewOpen = true)"
40
- />
41
- <Icon
42
- title="ลบไฟล์"
43
- :name="ui.action.deleteIcon"
44
- :class="[ui.imageItem.onPreview.actionBtnClass]"
45
- @click="handleDeleteFile"
46
- />
47
- <Modal v-model="isPreviewOpen" size="xl">
48
- <div class="absolute -top-8 left-0 flex w-full justify-between text-gray-600">
49
- <p>{{ selectedFile?.name }}</p>
50
- <Icon
51
- name="i-heroicons-x-mark"
52
- class="size-6 cursor-pointer hover:text-gray-400"
53
- @click="() => (isPreviewOpen = false)"
54
- />
55
- </div>
56
- <img :src="value?.url" alt="img-preview" class="w-full rounded-lg" />
57
- </Modal>
58
- </div>
59
- </div>
60
-
61
- <div v-if="selectedFile" :class="[ui.imageItem.onPreview.previewTextWrapper]">
62
- <p :class="[ui.imageItem.onPreview.previewText]">{{ selectedFile.name }}</p>
63
- </div>
64
- </div>
65
-
66
- <!-- Failed State -->
67
- <div v-if="selectedFile && upload.status.value.isError" class="w-full">
68
- <div :class="[ui.imageItem.onFailed.wrapper]">
69
- <img
70
- :class="[ui.imageItem.onFailed.failedImgClass]"
71
- :src="generateURL(selectedFile)"
72
- alt="img"
73
- />
74
- <div :class="[ui.imageItem.onFailed.failedActionWrapper]">
75
- <Icon
76
- title="ลบไฟล์"
77
- :name="ui.action.deleteIcon"
78
- :class="[ui.imageItem.onFailed.actionBtnClass]"
79
- @click="handleDeleteFile"
80
- />
81
- </div>
82
- </div>
83
- </div>
84
- </div>
85
- </div>
86
- </FieldWrapper>
87
- </template>
88
-
89
- <script lang="ts" setup>
90
- import { type IUploadImageAutoProps } from './types'
91
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
92
- import { useFieldHOC } from '#core/composables/useForm'
93
- import {
94
- computed,
95
- ref,
96
- toRef,
97
- useUI,
98
- useUiConfig,
99
- useWatchTrue,
100
- useUploadLoader,
101
- _get,
102
- type IUploadRequest,
103
- } from '#imports'
104
- import { uploadImage } from '#core/ui.config'
105
- import {
106
- checkMaxSize,
107
- generateURL,
108
- useFileAllocate,
109
- useFileProgress,
110
- } from '#core/helpers/componentHelper'
111
- import type { IFileValue } from '#core/components/Form/types'
112
- import i18next from 'i18next'
113
-
114
- const config = useUiConfig<typeof uploadImage>(uploadImage, 'uploadImage')
115
-
116
- const props = withDefaults(defineProps<IUploadImageAutoProps>(), {
117
- accept: 'image/*',
118
- bodyKey: 'file',
119
- responseURL: 'url',
120
- responsePath: 'path',
121
- uploadAddLabel: 'อัพโหลด',
122
- })
123
-
124
- const emits = defineEmits(['change', 'success', 'delete', 'error'])
125
-
126
- const request: IUploadRequest = {
127
- pathURL: props.uploadPathURL,
128
- requestOptions: props.requestOptions,
129
- }
130
-
131
- const selectedFile = ref<File>()
132
- const isPreviewOpen = ref<boolean>(false)
133
-
134
- const { wrapperProps, value, errorMessage } = useFieldHOC<IFileValue | undefined>(props)
135
-
136
- const upload = useUploadLoader(request)
137
- const { ui } = useUI('uploadImage', toRef(props, 'ui'), config)
138
-
139
- const fileInputRef = ref<HTMLInputElement | null>()
140
-
141
- const fileAllocate = useFileAllocate(toRef(selectedFile), props)
142
- const { onUploadProgress, onDownloadProgress, percent } = useFileProgress()
143
- const acceptFile = computed(() =>
144
- typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
145
- )
146
-
147
- const handleChange = (e: Event) => {
148
- if (props.isDisabled) return
149
-
150
- const file = (e.target as HTMLInputElement).files?.[0]
151
- const result = handleCheckFileCondition(file)
152
-
153
- if (result && file) {
154
- selectedFile.value = file
155
- emits('change', selectedFile.value)
156
- const formData = new FormData()
157
-
158
- formData.append(props.bodyKey, file)
159
- upload.run(formData, { data: { onUploadProgress, onDownloadProgress } })
160
- }
161
- }
162
-
163
- const handleCheckFileCondition = (file: File | undefined): boolean => {
164
- if (!file) return false
165
- const maxSize = checkMaxSize(file, fileAllocate.acceptFileSizeKb.value)
166
-
167
- if (!maxSize) {
168
- if (fileAllocate.isAcceptFileUseMb.value) {
169
- errorMessage.value = i18next.t('custom:invalid_file_size_mb', {
170
- size: fileAllocate.acceptFileSizeMb.value,
171
- })
172
- } else {
173
- errorMessage.value = i18next.t('custom:invalid_file_size_kb', {
174
- size: fileAllocate.acceptFileSizeKb.value,
175
- })
176
- }
177
-
178
- return false
179
- }
180
-
181
- errorMessage.value = ''
182
-
183
- return true
184
- }
185
-
186
- const handleOpenFile = () => {
187
- fileInputRef.value?.click()
188
- }
189
-
190
- const handleDeleteFile = () => {
191
- fileInputRef.value!.value = ''
192
- selectedFile.value = undefined
193
- value.value = undefined
194
- emits('change', undefined)
195
-
196
- emits('delete')
197
- }
198
-
199
- useWatchTrue(
200
- () => upload.status.value.isSuccess,
201
- () => {
202
- value.value = {
203
- url: _get(upload.data.value, props.responseURL),
204
- path: _get(upload.data.value, props.responsePath),
205
- name: upload.data.value.name,
206
- size: upload.data.value.size,
207
- }
208
-
209
- emits('success', value.value)
210
- }
211
- )
212
-
213
- useWatchTrue(
214
- () => upload.status.value.isError,
215
- () => {
216
- emits('error', upload.status.value.errorData)
217
- }
218
- )
219
- </script>
@@ -1,20 +0,0 @@
1
- import { type AxiosRequestConfig } from 'axios';
2
- import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '../types';
3
- export interface IUploadImageAutoProps extends IFieldProps {
4
- requestOptions: Omit<AxiosRequestConfig, 'baseURL'> & {
5
- baseURL: string;
6
- };
7
- uploadPathURL?: string;
8
- uploadAddLabel?: string;
9
- accept?: string[] | string;
10
- bodyKey?: string;
11
- responseURL?: string;
12
- responsePath?: string;
13
- maxSize?: number;
14
- }
15
- export type IUploadImageAutoField = IFormFieldBase<INPUT_TYPES.UPLOAD_IMAGE_AUTO, IUploadImageAutoProps, {
16
- change: (value: File | undefined) => void;
17
- success: (res: any) => void;
18
- delete: () => void;
19
- error: (err: any) => void;
20
- }>;
@@ -1,55 +0,0 @@
1
- <template>
2
- <FormFields :options="formFields" :form="form" />
3
- </template>
4
- <script lang="ts" setup>
5
- import { toTypedSchema, useForm, createFormFields, watch } from '#imports'
6
- import * as z from 'zod'
7
- import { INPUT_TYPES } from '#core/components/Form/types'
8
- import type { IWYSIWYGFieldProps } from '#core/components/Form/InputWYSIWYG/types'
9
-
10
- const emits = defineEmits(['submit'])
11
- const props = defineProps<{
12
- options: IWYSIWYGFieldProps['image']
13
- }>()
14
-
15
- const form = useForm({
16
- validationSchema: toTypedSchema(
17
- z.object({
18
- file: z
19
- .object({
20
- url: z.string(),
21
- path: z.string().optional(),
22
- name: z.string().optional(),
23
- size: z.string().optional(),
24
- })
25
- .optional()
26
- .nullable(),
27
- })
28
- ),
29
- initialValues: {
30
- file: null,
31
- },
32
- })
33
-
34
- const formFields = createFormFields(() => [
35
- {
36
- type: INPUT_TYPES.UPLOAD_IMAGE_AUTO,
37
- props: {
38
- name: 'file',
39
- ...((props.options || {}) as any),
40
- },
41
- },
42
- ])
43
-
44
- watch(
45
- () => form.values,
46
- () => {
47
- if (form.values.file?.url) {
48
- emits('submit', form.values.file?.url)
49
- }
50
- },
51
- {
52
- deep: true,
53
- }
54
- )
55
- </script>
@@ -1,230 +0,0 @@
1
- <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Modal v-model="isShowUploadImageModal" title="อัพโหลดรูปภาพ">
4
- <UploadImageForm :options="image" @submit="onImageSubmit" />
5
- </Modal>
6
- <ClientOnly>
7
- <div
8
- class="form-textarea focus:ring-primary-500 dark:focus:ring-primary-400 relative block w-full resize-none rounded-md border-0 bg-white p-0 pb-3 text-sm text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-75 dark:bg-gray-900 dark:text-white dark:ring-gray-700 dark:placeholder:text-gray-500"
9
- >
10
- <div class="tiptap-menu-bar">
11
- <div
12
- v-for="(items, index) in menuItems"
13
- :key="index"
14
- class="flex items-center border-r border-gray-200 pr-2"
15
- >
16
- <button
17
- v-for="item in items"
18
- :key="item.name"
19
- :class="{ 'is-active': item.isActive?.() }"
20
- class="menu-item"
21
- type="button"
22
- :title="item.title"
23
- @click="item.action"
24
- >
25
- <Icon :name="item.icon" class="size-5" />
26
- </button>
27
- </div>
28
- </div>
29
- <EditorContent
30
- :editor="editor"
31
- :placeholder="placeholder ?? label"
32
- :autofocus="autoFocus"
33
- :disabled="isDisabled || isReadonly"
34
- :name="name"
35
- />
36
- </div>
37
- </ClientOnly>
38
- </FieldWrapper>
39
- </template>
40
- <script lang="ts" setup>
41
- import { useFieldHOC } from '#core/composables/useForm'
42
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
43
- import { EditorContent, useEditor } from '@tiptap/vue-3'
44
- import type { IWYSIWYGFieldProps } from '#core/components/Form/InputWYSIWYG/types'
45
- import StarterKit from '@tiptap/starter-kit'
46
- import Underline from '@tiptap/extension-underline'
47
- import TextAlign from '@tiptap/extension-text-align'
48
- import Link from '@tiptap/extension-link'
49
- import Image from '@tiptap/extension-image'
50
- import Youtube from '@tiptap/extension-youtube'
51
- import { computed, watch, ref } from 'vue'
52
- import UploadImageForm from '#core/components/Form/InputWYSIWYG/UploadImageForm.vue'
53
-
54
- const props = withDefaults(defineProps<IWYSIWYGFieldProps>(), {})
55
- const { value, wrapperProps } = useFieldHOC<string>(props)
56
- const isShowUploadImageModal = ref(false)
57
- const editor = useEditor({
58
- content: value.value,
59
- extensions: [
60
- StarterKit,
61
- Underline,
62
- TextAlign.configure({
63
- types: ['heading', 'paragraph'],
64
- }),
65
- Link.configure({
66
- openOnClick: false,
67
- }),
68
- Image,
69
- Youtube,
70
- ],
71
- editorProps: {
72
- attributes: {
73
- class: 'prose m-4 focus:outline-none',
74
- },
75
- },
76
- onUpdate: ({ editor }) => {
77
- value.value = editor.getHTML()
78
- },
79
- })
80
-
81
- watch(value, (newValue) => {
82
- if (editor.value && newValue !== editor.value.getHTML()) {
83
- editor.value.commands.setContent(newValue)
84
- }
85
- })
86
-
87
- const menuItems = computed(() => [
88
- [
89
- {
90
- name: 'bold',
91
- icon: 'ph:text-b-bold',
92
- action: () => editor.value!.chain().focus().toggleBold().run(),
93
- isActive: () => editor.value!.isActive('bold'),
94
- title: 'Bold',
95
- },
96
- {
97
- name: 'italic',
98
- icon: 'ph:text-italic',
99
- action: () => editor.value!.chain().focus().toggleItalic().run(),
100
- isActive: () => editor.value!.isActive('italic'),
101
- title: 'Italic',
102
- },
103
- {
104
- name: 'underline',
105
- icon: 'ph:text-underline',
106
- action: () => editor.value!.chain().focus().toggleUnderline().run(),
107
- isActive: () => editor.value!.isActive('underline'),
108
- title: 'Underline',
109
- },
110
- ],
111
- [
112
- {
113
- name: 'bullet-list',
114
- icon: 'ph:list-bullets',
115
- action: () => editor.value!.chain().focus().toggleBulletList().run(),
116
- isActive: () => editor.value!.isActive('bulletList'),
117
- title: 'Bullet List',
118
- },
119
- {
120
- name: 'ordered-list',
121
- icon: 'ph:list-numbers',
122
- action: () => editor.value!.chain().focus().toggleOrderedList().run(),
123
- isActive: () => editor.value!.isActive('orderedList'),
124
- title: 'Ordered List',
125
- },
126
- ],
127
- [
128
- {
129
- name: 'align-left',
130
- icon: 'ph:text-align-left',
131
- action: () => editor.value!.chain().focus().setTextAlign('left').run(),
132
- isActive: () => editor.value!.isActive({ textAlign: 'left' }),
133
- title: 'Align Left',
134
- },
135
- {
136
- name: 'align-center',
137
- icon: 'ph:text-align-center',
138
- action: () => editor.value!.chain().focus().setTextAlign('center').run(),
139
- isActive: () => editor.value!.isActive({ textAlign: 'center' }),
140
- title: 'Align Center',
141
- },
142
- {
143
- name: 'align-right',
144
- icon: 'ph:text-align-right',
145
- action: () => editor.value!.chain().focus().setTextAlign('right').run(),
146
- isActive: () => editor.value!.isActive({ textAlign: 'right' }),
147
- title: 'Align Right',
148
- },
149
- ],
150
- [
151
- {
152
- name: 'link',
153
- icon: 'ph:link-simple',
154
- action: () => {
155
- const url = window.prompt('URL')
156
-
157
- if (url) {
158
- editor.value!.chain().focus().setLink({ href: url }).run()
159
- }
160
- },
161
- isActive: () => editor.value!.isActive('link'),
162
- title: 'Insert Link',
163
- },
164
- {
165
- name: 'image',
166
- icon: 'ph:image',
167
- action: () => {
168
- if (props.image?.requestOptions) {
169
- isShowUploadImageModal.value = true
170
- } else {
171
- const url = window.prompt('Image URL')
172
-
173
- if (url) {
174
- editor.value!.chain().focus().setImage({ src: url }).run()
175
- }
176
- }
177
- },
178
- title: 'Insert Image',
179
- },
180
- {
181
- name: 'video',
182
- icon: 'ph:video-camera',
183
- action: () => {
184
- const url = window.prompt('Video URL')
185
-
186
- if (url) {
187
- editor.value!.chain().focus().setYoutubeVideo({ src: url }).run()
188
- }
189
- },
190
- title: 'Insert Video',
191
- },
192
- ],
193
- [
194
- {
195
- name: 'hardBreak',
196
- icon: 'ri:text-wrap',
197
- action: () => editor.value!.chain().focus().setHardBreak().run(),
198
- title: 'Hard Break',
199
- },
200
- {
201
- name: 'clear',
202
- icon: 'ri:format-clear',
203
- action: () => editor.value!.chain().focus().clearNodes().unsetAllMarks().run(),
204
- title: 'Clear',
205
- },
206
- ],
207
- [
208
- {
209
- name: 'undo',
210
- icon: 'ph:arrow-counter-clockwise',
211
- action: () => editor.value!.chain().focus().undo().run(),
212
- title: 'Undo',
213
- },
214
- {
215
- name: 'redo',
216
- icon: 'ph:arrow-clockwise',
217
- action: () => editor.value!.chain().focus().redo().run(),
218
- title: 'Redo',
219
- },
220
- ],
221
- ])
222
-
223
- const onImageSubmit = (url: string) => {
224
- editor.value!.chain().focus().setImage({ src: url }).run()
225
- isShowUploadImageModal.value = false
226
- }
227
- </script>
228
- <style>
229
- .tiptap-menu-bar{@apply flex flex-wrap border-b py-2 px-2 gap-1}.menu-item{@apply px-1 py-1 rounded hover:bg-gray-100 transition-colors flex justify-center items-center}.menu-item.is-active{@apply bg-primary-100 text-primary-600}
230
- </style>
@@ -1,19 +0,0 @@
1
- import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '#core/components/Form/types';
2
- import type { AxiosRequestConfig } from 'axios';
3
- export interface IWYSIWYGFieldProps extends IFieldProps {
4
- image?: {
5
- requestOptions?: Omit<AxiosRequestConfig, 'baseURL'> & {
6
- baseURL: string;
7
- };
8
- uploadPathURL?: string;
9
- uploadAddLabel?: string;
10
- accept?: string[] | string;
11
- bodyKey?: string;
12
- responseURL?: string;
13
- responsePath?: string;
14
- maxSize?: number;
15
- };
16
- }
17
- export type IWYSIWYGField = IFormFieldBase<INPUT_TYPES.WYSIWYG, IWYSIWYGFieldProps, {
18
- change?: (value: string) => void;
19
- }>;
@@ -1,23 +0,0 @@
1
- <template>
2
- <UIcon :name="name" :dynamic="dynamicValue" />
3
- </template>
4
-
5
- <script lang="ts" setup>
6
- import { computed, useUiConfig } from '#imports'
7
- import { icon } from '#core/ui.config'
8
-
9
- const props = defineProps({
10
- name: {
11
- type: String,
12
- required: true,
13
- },
14
- dynamic: {
15
- type: Boolean,
16
- default: false,
17
- },
18
- })
19
-
20
- const config = useUiConfig<typeof icon>(icon, 'icon')
21
-
22
- const dynamicValue = computed(() => props.dynamic || config.dynamic)
23
- </script>
@@ -1,22 +0,0 @@
1
- <template>
2
- <TeleportSafe v-if="isDevEnv" to="#dev-logs">
3
- <LogItem v-if="typeof data !== 'undefined'" :data="data" :title="title" />
4
- <LogItem
5
- v-for="(item, index) in dataItems"
6
- :key="index"
7
- :data="item"
8
- :title="`${title} #${index + 1}`"
9
- />
10
- </TeleportSafe>
11
- </template>
12
- <script lang="ts" setup>
13
- import LogItem from './LogItem.vue'
14
-
15
- defineProps<{
16
- data?: any
17
- dataItems?: any[]
18
- title?: string
19
- }>()
20
-
21
- const isDevEnv = process.env.NODE_ENV === 'development'
22
- </script>