@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,98 @@
|
|
|
1
|
+
/* eslint-disable indent */
|
|
2
|
+
const getRowSize = arr => arr.reduce((sum, value) => sum + value.size, 0);
|
|
3
|
+
|
|
4
|
+
const createLayout = arr => {
|
|
5
|
+
return arr.reduce((acc, current, index) => {
|
|
6
|
+
const row = { rowId: index, rowContent: current };
|
|
7
|
+
|
|
8
|
+
return acc.concat(row);
|
|
9
|
+
}, []);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const formatLayout = arr => {
|
|
13
|
+
return arr
|
|
14
|
+
.reduce((acc, current) => {
|
|
15
|
+
let toPush = [];
|
|
16
|
+
const currentRow = current.rowContent.reduce((acc2, curr) => {
|
|
17
|
+
const acc2Size = getRowSize(acc2);
|
|
18
|
+
|
|
19
|
+
if (curr.name === '_TEMP_') {
|
|
20
|
+
return acc2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (acc2Size + curr.size <= 12) {
|
|
24
|
+
acc2.push(curr);
|
|
25
|
+
} else {
|
|
26
|
+
toPush.push(curr);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return acc2;
|
|
30
|
+
}, []);
|
|
31
|
+
const rowId =
|
|
32
|
+
acc.length === 0
|
|
33
|
+
? 0
|
|
34
|
+
: Math.max.apply(
|
|
35
|
+
Math,
|
|
36
|
+
acc.map(o => o.rowId)
|
|
37
|
+
) + 1;
|
|
38
|
+
|
|
39
|
+
const currentRowSize = getRowSize(currentRow);
|
|
40
|
+
|
|
41
|
+
if (currentRowSize < 12) {
|
|
42
|
+
currentRow.push({ name: '_TEMP_', size: 12 - currentRowSize });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
acc.push({ rowId, rowContent: currentRow });
|
|
46
|
+
|
|
47
|
+
if (toPush.length > 0) {
|
|
48
|
+
const toPushSize = getRowSize(toPush);
|
|
49
|
+
|
|
50
|
+
if (toPushSize < 12) {
|
|
51
|
+
toPush.push({ name: '_TEMP_', size: 12 - toPushSize });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
acc.push({ rowId: rowId + 1, rowContent: toPush });
|
|
55
|
+
toPush = [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return acc;
|
|
59
|
+
}, [])
|
|
60
|
+
.filter(row => row.rowContent.length > 0)
|
|
61
|
+
.filter(row => {
|
|
62
|
+
if (row.rowContent.length === 1) {
|
|
63
|
+
return row.rowContent[0].name !== '_TEMP_';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const unformatLayout = arr => {
|
|
71
|
+
return arr.reduce((acc, current) => {
|
|
72
|
+
const currentRow = current.rowContent.filter(content => content.name !== '_TEMP_');
|
|
73
|
+
|
|
74
|
+
return acc.concat([currentRow]);
|
|
75
|
+
}, []);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const getInputSize = type => {
|
|
79
|
+
switch (type) {
|
|
80
|
+
case 'boolean':
|
|
81
|
+
case 'date':
|
|
82
|
+
case 'integer':
|
|
83
|
+
case 'float':
|
|
84
|
+
case 'biginteger':
|
|
85
|
+
case 'decimal':
|
|
86
|
+
case 'time':
|
|
87
|
+
return 4;
|
|
88
|
+
case 'json':
|
|
89
|
+
case 'component':
|
|
90
|
+
case 'richtext':
|
|
91
|
+
case 'dynamiczone':
|
|
92
|
+
return 12;
|
|
93
|
+
default:
|
|
94
|
+
return 6;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { createLayout, formatLayout, getInputSize, getRowSize, unformatLayout };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { memo, useState } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { get } from 'lodash';
|
|
4
|
+
import isEqual from 'react-fast-compare';
|
|
5
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
6
|
+
import { Text } from '@buffetjs/core';
|
|
7
|
+
import { PopUpWarning } from 'strapi-helper-plugin';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import pluginId from '../../../pluginId';
|
|
10
|
+
import { getTrad } from '../../../utils';
|
|
11
|
+
import { DeleteButton } from '../components';
|
|
12
|
+
import { connect, select } from './utils';
|
|
13
|
+
|
|
14
|
+
const DeleteLink = ({ isCreatingEntry, onDelete, onDeleteSucceeded, trackerProperty }) => {
|
|
15
|
+
const [showWarningDelete, setWarningDelete] = useState(false);
|
|
16
|
+
const [didDeleteEntry, setDidDeleteEntry] = useState(false);
|
|
17
|
+
const [isModalConfirmButtonLoading, setIsModalConfirmButtonLoading] = useState(false);
|
|
18
|
+
const { formatMessage } = useIntl();
|
|
19
|
+
|
|
20
|
+
const toggleWarningDelete = () => setWarningDelete(prevState => !prevState);
|
|
21
|
+
|
|
22
|
+
const handleConfirmDelete = async () => {
|
|
23
|
+
try {
|
|
24
|
+
// Show the loading state
|
|
25
|
+
setIsModalConfirmButtonLoading(true);
|
|
26
|
+
|
|
27
|
+
await onDelete(trackerProperty);
|
|
28
|
+
|
|
29
|
+
// This is used to perform action after the modal is closed
|
|
30
|
+
// so the transitions are smoother
|
|
31
|
+
// Actions will be performed in the handleClosed function
|
|
32
|
+
setDidDeleteEntry(true);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
const errorMessage = get(
|
|
35
|
+
err,
|
|
36
|
+
'response.payload.message',
|
|
37
|
+
formatMessage({ id: `${pluginId}.error.record.delete` })
|
|
38
|
+
);
|
|
39
|
+
strapi.notification.error(errorMessage);
|
|
40
|
+
} finally {
|
|
41
|
+
setIsModalConfirmButtonLoading(false);
|
|
42
|
+
toggleWarningDelete();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const handleClosed = () => {
|
|
47
|
+
setDidDeleteEntry(false);
|
|
48
|
+
|
|
49
|
+
if (didDeleteEntry) {
|
|
50
|
+
onDeleteSucceeded();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (isCreatingEntry) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<li>
|
|
61
|
+
<DeleteButton onClick={toggleWarningDelete}>
|
|
62
|
+
<FontAwesomeIcon icon="trash-alt" />
|
|
63
|
+
<Text lineHeight="22px" color="lightOrange">
|
|
64
|
+
{formatMessage({
|
|
65
|
+
id: getTrad('containers.Edit.delete-entry'),
|
|
66
|
+
})}
|
|
67
|
+
</Text>
|
|
68
|
+
</DeleteButton>
|
|
69
|
+
</li>
|
|
70
|
+
<PopUpWarning
|
|
71
|
+
isOpen={showWarningDelete}
|
|
72
|
+
toggleModal={toggleWarningDelete}
|
|
73
|
+
content={{
|
|
74
|
+
message: getTrad('popUpWarning.bodyMessage.contentType.delete'),
|
|
75
|
+
}}
|
|
76
|
+
popUpWarningType="danger"
|
|
77
|
+
onConfirm={handleConfirmDelete}
|
|
78
|
+
onClosed={handleClosed}
|
|
79
|
+
isConfirmButtonLoading={isModalConfirmButtonLoading}
|
|
80
|
+
/>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
DeleteLink.propTypes = {
|
|
86
|
+
isCreatingEntry: PropTypes.bool.isRequired,
|
|
87
|
+
onDelete: PropTypes.func.isRequired,
|
|
88
|
+
onDeleteSucceeded: PropTypes.func.isRequired,
|
|
89
|
+
trackerProperty: PropTypes.object.isRequired,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const Memoized = memo(DeleteLink, isEqual);
|
|
93
|
+
|
|
94
|
+
export default connect(Memoized, select);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function connect(WrappedComponent, select) {
|
|
4
|
+
return function(props) {
|
|
5
|
+
// eslint-disable-next-line react/prop-types
|
|
6
|
+
const selectors = select();
|
|
7
|
+
|
|
8
|
+
return <WrappedComponent {...props} {...selectors} />;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default connect;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isEmpty } from 'lodash';
|
|
2
|
+
import { useContentManagerEditViewDataManager } from 'strapi-helper-plugin';
|
|
3
|
+
|
|
4
|
+
function useSelect() {
|
|
5
|
+
const { hasDraftAndPublish, modifiedData } = useContentManagerEditViewDataManager();
|
|
6
|
+
|
|
7
|
+
let trackerProperty = {};
|
|
8
|
+
|
|
9
|
+
if (hasDraftAndPublish) {
|
|
10
|
+
const isDraft = isEmpty(modifiedData.published_at);
|
|
11
|
+
|
|
12
|
+
trackerProperty = isDraft ? { status: 'draft' } : { status: 'published' };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
hasDraftAndPublish,
|
|
17
|
+
trackerProperty,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default useSelect;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { Header as PluginHeader } from '@buffetjs/custom';
|
|
4
|
+
import { get, isEqual, isEmpty, toString } from 'lodash';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import isEqualFastCompare from 'react-fast-compare';
|
|
7
|
+
import { Text } from '@buffetjs/core';
|
|
8
|
+
import { templateObject, ModalConfirm } from 'strapi-helper-plugin';
|
|
9
|
+
import { getTrad } from '../../../utils';
|
|
10
|
+
import { connect, getDraftRelations, select } from './utils';
|
|
11
|
+
|
|
12
|
+
const primaryButtonObject = {
|
|
13
|
+
color: 'primary',
|
|
14
|
+
type: 'button',
|
|
15
|
+
style: {
|
|
16
|
+
minWidth: 150,
|
|
17
|
+
fontWeight: 600,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const Header = ({
|
|
22
|
+
allowedActions: { canUpdate, canCreate, canPublish },
|
|
23
|
+
componentLayouts,
|
|
24
|
+
initialData,
|
|
25
|
+
isCreatingEntry,
|
|
26
|
+
isSingleType,
|
|
27
|
+
hasDraftAndPublish,
|
|
28
|
+
layout,
|
|
29
|
+
modifiedData,
|
|
30
|
+
onPublish,
|
|
31
|
+
onUnpublish,
|
|
32
|
+
status,
|
|
33
|
+
}) => {
|
|
34
|
+
const [showWarningUnpublish, setWarningUnpublish] = useState(false);
|
|
35
|
+
const { formatMessage } = useIntl();
|
|
36
|
+
const formatMessageRef = useRef(formatMessage);
|
|
37
|
+
const [draftRelationsCount, setDraftRelationsCount] = useState(0);
|
|
38
|
+
const [showWarningDraftRelation, setShowWarningDraftRelation] = useState(false);
|
|
39
|
+
const [shouldUnpublish, setShouldUnpublish] = useState(false);
|
|
40
|
+
const [shouldPublish, setShouldPublish] = useState(false);
|
|
41
|
+
|
|
42
|
+
const currentContentTypeMainField = useMemo(() => get(layout, ['settings', 'mainField'], 'id'), [
|
|
43
|
+
layout,
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const currentContentTypeName = useMemo(() => get(layout, ['info', 'name']), [layout]);
|
|
47
|
+
|
|
48
|
+
const didChangeData = useMemo(() => {
|
|
49
|
+
return !isEqual(initialData, modifiedData) || (isCreatingEntry && !isEmpty(modifiedData));
|
|
50
|
+
}, [initialData, isCreatingEntry, modifiedData]);
|
|
51
|
+
const apiID = useMemo(() => layout.apiID, [layout.apiID]);
|
|
52
|
+
|
|
53
|
+
/* eslint-disable indent */
|
|
54
|
+
const entryHeaderTitle = isCreatingEntry
|
|
55
|
+
? formatMessage({
|
|
56
|
+
id: getTrad('containers.Edit.pluginHeader.title.new'),
|
|
57
|
+
})
|
|
58
|
+
: templateObject({ mainField: currentContentTypeMainField }, initialData).mainField;
|
|
59
|
+
/* eslint-enable indent */
|
|
60
|
+
|
|
61
|
+
const headerTitle = useMemo(() => {
|
|
62
|
+
const title = isSingleType ? currentContentTypeName : entryHeaderTitle;
|
|
63
|
+
|
|
64
|
+
return title || currentContentTypeName;
|
|
65
|
+
}, [currentContentTypeName, entryHeaderTitle, isSingleType]);
|
|
66
|
+
|
|
67
|
+
const checkIfHasDraftRelations = useCallback(() => {
|
|
68
|
+
const count = getDraftRelations(modifiedData, layout, componentLayouts);
|
|
69
|
+
|
|
70
|
+
setDraftRelationsCount(count);
|
|
71
|
+
|
|
72
|
+
return count > 0;
|
|
73
|
+
}, [modifiedData, layout, componentLayouts]);
|
|
74
|
+
|
|
75
|
+
const headerActions = useMemo(() => {
|
|
76
|
+
let headerActions = [];
|
|
77
|
+
|
|
78
|
+
if ((isCreatingEntry && canCreate) || (!isCreatingEntry && canUpdate)) {
|
|
79
|
+
headerActions = [
|
|
80
|
+
{
|
|
81
|
+
disabled: !didChangeData,
|
|
82
|
+
color: 'success',
|
|
83
|
+
label: formatMessage({
|
|
84
|
+
id: getTrad('containers.Edit.submit'),
|
|
85
|
+
}),
|
|
86
|
+
isLoading: status === 'submit-pending',
|
|
87
|
+
type: 'submit',
|
|
88
|
+
style: {
|
|
89
|
+
minWidth: 150,
|
|
90
|
+
fontWeight: 600,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (hasDraftAndPublish && canPublish) {
|
|
97
|
+
const isPublished = !isEmpty(initialData.published_at);
|
|
98
|
+
const isLoading = isPublished ? status === 'unpublish-pending' : status === 'publish-pending';
|
|
99
|
+
const labelID = isPublished ? 'app.utils.unpublish' : 'app.utils.publish';
|
|
100
|
+
/* eslint-disable indent */
|
|
101
|
+
const onClick = isPublished
|
|
102
|
+
? () => setWarningUnpublish(true)
|
|
103
|
+
: e => {
|
|
104
|
+
if (!checkIfHasDraftRelations()) {
|
|
105
|
+
onPublish(e);
|
|
106
|
+
} else {
|
|
107
|
+
setShowWarningDraftRelation(true);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
/* eslint-enable indent */
|
|
111
|
+
|
|
112
|
+
const action = {
|
|
113
|
+
...primaryButtonObject,
|
|
114
|
+
disabled: isCreatingEntry || didChangeData,
|
|
115
|
+
isLoading,
|
|
116
|
+
label: formatMessage({ id: labelID }),
|
|
117
|
+
onClick,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
headerActions.unshift(action);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return headerActions;
|
|
124
|
+
}, [
|
|
125
|
+
isCreatingEntry,
|
|
126
|
+
canCreate,
|
|
127
|
+
canUpdate,
|
|
128
|
+
hasDraftAndPublish,
|
|
129
|
+
canPublish,
|
|
130
|
+
didChangeData,
|
|
131
|
+
formatMessage,
|
|
132
|
+
status,
|
|
133
|
+
initialData,
|
|
134
|
+
onPublish,
|
|
135
|
+
checkIfHasDraftRelations,
|
|
136
|
+
]);
|
|
137
|
+
|
|
138
|
+
const headerProps = useMemo(() => {
|
|
139
|
+
return {
|
|
140
|
+
title: {
|
|
141
|
+
label: toString(headerTitle),
|
|
142
|
+
},
|
|
143
|
+
content: `${formatMessageRef.current({ id: getTrad('api.id') })} : ${apiID}`,
|
|
144
|
+
actions: headerActions,
|
|
145
|
+
};
|
|
146
|
+
}, [headerActions, headerTitle, apiID]);
|
|
147
|
+
|
|
148
|
+
const toggleWarningPublish = () => setWarningUnpublish(prevState => !prevState);
|
|
149
|
+
|
|
150
|
+
const toggleWarningDraftRelation = useCallback(() => {
|
|
151
|
+
setShowWarningDraftRelation(prev => !prev);
|
|
152
|
+
}, []);
|
|
153
|
+
|
|
154
|
+
const handleConfirmPublish = useCallback(() => {
|
|
155
|
+
setShouldPublish(true);
|
|
156
|
+
setShowWarningDraftRelation(false);
|
|
157
|
+
}, []);
|
|
158
|
+
|
|
159
|
+
const handleConfirmUnpublish = useCallback(() => {
|
|
160
|
+
setShouldUnpublish(true);
|
|
161
|
+
setWarningUnpublish(false);
|
|
162
|
+
}, []);
|
|
163
|
+
|
|
164
|
+
const handleCloseModalPublish = useCallback(
|
|
165
|
+
e => {
|
|
166
|
+
if (shouldPublish) {
|
|
167
|
+
onPublish(e);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
setShouldUnpublish(false);
|
|
171
|
+
},
|
|
172
|
+
[onPublish, shouldPublish]
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
const handleCloseModalUnpublish = useCallback(
|
|
176
|
+
e => {
|
|
177
|
+
if (shouldUnpublish) {
|
|
178
|
+
onUnpublish(e);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
setShouldUnpublish(false);
|
|
182
|
+
},
|
|
183
|
+
[onUnpublish, shouldUnpublish]
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
const contentIdSuffix = draftRelationsCount > 1 ? 'plural' : 'singular';
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<>
|
|
190
|
+
<PluginHeader {...headerProps} />
|
|
191
|
+
{hasDraftAndPublish && (
|
|
192
|
+
<>
|
|
193
|
+
<ModalConfirm
|
|
194
|
+
isOpen={showWarningUnpublish}
|
|
195
|
+
toggle={toggleWarningPublish}
|
|
196
|
+
content={{
|
|
197
|
+
id: getTrad('popUpWarning.warning.unpublish'),
|
|
198
|
+
values: {
|
|
199
|
+
br: () => <br />,
|
|
200
|
+
},
|
|
201
|
+
}}
|
|
202
|
+
type="xwarning"
|
|
203
|
+
onConfirm={handleConfirmUnpublish}
|
|
204
|
+
onClosed={handleCloseModalUnpublish}
|
|
205
|
+
>
|
|
206
|
+
<Text>{formatMessage({ id: getTrad('popUpWarning.warning.unpublish-question') })}</Text>
|
|
207
|
+
</ModalConfirm>
|
|
208
|
+
<ModalConfirm
|
|
209
|
+
confirmButtonLabel={{
|
|
210
|
+
id: getTrad('popUpwarning.warning.has-draft-relations.button-confirm'),
|
|
211
|
+
}}
|
|
212
|
+
isOpen={showWarningDraftRelation}
|
|
213
|
+
toggle={toggleWarningDraftRelation}
|
|
214
|
+
onClosed={handleCloseModalPublish}
|
|
215
|
+
onConfirm={handleConfirmPublish}
|
|
216
|
+
type="success"
|
|
217
|
+
content={{
|
|
218
|
+
id: getTrad(`popUpwarning.warning.has-draft-relations.message.${contentIdSuffix}`),
|
|
219
|
+
values: {
|
|
220
|
+
count: draftRelationsCount,
|
|
221
|
+
b: chunks => (
|
|
222
|
+
<Text as="span" fontWeight="bold">
|
|
223
|
+
{chunks}
|
|
224
|
+
</Text>
|
|
225
|
+
),
|
|
226
|
+
br: () => <br />,
|
|
227
|
+
},
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
<Text>{formatMessage({ id: getTrad('popUpWarning.warning.publish-question') })}</Text>
|
|
231
|
+
</ModalConfirm>
|
|
232
|
+
</>
|
|
233
|
+
)}
|
|
234
|
+
</>
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
Header.propTypes = {
|
|
239
|
+
allowedActions: PropTypes.shape({
|
|
240
|
+
canUpdate: PropTypes.bool.isRequired,
|
|
241
|
+
canCreate: PropTypes.bool.isRequired,
|
|
242
|
+
canPublish: PropTypes.bool.isRequired,
|
|
243
|
+
}).isRequired,
|
|
244
|
+
componentLayouts: PropTypes.object.isRequired,
|
|
245
|
+
initialData: PropTypes.object.isRequired,
|
|
246
|
+
isCreatingEntry: PropTypes.bool.isRequired,
|
|
247
|
+
isSingleType: PropTypes.bool.isRequired,
|
|
248
|
+
status: PropTypes.string.isRequired,
|
|
249
|
+
layout: PropTypes.object.isRequired,
|
|
250
|
+
hasDraftAndPublish: PropTypes.bool.isRequired,
|
|
251
|
+
modifiedData: PropTypes.object.isRequired,
|
|
252
|
+
onPublish: PropTypes.func.isRequired,
|
|
253
|
+
onUnpublish: PropTypes.func.isRequired,
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const Memoized = memo(Header, isEqualFastCompare);
|
|
257
|
+
|
|
258
|
+
export default connect(Memoized, select);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function connect(WrappedComponent, select) {
|
|
4
|
+
return function(props) {
|
|
5
|
+
// eslint-disable-next-line react/prop-types
|
|
6
|
+
const selectors = select();
|
|
7
|
+
|
|
8
|
+
return <WrappedComponent {...props} {...selectors} />;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default connect;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { get, has, isEmpty, isNil } from 'lodash';
|
|
2
|
+
|
|
3
|
+
const getDraftRelations = (data, ctSchema, components) => {
|
|
4
|
+
const getDraftRelationsCount = (data, schema) =>
|
|
5
|
+
Object.keys(data).reduce((acc, current) => {
|
|
6
|
+
const type = get(schema, ['attributes', current, 'type'], 'string');
|
|
7
|
+
const relationType = get(schema, ['attributes', current, 'relationType'], '');
|
|
8
|
+
const isMorph = relationType.toLowerCase().includes('morph');
|
|
9
|
+
const oneWayTypes = ['oneWay', 'oneToOne', 'manyToOne'];
|
|
10
|
+
const currentData = data[current];
|
|
11
|
+
|
|
12
|
+
if (isNil(currentData)) {
|
|
13
|
+
return acc;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (type === 'dynamiczone') {
|
|
17
|
+
currentData.forEach(curr => {
|
|
18
|
+
const compoSchema = get(components, curr.__component, {});
|
|
19
|
+
|
|
20
|
+
acc += getDraftRelationsCount(curr, compoSchema);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (type === 'component') {
|
|
25
|
+
const isRepeatable = get(schema, ['attributes', current, 'repeatable'], false);
|
|
26
|
+
const compoUID = get(schema, ['attributes', current, 'component'], '');
|
|
27
|
+
const compoSchema = get(components, compoUID, {});
|
|
28
|
+
|
|
29
|
+
if (isRepeatable) {
|
|
30
|
+
currentData.forEach(curr => {
|
|
31
|
+
acc += getDraftRelationsCount(curr, compoSchema);
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
acc += getDraftRelationsCount(currentData, compoSchema);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (type === 'relation' && !isMorph) {
|
|
39
|
+
if (oneWayTypes.includes(relationType)) {
|
|
40
|
+
const hasDraftAndPublish = has(currentData, 'published_at');
|
|
41
|
+
|
|
42
|
+
if (hasDraftAndPublish && isEmpty(currentData.published_at)) {
|
|
43
|
+
acc += 1;
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
currentData.forEach(value => {
|
|
47
|
+
if (has(value, 'published_at') && isEmpty(value.published_at)) {
|
|
48
|
+
acc += 1;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return acc;
|
|
55
|
+
}, 0);
|
|
56
|
+
|
|
57
|
+
const count = getDraftRelationsCount(data, ctSchema, components);
|
|
58
|
+
|
|
59
|
+
return count;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default getDraftRelations;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useContentManagerEditViewDataManager } from 'strapi-helper-plugin';
|
|
2
|
+
|
|
3
|
+
function useSelect() {
|
|
4
|
+
const {
|
|
5
|
+
allLayoutData,
|
|
6
|
+
initialData,
|
|
7
|
+
isCreatingEntry,
|
|
8
|
+
isSingleType,
|
|
9
|
+
status,
|
|
10
|
+
layout,
|
|
11
|
+
hasDraftAndPublish,
|
|
12
|
+
modifiedData,
|
|
13
|
+
onPublish,
|
|
14
|
+
onUnpublish,
|
|
15
|
+
} = useContentManagerEditViewDataManager();
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
componentLayouts: allLayoutData.components,
|
|
19
|
+
initialData,
|
|
20
|
+
isCreatingEntry,
|
|
21
|
+
isSingleType,
|
|
22
|
+
status,
|
|
23
|
+
layout,
|
|
24
|
+
hasDraftAndPublish,
|
|
25
|
+
modifiedData,
|
|
26
|
+
onPublish,
|
|
27
|
+
onUnpublish,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default useSelect;
|