浏览代码

update docs fix 1024

Robin Herbots 10 年之前
父节点
当前提交
c02f6dd29e

+ 1 - 0
CHANGELOG.md

@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
 - update files to be included for package.json, bower.json, component.json
 
 ### Fixed
+- 3.2.0 Error extendDefinitions and extendAliases not functions #1024
 - Browserify error: `Error: Cannot find module 'inputmask' from '/Users/.../node_modules/jquery.inputmask/dist/inputmask` #1030
 - Invalid JSON phone-uk.js #1025
 

+ 3 - 3
Gruntfile.js

@@ -134,9 +134,9 @@ module.exports = function(grunt) {
 				}
 			}
 		},
-		browserify: { /* not working */
+		browserify: {
 			dist: {
-				dest: 'build/jquery.inputmask.bundle.js',
+				dest: 'build/browserify.bundle.js',
 				src: [],
 				options: {
 					require: ["./"]
@@ -151,7 +151,7 @@ module.exports = function(grunt) {
 	grunt.registerTask('publish:patch', ['clean', 'bump:patch', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
 	grunt.registerTask('publish:minor', ['clean', 'bump:minor', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
 	grunt.registerTask('publish:major', ['clean', 'bump:major', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
-	grunt.registerTask('validate', ['eslint', 'karma']);
+	grunt.registerTask('validate', ['eslint', 'browserify', 'karma']);
 	grunt.registerTask('build', ['bump:prerelease', 'clean', 'uglify']);
 	grunt.registerTask('default', ["availabletasks"]);
 

+ 2 - 0
README.md

@@ -586,6 +586,8 @@ $(selector).inputmask({
 
 You can also disable pasting a value by returning false in the onBeforePaste call.
 
+Default: Calls the onBeforeMask
+
 ### onBeforeWrite
 Executes before writing to the masked element
 

+ 42 - 18
README_date.md

@@ -1,26 +1,50 @@
-## date & datetime extensions
+# date & datetime extensions
 
-```javascript
-$(document).ready(function(){
-   $(selector).inputmask("dd/mm/yyyy");
-   $(selector).inputmask("mm/dd/yyyy");
-   $(selector).inputmask("date"); // alias for dd/mm/yyyy
-   $(selector).inputmask("date", {yearrange: { minyear: 1900, maxyear: 2099 }}); //specify year range
-});
-```
+Date & Time masks.  Includes autocompletion, yearranges, leapyeares, etc.
 
-The date aliases take leap years into account.  There is also autocompletion on day, month, year. For example:
+This extension will be updated in milestone 3.4.  
+All aliases will be replaced by 1 generic datetime alias which can accept a specifier for the desired datetime format.
 
-input:    2/2/2012         result: 02/02/2012<br>input:  352012            result: 03/05/2012<br>input:  3/530            result: 03/05/2030<br>input:  ctrl rightarrow            result: the date from today  
+## Definitions
 
-```javascript
-$(document).ready(function(){
-   $(selector).inputmask("datetime"); // 24h
-   $(selector).inputmask("datetime12"); // am/pm
-});
-```
+- h   :   hours  
+- s   :   seconds / minutes  
+- d   :   simple day  
+- m   :   simple month  
+- y   :   simple year   
+
+## Aliases
+
+- dd/mm/yyyy  
+- mm/dd/yyyy
+- yyyy/mm/dd  
+- dd.mm.yyyy  
+- dd-mm-yyyy  
+- mm.dd.yyyy  
+- mm-dd-yyyy  
+- yyyy.mm.dd  
+- yyyy-mm-dd  
+- datetime  
+- datetime12  
+- mm/dd/yyyy hh:mm xm  
+- hh:mm t  
+- h:s t  
+- hh:mm:ss  
+- hh:mm  
+- date  
+- mm/yyyy  
+- shamsi
+
+## Options
+### yearrange
+Define a yearrange.  
+
+yearrange: {
+  minyear: 1900,
+  maxyear: 2099
+}
 
-### jqueryui.datepicker example
+## jqueryui.datepicker example
 
 ```javascript
     $('#calender').datepicker({

+ 7 - 1
README_numeric.md

@@ -1,5 +1,11 @@
 # numeric extensions
-## aliases
+## Aliases
+
+- numeric  
+- currency  
+- decimal  
+- integer  
+- percentage  
 
 ## Options
 ### digits

+ 7 - 2
README_other.md

@@ -1,5 +1,10 @@
-## other extensions
+# other extensions
+## Definitions
+- A   :     alphabetical uppercasing
+- &   :     alfanumeric uppercasing
+- \#  :     hexadecimal
 
+## Aliases
 ### URL
 An URL mask for entering valid FTP, HTTP or HTTPS addresses.
 
@@ -36,4 +41,4 @@ $(document).ready(function(){
 });
 ```
 
-You can find/modify/extend these alias in the jquery.inputmask.extensions.js
+You can find/modify/extend these aliases in the inputmask.extensions.js

+ 17 - 2
README_phone.md

@@ -1,10 +1,25 @@
-## phone extensions
+# phone extensions
 
 ```javascript
  $(selector).inputmask("phone", {
                 url: "Scripts/jquery.inputmask/phone-codes/phone-codes.json",
                 onKeyValidation: function () { //show some metadata in the console
-                    console.log($(this).inputmask("getmetadata")["name_en"]);
+                    console.log($(this).inputmask("getmetadata")["city"]);
                 }
   });
 ```
+
+
+## Aliases
+- phone
+- phonebe
+
+## Options
+
+### url
+
+Specify the url to fetch the phone codes.
+
+### countrycode
+
+Specify the countrycode to help determine phonenumbers when pasting or with an initialValue.

+ 2 - 2
README_regex.md

@@ -1,5 +1,5 @@
-## regex extensions
-With the regex extension you can use any regular expression as a mask.  Currently this does only input restriction.<br>There is no further masking visualization.
+# regex extensions
+With the regex extension you can use any regular expression as a mask.  Currently this does only input restriction.  There is no further masking visualization.
 
 Example simple email regex:
 

+ 1 - 1
extra/phone-codes/phone-ru.js

@@ -2402,4 +2402,4 @@
 	{ "mask": "+7(87961)#-##-##", "cc": "RU", "cd": "Russia", "region": "Ставропольский край", "city": "Ессентукская", "operator": "", "desc": "" },
 	{ "mask": "+7(87964)#-##-##", "cc": "RU", "cd": "Russia", "region": "Ставропольский край", "city": "Курская", "operator": "", "desc": "" },
 	{ "mask": "+7(9##)###-##-##", "cc": "RU", "cd": "Russia", "type": "mobile" }
-]
+]

+ 0 - 1
js/dependencyLib.js

@@ -41,7 +41,6 @@
 			Event: $.Event, //needs to be replaced
 			_data: $._data, //needs to be replaced
 			data: $.data //needs to be replaced
-
 		}
 		dependencyLib = $; //todo split out needed functionality
 		window.dependencyLib = dependencyLib;

+ 6 - 4
js/inputmask.js

@@ -57,7 +57,9 @@
 				alias: null,
 				onKeyDown: $.noop, //callback to implement autocomplete on certain keys for example. args => event, buffer, caretPos, opts
 				onBeforeMask: null, //executes before masking the initial value to allow preprocessing of the initial value.	args => initialValue, opts => return processedValue
-				onBeforePaste: null, //executes before masking the pasted value to allow preprocessing of the pasted value.	args => pastedValue, opts => return processedValue
+				onBeforePaste: function(pastedValue, opts) {
+					return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(pastedValue, opts) : pastedValue;
+				}, //executes before masking the pasted value to allow preprocessing of the pasted value.	args => pastedValue, opts => return processedValue
 				onBeforeWrite: null, //executes before writing to the masked element. args => event, opts
 				onUnMask: null, //executes after unmasking to allow postprocessing of the unmaskedvalue.	args => maskedValue, unmaskedValue, opts
 				showMaskOnFocus: true, //show the mask-placeholder when the input has focus
@@ -1474,7 +1476,7 @@
 
 			function getMaskLength() {
 				var maskLength;
-				maxLength = $el.prop("maxLength");
+				maxLength = el.maxLength;
 				if (maxLength === -1) maxLength = undefined; /* FF sets no defined max length to -1 */
 				var pos, lvp = getLastValidPosition(),
 					testPos = getMaskSet().validPositions[lvp],
@@ -1755,7 +1757,7 @@
 			}
 
 			function isComplete(buffer) { //return true / false / undefined (repeat *)
-				if ($.isFunction(opts.isComplete)) return opts.isComplete.call($el, buffer, opts);
+				if ($.isFunction(opts.isComplete)) return opts.isComplete.call(el, buffer, opts);
 				if (opts.repeat === "*") return undefined;
 				var complete = false,
 					lrp = determineLastRequiredPosition(true),
@@ -2452,7 +2454,7 @@
 
 				//show tooltip
 				if (opts.showTooltip) {
-					$el.prop("title", getMaskSet().mask);
+					el.title = getMaskSet().mask;
 				}
 
 				if (el.dir === "rtl" || opts.rightAlign) {

+ 0 - 3
js/inputmask.numeric.extensions.js

@@ -623,9 +623,6 @@ Optional extensions on the jquery.inputmask base
 					}
 					return initialValue.toString();
 				},
-				onBeforePaste: function(pastedValue, opts) {
-					return opts.onBeforeMask(pastedValue, opts);
-				},
 				canClearPosition: function(maskset, position, lvp, strict, opts) {
 					var positionInput = maskset.validPositions[position].input,
 						canClear = ((positionInput !== opts.radixPoint || (maskset.validPositions[position].match.fn !== null && opts.decimalProtect === false)) || isFinite(positionInput)) ||

+ 2 - 1
js/inputmask.phone.extensions.js

@@ -57,8 +57,9 @@ When using this extension make sure you specify the correct url to get the masks
 				nojumpsThreshold: 1,
 				onBeforeMask: function(value, opts) {
 					var processedValue = value.replace(/^0/g, "");
-					if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) === -1)
+					if (processedValue.indexOf(opts.countrycode) > 1 || processedValue.indexOf(opts.countrycode) === -1) {
 						processedValue = "+" + opts.countrycode + processedValue;
+					}
 
 					return processedValue;
 				}