vue-tel-input 5.6.0 → 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 +4 -4
- package/dist/css/component.css +1 -1
- package/dist/vue-tel-input.common.js +72 -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 +72 -40
- 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 +35 -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 +35 -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 +10 -9
|
@@ -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,13 +5673,11 @@ 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('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)?_vm.
|
|
5666
|
-
var staticRenderFns = [
|
|
5676
|
+
;// 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&
|
|
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:{"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)}
|
|
5678
|
+
var staticRenderFns = []
|
|
5667
5679
|
|
|
5668
5680
|
|
|
5669
|
-
;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=13c114b8&
|
|
5670
|
-
|
|
5671
5681
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
5672
5682
|
|
|
5673
5683
|
function _arrayWithoutHoles(arr) {
|
|
@@ -8770,6 +8780,13 @@ var _excluded = ["metadata"];
|
|
|
8770
8780
|
//
|
|
8771
8781
|
//
|
|
8772
8782
|
//
|
|
8783
|
+
//
|
|
8784
|
+
//
|
|
8785
|
+
//
|
|
8786
|
+
//
|
|
8787
|
+
//
|
|
8788
|
+
//
|
|
8789
|
+
//
|
|
8773
8790
|
|
|
8774
8791
|
|
|
8775
8792
|
|
|
@@ -8909,7 +8926,8 @@ function getDefault(key) {
|
|
|
8909
8926
|
typeToFindInput: '',
|
|
8910
8927
|
typeToFindTimer: null,
|
|
8911
8928
|
dropdownOpenDirection: 'below',
|
|
8912
|
-
parsedPlaceholder: this.inputOptions.placeholder
|
|
8929
|
+
parsedPlaceholder: this.inputOptions.placeholder,
|
|
8930
|
+
searchQuery: ''
|
|
8913
8931
|
};
|
|
8914
8932
|
},
|
|
8915
8933
|
computed: {
|
|
@@ -8955,13 +8973,23 @@ function getDefault(key) {
|
|
|
8955
8973
|
return this.allCountries;
|
|
8956
8974
|
},
|
|
8957
8975
|
sortedCountries: function sortedCountries() {
|
|
8976
|
+
var _this2 = this;
|
|
8977
|
+
|
|
8958
8978
|
// Sort the list countries: from preferred countries to all countries
|
|
8959
8979
|
var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
|
|
8960
8980
|
return _objectSpread2(_objectSpread2({}, country), {}, {
|
|
8961
8981
|
preferred: true
|
|
8962
8982
|
});
|
|
8963
8983
|
});
|
|
8964
|
-
|
|
8984
|
+
var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
|
|
8985
|
+
|
|
8986
|
+
if (!this.dropdownOptions.showSearchBox) {
|
|
8987
|
+
return countriesList;
|
|
8988
|
+
}
|
|
8989
|
+
|
|
8990
|
+
return countriesList.filter(function (c) {
|
|
8991
|
+
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);
|
|
8992
|
+
});
|
|
8965
8993
|
},
|
|
8966
8994
|
phoneObject: function phoneObject() {
|
|
8967
8995
|
var _this$phone, _result$isValid, _result2;
|
|
@@ -9023,7 +9051,7 @@ function getDefault(key) {
|
|
|
9023
9051
|
this.$emit('validate', this.phoneObject);
|
|
9024
9052
|
},
|
|
9025
9053
|
'phoneObject.formatted': function phoneObjectFormatted(value) {
|
|
9026
|
-
var
|
|
9054
|
+
var _this3 = this;
|
|
9027
9055
|
|
|
9028
9056
|
if (!this.autoFormat || this.customValidate) {
|
|
9029
9057
|
return;
|
|
@@ -9032,8 +9060,8 @@ function getDefault(key) {
|
|
|
9032
9060
|
this.emitInput(value);
|
|
9033
9061
|
this.$nextTick(function () {
|
|
9034
9062
|
// In case `v-model` is not set, we need to update the `phone` to be new formatted value
|
|
9035
|
-
if (value && !
|
|
9036
|
-
|
|
9063
|
+
if (value && !_this3.value) {
|
|
9064
|
+
_this3.phone = value;
|
|
9037
9065
|
}
|
|
9038
9066
|
});
|
|
9039
9067
|
},
|
|
@@ -9044,13 +9072,13 @@ function getDefault(key) {
|
|
|
9044
9072
|
this.resetPlaceholder();
|
|
9045
9073
|
},
|
|
9046
9074
|
value: function value(_value, oldValue) {
|
|
9047
|
-
var
|
|
9075
|
+
var _this4 = this;
|
|
9048
9076
|
|
|
9049
9077
|
if (!this.testCharacters()) {
|
|
9050
9078
|
this.$nextTick(function () {
|
|
9051
|
-
|
|
9079
|
+
_this4.phone = oldValue;
|
|
9052
9080
|
|
|
9053
|
-
|
|
9081
|
+
_this4.onInput();
|
|
9054
9082
|
});
|
|
9055
9083
|
} else {
|
|
9056
9084
|
this.phone = _value;
|
|
@@ -9067,7 +9095,7 @@ function getDefault(key) {
|
|
|
9067
9095
|
}
|
|
9068
9096
|
},
|
|
9069
9097
|
mounted: function mounted() {
|
|
9070
|
-
var
|
|
9098
|
+
var _this5 = this;
|
|
9071
9099
|
|
|
9072
9100
|
if (this.value) {
|
|
9073
9101
|
this.phone = this.value.trim();
|
|
@@ -9075,15 +9103,15 @@ function getDefault(key) {
|
|
|
9075
9103
|
|
|
9076
9104
|
this.cleanInvalidCharacters();
|
|
9077
9105
|
this.initializeCountry().then(function () {
|
|
9078
|
-
var
|
|
9106
|
+
var _this5$inputOptions;
|
|
9079
9107
|
|
|
9080
|
-
if (!
|
|
9081
|
-
|
|
9108
|
+
if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
|
|
9109
|
+
_this5.phone = "+".concat(_this5.activeCountryCode);
|
|
9082
9110
|
}
|
|
9083
9111
|
|
|
9084
|
-
|
|
9112
|
+
_this5.$emit('validate', _this5.phoneObject);
|
|
9085
9113
|
}).catch(console.error).then(function () {
|
|
9086
|
-
|
|
9114
|
+
_this5.finishMounted = true;
|
|
9087
9115
|
});
|
|
9088
9116
|
},
|
|
9089
9117
|
methods: {
|
|
@@ -9102,15 +9130,15 @@ function getDefault(key) {
|
|
|
9102
9130
|
// .catch(console.error);
|
|
9103
9131
|
},
|
|
9104
9132
|
initializeCountry: function initializeCountry() {
|
|
9105
|
-
var
|
|
9133
|
+
var _this6 = this;
|
|
9106
9134
|
|
|
9107
9135
|
return new Promise(function (resolve) {
|
|
9108
|
-
var
|
|
9136
|
+
var _this6$phone;
|
|
9109
9137
|
|
|
9110
9138
|
/**
|
|
9111
9139
|
* 1. If the phone included prefix (i.e. +12), try to get the country and set it
|
|
9112
9140
|
*/
|
|
9113
|
-
if (((
|
|
9141
|
+
if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
|
|
9114
9142
|
resolve();
|
|
9115
9143
|
return;
|
|
9116
9144
|
}
|
|
@@ -9119,19 +9147,19 @@ function getDefault(key) {
|
|
|
9119
9147
|
*/
|
|
9120
9148
|
|
|
9121
9149
|
|
|
9122
|
-
if (
|
|
9123
|
-
if (typeof
|
|
9124
|
-
|
|
9150
|
+
if (_this6.defaultCountry) {
|
|
9151
|
+
if (typeof _this6.defaultCountry === 'string') {
|
|
9152
|
+
_this6.choose(_this6.defaultCountry);
|
|
9125
9153
|
|
|
9126
9154
|
resolve();
|
|
9127
9155
|
return;
|
|
9128
9156
|
}
|
|
9129
9157
|
|
|
9130
|
-
if (typeof
|
|
9131
|
-
var country =
|
|
9158
|
+
if (typeof _this6.defaultCountry === 'number') {
|
|
9159
|
+
var country = _this6.findCountryByDialCode(_this6.defaultCountry);
|
|
9132
9160
|
|
|
9133
9161
|
if (country) {
|
|
9134
|
-
|
|
9162
|
+
_this6.choose(country.iso2);
|
|
9135
9163
|
|
|
9136
9164
|
resolve();
|
|
9137
9165
|
return;
|
|
@@ -9139,21 +9167,21 @@ function getDefault(key) {
|
|
|
9139
9167
|
}
|
|
9140
9168
|
}
|
|
9141
9169
|
|
|
9142
|
-
var fallbackCountry =
|
|
9170
|
+
var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
|
|
9143
9171
|
/**
|
|
9144
9172
|
* 3. Check if fetching country based on user's IP is allowed, set it as the default country
|
|
9145
9173
|
*/
|
|
9146
9174
|
|
|
9147
|
-
if (
|
|
9175
|
+
if (_this6.autoDefaultCountry) {
|
|
9148
9176
|
getCountry().then(function (res) {
|
|
9149
|
-
|
|
9177
|
+
_this6.choose(res || _this6.activeCountryCode);
|
|
9150
9178
|
}).catch(function (error) {
|
|
9151
9179
|
console.warn(error);
|
|
9152
9180
|
/**
|
|
9153
9181
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9154
9182
|
*/
|
|
9155
9183
|
|
|
9156
|
-
|
|
9184
|
+
_this6.choose(fallbackCountry);
|
|
9157
9185
|
}).then(function () {
|
|
9158
9186
|
resolve();
|
|
9159
9187
|
});
|
|
@@ -9161,7 +9189,7 @@ function getDefault(key) {
|
|
|
9161
9189
|
/**
|
|
9162
9190
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
9163
9191
|
*/
|
|
9164
|
-
|
|
9192
|
+
_this6.choose(fallbackCountry);
|
|
9165
9193
|
|
|
9166
9194
|
resolve();
|
|
9167
9195
|
}
|
|
@@ -9172,11 +9200,11 @@ function getDefault(key) {
|
|
|
9172
9200
|
* Get the list of countries from the list of iso2 code
|
|
9173
9201
|
*/
|
|
9174
9202
|
getCountries: function getCountries() {
|
|
9175
|
-
var
|
|
9203
|
+
var _this7 = this;
|
|
9176
9204
|
|
|
9177
9205
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9178
9206
|
return list.map(function (countryCode) {
|
|
9179
|
-
return
|
|
9207
|
+
return _this7.findCountry(countryCode);
|
|
9180
9208
|
}).filter(Boolean);
|
|
9181
9209
|
},
|
|
9182
9210
|
findCountry: function findCountry() {
|
|
@@ -9225,6 +9253,7 @@ function getDefault(key) {
|
|
|
9225
9253
|
if ((_this$inputOptions = this.inputOptions) !== null && _this$inputOptions !== void 0 && _this$inputOptions.showDialCode && parsedCountry) {
|
|
9226
9254
|
// Reset phone if the showDialCode is set
|
|
9227
9255
|
this.phone = "+".concat(parsedCountry.dialCode);
|
|
9256
|
+
this.activeCountryCode = parsedCountry.iso2 || '';
|
|
9228
9257
|
return;
|
|
9229
9258
|
} // update value, even if international mode is NOT used
|
|
9230
9259
|
|
|
@@ -9294,18 +9323,21 @@ function getDefault(key) {
|
|
|
9294
9323
|
focus: function focus() {
|
|
9295
9324
|
this.$refs.input.focus();
|
|
9296
9325
|
},
|
|
9297
|
-
toggleDropdown: function toggleDropdown() {
|
|
9298
|
-
|
|
9326
|
+
toggleDropdown: function toggleDropdown(e) {
|
|
9327
|
+
var _e$path, _e$path$;
|
|
9328
|
+
|
|
9329
|
+
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
9330
|
return;
|
|
9300
9331
|
}
|
|
9301
9332
|
|
|
9333
|
+
this.searchQuery = '';
|
|
9302
9334
|
this.open = !this.open;
|
|
9303
9335
|
},
|
|
9304
9336
|
clickedOutside: function clickedOutside() {
|
|
9305
9337
|
this.open = false;
|
|
9306
9338
|
},
|
|
9307
9339
|
keyboardNav: function keyboardNav(e) {
|
|
9308
|
-
var
|
|
9340
|
+
var _this8 = this;
|
|
9309
9341
|
|
|
9310
9342
|
if (e.keyCode === 40) {
|
|
9311
9343
|
// down arrow
|
|
@@ -9351,11 +9383,11 @@ function getDefault(key) {
|
|
|
9351
9383
|
this.typeToFindInput += e.key;
|
|
9352
9384
|
clearTimeout(this.typeToFindTimer);
|
|
9353
9385
|
this.typeToFindTimer = setTimeout(function () {
|
|
9354
|
-
|
|
9386
|
+
_this8.typeToFindInput = '';
|
|
9355
9387
|
}, 700); // don't include preferred countries so we jump to the right place in the alphabet
|
|
9356
9388
|
|
|
9357
9389
|
var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
|
|
9358
|
-
return c.name.toLowerCase().startsWith(
|
|
9390
|
+
return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
|
|
9359
9391
|
});
|
|
9360
9392
|
|
|
9361
9393
|
if (typedCountryI >= 0) {
|