Browse Source

enhance checkval #2089

Robin Herbots 7 years ago
parent
commit
4c71fd4b50

+ 1 - 0
CHANGELOG.md

@@ -10,6 +10,7 @@
 - enhance regex alternations. ex: [01][0-9]|2[0-3] => ([01][0-9]|2[0-3])
 - enhance regex alternations. ex: [01][0-9]|2[0-3] => ([01][0-9]|2[0-3])
 
 
 ### Fixed
 ### Fixed
+- The first character is truncated when masking. #2089
 - No leading zero for single-digit hours KO #2061
 - No leading zero for single-digit hours KO #2061
 - Only 1st placeholder is displayed for fields with same alias numeric #2060
 - Only 1st placeholder is displayed for fields with same alias numeric #2060
 - Original placeholder disappear when mouseout in IE #2047
 - Original placeholder disappear when mouseout in IE #2047

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "inputmask",
   "name": "inputmask",
-  "version": "5.0.0-beta.141",
+  "version": "5.0.0-beta.142",
   "main": [
   "main": [
 	  "./index.js",
 	  "./index.js",
     "./css/inputmask.css"
     "./css/inputmask.css"

+ 1 - 1
composer.json

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

+ 21 - 8
dist/inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2019 Robin Herbots
  * Copyright (c) 2010 - 2019 Robin Herbots
  * Licensed under the MIT license
  * Licensed under the MIT license
- * Version: 5.0.0-beta.141
+ * Version: 5.0.0-beta.142
  */
  */
 !function webpackUniversalModuleDefinition(root, factory) {
 !function webpackUniversalModuleDefinition(root, factory) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = factory(); else if ("function" == typeof define && define.amd) define([], factory); else {
     if ("object" == typeof exports && "object" == typeof module) module.exports = factory(); else if ("function" == typeof define && define.amd) define([], factory); else {
@@ -1619,7 +1619,7 @@
                     var charCodeNdx = getMaskTemplate(!0, 0, !1).slice(ndx, seekNext(ndx)).join("").replace(/'/g, "").indexOf(charCodes);
                     var charCodeNdx = getMaskTemplate(!0, 0, !1).slice(ndx, seekNext(ndx)).join("").replace(/'/g, "").indexOf(charCodes);
                     return -1 !== charCodeNdx && !isMask(ndx) && (getTest(ndx).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx).match.fn && getTest(ndx).match.nativeDef === "'" + charCodes.charAt(0) || " " === getTest(ndx).match.nativeDef && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx + 1).match.fn && getTest(ndx + 1).match.nativeDef === "'" + charCodes.charAt(0)));
                     return -1 !== charCodeNdx && !isMask(ndx) && (getTest(ndx).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx).match.fn && getTest(ndx).match.nativeDef === "'" + charCodes.charAt(0) || " " === getTest(ndx).match.nativeDef && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx + 1).match.fn && getTest(ndx + 1).match.nativeDef === "'" + charCodes.charAt(0)));
                 }
                 }
-                if (resetMaskSet(), strict || !0 === opts.autoUnmask) initialNdx = seekNext(initialNdx); else {
+                if (resetMaskSet(), !strict) {
                     var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
                     var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
                     matches && 0 < matches.length && (inputValue.splice(0, matches.length * staticInput.length), 
                     matches && 0 < matches.length && (inputValue.splice(0, matches.length * staticInput.length), 
                     initialNdx = seekNext(initialNdx));
                     initialNdx = seekNext(initialNdx));
@@ -1627,19 +1627,30 @@
                 -1 === initialNdx ? (getMaskSet().p = seekNext(initialNdx), initialNdx = 0) : getMaskSet().p = initialNdx, 
                 -1 === initialNdx ? (getMaskSet().p = seekNext(initialNdx), initialNdx = 0) : getMaskSet().p = initialNdx, 
                 inputmask.caretPos = {
                 inputmask.caretPos = {
                     begin: initialNdx
                     begin: initialNdx
-                }, $.each(inputValue, function(ndx, charCode) {
+                };
+                var staticMatches = [], sndx, validPos, nextValid;
+                if ($.each(inputValue, function(ndx, charCode) {
                     if (void 0 !== charCode) if (void 0 === getMaskSet().validPositions[ndx] && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, void 0, void 0, !0)) getMaskSet().p++; else {
                     if (void 0 !== charCode) if (void 0 === getMaskSet().validPositions[ndx] && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, void 0, void 0, !0)) getMaskSet().p++; else {
                         var keypress = new $.Event("_checkval");
                         var keypress = new $.Event("_checkval");
                         keypress.which = charCode.charCodeAt(0), charCodes += charCode;
                         keypress.which = charCode.charCodeAt(0), charCodes += charCode;
                         var lvp = getLastValidPosition(void 0, !0);
                         var lvp = getLastValidPosition(void 0, !0);
                         isTemplateMatch(initialNdx, charCodes) ? result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, lvp + 1) : (result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, inputmask.caretPos.begin), 
                         isTemplateMatch(initialNdx, charCodes) ? result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, lvp + 1) : (result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, inputmask.caretPos.begin), 
-                        result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result && (writeBuffer(void 0, getBuffer(), result.forwardPosition, keypress, !1), 
+                        result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result && (result.pos && null === getMaskSet().validPositions[result.pos].match.fn && (staticMatches.push(result.pos), 
+                        result.forwardPosition = result.pos + 1), writeBuffer(void 0, getBuffer(), result.forwardPosition, keypress, !1), 
                         inputmask.caretPos = {
                         inputmask.caretPos = {
                             begin: result.forwardPosition,
                             begin: result.forwardPosition,
                             end: result.forwardPosition
                             end: result.forwardPosition
                         });
                         });
                     }
                     }
-                }), writeOut && writeBuffer(input, getBuffer(), result ? result.forwardPosition : void 0, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
+                }), 0 < staticMatches.length) if (isComplete(getBuffer())) for (;sndx = staticMatches.pop(); ) validPos = getMaskSet().validPositions[sndx], 
+                validPos.generatedInput = !0; else for (;sndx = staticMatches.pop(); ) {
+                    var keypress = new $.Event("_checkval"), nextSndx = sndx + 1;
+                    for (validPos = getMaskSet().validPositions[sndx], validPos.generatedInput = !0, 
+                    keypress.which = validPos.input.charCodeAt(0); (nextValid = getMaskSet().validPositions[nextSndx]) && nextValid.input === validPos.input; ) nextSndx++;
+                    if (EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, nextSndx), 
+                    isComplete(getBuffer())) break;
+                }
+                writeOut && writeBuffer(input, getBuffer(), result ? result.forwardPosition : void 0, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
             }
             }
             function unmaskedvalue(input) {
             function unmaskedvalue(input) {
                 if (input) {
                 if (input) {
@@ -2227,13 +2238,15 @@
                     opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 
                     opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 
                     opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts._radixDance = !1) : (opts.__financeInput = !1, 
                     opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts._radixDance = !1) : (opts.__financeInput = !1, 
                     opts.numericInput = !0);
                     opts.numericInput = !0);
-                    var mask = "[+]";
+                    var mask = "[+]", altMask;
                     if (mask += autoEscape(opts.prefix, opts), "" !== opts.groupSeparator ? mask += "(" + opts.groupSeparator + "999){+|1}" : mask += "9{+}", 
                     if (mask += autoEscape(opts.prefix, opts), "" !== opts.groupSeparator ? mask += "(" + opts.groupSeparator + "999){+|1}" : mask += "9{+}", 
                     void 0 !== opts.digits) {
                     void 0 !== opts.digits) {
                         var dq = opts.digits.toString().split(",");
                         var dq = opts.digits.toString().split(",");
-                        isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}" : (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && (opts.digitsOptional ? mask += "[" + opts.radixPoint + decimalDef + "{1," + opts.digits + "}]" : mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}");
+                        isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}" : (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && (opts.digitsOptional ? (altMask = mask + opts.radixPoint + decimalDef + "{1," + opts.digits + "}", 
+                        opts.keepStatic = !0) : mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}");
                     }
                     }
-                    return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask;
+                    return mask += autoEscape(opts.suffix, opts), mask += "[-]", altMask && (mask = [ altMask + autoEscape(opts.suffix, opts) + "[-]", mask ]), 
+                    opts.greedy = !1, console.log(mask), mask;
                 },
                 },
                 placeholder: "0",
                 placeholder: "0",
                 greedy: !1,
                 greedy: !1,

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


+ 21 - 8
dist/jquery.inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2019 Robin Herbots
  * Copyright (c) 2010 - 2019 Robin Herbots
  * Licensed under the MIT license
  * Licensed under the MIT license
- * Version: 5.0.0-beta.141
+ * Version: 5.0.0-beta.142
  */
  */
 !function webpackUniversalModuleDefinition(root, factory) {
 !function webpackUniversalModuleDefinition(root, factory) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = factory(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], factory); else {
     if ("object" == typeof exports && "object" == typeof module) module.exports = factory(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], factory); else {
@@ -1502,7 +1502,7 @@
                     var charCodeNdx = getMaskTemplate(!0, 0, !1).slice(ndx, seekNext(ndx)).join("").replace(/'/g, "").indexOf(charCodes);
                     var charCodeNdx = getMaskTemplate(!0, 0, !1).slice(ndx, seekNext(ndx)).join("").replace(/'/g, "").indexOf(charCodes);
                     return -1 !== charCodeNdx && !isMask(ndx) && (getTest(ndx).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx).match.fn && getTest(ndx).match.nativeDef === "'" + charCodes.charAt(0) || " " === getTest(ndx).match.nativeDef && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx + 1).match.fn && getTest(ndx + 1).match.nativeDef === "'" + charCodes.charAt(0)));
                     return -1 !== charCodeNdx && !isMask(ndx) && (getTest(ndx).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx).match.fn && getTest(ndx).match.nativeDef === "'" + charCodes.charAt(0) || " " === getTest(ndx).match.nativeDef && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0) || null === getTest(ndx + 1).match.fn && getTest(ndx + 1).match.nativeDef === "'" + charCodes.charAt(0)));
                 }
                 }
-                if (resetMaskSet(), strict || !0 === opts.autoUnmask) initialNdx = seekNext(initialNdx); else {
+                if (resetMaskSet(), !strict) {
                     var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
                     var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
                     matches && 0 < matches.length && (inputValue.splice(0, matches.length * staticInput.length), 
                     matches && 0 < matches.length && (inputValue.splice(0, matches.length * staticInput.length), 
                     initialNdx = seekNext(initialNdx));
                     initialNdx = seekNext(initialNdx));
@@ -1510,19 +1510,30 @@
                 -1 === initialNdx ? (getMaskSet().p = seekNext(initialNdx), initialNdx = 0) : getMaskSet().p = initialNdx, 
                 -1 === initialNdx ? (getMaskSet().p = seekNext(initialNdx), initialNdx = 0) : getMaskSet().p = initialNdx, 
                 inputmask.caretPos = {
                 inputmask.caretPos = {
                     begin: initialNdx
                     begin: initialNdx
-                }, $.each(inputValue, function(ndx, charCode) {
+                };
+                var staticMatches = [], sndx, validPos, nextValid;
+                if ($.each(inputValue, function(ndx, charCode) {
                     if (void 0 !== charCode) if (void 0 === getMaskSet().validPositions[ndx] && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, void 0, void 0, !0)) getMaskSet().p++; else {
                     if (void 0 !== charCode) if (void 0 === getMaskSet().validPositions[ndx] && inputValue[ndx] === getPlaceholder(ndx) && isMask(ndx, !0) && !1 === isValid(ndx, inputValue[ndx], !0, void 0, void 0, !0)) getMaskSet().p++; else {
                         var keypress = new $.Event("_checkval");
                         var keypress = new $.Event("_checkval");
                         keypress.which = charCode.charCodeAt(0), charCodes += charCode;
                         keypress.which = charCode.charCodeAt(0), charCodes += charCode;
                         var lvp = getLastValidPosition(void 0, !0);
                         var lvp = getLastValidPosition(void 0, !0);
                         isTemplateMatch(initialNdx, charCodes) ? result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, lvp + 1) : (result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, inputmask.caretPos.begin), 
                         isTemplateMatch(initialNdx, charCodes) ? result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, lvp + 1) : (result = EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, inputmask.caretPos.begin), 
-                        result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result && (writeBuffer(void 0, getBuffer(), result.forwardPosition, keypress, !1), 
+                        result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result && (result.pos && null === getMaskSet().validPositions[result.pos].match.fn && (staticMatches.push(result.pos), 
+                        result.forwardPosition = result.pos + 1), writeBuffer(void 0, getBuffer(), result.forwardPosition, keypress, !1), 
                         inputmask.caretPos = {
                         inputmask.caretPos = {
                             begin: result.forwardPosition,
                             begin: result.forwardPosition,
                             end: result.forwardPosition
                             end: result.forwardPosition
                         });
                         });
                     }
                     }
-                }), writeOut && writeBuffer(input, getBuffer(), result ? result.forwardPosition : void 0, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
+                }), 0 < staticMatches.length) if (isComplete(getBuffer())) for (;sndx = staticMatches.pop(); ) validPos = getMaskSet().validPositions[sndx], 
+                validPos.generatedInput = !0; else for (;sndx = staticMatches.pop(); ) {
+                    var keypress = new $.Event("_checkval"), nextSndx = sndx + 1;
+                    for (validPos = getMaskSet().validPositions[sndx], validPos.generatedInput = !0, 
+                    keypress.which = validPos.input.charCodeAt(0); (nextValid = getMaskSet().validPositions[nextSndx]) && nextValid.input === validPos.input; ) nextSndx++;
+                    if (EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, nextSndx), 
+                    isComplete(getBuffer())) break;
+                }
+                writeOut && writeBuffer(input, getBuffer(), result ? result.forwardPosition : void 0, initiatingEvent || new $.Event("checkval"), initiatingEvent && "input" === initiatingEvent.type);
             }
             }
             function unmaskedvalue(input) {
             function unmaskedvalue(input) {
                 if (input) {
                 if (input) {
@@ -2110,13 +2121,15 @@
                     opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 
                     opts.positionCaretOnClick = "radixFocus" === opts.positionCaretOnClick ? "lvp" : opts.positionCaretOnClick, 
                     opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts._radixDance = !1) : (opts.__financeInput = !1, 
                     opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), opts._radixDance = !1) : (opts.__financeInput = !1, 
                     opts.numericInput = !0);
                     opts.numericInput = !0);
-                    var mask = "[+]";
+                    var mask = "[+]", altMask;
                     if (mask += autoEscape(opts.prefix, opts), "" !== opts.groupSeparator ? mask += "(" + opts.groupSeparator + "999){+|1}" : mask += "9{+}", 
                     if (mask += autoEscape(opts.prefix, opts), "" !== opts.groupSeparator ? mask += "(" + opts.groupSeparator + "999){+|1}" : mask += "9{+}", 
                     void 0 !== opts.digits) {
                     void 0 !== opts.digits) {
                         var dq = opts.digits.toString().split(",");
                         var dq = opts.digits.toString().split(",");
-                        isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}" : (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && (opts.digitsOptional ? mask += "[" + opts.radixPoint + decimalDef + "{1," + opts.digits + "}]" : mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}");
+                        isFinite(dq[0]) && dq[1] && isFinite(dq[1]) ? mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}" : (isNaN(opts.digits) || 0 < parseInt(opts.digits)) && (opts.digitsOptional ? (altMask = mask + opts.radixPoint + decimalDef + "{1," + opts.digits + "}", 
+                        opts.keepStatic = !0) : mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}");
                     }
                     }
-                    return mask += autoEscape(opts.suffix, opts), mask += "[-]", opts.greedy = !1, mask;
+                    return mask += autoEscape(opts.suffix, opts), mask += "[-]", altMask && (mask = [ altMask + autoEscape(opts.suffix, opts) + "[-]", mask ]), 
+                    opts.greedy = !1, console.log(mask), mask;
                 },
                 },
                 placeholder: "0",
                 placeholder: "0",
                 greedy: !1,
                 greedy: !1,

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


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

@@ -84,7 +84,7 @@ Inputmask.extendAliases({
                 opts.numericInput = true;
                 opts.numericInput = true;
             }
             }
 
 
-            var mask = "[+]";
+            var mask = "[+]", altMask;
             mask += autoEscape(opts.prefix, opts);
             mask += autoEscape(opts.prefix, opts);
             if (opts.groupSeparator !== "")
             if (opts.groupSeparator !== "")
                 mask += "(" + opts.groupSeparator + "999){+|1}";
                 mask += "(" + opts.groupSeparator + "999){+|1}";
@@ -95,15 +95,22 @@ Inputmask.extendAliases({
                     mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}";
                     mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}";
                 } else if (isNaN(opts.digits) || parseInt(opts.digits) > 0) {
                 } else if (isNaN(opts.digits) || parseInt(opts.digits) > 0) {
                     if (opts.digitsOptional) {
                     if (opts.digitsOptional) {
-                        mask += "[" + opts.radixPoint + decimalDef + "{1," + opts.digits + "}]";
+                        altMask = mask + opts.radixPoint + decimalDef + "{1," + opts.digits + "}";
+                        // mask += "[" + opts.radixPoint + "]";
+                        opts.keepStatic = true;
                     } else mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}";
                     } else mask += opts.radixPoint + decimalDef + "{" + opts.digits + "}";
                 }
                 }
             }
             }
             mask += autoEscape(opts.suffix, opts);
             mask += autoEscape(opts.suffix, opts);
             mask += "[-]";
             mask += "[-]";
 
 
+            if (altMask) {
+                mask = [(altMask + autoEscape(opts.suffix, opts) + "[-]"), mask];
+            }
+
+
             opts.greedy = false; //enforce greedy false
             opts.greedy = false; //enforce greedy false
-            // console.log(mask);
+            console.log(mask);
             return mask;
             return mask;
         },
         },
         placeholder: "0",
         placeholder: "0",

+ 30 - 3
lib/maskScope.js

@@ -1677,21 +1677,21 @@ module.exports = function (actionObj, maskset, opts) {
         }
         }
 
 
         resetMaskSet();
         resetMaskSet();
-        if (!strict && opts.autoUnmask !== true) {
+        if (!strict) {
             var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""),
             var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""),
                 matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
                 matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
             if (matches && matches.length > 0) {
             if (matches && matches.length > 0) {
                 inputValue.splice(0, matches.length * staticInput.length);
                 inputValue.splice(0, matches.length * staticInput.length);
                 initialNdx = seekNext(initialNdx);
                 initialNdx = seekNext(initialNdx);
             }
             }
-        } else {
-            initialNdx = seekNext(initialNdx);
         }
         }
         if (initialNdx === -1) {
         if (initialNdx === -1) {
             getMaskSet().p = seekNext(initialNdx);
             getMaskSet().p = seekNext(initialNdx);
             initialNdx = 0;
             initialNdx = 0;
         } else getMaskSet().p = initialNdx;
         } else getMaskSet().p = initialNdx;
         inputmask.caretPos = {begin: initialNdx};
         inputmask.caretPos = {begin: initialNdx};
+
+        var staticMatches = [];
         $.each(inputValue, function (ndx, charCode) {
         $.each(inputValue, function (ndx, charCode) {
             // console.log(charCode);
             // console.log(charCode);
             if (charCode !== undefined) { //inputfallback strips some elements out of the inputarray.  $.each logically presents them as undefined
             if (charCode !== undefined) { //inputfallback strips some elements out of the inputarray.  $.each logically presents them as undefined
@@ -1714,12 +1714,39 @@ module.exports = function (actionObj, maskset, opts) {
                         result = EventHandlers.keypressEvent.call(input, keypress, true, false, strict, lvp + 1);
                         result = EventHandlers.keypressEvent.call(input, keypress, true, false, strict, lvp + 1);
                     }
                     }
                     if (result) {
                     if (result) {
+                        if (result.pos && getMaskSet().validPositions[result.pos].match.fn === null) {
+                            staticMatches.push(result.pos);
+                            result.forwardPosition = result.pos + 1;
+                        }
                         writeBuffer(undefined, getBuffer(), result.forwardPosition, keypress, false);
                         writeBuffer(undefined, getBuffer(), result.forwardPosition, keypress, false);
                         inputmask.caretPos = {begin: result.forwardPosition, end: result.forwardPosition};
                         inputmask.caretPos = {begin: result.forwardPosition, end: result.forwardPosition};
                     }
                     }
                 }
                 }
             }
             }
         });
         });
+        if (staticMatches.length > 0) {
+            var sndx, validPos, nextValid;
+            if (!isComplete(getBuffer())) {
+                while ((sndx = staticMatches.pop())) {
+                    var keypress = new $.Event("_checkval"),
+                        nextSndx = sndx + 1;
+
+                    validPos = getMaskSet().validPositions[sndx];
+                    validPos.generatedInput = true;
+                    keypress.which = validPos.input.charCodeAt(0);
+                    while ((nextValid = getMaskSet().validPositions[nextSndx]) && nextValid.input === validPos.input) {
+                        nextSndx++;
+                    }
+                    EventHandlers.keypressEvent.call(input, keypress, true, false, strict, nextSndx);
+                    if (isComplete(getBuffer())) break;
+                }
+            } else { //mark al statics as generated
+                while ((sndx = staticMatches.pop())) {
+                    validPos = getMaskSet().validPositions[sndx];
+                    validPos.generatedInput = true;
+                }
+            }
+        }
         if (writeOut)
         if (writeOut)
             writeBuffer(input, getBuffer(), result ? result.forwardPosition : undefined, initiatingEvent || new $.Event("checkval"), initiatingEvent && initiatingEvent.type === "input");
             writeBuffer(input, getBuffer(), result ? result.forwardPosition : undefined, initiatingEvent || new $.Event("checkval"), initiatingEvent && initiatingEvent.type === "input");
     }
     }

+ 1 - 1
package.json

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