|
|
@@ -3,7 +3,7 @@
|
|
|
* http://github.com/RobinHerbots/jquery.inputmask
|
|
|
* Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 2.3.5
|
|
|
+* Version: 2.3.7
|
|
|
*/
|
|
|
|
|
|
(function ($) {
|
|
|
@@ -117,39 +117,37 @@
|
|
|
case "remove":
|
|
|
return this.each(function () {
|
|
|
var $input = $(this), input = this;
|
|
|
- setTimeout(function () {
|
|
|
- if ($input.data('_inputmask')) {
|
|
|
- masksets = $input.data('_inputmask')['masksets'];
|
|
|
- activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex'];
|
|
|
- opts = $input.data('_inputmask')['opts'];
|
|
|
- //writeout the unmaskedvalue
|
|
|
- input._valueSet(maskScope(masksets, activeMasksetIndex).unmaskedvalue($input, true));
|
|
|
- //clear data
|
|
|
- $input.removeData('_inputmask');
|
|
|
- //unbind all events
|
|
|
- $input.unbind(".inputmask");
|
|
|
- $input.removeClass('focus.inputmask');
|
|
|
- //restore the value property
|
|
|
- var valueProperty;
|
|
|
- if (Object.getOwnPropertyDescriptor)
|
|
|
- valueProperty = Object.getOwnPropertyDescriptor(input, "value");
|
|
|
- if (valueProperty && valueProperty.get) {
|
|
|
- if (input._valueGet) {
|
|
|
- Object.defineProperty(input, "value", {
|
|
|
- get: input._valueGet,
|
|
|
- set: input._valueSet
|
|
|
- });
|
|
|
- }
|
|
|
- } else if (document.__lookupGetter__ && input.__lookupGetter__("value")) {
|
|
|
- if (input._valueGet) {
|
|
|
- input.__defineGetter__("value", input._valueGet);
|
|
|
- input.__defineSetter__("value", input._valueSet);
|
|
|
- }
|
|
|
+ if ($input.data('_inputmask')) {
|
|
|
+ masksets = $input.data('_inputmask')['masksets'];
|
|
|
+ activeMasksetIndex = $input.data('_inputmask')['activeMasksetIndex'];
|
|
|
+ opts = $input.data('_inputmask')['opts'];
|
|
|
+ //writeout the unmaskedvalue
|
|
|
+ input._valueSet(maskScope(masksets, activeMasksetIndex).unmaskedvalue($input, true));
|
|
|
+ //clear data
|
|
|
+ $input.removeData('_inputmask');
|
|
|
+ //unbind all events
|
|
|
+ $input.unbind(".inputmask");
|
|
|
+ $input.removeClass('focus.inputmask');
|
|
|
+ //restore the value property
|
|
|
+ var valueProperty;
|
|
|
+ if (Object.getOwnPropertyDescriptor)
|
|
|
+ valueProperty = Object.getOwnPropertyDescriptor(input, "value");
|
|
|
+ if (valueProperty && valueProperty.get) {
|
|
|
+ if (input._valueGet) {
|
|
|
+ Object.defineProperty(input, "value", {
|
|
|
+ get: input._valueGet,
|
|
|
+ set: input._valueSet
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (document.__lookupGetter__ && input.__lookupGetter__("value")) {
|
|
|
+ if (input._valueGet) {
|
|
|
+ input.__defineGetter__("value", input._valueGet);
|
|
|
+ input.__defineSetter__("value", input._valueSet);
|
|
|
}
|
|
|
- delete input._valueGet;
|
|
|
- delete input._valueSet;
|
|
|
}
|
|
|
- }, 0);
|
|
|
+ delete input._valueGet;
|
|
|
+ delete input._valueSet;
|
|
|
+ }
|
|
|
});
|
|
|
break;
|
|
|
case "getemptymask": //return the default (empty) mask value, usefull for setting the default value in validation
|
|
|
@@ -486,9 +484,12 @@
|
|
|
}
|
|
|
var newValidPosition = result.pos || maskPos;
|
|
|
if (activeMaskset['lastValidPosition'] == undefined ||
|
|
|
- (isRTL ? (opts.greedy ? activeMaskset['lastValidPosition'] > newValidPosition : newValidPosition == getActiveBuffer().length - 1)
|
|
|
- : activeMaskset['lastValidPosition'] < newValidPosition))
|
|
|
- activeMaskset['lastValidPosition'] = newValidPosition; //set new position from isValid
|
|
|
+ (isRTL ?
|
|
|
+ (opts.greedy ?
|
|
|
+ activeMaskset['lastValidPosition'] > newValidPosition :
|
|
|
+ newValidPosition == getActiveBuffer().length - 1) :
|
|
|
+ activeMaskset['lastValidPosition'] < newValidPosition))
|
|
|
+ activeMaskset['lastValidPosition'] = opts.numericInput ? 0 : newValidPosition; //set new position from isValid
|
|
|
}
|
|
|
results.push({ "activeMasksetIndex": index, "result": result });
|
|
|
}
|
|
|
@@ -640,7 +641,7 @@
|
|
|
$.each(masksets, function (ndx, ms) {
|
|
|
ms["buffer"] = ms["_buffer"].slice();
|
|
|
ms["lastValidPosition"] = undefined;
|
|
|
- ms["p"] = isRTL ? getMaskLength() : 0;
|
|
|
+ ms["p"] = (isRTL && ms["greedy"] == true) ? getMaskLength() : -1;
|
|
|
});
|
|
|
if (strict !== true) activeMasksetIndex = 0;
|
|
|
if (writeOut) input._valueSet(""); //initial clear
|
|
|
@@ -650,7 +651,7 @@
|
|
|
|
|
|
var ml = getMaskLength();
|
|
|
$.each(inputValue, function (ndx, charCode) {
|
|
|
- var index = isRTL ? (opts.numericInput ? ml : ml - ndx) : ndx,
|
|
|
+ var index = (isRTL && getActiveMaskSet()["greedy"] == true) ? (opts.numericInput ? ml : ml - ndx) : ndx,
|
|
|
lvp = getActiveMaskSet()["lastValidPosition"],
|
|
|
pos = getActiveMaskSet()["p"];
|
|
|
|
|
|
@@ -665,7 +666,7 @@
|
|
|
}
|
|
|
});
|
|
|
if (strict === true) {
|
|
|
- getActiveMaskSet()["lastValidPosition"] = isRTL ? seekNext(getActiveMaskSet()["p"]) : seekPrevious(getActiveMaskSet()["p"]);
|
|
|
+ getActiveMaskSet()["lastValidPosition"] = isRTL ? (opts.numericInput ? 0 : seekNext(getActiveMaskSet()["p"])) : seekPrevious(getActiveMaskSet()["p"]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1339,6 +1340,11 @@
|
|
|
activeMasksetIndex = ndx;
|
|
|
getActiveMaskSet()["undoBuffer"] = getActiveBuffer().join(''); //init undobuffer for recovery when not valid
|
|
|
var posend = pos.end < getMaskLength() ? pos.end : getMaskLength();
|
|
|
+ if (getActiveMaskSet()["lastValidPosition"] > pos.begin && getActiveMaskSet()["lastValidPosition"] < posend) {
|
|
|
+ getActiveMaskSet()["lastValidPosition"] = isRTL ? seekNext(posend) : seekPrevious(pos.begin);
|
|
|
+ } else {
|
|
|
+ redetermineLVP = true;
|
|
|
+ }
|
|
|
clearBuffer(getActiveBuffer(), pos.begin, posend);
|
|
|
var ml = getMaskLength();
|
|
|
if (opts.greedy == false) {
|
|
|
@@ -1349,11 +1355,6 @@
|
|
|
isRTL ? shiftR(0, posend - 1, getPlaceHolder(posend - 1), true) : shiftL(pos.begin, ml);
|
|
|
}
|
|
|
}
|
|
|
- if (getActiveMaskSet()["lastValidPosition"] > pos.begin && getActiveMaskSet()["lastValidPosition"] < posend) {
|
|
|
- getActiveMaskSet()["lastValidPosition"] = isRTL ? seekNext(posend) : seekPrevious(pos.begin);
|
|
|
- } else {
|
|
|
- redetermineLVP = true;
|
|
|
- }
|
|
|
});
|
|
|
if (redetermineLVP === true) {
|
|
|
activeMasksetIndex = initialIndex;
|
|
|
@@ -1370,7 +1371,7 @@
|
|
|
}
|
|
|
|
|
|
if (isRTL) {
|
|
|
- var p = seekPrevious(pos.end);
|
|
|
+ var p = seekPrevious(isSelection ? pos.begin : pos.end);
|
|
|
results = isValid(p, c, strict, isRTL);
|
|
|
if (strict === true) results = [{ "activeMasksetIndex": activeMasksetIndex, "result": results }];
|
|
|
$.each(results, function (index, result) {
|
|
|
@@ -1505,7 +1506,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.5
|
|
|
+Version: 2.3.7
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
|
@@ -1607,7 +1608,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2012 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.5
|
|
|
+Version: 2.3.7
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
|
@@ -2076,7 +2077,7 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.5
|
|
|
+Version: 2.3.7
|
|
|
|
|
|
Optional extensions on the jquery.inputmask base
|
|
|
*/
|
|
|
@@ -2243,11 +2244,13 @@ Input Mask plugin extensions
|
|
|
http://github.com/RobinHerbots/jquery.inputmask
|
|
|
Copyright (c) 2010 - 2013 Robin Herbots
|
|
|
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-Version: 2.3.5
|
|
|
+Version: 2.3.7
|
|
|
|
|
|
Regex extensions on the jquery.inputmask base
|
|
|
Allows for using regular expressions as a mask
|
|
|
*/
|
|
|
+
|
|
|
+/* EXPERIMENTAL */
|
|
|
(function ($) {
|
|
|
$.extend($.inputmask.defaults.aliases, { // $(selector).inputmask("Regex", { regex: "[0-9]*"}
|
|
|
'Regex': {
|