Browse Source

add the rightAlignNumerics option

Robin Herbots 12 years ago
parent
commit
f4e6fbd92f

+ 14 - 3
README.md

@@ -165,7 +165,7 @@ $.extend($.inputmask.defaults, {
 
 ```javascript
 $(document).ready(function(){
-    $('#test').inputmask('€ 999.999.999,99', { numericInput: true });    //123456  =>  € ___.__1.234,56
+    $(selector).inputmask('€ 999.999.999,99', { numericInput: true });    //123456  =>  € ___.__1.234,56
 });
 ```
 
@@ -173,15 +173,26 @@ If you define a radixPoint the caret will always jump to the integer part, until
 
 ```javascript
 $(document).ready(function(){
-    $('#test').inputmask('€ 999.999.999,99', { numericInput: true, radixPoint: "," });
+    $(selector).inputmask('€ 999.999.999,99', { numericInput: true, radixPoint: "," });
 });
 ```
 
+#### align the numerics to the right
+
+By setting the rightAlignNumerics you can specify to right align a numeric inputmask.  Default is true.  
+
+```javascript
+$(document).ready(function(){
+    $(selector).inputmask('decimal', { rightAlignNumerics: false });  //disables the right alignment of the decimal input
+});
+```
+
+
 ### remove the inputmask
 
 ```javascript
 $(document).ready(function(){
-    $('#test').inputmask('remove');
+    $('selector').inputmask('remove');
 });
 ```
 

+ 1 - 1
build.properties

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

BIN
dist/jQuery.InputMask.2.2.0.nupkg


BIN
dist/jQuery.InputMask.2.2.1.nupkg


+ 8 - 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.2.0
+* Version: 2.2.1
 */
 
 (function ($) {
@@ -37,6 +37,7 @@
                 //numeric basic properties
                 numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position)
                 radixPoint: "", //".", // | ","
+                rightAlignNumerics: true, //align numerics to the right
                 //numeric basic properties
                 definitions: {
                     '9': {
@@ -762,8 +763,9 @@
                 lastMaskPos = seekPrevious(buffer, getMaskLength(buffer)),
                 isRTL = false;
                 if (el.dir == "rtl" || opts.numericInput) {
-                    el.dir = "ltr"
-                    $input.css("text-align", "right");
+                    if (el.dir == "rtl" || (opts.numericInput && opts.rightAlignNumerics))
+                        $input.css("text-align", "right");
+                    el.dir = "ltr";
                     $input.removeAttr("dir");
                     var inputData = $input.data('inputmask');
                     inputData['isRTL'] = true;
@@ -1271,7 +1273,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.2.0
+Version: 2.2.1
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1368,7 +1370,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.2.0
+Version: 2.2.1
 
 Optional extensions on the jquery.inputmask base
 */
@@ -1861,7 +1863,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.2.0
+Version: 2.2.1
 
 Optional extensions on the jquery.inputmask base
 */

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


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


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"mask"
     ],
-    "version": "2.2.0",
+    "version": "2.2.1",
     "author": {
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 4 - 2
js/jquery.inputmask.js

@@ -37,6 +37,7 @@
                 //numeric basic properties
                 numericInput: false, //numericInput input direction style (input shifts to the left while holding the caret position)
                 radixPoint: "", //".", // | ","
+                rightAlignNumerics: true, //align numerics to the right
                 //numeric basic properties
                 definitions: {
                     '9': {
@@ -762,8 +763,9 @@
                 lastMaskPos = seekPrevious(buffer, getMaskLength(buffer)),
                 isRTL = false;
                 if (el.dir == "rtl" || opts.numericInput) {
-                    el.dir = "ltr"
-                    $input.css("text-align", "right");
+                    if (el.dir == "rtl" || (opts.numericInput && opts.rightAlignNumerics))
+                        $input.css("text-align", "right");
+                    el.dir = "ltr";
                     $input.removeAttr("dir");
                     var inputData = $input.data('inputmask');
                     inputData['isRTL'] = true;