vue-tel-input 5.6.3 → 5.7.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 +64 -37
- 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 +64 -37
- 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 +27 -6
- 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 +27 -6
- 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 +1 -1
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,
|
|
@@ -5657,8 +5663,8 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
|
|
|
5657
5663
|
/* harmony default export */ const utils = ({
|
|
5658
5664
|
options: _objectSpread2({}, defaultOptions)
|
|
5659
5665
|
});
|
|
5660
|
-
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
5661
|
-
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('div',{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},_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)],on:{"click":function($event){return _vm.choose(pb)},"mousemove":function($event){_vm.selectedIndex = index}}},[(_vm.dropdownOptions.showFlags)?_c('div',{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()])}),
|
|
5666
|
+
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"2f9a4d83-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=33071b52&
|
|
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:{"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('div',{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},[(_vm.dropdownOptions.showSearchBox)?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.searchQuery),expression:"searchQuery"}],staticClass:"vti__input vti__search_box",attrs:{"placeholder":"Search by country name or country code","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)],on:{"click":function($event){return _vm.choose(pb)},"mousemove":function($event){_vm.selectedIndex = index}}},[(_vm.dropdownOptions.showFlags)?_c('div',{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)}
|
|
5662
5668
|
var staticRenderFns = []
|
|
5663
5669
|
|
|
5664
5670
|
|
|
@@ -8764,6 +8770,13 @@ var _excluded = ["metadata"];
|
|
|
8764
8770
|
//
|
|
8765
8771
|
//
|
|
8766
8772
|
//
|
|
8773
|
+
//
|
|
8774
|
+
//
|
|
8775
|
+
//
|
|
8776
|
+
//
|
|
8777
|
+
//
|
|
8778
|
+
//
|
|
8779
|
+
//
|
|
8767
8780
|
|
|
8768
8781
|
|
|
8769
8782
|
|
|
@@ -8903,7 +8916,8 @@ function getDefault(key) {
|
|
|
8903
8916
|
typeToFindInput: '',
|
|
8904
8917
|
typeToFindTimer: null,
|
|
8905
8918
|
dropdownOpenDirection: 'below',
|
|
8906
|
-
parsedPlaceholder: this.inputOptions.placeholder
|
|
8919
|
+
parsedPlaceholder: this.inputOptions.placeholder,
|
|
8920
|
+
searchQuery: ''
|
|
8907
8921
|
};
|
|
8908
8922
|
},
|
|
8909
8923
|
computed: {
|
|
@@ -8949,13 +8963,23 @@ function getDefault(key) {
|
|
|
8949
8963
|
return this.allCountries;
|
|
8950
8964
|
},
|
|
8951
8965
|
sortedCountries: function sortedCountries() {
|
|
8966
|
+
var _this2 = this;
|
|
8967
|
+
|
|
8952
8968
|
// Sort the list countries: from preferred countries to all countries
|
|
8953
8969
|
var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
|
|
8954
8970
|
return _objectSpread2(_objectSpread2({}, country), {}, {
|
|
8955
8971
|
preferred: true
|
|
8956
8972
|
});
|
|
8957
8973
|
});
|
|
8958
|
-
|
|
8974
|
+
var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
|
|
8975
|
+
|
|
8976
|
+
if (!this.dropdownOptions.showSearchBox) {
|
|
8977
|
+
return countriesList;
|
|
8978
|
+
}
|
|
8979
|
+
|
|
8980
|
+
return countriesList.filter(function (c) {
|
|
8981
|
+
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);
|
|
8982
|
+
});
|
|
8959
8983
|
},
|
|
8960
8984
|
phoneObject: function phoneObject() {
|
|
8961
8985
|
var _this$phone, _result$isValid, _result2;
|
|
@@ -9017,7 +9041,7 @@ function getDefault(key) {
|
|
|
9017
9041
|
this.$emit('validate', this.phoneObject);
|
|
9018
9042
|
},
|
|
9019
9043
|
'phoneObject.formatted': function phoneObjectFormatted(value) {
|
|
9020
|
-
var
|
|
9044
|
+
var _this3 = this;
|
|
9021
9045
|
|
|
9022
9046
|
if (!this.autoFormat || this.customValidate) {
|
|
9023
9047
|
return;
|
|
@@ -9026,8 +9050,8 @@ function getDefault(key) {
|
|
|
9026
9050
|
this.emitInput(value);
|
|
9027
9051
|
this.$nextTick(function () {
|
|
9028
9052
|
// In case `v-model` is not set, we need to update the `phone` to be new formatted value
|
|
9029
|
-
if (value && !
|
|
9030
|
-
|
|
9053
|
+
if (value && !_this3.value) {
|
|
9054
|
+
_this3.phone = value;
|
|
9031
9055
|
}
|
|
9032
9056
|
});
|
|
9033
9057
|
},
|
|
@@ -9038,13 +9062,13 @@ function getDefault(key) {
|
|
|
9038
9062
|
this.resetPlaceholder();
|
|
9039
9063
|
},
|
|
9040
9064
|
value: function value(_value, oldValue) {
|
|
9041
|
-
var
|
|
9065
|
+
var _this4 = this;
|
|
9042
9066
|
|
|
9043
9067
|
if (!this.testCharacters()) {
|
|
9044
9068
|
this.$nextTick(function () {
|
|
9045
|
-
|
|
9069
|
+
_this4.phone = oldValue;
|
|
9046
9070
|
|
|
9047
|
-
|
|
9071
|
+
_this4.onInput();
|
|
9048
9072
|
});
|
|
9049
9073
|
} else {
|
|
9050
9074
|
this.phone = _value;
|
|
@@ -9061,7 +9085,7 @@ function getDefault(key) {
|
|
|
9061
9085
|
}
|
|
9062
9086
|
},
|
|
9063
9087
|
mounted: function mounted() {
|
|
9064
|
-
var
|
|
9088
|
+
var _this5 = this;
|
|
9065
9089
|
|
|
9066
9090
|
if (this.value) {
|
|
9067
9091
|
this.phone = this.value.trim();
|
|
@@ -9069,15 +9093,15 @@ function getDefault(key) {
|
|
|
9069
9093
|
|
|
9070
9094
|
this.cleanInvalidCharacters();
|
|
9071
9095
|
this.initializeCountry().then(function () {
|
|
9072
|
-
var
|
|
9096
|
+
var _this5$inputOptions;
|
|
9073
9097
|
|
|
9074
|
-
if (!
|
|
9075
|
-
|
|
9098
|
+
if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
|
|
9099
|
+
_this5.phone = "+".concat(_this5.activeCountryCode);
|
|
9076
9100
|
}
|
|
9077
9101
|
|
|
9078
|
-
|
|
9102
|
+
_this5.$emit('validate', _this5.phoneObject);
|
|
9079
9103
|
}).catch(console.error).then(function () {
|
|
9080
|
-
|
|
9104
|
+
_this5.finishMounted = true;
|
|
9081
9105
|
});
|
|
9082
9106
|
},
|
|
9083
9107
|
methods: {
|
|
@@ -9096,15 +9120,15 @@ function getDefault(key) {
|
|
|
9096
9120
|
// .catch(console.error);
|
|
9097
9121
|
},
|
|
9098
9122
|
initializeCountry: function initializeCountry() {
|
|
9099
|
-
var
|
|
9123
|
+
var _this6 = this;
|
|
9100
9124
|
|
|
9101
9125
|
return new Promise(function (resolve) {
|
|
9102
|
-
var
|
|
9126
|
+
var _this6$phone;
|
|
9103
9127
|
|
|
9104
9128
|
/**
|
|
9105
9129
|
* 1. If the phone included prefix (i.e. +12), try to get the country and set it
|
|
9106
9130
|
*/
|
|
9107
|
-
if (((
|
|
9131
|
+
if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
|
|
9108
9132
|
resolve();
|
|
9109
9133
|
return;
|
|
9110
9134
|
}
|
|
@@ -9113,19 +9137,19 @@ function getDefault(key) {
|
|
|
9113
9137
|
*/
|
|
9114
9138
|
|
|
9115
9139
|
|
|
9116
|
-
if (
|
|
9117
|
-
if (typeof
|
|
9118
|
-
|
|
9140
|
+
if (_this6.defaultCountry) {
|
|
9141
|
+
if (typeof _this6.defaultCountry === 'string') {
|
|
9142
|
+
_this6.choose(_this6.defaultCountry);
|
|
9119
9143
|
|
|
9120
9144
|
resolve();
|
|
9121
9145
|
return;
|
|
9122
9146
|
}
|
|
9123
9147
|
|
|
9124
|
-
if (typeof
|
|
9125
|
-
var country =
|
|
9148
|
+
if (typeof _this6.defaultCountry === 'number') {
|
|
9149
|
+
var country = _this6.findCountryByDialCode(_this6.defaultCountry);
|
|
9126
9150
|
|
|
9127
9151
|
if (country) {
|
|
9128
|
-
|
|
9152
|
+
_this6.choose(country.iso2);
|
|
9129
9153
|
|
|
9130
9154
|
resolve();
|
|
9131
9155
|
return;
|
|
@@ -9133,21 +9157,21 @@ function getDefault(key) {
|
|
|
9133
9157
|
}
|
|
9134
9158
|
}
|
|
9135
9159
|
|
|
9136
|
-
var fallbackCountry =
|
|
9160
|
+
var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
|
|
9137
9161
|
/**
|
|
9138
9162
|
* 3. Check if fetching country based on user's IP is allowed, set it as the default country
|
|
9139
9163
|
*/
|
|
9140
9164
|
|
|
9141
|
-
if (
|
|
9165
|
+
if (_this6.autoDefaultCountry) {
|
|
9142
9166
|
getCountry().then(function (res) {
|
|
9143
|
-
|
|
9167
|
+
_this6.choose(res || _this6.activeCountryCode);
|
|
9144
9168
|
}).catch(function (error) {
|
|
9145
9169
|
console.warn(error);
|
|
9146
9170
|
/**
|
|
9147
9171
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9148
9172
|
*/
|
|
9149
9173
|
|
|
9150
|
-
|
|
9174
|
+
_this6.choose(fallbackCountry);
|
|
9151
9175
|
}).then(function () {
|
|
9152
9176
|
resolve();
|
|
9153
9177
|
});
|
|
@@ -9155,7 +9179,7 @@ function getDefault(key) {
|
|
|
9155
9179
|
/**
|
|
9156
9180
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9157
9181
|
*/
|
|
9158
|
-
|
|
9182
|
+
_this6.choose(fallbackCountry);
|
|
9159
9183
|
|
|
9160
9184
|
resolve();
|
|
9161
9185
|
}
|
|
@@ -9166,11 +9190,11 @@ function getDefault(key) {
|
|
|
9166
9190
|
* Get the list of countries from the list of iso2 code
|
|
9167
9191
|
*/
|
|
9168
9192
|
getCountries: function getCountries() {
|
|
9169
|
-
var
|
|
9193
|
+
var _this7 = this;
|
|
9170
9194
|
|
|
9171
9195
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9172
9196
|
return list.map(function (countryCode) {
|
|
9173
|
-
return
|
|
9197
|
+
return _this7.findCountry(countryCode);
|
|
9174
9198
|
}).filter(Boolean);
|
|
9175
9199
|
},
|
|
9176
9200
|
findCountry: function findCountry() {
|
|
@@ -9289,18 +9313,21 @@ function getDefault(key) {
|
|
|
9289
9313
|
focus: function focus() {
|
|
9290
9314
|
this.$refs.input.focus();
|
|
9291
9315
|
},
|
|
9292
|
-
toggleDropdown: function toggleDropdown() {
|
|
9293
|
-
|
|
9316
|
+
toggleDropdown: function toggleDropdown(e) {
|
|
9317
|
+
var _e$path, _e$path$;
|
|
9318
|
+
|
|
9319
|
+
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') {
|
|
9294
9320
|
return;
|
|
9295
9321
|
}
|
|
9296
9322
|
|
|
9323
|
+
this.searchQuery = '';
|
|
9297
9324
|
this.open = !this.open;
|
|
9298
9325
|
},
|
|
9299
9326
|
clickedOutside: function clickedOutside() {
|
|
9300
9327
|
this.open = false;
|
|
9301
9328
|
},
|
|
9302
9329
|
keyboardNav: function keyboardNav(e) {
|
|
9303
|
-
var
|
|
9330
|
+
var _this8 = this;
|
|
9304
9331
|
|
|
9305
9332
|
if (e.keyCode === 40) {
|
|
9306
9333
|
// down arrow
|
|
@@ -9346,11 +9373,11 @@ function getDefault(key) {
|
|
|
9346
9373
|
this.typeToFindInput += e.key;
|
|
9347
9374
|
clearTimeout(this.typeToFindTimer);
|
|
9348
9375
|
this.typeToFindTimer = setTimeout(function () {
|
|
9349
|
-
|
|
9376
|
+
_this8.typeToFindInput = '';
|
|
9350
9377
|
}, 700); // don't include preferred countries so we jump to the right place in the alphabet
|
|
9351
9378
|
|
|
9352
9379
|
var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
|
|
9353
|
-
return c.name.toLowerCase().startsWith(
|
|
9380
|
+
return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
|
|
9354
9381
|
});
|
|
9355
9382
|
|
|
9356
9383
|
if (typedCountryI >= 0) {
|