@griddo/ax 1.56.1 → 1.56.2
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 +2 -2
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldInline/index.tsx +16 -12
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldItem/index.tsx +17 -15
- package/src/components/Fields/ConditionalField/index.tsx +1 -3
- package/src/components/Fields/FileField/index.tsx +1 -1
- package/src/modules/StructuredData/Form/ConnectedField/index.tsx +1 -3
- package/src/modules/StructuredData/Form/index.tsx +1 -3
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.
|
|
4
|
+
"version": "1.56.2",
|
|
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": "
|
|
236
|
+
"gitHead": "76dddc292b1037223a780b2093399c3c6e12ce02"
|
|
237
237
|
}
|
|
@@ -7,8 +7,21 @@ import * as S from "./style";
|
|
|
7
7
|
const ArrayFieldInline = (props: IProps): JSX.Element => {
|
|
8
8
|
const { fields, item, index, onChange, handleDelete } = props;
|
|
9
9
|
|
|
10
|
-
const deleteItem = () =>
|
|
11
|
-
|
|
10
|
+
const deleteItem = () => handleDelete(index);
|
|
11
|
+
|
|
12
|
+
const getFields = (fields: any[]): any[] => {
|
|
13
|
+
return fields.map((field: any) => {
|
|
14
|
+
const key = field.props.objKey;
|
|
15
|
+
const handleChange = (newValue: any) => onChange({ [key]: newValue });
|
|
16
|
+
|
|
17
|
+
const innerFields = field.props.innerFields ? getFields(field.props.innerFields) : undefined;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
...field,
|
|
21
|
+
props: { ...field.props, value: item[key], objKey: key, onChange: handleChange, innerFields },
|
|
22
|
+
key,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
12
25
|
};
|
|
13
26
|
|
|
14
27
|
return (
|
|
@@ -17,16 +30,7 @@ const ArrayFieldInline = (props: IProps): JSX.Element => {
|
|
|
17
30
|
<S.IconWrapper>
|
|
18
31
|
<IconAction icon="delete" onClick={deleteItem} size="s" />
|
|
19
32
|
</S.IconWrapper>
|
|
20
|
-
{fields
|
|
21
|
-
const key = field.props.objKey;
|
|
22
|
-
const handleChange = (newValue: any) => onChange({ [key]: newValue });
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
...field,
|
|
26
|
-
props: { ...field.props, value: item[key], objKey: key, onChange: handleChange },
|
|
27
|
-
key,
|
|
28
|
-
};
|
|
29
|
-
})}
|
|
33
|
+
{getFields(fields)}
|
|
30
34
|
</S.Content>
|
|
31
35
|
</S.Wrapper>
|
|
32
36
|
);
|
|
@@ -9,9 +9,7 @@ const ArrayFieldItem = (props: IProps): JSX.Element => {
|
|
|
9
9
|
|
|
10
10
|
const handleClick = () => setIsOpen(!isOpen);
|
|
11
11
|
|
|
12
|
-
const deleteItem = () =>
|
|
13
|
-
handleDelete(index);
|
|
14
|
-
};
|
|
12
|
+
const deleteItem = () => handleDelete(index);
|
|
15
13
|
|
|
16
14
|
const menuOptions = [
|
|
17
15
|
{
|
|
@@ -21,24 +19,28 @@ const ArrayFieldItem = (props: IProps): JSX.Element => {
|
|
|
21
19
|
},
|
|
22
20
|
];
|
|
23
21
|
|
|
22
|
+
const getFields = (fields: any[]): any[] => {
|
|
23
|
+
return fields.map((field: any) => {
|
|
24
|
+
const key = field.props.objKey;
|
|
25
|
+
const handleChange = (newValue: any) => onChange({ [key]: newValue });
|
|
26
|
+
|
|
27
|
+
const innerFields = field.props.innerFields ? getFields(field.props.innerFields) : undefined;
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
...field,
|
|
31
|
+
props: { ...field.props, value: item[key], objKey: key, onChange: handleChange, innerFields },
|
|
32
|
+
key,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
24
37
|
return (
|
|
25
38
|
<S.Wrapper isOpen={isOpen}>
|
|
26
39
|
<S.Title onClick={handleClick} isOpen={isOpen}>
|
|
27
40
|
{`${name} ${index + 1}`}
|
|
28
41
|
<S.StyledActionMenu icon="more" options={menuOptions} />
|
|
29
42
|
</S.Title>
|
|
30
|
-
<S.Content isOpen={isOpen}>
|
|
31
|
-
{fields.map((field: any) => {
|
|
32
|
-
const key = field.props.objKey;
|
|
33
|
-
const handleChange = (newValue: any) => onChange({ [key]: newValue });
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
...field,
|
|
37
|
-
props: { ...field.props, value: item[key], objKey: key, onChange: handleChange },
|
|
38
|
-
key,
|
|
39
|
-
};
|
|
40
|
-
})}
|
|
41
|
-
</S.Content>
|
|
43
|
+
<S.Content isOpen={isOpen}>{getFields(fields)}</S.Content>
|
|
42
44
|
</S.Wrapper>
|
|
43
45
|
);
|
|
44
46
|
};
|
|
@@ -6,9 +6,7 @@ import * as S from "./style";
|
|
|
6
6
|
const ConditionalField = (props: IConditionalFieldProps) => {
|
|
7
7
|
const { value, options, innerFields, onChange } = props;
|
|
8
8
|
|
|
9
|
-
const handleChange = (newValue: any) =>
|
|
10
|
-
onChange(newValue);
|
|
11
|
-
};
|
|
9
|
+
const handleChange = (newValue: any) => onChange(newValue);
|
|
12
10
|
|
|
13
11
|
return (
|
|
14
12
|
<S.Wrapper>
|
|
@@ -13,9 +13,7 @@ const ConnectedField = (props: IProps) => {
|
|
|
13
13
|
|
|
14
14
|
const value = form.content && form.content[fieldKey];
|
|
15
15
|
|
|
16
|
-
const handleChange = (newValue: any) => {
|
|
17
|
-
updateFormValue({ [fieldKey]: newValue });
|
|
18
|
-
};
|
|
16
|
+
const handleChange = (newValue: any) => updateFormValue({ [fieldKey]: newValue });
|
|
19
17
|
|
|
20
18
|
const isConditional = field.type === "ConditionalField";
|
|
21
19
|
const isArrayGroup = field.type === "ArrayFieldGroup";
|
|
@@ -92,9 +92,7 @@ const Form = (props: IProps) => {
|
|
|
92
92
|
|
|
93
93
|
const inversed = !currentSite;
|
|
94
94
|
|
|
95
|
-
const createNewTranslation = (value: boolean) =>
|
|
96
|
-
setisNewStructuredData(value);
|
|
97
|
-
};
|
|
95
|
+
const createNewTranslation = (value: boolean) => setisNewStructuredData(value);
|
|
98
96
|
|
|
99
97
|
const languageActions = {
|
|
100
98
|
setLanguage,
|