|
|
@@ -3,7 +3,7 @@
|
|
|
* http://github.com/RobinHerbots/jquery.inputmask
|
|
|
* Copyright (c) 2010 - 2015 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 3.2.2
|
|
|
+* Version: 3.2.3-3
|
|
|
*/
|
|
|
!function(factory) {
|
|
|
"function" == typeof define && define.amd ? define([ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery")) : factory(window.dependencyLib || jQuery);
|
|
|
@@ -69,7 +69,7 @@
|
|
|
position = void 0 !== position ? position : mtoken.matches.length;
|
|
|
var prevMatch = mtoken.matches[position - 1];
|
|
|
if (maskdef && !escaped) {
|
|
|
- maskdef.placeholder = $.isFunction(maskdef.placeholder) ? maskdef.placeholder.call(this, opts) : maskdef.placeholder;
|
|
|
+ maskdef.placeholder = $.isFunction(maskdef.placeholder) ? maskdef.placeholder(opts) : maskdef.placeholder;
|
|
|
for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) {
|
|
|
var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality;
|
|
|
mtoken.matches.splice(position++, 0, {
|
|
|
@@ -225,7 +225,7 @@
|
|
|
return mask = mask.toString();
|
|
|
}
|
|
|
var ms;
|
|
|
- if ($.isFunction(opts.mask) && (opts.mask = opts.mask.call(this, opts)), $.isArray(opts.mask)) {
|
|
|
+ if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) {
|
|
|
if (opts.mask.length > 1) {
|
|
|
opts.keepStatic = null === opts.keepStatic ? !0 : opts.keepStatic;
|
|
|
var altMask = "(";
|
|
|
@@ -911,7 +911,7 @@
|
|
|
var caretPos = caret(input);
|
|
|
caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1);
|
|
|
}, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin !== getMaskLength() ? pos.begin : pos.begin - 1)),
|
|
|
- opts.onKeyDown.call(this, e, getBuffer(), caret(input).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables);
|
|
|
+ opts.onKeyDown(e, getBuffer(), caret(input).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables);
|
|
|
}
|
|
|
function keypressEvent(e, checkval, writeOut, strict, ndx) {
|
|
|
var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode;
|
|
|
@@ -950,7 +950,7 @@
|
|
|
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
|
|
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
|
|
if (opts.showTooltip && $input.prop("title", getMaskSet().mask), checkval && $.isFunction(opts.onBeforeWrite)) {
|
|
|
- var result = opts.onBeforeWrite.call(this, e, getBuffer(), forwardPosition, opts);
|
|
|
+ var result = opts.onBeforeWrite(e, getBuffer(), forwardPosition, opts);
|
|
|
if (result && result.refreshFromBuffer) {
|
|
|
var refresh = result.refreshFromBuffer;
|
|
|
refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, result.buffer),
|
|
|
@@ -1114,14 +1114,13 @@
|
|
|
var undoValue, compositionCaretPos, compositionData, el, $el, maxLength, valueBuffer, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !0;
|
|
|
if (void 0 !== actionObj) switch (actionObj.action) {
|
|
|
case "isComplete":
|
|
|
- return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts,
|
|
|
- isComplete(actionObj.buffer);
|
|
|
+ return el = actionObj.el, isComplete(getBuffer());
|
|
|
|
|
|
case "unmaskedvalue":
|
|
|
return el = actionObj.el, void 0 !== el && void 0 !== el.inputmask ? (maskset = el.inputmask.maskset,
|
|
|
opts = el.inputmask.opts, isRTL = el.inputmask.isRTL, valueBuffer = isRTL ? el.inputmask._valueGet().split("").reverse().join("") : el.inputmask._valueGet()) : valueBuffer = actionObj.value,
|
|
|
- opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, valueBuffer, opts) || valueBuffer : valueBuffer).split(""),
|
|
|
- checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts),
|
|
|
+ opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(valueBuffer, opts) || valueBuffer : valueBuffer).split(""),
|
|
|
+ checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite(void 0, getBuffer(), 0, opts),
|
|
|
unmaskedvalue(el);
|
|
|
|
|
|
case "mask":
|
|
|
@@ -1130,11 +1129,13 @@
|
|
|
break;
|
|
|
|
|
|
case "format":
|
|
|
- return opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split(""),
|
|
|
- checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite.call(this, void 0, getBuffer(), 0, opts),
|
|
|
+ return opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(actionObj.value, opts) || actionObj.value : actionObj.value).split(""),
|
|
|
+ checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite(void 0, getBuffer(), 0, opts),
|
|
|
actionObj.metadata ? {
|
|
|
value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
|
|
|
- metadata: $el.inputmask("getmetadata")
|
|
|
+ metadata: maskScope({
|
|
|
+ action: "getmetadata"
|
|
|
+ }, maskset, opts)
|
|
|
} : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
|
|
|
|
|
|
case "isValid":
|
|
|
@@ -1143,8 +1144,7 @@
|
|
|
return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === buffer.join("");
|
|
|
|
|
|
case "getemptymask":
|
|
|
- return el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts,
|
|
|
- getBufferTemplate();
|
|
|
+ return getBufferTemplate();
|
|
|
|
|
|
case "remove":
|
|
|
el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts,
|
|
|
@@ -1159,8 +1159,7 @@
|
|
|
break;
|
|
|
|
|
|
case "getmetadata":
|
|
|
- if (el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts,
|
|
|
- $.isArray(maskset.metadata)) {
|
|
|
+ if ($.isArray(maskset.metadata)) {
|
|
|
for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 !== getMaskSet().validPositions[firstAlt].alternation) {
|
|
|
alternation = getMaskSet().validPositions[firstAlt].alternation;
|
|
|
break;
|
|
|
@@ -1281,39 +1280,36 @@
|
|
|
}), this.el.inputmask = void 0, this.el) : void 0;
|
|
|
},
|
|
|
getemptymask: function() {
|
|
|
- return this.el ? maskScope({
|
|
|
- action: "getemptymask",
|
|
|
- el: this.el
|
|
|
- }) : void 0;
|
|
|
+ return maskScope({
|
|
|
+ action: "getemptymask"
|
|
|
+ }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
|
|
|
},
|
|
|
hasMaskedValue: function() {
|
|
|
return !this.opts.autoUnmask;
|
|
|
},
|
|
|
isComplete: function() {
|
|
|
- return this.el ? maskScope({
|
|
|
+ return maskScope({
|
|
|
action: "isComplete",
|
|
|
- buffer: this.el.inputmask._valueGet().split(""),
|
|
|
el: this.el
|
|
|
- }) : void 0;
|
|
|
+ }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
|
|
|
},
|
|
|
getmetadata: function() {
|
|
|
- return this.el ? maskScope({
|
|
|
- action: "getmetadata",
|
|
|
- el: this.el
|
|
|
- }) : void 0;
|
|
|
+ return maskScope({
|
|
|
+ action: "getmetadata"
|
|
|
+ }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
|
|
|
},
|
|
|
isValid: function(value) {
|
|
|
return maskScope({
|
|
|
action: "isValid",
|
|
|
value: value
|
|
|
- }, generateMaskSet(this.opts, this.noMasksCache), this.opts);
|
|
|
+ }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
|
|
|
},
|
|
|
format: function(value, metadata) {
|
|
|
return maskScope({
|
|
|
action: "format",
|
|
|
value: value,
|
|
|
metadata: metadata
|
|
|
- }, generateMaskSet(this.opts, this.noMasksCache), this.opts);
|
|
|
+ }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
|
|
|
}
|
|
|
}, Inputmask.extendDefaults = function(options) {
|
|
|
$.extend(Inputmask.prototype.defaults, options);
|