vue-tel-input 5.6.3 → 5.10.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/LICENSE +0 -0
- package/README.md +2 -2
- package/dist/css/component.css +1 -1
- package/dist/vue-tel-input.common.js +94 -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 +94 -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 +56 -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 +56 -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
|
@@ -319,12 +319,23 @@ const allProps = [{
|
|
|
319
319
|
type: Boolean,
|
|
320
320
|
description: 'Show flags in the dropdown selection and list',
|
|
321
321
|
inDemo: true
|
|
322
|
+
}, {
|
|
323
|
+
name: 'dropdownOptions.showSearchBox',
|
|
324
|
+
default: false,
|
|
325
|
+
type: Boolean,
|
|
326
|
+
description: 'Show country search box',
|
|
327
|
+
inDemo: true
|
|
322
328
|
}, {
|
|
323
329
|
name: 'dropdownOptions.tabindex',
|
|
324
330
|
default: 0,
|
|
325
331
|
type: Number,
|
|
326
332
|
description: 'Native dropdown <code>tabindex</code> attribute',
|
|
327
333
|
inDemo: false
|
|
334
|
+
}, {
|
|
335
|
+
name: 'dropdownOptions.width',
|
|
336
|
+
default: '390px',
|
|
337
|
+
type: String,
|
|
338
|
+
description: 'Specify dropdown width'
|
|
328
339
|
}, {
|
|
329
340
|
name: 'ignoredCountries',
|
|
330
341
|
default: [],
|
|
@@ -486,8 +497,8 @@ const defaultOptions = [...allProps].reduce((prv, crr) => {
|
|
|
486
497
|
options: { ...defaultOptions
|
|
487
498
|
}
|
|
488
499
|
});
|
|
489
|
-
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
490
|
-
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('
|
|
500
|
+
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1dc3e612-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=0901b80c&
|
|
501
|
+
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,style:({ width: _vm.dropdownOptions.width }),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}}},[_c('div',{staticClass:"vti__flag-wrapper"},[(_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)}
|
|
491
502
|
var staticRenderFns = []
|
|
492
503
|
|
|
493
504
|
|
|
@@ -3531,6 +3542,35 @@ function getParents(node, memo) {
|
|
|
3531
3542
|
//
|
|
3532
3543
|
//
|
|
3533
3544
|
//
|
|
3545
|
+
//
|
|
3546
|
+
//
|
|
3547
|
+
//
|
|
3548
|
+
//
|
|
3549
|
+
//
|
|
3550
|
+
//
|
|
3551
|
+
//
|
|
3552
|
+
//
|
|
3553
|
+
//
|
|
3554
|
+
//
|
|
3555
|
+
//
|
|
3556
|
+
//
|
|
3557
|
+
//
|
|
3558
|
+
//
|
|
3559
|
+
//
|
|
3560
|
+
//
|
|
3561
|
+
//
|
|
3562
|
+
//
|
|
3563
|
+
//
|
|
3564
|
+
//
|
|
3565
|
+
//
|
|
3566
|
+
//
|
|
3567
|
+
//
|
|
3568
|
+
//
|
|
3569
|
+
//
|
|
3570
|
+
//
|
|
3571
|
+
//
|
|
3572
|
+
//
|
|
3573
|
+
//
|
|
3534
3574
|
|
|
3535
3575
|
|
|
3536
3576
|
|
|
@@ -3641,7 +3681,8 @@ function getDefault(key) {
|
|
|
3641
3681
|
typeToFindInput: '',
|
|
3642
3682
|
typeToFindTimer: null,
|
|
3643
3683
|
dropdownOpenDirection: 'below',
|
|
3644
|
-
parsedPlaceholder: this.inputOptions.placeholder
|
|
3684
|
+
parsedPlaceholder: this.inputOptions.placeholder,
|
|
3685
|
+
searchQuery: ''
|
|
3645
3686
|
};
|
|
3646
3687
|
},
|
|
3647
3688
|
|
|
@@ -3689,7 +3730,13 @@ function getDefault(key) {
|
|
|
3689
3730
|
const preferredCountries = this.getCountries(this.preferredCountries).map(country => ({ ...country,
|
|
3690
3731
|
preferred: true
|
|
3691
3732
|
}));
|
|
3692
|
-
|
|
3733
|
+
const countriesList = [...preferredCountries, ...this.filteredCountries];
|
|
3734
|
+
|
|
3735
|
+
if (!this.dropdownOptions.showSearchBox) {
|
|
3736
|
+
return countriesList;
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
return countriesList.filter(c => new RegExp(this.searchQuery, 'i').test(c.name) || new RegExp(this.searchQuery, 'i').test(c.iso2) || new RegExp(this.searchQuery, 'i').test(c.dialCode));
|
|
3693
3740
|
},
|
|
3694
3741
|
|
|
3695
3742
|
phoneObject() {
|
|
@@ -4012,11 +4059,12 @@ function getDefault(key) {
|
|
|
4012
4059
|
this.$refs.input.focus();
|
|
4013
4060
|
},
|
|
4014
4061
|
|
|
4015
|
-
toggleDropdown() {
|
|
4016
|
-
if (this.disabled || this.dropdownOptions.disabled) {
|
|
4062
|
+
toggleDropdown(e) {
|
|
4063
|
+
if (this.disabled || this.dropdownOptions.disabled || e?.path?.[0]?.type === 'text') {
|
|
4017
4064
|
return;
|
|
4018
4065
|
}
|
|
4019
4066
|
|
|
4067
|
+
this.searchQuery = '';
|
|
4020
4068
|
this.open = !this.open;
|
|
4021
4069
|
},
|
|
4022
4070
|
|
|
@@ -4037,6 +4085,7 @@ function getDefault(key) {
|
|
|
4037
4085
|
}
|
|
4038
4086
|
|
|
4039
4087
|
const selEle = this.$refs.list.children[this.selectedIndex];
|
|
4088
|
+
selEle.focus();
|
|
4040
4089
|
|
|
4041
4090
|
if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
|
|
4042
4091
|
this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
|
|
@@ -4053,6 +4102,7 @@ function getDefault(key) {
|
|
|
4053
4102
|
}
|
|
4054
4103
|
|
|
4055
4104
|
const selEle = this.$refs.list.children[this.selectedIndex];
|
|
4105
|
+
selEle.focus();
|
|
4056
4106
|
|
|
4057
4107
|
if (selEle.offsetTop < this.$refs.list.scrollTop) {
|
|
4058
4108
|
this.$refs.list.scrollTop = selEle.offsetTop;
|