@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.
package/config/locale.es.js
CHANGED
|
@@ -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
|
|
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
|
|
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:
|
|
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
|
-
},
|
|
481
|
-
t.value =
|
|
490
|
+
}, A = () => {
|
|
491
|
+
t.value = i.value ? `${l.value} ${i.value}` : void 0, m("update:modelValue", t.value);
|
|
482
492
|
}, K = () => {
|
|
483
|
-
|
|
493
|
+
z(() => {
|
|
484
494
|
const a = document.getElementById(
|
|
485
495
|
"phone-number-input"
|
|
486
496
|
);
|
|
487
497
|
a && a.focus();
|
|
488
498
|
});
|
|
489
|
-
},
|
|
490
|
-
l.value = a,
|
|
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 ? (
|
|
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((
|
|
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
|
|
511
|
-
const [a, n] = ((
|
|
512
|
-
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) => (
|
|
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
|
|
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] = (
|
|
531
|
-
class: H((
|
|
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:
|
|
545
|
+
onChange: A,
|
|
536
546
|
onHide: n[1] || (n[1] = () => {
|
|
537
547
|
K(), y.value = !1;
|
|
538
548
|
}),
|
|
539
|
-
onShow: n[2] || (n[2] = (
|
|
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:
|
|
559
|
+
option: M(({ option: e }) => [
|
|
550
560
|
d("div", Hc, [
|
|
551
561
|
d("img", {
|
|
552
|
-
src:
|
|
562
|
+
src: e.image,
|
|
553
563
|
alt: "country-img",
|
|
554
564
|
style: { height: "16px" }
|
|
555
565
|
}, null, 8, Ec),
|
|
556
|
-
d("span", null,
|
|
557
|
-
d("span", null,
|
|
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
|
-
(
|
|
572
|
+
(R(), P(X, {
|
|
563
573
|
key: I.value,
|
|
564
|
-
modelValue:
|
|
565
|
-
"onUpdate:modelValue": n[3] || (n[3] = (
|
|
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": (
|
|
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(
|
|
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:
|
|
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
package/plugins/WangsVue.es.js
CHANGED
|
@@ -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
|
|
4
|
-
import { P as
|
|
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) =>
|
|
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(
|
|
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
|