@fewangsit/wangsvue-fats 1.0.1-alpha.20 → 1.0.1-alpha.22

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.
@@ -153,7 +153,7 @@ export interface ButtonScanProps extends Omit<ButtonProps, 'type'> {
153
153
  /**
154
154
  * Defines the size of the button.
155
155
  *
156
- * @default to large
156
+ * @default to undefined / normal
157
157
  */
158
158
  size?: 'small' | 'large';
159
159
  }
@@ -1,11 +1,11 @@
1
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";
2
+ import { ref as re, defineComponent as Re, onBeforeUnmount as _e, 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 j, Teleport as Ne } from "vue";
3
3
  import { ChangelogServices as he } from "@tagsamurai/fats-api-services";
4
4
  import { u as Ie } from "../utils/baseToast.util.es.js";
5
5
  import { _ as ne } from "../button/index.es.js";
6
6
  import { _ as Ee } from "../dialogconfirm/index.es.js";
7
7
  import { _ as Ce } from "../hardwaresync/index.es.js";
8
- import { _ as $ } from "../icon/index.es.js";
8
+ import { _ as A } from "../icon/index.es.js";
9
9
  import { _ as z } from "../toast/index.es.js";
10
10
  import { v as J } from "../vendor/uuid/dist/esm-browser/v4.es.js";
11
11
  const Oe = (a) => {
@@ -56,7 +56,7 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
56
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
57
  key: 1,
58
58
  class: "text-xs font-medium leading-[16.39px] tracking-[0.02em]"
59
- }, He = /* @__PURE__ */ _e({
59
+ }, He = /* @__PURE__ */ Re({
60
60
  __name: "ButtonScan",
61
61
  props: {
62
62
  label: {},
@@ -93,7 +93,7 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
93
93
  emits: ["update:modelValue", "connect", "connected", "scan", "stop", "error", "beforeStartScan"],
94
94
  setup(a, { expose: l, emit: m }) {
95
95
  const s = a, r = m;
96
- Re(() => {
96
+ _e(() => {
97
97
  X();
98
98
  });
99
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(
@@ -133,11 +133,11 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
133
133
  }, 0);
134
134
  };
135
135
  window.scannerWorker.onmessage = ({ data: n }) => {
136
- var _;
136
+ var R;
137
137
  if (n.status === "connection_established")
138
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)
139
+ const { error: p } = (n == null ? void 0 : n.data) ?? {}, i = ((R = n == null ? void 0 : n.data) == null ? void 0 : R.deviceList) ?? [], _ = S.value[s.type], d = i.some(
140
+ (W) => W.serialNumber === (_ == null ? void 0 : _.serialNumber)
141
141
  );
142
142
  if (i.length && d)
143
143
  t();
@@ -164,13 +164,13 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
164
164
  Y(t);
165
165
  }
166
166
  }, Q = (e = !1, t = !1) => {
167
- var _;
167
+ var R;
168
168
  V.value = !1, c.removeGroup(g.value), localStorage.devmode || (window.addEventListener("blur", L), window.addEventListener("beforeunload", L));
169
169
  const n = S.value[o.value];
170
170
  if (n) {
171
171
  let p = "";
172
172
  s.bulk ? p = `bulkscan-${o.value.toLowerCase()}` : p = `scan-${o.value.toLowerCase()}`, window.scannerWorker.onmessage = async ({ data: i }) => {
173
- var R;
173
+ var _;
174
174
  if (i.status === "scan_started")
175
175
  t || (H.value++, setTimeout(() => {
176
176
  c.add({
@@ -187,13 +187,13 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
187
187
  if (d) {
188
188
  if (["scan-rfid", "scan-qr"].includes(p)) {
189
189
  y.value = !!s.scanValidation;
190
- const j = await ((R = s.scanValidation) == null ? void 0 : R.call(
190
+ const $ = await ((_ = s.scanValidation) == null ? void 0 : _.call(
191
191
  s,
192
192
  o.value,
193
193
  d,
194
194
  x()
195
195
  )) ?? !0;
196
- if (y.value = !1, j)
196
+ if (y.value = !1, $)
197
197
  s.autoSwitch ? (K(), fe()) : h(!0);
198
198
  else {
199
199
  V.value || Q(!1, !0);
@@ -206,8 +206,8 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
206
206
  tag: d,
207
207
  serialNumber: x()
208
208
  });
209
- } catch (j) {
210
- console.error(j);
209
+ } catch ($) {
210
+ console.error($);
211
211
  }
212
212
  r("update:modelValue", d), r("scan", d, x()), s.bulk && P.push(d);
213
213
  }
@@ -216,7 +216,7 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
216
216
  }, window.scannerWorker.onerror = Z, window.scannerWorker.postMessage({
217
217
  command: "scan",
218
218
  scanCommand: p,
219
- userId: (_ = JSON.parse(localStorage.getItem("user") ?? "{}")) == null ? void 0 : _._id,
219
+ userId: (R = JSON.parse(localStorage.getItem("user") ?? "{}")) == null ? void 0 : R._id,
220
220
  source: "app",
221
221
  jenisDevice: n.jenisDevice,
222
222
  serialNumber: n.serialNumber,
@@ -308,7 +308,8 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
308
308
  "[&_i]:w-2 [&_i]:h-2": e.type === "QR",
309
309
  "[&_i]:w-[11px] [&_i]:h-[7px]": e.type === "RFID"
310
310
  },
311
- "!px-1.5"
311
+ "!px-1.5",
312
+ s.class || e.$attrs.class
312
313
  ],
313
314
  disabled: s.disabled,
314
315
  icon: be.value,
@@ -352,35 +353,35 @@ const ie = () => window.devices ?? [], xe = () => window.device ?? { RFID: null,
352
353
  }, [
353
354
  n.detail === "scanning" ? (u(), D(F, { key: 0 }, [
354
355
  C("section", Le, [
355
- b($, {
356
+ b(A, {
356
357
  class: "animate-spin text-base",
357
358
  icon: "loader-4"
358
359
  }),
359
360
  C("span", We, [
360
361
  o.value === "RFID" ? (u(), D(F, { key: 0 }, [
361
- b($, {
362
+ b(A, {
362
363
  class: "text-base !w-4 !h-4",
363
364
  icon: "rfid"
364
365
  }),
365
- se(" " + A(y.value ? "Validating RFID..." : "RFID Scanning..."), 1)
366
+ se(" " + j(y.value ? "Validating RFID..." : "RFID Scanning..."), 1)
366
367
  ], 64)) : (u(), D(F, { key: 1 }, [
367
- b($, {
368
+ b(A, {
368
369
  class: "text-sm",
369
370
  icon: "qr"
370
371
  }),
371
- se(" " + A(y.value ? "Validating QR..." : "QR Scanning..."), 1)
372
+ se(" " + j(y.value ? "Validating QR..." : "QR Scanning..."), 1)
372
373
  ], 64))
373
374
  ])
374
375
  ]),
375
376
  C("section", Fe, [
376
377
  t[4] || (t[4] = C("span", null, "do not leave this page", -1)),
377
378
  b(ne, {
378
- onClick: t[1] || (t[1] = (_) => I(!0)),
379
+ onClick: t[1] || (t[1] = (R) => I(!0)),
379
380
  label: "Stop Scan",
380
381
  severity: "danger"
381
382
  })
382
383
  ])
383
- ], 64)) : (u(), D("span", Me, A(n.detail), 1))
384
+ ], 64)) : (u(), D("span", Me, j(n.detail), 1))
384
385
  ], 2)
385
386
  ]),
386
387
  _: 1
@@ -62,7 +62,8 @@ const e = {
62
62
  asideRightExpandedButtonLabel: "Close <"
63
63
  },
64
64
  InputPhoneNumber: {
65
- defaultPlaceholder: "Enter phone number"
65
+ defaultPlaceholder: "Enter phone number",
66
+ emptyInvalidText: "{label} must not be empty"
66
67
  },
67
68
  InputNumber: {
68
69
  defaultPlaceholder: "Enter {label}",
@@ -1,7 +1,10 @@
1
1
  import { DefineComponent } from 'vue';
2
2
 
3
+ import { CustomValidation } from '../form';
4
+
3
5
  export interface InputPhoneNumberLocaleConfig {
4
6
  defaultPlaceholder?: string;
7
+ emptyInvalidText?: string;
5
8
  }
6
9
 
7
10
  /**
@@ -63,7 +66,7 @@ export interface InputPhoneNumberProps {
63
66
  * Set the custom validator message.
64
67
  * By default each field has preserved with its validator message, you don't need to worrying about the message.
65
68
  */
66
- validatorMessage?: string;
69
+ validatorMessage?: string | CustomValidation<'empty'>;
67
70
  /**
68
71
  * Show information about the field.
69
72
  */
@@ -1,4 +1,4 @@
1
- import { defineComponent as G, onBeforeMount as V, shallowRef as u, onMounted as D, reactive as L, inject as x, computed as j, watch as C, createBlock as f, openBlock as P, withCtx as M, createElementVNode as d, withDirectives as F, createVNode as v, unref as c, normalizeClass as H, toDisplayString as R, normalizeProps as E, guardReactiveProps as J, vShow as q, nextTick as w } from "vue";
1
+ import { defineComponent as G, onBeforeMount as V, shallowRef as u, onMounted as D, reactive as L, inject as x, computed as j, watch as C, createBlock as P, openBlock as R, withCtx as M, createElementVNode as d, withDirectives as F, createVNode as v, unref as c, normalizeClass as H, toDisplayString as w, normalizeProps as E, guardReactiveProps as J, vShow as q, nextTick as z } from "vue";
2
2
  import O from "axios";
3
3
  import { u as W } from "../vendor/vee-validate/dist/vee-validate.esm.es.js";
4
4
  import { u as Z } from "../plugins/WangsVue.es.js";
@@ -468,32 +468,42 @@ const Fc = {
468
468
  t,
469
469
  W(
470
470
  o.fieldName ?? "numberInput",
471
- async (a) => await w(() => U(a))
471
+ async (a) => await z(() => U(a))
472
472
  )
473
473
  ), o.value != null && h(o.value), o.modelValue != null && h(o.modelValue);
474
474
  });
475
- const { locale: z } = Z("InputPhoneNumber"), S = x("preset", {}).inputphonenumber, y = u(!1), b = j(() => o.invalid || !!t.errorMessage), k = navigator.userAgent.includes("Chrome"), U = (a) => o.invalid && o.validatorMessage ? o.validatorMessage : a == null && o.mandatory ? o.validatorMessage ?? `${o.label} harus diisi.` : !0, g = u(), l = u(), e = u(), I = u(0), t = L({ value: null }), T = async () => {
475
+ const { locale: b } = Z("InputPhoneNumber"), S = x("preset", {}).inputphonenumber, y = u(!1), k = j(() => o.invalid || !!t.errorMessage), B = navigator.userAgent.includes("Chrome"), U = (a) => {
476
+ var n;
477
+ if (o.invalid && typeof o.validatorMessage == "string")
478
+ return o.validatorMessage;
479
+ if (typeof o.validatorMessage != "string") {
480
+ const { empty: s } = o.validatorMessage ?? {};
481
+ if (a == null && o.mandatory)
482
+ return s ?? ((n = b.emptyInvalidText) == null ? void 0 : n.replace("{label}", o.label));
483
+ }
484
+ return !0;
485
+ }, g = u(), l = u(), i = u(), I = u(0), t = L({ value: null }), T = async () => {
476
486
  const { data: a } = await O.get(
477
487
  "https://assets.tagsamurai.com/json/country-dial-code.json"
478
488
  );
479
489
  return a.filter((n) => n.dial_code) ?? [];
480
- }, B = () => {
481
- t.value = e.value ? `${l.value} ${e.value}` : void 0, m("update:modelValue", t.value);
490
+ }, A = () => {
491
+ t.value = i.value ? `${l.value} ${i.value}` : void 0, m("update:modelValue", t.value);
482
492
  }, K = () => {
483
- w(() => {
493
+ z(() => {
484
494
  const a = document.getElementById(
485
495
  "phone-number-input"
486
496
  );
487
497
  a && a.focus();
488
498
  });
489
- }, A = (a, n) => {
490
- l.value = a, e.value = n;
499
+ }, _ = (a, n) => {
500
+ l.value = a, i.value = n;
491
501
  }, h = (a) => {
492
502
  const n = a == null ? void 0 : a.split(" ");
493
- n != null && n.length ? (A(n[0], n[1]), t.value = e.value ? `${l.value} ${e.value}` : void 0) : t.value = void 0;
503
+ n != null && n.length ? (_(n[0], n[1]), t.value = i.value ? `${l.value} ${i.value}` : void 0) : t.value = void 0;
494
504
  }, N = () => {
495
505
  if (g.value) {
496
- const { country: a } = jc(), n = g.value.find((i) => i.name === a);
506
+ const { country: a } = jc(), n = g.value.find((s) => s.name === a);
497
507
  return n ? n.dial_code : "+62";
498
508
  }
499
509
  return "+62";
@@ -507,36 +517,36 @@ const Fc = {
507
517
  ), C(
508
518
  () => t.value,
509
519
  () => {
510
- var i;
511
- const [a, n] = ((i = t.value) == null ? void 0 : i.split(" ")) ?? [];
512
- a && n && A(a, n);
520
+ var s;
521
+ const [a, n] = ((s = t.value) == null ? void 0 : s.split(" ")) ?? [];
522
+ a && n && _(a, n);
513
523
  }
514
524
  ), C(
515
525
  () => o.modelValue,
516
526
  (a) => {
517
527
  h(a);
518
528
  }
519
- ), (a, n) => (P(), f(Y, {
529
+ ), (a, n) => (R(), P(Y, {
520
530
  info: o.fieldInfo,
521
531
  label: o.label,
522
532
  mandatory: o.mandatory
523
533
  }, {
524
534
  default: M(() => {
525
- var i, _;
535
+ var s, f;
526
536
  return [
527
537
  d("div", Fc, [
528
538
  v(c($), {
529
539
  modelValue: l.value,
530
- "onUpdate:modelValue": n[0] || (n[0] = (s) => l.value = s),
531
- class: H((i = c(S)) == null ? void 0 : i.dialcode.root({ isChromeBased: c(k), invalidInput: b.value }).class),
540
+ "onUpdate:modelValue": n[0] || (n[0] = (e) => l.value = e),
541
+ class: H((s = c(S)) == null ? void 0 : s.dialcode.root({ isChromeBased: c(B), invalidInput: k.value }).class),
532
542
  disabled: o.disabled,
533
543
  "filter-fields": ["dial_code", "name"],
534
544
  options: g.value,
535
- onChange: B,
545
+ onChange: A,
536
546
  onHide: n[1] || (n[1] = () => {
537
547
  K(), y.value = !1;
538
548
  }),
539
- onShow: n[2] || (n[2] = (s) => y.value = !0),
549
+ onShow: n[2] || (n[2] = (e) => y.value = !0),
540
550
  "data-wv-section": "dialcode",
541
551
  filter: "",
542
552
  "filter-placeholder": "Search",
@@ -546,32 +556,32 @@ const Fc = {
546
556
  dropdownicon: M(() => [
547
557
  v(Q, E(J(c(S).dialcode.dropdownicon({ state: { isShowOverlay: y.value } }))), null, 16)
548
558
  ]),
549
- option: M(({ option: s }) => [
559
+ option: M(({ option: e }) => [
550
560
  d("div", Hc, [
551
561
  d("img", {
552
- src: s.image,
562
+ src: e.image,
553
563
  alt: "country-img",
554
564
  style: { height: "16px" }
555
565
  }, null, 8, Ec),
556
- d("span", null, R(s.name), 1),
557
- d("span", null, R(s.dial_code), 1)
566
+ d("span", null, w(e.name), 1),
567
+ d("span", null, w(e.dial_code), 1)
558
568
  ])
559
569
  ]),
560
570
  _: 1
561
571
  }, 8, ["modelValue", "class", "disabled", "options"]),
562
- (P(), f(X, {
572
+ (R(), P(X, {
563
573
  key: I.value,
564
- modelValue: e.value,
565
- "onUpdate:modelValue": n[3] || (n[3] = (s) => e.value = s),
574
+ modelValue: i.value,
575
+ "onUpdate:modelValue": n[3] || (n[3] = (e) => i.value = e),
566
576
  "allowed-characters": /\d/,
567
577
  disabled: a.disabled,
568
- "input-class": (_ = c(S)) == null ? void 0 : _.input({ isChromeBased: c(k), invalidInput: b.value }).class,
578
+ "input-class": (f = c(S)) == null ? void 0 : f.input({ isChromeBased: c(B), invalidInput: k.value }).class,
569
579
  "max-length": a.maxDigit,
570
- placeholder: a.placeholder ?? c(z).defaultPlaceholder,
580
+ placeholder: a.placeholder ?? c(b).defaultPlaceholder,
571
581
  "use-field-wrapper": !1,
572
582
  "use-input-group": !1,
573
583
  "use-validator": !1,
574
- onBlur: B,
584
+ onBlur: A,
575
585
  "data-wv-section": "phoneinput",
576
586
  "input-id": "phone-number-input",
577
587
  "prevent-input-on-max-length": ""
@@ -1,51 +1,52 @@
1
- import { defineComponent as h, onMounted as v, shallowRef as i, watch as w, createBlock as c, openBlock as u, unref as _, withCtx as s, createVNode as g, createCommentVNode as y } from "vue";
1
+ import { defineComponent as h, onMounted as v, shallowRef as i, watch as w, createBlock as u, openBlock as c, unref as _, withCtx as s, createVNode as g, createCommentVNode as y } from "vue";
2
2
  import { u as L } from "../plugins/basei18n.es.js";
3
+ import { g as C } from "../utils/cookie.util.es.js";
3
4
  import { s as x } from "../vendor/primevue/dropdown/dropdown.esm.es.js";
4
- import { _ as C } from "../icon/index.es.js";
5
+ import { _ as k } from "../icon/index.es.js";
5
6
  import { _ as p } from "../languagedropdownoption/index.es.js";
6
- const b = /* @__PURE__ */ h({
7
+ const N = /* @__PURE__ */ h({
7
8
  __name: "LanguageSwitcher",
8
- setup(S) {
9
+ setup(O) {
9
10
  v(async () => {
10
- n.value = await f();
11
+ t.value = await f();
11
12
  });
12
- const { service: r, setLocale: m } = L(), n = i(), o = i([]), l = i(!1), f = async () => {
13
- const a = localStorage.getItem("lang") || navigator.language.split("-")[0];
14
- if (!o.value.length)
13
+ const { service: r, setLocale: m } = L(), t = i(), a = i([]), l = i(!1), f = async () => {
14
+ const o = C("lang") || navigator.language.split("-")[0];
15
+ if (!a.value.length)
15
16
  try {
16
- const e = await r.getLanguageOptionMeta(a);
17
+ const e = await r.getLanguageOptionMeta(o);
17
18
  if (e.isoCode)
18
- return o.value[0] = e, e;
19
+ return a.value[0] = e, e;
19
20
  } catch (e) {
20
21
  console.error(
21
22
  "Ups! Something error while fetching Language Option Meta.",
22
23
  e
23
24
  );
24
25
  }
25
- return o.value.find((e) => e.isoCode === a) || o.value[0];
26
+ return a.value.find((e) => e.isoCode === o) || a.value[0];
26
27
  }, d = async () => {
27
- if (!(!r || o.value.length > 1))
28
+ if (!(!r || a.value.length > 1))
28
29
  try {
29
30
  l.value = !0;
30
- const a = await r.getLanguageOptions();
31
- o.value = a;
32
- } catch (a) {
31
+ const o = await r.getLanguageOptions();
32
+ a.value = o;
33
+ } catch (o) {
33
34
  console.error(
34
35
  "Ups! Something error while fetching language options.",
35
- a
36
+ o
36
37
  );
37
38
  } finally {
38
39
  l.value = !1;
39
40
  }
40
41
  };
41
- return w(n, (a) => {
42
- m(a.isoCode);
43
- }), (a, e) => (u(), c(_(x), {
44
- modelValue: n.value,
45
- "onUpdate:modelValue": e[0] || (e[0] = (t) => n.value = t),
42
+ return w(t, (o) => {
43
+ m(o.isoCode);
44
+ }), (o, e) => (c(), u(_(x), {
45
+ modelValue: t.value,
46
+ "onUpdate:modelValue": e[0] || (e[0] = (n) => t.value = n),
46
47
  "filter-fields": ["language", "name"],
47
48
  loading: l.value,
48
- options: o.value,
49
+ options: a.value,
49
50
  pt: {
50
51
  root: {
51
52
  class: "flex items-center gap-1 gap-1"
@@ -64,25 +65,25 @@ const b = /* @__PURE__ */ h({
64
65
  "filter-placeholder": "Search language"
65
66
  }, {
66
67
  dropdownicon: s(() => [
67
- g(C, {
68
+ g(k, {
68
69
  class: "w-4 h-4 rotate-180 text-general-800 transition-transform",
69
70
  icon: "arrow-up-s"
70
71
  })
71
72
  ]),
72
- value: s(({ value: t }) => [
73
- t ? (u(), c(p, {
73
+ value: s(({ value: n }) => [
74
+ n ? (c(), u(p, {
74
75
  key: 0,
75
- option: t,
76
+ option: n,
76
77
  "icon-only": ""
77
78
  }, null, 8, ["option"])) : y("", !0)
78
79
  ]),
79
- option: s(({ option: t }) => [
80
- g(p, { option: t }, null, 8, ["option"])
80
+ option: s(({ option: n }) => [
81
+ g(p, { option: n }, null, 8, ["option"])
81
82
  ]),
82
83
  _: 1
83
84
  }, 8, ["modelValue", "loading", "options"]));
84
85
  }
85
86
  });
86
87
  export {
87
- b as _
88
+ N as _
88
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-fats",
3
- "version": "1.0.1-alpha.20",
3
+ "version": "1.0.1-alpha.22",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Fixed Asset Tagsamurai VueJS Component Library",
6
6
  "type": "module",
@@ -1,7 +1,7 @@
1
1
  import { inject as c } from "vue";
2
2
  import { x as m } from "../vendor/@wangs-ui/vue/dist/index.es.js";
3
- import { d as g } from "../utils/object.util.es.js";
4
- import { P as p } from "../vendor/primevue/config/config.esm.es.js";
3
+ import { d as p } from "../utils/object.util.es.js";
4
+ import { P as g } from "../vendor/primevue/config/config.esm.es.js";
5
5
  const h = {
6
6
  startsWith: "Starts with",
7
7
  contains: "Contains",
@@ -213,7 +213,8 @@ const h = {
213
213
  asideRightExpandedButtonLabel: "Tutup <"
214
214
  },
215
215
  InputPhoneNumber: {
216
- defaultPlaceholder: "Masukkan nomor telepon"
216
+ defaultPlaceholder: "Masukkan nomor telepon",
217
+ emptyInvalidText: "{label} harus diisi"
217
218
  },
218
219
  InputNumber: {
219
220
  defaultPlaceholder: "Tulis {label}",
@@ -299,7 +300,7 @@ const h = {
299
300
  if (!l)
300
301
  throw new Error("WangsVue is not installed!");
301
302
  return t ? l.getComponentConfig(t) : l.config;
302
- }, b = (t, l) => g(t, l), P = (t = u, l = !0) => {
303
+ }, b = (t, l) => p(t, l), P = (t = u, l = !0) => {
303
304
  const r = l ? b(u, t) : t;
304
305
  return {
305
306
  install: (o, e) => {
@@ -331,7 +332,7 @@ const h = {
331
332
  }
332
333
  })
333
334
  };
334
- o.config.globalProperties.$wangsvue = n, o.config.globalProperties.$preset = n.config.preset, o.provide(d, n), o.provide("preset", a.preset), o.provide("useToastConfig", a.useToastConfig), o.use(p, {
335
+ o.config.globalProperties.$wangsvue = n, o.config.globalProperties.$preset = n.config.preset, o.provide(d, n), o.provide("preset", a.preset), o.provide("useToastConfig", a.useToastConfig), o.use(g, {
335
336
  unstyled: !0,
336
337
  pt: a.preset,
337
338
  locale: a.locale.global
@@ -1,88 +1,89 @@
1
- import { shallowRef as P, shallowReactive as I, inject as M } from "vue";
2
- import { u as b } from "../assetinfo/index.es.js";
3
- const n = P(), u = "messages";
4
- let r;
1
+ import { shallowRef as m, shallowReactive as P, inject as I } from "vue";
2
+ import { u as M } from "../assetinfo/index.es.js";
3
+ import { s as b, g as y } from "../utils/cookie.util.es.js";
4
+ const s = m(), u = "messages";
5
+ let o;
5
6
  const f = () => {
6
7
  try {
7
- const t = localStorage.getItem(u);
8
- return t ? JSON.parse(t) : {};
8
+ const e = localStorage.getItem(u);
9
+ return e ? JSON.parse(e) : {};
9
10
  } catch {
10
11
  return {};
11
12
  }
12
- }, g = I(f()), a = new Proxy(g, {
13
- get: (t, e) => {
14
- const l = f()[e];
15
- return g[e] = l, l;
13
+ }, i = P(f()), r = new Proxy(i, {
14
+ get: (e, t) => {
15
+ const l = f()[t];
16
+ return i[t] = l, l;
16
17
  },
17
- set: (t, e, s) => (g[e] = s, m(g), !0)
18
- }), m = (t) => {
19
- localStorage.setItem(u, JSON.stringify(t));
20
- }, y = async (t) => {
21
- var e;
22
- if (!(t in a)) {
23
- const { setLoading: s } = b();
24
- s(!0, "Loading language package...");
18
+ set: (e, t, n) => (i[t] = n, x(i), !0)
19
+ }), x = (e) => {
20
+ localStorage.setItem(u, JSON.stringify(e));
21
+ }, A = async (e) => {
22
+ var t;
23
+ if (!(e in r)) {
24
+ const { setLoading: n } = M();
25
+ n(!0, "Loading language package...");
25
26
  let l = {};
26
27
  try {
27
- const { data: c } = await (((e = r == null ? void 0 : r.getMessages) == null ? void 0 : e.call(r, t)) ?? {});
28
+ const { data: c } = await (((t = o == null ? void 0 : o.getMessages) == null ? void 0 : t.call(o, e)) ?? {});
28
29
  l = c.data;
29
30
  } catch {
30
31
  } finally {
31
- s(!1);
32
+ n(!1);
32
33
  }
33
34
  return l;
34
35
  }
35
- return a[t];
36
- }, d = (t, ...e) => {
36
+ return r[e];
37
+ }, d = (e, ...t) => {
37
38
  var c;
38
- if (!n.value && !localStorage.lang) return t;
39
- let s = (c = a[n.value]) == null ? void 0 : c[t];
40
- const l = s === t && n.value !== "en";
41
- if ((!s || l) && (s = t, r == null || r.translateText(t, n.value).then((o) => {
42
- a[n.value] ? a[n.value] = {
43
- ...a[n.value],
44
- [t]: o
45
- } : a[n.value] = {
46
- [t]: o
39
+ if (!s.value && !y("lang")) return e;
40
+ let n = (c = r[s.value]) == null ? void 0 : c[e];
41
+ const l = n === e && s.value !== "en";
42
+ if ((!n || l) && (n = e, o == null || o.translateText(e, s.value).then((a) => {
43
+ r[s.value] ? r[s.value] = {
44
+ ...r[s.value],
45
+ [e]: a
46
+ } : r[s.value] = {
47
+ [e]: a
47
48
  };
48
- }).catch((o) => {
49
- console.error("Translation error:", o);
50
- })), e.length === 1 && typeof e[0] == "object" && !Array.isArray(e[0])) {
51
- const o = e[0];
52
- return Object.keys(o).reduce(
53
- (h, i) => h.replaceAll(`{${i}}`, o[i]),
54
- s
49
+ }).catch((a) => {
50
+ console.error("Translation error:", a);
51
+ })), t.length === 1 && typeof t[0] == "object" && !Array.isArray(t[0])) {
52
+ const a = t[0];
53
+ return Object.keys(a).reduce(
54
+ (h, g) => h.replaceAll(`{${g}}`, a[g]),
55
+ n
55
56
  );
56
57
  }
57
- if (e.length > 0) {
58
- let o = 0;
59
- return s.replace(/%s/g, () => String(e[o++] ?? ""));
58
+ if (t.length > 0) {
59
+ let a = 0;
60
+ return n.replace(/%s/g, () => String(t[a++] ?? ""));
60
61
  }
61
- return s;
62
- }, v = async (t) => {
63
- if (n.value !== t) {
64
- const e = await y(t);
65
- n.value = t, a[t] = e, localStorage.lang = t;
62
+ return n;
63
+ }, v = async (e) => {
64
+ if (s.value !== e) {
65
+ const t = await A(e);
66
+ s.value = e, r[e] = t, b({ name: "lang", value: s.value, path: "/" });
66
67
  }
67
- }, O = () => (M("i18n") || console.error("I18n Plugin not installed!"), {
68
+ }, E = () => (I("i18n") || console.error("I18n Plugin not installed!"), {
68
69
  t: d,
69
- locale: n,
70
+ locale: s,
70
71
  setLocale: v,
71
- service: r
72
- }), S = () => {
73
- const t = {
72
+ service: o
73
+ }), O = () => {
74
+ const e = {
74
75
  t: d,
75
- locale: n,
76
+ locale: s,
76
77
  setLocale: v,
77
- service: r
78
+ service: o
78
79
  };
79
80
  return {
80
- install(e) {
81
- e.config.globalProperties.$i18n = t, e.config.globalProperties.$t = t.t, e.provide("i18n", t);
81
+ install(t) {
82
+ t.config.globalProperties.$i18n = e, t.config.globalProperties.$t = e.t, t.provide("i18n", e);
82
83
  }
83
84
  };
84
- }, T = (t) => (r = t, S());
85
+ }, R = (e) => (o = e, O());
85
86
  export {
86
- T as c,
87
- O as u
87
+ R as c,
88
+ E as u
88
89
  };