@bindu-dashing/dam-solution-v2 5.8.38 → 5.8.40
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/AssetType/AssetTemplatesTable.js +5 -1
- package/build/AssetType/CreateAssetTemplate.js +3 -1
- package/build/AssetType/EditAssetTemplate.js +13 -3
- package/build/ImagePicker/TestImagePickerModal.js +10 -7
- package/build/MyDrive/BreadCrumbList.js +3 -14
- package/build/MyDrive/FolderGridView.js +4 -2
- package/build/MyDrive/FolderListView.js +4 -2
- package/build/MyDrive/routes.js +0 -6
- package/build/utilities/useAppNavigate.d.ts +1 -1
- package/build/utilities/useAppNavigate.js +20 -4
- package/package.json +1 -1
|
@@ -131,7 +131,11 @@ function AssetTemplatesTable({ assetTemplates, totalPages, totalCount, filters =
|
|
|
131
131
|
title: "Actions",
|
|
132
132
|
dataIndex: "",
|
|
133
133
|
key: "actions",
|
|
134
|
-
render: (record) => (_jsxs(Space, { children: [_jsx(Tooltip, { title: "Edit Asset template", className: "md-lib-hidden md:md-lib-block", children: _jsx(CustomButton, { icon: _jsx(EditOutlined, { size: 24, className: "md-lib-text-primaryColor" }), size: "large", label: "", className: "md-lib-border-none", onClick: () =>
|
|
134
|
+
render: (record) => (_jsxs(Space, { children: [_jsx(Tooltip, { title: "Edit Asset template", className: "md-lib-hidden md:md-lib-block", children: _jsx(CustomButton, { icon: _jsx(EditOutlined, { size: 24, className: "md-lib-text-primaryColor" }), size: "large", label: "", className: "md-lib-border-none", onClick: () => {
|
|
135
|
+
if (navigate) {
|
|
136
|
+
navigate(ASSET_TEMPLATE_SCREEN.replace(":id", get(record, "_id")));
|
|
137
|
+
}
|
|
138
|
+
} }) }), _jsx(Tooltip, { title: "Delete Asset template", placement: "topLeft", children: _jsx(CustomButton, { icon: _jsx(DeleteOutlined, { className: "md-lib-text-dangerColor", size: 24 }), label: "", type: "default", onClick: () => toggleDeletConfirm(record), className: "md-lib-border-none", size: "large" }) })] })),
|
|
135
139
|
},
|
|
136
140
|
];
|
|
137
141
|
const handleTableChange = (pagination, tableFilters, sorter) => {
|
|
@@ -41,7 +41,9 @@ export default function CreateAssetTemplate({ label }) {
|
|
|
41
41
|
// console.log("response", response);
|
|
42
42
|
showNotification(get(response, "data.message", CREATE_SUCCESS), NotificationStatus.SUCCESS);
|
|
43
43
|
toggleModal();
|
|
44
|
-
|
|
44
|
+
if (navigate) {
|
|
45
|
+
navigate(ASSET_TEMPLATE_SCREEN.replace(":id", get(response, "data._id")));
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
48
|
catch (error) {
|
|
47
49
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false })));
|
|
@@ -129,7 +129,9 @@ export default function EditAssetTemplate({ assetTemplate, inputTypes, }) {
|
|
|
129
129
|
return finalField;
|
|
130
130
|
}),
|
|
131
131
|
});
|
|
132
|
-
navigate
|
|
132
|
+
if (navigate) {
|
|
133
|
+
navigate(ASSETS_SCREEN);
|
|
134
|
+
}
|
|
133
135
|
showNotification(get(response, "data.message", UPDATE_SUCCESS), NotificationStatus.SUCCESS);
|
|
134
136
|
}
|
|
135
137
|
catch (error) {
|
|
@@ -168,11 +170,19 @@ export default function EditAssetTemplate({ assetTemplate, inputTypes, }) {
|
|
|
168
170
|
alignItems: "center",
|
|
169
171
|
marginBottom: 0,
|
|
170
172
|
}, centered: true, tabBarExtraContent: {
|
|
171
|
-
left: (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-border-b md-lib-p-3 md-lib-border-borderColor dark:md-lib-border-darkBorderColor dark:md-lib-bg-darkPrimary md-lib-bg-white", children: [_jsx(IoMdCloseIcon, { size: ICON_SIZE, onClick: () =>
|
|
173
|
+
left: (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-border-b md-lib-p-3 md-lib-border-borderColor dark:md-lib-border-darkBorderColor dark:md-lib-bg-darkPrimary md-lib-bg-white", children: [_jsx(IoMdCloseIcon, { size: ICON_SIZE, onClick: () => {
|
|
174
|
+
if (navigate) {
|
|
175
|
+
navigate(ASSETS_SCREEN);
|
|
176
|
+
}
|
|
177
|
+
}, className: "md-lib-cursor-pointer" }), _jsx(Paragraph, { className: "md-lib-text-xl md-lib-border-l md-lib-pl-4 md-lib-ml-4 md-lib-asset-template-title", style: { marginBottom: "0px !important" }, editable: {
|
|
172
178
|
onChange: (val) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { name: val }))),
|
|
173
179
|
icon: _jsx(FiEdit2Icon, { size: 15, className: "md-lib-ml-2" }),
|
|
174
180
|
}, children: name })] })),
|
|
175
|
-
right: (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-ml-auto", children: [imagePickerOutputFormatError && (_jsx("p", { className: "md-lib-text-sm md-lib-text-red-500", children: "Please fix the errors in the Image Picker Output format" })), _jsx(CustomButton, { label: "Cancel", onClick: () =>
|
|
181
|
+
right: (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-ml-auto", children: [imagePickerOutputFormatError && (_jsx("p", { className: "md-lib-text-sm md-lib-text-red-500", children: "Please fix the errors in the Image Picker Output format" })), _jsx(CustomButton, { label: "Cancel", onClick: () => {
|
|
182
|
+
if (navigate) {
|
|
183
|
+
navigate(ASSETS_SCREEN);
|
|
184
|
+
}
|
|
185
|
+
} }), _jsx(CustomButton, { label: "Save", type: currentFieldIndex !== null ? "default" : "primary", icon: _jsx(FiSaveIcon, {}), disabled: currentFieldIndex !== null, onClick: handleSaveTemplate, loading: loading })] })),
|
|
176
186
|
}, onChange: (key) => setState((prevState) => {
|
|
177
187
|
return Object.assign(Object.assign({}, prevState), { activeTab: key, currentFieldIndex: key === "2" ? null : prevState.currentFieldIndex });
|
|
178
188
|
}) }) }));
|
|
@@ -18,11 +18,14 @@ import { getFormattedValue } from "../hocs/helpers";
|
|
|
18
18
|
import { createApiClient } from "../hocs/configureAxios";
|
|
19
19
|
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
20
20
|
import { FETCH_ASSET_URL, FETCH_SHARED_FILE_URL, } from "../utilities/constants/apiUrls";
|
|
21
|
+
import { FoldersProvider } from "../utilities/FoldersContext";
|
|
21
22
|
function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile, }) {
|
|
22
23
|
const [state, setState] = useState({
|
|
23
24
|
parentFolderId: get(imagePicker, "folderId"),
|
|
24
25
|
fileForConfirmation: {},
|
|
25
26
|
});
|
|
27
|
+
const [folders, setFolders] = useState([]);
|
|
28
|
+
const [globalSearch, setGlobalSearch] = useState("");
|
|
26
29
|
const damConfig = useDamConfig();
|
|
27
30
|
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
28
31
|
const { parentFolderId, fileForConfirmation } = state;
|
|
@@ -50,12 +53,12 @@ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile,
|
|
|
50
53
|
onSelectFile();
|
|
51
54
|
} }, "confirm")) : null, children: get(imagePicker, "assetId") ? (_jsx(TestImageFromMetalData, { imagePicker: imagePicker, selectedPickerFile: fileForConfirmation, setSelectedFile: (file) => {
|
|
52
55
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
|
|
53
|
-
} })) : (_jsx(DriveContainer, { setSelectedFile: (file, localFile = false) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
} })) : (_jsx(FoldersProvider, { value: { folders, setFolders, globalSearch }, children: _jsx(DriveContainer, { setSelectedFile: (file, localFile = false) => {
|
|
57
|
+
console.log("local file", file);
|
|
58
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
|
|
59
|
+
if (localFile) {
|
|
60
|
+
setSelectedFile(get(file, "s3Url", ""), get(file, "thumbnailUrl", ""));
|
|
61
|
+
}
|
|
62
|
+
}, parentFolderId: parentFolderId, setParentFolderId: (id) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { parentFolderId: id, fileForConfirmation: {} }))), pickerFolderId: get(imagePicker, "folderId"), selectedPickerFile: fileForConfirmation, imagePicker: imagePicker, globalSearch: globalSearch, setGlobalSearch: setGlobalSearch }) })) }));
|
|
60
63
|
}
|
|
61
64
|
export default TestImagePickerModal;
|
|
@@ -1,19 +1,17 @@
|
|
|
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,
|
|
3
|
+
import { DRIVE_MODES_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
9
|
import useAppParams from "../utilities/useAppParams";
|
|
10
|
-
import useAppNavigate from "../utilities/useAppNavigate";
|
|
11
10
|
const FaChevronRightIcon = FaChevronRight;
|
|
12
11
|
function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolderId, globalSearch, setSelectedKeys, }) {
|
|
13
12
|
const { type, id } = useAppParams();
|
|
14
13
|
const damConfig = useDamConfig();
|
|
15
14
|
const { rootFolderId } = damConfig;
|
|
16
|
-
const navigate = !pickerFolderId ? useAppNavigate() : null;
|
|
17
15
|
const tree = useMemo(() => {
|
|
18
16
|
const fullTree = get(folder, "tree", []);
|
|
19
17
|
if (pickerFolderId) {
|
|
@@ -63,17 +61,8 @@ function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolde
|
|
|
63
61
|
if (pickerFolderId && setParentFolderId && !isLast) {
|
|
64
62
|
setParentFolderId(treeId);
|
|
65
63
|
}
|
|
66
|
-
if (!pickerFolderId && !isLast) {
|
|
67
|
-
|
|
68
|
-
// Navigate to MY_DRIVE_SCREEN only for root folder
|
|
69
|
-
if (navigate) {
|
|
70
|
-
navigate(MY_DRIVE_SCREEN);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else if (setSelectedKeys) {
|
|
74
|
-
// Use state-based navigation for other folders
|
|
75
|
-
setSelectedKeys(treeId);
|
|
76
|
-
}
|
|
64
|
+
if (!pickerFolderId && !isLast && setSelectedKeys) {
|
|
65
|
+
setSelectedKeys(treeId);
|
|
77
66
|
}
|
|
78
67
|
};
|
|
79
68
|
const currentItemRender = (_jsx(Breadcrumb.Item, { onClick: handleClick, className: "md-lib-h-auto md-lib-cursor-pointer", children: _jsx(Tooltip, { title: name, children: _jsx("p", { className: "md-lib-max-w-28 md-lib-truncate md-lib-font-semibold md-lib-text-[22px]", children: name }) }) }, treeId));
|
|
@@ -35,13 +35,15 @@ const FolderGridView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
else if (type === DriveModes.FOLDERS) {
|
|
38
|
-
navigate
|
|
38
|
+
if (navigate) {
|
|
39
|
+
navigate(FETCH_ENTITY_SCREEN.replace(":id", id).replace(":type", fileType));
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
else {
|
|
41
43
|
if (clickTimer.current) {
|
|
42
44
|
clearTimeout(clickTimer.current);
|
|
43
45
|
clickTimer.current = null;
|
|
44
|
-
if (fileType === EntityType.FOLDER) {
|
|
46
|
+
if (fileType === EntityType.FOLDER && navigate) {
|
|
45
47
|
navigate(SUBFOLDERS_SCREEN.replace(":folderId", id));
|
|
46
48
|
}
|
|
47
49
|
if (fileType === EntityType.FILE && type !== DriveModes.TRASH) {
|
|
@@ -72,13 +72,15 @@ const FolderListView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
else if (type === DriveModes.FOLDERS) {
|
|
75
|
-
navigate
|
|
75
|
+
if (navigate) {
|
|
76
|
+
navigate(FETCH_ENTITY_SCREEN.replace(":id", id).replace(":type", fileType));
|
|
77
|
+
}
|
|
76
78
|
}
|
|
77
79
|
else {
|
|
78
80
|
if (clickTimer.current) {
|
|
79
81
|
clearTimeout(clickTimer.current);
|
|
80
82
|
clickTimer.current = null;
|
|
81
|
-
if (fileType === EntityType.FOLDER) {
|
|
83
|
+
if (fileType === EntityType.FOLDER && navigate) {
|
|
82
84
|
navigate(SUBFOLDERS_SCREEN.replace(":folderId", id));
|
|
83
85
|
}
|
|
84
86
|
if (fileType === EntityType.FILE && type !== DriveModes.TRASH) {
|
package/build/MyDrive/routes.js
CHANGED
|
@@ -5,14 +5,8 @@ import useAppParams from "../utilities/useAppParams";
|
|
|
5
5
|
export default function AppRoutes({ folders, setFolders, routerVersion, }) {
|
|
6
6
|
const params = useAppParams();
|
|
7
7
|
const { type, id } = params;
|
|
8
|
-
// Determine which component to render based on params
|
|
9
|
-
// If type and id are present, it's likely an image picker or entity view
|
|
10
8
|
if (type && id) {
|
|
11
|
-
// This matches FETCH_ENTITY_SCREEN pattern
|
|
12
9
|
return _jsx(ImagePickerDrive, {});
|
|
13
10
|
}
|
|
14
|
-
// Otherwise, render the main drive container
|
|
15
|
-
// This handles both MY_DRIVE_SCREEN and SUBFOLDERS_SCREEN
|
|
16
|
-
// The folderId param will be handled by MyDriveMainContainer
|
|
17
11
|
return (_jsx(MyDriveMainContainer, { folders: folders, setFolders: setFolders }));
|
|
18
12
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare let useAppNavigate: () => (to: string) => void;
|
|
1
|
+
declare let useAppNavigate: () => ((to: string) => void) | null;
|
|
2
2
|
export default useAppNavigate;
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
let useAppNavigate;
|
|
2
3
|
const rrd = require("react-router-dom");
|
|
3
4
|
if (rrd.useNavigate) {
|
|
4
5
|
// ✅ v6+
|
|
5
6
|
const { useNavigate } = rrd;
|
|
6
7
|
useAppNavigate = () => {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
let navigateFn = null;
|
|
9
|
+
const hasRouterContext = React.useRef(false);
|
|
10
|
+
try {
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
hasRouterContext.current = true;
|
|
13
|
+
navigateFn = (to) => navigate(to);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
hasRouterContext.current = false;
|
|
17
|
+
navigateFn = null;
|
|
18
|
+
}
|
|
19
|
+
return navigateFn;
|
|
9
20
|
};
|
|
10
21
|
}
|
|
11
22
|
else {
|
|
12
23
|
// ✅ v4/v5 fallback → use our NavigatorProvider
|
|
13
24
|
const { useLegacyNavigate } = require("./NavigatorProvider");
|
|
14
25
|
useAppNavigate = () => {
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
try {
|
|
27
|
+
const navigate = useLegacyNavigate();
|
|
28
|
+
return (to) => navigate(to);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
17
33
|
};
|
|
18
34
|
}
|
|
19
35
|
export default useAppNavigate;
|