@bindu-dashing/dam-solution-v2 5.8.6
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/README.md +53 -0
- package/build/AssetType/AddFieldProperties.d.ts +9 -0
- package/build/AssetType/AddFieldProperties.js +197 -0
- package/build/AssetType/AssetTemplatesTable.d.ts +10 -0
- package/build/AssetType/AssetTemplatesTable.js +153 -0
- package/build/AssetType/CreateAssetTemplate.d.ts +3 -0
- package/build/AssetType/CreateAssetTemplate.js +68 -0
- package/build/AssetType/CreateOrEditAssetTemplate.d.ts +1 -0
- package/build/AssetType/CreateOrEditAssetTemplate.js +77 -0
- package/build/AssetType/DraggedField.d.ts +14 -0
- package/build/AssetType/DraggedField.js +40 -0
- package/build/AssetType/EditAssetTemplate.d.ts +5 -0
- package/build/AssetType/EditAssetTemplate.js +179 -0
- package/build/AssetType/FieldsSection.d.ts +14 -0
- package/build/AssetType/FieldsSection.js +239 -0
- package/build/AssetType/assetTemplatesContainer.d.ts +2 -0
- package/build/AssetType/assetTemplatesContainer.js +71 -0
- package/build/AssetType/fieldProperties/DateField.d.ts +5 -0
- package/build/AssetType/fieldProperties/DateField.js +23 -0
- package/build/AssetType/fieldProperties/NumberField.d.ts +5 -0
- package/build/AssetType/fieldProperties/NumberField.js +91 -0
- package/build/AssetType/fieldProperties/OptionsField.d.ts +6 -0
- package/build/AssetType/fieldProperties/OptionsField.js +55 -0
- package/build/AssetType/fieldProperties/TextField.d.ts +5 -0
- package/build/AssetType/fieldProperties/TextField.js +92 -0
- package/build/AssetType/index.d.ts +11 -0
- package/build/AssetType/index.js +24 -0
- package/build/AssetType/routes.d.ts +3 -0
- package/build/AssetType/routes.js +17 -0
- package/build/BookView/ProductDescription.d.ts +4 -0
- package/build/BookView/ProductDescription.js +20 -0
- package/build/BookView/bookDetail.d.ts +4 -0
- package/build/BookView/bookDetail.js +106 -0
- package/build/BookView/bookInfo.d.ts +4 -0
- package/build/BookView/bookInfo.js +17 -0
- package/build/BookView/description.d.ts +4 -0
- package/build/BookView/description.js +5 -0
- package/build/BookView/index.d.ts +10 -0
- package/build/BookView/index.js +23 -0
- package/build/CreateClient/CreateClientBtn.d.ts +8 -0
- package/build/CreateClient/CreateClientBtn.js +12 -0
- package/build/CreateClient/CreateClientForm.d.ts +9 -0
- package/build/CreateClient/CreateClientForm.js +165 -0
- package/build/CreateClient/index.d.ts +14 -0
- package/build/CreateClient/index.js +18 -0
- package/build/ImagePicker/MetaFieldOptions.d.ts +14 -0
- package/build/ImagePicker/MetaFieldOptions.js +75 -0
- package/build/ImagePicker/TestImagePickerModal.d.ts +8 -0
- package/build/ImagePicker/TestImagePickerModal.js +61 -0
- package/build/ImagePicker/TestImgFromMetaData.d.ts +7 -0
- package/build/ImagePicker/TestImgFromMetaData.js +82 -0
- package/build/ImagePicker/imagePickerComponent.d.ts +6 -0
- package/build/ImagePicker/imagePickerComponent.js +63 -0
- package/build/ImagePicker/index.d.ts +13 -0
- package/build/ImagePicker/index.js +24 -0
- package/build/ImagePicker/routes.d.ts +6 -0
- package/build/ImagePicker/routes.js +17 -0
- package/build/ImagePickerFilters/ImagePickerFiltersComponent.d.ts +8 -0
- package/build/ImagePickerFilters/ImagePickerFiltersComponent.js +223 -0
- package/build/ImagePickerFilters/index.d.ts +12 -0
- package/build/ImagePickerFilters/index.js +19 -0
- package/build/MyDrive/ActionBar.d.ts +6 -0
- package/build/MyDrive/ActionBar.js +165 -0
- package/build/MyDrive/AddDrive.d.ts +3 -0
- package/build/MyDrive/AddDrive.js +169 -0
- package/build/MyDrive/AddFolder.d.ts +10 -0
- package/build/MyDrive/AddFolder.js +150 -0
- package/build/MyDrive/BreadCrumbList.d.ts +9 -0
- package/build/MyDrive/BreadCrumbList.js +86 -0
- package/build/MyDrive/BulkUploadModal.d.ts +2 -0
- package/build/MyDrive/BulkUploadModal.js +279 -0
- package/build/MyDrive/DriveContainer.d.ts +13 -0
- package/build/MyDrive/DriveContainer.js +276 -0
- package/build/MyDrive/FileDownloadHistory.d.ts +7 -0
- package/build/MyDrive/FileDownloadHistory.js +94 -0
- package/build/MyDrive/FileMenuOptions.d.ts +11 -0
- package/build/MyDrive/FileMenuOptions.js +397 -0
- package/build/MyDrive/FilesGridView.d.ts +9 -0
- package/build/MyDrive/FilesGridView.js +25 -0
- package/build/MyDrive/FolderGridView.d.ts +19 -0
- package/build/MyDrive/FolderGridView.js +91 -0
- package/build/MyDrive/FolderListView.d.ts +25 -0
- package/build/MyDrive/FolderListView.js +188 -0
- package/build/MyDrive/FolderMenuOptions.d.ts +5 -0
- package/build/MyDrive/FolderMenuOptions.js +350 -0
- package/build/MyDrive/FolderTree.d.ts +8 -0
- package/build/MyDrive/FolderTree.js +342 -0
- package/build/MyDrive/ImageEditor/EditImage.d.ts +6 -0
- package/build/MyDrive/ImageEditor/EditImage.js +97 -0
- package/build/MyDrive/ImageEditor/EditImageModal.d.ts +8 -0
- package/build/MyDrive/ImageEditor/EditImageModal.js +30 -0
- package/build/MyDrive/ImageEditor/TuiImageEditor.d.ts +10 -0
- package/build/MyDrive/ImageEditor/TuiImageEditor.js +99 -0
- package/build/MyDrive/ImagePickerBreadCrumbList.d.ts +8 -0
- package/build/MyDrive/ImagePickerBreadCrumbList.js +35 -0
- package/build/MyDrive/ImagePickerDrive.d.ts +1 -0
- package/build/MyDrive/ImagePickerDrive.js +41 -0
- package/build/MyDrive/MyDriveMainContainer.d.ts +1 -0
- package/build/MyDrive/MyDriveMainContainer.js +32 -0
- package/build/MyDrive/SearchFilter.d.ts +8 -0
- package/build/MyDrive/SearchFilter.js +73 -0
- package/build/MyDrive/ShareBtn.d.ts +5 -0
- package/build/MyDrive/ShareBtn.js +19 -0
- package/build/MyDrive/ToggleView.d.ts +4 -0
- package/build/MyDrive/ToggleView.js +12 -0
- package/build/MyDrive/UploadStatusModal.d.ts +12 -0
- package/build/MyDrive/UploadStatusModal.js +40 -0
- package/build/MyDrive/fileDetails/CommentEntity.d.ts +8 -0
- package/build/MyDrive/fileDetails/CommentEntity.js +102 -0
- package/build/MyDrive/fileDetails/Comments.d.ts +6 -0
- package/build/MyDrive/fileDetails/Comments.js +65 -0
- package/build/MyDrive/fileDetails/Compliance.d.ts +2 -0
- package/build/MyDrive/fileDetails/Compliance.js +18 -0
- package/build/MyDrive/fileDetails/CreateComment.d.ts +7 -0
- package/build/MyDrive/fileDetails/CreateComment.js +48 -0
- package/build/MyDrive/fileDetails/Editor.d.ts +6 -0
- package/build/MyDrive/fileDetails/Editor.js +55 -0
- package/build/MyDrive/fileDetails/EmojiPicker.d.ts +5 -0
- package/build/MyDrive/fileDetails/EmojiPicker.js +6 -0
- package/build/MyDrive/fileDetails/FileDetails.d.ts +10 -0
- package/build/MyDrive/fileDetails/FileDetails.js +78 -0
- package/build/MyDrive/fileDetails/FileHeader.d.ts +7 -0
- package/build/MyDrive/fileDetails/FileHeader.js +25 -0
- package/build/MyDrive/fileDetails/FileViewer.d.ts +10 -0
- package/build/MyDrive/fileDetails/FileViewer.js +31 -0
- package/build/MyDrive/fileDetails/ImageOptions.d.ts +2 -0
- package/build/MyDrive/fileDetails/ImageOptions.js +44 -0
- package/build/MyDrive/fileDetails/ImageViewer.d.ts +5 -0
- package/build/MyDrive/fileDetails/ImageViewer.js +16 -0
- package/build/MyDrive/fileDetails/ManageFile.d.ts +7 -0
- package/build/MyDrive/fileDetails/ManageFile.js +34 -0
- package/build/MyDrive/fileDetails/MetaForm.d.ts +15 -0
- package/build/MyDrive/fileDetails/MetaForm.js +195 -0
- package/build/MyDrive/fileDetails/Metadata.d.ts +8 -0
- package/build/MyDrive/fileDetails/Metadata.js +52 -0
- package/build/MyDrive/fileDetails/PdfOptions.d.ts +9 -0
- package/build/MyDrive/fileDetails/PdfOptions.js +35 -0
- package/build/MyDrive/fileDetails/PdfViewer.d.ts +8 -0
- package/build/MyDrive/fileDetails/PdfViewer.js +18 -0
- package/build/MyDrive/fileDetails/Previewdetails.d.ts +9 -0
- package/build/MyDrive/fileDetails/Previewdetails.js +53 -0
- package/build/MyDrive/fileDetails/VideoPlayer.d.ts +4 -0
- package/build/MyDrive/fileDetails/VideoPlayer.js +21 -0
- package/build/MyDrive/files/AssetSelectionFormItem.d.ts +7 -0
- package/build/MyDrive/files/AssetSelectionFormItem.js +14 -0
- package/build/MyDrive/files/FolderTabs.d.ts +6 -0
- package/build/MyDrive/files/FolderTabs.js +83 -0
- package/build/MyDrive/files/MapFile.d.ts +8 -0
- package/build/MyDrive/files/MapFile.js +217 -0
- package/build/MyDrive/files/MoveToAnotherFolder.d.ts +9 -0
- package/build/MyDrive/files/MoveToAnotherFolder.js +53 -0
- package/build/MyDrive/filesListView.d.ts +2 -0
- package/build/MyDrive/filesListView.js +57 -0
- package/build/MyDrive/index.d.ts +10 -0
- package/build/MyDrive/index.js +35 -0
- package/build/MyDrive/routes.d.ts +7 -0
- package/build/MyDrive/routes.js +17 -0
- package/build/PenView/PenDetails.d.ts +4 -0
- package/build/PenView/PenDetails.js +114 -0
- package/build/PenView/ProductDescription.d.ts +5 -0
- package/build/PenView/ProductDescription.js +51 -0
- package/build/PenView/index.d.ts +10 -0
- package/build/PenView/index.js +23 -0
- package/build/RefreshKey/RefreshKeyBtn.d.ts +1 -0
- package/build/RefreshKey/RefreshKeyBtn.js +42 -0
- package/build/RefreshKey/index.d.ts +9 -0
- package/build/RefreshKey/index.js +23 -0
- package/build/ShoesView/ProductDescription.d.ts +4 -0
- package/build/ShoesView/ProductDescription.js +25 -0
- package/build/ShoesView/ShoeDetails.d.ts +4 -0
- package/build/ShoesView/ShoeDetails.js +96 -0
- package/build/ShoesView/index.d.ts +10 -0
- package/build/ShoesView/index.js +23 -0
- package/build/common/Button.d.ts +2 -0
- package/build/common/Button.js +18 -0
- package/build/common/CustomElements.d.ts +98 -0
- package/build/common/CustomElements.js +77 -0
- package/build/common/LoadMoreItems.d.ts +7 -0
- package/build/common/LoadMoreItems.js +33 -0
- package/build/common/RenderFormItem.d.ts +42 -0
- package/build/common/RenderFormItem.js +98 -0
- package/build/common/RenderThumnail.d.ts +7 -0
- package/build/common/RenderThumnail.js +6 -0
- package/build/common/deleteModal.d.ts +1 -0
- package/build/common/deleteModal.js +12 -0
- package/build/common/folders/TypeAndDateFilters.d.ts +10 -0
- package/build/common/folders/TypeAndDateFilters.js +59 -0
- package/build/common/folders/getFolderOrFileIcon.d.ts +2 -0
- package/build/common/folders/getFolderOrFileIcon.js +41 -0
- package/build/common/loader/CustomLoader.d.ts +7 -0
- package/build/common/loader/CustomLoader.js +8 -0
- package/build/common/loader/loader.d.ts +1 -0
- package/build/common/loader/loader.js +6 -0
- package/build/common/notifications.d.ts +2 -0
- package/build/common/notifications.js +30 -0
- package/build/common/steps.d.ts +4 -0
- package/build/common/steps.js +7 -0
- package/build/hocs/AppProvider.d.ts +3 -0
- package/build/hocs/AppProvider.js +11 -0
- package/build/hocs/DamConfigContext.d.ts +2 -0
- package/build/hocs/DamConfigContext.js +108 -0
- package/build/hocs/ThemeContext.d.ts +15 -0
- package/build/hocs/ThemeContext.js +131 -0
- package/build/hocs/ToastProvider.d.ts +2 -0
- package/build/hocs/ToastProvider.js +6 -0
- package/build/hocs/appConstants.d.ts +124 -0
- package/build/hocs/appConstants.js +211 -0
- package/build/hocs/configureAxios.d.ts +2 -0
- package/build/hocs/configureAxios.js +65 -0
- package/build/hocs/helpers.d.ts +15 -0
- package/build/hocs/helpers.js +177 -0
- package/build/index.d.ts +11 -0
- package/build/index.js +11 -0
- package/build/react-query/hooks/brand-hooks.d.ts +3 -0
- package/build/react-query/hooks/brand-hooks.js +10 -0
- package/build/react-query/hooks/folder-hooks.d.ts +7 -0
- package/build/react-query/hooks/folder-hooks.js +119 -0
- package/build/react-query/services/brand-services.d.ts +3 -0
- package/build/react-query/services/brand-services.js +30 -0
- package/build/react-query/services/file-services.d.ts +43 -0
- package/build/react-query/services/file-services.js +69 -0
- package/build/react-query/services/folder-services.d.ts +44 -0
- package/build/react-query/services/folder-services.js +87 -0
- package/build/react-query/services/image-picker-services.d.ts +5 -0
- package/build/react-query/services/image-picker-services.js +48 -0
- package/build/settings/InviteTeamModal.d.ts +12 -0
- package/build/settings/InviteTeamModal.js +174 -0
- package/build/settings/UpdateInvitationAccessType.d.ts +9 -0
- package/build/settings/UpdateInvitationAccessType.js +96 -0
- package/build/settings/getUserAvatar.d.ts +7 -0
- package/build/settings/getUserAvatar.js +11 -0
- package/build/style.css +1 -0
- package/build/types/assetType.d.ts +8 -0
- package/build/types/assetType.js +1 -0
- package/build/ui/pageTitle.d.ts +3 -0
- package/build/ui/pageTitle.js +4 -0
- package/build/utilities/FoldersContext.d.ts +14 -0
- package/build/utilities/FoldersContext.js +10 -0
- package/build/utilities/NavigatorProvider.d.ts +2 -0
- package/build/utilities/NavigatorProvider.js +10 -0
- package/build/utilities/constants/apiUrls.d.ts +95 -0
- package/build/utilities/constants/apiUrls.js +115 -0
- package/build/utilities/constants/imageUrls.d.ts +6 -0
- package/build/utilities/constants/imageUrls.js +6 -0
- package/build/utilities/constants/interface.d.ts +371 -0
- package/build/utilities/constants/interface.js +142 -0
- package/build/utilities/constants/messages.d.ts +54 -0
- package/build/utilities/constants/messages.js +54 -0
- package/build/utilities/constants/queryKeys.d.ts +16 -0
- package/build/utilities/constants/queryKeys.js +33 -0
- package/build/utilities/constants/routes.d.ts +22 -0
- package/build/utilities/constants/routes.js +22 -0
- package/build/utilities/helpers/validators.d.ts +12 -0
- package/build/utilities/helpers/validators.js +89 -0
- package/build/utilities/useAppNavigate.d.ts +2 -0
- package/build/utilities/useAppNavigate.js +19 -0
- package/build/utilities/useAppParams.d.ts +6 -0
- package/build/utilities/useAppParams.js +27 -0
- package/package.json +93 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dropdown } from "antd";
|
|
3
|
+
import { BsThreeDotsVertical } from "react-icons/bs";
|
|
4
|
+
import { IoArchiveOutline, IoDuplicateOutline } from "react-icons/io5";
|
|
5
|
+
import { TbStar, TbStarOff } from "react-icons/tb";
|
|
6
|
+
import { DeleteOutlined, EditOutlined, EyeOutlined, InfoCircleOutlined, UserAddOutlined, } from "@ant-design/icons";
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
import { DriveModes, NotificationStatus, } from "../utilities/constants/interface";
|
|
9
|
+
import { concat, difference, filter, first, get, includes, join, map, } from "lodash";
|
|
10
|
+
import { showNotification } from "../common/notifications";
|
|
11
|
+
import CustomLoader from "../common/loader/CustomLoader";
|
|
12
|
+
import { DownloadOutlined, } from "@ant-design/icons";
|
|
13
|
+
import AddFolder from "./AddFolder";
|
|
14
|
+
import { useMutation, useQueryClient } from "react-query";
|
|
15
|
+
import { archiveFiles, deleteFiles, downloadFiles, duplicateFiles, restoreFiles, unarchiveFiles, } from "../react-query/services/file-services";
|
|
16
|
+
import { ADDED_TO_FAV_MSG, ARCHIVE_OK_TEXT, ARCHIVE_SUCCESS, CREATE_SUCCESS, DELETE_CONFIRMATION_MESSAGE, DELETE_MESSAGE_DESCRIPTION, DELETE_OK_TEXT, DELETE_SUCCESS, INVALID_URL, REMOVED_FROM_FAV_MSG, RESTORE_SUCCESS, SOMETHING_WENT_WRONG, } from "../utilities/constants/messages";
|
|
17
|
+
import { getSelectedFiles, } from "../react-query/hooks/folder-hooks";
|
|
18
|
+
import { generateFoldersQueryKey, invalidateData, QueryKeys, } from "../utilities/constants/queryKeys";
|
|
19
|
+
import { DeleteConfirmationModal } from "../common/CustomElements";
|
|
20
|
+
import { addToFavFolders, removeFromFavFolders, } from "../react-query/services/folder-services";
|
|
21
|
+
import { MdDriveFileMoveOutline, MdOutlineUnarchive } from "react-icons/md";
|
|
22
|
+
import FileDetails from "./fileDetails/FileDetails";
|
|
23
|
+
import MoveToAnotherFolder from "./files/MoveToAnotherFolder";
|
|
24
|
+
import { AllowedFileActions, BulkRestrictedActions, DEFAULT_PAGE, FileActionsList, MyDriveFileActions, SingleFileRestrictedActions, } from "../hocs/appConstants";
|
|
25
|
+
import InviteTeamModal from "../settings/InviteTeamModal";
|
|
26
|
+
import { FETCH_ENTITY_SCREEN } from "../utilities/constants/routes";
|
|
27
|
+
import ManageFile from "./fileDetails/ManageFile";
|
|
28
|
+
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
29
|
+
import { createApiClient } from "../hocs/configureAxios";
|
|
30
|
+
import useAppParams from "../utilities/useAppParams";
|
|
31
|
+
import { AiOutlineHistory } from "react-icons/ai";
|
|
32
|
+
import FileDownloadHistory from "./FileDownloadHistory";
|
|
33
|
+
const TbStarOffIcon = TbStarOff;
|
|
34
|
+
const IoDuplicateOutlineIcon = IoDuplicateOutline;
|
|
35
|
+
const MdDriveFileMoveOutlineIcon = MdDriveFileMoveOutline;
|
|
36
|
+
const IoArchiveOutlineIcon = IoArchiveOutline;
|
|
37
|
+
const MdOutlineUnarchiveIcon = MdOutlineUnarchive;
|
|
38
|
+
const TbStarIcon = TbStar;
|
|
39
|
+
const BsThreeDotsVerticalIcon = BsThreeDotsVertical;
|
|
40
|
+
const AiOutlineHistoryIcon = AiOutlineHistory;
|
|
41
|
+
function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSelection, readOnly = false, fileModal = false, }) {
|
|
42
|
+
const damConfig = useDamConfig();
|
|
43
|
+
const { rootFolderId, appType, isAdmin } = damConfig;
|
|
44
|
+
const { folderId, type } = useAppParams();
|
|
45
|
+
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
46
|
+
const queryClient = useQueryClient();
|
|
47
|
+
const isBulkAction = useMemo(() => !!get(folderIds, "length", 0) || !!get(fileIds, "length", 0), [folderIds, fileIds]);
|
|
48
|
+
const isMultiSelection = useMemo(() => get(folderIds, "length", 0) + get(fileIds, "length", 0) > DEFAULT_PAGE, [folderIds, fileIds]);
|
|
49
|
+
const [state, setState] = useState({
|
|
50
|
+
loading: false,
|
|
51
|
+
displayUpdateName: false,
|
|
52
|
+
actionType: "",
|
|
53
|
+
showConfirmModal: false,
|
|
54
|
+
showPreviewModal: false,
|
|
55
|
+
showMoveFolder: false,
|
|
56
|
+
showShareModal: false,
|
|
57
|
+
showFileAccess: false,
|
|
58
|
+
showLogsModal: false,
|
|
59
|
+
});
|
|
60
|
+
const { loading, displayUpdateName, showConfirmModal, actionType, showPreviewModal, showMoveFolder, showShareModal, showFileAccess, showLogsModal, } = state;
|
|
61
|
+
const toggleLogsModal = () => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showLogsModal: !prevState.showLogsModal })));
|
|
62
|
+
const toggleFileAccess = () => {
|
|
63
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showFileAccess: !prevState.showFileAccess })));
|
|
64
|
+
};
|
|
65
|
+
const fileLinks = useMemo(() => {
|
|
66
|
+
return map(fileIds, (id) => `${appType == "reactJs"
|
|
67
|
+
? process.env.REACT_APP_MIXDRIVE_SITE_URL
|
|
68
|
+
: process.env.NEXT_PUBLIC_MIXDRIVE_SITE_URL}` +
|
|
69
|
+
FETCH_ENTITY_SCREEN.replace(":type", DriveModes.FILE).replace(":id", id));
|
|
70
|
+
}, [fileIds]);
|
|
71
|
+
const folderLinks = useMemo(() => {
|
|
72
|
+
return map(folderIds, (id) => `${appType == "reactJs"
|
|
73
|
+
? process.env.REACT_APP_MIXDRIVE_SITE_URL
|
|
74
|
+
: process.env.NEXT_PUBLIC_MIXDRIVE_SITE_URL}` +
|
|
75
|
+
FETCH_ENTITY_SCREEN.replace(":type", DriveModes.FOLDERS).replace(":id", id));
|
|
76
|
+
}, [folderIds]);
|
|
77
|
+
const link = useMemo(() => {
|
|
78
|
+
if (get(concat(fileLinks, folderLinks), "length")) {
|
|
79
|
+
return get(concat(fileLinks, folderLinks), "length") > 1
|
|
80
|
+
? join(concat(fileLinks, folderLinks), ", ")
|
|
81
|
+
: first(concat(fileLinks, folderLinks));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return (`${appType == "reactJs"
|
|
85
|
+
? process.env.REACT_APP_MIXDRIVE_SITE_URL
|
|
86
|
+
: process.env.NEXT_PUBLIC_MIXDRIVE_SITE_URL}` +
|
|
87
|
+
FETCH_ENTITY_SCREEN.replace(":type", DriveModes.FILE).replace(":id", get(file, "_id")));
|
|
88
|
+
}
|
|
89
|
+
}, [fileLinks, folderLinks, file]);
|
|
90
|
+
const toggleShareModal = () => {
|
|
91
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showShareModal: !prevState.showShareModal })));
|
|
92
|
+
};
|
|
93
|
+
const toggleShowPreviewModal = () => {
|
|
94
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showPreviewModal: !prevState.showPreviewModal })));
|
|
95
|
+
};
|
|
96
|
+
const toggleShowMoveFolder = () => {
|
|
97
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showMoveFolder: !prevState.showMoveFolder })));
|
|
98
|
+
};
|
|
99
|
+
const toggleConfirmPopup = (actionType = "") => {
|
|
100
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { actionType, showConfirmModal: !prevState.showConfirmModal })));
|
|
101
|
+
};
|
|
102
|
+
const toggleDisplayUpdateName = () => {
|
|
103
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false, displayUpdateName: !prevState.displayUpdateName })));
|
|
104
|
+
};
|
|
105
|
+
const onFailure = (message) => {
|
|
106
|
+
showNotification(message, NotificationStatus.ERROR);
|
|
107
|
+
};
|
|
108
|
+
const onDeleteSuccess = (message) => {
|
|
109
|
+
invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
|
|
110
|
+
showNotification(message, NotificationStatus.SUCCESS);
|
|
111
|
+
onCloseSelection === null || onCloseSelection === void 0 ? void 0 : onCloseSelection();
|
|
112
|
+
};
|
|
113
|
+
const deleteFileMutation = useMutation({
|
|
114
|
+
mutationFn: deleteFiles,
|
|
115
|
+
onSuccess: (response) => {
|
|
116
|
+
toggleConfirmPopup();
|
|
117
|
+
onDeleteSuccess(get(response, "data.message", DELETE_SUCCESS));
|
|
118
|
+
},
|
|
119
|
+
onError: (error) => {
|
|
120
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
const onDeleteFile = () => {
|
|
124
|
+
deleteFileMutation.mutate({
|
|
125
|
+
fileIds: [get(file, "_id")],
|
|
126
|
+
folderIds: [],
|
|
127
|
+
api,
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const archiveFileMutation = useMutation({
|
|
131
|
+
mutationFn: archiveFiles,
|
|
132
|
+
onSuccess: (response) => {
|
|
133
|
+
toggleConfirmPopup();
|
|
134
|
+
onDeleteSuccess(get(response, "data.message", ARCHIVE_SUCCESS));
|
|
135
|
+
},
|
|
136
|
+
onError: (error) => {
|
|
137
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
const onArchiveFile = () => {
|
|
141
|
+
archiveFileMutation.mutate({
|
|
142
|
+
fileIds: file ? [get(file, "_id")] : fileIds,
|
|
143
|
+
folderIds,
|
|
144
|
+
api,
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const favouriteFileMutation = useMutation({
|
|
148
|
+
mutationFn: addToFavFolders,
|
|
149
|
+
onSuccess: (response) => {
|
|
150
|
+
onFavSuccess(get(response, "data.message", ADDED_TO_FAV_MSG));
|
|
151
|
+
},
|
|
152
|
+
onError: (error) => {
|
|
153
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
const onFavouriteFile = () => {
|
|
157
|
+
favouriteFileMutation.mutate({
|
|
158
|
+
payload: {
|
|
159
|
+
fileIds: file ? [get(file, "_id")] : fileIds,
|
|
160
|
+
folderIds,
|
|
161
|
+
},
|
|
162
|
+
api,
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
const duplicateFileMutation = useMutation({
|
|
166
|
+
mutationFn: duplicateFiles,
|
|
167
|
+
onSuccess: (response) => {
|
|
168
|
+
invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
|
|
169
|
+
showNotification(get(response, "data.message", CREATE_SUCCESS), NotificationStatus.SUCCESS);
|
|
170
|
+
},
|
|
171
|
+
onError: (error) => {
|
|
172
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
const onDuplicateFile = () => {
|
|
176
|
+
duplicateFileMutation.mutate({
|
|
177
|
+
fileIds: [get(file, "_id")],
|
|
178
|
+
api,
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
const downloadFileMutation = useMutation({
|
|
182
|
+
mutationFn: downloadFiles,
|
|
183
|
+
onSuccess: (response) => {
|
|
184
|
+
const url = get(response, "data");
|
|
185
|
+
if (url) {
|
|
186
|
+
window.open(url, "_blank");
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
onFailure(INVALID_URL);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
onError: (error) => {
|
|
193
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
const onDownloadFile = () => {
|
|
197
|
+
// downloadFileMutation.mutate({
|
|
198
|
+
// fileIds: [get(file, "_id")!],
|
|
199
|
+
// folderIds: [],
|
|
200
|
+
// api,
|
|
201
|
+
// });
|
|
202
|
+
window.open(get(file, "downloadUrl", ""));
|
|
203
|
+
};
|
|
204
|
+
const onFavSuccess = (message) => {
|
|
205
|
+
invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
|
|
206
|
+
invalidateData(queryClient, QueryKeys.FILE, get(file, "_id"));
|
|
207
|
+
showNotification(message, NotificationStatus.SUCCESS);
|
|
208
|
+
onCloseSelection === null || onCloseSelection === void 0 ? void 0 : onCloseSelection();
|
|
209
|
+
};
|
|
210
|
+
const removeFavFileMutation = useMutation({
|
|
211
|
+
mutationFn: removeFromFavFolders,
|
|
212
|
+
onSuccess: (response) => {
|
|
213
|
+
onFavSuccess(get(response, "data.message", REMOVED_FROM_FAV_MSG));
|
|
214
|
+
},
|
|
215
|
+
onError: (error) => {
|
|
216
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
const onUnStarFile = () => {
|
|
220
|
+
removeFavFileMutation.mutate({
|
|
221
|
+
payload: {
|
|
222
|
+
fileIds: file ? [get(file, "_id")] : fileIds,
|
|
223
|
+
folderIds,
|
|
224
|
+
},
|
|
225
|
+
api,
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
const restoreFileMutation = useMutation({
|
|
229
|
+
mutationFn: restoreFiles,
|
|
230
|
+
onSuccess: (response) => {
|
|
231
|
+
onDeleteSuccess(get(response, "data.message", RESTORE_SUCCESS));
|
|
232
|
+
},
|
|
233
|
+
onError: (error) => {
|
|
234
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
const onRestoreFile = () => {
|
|
238
|
+
restoreFileMutation.mutate({
|
|
239
|
+
fileIds: [get(file, "_id")],
|
|
240
|
+
folderIds: [],
|
|
241
|
+
api,
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
const unarchiveFileMutation = useMutation({
|
|
245
|
+
mutationFn: unarchiveFiles,
|
|
246
|
+
onSuccess: (response) => {
|
|
247
|
+
onDeleteSuccess(get(response, "data.message", RESTORE_SUCCESS));
|
|
248
|
+
},
|
|
249
|
+
onError: (error) => {
|
|
250
|
+
onFailure(get(error, "message", SOMETHING_WENT_WRONG));
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
const onUnArchiveFile = () => {
|
|
254
|
+
unarchiveFileMutation.mutate({
|
|
255
|
+
fileIds: file ? [get(file, "_id")] : fileIds,
|
|
256
|
+
folderIds: folderIds,
|
|
257
|
+
api,
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
const favItems = [
|
|
261
|
+
{
|
|
262
|
+
key: FileActionsList.UNSTAR,
|
|
263
|
+
label: "Unstar",
|
|
264
|
+
icon: removeFavFileMutation.isLoading ? (_jsx(CustomLoader, {})) : (_jsx(TbStarOffIcon, {})),
|
|
265
|
+
onClick: () => onUnStarFile(),
|
|
266
|
+
},
|
|
267
|
+
];
|
|
268
|
+
const shareItem = isAdmin
|
|
269
|
+
? [
|
|
270
|
+
{
|
|
271
|
+
key: FileActionsList.SHARE,
|
|
272
|
+
label: "Share",
|
|
273
|
+
icon: _jsx(UserAddOutlined, {}),
|
|
274
|
+
onClick: toggleShareModal,
|
|
275
|
+
},
|
|
276
|
+
]
|
|
277
|
+
: [];
|
|
278
|
+
const adminItems = isAdmin
|
|
279
|
+
? [
|
|
280
|
+
{
|
|
281
|
+
key: FileActionsList.RENAME,
|
|
282
|
+
label: "Rename",
|
|
283
|
+
icon: _jsx(EditOutlined, {}),
|
|
284
|
+
onClick: () => toggleDisplayUpdateName(),
|
|
285
|
+
disabled: isMultiSelection || !isAdmin,
|
|
286
|
+
},
|
|
287
|
+
// {
|
|
288
|
+
// key: FileActionsList.DUPLICATE,
|
|
289
|
+
// label: "Duplicate",
|
|
290
|
+
// icon: duplicateFileMutation.isLoading ? (
|
|
291
|
+
// <CustomLoader />
|
|
292
|
+
// ) : (
|
|
293
|
+
// <IoDuplicateOutlineIcon />
|
|
294
|
+
// ),
|
|
295
|
+
// onClick: () => onDuplicateFile(),
|
|
296
|
+
// disabled: isMultiSelection || !isAdmin,
|
|
297
|
+
// },
|
|
298
|
+
{
|
|
299
|
+
key: FileActionsList.DELETE,
|
|
300
|
+
label: "Delete",
|
|
301
|
+
icon: deleteFileMutation.isLoading ? (_jsx(CustomLoader, {})) : (_jsx(DeleteOutlined, {})),
|
|
302
|
+
onClick: () => toggleConfirmPopup("delete"),
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
key: FileActionsList.SHOW_DOWNLOADS,
|
|
306
|
+
label: "Download history",
|
|
307
|
+
icon: _jsx(AiOutlineHistoryIcon, {}),
|
|
308
|
+
onClick: toggleLogsModal,
|
|
309
|
+
},
|
|
310
|
+
]
|
|
311
|
+
: [];
|
|
312
|
+
const items = [
|
|
313
|
+
{
|
|
314
|
+
key: FileActionsList.PREVIEW,
|
|
315
|
+
label: "View",
|
|
316
|
+
icon: _jsx(EyeOutlined, {}),
|
|
317
|
+
onClick: () => toggleShowPreviewModal(),
|
|
318
|
+
disabled: !!get(folderIds, "length"),
|
|
319
|
+
},
|
|
320
|
+
// {
|
|
321
|
+
// key: FileActionsList.COPY,
|
|
322
|
+
// label: "Copy",
|
|
323
|
+
// icon: loading ? <CustomLoader /> : <LinkOutlined />,
|
|
324
|
+
// onClick: () => handleCopy(link!),
|
|
325
|
+
// },
|
|
326
|
+
{
|
|
327
|
+
key: FileActionsList.DOWNLOAD,
|
|
328
|
+
label: "Download",
|
|
329
|
+
icon: downloadFileMutation.isLoading ? (_jsx(CustomLoader, {})) : (_jsx(DownloadOutlined, {})),
|
|
330
|
+
onClick: onDownloadFile,
|
|
331
|
+
},
|
|
332
|
+
...adminItems,
|
|
333
|
+
// {
|
|
334
|
+
// key: FileActionsList.MOVE,
|
|
335
|
+
// label: "Move",
|
|
336
|
+
// icon: <MdDriveFileMoveOutlineIcon />,
|
|
337
|
+
// onClick: () => toggleShowMoveFolder(),
|
|
338
|
+
// },
|
|
339
|
+
// {
|
|
340
|
+
// key: FileActionsList.ARCHIVE,
|
|
341
|
+
// label: "Archive",
|
|
342
|
+
// icon: <IoArchiveOutlineIcon />,
|
|
343
|
+
// onClick: () => toggleConfirmPopup("archive"),
|
|
344
|
+
// },
|
|
345
|
+
// {
|
|
346
|
+
// key: FileActionsList.UNARCHIVE,
|
|
347
|
+
// label: "Unarchive",
|
|
348
|
+
// icon: unarchiveFileMutation.isLoading ? (
|
|
349
|
+
// <CustomLoader />
|
|
350
|
+
// ) : (
|
|
351
|
+
// <MdOutlineUnarchiveIcon />
|
|
352
|
+
// ),
|
|
353
|
+
// onClick: () => onUnArchiveFile(),
|
|
354
|
+
// },
|
|
355
|
+
// ...(get(file, "isFavourite") || type === DriveModes.STARRED
|
|
356
|
+
// ? favItems
|
|
357
|
+
// : ([
|
|
358
|
+
// {
|
|
359
|
+
// key: FileActionsList.STAR,
|
|
360
|
+
// label: "Add to starred",
|
|
361
|
+
// icon: favouriteFileMutation.isLoading ? (
|
|
362
|
+
// <CustomLoader />
|
|
363
|
+
// ) : (
|
|
364
|
+
// <TbStarIcon />
|
|
365
|
+
// ),
|
|
366
|
+
// onClick: () => onFavouriteFile(),
|
|
367
|
+
// },
|
|
368
|
+
// ] as any)),
|
|
369
|
+
{
|
|
370
|
+
key: FileActionsList.FILE_INFO,
|
|
371
|
+
label: "File information",
|
|
372
|
+
icon: _jsx(InfoCircleOutlined, {}),
|
|
373
|
+
disabled: isMultiSelection,
|
|
374
|
+
onClick: toggleFileAccess,
|
|
375
|
+
},
|
|
376
|
+
// {
|
|
377
|
+
// key: FileActionsList.RESTORE,
|
|
378
|
+
// label: "Restore",
|
|
379
|
+
// icon: restoreFileMutation.isLoading ? <CustomLoader /> : <RedoOutlined />,
|
|
380
|
+
// onClick: () => onRestoreFile(),
|
|
381
|
+
// },
|
|
382
|
+
];
|
|
383
|
+
const filterActions = (menuItems, allowedActions = MyDriveFileActions) => filter(menuItems, (item) => includes(fileModal
|
|
384
|
+
? difference(allowedActions, SingleFileRestrictedActions)
|
|
385
|
+
: isBulkAction
|
|
386
|
+
? difference(allowedActions, BulkRestrictedActions)
|
|
387
|
+
: allowedActions, item === null || item === void 0 ? void 0 : item.key));
|
|
388
|
+
const currentMenuItems = useMemo(() => {
|
|
389
|
+
return filterActions(items, get(AllowedFileActions, type));
|
|
390
|
+
}, [type, items, isBulkAction]);
|
|
391
|
+
return (_jsxs(_Fragment, { children: [_jsx(Dropdown, { menu: { items: currentMenuItems }, trigger: ["click"], disabled: readOnly, children: _jsx(BsThreeDotsVerticalIcon, { size: 20, className: readOnly
|
|
392
|
+
? "md-lib-cursor-not-allowed md-lib-text-disabledBtnColor dark:md-lib-text-darkBorderColor"
|
|
393
|
+
: "md-lib-cursor-pointer", onClick: (e) => e.stopPropagation() }) }), displayUpdateName && (!!file || !!folder) && (_jsx(AddFolder, { file: file, open: displayUpdateName, handleCancel: toggleDisplayUpdateName, folder: folder, onCloseSelection: onCloseSelection, fileModal: fileModal })), _jsx(DeleteConfirmationModal, { showDeleteModal: showConfirmModal, toggleDeleteModal: toggleConfirmPopup, icon: actionType === "archive" ? (_jsx(IoArchiveOutlineIcon, {})) : (_jsx(DeleteOutlined, {})), okText: actionType === "archive" ? ARCHIVE_OK_TEXT : DELETE_OK_TEXT, description: isMultiSelection
|
|
394
|
+
? DELETE_CONFIRMATION_MESSAGE.replace(":action", actionType).replace(" :entity", "")
|
|
395
|
+
: DELETE_CONFIRMATION_MESSAGE.replace(":action", actionType).replace(":entity", get(file, "name", "this file")), onOk: actionType === "archive" ? onArchiveFile : onDeleteFile, subHeading: actionType === "archive" ? "" : DELETE_MESSAGE_DESCRIPTION, loading: deleteFileMutation.isLoading || archiveFileMutation.isLoading }), showPreviewModal && (_jsx(FileDetails, { open: showPreviewModal, handleClose: toggleShowPreviewModal, file: file, files: getSelectedFiles(queryClient, folderId ? folderId : rootFolderId, generateFoldersQueryKey(type), fileIds), onCloseSelection: onCloseSelection })), showMoveFolder && (_jsx(MoveToAnotherFolder, { open: showMoveFolder, handleCancel: toggleShowMoveFolder, fileIds: [get(file, "_id")], entity: file, onCloseSelection: onCloseSelection })), showShareModal && (_jsx(InviteTeamModal, { open: showShareModal, onClose: toggleShareModal, onFetchInvitations: () => { }, shareModal: true, fileIds: file ? [get(file, "_id")] : fileIds, folderIds: folderIds, inviteType: DriveModes.FILE, file: file })), showFileAccess && (file || folder) && (_jsx(ManageFile, { open: showFileAccess, onClose: toggleFileAccess, file: file ? file : folder })), showLogsModal && (_jsx(FileDownloadHistory, { file: file ? file : folder, open: showLogsModal, onClose: toggleLogsModal }))] }));
|
|
396
|
+
}
|
|
397
|
+
export default FileMenuOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FileEntity } from "../utilities/constants/interface";
|
|
2
|
+
declare const FilesGridView: ({ files, handleClick, selectedFileIds, isImagePicker, selectedPickerFile, }: {
|
|
3
|
+
files: FileEntity[];
|
|
4
|
+
handleClick: (file: FileEntity) => void;
|
|
5
|
+
selectedFileIds: string[];
|
|
6
|
+
isImagePicker?: boolean;
|
|
7
|
+
selectedPickerFile?: FileEntity;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
export default FilesGridView;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DriveModes, ThumbnailStatus, } from "../utilities/constants/interface";
|
|
3
|
+
import _, { get, includes } from "lodash";
|
|
4
|
+
import { getFileOrFolderIcon } from "../common/folders/getFolderOrFileIcon";
|
|
5
|
+
import FileMenuOptions from "./FileMenuOptions";
|
|
6
|
+
import { GrInProgress } from "react-icons/gr";
|
|
7
|
+
import useAppParams from "../utilities/useAppParams";
|
|
8
|
+
import { UPLOAD_FILE_IN_PROGRESS_WHITE_IMAGE } from "../hocs/appConstants";
|
|
9
|
+
import { Image } from "antd";
|
|
10
|
+
const IconInprogress = GrInProgress;
|
|
11
|
+
const FilesGridView = ({ files, handleClick, selectedFileIds, isImagePicker, selectedPickerFile, }) => {
|
|
12
|
+
const { type } = useAppParams();
|
|
13
|
+
return (_jsx("div", { className: "md-lib-grid md-lib-grid-cols-2 md:md-lib-grid-cols-3 xl:md-lib-grid-cols-4 md-lib-gap-x-4 md-lib-gap-y-10 md-lib-relative", children: _.map(files, (file) => {
|
|
14
|
+
const isSelected = includes(selectedFileIds, get(file, "_id")) ||
|
|
15
|
+
get(selectedPickerFile, "_id") === get(file, "_id");
|
|
16
|
+
return (_jsxs("div", { className: `md-lib-rounded-lg md-lib-pt-5 md-lib-h-52 md-lib-cursor-pointer ${isSelected
|
|
17
|
+
? "md-lib-bg-borderColor dark:md-lib-bg-darkSecondaryBg"
|
|
18
|
+
: "md-lib-bg-textColorActive dark:md-lib-bg-darkPrimary"} `, onClick: () => handleClick(file), children: [_jsxs("div", { className: "md-lib-flex md-lib-px-5 md-lib-items-center md-lib-justify-between md-lib-h-8", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-w-[calc(100%-20px)]", children: [getFileOrFolderIcon(get(file, "type"), get(file, "mimetype"), 20), _jsx("div", { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-sm md-lib-font-medium md-lib-truncate md-lib-w-[calc(100%-24px)]", title: get(file, "name", "N/A"), children: get(file, "name", "N/A") })] }), !isImagePicker &&
|
|
19
|
+
type !== DriveModes.FOLDERS &&
|
|
20
|
+
get(file, "fileUploadStatus") !== ThumbnailStatus.PENDING && (_jsx(FileMenuOptions, { file: file }))] }), _jsx("div", { className: "md-lib-mt-2 md-lib-h-28 md-lib-mx-2.5 md-lib-bg-white dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-md md-lib-flex md-lib-justify-center", children: get(file, "fileUploadStatus") === ThumbnailStatus.PENDING ? (
|
|
21
|
+
// <IconInprogress className="mt-10 text-[40px] text-imagesColor" />
|
|
22
|
+
_jsx(Image, { src: UPLOAD_FILE_IN_PROGRESS_WHITE_IMAGE, width: 100, height: 100 })) : (_jsx("img", { src: get(file, "thumbnailUrl", ""), width: 100, height: 100, alt: get(file, "name", "N/A") })) }), _jsx("div", { children: _jsx("p", { className: "md-lib-text-xs md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-px-5 md-lib-pt-2.5 md-lib-truncate md-lib-max-w-40", title: get(file, "name", "N/A"), children: get(file, "assetName", "N/A") }) })] }, get(file, "_id")));
|
|
23
|
+
}) }));
|
|
24
|
+
};
|
|
25
|
+
export default FilesGridView;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileEntity, FolderEntity, SortByKeys, SortOrders } from "../utilities/constants/interface";
|
|
2
|
+
declare const FolderGridView: ({ folders, foldersFetching, hasNextPage, fetchNextPage, files, selectedFileIds, selectedFolderIds, setSelectedItems, isImagePicker, setSelectedFile, setParentFolderId, selectedPickerFile, sortBy, sortOrder, setSortOrders, }: {
|
|
3
|
+
folders: FolderEntity[];
|
|
4
|
+
foldersFetching: boolean;
|
|
5
|
+
hasNextPage: boolean;
|
|
6
|
+
fetchNextPage: () => void;
|
|
7
|
+
files: FileEntity[];
|
|
8
|
+
selectedFolderIds: string[];
|
|
9
|
+
selectedFileIds: string[];
|
|
10
|
+
setSelectedItems: (values: any) => void;
|
|
11
|
+
setSelectedFile?: (value: FileEntity) => void;
|
|
12
|
+
isImagePicker?: boolean;
|
|
13
|
+
setParentFolderId?: (value: string) => void;
|
|
14
|
+
selectedPickerFile?: FileEntity;
|
|
15
|
+
sortBy: SortByKeys;
|
|
16
|
+
sortOrder: SortOrders;
|
|
17
|
+
setSortOrders: (newSortBy: SortByKeys, newSortOrder: SortOrders) => void;
|
|
18
|
+
}) => JSX.Element;
|
|
19
|
+
export default FolderGridView;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DriveModes, EntityType, SortByKeys, SortOrders, } from "../utilities/constants/interface";
|
|
3
|
+
import _, { filter, get, includes } from "lodash";
|
|
4
|
+
import { FaFolder, FaSort } from "react-icons/fa";
|
|
5
|
+
import LoadMoreItems from "../common/LoadMoreItems";
|
|
6
|
+
import FolderMenuOptions from "./FolderMenuOptions";
|
|
7
|
+
import { FETCH_ENTITY_SCREEN, SUBFOLDERS_SCREEN, } from "../utilities/constants/routes";
|
|
8
|
+
import FilesGridView from "./FilesGridView";
|
|
9
|
+
import { useRef, useState } from "react";
|
|
10
|
+
import ActionsBar from "./ActionBar";
|
|
11
|
+
import FileDetails from "./fileDetails/FileDetails";
|
|
12
|
+
import useAppNavigate from "../utilities/useAppNavigate";
|
|
13
|
+
import useAppParams from "../utilities/useAppParams";
|
|
14
|
+
import { ArrowDownOutlined, ArrowUpOutlined } from "@ant-design/icons";
|
|
15
|
+
const FaFolderIcon = FaFolder;
|
|
16
|
+
const FaSortIcon = FaSort;
|
|
17
|
+
const FolderGridView = ({ folders, foldersFetching, hasNextPage, fetchNextPage, files, selectedFileIds, selectedFolderIds, setSelectedItems, isImagePicker, setSelectedFile, setParentFolderId, selectedPickerFile, sortBy, sortOrder, setSortOrders, }) => {
|
|
18
|
+
const navigate = useAppNavigate();
|
|
19
|
+
const [state, setState] = useState({
|
|
20
|
+
selectedFile: {},
|
|
21
|
+
showPreviewModal: false,
|
|
22
|
+
});
|
|
23
|
+
const { showPreviewModal, selectedFile } = state;
|
|
24
|
+
const { type } = useAppParams();
|
|
25
|
+
const clickTimer = useRef(null);
|
|
26
|
+
const handleClick = (folder) => {
|
|
27
|
+
const id = get(folder, "_id");
|
|
28
|
+
const fileType = get(folder, "type", EntityType.FOLDER);
|
|
29
|
+
if (isImagePicker) {
|
|
30
|
+
if (fileType === EntityType.FILE) {
|
|
31
|
+
setSelectedFile === null || setSelectedFile === void 0 ? void 0 : setSelectedFile(folder);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
setParentFolderId === null || setParentFolderId === void 0 ? void 0 : setParentFolderId(id);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else if (type === DriveModes.FOLDERS) {
|
|
38
|
+
navigate(FETCH_ENTITY_SCREEN.replace(":id", id).replace(":type", fileType));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (clickTimer.current) {
|
|
42
|
+
clearTimeout(clickTimer.current);
|
|
43
|
+
clickTimer.current = null;
|
|
44
|
+
if (fileType === EntityType.FOLDER) {
|
|
45
|
+
navigate(SUBFOLDERS_SCREEN.replace(":folderId", id));
|
|
46
|
+
}
|
|
47
|
+
if (fileType === EntityType.FILE && type !== DriveModes.TRASH) {
|
|
48
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { selectedFile: folder, showPreviewModal: true })));
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
clickTimer.current = setTimeout(() => {
|
|
53
|
+
if (fileType === EntityType.FILE) {
|
|
54
|
+
const alreadySelected = includes(selectedFileIds, id);
|
|
55
|
+
setSelectedItems({
|
|
56
|
+
fileIds: alreadySelected
|
|
57
|
+
? filter(selectedFileIds, (fid) => fid !== id)
|
|
58
|
+
: [...selectedFileIds, id],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const alreadySelected = includes(selectedFolderIds, id);
|
|
63
|
+
setSelectedItems({
|
|
64
|
+
folderIds: alreadySelected
|
|
65
|
+
? filter(selectedFolderIds, (fid) => fid !== id)
|
|
66
|
+
: [...selectedFolderIds, id],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
clickTimer.current = null;
|
|
70
|
+
}, 250);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-gap-y-10", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-6", children: [_jsx("div", { className: "md-lib-flex md-lib-gap-2 ", onClick: () => setSortOrders(SortByKeys.NAME, sortOrder === SortOrders.ASCEND
|
|
74
|
+
? SortOrders.DESCEND
|
|
75
|
+
: SortOrders.ASCEND), children: _jsxs("div", { className: "md-lib-flex md-lib-gap-2 md-lib-items-center md-lib-font-medium md-lib-text-textColor dark:md-lib-text-darkTextColor hover:md-lib-bg-secondaryHoverColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-cursor-pointer", children: ["Name", sortBy === SortByKeys.NAME &&
|
|
76
|
+
(sortOrder === SortOrders.ASCEND ? (_jsx(ArrowUpOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" })) : (_jsx(ArrowDownOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))), sortBy !== SortByKeys.NAME && (_jsx(FaSortIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))] }) }), _jsx("div", { className: "md-lib-flex md-lib-gap-2", onClick: () => setSortOrders(SortByKeys.UPDATED_AT, sortOrder === SortOrders.ASCEND
|
|
77
|
+
? SortOrders.DESCEND
|
|
78
|
+
: SortOrders.ASCEND), children: _jsxs("div", { className: "md-lib-flex md-lib-gap-2 md-lib-items-center md-lib-font-medium md-lib-text-textColor dark:md-lib-text-darkTextColor hover:md-lib-bg-secondaryHoverColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-cursor-pointer", children: ["Modified At", sortBy === SortByKeys.UPDATED_AT &&
|
|
79
|
+
(sortOrder === SortOrders.ASCEND ? (_jsx(ArrowUpOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" })) : (_jsx(ArrowDownOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))), sortBy !== SortByKeys.UPDATED_AT && (_jsx(FaSortIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))] }) }), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-font-medium md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-sm md-lib-w-[100px] ", children: ["File size", _jsxs("span", { className: "md-lib-cursor-pointer", onClick: () => setSortOrders(SortByKeys.SIZE, sortOrder === SortOrders.ASCEND
|
|
80
|
+
? SortOrders.DESCEND
|
|
81
|
+
: SortOrders.ASCEND), children: [sortBy === SortByKeys.SIZE &&
|
|
82
|
+
(sortOrder === SortOrders.ASCEND ? (_jsx(ArrowUpOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" })) : (_jsx(ArrowDownOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))), sortBy !== SortByKeys.SIZE && (_jsx(FaSortIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))] })] })] }), _jsx("div", { className: "md-lib-grid md-lib-grid-cols-2 md:md-lib-grid-cols-3 xl:md-lib-grid-cols-4 2xl:md-lib-grid-cols-5 md-lib-gap-x-4 md-lib-gap-y-10", children: _.map(folders, (folder) => {
|
|
83
|
+
const isSelected = includes(selectedFolderIds, get(folder, "_id")) ||
|
|
84
|
+
get(selectedPickerFile, "_id") === get(folder, "_id");
|
|
85
|
+
return (_jsxs("div", { className: `md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-rounded-lg md-lib-px-5 md-lib-h-16 md-lib-flex md-lib-items-center md-lib-justify-between md-lib-cursor-pointer ${isSelected ? "md-lib-bg-borderColor dark:md-lib-bg-darkSecondaryBg" : ""}`, onClick: () => handleClick(folder), children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-w-[calc(100%-20px)]", children: [_jsxs("div", { children: [" ", _jsx(FaFolderIcon, { className: "md-lib-text-primaryColor", size: 32 })] }), _jsx("p", { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-truncate", title: get(folder, "name", "N/A"), children: get(folder, "name") })] }), !isImagePicker && type !== DriveModes.FOLDERS && (_jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(FolderMenuOptions, { folder: folder }) }))] }, get(folder, "_id")));
|
|
86
|
+
}) }), _jsx(FilesGridView, { files: files, handleClick: handleClick, selectedFileIds: selectedFileIds, isImagePicker: isImagePicker, selectedPickerFile: selectedPickerFile }), _jsx(LoadMoreItems, { hasNextPage: hasNextPage, isItemsFetching: foldersFetching, fetchNextPage: fetchNextPage }), (!!get(selectedFileIds, "length") ||
|
|
87
|
+
!!get(selectedFolderIds, "length")) && (_jsx(ActionsBar, { fileIds: selectedFileIds, folderIds: selectedFolderIds, onCloseSelection: () => setSelectedItems({ fileIds: [], folderIds: [] }) })), showPreviewModal && (_jsx(FileDetails, { open: showPreviewModal, handleClose: () => {
|
|
88
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showPreviewModal: false, selectedFile: {} })));
|
|
89
|
+
}, file: selectedFile }))] }));
|
|
90
|
+
};
|
|
91
|
+
export default FolderGridView;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AssetTemplateEntity, FileEntity, FolderEntity, SortByKeys, SortOrders } from "../utilities/constants/interface";
|
|
2
|
+
declare const FolderListView: ({ folders, foldersFetching, hasNextPage, fetchNextPage, selectedFileIds, selectedFolderIds, setSelectedItems, isImagePicker, setSelectedFile, setParentFolderId, selectedPickerFile, location, assets, sortByKey, sortOrder, setSortOrders, onSearch, searchKey, searchValue, metadataKey, metadataValue, }: {
|
|
3
|
+
folders: FolderEntity[] | FileEntity[];
|
|
4
|
+
foldersFetching: boolean;
|
|
5
|
+
hasNextPage: boolean;
|
|
6
|
+
fetchNextPage: () => void;
|
|
7
|
+
selectedFolderIds: string[];
|
|
8
|
+
selectedFileIds: string[];
|
|
9
|
+
setSelectedItems: (values: any) => void;
|
|
10
|
+
setSelectedFile?: (value: FileEntity) => void;
|
|
11
|
+
isImagePicker?: boolean;
|
|
12
|
+
setParentFolderId?: (value: string) => void;
|
|
13
|
+
selectedPickerFile?: FileEntity;
|
|
14
|
+
location: string;
|
|
15
|
+
assets: AssetTemplateEntity[];
|
|
16
|
+
sortByKey: SortByKeys;
|
|
17
|
+
sortOrder: SortOrders;
|
|
18
|
+
setSortOrders: (newSortBy: SortByKeys, newSortOrder: SortOrders) => void;
|
|
19
|
+
onSearch: (filters: Record<string, any>) => void;
|
|
20
|
+
searchKey: string;
|
|
21
|
+
searchValue: string;
|
|
22
|
+
metadataKey: string;
|
|
23
|
+
metadataValue: string;
|
|
24
|
+
}) => JSX.Element;
|
|
25
|
+
export default FolderListView;
|