@manuscripts/style-guide 1.0.5 → 1.0.6-LEAN-2237
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 +1 -14
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +1 -3
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +2 -2
- package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +0 -1
- package/dist/cjs/components/FileManager/FilesSection.js +6 -13
- package/dist/cjs/components/icons/index.js +5 -1
- package/dist/cjs/components/icons/plus-icon.js +27 -0
- package/dist/es/components/FileManager/FileManager.js +2 -15
- package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +1 -3
- package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +2 -2
- package/dist/es/components/FileManager/FileSectionItem/ItemActions.js +0 -1
- package/dist/es/components/FileManager/FilesSection.js +8 -15
- package/dist/es/components/icons/index.js +2 -0
- package/dist/es/components/icons/plus-icon.js +20 -0
- package/dist/types/components/FileManager/FileManager.d.ts +0 -1
- package/dist/types/components/FileManager/FileSectionItem/FileInfo.d.ts +0 -5
- package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +1 -3
- package/dist/types/components/icons/index.d.ts +2 -0
- package/dist/types/components/icons/plus-icon.d.ts +18 -0
- package/package.json +1 -1
|
@@ -51,11 +51,10 @@ const InlineFilesSection_1 = require("./InlineFilesSection");
|
|
|
51
51
|
const TooltipDiv_1 = require("./TooltipDiv");
|
|
52
52
|
const util_1 = require("./util");
|
|
53
53
|
exports.PermissionsContext = (0, react_1.createContext)(null);
|
|
54
|
-
const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments,
|
|
54
|
+
const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments, replace, upload }, addAttachmentToState, }) => {
|
|
55
55
|
const [state, dispatch] = (0, react_1.useReducer)(FileSectionState_1.reducer, (0, FileSectionState_1.getInitialState)());
|
|
56
56
|
const handleReplaceFile = (0, react_1.useCallback)((attachmentId, name, file, typeId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
57
|
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
58
|
-
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(util_1.namesWithDesignationMap.get(typeId) || util_1.Designation.Document));
|
|
59
58
|
const res = yield replace(attachmentId, name, file, typeId);
|
|
60
59
|
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
61
60
|
if (res) {
|
|
@@ -65,9 +64,6 @@ const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManageme
|
|
|
65
64
|
}), [replace]);
|
|
66
65
|
const handleUploadFile = (0, react_1.useCallback)((file, designation) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
66
|
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
68
|
-
if (util_1.namesWithDesignationMap.get(designation) == util_1.Designation.Supplementary) {
|
|
69
|
-
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(util_1.Designation.Supplementary));
|
|
70
|
-
}
|
|
71
67
|
const res = yield upload(file, designation);
|
|
72
68
|
dispatch(FileSectionState_1.actions.HANDLE_FINISH_UPLOAD());
|
|
73
69
|
if (res) {
|
|
@@ -87,13 +83,6 @@ const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManageme
|
|
|
87
83
|
}
|
|
88
84
|
return response;
|
|
89
85
|
}), [upload, saveModel]);
|
|
90
|
-
const handleChangeDesignationFile = (0, react_1.useCallback)((attachmentId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
|
-
const res = yield changeDesignation(attachmentId, typeId, name);
|
|
92
|
-
if (res) {
|
|
93
|
-
dispatch(FileSectionState_1.actions.HANDLE_SUCCESS_MESSAGE(''));
|
|
94
|
-
}
|
|
95
|
-
return res;
|
|
96
|
-
}), [changeDesignation]);
|
|
97
86
|
const handleDownload = (0, react_1.useCallback)((url) => {
|
|
98
87
|
window.location.assign(url);
|
|
99
88
|
}, []);
|
|
@@ -125,11 +114,9 @@ const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManageme
|
|
|
125
114
|
externalFile: element.externalFile,
|
|
126
115
|
title: element.title,
|
|
127
116
|
showAttachmentName: isSupplementOrOtherFilesTab,
|
|
128
|
-
showDesignationActions: isSupplementOrOtherFilesTab,
|
|
129
117
|
showReplaceAction: !isOtherFilesTab,
|
|
130
118
|
handleDownload,
|
|
131
119
|
handleReplace: handleReplaceFile,
|
|
132
|
-
handleChangeDesignation: handleChangeDesignationFile,
|
|
133
120
|
dispatch: dispatch,
|
|
134
121
|
};
|
|
135
122
|
if (enableDragAndDrop && isSupplementOrOtherFilesTab) {
|
|
@@ -30,12 +30,10 @@ exports.FileDescription = exports.FileName = exports.FileNameContainer = exports
|
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const FileManager_1 = require("../FileManager");
|
|
33
|
-
const
|
|
34
|
-
const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissionAttachmentName, fileExtension, designation, attachmentId, handleChangeDesignation, dispatch, }) => {
|
|
33
|
+
const FileInfo = ({ showAttachmentName, title, submissionAttachmentName, fileExtension, attachmentId, dispatch, }) => {
|
|
35
34
|
const fileName = submissionAttachmentName.substring(0, submissionAttachmentName.lastIndexOf('.'));
|
|
36
35
|
const can = (0, react_1.useContext)(FileManager_1.PermissionsContext);
|
|
37
36
|
return (react_1.default.createElement(exports.FileInfoContainer, null,
|
|
38
|
-
showDesignationActions && designation !== undefined && (react_1.default.createElement(DesignationActions_1.DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName: submissionAttachmentName, dispatch: dispatch, can: can })),
|
|
39
37
|
react_1.default.createElement(exports.FileNameTitleContainer, null,
|
|
40
38
|
react_1.default.createElement(exports.FileTitle, null,
|
|
41
39
|
!showAttachmentName ? fileName : title,
|
|
@@ -14,7 +14,7 @@ const util_1 = require("../util");
|
|
|
14
14
|
const FileInfo_1 = require("./FileInfo");
|
|
15
15
|
const FileTypeIcon_1 = require("./FileTypeIcon");
|
|
16
16
|
const ItemActions_1 = require("./ItemActions");
|
|
17
|
-
const FileSectionItem = ({ externalFile, title, showAttachmentName = false,
|
|
17
|
+
const FileSectionItem = ({ externalFile, title, showAttachmentName = false, showReplaceAction = true, handleDownload, handleReplace, dispatch, dragRef, className, style, onClose, isEditor, }) => {
|
|
18
18
|
const { isOpen, toggleOpen, wrapperRef } = (0, use_dropdown_1.useDropdown)();
|
|
19
19
|
const fileExtension = externalFile.name.substring(externalFile.name.lastIndexOf('.') + 1);
|
|
20
20
|
const designation = util_1.namesWithDesignationMap.get(externalFile.type.label);
|
|
@@ -29,7 +29,7 @@ const FileSectionItem = ({ externalFile, title, showAttachmentName = false, show
|
|
|
29
29
|
}
|
|
30
30
|
} },
|
|
31
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,
|
|
32
|
+
react_1.default.createElement(FileInfo_1.FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, submissionAttachmentName: externalFile.name, title: title, attachmentId: externalFile.id, dispatch: dispatch })),
|
|
33
33
|
onClose && (react_1.default.createElement(IconCloseButton, { onClick: (e) => {
|
|
34
34
|
e.preventDefault();
|
|
35
35
|
onClose();
|
|
@@ -62,7 +62,6 @@ const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, deta
|
|
|
62
62
|
setSelectedFile(file);
|
|
63
63
|
if (dispatch) {
|
|
64
64
|
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
65
|
-
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(attachmentDesignationName || util_1.Designation.Document));
|
|
66
65
|
}
|
|
67
66
|
const result = yield replaceAttachmentHandler(attachmentId, fileName, file, attachmentDesignation);
|
|
68
67
|
if (typeof result === 'object' && handleUpdateInline) {
|
|
@@ -30,7 +30,6 @@ const DragItemArea_1 = require("./DragItemArea");
|
|
|
30
30
|
const FileManager_1 = require("./FileManager");
|
|
31
31
|
const FileSectionUploadItem_1 = require("./FileSectionItem/FileSectionUploadItem");
|
|
32
32
|
const FileSectionState_1 = require("./FileSectionState");
|
|
33
|
-
const SelectDialogDesignation_1 = require("./SelectDialogDesignation");
|
|
34
33
|
const UploadFileArea_1 = require("./UploadFileArea");
|
|
35
34
|
const util_1 = require("./util");
|
|
36
35
|
const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, filesItem, dispatch, state, }) => {
|
|
@@ -40,13 +39,12 @@ const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, filesItem,
|
|
|
40
39
|
}
|
|
41
40
|
const isSupplementFilesTab = fileSection === util_1.FileSectionType.Supplements;
|
|
42
41
|
const isOtherFileTab = fileSection === util_1.FileSectionType.OtherFile;
|
|
43
|
-
const handleUploadOtherFile = () => {
|
|
44
|
-
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
45
|
-
state.uploadedFile &&
|
|
46
|
-
state.selectDesignation !== undefined &&
|
|
47
|
-
handleUpload(state.uploadedFile, (0, util_1.getDesignationName)(state.selectDesignation));
|
|
48
|
-
};
|
|
49
42
|
const can = (0, react_1.useContext)(FileManager_1.PermissionsContext);
|
|
43
|
+
const EMPTY_DESIGNATION = '';
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
dispatch(FileSectionState_1.actions.HANDLE_UPLOAD_ACTION());
|
|
46
|
+
state.uploadedFile && handleUpload(state.uploadedFile, EMPTY_DESIGNATION);
|
|
47
|
+
}, [state.uploadedFile, dispatch, handleUpload]);
|
|
50
48
|
const handleSuccessMessage = () => {
|
|
51
49
|
return (react_1.default.createElement(AlertMessage_1.AlertMessage, { type: AlertMessage_1.AlertMessageType.success, hideCloseButton: true, dismissButton: {
|
|
52
50
|
text: 'OK',
|
|
@@ -56,14 +54,9 @@ const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, filesItem,
|
|
|
56
54
|
return (react_1.default.createElement("div", null,
|
|
57
55
|
(can === null || can === void 0 ? void 0 : can.uploadFile) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
58
56
|
(isOtherFileTab || isSupplementFilesTab) && (react_1.default.createElement(UploadFileArea_1.UploadFileArea, { handleUploadFile: handleUpload, fileSection: fileSection, dispatch: dispatch })),
|
|
59
|
-
state.isUploadFile &&
|
|
60
|
-
state.uploadedFile &&
|
|
61
|
-
state.selectDesignation !== undefined && (react_1.default.createElement(FileSectionUploadItem_1.FileSectionUploadItem, { fileName: state.uploadedFile.name, isLoading: state.isUploadFile })))),
|
|
57
|
+
state.isUploadFile && state.uploadedFile && (react_1.default.createElement(FileSectionUploadItem_1.FileSectionUploadItem, { fileName: state.uploadedFile.name, isLoading: state.isUploadFile })))),
|
|
62
58
|
state.fileUploadedSuccessfullySection === fileSection &&
|
|
63
59
|
handleSuccessMessage(),
|
|
64
|
-
react_1.default.createElement(SelectDialogDesignation_1.SelectDialogDesignation, { isOpen: state.showDesignationPopup === fileSection, fileExtension: uploadedFileExtension, handleCancel: () => {
|
|
65
|
-
dispatch(FileSectionState_1.actions.HANDLE_CANCEL_UPLOAD());
|
|
66
|
-
}, uploadFileHandler: handleUploadOtherFile, dispatch: dispatch, fileSection: fileSection }),
|
|
67
60
|
filesItem,
|
|
68
61
|
(can === null || can === void 0 ? void 0 : can.changeDesignation) &&
|
|
69
62
|
enableDragAndDrop &&
|
|
@@ -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.PullQuoteIcon = exports.BlockQuoteIcon = exports.LeftArrow = exports.AnnotatorIcon = exports.ReadingIcon = exports.EditIcon = exports.UnsupportedFormatFileIcon = exports.MissingImage = 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.AddComment = exports.CloseOIcon = exports.BookmarkIcon = exports.BackArrowIcon = exports.AddIconInverted = exports.AddIconActive = exports.AddAuthor = void 0;
|
|
21
|
+
exports.PlusIcon = exports.PullQuoteIcon = exports.BlockQuoteIcon = exports.LeftArrow = exports.AnnotatorIcon = exports.ReadingIcon = exports.EditIcon = exports.UnsupportedFormatFileIcon = exports.MissingImage = 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.AddComment = exports.CloseOIcon = exports.CloseIcon = 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");
|
|
@@ -29,6 +29,8 @@ var back_arrow_1 = require("./back-arrow");
|
|
|
29
29
|
Object.defineProperty(exports, "BackArrowIcon", { enumerable: true, get: function () { return __importDefault(back_arrow_1).default; } });
|
|
30
30
|
var bookmark_1 = require("./bookmark");
|
|
31
31
|
Object.defineProperty(exports, "BookmarkIcon", { enumerable: true, get: function () { return __importDefault(bookmark_1).default; } });
|
|
32
|
+
var close_icon_1 = require("./close-icon");
|
|
33
|
+
Object.defineProperty(exports, "CloseIcon", { enumerable: true, get: function () { return __importDefault(close_icon_1).default; } });
|
|
32
34
|
var close_o_icon_1 = require("./close-o-icon");
|
|
33
35
|
Object.defineProperty(exports, "CloseOIcon", { enumerable: true, get: function () { return __importDefault(close_o_icon_1).default; } });
|
|
34
36
|
var add_comment_icon_1 = require("./add-comment-icon");
|
|
@@ -79,3 +81,5 @@ var block_quote_icon_1 = require("./block-quote-icon");
|
|
|
79
81
|
Object.defineProperty(exports, "BlockQuoteIcon", { enumerable: true, get: function () { return __importDefault(block_quote_icon_1).default; } });
|
|
80
82
|
var pull_quote_icon_1 = require("./pull-quote-icon");
|
|
81
83
|
Object.defineProperty(exports, "PullQuoteIcon", { enumerable: true, get: function () { return __importDefault(pull_quote_icon_1).default; } });
|
|
84
|
+
var plus_icon_1 = require("./plus-icon");
|
|
85
|
+
Object.defineProperty(exports, "PlusIcon", { enumerable: true, get: function () { return __importDefault(plus_icon_1).default; } });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2023 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
|
+
exports.PlusIcon = void 0;
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const PlusIcon = () => (react_1.default.createElement("svg", { width: "11", height: "10", viewBox: "0 0 11 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
24
|
+
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 0.5C5.25147 0.5 5.05 0.701472 5.05 0.95V4.55H1.45C1.20147 4.55 1 4.75147 1 5C1 5.24853 1.20147 5.45 1.45 5.45H5.05V9.05C5.05 9.29853 5.25147 9.5 5.5 9.5C5.74853 9.5 5.95 9.29853 5.95 9.05V5.45H9.55C9.79853 5.45 10 5.24853 10 5C10 4.75147 9.79853 4.55 9.55 4.55H5.95V0.95C5.95 0.701472 5.74853 0.5 5.5 0.5Z", fill: "#6E6E6E" }),
|
|
25
|
+
react_1.default.createElement("path", { d: "M5.05 4.55V5.05H5.55V4.55H5.05ZM5.05 5.45H5.55V4.95H5.05V5.45ZM5.95 5.45V4.95H5.45V5.45H5.95ZM5.95 4.55H5.45V5.05H5.95V4.55ZM5.55 0.95C5.55 0.977614 5.52761 1 5.5 1V0C4.97533 0 4.55 0.425329 4.55 0.95H5.55ZM5.55 4.55V0.95H4.55V4.55H5.55ZM1.45 5.05H5.05V4.05H1.45V5.05ZM1.5 5C1.5 5.02761 1.47761 5.05 1.45 5.05V4.05C0.925329 4.05 0.5 4.47533 0.5 5H1.5ZM1.45 4.95C1.47761 4.95 1.5 4.97239 1.5 5H0.5C0.5 5.52467 0.925328 5.95 1.45 5.95V4.95ZM5.05 4.95H1.45V5.95H5.05V4.95ZM5.55 9.05V5.45H4.55V9.05H5.55ZM5.5 9C5.52761 9 5.55 9.02239 5.55 9.05H4.55C4.55 9.57467 4.97533 10 5.5 10V9ZM5.45 9.05C5.45 9.02239 5.47239 9 5.5 9V10C6.02467 10 6.45 9.57467 6.45 9.05H5.45ZM5.45 5.45V9.05H6.45V5.45H5.45ZM9.55 4.95H5.95V5.95H9.55V4.95ZM9.5 5C9.5 4.97239 9.52238 4.95 9.55 4.95V5.95C10.0747 5.95 10.5 5.52467 10.5 5H9.5ZM9.55 5.05C9.52239 5.05 9.5 5.02761 9.5 5H10.5C10.5 4.47533 10.0747 4.05 9.55 4.05V5.05ZM5.95 5.05H9.55V4.05H5.95V5.05ZM5.45 0.95V4.55H6.45V0.95H5.45ZM5.5 1C5.47239 1 5.45 0.977615 5.45 0.95H6.45C6.45 0.425329 6.02467 0 5.5 0V1Z", fill: "#6E6E6E" })));
|
|
26
|
+
exports.PlusIcon = PlusIcon;
|
|
27
|
+
exports.default = exports.PlusIcon;
|
|
@@ -20,13 +20,12 @@ import { actions, getInitialState, reducer } from './FileSectionState';
|
|
|
20
20
|
import { FilesSection } from './FilesSection';
|
|
21
21
|
import { InlineFilesSection } from './InlineFilesSection';
|
|
22
22
|
import { TooltipDiv } from './TooltipDiv';
|
|
23
|
-
import {
|
|
23
|
+
import { generateAttachmentsTitles } from './util';
|
|
24
24
|
export const PermissionsContext = createContext(null);
|
|
25
|
-
export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments,
|
|
25
|
+
export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments, replace, upload }, addAttachmentToState, }) => {
|
|
26
26
|
const [state, dispatch] = useReducer(reducer, getInitialState());
|
|
27
27
|
const handleReplaceFile = useCallback((attachmentId, name, file, typeId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
28
|
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
29
|
-
dispatch(actions.SELECT_DESIGNATION(namesWithDesignationMap.get(typeId) || Designation.Document));
|
|
30
29
|
const res = yield replace(attachmentId, name, file, typeId);
|
|
31
30
|
dispatch(actions.HANDLE_FINISH_UPLOAD());
|
|
32
31
|
if (res) {
|
|
@@ -36,9 +35,6 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
|
|
|
36
35
|
}), [replace]);
|
|
37
36
|
const handleUploadFile = useCallback((file, designation) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
37
|
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
39
|
-
if (namesWithDesignationMap.get(designation) == Designation.Supplementary) {
|
|
40
|
-
dispatch(actions.SELECT_DESIGNATION(Designation.Supplementary));
|
|
41
|
-
}
|
|
42
38
|
const res = yield upload(file, designation);
|
|
43
39
|
dispatch(actions.HANDLE_FINISH_UPLOAD());
|
|
44
40
|
if (res) {
|
|
@@ -58,13 +54,6 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
|
|
|
58
54
|
}
|
|
59
55
|
return response;
|
|
60
56
|
}), [upload, saveModel]);
|
|
61
|
-
const handleChangeDesignationFile = useCallback((attachmentId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
const res = yield changeDesignation(attachmentId, typeId, name);
|
|
63
|
-
if (res) {
|
|
64
|
-
dispatch(actions.HANDLE_SUCCESS_MESSAGE(''));
|
|
65
|
-
}
|
|
66
|
-
return res;
|
|
67
|
-
}), [changeDesignation]);
|
|
68
57
|
const handleDownload = useCallback((url) => {
|
|
69
58
|
window.location.assign(url);
|
|
70
59
|
}, []);
|
|
@@ -96,11 +85,9 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
|
|
|
96
85
|
externalFile: element.externalFile,
|
|
97
86
|
title: element.title,
|
|
98
87
|
showAttachmentName: isSupplementOrOtherFilesTab,
|
|
99
|
-
showDesignationActions: isSupplementOrOtherFilesTab,
|
|
100
88
|
showReplaceAction: !isOtherFilesTab,
|
|
101
89
|
handleDownload,
|
|
102
90
|
handleReplace: handleReplaceFile,
|
|
103
|
-
handleChangeDesignation: handleChangeDesignationFile,
|
|
104
91
|
dispatch: dispatch,
|
|
105
92
|
};
|
|
106
93
|
if (enableDragAndDrop && isSupplementOrOtherFilesTab) {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { PermissionsContext } from '../FileManager';
|
|
4
|
-
|
|
5
|
-
export const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissionAttachmentName, fileExtension, designation, attachmentId, handleChangeDesignation, dispatch, }) => {
|
|
4
|
+
export const FileInfo = ({ showAttachmentName, title, submissionAttachmentName, fileExtension, attachmentId, dispatch, }) => {
|
|
6
5
|
const fileName = submissionAttachmentName.substring(0, submissionAttachmentName.lastIndexOf('.'));
|
|
7
6
|
const can = useContext(PermissionsContext);
|
|
8
7
|
return (React.createElement(FileInfoContainer, null,
|
|
9
|
-
showDesignationActions && designation !== undefined && (React.createElement(DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName: submissionAttachmentName, dispatch: dispatch, can: can })),
|
|
10
8
|
React.createElement(FileNameTitleContainer, null,
|
|
11
9
|
React.createElement(FileTitle, null,
|
|
12
10
|
!showAttachmentName ? fileName : title,
|
|
@@ -8,7 +8,7 @@ import { Designation, namesWithDesignationMap } from '../util';
|
|
|
8
8
|
import { FileInfo } from './FileInfo';
|
|
9
9
|
import { FileTypeIcon } from './FileTypeIcon';
|
|
10
10
|
import { ItemActions } from './ItemActions';
|
|
11
|
-
export const FileSectionItem = ({ externalFile, title, showAttachmentName = false,
|
|
11
|
+
export const FileSectionItem = ({ externalFile, title, showAttachmentName = false, showReplaceAction = true, handleDownload, handleReplace, dispatch, dragRef, className, style, onClose, isEditor, }) => {
|
|
12
12
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
13
13
|
const fileExtension = externalFile.name.substring(externalFile.name.lastIndexOf('.') + 1);
|
|
14
14
|
const designation = namesWithDesignationMap.get(externalFile.type.label);
|
|
@@ -23,7 +23,7 @@ export const FileSectionItem = ({ externalFile, title, showAttachmentName = fals
|
|
|
23
23
|
}
|
|
24
24
|
} },
|
|
25
25
|
React.createElement(FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
|
|
26
|
-
React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName,
|
|
26
|
+
React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, submissionAttachmentName: externalFile.name, title: title, attachmentId: externalFile.id, dispatch: dispatch })),
|
|
27
27
|
onClose && (React.createElement(IconCloseButton, { onClick: (e) => {
|
|
28
28
|
e.preventDefault();
|
|
29
29
|
onClose();
|
|
@@ -36,7 +36,6 @@ export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandle
|
|
|
36
36
|
setSelectedFile(file);
|
|
37
37
|
if (dispatch) {
|
|
38
38
|
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
39
|
-
dispatch(actions.SELECT_DESIGNATION(attachmentDesignationName || Designation.Document));
|
|
40
39
|
}
|
|
41
40
|
const result = yield replaceAttachmentHandler(attachmentId, fileName, file, attachmentDesignation);
|
|
42
41
|
if (typeof result === 'object' && handleUpdateInline) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
2
|
import { AlertMessage, AlertMessageType } from '../AlertMessage';
|
|
3
3
|
import { DragItemArea } from './DragItemArea';
|
|
4
4
|
import { PermissionsContext } from './FileManager';
|
|
5
5
|
import { FileSectionUploadItem } from './FileSectionItem/FileSectionUploadItem';
|
|
6
6
|
import { actions } from './FileSectionState';
|
|
7
|
-
import { SelectDialogDesignation } from './SelectDialogDesignation';
|
|
8
7
|
import { UploadFileArea } from './UploadFileArea';
|
|
9
|
-
import { FileSectionType
|
|
8
|
+
import { FileSectionType } from './util';
|
|
10
9
|
export const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, filesItem, dispatch, state, }) => {
|
|
11
10
|
let uploadedFileExtension = '';
|
|
12
11
|
if (state.uploadedFile) {
|
|
@@ -14,13 +13,12 @@ export const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, fil
|
|
|
14
13
|
}
|
|
15
14
|
const isSupplementFilesTab = fileSection === FileSectionType.Supplements;
|
|
16
15
|
const isOtherFileTab = fileSection === FileSectionType.OtherFile;
|
|
17
|
-
const handleUploadOtherFile = () => {
|
|
18
|
-
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
19
|
-
state.uploadedFile &&
|
|
20
|
-
state.selectDesignation !== undefined &&
|
|
21
|
-
handleUpload(state.uploadedFile, getDesignationName(state.selectDesignation));
|
|
22
|
-
};
|
|
23
16
|
const can = useContext(PermissionsContext);
|
|
17
|
+
const EMPTY_DESIGNATION = '';
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
20
|
+
state.uploadedFile && handleUpload(state.uploadedFile, EMPTY_DESIGNATION);
|
|
21
|
+
}, [state.uploadedFile, dispatch, handleUpload]);
|
|
24
22
|
const handleSuccessMessage = () => {
|
|
25
23
|
return (React.createElement(AlertMessage, { type: AlertMessageType.success, hideCloseButton: true, dismissButton: {
|
|
26
24
|
text: 'OK',
|
|
@@ -30,14 +28,9 @@ export const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, fil
|
|
|
30
28
|
return (React.createElement("div", null,
|
|
31
29
|
(can === null || can === void 0 ? void 0 : can.uploadFile) && (React.createElement(React.Fragment, null,
|
|
32
30
|
(isOtherFileTab || isSupplementFilesTab) && (React.createElement(UploadFileArea, { handleUploadFile: handleUpload, fileSection: fileSection, dispatch: dispatch })),
|
|
33
|
-
state.isUploadFile &&
|
|
34
|
-
state.uploadedFile &&
|
|
35
|
-
state.selectDesignation !== undefined && (React.createElement(FileSectionUploadItem, { fileName: state.uploadedFile.name, isLoading: state.isUploadFile })))),
|
|
31
|
+
state.isUploadFile && state.uploadedFile && (React.createElement(FileSectionUploadItem, { fileName: state.uploadedFile.name, isLoading: state.isUploadFile })))),
|
|
36
32
|
state.fileUploadedSuccessfullySection === fileSection &&
|
|
37
33
|
handleSuccessMessage(),
|
|
38
|
-
React.createElement(SelectDialogDesignation, { isOpen: state.showDesignationPopup === fileSection, fileExtension: uploadedFileExtension, handleCancel: () => {
|
|
39
|
-
dispatch(actions.HANDLE_CANCEL_UPLOAD());
|
|
40
|
-
}, uploadFileHandler: handleUploadOtherFile, dispatch: dispatch, fileSection: fileSection }),
|
|
41
34
|
filesItem,
|
|
42
35
|
(can === null || can === void 0 ? void 0 : can.changeDesignation) &&
|
|
43
36
|
enableDragAndDrop &&
|
|
@@ -18,6 +18,7 @@ export { default as AddIconActive } from './add-icon-active';
|
|
|
18
18
|
export { default as AddIconInverted } from './add-icon-inverted';
|
|
19
19
|
export { default as BackArrowIcon } from './back-arrow';
|
|
20
20
|
export { default as BookmarkIcon } from './bookmark';
|
|
21
|
+
export { default as CloseIcon } from './close-icon';
|
|
21
22
|
export { default as CloseOIcon } from './close-o-icon';
|
|
22
23
|
export { default as AddComment } from './add-comment-icon';
|
|
23
24
|
export { default as GoogleIcon } from './google';
|
|
@@ -43,3 +44,4 @@ export { default as AnnotatorIcon } from './annotator-icon';
|
|
|
43
44
|
export { default as LeftArrow } from './left-arrow';
|
|
44
45
|
export { default as BlockQuoteIcon } from './block-quote-icon';
|
|
45
46
|
export { default as PullQuoteIcon } from './pull-quote-icon';
|
|
47
|
+
export { default as PlusIcon } from './plus-icon';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2023 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
export const PlusIcon = () => (React.createElement("svg", { width: "11", height: "10", viewBox: "0 0 11 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
18
|
+
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 0.5C5.25147 0.5 5.05 0.701472 5.05 0.95V4.55H1.45C1.20147 4.55 1 4.75147 1 5C1 5.24853 1.20147 5.45 1.45 5.45H5.05V9.05C5.05 9.29853 5.25147 9.5 5.5 9.5C5.74853 9.5 5.95 9.29853 5.95 9.05V5.45H9.55C9.79853 5.45 10 5.24853 10 5C10 4.75147 9.79853 4.55 9.55 4.55H5.95V0.95C5.95 0.701472 5.74853 0.5 5.5 0.5Z", fill: "#6E6E6E" }),
|
|
19
|
+
React.createElement("path", { d: "M5.05 4.55V5.05H5.55V4.55H5.05ZM5.05 5.45H5.55V4.95H5.05V5.45ZM5.95 5.45V4.95H5.45V5.45H5.95ZM5.95 4.55H5.45V5.05H5.95V4.55ZM5.55 0.95C5.55 0.977614 5.52761 1 5.5 1V0C4.97533 0 4.55 0.425329 4.55 0.95H5.55ZM5.55 4.55V0.95H4.55V4.55H5.55ZM1.45 5.05H5.05V4.05H1.45V5.05ZM1.5 5C1.5 5.02761 1.47761 5.05 1.45 5.05V4.05C0.925329 4.05 0.5 4.47533 0.5 5H1.5ZM1.45 4.95C1.47761 4.95 1.5 4.97239 1.5 5H0.5C0.5 5.52467 0.925328 5.95 1.45 5.95V4.95ZM5.05 4.95H1.45V5.95H5.05V4.95ZM5.55 9.05V5.45H4.55V9.05H5.55ZM5.5 9C5.52761 9 5.55 9.02239 5.55 9.05H4.55C4.55 9.57467 4.97533 10 5.5 10V9ZM5.45 9.05C5.45 9.02239 5.47239 9 5.5 9V10C6.02467 10 6.45 9.57467 6.45 9.05H5.45ZM5.45 5.45V9.05H6.45V5.45H5.45ZM9.55 4.95H5.95V5.95H9.55V4.95ZM9.5 5C9.5 4.97239 9.52238 4.95 9.55 4.95V5.95C10.0747 5.95 10.5 5.52467 10.5 5H9.5ZM9.55 5.05C9.52239 5.05 9.5 5.02761 9.5 5H10.5C10.5 4.47533 10.0747 4.05 9.55 4.05V5.05ZM5.95 5.05H9.55V4.05H5.95V5.05ZM5.45 0.95V4.55H6.45V0.95H5.45ZM5.5 1C5.47239 1 5.45 0.977615 5.45 0.95H6.45C6.45 0.425329 6.02467 0 5.5 0V1Z", fill: "#6E6E6E" })));
|
|
20
|
+
export default PlusIcon;
|
|
@@ -10,7 +10,6 @@ export interface FileManagement {
|
|
|
10
10
|
getAttachments: () => SubmissionAttachment[];
|
|
11
11
|
upload: Upload;
|
|
12
12
|
replace: Replace;
|
|
13
|
-
changeDesignation: ChangeDesignation;
|
|
14
13
|
}
|
|
15
14
|
export declare const PermissionsContext: React.Context<Capabilities | null>;
|
|
16
15
|
export declare const FileManager: React.FC<{
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import React, { Dispatch } from 'react';
|
|
2
|
-
import { ChangeDesignation } from '../FileManager';
|
|
3
2
|
import { Action } from '../FileSectionState';
|
|
4
|
-
import { Designation } from '../util';
|
|
5
3
|
export declare const FileInfo: React.FC<{
|
|
6
4
|
showAttachmentName: boolean;
|
|
7
|
-
showDesignationActions: boolean;
|
|
8
5
|
title: string;
|
|
9
6
|
submissionAttachmentName: string;
|
|
10
7
|
fileExtension: string;
|
|
11
|
-
designation?: Designation;
|
|
12
8
|
attachmentId: string;
|
|
13
|
-
handleChangeDesignation: ChangeDesignation;
|
|
14
9
|
dispatch?: Dispatch<Action>;
|
|
15
10
|
}>;
|
|
16
11
|
export declare const FileInfoContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { CSSProperties, Dispatch } from 'react';
|
|
2
2
|
import { DragElementWrapper, DragSourceOptions } from 'react-dnd';
|
|
3
3
|
import { Maybe } from '../../SubmissionInspector/types';
|
|
4
|
-
import {
|
|
4
|
+
import { Replace } from '../FileManager';
|
|
5
5
|
import { Action } from '../FileSectionState';
|
|
6
6
|
export type SubmissionAttachment = {
|
|
7
7
|
id: string;
|
|
@@ -17,12 +17,10 @@ export interface FileSectionItemProps {
|
|
|
17
17
|
externalFile: SubmissionAttachment;
|
|
18
18
|
title: string;
|
|
19
19
|
showAttachmentName?: boolean;
|
|
20
|
-
showDesignationActions?: boolean;
|
|
21
20
|
showActions?: boolean;
|
|
22
21
|
showReplaceAction?: boolean;
|
|
23
22
|
handleDownload?: (url: string) => void;
|
|
24
23
|
handleReplace?: Replace;
|
|
25
|
-
handleChangeDesignation: ChangeDesignation;
|
|
26
24
|
dispatch?: Dispatch<Action>;
|
|
27
25
|
dragRef?: DragElementWrapper<DragSourceOptions>;
|
|
28
26
|
className?: string;
|
|
@@ -18,6 +18,7 @@ export { default as AddIconActive } from './add-icon-active';
|
|
|
18
18
|
export { default as AddIconInverted } from './add-icon-inverted';
|
|
19
19
|
export { default as BackArrowIcon } from './back-arrow';
|
|
20
20
|
export { default as BookmarkIcon } from './bookmark';
|
|
21
|
+
export { default as CloseIcon } from './close-icon';
|
|
21
22
|
export { default as CloseOIcon } from './close-o-icon';
|
|
22
23
|
export { default as AddComment } from './add-comment-icon';
|
|
23
24
|
export { default as GoogleIcon } from './google';
|
|
@@ -43,3 +44,4 @@ export { default as AnnotatorIcon } from './annotator-icon';
|
|
|
43
44
|
export { default as LeftArrow } from './left-arrow';
|
|
44
45
|
export { default as BlockQuoteIcon } from './block-quote-icon';
|
|
45
46
|
export { default as PullQuoteIcon } from './pull-quote-icon';
|
|
47
|
+
export { default as PlusIcon } from './plus-icon';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2023 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/// <reference types="react" />
|
|
17
|
+
export declare const PlusIcon: () => JSX.Element;
|
|
18
|
+
export default PlusIcon;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6-LEAN-2237",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|