@blaze-cms/plugin-media-ui 0.146.0-node18.1 → 0.146.0-rc-eagle.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/CHANGELOG.md +10 -16
- package/lib/components/CardMedia/CardMedia.js +168 -221
- package/lib/components/CardMedia/CardMedia.js.map +1 -1
- package/lib/components/CardMedia/index.js +2 -3
- package/lib/components/CardMedia/index.js.map +1 -1
- package/lib/components/EditMediaFile/EditMediaFile.js +162 -113
- package/lib/components/EditMediaFile/EditMediaFile.js.map +1 -1
- package/lib/components/EditMediaFile/EditMediaFilePage.js +81 -97
- package/lib/components/EditMediaFile/EditMediaFilePage.js.map +1 -1
- package/lib/components/EditMediaFile/index.js +2 -3
- package/lib/components/EditMediaFile/index.js.map +1 -1
- package/lib/components/EditorAdapter/EditorAdapter.js +43 -22
- package/lib/components/EditorAdapter/EditorAdapter.js.map +1 -1
- package/lib/components/EditorAdapter/index.js +2 -3
- package/lib/components/EditorAdapter/index.js.map +1 -1
- package/lib/components/FileList/FilesListContext/index.js +3 -4
- package/lib/components/FileList/FilesListContext/index.js.map +1 -1
- package/lib/components/FileList/FilesListProvider/index.js +27 -29
- package/lib/components/FileList/FilesListProvider/index.js.map +1 -1
- package/lib/components/FileList/useFileList/index.js +3 -6
- package/lib/components/FileList/useFileList/index.js.map +1 -1
- package/lib/components/FileList/useGetFiles/getFiles.js +164 -185
- package/lib/components/FileList/useGetFiles/getFiles.js.map +1 -1
- package/lib/components/FileList/useGetFiles/index.js +2 -3
- package/lib/components/FileList/useGetFiles/index.js.map +1 -1
- package/lib/components/FileList/useGetFiles/useGetFiles.js +88 -133
- package/lib/components/FileList/useGetFiles/useGetFiles.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/getCounters.js +10 -30
- package/lib/components/FileList/useGetFilesList/getCounters.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/index.js +2 -3
- package/lib/components/FileList/useGetFilesList/index.js.map +1 -1
- package/lib/components/FileList/useGetFilesList/useGetFilesList.js +89 -110
- package/lib/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -1
- package/lib/components/FilePreview/Actions/index.js +24 -38
- package/lib/components/FilePreview/Actions/index.js.map +1 -1
- package/lib/components/FilePreview/Image/Image.js +35 -24
- package/lib/components/FilePreview/Image/Image.js.map +1 -1
- package/lib/components/FilePreview/Image/RawImage.js +25 -27
- package/lib/components/FilePreview/Image/RawImage.js.map +1 -1
- package/lib/components/FilePreview/Image/imageSchema.js +2 -3
- package/lib/components/FilePreview/Image/imageSchema.js.map +1 -1
- package/lib/components/FilePreview/Image/index.js +1 -2
- package/lib/components/FilePreview/Image/index.js.map +1 -1
- package/lib/components/FilePreview/ModalContext.js +9 -0
- package/lib/components/FilePreview/ModalContext.js.map +1 -0
- package/lib/components/FilePreview/PDF/PDF.js +44 -31
- package/lib/components/FilePreview/PDF/PDF.js.map +1 -1
- package/lib/components/FilePreview/PDF/RawPDF.js +27 -29
- package/lib/components/FilePreview/PDF/RawPDF.js.map +1 -1
- package/lib/components/FilePreview/PDF/index.js +1 -2
- package/lib/components/FilePreview/PDF/index.js.map +1 -1
- package/lib/components/FilePreview/PDF/schema.js +1 -2
- package/lib/components/FilePreview/PDF/schema.js.map +1 -1
- package/lib/components/FilePreview/get-preview.js +12 -10
- package/lib/components/FilePreview/get-preview.js.map +1 -1
- package/lib/components/FilePreview/index.js +66 -57
- package/lib/components/FilePreview/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/PreviewDefault.js +35 -23
- package/lib/components/FilePreview/previewDefault/PreviewDefault.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/RawPreviewDefault.js +33 -27
- package/lib/components/FilePreview/previewDefault/RawPreviewDefault.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/icons/DefaultIcon.js +120 -123
- package/lib/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/icons/index.js +2 -3
- package/lib/components/FilePreview/previewDefault/icons/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/index.js +1 -2
- package/lib/components/FilePreview/previewDefault/index.js.map +1 -1
- package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js +1 -2
- package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FileList.js +10 -12
- package/lib/components/FilePreviewReadOnly/FileList.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FilePreviewList.js +14 -20
- package/lib/components/FilePreviewReadOnly/FilePreviewList.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js +52 -98
- package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/index.js +2 -3
- package/lib/components/FilePreviewReadOnly/index.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/mappers/format-initial-value.js +7 -8
- package/lib/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +1 -1
- package/lib/components/FilePreviewReadOnly/mappers/index.js +1 -2
- package/lib/components/FilePreviewReadOnly/mappers/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileList.js +26 -39
- package/lib/components/FileUploadAdapter/FileList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FilePreviewList.js +14 -20
- package/lib/components/FileUploadAdapter/FilePreviewList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileReorderList.js +18 -21
- package/lib/components/FileUploadAdapter/FileReorderList.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileReorderListItem.js +20 -23
- package/lib/components/FileUploadAdapter/FileReorderListItem.js.map +1 -1
- package/lib/components/FileUploadAdapter/FileUploadAdapter.js +238 -338
- package/lib/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -1
- package/lib/components/FileUploadAdapter/index.js +2 -3
- package/lib/components/FileUploadAdapter/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/format-initial-value.js +7 -8
- package/lib/components/FileUploadAdapter/mappers/format-initial-value.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-button-text.js +9 -6
- package/lib/components/FileUploadAdapter/mappers/get-button-text.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-format.js +7 -13
- package/lib/components/FileUploadAdapter/mappers/get-format.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +6 -5
- package/lib/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/index.js +6 -7
- package/lib/components/FileUploadAdapter/mappers/index.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/is-unselecting.js +2 -10
- package/lib/components/FileUploadAdapter/mappers/is-unselecting.js.map +1 -1
- package/lib/components/FileUploadAdapter/mappers/transform-to-array.js +2 -5
- package/lib/components/FileUploadAdapter/mappers/transform-to-array.js.map +1 -1
- package/lib/components/FileUploadAdapter/useLimit.js +4 -10
- package/lib/components/FileUploadAdapter/useLimit.js.map +1 -1
- package/lib/components/FileUploadModal/FileUploadModal.js +150 -145
- package/lib/components/FileUploadModal/FileUploadModal.js.map +1 -1
- package/lib/components/FileUploadModal/index.js +2 -3
- package/lib/components/FileUploadModal/index.js.map +1 -1
- package/lib/components/FilterPanel/FilterPanel.js +68 -88
- package/lib/components/FilterPanel/FilterPanel.js.map +1 -1
- package/lib/components/FilterPanel/index.js +2 -3
- package/lib/components/FilterPanel/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/Listing.js +58 -48
- package/lib/components/ListingContainer/Listing/Listing.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +75 -92
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js +2 -3
- package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js +22 -26
- package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -1
- package/lib/components/ListingContainer/Listing/MediaListing/index.js +2 -3
- package/lib/components/ListingContainer/Listing/MediaListing/index.js.map +1 -1
- package/lib/components/ListingContainer/Listing/index.js +2 -3
- package/lib/components/ListingContainer/Listing/index.js.map +1 -1
- package/lib/components/ListingContainer/ListingContainer.js +69 -92
- package/lib/components/ListingContainer/ListingContainer.js.map +1 -1
- package/lib/components/ListingContainer/index.js +2 -3
- package/lib/components/ListingContainer/index.js.map +1 -1
- package/lib/components/ListingContainer/mappers/exist-previous.js +3 -10
- package/lib/components/ListingContainer/mappers/exist-previous.js.map +1 -1
- package/lib/components/ListingContainer/mappers/index.js +2 -3
- package/lib/components/ListingContainer/mappers/index.js.map +1 -1
- package/lib/components/MediaListing.js +14 -26
- package/lib/components/MediaListing.js.map +1 -1
- package/lib/constants.js +15 -16
- package/lib/constants.js.map +1 -1
- package/lib/icons/MediaLibraryIcon.js +17 -20
- package/lib/icons/MediaLibraryIcon.js.map +1 -1
- package/lib/icons/index.js +2 -3
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +67 -92
- package/lib/index.js.map +1 -1
- package/lib/utils/available-filters/available-filters.js +1 -2
- package/lib/utils/available-filters/available-filters.js.map +1 -1
- package/lib/utils/bustUrl.js +13 -0
- package/lib/utils/bustUrl.js.map +1 -0
- package/lib/utils/media-context/index.js +4 -5
- package/lib/utils/media-context/index.js.map +1 -1
- package/lib/utils/media-context/media-context.js +3 -4
- package/lib/utils/media-context/media-context.js.map +1 -1
- package/lib/utils/media-context/useMediaContext.js +2 -4
- package/lib/utils/media-context/useMediaContext.js.map +1 -1
- package/package.json +14 -14
- package/src/components/CardMedia/CardMedia.js +27 -8
- package/src/components/EditMediaFile/EditMediaFile.js +115 -37
- package/src/components/EditMediaFile/EditMediaFilePage.js +35 -9
- package/src/components/EditorAdapter/EditorAdapter.js +31 -4
- package/src/components/FilePreview/Actions/index.js +25 -27
- package/src/components/FilePreview/Image/Image.js +15 -2
- package/src/components/FilePreview/Image/imageSchema.js +1 -1
- package/src/components/FilePreview/ModalContext.js +3 -0
- package/src/components/FilePreview/PDF/PDF.js +17 -4
- package/src/components/FilePreview/index.js +35 -6
- package/src/components/FilePreview/previewDefault/PreviewDefault.js +16 -3
- package/src/components/FilePreview/previewDefault/RawPreviewDefault.js +17 -7
- package/src/components/FilePreviewReadOnly/FileList.js +1 -3
- package/src/components/FilePreviewReadOnly/FilePreviewReadOnly.js +17 -29
- package/src/components/FileUploadAdapter/FileUploadAdapter.js +42 -18
- package/src/components/FileUploadAdapter/mappers/get-button-text.js +4 -3
- package/src/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +6 -4
- package/src/components/FileUploadModal/FileUploadModal.js +88 -42
- package/src/components/ListingContainer/Listing/Listing.js +15 -5
- package/src/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +11 -5
- package/src/components/ListingContainer/Listing/MediaListing/MediaListing.js +10 -2
- package/src/components/ListingContainer/ListingContainer.js +13 -4
- package/src/index.js +17 -14
- package/src/utils/bustUrl.js +6 -0
- package/lib-es/components/CardMedia/CardMedia.js +0 -219
- package/lib-es/components/CardMedia/CardMedia.js.map +0 -1
- package/lib-es/components/CardMedia/index.js +0 -3
- package/lib-es/components/CardMedia/index.js.map +0 -1
- package/lib-es/components/EditMediaFile/EditMediaFile.js +0 -115
- package/lib-es/components/EditMediaFile/EditMediaFile.js.map +0 -1
- package/lib-es/components/EditMediaFile/EditMediaFilePage.js +0 -86
- package/lib-es/components/EditMediaFile/EditMediaFilePage.js.map +0 -1
- package/lib-es/components/EditMediaFile/index.js +0 -3
- package/lib-es/components/EditMediaFile/index.js.map +0 -1
- package/lib-es/components/EditorAdapter/EditorAdapter.js +0 -39
- package/lib-es/components/EditorAdapter/EditorAdapter.js.map +0 -1
- package/lib-es/components/EditorAdapter/index.js +0 -3
- package/lib-es/components/EditorAdapter/index.js.map +0 -1
- package/lib-es/components/FileList/FilesListContext/index.js +0 -4
- package/lib-es/components/FileList/FilesListContext/index.js.map +0 -1
- package/lib-es/components/FileList/FilesListProvider/index.js +0 -36
- package/lib-es/components/FileList/FilesListProvider/index.js.map +0 -1
- package/lib-es/components/FileList/useFileList/index.js +0 -5
- package/lib-es/components/FileList/useFileList/index.js.map +0 -1
- package/lib-es/components/FileList/useGetFiles/getFiles.js +0 -179
- package/lib-es/components/FileList/useGetFiles/getFiles.js.map +0 -1
- package/lib-es/components/FileList/useGetFiles/index.js +0 -3
- package/lib-es/components/FileList/useGetFiles/index.js.map +0 -1
- package/lib-es/components/FileList/useGetFiles/useGetFiles.js +0 -114
- package/lib-es/components/FileList/useGetFiles/useGetFiles.js.map +0 -1
- package/lib-es/components/FileList/useGetFilesList/getCounters.js +0 -11
- package/lib-es/components/FileList/useGetFilesList/getCounters.js.map +0 -1
- package/lib-es/components/FileList/useGetFilesList/index.js +0 -3
- package/lib-es/components/FileList/useGetFilesList/index.js.map +0 -1
- package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js +0 -172
- package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js.map +0 -1
- package/lib-es/components/FilePreview/Actions/index.js +0 -38
- package/lib-es/components/FilePreview/Actions/index.js.map +0 -1
- package/lib-es/components/FilePreview/Image/Image.js +0 -27
- package/lib-es/components/FilePreview/Image/Image.js.map +0 -1
- package/lib-es/components/FilePreview/Image/RawImage.js +0 -31
- package/lib-es/components/FilePreview/Image/RawImage.js.map +0 -1
- package/lib-es/components/FilePreview/Image/imageSchema.js +0 -53
- package/lib-es/components/FilePreview/Image/imageSchema.js.map +0 -1
- package/lib-es/components/FilePreview/Image/index.js +0 -12
- package/lib-es/components/FilePreview/Image/index.js.map +0 -1
- package/lib-es/components/FilePreview/PDF/PDF.js +0 -34
- package/lib-es/components/FilePreview/PDF/PDF.js.map +0 -1
- package/lib-es/components/FilePreview/PDF/RawPDF.js +0 -33
- package/lib-es/components/FilePreview/PDF/RawPDF.js.map +0 -1
- package/lib-es/components/FilePreview/PDF/index.js +0 -12
- package/lib-es/components/FilePreview/PDF/index.js.map +0 -1
- package/lib-es/components/FilePreview/PDF/schema.js +0 -21
- package/lib-es/components/FilePreview/PDF/schema.js.map +0 -1
- package/lib-es/components/FilePreview/get-preview.js +0 -28
- package/lib-es/components/FilePreview/get-preview.js.map +0 -1
- package/lib-es/components/FilePreview/index.js +0 -85
- package/lib-es/components/FilePreview/index.js.map +0 -1
- package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js +0 -27
- package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js.map +0 -1
- package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js +0 -31
- package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js.map +0 -1
- package/lib-es/components/FilePreview/previewDefault/icons/DefaultIcon.js +0 -121
- package/lib-es/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +0 -1
- package/lib-es/components/FilePreview/previewDefault/icons/index.js +0 -3
- package/lib-es/components/FilePreview/previewDefault/icons/index.js.map +0 -1
- package/lib-es/components/FilePreview/previewDefault/index.js +0 -12
- package/lib-es/components/FilePreview/previewDefault/index.js.map +0 -1
- package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js +0 -25
- package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js.map +0 -1
- package/lib-es/components/FilePreviewReadOnly/FileList.js +0 -18
- package/lib-es/components/FilePreviewReadOnly/FileList.js.map +0 -1
- package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js +0 -22
- package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js.map +0 -1
- package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js +0 -66
- package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +0 -1
- package/lib-es/components/FilePreviewReadOnly/index.js +0 -3
- package/lib-es/components/FilePreviewReadOnly/index.js.map +0 -1
- package/lib-es/components/FilePreviewReadOnly/mappers/format-initial-value.js +0 -11
- package/lib-es/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +0 -1
- package/lib-es/components/FilePreviewReadOnly/mappers/index.js +0 -3
- package/lib-es/components/FilePreviewReadOnly/mappers/index.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/FileList.js +0 -52
- package/lib-es/components/FileUploadAdapter/FileList.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/FilePreviewList.js +0 -22
- package/lib-es/components/FileUploadAdapter/FilePreviewList.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/FileReorderList.js +0 -32
- package/lib-es/components/FileUploadAdapter/FileReorderList.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/FileReorderListItem.js +0 -24
- package/lib-es/components/FileUploadAdapter/FileReorderListItem.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js +0 -367
- package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/index.js +0 -3
- package/lib-es/components/FileUploadAdapter/index.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/mappers/format-initial-value.js +0 -11
- package/lib-es/components/FileUploadAdapter/mappers/format-initial-value.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js +0 -9
- package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-format.js +0 -12
- package/lib-es/components/FileUploadAdapter/mappers/get-format.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +0 -6
- package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/mappers/index.js +0 -8
- package/lib-es/components/FileUploadAdapter/mappers/index.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/mappers/is-unselecting.js +0 -2
- package/lib-es/components/FileUploadAdapter/mappers/is-unselecting.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/mappers/transform-to-array.js +0 -2
- package/lib-es/components/FileUploadAdapter/mappers/transform-to-array.js.map +0 -1
- package/lib-es/components/FileUploadAdapter/useLimit.js +0 -13
- package/lib-es/components/FileUploadAdapter/useLimit.js.map +0 -1
- package/lib-es/components/FileUploadModal/FileUploadModal.js +0 -113
- package/lib-es/components/FileUploadModal/FileUploadModal.js.map +0 -1
- package/lib-es/components/FileUploadModal/index.js +0 -3
- package/lib-es/components/FileUploadModal/index.js.map +0 -1
- package/lib-es/components/FilterPanel/FilterPanel.js +0 -135
- package/lib-es/components/FilterPanel/FilterPanel.js.map +0 -1
- package/lib-es/components/FilterPanel/index.js +0 -3
- package/lib-es/components/FilterPanel/index.js.map +0 -1
- package/lib-es/components/ListingContainer/Listing/Listing.js +0 -58
- package/lib-es/components/ListingContainer/Listing/Listing.js.map +0 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +0 -145
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +0 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js +0 -3
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +0 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js +0 -24
- package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +0 -1
- package/lib-es/components/ListingContainer/Listing/MediaListing/index.js +0 -3
- package/lib-es/components/ListingContainer/Listing/MediaListing/index.js.map +0 -1
- package/lib-es/components/ListingContainer/Listing/index.js +0 -3
- package/lib-es/components/ListingContainer/Listing/index.js.map +0 -1
- package/lib-es/components/ListingContainer/ListingContainer.js +0 -106
- package/lib-es/components/ListingContainer/ListingContainer.js.map +0 -1
- package/lib-es/components/ListingContainer/index.js +0 -3
- package/lib-es/components/ListingContainer/index.js.map +0 -1
- package/lib-es/components/ListingContainer/mappers/exist-previous.js +0 -3
- package/lib-es/components/ListingContainer/mappers/exist-previous.js.map +0 -1
- package/lib-es/components/ListingContainer/mappers/index.js +0 -3
- package/lib-es/components/ListingContainer/mappers/index.js.map +0 -1
- package/lib-es/components/MediaListing.js +0 -29
- package/lib-es/components/MediaListing.js.map +0 -1
- package/lib-es/constants.js +0 -36
- package/lib-es/constants.js.map +0 -1
- package/lib-es/icons/MediaLibraryIcon.js +0 -70
- package/lib-es/icons/MediaLibraryIcon.js.map +0 -1
- package/lib-es/icons/index.js +0 -3
- package/lib-es/icons/index.js.map +0 -1
- package/lib-es/index.js +0 -61
- package/lib-es/index.js.map +0 -1
- package/lib-es/utils/available-filters/available-filters.js +0 -26
- package/lib-es/utils/available-filters/available-filters.js.map +0 -1
- package/lib-es/utils/media-context/index.js +0 -4
- package/lib-es/utils/media-context/index.js.map +0 -1
- package/lib-es/utils/media-context/media-context.js +0 -6
- package/lib-es/utils/media-context/media-context.js.map +0 -1
- package/lib-es/utils/media-context/useMediaContext.js +0 -4
- package/lib-es/utils/media-context/useMediaContext.js.map +0 -1
|
@@ -1,74 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.js");
|
|
4
|
-
require("core-js/modules/es.array.filter.js");
|
|
5
|
-
require("core-js/modules/es.array.for-each.js");
|
|
6
|
-
require("core-js/modules/es.object.define-properties.js");
|
|
7
|
-
require("core-js/modules/es.object.define-property.js");
|
|
8
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
10
|
-
require("core-js/modules/es.object.keys.js");
|
|
11
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
12
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
13
4
|
Object.defineProperty(exports, "__esModule", {
|
|
14
5
|
value: true
|
|
15
6
|
});
|
|
16
|
-
exports
|
|
17
|
-
require("core-js/modules/es.array.concat.js");
|
|
18
|
-
require("core-js/modules/es.array.reduce.js");
|
|
19
|
-
require("core-js/modules/es.array.splice.js");
|
|
20
|
-
require("core-js/modules/es.date.to-json.js");
|
|
21
|
-
require("core-js/modules/es.object.to-string.js");
|
|
7
|
+
exports.default = void 0;
|
|
22
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
24
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
25
9
|
var _react = require("react");
|
|
26
10
|
var _lodash = _interopRequireDefault(require("lodash.differencewith"));
|
|
27
11
|
var _lodash2 = _interopRequireDefault(require("lodash.isequal"));
|
|
28
|
-
var
|
|
12
|
+
var _useGetFiles = _interopRequireDefault(require("../useGetFiles"));
|
|
29
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
15
|
function useGetFilesList() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
currentFilter = _useState6[0],
|
|
57
|
-
setCurrentFilter = _useState6[1];
|
|
58
|
-
var _useState7 = (0, _react.useState)({
|
|
59
|
-
all: 0,
|
|
60
|
-
text: 0,
|
|
61
|
-
image: 0,
|
|
62
|
-
video: 0
|
|
63
|
-
}),
|
|
64
|
-
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
65
|
-
allFilesCounter = _useState8[0],
|
|
66
|
-
setAllFilesCounter = _useState8[1];
|
|
67
|
-
var _useState9 = (0, _react.useState)(null),
|
|
68
|
-
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
69
|
-
counters = _useState10[0],
|
|
70
|
-
setCounters = _useState10[1];
|
|
71
|
-
(0, _react.useEffect)(function () {
|
|
16
|
+
const [{
|
|
17
|
+
queryParams,
|
|
18
|
+
previousFilter,
|
|
19
|
+
previousSearchTerm,
|
|
20
|
+
loading,
|
|
21
|
+
data: {
|
|
22
|
+
files: results,
|
|
23
|
+
all,
|
|
24
|
+
image,
|
|
25
|
+
video,
|
|
26
|
+
text
|
|
27
|
+
}
|
|
28
|
+
}, setParams] = (0, _useGetFiles.default)();
|
|
29
|
+
const [currentResults, setCurrentResults] = (0, _react.useState)([]);
|
|
30
|
+
const [allResults, setAllResults] = (0, _react.useState)([]);
|
|
31
|
+
const [currentFilter, setCurrentFilter] = (0, _react.useState)(null);
|
|
32
|
+
const [allFilesCounter, setAllFilesCounter] = (0, _react.useState)({
|
|
33
|
+
all: 0,
|
|
34
|
+
text: 0,
|
|
35
|
+
image: 0,
|
|
36
|
+
video: 0
|
|
37
|
+
});
|
|
38
|
+
const [counters, setCounters] = (0, _react.useState)(null);
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
72
40
|
if (all && image && video && text) {
|
|
73
41
|
setCounters({
|
|
74
42
|
all: all.total,
|
|
@@ -78,7 +46,7 @@ function useGetFilesList() {
|
|
|
78
46
|
});
|
|
79
47
|
}
|
|
80
48
|
}, [all, image, video, text]);
|
|
81
|
-
(0, _react.useEffect)(
|
|
49
|
+
(0, _react.useEffect)(() => {
|
|
82
50
|
if (!currentFilter && previousFilter) {
|
|
83
51
|
setCurrentFilter(previousFilter);
|
|
84
52
|
}
|
|
@@ -87,65 +55,78 @@ function useGetFilesList() {
|
|
|
87
55
|
setCurrentResults([]);
|
|
88
56
|
return;
|
|
89
57
|
}
|
|
90
|
-
|
|
58
|
+
const isContentDifferent = !!(0, _lodash.default)(results, currentResults, _lodash2.default).length;
|
|
91
59
|
if (isContentDifferent) {
|
|
92
|
-
setAllResults([
|
|
60
|
+
setAllResults([...allResults, ...results]);
|
|
93
61
|
setCurrentResults(results);
|
|
94
62
|
}
|
|
95
|
-
|
|
63
|
+
const shouldSetContentIfListIsVoid = !isContentDifferent && !allResults.length && results.length;
|
|
96
64
|
if (shouldSetContentIfListIsVoid) {
|
|
97
65
|
setAllResults(results);
|
|
98
66
|
setCurrentResults(results);
|
|
99
67
|
}
|
|
100
68
|
}, [currentFilter, currentResults, currentResults.length, previousFilter, results] //eslint-disable-line
|
|
101
69
|
);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
70
|
+
const removeFile = ({
|
|
71
|
+
index
|
|
72
|
+
}) => {
|
|
73
|
+
const resultsToUpdate = [...allResults];
|
|
105
74
|
resultsToUpdate.splice(index, 1);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
75
|
+
const currentFileType = resultsToUpdate[index].type;
|
|
76
|
+
const updatedFileTypeCounterValue = allFilesCounter[currentFileType] - 1;
|
|
77
|
+
const updateAllFilesCounter = allFilesCounter.all - 1;
|
|
109
78
|
if (queryParams.isSearch) {
|
|
110
|
-
setCounters(_objectSpread(_objectSpread({}, counters), {},
|
|
111
|
-
|
|
79
|
+
setCounters(_objectSpread(_objectSpread({}, counters), {}, {
|
|
80
|
+
[currentFileType]: counters[currentFileType] - 1,
|
|
81
|
+
all: counters.all - 1
|
|
82
|
+
}));
|
|
83
|
+
setAllFilesCounter(_objectSpread(_objectSpread({}, allFilesCounter), {}, {
|
|
84
|
+
[currentFileType]: updatedFileTypeCounterValue,
|
|
85
|
+
all: updateAllFilesCounter
|
|
86
|
+
}));
|
|
112
87
|
}
|
|
113
88
|
if (!queryParams.isSearch) {
|
|
114
|
-
|
|
89
|
+
const updatedCounters = _objectSpread(_objectSpread({}, allFilesCounter), {}, {
|
|
90
|
+
[currentFileType]: updatedFileTypeCounterValue,
|
|
91
|
+
all: updateAllFilesCounter
|
|
92
|
+
});
|
|
115
93
|
setCounters(updatedCounters);
|
|
116
94
|
setAllFilesCounter(updatedCounters);
|
|
117
95
|
}
|
|
118
96
|
setAllResults(resultsToUpdate);
|
|
119
97
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
98
|
+
const updateFile = ({
|
|
99
|
+
file,
|
|
100
|
+
index
|
|
101
|
+
}) => {
|
|
102
|
+
const resultsToUpdate = [...allResults];
|
|
124
103
|
resultsToUpdate[index] = file;
|
|
125
104
|
setAllResults(resultsToUpdate);
|
|
126
105
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
106
|
+
const addNewFile = newFiles => {
|
|
107
|
+
const {
|
|
108
|
+
image: _image,
|
|
109
|
+
video: _video,
|
|
110
|
+
text: _text
|
|
111
|
+
} = newFiles.reduce((acc, {
|
|
112
|
+
type
|
|
113
|
+
}) => {
|
|
114
|
+
acc[type] += 1;
|
|
115
|
+
return acc;
|
|
116
|
+
}, {
|
|
117
|
+
image: 0,
|
|
118
|
+
video: 0,
|
|
119
|
+
text: 0
|
|
120
|
+
});
|
|
140
121
|
if (queryParams.isSearch) {
|
|
141
122
|
setAllResults([]);
|
|
142
123
|
setParams({
|
|
143
|
-
queryParams
|
|
124
|
+
queryParams,
|
|
144
125
|
isSearch: false,
|
|
145
126
|
searchTerm: null
|
|
146
127
|
});
|
|
147
128
|
}
|
|
148
|
-
|
|
129
|
+
const updatedCounters = {
|
|
149
130
|
all: allFilesCounter.all + _image + _video + _text,
|
|
150
131
|
image: allFilesCounter.image + _image,
|
|
151
132
|
video: allFilesCounter.video + _video,
|
|
@@ -153,31 +134,31 @@ function useGetFilesList() {
|
|
|
153
134
|
};
|
|
154
135
|
setCounters(updatedCounters);
|
|
155
136
|
setAllFilesCounter(updatedCounters);
|
|
156
|
-
setAllResults([
|
|
137
|
+
setAllResults([...newFiles, ...allResults]);
|
|
157
138
|
};
|
|
158
|
-
|
|
139
|
+
const clearList = params => {
|
|
159
140
|
setAllResults([]);
|
|
160
141
|
setParams(_objectSpread(_objectSpread({}, params), {}, {
|
|
161
142
|
offset: 0
|
|
162
143
|
}));
|
|
163
144
|
setCounters(allFilesCounter);
|
|
164
145
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
146
|
+
const setQueryParams = params => {
|
|
147
|
+
const isNewSearchTerm = params.isSearch && previousSearchTerm !== params.searchTerm;
|
|
148
|
+
const hasDeletedSearchTerm = previousSearchTerm && params.searchTerm === null;
|
|
149
|
+
const newFilter = JSON.stringify(params.where);
|
|
150
|
+
const isNewFilter = newFilter !== previousFilter;
|
|
151
|
+
const shouldClearList = hasDeletedSearchTerm || isNewFilter || isNewSearchTerm;
|
|
171
152
|
shouldClearList ? clearList(params) : setParams(params);
|
|
172
153
|
setCurrentFilter(newFilter);
|
|
173
154
|
};
|
|
174
|
-
|
|
155
|
+
const parsedQueryParams = _objectSpread(_objectSpread({}, queryParams), {}, {
|
|
175
156
|
where: _objectSpread({}, queryParams.where)
|
|
176
157
|
});
|
|
177
158
|
if (parsedQueryParams.where.type === 'all') delete parsedQueryParams.where.type;
|
|
178
159
|
return [{
|
|
179
160
|
queryParams: parsedQueryParams,
|
|
180
|
-
loading
|
|
161
|
+
loading,
|
|
181
162
|
data: {
|
|
182
163
|
files: allResults,
|
|
183
164
|
all: counters ? formatCounterNumber(counters.all) : 0,
|
|
@@ -186,15 +167,13 @@ function useGetFilesList() {
|
|
|
186
167
|
documents: counters ? formatCounterNumber(counters.text) : 0
|
|
187
168
|
}
|
|
188
169
|
}, {
|
|
189
|
-
setQueryParams
|
|
190
|
-
clearList
|
|
191
|
-
removeFile
|
|
192
|
-
addNewFile
|
|
193
|
-
updateFile
|
|
170
|
+
setQueryParams,
|
|
171
|
+
clearList,
|
|
172
|
+
removeFile,
|
|
173
|
+
addNewFile,
|
|
174
|
+
updateFile
|
|
194
175
|
}];
|
|
195
176
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
};
|
|
199
|
-
var _default = exports["default"] = useGetFilesList;
|
|
177
|
+
const formatCounterNumber = n => n === 10000 ? '10000+' : n;
|
|
178
|
+
var _default = exports.default = useGetFilesList;
|
|
200
179
|
//# sourceMappingURL=useGetFilesList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetFilesList.js","names":["_react","require","_lodash","_interopRequireDefault","_lodash2","_useGetFiles3","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","useGetFilesList","_useGetFiles","useGetFiles","_useGetFiles2","_slicedToArray2","_useGetFiles2$","queryParams","previousFilter","previousSearchTerm","loading","_useGetFiles2$$data","data","results","files","all","image","video","text","setParams","_useState","useState","_useState2","currentResults","setCurrentResults","_useState3","_useState4","allResults","setAllResults","_useState5","_useState6","currentFilter","setCurrentFilter","_useState7","_useState8","allFilesCounter","setAllFilesCounter","_useState9","_useState10","counters","setCounters","useEffect","total","isContentDifferent","differenceWith","isEqual","concat","_toConsumableArray2","shouldSetContentIfListIsVoid","removeFile","_ref","index","resultsToUpdate","splice","currentFileType","type","updatedFileTypeCounterValue","updateAllFilesCounter","isSearch","updatedCounters","updateFile","_ref2","file","addNewFile","newFiles","_newFiles$reduce","reduce","acc","_ref3","_image","_video","_text","searchTerm","clearList","params","offset","setQueryParams","isNewSearchTerm","hasDeletedSearchTerm","newFilter","JSON","stringify","where","isNewFilter","shouldClearList","parsedQueryParams","formatCounterNumber","images","videos","documents","n","_default","exports"],"sources":["../../../../src/components/FileList/useGetFilesList/useGetFilesList.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport differenceWith from 'lodash.differencewith';\nimport isEqual from 'lodash.isequal';\nimport useGetFiles from '../useGetFiles';\n\nfunction useGetFilesList() {\n const [\n {\n queryParams,\n previousFilter,\n previousSearchTerm,\n loading,\n data: { files: results, all, image, video, text }\n },\n setParams\n ] = useGetFiles();\n const [currentResults, setCurrentResults] = useState([]);\n const [allResults, setAllResults] = useState([]);\n const [currentFilter, setCurrentFilter] = useState(null);\n const [allFilesCounter, setAllFilesCounter] = useState({ all: 0, text: 0, image: 0, video: 0 });\n const [counters, setCounters] = useState(null);\n\n useEffect(() => {\n if (all && image && video && text) {\n setCounters({\n all: all.total,\n image: image.total,\n video: video.total,\n text: text.total\n });\n }\n }, [all, image, video, text]);\n\n useEffect(\n () => {\n if (!currentFilter && previousFilter) {\n setCurrentFilter(previousFilter);\n }\n\n if (currentFilter !== previousFilter) {\n setAllResults([]);\n setCurrentResults([]);\n return;\n }\n\n const isContentDifferent = !!differenceWith(results, currentResults, isEqual).length;\n if (isContentDifferent) {\n setAllResults([...allResults, ...results]);\n setCurrentResults(results);\n }\n\n const shouldSetContentIfListIsVoid =\n !isContentDifferent && !allResults.length && results.length;\n\n if (shouldSetContentIfListIsVoid) {\n setAllResults(results);\n setCurrentResults(results);\n }\n },\n [currentFilter, currentResults, currentResults.length, previousFilter, results] //eslint-disable-line\n );\n\n const removeFile = ({ index }) => {\n const resultsToUpdate = [...allResults];\n resultsToUpdate.splice(index, 1);\n const currentFileType = resultsToUpdate[index].type;\n const updatedFileTypeCounterValue = allFilesCounter[currentFileType] - 1;\n const updateAllFilesCounter = allFilesCounter.all - 1;\n if (queryParams.isSearch) {\n setCounters({\n ...counters,\n [currentFileType]: counters[currentFileType] - 1,\n all: counters.all - 1\n });\n setAllFilesCounter({\n ...allFilesCounter,\n [currentFileType]: updatedFileTypeCounterValue,\n all: updateAllFilesCounter\n });\n }\n\n if (!queryParams.isSearch) {\n const updatedCounters = {\n ...allFilesCounter,\n [currentFileType]: updatedFileTypeCounterValue,\n all: updateAllFilesCounter\n };\n\n setCounters(updatedCounters);\n setAllFilesCounter(updatedCounters);\n }\n setAllResults(resultsToUpdate);\n };\n\n const updateFile = ({ file, index }) => {\n const resultsToUpdate = [...allResults];\n resultsToUpdate[index] = file;\n setAllResults(resultsToUpdate);\n };\n\n const addNewFile = newFiles => {\n const {\n image: _image,\n video: _video,\n text: _text\n } = newFiles.reduce(\n (acc, { type }) => {\n acc[type] += 1;\n return acc;\n },\n { image: 0, video: 0, text: 0 }\n );\n\n if (queryParams.isSearch) {\n setAllResults([]);\n setParams({ queryParams, isSearch: false, searchTerm: null });\n }\n\n const updatedCounters = {\n all: allFilesCounter.all + _image + _video + _text,\n image: allFilesCounter.image + _image,\n video: allFilesCounter.video + _video,\n text: allFilesCounter.text + _text\n };\n\n setCounters(updatedCounters);\n setAllFilesCounter(updatedCounters);\n setAllResults([...newFiles, ...allResults]);\n };\n\n const clearList = params => {\n setAllResults([]);\n setParams({ ...params, offset: 0 });\n setCounters(allFilesCounter);\n };\n\n const setQueryParams = params => {\n const isNewSearchTerm = params.isSearch && previousSearchTerm !== params.searchTerm;\n const hasDeletedSearchTerm = previousSearchTerm && params.searchTerm === null;\n const newFilter = JSON.stringify(params.where);\n const isNewFilter = newFilter !== previousFilter;\n const shouldClearList = hasDeletedSearchTerm || isNewFilter || isNewSearchTerm;\n shouldClearList ? clearList(params) : setParams(params);\n setCurrentFilter(newFilter);\n };\n\n const parsedQueryParams = {\n ...queryParams,\n where: { ...queryParams.where }\n };\n\n if (parsedQueryParams.where.type === 'all') delete parsedQueryParams.where.type;\n\n return [\n {\n queryParams: parsedQueryParams,\n loading,\n data: {\n files: allResults,\n all: counters ? formatCounterNumber(counters.all) : 0,\n images: counters ? formatCounterNumber(counters.image) : 0,\n videos: counters ? formatCounterNumber(counters.video) : 0,\n documents: counters ? formatCounterNumber(counters.text) : 0\n }\n },\n { setQueryParams, clearList, removeFile, addNewFile, updateFile }\n ];\n}\n\nconst formatCounterNumber = n => (n === 10000 ? '10000+' : n);\n\nexport default useGetFilesList;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAyC,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAA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GAAG,SAAtBA,mBAAmBA,CAAGI,CAAC;EAAA,OAAKA,CAAC,KAAK,KAAK,GAAG,QAAQ,GAAGA,CAAC;AAAA,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAE/C3F,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useGetFilesList.js","names":["_react","require","_lodash","_interopRequireDefault","_lodash2","_useGetFiles","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","useGetFilesList","queryParams","previousFilter","previousSearchTerm","loading","data","files","results","all","image","video","text","setParams","useGetFiles","currentResults","setCurrentResults","useState","allResults","setAllResults","currentFilter","setCurrentFilter","allFilesCounter","setAllFilesCounter","counters","setCounters","useEffect","total","isContentDifferent","differenceWith","isEqual","shouldSetContentIfListIsVoid","removeFile","index","resultsToUpdate","splice","currentFileType","type","updatedFileTypeCounterValue","updateAllFilesCounter","isSearch","updatedCounters","updateFile","file","addNewFile","newFiles","_image","_video","_text","reduce","acc","searchTerm","clearList","params","offset","setQueryParams","isNewSearchTerm","hasDeletedSearchTerm","newFilter","JSON","stringify","where","isNewFilter","shouldClearList","parsedQueryParams","formatCounterNumber","images","videos","documents","n","_default","exports"],"sources":["../../../../src/components/FileList/useGetFilesList/useGetFilesList.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport differenceWith from 'lodash.differencewith';\nimport isEqual from 'lodash.isequal';\nimport useGetFiles from '../useGetFiles';\n\nfunction useGetFilesList() {\n const [\n {\n queryParams,\n previousFilter,\n previousSearchTerm,\n loading,\n data: { files: results, all, image, video, text }\n },\n setParams\n ] = useGetFiles();\n const [currentResults, setCurrentResults] = useState([]);\n const [allResults, setAllResults] = useState([]);\n const [currentFilter, setCurrentFilter] = useState(null);\n const [allFilesCounter, setAllFilesCounter] = useState({ all: 0, text: 0, image: 0, video: 0 });\n const [counters, setCounters] = useState(null);\n\n useEffect(() => {\n if (all && image && video && text) {\n setCounters({\n all: all.total,\n image: image.total,\n video: video.total,\n text: text.total\n });\n }\n }, [all, image, video, text]);\n\n useEffect(\n () => {\n if (!currentFilter && previousFilter) {\n setCurrentFilter(previousFilter);\n }\n\n if (currentFilter !== previousFilter) {\n setAllResults([]);\n setCurrentResults([]);\n return;\n }\n\n const isContentDifferent = !!differenceWith(results, currentResults, isEqual).length;\n if (isContentDifferent) {\n setAllResults([...allResults, ...results]);\n setCurrentResults(results);\n }\n\n const shouldSetContentIfListIsVoid =\n !isContentDifferent && !allResults.length && results.length;\n\n if (shouldSetContentIfListIsVoid) {\n setAllResults(results);\n setCurrentResults(results);\n }\n },\n [currentFilter, currentResults, currentResults.length, previousFilter, results] //eslint-disable-line\n );\n\n const removeFile = ({ index }) => {\n const resultsToUpdate = [...allResults];\n resultsToUpdate.splice(index, 1);\n const currentFileType = resultsToUpdate[index].type;\n const updatedFileTypeCounterValue = allFilesCounter[currentFileType] - 1;\n const updateAllFilesCounter = allFilesCounter.all - 1;\n if (queryParams.isSearch) {\n setCounters({\n ...counters,\n [currentFileType]: counters[currentFileType] - 1,\n all: counters.all - 1\n });\n setAllFilesCounter({\n ...allFilesCounter,\n [currentFileType]: updatedFileTypeCounterValue,\n all: updateAllFilesCounter\n });\n }\n\n if (!queryParams.isSearch) {\n const updatedCounters = {\n ...allFilesCounter,\n [currentFileType]: updatedFileTypeCounterValue,\n all: updateAllFilesCounter\n };\n\n setCounters(updatedCounters);\n setAllFilesCounter(updatedCounters);\n }\n setAllResults(resultsToUpdate);\n };\n\n const updateFile = ({ file, index }) => {\n const resultsToUpdate = [...allResults];\n resultsToUpdate[index] = file;\n setAllResults(resultsToUpdate);\n };\n\n const addNewFile = newFiles => {\n const {\n image: _image,\n video: _video,\n text: _text\n } = newFiles.reduce(\n (acc, { type }) => {\n acc[type] += 1;\n return acc;\n },\n { image: 0, video: 0, text: 0 }\n );\n\n if (queryParams.isSearch) {\n setAllResults([]);\n setParams({ queryParams, isSearch: false, searchTerm: null });\n }\n\n const updatedCounters = {\n all: allFilesCounter.all + _image + _video + _text,\n image: allFilesCounter.image + _image,\n video: allFilesCounter.video + _video,\n text: allFilesCounter.text + _text\n };\n\n setCounters(updatedCounters);\n setAllFilesCounter(updatedCounters);\n setAllResults([...newFiles, ...allResults]);\n };\n\n const clearList = params => {\n setAllResults([]);\n setParams({ ...params, offset: 0 });\n setCounters(allFilesCounter);\n };\n\n const setQueryParams = params => {\n const isNewSearchTerm = params.isSearch && previousSearchTerm !== params.searchTerm;\n const hasDeletedSearchTerm = previousSearchTerm && params.searchTerm === null;\n const newFilter = JSON.stringify(params.where);\n const isNewFilter = newFilter !== previousFilter;\n const shouldClearList = hasDeletedSearchTerm || isNewFilter || isNewSearchTerm;\n shouldClearList ? clearList(params) : setParams(params);\n setCurrentFilter(newFilter);\n };\n\n const parsedQueryParams = {\n ...queryParams,\n where: { ...queryParams.where }\n };\n\n if (parsedQueryParams.where.type === 'all') delete parsedQueryParams.where.type;\n\n return [\n {\n queryParams: parsedQueryParams,\n loading,\n data: {\n files: allResults,\n all: counters ? formatCounterNumber(counters.all) : 0,\n images: counters ? formatCounterNumber(counters.image) : 0,\n videos: counters ? formatCounterNumber(counters.video) : 0,\n documents: counters ? formatCounterNumber(counters.text) : 0\n }\n },\n { setQueryParams, clearList, removeFile, addNewFile, updateFile }\n ];\n}\n\nconst formatCounterNumber = n => (n === 10000 ? '10000+' : n);\n\nexport default useGetFilesList;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,YAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAyC,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,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AK,EAAEW,UAAU;MACjBT,GAAG,EAAEe,QAAQ,GAAGyC,mBAAmB,CAACzC,QAAQ,CAACf,GAAG,CAAC,GAAG,CAAC;MACrDyD,MAAM,EAAE1C,QAAQ,GAAGyC,mBAAmB,CAACzC,QAAQ,CAACd,KAAK,CAAC,GAAG,CAAC;MAC1DyD,MAAM,EAAE3C,QAAQ,GAAGyC,mBAAmB,CAACzC,QAAQ,CAACb,KAAK,CAAC,GAAG,CAAC;MAC1DyD,SAAS,EAAE5C,QAAQ,GAAGyC,mBAAmB,CAACzC,QAAQ,CAACZ,IAAI,CAAC,GAAG;IAC7D;EACF,CAAC,EACD;IAAE2C,cAAc;IAAEH,SAAS;IAAEpB,UAAU;IAAEY,UAAU;IAAEF;EAAW,CAAC,CAClE;AACH;AAEA,MAAMuB,mBAAmB,GAAGI,CAAC,IAAKA,CAAC,KAAK,KAAK,GAAG,QAAQ,GAAGA,CAAE;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1E,OAAA,GAE/CI,eAAe","ignoreList":[]}
|
|
@@ -1,60 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
require("core-js/modules/es.object.define-property.js");
|
|
5
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
-
require("core-js/modules/es.object.to-string.js");
|
|
7
|
-
require("core-js/modules/es.string.iterator.js");
|
|
8
|
-
require("core-js/modules/es.weak-map.js");
|
|
9
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
11
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
12
4
|
Object.defineProperty(exports, "__esModule", {
|
|
13
5
|
value: true
|
|
14
6
|
});
|
|
15
|
-
exports
|
|
16
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
+
exports.default = void 0;
|
|
17
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
10
|
var _mediaContext = require("../../../utils/media-context");
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
handleEditModal
|
|
26
|
-
onUnselectFile
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
const Actions = ({
|
|
13
|
+
file
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
handleEditModal,
|
|
17
|
+
onUnselectFile
|
|
18
|
+
} = (0, _react.useContext)(_mediaContext.MediaContext);
|
|
19
|
+
const [, extension] = file.mimetype.split('/');
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
21
|
className: "FilePreviewItem__info__actions"
|
|
32
|
-
}, /*#__PURE__*/_react
|
|
22
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
23
|
className: "FilePreviewItem__info__actions FilePreviewItem__info__actions--media-type"
|
|
34
|
-
}, /*#__PURE__*/_react
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
35
25
|
className: "FilePreviewItem__info__actionsIcon material-icons"
|
|
36
|
-
}, "insert_photo"), ' ', /*#__PURE__*/_react
|
|
37
|
-
"data-testid":
|
|
26
|
+
}, "insert_photo"), ' ', /*#__PURE__*/_react.default.createElement("span", null, extension)), /*#__PURE__*/_react.default.createElement("div", null, handleEditModal && /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
+
"data-testid": `open-media-library-${file.id}`,
|
|
38
28
|
className: "FilePreviewItem__info__actionsIcon material-icons edit",
|
|
39
29
|
"aria-hidden": "true",
|
|
40
|
-
onClick:
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
30
|
+
onClick: () => handleEditModal(file)
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
44
32
|
className: "fas fa-pen fa-xs"
|
|
45
|
-
})), onUnselectFile && /*#__PURE__*/_react
|
|
46
|
-
"data-testid":
|
|
33
|
+
})), onUnselectFile && /*#__PURE__*/_react.default.createElement("div", {
|
|
34
|
+
"data-testid": `unselect-${file.id}`,
|
|
47
35
|
className: "FilePreviewItem__info__actionsIcon material-icons delete",
|
|
48
36
|
"aria-hidden": "true",
|
|
49
|
-
onClick:
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
37
|
+
onClick: () => onUnselectFile([file.id])
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
53
39
|
className: "fas fa-trash fa-xs"
|
|
54
|
-
}))))
|
|
40
|
+
}))));
|
|
55
41
|
};
|
|
56
42
|
Actions.propTypes = {
|
|
57
|
-
file: _propTypes
|
|
43
|
+
file: _propTypes.default.object.isRequired
|
|
58
44
|
};
|
|
59
|
-
var _default = exports
|
|
45
|
+
var _default = exports.default = Actions;
|
|
60
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_mediaContext","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_mediaContext","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Actions","file","handleEditModal","onUnselectFile","useContext","MediaContext","extension","mimetype","split","createElement","className","id","onClick","propTypes","PropTypes","object","isRequired","_default","exports"],"sources":["../../../../src/components/FilePreview/Actions/index.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { MediaContext } from '../../../utils/media-context';\n\nconst Actions = ({ file }) => {\n const { handleEditModal, onUnselectFile } = useContext(MediaContext);\n const [, extension] = file.mimetype.split('/');\n\n return (\n <div className=\"FilePreviewItem__info__actions\">\n <div className=\"FilePreviewItem__info__actions FilePreviewItem__info__actions--media-type\">\n <i className=\"FilePreviewItem__info__actionsIcon material-icons\">insert_photo</i>{' '}\n <span>{extension}</span>\n </div>\n <div>\n {handleEditModal && (\n <div\n data-testid={`open-media-library-${file.id}`}\n className=\"FilePreviewItem__info__actionsIcon material-icons edit\"\n aria-hidden=\"true\"\n onClick={() => handleEditModal(file)}>\n <i className=\"fas fa-pen fa-xs\" />\n </div>\n )}\n {onUnselectFile && (\n <div\n data-testid={`unselect-${file.id}`}\n className=\"FilePreviewItem__info__actionsIcon material-icons delete\"\n aria-hidden=\"true\"\n onClick={() => onUnselectFile([file.id])}>\n <i className=\"fas fa-trash fa-xs\" />\n </div>\n )}\n </div>\n </div>\n );\n};\n\nActions.propTypes = {\n file: PropTypes.object.isRequired\n};\n\nexport default Actions;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAA4D,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAA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gBACxFnC,MAAA,CAAAgB,OAAA,CAAAkB,aAAA;IAAGC,SAAS,EAAC;EAAmD,GAAC,cAAe,CAAC,EAAC,GAAG,eACrFnC,MAAA,CAAAgB,OAAA,CAAAkB,aAAA,eAAOH,SAAgB,CACpB,CAAC,eACN/B,MAAA,CAAAgB,OAAA,CAAAkB,aAAA,cACGP,eAAe,iBACd3B,MAAA,CAAAgB,OAAA,CAAAkB,aAAA;IACE,eAAa,sBAAsBR,IAAI,CAACU,EAAE,EAAG;IAC7CD,SAAS,EAAC,wDAAwD;IAClE,eAAY,MAAM;IAClBE,OAAO,EAAEA,CAAA,KAAMV,eAAe,CAACD,IAAI;EAAE,gBACrC1B,MAAA,CAAAgB,OAAA,CAAAkB,aAAA;IAAGC,SAAS,EAAC;EAAkB,CAAE,CAC9B,CACN,EACAP,cAAc,iBACb5B,MAAA,CAAAgB,OAAA,CAAAkB,aAAA;IACE,eAAa,YAAYR,IAAI,CAACU,EAAE,EAAG;IACnCD,SAAS,EAAC,0DAA0D;IACpE,eAAY,MAAM;IAClBE,OAAO,EAAEA,CAAA,KAAMT,cAAc,CAAC,CAACF,IAAI,CAACU,EAAE,CAAC;EAAE,gBACzCpC,MAAA,CAAAgB,OAAA,CAAAkB,aAAA;IAAGC,SAAS,EAAC;EAAoB,CAAE,CAChC,CAEJ,CACF,CAAC;AAEV,CAAC;AAEDV,OAAO,CAACa,SAAS,GAAG;EAClBZ,IAAI,EAAEa,kBAAS,CAACC,MAAM,CAACC;AACzB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3B,OAAA,GAEaS,OAAO","ignoreList":[]}
|
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Image = void 0;
|
|
9
|
-
require("core-js/modules/es.function.name.js");
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
var _button = _interopRequireDefault(require("@blaze-react/button"));
|
|
11
|
+
const Image = ({
|
|
12
|
+
url,
|
|
13
|
+
name,
|
|
14
|
+
children,
|
|
15
|
+
handleChangeFile,
|
|
16
|
+
showChangeButton
|
|
17
|
+
}) => /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
+
className: "preview"
|
|
19
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
className: "preview__file preview__file--image"
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
22
|
+
src: url,
|
|
23
|
+
alt: name
|
|
24
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: "preview__details preview__details--file"
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, /*#__PURE__*/_react.default.createElement("strong", null, "File details"), /*#__PURE__*/_react.default.createElement("a", {
|
|
27
|
+
href: url,
|
|
28
|
+
rel: "noopener noreferrer",
|
|
29
|
+
target: "_blank"
|
|
30
|
+
}, "Original")), showChangeButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
+
className: "preview__change-button"
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
33
|
+
onClick: handleChangeFile
|
|
34
|
+
}, "Change file")))), children);
|
|
35
|
+
exports.Image = Image;
|
|
31
36
|
Image.propTypes = {
|
|
32
|
-
url: _propTypes
|
|
33
|
-
name: _propTypes
|
|
34
|
-
children: _propTypes
|
|
37
|
+
url: _propTypes.default.string.isRequired,
|
|
38
|
+
name: _propTypes.default.string.isRequired,
|
|
39
|
+
children: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.node), _propTypes.default.node]).isRequired,
|
|
40
|
+
handleChangeFile: _propTypes.default.func,
|
|
41
|
+
showChangeButton: _propTypes.default.bool
|
|
42
|
+
};
|
|
43
|
+
Image.defaultProps = {
|
|
44
|
+
handleChangeFile: () => {},
|
|
45
|
+
showChangeButton: false
|
|
35
46
|
};
|
|
36
47
|
//# sourceMappingURL=Image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","names":["_react","_interopRequireDefault","require","_propTypes","Image","
|
|
1
|
+
{"version":3,"file":"Image.js","names":["_react","_interopRequireDefault","require","_propTypes","_button","Image","url","name","children","handleChangeFile","showChangeButton","default","createElement","className","src","alt","href","rel","target","onClick","exports","propTypes","PropTypes","string","isRequired","oneOfType","arrayOf","node","func","bool","defaultProps"],"sources":["../../../../src/components/FilePreview/Image/Image.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@blaze-react/button';\n\nconst Image = ({ url, name, children, handleChangeFile, showChangeButton }) => (\n <div className=\"preview\">\n <div className=\"preview__file preview__file--image\">\n <img src={url} alt={name} />\n <div className=\"preview__details preview__details--file\">\n <p>\n <strong>File details</strong>\n <a href={url} rel=\"noopener noreferrer\" target=\"_blank\">\n Original\n </a>\n </p>\n {showChangeButton && (\n <div className=\"preview__change-button\">\n <Button onClick={handleChangeFile}>Change file</Button>\n </div>\n )}\n </div>\n </div>\n {children}\n </div>\n);\n\nImage.propTypes = {\n url: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n handleChangeFile: PropTypes.func,\n showChangeButton: PropTypes.bool\n};\n\nImage.defaultProps = {\n handleCh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