@akemona-org/strapi-plugin-content-type-builder 3.7.0 → 3.7.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.
Files changed (87) hide show
  1. package/admin/src/components/AllowedTypesSelect/index.js +1 -1
  2. package/admin/src/components/AttributeOption/index.js +1 -1
  3. package/admin/src/components/BooleanBox/icons/CTSelected.js +1 -1
  4. package/admin/src/components/BooleanBox/icons/CTUnselected.js +1 -1
  5. package/admin/src/components/BooleanBox/icons/STSelected.js +1 -1
  6. package/admin/src/components/BooleanBox/icons/STUnselected.js +1 -1
  7. package/admin/src/components/BooleanBox/index.js +3 -3
  8. package/admin/src/components/ComponentCard/index.js +1 -1
  9. package/admin/src/components/ComponentIconPicker/CellRenderer.js +1 -6
  10. package/admin/src/components/ComponentIconPicker/index.js +4 -4
  11. package/admin/src/components/ComponentList/index.js +1 -3
  12. package/admin/src/components/ComponentSelect/MenuList.js +5 -6
  13. package/admin/src/components/ComponentSelect/MultipleMenuList.js +15 -15
  14. package/admin/src/components/ComponentSelect/Value.js +3 -11
  15. package/admin/src/components/ComponentSelect/utils/HasSomeSubArray.js +1 -1
  16. package/admin/src/components/ComponentSelect/utils/hasSubArray.js +1 -1
  17. package/admin/src/components/CreatableSelect/index.js +2 -2
  18. package/admin/src/components/CustomCheckbox/index.js +1 -1
  19. package/admin/src/components/DynamicZoneList/index.js +1 -1
  20. package/admin/src/components/HeaderNavLink/index.js +2 -4
  21. package/admin/src/components/List/index.js +1 -1
  22. package/admin/src/components/ListHeader/index.js +1 -1
  23. package/admin/src/components/ListRow/index.js +3 -3
  24. package/admin/src/components/ModalHeader/DropdownInfos.js +1 -1
  25. package/admin/src/components/ModalHeader/index.js +2 -8
  26. package/admin/src/components/RelationForm/index.js +2 -8
  27. package/admin/src/components/RelationFormBox/index.js +1 -3
  28. package/admin/src/components/RelationFormNaturePicker/index.js +1 -1
  29. package/admin/src/components/RelationTargetPicker/index.js +2 -2
  30. package/admin/src/components/SelectMenuUl/index.js +1 -1
  31. package/admin/src/components/WrapperSelect/index.js +2 -2
  32. package/admin/src/containers/DataManagerProvider/constants.js +10 -5
  33. package/admin/src/containers/DataManagerProvider/index.js +15 -17
  34. package/admin/src/containers/DataManagerProvider/reducer.js +25 -25
  35. package/admin/src/containers/DataManagerProvider/selectors.js +2 -2
  36. package/admin/src/containers/DataManagerProvider/utils/cleanData.js +8 -8
  37. package/admin/src/containers/DataManagerProvider/utils/createDataObject.js +1 -1
  38. package/admin/src/containers/DataManagerProvider/utils/createModifiedDataSchema.js +25 -42
  39. package/admin/src/containers/DataManagerProvider/utils/retrieveComponentsFromSchema.js +6 -21
  40. package/admin/src/containers/DataManagerProvider/utils/retrieveComponentsThatHaveComponents.js +12 -18
  41. package/admin/src/containers/DataManagerProvider/utils/retrieveNestedComponents.js +4 -10
  42. package/admin/src/containers/DataManagerProvider/utils/retrieveSpecificInfoFromComponents.js +1 -1
  43. package/admin/src/containers/FormModal/attributes/advancedForm.js +6 -6
  44. package/admin/src/containers/FormModal/attributes/baseForm.js +5 -5
  45. package/admin/src/containers/FormModal/attributes/types.js +10 -23
  46. package/admin/src/containers/FormModal/attributes/validation/common.js +8 -16
  47. package/admin/src/containers/FormModal/category/createCategorySchema.js +2 -2
  48. package/admin/src/containers/FormModal/component/createComponentSchema.js +2 -2
  49. package/admin/src/containers/FormModal/constants.js +10 -5
  50. package/admin/src/containers/FormModal/contentType/createContentTypeSchema.js +2 -2
  51. package/admin/src/containers/FormModal/contentType/form.js +1 -1
  52. package/admin/src/containers/FormModal/forms/index.js +5 -5
  53. package/admin/src/containers/FormModal/index.js +15 -15
  54. package/admin/src/containers/FormModal/reducer.js +9 -9
  55. package/admin/src/containers/FormModal/selectors.js +2 -2
  56. package/admin/src/containers/FormModal/utils/createHeadersArray.js +3 -6
  57. package/admin/src/containers/FormModal/utils/createHeadersObjectFromArray.js +1 -1
  58. package/admin/src/containers/FormModal/utils/createUid.js +2 -2
  59. package/admin/src/containers/FormModal/utils/getModalTitleSubHeader.js +1 -1
  60. package/admin/src/containers/FormModal/utils/relations.js +2 -2
  61. package/admin/src/containers/LeftMenu/index.js +11 -11
  62. package/admin/src/containers/ListView/index.js +4 -4
  63. package/admin/src/icons/Curve.js +1 -1
  64. package/admin/src/icons/ManyToMany.js +3 -12
  65. package/admin/src/icons/ManyToOne.js +1 -4
  66. package/admin/src/icons/OneToMany.js +2 -8
  67. package/admin/src/index.js +1 -1
  68. package/admin/src/pluginId.js +1 -1
  69. package/admin/src/utils/convertAttrObjToArray.js +1 -1
  70. package/admin/src/utils/formAPI.js +2 -2
  71. package/admin/src/utils/getAttributeDisplayedType.js +1 -1
  72. package/admin/src/utils/getComponents.js +2 -2
  73. package/admin/src/utils/getTrad.js +1 -1
  74. package/admin/src/utils/makeUnique.js +1 -1
  75. package/controllers/Components.js +7 -15
  76. package/controllers/validation/common.js +12 -18
  77. package/controllers/validation/data-transform.js +4 -4
  78. package/controllers/validation/model-schema.js +5 -14
  79. package/controllers/validation/relations.js +8 -20
  80. package/controllers/validation/types.js +12 -35
  81. package/package.json +6 -6
  82. package/services/Components.js +4 -4
  83. package/services/ContentTypes.js +2 -1
  84. package/services/api-handler.js +5 -5
  85. package/services/schema-builder/index.js +12 -14
  86. package/services/schema-builder/schema-handler.js +5 -5
  87. package/utils/helpers.js +1 -1
@@ -94,18 +94,15 @@ const DataManagerProvider = ({
94
94
 
95
95
  getDataRef.current = async () => {
96
96
  try {
97
- const [
98
- { data: componentsArray },
99
- { data: contentTypesArray },
100
- reservedNames,
101
- ] = await Promise.all(
102
- ['components', 'content-types', 'reserved-names'].map(endPoint => {
103
- return request(`/${pluginId}/${endPoint}`, {
104
- method: 'GET',
105
- signal,
106
- });
107
- })
108
- );
97
+ const [{ data: componentsArray }, { data: contentTypesArray }, reservedNames] =
98
+ await Promise.all(
99
+ ['components', 'content-types', 'reserved-names'].map((endPoint) => {
100
+ return request(`/${pluginId}/${endPoint}`, {
101
+ method: 'GET',
102
+ signal,
103
+ });
104
+ })
105
+ );
109
106
 
110
107
  const components = createDataObject(componentsArray);
111
108
  const contentTypes = createDataObject(contentTypesArray);
@@ -232,7 +229,7 @@ const DataManagerProvider = ({
232
229
  });
233
230
  };
234
231
 
235
- const deleteCategory = async categoryUid => {
232
+ const deleteCategory = async (categoryUid) => {
236
233
  try {
237
234
  const requestURL = `/${pluginId}/component-categories/${categoryUid}`;
238
235
  // eslint-disable-next-line no-alert
@@ -419,7 +416,7 @@ const DataManagerProvider = ({
419
416
 
420
417
  const redirectEndpoint = useMemo(() => {
421
418
  const allowedEndpoints = Object.keys(contentTypes)
422
- .filter(uid => get(contentTypes, [uid, 'schema', 'visible'], true))
419
+ .filter((uid) => get(contentTypes, [uid, 'schema', 'visible'], true))
423
420
  .sort();
424
421
 
425
422
  return get(allowedEndpoints, '0', '');
@@ -429,7 +426,7 @@ const DataManagerProvider = ({
429
426
  return <Redirect to={`/plugins/${pluginId}/content-types/${redirectEndpoint}`} />;
430
427
  }
431
428
 
432
- const submitData = async additionalContentTypeData => {
429
+ const submitData = async (additionalContentTypeData) => {
433
430
  try {
434
431
  const isCreating = get(modifiedData, [firstKeyToMainSchema, 'isTemporary'], false);
435
432
  const body = {
@@ -506,7 +503,7 @@ const DataManagerProvider = ({
506
503
 
507
504
  // Open the modal warning cancel changes
508
505
  const toggleModalCancel = () => {
509
- toggleInfoModal(prev => ({ ...prev, cancel: !prev.cancel }));
506
+ toggleInfoModal((prev) => ({ ...prev, cancel: !prev.cancel }));
510
507
  };
511
508
 
512
509
  const updatePermissions = async () => {
@@ -536,7 +533,8 @@ const DataManagerProvider = ({
536
533
  changeDynamicZoneComponents,
537
534
  components,
538
535
  componentsGroupedByCategory: groupBy(components, 'category'),
539
- componentsThatHaveOtherComponentInTheirAttributes: getAllComponentsThatHaveAComponentInTheirAttributes(),
536
+ componentsThatHaveOtherComponentInTheirAttributes:
537
+ getAllComponentsThatHaveAComponentInTheirAttributes(),
540
538
  contentTypes,
541
539
  createSchema,
542
540
  deleteCategory,
@@ -18,7 +18,7 @@ const initialState = fromJS({
18
18
 
19
19
  const ONE_SIDE_RELATIONS = ['oneWay', 'manyWay'];
20
20
 
21
- const getOppositeNature = originalNature => {
21
+ const getOppositeNature = (originalNature) => {
22
22
  if (originalNature === 'manyToOne') {
23
23
  return 'oneToMany';
24
24
  }
@@ -52,7 +52,7 @@ const addComponentsToState = (state, componentToAddUid, objToUpdate) => {
52
52
  );
53
53
 
54
54
  // We need to add the nested components to the modifiedData.components as well
55
- nestedComponents.forEach(componentUid => {
55
+ nestedComponents.forEach((componentUid) => {
56
56
  const isTemporary = state.getIn(['components', componentUid, 'isTemporary']) || false;
57
57
  const hasNestedComponentAlreadyBeenAdded =
58
58
  state.getIn(['modifiedData', 'components', componentUid]) !== undefined;
@@ -84,7 +84,7 @@ const reducer = (state = initialState, action) => {
84
84
  .updateIn(['modifiedData', ...pathToDataToEdit, 'schema', 'attributes', name], () => {
85
85
  return fromJS(rest);
86
86
  })
87
- .updateIn(['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'], obj => {
87
+ .updateIn(['modifiedData', ...pathToDataToEdit, 'schema', 'attributes'], (obj) => {
88
88
  const type = get(rest, 'type', 'relation');
89
89
  const target = get(rest, 'target', null);
90
90
  const nature = get(rest, 'nature', null);
@@ -117,7 +117,7 @@ const reducer = (state = initialState, action) => {
117
117
 
118
118
  return obj;
119
119
  })
120
- .updateIn(['modifiedData', 'components'], existingCompos => {
120
+ .updateIn(['modifiedData', 'components'], (existingCompos) => {
121
121
  if (action.shouldAddComponentToData) {
122
122
  return addComponentsToState(state, rest.component, existingCompos);
123
123
  }
@@ -130,7 +130,7 @@ const reducer = (state = initialState, action) => {
130
130
 
131
131
  return state.updateIn(
132
132
  ['modifiedData', 'contentType', 'schema', 'attributes', dynamicZoneTarget, 'components'],
133
- list => {
133
+ (list) => {
134
134
  return list.concat(componentsToAdd);
135
135
  }
136
136
  );
@@ -146,11 +146,11 @@ const reducer = (state = initialState, action) => {
146
146
  return state
147
147
  .updateIn(
148
148
  ['modifiedData', 'contentType', 'schema', 'attributes', dynamicZoneTarget, 'components'],
149
- list => {
149
+ (list) => {
150
150
  return fromJS(makeUnique([...list.toJS(), ...newComponents]));
151
151
  }
152
152
  )
153
- .updateIn(['modifiedData', 'components'], old => {
153
+ .updateIn(['modifiedData', 'components'], (old) => {
154
154
  const componentsSchema = newComponents.reduce((acc, current) => {
155
155
  return addComponentsToState(state, current, acc);
156
156
  }, old);
@@ -210,7 +210,7 @@ const reducer = (state = initialState, action) => {
210
210
  ? [forTarget]
211
211
  : [forTarget, targetUid];
212
212
 
213
- return newState.updateIn(['modifiedData', ...pathToDataToEdit, 'schema'], obj => {
213
+ return newState.updateIn(['modifiedData', ...pathToDataToEdit, 'schema'], (obj) => {
214
214
  let oppositeAttributeNameToRemove = null;
215
215
  let oppositeAttributeNameToUpdate = null;
216
216
  let oppositeAttributeNameToCreateBecauseOfNatureChange = null;
@@ -298,9 +298,8 @@ const reducer = (state = initialState, action) => {
298
298
  shouldCreateOppositeAttributeBecauseOfNatureChange ||
299
299
  shouldCreateOppositeAttributeBecauseOfTargetChange
300
300
  ) {
301
- acc[oppositeAttributeNameToCreateBecauseOfNatureChange] = fromJS(
302
- oppositeAttributeToCreate
303
- );
301
+ acc[oppositeAttributeNameToCreateBecauseOfNatureChange] =
302
+ fromJS(oppositeAttributeToCreate);
304
303
 
305
304
  oppositeAttributeToCreate = null;
306
305
  oppositeAttributeNameToCreateBecauseOfNatureChange = null;
@@ -311,9 +310,8 @@ const reducer = (state = initialState, action) => {
311
310
 
312
311
  acc[name] = fromJS(rest);
313
312
  } else if (current === oppositeAttributeNameToUpdate) {
314
- acc[oppositeAttributeNameToCreateBecauseOfNatureChange] = fromJS(
315
- oppositeAttributeToCreate
316
- );
313
+ acc[oppositeAttributeNameToCreateBecauseOfNatureChange] =
314
+ fromJS(oppositeAttributeToCreate);
317
315
  } else {
318
316
  acc[current] = obj.getIn(['attributes', current]);
319
317
  }
@@ -394,15 +392,17 @@ const reducer = (state = initialState, action) => {
394
392
  }
395
393
  }
396
394
 
397
- return state.removeIn(pathToAttributeToRemove).updateIn([...pathToAttributes], attributes => {
398
- return attributes.keySeq().reduce((acc, current) => {
399
- if (acc.getIn([current, 'targetField']) === attributeToRemoveName) {
400
- return acc.removeIn([current, 'targetField']);
401
- }
402
-
403
- return acc;
404
- }, attributes);
405
- });
395
+ return state
396
+ .removeIn(pathToAttributeToRemove)
397
+ .updateIn([...pathToAttributes], (attributes) => {
398
+ return attributes.keySeq().reduce((acc, current) => {
399
+ if (acc.getIn([current, 'targetField']) === attributeToRemoveName) {
400
+ return acc.removeIn([current, 'targetField']);
401
+ }
402
+
403
+ return acc;
404
+ }, attributes);
405
+ });
406
406
  }
407
407
  case actions.SET_MODIFIED_DATA: {
408
408
  let newState = state
@@ -427,7 +427,7 @@ const reducer = (state = initialState, action) => {
427
427
  uid,
428
428
  } = action;
429
429
 
430
- let newState = state.updateIn(['modifiedData', schemaType], obj => {
430
+ let newState = state.updateIn(['modifiedData', schemaType], (obj) => {
431
431
  let updatedObj = obj
432
432
  .updateIn(['schema', 'name'], () => name)
433
433
  .updateIn(['schema', 'collectionName'], () => collectionName);
@@ -445,7 +445,7 @@ const reducer = (state = initialState, action) => {
445
445
  });
446
446
 
447
447
  if (schemaType === 'component') {
448
- newState = newState.updateIn(['components'], obj => {
448
+ newState = newState.updateIn(['components'], (obj) => {
449
449
  return obj.update(uid, () => newState.getIn(['modifiedData', 'component']));
450
450
  });
451
451
  }
@@ -5,7 +5,7 @@ import { initialState } from './reducer';
5
5
  /**
6
6
  * Direct selector to the dataManagerProvider state domain
7
7
  */
8
- const dataManagerProviderDomain = () => state =>
8
+ const dataManagerProviderDomain = () => (state) =>
9
9
  state.get(`${pluginId}_dataManagerProvider`) || initialState;
10
10
 
11
11
  /**
@@ -17,7 +17,7 @@ const dataManagerProviderDomain = () => state =>
17
17
  */
18
18
 
19
19
  const makeSelectDataManagerProvider = () =>
20
- createSelector(dataManagerProviderDomain(), substate => {
20
+ createSelector(dataManagerProviderDomain(), (substate) => {
21
21
  return substate.toJS();
22
22
  });
23
23
 
@@ -4,7 +4,7 @@ import pluginId from '../../../pluginId';
4
4
  import makeUnique from '../../../utils/makeUnique';
5
5
 
6
6
  const getCreatedAndModifiedComponents = (allComponents, initialComponents) => {
7
- const componentUIDsToReturn = Object.keys(allComponents).filter(compoUid => {
7
+ const componentUIDsToReturn = Object.keys(allComponents).filter((compoUid) => {
8
8
  const currentCompo = get(allComponents, compoUid, {});
9
9
  const initialCompo = get(initialComponents, compoUid, {});
10
10
  const hasComponentBeenCreated = get(currentCompo, ['isTemporary'], false);
@@ -112,10 +112,10 @@ const formatAttributes = (attributes, mainDataUID, isCreatingMainData, isCompone
112
112
  }, {});
113
113
  };
114
114
 
115
- const formatRelationTargetAttribute = targetAttribute =>
115
+ const formatRelationTargetAttribute = (targetAttribute) =>
116
116
  targetAttribute === '-' ? null : targetAttribute;
117
117
 
118
- const removeNullKeys = obj =>
118
+ const removeNullKeys = (obj) =>
119
119
  Object.keys(obj).reduce((acc, current) => {
120
120
  if (obj[current] !== null && current !== 'plugin') {
121
121
  acc[current] = obj[current];
@@ -131,7 +131,7 @@ const getComponentsToPost = (
131
131
  isCreatingData = false
132
132
  ) => {
133
133
  const componentsToFormat = getCreatedAndModifiedComponents(allComponents, initialComponents);
134
- const formattedComponents = componentsToFormat.map(compoUID => {
134
+ const formattedComponents = componentsToFormat.map((compoUID) => {
135
135
  const currentCompo = get(allComponents, compoUID, {});
136
136
  const formattedComponent = formatComponent(currentCompo, mainDataUID, isCreatingData);
137
137
 
@@ -141,10 +141,10 @@ const getComponentsToPost = (
141
141
  return formattedComponents;
142
142
  };
143
143
 
144
- const sortContentType = types =>
144
+ const sortContentType = (types) =>
145
145
  sortBy(
146
146
  Object.keys(types)
147
- .map(uid => ({
147
+ .map((uid) => ({
148
148
  visible: types[uid].schema.visible,
149
149
  name: uid,
150
150
  title: types[uid].schema.name,
@@ -154,8 +154,8 @@ const sortContentType = types =>
154
154
  kind: types[uid].schema.kind,
155
155
  restrictRelationsTo: types[uid].schema.restrictRelationsTo,
156
156
  }))
157
- .filter(obj => obj !== null),
158
- obj => camelCase(obj.title)
157
+ .filter((obj) => obj !== null),
158
+ (obj) => camelCase(obj.title)
159
159
  );
160
160
 
161
161
  export {
@@ -1,4 +1,4 @@
1
- const createDataObject = arr =>
1
+ const createDataObject = (arr) =>
2
2
  arr.reduce((acc, current) => {
3
3
  acc[current.uid] = current;
4
4
 
@@ -7,16 +7,13 @@ const createModifiedDataSchema = (
7
7
  allComponentsSchema,
8
8
  isInContentTypeView
9
9
  ) => {
10
- const componentsAssociatedToContentType = retrievedComponents.reduce(
11
- (acc, current) => {
12
- const componentSchema = get(allComponentsSchema, current, {});
10
+ const componentsAssociatedToContentType = retrievedComponents.reduce((acc, current) => {
11
+ const componentSchema = get(allComponentsSchema, current, {});
13
12
 
14
- acc[current] = componentSchema;
13
+ acc[current] = componentSchema;
15
14
 
16
- return acc;
17
- },
18
- {}
19
- );
15
+ return acc;
16
+ }, {});
20
17
  const keyName = isInContentTypeView ? 'contentType' : 'component';
21
18
  const schema = {
22
19
  [keyName]: contentTypeSchema,
@@ -26,55 +23,41 @@ const createModifiedDataSchema = (
26
23
  return schema;
27
24
  };
28
25
 
29
- const orderAllDataAttributesWithImmutable = (
30
- allDataSchema,
31
- isInContentTypeView
32
- ) => {
26
+ const orderAllDataAttributesWithImmutable = (allDataSchema, isInContentTypeView) => {
33
27
  const attributesPath = ['schema', 'attributes'];
34
28
  const componentsSchema = allDataSchema.components;
35
- const componentsWithImmutableSchema = Object.keys(componentsSchema).reduce(
36
- (acc, current) => {
37
- const currentSchema = get(componentsSchema, [current], {});
29
+ const componentsWithImmutableSchema = Object.keys(componentsSchema).reduce((acc, current) => {
30
+ const currentSchema = get(componentsSchema, [current], {});
38
31
 
39
- const currentAttributes = get(currentSchema, attributesPath, {});
32
+ const currentAttributes = get(currentSchema, attributesPath, {});
40
33
 
41
- const fromJSAttributes = Object.keys(currentAttributes).reduce(
42
- (acc, current) => {
43
- acc[current] = fromJS(currentAttributes[current]);
34
+ const fromJSAttributes = Object.keys(currentAttributes).reduce((acc, current) => {
35
+ acc[current] = fromJS(currentAttributes[current]);
44
36
 
45
- return acc;
46
- },
47
- {}
48
- );
37
+ return acc;
38
+ }, {});
49
39
 
50
- // TODO refacto
51
- const currentImmutableSchemas = fromJS(currentSchema).setIn(
52
- ['schema', 'attributes'],
53
- fromJS(OrderedMap(fromJSAttributes))
54
- );
40
+ // TODO refacto
41
+ const currentImmutableSchemas = fromJS(currentSchema).setIn(
42
+ ['schema', 'attributes'],
43
+ fromJS(OrderedMap(fromJSAttributes))
44
+ );
55
45
 
56
- acc[current] = fromJS(currentImmutableSchemas);
46
+ acc[current] = fromJS(currentImmutableSchemas);
57
47
 
58
- return acc;
59
- },
60
- {}
61
- );
48
+ return acc;
49
+ }, {});
62
50
  const keyName = isInContentTypeView ? 'contentType' : 'component';
63
51
  const mainSchema = get(allDataSchema, [keyName], {});
64
52
  const mainImmutableSchema = fromJS(mainSchema).setIn(
65
53
  attributesPath,
66
54
  fromJS(
67
55
  OrderedMap(
68
- Object.keys(get(mainSchema, attributesPath, {})).reduce(
69
- (acc, current) => {
70
- acc[current] = fromJS(
71
- get(mainSchema, [...attributesPath, current], {})
72
- );
56
+ Object.keys(get(mainSchema, attributesPath, {})).reduce((acc, current) => {
57
+ acc[current] = fromJS(get(mainSchema, [...attributesPath, current], {}));
73
58
 
74
- return acc;
75
- },
76
- {}
77
- )
59
+ return acc;
60
+ }, {})
78
61
  )
79
62
  )
80
63
  );
@@ -17,31 +17,16 @@ const retrieveComponentsFromSchema = (attributes, allComponentsData) => {
17
17
  );
18
18
 
19
19
  // Retrieve the nested ones
20
- acc.push(
21
- ...retrieveComponentsFromSchema(
22
- currentComponentAttributes,
23
- allComponentsData
24
- )
25
- );
20
+ acc.push(...retrieveComponentsFromSchema(currentComponentAttributes, allComponentsData));
26
21
  }
27
22
 
28
23
  if (type === 'dynamiczone') {
29
24
  const dynamicZoneComponents = attributes[current].components;
30
- const componentsFromDZComponents = dynamicZoneComponents.reduce(
31
- (acc2, currentUid) => {
32
- const compoAttrs = get(
33
- allComponentsData,
34
- [currentUid, 'schema', 'attributes'],
35
- {}
36
- );
37
-
38
- return [
39
- ...acc2,
40
- ...retrieveComponentsFromSchema(compoAttrs, allComponentsData),
41
- ];
42
- },
43
- []
44
- );
25
+ const componentsFromDZComponents = dynamicZoneComponents.reduce((acc2, currentUid) => {
26
+ const compoAttrs = get(allComponentsData, [currentUid, 'schema', 'attributes'], {});
27
+
28
+ return [...acc2, ...retrieveComponentsFromSchema(compoAttrs, allComponentsData)];
29
+ }, []);
45
30
 
46
31
  return [...acc, ...dynamicZoneComponents, ...componentsFromDZComponents];
47
32
  }
@@ -1,35 +1,29 @@
1
1
  import { get } from 'lodash';
2
2
  import makeUnique from '../../../utils/makeUnique';
3
3
 
4
- const retrieveComponentsThatHaveComponents = allComponents => {
5
- const componentsThatHaveNestedComponents = Object.keys(allComponents).reduce(
6
- (acc, current) => {
7
- const currentComponent = get(allComponents, [current], {});
8
- const uid = currentComponent.uid;
4
+ const retrieveComponentsThatHaveComponents = (allComponents) => {
5
+ const componentsThatHaveNestedComponents = Object.keys(allComponents).reduce((acc, current) => {
6
+ const currentComponent = get(allComponents, [current], {});
7
+ const uid = currentComponent.uid;
9
8
 
10
- if (doesComponentHaveAComponentField(currentComponent)) {
11
- acc.push(uid);
12
- }
9
+ if (doesComponentHaveAComponentField(currentComponent)) {
10
+ acc.push(uid);
11
+ }
13
12
 
14
- return acc;
15
- },
16
- []
17
- );
13
+ return acc;
14
+ }, []);
18
15
 
19
16
  return makeUnique(componentsThatHaveNestedComponents);
20
17
  };
21
18
 
22
- const doesComponentHaveAComponentField = component => {
19
+ const doesComponentHaveAComponentField = (component) => {
23
20
  const attributes = get(component, ['schema', 'attributes'], {});
24
21
 
25
- return Object.keys(attributes).some(attributeName => {
22
+ return Object.keys(attributes).some((attributeName) => {
26
23
  const type = get(attributes, [attributeName, 'type'], '');
27
24
 
28
25
  return type === 'component';
29
26
  });
30
27
  };
31
28
 
32
- export {
33
- doesComponentHaveAComponentField,
34
- retrieveComponentsThatHaveComponents,
35
- };
29
+ export { doesComponentHaveAComponentField, retrieveComponentsThatHaveComponents };
@@ -1,16 +1,10 @@
1
1
  import { get } from 'lodash';
2
2
  import makeUnique from '../../../utils/makeUnique';
3
3
 
4
- const retrieveNestedComponents = appComponents => {
4
+ const retrieveNestedComponents = (appComponents) => {
5
5
  const nestedComponents = Object.keys(appComponents).reduce((acc, current) => {
6
- const componentAttributes = get(
7
- appComponents,
8
- [current, 'schema', 'attributes'],
9
- {}
10
- );
11
- const currentComponentNestedCompos = getComponentsFromComponent(
12
- componentAttributes
13
- );
6
+ const componentAttributes = get(appComponents, [current, 'schema', 'attributes'], {});
7
+ const currentComponentNestedCompos = getComponentsFromComponent(componentAttributes);
14
8
 
15
9
  return [...acc, ...currentComponentNestedCompos];
16
10
  }, []);
@@ -18,7 +12,7 @@ const retrieveNestedComponents = appComponents => {
18
12
  return makeUnique(nestedComponents);
19
13
  };
20
14
 
21
- const getComponentsFromComponent = componentAttributes => {
15
+ const getComponentsFromComponent = (componentAttributes) => {
22
16
  return Object.keys(componentAttributes).reduce((acc, current) => {
23
17
  const attribute = get(componentAttributes, current, {});
24
18
  const { type, component } = attribute;
@@ -2,7 +2,7 @@ import { get } from 'lodash';
2
2
  import makeUnique from '../../../utils/makeUnique';
3
3
 
4
4
  const retrieveSpecificInfoFromComponents = (allComponents, keysToRetrieve) => {
5
- const allData = Object.keys(allComponents).map(compo => {
5
+ const allData = Object.keys(allComponents).map((compo) => {
6
6
  return get(allComponents, [compo, ...keysToRetrieve], '');
7
7
  });
8
8
 
@@ -85,7 +85,7 @@ const advancedForm = {
85
85
  ],
86
86
  };
87
87
  },
88
- enumeration: data => {
88
+ enumeration: (data) => {
89
89
  return {
90
90
  items: [
91
91
  [
@@ -102,13 +102,13 @@ const advancedForm = {
102
102
  key="hidden___value__placeholder"
103
103
  id="components.InputSelect.option.placeholder"
104
104
  >
105
- {msg => <option value="">{msg}</option>}
105
+ {(msg) => <option value="">{msg}</option>}
106
106
  </FormattedMessage>,
107
107
  ].concat(
108
108
  data.enum
109
109
  ? data.enum
110
110
  .filter((val, index) => data.enum.indexOf(val) === index && !isEmpty(val))
111
- .map(val => (
111
+ .map((val) => (
112
112
  <option key={val} value={val}>
113
113
  {val}
114
114
  </option>
@@ -159,7 +159,7 @@ const advancedForm = {
159
159
  ],
160
160
  };
161
161
  },
162
- number: data => {
162
+ number: (data) => {
163
163
  const inputStep = data.type === 'decimal' || data.type === 'float' ? 'any' : '1';
164
164
 
165
165
  return {
@@ -194,7 +194,7 @@ const advancedForm = {
194
194
  ],
195
195
  };
196
196
  },
197
- relation: data => {
197
+ relation: (data) => {
198
198
  const targetAttributeValue = get(data, 'targetAttribute', null);
199
199
  const nameValue = get(data, 'name', null);
200
200
 
@@ -253,7 +253,7 @@ const advancedForm = {
253
253
  ],
254
254
  };
255
255
  },
256
- uid: data => {
256
+ uid: (data) => {
257
257
  return {
258
258
  items: [
259
259
  [{ ...options.default, disabled: Boolean(data.targetField), type: 'text' }],
@@ -91,7 +91,7 @@ const baseForm = {
91
91
 
92
92
  return (
93
93
  <FormattedMessage id={tradId} key={id}>
94
- {msg => (
94
+ {(msg) => (
95
95
  <option disabled={disabled} hidden={disabled} value={value}>
96
96
  {msg}
97
97
  </option>
@@ -192,7 +192,7 @@ const baseForm = {
192
192
 
193
193
  return (
194
194
  <FormattedMessage id={tradId} key={id}>
195
- {msg => (
195
+ {(msg) => (
196
196
  <option disabled={disabled} hidden={disabled} value={value}>
197
197
  {msg}
198
198
  </option>
@@ -279,8 +279,8 @@ const baseForm = {
279
279
  },
280
280
  uid: (data, step, attributes) => {
281
281
  const options = Object.keys(attributes)
282
- .filter(key => ['string', 'text'].includes(attributes[key].type))
283
- .map(key => ({ id: key, value: key }));
282
+ .filter((key) => ['string', 'text'].includes(attributes[key].type))
283
+ .map((key) => ({ id: key, value: key }));
284
284
 
285
285
  return {
286
286
  items: [
@@ -302,7 +302,7 @@ const baseForm = {
302
302
  <Fragment key={index}>
303
303
  {index === 0 ? (
304
304
  <FormattedMessage id={option.id}>
305
- {msg => <option value={option.value}>{msg}</option>}
305
+ {(msg) => <option value={option.value}>{msg}</option>}
306
306
  </FormattedMessage>
307
307
  ) : (
308
308
  <option value={option.value}>{option.value}</option>