inputmask.numeric.extensions.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. /*!
  2. * inputmask.numeric.extensions.js
  3. * https://github.com/RobinHerbots/jquery.inputmask
  4. * Copyright (c) 2010 - 2016 Robin Herbots
  5. * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. * Version: 3.2.8-11
  7. */
  8. !function(factory) {
  9. "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib.jquery"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);
  10. }(function($, Inputmask) {
  11. return Inputmask.extendAliases({
  12. numeric: {
  13. mask: function(opts) {
  14. function autoEscape(txt) {
  15. for (var escapedTxt = "", i = 0; i < txt.length; i++) escapedTxt += opts.definitions[txt.charAt(i)] ? "\\" + txt.charAt(i) : txt.charAt(i);
  16. return escapedTxt;
  17. }
  18. if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
  19. opts.repeat = 0, opts.groupSeparator === opts.radixPoint && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""),
  20. " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator,
  21. opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)),
  22. isFinite(opts.integerDigits))) {
  23. var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
  24. opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps),
  25. opts.integerDigits < 1 && (opts.integerDigits = "*");
  26. }
  27. opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)),
  28. opts.radixFocus = opts.radixFocus && "" !== opts.placeholder && opts.integerOptional === !0,
  29. opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~",
  30. 1 == opts.numericInput && (opts.radixFocus = !1, opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2),
  31. opts.decimalProtect = !1);
  32. var mask = autoEscape(opts.prefix);
  33. return mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}",
  34. void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.decimalProtect && (opts.radixPointDefinitionSymbol = ":"),
  35. mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"),
  36. "" !== opts.negationSymbol.back && (mask += "[-]"), mask += autoEscape(opts.suffix),
  37. opts.greedy = !1, mask;
  38. },
  39. placeholder: "",
  40. greedy: !1,
  41. digits: "*",
  42. digitsOptional: !0,
  43. radixPoint: ".",
  44. radixFocus: !0,
  45. groupSize: 3,
  46. groupSeparator: "",
  47. autoGroup: !1,
  48. allowPlus: !0,
  49. allowMinus: !0,
  50. negationSymbol: {
  51. front: "-",
  52. back: ""
  53. },
  54. integerDigits: "+",
  55. integerOptional: !0,
  56. prefix: "",
  57. suffix: "",
  58. rightAlign: !0,
  59. decimalProtect: !0,
  60. min: null,
  61. max: null,
  62. step: 1,
  63. insertMode: !0,
  64. autoUnmask: !1,
  65. unmaskAsNumber: !1,
  66. postFormat: function(buffer, pos, opts) {
  67. opts.numericInput === !0 && (buffer = buffer.reverse(), isFinite(pos) && (pos = buffer.join("").length - pos - 1));
  68. var i, l, suffixStripped = !1;
  69. buffer.length >= opts.suffix.length && buffer.join("").indexOf(opts.suffix) === buffer.length - opts.suffix.length && (buffer.length = buffer.length - opts.suffix.length,
  70. suffixStripped = !0), pos = pos >= buffer.length ? buffer.length - 1 : pos < opts.prefix.length ? opts.prefix.length : pos;
  71. var needsRefresh = !1, charAtPos = buffer[pos], cbuf = buffer.slice();
  72. charAtPos === opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
  73. charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (cbuf[pos] = "?");
  74. var bufVal = cbuf.join(""), bufValOrigin = bufVal;
  75. if (bufVal.length > 0 && opts.autoGroup || -1 !== bufVal.indexOf(opts.groupSeparator)) {
  76. var escapedGroupSeparator = Inputmask.escapeRegex(opts.groupSeparator);
  77. needsRefresh = 0 === bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
  78. var radixSplit = bufVal.split(opts.radixPoint);
  79. if (bufVal = "" === opts.radixPoint ? bufVal : radixSplit[0], bufVal !== opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal) && "" !== opts.groupSeparator; ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
  80. bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
  81. "" !== opts.radixPoint && radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
  82. }
  83. for (needsRefresh = bufValOrigin !== bufVal, buffer.length = bufVal.length, i = 0,
  84. l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
  85. var newPos = $.inArray("?", buffer);
  86. if (-1 === newPos && (newPos = $.inArray(charAtPos, buffer)), buffer[newPos] = charAtPos,
  87. !needsRefresh && suffixStripped) for (i = 0, l = opts.suffix.length; l > i; i++) buffer.push(opts.suffix.charAt(i));
  88. return newPos = opts.numericInput && isFinite(pos) ? buffer.join("").length - newPos - 1 : newPos,
  89. opts.numericInput && (buffer = buffer.reverse(), $.inArray(opts.radixPoint, buffer) < newPos && buffer.join("").length - opts.suffix.length !== newPos && (newPos -= 1)),
  90. {
  91. pos: newPos,
  92. refreshFromBuffer: needsRefresh,
  93. buffer: buffer
  94. };
  95. },
  96. onBeforeWrite: function(e, buffer, caretPos, opts) {
  97. if (e && ("blur" === e.type || "checkval" === e.type || "keydown" === e.type)) {
  98. var maskedValue = opts.numericInput ? buffer.slice().reverse().join("") : buffer.join(""), processValue = maskedValue.replace(opts.prefix, ""), minmaxed = !1;
  99. processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  100. "," === opts.radixPoint && (processValue = processValue.replace(opts.radixPoint, "."));
  101. var isNegative = processValue.match(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g")), isNegative = null !== isNegative && 1 === isNegative.length;
  102. if (processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""),
  103. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
  104. processValue = processValue === opts.negationSymbol.front ? processValue + "0" : processValue,
  105. isFinite(processValue)) {
  106. var floatValue = parseFloat(processValue), signedFloatValue = isNegative ? -1 * floatValue : floatValue;
  107. if (null !== opts.min && isFinite(opts.min) && signedFloatValue < parseFloat(opts.min) && (floatValue = Math.abs(opts.min),
  108. isNegative = opts.min < 0, minmaxed = !0), !minmaxed && null !== opts.max && isFinite(opts.max) && signedFloatValue > parseFloat(opts.max) && (floatValue = Math.abs(opts.max),
  109. isNegative = opts.max < 0, minmaxed = !0), processValue = floatValue.toString().replace(".", opts.radixPoint).split(""),
  110. isFinite(opts.digits)) {
  111. var radixPosition = $.inArray(opts.radixPoint, processValue), rpb = $.inArray(opts.radixPoint, maskedValue);
  112. -1 === radixPosition && (processValue.push(opts.radixPoint), radixPosition = processValue.length - 1);
  113. for (var i = 1; i <= opts.digits; i++) opts.digitsOptional || void 0 !== processValue[radixPosition + i] && processValue[radixPosition + i] !== opts.placeholder.charAt(0) ? -1 != rpb && void 0 != maskedValue[rpb + i] && (processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i]) : processValue[radixPosition + i] = "0";
  114. processValue[processValue.length - 1] == opts.radixPoint && delete processValue[processValue.length - 1];
  115. }
  116. if (floatValue.toString() !== processValue && floatValue.toString() + "." !== processValue || isNegative) {
  117. !isNegative || 0 === floatValue && "blur" === e.type || (processValue.unshift(opts.negationSymbol.front),
  118. processValue.push(opts.negationSymbol.back)), processValue = (opts.prefix + processValue.join("")).split(""),
  119. opts.numericInput && (processValue = processValue.reverse());
  120. var rslt = opts.postFormat(processValue, opts.numericInput ? caretPos : caretPos - 1, opts);
  121. return rslt.buffer && (rslt.refreshFromBuffer = rslt.buffer.join("") != buffer.join("")),
  122. rslt;
  123. }
  124. }
  125. }
  126. if (opts.autoGroup) {
  127. var rslt = opts.postFormat(buffer, opts.numericInput ? caretPos : caretPos - 1, opts);
  128. return rslt.caret = caretPos <= opts.prefix.length ? rslt.pos : rslt.pos + 1, rslt;
  129. }
  130. },
  131. regex: {
  132. integerPart: function(opts) {
  133. return new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+");
  134. },
  135. integerNPart: function(opts) {
  136. return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + "]+");
  137. }
  138. },
  139. signHandler: function(chrs, maskset, pos, strict, opts) {
  140. if (!strict && opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) {
  141. var matchRslt = maskset.buffer.join("").match(opts.regex.integerPart(opts));
  142. if (matchRslt && matchRslt[0].length > 0) return maskset.buffer[matchRslt.index] === ("-" === chrs ? "+" : opts.negationSymbol.front) ? "-" === chrs ? "" !== opts.negationSymbol.back ? {
  143. pos: matchRslt.index,
  144. c: opts.negationSymbol.front,
  145. remove: matchRslt.index,
  146. caret: pos,
  147. insert: {
  148. pos: maskset.buffer.length - opts.suffix.length - 1,
  149. c: opts.negationSymbol.back
  150. }
  151. } : {
  152. pos: matchRslt.index,
  153. c: opts.negationSymbol.front,
  154. remove: matchRslt.index,
  155. caret: pos
  156. } : "" !== opts.negationSymbol.back ? {
  157. pos: matchRslt.index,
  158. c: "+",
  159. remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ],
  160. caret: pos
  161. } : {
  162. pos: matchRslt.index,
  163. c: "+",
  164. remove: matchRslt.index,
  165. caret: pos
  166. } : maskset.buffer[matchRslt.index] === ("-" === chrs ? opts.negationSymbol.front : "+") ? "-" === chrs && "" !== opts.negationSymbol.back ? {
  167. remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ],
  168. caret: pos - 1
  169. } : {
  170. remove: matchRslt.index,
  171. caret: pos - 1
  172. } : "-" === chrs ? "" !== opts.negationSymbol.back ? {
  173. pos: matchRslt.index,
  174. c: opts.negationSymbol.front,
  175. caret: pos + 1,
  176. insert: {
  177. pos: maskset.buffer.length - opts.suffix.length,
  178. c: opts.negationSymbol.back
  179. }
  180. } : {
  181. pos: matchRslt.index,
  182. c: opts.negationSymbol.front,
  183. caret: pos + 1
  184. } : {
  185. pos: matchRslt.index,
  186. c: chrs,
  187. caret: pos + 1
  188. };
  189. }
  190. return !1;
  191. },
  192. radixHandler: function(chrs, maskset, pos, strict, opts) {
  193. if (!strict && (-1 !== $.inArray(chrs, [ ",", "." ]) && (chrs = opts.radixPoint),
  194. chrs === opts.radixPoint && void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0))) {
  195. var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts));
  196. if (-1 !== radixPos && maskset.validPositions[radixPos]) return maskset.validPositions[radixPos - 1] ? {
  197. caret: radixPos + 1
  198. } : {
  199. pos: integerValue.index,
  200. c: integerValue[0],
  201. caret: radixPos + 1
  202. };
  203. if (!integerValue || "0" === integerValue[0] && integerValue.index + 1 !== pos) return maskset.buffer[integerValue ? integerValue.index : pos] = "0",
  204. {
  205. pos: (integerValue ? integerValue.index : pos) + 1,
  206. c: opts.radixPoint
  207. };
  208. }
  209. return !1;
  210. },
  211. leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
  212. if (opts.numericInput === !0) {
  213. if ("0" === maskset.buffer[maskset.buffer.length - opts.prefix.length - 1]) return {
  214. pos: pos,
  215. remove: maskset.buffer.length - opts.prefix.length - 1
  216. };
  217. } else {
  218. var matchRslt = maskset.buffer.join("").match(opts.regex.integerNPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
  219. if (matchRslt && !strict && (-1 === radixPosition || radixPosition >= pos)) if (0 === matchRslt[0].indexOf("0")) {
  220. pos < opts.prefix.length && (pos = matchRslt.index);
  221. var _radixPosition = $.inArray(opts.radixPoint, maskset._buffer), digitsMatch = maskset._buffer && maskset.buffer.slice(radixPosition).join("") === maskset._buffer.slice(_radixPosition).join("") || 0 === parseInt(maskset.buffer.slice(radixPosition + 1).join("")), integerMatch = maskset._buffer && maskset.buffer.slice(matchRslt.index, radixPosition).join("") === maskset._buffer.slice(opts.prefix.length, _radixPosition).join("") || "0" === maskset.buffer.slice(matchRslt.index, radixPosition).join("");
  222. if (-1 === radixPosition || digitsMatch && integerMatch) return maskset.buffer.splice(matchRslt.index, 1),
  223. pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
  224. pos: pos,
  225. remove: matchRslt.index
  226. };
  227. if (matchRslt.index + 1 === pos || "0" === chrs) return maskset.buffer.splice(matchRslt.index, 1),
  228. pos = matchRslt.index, {
  229. pos: pos,
  230. remove: matchRslt.index
  231. };
  232. } else if ("0" === chrs && pos <= matchRslt.index && matchRslt[0] !== opts.groupSeparator) return !1;
  233. }
  234. return !0;
  235. },
  236. definitions: {
  237. "~": {
  238. validator: function(chrs, maskset, pos, strict, opts) {
  239. var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
  240. if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts),
  241. !isValid && (isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs),
  242. isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts),
  243. isValid === !0)))) {
  244. var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
  245. isValid = -1 !== radixPosition && opts.digitsOptional === !1 && opts.numericInput !== !0 && pos > radixPosition && !strict ? {
  246. pos: pos,
  247. remove: pos
  248. } : {
  249. pos: pos
  250. };
  251. }
  252. return isValid;
  253. },
  254. cardinality: 1,
  255. prevalidator: null
  256. },
  257. "+": {
  258. validator: function(chrs, maskset, pos, strict, opts) {
  259. var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
  260. return !isValid && (strict && opts.allowMinus && chrs === opts.negationSymbol.front || opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) && (isValid = "-" === chrs ? "" !== opts.negationSymbol.back ? {
  261. pos: pos,
  262. c: "-" === chrs ? opts.negationSymbol.front : "+",
  263. caret: pos + 1,
  264. insert: {
  265. pos: maskset.buffer.length,
  266. c: opts.negationSymbol.back
  267. }
  268. } : {
  269. pos: pos,
  270. c: "-" === chrs ? opts.negationSymbol.front : "+",
  271. caret: pos + 1
  272. } : !0), isValid;
  273. },
  274. cardinality: 1,
  275. prevalidator: null,
  276. placeholder: ""
  277. },
  278. "-": {
  279. validator: function(chrs, maskset, pos, strict, opts) {
  280. var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
  281. return !isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back && (isValid = !0),
  282. isValid;
  283. },
  284. cardinality: 1,
  285. prevalidator: null,
  286. placeholder: ""
  287. },
  288. ":": {
  289. validator: function(chrs, maskset, pos, strict, opts) {
  290. var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
  291. if (!isValid) {
  292. var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + ",\\.]";
  293. isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = {
  294. caret: pos + 1
  295. });
  296. }
  297. return isValid ? {
  298. c: opts.radixPoint
  299. } : isValid;
  300. },
  301. cardinality: 1,
  302. prevalidator: null,
  303. placeholder: function(opts) {
  304. return opts.radixPoint;
  305. }
  306. }
  307. },
  308. onUnMask: function(maskedValue, unmaskedValue, opts) {
  309. var processValue = maskedValue.replace(opts.prefix, "");
  310. return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  311. opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
  312. Number(processValue)) : processValue;
  313. },
  314. isComplete: function(buffer, opts) {
  315. var maskedValue = buffer.join(""), bufClone = buffer.slice();
  316. if (opts.postFormat(bufClone, 0, opts), bufClone.join("") !== maskedValue) return !1;
  317. var processValue = maskedValue.replace(opts.prefix, "");
  318. return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
  319. "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
  320. isFinite(processValue);
  321. },
  322. onBeforeMask: function(initialValue, opts) {
  323. if ("" !== opts.radixPoint && isFinite(initialValue)) initialValue = initialValue.toString().replace(".", opts.radixPoint); else {
  324. var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
  325. dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
  326. initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
  327. initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
  328. }
  329. if (0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
  330. "" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
  331. var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
  332. if (parseInt(opts.digits) < decPart.toString().length) {
  333. var digitsFactor = Math.pow(10, parseInt(opts.digits));
  334. initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."),
  335. initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor,
  336. initialValue = initialValue.toString().replace(".", opts.radixPoint);
  337. }
  338. }
  339. return initialValue.toString();
  340. },
  341. canClearPosition: function(maskset, position, lvp, strict, opts) {
  342. var positionInput = maskset.validPositions[position].input, canClear = positionInput !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && opts.decimalProtect === !1 || isFinite(positionInput) || position === lvp || positionInput === opts.groupSeparator || positionInput === opts.negationSymbol.front || positionInput === opts.negationSymbol.back;
  343. return canClear;
  344. },
  345. onKeyDown: function(e, buffer, caretPos, opts) {
  346. var $input = $(this);
  347. if (e.ctrlKey) switch (e.keyCode) {
  348. case Inputmask.keyCode.UP:
  349. $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), $input.trigger("setvalue");
  350. break;
  351. case Inputmask.keyCode.DOWN:
  352. $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), $input.trigger("setvalue");
  353. }
  354. }
  355. },
  356. currency: {
  357. prefix: "$ ",
  358. groupSeparator: ",",
  359. alias: "numeric",
  360. placeholder: "0",
  361. autoGroup: !0,
  362. digits: 2,
  363. digitsOptional: !1,
  364. clearMaskOnLostFocus: !1
  365. },
  366. decimal: {
  367. alias: "numeric"
  368. },
  369. integer: {
  370. alias: "numeric",
  371. digits: 0,
  372. radixPoint: ""
  373. },
  374. percentage: {
  375. alias: "numeric",
  376. digits: 2,
  377. radixPoint: ".",
  378. placeholder: "0",
  379. autoGroup: !1,
  380. min: 0,
  381. max: 100,
  382. suffix: " %",
  383. allowPlus: !1,
  384. allowMinus: !1
  385. }
  386. }), Inputmask;
  387. });