@ozdao/prometheus-framework 0.2.36 → 0.2.38
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main.css +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +42 -52
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.js +39 -242
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.cjs +1 -0
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.js +373 -0
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue2.js +4 -0
- package/dist/prometheus-framework/src/components/FieldPhone/click-outside.cjs +1 -2
- package/dist/prometheus-framework/src/components/FieldPhone/click-outside.js +13 -13
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.js +111 -2
- package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue2.js +49 -47
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +43 -42
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +61 -56
- package/dist/prometheus-framework/src/modules/events/components/sections/SectionMainGuest.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/SectionMainGuest.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/store/events.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/store/events.js +59 -39
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +31 -31
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.js +85 -55
- package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/orders.js +30 -38
- package/dist/prometheus-framework/src/modules/orders/store/shopcart.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/shopcart.js +31 -21
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +95 -92
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +54 -74
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +58 -48
- package/dist/prometheus-framework/src/modules/products/store/products.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.js +26 -26
- package/dist/prometheus-framework.cjs.js +18 -18
- package/dist/prometheus-framework.es.js +507 -493
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/modules/globals/store/globals.js +0 -1
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Button.vue.cjs");const u=["disabled"],d={key:0},m={key:
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Button.vue.cjs");const u=["disabled"],d={key:0},m={key:1,class:"loading"},h=e.createElementVNode("svg",{class:"i-regular",width:"135",height:"140",viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:"#fff"},[e.createElementVNode("rect",{y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"60",width:"15",height:"140",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})])],-1),b=[h],f={key:2,class:"t-semi loading t-black"},g={key:3,class:"error"},v={key:0,class:"button-counter"},y={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},text:{type:Object,default:t=>(console.log(t),t={...t.text,success:"✔",error:"✖"})},counter:{type:Object},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},showSucces:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!0},validation:{type:Boolean,default:!1}},setup(t){const n=t,a=e.ref(null),l=e.ref(null),o=e.ref(!1),c=e.ref(!1);async function r(){a.value.style["pointer-events"]="none",l.value=null,o.value=!0;const i=()=>{a.value&&(a.value.classList.replace("bg-fifth","bg-main"),a.value.style.pointerEvents="auto",o.value=!1,c.value=!1,l.value=null)};try{await n.submit(),a.value.classList.replace("bg-main","bg-fifth"),o.value=!1,n.showSucces?(c.value=!0,setTimeout(i,500)):i(),n.callback&&setTimeout(()=>n.callback(),n.callbackDelay)}catch{a.value.classList.replace("bg-main","bg-fourth-nano"),l.value=n.error,setTimeout(()=>{i(),a.value.classList.replace("bg-fourth-nano","bg-main")},1330)}}return(i,s)=>(e.openBlock(),e.createElementBlock("button",{onClick:e.withModifiers(r,["stop"]),disabled:t.validation,ref_key:"button",ref:a,class:"button"},[e.createVNode(e.Transition,{name:"moveFromTopAbsolute"},{default:e.withCtx(()=>[!o.value&&!l.value&&!c.value||!t.showLoader?(e.openBlock(),e.createElementBlock("span",d,[e.renderSlot(i.$slots,"default")])):o.value&&!l.value&&t.showLoader?(e.openBlock(),e.createElementBlock("span",m,b)):c.value&&t.showSucces?(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(t.text.success),1)):l.value?(e.openBlock(),e.createElementBlock("span",g,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)]),_:3}),t.counter?(e.openBlock(),e.createElementBlock("p",v,e.toDisplayString(t.counter),1)):e.createCommentVNode("",!0)],8,u))}};exports.default=y;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { ref as
|
1
|
+
import { ref as d, openBlock as l, createElementBlock as s, withModifiers as v, createVNode as g, Transition as y, withCtx as p, renderSlot as w, toDisplayString as h, createCommentVNode as b, createElementVNode as e, createTextVNode as r } from "vue";
|
2
2
|
import "./Button.vue.js";
|
3
|
-
const k = ["disabled"],
|
4
|
-
key:
|
3
|
+
const k = ["disabled"], x = { key: 0 }, N = {
|
4
|
+
key: 1,
|
5
5
|
class: "loading"
|
6
|
-
},
|
6
|
+
}, C = /* @__PURE__ */ e("svg", {
|
7
7
|
class: "i-regular",
|
8
8
|
width: "135",
|
9
9
|
height: "140",
|
@@ -25,7 +25,7 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
25
25
|
calcMode: "linear",
|
26
26
|
repeatCount: "indefinite"
|
27
27
|
}),
|
28
|
-
/* @__PURE__ */
|
28
|
+
/* @__PURE__ */ r(),
|
29
29
|
/* @__PURE__ */ e("animate", {
|
30
30
|
attributeName: "y",
|
31
31
|
begin: "0.5s",
|
@@ -50,7 +50,7 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
50
50
|
calcMode: "linear",
|
51
51
|
repeatCount: "indefinite"
|
52
52
|
}),
|
53
|
-
/* @__PURE__ */
|
53
|
+
/* @__PURE__ */ r(),
|
54
54
|
/* @__PURE__ */ e("animate", {
|
55
55
|
attributeName: "y",
|
56
56
|
begin: "0.25s",
|
@@ -74,7 +74,7 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
74
74
|
calcMode: "linear",
|
75
75
|
repeatCount: "indefinite"
|
76
76
|
}),
|
77
|
-
/* @__PURE__ */
|
77
|
+
/* @__PURE__ */ r(),
|
78
78
|
/* @__PURE__ */ e("animate", {
|
79
79
|
attributeName: "y",
|
80
80
|
begin: "0s",
|
@@ -99,7 +99,7 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
99
99
|
calcMode: "linear",
|
100
100
|
repeatCount: "indefinite"
|
101
101
|
}),
|
102
|
-
/* @__PURE__ */
|
102
|
+
/* @__PURE__ */ r(),
|
103
103
|
/* @__PURE__ */ e("animate", {
|
104
104
|
attributeName: "y",
|
105
105
|
begin: "0.25s",
|
@@ -124,7 +124,7 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
124
124
|
calcMode: "linear",
|
125
125
|
repeatCount: "indefinite"
|
126
126
|
}),
|
127
|
-
/* @__PURE__ */
|
127
|
+
/* @__PURE__ */ r(),
|
128
128
|
/* @__PURE__ */ e("animate", {
|
129
129
|
attributeName: "y",
|
130
130
|
begin: "0.5s",
|
@@ -134,15 +134,15 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
134
134
|
repeatCount: "indefinite"
|
135
135
|
})
|
136
136
|
])
|
137
|
-
], -1),
|
138
|
-
|
139
|
-
],
|
140
|
-
key:
|
141
|
-
class: "loading t-
|
142
|
-
},
|
143
|
-
key:
|
137
|
+
], -1), M = [
|
138
|
+
C
|
139
|
+
], B = {
|
140
|
+
key: 2,
|
141
|
+
class: "t-semi loading t-black"
|
142
|
+
}, _ = {
|
143
|
+
key: 3,
|
144
144
|
class: "error"
|
145
|
-
},
|
145
|
+
}, L = {
|
146
146
|
key: 0,
|
147
147
|
class: "button-counter"
|
148
148
|
}, V = {
|
@@ -154,6 +154,14 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
154
154
|
console.log("Button click.");
|
155
155
|
}
|
156
156
|
},
|
157
|
+
text: {
|
158
|
+
type: Object,
|
159
|
+
default: (t) => (console.log(t), t = {
|
160
|
+
...t.text,
|
161
|
+
success: "✔",
|
162
|
+
error: "✖"
|
163
|
+
})
|
164
|
+
},
|
157
165
|
counter: {
|
158
166
|
type: Object
|
159
167
|
},
|
@@ -180,55 +188,37 @@ const k = ["disabled"], N = { key: 0 }, x = {
|
|
180
188
|
default: !1
|
181
189
|
}
|
182
190
|
},
|
183
|
-
setup(
|
184
|
-
const
|
185
|
-
async function
|
186
|
-
|
191
|
+
setup(t) {
|
192
|
+
const n = t, a = d(null), i = d(null), u = d(!1), c = d(!1);
|
193
|
+
async function f() {
|
194
|
+
a.value.style["pointer-events"] = "none", i.value = null, u.value = !0;
|
187
195
|
const o = () => {
|
188
|
-
|
196
|
+
a.value && (a.value.classList.replace("bg-fifth", "bg-main"), a.value.style.pointerEvents = "auto", u.value = !1, c.value = !1, i.value = null);
|
189
197
|
};
|
190
198
|
try {
|
191
|
-
await
|
199
|
+
await n.submit(), a.value.classList.replace("bg-main", "bg-fifth"), u.value = !1, n.showSucces ? (c.value = !0, setTimeout(o, 500)) : o(), n.callback && setTimeout(() => n.callback(), n.callbackDelay);
|
192
200
|
} catch {
|
193
|
-
|
194
|
-
o(),
|
201
|
+
a.value.classList.replace("bg-main", "bg-fourth-nano"), i.value = n.error, setTimeout(() => {
|
202
|
+
o(), a.value.classList.replace("bg-fourth-nano", "bg-main");
|
195
203
|
}, 1330);
|
196
204
|
}
|
197
205
|
}
|
198
|
-
return (o,
|
199
|
-
onClick:
|
200
|
-
disabled:
|
206
|
+
return (o, m) => (l(), s("button", {
|
207
|
+
onClick: v(f, ["stop"]),
|
208
|
+
disabled: t.validation,
|
201
209
|
ref_key: "button",
|
202
|
-
ref:
|
210
|
+
ref: a,
|
203
211
|
class: "button"
|
204
212
|
}, [
|
205
|
-
|
206
|
-
default:
|
207
|
-
!u.value && !
|
213
|
+
g(y, { name: "moveFromTopAbsolute" }, {
|
214
|
+
default: p(() => [
|
215
|
+
!u.value && !i.value && !c.value || !t.showLoader ? (l(), s("span", x, [
|
208
216
|
w(o.$slots, "default")
|
209
|
-
])) :
|
217
|
+
])) : u.value && !i.value && t.showLoader ? (l(), s("span", N, M)) : c.value && t.showSucces ? (l(), s("span", B, h(t.text.success), 1)) : i.value ? (l(), s("span", _, h(i.value), 1)) : b("", !0)
|
210
218
|
]),
|
211
219
|
_: 3
|
212
220
|
}),
|
213
|
-
|
214
|
-
default: f(() => [
|
215
|
-
u.value && !n.value && a.showLoader ? (i(), l("span", x, C)) : r("", !0)
|
216
|
-
]),
|
217
|
-
_: 1
|
218
|
-
}),
|
219
|
-
m(b, { name: "TransitionTranslateY-small" }, {
|
220
|
-
default: f(() => [
|
221
|
-
d.value && a.showSucces ? (i(), l("span", T, "✔")) : r("", !0)
|
222
|
-
]),
|
223
|
-
_: 1
|
224
|
-
}),
|
225
|
-
m(b, { name: "TransitionTranslateY-small" }, {
|
226
|
-
default: f(() => [
|
227
|
-
n.value ? (i(), l("span", M, g(n.value), 1)) : r("", !0)
|
228
|
-
]),
|
229
|
-
_: 1
|
230
|
-
}),
|
231
|
-
a.counter ? (i(), l("p", B, g(a.counter), 1)) : r("", !0)
|
221
|
+
t.counter ? (l(), s("p", L, h(t.counter), 1)) : b("", !0)
|
232
222
|
], 8, k));
|
233
223
|
}
|
234
224
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("../Field/Field.vue2.cjs"),B=require("vue-i18n"),w={class:"pd-thin radius-extra flex-nowrap flex"},S=["innerHTML"],_={__name:"FieldBig",props:{input:String,placeholder:{type:String},action:{type:String,default:"Action"},placeholderTexts:{type:Object,default:()=>({en:["Lowest THC, please!","Something with banana flavors?","I'm in the mood for trippy vibes."],ru:["Я хочу самый низкий THC","Я хочу чего-нибудь бананового","Я хочу курнуть хейза"]})},typingSpeed:{type:Number,default:200},loopTyping:{type:Boolean,default:!1},enableTyping:{type:Boolean,default:!1}},emits:["update:input","action"],setup(c,{emit:y}){const t=c,{t:F,locale:s}=B.useI18n();let o=e.ref(0),n=e.ref(t.input),p=e.ref(t.placeholder),i=e.ref(t.enableTyping),d=e.ref(null),f=e.ref(""),r=e.ref(!0),v=null;const g=y;function m(){g("action")}function T(a){g("update:input",a),f.value=a}function h(){o.value=(o.value+1)%t.placeholderTexts[s.value].length}function I(){i.value=!1,clearInterval(d.value),p.value=t.placeholder,f.value||(n.value="")}function x(){!f.value&&t.enableTyping&&(i.value=!0,p.value="",b())}function b(){let a=t.placeholderTexts[s.value][o.value],l=0,u=!1;v=setInterval(()=>{r.value=!r.value},200),d.value=setInterval(()=>{i.value&&(u?(n.value=n.value.slice(0,-1),n.value=a.substring(0,l)+(r.value&&l%2?"|":""),l--):(n.value=a.substring(0,l)+(r.value&&l%2?"|":""),l++),l>a.length&&t.loopTyping&&setTimeout(()=>{u=!0,n.value=a.substring(0,l)},333),l===0&&u&&(u=!1,h(),a=t.placeholderTexts[s.value][o.value]))},t.typingSpeed)}return e.onMounted(()=>{t.enableTyping&&b()}),e.watchEffect(()=>{i.value||(clearInterval(d.value),clearInterval(v))}),(a,l)=>(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(k.default,{field:e.unref(n),"onUpdate:field":[l[0]||(l[0]=u=>e.isRef(n)?n.value=u:n=u),T],placeholder:e.unref(i)?" ":e.unref(p),onInput:h,onFocus:I,onBlur:x,class:"w-100 t-semi uppercase pd-small p-big"},null,8,["field","placeholder"]),c.action?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:m,class:"w-
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("../Field/Field.vue2.cjs"),B=require("vue-i18n"),w={class:"pd-thin radius-extra flex-nowrap flex"},S=["innerHTML"],_={__name:"FieldBig",props:{input:String,placeholder:{type:String},action:{type:String,default:"Action"},placeholderTexts:{type:Object,default:()=>({en:["Lowest THC, please!","Something with banana flavors?","I'm in the mood for trippy vibes."],ru:["Я хочу самый низкий THC","Я хочу чего-нибудь бананового","Я хочу курнуть хейза"]})},typingSpeed:{type:Number,default:200},loopTyping:{type:Boolean,default:!1},enableTyping:{type:Boolean,default:!1}},emits:["update:input","action"],setup(c,{emit:y}){const t=c,{t:F,locale:s}=B.useI18n();let o=e.ref(0),n=e.ref(t.input),p=e.ref(t.placeholder),i=e.ref(t.enableTyping),d=e.ref(null),f=e.ref(""),r=e.ref(!0),v=null;const g=y;function m(){g("action")}function T(a){g("update:input",a),f.value=a}function h(){o.value=(o.value+1)%t.placeholderTexts[s.value].length}function I(){i.value=!1,clearInterval(d.value),p.value=t.placeholder,f.value||(n.value="")}function x(){!f.value&&t.enableTyping&&(i.value=!0,p.value="",b())}function b(){let a=t.placeholderTexts[s.value][o.value],l=0,u=!1;v=setInterval(()=>{r.value=!r.value},200),d.value=setInterval(()=>{i.value&&(u?(n.value=n.value.slice(0,-1),n.value=a.substring(0,l)+(r.value&&l%2?"|":""),l--):(n.value=a.substring(0,l)+(r.value&&l%2?"|":""),l++),l>a.length&&t.loopTyping&&setTimeout(()=>{u=!0,n.value=a.substring(0,l)},333),l===0&&u&&(u=!1,h(),a=t.placeholderTexts[s.value][o.value]))},t.typingSpeed)}return e.onMounted(()=>{t.enableTyping&&b()}),e.watchEffect(()=>{i.value||(clearInterval(d.value),clearInterval(v))}),(a,l)=>(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(k.default,{field:e.unref(n),"onUpdate:field":[l[0]||(l[0]=u=>e.isRef(n)?n.value=u:n=u),T],placeholder:e.unref(i)?" ":e.unref(p),onInput:h,onFocus:I,onBlur:x,class:"w-100 t-semi uppercase pd-small p-big"},null,8,["field","placeholder"]),c.action?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:m,class:"w-max hover-bg-black hover-t-white t-black bg-main button",innerHTML:c.action},null,8,S)):e.createCommentVNode("",!0)]))}};exports.default=_;
|
@@ -90,7 +90,7 @@ const N = { class: "pd-thin radius-extra flex-nowrap flex" }, V = ["innerHTML"],
|
|
90
90
|
p.action ? (b(), T("button", {
|
91
91
|
key: 0,
|
92
92
|
onClick: x,
|
93
|
-
class: "w-
|
93
|
+
class: "w-max hover-bg-black hover-t-white t-black bg-main button",
|
94
94
|
innerHTML: p.action
|
95
95
|
}, null, 8, V)) : _("", !0)
|
96
96
|
]));
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),u=require("./utils.cjs"),f=require("./click-outside.cjs");require("./FieldPhone.vue2.cjs");const y=require("../../../../_virtual/_plugin-vue_export-helper.cjs"),h=require("../../../node_modules/libphonenumber-js/min/exports/parsePhoneNumber.cjs");function r(e){const t=u.default.options[e];return typeof t>"u"?u.default.options[e]:t}const C=i.defineComponent({name:"Vue3ReactiveTelInput",directives:{clickOutside:f.default},props:{modelValue:{type:String,default:""},badClass:{type:[String,Array,Object],default:""},goodClass:{type:[String,Array,Object],default:""},badStyle:{type:[String,Array,Object],default:""},goodStyle:{type:[String,Array,Object],default:""},badInputClass:{type:[String,Array,Object],default:""},goodInputClass:{type:[String,Array,Object],default:""},badInputStyle:{type:[String,Array,Object],default:""},goodInputStyle:{type:[String,Array,Object],default:""},allCountries:{type:Array,default:()=>r("allCountries")},autoFormat:{type:Boolean,default:()=>r("autoFormat")},validation:{type:[Boolean,Object],default:!1},customValidate:{type:[Boolean,RegExp],default:()=>r("customValidate")},defaultCountry:{type:String,default:()=>r("defaultCountry")},disabled:{type:Boolean,default:()=>r("disabled")},autoDefaultCountry:{type:Boolean,default:()=>r("autoDefaultCountry")},dropdownOptions:{type:Object,default:()=>r("dropdownOptions")},ignoredCountries:{type:Array,default:()=>r("ignoredCountries")},inputOptions:{type:Object,default:()=>r("inputOptions")},invalidMsg:{type:String,default:()=>r("invalidMsg")},mode:{type:String,default:()=>r("mode")},onlyCountries:{type:Array,default:()=>r("onlyCountries")},preferredCountries:{type:Array,default:()=>r("preferredCountries")},validCharactersOnly:{type:Boolean,default:()=>r("validCharactersOnly")},rootClass:{type:[String,Array,Object],default:()=>r("styleClasses")},inputClass:{type:[String,Array,Object],default:()=>""},divInputClass:{type:[String,Array,Object],default:()=>""},rootStyle:{type:[String,Array,Object],default:()=>""},dropdownStyle:{type:[String,Array,Object],default:()=>""},listStyle:{type:[String,Array,Object],default:()=>""},inputStyle:{type:[String,Array,Object],default:()=>""},inputId:{type:[String,Array,Object],default:()=>""},Placeholder:{type:[String,Object,Function],default:()=>""}},data(){return{counter:5,initCounter:5,message:{action:null,amount:null},phone:this.modelValue?this.modelValue:"",activeCountryCode:"",open:!1,finishMounted:!1,selectedIndex:null,typeToFindInput:"",typeToFindTimer:null,dropdownOpenDirection:"below",parsedPlaceholder:this.Placeholder!==""?this.Placeholder:this.inputOptions.placeholder}},watch:{activeCountry(e,t){if(!e&&(t!=null&&t.iso2)){this.activeCountryCode=t.iso2;return}e!=null&&e.iso2&&this.$emit("country-changed",e)},"phoneObject.countryCode":function(e){this.activeCountryCode=e},"phoneObject.valid":function(){this.$emit("validate",this.phoneObject)},"phoneObject.formatted":function(e){!this.autoFormat||this.customValidate||(this.emitInput(e),this.$nextTick(()=>{e&&!this.value&&(this.phone=e)}))},"inputOptions.placeholder":function(){this.resetPlaceholder()},value(e,t){this.testCharacters()?this.phone=e:this.$nextTick(()=>{this.phone=t,this.onInput()})},open(e){e?(this.setDropdownPosition(),this.$emit("open")):this.$emit("close")}},mounted(){this.cleanInvalidCharacters(),this.initializeCountry().then(()=>{var e;!this.phone&&((e=this.inputOptions)!=null&&e.showDialCode)&&this.activeCountryCode&&(this.phone=`+${this.activeCountryCode}`),this.$emit("validate",this.phoneObject)}).catch(console.error).then(()=>{this.finishMounted=!0})},computed:{activeCountry(){return this.findCountry(this.activeCountryCode)},activeCountryFlag(){return this.activeCountry?this.activeCountry.flag:null},parsedMode(){return this.mode==="auto"?!this.phone||this.phone[0]!=="+"?"national":"international":["international","national"].includes(this.mode)?this.mode:(console.error('Invalid value of prop "mode"'),"international")},filteredCountries(){return this.onlyCountries.length?this.allCountries.filter(({iso2:e})=>this.onlyCountries.some(t=>t.toUpperCase()===e)):this.ignoredCountries.length?this.allCountries.filter(({iso2:e})=>!this.ignoredCountries.includes(e.toUpperCase())&&!this.ignoredCountries.includes(e.toLowerCase())):this.allCountries},sortedCountries(){return[...this.getCountries(this.preferredCountries).map(t=>({...t,preferred:!0})),...this.filteredCountries]},phoneObject(){var a,d,n;let e;((a=this.phone)==null?void 0:a[0])==="+"?e=h.parsePhoneNumber(this.phone)||{}:e=h.parsePhoneNumber(this.phone,this.activeCountryCode)||{};const{metadata:t,...o}=e;let s=(d=e.isValid)==null?void 0:d.call(e),l=this.phone;return s&&(l=(n=e.format)==null?void 0:n.call(e,this.parsedMode.toUpperCase(),{nationalPrefix:!1})),e.country&&(this.ignoredCountries.length||this.onlyCountries.length)&&(this.findCountry(e.country)||(s=!1,Object.assign(e,{country:null}))),Object.assign(o,{countryCode:e.country,valid:s,country:this.activeCountry,formatted:l}),o},classes(){return this.phoneObject.valid===!0?this.goodClass:this.phoneObject.valid===!1?this.badClass:void 0},styles(){return this.phoneObject.valid===!0?this.goodStyle:this.phoneObject.valid===!1?this.badStyle:void 0},Iclasses(){return this.phoneObject.valid===!0?this.goodInputClass:this.phoneObject.valid===!1?this.badInputClass:void 0},Istyles(){return this.phoneObject.valid===!0?this.goodInputStyle:this.phoneObject.valid===!1?this.badInputStyle:void 0}},methods:{resetPlaceholder(){this.parsedPlaceholder=this.inputOptions.placeholder},initializeCountry(){return new Promise(e=>{var o;if(((o=this.phone)==null?void 0:o[0])==="+"){e();return}if(this.defaultCountry){this.choose(this.defaultCountry),e();return}const t=this.preferredCountries[0]||this.filteredCountries[0];this.autoDefaultCountry?u.getCountry().then(s=>{this.choose(s||this.activeCountryCode)}).catch(s=>{console.warn(s),this.choose(t)}).then(()=>{e()}):(this.choose(t),e())})},getCountries(e=[]){return e.map(t=>this.findCountry(t)).filter(Boolean)},findCountry(e=""){return this.filteredCountries.find(t=>t.iso2===e.toUpperCase())},getItemClass(e,t){const o=this.selectedIndex===e,s=e===this.preferredCountries.length-1,l=this.preferredCountries.some(a=>a.toUpperCase()===t);return{highlighted:o,"last-preferred":s,preferred:l}},choose(e){var o,s;let t=e;if(typeof t=="string"&&(t=this.findCountry(t)),!!t){if(((o=this.phone)==null?void 0:o[0])==="+"&&t.iso2&&this.phoneObject.nationalNumber){this.activeCountryCode=t.iso2,this.phone=h.parsePhoneNumber(this.phoneObject.nationalNumber,t.iso2).formatInternational();return}if((s=this.inputOptions)!=null&&s.showDialCode&&t){this.phone=`+${t.dialCode}`;return}this.activeCountryCode=t.iso2,this.emitInput(this.phone)}},cleanInvalidCharacters(){const e=this.phone;if(this.validCharactersOnly){const t=this.phone.match(/[()\-+0-9\s]*/g);this.phone=t.join("")}if(this.customValidate&&this.customValidate instanceof RegExp){const t=this.phone.match(this.customValidate);this.phone=t.join("")}e!==this.phone&&this.emitInput(this.phone)},testCharacters(){return this.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(this.phone)?!1:this.customValidate?this.testCustomValidate():!0},testCustomValidate(){return this.customValidate instanceof RegExp?this.customValidate.test(this.phone):!1},onInput(){this.$refs.input.setCustomValidity(this.phoneObject.valid?"":this.invalidMsg),this.emitInput(this.phoneObject)},emitInput(e){this.$emit("update:modelValue",e)},onBlur(){this.$emit("blur")},onFocus(){u.setCaretPosition(this.$refs.input,this.phone.length),this.$emit("focus")},onEnter(){this.$emit("enter")},onSpace(){this.$emit("space")},focus(){this.$refs.input.focus()},toggleDropdown(){this.disabled||(this.open=!this.open)},clickedOutside(){this.open=!1},keyboardNav(e){if(e.keyCode===40){e.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=0:this.selectedIndex=Math.min(this.sortedCountries.length-1,this.selectedIndex+1);const t=this.$refs.list.children[this.selectedIndex];t.offsetTop+t.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight&&(this.$refs.list.scrollTop=t.offsetTop-this.$refs.list.clientHeight+t.clientHeight)}else if(e.keyCode===38){e.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=this.sortedCountries.length-1:this.selectedIndex=Math.max(0,this.selectedIndex-1);const t=this.$refs.list.children[this.selectedIndex];t.offsetTop<this.$refs.list.scrollTop&&(this.$refs.list.scrollTop=t.offsetTop)}else if(e.keyCode===13)this.selectedIndex!==null&&this.choose(this.sortedCountries[this.selectedIndex]),this.open=!this.open;else{this.typeToFindInput+=e.key,clearTimeout(this.typeToFindTimer),this.typeToFindTimer=setTimeout(()=>{this.typeToFindInput=""},700);const t=this.sortedCountries.slice(this.preferredCountries.length).findIndex(o=>o.name.toLowerCase().startsWith(this.typeToFindInput));if(t>=0){this.selectedIndex=this.preferredCountries.length+t;const o=this.$refs.list.children[this.selectedIndex],s=o.offsetTop<this.$refs.list.scrollTop,l=o.offsetTop+o.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight;(s||l)&&(this.$refs.list.scrollTop=o.offsetTop-this.$refs.list.clientHeight/2)}}},reset(){this.selectedIndex=this.sortedCountries.map(e=>e.iso2).indexOf(this.activeCountryCode),this.open=!1},setDropdownPosition(){window.innerHeight-this.$refs.rootElement.getBoundingClientRect().bottom>200?this.dropdownOpenDirection="below":this.dropdownOpenDirection="above"}}}),m=["tabindex"],g={class:"flex-nowrap flex flex-v-center p-medium vti__selection"},b=["innerHTML"],O={key:1,class:"vti__country-code"},v=["onClick","onMousemove"],I=["innerHTML"],S={key:1},w=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex"],k={key:0,class:"mn-t-thin mn-b-thin invalid-feedback"};function j(e,t,o,s,l,a){const d=i.resolveDirective("click-outside");return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",{class:i.normalizeClass(["vue3-reactive-tel-input",{"bg-fourth-nano":e.validation},e.$attrs.class,e.rootClass,{disabled:e.disabled},e.classes]),style:i.normalizeStyle([e.rootStyle,e.styles]),ref:"rootElement"},[i.withDirectives((i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([["vti__dropdown",{open:e.open}],"br-solid br-black-transp br-1px radius-medium"]),tabindex:e.dropdownOptions.tabindex,onKeydown:[t[0]||(t[0]=(...n)=>e.keyboardNav&&e.keyboardNav(...n)),t[2]||(t[2]=i.withKeys((...n)=>e.reset&&e.reset(...n),["esc"]))],onClick:t[1]||(t[1]=(...n)=>e.toggleDropdown&&e.toggleDropdown(...n)),style:i.normalizeStyle([e.dropdownStyle])},[i.createElementVNode("span",g,[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:e.activeCountryFlag,class:"mn-r-thin"},null,8,b)):i.createCommentVNode("",!0),e.dropdownOptions.showDialCodeInSelection?(i.openBlock(),i.createElementBlock("span",O," +"+i.toDisplayString(e.activeCountry&&e.activeCountry.dialCode),1)):i.createCommentVNode("",!0)]),i.withDirectives(i.createElementVNode("ul",{ref:"list",class:i.normalizeClass(["bs-black radius-small vti__dropdown-list",e.dropdownOpenDirection]),style:i.normalizeStyle([e.listStyle])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.sortedCountries,(n,p)=>(i.openBlock(),i.createElementBlock("li",{class:i.normalizeClass(["flex-nowrap flex w-max",["vti__dropdown-item",e.getItemClass(p,n.iso2)]]),key:n.iso2+(n.preferred?"-preferred":""),onClick:c=>e.choose(n),onMousemove:c=>e.selectedIndex=p},[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:n.flag,class:"mn-r-thin"},null,8,I)):i.createCommentVNode("",!0),i.createElementVNode("strong",null,i.toDisplayString(n.name),1),e.dropdownOptions.showDialCodeInList?(i.openBlock(),i.createElementBlock("span",S," +"+i.toDisplayString(n.dialCode),1)):i.createCommentVNode("",!0)],42,v))),128))],6),[[i.vShow,e.open]])],46,m)),[[d,e.clickedOutside]]),i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":t[3]||(t[3]=n=>e.phone=n),pattern:"[0-9]*",ref:"input",type:e.inputOptions.type,autocomplete:e.inputOptions.autocomplete,autofocus:e.inputOptions.autofocus,class:i.normalizeClass(["vti__input",e.inputOptions.styleClasses,e.inputClass,e.Iclasses]),style:i.normalizeStyle([e.inputStyle,e.Istyles]),disabled:e.disabled,id:e.inputId!==""?e.inputId:e.inputOptions.id,maxlength:e.inputOptions.maxlength,name:e.inputId!==""?e.inputId:e.inputOptions.name,placeholder:e.parsedPlaceholder,readonly:e.inputOptions.readonly,required:e.inputOptions.required,tabindex:e.inputOptions.tabindex,onBlur:t[4]||(t[4]=(...n)=>e.onBlur&&e.onBlur(...n)),onFocus:t[5]||(t[5]=(...n)=>e.onFocus&&e.onFocus(...n)),onInput:t[6]||(t[6]=(...n)=>e.onInput&&e.onInput(...n)),onKeyup:[t[7]||(t[7]=i.withKeys((...n)=>e.onEnter&&e.onEnter(...n),["enter"])),t[8]||(t[8]=i.withKeys((...n)=>e.onSpace&&e.onSpace(...n),["space"]))]},null,46,w),[[i.vModelDynamic,e.phone]]),i.renderSlot(e.$slots,"default",{},void 0,!0)],6),i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[e.validation?(i.openBlock(),i.createElementBlock("div",k," * "+i.toDisplayString(e.validation.message),1)):i.createCommentVNode("",!0)]),_:1})],64)}const $=y.default(C,[["render",j],["__scopeId","data-v-5198d519"]]);exports.default=$;
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),u=require("./utils.cjs"),f=require("./click-outside.cjs");require("./FieldPhone.vue2.cjs");const y=require("../../../../_virtual/_plugin-vue_export-helper.cjs"),h=require("../../../node_modules/libphonenumber-js/min/exports/parsePhoneNumber.cjs");function r(e){const t=u.default.options[e];return typeof t>"u"?u.default.options[e]:t}const C=i.defineComponent({name:"Vue3ReactiveTelInput",directives:{clickOutside:f.default},props:{modelValue:{type:String,default:""},badClass:{type:[String,Array,Object],default:""},goodClass:{type:[String,Array,Object],default:""},badStyle:{type:[String,Array,Object],default:""},goodStyle:{type:[String,Array,Object],default:""},badInputClass:{type:[String,Array,Object],default:""},goodInputClass:{type:[String,Array,Object],default:""},badInputStyle:{type:[String,Array,Object],default:""},goodInputStyle:{type:[String,Array,Object],default:""},allCountries:{type:Array,default:()=>r("allCountries")},autoFormat:{type:Boolean,default:()=>r("autoFormat")},validation:{type:[Boolean,Object],default:!1},customValidate:{type:[Boolean,RegExp],default:()=>r("customValidate")},defaultCountry:{type:String,default:()=>r("defaultCountry")},disabled:{type:Boolean,default:()=>r("disabled")},autoDefaultCountry:{type:Boolean,default:()=>r("autoDefaultCountry")},dropdownOptions:{type:Object,default:()=>r("dropdownOptions")},ignoredCountries:{type:Array,default:()=>r("ignoredCountries")},inputOptions:{type:Object,default:()=>r("inputOptions")},invalidMsg:{type:String,default:()=>r("invalidMsg")},mode:{type:String,default:()=>r("mode")},onlyCountries:{type:Array,default:()=>r("onlyCountries")},preferredCountries:{type:Array,default:()=>r("preferredCountries")},validCharactersOnly:{type:Boolean,default:()=>r("validCharactersOnly")},rootClass:{type:[String,Array,Object],default:()=>r("styleClasses")},inputClass:{type:[String,Array,Object],default:()=>""},divInputClass:{type:[String,Array,Object],default:()=>""},rootStyle:{type:[String,Array,Object],default:()=>""},dropdownStyle:{type:[String,Array,Object],default:()=>""},listStyle:{type:[String,Array,Object],default:()=>""},inputStyle:{type:[String,Array,Object],default:()=>""},inputId:{type:[String,Array,Object],default:()=>""},Placeholder:{type:[String,Object,Function],default:()=>""}},data(){return{counter:5,initCounter:5,message:{action:null,amount:null},phone:this.modelValue?this.modelValue:"",activeCountryCode:"",open:!1,finishMounted:!1,selectedIndex:null,typeToFindInput:"",typeToFindTimer:null,dropdownOpenDirection:"below",parsedPlaceholder:this.Placeholder!==""?this.Placeholder:this.inputOptions.placeholder}},watch:{activeCountry(e,t){if(!e&&(t!=null&&t.iso2)){this.activeCountryCode=t.iso2;return}e!=null&&e.iso2&&this.$emit("country-changed",e)},"phoneObject.countryCode":function(e){this.activeCountryCode=e},"phoneObject.valid":function(){this.$emit("validate",this.phoneObject)},"phoneObject.formatted":function(e){!this.autoFormat||this.customValidate||(this.emitInput(e),this.$nextTick(()=>{e&&!this.value&&(this.phone=e)}))},"inputOptions.placeholder":function(){this.resetPlaceholder()},value(e,t){this.testCharacters()?this.phone=e:this.$nextTick(()=>{this.phone=t,this.onInput()})},open(e){e?(this.setDropdownPosition(),this.$emit("open")):this.$emit("close")}},mounted(){this.value&&(this.phone=this.value),this.cleanInvalidCharacters(),this.initializeCountry().then(()=>{var e;!this.phone&&((e=this.inputOptions)!=null&&e.showDialCode)&&this.activeCountryCode&&(this.phone=`+${this.activeCountryCode}`),this.$emit("validate",this.phoneObject)}).catch(console.error).then(()=>{this.finishMounted=!0})},computed:{activeCountry(){return this.findCountry(this.activeCountryCode)},activeCountryFlag(){return this.activeCountry?this.activeCountry.flag:null},parsedMode(){return this.mode==="auto"?!this.phone||this.phone[0]!=="+"?"national":"international":["international","national"].includes(this.mode)?this.mode:(console.error('Invalid value of prop "mode"'),"international")},filteredCountries(){return this.onlyCountries.length?this.allCountries.filter(({iso2:e})=>this.onlyCountries.some(t=>t.toUpperCase()===e)):this.ignoredCountries.length?this.allCountries.filter(({iso2:e})=>!this.ignoredCountries.includes(e.toUpperCase())&&!this.ignoredCountries.includes(e.toLowerCase())):this.allCountries},sortedCountries(){return[...this.getCountries(this.preferredCountries).map(t=>({...t,preferred:!0})),...this.filteredCountries]},phoneObject(){var a,d,n;let e;((a=this.phone)==null?void 0:a[0])==="+"?e=h.parsePhoneNumber(this.phone)||{}:e=h.parsePhoneNumber(this.phone,this.activeCountryCode)||{};const{metadata:t,...o}=e;let s=(d=e.isValid)==null?void 0:d.call(e),l=this.phone;return s&&(l=(n=e.format)==null?void 0:n.call(e,this.parsedMode.toUpperCase(),{nationalPrefix:!1})),e.country&&(this.ignoredCountries.length||this.onlyCountries.length)&&(this.findCountry(e.country)||(s=!1,Object.assign(e,{country:null}))),Object.assign(o,{countryCode:e.country,valid:s,country:this.activeCountry,formatted:l}),o},classes(){return this.phoneObject.valid===!0?this.goodClass:this.phoneObject.valid===!1?this.badClass:void 0},styles(){return this.phoneObject.valid===!0?this.goodStyle:this.phoneObject.valid===!1?this.badStyle:void 0},Iclasses(){return this.phoneObject.valid===!0?this.goodInputClass:this.phoneObject.valid===!1?this.badInputClass:void 0},Istyles(){return this.phoneObject.valid===!0?this.goodInputStyle:this.phoneObject.valid===!1?this.badInputStyle:void 0}},methods:{resetPlaceholder(){this.parsedPlaceholder=this.inputOptions.placeholder},initializeCountry(){return new Promise(e=>{var o;if(((o=this.phone)==null?void 0:o[0])==="+"){e();return}if(this.defaultCountry){this.choose(this.defaultCountry),e();return}const t=this.preferredCountries[0]||this.filteredCountries[0];this.autoDefaultCountry?u.getCountry().then(s=>{this.choose(s||this.activeCountryCode)}).catch(s=>{console.warn(s),this.choose(t)}).then(()=>{e()}):(this.choose(t),e())})},getCountries(e=[]){return e.map(t=>this.findCountry(t)).filter(Boolean)},findCountry(e=""){return this.filteredCountries.find(t=>t.iso2===e.toUpperCase())},getItemClass(e,t){const o=this.selectedIndex===e,s=e===this.preferredCountries.length-1,l=this.preferredCountries.some(a=>a.toUpperCase()===t);return{highlighted:o,"last-preferred":s,preferred:l}},choose(e){var o,s;let t=e;if(typeof t=="string"&&(t=this.findCountry(t)),!!t){if(((o=this.phone)==null?void 0:o[0])==="+"&&t.iso2&&this.phoneObject.nationalNumber){this.activeCountryCode=t.iso2,this.phone=h.parsePhoneNumber(this.phoneObject.nationalNumber,t.iso2).formatInternational();return}if((s=this.inputOptions)!=null&&s.showDialCode&&t){this.phone=`+${t.dialCode}`;return}this.activeCountryCode=t.iso2,this.emitInput(this.phone)}},cleanInvalidCharacters(){const e=this.phone;if(this.validCharactersOnly){const t=this.phone.match(/[()\-+0-9\s]*/g);this.phone=t.join("")}if(this.customValidate&&this.customValidate instanceof RegExp){const t=this.phone.match(this.customValidate);this.phone=t.join("")}e!==this.phone&&this.emitInput(this.phone)},testCharacters(){return this.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(this.phone)?!1:this.customValidate?this.testCustomValidate():!0},testCustomValidate(){return this.customValidate instanceof RegExp?this.customValidate.test(this.phone):!1},onInput(){this.$refs.input.setCustomValidity(this.phoneObject.valid?"":this.invalidMsg),this.emitInput(this.phoneObject)},emitInput(e){this.$emit("update:modelValue",e)},onBlur(){this.$emit("blur")},onFocus(){u.setCaretPosition(this.$refs.input,this.phone.length),this.$emit("focus")},onEnter(){this.$emit("enter")},onSpace(){this.$emit("space")},focus(){this.$refs.input.focus()},toggleDropdown(){this.disabled||(this.open=!this.open)},clickedOutside(){this.open=!1},keyboardNav(e){if(e.keyCode===40){e.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=0:this.selectedIndex=Math.min(this.sortedCountries.length-1,this.selectedIndex+1);const t=this.$refs.list.children[this.selectedIndex];t.offsetTop+t.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight&&(this.$refs.list.scrollTop=t.offsetTop-this.$refs.list.clientHeight+t.clientHeight)}else if(e.keyCode===38){e.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=this.sortedCountries.length-1:this.selectedIndex=Math.max(0,this.selectedIndex-1);const t=this.$refs.list.children[this.selectedIndex];t.offsetTop<this.$refs.list.scrollTop&&(this.$refs.list.scrollTop=t.offsetTop)}else if(e.keyCode===13)this.selectedIndex!==null&&this.choose(this.sortedCountries[this.selectedIndex]),this.open=!this.open;else{this.typeToFindInput+=e.key,clearTimeout(this.typeToFindTimer),this.typeToFindTimer=setTimeout(()=>{this.typeToFindInput=""},700);const t=this.sortedCountries.slice(this.preferredCountries.length).findIndex(o=>o.name.toLowerCase().startsWith(this.typeToFindInput));if(t>=0){this.selectedIndex=this.preferredCountries.length+t;const o=this.$refs.list.children[this.selectedIndex],s=o.offsetTop<this.$refs.list.scrollTop,l=o.offsetTop+o.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight;(s||l)&&(this.$refs.list.scrollTop=o.offsetTop-this.$refs.list.clientHeight/2)}}},reset(){this.selectedIndex=this.sortedCountries.map(e=>e.iso2).indexOf(this.activeCountryCode),this.open=!1},setDropdownPosition(){window.innerHeight-this.$refs.rootElement.getBoundingClientRect().bottom>200?this.dropdownOpenDirection="below":this.dropdownOpenDirection="above"}}}),m=["tabindex"],g={class:"flex-nowrap flex flex-v-center p-medium vti__selection"},b=["innerHTML"],v={key:1,class:"vti__country-code"},O=["onClick","onMousemove"],I=["innerHTML"],S={key:1},w=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex"],k={key:0,class:"mn-t-thin mn-b-thin invalid-feedback"};function j(e,t,o,s,l,a){const d=i.resolveDirective("click-outside");return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",{class:i.normalizeClass(["vue3-reactive-tel-input",{"bg-fourth-nano":e.validation},e.$attrs.class,e.rootClass,{disabled:e.disabled},e.classes]),style:i.normalizeStyle([e.rootStyle,e.styles]),ref:"rootElement"},[i.withDirectives((i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([["vti__dropdown",{open:e.open}],"br-solid br-black-transp br-1px radius-medium"]),tabindex:e.dropdownOptions.tabindex,onKeydown:[t[0]||(t[0]=(...n)=>e.keyboardNav&&e.keyboardNav(...n)),t[2]||(t[2]=i.withKeys((...n)=>e.reset&&e.reset(...n),["esc"]))],onClick:t[1]||(t[1]=(...n)=>e.toggleDropdown&&e.toggleDropdown(...n)),style:i.normalizeStyle([e.dropdownStyle])},[i.createElementVNode("span",g,[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:e.activeCountryFlag,class:"mn-r-thin"},null,8,b)):i.createCommentVNode("",!0),e.dropdownOptions.showDialCodeInSelection?(i.openBlock(),i.createElementBlock("span",v," +"+i.toDisplayString(e.activeCountry&&e.activeCountry.dialCode),1)):i.createCommentVNode("",!0)]),i.withDirectives(i.createElementVNode("ul",{ref:"list",class:i.normalizeClass(["bs-black radius-small vti__dropdown-list",e.dropdownOpenDirection]),style:i.normalizeStyle([e.listStyle])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.sortedCountries,(n,p)=>(i.openBlock(),i.createElementBlock("li",{class:i.normalizeClass(["flex-nowrap flex w-max",["vti__dropdown-item",e.getItemClass(p,n.iso2)]]),key:n.iso2+(n.preferred?"-preferred":""),onClick:c=>e.choose(n),onMousemove:c=>e.selectedIndex=p},[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:n.flag,class:"mn-r-thin"},null,8,I)):i.createCommentVNode("",!0),i.createElementVNode("strong",null,i.toDisplayString(n.name),1),e.dropdownOptions.showDialCodeInList?(i.openBlock(),i.createElementBlock("span",S," +"+i.toDisplayString(n.dialCode),1)):i.createCommentVNode("",!0)],42,O))),128))],6),[[i.vShow,e.open]])],46,m)),[[d,e.clickedOutside]]),i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":t[3]||(t[3]=n=>e.phone=n),inputmode:"numeric",pattern:"\\d*",ref:"input",type:e.inputOptions.type,autocomplete:e.inputOptions.autocomplete,autofocus:e.inputOptions.autofocus,class:i.normalizeClass(["vti__input",e.inputOptions.styleClasses,e.inputClass,e.Iclasses]),style:i.normalizeStyle([e.inputStyle,e.Istyles]),disabled:e.disabled,id:e.inputId!==""?e.inputId:e.inputOptions.id,maxlength:e.inputOptions.maxlength,name:e.inputId!==""?e.inputId:e.inputOptions.name,placeholder:e.parsedPlaceholder,readonly:e.inputOptions.readonly,required:e.inputOptions.required,tabindex:e.inputOptions.tabindex,onBlur:t[4]||(t[4]=(...n)=>e.onBlur&&e.onBlur(...n)),onFocus:t[5]||(t[5]=(...n)=>e.onFocus&&e.onFocus(...n)),onInput:t[6]||(t[6]=(...n)=>e.onInput&&e.onInput(...n)),onKeyup:[t[7]||(t[7]=i.withKeys((...n)=>e.onEnter&&e.onEnter(...n),["enter"])),t[8]||(t[8]=i.withKeys((...n)=>e.onSpace&&e.onSpace(...n),["space"]))]},null,46,w),[[i.vModelDynamic,e.phone]]),i.renderSlot(e.$slots,"default",{},void 0,!0)],6),i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[e.validation?(i.openBlock(),i.createElementBlock("div",k," * "+i.toDisplayString(e.validation.message),1)):i.createCommentVNode("",!0)]),_:1})],64)}const $=y.default(C,[["render",j],["__scopeId","data-v-a2b07445"]]);exports.default=$;
|
@@ -10,241 +10,43 @@ function o(e) {
|
|
10
10
|
}
|
11
11
|
const E = S({
|
12
12
|
name: "Vue3ReactiveTelInput",
|
13
|
-
// vue component name
|
14
13
|
directives: {
|
15
14
|
clickOutside: V
|
16
15
|
},
|
17
16
|
props: {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
},
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
},
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
},
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
default: ""
|
52
|
-
},
|
53
|
-
/**
|
54
|
-
* class assign when the input number is invalid belong to the country code
|
55
|
-
*/
|
56
|
-
badInputClass: {
|
57
|
-
type: [String, Array, Object],
|
58
|
-
default: ""
|
59
|
-
},
|
60
|
-
/**
|
61
|
-
* class assign when the input number is valid belong to the country code
|
62
|
-
*/
|
63
|
-
goodInputClass: {
|
64
|
-
type: [String, Array, Object],
|
65
|
-
default: ""
|
66
|
-
},
|
67
|
-
/**
|
68
|
-
* style assign when the input number is invalid belong to the country code
|
69
|
-
*/
|
70
|
-
badInputStyle: {
|
71
|
-
type: [String, Array, Object],
|
72
|
-
default: ""
|
73
|
-
},
|
74
|
-
/**
|
75
|
-
* style assign when the input number is valid belong to the country code
|
76
|
-
*/
|
77
|
-
goodInputStyle: {
|
78
|
-
type: [String, Array, Object],
|
79
|
-
default: ""
|
80
|
-
},
|
81
|
-
/**
|
82
|
-
* list of all contries
|
83
|
-
*/
|
84
|
-
allCountries: {
|
85
|
-
type: Array,
|
86
|
-
default: () => o("allCountries")
|
87
|
-
},
|
88
|
-
/**
|
89
|
-
* flag to know if the value will be automatically formatted
|
90
|
-
*/
|
91
|
-
autoFormat: {
|
92
|
-
type: Boolean,
|
93
|
-
default: () => o("autoFormat")
|
94
|
-
},
|
95
|
-
validation: {
|
96
|
-
type: [Boolean, Object],
|
97
|
-
default: !1
|
98
|
-
},
|
99
|
-
/**
|
100
|
-
* customized validation RegExp or flag
|
101
|
-
*/
|
102
|
-
customValidate: {
|
103
|
-
type: [Boolean, RegExp],
|
104
|
-
default: () => o("customValidate")
|
105
|
-
},
|
106
|
-
/**
|
107
|
-
* a default country
|
108
|
-
*/
|
109
|
-
defaultCountry: {
|
110
|
-
// Default country code, ie: 'AU'
|
111
|
-
// Will override the current country of user
|
112
|
-
type: String,
|
113
|
-
default: () => o("defaultCountry")
|
114
|
-
},
|
115
|
-
/**
|
116
|
-
* flag defining whether the input must be disabled
|
117
|
-
*/
|
118
|
-
disabled: {
|
119
|
-
type: Boolean,
|
120
|
-
default: () => o("disabled")
|
121
|
-
},
|
122
|
-
/**
|
123
|
-
* flag definir if we'll automatically choose a default country
|
124
|
-
*/
|
125
|
-
autoDefaultCountry: {
|
126
|
-
type: Boolean,
|
127
|
-
default: () => o("autoDefaultCountry")
|
128
|
-
},
|
129
|
-
/**
|
130
|
-
* object of dropdown options
|
131
|
-
*/
|
132
|
-
dropdownOptions: {
|
133
|
-
type: Object,
|
134
|
-
default: () => o("dropdownOptions")
|
135
|
-
},
|
136
|
-
/**
|
137
|
-
* list of countries to ignore
|
138
|
-
*/
|
139
|
-
ignoredCountries: {
|
140
|
-
type: Array,
|
141
|
-
default: () => o("ignoredCountries")
|
142
|
-
},
|
143
|
-
/**
|
144
|
-
* object of input options
|
145
|
-
*/
|
146
|
-
inputOptions: {
|
147
|
-
type: Object,
|
148
|
-
default: () => o("inputOptions")
|
149
|
-
},
|
150
|
-
/**
|
151
|
-
* valid message to display
|
152
|
-
*/
|
153
|
-
invalidMsg: {
|
154
|
-
type: String,
|
155
|
-
default: () => o("invalidMsg")
|
156
|
-
},
|
157
|
-
/**
|
158
|
-
* the mode of the input
|
159
|
-
*/
|
160
|
-
mode: {
|
161
|
-
type: String,
|
162
|
-
default: () => o("mode")
|
163
|
-
},
|
164
|
-
/**
|
165
|
-
* limit the giving input to only manage your list of contry
|
166
|
-
*/
|
167
|
-
onlyCountries: {
|
168
|
-
type: Array,
|
169
|
-
default: () => o("onlyCountries")
|
170
|
-
},
|
171
|
-
/**
|
172
|
-
* the list of preferred countries
|
173
|
-
*/
|
174
|
-
preferredCountries: {
|
175
|
-
type: Array,
|
176
|
-
default: () => o("preferredCountries")
|
177
|
-
},
|
178
|
-
/**
|
179
|
-
* the flag defining if the input must only content valid characters
|
180
|
-
*/
|
181
|
-
validCharactersOnly: {
|
182
|
-
type: Boolean,
|
183
|
-
default: () => o("validCharactersOnly")
|
184
|
-
},
|
185
|
-
/**
|
186
|
-
* the root default class
|
187
|
-
*/
|
188
|
-
rootClass: {
|
189
|
-
type: [String, Array, Object],
|
190
|
-
default: () => o("styleClasses")
|
191
|
-
},
|
192
|
-
/**
|
193
|
-
* the input default class
|
194
|
-
*/
|
195
|
-
inputClass: {
|
196
|
-
type: [String, Array, Object],
|
197
|
-
default: () => ""
|
198
|
-
},
|
199
|
-
/**
|
200
|
-
* the div input default class
|
201
|
-
*/
|
202
|
-
divInputClass: {
|
203
|
-
type: [String, Array, Object],
|
204
|
-
default: () => ""
|
205
|
-
},
|
206
|
-
/**
|
207
|
-
* the root default style
|
208
|
-
*/
|
209
|
-
rootStyle: {
|
210
|
-
type: [String, Array, Object],
|
211
|
-
default: () => ""
|
212
|
-
},
|
213
|
-
/**
|
214
|
-
* the dropdown button style
|
215
|
-
*/
|
216
|
-
dropdownStyle: {
|
217
|
-
type: [String, Array, Object],
|
218
|
-
default: () => ""
|
219
|
-
},
|
220
|
-
/**
|
221
|
-
* the dropdown list style
|
222
|
-
*/
|
223
|
-
listStyle: {
|
224
|
-
type: [String, Array, Object],
|
225
|
-
default: () => ""
|
226
|
-
},
|
227
|
-
/**
|
228
|
-
* the input style
|
229
|
-
*/
|
230
|
-
inputStyle: {
|
231
|
-
type: [String, Array, Object],
|
232
|
-
default: () => ""
|
233
|
-
},
|
234
|
-
/**
|
235
|
-
* the input id
|
236
|
-
*/
|
237
|
-
inputId: {
|
238
|
-
type: [String, Array, Object],
|
239
|
-
default: () => ""
|
240
|
-
},
|
241
|
-
/**
|
242
|
-
* the input placeholder
|
243
|
-
*/
|
244
|
-
Placeholder: {
|
245
|
-
type: [String, Object, Function],
|
246
|
-
default: () => ""
|
247
|
-
}
|
17
|
+
modelValue: { type: String, default: "" },
|
18
|
+
badClass: { type: [String, Array, Object], default: "" },
|
19
|
+
goodClass: { type: [String, Array, Object], default: "" },
|
20
|
+
badStyle: { type: [String, Array, Object], default: "" },
|
21
|
+
goodStyle: { type: [String, Array, Object], default: "" },
|
22
|
+
badInputClass: { type: [String, Array, Object], default: "" },
|
23
|
+
goodInputClass: { type: [String, Array, Object], default: "" },
|
24
|
+
badInputStyle: { type: [String, Array, Object], default: "" },
|
25
|
+
goodInputStyle: { type: [String, Array, Object], default: "" },
|
26
|
+
allCountries: { type: Array, default: () => o("allCountries") },
|
27
|
+
autoFormat: { type: Boolean, default: () => o("autoFormat") },
|
28
|
+
validation: { type: [Boolean, Object], default: !1 },
|
29
|
+
customValidate: { type: [Boolean, RegExp], default: () => o("customValidate") },
|
30
|
+
defaultCountry: { type: String, default: () => o("defaultCountry") },
|
31
|
+
disabled: { type: Boolean, default: () => o("disabled") },
|
32
|
+
autoDefaultCountry: { type: Boolean, default: () => o("autoDefaultCountry") },
|
33
|
+
dropdownOptions: { type: Object, default: () => o("dropdownOptions") },
|
34
|
+
ignoredCountries: { type: Array, default: () => o("ignoredCountries") },
|
35
|
+
inputOptions: { type: Object, default: () => o("inputOptions") },
|
36
|
+
invalidMsg: { type: String, default: () => o("invalidMsg") },
|
37
|
+
mode: { type: String, default: () => o("mode") },
|
38
|
+
onlyCountries: { type: Array, default: () => o("onlyCountries") },
|
39
|
+
preferredCountries: { type: Array, default: () => o("preferredCountries") },
|
40
|
+
validCharactersOnly: { type: Boolean, default: () => o("validCharactersOnly") },
|
41
|
+
rootClass: { type: [String, Array, Object], default: () => o("styleClasses") },
|
42
|
+
inputClass: { type: [String, Array, Object], default: () => "" },
|
43
|
+
divInputClass: { type: [String, Array, Object], default: () => "" },
|
44
|
+
rootStyle: { type: [String, Array, Object], default: () => "" },
|
45
|
+
dropdownStyle: { type: [String, Array, Object], default: () => "" },
|
46
|
+
listStyle: { type: [String, Array, Object], default: () => "" },
|
47
|
+
inputStyle: { type: [String, Array, Object], default: () => "" },
|
48
|
+
inputId: { type: [String, Array, Object], default: () => "" },
|
49
|
+
Placeholder: { type: [String, Object, Function], default: () => "" }
|
248
50
|
},
|
249
51
|
data() {
|
250
52
|
return {
|
@@ -254,7 +56,6 @@ const E = S({
|
|
254
56
|
action: null,
|
255
57
|
amount: null
|
256
58
|
},
|
257
|
-
// vue3-reactive-tel-data
|
258
59
|
phone: this.modelValue ? this.modelValue : "",
|
259
60
|
activeCountryCode: "",
|
260
61
|
open: !1,
|
@@ -301,7 +102,7 @@ const E = S({
|
|
301
102
|
}
|
302
103
|
},
|
303
104
|
mounted() {
|
304
|
-
this.cleanInvalidCharacters(), this.initializeCountry().then(() => {
|
105
|
+
this.value && (this.phone = this.value), this.cleanInvalidCharacters(), this.initializeCountry().then(() => {
|
305
106
|
var e;
|
306
107
|
!this.phone && ((e = this.inputOptions) != null && e.showDialCode) && this.activeCountryCode && (this.phone = `+${this.activeCountryCode}`), this.$emit("validate", this.phoneObject);
|
307
108
|
}).catch(console.error).then(() => {
|
@@ -330,10 +131,7 @@ const E = S({
|
|
330
131
|
var d, f, i;
|
331
132
|
let e;
|
332
133
|
((d = this.phone) == null ? void 0 : d[0]) === "+" ? e = g(this.phone) || {} : e = g(this.phone, this.activeCountryCode) || {};
|
333
|
-
const {
|
334
|
-
metadata: t,
|
335
|
-
...n
|
336
|
-
} = e;
|
134
|
+
const { metadata: t, ...n } = e;
|
337
135
|
let s = (f = e.isValid) == null ? void 0 : f.call(e), a = this.phone;
|
338
136
|
return s && (a = (i = e.format) == null ? void 0 : i.call(e, this.parsedMode.toUpperCase(), { nationalPrefix: !1 })), e.country && (this.ignoredCountries.length || this.onlyCountries.length) && (this.findCountry(e.country) || (s = !1, Object.assign(e, { country: null }))), Object.assign(n, {
|
339
137
|
countryCode: e.country,
|
@@ -380,9 +178,7 @@ const E = S({
|
|
380
178
|
}) : (this.choose(t), e());
|
381
179
|
});
|
382
180
|
},
|
383
|
-
|
384
|
-
* Get the list of countries from the list of iso2 code
|
385
|
-
*/
|
181
|
+
// Get the list of countries from the list of iso2 code
|
386
182
|
getCountries(e = []) {
|
387
183
|
return e.map((t) => this.findCountry(t)).filter(Boolean);
|
388
184
|
},
|
@@ -550,7 +346,8 @@ function G(e, t, n, s, a, d) {
|
|
550
346
|
]),
|
551
347
|
C(u("input", {
|
552
348
|
"onUpdate:modelValue": t[3] || (t[3] = (i) => e.phone = i),
|
553
|
-
|
349
|
+
inputmode: "numeric",
|
350
|
+
pattern: "\\d*",
|
554
351
|
ref: "input",
|
555
352
|
type: e.inputOptions.type,
|
556
353
|
autocomplete: e.inputOptions.autocomplete,
|
@@ -585,7 +382,7 @@ function G(e, t, n, s, a, d) {
|
|
585
382
|
})
|
586
383
|
], 64);
|
587
384
|
}
|
588
|
-
const _ = /* @__PURE__ */ M(E, [["render", G], ["__scopeId", "data-v-
|
385
|
+
const _ = /* @__PURE__ */ M(E, [["render", G], ["__scopeId", "data-v-a2b07445"]]);
|
589
386
|
export {
|
590
387
|
_ as default
|
591
388
|
};
|