@bindu-dashing/dam-solution-v2 5.8.35 → 5.8.37
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/build/MyDrive/BreadCrumbList.d.ts +2 -1
- package/build/MyDrive/BreadCrumbList.js +11 -7
- package/build/MyDrive/DriveContainer.d.ts +2 -1
- package/build/MyDrive/DriveContainer.js +2 -2
- package/build/MyDrive/FolderTree.js +4 -5
- package/build/MyDrive/MyDriveMainContainer.js +10 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FolderEntity } from "../utilities/constants/interface";
|
|
2
|
-
declare function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolderId, globalSearch, }: {
|
|
2
|
+
declare function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolderId, globalSearch, setSelectedKeys, }: {
|
|
3
3
|
folder: FolderEntity;
|
|
4
4
|
parentFolderId?: string;
|
|
5
5
|
setParentFolderId?: (id: string) => void;
|
|
6
6
|
pickerFolderId?: string;
|
|
7
7
|
globalSearch?: string;
|
|
8
|
+
setSelectedKeys?: (keys: string | string[]) => void;
|
|
8
9
|
}): JSX.Element;
|
|
9
10
|
export default BreadCrumbList;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DriveModes } from "../utilities/constants/interface";
|
|
3
|
-
import { DRIVE_MODES_SCREEN, MY_DRIVE_SCREEN,
|
|
3
|
+
import { DRIVE_MODES_SCREEN, MY_DRIVE_SCREEN, } from "../utilities/constants/routes";
|
|
4
4
|
import { Breadcrumb, Tooltip } from "antd";
|
|
5
5
|
import { findIndex, get, isEmpty, last, map, slice } from "lodash";
|
|
6
6
|
import { useMemo } from "react";
|
|
7
7
|
import { FaChevronRight } from "react-icons/fa";
|
|
8
8
|
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
9
|
-
import useAppNavigate from "../utilities/useAppNavigate";
|
|
10
9
|
import useAppParams from "../utilities/useAppParams";
|
|
10
|
+
import useAppNavigate from "../utilities/useAppNavigate";
|
|
11
11
|
const FaChevronRightIcon = FaChevronRight;
|
|
12
|
-
function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolderId, globalSearch, }) {
|
|
12
|
+
function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolderId, globalSearch, setSelectedKeys, }) {
|
|
13
13
|
const { type, id } = useAppParams();
|
|
14
14
|
const damConfig = useDamConfig();
|
|
15
15
|
const { rootFolderId } = damConfig;
|
|
@@ -63,12 +63,16 @@ function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolde
|
|
|
63
63
|
if (pickerFolderId && setParentFolderId && !isLast) {
|
|
64
64
|
setParentFolderId(treeId);
|
|
65
65
|
}
|
|
66
|
-
if (!pickerFolderId && !isLast
|
|
66
|
+
if (!pickerFolderId && !isLast) {
|
|
67
67
|
if (treeId === rootFolderId) {
|
|
68
|
-
|
|
68
|
+
// Navigate to MY_DRIVE_SCREEN only for root folder
|
|
69
|
+
if (navigate) {
|
|
70
|
+
navigate(MY_DRIVE_SCREEN);
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
|
-
else {
|
|
71
|
-
|
|
73
|
+
else if (setSelectedKeys) {
|
|
74
|
+
// Use state-based navigation for other folders
|
|
75
|
+
setSelectedKeys(treeId);
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SetStateAction } from "react";
|
|
2
2
|
import { FileEntity, ImagePickerEntity } from "../utilities/constants/interface";
|
|
3
|
-
declare function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pickerFolderId, selectedPickerFile, imagePicker, globalSearch, setGlobalSearch, }: {
|
|
3
|
+
declare function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pickerFolderId, selectedPickerFile, imagePicker, globalSearch, setGlobalSearch, setSelectedKeys, }: {
|
|
4
4
|
parentFolderId?: string;
|
|
5
5
|
setSelectedFile?: (file: FileEntity, localFile?: boolean) => void;
|
|
6
6
|
setParentFolderId?: (id: string) => void;
|
|
@@ -9,5 +9,6 @@ declare function DriveContainer({ parentFolderId, setSelectedFile, setParentFold
|
|
|
9
9
|
imagePicker?: ImagePickerEntity | {};
|
|
10
10
|
globalSearch?: string;
|
|
11
11
|
setGlobalSearch?: React.Dispatch<SetStateAction<string>>;
|
|
12
|
+
setSelectedKeys?: (keys: string | string[]) => void;
|
|
12
13
|
}): JSX.Element;
|
|
13
14
|
export default DriveContainer;
|
|
@@ -36,7 +36,7 @@ import useAppParams from "../utilities/useAppParams";
|
|
|
36
36
|
import { IoIosSearch } from "react-icons/io";
|
|
37
37
|
const BsUploadIcon = BsUpload;
|
|
38
38
|
const IoIosSearchIcon = IoIosSearch;
|
|
39
|
-
function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pickerFolderId, selectedPickerFile, imagePicker, globalSearch, setGlobalSearch, }) {
|
|
39
|
+
function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pickerFolderId, selectedPickerFile, imagePicker, globalSearch, setGlobalSearch, setSelectedKeys, }) {
|
|
40
40
|
const damConfig = useDamConfig();
|
|
41
41
|
const { rootFolderId, brand, isAdmin } = damConfig;
|
|
42
42
|
const brandId = get(brand, "_id");
|
|
@@ -236,7 +236,7 @@ function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pi
|
|
|
236
236
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), filters)));
|
|
237
237
|
};
|
|
238
238
|
// console.log("search", searchKey, searchValue, metadataKey, metadataValue);
|
|
239
|
-
return (_jsxs("div", { className: "md-lib-h-[inherit]", children: [type !== DriveModes.FILE && (_jsx(_Fragment, { children: _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-px-4 md-lib-h-20 md-lib-justify-between md-lib-border-b md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-mb-4", children: [imagePicker ? (_jsx(ImagePickerBreadCrumbList, { folder: parentFolder, parentFolderId: parentFolderId, setParentFolderId: setParentFolderId, pickerFolderId: pickerFolderId })) : (_jsx(_Fragment, { children: _jsx(BreadCrumbList, { folder: parentFolder, parentFolderId: parentFolderId, setParentFolderId: setParentFolderId, pickerFolderId: pickerFolderId, globalSearch: globalSearch }) })), _jsx(AddDrive, {}), get(imagePicker, "allowNewFiles") && (_jsx(Upload, { beforeUpload: (file) => {
|
|
239
|
+
return (_jsxs("div", { className: "md-lib-h-[inherit]", children: [type !== DriveModes.FILE && (_jsx(_Fragment, { children: _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-px-4 md-lib-h-20 md-lib-justify-between md-lib-border-b md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-mb-4", children: [imagePicker ? (_jsx(ImagePickerBreadCrumbList, { folder: parentFolder, parentFolderId: parentFolderId, setParentFolderId: setParentFolderId, pickerFolderId: pickerFolderId })) : (_jsx(_Fragment, { children: _jsx(BreadCrumbList, { folder: parentFolder, parentFolderId: parentFolderId, setParentFolderId: setParentFolderId, pickerFolderId: pickerFolderId, globalSearch: globalSearch, setSelectedKeys: setSelectedKeys }) })), isAdmin && _jsx(AddDrive, {}), get(imagePicker, "allowNewFiles") && (_jsx(Upload, { beforeUpload: (file) => {
|
|
240
240
|
onSelectNewFile(file);
|
|
241
241
|
}, showUploadList: false, accept: "image/*", children: _jsx(CustomButton, { loading: loadingType === "NEW_FILE_UPLOAD", label: "Select File", icon: _jsx(BsUploadIcon, {}) }) }))] }) })), _jsxs("div", { className: `md-lib-px-4 md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-flex ${!includes([DriveModes.FOLDERS, DriveModes.FILE], type)
|
|
242
242
|
? "md-lib-justify-between"
|
|
@@ -16,8 +16,6 @@ import { deleteFolders, } from "../react-query/services/folder-services";
|
|
|
16
16
|
import { generateFoldersQueryKey, invalidateData, } from "../utilities/constants/queryKeys";
|
|
17
17
|
import { createApiClient } from "../hocs/configureAxios";
|
|
18
18
|
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
19
|
-
import { MY_DRIVE_SCREEN, } from "../utilities/constants/routes";
|
|
20
|
-
import useAppNavigate from "../utilities/useAppNavigate";
|
|
21
19
|
import { AiOutlineSortDescending } from "react-icons/ai";
|
|
22
20
|
import { AiOutlineSortAscending } from "react-icons/ai";
|
|
23
21
|
import CustomLoader from "../common/loader/CustomLoader";
|
|
@@ -91,7 +89,6 @@ function FolderTree({ currentRootId, expandedKeys, selectedKeys, handleExpand, s
|
|
|
91
89
|
const { folderId, id, type } = useParams();
|
|
92
90
|
const damConfig = useDamConfig();
|
|
93
91
|
const { rootFolderId } = damConfig;
|
|
94
|
-
const navigate = useAppNavigate();
|
|
95
92
|
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
96
93
|
const { useBreakpoint } = Grid;
|
|
97
94
|
const [collapse, setCollapse] = useState(false);
|
|
@@ -346,7 +343,8 @@ function FolderTree({ currentRootId, expandedKeys, selectedKeys, handleExpand, s
|
|
|
346
343
|
});
|
|
347
344
|
invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : id ? id : rootFolderId);
|
|
348
345
|
if (deletedId === folderId || deletedId === id) {
|
|
349
|
-
|
|
346
|
+
// Navigate to root folder using state instead of URL
|
|
347
|
+
setSelectedKeys(rootFolderId);
|
|
350
348
|
}
|
|
351
349
|
showNotification(message, NotificationStatus.SUCCESS);
|
|
352
350
|
};
|
|
@@ -434,7 +432,8 @@ function FolderTree({ currentRootId, expandedKeys, selectedKeys, handleExpand, s
|
|
|
434
432
|
}), value: globalSearchValue, prefix: _jsx(IoIosSearchIcon, {}), onPressEnter: () => {
|
|
435
433
|
if (globalSearchValue.length >= 2 || !globalSearchValue) {
|
|
436
434
|
setGlobalSearch(globalSearchValue);
|
|
437
|
-
|
|
435
|
+
// Navigate to root folder using state instead of URL
|
|
436
|
+
setSelectedKeys(rootFolderId);
|
|
438
437
|
}
|
|
439
438
|
} }) }), !enableDrag && (_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor md-lib-mb-1 md-lib-font-400", children: "Sort By:" })), _jsxs("div", { className: "md-lib-flex md-lib-justify-between md-lib-items-center md-lib-mb-3 md-lib-gap-2", children: [!enableDrag && (_jsxs(Select, { value: sortMode, onChange: handleSortChange, style: { width: 200 }, children: [_jsx(Option, { value: "name", children: "Name" }), _jsx(Option, { value: "createdAt", children: "Created At" }), _jsx(Option, { value: "custom", children: "Custom Order" })] })), sortMode !== "custom" && (_jsx(Tooltip, { title: sortOrder === "desc" ? "Ascending" : "Descending", children: _jsx(Button, { onClick: () => {
|
|
440
439
|
if (sortOrder === "desc") {
|
|
@@ -50,5 +50,14 @@ export default function MyDriveMainContainer({ folders, setFolders }) {
|
|
|
50
50
|
const handleExpand = (keys) => {
|
|
51
51
|
setExpandedKeys(map(keys, (k) => k.toString()));
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
// Wrapper function to handle both string and string[] for setSelectedKeys
|
|
54
|
+
const handleSetSelectedKeys = (keys) => {
|
|
55
|
+
if (typeof keys === 'string') {
|
|
56
|
+
setSelectedKeys([keys]);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
setSelectedKeys(keys);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return (_jsxs(FoldersProvider, { value: { setFolders, folders, globalSearch }, children: [_jsx(FolderTree, { currentRootId: currentRootId, handleExpand: handleExpand, setSelectedKeys: setSelectedKeys, expandedKeys: expandedKeys, selectedKeys: selectedKeys, folders: folders, setExpandedKeys: setExpandedKeys, setFolders: setFolders, setGlobalSearch: setGlobalSearch, globalSearch: globalSearch }), _jsx("div", { className: "md-lib-h-[inherit] md-lib-overflow-x-auto", children: _jsx(DriveContainer, { parentFolderId: selectedFolderId, globalSearch: globalSearch, setGlobalSearch: setGlobalSearch, setSelectedKeys: handleSetSelectedKeys }) })] }));
|
|
54
63
|
}
|