|
|
@@ -3,7 +3,7 @@
|
|
|
* https://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.3.2-27
|
|
|
+* Version: 3.3.2-34
|
|
|
*/
|
|
|
!function($) {
|
|
|
function Inputmask(alias, options) {
|
|
|
@@ -683,9 +683,10 @@
|
|
|
return position;
|
|
|
}
|
|
|
function seekPrevious(pos, newBlock) {
|
|
|
- var position = pos;
|
|
|
+ var tests, position = pos;
|
|
|
if (0 >= position) return 0;
|
|
|
- for (;--position > 0 && (newBlock === !0 && getTest(position).match.newBlockMarker !== !0 || newBlock !== !0 && !isMask(position) && getTests(position).length < 2); ) ;
|
|
|
+ for (;--position > 0 && (newBlock === !0 && getTest(position).match.newBlockMarker !== !0 || newBlock !== !0 && !isMask(position) && (tests = getTests(position),
|
|
|
+ tests.length < 2 || 2 === tests.length && "" === tests[1].match.def)); ) ;
|
|
|
return position;
|
|
|
}
|
|
|
function getBufferElement(position) {
|
|
|
@@ -2174,27 +2175,28 @@
|
|
|
unmaskAsNumber: !1,
|
|
|
postFormat: function(buffer, pos, opts) {
|
|
|
opts.numericInput === !0 && (buffer = buffer.reverse(), isFinite(pos) && (pos = buffer.join("").length - pos - 1));
|
|
|
- var i, l, suffixStripped = !1;
|
|
|
- buffer.length >= opts.suffix.length && buffer.join("").indexOf(opts.suffix) === buffer.length - opts.suffix.length && (buffer.length = buffer.length - opts.suffix.length,
|
|
|
- suffixStripped = !0), pos = pos >= buffer.length ? buffer.length - 1 : pos < opts.prefix.length ? opts.prefix.length : pos;
|
|
|
- var needsRefresh = !1, charAtPos = buffer[pos], cbuf = buffer.slice();
|
|
|
+ var i, l;
|
|
|
+ pos = pos >= buffer.length ? buffer.length - 1 : pos < opts.prefix.length ? opts.prefix.length : pos;
|
|
|
+ var charAtPos = buffer[pos], cbuf = buffer.slice();
|
|
|
charAtPos === opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
|
|
|
- charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (cbuf[pos] = "?");
|
|
|
+ cbuf[pos] = "!";
|
|
|
var bufVal = cbuf.join(""), bufValOrigin = bufVal;
|
|
|
- if (bufVal.length > 0 && opts.autoGroup || -1 !== bufVal.indexOf(opts.groupSeparator)) {
|
|
|
+ if (bufVal = bufVal.replace(new RegExp(Inputmask.escapeRegex(opts.suffix) + "$"), ""),
|
|
|
+ bufVal = bufVal.replace(new RegExp("^" + Inputmask.escapeRegex(opts.prefix)), ""),
|
|
|
+ bufVal.length > 0 && opts.autoGroup || -1 !== bufVal.indexOf(opts.groupSeparator)) {
|
|
|
var escapedGroupSeparator = Inputmask.escapeRegex(opts.groupSeparator);
|
|
|
- needsRefresh = 0 === bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
|
|
|
- var radixSplit = bufVal.split(opts.radixPoint);
|
|
|
- if (bufVal = "" === opts.radixPoint ? bufVal : radixSplit[0], bufVal !== opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal) && "" !== opts.groupSeparator; ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
|
|
|
+ bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
|
|
|
+ var radixSplit = bufVal.split(charAtPos === opts.radixPoint ? "!" : opts.radixPoint);
|
|
|
+ if (bufVal = "" === opts.radixPoint ? bufVal : radixSplit[0], charAtPos !== opts.negationSymbol.front && (bufVal = bufVal.replace("!", "?")),
|
|
|
+ bufVal.length > opts.groupSize) for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal) && "" !== opts.groupSeparator; ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
|
|
|
bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
|
|
|
- "" !== opts.radixPoint && radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
|
|
|
+ bufVal = bufVal.replace("?", "!"), "" !== opts.radixPoint && radixSplit.length > 1 && (bufVal += (charAtPos === opts.radixPoint ? "!" : opts.radixPoint) + radixSplit[1]);
|
|
|
}
|
|
|
- for (needsRefresh = bufValOrigin !== bufVal, buffer.length = bufVal.length, i = 0,
|
|
|
- l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
|
|
|
- var newPos = $.inArray("?", buffer);
|
|
|
- if (-1 === newPos && (newPos = $.inArray(charAtPos, buffer)), buffer[newPos] = charAtPos,
|
|
|
- !needsRefresh && suffixStripped) for (i = 0, l = opts.suffix.length; l > i; i++) buffer.push(opts.suffix.charAt(i));
|
|
|
- return newPos = opts.numericInput && isFinite(pos) ? buffer.join("").length - newPos - 1 : newPos,
|
|
|
+ bufVal = opts.prefix + bufVal + opts.suffix;
|
|
|
+ var needsRefresh = bufValOrigin !== bufVal;
|
|
|
+ if (needsRefresh) for (buffer.length = bufVal.length, i = 0, l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
|
|
|
+ var newPos = $.inArray("!", bufVal);
|
|
|
+ return buffer[newPos] = charAtPos, newPos = opts.numericInput && isFinite(pos) ? buffer.join("").length - newPos - 1 : newPos,
|
|
|
opts.numericInput && (buffer = buffer.reverse(), $.inArray(opts.radixPoint, buffer) < newPos && buffer.join("").length - opts.suffix.length !== newPos && (newPos -= 1)),
|
|
|
{
|
|
|
pos: newPos,
|
|
|
@@ -2314,22 +2316,27 @@
|
|
|
return !1;
|
|
|
},
|
|
|
leadingZeroHandler: function(chrs, maskset, pos, strict, opts, isSelection) {
|
|
|
- if (!strict) if (opts.numericInput === !0) {
|
|
|
- var buffer = maskset.buffer.slice("").reverse(), bufferChar = buffer[opts.prefix.length];
|
|
|
- if ("0" === bufferChar && void 0 === maskset.validPositions[pos - 1]) return {
|
|
|
- pos: pos,
|
|
|
- remove: buffer.length - opts.prefix.length - 1
|
|
|
- };
|
|
|
- } else {
|
|
|
- var radixPosition = $.inArray(opts.radixPoint, maskset.buffer), matchRslt = maskset.buffer.slice(0, -1 !== radixPosition ? radixPosition : void 0).join("").match(opts.regex.integerNPart(opts));
|
|
|
- if (matchRslt && (-1 === radixPosition || radixPosition >= pos)) {
|
|
|
- var decimalPart = -1 === radixPosition ? 0 : parseInt(maskset.buffer.slice(radixPosition + 1).join(""));
|
|
|
- if (0 === matchRslt[0].indexOf("" !== opts.placeholder ? opts.placeholder.charAt(0) : "0") && (matchRslt.index + 1 === pos || isSelection !== !0 && 0 === decimalPart)) return maskset.buffer.splice(matchRslt.index, 1),
|
|
|
- {
|
|
|
- pos: matchRslt.index,
|
|
|
- remove: matchRslt.index
|
|
|
+ if (!strict) {
|
|
|
+ var buffer = maskset.buffer.slice("");
|
|
|
+ if (buffer.splice(0, opts.prefix.length), buffer.splice(buffer.length - opts.suffix.length, opts.suffix.length),
|
|
|
+ opts.numericInput === !0) {
|
|
|
+ var buffer = buffer.reverse(), bufferChar = buffer[0];
|
|
|
+ if ("0" === bufferChar && void 0 === maskset.validPositions[pos - 1]) return {
|
|
|
+ pos: pos,
|
|
|
+ remove: buffer.length - 1
|
|
|
};
|
|
|
- if ("0" === chrs && pos <= matchRslt.index && matchRslt[0] !== opts.groupSeparator) return !1;
|
|
|
+ } else {
|
|
|
+ pos -= opts.prefix.length;
|
|
|
+ var radixPosition = $.inArray(opts.radixPoint, buffer), matchRslt = buffer.slice(0, -1 !== radixPosition ? radixPosition : void 0).join("").match(opts.regex.integerNPart(opts));
|
|
|
+ if (matchRslt && (-1 === radixPosition || radixPosition >= pos)) {
|
|
|
+ var decimalPart = -1 === radixPosition ? 0 : parseInt(buffer.slice(radixPosition + 1).join(""));
|
|
|
+ if (0 === matchRslt[0].indexOf("" !== opts.placeholder ? opts.placeholder.charAt(0) : "0") && (matchRslt.index + 1 === pos || isSelection !== !0 && 0 === decimalPart)) return maskset.buffer.splice(matchRslt.index + opts.prefix.length, 1),
|
|
|
+ {
|
|
|
+ pos: matchRslt.index + opts.prefix.length,
|
|
|
+ remove: matchRslt.index + opts.prefix.length
|
|
|
+ };
|
|
|
+ if ("0" === chrs && pos <= matchRslt.index && matchRslt[0] !== opts.groupSeparator) return !1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return !0;
|