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

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.
@@ -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": ""
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.21",
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