@abp/jquery-validation 9.3.5 → 10.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abp.resourcemapping.js +2 -1
- package/package.json +2 -2
- package/src/abp.jquery.validate.js +27 -0
package/abp.resourcemapping.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
mappings: {
|
|
3
3
|
"@node_modules/jquery-validation/dist/jquery.validate.js": "@libs/jquery-validation/",
|
|
4
|
-
"@node_modules/jquery-validation/dist/localization/*.*": "@libs/jquery-validation/localization/"
|
|
4
|
+
"@node_modules/jquery-validation/dist/localization/*.*": "@libs/jquery-validation/localization/",
|
|
5
|
+
"@node_modules/@abp/jquery-validation/src/*.*": "@libs/jquery-validation/"
|
|
5
6
|
}
|
|
6
7
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "10.0.0-rc.1",
|
|
3
3
|
"name": "@abp/jquery-validation",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@abp/jquery": "~
|
|
13
|
+
"@abp/jquery": "~10.0.0-rc.1",
|
|
14
14
|
"jquery-validation": "^1.21.0"
|
|
15
15
|
},
|
|
16
16
|
"gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
$.validator.methods.range = function (value, element, param) {
|
|
2
|
+
if (this.optional(element)) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// Remove thousands separators and convert decimal separators
|
|
7
|
+
var cleanValue = value.replace(/[.,](?=.*[.,])/g, '').replace(/[.,](?!.*[.,])/g, '.');
|
|
8
|
+
var numericValue = parseFloat(cleanValue);
|
|
9
|
+
|
|
10
|
+
// Check if conversion was successful and value is within range
|
|
11
|
+
return !isNaN(numericValue) && (numericValue >= param[0] && numericValue <= param[1]);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
$.validator.methods.number = function (value, element) {
|
|
15
|
+
if (this.optional(element)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 1. Period as decimal separator, comma as thousands separator (e.g., 1,234.56 or -1,234.56)
|
|
20
|
+
// 2. Comma as decimal separator, period as thousands separator (e.g., 1.234,56 or -1.234,56)
|
|
21
|
+
// 3. Pure numbers (integers)
|
|
22
|
+
var pattern1 = /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/;
|
|
23
|
+
var pattern2 = /^(?:-?\d+|-?\d{1,3}(?:\.\d{3})+)?(?:-?,\d+)?$/;
|
|
24
|
+
var pattern3 = /^-?\d+$/;
|
|
25
|
+
|
|
26
|
+
return pattern1.test(value) || pattern2.test(value) || pattern3.test(value);
|
|
27
|
+
}
|