@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.
- package/LICENSE +22 -0
- package/README.md +27 -0
- package/admin/src/InjectedComponents/ContentTypeBuilder/ConfigureViewButton/index.js +78 -0
- package/admin/src/assets/images/background_input.svg +1 -0
- package/admin/src/assets/images/icon-cross-blue.svg +1 -0
- package/admin/src/assets/images/icon_remove.svg +19 -0
- package/admin/src/assets/images/logo.svg +1 -0
- package/admin/src/components/AddDropdown/components.js +113 -0
- package/admin/src/components/AddDropdown/index.js +76 -0
- package/admin/src/components/Block/components.js +28 -0
- package/admin/src/components/Block/index.js +45 -0
- package/admin/src/components/ComponentInitializer/P.js +9 -0
- package/admin/src/components/ComponentInitializer/index.js +43 -0
- package/admin/src/components/Container/index.js +7 -0
- package/admin/src/components/CustomInputCheckbox/components.js +77 -0
- package/admin/src/components/CustomInputCheckbox/index.js +53 -0
- package/admin/src/components/CustomTable/ActionCollapse/Delete.js +14 -0
- package/admin/src/components/CustomTable/ActionCollapse/DeleteAll.js +18 -0
- package/admin/src/components/CustomTable/ActionCollapse/Wrapper.js +20 -0
- package/admin/src/components/CustomTable/ActionCollapse/index.js +38 -0
- package/admin/src/components/CustomTable/Headers/Header.js +59 -0
- package/admin/src/components/CustomTable/Headers/Thead.js +35 -0
- package/admin/src/components/CustomTable/Headers/index.js +46 -0
- package/admin/src/components/CustomTable/Row/ActionContainer.js +19 -0
- package/admin/src/components/CustomTable/Row/Cell.js +55 -0
- package/admin/src/components/CustomTable/Row/index.js +112 -0
- package/admin/src/components/CustomTable/index.js +162 -0
- package/admin/src/components/CustomTable/styledComponents.js +85 -0
- package/admin/src/components/DragLayer/index.js +102 -0
- package/admin/src/components/DraggedField/Close/index.js +10 -0
- package/admin/src/components/DraggedField/GrabWrapper.js +38 -0
- package/admin/src/components/DraggedField/Link.js +17 -0
- package/admin/src/components/DraggedField/NameWrapper.js +29 -0
- package/admin/src/components/DraggedField/RemoveWrapper.js +32 -0
- package/admin/src/components/DraggedField/SubWrapper.js +36 -0
- package/admin/src/components/DraggedField/Wrapper.js +134 -0
- package/admin/src/components/DraggedField/index.js +196 -0
- package/admin/src/components/DraggedField/utils/getColor.js +12 -0
- package/admin/src/components/DraggedField/utils/getHeight.js +3 -0
- package/admin/src/components/DraggedFieldWithPreview/Carret.js +24 -0
- package/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +70 -0
- package/admin/src/components/DraggedFieldWithPreview/DynamicZoneWrapper.js +10 -0
- package/admin/src/components/DraggedFieldWithPreview/Tooltip.js +19 -0
- package/admin/src/components/DraggedFieldWithPreview/Wrapper.js +24 -0
- package/admin/src/components/DraggedFieldWithPreview/index.js +194 -0
- package/admin/src/components/DynamicComponentCard/Wrapper.js +63 -0
- package/admin/src/components/DynamicComponentCard/index.js +49 -0
- package/admin/src/components/DynamicZone/BaselineAlignement.js +11 -0
- package/admin/src/components/DynamicZone/Button.js +31 -0
- package/admin/src/components/DynamicZone/Component/RoundCTA.js +45 -0
- package/admin/src/components/DynamicZone/Component/index.js +79 -0
- package/admin/src/components/DynamicZone/ComponentWrapper.js +44 -0
- package/admin/src/components/DynamicZone/DynamicZoneWrapper.js +12 -0
- package/admin/src/components/DynamicZone/Label.js +42 -0
- package/admin/src/components/DynamicZone/Picker/Category/Banner/Wrapper.js +78 -0
- package/admin/src/components/DynamicZone/Picker/Category/Banner/index.js +33 -0
- package/admin/src/components/DynamicZone/Picker/Category/index.js +53 -0
- package/admin/src/components/DynamicZone/Picker/Wrapper.js +32 -0
- package/admin/src/components/DynamicZone/Picker/index.js +88 -0
- package/admin/src/components/DynamicZone/Wrapper.js +34 -0
- package/admin/src/components/DynamicZone/index.js +238 -0
- package/admin/src/components/DynamicZone/utils/connect.js +12 -0
- package/admin/src/components/DynamicZone/utils/select.js +49 -0
- package/admin/src/components/FieldComponent/ComponentIcon.js +44 -0
- package/admin/src/components/FieldComponent/EmptyComponent.js +19 -0
- package/admin/src/components/FieldComponent/Label.js +10 -0
- package/admin/src/components/FieldComponent/ResetComponent.js +41 -0
- package/admin/src/components/FieldComponent/Wrapper.js +18 -0
- package/admin/src/components/FieldComponent/index.js +171 -0
- package/admin/src/components/FieldComponent/utils/connect.js +12 -0
- package/admin/src/components/FieldComponent/utils/select.js +123 -0
- package/admin/src/components/FieldsReorder/Item.js +249 -0
- package/admin/src/components/FieldsReorder/components.js +8 -0
- package/admin/src/components/FieldsReorder/index.js +102 -0
- package/admin/src/components/FilterOptionsCTA/index.js +14 -0
- package/admin/src/components/FilterPicker/components.js +56 -0
- package/admin/src/components/FilterPicker/index.js +258 -0
- package/admin/src/components/FilterPicker/init.js +25 -0
- package/admin/src/components/FilterPicker/reducer.js +58 -0
- package/admin/src/components/FilterPickerOption/Input.js +58 -0
- package/admin/src/components/FilterPickerOption/Option.js +18 -0
- package/admin/src/components/FilterPickerOption/components.js +60 -0
- package/admin/src/components/FilterPickerOption/index.js +101 -0
- package/admin/src/components/FormTitle/index.js +26 -0
- package/admin/src/components/FormWrapper/index.js +20 -0
- package/admin/src/components/InputJSON/components.js +30 -0
- package/admin/src/components/InputJSON/index.js +184 -0
- package/admin/src/components/InputJSON/jsonlint.js +424 -0
- package/admin/src/components/InputJSONWithErrors/Wrapper.js +32 -0
- package/admin/src/components/InputJSONWithErrors/index.js +168 -0
- package/admin/src/components/InputUID/InputUID.js +26 -0
- package/admin/src/components/InputUID/Options/Option.js +22 -0
- package/admin/src/components/InputUID/Options/OptionsTitle.js +12 -0
- package/admin/src/components/InputUID/Options/RightOptionLabel.js +10 -0
- package/admin/src/components/InputUID/Options/index.js +34 -0
- package/admin/src/components/InputUID/Options/wrapper.js +13 -0
- package/admin/src/components/InputUID/RegenerateButton.js +18 -0
- package/admin/src/components/InputUID/RightContent.js +14 -0
- package/admin/src/components/InputUID/RightContentLabel.js +10 -0
- package/admin/src/components/InputUID/RightLabel.js +42 -0
- package/admin/src/components/InputUID/SubLabel.js +9 -0
- package/admin/src/components/InputUID/Wrapper.js +8 -0
- package/admin/src/components/InputUID/index.js +325 -0
- package/admin/src/components/InputUID/regex.js +3 -0
- package/admin/src/components/Inputs/index.js +283 -0
- package/admin/src/components/Inputs/utils/VALIDATIONS_TO_OMIT.js +12 -0
- package/admin/src/components/Inputs/utils/connect.js +12 -0
- package/admin/src/components/Inputs/utils/generateOptions.js +19 -0
- package/admin/src/components/Inputs/utils/getInputType.js +44 -0
- package/admin/src/components/Inputs/utils/getStep.js +15 -0
- package/admin/src/components/Inputs/utils/index.js +6 -0
- package/admin/src/components/Inputs/utils/select.js +38 -0
- package/admin/src/components/LayoutTitle/index.js +19 -0
- package/admin/src/components/MediaPreviewList/StyledMediaPreviewList.js +171 -0
- package/admin/src/components/MediaPreviewList/index.js +110 -0
- package/admin/src/components/NonRepeatableComponent/index.js +73 -0
- package/admin/src/components/NonRepeatableWrapper/index.js +73 -0
- package/admin/src/components/PlusButton/index.js +52 -0
- package/admin/src/components/PopupForm/index.js +93 -0
- package/admin/src/components/PreviewCarret/components.js +27 -0
- package/admin/src/components/PreviewCarret/index.js +22 -0
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +133 -0
- package/admin/src/components/PreviewWysiwyg/index.js +34 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.js +72 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +16 -0
- package/admin/src/components/RelationPreviewList/CountWrapper.js +7 -0
- package/admin/src/components/RelationPreviewList/RelationPreviewTooltip.js +117 -0
- package/admin/src/components/RelationPreviewList/index.js +111 -0
- package/admin/src/components/RepeatableComponent/AddFieldButton.js +64 -0
- package/admin/src/components/RepeatableComponent/Banner.js +112 -0
- package/admin/src/components/RepeatableComponent/BannerWrapper.js +194 -0
- package/admin/src/components/RepeatableComponent/CarretTop.js +14 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/index.js +245 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/connect.js +11 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/index.js +2 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/select.js +30 -0
- package/admin/src/components/RepeatableComponent/EmptyComponent.js +27 -0
- package/admin/src/components/RepeatableComponent/FormWrapper.js +27 -0
- package/admin/src/components/RepeatableComponent/index.js +187 -0
- package/admin/src/components/RepeatableComponent/reducer.js +73 -0
- package/admin/src/components/RepeatableComponent/utils/connect.js +11 -0
- package/admin/src/components/RepeatableComponent/utils/select.js +12 -0
- package/admin/src/components/Search/index.js +88 -0
- package/admin/src/components/SectionTitle/Title.js +11 -0
- package/admin/src/components/SectionTitle/index.js +29 -0
- package/admin/src/components/SelectMany/ListItem.js +107 -0
- package/admin/src/components/SelectMany/Relation.js +106 -0
- package/admin/src/components/SelectMany/components.js +153 -0
- package/admin/src/components/SelectMany/index.js +159 -0
- package/admin/src/components/SelectOne/SingleValue.js +58 -0
- package/admin/src/components/SelectOne/index.js +71 -0
- package/admin/src/components/SelectWrapper/ClearIndicator.js +15 -0
- package/admin/src/components/SelectWrapper/IndicatorSeparator.js +3 -0
- package/admin/src/components/SelectWrapper/Option.js +76 -0
- package/admin/src/components/SelectWrapper/components.js +14 -0
- package/admin/src/components/SelectWrapper/index.js +393 -0
- package/admin/src/components/SelectWrapper/utils/connect.js +12 -0
- package/admin/src/components/SelectWrapper/utils/index.js +3 -0
- package/admin/src/components/SelectWrapper/utils/select.js +45 -0
- package/admin/src/components/SelectWrapper/utils/styles.js +105 -0
- package/admin/src/components/Separator/index.js +9 -0
- package/admin/src/components/SettingFormWrapper/index.js +9 -0
- package/admin/src/components/SettingsViewWrapper/index.js +283 -0
- package/admin/src/components/SortWrapper/index.js +9 -0
- package/admin/src/components/SortableList/Item.js +126 -0
- package/admin/src/components/SortableList/index.js +60 -0
- package/admin/src/components/State/Wrapper.js +30 -0
- package/admin/src/components/State/index.js +26 -0
- package/admin/src/components/Truncate/index.js +5 -0
- package/admin/src/components/Truncated/index.js +10 -0
- package/admin/src/components/Wysiwyg/EditorWrapper.js +122 -0
- package/admin/src/components/Wysiwyg/MediaLib.js +71 -0
- package/admin/src/components/Wysiwyg/PreviewControlWrapper.js +30 -0
- package/admin/src/components/Wysiwyg/SelectWrapper.js +24 -0
- package/admin/src/components/Wysiwyg/ToggleModeWrapper.js +30 -0
- package/admin/src/components/Wysiwyg/constants.js +98 -0
- package/admin/src/components/Wysiwyg/customSelect.js +39 -0
- package/admin/src/components/Wysiwyg/helpers.js +116 -0
- package/admin/src/components/Wysiwyg/index.js +819 -0
- package/admin/src/components/Wysiwyg/previewControl.js +29 -0
- package/admin/src/components/Wysiwyg/toggleMode.js +44 -0
- package/admin/src/components/Wysiwyg/utils.js +70 -0
- package/admin/src/components/WysiwygBottomControls/components.js +44 -0
- package/admin/src/components/WysiwygBottomControls/index.js +33 -0
- package/admin/src/components/WysiwygDropUpload/Label.js +16 -0
- package/admin/src/components/WysiwygDropUpload/index.js +18 -0
- package/admin/src/components/WysiwygEditor/index.js +26 -0
- package/admin/src/components/WysiwygInlineControls/Button.js +77 -0
- package/admin/src/components/WysiwygInlineControls/StyledButton.js +54 -0
- package/admin/src/components/WysiwygInlineControls/Wrapper.js +25 -0
- package/admin/src/components/WysiwygInlineControls/index.js +66 -0
- package/admin/src/components/WysiwygWithErrors/Wrapper.js +38 -0
- package/admin/src/components/WysiwygWithErrors/index.js +158 -0
- package/admin/src/containers/CollectionTypeFormWrapper/index.js +376 -0
- package/admin/src/containers/CollectionTypeFormWrapper/utils/getRequestUrl.js +5 -0
- package/admin/src/containers/CollectionTypeFormWrapper/utils/index.js +2 -0
- package/admin/src/containers/CollectionTypeRecursivePath/index.js +125 -0
- package/admin/src/containers/ComponentSetttingsView/index.js +55 -0
- package/admin/src/containers/EditSettingsView/index.js +408 -0
- package/admin/src/containers/EditSettingsView/init.js +18 -0
- package/admin/src/containers/EditSettingsView/reducer.js +126 -0
- package/admin/src/containers/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +26 -0
- package/admin/src/containers/EditSettingsView/utils/getInputProps.js +30 -0
- package/admin/src/containers/EditSettingsView/utils/index.js +2 -0
- package/admin/src/containers/EditSettingsView/utils/layout.js +98 -0
- package/admin/src/containers/EditView/DeleteLink/index.js +94 -0
- package/admin/src/containers/EditView/DeleteLink/utils/connect.js +12 -0
- package/admin/src/containers/EditView/DeleteLink/utils/index.js +2 -0
- package/admin/src/containers/EditView/DeleteLink/utils/select.js +21 -0
- package/admin/src/containers/EditView/Header/index.js +258 -0
- package/admin/src/containers/EditView/Header/utils/connect.js +12 -0
- package/admin/src/containers/EditView/Header/utils/getDraftRelations.js +62 -0
- package/admin/src/containers/EditView/Header/utils/index.js +3 -0
- package/admin/src/containers/EditView/Header/utils/select.js +31 -0
- package/admin/src/containers/EditView/InformationCard.js +100 -0
- package/admin/src/containers/EditView/components.js +74 -0
- package/admin/src/containers/EditView/index.js +297 -0
- package/admin/src/containers/EditView/utils/createAttributesLayout.js +39 -0
- package/admin/src/containers/EditView/utils/getFieldsActionMatchingPermissions.js +23 -0
- package/admin/src/containers/EditView/utils/index.js +3 -0
- package/admin/src/containers/EditViewDataManagerProvider/index.js +519 -0
- package/admin/src/containers/EditViewDataManagerProvider/reducer.js +218 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/cleanData.js +88 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/getYupInnerErrors.js +17 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/index.js +3 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +368 -0
- package/admin/src/containers/EditViewLayoutManager/Permissions.js +30 -0
- package/admin/src/containers/EditViewLayoutManager/actions.js +9 -0
- package/admin/src/containers/EditViewLayoutManager/constants.js +2 -0
- package/admin/src/containers/EditViewLayoutManager/index.js +44 -0
- package/admin/src/containers/EditViewLayoutManager/reducer.js +30 -0
- package/admin/src/containers/EditViewLayoutManager/selectors.js +5 -0
- package/admin/src/containers/LayoutDndProvider/index.js +75 -0
- package/admin/src/containers/ListSettingsView/DragWrapper.js +21 -0
- package/admin/src/containers/ListSettingsView/DropdownButton.js +8 -0
- package/admin/src/containers/ListSettingsView/Label.js +91 -0
- package/admin/src/containers/ListSettingsView/MenuDropdown.js +41 -0
- package/admin/src/containers/ListSettingsView/Toggle.js +51 -0
- package/admin/src/containers/ListSettingsView/forms.json +64 -0
- package/admin/src/containers/ListSettingsView/index.js +298 -0
- package/admin/src/containers/ListSettingsView/init.js +11 -0
- package/admin/src/containers/ListSettingsView/reducer.js +77 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/StyledLink.js +28 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/Wrapper.js +8 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/index.js +29 -0
- package/admin/src/containers/ListView/FieldPicker/Field/Wrapper.js +15 -0
- package/admin/src/containers/ListView/FieldPicker/Field/index.js +24 -0
- package/admin/src/containers/ListView/FieldPicker/Fields/Wrapper.js +18 -0
- package/admin/src/containers/ListView/FieldPicker/Fields/index.js +27 -0
- package/admin/src/containers/ListView/FieldPicker/Header/Reset.js +8 -0
- package/admin/src/containers/ListView/FieldPicker/Header/index.js +42 -0
- package/admin/src/containers/ListView/FieldPicker/Wrapper.js +9 -0
- package/admin/src/containers/ListView/FieldPicker/index.js +46 -0
- package/admin/src/containers/ListView/Filter.js +83 -0
- package/admin/src/containers/ListView/Footer.js +60 -0
- package/admin/src/containers/ListView/actions.js +91 -0
- package/admin/src/containers/ListView/components.js +138 -0
- package/admin/src/containers/ListView/constants.js +16 -0
- package/admin/src/containers/ListView/index.js +573 -0
- package/admin/src/containers/ListView/reducer.js +182 -0
- package/admin/src/containers/ListView/selectors.js +24 -0
- package/admin/src/containers/ListView/utils/buildQueryString.js +26 -0
- package/admin/src/containers/ListView/utils/createPluginsFilter.js +13 -0
- package/admin/src/containers/ListView/utils/getAllAllowedHeaders.js +17 -0
- package/admin/src/containers/ListView/utils/getFirstSortableHeader.js +14 -0
- package/admin/src/containers/ListView/utils/index.js +3 -0
- package/admin/src/containers/ListViewLayoutManager/Permissions.js +29 -0
- package/admin/src/containers/ListViewLayoutManager/index.js +60 -0
- package/admin/src/containers/ListViewProvider/index.js +16 -0
- package/admin/src/containers/Main/actions.js +13 -0
- package/admin/src/containers/Main/constants.js +3 -0
- package/admin/src/containers/Main/index.js +100 -0
- package/admin/src/containers/Main/reducer.js +37 -0
- package/admin/src/containers/Main/selectors.js +20 -0
- package/admin/src/containers/RBACManager/actions.js +14 -0
- package/admin/src/containers/RBACManager/constants.js +2 -0
- package/admin/src/containers/RBACManager/reducer.js +32 -0
- package/admin/src/containers/RBACManager/useSyncRbac.js +28 -0
- package/admin/src/containers/SingleTypeFormWrapper/index.js +317 -0
- package/admin/src/containers/SingleTypeFormWrapper/utils/getRequestUrl.js +5 -0
- package/admin/src/containers/SingleTypeFormWrapper/utils/index.js +2 -0
- package/admin/src/containers/SingleTypeRecursivePath/index.js +84 -0
- package/admin/src/containers/WysiwygProvider/index.js +16 -0
- package/admin/src/contexts/ContentTypeLayout.js +5 -0
- package/admin/src/contexts/LayoutDnd.js +5 -0
- package/admin/src/contexts/ListView.js +5 -0
- package/admin/src/contexts/Wysiwyg.js +5 -0
- package/admin/src/contexts/index.js +4 -0
- package/admin/src/hooks/index.js +6 -0
- package/admin/src/hooks/useContentTypeLayout/index.js +19 -0
- package/admin/src/hooks/useFetchContentTypeLayout/index.js +83 -0
- package/admin/src/hooks/useFetchContentTypeLayout/reducer.js +56 -0
- package/admin/src/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +235 -0
- package/admin/src/hooks/useFindRedirectionLink/index.js +14 -0
- package/admin/src/hooks/useFindRedirectionLink/selectors.js +7 -0
- package/admin/src/hooks/useFindRedirectionLink/utils/getRedirectionLink.js +45 -0
- package/admin/src/hooks/useLayoutDnd.js +6 -0
- package/admin/src/hooks/useListView.js +6 -0
- package/admin/src/hooks/useWysiwyg.js +6 -0
- package/admin/src/icons/Bold/index.js +22 -0
- package/admin/src/icons/Code/index.js +13 -0
- package/admin/src/icons/Cross/index.js +33 -0
- package/admin/src/icons/Italic/index.js +23 -0
- package/admin/src/icons/Link/index.js +21 -0
- package/admin/src/icons/Media/index.js +14 -0
- package/admin/src/icons/Na/index.js +58 -0
- package/admin/src/icons/Ol/index.js +13 -0
- package/admin/src/icons/Quote/index.js +13 -0
- package/admin/src/icons/Striked/index.js +24 -0
- package/admin/src/icons/Ul/index.js +15 -0
- package/admin/src/icons/Underline/index.js +22 -0
- package/admin/src/index.js +52 -0
- package/admin/src/lifecycles.js +19 -0
- package/admin/src/permissions.js +27 -0
- package/admin/src/pluginId.js +5 -0
- package/admin/src/reducers.js +16 -0
- package/admin/src/selectors.js +6 -0
- package/admin/src/sharedReducers/crudReducer/actions.js +44 -0
- package/admin/src/sharedReducers/crudReducer/constants.js +7 -0
- package/admin/src/sharedReducers/crudReducer/reducer.js +75 -0
- package/admin/src/sharedReducers/crudReducer/selectors.js +5 -0
- package/admin/src/testUtils/data.js +305 -0
- package/admin/src/testUtils/index.js +4 -0
- package/admin/src/translations/ar.json +94 -0
- package/admin/src/translations/cs.json +130 -0
- package/admin/src/translations/de.json +177 -0
- package/admin/src/translations/dk.json +180 -0
- package/admin/src/translations/en.json +177 -0
- package/admin/src/translations/es.json +177 -0
- package/admin/src/translations/fr.json +162 -0
- package/admin/src/translations/id.json +175 -0
- package/admin/src/translations/index.js +53 -0
- package/admin/src/translations/it.json +177 -0
- package/admin/src/translations/ja.json +94 -0
- package/admin/src/translations/ko.json +110 -0
- package/admin/src/translations/ms.json +148 -0
- package/admin/src/translations/nl.json +94 -0
- package/admin/src/translations/pl.json +142 -0
- package/admin/src/translations/pt-BR.json +94 -0
- package/admin/src/translations/pt.json +94 -0
- package/admin/src/translations/ru.json +177 -0
- package/admin/src/translations/sk.json +172 -0
- package/admin/src/translations/th.json +155 -0
- package/admin/src/translations/tr.json +177 -0
- package/admin/src/translations/uk.json +148 -0
- package/admin/src/translations/vi.json +110 -0
- package/admin/src/translations/zh-Hans.json +177 -0
- package/admin/src/translations/zh.json +94 -0
- package/admin/src/utils/ItemTypes.js +7 -0
- package/admin/src/utils/checkIfAttributeIsDisplayable.js +13 -0
- package/admin/src/utils/createDefaultForm.js +50 -0
- package/admin/src/utils/dateFormats.js +18 -0
- package/admin/src/utils/formatFiltersFromQuery.js +55 -0
- package/admin/src/utils/formatFiltersToQuery.js +27 -0
- package/admin/src/utils/formatLayoutToApi.js +44 -0
- package/admin/src/utils/generatePermissionsObject.js +20 -0
- package/admin/src/utils/getComponents.js +50 -0
- package/admin/src/utils/getDisplayedValue.js +61 -0
- package/admin/src/utils/getFieldName.js +6 -0
- package/admin/src/utils/getMaxTempKey.js +12 -0
- package/admin/src/utils/getRequestUrl.js +5 -0
- package/admin/src/utils/getTrad.js +5 -0
- package/admin/src/utils/index.js +17 -0
- package/admin/src/utils/mergeMetasWithSchema.js +20 -0
- package/admin/src/utils/removeKeyInObject.js +45 -0
- package/admin/src/utils/removePasswordFieldsFromData.js +54 -0
- package/config/admin.json +5 -0
- package/config/functions/bootstrap.js +9 -0
- package/config/policies/has-draft-and-publish.js +19 -0
- package/config/policies/hasPermissions.js +34 -0
- package/config/policies/routing.js +27 -0
- package/config/routes.json +275 -0
- package/controllers/collection-types.js +282 -0
- package/controllers/components.js +66 -0
- package/controllers/content-types.js +112 -0
- package/controllers/relations.js +63 -0
- package/controllers/single-types.js +170 -0
- package/controllers/uid.js +41 -0
- package/controllers/validation/index.js +104 -0
- package/controllers/validation/model-configuration.js +114 -0
- package/oas.yml +757 -0
- package/package.json +77 -0
- package/services/components.js +92 -0
- package/services/configuration.js +79 -0
- package/services/content-types.js +73 -0
- package/services/data-mapper.js +98 -0
- package/services/entity-manager.js +140 -0
- package/services/metrics.js +34 -0
- package/services/permission-checker.js +69 -0
- package/services/permission.js +95 -0
- package/services/uid.js +63 -0
- package/services/utils/configuration/attributes.js +175 -0
- package/services/utils/configuration/index.js +43 -0
- package/services/utils/configuration/layouts.js +185 -0
- package/services/utils/configuration/metadatas.js +142 -0
- package/services/utils/configuration/settings.js +52 -0
- package/services/utils/store.js +93 -0
- package/utils/index.js +16 -0
- package/utils/pick-writable-attributes.js +6 -0
- package/utils/wrap-bad-request.js +15 -0
- package/validation/policies/hasPermissions.js +17 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { useHistory } from 'react-router-dom';
|
|
3
|
+
import { get } from 'lodash';
|
|
4
|
+
import {
|
|
5
|
+
request,
|
|
6
|
+
useGlobalContext,
|
|
7
|
+
useQueryParams,
|
|
8
|
+
formatComponentData,
|
|
9
|
+
contentManagementUtilRemoveFieldsFromData,
|
|
10
|
+
} from 'strapi-helper-plugin';
|
|
11
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import isEqual from 'react-fast-compare';
|
|
14
|
+
import { createDefaultForm, getTrad, removePasswordFieldsFromData } from '../../utils';
|
|
15
|
+
import pluginId from '../../pluginId';
|
|
16
|
+
import { useFindRedirectionLink } from '../../hooks';
|
|
17
|
+
import {
|
|
18
|
+
getData,
|
|
19
|
+
getDataSucceeded,
|
|
20
|
+
initForm,
|
|
21
|
+
resetProps,
|
|
22
|
+
setDataStructures,
|
|
23
|
+
setStatus,
|
|
24
|
+
submitSucceeded,
|
|
25
|
+
} from '../../sharedReducers/crudReducer/actions';
|
|
26
|
+
import selectCrudReducer from '../../sharedReducers/crudReducer/selectors';
|
|
27
|
+
import { getRequestUrl } from './utils';
|
|
28
|
+
|
|
29
|
+
// This container is used to handle the CRUD
|
|
30
|
+
const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }) => {
|
|
31
|
+
const { emitEvent } = useGlobalContext();
|
|
32
|
+
const { push, replace } = useHistory();
|
|
33
|
+
const [{ rawQuery }] = useQueryParams();
|
|
34
|
+
const dispatch = useDispatch();
|
|
35
|
+
const {
|
|
36
|
+
componentsDataStructure,
|
|
37
|
+
contentTypeDataStructure,
|
|
38
|
+
data,
|
|
39
|
+
isLoading,
|
|
40
|
+
status,
|
|
41
|
+
} = useSelector(selectCrudReducer);
|
|
42
|
+
const redirectionLink = useFindRedirectionLink(slug);
|
|
43
|
+
|
|
44
|
+
const isMounted = useRef(true);
|
|
45
|
+
const emitEventRef = useRef(emitEvent);
|
|
46
|
+
|
|
47
|
+
const allLayoutDataRef = useRef(allLayoutData);
|
|
48
|
+
|
|
49
|
+
const isCreatingEntry = id === null;
|
|
50
|
+
|
|
51
|
+
const requestURL = useMemo(() => {
|
|
52
|
+
if (isCreatingEntry && !origin) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return getRequestUrl(`${slug}/${origin || id}`);
|
|
57
|
+
}, [slug, id, isCreatingEntry, origin]);
|
|
58
|
+
|
|
59
|
+
const cleanClonedData = useCallback(
|
|
60
|
+
data => {
|
|
61
|
+
if (!origin) {
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cleaned = contentManagementUtilRemoveFieldsFromData(
|
|
66
|
+
data,
|
|
67
|
+
allLayoutDataRef.current.contentType,
|
|
68
|
+
allLayoutDataRef.current.components
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return cleaned;
|
|
72
|
+
},
|
|
73
|
+
[origin]
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const cleanReceivedData = useCallback(data => {
|
|
77
|
+
const cleaned = removePasswordFieldsFromData(
|
|
78
|
+
data,
|
|
79
|
+
allLayoutDataRef.current.contentType,
|
|
80
|
+
allLayoutDataRef.current.components
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return formatComponentData(
|
|
84
|
+
cleaned,
|
|
85
|
+
allLayoutDataRef.current.contentType,
|
|
86
|
+
allLayoutDataRef.current.components
|
|
87
|
+
);
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
// SET THE DEFAULT LAYOUT the effect is applied when the slug changes
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const componentsDataStructure = Object.keys(allLayoutData.components).reduce((acc, current) => {
|
|
93
|
+
const defaultComponentForm = createDefaultForm(
|
|
94
|
+
get(allLayoutData, ['components', current, 'attributes'], {}),
|
|
95
|
+
allLayoutData.components
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
acc[current] = formatComponentData(
|
|
99
|
+
defaultComponentForm,
|
|
100
|
+
allLayoutData.components[current],
|
|
101
|
+
allLayoutData.components
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return acc;
|
|
105
|
+
}, {});
|
|
106
|
+
|
|
107
|
+
const contentTypeDataStructure = createDefaultForm(
|
|
108
|
+
allLayoutData.contentType.attributes,
|
|
109
|
+
allLayoutData.components
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const contentTypeDataStructureFormatted = formatComponentData(
|
|
113
|
+
contentTypeDataStructure,
|
|
114
|
+
allLayoutData.contentType,
|
|
115
|
+
allLayoutData.components
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
dispatch(setDataStructures(componentsDataStructure, contentTypeDataStructureFormatted));
|
|
119
|
+
}, [allLayoutData, dispatch]);
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
return () => {
|
|
123
|
+
dispatch(resetProps());
|
|
124
|
+
};
|
|
125
|
+
}, [dispatch]);
|
|
126
|
+
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
const abortController = new AbortController();
|
|
129
|
+
const { signal } = abortController;
|
|
130
|
+
|
|
131
|
+
const fetchData = async signal => {
|
|
132
|
+
dispatch(getData());
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
const data = await request(requestURL, { method: 'GET', signal });
|
|
136
|
+
|
|
137
|
+
dispatch(getDataSucceeded(cleanReceivedData(cleanClonedData(data))));
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (err.name === 'AbortError') {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
console.error(err);
|
|
144
|
+
|
|
145
|
+
const resStatus = get(err, 'response.status', null);
|
|
146
|
+
|
|
147
|
+
if (resStatus === 404) {
|
|
148
|
+
push(redirectionLink);
|
|
149
|
+
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Not allowed to read a document
|
|
154
|
+
if (resStatus === 403) {
|
|
155
|
+
strapi.notification.info(getTrad('permissions.not-allowed.update'));
|
|
156
|
+
|
|
157
|
+
push(redirectionLink);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// This is needed in order to reset the form when the query changes
|
|
163
|
+
const init = async () => {
|
|
164
|
+
await dispatch(getData());
|
|
165
|
+
await dispatch(initForm(rawQuery));
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
if (!isMounted.current) {
|
|
169
|
+
return () => {};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (requestURL) {
|
|
173
|
+
fetchData(signal);
|
|
174
|
+
} else {
|
|
175
|
+
init();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return () => {
|
|
179
|
+
abortController.abort();
|
|
180
|
+
};
|
|
181
|
+
}, [cleanClonedData, cleanReceivedData, push, requestURL, dispatch, rawQuery, redirectionLink]);
|
|
182
|
+
|
|
183
|
+
const displayErrors = useCallback(err => {
|
|
184
|
+
const errorPayload = err.response.payload;
|
|
185
|
+
console.error(errorPayload);
|
|
186
|
+
|
|
187
|
+
let errorMessage = get(errorPayload, ['message'], 'Bad Request');
|
|
188
|
+
|
|
189
|
+
// TODO handle errors correctly when back-end ready
|
|
190
|
+
if (Array.isArray(errorMessage)) {
|
|
191
|
+
errorMessage = get(errorMessage, ['0', 'messages', '0', 'id']);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (typeof errorMessage === 'string') {
|
|
195
|
+
strapi.notification.error(errorMessage);
|
|
196
|
+
}
|
|
197
|
+
}, []);
|
|
198
|
+
|
|
199
|
+
const onDelete = useCallback(
|
|
200
|
+
async trackerProperty => {
|
|
201
|
+
try {
|
|
202
|
+
emitEventRef.current('willDeleteEntry', trackerProperty);
|
|
203
|
+
|
|
204
|
+
const response = await request(getRequestUrl(`${slug}/${id}`), {
|
|
205
|
+
method: 'DELETE',
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
strapi.notification.success(getTrad('success.record.delete'));
|
|
209
|
+
|
|
210
|
+
emitEventRef.current('didDeleteEntry', trackerProperty);
|
|
211
|
+
|
|
212
|
+
return Promise.resolve(response);
|
|
213
|
+
} catch (err) {
|
|
214
|
+
emitEventRef.current('didNotDeleteEntry', { error: err, ...trackerProperty });
|
|
215
|
+
|
|
216
|
+
return Promise.reject(err);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
[id, slug]
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
const onDeleteSucceeded = useCallback(() => {
|
|
223
|
+
replace(redirectionLink);
|
|
224
|
+
}, [redirectionLink, replace]);
|
|
225
|
+
|
|
226
|
+
const onPost = useCallback(
|
|
227
|
+
async (body, trackerProperty) => {
|
|
228
|
+
const endPoint = `${getRequestUrl(slug)}${rawQuery}`;
|
|
229
|
+
|
|
230
|
+
try {
|
|
231
|
+
// Show a loading button in the EditView/Header.js && lock the app => no navigation
|
|
232
|
+
dispatch(setStatus('submit-pending'));
|
|
233
|
+
|
|
234
|
+
const response = await request(endPoint, { method: 'POST', body });
|
|
235
|
+
|
|
236
|
+
emitEventRef.current('didCreateEntry', trackerProperty);
|
|
237
|
+
strapi.notification.toggle({
|
|
238
|
+
type: 'success',
|
|
239
|
+
message: { id: getTrad('success.record.save') },
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
dispatch(submitSucceeded(cleanReceivedData(response)));
|
|
243
|
+
// Enable navigation and remove loaders
|
|
244
|
+
dispatch(setStatus('resolved'));
|
|
245
|
+
|
|
246
|
+
replace(`/plugins/${pluginId}/collectionType/${slug}/${response.id}${rawQuery}`);
|
|
247
|
+
} catch (err) {
|
|
248
|
+
emitEventRef.current('didNotCreateEntry', { error: err, trackerProperty });
|
|
249
|
+
displayErrors(err);
|
|
250
|
+
dispatch(setStatus('resolved'));
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
[cleanReceivedData, displayErrors, replace, slug, dispatch, rawQuery]
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const onPublish = useCallback(async () => {
|
|
257
|
+
try {
|
|
258
|
+
emitEventRef.current('willPublishEntry');
|
|
259
|
+
const endPoint = getRequestUrl(`${slug}/${id}/actions/publish`);
|
|
260
|
+
|
|
261
|
+
dispatch(setStatus('publish-pending'));
|
|
262
|
+
|
|
263
|
+
const data = await request(endPoint, { method: 'POST' });
|
|
264
|
+
|
|
265
|
+
emitEventRef.current('didPublishEntry');
|
|
266
|
+
|
|
267
|
+
dispatch(submitSucceeded(cleanReceivedData(data)));
|
|
268
|
+
dispatch(setStatus('resolved'));
|
|
269
|
+
|
|
270
|
+
strapi.notification.toggle({
|
|
271
|
+
type: 'success',
|
|
272
|
+
message: { id: getTrad('success.record.publish') },
|
|
273
|
+
});
|
|
274
|
+
} catch (err) {
|
|
275
|
+
displayErrors(err);
|
|
276
|
+
dispatch(setStatus('resolved'));
|
|
277
|
+
}
|
|
278
|
+
}, [cleanReceivedData, displayErrors, id, slug, dispatch]);
|
|
279
|
+
|
|
280
|
+
const onPut = useCallback(
|
|
281
|
+
async (body, trackerProperty) => {
|
|
282
|
+
const endPoint = getRequestUrl(`${slug}/${id}`);
|
|
283
|
+
|
|
284
|
+
try {
|
|
285
|
+
emitEventRef.current('willEditEntry', trackerProperty);
|
|
286
|
+
|
|
287
|
+
dispatch(setStatus('submit-pending'));
|
|
288
|
+
|
|
289
|
+
const response = await request(endPoint, { method: 'PUT', body });
|
|
290
|
+
|
|
291
|
+
emitEventRef.current('didEditEntry', { trackerProperty });
|
|
292
|
+
strapi.notification.toggle({
|
|
293
|
+
type: 'success',
|
|
294
|
+
message: { id: getTrad('success.record.save') },
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
dispatch(submitSucceeded(cleanReceivedData(response)));
|
|
298
|
+
|
|
299
|
+
dispatch(setStatus('resolved'));
|
|
300
|
+
} catch (err) {
|
|
301
|
+
emitEventRef.current('didNotEditEntry', { error: err, trackerProperty });
|
|
302
|
+
displayErrors(err);
|
|
303
|
+
|
|
304
|
+
dispatch(setStatus('resolved'));
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
[cleanReceivedData, displayErrors, slug, id, dispatch]
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
const onUnpublish = useCallback(async () => {
|
|
311
|
+
const endPoint = getRequestUrl(`${slug}/${id}/actions/unpublish`);
|
|
312
|
+
|
|
313
|
+
dispatch(setStatus('unpublish-pending'));
|
|
314
|
+
|
|
315
|
+
try {
|
|
316
|
+
emitEventRef.current('willUnpublishEntry');
|
|
317
|
+
|
|
318
|
+
const response = await request(endPoint, { method: 'POST' });
|
|
319
|
+
|
|
320
|
+
emitEventRef.current('didUnpublishEntry');
|
|
321
|
+
strapi.notification.success(getTrad('success.record.unpublish'));
|
|
322
|
+
|
|
323
|
+
dispatch(submitSucceeded(cleanReceivedData(response)));
|
|
324
|
+
dispatch(setStatus('resolved'));
|
|
325
|
+
} catch (err) {
|
|
326
|
+
dispatch(setStatus('resolved'));
|
|
327
|
+
displayErrors(err);
|
|
328
|
+
}
|
|
329
|
+
}, [cleanReceivedData, displayErrors, id, slug, dispatch]);
|
|
330
|
+
|
|
331
|
+
return children({
|
|
332
|
+
componentsDataStructure,
|
|
333
|
+
contentTypeDataStructure,
|
|
334
|
+
data,
|
|
335
|
+
isCreatingEntry,
|
|
336
|
+
isLoadingForData: isLoading,
|
|
337
|
+
onDelete,
|
|
338
|
+
onDeleteSucceeded,
|
|
339
|
+
onPost,
|
|
340
|
+
onPublish,
|
|
341
|
+
onPut,
|
|
342
|
+
onUnpublish,
|
|
343
|
+
status,
|
|
344
|
+
redirectionLink,
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
CollectionTypeFormWrapper.defaultProps = {
|
|
349
|
+
id: null,
|
|
350
|
+
origin: null,
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
CollectionTypeFormWrapper.propTypes = {
|
|
354
|
+
allLayoutData: PropTypes.exact({
|
|
355
|
+
components: PropTypes.object.isRequired,
|
|
356
|
+
contentType: PropTypes.shape({
|
|
357
|
+
apiID: PropTypes.string.isRequired,
|
|
358
|
+
attributes: PropTypes.object.isRequired,
|
|
359
|
+
info: PropTypes.object.isRequired,
|
|
360
|
+
isDisplayed: PropTypes.bool.isRequired,
|
|
361
|
+
kind: PropTypes.string.isRequired,
|
|
362
|
+
layouts: PropTypes.object.isRequired,
|
|
363
|
+
metadatas: PropTypes.object.isRequired,
|
|
364
|
+
options: PropTypes.object.isRequired,
|
|
365
|
+
pluginOptions: PropTypes.object,
|
|
366
|
+
settings: PropTypes.object.isRequired,
|
|
367
|
+
uid: PropTypes.string.isRequired,
|
|
368
|
+
}).isRequired,
|
|
369
|
+
}).isRequired,
|
|
370
|
+
children: PropTypes.func.isRequired,
|
|
371
|
+
id: PropTypes.string,
|
|
372
|
+
origin: PropTypes.string,
|
|
373
|
+
slug: PropTypes.string.isRequired,
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export default memo(CollectionTypeFormWrapper, isEqual);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { Switch, Route } from 'react-router-dom';
|
|
3
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
|
+
import { get } from 'lodash';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { ErrorFallback, LoadingIndicatorPage, CheckPagePermissions } from 'strapi-helper-plugin';
|
|
7
|
+
import pluginPermissions from '../../permissions';
|
|
8
|
+
import { ContentTypeLayoutContext } from '../../contexts';
|
|
9
|
+
import { useFetchContentTypeLayout } from '../../hooks';
|
|
10
|
+
import { formatLayoutToApi } from '../../utils';
|
|
11
|
+
import EditViewLayoutManager from '../EditViewLayoutManager';
|
|
12
|
+
import EditSettingsView from '../EditSettingsView';
|
|
13
|
+
import ListViewLayout from '../ListViewLayoutManager';
|
|
14
|
+
import ListSettingsView from '../ListSettingsView';
|
|
15
|
+
|
|
16
|
+
const CollectionTypeRecursivePath = ({
|
|
17
|
+
match: {
|
|
18
|
+
params: { slug },
|
|
19
|
+
url,
|
|
20
|
+
},
|
|
21
|
+
}) => {
|
|
22
|
+
const { isLoading, layout, updateLayout } = useFetchContentTypeLayout(slug);
|
|
23
|
+
|
|
24
|
+
const { rawContentTypeLayout, rawComponentsLayouts } = useMemo(() => {
|
|
25
|
+
let rawContentTypeLayout = {};
|
|
26
|
+
let rawComponentsLayouts = {};
|
|
27
|
+
|
|
28
|
+
if (layout.contentType) {
|
|
29
|
+
rawContentTypeLayout = formatLayoutToApi(layout.contentType);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (layout.components) {
|
|
33
|
+
rawComponentsLayouts = Object.keys(layout.components).reduce((acc, current) => {
|
|
34
|
+
acc[current] = formatLayoutToApi(layout.components[current]);
|
|
35
|
+
|
|
36
|
+
return acc;
|
|
37
|
+
}, {});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return { rawContentTypeLayout, rawComponentsLayouts };
|
|
41
|
+
}, [layout]);
|
|
42
|
+
|
|
43
|
+
const uid = get(layout, ['contentType', 'uid'], null);
|
|
44
|
+
|
|
45
|
+
// This statement is needed in order to prevent the CollectionTypeFormWrapper effects clean up phase to be run twice.
|
|
46
|
+
// What can happen is that when navigating from one entry to another the cleanup phase of the fetch data effect is run twice : once when
|
|
47
|
+
// unmounting, once when the url changes.
|
|
48
|
+
// Since it can happen that the layout there's a delay when the layout is being fetched and the url changes adding the uid ! == slug
|
|
49
|
+
// statement prevent the component from being mounted and unmounted twice.
|
|
50
|
+
if (uid !== slug || isLoading) {
|
|
51
|
+
return <LoadingIndicatorPage />;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const renderRoute = (
|
|
55
|
+
{
|
|
56
|
+
location: { state },
|
|
57
|
+
history: { goBack },
|
|
58
|
+
match: {
|
|
59
|
+
params: { id, origin },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
Component
|
|
63
|
+
) => {
|
|
64
|
+
return (
|
|
65
|
+
<Component
|
|
66
|
+
slug={slug}
|
|
67
|
+
layout={layout}
|
|
68
|
+
state={state}
|
|
69
|
+
goBack={goBack}
|
|
70
|
+
id={id}
|
|
71
|
+
origin={origin}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const routes = [
|
|
77
|
+
{ path: 'create/clone/:origin', comp: EditViewLayoutManager },
|
|
78
|
+
{ path: 'create', comp: EditViewLayoutManager },
|
|
79
|
+
{ path: ':id', comp: EditViewLayoutManager },
|
|
80
|
+
{ path: '', comp: ListViewLayout },
|
|
81
|
+
].map(({ path, comp }) => (
|
|
82
|
+
<Route key={path} path={`${url}/${path}`} render={props => renderRoute(props, comp)} />
|
|
83
|
+
));
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<ErrorBoundary FallbackComponent={ErrorFallback}>
|
|
87
|
+
<ContentTypeLayoutContext.Provider value={layout}>
|
|
88
|
+
<Switch>
|
|
89
|
+
<Route path={`${url}/configurations/list`}>
|
|
90
|
+
<CheckPagePermissions permissions={pluginPermissions.collectionTypesConfigurations}>
|
|
91
|
+
<ListSettingsView
|
|
92
|
+
layout={rawContentTypeLayout}
|
|
93
|
+
slug={slug}
|
|
94
|
+
updateLayout={updateLayout}
|
|
95
|
+
/>
|
|
96
|
+
</CheckPagePermissions>
|
|
97
|
+
</Route>
|
|
98
|
+
<Route path={`${url}/configurations/edit`}>
|
|
99
|
+
<CheckPagePermissions permissions={pluginPermissions.collectionTypesConfigurations}>
|
|
100
|
+
<EditSettingsView
|
|
101
|
+
components={rawComponentsLayouts}
|
|
102
|
+
isContentTypeView
|
|
103
|
+
mainLayout={rawContentTypeLayout}
|
|
104
|
+
slug={slug}
|
|
105
|
+
updateLayout={updateLayout}
|
|
106
|
+
/>
|
|
107
|
+
</CheckPagePermissions>
|
|
108
|
+
</Route>
|
|
109
|
+
{routes}
|
|
110
|
+
</Switch>
|
|
111
|
+
</ContentTypeLayoutContext.Provider>
|
|
112
|
+
</ErrorBoundary>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
CollectionTypeRecursivePath.propTypes = {
|
|
117
|
+
match: PropTypes.shape({
|
|
118
|
+
url: PropTypes.string.isRequired,
|
|
119
|
+
params: PropTypes.shape({
|
|
120
|
+
slug: PropTypes.string.isRequired,
|
|
121
|
+
}).isRequired,
|
|
122
|
+
}).isRequired,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default memo(CollectionTypeRecursivePath);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { memo, useEffect, useMemo, useReducer } from 'react';
|
|
2
|
+
import { useParams } from 'react-router-dom';
|
|
3
|
+
import { CheckPagePermissions, LoadingIndicatorPage, request } from 'strapi-helper-plugin';
|
|
4
|
+
import { useSelector, shallowEqual } from 'react-redux';
|
|
5
|
+
import { getRequestUrl, mergeMetasWithSchema } from '../../utils';
|
|
6
|
+
import { makeSelectModelAndComponentSchemas } from '../Main/selectors';
|
|
7
|
+
import pluginPermissions from '../../permissions';
|
|
8
|
+
import crudReducer, { crudInitialState } from '../../sharedReducers/crudReducer/reducer';
|
|
9
|
+
import { getData, getDataSucceeded } from '../../sharedReducers/crudReducer/actions';
|
|
10
|
+
import EditSettingsView from '../EditSettingsView';
|
|
11
|
+
|
|
12
|
+
const ComponentSettingsView = () => {
|
|
13
|
+
const [{ isLoading, data: layout }, dispatch] = useReducer(crudReducer, crudInitialState);
|
|
14
|
+
const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
|
|
15
|
+
const { schemas } = useSelector(state => schemasSelector(state), shallowEqual);
|
|
16
|
+
const { uid } = useParams();
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const abortController = new AbortController();
|
|
20
|
+
const { signal } = abortController;
|
|
21
|
+
|
|
22
|
+
const fetchData = async signal => {
|
|
23
|
+
try {
|
|
24
|
+
dispatch(getData());
|
|
25
|
+
|
|
26
|
+
const { data } = await request(getRequestUrl(`components/${uid}/configuration`), {
|
|
27
|
+
method: 'GET',
|
|
28
|
+
signal,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
dispatch(getDataSucceeded(mergeMetasWithSchema(data, schemas, 'component')));
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.error(err);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
fetchData(signal);
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
40
|
+
abortController.abort();
|
|
41
|
+
};
|
|
42
|
+
}, [uid, schemas]);
|
|
43
|
+
|
|
44
|
+
if (isLoading) {
|
|
45
|
+
return <LoadingIndicatorPage />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<CheckPagePermissions permissions={pluginPermissions.componentsConfigurations}>
|
|
50
|
+
<EditSettingsView components={layout.components} mainLayout={layout.component} slug={uid} />
|
|
51
|
+
</CheckPagePermissions>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default memo(ComponentSettingsView);
|