redux-freeform 5.8.2-beta.7 → 5.8.2-beta.9
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.
|
@@ -75,6 +75,9 @@ const IS_PERCENTAGE = 'validator/IS_PERCENTAGE';
|
|
|
75
75
|
const IS_PERCENTAGE_ERROR = 'error/IS_PERCENTAGE';
|
|
76
76
|
const isPercentage = createValidator(IS_PERCENTAGE, IS_PERCENTAGE_ERROR);
|
|
77
77
|
validatorFns[IS_PERCENTAGE] = (value, args, form) => {
|
|
78
|
+
if (value === '') {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
78
81
|
const parts = value.split('.');
|
|
79
82
|
if (parts.length > 2) {
|
|
80
83
|
// Ensure there are 1 or 2 parts (integer and optional decimal)
|
|
@@ -87,8 +90,8 @@ validatorFns[IS_PERCENTAGE] = (value, args, form) => {
|
|
|
87
90
|
return false;
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
|
-
const
|
|
91
|
-
return
|
|
93
|
+
const num = parseFloat(value);
|
|
94
|
+
return num >= 0 && num <= 100;
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
|
@@ -71,6 +71,9 @@ const IS_PERCENTAGE = 'validator/IS_PERCENTAGE';
|
|
|
71
71
|
const IS_PERCENTAGE_ERROR = 'error/IS_PERCENTAGE';
|
|
72
72
|
const isPercentage = createValidator(IS_PERCENTAGE, IS_PERCENTAGE_ERROR);
|
|
73
73
|
validatorFns[IS_PERCENTAGE] = (value, args, form) => {
|
|
74
|
+
if (value === '') {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
74
77
|
const parts = value.split('.');
|
|
75
78
|
if (parts.length > 2) {
|
|
76
79
|
// Ensure there are 1 or 2 parts (integer and optional decimal)
|
|
@@ -83,8 +86,8 @@ validatorFns[IS_PERCENTAGE] = (value, args, form) => {
|
|
|
83
86
|
return false;
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
|
-
const
|
|
87
|
-
return
|
|
89
|
+
const num = parseFloat(value);
|
|
90
|
+
return num >= 0 && num <= 100;
|
|
88
91
|
};
|
|
89
92
|
|
|
90
93
|
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
|
@@ -77,6 +77,9 @@
|
|
|
77
77
|
const IS_PERCENTAGE_ERROR = 'error/IS_PERCENTAGE';
|
|
78
78
|
const isPercentage = createValidator(IS_PERCENTAGE, IS_PERCENTAGE_ERROR);
|
|
79
79
|
validatorFns[IS_PERCENTAGE] = (value, args, form) => {
|
|
80
|
+
if (value === '') {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
80
83
|
const parts = value.split('.');
|
|
81
84
|
if (parts.length > 2) {
|
|
82
85
|
// Ensure there are 1 or 2 parts (integer and optional decimal)
|
|
@@ -89,8 +92,8 @@
|
|
|
89
92
|
return false;
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
|
-
const
|
|
93
|
-
return
|
|
95
|
+
const num = parseFloat(value);
|
|
96
|
+
return num >= 0 && num <= 100;
|
|
94
97
|
};
|
|
95
98
|
|
|
96
99
|
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redux-freeform",
|
|
3
|
-
"version": "5.8.2-beta.
|
|
3
|
+
"version": "5.8.2-beta.9",
|
|
4
4
|
"description": "A small Redux form library that supports purely functional apps, without magic",
|
|
5
5
|
"main": "dist/redux-freeform.cjs.js",
|
|
6
6
|
"module": "dist/redux-freeform.esm.js",
|