Browse Source

pass preprocessing fn as mask

Robin Herbots 12 years ago
parent
commit
b1c2adeec7

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 build.major = 2
 build.minor = 3
-build.revision = 31
+build.revision = 32
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

+ 1 - 1
component.json

@@ -1,6 +1,6 @@
 {
     "name": "jquery.inputmask",
-    "version": "2.3.31",
+    "version": "2.3.32",
     "main": "./dist/jquery.inputmask.bundle.js",
     "dependencies": {
         "jquery": ">=1.5"

BIN
dist/jQuery.InputMask.2.3.31.nupkg


BIN
dist/jQuery.InputMask.2.3.32.nupkg


+ 10 - 6
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2013 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 2.3.31
+* Version: 2.3.32
 */
 
 (function ($) {
@@ -490,6 +490,10 @@
                     }
 
                 }
+                
+                if($.isFunction(opts.mask)) { //allow mask to be a preprocessing fn - should return a valid mask
+                    opts.mask = opts.mask.call(this);
+                }
                 if ($.isArray(opts.mask)) {
                     $.each(opts.mask, function (ndx, msk) {
                         if (msk["mask"] != undefined) {
@@ -1013,7 +1017,7 @@
                                     lvp = getActiveMaskSet()["lastValidPosition"],
                                     lastPosition;
                                 if (opts.isNumeric) {
-                                    lastPosition = opts.skipRadixDance === false && opts.radixPoint != "" && $.inArray(opts.radixPoint, buffer) != -1 ? $.inArray(opts.radixPoint, buffer) : getMaskLength();
+                                    lastPosition = opts.skipRadixDance === false && opts.radixPoint != "" && $.inArray(opts.radixPoint, buffer) != -1 ? (opts.numericInput ? seekNext($.inArray(opts.radixPoint, buffer)) : $.inArray(opts.radixPoint, buffer)) : getMaskLength();
                                 } else {
                                     lastPosition = seekNext(lvp == undefined ? -1 : lvp);
                                 }
@@ -1584,7 +1588,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.3.31
+Version: 2.3.32
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1686,7 +1690,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2012 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.3.31
+Version: 2.3.32
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2163,7 +2167,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.3.31
+Version: 2.3.32
 
 Optional extensions on the jquery.inputmask base
 */
@@ -2332,7 +2336,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 2.3.31
+Version: 2.3.32
 
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask

File diff suppressed because it is too large
+ 61 - 61
dist/jquery.inputmask.bundle.min.js


File diff suppressed because it is too large
+ 43 - 43
dist/min/jquery.inputmask.js


+ 4 - 0
js/jquery.inputmask.js

@@ -490,6 +490,10 @@
                     }
 
                 }
+                
+                if($.isFunction(opts.mask)) { //allow mask to be a preprocessing fn - should return a valid mask
+                    opts.mask = opts.mask.call(this);
+                }
                 if ($.isArray(opts.mask)) {
                     $.each(opts.mask, function (ndx, msk) {
                         if (msk["mask"] != undefined) {