ソースを参照

refactor some setvalidposition to also handle deletes

Robin Herbots 7 年 前
コミット
6bb908d929
49 ファイル変更327 行追加286 行削除
  1. 1 1
      bower.json
  2. 1 1
      component.json
  3. 1 1
      composer.json
  4. 1 1
      dist/inputmask/bindings/inputmask.binding.js
  5. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js
  6. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js
  7. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.js
  8. 1 1
      dist/inputmask/global/document.js
  9. 1 1
      dist/inputmask/global/window.js
  10. 1 1
      dist/inputmask/inputmask.date.extensions.js
  11. 4 5
      dist/inputmask/inputmask.extensions.js
  12. 71 55
      dist/inputmask/inputmask.js
  13. 2 3
      dist/inputmask/inputmask.numeric.extensions.js
  14. 1 1
      dist/inputmask/inputmask.phone.extensions.js
  15. 1 1
      dist/inputmask/jquery.inputmask.js
  16. 1 1
      dist/inputmask/phone-codes/phone-be.js
  17. 1 1
      dist/inputmask/phone-codes/phone-ca.js
  18. 1 1
      dist/inputmask/phone-codes/phone-hu.js
  19. 1 1
      dist/inputmask/phone-codes/phone-mx.js
  20. 1 1
      dist/inputmask/phone-codes/phone-nl.js
  21. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  22. 1 1
      dist/inputmask/phone-codes/phone-uk.js
  23. 1 1
      dist/inputmask/phone-codes/phone.js
  24. 75 61
      dist/jquery.inputmask.bundle.js
  25. 1 1
      dist/min/inputmask/bindings/inputmask.binding.min.js
  26. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js
  27. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js
  28. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js
  29. 1 1
      dist/min/inputmask/global/document.min.js
  30. 1 1
      dist/min/inputmask/global/window.min.js
  31. 1 1
      dist/min/inputmask/inputmask.date.extensions.min.js
  32. 2 2
      dist/min/inputmask/inputmask.extensions.min.js
  33. 2 2
      dist/min/inputmask/inputmask.min.js
  34. 2 2
      dist/min/inputmask/inputmask.numeric.extensions.min.js
  35. 1 1
      dist/min/inputmask/inputmask.phone.extensions.min.js
  36. 1 1
      dist/min/inputmask/jquery.inputmask.min.js
  37. 1 1
      dist/min/inputmask/phone-codes/phone-be.min.js
  38. 1 1
      dist/min/inputmask/phone-codes/phone-ca.min.js
  39. 1 1
      dist/min/inputmask/phone-codes/phone-hu.min.js
  40. 1 1
      dist/min/inputmask/phone-codes/phone-mx.min.js
  41. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  42. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  43. 1 1
      dist/min/inputmask/phone-codes/phone-uk.min.js
  44. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  45. 2 2
      dist/min/jquery.inputmask.bundle.min.js
  46. 96 97
      js/inputmask.extensions.js
  47. 30 16
      js/inputmask.js
  48. 3 3
      js/inputmask.numeric.extensions.js
  49. 1 1
      package.json

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.0-beta.24",
+  "version": "4.0.0-beta.25",
   "main": [
 	  "./dist/inputmask/inputmask.js",
 	  "./dist/inputmask/inputmask.extensions.js",

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
 	"name": "inputmask",
 	"repository": "robinherbots/Inputmask",
 	"description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-	"version": "4.0.0-beta.24",
+	"version": "4.0.0-beta.25",
 	"keywords": [
 		"jquery",
 		"plugins",

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/inputmask",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-  "version": "4.0.0-beta.24",
+  "version": "4.0.0-beta.25",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 1 - 1
dist/inputmask/bindings/inputmask.binding.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/global/document.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/global/window.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 4 - 5
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {
@@ -53,17 +53,16 @@
         email: {
             mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
             greedy: !1,
+            casing: "lower",
             onBeforePaste: function(pastedValue, opts) {
                 return (pastedValue = pastedValue.toLowerCase()).replace("mailto:", "");
             },
             definitions: {
                 "*": {
-                    validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
-                    casing: "lower"
+                    validator: "[0-91-9A-Za-zА-яЁёÀ-ÿµ!#$%&'*+/=?^_`{|}~-]"
                 },
                 "-": {
-                    validator: "[0-9A-Za-z-]",
-                    casing: "lower"
+                    validator: "[0-9A-Za-z-]"
                 }
             },
             onUnMask: function(maskedValue, unmaskedValue, opts) {

+ 71 - 55
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {
@@ -107,7 +107,7 @@
             }
             return -1 === before || before == closestTo ? after : -1 == after ? before : closestTo - before < after - closestTo ? before : after;
         }
-        function stripValidPositions(start, end, nocheck, strict) {
+        function stripValidPositions(pos, nocheck, strict) {
             function IsEnclosedStatic(pos) {
                 var posMatch = getMaskSet().validPositions[pos];
                 if (posMatch !== undefined && null === posMatch.match.fn) {
@@ -116,8 +116,8 @@
                 }
                 return !1;
             }
-            var i, startPos = start, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), needsValidation = !1;
-            for (getMaskSet().p = start, i = end - 1; i >= startPos; i--) getMaskSet().validPositions[i] !== undefined && (!0 !== nocheck && (!getMaskSet().validPositions[i].match.optionality && IsEnclosedStatic(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, !0), strict, opts)) || delete getMaskSet().validPositions[i]);
+            var i, startPos = pos.begin, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), needsValidation = !1;
+            for (getMaskSet().p = pos.begin, i = pos.end - 1; i >= startPos; i--) getMaskSet().validPositions[i] !== undefined && (!0 !== nocheck && (!getMaskSet().validPositions[i].match.optionality && IsEnclosedStatic(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, !0), strict, opts)) || delete getMaskSet().validPositions[i]);
             for (resetMaskSet(!0), i = startPos + 1; i <= getLastValidPosition(); ) {
                 for (;getMaskSet().validPositions[startPos] !== undefined; ) startPos++;
                 if (i < startPos && (i = startPos + 1), getMaskSet().validPositions[i] === undefined && isMask(i)) i++; else {
@@ -407,7 +407,10 @@
                         $.each(rslt.remove.sort(function(a, b) {
                             return b - a;
                         }), function(ndx, lmnt) {
-                            stripValidPositions(lmnt, lmnt + 1, !0);
+                            stripValidPositions({
+                                begin: lmnt,
+                                end: lmnt + 1
+                            }, !0);
                         })), rslt.insert !== undefined && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), 
                         $.each(rslt.insert.sort(function(a, b) {
                             return a - b;
@@ -424,7 +427,7 @@
                         refreshFromBuffer(position, validatedPos, getBuffer().slice()), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
                         !1;
                         return (!0 === rslt || rslt.pos !== undefined || rslt.c !== undefined) && (ndx > 0 && resetMaskSet(!0), 
-                        setValidPosition(validatedPos, $.extend({}, tst, {
+                        revalidateMask(validatedPos, $.extend({}, tst, {
                             input: function(elem, test, pos) {
                                 switch (opts.casing || test.casing) {
                                   case "upper":
@@ -452,58 +455,11 @@
                     }
                 }), rslt;
             }
-            function trackbackPositions(originalPos, newPos, fillOnly) {
-                var result;
-                if (originalPos === undefined) for (originalPos = newPos - 1; originalPos > 0 && !getMaskSet().validPositions[originalPos]; originalPos--) ;
-                for (var ps = originalPos; ps < newPos; ps++) if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, !0)) {
-                    var vp = 0 == ps ? getTest(ps) : getMaskSet().validPositions[ps - 1];
-                    if (vp) {
-                        var tstLocator, targetLocator = getLocator(vp), tests = getTests(ps).slice(), closest = undefined, bestMatch = getTest(ps);
-                        if ("" === tests[tests.length - 1].match.def && tests.pop(), $.each(tests, function(ndx, tst) {
-                            tstLocator = getLocator(tst, targetLocator.length);
-                            var distance = Math.abs(tstLocator - targetLocator);
-                            (closest === undefined || distance < closest) && null === tst.match.fn && !0 !== tst.match.optionality && !0 !== tst.match.optionalQuantifier && (closest = distance, 
-                            bestMatch = tst);
-                        }), (bestMatch = $.extend({}, bestMatch, {
-                            input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
-                        })).generatedInput = !0, setValidPosition(ps, bestMatch, !0), !0 !== fillOnly) {
-                            var cvpInput = getMaskSet().validPositions[newPos].input;
-                            getMaskSet().validPositions[newPos] = undefined, result = isValid(newPos, cvpInput, !0, !0);
-                        }
-                    }
-                }
-                return result;
-            }
-            function setValidPosition(pos, validTest, fromSetValid, isSelection) {
-                if (isSelection || opts.insertMode && getMaskSet().validPositions[pos] !== undefined && fromSetValid === undefined) {
-                    var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, !0);
-                    for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
-                    getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-                    var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1;
-                    for (i = j = pos; i <= lvp; i++) {
-                        var t = positionsClone[i];
-                        if (t !== undefined) for (var posMatch = j; "" !== getTest(posMatch).match.def && (null === t.match.fn && vps[i] && (!0 === vps[i].match.optionalQuantifier || !0 === vps[i].match.optionality) || null != t.match.fn); ) {
-                            if (posMatch++, !1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 
-                            getMaskSet().validPositions[posMatch].input = t.input, trackbackPositions(undefined, posMatch, !0), 
-                            j = posMatch, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
-                                var result = isValid(posMatch, t.input, !0, !0);
-                                valid = !1 !== result, j = result.caret || result.insert ? getLastValidPosition() : posMatch, 
-                                needsValidation = !0;
-                            } else if (!(valid = !0 === t.generatedInput) && "" === getTest(posMatch).match.def) break;
-                            if (valid) break;
-                        }
-                        if (!valid) break;
-                    }
-                    if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
-                    resetMaskSet(!0), !1;
-                } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-                return resetMaskSet(!0), !0;
-            }
             pos.begin !== undefined && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin);
             var result = !0, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
             if ($.isFunction(opts.preValidation) && !strict && !0 !== fromSetValid && !0 !== validateOnly && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts, getMaskSet())), 
             !0 === result) {
-                if (trackbackPositions(undefined, maskPos, !0), isSelection(pos) && (handleRemove(undefined, Inputmask.keyCode.DELETE, pos, !0, !0), 
+                if (trackbackPositions(undefined, maskPos, !0), isSelection(pos) && (revalidateMask(pos), 
                 maskPos = getMaskSet().p), (maxLength === undefined || maskPos < maxLength) && (result = _isValid(maskPos, c, strict), 
                 (!strict || !0 === fromSetValid) && !1 === result && !0 !== validateOnly)) {
                     var currentPosValid = getMaskSet().validPositions[maskPos];
@@ -535,6 +491,66 @@
             return result && result.pos === undefined && (result.pos = maskPos), !1 !== result && !0 !== validateOnly || (resetMaskSet(!0), 
             getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result;
         }
+        function trackbackPositions(originalPos, newPos, fillOnly) {
+            var result;
+            if (originalPos === undefined) for (originalPos = newPos - 1; originalPos > 0 && !getMaskSet().validPositions[originalPos]; originalPos--) ;
+            for (var ps = originalPos; ps < newPos; ps++) if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, !0)) {
+                var vp = 0 == ps ? getTest(ps) : getMaskSet().validPositions[ps - 1];
+                if (vp) {
+                    var tstLocator, targetLocator = getLocator(vp), tests = getTests(ps).slice(), closest = undefined, bestMatch = getTest(ps);
+                    if ("" === tests[tests.length - 1].match.def && tests.pop(), $.each(tests, function(ndx, tst) {
+                        tstLocator = getLocator(tst, targetLocator.length);
+                        var distance = Math.abs(tstLocator - targetLocator);
+                        (closest === undefined || distance < closest) && null === tst.match.fn && !0 !== tst.match.optionality && !0 !== tst.match.optionalQuantifier && (closest = distance, 
+                        bestMatch = tst);
+                    }), (bestMatch = $.extend({}, bestMatch, {
+                        input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
+                    })).generatedInput = !0, revalidateMask(ps, bestMatch, !0), !0 !== fillOnly) {
+                        var cvpInput = getMaskSet().validPositions[newPos].input;
+                        getMaskSet().validPositions[newPos] = undefined, result = isValid(newPos, cvpInput, !0, !0);
+                    }
+                }
+            }
+            return result;
+        }
+        function revalidateMask(pos, validTest, fromSetValid, isSelection) {
+            function IsEnclosedStatic(pos) {
+                var posMatch = getMaskSet().validPositions[pos];
+                if (posMatch !== undefined && null === posMatch.match.fn) {
+                    var prevMatch = getMaskSet().validPositions[pos - 1], nextMatch = getMaskSet().validPositions[pos + 1];
+                    return prevMatch !== undefined && nextMatch !== undefined;
+                }
+                return !1;
+            }
+            var begin = pos.begin !== undefined ? pos.begin : pos, end = pos.end !== undefined ? pos.end : pos;
+            if (isRTL && pos.begin !== pos.end && (begin = pos.end, end = pos.begin), isSelection || begin !== end || opts.insertMode && getMaskSet().validPositions[begin] !== undefined && fromSetValid === undefined) {
+                var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, !0);
+                for (getMaskSet().p = begin, i = lvp; i >= begin; i--) getMaskSet().validPositions[i] !== undefined && (!getMaskSet().validPositions[i].match.optionality && IsEnclosedStatic(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, !0), !1, opts) || delete getMaskSet().validPositions[i]);
+                var valid = !0, offset = end - begin, j = begin, vps = getMaskSet().validPositions, needsValidation = !1, posMatch = j;
+                for (validTest && (getMaskSet().validPositions[j] = $.extend(!0, {}, validTest), 
+                posMatch++), i = j; i <= lvp; i++) {
+                    var t = positionsClone[i + offset];
+                    if (t !== undefined) {
+                        for (;"" !== getTest(posMatch).match.def && (null === t.match.fn && vps[i] && (!0 === vps[i].match.optionalQuantifier || !0 === vps[i].match.optionality) || null != t.match.fn); ) {
+                            if (!1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 
+                            getMaskSet().validPositions[posMatch].input = t.input, trackbackPositions(undefined, posMatch, !0), 
+                            j = posMatch + 1, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
+                                var result = isValid(posMatch, t.input, !0, !0);
+                                valid = !1 !== result, j = result.caret || result.insert ? getLastValidPosition() : posMatch + 1, 
+                                needsValidation = !0;
+                            } else if (!(valid = !0 === t.generatedInput) && "" === getTest(posMatch).match.def) break;
+                            if (valid) break;
+                            posMatch++;
+                        }
+                        "" == getTest(posMatch).match.def && (valid = !1), posMatch = j;
+                    }
+                    if (!valid) break;
+                }
+                if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
+                resetMaskSet(!0), !1;
+            } else getMaskSet().validPositions[begin] = $.extend(!0, {}, validTest);
+            return resetMaskSet(!0), !0;
+        }
         function isMask(pos, strict) {
             var test = getTestTemplate(pos).match;
             if ("" === test.def && (test = getTest(pos).match), null != test.fn) return test.fn;
@@ -982,7 +998,7 @@
             getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.begin--, 
             !1 === opts.insertMode && pos.end !== getMaskSet().maskLength && pos.end--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1, 
             getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++), 
-            stripValidPositions(pos.begin, pos.end, !1, strict), !0 !== strict && null !== opts.keepStatic && !1 !== opts.keepStatic) {
+            stripValidPositions(pos, !1, strict), !0 !== strict && null !== opts.keepStatic && !1 !== opts.keepStatic) {
                 var result = alternate(!0);
                 result && (pos.begin = result.caret !== undefined ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, !0));
             }

+ 2 - 3
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {
@@ -287,8 +287,7 @@
             },
             canClearPosition: function(maskset, position, lvp, strict, opts) {
                 var vp = maskset.validPositions[position], canClear = vp.input !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && !1 === opts.decimalProtect || vp.input === opts.radixPoint && maskset.validPositions[position + 1] && null === maskset.validPositions[position + 1].match.fn || isFinite(vp.input) || position === lvp || vp.input === opts.groupSeparator || vp.input === opts.negationSymbol.front || vp.input === opts.negationSymbol.back;
-                return !canClear || "+" !== vp.match.nativeDef && "-" !== vp.match.nativeDef || (opts.isNegative = !1), 
-                canClear;
+                return canClear && "+" === vp.match.nativeDef && (opts.isNegative = !1), canClear;
             },
             onKeyDown: function(e, buffer, caretPos, opts) {
                 var $input = $(this);

+ 1 - 1
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-be.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ca.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-hu.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-mx.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-nl.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ru.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-uk.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(factory) {

+ 75 - 61
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(modules) {
@@ -147,7 +147,7 @@
                 }
                 return -1 === before || before == closestTo ? after : -1 == after ? before : closestTo - before < after - closestTo ? before : after;
             }
-            function stripValidPositions(start, end, nocheck, strict) {
+            function stripValidPositions(pos, nocheck, strict) {
                 function IsEnclosedStatic(pos) {
                     var posMatch = getMaskSet().validPositions[pos];
                     if (posMatch !== undefined && null === posMatch.match.fn) {
@@ -156,8 +156,8 @@
                     }
                     return !1;
                 }
-                var i, startPos = start, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), needsValidation = !1;
-                for (getMaskSet().p = start, i = end - 1; i >= startPos; i--) getMaskSet().validPositions[i] !== undefined && (!0 !== nocheck && (!getMaskSet().validPositions[i].match.optionality && IsEnclosedStatic(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, !0), strict, opts)) || delete getMaskSet().validPositions[i]);
+                var i, startPos = pos.begin, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), needsValidation = !1;
+                for (getMaskSet().p = pos.begin, i = pos.end - 1; i >= startPos; i--) getMaskSet().validPositions[i] !== undefined && (!0 !== nocheck && (!getMaskSet().validPositions[i].match.optionality && IsEnclosedStatic(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, !0), strict, opts)) || delete getMaskSet().validPositions[i]);
                 for (resetMaskSet(!0), i = startPos + 1; i <= getLastValidPosition(); ) {
                     for (;getMaskSet().validPositions[startPos] !== undefined; ) startPos++;
                     if (i < startPos && (i = startPos + 1), getMaskSet().validPositions[i] === undefined && isMask(i)) i++; else {
@@ -447,7 +447,10 @@
                             $.each(rslt.remove.sort(function(a, b) {
                                 return b - a;
                             }), function(ndx, lmnt) {
-                                stripValidPositions(lmnt, lmnt + 1, !0);
+                                stripValidPositions({
+                                    begin: lmnt,
+                                    end: lmnt + 1
+                                }, !0);
                             })), rslt.insert !== undefined && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), 
                             $.each(rslt.insert.sort(function(a, b) {
                                 return a - b;
@@ -464,7 +467,7 @@
                             refreshFromBuffer(position, validatedPos, getBuffer().slice()), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), 
                             !1;
                             return (!0 === rslt || rslt.pos !== undefined || rslt.c !== undefined) && (ndx > 0 && resetMaskSet(!0), 
-                            setValidPosition(validatedPos, $.extend({}, tst, {
+                            revalidateMask(validatedPos, $.extend({}, tst, {
                                 input: function(elem, test, pos) {
                                     switch (opts.casing || test.casing) {
                                       case "upper":
@@ -492,58 +495,11 @@
                         }
                     }), rslt;
                 }
-                function trackbackPositions(originalPos, newPos, fillOnly) {
-                    var result;
-                    if (originalPos === undefined) for (originalPos = newPos - 1; originalPos > 0 && !getMaskSet().validPositions[originalPos]; originalPos--) ;
-                    for (var ps = originalPos; ps < newPos; ps++) if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, !0)) {
-                        var vp = 0 == ps ? getTest(ps) : getMaskSet().validPositions[ps - 1];
-                        if (vp) {
-                            var tstLocator, targetLocator = getLocator(vp), tests = getTests(ps).slice(), closest = undefined, bestMatch = getTest(ps);
-                            if ("" === tests[tests.length - 1].match.def && tests.pop(), $.each(tests, function(ndx, tst) {
-                                tstLocator = getLocator(tst, targetLocator.length);
-                                var distance = Math.abs(tstLocator - targetLocator);
-                                (closest === undefined || distance < closest) && null === tst.match.fn && !0 !== tst.match.optionality && !0 !== tst.match.optionalQuantifier && (closest = distance, 
-                                bestMatch = tst);
-                            }), (bestMatch = $.extend({}, bestMatch, {
-                                input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
-                            })).generatedInput = !0, setValidPosition(ps, bestMatch, !0), !0 !== fillOnly) {
-                                var cvpInput = getMaskSet().validPositions[newPos].input;
-                                getMaskSet().validPositions[newPos] = undefined, result = isValid(newPos, cvpInput, !0, !0);
-                            }
-                        }
-                    }
-                    return result;
-                }
-                function setValidPosition(pos, validTest, fromSetValid, isSelection) {
-                    if (isSelection || opts.insertMode && getMaskSet().validPositions[pos] !== undefined && fromSetValid === undefined) {
-                        var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, !0);
-                        for (i = pos; i <= lvp; i++) delete getMaskSet().validPositions[i];
-                        getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-                        var j, valid = !0, vps = getMaskSet().validPositions, needsValidation = !1;
-                        for (i = j = pos; i <= lvp; i++) {
-                            var t = positionsClone[i];
-                            if (t !== undefined) for (var posMatch = j; "" !== getTest(posMatch).match.def && (null === t.match.fn && vps[i] && (!0 === vps[i].match.optionalQuantifier || !0 === vps[i].match.optionality) || null != t.match.fn); ) {
-                                if (posMatch++, !1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 
-                                getMaskSet().validPositions[posMatch].input = t.input, trackbackPositions(undefined, posMatch, !0), 
-                                j = posMatch, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
-                                    var result = isValid(posMatch, t.input, !0, !0);
-                                    valid = !1 !== result, j = result.caret || result.insert ? getLastValidPosition() : posMatch, 
-                                    needsValidation = !0;
-                                } else if (!(valid = !0 === t.generatedInput) && "" === getTest(posMatch).match.def) break;
-                                if (valid) break;
-                            }
-                            if (!valid) break;
-                        }
-                        if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
-                        resetMaskSet(!0), !1;
-                    } else getMaskSet().validPositions[pos] = $.extend(!0, {}, validTest);
-                    return resetMaskSet(!0), !0;
-                }
                 pos.begin !== undefined && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin);
                 var result = !0, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
                 if ($.isFunction(opts.preValidation) && !strict && !0 !== fromSetValid && !0 !== validateOnly && (result = opts.preValidation(getBuffer(), maskPos, c, isSelection(pos), opts, getMaskSet())), 
                 !0 === result) {
-                    if (trackbackPositions(undefined, maskPos, !0), isSelection(pos) && (handleRemove(undefined, Inputmask.keyCode.DELETE, pos, !0, !0), 
+                    if (trackbackPositions(undefined, maskPos, !0), isSelection(pos) && (revalidateMask(pos), 
                     maskPos = getMaskSet().p), (maxLength === undefined || maskPos < maxLength) && (result = _isValid(maskPos, c, strict), 
                     (!strict || !0 === fromSetValid) && !1 === result && !0 !== validateOnly)) {
                         var currentPosValid = getMaskSet().validPositions[maskPos];
@@ -575,6 +531,66 @@
                 return result && result.pos === undefined && (result.pos = maskPos), !1 !== result && !0 !== validateOnly || (resetMaskSet(!0), 
                 getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result;
             }
+            function trackbackPositions(originalPos, newPos, fillOnly) {
+                var result;
+                if (originalPos === undefined) for (originalPos = newPos - 1; originalPos > 0 && !getMaskSet().validPositions[originalPos]; originalPos--) ;
+                for (var ps = originalPos; ps < newPos; ps++) if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, !0)) {
+                    var vp = 0 == ps ? getTest(ps) : getMaskSet().validPositions[ps - 1];
+                    if (vp) {
+                        var tstLocator, targetLocator = getLocator(vp), tests = getTests(ps).slice(), closest = undefined, bestMatch = getTest(ps);
+                        if ("" === tests[tests.length - 1].match.def && tests.pop(), $.each(tests, function(ndx, tst) {
+                            tstLocator = getLocator(tst, targetLocator.length);
+                            var distance = Math.abs(tstLocator - targetLocator);
+                            (closest === undefined || distance < closest) && null === tst.match.fn && !0 !== tst.match.optionality && !0 !== tst.match.optionalQuantifier && (closest = distance, 
+                            bestMatch = tst);
+                        }), (bestMatch = $.extend({}, bestMatch, {
+                            input: getPlaceholder(ps, bestMatch.match, !0) || bestMatch.match.def
+                        })).generatedInput = !0, revalidateMask(ps, bestMatch, !0), !0 !== fillOnly) {
+                            var cvpInput = getMaskSet().validPositions[newPos].input;
+                            getMaskSet().validPositions[newPos] = undefined, result = isValid(newPos, cvpInput, !0, !0);
+                        }
+                    }
+                }
+                return result;
+            }
+            function revalidateMask(pos, validTest, fromSetValid, isSelection) {
+                function IsEnclosedStatic(pos) {
+                    var posMatch = getMaskSet().validPositions[pos];
+                    if (posMatch !== undefined && null === posMatch.match.fn) {
+                        var prevMatch = getMaskSet().validPositions[pos - 1], nextMatch = getMaskSet().validPositions[pos + 1];
+                        return prevMatch !== undefined && nextMatch !== undefined;
+                    }
+                    return !1;
+                }
+                var begin = pos.begin !== undefined ? pos.begin : pos, end = pos.end !== undefined ? pos.end : pos;
+                if (isRTL && pos.begin !== pos.end && (begin = pos.end, end = pos.begin), isSelection || begin !== end || opts.insertMode && getMaskSet().validPositions[begin] !== undefined && fromSetValid === undefined) {
+                    var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(undefined, !0);
+                    for (getMaskSet().p = begin, i = lvp; i >= begin; i--) getMaskSet().validPositions[i] !== undefined && (!getMaskSet().validPositions[i].match.optionality && IsEnclosedStatic(i) || !1 === opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, !0), !1, opts) || delete getMaskSet().validPositions[i]);
+                    var valid = !0, offset = end - begin, j = begin, vps = getMaskSet().validPositions, needsValidation = !1, posMatch = j;
+                    for (validTest && (getMaskSet().validPositions[j] = $.extend(!0, {}, validTest), 
+                    posMatch++), i = j; i <= lvp; i++) {
+                        var t = positionsClone[i + offset];
+                        if (t !== undefined) {
+                            for (;"" !== getTest(posMatch).match.def && (null === t.match.fn && vps[i] && (!0 === vps[i].match.optionalQuantifier || !0 === vps[i].match.optionality) || null != t.match.fn); ) {
+                                if (!1 === needsValidation && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) getMaskSet().validPositions[posMatch] = $.extend(!0, {}, positionsClone[posMatch]), 
+                                getMaskSet().validPositions[posMatch].input = t.input, trackbackPositions(undefined, posMatch, !0), 
+                                j = posMatch + 1, valid = !0; else if (positionCanMatchDefinition(posMatch, t.match.def)) {
+                                    var result = isValid(posMatch, t.input, !0, !0);
+                                    valid = !1 !== result, j = result.caret || result.insert ? getLastValidPosition() : posMatch + 1, 
+                                    needsValidation = !0;
+                                } else if (!(valid = !0 === t.generatedInput) && "" === getTest(posMatch).match.def) break;
+                                if (valid) break;
+                                posMatch++;
+                            }
+                            "" == getTest(posMatch).match.def && (valid = !1), posMatch = j;
+                        }
+                        if (!valid) break;
+                    }
+                    if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), 
+                    resetMaskSet(!0), !1;
+                } else getMaskSet().validPositions[begin] = $.extend(!0, {}, validTest);
+                return resetMaskSet(!0), !0;
+            }
             function isMask(pos, strict) {
                 var test = getTestTemplate(pos).match;
                 if ("" === test.def && (test = getTest(pos).match), null != test.fn) return test.fn;
@@ -1022,7 +1038,7 @@
                 getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.begin--, 
                 !1 === opts.insertMode && pos.end !== getMaskSet().maskLength && pos.end--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end, !0) && getMaskSet().validPositions[pos.end] && getMaskSet().validPositions[pos.end].input !== opts.radixPoint ? pos.end + 1 : seekNext(pos.end) + 1, 
                 getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++), 
-                stripValidPositions(pos.begin, pos.end, !1, strict), !0 !== strict && null !== opts.keepStatic && !1 !== opts.keepStatic) {
+                stripValidPositions(pos, !1, strict), !0 !== strict && null !== opts.keepStatic && !1 !== opts.keepStatic) {
                     var result = alternate(!0);
                     result && (pos.begin = result.caret !== undefined ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, !0));
                 }
@@ -1858,17 +1874,16 @@
             email: {
                 mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
                 greedy: !1,
+                casing: "lower",
                 onBeforePaste: function(pastedValue, opts) {
                     return (pastedValue = pastedValue.toLowerCase()).replace("mailto:", "");
                 },
                 definitions: {
                     "*": {
-                        validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
-                        casing: "lower"
+                        validator: "[0-91-9A-Za-zА-яЁёÀ-ÿµ!#$%&'*+/=?^_`{|}~-]"
                     },
                     "-": {
-                        validator: "[0-9A-Za-z-]",
-                        casing: "lower"
+                        validator: "[0-9A-Za-z-]"
                     }
                 },
                 onUnMask: function(maskedValue, unmaskedValue, opts) {
@@ -2176,8 +2191,7 @@
                 },
                 canClearPosition: function(maskset, position, lvp, strict, opts) {
                     var vp = maskset.validPositions[position], canClear = vp.input !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && !1 === opts.decimalProtect || vp.input === opts.radixPoint && maskset.validPositions[position + 1] && null === maskset.validPositions[position + 1].match.fn || isFinite(vp.input) || position === lvp || vp.input === opts.groupSeparator || vp.input === opts.negationSymbol.front || vp.input === opts.negationSymbol.back;
-                    return !canClear || "+" !== vp.match.nativeDef && "-" !== vp.match.nativeDef || (opts.isNegative = !1), 
-                    canClear;
+                    return canClear && "+" === vp.match.nativeDef && (opts.isNegative = !1), canClear;
                 },
                 onKeyDown: function(e, buffer, caretPos, opts) {
                     var $input = $(this);

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/bindings/inputmask.binding.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js


+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):window.dependencyLib=e(jQuery)}(function(e){return e});

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js


+ 1 - 1
dist/min/inputmask/global/document.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 "function"==typeof define&&define.amd?define(function(){return document}):"object"==typeof exports&&(module.exports=document);

+ 1 - 1
dist/min/inputmask/global/window.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.24
+* Version: 4.0.0-beta.25
 */
 
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js


ファイルの差分が大きいため隠しています
+ 2 - 2
dist/min/inputmask/inputmask.extensions.min.js


ファイルの差分が大きいため隠しています
+ 2 - 2
dist/min/inputmask/inputmask.min.js


ファイルの差分が大きいため隠しています
+ 2 - 2
dist/min/inputmask/inputmask.numeric.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/inputmask.phone.extensions.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-be.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ca.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-hu.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-mx.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-nl.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ru.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone-uk.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/inputmask/phone-codes/phone.min.js


ファイルの差分が大きいため隠しています
+ 2 - 2
dist/min/jquery.inputmask.bundle.min.js


+ 96 - 97
js/inputmask.extensions.js

@@ -8,103 +8,102 @@
  Optional extensions on the jquery.inputmask base
  */
 (function (factory) {
-	if (typeof define === "function" && define.amd) {
-		define(["./dependencyLibs/inputmask.dependencyLib", "./inputmask"], factory);
-	} else if (typeof exports === "object") {
-		module.exports = factory(require("./dependencyLibs/inputmask.dependencyLib"), require("./inputmask"));
-	} else {
-		factory(window.dependencyLib || jQuery, window.Inputmask);
-	}
+    if (typeof define === "function" && define.amd) {
+        define(["./dependencyLibs/inputmask.dependencyLib", "./inputmask"], factory);
+    } else if (typeof exports === "object") {
+        module.exports = factory(require("./dependencyLibs/inputmask.dependencyLib"), require("./inputmask"));
+    } else {
+        factory(window.dependencyLib || jQuery, window.Inputmask);
+    }
 }
 (function ($, Inputmask) {
-	//extra definitions
-	Inputmask.extendDefinitions({
-		"A": {
-			validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
-			casing: "upper" //auto uppercasing
-		},
-		"&": { //alfanumeric uppercasing
-			validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
-			casing: "upper"
-		},
-		"#": { //hexadecimal
-			validator: "[0-9A-Fa-f]",
-			casing: "upper"
-		}
-	});
-	Inputmask.extendAliases({
-		"url": {
-			definitions: {
-				"i": {
-					validator: ".",
-				}
-			},
-			mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
-			insertMode: false,
-			autoUnmask: false,
-			inputmode: "url",
-		},
-		"ip": { //ip-address mask
-			mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
-			definitions: {
-				"i": {
-					validator: function (chrs, maskset, pos, strict, opts) {
-						if (pos - 1 > -1 && maskset.buffer[pos - 1] !== ".") {
-							chrs = maskset.buffer[pos - 1] + chrs;
-							if (pos - 2 > -1 && maskset.buffer[pos - 2] !== ".") {
-								chrs = maskset.buffer[pos - 2] + chrs;
-							} else chrs = "0" + chrs;
-						} else chrs = "00" + chrs;
-						return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
-					}
-				}
-			},
-			onUnMask: function (maskedValue, unmaskedValue, opts) {
-				return maskedValue;
-			},
-			inputmode: "numeric",
-		},
-		"email": {
-			//https://en.wikipedia.org/wiki/Domain_name#Domain_name_space
-			//https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
-			//should be extended with the toplevel domains at the end
-			mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
-			greedy: false,
-			onBeforePaste: function (pastedValue, opts) {
-				pastedValue = pastedValue.toLowerCase();
-				return pastedValue.replace("mailto:", "");
-			},
-			definitions: {
-				"*": {
-					validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
-					casing: "lower"
-				},
-				"-": {
-					validator: "[0-9A-Za-z\-]",
-					casing: "lower"
-				}
-			},
-			onUnMask: function (maskedValue, unmaskedValue, opts) {
-				return maskedValue;
-			},
-			inputmode: "email",
-		},
-		"mac": {
-			mask: "##:##:##:##:##:##"
-		},
-		//https://en.wikipedia.org/wiki/Vehicle_identification_number
-		// see issue #1199
-		"vin": {
-			mask: "V{13}9{4}",
-			definitions: {
-				'V': {
-					validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
-					casing: "upper"
-				}
-			},
-			clearIncomplete: true,
-			autoUnmask: true
-		}
-	});
-	return Inputmask;
+    //extra definitions
+    Inputmask.extendDefinitions({
+        "A": {
+            validator: "[A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
+            casing: "upper" //auto uppercasing
+        },
+        "&": { //alfanumeric uppercasing
+            validator: "[0-9A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5]",
+            casing: "upper"
+        },
+        "#": { //hexadecimal
+            validator: "[0-9A-Fa-f]",
+            casing: "upper"
+        }
+    });
+    Inputmask.extendAliases({
+        "url": {
+            definitions: {
+                "i": {
+                    validator: ".",
+                }
+            },
+            mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",
+            insertMode: false,
+            autoUnmask: false,
+            inputmode: "url",
+        },
+        "ip": { //ip-address mask
+            mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
+            definitions: {
+                "i": {
+                    validator: function (chrs, maskset, pos, strict, opts) {
+                        if (pos - 1 > -1 && maskset.buffer[pos - 1] !== ".") {
+                            chrs = maskset.buffer[pos - 1] + chrs;
+                            if (pos - 2 > -1 && maskset.buffer[pos - 2] !== ".") {
+                                chrs = maskset.buffer[pos - 2] + chrs;
+                            } else chrs = "0" + chrs;
+                        } else chrs = "00" + chrs;
+                        return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
+                    }
+                }
+            },
+            onUnMask: function (maskedValue, unmaskedValue, opts) {
+                return maskedValue;
+            },
+            inputmode: "numeric",
+        },
+        "email": {
+            //https://en.wikipedia.org/wiki/Domain_name#Domain_name_space
+            //https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
+            //should be extended with the toplevel domains at the end
+            mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
+            greedy: false,
+            casing: "lower",
+            onBeforePaste: function (pastedValue, opts) {
+                pastedValue = pastedValue.toLowerCase();
+                return pastedValue.replace("mailto:", "");
+            },
+            definitions: {
+                "*": {
+                    validator: "[0-9\uFF11-\uFF19A-Za-z\u0410-\u044F\u0401\u0451\u00C0-\u00FF\u00B5!#$%&'*+/=?^_`{|}~\-]"
+                },
+                "-": {
+                    validator: "[0-9A-Za-z\-]"
+                }
+            },
+            onUnMask: function (maskedValue, unmaskedValue, opts) {
+                return maskedValue;
+            },
+            inputmode: "email"
+        },
+        "mac": {
+            mask: "##:##:##:##:##:##"
+        },
+        //https://en.wikipedia.org/wiki/Vehicle_identification_number
+        // see issue #1199
+        "vin": {
+            mask: "V{13}9{4}",
+            definitions: {
+                'V': {
+                    validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
+                    casing: "upper"
+                }
+            },
+            clearIncomplete: true,
+            autoUnmask: true
+        }
+    });
+    return Inputmask;
 }));

+ 30 - 16
js/inputmask.js

@@ -1648,7 +1648,7 @@
                     if (isSelection(pos)) {
                         // handleRemove(undefined, Inputmask.keyCode.DELETE, pos, true, true);
                         revalidateMask(pos);
-                        // maskPos = getMaskSet().p;
+                        maskPos = getMaskSet().p;
                     }
 
                     if (maxLength === undefined || maskPos < maxLength) {
@@ -1758,15 +1758,20 @@
                     return false;
                 }
 
-                if (pos.begin === undefined) pos = {begin: pos, end: pos};
-                if (isSelection || pos.begin !== pos.end || (opts.insertMode && getMaskSet().validPositions[pos.begin] !== undefined && fromSetValid === undefined)) {
+
+                var begin = pos.begin !== undefined ? pos.begin : pos, end = pos.end !== undefined ? pos.end : pos
+                if (isRTL && pos.begin !== pos.end) {
+                    begin = pos.end;
+                    end = pos.begin;
+                }
+                if (isSelection || begin !== end || (opts.insertMode && getMaskSet().validPositions[begin] !== undefined && fromSetValid === undefined)) {
                     //reposition & revalidate others
                     var positionsClone = $.extend(true, {}, getMaskSet().validPositions),
                         lvp = getLastValidPosition(undefined, true),
                         i;
-                    getMaskSet().p = pos.begin; //needed for alternated position after overtype selection
+                    getMaskSet().p = begin; //needed for alternated position after overtype selection
 
-                    for (i = lvp; i >= pos.begin; i--) { //clear selection
+                    for (i = lvp; i >= begin; i--) { //clear selection
                         if (getMaskSet().validPositions[i] !== undefined) {
                             if ((getMaskSet().validPositions[i].match.optionality || !IsEnclosedStatic(i)) && opts.canClearPosition(getMaskSet(), i, getLastValidPosition(undefined, true), false, opts) !== false) {
                                 delete getMaskSet().validPositions[i];
@@ -1774,33 +1779,41 @@
                         }
                     }
 
-                    if (validTest) getMaskSet().validPositions[pos.begin] = $.extend(true, {}, validTest); else pos.begin--;
-                    var valid = true, offset = pos.end - pos.begin,
-                        j, vps = getMaskSet().validPositions,
-                        needsValidation = false;
-                    for (i = (j = pos.begin); i <= lvp; i++) {
+
+                    var valid = true, offset = end - begin,
+                        j = begin, vps = getMaskSet().validPositions,
+                        needsValidation = false, posMatch = j;
+
+                    if (validTest) {
+                        getMaskSet().validPositions[j] = $.extend(true, {}, validTest);
+                        posMatch++;
+                    }
+                    for (i = j; i <= lvp; i++) {
                         var t = positionsClone[i + offset];
                         if (t !== undefined /*&& (t.generatedInput !== true || t.match.fn === null)*/) {
-                            var posMatch = j;
                             while (getTest(posMatch).match.def !== "" && ((t.match.fn === null && vps[i] && (vps[i].match.optionalQuantifier === true || vps[i].match.optionality === true)) || t.match.fn != null)) {
-                                posMatch++;
                                 if (needsValidation === false && positionsClone[posMatch] && positionsClone[posMatch].match.def === t.match.def) { //obvious match
                                     getMaskSet().validPositions[posMatch] = $.extend(true, {}, positionsClone[posMatch]);
                                     getMaskSet().validPositions[posMatch].input = t.input;
                                     trackbackPositions(undefined, posMatch, true);
-                                    j = posMatch;
+                                    j = posMatch + 1;
                                     valid = true;
                                 } else if (positionCanMatchDefinition(posMatch, t.match.def)) { //validated match
                                     var result = isValid(posMatch, t.input, true, true);
                                     valid = result !== false;
-                                    j = (result.caret || result.insert) ? getLastValidPosition() : posMatch;
+                                    j = (result.caret || result.insert) ? getLastValidPosition() : posMatch + 1;
                                     needsValidation = true;
                                 } else {
                                     valid = t.generatedInput === true;
                                     if (!valid && getTest(posMatch).match.def === "") break;
                                 }
                                 if (valid) break;
+                                posMatch++;
                             }
+                            if (getTest(posMatch).match.def == "")
+                                valid = false;
+                            //restore position
+                            posMatch = j;
                         }
                         if (!valid) break;
                     }
@@ -1810,8 +1823,9 @@
                         resetMaskSet(true);
                         return false;
                     }
-                } else {
-                    getMaskSet().validPositions[pos.begin] = $.extend(true, {}, validTest);
+                }
+                else {
+                    getMaskSet().validPositions[begin] = $.extend(true, {}, validTest);
                 }
 
 

+ 3 - 3
js/inputmask.numeric.extensions.js

@@ -424,7 +424,7 @@
                                     bufferTemplate = bufferTemplate.slice(1);
                                 }
                                 // if (processValue !== opts.radixPoint) {
-                                    processValue = processValue.replace(bufferTemplate, "");
+                                processValue = processValue.replace(bufferTemplate, "");
                                 // }
                                 processValue = processValue.split("");
 
@@ -516,7 +516,7 @@
             onBeforeMask: function (initialValue, opts) {
                 opts.isNegative = undefined;
 
-                if(typeof initialValue == "number" && opts.radixPoint !== "") {
+                if (typeof initialValue == "number" && opts.radixPoint !== "") {
                     initialValue = initialValue.toString().replace(".", opts.radixPoint);
                 }
 
@@ -583,7 +583,7 @@
                         vp.input === opts.negationSymbol.front ||
                         vp.input === opts.negationSymbol.back;
 
-                if (canClear && (vp.match.nativeDef === "+" || vp.match.nativeDef === "-")) {
+                if (canClear && vp.match.nativeDef === "+") {
                     opts.isNegative = false;
                 }
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.0-beta.24",
+  "version": "4.0.0-beta.25",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
   "main": "index.js",
   "files": [