Robin Herbots 10 years ago
parent
commit
4cbc8a4615

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.2.6-29",
+  "version": "3.2.6-30",
   "main": [
     "./dist/inputmask/inputmask.js"
   ],

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
   "name": "jquery_inputmask",
   "repository": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.2.6-29",
+  "version": "3.2.6-30",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "main": "./dist/jquery.inputmask.bundle.js",
   "scripts": [

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.2.6-29",
+  "version": "3.2.6-30",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/jquery.inputmask",

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

File diff suppressed because it is too large
+ 19 - 16
dist/inputmask/inputmask.js


+ 7 - 213
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,216 +3,12 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
 }(function($, Inputmask) {
     return Inputmask.extendAliases({
-        numeric2: {
-            mask: function(opts) {
-                function autoEscape(txt) {
-                    for (var escapedTxt = "", i = 0; i < txt.length; i++) escapedTxt += opts.definitions[txt.charAt(i)] ? "\\" + txt.charAt(i) : txt.charAt(i);
-                    return escapedTxt;
-                }
-                0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat), 
-                opts.repeat = 0, opts.groupSeparator === opts.radixPoint && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""), 
-                " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator;
-                var seps = "+", mod = 0;
-                opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)), 
-                isFinite(opts.integerDigits) && (seps = Math.floor(opts.integerDigits / opts.groupSize), 
-                mod = opts.integerDigits % opts.groupSize)), opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)), 
-                opts.jitMasking === !0 && opts.placeholder.length > 0 && (opts.jitMasking = 1), 
-                opts.radixFocus = (opts.radixFocus || opts.radixFocus === !1 && isNaN(opts.digits)) && "" !== opts.placeholder && opts.integerOptional === !0, 
-                opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~";
-                var mask = autoEscape(opts.prefix);
-                return mask += "[+]", opts.autoGroup ? (mask += "(" + opts.groupSeparator + "~{" + opts.groupSize + "}){" + seps + "}", 
-                mod > 0 && (mask += "~{" + mod + "}")) : mask += "~{" + opts.integerDigits + "}", 
-                void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.digitsOptional || isNaN(opts.digits) ? mask += "[:;{1," + opts.digits + "}]" : (mask += ":;{" + opts.digits + "}", 
-                isFinite(opts.jitMasking) && opts.jitMasking < 1 + opts.radixPoint.length + (isFinite(opts.digits) ? opts.digits : 2) && (opts.jitMasking = 1 + opts.radixPoint.length + (isFinite(opts.digits) ? opts.digits : 2)))), 
-                "" !== opts.negationSymbol.back && (mask += "[-]"), mask += autoEscape(opts.suffix), 
-                opts.greedy = !1, console.log(mask), mask;
-            },
-            placeholder: "",
-            greedy: !1,
-            digits: "*",
-            digitsOptional: !0,
-            radixPoint: ".",
-            radixFocus: !0,
-            groupSize: 3,
-            groupSeparator: "",
-            autoGroup: !1,
-            allowPlus: !0,
-            allowMinus: !0,
-            negationSymbol: {
-                front: "-",
-                back: ""
-            },
-            integerDigits: "+",
-            integerOptional: !0,
-            prefix: "",
-            suffix: "",
-            rightAlign: !0,
-            decimalProtect: !0,
-            min: null,
-            max: null,
-            step: 1,
-            insertMode: !0,
-            autoUnmask: !1,
-            unmaskAsNumber: !1,
-            jitMasking: !0,
-            numericInput: !0,
-            onBeforeWrite: function(e, buffer, caretPos, opts) {},
-            regex: {
-                integerPart: function(opts) {
-                    return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + "]+[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?$");
-                },
-                integerNPart: function(opts) {
-                    return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + "]+");
-                }
-            },
-            signHandler: function(chrs, maskset, pos, strict, opts) {
-                return !1;
-            },
-            radixHandler: function(chrs, maskset, pos, strict, opts) {
-                if (-1 !== $.inArray(chrs, [ ",", "." ]) && (chrs = opts.radixPoint), chrs === opts.radixPoint && void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
-                    var radixPos = $.inArray(opts.radixPoint, maskset.buffer);
-                    if (radixPos > -1) return {
-                        caret: pos > radixPos ? radixPos : radixPos + 1
-                    };
-                }
-                return !1;
-            },
-            leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
-                return strict || "0" !== maskset.buffer[maskset.buffer.length - opts.prefix.length - 1] || maskset.buffer[maskset.buffer.length - opts.prefix.length - 2] === opts.radixPoint ? !0 : {
-                    pos: pos,
-                    remove: maskset.buffer.length - opts.prefix.length - 1
-                };
-            },
-            postValidation: function(buffer, opts) {
-                return !0;
-            },
-            definitions: {
-                "~": {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-                        if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts), 
-                        !isValid && (isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs), 
-                        isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts), 
-                        isValid === !0 && !strict && opts.radixFocus === !0)))) {
-                            var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
-                            -1 !== radixPosition && opts.digitsOptional === !1 && radixPosition >= pos && pos > 0 && (isValid = {
-                                pos: pos - 1,
-                                remove: void 0 !== maskset.validPositions[pos] ? pos - 1 : void 0
-                            });
-                        }
-                        return isValid;
-                    },
-                    cardinality: 1,
-                    prevalidator: null
-                },
-                "+": {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-                        return isValid || (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts), 
-                        !isValid && (strict && opts.allowMinus && chrs === opts.negationSymbol.front || opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) && (isValid = "-" === chrs ? "" !== opts.negationSymbol.back ? {
-                            pos: pos,
-                            c: "-" === chrs ? opts.negationSymbol.front : "+",
-                            caret: pos + 1,
-                            insert: {
-                                pos: maskset.buffer.length,
-                                c: opts.negationSymbol.back
-                            }
-                        } : {
-                            pos: pos,
-                            c: "-" === chrs ? opts.negationSymbol.front : "+",
-                            caret: pos + 1
-                        } : !0)), isValid;
-                    },
-                    cardinality: 1,
-                    prevalidator: null,
-                    placeholder: ""
-                },
-                "-": {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-                        return isValid || (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts), 
-                        !isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back && (isValid = !0)), 
-                        isValid;
-                    },
-                    cardinality: 1,
-                    prevalidator: null,
-                    placeholder: ""
-                },
-                ":": {
-                    validator: function(chrs, maskset, pos, strict, opts) {
-                        var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-                        if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts), 
-                        !isValid)) {
-                            var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + ",\\.]";
-                            if (isValid = new RegExp(radix).test(chrs), !isValid && new RegExp("[0-9]").test(chrs)) {
-                                if ((opts.radixFocus !== !0 || opts.radixFocus === !0 && strict) && pos === $.inArray(opts.radixPoint, maskset.buffer)) return isValid = {
-                                    pos: pos,
-                                    c: opts.radixPoint,
-                                    insert: {
-                                        pos: pos + 1,
-                                        c: chrs
-                                    }
-                                };
-                                if (!strict) return isValid = {
-                                    pos: pos - 1,
-                                    c: chrs
-                                };
-                            }
-                        }
-                        return isValid !== !0 ? isValid : {
-                            c: opts.radixPoint
-                        };
-                    },
-                    cardinality: 1,
-                    prevalidator: null,
-                    definitionSymbol: "~",
-                    placeholder: function(opts) {
-                        return opts.radixPoint;
-                    }
-                }
-            },
-            onUnMask: function(maskedValue, unmaskedValue, opts) {
-                var processValue = maskedValue.replace(opts.prefix, "");
-                return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
-                opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")), 
-                Number(processValue)) : processValue;
-            },
-            isComplete: function(buffer, opts) {
-                var maskedValue = buffer.join(""), processValue = maskedValue.replace(opts.prefix, "");
-                return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
-                "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")), 
-                isFinite(processValue);
-            },
-            onBeforeMask: function(initialValue, opts) {
-                if ("" !== opts.radixPoint && isFinite(initialValue)) initialValue = initialValue.toString().replace(".", opts.radixPoint); else {
-                    var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
-                    dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""), 
-                    initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""), 
-                    initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
-                }
-                if (0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))), 
-                "" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
-                    var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
-                    if (parseInt(opts.digits) < decPart.toString().length) {
-                        var digitsFactor = Math.pow(10, parseInt(opts.digits));
-                        initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."), 
-                        initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor, 
-                        initialValue = initialValue.toString().replace(".", opts.radixPoint);
-                    }
-                }
-                return initialValue.toString();
-            },
-            canClearPosition: function(maskset, position, lvp, strict, opts) {
-                return !0;
-            },
-            onKeyDown: function(e, buffer, caretPos, opts) {}
-        },
         numeric: {
             mask: function(opts) {
                 function autoEscape(txt) {
@@ -445,19 +241,17 @@
                 }
                 return !0;
             },
-            postValidation: function(buffer, opts) {
-                var isValid = !0, maskedValue = buffer.join(""), processValue = maskedValue.replace(opts.prefix, "");
+            postValidation: function(buffer, currentResult, opts) {
+                var isValid = !0, maskedValue = opts.numericInput ? buffer.slice().reverse().join("") : buffer.join(""), processValue = maskedValue.replace(opts.prefix, "");
                 return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), 
                 "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")), 
                 processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"), 
                 processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""), 
                 processValue = processValue === opts.negationSymbol.front ? processValue + "0" : processValue, 
-                isFinite(processValue) && (null !== opts.max && isFinite(opts.max) && (isValid = parseFloat(processValue) <= parseFloat(opts.max)), 
-                isValid && null !== opts.min && isFinite(opts.min) && (0 >= processValue || processValue.toString().length >= opts.min.toString().length) && (isValid = parseFloat(processValue) >= parseFloat(opts.min), 
-                isValid || (isValid = $.extend(!0, {
-                    refreshFromBuffer: !0,
-                    buffer: (opts.prefix + opts.min).split("")
-                }, opts.postFormat((opts.prefix + opts.min).split(""), 0, !0, opts)), isValid.refreshFromBuffer = !0))), 
+                isFinite(processValue) && (null !== opts.max && isFinite(opts.max) && (processValue = parseFloat(processValue) > parseFloat(opts.max) ? opts.max : processValue, 
+                isValid = opts.postFormat((opts.prefix + processValue).split(""), 0, !0, opts)), 
+                null !== opts.min && isFinite(opts.min) && (processValue = parseFloat(processValue) < parseFloat(opts.min) ? opts.min : processValue, 
+                isValid = opts.postFormat((opts.prefix + processValue).split(""), 0, !0, opts))), 
                 isValid;
             },
             definitions: {

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
@@ -99,9 +99,9 @@
                             }
                             return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
                         }
-                        var groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
-                        null === opts.regexTokens && analyseRegex(), cbuffer.splice(pos, 0, chrs);
-                        for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
+                        var bufferStr, groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
+                        null === opts.regexTokens && analyseRegex(), cbuffer.splice(pos, 0, chrs), bufferStr = cbuffer.join("");
+                        for (var i = 0; i < opts.regexTokens.length; i++) {
                             var regexToken = opts.regexTokens[i];
                             if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
                         }

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

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery, window.Inputmask);

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


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


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

@@ -3,6 +3,6 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-29
+* Version: 3.2.6-30
 */
 !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return window.dependencyLib=a,a});

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
+ 3 - 3
dist/min/inputmask/inputmask.min.js


File diff suppressed because it is too large
+ 2 - 2
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
+ 2 - 2
dist/min/inputmask/inputmask.regex.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
+ 4 - 4
dist/min/jquery.inputmask.bundle.min.js


+ 17 - 14
js/inputmask.js

@@ -800,12 +800,10 @@
 			}
 
 			function getLastValidPosition(closestTo, strict) {
-				var maskset = getMaskSet(),
-					lastValidPosition = -1,
-					valids = maskset.validPositions;
+				var before = -1,
+					after = -1;
+				valids = getMaskSet().validPositions;
 				if (closestTo === undefined) closestTo = -1;
-				var before = lastValidPosition,
-					after = lastValidPosition;
 				for (var posNdx in valids) {
 					var psNdx = parseInt(posNdx);
 					if (valids[psNdx] && (strict || valids[psNdx].match.fn !== null)) {
@@ -813,8 +811,7 @@
 						if (psNdx >= closestTo) after = psNdx;
 					}
 				}
-				lastValidPosition = (before !== -1 && (closestTo - before) > 1) || after < closestTo ? before : after;
-				return lastValidPosition;
+				return (before !== -1 && (closestTo - before) > 1) || after < closestTo ? before : after;
 			}
 
 			function setValidPosition(pos, validTest, fromSetValid) {
@@ -842,7 +839,7 @@
 
 								//does it match
 								if (positionCanMatchDefinition(posMatch, t.match.def)) {
-									var result = isValid(posMatch, t.input, true, true)
+									var result = isValid(posMatch, t.input, true, true);
 									valid = result !== false;
 									j = (result.caret || result.insert) ? getLastValidPosition() : posMatch;
 									break;
@@ -1318,7 +1315,7 @@
 								$.each(rslt.insert.sort(function(a, b) {
 									return a - b;
 								}), function(ndx, lmnt) {
-									isValid(lmnt.pos, lmnt.c);
+									isValid(lmnt.pos, lmnt.c, false, fromSetValid);
 								});
 							}
 
@@ -1332,7 +1329,7 @@
 								}
 								validatedPos = rslt.pos !== undefined ? rslt.pos : position;
 								if (validatedPos !== position) {
-									rslt = $.extend(rslt, isValid(validatedPos, elem, true)); //revalidate new position strict
+									rslt = $.extend(rslt, isValid(validatedPos, elem, true, fromSetValid)); //revalidate new position strict
 									return false;
 								}
 
@@ -1445,7 +1442,7 @@
 											while (validInputs.length > 0) {
 												var input = validInputs.shift();
 												if (input !== opts.skipOptionalPartCharacter) {
-													if (!(isValidRslt = isValid(getLastValidPosition(undefined, true) + 1, input, false, true))) {
+													if (!(isValidRslt = isValid(getLastValidPosition(undefined, true) + 1, input, false, fromSetValid))) {
 														break;
 													}
 												}
@@ -1523,7 +1520,7 @@
 					if (getMaskSet().validPositions[pndx] === undefined && (((!isMask(pndx) || buffer[pndx] !== getPlaceholder(pndx)) && getTests(pndx).length > 1) || (buffer[pndx] === opts.radixPoint || buffer[pndx] === "0" && $.inArray(opts.radixPoint, buffer) < pndx))) //special case for decimals ~ = placeholder but yet valid input
 					{
 						//console.log("inject " + pndx + " " + buffer[pndx]);
-						_isValid(pndx, buffer[pndx], true);
+						_isValid(pndx, buffer[pndx], true, fromSetValid);
 					}
 				}
 
@@ -1536,7 +1533,7 @@
 				//}
 				if (maskPos < getMaskLength()) {
 					result = _isValid(maskPos, c, strict, fromSetValid);
-					if ((!strict || fromSetValid) && result === false) {
+					if ((!strict || fromSetValid === true) && result === false) {
 						var currentPosValid = getMaskSet().validPositions[maskPos];
 						if (currentPosValid && currentPosValid.match.fn === null && (currentPosValid.match.def === c || c === opts.skipOptionalPartCharacter)) {
 							result = {
@@ -1565,7 +1562,7 @@
 						"pos": maskPos
 					};
 				}
-				if ($.isFunction(opts.postValidation) && result !== false && !strict) {
+				if ($.isFunction(opts.postValidation) && result !== false && !strict && fromSetValid !== true) {
 					var postValidResult = opts.postValidation(getBuffer(true), result, opts);
 					if (!postValidResult) {
 						resetMaskSet(true);
@@ -2639,6 +2636,12 @@
 				}
 			}
 
+			function resetEvent(e) {
+				setTimeout(function() {
+					$el.trigger("setvalue");
+				}, 0);
+			}
+
 			function mask(elem) {
 				el = elem;
 				$el = $(el);

+ 7 - 583
js/inputmask.numeric.extensions.js

@@ -19,577 +19,6 @@ Optional extensions on the jquery.inputmask base
 	(function($, Inputmask) {
 		//number aliases
 		Inputmask.extendAliases({
-			"numeric2": {
-				mask: function(opts) {
-					function autoEscape(txt) {
-						var escapedTxt = "";
-						for (var i = 0; i < txt.length; i++) {
-							escapedTxt += opts.definitions[txt.charAt(i)] ? "\\" + txt.charAt(i) : txt.charAt(i);
-						}
-						return escapedTxt;
-					}
-					if (opts.repeat !== 0 && isNaN(opts.integerDigits)) {
-						opts.integerDigits = opts.repeat;
-					}
-					opts.repeat = 0;
-					if (opts.groupSeparator === opts.radixPoint) { //treat equal separator and radixpoint
-						if (opts.radixPoint === ".") {
-							opts.groupSeparator = ",";
-						} else if (opts.radixPoint === ",") {
-							opts.groupSeparator = ".";
-						} else opts.groupSeparator = "";
-					}
-					if (opts.groupSeparator === " ") { //prevent conflict with default skipOptionalPartCharacter
-						opts.skipOptionalPartCharacter = undefined;
-					}
-					opts.autoGroup = opts.autoGroup && opts.groupSeparator !== "";
-					var seps = "+",
-						mod = 0;
-					if (opts.autoGroup) {
-						if (typeof opts.groupSize == "string" && isFinite(opts.groupSize)) opts.groupSize = parseInt(opts.groupSize);
-						if (isFinite(opts.integerDigits)) {
-							seps = Math.floor(opts.integerDigits / opts.groupSize);
-							mod = opts.integerDigits % opts.groupSize;
-						}
-					}
-
-					//enforce placeholder to single
-					if (opts.placeholder.length > 1) {
-						opts.placeholder = opts.placeholder.charAt(0);
-					}
-					if (opts.jitMasking === true && opts.placeholder.length > 0) {
-						opts.jitMasking = 1;
-					}
-
-					//only allow radixfocus when placeholder = 0
-					opts.radixFocus = (opts.radixFocus || (opts.radixFocus === false && isNaN(opts.digits))) && opts.placeholder !== "" && opts.integerOptional === true;
-
-					opts.definitions[";"] = opts.definitions["~"]; //clone integer def for decimals
-					opts.definitions[";"].definitionSymbol = "~";
-
-					var mask = autoEscape(opts.prefix);
-					mask += "[+]";
-					if (opts.autoGroup) {
-						mask += "(" + opts.groupSeparator + "~{" + opts.groupSize + "}){" + seps + "}";
-						if (mod > 0) mask += "~{" + mod + "}";
-					} else {
-						mask += "~{" + opts.integerDigits + "}";
-					}
-
-					if (opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
-						if (opts.digitsOptional || isNaN(opts.digits)) {
-							mask += "[:;{1," + opts.digits + "}]";
-						} else {
-							mask += ":;{" + opts.digits + "}";
-							if (isFinite(opts.jitMasking)) {
-								if (opts.jitMasking < (1 + opts.radixPoint.length + (isFinite(opts.digits) ? opts.digits : 2))) {
-									opts.jitMasking = (1 + opts.radixPoint.length + (isFinite(opts.digits) ? opts.digits : 2));
-								}
-							}
-						}
-					}
-					if (opts.negationSymbol.back !== "") {
-						mask += "[-]";
-					}
-					mask += autoEscape(opts.suffix);
-
-					opts.greedy = false; //enforce greedy false
-
-					console.log(mask);
-					return mask;
-				},
-				placeholder: "",
-				greedy: false,
-				digits: "*", //number of fractionalDigits
-				digitsOptional: true,
-				radixPoint: ".",
-				radixFocus: true,
-				groupSize: 3,
-				groupSeparator: "",
-				autoGroup: false,
-				allowPlus: true,
-				allowMinus: true,
-				negationSymbol: {
-					front: "-", //"("
-					back: "" //")"
-				},
-				integerDigits: "+", //number of integerDigits
-				integerOptional: true,
-				prefix: "",
-				suffix: "",
-				rightAlign: true,
-				decimalProtect: true, //do not allow assumption of decimals input without entering the radixpoint
-				min: null, //minimum value
-				max: null, //maximum value
-				step: 1,
-				insertMode: true,
-				autoUnmask: false,
-				unmaskAsNumber: false,
-				jitMasking: true,
-				numericInput: true,
-				onBeforeWrite: function(e, buffer, caretPos, opts) {
-					// if (e && (e.type === "blur" || e.type === "checkval")) {
-					// 	//handle minvalue
-					// 	var maskedValue = buffer.join(""),
-					// 		processValue = maskedValue.replace(opts.prefix, "");
-					// 	processValue = processValue.replace(opts.suffix, "");
-					// 	processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
-					// 	if (opts.radixPoint === ",") processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
-					//
-					// 	if (isFinite(processValue)) {
-					// 		if (isFinite(opts.min) && parseFloat(processValue) < parseFloat(opts.min)) {
-					// 			return {
-					// 				"refreshFromBuffer": true,
-					// 				"buffer": (opts.prefix + opts.min).split("")
-					// 			};
-					// 		}
-					// 	}
-					// 	var tmpBufSplit = opts.radixPoint !== "" ? buffer.join("").split(opts.radixPoint) : [buffer.join("")],
-					// 		matchRslt = tmpBufSplit[0].match(opts.regex.integerPart(opts)),
-					// 		matchRsltDigits = tmpBufSplit.length === 2 ? tmpBufSplit[1].match(opts.regex.integerNPart(opts)) : undefined;
-					// 	if (matchRslt) {
-					// 		if ((matchRslt[0] === opts.negationSymbol.front + "0" || matchRslt[0] === opts.negationSymbol.front || matchRslt[0] === "+") && (matchRsltDigits === undefined || matchRsltDigits[0].match(/^0+$/))) {
-					// 			buffer.splice(matchRslt.index, 1);
-					// 		}
-					// 		var radixPosition = $.inArray(opts.radixPoint, buffer);
-					// 		if (radixPosition !== -1) {
-					// 			if (isFinite(opts.digits) && !opts.digitsOptional) {
-					// 				for (var i = 1; i <= opts.digits; i++) {
-					// 					if (buffer[radixPosition + i] === undefined || buffer[radixPosition + i] === opts.placeholder.charAt(0)) {
-					// 						buffer[radixPosition + i] = "0";
-					// 					}
-					// 				}
-					// 				return {
-					// 					"refreshFromBuffer": maskedValue !== buffer.join(""),
-					// 					"buffer": buffer
-					// 				};
-					// 			} else if (radixPosition === buffer.length - opts.suffix.length - 1) {
-					// 				buffer.splice(radixPosition, 1);
-					// 				return {
-					// 					"refreshFromBuffer": true,
-					// 					"buffer": buffer
-					// 				};
-					// 			}
-					// 		}
-					// 	}
-					// }
-				},
-				regex: {
-					integerPart: function(opts) {
-						return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + "]+[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "\+]?$");
-					},
-					integerNPart: function(opts) {
-						return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + "]+");
-					}
-				},
-				signHandler: function(chrs, maskset, pos, strict, opts) {
-					// if (!strict && (opts.allowMinus && chrs === "-") || (opts.allowPlus && chrs === "+")) {
-					// 	var matchRslt = maskset.buffer.join("").match(opts.regex.integerPart(opts));
-					//
-					// 	if (matchRslt && matchRslt[0].length > 0) {
-					// 		if (maskset.buffer[matchRslt.index] === (chrs === "-" ? "+" : opts.negationSymbol.front)) {
-					// 			if (chrs === "-") {
-					// 				if (opts.negationSymbol.back !== "") {
-					// 					return {
-					// 						"pos": matchRslt.index,
-					// 						"c": opts.negationSymbol.front,
-					// 						"remove": matchRslt.index,
-					// 						"caret": pos,
-					// 						"insert": {
-					// 							"pos": maskset.buffer.length - opts.suffix.length - 1,
-					// 							"c": opts.negationSymbol.back
-					// 						}
-					// 					};
-					// 				} else {
-					// 					return {
-					// 						"pos": matchRslt.index,
-					// 						"c": opts.negationSymbol.front,
-					// 						"remove": matchRslt.index,
-					// 						"caret": pos
-					// 					};
-					// 				}
-					// 			} else {
-					// 				if (opts.negationSymbol.back !== "") {
-					// 					return {
-					// 						"pos": matchRslt.index,
-					// 						"c": "+",
-					// 						"remove": [matchRslt.index, maskset.buffer.length - opts.suffix.length - 1],
-					// 						"caret": pos
-					// 					};
-					// 				} else {
-					// 					return {
-					// 						"pos": matchRslt.index,
-					// 						"c": "+",
-					// 						"remove": matchRslt.index,
-					// 						"caret": pos
-					// 					};
-					// 				}
-					// 			}
-					// 		} else if (maskset.buffer[matchRslt.index] === (chrs === "-" ? opts.negationSymbol.front : "+")) {
-					// 			if (chrs === "-" && opts.negationSymbol.back !== "") {
-					// 				return {
-					// 					"remove": [matchRslt.index, maskset.buffer.length - opts.suffix.length - 1],
-					// 					"caret": pos - 1
-					// 				};
-					// 			} else {
-					// 				return {
-					// 					"remove": matchRslt.index,
-					// 					"caret": pos - 1
-					// 				};
-					// 			}
-					// 		} else {
-					// 			if (chrs === "-") {
-					// 				if (opts.negationSymbol.back !== "") {
-					// 					return {
-					// 						"pos": matchRslt.index,
-					// 						"c": opts.negationSymbol.front,
-					// 						"caret": pos + 1,
-					// 						"insert": {
-					// 							"pos": maskset.buffer.length - opts.suffix.length,
-					// 							"c": opts.negationSymbol.back
-					// 						}
-					// 					};
-					// 				} else {
-					// 					return {
-					// 						"pos": matchRslt.index,
-					// 						"c": opts.negationSymbol.front,
-					// 						"caret": pos + 1
-					// 					};
-					// 				}
-					// 			} else {
-					// 				return {
-					// 					"pos": matchRslt.index,
-					// 					"c": chrs,
-					// 					"caret": pos + 1
-					// 				};
-					// 			}
-					// 		}
-					// 	}
-					// }
-					return false;
-				},
-				radixHandler: function(chrs, maskset, pos, strict, opts) {
-					if ($.inArray(chrs, [",", "."]) !== -1) chrs = opts.radixPoint;
-					if (chrs === opts.radixPoint && (opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0))) {
-						var radixPos = $.inArray(opts.radixPoint, maskset.buffer);
-						if (radixPos > -1) {
-							return {
-								caret: radixPos < pos ? radixPos : radixPos + 1
-							}
-						}
-					}
-					return false;
-				},
-				leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
-					if (!strict) {
-						if (maskset.buffer[maskset.buffer.length - opts.prefix.length - 1] === "0" && maskset.buffer[maskset.buffer.length - opts.prefix.length - 2] !== opts.radixPoint) {
-							return {
-								"pos": pos,
-								"remove": maskset.buffer.length - opts.prefix.length - 1
-							};
-						}
-					}
-					return true;
-				},
-				postValidation: function(buffer, opts) {
-
-					return true;
-					//handle maxvalue
-					var isValid = true,
-						maskedValue = buffer.join(""),
-						processValue = maskedValue.replace(opts.prefix, "");
-					processValue = processValue.replace(opts.suffix, "");
-					processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
-					if (opts.radixPoint === ",") processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
-					//handle negation symbol
-					processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-");
-					processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
-					processValue = processValue === opts.negationSymbol.front ? processValue + "0" : processValue;
-
-					if (isFinite(processValue)) {
-						if (opts.max !== null && isFinite(opts.max)) {
-							isValid = parseFloat(processValue) <= parseFloat(opts.max);
-						}
-						if (isValid && opts.min !== null && isFinite(opts.min) && (processValue <= 0 || processValue.toString().length >= opts.min.toString().length)) {
-							isValid = parseFloat(processValue) >= parseFloat(opts.min);
-							if (!isValid) {
-								isValid = {
-									"refreshFromBuffer": true,
-									"buffer": (opts.prefix + opts.min).split("")
-								};
-							}
-						}
-					}
-
-					return isValid;
-				},
-				definitions: {
-					"~": {
-						validator: function(chrs, maskset, pos, strict, opts) {
-							var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-							if (!isValid) {
-								isValid = opts.radixHandler(chrs, maskset, pos, strict, opts);
-								if (!isValid) {
-									isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
-									if (isValid === true) {
-										isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts);
-										if (isValid === true && !strict && opts.radixFocus === true) {
-											//handle overwrite when fixed precision
-											var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
-											if (radixPosition !== -1 && opts.digitsOptional === false && pos <= radixPosition && pos > 0) {
-												isValid = {
-													"pos": pos - 1,
-													"remove": maskset.validPositions[pos] !== undefined ? pos - 1 : undefined
-												};
-											} //else isValid = pos >= 0;
-										}
-									}
-								}
-							}
-
-							return isValid;
-						},
-						cardinality: 1,
-						prevalidator: null
-					},
-					"+": {
-						validator: function(chrs, maskset, pos, strict, opts) {
-							var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-							if (!isValid) {
-								isValid = opts.radixHandler(chrs, maskset, pos, strict, opts);
-								if (!isValid && ((strict && opts.allowMinus && chrs === opts.negationSymbol.front) || (opts.allowMinus && chrs === "-") || (opts.allowPlus && chrs === "+"))) {
-									if (chrs === "-") {
-										if (opts.negationSymbol.back !== "") {
-											isValid = {
-												"pos": pos,
-												"c": chrs === "-" ? opts.negationSymbol.front : "+",
-												"caret": pos + 1,
-												"insert": {
-													"pos": maskset.buffer.length,
-													"c": opts.negationSymbol.back
-												}
-											};
-										} else {
-											isValid = {
-												"pos": pos,
-												"c": chrs === "-" ? opts.negationSymbol.front : "+",
-												"caret": pos + 1
-											};
-										}
-									} else {
-										isValid = true;
-									}
-								}
-							}
-							return isValid;
-						},
-						cardinality: 1,
-						prevalidator: null,
-						placeholder: ""
-					},
-					"-": {
-						validator: function(chrs, maskset, pos, strict, opts) {
-							var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-							if (!isValid) {
-								isValid = opts.radixHandler(chrs, maskset, pos, strict, opts);
-								if (!isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back) {
-									isValid = true;
-								}
-							}
-							return isValid;
-						},
-						cardinality: 1,
-						prevalidator: null,
-						placeholder: ""
-					},
-					":": {
-						validator: function(chrs, maskset, pos, strict, opts) {
-							var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-							if (!isValid) {
-								isValid = opts.radixHandler(chrs, maskset, pos, strict, opts);
-								if (!isValid) {
-									var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + ",\\." + "]";
-									isValid = new RegExp(radix).test(chrs);
-									if (!isValid && new RegExp("[0-9]").test(chrs)) {
-										if ((opts.radixFocus !== true || (opts.radixFocus === true && strict)) && pos === $.inArray(opts.radixPoint, maskset.buffer)) {
-											return isValid = {
-												pos: pos,
-												c: opts.radixPoint,
-												insert: {
-													pos: pos + 1,
-													c: chrs,
-												}
-											}
-										} else if (!strict) {
-											return isValid = {
-												pos: pos - 1,
-												c: chrs
-											}
-										}
-									}
-								}
-							}
-							return isValid !== true ? isValid : {
-								c: opts.radixPoint
-							};
-						},
-						cardinality: 1,
-						prevalidator: null,
-						definitionSymbol: "~",
-						placeholder: function(opts) {
-							return opts.radixPoint;
-						}
-					}
-				},
-				onUnMask: function(maskedValue, unmaskedValue, opts) {
-					var processValue = maskedValue.replace(opts.prefix, "");
-					processValue = processValue.replace(opts.suffix, "");
-					processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
-					if (opts.unmaskAsNumber) {
-						if (opts.radixPoint !== "" && processValue.indexOf(opts.radixPoint) !== -1) processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".");
-						return Number(processValue);
-					}
-					return processValue;
-				},
-				isComplete: function(buffer, opts) {
-					var maskedValue = buffer.join("");
-
-					var processValue = maskedValue.replace(opts.prefix, "");
-					processValue = processValue.replace(opts.suffix, "");
-					processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
-					if (opts.radixPoint === ",") processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
-					return isFinite(processValue);
-				},
-				onBeforeMask: function(initialValue, opts) {
-					if (opts.radixPoint !== "" && isFinite(initialValue)) {
-						initialValue = initialValue.toString().replace(".", opts.radixPoint);
-					} else {
-						var kommaMatches = initialValue.match(/,/g);
-						var dotMatches = initialValue.match(/\./g);
-						if (dotMatches && kommaMatches) {
-							if (dotMatches.length > kommaMatches.length) {
-								initialValue = initialValue.replace(/\./g, "");
-								initialValue = initialValue.replace(",", opts.radixPoint);
-							} else if (kommaMatches.length > dotMatches.length) {
-								initialValue = initialValue.replace(/,/g, "");
-								initialValue = initialValue.replace(".", opts.radixPoint);
-							} else { //equal
-								initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "");
-							}
-						} else {
-							initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
-						}
-					}
-
-					if (opts.digits === 0) {
-						if (initialValue.indexOf(".") !== -1) {
-							initialValue = initialValue.substring(0, initialValue.indexOf("."));
-						} else if (initialValue.indexOf(",") !== -1) {
-							initialValue = initialValue.substring(0, initialValue.indexOf(","));
-						}
-					}
-
-					if (opts.radixPoint !== "" && isFinite(opts.digits) && initialValue.indexOf(opts.radixPoint) !== -1) {
-						var valueParts = initialValue.split(opts.radixPoint),
-							decPart = valueParts[1].match(new RegExp("\\d*"))[0];
-						if (parseInt(opts.digits) < decPart.toString().length) {
-							var digitsFactor = Math.pow(10, parseInt(opts.digits));
-							//make the initialValue a valid javascript number for the parsefloat
-							initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
-							initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor;
-							initialValue = initialValue.toString().replace(".", opts.radixPoint);
-						}
-					}
-					return initialValue.toString();
-				},
-				canClearPosition: function(maskset, position, lvp, strict, opts) {
-					return true;
-					var positionInput = maskset.validPositions[position].input,
-						canClear = ((positionInput !== opts.radixPoint || (maskset.validPositions[position].match.fn !== null && opts.decimalProtect === false)) || isFinite(positionInput)) ||
-						position === lvp ||
-						positionInput === opts.groupSeparator ||
-						positionInput === opts.negationSymbol.front ||
-						positionInput === opts.negationSymbol.back;
-
-					// if (canClear && isFinite(positionInput)) {
-					// 	var matchRslt,
-					// 		radixPos = $.inArray(opts.radixPoint, maskset.buffer);
-					//
-					// 	//inject radixpoint
-					// 	var radixInjection = false;
-					// 	if (maskset.validPositions[radixPos] === undefined) {
-					// 		maskset.validPositions[radixPos] = {
-					// 			input: opts.radixPoint
-					// 		};
-					// 		radixInjection = true;
-					// 	}
-					//
-					// 	if (!strict && maskset.buffer) {
-					// 		matchRslt = maskset.buffer.join("").substr(0, position).match(opts.regex.integerNPart(opts));
-					// 		var pos = position + 1,
-					// 			isNull = matchRslt == null || parseInt(matchRslt["0"].replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "")) === 0;
-					// 		if (isNull) {
-					// 			while (maskset.validPositions[pos] && (maskset.validPositions[pos].input === opts.groupSeparator || maskset.validPositions[pos].input === "0")) {
-					// 				delete maskset.validPositions[pos];
-					// 				pos++;
-					// 			}
-					// 		}
-					// 	}
-					//
-					// 	var buffer = [];
-					// 	//build new buffer from validPositions
-					// 	for (var vp in maskset.validPositions) {
-					// 		if (maskset.validPositions[vp].input !== undefined) buffer.push(maskset.validPositions[vp].input);
-					// 	}
-					// 	//remove radix Injection
-					// 	if (radixInjection) {
-					// 		delete maskset.validPositions[radixPos];
-					// 	}
-					//
-					// 	if (radixPos > 0) {
-					// 		var bufVal = buffer.join("");
-					// 		matchRslt = bufVal.match(opts.regex.integerNPart(opts));
-					// 		if (matchRslt) {
-					// 			if (position <= radixPos) {
-					// 				if (matchRslt["0"].indexOf("0") === 0) {
-					// 					canClear = matchRslt.index !== position || opts.placeholder === "0";
-					// 				} else {
-					// 					var intPart = parseInt(matchRslt["0"].replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "")),
-					// 						radixPart = parseInt(bufVal.split(opts.radixPoint)[1]);
-					// 					if (intPart < 10 && maskset.validPositions[position] && (opts.placeholder !== "0" || radixPart > 0)) {
-					// 						maskset.validPositions[position].input = "0";
-					// 						maskset.p = opts.prefix.length + 1;
-					// 						canClear = false;
-					// 					}
-					// 				}
-					// 			} else if (matchRslt["0"].indexOf("0") === 0) {
-					// 				if (bufVal.length === 3) {
-					// 					maskset.validPositions = {};
-					// 					canClear = false;
-					// 				}
-					// 			}
-					// 		}
-					// 	}
-					// }
-
-					return canClear;
-				},
-				onKeyDown: function(e, buffer, caretPos, opts) {
-					// var $input = $(this);
-					// if (e.ctrlKey) {
-					// 	switch (e.keyCode) {
-					// 		case Inputmask.keyCode.UP:
-					// 			$input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step));
-					// 			$input.trigger("setvalue");
-					// 			break;
-					// 		case Inputmask.keyCode.DOWN:
-					// 			$input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step));
-					// 			$input.trigger("setvalue");
-					// 			break;
-					// 	}
-					// }
-				}
-			},
 			"numeric": {
 				mask: function(opts) {
 					function autoEscape(txt) {
@@ -998,10 +427,10 @@ Optional extensions on the jquery.inputmask base
 					}
 					return true;
 				},
-				postValidation: function(buffer, opts) {
+				postValidation: function(buffer, currentResult, opts) {
 					//handle maxvalue
 					var isValid = true,
-						maskedValue = buffer.join(""),
+						maskedValue = opts.numericInput ? buffer.slice().reverse().join("") : buffer.join(""),
 						processValue = maskedValue.replace(opts.prefix, "");
 					processValue = processValue.replace(opts.suffix, "");
 					processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
@@ -1013,17 +442,12 @@ Optional extensions on the jquery.inputmask base
 
 					if (isFinite(processValue)) {
 						if (opts.max !== null && isFinite(opts.max)) {
-							isValid = parseFloat(processValue) <= parseFloat(opts.max);
+							processValue = parseFloat(processValue) > parseFloat(opts.max) ? opts.max : processValue;
+							isValid = opts.postFormat((opts.prefix + processValue).split(""), 0, true, opts);
 						}
-						if (isValid && opts.min !== null && isFinite(opts.min) && (processValue <= 0 || processValue.toString().length >= opts.min.toString().length)) {
-							isValid = parseFloat(processValue) >= parseFloat(opts.min);
-							if (!isValid) {
-								isValid = $.extend(true, {
-									"refreshFromBuffer": true,
-									"buffer": (opts.prefix + opts.min).split("")
-								}, opts.postFormat((opts.prefix + opts.min).split(""), 0, true, opts));
-								isValid.refreshFromBuffer = true; //enforce refresh
-							}
+						if (opts.min !== null && isFinite(opts.min)) {
+							processValue = parseFloat(processValue) < parseFloat(opts.min) ? opts.min : processValue;
+							isValid = opts.postFormat((opts.prefix + processValue).split(""), 0, true, opts);
 						}
 					}
 

+ 2 - 2
js/inputmask.regex.extensions.js

@@ -35,6 +35,7 @@ Allows for using regular expressions as a mask
 				"r": {
 					validator: function(chrs, maskset, pos, strict, opts) {
 						var cbuffer = maskset.buffer.slice(),
+							bufferStr,
 							regexPart = "",
 							isValid = false,
 							openGroupCount = 0,
@@ -121,8 +122,7 @@ Allows for using regular expressions as a mask
 						}
 
 						function validateRegexToken(token, fromGroup) {
-							var isvalid = false,
-								bufferStr;
+							var isvalid = false;
 							if (fromGroup) {
 								regexPart += "(";
 								openGroupCount++;

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.2.6-29",
+  "version": "3.2.6-30",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": "./dist/inputmask/jquery.inputmask.js",
   "files": [

+ 1 - 1
qunit/tests_numeric.js

@@ -1324,7 +1324,7 @@ define([
 		$("#testmask").trigger("click");
 		setTimeout(function() {
 			$("#testmask").Type("1234");
-			assert.equal($("#testmask")[0].inputmask._valueGet(), "$ 123.00", "Result " + $("#testmask")[0].inputmask._valueGet());
+			assert.equal($("#testmask")[0].inputmask._valueGet(), "$ 1,000.00", "Result " + $("#testmask")[0].inputmask._valueGet());
 			done();
 		}, 5);
 	});