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
|
@@ -319,6 +319,12 @@ 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,
|
|
@@ -379,6 +385,12 @@ const allProps = [{
|
|
|
379
385
|
type: String,
|
|
380
386
|
description: 'Native input <code>name</code> attribute',
|
|
381
387
|
inDemo: false
|
|
388
|
+
}, {
|
|
389
|
+
name: 'inputOptions.showDialCode',
|
|
390
|
+
default: false,
|
|
391
|
+
type: Boolean,
|
|
392
|
+
description: 'Show dial code in input',
|
|
393
|
+
inDemo: false
|
|
382
394
|
}, {
|
|
383
395
|
name: 'inputOptions.placeholder',
|
|
384
396
|
default: 'Enter a phone number',
|
|
@@ -480,13 +492,11 @@ const defaultOptions = [...allProps].reduce((prv, crr) => {
|
|
|
480
492
|
options: { ...defaultOptions
|
|
481
493
|
}
|
|
482
494
|
});
|
|
483
|
-
;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
484
|
-
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.
|
|
485
|
-
var staticRenderFns = [
|
|
495
|
+
;// 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&
|
|
496
|
+
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)}
|
|
497
|
+
var staticRenderFns = []
|
|
486
498
|
|
|
487
499
|
|
|
488
|
-
;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=13c114b8&
|
|
489
|
-
|
|
490
500
|
;// CONCATENATED MODULE: ./node_modules/libphonenumber-js/metadata.min.json.js
|
|
491
501
|
// This file is a workaround for a bug in web browsers' "native"
|
|
492
502
|
// ES6 importing system which is uncapable of importing "*.json" files.
|
|
@@ -3527,6 +3537,13 @@ function getParents(node, memo) {
|
|
|
3527
3537
|
//
|
|
3528
3538
|
//
|
|
3529
3539
|
//
|
|
3540
|
+
//
|
|
3541
|
+
//
|
|
3542
|
+
//
|
|
3543
|
+
//
|
|
3544
|
+
//
|
|
3545
|
+
//
|
|
3546
|
+
//
|
|
3530
3547
|
|
|
3531
3548
|
|
|
3532
3549
|
|
|
@@ -3637,7 +3654,8 @@ function getDefault(key) {
|
|
|
3637
3654
|
typeToFindInput: '',
|
|
3638
3655
|
typeToFindTimer: null,
|
|
3639
3656
|
dropdownOpenDirection: 'below',
|
|
3640
|
-
parsedPlaceholder: this.inputOptions.placeholder
|
|
3657
|
+
parsedPlaceholder: this.inputOptions.placeholder,
|
|
3658
|
+
searchQuery: ''
|
|
3641
3659
|
};
|
|
3642
3660
|
},
|
|
3643
3661
|
|
|
@@ -3685,7 +3703,13 @@ function getDefault(key) {
|
|
|
3685
3703
|
const preferredCountries = this.getCountries(this.preferredCountries).map(country => ({ ...country,
|
|
3686
3704
|
preferred: true
|
|
3687
3705
|
}));
|
|
3688
|
-
|
|
3706
|
+
const countriesList = [...preferredCountries, ...this.filteredCountries];
|
|
3707
|
+
|
|
3708
|
+
if (!this.dropdownOptions.showSearchBox) {
|
|
3709
|
+
return countriesList;
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3712
|
+
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));
|
|
3689
3713
|
},
|
|
3690
3714
|
|
|
3691
3715
|
phoneObject() {
|
|
@@ -3928,6 +3952,7 @@ function getDefault(key) {
|
|
|
3928
3952
|
if (this.inputOptions?.showDialCode && parsedCountry) {
|
|
3929
3953
|
// Reset phone if the showDialCode is set
|
|
3930
3954
|
this.phone = `+${parsedCountry.dialCode}`;
|
|
3955
|
+
this.activeCountryCode = parsedCountry.iso2 || '';
|
|
3931
3956
|
return;
|
|
3932
3957
|
} // update value, even if international mode is NOT used
|
|
3933
3958
|
|
|
@@ -4007,11 +4032,12 @@ function getDefault(key) {
|
|
|
4007
4032
|
this.$refs.input.focus();
|
|
4008
4033
|
},
|
|
4009
4034
|
|
|
4010
|
-
toggleDropdown() {
|
|
4011
|
-
if (this.disabled || this.dropdownOptions.disabled) {
|
|
4035
|
+
toggleDropdown(e) {
|
|
4036
|
+
if (this.disabled || this.dropdownOptions.disabled || e?.path?.[0]?.type === 'text') {
|
|
4012
4037
|
return;
|
|
4013
4038
|
}
|
|
4014
4039
|
|
|
4040
|
+
this.searchQuery = '';
|
|
4015
4041
|
this.open = !this.open;
|
|
4016
4042
|
},
|
|
4017
4043
|
|