Browse Source

init fix + alternation fix

Robin Herbots 7 years ago
parent
commit
6fa381eb30
51 changed files with 77 additions and 242 deletions
  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. 1 1
      dist/inputmask/inputmask.extensions.js
  12. 9 5
      dist/inputmask/inputmask.js
  13. 1 1
      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-it.js
  20. 1 1
      dist/inputmask/phone-codes/phone-mx.js
  21. 1 1
      dist/inputmask/phone-codes/phone-nl.js
  22. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  23. 1 1
      dist/inputmask/phone-codes/phone.js
  24. 9 5
      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. 1 1
      dist/min/inputmask/inputmask.extensions.min.js
  33. 2 2
      dist/min/inputmask/inputmask.min.js
  34. 1 1
      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-it.min.js
  41. 1 1
      dist/min/inputmask/phone-codes/phone-mx.min.js
  42. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  43. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  44. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  45. 2 2
      dist/min/jquery.inputmask.bundle.min.js
  46. 0 1
      index.js
  47. 11 5
      js/inputmask.js
  48. 1 1
      package.json
  49. 0 1
      qunit/index.js
  50. 2 2
      qunit/tests_paste.js
  51. 0 177
      temp.js

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.0-beta.39",
+  "version": "4.0.0-beta.42",
   "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.39",
+	"version": "4.0.0-beta.42",
 	"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.39",
+  "version": "4.0.0-beta.42",
   "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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 "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.39
+* Version: 4.0.0-beta.42
 */
 
 "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.39
+* Version: 4.0.0-beta.42
 */
 
 !function(factory) {

+ 1 - 1
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.39
+* Version: 4.0.0-beta.42
 */
 
 !function(factory) {

+ 9 - 5
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.39
+* Version: 4.0.0-beta.42
 */
 
 !function(factory) {
@@ -333,13 +333,13 @@
                 decisionPos = parseInt(lastAlt), getMaskSet().excludes[decisionPos] = getMaskSet().excludes[decisionPos] || [], 
                 !0 !== pos && getMaskSet().excludes[decisionPos].push(getDecisionTaker(prevAltPos));
                 var validInputsClone = [], staticInputsBeforePos = 0;
-                for (i = decisionPos; i < getLastValidPosition(undefined, !0) + 1; i++) (validPos = getMaskSet().validPositions[i]) && !0 !== validPos.generatedInput && /[0-9a-bA-Z]/.test(validPos.input) ? validInputsClone.push(validPos.input) : i < pos && staticInputsBeforePos++, 
+                for (i = decisionPos; i < getLastValidPosition(undefined, !0) + 1; i++) (validPos = getMaskSet().validPositions[i]) && !0 !== validPos.generatedInput ? validInputsClone.push(validPos.input) : i < pos && staticInputsBeforePos++, 
                 delete getMaskSet().validPositions[i];
                 for (;getMaskSet().excludes[decisionPos] && getMaskSet().excludes[decisionPos].length < 10; ) {
                     var posOffset = -1 * staticInputsBeforePos, validInputs = validInputsClone.slice();
                     for (getMaskSet().tests[decisionPos] = undefined, resetMaskSet(!0), isValidRslt = !0; validInputs.length > 0; ) {
                         var input = validInputs.shift();
-                        if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition(undefined, !0) + 1, input, !1, fromSetValid, !0))) break;
+                        if (!(isValidRslt = isValid(getLastValidPosition(undefined, !0) + 1, input, !1, fromSetValid, !0))) break;
                     }
                     if (isValidRslt && c !== undefined) {
                         var targetLvp = getLastValidPosition(pos) + 1;
@@ -971,7 +971,10 @@
             getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++), 
             revalidateMask(pos), !0 !== strict && !1 !== opts.keepStatic || null !== opts.regex) {
                 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));
+                if (result) {
+                    var newPos = result.caret !== undefined ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, !0);
+                    (k !== Inputmask.keyCode.DELETE || pos.begin > newPos) && pos.begin;
+                }
             }
             var lvp = getLastValidPosition(pos.begin, !0);
             if (lvp < pos.begin || -1 === pos.begin) getMaskSet().p = seekNext(lvp); else if (!0 !== strict && (getMaskSet().p = pos.begin, 
@@ -1161,7 +1164,8 @@
                     var buffer = getBuffer().slice();
                     undoValue = buffer.join(""), !1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(), 
                     opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)), 
-                    writeBuffer(el, buffer), document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
+                    (!1 === opts.clearMaskOnLostFocus || opts.showMaskOnFocus && document.activeElement === el || "" !== el.inputmask._valueGet(!0)) && writeBuffer(el, buffer), 
+                    document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
                 }
             }(el);
             break;

+ 1 - 1
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.39
+* Version: 4.0.0-beta.42
 */
 
 !function(factory) {

+ 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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-it.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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !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.39
+* Version: 4.0.0-beta.42
 */
 
 !function(factory) {

+ 9 - 5
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.39
+* Version: 4.0.0-beta.42
 */
 
 !function(modules) {
@@ -373,13 +373,13 @@
                     decisionPos = parseInt(lastAlt), getMaskSet().excludes[decisionPos] = getMaskSet().excludes[decisionPos] || [], 
                     !0 !== pos && getMaskSet().excludes[decisionPos].push(getDecisionTaker(prevAltPos));
                     var validInputsClone = [], staticInputsBeforePos = 0;
-                    for (i = decisionPos; i < getLastValidPosition(undefined, !0) + 1; i++) (validPos = getMaskSet().validPositions[i]) && !0 !== validPos.generatedInput && /[0-9a-bA-Z]/.test(validPos.input) ? validInputsClone.push(validPos.input) : i < pos && staticInputsBeforePos++, 
+                    for (i = decisionPos; i < getLastValidPosition(undefined, !0) + 1; i++) (validPos = getMaskSet().validPositions[i]) && !0 !== validPos.generatedInput ? validInputsClone.push(validPos.input) : i < pos && staticInputsBeforePos++, 
                     delete getMaskSet().validPositions[i];
                     for (;getMaskSet().excludes[decisionPos] && getMaskSet().excludes[decisionPos].length < 10; ) {
                         var posOffset = -1 * staticInputsBeforePos, validInputs = validInputsClone.slice();
                         for (getMaskSet().tests[decisionPos] = undefined, resetMaskSet(!0), isValidRslt = !0; validInputs.length > 0; ) {
                             var input = validInputs.shift();
-                            if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition(undefined, !0) + 1, input, !1, fromSetValid, !0))) break;
+                            if (!(isValidRslt = isValid(getLastValidPosition(undefined, !0) + 1, input, !1, fromSetValid, !0))) break;
                         }
                         if (isValidRslt && c !== undefined) {
                             var targetLvp = getLastValidPosition(pos) + 1;
@@ -1011,7 +1011,10 @@
                 getMaskSet().validPositions[pos.begin] !== undefined && getMaskSet().validPositions[pos.begin].input === opts.groupSeparator && pos.end++), 
                 revalidateMask(pos), !0 !== strict && !1 !== opts.keepStatic || null !== opts.regex) {
                     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));
+                    if (result) {
+                        var newPos = result.caret !== undefined ? result.caret : result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, !0);
+                        (k !== Inputmask.keyCode.DELETE || pos.begin > newPos) && pos.begin;
+                    }
                 }
                 var lvp = getLastValidPosition(pos.begin, !0);
                 if (lvp < pos.begin || -1 === pos.begin) getMaskSet().p = seekNext(lvp); else if (!0 !== strict && (getMaskSet().p = pos.begin, 
@@ -1201,7 +1204,8 @@
                         var buffer = getBuffer().slice();
                         undoValue = buffer.join(""), !1 === isComplete(buffer) && opts.clearIncomplete && resetMaskSet(), 
                         opts.clearMaskOnLostFocus && document.activeElement !== el && (-1 === getLastValidPosition() ? buffer = [] : clearOptionalTail(buffer)), 
-                        writeBuffer(el, buffer), document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
+                        (!1 === opts.clearMaskOnLostFocus || opts.showMaskOnFocus && document.activeElement === el || "" !== el.inputmask._valueGet(!0)) && writeBuffer(el, buffer), 
+                        document.activeElement === el && caret(el, seekNext(getLastValidPosition()));
                     }
                 }(el);
                 break;

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/bindings/inputmask.binding.min.js


File diff suppressed because it is too large
+ 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.39
+* Version: 4.0.0-beta.42
 */
 
 !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});

File diff suppressed because it is too large
+ 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.39
+* Version: 4.0.0-beta.42
 */
 
 "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.39
+* Version: 4.0.0-beta.42
 */
 
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.extensions.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/min/inputmask/inputmask.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.numeric.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.phone.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-be.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ca.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-hu.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-it.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-mx.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-nl.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ru.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/min/jquery.inputmask.bundle.min.js


+ 0 - 1
index.js

@@ -6,7 +6,6 @@ require("./dist/inputmask/inputmask.phone.extensions");
 // require("./dist/inputmask/phone-codes/phone-be");
 // require("./dist/inputmask/phone-codes/phone-nl");
 // require("./dist/inputmask/phone-codes/phone-ru");
-// require("./dist/inputmask/phone-codes/phone-uk");
 // require("./dist/inputmask/phone-codes/phone");
 
 module.exports = require("./dist/inputmask/inputmask.js");

+ 11 - 5
js/inputmask.js

@@ -1430,7 +1430,7 @@
                     var validInputsClone = [], staticInputsBeforePos = 0;
                     for (i = decisionPos; i < getLastValidPosition(undefined, true) + 1; i++) {
                         validPos = getMaskSet().validPositions[i];
-                        if (validPos && validPos.generatedInput !== true && /[0-9a-bA-Z]/.test(validPos.input)) {
+                        if (validPos && validPos.generatedInput !== true /*&& /[0-9a-bA-Z]/.test(validPos.input)*/) {
                             validInputsClone.push(validPos.input);
                         } else if (i < pos) staticInputsBeforePos++;
                         delete getMaskSet().validPositions[i];
@@ -1446,11 +1446,11 @@
                         isValidRslt = true;
                         while (validInputs.length > 0) {
                             var input = validInputs.shift();
-                            if (input !== opts.skipOptionalPartCharacter) {
+                            // if (input !== opts.skipOptionalPartCharacter) {
                                 if (!(isValidRslt = isValid(getLastValidPosition(undefined, true) + 1, input, false, fromSetValid, true))) {
                                     break;
                                 }
-                            }
+                            // }
                         }
 
                         if (isValidRslt && c !== undefined) {
@@ -2740,7 +2740,12 @@
 
                 if (strict !== true && opts.keepStatic !== false || opts.regex !== null) {
                     var result = alternate(true);
-                    if (result) pos.begin = result.caret !== undefined ? result.caret : (result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, true));
+                    if (result) {
+                        var newPos = result.caret !== undefined ? result.caret : (result.pos ? seekNext(result.pos.begin ? result.pos.begin : result.pos) : getLastValidPosition(-1, true));
+                        if (k !== Inputmask.keyCode.DELETE || pos.begin > newPos) {
+                            pos.begin == newPos;
+                        }
+                    }
                 }
                 var lvp = getLastValidPosition(pos.begin, true);
                 if (lvp < pos.begin || pos.begin === -1) {
@@ -3136,7 +3141,8 @@
                                 clearOptionalTail(buffer);
                             }
                         }
-                        writeBuffer(el, buffer);
+                        if (opts.clearMaskOnLostFocus === false || (opts.showMaskOnFocus && document.activeElement === el) || el.inputmask._valueGet(true) !== "")
+                            writeBuffer(el, buffer);
                         if (document.activeElement === el) { //position the caret when in focus
                             caret(el, seekNext(getLastValidPosition()));
                         }

+ 1 - 1
package.json

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

+ 0 - 1
qunit/index.js

@@ -9,7 +9,6 @@ import "../js/inputmask.phone.extensions";
 import "../js/phone-codes/phone-be";
 import "../js/phone-codes/phone-nl";
 import "../js/phone-codes/phone-ru";
-import "../js/phone-codes/phone-uk";
 import "../js/phone-codes/phone";
 import "../js/jquery.inputmask";
 

+ 2 - 2
qunit/tests_paste.js

@@ -80,7 +80,7 @@ export default function (qunit, $, Inputmask) {
 	});
 
 	qunit.test("99.999.999/9999-99 numericInput ~ paste 79100085302751__-____/..__ - imbelo", function (assert) {
-		var done = assert.async(), $fixture = $("body");
+		var done = assert.async(), $fixture = $("#qunit-fixture");
 		$fixture.append('<input type="text" id="testmask" />');
 		var testmask = document.getElementById("testmask");
 		Inputmask({
@@ -88,7 +88,7 @@ export default function (qunit, $, Inputmask) {
 			"numericInput": true
 		}).mask(testmask);
 		testmask.focus();
-		$("#testmask").paste("79100085302751__-____/..__");
+		$("#testmask").paste("79100085302751");
 
 		setTimeout(function () {
 			assert.equal(testmask.value, "79.100.085/3027-51", "Result " + testmask.value);

+ 0 - 177
temp.js

@@ -1,177 +0,0 @@
-[{
-    "matches": [{
-        "matches": [{
-            "matches": [{
-                "matches": [{
-                    "fn": {},
-                    "optionality": false,
-                    "newBlockMarker": true,
-                    "casing": null,
-                    "def": "[0-9]",
-                    "nativeDef": "[0-9]"
-                }],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": true,
-                "isOptional": false,
-                "isQuantifier": false,
-                "isAlternator": false,
-                "quantifier": {"min": 1, "max": 1}
-            }, {
-                "matches": [],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": false,
-                "isOptional": false,
-                "isQuantifier": true,
-                "isAlternator": false,
-                "quantifier": {"min": 2, "max": 2}
-            }],
-            "openGroup": false,
-            "alternatorGroup": false,
-            "isGroup": false,
-            "isOptional": false,
-            "isQuantifier": false,
-            "isAlternator": false,
-            "quantifier": {"min": 1, "max": 1}
-        }, {
-            "matches": [{
-                "matches": [{
-                    "fn": {},
-                    "optionality": false,
-                    "newBlockMarker": true,
-                    "casing": null,
-                    "def": "[0-9]",
-                    "nativeDef": "[0-9]"
-                }],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": true,
-                "isOptional": false,
-                "isQuantifier": false,
-                "isAlternator": false,
-                "quantifier": {"min": 1, "max": 1}
-            }, {
-                "matches": [],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": false,
-                "isOptional": false,
-                "isQuantifier": true,
-                "isAlternator": false,
-                "quantifier": {"min": 3, "max": 3}
-            }],
-            "openGroup": false,
-            "alternatorGroup": false,
-            "isGroup": false,
-            "isOptional": false,
-            "isQuantifier": false,
-            "isAlternator": false,
-            "quantifier": {"min": 1, "max": 1}
-        }],
-        "openGroup": false,
-        "alternatorGroup": false,
-        "isGroup": false,
-        "isOptional": false,
-        "isQuantifier": false,
-        "isAlternator": true,
-        "quantifier": {"min": 1, "max": 1}
-    }],
-    "openGroup": false,
-    "alternatorGroup": false,
-    "isGroup": false,
-    "isOptional": false,
-    "isQuantifier": false,
-    "isAlternator": false,
-    "quantifier": {"min": 1, "max": 1}
-}]
-js\inputmask.js
-:
-623 [{
-    "matches": [{
-        "matches": [{
-            "matches": [{
-                "matches": [{
-                    "fn": {},
-                    "optionality": false,
-                    "newBlockMarker": true,
-                    "casing": null,
-                    "def": "[0-9]",
-                    "nativeDef": "[0-9]"
-                }],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": true,
-                "isOptional": false,
-                "isQuantifier": false,
-                "isAlternator": false,
-                "quantifier": {"min": 1, "max": 1}
-            }, {
-                "matches": [],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": false,
-                "isOptional": false,
-                "isQuantifier": true,
-                "isAlternator": false,
-                "quantifier": {"min": 2, "max": 2}
-            }],
-            "openGroup": false,
-            "alternatorGroup": false,
-            "isGroup": false,
-            "isOptional": false,
-            "isQuantifier": false,
-            "isAlternator": false,
-            "quantifier": {"min": 1, "max": 1}
-        }, {
-            "matches": [{
-                "matches": [{
-                    "fn": {},
-                    "optionality": false,
-                    "newBlockMarker": true,
-                    "casing": null,
-                    "def": "[0-9]",
-                    "nativeDef": "[0-9]",
-                    "isGroup": false
-                }],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": true,
-                "isOptional": false,
-                "isQuantifier": false,
-                "isAlternator": false,
-                "quantifier": {"min": 1, "max": 1}
-            }, {
-                "matches": [],
-                "openGroup": false,
-                "alternatorGroup": false,
-                "isGroup": false,
-                "isOptional": false,
-                "isQuantifier": true,
-                "isAlternator": false,
-                "quantifier": {"min": 3, "max": 3}
-            }],
-            "openGroup": true,
-            "alternatorGroup": false,
-            "isGroup": false,
-            "isOptional": false,
-            "isQuantifier": false,
-            "isAlternator": false,
-            "quantifier": {"min": 1, "max": 1}
-        }],
-        "openGroup": false,
-        "alternatorGroup": false,
-        "isGroup": false,
-        "isOptional": false,
-        "isQuantifier": false,
-        "isAlternator": true,
-        "quantifier": {"min": 1, "max": 1}
-    }],
-    "openGroup": false,
-    "alternatorGroup": false,
-    "isGroup": false,
-    "isOptional": false,
-    "isQuantifier": false,
-    "isAlternator": false,
-    "quantifier": {"min": 1, "max": 1}
-}]