@thecb/components 6.1.3 → 6.1.4-beta.3
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/dist/index.esm.js
CHANGED
|
@@ -34722,6 +34722,24 @@ const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
|
34722
34722
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
34723
34723
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
34724
34724
|
|
|
34725
|
+
/*
|
|
34726
|
+
07/22: experimental expiration date constraint
|
|
34727
|
+
should allow entry of expiration date using "/" character
|
|
34728
|
+
to accommodate browser autofill
|
|
34729
|
+
|
|
34730
|
+
not tested as validation function
|
|
34731
|
+
to validate exp date instead use combo of:
|
|
34732
|
+
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
34733
|
+
*/
|
|
34734
|
+
const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
|
|
34735
|
+
const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
|
|
34736
|
+
const onlyExpirationDate = createValidator(
|
|
34737
|
+
ONLY_EXPIRATION_DATE,
|
|
34738
|
+
ONLY_EXPIRATION_DATE_ERROR
|
|
34739
|
+
);
|
|
34740
|
+
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
34741
|
+
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
34742
|
+
|
|
34725
34743
|
const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
34726
34744
|
const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
34727
34745
|
const numberLessThan = createValidator(
|
|
@@ -35110,10 +35128,24 @@ const runValidator = (validator, value, form) => {
|
|
|
35110
35128
|
if (validatorFn === undefined) {
|
|
35111
35129
|
throw new Error(runValidatorErrorMessage(validator.type));
|
|
35112
35130
|
}
|
|
35131
|
+
console.log(
|
|
35132
|
+
"run validator (validator, value, form):",
|
|
35133
|
+
validator.type,
|
|
35134
|
+
validator.args,
|
|
35135
|
+
value,
|
|
35136
|
+
form
|
|
35137
|
+
);
|
|
35113
35138
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
35114
35139
|
};
|
|
35115
35140
|
|
|
35116
35141
|
const _computeErrors = (fieldName, form, validators) => {
|
|
35142
|
+
console.log("field name is", fieldName);
|
|
35143
|
+
console.log("form is", form);
|
|
35144
|
+
console.log("validators are", validators);
|
|
35145
|
+
const validatorsResult = validators.map(v =>
|
|
35146
|
+
runValidator(v, form[fieldName].rawValue, form)
|
|
35147
|
+
);
|
|
35148
|
+
console.log("validators result is", validatorsResult);
|
|
35117
35149
|
return validators
|
|
35118
35150
|
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
35119
35151
|
.filter(x => x !== null);
|
|
@@ -42291,7 +42323,7 @@ var formConfig$8 = {
|
|
|
42291
42323
|
},
|
|
42292
42324
|
expirationDate: {
|
|
42293
42325
|
validators: [required(), hasLength(4, 4), isValidMonth(0), dateAfterToday("MMYY", "month", true)],
|
|
42294
|
-
constraints: [
|
|
42326
|
+
constraints: [onlyExpirationDate(), hasLength(0, 4)]
|
|
42295
42327
|
},
|
|
42296
42328
|
cvv: {
|
|
42297
42329
|
validators: [required(), hasLength(3, 4)],
|