inputmask.numeric.extensions.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /*
  2. Input Mask plugin extensions
  3. http://github.com/RobinHerbots/jquery.inputmask
  4. Copyright (c) 2010 - Robin Herbots
  5. Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. Version: 0.0.0-dev
  7. Optional extensions on the jquery.inputmask base
  8. */
  9. (function (factory) {
  10. if (typeof define === "function" && define.amd) {
  11. define(["./dependencyLibs/inputmask.dependencyLib", "./inputmask"], factory);
  12. } else if (typeof exports === "object") {
  13. module.exports = factory(require("./dependencyLibs/inputmask.dependencyLib"), require("./inputmask"));
  14. } else {
  15. factory(window.dependencyLib || jQuery, window.Inputmask);
  16. }
  17. }
  18. (function ($, Inputmask, undefined) {
  19. function autoEscape(txt, opts) {
  20. var escapedTxt = "";
  21. for (var i = 0; i < txt.length; i++) {
  22. if (opts.definitions[txt.charAt(i)] ||
  23. opts.optionalmarker.start === txt.charAt(i) ||
  24. opts.optionalmarker.end === txt.charAt(i) ||
  25. opts.quantifiermarker.start === txt.charAt(i) ||
  26. opts.quantifiermarker.end === txt.charAt(i) ||
  27. opts.groupmarker.start === txt.charAt(i) ||
  28. opts.groupmarker.end === txt.charAt(i) ||
  29. opts.alternatormarker === txt.charAt(i))
  30. escapedTxt += "\\" + txt.charAt(i)
  31. else escapedTxt += txt.charAt(i);
  32. }
  33. return escapedTxt;
  34. }
  35. //number aliases
  36. Inputmask.extendAliases({
  37. "numeric": {
  38. mask: function (opts) {
  39. if (opts.repeat !== 0 && isNaN(opts.integerDigits)) {
  40. opts.integerDigits = opts.repeat;
  41. }
  42. opts.repeat = 0;
  43. if (opts.groupSeparator === opts.radixPoint) { //treat equal separator and radixpoint
  44. if (opts.radixPoint === ".") {
  45. opts.groupSeparator = ",";
  46. } else if (opts.radixPoint === ",") {
  47. opts.groupSeparator = ".";
  48. } else opts.groupSeparator = "";
  49. }
  50. if (opts.groupSeparator === " ") { //prevent conflict with default skipOptionalPartCharacter
  51. opts.skipOptionalPartCharacter = undefined;
  52. }
  53. opts.autoGroup = opts.autoGroup && opts.groupSeparator !== "";
  54. if (opts.autoGroup) {
  55. if (typeof opts.groupSize == "string" && isFinite(opts.groupSize)) opts.groupSize = parseInt(opts.groupSize);
  56. if (isFinite(opts.integerDigits)) {
  57. var seps = Math.floor(opts.integerDigits / opts.groupSize);
  58. var mod = opts.integerDigits % opts.groupSize;
  59. opts.integerDigits = parseInt(opts.integerDigits) + (mod === 0 ? seps - 1 : seps);
  60. if (opts.integerDigits < 1) {
  61. opts.integerDigits = "*";
  62. }
  63. }
  64. }
  65. //enforce placeholder to single
  66. if (opts.placeholder.length > 1) {
  67. opts.placeholder = opts.placeholder.charAt(0);
  68. }
  69. //only allow radixfocus when placeholder = 0
  70. if (opts.positionCaretOnClick === "radixFocus" && (opts.placeholder === "" && opts.integerOptional === false)) {
  71. opts.positionCaretOnClick = "lvp";
  72. }
  73. opts.definitions[";"] = opts.definitions["~"]; //clone integer def for decimals
  74. opts.definitions[";"].definitionSymbol = "~";
  75. if (opts.numericInput === true) { //finance people input style
  76. opts.positionCaretOnClick = opts.positionCaretOnClick === "radixFocus" ? "lvp" : opts.positionCaretOnClick;
  77. opts.digitsOptional = false;
  78. if (isNaN(opts.digits)) opts.digits = 2;
  79. opts.decimalProtect = false;
  80. }
  81. var mask = "[+]";
  82. mask += autoEscape(opts.prefix, opts);
  83. if (opts.integerOptional === true) {
  84. mask += "~{1," + opts.integerDigits + "}";
  85. } else mask += "~{" + opts.integerDigits + "}";
  86. if (opts.digits !== undefined) {
  87. opts.radixPointDefinitionSymbol = opts.decimalProtect ? ":" : opts.radixPoint;
  88. var dq = opts.digits.toString().split(",");
  89. if (isFinite(dq[0] && dq[1] && isFinite(dq[1]))) {
  90. mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}";
  91. } else if (isNaN(opts.digits) || parseInt(opts.digits) > 0) {
  92. if (opts.digitsOptional) {
  93. mask += "[" + opts.radixPointDefinitionSymbol + ";{1," + opts.digits + "}]";
  94. } else mask += opts.radixPointDefinitionSymbol + ";{" + opts.digits + "}";
  95. }
  96. }
  97. mask += autoEscape(opts.suffix, opts);
  98. mask += "[-]";
  99. opts.greedy = false; //enforce greedy false
  100. return mask;
  101. },
  102. placeholder: "",
  103. greedy: false,
  104. digits: "*", //number of fractionalDigits
  105. digitsOptional: true,
  106. radixPoint: ".",
  107. positionCaretOnClick: "radixFocus",
  108. groupSize: 3,
  109. groupSeparator: "",
  110. autoGroup: false,
  111. allowMinus: true,
  112. negationSymbol: {
  113. front: "-", //"("
  114. back: "" //")"
  115. },
  116. integerDigits: "+", //number of integerDigits
  117. integerOptional: true,
  118. prefix: "",
  119. suffix: "",
  120. rightAlign: true,
  121. decimalProtect: true, //do not allow assumption of decimals input without entering the radixpoint
  122. min: null, //minimum value
  123. max: null, //maximum value
  124. step: 1,
  125. insertMode: true,
  126. autoUnmask: false,
  127. unmaskAsNumber: false,
  128. inputmode: "numeric",
  129. preValidation: function (buffer, pos, c, opts) {
  130. if (c === "-" || c == opts.negationSymbol.front) {
  131. if (opts.allowMinus !== true) return false;
  132. opts.isNegative = opts.isNegative === undefined ? true : !opts.isNegative;
  133. return {caret: pos, dopost: true};
  134. }
  135. if (opts.numericInput !== true && c === opts.radixPoint && (opts.digits !== undefined && (isNaN(opts.digits) || parseInt(opts.digits) > 0))) {
  136. var radixPos = $.inArray(opts.radixPoint, buffer);
  137. if (radixPos !== -1) {
  138. return {"caret": radixPos + 1};
  139. }
  140. }
  141. return true;
  142. },
  143. postValidation: function (buffer, currentResult, opts) {
  144. function buildPostMask(buffer, opts) {
  145. //define base for formatter
  146. var postMask = "";
  147. postMask += "(" + opts.groupSeparator + "*{" + opts.groupSize + "}){*}";
  148. if (opts.radixPoint !== "") {
  149. var radixSplit = buffer.join("").split(opts.radixPoint);
  150. if (radixSplit[1]) {
  151. postMask += opts.radixPoint + "*{" + radixSplit[1].match(/^\d*\??\d*/)[0].length + "}";
  152. }
  153. }
  154. return postMask;
  155. }
  156. var suffix = opts.suffix.split(""), prefix = opts.prefix.split("");
  157. if (currentResult.pos == undefined && currentResult.caret !== undefined && currentResult.dopost !== true) return currentResult;
  158. var caretPos = currentResult.caret != undefined ? currentResult.caret : currentResult.pos;
  159. var maskedValue = buffer.slice();
  160. if (opts.numericInput) {
  161. caretPos = maskedValue.length - caretPos;
  162. maskedValue = maskedValue.reverse();
  163. }
  164. //mark caretPos
  165. var charAtPos = maskedValue[caretPos];
  166. if (caretPos == maskedValue.length - 1 && charAtPos === opts.radixPoint) return currentResult;
  167. if (charAtPos !== undefined) {
  168. if (charAtPos !== opts.radixPoint &&
  169. charAtPos !== opts.negationSymbol.front &&
  170. (charAtPos !== opts.negationSymbol.back)
  171. ) {
  172. maskedValue[caretPos] = "?";
  173. if (opts.prefix.length > 0 && caretPos >= (opts.isNegative === true ? 0 : 1) && caretPos < opts.prefix.length - 1 + (opts.isNegative === true ? 0 : 1)) {
  174. prefix[caretPos - (opts.isNegative === true ? 0 : 1)] = "?";
  175. } else if (opts.suffix.length > 0 && caretPos >= (maskedValue.length - opts.suffix.length) - (opts.isNegative === true ? 0 : 1)) {
  176. suffix[caretPos - (maskedValue.length - opts.suffix.length - (opts.isNegative === true ? 0 : 1))] = "?";
  177. }
  178. }
  179. }
  180. //make numeric
  181. prefix = prefix.join("");
  182. suffix = suffix.join("");
  183. var processValue = maskedValue.join("").replace(prefix, "");
  184. processValue = processValue.replace(suffix, "");
  185. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
  186. //strip negation symbol
  187. processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), "");
  188. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), "");
  189. //strip placeholder at the end
  190. if (isNaN(opts.placeholder)) {
  191. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.placeholder), "g"), "");
  192. }
  193. //strip leading zeroes
  194. if (charAtPos == "0")
  195. processValue = processValue.replace(/^\?0/g, "?");
  196. processValue = processValue.replace(/^0/g, "");
  197. if (processValue[0] === opts.radixPoint) processValue = "0" + processValue;
  198. if (processValue !== "") {
  199. processValue = processValue.split("");
  200. //handle digits
  201. if (isFinite(opts.digits)) {
  202. var radixPosition = $.inArray(opts.radixPoint, processValue);
  203. var rpb = $.inArray(opts.radixPoint, maskedValue);
  204. if (radixPosition === -1) {
  205. processValue.push(opts.radixPoint);
  206. radixPosition = processValue.length - 1;
  207. }
  208. for (var i = 1; i <= opts.digits; i++) {
  209. if (!opts.digitsOptional && (processValue[radixPosition + i] === undefined || processValue[radixPosition + i] === opts.placeholder.charAt(0))) {
  210. processValue[radixPosition + i] = "0";
  211. } else if (rpb !== -1 && maskedValue[rpb + i] !== undefined) {
  212. processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i];
  213. }
  214. }
  215. }
  216. if (opts.autoGroup === true && opts.groupSeparator !== "" && charAtPos !== opts.radixPoint) {
  217. processValue = Inputmask(buildPostMask(processValue, opts), {
  218. numericInput: true, jitMasking: true,
  219. definitions: {
  220. "*": {
  221. validator: "[0-9?]",
  222. cardinality: 1
  223. }
  224. }
  225. }).format(processValue.join(""));
  226. } else processValue = processValue.join("");
  227. }
  228. processValue = prefix + processValue;
  229. processValue += suffix;
  230. if (opts.isNegative) {
  231. processValue = opts.negationSymbol.front + processValue;
  232. processValue += opts.negationSymbol.back;
  233. }
  234. processValue = processValue.split("");
  235. //unmark position
  236. if (charAtPos !== undefined) {
  237. if (charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back) {
  238. caretPos = $.inArray("?", processValue);
  239. processValue[caretPos] = charAtPos;
  240. } else if (charAtPos === opts.radixPoint ||
  241. charAtPos === opts.negationSymbol.front ||
  242. charAtPos === opts.negationSymbol.back) {
  243. var newCaretPos = $.inArray(charAtPos, processValue);
  244. if (newCaretPos !== -1) caretPos = newCaretPos;
  245. else charAtPos = undefined;
  246. }
  247. }
  248. if (opts.numericInput) {
  249. caretPos = processValue.length - caretPos;
  250. processValue = processValue.reverse();
  251. }
  252. var rslt = {
  253. caret: (charAtPos === undefined || currentResult.pos) ? caretPos + 1 : caretPos,
  254. buffer: processValue,
  255. refreshFromBuffer: processValue.join("") != buffer.join("")
  256. };
  257. console.log(JSON.stringify(rslt));
  258. return rslt.refreshFromBuffer ? rslt : currentResult;
  259. },
  260. onBeforeWrite: function (e, buffer, caretPos, opts) {
  261. function parseMinMaxOptions(opts) {
  262. if (opts.parseMinMaxOptions === undefined) {
  263. //convert min and max options
  264. if (opts.min !== null) {
  265. opts.min = opts.min.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
  266. if (opts.radixPoint === ",") opts.min = opts.min.replace(opts.radixPoint, ".");
  267. opts.min = isFinite(opts.min) ? parseFloat(opts.min) : NaN;
  268. if (isNaN(opts.min)) opts.min = Number.MIN_VALUE;
  269. }
  270. if (opts.max !== null) {
  271. opts.max = opts.max.toString().replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
  272. if (opts.radixPoint === ",") opts.max = opts.max.replace(opts.radixPoint, ".");
  273. opts.max = isFinite(opts.max) ? parseFloat(opts.max) : NaN;
  274. if (isNaN(opts.max)) opts.max = Number.MAX_VALUE;
  275. }
  276. opts.parseMinMaxOptions = "done";
  277. console.log(opts.min + " " + opts.max);
  278. }
  279. }
  280. if (e) {
  281. switch (e.type) {
  282. case "keydown":
  283. return opts.postValidation(buffer, {caret: caretPos, dopost: true}, opts);
  284. case "blur":
  285. var unmasked;
  286. parseMinMaxOptions(opts);
  287. if (opts.min !== null || opts.max !== null) {
  288. unmasked = opts.onUnMask(buffer.join(""), undefined, $.extend({}, opts, {unmaskAsNumber: true}));
  289. if (opts.min !== null && unmasked < opts.min) {
  290. opts.isNegative = opts.min < 0;
  291. return {
  292. buffer: opts.min.toString().split(""),
  293. refreshFromBuffer: true
  294. }
  295. } else if (opts.max !== null && unmasked > opts.max) {
  296. opts.isNegative = opts.max < 0;
  297. return {
  298. buffer: opts.max.toString().split(""),
  299. refreshFromBuffer: true
  300. }
  301. }
  302. }
  303. break;
  304. default:
  305. //strip radixpoint at the end
  306. // if (processValue[processValue.length - 1] === opts.radixPoint) {
  307. // delete processValue[processValue.length - 1];
  308. // }
  309. break;
  310. }
  311. }
  312. },
  313. regex: {
  314. integerPart: function (opts, emptyCheck) {
  315. return emptyCheck ? new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "\+]?") : new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "\+]?\\d+");
  316. }
  317. ,
  318. integerNPart: function (opts) {
  319. return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+");
  320. }
  321. }
  322. ,
  323. definitions: {
  324. "~": {
  325. validator: function (chrs, maskset, pos, strict, opts, isSelection) {
  326. var isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs);
  327. if (isValid === true && opts.numericInput !== true) {
  328. //handle overwrite when fixed precision
  329. var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
  330. if (radixPosition !== -1 && (opts.digitsOptional === false || maskset.validPositions[pos]) && opts.numericInput !== true && pos > radixPosition && !strict) {
  331. isValid = {
  332. "pos": pos,
  333. "remove": pos
  334. };
  335. } else {
  336. isValid = {
  337. pos: pos
  338. };
  339. }
  340. }
  341. return isValid;
  342. }
  343. ,
  344. cardinality: 1
  345. }
  346. ,
  347. "+": {
  348. validator: function (chrs, maskset, pos, strict, opts) {
  349. return (strict && opts.allowMinus && chrs === opts.negationSymbol.front);
  350. },
  351. cardinality: 1,
  352. placeholder: ""
  353. },
  354. "-": {
  355. validator: function (chrs, maskset, pos, strict, opts) {
  356. return (strict && opts.allowMinus && chrs === opts.negationSymbol.back);
  357. },
  358. cardinality: 1,
  359. placeholder: ""
  360. },
  361. ":": {
  362. validator: function (chrs, maskset, pos, strict, opts) {
  363. var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + "]";
  364. isValid = new RegExp(radix).test(chrs);
  365. if (isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint) {
  366. isValid = {
  367. "caret": pos + 1
  368. };
  369. }
  370. return isValid;
  371. },
  372. cardinality: 1,
  373. placeholder: function (opts) {
  374. return opts.radixPoint;
  375. }
  376. }
  377. },
  378. onUnMask: function (maskedValue, unmaskedValue, opts) {
  379. if (unmaskedValue === "" && opts.nullable === true) {
  380. return unmaskedValue;
  381. }
  382. var processValue = maskedValue.replace(opts.prefix, "");
  383. processValue = processValue.replace(opts.suffix, "");
  384. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
  385. if (opts.unmaskAsNumber) {
  386. if (opts.radixPoint !== "" && processValue.indexOf(opts.radixPoint) !== -1) processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".");
  387. return Number(processValue);
  388. }
  389. return processValue;
  390. }
  391. ,
  392. isComplete: function (buffer, opts) {
  393. var maskedValue = buffer.join(""),
  394. bufClone = buffer.slice();
  395. //verify separator positions
  396. if (bufClone.join("") !== maskedValue) return false;
  397. var processValue = maskedValue.replace(opts.prefix, "");
  398. processValue = processValue.replace(opts.suffix, "");
  399. processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
  400. if (opts.radixPoint === ",") processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
  401. return isFinite(processValue);
  402. },
  403. onBeforeMask: function (initialValue, opts) {
  404. initialValue = initialValue.toString();
  405. if (opts.numericInput === true) {
  406. initialValue = initialValue.split("").reverse().join("");
  407. }
  408. if (opts.radixPoint !== "" && isFinite(initialValue)) {
  409. var vs = initialValue.split("."),
  410. groupSize = opts.groupSeparator !== "" ? parseInt(opts.groupSize) : 0;
  411. if (vs.length === 2 && (vs[0].length > groupSize || vs[1].length > groupSize))
  412. initialValue = initialValue.replace(".", opts.radixPoint);
  413. }
  414. var kommaMatches = initialValue.match(/,/g);
  415. var dotMatches = initialValue.match(/\./g);
  416. if (dotMatches && kommaMatches) {
  417. if (dotMatches.length > kommaMatches.length) {
  418. initialValue = initialValue.replace(/\./g, "");
  419. initialValue = initialValue.replace(",", opts.radixPoint);
  420. } else if (kommaMatches.length > dotMatches.length) {
  421. initialValue = initialValue.replace(/,/g, "");
  422. initialValue = initialValue.replace(".", opts.radixPoint);
  423. } else { //equal
  424. initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "");
  425. }
  426. } else {
  427. initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
  428. }
  429. if (opts.digits === 0) {
  430. if (initialValue.indexOf(".") !== -1) {
  431. initialValue = initialValue.substring(0, initialValue.indexOf("."));
  432. } else if (initialValue.indexOf(",") !== -1) {
  433. initialValue = initialValue.substring(0, initialValue.indexOf(","));
  434. }
  435. }
  436. if (opts.radixPoint !== "" && isFinite(opts.digits) && initialValue.indexOf(opts.radixPoint) !== -1) {
  437. var valueParts = initialValue.split(opts.radixPoint),
  438. decPart = valueParts[1].match(new RegExp("\\d*"))[0];
  439. if (parseInt(opts.digits) < decPart.toString().length) {
  440. var digitsFactor = Math.pow(10, parseInt(opts.digits));
  441. //make the initialValue a valid javascript number for the parsefloat
  442. initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".");
  443. initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor;
  444. initialValue = initialValue.toString().replace(".", opts.radixPoint);
  445. }
  446. }
  447. if (opts.numericInput === true) {
  448. initialValue = initialValue.split("").reverse().join("");
  449. }
  450. return initialValue;
  451. }
  452. ,
  453. canClearPosition: function (maskset, position, lvp, strict, opts) {
  454. var vp = maskset.validPositions[position],
  455. canClear = ((vp.input !== opts.radixPoint || (maskset.validPositions[position].match.fn !== null && opts.decimalProtect === false)) || isFinite(vp.input)) ||
  456. position === lvp ||
  457. vp.input === opts.groupSeparator ||
  458. vp.input === opts.negationSymbol.front ||
  459. vp.input === opts.negationSymbol.back;
  460. if (canClear && (vp.match.nativeDef == "+" || vp.match.nativeDef == "-")) {
  461. opts.isNegative = false;
  462. }
  463. return canClear;
  464. }
  465. ,
  466. onKeyDown: function (e, buffer, caretPos, opts) {
  467. //TODO FIXME
  468. var $input = $(this);
  469. if (e.ctrlKey) {
  470. switch (e.keyCode) {
  471. case Inputmask.keyCode.UP:
  472. $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step));
  473. $input.trigger("setvalue");
  474. break;
  475. case Inputmask.keyCode.DOWN:
  476. $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step));
  477. $input.trigger("setvalue");
  478. break;
  479. }
  480. }
  481. }
  482. },
  483. "currency": {
  484. prefix: "$ ",
  485. groupSeparator: ",",
  486. alias: "numeric",
  487. placeholder: "0",
  488. autoGroup: true,
  489. digits: 2,
  490. digitsOptional: false,
  491. clearMaskOnLostFocus: false
  492. }
  493. ,
  494. "decimal": {
  495. alias: "numeric"
  496. }
  497. ,
  498. "integer": {
  499. alias: "numeric",
  500. digits: 0,
  501. radixPoint: ""
  502. }
  503. ,
  504. "percentage": {
  505. alias: "numeric",
  506. digits: 2,
  507. radixPoint: ".",
  508. placeholder: "0",
  509. autoGroup: false,
  510. min: 0,
  511. max: 100,
  512. suffix: " %",
  513. allowMinus: false
  514. }
  515. })
  516. ;
  517. return Inputmask;
  518. }))
  519. ;