@ramathibodi/nuxt-commons 0.1.73 → 4.0.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 (260) hide show
  1. package/README.md +81 -55
  2. package/dist/module.json +4 -4
  3. package/dist/module.mjs +5 -4
  4. package/dist/runtime/bridges/authentication.d.ts +21 -0
  5. package/dist/runtime/bridges/authentication.js +20 -0
  6. package/dist/runtime/bridges/graphql.d.ts +17 -0
  7. package/dist/runtime/bridges/graphql.js +45 -0
  8. package/dist/runtime/components/Alert.d.vue.ts +3 -0
  9. package/dist/runtime/components/Alert.vue +17 -22
  10. package/dist/runtime/components/Alert.vue.d.ts +3 -0
  11. package/dist/runtime/components/BarcodeReader.d.vue.ts +9 -0
  12. package/dist/runtime/components/BarcodeReader.vue +56 -73
  13. package/dist/runtime/components/BarcodeReader.vue.d.ts +9 -0
  14. package/dist/runtime/components/ExportCSV.d.vue.ts +55 -0
  15. package/dist/runtime/components/ExportCSV.vue +39 -68
  16. package/dist/runtime/components/ExportCSV.vue.d.ts +55 -0
  17. package/dist/runtime/components/FileBtn.d.vue.ts +53 -0
  18. package/dist/runtime/components/FileBtn.vue +23 -38
  19. package/dist/runtime/components/FileBtn.vue.d.ts +53 -0
  20. package/dist/runtime/components/ImportCSV.d.vue.ts +52 -0
  21. package/dist/runtime/components/ImportCSV.vue +60 -99
  22. package/dist/runtime/components/ImportCSV.vue.d.ts +52 -0
  23. package/dist/runtime/components/MrzReader.d.vue.ts +19 -0
  24. package/dist/runtime/components/MrzReader.vue +128 -0
  25. package/dist/runtime/components/MrzReader.vue.d.ts +19 -0
  26. package/dist/runtime/components/SplitterPanel.d.vue.ts +15 -0
  27. package/dist/runtime/components/SplitterPanel.vue +18 -27
  28. package/dist/runtime/components/SplitterPanel.vue.d.ts +15 -0
  29. package/dist/runtime/components/TabsGroup.d.vue.ts +19 -0
  30. package/dist/runtime/components/TabsGroup.vue +8 -12
  31. package/dist/runtime/components/TabsGroup.vue.d.ts +19 -0
  32. package/dist/runtime/components/TextBarcode.d.vue.ts +12 -0
  33. package/dist/runtime/components/TextBarcode.vue +22 -33
  34. package/dist/runtime/components/TextBarcode.vue.d.ts +12 -0
  35. package/dist/runtime/components/device/IdCardButton.d.vue.ts +57 -0
  36. package/dist/runtime/components/device/IdCardButton.vue +30 -55
  37. package/dist/runtime/components/device/IdCardButton.vue.d.ts +57 -0
  38. package/dist/runtime/components/device/IdCardWebSocket.d.vue.ts +55 -0
  39. package/dist/runtime/components/device/IdCardWebSocket.vue +104 -153
  40. package/dist/runtime/components/device/IdCardWebSocket.vue.d.ts +55 -0
  41. package/dist/runtime/components/device/Scanner.d.vue.ts +66 -0
  42. package/dist/runtime/components/device/Scanner.vue +97 -166
  43. package/dist/runtime/components/device/Scanner.vue.d.ts +66 -0
  44. package/dist/runtime/components/dialog/Confirm.d.vue.ts +37 -0
  45. package/dist/runtime/components/dialog/Confirm.vue +30 -47
  46. package/dist/runtime/components/dialog/Confirm.vue.d.ts +37 -0
  47. package/dist/runtime/components/dialog/Host.d.vue.ts +9 -0
  48. package/dist/runtime/components/dialog/Host.vue +34 -53
  49. package/dist/runtime/components/dialog/Host.vue.d.ts +9 -0
  50. package/dist/runtime/components/dialog/Index.d.vue.ts +24 -0
  51. package/dist/runtime/components/dialog/Index.vue +20 -28
  52. package/dist/runtime/components/dialog/Index.vue.d.ts +24 -0
  53. package/dist/runtime/components/dialog/Loading.d.vue.ts +21 -0
  54. package/dist/runtime/components/dialog/Loading.vue +12 -17
  55. package/dist/runtime/components/dialog/Loading.vue.d.ts +21 -0
  56. package/dist/runtime/components/dialog/default/Confirm.d.vue.ts +40 -0
  57. package/dist/runtime/components/dialog/default/Confirm.vue +29 -50
  58. package/dist/runtime/components/dialog/default/Confirm.vue.d.ts +40 -0
  59. package/dist/runtime/components/dialog/default/Loading.d.vue.ts +23 -0
  60. package/dist/runtime/components/dialog/default/Loading.vue +12 -17
  61. package/dist/runtime/components/dialog/default/Loading.vue.d.ts +23 -0
  62. package/dist/runtime/components/dialog/default/Notify.d.vue.ts +23 -0
  63. package/dist/runtime/components/dialog/default/Notify.vue +19 -36
  64. package/dist/runtime/components/dialog/default/Notify.vue.d.ts +23 -0
  65. package/dist/runtime/components/dialog/default/Printing.d.vue.ts +21 -0
  66. package/dist/runtime/components/dialog/default/Printing.vue +13 -17
  67. package/dist/runtime/components/dialog/default/Printing.vue.d.ts +21 -0
  68. package/dist/runtime/components/dialog/default/VerifyUser.d.vue.ts +29 -0
  69. package/dist/runtime/components/dialog/default/VerifyUser.vue +44 -70
  70. package/dist/runtime/components/dialog/default/VerifyUser.vue.d.ts +29 -0
  71. package/dist/runtime/components/document/Form.d.vue.ts +9 -0
  72. package/dist/runtime/components/document/Form.vue +27 -34
  73. package/dist/runtime/components/document/Form.vue.d.ts +9 -0
  74. package/dist/runtime/components/document/TemplateBuilder.d.vue.ts +24 -0
  75. package/dist/runtime/components/document/TemplateBuilder.vue +154 -182
  76. package/dist/runtime/components/document/TemplateBuilder.vue.d.ts +24 -0
  77. package/dist/runtime/components/form/ActionPad.d.vue.ts +114 -0
  78. package/dist/runtime/components/form/ActionPad.vue +48 -73
  79. package/dist/runtime/components/form/ActionPad.vue.d.ts +114 -0
  80. package/dist/runtime/components/form/Birthdate.d.vue.ts +38 -0
  81. package/dist/runtime/components/form/Birthdate.vue +44 -64
  82. package/dist/runtime/components/form/Birthdate.vue.d.ts +38 -0
  83. package/dist/runtime/components/form/CheckboxGroup.d.vue.ts +41 -0
  84. package/dist/runtime/components/form/CheckboxGroup.vue +34 -52
  85. package/dist/runtime/components/form/CheckboxGroup.vue.d.ts +41 -0
  86. package/dist/runtime/components/form/CodeEditor.d.vue.ts +25 -0
  87. package/dist/runtime/components/form/CodeEditor.vue +18 -28
  88. package/dist/runtime/components/form/CodeEditor.vue.d.ts +25 -0
  89. package/dist/runtime/components/form/Date.d.vue.ts +86 -0
  90. package/dist/runtime/components/form/Date.vue +109 -150
  91. package/dist/runtime/components/form/Date.vue.d.ts +86 -0
  92. package/dist/runtime/components/form/DateTime.d.vue.ts +36 -0
  93. package/dist/runtime/components/form/DateTime.vue +94 -131
  94. package/dist/runtime/components/form/DateTime.vue.d.ts +36 -0
  95. package/dist/runtime/components/form/Dialog.d.vue.ts +69 -0
  96. package/dist/runtime/components/form/Dialog.vue +60 -84
  97. package/dist/runtime/components/form/Dialog.vue.d.ts +69 -0
  98. package/dist/runtime/components/form/EditPad.d.vue.ts +113 -0
  99. package/dist/runtime/components/form/EditPad.vue +49 -73
  100. package/dist/runtime/components/form/EditPad.vue.d.ts +113 -0
  101. package/dist/runtime/components/form/File.d.vue.ts +65 -0
  102. package/dist/runtime/components/form/File.vue +112 -174
  103. package/dist/runtime/components/form/File.vue.d.ts +65 -0
  104. package/dist/runtime/components/form/Hidden.d.vue.ts +12 -0
  105. package/dist/runtime/components/form/Hidden.vue +17 -22
  106. package/dist/runtime/components/form/Hidden.vue.d.ts +12 -0
  107. package/dist/runtime/components/form/Iterator.d.vue.ts +279 -0
  108. package/dist/runtime/components/form/Iterator.vue +162 -240
  109. package/dist/runtime/components/form/Iterator.vue.d.ts +279 -0
  110. package/dist/runtime/components/form/Login.d.vue.ts +32 -0
  111. package/dist/runtime/components/form/Login.vue +23 -43
  112. package/dist/runtime/components/form/Login.vue.d.ts +32 -0
  113. package/dist/runtime/components/form/Pad.d.vue.ts +674 -0
  114. package/dist/runtime/components/form/Pad.vue +166 -253
  115. package/dist/runtime/components/form/Pad.vue.d.ts +674 -0
  116. package/dist/runtime/components/form/SignPad.d.vue.ts +62 -0
  117. package/dist/runtime/components/form/SignPad.vue +80 -118
  118. package/dist/runtime/components/form/SignPad.vue.d.ts +62 -0
  119. package/dist/runtime/components/form/System.d.vue.ts +34 -0
  120. package/dist/runtime/components/form/System.vue +18 -24
  121. package/dist/runtime/components/form/System.vue.d.ts +34 -0
  122. package/dist/runtime/components/form/Table.d.vue.ts +221 -0
  123. package/dist/runtime/components/form/Table.vue +123 -170
  124. package/dist/runtime/components/form/Table.vue.d.ts +221 -0
  125. package/dist/runtime/components/form/TableData.d.vue.ts +102 -0
  126. package/dist/runtime/components/form/TableData.vue +109 -127
  127. package/dist/runtime/components/form/TableData.vue.d.ts +102 -0
  128. package/dist/runtime/components/form/Time.d.vue.ts +49 -0
  129. package/dist/runtime/components/form/Time.vue +64 -87
  130. package/dist/runtime/components/form/Time.vue.d.ts +49 -0
  131. package/dist/runtime/components/form/images/Capture.d.vue.ts +96 -0
  132. package/dist/runtime/components/form/images/Capture.vue +104 -139
  133. package/dist/runtime/components/form/images/Capture.vue.d.ts +96 -0
  134. package/dist/runtime/components/form/images/Edit.d.vue.ts +29 -0
  135. package/dist/runtime/components/form/images/Edit.vue +57 -69
  136. package/dist/runtime/components/form/images/Edit.vue.d.ts +29 -0
  137. package/dist/runtime/components/form/images/Field.d.vue.ts +27 -0
  138. package/dist/runtime/components/form/images/Field.vue +136 -194
  139. package/dist/runtime/components/form/images/Field.vue.d.ts +27 -0
  140. package/dist/runtime/components/form/images/Pad.d.vue.ts +13 -0
  141. package/dist/runtime/components/form/images/Pad.vue +23 -28
  142. package/dist/runtime/components/form/images/Pad.vue.d.ts +13 -0
  143. package/dist/runtime/components/label/Date.d.vue.ts +13 -0
  144. package/dist/runtime/components/label/Date.vue +13 -21
  145. package/dist/runtime/components/label/Date.vue.d.ts +13 -0
  146. package/dist/runtime/components/label/DateAgo.d.vue.ts +20 -0
  147. package/dist/runtime/components/label/DateAgo.vue +43 -67
  148. package/dist/runtime/components/label/DateAgo.vue.d.ts +20 -0
  149. package/dist/runtime/components/label/DateCount.d.vue.ts +22 -0
  150. package/dist/runtime/components/label/DateCount.vue +58 -97
  151. package/dist/runtime/components/label/DateCount.vue.d.ts +22 -0
  152. package/dist/runtime/components/label/Field.d.vue.ts +38 -0
  153. package/dist/runtime/components/label/Field.vue +18 -32
  154. package/dist/runtime/components/label/Field.vue.d.ts +38 -0
  155. package/dist/runtime/components/label/FormatMoney.d.vue.ts +12 -0
  156. package/dist/runtime/components/label/FormatMoney.vue +12 -20
  157. package/dist/runtime/components/label/FormatMoney.vue.d.ts +12 -0
  158. package/dist/runtime/components/label/Mask.d.vue.ts +10 -0
  159. package/dist/runtime/components/label/Mask.vue +21 -30
  160. package/dist/runtime/components/label/Mask.vue.d.ts +10 -0
  161. package/dist/runtime/components/label/Object.d.vue.ts +8 -0
  162. package/dist/runtime/components/label/Object.vue +10 -12
  163. package/dist/runtime/components/label/Object.vue.d.ts +8 -0
  164. package/dist/runtime/components/master/Autocomplete.d.vue.ts +70 -0
  165. package/dist/runtime/components/master/Autocomplete.vue +25 -26
  166. package/dist/runtime/components/master/Autocomplete.vue.d.ts +70 -0
  167. package/dist/runtime/components/master/Combobox.d.vue.ts +70 -0
  168. package/dist/runtime/components/master/Combobox.vue +26 -27
  169. package/dist/runtime/components/master/Combobox.vue.d.ts +70 -0
  170. package/dist/runtime/components/master/RadioGroup.d.vue.ts +51 -0
  171. package/dist/runtime/components/master/RadioGroup.vue +44 -47
  172. package/dist/runtime/components/master/RadioGroup.vue.d.ts +51 -0
  173. package/dist/runtime/components/master/Select.d.vue.ts +68 -0
  174. package/dist/runtime/components/master/Select.vue +25 -26
  175. package/dist/runtime/components/master/Select.vue.d.ts +68 -0
  176. package/dist/runtime/components/master/label.d.vue.ts +24 -0
  177. package/dist/runtime/components/master/label.vue +22 -34
  178. package/dist/runtime/components/master/label.vue.d.ts +24 -0
  179. package/dist/runtime/components/model/Autocomplete.d.vue.ts +82 -0
  180. package/dist/runtime/components/model/Autocomplete.vue +50 -37
  181. package/dist/runtime/components/model/Autocomplete.vue.d.ts +82 -0
  182. package/dist/runtime/components/model/Combobox.d.vue.ts +82 -0
  183. package/dist/runtime/components/model/Combobox.vue +51 -37
  184. package/dist/runtime/components/model/Combobox.vue.d.ts +82 -0
  185. package/dist/runtime/components/model/Pad.d.vue.ts +72 -0
  186. package/dist/runtime/components/model/Pad.vue +50 -53
  187. package/dist/runtime/components/model/Pad.vue.d.ts +72 -0
  188. package/dist/runtime/components/model/Select.d.vue.ts +72 -0
  189. package/dist/runtime/components/model/Select.vue +42 -32
  190. package/dist/runtime/components/model/Select.vue.d.ts +72 -0
  191. package/dist/runtime/components/model/Table.d.vue.ts +272 -0
  192. package/dist/runtime/components/model/Table.vue +121 -133
  193. package/dist/runtime/components/model/Table.vue.d.ts +272 -0
  194. package/dist/runtime/components/model/iterator.d.vue.ts +321 -0
  195. package/dist/runtime/components/model/iterator.vue +148 -175
  196. package/dist/runtime/components/model/iterator.vue.d.ts +321 -0
  197. package/dist/runtime/components/model/label.d.vue.ts +26 -0
  198. package/dist/runtime/components/model/label.vue +25 -35
  199. package/dist/runtime/components/model/label.vue.d.ts +26 -0
  200. package/dist/runtime/components/pdf/Print.d.vue.ts +17 -0
  201. package/dist/runtime/components/pdf/Print.vue +27 -38
  202. package/dist/runtime/components/pdf/Print.vue.d.ts +17 -0
  203. package/dist/runtime/components/pdf/View.d.vue.ts +52 -0
  204. package/dist/runtime/components/pdf/View.vue +58 -83
  205. package/dist/runtime/components/pdf/View.vue.d.ts +52 -0
  206. package/dist/runtime/composables/alert.d.ts +4 -0
  207. package/dist/runtime/composables/api.d.ts +4 -0
  208. package/dist/runtime/composables/api.js +4 -2
  209. package/dist/runtime/composables/assetFile.js +4 -2
  210. package/dist/runtime/composables/dialog.d.ts +1 -1
  211. package/dist/runtime/composables/document/template.js +3 -3
  212. package/dist/runtime/composables/document/templateFormHidden.d.ts +4 -0
  213. package/dist/runtime/composables/document/templateFormTable.js +1 -0
  214. package/dist/runtime/composables/graphql.d.ts +2 -2
  215. package/dist/runtime/composables/graphql.js +5 -5
  216. package/dist/runtime/composables/graphqlModel.d.ts +6 -6
  217. package/dist/runtime/composables/graphqlModelItem.d.ts +4 -4
  218. package/dist/runtime/composables/graphqlModelOperation.d.ts +6 -6
  219. package/dist/runtime/composables/graphqlModelOperation.js +2 -1
  220. package/dist/runtime/composables/graphqlOperation.js +5 -1
  221. package/dist/runtime/composables/hostAgentWs.d.ts +1 -1
  222. package/dist/runtime/composables/localStorageModel.d.ts +4 -0
  223. package/dist/runtime/composables/lookupList.d.ts +4 -0
  224. package/dist/runtime/composables/lookupListMaster.js +3 -3
  225. package/dist/runtime/composables/menu.d.ts +4 -0
  226. package/dist/runtime/composables/menu.js +2 -2
  227. package/dist/runtime/composables/useMrzReader.d.ts +48 -0
  228. package/dist/runtime/composables/useMrzReader.js +423 -0
  229. package/dist/runtime/composables/useTesseract.d.ts +16 -0
  230. package/dist/runtime/composables/useTesseract.js +45 -0
  231. package/dist/runtime/composables/userPermission.d.ts +1 -1
  232. package/dist/runtime/composables/utils/fuzzy.d.ts +2 -1
  233. package/dist/runtime/labs/Calendar.d.vue.ts +35 -0
  234. package/dist/runtime/labs/Calendar.vue +47 -75
  235. package/dist/runtime/labs/Calendar.vue.d.ts +35 -0
  236. package/dist/runtime/labs/form/EditMobile.d.vue.ts +12 -0
  237. package/dist/runtime/labs/form/EditMobile.vue +19 -36
  238. package/dist/runtime/labs/form/EditMobile.vue.d.ts +12 -0
  239. package/dist/runtime/labs/form/TextFieldMask.d.vue.ts +21 -0
  240. package/dist/runtime/labs/form/TextFieldMask.vue +19 -25
  241. package/dist/runtime/labs/form/TextFieldMask.vue.d.ts +21 -0
  242. package/dist/runtime/plugins/dialogManager.js +2 -2
  243. package/dist/runtime/plugins/permission.js +3 -3
  244. package/dist/runtime/types/bridge.d.ts +14 -0
  245. package/dist/runtime/utils/asset.d.ts +2 -0
  246. package/dist/runtime/utils/asset.js +49 -0
  247. package/dist/runtime/utils/datetime.js +1 -1
  248. package/dist/types.d.mts +2 -6
  249. package/package.json +79 -57
  250. package/scripts/ci-release.mjs +125 -0
  251. package/scripts/enrich-vue-docs-from-ai.mjs +197 -0
  252. package/scripts/generate-ai-summary.mjs +321 -0
  253. package/scripts/generate-composables-md.mjs +129 -0
  254. package/scripts/release-version.mjs +68 -0
  255. package/scripts/release.mjs +49 -0
  256. package/templates/public/tesseract/mrz.traineddata.gz +0 -0
  257. package/templates/public/tesseract/ocrb.traineddata.gz +0 -0
  258. package/dist/module.cjs +0 -5
  259. package/dist/module.d.ts +0 -8
  260. package/dist/types.d.ts +0 -7
@@ -1,289 +1,211 @@
1
- <script lang="ts" setup>
2
- import {computed, defineExpose, defineOptions, nextTick, ref, useAttrs, useSlots, useTemplateRef, watch} from 'vue'
3
- import {omit} from 'lodash-es'
4
- import type {FormDialogCallback} from '../../types/formDialog'
5
- import {VDataIterator} from "vuetify/components/VDataIterator";
6
- import {VDataTable} from "vuetify/components/VDataTable";
7
- import {VInput} from 'vuetify/components/VInput'
8
- import {useDisplay} from 'vuetify'
9
-
1
+ <script setup>
2
+ import { computed, nextTick, ref, useAttrs, useSlots, useTemplateRef, watch } from "vue";
3
+ import { omit } from "lodash-es";
4
+ import { VDataIterator } from "vuetify/components/VDataIterator";
5
+ import { VDataTable } from "vuetify/components/VDataTable";
6
+ import { VInput } from "vuetify/components/VInput";
7
+ import { useDisplay } from "vuetify";
10
8
  defineOptions({
11
- inheritAttrs: false,
12
- })
13
-
14
- interface Props extends /* @vue-ignore */ InstanceType<typeof VDataIterator['$props']>,/* @vue-ignore */ InstanceType<typeof VDataTable['$props']> {
15
- title: string
16
- noDataText?: string
17
- modelValue?: Record<string, any>[]
18
- modelKey?: string
19
- dialogFullscreen?: boolean
20
- initialData?: Record<string, any>
21
- toolbarColor?: string
22
- importable?: boolean
23
- exportable?: boolean
24
- insertable?: boolean
25
- searchable?: boolean
26
-
27
- loading?: boolean
28
-
29
- viewSwitch?: boolean
30
- viewSwitchMultiple?: boolean
31
-
32
- cols?: string | number | boolean
33
- xxl?: string | number | boolean
34
- xl?: string | number | boolean
35
- lg?: string | number | boolean
36
- md?: string | number | boolean
37
- sm?: string | number | boolean
38
- itemsPerPage?: string | number
39
-
40
- preferTable?: string | number | boolean
41
- preferTableXxl?: string | number | boolean
42
- preferTableXl?: string | number | boolean
43
- preferTableLg?: string | number | boolean
44
- preferTableMd?: string | number | boolean
45
- preferTableSm?: string | number | boolean
46
- }
47
-
48
- const props = withDefaults(defineProps<Props>(), {
49
- noDataText: 'ไม่พบข้อมูล',
50
- dialogFullscreen: false,
51
- modelKey: 'id',
52
- toolbarColor: 'primary',
53
- importable: true,
54
- exportable: true,
55
- insertable: true,
56
- searchable: true,
57
-
58
- loading: false,
59
-
60
- viewSwitch: false,
61
- viewSwitchMultiple:false,
62
-
63
- cols: 12,
64
- xxl: false,
65
- xl: false,
66
- lg: 2,
67
- md: 4,
68
- sm: 6,
69
- itemsPerPage: 12,
70
- })
71
-
72
- const emit = defineEmits(['update:modelValue'])
73
-
74
- const attrs = useAttrs()
9
+ inheritAttrs: false
10
+ });
11
+ const props = defineProps({
12
+ title: { type: String, required: true },
13
+ noDataText: { type: String, required: false, default: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25" },
14
+ modelValue: { type: Array, required: false },
15
+ modelKey: { type: String, required: false, default: "id" },
16
+ dialogFullscreen: { type: Boolean, required: false, default: false },
17
+ initialData: { type: Object, required: false },
18
+ toolbarColor: { type: String, required: false, default: "primary" },
19
+ importable: { type: Boolean, required: false, default: true },
20
+ exportable: { type: Boolean, required: false, default: true },
21
+ insertable: { type: Boolean, required: false, default: true },
22
+ searchable: { type: Boolean, required: false, default: true },
23
+ loading: { type: Boolean, required: false, default: false },
24
+ viewSwitch: { type: Boolean, required: false, default: false },
25
+ viewSwitchMultiple: { type: Boolean, required: false, default: false },
26
+ cols: { type: [String, Number, Boolean], required: false, default: 12 },
27
+ xxl: { type: [String, Number, Boolean], required: false, default: false },
28
+ xl: { type: [String, Number, Boolean], required: false, default: false },
29
+ lg: { type: [String, Number, Boolean], required: false, default: 2 },
30
+ md: { type: [String, Number, Boolean], required: false, default: 4 },
31
+ sm: { type: [String, Number, Boolean], required: false, default: 6 },
32
+ itemsPerPage: { type: [String, Number], required: false, default: 12 },
33
+ preferTable: { type: [String, Number, Boolean], required: false },
34
+ preferTableXxl: { type: [String, Number, Boolean], required: false },
35
+ preferTableXl: { type: [String, Number, Boolean], required: false },
36
+ preferTableLg: { type: [String, Number, Boolean], required: false },
37
+ preferTableMd: { type: [String, Number, Boolean], required: false },
38
+ preferTableSm: { type: [String, Number, Boolean], required: false }
39
+ });
40
+ const emit = defineEmits(["update:modelValue"]);
41
+ const attrs = useAttrs();
75
42
  const plainAttrs = computed(() => {
76
- return omit(attrs, ['modelValue', 'onUpdate:modelValue'])
77
- })
78
-
79
- const inputRef = useTemplateRef<VInput>("inputRef")
80
-
81
- const slots = useSlots()
43
+ return omit(attrs, ["modelValue", "onUpdate:modelValue"]);
44
+ });
45
+ const inputRef = useTemplateRef("inputRef");
46
+ const slots = useSlots();
82
47
  const tableSlots = computed(() => {
83
- return omit(slots, ['item'])
84
- })
85
-
86
- const display = useDisplay()
87
- const isProgrammaticSet = ref(false)
88
- const userOverrodeView = ref(false)
89
-
90
- const viewType = ref<string[] | string>('iterator')
91
-
92
- function setViewTypeSafely(val: 'iterator' | 'table') {
93
- isProgrammaticSet.value = true
48
+ return omit(slots, ["item"]);
49
+ });
50
+ const display = useDisplay();
51
+ const isProgrammaticSet = ref(false);
52
+ const userOverrodeView = ref(false);
53
+ const viewType = ref("iterator");
54
+ function setViewTypeSafely(val) {
55
+ isProgrammaticSet.value = true;
94
56
  if (Array.isArray(viewType.value)) {
95
- viewType.value = [val]
57
+ viewType.value = [val];
96
58
  } else {
97
- viewType.value = val
59
+ viewType.value = val;
98
60
  }
99
- nextTick(() => { isProgrammaticSet.value = false })
61
+ nextTick(() => {
62
+ isProgrammaticSet.value = false;
63
+ });
100
64
  }
101
-
102
65
  watch(viewType, () => {
103
- if (!isProgrammaticSet.value) userOverrodeView.value = true
104
- })
105
-
106
- function parsePrefer(val: unknown): boolean | number {
107
- if (val === true) return true
108
- const n = Number(val)
109
- return Number.isFinite(n) && n > 0 ? n : false
66
+ if (!isProgrammaticSet.value) userOverrodeView.value = true;
67
+ });
68
+ function parsePrefer(val) {
69
+ if (val === true) return true;
70
+ const n = Number(val);
71
+ return Number.isFinite(n) && n > 0 ? n : false;
110
72
  }
111
-
112
- const computedPreferTable = computed<boolean | number>(() => {
113
- const bp = display.name?.value
114
- if (bp === 'xxl' && props.preferTableXxl !== undefined) return parsePrefer(props.preferTableXxl)
115
- if (bp === 'xl' && props.preferTableXl !== undefined) return parsePrefer(props.preferTableXl)
116
- if (bp === 'lg' && props.preferTableLg !== undefined) return parsePrefer(props.preferTableLg)
117
- if (bp === 'md' && props.preferTableMd !== undefined) return parsePrefer(props.preferTableMd)
118
- if (bp === 'sm' && props.preferTableSm !== undefined) return parsePrefer(props.preferTableSm)
119
- return parsePrefer(props.preferTable)
120
- })
121
-
122
- const items = ref<Record<string, any>[]>([])
123
- const search = ref<string>()
124
- const currentItem = ref<Record<string, any> | undefined>(undefined)
125
-
126
- function setSearch(keyword: string) {
127
- search.value = keyword
73
+ const computedPreferTable = computed(() => {
74
+ const bp = display.name?.value;
75
+ if (bp === "xxl" && props.preferTableXxl !== void 0) return parsePrefer(props.preferTableXxl);
76
+ if (bp === "xl" && props.preferTableXl !== void 0) return parsePrefer(props.preferTableXl);
77
+ if (bp === "lg" && props.preferTableLg !== void 0) return parsePrefer(props.preferTableLg);
78
+ if (bp === "md" && props.preferTableMd !== void 0) return parsePrefer(props.preferTableMd);
79
+ if (bp === "sm" && props.preferTableSm !== void 0) return parsePrefer(props.preferTableSm);
80
+ return parsePrefer(props.preferTable);
81
+ });
82
+ const items = ref([]);
83
+ const search = ref();
84
+ const currentItem = ref(void 0);
85
+ function setSearch(keyword) {
86
+ search.value = keyword;
128
87
  }
129
-
130
- const isDialogOpen = ref<boolean>(false)
131
-
88
+ const isDialogOpen = ref(false);
132
89
  watch(() => props.modelValue, (newValue) => {
133
- if (!Array.isArray(newValue) || !newValue.every(item => typeof item === 'object')) {
134
- items.value = []
135
- }
136
- else {
137
- let maxKey = 0
138
-
90
+ if (!Array.isArray(newValue) || !newValue.every((item) => typeof item === "object")) {
91
+ items.value = [];
92
+ } else {
93
+ let maxKey = 0;
139
94
  newValue.forEach((item) => {
140
95
  if (!item.hasOwnProperty(props.modelKey)) {
141
- maxKey = Math.max(maxKey, ...newValue.map(i => i[props.modelKey] || 0))
142
- item[props.modelKey] = maxKey + 1
96
+ maxKey = Math.max(maxKey, ...newValue.map((i) => i[props.modelKey] || 0));
97
+ item[props.modelKey] = maxKey + 1;
143
98
  }
144
- })
145
-
146
- items.value = newValue
99
+ });
100
+ items.value = newValue;
147
101
  }
148
- }, { immediate: true })
149
-
102
+ }, { immediate: true });
150
103
  watch(items, (newValue) => {
151
- emit('update:modelValue', newValue)
152
- }, { deep: true })
153
-
104
+ emit("update:modelValue", newValue);
105
+ }, { deep: true });
154
106
  watch(
155
- [() => items.value?.length, computedPreferTable, () => display.name?.value],
156
- ([len, prefer]) => {
157
- if (userOverrodeView.value) return // respect explicit user choice forever (until remount)
158
-
159
- let target: 'iterator' | 'table' = 'iterator'
160
- if (prefer === true) {
161
- target = 'table'
162
- } else if (typeof prefer === 'number') {
163
- if (Number(len) >= prefer) target = 'table'
164
- }
165
-
166
- if (!viewType.value?.includes(target)) setViewTypeSafely(target)
167
- },
168
- { immediate: true }
169
- )
170
-
171
- const itemsPerPageInternal = ref<string | number>()
107
+ [() => items.value?.length, computedPreferTable, () => display.name?.value],
108
+ ([len, prefer]) => {
109
+ if (userOverrodeView.value) return;
110
+ let target = "iterator";
111
+ if (prefer === true) {
112
+ target = "table";
113
+ } else if (typeof prefer === "number") {
114
+ if (Number(len) >= prefer) target = "table";
115
+ }
116
+ if (!viewType.value?.includes(target)) setViewTypeSafely(target);
117
+ },
118
+ { immediate: true }
119
+ );
120
+ const itemsPerPageInternal = ref();
172
121
  watch(() => props.itemsPerPage, (newValue) => {
173
- if (newValue.toString().toLowerCase() == 'all') itemsPerPageInternal.value = '-1'
174
- else if (newValue) itemsPerPageInternal.value = newValue
175
- }, { immediate: true })
176
-
177
- function createItem(item: Record<string, any>, callback?: FormDialogCallback) {
178
- if (items.value.length > 0) item[props.modelKey] = Math.max(...items.value.map(i => i[props.modelKey] || 0)) + 1
179
- else item[props.modelKey] = 1
180
-
181
- items.value.push(item)
182
-
183
- if (callback) callback.done()
122
+ if (newValue.toString().toLowerCase() == "all") itemsPerPageInternal.value = "-1";
123
+ else if (newValue) itemsPerPageInternal.value = newValue;
124
+ }, { immediate: true });
125
+ function createItem(item, callback) {
126
+ if (items.value.length > 0) item[props.modelKey] = Math.max(...items.value.map((i) => i[props.modelKey] || 0)) + 1;
127
+ else item[props.modelKey] = 1;
128
+ items.value.push(item);
129
+ if (callback) callback.done();
184
130
  }
185
-
186
- function importItems(importItems: Record<string, any>[], callback?: FormDialogCallback) {
187
- importItems.forEach((item) => {
188
- createItem(item)
189
- })
190
- if (callback) callback.done()
131
+ function importItems(importItems2, callback) {
132
+ importItems2.forEach((item) => {
133
+ createItem(item);
134
+ });
135
+ if (callback) callback.done();
191
136
  }
192
-
193
- function updateItem(newItem: Record<string, any>, callback?: FormDialogCallback) {
194
- const index = items.value.findIndex(item => item[props.modelKey] === newItem[props.modelKey])
195
-
137
+ function updateItem(newItem, callback) {
138
+ const index = items.value.findIndex((item) => item[props.modelKey] === newItem[props.modelKey]);
196
139
  if (index !== -1) {
197
- items.value[index] = newItem
140
+ items.value[index] = newItem;
198
141
  }
199
-
200
- if (callback) callback.done()
142
+ if (callback) callback.done();
201
143
  }
202
-
203
- function moveUpItem(currentItem: Record<string, any>, callback?: FormDialogCallback) {
204
- const index = items.value.findIndex(item => item[props.modelKey] === currentItem[props.modelKey])
205
-
144
+ function moveUpItem(currentItem2, callback) {
145
+ const index = items.value.findIndex((item) => item[props.modelKey] === currentItem2[props.modelKey]);
206
146
  if (index > 0) {
207
- const temp = items.value[index - 1]
208
- items.value[index - 1] = items.value[index]
209
- items.value[index] = temp
147
+ const temp = items.value[index - 1];
148
+ items.value[index - 1] = items.value[index];
149
+ items.value[index] = temp;
210
150
  }
211
-
212
- if (callback) callback.done()
151
+ if (callback) callback.done();
213
152
  }
214
-
215
- function moveDownItem(currentItem: Record<string, any>, callback?: FormDialogCallback) {
216
- const index = items.value.findIndex(item => item[props.modelKey] === currentItem[props.modelKey])
217
-
153
+ function moveDownItem(currentItem2, callback) {
154
+ const index = items.value.findIndex((item) => item[props.modelKey] === currentItem2[props.modelKey]);
218
155
  if (index >= 0 && index < items.value.length - 1) {
219
- const temp = items.value[index + 1]
220
- items.value[index + 1] = items.value[index]
221
- items.value[index] = temp
156
+ const temp = items.value[index + 1];
157
+ items.value[index + 1] = items.value[index];
158
+ items.value[index] = temp;
222
159
  }
223
-
224
- if (callback) callback.done()
160
+ if (callback) callback.done();
225
161
  }
226
-
227
- function moveToItem(currentItem: Record<string, any>, callback?: FormDialogCallback) {
228
- const index = items.value.findIndex(item => item[props.modelKey] === currentItem[props.modelKey]);
229
-
162
+ function moveToItem(currentItem2, callback) {
163
+ const index = items.value.findIndex((item) => item[props.modelKey] === currentItem2[props.modelKey]);
230
164
  if (index !== -1) {
231
165
  const newPosition = prompt("Enter the new position (0-based index):");
232
- const parsedPosition = parseInt(<string>newPosition, 10);
233
-
166
+ const parsedPosition = parseInt(newPosition, 10);
234
167
  if (isNaN(parsedPosition) || parsedPosition < 0 || parsedPosition >= items.value.length) {
235
168
  alert("Invalid position entered. Please enter a number between 0 and " + (items.value.length - 1));
236
- return
169
+ return;
237
170
  }
238
-
239
171
  const [temp] = items.value.splice(index, 1);
240
-
241
172
  items.value.splice(parsedPosition, 0, temp);
242
173
  }
243
-
244
174
  if (callback) callback.done();
245
175
  }
246
-
247
- function deleteItem(deleteItem: Record<string, any>, callback?: FormDialogCallback) {
248
- const index = items.value.findIndex(item => item[props.modelKey] === deleteItem[props.modelKey])
249
-
176
+ function deleteItem(deleteItem2, callback) {
177
+ const index = items.value.findIndex((item) => item[props.modelKey] === deleteItem2[props.modelKey]);
250
178
  if (index !== -1) {
251
- items.value.splice(index, 1)
179
+ items.value.splice(index, 1);
252
180
  }
253
-
254
- if (callback) callback.done()
181
+ if (callback) callback.done();
255
182
  }
256
-
257
- function openDialog(item?: object) {
258
- currentItem.value = item
183
+ function openDialog(item) {
184
+ currentItem.value = item;
259
185
  nextTick(() => {
260
- isDialogOpen.value = true
261
- })
186
+ isDialogOpen.value = true;
187
+ });
262
188
  }
263
-
264
- const operation = ref({ openDialog, createItem, updateItem, deleteItem, moveUpItem, moveDownItem,moveToItem,setSearch })
265
-
266
- const isValid = computed(()=>{
267
- return inputRef.value?.isValid
268
- })
269
-
270
- const errorMessages = computed(()=>{
271
- return inputRef.value?.errorMessages
272
- })
273
-
189
+ const operation = ref({ openDialog, createItem, updateItem, deleteItem, moveUpItem, moveDownItem, moveToItem, setSearch });
190
+ const isValid = computed(() => {
191
+ return inputRef.value?.isValid;
192
+ });
193
+ const errorMessages = computed(() => {
194
+ return inputRef.value?.errorMessages;
195
+ });
274
196
  defineExpose({
275
197
  errorMessages,
276
198
  isValid,
277
- reset: ()=>inputRef.value?.reset(),
278
- resetValidation : ()=>inputRef.value?.resetValidation(),
279
- validate : ()=>inputRef.value?.validate(),
199
+ reset: () => inputRef.value?.reset(),
200
+ resetValidation: () => inputRef.value?.resetValidation(),
201
+ validate: () => inputRef.value?.validate(),
280
202
  operation
281
- })
203
+ });
282
204
  </script>
283
205
 
284
206
  <template>
285
207
  <v-input v-model="items" v-bind="plainAttrs" ref="inputRef">
286
- <template #default="{isReadonly,isDisabled}">
208
+ <template #default="{ isReadonly, isDisabled }">
287
209
  <v-container fluid class="ma-0 pa-0">
288
210
  <v-card>
289
211
  <v-data-iterator
@@ -359,7 +281,7 @@ defineExpose({
359
281
  <v-row
360
282
  justify="end"
361
283
  class="ma-1"
362
- dense
284
+ density="compact"
363
285
  no-gutters
364
286
  align="center"
365
287
  >
@@ -430,13 +352,13 @@ defineExpose({
430
352
  >
431
353
  <!-- @ts-ignore -->
432
354
  <template
433
- v-for="(_, name, index) in (tableSlots as {})"
355
+ v-for="(_, name, index) in tableSlots"
434
356
  :key="index"
435
357
  #[name]="slotData"
436
358
  >
437
359
  <slot
438
360
  :name="name"
439
- v-bind="((slotData || {}) as object)"
361
+ v-bind="slotData || {}"
440
362
  :operation="operation"
441
363
  :isReadonly="isReadonly"
442
364
  :isDisabled="isDisabled"
@@ -446,9 +368,9 @@ defineExpose({
446
368
  v-if="!$slots['item.operation'] && !(isReadonly.value || isDisabled.value)"
447
369
  #item.operation="props"
448
370
  >
449
- <v-icon density="compact" :disabled="props.index==0" @click="moveUpItem(props.item)">mdi:mdi-arrow-up-thick</v-icon>
371
+ <v-icon density="compact" :disabled="props.index == 0" @click="moveUpItem(props.item)">mdi:mdi-arrow-up-thick</v-icon>
450
372
  <v-icon density="compact" @click="moveToItem(props.item)">fa:fas fa-arrow-right-to-bracket</v-icon>
451
- <v-icon density="compact" :disabled="props.index==items.length-1" @click="moveDownItem(props.item)">mdi:mdi-arrow-down-thick</v-icon>
373
+ <v-icon density="compact" :disabled="props.index == items.length - 1" @click="moveDownItem(props.item)">mdi:mdi-arrow-down-thick</v-icon>
452
374
  </template>
453
375
  <template
454
376
  v-if="!$slots['item.action'] && !(isReadonly.value || isDisabled.value)"
@@ -474,7 +396,7 @@ defineExpose({
474
396
  <v-row
475
397
  align-content="center"
476
398
  justify="end"
477
- dense
399
+ density="compact"
478
400
  >
479
401
  <v-spacer />
480
402
  <v-select