@bindu-dashing/dam-solution-v2 5.8.116 → 5.8.118
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.
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
11
|
import { Button, Checkbox, Form, Input } from "antd";
|
|
3
12
|
import TextField from "./fieldProperties/TextField";
|
|
@@ -5,28 +14,43 @@ import NumberField from "./fieldProperties/NumberField";
|
|
|
5
14
|
import { useEffect, useState } from "react";
|
|
6
15
|
import DateField from "./fieldProperties/DateField";
|
|
7
16
|
import OptionsField from "./fieldProperties/OptionsField";
|
|
8
|
-
import { InputSupportedTypes, InputTypes, } from "../utilities/constants/interface";
|
|
17
|
+
import { InputSupportedTypes, InputTypes, NotificationStatus, } from "../utilities/constants/interface";
|
|
9
18
|
import { first, get, includes, isArray, nth } from "lodash";
|
|
10
19
|
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
11
20
|
import useAppNavigate from "../utilities/useAppNavigate";
|
|
12
21
|
import { getFormItem } from "../MyDrive/fileDetails/MetaForm";
|
|
13
22
|
import dayjs from "dayjs";
|
|
14
23
|
import { DATE_FORMAT, DATE_WITH_TIME_FORMAT } from "../hocs/appConstants";
|
|
24
|
+
import { showNotification } from "../common/notifications";
|
|
25
|
+
import { UPDATE_SUCCESS } from "../utilities/constants/messages";
|
|
15
26
|
export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpdateField, currentInputType, index, allFields, }) {
|
|
16
27
|
const { styles } = useDamConfig();
|
|
17
28
|
const navigate = useAppNavigate();
|
|
18
29
|
const [defaultValueInput, setDefaultValueInput] = useState("");
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
const [loading, setLoading] = useState(false);
|
|
31
|
+
const onUpdate = (values) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
try {
|
|
33
|
+
setLoading(true);
|
|
34
|
+
const allValues = Object.assign({}, values);
|
|
35
|
+
if (allValues === null || allValues === void 0 ? void 0 : allValues.defaultValue) {
|
|
36
|
+
allValues["defaultValue"] = getFormattedDefaultValue(allValues);
|
|
37
|
+
}
|
|
38
|
+
if (get(field, "_id", null)) {
|
|
39
|
+
allValues["_id"] = get(field, "_id");
|
|
40
|
+
}
|
|
41
|
+
// Small delay to show loading state
|
|
42
|
+
yield new Promise((resolve) => setTimeout(resolve, 300));
|
|
43
|
+
onUpdateField(allValues, currentInputType, index);
|
|
44
|
+
setCurrentFieldIndex(null);
|
|
45
|
+
showNotification(UPDATE_SUCCESS, NotificationStatus.SUCCESS);
|
|
23
46
|
}
|
|
24
|
-
|
|
25
|
-
|
|
47
|
+
catch (error) {
|
|
48
|
+
// Handle error if needed
|
|
26
49
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
50
|
+
finally {
|
|
51
|
+
setLoading(false);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
30
54
|
const [form] = Form.useForm();
|
|
31
55
|
const getFormattedDefaultValue = (values) => {
|
|
32
56
|
const defaultName = get(field, "defaultName");
|
|
@@ -193,5 +217,5 @@ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpda
|
|
|
193
217
|
], get(currentInputType, "defaultName")) && (_jsx(OptionsField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []), currentInputType: currentInputType }))] })] }), _jsxs(Form.Item, { className: "md-lib-flex md-lib-items-center md-lib-justify-end md-lib-absolute md-lib-bottom-0 md-lib-right-0 !md-lib-my-2", children: [_jsx(Button, { color: "primary", variant: "text", onClick: () => {
|
|
194
218
|
setCurrentFieldIndex(null);
|
|
195
219
|
// navigate(ASSETS_SCREEN);
|
|
196
|
-
}, size: "large", children: "Cancel" }), _jsx(Button, { color: "primary", htmlType: "submit", className: "md-lib-ml-2 md-lib-border-primaryColor md-lib-text-primaryColor", size: "large", children: "Update" })] })] }) })] }));
|
|
220
|
+
}, size: "large", children: "Cancel" }), _jsx(Button, { color: "primary", htmlType: "submit", className: "md-lib-ml-2 md-lib-border-primaryColor md-lib-text-primaryColor", size: "large", loading: loading, children: "Update" })] })] }) })] }));
|
|
197
221
|
}
|
|
@@ -309,7 +309,6 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
|
|
|
309
309
|
label: "Share",
|
|
310
310
|
icon: _jsx(UserAddOutlined, {}),
|
|
311
311
|
onClick: toggleShareModal,
|
|
312
|
-
disabled: !!get(folderIds, "length"),
|
|
313
312
|
},
|
|
314
313
|
]
|
|
315
314
|
: [];
|
|
@@ -371,7 +370,6 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
|
|
|
371
370
|
onClick: () => toggleShowMoveFolder(),
|
|
372
371
|
disabled: !!get(folderIds, "length"),
|
|
373
372
|
},
|
|
374
|
-
...shareItem,
|
|
375
373
|
// {
|
|
376
374
|
// key: FileActionsList.ARCHIVE,
|
|
377
375
|
// label: "Archive",
|
|
@@ -428,6 +426,6 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
|
|
|
428
426
|
? "md-lib-cursor-not-allowed md-lib-text-disabledBtnColor dark:md-lib-text-darkBorderColor"
|
|
429
427
|
: "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
|
|
430
428
|
? DELETE_CONFIRMATION_MESSAGE.replace(":action", actionType).replace(" :entity", "")
|
|
431
|
-
: 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 || undefined, files: getSelectedFiles(queryClient, folderId ? folderId : rootFolderId, generateFoldersQueryKey(type), file ? [get(file, "_id")] : fileIds), fileIds: file ? [get(file, "_id")] : fileIds, onCloseSelection: onCloseSelection })), showMoveFolder && (effectiveFile || file) && (_jsx(MoveToAnotherFolder, { open: showMoveFolder, handleCancel: toggleShowMoveFolder, fileIds: effectiveFile ? [get(effectiveFile, "_id")] : [get(file, "_id")], folderIds: [], entity: effectiveFile || file, onCloseSelection: onCloseSelection })), showShareModal && (_jsx(InviteTeamModal, { open: showShareModal, onClose: toggleShareModal, onFetchInvitations: () => { }, shareModal: true, fileIds:
|
|
429
|
+
: 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 || undefined, files: getSelectedFiles(queryClient, folderId ? folderId : rootFolderId, generateFoldersQueryKey(type), file ? [get(file, "_id")] : fileIds), fileIds: file ? [get(file, "_id")] : fileIds, onCloseSelection: onCloseSelection })), showMoveFolder && (effectiveFile || file) && (_jsx(MoveToAnotherFolder, { open: showMoveFolder, handleCancel: toggleShowMoveFolder, fileIds: effectiveFile ? [get(effectiveFile, "_id")] : [get(file, "_id")], folderIds: [], entity: effectiveFile || 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 }))] }));
|
|
432
430
|
}
|
|
433
431
|
export default FileMenuOptions;
|