@manuscripts/style-guide 0.31.0 → 0.31.4
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 +14 -2
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +15 -3
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +1 -4
- package/dist/cjs/components/FileManager/InlineFilesSection.js +1 -3
- package/dist/cjs/components/icons/unsupported-format-file-icon.js +27 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/lib/inlineFiles.js +72 -39
- package/dist/es/components/FileManager/FileManager.js +15 -3
- package/dist/es/components/FileManager/FileSectionItem/DesignationActions.js +15 -3
- package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +1 -4
- package/dist/es/components/FileManager/InlineFilesSection.js +3 -5
- package/dist/es/components/icons/unsupported-format-file-icon.js +22 -0
- package/dist/es/index.js +1 -0
- package/dist/es/lib/inlineFiles.js +73 -40
- package/dist/types/components/FileManager/FileSectionItem/DesignationActions.d.ts +2 -0
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +8 -3
- package/dist/types/components/Form.d.ts +1 -1
- package/dist/types/components/icons/unsupported-format-file-icon.d.ts +19 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -34,6 +34,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
34
|
exports.FileManager = exports.PermissionsContext = void 0;
|
|
35
35
|
const react_1 = __importStar(require("react"));
|
|
36
36
|
const react_tooltip_1 = __importDefault(require("react-tooltip"));
|
|
37
|
+
const inlineFiles_1 = __importDefault(require("../../lib/inlineFiles"));
|
|
37
38
|
const AlertMessage_1 = require("../AlertMessage");
|
|
38
39
|
const Inspector_1 = require("../Inspector");
|
|
39
40
|
const InspectorSection_1 = require("../InspectorSection");
|
|
@@ -74,13 +75,24 @@ const FileManager = ({ submissionId, attachments, modelMap, enableDragAndDrop, c
|
|
|
74
75
|
const handleDownloadFile = (0, react_1.useCallback)((publicUrl) => {
|
|
75
76
|
return handleDownload(publicUrl);
|
|
76
77
|
}, [handleDownload]);
|
|
78
|
+
const inlineFiles = (0, react_1.useMemo)(() => (0, inlineFiles_1.default)(modelMap, attachments), [modelMap.values(), attachments]);
|
|
79
|
+
const inlineAttachmentsIds = (0, react_1.useMemo)(() => {
|
|
80
|
+
const attachmentsIDs = new Set();
|
|
81
|
+
inlineFiles.map(({ attachments }) => {
|
|
82
|
+
if (attachments) {
|
|
83
|
+
attachments.map((attachment) => attachmentsIDs.add(attachment.id));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return attachmentsIDs;
|
|
87
|
+
}, [inlineFiles]);
|
|
77
88
|
const getFileSectionExternalFile = (fileSection) => {
|
|
78
89
|
const isSupplementOrOtherFilesTab = fileSection === util_1.FileSectionType.Supplements ||
|
|
79
90
|
fileSection === util_1.FileSectionType.OtherFile;
|
|
80
91
|
const itemsData = attachments.filter((element) => {
|
|
81
92
|
const designation = util_1.namesWithDesignationMap.get(element.type.label);
|
|
82
93
|
return (designation !== undefined &&
|
|
83
|
-
util_1.designationWithFileSectionsMap.get(designation) === fileSection
|
|
94
|
+
util_1.designationWithFileSectionsMap.get(designation) === fileSection &&
|
|
95
|
+
!inlineAttachmentsIds.has(element.id));
|
|
84
96
|
});
|
|
85
97
|
const itemsDataWithTitle = (0, util_1.generateAttachmentsTitles)(itemsData, fileSection);
|
|
86
98
|
const filesItems = itemsDataWithTitle.map((element) => {
|
|
@@ -130,7 +142,7 @@ const FileManager = ({ submissionId, attachments, modelMap, enableDragAndDrop, c
|
|
|
130
142
|
react_1.default.createElement("div", null, "Files excluded from the final submission.")))),
|
|
131
143
|
react_1.default.createElement(Inspector_1.InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
|
132
144
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
133
|
-
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, {
|
|
145
|
+
react_1.default.createElement(InlineFilesSection_1.InlineFilesSection, { inlineFiles: inlineFiles, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, isEditor: enableDragAndDrop, dispatch: dispatch })),
|
|
134
146
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
135
147
|
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 })),
|
|
136
148
|
react_1.default.createElement(Inspector_1.InspectorTabPanel, null,
|
|
@@ -24,12 +24,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.DesignationActions = void 0;
|
|
26
26
|
const react_1 = __importStar(require("react"));
|
|
27
|
+
const react_tooltip_1 = __importDefault(require("react-tooltip"));
|
|
27
28
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
28
29
|
const BottomArrowIcon_1 = __importDefault(require("../../icons/BottomArrowIcon"));
|
|
29
30
|
const ConfirmationPopUp_1 = require("../ConfirmationPopUp");
|
|
31
|
+
const TooltipDiv_1 = require("../TooltipDiv");
|
|
30
32
|
const util_1 = require("../util");
|
|
31
33
|
const DesignationActionsList_1 = require("./DesignationActionsList");
|
|
32
|
-
const DesignationActions = ({ designation, attachmentId, fileExtension, handleChangeDesignation, submissionId, fileName, dispatch, }) => {
|
|
34
|
+
const DesignationActions = ({ designation, attachmentId, fileExtension, handleChangeDesignation, submissionId, fileName, can, dispatch, }) => {
|
|
33
35
|
const [isActionsShown, setIsActionsShown] = (0, react_1.useState)(false);
|
|
34
36
|
const [confirmationPopUpData, setConfirmationPopUpData] = (0, react_1.useState)({
|
|
35
37
|
isConfirmationPopUpOpen: false,
|
|
@@ -73,9 +75,12 @@ const DesignationActions = ({ designation, attachmentId, fileExtension, handleCh
|
|
|
73
75
|
};
|
|
74
76
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
75
77
|
react_1.default.createElement(SecondaryActionsContainer, { onClick: toggleActionsList, onBlur: hideActionsList },
|
|
76
|
-
react_1.default.createElement(
|
|
78
|
+
!(can === null || can === void 0 ? void 0 : can.changeDesignation) && (react_1.default.createElement(TooltipContainer, null,
|
|
79
|
+
react_1.default.createElement(react_tooltip_1.default, { id: "file-designation", place: "bottom", offset: { bottom: -8 }, effect: "solid", className: "tooltip" },
|
|
80
|
+
react_1.default.createElement("div", null, "You don\u2019t have permissions to adjust this selection")))),
|
|
81
|
+
react_1.default.createElement(SecondaryActionsText, { "data-for": "file-designation", "data-tip": true }, util_1.designationWithReadableNamesMap.get(designation)),
|
|
77
82
|
react_1.default.createElement(BottomArrowIcon_1.default, null),
|
|
78
|
-
isActionsShown && (react_1.default.createElement(ActionsListContainer, null,
|
|
83
|
+
isActionsShown && (can === null || can === void 0 ? void 0 : can.changeDesignation) && (react_1.default.createElement(ActionsListContainer, null,
|
|
79
84
|
react_1.default.createElement(DesignationActionsList_1.DesignationActionsList, { handleChangeDesignation: handleChangeDesignation, designationActionsList: designationActionsList, submissionId: submissionId, fileName: fileName, designation: designation, attachmentId: attachmentId, dispatch: dispatch, handleOpenConfirmationPopup: handleOpenConfirmationPopup })))),
|
|
80
85
|
confirmationPopUpData.isConfirmationPopUpOpen && (react_1.default.createElement(ConfirmationPopUp_1.ConfirmationPopUp, { popupHeader: confirmationPopUpData.confirmationPopUpHeader !== undefined
|
|
81
86
|
? confirmationPopUpData.confirmationPopUpHeader
|
|
@@ -113,3 +118,10 @@ const ActionsListContainer = styled_components_1.default.div `
|
|
|
113
118
|
top: 40px;
|
|
114
119
|
z-index: 999;
|
|
115
120
|
`;
|
|
121
|
+
const TooltipContainer = (0, styled_components_1.default)(TooltipDiv_1.TooltipDiv) `
|
|
122
|
+
.tooltip {
|
|
123
|
+
white-space: normal;
|
|
124
|
+
width: 144px;
|
|
125
|
+
height: 32px;
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
@@ -31,10 +31,7 @@ const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissio
|
|
|
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
|
-
(
|
|
35
|
-
showDesignationActions &&
|
|
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 })),
|
|
34
|
+
showDesignationActions && designation !== undefined && submissionId && (react_1.default.createElement(DesignationActions_1.DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, submissionId: submissionId, fileName: submissionAttachmentName, dispatch: dispatch, can: can })),
|
|
38
35
|
react_1.default.createElement(exports.FileNameTitleContainer, null,
|
|
39
36
|
react_1.default.createElement(exports.FileTitle, null,
|
|
40
37
|
!showAttachmentName ? fileName : title,
|
|
@@ -26,14 +26,12 @@ exports.InlineFilesSection = void 0;
|
|
|
26
26
|
const react_1 = __importStar(require("react"));
|
|
27
27
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
28
28
|
const use_dropdown_1 = require("../../hooks/use-dropdown");
|
|
29
|
-
const inlineFiles_1 = __importDefault(require("../../lib/inlineFiles"));
|
|
30
29
|
const dots_icon_1 = __importDefault(require("../icons/dots-icon"));
|
|
31
30
|
const FileInfo_1 = require("./FileSectionItem/FileInfo");
|
|
32
31
|
const FileSectionItem_1 = require("./FileSectionItem/FileSectionItem");
|
|
33
32
|
const ItemActions_1 = require("./FileSectionItem/ItemActions");
|
|
34
33
|
const util_1 = require("./util");
|
|
35
|
-
const InlineFilesSection = ({ submissionId, handleReplace, handleDownload,
|
|
36
|
-
const inlineFiles = (0, react_1.useMemo)(() => (0, inlineFiles_1.default)(modelMap, attachments), [modelMap, attachments]);
|
|
34
|
+
const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, inlineFiles, isEditor, dispatch, }) => {
|
|
37
35
|
const onElementClick = (0, react_1.useCallback)((e) => {
|
|
38
36
|
if (!isEditor) {
|
|
39
37
|
return;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 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 UnsupportedFormatFileIcon = (props) => (react_1.default.createElement("svg", { className: props.className, width: "28", height: "32", viewBox: "0 0 28 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
23
|
+
react_1.default.createElement("path", { d: "M3 30.75H25C25.9665 30.75 26.75 29.9665 26.75 29V11.4383C26.75 10.9494 26.5455 10.4828 26.186 10.1515L17.0311 1.71322C16.7085 1.41588 16.2863 1.25 15.846 1.25H15.8364H15.8268H15.817H15.8071H15.7971H15.787H15.7767H15.7664H15.756H15.7454H15.7348H15.724H15.7132H15.7022H15.6912H15.68H15.6687H15.6573H15.6458H15.6343H15.6226H15.6108H15.5989H15.5869H15.5748H15.5626H15.5503H15.5379H15.5254H15.5128H15.5001H15.4873H15.4744H15.4614H15.4483H15.435H15.4217H15.4083H15.3949H15.3813H15.3676H15.3538H15.3399H15.3259H15.3118H15.2976H15.2834H15.269H15.2545H15.24H15.2253H15.2106H15.1957H15.1808H15.1658H15.1507H15.1354H15.1201H15.1047H15.0892H15.0737H15.058H15.0422H15.0264H15.0104H14.9944H14.9782H14.962H14.9457H14.9293H14.9128H14.8963H14.8796H14.8628H14.846H14.8291H14.812H14.7949H14.7778H14.7605H14.7431H14.7257H14.7081H14.6905H14.6728H14.655H14.6371H14.6192H14.6011H14.583H14.5648H14.5465H14.5281H14.5097H14.4911H14.4725H14.4538H14.435H14.4161H14.3972H14.3782H14.3591H14.3399H14.3206H14.3012H14.2818H14.2623H14.2427H14.2231H14.2033H14.1835H14.1636H14.1436H14.1236H14.1034H14.0832H14.0629H14.0426H14.0222H14.0016H13.9811H13.9604H13.9397H13.9189H13.898H13.877H13.856H13.8349H13.8137H13.7925H13.7711H13.7498H13.7283H13.7068H13.6852H13.6635H13.6417H13.6199H13.598H13.5761H13.554H13.5319H13.5098H13.4875H13.4652H13.4429H13.4204H13.3979H13.3754H13.3527H13.33H13.3072H13.2844H13.2615H13.2385H13.2155H13.1924H13.1692H13.146H13.1227H13.0994H13.0759H13.0525H13.0289H13.0053H12.9816H12.9579H12.9341H12.9102H12.8863H12.8624H12.8383H12.8142H12.79H12.7658H12.7415H12.7172H12.6928H12.6684H12.6438H12.6193H12.5946H12.5699H12.5452H12.5204H12.4955H12.4706H12.4456H12.4206H12.3955H12.3704H12.3452H12.3199H12.2946H12.2693H12.2439H12.2184H12.1929H12.1673H12.1417H12.116H12.0903H12.0645H12.0386H12.0128H11.9868H11.9608H11.9348H11.9087H11.8826H11.8564H11.8301H11.8038H11.7775H11.7511H11.7247H11.6982H11.6717H11.6451H11.6185H11.5918H11.5651H11.5383H11.5115H11.4846H11.4577H11.4308H11.4038H11.3768H11.3497H11.3226H11.2954H11.2682H11.2409H11.2136H11.1863H11.1589H11.1315H11.104H11.0765H11.0489H11.0213H10.9937H10.966H10.9383H10.9105H10.8828H10.8549H10.827H10.7991H10.7712H10.7432H10.7152H10.6871H10.659H10.6309H10.6027H10.5745H10.5462H10.5179H10.4896H10.4613H10.4329H10.4044H10.376H10.3475H10.3189H10.2904H10.2618H10.2332H10.2045H10.1758H10.1471H10.1183H10.0895H10.0607H10.0318H10.003H9.97403H9.94509H9.91611H9.8871H9.85807H9.829H9.79991H9.77078H9.74163H9.71245H9.68324H9.65401H9.62474H9.59545H9.56613H9.53679H9.50742H9.47803H9.4486H9.41916H9.38969H9.36019H9.33067H9.30112H9.27155H9.24196H9.21234H9.1827H9.15304H9.12336H9.09365H9.06392H9.03417H9.0044H8.97461H8.94479H8.91496H8.8851H8.85523H8.82533H8.79542H8.76548H8.73553H8.70556H8.67557H8.64556H8.61554H8.58549H8.55543H8.52536H8.49526H8.46515H8.43503H8.40488H8.37473H8.34455H8.31437H8.28416H8.25395H8.22371H8.19347H8.16321H8.13294H8.10265H8.07236H8.04205H8.01173H7.98139H7.95105H7.92069H7.89032H7.85994H7.82955H7.79915H7.76874H7.73832H7.7079H7.67746H7.64701H7.61656H7.58609H7.55562H7.52515H7.49466H7.46417H7.43367H7.40316H7.37265H7.34213H7.3116H7.28107H7.25054H7.22H7.18945H7.1589H7.12835H7.09779H7.06723H7.03667H7.0061H6.97554H6.94496H6.91439H6.88382H6.85324H6.82266H6.79208H6.7615H6.73092H6.70034H6.66976H6.63919H6.60861H6.57803H6.54745H6.51688H6.48631H6.45574H6.42517H6.3946H6.36404H6.33348H6.30292H6.27237H6.24183H6.21128H6.18074H6.15021H6.11968H6.08916H6.05864H6.02813H5.99763H5.96713H5.93664H5.90615H5.87568H5.84521H5.81475H5.78429H5.75385H5.72342H5.69299H5.66257H5.63217H5.60177H5.57139H5.54101H5.51065H5.48029H5.44995H5.41962H5.3893H5.35899H5.3287H5.29842H5.26815H5.2379H5.20766H5.17743H5.14722H5.11702H5.08684H5.05667H5.02651H4.99638H4.96626H4.93615H4.90606H4.87599H4.84593H4.8159H4.78588H4.75587H4.72589H4.69592H4.66598H4.63605H4.60614H4.57625H4.54638H4.51653H4.48671H4.4569H4.42711H4.39734H4.3676H4.33788H4.30818H4.2785H4.24884H4.21921H4.1896H4.16001H4.13045H4.10091H4.0714H4.04191H4.01245H3.98301H3.95359H3.92421H3.89485H3.86551H3.8362H3.80692H3.77766H3.74844H3.71924H3.69006H3.66092H3.6318H3.60272H3.57366H3.54463H3.51563H3.48667H3.45773H3.42882H3.39994H3.3711H3.34228H3.3135H3.28475H3.25603H3.22735H3.19869H3.17007H3.14148H3.11293H3.08441H3.05593H3.02748H2.99906C2.03164 1.25 1.25 2.03442 1.25 3V29C1.25 29.9665 2.0335 30.75 3 30.75Z", stroke: "#6E6E6E", strokeWidth: "1.5" }),
|
|
24
|
+
react_1.default.createElement("path", { d: "M8 24C10.1212 20.9815 15.8909 16.7556 22 24", stroke: "#6E6E6E", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
25
|
+
react_1.default.createElement("path", { d: "M8 8C8 8 8 9.04738 8 11", stroke: "#6E6E6E", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
26
|
+
react_1.default.createElement("path", { d: "M16 2V12H26", stroke: "#6E6E6E", strokeWidth: "1.5" })));
|
|
27
|
+
exports.default = UnsupportedFormatFileIcon;
|
package/dist/cjs/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.SelectDialogDesignation = exports.errorsDecoder = exports.PdfPreview = void 0;
|
|
31
|
+
exports.SelectDialogDesignation = exports.errorsDecoder = exports.PdfPreview = exports.inlineFiles = void 0;
|
|
32
32
|
__exportStar(require("./components/AffiliationsEditor"), exports);
|
|
33
33
|
__exportStar(require("./components/AffiliationsList"), exports);
|
|
34
34
|
__exportStar(require("./components/AuthorForm"), exports);
|
|
@@ -60,6 +60,8 @@ __exportStar(require("./components/Tip"), exports);
|
|
|
60
60
|
__exportStar(require("./components/icons"), exports);
|
|
61
61
|
__exportStar(require("./components/Inspector"), exports);
|
|
62
62
|
__exportStar(require("./components/InspectorSection"), exports);
|
|
63
|
+
var inlineFiles_1 = require("./lib/inlineFiles");
|
|
64
|
+
Object.defineProperty(exports, "inlineFiles", { enumerable: true, get: function () { return __importDefault(inlineFiles_1).default; } });
|
|
63
65
|
var PdfPreview_1 = require("./components/PdfPreview");
|
|
64
66
|
Object.defineProperty(exports, "PdfPreview", { enumerable: true, get: function () { return __importDefault(PdfPreview_1).default; } });
|
|
65
67
|
__exportStar(require("./components/SubmissionInspector"), exports);
|
|
@@ -37,49 +37,82 @@ const getFigureData = (element, modelMap, attachmentsMap) => {
|
|
|
37
37
|
exports.default = (modelMap, attachments) => {
|
|
38
38
|
const files = [];
|
|
39
39
|
const attachmentsMap = new Map(attachments.map((attachment) => [attachment.id, attachment]));
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const { graphicalAbstractFigureId, figureElement, tableElement } = getAuxiliaryObjects(modelMap);
|
|
41
|
+
if (graphicalAbstractFigureId) {
|
|
42
|
+
const element = modelMap.get(graphicalAbstractFigureId);
|
|
43
|
+
files.unshift(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Graphical Abstract`, type: util_1.FileType.GraphicalAbstract }));
|
|
44
|
+
}
|
|
45
|
+
figureElement.map((id, index) => {
|
|
46
|
+
const element = modelMap.get(id);
|
|
47
|
+
files.push(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Figure ${index + 1}`, type: util_1.FileType.Figure }));
|
|
48
|
+
});
|
|
49
|
+
tableElement.map((id) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const tableElement = modelMap.get(id);
|
|
52
|
+
const table = modelMap.get(tableElement.containedObjectID);
|
|
53
|
+
const externalFileReference = (_a = table === null || table === void 0 ? void 0 : table.externalFileReferences) === null || _a === void 0 ? void 0 : _a.find((file) => file.kind === 'dataset' && file.ref);
|
|
54
|
+
const attachment = getAttachment(externalFileReference, attachmentsMap);
|
|
55
|
+
if (attachment) {
|
|
56
|
+
files.push({
|
|
57
|
+
id: tableElement._id,
|
|
58
|
+
label: `Table`,
|
|
59
|
+
type: util_1.FileType.SheetsWorkbooks,
|
|
60
|
+
attachments: [attachment],
|
|
61
|
+
caption: getCaptionText(tableElement.caption),
|
|
49
62
|
});
|
|
50
63
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
});
|
|
65
|
+
return files;
|
|
66
|
+
};
|
|
67
|
+
const getAuxiliaryObjects = (modelMap) => {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
let graphicalAbstractFigureId;
|
|
70
|
+
const figureElementIds = [], tableElementIds = [], orderObjects = {};
|
|
71
|
+
for (const model of modelMap.values()) {
|
|
72
|
+
switch (model.objectType) {
|
|
73
|
+
case manuscripts_json_schema_1.ObjectTypes.Section: {
|
|
74
|
+
const section = model;
|
|
75
|
+
if (section.category === 'MPSectionCategory:abstract-graphical') {
|
|
76
|
+
graphicalAbstractFigureId = (_a = section.elementIDs) === null || _a === void 0 ? void 0 : _a.find((id) => {
|
|
77
|
+
const obj = modelMap.get(id);
|
|
78
|
+
return obj && (0, manuscript_transform_1.hasObjectType)(manuscripts_json_schema_1.ObjectTypes.FigureElement)(obj);
|
|
79
|
+
});
|
|
57
80
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
case manuscripts_json_schema_1.ObjectTypes.TableElement: {
|
|
65
|
-
const tableElement = element;
|
|
66
|
-
const table = modelMap.get(tableElement.containedObjectID);
|
|
67
|
-
const externalFileReference = (_a = table.externalFileReferences) === null || _a === void 0 ? void 0 : _a.find((file) => file.kind === 'dataset' && file.ref);
|
|
68
|
-
const attachment = getAttachment(externalFileReference, attachmentsMap);
|
|
69
|
-
if (attachment) {
|
|
70
|
-
files.push({
|
|
71
|
-
id: element._id,
|
|
72
|
-
label: `Table`,
|
|
73
|
-
type: util_1.FileType.SheetsWorkbooks,
|
|
74
|
-
attachments: [attachment],
|
|
75
|
-
caption: getCaptionText(tableElement.caption),
|
|
76
|
-
});
|
|
81
|
+
else {
|
|
82
|
+
(_b = section.elementIDs) === null || _b === void 0 ? void 0 : _b.map((elementId) => {
|
|
83
|
+
const element = modelMap.get(elementId);
|
|
84
|
+
if (!element) {
|
|
85
|
+
return;
|
|
77
86
|
}
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
switch (element.objectType) {
|
|
88
|
+
case manuscripts_json_schema_1.ObjectTypes.FigureElement:
|
|
89
|
+
case manuscripts_json_schema_1.ObjectTypes.MultiGraphicFigureElement:
|
|
90
|
+
figureElementIds.push(element._id);
|
|
91
|
+
break;
|
|
92
|
+
case manuscripts_json_schema_1.ObjectTypes.TableElement:
|
|
93
|
+
tableElementIds.push(element._id);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
80
97
|
}
|
|
81
|
-
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case manuscripts_json_schema_1.ObjectTypes.ElementsOrder: {
|
|
101
|
+
const elementsOrder = model;
|
|
102
|
+
orderObjects[elementsOrder.elementType] = elementsOrder;
|
|
103
|
+
}
|
|
82
104
|
}
|
|
83
|
-
}
|
|
84
|
-
return
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
graphicalAbstractFigureId,
|
|
108
|
+
figureElement: orderObjects[manuscripts_json_schema_1.ObjectTypes.FigureElement]
|
|
109
|
+
? sortAuxiliaryObject(orderObjects[manuscripts_json_schema_1.ObjectTypes.FigureElement], figureElementIds)
|
|
110
|
+
: figureElementIds,
|
|
111
|
+
tableElement: orderObjects[manuscripts_json_schema_1.ObjectTypes.TableElement]
|
|
112
|
+
? sortAuxiliaryObject(orderObjects[manuscripts_json_schema_1.ObjectTypes.TableElement], tableElementIds)
|
|
113
|
+
: tableElementIds,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
const sortAuxiliaryObject = (orderObject, auxiliaryObjectIds) => {
|
|
117
|
+
return auxiliaryObjectIds.sort((a, b) => orderObject.elements.indexOf(a) - orderObject.elements.indexOf(b));
|
|
85
118
|
};
|
|
@@ -7,8 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import React, { createContext, useCallback, useReducer } from 'react';
|
|
10
|
+
import React, { createContext, useCallback, useMemo, useReducer } from 'react';
|
|
11
11
|
import ReactTooltip from 'react-tooltip';
|
|
12
|
+
import getInlineFiles from '../../lib/inlineFiles';
|
|
12
13
|
import { AlertMessage, AlertMessageType } from '../AlertMessage';
|
|
13
14
|
import { InspectorTab, InspectorTabList, InspectorTabPanel, InspectorTabPanels, InspectorTabs, } from '../Inspector';
|
|
14
15
|
import { InspectorSection } from '../InspectorSection';
|
|
@@ -49,13 +50,24 @@ export const FileManager = ({ submissionId, attachments, modelMap, enableDragAnd
|
|
|
49
50
|
const handleDownloadFile = useCallback((publicUrl) => {
|
|
50
51
|
return handleDownload(publicUrl);
|
|
51
52
|
}, [handleDownload]);
|
|
53
|
+
const inlineFiles = useMemo(() => getInlineFiles(modelMap, attachments), [modelMap.values(), attachments]);
|
|
54
|
+
const inlineAttachmentsIds = useMemo(() => {
|
|
55
|
+
const attachmentsIDs = new Set();
|
|
56
|
+
inlineFiles.map(({ attachments }) => {
|
|
57
|
+
if (attachments) {
|
|
58
|
+
attachments.map((attachment) => attachmentsIDs.add(attachment.id));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return attachmentsIDs;
|
|
62
|
+
}, [inlineFiles]);
|
|
52
63
|
const getFileSectionExternalFile = (fileSection) => {
|
|
53
64
|
const isSupplementOrOtherFilesTab = fileSection === FileSectionType.Supplements ||
|
|
54
65
|
fileSection === FileSectionType.OtherFile;
|
|
55
66
|
const itemsData = attachments.filter((element) => {
|
|
56
67
|
const designation = namesWithDesignationMap.get(element.type.label);
|
|
57
68
|
return (designation !== undefined &&
|
|
58
|
-
designationWithFileSectionsMap.get(designation) === fileSection
|
|
69
|
+
designationWithFileSectionsMap.get(designation) === fileSection &&
|
|
70
|
+
!inlineAttachmentsIds.has(element.id));
|
|
59
71
|
});
|
|
60
72
|
const itemsDataWithTitle = generateAttachmentsTitles(itemsData, fileSection);
|
|
61
73
|
const filesItems = itemsDataWithTitle.map((element) => {
|
|
@@ -105,7 +117,7 @@ export const FileManager = ({ submissionId, attachments, modelMap, enableDragAnd
|
|
|
105
117
|
React.createElement("div", null, "Files excluded from the final submission.")))),
|
|
106
118
|
React.createElement(InspectorTabPanels, { style: { overflowY: 'visible', position: 'relative' } },
|
|
107
119
|
React.createElement(InspectorTabPanel, null,
|
|
108
|
-
React.createElement(InlineFilesSection, {
|
|
120
|
+
React.createElement(InlineFilesSection, { inlineFiles: inlineFiles, submissionId: submissionId, handleReplace: handleReplace, handleDownload: handleDownload, isEditor: enableDragAndDrop, dispatch: dispatch })),
|
|
109
121
|
React.createElement(InspectorTabPanel, null,
|
|
110
122
|
React.createElement(FilesSection, { submissionId: submissionId, enableDragAndDrop: enableDragAndDrop, handleUpload: handleUploadFile, fileSection: FileSectionType.Supplements, filesItem: getFileSectionExternalFile(FileSectionType.Supplements), state: state, dispatch: dispatch })),
|
|
111
123
|
React.createElement(InspectorTabPanel, null,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
+
import ReactTooltip from 'react-tooltip';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
import BottomArrowIcon from '../../icons/BottomArrowIcon';
|
|
4
5
|
import { ConfirmationPopUp } from '../ConfirmationPopUp';
|
|
6
|
+
import { TooltipDiv } from '../TooltipDiv';
|
|
5
7
|
import { designationWithReadableNamesMap, getDesignationActionsList, } from '../util';
|
|
6
8
|
import { DesignationActionsList } from './DesignationActionsList';
|
|
7
|
-
export const DesignationActions = ({ designation, attachmentId, fileExtension, handleChangeDesignation, submissionId, fileName, dispatch, }) => {
|
|
9
|
+
export const DesignationActions = ({ designation, attachmentId, fileExtension, handleChangeDesignation, submissionId, fileName, can, dispatch, }) => {
|
|
8
10
|
const [isActionsShown, setIsActionsShown] = useState(false);
|
|
9
11
|
const [confirmationPopUpData, setConfirmationPopUpData] = useState({
|
|
10
12
|
isConfirmationPopUpOpen: false,
|
|
@@ -48,9 +50,12 @@ export const DesignationActions = ({ designation, attachmentId, fileExtension, h
|
|
|
48
50
|
};
|
|
49
51
|
return (React.createElement(React.Fragment, null,
|
|
50
52
|
React.createElement(SecondaryActionsContainer, { onClick: toggleActionsList, onBlur: hideActionsList },
|
|
51
|
-
React.createElement(
|
|
53
|
+
!(can === null || can === void 0 ? void 0 : can.changeDesignation) && (React.createElement(TooltipContainer, null,
|
|
54
|
+
React.createElement(ReactTooltip, { id: "file-designation", place: "bottom", offset: { bottom: -8 }, effect: "solid", className: "tooltip" },
|
|
55
|
+
React.createElement("div", null, "You don\u2019t have permissions to adjust this selection")))),
|
|
56
|
+
React.createElement(SecondaryActionsText, { "data-for": "file-designation", "data-tip": true }, designationWithReadableNamesMap.get(designation)),
|
|
52
57
|
React.createElement(BottomArrowIcon, null),
|
|
53
|
-
isActionsShown && (React.createElement(ActionsListContainer, null,
|
|
58
|
+
isActionsShown && (can === null || can === void 0 ? void 0 : can.changeDesignation) && (React.createElement(ActionsListContainer, null,
|
|
54
59
|
React.createElement(DesignationActionsList, { handleChangeDesignation: handleChangeDesignation, designationActionsList: designationActionsList, submissionId: submissionId, fileName: fileName, designation: designation, attachmentId: attachmentId, dispatch: dispatch, handleOpenConfirmationPopup: handleOpenConfirmationPopup })))),
|
|
55
60
|
confirmationPopUpData.isConfirmationPopUpOpen && (React.createElement(ConfirmationPopUp, { popupHeader: confirmationPopUpData.confirmationPopUpHeader !== undefined
|
|
56
61
|
? confirmationPopUpData.confirmationPopUpHeader
|
|
@@ -87,3 +92,10 @@ const ActionsListContainer = styled.div `
|
|
|
87
92
|
top: 40px;
|
|
88
93
|
z-index: 999;
|
|
89
94
|
`;
|
|
95
|
+
const TooltipContainer = styled(TooltipDiv) `
|
|
96
|
+
.tooltip {
|
|
97
|
+
white-space: normal;
|
|
98
|
+
width: 144px;
|
|
99
|
+
height: 32px;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
@@ -6,10 +6,7 @@ export const FileInfo = ({ showAttachmentName, showDesignationActions, title, su
|
|
|
6
6
|
const fileName = submissionAttachmentName.substring(0, submissionAttachmentName.lastIndexOf('.'));
|
|
7
7
|
const can = useContext(PermissionsContext);
|
|
8
8
|
return (React.createElement(FileInfoContainer, null,
|
|
9
|
-
(
|
|
10
|
-
showDesignationActions &&
|
|
11
|
-
designation !== undefined &&
|
|
12
|
-
submissionId && (React.createElement(DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, submissionId: submissionId, fileName: submissionAttachmentName, dispatch: dispatch })),
|
|
9
|
+
showDesignationActions && designation !== undefined && submissionId && (React.createElement(DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, submissionId: submissionId, fileName: submissionAttachmentName, dispatch: dispatch, can: can })),
|
|
13
10
|
React.createElement(FileNameTitleContainer, null,
|
|
14
11
|
React.createElement(FileTitle, null,
|
|
15
12
|
!showAttachmentName ? fileName : title,
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import React, { useCallback
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { useDropdown } from '../../hooks/use-dropdown';
|
|
4
|
-
import getInlineFiles from '../../lib/inlineFiles';
|
|
5
4
|
import DotsIcon from '../icons/dots-icon';
|
|
6
5
|
import { FileDescription, FileInfoContainer, FileNameTitleContainer, FileTitle, } from './FileSectionItem/FileInfo';
|
|
7
6
|
import { ActionsIcon, Item, } from './FileSectionItem/FileSectionItem';
|
|
8
7
|
import { ItemActions } from './FileSectionItem/ItemActions';
|
|
9
|
-
import { extensionsWithFileTypesMap, fileTypesWithIconMap } from './util';
|
|
10
|
-
export const InlineFilesSection = ({ submissionId, handleReplace, handleDownload,
|
|
11
|
-
const inlineFiles = useMemo(() => getInlineFiles(modelMap, attachments), [modelMap, attachments]);
|
|
8
|
+
import { extensionsWithFileTypesMap, fileTypesWithIconMap, } from './util';
|
|
9
|
+
export const InlineFilesSection = ({ submissionId, handleReplace, handleDownload, inlineFiles, isEditor, dispatch, }) => {
|
|
12
10
|
const onElementClick = useCallback((e) => {
|
|
13
11
|
if (!isEditor) {
|
|
14
12
|
return;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 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
|
+
const UnsupportedFormatFileIcon = (props) => (React.createElement("svg", { className: props.className, width: "28", height: "32", viewBox: "0 0 28 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
18
|
+
React.createElement("path", { d: "M3 30.75H25C25.9665 30.75 26.75 29.9665 26.75 29V11.4383C26.75 10.9494 26.5455 10.4828 26.186 10.1515L17.0311 1.71322C16.7085 1.41588 16.2863 1.25 15.846 1.25H15.8364H15.8268H15.817H15.8071H15.7971H15.787H15.7767H15.7664H15.756H15.7454H15.7348H15.724H15.7132H15.7022H15.6912H15.68H15.6687H15.6573H15.6458H15.6343H15.6226H15.6108H15.5989H15.5869H15.5748H15.5626H15.5503H15.5379H15.5254H15.5128H15.5001H15.4873H15.4744H15.4614H15.4483H15.435H15.4217H15.4083H15.3949H15.3813H15.3676H15.3538H15.3399H15.3259H15.3118H15.2976H15.2834H15.269H15.2545H15.24H15.2253H15.2106H15.1957H15.1808H15.1658H15.1507H15.1354H15.1201H15.1047H15.0892H15.0737H15.058H15.0422H15.0264H15.0104H14.9944H14.9782H14.962H14.9457H14.9293H14.9128H14.8963H14.8796H14.8628H14.846H14.8291H14.812H14.7949H14.7778H14.7605H14.7431H14.7257H14.7081H14.6905H14.6728H14.655H14.6371H14.6192H14.6011H14.583H14.5648H14.5465H14.5281H14.5097H14.4911H14.4725H14.4538H14.435H14.4161H14.3972H14.3782H14.3591H14.3399H14.3206H14.3012H14.2818H14.2623H14.2427H14.2231H14.2033H14.1835H14.1636H14.1436H14.1236H14.1034H14.0832H14.0629H14.0426H14.0222H14.0016H13.9811H13.9604H13.9397H13.9189H13.898H13.877H13.856H13.8349H13.8137H13.7925H13.7711H13.7498H13.7283H13.7068H13.6852H13.6635H13.6417H13.6199H13.598H13.5761H13.554H13.5319H13.5098H13.4875H13.4652H13.4429H13.4204H13.3979H13.3754H13.3527H13.33H13.3072H13.2844H13.2615H13.2385H13.2155H13.1924H13.1692H13.146H13.1227H13.0994H13.0759H13.0525H13.0289H13.0053H12.9816H12.9579H12.9341H12.9102H12.8863H12.8624H12.8383H12.8142H12.79H12.7658H12.7415H12.7172H12.6928H12.6684H12.6438H12.6193H12.5946H12.5699H12.5452H12.5204H12.4955H12.4706H12.4456H12.4206H12.3955H12.3704H12.3452H12.3199H12.2946H12.2693H12.2439H12.2184H12.1929H12.1673H12.1417H12.116H12.0903H12.0645H12.0386H12.0128H11.9868H11.9608H11.9348H11.9087H11.8826H11.8564H11.8301H11.8038H11.7775H11.7511H11.7247H11.6982H11.6717H11.6451H11.6185H11.5918H11.5651H11.5383H11.5115H11.4846H11.4577H11.4308H11.4038H11.3768H11.3497H11.3226H11.2954H11.2682H11.2409H11.2136H11.1863H11.1589H11.1315H11.104H11.0765H11.0489H11.0213H10.9937H10.966H10.9383H10.9105H10.8828H10.8549H10.827H10.7991H10.7712H10.7432H10.7152H10.6871H10.659H10.6309H10.6027H10.5745H10.5462H10.5179H10.4896H10.4613H10.4329H10.4044H10.376H10.3475H10.3189H10.2904H10.2618H10.2332H10.2045H10.1758H10.1471H10.1183H10.0895H10.0607H10.0318H10.003H9.97403H9.94509H9.91611H9.8871H9.85807H9.829H9.79991H9.77078H9.74163H9.71245H9.68324H9.65401H9.62474H9.59545H9.56613H9.53679H9.50742H9.47803H9.4486H9.41916H9.38969H9.36019H9.33067H9.30112H9.27155H9.24196H9.21234H9.1827H9.15304H9.12336H9.09365H9.06392H9.03417H9.0044H8.97461H8.94479H8.91496H8.8851H8.85523H8.82533H8.79542H8.76548H8.73553H8.70556H8.67557H8.64556H8.61554H8.58549H8.55543H8.52536H8.49526H8.46515H8.43503H8.40488H8.37473H8.34455H8.31437H8.28416H8.25395H8.22371H8.19347H8.16321H8.13294H8.10265H8.07236H8.04205H8.01173H7.98139H7.95105H7.92069H7.89032H7.85994H7.82955H7.79915H7.76874H7.73832H7.7079H7.67746H7.64701H7.61656H7.58609H7.55562H7.52515H7.49466H7.46417H7.43367H7.40316H7.37265H7.34213H7.3116H7.28107H7.25054H7.22H7.18945H7.1589H7.12835H7.09779H7.06723H7.03667H7.0061H6.97554H6.94496H6.91439H6.88382H6.85324H6.82266H6.79208H6.7615H6.73092H6.70034H6.66976H6.63919H6.60861H6.57803H6.54745H6.51688H6.48631H6.45574H6.42517H6.3946H6.36404H6.33348H6.30292H6.27237H6.24183H6.21128H6.18074H6.15021H6.11968H6.08916H6.05864H6.02813H5.99763H5.96713H5.93664H5.90615H5.87568H5.84521H5.81475H5.78429H5.75385H5.72342H5.69299H5.66257H5.63217H5.60177H5.57139H5.54101H5.51065H5.48029H5.44995H5.41962H5.3893H5.35899H5.3287H5.29842H5.26815H5.2379H5.20766H5.17743H5.14722H5.11702H5.08684H5.05667H5.02651H4.99638H4.96626H4.93615H4.90606H4.87599H4.84593H4.8159H4.78588H4.75587H4.72589H4.69592H4.66598H4.63605H4.60614H4.57625H4.54638H4.51653H4.48671H4.4569H4.42711H4.39734H4.3676H4.33788H4.30818H4.2785H4.24884H4.21921H4.1896H4.16001H4.13045H4.10091H4.0714H4.04191H4.01245H3.98301H3.95359H3.92421H3.89485H3.86551H3.8362H3.80692H3.77766H3.74844H3.71924H3.69006H3.66092H3.6318H3.60272H3.57366H3.54463H3.51563H3.48667H3.45773H3.42882H3.39994H3.3711H3.34228H3.3135H3.28475H3.25603H3.22735H3.19869H3.17007H3.14148H3.11293H3.08441H3.05593H3.02748H2.99906C2.03164 1.25 1.25 2.03442 1.25 3V29C1.25 29.9665 2.0335 30.75 3 30.75Z", stroke: "#6E6E6E", strokeWidth: "1.5" }),
|
|
19
|
+
React.createElement("path", { d: "M8 24C10.1212 20.9815 15.8909 16.7556 22 24", stroke: "#6E6E6E", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20
|
+
React.createElement("path", { d: "M8 8C8 8 8 9.04738 8 11", stroke: "#6E6E6E", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
21
|
+
React.createElement("path", { d: "M16 2V12H26", stroke: "#6E6E6E", strokeWidth: "1.5" })));
|
|
22
|
+
export default UnsupportedFormatFileIcon;
|
package/dist/es/index.js
CHANGED
|
@@ -44,6 +44,7 @@ export * from './components/Tip';
|
|
|
44
44
|
export * from './components/icons';
|
|
45
45
|
export * from './components/Inspector';
|
|
46
46
|
export * from './components/InspectorSection';
|
|
47
|
+
export { default as inlineFiles } from './lib/inlineFiles';
|
|
47
48
|
export { default as PdfPreview } from './components/PdfPreview';
|
|
48
49
|
export * from './components/SubmissionInspector';
|
|
49
50
|
export * from './components/Dropdown';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasObjectType } from '@manuscripts/manuscript-transform';
|
|
2
2
|
import { ObjectTypes, } from '@manuscripts/manuscripts-json-schema';
|
|
3
3
|
import { FileType } from '../components/FileManager/util';
|
|
4
4
|
const getCaptionText = (caption) => caption &&
|
|
@@ -35,49 +35,82 @@ const getFigureData = (element, modelMap, attachmentsMap) => {
|
|
|
35
35
|
export default (modelMap, attachments) => {
|
|
36
36
|
const files = [];
|
|
37
37
|
const attachmentsMap = new Map(attachments.map((attachment) => [attachment.id, attachment]));
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
const { graphicalAbstractFigureId, figureElement, tableElement } = getAuxiliaryObjects(modelMap);
|
|
39
|
+
if (graphicalAbstractFigureId) {
|
|
40
|
+
const element = modelMap.get(graphicalAbstractFigureId);
|
|
41
|
+
files.unshift(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Graphical Abstract`, type: FileType.GraphicalAbstract }));
|
|
42
|
+
}
|
|
43
|
+
figureElement.map((id, index) => {
|
|
44
|
+
const element = modelMap.get(id);
|
|
45
|
+
files.push(Object.assign(Object.assign({}, getFigureData(element, modelMap, attachmentsMap)), { label: `Figure ${index + 1}`, type: FileType.Figure }));
|
|
46
|
+
});
|
|
47
|
+
tableElement.map((id) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const tableElement = modelMap.get(id);
|
|
50
|
+
const table = modelMap.get(tableElement.containedObjectID);
|
|
51
|
+
const externalFileReference = (_a = table === null || table === void 0 ? void 0 : table.externalFileReferences) === null || _a === void 0 ? void 0 : _a.find((file) => file.kind === 'dataset' && file.ref);
|
|
52
|
+
const attachment = getAttachment(externalFileReference, attachmentsMap);
|
|
53
|
+
if (attachment) {
|
|
54
|
+
files.push({
|
|
55
|
+
id: tableElement._id,
|
|
56
|
+
label: `Table`,
|
|
57
|
+
type: FileType.SheetsWorkbooks,
|
|
58
|
+
attachments: [attachment],
|
|
59
|
+
caption: getCaptionText(tableElement.caption),
|
|
47
60
|
});
|
|
48
61
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
});
|
|
63
|
+
return files;
|
|
64
|
+
};
|
|
65
|
+
const getAuxiliaryObjects = (modelMap) => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
let graphicalAbstractFigureId;
|
|
68
|
+
const figureElementIds = [], tableElementIds = [], orderObjects = {};
|
|
69
|
+
for (const model of modelMap.values()) {
|
|
70
|
+
switch (model.objectType) {
|
|
71
|
+
case ObjectTypes.Section: {
|
|
72
|
+
const section = model;
|
|
73
|
+
if (section.category === 'MPSectionCategory:abstract-graphical') {
|
|
74
|
+
graphicalAbstractFigureId = (_a = section.elementIDs) === null || _a === void 0 ? void 0 : _a.find((id) => {
|
|
75
|
+
const obj = modelMap.get(id);
|
|
76
|
+
return obj && hasObjectType(ObjectTypes.FigureElement)(obj);
|
|
77
|
+
});
|
|
55
78
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
case ObjectTypes.TableElement: {
|
|
63
|
-
const tableElement = element;
|
|
64
|
-
const table = modelMap.get(tableElement.containedObjectID);
|
|
65
|
-
const externalFileReference = (_a = table.externalFileReferences) === null || _a === void 0 ? void 0 : _a.find((file) => file.kind === 'dataset' && file.ref);
|
|
66
|
-
const attachment = getAttachment(externalFileReference, attachmentsMap);
|
|
67
|
-
if (attachment) {
|
|
68
|
-
files.push({
|
|
69
|
-
id: element._id,
|
|
70
|
-
label: `Table`,
|
|
71
|
-
type: FileType.SheetsWorkbooks,
|
|
72
|
-
attachments: [attachment],
|
|
73
|
-
caption: getCaptionText(tableElement.caption),
|
|
74
|
-
});
|
|
79
|
+
else {
|
|
80
|
+
(_b = section.elementIDs) === null || _b === void 0 ? void 0 : _b.map((elementId) => {
|
|
81
|
+
const element = modelMap.get(elementId);
|
|
82
|
+
if (!element) {
|
|
83
|
+
return;
|
|
75
84
|
}
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
switch (element.objectType) {
|
|
86
|
+
case ObjectTypes.FigureElement:
|
|
87
|
+
case ObjectTypes.MultiGraphicFigureElement:
|
|
88
|
+
figureElementIds.push(element._id);
|
|
89
|
+
break;
|
|
90
|
+
case ObjectTypes.TableElement:
|
|
91
|
+
tableElementIds.push(element._id);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
78
95
|
}
|
|
79
|
-
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case ObjectTypes.ElementsOrder: {
|
|
99
|
+
const elementsOrder = model;
|
|
100
|
+
orderObjects[elementsOrder.elementType] = elementsOrder;
|
|
101
|
+
}
|
|
80
102
|
}
|
|
81
|
-
}
|
|
82
|
-
return
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
graphicalAbstractFigureId,
|
|
106
|
+
figureElement: orderObjects[ObjectTypes.FigureElement]
|
|
107
|
+
? sortAuxiliaryObject(orderObjects[ObjectTypes.FigureElement], figureElementIds)
|
|
108
|
+
: figureElementIds,
|
|
109
|
+
tableElement: orderObjects[ObjectTypes.TableElement]
|
|
110
|
+
? sortAuxiliaryObject(orderObjects[ObjectTypes.TableElement], tableElementIds)
|
|
111
|
+
: tableElementIds,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const sortAuxiliaryObject = (orderObject, auxiliaryObjectIds) => {
|
|
115
|
+
return auxiliaryObjectIds.sort((a, b) => orderObject.elements.indexOf(a) - orderObject.elements.indexOf(b));
|
|
83
116
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { Dispatch } from 'react';
|
|
2
|
+
import { Capabilities } from '../../../lib/capabilities';
|
|
2
3
|
import { Action } from '../FileSectionState';
|
|
3
4
|
import { Designation } from '../util';
|
|
4
5
|
export declare const DesignationActions: React.FC<{
|
|
@@ -8,5 +9,6 @@ export declare const DesignationActions: React.FC<{
|
|
|
8
9
|
handleChangeDesignation?: (submissionId: string, attachmentId: string, typeId: string, name: string) => Promise<boolean>;
|
|
9
10
|
submissionId: string;
|
|
10
11
|
fileName: string;
|
|
12
|
+
can: Capabilities | null;
|
|
11
13
|
dispatch?: Dispatch<Action>;
|
|
12
14
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Model } from '@manuscripts/manuscripts-json-schema';
|
|
2
1
|
import React, { Dispatch } from 'react';
|
|
3
2
|
import { SubmissionAttachment } from './FileSectionItem/FileSectionItem';
|
|
4
3
|
import { Action } from './FileSectionState';
|
|
4
|
+
import { FileType } from './util';
|
|
5
5
|
export interface ExternalFileRef {
|
|
6
6
|
url: string;
|
|
7
7
|
kind?: string;
|
|
@@ -9,8 +9,13 @@ export interface ExternalFileRef {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const InlineFilesSection: React.FC<{
|
|
11
11
|
submissionId: string;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
inlineFiles: {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
type: FileType;
|
|
16
|
+
caption?: string;
|
|
17
|
+
attachments?: SubmissionAttachment[];
|
|
18
|
+
}[];
|
|
14
19
|
handleReplace: (submissionId: string, attachmentId: string, name: string, file: File, typeId: string) => Promise<boolean>;
|
|
15
20
|
handleDownload: (url: string) => void;
|
|
16
21
|
isEditor: boolean;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
/// <reference types="react" />
|
|
17
|
-
export declare const CenteredForm: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "title" | "role" | "name" | "placeholder" | "slot" | "style" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "
|
|
17
|
+
export declare const CenteredForm: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "title" | "role" | "name" | "id" | "placeholder" | "slot" | "style" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoComplete" | "method" | "target" | "acceptCharset" | "action" | "encType" | "noValidate"> & import("react").RefAttributes<HTMLFormElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
18
18
|
export declare const FormHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
19
|
export declare const FormActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
20
|
export declare const FormError: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 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
|
+
import { IconProps } from './types';
|
|
18
|
+
declare const UnsupportedFormatFileIcon: React.FC<IconProps>;
|
|
19
|
+
export default UnsupportedFormatFileIcon;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from './components/Tip';
|
|
|
45
45
|
export * from './components/icons';
|
|
46
46
|
export * from './components/Inspector';
|
|
47
47
|
export * from './components/InspectorSection';
|
|
48
|
+
export { default as inlineFiles } from './lib/inlineFiles';
|
|
48
49
|
export { default as PdfPreview } from './components/PdfPreview';
|
|
49
50
|
export * from './components/SubmissionInspector';
|
|
50
51
|
export * from './components/Dropdown';
|
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": "0.31.
|
|
4
|
+
"version": "0.31.4",
|
|
5
5
|
"repository": "gitlab:atypon-opensource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@manuscripts/data": "^0.1.0",
|
|
65
65
|
"@manuscripts/examples": "^0.0.7",
|
|
66
66
|
"@manuscripts/manuscript-transform": "^0.48.16",
|
|
67
|
-
"@manuscripts/manuscripts-json-schema": "^1.49.
|
|
67
|
+
"@manuscripts/manuscripts-json-schema": "^1.49.11",
|
|
68
68
|
"@manuscripts/publish": "^0.2.2",
|
|
69
69
|
"@storybook/addon-actions": "^5.3.14",
|
|
70
70
|
"@storybook/addons": "^5.3.14",
|