@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,519 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useReducer } from 'react';
|
|
2
|
+
import { cloneDeep, get, isEmpty, isEqual, set } from 'lodash';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Prompt, Redirect } from 'react-router-dom';
|
|
5
|
+
import {
|
|
6
|
+
LoadingIndicatorPage,
|
|
7
|
+
useGlobalContext,
|
|
8
|
+
OverlayBlocker,
|
|
9
|
+
ContentManagerEditViewDataManagerContext,
|
|
10
|
+
} from 'strapi-helper-plugin';
|
|
11
|
+
import { getTrad, removeKeyInObject } from '../../utils';
|
|
12
|
+
import reducer, { initialState } from './reducer';
|
|
13
|
+
import { cleanData, createYupSchema, getYupInnerErrors } from './utils';
|
|
14
|
+
|
|
15
|
+
const EditViewDataManagerProvider = ({
|
|
16
|
+
allLayoutData,
|
|
17
|
+
allowedActions: { canRead, canUpdate },
|
|
18
|
+
children,
|
|
19
|
+
componentsDataStructure,
|
|
20
|
+
contentTypeDataStructure,
|
|
21
|
+
createActionAllowedFields,
|
|
22
|
+
from,
|
|
23
|
+
initialValues,
|
|
24
|
+
isCreatingEntry,
|
|
25
|
+
isLoadingForData,
|
|
26
|
+
isSingleType,
|
|
27
|
+
onPost,
|
|
28
|
+
onPublish,
|
|
29
|
+
onPut,
|
|
30
|
+
onUnpublish,
|
|
31
|
+
readActionAllowedFields,
|
|
32
|
+
// Not sure this is needed anymore
|
|
33
|
+
redirectToPreviousPage,
|
|
34
|
+
slug,
|
|
35
|
+
status,
|
|
36
|
+
updateActionAllowedFields,
|
|
37
|
+
}) => {
|
|
38
|
+
const [reducerState, dispatch] = useReducer(reducer, initialState);
|
|
39
|
+
const {
|
|
40
|
+
formErrors,
|
|
41
|
+
initialData,
|
|
42
|
+
modifiedData,
|
|
43
|
+
modifiedDZName,
|
|
44
|
+
shouldCheckErrors,
|
|
45
|
+
} = reducerState.toJS();
|
|
46
|
+
|
|
47
|
+
const currentContentTypeLayout = get(allLayoutData, ['contentType'], {});
|
|
48
|
+
|
|
49
|
+
const hasDraftAndPublish = useMemo(() => {
|
|
50
|
+
return get(currentContentTypeLayout, ['options', 'draftAndPublish'], false);
|
|
51
|
+
}, [currentContentTypeLayout]);
|
|
52
|
+
|
|
53
|
+
const shouldNotRunValidations = useMemo(() => {
|
|
54
|
+
return hasDraftAndPublish && !initialData.published_at;
|
|
55
|
+
}, [hasDraftAndPublish, initialData.published_at]);
|
|
56
|
+
|
|
57
|
+
const { emitEvent, formatMessage } = useGlobalContext();
|
|
58
|
+
const emitEventRef = useRef(emitEvent);
|
|
59
|
+
|
|
60
|
+
const shouldRedirectToHomepageWhenEditingEntry = useMemo(() => {
|
|
61
|
+
if (isLoadingForData) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (isCreatingEntry) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (canRead === false && canUpdate === false) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return false;
|
|
74
|
+
}, [isLoadingForData, isCreatingEntry, canRead, canUpdate]);
|
|
75
|
+
|
|
76
|
+
// TODO check this effect if it is really needed (not prio)
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!isLoadingForData) {
|
|
79
|
+
checkFormErrors();
|
|
80
|
+
}
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
}, [shouldCheckErrors]);
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (shouldRedirectToHomepageWhenEditingEntry) {
|
|
86
|
+
strapi.notification.info(getTrad('permissions.not-allowed.update'));
|
|
87
|
+
}
|
|
88
|
+
}, [shouldRedirectToHomepageWhenEditingEntry]);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
dispatch({
|
|
92
|
+
type: 'SET_DEFAULT_DATA_STRUCTURES',
|
|
93
|
+
componentsDataStructure,
|
|
94
|
+
contentTypeDataStructure,
|
|
95
|
+
});
|
|
96
|
+
}, [componentsDataStructure, contentTypeDataStructure]);
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
dispatch({
|
|
100
|
+
type: 'INIT_FORM',
|
|
101
|
+
initialValues,
|
|
102
|
+
});
|
|
103
|
+
}, [initialValues]);
|
|
104
|
+
|
|
105
|
+
const addComponentToDynamicZone = useCallback((keys, componentUid, shouldCheckErrors = false) => {
|
|
106
|
+
emitEventRef.current('didAddComponentToDynamicZone');
|
|
107
|
+
|
|
108
|
+
dispatch({
|
|
109
|
+
type: 'ADD_COMPONENT_TO_DYNAMIC_ZONE',
|
|
110
|
+
keys: keys.split('.'),
|
|
111
|
+
componentUid,
|
|
112
|
+
shouldCheckErrors,
|
|
113
|
+
});
|
|
114
|
+
}, []);
|
|
115
|
+
|
|
116
|
+
const addNonRepeatableComponentToField = useCallback((keys, componentUid) => {
|
|
117
|
+
dispatch({
|
|
118
|
+
type: 'ADD_NON_REPEATABLE_COMPONENT_TO_FIELD',
|
|
119
|
+
keys: keys.split('.'),
|
|
120
|
+
componentUid,
|
|
121
|
+
});
|
|
122
|
+
}, []);
|
|
123
|
+
|
|
124
|
+
const addRelation = useCallback(({ target: { name, value } }) => {
|
|
125
|
+
dispatch({
|
|
126
|
+
type: 'ADD_RELATION',
|
|
127
|
+
keys: name.split('.'),
|
|
128
|
+
value,
|
|
129
|
+
});
|
|
130
|
+
}, []);
|
|
131
|
+
|
|
132
|
+
const addRepeatableComponentToField = useCallback(
|
|
133
|
+
(keys, componentUid, shouldCheckErrors = false) => {
|
|
134
|
+
dispatch({
|
|
135
|
+
type: 'ADD_REPEATABLE_COMPONENT_TO_FIELD',
|
|
136
|
+
keys: keys.split('.'),
|
|
137
|
+
componentUid,
|
|
138
|
+
shouldCheckErrors,
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
[]
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const yupSchema = useMemo(() => {
|
|
145
|
+
const options = { isCreatingEntry, isDraft: shouldNotRunValidations, isFromComponent: false };
|
|
146
|
+
|
|
147
|
+
return createYupSchema(
|
|
148
|
+
currentContentTypeLayout,
|
|
149
|
+
{
|
|
150
|
+
components: allLayoutData.components || {},
|
|
151
|
+
},
|
|
152
|
+
options
|
|
153
|
+
);
|
|
154
|
+
}, [
|
|
155
|
+
allLayoutData.components,
|
|
156
|
+
currentContentTypeLayout,
|
|
157
|
+
isCreatingEntry,
|
|
158
|
+
shouldNotRunValidations,
|
|
159
|
+
]);
|
|
160
|
+
|
|
161
|
+
const checkFormErrors = useCallback(
|
|
162
|
+
async (dataToSet = {}) => {
|
|
163
|
+
let errors = {};
|
|
164
|
+
const updatedData = cloneDeep(modifiedData);
|
|
165
|
+
|
|
166
|
+
if (!isEmpty(updatedData)) {
|
|
167
|
+
set(updatedData, dataToSet.path, dataToSet.value);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
// Validate the form using yup
|
|
172
|
+
await yupSchema.validate(updatedData, { abortEarly: false });
|
|
173
|
+
} catch (err) {
|
|
174
|
+
errors = getYupInnerErrors(err);
|
|
175
|
+
|
|
176
|
+
if (modifiedDZName) {
|
|
177
|
+
errors = Object.keys(errors).reduce((acc, current) => {
|
|
178
|
+
const dzName = current.split('.')[0];
|
|
179
|
+
|
|
180
|
+
if (dzName !== modifiedDZName) {
|
|
181
|
+
acc[current] = errors[current];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return acc;
|
|
185
|
+
}, {});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
dispatch({
|
|
190
|
+
type: 'SET_FORM_ERRORS',
|
|
191
|
+
errors,
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
[modifiedDZName, modifiedData, yupSchema]
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const handleChange = useCallback(
|
|
198
|
+
({ target: { name, value, type } }, shouldSetInitialValue = false) => {
|
|
199
|
+
let inputValue = value;
|
|
200
|
+
|
|
201
|
+
// Empty string is not a valid date,
|
|
202
|
+
// Set the date to null when it's empty
|
|
203
|
+
if (type === 'date' && value === '') {
|
|
204
|
+
inputValue = null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (type === 'password' && !value) {
|
|
208
|
+
dispatch({
|
|
209
|
+
type: 'REMOVE_PASSWORD_FIELD',
|
|
210
|
+
keys: name.split('.'),
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Allow to reset enum
|
|
217
|
+
if (type === 'select-one' && value === '') {
|
|
218
|
+
inputValue = null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Allow to reset number input
|
|
222
|
+
if (type === 'number' && value === '') {
|
|
223
|
+
inputValue = null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
dispatch({
|
|
227
|
+
type: 'ON_CHANGE',
|
|
228
|
+
keys: name.split('.'),
|
|
229
|
+
value: inputValue,
|
|
230
|
+
shouldSetInitialValue,
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
[]
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
const createFormData = useCallback(
|
|
237
|
+
data => {
|
|
238
|
+
// First we need to remove the added keys needed for the dnd
|
|
239
|
+
const preparedData = removeKeyInObject(cloneDeep(data), '__temp_key__');
|
|
240
|
+
// Then we need to apply our helper
|
|
241
|
+
const cleanedData = cleanData(
|
|
242
|
+
preparedData,
|
|
243
|
+
currentContentTypeLayout,
|
|
244
|
+
allLayoutData.components
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
return cleanedData;
|
|
248
|
+
},
|
|
249
|
+
[allLayoutData.components, currentContentTypeLayout]
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
const trackerProperty = useMemo(() => {
|
|
253
|
+
if (!hasDraftAndPublish) {
|
|
254
|
+
return {};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return shouldNotRunValidations ? { status: 'draft' } : {};
|
|
258
|
+
}, [hasDraftAndPublish, shouldNotRunValidations]);
|
|
259
|
+
|
|
260
|
+
const handleSubmit = useCallback(
|
|
261
|
+
async e => {
|
|
262
|
+
e.preventDefault();
|
|
263
|
+
let errors = {};
|
|
264
|
+
|
|
265
|
+
// First validate the form
|
|
266
|
+
try {
|
|
267
|
+
await yupSchema.validate(modifiedData, { abortEarly: false });
|
|
268
|
+
|
|
269
|
+
const formData = createFormData(modifiedData);
|
|
270
|
+
|
|
271
|
+
if (isCreatingEntry) {
|
|
272
|
+
onPost(formData, trackerProperty);
|
|
273
|
+
} else {
|
|
274
|
+
onPut(formData, trackerProperty);
|
|
275
|
+
}
|
|
276
|
+
} catch (err) {
|
|
277
|
+
console.error('ValidationError');
|
|
278
|
+
console.error(err);
|
|
279
|
+
|
|
280
|
+
errors = getYupInnerErrors(err);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
dispatch({
|
|
284
|
+
type: 'SET_FORM_ERRORS',
|
|
285
|
+
errors,
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
[createFormData, isCreatingEntry, modifiedData, onPost, onPut, trackerProperty, yupSchema]
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
const handlePublish = useCallback(async () => {
|
|
292
|
+
// Create yup schema here's we need to apply all the validations
|
|
293
|
+
const schema = createYupSchema(
|
|
294
|
+
currentContentTypeLayout,
|
|
295
|
+
{
|
|
296
|
+
components: get(allLayoutData, 'components', {}),
|
|
297
|
+
},
|
|
298
|
+
{ isCreatingEntry, isDraft: false, isFromComponent: false }
|
|
299
|
+
);
|
|
300
|
+
let errors = {};
|
|
301
|
+
|
|
302
|
+
try {
|
|
303
|
+
// Validate the form using yup
|
|
304
|
+
await schema.validate(modifiedData, { abortEarly: false });
|
|
305
|
+
|
|
306
|
+
onPublish();
|
|
307
|
+
} catch (err) {
|
|
308
|
+
console.error('ValidationError');
|
|
309
|
+
console.error(err);
|
|
310
|
+
|
|
311
|
+
errors = getYupInnerErrors(err);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
dispatch({
|
|
315
|
+
type: 'SET_FORM_ERRORS',
|
|
316
|
+
errors,
|
|
317
|
+
});
|
|
318
|
+
}, [allLayoutData, currentContentTypeLayout, isCreatingEntry, modifiedData, onPublish]);
|
|
319
|
+
|
|
320
|
+
const shouldCheckDZErrors = useCallback(
|
|
321
|
+
dzName => {
|
|
322
|
+
const doesDZHaveError = Object.keys(formErrors).some(key => key.split('.')[0] === dzName);
|
|
323
|
+
const shouldCheckErrors = !isEmpty(formErrors) && doesDZHaveError;
|
|
324
|
+
|
|
325
|
+
return shouldCheckErrors;
|
|
326
|
+
},
|
|
327
|
+
[formErrors]
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
const moveComponentDown = useCallback(
|
|
331
|
+
(dynamicZoneName, currentIndex) => {
|
|
332
|
+
emitEventRef.current('changeComponentsOrder');
|
|
333
|
+
|
|
334
|
+
dispatch({
|
|
335
|
+
type: 'MOVE_COMPONENT_DOWN',
|
|
336
|
+
dynamicZoneName,
|
|
337
|
+
currentIndex,
|
|
338
|
+
shouldCheckErrors: shouldCheckDZErrors(dynamicZoneName),
|
|
339
|
+
});
|
|
340
|
+
},
|
|
341
|
+
[shouldCheckDZErrors]
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
const moveComponentUp = useCallback(
|
|
345
|
+
(dynamicZoneName, currentIndex) => {
|
|
346
|
+
emitEventRef.current('changeComponentsOrder');
|
|
347
|
+
|
|
348
|
+
dispatch({
|
|
349
|
+
type: 'MOVE_COMPONENT_UP',
|
|
350
|
+
dynamicZoneName,
|
|
351
|
+
currentIndex,
|
|
352
|
+
shouldCheckErrors: shouldCheckDZErrors(dynamicZoneName),
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
[shouldCheckDZErrors]
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
const moveComponentField = useCallback((pathToComponent, dragIndex, hoverIndex) => {
|
|
359
|
+
dispatch({
|
|
360
|
+
type: 'MOVE_COMPONENT_FIELD',
|
|
361
|
+
pathToComponent,
|
|
362
|
+
dragIndex,
|
|
363
|
+
hoverIndex,
|
|
364
|
+
});
|
|
365
|
+
}, []);
|
|
366
|
+
|
|
367
|
+
const moveRelation = useCallback((dragIndex, overIndex, name) => {
|
|
368
|
+
dispatch({
|
|
369
|
+
type: 'MOVE_FIELD',
|
|
370
|
+
dragIndex,
|
|
371
|
+
overIndex,
|
|
372
|
+
keys: name.split('.'),
|
|
373
|
+
});
|
|
374
|
+
}, []);
|
|
375
|
+
|
|
376
|
+
const onRemoveRelation = useCallback(keys => {
|
|
377
|
+
dispatch({
|
|
378
|
+
type: 'REMOVE_RELATION',
|
|
379
|
+
keys,
|
|
380
|
+
});
|
|
381
|
+
}, []);
|
|
382
|
+
|
|
383
|
+
const removeComponentFromDynamicZone = useCallback(
|
|
384
|
+
(dynamicZoneName, index) => {
|
|
385
|
+
emitEventRef.current('removeComponentFromDynamicZone');
|
|
386
|
+
|
|
387
|
+
dispatch({
|
|
388
|
+
type: 'REMOVE_COMPONENT_FROM_DYNAMIC_ZONE',
|
|
389
|
+
dynamicZoneName,
|
|
390
|
+
index,
|
|
391
|
+
shouldCheckErrors: shouldCheckDZErrors(dynamicZoneName),
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
[shouldCheckDZErrors]
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
const removeComponentFromField = useCallback((keys, componentUid) => {
|
|
398
|
+
dispatch({
|
|
399
|
+
type: 'REMOVE_COMPONENT_FROM_FIELD',
|
|
400
|
+
keys: keys.split('.'),
|
|
401
|
+
componentUid,
|
|
402
|
+
});
|
|
403
|
+
}, []);
|
|
404
|
+
|
|
405
|
+
const removeRepeatableField = useCallback((keys, componentUid) => {
|
|
406
|
+
dispatch({
|
|
407
|
+
type: 'REMOVE_REPEATABLE_FIELD',
|
|
408
|
+
keys: keys.split('.'),
|
|
409
|
+
componentUid,
|
|
410
|
+
});
|
|
411
|
+
}, []);
|
|
412
|
+
|
|
413
|
+
const triggerFormValidation = useCallback(() => {
|
|
414
|
+
dispatch({
|
|
415
|
+
type: 'TRIGGER_FORM_VALIDATION',
|
|
416
|
+
});
|
|
417
|
+
}, []);
|
|
418
|
+
|
|
419
|
+
const overlayBlockerParams = useMemo(
|
|
420
|
+
() => ({
|
|
421
|
+
children: <div />,
|
|
422
|
+
noGradient: true,
|
|
423
|
+
}),
|
|
424
|
+
[]
|
|
425
|
+
);
|
|
426
|
+
|
|
427
|
+
// Redirect the user to the previous page if he is not allowed to read/update a document
|
|
428
|
+
if (shouldRedirectToHomepageWhenEditingEntry) {
|
|
429
|
+
return <Redirect to={from} />;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return (
|
|
433
|
+
<ContentManagerEditViewDataManagerContext.Provider
|
|
434
|
+
value={{
|
|
435
|
+
addComponentToDynamicZone,
|
|
436
|
+
addNonRepeatableComponentToField,
|
|
437
|
+
addRelation,
|
|
438
|
+
addRepeatableComponentToField,
|
|
439
|
+
allLayoutData,
|
|
440
|
+
checkFormErrors,
|
|
441
|
+
createActionAllowedFields,
|
|
442
|
+
formErrors,
|
|
443
|
+
hasDraftAndPublish,
|
|
444
|
+
initialData,
|
|
445
|
+
isCreatingEntry,
|
|
446
|
+
isSingleType,
|
|
447
|
+
shouldNotRunValidations,
|
|
448
|
+
status,
|
|
449
|
+
layout: currentContentTypeLayout,
|
|
450
|
+
modifiedData,
|
|
451
|
+
moveComponentDown,
|
|
452
|
+
moveComponentField,
|
|
453
|
+
moveComponentUp,
|
|
454
|
+
moveRelation,
|
|
455
|
+
onChange: handleChange,
|
|
456
|
+
onPublish: handlePublish,
|
|
457
|
+
onUnpublish,
|
|
458
|
+
onRemoveRelation,
|
|
459
|
+
readActionAllowedFields,
|
|
460
|
+
redirectToPreviousPage,
|
|
461
|
+
removeComponentFromDynamicZone,
|
|
462
|
+
removeComponentFromField,
|
|
463
|
+
removeRepeatableField,
|
|
464
|
+
slug,
|
|
465
|
+
triggerFormValidation,
|
|
466
|
+
updateActionAllowedFields,
|
|
467
|
+
}}
|
|
468
|
+
>
|
|
469
|
+
<>
|
|
470
|
+
<OverlayBlocker
|
|
471
|
+
key="overlayBlocker"
|
|
472
|
+
isOpen={status !== 'resolved'}
|
|
473
|
+
{...overlayBlockerParams}
|
|
474
|
+
/>
|
|
475
|
+
{isLoadingForData ? (
|
|
476
|
+
<LoadingIndicatorPage />
|
|
477
|
+
) : (
|
|
478
|
+
<>
|
|
479
|
+
<Prompt
|
|
480
|
+
when={!isEqual(modifiedData, initialData)}
|
|
481
|
+
message={formatMessage({ id: 'global.prompt.unsaved' })}
|
|
482
|
+
/>
|
|
483
|
+
<form onSubmit={handleSubmit}>{children}</form>
|
|
484
|
+
</>
|
|
485
|
+
)}
|
|
486
|
+
</>
|
|
487
|
+
</ContentManagerEditViewDataManagerContext.Provider>
|
|
488
|
+
);
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
EditViewDataManagerProvider.defaultProps = {
|
|
492
|
+
from: '/',
|
|
493
|
+
redirectToPreviousPage: () => {},
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
EditViewDataManagerProvider.propTypes = {
|
|
497
|
+
allLayoutData: PropTypes.object.isRequired,
|
|
498
|
+
allowedActions: PropTypes.object.isRequired,
|
|
499
|
+
children: PropTypes.arrayOf(PropTypes.element).isRequired,
|
|
500
|
+
componentsDataStructure: PropTypes.object.isRequired,
|
|
501
|
+
contentTypeDataStructure: PropTypes.object.isRequired,
|
|
502
|
+
createActionAllowedFields: PropTypes.array.isRequired,
|
|
503
|
+
from: PropTypes.string,
|
|
504
|
+
initialValues: PropTypes.object.isRequired,
|
|
505
|
+
isCreatingEntry: PropTypes.bool.isRequired,
|
|
506
|
+
isLoadingForData: PropTypes.bool.isRequired,
|
|
507
|
+
isSingleType: PropTypes.bool.isRequired,
|
|
508
|
+
onPost: PropTypes.func.isRequired,
|
|
509
|
+
onPublish: PropTypes.func.isRequired,
|
|
510
|
+
onPut: PropTypes.func.isRequired,
|
|
511
|
+
onUnpublish: PropTypes.func.isRequired,
|
|
512
|
+
readActionAllowedFields: PropTypes.array.isRequired,
|
|
513
|
+
redirectToPreviousPage: PropTypes.func,
|
|
514
|
+
slug: PropTypes.string.isRequired,
|
|
515
|
+
status: PropTypes.string.isRequired,
|
|
516
|
+
updateActionAllowedFields: PropTypes.array.isRequired,
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
export default EditViewDataManagerProvider;
|