@fewangsit/wangsvue-fats 1.0.1-rc.0 → 1.0.1-rc.11

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 (242) hide show
  1. package/animation/index.es.js +50 -0
  2. package/approverinfo/index.es.js +6 -6
  3. package/assetinfo/index.es.js +160 -2
  4. package/backgroundimagecropper/{BackgroundImageCropper.es.js → index.es.js} +1 -1
  5. package/badge/index.es.js +7 -7
  6. package/badgegroup/index.es.js +7 -7
  7. package/basecalendar/{BaseCalendar.es.js → index.es.js} +6 -6
  8. package/basetree/index.es.js +14 -14
  9. package/breadcrumb/index.es.js +6 -6
  10. package/button/index.es.js +118 -2
  11. package/buttonaddbyscan/index.es.js +13 -13
  12. package/buttonbulkaction/index.es.js +184 -2
  13. package/buttoncopy/index.es.js +6 -6
  14. package/buttondownload/index.es.js +15 -15
  15. package/buttonfilter/index.es.js +6 -6
  16. package/buttonradio/index.es.js +2 -2
  17. package/buttonscan/index.es.js +414 -2
  18. package/buttonsearch/index.es.js +9 -9
  19. package/buttonsearchbyscan/index.es.js +7 -7
  20. package/buttonselecttree/index.es.js +22 -22
  21. package/buttonselectuser/index.es.js +25 -25
  22. package/buttonsync/index.es.js +12 -12
  23. package/buttontoggle/index.es.js +6 -6
  24. package/buttonviewlog/index.es.js +2 -2
  25. package/calendar/index.es.js +4 -4
  26. package/card/index.es.js +4 -4
  27. package/carousel/index.es.js +7 -7
  28. package/checkbox/index.es.js +2 -2
  29. package/codesnippet/{CodeSnippet.es.js → index.es.js} +1 -1
  30. package/codesnippetadapter/{CodeSnippetAdapter.es.js → index.es.js} +1 -1
  31. package/columnlist/{ColumnList.es.js → index.es.js} +8 -8
  32. package/config/defaultProps.es.js +133 -0
  33. package/config/index.es.js +10 -218
  34. package/config/locale.es.js +85 -0
  35. package/customcolumn/index.es.js +8 -8
  36. package/datatable/index.es.js +108 -107
  37. package/datepicker/index.es.js +138 -2
  38. package/daypicker/index.es.js +6 -6
  39. package/dialog/index.es.js +4 -4
  40. package/dialogassetnamedetail/index.es.js +11 -11
  41. package/dialogbasictransferlog/{DialogBasicTransferLog.es.js → index.es.js} +17 -17
  42. package/dialogconfirm/index.es.js +17 -17
  43. package/dialogdamagelog/index.es.js +14 -14
  44. package/dialogform/index.es.js +32 -32
  45. package/dialogfulltransferlog/{DialogFullTransferLog.es.js → index.es.js} +16 -16
  46. package/dialoglinkedasset/index.es.js +9 -9
  47. package/dialogprintqr/index.es.js +332 -2
  48. package/dialogreportdamage/index.es.js +12 -12
  49. package/dialogreportmissing/index.es.js +12 -12
  50. package/dialogreporttag/index.es.js +8 -8
  51. package/dialogselecttree/index.es.js +13 -13
  52. package/dialogselectuser/index.d.ts +2 -2
  53. package/dialogselectuser/index.es.js +18 -18
  54. package/dialogselectuserfilter/{DialogSelectUserFilter.es.js → index.es.js} +2 -2
  55. package/dialogtransferlog/index.es.js +9 -9
  56. package/directives/{focus/index.es.js → focus.es.js} +2 -2
  57. package/directives/index.es.js +2 -0
  58. package/directives/tooltip.es.js +1 -0
  59. package/disposalreport/index.es.js +8 -8
  60. package/disposalreportbulkaction/{DisposalReportBulkAction.es.js → index.es.js} +9 -8
  61. package/disposalreporttable/{DisposalReportTable.es.js → index.es.js} +16 -16
  62. package/disposalreporttablefilter/{DisposalReportTableFilter.es.js → index.es.js} +5 -5
  63. package/dropdown/index.es.js +37 -37
  64. package/editor/{Editor.es.js → index.es.js} +57 -57
  65. package/editorbutton/{EditorButton.es.js → index.es.js} +1 -1
  66. package/event-bus/index.es.js +4 -3
  67. package/event-bus/mitt.es.js +53 -0
  68. package/fieldwrapper/{FieldWrapper.es.js → index.es.js} +2 -2
  69. package/fileupload/index.es.js +13 -13
  70. package/filtercontainer/index.es.js +34 -34
  71. package/form/index.es.js +23 -23
  72. package/hardwaresync/{HardwareSync.es.js → index.es.js} +42 -42
  73. package/icon/index.es.js +4 -4
  74. package/image/index.es.js +14 -14
  75. package/imagecompressor/index.es.js +14 -14
  76. package/imageinputinfo/{ImageInputInfo.es.js → index.es.js} +2 -2
  77. package/inlinemessage/index.es.js +7 -7
  78. package/inputbadge/index.es.js +14 -14
  79. package/inputcurrency/index.es.js +147 -2
  80. package/inputemail/index.es.js +4 -4
  81. package/inputnumber/index.es.js +6 -6
  82. package/inputotp/index.es.js +1 -1
  83. package/inputpassword/index.es.js +10 -10
  84. package/inputphonenumber/index.es.js +28 -28
  85. package/inputrangenumber/index.es.js +9 -9
  86. package/inputsearch/index.es.js +2 -2
  87. package/inputtext/index.es.js +11 -11
  88. package/inputurl/index.es.js +5 -5
  89. package/invisiblefield/index.es.js +8 -8
  90. package/languagedropdownoption/{LanguageDropdownOption.es.js → index.es.js} +3 -3
  91. package/languageswitcher/index.es.js +7 -7
  92. package/litedropdown/index.es.js +10 -10
  93. package/loading/index.es.js +8 -8
  94. package/mentionlist/{MentionList.es.js → index.es.js} +4 -4
  95. package/menu/index.es.js +20 -19
  96. package/menuitem/{MenuItem.es.js → index.es.js} +1 -1
  97. package/multiselect/index.es.js +27 -27
  98. package/overlaypanel/index.es.js +6 -6
  99. package/package.json +1 -5
  100. package/paginator/index.es.js +11 -11
  101. package/plugins/VueHtmlToPaper.es.js +40 -0
  102. package/{animation/Animation.es.js → plugins/WangsVue.es.js} +38 -83
  103. package/plugins/basei18n.d.ts +103 -0
  104. package/plugins/basei18n.es.js +88 -0
  105. package/plugins/{formValidation/index.es.js → formValidation.es.js} +4 -4
  106. package/plugins/i18n.d.ts +5 -102
  107. package/plugins/i18n.es.js +6 -0
  108. package/stats.html +1 -1
  109. package/steps/index.es.js +4 -4
  110. package/tabmenu/index.es.js +1 -1
  111. package/tagtype/index.es.js +6 -6
  112. package/textarea/index.es.js +5 -5
  113. package/timeline/index.es.js +5 -5
  114. package/timelinecontentbytype/{TimelineContentByType.es.js → index.es.js} +9 -9
  115. package/toast/index.es.js +3 -3
  116. package/toggleswitch/index.es.js +2 -2
  117. package/transactionroles/index.es.js +2 -2
  118. package/tree/index.es.js +117 -107
  119. package/treenode/{TreeNode.es.js → index.es.js} +4 -4
  120. package/treesearchinput/{TreeSearchInput.es.js → index.es.js} +4 -4
  121. package/username/index.es.js +20 -20
  122. package/userwithicon/index.es.js +4 -4
  123. package/utils/baseToast.util.es.js +1 -1
  124. package/utils/date.util.es.js +2 -2
  125. package/utils/index.es.js +3 -36
  126. package/utils/role.util.es.js +2 -2
  127. package/validatormessage/index.es.js +4 -4
  128. package/vendor/highlight.js/es/core.es.js +1 -1
  129. package/vendor/lodash/_freeGlobal.es.js +1 -1
  130. package/vendor/simplebar-core/dist/index.es.js +1 -1
  131. package/wangsvue-fats.d.ts +1 -2
  132. package/wangsvue-fats.es.js +219 -256
  133. package/wangsvue-fats.system.js +56 -56
  134. package/approverinfo/package.json +0 -4
  135. package/assetinfo/AssetInfo.es.js +0 -179
  136. package/assetinfo/package.json +0 -4
  137. package/badge/package.json +0 -4
  138. package/badgegroup/package.json +0 -4
  139. package/basetree/package.json +0 -4
  140. package/breadcrumb/package.json +0 -4
  141. package/button/Button.es.js +0 -120
  142. package/button/package.json +0 -4
  143. package/buttonaddbyscan/package.json +0 -4
  144. package/buttonbulkaction/ButtonBulkAction.es.js +0 -238
  145. package/buttonbulkaction/package.json +0 -4
  146. package/buttoncopy/package.json +0 -4
  147. package/buttondownload/package.json +0 -4
  148. package/buttonfilter/package.json +0 -4
  149. package/buttonradio/package.json +0 -4
  150. package/buttonscan/ButtonScan.es.js +0 -416
  151. package/buttonscan/package.json +0 -4
  152. package/buttonsearch/package.json +0 -4
  153. package/buttonsearchbyscan/package.json +0 -4
  154. package/buttonselecttree/package.json +0 -4
  155. package/buttonselectuser/package.json +0 -4
  156. package/buttonsync/package.json +0 -4
  157. package/buttontoggle/package.json +0 -4
  158. package/buttonviewlog/package.json +0 -4
  159. package/calendar/package.json +0 -4
  160. package/card/package.json +0 -4
  161. package/carousel/package.json +0 -4
  162. package/checkbox/package.json +0 -4
  163. package/config/package.json +0 -4
  164. package/customcolumn/package.json +0 -4
  165. package/datatable/package.json +0 -4
  166. package/datepicker/DatePicker.es.js +0 -224
  167. package/datepicker/package.json +0 -4
  168. package/daypicker/package.json +0 -4
  169. package/dialog/package.json +0 -4
  170. package/dialogassetnamedetail/package.json +0 -4
  171. package/dialogconfirm/package.json +0 -4
  172. package/dialogdamagelog/package.json +0 -4
  173. package/dialogform/package.json +0 -4
  174. package/dialoglinkedasset/package.json +0 -4
  175. package/dialogprintqr/DialogPrintQR.es.js +0 -334
  176. package/dialogprintqr/package.json +0 -4
  177. package/dialogreportdamage/package.json +0 -4
  178. package/dialogreportmissing/package.json +0 -4
  179. package/dialogreporttag/package.json +0 -4
  180. package/dialogselecttree/package.json +0 -4
  181. package/dialogselectuser/package.json +0 -4
  182. package/dialogtransferlog/package.json +0 -4
  183. package/directives/focus/package.json +0 -4
  184. package/directives/tooltip/index.es.js +0 -4
  185. package/directives/tooltip/package.json +0 -4
  186. package/disposalreport/package.json +0 -4
  187. package/dropdown/package.json +0 -4
  188. package/event-bus/package.json +0 -4
  189. package/fileupload/package.json +0 -4
  190. package/filtercontainer/package.json +0 -4
  191. package/form/package.json +0 -4
  192. package/icon/package.json +0 -4
  193. package/image/package.json +0 -4
  194. package/imagecompressor/package.json +0 -4
  195. package/index.d.ts +0 -2
  196. package/inlinemessage/package.json +0 -4
  197. package/inputbadge/package.json +0 -4
  198. package/inputcurrency/InputCurrency.es.js +0 -150
  199. package/inputcurrency/helpers/index.es.js +0 -5
  200. package/inputcurrency/helpers/package.json +0 -4
  201. package/inputcurrency/package.json +0 -4
  202. package/inputemail/package.json +0 -4
  203. package/inputnumber/package.json +0 -4
  204. package/inputotp/package.json +0 -4
  205. package/inputpassword/package.json +0 -4
  206. package/inputphonenumber/package.json +0 -4
  207. package/inputrangenumber/package.json +0 -4
  208. package/inputsearch/package.json +0 -4
  209. package/inputtext/package.json +0 -4
  210. package/inputurl/package.json +0 -4
  211. package/invisiblefield/package.json +0 -4
  212. package/languageswitcher/package.json +0 -4
  213. package/litedropdown/package.json +0 -4
  214. package/loading/package.json +0 -4
  215. package/loading/store/index.es.js +0 -5
  216. package/loading/store/package.json +0 -4
  217. package/menu/package.json +0 -4
  218. package/multiselect/package.json +0 -4
  219. package/overlaypanel/package.json +0 -4
  220. package/paginator/package.json +0 -4
  221. package/plugins/formValidation/package.json +0 -4
  222. package/plugins/i18n/index.es.js +0 -8
  223. package/plugins/i18n/package.json +0 -4
  224. package/plugins/i18n-extension.d.ts +0 -4
  225. package/steps/package.json +0 -4
  226. package/tabmenu/package.json +0 -4
  227. package/tagtype/package.json +0 -4
  228. package/textarea/package.json +0 -4
  229. package/timeline/package.json +0 -4
  230. package/toast/package.json +0 -4
  231. package/toast/service/index.es.js +0 -5
  232. package/toast/service/package.json +0 -4
  233. package/toggleswitch/package.json +0 -4
  234. package/transactionroles/package.json +0 -4
  235. package/tree/package.json +0 -4
  236. package/username/package.json +0 -4
  237. package/userwithicon/package.json +0 -4
  238. package/utils/package.json +0 -4
  239. package/validatormessage/package.json +0 -4
  240. /package/inputgroup/{InputGroup.es.js → index.es.js} +0 -0
  241. /package/mentionsection/{MentionSection.es.js → index.es.js} +0 -0
  242. /package/multirow/{MultiRow.es.js → index.es.js} +0 -0
@@ -1,4 +1,416 @@
1
- import { _ as f } from "./ButtonScan.es.js";
1
+ import { AxiosError as ye } from "axios";
2
+ import { ref as re, defineComponent as _e, onBeforeUnmount as Re, shallowRef as v, computed as E, createElementBlock as D, openBlock as u, Fragment as F, createVNode as b, createBlock as M, createCommentVNode as U, mergeProps as De, withCtx as ke, createElementVNode as C, normalizeClass as ee, createTextVNode as se, toDisplayString as A, Teleport as Ne } from "vue";
3
+ import { ChangelogServices as he } from "@tagsamurai/fats-api-services";
4
+ import { u as Ie } from "../utils/baseToast.util.es.js";
5
+ import { _ as ne } from "../button/index.es.js";
6
+ import { _ as Ee } from "../dialogconfirm/index.es.js";
7
+ import { _ as Ce } from "../hardwaresync/index.es.js";
8
+ import { _ as $ } from "../icon/index.es.js";
9
+ import { _ as z } from "../toast/index.es.js";
10
+ import { v as J } from "../vendor/uuid/dist/esm-browser/v4.es.js";
11
+ const Oe = (a) => {
12
+ if (a instanceof ye)
13
+ return a.response ? "DEVICE_NOT_CONNECTED" : "DRIVER_NOT_FOUND";
14
+ if (a instanceof Error && ["NOT_SUPPORTED_SYSTEM", "HARDWARE_NOT_SYNCHRONIZED"].includes(
15
+ a.message
16
+ ))
17
+ return a.message;
18
+ }, ce = `(function(){"use strict";let n=null,t=null,a;self.onmessage=s=>{const e=s.data;switch(e.command){case"sync":u(e);break;case"connect":l(e);break;case"scan":m(e);break;case"stopscan":d(e);break}};const r=s=>{let e="established";n&&n.readyState===WebSocket.OPEN?(e="reused",s.onopen(n,e),i(s.timeout)):n=new WebSocket("wss://dev-api.tagsamurai.com/rfid-reader-go/"),n.onopen=()=>{e="established",n&&s.onopen(n,e),i(s.timeout)},n.onmessage=o=>{s.onmessage(o),i(s.timeout)},n.onerror=o=>{console.error("🚀 ~ Scanner Worker: openConnection ~ error:",o),s.onerror(o),n==null||n.close(),n=null,t&&clearTimeout(t)}},p=()=>{d({userId:a}),a=void 0,n&&n.close(),n=null,t&&clearTimeout(t),console.info("Socket connection has been closed!")},i=(s=0)=>{s&&(t&&clearTimeout(t),t=setTimeout(p,s))},u=({userId:s})=>{a=s,r({onopen:e=>{e.send(JSON.stringify({data:{command:"connect",userId:s,source:"app"},event:"reader"}))},onmessage:e=>{postMessage({status:"synced",...JSON.parse(e.data)})},onerror:e=>{postMessage({status:"sync_error",error:e})}})},l=({userId:s})=>{a=s,r({onopen:(e,o)=>{o==="established"?e.send(JSON.stringify({data:{command:"connect",userId:s,source:"app"},event:"reader"})):postMessage({status:"connection_reused"})},onmessage:e=>{postMessage({status:"connection_established",...JSON.parse(e.data)})},onerror:e=>{postMessage({status:"error_connecting",error:e})}})},m=({scanCommand:s,userId:e,serialNumber:o,jenisDevice:g})=>{a=e,r({onopen:c=>{c.send(JSON.stringify({data:{command:s,userId:e,source:"app",serialNumber:o,jenisDevice:g},event:"reader"})),postMessage({status:"scan_started"})},onmessage:c=>{postMessage({status:"scanned",...JSON.parse(c.data)})},onerror:c=>{postMessage({status:"scan_error",error:c})}})},d=({userId:s})=>{n&&n.readyState===WebSocket.OPEN&&(n.send(JSON.stringify({data:{command:"stopscan",userId:s,source:"app"},event:"reader"})),postMessage({status:"scan_stopped"}),console.info("Scan Process Stopped!"))}})();
19
+ `, te = typeof self < "u" && self.Blob && new Blob([ce], { type: "text/javascript;charset=utf-8" });
20
+ function Te(a) {
21
+ let l;
22
+ try {
23
+ if (l = te && (self.URL || self.webkitURL).createObjectURL(te), !l) throw "";
24
+ const m = new Worker(l, {
25
+ name: a == null ? void 0 : a.name
26
+ });
27
+ return m.addEventListener("error", () => {
28
+ (self.URL || self.webkitURL).revokeObjectURL(l);
29
+ }), m;
30
+ } catch {
31
+ return new Worker(
32
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(ce),
33
+ {
34
+ name: a == null ? void 0 : a.name
35
+ }
36
+ );
37
+ } finally {
38
+ l && (self.URL || self.webkitURL).revokeObjectURL(l);
39
+ }
40
+ }
41
+ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null, QR: null }, oe = re(ie()), ae = re(xe()), Be = () => {
42
+ const a = (s) => {
43
+ window.devices = s, m();
44
+ }, l = (s) => {
45
+ window.device = s, ae.value = s;
46
+ }, m = () => {
47
+ oe.value = ie();
48
+ };
49
+ return {
50
+ devices: oe,
51
+ device: ae,
52
+ saveDevices: a,
53
+ setDevice: l,
54
+ loadDevices: m
55
+ };
56
+ }, Le = { class: "flex gap-2 items-center" }, We = { class: "flex gap-0.5 items-center leading-4" }, Fe = { class: "flex gap-5 items-center" }, Me = {
57
+ key: 1,
58
+ class: "text-xs font-medium leading-[16.39px] tracking-[0.02em]"
59
+ }, He = /* @__PURE__ */ _e({
60
+ __name: "ButtonScan",
61
+ props: {
62
+ label: {},
63
+ icon: {},
64
+ type: { default: "RFID" },
65
+ autoSwitch: { type: Boolean },
66
+ scanValidation: {},
67
+ modelValue: {},
68
+ bulk: { type: Boolean },
69
+ id: {},
70
+ disabled: { type: Boolean },
71
+ powerbank: { type: Boolean },
72
+ labelOnly: { type: Boolean },
73
+ outlined: { type: Boolean },
74
+ severity: {},
75
+ size: { default: void 0 },
76
+ style: {},
77
+ class: {},
78
+ iconPos: {},
79
+ iconClass: {},
80
+ tooltip: {},
81
+ tooltipPos: {},
82
+ badge: {},
83
+ badgeClass: {},
84
+ badgeSeverity: {},
85
+ loading: { type: Boolean },
86
+ loadingIcon: {},
87
+ link: { type: Boolean },
88
+ raised: { type: Boolean },
89
+ rounded: { type: Boolean },
90
+ text: { type: Boolean },
91
+ plain: { type: Boolean }
92
+ },
93
+ emits: ["update:modelValue", "connect", "connected", "scan", "stop", "error", "beforeStartScan"],
94
+ setup(a, { expose: l, emit: m }) {
95
+ const s = a, r = m;
96
+ Re(() => {
97
+ X();
98
+ });
99
+ const c = Ie(), { devices: le, device: S, saveDevices: ue, setDevice: G } = Be(), w = v(!1), O = v(!1), k = v(!1), N = v(!1), y = v(!1), V = v(!1), f = v(), H = v(0), o = v(s.type ?? "RFID"), P = [], T = E(
100
+ () => o.value === "RFID" ? "RFID_Scanning" : "QR_Scanning"
101
+ ), g = E(
102
+ () => o.value === "RFID" ? "RFID_Connecting" : "QR_Connecting"
103
+ );
104
+ E(() => `The scanner could not identify the ${o.value} code. It may be damaged or improperly positioned. Please check the code and try again.`);
105
+ const de = () => {
106
+ window.scannerWorker ?? (window.scannerWorker = new Te());
107
+ }, x = () => {
108
+ const { serialNumber: e = "" } = S.value[o.value] ?? {};
109
+ return e;
110
+ }, q = async () => {
111
+ try {
112
+ de(), await ve(), w.value = !0;
113
+ } catch (e) {
114
+ console.error(e), w.value = !1;
115
+ }
116
+ }, ve = async () => {
117
+ var e;
118
+ try {
119
+ if (!ge())
120
+ throw new Error("NOT_SUPPORTED_SYSTEM");
121
+ if (r("connect"), !le.value.length || !S.value[o.value])
122
+ throw new Error("HARDWARE_NOT_SYNCHRONIZED");
123
+ c.add({
124
+ customMessage: !0,
125
+ message: o.value === "QR" ? "Connecting QR Scanner..." : "Connecting RFID Scanner...",
126
+ severity: "info",
127
+ life: 0,
128
+ group: g.value
129
+ }), k.value = !0;
130
+ const t = () => {
131
+ r("connected", S.value[o.value]), setTimeout(() => {
132
+ Q();
133
+ }, 0);
134
+ };
135
+ window.scannerWorker.onmessage = ({ data: n }) => {
136
+ var _;
137
+ if (n.status === "connection_established")
138
+ try {
139
+ const { error: p } = (n == null ? void 0 : n.data) ?? {}, i = ((_ = n == null ? void 0 : n.data) == null ? void 0 : _.deviceList) ?? [], R = S.value[s.type], d = i.some(
140
+ (W) => W.serialNumber === (R == null ? void 0 : R.serialNumber)
141
+ );
142
+ if (i.length && d)
143
+ t();
144
+ else {
145
+ if (p === "Driver not connected to server")
146
+ throw new Error("DRIVER_NOT_FOUND");
147
+ if (!i.length)
148
+ throw new Error("DEVICE_NOT_CONNECTED");
149
+ }
150
+ c.removeGroup(g.value);
151
+ } catch (p) {
152
+ Y(p);
153
+ }
154
+ else n.status === "connection_reused" ? t() : n.status === "error_connecting" && (c.removeGroup(g.value), c.add({
155
+ customMessage: !0,
156
+ message: "Scanner connection failed",
157
+ severity: "error"
158
+ }));
159
+ }, window.scannerWorker.postMessage({
160
+ command: "connect",
161
+ userId: (e = JSON.parse(localStorage.getItem("user") ?? "{}")) == null ? void 0 : e._id
162
+ });
163
+ } catch (t) {
164
+ Y(t);
165
+ }
166
+ }, Q = (e = !1, t = !1) => {
167
+ var _;
168
+ V.value = !1, c.removeGroup(g.value), localStorage.devmode || (window.addEventListener("blur", L), window.addEventListener("beforeunload", L));
169
+ const n = S.value[o.value];
170
+ if (n) {
171
+ let p = "";
172
+ s.bulk ? p = `bulkscan-${o.value.toLowerCase()}` : p = `scan-${o.value.toLowerCase()}`, window.scannerWorker.onmessage = async ({ data: i }) => {
173
+ var R;
174
+ if (i.status === "scan_started")
175
+ t || (H.value++, setTimeout(() => {
176
+ c.add({
177
+ customMessage: !0,
178
+ message: "scanning",
179
+ severity: "info",
180
+ life: 0,
181
+ group: T.value
182
+ });
183
+ }, 0));
184
+ else if (i.status === "scanned") {
185
+ const { code: d, error: W, deviceList: we } = (i == null ? void 0 : i.data) ?? {};
186
+ if (W) return me(W, we);
187
+ if (d) {
188
+ if (["scan-rfid", "scan-qr"].includes(p)) {
189
+ y.value = !!s.scanValidation;
190
+ const j = await ((R = s.scanValidation) == null ? void 0 : R.call(
191
+ s,
192
+ o.value,
193
+ d,
194
+ x()
195
+ )) ?? !0;
196
+ if (y.value = !1, j)
197
+ s.autoSwitch ? (K(), fe()) : h(!0);
198
+ else {
199
+ V.value || Q(!1, !0);
200
+ return;
201
+ }
202
+ }
203
+ if (!P.includes(d)) {
204
+ try {
205
+ he.postScanLog({
206
+ tag: d,
207
+ serialNumber: x()
208
+ });
209
+ } catch (j) {
210
+ console.error(j);
211
+ }
212
+ r("update:modelValue", d), r("scan", d, x()), s.bulk && P.push(d);
213
+ }
214
+ }
215
+ } else i.status === "scan_stopped" ? h(!0) : i.status === "scan_error" && Z(i.error);
216
+ }, window.scannerWorker.onerror = Z, window.scannerWorker.postMessage({
217
+ command: "scan",
218
+ scanCommand: p,
219
+ userId: (_ = JSON.parse(localStorage.getItem("user") ?? "{}")) == null ? void 0 : _._id,
220
+ source: "app",
221
+ jenisDevice: n.jenisDevice,
222
+ serialNumber: n.serialNumber,
223
+ newConnection: e
224
+ });
225
+ }
226
+ }, Y = (e) => {
227
+ G({ RFID: void 0, QR: void 0 }), N.value = !0, f.value = e instanceof Error ? e.message : Oe(e), k.value = !1, r("error", e), c.removeGroup(g.value);
228
+ }, me = (e, t = []) => {
229
+ let n = "";
230
+ f.value = void 0, I(!0), e === "Time out" ? n = "The scanning process has timed out. Please try again." : e === "Driver not connected to server" ? f.value = "DRIVER_NOT_FOUND" : e === "Device disconnected" && (f.value = "DEVICE_DISCONNECTED", ue(t), G({ RFID: void 0, QR: void 0 })), r("error", e), N.value = !!f.value, n && c.add({
231
+ customMessage: !0,
232
+ message: n,
233
+ error: e,
234
+ life: 6e3,
235
+ group: T.value
236
+ });
237
+ }, Z = (e) => {
238
+ I(!0), r("error", e), c.add({
239
+ customMessage: !0,
240
+ message: "An unexpected error occurred during scanning. Please try again, and if the issue persists, contact your administrator for assistance.",
241
+ error: e,
242
+ life: 6e3,
243
+ group: T.value
244
+ });
245
+ }, B = () => {
246
+ window.Cypress ? pe() : q();
247
+ }, pe = () => {
248
+ c.add({
249
+ customMessage: !0,
250
+ message: "Connecting device...",
251
+ severity: "info",
252
+ life: 3e3,
253
+ group: g.value
254
+ }), setTimeout(async () => {
255
+ var e;
256
+ if (r("connect"), r("connected", {
257
+ jenisDevice: "Handheld",
258
+ serialNumber: J(),
259
+ API: "v2",
260
+ rfidScan: !0,
261
+ qrScan: !0,
262
+ name: "Device Test"
263
+ }), s.bulk)
264
+ r("scan", J(), "serialNumber");
265
+ else {
266
+ const t = J();
267
+ y.value = !!s.scanValidation;
268
+ const n = await ((e = s.scanValidation) == null ? void 0 : e.call(
269
+ s,
270
+ o.value,
271
+ t,
272
+ x()
273
+ )) ?? !0;
274
+ y.value = !1, n && (r("scan", t, "serialNumber"), h());
275
+ }
276
+ }, 100);
277
+ }, K = () => {
278
+ c.removeGroup("RFID_Scanning"), c.removeGroup("QR_Scanning");
279
+ }, h = (e = !1) => {
280
+ K(), k.value = !1, X(), e && r("stop"), P.splice(0);
281
+ }, I = (e = !1) => {
282
+ var t;
283
+ window.scannerWorker.onmessage = null, window.scannerWorker.postMessage({
284
+ command: "stopscan",
285
+ userId: (t = JSON.parse(localStorage.getItem("user") ?? "{}")) == null ? void 0 : t._id
286
+ }), h(e), V.value = !0, w.value = !1;
287
+ }, fe = () => {
288
+ s.bulk || (S.value[o.value] ? (o.value = o.value === "QR" ? "RFID" : "QR", Q()) : (h(), N.value = !0, f.value = "HARDWARE_NOT_SYNCHRONIZED", k.value = !1));
289
+ }, L = (e) => {
290
+ O.value = !0, I(!0), e.preventDefault();
291
+ }, X = () => {
292
+ window.removeEventListener("blur", L), window.removeEventListener("beforeunload", L);
293
+ }, ge = () => {
294
+ const { userAgent: e } = navigator;
295
+ return e.includes("Windows");
296
+ }, be = E(() => {
297
+ if (!s.labelOnly)
298
+ return s.icon ? s.icon : s.autoSwitch ? "qr-scan" : o.value === "QR" ? "qr" : "rfid";
299
+ }), Se = E(() => s.label ? s.label : s.autoSwitch ? "SCAN TAG" : o.value === "QR" ? "Scan QR" : "Scan RFID");
300
+ return l({
301
+ onBeforeStartScan: B,
302
+ startScan: q,
303
+ stopScan: I
304
+ }), (e, t) => (u(), D(F, null, [
305
+ b(ne, De(e.$attrs, {
306
+ class: [
307
+ {
308
+ "[&_i]:w-2 [&_i]:h-2": e.type === "QR",
309
+ "[&_i]:w-[11px] [&_i]:h-[7px]": e.type === "RFID"
310
+ },
311
+ "!px-1.5"
312
+ ],
313
+ disabled: s.disabled,
314
+ icon: be.value,
315
+ label: Se.value,
316
+ outlined: s.outlined,
317
+ severity: s.severity,
318
+ size: s.size,
319
+ onClick: B
320
+ }), null, 16, ["class", "disabled", "icon", "label", "outlined", "severity", "size"]),
321
+ b(Ce, {
322
+ visible: N.value,
323
+ "onUpdate:visible": t[0] || (t[0] = (n) => N.value = n),
324
+ bulk: e.bulk,
325
+ "error-code": f.value,
326
+ "search-by": o.value,
327
+ onScan: B
328
+ }, null, 8, ["visible", "bulk", "error-code", "search-by"]),
329
+ w.value ? (u(), M(z, {
330
+ key: 0,
331
+ "base-z-index": 9983,
332
+ group: g.value,
333
+ icon: "info"
334
+ }, null, 8, ["group"])) : U("", !0),
335
+ w.value ? (u(), M(z, {
336
+ key: 1,
337
+ "base-z-index": 9997,
338
+ class: "!absolute !bottom-[80px] !h-max",
339
+ group: "scan-error-validation"
340
+ })) : U("", !0),
341
+ w.value ? (u(), M(z, {
342
+ key: H.value,
343
+ "base-z-index": 9984,
344
+ group: T.value,
345
+ class: "[&_[data-pc-section=buttoncontainer]]"
346
+ }, {
347
+ message: ke(({ message: n }) => [
348
+ C("div", {
349
+ class: ee(
350
+ n.detail == "scanning" ? "w-full -mr-8 z-10 flex gap-2 justify-between items-center text-general-800 text-xs font-normal" : "w-full"
351
+ )
352
+ }, [
353
+ n.detail === "scanning" ? (u(), D(F, { key: 0 }, [
354
+ C("section", Le, [
355
+ b($, {
356
+ class: "animate-spin text-base",
357
+ icon: "loader-4"
358
+ }),
359
+ C("span", We, [
360
+ o.value === "RFID" ? (u(), D(F, { key: 0 }, [
361
+ b($, {
362
+ class: "text-base !w-4 !h-4",
363
+ icon: "rfid"
364
+ }),
365
+ se(" " + A(y.value ? "Validating RFID..." : "RFID Scanning..."), 1)
366
+ ], 64)) : (u(), D(F, { key: 1 }, [
367
+ b($, {
368
+ class: "text-sm",
369
+ icon: "qr"
370
+ }),
371
+ se(" " + A(y.value ? "Validating QR..." : "QR Scanning..."), 1)
372
+ ], 64))
373
+ ])
374
+ ]),
375
+ C("section", Fe, [
376
+ t[4] || (t[4] = C("span", null, "do not leave this page", -1)),
377
+ b(ne, {
378
+ onClick: t[1] || (t[1] = (_) => I(!0)),
379
+ label: "Stop Scan",
380
+ severity: "danger"
381
+ })
382
+ ])
383
+ ], 64)) : (u(), D("span", Me, A(n.detail), 1))
384
+ ], 2)
385
+ ]),
386
+ _: 1
387
+ }, 8, ["group"])) : U("", !0),
388
+ b(Ee, {
389
+ visible: O.value,
390
+ "onUpdate:visible": t[2] || (t[2] = (n) => O.value = n),
391
+ header: `${o.value} SCAN STOPPED`,
392
+ onConfirm: t[3] || (t[3] = (n) => (O.value = !1, B())),
393
+ "confirm-label": "Continue",
394
+ message: "The scan process was interrupted because you want to leave this window.",
395
+ severity: "danger"
396
+ }, null, 8, ["visible", "header"]),
397
+ (u(), M(Ne, { to: "body" }, [
398
+ k.value ? (u(), D("div", {
399
+ key: 0,
400
+ class: ee([
401
+ e.$preset.dialog.mask({ props: { modal: !0 } }).class,
402
+ "w-screen h-screen fixed top-0 left-0",
403
+ "!z-[9982]"
404
+ ]),
405
+ "data-ts-section": "toast-mask"
406
+ }, null, 2)) : U("", !0)
407
+ ]))
408
+ ], 64));
409
+ }
410
+ });
2
411
  export {
3
- f as default
412
+ Te as W,
413
+ He as _,
414
+ Oe as g,
415
+ Be as u
4
416
  };
@@ -1,15 +1,15 @@
1
1
  import { defineComponent as x, inject as P, shallowRef as g, ref as V, createElementBlock as w, openBlock as I, mergeProps as o, unref as e, createVNode as u, withModifiers as q, createElementVNode as i, nextTick as E } from "vue";
2
- import { e as N } from "../buttonbulkaction/ButtonBulkAction.es.js";
3
- import { u as T } from "../animation/Animation.es.js";
4
- import { s as j } from "../vendor/primevue/inputtext/inputtext.esm.es.js";
5
- import c from "../icon/index.es.js";
6
- const G = /* @__PURE__ */ x({
2
+ import { e as N } from "../event-bus/index.es.js";
3
+ import { u as T } from "../plugins/WangsVue.es.js";
4
+ import { s as _ } from "../vendor/primevue/inputtext/inputtext.esm.es.js";
5
+ import { _ as c } from "../icon/index.es.js";
6
+ const D = /* @__PURE__ */ x({
7
7
  __name: "ButtonSearch",
8
8
  props: {
9
9
  tableName: { default: "datatable" }
10
10
  },
11
11
  emits: ["search", "collapsed"],
12
- setup(F) {
12
+ setup(j) {
13
13
  const t = P("preset", {}).buttonsearch, { locale: $ } = T("ButtonSearch"), n = g(), s = V(), r = g(!1), B = () => {
14
14
  r.value = !0, p();
15
15
  }, p = () => {
@@ -36,7 +36,7 @@ const G = /* @__PURE__ */ x({
36
36
  }, (f = e(t)) == null ? void 0 : f.collapsebutton.root({ context: { showSearchInput: r.value } }), { type: "button" }), [
37
37
  u(c, o((h = e(t)) == null ? void 0 : h.collapsebutton.icon, { icon: "arrow-left" }), null, 16)
38
38
  ], 16),
39
- u(e(j), o((d = e(t)) == null ? void 0 : d.inputtext, {
39
+ u(e(_), o((d = e(t)) == null ? void 0 : d.inputtext, {
40
40
  ref_key: "inputtext",
41
41
  ref: s,
42
42
  "model-value": n.value,
@@ -44,7 +44,7 @@ const G = /* @__PURE__ */ x({
44
44
  onInput: C
45
45
  }), null, 16, ["model-value", "placeholder"]),
46
46
  i("button", o({
47
- onClick: l[1] || (l[1] = (M) => {
47
+ onClick: l[1] || (l[1] = (F) => {
48
48
  n.value = void 0, p();
49
49
  })
50
50
  }, (y = e(t)) == null ? void 0 : y.resetbutton.root({ query: n.value }), { type: "button" }), [
@@ -66,5 +66,5 @@ const G = /* @__PURE__ */ x({
66
66
  }
67
67
  });
68
68
  export {
69
- G as default
69
+ D as _
70
70
  };
@@ -1,8 +1,8 @@
1
- import { defineComponent as B, shallowRef as C, ref as m, createElementBlock as N, openBlock as R, Fragment as _, createVNode as l, createElementVNode as p, mergeProps as q, withCtx as V, normalizeClass as b } from "vue";
2
- import { e as w } from "../buttonbulkaction/ButtonBulkAction.es.js";
3
- import { _ as f } from "../button/Button.es.js";
4
- import { _ as S } from "../buttonscan/ButtonScan.es.js";
5
- import D from "../overlaypanel/index.es.js";
1
+ import { defineComponent as B, shallowRef as C, ref as m, createElementBlock as N, openBlock as _, Fragment as R, createVNode as l, createElementVNode as p, mergeProps as q, withCtx as V, normalizeClass as b } from "vue";
2
+ import { e as w } from "../event-bus/index.es.js";
3
+ import { _ as f } from "../button/index.es.js";
4
+ import { _ as S } from "../buttonscan/index.es.js";
5
+ import { _ as D } from "../overlaypanel/index.es.js";
6
6
  const F = { class: "hidden" }, x = { class: "flex gap-1 justify-center p-2" }, A = /* @__PURE__ */ B({
7
7
  __name: "ButtonSearchByScan",
8
8
  props: {
@@ -28,7 +28,7 @@ const F = { class: "hidden" }, x = { class: "flex gap-1 justify-center p-2" }, A
28
28
  var n, a;
29
29
  (n = i.value) == null || n.stopScan(e), (a = r.value) == null || a.stopScan(e);
30
30
  }
31
- }), (e, n) => (R(), N(_, null, [
31
+ }), (e, n) => (_(), N(R, null, [
32
32
  l(f, q(e.$attrs, {
33
33
  icon: s.icon ?? "qr-scan",
34
34
  label: e.label,
@@ -86,5 +86,5 @@ const F = { class: "hidden" }, x = { class: "flex gap-1 justify-center p-2" }, A
86
86
  }
87
87
  });
88
88
  export {
89
- A as default
89
+ A as _
90
90
  };
@@ -1,15 +1,15 @@
1
- import { defineComponent as L, onMounted as W, reactive as F, ref as d, computed as c, watch as T, createElementBlock as A, openBlock as i, Fragment as _, createVNode as u, createBlock as p, mergeProps as z, withCtx as y, createCommentVNode as M, normalizeStyle as Y, normalizeClass as j, createSlots as J, renderSlot as P, nextTick as U } from "vue";
1
+ import { defineComponent as G, onMounted as L, reactive as W, ref as d, computed as c, watch as T, createElementBlock as A, openBlock as i, Fragment as F, createVNode as u, createBlock as p, mergeProps as z, withCtx as y, createCommentVNode as M, normalizeStyle as Y, normalizeClass as j, createSlots as J, renderSlot as P, nextTick as U } from "vue";
2
2
  import { u as q } from "../vendor/vee-validate/dist/vee-validate.esm.es.js";
3
- import Q from "../badge/index.es.js";
4
- import { _ as h } from "../button/Button.es.js";
5
- import X from "../dialogselecttree/index.es.js";
6
- import { _ as Z } from "../fieldwrapper/FieldWrapper.es.js";
7
- import D from "../icon/index.es.js";
8
- import ee from "../validatormessage/index.es.js";
3
+ import { _ as Q } from "../badge/index.es.js";
4
+ import { _ as h } from "../button/index.es.js";
5
+ import { _ as X } from "../dialogselecttree/index.es.js";
6
+ import { _ as Z } from "../fieldwrapper/index.es.js";
7
+ import { _ as D } from "../icon/index.es.js";
8
+ import { _ as ee } from "../validatormessage/index.es.js";
9
9
  const le = {
10
10
  key: 0,
11
11
  class: "inline-flex gap-1 items-center"
12
- }, ue = /* @__PURE__ */ L({
12
+ }, ue = /* @__PURE__ */ G({
13
13
  __name: "ButtonSelectTree",
14
14
  props: {
15
15
  type: {},
@@ -49,14 +49,14 @@ const le = {
49
49
  emits: ["update:value", "dialogShown", "dialogHidden", "reset"],
50
50
  setup($, { emit: K }) {
51
51
  const f = K, l = $;
52
- W(() => {
52
+ L(() => {
53
53
  var e, a;
54
54
  l.useValidator && (Object.assign(
55
55
  s,
56
- q(l.fieldName, (t) => V(t))
56
+ q(l.fieldName, (t) => _(t))
57
57
  ), l.value && ((a = (e = k.value) == null ? void 0 : e.treeComponent) == null || a.fetchTreeList(), s.value = l.value));
58
58
  });
59
- const s = F({
59
+ const s = W({
60
60
  value: l.value
61
61
  }), k = d(), m = d(l.fetchTreeOnButtonRender), b = d(l.fetchTreeOnButtonRender), w = d(0), n = d(
62
62
  !Array.isArray(l.value) && typeof l.value != "number" && typeof l.value != "string" ? l.value : void 0
@@ -89,22 +89,22 @@ const le = {
89
89
  return e.map((t) => a ? t == null ? void 0 : t[a] : t);
90
90
  if (e && l.selectionMode === "single")
91
91
  return a ? e == null ? void 0 : e[a] : e;
92
- }, V = async (e) => (await U(), (Array.isArray(e) && !(e != null && e.length) || !Array.isArray(e) && !e) && l.mandatory ? l.validatorMessage ? l.validatorMessage : l.type === "group" ? "You must pick a group" : "You must pick a category" : l.invalid && l.validatorMessage ? l.validatorMessage : !0), O = (e) => {
92
+ }, _ = async (e) => (await U(), (Array.isArray(e) && !(e != null && e.length) || !Array.isArray(e) && !e) && l.mandatory ? l.validatorMessage ? l.validatorMessage : l.type === "group" ? "You must pick a group" : "You must pick a category" : l.invalid && l.validatorMessage ? l.validatorMessage : !0), V = (e) => {
93
93
  var a;
94
94
  if (e) {
95
- const { keys: t, singleNode: o, selectedNodes: r } = e, H = ((a = t[-1]) == null ? void 0 : a.checked) ?? !1;
95
+ const { keys: t, singleNode: o, selectedNodes: r } = e, R = ((a = t[-1]) == null ? void 0 : a.checked) ?? !1;
96
96
  if (l.selectionMode === "single")
97
97
  v.value = o, s.value = g(v.value, l.fieldDataKey);
98
98
  else {
99
- const I = r == null ? void 0 : r.filter((G) => {
99
+ const H = r == null ? void 0 : r.filter((I) => {
100
100
  var N;
101
- return !((N = l.excludedKeys) != null && N.includes(Number(G.key)));
101
+ return !((N = l.excludedKeys) != null && N.includes(Number(I.key)));
102
102
  });
103
- s.value = g(I, l.fieldDataKey) ?? [];
103
+ s.value = g(H, l.fieldDataKey) ?? [];
104
104
  }
105
- f("update:value", s.value, H);
105
+ f("update:value", s.value, R);
106
106
  }
107
- }, R = () => {
107
+ }, O = () => {
108
108
  v.value = void 0, w.value++, f("reset");
109
109
  }, S = () => {
110
110
  m.value = !0, b.value = !1, f("dialogShown");
@@ -120,7 +120,7 @@ const le = {
120
120
  l.selectionMode === "single" && (n.value = e);
121
121
  },
122
122
  { immediate: !0 }
123
- ), (e, a) => (i(), A(_, null, [
123
+ ), (e, a) => (i(), A(F, null, [
124
124
  u(Z, z(e.$attrs, {
125
125
  info: e.fieldInfo,
126
126
  label: l.fieldLabel,
@@ -150,7 +150,7 @@ const le = {
150
150
  })) : M("", !0),
151
151
  e.singleResetable ? (i(), p(h, {
152
152
  key: 1,
153
- onClick: R,
153
+ onClick: O,
154
154
  class: "p-0 m-0 !min-w-0 !min-h-0 !h-4 !w-4 focus-visible:ring-0 focus-visible:bg-danger-50",
155
155
  text: ""
156
156
  }, {
@@ -202,7 +202,7 @@ const le = {
202
202
  "show-disposable-groups": l.showDisposableGroups,
203
203
  type: l.type,
204
204
  onHide: a[1] || (a[1] = (t) => e.$emit("dialogHidden")),
205
- onSelect: O
205
+ onSelect: V
206
206
  }, J({ _: 2 }, [
207
207
  e.$slots.treenode ? {
208
208
  name: "treenode",
@@ -216,5 +216,5 @@ const le = {
216
216
  }
217
217
  });
218
218
  export {
219
- ue as default
219
+ ue as _
220
220
  };