@fewangsit/wangsvue-fats 1.0.1-alpha.65 → 1.0.1-alpha.67

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.
@@ -15,7 +15,7 @@ const Te = (t) => {
15
15
  t.message
16
16
  ))
17
17
  return t.message;
18
- }, ie = `(function(){"use strict";let n=null,t=null,a,c,r="";self.onmessage=s=>{const e=s.data;switch(c=e.companyCode,e.command){case"sync":l(e);break;case"connect":g(e);break;case"scan":S(e);break;case"stopscan":p(e);break}};const d=s=>{let e="established";n&&n.readyState===WebSocket.OPEN?(e="reused",s.onopen(n,e),m(s.timeout)):n=new WebSocket("wss://dev-api.tagsamurai.com/rfid-reader-go/"),n.onopen=()=>{r=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),e="established",n&&s.onopen(n,e),m(s.timeout)},n.onmessage=o=>{s.onmessage(o),m(s.timeout)},n.onerror=o=>{console.error("🚀 ~ Scanner Worker: openConnection ~ error:",o),s.onerror(o),n==null||n.close(),n=null,t&&clearTimeout(t)}},u=()=>{p({userId:a}),a=void 0,n&&n.close(),n=null,t&&clearTimeout(t),console.info("Socket connection has been closed!")},m=(s=0)=>{s&&(t&&clearTimeout(t),t=setTimeout(u,s))},l=({userId:s})=>{a=s,d({onopen:e=>{e.send(JSON.stringify({data:{command:"connect",userId:s,sessionId:r,companyCode:c,source:"app"},event:"reader"}))},onmessage:e=>{postMessage({status:"synced",...JSON.parse(e.data)})},onerror:e=>{postMessage({status:"sync_error",error:e})}})},g=({userId:s})=>{a=s,d({onopen:(e,o)=>{o==="established"?e.send(JSON.stringify({data:{command:"connect",userId:s,source:"app",sessionId:r,companyCode:c},event:"reader"})):postMessage({status:"connection_reused"})},onmessage:e=>{postMessage({status:"connection_established",...JSON.parse(e.data)})},onerror:e=>{postMessage({status:"error_connecting",error:e})}})},S=({scanCommand:s,userId:e,serialNumber:o,jenisDevice:f})=>{a=e,d({onopen:i=>{i.send(JSON.stringify({data:{command:s,userId:e,sessionId:r,companyCode:c,source:"app",serialNumber:o,jenisDevice:f},event:"reader"})),postMessage({status:"scan_started"})},onmessage:i=>{postMessage({status:"scanned",...JSON.parse(i.data)})},onerror:i=>{postMessage({status:"scan_error",error:i})}})},p=({userId:s})=>{n&&n.readyState===WebSocket.OPEN&&(n.send(JSON.stringify({data:{command:"stopscan",userId:s,source:"app",sessionId:r,companyCode:c},event:"reader"})),postMessage({status:"scan_stopped"}),console.info("Scan Process Stopped!"))}})();
18
+ }, ie = `(function(){"use strict";let n=null,t=null,a,c,r="";self.onmessage=s=>{const e=s.data;switch(c=e.companyCode,e.command){case"sync":l(e);break;case"connect":g(e);break;case"scan":S(e);break;case"stopscan":p(e);break}};const d=s=>{let e="established";n&&n.readyState===WebSocket.OPEN?(e="reused",s.onopen(n,e),m(s.timeout)):n=new WebSocket("wss://dev-api.tagsamurai.com/rfid-reader-go"),n.onopen=()=>{r=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),e="established",n&&s.onopen(n,e),m(s.timeout)},n.onmessage=o=>{s.onmessage(o),m(s.timeout)},n.onerror=o=>{console.error("🚀 ~ Scanner Worker: openConnection ~ error:",o),s.onerror(o),n==null||n.close(),n=null,t&&clearTimeout(t)}},u=()=>{p({userId:a}),a=void 0,n&&n.close(),n=null,t&&clearTimeout(t),console.info("Socket connection has been closed!")},m=(s=0)=>{s&&(t&&clearTimeout(t),t=setTimeout(u,s))},l=({userId:s})=>{a=s,d({onopen:e=>{e.send(JSON.stringify({data:{command:"connect",userId:s,sessionId:r,companyCode:c,source:"app"},event:"reader"}))},onmessage:e=>{postMessage({status:"synced",...JSON.parse(e.data)})},onerror:e=>{postMessage({status:"sync_error",error:e})}})},g=({userId:s})=>{a=s,d({onopen:(e,o)=>{o==="established"?e.send(JSON.stringify({data:{command:"connect",userId:s,source:"app",sessionId:r,companyCode:c},event:"reader"})):postMessage({status:"connection_reused"})},onmessage:e=>{postMessage({status:"connection_established",...JSON.parse(e.data)})},onerror:e=>{postMessage({status:"error_connecting",error:e})}})},S=({scanCommand:s,userId:e,serialNumber:o,jenisDevice:f})=>{a=e,d({onopen:i=>{i.send(JSON.stringify({data:{command:s,userId:e,sessionId:r,companyCode:c,source:"app",serialNumber:o,jenisDevice:f},event:"reader"})),postMessage({status:"scan_started"})},onmessage:i=>{postMessage({status:"scanned",...JSON.parse(i.data)})},onerror:i=>{postMessage({status:"scan_error",error:i})}})},p=({userId:s})=>{n&&n.readyState===WebSocket.OPEN&&(n.send(JSON.stringify({data:{command:"stopscan",userId:s,source:"app",sessionId:r,companyCode:c},event:"reader"})),postMessage({status:"scan_stopped"}),console.info("Scan Process Stopped!"))}})();
19
19
  `, ae = typeof self < "u" && self.Blob && new Blob([ie], { type: "text/javascript;charset=utf-8" });
20
20
  function xe(t) {
21
21
  let u;
@@ -1,4 +1,4 @@
1
- import { Slot } from 'vue';
1
+ import { ShallowRef, Slot } from 'vue';
2
2
 
3
3
  import { TreeNode } from '../basetree';
4
4
  import { QueryParams, ShortFetchResponse } from '../datatable';
@@ -199,7 +199,9 @@ declare class ButtonSelectTree extends ClassComponent<
199
199
  ButtonSelectTreeProps,
200
200
  ButtonSelectTreeSlots,
201
201
  ButtonSelectTreeEmits
202
- > {}
202
+ > {
203
+ dialogTreeKey: ShallowRef<number>;
204
+ }
203
205
 
204
206
  declare module '@vue/runtime-core' {
205
207
  interface GlobalComponents {
@@ -1,15 +1,15 @@
1
- import { defineComponent as G, onMounted as L, reactive as W, ref as d, computed as c, watch as A, createElementBlock as M, openBlock as i, Fragment as F, createVNode as u, createBlock as p, mergeProps as z, withCtx as y, createCommentVNode as N, normalizeStyle as Y, normalizeClass as j, createSlots as J, renderSlot as P, nextTick as U } from "vue";
2
- import { u as q } from "../vendor/vee-validate/dist/vee-validate.esm.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";
1
+ import { defineComponent as L, onMounted as W, reactive as F, ref as d, computed as p, watch as A, createElementBlock as M, openBlock as i, Fragment as z, createVNode as u, createBlock as c, mergeProps as Y, withCtx as y, createCommentVNode as N, normalizeStyle as j, normalizeClass as J, createSlots as P, renderSlot as U, nextTick as q } from "vue";
2
+ import { u as Q } from "../vendor/vee-validate/dist/vee-validate.esm.es.js";
3
+ import { _ as X } from "../badge/index.es.js";
4
+ import { _ as k } from "../button/index.es.js";
5
+ import { _ as Z } from "../dialogselecttree/index.es.js";
6
+ import { _ as ee } from "../fieldwrapper/index.es.js";
7
7
  import { _ as D } from "../icon/index.es.js";
8
- import { _ as ee } from "../validatormessage/index.es.js";
9
- const le = {
8
+ import { _ as le } from "../validatormessage/index.es.js";
9
+ const te = {
10
10
  key: 0,
11
11
  class: "inline-flex gap-1 items-center"
12
- }, ue = /* @__PURE__ */ G({
12
+ }, fe = /* @__PURE__ */ L({
13
13
  __name: "ButtonSelectTree",
14
14
  props: {
15
15
  type: {},
@@ -47,31 +47,31 @@ const le = {
47
47
  fetchTreeOnButtonRender: { type: Boolean, default: !1 }
48
48
  },
49
49
  emits: ["update:value", "dialogShown", "dialogHidden", "reset"],
50
- setup($, { emit: K }) {
51
- const f = K, l = $;
52
- L(() => {
50
+ setup($, { expose: K, emit: x }) {
51
+ const f = x, l = $;
52
+ W(() => {
53
53
  var e, a;
54
54
  l.useValidator && (Object.assign(
55
55
  s,
56
- q(l.fieldName, (t) => _(t))
57
- ), l.value && ((a = (e = k.value) == null ? void 0 : e.treeComponent) == null || a.fetchTreeList(), s.value = l.value));
56
+ Q(l.fieldName, (t) => V(t))
57
+ ), l.value && ((a = (e = w.value) == null ? void 0 : e.treeComponent) == null || a.fetchTreeList(), s.value = l.value));
58
58
  });
59
- const s = W({
59
+ const s = F({
60
60
  value: l.value
61
- }), k = d(), m = d(l.fetchTreeOnButtonRender), b = d(l.fetchTreeOnButtonRender), w = d(0), n = d(
61
+ }), w = d(), m = d(l.fetchTreeOnButtonRender), b = d(l.fetchTreeOnButtonRender), v = d(0), n = d(
62
62
  !Array.isArray(l.value) && typeof l.value != "number" && typeof l.value != "string" ? l.value : void 0
63
- ), v = c({
63
+ ), g = p({
64
64
  get: () => n.value,
65
65
  set: (e) => {
66
- n.value = e, f("update:value", g(e, l.fieldDataKey));
66
+ n.value = e, f("update:value", h(e, l.fieldDataKey));
67
67
  }
68
- }), B = c(() => E(s.value ?? l.value)), x = c(() => {
68
+ }), B = p(() => _(s.value ?? l.value)), C = p(() => {
69
69
  var t;
70
70
  const a = (l.selectionMode === "checkbox" ? ((t = B.value) == null ? void 0 : t.filter((o) => (o == null ? void 0 : o.toString()) != "-1")) ?? [] : []).length;
71
71
  return a && l.selectionMode === "checkbox" ? a + (l.type === "group" ? " group(s) selected" : " category(s) selected") : l.label ? l.label : l.type === "group" ? "Select Group" : "Select Category";
72
- }), C = c(
72
+ }), E = p(
73
73
  () => l.width ? `width: ${l.width}px !important` : void 0
74
- ), E = (e) => {
74
+ ), _ = (e) => {
75
75
  const a = JSON.parse(
76
76
  sessionStorage.getItem(`flatten${l.type}nodes`) ?? "[]"
77
77
  );
@@ -84,28 +84,28 @@ const le = {
84
84
  }
85
85
  return t.key;
86
86
  }) : [];
87
- }, g = (e, a) => {
87
+ }, h = (e, a) => {
88
88
  if (Array.isArray(e) && l.selectionMode === "checkbox")
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
- }, _ = 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) => {
92
+ }, V = async (e) => (await q(), (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) => {
93
93
  var a;
94
94
  if (e) {
95
- const { keys: t, singleNode: o, selectedNodes: r } = e, R = ((a = t[-1]) == null ? void 0 : a.checked) ?? !1;
95
+ const { keys: t, singleNode: o, selectedNodes: r } = e, H = ((a = t[-1]) == null ? void 0 : a.checked) ?? !1;
96
96
  if (l.selectionMode === "single")
97
- v.value = o, s.value = g(v.value, l.fieldDataKey);
97
+ g.value = o, s.value = h(g.value, l.fieldDataKey);
98
98
  else {
99
- const H = r == null ? void 0 : r.filter((I) => {
99
+ const I = r == null ? void 0 : r.filter((G) => {
100
100
  var T;
101
- return !((T = l.excludedKeys) != null && T.includes(I.key));
101
+ return !((T = l.excludedKeys) != null && T.includes(G.key));
102
102
  });
103
- s.value = g(H, l.fieldDataKey) ?? [];
103
+ s.value = h(I, l.fieldDataKey) ?? [];
104
104
  }
105
- f("update:value", s.value, R);
105
+ f("update:value", s.value, H);
106
106
  }
107
- }, O = () => {
108
- v.value = void 0, w.value++, f("reset");
107
+ }, R = () => {
108
+ g.value = void 0, v.value++, f("reset");
109
109
  }, S = () => {
110
110
  m.value = !0, b.value = !1, f("dialogShown");
111
111
  };
@@ -120,20 +120,20 @@ const le = {
120
120
  l.selectionMode === "single" && (n.value = e);
121
121
  },
122
122
  { immediate: !0 }
123
- ), (e, a) => (i(), M(F, null, [
124
- u(Z, z(e.$attrs, {
123
+ ), K({ dialogTreeKey: v }), (e, a) => (i(), M(z, null, [
124
+ u(ee, Y(e.$attrs, {
125
125
  info: e.fieldInfo,
126
126
  label: l.fieldLabel,
127
127
  mandatory: l.mandatory,
128
128
  "show-optional-text": e.$attrs["show-optional-text"] != !1
129
129
  }), {
130
130
  default: y(() => [
131
- n.value ? (i(), M("span", le, [
132
- u(Q, {
131
+ n.value ? (i(), M("span", te, [
132
+ u(X, {
133
133
  label: n.value.name,
134
134
  format: "nowrap"
135
135
  }, null, 8, ["label"]),
136
- e.singleEditable ? (i(), p(h, {
136
+ e.singleEditable ? (i(), c(k, {
137
137
  key: 0,
138
138
  onClick: S,
139
139
  class: "p-0 m-0 !min-w-0 !min-h-0 !h-4 !w-4 focus-visible:ring-0 focus-visible:bg-primary-50",
@@ -148,9 +148,9 @@ const le = {
148
148
  ]),
149
149
  _: 1
150
150
  })) : N("", !0),
151
- e.singleResetable ? (i(), p(h, {
151
+ e.singleResetable ? (i(), c(k, {
152
152
  key: 1,
153
- onClick: O,
153
+ onClick: R,
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
  }, {
@@ -163,24 +163,24 @@ const le = {
163
163
  ]),
164
164
  _: 1
165
165
  })) : N("", !0)
166
- ])) : (i(), p(h, {
166
+ ])) : (i(), c(k, {
167
167
  key: 1,
168
- class: j({ "!w-full": !l.width }),
168
+ class: J({ "!w-full": !l.width }),
169
169
  disabled: e.disabled,
170
- label: x.value,
171
- style: Y(C.value),
170
+ label: C.value,
171
+ style: j(E.value),
172
172
  onClick: S
173
173
  }, null, 8, ["class", "disabled", "label", "style"])),
174
- u(ee, {
174
+ u(le, {
175
175
  message: s.errorMessage
176
176
  }, null, 8, ["message"])
177
177
  ]),
178
178
  _: 1
179
179
  }, 16, ["info", "label", "mandatory", "show-optional-text"]),
180
- (i(), p(X, {
181
- key: w.value + +b.value,
180
+ (i(), c(Z, {
181
+ key: v.value + +b.value,
182
182
  ref_key: "dialogTreeInstance",
183
- ref: k,
183
+ ref: w,
184
184
  visible: m.value,
185
185
  "onUpdate:visible": a[0] || (a[0] = (t) => m.value = t),
186
186
  "allow-empty-selection": e.allowEmptySelection,
@@ -202,12 +202,12 @@ 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: V
206
- }, J({ _: 2 }, [
205
+ onSelect: O
206
+ }, P({ _: 2 }, [
207
207
  e.$slots.treenode ? {
208
208
  name: "treenode",
209
209
  fn: y(({ node: t }) => [
210
- P(e.$slots, "treenode", { node: t })
210
+ U(e.$slots, "treenode", { node: t })
211
211
  ]),
212
212
  key: "0"
213
213
  } : void 0
@@ -216,5 +216,5 @@ const le = {
216
216
  }
217
217
  });
218
218
  export {
219
- ue as _
219
+ fe as _
220
220
  };