@desource/phone-mask-vue 0.2.3 → 0.3.0
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/CHANGELOG.md +12 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/index.cjs +170 -212
- package/dist/index.js +170 -212
- package/dist/index.mjs +170 -212
- package/dist/phone-mask-vue.css +64 -64
- package/dist/types/components/PhoneInput.vue.d.ts.map +1 -1
- package/dist/types/composables/useCountrySelector.d.ts.map +1 -1
- package/dist/types/consts.d.ts +0 -4
- package/dist/types/consts.d.ts.map +1 -1
- package/dist/types/directives/vPhoneMask.d.ts.map +1 -1
- package/dist/types/types.d.ts +0 -4
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,66 +1,76 @@
|
|
|
1
1
|
var lib = (function(exports, vue) {
|
|
2
2
|
"use strict";
|
|
3
3
|
const M = { AC: "+247 #####", AD: ["+376 ### ###", "+376 #### ####"], AE: ["+971 # ### ####", "+971 ## ### ####", "+971 ### ######", "+971 ### # #####"], AF: "+93 ## ### ####", AG: "+1 ###-###-####", AI: "+1 ###-###-####", AL: ["+355 ## ### ###", "+355 ## ### ####", "+355 ### ####", "+355 ### ###", "+355 ### #####"], AM: ["+374 ## ######", "+374 ### ## ###"], AO: "+244 ### ### ###", AR: ["+54 ## ####-####", "+54 # ## ####-####", "+54 ###-###-####"], AS: "+1 ###-###-####", AT: ["+43 # #########", "+43 ### ######"], AU: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###", "+61 ## ### ##"], AW: "+297 ### ####", AX: ["+358 ## #######", "+358 ### ######"], AZ: ["+994 ## ### ## ##", "+994 ### ## ## ##"], BA: ["+387 ## ###-###", "+387 ## ### ###"], BB: "+1 ###-###-####", BD: ["+880 #-#######", "+880 ####-######", "+880 ###-#######"], BE: ["+32 ## ## ## ##", "+32 ### ## ## ##", "+32 ### ## ###"], BF: "+226 ## ## ## ##", BG: ["+359 # ### ###", "+359 ## ### ###", "+359 ### ## ###"], BH: "+973 #### ####", BI: "+257 ## ## ## ##", BJ: ["+229 ## ## ## ## ##", "+229 ## ## ## ##"], BL: "+590 ### ## ## ##", BM: "+1 ###-###-####", BN: "+673 ### ####", BO: ["+591 # #######", "+591 ########", "+591 ### ## ####"], BQ: "+599 ### ####", BR: ["+55 ## ####-####", "+55 ## #####-####", "+55 ### ## ####", "+55 ####-####"], BS: "+1 ###-###-####", BT: ["+975 # ### ###", "+975 ## ## ## ##"], BW: ["+267 ### ####", "+267 ## ### ###", "+267 #### ### ###", "+267 ## #####"], BY: ["+375 ### ##-##-##", "+375 ## ###-##-##", "+375 ### ### ####"], BZ: ["+501 ###-####", "+501 #-###-####-###"], CA: "+1 ###-###-####", CC: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###"], CD: ["+243 ## #####", "+243 ### ### ###"], CF: "+236 ## ## ## ##", CG: ["+242 ## ### ####", "+242 # #### ####"], CH: ["+41 ## ### ## ##", "+41 ### ### ###"], CI: ["+225 ## ## # #####", "+225 ## ## ## ####"], CK: "+682 ## ###", CL: ["+56 ### ### ###", "+56 # #### ####", "+56 ### ### ####", "+56 ## ### ####"], CM: ["+237 # ## ## ## ##", "+237 ## ## ## ##"], CN: ["+86 ## #### ####", "+86 ### #### ####", "+86 ### ### ####", "+86 ########"], CO: ["+57 ### #######", "+57 # ### #######"], CR: ["+506 #### ####", "+506 ###-###-####"], CU: ["+53 # #######", "+53 ### #######"], CV: "+238 ### ## ##", CW: ["+599 # ### ####", "+599 ### ####"], CX: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###"], CY: "+357 ## ######", CZ: "+420 ### ### ###", DE: ["+49 ## ######", "+49 #### #######", "+49 ### ##########", "+49 ### # ######", "+49 ### # ####", "+49 ### #### ####", "+49 ########"], DJ: "+253 ## ## ## ##", DK: "+45 ## ## ## ##", DM: "+1 ###-###-####", DO: "+1 ###-###-####", DZ: ["+213 ## ## ## ##", "+213 ### ## ## ##", "+213 ## ### ## ##"], EC: ["+593 #-###-####", "+593 ## ### ####", "+593 #### ### ####"], EE: ["+372 ### ####", "+372 #### ####", "+372 ## ## ####"], EG: ["+20 # ########", "+20 ## ########", "+20 ### ### ####"], EH: ["+212 # ## ## ## ##", "+212 ##-#######"], ER: "+291 # ### ###", ES: ["+34 ### ## ## ##", "+34 ### ### ###"], ET: "+251 ## ### ####", FI: ["+358 ## #######", "+358 ### ######"], FJ: ["+679 ### ####", "+679 #### ### ####"], FK: "+500 #####", FM: "+691 ### ####", FO: "+298 ######", FR: ["+33 # ## ## ## ##", "+33 ### ## ## ##"], GA: "+241 ## ## ## ##", GB: ["+44 ### ### ####", "+44 #### ######", "+44 ## #### ####"], GD: "+1 ###-###-####", GE: ["+995 ## ### ## ##", "+995 ### ## ## ##", "+995 ### ### ###"], GF: "+594 ### ## ## ##", GG: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], GH: ["+233 ## ### ####", "+233 ### #####"], GI: ["+350 ### #####", "+350 ########"], GL: "+299 ## ## ##", GM: "+220 ### ####", GN: ["+224 ## ## ## ##", "+224 ### ## ## ##"], GP: "+590 ### ## ## ##", GQ: ["+240 ### ### ###", "+240 ### ######"], GR: ["+30 ## #### ####", "+30 ### ### ####"], GT: ["+502 #### ####", "+502 #### ### ####"], GU: "+1 ###-###-####", GW: ["+245 ### ### ###", "+245 ### ####"], GY: "+592 ### ####", HK: ["+852 #### ####", "+852 ### ### ###", "+852 ### ## ### ###"], HN: ["+504 ####-####", "+504 ###########"], HR: ["+385 # #### ###", "+385 ## ### ####", "+385 ### ### ###", "+385 ## ## ###", "+385 ## ### ###"], HT: "+509 ## ## ####", HU: ["+36 # ### ####", "+36 ## ### ####", "+36 ## ### ###"], ID: ["+62 ## #######", "+62 ###-###-###", "+62 ### #######", "+62 ### # ### ###", "+62 ### ### ####"], IE: ["+353 ## #####", "+353 ## ### ####", "+353 #### ### ###", "+353 ### ### ###"], IL: ["+972 #-###-####", "+972 ##-###-####", "+972 #-###-###-###"], IM: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], IN: ["+91 ##### #####", "+91 #### ## ####", "+91 #### ### ### ###", "+91 #### ### ####"], IO: "+246 ### ####", IQ: ["+964 # ### ####", "+964 ### ### ####"], IR: ["+98 ## #### ####", "+98 ### ### ####"], IS: "+354 ### ####", IT: ["+39 ## #### ####", "+39 ### ### ####", "+39 ### ### ###"], JE: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], JM: "+1 ###-###-####", JO: ["+962 # ### ####", "+962 # #### ####", "+962 ### #####", "+962 ## #######"], JP: ["+81 #-####-####", "+81 ##-####-####", "+81 ###-###-###", "+81 ##-###-####"], KE: ["+254 ## #######", "+254 ### ######", "+254 ### ### ###"], KG: ["+996 ### ### ###", "+996 ### ### # ##"], KH: ["+855 ## ### ###", "+855 #### ### ###"], KI: ["+686 #####", "+686 ########"], KM: "+269 ### ## ##", KN: "+1 ###-###-####", KP: ["+850 # ### ####", "+850 ### ### ####"], KR: ["+82 #-###-####", "+82 ##-####-####", "+82 ##-###-####"], KW: ["+965 #### ####", "+965 ### #####", "+965 #### ###"], KY: "+1 ###-###-####", KZ: ["+7 ##### # ## ##", "+7 ### ### ####", "+7 ### ###-##-##"], LA: ["+856 ## ### ###", "+856 ## ## ### ###"], LB: ["+961 # ### ###", "+961 ## ### ###"], LC: "+1 ###-###-####", LI: ["+423 ### ## ##", "+423 ### ### ###"], LK: ["+94 ### ### ###", "+94 ## ### ####"], LR: ["+231 ## ### ###", "+231 ## ### ####"], LS: "+266 #### ####", LT: ["+370 ### #####", "+370 ### ## ###"], LU: ["+352 ## ## ## ##", "+352 ### ### ###", "+352 ### ## ###"], LV: "+371 ## ### ###", LY: "+218 ##-#######", MA: ["+212 # ## ## ## ##", "+212 ##-#######"], MC: ["+377 ## ## ## ##", "+377 # ## ## ## ##"], MD: ["+373 ## ### ###", "+373 ### ## ###", "+373 ### #####"], ME: "+382 ## ### ###", MF: "+590 ### ## ## ##", MG: "+261 ## ## ### ##", MH: "+692 ###-####", MK: ["+389 # ### ####", "+389 ## ### ###", "+389 ### # ## ##"], ML: "+223 ## ## ## ##", MM: ["+95 # ### ###", "+95 # ### ####", "+95 ### ### ####"], MN: "+976 #### ####", MO: ["+853 #### ####", "+853 #### ###"], MP: "+1 ###-###-####", MQ: "+596 ### ## ## ##", MR: "+222 ## ## ## ##", MS: "+1 ###-###-####", MT: "+356 #### ####", MU: ["+230 #### ####", "+230 ### ####"], MV: ["+960 ###-####", "+960 ### ### ####"], MW: ["+265 # ### ###", "+265 ### ## ## ##"], MX: "+52 ### ### ####", MY: ["+60 #-#### ####", "+60 ##-### ####", "+60 #-###-##-####", "+60 ###-### ####"], MZ: ["+258 ## ### ###", "+258 ## ### ####", "+258 ### ### ###"], NA: ["+264 ## ### ###", "+264 ## ### ####", "+264 ### ### ###"], NC: "+687 ##.##.##", NE: ["+227 ## ## ## ##", "+227 ## ### ###"], NF: ["+672 ## ####", "+672 # #####"], NG: ["+234 #### ## ####", "+234 ### ### ####", "+234 ### #### ####"], NI: "+505 #### ####", NL: ["+31 ## ### ####", "+31 # ########", "+31 ### ####", "+31 ## #######"], NO: ["+47 ## ## ## ##", "+47 ### ## ###"], NP: ["+977 #-#######", "+977 ###-#######", "+977 ###########"], NR: "+674 ### ####", NU: ["+683 ####", "+683 ### ####"], NZ: ["+64 # ### ####", "+64 ## ### ####", "+64 ### ### ###"], OM: ["+968 ## ######", "+968 #### ####", "+968 ### #####"], PA: ["+507 ###-####", "+507 ####-####"], PE: ["+51 # #######", "+51 ### ### ###", "+51 ### #####"], PF: ["+689 ## ## ## ##", "+689 ### ## ## ##"], PG: ["+675 ### ####", "+675 #### ####"], PH: ["+63 # #### ####", "+63 ### ### ####", "+63 #### # ### ####"], PK: ["+92 ## ########", "+92 ### #######", "+92 ### ### ##", "+92 #### #####"], PL: ["+48 ## ### ## ##", "+48 ### ### ###"], PM: ["+508 ## ## ##", "+508 ### ## ## ##"], PR: "+1 ###-###-####", PS: ["+970 # ### ####", "+970 ### ### ###", "+970 #### ### ###"], PT: ["+351 ## ### ####", "+351 ### ### ###"], PW: "+680 ### ####", PY: ["+595 ## ### ####", "+595 ### ######", "+595 #### ### ####"], QA: ["+974 #### ####", "+974 ### ####"], RE: "+262 ### ## ## ##", RO: ["+40 ## ### ####", "+40 ### ### ###"], RS: ["+381 ## ######", "+381 ## #######", "+381 ### #####"], RU: "+7 ### ###-##-##", RW: "+250 ### ### ###", SA: ["+966 ## ### ####", "+966 ### ### ####", "+966 #### #####"], SB: ["+677 #####", "+677 ## #####"], SC: ["+248 # ### ###", "+248 #######"], SD: "+249 ## ### ####", SE: ["+46 # ## ## ##", "+46 ## ### ## ##", "+46 ## ## ## ##", "+46 ### ## ## ###"], SG: ["+65 #### ####", "+65 #### ### ####"], SH: "+290 #####", SI: ["+386 # ### ## ##", "+386 ## ### ###", "+386 ## ######", "+386 ### #####"], SJ: ["+47 ## ## ## ##", "+47 ### ## ###"], SK: ["+421 #/### ### ##", "+421 ### ### ###", "+421 #######"], SL: "+232 ## ######", SM: ["+378 #### ######", "+378 ## ## ## ##"], SN: ["+221 ## ### ## ##", "+221 ### ## ## ##"], SO: ["+252 # ######", "+252 # #######"], SR: ["+597 ###-###", "+597 ###-####", "+597 ##-##-##"], SS: "+211 ### ### ###", ST: "+239 ### ####", SV: ["+503 #### ####", "+503 ### ####"], SX: "+1 ###-###-####", SY: ["+963 ## ### ####", "+963 ### ### ###"], SZ: ["+268 #### ####", "+268 ##### ####"], TA: "+290 ####", TC: "+1 ###-###-####", TD: "+235 ## ## ## ##", TG: "+228 ## ## ## ##", TH: ["+66 # ### ####", "+66 ## ### ####", "+66 #### ### ###"], TJ: ["+992 ### ## ####", "+992 ## ### ####"], TK: "+690 ####", TL: ["+670 ### ####", "+670 #### ####"], TM: ["+993 ## ##-##-##", "+993 ## ######"], TN: "+216 ## ### ###", TO: ["+676 ##-###", "+676 ### ####", "+676 #### ###"], TR: ["+90 ### ### ## ##", "+90 ### ### ####"], TT: "+1 ###-###-####", TV: ["+688 ## ###", "+688 ## ####"], TW: ["+886 # #### ####", "+886 ### ### ###", "+886 ## ### ####", "+886 ## #### ####"], TZ: ["+255 ## ### ####", "+255 ### ### ###", "+255 ### ## ####"], UA: ["+380 #### #####", "+380 ## ### ####", "+380 ### ### ###"], UG: ["+256 ## #######", "+256 ### ######"], US: "+1 ###-###-####", UY: ["+598 #### ####", "+598 ## ### ###", "+598 ### ####"], UZ: "+998 ## ### ## ##", VA: ["+39 ## #### ####", "+39 ### ### ####", "+39 ### ### ###"], VC: "+1 ###-###-####", VE: "+58 ###-#######", VG: "+1 ###-###-####", VI: "+1 ###-###-####", VN: ["+84 ### #### ###", "+84 ### ### ###", "+84 #### ######", "+84 ## ### ## ##"], VU: ["+678 #####", "+678 ### ####"], WF: ["+681 ## ## ##", "+681 ### ## ## ##"], WS: ["+685 #####", "+685 ## #####", "+685 ### ###"], XK: ["+383 ## ### ###", "+383 ### #####"], YE: ["+967 # ### ###", "+967 ### ### ###"], YT: "+262 ### ## ## ##", ZA: ["+27 ## ### ####", "+27 ### ### ###"], ZM: ["+260 ### ### ###", "+260 ## #######", "+260 #########"], ZW: ["+263 ## #####", "+263 ## ### ####", "+263 ### ####", "+263 #### ######"] };
|
|
4
|
-
const t$1 = /^[a-z]{2}$/i, countryCodeEmoji = (
|
|
5
|
-
if (!t$1.test(
|
|
6
|
-
const t2 = typeof
|
|
7
|
-
throw new TypeError(`cc argument must be an ISO 3166-1 alpha-2 string, but got '${"string" === t2 ?
|
|
4
|
+
const t$1 = /^[a-z]{2}$/i, countryCodeEmoji = (o2) => {
|
|
5
|
+
if (!t$1.test(o2)) {
|
|
6
|
+
const t2 = typeof o2;
|
|
7
|
+
throw new TypeError(`cc argument must be an ISO 3166-1 alpha-2 string, but got '${"string" === t2 ? o2 : t2}' instead.`);
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
return String.fromCodePoint(...
|
|
9
|
+
const e2 = [...o2.toUpperCase()].map((t2) => (t2.codePointAt(0) ?? 0) + 127397);
|
|
10
|
+
return String.fromCodePoint(...e2);
|
|
11
11
|
};
|
|
12
|
-
const t = Object.entries(M), divideMask = (
|
|
13
|
-
function getCodeAndMask(
|
|
12
|
+
const t = Object.entries(M), divideMask = (e2) => e2.split(/ (.*)/s);
|
|
13
|
+
function getCodeAndMask(e2) {
|
|
14
14
|
let n = "", t2 = "";
|
|
15
|
-
if (Array.isArray(
|
|
16
|
-
const
|
|
17
|
-
for (const t3 of
|
|
18
|
-
const [
|
|
19
|
-
n || (n =
|
|
15
|
+
if (Array.isArray(e2)) {
|
|
16
|
+
const o2 = [];
|
|
17
|
+
for (const t3 of e2) {
|
|
18
|
+
const [e3, s2] = divideMask(t3);
|
|
19
|
+
n || (n = e3), o2.push(s2);
|
|
20
20
|
}
|
|
21
|
-
t2 =
|
|
21
|
+
t2 = o2;
|
|
22
22
|
} else {
|
|
23
|
-
const [
|
|
24
|
-
n =
|
|
23
|
+
const [o2, s2] = divideMask(e2);
|
|
24
|
+
n = o2, t2 = s2;
|
|
25
25
|
}
|
|
26
26
|
return [n, t2];
|
|
27
27
|
}
|
|
28
|
-
t.map(([
|
|
29
|
-
t.reduce((
|
|
30
|
-
const [
|
|
31
|
-
return
|
|
28
|
+
t.map(([e2, n]) => ({ id: e2, mask: n }));
|
|
29
|
+
t.reduce((e2, [n, t2]) => {
|
|
30
|
+
const [o2, s2] = getCodeAndMask(t2);
|
|
31
|
+
return e2[n] = { code: o2, mask: s2 }, e2;
|
|
32
32
|
}, {});
|
|
33
|
-
t.map(([
|
|
34
|
-
const [t2,
|
|
35
|
-
return { id:
|
|
33
|
+
t.map(([e2, n]) => {
|
|
34
|
+
const [t2, o2] = getCodeAndMask(n);
|
|
35
|
+
return { id: e2, code: t2, mask: o2 };
|
|
36
36
|
});
|
|
37
|
-
t.reduce((
|
|
38
|
-
const [
|
|
39
|
-
return
|
|
37
|
+
t.reduce((e2, [t2, o2]) => {
|
|
38
|
+
const [s2, a] = getCodeAndMask(o2);
|
|
39
|
+
return e2[t2] = { code: s2, mask: a, flag: countryCodeEmoji(t2) }, e2;
|
|
40
40
|
}, {});
|
|
41
|
-
t.map(([
|
|
42
|
-
const [
|
|
43
|
-
return { id:
|
|
41
|
+
t.map(([e2, t2]) => {
|
|
42
|
+
const [o2, s2] = getCodeAndMask(t2);
|
|
43
|
+
return { id: e2, code: o2, mask: s2, flag: countryCodeEmoji(e2) };
|
|
44
44
|
});
|
|
45
|
-
const MasksFullMap = (
|
|
46
|
-
const
|
|
47
|
-
return t.reduce((
|
|
48
|
-
const [a, r] = getCodeAndMask(
|
|
49
|
-
return
|
|
45
|
+
const MasksFullMap = (e2) => {
|
|
46
|
+
const o2 = new Intl.DisplayNames([e2], { type: "region" });
|
|
47
|
+
return t.reduce((e3, [t2, s2]) => {
|
|
48
|
+
const [a, r] = getCodeAndMask(s2), d = o2.of(t2) ?? "";
|
|
49
|
+
return e3[t2] = { code: a, mask: r, name: d, flag: countryCodeEmoji(t2) }, e3;
|
|
50
50
|
}, {});
|
|
51
|
-
}, MasksFull = (
|
|
52
|
-
const
|
|
53
|
-
return t.map(([
|
|
54
|
-
const [
|
|
55
|
-
return { id:
|
|
51
|
+
}, MasksFull = (e2) => {
|
|
52
|
+
const o2 = new Intl.DisplayNames([e2], { type: "region" });
|
|
53
|
+
return t.map(([e3, t2]) => {
|
|
54
|
+
const [s2, a] = getCodeAndMask(t2);
|
|
55
|
+
return { id: e3, code: s2, mask: a, name: o2.of(e3) ?? "", flag: countryCodeEmoji(e3) };
|
|
56
56
|
});
|
|
57
|
-
}, m = t.reduce((
|
|
58
|
-
const [
|
|
59
|
-
return
|
|
60
|
-
}, {}), i = t.map(([
|
|
61
|
-
const [
|
|
62
|
-
return { id:
|
|
57
|
+
}, m = t.reduce((e2, [t2, o2]) => {
|
|
58
|
+
const [s2, a] = getCodeAndMask(o2), r = new Intl.DisplayNames(["en"], { type: "region" });
|
|
59
|
+
return e2[t2] = { code: s2, mask: a, name: r.of(t2) ?? "", flag: countryCodeEmoji(t2) }, e2;
|
|
60
|
+
}, {}), i = t.map(([e2, t2]) => {
|
|
61
|
+
const [o2, s2] = getCodeAndMask(t2);
|
|
62
|
+
return { id: e2, code: o2, mask: s2, name: new Intl.DisplayNames(["en"], { type: "region" }).of(e2) ?? "", flag: countryCodeEmoji(e2) };
|
|
63
63
|
}), g = countryCodeEmoji;
|
|
64
|
+
function getNavigatorLang() {
|
|
65
|
+
return "undefined" != typeof navigator && navigator.language || "en";
|
|
66
|
+
}
|
|
67
|
+
function getMasksFullMapByLocale(e2) {
|
|
68
|
+
return e2.toLowerCase().startsWith("en") ? m : MasksFullMap(e2);
|
|
69
|
+
}
|
|
70
|
+
function getCountry(t2, n) {
|
|
71
|
+
const e2 = getMasksFullMapByLocale(n), r = t2.toUpperCase();
|
|
72
|
+
return r in e2 ? { id: r, ...e2[r] } : { id: "US", ...e2.US };
|
|
73
|
+
}
|
|
64
74
|
function toArray(t2) {
|
|
65
75
|
return Array.isArray(t2) ? t2 : [t2];
|
|
66
76
|
}
|
|
@@ -72,35 +82,60 @@ var lib = (function(exports, vue) {
|
|
|
72
82
|
}
|
|
73
83
|
function pickMaskVariant(t2, n) {
|
|
74
84
|
if (1 === t2.length) return t2[0];
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
return
|
|
85
|
+
const e2 = t2.map((t3) => ({ mask: t3, count: countPlaceholders(t3) })), r = e2.filter((t3) => t3.count >= n).sort((t3, n2) => t3.count - n2.count);
|
|
86
|
+
if (r.length > 0) return r[0].mask;
|
|
87
|
+
const o2 = e2.sort((t3, n2) => n2.count - t3.count)[0];
|
|
88
|
+
return o2 ? o2.mask : t2[0];
|
|
79
89
|
}
|
|
80
90
|
function formatDigitsWithMap(t2, n) {
|
|
81
|
-
let
|
|
82
|
-
const
|
|
83
|
-
let
|
|
84
|
-
const
|
|
85
|
-
for (let
|
|
86
|
-
const
|
|
87
|
-
if ("#" ===
|
|
88
|
-
if (!(
|
|
89
|
-
|
|
91
|
+
let e2 = "";
|
|
92
|
+
const r = [];
|
|
93
|
+
let o2 = 0;
|
|
94
|
+
const a = n.length, i2 = t2.length;
|
|
95
|
+
for (let u = 0; u < i2; u++) {
|
|
96
|
+
const i3 = t2[u];
|
|
97
|
+
if ("#" === i3) {
|
|
98
|
+
if (!(o2 < a)) break;
|
|
99
|
+
e2 += n[o2], r.push(o2), o2++;
|
|
90
100
|
} else {
|
|
91
|
-
const n2 = -1 !== t2.indexOf("#",
|
|
92
|
-
(
|
|
101
|
+
const n2 = -1 !== t2.indexOf("#", u + 1) && o2 < a;
|
|
102
|
+
(e2.length > 0 || n2) && (e2 += i3, r.push(-1));
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
|
-
return { display:
|
|
105
|
+
return { display: e2, map: r };
|
|
106
|
+
}
|
|
107
|
+
const o = "https://ipapi.co/json/", e = 1500, p = "@desource/phone-mask:geo", s = 864e5;
|
|
108
|
+
async function detectCountryFromGeoIP(e$1 = o, r = e) {
|
|
109
|
+
const c = new AbortController(), n = setTimeout(() => c.abort(), r);
|
|
110
|
+
try {
|
|
111
|
+
const t2 = await fetch(e$1, { signal: c.signal, headers: { Accept: "application/json" } });
|
|
112
|
+
if (clearTimeout(n), !t2.ok) return null;
|
|
113
|
+
const o2 = await t2.json();
|
|
114
|
+
return (o2.country || o2.country_code || o2.countryCode || o2.country_code2 || "").toString().toUpperCase() || null;
|
|
115
|
+
} catch {
|
|
116
|
+
return clearTimeout(n), null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function detectByGeoIp(t2) {
|
|
120
|
+
try {
|
|
121
|
+
const o3 = localStorage.getItem(p);
|
|
122
|
+
if (o3) {
|
|
123
|
+
const c = JSON.parse(o3), n = Date.now() - c.ts > s;
|
|
124
|
+
if (!n && c.country_code && t2(c.country_code)) return c.country_code.toUpperCase();
|
|
125
|
+
n && localStorage.removeItem(p);
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
129
|
+
const o2 = await detectCountryFromGeoIP();
|
|
130
|
+
if (o2 && t2(o2)) {
|
|
131
|
+
try {
|
|
132
|
+
localStorage.setItem(p, JSON.stringify({ country_code: o2, ts: Date.now() }));
|
|
133
|
+
} catch {
|
|
134
|
+
}
|
|
135
|
+
return o2;
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
96
138
|
}
|
|
97
|
-
const CACHE_KEY = "@desource/phone-mask:geo";
|
|
98
|
-
const CACHE_EXPIRY_MS = 24 * 60 * 6e4;
|
|
99
|
-
const GEO_IP_TIMEOUT = 1500;
|
|
100
|
-
const GEO_IP_URL = "https://ipapi.co/json/";
|
|
101
|
-
const Delimiters = [" ", "-", "(", ")"];
|
|
102
|
-
const NavigationKeys = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "Tab"];
|
|
103
|
-
const InvalidPattern = /[^\d\s\-()]/;
|
|
104
139
|
const emptyCountry = { id: "", code: "", mask: "", flag: "", name: "" };
|
|
105
140
|
function useCountrySelector(usedLocale) {
|
|
106
141
|
const isEnLocale = vue.computed(() => usedLocale.value.toLowerCase().startsWith("en"));
|
|
@@ -174,7 +209,7 @@ var lib = (function(exports, vue) {
|
|
|
174
209
|
};
|
|
175
210
|
const detectFromLocale = () => {
|
|
176
211
|
try {
|
|
177
|
-
const lang =
|
|
212
|
+
const lang = getNavigatorLang();
|
|
178
213
|
try {
|
|
179
214
|
const loc = new Intl.Locale(lang);
|
|
180
215
|
if (loc.region && hasCountry(loc.region)) return loc.region.toUpperCase();
|
|
@@ -186,46 +221,6 @@ var lib = (function(exports, vue) {
|
|
|
186
221
|
}
|
|
187
222
|
return null;
|
|
188
223
|
};
|
|
189
|
-
const detectByGeoIp = async () => {
|
|
190
|
-
try {
|
|
191
|
-
const cached = localStorage.getItem(CACHE_KEY);
|
|
192
|
-
if (cached) {
|
|
193
|
-
const parsed = JSON.parse(cached);
|
|
194
|
-
const isExpired = Date.now() - parsed.ts > CACHE_EXPIRY_MS;
|
|
195
|
-
if (!isExpired && parsed.country_code && hasCountry(parsed.country_code)) {
|
|
196
|
-
return parsed.country_code.toUpperCase();
|
|
197
|
-
}
|
|
198
|
-
if (isExpired) {
|
|
199
|
-
localStorage.removeItem(CACHE_KEY);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
} catch {
|
|
203
|
-
}
|
|
204
|
-
const controller = new AbortController();
|
|
205
|
-
const timeoutId = setTimeout(() => controller.abort(), GEO_IP_TIMEOUT);
|
|
206
|
-
try {
|
|
207
|
-
const res = await fetch(GEO_IP_URL, {
|
|
208
|
-
signal: controller.signal,
|
|
209
|
-
headers: { Accept: "application/json" }
|
|
210
|
-
});
|
|
211
|
-
if (!res.ok) {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
const json = await res.json();
|
|
215
|
-
const code = (json.country || json.country_code || json.countryCode || json.country_code2 || "").toString().toUpperCase();
|
|
216
|
-
if (code && hasCountry(code)) {
|
|
217
|
-
try {
|
|
218
|
-
localStorage.setItem(CACHE_KEY, JSON.stringify({ country_code: code, ts: Date.now() }));
|
|
219
|
-
} catch {
|
|
220
|
-
}
|
|
221
|
-
return code;
|
|
222
|
-
}
|
|
223
|
-
} catch {
|
|
224
|
-
} finally {
|
|
225
|
-
clearTimeout(timeoutId);
|
|
226
|
-
}
|
|
227
|
-
return null;
|
|
228
|
-
};
|
|
229
224
|
const selectInitialCountry = (id, emitFn) => {
|
|
230
225
|
const previousId = selectedId.value;
|
|
231
226
|
selectedId.value = id;
|
|
@@ -238,7 +233,7 @@ var lib = (function(exports, vue) {
|
|
|
238
233
|
return;
|
|
239
234
|
}
|
|
240
235
|
if (!detect) return;
|
|
241
|
-
const geo = await detectByGeoIp();
|
|
236
|
+
const geo = await detectByGeoIp(hasCountry);
|
|
242
237
|
if (geo) {
|
|
243
238
|
selectInitialCountry(geo, emitFn);
|
|
244
239
|
return;
|
|
@@ -334,6 +329,9 @@ var lib = (function(exports, vue) {
|
|
|
334
329
|
if (!el) return [0, 0];
|
|
335
330
|
return [el.selectionStart ?? 0, el.selectionEnd ?? 0];
|
|
336
331
|
}
|
|
332
|
+
const Delimiters = [" ", "-", "(", ")"];
|
|
333
|
+
const NavigationKeys = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "Tab"];
|
|
334
|
+
const InvalidPattern = /[^\d\s\-()]/;
|
|
337
335
|
function useMask(selected, telRef) {
|
|
338
336
|
const digits = vue.ref("");
|
|
339
337
|
const displayValue = vue.ref("");
|
|
@@ -364,17 +362,17 @@ var lib = (function(exports, vue) {
|
|
|
364
362
|
if (startIdx >= endIdx) return;
|
|
365
363
|
digits.value = digits.value.slice(0, startIdx) + digits.value.slice(endIdx);
|
|
366
364
|
};
|
|
367
|
-
const handleBeforeInput = (
|
|
368
|
-
const el =
|
|
365
|
+
const handleBeforeInput = (e2) => {
|
|
366
|
+
const el = e2.target;
|
|
369
367
|
if (!el) return;
|
|
370
|
-
const data =
|
|
371
|
-
if (
|
|
368
|
+
const data = e2.data;
|
|
369
|
+
if (e2.inputType !== "insertText" || !data) return;
|
|
372
370
|
if (InvalidPattern.test(data) || data === " " && el.value.endsWith(" ")) {
|
|
373
|
-
|
|
371
|
+
e2.preventDefault();
|
|
374
372
|
}
|
|
375
373
|
};
|
|
376
|
-
const handleInput = (
|
|
377
|
-
const el =
|
|
374
|
+
const handleInput = (e2) => {
|
|
375
|
+
const el = e2.target;
|
|
378
376
|
if (!el) return;
|
|
379
377
|
const newDigits = extractDigits(el.value, maxDigits.value);
|
|
380
378
|
showValidationHint.value = false;
|
|
@@ -392,13 +390,13 @@ var lib = (function(exports, vue) {
|
|
|
392
390
|
setCaretToDigitPosition(digits.value.length);
|
|
393
391
|
});
|
|
394
392
|
};
|
|
395
|
-
const handleKeydownInternal = (
|
|
396
|
-
const el = telRef.value ??
|
|
393
|
+
const handleKeydownInternal = (e2) => {
|
|
394
|
+
const el = telRef.value ?? e2.target;
|
|
397
395
|
if (!el) return;
|
|
398
|
-
if (
|
|
396
|
+
if (e2.ctrlKey || e2.metaKey || e2.altKey || NavigationKeys.includes(e2.key)) return;
|
|
399
397
|
const [selStart, selEnd] = getSelection(el);
|
|
400
|
-
if (
|
|
401
|
-
|
|
398
|
+
if (e2.key === "Backspace") {
|
|
399
|
+
e2.preventDefault();
|
|
402
400
|
if (selStart !== selEnd) {
|
|
403
401
|
const range = formatter.value.getDigitRange(digits.value, selStart, selEnd);
|
|
404
402
|
if (range) {
|
|
@@ -427,8 +425,8 @@ var lib = (function(exports, vue) {
|
|
|
427
425
|
}
|
|
428
426
|
return;
|
|
429
427
|
}
|
|
430
|
-
if (
|
|
431
|
-
|
|
428
|
+
if (e2.key === "Delete") {
|
|
429
|
+
e2.preventDefault();
|
|
432
430
|
if (selStart !== selEnd) {
|
|
433
431
|
const range = formatter.value.getDigitRange(digits.value, selStart, selEnd);
|
|
434
432
|
if (range) {
|
|
@@ -450,30 +448,30 @@ var lib = (function(exports, vue) {
|
|
|
450
448
|
}
|
|
451
449
|
return;
|
|
452
450
|
}
|
|
453
|
-
if (/^[0-9]$/.test(
|
|
451
|
+
if (/^[0-9]$/.test(e2.key)) {
|
|
454
452
|
if (digits.value.length >= maxDigits.value) {
|
|
455
|
-
|
|
453
|
+
e2.preventDefault();
|
|
456
454
|
}
|
|
457
455
|
return;
|
|
458
456
|
}
|
|
459
|
-
if (
|
|
460
|
-
|
|
457
|
+
if (e2.key.length === 1) {
|
|
458
|
+
e2.preventDefault();
|
|
461
459
|
}
|
|
462
460
|
};
|
|
463
|
-
const handleKeydown = (
|
|
461
|
+
const handleKeydown = (e2) => {
|
|
464
462
|
showValidationHint.value = false;
|
|
465
463
|
if (validationTimer.value) {
|
|
466
464
|
clearTimeout(validationTimer.value);
|
|
467
465
|
}
|
|
468
|
-
handleKeydownInternal(
|
|
466
|
+
handleKeydownInternal(e2);
|
|
469
467
|
if (validationTimer.value) clearTimeout(validationTimer.value);
|
|
470
468
|
validationTimer.value = setTimeout(() => {
|
|
471
469
|
if (!isComplete.value && !isEmpty.value) showValidationHint.value = true;
|
|
472
470
|
}, 300);
|
|
473
471
|
};
|
|
474
|
-
const handlePaste = (
|
|
475
|
-
|
|
476
|
-
const text =
|
|
472
|
+
const handlePaste = (e2) => {
|
|
473
|
+
e2.preventDefault();
|
|
474
|
+
const text = e2.clipboardData?.getData("text") || "";
|
|
477
475
|
const pastedDigits = extractDigits(text, maxDigits.value);
|
|
478
476
|
if (pastedDigits.length === 0) return;
|
|
479
477
|
const el = telRef.value;
|
|
@@ -664,11 +662,7 @@ var lib = (function(exports, vue) {
|
|
|
664
662
|
const liveRef = vue.useTemplateRef("liveRef");
|
|
665
663
|
const dropdownRef = vue.useTemplateRef("dropdownRef");
|
|
666
664
|
const usedLocale = vue.computed(() => {
|
|
667
|
-
|
|
668
|
-
if (typeof navigator !== "undefined") {
|
|
669
|
-
return navigator.language || "en";
|
|
670
|
-
}
|
|
671
|
-
return "en";
|
|
665
|
+
return props.locale || getNavigatorLang();
|
|
672
666
|
});
|
|
673
667
|
const dropdownStyle = vue.shallowRef({});
|
|
674
668
|
const countrySelector = useCountrySelector(usedLocale);
|
|
@@ -725,30 +719,30 @@ var lib = (function(exports, vue) {
|
|
|
725
719
|
digits: digits.value
|
|
726
720
|
});
|
|
727
721
|
};
|
|
728
|
-
const onInput = async (
|
|
722
|
+
const onInput = async (e2) => {
|
|
729
723
|
if (inactive.value) return;
|
|
730
|
-
mask.handleInput(
|
|
724
|
+
mask.handleInput(e2);
|
|
731
725
|
await vue.nextTick();
|
|
732
726
|
emitModelUpdate();
|
|
733
727
|
};
|
|
734
|
-
const onKeydown = async (
|
|
728
|
+
const onKeydown = async (e2) => {
|
|
735
729
|
if (inactive.value) return;
|
|
736
|
-
mask.handleKeydown(
|
|
730
|
+
mask.handleKeydown(e2);
|
|
737
731
|
await vue.nextTick();
|
|
738
732
|
emitModelUpdate();
|
|
739
733
|
};
|
|
740
|
-
const onPaste = async (
|
|
734
|
+
const onPaste = async (e2) => {
|
|
741
735
|
if (inactive.value) return;
|
|
742
|
-
mask.handlePaste(
|
|
736
|
+
mask.handlePaste(e2);
|
|
743
737
|
await vue.nextTick();
|
|
744
738
|
emitModelUpdate();
|
|
745
739
|
};
|
|
746
|
-
const onFocus = (
|
|
740
|
+
const onFocus = (e2) => {
|
|
747
741
|
mask.handleFocus();
|
|
748
742
|
dropdownOpened.value = false;
|
|
749
|
-
emit("focus",
|
|
743
|
+
emit("focus", e2);
|
|
750
744
|
};
|
|
751
|
-
const onBlur = (
|
|
745
|
+
const onBlur = (e2) => emit("blur", e2);
|
|
752
746
|
const onSelectCountry = async (countryId) => {
|
|
753
747
|
countrySelector.selectCountry(countryId);
|
|
754
748
|
emit("country-change", selected.value);
|
|
@@ -774,8 +768,8 @@ var lib = (function(exports, vue) {
|
|
|
774
768
|
await vue.nextTick();
|
|
775
769
|
telRef.value?.focus();
|
|
776
770
|
};
|
|
777
|
-
const positionDropdown = (
|
|
778
|
-
if (
|
|
771
|
+
const positionDropdown = (e2) => {
|
|
772
|
+
if (e2?.type === "scroll" && e2.target && dropdownRef.value?.contains(e2.target)) return;
|
|
779
773
|
const root = rootRef.value;
|
|
780
774
|
if (!root) return;
|
|
781
775
|
const rect = root.getBoundingClientRect();
|
|
@@ -1117,42 +1111,7 @@ var lib = (function(exports, vue) {
|
|
|
1117
1111
|
}
|
|
1118
1112
|
return target;
|
|
1119
1113
|
};
|
|
1120
|
-
const PhoneInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1121
|
-
function getNavigatorLang() {
|
|
1122
|
-
if (typeof navigator !== "undefined") {
|
|
1123
|
-
return navigator.language || "";
|
|
1124
|
-
}
|
|
1125
|
-
return "";
|
|
1126
|
-
}
|
|
1127
|
-
function getCountry(countryCode, locale) {
|
|
1128
|
-
const isEn = locale.toLowerCase().startsWith("en");
|
|
1129
|
-
const countriesMap = isEn ? m : MasksFullMap(locale);
|
|
1130
|
-
const id = countryCode.toUpperCase();
|
|
1131
|
-
const found = countriesMap[id];
|
|
1132
|
-
return found ? { id, ...found } : null;
|
|
1133
|
-
}
|
|
1134
|
-
function getDefaultCountry(locale) {
|
|
1135
|
-
const isEn = locale.toLowerCase().startsWith("en");
|
|
1136
|
-
const countries = isEn ? m : MasksFullMap(locale);
|
|
1137
|
-
return { id: "US", ...countries.US };
|
|
1138
|
-
}
|
|
1139
|
-
async function detectCountryFromGeoIP() {
|
|
1140
|
-
try {
|
|
1141
|
-
const controller = new AbortController();
|
|
1142
|
-
const timeoutId = setTimeout(() => controller.abort(), GEO_IP_TIMEOUT);
|
|
1143
|
-
const res = await fetch(GEO_IP_URL, {
|
|
1144
|
-
signal: controller.signal,
|
|
1145
|
-
headers: { Accept: "application/json" }
|
|
1146
|
-
});
|
|
1147
|
-
clearTimeout(timeoutId);
|
|
1148
|
-
if (!res.ok) return null;
|
|
1149
|
-
const json = await res.json();
|
|
1150
|
-
const code = (json.country || json.country_code || json.countryCode || json.country_code2 || "").toString().toUpperCase();
|
|
1151
|
-
return code || null;
|
|
1152
|
-
} catch {
|
|
1153
|
-
return null;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1114
|
+
const PhoneInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-755b15ee"]]);
|
|
1156
1115
|
function detectCountryFromLocale() {
|
|
1157
1116
|
try {
|
|
1158
1117
|
const lang = getNavigatorLang();
|
|
@@ -1175,24 +1134,24 @@ var lib = (function(exports, vue) {
|
|
|
1175
1134
|
} else if (typeof value === "object" && value !== null) {
|
|
1176
1135
|
options = value;
|
|
1177
1136
|
}
|
|
1178
|
-
const locale = options.locale || getNavigatorLang()
|
|
1179
|
-
let country
|
|
1137
|
+
const locale = options.locale || getNavigatorLang();
|
|
1138
|
+
let country;
|
|
1180
1139
|
if (options.country) {
|
|
1181
1140
|
country = getCountry(options.country, locale);
|
|
1182
1141
|
} else if (options.detect) {
|
|
1183
1142
|
const geoCountry = await detectCountryFromGeoIP();
|
|
1184
1143
|
if (geoCountry) {
|
|
1185
1144
|
country = getCountry(geoCountry, locale);
|
|
1186
|
-
}
|
|
1187
|
-
if (!country) {
|
|
1145
|
+
} else {
|
|
1188
1146
|
const localeCountry = detectCountryFromLocale();
|
|
1189
1147
|
if (localeCountry) {
|
|
1190
1148
|
country = getCountry(localeCountry, locale);
|
|
1149
|
+
} else {
|
|
1150
|
+
country = getCountry("US", locale);
|
|
1191
1151
|
}
|
|
1192
1152
|
}
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
country = getDefaultCountry(locale);
|
|
1153
|
+
} else {
|
|
1154
|
+
country = getCountry("US", locale);
|
|
1196
1155
|
}
|
|
1197
1156
|
return {
|
|
1198
1157
|
country,
|
|
@@ -1215,17 +1174,17 @@ var lib = (function(exports, vue) {
|
|
|
1215
1174
|
}
|
|
1216
1175
|
}
|
|
1217
1176
|
function createBeforeInputHandler(el) {
|
|
1218
|
-
return (
|
|
1219
|
-
const data =
|
|
1220
|
-
if (
|
|
1177
|
+
return (e2) => {
|
|
1178
|
+
const data = e2.data;
|
|
1179
|
+
if (e2.inputType !== "insertText" || !data) return;
|
|
1221
1180
|
if (InvalidPattern.test(data) || data === " " && el.value.endsWith(" ")) {
|
|
1222
|
-
|
|
1181
|
+
e2.preventDefault();
|
|
1223
1182
|
}
|
|
1224
1183
|
};
|
|
1225
1184
|
}
|
|
1226
1185
|
function createInputHandler(el, state) {
|
|
1227
|
-
return (
|
|
1228
|
-
const target =
|
|
1186
|
+
return (e2) => {
|
|
1187
|
+
const target = e2.target;
|
|
1229
1188
|
if (!target) return;
|
|
1230
1189
|
const raw = target.value || "";
|
|
1231
1190
|
const maxDigits = state.formatter.getMaxDigits();
|
|
@@ -1238,11 +1197,11 @@ var lib = (function(exports, vue) {
|
|
|
1238
1197
|
};
|
|
1239
1198
|
}
|
|
1240
1199
|
function createKeydownHandler(el, state) {
|
|
1241
|
-
return (
|
|
1242
|
-
if (
|
|
1200
|
+
return (e2) => {
|
|
1201
|
+
if (e2.ctrlKey || e2.metaKey || e2.altKey || NavigationKeys.includes(e2.key)) return;
|
|
1243
1202
|
const [selStart, selEnd] = getSelection(el);
|
|
1244
|
-
if (
|
|
1245
|
-
|
|
1203
|
+
if (e2.key === "Backspace") {
|
|
1204
|
+
e2.preventDefault();
|
|
1246
1205
|
if (selStart !== selEnd) {
|
|
1247
1206
|
const range = state.formatter.getDigitRange(state.digits, selStart, selEnd);
|
|
1248
1207
|
if (range) {
|
|
@@ -1277,8 +1236,8 @@ var lib = (function(exports, vue) {
|
|
|
1277
1236
|
}
|
|
1278
1237
|
return;
|
|
1279
1238
|
}
|
|
1280
|
-
if (
|
|
1281
|
-
|
|
1239
|
+
if (e2.key === "Delete") {
|
|
1240
|
+
e2.preventDefault();
|
|
1282
1241
|
if (selStart !== selEnd) {
|
|
1283
1242
|
const range = state.formatter.getDigitRange(state.digits, selStart, selEnd);
|
|
1284
1243
|
if (range) {
|
|
@@ -1306,21 +1265,21 @@ var lib = (function(exports, vue) {
|
|
|
1306
1265
|
}
|
|
1307
1266
|
return;
|
|
1308
1267
|
}
|
|
1309
|
-
if (/^[0-9]$/.test(
|
|
1268
|
+
if (/^[0-9]$/.test(e2.key)) {
|
|
1310
1269
|
if (state.digits.length >= state.formatter.getMaxDigits()) {
|
|
1311
|
-
|
|
1270
|
+
e2.preventDefault();
|
|
1312
1271
|
}
|
|
1313
1272
|
return;
|
|
1314
1273
|
}
|
|
1315
|
-
if (
|
|
1316
|
-
|
|
1274
|
+
if (e2.key.length === 1) {
|
|
1275
|
+
e2.preventDefault();
|
|
1317
1276
|
}
|
|
1318
1277
|
};
|
|
1319
1278
|
}
|
|
1320
1279
|
function createPasteHandler(el, state) {
|
|
1321
|
-
return (
|
|
1322
|
-
|
|
1323
|
-
const text =
|
|
1280
|
+
return (e2) => {
|
|
1281
|
+
e2.preventDefault();
|
|
1282
|
+
const text = e2.clipboardData?.getData("text") || "";
|
|
1324
1283
|
const maxDigits = state.formatter.getMaxDigits();
|
|
1325
1284
|
const pastedDigits = extractDigits(text, maxDigits);
|
|
1326
1285
|
if (pastedDigits.length === 0) return;
|
|
@@ -1354,7 +1313,6 @@ var lib = (function(exports, vue) {
|
|
|
1354
1313
|
}
|
|
1355
1314
|
async function updateCountry(el, state, newCountryCode) {
|
|
1356
1315
|
const newCountry = getCountry(newCountryCode, state.locale);
|
|
1357
|
-
if (!newCountry) return;
|
|
1358
1316
|
state.country = newCountry;
|
|
1359
1317
|
state.formatter = createPhoneFormatter(newCountry);
|
|
1360
1318
|
el.placeholder = state.formatter.getPlaceholder();
|