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
|
@@ -2349,7 +2349,7 @@ module.exports = function (exec) {
|
|
|
2349
2349
|
|
|
2350
2350
|
/***/ }),
|
|
2351
2351
|
|
|
2352
|
-
/***/
|
|
2352
|
+
/***/ 5612:
|
|
2353
2353
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2354
2354
|
|
|
2355
2355
|
var anObject = __webpack_require__(9670);
|
|
@@ -3744,7 +3744,7 @@ var checkCorrectnessOfIteration = __webpack_require__(7072);
|
|
|
3744
3744
|
var speciesConstructor = __webpack_require__(6707);
|
|
3745
3745
|
var task = __webpack_require__(261).set;
|
|
3746
3746
|
var microtask = __webpack_require__(5948);
|
|
3747
|
-
var promiseResolve = __webpack_require__(
|
|
3747
|
+
var promiseResolve = __webpack_require__(5612);
|
|
3748
3748
|
var hostReportErrors = __webpack_require__(842);
|
|
3749
3749
|
var newPromiseCapabilityModule = __webpack_require__(8523);
|
|
3750
3750
|
var perform = __webpack_require__(2534);
|
|
@@ -5506,6 +5506,12 @@ var allProps = [{
|
|
|
5506
5506
|
type: Boolean,
|
|
5507
5507
|
description: 'Show flags in the dropdown selection and list',
|
|
5508
5508
|
inDemo: true
|
|
5509
|
+
}, {
|
|
5510
|
+
name: 'dropdownOptions.showSearchBox',
|
|
5511
|
+
default: false,
|
|
5512
|
+
type: Boolean,
|
|
5513
|
+
description: 'Show country search box',
|
|
5514
|
+
inDemo: true
|
|
5509
5515
|
}, {
|
|
5510
5516
|
name: 'dropdownOptions.tabindex',
|
|
5511
5517
|
default: 0,
|
|
@@ -5566,6 +5572,12 @@ var allProps = [{
|
|
|
5566
5572
|
type: String,
|
|
5567
5573
|
description: 'Native input <code>name</code> attribute',
|
|
5568
5574
|
inDemo: false
|
|
5575
|
+
}, {
|
|
5576
|
+
name: 'inputOptions.showDialCode',
|
|
5577
|
+
default: false,
|
|
5578
|
+
type: Boolean,
|
|
5579
|
+
description: 'Show dial code in input',
|
|
5580
|
+
inDemo: false
|
|
5569
5581
|
}, {
|
|
5570
5582
|
name: 'inputOptions.placeholder',
|
|
5571
5583
|
default: 'Enter a phone number',
|
|
@@ -5661,12 +5673,10 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
|
|
|
5661
5673
|
/* harmony default export */ const utils = ({
|
|
5662
5674
|
options: _objectSpread2({}, defaultOptions)
|
|
5663
5675
|
});
|
|
5664
|
-
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
5665
|
-
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('
|
|
5666
|
-
var staticRenderFns = [
|
|
5667
|
-
|
|
5676
|
+
;// 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&
|
|
5677
|
+
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)}
|
|
5678
|
+
var staticRenderFns = []
|
|
5668
5679
|
|
|
5669
|
-
;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=13c114b8&
|
|
5670
5680
|
|
|
5671
5681
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
5672
5682
|
|
|
@@ -8770,6 +8780,32 @@ var _excluded = ["metadata"];
|
|
|
8770
8780
|
//
|
|
8771
8781
|
//
|
|
8772
8782
|
//
|
|
8783
|
+
//
|
|
8784
|
+
//
|
|
8785
|
+
//
|
|
8786
|
+
//
|
|
8787
|
+
//
|
|
8788
|
+
//
|
|
8789
|
+
//
|
|
8790
|
+
//
|
|
8791
|
+
//
|
|
8792
|
+
//
|
|
8793
|
+
//
|
|
8794
|
+
//
|
|
8795
|
+
//
|
|
8796
|
+
//
|
|
8797
|
+
//
|
|
8798
|
+
//
|
|
8799
|
+
//
|
|
8800
|
+
//
|
|
8801
|
+
//
|
|
8802
|
+
//
|
|
8803
|
+
//
|
|
8804
|
+
//
|
|
8805
|
+
//
|
|
8806
|
+
//
|
|
8807
|
+
//
|
|
8808
|
+
//
|
|
8773
8809
|
|
|
8774
8810
|
|
|
8775
8811
|
|
|
@@ -8909,7 +8945,8 @@ function getDefault(key) {
|
|
|
8909
8945
|
typeToFindInput: '',
|
|
8910
8946
|
typeToFindTimer: null,
|
|
8911
8947
|
dropdownOpenDirection: 'below',
|
|
8912
|
-
parsedPlaceholder: this.inputOptions.placeholder
|
|
8948
|
+
parsedPlaceholder: this.inputOptions.placeholder,
|
|
8949
|
+
searchQuery: ''
|
|
8913
8950
|
};
|
|
8914
8951
|
},
|
|
8915
8952
|
computed: {
|
|
@@ -8955,13 +8992,23 @@ function getDefault(key) {
|
|
|
8955
8992
|
return this.allCountries;
|
|
8956
8993
|
},
|
|
8957
8994
|
sortedCountries: function sortedCountries() {
|
|
8995
|
+
var _this2 = this;
|
|
8996
|
+
|
|
8958
8997
|
// Sort the list countries: from preferred countries to all countries
|
|
8959
8998
|
var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
|
|
8960
8999
|
return _objectSpread2(_objectSpread2({}, country), {}, {
|
|
8961
9000
|
preferred: true
|
|
8962
9001
|
});
|
|
8963
9002
|
});
|
|
8964
|
-
|
|
9003
|
+
var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
|
|
9004
|
+
|
|
9005
|
+
if (!this.dropdownOptions.showSearchBox) {
|
|
9006
|
+
return countriesList;
|
|
9007
|
+
}
|
|
9008
|
+
|
|
9009
|
+
return countriesList.filter(function (c) {
|
|
9010
|
+
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);
|
|
9011
|
+
});
|
|
8965
9012
|
},
|
|
8966
9013
|
phoneObject: function phoneObject() {
|
|
8967
9014
|
var _this$phone, _result$isValid, _result2;
|
|
@@ -9023,7 +9070,7 @@ function getDefault(key) {
|
|
|
9023
9070
|
this.$emit('validate', this.phoneObject);
|
|
9024
9071
|
},
|
|
9025
9072
|
'phoneObject.formatted': function phoneObjectFormatted(value) {
|
|
9026
|
-
var
|
|
9073
|
+
var _this3 = this;
|
|
9027
9074
|
|
|
9028
9075
|
if (!this.autoFormat || this.customValidate) {
|
|
9029
9076
|
return;
|
|
@@ -9032,8 +9079,8 @@ function getDefault(key) {
|
|
|
9032
9079
|
this.emitInput(value);
|
|
9033
9080
|
this.$nextTick(function () {
|
|
9034
9081
|
// In case `v-model` is not set, we need to update the `phone` to be new formatted value
|
|
9035
|
-
if (value && !
|
|
9036
|
-
|
|
9082
|
+
if (value && !_this3.value) {
|
|
9083
|
+
_this3.phone = value;
|
|
9037
9084
|
}
|
|
9038
9085
|
});
|
|
9039
9086
|
},
|
|
@@ -9044,13 +9091,13 @@ function getDefault(key) {
|
|
|
9044
9091
|
this.resetPlaceholder();
|
|
9045
9092
|
},
|
|
9046
9093
|
value: function value(_value, oldValue) {
|
|
9047
|
-
var
|
|
9094
|
+
var _this4 = this;
|
|
9048
9095
|
|
|
9049
9096
|
if (!this.testCharacters()) {
|
|
9050
9097
|
this.$nextTick(function () {
|
|
9051
|
-
|
|
9098
|
+
_this4.phone = oldValue;
|
|
9052
9099
|
|
|
9053
|
-
|
|
9100
|
+
_this4.onInput();
|
|
9054
9101
|
});
|
|
9055
9102
|
} else {
|
|
9056
9103
|
this.phone = _value;
|
|
@@ -9067,7 +9114,7 @@ function getDefault(key) {
|
|
|
9067
9114
|
}
|
|
9068
9115
|
},
|
|
9069
9116
|
mounted: function mounted() {
|
|
9070
|
-
var
|
|
9117
|
+
var _this5 = this;
|
|
9071
9118
|
|
|
9072
9119
|
if (this.value) {
|
|
9073
9120
|
this.phone = this.value.trim();
|
|
@@ -9075,15 +9122,15 @@ function getDefault(key) {
|
|
|
9075
9122
|
|
|
9076
9123
|
this.cleanInvalidCharacters();
|
|
9077
9124
|
this.initializeCountry().then(function () {
|
|
9078
|
-
var
|
|
9125
|
+
var _this5$inputOptions;
|
|
9079
9126
|
|
|
9080
|
-
if (!
|
|
9081
|
-
|
|
9127
|
+
if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
|
|
9128
|
+
_this5.phone = "+".concat(_this5.activeCountryCode);
|
|
9082
9129
|
}
|
|
9083
9130
|
|
|
9084
|
-
|
|
9131
|
+
_this5.$emit('validate', _this5.phoneObject);
|
|
9085
9132
|
}).catch(console.error).then(function () {
|
|
9086
|
-
|
|
9133
|
+
_this5.finishMounted = true;
|
|
9087
9134
|
});
|
|
9088
9135
|
},
|
|
9089
9136
|
methods: {
|
|
@@ -9102,15 +9149,15 @@ function getDefault(key) {
|
|
|
9102
9149
|
// .catch(console.error);
|
|
9103
9150
|
},
|
|
9104
9151
|
initializeCountry: function initializeCountry() {
|
|
9105
|
-
var
|
|
9152
|
+
var _this6 = this;
|
|
9106
9153
|
|
|
9107
9154
|
return new Promise(function (resolve) {
|
|
9108
|
-
var
|
|
9155
|
+
var _this6$phone;
|
|
9109
9156
|
|
|
9110
9157
|
/**
|
|
9111
9158
|
* 1. If the phone included prefix (i.e. +12), try to get the country and set it
|
|
9112
9159
|
*/
|
|
9113
|
-
if (((
|
|
9160
|
+
if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
|
|
9114
9161
|
resolve();
|
|
9115
9162
|
return;
|
|
9116
9163
|
}
|
|
@@ -9119,19 +9166,19 @@ function getDefault(key) {
|
|
|
9119
9166
|
*/
|
|
9120
9167
|
|
|
9121
9168
|
|
|
9122
|
-
if (
|
|
9123
|
-
if (typeof
|
|
9124
|
-
|
|
9169
|
+
if (_this6.defaultCountry) {
|
|
9170
|
+
if (typeof _this6.defaultCountry === 'string') {
|
|
9171
|
+
_this6.choose(_this6.defaultCountry);
|
|
9125
9172
|
|
|
9126
9173
|
resolve();
|
|
9127
9174
|
return;
|
|
9128
9175
|
}
|
|
9129
9176
|
|
|
9130
|
-
if (typeof
|
|
9131
|
-
var country =
|
|
9177
|
+
if (typeof _this6.defaultCountry === 'number') {
|
|
9178
|
+
var country = _this6.findCountryByDialCode(_this6.defaultCountry);
|
|
9132
9179
|
|
|
9133
9180
|
if (country) {
|
|
9134
|
-
|
|
9181
|
+
_this6.choose(country.iso2);
|
|
9135
9182
|
|
|
9136
9183
|
resolve();
|
|
9137
9184
|
return;
|
|
@@ -9139,21 +9186,21 @@ function getDefault(key) {
|
|
|
9139
9186
|
}
|
|
9140
9187
|
}
|
|
9141
9188
|
|
|
9142
|
-
var fallbackCountry =
|
|
9189
|
+
var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
|
|
9143
9190
|
/**
|
|
9144
9191
|
* 3. Check if fetching country based on user's IP is allowed, set it as the default country
|
|
9145
9192
|
*/
|
|
9146
9193
|
|
|
9147
|
-
if (
|
|
9194
|
+
if (_this6.autoDefaultCountry) {
|
|
9148
9195
|
getCountry().then(function (res) {
|
|
9149
|
-
|
|
9196
|
+
_this6.choose(res || _this6.activeCountryCode);
|
|
9150
9197
|
}).catch(function (error) {
|
|
9151
9198
|
console.warn(error);
|
|
9152
9199
|
/**
|
|
9153
9200
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9154
9201
|
*/
|
|
9155
9202
|
|
|
9156
|
-
|
|
9203
|
+
_this6.choose(fallbackCountry);
|
|
9157
9204
|
}).then(function () {
|
|
9158
9205
|
resolve();
|
|
9159
9206
|
});
|
|
@@ -9161,7 +9208,7 @@ function getDefault(key) {
|
|
|
9161
9208
|
/**
|
|
9162
9209
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9163
9210
|
*/
|
|
9164
|
-
|
|
9211
|
+
_this6.choose(fallbackCountry);
|
|
9165
9212
|
|
|
9166
9213
|
resolve();
|
|
9167
9214
|
}
|
|
@@ -9172,11 +9219,11 @@ function getDefault(key) {
|
|
|
9172
9219
|
* Get the list of countries from the list of iso2 code
|
|
9173
9220
|
*/
|
|
9174
9221
|
getCountries: function getCountries() {
|
|
9175
|
-
var
|
|
9222
|
+
var _this7 = this;
|
|
9176
9223
|
|
|
9177
9224
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9178
9225
|
return list.map(function (countryCode) {
|
|
9179
|
-
return
|
|
9226
|
+
return _this7.findCountry(countryCode);
|
|
9180
9227
|
}).filter(Boolean);
|
|
9181
9228
|
},
|
|
9182
9229
|
findCountry: function findCountry() {
|
|
@@ -9225,6 +9272,7 @@ function getDefault(key) {
|
|
|
9225
9272
|
if ((_this$inputOptions = this.inputOptions) !== null && _this$inputOptions !== void 0 && _this$inputOptions.showDialCode && parsedCountry) {
|
|
9226
9273
|
// Reset phone if the showDialCode is set
|
|
9227
9274
|
this.phone = "+".concat(parsedCountry.dialCode);
|
|
9275
|
+
this.activeCountryCode = parsedCountry.iso2 || '';
|
|
9228
9276
|
return;
|
|
9229
9277
|
} // update value, even if international mode is NOT used
|
|
9230
9278
|
|
|
@@ -9294,18 +9342,21 @@ function getDefault(key) {
|
|
|
9294
9342
|
focus: function focus() {
|
|
9295
9343
|
this.$refs.input.focus();
|
|
9296
9344
|
},
|
|
9297
|
-
toggleDropdown: function toggleDropdown() {
|
|
9298
|
-
|
|
9345
|
+
toggleDropdown: function toggleDropdown(e) {
|
|
9346
|
+
var _e$path, _e$path$;
|
|
9347
|
+
|
|
9348
|
+
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') {
|
|
9299
9349
|
return;
|
|
9300
9350
|
}
|
|
9301
9351
|
|
|
9352
|
+
this.searchQuery = '';
|
|
9302
9353
|
this.open = !this.open;
|
|
9303
9354
|
},
|
|
9304
9355
|
clickedOutside: function clickedOutside() {
|
|
9305
9356
|
this.open = false;
|
|
9306
9357
|
},
|
|
9307
9358
|
keyboardNav: function keyboardNav(e) {
|
|
9308
|
-
var
|
|
9359
|
+
var _this8 = this;
|
|
9309
9360
|
|
|
9310
9361
|
if (e.keyCode === 40) {
|
|
9311
9362
|
// down arrow
|
|
@@ -9319,6 +9370,7 @@ function getDefault(key) {
|
|
|
9319
9370
|
}
|
|
9320
9371
|
|
|
9321
9372
|
var selEle = this.$refs.list.children[this.selectedIndex];
|
|
9373
|
+
selEle.focus();
|
|
9322
9374
|
|
|
9323
9375
|
if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
|
|
9324
9376
|
this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
|
|
@@ -9336,6 +9388,8 @@ function getDefault(key) {
|
|
|
9336
9388
|
|
|
9337
9389
|
var _selEle = this.$refs.list.children[this.selectedIndex];
|
|
9338
9390
|
|
|
9391
|
+
_selEle.focus();
|
|
9392
|
+
|
|
9339
9393
|
if (_selEle.offsetTop < this.$refs.list.scrollTop) {
|
|
9340
9394
|
this.$refs.list.scrollTop = _selEle.offsetTop;
|
|
9341
9395
|
}
|
|
@@ -9351,11 +9405,11 @@ function getDefault(key) {
|
|
|
9351
9405
|
this.typeToFindInput += e.key;
|
|
9352
9406
|
clearTimeout(this.typeToFindTimer);
|
|
9353
9407
|
this.typeToFindTimer = setTimeout(function () {
|
|
9354
|
-
|
|
9408
|
+
_this8.typeToFindInput = '';
|
|
9355
9409
|
}, 700); // don't include preferred countries so we jump to the right place in the alphabet
|
|
9356
9410
|
|
|
9357
9411
|
var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
|
|
9358
|
-
return c.name.toLowerCase().startsWith(
|
|
9412
|
+
return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
|
|
9359
9413
|
});
|
|
9360
9414
|
|
|
9361
9415
|
if (typedCountryI >= 0) {
|