@manuscripts/style-guide 0.30.22 → 0.30.25
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 +21 -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 +10 -11
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +8 -8
- package/dist/cjs/components/FileManager/FileSectionItem/FileTypeIcon.js +9 -18
- package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +3 -3
- 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 +156 -0
- package/dist/cjs/components/FileManager/util.js +17 -24
- package/dist/cjs/components/icons/audio-icon.js +4 -4
- package/dist/cjs/components/icons/code-file-icon.js +4 -4
- package/dist/cjs/components/icons/compressed-file-icon.js +11 -11
- package/dist/cjs/components/icons/document-icon-with-dot.js +28 -0
- package/dist/cjs/components/icons/document-icon.js +5 -5
- package/dist/cjs/components/icons/figure-icon.js +4 -4
- package/dist/cjs/components/icons/graphical_abstract_icon.js +26 -0
- package/dist/cjs/components/icons/image-icon.js +24 -0
- package/dist/cjs/components/icons/latex-icon.js +6 -6
- package/dist/cjs/components/icons/pdf-file-icon.js +3 -3
- package/dist/cjs/components/icons/table-icon.js +2 -4
- package/dist/cjs/components/icons/unknown-format-file-icon.js +3 -3
- package/dist/cjs/components/icons/video-icon.js +2 -2
- package/dist/cjs/hooks/use-dropdown.js +2 -1
- package/dist/cjs/lib/inlineFiles.js +73 -0
- package/dist/es/components/FileManager/FileManager.js +22 -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 +7 -8
- package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +8 -8
- package/dist/es/components/FileManager/FileSectionItem/FileTypeIcon.js +9 -18
- package/dist/es/components/FileManager/FileSectionItem/ItemActions.js +3 -3
- 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 +130 -0
- package/dist/es/components/FileManager/util.js +15 -20
- package/dist/es/components/icons/audio-icon.js +4 -4
- package/dist/es/components/icons/code-file-icon.js +4 -4
- package/dist/es/components/icons/compressed-file-icon.js +11 -11
- package/dist/es/components/icons/document-icon-with-dot.js +23 -0
- package/dist/es/components/icons/document-icon.js +5 -5
- package/dist/es/components/icons/figure-icon.js +4 -4
- package/dist/es/components/icons/graphical_abstract_icon.js +21 -0
- package/dist/es/components/icons/image-icon.js +19 -0
- package/dist/es/components/icons/latex-icon.js +6 -6
- package/dist/es/components/icons/pdf-file-icon.js +3 -3
- package/dist/es/components/icons/table-icon.js +2 -4
- package/dist/es/components/icons/unknown-format-file-icon.js +3 -3
- package/dist/es/components/icons/video-icon.js +2 -2
- package/dist/es/hooks/use-dropdown.js +2 -1
- package/dist/es/lib/inlineFiles.js +71 -0
- package/dist/types/components/FileManager/FileManager.d.ts +7 -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 +5 -2
- package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +14 -4
- package/dist/types/components/FileManager/FileSectionItem/ItemActions.d.ts +6 -3
- 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 +16 -0
- package/dist/types/components/FileManager/UploadFileArea.d.ts +1 -1
- package/dist/types/components/FileManager/util.d.ts +8 -7
- package/dist/types/components/icons/document-icon-with-dot.d.ts +19 -0
- package/dist/types/components/icons/graphical_abstract_icon.d.ts +19 -0
- package/dist/types/components/icons/image-icon.d.ts +19 -0
- package/dist/types/hooks/use-dropdown.d.ts +1 -1
- package/dist/types/lib/inlineFiles.d.ts +11 -0
- package/package.json +4 -4
|
@@ -42,51 +42,34 @@ const DragLayer_1 = require("./FileSectionItem/DragLayer");
|
|
|
42
42
|
const FileSectionItem_1 = require("./FileSectionItem/FileSectionItem");
|
|
43
43
|
const FileSectionState_1 = require("./FileSectionState");
|
|
44
44
|
const FilesSection_1 = require("./FilesSection");
|
|
45
|
+
const InlineFilesSection_1 = require("./InlineFilesSection");
|
|
45
46
|
const TooltipDiv_1 = require("./TooltipDiv");
|
|
46
47
|
const util_1 = require("./util");
|
|
47
48
|
exports.PermissionsContext = (0, react_1.createContext)(null);
|
|
48
|
-
const FileManager = ({ submissionId,
|
|
49
|
+
const FileManager = ({ submissionId, attachments, modelMap, enableDragAndDrop, can, handleUpload, handleDownload, handleReplace, handleChangeDesignation, }) => {
|
|
49
50
|
const [state, dispatch] = (0, react_1.useReducer)(FileSectionState_1.reducer, (0, FileSectionState_1.getInitialState)());
|
|
50
|
-
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* () {
|
|
51
52
|
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
52
53
|
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(util_1.namesWithDesignationMap.get(typeId) || util_1.Designation.Document));
|
|
53
|
-
const res = yield handleReplace(submissionId, name, file, typeId);
|
|
54
|
-
if (res) {
|
|
55
|
-
dispatch(FileSectionState_1.actions.SHOW_FILE_UPLOADED_ALERT());
|
|
56
|
-
}
|
|
54
|
+
const res = yield handleReplace(submissionId, attachmentId, name, file, typeId);
|
|
57
55
|
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
58
56
|
return res;
|
|
59
57
|
}), [handleReplace]);
|
|
60
58
|
const handleUploadFile = (0, react_1.useCallback)((submissionId, file, designation) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(util_1.Designation.Supplementary));
|
|
65
|
-
}
|
|
66
|
-
const res = yield handleUpload(submissionId, file, designation);
|
|
67
|
-
if (res) {
|
|
68
|
-
dispatch(FileSectionState_1.actions.SHOW_FILE_UPLOADED_ALERT());
|
|
69
|
-
}
|
|
70
|
-
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
71
|
-
return res;
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
console.error(e);
|
|
75
|
-
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));
|
|
76
62
|
}
|
|
63
|
+
const res = yield handleUpload(submissionId, file, designation);
|
|
64
|
+
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
65
|
+
return res;
|
|
77
66
|
}), [handleUpload]);
|
|
78
|
-
const handleChangeDesignationFile = (0, react_1.useCallback)((submissionId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
dispatch(FileSectionState_1.actions.HANDLE_SUCCESS_MESSAGE());
|
|
83
|
-
}
|
|
84
|
-
return res;
|
|
85
|
-
}
|
|
86
|
-
catch (e) {
|
|
87
|
-
console.log(e);
|
|
88
|
-
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());
|
|
89
71
|
}
|
|
72
|
+
return res;
|
|
90
73
|
}), [handleChangeDesignation]);
|
|
91
74
|
const handleDownloadFile = (0, react_1.useCallback)((publicUrl) => {
|
|
92
75
|
return handleDownload(publicUrl);
|
|
@@ -94,12 +77,12 @@ const FileManager = ({ submissionId, externalFiles, enableDragAndDrop, can, hand
|
|
|
94
77
|
const getFileSectionExternalFile = (fileSection) => {
|
|
95
78
|
const isSupplementOrOtherFilesTab = fileSection === util_1.FileSectionType.Supplements ||
|
|
96
79
|
fileSection === util_1.FileSectionType.OtherFile;
|
|
97
|
-
const itemsData =
|
|
98
|
-
const designation = util_1.namesWithDesignationMap.get(element.
|
|
80
|
+
const itemsData = attachments.filter((element) => {
|
|
81
|
+
const designation = util_1.namesWithDesignationMap.get(element.type.label);
|
|
99
82
|
return (designation !== undefined &&
|
|
100
83
|
util_1.designationWithFileSectionsMap.get(designation) === fileSection);
|
|
101
84
|
});
|
|
102
|
-
const itemsDataWithTitle = (0, util_1.
|
|
85
|
+
const itemsDataWithTitle = (0, util_1.generateAttachmentsTitles)(itemsData, fileSection);
|
|
103
86
|
const filesItems = itemsDataWithTitle.map((element) => {
|
|
104
87
|
const itemProps = {
|
|
105
88
|
submissionId: submissionId,
|
|
@@ -113,10 +96,10 @@ const FileManager = ({ submissionId, externalFiles, enableDragAndDrop, can, hand
|
|
|
113
96
|
dispatch: dispatch,
|
|
114
97
|
};
|
|
115
98
|
if (enableDragAndDrop && isSupplementOrOtherFilesTab) {
|
|
116
|
-
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 })));
|
|
117
100
|
}
|
|
118
101
|
else {
|
|
119
|
-
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 })));
|
|
120
103
|
}
|
|
121
104
|
});
|
|
122
105
|
return filesItems;
|
|
@@ -147,7 +130,7 @@ const FileManager = ({ submissionId, externalFiles, enableDragAndDrop, can, hand
|
|
|
147
130
|
react_1.default.createElement("div", null, "Files excluded from the final submission.")))),
|
|
148
131
|
react_1.default.createElement(Inspector_1.InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
|
149
132
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
150
|
-
react_1.default.createElement(
|
|
133
|
+
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { modelMap: modelMap, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, isEditor: enableDragAndDrop, dispatch: dispatch })),
|
|
151
134
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
152
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 })),
|
|
153
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;
|
|
@@ -22,29 +22,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.FileName = exports.FileNameContainer = exports.FileInfoContainer = exports.FileInfo = void 0;
|
|
25
|
+
exports.FileDescription = exports.FileName = exports.FileNameContainer = exports.FileTitle = exports.FileNameTitleContainer = exports.FileInfoContainer = exports.FileInfo = void 0;
|
|
26
26
|
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 })),
|
|
38
|
-
react_1.default.createElement(FileNameTitleContainer, null,
|
|
39
|
-
react_1.default.createElement(FileTitle, null,
|
|
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
|
+
react_1.default.createElement(exports.FileNameTitleContainer, null,
|
|
39
|
+
react_1.default.createElement(exports.FileTitle, null,
|
|
40
40
|
!showAttachmentName ? fileName : title,
|
|
41
41
|
showAttachmentName && ':'),
|
|
42
42
|
showAttachmentName && (react_1.default.createElement(exports.FileNameContainer, null,
|
|
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(FileDescription, null, description)));
|
|
46
|
+
fileExtension))))));
|
|
48
47
|
};
|
|
49
48
|
exports.FileInfo = FileInfo;
|
|
50
49
|
exports.FileInfoContainer = styled_components_1.default.div `
|
|
@@ -56,11 +55,11 @@ exports.FileInfoContainer = styled_components_1.default.div `
|
|
|
56
55
|
align-items: start;
|
|
57
56
|
width: 100%;
|
|
58
57
|
`;
|
|
59
|
-
|
|
58
|
+
exports.FileNameTitleContainer = styled_components_1.default.div `
|
|
60
59
|
display: flex;
|
|
61
60
|
width: 100%;
|
|
62
61
|
`;
|
|
63
|
-
|
|
62
|
+
exports.FileTitle = styled_components_1.default.div `
|
|
64
63
|
color: ${(props) => props.theme.colors.text.primary};
|
|
65
64
|
font-weight: bold;
|
|
66
65
|
font-size: 16px;
|
|
@@ -82,7 +81,7 @@ exports.FileName = styled_components_1.default.div `
|
|
|
82
81
|
white-space: nowrap;
|
|
83
82
|
overflow: hidden;
|
|
84
83
|
`;
|
|
85
|
-
|
|
84
|
+
exports.FileDescription = styled_components_1.default.div `
|
|
86
85
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
87
86
|
font-size: 14px;
|
|
88
87
|
line-height: 20px;
|
|
@@ -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 `
|
|
@@ -7,46 +7,37 @@ exports.FileTypeIcon = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_tooltip_1 = __importDefault(require("react-tooltip"));
|
|
9
9
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
+
const document_icon_with_dot_1 = __importDefault(require("../../icons/document-icon-with-dot"));
|
|
10
11
|
const unknown_format_file_icon_1 = __importDefault(require("../../icons/unknown-format-file-icon"));
|
|
11
12
|
const TooltipDiv_1 = require("../TooltipDiv");
|
|
12
13
|
const util_1 = require("../util");
|
|
13
14
|
const FileTypeIcon = ({ withDot, fileExtension, alt }) => {
|
|
14
15
|
let fileIcon = react_1.default.createElement(unknown_format_file_icon_1.default, null);
|
|
16
|
+
if (withDot) {
|
|
17
|
+
return (react_1.default.createElement(Container, null,
|
|
18
|
+
react_1.default.createElement(document_icon_with_dot_1.default, null),
|
|
19
|
+
react_1.default.createElement(TooltipDiv_1.TooltipDiv, null,
|
|
20
|
+
react_1.default.createElement(react_tooltip_1.default, { id: "dot", place: "bottom", effect: "float", className: "tooltip" },
|
|
21
|
+
react_1.default.createElement("div", null, "Main manuscript. Only one file per submission")))));
|
|
22
|
+
}
|
|
15
23
|
if (fileExtension) {
|
|
16
24
|
const fileType = util_1.extensionsWithFileTypesMap.get(fileExtension.toLowerCase());
|
|
17
25
|
fileIcon = util_1.fileTypesWithIconMap.get(fileType);
|
|
18
26
|
}
|
|
19
|
-
return
|
|
20
|
-
withDot && react_1.default.createElement(Dot, { "data-for": "dot", "data-tip": true }),
|
|
21
|
-
react_1.default.createElement(TooltipDiv_1.TooltipDiv, null,
|
|
22
|
-
react_1.default.createElement(react_tooltip_1.default, { id: "dot", place: "bottom", offset: { bottom: -7 }, effect: "solid", className: "tooltip" },
|
|
23
|
-
react_1.default.createElement("div", null, "Main manuscript. Only one file per submission"))),
|
|
24
|
-
fileIcon));
|
|
27
|
+
return react_1.default.createElement(Container, null, fileIcon);
|
|
25
28
|
};
|
|
26
29
|
exports.FileTypeIcon = FileTypeIcon;
|
|
27
30
|
const Container = styled_components_1.default.div `
|
|
28
31
|
width: 40px;
|
|
29
32
|
min-width: 40px;
|
|
30
33
|
height: 40px;
|
|
31
|
-
background-color: ${(props) => props.theme.colors.background.secondary};
|
|
32
34
|
display: flex;
|
|
33
35
|
justify-content: center;
|
|
34
36
|
align-items: center;
|
|
35
|
-
border: 1px solid #f2f2f2;
|
|
36
37
|
box-sizing: border-box;
|
|
37
38
|
border-radius: 4px;
|
|
38
39
|
position: relative;
|
|
39
40
|
`;
|
|
40
|
-
const Dot = styled_components_1.default.div `
|
|
41
|
-
width: 12px;
|
|
42
|
-
height: 12px;
|
|
43
|
-
background: #1a9bc7;
|
|
44
|
-
border: 2px solid #ffffff;
|
|
45
|
-
border-radius: 50%;
|
|
46
|
-
position: absolute;
|
|
47
|
-
top: -8px;
|
|
48
|
-
left: -8px;
|
|
49
|
-
`;
|
|
50
41
|
const Img = styled_components_1.default.img `
|
|
51
42
|
width: 100%;
|
|
52
43
|
height: 100%;
|
|
@@ -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, }) => {
|
|
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
|
};
|
|
@@ -46,7 +46,7 @@ const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, subm
|
|
|
46
46
|
fileInputRef.current.click();
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return (react_1.default.createElement(Dropdown_1.DropdownList, { direction: 'right', width: 125, height: 96, top: 5, onClick: hideActionList },
|
|
49
|
+
return (react_1.default.createElement(Dropdown_1.DropdownList, { direction: 'right', className: dropDownClassName, width: 125, height: 96, top: 5, onClick: hideActionList },
|
|
50
50
|
react_1.default.createElement(ItemsAction_1.ActionsItem, { onClick: () => {
|
|
51
51
|
publicUrl !== undefined ? downloadAttachmentHandler(publicUrl) : {};
|
|
52
52
|
} }, "Download"),
|
|
@@ -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 })),
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.InlineFilesSection = void 0;
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
28
|
+
const use_dropdown_1 = require("../../hooks/use-dropdown");
|
|
29
|
+
const inlineFiles_1 = __importDefault(require("../../lib/inlineFiles"));
|
|
30
|
+
const dots_icon_1 = __importDefault(require("../icons/dots-icon"));
|
|
31
|
+
const FileInfo_1 = require("./FileSectionItem/FileInfo");
|
|
32
|
+
const FileSectionItem_1 = require("./FileSectionItem/FileSectionItem");
|
|
33
|
+
const ItemActions_1 = require("./FileSectionItem/ItemActions");
|
|
34
|
+
const util_1 = require("./util");
|
|
35
|
+
const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, modelMap, isEditor, dispatch, }) => {
|
|
36
|
+
const inlineFiles = (0, react_1.useMemo)(() => (0, inlineFiles_1.default)(modelMap), [modelMap]);
|
|
37
|
+
const onElementClick = (0, react_1.useCallback)((e) => {
|
|
38
|
+
if (!isEditor) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const { id } = e.currentTarget;
|
|
42
|
+
const isSelected = id == window.location.hash.substr(1);
|
|
43
|
+
window.location.hash = !isSelected ? `#${id}` : '#';
|
|
44
|
+
if (isSelected) {
|
|
45
|
+
window.location.hash = `#${id}`;
|
|
46
|
+
}
|
|
47
|
+
}, [isEditor]);
|
|
48
|
+
return (react_1.default.createElement("div", null, inlineFiles.map((file, index) => {
|
|
49
|
+
var _a;
|
|
50
|
+
return (react_1.default.createElement(ElementItem, { className: 'item', key: index, id: file.id, onClick: onElementClick },
|
|
51
|
+
react_1.default.createElement(FileReferences, { className: 'refItems' }, (_a = file.externalFileReferences) === null || _a === void 0 ? void 0 : _a.map((externalFile, index) => (react_1.default.createElement(FileReference, { key: index, externalFile: externalFile.ref, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, dispatch: dispatch })))),
|
|
52
|
+
react_1.default.createElement(Element, { className: 'element' },
|
|
53
|
+
util_1.fileTypesWithIconMap.get(file.type),
|
|
54
|
+
react_1.default.createElement(FileInfo_1.FileInfoContainer, null,
|
|
55
|
+
react_1.default.createElement(FileInfo_1.FileNameTitleContainer, null,
|
|
56
|
+
react_1.default.createElement(FileInfo_1.FileTitle, null, file.label)),
|
|
57
|
+
file.caption && (react_1.default.createElement(FileInfo_1.FileDescription, null, file.caption))))));
|
|
58
|
+
})));
|
|
59
|
+
};
|
|
60
|
+
exports.InlineFilesSection = InlineFilesSection;
|
|
61
|
+
const FileReference = ({ externalFile, submissionId, handleReplace, handleDownload, dispatch, }) => {
|
|
62
|
+
const { isOpen, toggleOpen, wrapperRef } = (0, use_dropdown_1.useDropdown)();
|
|
63
|
+
if (!externalFile || !externalFile.filename) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const fileExtension = externalFile.filename.substring(externalFile.filename.lastIndexOf('.') + 1);
|
|
67
|
+
return (react_1.default.createElement(FileReferenceItem, { key: externalFile._id },
|
|
68
|
+
react_1.default.createElement(Container, null,
|
|
69
|
+
util_1.fileTypesWithIconMap.get(util_1.extensionsWithFileTypesMap.get(fileExtension)),
|
|
70
|
+
react_1.default.createElement(FileReferenceName, null, externalFile.filename)),
|
|
71
|
+
handleDownload && handleReplace && submissionId && (react_1.default.createElement(DropdownContainer, { ref: wrapperRef },
|
|
72
|
+
react_1.default.createElement(FileSectionItem_1.ActionsIcon, { onClick: toggleOpen, type: "button", className: 'external_file_dropdown', "aria-label": "Download or Replace", "aria-pressed": isOpen },
|
|
73
|
+
react_1.default.createElement(dots_icon_1.default, null)),
|
|
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' }))))));
|
|
75
|
+
};
|
|
76
|
+
const ElementItem = (0, styled_components_1.default)(FileSectionItem_1.Item) `
|
|
77
|
+
display: flex;
|
|
78
|
+
// this will allow us to select the previous sibling node,
|
|
79
|
+
// to change the background on the hover for adjacent node
|
|
80
|
+
flex-direction: column-reverse;
|
|
81
|
+
padding: 0;
|
|
82
|
+
|
|
83
|
+
:hover {
|
|
84
|
+
background: #f2fbfc;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.refItems:hover ~ .element {
|
|
88
|
+
background: white !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.refItems:hover {
|
|
92
|
+
background: white !important;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
border-bottom: 1px dashed #f0f0f0;
|
|
96
|
+
|
|
97
|
+
:last-child {
|
|
98
|
+
border-bottom: 0;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
const Container = styled_components_1.default.div `
|
|
102
|
+
display: flex;
|
|
103
|
+
`;
|
|
104
|
+
const Element = styled_components_1.default.div `
|
|
105
|
+
display: flex;
|
|
106
|
+
padding: 20px 15px;
|
|
107
|
+
`;
|
|
108
|
+
const FileReferences = styled_components_1.default.div ``;
|
|
109
|
+
const FileReferenceItem = styled_components_1.default.div `
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
|
|
114
|
+
svg {
|
|
115
|
+
width: 14px;
|
|
116
|
+
height: 17px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
path {
|
|
120
|
+
fill: #6e6e6e;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
padding: ${(props) => props.theme.grid.unit * 2}px
|
|
124
|
+
${(props) => props.theme.grid.unit * 4}px;
|
|
125
|
+
|
|
126
|
+
:hover {
|
|
127
|
+
background: #f2fbfc;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.external_file_dropdown {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
}
|
|
133
|
+
:hover .external_file_dropdown {
|
|
134
|
+
opacity: 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ref_item_dropdown {
|
|
138
|
+
top: 65%;
|
|
139
|
+
right: 10px;
|
|
140
|
+
width: 180px;
|
|
141
|
+
}
|
|
142
|
+
:last-child {
|
|
143
|
+
margin-bottom: 25px;
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
const FileReferenceName = styled_components_1.default.div `
|
|
147
|
+
font-family: ${(props) => props.theme.font.family.Lato};
|
|
148
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
149
|
+
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
150
|
+
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
151
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
152
|
+
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
153
|
+
`;
|
|
154
|
+
const DropdownContainer = styled_components_1.default.div `
|
|
155
|
+
position: relative;
|
|
156
|
+
`;
|