|
|
@@ -220,7 +220,7 @@
|
|
|
var before = lastValidPosition, after = lastValidPosition;
|
|
|
for (var posNdx in valids) {
|
|
|
var psNdx = parseInt(posNdx);
|
|
|
- (-1 == closestTo || null != valids[psNdx].match.fn) && (closestTo >= psNdx && (before = psNdx),
|
|
|
+ valids[psNdx] && null != valids[psNdx].match.fn && (closestTo >= psNdx && (before = psNdx),
|
|
|
psNdx >= closestTo && (after = psNdx));
|
|
|
}
|
|
|
return lastValidPosition = -1 != before && closestTo - before > 1 || closestTo > after ? before : after;
|
|
|
@@ -258,12 +258,14 @@
|
|
|
void 0 != t && void 0 == s ? (positionCanMatchDefinition(startPos, t.match.def) && isValid(startPos, t.input, !0) !== !1 && (delete getMaskSet().validPositions[i],
|
|
|
i++), startPos++) : i++;
|
|
|
}
|
|
|
- var lvp = getLastValidPosition();
|
|
|
- lvp >= start && void 0 != getMaskSet().validPositions[lvp] && getMaskSet().validPositions[lvp].input == opts.radixPoint && delete getMaskSet().validPositions[lvp],
|
|
|
+ var lvp = getLastValidPosition(), ml = getMaskLength();
|
|
|
+ for (lvp >= start && void 0 != getMaskSet().validPositions[lvp] && getMaskSet().validPositions[lvp].input == opts.radixPoint && delete getMaskSet().validPositions[lvp],
|
|
|
+ i = lvp + 1; ml >= i; i++) getMaskSet().validPositions[i] && delete getMaskSet().validPositions[i];
|
|
|
resetMaskSet(!0);
|
|
|
}
|
|
|
function getTestTemplate(pos, ndxIntlzr, tstPs) {
|
|
|
- for (var testPos, testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
|
|
|
+ var testPos = getMaskSet().validPositions[pos];
|
|
|
+ if (void 0 == testPos) for (var testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
|
|
|
!(testPos.match && (opts.greedy && testPos.match.optionalQuantifier !== !0 || (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0) && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
|
|
|
return testPos;
|
|
|
}
|
|
|
@@ -416,11 +418,20 @@
|
|
|
}, rslt !== !1) {
|
|
|
var elem = void 0 != rslt.c ? rslt.c : c;
|
|
|
elem = elem == opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
|
|
|
- var validatedPos = position;
|
|
|
- if (void 0 != rslt.remove && stripValidPositions(rslt.remove, rslt.remove + 1, !0),
|
|
|
- rslt.refreshFromBuffer) {
|
|
|
+ var validatedPos = position, possibleModifiedBuffer = getBuffer();
|
|
|
+ if (void 0 != rslt.remove && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]),
|
|
|
+ $.each(rslt.remove.sort(function(a, b) {
|
|
|
+ return b - a;
|
|
|
+ }), function(ndx, lmnt) {
|
|
|
+ stripValidPositions(lmnt, lmnt + 1, !0);
|
|
|
+ })), void 0 != rslt.insert && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]),
|
|
|
+ $.each(rslt.insert.sort(function(a, b) {
|
|
|
+ return a - b;
|
|
|
+ }), function(ndx, lmnt) {
|
|
|
+ isValid(lmnt.pos, lmnt.c, !0);
|
|
|
+ })), rslt.refreshFromBuffer) {
|
|
|
var refresh = rslt.refreshFromBuffer;
|
|
|
- if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end),
|
|
|
+ if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, possibleModifiedBuffer),
|
|
|
void 0 == rslt.pos && void 0 == rslt.c) return rslt.pos = getLastValidPosition(),
|
|
|
!1;
|
|
|
if (validatedPos = void 0 != rslt.pos ? rslt.pos : position, validatedPos != position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
|
|
@@ -476,7 +487,9 @@
|
|
|
}
|
|
|
strict = strict === !0;
|
|
|
for (var buffer = getBuffer(), pndx = pos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
|
|
|
- for (pndx++; pos > pndx; pndx++) void 0 == getMaskSet().validPositions[pndx] && ((!isMask(pndx) || buffer[pndx] != getPlaceholder(pndx)) && getTests(pndx).length > 1 || buffer[pndx] == opts.radixPoint || "0" == buffer[pndx] && $.inArray(opts.radixPoint, buffer) < pndx) && _isValid(pndx, buffer[pndx], !0);
|
|
|
+ for (pndx++; pos > pndx; pndx++) console.log("missing " + pndx + " " + buffer[pndx] + " ismask " + isMask(pndx) + " plchldr " + getPlaceholder(pndx) + " nrt " + getTests(pndx).len),
|
|
|
+ void 0 == getMaskSet().validPositions[pndx] && ((!isMask(pndx) || buffer[pndx] != getPlaceholder(pndx)) && getTests(pndx).length > 1 || buffer[pndx] == opts.radixPoint || "0" == buffer[pndx] && $.inArray(opts.radixPoint, buffer) < pndx) && (console.log("inject " + pndx + " " + buffer[pndx]),
|
|
|
+ _isValid(pndx, buffer[pndx], !0));
|
|
|
var maskPos = pos, result = !1, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
|
|
|
if (maskPos < getMaskLength() && (result = _isValid(maskPos, c, strict, fromSetValid),
|
|
|
!strict && result === !1)) {
|
|
|
@@ -575,7 +588,7 @@
|
|
|
}), writeOut && writeBuffer(input, getBuffer(), $(input).is(":focus") ? seekNext(getLastValidPosition(0)) : void 0, $.Event("checkval"));
|
|
|
}
|
|
|
function escapeRegex(str) {
|
|
|
- return $.inputmask.escapeRegex.call(this, str);
|
|
|
+ return $.inputmask.escapeRegex(str);
|
|
|
}
|
|
|
function unmaskedvalue($input) {
|
|
|
if ($input.data("_inputmask") && !$input.hasClass("hasDatepicker")) {
|
|
|
@@ -625,7 +638,7 @@
|
|
|
}
|
|
|
function clearOptionalTail(buffer) {
|
|
|
for (var rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
|
|
- buffer.splice(rl, lmib + 1 - rl);
|
|
|
+ return buffer.splice(rl, lmib + 1 - rl), buffer;
|
|
|
}
|
|
|
function isComplete(buffer) {
|
|
|
if ($.isFunction(opts.isComplete)) return opts.isComplete.call($el, buffer, opts);
|
|
|
@@ -634,7 +647,7 @@
|
|
|
var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l);
|
|
|
getLastValidPosition();
|
|
|
}
|
|
|
- if (void 0 == lrp.def || lrp.def.newBlockMarker || lrp.def.optionalQuantifier) {
|
|
|
+ if (void 0 == lrp.def || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) {
|
|
|
complete = !0;
|
|
|
for (var i = 0; aml >= i; i++) {
|
|
|
var mask = isMask(i), test = getTest(i);
|
|
|
@@ -1839,7 +1852,8 @@
|
|
|
opts.radixFocus = opts.radixFocus && "0" == opts.placeholder, opts.definitions[";"] = opts.definitions["~"];
|
|
|
var mask = autoEscape(opts.prefix);
|
|
|
return mask += "[+]", mask += "~{1," + opts.integerDigits + "}", void 0 != opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"),
|
|
|
- mask += autoEscape(opts.suffix), mask += "[-]", opts.greedy = !1, mask;
|
|
|
+ "" != opts.negationSymbol.back && (mask += "[-]"), mask += autoEscape(opts.suffix),
|
|
|
+ opts.greedy = !1, mask;
|
|
|
},
|
|
|
placeholder: "",
|
|
|
greedy: !1,
|
|
|
@@ -1864,13 +1878,14 @@
|
|
|
min: void 0,
|
|
|
max: void 0,
|
|
|
postFormat: function(buffer, pos, reformatOnly, opts) {
|
|
|
+ console.log("input " + buffer);
|
|
|
var 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];
|
|
|
- if ("" == opts.groupSeparator || -1 != $.inArray(opts.radixPoint, buffer) && pos >= $.inArray(opts.radixPoint, buffer) || new RegExp("[-+]").test(charAtPos)) {
|
|
|
+ if ("" == opts.groupSeparator || -1 != $.inArray(opts.radixPoint, buffer) && pos >= $.inArray(opts.radixPoint, buffer) || new RegExp("[" + $.inputmask.escapeRegex(opts.negationSymbol.front) + "+]").test(charAtPos)) {
|
|
|
if (suffixStripped) for (var i = 0, l = opts.suffix.length; l > i; i++) buffer.push(opts.suffix.charAt(i));
|
|
|
- return {
|
|
|
+ return console.log("return input " + buffer), {
|
|
|
pos: pos
|
|
|
};
|
|
|
}
|
|
|
@@ -1879,7 +1894,7 @@
|
|
|
reformatOnly ? cbuf[pos] = "?" : cbuf.splice(pos, 0, "?");
|
|
|
var bufVal = cbuf.join(""), bufValOrigin = bufVal;
|
|
|
if (bufVal.length > 0 && opts.autoGroup || reformatOnly && -1 != bufVal.indexOf(opts.groupSeparator)) {
|
|
|
- var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, 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); ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
|
|
|
@@ -1890,7 +1905,7 @@
|
|
|
for (var i = 0, l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
|
|
|
var newPos = $.inArray("?", buffer);
|
|
|
if (reformatOnly ? buffer[newPos] = charAtPos : buffer.splice(newPos, 1), !needsRefresh && suffixStripped) for (var i = 0, l = opts.suffix.length; l > i; i++) buffer.push(opts.suffix.charAt(i));
|
|
|
- return {
|
|
|
+ return console.log("formatted " + buffer + " refresh " + needsRefresh), {
|
|
|
pos: newPos,
|
|
|
refreshFromBuffer: needsRefresh,
|
|
|
buffer: buffer
|
|
|
@@ -1899,8 +1914,8 @@
|
|
|
onBeforeWrite: function(e, buffer, caretPos, opts) {
|
|
|
if (e && "blur" == e.type) {
|
|
|
var maskedValue = buffer.join(""), processValue = maskedValue.replace(opts.prefix, "");
|
|
|
- if (processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
|
|
- processValue = processValue.replace($.inputmask.escapeRegex.call(this, opts.radixPoint), "."),
|
|
|
+ if (processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
|
|
+ processValue = processValue.replace($.inputmask.escapeRegex(opts.radixPoint), "."),
|
|
|
isFinite(processValue) && isFinite(opts.min) && parseFloat(processValue) < parseFloat(opts.min)) return opts.postFormat((opts.prefix + opts.min).split(""), 0, !0, opts);
|
|
|
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;
|
|
|
!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);
|
|
|
@@ -1920,26 +1935,60 @@
|
|
|
},
|
|
|
regex: {
|
|
|
integerPart: function(opts) {
|
|
|
- return new RegExp("[" + $.inputmask.escapeRegex.call(this, opts.negationSymbol.front) + "+]?\\d*");
|
|
|
+ return new RegExp("[" + $.inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+");
|
|
|
},
|
|
|
integerNPart: function(opts) {
|
|
|
- return new RegExp("[\\d" + $.inputmask.escapeRegex.call(this, opts.groupSeparator) + "]+");
|
|
|
+ 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) return maskset.buffer[matchRslt.index] == ("-" === chrs ? "+" : opts.negationSymbol.front) ? {
|
|
|
+ if (matchRslt && matchRslt[0].length > 0) return maskset.buffer[matchRslt.index] == ("-" === chrs ? "+" : opts.negationSymbol.front) ? "-" == chrs ? "" != opts.negationSymbol.back ? {
|
|
|
pos: matchRslt.index,
|
|
|
- c: "-" === chrs ? opts.negationSymbol.front : "+",
|
|
|
+ c: opts.negationSymbol.front,
|
|
|
remove: matchRslt.index,
|
|
|
+ caret: pos,
|
|
|
+ insert: {
|
|
|
+ pos: maskset.buffer.length - opts.suffix.length - 1,
|
|
|
+ c: opts.negationSymbol.back
|
|
|
+ }
|
|
|
+ } : {
|
|
|
+ pos: matchRslt.index,
|
|
|
+ c: opts.negationSymbol.front,
|
|
|
+ remove: matchRslt.index,
|
|
|
+ caret: pos
|
|
|
+ } : "" != opts.negationSymbol.back ? {
|
|
|
+ pos: matchRslt.index,
|
|
|
+ c: "+",
|
|
|
+ remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ],
|
|
|
caret: pos
|
|
|
- } : maskset.buffer[matchRslt.index] == ("-" === chrs ? opts.negationSymbol.front : "+") ? {
|
|
|
+ } : {
|
|
|
+ pos: matchRslt.index,
|
|
|
+ c: "+",
|
|
|
remove: matchRslt.index,
|
|
|
+ caret: pos
|
|
|
+ } : maskset.buffer[matchRslt.index] == ("-" === chrs ? opts.negationSymbol.front : "+") ? "-" == chrs && "" != opts.negationSymbol.back ? {
|
|
|
+ remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ],
|
|
|
caret: pos - 1
|
|
|
} : {
|
|
|
+ remove: matchRslt.index,
|
|
|
+ caret: pos - 1
|
|
|
+ } : "-" == chrs ? "" != opts.negationSymbol.back ? {
|
|
|
pos: matchRslt.index,
|
|
|
- c: "-" === chrs ? opts.negationSymbol.front : "+",
|
|
|
+ c: opts.negationSymbol.front,
|
|
|
+ caret: pos + 1,
|
|
|
+ insert: {
|
|
|
+ pos: maskset.buffer.length - opts.suffix.length,
|
|
|
+ c: opts.negationSymbol.back
|
|
|
+ }
|
|
|
+ } : {
|
|
|
+ pos: matchRslt.index,
|
|
|
+ c: opts.negationSymbol.front,
|
|
|
+ caret: pos + 1
|
|
|
+ } : {
|
|
|
+ pos: matchRslt.index,
|
|
|
+ c: chrs,
|
|
|
caret: pos + 1
|
|
|
};
|
|
|
}
|
|
|
@@ -1982,8 +2031,10 @@
|
|
|
},
|
|
|
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.call(this, opts.groupSeparator), "g"), ""),
|
|
|
- processValue = processValue.replace($.inputmask.escapeRegex.call(this, opts.radixPoint), "."),
|
|
|
+ return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
|
|
|
+ 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) + "$"), ""),
|
|
|
isFinite(processValue) && isFinite(opts.max) && (isValid = parseFloat(processValue) <= parseFloat(opts.max)),
|
|
|
isValid;
|
|
|
},
|
|
|
@@ -1992,7 +2043,7 @@
|
|
|
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.call(this, opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs),
|
|
|
+ !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)))) {
|
|
|
var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
|
|
@@ -2011,8 +2062,19 @@
|
|
|
"+": {
|
|
|
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 = !0),
|
|
|
- isValid;
|
|
|
+ return !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,
|
|
|
@@ -2032,7 +2094,7 @@
|
|
|
validator: function(chrs, maskset, pos, strict, opts) {
|
|
|
var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
|
|
|
if (!isValid) {
|
|
|
- var radix = "[" + $.inputmask.escapeRegex.call(this, opts.radixPoint) + "]";
|
|
|
+ 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
|
|
|
});
|
|
|
@@ -2050,14 +2112,14 @@
|
|
|
autoUnmask: !1,
|
|
|
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
|
|
var processValue = maskedValue.replace(opts.prefix, "");
|
|
|
- return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), "");
|
|
|
+ return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex(opts.groupSeparator), "g"), "");
|
|
|
},
|
|
|
isComplete: function(buffer, opts) {
|
|
|
var maskedValue = buffer.join(""), bufClone = buffer.slice();
|
|
|
if (opts.postFormat(bufClone, 0, !0, opts), bufClone.join("") != maskedValue) return !1;
|
|
|
var processValue = maskedValue.replace(opts.prefix, "");
|
|
|
- return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
|
|
- "," === opts.radixPoint && (processValue = processValue.replace($.inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
|
|
|
+ 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) {
|
|
|
@@ -2065,7 +2127,7 @@
|
|
|
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.call(this, opts.groupSeparator), "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"), "");
|
|
|
}
|
|
|
return 0 == opts.digits && (-1 != initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 != initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
|
|
|
initialValue;
|
|
|
@@ -2075,7 +2137,7 @@
|
|
|
if (canClear && isFinite(positionInput)) {
|
|
|
var matchRslt = maskset.buffer.join("").substr(0, position).match(opts.regex.integerNPart(opts));
|
|
|
if (!strict) {
|
|
|
- var pos = position + 1, isNull = null == matchRslt || 0 == parseInt(matchRslt[0].replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""));
|
|
|
+ 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++;
|
|
|
}
|
|
|
@@ -2084,7 +2146,7 @@
|
|
|
matchRslt = buffer.join("").match(opts.regex.integerNPart(opts));
|
|
|
var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
|
|
if (matchRslt && (-1 == radixPosition || radixPosition >= position)) if (0 == matchRslt[0].indexOf("0")) canClear = matchRslt.index != position || -1 == radixPosition; else {
|
|
|
- var intPart = parseInt(matchRslt[0].replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""));
|
|
|
+ var intPart = parseInt(matchRslt[0].replace(new RegExp($.inputmask.escapeRegex(opts.groupSeparator), "g"), ""));
|
|
|
-1 != radixPosition && 10 > intPart && "0" == opts.placeholder.charAt(0) && (maskset.validPositions[position].input = "0",
|
|
|
maskset.p = opts.prefix.length + 1, canClear = !1);
|
|
|
}
|