@ozdao/prometheus-framework 0.2.35 → 0.2.37
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/Checkbox/Checkbox.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue.js +61 -2
- package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue2.js +2 -61
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.js +2 -49
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.js +49 -2
- 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/Popup/Popup.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +70 -2
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +2 -70
- 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/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
- 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 +45 -44
- 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/pages/Events.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +2 -2
- 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/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
- 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/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
- 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 +96 -93
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- 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/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +2 -2
- package/dist/prometheus-framework.cjs.js +13 -14
- package/dist/prometheus-framework.es.js +346 -557
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.vue +26 -19
- package/src/components/FieldBig/FieldBig.vue +1 -1
- package/src/components/FieldPhone/FieldPhone.vue +55 -304
- package/src/components/FieldPhone/FieldPhone2.vue +671 -0
- package/src/components/FieldPhone/click-outside.js +16 -11
- package/src/components/Footer/Footer.vue +4 -4
- package/src/components/Header/Header.vue +2 -1
- package/src/components/Select/Select.vue +2 -1
- package/src/modules/chats/components/sections/ChatWindow.vue +3 -1
- package/src/modules/chats/store/chat.store.js +1 -3
- package/src/modules/events/components/pages/EditEvent.vue +2 -1
- package/src/modules/events/components/pages/Event.vue +8 -2
- package/src/modules/events/components/sections/SectionMainGuest.vue +1 -1
- package/src/modules/events/components/sections/SectionSpecialGuests.vue +0 -1
- package/src/modules/events/store/events.js +23 -3
- package/src/modules/globals/mixins/mixins.js +33 -2
- package/src/modules/landing/components/sections/HeroGovernance.vue +156 -0
- package/src/modules/marketplace/components/sections/Filters.vue +3 -0
- package/src/modules/marketplace/router/marketplace.js +1 -0
- package/src/modules/orders/components/blocks/StatusHistory.vue +8 -3
- package/src/modules/orders/components/pages/EditOrder.vue +9 -11
- package/src/modules/orders/components/pages/FormOrder.vue +58 -46
- package/src/modules/orders/components/pages/Order.vue +63 -42
- package/src/modules/orders/components/sections/FormOrderDetails.vue +50 -18
- package/src/modules/orders/controllers/orders.controller.js +10 -1
- package/src/modules/orders/models/order.model.js +1 -0
- package/src/modules/orders/store/orders.js +21 -27
- package/src/modules/orders/store/shopcart.js +14 -2
- package/src/modules/organizations/components/sections/DetailsTab.vue +2 -2
- package/src/modules/products/components/sections/FilterProducts.vue +3 -4
- package/src/modules/products/components/sections/HeroRecommendation.vue +29 -2
- package/src/modules/products/components/sections/SectionProduct.vue +14 -9
- package/src/modules/products/controllers/products.controller.js +26 -17
- package/src/modules/products/routes/products.routes.js +6 -6
- package/src/modules/products/store/products.js +10 -10
- package/src/styles/config.scss +10 -3
@@ -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
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),oe=require("./click-outside.cjs"),re=require("./all-countries.cjs");require("./FieldPhone2.vue2.cjs");const ue=require("../../../../_virtual/_plugin-vue_export-helper.cjs"),w=require("../../../node_modules/libphonenumber-js/min/exports/parsePhoneNumber.cjs"),ie=["tabindex"],se={class:"flex-nowrap flex flex-v-center p-medium vti__selection"},de=["innerHTML"],ce={key:1,class:"vti__country-code"},fe=["onClick","onMousemove"],ve=["innerHTML"],pe={key:1},ye=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex"],me={key:0,class:"mn-t-thin mn-b-thin invalid-feedback"},he={__name:"FieldPhone2",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:()=>re.default},autoFormat:{type:Boolean,default:()=>!0},validation:{type:[Boolean,Object],default:!1},customValidate:{type:[Boolean,RegExp],default:()=>!1},defaultCountry:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},autoDefaultCountry:{type:Boolean,default:()=>!0},ignoredCountries:{type:Array,default:()=>[]},invalidMsg:{type:String,default:()=>""},mode:{type:String,default:()=>"auto"},onlyCountries:{type:Array,default:()=>[]},preferredCountries:{type:Array,default:()=>[]},validCharactersOnly:{type:Boolean,default:()=>!1},rootClass:{type:[String,Array,Object],default:()=>""},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:()=>""},dropdownOptions:{type:Object,default:()=>({showDialCodeInList:!0,showDialCodeInSelection:!1,showFlags:!0,tabindex:0})},inputOptions:{type:Object,default:()=>({autocomplete:"on",autofocus:!1,id:"",maxlength:25,name:"telephone",placeholder:"Enter a phone number",readonly:!1,required:!1,tabindex:0,type:"tel",styleClasses:""})}},emits:["update:modelValue","validate","country-changed","open","close","blur","focus","enter","space"],setup(a,{emit:V}){let N=oe.default;const n=a,c=V;e.ref(5),e.ref(5),e.reactive({action:null,amount:null});const r=e.ref(n.modelValue?n.modelValue:""),v=e.ref(""),f=e.ref(!1),P=e.ref(!1),s=e.ref(null),S=e.ref(""),x=e.ref(null),T=e.ref("below"),I=e.ref(n.Placeholder!==""?n.Placeholder:n.inputOptions.placeholder),B=e.ref(null),d=e.ref(null),O=e.ref(null);e.onMounted(async()=>{n.modelValue&&(r.value=n.modelValue),G(),U().then(()=>{var t;!r.value&&((t=n.inputOptions)!=null&&t.showDialCode)&&v.value&&(r.value=`+${v.value}`),c("validate",u.value)}).catch(console.error).then(()=>{P.value=!0})});const p=e.computed(()=>C(v.value)),M=e.computed(()=>p.value?p.value.flag:null),F=e.computed(()=>n.mode==="auto"?!r.value||r.value[0]!=="+"?"national":"international":["international","national"].includes(n.mode)?n.mode:(console.error('Invalid value of prop "mode"'),"international")),k=e.computed(()=>n.onlyCountries&&n.onlyCountries.length?n.allCountries.filter(({iso2:t})=>n.onlyCountries.includes(t.toUpperCase())):n.ignoredCountries&&n.ignoredCountries.length?n.allCountries.filter(({iso2:t})=>!n.ignoredCountries.includes(t.toUpperCase())&&!n.ignoredCountries.includes(t.toLowerCase())):n.allCountries),y=e.computed(()=>[...K(n.preferredCountries).map(l=>({...l,preferred:!0})),...k.value]),u=e.computed(()=>{var b,D,A;let t={};((b=r.value)==null?void 0:b[0])==="+"?t=w.parsePhoneNumber(r.value)||{}:t=w.parsePhoneNumber(r.value,v.value)||{};const{metadata:l,...o}=t;let i=(D=t.isValid)==null?void 0:D.call(t),h=r.value;return i&&(h=(A=t.format)==null?void 0:A.call(t,F.value.toUpperCase(),{nationalPrefix:!1})),t.country&&(n.ignoredCountries.length||n.onlyCountries.length)&&(C(t.country)||(i=!1,t={...t,country:null})),{...o,countryCode:t.country,valid:i,country:p.value,formatted:h}}),H=e.computed(()=>u.value.valid===!0?n.goodClass:u.value.valid===!1?n.badClass:void 0),q=e.computed(()=>u.value.valid===!0?n.goodStyle:u.value.valid===!1?n.badStyle:void 0),z=e.computed(()=>u.value.valid===!0?n.goodInputClass:u.value.valid===!1?n.badInputClass:void 0),L=e.computed(()=>u.value.valid===!0?n.goodInputStyle:u.value.valid===!1?n.badInputStyle:void 0);e.watch(p,(t,l)=>{if(!t&&(l!=null&&l.iso2)){v.value=l.iso2;return}t!=null&&t.iso2&&(c("country-changed",t),E())}),e.watch(()=>u.value.countryCode,t=>{v.value=t}),e.watch(()=>u.value.valid,()=>{c("validate",u.value)}),e.watch(()=>u.value.formatted,t=>{!n.autoFormat||n.customValidate||(g(t),e.nextTick(()=>{t&&!n.modelValue&&(r.value=t)}))}),e.watch(()=>n.inputOptions.placeholder,()=>{E()}),e.watch(()=>n.modelValue,(t,l)=>{J()?r.value=t:e.nextTick(()=>{r.value=l,j()})}),e.watch(f,t=>{t?(ae(),c("open")):c("close")});function R(){return fetch("https://ip2c.org/s").then(t=>t.text()).then(t=>{const l=(t||"").toString();if(!l||l[0]!=="1")throw new Error("unable to fetch the country");return l.substr(2,2)})}function $(t,l){if(t.setSelectionRange)t.focus(),t.setSelectionRange(l,l);else if(t.createTextRange){const o=t.createTextRange();o.collapse(!0),o.moveEnd("character",l),o.moveStart("character",l),o.select()}}function E(){I.value=n.inputOptions.placeholder}function U(){return new Promise(t=>{var o;if(((o=r.value)==null?void 0:o[0])==="+"){t();return}if(n.defaultCountry){m(n.defaultCountry),t();return}const l=n.preferredCountries[0]||k.value[0];n.autoDefaultCountry?R().then(i=>{m(i||v.value)}).catch(i=>{console.warn(i),m(l)}).finally(()=>{t()}):(m(l),t())})}function K(t=[]){return t.map(l=>C(l)).filter(Boolean)}function C(t=""){return k.value.find(l=>l.iso2===t.toUpperCase())}function W(t,l){const o=s.value===t,i=t===n.preferredCountries.length-1,h=n.preferredCountries.some(b=>b.toUpperCase()===l);return{highlighted:o,"last-preferred":i,preferred:h}}function m(t){var o,i;let l=typeof t=="string"?C(t):t;if(l){if(((o=r.value)==null?void 0:o[0])==="+"&&l.iso2&&u.value.nationalNumber){v.value=l.iso2,r.value=w.parsePhoneNumber(u.value.nationalNumber,l.iso2).formatInternational();return}if((i=n.inputOptions)!=null&&i.showDialCode&&l){r.value=`+${l.dialCode}`;return}v.value=l.iso2,g(r.value)}}function G(){const t=r.value;if(n.validCharactersOnly){const l=r.value.match(/[()\-+0-9\s]*/g);r.value=l.join("")}if(n.customValidate&&n.customValidate instanceof RegExp){const l=r.value.match(n.customValidate);r.value=l?l.join(""):""}t!==r.value&&g(r.value)}function J(){return n.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(r.value)?!1:n.customValidate?Q():!0}function Q(){return n.customValidate instanceof RegExp?n.customValidate.test(r.value):!1}function j(){O.value.setCustomValidity(u.valid?"":n.invalidMsg),g(r.value)}function g(t){c("update:modelValue",t),u.value.valid?c("country",u.value.number):c("country",null)}function X(){c("blur")}function Y(){$(O.value,r.value.length),c("focus")}function Z(){c("enter")}function _(){c("space")}function ee(){n.disabled||(f.value=!f.value)}function te(){f.value=!1}function ne(t){t.keyCode===40?(t.preventDefault(),f.value=!0,s.value=s.value===null?0:Math.min(y.value.length-1,s.value+1),e.nextTick(()=>{const l=d.value.children[s.value];l.offsetTop+l.clientHeight>d.value.scrollTop+d.value.clientHeight&&(d.value.scrollTop=l.offsetTop-d.value.clientHeight+l.clientHeight)})):t.keyCode===38?(t.preventDefault(),f.value=!0,s.value=s.value===null?y.value.length-1:Math.max(0,s.value-1),e.nextTick(()=>{const l=d.value.children[s.value];l.offsetTop<d.value.scrollTop&&(d.value.scrollTop=l.offsetTop)})):t.keyCode===13?(t.preventDefault(),s.value!==null&&m(y.value[s.value]),f.value=!f.value):(S.value+=t.key,clearTimeout(x),x=setTimeout(()=>{S.value=""},700),e.nextTick(()=>{const l=y.value.slice(n.preferredCountries.length).findIndex(o=>o.name.toLowerCase().startsWith(S.value));if(l>=0){s.value=n.preferredCountries.length+l;const o=d.value.children[s.value];(o.offsetTop<d.value.scrollTop||o.offsetTop+o.clientHeight>d.value.scrollTop+d.value.clientHeight)&&(d.value.scrollTop=o.offsetTop-d.value.clientHeight/2)}}))}function le(){s.value=y.value.map(t=>t.iso2).indexOf(v.value),f.value=!1}function ae(){const l=window.innerHeight-B.value.getBoundingClientRect().bottom>200;T.value=l?"below":"above"}return(t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass([[a.rootClass,H.value,t.$attrs.class,{"bg-fourth-nano":a.validation},{disabled:a.disabled}],"vue3-reactive-tel-input"]),style:e.normalizeStyle([a.rootStyle,q.value]),ref_key:"rootElement",ref:B},[e.withDirectives((e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([["vti__dropdown",{open:f.value}],"br-solid br-black-transp br-1px radius-medium"]),style:e.normalizeStyle([a.dropdownStyle]),tabindex:a.dropdownOptions.tabindex,onKeydown:[ne,e.withKeys(le,["esc"])],onClick:ee},[e.createElementVNode("span",se,[a.dropdownOptions.showFlags?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:M.value,class:"mn-r-thin"},null,8,de)):e.createCommentVNode("",!0),a.dropdownOptions.showDialCodeInSelection?(e.openBlock(),e.createElementBlock("span",ce," +"+e.toDisplayString(p.value&&p.value.dialCode),1)):e.createCommentVNode("",!0)]),e.withDirectives(e.createElementVNode("ul",{ref_key:"list",ref:d,class:e.normalizeClass(["bs-black radius-small vti__dropdown-list",T.value]),style:e.normalizeStyle([a.listStyle])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(o,i)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["flex-nowrap flex w-max",["vti__dropdown-item",W(i,o.iso2)]]),key:o.iso2+(o.preferred?"-preferred":""),onClick:h=>m(o),onMousemove:h=>s.value=i},[a.dropdownOptions.showFlags?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:o.flag,class:"mn-r-thin"},null,8,ve)):e.createCommentVNode("",!0),e.createElementVNode("strong",null,e.toDisplayString(o.name),1),a.dropdownOptions.showDialCodeInList?(e.openBlock(),e.createElementBlock("span",pe," +"+e.toDisplayString(o.dialCode),1)):e.createCommentVNode("",!0)],42,fe))),128))],6),[[e.vShow,f.value]])],46,ie)),[[e.unref(N),te]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=o=>r.value=o),inputmode:"numeric",pattern:"\\d*",ref_key:"input",ref:O,type:a.inputOptions.type,autocomplete:a.inputOptions.autocomplete,autofocus:a.inputOptions.autofocus,class:e.normalizeClass(["vti__input",a.inputOptions.styleClasses,a.inputClass,z.value]),style:e.normalizeStyle([a.inputStyle,L.value]),disabled:a.disabled,id:a.inputId!==""?a.inputId:a.inputOptions.id,maxlength:a.inputOptions.maxlength,name:a.inputId!==""?a.inputId:a.inputOptions.name,placeholder:I.value,readonly:a.inputOptions.readonly,required:a.inputOptions.required,tabindex:a.inputOptions.tabindex,onBlur:X,onFocus:Y,onInput:j,onKeyup:[e.withKeys(Z,["enter"]),e.withKeys(_,["space"])]},null,46,ye),[[e.vModelDynamic,r.value]]),e.renderSlot(t.$slots,"default",{},void 0,!0)],6),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[a.validation?(e.openBlock(),e.createElementBlock("div",me," * "+e.toDisplayString(a.validation.message),1)):e.createCommentVNode("",!0)]),_:1})],64))}},Ce=ue.default(he,[["__scopeId","data-v-0ab16817"]]);exports.default=Ce;
|