|
@@ -69,18 +69,7 @@
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onKeyDown: function(e, buffer, caretPos, opts) {
|
|
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);
|
|
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
|
|
return rslt.caret = rslt.pos + 1, rslt;
|
|
return rslt.caret = rslt.pos + 1, rslt;
|
|
|
}
|
|
}
|
|
@@ -94,6 +83,8 @@
|
|
|
postProcessOnBlur: function(tmpBuffer, opts) {
|
|
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;
|
|
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);
|
|
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: {
|
|
regex: {
|
|
|
integerPart: function() {
|
|
integerPart: function() {
|