vue-tel-input 5.6.1 → 5.8.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/README.md +2 -2
- package/dist/css/component.css +1 -1
- package/dist/vue-tel-input.common.js +94 -40
- package/dist/vue-tel-input.common.js.map +1 -1
- package/dist/vue-tel-input.css +1 -1
- package/dist/vue-tel-input.umd.js +96 -42
- package/dist/vue-tel-input.umd.js.map +1 -1
- package/dist/vue-tel-input.umd.min.js +1 -1
- package/dist/vue-tel-input.umd.min.js.map +1 -1
- package/dist-modern/css/component.css +1 -1
- package/dist-modern/vue-tel-input.common.js +56 -9
- package/dist-modern/vue-tel-input.common.js.map +1 -1
- package/dist-modern/vue-tel-input.css +1 -1
- package/dist-modern/vue-tel-input.umd.js +56 -9
- package/dist-modern/vue-tel-input.umd.js.map +1 -1
- package/dist-modern/vue-tel-input.umd.min.js +1 -1
- package/dist-modern/vue-tel-input.umd.min.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
package/dist/css/component.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.vue-tel-input{border-radius:3px;display:flex;border:1px solid #bbb;text-align:left}.vue-tel-input.disabled .dropdown,.vue-tel-input.disabled .selection,.vue-tel-input.disabled input{cursor:no-drop}.vue-tel-input:focus-within{box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);border-color:#66afe9}.vti__dropdown{display:flex;flex-direction:column;align-content:center;justify-content:center;position:relative;padding:7px;cursor:pointer}.vti__dropdown.show{max-height:300px;overflow:scroll}.vti__dropdown.disabled,.vti__dropdown.open{background-color:#f3f3f3}.vti__dropdown.disabled{cursor:no-drop;outline:none}.vti__dropdown:hover{background-color:#f3f3f3}.vti__selection{font-size:.8em;display:flex;align-items:center}.vti__selection .vti__country-code{color:#666}.vti__flag{margin-right:5px;margin-left:5px}.vti__dropdown-list{z-index:1;padding:0;margin:0;text-align:left;list-style:none;max-height:200px;overflow-y:scroll;position:absolute;left:-1px;background-color:#fff;border:1px solid #ccc;width:390px}.vti__dropdown-list.below{top:33px}.vti__dropdown-list.above{top:auto;bottom:100%}.vti__dropdown-arrow{transform:scaleY(.5);display:inline-block;color:#666}.vti__dropdown-item{cursor:pointer;padding:4px 15px}.vti__dropdown-item.highlighted{background-color:#f3f3f3}.vti__dropdown-item.last-preferred{border-bottom:1px solid #cacaca}.vti__dropdown-item .vti__flag{display:inline-block;margin-right:5px}.vti__input{border:none;border-radius:0 2px 2px 0;width:100%;outline:none;padding-left:7px}
|
|
1
|
+
.vue-tel-input{border-radius:3px;display:flex;border:1px solid #bbb;text-align:left}.vue-tel-input.disabled .dropdown,.vue-tel-input.disabled .selection,.vue-tel-input.disabled input{cursor:no-drop}.vue-tel-input:focus-within{box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);border-color:#66afe9}.vti__dropdown{display:flex;flex-direction:column;align-content:center;justify-content:center;position:relative;padding:7px;cursor:pointer}.vti__dropdown.show{max-height:300px;overflow:scroll}.vti__dropdown.disabled,.vti__dropdown.open{background-color:#f3f3f3}.vti__dropdown.disabled{cursor:no-drop;outline:none}.vti__dropdown:hover{background-color:#f3f3f3}.vti__selection{font-size:.8em;display:flex;align-items:center}.vti__selection .vti__country-code{color:#666}.vti__flag{margin-right:5px;margin-left:5px}.vti__dropdown-list{z-index:1;padding:0;margin:0;text-align:left;list-style:none;max-height:200px;overflow-y:scroll;position:absolute;left:-1px;background-color:#fff;border:1px solid #ccc;width:390px}.vti__dropdown-list.below{top:33px}.vti__dropdown-list.above{top:auto;bottom:100%}.vti__dropdown-arrow{transform:scaleY(.5);display:inline-block;color:#666}.vti__dropdown-item{cursor:pointer;padding:4px 15px}.vti__dropdown-item.highlighted{background-color:#f3f3f3}.vti__dropdown-item.last-preferred{border-bottom:1px solid #cacaca}.vti__dropdown-item .vti__flag{display:inline-block;margin-right:5px}.vti__input{border:none;border-radius:0 2px 2px 0;width:100%;outline:none;padding-left:7px}.vti__search_box{border:1px solid #ccc;width:94%;padding:7px;margin:2px 2px}
|
|
@@ -5496,6 +5496,12 @@ var allProps = [{
|
|
|
5496
5496
|
type: Boolean,
|
|
5497
5497
|
description: 'Show flags in the dropdown selection and list',
|
|
5498
5498
|
inDemo: true
|
|
5499
|
+
}, {
|
|
5500
|
+
name: 'dropdownOptions.showSearchBox',
|
|
5501
|
+
default: false,
|
|
5502
|
+
type: Boolean,
|
|
5503
|
+
description: 'Show country search box',
|
|
5504
|
+
inDemo: true
|
|
5499
5505
|
}, {
|
|
5500
5506
|
name: 'dropdownOptions.tabindex',
|
|
5501
5507
|
default: 0,
|
|
@@ -5556,6 +5562,12 @@ var allProps = [{
|
|
|
5556
5562
|
type: String,
|
|
5557
5563
|
description: 'Native input <code>name</code> attribute',
|
|
5558
5564
|
inDemo: false
|
|
5565
|
+
}, {
|
|
5566
|
+
name: 'inputOptions.showDialCode',
|
|
5567
|
+
default: false,
|
|
5568
|
+
type: Boolean,
|
|
5569
|
+
description: 'Show dial code in input',
|
|
5570
|
+
inDemo: false
|
|
5559
5571
|
}, {
|
|
5560
5572
|
name: 'inputOptions.placeholder',
|
|
5561
5573
|
default: 'Enter a phone number',
|
|
@@ -5651,12 +5663,10 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
|
|
|
5651
5663
|
/* harmony default export */ const utils = ({
|
|
5652
5664
|
options: _objectSpread2({}, defaultOptions)
|
|
5653
5665
|
});
|
|
5654
|
-
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
5655
|
-
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['vue-tel-input', _vm.styleClasses, { disabled: _vm.disabled }]},[_c('div',{directives:[{name:"click-outside",rawName:"v-click-outside",value:(_vm.clickedOutside),expression:"clickedOutside"}],class:['vti__dropdown', { open: _vm.open, disabled: _vm.dropdownOptions.disabled }],attrs:{"tabindex":_vm.dropdownOptions.tabindex},on:{"keydown":[_vm.keyboardNav,function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }return _vm.reset.apply(null, arguments)}],"click":_vm.toggleDropdown}},[_c('span',{staticClass:"vti__selection"},[(_vm.dropdownOptions.showFlags)?_c('
|
|
5656
|
-
var staticRenderFns = [
|
|
5657
|
-
|
|
5666
|
+
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"4e66b896-vue-loader-template"}!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].rules[0].use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/vue-tel-input.vue?vue&type=template&id=5363803c&
|
|
5667
|
+
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['vue-tel-input', _vm.styleClasses, { disabled: _vm.disabled }]},[_c('div',{directives:[{name:"click-outside",rawName:"v-click-outside",value:(_vm.clickedOutside),expression:"clickedOutside"}],class:['vti__dropdown', { open: _vm.open, disabled: _vm.dropdownOptions.disabled }],attrs:{"aria-label":"Country Code Selector","aria-haspopup":"listbox","aria-expanded":_vm.open,"role":"button","tabindex":_vm.dropdownOptions.tabindex},on:{"keydown":[_vm.keyboardNav,function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.toggleDropdown.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }return _vm.reset.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"tab",9,$event.key,"Tab")){ return null; }return _vm.reset.apply(null, arguments)}],"click":_vm.toggleDropdown}},[_c('span',{staticClass:"vti__selection"},[(_vm.dropdownOptions.showFlags)?_c('span',{class:['vti__flag', _vm.activeCountryCode.toLowerCase()]}):_vm._e(),(_vm.dropdownOptions.showDialCodeInSelection)?_c('span',{staticClass:"vti__country-code"},[_vm._v(" +"+_vm._s(_vm.activeCountry && _vm.activeCountry.dialCode)+" ")]):_vm._e(),_vm._t("arrow-icon",function(){return [_c('span',{staticClass:"vti__dropdown-arrow"},[_vm._v(_vm._s(_vm.open ? "▲" : "▼"))])]},{"open":_vm.open})],2),(_vm.open)?_c('ul',{ref:"list",staticClass:"vti__dropdown-list",class:_vm.dropdownOpenDirection,attrs:{"role":"listbox"}},[(_vm.dropdownOptions.showSearchBox)?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.searchQuery),expression:"searchQuery"}],staticClass:"vti__input vti__search_box",attrs:{"aria-label":"Search by country name or country code","placeholder":_vm.sortedCountries[0].name,"type":"text"},domProps:{"value":(_vm.searchQuery)},on:{"input":function($event){if($event.target.composing){ return; }_vm.searchQuery=$event.target.value}}}):_vm._e(),_vm._l((_vm.sortedCountries),function(pb,index){return _c('li',{key:pb.iso2 + (pb.preferred ? '-preferred' : ''),class:['vti__dropdown-item', _vm.getItemClass(index, pb.iso2)],attrs:{"role":"option","tabindex":"-1","aria-selected":_vm.activeCountryCode === pb.iso2 && !pb.preferred},on:{"click":function($event){return _vm.choose(pb)},"mousemove":function($event){_vm.selectedIndex = index}}},[(_vm.dropdownOptions.showFlags)?_c('span',{class:['vti__flag', pb.iso2.toLowerCase()]}):_vm._e(),_c('strong',[_vm._v(_vm._s(pb.name))]),(_vm.dropdownOptions.showDialCodeInList)?_c('span',[_vm._v(" +"+_vm._s(pb.dialCode)+" ")]):_vm._e()])})],2):_vm._e()]),((_vm.inputOptions.type)==='checkbox')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":"checkbox"},domProps:{"checked":Array.isArray(_vm.phone)?_vm._i(_vm.phone,null)>-1:(_vm.phone)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":_vm.onInput,"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}],"change":function($event){var $$a=_vm.phone,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.phone=$$a.concat([$$v]))}else{$$i>-1&&(_vm.phone=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.phone=$$c}}}}):((_vm.inputOptions.type)==='radio')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":"radio"},domProps:{"checked":_vm._q(_vm.phone,null)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":_vm.onInput,"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}],"change":function($event){_vm.phone=null}}}):_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":_vm.inputOptions.type},domProps:{"value":(_vm.phone)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":[function($event){if($event.target.composing){ return; }_vm.phone=$event.target.value},_vm.onInput],"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}]}}),_vm._t("icon-right")],2)}
|
|
5668
|
+
var staticRenderFns = []
|
|
5658
5669
|
|
|
5659
|
-
;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=13c114b8&
|
|
5660
5670
|
|
|
5661
5671
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
5662
5672
|
|
|
@@ -8760,6 +8770,32 @@ var _excluded = ["metadata"];
|
|
|
8760
8770
|
//
|
|
8761
8771
|
//
|
|
8762
8772
|
//
|
|
8773
|
+
//
|
|
8774
|
+
//
|
|
8775
|
+
//
|
|
8776
|
+
//
|
|
8777
|
+
//
|
|
8778
|
+
//
|
|
8779
|
+
//
|
|
8780
|
+
//
|
|
8781
|
+
//
|
|
8782
|
+
//
|
|
8783
|
+
//
|
|
8784
|
+
//
|
|
8785
|
+
//
|
|
8786
|
+
//
|
|
8787
|
+
//
|
|
8788
|
+
//
|
|
8789
|
+
//
|
|
8790
|
+
//
|
|
8791
|
+
//
|
|
8792
|
+
//
|
|
8793
|
+
//
|
|
8794
|
+
//
|
|
8795
|
+
//
|
|
8796
|
+
//
|
|
8797
|
+
//
|
|
8798
|
+
//
|
|
8763
8799
|
|
|
8764
8800
|
|
|
8765
8801
|
|
|
@@ -8899,7 +8935,8 @@ function getDefault(key) {
|
|
|
8899
8935
|
typeToFindInput: '',
|
|
8900
8936
|
typeToFindTimer: null,
|
|
8901
8937
|
dropdownOpenDirection: 'below',
|
|
8902
|
-
parsedPlaceholder: this.inputOptions.placeholder
|
|
8938
|
+
parsedPlaceholder: this.inputOptions.placeholder,
|
|
8939
|
+
searchQuery: ''
|
|
8903
8940
|
};
|
|
8904
8941
|
},
|
|
8905
8942
|
computed: {
|
|
@@ -8945,13 +8982,23 @@ function getDefault(key) {
|
|
|
8945
8982
|
return this.allCountries;
|
|
8946
8983
|
},
|
|
8947
8984
|
sortedCountries: function sortedCountries() {
|
|
8985
|
+
var _this2 = this;
|
|
8986
|
+
|
|
8948
8987
|
// Sort the list countries: from preferred countries to all countries
|
|
8949
8988
|
var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
|
|
8950
8989
|
return _objectSpread2(_objectSpread2({}, country), {}, {
|
|
8951
8990
|
preferred: true
|
|
8952
8991
|
});
|
|
8953
8992
|
});
|
|
8954
|
-
|
|
8993
|
+
var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
|
|
8994
|
+
|
|
8995
|
+
if (!this.dropdownOptions.showSearchBox) {
|
|
8996
|
+
return countriesList;
|
|
8997
|
+
}
|
|
8998
|
+
|
|
8999
|
+
return countriesList.filter(function (c) {
|
|
9000
|
+
return new RegExp(_this2.searchQuery, 'i').test(c.name) || new RegExp(_this2.searchQuery, 'i').test(c.iso2) || new RegExp(_this2.searchQuery, 'i').test(c.dialCode);
|
|
9001
|
+
});
|
|
8955
9002
|
},
|
|
8956
9003
|
phoneObject: function phoneObject() {
|
|
8957
9004
|
var _this$phone, _result$isValid, _result2;
|
|
@@ -9013,7 +9060,7 @@ function getDefault(key) {
|
|
|
9013
9060
|
this.$emit('validate', this.phoneObject);
|
|
9014
9061
|
},
|
|
9015
9062
|
'phoneObject.formatted': function phoneObjectFormatted(value) {
|
|
9016
|
-
var
|
|
9063
|
+
var _this3 = this;
|
|
9017
9064
|
|
|
9018
9065
|
if (!this.autoFormat || this.customValidate) {
|
|
9019
9066
|
return;
|
|
@@ -9022,8 +9069,8 @@ function getDefault(key) {
|
|
|
9022
9069
|
this.emitInput(value);
|
|
9023
9070
|
this.$nextTick(function () {
|
|
9024
9071
|
// In case `v-model` is not set, we need to update the `phone` to be new formatted value
|
|
9025
|
-
if (value && !
|
|
9026
|
-
|
|
9072
|
+
if (value && !_this3.value) {
|
|
9073
|
+
_this3.phone = value;
|
|
9027
9074
|
}
|
|
9028
9075
|
});
|
|
9029
9076
|
},
|
|
@@ -9034,13 +9081,13 @@ function getDefault(key) {
|
|
|
9034
9081
|
this.resetPlaceholder();
|
|
9035
9082
|
},
|
|
9036
9083
|
value: function value(_value, oldValue) {
|
|
9037
|
-
var
|
|
9084
|
+
var _this4 = this;
|
|
9038
9085
|
|
|
9039
9086
|
if (!this.testCharacters()) {
|
|
9040
9087
|
this.$nextTick(function () {
|
|
9041
|
-
|
|
9088
|
+
_this4.phone = oldValue;
|
|
9042
9089
|
|
|
9043
|
-
|
|
9090
|
+
_this4.onInput();
|
|
9044
9091
|
});
|
|
9045
9092
|
} else {
|
|
9046
9093
|
this.phone = _value;
|
|
@@ -9057,7 +9104,7 @@ function getDefault(key) {
|
|
|
9057
9104
|
}
|
|
9058
9105
|
},
|
|
9059
9106
|
mounted: function mounted() {
|
|
9060
|
-
var
|
|
9107
|
+
var _this5 = this;
|
|
9061
9108
|
|
|
9062
9109
|
if (this.value) {
|
|
9063
9110
|
this.phone = this.value.trim();
|
|
@@ -9065,15 +9112,15 @@ function getDefault(key) {
|
|
|
9065
9112
|
|
|
9066
9113
|
this.cleanInvalidCharacters();
|
|
9067
9114
|
this.initializeCountry().then(function () {
|
|
9068
|
-
var
|
|
9115
|
+
var _this5$inputOptions;
|
|
9069
9116
|
|
|
9070
|
-
if (!
|
|
9071
|
-
|
|
9117
|
+
if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
|
|
9118
|
+
_this5.phone = "+".concat(_this5.activeCountryCode);
|
|
9072
9119
|
}
|
|
9073
9120
|
|
|
9074
|
-
|
|
9121
|
+
_this5.$emit('validate', _this5.phoneObject);
|
|
9075
9122
|
}).catch(console.error).then(function () {
|
|
9076
|
-
|
|
9123
|
+
_this5.finishMounted = true;
|
|
9077
9124
|
});
|
|
9078
9125
|
},
|
|
9079
9126
|
methods: {
|
|
@@ -9092,15 +9139,15 @@ function getDefault(key) {
|
|
|
9092
9139
|
// .catch(console.error);
|
|
9093
9140
|
},
|
|
9094
9141
|
initializeCountry: function initializeCountry() {
|
|
9095
|
-
var
|
|
9142
|
+
var _this6 = this;
|
|
9096
9143
|
|
|
9097
9144
|
return new Promise(function (resolve) {
|
|
9098
|
-
var
|
|
9145
|
+
var _this6$phone;
|
|
9099
9146
|
|
|
9100
9147
|
/**
|
|
9101
9148
|
* 1. If the phone included prefix (i.e. +12), try to get the country and set it
|
|
9102
9149
|
*/
|
|
9103
|
-
if (((
|
|
9150
|
+
if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
|
|
9104
9151
|
resolve();
|
|
9105
9152
|
return;
|
|
9106
9153
|
}
|
|
@@ -9109,19 +9156,19 @@ function getDefault(key) {
|
|
|
9109
9156
|
*/
|
|
9110
9157
|
|
|
9111
9158
|
|
|
9112
|
-
if (
|
|
9113
|
-
if (typeof
|
|
9114
|
-
|
|
9159
|
+
if (_this6.defaultCountry) {
|
|
9160
|
+
if (typeof _this6.defaultCountry === 'string') {
|
|
9161
|
+
_this6.choose(_this6.defaultCountry);
|
|
9115
9162
|
|
|
9116
9163
|
resolve();
|
|
9117
9164
|
return;
|
|
9118
9165
|
}
|
|
9119
9166
|
|
|
9120
|
-
if (typeof
|
|
9121
|
-
var country =
|
|
9167
|
+
if (typeof _this6.defaultCountry === 'number') {
|
|
9168
|
+
var country = _this6.findCountryByDialCode(_this6.defaultCountry);
|
|
9122
9169
|
|
|
9123
9170
|
if (country) {
|
|
9124
|
-
|
|
9171
|
+
_this6.choose(country.iso2);
|
|
9125
9172
|
|
|
9126
9173
|
resolve();
|
|
9127
9174
|
return;
|
|
@@ -9129,21 +9176,21 @@ function getDefault(key) {
|
|
|
9129
9176
|
}
|
|
9130
9177
|
}
|
|
9131
9178
|
|
|
9132
|
-
var fallbackCountry =
|
|
9179
|
+
var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
|
|
9133
9180
|
/**
|
|
9134
9181
|
* 3. Check if fetching country based on user's IP is allowed, set it as the default country
|
|
9135
9182
|
*/
|
|
9136
9183
|
|
|
9137
|
-
if (
|
|
9184
|
+
if (_this6.autoDefaultCountry) {
|
|
9138
9185
|
getCountry().then(function (res) {
|
|
9139
|
-
|
|
9186
|
+
_this6.choose(res || _this6.activeCountryCode);
|
|
9140
9187
|
}).catch(function (error) {
|
|
9141
9188
|
console.warn(error);
|
|
9142
9189
|
/**
|
|
9143
9190
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9144
9191
|
*/
|
|
9145
9192
|
|
|
9146
|
-
|
|
9193
|
+
_this6.choose(fallbackCountry);
|
|
9147
9194
|
}).then(function () {
|
|
9148
9195
|
resolve();
|
|
9149
9196
|
});
|
|
@@ -9151,7 +9198,7 @@ function getDefault(key) {
|
|
|
9151
9198
|
/**
|
|
9152
9199
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9153
9200
|
*/
|
|
9154
|
-
|
|
9201
|
+
_this6.choose(fallbackCountry);
|
|
9155
9202
|
|
|
9156
9203
|
resolve();
|
|
9157
9204
|
}
|
|
@@ -9162,11 +9209,11 @@ function getDefault(key) {
|
|
|
9162
9209
|
* Get the list of countries from the list of iso2 code
|
|
9163
9210
|
*/
|
|
9164
9211
|
getCountries: function getCountries() {
|
|
9165
|
-
var
|
|
9212
|
+
var _this7 = this;
|
|
9166
9213
|
|
|
9167
9214
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9168
9215
|
return list.map(function (countryCode) {
|
|
9169
|
-
return
|
|
9216
|
+
return _this7.findCountry(countryCode);
|
|
9170
9217
|
}).filter(Boolean);
|
|
9171
9218
|
},
|
|
9172
9219
|
findCountry: function findCountry() {
|
|
@@ -9215,6 +9262,7 @@ function getDefault(key) {
|
|
|
9215
9262
|
if ((_this$inputOptions = this.inputOptions) !== null && _this$inputOptions !== void 0 && _this$inputOptions.showDialCode && parsedCountry) {
|
|
9216
9263
|
// Reset phone if the showDialCode is set
|
|
9217
9264
|
this.phone = "+".concat(parsedCountry.dialCode);
|
|
9265
|
+
this.activeCountryCode = parsedCountry.iso2 || '';
|
|
9218
9266
|
return;
|
|
9219
9267
|
} // update value, even if international mode is NOT used
|
|
9220
9268
|
|
|
@@ -9284,18 +9332,21 @@ function getDefault(key) {
|
|
|
9284
9332
|
focus: function focus() {
|
|
9285
9333
|
this.$refs.input.focus();
|
|
9286
9334
|
},
|
|
9287
|
-
toggleDropdown: function toggleDropdown() {
|
|
9288
|
-
|
|
9335
|
+
toggleDropdown: function toggleDropdown(e) {
|
|
9336
|
+
var _e$path, _e$path$;
|
|
9337
|
+
|
|
9338
|
+
if (this.disabled || this.dropdownOptions.disabled || (e === null || e === void 0 ? void 0 : (_e$path = e.path) === null || _e$path === void 0 ? void 0 : (_e$path$ = _e$path[0]) === null || _e$path$ === void 0 ? void 0 : _e$path$.type) === 'text') {
|
|
9289
9339
|
return;
|
|
9290
9340
|
}
|
|
9291
9341
|
|
|
9342
|
+
this.searchQuery = '';
|
|
9292
9343
|
this.open = !this.open;
|
|
9293
9344
|
},
|
|
9294
9345
|
clickedOutside: function clickedOutside() {
|
|
9295
9346
|
this.open = false;
|
|
9296
9347
|
},
|
|
9297
9348
|
keyboardNav: function keyboardNav(e) {
|
|
9298
|
-
var
|
|
9349
|
+
var _this8 = this;
|
|
9299
9350
|
|
|
9300
9351
|
if (e.keyCode === 40) {
|
|
9301
9352
|
// down arrow
|
|
@@ -9309,6 +9360,7 @@ function getDefault(key) {
|
|
|
9309
9360
|
}
|
|
9310
9361
|
|
|
9311
9362
|
var selEle = this.$refs.list.children[this.selectedIndex];
|
|
9363
|
+
selEle.focus();
|
|
9312
9364
|
|
|
9313
9365
|
if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
|
|
9314
9366
|
this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
|
|
@@ -9326,6 +9378,8 @@ function getDefault(key) {
|
|
|
9326
9378
|
|
|
9327
9379
|
var _selEle = this.$refs.list.children[this.selectedIndex];
|
|
9328
9380
|
|
|
9381
|
+
_selEle.focus();
|
|
9382
|
+
|
|
9329
9383
|
if (_selEle.offsetTop < this.$refs.list.scrollTop) {
|
|
9330
9384
|
this.$refs.list.scrollTop = _selEle.offsetTop;
|
|
9331
9385
|
}
|
|
@@ -9341,11 +9395,11 @@ function getDefault(key) {
|
|
|
9341
9395
|
this.typeToFindInput += e.key;
|
|
9342
9396
|
clearTimeout(this.typeToFindTimer);
|
|
9343
9397
|
this.typeToFindTimer = setTimeout(function () {
|
|
9344
|
-
|
|
9398
|
+
_this8.typeToFindInput = '';
|
|
9345
9399
|
}, 700); // don't include preferred countries so we jump to the right place in the alphabet
|
|
9346
9400
|
|
|
9347
9401
|
var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
|
|
9348
|
-
return c.name.toLowerCase().startsWith(
|
|
9402
|
+
return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
|
|
9349
9403
|
});
|
|
9350
9404
|
|
|
9351
9405
|
if (typedCountryI >= 0) {
|