@bolttech/form-engine-core 0.0.3-beta.6 → 0.0.3-beta.8

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
@@ -3293,10 +3293,8 @@ class FormCore {
3293
3293
  }
3294
3294
  const fieldProp = field[property];
3295
3295
  let propState;
3296
- if (Array.isArray(fieldProp)) {
3297
- propState = [...fieldProp];
3298
- } else if (typeof fieldProp === 'object' && !isNil(fieldProp)) {
3299
- propState = Object.assign({}, fieldProp);
3296
+ if (Array.isArray(fieldProp) || typeof fieldProp === 'object' && !isNil(fieldProp)) {
3297
+ propState = cloneDeep(fieldProp);
3300
3298
  } else {
3301
3299
  this.config.defaultLogVerbose && console.warn(`invalid template property, skipping evaluation of ${field.name} with ${fieldProp}`);
3302
3300
  return;
@@ -3882,10 +3880,12 @@ class FormCore {
3882
3880
  */
3883
3881
  getFormValues() {
3884
3882
  const values = {};
3883
+ const metadata = {};
3885
3884
  const erroredFields = [];
3886
3885
  this.fields.forEach((val, key) => {
3887
3886
  if (val.value) {
3888
3887
  set(values, val.nameToSubmit || key, val.value);
3888
+ metadata[key] = val.metadata;
3889
3889
  }
3890
3890
  if (!val.valid) {
3891
3891
  erroredFields.push(key);
@@ -3893,6 +3893,7 @@ class FormCore {
3893
3893
  });
3894
3894
  return {
3895
3895
  values,
3896
+ metadata,
3896
3897
  erroredFields,
3897
3898
  isValid: this.isValid
3898
3899
  };
@@ -4136,6 +4137,7 @@ class FormGroup {
4136
4137
  submitMultipleFormsByIndex(indexes, callback) {
4137
4138
  let isValid = true;
4138
4139
  let values = {};
4140
+ let metadata = {};
4139
4141
  let erroredFields = [];
4140
4142
  indexes.forEach(index => {
4141
4143
  var _a, _b;
@@ -4143,12 +4145,14 @@ class FormGroup {
4143
4145
  const res = (_b = this.forms.get(index)) === null || _b === void 0 ? void 0 : _b.getFormValues();
4144
4146
  isValid = isValid && ((res === null || res === void 0 ? void 0 : res.isValid) || false);
4145
4147
  values = Object.assign(Object.assign({}, values), (res === null || res === void 0 ? void 0 : res.values) || {});
4148
+ metadata = Object.assign(Object.assign({}, metadata), (res === null || res === void 0 ? void 0 : res.metadata) || {});
4146
4149
  erroredFields = [...erroredFields, ...((res === null || res === void 0 ? void 0 : res.erroredFields) || [])];
4147
4150
  });
4148
4151
  isValid && callback && callback({
4149
4152
  erroredFields,
4150
4153
  isValid,
4151
- values
4154
+ values,
4155
+ metadata
4152
4156
  });
4153
4157
  }
4154
4158
  onDataSubscription({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "0.0.3-beta.6",
3
+ "version": "0.0.3-beta.8",
4
4
  "module": "./index.esm.js",
5
5
  "type": "module",
6
6
  "main": "./index.esm.js",
@@ -19,6 +19,7 @@ import { TMapper } from './mapper';
19
19
  */
20
20
  type TFormValues<T> = {
21
21
  values: T;
22
+ metadata: unknown;
22
23
  erroredFields: string[];
23
24
  isValid: boolean;
24
25
  };