@akemona-org/strapi-plugin-content-manager 3.7.0

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 (401) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +27 -0
  3. package/admin/src/InjectedComponents/ContentTypeBuilder/ConfigureViewButton/index.js +78 -0
  4. package/admin/src/assets/images/background_input.svg +1 -0
  5. package/admin/src/assets/images/icon-cross-blue.svg +1 -0
  6. package/admin/src/assets/images/icon_remove.svg +19 -0
  7. package/admin/src/assets/images/logo.svg +1 -0
  8. package/admin/src/components/AddDropdown/components.js +113 -0
  9. package/admin/src/components/AddDropdown/index.js +76 -0
  10. package/admin/src/components/Block/components.js +28 -0
  11. package/admin/src/components/Block/index.js +45 -0
  12. package/admin/src/components/ComponentInitializer/P.js +9 -0
  13. package/admin/src/components/ComponentInitializer/index.js +43 -0
  14. package/admin/src/components/Container/index.js +7 -0
  15. package/admin/src/components/CustomInputCheckbox/components.js +77 -0
  16. package/admin/src/components/CustomInputCheckbox/index.js +53 -0
  17. package/admin/src/components/CustomTable/ActionCollapse/Delete.js +14 -0
  18. package/admin/src/components/CustomTable/ActionCollapse/DeleteAll.js +18 -0
  19. package/admin/src/components/CustomTable/ActionCollapse/Wrapper.js +20 -0
  20. package/admin/src/components/CustomTable/ActionCollapse/index.js +38 -0
  21. package/admin/src/components/CustomTable/Headers/Header.js +59 -0
  22. package/admin/src/components/CustomTable/Headers/Thead.js +35 -0
  23. package/admin/src/components/CustomTable/Headers/index.js +46 -0
  24. package/admin/src/components/CustomTable/Row/ActionContainer.js +19 -0
  25. package/admin/src/components/CustomTable/Row/Cell.js +55 -0
  26. package/admin/src/components/CustomTable/Row/index.js +112 -0
  27. package/admin/src/components/CustomTable/index.js +162 -0
  28. package/admin/src/components/CustomTable/styledComponents.js +85 -0
  29. package/admin/src/components/DragLayer/index.js +102 -0
  30. package/admin/src/components/DraggedField/Close/index.js +10 -0
  31. package/admin/src/components/DraggedField/GrabWrapper.js +38 -0
  32. package/admin/src/components/DraggedField/Link.js +17 -0
  33. package/admin/src/components/DraggedField/NameWrapper.js +29 -0
  34. package/admin/src/components/DraggedField/RemoveWrapper.js +32 -0
  35. package/admin/src/components/DraggedField/SubWrapper.js +36 -0
  36. package/admin/src/components/DraggedField/Wrapper.js +134 -0
  37. package/admin/src/components/DraggedField/index.js +196 -0
  38. package/admin/src/components/DraggedField/utils/getColor.js +12 -0
  39. package/admin/src/components/DraggedField/utils/getHeight.js +3 -0
  40. package/admin/src/components/DraggedFieldWithPreview/Carret.js +24 -0
  41. package/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +70 -0
  42. package/admin/src/components/DraggedFieldWithPreview/DynamicZoneWrapper.js +10 -0
  43. package/admin/src/components/DraggedFieldWithPreview/Tooltip.js +19 -0
  44. package/admin/src/components/DraggedFieldWithPreview/Wrapper.js +24 -0
  45. package/admin/src/components/DraggedFieldWithPreview/index.js +194 -0
  46. package/admin/src/components/DynamicComponentCard/Wrapper.js +63 -0
  47. package/admin/src/components/DynamicComponentCard/index.js +49 -0
  48. package/admin/src/components/DynamicZone/BaselineAlignement.js +11 -0
  49. package/admin/src/components/DynamicZone/Button.js +31 -0
  50. package/admin/src/components/DynamicZone/Component/RoundCTA.js +45 -0
  51. package/admin/src/components/DynamicZone/Component/index.js +79 -0
  52. package/admin/src/components/DynamicZone/ComponentWrapper.js +44 -0
  53. package/admin/src/components/DynamicZone/DynamicZoneWrapper.js +12 -0
  54. package/admin/src/components/DynamicZone/Label.js +42 -0
  55. package/admin/src/components/DynamicZone/Picker/Category/Banner/Wrapper.js +78 -0
  56. package/admin/src/components/DynamicZone/Picker/Category/Banner/index.js +33 -0
  57. package/admin/src/components/DynamicZone/Picker/Category/index.js +53 -0
  58. package/admin/src/components/DynamicZone/Picker/Wrapper.js +32 -0
  59. package/admin/src/components/DynamicZone/Picker/index.js +88 -0
  60. package/admin/src/components/DynamicZone/Wrapper.js +34 -0
  61. package/admin/src/components/DynamicZone/index.js +238 -0
  62. package/admin/src/components/DynamicZone/utils/connect.js +12 -0
  63. package/admin/src/components/DynamicZone/utils/select.js +49 -0
  64. package/admin/src/components/FieldComponent/ComponentIcon.js +44 -0
  65. package/admin/src/components/FieldComponent/EmptyComponent.js +19 -0
  66. package/admin/src/components/FieldComponent/Label.js +10 -0
  67. package/admin/src/components/FieldComponent/ResetComponent.js +41 -0
  68. package/admin/src/components/FieldComponent/Wrapper.js +18 -0
  69. package/admin/src/components/FieldComponent/index.js +171 -0
  70. package/admin/src/components/FieldComponent/utils/connect.js +12 -0
  71. package/admin/src/components/FieldComponent/utils/select.js +123 -0
  72. package/admin/src/components/FieldsReorder/Item.js +249 -0
  73. package/admin/src/components/FieldsReorder/components.js +8 -0
  74. package/admin/src/components/FieldsReorder/index.js +102 -0
  75. package/admin/src/components/FilterOptionsCTA/index.js +14 -0
  76. package/admin/src/components/FilterPicker/components.js +56 -0
  77. package/admin/src/components/FilterPicker/index.js +258 -0
  78. package/admin/src/components/FilterPicker/init.js +25 -0
  79. package/admin/src/components/FilterPicker/reducer.js +58 -0
  80. package/admin/src/components/FilterPickerOption/Input.js +58 -0
  81. package/admin/src/components/FilterPickerOption/Option.js +18 -0
  82. package/admin/src/components/FilterPickerOption/components.js +60 -0
  83. package/admin/src/components/FilterPickerOption/index.js +101 -0
  84. package/admin/src/components/FormTitle/index.js +26 -0
  85. package/admin/src/components/FormWrapper/index.js +20 -0
  86. package/admin/src/components/InputJSON/components.js +30 -0
  87. package/admin/src/components/InputJSON/index.js +184 -0
  88. package/admin/src/components/InputJSON/jsonlint.js +424 -0
  89. package/admin/src/components/InputJSONWithErrors/Wrapper.js +32 -0
  90. package/admin/src/components/InputJSONWithErrors/index.js +168 -0
  91. package/admin/src/components/InputUID/InputUID.js +26 -0
  92. package/admin/src/components/InputUID/Options/Option.js +22 -0
  93. package/admin/src/components/InputUID/Options/OptionsTitle.js +12 -0
  94. package/admin/src/components/InputUID/Options/RightOptionLabel.js +10 -0
  95. package/admin/src/components/InputUID/Options/index.js +34 -0
  96. package/admin/src/components/InputUID/Options/wrapper.js +13 -0
  97. package/admin/src/components/InputUID/RegenerateButton.js +18 -0
  98. package/admin/src/components/InputUID/RightContent.js +14 -0
  99. package/admin/src/components/InputUID/RightContentLabel.js +10 -0
  100. package/admin/src/components/InputUID/RightLabel.js +42 -0
  101. package/admin/src/components/InputUID/SubLabel.js +9 -0
  102. package/admin/src/components/InputUID/Wrapper.js +8 -0
  103. package/admin/src/components/InputUID/index.js +325 -0
  104. package/admin/src/components/InputUID/regex.js +3 -0
  105. package/admin/src/components/Inputs/index.js +283 -0
  106. package/admin/src/components/Inputs/utils/VALIDATIONS_TO_OMIT.js +12 -0
  107. package/admin/src/components/Inputs/utils/connect.js +12 -0
  108. package/admin/src/components/Inputs/utils/generateOptions.js +19 -0
  109. package/admin/src/components/Inputs/utils/getInputType.js +44 -0
  110. package/admin/src/components/Inputs/utils/getStep.js +15 -0
  111. package/admin/src/components/Inputs/utils/index.js +6 -0
  112. package/admin/src/components/Inputs/utils/select.js +38 -0
  113. package/admin/src/components/LayoutTitle/index.js +19 -0
  114. package/admin/src/components/MediaPreviewList/StyledMediaPreviewList.js +171 -0
  115. package/admin/src/components/MediaPreviewList/index.js +110 -0
  116. package/admin/src/components/NonRepeatableComponent/index.js +73 -0
  117. package/admin/src/components/NonRepeatableWrapper/index.js +73 -0
  118. package/admin/src/components/PlusButton/index.js +52 -0
  119. package/admin/src/components/PopupForm/index.js +93 -0
  120. package/admin/src/components/PreviewCarret/components.js +27 -0
  121. package/admin/src/components/PreviewCarret/index.js +22 -0
  122. package/admin/src/components/PreviewWysiwyg/Wrapper.js +133 -0
  123. package/admin/src/components/PreviewWysiwyg/index.js +34 -0
  124. package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.js +72 -0
  125. package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +16 -0
  126. package/admin/src/components/RelationPreviewList/CountWrapper.js +7 -0
  127. package/admin/src/components/RelationPreviewList/RelationPreviewTooltip.js +117 -0
  128. package/admin/src/components/RelationPreviewList/index.js +111 -0
  129. package/admin/src/components/RepeatableComponent/AddFieldButton.js +64 -0
  130. package/admin/src/components/RepeatableComponent/Banner.js +112 -0
  131. package/admin/src/components/RepeatableComponent/BannerWrapper.js +194 -0
  132. package/admin/src/components/RepeatableComponent/CarretTop.js +14 -0
  133. package/admin/src/components/RepeatableComponent/DraggedItem/index.js +245 -0
  134. package/admin/src/components/RepeatableComponent/DraggedItem/utils/connect.js +11 -0
  135. package/admin/src/components/RepeatableComponent/DraggedItem/utils/index.js +2 -0
  136. package/admin/src/components/RepeatableComponent/DraggedItem/utils/select.js +30 -0
  137. package/admin/src/components/RepeatableComponent/EmptyComponent.js +27 -0
  138. package/admin/src/components/RepeatableComponent/FormWrapper.js +27 -0
  139. package/admin/src/components/RepeatableComponent/index.js +187 -0
  140. package/admin/src/components/RepeatableComponent/reducer.js +73 -0
  141. package/admin/src/components/RepeatableComponent/utils/connect.js +11 -0
  142. package/admin/src/components/RepeatableComponent/utils/select.js +12 -0
  143. package/admin/src/components/Search/index.js +88 -0
  144. package/admin/src/components/SectionTitle/Title.js +11 -0
  145. package/admin/src/components/SectionTitle/index.js +29 -0
  146. package/admin/src/components/SelectMany/ListItem.js +107 -0
  147. package/admin/src/components/SelectMany/Relation.js +106 -0
  148. package/admin/src/components/SelectMany/components.js +153 -0
  149. package/admin/src/components/SelectMany/index.js +159 -0
  150. package/admin/src/components/SelectOne/SingleValue.js +58 -0
  151. package/admin/src/components/SelectOne/index.js +71 -0
  152. package/admin/src/components/SelectWrapper/ClearIndicator.js +15 -0
  153. package/admin/src/components/SelectWrapper/IndicatorSeparator.js +3 -0
  154. package/admin/src/components/SelectWrapper/Option.js +76 -0
  155. package/admin/src/components/SelectWrapper/components.js +14 -0
  156. package/admin/src/components/SelectWrapper/index.js +393 -0
  157. package/admin/src/components/SelectWrapper/utils/connect.js +12 -0
  158. package/admin/src/components/SelectWrapper/utils/index.js +3 -0
  159. package/admin/src/components/SelectWrapper/utils/select.js +45 -0
  160. package/admin/src/components/SelectWrapper/utils/styles.js +105 -0
  161. package/admin/src/components/Separator/index.js +9 -0
  162. package/admin/src/components/SettingFormWrapper/index.js +9 -0
  163. package/admin/src/components/SettingsViewWrapper/index.js +283 -0
  164. package/admin/src/components/SortWrapper/index.js +9 -0
  165. package/admin/src/components/SortableList/Item.js +126 -0
  166. package/admin/src/components/SortableList/index.js +60 -0
  167. package/admin/src/components/State/Wrapper.js +30 -0
  168. package/admin/src/components/State/index.js +26 -0
  169. package/admin/src/components/Truncate/index.js +5 -0
  170. package/admin/src/components/Truncated/index.js +10 -0
  171. package/admin/src/components/Wysiwyg/EditorWrapper.js +122 -0
  172. package/admin/src/components/Wysiwyg/MediaLib.js +71 -0
  173. package/admin/src/components/Wysiwyg/PreviewControlWrapper.js +30 -0
  174. package/admin/src/components/Wysiwyg/SelectWrapper.js +24 -0
  175. package/admin/src/components/Wysiwyg/ToggleModeWrapper.js +30 -0
  176. package/admin/src/components/Wysiwyg/constants.js +98 -0
  177. package/admin/src/components/Wysiwyg/customSelect.js +39 -0
  178. package/admin/src/components/Wysiwyg/helpers.js +116 -0
  179. package/admin/src/components/Wysiwyg/index.js +819 -0
  180. package/admin/src/components/Wysiwyg/previewControl.js +29 -0
  181. package/admin/src/components/Wysiwyg/toggleMode.js +44 -0
  182. package/admin/src/components/Wysiwyg/utils.js +70 -0
  183. package/admin/src/components/WysiwygBottomControls/components.js +44 -0
  184. package/admin/src/components/WysiwygBottomControls/index.js +33 -0
  185. package/admin/src/components/WysiwygDropUpload/Label.js +16 -0
  186. package/admin/src/components/WysiwygDropUpload/index.js +18 -0
  187. package/admin/src/components/WysiwygEditor/index.js +26 -0
  188. package/admin/src/components/WysiwygInlineControls/Button.js +77 -0
  189. package/admin/src/components/WysiwygInlineControls/StyledButton.js +54 -0
  190. package/admin/src/components/WysiwygInlineControls/Wrapper.js +25 -0
  191. package/admin/src/components/WysiwygInlineControls/index.js +66 -0
  192. package/admin/src/components/WysiwygWithErrors/Wrapper.js +38 -0
  193. package/admin/src/components/WysiwygWithErrors/index.js +158 -0
  194. package/admin/src/containers/CollectionTypeFormWrapper/index.js +376 -0
  195. package/admin/src/containers/CollectionTypeFormWrapper/utils/getRequestUrl.js +5 -0
  196. package/admin/src/containers/CollectionTypeFormWrapper/utils/index.js +2 -0
  197. package/admin/src/containers/CollectionTypeRecursivePath/index.js +125 -0
  198. package/admin/src/containers/ComponentSetttingsView/index.js +55 -0
  199. package/admin/src/containers/EditSettingsView/index.js +408 -0
  200. package/admin/src/containers/EditSettingsView/init.js +18 -0
  201. package/admin/src/containers/EditSettingsView/reducer.js +126 -0
  202. package/admin/src/containers/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +26 -0
  203. package/admin/src/containers/EditSettingsView/utils/getInputProps.js +30 -0
  204. package/admin/src/containers/EditSettingsView/utils/index.js +2 -0
  205. package/admin/src/containers/EditSettingsView/utils/layout.js +98 -0
  206. package/admin/src/containers/EditView/DeleteLink/index.js +94 -0
  207. package/admin/src/containers/EditView/DeleteLink/utils/connect.js +12 -0
  208. package/admin/src/containers/EditView/DeleteLink/utils/index.js +2 -0
  209. package/admin/src/containers/EditView/DeleteLink/utils/select.js +21 -0
  210. package/admin/src/containers/EditView/Header/index.js +258 -0
  211. package/admin/src/containers/EditView/Header/utils/connect.js +12 -0
  212. package/admin/src/containers/EditView/Header/utils/getDraftRelations.js +62 -0
  213. package/admin/src/containers/EditView/Header/utils/index.js +3 -0
  214. package/admin/src/containers/EditView/Header/utils/select.js +31 -0
  215. package/admin/src/containers/EditView/InformationCard.js +100 -0
  216. package/admin/src/containers/EditView/components.js +74 -0
  217. package/admin/src/containers/EditView/index.js +297 -0
  218. package/admin/src/containers/EditView/utils/createAttributesLayout.js +39 -0
  219. package/admin/src/containers/EditView/utils/getFieldsActionMatchingPermissions.js +23 -0
  220. package/admin/src/containers/EditView/utils/index.js +3 -0
  221. package/admin/src/containers/EditViewDataManagerProvider/index.js +519 -0
  222. package/admin/src/containers/EditViewDataManagerProvider/reducer.js +218 -0
  223. package/admin/src/containers/EditViewDataManagerProvider/utils/cleanData.js +88 -0
  224. package/admin/src/containers/EditViewDataManagerProvider/utils/getYupInnerErrors.js +17 -0
  225. package/admin/src/containers/EditViewDataManagerProvider/utils/index.js +3 -0
  226. package/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +368 -0
  227. package/admin/src/containers/EditViewLayoutManager/Permissions.js +30 -0
  228. package/admin/src/containers/EditViewLayoutManager/actions.js +9 -0
  229. package/admin/src/containers/EditViewLayoutManager/constants.js +2 -0
  230. package/admin/src/containers/EditViewLayoutManager/index.js +44 -0
  231. package/admin/src/containers/EditViewLayoutManager/reducer.js +30 -0
  232. package/admin/src/containers/EditViewLayoutManager/selectors.js +5 -0
  233. package/admin/src/containers/LayoutDndProvider/index.js +75 -0
  234. package/admin/src/containers/ListSettingsView/DragWrapper.js +21 -0
  235. package/admin/src/containers/ListSettingsView/DropdownButton.js +8 -0
  236. package/admin/src/containers/ListSettingsView/Label.js +91 -0
  237. package/admin/src/containers/ListSettingsView/MenuDropdown.js +41 -0
  238. package/admin/src/containers/ListSettingsView/Toggle.js +51 -0
  239. package/admin/src/containers/ListSettingsView/forms.json +64 -0
  240. package/admin/src/containers/ListSettingsView/index.js +298 -0
  241. package/admin/src/containers/ListSettingsView/init.js +11 -0
  242. package/admin/src/containers/ListSettingsView/reducer.js +77 -0
  243. package/admin/src/containers/ListView/FieldPicker/ConfigureLink/StyledLink.js +28 -0
  244. package/admin/src/containers/ListView/FieldPicker/ConfigureLink/Wrapper.js +8 -0
  245. package/admin/src/containers/ListView/FieldPicker/ConfigureLink/index.js +29 -0
  246. package/admin/src/containers/ListView/FieldPicker/Field/Wrapper.js +15 -0
  247. package/admin/src/containers/ListView/FieldPicker/Field/index.js +24 -0
  248. package/admin/src/containers/ListView/FieldPicker/Fields/Wrapper.js +18 -0
  249. package/admin/src/containers/ListView/FieldPicker/Fields/index.js +27 -0
  250. package/admin/src/containers/ListView/FieldPicker/Header/Reset.js +8 -0
  251. package/admin/src/containers/ListView/FieldPicker/Header/index.js +42 -0
  252. package/admin/src/containers/ListView/FieldPicker/Wrapper.js +9 -0
  253. package/admin/src/containers/ListView/FieldPicker/index.js +46 -0
  254. package/admin/src/containers/ListView/Filter.js +83 -0
  255. package/admin/src/containers/ListView/Footer.js +60 -0
  256. package/admin/src/containers/ListView/actions.js +91 -0
  257. package/admin/src/containers/ListView/components.js +138 -0
  258. package/admin/src/containers/ListView/constants.js +16 -0
  259. package/admin/src/containers/ListView/index.js +573 -0
  260. package/admin/src/containers/ListView/reducer.js +182 -0
  261. package/admin/src/containers/ListView/selectors.js +24 -0
  262. package/admin/src/containers/ListView/utils/buildQueryString.js +26 -0
  263. package/admin/src/containers/ListView/utils/createPluginsFilter.js +13 -0
  264. package/admin/src/containers/ListView/utils/getAllAllowedHeaders.js +17 -0
  265. package/admin/src/containers/ListView/utils/getFirstSortableHeader.js +14 -0
  266. package/admin/src/containers/ListView/utils/index.js +3 -0
  267. package/admin/src/containers/ListViewLayoutManager/Permissions.js +29 -0
  268. package/admin/src/containers/ListViewLayoutManager/index.js +60 -0
  269. package/admin/src/containers/ListViewProvider/index.js +16 -0
  270. package/admin/src/containers/Main/actions.js +13 -0
  271. package/admin/src/containers/Main/constants.js +3 -0
  272. package/admin/src/containers/Main/index.js +100 -0
  273. package/admin/src/containers/Main/reducer.js +37 -0
  274. package/admin/src/containers/Main/selectors.js +20 -0
  275. package/admin/src/containers/RBACManager/actions.js +14 -0
  276. package/admin/src/containers/RBACManager/constants.js +2 -0
  277. package/admin/src/containers/RBACManager/reducer.js +32 -0
  278. package/admin/src/containers/RBACManager/useSyncRbac.js +28 -0
  279. package/admin/src/containers/SingleTypeFormWrapper/index.js +317 -0
  280. package/admin/src/containers/SingleTypeFormWrapper/utils/getRequestUrl.js +5 -0
  281. package/admin/src/containers/SingleTypeFormWrapper/utils/index.js +2 -0
  282. package/admin/src/containers/SingleTypeRecursivePath/index.js +84 -0
  283. package/admin/src/containers/WysiwygProvider/index.js +16 -0
  284. package/admin/src/contexts/ContentTypeLayout.js +5 -0
  285. package/admin/src/contexts/LayoutDnd.js +5 -0
  286. package/admin/src/contexts/ListView.js +5 -0
  287. package/admin/src/contexts/Wysiwyg.js +5 -0
  288. package/admin/src/contexts/index.js +4 -0
  289. package/admin/src/hooks/index.js +6 -0
  290. package/admin/src/hooks/useContentTypeLayout/index.js +19 -0
  291. package/admin/src/hooks/useFetchContentTypeLayout/index.js +83 -0
  292. package/admin/src/hooks/useFetchContentTypeLayout/reducer.js +56 -0
  293. package/admin/src/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +235 -0
  294. package/admin/src/hooks/useFindRedirectionLink/index.js +14 -0
  295. package/admin/src/hooks/useFindRedirectionLink/selectors.js +7 -0
  296. package/admin/src/hooks/useFindRedirectionLink/utils/getRedirectionLink.js +45 -0
  297. package/admin/src/hooks/useLayoutDnd.js +6 -0
  298. package/admin/src/hooks/useListView.js +6 -0
  299. package/admin/src/hooks/useWysiwyg.js +6 -0
  300. package/admin/src/icons/Bold/index.js +22 -0
  301. package/admin/src/icons/Code/index.js +13 -0
  302. package/admin/src/icons/Cross/index.js +33 -0
  303. package/admin/src/icons/Italic/index.js +23 -0
  304. package/admin/src/icons/Link/index.js +21 -0
  305. package/admin/src/icons/Media/index.js +14 -0
  306. package/admin/src/icons/Na/index.js +58 -0
  307. package/admin/src/icons/Ol/index.js +13 -0
  308. package/admin/src/icons/Quote/index.js +13 -0
  309. package/admin/src/icons/Striked/index.js +24 -0
  310. package/admin/src/icons/Ul/index.js +15 -0
  311. package/admin/src/icons/Underline/index.js +22 -0
  312. package/admin/src/index.js +52 -0
  313. package/admin/src/lifecycles.js +19 -0
  314. package/admin/src/permissions.js +27 -0
  315. package/admin/src/pluginId.js +5 -0
  316. package/admin/src/reducers.js +16 -0
  317. package/admin/src/selectors.js +6 -0
  318. package/admin/src/sharedReducers/crudReducer/actions.js +44 -0
  319. package/admin/src/sharedReducers/crudReducer/constants.js +7 -0
  320. package/admin/src/sharedReducers/crudReducer/reducer.js +75 -0
  321. package/admin/src/sharedReducers/crudReducer/selectors.js +5 -0
  322. package/admin/src/testUtils/data.js +305 -0
  323. package/admin/src/testUtils/index.js +4 -0
  324. package/admin/src/translations/ar.json +94 -0
  325. package/admin/src/translations/cs.json +130 -0
  326. package/admin/src/translations/de.json +177 -0
  327. package/admin/src/translations/dk.json +180 -0
  328. package/admin/src/translations/en.json +177 -0
  329. package/admin/src/translations/es.json +177 -0
  330. package/admin/src/translations/fr.json +162 -0
  331. package/admin/src/translations/id.json +175 -0
  332. package/admin/src/translations/index.js +53 -0
  333. package/admin/src/translations/it.json +177 -0
  334. package/admin/src/translations/ja.json +94 -0
  335. package/admin/src/translations/ko.json +110 -0
  336. package/admin/src/translations/ms.json +148 -0
  337. package/admin/src/translations/nl.json +94 -0
  338. package/admin/src/translations/pl.json +142 -0
  339. package/admin/src/translations/pt-BR.json +94 -0
  340. package/admin/src/translations/pt.json +94 -0
  341. package/admin/src/translations/ru.json +177 -0
  342. package/admin/src/translations/sk.json +172 -0
  343. package/admin/src/translations/th.json +155 -0
  344. package/admin/src/translations/tr.json +177 -0
  345. package/admin/src/translations/uk.json +148 -0
  346. package/admin/src/translations/vi.json +110 -0
  347. package/admin/src/translations/zh-Hans.json +177 -0
  348. package/admin/src/translations/zh.json +94 -0
  349. package/admin/src/utils/ItemTypes.js +7 -0
  350. package/admin/src/utils/checkIfAttributeIsDisplayable.js +13 -0
  351. package/admin/src/utils/createDefaultForm.js +50 -0
  352. package/admin/src/utils/dateFormats.js +18 -0
  353. package/admin/src/utils/formatFiltersFromQuery.js +55 -0
  354. package/admin/src/utils/formatFiltersToQuery.js +27 -0
  355. package/admin/src/utils/formatLayoutToApi.js +44 -0
  356. package/admin/src/utils/generatePermissionsObject.js +20 -0
  357. package/admin/src/utils/getComponents.js +50 -0
  358. package/admin/src/utils/getDisplayedValue.js +61 -0
  359. package/admin/src/utils/getFieldName.js +6 -0
  360. package/admin/src/utils/getMaxTempKey.js +12 -0
  361. package/admin/src/utils/getRequestUrl.js +5 -0
  362. package/admin/src/utils/getTrad.js +5 -0
  363. package/admin/src/utils/index.js +17 -0
  364. package/admin/src/utils/mergeMetasWithSchema.js +20 -0
  365. package/admin/src/utils/removeKeyInObject.js +45 -0
  366. package/admin/src/utils/removePasswordFieldsFromData.js +54 -0
  367. package/config/admin.json +5 -0
  368. package/config/functions/bootstrap.js +9 -0
  369. package/config/policies/has-draft-and-publish.js +19 -0
  370. package/config/policies/hasPermissions.js +34 -0
  371. package/config/policies/routing.js +27 -0
  372. package/config/routes.json +275 -0
  373. package/controllers/collection-types.js +282 -0
  374. package/controllers/components.js +66 -0
  375. package/controllers/content-types.js +112 -0
  376. package/controllers/relations.js +63 -0
  377. package/controllers/single-types.js +170 -0
  378. package/controllers/uid.js +41 -0
  379. package/controllers/validation/index.js +104 -0
  380. package/controllers/validation/model-configuration.js +114 -0
  381. package/oas.yml +757 -0
  382. package/package.json +77 -0
  383. package/services/components.js +92 -0
  384. package/services/configuration.js +79 -0
  385. package/services/content-types.js +73 -0
  386. package/services/data-mapper.js +98 -0
  387. package/services/entity-manager.js +140 -0
  388. package/services/metrics.js +34 -0
  389. package/services/permission-checker.js +69 -0
  390. package/services/permission.js +95 -0
  391. package/services/uid.js +63 -0
  392. package/services/utils/configuration/attributes.js +175 -0
  393. package/services/utils/configuration/index.js +43 -0
  394. package/services/utils/configuration/layouts.js +185 -0
  395. package/services/utils/configuration/metadatas.js +142 -0
  396. package/services/utils/configuration/settings.js +52 -0
  397. package/services/utils/store.js +93 -0
  398. package/utils/index.js +16 -0
  399. package/utils/pick-writable-attributes.js +6 -0
  400. package/utils/wrap-bad-request.js +15 -0
  401. package/validation/policies/hasPermissions.js +17 -0
@@ -0,0 +1,177 @@
1
+ {
2
+ "EditRelations.title": "关联数据",
3
+ "api.id": "API ID",
4
+ "components.AddFilterCTA.add": "过滤器",
5
+ "components.AddFilterCTA.hide": "过滤器",
6
+ "components.DraggableAttr.edit": "点击以编辑",
7
+ "components.DynamicZone.add-compo": "添加到 {componentName}",
8
+ "components.DynamicZone.missing.plural": "有 {count} 个缺少的组件",
9
+ "components.DynamicZone.missing.singular": "有 {count} 个缺少的组件",
10
+ "components.DynamicZone.pick-compo": "选择一个组件",
11
+ "components.DynamicZone.required": "必须选择组件",
12
+ "components.EmptyAttributesBlock.button": "前往设置页面",
13
+ "components.EmptyAttributesBlock.description": "您可以更改设置",
14
+ "components.FieldItem.linkToComponentLayout": "设置组件的布局",
15
+ "components.FilterOptions.button.apply": "应用",
16
+ "components.FiltersPickWrapper.PluginHeader.actions.apply": "应用",
17
+ "components.FiltersPickWrapper.PluginHeader.actions.clearAll": "清除",
18
+ "components.FiltersPickWrapper.PluginHeader.description": "设置过滤条件",
19
+ "components.FiltersPickWrapper.PluginHeader.title.filter": "过滤器",
20
+ "components.FiltersPickWrapper.hide": "隐藏",
21
+ "components.LimitSelect.itemsPerPage": "每页展示数目",
22
+ "components.NotAllowedInput.text": "没有权限查看该字段",
23
+ "components.Search.placeholder": "搜索...",
24
+ "components.Select.draft-info-title": "状态: 草稿",
25
+ "components.Select.publish-info-title": "状态: 已发布",
26
+ "components.SettingsViewWrapper.pluginHeader.description.edit-settings": "自定义编辑视图的外观。",
27
+ "components.SettingsViewWrapper.pluginHeader.description.list-settings": "定义列表视图的设置。",
28
+ "components.SettingsViewWrapper.pluginHeader.title": "配置视图 :{name}",
29
+ "components.TableDelete.delete": "刪除所有",
30
+ "components.TableDelete.deleteSelected": "删除所选",
31
+ "components.TableDelete.entries.plural": "已选取 {number} 条记录",
32
+ "components.TableDelete.entries.singular": "已选取 {number} 条记录",
33
+ "components.TableEmpty.withFilters": "没有找到与 {contentType} 相关的内容",
34
+ "components.TableEmpty.withSearch": "在 {contentType} 中没有找到符合 “{search}” 的内容",
35
+ "components.TableEmpty.withoutFilter": "没有找到 {contentType}",
36
+ "components.empty-repeatable": "暂无内容,点击按钮来添加",
37
+ "components.repeatable.reorder.error": "渲染组件字段时出现了一个错误,请重试",
38
+ "components.notification.info.maximum-requirement": "字段数量已到上限",
39
+ "components.notification.info.minimum-requirement": "已添加一个字段,以满足最低要求",
40
+ "components.reset-entry": "重置记录",
41
+ "components.uid.apply": "应用",
42
+ "components.uid.available": "可用",
43
+ "components.uid.regenerate": "重新生成",
44
+ "components.uid.suggested": "建议",
45
+ "components.uid.unavailable": "不可用",
46
+ "containers.Edit.Link.Fields": "编辑字段",
47
+ "containers.Edit.Link.Layout": "编辑布局",
48
+ "containers.Edit.Link.Model": "编辑该内容类型",
49
+ "containers.Edit.addAnItem": "新增关联...",
50
+ "containers.Edit.clickToJump": "跳转到该项记录",
51
+ "containers.Edit.delete": "删除",
52
+ "containers.Edit.delete-entry": "删除该记录",
53
+ "containers.Edit.editing": "编辑...",
54
+ "containers.Edit.information": "记录信息",
55
+ "containers.Edit.information.by": "属于",
56
+ "containers.Edit.information.draftVersion": "草稿版本",
57
+ "containers.Edit.information.editing": "正在编辑",
58
+ "containers.Edit.information.lastUpdate": "最后更新",
59
+ "containers.Edit.information.publishedVersion": "已发布版本",
60
+ "containers.Edit.pluginHeader.title.new": "创建记录",
61
+ "containers.Edit.reset": "重置",
62
+ "containers.Edit.returnList": "返回列表",
63
+ "containers.Edit.seeDetails": "详细信息",
64
+ "containers.Edit.submit": "保存",
65
+ "containers.EditSettingsView.modal-form.edit-field": "编辑字段",
66
+ "containers.EditView.add.new": "新增记录",
67
+ "containers.EditView.components.missing.plural": "缺失 {count} 个组件",
68
+ "containers.EditView.components.missing.singular": "缺少 {count} 个组件",
69
+ "containers.EditView.notification.errors": "表单包含一些错误",
70
+ "containers.Home.introduction": "要编辑您的记录,请转到左边菜单中的特定链接。这个插件没有合适的方法来编辑设置,它仍然在积极的开发中。",
71
+ "containers.Home.pluginHeaderDescription": "通过一个强大而漂亮的界面管理你的记录。",
72
+ "containers.Home.pluginHeaderTitle": "内容管理器",
73
+ "containers.List.addAnEntry": "增加新的 {entity}",
74
+ "containers.List.draft": "草稿",
75
+ "containers.List.errorFetchRecords": "错误",
76
+ "containers.List.pluginHeaderDescription": "找到 {label} 条记录",
77
+ "containers.List.pluginHeaderDescription.singular": "找到 {label} 条记录",
78
+ "containers.List.published": "已发布",
79
+ "containers.ListPage.displayedFields": "展示的字段",
80
+ "containers.ListPage.items.plural": "项目",
81
+ "containers.ListPage.items.singular": "项目",
82
+ "containers.ListPage.table-headers.published_at": "发布状态",
83
+ "containers.ListSettingsView.modal-form.edit-label": "编辑标签",
84
+ "containers.SettingPage.add.field": "新增字段",
85
+ "containers.SettingPage.add.relational-field": "新增关联字段",
86
+ "containers.SettingPage.attributes": "属性",
87
+ "containers.SettingPage.attributes.description": "调整字段的顺序",
88
+ "containers.SettingPage.editSettings.description": "拖拽字段来布局",
89
+ "containers.SettingPage.editSettings.entry.title": "标题",
90
+ "containers.SettingPage.editSettings.entry.title.description": "设置展示的字段",
91
+ "containers.SettingPage.editSettings.relation-field.description": "设置编辑和列表页面的展示文本",
92
+ "containers.SettingPage.editSettings.title": "编辑展示字段",
93
+ "containers.SettingPage.layout": "布局",
94
+ "containers.SettingPage.listSettings.description": "编辑集合类型的配置",
95
+ "containers.SettingPage.listSettings.title": "列表 (设置)",
96
+ "containers.SettingPage.pluginHeaderDescription": "编辑集合类型的特定配置",
97
+ "containers.SettingPage.relations": "关联字段",
98
+ "containers.SettingPage.settings": "设置",
99
+ "containers.SettingPage.view": "视图",
100
+ "containers.SettingViewModel.pluginHeader.title": "内容管理:{name}",
101
+ "containers.SettingsPage.Block.contentType.description": "调整指定内容类型的的字段",
102
+ "containers.SettingsPage.Block.contentType.title": "集合类型",
103
+ "containers.SettingsPage.Block.generalSettings.description": "编辑所有集合类型的默认配置",
104
+ "containers.SettingsPage.Block.generalSettings.title": "总览",
105
+ "containers.SettingsPage.pluginHeaderDescription": "编辑所有集合类型和组的配置",
106
+ "containers.SettingsView.list.subtitle": "编辑所有集合类型和组的布局和展示配置",
107
+ "containers.SettingsView.list.title": "展示设置",
108
+ "emptyAttributes.button": "跳转到集合类型编辑器",
109
+ "emptyAttributes.description": "为该集合类型添加第一个字段",
110
+ "emptyAttributes.title": "还没有字段",
111
+ "error.attribute.key.taken": "该值已存在",
112
+ "error.attribute.sameKeyAndName": "不能相等",
113
+ "error.attribute.taken": "该名称已被使用",
114
+ "error.contentTypeName.taken": "该名称已被使用",
115
+ "error.model.fetch": "获取模型配置时发生错误",
116
+ "error.record.create": "创建记录时发生错误",
117
+ "error.record.delete": "删除记录时发生错误",
118
+ "error.record.fetch": "获取记录时发生错误。",
119
+ "error.record.update": "更新记录时发生错误",
120
+ "error.records.count": "获取计数记录期间发生错误。",
121
+ "error.records.fetch": "获取记录时发生错误。",
122
+ "error.schema.generation": "Schema 生成过程中发生错误。",
123
+ "error.validation.json": "JSON格式不正确",
124
+ "error.validation.max": "超过最大值",
125
+ "error.validation.maxLength": "长度太长",
126
+ "error.validation.min": "小于最小值",
127
+ "error.validation.minLength": "长度太短",
128
+ "error.validation.minSupMax": "最小值大于最大值。",
129
+ "error.validation.regex": "格式错误",
130
+ "error.validation.required": "必填项",
131
+ "form.Input.bulkActions": "启用批量操作",
132
+ "form.Input.defaultSort": "默认排序设置",
133
+ "form.Input.description": "字段说明",
134
+ "form.Input.description.placeholder": "资料页面中的展示名称",
135
+ "form.Input.editable": "可编辑字段",
136
+ "form.Input.filters": "应用过滤器",
137
+ "form.Input.label": "字段名称",
138
+ "form.Input.label.inputDescription": "这个标签会展示在表格的标题列名称",
139
+ "form.Input.pageEntries": "每页条数",
140
+ "form.Input.pageEntries.inputDescription": "注意:您可以在集合类型设置中覆盖此设定",
141
+ "form.Input.placeholder": "占位符",
142
+ "form.Input.placeholder.placeholder": "在文字框中显示提示信息",
143
+ "form.Input.search": "启用搜索功能",
144
+ "form.Input.search.field": "允许此字段可以被搜索",
145
+ "form.Input.sort.field": "允许此字段可以被排序",
146
+ "form.Input.wysiwyg": "显示为所见即所得模式",
147
+ "global.displayedFields": "展示的字段",
148
+ "groups": "分组",
149
+ "groups.numbered": "分组 ({number})",
150
+ "models": "内容类型",
151
+ "models.numbered": "内容类型 ({number})",
152
+ "notification.error.displayedFields": "至少需要展示一个字段",
153
+ "notification.error.relationship.fetch": "获取关联数据时发生错误",
154
+ "notification.info.SettingPage.disableSort": "您至少需要允许一个字段可以被用來排序",
155
+ "notification.info.minimumFields": "至少需要展示一个字段",
156
+ "notification.upload.error": "上传文件时发生了错误",
157
+ "pageNotFound": "页面未找到",
158
+ "permissions.not-allowed.create": "没有创建文档的权限",
159
+ "permissions.not-allowed.update": "没有查看该文档的权限",
160
+ "plugin.description.long": "快速查看、编辑与删除数据库中的数据。",
161
+ "plugin.description.short": "快速查看、编辑与删除数据库中的数据。",
162
+ "popUpWarning.bodyMessage.contentType.delete": "确定要删除该记录吗?",
163
+ "popUpWarning.bodyMessage.contentType.delete.all": "确定要删除这些内容吗?",
164
+ "popUpWarning.warning.cancelAllSettings": "确定要放弃修改吗?",
165
+ "popUpWarning.warning.publish-question": "是否仍要进行发布?",
166
+ "popUpWarning.warning.unpublish": "取消发布后状态将直接变更为:草稿",
167
+ "popUpWarning.warning.unpublish-question": "您确定要取消发布吗?",
168
+ "popUpWarning.warning.updateAllSettings": "这将会改动您已有的设置",
169
+ "popUpwarning.warning.has-draft-relations.button-confirm": "是的,发布",
170
+ "popUpwarning.warning.has-draft-relations.message.plural": "<b>有 {count} 个关联的内容尚未发布,</b><br></br>这可能会在正式项目中产生错误和无效链接。",
171
+ "popUpwarning.warning.has-draft-relations.message.singular": "<b>有 {count} 个关联的内容尚未发布,</b><br></br>这可能会在正式项目中产生错误和无效链接。",
172
+ "popUpwarning.warning.has-draft-relations.second-message": "这可能会在正式项目中产生错误和无效链接。",
173
+ "success.record.delete": "删除成功",
174
+ "success.record.publish": "发布成功",
175
+ "success.record.save": "保存成功",
176
+ "success.record.unpublish": "取消发布成功"
177
+ }
@@ -0,0 +1,94 @@
1
+ {
2
+ "EditRelations.title": "關聯式資料",
3
+ "components.AddFilterCTA.add": "過濾器",
4
+ "components.AddFilterCTA.hide": "過濾器",
5
+ "components.DraggableAttr.edit": "點擊以編輯",
6
+ "components.EmptyAttributesBlock.button": "前往設定頁面",
7
+ "components.EmptyAttributesBlock.description": "您可以變更設定",
8
+ "components.FilterOptions.button.apply": "套用",
9
+ "components.FiltersPickWrapper.PluginHeader.actions.apply": "套用",
10
+ "components.FiltersPickWrapper.PluginHeader.actions.clearAll": "清除",
11
+ "components.FiltersPickWrapper.PluginHeader.description": "設定過濾資料的條件",
12
+ "components.FiltersPickWrapper.PluginHeader.title.filter": "過濾器",
13
+ "components.FiltersPickWrapper.hide": "隱藏",
14
+ "components.LimitSelect.itemsPerPage": "每個頁面檔案數量",
15
+ "components.Search.placeholder": "搜尋...",
16
+ "components.TableDelete.delete": "刪除",
17
+ "components.TableDelete.deleteSelected": "删除所选",
18
+ "components.TableDelete.entries.plural": "已選取 {number} 個項目",
19
+ "components.TableDelete.entries.singular": "已選取 {number} 個項目",
20
+ "components.TableEmpty.withFilters": "找不到 {contentType} 依照套用的過濾器...",
21
+ "components.TableEmpty.withSearch": "找不到 {contentType} 依照搜尋條件: ({search})...",
22
+ "components.TableEmpty.withoutFilter": "找不到 {contentType}...",
23
+ "containers.Edit.addAnItem": "新增關聯...",
24
+ "containers.Edit.clickToJump": "跳轉到該筆資料",
25
+ "containers.Edit.delete": "刪除",
26
+ "containers.Edit.editing": "編輯中...",
27
+ "containers.Edit.reset": "重設",
28
+ "containers.Edit.returnList": "回到清單",
29
+ "containers.Edit.seeDetails": "詳細資料",
30
+ "containers.Edit.submit": "儲存",
31
+ "containers.Home.introduction": "這個擴充功能還在開發階段,如果要編輯項目,請前往左邊選單中對應的連結",
32
+ "containers.Home.pluginHeaderDescription": "透過強大的介面來管理您的項目",
33
+ "containers.Home.pluginHeaderTitle": "內容管理員",
34
+ "containers.List.addAnEntry": "建立新的 {entity}",
35
+ "containers.List.errorFetchRecords": "錯誤",
36
+ "containers.List.pluginHeaderDescription": "找到 {label} 筆資料",
37
+ "containers.List.pluginHeaderDescription.singular": "找到 {label} 筆資料",
38
+ "containers.ListPage.displayedFields": "顯示欄位",
39
+ "containers.SettingPage.attributes": "屬性",
40
+ "containers.SettingPage.attributes.description": "調整欄位的順序",
41
+ "containers.SettingPage.editSettings.description": "拖曳欄位以規劃排版",
42
+ "containers.SettingPage.editSettings.title": "編輯 (設定)",
43
+ "containers.SettingPage.listSettings.title": "列表 (設定)",
44
+ "containers.SettingPage.relations": "關聯欄位",
45
+ "containers.SettingsPage.Block.contentType.description": "調整指定資料類型的選項",
46
+ "containers.SettingsPage.Block.generalSettings.title": "總覽",
47
+ "emptyAttributes.title": "目前還沒有欄位",
48
+ "error.attribute.key.taken": "這個數值已存在",
49
+ "error.attribute.sameKeyAndName": "不能等於",
50
+ "error.attribute.taken": "這個欄位名稱已存在",
51
+ "error.contentTypeName.taken": "這個名稱已存在",
52
+ "error.model.fetch": "讀取資料結構設定時發生錯誤",
53
+ "error.record.create": "增加資料時發生錯誤",
54
+ "error.record.delete": "刪除資料時發生錯誤",
55
+ "error.record.fetch": "讀取資料時發生錯誤",
56
+ "error.record.update": "更新資料時發生錯誤",
57
+ "error.records.count": "讀取資料數量時發生錯誤",
58
+ "error.records.fetch": "讀取資料時發生錯誤",
59
+ "error.schema.generation": "產生資料結構時發生錯誤",
60
+ "error.validation.json": "非法的JSON格式",
61
+ "error.validation.max": "數值過高",
62
+ "error.validation.maxLength": "長度過長",
63
+ "error.validation.min": "數值過低",
64
+ "error.validation.minLength": "長度不足",
65
+ "error.validation.minSupMax": "不能高於最大值",
66
+ "error.validation.regex": "此欄位無法與正規表達式批配",
67
+ "error.validation.required": "必填欄位",
68
+ "form.Input.bulkActions": "啟用批次操作",
69
+ "form.Input.defaultSort": "預設排序設定",
70
+ "form.Input.description": "說明",
71
+ "form.Input.description.placeholder": "描述這個欄位",
72
+ "form.Input.editable": "可編輯欄位",
73
+ "form.Input.filters": "啟用過濾器",
74
+ "form.Input.label": "標籤",
75
+ "form.Input.label.inputDescription": "這個數值會顯示在表格的標題列名稱",
76
+ "form.Input.pageEntries": "每頁項目",
77
+ "form.Input.placeholder": "佔位符",
78
+ "form.Input.placeholder.placeholder": "在文字框中顯示提示訊息",
79
+ "form.Input.search": "啟用搜尋功能",
80
+ "form.Input.search.field": "允許此欄位被搜尋",
81
+ "form.Input.sort.field": "允許以此欄位排序",
82
+ "notification.error.displayedFields": "您至少需要顯示一個欄位",
83
+ "notification.error.relationship.fetch": "讀取關聯資料時發生錯誤",
84
+ "notification.info.SettingPage.disableSort": "您至少需要允許一個欄位被用來排序",
85
+ "pageNotFound": "無法找到此頁面",
86
+ "plugin.description.long": "快速瀏覽、編輯、刪除資料庫的資料",
87
+ "plugin.description.short": "快速瀏覽、編輯、刪除資料庫的資料",
88
+ "popUpWarning.bodyMessage.contentType.delete": "您確定要刪除這筆資料嗎?",
89
+ "popUpWarning.bodyMessage.contentType.delete.all": "您確定要刪除這些資料嗎?",
90
+ "popUpWarning.warning.cancelAllSettings": "您確定要放棄變更?",
91
+ "popUpWarning.warning.updateAllSettings": "這會更動您的設定",
92
+ "success.record.delete": "已刪除",
93
+ "success.record.save": "已儲存"
94
+ }
@@ -0,0 +1,7 @@
1
+ export default {
2
+ COMPONENT: 'component',
3
+ EDIT_FIELD: 'editField',
4
+ EDIT_RELATION: 'editRelation',
5
+ FIELD: 'field',
6
+ RELATION: 'relation',
7
+ };
@@ -0,0 +1,13 @@
1
+ import { toLower } from 'lodash';
2
+
3
+ const checkIfAttributeIsDisplayable = attribute => {
4
+ const type = attribute.type;
5
+
6
+ if (type === 'relation') {
7
+ return !toLower(attribute.relationType).includes('morph');
8
+ }
9
+
10
+ return !['json', 'component', 'dynamiczone', 'richtext'].includes(type) && !!type;
11
+ };
12
+
13
+ export default checkIfAttributeIsDisplayable;
@@ -0,0 +1,50 @@
1
+ import { get } from 'lodash';
2
+
3
+ const createDefaultForm = (attributes, allComponentsSchema) => {
4
+ return Object.keys(attributes).reduce((acc, current) => {
5
+ const attribute = get(attributes, [current], {});
6
+ const { default: defaultValue, component, type, required, min, repeatable } = attribute;
7
+
8
+ if (type === 'json') {
9
+ acc[current] = null;
10
+ }
11
+
12
+ if (type === 'json' && required === true) {
13
+ acc[current] = {};
14
+ }
15
+
16
+ if (defaultValue !== undefined) {
17
+ acc[current] = defaultValue;
18
+ }
19
+
20
+ if (type === 'component') {
21
+ const currentComponentSchema = get(allComponentsSchema, [component, 'attributes'], {});
22
+ const currentComponentDefaultForm = createDefaultForm(
23
+ currentComponentSchema,
24
+ allComponentsSchema
25
+ );
26
+
27
+ if (required === true) {
28
+ acc[current] = repeatable === true ? [] : currentComponentDefaultForm;
29
+ }
30
+
31
+ if (min && repeatable === true && required) {
32
+ acc[current] = [];
33
+
34
+ for (let i = 0; i < min; i += 1) {
35
+ acc[current].push(currentComponentDefaultForm);
36
+ }
37
+ }
38
+ }
39
+
40
+ if (type === 'dynamiczone') {
41
+ if (required === true) {
42
+ acc[current] = [];
43
+ }
44
+ }
45
+
46
+ return acc;
47
+ }, {});
48
+ };
49
+
50
+ export default createDefaultForm;
@@ -0,0 +1,18 @@
1
+ // NOTE TO PLUGINS DEVELOPERS:
2
+ // If you modify this file you need to update the documentation accordingly
3
+ // Here's the file: strapi/docs/3.0.0-beta.x/guides/custom-admin.md#update-the-content-manager
4
+ // Also the strapi-generate-plugins/files/admin/src/index.js needs to be updated
5
+ // IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
6
+
7
+ import { dateFormats as defaultDateFormats } from 'strapi-helper-plugin';
8
+
9
+ const dateFormats = {
10
+ ...defaultDateFormats,
11
+ // Customise the format by uncommenting the one you wan to override it corresponds to the type of your field
12
+ // date: 'dddd, MMMM Do YYYY',
13
+ // datetime: 'dddd, MMMM Do YYYY HH:mm',
14
+ // time: 'HH:mm A',
15
+ // timestamp: 'dddd, MMMM Do YYYY HH:mm',
16
+ };
17
+
18
+ export default dateFormats;
@@ -0,0 +1,55 @@
1
+ // List of all the possible filters
2
+ const VALID_REST_OPERATORS = [
3
+ 'eq',
4
+ 'ne',
5
+ 'in',
6
+ 'nin',
7
+ 'contains',
8
+ 'ncontains',
9
+ 'containss',
10
+ 'ncontainss',
11
+ 'lt',
12
+ 'lte',
13
+ 'gt',
14
+ 'gte',
15
+ 'null',
16
+ ];
17
+
18
+ // from strapi-utils/convert-rest-query-params
19
+ const findAppliedFilter = whereClause => {
20
+ // Useful to remove the mainField of relation fields.
21
+ const formattedWhereClause = whereClause.split('.')[0];
22
+ const separatorIndex = whereClause.lastIndexOf('_');
23
+
24
+ if (separatorIndex === -1) {
25
+ return { operator: '=', field: formattedWhereClause };
26
+ }
27
+
28
+ const fieldName = formattedWhereClause.substring(0, separatorIndex);
29
+ const operator = whereClause.slice(separatorIndex + 1);
30
+
31
+ // the field as underscores
32
+ if (!VALID_REST_OPERATORS.includes(operator)) {
33
+ return { operator: '=', field: formattedWhereClause };
34
+ }
35
+
36
+ return { operator: `_${operator}`, field: fieldName };
37
+ };
38
+
39
+ const formatFiltersFromQuery = ({ _where }) => {
40
+ if (!_where) {
41
+ return [];
42
+ }
43
+
44
+ return _where.map(obj => {
45
+ const [key] = Object.keys(obj);
46
+ const { field, operator } = findAppliedFilter(key);
47
+
48
+ const value = obj[key];
49
+
50
+ return { name: field, filter: operator, value };
51
+ });
52
+ };
53
+
54
+ export default formatFiltersFromQuery;
55
+ export { findAppliedFilter };
@@ -0,0 +1,27 @@
1
+ import { get } from 'lodash';
2
+
3
+ const formatFilterName = (name, metadatas) => {
4
+ const mainField = get(metadatas, [name, 'list', 'mainField', 'name'], null);
5
+
6
+ if (mainField) {
7
+ return `${name}.${mainField}`;
8
+ }
9
+
10
+ return name;
11
+ };
12
+
13
+ const formatFiltersToQuery = (array, metadatas) => {
14
+ const nextFilters = array.map(({ name, filter, value }) => {
15
+ const formattedName = formatFilterName(name, metadatas);
16
+
17
+ if (filter === '=') {
18
+ return { [formattedName]: value };
19
+ }
20
+
21
+ return { [`${formattedName}${filter}`]: value };
22
+ });
23
+
24
+ return { _where: nextFilters };
25
+ };
26
+
27
+ export default formatFiltersToQuery;
@@ -0,0 +1,44 @@
1
+ import { omit, get } from 'lodash';
2
+
3
+ const formatLayoutToApi = ({ layouts, metadatas, ...rest }) => {
4
+ const list = layouts.list.map(obj => {
5
+ if (obj.name) {
6
+ return obj.name;
7
+ }
8
+
9
+ return obj;
10
+ });
11
+ const editRelations = layouts.editRelations.map(({ name }) => name);
12
+
13
+ const formattedMetadatas = Object.keys(metadatas).reduce((acc, current) => {
14
+ const currentMetadatas = get(metadatas, [current], {});
15
+ let editMetadatas = currentMetadatas.edit;
16
+
17
+ if (editMetadatas.mainField) {
18
+ editMetadatas = { ...editMetadatas, mainField: currentMetadatas.edit.mainField.name };
19
+ }
20
+
21
+ return {
22
+ ...acc,
23
+ [current]: {
24
+ edit: editMetadatas,
25
+ list: omit(currentMetadatas.list, ['mainField']),
26
+ },
27
+ };
28
+ }, {});
29
+
30
+ const edit = layouts.edit.map(row =>
31
+ row.map(({ name, size }) => ({
32
+ name,
33
+ size,
34
+ }))
35
+ );
36
+
37
+ return {
38
+ ...rest,
39
+ layouts: { edit, editRelations, list },
40
+ metadatas: formattedMetadatas,
41
+ };
42
+ };
43
+
44
+ export default formatLayoutToApi;
@@ -0,0 +1,20 @@
1
+ const addSubjectToPermissionsArray = (array, uid) => array.map(data => ({ ...data, subject: uid }));
2
+
3
+ const generatePermissionsObject = uid => {
4
+ const permissions = {
5
+ create: [{ action: 'plugins::content-manager.explorer.create', subject: null }],
6
+ delete: [{ action: 'plugins::content-manager.explorer.delete', subject: null }],
7
+ publish: [{ action: 'plugins::content-manager.explorer.publish', subject: null }],
8
+ read: [{ action: 'plugins::content-manager.explorer.read', subject: null }],
9
+ update: [{ action: 'plugins::content-manager.explorer.update', subject: null }],
10
+ };
11
+
12
+ return Object.keys(permissions).reduce((acc, current) => {
13
+ acc[current] = addSubjectToPermissionsArray(permissions[current], uid);
14
+
15
+ return acc;
16
+ }, {});
17
+ };
18
+
19
+ export default generatePermissionsObject;
20
+ export { addSubjectToPermissionsArray };
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { get } from 'lodash';
3
+ import pluginId from '../pluginId';
4
+
5
+ /**
6
+ * Retrieve external links from injected components
7
+ * @type {Array} List of external links to display
8
+ */
9
+ const getInjectedComponents = (
10
+ container,
11
+ area,
12
+ plugins,
13
+ currentEnvironment,
14
+ slug,
15
+ push,
16
+ ...rest
17
+ ) => {
18
+ const componentsToInject = Object.keys(plugins).reduce((acc, current) => {
19
+ // Retrieve injected compos from plugin
20
+ const currentPlugin = plugins[current];
21
+ const injectedComponents = get(currentPlugin, 'injectedComponents', []);
22
+
23
+ const compos = injectedComponents
24
+ .filter(compo => {
25
+ return (
26
+ compo.plugin === `${pluginId}.${container}` && compo.area === area
27
+ );
28
+ })
29
+ .map(compo => {
30
+ const Component = compo.component;
31
+
32
+ return (
33
+ <Component
34
+ viewProps={rest}
35
+ currentEnvironment={currentEnvironment}
36
+ getModelName={() => slug}
37
+ push={push}
38
+ {...compo.props}
39
+ key={compo.key}
40
+ />
41
+ );
42
+ });
43
+
44
+ return [...acc, ...compos];
45
+ }, []);
46
+
47
+ return componentsToInject;
48
+ };
49
+
50
+ export default getInjectedComponents;
@@ -0,0 +1,61 @@
1
+ import { isEmpty, isNull, isObject, toLower, toString } from 'lodash';
2
+ import moment from 'moment';
3
+ import dateFormats from './dateFormats';
4
+
5
+ const getDisplayedValue = (type, value, name) => {
6
+ switch (toLower(type)) {
7
+ case 'string':
8
+ case 'text':
9
+ case 'email':
10
+ case 'enumeration':
11
+ case 'uid':
12
+ return (value && !isEmpty(toString(value))) || name === 'id' ? toString(value) : '-';
13
+ case 'float':
14
+ case 'integer':
15
+ case 'biginteger':
16
+ case 'decimal':
17
+ return !isNull(value) ? toString(value) : '-';
18
+ case 'boolean':
19
+ return value !== null ? toString(value) : '-';
20
+ case 'date':
21
+ case 'datetime':
22
+ case 'timestamp': {
23
+ if (value == null) {
24
+ return '-';
25
+ }
26
+
27
+ const date =
28
+ value && isObject(value) && value._isAMomentObject === true ? JSON.stringify(value) : value;
29
+
30
+ return moment(date).format(dateFormats[type]);
31
+ }
32
+ case 'password':
33
+ return '••••••••';
34
+ case 'media':
35
+ case 'file':
36
+ case 'files':
37
+ return value;
38
+ case 'time': {
39
+ if (!value) {
40
+ return '-';
41
+ }
42
+
43
+ const [hour, minute, second] = value.split(':');
44
+ const timeObj = {
45
+ hour,
46
+ minute,
47
+ second,
48
+ };
49
+ const date = moment().set(timeObj);
50
+
51
+ return date.format(dateFormats.time);
52
+ }
53
+ case 'relation': {
54
+ return value;
55
+ }
56
+ default:
57
+ return '-';
58
+ }
59
+ };
60
+
61
+ export default getDisplayedValue;
@@ -0,0 +1,6 @@
1
+ import { isNaN } from 'lodash';
2
+
3
+ const getFieldName = stringName =>
4
+ stringName.split('.').filter(string => isNaN(parseInt(string, 10)));
5
+
6
+ export default getFieldName;
@@ -0,0 +1,12 @@
1
+ const getMaxTempKey = arr => {
2
+ if (arr.length === 0) {
3
+ return -1;
4
+ }
5
+
6
+ return Math.max.apply(
7
+ Math,
8
+ arr.map(o => o.__temp_key__)
9
+ );
10
+ };
11
+
12
+ export default getMaxTempKey;
@@ -0,0 +1,5 @@
1
+ import pluginId from '../pluginId';
2
+
3
+ const getRequestUrl = path => `/${pluginId}/${path}`;
4
+
5
+ export default getRequestUrl;
@@ -0,0 +1,5 @@
1
+ import pluginId from '../pluginId';
2
+
3
+ const getTrad = id => `${pluginId}.${id}`;
4
+
5
+ export default getTrad;