@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,105 @@
|
|
|
1
|
+
/* eslint-disable indent */
|
|
2
|
+
/* eslint-disable no-nested-ternary */
|
|
3
|
+
|
|
4
|
+
const styles = {
|
|
5
|
+
container: base => ({ ...base, background: '#ffffff' }),
|
|
6
|
+
control: (base, state) => {
|
|
7
|
+
const borderRadiusStyle = state.selectProps.menuIsOpen
|
|
8
|
+
? {
|
|
9
|
+
borderBottomLeftRadius: '0 !important',
|
|
10
|
+
borderBottomRightRadius: '0 !important',
|
|
11
|
+
}
|
|
12
|
+
: {};
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
selectProps: { error, value },
|
|
16
|
+
} = state;
|
|
17
|
+
|
|
18
|
+
let border;
|
|
19
|
+
let borderBottom;
|
|
20
|
+
let backgroundColor;
|
|
21
|
+
|
|
22
|
+
if (state.isFocused) {
|
|
23
|
+
border = '1px solid #78caff !important';
|
|
24
|
+
} else if (error && !value.length) {
|
|
25
|
+
border = '1px solid #f64d0a !important';
|
|
26
|
+
} else {
|
|
27
|
+
border = '1px solid #e3e9f3 !important';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (state.menuIsOpen === true) {
|
|
31
|
+
borderBottom = '1px solid #e3e9f3 !important';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (state.isDisabled) {
|
|
35
|
+
backgroundColor = '#fafafb !important';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
...base,
|
|
40
|
+
fontSize: 13,
|
|
41
|
+
height: 34,
|
|
42
|
+
minHeight: 34,
|
|
43
|
+
border,
|
|
44
|
+
outline: 0,
|
|
45
|
+
boxShadow: 0,
|
|
46
|
+
borderRadius: '2px !important',
|
|
47
|
+
...borderRadiusStyle,
|
|
48
|
+
borderBottom,
|
|
49
|
+
backgroundColor,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
input: base => ({ ...base, marginLeft: 10 }),
|
|
53
|
+
menu: base => {
|
|
54
|
+
return {
|
|
55
|
+
...base,
|
|
56
|
+
width: '100%',
|
|
57
|
+
margin: '0',
|
|
58
|
+
paddingTop: 0,
|
|
59
|
+
borderRadius: '2px !important',
|
|
60
|
+
borderTopLeftRadius: '0 !important',
|
|
61
|
+
borderTopRightRadius: '0 !important',
|
|
62
|
+
border: '1px solid #78caff !important',
|
|
63
|
+
boxShadow: 0,
|
|
64
|
+
borderTop: '0 !important',
|
|
65
|
+
fontSize: '13px',
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
menuList: base => ({
|
|
69
|
+
...base,
|
|
70
|
+
maxHeight: '112px',
|
|
71
|
+
paddingTop: 2,
|
|
72
|
+
}),
|
|
73
|
+
option: (base, state) => {
|
|
74
|
+
return {
|
|
75
|
+
...base,
|
|
76
|
+
height: 36,
|
|
77
|
+
backgroundColor: state.isFocused ? '#f6f6f6' : '#fff',
|
|
78
|
+
':active': {
|
|
79
|
+
...base[':active'],
|
|
80
|
+
backgroundColor: '#f6f6f6',
|
|
81
|
+
},
|
|
82
|
+
color: '#333740',
|
|
83
|
+
fontWeight: state.isFocused ? '600' : '400',
|
|
84
|
+
cursor: 'pointer',
|
|
85
|
+
WebkitFontSmoothing: 'antialiased',
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
placeholder: base => ({
|
|
89
|
+
...base,
|
|
90
|
+
marginTop: 0,
|
|
91
|
+
marginLeft: 10,
|
|
92
|
+
color: '#aaa',
|
|
93
|
+
overflow: 'hidden',
|
|
94
|
+
whiteSpace: 'nowrap',
|
|
95
|
+
textOverflow: 'ellipsis',
|
|
96
|
+
maxWidth: 'calc(100% - 32px)',
|
|
97
|
+
}),
|
|
98
|
+
valueContainer: base => ({
|
|
99
|
+
...base,
|
|
100
|
+
padding: '2px 0px 4px 0px',
|
|
101
|
+
lineHeight: '18px',
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default styles;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import React, { useState, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { get, isEqual, upperFirst } from 'lodash';
|
|
4
|
+
import { withRouter } from 'react-router-dom';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import { Inputs as Input, Header } from '@buffetjs/custom';
|
|
7
|
+
import {
|
|
8
|
+
BackHeader,
|
|
9
|
+
LoadingIndicatorPage,
|
|
10
|
+
ModalConfirm,
|
|
11
|
+
PopUpWarning,
|
|
12
|
+
// contexts
|
|
13
|
+
useGlobalContext,
|
|
14
|
+
} from 'strapi-helper-plugin';
|
|
15
|
+
import pluginId from '../../pluginId';
|
|
16
|
+
import Block from '../Block';
|
|
17
|
+
import Container from '../Container';
|
|
18
|
+
import SectionTitle from '../SectionTitle';
|
|
19
|
+
import Separator from '../Separator';
|
|
20
|
+
|
|
21
|
+
const SettingsViewWrapper = ({
|
|
22
|
+
children,
|
|
23
|
+
history: { goBack },
|
|
24
|
+
displayedFields,
|
|
25
|
+
inputs,
|
|
26
|
+
initialData,
|
|
27
|
+
isEditSettings,
|
|
28
|
+
isLoading,
|
|
29
|
+
modifiedData,
|
|
30
|
+
name,
|
|
31
|
+
onChange,
|
|
32
|
+
onConfirmReset,
|
|
33
|
+
onConfirmSubmit,
|
|
34
|
+
onModalConfirmClosed,
|
|
35
|
+
}) => {
|
|
36
|
+
const { emitEvent, formatMessage } = useGlobalContext();
|
|
37
|
+
const [showWarningCancel, setWarningCancel] = useState(false);
|
|
38
|
+
const [showWarningSubmit, setWarningSubmit] = useState(false);
|
|
39
|
+
|
|
40
|
+
const attributes = useMemo(() => {
|
|
41
|
+
return get(modifiedData, ['attributes'], {});
|
|
42
|
+
}, [modifiedData]);
|
|
43
|
+
|
|
44
|
+
const toggleWarningCancel = () => setWarningCancel(prevState => !prevState);
|
|
45
|
+
const toggleWarningSubmit = () => setWarningSubmit(prevState => !prevState);
|
|
46
|
+
|
|
47
|
+
const getPluginHeaderActions = () => {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
color: 'cancel',
|
|
51
|
+
onClick: toggleWarningCancel,
|
|
52
|
+
label: formatMessage({
|
|
53
|
+
id: 'app.components.Button.reset',
|
|
54
|
+
}),
|
|
55
|
+
type: 'button',
|
|
56
|
+
disabled: isEqual(modifiedData, initialData),
|
|
57
|
+
style: {
|
|
58
|
+
fontWeight: 600,
|
|
59
|
+
paddingLeft: 15,
|
|
60
|
+
paddingRight: 15,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
color: 'success',
|
|
65
|
+
label: formatMessage({
|
|
66
|
+
id: `${pluginId}.containers.Edit.submit`,
|
|
67
|
+
}),
|
|
68
|
+
type: 'submit',
|
|
69
|
+
disabled: isEqual(modifiedData, initialData),
|
|
70
|
+
style: {
|
|
71
|
+
minWidth: 150,
|
|
72
|
+
fontWeight: 600,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const headerProps = {
|
|
79
|
+
actions: getPluginHeaderActions(),
|
|
80
|
+
title: {
|
|
81
|
+
label: formatMessage(
|
|
82
|
+
{
|
|
83
|
+
id: `${pluginId}.components.SettingsViewWrapper.pluginHeader.title`,
|
|
84
|
+
},
|
|
85
|
+
{ name: upperFirst(name) }
|
|
86
|
+
),
|
|
87
|
+
},
|
|
88
|
+
content: formatMessage({
|
|
89
|
+
id: `${pluginId}.components.SettingsViewWrapper.pluginHeader.description.${
|
|
90
|
+
isEditSettings ? 'edit' : 'list'
|
|
91
|
+
}-settings`,
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const getSelectOptions = input => {
|
|
96
|
+
if (input.name === 'settings.defaultSortBy') {
|
|
97
|
+
return [
|
|
98
|
+
'id',
|
|
99
|
+
...displayedFields.filter(name => {
|
|
100
|
+
const type = get(attributes, [name, 'type']);
|
|
101
|
+
|
|
102
|
+
return !['media', 'richtext', 'dynamiczone', 'relation'].includes(type) && name !== 'id';
|
|
103
|
+
}),
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (input.name === 'settings.mainField') {
|
|
108
|
+
const options = Object.keys(attributes).filter(attr => {
|
|
109
|
+
const type = get(attributes, [attr, 'type'], '');
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
![
|
|
113
|
+
'dynamiczone',
|
|
114
|
+
'json',
|
|
115
|
+
'text',
|
|
116
|
+
'relation',
|
|
117
|
+
'component',
|
|
118
|
+
'boolean',
|
|
119
|
+
'date',
|
|
120
|
+
'media',
|
|
121
|
+
'richtext',
|
|
122
|
+
'timestamp',
|
|
123
|
+
].includes(type) && !!type
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return options;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return input.options;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const handleSubmit = e => {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
toggleWarningSubmit();
|
|
136
|
+
emitEvent('willSaveContentTypeLayout');
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
if (isLoading) {
|
|
140
|
+
return <LoadingIndicatorPage />;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<>
|
|
145
|
+
<BackHeader onClick={goBack} />
|
|
146
|
+
<Container className="container-fluid">
|
|
147
|
+
<form onSubmit={handleSubmit}>
|
|
148
|
+
<Header {...headerProps} />
|
|
149
|
+
<div
|
|
150
|
+
className="row"
|
|
151
|
+
style={{
|
|
152
|
+
paddingTop: '3px',
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
155
|
+
<Block
|
|
156
|
+
style={{
|
|
157
|
+
marginBottom: '13px',
|
|
158
|
+
paddingBottom: '30px',
|
|
159
|
+
paddingTop: '24px',
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
<SectionTitle isSettings />
|
|
163
|
+
<div className="row">
|
|
164
|
+
{inputs.map(input => {
|
|
165
|
+
return (
|
|
166
|
+
<FormattedMessage key={input.name} id={input.label.id}>
|
|
167
|
+
{label => (
|
|
168
|
+
<div className={input.customBootstrapClass}>
|
|
169
|
+
<FormattedMessage
|
|
170
|
+
id={get(input, 'description.id', 'app.utils.defaultMessage')}
|
|
171
|
+
>
|
|
172
|
+
{description => (
|
|
173
|
+
<Input
|
|
174
|
+
{...input}
|
|
175
|
+
description={description}
|
|
176
|
+
label={label === ' ' ? null : label}
|
|
177
|
+
onChange={onChange}
|
|
178
|
+
options={getSelectOptions(input)}
|
|
179
|
+
value={get(modifiedData, input.name, '')}
|
|
180
|
+
/>
|
|
181
|
+
)}
|
|
182
|
+
</FormattedMessage>
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
</FormattedMessage>
|
|
186
|
+
);
|
|
187
|
+
})}
|
|
188
|
+
<div className="col-12">
|
|
189
|
+
<Separator style={{ marginBottom: 20 }} />
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
<SectionTitle />
|
|
193
|
+
{children}
|
|
194
|
+
</Block>
|
|
195
|
+
</div>
|
|
196
|
+
<PopUpWarning
|
|
197
|
+
isOpen={showWarningCancel}
|
|
198
|
+
toggleModal={toggleWarningCancel}
|
|
199
|
+
content={{
|
|
200
|
+
message: `${pluginId}.popUpWarning.warning.cancelAllSettings`,
|
|
201
|
+
}}
|
|
202
|
+
popUpWarningType="danger"
|
|
203
|
+
onConfirm={() => {
|
|
204
|
+
onConfirmReset();
|
|
205
|
+
toggleWarningCancel();
|
|
206
|
+
}}
|
|
207
|
+
/>
|
|
208
|
+
<ModalConfirm
|
|
209
|
+
isOpen={showWarningSubmit}
|
|
210
|
+
toggle={toggleWarningSubmit}
|
|
211
|
+
content={{
|
|
212
|
+
id: `${pluginId}.popUpWarning.warning.updateAllSettings`,
|
|
213
|
+
}}
|
|
214
|
+
type="success"
|
|
215
|
+
onConfirm={async () => {
|
|
216
|
+
await onConfirmSubmit();
|
|
217
|
+
toggleWarningSubmit();
|
|
218
|
+
}}
|
|
219
|
+
onClosed={() => {
|
|
220
|
+
if (onModalConfirmClosed) {
|
|
221
|
+
onModalConfirmClosed();
|
|
222
|
+
}
|
|
223
|
+
}}
|
|
224
|
+
/>
|
|
225
|
+
</form>
|
|
226
|
+
</Container>
|
|
227
|
+
</>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
SettingsViewWrapper.defaultProps = {
|
|
232
|
+
displayedFields: [],
|
|
233
|
+
inputs: [],
|
|
234
|
+
initialData: {},
|
|
235
|
+
isEditSettings: false,
|
|
236
|
+
modifiedData: {},
|
|
237
|
+
name: '',
|
|
238
|
+
onConfirmReset: () => {},
|
|
239
|
+
onConfirmSubmit: async () => {},
|
|
240
|
+
onModalConfirmClosed: null,
|
|
241
|
+
onSubmit: () => {},
|
|
242
|
+
pluginHeaderProps: {
|
|
243
|
+
actions: [],
|
|
244
|
+
description: {
|
|
245
|
+
id: 'app.utils.defaultMessage',
|
|
246
|
+
},
|
|
247
|
+
title: {
|
|
248
|
+
id: 'app.utils.defaultMessage',
|
|
249
|
+
values: {},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
SettingsViewWrapper.propTypes = {
|
|
255
|
+
children: PropTypes.node.isRequired,
|
|
256
|
+
displayedFields: PropTypes.array,
|
|
257
|
+
history: PropTypes.shape({
|
|
258
|
+
goBack: PropTypes.func.isRequired,
|
|
259
|
+
}).isRequired,
|
|
260
|
+
initialData: PropTypes.object,
|
|
261
|
+
inputs: PropTypes.array,
|
|
262
|
+
isEditSettings: PropTypes.bool,
|
|
263
|
+
isLoading: PropTypes.bool.isRequired,
|
|
264
|
+
modifiedData: PropTypes.object,
|
|
265
|
+
name: PropTypes.string,
|
|
266
|
+
onChange: PropTypes.func.isRequired,
|
|
267
|
+
onConfirmReset: PropTypes.func,
|
|
268
|
+
onConfirmSubmit: PropTypes.func,
|
|
269
|
+
onModalConfirmClosed: PropTypes.func,
|
|
270
|
+
onSubmit: PropTypes.func,
|
|
271
|
+
pluginHeaderProps: PropTypes.shape({
|
|
272
|
+
actions: PropTypes.array,
|
|
273
|
+
description: PropTypes.shape({
|
|
274
|
+
id: PropTypes.string,
|
|
275
|
+
}),
|
|
276
|
+
title: PropTypes.shape({
|
|
277
|
+
id: PropTypes.string,
|
|
278
|
+
values: PropTypes.object,
|
|
279
|
+
}),
|
|
280
|
+
}),
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export default withRouter(SettingsViewWrapper);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { useDrag, useDrop } from 'react-dnd';
|
|
3
|
+
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { get } from 'lodash';
|
|
6
|
+
import useLayoutDnd from '../../hooks/useLayoutDnd';
|
|
7
|
+
|
|
8
|
+
import DraggedFieldWithPreview from '../DraggedFieldWithPreview';
|
|
9
|
+
|
|
10
|
+
import ItemTypes from '../../utils/ItemTypes';
|
|
11
|
+
|
|
12
|
+
const Item = ({ index, move, name, removeItem }) => {
|
|
13
|
+
const {
|
|
14
|
+
goTo,
|
|
15
|
+
metadatas,
|
|
16
|
+
selectedItemName,
|
|
17
|
+
setEditFieldToSelect,
|
|
18
|
+
setIsDraggingSibling,
|
|
19
|
+
} = useLayoutDnd();
|
|
20
|
+
const dragRef = useRef(null);
|
|
21
|
+
const dropRef = useRef(null);
|
|
22
|
+
|
|
23
|
+
// from: https://codesandbox.io/s/github/react-dnd/react-dnd/tree/gh-pages/examples_hooks_js/04-sortable/simple?from-embed
|
|
24
|
+
const [, drop] = useDrop({
|
|
25
|
+
accept: ItemTypes.EDIT_RELATION,
|
|
26
|
+
hover(item, monitor) {
|
|
27
|
+
if (!dropRef.current) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const dragIndex = item.index;
|
|
31
|
+
const hoverIndex = index;
|
|
32
|
+
|
|
33
|
+
// Don't replace items with themselves
|
|
34
|
+
if (dragIndex === hoverIndex) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Determine rectangle on screen
|
|
38
|
+
const hoverBoundingRect = dropRef.current.getBoundingClientRect();
|
|
39
|
+
// Get vertical middle
|
|
40
|
+
const hoverMiddleY =
|
|
41
|
+
(hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
42
|
+
// Determine mouse position
|
|
43
|
+
const clientOffset = monitor.getClientOffset();
|
|
44
|
+
// Get pixels to the top
|
|
45
|
+
const hoverClientY = clientOffset.y - hoverBoundingRect.top;
|
|
46
|
+
|
|
47
|
+
// Only perform the move when the mouse has crossed half of the items height
|
|
48
|
+
// When dragging downwards, only move when the cursor is below 50%
|
|
49
|
+
// When dragging upwards, only move when the cursor is above 50%
|
|
50
|
+
// Dragging downwards
|
|
51
|
+
if (dragIndex < hoverIndex && hoverClientY < hoverMiddleY) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// Dragging upwards
|
|
55
|
+
if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// Time to actually perform the action
|
|
59
|
+
move(dragIndex, hoverIndex);
|
|
60
|
+
// Note: we're mutating the monitor item here!
|
|
61
|
+
// Generally it's better to avoid mutations,
|
|
62
|
+
// but it's good here for the sake of performance
|
|
63
|
+
// to avoid expensive index searches.
|
|
64
|
+
item.index = hoverIndex;
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const [{ isDragging }, drag, preview] = useDrag({
|
|
68
|
+
item: { type: ItemTypes.EDIT_RELATION, id: name, name, index },
|
|
69
|
+
begin: () => {
|
|
70
|
+
// Remove the over state from other components
|
|
71
|
+
// Since it's a dynamic list where items are replaced on the fly we need to disable all the over state
|
|
72
|
+
setIsDraggingSibling(true);
|
|
73
|
+
},
|
|
74
|
+
end: () => {
|
|
75
|
+
setIsDraggingSibling(false);
|
|
76
|
+
},
|
|
77
|
+
collect: monitor => ({
|
|
78
|
+
isDragging: monitor.isDragging(),
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
preview(getEmptyImage(), { captureDraggingState: false });
|
|
84
|
+
}, [preview]);
|
|
85
|
+
|
|
86
|
+
// Create the refs
|
|
87
|
+
// We need 1 for the drop target
|
|
88
|
+
// 1 for the drag target
|
|
89
|
+
const refs = {
|
|
90
|
+
dragRef: drag(dragRef),
|
|
91
|
+
dropRef: drop(dropRef),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<DraggedFieldWithPreview
|
|
96
|
+
isDragging={isDragging}
|
|
97
|
+
label={get(metadatas, [name, 'edit', 'label'], '')}
|
|
98
|
+
name={name}
|
|
99
|
+
onClickEdit={() => setEditFieldToSelect(name)}
|
|
100
|
+
onClickRemove={e => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
removeItem(index);
|
|
103
|
+
}}
|
|
104
|
+
push={goTo}
|
|
105
|
+
ref={refs}
|
|
106
|
+
selectedItem={selectedItemName}
|
|
107
|
+
size={12}
|
|
108
|
+
style={{ marginBottom: 6, paddingLeft: 5, paddingRight: 5 }}
|
|
109
|
+
type="relation"
|
|
110
|
+
i={index === 0}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
Item.defaultProps = {
|
|
116
|
+
move: () => {},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
Item.propTypes = {
|
|
120
|
+
index: PropTypes.number.isRequired,
|
|
121
|
+
move: PropTypes.func,
|
|
122
|
+
name: PropTypes.string.isRequired,
|
|
123
|
+
removeItem: PropTypes.func.isRequired,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default Item;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import useLayoutDnd from '../../hooks/useLayoutDnd';
|
|
4
|
+
|
|
5
|
+
import Add from '../AddDropdown';
|
|
6
|
+
import SortWrapper from '../SortWrapper';
|
|
7
|
+
import Item from './Item';
|
|
8
|
+
|
|
9
|
+
const SortableList = ({ addItem, buttonData, moveItem, removeItem }) => {
|
|
10
|
+
const { relationsLayout } = useLayoutDnd();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className="col-4">
|
|
14
|
+
<SortWrapper
|
|
15
|
+
style={{
|
|
16
|
+
marginTop: 7,
|
|
17
|
+
paddingTop: 11,
|
|
18
|
+
paddingLeft: 5,
|
|
19
|
+
paddingRight: 5,
|
|
20
|
+
border: '1px dashed #e3e9f3',
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
{relationsLayout.map((relationName, index) => {
|
|
24
|
+
return (
|
|
25
|
+
<Item
|
|
26
|
+
index={index}
|
|
27
|
+
key={relationName}
|
|
28
|
+
move={moveItem}
|
|
29
|
+
name={relationName}
|
|
30
|
+
removeItem={removeItem}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
})}
|
|
34
|
+
<Add
|
|
35
|
+
data={buttonData}
|
|
36
|
+
isRelation
|
|
37
|
+
onClick={addItem}
|
|
38
|
+
style={{
|
|
39
|
+
marginLeft: 10,
|
|
40
|
+
marginRight: 10,
|
|
41
|
+
marginBottom: 13,
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
</SortWrapper>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
SortableList.defaultProps = {
|
|
50
|
+
buttonData: [],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
SortableList.propTypes = {
|
|
54
|
+
addItem: PropTypes.func.isRequired,
|
|
55
|
+
buttonData: PropTypes.array,
|
|
56
|
+
moveItem: PropTypes.func.isRequired,
|
|
57
|
+
removeItem: PropTypes.func.isRequired,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default memo(SortableList);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Text } from '@buffetjs/core';
|
|
3
|
+
|
|
4
|
+
const Wrapper = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
padding: 1rem;
|
|
10
|
+
border-radius: 0.2rem;
|
|
11
|
+
height: 2.5rem;
|
|
12
|
+
${({ theme, isGreen }) =>
|
|
13
|
+
isGreen
|
|
14
|
+
? `
|
|
15
|
+
border: 1px solid #aad67c;
|
|
16
|
+
background-color: #e6f8d4;
|
|
17
|
+
${Text} {
|
|
18
|
+
color: ${theme.main.colors.green};
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
: `
|
|
22
|
+
border: 1px solid #A5D5FF;
|
|
23
|
+
background-color: ${theme.main.colors.lightestBlue};
|
|
24
|
+
${Text} {
|
|
25
|
+
color: ${theme.main.colors.mediumBlue};
|
|
26
|
+
}
|
|
27
|
+
`};
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export default Wrapper;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import { Text } from '@buffetjs/core';
|
|
5
|
+
import { getTrad } from '../../utils';
|
|
6
|
+
import Wrapper from './Wrapper';
|
|
7
|
+
|
|
8
|
+
const State = ({ isPublished }) => {
|
|
9
|
+
const { formatMessage } = useIntl();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Wrapper isGreen={isPublished}>
|
|
13
|
+
<Text lineHeight="19px">
|
|
14
|
+
{formatMessage({
|
|
15
|
+
id: getTrad(`containers.List.${isPublished ? 'published' : 'draft'}`),
|
|
16
|
+
})}
|
|
17
|
+
</Text>
|
|
18
|
+
</Wrapper>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
State.propTypes = {
|
|
23
|
+
isPublished: PropTypes.bool.isRequired,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default State;
|