@manuscripts/style-guide 1.1.4 → 1.1.5-LEAN-2192
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/EditorHeader/EditorHeader.js +2 -2
- package/dist/cjs/components/EditorHeader/ProceedView.js +5 -5
- package/dist/cjs/components/FileManager/FileManager.js +8 -20
- package/dist/cjs/components/FileManager/FileSectionItem/DragLayer.js +1 -1
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +1 -3
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +4 -6
- package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +3 -16
- package/dist/cjs/components/FileManager/FileSectionState.js +5 -14
- package/dist/cjs/components/FileManager/FilesSection.js +7 -20
- package/dist/cjs/components/FileManager/InlineFilesSection.js +1 -1
- package/dist/cjs/components/FileManager/util.js +1 -323
- package/dist/cjs/index.js +1 -3
- package/dist/cjs/lib/capabilities.js +0 -1
- package/dist/es/components/EditorHeader/EditorHeader.js +2 -2
- package/dist/es/components/EditorHeader/ProceedView.js +5 -5
- package/dist/es/components/FileManager/FileManager.js +9 -21
- package/dist/es/components/FileManager/FileSectionItem/DragLayer.js +1 -1
- package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +1 -3
- package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +4 -6
- package/dist/es/components/FileManager/FileSectionItem/ItemActions.js +4 -17
- package/dist/es/components/FileManager/FileSectionState.js +5 -14
- package/dist/es/components/FileManager/FilesSection.js +9 -22
- package/dist/es/components/FileManager/InlineFilesSection.js +1 -1
- package/dist/es/components/FileManager/util.js +0 -318
- package/dist/es/index.js +0 -1
- package/dist/es/lib/capabilities.js +0 -1
- package/dist/types/components/EditorHeader/EditorHeader.d.ts +1 -1
- package/dist/types/components/EditorHeader/ProceedView.d.ts +1 -1
- package/dist/types/components/FileManager/FileManager.d.ts +2 -4
- 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/FileManager/FileSectionItem/ItemActions.d.ts +0 -2
- package/dist/types/components/FileManager/FileSectionState.d.ts +2 -5
- package/dist/types/components/FileManager/util.d.ts +0 -30
- package/dist/types/index.d.ts +0 -1
- package/dist/types/lib/capabilities.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +0 -131
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActionsList.js +0 -54
- package/dist/cjs/components/FileManager/SelectDesignationActions.js +0 -74
- package/dist/cjs/components/FileManager/SelectDialogDesignation.js +0 -33
- package/dist/es/components/FileManager/FileSectionItem/DesignationActions.js +0 -101
- package/dist/es/components/FileManager/FileSectionItem/DesignationActionsList.js +0 -47
- package/dist/es/components/FileManager/SelectDesignationActions.js +0 -44
- package/dist/es/components/FileManager/SelectDialogDesignation.js +0 -26
- package/dist/types/components/FileManager/FileSectionItem/DesignationActions.d.ts +0 -14
- package/dist/types/components/FileManager/FileSectionItem/DesignationActionsList.d.ts +0 -13
- package/dist/types/components/FileManager/SelectDesignationActions.d.ts +0 -12
- package/dist/types/components/FileManager/SelectDialogDesignation.d.ts +0 -11
|
@@ -5,14 +5,12 @@ export const getInitialState = () => ({
|
|
|
5
5
|
fileUploadedSuccessfullySection: undefined,
|
|
6
6
|
successMessage: '',
|
|
7
7
|
isShowSuccessMessage: false,
|
|
8
|
-
|
|
9
|
-
showDesignationPopup: undefined,
|
|
8
|
+
currentSection: undefined,
|
|
10
9
|
});
|
|
11
10
|
var ActionTypes;
|
|
12
11
|
(function (ActionTypes) {
|
|
13
12
|
ActionTypes["UPLOAD_FILE"] = "UploadFile";
|
|
14
13
|
ActionTypes["MOVE_FILE"] = "moveFile";
|
|
15
|
-
ActionTypes["SELECT_DESIGNATION"] = "selectDesignation";
|
|
16
14
|
ActionTypes["HANDLE_CANCEL_UPLOAD"] = "handleCancel";
|
|
17
15
|
ActionTypes["HANDLE_UPLOAD_ACTION"] = "handleUpload";
|
|
18
16
|
ActionTypes["HANDLE_FINISH_UPLOAD"] = "handleFinishUpload";
|
|
@@ -22,7 +20,7 @@ var ActionTypes;
|
|
|
22
20
|
export const reducer = (state, action) => {
|
|
23
21
|
switch (action.type) {
|
|
24
22
|
case ActionTypes.UPLOAD_FILE: {
|
|
25
|
-
return Object.assign(Object.assign({}, state), {
|
|
23
|
+
return Object.assign(Object.assign({}, state), { uploadedFile: action.uploadFile, currentSection: action.sectionType });
|
|
26
24
|
}
|
|
27
25
|
case ActionTypes.MOVE_FILE: {
|
|
28
26
|
return Object.assign(Object.assign({}, state), { moveToOtherState: {
|
|
@@ -30,17 +28,14 @@ export const reducer = (state, action) => {
|
|
|
30
28
|
name: action.name,
|
|
31
29
|
}, successMessage: action.successMoveMessage, isShowSuccessMessage: false });
|
|
32
30
|
}
|
|
33
|
-
case ActionTypes.SELECT_DESIGNATION: {
|
|
34
|
-
return Object.assign(Object.assign({}, state), { selectDesignation: action.designation });
|
|
35
|
-
}
|
|
36
31
|
case ActionTypes.HANDLE_UPLOAD_ACTION: {
|
|
37
|
-
return Object.assign(Object.assign({}, state), {
|
|
32
|
+
return Object.assign(Object.assign({}, state), { isUploadFile: true, isShowSuccessMessage: false, successMessage: '' });
|
|
38
33
|
}
|
|
39
34
|
case ActionTypes.HANDLE_CANCEL_UPLOAD: {
|
|
40
|
-
return Object.assign(
|
|
35
|
+
return Object.assign({}, state);
|
|
41
36
|
}
|
|
42
37
|
case ActionTypes.HANDLE_FINISH_UPLOAD: {
|
|
43
|
-
return Object.assign(Object.assign({}, state), { isUploadFile: false, uploadedFile: undefined
|
|
38
|
+
return Object.assign(Object.assign({}, state), { isUploadFile: false, uploadedFile: undefined });
|
|
44
39
|
}
|
|
45
40
|
case ActionTypes.HANDLE_SUCCESS_MESSAGE: {
|
|
46
41
|
return Object.assign(Object.assign({}, state), { isShowSuccessMessage: true, successMessage: action.successMessage, fileUploadedSuccessfullySection: action.sectionType });
|
|
@@ -63,10 +58,6 @@ export const actions = {
|
|
|
63
58
|
HANDLE_CANCEL_UPLOAD: () => ({
|
|
64
59
|
type: ActionTypes.HANDLE_CANCEL_UPLOAD,
|
|
65
60
|
}),
|
|
66
|
-
SELECT_DESIGNATION: (designation) => ({
|
|
67
|
-
type: ActionTypes.SELECT_DESIGNATION,
|
|
68
|
-
designation,
|
|
69
|
-
}),
|
|
70
61
|
MOVE_FILE: (attachmentId, typeId, name, successMoveMessage) => ({
|
|
71
62
|
type: ActionTypes.MOVE_FILE,
|
|
72
63
|
typeId,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
2
|
import { AlertMessage, AlertMessageType } from '../AlertMessage';
|
|
3
|
-
import { DragItemArea } from './DragItemArea';
|
|
4
3
|
import { PermissionsContext } from './FileManager';
|
|
5
4
|
import { FileSectionUploadItem } from './FileSectionItem/FileSectionUploadItem';
|
|
6
5
|
import { actions } from './FileSectionState';
|
|
7
|
-
import { SelectDialogDesignation } from './SelectDialogDesignation';
|
|
8
6
|
import { UploadFileArea } from './UploadFileArea';
|
|
9
|
-
import { FileSectionType
|
|
7
|
+
import { FileSectionType } from './util';
|
|
10
8
|
export const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, filesItem, dispatch, state, }) => {
|
|
11
9
|
let uploadedFileExtension = '';
|
|
12
10
|
if (state.uploadedFile) {
|
|
@@ -14,13 +12,12 @@ export const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, fil
|
|
|
14
12
|
}
|
|
15
13
|
const isSupplementFilesTab = fileSection === FileSectionType.Supplements;
|
|
16
14
|
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
15
|
const can = useContext(PermissionsContext);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
state.uploadedFile &&
|
|
18
|
+
fileSection === state.currentSection &&
|
|
19
|
+
handleUpload(state.uploadedFile);
|
|
20
|
+
}, [state.uploadedFile]);
|
|
24
21
|
const handleSuccessMessage = () => {
|
|
25
22
|
return (React.createElement(AlertMessage, { type: AlertMessageType.success, hideCloseButton: true, dismissButton: {
|
|
26
23
|
text: 'OK',
|
|
@@ -30,18 +27,8 @@ export const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, fil
|
|
|
30
27
|
return (React.createElement("div", null,
|
|
31
28
|
(can === null || can === void 0 ? void 0 : can.uploadFile) && (React.createElement(React.Fragment, null,
|
|
32
29
|
(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 })))),
|
|
30
|
+
state.isUploadFile && state.uploadedFile && (React.createElement(FileSectionUploadItem, { fileName: state.uploadedFile.name, isLoading: state.isUploadFile })))),
|
|
36
31
|
state.fileUploadedSuccessfullySection === fileSection &&
|
|
37
32
|
handleSuccessMessage(),
|
|
38
|
-
|
|
39
|
-
dispatch(actions.HANDLE_CANCEL_UPLOAD());
|
|
40
|
-
}, uploadFileHandler: handleUploadOtherFile, dispatch: dispatch, fileSection: fileSection }),
|
|
41
|
-
filesItem,
|
|
42
|
-
(can === null || can === void 0 ? void 0 : can.changeDesignation) &&
|
|
43
|
-
enableDragAndDrop &&
|
|
44
|
-
(isSupplementFilesTab || isOtherFileTab) && (React.createElement(DragItemArea, { text: isSupplementFilesTab
|
|
45
|
-
? 'Drag the items to place them in the text'
|
|
46
|
-
: 'Drag the items to place in the Supplements section or in the text' }))));
|
|
33
|
+
filesItem));
|
|
47
34
|
};
|
|
@@ -48,7 +48,7 @@ const FileReference = ({ attachment, handleReplace, handleDownload, handleUpdate
|
|
|
48
48
|
(attachment === null || attachment === void 0 ? void 0 : attachment.modelId) &&
|
|
49
49
|
handleUpdateInline(attachment.modelId, uploadAttachment), detachAttachmnetHandler: () => handleDetachFile &&
|
|
50
50
|
attachment.modelId &&
|
|
51
|
-
handleDetachFile(attachment.id, attachment.modelId), downloadAttachmentHandler: handleDownload, attachmentId: attachment.id, fileName: attachment.name,
|
|
51
|
+
handleDetachFile(attachment.id, attachment.modelId), downloadAttachmentHandler: handleDownload, attachmentId: attachment.id, fileName: attachment.name, publicUrl: attachment.link, hideActionList: toggleOpen, dispatch: dispatch, dropDownClassName: 'ref_item_dropdown' }))))));
|
|
52
52
|
};
|
|
53
53
|
const ElementItem = styled(Item) `
|
|
54
54
|
display: flex;
|
|
@@ -32,245 +32,6 @@ export var FileType;
|
|
|
32
32
|
FileType[FileType["Figure"] = 10] = "Figure";
|
|
33
33
|
FileType[FileType["GraphicalAbstract"] = 11] = "GraphicalAbstract";
|
|
34
34
|
})(FileType || (FileType = {}));
|
|
35
|
-
export var Designation;
|
|
36
|
-
(function (Designation) {
|
|
37
|
-
Designation[Designation["Figure"] = 0] = "Figure";
|
|
38
|
-
Designation[Designation["Table"] = 1] = "Table";
|
|
39
|
-
Designation[Designation["Supplementary"] = 2] = "Supplementary";
|
|
40
|
-
Designation[Designation["ConflictOfInterest"] = 3] = "ConflictOfInterest";
|
|
41
|
-
Designation[Designation["Document"] = 4] = "Document";
|
|
42
|
-
Designation[Designation["GraphicalAbstract"] = 5] = "GraphicalAbstract";
|
|
43
|
-
Designation[Designation["GraphicalAbstractImage"] = 6] = "GraphicalAbstractImage";
|
|
44
|
-
Designation[Designation["GraphicalAbstractText"] = 7] = "GraphicalAbstractText";
|
|
45
|
-
Designation[Designation["Metadata"] = 8] = "Metadata";
|
|
46
|
-
Designation[Designation["SubmissionFile"] = 9] = "SubmissionFile";
|
|
47
|
-
Designation[Designation["SubmissionPdf"] = 10] = "SubmissionPdf";
|
|
48
|
-
Designation[Designation["TitlePage"] = 11] = "TitlePage";
|
|
49
|
-
Designation[Designation["Dataset"] = 12] = "Dataset";
|
|
50
|
-
Designation[Designation["MainManuscript"] = 13] = "MainManuscript";
|
|
51
|
-
})(Designation || (Designation = {}));
|
|
52
|
-
export const designationWithFileSectionsMap = new Map([
|
|
53
|
-
[Designation.Figure, FileSectionType.OtherFile],
|
|
54
|
-
[Designation.Table, FileSectionType.OtherFile],
|
|
55
|
-
[Designation.Supplementary, FileSectionType.Supplements],
|
|
56
|
-
[Designation.ConflictOfInterest, FileSectionType.OtherFile],
|
|
57
|
-
[Designation.Document, FileSectionType.OtherFile],
|
|
58
|
-
[Designation.GraphicalAbstract, FileSectionType.OtherFile],
|
|
59
|
-
[Designation.GraphicalAbstractImage, FileSectionType.OtherFile],
|
|
60
|
-
[Designation.GraphicalAbstractText, FileSectionType.OtherFile],
|
|
61
|
-
[Designation.Metadata, FileSectionType.OtherFile],
|
|
62
|
-
[Designation.SubmissionFile, FileSectionType.OtherFile],
|
|
63
|
-
[Designation.SubmissionPdf, FileSectionType.OtherFile],
|
|
64
|
-
[Designation.TitlePage, FileSectionType.OtherFile],
|
|
65
|
-
[Designation.Dataset, FileSectionType.OtherFile],
|
|
66
|
-
[Designation.MainManuscript, FileSectionType.OtherFile],
|
|
67
|
-
]);
|
|
68
|
-
export const namesWithDesignationMap = new Map([
|
|
69
|
-
['figure', Designation.Figure],
|
|
70
|
-
['table', Designation.Table],
|
|
71
|
-
['supplementary', Designation.Supplementary],
|
|
72
|
-
['conflict-of-interest', Designation.ConflictOfInterest],
|
|
73
|
-
['document', Designation.Document],
|
|
74
|
-
['graphical-abstract', Designation.GraphicalAbstract],
|
|
75
|
-
['graphical-abstract-image', Designation.GraphicalAbstractImage],
|
|
76
|
-
['graphical-abstract-text', Designation.GraphicalAbstractText],
|
|
77
|
-
['metadata', Designation.Metadata],
|
|
78
|
-
['submission-file', Designation.SubmissionFile],
|
|
79
|
-
['submission-pdf', Designation.SubmissionPdf],
|
|
80
|
-
['title-page', Designation.TitlePage],
|
|
81
|
-
['dataset', Designation.Dataset],
|
|
82
|
-
['main-manuscript', Designation.MainManuscript],
|
|
83
|
-
]);
|
|
84
|
-
export const designationWithReadableNamesMap = new Map([
|
|
85
|
-
[Designation.Figure, 'Figure'],
|
|
86
|
-
[Designation.Table, 'Table'],
|
|
87
|
-
[Designation.Supplementary, 'Supplementary'],
|
|
88
|
-
[Designation.ConflictOfInterest, 'Conflict Of Interest'],
|
|
89
|
-
[Designation.Document, 'Document'],
|
|
90
|
-
[Designation.GraphicalAbstract, 'Graphical Abstract'],
|
|
91
|
-
[Designation.GraphicalAbstractImage, 'Graphical Abstract Image'],
|
|
92
|
-
[Designation.GraphicalAbstractText, 'Graphical Abstract Text'],
|
|
93
|
-
[Designation.Metadata, 'Metadata'],
|
|
94
|
-
[Designation.SubmissionFile, 'Submission File'],
|
|
95
|
-
[Designation.SubmissionPdf, 'Submission PDF'],
|
|
96
|
-
[Designation.TitlePage, 'Title Page'],
|
|
97
|
-
[Designation.Dataset, 'Dataset'],
|
|
98
|
-
[Designation.MainManuscript, 'Main Manuscript'],
|
|
99
|
-
]);
|
|
100
|
-
export const designationWithAllowedMediaTypesMap = new Map([
|
|
101
|
-
[Designation.Figure, ['jpeg', 'png', 'tiff', 'pdf', 'svg', 'ai']],
|
|
102
|
-
[
|
|
103
|
-
Designation.Table,
|
|
104
|
-
['xls', 'csv', 'tsv', 'tex', 'html', 'jpeg', 'jpg', 'png', 'gif', 'tiff'],
|
|
105
|
-
],
|
|
106
|
-
[Designation.Supplementary, []],
|
|
107
|
-
[Designation.ConflictOfInterest, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
108
|
-
[Designation.Document, ['doc', 'docx', 'pdf', 'tex']],
|
|
109
|
-
[Designation.GraphicalAbstract, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
110
|
-
[
|
|
111
|
-
Designation.GraphicalAbstractImage,
|
|
112
|
-
['jpeg', 'png', 'tiff', 'gif', 'pdf', 'eps'],
|
|
113
|
-
],
|
|
114
|
-
[Designation.GraphicalAbstractText, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
115
|
-
[Designation.Metadata, ['xml']],
|
|
116
|
-
[Designation.SubmissionFile, []],
|
|
117
|
-
[Designation.SubmissionPdf, ['pdf']],
|
|
118
|
-
[Designation.TitlePage, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
119
|
-
[Designation.Dataset, []],
|
|
120
|
-
[Designation.MainManuscript, ['manuproj', 'docx']],
|
|
121
|
-
]);
|
|
122
|
-
export const designationWithAllowedDesignationsToTransitionMap = new Map([
|
|
123
|
-
[
|
|
124
|
-
Designation.Figure,
|
|
125
|
-
[
|
|
126
|
-
Designation.SubmissionFile,
|
|
127
|
-
Designation.Supplementary,
|
|
128
|
-
Designation.GraphicalAbstractImage,
|
|
129
|
-
Designation.Dataset,
|
|
130
|
-
],
|
|
131
|
-
],
|
|
132
|
-
[
|
|
133
|
-
Designation.Table,
|
|
134
|
-
[
|
|
135
|
-
Designation.Supplementary,
|
|
136
|
-
Designation.SubmissionFile,
|
|
137
|
-
Designation.Dataset,
|
|
138
|
-
],
|
|
139
|
-
],
|
|
140
|
-
[
|
|
141
|
-
Designation.Supplementary,
|
|
142
|
-
[
|
|
143
|
-
Designation.Supplementary,
|
|
144
|
-
Designation.SubmissionFile,
|
|
145
|
-
Designation.Document,
|
|
146
|
-
Designation.Figure,
|
|
147
|
-
Designation.GraphicalAbstractImage,
|
|
148
|
-
Designation.ConflictOfInterest,
|
|
149
|
-
Designation.SubmissionPdf,
|
|
150
|
-
Designation.Metadata,
|
|
151
|
-
Designation.GraphicalAbstractText,
|
|
152
|
-
Designation.GraphicalAbstract,
|
|
153
|
-
Designation.TitlePage,
|
|
154
|
-
Designation.Table,
|
|
155
|
-
Designation.Dataset,
|
|
156
|
-
],
|
|
157
|
-
],
|
|
158
|
-
[
|
|
159
|
-
Designation.ConflictOfInterest,
|
|
160
|
-
[
|
|
161
|
-
Designation.ConflictOfInterest,
|
|
162
|
-
Designation.Document,
|
|
163
|
-
Designation.GraphicalAbstract,
|
|
164
|
-
Designation.GraphicalAbstractImage,
|
|
165
|
-
Designation.GraphicalAbstractText,
|
|
166
|
-
Designation.Metadata,
|
|
167
|
-
Designation.SubmissionFile,
|
|
168
|
-
Designation.SubmissionPdf,
|
|
169
|
-
Designation.Dataset,
|
|
170
|
-
],
|
|
171
|
-
],
|
|
172
|
-
[
|
|
173
|
-
Designation.Document,
|
|
174
|
-
[
|
|
175
|
-
Designation.ConflictOfInterest,
|
|
176
|
-
Designation.Document,
|
|
177
|
-
Designation.GraphicalAbstract,
|
|
178
|
-
Designation.GraphicalAbstractImage,
|
|
179
|
-
Designation.GraphicalAbstractText,
|
|
180
|
-
Designation.Metadata,
|
|
181
|
-
Designation.SubmissionFile,
|
|
182
|
-
Designation.SubmissionPdf,
|
|
183
|
-
Designation.MainManuscript,
|
|
184
|
-
Designation.Dataset,
|
|
185
|
-
],
|
|
186
|
-
],
|
|
187
|
-
[
|
|
188
|
-
Designation.GraphicalAbstract,
|
|
189
|
-
[
|
|
190
|
-
Designation.Document,
|
|
191
|
-
Designation.SubmissionFile,
|
|
192
|
-
Designation.Supplementary,
|
|
193
|
-
Designation.Dataset,
|
|
194
|
-
],
|
|
195
|
-
],
|
|
196
|
-
[
|
|
197
|
-
Designation.GraphicalAbstractImage,
|
|
198
|
-
[
|
|
199
|
-
Designation.Figure,
|
|
200
|
-
Designation.SubmissionFile,
|
|
201
|
-
Designation.Supplementary,
|
|
202
|
-
Designation.Dataset,
|
|
203
|
-
],
|
|
204
|
-
],
|
|
205
|
-
[
|
|
206
|
-
Designation.GraphicalAbstractText,
|
|
207
|
-
[
|
|
208
|
-
Designation.Document,
|
|
209
|
-
Designation.SubmissionFile,
|
|
210
|
-
Designation.Supplementary,
|
|
211
|
-
Designation.Dataset,
|
|
212
|
-
],
|
|
213
|
-
],
|
|
214
|
-
[Designation.Metadata, [Designation.SubmissionFile, Designation.Dataset]],
|
|
215
|
-
[
|
|
216
|
-
Designation.SubmissionFile,
|
|
217
|
-
[
|
|
218
|
-
Designation.Supplementary,
|
|
219
|
-
Designation.SubmissionFile,
|
|
220
|
-
Designation.Document,
|
|
221
|
-
Designation.Figure,
|
|
222
|
-
Designation.GraphicalAbstractImage,
|
|
223
|
-
Designation.ConflictOfInterest,
|
|
224
|
-
Designation.SubmissionPdf,
|
|
225
|
-
Designation.Metadata,
|
|
226
|
-
Designation.GraphicalAbstractText,
|
|
227
|
-
Designation.GraphicalAbstract,
|
|
228
|
-
Designation.TitlePage,
|
|
229
|
-
Designation.Table,
|
|
230
|
-
Designation.Dataset,
|
|
231
|
-
],
|
|
232
|
-
],
|
|
233
|
-
[
|
|
234
|
-
Designation.SubmissionPdf,
|
|
235
|
-
[
|
|
236
|
-
Designation.ConflictOfInterest,
|
|
237
|
-
Designation.Document,
|
|
238
|
-
Designation.GraphicalAbstract,
|
|
239
|
-
Designation.GraphicalAbstractImage,
|
|
240
|
-
Designation.GraphicalAbstractText,
|
|
241
|
-
Designation.Metadata,
|
|
242
|
-
Designation.SubmissionFile,
|
|
243
|
-
Designation.SubmissionPdf,
|
|
244
|
-
Designation.Dataset,
|
|
245
|
-
],
|
|
246
|
-
],
|
|
247
|
-
[
|
|
248
|
-
Designation.TitlePage,
|
|
249
|
-
[
|
|
250
|
-
Designation.Document,
|
|
251
|
-
Designation.SubmissionFile,
|
|
252
|
-
Designation.Supplementary,
|
|
253
|
-
Designation.Dataset,
|
|
254
|
-
],
|
|
255
|
-
],
|
|
256
|
-
[
|
|
257
|
-
Designation.Dataset,
|
|
258
|
-
[
|
|
259
|
-
Designation.Supplementary,
|
|
260
|
-
Designation.SubmissionFile,
|
|
261
|
-
Designation.Document,
|
|
262
|
-
Designation.Figure,
|
|
263
|
-
Designation.GraphicalAbstractImage,
|
|
264
|
-
Designation.ConflictOfInterest,
|
|
265
|
-
Designation.SubmissionPdf,
|
|
266
|
-
Designation.Metadata,
|
|
267
|
-
Designation.GraphicalAbstractText,
|
|
268
|
-
Designation.GraphicalAbstract,
|
|
269
|
-
Designation.TitlePage,
|
|
270
|
-
Designation.Table,
|
|
271
|
-
],
|
|
272
|
-
],
|
|
273
|
-
]);
|
|
274
35
|
export const extensionsWithFileTypesMap = new Map([
|
|
275
36
|
['png', FileType.Image],
|
|
276
37
|
['jpg', FileType.Image],
|
|
@@ -378,85 +139,6 @@ export const generateAttachmentsTitles = (externalFiles, fileSectionType) => {
|
|
|
378
139
|
}));
|
|
379
140
|
return result;
|
|
380
141
|
};
|
|
381
|
-
export const getDesignationActionsList = (designation, fileExtension) => {
|
|
382
|
-
const allowedDesignationsToTransition = designationWithAllowedDesignationsToTransitionMap.get(designation);
|
|
383
|
-
if (allowedDesignationsToTransition) {
|
|
384
|
-
if (designation === Designation.Supplementary ||
|
|
385
|
-
designation === Designation.SubmissionFile) {
|
|
386
|
-
return allowedDesignationsToTransition;
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
allowedDesignationsToTransition.filter((value) => {
|
|
390
|
-
const allowedMediaTypes = designationWithAllowedMediaTypesMap.get(value);
|
|
391
|
-
if (allowedMediaTypes) {
|
|
392
|
-
return allowedMediaTypes.indexOf(fileExtension) !== -1;
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
return false;
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
return allowedDesignationsToTransition;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
return [];
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
export const getDesignationName = (designation) => {
|
|
406
|
-
let result = undefined;
|
|
407
|
-
namesWithDesignationMap.forEach((value, key, map) => {
|
|
408
|
-
if (value === designation) {
|
|
409
|
-
result = key;
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
if (result == undefined) {
|
|
413
|
-
result = '';
|
|
414
|
-
}
|
|
415
|
-
return result;
|
|
416
|
-
};
|
|
417
|
-
export const getDesignationByFileSection = (fileSectionType) => {
|
|
418
|
-
const result = new Array();
|
|
419
|
-
designationWithFileSectionsMap.forEach((value, key, map) => {
|
|
420
|
-
if (value === fileSectionType) {
|
|
421
|
-
result.push(key);
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
return result;
|
|
425
|
-
};
|
|
426
|
-
export const getUploadFileDesignationList = (fileExtension, fileSectionType, can) => {
|
|
427
|
-
const result = new Array();
|
|
428
|
-
const checkDesignation = (value) => {
|
|
429
|
-
if (value === Designation.MainManuscript && !(can === null || can === void 0 ? void 0 : can.setMainManuscript)) {
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
const allowedExtension = designationWithAllowedMediaTypesMap.get(value);
|
|
433
|
-
const isAllowed = allowedExtension === null || allowedExtension === void 0 ? void 0 : allowedExtension.includes(fileExtension);
|
|
434
|
-
if (isAllowed ||
|
|
435
|
-
value === Designation.Supplementary ||
|
|
436
|
-
value === Designation.SubmissionFile ||
|
|
437
|
-
value === Designation.Dataset) {
|
|
438
|
-
const label = designationWithReadableNamesMap.get(value);
|
|
439
|
-
if (label) {
|
|
440
|
-
result.push({
|
|
441
|
-
value: value,
|
|
442
|
-
label: label,
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
if (typeof fileSectionType === 'number') {
|
|
448
|
-
const allowedDesignationByFileSection = getDesignationByFileSection(fileSectionType);
|
|
449
|
-
allowedDesignationByFileSection.forEach(checkDesignation);
|
|
450
|
-
}
|
|
451
|
-
else if (Array.isArray(fileSectionType)) {
|
|
452
|
-
designationWithFileSectionsMap.forEach((value, key) => {
|
|
453
|
-
if (fileSectionType.includes(key)) {
|
|
454
|
-
checkDesignation(key);
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
return result;
|
|
459
|
-
};
|
|
460
142
|
export const droppableSections = [
|
|
461
143
|
FileSectionType.Supplements,
|
|
462
144
|
FileSectionType.OtherFile,
|
package/dist/es/index.js
CHANGED
|
@@ -55,6 +55,5 @@ export * from './lib/authors';
|
|
|
55
55
|
export * from './lib/capabilities';
|
|
56
56
|
export { default as errorsDecoder } from './lib/errors-decoder';
|
|
57
57
|
export * from './types';
|
|
58
|
-
export { SelectDialogDesignation } from './components/FileManager/SelectDialogDesignation';
|
|
59
58
|
export * from './components/LoadingOverlay';
|
|
60
59
|
export * from './components/EditorHeader/EditorHeader';
|
|
@@ -32,7 +32,6 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
32
32
|
viewHistory: false,
|
|
33
33
|
restoreVersion: isOwner() || isEditor() || isWriter(),
|
|
34
34
|
downloadFiles: true,
|
|
35
|
-
changeDesignation: (isOwner() || isEditor() || isWriter()) && allowed(A.updateAttachment),
|
|
36
35
|
replaceFile: isOwner() || isEditor() || isWriter(),
|
|
37
36
|
uploadFile: isOwner() || isEditor() || isWriter(),
|
|
38
37
|
handleQualityReport: isOwner() || isEditor() || isWriter(),
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
export type PartialSubmission = {
|
|
4
4
|
id: string;
|
|
5
5
|
currentStep: SubmissionStep;
|
|
6
|
-
|
|
6
|
+
previousStep?: SubmissionStep | null | undefined;
|
|
7
7
|
};
|
|
8
8
|
export type SubmissionStep = {
|
|
9
9
|
type: SubmissionStepType;
|
|
@@ -11,8 +11,8 @@ export declare const ProceedView: React.FC<{
|
|
|
11
11
|
noteValue: string;
|
|
12
12
|
currentStepTransition: SubmissionStepTransition[];
|
|
13
13
|
error: string | undefined;
|
|
14
|
-
nextStepType: SubmissionStepType;
|
|
15
14
|
currentStepType: SubmissionStepType;
|
|
15
|
+
previousStepType: SubmissionStepType;
|
|
16
16
|
confirmationDialog: boolean;
|
|
17
17
|
onCancelClick: () => void;
|
|
18
18
|
continueDialogAction: () => Promise<void>;
|
|
@@ -3,14 +3,12 @@ import { Build } from '@manuscripts/transform';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Capabilities } from '../../lib/capabilities';
|
|
5
5
|
import { FileAttachment } from './FileSectionItem/FileSectionItem';
|
|
6
|
-
export type Upload = (file: File
|
|
7
|
-
export type Replace = (attachmentId: string, name: string, file: File
|
|
8
|
-
export type ChangeDesignation = (attachmentId: string, typeId: string, name: string) => Promise<boolean>;
|
|
6
|
+
export type Upload = (file: File) => Promise<boolean | FileAttachment | undefined>;
|
|
7
|
+
export type Replace = (attachmentId: string, name: string, file: File) => Promise<boolean | FileAttachment | undefined>;
|
|
9
8
|
export interface FileManagement {
|
|
10
9
|
getAttachments: () => FileAttachment[];
|
|
11
10
|
upload: Upload;
|
|
12
11
|
replace: Replace;
|
|
13
|
-
changeDesignation: ChangeDesignation;
|
|
14
12
|
}
|
|
15
13
|
export declare const PermissionsContext: React.Context<Capabilities | null>;
|
|
16
14
|
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
|
fileAttachmentName: 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
|
import { FileSectionType } from '../util';
|
|
7
7
|
export type FileAttachment = {
|
|
@@ -19,13 +19,11 @@ export interface FileSectionItemProps {
|
|
|
19
19
|
fileSection: FileSectionType;
|
|
20
20
|
title: string;
|
|
21
21
|
showAttachmentName?: boolean;
|
|
22
|
-
showDesignationActions?: boolean;
|
|
23
22
|
showActions?: boolean;
|
|
24
23
|
showReplaceAction?: boolean;
|
|
25
24
|
handleDownload?: (url: string) => void;
|
|
26
25
|
handleReplace?: Replace;
|
|
27
26
|
handleSupplementReplace?: (attachment: FileAttachment, oldAttachmentId: string) => void;
|
|
28
|
-
handleChangeDesignation: ChangeDesignation;
|
|
29
27
|
dispatch?: Dispatch<Action>;
|
|
30
28
|
dragRef?: DragElementWrapper<DragSourceOptions>;
|
|
31
29
|
className?: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { Dispatch } from 'react';
|
|
2
|
-
import { Maybe } from '../../SubmissionInspector/types';
|
|
3
2
|
import { Replace } from '../FileManager';
|
|
4
3
|
import { Action } from '../FileSectionState';
|
|
5
4
|
import { FileSectionType } from '../util';
|
|
@@ -13,7 +12,6 @@ export declare const ItemActions: React.FC<{
|
|
|
13
12
|
handleSupplementReplace?: (attachment: FileAttachment, oldAttachmentId: string) => void;
|
|
14
13
|
attachmentId: string;
|
|
15
14
|
fileName: string;
|
|
16
|
-
designation?: Maybe<string> | undefined;
|
|
17
15
|
publicUrl: string | undefined;
|
|
18
16
|
hideActionList: (e?: React.MouseEvent) => void;
|
|
19
17
|
dispatch?: Dispatch<Action>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileSectionType } from './util';
|
|
2
2
|
export declare const getInitialState: () => State;
|
|
3
3
|
export interface State {
|
|
4
4
|
uploadedFile: File | undefined;
|
|
@@ -10,13 +10,11 @@ export interface State {
|
|
|
10
10
|
fileUploadedSuccessfullySection: FileSectionType | undefined;
|
|
11
11
|
successMessage: string;
|
|
12
12
|
isShowSuccessMessage: boolean;
|
|
13
|
-
|
|
14
|
-
showDesignationPopup: FileSectionType | undefined;
|
|
13
|
+
currentSection: FileSectionType | undefined;
|
|
15
14
|
}
|
|
16
15
|
declare enum ActionTypes {
|
|
17
16
|
UPLOAD_FILE = "UploadFile",
|
|
18
17
|
MOVE_FILE = "moveFile",
|
|
19
|
-
SELECT_DESIGNATION = "selectDesignation",
|
|
20
18
|
HANDLE_CANCEL_UPLOAD = "handleCancel",
|
|
21
19
|
HANDLE_UPLOAD_ACTION = "handleUpload",
|
|
22
20
|
HANDLE_FINISH_UPLOAD = "handleFinishUpload",
|
|
@@ -32,7 +30,6 @@ export declare const actions: {
|
|
|
32
30
|
UPLOAD_FILE: (uploadFile: File, sectionType: FileSectionType) => Action;
|
|
33
31
|
HANDLE_UPLOAD_ACTION: () => Action;
|
|
34
32
|
HANDLE_CANCEL_UPLOAD: () => Action;
|
|
35
|
-
SELECT_DESIGNATION: (designation: Designation) => Action;
|
|
36
33
|
MOVE_FILE: (attachmentId: string, typeId: string, name: string, successMoveMessage: string) => Action;
|
|
37
34
|
HANDLE_FINISH_UPLOAD: () => Action;
|
|
38
35
|
HANDLE_SUCCESS_MESSAGE: (successMessage: string, sectionType?: FileSectionType) => Action;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Capabilities } from '../../lib/capabilities';
|
|
2
|
-
import { Maybe } from '../SubmissionInspector/types';
|
|
3
1
|
import { FileAttachment } from './FileSectionItem/FileSectionItem';
|
|
4
2
|
export declare enum FileSectionType {
|
|
5
3
|
Inline = 0,
|
|
@@ -20,27 +18,6 @@ export declare enum FileType {
|
|
|
20
18
|
Figure = 10,
|
|
21
19
|
GraphicalAbstract = 11
|
|
22
20
|
}
|
|
23
|
-
export declare enum Designation {
|
|
24
|
-
Figure = 0,
|
|
25
|
-
Table = 1,
|
|
26
|
-
Supplementary = 2,
|
|
27
|
-
ConflictOfInterest = 3,
|
|
28
|
-
Document = 4,
|
|
29
|
-
GraphicalAbstract = 5,
|
|
30
|
-
GraphicalAbstractImage = 6,
|
|
31
|
-
GraphicalAbstractText = 7,
|
|
32
|
-
Metadata = 8,
|
|
33
|
-
SubmissionFile = 9,
|
|
34
|
-
SubmissionPdf = 10,
|
|
35
|
-
TitlePage = 11,
|
|
36
|
-
Dataset = 12,
|
|
37
|
-
MainManuscript = 13
|
|
38
|
-
}
|
|
39
|
-
export declare const designationWithFileSectionsMap: Map<Designation, FileSectionType>;
|
|
40
|
-
export declare const namesWithDesignationMap: Map<Maybe<string> | undefined, Designation>;
|
|
41
|
-
export declare const designationWithReadableNamesMap: Map<Designation, string>;
|
|
42
|
-
export declare const designationWithAllowedMediaTypesMap: Map<Designation, string[]>;
|
|
43
|
-
export declare const designationWithAllowedDesignationsToTransitionMap: Map<Designation, Designation[]>;
|
|
44
21
|
export declare const extensionsWithFileTypesMap: Map<string, FileType>;
|
|
45
22
|
export declare const fileTypesWithTitlesMap: Map<FileType | undefined, string>;
|
|
46
23
|
export declare const fileTypesWithIconMap: Map<FileType | undefined, JSX.Element>;
|
|
@@ -48,11 +25,4 @@ export declare const generateAttachmentsTitles: (externalFiles: FileAttachment[]
|
|
|
48
25
|
title: string;
|
|
49
26
|
externalFile: FileAttachment;
|
|
50
27
|
}>;
|
|
51
|
-
export declare const getDesignationActionsList: (designation: Designation, fileExtension: string) => Array<Designation>;
|
|
52
|
-
export declare const getDesignationName: (designation: Designation) => string;
|
|
53
|
-
export declare const getDesignationByFileSection: (fileSectionType: FileSectionType) => Array<Designation>;
|
|
54
|
-
export declare const getUploadFileDesignationList: (fileExtension: string, fileSectionType: FileSectionType | Designation[], can: Capabilities | null) => Array<{
|
|
55
|
-
value: number;
|
|
56
|
-
label: string;
|
|
57
|
-
}>;
|
|
58
28
|
export declare const droppableSections: FileSectionType[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -56,6 +56,5 @@ export * from './lib/authors';
|
|
|
56
56
|
export * from './lib/capabilities';
|
|
57
57
|
export { default as errorsDecoder } from './lib/errors-decoder';
|
|
58
58
|
export * from './types';
|
|
59
|
-
export { SelectDialogDesignation } from './components/FileManager/SelectDialogDesignation';
|
|
60
59
|
export * from './components/LoadingOverlay';
|
|
61
60
|
export * from './components/EditorHeader/EditorHeader';
|
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.1.
|
|
4
|
+
"version": "1.1.5-LEAN-2192",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|