浏览代码

Cleanup numeric extensions - remove ugly postFormat overhead #614
numeric2 alias - still needs regression fixing

Robin Herbots 10 年之前
父节点
当前提交
c96a758e57

+ 3 - 2
README.md

@@ -1,4 +1,5 @@
 # jquery.inputmask 3.x
+
 Copyright (c) 2010 - 2015 Robin Herbots Licensed under the MIT license ([http://opensource.org/licenses/mit-license.php](http://opensource.org/licenses/mit-license.php))
 
 [![NPM Version][npm-image]][npm-url] [![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url]
@@ -29,7 +30,7 @@ Highlights:
 
 Demo page see [http://robinherbots.github.io/jquery.inputmask](http://robinherbots.github.io/jquery.inputmask)
 
-[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZNR3EB6JTMMSS)
+[![donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZNR3EB6JTMMSS)
 
 ## Usage:
 Include the js-files which you can find in the `dist` folder.
@@ -276,7 +277,7 @@ You can define the mask as a function which can allow to preprocess the resultin
 Just in time masking.  With the jitMasking option you can enable jit masking.  The mask will only be visible for the user entered characters.
 Default: false
 
-Value can be true or a threshold number or false. 
+Value can be true or a threshold number or false.
 
 ```javascript
    Inputmask("date", { jitMasking: true }).mask(selector);

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.2.6-26",
+  "version": "3.2.6-29",
   "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-26",
+  "version": "3.2.6-29",
   "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-26",
+  "version": "3.2.6-29",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/jquery.inputmask",

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

@@ -1,9 +1,9 @@
 /*!
 * inputmask.date.extensions.js
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
+* Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-26
+* Version: 3.2.6-29
 */
 !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);

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

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

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

@@ -1,9 +1,9 @@
 /*!
 * inputmask.extensions.js
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
+* Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-26
+* Version: 3.2.6-29
 */
 !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);

文件差异内容过多而无法显示
+ 27 - 19
dist/inputmask/inputmask.js


+ 49 - 96
dist/inputmask/inputmask.numeric.extensions.js

@@ -1,9 +1,9 @@
 /*!
 * inputmask.numeric.extensions.js
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
+* Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-26
+* Version: 3.2.6-29
 */
 !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);
@@ -23,15 +23,15 @@
                 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.placeholder && opts.integerOptional === !0, 
+                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 ? mask += "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (mask += (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}", 
+                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, mask;
+                opts.greedy = !1, console.log(mask), mask;
             },
             placeholder: "",
             greedy: !1,
@@ -62,36 +62,7 @@
             unmaskAsNumber: !1,
             jitMasking: !0,
             numericInput: !0,
-            onBeforeWrite: function(e, buffer, caretPos, opts) {
-                if (e && ("blur" === e.type || "checkval" === e.type)) {
-                    var maskedValue = buffer.join(""), processValue = maskedValue.replace(opts.prefix, "");
-                    if (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) && isFinite(opts.min) && parseFloat(processValue) < parseFloat(opts.min)) return {
-                        refreshFromBuffer: !0,
-                        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 = 2 === tmpBufSplit.length ? tmpBufSplit[1].match(opts.regex.integerNPart(opts)) : void 0;
-                    if (matchRslt) {
-                        matchRslt[0] !== opts.negationSymbol.front + "0" && matchRslt[0] !== opts.negationSymbol.front && "+" !== matchRslt[0] || void 0 !== matchRsltDigits && !matchRsltDigits[0].match(/^0+$/) || buffer.splice(matchRslt.index, 1);
-                        var radixPosition = $.inArray(opts.radixPoint, buffer);
-                        if (-1 !== radixPosition) {
-                            if (isFinite(opts.digits) && !opts.digitsOptional) {
-                                for (var i = 1; i <= opts.digits; i++) (void 0 === buffer[radixPosition + i] || buffer[radixPosition + i] === opts.placeholder.charAt(0)) && (buffer[radixPosition + i] = "0");
-                                return {
-                                    refreshFromBuffer: maskedValue !== buffer.join(""),
-                                    buffer: buffer
-                                };
-                            }
-                            if (radixPosition === buffer.length - opts.suffix.length - 1) return buffer.splice(radixPosition, 1), 
-                            {
-                                refreshFromBuffer: !0,
-                                buffer: buffer
-                            };
-                        }
-                    }
-                }
-            },
+            onBeforeWrite: function(e, buffer, caretPos, opts) {},
             regex: {
                 integerPart: function(opts) {
                     return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + "]+[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?$");
@@ -104,24 +75,22 @@
                 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 !0;
+                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) {
-                var isValid = !0, 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), ".")), 
-                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 = {
-                    refreshFromBuffer: !0,
-                    buffer: (opts.prefix + opts.min).split("")
-                }))), isValid;
+                return !0;
             },
             definitions: {
                 "~": {
@@ -130,11 +99,11 @@
                         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)))) {
+                        isValid === !0 && !strict && opts.radixFocus === !0)))) {
                             var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
-                            -1 !== radixPosition && opts.digitsOptional === !1 && pos > radixPosition + 1 && !strict && (isValid = {
+                            -1 !== radixPosition && opts.digitsOptional === !1 && radixPosition >= pos && pos > 0 && (isValid = {
                                 pos: pos - 1,
-                                remove: pos - 1
+                                remove: void 0 !== maskset.validPositions[pos] ? pos - 1 : void 0
                             });
                         }
                         return isValid;
@@ -145,7 +114,8 @@
                 "+": {
                     validator: function(chrs, maskset, pos, strict, opts) {
                         var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-                        return !isValid && (strict && opts.allowMinus && chrs === opts.negationSymbol.front || opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) && (isValid = "-" === chrs ? "" !== opts.negationSymbol.back ? {
+                        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,
@@ -157,7 +127,7 @@
                             pos: pos,
                             c: "-" === chrs ? opts.negationSymbol.front : "+",
                             caret: pos + 1
-                        } : !0), isValid;
+                        } : !0)), isValid;
                     },
                     cardinality: 1,
                     prevalidator: null,
@@ -166,7 +136,8 @@
                 "-": {
                     validator: function(chrs, maskset, pos, strict, opts) {
                         var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-                        return !isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back && (isValid = !0), 
+                        return isValid || (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts), 
+                        !isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back && (isValid = !0)), 
                         isValid;
                     },
                     cardinality: 1,
@@ -176,18 +147,31 @@
                 ":": {
                     validator: function(chrs, maskset, pos, strict, opts) {
                         var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-                        if (!isValid) {
+                        if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts), 
+                        !isValid)) {
                             var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + ",\\.]";
-                            isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = {
-                                caret: pos + 1
-                            });
+                            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 ? {
+                        return isValid !== !0 ? isValid : {
                             c: opts.radixPoint
-                        } : isValid;
+                        };
                     },
                     cardinality: 1,
                     prevalidator: null,
+                    definitionSymbol: "~",
                     placeholder: function(opts) {
                         return opts.radixPoint;
                     }
@@ -225,42 +209,9 @@
                 return initialValue.toString();
             },
             canClearPosition: function(maskset, position, lvp, strict, opts) {
-                var positionInput = maskset.validPositions[position].input, canClear = positionInput !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && opts.decimalProtect === !1 || 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), radixInjection = !1;
-                    if (void 0 === maskset.validPositions[radixPos] && (maskset.validPositions[radixPos] = {
-                        input: opts.radixPoint
-                    }, radixInjection = !0), !strict && maskset.buffer) {
-                        matchRslt = maskset.buffer.join("").substr(0, position).match(opts.regex.integerNPart(opts));
-                        var pos = position + 1, isNull = null == matchRslt || 0 === parseInt(matchRslt[0].replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""));
-                        if (isNull) for (;maskset.validPositions[pos] && (maskset.validPositions[pos].input === opts.groupSeparator || "0" === maskset.validPositions[pos].input); ) delete maskset.validPositions[pos], 
-                        pos++;
-                    }
-                    var buffer = [];
-                    for (var vp in maskset.validPositions) void 0 !== maskset.validPositions[vp].input && buffer.push(maskset.validPositions[vp].input);
-                    if (radixInjection && delete maskset.validPositions[radixPos], radixPos > 0) {
-                        var bufVal = buffer.join("");
-                        if (matchRslt = bufVal.match(opts.regex.integerNPart(opts))) if (radixPos >= position) if (0 === matchRslt[0].indexOf("0")) canClear = matchRslt.index !== position || "0" === opts.placeholder; else {
-                            var intPart = parseInt(matchRslt[0].replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "")), radixPart = parseInt(bufVal.split(opts.radixPoint)[1]);
-                            10 > intPart && maskset.validPositions[position] && ("0" !== opts.placeholder || radixPart > 0) && (maskset.validPositions[position].input = "0", 
-                            maskset.p = opts.prefix.length + 1, canClear = !1);
-                        } else 0 === matchRslt[0].indexOf("0") && 3 === bufVal.length && (maskset.validPositions = {}, 
-                        canClear = !1);
-                    }
-                }
-                return canClear;
+                return !0;
             },
-            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");
-                }
-            }
+            onKeyDown: function(e, buffer, caretPos, opts) {}
         },
         numeric: {
             mask: function(opts) {
@@ -279,7 +230,9 @@
                 }
                 opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)), 
                 opts.radixFocus = opts.radixFocus && "" !== opts.placeholder && opts.integerOptional === !0, 
-                opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~";
+                opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~", 
+                1 == opts.numericInput && (opts.radixFocus = !1, opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), 
+                opts.decimalProtect = !1);
                 var mask = autoEscape(opts.prefix);
                 return mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}", 
                 void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"), 

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

@@ -1,9 +1,9 @@
 /*!
 * inputmask.phone.extensions.js
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
+* Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-26
+* Version: 3.2.6-29
 */
 !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);

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

@@ -1,9 +1,9 @@
 /*!
 * inputmask.regex.extensions.js
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
+* Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-26
+* Version: 3.2.6-29
 */
 !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);

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

@@ -1,9 +1,9 @@
 /*!
 * jquery.inputmask.js
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
+* Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-26
+* Version: 3.2.6-29
 */
 !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);

文件差异内容过多而无法显示
+ 74 - 113
dist/jquery.inputmask.bundle.js


文件差异内容过多而无法显示
+ 2 - 2
dist/min/inputmask/inputmask.date.extensions.min.js


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

@@ -1,8 +1,8 @@
 /*!
 * inputmask.dependencyLib.jquery.min.js
 * http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
+* Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.6-26
+* Version: 3.2.6-29
 */
 !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});

文件差异内容过多而无法显示
+ 2 - 2
dist/min/inputmask/inputmask.extensions.min.js


文件差异内容过多而无法显示
+ 4 - 4
dist/min/inputmask/inputmask.min.js


文件差异内容过多而无法显示
+ 3 - 3
dist/min/inputmask/inputmask.numeric.extensions.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/min/inputmask/inputmask.phone.extensions.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/min/inputmask/inputmask.regex.extensions.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/min/inputmask/jquery.inputmask.min.js


文件差异内容过多而无法显示
+ 5 - 5
dist/min/jquery.inputmask.bundle.min.js


+ 14 - 12
js/inputmask.js

@@ -842,8 +842,9 @@
 
 								//does it match
 								if (positionCanMatchDefinition(posMatch, t.match.def)) {
-									valid = isValid(posMatch, t.input, true, true) !== false;
-									j = posMatch;
+									var result = isValid(posMatch, t.input, true, true)
+									valid = result !== false;
+									j = (result.caret || result.insert) ? getLastValidPosition() : posMatch;
 									break;
 								} else {
 									valid = t.match.fn == null;
@@ -1317,7 +1318,7 @@
 								$.each(rslt.insert.sort(function(a, b) {
 									return a - b;
 								}), function(ndx, lmnt) {
-									isValid(lmnt.pos, lmnt.c, true);
+									isValid(lmnt.pos, lmnt.c);
 								});
 							}
 
@@ -1765,9 +1766,9 @@
 				return unmaskedValue;
 			}
 
-			function caret(input, begin, end) {
+			function caret(input, begin, end, notranslate) {
 				function translatePosition(pos) {
-					if (isRTL && typeof pos === "number" && (!opts.greedy || opts.placeholder !== "")) {
+					if (notranslate !== true && isRTL && typeof pos === "number" && (!opts.greedy || opts.placeholder !== "")) {
 						var bffrLght = getBuffer().join("").length; //join is needed because sometimes we get an empty buffer element which must not be counted for the caret position (numeric alias)
 						pos = bffrLght - pos;
 					}
@@ -1902,7 +1903,7 @@
 			var EventRuler = {
 				on: function(input, eventName, eventHandler) {
 					var ev = function(e) {
-						// console.log("triggered " + e.type);
+						console.log("triggered " + e.type);
 						var inComposition = false,
 							keydownPressed = false;
 						if (this.inputmask === undefined && this.nodeName !== "FORM") { //happens when cloning an object with jquery.clone
@@ -2184,13 +2185,13 @@
 						input.title = opts.tooltip || getMaskSet().mask;
 					}
 				} else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) { //when END or PAGE_DOWN pressed set position at lastmatch
-					setTimeout(function() {
-						var caretPos = seekNext(getLastValidPosition());
-						if (!opts.insertMode && caretPos === getMaskLength() && !e.shiftKey) caretPos--;
-						caret(input, e.shiftKey ? pos.begin : caretPos, caretPos);
-					}, 0);
+					e.preventDefault();
+					var caretPos = seekNext(getLastValidPosition());
+					if (!opts.insertMode && caretPos === getMaskLength() && !e.shiftKey) caretPos--;
+					caret(input, e.shiftKey ? pos.begin : caretPos, caretPos, true);
 				} else if ((k === Inputmask.keyCode.HOME && !e.shiftKey) || k === Inputmask.keyCode.PAGE_UP) { //Home or page_up
-					caret(input, 0, e.shiftKey ? pos.begin : 0);
+					e.preventDefault();
+					caret(input, 0, e.shiftKey ? pos.begin : 0, true);
 				} else if (((opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE) || (k === 90 && e.ctrlKey)) && e.altKey !== true) { //escape && undo && #762
 					checkVal(input, true, false, undoValue.split(""));
 					$input.trigger("click");
@@ -2277,6 +2278,7 @@
 								c = valResult.c !== undefined ? valResult.c : c; //set new char from isValid
 							}
 							resetMaskSet(true);
+							console.log(valResult);
 							if (valResult.caret !== undefined) {
 								forwardPosition = valResult.caret;
 							} else {

+ 205 - 169
js/inputmask.numeric.extensions.js

@@ -62,7 +62,7 @@ Optional extensions on the jquery.inputmask base
 					}
 
 					//only allow radixfocus when placeholder = 0
-					opts.radixFocus = opts.radixFocus && opts.placeholder !== "" && opts.integerOptional === true;
+					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 = "~";
@@ -77,10 +77,10 @@ Optional extensions on the jquery.inputmask base
 					}
 
 					if (opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0)) {
-						if (opts.digitsOptional) {
-							mask += "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]";
+						if (opts.digitsOptional || isNaN(opts.digits)) {
+							mask += "[:;{1," + opts.digits + "}]";
 						} else {
-							mask += (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}";
+							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));
@@ -95,6 +95,7 @@ Optional extensions on the jquery.inputmask base
 
 					opts.greedy = false; //enforce greedy false
 
+					console.log(mask);
 					return mask;
 				},
 				placeholder: "",
@@ -127,51 +128,51 @@ Optional extensions on the jquery.inputmask base
 				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
-									};
-								}
-							}
-						}
-					}
+					// 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) {
@@ -268,26 +269,31 @@ Optional extensions on the jquery.inputmask base
 					return false;
 				},
 				radixHandler: function(chrs, maskset, pos, strict, opts) {
-					// if (!strict) {
-					// 	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),
-					// 			integerValue = maskset.buffer.join("").match(opts.regex.integerPart(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 (maskset.buffer[maskset.buffer.length - opts.prefix.length - 1] === "0") {
-					// 	return {
-					// 		"pos": pos,
-					// 		"remove": maskset.buffer.length - opts.prefix.length - 1
-					// 	};
-					// }
+					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(""),
@@ -327,15 +333,15 @@ Optional extensions on the jquery.inputmask base
 									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) {
+										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 + 1 && !strict) {
+											if (radixPosition !== -1 && opts.digitsOptional === false && pos <= radixPosition && pos > 0) {
 												isValid = {
 													"pos": pos - 1,
-													"remove": pos - 1
+													"remove": maskset.validPositions[pos] !== undefined ? pos - 1 : undefined
 												};
-											}
+											} //else isValid = pos >= 0;
 										}
 									}
 								}
@@ -349,27 +355,30 @@ Optional extensions on the jquery.inputmask base
 					"+": {
 						validator: function(chrs, maskset, pos, strict, opts) {
 							var isValid = opts.signHandler(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
-											}
-										};
+							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 = {
-											"pos": pos,
-											"c": chrs === "-" ? opts.negationSymbol.front : "+",
-											"caret": pos + 1
-										};
+										isValid = true;
 									}
-								} else {
-									isValid = true;
 								}
 							}
 							return isValid;
@@ -381,8 +390,11 @@ Optional extensions on the jquery.inputmask base
 					"-": {
 						validator: function(chrs, maskset, pos, strict, opts) {
 							var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
-							if (!isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back) {
-								isValid = true;
+							if (!isValid) {
+								isValid = opts.radixHandler(chrs, maskset, pos, strict, opts);
+								if (!isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back) {
+									isValid = true;
+								}
 							}
 							return isValid;
 						},
@@ -394,20 +406,36 @@ Optional extensions on the jquery.inputmask base
 						validator: function(chrs, maskset, pos, strict, opts) {
 							var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
 							if (!isValid) {
-								var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + ",\\." + "]";
-								isValid = new RegExp(radix).test(chrs);
-								if (isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint) {
-									isValid = {
-										"caret": pos + 1
-									};
+								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 ? {
+							return isValid !== true ? isValid : {
 								c: opts.radixPoint
-							} : isValid;
+							};
 						},
 						cardinality: 1,
 						prevalidator: null,
+						definitionSymbol: "~",
 						placeholder: function(opts) {
 							return opts.radixPoint;
 						}
@@ -475,6 +503,7 @@ Optional extensions on the jquery.inputmask base
 					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 ||
@@ -482,83 +511,83 @@ Optional extensions on the jquery.inputmask base
 						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;
-									}
-								}
-							}
-						}
-					}
+					// 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;
-						}
-					}
+					// 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": {
@@ -607,6 +636,13 @@ Optional extensions on the jquery.inputmask base
 					opts.definitions[";"] = opts.definitions["~"]; //clone integer def for decimals
 					opts.definitions[";"].definitionSymbol = "~";
 
+					if (opts.numericInput == true) { //finance people input style
+						opts.radixFocus = false;
+						opts.digitsOptional = false;
+						if (isNaN(opts.digits)) opts.digits = 2;
+						opts.decimalProtect = false;
+					}
+
 					var mask = autoEscape(opts.prefix);
 					mask += "[+]";
 					if (opts.integerOptional === true) {

+ 1 - 1
package.json

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

+ 1 - 1
qunit/tests_dynamic.js

@@ -110,7 +110,7 @@ define([
 		testmask.focus();
 		$("#testmask").Type("some.");
 		testmask.blur();
-		assert.equal(testmask.value, "some._@_", "Result " + testmask.value);
+		assert.equal(testmask.value, "some.@_", "Result " + testmask.value);
 
 
 	});