@ramathibodi/nuxt-commons 0.1.74 → 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 (243) hide show
  1. package/README.md +9 -2
  2. package/dist/module.json +4 -4
  3. package/dist/module.mjs +4 -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 -26
  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 -81
  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 -76
  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 -50
  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 -111
  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 +69 -109
  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 -35
  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 -20
  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 -45
  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 -67
  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 -165
  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 -178
  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 -59
  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 -57
  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 -40
  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 -29
  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 -62
  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 -29
  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 -48
  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 -29
  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 -82
  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 -42
  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 -194
  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 -85
  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 -76
  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 -64
  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 -36
  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 -162
  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 -143
  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 -96
  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 -85
  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 -186
  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 -34
  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 -252
  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 -55
  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 -265
  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 -126
  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 -32
  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 -182
  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 -139
  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 -99
  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 -147
  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 -81
  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 -205
  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 -40
  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 -29
  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 -75
  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 -105
  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 -40
  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 -28
  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 -38
  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 -20
  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 -34
  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 -35
  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 -59
  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 -34
  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 -42
  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 -49
  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 -49
  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 -65
  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 -44
  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 -145
  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 -183
  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 -43
  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 -50
  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 -95
  205. package/dist/runtime/components/pdf/View.vue.d.ts +52 -0
  206. package/dist/runtime/composables/api.js +4 -2
  207. package/dist/runtime/composables/assetFile.js +4 -2
  208. package/dist/runtime/composables/dialog.d.ts +1 -1
  209. package/dist/runtime/composables/document/template.js +3 -3
  210. package/dist/runtime/composables/document/templateFormTable.js +1 -0
  211. package/dist/runtime/composables/graphql.d.ts +2 -2
  212. package/dist/runtime/composables/graphql.js +5 -5
  213. package/dist/runtime/composables/graphqlModel.d.ts +6 -6
  214. package/dist/runtime/composables/graphqlModelItem.d.ts +4 -4
  215. package/dist/runtime/composables/graphqlModelOperation.d.ts +6 -6
  216. package/dist/runtime/composables/graphqlModelOperation.js +2 -1
  217. package/dist/runtime/composables/graphqlOperation.js +5 -1
  218. package/dist/runtime/composables/hostAgentWs.d.ts +1 -1
  219. package/dist/runtime/composables/lookupListMaster.js +3 -3
  220. package/dist/runtime/composables/menu.js +2 -2
  221. package/dist/runtime/composables/userPermission.d.ts +1 -1
  222. package/dist/runtime/composables/utils/fuzzy.d.ts +2 -1
  223. package/dist/runtime/labs/Calendar.d.vue.ts +35 -0
  224. package/dist/runtime/labs/Calendar.vue +47 -75
  225. package/dist/runtime/labs/Calendar.vue.d.ts +35 -0
  226. package/dist/runtime/labs/form/EditMobile.d.vue.ts +12 -0
  227. package/dist/runtime/labs/form/EditMobile.vue +19 -36
  228. package/dist/runtime/labs/form/EditMobile.vue.d.ts +12 -0
  229. package/dist/runtime/labs/form/TextFieldMask.d.vue.ts +21 -0
  230. package/dist/runtime/labs/form/TextFieldMask.vue +19 -25
  231. package/dist/runtime/labs/form/TextFieldMask.vue.d.ts +21 -0
  232. package/dist/runtime/plugins/dialogManager.js +2 -2
  233. package/dist/runtime/plugins/permission.js +3 -3
  234. package/dist/runtime/types/bridge.d.ts +14 -0
  235. package/dist/runtime/utils/datetime.js +1 -1
  236. package/dist/types.d.mts +2 -6
  237. package/package.json +71 -58
  238. package/scripts/ci-release.mjs +125 -0
  239. package/scripts/release-version.mjs +68 -0
  240. package/scripts/release.mjs +49 -0
  241. package/dist/module.cjs +0 -5
  242. package/dist/module.d.ts +0 -8
  243. package/dist/types.d.ts +0 -7
@@ -1,69 +1,32 @@
1
- <script setup lang="ts">
2
- /**
3
- * DeviceIdCardButton bridges UI actions with host-agent hardware/device operations and emits runtime scan/read results.
4
- * This doc block is consumed by vue-docgen for generated API documentation.
5
- */
6
- import { computed, ref, useAttrs } from 'vue'
7
- import { VBtn } from 'vuetify/components/VBtn'
8
- import { useAlert } from '../../composables/alert'
9
- import { useHostAgent, type PatientRegisterPayload } from '../../composables/hostAgent'
10
-
11
- interface Props extends /* @vue-ignore */ InstanceType<typeof VBtn['$props']> {
12
- /** If true -> call /idcard/infoAndPhoto, else /idcard/info */
13
- withPhoto?: boolean // Includes portrait/photo data in ID card read results.
14
- /** Optional reader name/query string */
15
- reader?: string | null // Preferred hardware reader identifier to connect or switch to.
16
- /** Auto-disable button while reading */
17
- disableWhileLoading?: boolean // Disables the trigger button while a read operation is in progress.
18
- }
19
-
20
- /**
21
- * Public props accepted by DeviceIdCardButton.
22
- * Document each prop field with intent, defaults, and side effects for clear generated docs.
23
- */
24
- const props = withDefaults(defineProps<Props>(), {
25
- withPhoto: false,
26
- reader: null,
27
- disableWhileLoading: true,
28
- })
29
-
30
- /**
31
- * Custom events emitted by DeviceIdCardButton.
32
- * Parents can listen to these events to react to user actions and internal state changes.
33
- */
34
- const emit = defineEmits<{
35
- (e: 'read', payload: PatientRegisterPayload): void
36
- (e: 'error', err: unknown): void
37
- (e: 'loading', loading: boolean): void
38
- }>()
39
-
40
- const attrs = useAttrs()
41
- const host = useHostAgent()
42
-
43
- const loading = ref(false)
44
- const disabled = computed(() => (props.disableWhileLoading ? loading.value : false))
45
-
46
- async function onClick(ev: MouseEvent) {
47
- // allow parent to prevent if they attach their own click handler and call preventDefault
48
- if (ev.defaultPrevented) return
49
-
1
+ <script setup>
2
+ import { computed, ref, useAttrs } from "vue";
3
+ import { VBtn } from "vuetify/components/VBtn";
4
+ import { useAlert } from "../../composables/alert";
5
+ import { useHostAgent } from "../../composables/hostAgent";
6
+ const props = defineProps({
7
+ withPhoto: { type: Boolean, required: false, default: false },
8
+ reader: { type: [String, null], required: false, default: null },
9
+ disableWhileLoading: { type: Boolean, required: false, default: true }
10
+ });
11
+ const emit = defineEmits(["read", "error", "loading"]);
12
+ const attrs = useAttrs();
13
+ const host = useHostAgent();
14
+ const loading = ref(false);
15
+ const disabled = computed(() => props.disableWhileLoading ? loading.value : false);
16
+ async function onClick(ev) {
17
+ if (ev.defaultPrevented) return;
50
18
  try {
51
- loading.value = true
52
- emit('loading', true)
53
-
54
- const payload = props.withPhoto
55
- ? await host.getIdCardInfoAndPhoto(props.reader ?? undefined)
56
- : await host.getIdCardInfo(props.reader ?? undefined)
57
-
58
- emit('read', payload)
59
- } catch (e: any) {
60
- emit('error', e)
61
-
62
- const msg = e?.data?.detail || e?.data?.title || e?.message || 'ID card read failed'
63
- useAlert()?.addAlert({ message: msg, alertType: 'error' })
19
+ loading.value = true;
20
+ emit("loading", true);
21
+ const payload = props.withPhoto ? await host.getIdCardInfoAndPhoto(props.reader ?? void 0) : await host.getIdCardInfo(props.reader ?? void 0);
22
+ emit("read", payload);
23
+ } catch (e) {
24
+ emit("error", e);
25
+ const msg = e?.data?.detail || e?.data?.title || e?.message || "ID card read failed";
26
+ useAlert()?.addAlert({ message: msg, alertType: "error" });
64
27
  } finally {
65
- loading.value = false
66
- emit('loading', false)
28
+ loading.value = false;
29
+ emit("loading", false);
67
30
  }
68
31
  }
69
32
  </script>
@@ -78,17 +41,17 @@ async function onClick(ev: MouseEvent) {
78
41
  v-bind="attrs"
79
42
  class="idcard-btn"
80
43
  :loading="loading"
81
- :disabled="disabled || (attrs as any).disabled"
44
+ :disabled="disabled || attrs.disabled"
82
45
  @click="onClick"
83
46
  >
84
47
  <template
85
- v-for="(_, name, index) in ($slots as {})"
48
+ v-for="(_, name, index) in $slots"
86
49
  :key="index"
87
50
  #[name]="slotData"
88
51
  >
89
52
  <slot
90
53
  :name="name"
91
- v-bind="((slotData || {}) as object)"
54
+ v-bind="slotData || {}"
92
55
  />
93
56
  </template>
94
57
  </v-btn>
@@ -0,0 +1,57 @@
1
+ import { VBtn } from 'vuetify/components/VBtn';
2
+ import { type PatientRegisterPayload } from '../../composables/hostAgent.js';
3
+ interface Props extends /* @vue-ignore */ InstanceType<typeof VBtn['$props']> {
4
+ /** If true -> call /idcard/infoAndPhoto, else /idcard/info */
5
+ withPhoto?: boolean;
6
+ /** Optional reader name/query string */
7
+ reader?: string | null;
8
+ /** Auto-disable button while reading */
9
+ disableWhileLoading?: boolean;
10
+ }
11
+ declare var __VLS_12: never, __VLS_13: {};
12
+ type __VLS_Slots = {} & {
13
+ [K in NonNullable<typeof __VLS_12>]?: (props: typeof __VLS_13) => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
16
+ withPhoto: boolean;
17
+ reader: null;
18
+ disableWhileLoading: boolean;
19
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
20
+ error: (err: unknown) => any;
21
+ loading: (loading: boolean) => any;
22
+ read: (payload: PatientRegisterPayload) => any;
23
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
24
+ withPhoto: boolean;
25
+ reader: null;
26
+ disableWhileLoading: boolean;
27
+ }>>> & Readonly<{
28
+ onError?: ((err: unknown) => any) | undefined;
29
+ onLoading?: ((loading: boolean) => any) | undefined;
30
+ onRead?: ((payload: PatientRegisterPayload) => any) | undefined;
31
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
35
+ type __VLS_TypePropsToOption<T> = {
36
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
37
+ type: import('vue').PropType<Required<T>[K]>;
38
+ } : {
39
+ type: import('vue').PropType<T[K]>;
40
+ required: true;
41
+ };
42
+ };
43
+ type __VLS_WithDefaults<P, D> = {
44
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
45
+ default: D[K];
46
+ }> : P[K];
47
+ };
48
+ type __VLS_WithSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
53
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
54
+ [K in keyof T]: T[K];
55
+ } : {
56
+ [K in keyof T as K]: T[K];
57
+ }) & {};
@@ -0,0 +1,55 @@
1
+ import { type IdCardWsServerMessage, type PatientRegisterPayload } from '../../composables/hostAgent.js';
2
+ interface Props {
3
+ /** Subscribe withPhoto=true => server will push payload that includes photo when available */
4
+ withPhoto?: boolean;
5
+ /** Optional reader name; null/undefined means "any/default" */
6
+ reader?: string | null;
7
+ /** Auto-connect on mount (default true) */
8
+ autoConnect?: boolean;
9
+ /** Auto-subscribe after connect (default true) */
10
+ autoSubscribe?: boolean;
11
+ /** If true, try to reconnect when socket closes unexpectedly */
12
+ autoReconnect?: boolean;
13
+ /** Reconnect delay in ms */
14
+ reconnectDelayMs?: number;
15
+ }
16
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
17
+ message: (msg: IdCardWsServerMessage) => any;
18
+ error: (err: unknown) => any;
19
+ connected: () => any;
20
+ disconnected: (info?: {
21
+ code?: number;
22
+ reason?: string;
23
+ } | undefined) => any;
24
+ subscribed: (info?: {
25
+ reader?: string | null;
26
+ withPhoto?: boolean;
27
+ } | undefined) => any;
28
+ unsubscribed: () => any;
29
+ inserted: (payload: PatientRegisterPayload) => any;
30
+ removed: () => any;
31
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
32
+ onMessage?: ((msg: IdCardWsServerMessage) => any) | undefined;
33
+ onError?: ((err: unknown) => any) | undefined;
34
+ onConnected?: (() => any) | undefined;
35
+ onDisconnected?: ((info?: {
36
+ code?: number;
37
+ reason?: string;
38
+ } | undefined) => any) | undefined;
39
+ onSubscribed?: ((info?: {
40
+ reader?: string | null;
41
+ withPhoto?: boolean;
42
+ } | undefined) => any) | undefined;
43
+ onUnsubscribed?: (() => any) | undefined;
44
+ onInserted?: ((payload: PatientRegisterPayload) => any) | undefined;
45
+ onRemoved?: (() => any) | undefined;
46
+ }>, {
47
+ reader: string | null;
48
+ withPhoto: boolean;
49
+ autoConnect: boolean;
50
+ autoSubscribe: boolean;
51
+ autoReconnect: boolean;
52
+ reconnectDelayMs: number;
53
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
54
+ declare const _default: typeof __VLS_export;
55
+ export default _default;
@@ -1,205 +1,144 @@
1
- <script setup lang="ts">
2
- /**
3
- * DeviceIdCardWebSocket bridges UI actions with host-agent hardware/device operations and emits runtime scan/read results.
4
- * This doc block is consumed by vue-docgen for generated API documentation.
5
- */
6
- import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
7
- import { type IdCardWsServerMessage, type PatientRegisterPayload } from '../../composables/hostAgent'
1
+ <script setup>
2
+ import { onBeforeUnmount, onMounted, ref, watch } from "vue";
3
+ import {} from "../../composables/hostAgent";
8
4
  import { useHostAgentWs } from "../../composables/hostAgentWs";
9
-
10
- interface Props {
11
- /** Subscribe withPhoto=true => server will push payload that includes photo when available */
12
- withPhoto?: boolean // Includes portrait/photo data in ID card read results.
13
- /** Optional reader name; null/undefined means "any/default" */
14
- reader?: string | null // Preferred hardware reader identifier to connect or switch to.
15
- /** Auto-connect on mount (default true) */
16
- autoConnect?: boolean // Connects to the device WebSocket automatically on mount.
17
- /** Auto-subscribe after connect (default true) */
18
- autoSubscribe?: boolean // Subscribes to live reader events automatically after connect.
19
- /** If true, try to reconnect when socket closes unexpectedly */
20
- autoReconnect?: boolean // Retries connection automatically when the socket closes unexpectedly.
21
- /** Reconnect delay in ms */
22
- reconnectDelayMs?: number // Delay in milliseconds before each reconnect attempt.
23
- }
24
-
25
- /**
26
- * Public props accepted by DeviceIdCardWebSocket.
27
- * Document each prop field with intent, defaults, and side effects for clear generated docs.
28
- */
29
- const props = withDefaults(defineProps<Props>(), {
30
- withPhoto: false,
31
- reader: null,
32
- autoConnect: true,
33
- autoSubscribe: true,
34
- autoReconnect: false,
35
- reconnectDelayMs: 1000,
36
- })
37
-
38
- /**
39
- * Custom events emitted by DeviceIdCardWebSocket.
40
- * Parents can listen to these events to react to user actions and internal state changes.
41
- */
42
- const emit = defineEmits<{
43
- (e: 'connected'): void
44
- (e: 'disconnected', info?: { code?: number; reason?: string }): void
45
- (e: 'subscribed', info?: { reader?: string | null; withPhoto?: boolean }): void
46
- (e: 'unsubscribed'): void
47
- (e: 'inserted', payload: PatientRegisterPayload): void
48
- (e: 'removed'): void
49
- (e: 'error', err: unknown): void
50
- (e: 'message', msg: IdCardWsServerMessage): void
51
- }>()
52
-
53
- const host = useHostAgentWs()
54
-
55
- const reconnectTimer = ref<ReturnType<typeof setTimeout> | null>(null)
56
- const mounted = ref(false)
57
- const manuallyDisconnected = ref(false)
58
-
5
+ const props = defineProps({
6
+ withPhoto: { type: Boolean, required: false, default: false },
7
+ reader: { type: [String, null], required: false, default: null },
8
+ autoConnect: { type: Boolean, required: false, default: true },
9
+ autoSubscribe: { type: Boolean, required: false, default: true },
10
+ autoReconnect: { type: Boolean, required: false, default: false },
11
+ reconnectDelayMs: { type: Number, required: false, default: 1e3 }
12
+ });
13
+ const emit = defineEmits(["connected", "disconnected", "subscribed", "unsubscribed", "inserted", "removed", "error", "message"]);
14
+ const host = useHostAgentWs();
15
+ const reconnectTimer = ref(null);
16
+ const mounted = ref(false);
17
+ const manuallyDisconnected = ref(false);
59
18
  function clearReconnect() {
60
19
  if (reconnectTimer.value) {
61
- clearTimeout(reconnectTimer.value)
62
- reconnectTimer.value = null
20
+ clearTimeout(reconnectTimer.value);
21
+ reconnectTimer.value = null;
63
22
  }
64
23
  }
65
-
66
24
  function connectAndSubscribe() {
67
- manuallyDisconnected.value = false
68
- host.connectIdCardWs()
69
-
70
- // subscribe immediately; safe because connectIdCardWs sets handlers then WS opens soon
71
- // but we must wait until OPEN to send; so we subscribe on "open" event in handler below.
25
+ manuallyDisconnected.value = false;
26
+ host.connectIdCardWs();
72
27
  }
73
-
74
28
  function safeDisconnect() {
75
- manuallyDisconnected.value = true
76
- clearReconnect()
29
+ manuallyDisconnected.value = true;
30
+ clearReconnect();
77
31
  try {
78
- // best-effort unsubscribe (only if connected)
79
32
  if (host.wsConnected.value) {
80
- try { host.unsubscribeIdCardWs() } catch { /* ignore */ }
33
+ try {
34
+ host.unsubscribeIdCardWs();
35
+ } catch {
36
+ }
81
37
  }
82
- } catch { /* ignore */ }
83
- host.disconnectIdCardWs()
38
+ } catch {
39
+ }
40
+ host.disconnectIdCardWs();
84
41
  }
85
-
86
42
  const off = host.onIdCardWsEvent((ev) => {
87
- if (ev.type === 'open') {
88
- emit('connected')
89
-
43
+ if (ev.type === "open") {
44
+ emit("connected");
90
45
  if (props.autoSubscribe) {
91
46
  try {
92
- host.subscribeIdCardWs({ reader: props.reader ?? null, withPhoto: props.withPhoto })
47
+ host.subscribeIdCardWs({ reader: props.reader ?? null, withPhoto: props.withPhoto });
93
48
  } catch (e) {
94
- emit('error', e)
49
+ emit("error", e);
95
50
  }
96
51
  }
97
- return
52
+ return;
98
53
  }
99
-
100
- if (ev.type === 'close') {
101
- emit('disconnected', { code: ev.code, reason: ev.reason })
102
-
54
+ if (ev.type === "close") {
55
+ emit("disconnected", { code: ev.code, reason: ev.reason });
103
56
  if (props.autoReconnect && mounted.value && !manuallyDisconnected.value) {
104
- clearReconnect()
57
+ clearReconnect();
105
58
  reconnectTimer.value = setTimeout(() => {
106
59
  try {
107
- connectAndSubscribe()
60
+ connectAndSubscribe();
108
61
  } catch (e) {
109
- emit('error', e)
62
+ emit("error", e);
110
63
  }
111
- }, props.reconnectDelayMs)
64
+ }, props.reconnectDelayMs);
112
65
  }
113
- return
66
+ return;
114
67
  }
115
-
116
- if (ev.type === 'error') {
117
- emit('error', ev.error)
118
- return
68
+ if (ev.type === "error") {
69
+ emit("error", ev.error);
70
+ return;
119
71
  }
120
-
121
- if (ev.type === 'message') {
122
- const msg = ev.data
123
- emit('message', msg)
124
-
72
+ if (ev.type === "message") {
73
+ const msg = ev.data;
74
+ emit("message", msg);
125
75
  switch (msg.type) {
126
- case 'monitor.subscribed':
127
- if (msg.ok) emit('subscribed', { reader: msg.reader ?? null, withPhoto: !!msg.withPhoto })
128
- break
129
- case 'monitor.unsubscribed':
130
- emit('unsubscribed')
131
- break
132
- case 'card.inserted':
133
- emit('inserted', msg.payload)
134
- break
135
- case 'card.removed':
136
- emit('removed')
137
- break
138
- case 'card.error':
139
- case 'error':
140
- emit('error', msg)
141
- break
76
+ case "monitor.subscribed":
77
+ if (msg.ok) emit("subscribed", { reader: msg.reader ?? null, withPhoto: !!msg.withPhoto });
78
+ break;
79
+ case "monitor.unsubscribed":
80
+ emit("unsubscribed");
81
+ break;
82
+ case "card.inserted":
83
+ emit("inserted", msg.payload);
84
+ break;
85
+ case "card.removed":
86
+ emit("removed");
87
+ break;
88
+ case "card.error":
89
+ case "error":
90
+ emit("error", msg);
91
+ break;
142
92
  }
143
93
  }
144
- })
145
-
94
+ });
146
95
  onMounted(() => {
147
- mounted.value = true
148
- if (props.autoConnect) connectAndSubscribe()
149
- })
150
-
96
+ mounted.value = true;
97
+ if (props.autoConnect) connectAndSubscribe();
98
+ });
151
99
  onBeforeUnmount(() => {
152
- mounted.value = false
153
- try { off?.() } catch { /* ignore */ }
154
- safeDisconnect()
155
- })
156
-
157
- /**
158
- * If props change while connected, switch subscription behavior.
159
- * - withPhoto changes => re-subscribe (server treats subscribe twice as error), so do unsubscribe -> subscribe
160
- * - reader changes => use switchReader action when possible; if not connected, just store for next subscribe
161
- */
100
+ mounted.value = false;
101
+ try {
102
+ off?.();
103
+ } catch {
104
+ }
105
+ safeDisconnect();
106
+ });
162
107
  watch(
163
- () => props.reader,
164
- (r) => {
165
- if (!mounted.value) return
166
- if (!host.wsConnected.value) return
167
- if (!host.wsSubscribed.value) return
168
-
169
- try {
170
- host.switchReaderIdCardWs(r ?? null)
171
- } catch (e) {
172
- emit('error', e)
173
- }
108
+ () => props.reader,
109
+ (r) => {
110
+ if (!mounted.value) return;
111
+ if (!host.wsConnected.value) return;
112
+ if (!host.wsSubscribed.value) return;
113
+ try {
114
+ host.switchReaderIdCardWs(r ?? null);
115
+ } catch (e) {
116
+ emit("error", e);
174
117
  }
175
- )
176
-
118
+ }
119
+ );
177
120
  watch(
178
- () => props.withPhoto,
179
- (withPhoto) => {
180
- if (!mounted.value) return
181
- if (!host.wsConnected.value) return
182
-
183
- // Server disallows re-subscribe without unsubscribe first.
184
- // We do a clean unsubscribe -> resubscribe sequence.
121
+ () => props.withPhoto,
122
+ (withPhoto) => {
123
+ if (!mounted.value) return;
124
+ if (!host.wsConnected.value) return;
125
+ try {
126
+ if (host.wsSubscribed.value) {
127
+ host.unsubscribeIdCardWs();
128
+ }
129
+ } catch {
130
+ }
131
+ setTimeout(() => {
185
132
  try {
186
- if (host.wsSubscribed.value) {
187
- host.unsubscribeIdCardWs()
188
- }
189
- } catch { /* ignore */ }
190
-
191
- // resubscribe after a tick; give server a moment to process unsubscribe
192
- setTimeout(() => {
193
- try {
194
- if (host.wsConnected.value) {
195
- host.subscribeIdCardWs({ reader: props.reader ?? null, withPhoto })
196
- }
197
- } catch (e) {
198
- emit('error', e)
133
+ if (host.wsConnected.value) {
134
+ host.subscribeIdCardWs({ reader: props.reader ?? null, withPhoto });
199
135
  }
200
- }, 0)
201
- }
202
- )
136
+ } catch (e) {
137
+ emit("error", e);
138
+ }
139
+ }, 0);
140
+ }
141
+ );
203
142
  </script>
204
143
 
205
144
  <template>
@@ -0,0 +1,55 @@
1
+ import { type IdCardWsServerMessage, type PatientRegisterPayload } from '../../composables/hostAgent.js';
2
+ interface Props {
3
+ /** Subscribe withPhoto=true => server will push payload that includes photo when available */
4
+ withPhoto?: boolean;
5
+ /** Optional reader name; null/undefined means "any/default" */
6
+ reader?: string | null;
7
+ /** Auto-connect on mount (default true) */
8
+ autoConnect?: boolean;
9
+ /** Auto-subscribe after connect (default true) */
10
+ autoSubscribe?: boolean;
11
+ /** If true, try to reconnect when socket closes unexpectedly */
12
+ autoReconnect?: boolean;
13
+ /** Reconnect delay in ms */
14
+ reconnectDelayMs?: number;
15
+ }
16
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
17
+ message: (msg: IdCardWsServerMessage) => any;
18
+ error: (err: unknown) => any;
19
+ connected: () => any;
20
+ disconnected: (info?: {
21
+ code?: number;
22
+ reason?: string;
23
+ } | undefined) => any;
24
+ subscribed: (info?: {
25
+ reader?: string | null;
26
+ withPhoto?: boolean;
27
+ } | undefined) => any;
28
+ unsubscribed: () => any;
29
+ inserted: (payload: PatientRegisterPayload) => any;
30
+ removed: () => any;
31
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
32
+ onMessage?: ((msg: IdCardWsServerMessage) => any) | undefined;
33
+ onError?: ((err: unknown) => any) | undefined;
34
+ onConnected?: (() => any) | undefined;
35
+ onDisconnected?: ((info?: {
36
+ code?: number;
37
+ reason?: string;
38
+ } | undefined) => any) | undefined;
39
+ onSubscribed?: ((info?: {
40
+ reader?: string | null;
41
+ withPhoto?: boolean;
42
+ } | undefined) => any) | undefined;
43
+ onUnsubscribed?: (() => any) | undefined;
44
+ onInserted?: ((payload: PatientRegisterPayload) => any) | undefined;
45
+ onRemoved?: (() => any) | undefined;
46
+ }>, {
47
+ reader: string | null;
48
+ withPhoto: boolean;
49
+ autoConnect: boolean;
50
+ autoSubscribe: boolean;
51
+ autoReconnect: boolean;
52
+ reconnectDelayMs: number;
53
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
54
+ declare const _default: typeof __VLS_export;
55
+ export default _default;
@@ -0,0 +1,66 @@
1
+ import type { Base64File } from '../../composables/assetFile.js';
2
+ interface Props {
3
+ feeder?: boolean;
4
+ duplex?: boolean;
5
+ dpi?: number;
6
+ quality?: number;
7
+ /** UI string: 'color' | 'grey' | 'bw' */
8
+ color?: string;
9
+ maxSize?: number;
10
+ }
11
+ declare function performScan(): Promise<void>;
12
+ /**
13
+ * ✅ Upload helpers (restored)
14
+ */
15
+ declare function fileToBase64(file: File): Promise<Base64File>;
16
+ declare function performFileUpload(files: File | File[] | undefined): void;
17
+ declare var __VLS_1: {
18
+ scannerOptions: {
19
+ deviceName?: string | null | undefined;
20
+ driver?: (import("../../composables/hostAgent.js").Driver | null) | undefined;
21
+ paperSource?: import("../../composables/hostAgent.js").PaperSource | undefined;
22
+ pageSize?: string | null | undefined;
23
+ dpi: number;
24
+ bitDepth?: import("../../composables/hostAgent.js").BitDepth | undefined;
25
+ quality?: number | undefined;
26
+ maxQuality?: boolean | undefined;
27
+ autoDeskew?: boolean | undefined;
28
+ excludeBlankPages?: boolean | undefined;
29
+ brightness?: number | undefined;
30
+ contrast?: number | undefined;
31
+ };
32
+ configHelper: {
33
+ feeder: boolean;
34
+ duplex: boolean;
35
+ color: string;
36
+ };
37
+ operation: {
38
+ performScan: typeof performScan;
39
+ performFileUpload: typeof performFileUpload;
40
+ fileToBase64: typeof fileToBase64;
41
+ };
42
+ isScanning: boolean;
43
+ };
44
+ type __VLS_Slots = {} & {
45
+ default?: (props: typeof __VLS_1) => any;
46
+ };
47
+ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
48
+ scan: (files: Base64File[]) => any;
49
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
50
+ onScan?: ((files: Base64File[]) => any) | undefined;
51
+ }>, {
52
+ color: string;
53
+ duplex: boolean;
54
+ feeder: boolean;
55
+ dpi: number;
56
+ quality: number;
57
+ maxSize: number;
58
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
59
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
60
+ declare const _default: typeof __VLS_export;
61
+ export default _default;
62
+ type __VLS_WithSlots<T, S> = T & {
63
+ new (): {
64
+ $slots: S;
65
+ };
66
+ };