vue-tel-input 5.14.0 → 5.14.2
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/dist/vue-tel-input.common.js +238 -36
- package/dist/vue-tel-input.common.js.map +1 -1
- package/dist/vue-tel-input.umd.js +238 -36
- 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/vue-tel-input.common.js +7 -2
- package/dist-modern/vue-tel-input.common.js.map +1 -1
- package/dist-modern/vue-tel-input.umd.js +7 -2
- 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
|
@@ -1419,6 +1419,57 @@ module.exports = function (V, P) {
|
|
|
1419
1419
|
};
|
|
1420
1420
|
|
|
1421
1421
|
|
|
1422
|
+
/***/ }),
|
|
1423
|
+
|
|
1424
|
+
/***/ 647:
|
|
1425
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1426
|
+
|
|
1427
|
+
var uncurryThis = __webpack_require__(1702);
|
|
1428
|
+
var toObject = __webpack_require__(7908);
|
|
1429
|
+
|
|
1430
|
+
var floor = Math.floor;
|
|
1431
|
+
var charAt = uncurryThis(''.charAt);
|
|
1432
|
+
var replace = uncurryThis(''.replace);
|
|
1433
|
+
var stringSlice = uncurryThis(''.slice);
|
|
1434
|
+
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
1435
|
+
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
1436
|
+
|
|
1437
|
+
// `GetSubstitution` abstract operation
|
|
1438
|
+
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
1439
|
+
module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
1440
|
+
var tailPos = position + matched.length;
|
|
1441
|
+
var m = captures.length;
|
|
1442
|
+
var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
1443
|
+
if (namedCaptures !== undefined) {
|
|
1444
|
+
namedCaptures = toObject(namedCaptures);
|
|
1445
|
+
symbols = SUBSTITUTION_SYMBOLS;
|
|
1446
|
+
}
|
|
1447
|
+
return replace(replacement, symbols, function (match, ch) {
|
|
1448
|
+
var capture;
|
|
1449
|
+
switch (charAt(ch, 0)) {
|
|
1450
|
+
case '$': return '$';
|
|
1451
|
+
case '&': return matched;
|
|
1452
|
+
case '`': return stringSlice(str, 0, position);
|
|
1453
|
+
case "'": return stringSlice(str, tailPos);
|
|
1454
|
+
case '<':
|
|
1455
|
+
capture = namedCaptures[stringSlice(ch, 1, -1)];
|
|
1456
|
+
break;
|
|
1457
|
+
default: // \d\d?
|
|
1458
|
+
var n = +ch;
|
|
1459
|
+
if (n === 0) return match;
|
|
1460
|
+
if (n > m) {
|
|
1461
|
+
var f = floor(n / 10);
|
|
1462
|
+
if (f === 0) return match;
|
|
1463
|
+
if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
|
|
1464
|
+
return match;
|
|
1465
|
+
}
|
|
1466
|
+
capture = captures[n - 1];
|
|
1467
|
+
}
|
|
1468
|
+
return capture === undefined ? '' : capture;
|
|
1469
|
+
});
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
|
|
1422
1473
|
/***/ }),
|
|
1423
1474
|
|
|
1424
1475
|
/***/ 7854:
|
|
@@ -5917,6 +5968,151 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
|
|
|
5917
5968
|
});
|
|
5918
5969
|
|
|
5919
5970
|
|
|
5971
|
+
/***/ }),
|
|
5972
|
+
|
|
5973
|
+
/***/ 5306:
|
|
5974
|
+
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
5975
|
+
|
|
5976
|
+
"use strict";
|
|
5977
|
+
|
|
5978
|
+
var apply = __webpack_require__(2104);
|
|
5979
|
+
var call = __webpack_require__(6916);
|
|
5980
|
+
var uncurryThis = __webpack_require__(1702);
|
|
5981
|
+
var fixRegExpWellKnownSymbolLogic = __webpack_require__(7007);
|
|
5982
|
+
var fails = __webpack_require__(7293);
|
|
5983
|
+
var anObject = __webpack_require__(9670);
|
|
5984
|
+
var isCallable = __webpack_require__(614);
|
|
5985
|
+
var isNullOrUndefined = __webpack_require__(8554);
|
|
5986
|
+
var toIntegerOrInfinity = __webpack_require__(9303);
|
|
5987
|
+
var toLength = __webpack_require__(7466);
|
|
5988
|
+
var toString = __webpack_require__(1340);
|
|
5989
|
+
var requireObjectCoercible = __webpack_require__(4488);
|
|
5990
|
+
var advanceStringIndex = __webpack_require__(1530);
|
|
5991
|
+
var getMethod = __webpack_require__(8173);
|
|
5992
|
+
var getSubstitution = __webpack_require__(647);
|
|
5993
|
+
var regExpExec = __webpack_require__(7651);
|
|
5994
|
+
var wellKnownSymbol = __webpack_require__(5112);
|
|
5995
|
+
|
|
5996
|
+
var REPLACE = wellKnownSymbol('replace');
|
|
5997
|
+
var max = Math.max;
|
|
5998
|
+
var min = Math.min;
|
|
5999
|
+
var concat = uncurryThis([].concat);
|
|
6000
|
+
var push = uncurryThis([].push);
|
|
6001
|
+
var stringIndexOf = uncurryThis(''.indexOf);
|
|
6002
|
+
var stringSlice = uncurryThis(''.slice);
|
|
6003
|
+
|
|
6004
|
+
var maybeToString = function (it) {
|
|
6005
|
+
return it === undefined ? it : String(it);
|
|
6006
|
+
};
|
|
6007
|
+
|
|
6008
|
+
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
6009
|
+
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
6010
|
+
var REPLACE_KEEPS_$0 = (function () {
|
|
6011
|
+
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
6012
|
+
return 'a'.replace(/./, '$0') === '$0';
|
|
6013
|
+
})();
|
|
6014
|
+
|
|
6015
|
+
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
6016
|
+
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
6017
|
+
if (/./[REPLACE]) {
|
|
6018
|
+
return /./[REPLACE]('a', '$0') === '';
|
|
6019
|
+
}
|
|
6020
|
+
return false;
|
|
6021
|
+
})();
|
|
6022
|
+
|
|
6023
|
+
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
|
|
6024
|
+
var re = /./;
|
|
6025
|
+
re.exec = function () {
|
|
6026
|
+
var result = [];
|
|
6027
|
+
result.groups = { a: '7' };
|
|
6028
|
+
return result;
|
|
6029
|
+
};
|
|
6030
|
+
// eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
|
|
6031
|
+
return ''.replace(re, '$<a>') !== '7';
|
|
6032
|
+
});
|
|
6033
|
+
|
|
6034
|
+
// @@replace logic
|
|
6035
|
+
fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
|
|
6036
|
+
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
|
|
6037
|
+
|
|
6038
|
+
return [
|
|
6039
|
+
// `String.prototype.replace` method
|
|
6040
|
+
// https://tc39.es/ecma262/#sec-string.prototype.replace
|
|
6041
|
+
function replace(searchValue, replaceValue) {
|
|
6042
|
+
var O = requireObjectCoercible(this);
|
|
6043
|
+
var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
|
|
6044
|
+
return replacer
|
|
6045
|
+
? call(replacer, searchValue, O, replaceValue)
|
|
6046
|
+
: call(nativeReplace, toString(O), searchValue, replaceValue);
|
|
6047
|
+
},
|
|
6048
|
+
// `RegExp.prototype[@@replace]` method
|
|
6049
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
|
|
6050
|
+
function (string, replaceValue) {
|
|
6051
|
+
var rx = anObject(this);
|
|
6052
|
+
var S = toString(string);
|
|
6053
|
+
|
|
6054
|
+
if (
|
|
6055
|
+
typeof replaceValue == 'string' &&
|
|
6056
|
+
stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
|
|
6057
|
+
stringIndexOf(replaceValue, '$<') === -1
|
|
6058
|
+
) {
|
|
6059
|
+
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
|
|
6060
|
+
if (res.done) return res.value;
|
|
6061
|
+
}
|
|
6062
|
+
|
|
6063
|
+
var functionalReplace = isCallable(replaceValue);
|
|
6064
|
+
if (!functionalReplace) replaceValue = toString(replaceValue);
|
|
6065
|
+
|
|
6066
|
+
var global = rx.global;
|
|
6067
|
+
if (global) {
|
|
6068
|
+
var fullUnicode = rx.unicode;
|
|
6069
|
+
rx.lastIndex = 0;
|
|
6070
|
+
}
|
|
6071
|
+
var results = [];
|
|
6072
|
+
while (true) {
|
|
6073
|
+
var result = regExpExec(rx, S);
|
|
6074
|
+
if (result === null) break;
|
|
6075
|
+
|
|
6076
|
+
push(results, result);
|
|
6077
|
+
if (!global) break;
|
|
6078
|
+
|
|
6079
|
+
var matchStr = toString(result[0]);
|
|
6080
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
|
6081
|
+
}
|
|
6082
|
+
|
|
6083
|
+
var accumulatedResult = '';
|
|
6084
|
+
var nextSourcePosition = 0;
|
|
6085
|
+
for (var i = 0; i < results.length; i++) {
|
|
6086
|
+
result = results[i];
|
|
6087
|
+
|
|
6088
|
+
var matched = toString(result[0]);
|
|
6089
|
+
var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
|
|
6090
|
+
var captures = [];
|
|
6091
|
+
// NOTE: This is equivalent to
|
|
6092
|
+
// captures = result.slice(1).map(maybeToString)
|
|
6093
|
+
// but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
6094
|
+
// the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
6095
|
+
// causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
6096
|
+
for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
|
|
6097
|
+
var namedCaptures = result.groups;
|
|
6098
|
+
if (functionalReplace) {
|
|
6099
|
+
var replacerArgs = concat([matched], captures, position, S);
|
|
6100
|
+
if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
|
|
6101
|
+
var replacement = toString(apply(replaceValue, undefined, replacerArgs));
|
|
6102
|
+
} else {
|
|
6103
|
+
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
|
6104
|
+
}
|
|
6105
|
+
if (position >= nextSourcePosition) {
|
|
6106
|
+
accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
|
|
6107
|
+
nextSourcePosition = position + matched.length;
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
return accumulatedResult + stringSlice(S, nextSourcePosition);
|
|
6111
|
+
}
|
|
6112
|
+
];
|
|
6113
|
+
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
6114
|
+
|
|
6115
|
+
|
|
5920
6116
|
/***/ }),
|
|
5921
6117
|
|
|
5922
6118
|
/***/ 3123:
|
|
@@ -7279,7 +7475,7 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
|
|
|
7279
7475
|
/* harmony default export */ var utils = ({
|
|
7280
7476
|
options: _objectSpread2({}, defaultOptions)
|
|
7281
7477
|
});
|
|
7282
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/vue-tel-input.vue?vue&type=template&id=
|
|
7478
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/vue-tel-input.vue?vue&type=template&id=2da290d5&
|
|
7283
7479
|
|
|
7284
7480
|
|
|
7285
7481
|
|
|
@@ -7365,6 +7561,9 @@ var render = function render() {
|
|
|
7365
7561
|
"click": function click($event) {
|
|
7366
7562
|
$event.stopPropagation();
|
|
7367
7563
|
},
|
|
7564
|
+
"keydown": function keydown($event) {
|
|
7565
|
+
$event.stopPropagation();
|
|
7566
|
+
},
|
|
7368
7567
|
"input": function input($event) {
|
|
7369
7568
|
if ($event.target.composing) return;
|
|
7370
7569
|
_vm.searchQuery = $event.target.value;
|
|
@@ -7535,7 +7734,7 @@ var render = function render() {
|
|
|
7535
7734
|
|
|
7536
7735
|
var staticRenderFns = [];
|
|
7537
7736
|
|
|
7538
|
-
;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=
|
|
7737
|
+
;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=2da290d5&
|
|
7539
7738
|
|
|
7540
7739
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
7541
7740
|
|
|
@@ -7567,6 +7766,8 @@ function _nonIterableSpread() {
|
|
|
7567
7766
|
function _toConsumableArray(arr) {
|
|
7568
7767
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
7569
7768
|
}
|
|
7769
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.replace.js
|
|
7770
|
+
var es_string_replace = __webpack_require__(5306);
|
|
7570
7771
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.trim.js
|
|
7571
7772
|
var es_string_trim = __webpack_require__(3210);
|
|
7572
7773
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
|
|
@@ -10678,6 +10879,7 @@ var _excluded = ["metadata"];
|
|
|
10678
10879
|
|
|
10679
10880
|
|
|
10680
10881
|
|
|
10882
|
+
|
|
10681
10883
|
|
|
10682
10884
|
|
|
10683
10885
|
function getDefault(key) {
|
|
@@ -10862,8 +11064,6 @@ function getDefault(key) {
|
|
|
10862
11064
|
return this.allCountries;
|
|
10863
11065
|
},
|
|
10864
11066
|
sortedCountries: function sortedCountries() {
|
|
10865
|
-
var _this2 = this;
|
|
10866
|
-
|
|
10867
11067
|
// Sort the list countries: from preferred countries to all countries
|
|
10868
11068
|
var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
|
|
10869
11069
|
return _objectSpread2(_objectSpread2({}, country), {}, {
|
|
@@ -10876,8 +11076,10 @@ function getDefault(key) {
|
|
|
10876
11076
|
return countriesList;
|
|
10877
11077
|
}
|
|
10878
11078
|
|
|
11079
|
+
var userInput = this.searchQuery;
|
|
11080
|
+
var cleanInput = userInput.replace(/[~`!@#$%^&*()+={}\[\];:\'\"<>.,\/\\\?-_]|^0{2,}/g, '');
|
|
10879
11081
|
return countriesList.filter(function (c) {
|
|
10880
|
-
return new RegExp(
|
|
11082
|
+
return new RegExp(cleanInput, 'i').test(c.name) || new RegExp(cleanInput, 'i').test(c.iso2) || new RegExp(cleanInput, 'i').test(c.dialCode);
|
|
10881
11083
|
});
|
|
10882
11084
|
},
|
|
10883
11085
|
phoneObject: function phoneObject() {
|
|
@@ -10954,7 +11156,7 @@ function getDefault(key) {
|
|
|
10954
11156
|
this.$emit('validate', this.phoneObject);
|
|
10955
11157
|
},
|
|
10956
11158
|
'phoneObject.formatted': function phoneObjectFormatted(value) {
|
|
10957
|
-
var
|
|
11159
|
+
var _this2 = this;
|
|
10958
11160
|
|
|
10959
11161
|
if (!this.autoFormat || this.customValidate) {
|
|
10960
11162
|
return;
|
|
@@ -10963,8 +11165,8 @@ function getDefault(key) {
|
|
|
10963
11165
|
this.emitInput(value);
|
|
10964
11166
|
this.$nextTick(function () {
|
|
10965
11167
|
// In case `v-model` is not set, we need to update the `phone` to be new formatted value
|
|
10966
|
-
if (value && !
|
|
10967
|
-
|
|
11168
|
+
if (value && !_this2.value) {
|
|
11169
|
+
_this2.phone = value;
|
|
10968
11170
|
}
|
|
10969
11171
|
});
|
|
10970
11172
|
},
|
|
@@ -10975,13 +11177,13 @@ function getDefault(key) {
|
|
|
10975
11177
|
this.resetPlaceholder();
|
|
10976
11178
|
},
|
|
10977
11179
|
value: function value(_value, oldValue) {
|
|
10978
|
-
var
|
|
11180
|
+
var _this3 = this;
|
|
10979
11181
|
|
|
10980
11182
|
if (!this.testCharacters()) {
|
|
10981
11183
|
this.$nextTick(function () {
|
|
10982
|
-
|
|
11184
|
+
_this3.phone = oldValue;
|
|
10983
11185
|
|
|
10984
|
-
|
|
11186
|
+
_this3.onInput();
|
|
10985
11187
|
});
|
|
10986
11188
|
} else {
|
|
10987
11189
|
this.phone = _value;
|
|
@@ -10998,7 +11200,7 @@ function getDefault(key) {
|
|
|
10998
11200
|
}
|
|
10999
11201
|
},
|
|
11000
11202
|
mounted: function mounted() {
|
|
11001
|
-
var
|
|
11203
|
+
var _this4 = this;
|
|
11002
11204
|
|
|
11003
11205
|
if (this.value) {
|
|
11004
11206
|
this.phone = this.value.trim();
|
|
@@ -11006,15 +11208,15 @@ function getDefault(key) {
|
|
|
11006
11208
|
|
|
11007
11209
|
this.cleanInvalidCharacters();
|
|
11008
11210
|
this.initializeCountry().then(function () {
|
|
11009
|
-
var
|
|
11211
|
+
var _this4$inputOptions;
|
|
11010
11212
|
|
|
11011
|
-
if (!
|
|
11012
|
-
|
|
11213
|
+
if (!_this4.phone && (_this4$inputOptions = _this4.inputOptions) !== null && _this4$inputOptions !== void 0 && _this4$inputOptions.showDialCode && _this4.activeCountryCode) {
|
|
11214
|
+
_this4.phone = "+".concat(_this4.activeCountryCode);
|
|
11013
11215
|
}
|
|
11014
11216
|
|
|
11015
|
-
|
|
11217
|
+
_this4.$emit('validate', _this4.phoneObject);
|
|
11016
11218
|
}).catch(console.error).then(function () {
|
|
11017
|
-
|
|
11219
|
+
_this4.finishMounted = true;
|
|
11018
11220
|
});
|
|
11019
11221
|
},
|
|
11020
11222
|
methods: {
|
|
@@ -11033,15 +11235,15 @@ function getDefault(key) {
|
|
|
11033
11235
|
// .catch(console.error);
|
|
11034
11236
|
},
|
|
11035
11237
|
initializeCountry: function initializeCountry() {
|
|
11036
|
-
var
|
|
11238
|
+
var _this5 = this;
|
|
11037
11239
|
|
|
11038
11240
|
return new Promise(function (resolve) {
|
|
11039
|
-
var
|
|
11241
|
+
var _this5$phone;
|
|
11040
11242
|
|
|
11041
11243
|
/**
|
|
11042
11244
|
* 1. If the phone included prefix (i.e. +12), try to get the country and set it
|
|
11043
11245
|
*/
|
|
11044
|
-
if (((
|
|
11246
|
+
if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
|
|
11045
11247
|
resolve();
|
|
11046
11248
|
return;
|
|
11047
11249
|
}
|
|
@@ -11050,19 +11252,19 @@ function getDefault(key) {
|
|
|
11050
11252
|
*/
|
|
11051
11253
|
|
|
11052
11254
|
|
|
11053
|
-
if (
|
|
11054
|
-
if (typeof
|
|
11055
|
-
|
|
11255
|
+
if (_this5.defaultCountry) {
|
|
11256
|
+
if (typeof _this5.defaultCountry === 'string') {
|
|
11257
|
+
_this5.choose(_this5.defaultCountry);
|
|
11056
11258
|
|
|
11057
11259
|
resolve();
|
|
11058
11260
|
return;
|
|
11059
11261
|
}
|
|
11060
11262
|
|
|
11061
|
-
if (typeof
|
|
11062
|
-
var country =
|
|
11263
|
+
if (typeof _this5.defaultCountry === 'number') {
|
|
11264
|
+
var country = _this5.findCountryByDialCode(_this5.defaultCountry);
|
|
11063
11265
|
|
|
11064
11266
|
if (country) {
|
|
11065
|
-
|
|
11267
|
+
_this5.choose(country.iso2);
|
|
11066
11268
|
|
|
11067
11269
|
resolve();
|
|
11068
11270
|
return;
|
|
@@ -11070,21 +11272,21 @@ function getDefault(key) {
|
|
|
11070
11272
|
}
|
|
11071
11273
|
}
|
|
11072
11274
|
|
|
11073
|
-
var fallbackCountry =
|
|
11275
|
+
var fallbackCountry = _this5.preferredCountries[0] || _this5.filteredCountries[0];
|
|
11074
11276
|
/**
|
|
11075
11277
|
* 3. Check if fetching country based on user's IP is allowed, set it as the default country
|
|
11076
11278
|
*/
|
|
11077
11279
|
|
|
11078
|
-
if (
|
|
11280
|
+
if (_this5.autoDefaultCountry) {
|
|
11079
11281
|
getCountry().then(function (res) {
|
|
11080
|
-
|
|
11282
|
+
_this5.choose(res || _this5.activeCountryCode);
|
|
11081
11283
|
}).catch(function (error) {
|
|
11082
11284
|
console.warn(error);
|
|
11083
11285
|
/**
|
|
11084
11286
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
11085
11287
|
*/
|
|
11086
11288
|
|
|
11087
|
-
|
|
11289
|
+
_this5.choose(fallbackCountry);
|
|
11088
11290
|
}).then(function () {
|
|
11089
11291
|
resolve();
|
|
11090
11292
|
});
|
|
@@ -11092,7 +11294,7 @@ function getDefault(key) {
|
|
|
11092
11294
|
/**
|
|
11093
11295
|
* 4. Use the first country from preferred list (if available) or all countries list
|
|
11094
11296
|
*/
|
|
11095
|
-
|
|
11297
|
+
_this5.choose(fallbackCountry);
|
|
11096
11298
|
|
|
11097
11299
|
resolve();
|
|
11098
11300
|
}
|
|
@@ -11103,11 +11305,11 @@ function getDefault(key) {
|
|
|
11103
11305
|
* Get the list of countries from the list of iso2 code
|
|
11104
11306
|
*/
|
|
11105
11307
|
getCountries: function getCountries() {
|
|
11106
|
-
var
|
|
11308
|
+
var _this6 = this;
|
|
11107
11309
|
|
|
11108
11310
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
11109
11311
|
return list.map(function (countryCode) {
|
|
11110
|
-
return
|
|
11312
|
+
return _this6.findCountry(countryCode);
|
|
11111
11313
|
}).filter(Boolean);
|
|
11112
11314
|
},
|
|
11113
11315
|
findCountry: function findCountry() {
|
|
@@ -11240,7 +11442,7 @@ function getDefault(key) {
|
|
|
11240
11442
|
this.open = false;
|
|
11241
11443
|
},
|
|
11242
11444
|
keyboardNav: function keyboardNav(e) {
|
|
11243
|
-
var
|
|
11445
|
+
var _this7 = this;
|
|
11244
11446
|
|
|
11245
11447
|
if (e.keyCode === 40) {
|
|
11246
11448
|
// down arrow
|
|
@@ -11289,11 +11491,11 @@ function getDefault(key) {
|
|
|
11289
11491
|
this.typeToFindInput += e.key;
|
|
11290
11492
|
clearTimeout(this.typeToFindTimer);
|
|
11291
11493
|
this.typeToFindTimer = setTimeout(function () {
|
|
11292
|
-
|
|
11494
|
+
_this7.typeToFindInput = '';
|
|
11293
11495
|
}, 700); // don't include preferred countries so we jump to the right place in the alphabet
|
|
11294
11496
|
|
|
11295
11497
|
var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
|
|
11296
|
-
return c.name.toLowerCase().startsWith(
|
|
11498
|
+
return c.name.toLowerCase().startsWith(_this7.typeToFindInput);
|
|
11297
11499
|
});
|
|
11298
11500
|
|
|
11299
11501
|
if (typedCountryI >= 0) {
|