@griddo/ax 1.56.1 → 1.56.5

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.1",
4
+ "version": "1.56.5",
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": "337c1eda056013bf9d886bb9fb95ddb20c9ae07c"
236
+ "gitHead": "f05dd72f2dff20925d58af9401479bfba5e34213"
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
- handleDelete(index);
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.map((field: any) => {
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>
@@ -80,7 +80,7 @@ const FileField = (props: IProps) => {
80
80
  <TextField
81
81
  name="url"
82
82
  value={value.url}
83
- onChange={() => {}}
83
+ onChange={() => null}
84
84
  readonly={true}
85
85
  icon="openOutside"
86
86
  onClickIcon={handleOnClickUrl}
@@ -1,8 +1,17 @@
1
1
  import React from "react";
2
2
 
3
3
  const getImage = (name: string) => {
4
+ const simpleIcons: any = {
5
+ es: "Es_ES",
6
+ en: "En_GB",
7
+ de: "De_DE",
8
+ fr: "Fr_FR",
9
+ it: "It_IT",
10
+ pt: "Pt_PT",
11
+ };
12
+ const filename = simpleIcons[name?.toLowerCase()] || name;
4
13
  try {
5
- return require(`./components/${name}`).default;
14
+ return require(`./components/${filename}`).default;
6
15
  } catch (err) {
7
16
  return null;
8
17
  }
@@ -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,