@manuscripts/style-guide 0.30.23 → 0.30.26
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/dist/cjs/components/FileManager/FileManager.js +20 -38
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +4 -4
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActionsList.js +5 -5
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +4 -5
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +8 -8
- package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +2 -2
- package/dist/cjs/components/FileManager/FileSectionState.js +1 -16
- package/dist/cjs/components/FileManager/FilesSection.js +1 -6
- package/dist/cjs/components/FileManager/InlineFilesSection.js +6 -3
- package/dist/cjs/components/FileManager/util.js +7 -23
- package/dist/cjs/components/icons/attach.js +26 -0
- package/dist/cjs/components/icons/index.js +5 -1
- package/dist/cjs/components/icons/upload.js +13 -0
- package/dist/cjs/lib/inlineFiles.js +23 -15
- package/dist/es/components/FileManager/FileManager.js +21 -39
- package/dist/es/components/FileManager/FileSectionItem/DesignationActions.js +4 -4
- package/dist/es/components/FileManager/FileSectionItem/DesignationActionsList.js +5 -5
- package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +4 -5
- package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +8 -8
- package/dist/es/components/FileManager/FileSectionItem/ItemActions.js +2 -2
- package/dist/es/components/FileManager/FileSectionState.js +1 -16
- package/dist/es/components/FileManager/FilesSection.js +1 -6
- package/dist/es/components/FileManager/InlineFilesSection.js +6 -3
- package/dist/es/components/FileManager/util.js +5 -19
- package/dist/es/components/icons/attach.js +21 -0
- package/dist/es/components/icons/index.js +2 -0
- package/dist/es/components/icons/upload.js +8 -0
- package/dist/es/lib/inlineFiles.js +23 -15
- package/dist/types/components/FileManager/FileManager.d.ts +6 -5
- package/dist/types/components/FileManager/FileSectionItem/DesignationActions.d.ts +2 -1
- package/dist/types/components/FileManager/FileSectionItem/DesignationActionsList.d.ts +2 -1
- package/dist/types/components/FileManager/FileSectionItem/FileInfo.d.ts +2 -2
- package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +14 -4
- package/dist/types/components/FileManager/FileSectionItem/ItemActions.d.ts +4 -2
- package/dist/types/components/FileManager/FileSectionState.d.ts +2 -7
- package/dist/types/components/FileManager/FilesSection.d.ts +1 -1
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +2 -1
- package/dist/types/components/FileManager/UploadFileArea.d.ts +1 -1
- package/dist/types/components/FileManager/util.d.ts +5 -6
- package/dist/types/components/icons/attach.d.ts +18 -0
- package/dist/types/components/icons/index.d.ts +2 -0
- package/dist/types/components/icons/upload.d.ts +3 -0
- package/package.json +1 -1
|
@@ -46,48 +46,30 @@ const InlineFilesSection_1 = require("./InlineFilesSection");
|
|
|
46
46
|
const TooltipDiv_1 = require("./TooltipDiv");
|
|
47
47
|
const util_1 = require("./util");
|
|
48
48
|
exports.PermissionsContext = (0, react_1.createContext)(null);
|
|
49
|
-
const FileManager = ({ submissionId,
|
|
49
|
+
const FileManager = ({ submissionId, attachments, modelMap, enableDragAndDrop, can, handleUpload, handleDownload, handleReplace, handleChangeDesignation, }) => {
|
|
50
50
|
const [state, dispatch] = (0, react_1.useReducer)(FileSectionState_1.reducer, (0, FileSectionState_1.getInitialState)());
|
|
51
|
-
const handleReplaceFile = (0, react_1.useCallback)((submissionId, name, file, typeId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const handleReplaceFile = (0, react_1.useCallback)((submissionId, attachmentId, name, file, typeId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
52
|
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
53
53
|
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(util_1.namesWithDesignationMap.get(typeId) || util_1.Designation.Document));
|
|
54
|
-
const res = yield handleReplace(submissionId, name, file, typeId);
|
|
55
|
-
if (res) {
|
|
56
|
-
dispatch(FileSectionState_1.actions.SHOW_FILE_UPLOADED_ALERT());
|
|
57
|
-
}
|
|
54
|
+
const res = yield handleReplace(submissionId, attachmentId, name, file, typeId);
|
|
58
55
|
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
59
56
|
return res;
|
|
60
57
|
}), [handleReplace]);
|
|
61
58
|
const handleUploadFile = (0, react_1.useCallback)((submissionId, file, designation) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(util_1.Designation.Supplementary));
|
|
66
|
-
}
|
|
67
|
-
const res = yield handleUpload(submissionId, file, designation);
|
|
68
|
-
if (res) {
|
|
69
|
-
dispatch(FileSectionState_1.actions.SHOW_FILE_UPLOADED_ALERT());
|
|
70
|
-
}
|
|
71
|
-
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
72
|
-
return res;
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
console.error(e);
|
|
76
|
-
return false;
|
|
59
|
+
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
60
|
+
if (util_1.namesWithDesignationMap.get(designation) == util_1.Designation.Supplementary) {
|
|
61
|
+
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(util_1.Designation.Supplementary));
|
|
77
62
|
}
|
|
63
|
+
const res = yield handleUpload(submissionId, file, designation);
|
|
64
|
+
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
65
|
+
return res;
|
|
78
66
|
}), [handleUpload]);
|
|
79
|
-
const handleChangeDesignationFile = (0, react_1.useCallback)((submissionId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
dispatch(FileSectionState_1.actions.HANDLE_SUCCESS_MESSAGE());
|
|
84
|
-
}
|
|
85
|
-
return res;
|
|
86
|
-
}
|
|
87
|
-
catch (e) {
|
|
88
|
-
console.log(e);
|
|
89
|
-
return false;
|
|
67
|
+
const handleChangeDesignationFile = (0, react_1.useCallback)((submissionId, attachmentId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const res = yield handleChangeDesignation(submissionId, attachmentId, typeId, name);
|
|
69
|
+
if (res) {
|
|
70
|
+
dispatch(FileSectionState_1.actions.HANDLE_SUCCESS_MESSAGE());
|
|
90
71
|
}
|
|
72
|
+
return res;
|
|
91
73
|
}), [handleChangeDesignation]);
|
|
92
74
|
const handleDownloadFile = (0, react_1.useCallback)((publicUrl) => {
|
|
93
75
|
return handleDownload(publicUrl);
|
|
@@ -95,12 +77,12 @@ const FileManager = ({ submissionId, externalFiles, modelMap, enableDragAndDrop,
|
|
|
95
77
|
const getFileSectionExternalFile = (fileSection) => {
|
|
96
78
|
const isSupplementOrOtherFilesTab = fileSection === util_1.FileSectionType.Supplements ||
|
|
97
79
|
fileSection === util_1.FileSectionType.OtherFile;
|
|
98
|
-
const itemsData =
|
|
99
|
-
const designation = util_1.namesWithDesignationMap.get(element.
|
|
80
|
+
const itemsData = attachments.filter((element) => {
|
|
81
|
+
const designation = util_1.namesWithDesignationMap.get(element.type.label);
|
|
100
82
|
return (designation !== undefined &&
|
|
101
83
|
util_1.designationWithFileSectionsMap.get(designation) === fileSection);
|
|
102
84
|
});
|
|
103
|
-
const itemsDataWithTitle = (0, util_1.
|
|
85
|
+
const itemsDataWithTitle = (0, util_1.generateAttachmentsTitles)(itemsData, fileSection);
|
|
104
86
|
const filesItems = itemsDataWithTitle.map((element) => {
|
|
105
87
|
const itemProps = {
|
|
106
88
|
submissionId: submissionId,
|
|
@@ -114,10 +96,10 @@ const FileManager = ({ submissionId, externalFiles, modelMap, enableDragAndDrop,
|
|
|
114
96
|
dispatch: dispatch,
|
|
115
97
|
};
|
|
116
98
|
if (enableDragAndDrop && isSupplementOrOtherFilesTab) {
|
|
117
|
-
return (react_1.default.createElement(DraggableFileSectionItem_1.DraggableFileSectionItem, Object.assign({}, itemProps, { key: element.externalFile.
|
|
99
|
+
return (react_1.default.createElement(DraggableFileSectionItem_1.DraggableFileSectionItem, Object.assign({}, itemProps, { key: element.externalFile.id })));
|
|
118
100
|
}
|
|
119
101
|
else {
|
|
120
|
-
return (react_1.default.createElement(FileSectionItem_1.FileSectionItem, Object.assign({}, itemProps, { key: element.externalFile.
|
|
102
|
+
return (react_1.default.createElement(FileSectionItem_1.FileSectionItem, Object.assign({}, itemProps, { key: element.externalFile.id, isEditor: enableDragAndDrop })));
|
|
121
103
|
}
|
|
122
104
|
});
|
|
123
105
|
return filesItems;
|
|
@@ -148,7 +130,7 @@ const FileManager = ({ submissionId, externalFiles, modelMap, enableDragAndDrop,
|
|
|
148
130
|
react_1.default.createElement("div", null, "Files excluded from the final submission.")))),
|
|
149
131
|
react_1.default.createElement(Inspector_1.InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
|
150
132
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
151
|
-
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { modelMap: modelMap, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, dispatch: dispatch })),
|
|
133
|
+
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { modelMap: modelMap, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, isEditor: enableDragAndDrop, dispatch: dispatch })),
|
|
152
134
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
153
135
|
react_1.default.createElement(FilesSection_1.FilesSection, { submissionId: submissionId, enableDragAndDrop: enableDragAndDrop, handleUpload: handleUploadFile, fileSection: util_1.FileSectionType.Supplements, filesItem: getFileSectionExternalFile(util_1.FileSectionType.Supplements), state: state, dispatch: dispatch })),
|
|
154
136
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
@@ -29,7 +29,7 @@ const BottomArrowIcon_1 = __importDefault(require("../../icons/BottomArrowIcon")
|
|
|
29
29
|
const ConfirmationPopUp_1 = require("../ConfirmationPopUp");
|
|
30
30
|
const util_1 = require("../util");
|
|
31
31
|
const DesignationActionsList_1 = require("./DesignationActionsList");
|
|
32
|
-
const DesignationActions = ({ designation, fileExtension, handleChangeDesignation, submissionId, fileName, dispatch, }) => {
|
|
32
|
+
const DesignationActions = ({ designation, attachmentId, fileExtension, handleChangeDesignation, submissionId, fileName, dispatch, }) => {
|
|
33
33
|
const [isActionsShown, setIsActionsShown] = (0, react_1.useState)(false);
|
|
34
34
|
const [confirmationPopUpData, setConfirmationPopUpData] = (0, react_1.useState)({
|
|
35
35
|
isConfirmationPopUpOpen: false,
|
|
@@ -45,7 +45,7 @@ const DesignationActions = ({ designation, fileExtension, handleChangeDesignatio
|
|
|
45
45
|
const hideActionsList = () => {
|
|
46
46
|
setIsActionsShown(false);
|
|
47
47
|
};
|
|
48
|
-
if (designation && fileExtension) {
|
|
48
|
+
if (designation !== undefined && fileExtension) {
|
|
49
49
|
const designationActionsList = (0, util_1.getDesignationActionsList)(designation, fileExtension);
|
|
50
50
|
if (!designationActionsList.length) {
|
|
51
51
|
return null;
|
|
@@ -60,7 +60,7 @@ const DesignationActions = ({ designation, fileExtension, handleChangeDesignatio
|
|
|
60
60
|
};
|
|
61
61
|
const handleMoveAction = () => {
|
|
62
62
|
handleChangeDesignation &&
|
|
63
|
-
handleChangeDesignation(submissionId, confirmationPopUpData.selectedDesignation, fileName);
|
|
63
|
+
handleChangeDesignation(submissionId, attachmentId, confirmationPopUpData.selectedDesignation, fileName);
|
|
64
64
|
handleCloseAction();
|
|
65
65
|
};
|
|
66
66
|
const handleCloseAction = () => {
|
|
@@ -76,7 +76,7 @@ const DesignationActions = ({ designation, fileExtension, handleChangeDesignatio
|
|
|
76
76
|
react_1.default.createElement(SecondaryActionsText, null, util_1.designationWithReadableNamesMap.get(designation)),
|
|
77
77
|
react_1.default.createElement(BottomArrowIcon_1.default, null),
|
|
78
78
|
isActionsShown && (react_1.default.createElement(ActionsListContainer, null,
|
|
79
|
-
react_1.default.createElement(DesignationActionsList_1.DesignationActionsList, { handleChangeDesignation: handleChangeDesignation, designationActionsList: designationActionsList, submissionId: submissionId, fileName: fileName, designation: designation, dispatch: dispatch, handleOpenConfirmationPopup: handleOpenConfirmationPopup })))),
|
|
79
|
+
react_1.default.createElement(DesignationActionsList_1.DesignationActionsList, { handleChangeDesignation: handleChangeDesignation, designationActionsList: designationActionsList, submissionId: submissionId, fileName: fileName, designation: designation, attachmentId: attachmentId, dispatch: dispatch, handleOpenConfirmationPopup: handleOpenConfirmationPopup })))),
|
|
80
80
|
confirmationPopUpData.isConfirmationPopUpOpen && (react_1.default.createElement(ConfirmationPopUp_1.ConfirmationPopUp, { popupHeader: confirmationPopUpData.confirmationPopUpHeader !== undefined
|
|
81
81
|
? confirmationPopUpData.confirmationPopUpHeader
|
|
82
82
|
: '', popUpMessage: confirmationPopUpData.confirmationPopUpMessage !== undefined
|
|
@@ -8,17 +8,17 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const FileSectionState_1 = require("../FileSectionState");
|
|
9
9
|
const ItemsAction_1 = require("../ItemsAction");
|
|
10
10
|
const util_1 = require("../util");
|
|
11
|
-
const DesignationActionsList = ({ handleChangeDesignation, designationActionsList, submissionId, fileName, designation, dispatch, handleOpenConfirmationPopup, }) => {
|
|
11
|
+
const DesignationActionsList = ({ handleChangeDesignation, designationActionsList, submissionId, fileName, designation, attachmentId, dispatch, handleOpenConfirmationPopup, }) => {
|
|
12
12
|
const handleChangeOtherFilesTabDesignation = (designation, isMoveInOtherFileSection, confirmationPopupHeader, confirmationPopupMessage, successMoveMessage) => {
|
|
13
13
|
if (isMoveInOtherFileSection) {
|
|
14
14
|
if (dispatch) {
|
|
15
|
-
dispatch(FileSectionState_1.actions.MOVE_FILE(submissionId, (0, util_1.getDesignationName)(designation), fileName, successMoveMessage));
|
|
15
|
+
dispatch(FileSectionState_1.actions.MOVE_FILE(submissionId, attachmentId, (0, util_1.getDesignationName)(designation), fileName, successMoveMessage));
|
|
16
16
|
handleOpenConfirmationPopup(confirmationPopupHeader, confirmationPopupMessage, (0, util_1.getDesignationName)(designation));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
20
|
handleChangeDesignation &&
|
|
21
|
-
handleChangeDesignation(submissionId, (0, util_1.getDesignationName)(designation), fileName);
|
|
21
|
+
handleChangeDesignation(submissionId, attachmentId, (0, util_1.getDesignationName)(designation), fileName);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
const isSupplementaryActionIncluded = designationActionsList.indexOf(util_1.Designation.Supplementary) !== -1;
|
|
@@ -27,7 +27,7 @@ const DesignationActionsList = ({ handleChangeDesignation, designationActionsLis
|
|
|
27
27
|
.map((value) => {
|
|
28
28
|
return (react_1.default.createElement(ItemsAction_1.ActionsItem, { key: value, onClick: () => {
|
|
29
29
|
let isMoveToOtherFileSection = true;
|
|
30
|
-
if (designation) {
|
|
30
|
+
if (designation !== undefined) {
|
|
31
31
|
isMoveToOtherFileSection =
|
|
32
32
|
util_1.designationWithFileSectionsMap.get(designation) !==
|
|
33
33
|
util_1.FileSectionType.OtherFile;
|
|
@@ -43,7 +43,7 @@ const DesignationActionsList = ({ handleChangeDesignation, designationActionsLis
|
|
|
43
43
|
react_1.default.createElement(ItemsAction_1.ActionsSeparator, null),
|
|
44
44
|
react_1.default.createElement(ItemsAction_1.ActionsItem, { onClick: () => {
|
|
45
45
|
let isMoveToOtherFileSection = true;
|
|
46
|
-
if (designation) {
|
|
46
|
+
if (designation !== undefined) {
|
|
47
47
|
isMoveToOtherFileSection =
|
|
48
48
|
util_1.designationWithFileSectionsMap.get(designation) !==
|
|
49
49
|
util_1.FileSectionType.Supplements;
|
|
@@ -27,14 +27,14 @@ const react_1 = __importStar(require("react"));
|
|
|
27
27
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
28
28
|
const FileManager_1 = require("../FileManager");
|
|
29
29
|
const DesignationActions_1 = require("./DesignationActions");
|
|
30
|
-
const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissionAttachmentName, fileExtension, designation,
|
|
30
|
+
const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissionAttachmentName, fileExtension, designation, attachmentId, handleChangeDesignation, submissionId, dispatch, }) => {
|
|
31
31
|
const fileName = submissionAttachmentName.substring(0, submissionAttachmentName.lastIndexOf('.'));
|
|
32
32
|
const can = (0, react_1.useContext)(FileManager_1.PermissionsContext);
|
|
33
33
|
return (react_1.default.createElement(exports.FileInfoContainer, null,
|
|
34
34
|
(can === null || can === void 0 ? void 0 : can.changeDesignation) &&
|
|
35
35
|
showDesignationActions &&
|
|
36
|
-
designation &&
|
|
37
|
-
submissionId && (react_1.default.createElement(DesignationActions_1.DesignationActions, { designation: designation, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, submissionId: submissionId, fileName: submissionAttachmentName, dispatch: dispatch })),
|
|
36
|
+
designation !== undefined &&
|
|
37
|
+
submissionId && (react_1.default.createElement(DesignationActions_1.DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, submissionId: submissionId, fileName: submissionAttachmentName, dispatch: dispatch })),
|
|
38
38
|
react_1.default.createElement(exports.FileNameTitleContainer, null,
|
|
39
39
|
react_1.default.createElement(exports.FileTitle, null,
|
|
40
40
|
!showAttachmentName ? fileName : title,
|
|
@@ -43,8 +43,7 @@ const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissio
|
|
|
43
43
|
react_1.default.createElement(exports.FileName, null, fileName),
|
|
44
44
|
react_1.default.createElement("div", null,
|
|
45
45
|
".",
|
|
46
|
-
fileExtension))))
|
|
47
|
-
description && react_1.default.createElement(exports.FileDescription, null, description)));
|
|
46
|
+
fileExtension))))));
|
|
48
47
|
};
|
|
49
48
|
exports.FileInfo = FileInfo;
|
|
50
49
|
exports.FileInfoContainer = styled_components_1.default.div `
|
|
@@ -16,20 +16,20 @@ const FileTypeIcon_1 = require("./FileTypeIcon");
|
|
|
16
16
|
const ItemActions_1 = require("./ItemActions");
|
|
17
17
|
const FileSectionItem = ({ submissionId, externalFile, title, showAttachmentName = false, showDesignationActions = false, handleDownload, handleReplace, handleChangeDesignation, dispatch, dragRef, className, style, onClose, isEditor, }) => {
|
|
18
18
|
const { isOpen, toggleOpen, wrapperRef } = (0, use_dropdown_1.useDropdown)();
|
|
19
|
-
const fileExtension = externalFile.
|
|
20
|
-
const designation = util_1.namesWithDesignationMap.get(externalFile.
|
|
19
|
+
const fileExtension = externalFile.name.substring(externalFile.name.lastIndexOf('.') + 1);
|
|
20
|
+
const designation = util_1.namesWithDesignationMap.get(externalFile.type.label);
|
|
21
21
|
const isMainManuscript = designation === util_1.Designation.MainManuscript;
|
|
22
|
-
const isSelected = externalFile.
|
|
22
|
+
const isSelected = externalFile.id == window.location.hash.substr(1);
|
|
23
23
|
return (react_1.default.createElement(exports.Item, { ref: dragRef, className: className, style: style },
|
|
24
24
|
react_1.default.createElement(exports.ItemContainer, { onClick: () => {
|
|
25
25
|
window.location.hash =
|
|
26
|
-
isEditor && !isSelected ? `#${externalFile.
|
|
26
|
+
isEditor && !isSelected ? `#${externalFile.id}` : '#';
|
|
27
27
|
if (isSelected) {
|
|
28
|
-
window.location.hash = `#${externalFile.
|
|
28
|
+
window.location.hash = `#${externalFile.id}`;
|
|
29
29
|
}
|
|
30
30
|
} },
|
|
31
|
-
react_1.default.createElement(FileTypeIcon_1.FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.
|
|
32
|
-
react_1.default.createElement(FileInfo_1.FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions, submissionAttachmentName: externalFile.
|
|
31
|
+
react_1.default.createElement(FileTypeIcon_1.FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
|
|
32
|
+
react_1.default.createElement(FileInfo_1.FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions, submissionAttachmentName: externalFile.name, title: title, designation: designation, attachmentId: externalFile.id, handleChangeDesignation: handleChangeDesignation, submissionId: submissionId, dispatch: dispatch })),
|
|
33
33
|
onClose && (react_1.default.createElement(IconCloseButton, { onClick: (e) => {
|
|
34
34
|
e.preventDefault();
|
|
35
35
|
onClose();
|
|
@@ -38,7 +38,7 @@ const FileSectionItem = ({ submissionId, externalFile, title, showAttachmentName
|
|
|
38
38
|
handleDownload && handleReplace && submissionId && (react_1.default.createElement(Dropdown_1.DropdownContainer, { ref: wrapperRef },
|
|
39
39
|
react_1.default.createElement(exports.ActionsIcon, { onClick: toggleOpen, type: "button", "aria-label": "Download or Replace", "aria-pressed": isOpen },
|
|
40
40
|
react_1.default.createElement(dots_icon_1.default, null)),
|
|
41
|
-
isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { replaceAttachmentHandler: handleReplace, downloadAttachmentHandler: handleDownload, submissionId: submissionId, fileName: externalFile.
|
|
41
|
+
isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { replaceAttachmentHandler: handleReplace, downloadAttachmentHandler: handleDownload, submissionId: submissionId, attachmentId: externalFile.id, fileName: externalFile.name, designation: externalFile.type.label, publicUrl: externalFile.link, hideActionList: toggleOpen, dispatch: dispatch }))))));
|
|
42
42
|
};
|
|
43
43
|
exports.FileSectionItem = FileSectionItem;
|
|
44
44
|
const IconCloseButton = styled_components_1.default.button `
|
|
@@ -25,7 +25,7 @@ const Dropdown_1 = require("../../Dropdown");
|
|
|
25
25
|
const FileManager_1 = require("../FileManager");
|
|
26
26
|
const FileSectionState_1 = require("../FileSectionState");
|
|
27
27
|
const ItemsAction_1 = require("../ItemsAction");
|
|
28
|
-
const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, submissionId, fileName, designation, publicUrl, hideActionList, dispatch, dropDownClassName, }) => {
|
|
28
|
+
const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, submissionId, attachmentId, fileName, designation, publicUrl, hideActionList, dispatch, dropDownClassName, }) => {
|
|
29
29
|
const attachmentDesignation = designation == undefined ? 'undefined' : designation;
|
|
30
30
|
const fileInputRef = (0, react_1.useRef)(null);
|
|
31
31
|
const [selectedFile, setSelectedFile] = (0, react_1.useState)();
|
|
@@ -37,7 +37,7 @@ const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, subm
|
|
|
37
37
|
if (dispatch) {
|
|
38
38
|
dispatch(FileSectionState_1.actions.UPLOAD_FILE(file));
|
|
39
39
|
}
|
|
40
|
-
replaceAttachmentHandler(submissionId, fileName, file, attachmentDesignation);
|
|
40
|
+
replaceAttachmentHandler(submissionId, attachmentId, fileName, file, attachmentDesignation);
|
|
41
41
|
hideActionList();
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -4,7 +4,6 @@ exports.actions = exports.reducer = exports.getInitialState = void 0;
|
|
|
4
4
|
const getInitialState = () => ({
|
|
5
5
|
uploadedFile: undefined,
|
|
6
6
|
isUploadFile: false,
|
|
7
|
-
isFileUploaded: false,
|
|
8
7
|
moveToOtherState: undefined,
|
|
9
8
|
successMessage: '',
|
|
10
9
|
isShowSuccessMessage: false,
|
|
@@ -21,8 +20,6 @@ var ActionTypes;
|
|
|
21
20
|
ActionTypes["HANDLE_UPLOAD_ACTION"] = "handleUpload";
|
|
22
21
|
ActionTypes["HANDLE_FINISH_UPLOAD"] = "handleFinishUpload";
|
|
23
22
|
ActionTypes["HANDLE_SUCCESS_MESSAGE"] = "handleSuccessMessage";
|
|
24
|
-
ActionTypes["SHOW_FILE_UPLOADED_ALERT"] = "showFileUploadedAlert";
|
|
25
|
-
ActionTypes["CLOSE_FILE_UPLOADED_ALERT"] = "closeFileUploadedAlert";
|
|
26
23
|
})(ActionTypes || (ActionTypes = {}));
|
|
27
24
|
const reducer = (state, action) => {
|
|
28
25
|
switch (action.type) {
|
|
@@ -48,15 +45,9 @@ const reducer = (state, action) => {
|
|
|
48
45
|
case ActionTypes.HANDLE_FINISH_UPLOAD: {
|
|
49
46
|
return Object.assign(Object.assign({}, state), { isUploadFile: false, uploadedFile: undefined, selectDesignation: undefined });
|
|
50
47
|
}
|
|
51
|
-
case ActionTypes.SHOW_FILE_UPLOADED_ALERT: {
|
|
52
|
-
return Object.assign(Object.assign({}, state), { isFileUploaded: true });
|
|
53
|
-
}
|
|
54
48
|
case ActionTypes.HANDLE_SUCCESS_MESSAGE: {
|
|
55
49
|
return Object.assign(Object.assign({}, state), { isShowSuccessMessage: true });
|
|
56
50
|
}
|
|
57
|
-
case ActionTypes.CLOSE_FILE_UPLOADED_ALERT: {
|
|
58
|
-
return Object.assign(Object.assign({}, state), { isFileUploaded: false });
|
|
59
|
-
}
|
|
60
51
|
}
|
|
61
52
|
return state;
|
|
62
53
|
};
|
|
@@ -76,7 +67,7 @@ exports.actions = {
|
|
|
76
67
|
type: ActionTypes.SELECT_DESIGNATION,
|
|
77
68
|
designation,
|
|
78
69
|
}),
|
|
79
|
-
MOVE_FILE: (submissionId, typeId, name, successMoveMessage) => ({
|
|
70
|
+
MOVE_FILE: (submissionId, attachmentId, typeId, name, successMoveMessage) => ({
|
|
80
71
|
type: ActionTypes.MOVE_FILE,
|
|
81
72
|
submissionId,
|
|
82
73
|
typeId,
|
|
@@ -86,12 +77,6 @@ exports.actions = {
|
|
|
86
77
|
HANDLE_FINISH_UPLOAD: () => ({
|
|
87
78
|
type: ActionTypes.HANDLE_FINISH_UPLOAD,
|
|
88
79
|
}),
|
|
89
|
-
SHOW_FILE_UPLOADED_ALERT: () => ({
|
|
90
|
-
type: ActionTypes.SHOW_FILE_UPLOADED_ALERT,
|
|
91
|
-
}),
|
|
92
|
-
CLOSE_FILE_UPLOADED_ALERT: () => ({
|
|
93
|
-
type: ActionTypes.CLOSE_FILE_UPLOADED_ALERT,
|
|
94
|
-
}),
|
|
95
80
|
HANDLE_SUCCESS_MESSAGE: () => ({
|
|
96
81
|
type: ActionTypes.HANDLE_SUCCESS_MESSAGE,
|
|
97
82
|
}),
|
|
@@ -21,7 +21,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.FilesSection = void 0;
|
|
23
23
|
const react_1 = __importStar(require("react"));
|
|
24
|
-
const AlertMessage_1 = require("../AlertMessage");
|
|
25
24
|
const DragItemArea_1 = require("./DragItemArea");
|
|
26
25
|
const FileManager_1 = require("./FileManager");
|
|
27
26
|
const FileSectionUploadItem_1 = require("./FileSectionItem/FileSectionUploadItem");
|
|
@@ -48,11 +47,7 @@ const FilesSection = ({ submissionId, enableDragAndDrop, handleUpload, fileSecti
|
|
|
48
47
|
(isOtherFileTab || isSupplementFilesTab) && (react_1.default.createElement(UploadFileArea_1.UploadFileArea, { handleUploadFile: handleUpload, fileSection: fileSection, submissionId: submissionId, dispatch: dispatch })),
|
|
49
48
|
state.isUploadFile &&
|
|
50
49
|
state.uploadedFile &&
|
|
51
|
-
state.selectDesignation !== undefined && (react_1.default.createElement(FileSectionUploadItem_1.FileSectionUploadItem, { submissionId: submissionId, fileName: state.uploadedFile.name, isLoading: state.isUploadFile })),
|
|
52
|
-
state.isFileUploaded && (react_1.default.createElement(AlertMessage_1.AlertMessage, { type: AlertMessage_1.AlertMessageType.info, hideCloseButton: true, dismissButton: {
|
|
53
|
-
action: () => dispatch(FileSectionState_1.actions.CLOSE_FILE_UPLOADED_ALERT()),
|
|
54
|
-
text: 'Close',
|
|
55
|
-
} }, "File uploaded successfully. It may take a few moments to show the new file in the Inspector.")))),
|
|
50
|
+
state.selectDesignation !== undefined && (react_1.default.createElement(FileSectionUploadItem_1.FileSectionUploadItem, { submissionId: submissionId, fileName: state.uploadedFile.name, isLoading: state.isUploadFile })))),
|
|
56
51
|
state.uploadedFile && isOtherFileTab && (react_1.default.createElement(SelectDialogDesignation_1.SelectDialogDesignation, { isOpen: state.isOpenSelectDesignationPopup, fileExtension: uploadedFileExtension, handleCancel: () => {
|
|
57
52
|
dispatch(FileSectionState_1.actions.HANDLE_CANCEL_UPLOAD());
|
|
58
53
|
}, uploadFileHandler: () => handleUploadOtherFile(), dispatch: dispatch, fileSection: fileSection })),
|
|
@@ -32,16 +32,19 @@ const FileInfo_1 = require("./FileSectionItem/FileInfo");
|
|
|
32
32
|
const FileSectionItem_1 = require("./FileSectionItem/FileSectionItem");
|
|
33
33
|
const ItemActions_1 = require("./FileSectionItem/ItemActions");
|
|
34
34
|
const util_1 = require("./util");
|
|
35
|
-
const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, modelMap, dispatch }) => {
|
|
35
|
+
const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, modelMap, isEditor, dispatch, }) => {
|
|
36
36
|
const inlineFiles = (0, react_1.useMemo)(() => (0, inlineFiles_1.default)(modelMap), [modelMap]);
|
|
37
37
|
const onElementClick = (0, react_1.useCallback)((e) => {
|
|
38
|
+
if (!isEditor) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
38
41
|
const { id } = e.currentTarget;
|
|
39
42
|
const isSelected = id == window.location.hash.substr(1);
|
|
40
43
|
window.location.hash = !isSelected ? `#${id}` : '#';
|
|
41
44
|
if (isSelected) {
|
|
42
45
|
window.location.hash = `#${id}`;
|
|
43
46
|
}
|
|
44
|
-
}, []);
|
|
47
|
+
}, [isEditor]);
|
|
45
48
|
return (react_1.default.createElement("div", null, inlineFiles.map((file, index) => {
|
|
46
49
|
var _a;
|
|
47
50
|
return (react_1.default.createElement(ElementItem, { className: 'item', key: index, id: file.id, onClick: onElementClick },
|
|
@@ -68,7 +71,7 @@ const FileReference = ({ externalFile, submissionId, handleReplace, handleDownlo
|
|
|
68
71
|
handleDownload && handleReplace && submissionId && (react_1.default.createElement(DropdownContainer, { ref: wrapperRef },
|
|
69
72
|
react_1.default.createElement(FileSectionItem_1.ActionsIcon, { onClick: toggleOpen, type: "button", className: 'external_file_dropdown', "aria-label": "Download or Replace", "aria-pressed": isOpen },
|
|
70
73
|
react_1.default.createElement(dots_icon_1.default, null)),
|
|
71
|
-
isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { replaceAttachmentHandler: handleReplace, downloadAttachmentHandler: handleDownload, submissionId: submissionId, fileName: externalFile.filename, designation: externalFile.designation, publicUrl: externalFile.publicUrl, hideActionList: toggleOpen, dispatch: dispatch, dropDownClassName: 'ref_item_dropdown' }))))));
|
|
74
|
+
isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { replaceAttachmentHandler: handleReplace, downloadAttachmentHandler: handleDownload, submissionId: submissionId, attachmentId: undefined, fileName: externalFile.filename, designation: externalFile.designation, publicUrl: externalFile.publicUrl, hideActionList: toggleOpen, dispatch: dispatch, dropDownClassName: 'ref_item_dropdown' }))))));
|
|
72
75
|
};
|
|
73
76
|
const ElementItem = (0, styled_components_1.default)(FileSectionItem_1.Item) `
|
|
74
77
|
display: flex;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.droppableSections = exports.getUploadFileDesignationList = exports.getDesignationByFileSection = exports.getDesignationName = exports.getDesignationActionsList = exports.generateAttachmentsTitles = exports.fileTypesWithIconMap = exports.fileTypesWithTitlesMap = exports.extensionsWithFileTypesMap = exports.designationWithAllowedDesignationsToTransitionMap = exports.designationWithAllowedMediaTypesMap = exports.designationWithReadableNamesMap = exports.namesWithDesignationMap = exports.designationWithFileSectionsMap = exports.Designation = exports.FileType = exports.FileSectionType = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const audio_icon_1 = __importDefault(require("../icons/audio-icon"));
|
|
9
9
|
const code_file_icon_1 = __importDefault(require("../icons/code-file-icon"));
|
|
@@ -56,8 +56,8 @@ var Designation;
|
|
|
56
56
|
Designation[Designation["MainManuscript"] = 13] = "MainManuscript";
|
|
57
57
|
})(Designation = exports.Designation || (exports.Designation = {}));
|
|
58
58
|
exports.designationWithFileSectionsMap = new Map([
|
|
59
|
-
[Designation.Figure, FileSectionType.
|
|
60
|
-
[Designation.Table, FileSectionType.
|
|
59
|
+
[Designation.Figure, FileSectionType.OtherFile],
|
|
60
|
+
[Designation.Table, FileSectionType.OtherFile],
|
|
61
61
|
[Designation.Supplementary, FileSectionType.Supplements],
|
|
62
62
|
[Designation.ConflictOfInterest, FileSectionType.OtherFile],
|
|
63
63
|
[Designation.Document, FileSectionType.OtherFile],
|
|
@@ -352,15 +352,15 @@ exports.fileTypesWithIconMap = new Map([
|
|
|
352
352
|
],
|
|
353
353
|
[undefined, react_1.default.createElement(unknown_format_file_icon_1.default, { key: undefined })],
|
|
354
354
|
]);
|
|
355
|
-
const
|
|
355
|
+
const generateAttachmentsTitles = (externalFiles, fileSectionType) => {
|
|
356
356
|
const titleCountersMap = new Map();
|
|
357
357
|
const externalFilesWithTitlesMap = new Map();
|
|
358
358
|
externalFiles.forEach((element) => {
|
|
359
|
-
const fileExtension = element.
|
|
359
|
+
const fileExtension = element.name.substring(element.name.lastIndexOf('.') + 1);
|
|
360
360
|
const fileType = exports.extensionsWithFileTypesMap.get(fileExtension.toLowerCase());
|
|
361
361
|
const fileTitle = exports.fileTypesWithTitlesMap.get(fileType);
|
|
362
362
|
if (fileSectionType === FileSectionType.Inline) {
|
|
363
|
-
externalFilesWithTitlesMap.set(element.
|
|
363
|
+
externalFilesWithTitlesMap.set(element.name, element);
|
|
364
364
|
}
|
|
365
365
|
else {
|
|
366
366
|
if (fileTitle !== undefined) {
|
|
@@ -383,15 +383,7 @@ const generateExternalFilesTitles = (externalFiles, fileSectionType) => {
|
|
|
383
383
|
}));
|
|
384
384
|
return result;
|
|
385
385
|
};
|
|
386
|
-
exports.
|
|
387
|
-
const sortExternalFiles = (externalFile) => externalFile
|
|
388
|
-
.sort((a, b) => Number(a.createdAt) - Number(b.createdAt))
|
|
389
|
-
.sort((a, b) => b.designation === 'main-manuscript'
|
|
390
|
-
? 1
|
|
391
|
-
: a.designation === 'main-manuscript'
|
|
392
|
-
? -1
|
|
393
|
-
: 0);
|
|
394
|
-
exports.sortExternalFiles = sortExternalFiles;
|
|
386
|
+
exports.generateAttachmentsTitles = generateAttachmentsTitles;
|
|
395
387
|
const getDesignationActionsList = (designation, fileExtension) => {
|
|
396
388
|
const allowedDesignationsToTransition = exports.designationWithAllowedDesignationsToTransitionMap.get(designation);
|
|
397
389
|
if (allowedDesignationsToTransition) {
|
|
@@ -479,11 +471,3 @@ exports.droppableSections = [
|
|
|
479
471
|
FileSectionType.Supplements,
|
|
480
472
|
FileSectionType.OtherFile,
|
|
481
473
|
];
|
|
482
|
-
const isOfDesignation = (file, designation) => {
|
|
483
|
-
const formats = exports.designationWithAllowedMediaTypesMap.get(designation);
|
|
484
|
-
return !!(formats === null || formats === void 0 ? void 0 : formats.find((type) => file.MIME.indexOf('/' + type) >= 0));
|
|
485
|
-
};
|
|
486
|
-
const isFigure = (file) => {
|
|
487
|
-
return isOfDesignation(file, Designation.Figure);
|
|
488
|
-
};
|
|
489
|
-
exports.isFigure = isFigure;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2022 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const react_1 = __importDefault(require("react"));
|
|
22
|
+
const AttachIcon = () => {
|
|
23
|
+
return (react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
24
|
+
react_1.default.createElement("path", { d: "M8.85683 5.35715L5.85183 8.36215C5.16883 9.04515 5.16883 10.1531 5.85183 10.8371C6.53483 11.5201 7.64283 11.5201 8.32683 10.8371L12.3928 6.77115C13.7598 5.40415 13.7598 3.18815 12.3928 1.82115C11.0258 0.454148 8.80983 0.454148 7.44283 1.82115L3.02383 6.24115C0.973828 8.29115 0.973828 11.6151 3.02383 13.6661C5.07383 15.7161 8.39783 15.7161 10.4488 13.6661L14.5138 9.60015", stroke: "#6E6E6E", strokeWidth: "1.5", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
25
|
+
};
|
|
26
|
+
exports.default = AttachIcon;
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.TaskStepNextIcon = exports.TaskStepDoneIcon = exports.TaskStepCurrentIcon = exports.ZoomOutIcon = exports.ZoomInIcon = exports.UserIcon = exports.TickMarkIcon = exports.SearchIcon = exports.ProjectsListIcon = exports.ProjectIcon = exports.ProjectNotificationIcon = exports.OrcidIcon = exports.GoogleIcon = exports.CloseOIcon = exports.BookmarkIcon = exports.BackArrowIcon = exports.AddIconInverted = exports.AddIconActive = exports.AddAuthor = void 0;
|
|
21
|
+
exports.UploadIcon = exports.AttachIcon = exports.TaskStepNextIcon = exports.TaskStepDoneIcon = exports.TaskStepCurrentIcon = exports.ZoomOutIcon = exports.ZoomInIcon = exports.UserIcon = exports.TickMarkIcon = exports.SearchIcon = exports.ProjectsListIcon = exports.ProjectIcon = exports.ProjectNotificationIcon = exports.OrcidIcon = exports.GoogleIcon = exports.CloseOIcon = exports.BookmarkIcon = exports.BackArrowIcon = exports.AddIconInverted = exports.AddIconActive = exports.AddAuthor = void 0;
|
|
22
22
|
var add_author_1 = require("./add-author");
|
|
23
23
|
Object.defineProperty(exports, "AddAuthor", { enumerable: true, get: function () { return __importDefault(add_author_1).default; } });
|
|
24
24
|
var add_icon_active_1 = require("./add-icon-active");
|
|
@@ -57,3 +57,7 @@ var task_step_done_1 = require("./task-step-done");
|
|
|
57
57
|
Object.defineProperty(exports, "TaskStepDoneIcon", { enumerable: true, get: function () { return __importDefault(task_step_done_1).default; } });
|
|
58
58
|
var task_step_next_1 = require("./task-step-next");
|
|
59
59
|
Object.defineProperty(exports, "TaskStepNextIcon", { enumerable: true, get: function () { return __importDefault(task_step_next_1).default; } });
|
|
60
|
+
var attach_1 = require("./attach");
|
|
61
|
+
Object.defineProperty(exports, "AttachIcon", { enumerable: true, get: function () { return __importDefault(attach_1).default; } });
|
|
62
|
+
var upload_1 = require("./upload");
|
|
63
|
+
Object.defineProperty(exports, "UploadIcon", { enumerable: true, get: function () { return __importDefault(upload_1).default; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const UploadIcon = () => {
|
|
8
|
+
return (react_1.default.createElement("svg", { width: "17", height: "18", viewBox: "0 0 17 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
9
|
+
react_1.default.createElement("path", { d: "M8.5 12.5V1.5", stroke: "#6E6E6E", strokeWidth: "1.5", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
10
|
+
react_1.default.createElement("path", { d: "M13.5 6.5L8.5 1.5L3.5 6.5", stroke: "#6E6E6E", strokeWidth: "1.5", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
11
|
+
react_1.default.createElement("path", { d: "M15.5 16.5H1.5", stroke: "#6E6E6E", strokeWidth: "1.5", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
12
|
+
};
|
|
13
|
+
exports.default = UploadIcon;
|
|
@@ -7,14 +7,17 @@ const getCaptionText = (caption) => caption &&
|
|
|
7
7
|
new DOMParser().parseFromString(caption, 'text/html').documentElement
|
|
8
8
|
.innerText;
|
|
9
9
|
const getFigureData = (element, modelMap) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const externalFileReferences = [];
|
|
11
|
+
element.containedObjectIDs.map((e) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const object = modelMap.get(e);
|
|
14
|
+
if (object && object.objectType === manuscripts_json_schema_1.ObjectTypes.Figure) {
|
|
15
|
+
const externalFileRef = (_a = object.externalFileReferences) === null || _a === void 0 ? void 0 : _a.find((figure) => figure.kind === 'imageRepresentation');
|
|
16
|
+
if (externalFileRef) {
|
|
17
|
+
externalFileReferences.push(externalFileRef);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
13
20
|
});
|
|
14
|
-
const { externalFileReferences } = (figureId &&
|
|
15
|
-
modelMap.get(figureId)) || {
|
|
16
|
-
externalFileReferences: undefined,
|
|
17
|
-
};
|
|
18
21
|
return {
|
|
19
22
|
id: element._id,
|
|
20
23
|
externalFileReferences,
|
|
@@ -36,25 +39,30 @@ exports.default = (modelMap) => {
|
|
|
36
39
|
}
|
|
37
40
|
else {
|
|
38
41
|
(_b = section.elementIDs) === null || _b === void 0 ? void 0 : _b.map((elementId) => {
|
|
42
|
+
var _a;
|
|
39
43
|
const element = modelMap.get(elementId);
|
|
40
44
|
if (!element) {
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
43
47
|
switch (element.objectType) {
|
|
44
|
-
case manuscripts_json_schema_1.ObjectTypes.FigureElement:
|
|
48
|
+
case manuscripts_json_schema_1.ObjectTypes.FigureElement:
|
|
49
|
+
case manuscripts_json_schema_1.ObjectTypes.MultiGraphicFigureElement: {
|
|
45
50
|
files.push(Object.assign(Object.assign({}, getFigureData(element, modelMap)), { label: `Figure`, type: util_1.FileType.Figure }));
|
|
46
51
|
break;
|
|
47
52
|
}
|
|
48
53
|
case manuscripts_json_schema_1.ObjectTypes.TableElement: {
|
|
49
54
|
const tableElement = element;
|
|
50
55
|
const table = modelMap.get(tableElement.containedObjectID);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const externalFileReferences = (_a = table.externalFileReferences) === null || _a === void 0 ? void 0 : _a.filter((file) => file.kind === 'dataset' && file.ref);
|
|
57
|
+
if (externalFileReferences && externalFileReferences.length > 0) {
|
|
58
|
+
files.push({
|
|
59
|
+
id: element._id,
|
|
60
|
+
label: `Table`,
|
|
61
|
+
type: util_1.FileType.SheetsWorkbooks,
|
|
62
|
+
externalFileReferences: table.externalFileReferences,
|
|
63
|
+
caption: getCaptionText(tableElement.caption),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
58
66
|
break;
|
|
59
67
|
}
|
|
60
68
|
}
|