@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,71 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { get, isNull } from 'lodash';
|
|
4
|
+
import Select from 'react-select';
|
|
5
|
+
import SingleValue from './SingleValue';
|
|
6
|
+
|
|
7
|
+
function SelectOne({
|
|
8
|
+
components,
|
|
9
|
+
mainField,
|
|
10
|
+
name,
|
|
11
|
+
isDisabled,
|
|
12
|
+
isLoading,
|
|
13
|
+
onChange,
|
|
14
|
+
onInputChange,
|
|
15
|
+
onMenuClose,
|
|
16
|
+
onMenuOpen,
|
|
17
|
+
onMenuScrollToBottom,
|
|
18
|
+
options,
|
|
19
|
+
placeholder,
|
|
20
|
+
styles,
|
|
21
|
+
value,
|
|
22
|
+
}) {
|
|
23
|
+
return (
|
|
24
|
+
<Select
|
|
25
|
+
components={{ ...components, SingleValue }}
|
|
26
|
+
id={name}
|
|
27
|
+
isClearable
|
|
28
|
+
isDisabled={isDisabled}
|
|
29
|
+
isLoading={isLoading}
|
|
30
|
+
mainField={mainField}
|
|
31
|
+
options={options}
|
|
32
|
+
onChange={onChange}
|
|
33
|
+
onInputChange={onInputChange}
|
|
34
|
+
onMenuClose={onMenuClose}
|
|
35
|
+
onMenuOpen={onMenuOpen}
|
|
36
|
+
onMenuScrollToBottom={onMenuScrollToBottom}
|
|
37
|
+
placeholder={placeholder}
|
|
38
|
+
styles={styles}
|
|
39
|
+
value={isNull(value) ? null : { label: get(value, [mainField.name], ''), value }}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
SelectOne.defaultProps = {
|
|
45
|
+
components: {},
|
|
46
|
+
value: null,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
SelectOne.propTypes = {
|
|
50
|
+
components: PropTypes.object,
|
|
51
|
+
isDisabled: PropTypes.bool.isRequired,
|
|
52
|
+
isLoading: PropTypes.bool.isRequired,
|
|
53
|
+
mainField: PropTypes.shape({
|
|
54
|
+
name: PropTypes.string.isRequired,
|
|
55
|
+
schema: PropTypes.shape({
|
|
56
|
+
type: PropTypes.string.isRequired,
|
|
57
|
+
}).isRequired,
|
|
58
|
+
}).isRequired,
|
|
59
|
+
name: PropTypes.string.isRequired,
|
|
60
|
+
onChange: PropTypes.func.isRequired,
|
|
61
|
+
onInputChange: PropTypes.func.isRequired,
|
|
62
|
+
onMenuClose: PropTypes.func.isRequired,
|
|
63
|
+
onMenuOpen: PropTypes.func.isRequired,
|
|
64
|
+
onMenuScrollToBottom: PropTypes.func.isRequired,
|
|
65
|
+
options: PropTypes.array.isRequired,
|
|
66
|
+
placeholder: PropTypes.node.isRequired,
|
|
67
|
+
styles: PropTypes.object.isRequired,
|
|
68
|
+
value: PropTypes.object,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default memo(SelectOne);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Remove } from '@buffetjs/icons';
|
|
3
|
+
import { components } from 'react-select';
|
|
4
|
+
|
|
5
|
+
const ClearIndicator = props => {
|
|
6
|
+
const Component = components.ClearIndicator;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Component {...props}>
|
|
10
|
+
<Remove width="11px" height="11px" fill="#9EA7B8" />
|
|
11
|
+
</Component>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default ClearIndicator;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { components } from 'react-select';
|
|
4
|
+
import { useIntl } from 'react-intl';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { get, has, isEmpty } from 'lodash';
|
|
7
|
+
import { Flex, Text } from '@buffetjs/core';
|
|
8
|
+
import { RelationDPState } from 'strapi-helper-plugin';
|
|
9
|
+
import { getDisplayedValue, getTrad } from '../../utils';
|
|
10
|
+
|
|
11
|
+
const TextGrow = styled(Text)`
|
|
12
|
+
flex-grow: 2;
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const Option = props => {
|
|
16
|
+
const { formatMessage } = useIntl();
|
|
17
|
+
const Component = components.Option;
|
|
18
|
+
const hasDraftAndPublish = has(get(props, 'data.value'), 'published_at');
|
|
19
|
+
const isDraft = isEmpty(get(props, 'data.value.published_at'));
|
|
20
|
+
const titleLabelID = isDraft
|
|
21
|
+
? 'components.Select.draft-info-title'
|
|
22
|
+
: 'components.Select.publish-info-title';
|
|
23
|
+
const title = formatMessage({ id: getTrad(titleLabelID) });
|
|
24
|
+
const fontWeight = props.isFocused ? 'bold' : 'regular';
|
|
25
|
+
const mainField = get(props, ['selectProps', 'mainField'], {});
|
|
26
|
+
const value = getDisplayedValue(mainField.schema.type, props.label, mainField.name);
|
|
27
|
+
|
|
28
|
+
if (hasDraftAndPublish) {
|
|
29
|
+
return (
|
|
30
|
+
<Component {...props}>
|
|
31
|
+
<Flex>
|
|
32
|
+
<RelationDPState
|
|
33
|
+
marginLeft="0"
|
|
34
|
+
marginTop="1px"
|
|
35
|
+
marginRight="10px"
|
|
36
|
+
isDraft={isDraft}
|
|
37
|
+
marginBottom="0"
|
|
38
|
+
title={title}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<TextGrow ellipsis as="div" fontWeight={fontWeight} title={value}>
|
|
42
|
+
{value}
|
|
43
|
+
</TextGrow>
|
|
44
|
+
</Flex>
|
|
45
|
+
</Component>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Component {...props}>
|
|
51
|
+
<Text ellipsis fontWeight={fontWeight} title={value}>
|
|
52
|
+
{value}
|
|
53
|
+
</Text>
|
|
54
|
+
</Component>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
Option.defaultProps = {
|
|
59
|
+
label: '',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
Option.propTypes = {
|
|
63
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
64
|
+
isFocused: PropTypes.bool.isRequired,
|
|
65
|
+
selectProps: PropTypes.shape({
|
|
66
|
+
hasDraftAndPublish: PropTypes.bool,
|
|
67
|
+
mainField: PropTypes.shape({
|
|
68
|
+
name: PropTypes.string.isRequired,
|
|
69
|
+
schema: PropTypes.shape({
|
|
70
|
+
type: PropTypes.string.isRequired,
|
|
71
|
+
}).isRequired,
|
|
72
|
+
}).isRequired,
|
|
73
|
+
}).isRequired,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default Option;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Text } from '@buffetjs/core';
|
|
3
|
+
|
|
4
|
+
const BaselineAlignment = styled.div`
|
|
5
|
+
padding-top: 1px;
|
|
6
|
+
`;
|
|
7
|
+
|
|
8
|
+
const A = styled(Text)`
|
|
9
|
+
&:hover {
|
|
10
|
+
text-decoration: underline;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export { A, BaselineAlignment };
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import React, { useCallback, useState, useEffect, useMemo, memo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
4
|
+
import { Link, useLocation } from 'react-router-dom';
|
|
5
|
+
import { findIndex, get, isArray, isEmpty, set } from 'lodash';
|
|
6
|
+
import {
|
|
7
|
+
DropdownIndicator,
|
|
8
|
+
LabelIconWrapper,
|
|
9
|
+
NotAllowedInput,
|
|
10
|
+
request,
|
|
11
|
+
useContentManagerEditViewDataManager,
|
|
12
|
+
useQueryParams,
|
|
13
|
+
} from 'strapi-helper-plugin';
|
|
14
|
+
import { Flex, Text, Padded } from '@buffetjs/core';
|
|
15
|
+
import { stringify } from 'qs';
|
|
16
|
+
import pluginId from '../../pluginId';
|
|
17
|
+
import SelectOne from '../SelectOne';
|
|
18
|
+
import SelectMany from '../SelectMany';
|
|
19
|
+
import ClearIndicator from './ClearIndicator';
|
|
20
|
+
import IndicatorSeparator from './IndicatorSeparator';
|
|
21
|
+
import Option from './Option';
|
|
22
|
+
import { A, BaselineAlignment } from './components';
|
|
23
|
+
import { connect, select, styles } from './utils';
|
|
24
|
+
|
|
25
|
+
const initialPaginationState = {
|
|
26
|
+
_contains: '',
|
|
27
|
+
_limit: 20,
|
|
28
|
+
_start: 0,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const buildParams = (query, paramsToKeep) => {
|
|
32
|
+
if (!paramsToKeep) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return paramsToKeep.reduce((acc, current) => {
|
|
37
|
+
const value = get(query, current, null);
|
|
38
|
+
|
|
39
|
+
if (value) {
|
|
40
|
+
set(acc, current, value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
};
|
|
46
|
+
function SelectWrapper({
|
|
47
|
+
description,
|
|
48
|
+
editable,
|
|
49
|
+
label,
|
|
50
|
+
labelIcon,
|
|
51
|
+
isCreatingEntry,
|
|
52
|
+
isFieldAllowed,
|
|
53
|
+
isFieldReadable,
|
|
54
|
+
mainField,
|
|
55
|
+
name,
|
|
56
|
+
relationType,
|
|
57
|
+
targetModel,
|
|
58
|
+
placeholder,
|
|
59
|
+
queryInfos,
|
|
60
|
+
}) {
|
|
61
|
+
const { formatMessage } = useIntl();
|
|
62
|
+
const [{ query }] = useQueryParams();
|
|
63
|
+
// Disable the input in case of a polymorphic relation
|
|
64
|
+
const isMorph = useMemo(() => relationType.toLowerCase().includes('morph'), [relationType]);
|
|
65
|
+
const {
|
|
66
|
+
addRelation,
|
|
67
|
+
modifiedData,
|
|
68
|
+
moveRelation,
|
|
69
|
+
onChange,
|
|
70
|
+
onRemoveRelation,
|
|
71
|
+
} = useContentManagerEditViewDataManager();
|
|
72
|
+
const { pathname } = useLocation();
|
|
73
|
+
|
|
74
|
+
const value = get(modifiedData, name, null);
|
|
75
|
+
const [state, setState] = useState(initialPaginationState);
|
|
76
|
+
const [options, setOptions] = useState([]);
|
|
77
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
78
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
79
|
+
|
|
80
|
+
const filteredOptions = useMemo(() => {
|
|
81
|
+
return options.filter(option => {
|
|
82
|
+
if (!isEmpty(value)) {
|
|
83
|
+
// SelectMany
|
|
84
|
+
if (Array.isArray(value)) {
|
|
85
|
+
return findIndex(value, o => o.id === option.value.id) === -1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// SelectOne
|
|
89
|
+
return get(value, 'id', '') !== option.value.id;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return true;
|
|
93
|
+
});
|
|
94
|
+
}, [options, value]);
|
|
95
|
+
|
|
96
|
+
const {
|
|
97
|
+
endPoint,
|
|
98
|
+
containsKey,
|
|
99
|
+
defaultParams,
|
|
100
|
+
shouldDisplayRelationLink,
|
|
101
|
+
paramsToKeep,
|
|
102
|
+
} = queryInfos;
|
|
103
|
+
|
|
104
|
+
const isSingle = ['oneWay', 'oneToOne', 'manyToOne', 'oneToManyMorph', 'oneToOneMorph'].includes(
|
|
105
|
+
relationType
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const idsToOmit = useMemo(() => {
|
|
109
|
+
if (!value) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (isSingle) {
|
|
114
|
+
return [value.id];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return value.map(val => val.id);
|
|
118
|
+
}, [isSingle, value]);
|
|
119
|
+
|
|
120
|
+
const getData = useCallback(
|
|
121
|
+
async signal => {
|
|
122
|
+
// Currently polymorphic relations are not handled
|
|
123
|
+
if (isMorph) {
|
|
124
|
+
setIsLoading(false);
|
|
125
|
+
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (!isFieldAllowed) {
|
|
130
|
+
setIsLoading(false);
|
|
131
|
+
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
setIsLoading(true);
|
|
136
|
+
|
|
137
|
+
const params = { _limit: state._limit, ...defaultParams };
|
|
138
|
+
|
|
139
|
+
if (state._contains) {
|
|
140
|
+
params[containsKey] = state._contains;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
const data = await request(endPoint, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
params,
|
|
147
|
+
signal,
|
|
148
|
+
body: { idsToOmit },
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const formattedData = data.map(obj => {
|
|
152
|
+
return { value: obj, label: obj[mainField.name] };
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
setOptions(prevState =>
|
|
156
|
+
prevState.concat(formattedData).filter((obj, index) => {
|
|
157
|
+
const objIndex = prevState.findIndex(el => el.value.id === obj.value.id);
|
|
158
|
+
|
|
159
|
+
if (objIndex === -1) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return prevState.findIndex(el => el.value.id === obj.value.id) === index;
|
|
164
|
+
})
|
|
165
|
+
);
|
|
166
|
+
setIsLoading(false);
|
|
167
|
+
} catch (err) {
|
|
168
|
+
// Silent
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
[
|
|
172
|
+
isMorph,
|
|
173
|
+
isFieldAllowed,
|
|
174
|
+
state._limit,
|
|
175
|
+
state._contains,
|
|
176
|
+
defaultParams,
|
|
177
|
+
containsKey,
|
|
178
|
+
endPoint,
|
|
179
|
+
idsToOmit,
|
|
180
|
+
mainField.name,
|
|
181
|
+
]
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
const abortController = new AbortController();
|
|
186
|
+
const { signal } = abortController;
|
|
187
|
+
|
|
188
|
+
if (isOpen) {
|
|
189
|
+
getData(signal);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return () => abortController.abort();
|
|
193
|
+
}, [getData, isOpen]);
|
|
194
|
+
|
|
195
|
+
const handleInputChange = (inputValue, { action }) => {
|
|
196
|
+
if (action === 'input-change') {
|
|
197
|
+
setState(prevState => {
|
|
198
|
+
if (prevState._contains === inputValue) {
|
|
199
|
+
return prevState;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return { ...prevState, _contains: inputValue, _start: 0 };
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return inputValue;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const handleMenuScrollToBottom = () => {
|
|
210
|
+
setState(prevState => ({ ...prevState, _limit: prevState._limit + 20 }));
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const handleMenuClose = () => {
|
|
214
|
+
setState(initialPaginationState);
|
|
215
|
+
setIsOpen(false);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const handleChange = value => {
|
|
219
|
+
onChange({ target: { name, value: value ? value.value : value } });
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const handleAddRelation = value => {
|
|
223
|
+
if (!isEmpty(value)) {
|
|
224
|
+
addRelation({ target: { name, value } });
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const handleMenuOpen = () => {
|
|
229
|
+
setIsOpen(true);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const to = `/plugins/${pluginId}/collectionType/${targetModel}/${value ? value.id : null}`;
|
|
233
|
+
|
|
234
|
+
const searchToPersist = stringify(buildParams(query, paramsToKeep), { encode: false });
|
|
235
|
+
|
|
236
|
+
const link = useMemo(() => {
|
|
237
|
+
if (!value) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!shouldDisplayRelationLink) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<Link to={{ pathname: to, state: { from: pathname }, search: searchToPersist }}>
|
|
247
|
+
<FormattedMessage id="content-manager.containers.Edit.seeDetails">
|
|
248
|
+
{msg => <A color="mediumBlue">{msg}</A>}
|
|
249
|
+
</FormattedMessage>
|
|
250
|
+
</Link>
|
|
251
|
+
);
|
|
252
|
+
}, [shouldDisplayRelationLink, pathname, to, value, searchToPersist]);
|
|
253
|
+
|
|
254
|
+
const Component = isSingle ? SelectOne : SelectMany;
|
|
255
|
+
const associationsLength = isArray(value) ? value.length : 0;
|
|
256
|
+
|
|
257
|
+
const isDisabled = useMemo(() => {
|
|
258
|
+
if (isMorph) {
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!isCreatingEntry) {
|
|
263
|
+
return (!isFieldAllowed && isFieldReadable) || !editable;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return !editable;
|
|
267
|
+
}, [isMorph, isCreatingEntry, editable, isFieldAllowed, isFieldReadable]);
|
|
268
|
+
|
|
269
|
+
const labelIconformatted = labelIcon
|
|
270
|
+
? { icon: labelIcon.icon, title: formatMessage(labelIcon.title) }
|
|
271
|
+
: labelIcon;
|
|
272
|
+
|
|
273
|
+
if (!isFieldAllowed && isCreatingEntry) {
|
|
274
|
+
return <NotAllowedInput label={label} labelIcon={labelIconformatted} />;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (!isCreatingEntry && !isFieldAllowed && !isFieldReadable) {
|
|
278
|
+
return <NotAllowedInput label={label} labelIcon={labelIconformatted} />;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return (
|
|
282
|
+
<Padded>
|
|
283
|
+
<BaselineAlignment />
|
|
284
|
+
<Flex justifyContent="space-between">
|
|
285
|
+
<Flex>
|
|
286
|
+
<Text fontWeight="semiBold">
|
|
287
|
+
<span>
|
|
288
|
+
{label}
|
|
289
|
+
{!isSingle && ` (${associationsLength})`}
|
|
290
|
+
</span>
|
|
291
|
+
</Text>
|
|
292
|
+
{labelIconformatted && (
|
|
293
|
+
<div style={{ lineHeight: '13px' }}>
|
|
294
|
+
<LabelIconWrapper title={labelIconformatted.title}>
|
|
295
|
+
{labelIconformatted.icon}
|
|
296
|
+
</LabelIconWrapper>
|
|
297
|
+
</div>
|
|
298
|
+
)}
|
|
299
|
+
</Flex>
|
|
300
|
+
{isSingle && link}
|
|
301
|
+
</Flex>
|
|
302
|
+
{!isEmpty(description) && (
|
|
303
|
+
<Padded top size="xs">
|
|
304
|
+
<BaselineAlignment />
|
|
305
|
+
<Text fontSize="sm" color="grey" lineHeight="12px" ellipsis>
|
|
306
|
+
{description}
|
|
307
|
+
</Text>
|
|
308
|
+
</Padded>
|
|
309
|
+
)}
|
|
310
|
+
<Padded top size="sm">
|
|
311
|
+
<BaselineAlignment />
|
|
312
|
+
|
|
313
|
+
<Component
|
|
314
|
+
addRelation={handleAddRelation}
|
|
315
|
+
components={{ ClearIndicator, DropdownIndicator, IndicatorSeparator, Option }}
|
|
316
|
+
displayNavigationLink={shouldDisplayRelationLink}
|
|
317
|
+
id={name}
|
|
318
|
+
isDisabled={isDisabled}
|
|
319
|
+
isLoading={isLoading}
|
|
320
|
+
isClearable
|
|
321
|
+
mainField={mainField}
|
|
322
|
+
move={moveRelation}
|
|
323
|
+
name={name}
|
|
324
|
+
options={filteredOptions}
|
|
325
|
+
onChange={handleChange}
|
|
326
|
+
onInputChange={handleInputChange}
|
|
327
|
+
onMenuClose={handleMenuClose}
|
|
328
|
+
onMenuOpen={handleMenuOpen}
|
|
329
|
+
onMenuScrollToBottom={handleMenuScrollToBottom}
|
|
330
|
+
onRemove={onRemoveRelation}
|
|
331
|
+
placeholder={
|
|
332
|
+
isEmpty(placeholder) ? (
|
|
333
|
+
<FormattedMessage id={`${pluginId}.containers.Edit.addAnItem`} />
|
|
334
|
+
) : (
|
|
335
|
+
placeholder
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
searchToPersist={searchToPersist}
|
|
339
|
+
styles={styles}
|
|
340
|
+
targetModel={targetModel}
|
|
341
|
+
value={value}
|
|
342
|
+
/>
|
|
343
|
+
</Padded>
|
|
344
|
+
<div style={{ marginBottom: 28 }} />
|
|
345
|
+
</Padded>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
SelectWrapper.defaultProps = {
|
|
350
|
+
editable: true,
|
|
351
|
+
description: '',
|
|
352
|
+
label: '',
|
|
353
|
+
labelIcon: null,
|
|
354
|
+
isFieldAllowed: true,
|
|
355
|
+
placeholder: '',
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
SelectWrapper.propTypes = {
|
|
359
|
+
editable: PropTypes.bool,
|
|
360
|
+
description: PropTypes.string,
|
|
361
|
+
label: PropTypes.string,
|
|
362
|
+
labelIcon: PropTypes.shape({
|
|
363
|
+
icon: PropTypes.node.isRequired,
|
|
364
|
+
title: PropTypes.shape({
|
|
365
|
+
id: PropTypes.string.isRequired,
|
|
366
|
+
defaultMessage: PropTypes.string,
|
|
367
|
+
}),
|
|
368
|
+
}),
|
|
369
|
+
isCreatingEntry: PropTypes.bool.isRequired,
|
|
370
|
+
isFieldAllowed: PropTypes.bool,
|
|
371
|
+
isFieldReadable: PropTypes.bool.isRequired,
|
|
372
|
+
mainField: PropTypes.shape({
|
|
373
|
+
name: PropTypes.string.isRequired,
|
|
374
|
+
schema: PropTypes.shape({
|
|
375
|
+
type: PropTypes.string.isRequired,
|
|
376
|
+
}).isRequired,
|
|
377
|
+
}).isRequired,
|
|
378
|
+
name: PropTypes.string.isRequired,
|
|
379
|
+
placeholder: PropTypes.string,
|
|
380
|
+
relationType: PropTypes.string.isRequired,
|
|
381
|
+
targetModel: PropTypes.string.isRequired,
|
|
382
|
+
queryInfos: PropTypes.shape({
|
|
383
|
+
containsKey: PropTypes.string.isRequired,
|
|
384
|
+
defaultParams: PropTypes.object,
|
|
385
|
+
endPoint: PropTypes.string.isRequired,
|
|
386
|
+
shouldDisplayRelationLink: PropTypes.bool.isRequired,
|
|
387
|
+
paramsToKeep: PropTypes.array,
|
|
388
|
+
}).isRequired,
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
const Memoized = memo(SelectWrapper);
|
|
392
|
+
|
|
393
|
+
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(props);
|
|
7
|
+
|
|
8
|
+
return <WrappedComponent {...props} {...selectors} />;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default connect;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useContentManagerEditViewDataManager } from 'strapi-helper-plugin';
|
|
3
|
+
|
|
4
|
+
function useSelect({ isUserAllowedToEditField, isUserAllowedToReadField, name }) {
|
|
5
|
+
const {
|
|
6
|
+
isCreatingEntry,
|
|
7
|
+
createActionAllowedFields,
|
|
8
|
+
readActionAllowedFields,
|
|
9
|
+
updateActionAllowedFields,
|
|
10
|
+
} = useContentManagerEditViewDataManager();
|
|
11
|
+
|
|
12
|
+
const isFieldAllowed = useMemo(() => {
|
|
13
|
+
if (isUserAllowedToEditField === true) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const allowedFields = isCreatingEntry ? createActionAllowedFields : updateActionAllowedFields;
|
|
18
|
+
|
|
19
|
+
return allowedFields.includes(name);
|
|
20
|
+
}, [
|
|
21
|
+
isCreatingEntry,
|
|
22
|
+
createActionAllowedFields,
|
|
23
|
+
name,
|
|
24
|
+
isUserAllowedToEditField,
|
|
25
|
+
updateActionAllowedFields,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const isFieldReadable = useMemo(() => {
|
|
29
|
+
if (isUserAllowedToReadField) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const allowedFields = isCreatingEntry ? [] : readActionAllowedFields;
|
|
34
|
+
|
|
35
|
+
return allowedFields.includes(name);
|
|
36
|
+
}, [isCreatingEntry, isUserAllowedToReadField, name, readActionAllowedFields]);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
isCreatingEntry,
|
|
40
|
+
isFieldAllowed,
|
|
41
|
+
isFieldReadable,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default useSelect;
|