@manuscripts/style-guide 0.31.1 → 0.31.2
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/FileSectionItem/DesignationActions.js +15 -3
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +1 -4
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/lib/inlineFiles.js +65 -41
- package/dist/es/components/FileManager/FileSectionItem/DesignationActions.js +15 -3
- package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +1 -4
- package/dist/es/index.js +1 -0
- package/dist/es/lib/inlineFiles.js +66 -42
- package/dist/types/components/FileManager/FileSectionItem/DesignationActions.d.ts +2 -0
- package/dist/types/components/Form.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -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,
|
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,73 @@ 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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
break;
|
|
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
|
-
});
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
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),
|
|
81
62
|
});
|
|
82
63
|
}
|
|
83
64
|
});
|
|
84
65
|
return files;
|
|
85
66
|
};
|
|
67
|
+
const getAuxiliaryObjects = (modelMap) => {
|
|
68
|
+
var _a;
|
|
69
|
+
let graphicalAbstractFigureId, figureElementIds = [];
|
|
70
|
+
const 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
|
+
});
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case manuscripts_json_schema_1.ObjectTypes.FigureElement:
|
|
84
|
+
case manuscripts_json_schema_1.ObjectTypes.MultiGraphicFigureElement:
|
|
85
|
+
figureElementIds.push(model._id);
|
|
86
|
+
break;
|
|
87
|
+
case manuscripts_json_schema_1.ObjectTypes.TableElement:
|
|
88
|
+
tableElementIds.push(model._id);
|
|
89
|
+
break;
|
|
90
|
+
case manuscripts_json_schema_1.ObjectTypes.ElementsOrder: {
|
|
91
|
+
const elementsOrder = model;
|
|
92
|
+
orderObjects[elementsOrder.elementType] = elementsOrder;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
figureElementIds = figureElementIds.filter((id) => id !== graphicalAbstractFigureId);
|
|
97
|
+
return {
|
|
98
|
+
graphicalAbstractFigureId,
|
|
99
|
+
figureElement: orderObjects[manuscripts_json_schema_1.ObjectTypes.FigureElement]
|
|
100
|
+
? sortAuxiliaryObject(orderObjects[manuscripts_json_schema_1.ObjectTypes.FigureElement], figureElementIds)
|
|
101
|
+
: figureElementIds,
|
|
102
|
+
tableElement: orderObjects[manuscripts_json_schema_1.ObjectTypes.TableElement]
|
|
103
|
+
? sortAuxiliaryObject(orderObjects[manuscripts_json_schema_1.ObjectTypes.TableElement], tableElementIds)
|
|
104
|
+
: tableElementIds,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
const sortAuxiliaryObject = (orderObject, auxiliaryObjectIds) => {
|
|
108
|
+
return auxiliaryObjectIds.sort((a, b) => orderObject.elements.indexOf(a) - orderObject.elements.indexOf(b));
|
|
109
|
+
};
|
|
@@ -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,
|
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,73 @@ 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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
break;
|
|
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
|
-
});
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
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),
|
|
79
60
|
});
|
|
80
61
|
}
|
|
81
62
|
});
|
|
82
63
|
return files;
|
|
83
64
|
};
|
|
65
|
+
const getAuxiliaryObjects = (modelMap) => {
|
|
66
|
+
var _a;
|
|
67
|
+
let graphicalAbstractFigureId, figureElementIds = [];
|
|
68
|
+
const 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
|
+
});
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case ObjectTypes.FigureElement:
|
|
82
|
+
case ObjectTypes.MultiGraphicFigureElement:
|
|
83
|
+
figureElementIds.push(model._id);
|
|
84
|
+
break;
|
|
85
|
+
case ObjectTypes.TableElement:
|
|
86
|
+
tableElementIds.push(model._id);
|
|
87
|
+
break;
|
|
88
|
+
case ObjectTypes.ElementsOrder: {
|
|
89
|
+
const elementsOrder = model;
|
|
90
|
+
orderObjects[elementsOrder.elementType] = elementsOrder;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
figureElementIds = figureElementIds.filter((id) => id !== graphicalAbstractFigureId);
|
|
95
|
+
return {
|
|
96
|
+
graphicalAbstractFigureId,
|
|
97
|
+
figureElement: orderObjects[ObjectTypes.FigureElement]
|
|
98
|
+
? sortAuxiliaryObject(orderObjects[ObjectTypes.FigureElement], figureElementIds)
|
|
99
|
+
: figureElementIds,
|
|
100
|
+
tableElement: orderObjects[ObjectTypes.TableElement]
|
|
101
|
+
? sortAuxiliaryObject(orderObjects[ObjectTypes.TableElement], tableElementIds)
|
|
102
|
+
: tableElementIds,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const sortAuxiliaryObject = (orderObject, auxiliaryObjectIds) => {
|
|
106
|
+
return auxiliaryObjectIds.sort((a, b) => orderObject.elements.indexOf(a) - orderObject.elements.indexOf(b));
|
|
107
|
+
};
|
|
@@ -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
|
}>;
|
|
@@ -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>;
|
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.2",
|
|
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",
|