maz-ui 2.3.12 → 2.3.13
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/lib/index.js +1 -1
- package/lib/maz-phone-number-input.js +29 -35
- package/lib/maz-ui.common.js +30 -36
- package/package.json +1 -1
|
@@ -2919,15 +2919,11 @@ var render = function () {
|
|
|
2919
2919
|
color: _vm.color,
|
|
2920
2920
|
},
|
|
2921
2921
|
on: {
|
|
2922
|
-
keydown:
|
|
2923
|
-
_vm.lastKeyPressed = e.keyCode
|
|
2924
|
-
},
|
|
2922
|
+
keydown: _vm.onKeydown,
|
|
2925
2923
|
focus: function ($event) {
|
|
2926
2924
|
return _vm.$emit("focus", $event)
|
|
2927
2925
|
},
|
|
2928
|
-
blur:
|
|
2929
|
-
return _vm.$emit("blur", $event)
|
|
2930
|
-
},
|
|
2926
|
+
blur: _vm.onBlur,
|
|
2931
2927
|
change: function ($event) {
|
|
2932
2928
|
return _vm.$emit("change", $event)
|
|
2933
2929
|
},
|
|
@@ -3042,9 +3038,8 @@ var utils_getResultsFromPhoneNumber = function getResultsFromPhoneNumber(phoneNu
|
|
|
3042
3038
|
var parsing = phoneNumber ? Object(external_libphonenumber_js_["parsePhoneNumberFromString"])(phoneNumber, countryCode) : null;
|
|
3043
3039
|
var results = {
|
|
3044
3040
|
countryCode: countryCode,
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3041
|
+
phoneNumber: phoneNumber,
|
|
3042
|
+
isValid: false
|
|
3048
3043
|
};
|
|
3049
3044
|
|
|
3050
3045
|
if (parsing) {
|
|
@@ -3417,7 +3412,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3417
3412
|
return {
|
|
3418
3413
|
results: {},
|
|
3419
3414
|
countryCode: this.defaultCountryCode,
|
|
3420
|
-
|
|
3415
|
+
cursorPosition: null,
|
|
3421
3416
|
asYouTypeNumber: this.defaultPhoneNumber
|
|
3422
3417
|
};
|
|
3423
3418
|
},
|
|
@@ -3604,34 +3599,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3604
3599
|
var _this6 = this;
|
|
3605
3600
|
|
|
3606
3601
|
return _mainvue_type_script_lang_js_asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
|
|
3607
|
-
var
|
|
3602
|
+
var countryCode, value, hasDeletedCharac, _this6$results, isValid, e164, cursorIsAtEnd, shouldUseAsYouType, valueToEmit;
|
|
3608
3603
|
|
|
3609
3604
|
return regenerator_default.a.wrap(function _callee2$(_context2) {
|
|
3610
3605
|
while (1) {
|
|
3611
3606
|
switch (_context2.prev = _context2.next) {
|
|
3612
3607
|
case 0:
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
_context2.next = 4;
|
|
3608
|
+
countryCode = _this6.countryCode, value = _this6.value;
|
|
3609
|
+
_context2.next = 3;
|
|
3616
3610
|
return _this6.$nextTick();
|
|
3617
3611
|
|
|
3618
|
-
case
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
_context2.next = 8;
|
|
3626
|
-
return utils_getResultsFromPhoneNumber(phoneNumber, countryCode);
|
|
3627
|
-
|
|
3628
|
-
case 8:
|
|
3629
|
-
_this6.results = _context2.sent;
|
|
3630
|
-
_context2.next = 11;
|
|
3631
|
-
return utils_getAsYouTypeFormat(phoneNumber, countryCode);
|
|
3632
|
-
|
|
3633
|
-
case 11:
|
|
3634
|
-
_this6.asYouTypeNumber = _context2.sent;
|
|
3612
|
+
case 3:
|
|
3613
|
+
hasDeletedCharac = _this6.asYouTypeNumber && phoneNumber && _this6.asYouTypeNumber.length > phoneNumber.length;
|
|
3614
|
+
_this6.results = utils_getResultsFromPhoneNumber(phoneNumber, countryCode);
|
|
3615
|
+
_this6$results = _this6.results, isValid = _this6$results.isValid, e164 = _this6$results.e164;
|
|
3616
|
+
cursorIsAtEnd = _this6.asYouTypeNumber && _this6.cursorPosition ? _this6.cursorPosition + 1 >= _this6.asYouTypeNumber.length : true;
|
|
3617
|
+
shouldUseAsYouType = !hasDeletedCharac && cursorIsAtEnd || isValid;
|
|
3618
|
+
_this6.asYouTypeNumber = shouldUseAsYouType ? utils_getAsYouTypeFormat(phoneNumber, countryCode) : phoneNumber;
|
|
3635
3619
|
|
|
3636
3620
|
if (!noAutoUpdateCountryCode && _this6.results && _this6.results.countryCode && countryCode !== _this6.results.countryCode) {
|
|
3637
3621
|
_this6.setCountryCode(_this6.results.countryCode);
|
|
@@ -3641,22 +3625,21 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3641
3625
|
|
|
3642
3626
|
_this6.$emit('update', _this6.results);
|
|
3643
3627
|
|
|
3644
|
-
_this6$results = _this6.results, isValid = _this6$results.isValid, e164 = _this6$results.e164;
|
|
3645
3628
|
valueToEmit = isValid ? e164 : _this6.asYouTypeNumber;
|
|
3646
3629
|
|
|
3647
3630
|
if (!(!valueToEmit && valueToEmit === value)) {
|
|
3648
|
-
_context2.next =
|
|
3631
|
+
_context2.next = 14;
|
|
3649
3632
|
break;
|
|
3650
3633
|
}
|
|
3651
3634
|
|
|
3652
3635
|
return _context2.abrupt("return");
|
|
3653
3636
|
|
|
3654
|
-
case
|
|
3637
|
+
case 14:
|
|
3655
3638
|
// sent when the user tape
|
|
3656
3639
|
// @arg Phone number value formatted in e164 format (international format)
|
|
3657
3640
|
_this6.$emit('input', valueToEmit);
|
|
3658
3641
|
|
|
3659
|
-
case
|
|
3642
|
+
case 15:
|
|
3660
3643
|
case "end":
|
|
3661
3644
|
return _context2.stop();
|
|
3662
3645
|
}
|
|
@@ -3664,6 +3647,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3664
3647
|
}, _callee2);
|
|
3665
3648
|
}))();
|
|
3666
3649
|
},
|
|
3650
|
+
onBlur: function onBlur(event) {
|
|
3651
|
+
this.$emit('blur', event);
|
|
3652
|
+
|
|
3653
|
+
if (this.countryCode) {
|
|
3654
|
+
this.asYouTypeNumber = utils_getAsYouTypeFormat(this.asYouTypeNumber, this.countryCode);
|
|
3655
|
+
}
|
|
3656
|
+
},
|
|
3657
|
+
onKeydown: function onKeydown(event) {
|
|
3658
|
+
var target = event.target;
|
|
3659
|
+
this.cursorPosition = target === null || target === void 0 ? void 0 : target.selectionStart;
|
|
3660
|
+
},
|
|
3667
3661
|
setCountryCode: function setCountryCode(locale, focusPhoneNumberInput) {
|
|
3668
3662
|
var _this7 = this;
|
|
3669
3663
|
|
package/lib/maz-ui.common.js
CHANGED
|
@@ -126,7 +126,7 @@ module.exports = require("vue-zoom-img");
|
|
|
126
126
|
/* 6 */
|
|
127
127
|
/***/ (function(module) {
|
|
128
128
|
|
|
129
|
-
module.exports = JSON.parse("{\"a\":\"2.3.
|
|
129
|
+
module.exports = JSON.parse("{\"a\":\"2.3.13\"}");
|
|
130
130
|
|
|
131
131
|
/***/ }),
|
|
132
132
|
/* 7 */
|
|
@@ -12315,15 +12315,11 @@ var _mainvue_type_template_id_0022c02d_render = function () {
|
|
|
12315
12315
|
color: _vm.color,
|
|
12316
12316
|
},
|
|
12317
12317
|
on: {
|
|
12318
|
-
keydown:
|
|
12319
|
-
_vm.lastKeyPressed = e.keyCode
|
|
12320
|
-
},
|
|
12318
|
+
keydown: _vm.onKeydown,
|
|
12321
12319
|
focus: function ($event) {
|
|
12322
12320
|
return _vm.$emit("focus", $event)
|
|
12323
12321
|
},
|
|
12324
|
-
blur:
|
|
12325
|
-
return _vm.$emit("blur", $event)
|
|
12326
|
-
},
|
|
12322
|
+
blur: _vm.onBlur,
|
|
12327
12323
|
change: function ($event) {
|
|
12328
12324
|
return _vm.$emit("change", $event)
|
|
12329
12325
|
},
|
|
@@ -12434,9 +12430,8 @@ var utils_getResultsFromPhoneNumber = function getResultsFromPhoneNumber(phoneNu
|
|
|
12434
12430
|
var parsing = phoneNumber ? Object(external_libphonenumber_js_["parsePhoneNumberFromString"])(phoneNumber, countryCode) : null;
|
|
12435
12431
|
var results = {
|
|
12436
12432
|
countryCode: countryCode,
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12433
|
+
phoneNumber: phoneNumber,
|
|
12434
|
+
isValid: false
|
|
12440
12435
|
};
|
|
12441
12436
|
|
|
12442
12437
|
if (parsing) {
|
|
@@ -13873,7 +13868,7 @@ function MazPhoneNumberInput_mainvue_type_script_lang_js_typeof(obj) { "@babel/h
|
|
|
13873
13868
|
return {
|
|
13874
13869
|
results: {},
|
|
13875
13870
|
countryCode: this.defaultCountryCode,
|
|
13876
|
-
|
|
13871
|
+
cursorPosition: null,
|
|
13877
13872
|
asYouTypeNumber: this.defaultPhoneNumber
|
|
13878
13873
|
};
|
|
13879
13874
|
},
|
|
@@ -14060,34 +14055,23 @@ function MazPhoneNumberInput_mainvue_type_script_lang_js_typeof(obj) { "@babel/h
|
|
|
14060
14055
|
var _this6 = this;
|
|
14061
14056
|
|
|
14062
14057
|
return MazPhoneNumberInput_mainvue_type_script_lang_js_asyncToGenerator( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
|
|
14063
|
-
var
|
|
14058
|
+
var countryCode, value, hasDeletedCharac, _this6$results, isValid, e164, cursorIsAtEnd, shouldUseAsYouType, valueToEmit;
|
|
14064
14059
|
|
|
14065
14060
|
return regenerator_default.a.wrap(function _callee2$(_context2) {
|
|
14066
14061
|
while (1) {
|
|
14067
14062
|
switch (_context2.prev = _context2.next) {
|
|
14068
14063
|
case 0:
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
_context2.next = 4;
|
|
14064
|
+
countryCode = _this6.countryCode, value = _this6.value;
|
|
14065
|
+
_context2.next = 3;
|
|
14072
14066
|
return _this6.$nextTick();
|
|
14073
14067
|
|
|
14074
|
-
case
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
_context2.next = 8;
|
|
14082
|
-
return utils_getResultsFromPhoneNumber(phoneNumber, countryCode);
|
|
14083
|
-
|
|
14084
|
-
case 8:
|
|
14085
|
-
_this6.results = _context2.sent;
|
|
14086
|
-
_context2.next = 11;
|
|
14087
|
-
return utils_getAsYouTypeFormat(phoneNumber, countryCode);
|
|
14088
|
-
|
|
14089
|
-
case 11:
|
|
14090
|
-
_this6.asYouTypeNumber = _context2.sent;
|
|
14068
|
+
case 3:
|
|
14069
|
+
hasDeletedCharac = _this6.asYouTypeNumber && phoneNumber && _this6.asYouTypeNumber.length > phoneNumber.length;
|
|
14070
|
+
_this6.results = utils_getResultsFromPhoneNumber(phoneNumber, countryCode);
|
|
14071
|
+
_this6$results = _this6.results, isValid = _this6$results.isValid, e164 = _this6$results.e164;
|
|
14072
|
+
cursorIsAtEnd = _this6.asYouTypeNumber && _this6.cursorPosition ? _this6.cursorPosition + 1 >= _this6.asYouTypeNumber.length : true;
|
|
14073
|
+
shouldUseAsYouType = !hasDeletedCharac && cursorIsAtEnd || isValid;
|
|
14074
|
+
_this6.asYouTypeNumber = shouldUseAsYouType ? utils_getAsYouTypeFormat(phoneNumber, countryCode) : phoneNumber;
|
|
14091
14075
|
|
|
14092
14076
|
if (!noAutoUpdateCountryCode && _this6.results && _this6.results.countryCode && countryCode !== _this6.results.countryCode) {
|
|
14093
14077
|
_this6.setCountryCode(_this6.results.countryCode);
|
|
@@ -14097,22 +14081,21 @@ function MazPhoneNumberInput_mainvue_type_script_lang_js_typeof(obj) { "@babel/h
|
|
|
14097
14081
|
|
|
14098
14082
|
_this6.$emit('update', _this6.results);
|
|
14099
14083
|
|
|
14100
|
-
_this6$results = _this6.results, isValid = _this6$results.isValid, e164 = _this6$results.e164;
|
|
14101
14084
|
valueToEmit = isValid ? e164 : _this6.asYouTypeNumber;
|
|
14102
14085
|
|
|
14103
14086
|
if (!(!valueToEmit && valueToEmit === value)) {
|
|
14104
|
-
_context2.next =
|
|
14087
|
+
_context2.next = 14;
|
|
14105
14088
|
break;
|
|
14106
14089
|
}
|
|
14107
14090
|
|
|
14108
14091
|
return _context2.abrupt("return");
|
|
14109
14092
|
|
|
14110
|
-
case
|
|
14093
|
+
case 14:
|
|
14111
14094
|
// sent when the user tape
|
|
14112
14095
|
// @arg Phone number value formatted in e164 format (international format)
|
|
14113
14096
|
_this6.$emit('input', valueToEmit);
|
|
14114
14097
|
|
|
14115
|
-
case
|
|
14098
|
+
case 15:
|
|
14116
14099
|
case "end":
|
|
14117
14100
|
return _context2.stop();
|
|
14118
14101
|
}
|
|
@@ -14120,6 +14103,17 @@ function MazPhoneNumberInput_mainvue_type_script_lang_js_typeof(obj) { "@babel/h
|
|
|
14120
14103
|
}, _callee2);
|
|
14121
14104
|
}))();
|
|
14122
14105
|
},
|
|
14106
|
+
onBlur: function onBlur(event) {
|
|
14107
|
+
this.$emit('blur', event);
|
|
14108
|
+
|
|
14109
|
+
if (this.countryCode) {
|
|
14110
|
+
this.asYouTypeNumber = utils_getAsYouTypeFormat(this.asYouTypeNumber, this.countryCode);
|
|
14111
|
+
}
|
|
14112
|
+
},
|
|
14113
|
+
onKeydown: function onKeydown(event) {
|
|
14114
|
+
var target = event.target;
|
|
14115
|
+
this.cursorPosition = target === null || target === void 0 ? void 0 : target.selectionStart;
|
|
14116
|
+
},
|
|
14123
14117
|
setCountryCode: function setCountryCode(locale, focusPhoneNumberInput) {
|
|
14124
14118
|
var _this7 = this;
|
|
14125
14119
|
|