@bolttech/form-engine-core 0.0.1-beta.12 → 0.0.1-beta.13
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/index.esm.js +11 -3
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -2638,7 +2638,8 @@ class FormField {
|
|
|
2638
2638
|
event
|
|
2639
2639
|
}) {
|
|
2640
2640
|
var _a;
|
|
2641
|
-
if (!this.validations) {
|
|
2641
|
+
if (!this.validations || !this.visibility) {
|
|
2642
|
+
this.errors = {};
|
|
2642
2643
|
this._valid = true;
|
|
2643
2644
|
return;
|
|
2644
2645
|
}
|
|
@@ -3221,10 +3222,16 @@ class FormCore {
|
|
|
3221
3222
|
const error = validations[validationKey](field.value, structElement.validations);
|
|
3222
3223
|
if (Array.isArray(structElement.fields)) {
|
|
3223
3224
|
structElement.fields.forEach(fieldKey => {
|
|
3224
|
-
if (!this.fields.has(fieldKey)) console.warn(`failed to update visibility onto field ${fieldKey}`);else
|
|
3225
|
+
if (!this.fields.has(fieldKey)) console.warn(`failed to update visibility onto field ${fieldKey}`);else {
|
|
3226
|
+
this.fields.get(fieldKey).visibility = !error;
|
|
3227
|
+
if (error) this.fields.get(fieldKey).value = '';
|
|
3228
|
+
}
|
|
3225
3229
|
});
|
|
3226
3230
|
} else if (structElement.fields) {
|
|
3227
|
-
if (!this.fields.has(structElement.fields)) console.warn(`failed to update visibility onto field ${structElement.fields}`);else
|
|
3231
|
+
if (!this.fields.has(structElement.fields)) console.warn(`failed to update visibility onto field ${structElement.fields}`);else {
|
|
3232
|
+
this.fields.get(structElement.fields).visibility = !error;
|
|
3233
|
+
if (error) this.fields.get(structElement.fields).value = '';
|
|
3234
|
+
}
|
|
3228
3235
|
}
|
|
3229
3236
|
});
|
|
3230
3237
|
});
|
|
@@ -3413,6 +3420,7 @@ class FormCore {
|
|
|
3413
3420
|
set(values, val.nameToSubmit || key, val.value);
|
|
3414
3421
|
}
|
|
3415
3422
|
});
|
|
3423
|
+
console.log(values);
|
|
3416
3424
|
}
|
|
3417
3425
|
/**
|
|
3418
3426
|
* Gets the current values of all form fields.
|