redux-freeform 5.4.0 → 5.6.0-beta.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.
|
@@ -55,6 +55,12 @@ dayjs.extend(isSameOrAfter);
|
|
|
55
55
|
|
|
56
56
|
let validatorFns = {};
|
|
57
57
|
|
|
58
|
+
const INCLUDED_IN = "validator/INCLUDED_IN";
|
|
59
|
+
const INCLUDED_IN_ERROR = "error/INCLUDED_IN";
|
|
60
|
+
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
61
|
+
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
62
|
+
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
63
|
+
|
|
58
64
|
const REQUIRED = "validator/REQUIRED";
|
|
59
65
|
const REQUIRED_ERROR = "error/REQUIRED";
|
|
60
66
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
@@ -70,6 +76,26 @@ const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
|
70
76
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
71
77
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
72
78
|
|
|
79
|
+
/*
|
|
80
|
+
07/22: experimental expiration date constraint
|
|
81
|
+
should allow entry of expiration date using "/" character
|
|
82
|
+
to accommodate browser autofill
|
|
83
|
+
|
|
84
|
+
not tested as validation function
|
|
85
|
+
to validate exp date instead use combo of:
|
|
86
|
+
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
87
|
+
*/
|
|
88
|
+
const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
|
|
89
|
+
const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
|
|
90
|
+
const onlyExpirationDate = createValidator(
|
|
91
|
+
ONLY_EXPIRATION_DATE,
|
|
92
|
+
ONLY_EXPIRATION_DATE_ERROR
|
|
93
|
+
);
|
|
94
|
+
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
95
|
+
/^((0[1-9])|(1[0-2])|([1-9]))([\/])?((2[2-9])|(3[0-9])|(4[0-9])|(5[0-9]))$/.test(
|
|
96
|
+
value
|
|
97
|
+
);
|
|
98
|
+
|
|
73
99
|
const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
74
100
|
const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
75
101
|
const numberLessThan = createValidator(
|
|
@@ -1741,6 +1767,7 @@ exports.hasLowercaseLetter = hasLowercaseLetter;
|
|
|
1741
1767
|
exports.hasNumber = hasNumber;
|
|
1742
1768
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
1743
1769
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
1770
|
+
exports.includedIn = includedIn;
|
|
1744
1771
|
exports.isProbablyEmail = isProbablyEmail;
|
|
1745
1772
|
exports.isRoutingNumber = isRoutingNumber;
|
|
1746
1773
|
exports.isValidMonth = isValidMonth;
|
|
@@ -1750,6 +1777,7 @@ exports.numberGreaterThan = numberGreaterThan;
|
|
|
1750
1777
|
exports.numberGreaterThanOrEqualTo = numberGreaterThanOrEqualTo;
|
|
1751
1778
|
exports.numberLessThan = numberLessThan;
|
|
1752
1779
|
exports.numberLessThanOrEqualTo = numberLessThanOrEqualTo;
|
|
1780
|
+
exports.onlyExpirationDate = onlyExpirationDate;
|
|
1753
1781
|
exports.onlyIntegers = onlyIntegers;
|
|
1754
1782
|
exports.onlyNaturals = onlyNaturals;
|
|
1755
1783
|
exports.required = required;
|
|
@@ -51,6 +51,12 @@ dayjs.extend(isSameOrAfter);
|
|
|
51
51
|
|
|
52
52
|
let validatorFns = {};
|
|
53
53
|
|
|
54
|
+
const INCLUDED_IN = "validator/INCLUDED_IN";
|
|
55
|
+
const INCLUDED_IN_ERROR = "error/INCLUDED_IN";
|
|
56
|
+
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
57
|
+
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
58
|
+
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
59
|
+
|
|
54
60
|
const REQUIRED = "validator/REQUIRED";
|
|
55
61
|
const REQUIRED_ERROR = "error/REQUIRED";
|
|
56
62
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
@@ -66,6 +72,26 @@ const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
|
66
72
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
67
73
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
68
74
|
|
|
75
|
+
/*
|
|
76
|
+
07/22: experimental expiration date constraint
|
|
77
|
+
should allow entry of expiration date using "/" character
|
|
78
|
+
to accommodate browser autofill
|
|
79
|
+
|
|
80
|
+
not tested as validation function
|
|
81
|
+
to validate exp date instead use combo of:
|
|
82
|
+
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
83
|
+
*/
|
|
84
|
+
const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
|
|
85
|
+
const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
|
|
86
|
+
const onlyExpirationDate = createValidator(
|
|
87
|
+
ONLY_EXPIRATION_DATE,
|
|
88
|
+
ONLY_EXPIRATION_DATE_ERROR
|
|
89
|
+
);
|
|
90
|
+
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
91
|
+
/^((0[1-9])|(1[0-2])|([1-9]))([\/])?((2[2-9])|(3[0-9])|(4[0-9])|(5[0-9]))$/.test(
|
|
92
|
+
value
|
|
93
|
+
);
|
|
94
|
+
|
|
69
95
|
const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
70
96
|
const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
71
97
|
const numberLessThan = createValidator(
|
|
@@ -1729,4 +1755,4 @@ const createFormState = formConfig => ({
|
|
|
1729
1755
|
mapStateToProps: mapStateToProps
|
|
1730
1756
|
});
|
|
1731
1757
|
|
|
1732
|
-
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyIntegers, onlyNaturals, required, validateSum, validateWhen };
|
|
1758
|
+
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyExpirationDate, onlyIntegers, onlyNaturals, required, validateSum, validateWhen };
|
|
@@ -57,6 +57,12 @@
|
|
|
57
57
|
|
|
58
58
|
let validatorFns = {};
|
|
59
59
|
|
|
60
|
+
const INCLUDED_IN = "validator/INCLUDED_IN";
|
|
61
|
+
const INCLUDED_IN_ERROR = "error/INCLUDED_IN";
|
|
62
|
+
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
63
|
+
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
64
|
+
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
65
|
+
|
|
60
66
|
const REQUIRED = "validator/REQUIRED";
|
|
61
67
|
const REQUIRED_ERROR = "error/REQUIRED";
|
|
62
68
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
@@ -72,6 +78,26 @@
|
|
|
72
78
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
73
79
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
74
80
|
|
|
81
|
+
/*
|
|
82
|
+
07/22: experimental expiration date constraint
|
|
83
|
+
should allow entry of expiration date using "/" character
|
|
84
|
+
to accommodate browser autofill
|
|
85
|
+
|
|
86
|
+
not tested as validation function
|
|
87
|
+
to validate exp date instead use combo of:
|
|
88
|
+
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
89
|
+
*/
|
|
90
|
+
const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
|
|
91
|
+
const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
|
|
92
|
+
const onlyExpirationDate = createValidator(
|
|
93
|
+
ONLY_EXPIRATION_DATE,
|
|
94
|
+
ONLY_EXPIRATION_DATE_ERROR
|
|
95
|
+
);
|
|
96
|
+
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
97
|
+
/^((0[1-9])|(1[0-2])|([1-9]))([\/])?((2[2-9])|(3[0-9])|(4[0-9])|(5[0-9]))$/.test(
|
|
98
|
+
value
|
|
99
|
+
);
|
|
100
|
+
|
|
75
101
|
const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
76
102
|
const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
77
103
|
const numberLessThan = createValidator(
|
|
@@ -1743,6 +1769,7 @@
|
|
|
1743
1769
|
exports.hasNumber = hasNumber;
|
|
1744
1770
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
1745
1771
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
1772
|
+
exports.includedIn = includedIn;
|
|
1746
1773
|
exports.isProbablyEmail = isProbablyEmail;
|
|
1747
1774
|
exports.isRoutingNumber = isRoutingNumber;
|
|
1748
1775
|
exports.isValidMonth = isValidMonth;
|
|
@@ -1752,6 +1779,7 @@
|
|
|
1752
1779
|
exports.numberGreaterThanOrEqualTo = numberGreaterThanOrEqualTo;
|
|
1753
1780
|
exports.numberLessThan = numberLessThan;
|
|
1754
1781
|
exports.numberLessThanOrEqualTo = numberLessThanOrEqualTo;
|
|
1782
|
+
exports.onlyExpirationDate = onlyExpirationDate;
|
|
1755
1783
|
exports.onlyIntegers = onlyIntegers;
|
|
1756
1784
|
exports.onlyNaturals = onlyNaturals;
|
|
1757
1785
|
exports.required = required;
|
package/package.json
CHANGED