@akemona-org/strapi-plugin-upload 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 +19 -0
- package/admin/src/assets/images/logo.svg +1 -0
- package/admin/src/components/BrowseAssets/Wrapper.js +8 -0
- package/admin/src/components/BrowseAssets/index.js +182 -0
- package/admin/src/components/Card/index.js +146 -0
- package/admin/src/components/CardBorder/index.js +28 -0
- package/admin/src/components/CardControl/Wrapper.js +89 -0
- package/admin/src/components/CardControl/index.js +61 -0
- package/admin/src/components/CardControlsWrapper/index.js +22 -0
- package/admin/src/components/CardEmpty/Bar.js +19 -0
- package/admin/src/components/CardEmpty/Wrapper.js +7 -0
- package/admin/src/components/CardEmpty/index.js +16 -0
- package/admin/src/components/CardErrorMessage/index.js +9 -0
- package/admin/src/components/CardImgWrapper/index.js +52 -0
- package/admin/src/components/CardPreview/Image.js +12 -0
- package/admin/src/components/CardPreview/Wrapper.js +25 -0
- package/admin/src/components/CardPreview/index.js +66 -0
- package/admin/src/components/CardTitle/index.js +14 -0
- package/admin/src/components/CardWrapper/index.js +23 -0
- package/admin/src/components/CheckControl/Button.js +49 -0
- package/admin/src/components/CheckControl/CustomDropdownSection.js +9 -0
- package/admin/src/components/CheckControl/Spacer.js +7 -0
- package/admin/src/components/CheckControl/index.js +74 -0
- package/admin/src/components/Container/index.js +7 -0
- package/admin/src/components/ContainerFluid/index.js +12 -0
- package/admin/src/components/ControlsWrapper/index.js +9 -0
- package/admin/src/components/DragLayer/Wrapper.js +13 -0
- package/admin/src/components/DragLayer/index.js +68 -0
- package/admin/src/components/DropdownButton/index.js +63 -0
- package/admin/src/components/DropdownSection/index.js +27 -0
- package/admin/src/components/Duration/index.js +25 -0
- package/admin/src/components/Duration/utils/formatDuration.js +13 -0
- package/admin/src/components/EditForm/CropWrapper.js +21 -0
- package/admin/src/components/EditForm/ErrorMessage.js +10 -0
- package/admin/src/components/EditForm/FileDetailsBox.js +95 -0
- package/admin/src/components/EditForm/FileDetailsBoxWrapper.js +14 -0
- package/admin/src/components/EditForm/FileWrapper.js +41 -0
- package/admin/src/components/EditForm/FormWrapper.js +7 -0
- package/admin/src/components/EditForm/SizeBox.js +13 -0
- package/admin/src/components/EditForm/Wrapper.js +8 -0
- package/admin/src/components/EditForm/index.js +425 -0
- package/admin/src/components/EditForm/utils/form.js +34 -0
- package/admin/src/components/EditForm/utils/isImageType.js +3 -0
- package/admin/src/components/EditForm/utils/isVideoType.js +3 -0
- package/admin/src/components/FileIcon/Wrapper.js +20 -0
- package/admin/src/components/FileIcon/index.js +33 -0
- package/admin/src/components/FileIcon/utils/extensions.json +4 -0
- package/admin/src/components/FileInfos/index.js +32 -0
- package/admin/src/components/Filters/index.js +30 -0
- package/admin/src/components/FiltersList/index.js +34 -0
- package/admin/src/components/FiltersList/utils/formatFilter.js +36 -0
- package/admin/src/components/FiltersPicker/FiltersCard/FilterButton.js +8 -0
- package/admin/src/components/FiltersPicker/FiltersCard/FilterInput.js +35 -0
- package/admin/src/components/FiltersPicker/FiltersCard/InputWrapper.js +10 -0
- package/admin/src/components/FiltersPicker/FiltersCard/SizeInput.js +57 -0
- package/admin/src/components/FiltersPicker/FiltersCard/Wrapper.js +8 -0
- package/admin/src/components/FiltersPicker/FiltersCard/index.js +97 -0
- package/admin/src/components/FiltersPicker/FiltersCard/init.js +21 -0
- package/admin/src/components/FiltersPicker/FiltersCard/reducer.js +47 -0
- package/admin/src/components/FiltersPicker/FiltersCard/utils/filtersForm.js +27 -0
- package/admin/src/components/FiltersPicker/index.js +43 -0
- package/admin/src/components/FiltersPicker/utils/formatFilter.js +18 -0
- package/admin/src/components/InfiniteLoadingIndicator/Button.js +20 -0
- package/admin/src/components/InfiniteLoadingIndicator/Container.js +12 -0
- package/admin/src/components/InfiniteLoadingIndicator/Wrapper.js +18 -0
- package/admin/src/components/InfiniteLoadingIndicator/index.js +39 -0
- package/admin/src/components/Input/index.js +7 -0
- package/admin/src/components/InputFileModal/Label.js +47 -0
- package/admin/src/components/InputFileModal/P.js +15 -0
- package/admin/src/components/InputFileModal/index.js +73 -0
- package/admin/src/components/InputMedia/CardControlWrapper.js +12 -0
- package/admin/src/components/InputMedia/CardPreviewWrapper.js +13 -0
- package/admin/src/components/InputMedia/Chevron/Wrapper.js +10 -0
- package/admin/src/components/InputMedia/Chevron/index.js +21 -0
- package/admin/src/components/InputMedia/EmptyInputMedia.js +60 -0
- package/admin/src/components/InputMedia/EmptyText.js +13 -0
- package/admin/src/components/InputMedia/ErrorMessage.js +12 -0
- package/admin/src/components/InputMedia/IconUpload.js +48 -0
- package/admin/src/components/InputMedia/InputFilePreview.js +37 -0
- package/admin/src/components/InputMedia/Name.js +10 -0
- package/admin/src/components/InputMedia/Wrapper.js +11 -0
- package/admin/src/components/InputMedia/index.js +238 -0
- package/admin/src/components/InputUploadURL/Wrapper.js +13 -0
- package/admin/src/components/InputUploadURL/index.js +46 -0
- package/admin/src/components/IntlText/index.js +26 -0
- package/admin/src/components/List/ListCell.js +19 -0
- package/admin/src/components/List/ListRow.js +8 -0
- package/admin/src/components/List/index.js +114 -0
- package/admin/src/components/ListEmpty/Wrapper.js +15 -0
- package/admin/src/components/ListEmpty/index.js +70 -0
- package/admin/src/components/ListEmpty/utils/generateRows.js +12 -0
- package/admin/src/components/ListModal/BaselineAlignmentWrapper.js +12 -0
- package/admin/src/components/ListModal/index.js +66 -0
- package/admin/src/components/ListWrapper/index.js +16 -0
- package/admin/src/components/LoadingIndicator/index.js +44 -0
- package/admin/src/components/ModalHeader/BackButton.js +33 -0
- package/admin/src/components/ModalHeader/Wrapper.js +24 -0
- package/admin/src/components/ModalHeader/index.js +47 -0
- package/admin/src/components/ModalNavWrapper/BaselineAlignment.js +12 -0
- package/admin/src/components/ModalNavWrapper/Hr.js +14 -0
- package/admin/src/components/ModalNavWrapper/Wrapper.js +8 -0
- package/admin/src/components/ModalNavWrapper/index.js +70 -0
- package/admin/src/components/ModalSection/index.js +20 -0
- package/admin/src/components/ModalTab/Count/Wrapper.js +16 -0
- package/admin/src/components/ModalTab/Count/index.js +30 -0
- package/admin/src/components/ModalTab/Wrapper.js +37 -0
- package/admin/src/components/ModalTab/index.js +60 -0
- package/admin/src/components/PlayIcon/Play.js +65 -0
- package/admin/src/components/PlayIcon/Wrapper.js +24 -0
- package/admin/src/components/PlayIcon/index.js +23 -0
- package/admin/src/components/SelectAll/Wrapper.js +19 -0
- package/admin/src/components/SelectAll/index.js +26 -0
- package/admin/src/components/SelectedAssets/DraggableCard.js +149 -0
- package/admin/src/components/SelectedAssets/ListTitleWrapper.js +7 -0
- package/admin/src/components/SelectedAssets/ListWrapper.js +7 -0
- package/admin/src/components/SelectedAssets/SortableList.js +102 -0
- package/admin/src/components/SelectedAssets/Wrapper.js +7 -0
- package/admin/src/components/SelectedAssets/index.js +56 -0
- package/admin/src/components/SortList/Wrapper.js +19 -0
- package/admin/src/components/SortList/index.js +37 -0
- package/admin/src/components/SortListItem/Wrapper.js +28 -0
- package/admin/src/components/SortListItem/index.js +35 -0
- package/admin/src/components/SortPicker/index.js +54 -0
- package/admin/src/components/Tag/Wrapper.js +16 -0
- package/admin/src/components/Tag/index.js +25 -0
- package/admin/src/components/UploadForm/index.js +61 -0
- package/admin/src/components/UploadList/ButtonWrapper.js +7 -0
- package/admin/src/components/UploadList/Container.js +10 -0
- package/admin/src/components/UploadList/CustomModalSection.js +9 -0
- package/admin/src/components/UploadList/ListTitle.js +10 -0
- package/admin/src/components/UploadList/ListTitleWrapper.js +7 -0
- package/admin/src/components/UploadList/RowItem.js +98 -0
- package/admin/src/components/UploadList/index.js +90 -0
- package/admin/src/components/VideoPlayer/Wrapper.js +24 -0
- package/admin/src/components/VideoPlayer/index.js +57 -0
- package/admin/src/components/VideoPreview/CanvasWrapper.js +22 -0
- package/admin/src/components/VideoPreview/Thumbnail.js +12 -0
- package/admin/src/components/VideoPreview/Wrapper.js +15 -0
- package/admin/src/components/VideoPreview/index.js +165 -0
- package/admin/src/components/VideoPreview/reducer.js +33 -0
- package/admin/src/containers/App/index.js +31 -0
- package/admin/src/containers/HomePage/HomePageContent/HomePageList.js +98 -0
- package/admin/src/containers/HomePage/HomePageContent/HomePageSettings.js +103 -0
- package/admin/src/containers/HomePage/HomePageContent/index.js +90 -0
- package/admin/src/containers/HomePage/components.js +18 -0
- package/admin/src/containers/HomePage/index.js +373 -0
- package/admin/src/containers/HomePage/init.js +5 -0
- package/admin/src/containers/HomePage/reducer.js +88 -0
- package/admin/src/containers/HomePage/utils/generateParamsFromQuery.js +14 -0
- package/admin/src/containers/HomePage/utils/generateStringFromParams.js +27 -0
- package/admin/src/containers/HomePage/utils/getHeaderLabel.js +13 -0
- package/admin/src/containers/HomePage/utils/index.js +2 -0
- package/admin/src/containers/Initializer/index.js +44 -0
- package/admin/src/containers/InputModalStepper/HeaderSearch.js +12 -0
- package/admin/src/containers/InputModalStepper/InputModalStepper.js +480 -0
- package/admin/src/containers/InputModalStepper/Search.js +48 -0
- package/admin/src/containers/InputModalStepper/index.js +86 -0
- package/admin/src/containers/InputModalStepper/stepper.js +52 -0
- package/admin/src/containers/InputModalStepperProvider/index.js +564 -0
- package/admin/src/containers/InputModalStepperProvider/init.js +5 -0
- package/admin/src/containers/InputModalStepperProvider/reducer.js +301 -0
- package/admin/src/containers/ModalStepper/index.js +629 -0
- package/admin/src/containers/ModalStepper/init.js +5 -0
- package/admin/src/containers/ModalStepper/reducer.js +132 -0
- package/admin/src/containers/ModalStepper/stepper.js +46 -0
- package/admin/src/containers/SettingsPage/Divider.js +11 -0
- package/admin/src/containers/SettingsPage/SectionTitleWrapper.js +7 -0
- package/admin/src/containers/SettingsPage/Wrapper.js +17 -0
- package/admin/src/containers/SettingsPage/index.js +198 -0
- package/admin/src/containers/SettingsPage/init.js +5 -0
- package/admin/src/containers/SettingsPage/reducer.js +38 -0
- package/admin/src/contexts/AppContext/index.js +5 -0
- package/admin/src/contexts/InputModal/InputModalDataManager.js +5 -0
- package/admin/src/contexts/index.js +2 -0
- package/admin/src/hooks/index.js +2 -0
- package/admin/src/hooks/useAppContext/index.js +6 -0
- package/admin/src/hooks/useModalContext.js +6 -0
- package/admin/src/icons/BrokenFile/index.js +91 -0
- package/admin/src/icons/Cloud/index.js +35 -0
- package/admin/src/icons/DoubleFile/index.js +35 -0
- package/admin/src/icons/Download/index.js +36 -0
- package/admin/src/icons/File/index.js +35 -0
- package/admin/src/index.js +85 -0
- package/admin/src/lifecycles.js +13 -0
- package/admin/src/permissions.js +40 -0
- package/admin/src/pluginId.js +5 -0
- package/admin/src/translations/de.json +81 -0
- package/admin/src/translations/dk.json +81 -0
- package/admin/src/translations/en.json +86 -0
- package/admin/src/translations/es.json +81 -0
- package/admin/src/translations/fr.json +85 -0
- package/admin/src/translations/he.json +81 -0
- package/admin/src/translations/index.js +39 -0
- package/admin/src/translations/it.json +82 -0
- package/admin/src/translations/ja.json +81 -0
- package/admin/src/translations/ms.json +73 -0
- package/admin/src/translations/pl.json +81 -0
- package/admin/src/translations/pt-BR.json +81 -0
- package/admin/src/translations/ru.json +81 -0
- package/admin/src/translations/sk.json +81 -0
- package/admin/src/translations/th.json +81 -0
- package/admin/src/translations/uk.json +78 -0
- package/admin/src/translations/zh-Hans.json +86 -0
- package/admin/src/translations/zh.json +81 -0
- package/admin/src/utils/ItemTypes.js +3 -0
- package/admin/src/utils/canDownloadFile.js +3 -0
- package/admin/src/utils/compactParams.js +13 -0
- package/admin/src/utils/createFileToDownloadName.js +9 -0
- package/admin/src/utils/createMatrix.js +32 -0
- package/admin/src/utils/createNewFilesToDownloadArray.js +57 -0
- package/admin/src/utils/createNewFilesToUploadArray.js +25 -0
- package/admin/src/utils/formatBytes.js +13 -0
- package/admin/src/utils/formatFileForEditing.js +20 -0
- package/admin/src/utils/formatFilters.js +23 -0
- package/admin/src/utils/generatePageFromStart.js +5 -0
- package/admin/src/utils/generateStartFromPage.js +5 -0
- package/admin/src/utils/getFileModelTimestamps.js +15 -0
- package/admin/src/utils/getFilesToDownload.js +5 -0
- package/admin/src/utils/getRequestUrl.js +5 -0
- package/admin/src/utils/getTrad.js +5 -0
- package/admin/src/utils/getType.js +15 -0
- package/admin/src/utils/getYupError.js +17 -0
- package/admin/src/utils/index.js +20 -0
- package/admin/src/utils/unformatBytes.js +16 -0
- package/admin/src/utils/urlYupSchema.js +49 -0
- package/config/config.json +8 -0
- package/config/functions/bootstrap.js +143 -0
- package/config/routes.json +98 -0
- package/config/schema.graphql.js +96 -0
- package/controllers/Upload.js +103 -0
- package/controllers/upload/admin.js +213 -0
- package/controllers/upload/api.js +125 -0
- package/controllers/validation/settings.js +22 -0
- package/controllers/validation/upload.js +27 -0
- package/documentation/1.0.0/overrides/upload-File.json +263 -0
- package/errors.js +48 -0
- package/index.js +7 -0
- package/middlewares/upload/defaults.json +5 -0
- package/middlewares/upload/index.js +35 -0
- package/models/File.js +7 -0
- package/models/File.settings.json +86 -0
- package/package.json +71 -0
- package/services/Upload.js +397 -0
- package/services/image-manipulation.js +167 -0
- package/utils/file.js +23 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import CardControlWrapper from './CardControlWrapper';
|
|
4
|
+
|
|
5
|
+
const CardPreviewWrapper = styled.div`
|
|
6
|
+
position: relative;
|
|
7
|
+
height: 20rem;
|
|
8
|
+
&:hover ${CardControlWrapper} {
|
|
9
|
+
opacity: 1;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export default CardPreviewWrapper;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import Wrapper from './Wrapper';
|
|
6
|
+
|
|
7
|
+
const Chevron = ({ side, onClick }) => (
|
|
8
|
+
<Wrapper onClick={onClick}>
|
|
9
|
+
<FontAwesomeIcon color="white" icon={`chevron-${side}`} />
|
|
10
|
+
</Wrapper>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
Chevron.propTypes = {
|
|
14
|
+
onClick: PropTypes.func.isRequired,
|
|
15
|
+
side: PropTypes.string,
|
|
16
|
+
};
|
|
17
|
+
Chevron.defaultProps = {
|
|
18
|
+
side: 'right',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default Chevron;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { useIntl } from 'react-intl';
|
|
5
|
+
import { getTrad } from '../../utils';
|
|
6
|
+
import IconUpload from './IconUpload';
|
|
7
|
+
|
|
8
|
+
const EmptyInputMediaWrapper = styled.div`
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
border-radius: ${({ theme }) => theme.main.sizes.borderRadius};
|
|
18
|
+
background-color: ${({ theme, isInDropZone }) =>
|
|
19
|
+
isInDropZone ? '#515764' : theme.main.colors.black};
|
|
20
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
21
|
+
|
|
22
|
+
& * {
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const EmptyInputMedia = ({ children, ...props }) => {
|
|
28
|
+
const { formatMessage } = useIntl();
|
|
29
|
+
|
|
30
|
+
const [isInDropZone, setIsInDropZone] = useState(false);
|
|
31
|
+
|
|
32
|
+
const handleDragEnter = () => setIsInDropZone(true);
|
|
33
|
+
const handleResetDropZone = () => setIsInDropZone(false);
|
|
34
|
+
|
|
35
|
+
const titleSvgTranslate = formatMessage({ id: getTrad('input.placeholder.icon') });
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<EmptyInputMediaWrapper
|
|
39
|
+
{...props}
|
|
40
|
+
onDragEnter={handleDragEnter}
|
|
41
|
+
onDragLeave={handleResetDropZone}
|
|
42
|
+
onDrop={handleResetDropZone}
|
|
43
|
+
isInDropZone={isInDropZone}
|
|
44
|
+
>
|
|
45
|
+
<IconUpload title={titleSvgTranslate} />
|
|
46
|
+
{isInDropZone ? null : children}
|
|
47
|
+
</EmptyInputMediaWrapper>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
EmptyInputMedia.propTypes = {
|
|
52
|
+
disabled: PropTypes.bool,
|
|
53
|
+
children: PropTypes.node.isRequired,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
EmptyInputMedia.defaultProps = {
|
|
57
|
+
disabled: false,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default EmptyInputMedia;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import IntlText from '../IntlText';
|
|
3
|
+
|
|
4
|
+
const EmptyText = styled(IntlText)`
|
|
5
|
+
position: absolute;
|
|
6
|
+
width: 17rem;
|
|
7
|
+
margin-top: -0.3rem;
|
|
8
|
+
line-height: 1.8rem;
|
|
9
|
+
text-align: center;
|
|
10
|
+
color: ${({ theme }) => theme.main.colors.white};
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export default EmptyText;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { colors } from '@buffetjs/styles';
|
|
4
|
+
|
|
5
|
+
const ErrorMessage = styled.p`
|
|
6
|
+
font-size: 1.3rem !important;
|
|
7
|
+
padding-top: 5px;
|
|
8
|
+
margin: 0;
|
|
9
|
+
color: ${colors.darkOrange};
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export default ErrorMessage;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
const IconUpload = ({ title, ...props }) => {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
width="105"
|
|
8
|
+
height="84"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<title>{title}</title>
|
|
14
|
+
<defs>
|
|
15
|
+
<rect id="a" y="1.354" width="77.333" height="62.292" rx="4" />
|
|
16
|
+
<rect id="b" y="1.354" width="77.333" height="62.292" rx="4" />
|
|
17
|
+
</defs>
|
|
18
|
+
<g fill="none" fillRule="evenodd" opacity=".05">
|
|
19
|
+
<g transform="rotate(-12 75.8 12.214)">
|
|
20
|
+
<use fill="#FAFAFB" xlinkHref="#a" />
|
|
21
|
+
<rect stroke="#979797" x=".5" y="1.854" width="76.333" height="61.292" rx="4" />
|
|
22
|
+
</g>
|
|
23
|
+
<path
|
|
24
|
+
d="M74.255 36.05l3.942 18.544-57.385 12.198-1.689-7.948L29.35 42.827l7.928 5.236 16.363-25.628L74.255 36.05zM71.974 6.078l-65.21 13.86a1.272 1.272 0 0 0-.833.589 1.311 1.311 0 0 0-.19 1.014l10.7 50.334c.076.358.27.641.584.849.314.207.648.273 1.001.198l65.21-13.86c.353-.076.63-.272.833-.589.203-.317.266-.655.19-1.014l-10.7-50.334a1.311 1.311 0 0 0-.584-.849 1.272 1.272 0 0 0-1.001-.198zm6.803-.061L89.475 56.35c.387 1.822.08 3.517-.921 5.085-1.001 1.568-2.399 2.543-4.192 2.924L19.152 78.22c-1.793.381-3.466.06-5.019-.966-1.552-1.026-2.522-2.45-2.91-4.27L.525 22.65c-.387-1.822-.08-3.517.921-5.085 1.001-1.568 2.399-2.543 4.192-2.924L70.848.78c1.793-.381 3.466-.06 5.019.966 1.552 1.026 2.522 2.45 2.91 4.27z"
|
|
25
|
+
fill="#333740"
|
|
26
|
+
fillRule="nonzero"
|
|
27
|
+
/>
|
|
28
|
+
<g>
|
|
29
|
+
<g transform="rotate(15 7.723 110.16)">
|
|
30
|
+
<use fill="#FAFAFB" xlinkHref="#b" />
|
|
31
|
+
<rect stroke="#979797" x=".5" y="1.854" width="76.333" height="61.292" rx="4" />
|
|
32
|
+
</g>
|
|
33
|
+
<path
|
|
34
|
+
d="M49.626 26.969c-.584 2.18-1.832 3.832-3.744 4.955-1.911 1.123-3.94 1.398-6.086.822-2.147-.575-3.767-1.827-4.86-3.755-1.094-1.929-1.35-3.983-.765-6.163.584-2.18 1.832-3.832 3.743-4.955 1.912-1.124 3.94-1.398 6.087-.823s3.767 1.827 4.86 3.756c1.094 1.928 1.349 3.983.765 6.163zm37.007 26.74L81.726 72.02 25.058 56.836l2.103-7.848 16.384-9.63 4.687 8.266 26.214-15.406 12.187 21.49zm11.574-27.742L33.812 8.712a1.272 1.272 0 0 0-1.01.146c-.324.19-.533.463-.628.817L18.855 59.38c-.095.354-.05.695.136 1.022.186.327.453.538.802.631l64.395 17.255c.349.093.685.045 1.01-.146.324-.19.533-.463.628-.817L99.145 27.62c.095-.354.05-.695-.136-1.022a1.272 1.272 0 0 0-.802-.631zm6.09 3.033l-13.32 49.705c-.481 1.799-1.524 3.17-3.128 4.112-1.605.943-3.292 1.177-5.063.703L18.39 66.265c-1.771-.474-3.115-1.52-4.033-3.14-.918-1.618-1.136-3.327-.654-5.125L27.022 8.295c.482-1.799 1.525-3.17 3.13-4.112 1.604-.943 3.291-1.177 5.062-.703L99.61 20.735c1.771.474 3.115 1.52 4.033 3.14.918 1.618 1.136 3.327.654 5.125z"
|
|
35
|
+
fill="#333740"
|
|
36
|
+
fillRule="nonzero"
|
|
37
|
+
/>
|
|
38
|
+
</g>
|
|
39
|
+
</g>
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
IconUpload.propTypes = {
|
|
45
|
+
title: PropTypes.string.isRequired,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default IconUpload;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { get } from 'lodash';
|
|
4
|
+
import { prefixFileUrlWithBackendUrl } from 'strapi-helper-plugin';
|
|
5
|
+
import { Flex } from '@buffetjs/core';
|
|
6
|
+
|
|
7
|
+
import CardPreview from '../CardPreview';
|
|
8
|
+
import Chevron from './Chevron';
|
|
9
|
+
|
|
10
|
+
const InputFilePreview = ({ file, onClick, isSlider }) => {
|
|
11
|
+
const fileUrl = prefixFileUrlWithBackendUrl(get(file, ['formats', 'small', 'url'], file.url));
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Flex
|
|
15
|
+
key={file.id}
|
|
16
|
+
style={{ height: '100%' }}
|
|
17
|
+
alignItems="center"
|
|
18
|
+
justifyContent="space-between"
|
|
19
|
+
>
|
|
20
|
+
{isSlider && <Chevron side="left" onClick={() => onClick(false)} />}
|
|
21
|
+
<CardPreview hasIcon url={fileUrl} type={file.mime} />
|
|
22
|
+
{isSlider && <Chevron side="right" onClick={() => onClick(true)} />}
|
|
23
|
+
</Flex>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
InputFilePreview.propTypes = {
|
|
28
|
+
file: PropTypes.object,
|
|
29
|
+
isSlider: PropTypes.bool,
|
|
30
|
+
onClick: PropTypes.func.isRequired,
|
|
31
|
+
};
|
|
32
|
+
InputFilePreview.defaultProps = {
|
|
33
|
+
isSlider: false,
|
|
34
|
+
file: null,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default InputFilePreview;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
4
|
+
import { get, isEmpty } from 'lodash';
|
|
5
|
+
import {
|
|
6
|
+
CheckPermissions,
|
|
7
|
+
LabelIconWrapper,
|
|
8
|
+
prefixFileUrlWithBackendUrl,
|
|
9
|
+
} from 'strapi-helper-plugin';
|
|
10
|
+
import pluginPermissions from '../../permissions';
|
|
11
|
+
import { getTrad, formatFileForEditing } from '../../utils';
|
|
12
|
+
import CardControl from '../CardControl';
|
|
13
|
+
import CardControlWrapper from './CardControlWrapper';
|
|
14
|
+
import CardPreviewWrapper from './CardPreviewWrapper';
|
|
15
|
+
import EmptyInputMedia from './EmptyInputMedia';
|
|
16
|
+
import EmptyText from './EmptyText';
|
|
17
|
+
import InputFilePreview from './InputFilePreview';
|
|
18
|
+
import InputModalStepper from '../../containers/InputModalStepper';
|
|
19
|
+
import Name from './Name';
|
|
20
|
+
import Wrapper from './Wrapper';
|
|
21
|
+
import Input from '../Input';
|
|
22
|
+
import ErrorMessage from './ErrorMessage';
|
|
23
|
+
|
|
24
|
+
const InputMedia = ({
|
|
25
|
+
disabled,
|
|
26
|
+
label,
|
|
27
|
+
onChange,
|
|
28
|
+
name,
|
|
29
|
+
attribute,
|
|
30
|
+
value,
|
|
31
|
+
type,
|
|
32
|
+
id,
|
|
33
|
+
error,
|
|
34
|
+
labelIcon,
|
|
35
|
+
}) => {
|
|
36
|
+
const [modal, setModal] = useState({
|
|
37
|
+
isOpen: false,
|
|
38
|
+
step: 'list',
|
|
39
|
+
fileToEdit: null,
|
|
40
|
+
isDisplayed: false,
|
|
41
|
+
});
|
|
42
|
+
const [fileToDisplay, setFileToDisplay] = useState(0);
|
|
43
|
+
const hasNoValue = !!value && Array.isArray(value) && value.length === 0;
|
|
44
|
+
const currentFile = attribute.multiple ? value[fileToDisplay] : value;
|
|
45
|
+
const fileURL = get(currentFile, ['url'], null);
|
|
46
|
+
const prefixedFileURL = fileURL ? prefixFileUrlWithBackendUrl(fileURL) : null;
|
|
47
|
+
const displaySlidePagination =
|
|
48
|
+
attribute.multiple && value.length > 1 ? ` (${fileToDisplay + 1}/${value.length})` : '';
|
|
49
|
+
const inputId = id || name;
|
|
50
|
+
const errorId = `error-${inputId}`;
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
setFileToDisplay(0);
|
|
54
|
+
}, [modal.isOpen]);
|
|
55
|
+
|
|
56
|
+
const handleClickToggleModal = () => {
|
|
57
|
+
if (!disabled) {
|
|
58
|
+
setModal(prev => ({
|
|
59
|
+
isDisplayed: true,
|
|
60
|
+
step: 'list',
|
|
61
|
+
isOpen: !prev.isOpen,
|
|
62
|
+
fileToEdit: null,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleClosed = () => setModal(prev => ({ ...prev, isDisplayed: false }));
|
|
68
|
+
|
|
69
|
+
const handleChange = v => {
|
|
70
|
+
onChange({ target: { name, type, value: v } });
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handleFilesNavigation = displayNext => {
|
|
74
|
+
if (attribute.multiple) {
|
|
75
|
+
if (displayNext && fileToDisplay === value.length - 1) {
|
|
76
|
+
setFileToDisplay(0);
|
|
77
|
+
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!displayNext && fileToDisplay === 0) {
|
|
82
|
+
setFileToDisplay(value.length - 1);
|
|
83
|
+
} else {
|
|
84
|
+
setFileToDisplay(prev => (displayNext ? prev + 1 : prev - 1));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleRemoveFile = () => {
|
|
90
|
+
const newValue = attribute.multiple
|
|
91
|
+
? value.filter((file, index) => index !== fileToDisplay)
|
|
92
|
+
: null;
|
|
93
|
+
|
|
94
|
+
if (Array.isArray(newValue) && fileToDisplay === newValue.length) {
|
|
95
|
+
setFileToDisplay(fileToDisplay > 0 ? fileToDisplay - 1 : fileToDisplay);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
handleChange(newValue);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const handleEditFile = () => {
|
|
102
|
+
setModal(() => ({
|
|
103
|
+
isDisplayed: true,
|
|
104
|
+
isOpen: true,
|
|
105
|
+
step: 'edit',
|
|
106
|
+
fileToEdit: formatFileForEditing(currentFile),
|
|
107
|
+
}));
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const handleCopy = () => {
|
|
111
|
+
strapi.notification.toggle({
|
|
112
|
+
type: 'info',
|
|
113
|
+
message: { id: 'notification.link-copied' },
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const handleAllowDrop = e => e.preventDefault();
|
|
118
|
+
|
|
119
|
+
const handleDrop = e => {
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
e.persist();
|
|
122
|
+
|
|
123
|
+
if (e.dataTransfer) {
|
|
124
|
+
setModal(() => ({
|
|
125
|
+
isDisplayed: true,
|
|
126
|
+
isOpen: true,
|
|
127
|
+
step: 'upload',
|
|
128
|
+
filesToUpload: e.dataTransfer.files,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<Wrapper hasError={!isEmpty(error)}>
|
|
135
|
+
<Name htmlFor={name}>
|
|
136
|
+
<span>{`${label}${displaySlidePagination}`}</span>
|
|
137
|
+
{labelIcon && <LabelIconWrapper title={labelIcon.title}>{labelIcon.icon}</LabelIconWrapper>}
|
|
138
|
+
</Name>
|
|
139
|
+
|
|
140
|
+
<CardPreviewWrapper onDragOver={handleAllowDrop} onDrop={handleDrop}>
|
|
141
|
+
<CardControlWrapper>
|
|
142
|
+
{!disabled && (
|
|
143
|
+
<CardControl
|
|
144
|
+
small
|
|
145
|
+
title="add"
|
|
146
|
+
color="#9EA7B8"
|
|
147
|
+
type="plus"
|
|
148
|
+
onClick={handleClickToggleModal}
|
|
149
|
+
/>
|
|
150
|
+
)}
|
|
151
|
+
{!hasNoValue && !disabled && (
|
|
152
|
+
<>
|
|
153
|
+
<CheckPermissions permissions={pluginPermissions.update}>
|
|
154
|
+
<CardControl
|
|
155
|
+
small
|
|
156
|
+
title="edit"
|
|
157
|
+
color="#9EA7B8"
|
|
158
|
+
type="pencil"
|
|
159
|
+
onClick={handleEditFile}
|
|
160
|
+
/>
|
|
161
|
+
</CheckPermissions>
|
|
162
|
+
<CheckPermissions permissions={pluginPermissions.copyLink}>
|
|
163
|
+
<CopyToClipboard onCopy={handleCopy} text={prefixedFileURL}>
|
|
164
|
+
<CardControl small title="copy-link" color="#9EA7B8" type="link" />
|
|
165
|
+
</CopyToClipboard>
|
|
166
|
+
</CheckPermissions>
|
|
167
|
+
<CardControl
|
|
168
|
+
small
|
|
169
|
+
title="delete"
|
|
170
|
+
color="#9EA7B8"
|
|
171
|
+
type="trash-alt"
|
|
172
|
+
onClick={handleRemoveFile}
|
|
173
|
+
/>
|
|
174
|
+
</>
|
|
175
|
+
)}
|
|
176
|
+
</CardControlWrapper>
|
|
177
|
+
{hasNoValue ? (
|
|
178
|
+
<EmptyInputMedia onClick={handleClickToggleModal} disabled={disabled}>
|
|
179
|
+
<EmptyText id={getTrad('input.placeholder')} />
|
|
180
|
+
</EmptyInputMedia>
|
|
181
|
+
) : (
|
|
182
|
+
<InputFilePreview
|
|
183
|
+
isSlider={attribute.multiple && value.length > 1}
|
|
184
|
+
file={currentFile}
|
|
185
|
+
onClick={handleFilesNavigation}
|
|
186
|
+
/>
|
|
187
|
+
)}
|
|
188
|
+
<Input type="file" name={name} />
|
|
189
|
+
</CardPreviewWrapper>
|
|
190
|
+
{modal.isDisplayed && (
|
|
191
|
+
<InputModalStepper
|
|
192
|
+
isOpen={modal.isOpen}
|
|
193
|
+
onClosed={handleClosed}
|
|
194
|
+
step={modal.step}
|
|
195
|
+
fileToEdit={modal.fileToEdit}
|
|
196
|
+
filesToUpload={modal.filesToUpload}
|
|
197
|
+
multiple={attribute.multiple}
|
|
198
|
+
onInputMediaChange={handleChange}
|
|
199
|
+
selectedFiles={value}
|
|
200
|
+
onToggle={handleClickToggleModal}
|
|
201
|
+
allowedTypes={attribute.allowedTypes}
|
|
202
|
+
/>
|
|
203
|
+
)}
|
|
204
|
+
{error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}
|
|
205
|
+
</Wrapper>
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
InputMedia.propTypes = {
|
|
210
|
+
attribute: PropTypes.shape({
|
|
211
|
+
allowedTypes: PropTypes.arrayOf(PropTypes.string),
|
|
212
|
+
multiple: PropTypes.bool,
|
|
213
|
+
required: PropTypes.bool,
|
|
214
|
+
type: PropTypes.string,
|
|
215
|
+
}).isRequired,
|
|
216
|
+
disabled: PropTypes.bool,
|
|
217
|
+
error: PropTypes.string,
|
|
218
|
+
id: PropTypes.string,
|
|
219
|
+
label: PropTypes.string,
|
|
220
|
+
labelIcon: PropTypes.shape({
|
|
221
|
+
icon: PropTypes.node.isRequired,
|
|
222
|
+
title: PropTypes.string,
|
|
223
|
+
}),
|
|
224
|
+
name: PropTypes.string.isRequired,
|
|
225
|
+
onChange: PropTypes.func.isRequired,
|
|
226
|
+
type: PropTypes.string.isRequired,
|
|
227
|
+
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
228
|
+
};
|
|
229
|
+
InputMedia.defaultProps = {
|
|
230
|
+
disabled: false,
|
|
231
|
+
id: null,
|
|
232
|
+
error: null,
|
|
233
|
+
label: '',
|
|
234
|
+
labelIcon: null,
|
|
235
|
+
value: null,
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export default InputMedia;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import ContainerFluid from '../ContainerFluid';
|
|
3
|
+
|
|
4
|
+
const Wrapper = styled(ContainerFluid)`
|
|
5
|
+
margin-bottom: 0.3rem;
|
|
6
|
+
padding-top: 2.3rem;
|
|
7
|
+
|
|
8
|
+
textarea {
|
|
9
|
+
height: 10.1rem;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export default Wrapper;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Inputs } from '@buffetjs/custom';
|
|
3
|
+
import { useGlobalContext } from 'strapi-helper-plugin';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Wrapper from './Wrapper';
|
|
6
|
+
import { getTrad } from '../../utils';
|
|
7
|
+
|
|
8
|
+
const InputUploadURL = ({ errors, onChange, value }) => {
|
|
9
|
+
const { formatMessage } = useGlobalContext();
|
|
10
|
+
const label = formatMessage({ id: getTrad('input.url.label') });
|
|
11
|
+
const description = formatMessage({ id: getTrad('input.url.description') });
|
|
12
|
+
const error = errors ? formatMessage({ id: errors.id }, { number: errors.number }) : null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Wrapper>
|
|
16
|
+
<div className="row">
|
|
17
|
+
<div className="col-12">
|
|
18
|
+
<Inputs
|
|
19
|
+
autoFocus
|
|
20
|
+
error={error}
|
|
21
|
+
type="textarea"
|
|
22
|
+
name="url"
|
|
23
|
+
onChange={onChange}
|
|
24
|
+
label={label}
|
|
25
|
+
description={description}
|
|
26
|
+
value={value.join('\n')}
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</Wrapper>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
InputUploadURL.defaultProps = {
|
|
35
|
+
errors: null,
|
|
36
|
+
onChange: () => {},
|
|
37
|
+
value: [],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
InputUploadURL.propTypes = {
|
|
41
|
+
errors: PropTypes.object,
|
|
42
|
+
onChange: PropTypes.func,
|
|
43
|
+
value: PropTypes.arrayOf(PropTypes.string),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default InputUploadURL;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { Text } from '@buffetjs/core';
|
|
6
|
+
|
|
7
|
+
const IntlText = ({ id, defaultMessage, values, ...textProps }) => (
|
|
8
|
+
<FormattedMessage id={id} defaultMessage={defaultMessage} values={values}>
|
|
9
|
+
{msg => <Text {...textProps}>{msg}</Text>}
|
|
10
|
+
</FormattedMessage>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
IntlText.defaultProps = {
|
|
14
|
+
id: 'app.utils.defaultMessage',
|
|
15
|
+
defaultMessage: '',
|
|
16
|
+
values: {},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
IntlText.propTypes = {
|
|
20
|
+
id: PropTypes.string,
|
|
21
|
+
defaultMessage: PropTypes.string,
|
|
22
|
+
values: PropTypes.object,
|
|
23
|
+
// TODO - textProps type to specify
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default IntlText;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const ListCell = styled.div`
|
|
4
|
+
width: 100%;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
padding-left: 15px;
|
|
7
|
+
padding-right: 15px;
|
|
8
|
+
@media only screen and (min-width: 768px) {
|
|
9
|
+
width: 50%;
|
|
10
|
+
}
|
|
11
|
+
@media only screen and (min-width: 1024px) {
|
|
12
|
+
width: 25%;
|
|
13
|
+
}
|
|
14
|
+
@media only screen and (min-width: 1280px) {
|
|
15
|
+
max-width: 248px;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export default ListCell;
|