@blaze-cms/plugin-media-ui 0.146.0-alpha.13 → 0.146.0-alpha.17
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/CHANGELOG.md +22 -0
- package/lib/components/CardMedia/CardMedia.js +2 -2
- package/lib/components/CardMedia/CardMedia.js.map +1 -1
- package/lib/components/CardMedia/index.js.map +1 -1
- package/lib/components/EditMediaFile/EditMediaFile.js +7 -7
- package/lib/components/EditMediaFile/EditMediaFile.js.map +1 -1
- package/lib/components/EditMediaFile/EditMediaFilePage.js +3 -3
- package/lib/components/EditMediaFile/EditMediaFilePage.js.map +1 -1
- package/lib/components/EditMediaFile/index.js.map +1 -1
- package/lib/components/EditorAdapter/EditorAdapter.js.map +1 -1
- package/lib/components/EditorAdapter/index.js.map +1 -1
- package/lib/components/FileList/FilesListContext/index.js.map +1 -1
- package/lib/components/FileList/FilesListProvider/index.js.map +1 -1
- package/lib/components/FileList/useFileList/index.js.map +1 -1
- package/lib/components/FileList/useGetFiles/getFiles.js +2 -2
- package/lib/components/FileList/useGetFiles/getFiles.js.map +1 -1
- package/lib/components/FileList/useGetFiles/index.js.map +1 -1
- package/lib/components/FileList/useGetFiles/useGetFiles.js +5 -5
- package/lib/components/FileList/useGetFiles/useGetFiles.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/getCounters.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/index.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/useGetFilesList.js +5 -5
- package/lib/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -1
- package/lib/components/FilePreview/Actions/index.js +4 -4
- package/lib/components/FilePreview/Actions/index.js.map +1 -1
- package/lib/components/FilePreview/Image/Image.js.map +1 -1
- package/lib/components/FilePreview/Image/RawImage.js.map +1 -1
- package/lib/components/FilePreview/Image/imageSchema.js.map +1 -1
- package/lib/components/FilePreview/Image/index.js +1 -3
- package/lib/components/FilePreview/Image/index.js.map +1 -1
- package/lib/components/FilePreview/PDF/PDF.js.map +1 -1
- package/lib/components/FilePreview/PDF/RawPDF.js.map +1 -1
- package/lib/components/FilePreview/PDF/index.js.map +1 -1
- package/lib/components/FilePreview/PDF/schema.js.map +1 -1
- package/lib/components/FilePreview/get-preview.js.map +1 -1
- package/lib/components/FilePreview/index.js +4 -4
- package/lib/components/FilePreview/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/PreviewDefault.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/RawPreviewDefault.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/icons/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FileList.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FilePreviewList.js +1 -1
- package/lib/components/FilePreviewReadOnly/FilePreviewList.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js +11 -15
- package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/index.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/mappers/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileList.js +2 -2
- package/lib/components/FileUploadAdapter/FileList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FilePreviewList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileReorderList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileReorderListItem.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileUploadAdapter.js +32 -23
- package/lib/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -1
- package/lib/components/FileUploadAdapter/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/format-initial-value.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-button-text.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-format.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/is-unselecting.js +1 -1
- package/lib/components/FileUploadAdapter/mappers/is-unselecting.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/transform-to-array.js.map +1 -1
- package/lib/components/FileUploadAdapter/useLimit.js.map +1 -1
- package/lib/components/FileUploadModal/FileUploadModal.js +21 -13
- package/lib/components/FileUploadModal/FileUploadModal.js.map +1 -1
- package/lib/components/FileUploadModal/index.js.map +1 -1
- package/lib/components/FilterPanel/FilterPanel.js +5 -5
- package/lib/components/FilterPanel/FilterPanel.js.map +1 -1
- package/lib/components/FilterPanel/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/Listing.js +6 -1
- package/lib/components/ListingContainer/Listing/Listing.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +8 -8
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js +2 -2
- package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/index.js.map +1 -1
- package/lib/components/ListingContainer/ListingContainer.js +24 -13
- package/lib/components/ListingContainer/ListingContainer.js.map +1 -1
- package/lib/components/ListingContainer/index.js.map +1 -1
- package/lib/components/ListingContainer/mappers/exist-previous.js.map +1 -1
- package/lib/components/ListingContainer/mappers/index.js.map +1 -1
- package/lib/components/MediaListing.js +49 -0
- package/lib/components/MediaListing.js.map +1 -0
- package/lib/constants.js.map +1 -1
- package/lib/icons/MediaLibraryIcon.js.map +1 -1
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/utils/available-filters/available-filters.js.map +1 -1
- package/lib/utils/media-context/index.js.map +1 -1
- package/lib/utils/media-context/media-context.js +1 -1
- package/lib/utils/media-context/media-context.js.map +1 -1
- package/lib/utils/media-context/useMediaContext.js.map +1 -1
- package/lib-es/components/CardMedia/CardMedia.js.map +1 -1
- package/lib-es/components/CardMedia/index.js.map +1 -1
- package/lib-es/components/EditMediaFile/EditMediaFile.js.map +1 -1
- package/lib-es/components/EditMediaFile/EditMediaFilePage.js.map +1 -1
- package/lib-es/components/EditMediaFile/index.js.map +1 -1
- package/lib-es/components/EditorAdapter/EditorAdapter.js.map +1 -1
- package/lib-es/components/EditorAdapter/index.js.map +1 -1
- package/lib-es/components/FileList/FilesListContext/index.js.map +1 -1
- package/lib-es/components/FileList/FilesListProvider/index.js.map +1 -1
- package/lib-es/components/FileList/useFileList/index.js.map +1 -1
- package/lib-es/components/FileList/useGetFiles/getFiles.js.map +1 -1
- package/lib-es/components/FileList/useGetFiles/index.js.map +1 -1
- package/lib-es/components/FileList/useGetFiles/useGetFiles.js.map +1 -1
- package/lib-es/components/FileList/useGetFilesList/getCounters.js.map +1 -1
- package/lib-es/components/FileList/useGetFilesList/index.js.map +1 -1
- package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -1
- package/lib-es/components/FilePreview/Actions/index.js +2 -2
- package/lib-es/components/FilePreview/Actions/index.js.map +1 -1
- package/lib-es/components/FilePreview/Image/Image.js.map +1 -1
- package/lib-es/components/FilePreview/Image/RawImage.js.map +1 -1
- package/lib-es/components/FilePreview/Image/imageSchema.js.map +1 -1
- package/lib-es/components/FilePreview/Image/index.js +1 -3
- package/lib-es/components/FilePreview/Image/index.js.map +1 -1
- package/lib-es/components/FilePreview/PDF/PDF.js.map +1 -1
- package/lib-es/components/FilePreview/PDF/RawPDF.js.map +1 -1
- package/lib-es/components/FilePreview/PDF/index.js.map +1 -1
- package/lib-es/components/FilePreview/PDF/schema.js.map +1 -1
- package/lib-es/components/FilePreview/get-preview.js.map +1 -1
- package/lib-es/components/FilePreview/index.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/icons/index.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/index.js.map +1 -1
- package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/FileList.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js +1 -1
- package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js +2 -4
- package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/index.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +1 -1
- package/lib-es/components/FilePreviewReadOnly/mappers/index.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/FileList.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/FilePreviewList.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/FileReorderList.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/FileReorderListItem.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js +13 -8
- package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/index.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/format-initial-value.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-format.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/index.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/is-unselecting.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/mappers/transform-to-array.js.map +1 -1
- package/lib-es/components/FileUploadAdapter/useLimit.js.map +1 -1
- package/lib-es/components/FileUploadModal/FileUploadModal.js +14 -4
- package/lib-es/components/FileUploadModal/FileUploadModal.js.map +1 -1
- package/lib-es/components/FileUploadModal/index.js.map +1 -1
- package/lib-es/components/FilterPanel/FilterPanel.js.map +1 -1
- package/lib-es/components/FilterPanel/index.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/Listing.js +6 -1
- package/lib-es/components/ListingContainer/Listing/Listing.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/index.js.map +1 -1
- package/lib-es/components/ListingContainer/Listing/index.js.map +1 -1
- package/lib-es/components/ListingContainer/ListingContainer.js +17 -5
- package/lib-es/components/ListingContainer/ListingContainer.js.map +1 -1
- package/lib-es/components/ListingContainer/index.js.map +1 -1
- package/lib-es/components/ListingContainer/mappers/exist-previous.js.map +1 -1
- package/lib-es/components/ListingContainer/mappers/index.js.map +1 -1
- package/lib-es/components/MediaListing.js +29 -0
- package/lib-es/components/MediaListing.js.map +1 -0
- package/lib-es/constants.js.map +1 -1
- package/lib-es/icons/MediaLibraryIcon.js.map +1 -1
- package/lib-es/icons/index.js.map +1 -1
- package/lib-es/index.js +2 -2
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/available-filters/available-filters.js.map +1 -1
- package/lib-es/utils/media-context/index.js.map +1 -1
- package/lib-es/utils/media-context/media-context.js +1 -1
- package/lib-es/utils/media-context/media-context.js.map +1 -1
- package/lib-es/utils/media-context/useMediaContext.js.map +1 -1
- package/package.json +6 -6
- package/src/components/FilePreview/Actions/index.js +18 -14
- package/src/components/FilePreview/Image/index.js +1 -3
- package/src/components/FilePreviewReadOnly/FilePreviewList.js +3 -1
- package/src/components/FilePreviewReadOnly/FilePreviewReadOnly.js +2 -7
- package/src/components/FileUploadAdapter/FileUploadAdapter.js +18 -10
- package/src/components/FileUploadModal/FileUploadModal.js +12 -4
- package/src/components/ListingContainer/Listing/Listing.js +6 -1
- package/src/components/ListingContainer/ListingContainer.js +14 -2
- package/src/components/MediaListing.js +31 -0
- package/src/index.js +3 -3
- package/src/utils/media-context/media-context.js +1 -1
- package/lib/components/FilePreview/Image/ReadOnly.js +0 -47
- package/lib/components/FilePreview/Image/ReadOnly.js.map +0 -1
- package/lib-es/components/FilePreview/Image/ReadOnly.js +0 -37
- package/lib-es/components/FilePreview/Image/ReadOnly.js.map +0 -1
- package/src/components/FilePreview/Image/ReadOnly.js +0 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["MediaListing"],"sources":["../../../../../src/components/ListingContainer/Listing/MediaListing/index.js"],"sourcesContent":["import MediaListing from './MediaListing';\n\nexport default MediaListing;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["MediaListing"],"sources":["../../../../../src/components/ListingContainer/Listing/MediaListing/index.js"],"sourcesContent":["import MediaListing from './MediaListing';\n\nexport default MediaListing;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Listing"],"sources":["../../../../src/components/ListingContainer/Listing/index.js"],"sourcesContent":["import Listing from './Listing';\n\nexport default Listing;\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,WAAW;AAE/B,eAAeA,OAAO"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Listing"],"sources":["../../../../src/components/ListingContainer/Listing/index.js"],"sourcesContent":["import Listing from './Listing';\n\nexport default Listing;\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,WAAW;AAE/B,eAAeA,OAAO","ignoreList":[]}
|
|
@@ -17,6 +17,7 @@ const ListingContainer = ({
|
|
|
17
17
|
filesSelected,
|
|
18
18
|
displayFileUploadModal,
|
|
19
19
|
setDisplayFileUploadModal,
|
|
20
|
+
closeModalAndSetValue,
|
|
20
21
|
simpleLayout
|
|
21
22
|
}) => {
|
|
22
23
|
const [selectedFiles, setSelectedFiles] = useState(filesSelected || []);
|
|
@@ -38,9 +39,15 @@ const ListingContainer = ({
|
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
41
|
if (loading) return null;
|
|
41
|
-
const getSelectedFiles = ({
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const getSelectedFiles = (file, files) => {
|
|
43
|
+
if (simpleLayout) {
|
|
44
|
+
handleSelectedFiles(files, false);
|
|
45
|
+
setSelectedFiles(files);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const {
|
|
49
|
+
id
|
|
50
|
+
} = file;
|
|
44
51
|
const existPreviousFile = existPrevious(selectedFiles, id);
|
|
45
52
|
if (maxItems === selectedFiles.length && !existPreviousFile) {
|
|
46
53
|
handleSelectedFiles([id], false);
|
|
@@ -69,11 +76,14 @@ const ListingContainer = ({
|
|
|
69
76
|
onClickPrompt: () => handleDisplayFileUploadModal(true)
|
|
70
77
|
}
|
|
71
78
|
}, /*#__PURE__*/React.createElement(FilesListProvider, null, /*#__PURE__*/React.createElement(Listing, {
|
|
79
|
+
closeModalAndSetValue: closeModalAndSetValue,
|
|
72
80
|
simpleLayout: simpleLayout,
|
|
73
81
|
getSelectedFiles: getSelectedFiles,
|
|
74
82
|
setDisplayFileUploadModal: setDisplayFileUploadModal,
|
|
75
83
|
displayFileUploadModal: displayFileUploadModal,
|
|
76
|
-
handleDisplayFileUploadModal: handleDisplayFileUploadModal
|
|
84
|
+
handleDisplayFileUploadModal: handleDisplayFileUploadModal,
|
|
85
|
+
setSelectedFiles: setSelectedFiles,
|
|
86
|
+
handleSelectedFiles: handleSelectedFiles
|
|
77
87
|
}))));
|
|
78
88
|
};
|
|
79
89
|
ListingContainer.propTypes = {
|
|
@@ -82,9 +92,11 @@ ListingContainer.propTypes = {
|
|
|
82
92
|
filesSelected: PropTypes.arrayOf(PropTypes.string),
|
|
83
93
|
simpleLayout: PropTypes.bool,
|
|
84
94
|
setDisplayFileUploadModal: PropTypes.func.isRequired,
|
|
85
|
-
displayFileUploadModal: PropTypes.bool.isRequired
|
|
95
|
+
displayFileUploadModal: PropTypes.bool.isRequired,
|
|
96
|
+
closeModalAndSetValue: PropTypes.func
|
|
86
97
|
};
|
|
87
98
|
ListingContainer.defaultProps = {
|
|
99
|
+
closeModalAndSetValue: () => {},
|
|
88
100
|
handleSelectedFiles: () => {},
|
|
89
101
|
maxItems: false,
|
|
90
102
|
filesSelected: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListingContainer.js","names":["React","useState","PropTypes","useQuery","getQuery","ToastProvider","Listing","availableFilters","MediaContextProvider","FilesListProvider","existPrevious","ListingContainer","handleSelectedFiles","maxItems","filesSelected","displayFileUploadModal","setDisplayFileUploadModal","simpleLayout","selectedFiles","setSelectedFiles","selectedFilter","setSelectedFilter","filter","isSearch","searchTerm","storeKey","fileStoresType","loading","data","getFileStores","fileStores","variables","visibleInAdmin","getSelectedFiles","id","existPreviousFile","length","allSelectedFiles","fileId","handleDisplayFileUploadModal","param","defaultFileStore","find","isDefault","key","createElement","value","changeSelectedFilter","_objectSpread","filters","onClickPrompt","propTypes","func","oneOfType","number","bool","arrayOf","string","isRequired","defaultProps"],"sources":["../../../src/components/ListingContainer/ListingContainer.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { ToastProvider } from '@blaze-react/toaster';\nimport Listing from './Listing';\nimport { availableFilters } from '../../utils/available-filters/available-filters';\nimport { MediaContextProvider } from '../../utils/media-context';\nimport FilesListProvider from '../FileList/FilesListProvider';\nimport { existPrevious } from './mappers';\n\nconst ListingContainer = ({\n handleSelectedFiles,\n maxItems,\n filesSelected,\n displayFileUploadModal,\n setDisplayFileUploadModal,\n simpleLayout\n}) => {\n const [selectedFiles, setSelectedFiles] = useState(filesSelected || []);\n const [selectedFilter, setSelectedFilter] = useState({\n filter: 'all',\n isSearch: false,\n searchTerm: null,\n storeKey: null\n });\n\n const fileStoresType = getQuery('GET_FILE_STORES');\n const { loading, data: { getFileStores: fileStores = [] } = {} } = useQuery(fileStoresType, {\n variables: { visibleInAdmin: true }\n });\n if (loading) return null;\n\n const getSelectedFiles = (
|
|
1
|
+
{"version":3,"file":"ListingContainer.js","names":["React","useState","PropTypes","useQuery","getQuery","ToastProvider","Listing","availableFilters","MediaContextProvider","FilesListProvider","existPrevious","ListingContainer","handleSelectedFiles","maxItems","filesSelected","displayFileUploadModal","setDisplayFileUploadModal","closeModalAndSetValue","simpleLayout","selectedFiles","setSelectedFiles","selectedFilter","setSelectedFilter","filter","isSearch","searchTerm","storeKey","fileStoresType","loading","data","getFileStores","fileStores","variables","visibleInAdmin","getSelectedFiles","file","files","id","existPreviousFile","length","allSelectedFiles","fileId","handleDisplayFileUploadModal","param","defaultFileStore","find","isDefault","key","createElement","value","changeSelectedFilter","_objectSpread","filters","onClickPrompt","propTypes","func","oneOfType","number","bool","arrayOf","string","isRequired","defaultProps"],"sources":["../../../src/components/ListingContainer/ListingContainer.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { ToastProvider } from '@blaze-react/toaster';\nimport Listing from './Listing';\nimport { availableFilters } from '../../utils/available-filters/available-filters';\nimport { MediaContextProvider } from '../../utils/media-context';\nimport FilesListProvider from '../FileList/FilesListProvider';\nimport { existPrevious } from './mappers';\n\nconst ListingContainer = ({\n handleSelectedFiles,\n maxItems,\n filesSelected,\n displayFileUploadModal,\n setDisplayFileUploadModal,\n closeModalAndSetValue,\n simpleLayout\n}) => {\n const [selectedFiles, setSelectedFiles] = useState(filesSelected || []);\n const [selectedFilter, setSelectedFilter] = useState({\n filter: 'all',\n isSearch: false,\n searchTerm: null,\n storeKey: null\n });\n\n const fileStoresType = getQuery('GET_FILE_STORES');\n const { loading, data: { getFileStores: fileStores = [] } = {} } = useQuery(fileStoresType, {\n variables: { visibleInAdmin: true }\n });\n if (loading) return null;\n\n const getSelectedFiles = (file, files) => {\n if (simpleLayout) {\n handleSelectedFiles(files, false);\n setSelectedFiles(files);\n return;\n }\n const { id } = file;\n const existPreviousFile = existPrevious(selectedFiles, id);\n if (maxItems === selectedFiles.length && !existPreviousFile) {\n handleSelectedFiles([id], false);\n setSelectedFiles([id]);\n } else {\n const allSelectedFiles = existPreviousFile\n ? selectedFiles.filter(fileId => fileId !== existPreviousFile)\n : [...selectedFiles, id];\n\n handleSelectedFiles(allSelectedFiles, false);\n setSelectedFiles(allSelectedFiles);\n }\n };\n\n const handleDisplayFileUploadModal = param => setDisplayFileUploadModal(param);\n const defaultFileStore = (fileStores.find(({ isDefault }) => isDefault) || {}).key;\n\n return (\n <ToastProvider>\n <MediaContextProvider\n value={{\n fileStores,\n defaultFileStore,\n changeSelectedFilter: value => setSelectedFilter(value),\n selectedFilter: {\n ...selectedFilter,\n storeKey: selectedFilter.storeKey || defaultFileStore\n },\n selectedFiles,\n getSelectedFiles,\n filters: availableFilters,\n onClickPrompt: () => handleDisplayFileUploadModal(true)\n }}>\n <FilesListProvider>\n <Listing\n closeModalAndSetValue={closeModalAndSetValue}\n simpleLayout={simpleLayout}\n getSelectedFiles={getSelectedFiles}\n setDisplayFileUploadModal={setDisplayFileUploadModal}\n displayFileUploadModal={displayFileUploadModal}\n handleDisplayFileUploadModal={handleDisplayFileUploadModal}\n setSelectedFiles={setSelectedFiles}\n handleSelectedFiles={handleSelectedFiles}\n />\n </FilesListProvider>\n </MediaContextProvider>\n </ToastProvider>\n );\n};\n\nListingContainer.propTypes = {\n handleSelectedFiles: PropTypes.func,\n maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),\n filesSelected: PropTypes.arrayOf(PropTypes.string),\n simpleLayout: PropTypes.bool,\n setDisplayFileUploadModal: PropTypes.func.isRequired,\n displayFileUploadModal: PropTypes.bool.isRequired,\n closeModalAndSetValue: PropTypes.func\n};\n\nListingContainer.defaultProps = {\n closeModalAndSetValue: () => {},\n handleSelectedFiles: () => {},\n maxItems: false,\n filesSelected: [],\n simpleLayout: false\n};\n\nexport default ListingContainer;\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ListingContainer"],"sources":["../../../src/components/ListingContainer/index.js"],"sourcesContent":["import ListingContainer from './ListingContainer';\n\nexport default ListingContainer;\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AAEjD,eAAeA,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ListingContainer"],"sources":["../../../src/components/ListingContainer/index.js"],"sourcesContent":["import ListingContainer from './ListingContainer';\n\nexport default ListingContainer;\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AAEjD,eAAeA,gBAAgB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exist-previous.js","names":["existPrevious","selectedFiles","id","find","fileId"],"sources":["../../../../src/components/ListingContainer/mappers/exist-previous.js"],"sourcesContent":["const existPrevious = (selectedFiles, id) => selectedFiles.find(fileId => fileId === id);\n\nexport default existPrevious;\n"],"mappings":"AAAA,MAAMA,aAAa,GAAGA,CAACC,aAAa,EAAEC,EAAE,KAAKD,aAAa,CAACE,IAAI,CAACC,MAAM,IAAIA,MAAM,KAAKF,EAAE,CAAC;AAExF,eAAeF,aAAa"}
|
|
1
|
+
{"version":3,"file":"exist-previous.js","names":["existPrevious","selectedFiles","id","find","fileId"],"sources":["../../../../src/components/ListingContainer/mappers/exist-previous.js"],"sourcesContent":["const existPrevious = (selectedFiles, id) => selectedFiles.find(fileId => fileId === id);\n\nexport default existPrevious;\n"],"mappings":"AAAA,MAAMA,aAAa,GAAGA,CAACC,aAAa,EAAEC,EAAE,KAAKD,aAAa,CAACE,IAAI,CAACC,MAAM,IAAIA,MAAM,KAAKF,EAAE,CAAC;AAExF,eAAeF,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["existPrevious"],"sources":["../../../../src/components/ListingContainer/mappers/index.js"],"sourcesContent":["import existPrevious from './exist-previous';\n\nexport { existPrevious };\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,kBAAkB;AAE5C,SAASA,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["existPrevious"],"sources":["../../../../src/components/ListingContainer/mappers/index.js"],"sourcesContent":["import existPrevious from './exist-previous';\n\nexport { existPrevious };\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,kBAAkB;AAE5C,SAASA,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ListingContainer from './ListingContainer';
|
|
4
|
+
const MediaListing = ({
|
|
5
|
+
handleSelectedFiles,
|
|
6
|
+
maxItems,
|
|
7
|
+
filesSelected
|
|
8
|
+
}) => {
|
|
9
|
+
const [displayFileUploadModal, setDisplayFileUploadModal] = useState(false);
|
|
10
|
+
return /*#__PURE__*/React.createElement(ListingContainer, {
|
|
11
|
+
setDisplayFileUploadModal: setDisplayFileUploadModal,
|
|
12
|
+
displayFileUploadModal: displayFileUploadModal,
|
|
13
|
+
handleSelectedFiles: handleSelectedFiles,
|
|
14
|
+
filesSelected: filesSelected,
|
|
15
|
+
maxItems: maxItems
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
MediaListing.propTypes = {
|
|
19
|
+
handleSelectedFiles: PropTypes.func,
|
|
20
|
+
maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
|
|
21
|
+
filesSelected: PropTypes.arrayOf(PropTypes.string)
|
|
22
|
+
};
|
|
23
|
+
MediaListing.defaultProps = {
|
|
24
|
+
handleSelectedFiles: () => {},
|
|
25
|
+
maxItems: false,
|
|
26
|
+
filesSelected: []
|
|
27
|
+
};
|
|
28
|
+
export default MediaListing;
|
|
29
|
+
//# sourceMappingURL=MediaListing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaListing.js","names":["React","useState","PropTypes","ListingContainer","MediaListing","handleSelectedFiles","maxItems","filesSelected","displayFileUploadModal","setDisplayFileUploadModal","createElement","propTypes","func","oneOfType","number","bool","arrayOf","string","defaultProps"],"sources":["../../src/components/MediaListing.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport ListingContainer from './ListingContainer';\n\nconst MediaListing = ({ handleSelectedFiles, maxItems, filesSelected }) => {\n const [displayFileUploadModal, setDisplayFileUploadModal] = useState(false);\n\n return (\n <ListingContainer\n setDisplayFileUploadModal={setDisplayFileUploadModal}\n displayFileUploadModal={displayFileUploadModal}\n handleSelectedFiles={handleSelectedFiles}\n filesSelected={filesSelected}\n maxItems={maxItems}\n />\n );\n};\n\nMediaListing.propTypes = {\n handleSelectedFiles: PropTypes.func,\n maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),\n filesSelected: PropTypes.arrayOf(PropTypes.string)\n};\n\nMediaListing.defaultProps = {\n handleSelectedFiles: () => {},\n maxItems: false,\n filesSelected: []\n};\n\nexport default MediaListing;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,MAAMC,YAAY,GAAGA,CAAC;EAAEC,mBAAmB;EAAEC,QAAQ;EAAEC;AAAc,CAAC,KAAK;EACzE,MAAM,CAACC,sBAAsB,EAAEC,yBAAyB,CAAC,GAAGR,QAAQ,CAAC,KAAK,CAAC;EAE3E,oBACED,KAAA,CAAAU,aAAA,CAACP,gBAAgB;IACfM,yBAAyB,EAAEA,yBAA0B;IACrDD,sBAAsB,EAAEA,sBAAuB;IAC/CH,mBAAmB,EAAEA,mBAAoB;IACzCE,aAAa,EAAEA,aAAc;IAC7BD,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC;AAEDF,YAAY,CAACO,SAAS,GAAG;EACvBN,mBAAmB,EAAEH,SAAS,CAACU,IAAI;EACnCN,QAAQ,EAAEJ,SAAS,CAACW,SAAS,CAAC,CAACX,SAAS,CAACY,MAAM,EAAEZ,SAAS,CAACa,IAAI,CAAC,CAAC;EACjER,aAAa,EAAEL,SAAS,CAACc,OAAO,CAACd,SAAS,CAACe,MAAM;AACnD,CAAC;AAEDb,YAAY,CAACc,YAAY,GAAG;EAC1Bb,mBAAmB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC7BC,QAAQ,EAAE,KAAK;EACfC,aAAa,EAAE;AACjB,CAAC;AAED,eAAeH,YAAY","ignoreList":[]}
|
package/lib-es/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["PLUGIN_NAME","ONE_FILE_AS_LIMIT","AVAILABLE_FILTER_TYPES","all","type","images","videos","documents","MEDIA_LIST_ITEM_SIZE","MEDIA_OVER_SCAN_COUNT","ICON_SIZE","WIDTH","HEIGHT","ICON_COLOR","STROKE","FILL","STORE_KEY","NAME","ALL","INVALID_STORE_KEY_VALUES","PREVIEW","REORDER","IMAGES","MORE"],"sources":["../src/constants.js"],"sourcesContent":["const PLUGIN_NAME = 'media-ui';\nconst ONE_FILE_AS_LIMIT = 1;\nconst AVAILABLE_FILTER_TYPES = {\n all: {\n type: 'all'\n },\n images: {\n type: 'image'\n },\n videos: {\n type: 'video'\n },\n documents: {\n type: 'text'\n }\n};\n\nconst MEDIA_LIST_ITEM_SIZE = 97;\nconst MEDIA_OVER_SCAN_COUNT = 0;\n\nconst ICON_SIZE = {\n WIDTH: '25px',\n HEIGHT: '25px'\n};\n\nconst ICON_COLOR = {\n STROKE: '#63779C',\n FILL: '#63779C'\n};\n\nconst STORE_KEY = 'storeKey';\nconst NAME = 'name';\n\nconst ALL = 'all';\nconst INVALID_STORE_KEY_VALUES = [null, '', 'Please Choose...', 'Any'];\nconst PREVIEW = 'Preview';\nconst REORDER = 'Reorder';\nconst IMAGES = 'Images';\nconst MORE = 'more ...';\n\nexport {\n ALL,\n AVAILABLE_FILTER_TYPES,\n IMAGES,\n INVALID_STORE_KEY_VALUES,\n MEDIA_LIST_ITEM_SIZE,\n MEDIA_OVER_SCAN_COUNT,\n MORE,\n NAME,\n ONE_FILE_AS_LIMIT,\n PLUGIN_NAME,\n PREVIEW,\n REORDER,\n STORE_KEY,\n ICON_SIZE,\n ICON_COLOR\n};\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,UAAU;AAC9B,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,sBAAsB,GAAG;EAC7BC,GAAG,EAAE;IACHC,IAAI,EAAE;EACR,CAAC;EACDC,MAAM,EAAE;IACND,IAAI,EAAE;EACR,CAAC;EACDE,MAAM,EAAE;IACNF,IAAI,EAAE;EACR,CAAC;EACDG,SAAS,EAAE;IACTH,IAAI,EAAE;EACR;AACF,CAAC;AAED,MAAMI,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,qBAAqB,GAAG,CAAC;AAE/B,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAE,MAAM;EACbC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,UAAU,GAAG;EACjBC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,SAAS,GAAG,UAAU;AAC5B,MAAMC,IAAI,GAAG,MAAM;AAEnB,MAAMC,GAAG,GAAG,KAAK;AACjB,MAAMC,wBAAwB,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,kBAAkB,EAAE,KAAK,CAAC;AACtE,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,MAAM,GAAG,QAAQ;AACvB,MAAMC,IAAI,GAAG,UAAU;AAEvB,SACEL,GAAG,EACHhB,sBAAsB,EACtBoB,MAAM,EACNH,wBAAwB,EACxBX,oBAAoB,EACpBC,qBAAqB,EACrBc,IAAI,EACJN,IAAI,EACJhB,iBAAiB,EACjBD,WAAW,EACXoB,OAAO,EACPC,OAAO,EACPL,SAAS,EACTN,SAAS,EACTG,UAAU"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":["PLUGIN_NAME","ONE_FILE_AS_LIMIT","AVAILABLE_FILTER_TYPES","all","type","images","videos","documents","MEDIA_LIST_ITEM_SIZE","MEDIA_OVER_SCAN_COUNT","ICON_SIZE","WIDTH","HEIGHT","ICON_COLOR","STROKE","FILL","STORE_KEY","NAME","ALL","INVALID_STORE_KEY_VALUES","PREVIEW","REORDER","IMAGES","MORE"],"sources":["../src/constants.js"],"sourcesContent":["const PLUGIN_NAME = 'media-ui';\nconst ONE_FILE_AS_LIMIT = 1;\nconst AVAILABLE_FILTER_TYPES = {\n all: {\n type: 'all'\n },\n images: {\n type: 'image'\n },\n videos: {\n type: 'video'\n },\n documents: {\n type: 'text'\n }\n};\n\nconst MEDIA_LIST_ITEM_SIZE = 97;\nconst MEDIA_OVER_SCAN_COUNT = 0;\n\nconst ICON_SIZE = {\n WIDTH: '25px',\n HEIGHT: '25px'\n};\n\nconst ICON_COLOR = {\n STROKE: '#63779C',\n FILL: '#63779C'\n};\n\nconst STORE_KEY = 'storeKey';\nconst NAME = 'name';\n\nconst ALL = 'all';\nconst INVALID_STORE_KEY_VALUES = [null, '', 'Please Choose...', 'Any'];\nconst PREVIEW = 'Preview';\nconst REORDER = 'Reorder';\nconst IMAGES = 'Images';\nconst MORE = 'more ...';\n\nexport {\n ALL,\n AVAILABLE_FILTER_TYPES,\n IMAGES,\n INVALID_STORE_KEY_VALUES,\n MEDIA_LIST_ITEM_SIZE,\n MEDIA_OVER_SCAN_COUNT,\n MORE,\n NAME,\n ONE_FILE_AS_LIMIT,\n PLUGIN_NAME,\n PREVIEW,\n REORDER,\n STORE_KEY,\n ICON_SIZE,\n ICON_COLOR\n};\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,UAAU;AAC9B,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,sBAAsB,GAAG;EAC7BC,GAAG,EAAE;IACHC,IAAI,EAAE;EACR,CAAC;EACDC,MAAM,EAAE;IACND,IAAI,EAAE;EACR,CAAC;EACDE,MAAM,EAAE;IACNF,IAAI,EAAE;EACR,CAAC;EACDG,SAAS,EAAE;IACTH,IAAI,EAAE;EACR;AACF,CAAC;AAED,MAAMI,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,qBAAqB,GAAG,CAAC;AAE/B,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAE,MAAM;EACbC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,UAAU,GAAG;EACjBC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,SAAS,GAAG,UAAU;AAC5B,MAAMC,IAAI,GAAG,MAAM;AAEnB,MAAMC,GAAG,GAAG,KAAK;AACjB,MAAMC,wBAAwB,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,kBAAkB,EAAE,KAAK,CAAC;AACtE,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,MAAM,GAAG,QAAQ;AACvB,MAAMC,IAAI,GAAG,UAAU;AAEvB,SACEL,GAAG,EACHhB,sBAAsB,EACtBoB,MAAM,EACNH,wBAAwB,EACxBX,oBAAoB,EACpBC,qBAAqB,EACrBc,IAAI,EACJN,IAAI,EACJhB,iBAAiB,EACjBD,WAAW,EACXoB,OAAO,EACPC,OAAO,EACPL,SAAS,EACTN,SAAS,EACTG,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaLibraryIcon.js","names":["React","ICON_SIZE","ICON_COLOR","MediaLibraryIcon","width","WIDTH","height","HEIGHT","stroke","STROKE","createElement","viewBox","version","xmlns","xmlnsXlink","id","strokeWidth","fill","fillRule","transform","d","strokeLinecap","strokeLinejoin","cx","cy","rx","ry","x","y"],"sources":["../../src/icons/MediaLibraryIcon.js"],"sourcesContent":["import React from 'react';\nimport { ICON_SIZE, ICON_COLOR } from '../constants';\n\nfunction MediaLibraryIcon({\n width = ICON_SIZE.WIDTH,\n height = ICON_SIZE.HEIGHT,\n stroke = ICON_COLOR.STROKE\n}) {\n return (\n <svg\n width={width}\n height={height}\n viewBox=\"0 0 23 22\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\">\n <title>media-library</title>\n <g id=\"Page-1\" stroke=\"none\" strokeWidth=\"1\" fill=\"none\" fillRule=\"evenodd\">\n <g id=\"media-library\" transform=\"translate(1, 1.5)\">\n <g\n id=\"Group\"\n transform=\"translate(11.2707, 9.5) rotate(10) translate(-11.2707, -9.5)translate(2.7864, 1.3495)\">\n <path\n d=\"M6.97432089e-17,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 6.97432089e-17,0.912280592 6.97432089e-17,2.03763573 L6.97432089e-17,14.2634501 C6.97432089e-17,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z\"\n id=\"Shape\"\n stroke={stroke}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <ellipse\n id=\"Oval\"\n fill=\"#899BBC\"\n fillRule=\"nonzero\"\n cx=\"10.6975876\"\n cy=\"4.41487742\"\n rx=\"1.106647\"\n ry=\"1.01881787\"\n />\n </g>\n <rect\n id=\"Rectangle\"\n fill=\"#FFFFFF\"\n fillRule=\"nonzero\"\n x=\"0\"\n y=\"2.52861778\"\n width=\"16.9685872\"\n height=\"16.3010859\"\n rx=\"3\"\n />\n <g id=\"Group\" transform=\"translate(0, 2.5286)\">\n <path\n d=\"M0,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 0,0.912280592 0,2.03763573 L0,14.2634501 C0,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z\"\n id=\"Shape\"\n stroke=\"#63779C\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <ellipse\n id=\"Oval\"\n fill=\"#63779C\"\n fillRule=\"nonzero\"\n cx=\"10.6975876\"\n cy=\"4.41487742\"\n rx=\"1.106647\"\n ry=\"1.01881787\"\n />\n </g>\n </g>\n </g>\n </svg>\n );\n}\n\nexport default MediaLibraryIcon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,UAAU,QAAQ,cAAc;AAEpD,SAASC,gBAAgBA,CAAC;EACxBC,KAAK,GAAGH,SAAS,CAACI,KAAK;EACvBC,MAAM,GAAGL,SAAS,CAACM,MAAM;EACzBC,MAAM,GAAGN,UAAU,CAACO;AACtB,CAAC,EAAE;EACD,oBACET,KAAA,CAAAU,aAAA;IACEN,KAAK,EAAEA,KAAM;IACbE,MAAM,EAAEA,MAAO;IACfK,OAAO,EAAC,WAAW;IACnBC,OAAO,EAAC,KAAK;IACbC,KAAK,EAAC,4BAA4B;IAClCC,UAAU,EAAC;EAA8B,gBACzCd,KAAA,CAAAU,aAAA,gBAAO,eAAoB,CAAC,eAC5BV,KAAA,CAAAU,aAAA;IAAGK,EAAE,EAAC,QAAQ;IAACP,MAAM,EAAC,MAAM;IAACQ,WAAW,EAAC,GAAG;IAACC,IAAI,EAAC,MAAM;IAACC,QAAQ,EAAC;EAAS,gBACzElB,KAAA,CAAAU,aAAA;IAAGK,EAAE,EAAC,eAAe;IAACI,SAAS,EAAC;EAAmB,gBACjDnB,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,OAAO;IACVI,SAAS,EAAC;EAAuF,gBACjGnB,KAAA,CAAAU,aAAA;IACEU,CAAC,EAAC,koBAAkoB;IACpoBL,EAAE,EAAC,OAAO;IACVP,MAAM,EAAEA,MAAO;IACfa,aAAa,EAAC,OAAO;IACrBC,cAAc,EAAC;EAAO,CACvB,CAAC,eACFtB,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,MAAM;IACTE,IAAI,EAAC,SAAS;IACdC,QAAQ,EAAC,SAAS;IAClBK,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,UAAU;IACbC,EAAE,EAAC;EAAY,CAChB,CACA,CAAC,eACJ1B,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,WAAW;IACdE,IAAI,EAAC,SAAS;IACdC,QAAQ,EAAC,SAAS;IAClBS,CAAC,EAAC,GAAG;IACLC,CAAC,EAAC,YAAY;IACdxB,KAAK,EAAC,YAAY;IAClBE,MAAM,EAAC,YAAY;IACnBmB,EAAE,EAAC;EAAG,CACP,CAAC,eACFzB,KAAA,CAAAU,aAAA;IAAGK,EAAE,EAAC,OAAO;IAACI,SAAS,EAAC;EAAsB,gBAC5CnB,KAAA,CAAAU,aAAA;IACEU,CAAC,EAAC,ikBAAikB;IACnkBL,EAAE,EAAC,OAAO;IACVP,MAAM,EAAC,SAAS;IAChBa,aAAa,EAAC,OAAO;IACrBC,cAAc,EAAC;EAAO,CACvB,CAAC,eACFtB,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,MAAM;IACTE,IAAI,EAAC,SAAS;IACdC,QAAQ,EAAC,SAAS;IAClBK,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,UAAU;IACbC,EAAE,EAAC;EAAY,CAChB,CACA,CACF,CACF,CACA,CAAC;AAEV;AAEA,eAAevB,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"MediaLibraryIcon.js","names":["React","ICON_SIZE","ICON_COLOR","MediaLibraryIcon","width","WIDTH","height","HEIGHT","stroke","STROKE","createElement","viewBox","version","xmlns","xmlnsXlink","id","strokeWidth","fill","fillRule","transform","d","strokeLinecap","strokeLinejoin","cx","cy","rx","ry","x","y"],"sources":["../../src/icons/MediaLibraryIcon.js"],"sourcesContent":["import React from 'react';\nimport { ICON_SIZE, ICON_COLOR } from '../constants';\n\nfunction MediaLibraryIcon({\n width = ICON_SIZE.WIDTH,\n height = ICON_SIZE.HEIGHT,\n stroke = ICON_COLOR.STROKE\n}) {\n return (\n <svg\n width={width}\n height={height}\n viewBox=\"0 0 23 22\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\">\n <title>media-library</title>\n <g id=\"Page-1\" stroke=\"none\" strokeWidth=\"1\" fill=\"none\" fillRule=\"evenodd\">\n <g id=\"media-library\" transform=\"translate(1, 1.5)\">\n <g\n id=\"Group\"\n transform=\"translate(11.2707, 9.5) rotate(10) translate(-11.2707, -9.5)translate(2.7864, 1.3495)\">\n <path\n d=\"M6.97432089e-17,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 6.97432089e-17,0.912280592 6.97432089e-17,2.03763573 L6.97432089e-17,14.2634501 C6.97432089e-17,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z\"\n id=\"Shape\"\n stroke={stroke}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <ellipse\n id=\"Oval\"\n fill=\"#899BBC\"\n fillRule=\"nonzero\"\n cx=\"10.6975876\"\n cy=\"4.41487742\"\n rx=\"1.106647\"\n ry=\"1.01881787\"\n />\n </g>\n <rect\n id=\"Rectangle\"\n fill=\"#FFFFFF\"\n fillRule=\"nonzero\"\n x=\"0\"\n y=\"2.52861778\"\n width=\"16.9685872\"\n height=\"16.3010859\"\n rx=\"3\"\n />\n <g id=\"Group\" transform=\"translate(0, 2.5286)\">\n <path\n d=\"M0,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 0,0.912280592 0,2.03763573 L0,14.2634501 C0,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z\"\n id=\"Shape\"\n stroke=\"#63779C\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <ellipse\n id=\"Oval\"\n fill=\"#63779C\"\n fillRule=\"nonzero\"\n cx=\"10.6975876\"\n cy=\"4.41487742\"\n rx=\"1.106647\"\n ry=\"1.01881787\"\n />\n </g>\n </g>\n </g>\n </svg>\n );\n}\n\nexport default MediaLibraryIcon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,UAAU,QAAQ,cAAc;AAEpD,SAASC,gBAAgBA,CAAC;EACxBC,KAAK,GAAGH,SAAS,CAACI,KAAK;EACvBC,MAAM,GAAGL,SAAS,CAACM,MAAM;EACzBC,MAAM,GAAGN,UAAU,CAACO;AACtB,CAAC,EAAE;EACD,oBACET,KAAA,CAAAU,aAAA;IACEN,KAAK,EAAEA,KAAM;IACbE,MAAM,EAAEA,MAAO;IACfK,OAAO,EAAC,WAAW;IACnBC,OAAO,EAAC,KAAK;IACbC,KAAK,EAAC,4BAA4B;IAClCC,UAAU,EAAC;EAA8B,gBACzCd,KAAA,CAAAU,aAAA,gBAAO,eAAoB,CAAC,eAC5BV,KAAA,CAAAU,aAAA;IAAGK,EAAE,EAAC,QAAQ;IAACP,MAAM,EAAC,MAAM;IAACQ,WAAW,EAAC,GAAG;IAACC,IAAI,EAAC,MAAM;IAACC,QAAQ,EAAC;EAAS,gBACzElB,KAAA,CAAAU,aAAA;IAAGK,EAAE,EAAC,eAAe;IAACI,SAAS,EAAC;EAAmB,gBACjDnB,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,OAAO;IACVI,SAAS,EAAC;EAAuF,gBACjGnB,KAAA,CAAAU,aAAA;IACEU,CAAC,EAAC,koBAAkoB;IACpoBL,EAAE,EAAC,OAAO;IACVP,MAAM,EAAEA,MAAO;IACfa,aAAa,EAAC,OAAO;IACrBC,cAAc,EAAC;EAAO,CACvB,CAAC,eACFtB,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,MAAM;IACTE,IAAI,EAAC,SAAS;IACdC,QAAQ,EAAC,SAAS;IAClBK,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,UAAU;IACbC,EAAE,EAAC;EAAY,CAChB,CACA,CAAC,eACJ1B,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,WAAW;IACdE,IAAI,EAAC,SAAS;IACdC,QAAQ,EAAC,SAAS;IAClBS,CAAC,EAAC,GAAG;IACLC,CAAC,EAAC,YAAY;IACdxB,KAAK,EAAC,YAAY;IAClBE,MAAM,EAAC,YAAY;IACnBmB,EAAE,EAAC;EAAG,CACP,CAAC,eACFzB,KAAA,CAAAU,aAAA;IAAGK,EAAE,EAAC,OAAO;IAACI,SAAS,EAAC;EAAsB,gBAC5CnB,KAAA,CAAAU,aAAA;IACEU,CAAC,EAAC,ikBAAikB;IACnkBL,EAAE,EAAC,OAAO;IACVP,MAAM,EAAC,SAAS;IAChBa,aAAa,EAAC,OAAO;IACrBC,cAAc,EAAC;EAAO,CACvB,CAAC,eACFtB,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,MAAM;IACTE,IAAI,EAAC,SAAS;IACdC,QAAQ,EAAC,SAAS;IAClBK,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,UAAU;IACbC,EAAE,EAAC;EAAY,CAChB,CACA,CACF,CACF,CACA,CAAC;AAEV;AAEA,eAAevB,gBAAgB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["MediaLibraryIcon"],"sources":["../../src/icons/index.js"],"sourcesContent":["import MediaLibraryIcon from './MediaLibraryIcon';\n\nexport { MediaLibraryIcon };\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AAEjD,SAASA,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["MediaLibraryIcon"],"sources":["../../src/icons/index.js"],"sourcesContent":["import MediaLibraryIcon from './MediaLibraryIcon';\n\nexport { MediaLibraryIcon };\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AAEjD,SAASA,gBAAgB","ignoreList":[]}
|
package/lib-es/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { MediaLibraryIcon } from './icons';
|
|
|
5
5
|
import pkg from '../package.json';
|
|
6
6
|
import { PLUGIN_NAME } from './constants';
|
|
7
7
|
export const FilePreviewReadOnly = React.lazy(() => import( /* webpackChunkName: 'MediaFilePreviewReadOnly' */'./components/FilePreviewReadOnly'));
|
|
8
|
-
const
|
|
8
|
+
const MediaListing = React.lazy(() => import( /* webpackChunkName: 'MediaListingContainer' */'./components/MediaListing'));
|
|
9
9
|
const EditMediaFilePage = React.lazy(() => import( /* webpackChunkName: 'EditMediaFilePage' */'./components/EditMediaFile/EditMediaFilePage'));
|
|
10
10
|
export default async function load(app) {
|
|
11
11
|
app.events.once('admin:menu:config:load', ({
|
|
@@ -41,7 +41,7 @@ export default async function load(app) {
|
|
|
41
41
|
const mediaRoute = {
|
|
42
42
|
path: '/media',
|
|
43
43
|
key: 'media',
|
|
44
|
-
component:
|
|
44
|
+
component: MediaListing,
|
|
45
45
|
exact: true
|
|
46
46
|
};
|
|
47
47
|
const editMediaFileRoute = {
|
package/lib-es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","FileUploadAdapter","EditorAdapter","MediaLibraryIcon","pkg","PLUGIN_NAME","FilePreviewReadOnly","lazy","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","FileUploadAdapter","EditorAdapter","MediaLibraryIcon","pkg","PLUGIN_NAME","FilePreviewReadOnly","lazy","MediaListing","EditMediaFilePage","load","app","events","once","addConfig","main","items","media","label","uri","icon","order","addFieldType","type","component","mediaRoute","path","key","exact","editMediaFileRoute","addRoute","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport FileUploadAdapter from './components/FileUploadAdapter';\nimport EditorAdapter from './components/EditorAdapter';\nimport { MediaLibraryIcon } from './icons';\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport const FilePreviewReadOnly = React.lazy(() =>\n import(/* webpackChunkName: 'MediaFilePreviewReadOnly' */ './components/FilePreviewReadOnly')\n);\n\nconst MediaListing = React.lazy(() =>\n import(/* webpackChunkName: 'MediaListingContainer' */ './components/MediaListing')\n);\n\nconst EditMediaFilePage = React.lazy(() =>\n import(/* webpackChunkName: 'EditMediaFilePage' */ './components/EditMediaFile/EditMediaFilePage')\n);\nexport default async function load(app) {\n app.events.once('admin:menu:config:load', ({ addConfig }) => {\n addConfig({\n main: {\n items: {\n media: {\n label: 'Media',\n uri: '/media',\n icon: MediaLibraryIcon,\n order: 30\n }\n }\n }\n });\n });\n\n app.events.once('load:custom:field:type', addFieldType => {\n addFieldType({ type: 'fileUpload', component: FileUploadAdapter });\n addFieldType({ type: 'filePreview', component: FilePreviewReadOnly });\n addFieldType({ type: 'editor', component: EditorAdapter });\n });\n\n const mediaRoute = {\n path: '/media',\n key: 'media',\n component: MediaListing,\n exact: true\n };\n\n const editMediaFileRoute = {\n path: '/media/edit/:fileId',\n key: 'editMedia',\n component: EditMediaFilePage,\n exact: true\n };\n\n app.addRoute(mediaRoute);\n app.addRoute(editMediaFileRoute);\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,iBAAiB,MAAM,gCAAgC;AAC9D,OAAOC,aAAa,MAAM,4BAA4B;AACtD,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,WAAW,QAAQ,aAAa;AAEzC,OAAO,MAAMC,mBAAmB,GAAGN,KAAK,CAACO,IAAI,CAAC,MAC5C,MAAM,EAAC,kDAAmD,kCAAkC,CAC9F,CAAC;AAED,MAAMC,YAAY,GAAGR,KAAK,CAACO,IAAI,CAAC,MAC9B,MAAM,EAAC,+CAAgD,2BAA2B,CACpF,CAAC;AAED,MAAME,iBAAiB,GAAGT,KAAK,CAACO,IAAI,CAAC,MACnC,MAAM,EAAC,2CAA4C,8CAA8C,CACnG,CAAC;AACD,eAAe,eAAeG,IAAIA,CAACC,GAAG,EAAE;EACtCA,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAAEC;EAAU,CAAC,KAAK;IAC3DA,SAAS,CAAC;MACRC,IAAI,EAAE;QACJC,KAAK,EAAE;UACLC,KAAK,EAAE;YACLC,KAAK,EAAE,OAAO;YACdC,GAAG,EAAE,QAAQ;YACbC,IAAI,EAAEjB,gBAAgB;YACtBkB,KAAK,EAAE;UACT;QACF;MACF;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFV,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,wBAAwB,EAAES,YAAY,IAAI;IACxDA,YAAY,CAAC;MAAEC,IAAI,EAAE,YAAY;MAAEC,SAAS,EAAEvB;IAAkB,CAAC,CAAC;IAClEqB,YAAY,CAAC;MAAEC,IAAI,EAAE,aAAa;MAAEC,SAAS,EAAElB;IAAoB,CAAC,CAAC;IACrEgB,YAAY,CAAC;MAAEC,IAAI,EAAE,QAAQ;MAAEC,SAAS,EAAEtB;IAAc,CAAC,CAAC;EAC5D,CAAC,CAAC;EAEF,MAAMuB,UAAU,GAAG;IACjBC,IAAI,EAAE,QAAQ;IACdC,GAAG,EAAE,OAAO;IACZH,SAAS,EAAEhB,YAAY;IACvBoB,KAAK,EAAE;EACT,CAAC;EAED,MAAMC,kBAAkB,GAAG;IACzBH,IAAI,EAAE,qBAAqB;IAC3BC,GAAG,EAAE,WAAW;IAChBH,SAAS,EAAEf,iBAAiB;IAC5BmB,KAAK,EAAE;EACT,CAAC;EAEDjB,GAAG,CAACmB,QAAQ,CAACL,UAAU,CAAC;EACxBd,GAAG,CAACmB,QAAQ,CAACD,kBAAkB,CAAC;EAEhC,OAAO;IACLE,IAAI,EAAE1B,WAAW;IACjB2B,OAAO,EAAE5B,GAAG,CAAC4B;EACf,CAAC;AACH;AAEAtB,IAAI,CAACuB,UAAU,GAAG5B,WAAW","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"available-filters.js","names":["availableFilters","label","searchTerm","id","type","formats"],"sources":["../../../src/utils/available-filters/available-filters.js"],"sourcesContent":["const availableFilters = [\n {\n label: 'All',\n searchTerm: 'all',\n id: 'all',\n type: 'all',\n formats: [\n 'text/csv',\n 'text/plain',\n 'text/rtf',\n 'image/gif',\n 'image/jpeg',\n 'image/png',\n 'image/bmp',\n 'image/svg+xml',\n 'image/tiff',\n 'image/webp',\n 'application/pdf'\n ]\n },\n {\n label: 'Images',\n searchTerm: 'images',\n id: 'images',\n type: 'image',\n formats: [\n 'image/gif',\n 'image/jpeg',\n 'image/png',\n 'image/bmp',\n 'image/svg+xml',\n 'image/tiff',\n 'image/webp'\n ]\n },\n {\n label: 'Videos',\n searchTerm: 'videos',\n type: 'video',\n id: 'videos'\n },\n {\n label: 'Docs',\n searchTerm: 'documents',\n id: 'documents',\n type: 'text',\n formats: ['text/csv', 'text/plain', 'text/rtf', 'application/pdf']\n }\n];\n\nexport { availableFilters };\n"],"mappings":"AAAA,MAAMA,gBAAgB,GAAG,CACvB;EACEC,KAAK,EAAE,KAAK;EACZC,UAAU,EAAE,KAAK;EACjBC,EAAE,EAAE,KAAK;EACTC,IAAI,EAAE,KAAK;EACXC,OAAO,EAAE,CACP,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,iBAAiB;AAErB,CAAC,EACD;EACEJ,KAAK,EAAE,QAAQ;EACfC,UAAU,EAAE,QAAQ;EACpBC,EAAE,EAAE,QAAQ;EACZC,IAAI,EAAE,OAAO;EACbC,OAAO,EAAE,CACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY;AAEhB,CAAC,EACD;EACEJ,KAAK,EAAE,QAAQ;EACfC,UAAU,EAAE,QAAQ;EACpBE,IAAI,EAAE,OAAO;EACbD,EAAE,EAAE;AACN,CAAC,EACD;EACEF,KAAK,EAAE,MAAM;EACbC,UAAU,EAAE,WAAW;EACvBC,EAAE,EAAE,WAAW;EACfC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB;AACnE,CAAC,CACF;AAED,SAASL,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"available-filters.js","names":["availableFilters","label","searchTerm","id","type","formats"],"sources":["../../../src/utils/available-filters/available-filters.js"],"sourcesContent":["const availableFilters = [\n {\n label: 'All',\n searchTerm: 'all',\n id: 'all',\n type: 'all',\n formats: [\n 'text/csv',\n 'text/plain',\n 'text/rtf',\n 'image/gif',\n 'image/jpeg',\n 'image/png',\n 'image/bmp',\n 'image/svg+xml',\n 'image/tiff',\n 'image/webp',\n 'application/pdf'\n ]\n },\n {\n label: 'Images',\n searchTerm: 'images',\n id: 'images',\n type: 'image',\n formats: [\n 'image/gif',\n 'image/jpeg',\n 'image/png',\n 'image/bmp',\n 'image/svg+xml',\n 'image/tiff',\n 'image/webp'\n ]\n },\n {\n label: 'Videos',\n searchTerm: 'videos',\n type: 'video',\n id: 'videos'\n },\n {\n label: 'Docs',\n searchTerm: 'documents',\n id: 'documents',\n type: 'text',\n formats: ['text/csv', 'text/plain', 'text/rtf', 'application/pdf']\n }\n];\n\nexport { availableFilters };\n"],"mappings":"AAAA,MAAMA,gBAAgB,GAAG,CACvB;EACEC,KAAK,EAAE,KAAK;EACZC,UAAU,EAAE,KAAK;EACjBC,EAAE,EAAE,KAAK;EACTC,IAAI,EAAE,KAAK;EACXC,OAAO,EAAE,CACP,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,iBAAiB;AAErB,CAAC,EACD;EACEJ,KAAK,EAAE,QAAQ;EACfC,UAAU,EAAE,QAAQ;EACpBC,EAAE,EAAE,QAAQ;EACZC,IAAI,EAAE,OAAO;EACbC,OAAO,EAAE,CACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY;AAEhB,CAAC,EACD;EACEJ,KAAK,EAAE,QAAQ;EACfC,UAAU,EAAE,QAAQ;EACpBE,IAAI,EAAE,OAAO;EACbD,EAAE,EAAE;AACN,CAAC,EACD;EACEF,KAAK,EAAE,MAAM;EACbC,UAAU,EAAE,WAAW;EACvBC,EAAE,EAAE,WAAW;EACfC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB;AACnE,CAAC,CACF;AAED,SAASL,gBAAgB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["MediaContext","MediaContextProvider","MediaContextConsumer","useMediaContext"],"sources":["../../../src/utils/media-context/index.js"],"sourcesContent":["import { MediaContext, MediaContextProvider, MediaContextConsumer } from './media-context';\nimport { useMediaContext } from './useMediaContext';\n\nexport { MediaContext, MediaContextProvider, MediaContextConsumer, useMediaContext };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,oBAAoB,EAAEC,oBAAoB,QAAQ,iBAAiB;AAC1F,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASH,YAAY,EAAEC,oBAAoB,EAAEC,oBAAoB,EAAEC,eAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["MediaContext","MediaContextProvider","MediaContextConsumer","useMediaContext"],"sources":["../../../src/utils/media-context/index.js"],"sourcesContent":["import { MediaContext, MediaContextProvider, MediaContextConsumer } from './media-context';\nimport { useMediaContext } from './useMediaContext';\n\nexport { MediaContext, MediaContextProvider, MediaContextConsumer, useMediaContext };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,oBAAoB,EAAEC,oBAAoB,QAAQ,iBAAiB;AAC1F,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASH,YAAY,EAAEC,oBAAoB,EAAEC,oBAAoB,EAAEC,eAAe","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
const MediaContext = React.createContext();
|
|
2
|
+
const MediaContext = React.createContext({});
|
|
3
3
|
const MediaContextProvider = MediaContext.Provider;
|
|
4
4
|
const MediaContextConsumer = MediaContext.Consumer;
|
|
5
5
|
export { MediaContext, MediaContextProvider, MediaContextConsumer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-context.js","names":["React","MediaContext","createContext","MediaContextProvider","Provider","MediaContextConsumer","Consumer"],"sources":["../../../src/utils/media-context/media-context.js"],"sourcesContent":["import React from 'react';\n\nconst MediaContext = React.createContext();\nconst MediaContextProvider = MediaContext.Provider;\nconst MediaContextConsumer = MediaContext.Consumer;\n\nexport { MediaContext, MediaContextProvider, MediaContextConsumer };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,YAAY,GAAGD,KAAK,CAACE,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"media-context.js","names":["React","MediaContext","createContext","MediaContextProvider","Provider","MediaContextConsumer","Consumer"],"sources":["../../../src/utils/media-context/media-context.js"],"sourcesContent":["import React from 'react';\n\nconst MediaContext = React.createContext({});\nconst MediaContextProvider = MediaContext.Provider;\nconst MediaContextConsumer = MediaContext.Consumer;\n\nexport { MediaContext, MediaContextProvider, MediaContextConsumer };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,YAAY,GAAGD,KAAK,CAACE,aAAa,CAAC,CAAC,CAAC,CAAC;AAC5C,MAAMC,oBAAoB,GAAGF,YAAY,CAACG,QAAQ;AAClD,MAAMC,oBAAoB,GAAGJ,YAAY,CAACK,QAAQ;AAElD,SAASL,YAAY,EAAEE,oBAAoB,EAAEE,oBAAoB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMediaContext.js","names":["useContext","useMediaContext","ctx"],"sources":["../../../src/utils/media-context/useMediaContext.js"],"sourcesContent":["import { useContext } from 'react';\n\nconst useMediaContext = ctx => useContext(ctx);\n\nexport { useMediaContext };\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,MAAMC,eAAe,GAAGC,GAAG,IAAIF,UAAU,CAACE,GAAG,CAAC;AAE9C,SAASD,eAAe"}
|
|
1
|
+
{"version":3,"file":"useMediaContext.js","names":["useContext","useMediaContext","ctx"],"sources":["../../../src/utils/media-context/useMediaContext.js"],"sourcesContent":["import { useContext } from 'react';\n\nconst useMediaContext = ctx => useContext(ctx);\n\nexport { useMediaContext };\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,MAAMC,eAAe,GAAGC,GAAG,IAAIF,UAAU,CAACE,GAAG,CAAC;AAE9C,SAASD,eAAe","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-media-ui",
|
|
3
|
-
"version": "0.146.0-alpha.
|
|
3
|
+
"version": "0.146.0-alpha.17",
|
|
4
4
|
"description": "Blaze plugin media ui",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/admin-ui-utils": "
|
|
30
|
+
"@blaze-cms/admin-ui-utils": "0.146.0-alpha.17",
|
|
31
31
|
"@blaze-cms/core-errors": "^0.140.3",
|
|
32
|
-
"@blaze-cms/plugin-search-ui": "
|
|
33
|
-
"@blaze-cms/react-form-builder": "0.146.0-alpha.
|
|
32
|
+
"@blaze-cms/plugin-search-ui": "0.146.0-alpha.17",
|
|
33
|
+
"@blaze-cms/react-form-builder": "0.146.0-alpha.17",
|
|
34
34
|
"@blaze-cms/setup-ui": "^0.140.3",
|
|
35
35
|
"@blaze-react/button": "0.8.0-alpha.82",
|
|
36
36
|
"@blaze-react/drafteditor": "0.7.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"react-tiny-virtual-list": "2.2.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@blaze-cms/core-ui": "
|
|
47
|
+
"@blaze-cms/core-ui": "0.146.0-alpha.17"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@apollo/client": "3.x",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"lib/*",
|
|
58
58
|
"lib-es/*"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "097c0079a46a166784700a30abe84316b479e0fa"
|
|
61
61
|
}
|
|
@@ -14,20 +14,24 @@ const Actions = ({ file }) => {
|
|
|
14
14
|
<span>{extension}</span>
|
|
15
15
|
</div>
|
|
16
16
|
<div>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
{handleEditModal && (
|
|
18
|
+
<div
|
|
19
|
+
data-testid={`open-media-library-${file.id}`}
|
|
20
|
+
className="FilePreviewItem__info__actionsIcon material-icons edit"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
onClick={() => handleEditModal(file)}>
|
|
23
|
+
<i className="fas fa-pen fa-xs" />
|
|
24
|
+
</div>
|
|
25
|
+
)}
|
|
26
|
+
{onUnselectFile && (
|
|
27
|
+
<div
|
|
28
|
+
data-testid={`unselect-${file.id}`}
|
|
29
|
+
className="FilePreviewItem__info__actionsIcon material-icons delete"
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
onClick={() => onUnselectFile([file.id])}>
|
|
32
|
+
<i className="fas fa-trash fa-xs" />
|
|
33
|
+
</div>
|
|
34
|
+
)}
|
|
31
35
|
</div>
|
|
32
36
|
</div>
|
|
33
37
|
</>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { RawImage } from './RawImage';
|
|
2
2
|
import { Image } from './Image';
|
|
3
|
-
import { ReadOnly } from './ReadOnly';
|
|
4
3
|
import { imageSchema } from './imageSchema';
|
|
5
4
|
|
|
6
5
|
const image = {
|
|
7
6
|
component: {
|
|
8
7
|
card: Image,
|
|
9
|
-
raw: RawImage
|
|
10
|
-
readOnly: ReadOnly
|
|
8
|
+
raw: RawImage
|
|
11
9
|
},
|
|
12
10
|
schema: imageSchema
|
|
13
11
|
};
|
|
@@ -4,7 +4,9 @@ import FilePreview from '../FilePreview';
|
|
|
4
4
|
|
|
5
5
|
const FilePreviewList = ({ selectedFiles, children }) => (
|
|
6
6
|
<div className="FileUploadAdapter__preview">
|
|
7
|
-
{selectedFiles.map(file =>
|
|
7
|
+
{selectedFiles.map(file => (
|
|
8
|
+
<FilePreview key={file.id} file={file} previewType={FilePreview.availablePreviewTypes.raw} />
|
|
9
|
+
))}
|
|
8
10
|
{children}
|
|
9
11
|
</div>
|
|
10
12
|
);
|
|
@@ -10,13 +10,12 @@ const FilePreviewReadOnly = ({ label, id, type, value }) => {
|
|
|
10
10
|
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
11
11
|
const client = useApolloClient();
|
|
12
12
|
|
|
13
|
-
const getFiles = async (offset, ids
|
|
13
|
+
const getFiles = async (offset, ids) => {
|
|
14
14
|
const {
|
|
15
15
|
data: { files: newFiles }
|
|
16
16
|
} = await client.query({
|
|
17
17
|
query: getQuery('GET_FILES'),
|
|
18
18
|
variables: {
|
|
19
|
-
limit: fetchAll ? 0 : 4,
|
|
20
19
|
offset,
|
|
21
20
|
where: {
|
|
22
21
|
id: {
|
|
@@ -33,11 +32,7 @@ const FilePreviewReadOnly = ({ label, id, type, value }) => {
|
|
|
33
32
|
useEffect(
|
|
34
33
|
() => {
|
|
35
34
|
(async () => {
|
|
36
|
-
const
|
|
37
|
-
? initialValue.filter((_, i) => i <= 3)
|
|
38
|
-
: initialValue;
|
|
39
|
-
|
|
40
|
-
const files = await getFiles(0, initialFiles);
|
|
35
|
+
const files = await getFiles(0, initialValue);
|
|
41
36
|
const orderedFiles = orderFiles(files, initialValue);
|
|
42
37
|
setSelectedFiles(orderedFiles);
|
|
43
38
|
})();
|
|
@@ -29,7 +29,8 @@ const FileUploadAdapter = ({
|
|
|
29
29
|
maxItems,
|
|
30
30
|
shouldRenderInPreview,
|
|
31
31
|
canDragAndDrop,
|
|
32
|
-
simpleLayout
|
|
32
|
+
simpleLayout,
|
|
33
|
+
previewAllFiles
|
|
33
34
|
}) => {
|
|
34
35
|
const { InjectPreview } = useContext(FileUploadAdapter.FormContext);
|
|
35
36
|
const [currentLimit] = useLimit(maxItems);
|
|
@@ -43,7 +44,7 @@ const FileUploadAdapter = ({
|
|
|
43
44
|
const client = useApolloClient();
|
|
44
45
|
const { addToast } = useToasts();
|
|
45
46
|
|
|
46
|
-
const getFiles = async (offset, ids, fetchAll) => {
|
|
47
|
+
const getFiles = async (offset, ids, fetchAll = previewAllFiles) => {
|
|
47
48
|
const {
|
|
48
49
|
data: { files: newFiles }
|
|
49
50
|
} = await client.query({
|
|
@@ -66,9 +67,10 @@ const FileUploadAdapter = ({
|
|
|
66
67
|
useEffect(
|
|
67
68
|
() => {
|
|
68
69
|
(async () => {
|
|
69
|
-
const initialFiles =
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const initialFiles =
|
|
71
|
+
!selectedFiles.length && !previewAllFiles
|
|
72
|
+
? currentValue.filter((_, i) => i <= 3)
|
|
73
|
+
: currentValue;
|
|
72
74
|
|
|
73
75
|
const files = await getFiles(0, initialFiles);
|
|
74
76
|
const orderedFiles = orderFiles(files, currentValue);
|
|
@@ -132,9 +134,9 @@ const FileUploadAdapter = ({
|
|
|
132
134
|
});
|
|
133
135
|
};
|
|
134
136
|
|
|
135
|
-
const closeModalAndSetValue = isSaving => {
|
|
137
|
+
const closeModalAndSetValue = (isSaving, values) => {
|
|
136
138
|
if (isSaving) {
|
|
137
|
-
const parsedValue = getFormat(type, { filesIds: currentValue });
|
|
139
|
+
const parsedValue = getFormat(type, { filesIds: simpleLayout ? values : currentValue });
|
|
138
140
|
setDisplayModal(false);
|
|
139
141
|
return onChange({
|
|
140
142
|
event: { target: { value: parsedValue, name: id, type, currentValue } },
|
|
@@ -148,7 +150,9 @@ const FileUploadAdapter = ({
|
|
|
148
150
|
|
|
149
151
|
const fileUploadButtonText = getButtonText({ maxItems, value: initialValue });
|
|
150
152
|
|
|
151
|
-
const filesPending =
|
|
153
|
+
const filesPending = previewAllFiles
|
|
154
|
+
? 0
|
|
155
|
+
: getNumberFilesPendingToFetch(currentOffset, currentValue);
|
|
152
156
|
const onOpenLibrary = () => setDisplayModal(true);
|
|
153
157
|
const handleEditModal = file => {
|
|
154
158
|
const selectedEditFile = selectedFiles.find(({ id: _id }) => _id === file.id);
|
|
@@ -317,6 +321,7 @@ const FileUploadAdapter = ({
|
|
|
317
321
|
<div className="file-upload-modal-wrapper">
|
|
318
322
|
<ListingContainer
|
|
319
323
|
displayFileUploadModal={displayFileUploadModal}
|
|
324
|
+
closeModalAndSetValue={closeModalAndSetValue}
|
|
320
325
|
setDisplayFileUploadModal={setDisplayFileUploadModal}
|
|
321
326
|
handleSelectedFiles={handleSelectedFiles}
|
|
322
327
|
maxItems={currentLimit}
|
|
@@ -335,6 +340,7 @@ const FileUploadAdapter = ({
|
|
|
335
340
|
title="Media library"
|
|
336
341
|
onClose={() => closeModalAndSetValue()}>
|
|
337
342
|
<ListingContainer
|
|
343
|
+
closeModalAndSetValue={closeModalAndSetValue}
|
|
338
344
|
displayFileUploadModal={displayFileUploadModal}
|
|
339
345
|
setDisplayFileUploadModal={setDisplayFileUploadModal}
|
|
340
346
|
handleSelectedFiles={handleSelectedFiles}
|
|
@@ -357,7 +363,8 @@ FileUploadAdapter.propTypes = {
|
|
|
357
363
|
maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
|
|
358
364
|
shouldRenderInPreview: PropTypes.bool,
|
|
359
365
|
canDragAndDrop: PropTypes.bool,
|
|
360
|
-
simpleLayout: PropTypes.bool
|
|
366
|
+
simpleLayout: PropTypes.bool,
|
|
367
|
+
previewAllFiles: PropTypes.bool
|
|
361
368
|
};
|
|
362
369
|
|
|
363
370
|
FileUploadAdapter.defaultProps = {
|
|
@@ -365,7 +372,8 @@ FileUploadAdapter.defaultProps = {
|
|
|
365
372
|
maxItems: false,
|
|
366
373
|
shouldRenderInPreview: false,
|
|
367
374
|
canDragAndDrop: false,
|
|
368
|
-
simpleLayout: false
|
|
375
|
+
simpleLayout: false,
|
|
376
|
+
previewAllFiles: false
|
|
369
377
|
};
|
|
370
378
|
|
|
371
379
|
export default FileUploadAdapter;
|
|
@@ -6,7 +6,7 @@ import { useToasts } from '@blaze-react/toaster';
|
|
|
6
6
|
import { useApolloClient, useQuery } from '@apollo/client';
|
|
7
7
|
import useFileList from '../FileList/useFileList';
|
|
8
8
|
|
|
9
|
-
const FileUploadModal = ({ onClose, getSelectedFiles }) => {
|
|
9
|
+
const FileUploadModal = ({ onClose, getSelectedFiles, closeModalAndSetValue, simpleLayout }) => {
|
|
10
10
|
const [files, setFiles] = useState([]);
|
|
11
11
|
const { addToast } = useToasts();
|
|
12
12
|
const client = useApolloClient();
|
|
@@ -49,7 +49,11 @@ const FileUploadModal = ({ onClose, getSelectedFiles }) => {
|
|
|
49
49
|
const fileNames = files.map(({ file }) => file.name);
|
|
50
50
|
addNewFile(parsedResponse);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
if (simpleLayout) {
|
|
53
|
+
const filesToSelect = parsedResponse.map(file => file.id);
|
|
54
|
+
getSelectedFiles(null, filesToSelect);
|
|
55
|
+
closeModalAndSetValue(simpleLayout, filesToSelect);
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
addToast(`Uploaded: ${fileNames.join(', ')}`, {
|
|
55
59
|
appearance: 'success',
|
|
@@ -90,11 +94,15 @@ const FileUploadModal = ({ onClose, getSelectedFiles }) => {
|
|
|
90
94
|
|
|
91
95
|
FileUploadModal.propTypes = {
|
|
92
96
|
getSelectedFiles: PropTypes.func.isRequired,
|
|
93
|
-
onClose: PropTypes.func
|
|
97
|
+
onClose: PropTypes.func,
|
|
98
|
+
simpleLayout: PropTypes.bool,
|
|
99
|
+
closeModalAndSetValue: PropTypes.func
|
|
94
100
|
};
|
|
95
101
|
|
|
96
102
|
FileUploadModal.defaultProps = {
|
|
97
|
-
onClose: () => {}
|
|
103
|
+
onClose: () => {},
|
|
104
|
+
closeModalAndSetValue: () => {},
|
|
105
|
+
simpleLayout: false
|
|
98
106
|
};
|
|
99
107
|
|
|
100
108
|
export default FileUploadModal;
|
|
@@ -12,6 +12,7 @@ const Listing = ({
|
|
|
12
12
|
handleDisplayFileUploadModal,
|
|
13
13
|
getSelectedFiles,
|
|
14
14
|
setDisplayFileUploadModal,
|
|
15
|
+
closeModalAndSetValue,
|
|
15
16
|
simpleLayout
|
|
16
17
|
}) => (
|
|
17
18
|
<div className="page">
|
|
@@ -21,6 +22,8 @@ const Listing = ({
|
|
|
21
22
|
handleDisplayFileUploadModal(false);
|
|
22
23
|
setDisplayFileUploadModal(false);
|
|
23
24
|
}}
|
|
25
|
+
closeModalAndSetValue={closeModalAndSetValue}
|
|
26
|
+
simpleLayout={simpleLayout}
|
|
24
27
|
getSelectedFiles={getSelectedFiles}
|
|
25
28
|
/>
|
|
26
29
|
)}
|
|
@@ -57,10 +60,12 @@ Listing.propTypes = {
|
|
|
57
60
|
handleDisplayFileUploadModal: PropTypes.func,
|
|
58
61
|
simpleLayout: PropTypes.bool,
|
|
59
62
|
setDisplayFileUploadModal: PropTypes.func.isRequired,
|
|
60
|
-
displayFileUploadModal: PropTypes.bool.isRequired
|
|
63
|
+
displayFileUploadModal: PropTypes.bool.isRequired,
|
|
64
|
+
closeModalAndSetValue: PropTypes.func
|
|
61
65
|
};
|
|
62
66
|
|
|
63
67
|
Listing.defaultProps = {
|
|
68
|
+
closeModalAndSetValue: () => {},
|
|
64
69
|
handleDisplayFileUploadModal: () => {},
|
|
65
70
|
simpleLayout: false
|
|
66
71
|
};
|