Robin Herbots 11 years ago
parent
commit
becc9e183f

+ 3 - 12
dist/inputmask/jquery.inputmask.numeric.extensions.js

@@ -69,18 +69,7 @@
                 };
             },
             onKeyDown: function(e, buffer, caretPos, opts) {
-                if (e.keyCode == $.inputmask.keyCode.TAB && "0" != opts.placeholder.charAt(0)) {
-                    var radixPosition = $.inArray(opts.radixPoint, buffer);
-                    if (-1 != radixPosition && isFinite(opts.digits)) {
-                        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: {
-                                start: ++radixPosition,
-                                end: radixPosition + opts.digits
-                            }
-                        };
-                    }
-                } else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
+                if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
                     var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
                     return rslt.caret = rslt.pos + 1, rslt;
                 }
@@ -94,6 +83,8 @@
             postProcessOnBlur: function(tmpBuffer, opts) {
                 var tmpBufSplit = "" != opts.radixPoint ? tmpBuffer.join("").split(opts.radixPoint) : [ tmpBuffer.join("") ], matchRslt = tmpBufSplit[0].match(opts.regex.integerPart(opts)), matchRsltDigits = 2 == tmpBufSplit.length ? tmpBufSplit[1].match(opts.regex.integerNPart(opts)) : void 0;
                 matchRslt && "-0" == matchRslt[matchRslt.index] && (void 0 == matchRsltDigits || matchRsltDigits[matchRsltDigits.index].match(/^0+$/)) && tmpBuffer.splice(0, 1);
+                var radixPosition = $.inArray(opts.radixPoint, tmpBuffer);
+                if (-1 != radixPosition && isFinite(opts.digits)) for (var i = 1; i <= opts.digits; i++) (void 0 == tmpBuffer[radixPosition + i] || tmpBuffer[radixPosition + i] == opts.placeholder.charAt(0)) && (tmpBuffer[radixPosition + i] = "0");
             },
             regex: {
                 integerPart: function() {

+ 3 - 12
dist/jquery.inputmask.bundle.js

@@ -1816,18 +1816,7 @@
                 };
             },
             onKeyDown: function(e, buffer, caretPos, opts) {
-                if (e.keyCode == $.inputmask.keyCode.TAB && "0" != opts.placeholder.charAt(0)) {
-                    var radixPosition = $.inArray(opts.radixPoint, buffer);
-                    if (-1 != radixPosition && isFinite(opts.digits)) {
-                        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: {
-                                start: ++radixPosition,
-                                end: radixPosition + opts.digits
-                            }
-                        };
-                    }
-                } else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
+                if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
                     var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
                     return rslt.caret = rslt.pos + 1, rslt;
                 }
@@ -1841,6 +1830,8 @@
             postProcessOnBlur: function(tmpBuffer, opts) {
                 var tmpBufSplit = "" != opts.radixPoint ? tmpBuffer.join("").split(opts.radixPoint) : [ tmpBuffer.join("") ], matchRslt = tmpBufSplit[0].match(opts.regex.integerPart(opts)), matchRsltDigits = 2 == tmpBufSplit.length ? tmpBufSplit[1].match(opts.regex.integerNPart(opts)) : void 0;
                 matchRslt && "-0" == matchRslt[matchRslt.index] && (void 0 == matchRsltDigits || matchRsltDigits[matchRsltDigits.index].match(/^0+$/)) && tmpBuffer.splice(0, 1);
+                var radixPosition = $.inArray(opts.radixPoint, tmpBuffer);
+                if (-1 != radixPosition && isFinite(opts.digits)) for (var i = 1; i <= opts.digits; i++) (void 0 == tmpBuffer[radixPosition + i] || tmpBuffer[radixPosition + i] == opts.placeholder.charAt(0)) && (tmpBuffer[radixPosition + i] = "0");
             },
             regex: {
                 integerPart: function() {

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


+ 7 - 9
js/jquery.inputmask.numeric.extensions.js

@@ -106,15 +106,7 @@ Optional extensions on the jquery.inputmask base
                 return { pos: newPos, "refreshFromBuffer": needsRefresh };
             },
             onKeyDown: function (e, buffer, caretPos, opts) {
-                if (e.keyCode == $.inputmask.keyCode.TAB && opts.placeholder.charAt(0) != "0") {
-                    var radixPosition = $.inArray(opts.radixPoint, buffer);
-                    if (radixPosition != -1 && isFinite(opts.digits)) {
-                        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": { start: ++radixPosition, end: radixPosition + opts.digits } };
-                    }
-                } else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
+                if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
                     var rslt = opts.postFormat(buffer, caretPos - 1, true, opts);
                     rslt.caret = rslt.pos + 1;
                     return rslt;
@@ -134,6 +126,12 @@ Optional extensions on the jquery.inputmask base
                 if (matchRslt && matchRslt[matchRslt.index] == "-0" && (matchRsltDigits == undefined || matchRsltDigits[matchRsltDigits.index].match(/^0+$/))) {
                     tmpBuffer.splice(0, 1);
                 }
+                var radixPosition = $.inArray(opts.radixPoint, tmpBuffer);
+                if (radixPosition != -1 && isFinite(opts.digits)) {
+                    for (var i = 1; i <= opts.digits; i++) {
+                        if (tmpBuffer[radixPosition + i] == undefined || tmpBuffer[radixPosition + i] == opts.placeholder.charAt(0)) tmpBuffer[radixPosition + i] = "0";
+                    }
+                }
             },
             regex: {
                 integerPart: function (opts) { return new RegExp('[-\+]?\\d+'); },