@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,283 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { get, omit, take } from 'lodash';
|
|
4
|
+
import isEqual from 'react-fast-compare';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
import { Inputs as InputsIndex } from '@buffetjs/custom';
|
|
7
|
+
import { NotAllowedInput, useStrapi } from 'strapi-helper-plugin';
|
|
8
|
+
import { useContentTypeLayout } from '../../hooks';
|
|
9
|
+
import { getFieldName } from '../../utils';
|
|
10
|
+
import InputJSONWithErrors from '../InputJSONWithErrors';
|
|
11
|
+
import SelectWrapper from '../SelectWrapper';
|
|
12
|
+
import WysiwygWithErrors from '../WysiwygWithErrors';
|
|
13
|
+
import InputUID from '../InputUID';
|
|
14
|
+
import {
|
|
15
|
+
connect,
|
|
16
|
+
generateOptions,
|
|
17
|
+
getInputType,
|
|
18
|
+
getStep,
|
|
19
|
+
select,
|
|
20
|
+
VALIDATIONS_TO_OMIT,
|
|
21
|
+
} from './utils';
|
|
22
|
+
|
|
23
|
+
function Inputs({
|
|
24
|
+
allowedFields,
|
|
25
|
+
autoFocus,
|
|
26
|
+
fieldSchema,
|
|
27
|
+
formErrors,
|
|
28
|
+
isCreatingEntry,
|
|
29
|
+
keys,
|
|
30
|
+
labelIcon,
|
|
31
|
+
metadatas,
|
|
32
|
+
onBlur,
|
|
33
|
+
onChange,
|
|
34
|
+
readableFields,
|
|
35
|
+
shouldNotRunValidations,
|
|
36
|
+
queryInfos,
|
|
37
|
+
value,
|
|
38
|
+
}) {
|
|
39
|
+
const {
|
|
40
|
+
strapi: { fieldApi },
|
|
41
|
+
} = useStrapi();
|
|
42
|
+
const { contentType: currentContentTypeLayout } = useContentTypeLayout();
|
|
43
|
+
const { formatMessage } = useIntl();
|
|
44
|
+
|
|
45
|
+
const labelIconformatted = labelIcon
|
|
46
|
+
? { icon: labelIcon.icon, title: formatMessage(labelIcon.title) }
|
|
47
|
+
: labelIcon;
|
|
48
|
+
|
|
49
|
+
const disabled = useMemo(() => !get(metadatas, 'editable', true), [metadatas]);
|
|
50
|
+
const type = fieldSchema.type;
|
|
51
|
+
|
|
52
|
+
const errorId = useMemo(() => {
|
|
53
|
+
return get(formErrors, [keys, 'id'], null);
|
|
54
|
+
}, [formErrors, keys]);
|
|
55
|
+
|
|
56
|
+
const errorMessage = errorId ? formatMessage({ id: errorId, defaultMessage: errorId }) : null;
|
|
57
|
+
|
|
58
|
+
const fieldName = useMemo(() => {
|
|
59
|
+
return getFieldName(keys);
|
|
60
|
+
}, [keys]);
|
|
61
|
+
|
|
62
|
+
const validations = useMemo(() => {
|
|
63
|
+
const inputValidations = omit(
|
|
64
|
+
fieldSchema,
|
|
65
|
+
shouldNotRunValidations
|
|
66
|
+
? [...VALIDATIONS_TO_OMIT, 'required', 'minLength']
|
|
67
|
+
: VALIDATIONS_TO_OMIT
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const regexpString = fieldSchema.regex || null;
|
|
71
|
+
|
|
72
|
+
if (regexpString) {
|
|
73
|
+
const regexp = new RegExp(regexpString);
|
|
74
|
+
|
|
75
|
+
if (regexp) {
|
|
76
|
+
inputValidations.regex = regexp;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return inputValidations;
|
|
81
|
+
}, [fieldSchema, shouldNotRunValidations]);
|
|
82
|
+
|
|
83
|
+
const isRequired = useMemo(() => get(validations, ['required'], false), [validations]);
|
|
84
|
+
|
|
85
|
+
const isChildOfDynamicZone = useMemo(() => {
|
|
86
|
+
const attributes = get(currentContentTypeLayout, ['attributes'], {});
|
|
87
|
+
const foundAttributeType = get(attributes, [fieldName[0], 'type'], null);
|
|
88
|
+
|
|
89
|
+
return foundAttributeType === 'dynamiczone';
|
|
90
|
+
}, [currentContentTypeLayout, fieldName]);
|
|
91
|
+
|
|
92
|
+
const inputType = useMemo(() => {
|
|
93
|
+
return getInputType(type);
|
|
94
|
+
}, [type]);
|
|
95
|
+
|
|
96
|
+
const inputValue = useMemo(() => {
|
|
97
|
+
// Fix for input file multipe
|
|
98
|
+
if (type === 'media' && !value) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return value;
|
|
103
|
+
}, [type, value]);
|
|
104
|
+
|
|
105
|
+
const step = useMemo(() => {
|
|
106
|
+
return getStep(type);
|
|
107
|
+
}, [type]);
|
|
108
|
+
|
|
109
|
+
const isUserAllowedToEditField = useMemo(() => {
|
|
110
|
+
const joinedName = fieldName.join('.');
|
|
111
|
+
|
|
112
|
+
if (allowedFields.includes(joinedName)) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (isChildOfDynamicZone) {
|
|
117
|
+
return allowedFields.includes(fieldName[0]);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const isChildOfComponent = fieldName.length > 1;
|
|
121
|
+
|
|
122
|
+
if (isChildOfComponent) {
|
|
123
|
+
const parentFieldName = take(fieldName, fieldName.length - 1).join('.');
|
|
124
|
+
|
|
125
|
+
return allowedFields.includes(parentFieldName);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return false;
|
|
129
|
+
}, [allowedFields, fieldName, isChildOfDynamicZone]);
|
|
130
|
+
|
|
131
|
+
const isUserAllowedToReadField = useMemo(() => {
|
|
132
|
+
const joinedName = fieldName.join('.');
|
|
133
|
+
|
|
134
|
+
if (readableFields.includes(joinedName)) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (isChildOfDynamicZone) {
|
|
139
|
+
return readableFields.includes(fieldName[0]);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const isChildOfComponent = fieldName.length > 1;
|
|
143
|
+
|
|
144
|
+
if (isChildOfComponent) {
|
|
145
|
+
const parentFieldName = take(fieldName, fieldName.length - 1).join('.');
|
|
146
|
+
|
|
147
|
+
return readableFields.includes(parentFieldName);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return false;
|
|
151
|
+
}, [readableFields, fieldName, isChildOfDynamicZone]);
|
|
152
|
+
|
|
153
|
+
const shouldDisplayNotAllowedInput = useMemo(() => {
|
|
154
|
+
return isUserAllowedToReadField || isUserAllowedToEditField;
|
|
155
|
+
}, [isUserAllowedToEditField, isUserAllowedToReadField]);
|
|
156
|
+
|
|
157
|
+
const shouldDisableField = useMemo(() => {
|
|
158
|
+
if (!isCreatingEntry) {
|
|
159
|
+
const doesNotHaveRight = isUserAllowedToReadField && !isUserAllowedToEditField;
|
|
160
|
+
|
|
161
|
+
if (doesNotHaveRight) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return disabled;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return disabled;
|
|
169
|
+
}, [disabled, isCreatingEntry, isUserAllowedToEditField, isUserAllowedToReadField]);
|
|
170
|
+
|
|
171
|
+
const options = useMemo(() => generateOptions(fieldSchema.enum || [], isRequired), [
|
|
172
|
+
fieldSchema,
|
|
173
|
+
isRequired,
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
const otherFields = useMemo(() => {
|
|
177
|
+
return fieldApi.getFields();
|
|
178
|
+
}, [fieldApi]);
|
|
179
|
+
|
|
180
|
+
const { description, visible } = metadatas;
|
|
181
|
+
|
|
182
|
+
if (visible === false) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!shouldDisplayNotAllowedInput) {
|
|
187
|
+
return (
|
|
188
|
+
<NotAllowedInput
|
|
189
|
+
label={metadatas.label}
|
|
190
|
+
labelIcon={labelIconformatted}
|
|
191
|
+
error={errorMessage}
|
|
192
|
+
/>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (type === 'relation') {
|
|
197
|
+
return (
|
|
198
|
+
<div key={keys}>
|
|
199
|
+
<SelectWrapper
|
|
200
|
+
{...metadatas}
|
|
201
|
+
{...fieldSchema}
|
|
202
|
+
labelIcon={labelIcon}
|
|
203
|
+
isUserAllowedToEditField={isUserAllowedToEditField}
|
|
204
|
+
isUserAllowedToReadField={isUserAllowedToReadField}
|
|
205
|
+
name={keys}
|
|
206
|
+
queryInfos={queryInfos}
|
|
207
|
+
value={value}
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<InputsIndex
|
|
215
|
+
{...metadatas}
|
|
216
|
+
autoComplete="new-password"
|
|
217
|
+
autoFocus={autoFocus}
|
|
218
|
+
disabled={shouldDisableField}
|
|
219
|
+
error={errorMessage}
|
|
220
|
+
inputDescription={description}
|
|
221
|
+
labelIcon={labelIconformatted}
|
|
222
|
+
description={description}
|
|
223
|
+
contentTypeUID={currentContentTypeLayout.uid}
|
|
224
|
+
customInputs={{
|
|
225
|
+
json: InputJSONWithErrors,
|
|
226
|
+
wysiwyg: WysiwygWithErrors,
|
|
227
|
+
uid: InputUID,
|
|
228
|
+
...otherFields,
|
|
229
|
+
}}
|
|
230
|
+
multiple={fieldSchema.multiple || false}
|
|
231
|
+
attribute={fieldSchema}
|
|
232
|
+
name={keys}
|
|
233
|
+
onBlur={onBlur}
|
|
234
|
+
onChange={onChange}
|
|
235
|
+
options={options}
|
|
236
|
+
step={step}
|
|
237
|
+
type={inputType}
|
|
238
|
+
validations={validations}
|
|
239
|
+
value={inputValue}
|
|
240
|
+
withDefaultValue={false}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
Inputs.defaultProps = {
|
|
246
|
+
autoFocus: false,
|
|
247
|
+
formErrors: {},
|
|
248
|
+
labelIcon: null,
|
|
249
|
+
onBlur: null,
|
|
250
|
+
queryInfos: {},
|
|
251
|
+
value: null,
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
Inputs.propTypes = {
|
|
255
|
+
allowedFields: PropTypes.array.isRequired,
|
|
256
|
+
autoFocus: PropTypes.bool,
|
|
257
|
+
fieldSchema: PropTypes.object.isRequired,
|
|
258
|
+
formErrors: PropTypes.object,
|
|
259
|
+
keys: PropTypes.string.isRequired,
|
|
260
|
+
isCreatingEntry: PropTypes.bool.isRequired,
|
|
261
|
+
labelIcon: PropTypes.shape({
|
|
262
|
+
icon: PropTypes.node.isRequired,
|
|
263
|
+
title: PropTypes.shape({
|
|
264
|
+
id: PropTypes.string.isRequired,
|
|
265
|
+
defaultMessage: PropTypes.string.isRequired,
|
|
266
|
+
}).isRequired,
|
|
267
|
+
}),
|
|
268
|
+
metadatas: PropTypes.object.isRequired,
|
|
269
|
+
onBlur: PropTypes.func,
|
|
270
|
+
onChange: PropTypes.func.isRequired,
|
|
271
|
+
readableFields: PropTypes.array.isRequired,
|
|
272
|
+
shouldNotRunValidations: PropTypes.bool.isRequired,
|
|
273
|
+
queryInfos: PropTypes.shape({
|
|
274
|
+
containsKey: PropTypes.string,
|
|
275
|
+
defaultParams: PropTypes.object,
|
|
276
|
+
endPoint: PropTypes.string,
|
|
277
|
+
}),
|
|
278
|
+
value: PropTypes.any,
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const Memoized = memo(Inputs, isEqual);
|
|
282
|
+
|
|
283
|
+
export default connect(Memoized, select);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function connect(WrappedComponent, select) {
|
|
4
|
+
return function(props) {
|
|
5
|
+
// eslint-disable-next-line react/prop-types
|
|
6
|
+
const selectors = select(props.keys);
|
|
7
|
+
|
|
8
|
+
return <WrappedComponent {...props} {...selectors} />;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default connect;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
|
|
4
|
+
const generateOptions = (options, isRequired = false) => [
|
|
5
|
+
<FormattedMessage id="components.InputSelect.option.placeholder" key="__enum_option_null">
|
|
6
|
+
{msg => (
|
|
7
|
+
<option disabled={isRequired} hidden={isRequired} value="">
|
|
8
|
+
{msg}
|
|
9
|
+
</option>
|
|
10
|
+
)}
|
|
11
|
+
</FormattedMessage>,
|
|
12
|
+
...options.map(v => (
|
|
13
|
+
<option key={v} value={v}>
|
|
14
|
+
{v}
|
|
15
|
+
</option>
|
|
16
|
+
)),
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export default generateOptions;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { toLower } from 'lodash';
|
|
2
|
+
|
|
3
|
+
const getInputType = (type = '') => {
|
|
4
|
+
switch (toLower(type)) {
|
|
5
|
+
case 'boolean':
|
|
6
|
+
return 'bool';
|
|
7
|
+
case 'biginteger':
|
|
8
|
+
return 'text';
|
|
9
|
+
case 'decimal':
|
|
10
|
+
case 'float':
|
|
11
|
+
case 'integer':
|
|
12
|
+
return 'number';
|
|
13
|
+
case 'date':
|
|
14
|
+
case 'datetime':
|
|
15
|
+
case 'time':
|
|
16
|
+
return type;
|
|
17
|
+
case 'email':
|
|
18
|
+
return 'email';
|
|
19
|
+
case 'enumeration':
|
|
20
|
+
return 'select';
|
|
21
|
+
case 'password':
|
|
22
|
+
return 'password';
|
|
23
|
+
case 'string':
|
|
24
|
+
return 'text';
|
|
25
|
+
case 'text':
|
|
26
|
+
return 'textarea';
|
|
27
|
+
case 'media':
|
|
28
|
+
case 'file':
|
|
29
|
+
case 'files':
|
|
30
|
+
return 'media';
|
|
31
|
+
case 'json':
|
|
32
|
+
return 'json';
|
|
33
|
+
case 'wysiwyg':
|
|
34
|
+
case 'WYSIWYG':
|
|
35
|
+
case 'richtext':
|
|
36
|
+
return 'wysiwyg';
|
|
37
|
+
case 'uid':
|
|
38
|
+
return 'uid';
|
|
39
|
+
default:
|
|
40
|
+
return type || 'text';
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default getInputType;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const getStep = type => {
|
|
2
|
+
let step;
|
|
3
|
+
|
|
4
|
+
if (type === 'float' || type === 'decimal') {
|
|
5
|
+
step = 0.01;
|
|
6
|
+
} else if (type === 'time' || type === 'datetime') {
|
|
7
|
+
step = 30;
|
|
8
|
+
} else {
|
|
9
|
+
step = 1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return step;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default getStep;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as connect } from './connect';
|
|
2
|
+
export { default as generateOptions } from './generateOptions';
|
|
3
|
+
export { default as getInputType } from './getInputType';
|
|
4
|
+
export { default as getStep } from './getStep';
|
|
5
|
+
export { default as select } from './select';
|
|
6
|
+
export { default as VALIDATIONS_TO_OMIT } from './VALIDATIONS_TO_OMIT';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { get } from 'lodash';
|
|
3
|
+
import { useContentManagerEditViewDataManager } from 'strapi-helper-plugin';
|
|
4
|
+
|
|
5
|
+
function useSelect(keys) {
|
|
6
|
+
const {
|
|
7
|
+
createActionAllowedFields,
|
|
8
|
+
formErrors,
|
|
9
|
+
isCreatingEntry,
|
|
10
|
+
modifiedData,
|
|
11
|
+
onChange,
|
|
12
|
+
readActionAllowedFields,
|
|
13
|
+
shouldNotRunValidations,
|
|
14
|
+
updateActionAllowedFields,
|
|
15
|
+
} = useContentManagerEditViewDataManager();
|
|
16
|
+
|
|
17
|
+
const allowedFields = useMemo(() => {
|
|
18
|
+
return isCreatingEntry ? createActionAllowedFields : updateActionAllowedFields;
|
|
19
|
+
}, [isCreatingEntry, createActionAllowedFields, updateActionAllowedFields]);
|
|
20
|
+
|
|
21
|
+
const readableFields = useMemo(() => {
|
|
22
|
+
return isCreatingEntry ? [] : readActionAllowedFields;
|
|
23
|
+
}, [isCreatingEntry, readActionAllowedFields]);
|
|
24
|
+
|
|
25
|
+
const value = get(modifiedData, keys, null);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
allowedFields,
|
|
29
|
+
formErrors,
|
|
30
|
+
isCreatingEntry,
|
|
31
|
+
onChange,
|
|
32
|
+
readableFields,
|
|
33
|
+
shouldNotRunValidations,
|
|
34
|
+
value,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default useSelect;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const LayoutTitle = styled.div`
|
|
4
|
+
color: #333740;
|
|
5
|
+
font-size: 13px;
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
line-height: 18px;
|
|
8
|
+
|
|
9
|
+
p {
|
|
10
|
+
margin-top: 2px;
|
|
11
|
+
margin-bottom: 13px;
|
|
12
|
+
color: #9ea7b8;
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
font-weight: 400;
|
|
15
|
+
line-height: normal;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export default LayoutTitle;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const sizes = {
|
|
4
|
+
small: '35px',
|
|
5
|
+
big: '127px',
|
|
6
|
+
margin: '20px',
|
|
7
|
+
};
|
|
8
|
+
const max = 4;
|
|
9
|
+
|
|
10
|
+
const StyledMediaPreviewList = styled.div`
|
|
11
|
+
position: relative;
|
|
12
|
+
height: ${sizes.small};
|
|
13
|
+
> div {
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
${createCSS()};
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
function createCSS() {
|
|
21
|
+
let styles = '';
|
|
22
|
+
|
|
23
|
+
for (let i = 0; i <= max; i += 1) {
|
|
24
|
+
styles += `
|
|
25
|
+
&:nth-of-type(${i}) {
|
|
26
|
+
left: calc( ${sizes.margin} * ${i - 1});
|
|
27
|
+
z-index: ${i};
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return css`
|
|
33
|
+
${styles}
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const MediaPreviewItem = styled.div`
|
|
38
|
+
width: ${sizes.small};
|
|
39
|
+
height: ${sizes.small};
|
|
40
|
+
div {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
border-radius: calc(${sizes.small} / 2);
|
|
45
|
+
background-color: #f3f3f4;
|
|
46
|
+
border: 1px solid #f3f3f4;
|
|
47
|
+
}
|
|
48
|
+
&.hoverable {
|
|
49
|
+
:hover {
|
|
50
|
+
z-index: ${max + 1};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const MediaPreviewFile = styled(MediaPreviewItem)`
|
|
56
|
+
span {
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
}
|
|
61
|
+
div {
|
|
62
|
+
position: relative;
|
|
63
|
+
background-color: #f3f3f4;
|
|
64
|
+
color: #333740;
|
|
65
|
+
text-align: center;
|
|
66
|
+
line-height: ${sizes.small};
|
|
67
|
+
border: 1px solid white;
|
|
68
|
+
span {
|
|
69
|
+
display: block;
|
|
70
|
+
padding: 0 3px;
|
|
71
|
+
text-transform: uppercase;
|
|
72
|
+
font-size: 10px;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
}
|
|
75
|
+
i,
|
|
76
|
+
svg {
|
|
77
|
+
position: absolute;
|
|
78
|
+
left: 1px;
|
|
79
|
+
top: -1px;
|
|
80
|
+
font-size: 15px;
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
&:before {
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
padding: 10px;
|
|
87
|
+
line-height: 35px;
|
|
88
|
+
background: #f3f3f4;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
div + span {
|
|
93
|
+
display: none;
|
|
94
|
+
position: absolute;
|
|
95
|
+
left: 120%;
|
|
96
|
+
bottom: -10px;
|
|
97
|
+
max-width: 150px;
|
|
98
|
+
color: #333740;
|
|
99
|
+
}
|
|
100
|
+
&.hoverable {
|
|
101
|
+
:hover {
|
|
102
|
+
div + span {
|
|
103
|
+
display: block;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
const MediaPreviewText = styled(MediaPreviewItem)`
|
|
110
|
+
div {
|
|
111
|
+
font-size: 13px;
|
|
112
|
+
color: #333740;
|
|
113
|
+
text-align: center;
|
|
114
|
+
line-height: ${sizes.small};
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
const MediaPreviewImage = styled(MediaPreviewItem)`
|
|
120
|
+
img {
|
|
121
|
+
display: block;
|
|
122
|
+
object-fit: cover;
|
|
123
|
+
background-color: #fafafb;
|
|
124
|
+
}
|
|
125
|
+
div {
|
|
126
|
+
position: relative;
|
|
127
|
+
&::before {
|
|
128
|
+
content: '-';
|
|
129
|
+
position: absolute;
|
|
130
|
+
width: 100%;
|
|
131
|
+
height: 100%;
|
|
132
|
+
background: white;
|
|
133
|
+
color: transparent;
|
|
134
|
+
opacity: 0;
|
|
135
|
+
}
|
|
136
|
+
img {
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
div + img {
|
|
142
|
+
display: none;
|
|
143
|
+
width: ${sizes.big};
|
|
144
|
+
height: ${sizes.big};
|
|
145
|
+
border-radius: calc(${sizes.big} / 2);
|
|
146
|
+
margin-top: calc(${`-${sizes.big}`} - ${sizes.small} - 5px);
|
|
147
|
+
margin-left: calc((${sizes.small} - ${sizes.big}) / 2);
|
|
148
|
+
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.hoverable {
|
|
152
|
+
:hover {
|
|
153
|
+
div {
|
|
154
|
+
&::before {
|
|
155
|
+
opacity: 0.6;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
div + img {
|
|
159
|
+
display: block;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
MediaPreviewFile,
|
|
167
|
+
MediaPreviewImage,
|
|
168
|
+
MediaPreviewItem,
|
|
169
|
+
MediaPreviewText,
|
|
170
|
+
StyledMediaPreviewList,
|
|
171
|
+
};
|