@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,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* listView reducer
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import produce from 'immer';
|
|
7
|
+
import {
|
|
8
|
+
GET_DATA,
|
|
9
|
+
GET_DATA_SUCCEEDED,
|
|
10
|
+
RESET_PROPS,
|
|
11
|
+
ON_CHANGE_BULK,
|
|
12
|
+
ON_CHANGE_BULK_SELECT_ALL,
|
|
13
|
+
ON_DELETE_DATA_ERROR,
|
|
14
|
+
ON_DELETE_DATA_SUCCEEDED,
|
|
15
|
+
ON_DELETE_SEVERAL_DATA_SUCCEEDED,
|
|
16
|
+
TOGGLE_MODAL_DELETE,
|
|
17
|
+
TOGGLE_MODAL_DELETE_ALL,
|
|
18
|
+
ON_CHANGE_LIST_HEADERS,
|
|
19
|
+
ON_RESET_LIST_HEADERS,
|
|
20
|
+
SET_LIST_LAYOUT,
|
|
21
|
+
SET_MODAL_LOADING_STATE,
|
|
22
|
+
} from './constants';
|
|
23
|
+
|
|
24
|
+
export const initialState = {
|
|
25
|
+
data: [],
|
|
26
|
+
didDeleteData: false,
|
|
27
|
+
entriesToDelete: [],
|
|
28
|
+
isLoading: true,
|
|
29
|
+
showModalConfirmButtonLoading: false,
|
|
30
|
+
showWarningDelete: false,
|
|
31
|
+
showWarningDeleteAll: false,
|
|
32
|
+
contentType: {},
|
|
33
|
+
initialDisplayedHeaders: [],
|
|
34
|
+
displayedHeaders: [],
|
|
35
|
+
pagination: {
|
|
36
|
+
total: 0,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const listViewReducer = (state = initialState, action) =>
|
|
41
|
+
// eslint-disable-next-line consistent-return
|
|
42
|
+
produce(state, drafState => {
|
|
43
|
+
switch (action.type) {
|
|
44
|
+
case GET_DATA: {
|
|
45
|
+
return {
|
|
46
|
+
...initialState,
|
|
47
|
+
contentType: state.contentType,
|
|
48
|
+
initialDisplayedHeaders: state.initialDisplayedHeaders,
|
|
49
|
+
displayedHeaders: state.displayedHeaders,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
case GET_DATA_SUCCEEDED: {
|
|
54
|
+
drafState.pagination = action.pagination;
|
|
55
|
+
drafState.data = action.data;
|
|
56
|
+
drafState.isLoading = false;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case ON_CHANGE_BULK: {
|
|
60
|
+
const hasElement = state.entriesToDelete.some(el => el === action.name);
|
|
61
|
+
|
|
62
|
+
if (hasElement) {
|
|
63
|
+
drafState.entriesToDelete = drafState.entriesToDelete.filter(el => el !== action.name);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
drafState.entriesToDelete.push(action.name);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case ON_CHANGE_BULK_SELECT_ALL: {
|
|
71
|
+
if (state.entriesToDelete.length > 0) {
|
|
72
|
+
drafState.entriesToDelete = [];
|
|
73
|
+
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
drafState.data.forEach(value => {
|
|
78
|
+
drafState.entriesToDelete.push(value.id.toString());
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
case ON_CHANGE_LIST_HEADERS: {
|
|
85
|
+
const {
|
|
86
|
+
target: { name, value },
|
|
87
|
+
} = action;
|
|
88
|
+
|
|
89
|
+
if (!value) {
|
|
90
|
+
const { metadatas, attributes, uid } = state.contentType;
|
|
91
|
+
const metas = metadatas[name].list;
|
|
92
|
+
const header = {
|
|
93
|
+
name,
|
|
94
|
+
fieldSchema: attributes[name],
|
|
95
|
+
metadatas: metas,
|
|
96
|
+
key: `__${name}_key__`,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
if (attributes[name].type === 'relation') {
|
|
100
|
+
drafState.displayedHeaders.push({
|
|
101
|
+
...header,
|
|
102
|
+
queryInfos: {
|
|
103
|
+
defaultParams: {},
|
|
104
|
+
endPoint: `collection-types/${uid}`,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
drafState.displayedHeaders.push(header);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
drafState.displayedHeaders = state.displayedHeaders.filter(
|
|
112
|
+
header => header.name !== name
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case ON_DELETE_DATA_SUCCEEDED: {
|
|
119
|
+
drafState.didDeleteData = true;
|
|
120
|
+
drafState.showWarningDelete = false;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case ON_DELETE_DATA_ERROR: {
|
|
124
|
+
drafState.didDeleteData = false;
|
|
125
|
+
drafState.showWarningDelete = false;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case ON_DELETE_SEVERAL_DATA_SUCCEEDED: {
|
|
129
|
+
drafState.didDeleteData = true;
|
|
130
|
+
drafState.showWarningDeleteAll = false;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case ON_RESET_LIST_HEADERS: {
|
|
134
|
+
drafState.displayedHeaders = state.initialDisplayedHeaders;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case RESET_PROPS: {
|
|
138
|
+
return initialState;
|
|
139
|
+
}
|
|
140
|
+
case SET_MODAL_LOADING_STATE: {
|
|
141
|
+
drafState.showModalConfirmButtonLoading = true;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case TOGGLE_MODAL_DELETE: {
|
|
145
|
+
drafState.showModalConfirmButtonLoading = false;
|
|
146
|
+
|
|
147
|
+
// Only change this value when the modal is opening
|
|
148
|
+
if (!state.showWarningDelete) {
|
|
149
|
+
drafState.didDeleteData = false;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
drafState.entriesToDelete = [];
|
|
153
|
+
drafState.showWarningDelete = !state.showWarningDelete;
|
|
154
|
+
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case TOGGLE_MODAL_DELETE_ALL: {
|
|
158
|
+
drafState.showModalConfirmButtonLoading = false;
|
|
159
|
+
|
|
160
|
+
// Only change this value when the modal is closing
|
|
161
|
+
if (!state.showWarningDeleteAll) {
|
|
162
|
+
drafState.didDeleteData = false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
drafState.showWarningDeleteAll = !state.showWarningDeleteAll;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
case SET_LIST_LAYOUT: {
|
|
169
|
+
const { contentType, displayedHeaders } = action;
|
|
170
|
+
|
|
171
|
+
drafState.contentType = contentType;
|
|
172
|
+
drafState.displayedHeaders = displayedHeaders;
|
|
173
|
+
drafState.initialDisplayedHeaders = displayedHeaders;
|
|
174
|
+
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
default:
|
|
178
|
+
return drafState;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
export default listViewReducer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
import pluginId from '../../pluginId';
|
|
3
|
+
import { initialState } from './reducer';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Direct selector to the listView state domain
|
|
7
|
+
*/
|
|
8
|
+
const listViewDomain = () => state => state.get(`${pluginId}_listView`) || initialState;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Other specific selectors
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Default selector used by listView
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const makeSelectListView = () =>
|
|
19
|
+
createSelector(listViewDomain(), substate => {
|
|
20
|
+
return substate;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default makeSelectListView;
|
|
24
|
+
export { listViewDomain };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { stringify } from 'qs';
|
|
2
|
+
import createPluginsFilter from './createPluginsFilter';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a valid query string from an object of queryParams
|
|
6
|
+
* This includes:
|
|
7
|
+
* - a _where clause
|
|
8
|
+
* - plugin options
|
|
9
|
+
*/
|
|
10
|
+
const buildQueryString = (queryParams = {}) => {
|
|
11
|
+
const _where = queryParams._where || [];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Extracting pluginOptions from the query since we don't want them to be part
|
|
15
|
+
* of the url
|
|
16
|
+
*/
|
|
17
|
+
const { plugins: _, ...otherQueryParams } = {
|
|
18
|
+
...queryParams,
|
|
19
|
+
_where,
|
|
20
|
+
...createPluginsFilter(queryParams.plugins),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return `?${stringify(otherQueryParams, { encode: false })}`;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default buildQueryString;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const createPluginsFilter = obj =>
|
|
2
|
+
Object.values(obj || {}).reduce((acc, current) => {
|
|
3
|
+
return {
|
|
4
|
+
...acc,
|
|
5
|
+
...Object.keys(current).reduce((accumulator, key) => {
|
|
6
|
+
accumulator[`_${key}`] = current[key];
|
|
7
|
+
|
|
8
|
+
return accumulator;
|
|
9
|
+
}, {}),
|
|
10
|
+
};
|
|
11
|
+
}, {});
|
|
12
|
+
|
|
13
|
+
export default createPluginsFilter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { checkIfAttributeIsDisplayable } from '../../../utils';
|
|
2
|
+
|
|
3
|
+
const getAllAllowedHeaders = attributes => {
|
|
4
|
+
const allowedAttributes = Object.keys(attributes).reduce((acc, current) => {
|
|
5
|
+
const attribute = attributes[current];
|
|
6
|
+
|
|
7
|
+
if (checkIfAttributeIsDisplayable(attribute)) {
|
|
8
|
+
acc.push(current);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return acc;
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
return allowedAttributes.sort();
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default getAllAllowedHeaders;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { get } from 'lodash';
|
|
2
|
+
|
|
3
|
+
const getFirstSortableHeader = headers => {
|
|
4
|
+
const matched = headers.find(header => header.metadatas.sortable === true);
|
|
5
|
+
const fieldName = get(matched, 'name', 'id');
|
|
6
|
+
|
|
7
|
+
if (get(matched, 'fieldSchema.type', '') === 'relation') {
|
|
8
|
+
return `${fieldName}.${matched.metadatas.mainField}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return fieldName;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default getFirstSortableHeader;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useUserPermissions, LoadingIndicatorPage } from 'strapi-helper-plugin';
|
|
4
|
+
import isEqual from 'react-fast-compare';
|
|
5
|
+
import ListView from '../ListView';
|
|
6
|
+
import { generatePermissionsObject } from '../../utils';
|
|
7
|
+
|
|
8
|
+
const Permissions = props => {
|
|
9
|
+
const viewPermissions = useMemo(() => generatePermissionsObject(props.slug), [props.slug]);
|
|
10
|
+
const { isLoading, allowedActions } = useUserPermissions(viewPermissions, props.permissions);
|
|
11
|
+
|
|
12
|
+
if (isLoading) {
|
|
13
|
+
return <LoadingIndicatorPage />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return <ListView {...props} {...allowedActions} />;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
Permissions.defaultProps = {
|
|
20
|
+
permissions: [],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Permissions.propTypes = {
|
|
24
|
+
permissions: PropTypes.array,
|
|
25
|
+
slug: PropTypes.string.isRequired,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// This avoids the components to rerender on params change causing multiple requests to be fired
|
|
29
|
+
export default memo(Permissions, isEqual);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useDispatch } from 'react-redux';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { useHistory } from 'react-router-dom';
|
|
5
|
+
import { useQueryParams } from 'strapi-helper-plugin';
|
|
6
|
+
import { useFindRedirectionLink } from '../../hooks';
|
|
7
|
+
import { resetProps, setLayout } from '../ListView/actions';
|
|
8
|
+
import useSyncRbac from '../RBACManager/useSyncRbac';
|
|
9
|
+
import Permissions from './Permissions';
|
|
10
|
+
|
|
11
|
+
const ListViewLayout = ({ layout, ...props }) => {
|
|
12
|
+
const dispatch = useDispatch();
|
|
13
|
+
const { replace } = useHistory();
|
|
14
|
+
const [{ query, rawQuery }] = useQueryParams();
|
|
15
|
+
const permissions = useSyncRbac(query, props.slug, 'listView');
|
|
16
|
+
const redirectionLink = useFindRedirectionLink(props.slug);
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!rawQuery) {
|
|
20
|
+
replace(redirectionLink);
|
|
21
|
+
}
|
|
22
|
+
}, [rawQuery, replace, redirectionLink]);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
dispatch(setLayout(layout.contentType));
|
|
26
|
+
}, [dispatch, layout]);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
return () => {
|
|
30
|
+
dispatch(resetProps());
|
|
31
|
+
};
|
|
32
|
+
}, [dispatch]);
|
|
33
|
+
|
|
34
|
+
if (!permissions) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return <Permissions {...props} layout={layout} permissions={permissions} />;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
ListViewLayout.propTypes = {
|
|
42
|
+
layout: PropTypes.exact({
|
|
43
|
+
components: PropTypes.object.isRequired,
|
|
44
|
+
contentType: PropTypes.shape({
|
|
45
|
+
attributes: PropTypes.object.isRequired,
|
|
46
|
+
metadatas: PropTypes.object.isRequired,
|
|
47
|
+
info: PropTypes.shape({ label: PropTypes.string.isRequired }).isRequired,
|
|
48
|
+
layouts: PropTypes.shape({
|
|
49
|
+
list: PropTypes.array.isRequired,
|
|
50
|
+
editRelations: PropTypes.array,
|
|
51
|
+
}).isRequired,
|
|
52
|
+
options: PropTypes.object.isRequired,
|
|
53
|
+
settings: PropTypes.object.isRequired,
|
|
54
|
+
pluginOptions: PropTypes.object,
|
|
55
|
+
}).isRequired,
|
|
56
|
+
}).isRequired,
|
|
57
|
+
slug: PropTypes.string.isRequired,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default ListViewLayout;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import ListViewContext from '../../contexts/ListView';
|
|
5
|
+
|
|
6
|
+
function ListViewProvider({ children, ...rest }) {
|
|
7
|
+
return (
|
|
8
|
+
<ListViewContext.Provider value={rest}>{children}</ListViewContext.Provider>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
ListViewProvider.propTypes = {
|
|
13
|
+
children: PropTypes.node.isRequired,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default ListViewProvider;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GET_DATA, GET_DATA_SUCCEEDED, RESET_PROPS } from './constants';
|
|
2
|
+
|
|
3
|
+
export const getData = () => ({
|
|
4
|
+
type: GET_DATA,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export const getDataSucceeded = (models, components) => ({
|
|
8
|
+
type: GET_DATA_SUCCEEDED,
|
|
9
|
+
components,
|
|
10
|
+
models,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const resetProps = () => ({ type: RESET_PROPS });
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { bindActionCreators, compose } from 'redux';
|
|
5
|
+
import { Switch, Route } from 'react-router-dom';
|
|
6
|
+
import {
|
|
7
|
+
CheckPagePermissions,
|
|
8
|
+
LoadingIndicatorPage,
|
|
9
|
+
NotFound,
|
|
10
|
+
request,
|
|
11
|
+
} from 'strapi-helper-plugin';
|
|
12
|
+
import { DndProvider } from 'react-dnd';
|
|
13
|
+
import HTML5Backend from 'react-dnd-html5-backend';
|
|
14
|
+
import pluginId from '../../pluginId';
|
|
15
|
+
import pluginPermissions from '../../permissions';
|
|
16
|
+
import { getRequestUrl } from '../../utils';
|
|
17
|
+
import DragLayer from '../../components/DragLayer';
|
|
18
|
+
import CollectionTypeRecursivePath from '../CollectionTypeRecursivePath';
|
|
19
|
+
import ComponentSettingsView from '../ComponentSetttingsView';
|
|
20
|
+
import SingleTypeRecursivePath from '../SingleTypeRecursivePath';
|
|
21
|
+
import { getData, getDataSucceeded, resetProps } from './actions';
|
|
22
|
+
import makeSelectMain from './selectors';
|
|
23
|
+
|
|
24
|
+
function Main({ getData, getDataSucceeded, isLoading, resetProps }) {
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const abortController = new AbortController();
|
|
27
|
+
const { signal } = abortController;
|
|
28
|
+
|
|
29
|
+
const fetchData = async signal => {
|
|
30
|
+
getData();
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const [{ data: components }, { data: models }] = await Promise.all(
|
|
34
|
+
['components', 'content-types'].map(endPoint =>
|
|
35
|
+
request(getRequestUrl(endPoint), { method: 'GET', signal })
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
getDataSucceeded(models, components);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
console.error(err);
|
|
42
|
+
strapi.notification.error('notification.error');
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
fetchData(signal);
|
|
47
|
+
|
|
48
|
+
return () => {
|
|
49
|
+
abortController.abort();
|
|
50
|
+
resetProps();
|
|
51
|
+
};
|
|
52
|
+
}, [getData, getDataSucceeded, resetProps]);
|
|
53
|
+
|
|
54
|
+
if (isLoading) {
|
|
55
|
+
return <LoadingIndicatorPage />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<DndProvider backend={HTML5Backend}>
|
|
60
|
+
<DragLayer />
|
|
61
|
+
|
|
62
|
+
<Switch>
|
|
63
|
+
<Route path={`/plugins/${pluginId}/components/:uid/configurations/edit`}>
|
|
64
|
+
<CheckPagePermissions permissions={pluginPermissions.componentsConfigurations}>
|
|
65
|
+
<ComponentSettingsView />
|
|
66
|
+
</CheckPagePermissions>
|
|
67
|
+
</Route>
|
|
68
|
+
<Route
|
|
69
|
+
path={`/plugins/${pluginId}/collectionType/:slug`}
|
|
70
|
+
component={CollectionTypeRecursivePath}
|
|
71
|
+
/>
|
|
72
|
+
<Route path={`/plugins/${pluginId}/singleType/:slug`} component={SingleTypeRecursivePath} />
|
|
73
|
+
<Route path="" component={NotFound} />
|
|
74
|
+
</Switch>
|
|
75
|
+
</DndProvider>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Main.propTypes = {
|
|
80
|
+
getData: PropTypes.func.isRequired,
|
|
81
|
+
getDataSucceeded: PropTypes.func.isRequired,
|
|
82
|
+
isLoading: PropTypes.bool.isRequired,
|
|
83
|
+
resetProps: PropTypes.func.isRequired,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const mapStateToProps = makeSelectMain();
|
|
87
|
+
|
|
88
|
+
export function mapDispatchToProps(dispatch) {
|
|
89
|
+
return bindActionCreators(
|
|
90
|
+
{
|
|
91
|
+
getData,
|
|
92
|
+
getDataSucceeded,
|
|
93
|
+
resetProps,
|
|
94
|
+
},
|
|
95
|
+
dispatch
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
99
|
+
|
|
100
|
+
export default compose(withConnect)(Main);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* main reducer
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable consistent-return */
|
|
6
|
+
import produce from 'immer';
|
|
7
|
+
import { GET_DATA, GET_DATA_SUCCEEDED, RESET_PROPS } from './constants';
|
|
8
|
+
|
|
9
|
+
const initialState = {
|
|
10
|
+
components: [],
|
|
11
|
+
isLoading: true,
|
|
12
|
+
models: [],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const mainReducer = (state = initialState, action) =>
|
|
16
|
+
produce(state, draftState => {
|
|
17
|
+
switch (action.type) {
|
|
18
|
+
case GET_DATA: {
|
|
19
|
+
draftState.isLoading = true;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case GET_DATA_SUCCEEDED: {
|
|
23
|
+
draftState.isLoading = false;
|
|
24
|
+
draftState.components = action.components;
|
|
25
|
+
draftState.models = action.models;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case RESET_PROPS: {
|
|
29
|
+
return initialState;
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
return draftState;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default mainReducer;
|
|
37
|
+
export { initialState };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
import pluginId from '../../pluginId';
|
|
3
|
+
import { initialState } from './reducer';
|
|
4
|
+
|
|
5
|
+
const selectMainDomain = () => state => {
|
|
6
|
+
return state.get(`${pluginId}_main`) || initialState;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const makeSelectMain = () =>
|
|
10
|
+
createSelector(selectMainDomain(), substate => {
|
|
11
|
+
return substate;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const makeSelectModelAndComponentSchemas = () =>
|
|
15
|
+
createSelector(selectMainDomain(), ({ components, models }) => ({
|
|
16
|
+
schemas: [...components, ...models],
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
export default makeSelectMain;
|
|
20
|
+
export { makeSelectModelAndComponentSchemas, selectMainDomain };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RESET_PERMISSIONS, SET_PERMISSIONS } from './constants';
|
|
2
|
+
|
|
3
|
+
export const setPermissions = (permissions, plugins, containerName) => {
|
|
4
|
+
return {
|
|
5
|
+
type: SET_PERMISSIONS,
|
|
6
|
+
permissions,
|
|
7
|
+
__meta__: {
|
|
8
|
+
plugins,
|
|
9
|
+
containerName,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const resetPermissions = () => ({ type: RESET_PERMISSIONS });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* RBACManager reducer
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import produce from 'immer';
|
|
7
|
+
import { SET_PERMISSIONS, RESET_PERMISSIONS } from './constants';
|
|
8
|
+
|
|
9
|
+
export const initialState = {
|
|
10
|
+
permissions: null,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const rbacManagerReducer = (state = initialState, action) =>
|
|
14
|
+
// eslint-disable-next-line consistent-return
|
|
15
|
+
produce(state, draftState => {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case SET_PERMISSIONS: {
|
|
18
|
+
draftState.permissions = Object.entries(action.permissions).reduce((acc, current) => {
|
|
19
|
+
return [...acc, ...current[1]];
|
|
20
|
+
}, []);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
case RESET_PERMISSIONS: {
|
|
24
|
+
draftState.permissions = null;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
default:
|
|
28
|
+
return draftState;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default rbacManagerReducer;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
import { resetPermissions, setPermissions } from './actions';
|
|
4
|
+
import { selectPermissions, selectCollectionTypePermissions } from '../../selectors';
|
|
5
|
+
|
|
6
|
+
const useSyncRbac = (query, collectionTypeUID, containerName = 'listView') => {
|
|
7
|
+
const collectionTypesRelatedPermissions = useSelector(selectCollectionTypePermissions);
|
|
8
|
+
const permissions = useSelector(selectPermissions);
|
|
9
|
+
const dispatch = useDispatch();
|
|
10
|
+
|
|
11
|
+
const relatedPermissions = collectionTypesRelatedPermissions[collectionTypeUID];
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (relatedPermissions) {
|
|
15
|
+
dispatch(setPermissions(relatedPermissions, query ? query.plugins : null, containerName));
|
|
16
|
+
|
|
17
|
+
return () => {
|
|
18
|
+
dispatch(resetPermissions());
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return () => {};
|
|
23
|
+
}, [relatedPermissions, dispatch, query, containerName]);
|
|
24
|
+
|
|
25
|
+
return permissions;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default useSyncRbac;
|