@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
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.droppableSections = exports.
|
|
6
|
+
exports.droppableSections = exports.generateAttachmentsTitles = exports.fileTypesWithIconMap = exports.fileTypesWithTitlesMap = exports.extensionsWithFileTypesMap = exports.FileType = exports.FileSectionType = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const audio_icon_1 = __importDefault(require("../icons/audio-icon"));
|
|
9
9
|
const code_file_icon_1 = __importDefault(require("../icons/code-file-icon"));
|
|
@@ -38,245 +38,6 @@ var FileType;
|
|
|
38
38
|
FileType[FileType["Figure"] = 10] = "Figure";
|
|
39
39
|
FileType[FileType["GraphicalAbstract"] = 11] = "GraphicalAbstract";
|
|
40
40
|
})(FileType = exports.FileType || (exports.FileType = {}));
|
|
41
|
-
var Designation;
|
|
42
|
-
(function (Designation) {
|
|
43
|
-
Designation[Designation["Figure"] = 0] = "Figure";
|
|
44
|
-
Designation[Designation["Table"] = 1] = "Table";
|
|
45
|
-
Designation[Designation["Supplementary"] = 2] = "Supplementary";
|
|
46
|
-
Designation[Designation["ConflictOfInterest"] = 3] = "ConflictOfInterest";
|
|
47
|
-
Designation[Designation["Document"] = 4] = "Document";
|
|
48
|
-
Designation[Designation["GraphicalAbstract"] = 5] = "GraphicalAbstract";
|
|
49
|
-
Designation[Designation["GraphicalAbstractImage"] = 6] = "GraphicalAbstractImage";
|
|
50
|
-
Designation[Designation["GraphicalAbstractText"] = 7] = "GraphicalAbstractText";
|
|
51
|
-
Designation[Designation["Metadata"] = 8] = "Metadata";
|
|
52
|
-
Designation[Designation["SubmissionFile"] = 9] = "SubmissionFile";
|
|
53
|
-
Designation[Designation["SubmissionPdf"] = 10] = "SubmissionPdf";
|
|
54
|
-
Designation[Designation["TitlePage"] = 11] = "TitlePage";
|
|
55
|
-
Designation[Designation["Dataset"] = 12] = "Dataset";
|
|
56
|
-
Designation[Designation["MainManuscript"] = 13] = "MainManuscript";
|
|
57
|
-
})(Designation = exports.Designation || (exports.Designation = {}));
|
|
58
|
-
exports.designationWithFileSectionsMap = new Map([
|
|
59
|
-
[Designation.Figure, FileSectionType.OtherFile],
|
|
60
|
-
[Designation.Table, FileSectionType.OtherFile],
|
|
61
|
-
[Designation.Supplementary, FileSectionType.Supplements],
|
|
62
|
-
[Designation.ConflictOfInterest, FileSectionType.OtherFile],
|
|
63
|
-
[Designation.Document, FileSectionType.OtherFile],
|
|
64
|
-
[Designation.GraphicalAbstract, FileSectionType.OtherFile],
|
|
65
|
-
[Designation.GraphicalAbstractImage, FileSectionType.OtherFile],
|
|
66
|
-
[Designation.GraphicalAbstractText, FileSectionType.OtherFile],
|
|
67
|
-
[Designation.Metadata, FileSectionType.OtherFile],
|
|
68
|
-
[Designation.SubmissionFile, FileSectionType.OtherFile],
|
|
69
|
-
[Designation.SubmissionPdf, FileSectionType.OtherFile],
|
|
70
|
-
[Designation.TitlePage, FileSectionType.OtherFile],
|
|
71
|
-
[Designation.Dataset, FileSectionType.OtherFile],
|
|
72
|
-
[Designation.MainManuscript, FileSectionType.OtherFile],
|
|
73
|
-
]);
|
|
74
|
-
exports.namesWithDesignationMap = new Map([
|
|
75
|
-
['figure', Designation.Figure],
|
|
76
|
-
['table', Designation.Table],
|
|
77
|
-
['supplementary', Designation.Supplementary],
|
|
78
|
-
['conflict-of-interest', Designation.ConflictOfInterest],
|
|
79
|
-
['document', Designation.Document],
|
|
80
|
-
['graphical-abstract', Designation.GraphicalAbstract],
|
|
81
|
-
['graphical-abstract-image', Designation.GraphicalAbstractImage],
|
|
82
|
-
['graphical-abstract-text', Designation.GraphicalAbstractText],
|
|
83
|
-
['metadata', Designation.Metadata],
|
|
84
|
-
['submission-file', Designation.SubmissionFile],
|
|
85
|
-
['submission-pdf', Designation.SubmissionPdf],
|
|
86
|
-
['title-page', Designation.TitlePage],
|
|
87
|
-
['dataset', Designation.Dataset],
|
|
88
|
-
['main-manuscript', Designation.MainManuscript],
|
|
89
|
-
]);
|
|
90
|
-
exports.designationWithReadableNamesMap = new Map([
|
|
91
|
-
[Designation.Figure, 'Figure'],
|
|
92
|
-
[Designation.Table, 'Table'],
|
|
93
|
-
[Designation.Supplementary, 'Supplementary'],
|
|
94
|
-
[Designation.ConflictOfInterest, 'Conflict Of Interest'],
|
|
95
|
-
[Designation.Document, 'Document'],
|
|
96
|
-
[Designation.GraphicalAbstract, 'Graphical Abstract'],
|
|
97
|
-
[Designation.GraphicalAbstractImage, 'Graphical Abstract Image'],
|
|
98
|
-
[Designation.GraphicalAbstractText, 'Graphical Abstract Text'],
|
|
99
|
-
[Designation.Metadata, 'Metadata'],
|
|
100
|
-
[Designation.SubmissionFile, 'Submission File'],
|
|
101
|
-
[Designation.SubmissionPdf, 'Submission PDF'],
|
|
102
|
-
[Designation.TitlePage, 'Title Page'],
|
|
103
|
-
[Designation.Dataset, 'Dataset'],
|
|
104
|
-
[Designation.MainManuscript, 'Main Manuscript'],
|
|
105
|
-
]);
|
|
106
|
-
exports.designationWithAllowedMediaTypesMap = new Map([
|
|
107
|
-
[Designation.Figure, ['jpeg', 'png', 'tiff', 'pdf', 'svg', 'ai']],
|
|
108
|
-
[
|
|
109
|
-
Designation.Table,
|
|
110
|
-
['xls', 'csv', 'tsv', 'tex', 'html', 'jpeg', 'jpg', 'png', 'gif', 'tiff'],
|
|
111
|
-
],
|
|
112
|
-
[Designation.Supplementary, []],
|
|
113
|
-
[Designation.ConflictOfInterest, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
114
|
-
[Designation.Document, ['doc', 'docx', 'pdf', 'tex']],
|
|
115
|
-
[Designation.GraphicalAbstract, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
116
|
-
[
|
|
117
|
-
Designation.GraphicalAbstractImage,
|
|
118
|
-
['jpeg', 'png', 'tiff', 'gif', 'pdf', 'eps'],
|
|
119
|
-
],
|
|
120
|
-
[Designation.GraphicalAbstractText, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
121
|
-
[Designation.Metadata, ['xml']],
|
|
122
|
-
[Designation.SubmissionFile, []],
|
|
123
|
-
[Designation.SubmissionPdf, ['pdf']],
|
|
124
|
-
[Designation.TitlePage, ['doc', 'docx', 'pdf', 'tex', 'txt']],
|
|
125
|
-
[Designation.Dataset, []],
|
|
126
|
-
[Designation.MainManuscript, ['manuproj', 'docx']],
|
|
127
|
-
]);
|
|
128
|
-
exports.designationWithAllowedDesignationsToTransitionMap = new Map([
|
|
129
|
-
[
|
|
130
|
-
Designation.Figure,
|
|
131
|
-
[
|
|
132
|
-
Designation.SubmissionFile,
|
|
133
|
-
Designation.Supplementary,
|
|
134
|
-
Designation.GraphicalAbstractImage,
|
|
135
|
-
Designation.Dataset,
|
|
136
|
-
],
|
|
137
|
-
],
|
|
138
|
-
[
|
|
139
|
-
Designation.Table,
|
|
140
|
-
[
|
|
141
|
-
Designation.Supplementary,
|
|
142
|
-
Designation.SubmissionFile,
|
|
143
|
-
Designation.Dataset,
|
|
144
|
-
],
|
|
145
|
-
],
|
|
146
|
-
[
|
|
147
|
-
Designation.Supplementary,
|
|
148
|
-
[
|
|
149
|
-
Designation.Supplementary,
|
|
150
|
-
Designation.SubmissionFile,
|
|
151
|
-
Designation.Document,
|
|
152
|
-
Designation.Figure,
|
|
153
|
-
Designation.GraphicalAbstractImage,
|
|
154
|
-
Designation.ConflictOfInterest,
|
|
155
|
-
Designation.SubmissionPdf,
|
|
156
|
-
Designation.Metadata,
|
|
157
|
-
Designation.GraphicalAbstractText,
|
|
158
|
-
Designation.GraphicalAbstract,
|
|
159
|
-
Designation.TitlePage,
|
|
160
|
-
Designation.Table,
|
|
161
|
-
Designation.Dataset,
|
|
162
|
-
],
|
|
163
|
-
],
|
|
164
|
-
[
|
|
165
|
-
Designation.ConflictOfInterest,
|
|
166
|
-
[
|
|
167
|
-
Designation.ConflictOfInterest,
|
|
168
|
-
Designation.Document,
|
|
169
|
-
Designation.GraphicalAbstract,
|
|
170
|
-
Designation.GraphicalAbstractImage,
|
|
171
|
-
Designation.GraphicalAbstractText,
|
|
172
|
-
Designation.Metadata,
|
|
173
|
-
Designation.SubmissionFile,
|
|
174
|
-
Designation.SubmissionPdf,
|
|
175
|
-
Designation.Dataset,
|
|
176
|
-
],
|
|
177
|
-
],
|
|
178
|
-
[
|
|
179
|
-
Designation.Document,
|
|
180
|
-
[
|
|
181
|
-
Designation.ConflictOfInterest,
|
|
182
|
-
Designation.Document,
|
|
183
|
-
Designation.GraphicalAbstract,
|
|
184
|
-
Designation.GraphicalAbstractImage,
|
|
185
|
-
Designation.GraphicalAbstractText,
|
|
186
|
-
Designation.Metadata,
|
|
187
|
-
Designation.SubmissionFile,
|
|
188
|
-
Designation.SubmissionPdf,
|
|
189
|
-
Designation.MainManuscript,
|
|
190
|
-
Designation.Dataset,
|
|
191
|
-
],
|
|
192
|
-
],
|
|
193
|
-
[
|
|
194
|
-
Designation.GraphicalAbstract,
|
|
195
|
-
[
|
|
196
|
-
Designation.Document,
|
|
197
|
-
Designation.SubmissionFile,
|
|
198
|
-
Designation.Supplementary,
|
|
199
|
-
Designation.Dataset,
|
|
200
|
-
],
|
|
201
|
-
],
|
|
202
|
-
[
|
|
203
|
-
Designation.GraphicalAbstractImage,
|
|
204
|
-
[
|
|
205
|
-
Designation.Figure,
|
|
206
|
-
Designation.SubmissionFile,
|
|
207
|
-
Designation.Supplementary,
|
|
208
|
-
Designation.Dataset,
|
|
209
|
-
],
|
|
210
|
-
],
|
|
211
|
-
[
|
|
212
|
-
Designation.GraphicalAbstractText,
|
|
213
|
-
[
|
|
214
|
-
Designation.Document,
|
|
215
|
-
Designation.SubmissionFile,
|
|
216
|
-
Designation.Supplementary,
|
|
217
|
-
Designation.Dataset,
|
|
218
|
-
],
|
|
219
|
-
],
|
|
220
|
-
[Designation.Metadata, [Designation.SubmissionFile, Designation.Dataset]],
|
|
221
|
-
[
|
|
222
|
-
Designation.SubmissionFile,
|
|
223
|
-
[
|
|
224
|
-
Designation.Supplementary,
|
|
225
|
-
Designation.SubmissionFile,
|
|
226
|
-
Designation.Document,
|
|
227
|
-
Designation.Figure,
|
|
228
|
-
Designation.GraphicalAbstractImage,
|
|
229
|
-
Designation.ConflictOfInterest,
|
|
230
|
-
Designation.SubmissionPdf,
|
|
231
|
-
Designation.Metadata,
|
|
232
|
-
Designation.GraphicalAbstractText,
|
|
233
|
-
Designation.GraphicalAbstract,
|
|
234
|
-
Designation.TitlePage,
|
|
235
|
-
Designation.Table,
|
|
236
|
-
Designation.Dataset,
|
|
237
|
-
],
|
|
238
|
-
],
|
|
239
|
-
[
|
|
240
|
-
Designation.SubmissionPdf,
|
|
241
|
-
[
|
|
242
|
-
Designation.ConflictOfInterest,
|
|
243
|
-
Designation.Document,
|
|
244
|
-
Designation.GraphicalAbstract,
|
|
245
|
-
Designation.GraphicalAbstractImage,
|
|
246
|
-
Designation.GraphicalAbstractText,
|
|
247
|
-
Designation.Metadata,
|
|
248
|
-
Designation.SubmissionFile,
|
|
249
|
-
Designation.SubmissionPdf,
|
|
250
|
-
Designation.Dataset,
|
|
251
|
-
],
|
|
252
|
-
],
|
|
253
|
-
[
|
|
254
|
-
Designation.TitlePage,
|
|
255
|
-
[
|
|
256
|
-
Designation.Document,
|
|
257
|
-
Designation.SubmissionFile,
|
|
258
|
-
Designation.Supplementary,
|
|
259
|
-
Designation.Dataset,
|
|
260
|
-
],
|
|
261
|
-
],
|
|
262
|
-
[
|
|
263
|
-
Designation.Dataset,
|
|
264
|
-
[
|
|
265
|
-
Designation.Supplementary,
|
|
266
|
-
Designation.SubmissionFile,
|
|
267
|
-
Designation.Document,
|
|
268
|
-
Designation.Figure,
|
|
269
|
-
Designation.GraphicalAbstractImage,
|
|
270
|
-
Designation.ConflictOfInterest,
|
|
271
|
-
Designation.SubmissionPdf,
|
|
272
|
-
Designation.Metadata,
|
|
273
|
-
Designation.GraphicalAbstractText,
|
|
274
|
-
Designation.GraphicalAbstract,
|
|
275
|
-
Designation.TitlePage,
|
|
276
|
-
Designation.Table,
|
|
277
|
-
],
|
|
278
|
-
],
|
|
279
|
-
]);
|
|
280
41
|
exports.extensionsWithFileTypesMap = new Map([
|
|
281
42
|
['png', FileType.Image],
|
|
282
43
|
['jpg', FileType.Image],
|
|
@@ -385,89 +146,6 @@ const generateAttachmentsTitles = (externalFiles, fileSectionType) => {
|
|
|
385
146
|
return result;
|
|
386
147
|
};
|
|
387
148
|
exports.generateAttachmentsTitles = generateAttachmentsTitles;
|
|
388
|
-
const getDesignationActionsList = (designation, fileExtension) => {
|
|
389
|
-
const allowedDesignationsToTransition = exports.designationWithAllowedDesignationsToTransitionMap.get(designation);
|
|
390
|
-
if (allowedDesignationsToTransition) {
|
|
391
|
-
if (designation === Designation.Supplementary ||
|
|
392
|
-
designation === Designation.SubmissionFile) {
|
|
393
|
-
return allowedDesignationsToTransition;
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
allowedDesignationsToTransition.filter((value) => {
|
|
397
|
-
const allowedMediaTypes = exports.designationWithAllowedMediaTypesMap.get(value);
|
|
398
|
-
if (allowedMediaTypes) {
|
|
399
|
-
return allowedMediaTypes.indexOf(fileExtension) !== -1;
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
return allowedDesignationsToTransition;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
409
|
-
return [];
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
exports.getDesignationActionsList = getDesignationActionsList;
|
|
413
|
-
const getDesignationName = (designation) => {
|
|
414
|
-
let result = undefined;
|
|
415
|
-
exports.namesWithDesignationMap.forEach((value, key, map) => {
|
|
416
|
-
if (value === designation) {
|
|
417
|
-
result = key;
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
if (result == undefined) {
|
|
421
|
-
result = '';
|
|
422
|
-
}
|
|
423
|
-
return result;
|
|
424
|
-
};
|
|
425
|
-
exports.getDesignationName = getDesignationName;
|
|
426
|
-
const getDesignationByFileSection = (fileSectionType) => {
|
|
427
|
-
const result = new Array();
|
|
428
|
-
exports.designationWithFileSectionsMap.forEach((value, key, map) => {
|
|
429
|
-
if (value === fileSectionType) {
|
|
430
|
-
result.push(key);
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
return result;
|
|
434
|
-
};
|
|
435
|
-
exports.getDesignationByFileSection = getDesignationByFileSection;
|
|
436
|
-
const getUploadFileDesignationList = (fileExtension, fileSectionType, can) => {
|
|
437
|
-
const result = new Array();
|
|
438
|
-
const checkDesignation = (value) => {
|
|
439
|
-
if (value === Designation.MainManuscript && !(can === null || can === void 0 ? void 0 : can.setMainManuscript)) {
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
const allowedExtension = exports.designationWithAllowedMediaTypesMap.get(value);
|
|
443
|
-
const isAllowed = allowedExtension === null || allowedExtension === void 0 ? void 0 : allowedExtension.includes(fileExtension);
|
|
444
|
-
if (isAllowed ||
|
|
445
|
-
value === Designation.Supplementary ||
|
|
446
|
-
value === Designation.SubmissionFile ||
|
|
447
|
-
value === Designation.Dataset) {
|
|
448
|
-
const label = exports.designationWithReadableNamesMap.get(value);
|
|
449
|
-
if (label) {
|
|
450
|
-
result.push({
|
|
451
|
-
value: value,
|
|
452
|
-
label: label,
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
if (typeof fileSectionType === 'number') {
|
|
458
|
-
const allowedDesignationByFileSection = (0, exports.getDesignationByFileSection)(fileSectionType);
|
|
459
|
-
allowedDesignationByFileSection.forEach(checkDesignation);
|
|
460
|
-
}
|
|
461
|
-
else if (Array.isArray(fileSectionType)) {
|
|
462
|
-
exports.designationWithFileSectionsMap.forEach((value, key) => {
|
|
463
|
-
if (fileSectionType.includes(key)) {
|
|
464
|
-
checkDesignation(key);
|
|
465
|
-
}
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
return result;
|
|
469
|
-
};
|
|
470
|
-
exports.getUploadFileDesignationList = getUploadFileDesignationList;
|
|
471
149
|
exports.droppableSections = [
|
|
472
150
|
FileSectionType.Supplements,
|
|
473
151
|
FileSectionType.OtherFile,
|
package/dist/cjs/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
32
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
35
|
+
exports.errorsDecoder = exports.useDeepCompareCallback = exports.useDeepCompareMemo = exports.useFiles = void 0;
|
|
36
36
|
__exportStar(require("./components/AffiliationsEditor"), exports);
|
|
37
37
|
__exportStar(require("./components/AffiliationsList"), exports);
|
|
38
38
|
__exportStar(require("./components/AuthorForm"), exports);
|
|
@@ -79,7 +79,5 @@ __exportStar(require("./lib/capabilities"), exports);
|
|
|
79
79
|
var errors_decoder_1 = require("./lib/errors-decoder");
|
|
80
80
|
Object.defineProperty(exports, "errorsDecoder", { enumerable: true, get: function () { return __importDefault(errors_decoder_1).default; } });
|
|
81
81
|
__exportStar(require("./types"), exports);
|
|
82
|
-
var SelectDialogDesignation_1 = require("./components/FileManager/SelectDialogDesignation");
|
|
83
|
-
Object.defineProperty(exports, "SelectDialogDesignation", { enumerable: true, get: function () { return SelectDialogDesignation_1.SelectDialogDesignation; } });
|
|
84
82
|
__exportStar(require("./components/LoadingOverlay"), exports);
|
|
85
83
|
__exportStar(require("./components/EditorHeader/EditorHeader"), exports);
|
|
@@ -38,7 +38,6 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
38
38
|
viewHistory: false,
|
|
39
39
|
restoreVersion: isOwner() || isEditor() || isWriter(),
|
|
40
40
|
downloadFiles: true,
|
|
41
|
-
changeDesignation: (isOwner() || isEditor() || isWriter()) && allowed(A.updateAttachment),
|
|
42
41
|
replaceFile: isOwner() || isEditor() || isWriter(),
|
|
43
42
|
uploadFile: isOwner() || isEditor() || isWriter(),
|
|
44
43
|
handleQualityReport: isOwner() || isEditor() || isWriter(),
|
|
@@ -20,7 +20,7 @@ const MapUserRole = {
|
|
|
20
20
|
Viewer: { label: 'Reading...', icon: ReadingIcon },
|
|
21
21
|
};
|
|
22
22
|
export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
|
|
23
|
-
var _a, _b, _c;
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
24
|
const [confirmationDialog, toggleConfirmationDialog] = useState(false);
|
|
25
25
|
const [loading, setLoading] = useState(false);
|
|
26
26
|
const [noteValue, setNoteValue] = useState('');
|
|
@@ -66,7 +66,7 @@ export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions
|
|
|
66
66
|
React.createElement("span", null, "Dashboard"))),
|
|
67
67
|
handleSnapshot &&
|
|
68
68
|
typeof hasPendingSuggestions == 'boolean' &&
|
|
69
|
-
submission.
|
|
69
|
+
submission.previousStep && (React.createElement(ProceedView, { isAnnotator: isAnnotator, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, loading: loading, showComplete: showComplete, noteValue: noteValue, currentStepTransition: currentStepTransition, error: error, currentStepType: submission.currentStep.type, previousStepType: (_d = submission.previousStep) === null || _d === void 0 ? void 0 : _d.type, confirmationDialog: confirmationDialog, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
|
|
70
70
|
status && (React.createElement(ChildWrapper, null,
|
|
71
71
|
React.createElement(SaveStatus, { status: status }))),
|
|
72
72
|
React.createElement(Spacer, null),
|
|
@@ -17,7 +17,7 @@ const StepDetails = ({ icon, label, description, role }) => (React.createElement
|
|
|
17
17
|
React.createElement(SecondarySmallText, null,
|
|
18
18
|
"Actor: ",
|
|
19
19
|
role.label))));
|
|
20
|
-
export const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loading, showComplete, confirmationDialog,
|
|
20
|
+
export const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loading, showComplete, confirmationDialog, currentStepType, previousStepType, isAnnotator, hasPendingSuggestions, error, noteValue, onNoteChange, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
21
21
|
const dialogMessages = useMemo(() => hasPendingSuggestions && !isAnnotator
|
|
22
22
|
? {
|
|
23
23
|
header: 'The task can not be transitioned to the next step',
|
|
@@ -33,7 +33,7 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
33
33
|
: showComplete
|
|
34
34
|
? {
|
|
35
35
|
header: 'Content reassigned successfully',
|
|
36
|
-
message: `to the ${
|
|
36
|
+
message: `to the ${currentStepType.label}`,
|
|
37
37
|
actions: {
|
|
38
38
|
primary: {
|
|
39
39
|
action: onCancelClick,
|
|
@@ -58,7 +58,7 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
58
58
|
showComplete,
|
|
59
59
|
continueDialogAction,
|
|
60
60
|
onCancelClick,
|
|
61
|
-
|
|
61
|
+
currentStepType,
|
|
62
62
|
hasPendingSuggestions,
|
|
63
63
|
isAnnotator,
|
|
64
64
|
]);
|
|
@@ -71,10 +71,10 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
71
71
|
(loading && (React.createElement(LoadingOverlay, null,
|
|
72
72
|
React.createElement(Message, { isCentered: true }, "Proceeding with your submission\u2026")))) || (React.createElement(Dialog, { isOpen: confirmationDialog && !loading, category: Category.confirmation, header: dialogMessages.header, message: dialogMessages.message, actions: dialogMessages.actions },
|
|
73
73
|
(showComplete && (React.createElement(Grid, null,
|
|
74
|
-
React.createElement(StepDetails, Object.assign({},
|
|
74
|
+
React.createElement(StepDetails, Object.assign({}, previousStepType, { icon: React.createElement(React.Fragment, null,
|
|
75
75
|
React.createElement(TaskStepDoneIcon, null),
|
|
76
76
|
React.createElement(Line, null)) })),
|
|
77
|
-
React.createElement(StepDetails, Object.assign({},
|
|
77
|
+
React.createElement(StepDetails, Object.assign({}, currentStepType))))) ||
|
|
78
78
|
((!hasPendingSuggestions || isAnnotator) && onNoteChange && (React.createElement(TextAreaWrapper, null,
|
|
79
79
|
React.createElement(MediumTextArea, { value: noteValue, onChange: onNoteChange, rows: 5, placeholder: 'Add any additional comment here...' })))),
|
|
80
80
|
error && (React.createElement(AlertMessage, { type: AlertMessageType.error, hideCloseButton: true }, error))))));
|
|
@@ -21,34 +21,31 @@ import { actions, getInitialState, reducer } from './FileSectionState';
|
|
|
21
21
|
import { FilesSection } from './FilesSection';
|
|
22
22
|
import { InlineFilesSection } from './InlineFilesSection';
|
|
23
23
|
import { TooltipDiv } from './TooltipDiv';
|
|
24
|
-
import {
|
|
24
|
+
import { generateAttachmentsTitles } from './util';
|
|
25
25
|
export const PermissionsContext = createContext(null);
|
|
26
|
-
export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments,
|
|
26
|
+
export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments, replace, upload }, addAttachmentToState, }) => {
|
|
27
27
|
const [state, dispatch] = useReducer(reducer, getInitialState());
|
|
28
|
-
const handleReplaceFile = useCallback((attachmentId, name, file
|
|
28
|
+
const handleReplaceFile = useCallback((attachmentId, name, file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
29
|
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
30
|
-
|
|
31
|
-
const res = yield replace(attachmentId, name, file, typeId);
|
|
30
|
+
const res = yield replace(attachmentId, name, file);
|
|
32
31
|
dispatch(actions.HANDLE_FINISH_UPLOAD());
|
|
33
32
|
if (res) {
|
|
34
33
|
dispatch(actions.HANDLE_SUCCESS_MESSAGE('File uploaded successfully.'));
|
|
35
34
|
}
|
|
36
35
|
return res;
|
|
37
36
|
}), [replace]);
|
|
38
|
-
const handleUploadFile = useCallback((file
|
|
37
|
+
const handleUploadFile = useCallback((file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
38
|
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
40
|
-
|
|
41
|
-
dispatch(actions.SELECT_DESIGNATION(Designation.Supplementary));
|
|
42
|
-
}
|
|
43
|
-
const res = yield upload(file, designation);
|
|
39
|
+
const res = yield upload(file);
|
|
44
40
|
dispatch(actions.HANDLE_FINISH_UPLOAD());
|
|
45
41
|
if (res) {
|
|
46
42
|
dispatch(actions.HANDLE_SUCCESS_MESSAGE('File uploaded successfully.', FileSectionType.OtherFile));
|
|
47
43
|
}
|
|
48
44
|
return res;
|
|
49
45
|
}), [upload]);
|
|
50
|
-
const handleUploadFileWithSupplement = useCallback((file
|
|
51
|
-
|
|
46
|
+
const handleUploadFileWithSupplement = useCallback((file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
48
|
+
const response = yield upload(file);
|
|
52
49
|
if (typeof response === 'object') {
|
|
53
50
|
const { id, name } = response;
|
|
54
51
|
yield saveModel(buildSupplementaryMaterial(name, `attachment:${id}`));
|
|
@@ -63,13 +60,6 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
|
|
|
63
60
|
const model = getModelsByType(modelMap, ObjectTypes.Supplement).find(({ href }) => (href === null || href === void 0 ? void 0 : href.replace('attachment:', '')) === oldAttachmentId);
|
|
64
61
|
yield saveModel(Object.assign(Object.assign({}, model), { title: attachment.name, href: `attachment:${attachment.id}` }));
|
|
65
62
|
}), [modelMap, saveModel]);
|
|
66
|
-
const handleChangeDesignationFile = useCallback((attachmentId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
-
const res = yield changeDesignation(attachmentId, typeId, name);
|
|
68
|
-
if (res) {
|
|
69
|
-
dispatch(actions.HANDLE_SUCCESS_MESSAGE(''));
|
|
70
|
-
}
|
|
71
|
-
return res;
|
|
72
|
-
}), [changeDesignation]);
|
|
73
63
|
const handleDownload = useCallback((url) => {
|
|
74
64
|
window.location.assign(url);
|
|
75
65
|
}, []);
|
|
@@ -102,12 +92,10 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
|
|
|
102
92
|
externalFile: element.externalFile,
|
|
103
93
|
title: element.title,
|
|
104
94
|
showAttachmentName: isSupplementOrOtherFilesTab,
|
|
105
|
-
showDesignationActions: isSupplementOrOtherFilesTab,
|
|
106
95
|
showReplaceAction: !isOtherFilesTab,
|
|
107
96
|
handleDownload,
|
|
108
97
|
handleReplace: handleReplaceFile,
|
|
109
98
|
handleSupplementReplace,
|
|
110
|
-
handleChangeDesignation: handleChangeDesignationFile,
|
|
111
99
|
dispatch: dispatch,
|
|
112
100
|
};
|
|
113
101
|
if (enableDragAndDrop && isSupplementOrOtherFilesTab) {
|
|
@@ -26,7 +26,7 @@ export const DragLayer = () => {
|
|
|
26
26
|
const renderItem = useCallback(() => {
|
|
27
27
|
switch (itemType) {
|
|
28
28
|
case 'FileSectionItem':
|
|
29
|
-
return (React.createElement(CustomFileSectionItem, { title: item.title, externalFile: item.externalFile, showAttachmentName: item.showAttachmentName, withDot: item.withDot, showSecondaryActions: false,
|
|
29
|
+
return (React.createElement(CustomFileSectionItem, { title: item.title, externalFile: item.externalFile, showAttachmentName: item.showAttachmentName, withDot: item.withDot, showSecondaryActions: false, style: { width: item.width } }));
|
|
30
30
|
default:
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { PermissionsContext } from '../FileManager';
|
|
4
|
-
|
|
5
|
-
export const FileInfo = ({ showAttachmentName, showDesignationActions, title, fileAttachmentName, fileExtension, designation, attachmentId, handleChangeDesignation, dispatch, }) => {
|
|
4
|
+
export const FileInfo = ({ showAttachmentName, title, fileAttachmentName, fileExtension, attachmentId, dispatch, }) => {
|
|
6
5
|
const fileName = fileAttachmentName.substring(0, fileAttachmentName.lastIndexOf('.'));
|
|
7
6
|
const can = useContext(PermissionsContext);
|
|
8
7
|
return (React.createElement(FileInfoContainer, null,
|
|
9
|
-
showDesignationActions && designation !== undefined && (React.createElement(DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName: fileAttachmentName, dispatch: dispatch, can: can })),
|
|
10
8
|
React.createElement(FileNameTitleContainer, null,
|
|
11
9
|
React.createElement(FileTitle, null,
|
|
12
10
|
!showAttachmentName ? fileName : title,
|
|
@@ -4,15 +4,13 @@ import { useDropdown } from '../../../hooks/use-dropdown';
|
|
|
4
4
|
import { DropdownContainer } from '../../Dropdown';
|
|
5
5
|
import { CloseOIcon } from '../../icons/';
|
|
6
6
|
import DotsIcon from '../../icons/dots-icon';
|
|
7
|
-
import { Designation, namesWithDesignationMap } from '../util';
|
|
8
7
|
import { FileInfo } from './FileInfo';
|
|
9
8
|
import { FileTypeIcon } from './FileTypeIcon';
|
|
10
9
|
import { ItemActions } from './ItemActions';
|
|
11
|
-
export const FileSectionItem = ({ fileSection, externalFile, title, showAttachmentName = false,
|
|
10
|
+
export const FileSectionItem = ({ fileSection, externalFile, title, showAttachmentName = false, showReplaceAction = true, handleDownload, handleReplace, handleSupplementReplace, dispatch, dragRef, className, style, onClose, isEditor, }) => {
|
|
12
11
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
|
13
12
|
const fileExtension = externalFile.name.substring(externalFile.name.lastIndexOf('.') + 1);
|
|
14
|
-
const
|
|
15
|
-
const isMainManuscript = designation === Designation.MainManuscript;
|
|
13
|
+
const isMainManuscript = externalFile.type.label === 'main-manuscript';
|
|
16
14
|
const isSelected = externalFile.id == window.location.hash.substr(1);
|
|
17
15
|
return (React.createElement(Item, { ref: dragRef, className: className, style: style },
|
|
18
16
|
React.createElement(ItemContainer, { onClick: () => {
|
|
@@ -23,7 +21,7 @@ export const FileSectionItem = ({ fileSection, externalFile, title, showAttachme
|
|
|
23
21
|
}
|
|
24
22
|
} },
|
|
25
23
|
React.createElement(FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
|
|
26
|
-
React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName,
|
|
24
|
+
React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, fileAttachmentName: externalFile.name, title: title, attachmentId: externalFile.id, dispatch: dispatch })),
|
|
27
25
|
onClose && (React.createElement(IconCloseButton, { onClick: (e) => {
|
|
28
26
|
e.preventDefault();
|
|
29
27
|
onClose();
|
|
@@ -32,7 +30,7 @@ export const FileSectionItem = ({ fileSection, externalFile, title, showAttachme
|
|
|
32
30
|
handleDownload && handleReplace && (React.createElement(DropdownContainer, { ref: wrapperRef },
|
|
33
31
|
React.createElement(ActionsIcon, { onClick: toggleOpen, type: "button", "aria-label": "Download or Replace", "aria-pressed": isOpen },
|
|
34
32
|
React.createElement(DotsIcon, null)),
|
|
35
|
-
isOpen && (React.createElement(ItemActions, { fileSection: fileSection, replaceAttachmentHandler: handleReplace, showReplaceAction: showReplaceAction, downloadAttachmentHandler: handleDownload, handleSupplementReplace: handleSupplementReplace, attachmentId: externalFile.id, fileName: externalFile.name,
|
|
33
|
+
isOpen && (React.createElement(ItemActions, { fileSection: fileSection, replaceAttachmentHandler: handleReplace, showReplaceAction: showReplaceAction, downloadAttachmentHandler: handleDownload, handleSupplementReplace: handleSupplementReplace, attachmentId: externalFile.id, fileName: externalFile.name, publicUrl: externalFile.link, hideActionList: toggleOpen, dispatch: dispatch }))))));
|
|
36
34
|
};
|
|
37
35
|
const IconCloseButton = styled.button `
|
|
38
36
|
border: none;
|
|
@@ -12,22 +12,10 @@ import { DropdownList } from '../../Dropdown';
|
|
|
12
12
|
import { PermissionsContext } from '../FileManager';
|
|
13
13
|
import { actions } from '../FileSectionState';
|
|
14
14
|
import { ActionsItem } from '../ItemsAction';
|
|
15
|
-
import {
|
|
16
|
-
export const ItemActions = ({ fileSection, downloadAttachmentHandler, replaceAttachmentHandler, handleSupplementReplace, detachAttachmnetHandler, handleUpdateInline, attachmentId, fileName,
|
|
17
|
-
const attachmentDesignation = designation == undefined ? 'undefined' : designation;
|
|
18
|
-
const attachmentDesignationName = attachmentDesignation !== 'undefined'
|
|
19
|
-
? namesWithDesignationMap.get(attachmentDesignation)
|
|
20
|
-
: undefined;
|
|
15
|
+
import { FileSectionType } from '../util';
|
|
16
|
+
export const ItemActions = ({ fileSection, downloadAttachmentHandler, replaceAttachmentHandler, handleSupplementReplace, detachAttachmnetHandler, handleUpdateInline, attachmentId, fileName, publicUrl, hideActionList, dispatch, dropDownClassName, showReplaceAction, }) => {
|
|
21
17
|
const can = useContext(PermissionsContext);
|
|
22
|
-
const canBeReplaced =
|
|
23
|
-
(attachmentDesignationName == undefined ||
|
|
24
|
-
![
|
|
25
|
-
Designation.MainManuscript,
|
|
26
|
-
Designation.SubmissionFile,
|
|
27
|
-
Designation.SubmissionPdf,
|
|
28
|
-
].includes(attachmentDesignationName))) ||
|
|
29
|
-
(attachmentDesignationName == Designation.MainManuscript &&
|
|
30
|
-
(can === null || can === void 0 ? void 0 : can.setMainManuscript));
|
|
18
|
+
const canBeReplaced = showReplaceAction == undefined || showReplaceAction;
|
|
31
19
|
const fileInputRef = useRef(null);
|
|
32
20
|
const [selectedFile, setSelectedFile] = useState();
|
|
33
21
|
const handleChange = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -36,9 +24,8 @@ export const ItemActions = ({ fileSection, downloadAttachmentHandler, replaceAtt
|
|
|
36
24
|
setSelectedFile(file);
|
|
37
25
|
if (dispatch) {
|
|
38
26
|
dispatch(actions.HANDLE_UPLOAD_ACTION());
|
|
39
|
-
dispatch(actions.SELECT_DESIGNATION(attachmentDesignationName || Designation.Document));
|
|
40
27
|
}
|
|
41
|
-
const result = yield replaceAttachmentHandler(attachmentId, fileName, file
|
|
28
|
+
const result = yield replaceAttachmentHandler(attachmentId, fileName, file);
|
|
42
29
|
if (fileSection === FileSectionType.Supplements &&
|
|
43
30
|
typeof result === 'object' &&
|
|
44
31
|
handleSupplementReplace) {
|