@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,298 @@
|
|
|
1
|
+
import React, { memo, useMemo, useReducer, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { get, pick } from 'lodash';
|
|
4
|
+
import { request, useGlobalContext } from 'strapi-helper-plugin';
|
|
5
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
6
|
+
import { useDrop } from 'react-dnd';
|
|
7
|
+
import { DropdownItem } from 'reactstrap';
|
|
8
|
+
import { Inputs as Input } from '@buffetjs/custom';
|
|
9
|
+
import pluginId from '../../pluginId';
|
|
10
|
+
import { checkIfAttributeIsDisplayable, ItemTypes, getRequestUrl } from '../../utils';
|
|
11
|
+
import PopupForm from '../../components/PopupForm';
|
|
12
|
+
import SettingsViewWrapper from '../../components/SettingsViewWrapper';
|
|
13
|
+
import SortWrapper from '../../components/SortWrapper';
|
|
14
|
+
import LayoutDndProvider from '../LayoutDndProvider';
|
|
15
|
+
import Label from './Label';
|
|
16
|
+
import MenuDropdown from './MenuDropdown';
|
|
17
|
+
import DropdownButton from './DropdownButton';
|
|
18
|
+
import DragWrapper from './DragWrapper';
|
|
19
|
+
import Toggle from './Toggle';
|
|
20
|
+
import init from './init';
|
|
21
|
+
import reducer, { initialState } from './reducer';
|
|
22
|
+
import forms from './forms.json';
|
|
23
|
+
|
|
24
|
+
const ListSettingsView = ({ layout, slug, updateLayout }) => {
|
|
25
|
+
const [reducerState, dispatch] = useReducer(reducer, initialState, () =>
|
|
26
|
+
init(initialState, layout)
|
|
27
|
+
);
|
|
28
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
29
|
+
const [isModalFormOpen, setIsModalFormOpen] = useState(false);
|
|
30
|
+
const [isDraggingSibling, setIsDraggingSibling] = useState(false);
|
|
31
|
+
const { formatMessage } = useIntl();
|
|
32
|
+
const { emitEvent, updateMenu } = useGlobalContext();
|
|
33
|
+
const toggleModalForm = () => setIsModalFormOpen(prevState => !prevState);
|
|
34
|
+
const { labelForm, labelToEdit, initialData, modifiedData } = reducerState.toJS();
|
|
35
|
+
const attributes = useMemo(() => {
|
|
36
|
+
return get(modifiedData, ['attributes'], {});
|
|
37
|
+
}, [modifiedData]);
|
|
38
|
+
|
|
39
|
+
const getName = useMemo(() => {
|
|
40
|
+
return get(modifiedData, ['info', 'name'], '');
|
|
41
|
+
}, [modifiedData]);
|
|
42
|
+
|
|
43
|
+
const displayedFields = useMemo(() => {
|
|
44
|
+
return get(modifiedData, ['layouts', 'list'], []);
|
|
45
|
+
}, [modifiedData]);
|
|
46
|
+
|
|
47
|
+
const listRemainingFields = useMemo(() => {
|
|
48
|
+
const metadatas = get(modifiedData, ['metadatas'], {});
|
|
49
|
+
|
|
50
|
+
return Object.keys(metadatas)
|
|
51
|
+
.filter(key => {
|
|
52
|
+
return checkIfAttributeIsDisplayable(get(attributes, key, {}));
|
|
53
|
+
})
|
|
54
|
+
.filter(field => {
|
|
55
|
+
return !displayedFields.includes(field);
|
|
56
|
+
})
|
|
57
|
+
.sort();
|
|
58
|
+
}, [displayedFields, attributes, modifiedData]);
|
|
59
|
+
|
|
60
|
+
const handleClickEditLabel = labelToEdit => {
|
|
61
|
+
dispatch({
|
|
62
|
+
type: 'SET_LABEL_TO_EDIT',
|
|
63
|
+
labelToEdit,
|
|
64
|
+
});
|
|
65
|
+
toggleModalForm();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleClosed = () => {
|
|
69
|
+
dispatch({
|
|
70
|
+
type: 'UNSET_LABEL_TO_EDIT',
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const handleChange = ({ target: { name, value } }) => {
|
|
75
|
+
dispatch({
|
|
76
|
+
type: 'ON_CHANGE',
|
|
77
|
+
keys: name,
|
|
78
|
+
value: name === 'settings.pageSize' ? parseInt(value, 10) : value,
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const handleChangeEditLabel = ({ target: { name, value } }) => {
|
|
83
|
+
dispatch({
|
|
84
|
+
type: 'ON_CHANGE_LABEL_METAS',
|
|
85
|
+
name,
|
|
86
|
+
value,
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const handleConfirm = async () => {
|
|
91
|
+
try {
|
|
92
|
+
const body = pick(modifiedData, ['layouts', 'settings', 'metadatas']);
|
|
93
|
+
|
|
94
|
+
const response = await request(getRequestUrl(`content-types/${slug}/configuration`), {
|
|
95
|
+
method: 'PUT',
|
|
96
|
+
body,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
updateLayout(response.data);
|
|
100
|
+
|
|
101
|
+
dispatch({
|
|
102
|
+
type: 'SUBMIT_SUCCEEDED',
|
|
103
|
+
});
|
|
104
|
+
emitEvent('didEditListSettings');
|
|
105
|
+
} catch (err) {
|
|
106
|
+
strapi.notification.toggle({
|
|
107
|
+
type: 'warning',
|
|
108
|
+
message: { id: 'notification.error' },
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const move = (originalIndex, atIndex) => {
|
|
114
|
+
dispatch({
|
|
115
|
+
type: 'MOVE_FIELD',
|
|
116
|
+
originalIndex,
|
|
117
|
+
atIndex,
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const [, drop] = useDrop({ accept: ItemTypes.FIELD });
|
|
122
|
+
|
|
123
|
+
const renderForm = () => {
|
|
124
|
+
const type = get(attributes, [labelToEdit, 'type'], 'text');
|
|
125
|
+
const relationType = get(attributes, [labelToEdit, 'relationType']);
|
|
126
|
+
let shouldDisplaySortToggle = !['media', 'relation'].includes(type);
|
|
127
|
+
const label = formatMessage({ id: `${pluginId}.form.Input.label` });
|
|
128
|
+
const description = formatMessage({ id: `${pluginId}.form.Input.label.inputDescription` });
|
|
129
|
+
|
|
130
|
+
if (['oneWay', 'oneToOne', 'manyToOne'].includes(relationType)) {
|
|
131
|
+
shouldDisplaySortToggle = true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<>
|
|
136
|
+
<div className="col-6" style={{ marginBottom: 4 }}>
|
|
137
|
+
<Input
|
|
138
|
+
description={description}
|
|
139
|
+
label={label}
|
|
140
|
+
type="text"
|
|
141
|
+
name="label"
|
|
142
|
+
onBlur={() => {}}
|
|
143
|
+
value={get(labelForm, 'label', '')}
|
|
144
|
+
onChange={handleChangeEditLabel}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
{shouldDisplaySortToggle && (
|
|
148
|
+
<div className="col-6" style={{ marginBottom: 4 }}>
|
|
149
|
+
<FormattedMessage id={`${pluginId}.form.Input.sort.field`}>
|
|
150
|
+
{label => (
|
|
151
|
+
<Input
|
|
152
|
+
label={label}
|
|
153
|
+
type="bool"
|
|
154
|
+
name="sortable"
|
|
155
|
+
value={get(labelForm, 'sortable', false)}
|
|
156
|
+
onChange={handleChangeEditLabel}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
</FormattedMessage>
|
|
160
|
+
</div>
|
|
161
|
+
)}
|
|
162
|
+
</>
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<LayoutDndProvider
|
|
168
|
+
isDraggingSibling={isDraggingSibling}
|
|
169
|
+
setIsDraggingSibling={setIsDraggingSibling}
|
|
170
|
+
>
|
|
171
|
+
<SettingsViewWrapper
|
|
172
|
+
displayedFields={displayedFields}
|
|
173
|
+
inputs={forms}
|
|
174
|
+
isLoading={false}
|
|
175
|
+
initialData={initialData}
|
|
176
|
+
modifiedData={modifiedData}
|
|
177
|
+
onChange={handleChange}
|
|
178
|
+
onConfirmReset={() => {
|
|
179
|
+
dispatch({
|
|
180
|
+
type: 'ON_RESET',
|
|
181
|
+
});
|
|
182
|
+
}}
|
|
183
|
+
onConfirmSubmit={handleConfirm}
|
|
184
|
+
onModalConfirmClosed={updateMenu}
|
|
185
|
+
name={getName}
|
|
186
|
+
>
|
|
187
|
+
<DragWrapper>
|
|
188
|
+
<div className="row">
|
|
189
|
+
<div className="col-12">
|
|
190
|
+
<SortWrapper
|
|
191
|
+
ref={drop}
|
|
192
|
+
style={{
|
|
193
|
+
display: 'flex',
|
|
194
|
+
width: '100%',
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
{displayedFields.map((item, index) => {
|
|
198
|
+
const label = get(modifiedData, ['metadatas', item, 'list', 'label'], '');
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<Label
|
|
202
|
+
count={displayedFields.length}
|
|
203
|
+
key={item}
|
|
204
|
+
index={index}
|
|
205
|
+
isDraggingSibling={isDraggingSibling}
|
|
206
|
+
label={label}
|
|
207
|
+
move={move}
|
|
208
|
+
name={item}
|
|
209
|
+
onClick={handleClickEditLabel}
|
|
210
|
+
onRemove={e => {
|
|
211
|
+
e.stopPropagation();
|
|
212
|
+
|
|
213
|
+
if (displayedFields.length === 1) {
|
|
214
|
+
strapi.notification.toggle({
|
|
215
|
+
type: 'info',
|
|
216
|
+
message: { id: `${pluginId}.notification.info.minimumFields` },
|
|
217
|
+
});
|
|
218
|
+
} else {
|
|
219
|
+
dispatch({
|
|
220
|
+
type: 'REMOVE_FIELD',
|
|
221
|
+
index,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}}
|
|
225
|
+
selectedItem={labelToEdit}
|
|
226
|
+
setIsDraggingSibling={setIsDraggingSibling}
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
})}
|
|
230
|
+
</SortWrapper>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
<DropdownButton
|
|
234
|
+
isOpen={isOpen}
|
|
235
|
+
toggle={() => {
|
|
236
|
+
if (listRemainingFields.length > 0) {
|
|
237
|
+
setIsOpen(prevState => !prevState);
|
|
238
|
+
}
|
|
239
|
+
}}
|
|
240
|
+
direction="down"
|
|
241
|
+
style={{
|
|
242
|
+
position: 'absolute',
|
|
243
|
+
top: 11,
|
|
244
|
+
right: 10,
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
<Toggle disabled={listRemainingFields.length === 0} />
|
|
248
|
+
<MenuDropdown>
|
|
249
|
+
{listRemainingFields.map(item => (
|
|
250
|
+
<DropdownItem
|
|
251
|
+
key={item}
|
|
252
|
+
onClick={() => {
|
|
253
|
+
dispatch({
|
|
254
|
+
type: 'ADD_FIELD',
|
|
255
|
+
item,
|
|
256
|
+
});
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
{item}
|
|
260
|
+
</DropdownItem>
|
|
261
|
+
))}
|
|
262
|
+
</MenuDropdown>
|
|
263
|
+
</DropdownButton>
|
|
264
|
+
</DragWrapper>
|
|
265
|
+
</SettingsViewWrapper>
|
|
266
|
+
<PopupForm
|
|
267
|
+
headerId={`${pluginId}.containers.ListSettingsView.modal-form.edit-label`}
|
|
268
|
+
isOpen={isModalFormOpen}
|
|
269
|
+
onClosed={handleClosed}
|
|
270
|
+
onSubmit={e => {
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
toggleModalForm();
|
|
273
|
+
dispatch({
|
|
274
|
+
type: 'SUBMIT_LABEL_FORM',
|
|
275
|
+
});
|
|
276
|
+
}}
|
|
277
|
+
onToggle={toggleModalForm}
|
|
278
|
+
renderForm={renderForm}
|
|
279
|
+
subHeaderContent={labelToEdit}
|
|
280
|
+
type={get(attributes, [labelToEdit, 'type'], 'text')}
|
|
281
|
+
/>
|
|
282
|
+
</LayoutDndProvider>
|
|
283
|
+
);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
ListSettingsView.propTypes = {
|
|
287
|
+
layout: PropTypes.shape({
|
|
288
|
+
uid: PropTypes.string.isRequired,
|
|
289
|
+
settings: PropTypes.object.isRequired,
|
|
290
|
+
metadatas: PropTypes.object.isRequired,
|
|
291
|
+
options: PropTypes.object.isRequired,
|
|
292
|
+
attributes: PropTypes.object.isRequired,
|
|
293
|
+
}).isRequired,
|
|
294
|
+
slug: PropTypes.string.isRequired,
|
|
295
|
+
updateLayout: PropTypes.func.isRequired,
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
export default memo(ListSettingsView);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { fromJS } from 'immutable';
|
|
2
|
+
|
|
3
|
+
const initialState = fromJS({
|
|
4
|
+
labelForm: {},
|
|
5
|
+
labelToEdit: '',
|
|
6
|
+
initialData: {},
|
|
7
|
+
modifiedData: {},
|
|
8
|
+
status: 'resolved',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const reducer = (state, action) => {
|
|
12
|
+
const layoutPath = ['modifiedData', 'layouts', 'list'];
|
|
13
|
+
|
|
14
|
+
switch (action.type) {
|
|
15
|
+
case 'ADD_FIELD':
|
|
16
|
+
return state.updateIn(layoutPath, list => list.push(action.item));
|
|
17
|
+
|
|
18
|
+
case 'MOVE_FIELD':
|
|
19
|
+
return state.updateIn(['modifiedData', 'layouts', 'list'], list => {
|
|
20
|
+
return list
|
|
21
|
+
.delete(action.originalIndex)
|
|
22
|
+
.insert(action.atIndex, list.get(action.originalIndex));
|
|
23
|
+
});
|
|
24
|
+
case 'ON_CHANGE':
|
|
25
|
+
return state.updateIn(['modifiedData', ...action.keys.split('.')], () => action.value);
|
|
26
|
+
case 'ON_CHANGE_LABEL_METAS':
|
|
27
|
+
return state.updateIn(['labelForm', action.name], () => action.value);
|
|
28
|
+
case 'ON_RESET':
|
|
29
|
+
return state.update('modifiedData', () => state.get('initialData'));
|
|
30
|
+
case 'REMOVE_FIELD': {
|
|
31
|
+
const defaultSortByPath = ['modifiedData', 'settings', 'defaultSortBy'];
|
|
32
|
+
const defaultSortBy = state.getIn(defaultSortByPath);
|
|
33
|
+
const attrPath = ['modifiedData', 'layouts', 'list', action.index];
|
|
34
|
+
const attrToBeRemoved = state.getIn(attrPath);
|
|
35
|
+
|
|
36
|
+
const firstAttr = state.getIn(['modifiedData', 'layouts', 'list', 1]);
|
|
37
|
+
const firstAttrType = state.getIn(['modifiedData', 'attributes', firstAttr, 'type']);
|
|
38
|
+
const attrToSelect =
|
|
39
|
+
firstAttrType !== 'media' && firstAttrType !== 'richtext' ? firstAttr : 'id';
|
|
40
|
+
|
|
41
|
+
return state
|
|
42
|
+
.removeIn(['modifiedData', 'layouts', 'list', action.index])
|
|
43
|
+
.updateIn(defaultSortByPath, () => {
|
|
44
|
+
if (attrToBeRemoved === defaultSortBy) {
|
|
45
|
+
return attrToSelect;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return defaultSortBy;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
case 'SET_LABEL_TO_EDIT':
|
|
52
|
+
return state
|
|
53
|
+
.update('labelToEdit', () => action.labelToEdit)
|
|
54
|
+
.updateIn(['labelForm', 'label'], () =>
|
|
55
|
+
state.getIn(['modifiedData', 'metadatas', action.labelToEdit, 'list', 'label'])
|
|
56
|
+
)
|
|
57
|
+
.updateIn(['labelForm', 'sortable'], () =>
|
|
58
|
+
state.getIn(['modifiedData', 'metadatas', action.labelToEdit, 'list', 'sortable'])
|
|
59
|
+
);
|
|
60
|
+
case 'UNSET_LABEL_TO_EDIT':
|
|
61
|
+
return state.update('labelToEdit', () => '').update('labelForm', () => fromJS({}));
|
|
62
|
+
case 'SUBMIT_LABEL_FORM': {
|
|
63
|
+
const metaPath = ['modifiedData', 'metadatas', state.get('labelToEdit'), 'list'];
|
|
64
|
+
|
|
65
|
+
return state
|
|
66
|
+
.updateIn([...metaPath, 'label'], () => state.getIn(['labelForm', 'label']))
|
|
67
|
+
.updateIn([...metaPath, 'sortable'], () => state.getIn(['labelForm', 'sortable']));
|
|
68
|
+
}
|
|
69
|
+
case 'SUBMIT_SUCCEEDED':
|
|
70
|
+
return state.update('initialData', () => state.get('modifiedData'));
|
|
71
|
+
default:
|
|
72
|
+
return state;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default reducer;
|
|
77
|
+
export { initialState };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
const StyledLink = styled(Link)`
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
color: #333740;
|
|
10
|
+
font-size: 13px;
|
|
11
|
+
svg {
|
|
12
|
+
margin-right: 10px;
|
|
13
|
+
vertical-align: middle;
|
|
14
|
+
}
|
|
15
|
+
&:hover {
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
span {
|
|
18
|
+
color: #007eff;
|
|
19
|
+
}
|
|
20
|
+
svg {
|
|
21
|
+
g {
|
|
22
|
+
fill: #007eff;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export default StyledLink;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { LayoutIcon, useGlobalContext } from 'strapi-helper-plugin';
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import Link from './StyledLink';
|
|
6
|
+
import Wrapper from './Wrapper';
|
|
7
|
+
|
|
8
|
+
const ConfigureLink = ({ slug }) => {
|
|
9
|
+
const { emitEvent } = useGlobalContext();
|
|
10
|
+
|
|
11
|
+
const handleClick = () => {
|
|
12
|
+
emitEvent('willEditListLayout');
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Wrapper>
|
|
17
|
+
<Link to={`${slug}/configurations/list`} onClick={handleClick}>
|
|
18
|
+
<LayoutIcon />
|
|
19
|
+
<FormattedMessage id="app.links.configure-view" />
|
|
20
|
+
</Link>
|
|
21
|
+
</Wrapper>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
ConfigureLink.propTypes = {
|
|
26
|
+
slug: PropTypes.string.isRequired,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default memo(ConfigureLink);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const Wrapper = styled.li`
|
|
4
|
+
padding: 0 16px;
|
|
5
|
+
height: 36px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
&:hover {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
background-color: ${({ theme }) => theme.main.colors.mediumGrey};
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export default Wrapper;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Checkbox } from '@buffetjs/core';
|
|
4
|
+
import Wrapper from './Wrapper';
|
|
5
|
+
|
|
6
|
+
const Field = ({ name, onChange, value }) => {
|
|
7
|
+
const handleChange = ({ target: { name, value } }) => {
|
|
8
|
+
onChange({ name, value: !value });
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Wrapper>
|
|
13
|
+
<Checkbox name={name} message={name} onChange={handleChange} value={value} />
|
|
14
|
+
</Wrapper>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Field.propTypes = {
|
|
19
|
+
name: PropTypes.string.isRequired,
|
|
20
|
+
onChange: PropTypes.func.isRequired,
|
|
21
|
+
value: PropTypes.bool.isRequired,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default Field;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { themePropTypes } from 'strapi-helper-plugin';
|
|
4
|
+
import { Text } from '@buffetjs/core';
|
|
5
|
+
|
|
6
|
+
const Wrapper = styled(props => <Text as="ul" fontSize="md" {...props} />)`
|
|
7
|
+
margin-bottom: 0;
|
|
8
|
+
padding: 9px 0 0 0;
|
|
9
|
+
min-width: 228px;
|
|
10
|
+
list-style-type: none;
|
|
11
|
+
background-color: ${({ theme }) => theme.main.colors.white};
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
Wrapper.propTypes = {
|
|
15
|
+
...themePropTypes,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default Wrapper;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Field from '../Field';
|
|
4
|
+
import Wrapper from './Wrapper';
|
|
5
|
+
|
|
6
|
+
const Fields = ({ displayedHeaders, items, onChange }) => {
|
|
7
|
+
const getInputValue = useCallback(
|
|
8
|
+
headerName => displayedHeaders.findIndex(({ name }) => name === headerName) !== -1,
|
|
9
|
+
[displayedHeaders]
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Wrapper>
|
|
14
|
+
{items.map(header => (
|
|
15
|
+
<Field key={header} name={header} onChange={onChange} value={getInputValue(header)} />
|
|
16
|
+
))}
|
|
17
|
+
</Wrapper>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Fields.propTypes = {
|
|
22
|
+
displayedHeaders: PropTypes.array.isRequired,
|
|
23
|
+
items: PropTypes.array.isRequired,
|
|
24
|
+
onChange: PropTypes.func.isRequired,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default Fields;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { Flex, Padded, Text } from '@buffetjs/core';
|
|
5
|
+
import { BaselineAlignment, useGlobalContext } from 'strapi-helper-plugin';
|
|
6
|
+
import { getTrad } from '../../../../utils';
|
|
7
|
+
import Reset from './Reset';
|
|
8
|
+
|
|
9
|
+
const Header = ({ onClick, onToggle }) => {
|
|
10
|
+
const { emitEvent } = useGlobalContext();
|
|
11
|
+
|
|
12
|
+
const handleClick = () => {
|
|
13
|
+
onClick();
|
|
14
|
+
onToggle();
|
|
15
|
+
|
|
16
|
+
emitEvent('willChangeListFieldsSettings');
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<BaselineAlignment top size="19px">
|
|
21
|
+
<Padded left right size="xs">
|
|
22
|
+
<Padded left right size="sm">
|
|
23
|
+
<Flex justifyContent="space-between">
|
|
24
|
+
<Text fontWeight="bold">
|
|
25
|
+
<FormattedMessage id={getTrad('containers.ListPage.displayedFields')} />
|
|
26
|
+
</Text>
|
|
27
|
+
<Reset color="mediumBlue" cursor="pointer" onClick={handleClick}>
|
|
28
|
+
<FormattedMessage id={getTrad('containers.Edit.reset')} />
|
|
29
|
+
</Reset>
|
|
30
|
+
</Flex>
|
|
31
|
+
</Padded>
|
|
32
|
+
</Padded>
|
|
33
|
+
</BaselineAlignment>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
Header.propTypes = {
|
|
38
|
+
onClick: PropTypes.func.isRequired,
|
|
39
|
+
onToggle: PropTypes.func.isRequired,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default Header;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Flex, Padded, Picker } from '@buffetjs/core';
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
+
import { Carret } from 'strapi-helper-plugin';
|
|
6
|
+
import Fields from './Fields';
|
|
7
|
+
import Header from './Header';
|
|
8
|
+
import Wrapper from './Wrapper';
|
|
9
|
+
import ConfigureLink from './ConfigureLink';
|
|
10
|
+
|
|
11
|
+
const FieldPicker = ({ displayedHeaders, items, onChange, onClickReset, slug }) => {
|
|
12
|
+
return (
|
|
13
|
+
<Wrapper>
|
|
14
|
+
<Picker
|
|
15
|
+
position="right"
|
|
16
|
+
renderButtonContent={isOpen => (
|
|
17
|
+
<Flex>
|
|
18
|
+
<div>
|
|
19
|
+
<FontAwesomeIcon icon="cog" style={{ marginRight: 5 }} />
|
|
20
|
+
</div>
|
|
21
|
+
<Padded>
|
|
22
|
+
<Carret fill={isOpen ? '#007eff' : '#292b2c'} isUp={isOpen} />
|
|
23
|
+
</Padded>
|
|
24
|
+
</Flex>
|
|
25
|
+
)}
|
|
26
|
+
renderSectionContent={onToggle => (
|
|
27
|
+
<>
|
|
28
|
+
<ConfigureLink slug={slug} />
|
|
29
|
+
<Header onClick={onClickReset} onToggle={onToggle} />
|
|
30
|
+
<Fields displayedHeaders={displayedHeaders} items={items} onChange={onChange} />
|
|
31
|
+
</>
|
|
32
|
+
)}
|
|
33
|
+
/>
|
|
34
|
+
</Wrapper>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
FieldPicker.propTypes = {
|
|
39
|
+
displayedHeaders: PropTypes.array.isRequired,
|
|
40
|
+
items: PropTypes.array.isRequired,
|
|
41
|
+
onChange: PropTypes.func.isRequired,
|
|
42
|
+
onClickReset: PropTypes.func.isRequired,
|
|
43
|
+
slug: PropTypes.string.isRequired,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default memo(FieldPicker);
|