@bolttech/form-engine-core 0.0.1-beta.38 → 0.0.1-beta.39

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 CHANGED
@@ -3418,17 +3418,23 @@ class FormCore {
3418
3418
  if (!structResetValue || !(structResetValue === null || structResetValue === void 0 ? void 0 : structResetValue.some(config => config.events.includes(event)))) return;
3419
3419
  structResetValue.forEach(structElement => {
3420
3420
  if (!structElement.events.includes(event)) return;
3421
+ const handleFieldRestoration = () => {
3422
+ if (Array.isArray(structElement.fields)) {
3423
+ structElement.fields.forEach((fieldKey, index) => {
3424
+ const resettledValue = Array.isArray(structElement.resettledValue) ? structElement.resettledValue[index] : structElement.resettledValue;
3425
+ this.setResetFieldValue(fieldKey, resettledValue);
3426
+ });
3427
+ } else if (structElement.fields) {
3428
+ this.setResetFieldValue(structElement.fields, structElement.resettledValue);
3429
+ }
3430
+ };
3431
+ if (!structElement.validations) {
3432
+ return handleFieldRestoration();
3433
+ }
3421
3434
  Object.keys(structElement.validations).forEach(validationKey => {
3422
3435
  const error = handleValidation(field.value, structElement.validations, validations, validationKey);
3423
3436
  if (!error) {
3424
- if (Array.isArray(structElement.fields)) {
3425
- structElement.fields.forEach((fieldKey, index) => {
3426
- const resettledValue = Array.isArray(structElement.resettledValue) ? structElement.resettledValue[index] : structElement.resettledValue;
3427
- this.setResetFieldValue(fieldKey, resettledValue);
3428
- });
3429
- } else if (structElement.fields) {
3430
- this.setResetFieldValue(structElement.fields, structElement.resettledValue);
3431
- }
3437
+ handleFieldRestoration();
3432
3438
  }
3433
3439
  });
3434
3440
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "0.0.1-beta.38",
3
+ "version": "0.0.1-beta.39",
4
4
  "module": "./index.esm.js",
5
5
  "type": "module",
6
6
  "main": "./index.esm.js",
@@ -654,8 +654,9 @@ type TVisibility = {
654
654
  * };
655
655
  * ```
656
656
  */
657
- type TResetValueMethods = TVisibility & {
657
+ type TResetValueMethods = Omit<TVisibility, 'showOnlyIfTrue' | 'validations'> & {
658
658
  resettledValue: unknown[] | unknown;
659
+ validations?: TSchemaValidation;
659
660
  };
660
661
  /**
661
662
  * @type TApiConfig