@akemona-org/strapi-plugin-content-manager 3.7.0 → 3.7.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.
Files changed (155) hide show
  1. package/admin/src/InjectedComponents/ContentTypeBuilder/ConfigureViewButton/index.js +2 -5
  2. package/admin/src/components/AddDropdown/index.js +5 -12
  3. package/admin/src/components/Block/index.js +2 -4
  4. package/admin/src/components/ComponentInitializer/index.js +1 -1
  5. package/admin/src/components/CustomTable/ActionCollapse/index.js +2 -2
  6. package/admin/src/components/CustomTable/Row/Cell.js +1 -1
  7. package/admin/src/components/CustomTable/Row/index.js +6 -6
  8. package/admin/src/components/CustomTable/index.js +5 -5
  9. package/admin/src/components/CustomTable/styledComponents.js +2 -2
  10. package/admin/src/components/DragLayer/index.js +1 -1
  11. package/admin/src/components/DraggedField/Wrapper.js +2 -7
  12. package/admin/src/components/DraggedField/index.js +3 -3
  13. package/admin/src/components/DraggedField/utils/getHeight.js +1 -1
  14. package/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +2 -2
  15. package/admin/src/components/DraggedFieldWithPreview/Wrapper.js +1 -2
  16. package/admin/src/components/DraggedFieldWithPreview/index.js +4 -4
  17. package/admin/src/components/DynamicComponentCard/index.js +2 -8
  18. package/admin/src/components/DynamicZone/Picker/index.js +3 -3
  19. package/admin/src/components/DynamicZone/index.js +4 -4
  20. package/admin/src/components/DynamicZone/utils/select.js +1 -1
  21. package/admin/src/components/FieldComponent/index.js +1 -1
  22. package/admin/src/components/FieldComponent/utils/select.js +6 -6
  23. package/admin/src/components/FieldsReorder/Item.js +6 -9
  24. package/admin/src/components/FieldsReorder/index.js +6 -17
  25. package/admin/src/components/FilterOptionsCTA/index.js +1 -1
  26. package/admin/src/components/FilterPicker/components.js +2 -2
  27. package/admin/src/components/FilterPicker/index.js +7 -7
  28. package/admin/src/components/FilterPicker/reducer.js +2 -2
  29. package/admin/src/components/FilterPickerOption/Input.js +1 -1
  30. package/admin/src/components/FilterPickerOption/Option.js +1 -3
  31. package/admin/src/components/FilterPickerOption/components.js +2 -2
  32. package/admin/src/components/FilterPickerOption/index.js +4 -4
  33. package/admin/src/components/FormTitle/index.js +1 -5
  34. package/admin/src/components/InputJSON/index.js +3 -3
  35. package/admin/src/components/InputJSON/jsonlint.js +639 -383
  36. package/admin/src/components/InputJSONWithErrors/index.js +2 -2
  37. package/admin/src/components/InputUID/Options/index.js +2 -2
  38. package/admin/src/components/InputUID/Options/wrapper.js +1 -1
  39. package/admin/src/components/InputUID/index.js +2 -2
  40. package/admin/src/components/Inputs/index.js +4 -4
  41. package/admin/src/components/Inputs/utils/generateOptions.js +2 -2
  42. package/admin/src/components/Inputs/utils/getStep.js +1 -1
  43. package/admin/src/components/MediaPreviewList/index.js +5 -5
  44. package/admin/src/components/NonRepeatableComponent/index.js +4 -4
  45. package/admin/src/components/PreviewWysiwyg/Wrapper.js +1 -1
  46. package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +1 -1
  47. package/admin/src/components/RelationPreviewList/RelationPreviewTooltip.js +3 -3
  48. package/admin/src/components/RelationPreviewList/index.js +1 -1
  49. package/admin/src/components/RepeatableComponent/Banner.js +2 -2
  50. package/admin/src/components/RepeatableComponent/BannerWrapper.js +1 -2
  51. package/admin/src/components/RepeatableComponent/DraggedItem/index.js +3 -9
  52. package/admin/src/components/RepeatableComponent/index.js +8 -8
  53. package/admin/src/components/RepeatableComponent/reducer.js +9 -9
  54. package/admin/src/components/Search/index.js +2 -2
  55. package/admin/src/components/SectionTitle/index.js +1 -3
  56. package/admin/src/components/SelectMany/ListItem.js +2 -2
  57. package/admin/src/components/SelectMany/index.js +3 -3
  58. package/admin/src/components/SelectOne/SingleValue.js +1 -1
  59. package/admin/src/components/SelectWrapper/ClearIndicator.js +1 -1
  60. package/admin/src/components/SelectWrapper/Option.js +1 -1
  61. package/admin/src/components/SelectWrapper/index.js +17 -27
  62. package/admin/src/components/SelectWrapper/utils/styles.js +6 -6
  63. package/admin/src/components/SettingsViewWrapper/index.js +9 -9
  64. package/admin/src/components/SortableList/Item.js +5 -11
  65. package/admin/src/components/Wysiwyg/MediaLib.js +1 -1
  66. package/admin/src/components/Wysiwyg/index.js +17 -25
  67. package/admin/src/components/Wysiwyg/toggleMode.js +3 -7
  68. package/admin/src/components/Wysiwyg/utils.js +2 -10
  69. package/admin/src/components/WysiwygDropUpload/index.js +1 -1
  70. package/admin/src/components/WysiwygInlineControls/Button.js +1 -1
  71. package/admin/src/components/WysiwygInlineControls/index.js +1 -1
  72. package/admin/src/components/WysiwygWithErrors/index.js +1 -1
  73. package/admin/src/containers/CollectionTypeFormWrapper/index.js +7 -12
  74. package/admin/src/containers/CollectionTypeFormWrapper/utils/getRequestUrl.js +1 -1
  75. package/admin/src/containers/CollectionTypeRecursivePath/index.js +1 -1
  76. package/admin/src/containers/ComponentSetttingsView/index.js +2 -2
  77. package/admin/src/containers/EditSettingsView/index.js +17 -17
  78. package/admin/src/containers/EditSettingsView/reducer.js +10 -10
  79. package/admin/src/containers/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +2 -2
  80. package/admin/src/containers/EditSettingsView/utils/getInputProps.js +1 -1
  81. package/admin/src/containers/EditSettingsView/utils/layout.js +9 -9
  82. package/admin/src/containers/EditView/DeleteLink/index.js +1 -1
  83. package/admin/src/containers/EditView/Header/index.js +10 -9
  84. package/admin/src/containers/EditView/Header/utils/getDraftRelations.js +3 -3
  85. package/admin/src/containers/EditView/index.js +7 -10
  86. package/admin/src/containers/EditView/utils/createAttributesLayout.js +4 -9
  87. package/admin/src/containers/EditView/utils/getFieldsActionMatchingPermissions.js +1 -1
  88. package/admin/src/containers/EditViewDataManagerProvider/index.js +7 -12
  89. package/admin/src/containers/EditViewDataManagerProvider/reducer.js +14 -14
  90. package/admin/src/containers/EditViewDataManagerProvider/utils/cleanData.js +4 -4
  91. package/admin/src/containers/EditViewDataManagerProvider/utils/getYupInnerErrors.js +2 -8
  92. package/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +12 -12
  93. package/admin/src/containers/EditViewLayoutManager/Permissions.js +1 -1
  94. package/admin/src/containers/EditViewLayoutManager/reducer.js +1 -1
  95. package/admin/src/containers/EditViewLayoutManager/selectors.js +1 -1
  96. package/admin/src/containers/ListSettingsView/Label.js +2 -11
  97. package/admin/src/containers/ListSettingsView/index.js +9 -9
  98. package/admin/src/containers/ListSettingsView/reducer.js +2 -2
  99. package/admin/src/containers/ListView/FieldPicker/Fields/Wrapper.js +1 -1
  100. package/admin/src/containers/ListView/FieldPicker/Fields/index.js +2 -2
  101. package/admin/src/containers/ListView/FieldPicker/index.js +2 -2
  102. package/admin/src/containers/ListView/Filter.js +1 -4
  103. package/admin/src/containers/ListView/actions.js +2 -2
  104. package/admin/src/containers/ListView/index.js +8 -7
  105. package/admin/src/containers/ListView/reducer.js +5 -5
  106. package/admin/src/containers/ListView/selectors.js +2 -2
  107. package/admin/src/containers/ListView/utils/createPluginsFilter.js +1 -1
  108. package/admin/src/containers/ListView/utils/getAllAllowedHeaders.js +1 -1
  109. package/admin/src/containers/ListView/utils/getFirstSortableHeader.js +2 -2
  110. package/admin/src/containers/ListViewLayoutManager/Permissions.js +1 -1
  111. package/admin/src/containers/ListViewProvider/index.js +1 -3
  112. package/admin/src/containers/Main/index.js +2 -2
  113. package/admin/src/containers/Main/reducer.js +1 -1
  114. package/admin/src/containers/Main/selectors.js +2 -2
  115. package/admin/src/containers/RBACManager/reducer.js +1 -1
  116. package/admin/src/containers/SingleTypeFormWrapper/index.js +6 -11
  117. package/admin/src/containers/SingleTypeFormWrapper/utils/getRequestUrl.js +1 -1
  118. package/admin/src/containers/WysiwygProvider/index.js +1 -3
  119. package/admin/src/hooks/useContentTypeLayout/index.js +1 -1
  120. package/admin/src/hooks/useFetchContentTypeLayout/index.js +3 -3
  121. package/admin/src/hooks/useFetchContentTypeLayout/reducer.js +1 -1
  122. package/admin/src/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +8 -8
  123. package/admin/src/hooks/useFindRedirectionLink/index.js +1 -1
  124. package/admin/src/hooks/useFindRedirectionLink/selectors.js +1 -1
  125. package/admin/src/icons/Cross/index.js +1 -6
  126. package/admin/src/icons/Na/index.js +3 -22
  127. package/admin/src/index.js +1 -1
  128. package/admin/src/pluginId.js +1 -1
  129. package/admin/src/selectors.js +2 -2
  130. package/admin/src/sharedReducers/crudReducer/actions.js +3 -3
  131. package/admin/src/sharedReducers/crudReducer/reducer.js +1 -1
  132. package/admin/src/sharedReducers/crudReducer/selectors.js +1 -1
  133. package/admin/src/utils/checkIfAttributeIsDisplayable.js +1 -1
  134. package/admin/src/utils/formatFiltersFromQuery.js +2 -2
  135. package/admin/src/utils/formatLayoutToApi.js +2 -2
  136. package/admin/src/utils/generatePermissionsObject.js +3 -2
  137. package/admin/src/utils/getComponents.js +3 -5
  138. package/admin/src/utils/getFieldName.js +2 -2
  139. package/admin/src/utils/getMaxTempKey.js +2 -2
  140. package/admin/src/utils/getRequestUrl.js +1 -1
  141. package/admin/src/utils/getTrad.js +1 -1
  142. package/admin/src/utils/mergeMetasWithSchema.js +2 -2
  143. package/admin/src/utils/removeKeyInObject.js +1 -1
  144. package/admin/src/utils/removePasswordFieldsFromData.js +2 -2
  145. package/controllers/content-types.js +4 -4
  146. package/package.json +4 -4
  147. package/services/components.js +1 -1
  148. package/services/configuration.js +9 -9
  149. package/services/permission-checker.js +6 -6
  150. package/services/uid.js +1 -1
  151. package/services/utils/configuration/layouts.js +14 -35
  152. package/services/utils/configuration/metadatas.js +1 -1
  153. package/services/utils/store.js +9 -9
  154. package/utils/index.js +1 -1
  155. package/utils/wrap-bad-request.js +14 -12
@@ -41,8 +41,8 @@ const SettingsViewWrapper = ({
41
41
  return get(modifiedData, ['attributes'], {});
42
42
  }, [modifiedData]);
43
43
 
44
- const toggleWarningCancel = () => setWarningCancel(prevState => !prevState);
45
- const toggleWarningSubmit = () => setWarningSubmit(prevState => !prevState);
44
+ const toggleWarningCancel = () => setWarningCancel((prevState) => !prevState);
45
+ const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
46
46
 
47
47
  const getPluginHeaderActions = () => {
48
48
  return [
@@ -92,11 +92,11 @@ const SettingsViewWrapper = ({
92
92
  }),
93
93
  };
94
94
 
95
- const getSelectOptions = input => {
95
+ const getSelectOptions = (input) => {
96
96
  if (input.name === 'settings.defaultSortBy') {
97
97
  return [
98
98
  'id',
99
- ...displayedFields.filter(name => {
99
+ ...displayedFields.filter((name) => {
100
100
  const type = get(attributes, [name, 'type']);
101
101
 
102
102
  return !['media', 'richtext', 'dynamiczone', 'relation'].includes(type) && name !== 'id';
@@ -105,7 +105,7 @@ const SettingsViewWrapper = ({
105
105
  }
106
106
 
107
107
  if (input.name === 'settings.mainField') {
108
- const options = Object.keys(attributes).filter(attr => {
108
+ const options = Object.keys(attributes).filter((attr) => {
109
109
  const type = get(attributes, [attr, 'type'], '');
110
110
 
111
111
  return (
@@ -130,7 +130,7 @@ const SettingsViewWrapper = ({
130
130
  return input.options;
131
131
  };
132
132
 
133
- const handleSubmit = e => {
133
+ const handleSubmit = (e) => {
134
134
  e.preventDefault();
135
135
  toggleWarningSubmit();
136
136
  emitEvent('willSaveContentTypeLayout');
@@ -161,15 +161,15 @@ const SettingsViewWrapper = ({
161
161
  >
162
162
  <SectionTitle isSettings />
163
163
  <div className="row">
164
- {inputs.map(input => {
164
+ {inputs.map((input) => {
165
165
  return (
166
166
  <FormattedMessage key={input.name} id={input.label.id}>
167
- {label => (
167
+ {(label) => (
168
168
  <div className={input.customBootstrapClass}>
169
169
  <FormattedMessage
170
170
  id={get(input, 'description.id', 'app.utils.defaultMessage')}
171
171
  >
172
- {description => (
172
+ {(description) => (
173
173
  <Input
174
174
  {...input}
175
175
  description={description}
@@ -10,13 +10,8 @@ import DraggedFieldWithPreview from '../DraggedFieldWithPreview';
10
10
  import ItemTypes from '../../utils/ItemTypes';
11
11
 
12
12
  const Item = ({ index, move, name, removeItem }) => {
13
- const {
14
- goTo,
15
- metadatas,
16
- selectedItemName,
17
- setEditFieldToSelect,
18
- setIsDraggingSibling,
19
- } = useLayoutDnd();
13
+ const { goTo, metadatas, selectedItemName, setEditFieldToSelect, setIsDraggingSibling } =
14
+ useLayoutDnd();
20
15
  const dragRef = useRef(null);
21
16
  const dropRef = useRef(null);
22
17
 
@@ -37,8 +32,7 @@ const Item = ({ index, move, name, removeItem }) => {
37
32
  // Determine rectangle on screen
38
33
  const hoverBoundingRect = dropRef.current.getBoundingClientRect();
39
34
  // Get vertical middle
40
- const hoverMiddleY =
41
- (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
35
+ const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
42
36
  // Determine mouse position
43
37
  const clientOffset = monitor.getClientOffset();
44
38
  // Get pixels to the top
@@ -74,7 +68,7 @@ const Item = ({ index, move, name, removeItem }) => {
74
68
  end: () => {
75
69
  setIsDraggingSibling(false);
76
70
  },
77
- collect: monitor => ({
71
+ collect: (monitor) => ({
78
72
  isDragging: monitor.isDragging(),
79
73
  }),
80
74
  });
@@ -97,7 +91,7 @@ const Item = ({ index, move, name, removeItem }) => {
97
91
  label={get(metadatas, [name, 'edit', 'label'], '')}
98
92
  name={name}
99
93
  onClickEdit={() => setEditFieldToSelect(name)}
100
- onClickRemove={e => {
94
+ onClickRemove={(e) => {
101
95
  e.stopPropagation();
102
96
  removeItem(index);
103
97
  }}
@@ -19,7 +19,7 @@ const MediaLib = ({ isOpen, onChange, onToggle }) => {
19
19
 
20
20
  const Component = getComponent('media-library').Component;
21
21
 
22
- const handleInputChange = data => {
22
+ const handleInputChange = (data) => {
23
23
  if (data) {
24
24
  const formattedData = data.map(({ name, alternativeText, url }) => {
25
25
  const alt = alternativeText || name;
@@ -149,7 +149,7 @@ class Wysiwyg extends React.Component {
149
149
  * Init the editor with data from
150
150
  * @param {[type]} props [description]
151
151
  */
152
- setInitialValue = props => {
152
+ setInitialValue = (props) => {
153
153
  if (isEmpty(props.value)) {
154
154
  return this.setState({ editorState: EditorState.createEmpty() });
155
155
  }
@@ -246,9 +246,7 @@ class Wysiwyg extends React.Component {
246
246
  nextBlocks.map((block, index) => {
247
247
  const previousContent =
248
248
  index === 0
249
- ? this.getEditorState()
250
- .getCurrentContent()
251
- .getBlockForKey(this.getCurrentAnchorKey())
249
+ ? this.getEditorState().getCurrentContent().getBlockForKey(this.getCurrentAnchorKey())
252
250
  : newEditorState.getCurrentContent().getBlockBefore(block.getKey());
253
251
  // Check if there was an li before the position so we update the entire list bullets
254
252
  const number = previousContent ? parseInt(previousContent.getText().split('.')[0], 10) : 0;
@@ -325,7 +323,7 @@ class Wysiwyg extends React.Component {
325
323
  });
326
324
  }
327
325
 
328
- selectedBlocksList.map(block => {
326
+ selectedBlocksList.map((block) => {
329
327
  const selectedText = block.getText();
330
328
  const li = selectedText === '' ? '- ' : `- ${selectedText}`;
331
329
  const newBlock = createNewBlock(li, 'block-list', block.getKey());
@@ -345,7 +343,7 @@ class Wysiwyg extends React.Component {
345
343
  * Handler to create header
346
344
  * @param {String} text header content
347
345
  */
348
- addBlock = text => {
346
+ addBlock = (text) => {
349
347
  const nextBlockKey = this.getNextBlockKey(this.getCurrentAnchorKey()) || genKey();
350
348
  const newBlock = createNewBlock(text, 'header', nextBlockKey);
351
349
  const newContentState = this.createNewContentStateFromBlock(newBlock);
@@ -363,7 +361,7 @@ class Wysiwyg extends React.Component {
363
361
  );
364
362
  };
365
363
 
366
- addLinks = data => {
364
+ addLinks = (data) => {
367
365
  const links = data.reduce((acc, { alt, url }) => `${acc}![${alt}](${url})\n`, '');
368
366
  const { selection } = this.state;
369
367
  const newBlock = createNewBlock(links);
@@ -501,9 +499,7 @@ class Wysiwyg extends React.Component {
501
499
  * @return {Map} ContentBlock
502
500
  */
503
501
  getCurrentContentBlock = () =>
504
- this.getEditorState()
505
- .getCurrentContent()
506
- .getBlockForKey(this.getSelection().getAnchorKey());
502
+ this.getEditorState().getCurrentContent().getBlockForKey(this.getSelection().getAnchorKey());
507
503
 
508
504
  /**
509
505
  * Retrieve the block key after a specific one
@@ -515,17 +511,13 @@ class Wysiwyg extends React.Component {
515
511
  editorState.getCurrentContent().getKeyAfter(currentBlockKey);
516
512
 
517
513
  getSelectedText = ({ start, end } = getOffSets(this.getSelection())) =>
518
- this.getCurrentContentBlock()
519
- .getText()
520
- .slice(start, end);
514
+ this.getCurrentContentBlock().getText().slice(start, end);
521
515
 
522
516
  handleBlur = () => {
523
517
  const target = {
524
518
  name: this.props.name,
525
519
  type: 'textarea',
526
- value: this.getEditorState()
527
- .getCurrentContent()
528
- .getPlainText(),
520
+ value: this.getEditorState().getCurrentContent().getPlainText(),
529
521
  };
530
522
  this.props.onBlur({ target });
531
523
  this.blur();
@@ -593,7 +585,7 @@ class Wysiwyg extends React.Component {
593
585
  return false;
594
586
  };
595
587
 
596
- mapKeyToEditorCommand = e => {
588
+ mapKeyToEditorCommand = (e) => {
597
589
  if (e.keyCode === 9 /* TAB */) {
598
590
  const newEditorState = RichUtils.onTab(e, this.state.editorState, 4 /* maxDepth */);
599
591
  if (newEditorState !== this.state.editorState) {
@@ -614,7 +606,7 @@ class Wysiwyg extends React.Component {
614
606
  modifyBlockContent = (text, contentState = this.getEditorState().getCurrentContent()) =>
615
607
  Modifier.replaceText(contentState, this.getSelection(), text);
616
608
 
617
- onChange = editorState => {
609
+ onChange = (editorState) => {
618
610
  const { disabled } = this.props;
619
611
 
620
612
  if (!disabled) {
@@ -623,7 +615,7 @@ class Wysiwyg extends React.Component {
623
615
  }
624
616
  };
625
617
 
626
- handleTab = e => {
618
+ handleTab = (e) => {
627
619
  e.preventDefault();
628
620
  const newEditorState = onTab(this.getEditorState());
629
621
 
@@ -635,7 +627,7 @@ class Wysiwyg extends React.Component {
635
627
  */
636
628
 
637
629
  handleToggle = () => {
638
- this.setState(prevState => ({
630
+ this.setState((prevState) => ({
639
631
  ...prevState,
640
632
  isMediaLibraryOpened: !prevState.isMediaLibraryOpened,
641
633
  }));
@@ -645,7 +637,7 @@ class Wysiwyg extends React.Component {
645
637
  * Update the parent reducer
646
638
  * @param {Map} editorState [description]
647
639
  */
648
- sendData = editorState => {
640
+ sendData = (editorState) => {
649
641
  if (
650
642
  this.getEditorState().getCurrentContent() !== editorState.getCurrentContent() ||
651
643
  editorState.getLastChangeType() === 'remove-range'
@@ -660,7 +652,7 @@ class Wysiwyg extends React.Component {
660
652
  } else return;
661
653
  };
662
654
 
663
- toggleFullScreen = e => {
655
+ toggleFullScreen = (e) => {
664
656
  e.preventDefault();
665
657
  this.setState({
666
658
  isFullscreen: !this.state.isFullscreen,
@@ -690,7 +682,7 @@ class Wysiwyg extends React.Component {
690
682
  !this.props.deactivateErrorHighlight && this.props.error && 'editorError',
691
683
  !isEmpty(this.props.className) && this.props.className
692
684
  )}
693
- onClick={e => {
685
+ onClick={(e) => {
694
686
  if (isFullscreen) {
695
687
  e.preventDefault();
696
688
  e.stopPropagation();
@@ -741,7 +733,7 @@ class Wysiwyg extends React.Component {
741
733
  onChange={this.onChange}
742
734
  onTab={this.handleTab}
743
735
  placeholder={this.props.placeholder}
744
- setRef={editor => (this.domEditor = editor)}
736
+ setRef={(editor) => (this.domEditor = editor)}
745
737
  stripPastedStyles
746
738
  tabIndex={this.props.tabIndex}
747
739
  spellCheck
@@ -761,7 +753,7 @@ class Wysiwyg extends React.Component {
761
753
  {isFullscreen && (
762
754
  <div
763
755
  className={cn('editorWrapper')}
764
- onClick={e => {
756
+ onClick={(e) => {
765
757
  e.preventDefault();
766
758
  e.stopPropagation();
767
759
  }}
@@ -9,7 +9,7 @@ import { FormattedMessage } from 'react-intl';
9
9
  import PropTypes from 'prop-types';
10
10
  import ToggleModeWrapper from './ToggleModeWrapper';
11
11
 
12
- const ToggleMode = props => {
12
+ const ToggleMode = (props) => {
13
13
  const label = props.isPreviewMode
14
14
  ? 'components.Wysiwyg.ToggleMode.markdown'
15
15
  : 'components.Wysiwyg.ToggleMode.preview';
@@ -17,12 +17,8 @@ const ToggleMode = props => {
17
17
  return (
18
18
  <ToggleModeWrapper>
19
19
  <FormattedMessage id={label}>
20
- {msg => (
21
- <button
22
- type="button"
23
- className="toggleModeButton"
24
- onClick={props.onClick}
25
- >
20
+ {(msg) => (
21
+ <button type="button" className="toggleModeButton" onClick={props.onClick}>
26
22
  {msg}
27
23
  </button>
28
24
  )}
@@ -53,17 +53,9 @@ export function onTab(editorState) {
53
53
  let newContentState;
54
54
 
55
55
  if (selection.isCollapsed()) {
56
- newContentState = Modifier.insertText(
57
- contentState,
58
- selection,
59
- DEFAULT_INDENTATION
60
- );
56
+ newContentState = Modifier.insertText(contentState, selection, DEFAULT_INDENTATION);
61
57
  } else {
62
- newContentState = Modifier.replaceText(
63
- contentState,
64
- selection,
65
- DEFAULT_INDENTATION
66
- );
58
+ newContentState = Modifier.replaceText(contentState, selection, DEFAULT_INDENTATION);
67
59
  }
68
60
 
69
61
  return EditorState.push(editorState, newContentState, 'insert-characters');
@@ -7,7 +7,7 @@
7
7
  import React from 'react';
8
8
  import Label from './Label';
9
9
 
10
- const WysiwygDropUpload = props => {
10
+ const WysiwygDropUpload = (props) => {
11
11
  return (
12
12
  <Label {...props}>
13
13
  <input onChange={() => {}} type="file" tabIndex="-1" />
@@ -36,7 +36,7 @@ const Button = ({
36
36
  style,
37
37
  text,
38
38
  }) => {
39
- const handleClick = e => {
39
+ const handleClick = (e) => {
40
40
  e.preventDefault();
41
41
 
42
42
  handlers[handler](text, style);
@@ -27,7 +27,7 @@ const WysiwygInlineControls = ({
27
27
 
28
28
  return (
29
29
  <Wrapper>
30
- {buttons.map(type => (
30
+ {buttons.map((type) => (
31
31
  <Button
32
32
  key={type.label}
33
33
  active={type.style === blockType || currentStyle.has(type.style)}
@@ -65,7 +65,7 @@ class WysiwygWithErrors extends React.Component {
65
65
  error={hasError}
66
66
  name={name}
67
67
  onBlur={isFunction(handleBlur) ? handleBlur : onBlur}
68
- onChange={e => {
68
+ onChange={(e) => {
69
69
  if (!canCheck) {
70
70
  dispatch({
71
71
  type: 'SET_CHECK',
@@ -32,13 +32,8 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
32
32
  const { push, replace } = useHistory();
33
33
  const [{ rawQuery }] = useQueryParams();
34
34
  const dispatch = useDispatch();
35
- const {
36
- componentsDataStructure,
37
- contentTypeDataStructure,
38
- data,
39
- isLoading,
40
- status,
41
- } = useSelector(selectCrudReducer);
35
+ const { componentsDataStructure, contentTypeDataStructure, data, isLoading, status } =
36
+ useSelector(selectCrudReducer);
42
37
  const redirectionLink = useFindRedirectionLink(slug);
43
38
 
44
39
  const isMounted = useRef(true);
@@ -57,7 +52,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
57
52
  }, [slug, id, isCreatingEntry, origin]);
58
53
 
59
54
  const cleanClonedData = useCallback(
60
- data => {
55
+ (data) => {
61
56
  if (!origin) {
62
57
  return data;
63
58
  }
@@ -73,7 +68,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
73
68
  [origin]
74
69
  );
75
70
 
76
- const cleanReceivedData = useCallback(data => {
71
+ const cleanReceivedData = useCallback((data) => {
77
72
  const cleaned = removePasswordFieldsFromData(
78
73
  data,
79
74
  allLayoutDataRef.current.contentType,
@@ -128,7 +123,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
128
123
  const abortController = new AbortController();
129
124
  const { signal } = abortController;
130
125
 
131
- const fetchData = async signal => {
126
+ const fetchData = async (signal) => {
132
127
  dispatch(getData());
133
128
 
134
129
  try {
@@ -180,7 +175,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
180
175
  };
181
176
  }, [cleanClonedData, cleanReceivedData, push, requestURL, dispatch, rawQuery, redirectionLink]);
182
177
 
183
- const displayErrors = useCallback(err => {
178
+ const displayErrors = useCallback((err) => {
184
179
  const errorPayload = err.response.payload;
185
180
  console.error(errorPayload);
186
181
 
@@ -197,7 +192,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
197
192
  }, []);
198
193
 
199
194
  const onDelete = useCallback(
200
- async trackerProperty => {
195
+ async (trackerProperty) => {
201
196
  try {
202
197
  emitEventRef.current('willDeleteEntry', trackerProperty);
203
198
 
@@ -1,5 +1,5 @@
1
1
  import pluginId from '../../../pluginId';
2
2
 
3
- const getRequestUrl = path => `/${pluginId}/collection-types/${path}`;
3
+ const getRequestUrl = (path) => `/${pluginId}/collection-types/${path}`;
4
4
 
5
5
  export default getRequestUrl;
@@ -79,7 +79,7 @@ const CollectionTypeRecursivePath = ({
79
79
  { path: ':id', comp: EditViewLayoutManager },
80
80
  { path: '', comp: ListViewLayout },
81
81
  ].map(({ path, comp }) => (
82
- <Route key={path} path={`${url}/${path}`} render={props => renderRoute(props, comp)} />
82
+ <Route key={path} path={`${url}/${path}`} render={(props) => renderRoute(props, comp)} />
83
83
  ));
84
84
 
85
85
  return (
@@ -12,14 +12,14 @@ import EditSettingsView from '../EditSettingsView';
12
12
  const ComponentSettingsView = () => {
13
13
  const [{ isLoading, data: layout }, dispatch] = useReducer(crudReducer, crudInitialState);
14
14
  const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
15
- const { schemas } = useSelector(state => schemasSelector(state), shallowEqual);
15
+ const { schemas } = useSelector((state) => schemasSelector(state), shallowEqual);
16
16
  const { uid } = useParams();
17
17
 
18
18
  useEffect(() => {
19
19
  const abortController = new AbortController();
20
20
  const { signal } = abortController;
21
21
 
22
- const fetchData = async signal => {
22
+ const fetchData = async (signal) => {
23
23
  try {
24
24
  dispatch(getData());
25
25
 
@@ -32,7 +32,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
32
32
  const [isDraggingSibling, setIsDraggingSibling] = useState(false);
33
33
 
34
34
  const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
35
- const { schemas } = useSelector(state => schemasSelector(state), shallowEqual);
35
+ const { schemas } = useSelector((state) => schemasSelector(state), shallowEqual);
36
36
 
37
37
  const { componentLayouts, initialData, metaToEdit, modifiedData, metaForm } = reducerState.toJS();
38
38
 
@@ -47,8 +47,8 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
47
47
  const relationsLayout = modifiedData.layouts.editRelations;
48
48
  const editRelationsLayoutRemainingFields = useMemo(() => {
49
49
  return Object.keys(attributes)
50
- .filter(attr => attributes[attr].type === 'relation')
51
- .filter(attr => relationsLayout.indexOf(attr) === -1);
50
+ .filter((attr) => attributes[attr].type === 'relation')
51
+ .filter((attr) => relationsLayout.indexOf(attr) === -1);
52
52
  }, [attributes, relationsLayout]);
53
53
 
54
54
  const formToDisplay = useMemo(() => {
@@ -58,29 +58,29 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
58
58
 
59
59
  const associatedMetas = get(modifiedData, ['metadatas', metaToEdit, 'edit'], {});
60
60
 
61
- return Object.keys(associatedMetas).filter(meta => meta !== 'visible');
61
+ return Object.keys(associatedMetas).filter((meta) => meta !== 'visible');
62
62
  }, [metaToEdit, modifiedData]);
63
63
 
64
64
  const editLayoutRemainingFields = useMemo(() => {
65
65
  const displayedFields = flatMap(modifiedData.layouts.edit, 'rowContent');
66
66
 
67
67
  return Object.keys(modifiedData.attributes)
68
- .filter(attr => {
68
+ .filter((attr) => {
69
69
  if (!isContentTypeView) {
70
70
  return true;
71
71
  }
72
72
 
73
73
  return get(modifiedData, ['attributes', attr, 'type'], '') !== 'relation';
74
74
  })
75
- .filter(attr => get(modifiedData, ['metadatas', attr, 'edit', 'visible'], false) === true)
76
- .filter(attr => {
77
- return displayedFields.findIndex(el => el.name === attr) === -1;
75
+ .filter((attr) => get(modifiedData, ['metadatas', attr, 'edit', 'visible'], false) === true)
76
+ .filter((attr) => {
77
+ return displayedFields.findIndex((el) => el.name === attr) === -1;
78
78
  })
79
79
  .sort();
80
80
  }, [isContentTypeView, modifiedData]);
81
81
 
82
82
  const getSelectedItemSelectOptions = useCallback(
83
- formType => {
83
+ (formType) => {
84
84
  if (formType !== 'relation' && formType !== 'component') {
85
85
  return [];
86
86
  }
@@ -137,7 +137,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
137
137
  }
138
138
  };
139
139
 
140
- const handleSubmitMetaForm = e => {
140
+ const handleSubmitMetaForm = (e) => {
141
141
  e.preventDefault();
142
142
  dispatch({
143
143
  type: 'SUBMIT_META_FORM',
@@ -174,7 +174,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
174
174
  };
175
175
 
176
176
  const toggleModalForm = () => {
177
- setIsModalFormOpen(prevState => !prevState);
177
+ setIsModalFormOpen((prevState) => !prevState);
178
178
  };
179
179
 
180
180
  const renderForm = () =>
@@ -202,11 +202,11 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
202
202
  <FormattedMessage
203
203
  id={`${pluginId}.containers.SettingPage.editSettings.relation-field.description`}
204
204
  >
205
- {description => (
205
+ {(description) => (
206
206
  <FormattedMessage
207
207
  id={get(getInputProps(meta), 'label.id', 'app.utils.defaultMessage')}
208
208
  >
209
- {label => (
209
+ {(label) => (
210
210
  <Input
211
211
  autoFocus={index === 0}
212
212
  description={meta === 'mainField' ? description : ''}
@@ -236,7 +236,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
236
236
  metadatas={get(modifiedData, ['metadatas'], {})}
237
237
  moveItem={moveItem}
238
238
  moveRow={moveRow}
239
- onAddData={name => {
239
+ onAddData={(name) => {
240
240
  dispatch({
241
241
  type: 'ON_ADD_DATA',
242
242
  name,
@@ -250,7 +250,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
250
250
  fieldIndex,
251
251
  });
252
252
  }}
253
- setEditFieldToSelect={name => {
253
+ setEditFieldToSelect={(name) => {
254
254
  dispatch({
255
255
  type: 'SET_FIELD_TO_EDIT',
256
256
  name,
@@ -338,7 +338,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
338
338
  <FieldsReorder className={fieldsReorderClassName} />
339
339
  {isContentTypeView && (
340
340
  <SortableList
341
- addItem={name => {
341
+ addItem={(name) => {
342
342
  dispatch({
343
343
  type: 'ADD_RELATION',
344
344
  name,
@@ -352,7 +352,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
352
352
  hoverIndex,
353
353
  });
354
354
  }}
355
- removeItem={index => {
355
+ removeItem={(index) => {
356
356
  dispatch({
357
357
  type: 'REMOVE_RELATION',
358
358
  index,
@@ -16,16 +16,16 @@ const reducer = (state, action) => {
16
16
 
17
17
  switch (action.type) {
18
18
  case 'ADD_RELATION':
19
- return state.updateIn(layoutPathRelations, list => list.push(action.name));
19
+ return state.updateIn(layoutPathRelations, (list) => list.push(action.name));
20
20
  case 'MOVE_RELATION': {
21
- return state.updateIn(layoutPathRelations, list => {
21
+ return state.updateIn(layoutPathRelations, (list) => {
22
22
  return list
23
23
  .delete(action.dragIndex)
24
24
  .insert(action.hoverIndex, state.getIn([...layoutPathRelations, action.dragIndex]));
25
25
  });
26
26
  }
27
27
  case 'MOVE_ROW':
28
- return state.updateIn(layoutPathEdit, list => {
28
+ return state.updateIn(layoutPathEdit, (list) => {
29
29
  return list
30
30
  .delete(action.dragRowIndex)
31
31
  .insert(action.hoverRowIndex, state.getIn([...layoutPathEdit, action.dragRowIndex]));
@@ -34,7 +34,7 @@ const reducer = (state, action) => {
34
34
  const size = getInputSize(state.getIn(['modifiedData', 'attributes', action.name, 'type']));
35
35
 
36
36
  const listSize = state.getIn(layoutPathEdit).size;
37
- const newList = state.getIn(layoutPathEdit).updateIn([listSize - 1, 'rowContent'], list => {
37
+ const newList = state.getIn(layoutPathEdit).updateIn([listSize - 1, 'rowContent'], (list) => {
38
38
  if (list) {
39
39
  return list.push({
40
40
  name: action.name,
@@ -60,9 +60,9 @@ const reducer = (state, action) => {
60
60
 
61
61
  // Delete the entire row if length is one or if lenght is equal to 2 and the second element is the hidden div used to make the dnd exp smoother
62
62
  if (row.size === 1 || (row.size === 2 && row.getIn([1, 'name']) === '_TEMP_')) {
63
- newState = state.updateIn(layoutPathEdit, list => list.delete(action.rowIndex));
63
+ newState = state.updateIn(layoutPathEdit, (list) => list.delete(action.rowIndex));
64
64
  } else {
65
- newState = state.updateIn([...layoutPathEdit, action.rowIndex, 'rowContent'], list =>
65
+ newState = state.updateIn([...layoutPathEdit, action.rowIndex, 'rowContent'], (list) =>
66
66
  list.delete(action.fieldIndex)
67
67
  );
68
68
  }
@@ -71,13 +71,13 @@ const reducer = (state, action) => {
71
71
  return state.updateIn(layoutPathEdit, () => updatedList);
72
72
  }
73
73
  case 'REMOVE_RELATION':
74
- return state.updateIn(layoutPathRelations, list => list.delete(action.index));
74
+ return state.updateIn(layoutPathRelations, (list) => list.delete(action.index));
75
75
  case 'REORDER_DIFF_ROW': {
76
76
  const newState = state
77
- .updateIn([...layoutPathEdit, action.dragRowIndex, 'rowContent'], list => {
77
+ .updateIn([...layoutPathEdit, action.dragRowIndex, 'rowContent'], (list) => {
78
78
  return list.remove(action.dragIndex);
79
79
  })
80
- .updateIn([...layoutPathEdit, action.hoverRowIndex, 'rowContent'], list => {
80
+ .updateIn([...layoutPathEdit, action.hoverRowIndex, 'rowContent'], (list) => {
81
81
  return list.insert(
82
82
  action.hoverIndex,
83
83
  state.getIn([...layoutPathEdit, action.dragRowIndex, 'rowContent', action.dragIndex])
@@ -91,7 +91,7 @@ const reducer = (state, action) => {
91
91
  case 'REORDER_ROW': {
92
92
  const newState = state.updateIn(
93
93
  [...layoutPathEdit, action.dragRowIndex, 'rowContent'],
94
- list => {
94
+ (list) => {
95
95
  return list
96
96
  .delete(action.dragIndex)
97
97
  .insert(action.hoverIndex, list.get(action.dragIndex));
@@ -1,9 +1,9 @@
1
1
  import { get } from 'lodash';
2
2
 
3
- const createPossibleMainFieldsForModelsAndComponents = array => {
3
+ const createPossibleMainFieldsForModelsAndComponents = (array) => {
4
4
  return array.reduce((acc, current) => {
5
5
  const attributes = get(current, ['attributes'], {});
6
- const possibleMainFields = Object.keys(attributes).filter(attr => {
6
+ const possibleMainFields = Object.keys(attributes).filter((attr) => {
7
7
  return ![
8
8
  'boolean',
9
9
  'component',
@@ -1,6 +1,6 @@
1
1
  import pluginId from '../../../pluginId';
2
2
 
3
- const getInputProps = fieldName => {
3
+ const getInputProps = (fieldName) => {
4
4
  let type;
5
5
 
6
6
  switch (fieldName) {