redux-freeform 5.3.0 → 5.5.0
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);
|
|
@@ -131,12 +137,12 @@ const MATCHES_FIELD_ERROR = "error/MATCHES_FIELD";
|
|
|
131
137
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR);
|
|
132
138
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
133
139
|
const dependentField = form[args[0]];
|
|
134
|
-
const dependentFieldValue = dependentField?.rawValue ?? "";
|
|
135
140
|
if (dependentField === undefined) {
|
|
136
141
|
throw new Error(
|
|
137
142
|
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
138
143
|
);
|
|
139
144
|
}
|
|
145
|
+
const dependentFieldValue = dependentField.rawValue;
|
|
140
146
|
return value === dependentFieldValue;
|
|
141
147
|
};
|
|
142
148
|
|
|
@@ -1741,6 +1747,7 @@ exports.hasLowercaseLetter = hasLowercaseLetter;
|
|
|
1741
1747
|
exports.hasNumber = hasNumber;
|
|
1742
1748
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
1743
1749
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
1750
|
+
exports.includedIn = includedIn;
|
|
1744
1751
|
exports.isProbablyEmail = isProbablyEmail;
|
|
1745
1752
|
exports.isRoutingNumber = isRoutingNumber;
|
|
1746
1753
|
exports.isValidMonth = isValidMonth;
|
|
@@ -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);
|
|
@@ -127,12 +133,12 @@ const MATCHES_FIELD_ERROR = "error/MATCHES_FIELD";
|
|
|
127
133
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR);
|
|
128
134
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
129
135
|
const dependentField = form[args[0]];
|
|
130
|
-
const dependentFieldValue = dependentField?.rawValue ?? "";
|
|
131
136
|
if (dependentField === undefined) {
|
|
132
137
|
throw new Error(
|
|
133
138
|
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
134
139
|
);
|
|
135
140
|
}
|
|
141
|
+
const dependentFieldValue = dependentField.rawValue;
|
|
136
142
|
return value === dependentFieldValue;
|
|
137
143
|
};
|
|
138
144
|
|
|
@@ -1729,4 +1735,4 @@ const createFormState = formConfig => ({
|
|
|
1729
1735
|
mapStateToProps: mapStateToProps
|
|
1730
1736
|
});
|
|
1731
1737
|
|
|
1732
|
-
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyIntegers, onlyNaturals, required, validateSum, validateWhen };
|
|
1738
|
+
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, includedIn, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, 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);
|
|
@@ -133,12 +139,12 @@
|
|
|
133
139
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR);
|
|
134
140
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
135
141
|
const dependentField = form[args[0]];
|
|
136
|
-
const dependentFieldValue = dependentField?.rawValue ?? "";
|
|
137
142
|
if (dependentField === undefined) {
|
|
138
143
|
throw new Error(
|
|
139
144
|
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
140
145
|
);
|
|
141
146
|
}
|
|
147
|
+
const dependentFieldValue = dependentField.rawValue;
|
|
142
148
|
return value === dependentFieldValue;
|
|
143
149
|
};
|
|
144
150
|
|
|
@@ -1743,6 +1749,7 @@
|
|
|
1743
1749
|
exports.hasNumber = hasNumber;
|
|
1744
1750
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
1745
1751
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
1752
|
+
exports.includedIn = includedIn;
|
|
1746
1753
|
exports.isProbablyEmail = isProbablyEmail;
|
|
1747
1754
|
exports.isRoutingNumber = isRoutingNumber;
|
|
1748
1755
|
exports.isValidMonth = isValidMonth;
|
package/package.json
CHANGED