|
|
@@ -55,11 +55,6 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
maskTemplate.push(includeMode === false ? test.nativeDef : getPlaceholder(pos, test));
|
|
|
}
|
|
|
}
|
|
|
- if (opts.keepStatic === "auto") {
|
|
|
- if (test.newBlockMarker && test.static !== true) {
|
|
|
- opts.keepStatic = pos - 1;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
pos++;
|
|
|
} while ((maxLength === undefined || pos < maxLength) && (test.static !== true || test.def !== "") || minimalPos > pos);
|
|
|
@@ -540,7 +535,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
maskset.tests = {}; //refresh tests after possible alternating
|
|
|
start = 0;
|
|
|
end = buffer.length;
|
|
|
- p = determineNewCaretPosition({begin: 0, end: 0}, false).begin;
|
|
|
+ p = determineNewCaretPosition({ begin: 0, end: 0 }, false).begin;
|
|
|
} else {
|
|
|
for (i = start; i < end; i++) {
|
|
|
delete maskset.validPositions[i];
|
|
|
@@ -686,7 +681,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
returnRslt = isValidRslt;
|
|
|
}
|
|
|
if (maskPos == true && isValidRslt) { //return validposition on generalise
|
|
|
- returnRslt = {caretPos: i};
|
|
|
+ returnRslt = { caretPos: i };
|
|
|
}
|
|
|
}
|
|
|
if (!isValidRslt) {
|
|
|
@@ -739,7 +734,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
$.each(commandObj.remove.sort(function (a, b) {
|
|
|
return b.pos - a.pos;
|
|
|
}), function (ndx, lmnt) {
|
|
|
- revalidateMask({begin: lmnt, end: lmnt + 1});
|
|
|
+ revalidateMask({ begin: lmnt, end: lmnt + 1 });
|
|
|
});
|
|
|
commandObj.remove = undefined;
|
|
|
}
|
|
|
@@ -849,7 +844,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
if (pos.end > maskPos) {
|
|
|
maskset.validPositions[maskPos] = undefined;
|
|
|
}
|
|
|
- if (!skip && !isMask(maskPos, true)) {
|
|
|
+ if (!skip && !isMask(maskPos, opts.keepStatic)) {
|
|
|
for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) {
|
|
|
// if (!isMask(nPos, true)) {
|
|
|
// continue;
|
|
|
@@ -870,9 +865,9 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (result === false && (opts.keepStatic === false || isComplete(getBuffer()) || maskPos === 0) && !strict && fromAlternate !== true) { //try fuzzy alternator logic
|
|
|
+ if (result === false && opts.keepStatic && (isComplete(getBuffer()) || maskPos === 0) && !strict && fromAlternate !== true) { //try fuzzy alternator logic
|
|
|
result = alternate(maskPos, c, strict, fromIsValid, undefined, pos);
|
|
|
- } else if (isSelection(pos) && maskset.tests[maskPos] && maskset.tests[maskPos].length > 1 && opts.keepStatic === true && !strict && fromAlternate !== true) { //selection clears an alternated keepstatic mask ~ #2189
|
|
|
+ } else if (isSelection(pos) && maskset.tests[maskPos] && maskset.tests[maskPos].length > 1 && opts.keepStatic && !strict && fromAlternate !== true) { //selection clears an alternated keepstatic mask ~ #2189
|
|
|
result = alternate(true);
|
|
|
}
|
|
|
|
|
|
@@ -882,7 +877,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
- if ($.isFunction(opts.postValidation) && result !== false && fromIsValid !== true && validateOnly !== true) {
|
|
|
+ if ($.isFunction(opts.postValidation) && fromIsValid !== true && validateOnly !== true) {
|
|
|
var postResult = opts.postValidation(getBuffer(true), pos.begin !== undefined ? (isRTL ? pos.end : pos.begin) : pos, result, opts, maskset, strict);
|
|
|
if (postResult !== undefined) {
|
|
|
result = postResult === true ? result : postResult;
|
|
|
@@ -1048,7 +1043,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
|
|
|
if (strict !== true && pos > -1) {
|
|
|
var tests = getTests(pos);
|
|
|
- return tests.length > 1 + (tests[tests.length - 1].match.def === "" ? 1 : 0);
|
|
|
+ return tests.length > (1 + (tests[tests.length - 1].match.def === "" ? 1 : 0));
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
@@ -1057,8 +1052,8 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
if (fuzzy === undefined) fuzzy = true;
|
|
|
var position = pos + 1;
|
|
|
while (getTest(position).match.def !== "" &&
|
|
|
- ((newBlock === true && (getTest(position).match.newBlockMarker !== true || !isMask(position, undefined, true))) ||
|
|
|
- (newBlock !== true && !isMask(position, undefined, fuzzy)))) {
|
|
|
+ ((newBlock === true && (getTest(position).match.newBlockMarker !== true || !isMask(position, undefined, true))) ||
|
|
|
+ (newBlock !== true && !isMask(position, undefined, fuzzy)))) {
|
|
|
position++;
|
|
|
}
|
|
|
return position;
|
|
|
@@ -1070,10 +1065,10 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
if (position <= 0) return 0;
|
|
|
|
|
|
while (--position > 0 &&
|
|
|
- ((newBlock === true && getTest(position).match.newBlockMarker !== true) ||
|
|
|
- (newBlock !== true && !isMask(position, undefined, true) &&
|
|
|
- // eslint-disable-next-line no-empty
|
|
|
- (tests = getTests(position), tests.length < 2 || (tests.length === 2 && tests[1].match.def === ""))))) {
|
|
|
+ ((newBlock === true && getTest(position).match.newBlockMarker !== true) ||
|
|
|
+ (newBlock !== true && !isMask(position, undefined, true) &&
|
|
|
+ // eslint-disable-next-line no-empty
|
|
|
+ (tests = getTests(position), tests.length < 2 || (tests.length === 2 && tests[1].match.def === ""))))) {
|
|
|
}
|
|
|
return position;
|
|
|
}
|
|
|
@@ -1194,7 +1189,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
case "none":
|
|
|
break;
|
|
|
case "select":
|
|
|
- selectedCaret = {begin: 0, end: getBuffer().length};
|
|
|
+ selectedCaret = { begin: 0, end: getBuffer().length };
|
|
|
break;
|
|
|
case "ignore":
|
|
|
selectedCaret.end = selectedCaret.begin = seekNext(getLastValidPosition());
|
|
|
@@ -1420,9 +1415,9 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
//special treat the decimal separator
|
|
|
if ((k === 44 || k === 46) && e.location === 3 && opts.radixPoint !== "") k = opts.radixPoint.charCodeAt(0);
|
|
|
var pos = checkval ? {
|
|
|
- begin: ndx,
|
|
|
- end: ndx
|
|
|
- } : caret(input),
|
|
|
+ begin: ndx,
|
|
|
+ end: ndx
|
|
|
+ } : caret(input),
|
|
|
forwardPosition, c = String.fromCharCode(k);
|
|
|
|
|
|
maskset.writeOutBuffer = true;
|
|
|
@@ -1435,8 +1430,9 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
|
|
|
forwardPosition = ((opts.numericInput && valResult.caret === undefined) ? seekPrevious(forwardPosition) : forwardPosition);
|
|
|
if (writeOut !== false) {
|
|
|
+
|
|
|
setTimeout(function () {
|
|
|
- opts.onKeyValidation.call(input, k, valResult, opts);
|
|
|
+ opts.onKeyValidation.call(input, k, valResult);
|
|
|
}, 0);
|
|
|
if (maskset.writeOutBuffer && valResult !== false) {
|
|
|
var buffer = getBuffer();
|
|
|
@@ -1801,15 +1797,15 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
|| (getTest(ndx).match.nativeDef === " " && (getTest(ndx + 1).match.nativeDef === charCodes.charAt(0)
|
|
|
|| (getTest(ndx + 1).match.static === true && getTest(ndx + 1).match.nativeDef === ("'" + charCodes.charAt(0))))));
|
|
|
|
|
|
- if (!match && charCodeNdx > 0) inputmask.caretPos = {begin: seekNext(charCodeNdx)};
|
|
|
+ if (!match && charCodeNdx > 0) inputmask.caretPos = { begin: seekNext(charCodeNdx) };
|
|
|
return match;
|
|
|
}
|
|
|
|
|
|
resetMaskSet();
|
|
|
maskset.tests = {}; //reset tests ~ possible after alternating
|
|
|
- initialNdx = opts.radixPoint ? determineNewCaretPosition({begin: 0, end: 0}).begin : 0;
|
|
|
+ initialNdx = opts.radixPoint ? determineNewCaretPosition({ begin: 0, end: 0 }).begin : 0;
|
|
|
maskset.p = initialNdx;
|
|
|
- inputmask.caretPos = {begin: initialNdx};
|
|
|
+ inputmask.caretPos = { begin: initialNdx };
|
|
|
|
|
|
var staticMatches = [], prevCaretPos = inputmask.caretPos;
|
|
|
$.each(inputValue, function (ndx, charCode) {
|
|
|
@@ -1840,7 +1836,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
}
|
|
|
}
|
|
|
writeBuffer(undefined, getBuffer(), result.forwardPosition, keypress, false);
|
|
|
- inputmask.caretPos = {begin: result.forwardPosition, end: result.forwardPosition};
|
|
|
+ inputmask.caretPos = { begin: result.forwardPosition, end: result.forwardPosition };
|
|
|
prevCaretPos = inputmask.caretPos;
|
|
|
} else {
|
|
|
inputmask.caretPos = prevCaretPos;
|
|
|
@@ -1935,7 +1931,7 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
|
|
|
var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end;
|
|
|
input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0;
|
|
|
- input.inputmask.caretPos = {begin: begin, end: end}; //track caret internally
|
|
|
+ input.inputmask.caretPos = { begin: begin, end: end }; //track caret internally
|
|
|
if (opts.insertModeVisual && opts.insertMode === false && begin === end) end++; //set visualization for insert/overwrite mode
|
|
|
if (input === document.activeElement) {
|
|
|
if ("setSelectionRange" in input) {
|
|
|
@@ -2461,4 +2457,4 @@ module.exports = function maskScope(actionObj, maskset, opts) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-;
|
|
|
+ ;
|