@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,141 +0,0 @@
1
- <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div
4
- :class="[
5
- ui.base,
6
- ui.border,
7
- ui.shadow,
8
- ui.padding,
9
- {
10
- [ui.stages.default]: !wrapperProps.errorMessage,
11
- [ui.stages.error]: wrapperProps.errorMessage,
12
- },
13
- ]"
14
- >
15
- <p
16
- v-if="wrapperProps.placeholder && !innerValue && (!value || value.length === 0)"
17
- :class="[ui.placeholder]"
18
- @click="focusInput"
19
- >
20
- {{ wrapperProps.placeholder }}
21
- </p>
22
- <div :class="[ui.innerWrapper]">
23
- <Badge
24
- v-for="(text, index) in value"
25
- :key="index"
26
- :size="ui.tag.size || (ui.default.tag.size as any)"
27
- :color="ui.tag.color || (ui.default.tag.color as any)"
28
- :variant="ui.tag.variant || (ui.default.tag.variant as any)"
29
- :ui="badgeUi"
30
- >
31
- <div class="flex items-center gap-x-0.5">
32
- {{ tagPrefix + text }}
33
- <Icon name="ph:x" class="size-3 cursor-pointer" @click="onClickDelete(index)" />
34
- </div>
35
- </Badge>
36
- <input
37
- ref="inputRef"
38
- v-model="innerValue"
39
- :class="[ui.input]"
40
- :disabled="wrapperProps.isDisabled"
41
- :name="name"
42
- :readonly="isReadonly"
43
- :autofocus="!!autoFocus"
44
- @blur="onBlur"
45
- @keyup.delete="onDelete"
46
- @keyup.enter="onEnter"
47
- @keyup.space="onSpace"
48
- />
49
- </div>
50
- </div>
51
- </FieldWrapper>
52
- </template>
53
-
54
- <script lang="ts" setup>
55
- import { ref, toRef, useUI, useUiConfig } from '#imports'
56
- import { type ITagsFieldProps } from '#core/components/Form/InputTags/types'
57
- import { tags } from '#core/ui.config'
58
- import { useFieldHOC } from '#core/composables/useForm'
59
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
60
-
61
- const config = useUiConfig<typeof tags>(tags, 'tags')
62
-
63
- const props = withDefaults(defineProps<ITagsFieldProps>(), {
64
- tagPrefix: '#',
65
- })
66
-
67
- const emits = defineEmits(['change', 'blur'])
68
-
69
- const { value, wrapperProps } = useFieldHOC<string[]>(props)
70
-
71
- const { ui } = useUI('tags', toRef(props, 'ui'), config)
72
-
73
- const inputRef = ref<HTMLInputElement | null>(null)
74
- const innerValue = ref<string>('')
75
- const backspaceCount = ref<number>(0)
76
-
77
- const operateValue = (input: string) => {
78
- const tagSet = splitBySpace(input)
79
-
80
- if (value.value && value.value.length > 0) {
81
- value.value = [...value.value, ...tagSet]
82
- } else {
83
- value.value = tagSet
84
- }
85
-
86
- innerValue.value = ''
87
-
88
- emits('change', value.value)
89
- }
90
-
91
- const onBlur = (e: FocusEvent) => {
92
- const eventValue = e.target as HTMLInputElement
93
-
94
- if (!eventValue.value || eventValue.value === '') return
95
-
96
- operateValue(eventValue.value)
97
-
98
- emits('blur', eventValue.value)
99
- }
100
-
101
- const onDelete = (e: KeyboardEvent) => {
102
- if (e.key === 'Backspace') {
103
- if (innerValue.value === '') {
104
- backspaceCount.value += 1
105
- } else {
106
- backspaceCount.value = 0
107
- }
108
-
109
- if (backspaceCount.value >= 2 && value.value.length > 0) {
110
- value.value = value.value.slice(0, value.value.length - 1)
111
- backspaceCount.value = 0
112
- }
113
- }
114
- }
115
-
116
- const onClickDelete = (index: number) => {
117
- value.value = value.value.filter((_, i) => i !== index)
118
- }
119
-
120
- const onEnter = (e: KeyboardEvent) => {
121
- if (e.key === 'Enter') {
122
- operateValue(innerValue.value)
123
- }
124
- }
125
-
126
- const onSpace = (e: KeyboardEvent) => {
127
- if (e.key === ' ') {
128
- operateValue(innerValue.value)
129
- }
130
- }
131
-
132
- const splitBySpace = (input: string): string[] => {
133
- const spited = input.split(' ')
134
-
135
- return spited.filter((item) => item !== '')
136
- }
137
-
138
- const focusInput = () => {
139
- inputRef.value?.focus()
140
- }
141
- </script>
@@ -1,11 +0,0 @@
1
- import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '#core/components/Form/types';
2
- export interface ITagsFieldProps extends IFieldProps {
3
- leadingIcon?: string;
4
- trailingIcon?: string;
5
- tagPrefix?: string;
6
- badgeUi?: object | any;
7
- }
8
- export type ITagsField = IFormFieldBase<INPUT_TYPES.TAGS, ITagsFieldProps, {
9
- change?: (value: string[]) => void;
10
- blur?: (value: string) => void;
11
- }>;
@@ -1,206 +0,0 @@
1
- <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <div
4
- ref="dropzoneRef"
5
- :class="[
6
- ui.base,
7
- {
8
- [ui.disabled]: isDisabled,
9
- [ui.background.default]: !isOverDropZone && !isDisabled,
10
- [ui.background.dragover]: isOverDropZone && !isDisabled,
11
- },
12
- ]"
13
- >
14
- <input
15
- ref="fileInputRef"
16
- type="file"
17
- class="hidden"
18
- :name="name"
19
- :accept="acceptFile"
20
- :disabled="isDisabled"
21
- @change="handleChange"
22
- />
23
- <div :class="[ui.wrapper]">
24
- <div v-if="!selectedFile" :class="[ui.placeholderWrapper]">
25
- <Icon :name="ui.default.uploadIcon" :class="[ui.labelIcon]" />
26
- <div :class="[ui.labelWrapper]">
27
- <p class="text-primary cursor-pointer" @click="handleOpenFile">
28
- {{ selectFileLabel }}
29
- </p>
30
- <p>{{ selectFileSubLabel }}</p>
31
- </div>
32
- <p v-if="placeholder" :class="[ui.placeholder]">{{ placeholder }}</p>
33
- </div>
34
-
35
- <!-- Selected State -->
36
- <div v-if="selectedFile" :class="[ui.onPreview.wrapper]">
37
- <div :class="[ui.onPreview.previewImgWrapper]">
38
- <div v-if="isImage(selectedFile)" class="size-full overflow-hidden">
39
- <img
40
- :src="generateURL(selectedFile)"
41
- :class="[ui.onPreview.previewImgClass]"
42
- alt="image-preview"
43
- />
44
- </div>
45
- <div v-else>
46
- <Icon
47
- :name="ui.onPreview.previewFileIcon || ui.default.filePreviewIcon"
48
- :class="[ui.onPreview.previewFileClass]"
49
- />
50
- </div>
51
- </div>
52
- <div :class="[ui.onPreview.textWrapper]">
53
- <div class="truncate">
54
- <h1 class="truncate font-bold">{{ selectedFile?.name }}</h1>
55
- <p class="truncate font-light text-gray-400">
56
- {{
57
- fileAllocate.isSelectedFileUseMb.value
58
- ? `${fileAllocate.selectedFileSizeMb.value} MB`
59
- : `${fileAllocate.selectedFileSizeKb.value} KB`
60
- }}
61
- </p>
62
- </div>
63
- <div :class="[ui.action.wrapper]">
64
- <Icon
65
- v-if="isImage(selectedFile)"
66
- :name="ui.action.previewIcon"
67
- :class="[ui.action.iconClass]"
68
- @click="() => (isPreviewOpen = true)"
69
- />
70
- <Icon
71
- :name="ui.action.downloadIcon"
72
- :class="[ui.action.iconClass]"
73
- @click="handleDownloadFile"
74
- />
75
- <Icon
76
- :name="ui.action.deleteIcon"
77
- :class="[ui.action.iconClass]"
78
- @click="handleDeleteFile"
79
- />
80
- <Modal v-model="isPreviewOpen" :title="selectedFile?.name">
81
- <img :src="generateURL(selectedFile)" alt="image-preview" />
82
- </Modal>
83
- </div>
84
- </div>
85
- </div>
86
- </div>
87
- </div>
88
- </FieldWrapper>
89
- </template>
90
-
91
- <script lang="ts" setup>
92
- import { useDropZone } from '@vueuse/core'
93
- import { type IUploadDropzoneProps } from './types'
94
- import {
95
- isImage,
96
- generateURL,
97
- checkMaxSize,
98
- checkFileType,
99
- downloadFileFromURL,
100
- useFileAllocate,
101
- } from '#core/helpers/componentHelper'
102
- import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
103
- import { useFieldHOC } from '#core/composables/useForm'
104
- import { computed, ref, toRef, useUI, useUiConfig } from '#imports'
105
- import { uploadFileDropzone } from '#core/ui.config'
106
- import i18next from 'i18next'
107
-
108
- const config = useUiConfig<typeof uploadFileDropzone>(uploadFileDropzone, 'uploadFileDropzone')
109
-
110
- const props = withDefaults(defineProps<IUploadDropzoneProps>(), {
111
- selectFileLabel: 'คลิกเพื่อเลือกไฟล์',
112
- selectFileSubLabel: 'หรือ ลากและวางที่นี่',
113
- })
114
-
115
- const emit = defineEmits(['change', 'delete'])
116
- const isPreviewOpen = ref<boolean>(false)
117
-
118
- const { wrapperProps, handleChange: onChange, setErrors, value } = useFieldHOC<File>(props)
119
-
120
- const { ui } = useUI('uploadFileDropzone', toRef(props, 'ui'), config)
121
-
122
- const fileInputRef = ref<HTMLInputElement>()
123
- const dropzoneRef = ref<HTMLDivElement>()
124
-
125
- const acceptFile = computed(() =>
126
- typeof props.accept === 'string' ? props.accept : props.accept?.join(',')
127
- )
128
-
129
- const selectedFile = computed(() => value?.value)
130
- const fileAllocate = useFileAllocate(selectedFile, props)
131
-
132
- const onDrop = (files: File[] | null) => {
133
- if (props.isDisabled || files?.length === 0 || !files) return
134
-
135
- const file = files[0]
136
- const result = handleCheckFileCondition(file)
137
-
138
- if (result) {
139
- onChange(file)
140
- emit('change', file)
141
- }
142
- }
143
-
144
- const { isOverDropZone } = useDropZone(dropzoneRef as unknown as HTMLElement, {
145
- onDrop,
146
- })
147
-
148
- const handleChange = (e: Event) => {
149
- if (props.isDisabled) return
150
-
151
- const file = (e.target as HTMLInputElement).files?.[0]
152
- const result = handleCheckFileCondition(file)
153
-
154
- if (result && file) {
155
- onChange(file)
156
- value.value = file
157
- emit('change', file)
158
- }
159
- }
160
-
161
- const handleOpenFile = () => {
162
- fileInputRef.value?.click()
163
- }
164
-
165
- const handleDeleteFile = () => {
166
- fileInputRef.value?.value && (fileInputRef.value.value = '')
167
- onChange(undefined)
168
- emit('delete')
169
- }
170
-
171
- const handleDownloadFile = () => {
172
- downloadFileFromURL(generateURL(selectedFile.value), selectedFile.value?.name)
173
- }
174
-
175
- const handleCheckFileCondition = (file: File | undefined): boolean => {
176
- if (!file) return false
177
-
178
- const fileType = checkFileType(file, acceptFile.value ?? '')
179
-
180
- if (!fileType) {
181
- setErrors(i18next.t('custom:invalid_file_type'))
182
-
183
- return false
184
- }
185
-
186
- const maxSize = checkMaxSize(file, fileAllocate.acceptFileSizeKb.value)
187
-
188
- if (!maxSize) {
189
- if (fileAllocate.isAcceptFileUseMb.value) {
190
- setErrors(
191
- i18next.t('custom:invalid_file_size_mb', { size: fileAllocate.acceptFileSizeMb.value })
192
- )
193
- } else {
194
- setErrors(
195
- i18next.t('custom:invalid_file_size_kb', { size: fileAllocate.acceptFileSizeKb.value })
196
- )
197
- }
198
-
199
- return false
200
- }
201
-
202
- setErrors('')
203
-
204
- return true
205
- }
206
- </script>
@@ -1,11 +0,0 @@
1
- import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '../types';
2
- export interface IUploadDropzoneProps extends IFieldProps {
3
- selectFileLabel?: string;
4
- selectFileSubLabel?: string;
5
- accept?: string[] | string;
6
- maxSize?: number;
7
- }
8
- export type IUploadDropzoneField = IFormFieldBase<INPUT_TYPES.UPLOAD_DROPZONE, IUploadDropzoneProps, {
9
- change: (value: File | undefined) => void;
10
- delete: () => void;
11
- }>;