@griddo/ax 1.56.0 → 1.56.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "1.56.0",
4
+ "version": "1.56.1",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -233,5 +233,5 @@
233
233
  "publishConfig": {
234
234
  "access": "public"
235
235
  },
236
- "gitHead": "da5400112025b528c1c0946cd76b1cfbedf00362"
236
+ "gitHead": "337c1eda056013bf9d886bb9fb95ddb20c9ae07c"
237
237
  }
@@ -3,7 +3,7 @@ import { FieldContainer, FieldsBehavior } from "@ax/components";
3
3
  import { IErrorItem, IPage } from "@ax/types";
4
4
 
5
5
  const getInnerFields = (
6
- innerFields: any,
6
+ innerFields: any[],
7
7
  innerActions: any,
8
8
  selectedContent: IPage,
9
9
  isTemplateActivated: boolean,
@@ -49,22 +49,35 @@ const getInnerFields = (
49
49
  );
50
50
  };
51
51
 
52
- const getStructuredDataInnerFields = (innerFields: any) => {
52
+ const getStructuredDataInnerFields = (
53
+ innerFields: any[],
54
+ content: any,
55
+ updateValue: (value: Record<string, unknown>) => void
56
+ ) => {
53
57
  let fieldArr: any[] = [];
54
58
 
55
59
  return (
56
60
  innerFields &&
57
61
  innerFields.map((singleFieldProps: any) => {
58
- const { key } = singleFieldProps;
62
+ const { key, type, fields } = singleFieldProps;
59
63
 
60
- if (singleFieldProps.type === "ConditionalField" || singleFieldProps.type === "ArrayFieldGroup") {
61
- fieldArr = getStructuredDataInnerFields(singleFieldProps.fields);
64
+ const handleChange = (newValue: any) => {
65
+ updateValue({ [key]: newValue });
66
+ };
67
+
68
+ const value = content && content[key];
69
+
70
+ if (type === "ConditionalField" || type === "ArrayFieldGroup") {
71
+ fieldArr = getStructuredDataInnerFields(fields, content, updateValue);
62
72
  }
63
73
 
64
74
  const fieldProps = {
75
+ value,
65
76
  objKey: key,
66
- fieldType: singleFieldProps.type,
77
+ fieldType: type,
67
78
  innerFields: fieldArr,
79
+ field: singleFieldProps,
80
+ onChange: handleChange,
68
81
  ...singleFieldProps,
69
82
  };
70
83
 
@@ -23,7 +23,7 @@ const ConnectedField = (props: IProps) => {
23
23
  let innerFields: JSX.Element[] = [];
24
24
 
25
25
  if (isConditional || isArrayGroup) {
26
- innerFields = getStructuredDataInnerFields(field.fields);
26
+ innerFields = getStructuredDataInnerFields(field.fields, form.content, updateFormValue);
27
27
  }
28
28
 
29
29
  const fieldProps = {