|
|
@@ -3,7 +3,7 @@
|
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
|
* Copyright (c) 2010 - 2018 Robin Herbots
|
|
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
|
-* Version: 4.0.1-beta.34
|
|
|
+* Version: 4.0.1-beta.35
|
|
|
*/
|
|
|
|
|
|
!function(modules) {
|
|
|
@@ -62,185 +62,80 @@
|
|
|
_inputmask4.default === _jquery2.default && __webpack_require__(9), window.Inputmask = _inputmask2.default;
|
|
|
}, function(module, exports, __webpack_require__) {
|
|
|
"use strict";
|
|
|
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
|
|
|
- return typeof obj;
|
|
|
- } : function(obj) {
|
|
|
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
|
- };
|
|
|
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
|
|
+ "function" == typeof Symbol && Symbol.iterator;
|
|
|
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2), __webpack_require__(4) ],
|
|
|
void 0 === (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof (__WEBPACK_AMD_DEFINE_FACTORY__ = function($, Inputmask) {
|
|
|
- var formatCode = {
|
|
|
- d: [ "[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", Date.prototype.getDate ],
|
|
|
- dd: [ "0[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", function() {
|
|
|
- return pad(Date.prototype.getDate.call(this), 2);
|
|
|
- } ],
|
|
|
- ddd: [ "" ],
|
|
|
- dddd: [ "" ],
|
|
|
- m: [ "[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
|
|
|
- return Date.prototype.getMonth.call(this) + 1;
|
|
|
- } ],
|
|
|
- mm: [ "0[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
|
|
|
- return pad(Date.prototype.getMonth.call(this) + 1, 2);
|
|
|
- } ],
|
|
|
- mmm: [ "" ],
|
|
|
- mmmm: [ "" ],
|
|
|
- yy: [ "[0-9]{2}", Date.prototype.setFullYear, "year", function() {
|
|
|
- return pad(Date.prototype.getFullYear.call(this), 2);
|
|
|
- } ],
|
|
|
- yyyy: [ "[0-9]{4}", Date.prototype.setFullYear, "year", function() {
|
|
|
- return pad(Date.prototype.getFullYear.call(this), 4);
|
|
|
- } ],
|
|
|
- h: [ "[1-9]|1[0-2]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
- hh: [ "0[1-9]|1[0-2]", Date.prototype.setHours, "hours", function() {
|
|
|
- return pad(Date.prototype.getHours.call(this), 2);
|
|
|
- } ],
|
|
|
- hhh: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
- H: [ "1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
- HH: [ "[01][0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
|
|
|
- return pad(Date.prototype.getHours.call(this), 2);
|
|
|
- } ],
|
|
|
- HHH: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
- M: [ "[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes ],
|
|
|
- MM: [ "[0-5][0-9]", Date.prototype.setMinutes, "minutes", function() {
|
|
|
- return pad(Date.prototype.getMinutes.call(this), 2);
|
|
|
- } ],
|
|
|
- s: [ "[1-5]?[0-9]", Date.prototype.setSeconds, "seconds", Date.prototype.getSeconds ],
|
|
|
- ss: [ "[0-5][0-9]", Date.prototype.setSeconds, "seconds", function() {
|
|
|
- return pad(Date.prototype.getSeconds.call(this), 2);
|
|
|
- } ],
|
|
|
- l: [ "[0-9]{3}", Date.prototype.setMilliseconds, "milliseconds", function() {
|
|
|
- return pad(Date.prototype.getMilliseconds.call(this), 3);
|
|
|
- } ],
|
|
|
- L: [ "[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function() {
|
|
|
- return pad(Date.prototype.getMilliseconds.call(this), 2);
|
|
|
- } ],
|
|
|
- t: [ "[ap]" ],
|
|
|
- tt: [ "[ap]m" ],
|
|
|
- T: [ "[AP]" ],
|
|
|
- TT: [ "[AP]M" ],
|
|
|
- Z: [ "" ],
|
|
|
- o: [ "" ],
|
|
|
- S: [ "" ]
|
|
|
- }, formatAlias = {
|
|
|
- isoDate: "yyyy-mm-dd",
|
|
|
- isoTime: "HH:MM:ss",
|
|
|
- isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
|
|
|
- isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
|
|
|
- };
|
|
|
- function getTokenizer(opts) {
|
|
|
- if (!opts.tokenizer) {
|
|
|
- var tokens = [];
|
|
|
- for (var ndx in formatCode) -1 === tokens.indexOf(ndx[0]) && tokens.push(ndx[0]);
|
|
|
- opts.tokenizer = "(" + tokens.join("+|") + ")+?|.", opts.tokenizer = new RegExp(opts.tokenizer, "g");
|
|
|
- }
|
|
|
- return opts.tokenizer;
|
|
|
- }
|
|
|
- function parse(format, dateObjValue, opts, raw) {
|
|
|
- for (var match, mask = ""; match = getTokenizer(opts).exec(format); ) if (void 0 === dateObjValue) if (formatCode[match[0]]) mask += "(" + formatCode[match[0]][0] + ")"; else switch (match[0]) {
|
|
|
- case "[":
|
|
|
- mask += "(";
|
|
|
- break;
|
|
|
-
|
|
|
- case "]":
|
|
|
- mask += ")?";
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- mask += Inputmask.escapeRegex(match[0]);
|
|
|
- } else if (formatCode[match[0]]) if (!0 !== raw && formatCode[match[0]][3]) {
|
|
|
- var getFn = formatCode[match[0]][3];
|
|
|
- mask += getFn.call(dateObjValue.date);
|
|
|
- } else formatCode[match[0]][2] ? mask += dateObjValue["raw" + formatCode[match[0]][2]] : mask += match[0]; else mask += match[0];
|
|
|
- return mask;
|
|
|
- }
|
|
|
- function pad(val, len) {
|
|
|
- for (val = String(val), len = len || 2; val.length < len; ) val = "0" + val;
|
|
|
- return val;
|
|
|
- }
|
|
|
- function analyseMask(maskString, format, opts) {
|
|
|
- var targetProp, match, dateOperation, targetValidator, dateObj = {
|
|
|
- date: new Date(1, 0, 1)
|
|
|
- }, mask = maskString;
|
|
|
- function extendProperty(value) {
|
|
|
- var correctedValue;
|
|
|
- if (opts.min && opts.min[targetProp] || opts.max && opts.max[targetProp]) {
|
|
|
- var min = opts.min && opts.min[targetProp] || opts.max[targetProp], max = opts.max && opts.max[targetProp] || opts.min[targetProp];
|
|
|
- for (correctedValue = value.replace(/[^0-9]/g, ""), correctedValue += (min.indexOf(correctedValue) < max.indexOf(correctedValue) ? max : min).toString().substr(correctedValue.length); !new RegExp(targetValidator).test(correctedValue); ) correctedValue--;
|
|
|
- } else correctedValue = value.replace(/[^0-9]/g, "0");
|
|
|
- return correctedValue;
|
|
|
- }
|
|
|
- function setValue(dateObj, value, opts) {
|
|
|
- dateObj[targetProp] = extendProperty(value), dateObj["raw" + targetProp] = value,
|
|
|
- void 0 !== dateOperation && dateOperation.call(dateObj.date, "month" == targetProp ? parseInt(dateObj[targetProp]) - 1 : dateObj[targetProp]);
|
|
|
- }
|
|
|
- if ("string" == typeof mask) {
|
|
|
- for (;match = getTokenizer(opts).exec(format); ) {
|
|
|
- var value = mask.slice(0, match[0].length);
|
|
|
- formatCode.hasOwnProperty(match[0]) && (targetValidator = formatCode[match[0]][0],
|
|
|
- targetProp = formatCode[match[0]][2], dateOperation = formatCode[match[0]][1], setValue(dateObj, value)),
|
|
|
- mask = mask.slice(value.length);
|
|
|
- }
|
|
|
- return dateObj;
|
|
|
+ return Inputmask.extendDefinitions({
|
|
|
+ A: {
|
|
|
+ validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
|
|
+ casing: "upper"
|
|
|
+ },
|
|
|
+ "&": {
|
|
|
+ validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
|
|
+ casing: "upper"
|
|
|
+ },
|
|
|
+ "#": {
|
|
|
+ validator: "[0-9A-Fa-f]",
|
|
|
+ casing: "upper"
|
|
|
}
|
|
|
- if (mask && "object" === (void 0 === mask ? "undefined" : _typeof(mask)) && mask.hasOwnProperty("date")) return mask;
|
|
|
- }
|
|
|
- return Inputmask.extendAliases({
|
|
|
- datetime: {
|
|
|
- mask: function(opts) {
|
|
|
- return formatCode.S = opts.i18n.ordinalSuffix.join("|"), opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat,
|
|
|
- opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat,
|
|
|
- opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat,
|
|
|
- opts.placeholder = "" !== opts.placeholder ? opts.placeholder : opts.inputFormat.replace(/[\[\]]/, ""),
|
|
|
- opts.regex = parse(opts.inputFormat, void 0, opts), null;
|
|
|
+ }), Inputmask.extendAliases({
|
|
|
+ cssunit: {
|
|
|
+ regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"
|
|
|
+ },
|
|
|
+ url: {
|
|
|
+ regex: "(https?|ftp)//.*",
|
|
|
+ autoUnmask: !1
|
|
|
+ },
|
|
|
+ ip: {
|
|
|
+ mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
|
|
+ definitions: {
|
|
|
+ i: {
|
|
|
+ validator: function(chrs, maskset, pos, strict, opts) {
|
|
|
+ return -1 < pos - 1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
|
|
+ chrs = -1 < pos - 2 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
|
|
|
+ new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- placeholder: "",
|
|
|
- inputFormat: "isoDateTime",
|
|
|
- displayFormat: void 0,
|
|
|
- outputFormat: void 0,
|
|
|
- min: null,
|
|
|
- max: null,
|
|
|
- i18n: {
|
|
|
- dayNames: [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ],
|
|
|
- monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
|
|
|
- ordinalSuffix: [ "st", "nd", "rd", "th" ]
|
|
|
+ onUnMask: function(maskedValue, unmaskedValue, opts) {
|
|
|
+ return maskedValue;
|
|
|
},
|
|
|
- postValidation: function(buffer, pos, currentResult, opts) {
|
|
|
- opts.min = analyseMask(opts.min, opts.inputFormat, opts), opts.max = analyseMask(opts.max, opts.inputFormat, opts);
|
|
|
- var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts);
|
|
|
- return result && dateParts.date.getTime() == dateParts.date.getTime() && (result = (result = function(dateParts, currentResult) {
|
|
|
- return (!isFinite(dateParts.rawday) || "29" == dateParts.day && !isFinite(dateParts.rawyear) || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) && currentResult;
|
|
|
- }(dateParts, result)) && function(dateParts, opts) {
|
|
|
- var result = !0;
|
|
|
- if (opts.min) {
|
|
|
- if (dateParts.rawyear) {
|
|
|
- var rawYear = dateParts.rawyear.replace(/[^0-9]/g, ""), minYear = opts.min.year.substr(0, rawYear.length);
|
|
|
- result = minYear <= rawYear;
|
|
|
- }
|
|
|
- dateParts.year === dateParts.rawyear && opts.min.date.getTime() == opts.min.date.getTime() && (result = opts.min.date.getTime() <= dateParts.date.getTime());
|
|
|
- }
|
|
|
- return result && opts.max && opts.max.date.getTime() == opts.max.date.getTime() && (result = opts.max.date.getTime() >= dateParts.date.getTime()),
|
|
|
- result;
|
|
|
- }(dateParts, opts)), pos && result && currentResult.pos !== pos ? {
|
|
|
- buffer: parse(opts.inputFormat, dateParts, opts),
|
|
|
- refreshFromBuffer: {
|
|
|
- start: pos,
|
|
|
- end: currentResult.pos
|
|
|
- }
|
|
|
- } : result;
|
|
|
+ inputmode: "numeric"
|
|
|
+ },
|
|
|
+ email: {
|
|
|
+ mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
|
|
|
+ greedy: !1,
|
|
|
+ casing: "lower",
|
|
|
+ onBeforePaste: function(pastedValue, opts) {
|
|
|
+ return (pastedValue = pastedValue.toLowerCase()).replace("mailto:", "");
|
|
|
},
|
|
|
- onKeyDown: function(e, buffer, caretPos, opts) {
|
|
|
- if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
|
|
|
- for (var match, today = new Date(), date = ""; match = getTokenizer(opts).exec(opts.inputFormat); ) "d" === match[0].charAt(0) ? date += pad(today.getDate(), match[0].length) : "m" === match[0].charAt(0) ? date += pad(today.getMonth() + 1, match[0].length) : "yyyy" === match[0] ? date += today.getFullYear().toString() : "y" === match[0].charAt(0) && (date += pad(today.getYear(), match[0].length));
|
|
|
- this.inputmask._valueSet(date), $(this).trigger("setvalue");
|
|
|
+ definitions: {
|
|
|
+ "*": {
|
|
|
+ validator: "[0-91-9A-Za-zА-яЁёÀ-ÿµ!#$%&'*+/=?^_`{|}~-]"
|
|
|
+ },
|
|
|
+ "-": {
|
|
|
+ validator: "[0-9A-Za-z-]"
|
|
|
}
|
|
|
},
|
|
|
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
|
|
- return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, !0);
|
|
|
+ return maskedValue;
|
|
|
},
|
|
|
- casing: function(elem, test, pos, validPositions) {
|
|
|
- return 0 == test.nativeDef.indexOf("[ap]") ? elem.toLowerCase() : 0 == test.nativeDef.indexOf("[AP]") ? elem.toUpperCase() : elem;
|
|
|
+ inputmode: "email"
|
|
|
+ },
|
|
|
+ mac: {
|
|
|
+ mask: "##:##:##:##:##:##"
|
|
|
+ },
|
|
|
+ vin: {
|
|
|
+ mask: "V{13}9{4}",
|
|
|
+ definitions: {
|
|
|
+ V: {
|
|
|
+ validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
|
|
|
+ casing: "upper"
|
|
|
+ }
|
|
|
},
|
|
|
- insertMode: !1
|
|
|
+ clearIncomplete: !0,
|
|
|
+ autoUnmask: !0
|
|
|
}
|
|
|
}), Inputmask;
|
|
|
}) ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) || (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
|
|
@@ -442,7 +337,7 @@
|
|
|
}
|
|
|
return !1;
|
|
|
}
|
|
|
- if (5e3 < testPos) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask;
|
|
|
+ if (500 < testPos && quantifierRecurse !== undefined) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask;
|
|
|
if (testPos === pos && match.matches === undefined) return matches.push({
|
|
|
match: match,
|
|
|
locator: loopNdx.reverse(),
|
|
|
@@ -512,7 +407,7 @@
|
|
|
if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) {
|
|
|
if ((latestMatch = matches[matches.length - 1].match).optionalQuantifier = qndx > qt.quantifier.min - 1,
|
|
|
latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit,
|
|
|
- isFirstMatch(latestMatch, tokenGroup) && latestMatch.optionalQuantifier) {
|
|
|
+ latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) {
|
|
|
insertStop = !0, testPos = pos;
|
|
|
break;
|
|
|
}
|
|
|
@@ -773,6 +668,7 @@
|
|
|
needsValidation = !0;
|
|
|
} else valid = !0 === t.generatedInput || t.input === opts.radixPoint && !0 === opts.numericInput;
|
|
|
if (valid) break;
|
|
|
+ if (!valid && end < posMatch && isMask(posMatch, !0) && (null !== t.match.fn || posMatch > getMaskSet().maskLength)) break;
|
|
|
posMatch++;
|
|
|
}
|
|
|
"" == getTest(posMatch).match.def && (valid = !1), posMatch = j;
|
|
|
@@ -1882,80 +1778,185 @@
|
|
|
}.call(exports, __webpack_require__, exports, module)) || (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|
|
|
}, function(module, exports, __webpack_require__) {
|
|
|
"use strict";
|
|
|
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
|
|
- "function" == typeof Symbol && Symbol.iterator;
|
|
|
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
|
|
|
+ return typeof obj;
|
|
|
+ } : function(obj) {
|
|
|
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
|
+ };
|
|
|
__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2), __webpack_require__(4) ],
|
|
|
void 0 === (__WEBPACK_AMD_DEFINE_RESULT__ = "function" == typeof (__WEBPACK_AMD_DEFINE_FACTORY__ = function($, Inputmask) {
|
|
|
- return Inputmask.extendDefinitions({
|
|
|
- A: {
|
|
|
- validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
|
|
- casing: "upper"
|
|
|
- },
|
|
|
- "&": {
|
|
|
- validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
|
|
- casing: "upper"
|
|
|
- },
|
|
|
- "#": {
|
|
|
- validator: "[0-9A-Fa-f]",
|
|
|
- casing: "upper"
|
|
|
+ var formatCode = {
|
|
|
+ d: [ "[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", Date.prototype.getDate ],
|
|
|
+ dd: [ "0[1-9]|[12][0-9]|3[01]", Date.prototype.setDate, "day", function() {
|
|
|
+ return pad(Date.prototype.getDate.call(this), 2);
|
|
|
+ } ],
|
|
|
+ ddd: [ "" ],
|
|
|
+ dddd: [ "" ],
|
|
|
+ m: [ "[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
|
|
|
+ return Date.prototype.getMonth.call(this) + 1;
|
|
|
+ } ],
|
|
|
+ mm: [ "0[1-9]|1[012]", Date.prototype.setMonth, "month", function() {
|
|
|
+ return pad(Date.prototype.getMonth.call(this) + 1, 2);
|
|
|
+ } ],
|
|
|
+ mmm: [ "" ],
|
|
|
+ mmmm: [ "" ],
|
|
|
+ yy: [ "[0-9]{2}", Date.prototype.setFullYear, "year", function() {
|
|
|
+ return pad(Date.prototype.getFullYear.call(this), 2);
|
|
|
+ } ],
|
|
|
+ yyyy: [ "[0-9]{4}", Date.prototype.setFullYear, "year", function() {
|
|
|
+ return pad(Date.prototype.getFullYear.call(this), 4);
|
|
|
+ } ],
|
|
|
+ h: [ "[1-9]|1[0-2]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
+ hh: [ "0[1-9]|1[0-2]", Date.prototype.setHours, "hours", function() {
|
|
|
+ return pad(Date.prototype.getHours.call(this), 2);
|
|
|
+ } ],
|
|
|
+ hhh: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
+ H: [ "1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
+ HH: [ "[01][0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
|
|
|
+ return pad(Date.prototype.getHours.call(this), 2);
|
|
|
+ } ],
|
|
|
+ HHH: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
|
+ M: [ "[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes ],
|
|
|
+ MM: [ "[0-5][0-9]", Date.prototype.setMinutes, "minutes", function() {
|
|
|
+ return pad(Date.prototype.getMinutes.call(this), 2);
|
|
|
+ } ],
|
|
|
+ s: [ "[1-5]?[0-9]", Date.prototype.setSeconds, "seconds", Date.prototype.getSeconds ],
|
|
|
+ ss: [ "[0-5][0-9]", Date.prototype.setSeconds, "seconds", function() {
|
|
|
+ return pad(Date.prototype.getSeconds.call(this), 2);
|
|
|
+ } ],
|
|
|
+ l: [ "[0-9]{3}", Date.prototype.setMilliseconds, "milliseconds", function() {
|
|
|
+ return pad(Date.prototype.getMilliseconds.call(this), 3);
|
|
|
+ } ],
|
|
|
+ L: [ "[0-9]{2}", Date.prototype.setMilliseconds, "milliseconds", function() {
|
|
|
+ return pad(Date.prototype.getMilliseconds.call(this), 2);
|
|
|
+ } ],
|
|
|
+ t: [ "[ap]" ],
|
|
|
+ tt: [ "[ap]m" ],
|
|
|
+ T: [ "[AP]" ],
|
|
|
+ TT: [ "[AP]M" ],
|
|
|
+ Z: [ "" ],
|
|
|
+ o: [ "" ],
|
|
|
+ S: [ "" ]
|
|
|
+ }, formatAlias = {
|
|
|
+ isoDate: "yyyy-mm-dd",
|
|
|
+ isoTime: "HH:MM:ss",
|
|
|
+ isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
|
|
|
+ isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
|
|
|
+ };
|
|
|
+ function getTokenizer(opts) {
|
|
|
+ if (!opts.tokenizer) {
|
|
|
+ var tokens = [];
|
|
|
+ for (var ndx in formatCode) -1 === tokens.indexOf(ndx[0]) && tokens.push(ndx[0]);
|
|
|
+ opts.tokenizer = "(" + tokens.join("+|") + ")+?|.", opts.tokenizer = new RegExp(opts.tokenizer, "g");
|
|
|
}
|
|
|
- }), Inputmask.extendAliases({
|
|
|
- cssunit: {
|
|
|
- regex: "[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"
|
|
|
- },
|
|
|
- url: {
|
|
|
- regex: "(https?|ftp)//.*",
|
|
|
- autoUnmask: !1
|
|
|
- },
|
|
|
- ip: {
|
|
|
- mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
|
|
- definitions: {
|
|
|
- i: {
|
|
|
- validator: function(chrs, maskset, pos, strict, opts) {
|
|
|
- return -1 < pos - 1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
|
|
- chrs = -1 < pos - 2 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
|
|
|
- new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
|
|
- }
|
|
|
- }
|
|
|
+ return opts.tokenizer;
|
|
|
+ }
|
|
|
+ function parse(format, dateObjValue, opts, raw) {
|
|
|
+ for (var match, mask = ""; match = getTokenizer(opts).exec(format); ) if (void 0 === dateObjValue) if (formatCode[match[0]]) mask += "(" + formatCode[match[0]][0] + ")"; else switch (match[0]) {
|
|
|
+ case "[":
|
|
|
+ mask += "(";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "]":
|
|
|
+ mask += ")?";
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ mask += Inputmask.escapeRegex(match[0]);
|
|
|
+ } else if (formatCode[match[0]]) if (!0 !== raw && formatCode[match[0]][3]) {
|
|
|
+ var getFn = formatCode[match[0]][3];
|
|
|
+ mask += getFn.call(dateObjValue.date);
|
|
|
+ } else formatCode[match[0]][2] ? mask += dateObjValue["raw" + formatCode[match[0]][2]] : mask += match[0]; else mask += match[0];
|
|
|
+ return mask;
|
|
|
+ }
|
|
|
+ function pad(val, len) {
|
|
|
+ for (val = String(val), len = len || 2; val.length < len; ) val = "0" + val;
|
|
|
+ return val;
|
|
|
+ }
|
|
|
+ function analyseMask(maskString, format, opts) {
|
|
|
+ var targetProp, match, dateOperation, targetValidator, dateObj = {
|
|
|
+ date: new Date(1, 0, 1)
|
|
|
+ }, mask = maskString;
|
|
|
+ function extendProperty(value) {
|
|
|
+ var correctedValue;
|
|
|
+ if (opts.min && opts.min[targetProp] || opts.max && opts.max[targetProp]) {
|
|
|
+ var min = opts.min && opts.min[targetProp] || opts.max[targetProp], max = opts.max && opts.max[targetProp] || opts.min[targetProp];
|
|
|
+ for (correctedValue = value.replace(/[^0-9]/g, ""), correctedValue += (min.indexOf(correctedValue) < max.indexOf(correctedValue) ? max : min).toString().substr(correctedValue.length); !new RegExp(targetValidator).test(correctedValue); ) correctedValue--;
|
|
|
+ } else correctedValue = value.replace(/[^0-9]/g, "0");
|
|
|
+ return correctedValue;
|
|
|
+ }
|
|
|
+ function setValue(dateObj, value, opts) {
|
|
|
+ dateObj[targetProp] = extendProperty(value), dateObj["raw" + targetProp] = value,
|
|
|
+ void 0 !== dateOperation && dateOperation.call(dateObj.date, "month" == targetProp ? parseInt(dateObj[targetProp]) - 1 : dateObj[targetProp]);
|
|
|
+ }
|
|
|
+ if ("string" == typeof mask) {
|
|
|
+ for (;match = getTokenizer(opts).exec(format); ) {
|
|
|
+ var value = mask.slice(0, match[0].length);
|
|
|
+ formatCode.hasOwnProperty(match[0]) && (targetValidator = formatCode[match[0]][0],
|
|
|
+ targetProp = formatCode[match[0]][2], dateOperation = formatCode[match[0]][1], setValue(dateObj, value)),
|
|
|
+ mask = mask.slice(value.length);
|
|
|
+ }
|
|
|
+ return dateObj;
|
|
|
+ }
|
|
|
+ if (mask && "object" === (void 0 === mask ? "undefined" : _typeof(mask)) && mask.hasOwnProperty("date")) return mask;
|
|
|
+ }
|
|
|
+ return Inputmask.extendAliases({
|
|
|
+ datetime: {
|
|
|
+ mask: function(opts) {
|
|
|
+ return formatCode.S = opts.i18n.ordinalSuffix.join("|"), opts.inputFormat = formatAlias[opts.inputFormat] || opts.inputFormat,
|
|
|
+ opts.displayFormat = formatAlias[opts.displayFormat] || opts.displayFormat || opts.inputFormat,
|
|
|
+ opts.outputFormat = formatAlias[opts.outputFormat] || opts.outputFormat || opts.inputFormat,
|
|
|
+ opts.placeholder = "" !== opts.placeholder ? opts.placeholder : opts.inputFormat.replace(/[\[\]]/, ""),
|
|
|
+ opts.regex = parse(opts.inputFormat, void 0, opts), null;
|
|
|
},
|
|
|
- onUnMask: function(maskedValue, unmaskedValue, opts) {
|
|
|
- return maskedValue;
|
|
|
+ placeholder: "",
|
|
|
+ inputFormat: "isoDateTime",
|
|
|
+ displayFormat: void 0,
|
|
|
+ outputFormat: void 0,
|
|
|
+ min: null,
|
|
|
+ max: null,
|
|
|
+ i18n: {
|
|
|
+ dayNames: [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ],
|
|
|
+ monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
|
|
|
+ ordinalSuffix: [ "st", "nd", "rd", "th" ]
|
|
|
},
|
|
|
- inputmode: "numeric"
|
|
|
- },
|
|
|
- email: {
|
|
|
- mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",
|
|
|
- greedy: !1,
|
|
|
- casing: "lower",
|
|
|
- onBeforePaste: function(pastedValue, opts) {
|
|
|
- return (pastedValue = pastedValue.toLowerCase()).replace("mailto:", "");
|
|
|
+ postValidation: function(buffer, pos, currentResult, opts) {
|
|
|
+ opts.min = analyseMask(opts.min, opts.inputFormat, opts), opts.max = analyseMask(opts.max, opts.inputFormat, opts);
|
|
|
+ var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts);
|
|
|
+ return result && dateParts.date.getTime() == dateParts.date.getTime() && (result = (result = function(dateParts, currentResult) {
|
|
|
+ return (!isFinite(dateParts.rawday) || "29" == dateParts.day && !isFinite(dateParts.rawyear) || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) && currentResult;
|
|
|
+ }(dateParts, result)) && function(dateParts, opts) {
|
|
|
+ var result = !0;
|
|
|
+ if (opts.min) {
|
|
|
+ if (dateParts.rawyear) {
|
|
|
+ var rawYear = dateParts.rawyear.replace(/[^0-9]/g, ""), minYear = opts.min.year.substr(0, rawYear.length);
|
|
|
+ result = minYear <= rawYear;
|
|
|
+ }
|
|
|
+ dateParts.year === dateParts.rawyear && opts.min.date.getTime() == opts.min.date.getTime() && (result = opts.min.date.getTime() <= dateParts.date.getTime());
|
|
|
+ }
|
|
|
+ return result && opts.max && opts.max.date.getTime() == opts.max.date.getTime() && (result = opts.max.date.getTime() >= dateParts.date.getTime()),
|
|
|
+ result;
|
|
|
+ }(dateParts, opts)), pos && result && currentResult.pos !== pos ? {
|
|
|
+ buffer: parse(opts.inputFormat, dateParts, opts),
|
|
|
+ refreshFromBuffer: {
|
|
|
+ start: pos,
|
|
|
+ end: currentResult.pos
|
|
|
+ }
|
|
|
+ } : result;
|
|
|
},
|
|
|
- definitions: {
|
|
|
- "*": {
|
|
|
- validator: "[0-91-9A-Za-zА-яЁёÀ-ÿµ!#$%&'*+/=?^_`{|}~-]"
|
|
|
- },
|
|
|
- "-": {
|
|
|
- validator: "[0-9A-Za-z-]"
|
|
|
+ onKeyDown: function(e, buffer, caretPos, opts) {
|
|
|
+ if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
|
|
|
+ for (var match, today = new Date(), date = ""; match = getTokenizer(opts).exec(opts.inputFormat); ) "d" === match[0].charAt(0) ? date += pad(today.getDate(), match[0].length) : "m" === match[0].charAt(0) ? date += pad(today.getMonth() + 1, match[0].length) : "yyyy" === match[0] ? date += today.getFullYear().toString() : "y" === match[0].charAt(0) && (date += pad(today.getYear(), match[0].length));
|
|
|
+ this.inputmask._valueSet(date), $(this).trigger("setvalue");
|
|
|
}
|
|
|
},
|
|
|
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
|
|
- return maskedValue;
|
|
|
+ return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, !0);
|
|
|
},
|
|
|
- inputmode: "email"
|
|
|
- },
|
|
|
- mac: {
|
|
|
- mask: "##:##:##:##:##:##"
|
|
|
- },
|
|
|
- vin: {
|
|
|
- mask: "V{13}9{4}",
|
|
|
- definitions: {
|
|
|
- V: {
|
|
|
- validator: "[A-HJ-NPR-Za-hj-npr-z\\d]",
|
|
|
- casing: "upper"
|
|
|
- }
|
|
|
+ casing: function(elem, test, pos, validPositions) {
|
|
|
+ return 0 == test.nativeDef.indexOf("[ap]") ? elem.toLowerCase() : 0 == test.nativeDef.indexOf("[AP]") ? elem.toUpperCase() : elem;
|
|
|
},
|
|
|
- clearIncomplete: !0,
|
|
|
- autoUnmask: !0
|
|
|
+ insertMode: !1
|
|
|
}
|
|
|
}), Inputmask;
|
|
|
}) ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__) || (module.exports = __WEBPACK_AMD_DEFINE_RESULT__);
|