@manuscripts/style-guide 1.0.6 → 1.0.7-LEAN-2237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/cjs/components/FileManager/FileManager.js +7 -20
  2. package/dist/cjs/components/FileManager/FileSectionItem/DragLayer.js +1 -1
  3. package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +1 -3
  4. package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +4 -6
  5. package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +3 -17
  6. package/dist/cjs/components/FileManager/FileSectionState.js +4 -14
  7. package/dist/cjs/components/FileManager/FilesSection.js +6 -20
  8. package/dist/cjs/components/FileManager/InlineFilesSection.js +1 -1
  9. package/dist/cjs/components/FileManager/util.js +1 -323
  10. package/dist/cjs/index.js +1 -5
  11. package/dist/cjs/lib/capabilities.js +0 -1
  12. package/dist/es/components/FileManager/FileManager.js +8 -21
  13. package/dist/es/components/FileManager/FileSectionItem/DragLayer.js +1 -1
  14. package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +1 -3
  15. package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +4 -6
  16. package/dist/es/components/FileManager/FileSectionItem/ItemActions.js +3 -17
  17. package/dist/es/components/FileManager/FileSectionState.js +4 -14
  18. package/dist/es/components/FileManager/FilesSection.js +8 -22
  19. package/dist/es/components/FileManager/InlineFilesSection.js +1 -1
  20. package/dist/es/components/FileManager/util.js +0 -318
  21. package/dist/es/index.js +0 -2
  22. package/dist/es/lib/capabilities.js +0 -1
  23. package/dist/types/components/FileManager/FileManager.d.ts +2 -4
  24. package/dist/types/components/FileManager/FileSectionItem/FileInfo.d.ts +0 -5
  25. package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +1 -3
  26. package/dist/types/components/FileManager/FileSectionItem/ItemActions.d.ts +0 -2
  27. package/dist/types/components/FileManager/FileSectionState.d.ts +1 -5
  28. package/dist/types/components/FileManager/util.d.ts +0 -31
  29. package/dist/types/components/icons/add-author.d.ts +0 -1
  30. package/dist/types/components/icons/add-comment-icon.d.ts +0 -1
  31. package/dist/types/components/icons/add-icon-active.d.ts +0 -1
  32. package/dist/types/components/icons/add-icon-inverted.d.ts +0 -1
  33. package/dist/types/components/icons/back-arrow.d.ts +0 -1
  34. package/dist/types/components/icons/bookmark.d.ts +0 -1
  35. package/dist/types/components/icons/google.d.ts +0 -1
  36. package/dist/types/components/icons/orcid.d.ts +0 -1
  37. package/dist/types/components/icons/plus-icon.d.ts +0 -1
  38. package/dist/types/components/icons/project-notification.d.ts +0 -1
  39. package/dist/types/components/icons/project.d.ts +0 -1
  40. package/dist/types/components/icons/projects-list.d.ts +0 -1
  41. package/dist/types/components/icons/search.d.ts +0 -1
  42. package/dist/types/components/icons/tick-mark.d.ts +0 -1
  43. package/dist/types/components/icons/user.d.ts +0 -1
  44. package/dist/types/index.d.ts +0 -2
  45. package/dist/types/lib/capabilities.d.ts +0 -1
  46. package/package.json +35 -37
  47. package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +0 -131
  48. package/dist/cjs/components/FileManager/FileSectionItem/DesignationActionsList.js +0 -54
  49. package/dist/cjs/components/FileManager/SelectDesignationActions.js +0 -74
  50. package/dist/cjs/components/FileManager/SelectDialogDesignation.js +0 -33
  51. package/dist/cjs/components/PdfPreview.js +0 -111
  52. package/dist/es/components/FileManager/FileSectionItem/DesignationActions.js +0 -101
  53. package/dist/es/components/FileManager/FileSectionItem/DesignationActionsList.js +0 -47
  54. package/dist/es/components/FileManager/SelectDesignationActions.js +0 -44
  55. package/dist/es/components/FileManager/SelectDialogDesignation.js +0 -26
  56. package/dist/es/components/PdfPreview.js +0 -83
  57. package/dist/types/components/FileManager/FileSectionItem/DesignationActions.d.ts +0 -14
  58. package/dist/types/components/FileManager/FileSectionItem/DesignationActionsList.d.ts +0 -13
  59. package/dist/types/components/FileManager/SelectDesignationActions.d.ts +0 -12
  60. package/dist/types/components/FileManager/SelectDialogDesignation.d.ts +0 -11
  61. package/dist/types/components/PdfPreview.d.ts +0 -7
@@ -39,7 +39,6 @@ const getLWCapabilities = (project, profile, lwRole, actions) => {
39
39
  viewHistory: false,
40
40
  restoreVersion: isOwner() || isEditor() || isWriter(),
41
41
  downloadFiles: true,
42
- changeDesignation: (isOwner() || isEditor() || isWriter()) && allowed(A.updateAttachment),
43
42
  replaceFile: isOwner() || isEditor() || isWriter(),
44
43
  uploadFile: isOwner() || isEditor() || isWriter(),
45
44
  handleQualityReport: isOwner() || isEditor() || isWriter(),
@@ -20,34 +20,30 @@ import { actions, getInitialState, reducer } from './FileSectionState';
20
20
  import { FilesSection } from './FilesSection';
21
21
  import { InlineFilesSection } from './InlineFilesSection';
22
22
  import { TooltipDiv } from './TooltipDiv';
23
- import { Designation, generateAttachmentsTitles, namesWithDesignationMap, } from './util';
23
+ import { generateAttachmentsTitles } from './util';
24
24
  export const PermissionsContext = createContext(null);
25
- export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments, changeDesignation, replace, upload }, addAttachmentToState, }) => {
25
+ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManagement: { getAttachments, replace, upload }, addAttachmentToState, }) => {
26
26
  const [state, dispatch] = useReducer(reducer, getInitialState());
27
- const handleReplaceFile = useCallback((attachmentId, name, file, typeId) => __awaiter(void 0, void 0, void 0, function* () {
27
+ const handleReplaceFile = useCallback((attachmentId, name, file) => __awaiter(void 0, void 0, void 0, function* () {
28
28
  dispatch(actions.HANDLE_UPLOAD_ACTION());
29
- dispatch(actions.SELECT_DESIGNATION(namesWithDesignationMap.get(typeId) || Designation.Document));
30
- const res = yield replace(attachmentId, name, file, typeId);
29
+ const res = yield replace(attachmentId, name, file);
31
30
  dispatch(actions.HANDLE_FINISH_UPLOAD());
32
31
  if (res) {
33
32
  dispatch(actions.HANDLE_SUCCESS_MESSAGE('File uploaded successfully.'));
34
33
  }
35
34
  return res;
36
35
  }), [replace]);
37
- const handleUploadFile = useCallback((file, designation) => __awaiter(void 0, void 0, void 0, function* () {
36
+ const handleUploadFile = useCallback((file) => __awaiter(void 0, void 0, void 0, function* () {
38
37
  dispatch(actions.HANDLE_UPLOAD_ACTION());
39
- if (namesWithDesignationMap.get(designation) == Designation.Supplementary) {
40
- dispatch(actions.SELECT_DESIGNATION(Designation.Supplementary));
41
- }
42
- const res = yield upload(file, designation);
38
+ const res = yield upload(file);
43
39
  dispatch(actions.HANDLE_FINISH_UPLOAD());
44
40
  if (res) {
45
41
  dispatch(actions.HANDLE_SUCCESS_MESSAGE('File uploaded successfully.', FileSectionType.OtherFile));
46
42
  }
47
43
  return res;
48
44
  }), [upload]);
49
- const handleUploadFileWithSupplement = useCallback((file, designation) => __awaiter(void 0, void 0, void 0, function* () {
50
- const response = yield upload(file, designation);
45
+ const handleUploadFileWithSupplement = useCallback((file) => __awaiter(void 0, void 0, void 0, function* () {
46
+ const response = yield upload(file);
51
47
  if (typeof response === 'object') {
52
48
  const { id, name } = response;
53
49
  yield saveModel(buildSupplementaryMaterial(name, `attachment:${id}`));
@@ -58,13 +54,6 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
58
54
  }
59
55
  return response;
60
56
  }), [upload, saveModel]);
61
- const handleChangeDesignationFile = useCallback((attachmentId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
62
- const res = yield changeDesignation(attachmentId, typeId, name);
63
- if (res) {
64
- dispatch(actions.HANDLE_SUCCESS_MESSAGE(''));
65
- }
66
- return res;
67
- }), [changeDesignation]);
68
57
  const handleDownload = useCallback((url) => {
69
58
  window.location.assign(url);
70
59
  }, []);
@@ -96,11 +85,9 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
96
85
  externalFile: element.externalFile,
97
86
  title: element.title,
98
87
  showAttachmentName: isSupplementOrOtherFilesTab,
99
- showDesignationActions: isSupplementOrOtherFilesTab,
100
88
  showReplaceAction: !isOtherFilesTab,
101
89
  handleDownload,
102
90
  handleReplace: handleReplaceFile,
103
- handleChangeDesignation: handleChangeDesignationFile,
104
91
  dispatch: dispatch,
105
92
  };
106
93
  if (enableDragAndDrop && isSupplementOrOtherFilesTab) {
@@ -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, showDesignationActions: false, style: { width: item.width } }));
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
- import { DesignationActions } from './DesignationActions';
5
- export const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissionAttachmentName, fileExtension, designation, attachmentId, handleChangeDesignation, dispatch, }) => {
4
+ export const FileInfo = ({ showAttachmentName, title, submissionAttachmentName, fileExtension, attachmentId, dispatch, }) => {
6
5
  const fileName = submissionAttachmentName.substring(0, submissionAttachmentName.lastIndexOf('.'));
7
6
  const can = useContext(PermissionsContext);
8
7
  return (React.createElement(FileInfoContainer, null,
9
- showDesignationActions && designation !== undefined && (React.createElement(DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName: submissionAttachmentName, dispatch: dispatch, can: can })),
10
8
  React.createElement(FileNameTitleContainer, null,
11
9
  React.createElement(FileTitle, null,
12
10
  !showAttachmentName ? fileName : title,
@@ -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 = ({ externalFile, title, showAttachmentName = false, showDesignationActions = false, showReplaceAction = true, handleDownload, handleReplace, handleChangeDesignation, dispatch, dragRef, className, style, onClose, isEditor, }) => {
10
+ export const FileSectionItem = ({ externalFile, title, showAttachmentName = false, showReplaceAction = true, handleDownload, handleReplace, 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 designation = namesWithDesignationMap.get(externalFile.type.label);
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 = ({ externalFile, title, showAttachmentName = fals
23
21
  }
24
22
  } },
25
23
  React.createElement(FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
26
- React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions, submissionAttachmentName: externalFile.name, title: title, designation: designation, attachmentId: externalFile.id, handleChangeDesignation: handleChangeDesignation, dispatch: dispatch })),
24
+ React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, submissionAttachmentName: 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 = ({ externalFile, title, showAttachmentName = fals
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, { replaceAttachmentHandler: handleReplace, showReplaceAction: showReplaceAction, downloadAttachmentHandler: handleDownload, attachmentId: externalFile.id, fileName: externalFile.name, designation: externalFile.type.label, publicUrl: externalFile.link, hideActionList: toggleOpen, dispatch: dispatch }))))));
33
+ isOpen && (React.createElement(ItemActions, { replaceAttachmentHandler: handleReplace, showReplaceAction: showReplaceAction, downloadAttachmentHandler: handleDownload, 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,9 @@ import { DropdownList } from '../../Dropdown';
12
12
  import { PermissionsContext } from '../FileManager';
13
13
  import { actions } from '../FileSectionState';
14
14
  import { ActionsItem } from '../ItemsAction';
15
- import { Designation, namesWithDesignationMap } from '../util';
16
- export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, detachAttachmnetHandler, handleUpdateInline, attachmentId, fileName, designation, publicUrl, hideActionList, dispatch, dropDownClassName, showReplaceAction, }) => {
17
- const attachmentDesignation = designation == undefined ? 'undefined' : designation;
18
- const attachmentDesignationName = attachmentDesignation !== 'undefined'
19
- ? namesWithDesignationMap.get(attachmentDesignation)
20
- : undefined;
15
+ export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, detachAttachmnetHandler, handleUpdateInline, attachmentId, fileName, publicUrl, hideActionList, dispatch, dropDownClassName, showReplaceAction, }) => {
21
16
  const can = useContext(PermissionsContext);
22
- const canBeReplaced = ((showReplaceAction == undefined || showReplaceAction) &&
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));
17
+ const canBeReplaced = showReplaceAction == undefined || showReplaceAction;
31
18
  const fileInputRef = useRef(null);
32
19
  const [selectedFile, setSelectedFile] = useState();
33
20
  const handleChange = (event) => __awaiter(void 0, void 0, void 0, function* () {
@@ -36,9 +23,8 @@ export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandle
36
23
  setSelectedFile(file);
37
24
  if (dispatch) {
38
25
  dispatch(actions.HANDLE_UPLOAD_ACTION());
39
- dispatch(actions.SELECT_DESIGNATION(attachmentDesignationName || Designation.Document));
40
26
  }
41
- const result = yield replaceAttachmentHandler(attachmentId, fileName, file, attachmentDesignation);
27
+ const result = yield replaceAttachmentHandler(attachmentId, fileName, file);
42
28
  if (typeof result === 'object' && handleUpdateInline) {
43
29
  handleUpdateInline(result);
44
30
  }
@@ -5,14 +5,11 @@ export const getInitialState = () => ({
5
5
  fileUploadedSuccessfullySection: undefined,
6
6
  successMessage: '',
7
7
  isShowSuccessMessage: false,
8
- selectDesignation: undefined,
9
- showDesignationPopup: undefined,
10
8
  });
11
9
  var ActionTypes;
12
10
  (function (ActionTypes) {
13
11
  ActionTypes["UPLOAD_FILE"] = "UploadFile";
14
12
  ActionTypes["MOVE_FILE"] = "moveFile";
15
- ActionTypes["SELECT_DESIGNATION"] = "selectDesignation";
16
13
  ActionTypes["HANDLE_CANCEL_UPLOAD"] = "handleCancel";
17
14
  ActionTypes["HANDLE_UPLOAD_ACTION"] = "handleUpload";
18
15
  ActionTypes["HANDLE_FINISH_UPLOAD"] = "handleFinishUpload";
@@ -22,7 +19,7 @@ var ActionTypes;
22
19
  export const reducer = (state, action) => {
23
20
  switch (action.type) {
24
21
  case ActionTypes.UPLOAD_FILE: {
25
- return Object.assign(Object.assign({}, state), { showDesignationPopup: action.sectionType, uploadedFile: action.uploadFile, selectDesignation: undefined });
22
+ return Object.assign(Object.assign({}, state), { uploadedFile: action.uploadFile });
26
23
  }
27
24
  case ActionTypes.MOVE_FILE: {
28
25
  return Object.assign(Object.assign({}, state), { moveToOtherState: {
@@ -30,17 +27,14 @@ export const reducer = (state, action) => {
30
27
  name: action.name,
31
28
  }, successMessage: action.successMoveMessage, isShowSuccessMessage: false });
32
29
  }
33
- case ActionTypes.SELECT_DESIGNATION: {
34
- return Object.assign(Object.assign({}, state), { selectDesignation: action.designation });
35
- }
36
30
  case ActionTypes.HANDLE_UPLOAD_ACTION: {
37
- return Object.assign(Object.assign({}, state), { showDesignationPopup: undefined, isUploadFile: true, isShowSuccessMessage: false, successMessage: '' });
31
+ return Object.assign(Object.assign({}, state), { isUploadFile: true, isShowSuccessMessage: false, successMessage: '' });
38
32
  }
39
33
  case ActionTypes.HANDLE_CANCEL_UPLOAD: {
40
- return Object.assign(Object.assign({}, state), { showDesignationPopup: undefined });
34
+ return Object.assign({}, state);
41
35
  }
42
36
  case ActionTypes.HANDLE_FINISH_UPLOAD: {
43
- return Object.assign(Object.assign({}, state), { isUploadFile: false, uploadedFile: undefined, selectDesignation: undefined });
37
+ return Object.assign(Object.assign({}, state), { isUploadFile: false, uploadedFile: undefined });
44
38
  }
45
39
  case ActionTypes.HANDLE_SUCCESS_MESSAGE: {
46
40
  return Object.assign(Object.assign({}, state), { isShowSuccessMessage: true, successMessage: action.successMessage, fileUploadedSuccessfullySection: action.sectionType });
@@ -63,10 +57,6 @@ export const actions = {
63
57
  HANDLE_CANCEL_UPLOAD: () => ({
64
58
  type: ActionTypes.HANDLE_CANCEL_UPLOAD,
65
59
  }),
66
- SELECT_DESIGNATION: (designation) => ({
67
- type: ActionTypes.SELECT_DESIGNATION,
68
- designation,
69
- }),
70
60
  MOVE_FILE: (attachmentId, typeId, name, successMoveMessage) => ({
71
61
  type: ActionTypes.MOVE_FILE,
72
62
  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, getDesignationName } from './util';
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,11 @@ 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
+ dispatch(actions.HANDLE_UPLOAD_ACTION());
18
+ state.uploadedFile && handleUpload(state.uploadedFile);
19
+ }, [state.uploadedFile, dispatch, handleUpload]);
24
20
  const handleSuccessMessage = () => {
25
21
  return (React.createElement(AlertMessage, { type: AlertMessageType.success, hideCloseButton: true, dismissButton: {
26
22
  text: 'OK',
@@ -30,18 +26,8 @@ export const FilesSection = ({ enableDragAndDrop, handleUpload, fileSection, fil
30
26
  return (React.createElement("div", null,
31
27
  (can === null || can === void 0 ? void 0 : can.uploadFile) && (React.createElement(React.Fragment, null,
32
28
  (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 })))),
29
+ state.isUploadFile && state.uploadedFile && (React.createElement(FileSectionUploadItem, { fileName: state.uploadedFile.name, isLoading: state.isUploadFile })))),
36
30
  state.fileUploadedSuccessfullySection === fileSection &&
37
31
  handleSuccessMessage(),
38
- React.createElement(SelectDialogDesignation, { isOpen: state.showDesignationPopup === fileSection, fileExtension: uploadedFileExtension, handleCancel: () => {
39
- dispatch(actions.HANDLE_CANCEL_UPLOAD());
40
- }, uploadFileHandler: handleUploadOtherFile, dispatch: dispatch, fileSection: fileSection }),
41
- 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' }))));
32
+ filesItem));
47
33
  };
@@ -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, designation: attachment.type.label, publicUrl: attachment.link, hideActionList: toggleOpen, dispatch: dispatch, dropDownClassName: 'ref_item_dropdown' }))))));
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
@@ -46,7 +46,6 @@ export * from './components/Inspector';
46
46
  export * from './components/InspectorSection';
47
47
  export * from './components/Badge';
48
48
  export * from './components/NavDropdown';
49
- export { default as PdfPreview } from './components/PdfPreview';
50
49
  export * from './components/SubmissionInspector';
51
50
  export * from './components/Dropdown';
52
51
  export * from './hooks/use-dropdown';
@@ -56,6 +55,5 @@ export * from './lib/authors';
56
55
  export * from './lib/capabilities';
57
56
  export { default as errorsDecoder } from './lib/lw-errors-decoder';
58
57
  export * from './types';
59
- export { SelectDialogDesignation } from './components/FileManager/SelectDialogDesignation';
60
58
  export * from './components/LoadingOverlay';
61
59
  export * from './components/EditorHeader/EditorHeader';
@@ -33,7 +33,6 @@ export const getLWCapabilities = (project, profile, lwRole, actions) => {
33
33
  viewHistory: false,
34
34
  restoreVersion: isOwner() || isEditor() || isWriter(),
35
35
  downloadFiles: true,
36
- changeDesignation: (isOwner() || isEditor() || isWriter()) && allowed(A.updateAttachment),
37
36
  replaceFile: isOwner() || isEditor() || isWriter(),
38
37
  uploadFile: isOwner() || isEditor() || isWriter(),
39
38
  handleQualityReport: isOwner() || isEditor() || isWriter(),