|
|
@@ -1,9 +1,9 @@
|
|
1
|
1
|
/*!
|
|
2
|
2
|
* jquery.inputmask.bundle.js
|
|
3
|
3
|
* https://github.com/RobinHerbots/Inputmask
|
|
4
|
|
-* Copyright (c) 2010 - 2018 Robin Herbots
|
|
|
4
|
+* Copyright (c) 2010 - 2019 Robin Herbots
|
|
5
|
5
|
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
|
6
|
|
-* Version: 4.0.2
|
|
|
6
|
+* Version: 4.0.8
|
|
7
|
7
|
*/
|
|
8
|
8
|
|
|
9
|
9
|
(function(modules) {
|
|
|
@@ -73,8 +73,8 @@
|
|
73
|
73
|
})([ function(module, exports, __webpack_require__) {
|
|
74
|
74
|
"use strict";
|
|
75
|
75
|
__webpack_require__(1);
|
|
|
76
|
+ __webpack_require__(6);
|
|
76
|
77
|
__webpack_require__(7);
|
|
77
|
|
- __webpack_require__(8);
|
|
78
|
78
|
var _inputmask = __webpack_require__(2);
|
|
79
|
79
|
var _inputmask2 = _interopRequireDefault(_inputmask);
|
|
80
|
80
|
var _inputmask3 = __webpack_require__(3);
|
|
|
@@ -87,7 +87,7 @@
|
|
87
|
87
|
};
|
|
88
|
88
|
}
|
|
89
|
89
|
if (_inputmask4.default === _jquery2.default) {
|
|
90
|
|
- __webpack_require__(9);
|
|
|
90
|
+ __webpack_require__(8);
|
|
91
|
91
|
}
|
|
92
|
92
|
window.Inputmask = _inputmask2.default;
|
|
93
|
93
|
}, function(module, exports, __webpack_require__) {
|
|
|
@@ -195,12 +195,12 @@
|
|
195
|
195
|
};
|
|
196
|
196
|
(function(factory) {
|
|
197
|
197
|
if (true) {
|
|
198
|
|
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(3), __webpack_require__(5), __webpack_require__(6) ],
|
|
|
198
|
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(3), __webpack_require__(5) ],
|
|
199
|
199
|
__WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__,
|
|
200
|
200
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
201
|
201
|
} else {}
|
|
202
|
|
- })(function($, window, document, undefined) {
|
|
203
|
|
- var ua = navigator.userAgent, mobile = isInputEventSupported("touchstart"), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile;
|
|
|
202
|
+ })(function($, window, undefined) {
|
|
|
203
|
+ var document = window.document, ua = navigator.userAgent, ie = ua.indexOf("MSIE ") > 0 || ua.indexOf("Trident/") > 0, mobile = isInputEventSupported("touchstart"), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile;
|
|
204
|
204
|
function Inputmask(alias, options, internal) {
|
|
205
|
205
|
if (!(this instanceof Inputmask)) {
|
|
206
|
206
|
return new Inputmask(alias, options, internal);
|
|
|
@@ -265,7 +265,7 @@
|
|
265
|
265
|
keepStatic: null,
|
|
266
|
266
|
positionCaretOnTab: true,
|
|
267
|
267
|
tabThrough: false,
|
|
268
|
|
- supportsInputType: [ "text", "tel", "password", "search" ],
|
|
|
268
|
+ supportsInputType: [ "text", "tel", "url", "password", "search" ],
|
|
269
|
269
|
ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 0, 229 ],
|
|
270
|
270
|
isComplete: null,
|
|
271
|
271
|
preValidation: null,
|
|
|
@@ -280,7 +280,8 @@
|
|
280
|
280
|
inputmode: "verbatim",
|
|
281
|
281
|
colorMask: false,
|
|
282
|
282
|
disablePredictiveText: false,
|
|
283
|
|
- importDataAttributes: true
|
|
|
283
|
+ importDataAttributes: true,
|
|
|
284
|
+ shiftPositions: true
|
|
284
|
285
|
},
|
|
285
|
286
|
definitions: {
|
|
286
|
287
|
9: {
|
|
|
@@ -301,6 +302,7 @@
|
|
301
|
302
|
var that = this;
|
|
302
|
303
|
function importAttributeOptions(npt, opts, userOptions, dataAttribute) {
|
|
303
|
304
|
if (opts.importDataAttributes === true) {
|
|
|
305
|
+ var attrOptions = npt.getAttribute(dataAttribute), option, dataoptions, optionData, p;
|
|
304
|
306
|
var importOption = function importOption(option, optionData) {
|
|
305
|
307
|
optionData = optionData !== undefined ? optionData : npt.getAttribute(dataAttribute + "-" + option);
|
|
306
|
308
|
if (optionData !== null) {
|
|
|
@@ -310,7 +312,6 @@
|
|
310
|
312
|
userOptions[option] = optionData;
|
|
311
|
313
|
}
|
|
312
|
314
|
};
|
|
313
|
|
- var attrOptions = npt.getAttribute(dataAttribute), option, dataoptions, optionData, p;
|
|
314
|
315
|
if (attrOptions && attrOptions !== "") {
|
|
315
|
316
|
attrOptions = attrOptions.replace(/'/g, '"');
|
|
316
|
317
|
dataoptions = JSON.parse("{" + attrOptions + "}");
|
|
|
@@ -746,6 +747,9 @@
|
|
746
|
747
|
reverseTokens(maskTokens[0]);
|
|
747
|
748
|
}
|
|
748
|
749
|
return maskTokens;
|
|
|
750
|
+ },
|
|
|
751
|
+ positionColorMask: function positionColorMask(input, template) {
|
|
|
752
|
+ input.style.left = template.offsetLeft + "px";
|
|
749
|
753
|
}
|
|
750
|
754
|
};
|
|
751
|
755
|
Inputmask.extendDefaults = function(options) {
|
|
|
@@ -852,7 +856,8 @@
|
|
852
|
856
|
tests: {},
|
|
853
|
857
|
excludes: {},
|
|
854
|
858
|
metadata: metadata,
|
|
855
|
|
- maskLength: undefined
|
|
|
859
|
+ maskLength: undefined,
|
|
|
860
|
+ jitOffset: {}
|
|
856
|
861
|
};
|
|
857
|
862
|
if (nocache !== true) {
|
|
858
|
863
|
Inputmask.prototype.masksCache[maskdefKey] = masksetDefinition;
|
|
|
@@ -911,7 +916,7 @@
|
|
911
|
916
|
maskset = maskset || this.maskset;
|
|
912
|
917
|
opts = opts || this.opts;
|
|
913
|
918
|
var inputmask = this, el = this.el, isRTL = this.isRTL, undoValue, $el, skipKeyPressEvent = false, skipInputEvent = false, ignorable = false, maxLength, mouseEnter = false, colorMask, originalPlaceholder;
|
|
914
|
|
- function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
|
|
|
919
|
+ var getMaskTemplate = function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
|
|
915
|
920
|
var greedy = opts.greedy;
|
|
916
|
921
|
if (clearOptionalTail) opts.greedy = false;
|
|
917
|
922
|
minimalPos = minimalPos || 0;
|
|
|
@@ -944,7 +949,7 @@
|
|
944
|
949
|
if (includeMode !== false || getMaskSet().maskLength === undefined) getMaskSet().maskLength = pos - 1;
|
|
945
|
950
|
opts.greedy = greedy;
|
|
946
|
951
|
return maskTemplate;
|
|
947
|
|
- }
|
|
|
952
|
+ };
|
|
948
|
953
|
function getMaskSet() {
|
|
949
|
954
|
return maskset;
|
|
950
|
955
|
}
|
|
|
@@ -989,7 +994,7 @@
|
|
989
|
994
|
var tst = tests[ndx];
|
|
990
|
995
|
tstLocator = getLocator(tst, targetLocator.length);
|
|
991
|
996
|
var distance = Math.abs(tstLocator - targetLocator);
|
|
992
|
|
- if (closest === undefined || tstLocator !== "" && distance < closest || bestMatch && bestMatch.match.optionality && bestMatch.match.newBlockMarker === "master" && (!tst.match.optionality || !tst.match.newBlockMarker) || bestMatch && bestMatch.match.optionalQuantifier && !tst.match.optionalQuantifier) {
|
|
|
997
|
+ if (closest === undefined || tstLocator !== "" && distance < closest || bestMatch && !opts.greedy && bestMatch.match.optionality && bestMatch.match.newBlockMarker === "master" && (!tst.match.optionality || !tst.match.newBlockMarker) || bestMatch && bestMatch.match.optionalQuantifier && !tst.match.optionalQuantifier) {
|
|
993
|
998
|
closest = distance;
|
|
994
|
999
|
bestMatch = tst;
|
|
995
|
1000
|
}
|
|
|
@@ -1016,7 +1021,7 @@
|
|
1016
|
1021
|
return valid;
|
|
1017
|
1022
|
}
|
|
1018
|
1023
|
function getTests(pos, ndxIntlzr, tstPs) {
|
|
1019
|
|
- var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "", offset = 0;
|
|
|
1024
|
+ var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : "";
|
|
1020
|
1025
|
function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
|
|
1021
|
1026
|
function handleMatch(match, loopNdx, quantifierRecurse) {
|
|
1022
|
1027
|
function isFirstMatch(latestMatch, tokenGroup) {
|
|
|
@@ -1074,7 +1079,8 @@
|
|
1074
|
1079
|
return source.match.def === target.match.nativeDef;
|
|
1075
|
1080
|
}
|
|
1076
|
1081
|
function staticCanMatchDefinition(source, target) {
|
|
1077
|
|
- var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc, canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false;
|
|
|
1082
|
+ var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc;
|
|
|
1083
|
+ canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false;
|
|
1078
|
1084
|
return canMatch;
|
|
1079
|
1085
|
}
|
|
1080
|
1086
|
function setMergeLocators(targetMatch, altMatch) {
|
|
|
@@ -1207,18 +1213,15 @@
|
|
1207
|
1213
|
match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup);
|
|
1208
|
1214
|
if (match) {
|
|
1209
|
1215
|
latestMatch = matches[matches.length - 1].match;
|
|
1210
|
|
- latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1;
|
|
|
1216
|
+ latestMatch.optionalQuantifier = qndx >= qt.quantifier.min;
|
|
1211
|
1217
|
latestMatch.jit = (qndx || 1) * tokenGroup.matches.indexOf(latestMatch) >= qt.quantifier.jit;
|
|
1212
|
1218
|
if (latestMatch.optionalQuantifier && isFirstMatch(latestMatch, tokenGroup)) {
|
|
1213
|
1219
|
insertStop = true;
|
|
1214
|
1220
|
testPos = pos;
|
|
1215
|
1221
|
break;
|
|
1216
|
1222
|
}
|
|
1217
|
|
- if (latestMatch.jit && !latestMatch.optionalQuantifier) {
|
|
1218
|
|
- offset = tokenGroup.matches.indexOf(latestMatch);
|
|
1219
|
|
- testPos = pos;
|
|
1220
|
|
- insertStop = true;
|
|
1221
|
|
- break;
|
|
|
1223
|
+ if (latestMatch.jit) {
|
|
|
1224
|
+ getMaskSet().jitOffset[pos] = tokenGroup.matches.indexOf(latestMatch);
|
|
1222
|
1225
|
}
|
|
1223
|
1226
|
return true;
|
|
1224
|
1227
|
}
|
|
|
@@ -1231,8 +1234,7 @@
|
|
1231
|
1234
|
testPos++;
|
|
1232
|
1235
|
}
|
|
1233
|
1236
|
}
|
|
1234
|
|
- for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx = tndx + 1 + offset) {
|
|
1235
|
|
- offset = 0;
|
|
|
1237
|
+ for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) {
|
|
1236
|
1238
|
if (maskToken.matches[tndx].isQuantifier !== true) {
|
|
1237
|
1239
|
var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
|
|
1238
|
1240
|
if (match && testPos === pos) {
|
|
|
@@ -1318,6 +1320,7 @@
|
|
1318
|
1320
|
function getBuffer(noCache) {
|
|
1319
|
1321
|
if (getMaskSet().buffer === undefined || noCache === true) {
|
|
1320
|
1322
|
getMaskSet().buffer = getMaskTemplate(true, getLastValidPosition(), true);
|
|
|
1323
|
+ if (getMaskSet()._buffer === undefined) getMaskSet()._buffer = getMaskSet().buffer.slice();
|
|
1321
|
1324
|
}
|
|
1322
|
1325
|
return getMaskSet().buffer;
|
|
1323
|
1326
|
}
|
|
|
@@ -1536,13 +1539,18 @@
|
|
1536
|
1539
|
result = {
|
|
1537
|
1540
|
caret: seekNext(maskPos)
|
|
1538
|
1541
|
};
|
|
1539
|
|
- } else if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && !isMask(maskPos, true)) {
|
|
1540
|
|
- for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) {
|
|
1541
|
|
- result = _isValid(nPos, c, strict);
|
|
1542
|
|
- if (result !== false) {
|
|
1543
|
|
- result = trackbackPositions(maskPos, result.pos !== undefined ? result.pos : nPos) || result;
|
|
1544
|
|
- maskPos = nPos;
|
|
1545
|
|
- break;
|
|
|
1542
|
+ } else {
|
|
|
1543
|
+ if ((opts.insertMode || getMaskSet().validPositions[seekNext(maskPos)] === undefined) && (!isMask(maskPos, true) || getMaskSet().jitOffset[maskPos])) {
|
|
|
1544
|
+ if (getMaskSet().jitOffset[maskPos] && getMaskSet().validPositions[seekNext(maskPos)] === undefined) {
|
|
|
1545
|
+ result = isValid(maskPos + getMaskSet().jitOffset[maskPos], c, strict);
|
|
|
1546
|
+ if (result !== false) result.caret = maskPos;
|
|
|
1547
|
+ } else for (var nPos = maskPos + 1, snPos = seekNext(maskPos); nPos <= snPos; nPos++) {
|
|
|
1548
|
+ result = _isValid(nPos, c, strict);
|
|
|
1549
|
+ if (result !== false) {
|
|
|
1550
|
+ result = trackbackPositions(maskPos, result.pos !== undefined ? result.pos : nPos) || result;
|
|
|
1551
|
+ maskPos = nPos;
|
|
|
1552
|
+ break;
|
|
|
1553
|
+ }
|
|
1546
|
1554
|
}
|
|
1547
|
1555
|
}
|
|
1548
|
1556
|
}
|
|
|
@@ -1649,7 +1657,7 @@
|
|
1649
|
1657
|
trackbackPositions(undefined, posMatch, true);
|
|
1650
|
1658
|
j = posMatch + 1;
|
|
1651
|
1659
|
valid = true;
|
|
1652
|
|
- } else if (positionCanMatchDefinition(posMatch, t.match.def)) {
|
|
|
1660
|
+ } else if (opts.shiftPositions && positionCanMatchDefinition(posMatch, t.match.def)) {
|
|
1653
|
1661
|
var result = isValid(posMatch, t.input, true, true);
|
|
1654
|
1662
|
valid = result !== false;
|
|
1655
|
1663
|
j = result.caret || result.insert ? getLastValidPosition() : posMatch + 1;
|
|
|
@@ -1705,9 +1713,6 @@
|
|
1705
|
1713
|
tests.length < 2 || tests.length === 2 && tests[1].match.def === ""))) {}
|
|
1706
|
1714
|
return position;
|
|
1707
|
1715
|
}
|
|
1708
|
|
- function getBufferElement(position) {
|
|
1709
|
|
- return getMaskSet().validPositions[position] === undefined ? getPlaceholder(position) : getMaskSet().validPositions[position].input;
|
|
1710
|
|
- }
|
|
1711
|
1716
|
function writeBuffer(input, buffer, caretPos, event, triggerEvents) {
|
|
1712
|
1717
|
if (event && $.isFunction(opts.onBeforeWrite)) {
|
|
1713
|
1718
|
var result = opts.onBeforeWrite.call(inputmask, event, buffer, caretPos, opts);
|
|
|
@@ -1764,6 +1769,25 @@
|
|
1764
|
1769
|
}
|
|
1765
|
1770
|
return opts.placeholder.charAt(pos % opts.placeholder.length);
|
|
1766
|
1771
|
}
|
|
|
1772
|
+ function HandleNativePlaceholder(npt, value) {
|
|
|
1773
|
+ if (ie) {
|
|
|
1774
|
+ if (npt.inputmask._valueGet() !== value && (npt.placeholder !== value || npt.placeholder === "")) {
|
|
|
1775
|
+ var buffer = getBuffer().slice(), nptValue = npt.inputmask._valueGet();
|
|
|
1776
|
+ if (nptValue !== value) {
|
|
|
1777
|
+ var lvp = getLastValidPosition();
|
|
|
1778
|
+ if (lvp === -1 && nptValue === getBufferTemplate().join("")) {
|
|
|
1779
|
+ buffer = [];
|
|
|
1780
|
+ } else if (lvp !== -1) {
|
|
|
1781
|
+ clearOptionalTail(buffer);
|
|
|
1782
|
+ }
|
|
|
1783
|
+ writeBuffer(npt, buffer);
|
|
|
1784
|
+ }
|
|
|
1785
|
+ }
|
|
|
1786
|
+ } else if (npt.placeholder !== value) {
|
|
|
1787
|
+ npt.placeholder = value;
|
|
|
1788
|
+ if (npt.placeholder === "") npt.removeAttribute("placeholder");
|
|
|
1789
|
+ }
|
|
|
1790
|
+ }
|
|
1767
|
1791
|
var EventRuler = {
|
|
1768
|
1792
|
on: function on(input, eventName, eventHandler) {
|
|
1769
|
1793
|
var ev = function ev(e) {
|
|
|
@@ -2078,7 +2102,7 @@
|
|
2078
|
2102
|
this.inputmask.refreshValue = false;
|
|
2079
|
2103
|
var input = this, value = e && e.detail ? e.detail[0] : arguments[1], value = value || input.inputmask._valueGet(true);
|
|
2080
|
2104
|
if ($.isFunction(opts.onBeforeMask)) value = opts.onBeforeMask.call(inputmask, value, opts) || value;
|
|
2081
|
|
- value = value.split("");
|
|
|
2105
|
+ value = value.toString().split("");
|
|
2082
|
2106
|
checkVal(input, true, false, value);
|
|
2083
|
2107
|
undoValue = getBuffer().join("");
|
|
2084
|
2108
|
if ((opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("")) {
|
|
|
@@ -2087,8 +2111,8 @@
|
|
2087
|
2111
|
},
|
|
2088
|
2112
|
focusEvent: function focusEvent(e) {
|
|
2089
|
2113
|
var input = this, nptValue = input.inputmask._valueGet();
|
|
2090
|
|
- if (opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && nptValue === "")) {
|
|
2091
|
|
- if (input.inputmask._valueGet() !== getBuffer().join("")) {
|
|
|
2114
|
+ if (opts.showMaskOnFocus) {
|
|
|
2115
|
+ if (nptValue !== getBuffer().join("")) {
|
|
2092
|
2116
|
writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()));
|
|
2093
|
2117
|
} else if (mouseEnter === false) {
|
|
2094
|
2118
|
caret(input, seekNext(getLastValidPosition()));
|
|
|
@@ -2103,8 +2127,7 @@
|
|
2103
|
2127
|
var input = this;
|
|
2104
|
2128
|
mouseEnter = false;
|
|
2105
|
2129
|
if (opts.clearMaskOnLostFocus && document.activeElement !== input) {
|
|
2106
|
|
- input.placeholder = originalPlaceholder;
|
|
2107
|
|
- if (input.placeholder === "") input.removeAttribute("placeholder");
|
|
|
2130
|
+ HandleNativePlaceholder(input, originalPlaceholder);
|
|
2108
|
2131
|
}
|
|
2109
|
2132
|
},
|
|
2110
|
2133
|
clickEvent: function clickEvent(e, tabbed) {
|
|
|
@@ -2188,8 +2211,7 @@
|
|
2188
|
2211
|
blurEvent: function blurEvent(e) {
|
|
2189
|
2212
|
var $input = $(this), input = this;
|
|
2190
|
2213
|
if (input.inputmask) {
|
|
2191
|
|
- input.placeholder = originalPlaceholder;
|
|
2192
|
|
- if (input.placeholder === "") input.removeAttribute("placeholder");
|
|
|
2214
|
+ HandleNativePlaceholder(input, originalPlaceholder);
|
|
2193
|
2215
|
var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice();
|
|
2194
|
2216
|
if (nptValue !== "" || colorMask !== undefined) {
|
|
2195
|
2217
|
if (opts.clearMaskOnLostFocus) {
|
|
|
@@ -2224,7 +2246,7 @@
|
|
2224
|
2246
|
var input = this;
|
|
2225
|
2247
|
mouseEnter = true;
|
|
2226
|
2248
|
if (document.activeElement !== input && opts.showMaskOnHover) {
|
|
2227
|
|
- input.placeholder = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
|
|
|
2249
|
+ HandleNativePlaceholder(input, (isRTL ? getBuffer().slice().reverse() : getBuffer()).join(""));
|
|
2228
|
2250
|
}
|
|
2229
|
2251
|
},
|
|
2230
|
2252
|
submitEvent: function submitEvent(e) {
|
|
|
@@ -2547,9 +2569,6 @@
|
|
2547
|
2569
|
return EventHandlers.clickEvent.call(input, [ e ]);
|
|
2548
|
2570
|
});
|
|
2549
|
2571
|
}
|
|
2550
|
|
- Inputmask.prototype.positionColorMask = function(input, template) {
|
|
2551
|
|
- input.style.left = template.offsetLeft + "px";
|
|
2552
|
|
- };
|
|
2553
|
2572
|
function renderColorMask(input, caretPos, clear) {
|
|
2554
|
2573
|
var maskTemplate = [], isStatic = false, test, testPos, ndxIntlzr, pos = 0;
|
|
2555
|
2574
|
function setEntry(entry) {
|
|
|
@@ -2945,18 +2964,7 @@
|
|
2945
|
2964
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2946
|
2965
|
};
|
|
2947
|
2966
|
if (true) !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
|
2948
|
|
- return window;
|
|
2949
|
|
- }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); else {}
|
|
2950
|
|
-}, function(module, exports, __webpack_require__) {
|
|
2951
|
|
- "use strict";
|
|
2952
|
|
- var __WEBPACK_AMD_DEFINE_RESULT__;
|
|
2953
|
|
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
|
|
2954
|
|
- return typeof obj;
|
|
2955
|
|
- } : function(obj) {
|
|
2956
|
|
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2957
|
|
- };
|
|
2958
|
|
- if (true) !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
|
2959
|
|
- return document;
|
|
|
2967
|
+ return typeof window !== "undefined" ? window : new (eval("require('jsdom').JSDOM"))("").window;
|
|
2960
|
2968
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); else {}
|
|
2961
|
2969
|
}, function(module, exports, __webpack_require__) {
|
|
2962
|
2970
|
"use strict";
|
|
|
@@ -3001,15 +3009,14 @@
|
|
3001
|
3009
|
} ],
|
|
3002
|
3010
|
hhh: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
3003
|
3011
|
H: [ "1?[0-9]|2[0-3]", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
3004
|
|
- HH: [ "[01][0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
|
|
|
3012
|
+ HH: [ "0[0-9]|1[0-9]|2[0-3]", Date.prototype.setHours, "hours", function() {
|
|
3005
|
3013
|
return pad(Date.prototype.getHours.call(this), 2);
|
|
3006
|
3014
|
} ],
|
|
3007
|
3015
|
HHH: [ "[0-9]+", Date.prototype.setHours, "hours", Date.prototype.getHours ],
|
|
3008
|
3016
|
M: [ "[1-5]?[0-9]", Date.prototype.setMinutes, "minutes", Date.prototype.getMinutes ],
|
|
3009
|
|
- MM: [ "[0-5][0-9]", Date.prototype.setMinutes, "minutes", function() {
|
|
|
3017
|
+ MM: [ "0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]", Date.prototype.setMinutes, "minutes", function() {
|
|
3010
|
3018
|
return pad(Date.prototype.getMinutes.call(this), 2);
|
|
3011
|
3019
|
} ],
|
|
3012
|
|
- s: [ "[1-5]?[0-9]", Date.prototype.setSeconds, "seconds", Date.prototype.getSeconds ],
|
|
3013
|
3020
|
ss: [ "[0-5][0-9]", Date.prototype.setSeconds, "seconds", function() {
|
|
3014
|
3021
|
return pad(Date.prototype.getSeconds.call(this), 2);
|
|
3015
|
3022
|
} ],
|
|
|
@@ -3108,15 +3115,11 @@
|
|
3108
|
3115
|
date: new Date(1, 0, 1)
|
|
3109
|
3116
|
}, targetProp, mask = maskString, match, dateOperation, targetValidator;
|
|
3110
|
3117
|
function extendProperty(value) {
|
|
3111
|
|
- var correctedValue;
|
|
3112
|
|
- if (opts.min && opts.min[targetProp] || opts.max && opts.max[targetProp]) {
|
|
3113
|
|
- var min = opts.min && opts.min[targetProp] || opts.max[targetProp], max = opts.max && opts.max[targetProp] || opts.min[targetProp];
|
|
3114
|
|
- correctedValue = value.replace(/[^0-9]/g, "");
|
|
3115
|
|
- correctedValue += (min.indexOf(correctedValue) < max.indexOf(correctedValue) ? max : min).toString().substr(correctedValue.length);
|
|
3116
|
|
- while (!new RegExp(targetValidator).test(correctedValue)) {
|
|
3117
|
|
- correctedValue--;
|
|
3118
|
|
- }
|
|
3119
|
|
- } else correctedValue = value.replace(/[^0-9]/g, "0");
|
|
|
3118
|
+ var correctedValue = value.replace(/[^0-9]/g, "0");
|
|
|
3119
|
+ if (correctedValue != value) {
|
|
|
3120
|
+ var enteredPart = value.replace(/[^0-9]/g, ""), min = (opts.min && opts.min[targetProp] || value).toString(), max = (opts.max && opts.max[targetProp] || value).toString();
|
|
|
3121
|
+ correctedValue = enteredPart + (enteredPart < min.slice(0, enteredPart.length) ? min.slice(enteredPart.length) : enteredPart > max.slice(0, enteredPart.length) ? max.slice(enteredPart.length) : correctedValue.toString().slice(enteredPart.length));
|
|
|
3122
|
+ }
|
|
3120
|
3123
|
return correctedValue;
|
|
3121
|
3124
|
}
|
|
3122
|
3125
|
function setValue(dateObj, value, opts) {
|
|
|
@@ -3209,7 +3212,8 @@
|
|
3209
|
3212
|
if (test.nativeDef.indexOf("[AP]") == 0) return elem.toUpperCase();
|
|
3210
|
3213
|
return elem;
|
|
3211
|
3214
|
},
|
|
3212
|
|
- insertMode: false
|
|
|
3215
|
+ insertMode: false,
|
|
|
3216
|
+ shiftPositions: false
|
|
3213
|
3217
|
}
|
|
3214
|
3218
|
});
|
|
3215
|
3219
|
return Inputmask;
|
|
|
@@ -3239,14 +3243,14 @@
|
|
3239
|
3243
|
}
|
|
3240
|
3244
|
return escapedTxt;
|
|
3241
|
3245
|
}
|
|
3242
|
|
- function alignDigits(buffer, opts) {
|
|
3243
|
|
- if (opts.numericInput) {
|
|
|
3246
|
+ function alignDigits(buffer, digits, opts) {
|
|
|
3247
|
+ if (digits > 0) {
|
|
3244
|
3248
|
var radixPosition = $.inArray(opts.radixPoint, buffer);
|
|
3245
|
3249
|
if (radixPosition === -1) {
|
|
3246
|
3250
|
buffer.push(opts.radixPoint);
|
|
3247
|
3251
|
radixPosition = buffer.length - 1;
|
|
3248
|
3252
|
}
|
|
3249
|
|
- for (var i = 1; i <= opts.digits; i++) {
|
|
|
3253
|
+ for (var i = 1; i <= digits; i++) {
|
|
3250
|
3254
|
buffer[radixPosition + i] = buffer[radixPosition + i] || "0";
|
|
3251
|
3255
|
}
|
|
3252
|
3256
|
}
|
|
|
@@ -3343,6 +3347,7 @@
|
|
3343
|
3347
|
insertMode: true,
|
|
3344
|
3348
|
autoUnmask: false,
|
|
3345
|
3349
|
unmaskAsNumber: false,
|
|
|
3350
|
+ inputType: "text",
|
|
3346
|
3351
|
inputmode: "numeric",
|
|
3347
|
3352
|
preValidation: function preValidation(buffer, pos, c, isSelection, opts, maskset) {
|
|
3348
|
3353
|
if (c === "-" || c === opts.negationSymbol.front) {
|
|
|
@@ -3689,50 +3694,30 @@
|
|
3689
|
3694
|
},
|
|
3690
|
3695
|
onBeforeMask: function onBeforeMask(initialValue, opts) {
|
|
3691
|
3696
|
opts.isNegative = undefined;
|
|
3692
|
|
- if (typeof initialValue == "number" && opts.radixPoint !== "") {
|
|
3693
|
|
- initialValue = initialValue.toString().replace(".", opts.radixPoint);
|
|
3694
|
|
- }
|
|
3695
|
|
- initialValue = initialValue.toString().charAt(initialValue.length - 1) === opts.radixPoint ? initialValue.toString().substr(0, initialValue.length - 1) : initialValue.toString();
|
|
3696
|
|
- if (opts.radixPoint !== "" && isFinite(initialValue)) {
|
|
3697
|
|
- var vs = initialValue.split("."), groupSize = opts.groupSeparator !== "" ? parseInt(opts.groupSize) : 0;
|
|
3698
|
|
- if (vs.length === 2 && (vs[0].length > groupSize || vs[1].length > groupSize || vs[0].length <= groupSize && vs[1].length < groupSize)) {
|
|
3699
|
|
- initialValue = initialValue.replace(".", opts.radixPoint);
|
|
3700
|
|
- }
|
|
3701
|
|
- }
|
|
3702
|
|
- var kommaMatches = initialValue.match(/,/g);
|
|
3703
|
|
- var dotMatches = initialValue.match(/\./g);
|
|
3704
|
|
- if (dotMatches && kommaMatches) {
|
|
3705
|
|
- if (dotMatches.length > kommaMatches.length) {
|
|
3706
|
|
- initialValue = initialValue.replace(/\./g, "");
|
|
3707
|
|
- initialValue = initialValue.replace(",", opts.radixPoint);
|
|
3708
|
|
- } else if (kommaMatches.length > dotMatches.length) {
|
|
3709
|
|
- initialValue = initialValue.replace(/,/g, "");
|
|
3710
|
|
- initialValue = initialValue.replace(".", opts.radixPoint);
|
|
3711
|
|
- } else {
|
|
3712
|
|
- initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue.replace(/,/g, "");
|
|
3713
|
|
- }
|
|
3714
|
|
- } else {
|
|
3715
|
|
- initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
|
|
3716
|
|
- }
|
|
3717
|
|
- if (opts.digits === 0) {
|
|
3718
|
|
- if (initialValue.indexOf(".") !== -1) {
|
|
3719
|
|
- initialValue = initialValue.substring(0, initialValue.indexOf("."));
|
|
3720
|
|
- } else if (initialValue.indexOf(",") !== -1) {
|
|
3721
|
|
- initialValue = initialValue.substring(0, initialValue.indexOf(","));
|
|
3722
|
|
- }
|
|
3723
|
|
- }
|
|
3724
|
|
- if (opts.radixPoint !== "" && isFinite(opts.digits)) {
|
|
3725
|
|
- if (initialValue.indexOf(opts.radixPoint) !== -1) {
|
|
3726
|
|
- var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
|
|
3727
|
|
- if (parseInt(opts.digits) < decPart.toString().length) {
|
|
3728
|
|
- var digitsFactor = Math.pow(10, parseInt(opts.digits));
|
|
3729
|
|
- initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
|
|
3730
|
|
- initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor;
|
|
3731
|
|
- initialValue = initialValue.toString().replace(".", opts.radixPoint);
|
|
3732
|
|
- }
|
|
3733
|
|
- }
|
|
3734
|
|
- }
|
|
3735
|
|
- return alignDigits(initialValue.toString().split(""), opts).join("");
|
|
|
3697
|
+ var radixPoint = opts.radixPoint || ",";
|
|
|
3698
|
+ if ((typeof initialValue == "number" || opts.inputType === "number") && radixPoint !== "") {
|
|
|
3699
|
+ initialValue = initialValue.toString().replace(".", radixPoint);
|
|
|
3700
|
+ }
|
|
|
3701
|
+ var valueParts = initialValue.split(radixPoint), integerPart = valueParts[0].replace(/[^\-0-9]/g, ""), decimalPart = valueParts.length > 1 ? valueParts[1].replace(/[^0-9]/g, "") : "";
|
|
|
3702
|
+ initialValue = integerPart + (decimalPart !== "" ? radixPoint + decimalPart : decimalPart);
|
|
|
3703
|
+ var digits = 0;
|
|
|
3704
|
+ if (radixPoint !== "") {
|
|
|
3705
|
+ digits = decimalPart.length;
|
|
|
3706
|
+ if (decimalPart !== "") {
|
|
|
3707
|
+ var digitsFactor = Math.pow(10, digits || 1);
|
|
|
3708
|
+ if (isFinite(opts.digits)) {
|
|
|
3709
|
+ digits = parseInt(opts.digits);
|
|
|
3710
|
+ digitsFactor = Math.pow(10, digits);
|
|
|
3711
|
+ }
|
|
|
3712
|
+ initialValue = initialValue.replace(Inputmask.escapeRegex(radixPoint), ".");
|
|
|
3713
|
+ if (isFinite(initialValue)) initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor;
|
|
|
3714
|
+ initialValue = initialValue.toString().replace(".", radixPoint);
|
|
|
3715
|
+ }
|
|
|
3716
|
+ }
|
|
|
3717
|
+ if (opts.digits === 0 && initialValue.indexOf(Inputmask.escapeRegex(radixPoint)) !== -1) {
|
|
|
3718
|
+ initialValue = initialValue.substring(0, initialValue.indexOf(Inputmask.escapeRegex(radixPoint)));
|
|
|
3719
|
+ }
|
|
|
3720
|
+ return alignDigits(initialValue.toString().split(""), digits, opts).join("");
|
|
3736
|
3721
|
},
|
|
3737
|
3722
|
onKeyDown: function onKeyDown(e, buffer, caretPos, opts) {
|
|
3738
|
3723
|
var $input = $(this);
|