@manuscripts/style-guide 1.1.3 → 1.1.4-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.
@@ -49,7 +49,7 @@ const MapUserRole = {
49
49
  Viewer: { label: 'Reading...', icon: __1.ReadingIcon },
50
50
  };
51
51
  const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
52
- var _a, _b, _c;
52
+ var _a, _b, _c, _d;
53
53
  const [confirmationDialog, toggleConfirmationDialog] = (0, react_1.useState)(false);
54
54
  const [loading, setLoading] = (0, react_1.useState)(false);
55
55
  const [noteValue, setNoteValue] = (0, react_1.useState)('');
@@ -95,7 +95,7 @@ const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userR
95
95
  react_1.default.createElement("span", null, "Dashboard"))),
96
96
  handleSnapshot &&
97
97
  typeof hasPendingSuggestions == 'boolean' &&
98
- submission.nextStep && (react_1.default.createElement(ProceedView_1.ProceedView, { isAnnotator: isAnnotator, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, loading: loading, showComplete: showComplete, noteValue: noteValue, currentStepTransition: currentStepTransition, error: error, nextStepType: submission.nextStep.type, currentStepType: submission.currentStep.type, confirmationDialog: confirmationDialog, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
98
+ submission.previousStep && (react_1.default.createElement(ProceedView_1.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 })),
99
99
  status && (react_1.default.createElement(ChildWrapper, null,
100
100
  react_1.default.createElement(__1.SaveStatus, { status: status }))),
101
101
  react_1.default.createElement(Spacer, null),
@@ -46,7 +46,7 @@ const StepDetails = ({ icon, label, description, role }) => (react_1.default.cre
46
46
  react_1.default.createElement(__1.SecondarySmallText, null,
47
47
  "Actor: ",
48
48
  role.label))));
49
- const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loading, showComplete, confirmationDialog, nextStepType, currentStepType, isAnnotator, hasPendingSuggestions, error, noteValue, onNoteChange, onCancelClick, continueDialogAction, message: Message, }) => {
49
+ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loading, showComplete, confirmationDialog, currentStepType, previousStepType, isAnnotator, hasPendingSuggestions, error, noteValue, onNoteChange, onCancelClick, continueDialogAction, message: Message, }) => {
50
50
  const dialogMessages = (0, react_1.useMemo)(() => hasPendingSuggestions && !isAnnotator
51
51
  ? {
52
52
  header: 'The task can not be transitioned to the next step',
@@ -62,7 +62,7 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loadin
62
62
  : showComplete
63
63
  ? {
64
64
  header: 'Content reassigned successfully',
65
- message: `to the ${nextStepType.label}`,
65
+ message: `to the ${currentStepType.label}`,
66
66
  actions: {
67
67
  primary: {
68
68
  action: onCancelClick,
@@ -87,7 +87,7 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loadin
87
87
  showComplete,
88
88
  continueDialogAction,
89
89
  onCancelClick,
90
- nextStepType,
90
+ currentStepType,
91
91
  hasPendingSuggestions,
92
92
  isAnnotator,
93
93
  ]);
@@ -100,10 +100,10 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loadin
100
100
  (loading && (react_1.default.createElement(__1.LoadingOverlay, null,
101
101
  react_1.default.createElement(Message, { isCentered: true }, "Proceeding with your submission\u2026")))) || (react_1.default.createElement(__1.Dialog, { isOpen: confirmationDialog && !loading, category: __1.Category.confirmation, header: dialogMessages.header, message: dialogMessages.message, actions: dialogMessages.actions },
102
102
  (showComplete && (react_1.default.createElement(Grid, null,
103
- react_1.default.createElement(StepDetails, Object.assign({}, currentStepType, { icon: react_1.default.createElement(react_1.default.Fragment, null,
103
+ react_1.default.createElement(StepDetails, Object.assign({}, previousStepType, { icon: react_1.default.createElement(react_1.default.Fragment, null,
104
104
  react_1.default.createElement(__1.TaskStepDoneIcon, null),
105
105
  react_1.default.createElement(Line, null)) })),
106
- react_1.default.createElement(StepDetails, Object.assign({}, nextStepType))))) ||
106
+ react_1.default.createElement(StepDetails, Object.assign({}, currentStepType))))) ||
107
107
  ((!hasPendingSuggestions || isAnnotator) && onNoteChange && (react_1.default.createElement(TextAreaWrapper, null,
108
108
  react_1.default.createElement(EditorHeader_1.MediumTextArea, { value: noteValue, onChange: onNoteChange, rows: 5, placeholder: 'Add any additional comment here...' })))),
109
109
  error && (react_1.default.createElement(AlertMessage_1.AlertMessage, { type: AlertMessage_1.AlertMessageType.error, hideCloseButton: true }, error))))));
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.FileManager = exports.PermissionsContext = void 0;
39
+ const json_schema_1 = require("@manuscripts/json-schema");
39
40
  const transform_1 = require("@manuscripts/transform");
40
41
  const react_1 = __importStar(require("react"));
41
42
  const react_tooltip_1 = __importDefault(require("react-tooltip"));
@@ -87,6 +88,10 @@ const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManageme
87
88
  }
88
89
  return response;
89
90
  }), [upload, saveModel]);
91
+ const handleSupplementReplace = (0, react_1.useCallback)((attachment, oldAttachmentId) => __awaiter(void 0, void 0, void 0, function* () {
92
+ const model = (0, transform_1.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement).find(({ href }) => (href === null || href === void 0 ? void 0 : href.replace('attachment:', '')) === oldAttachmentId);
93
+ yield saveModel(Object.assign(Object.assign({}, model), { title: attachment.name, href: `attachment:${attachment.id}` }));
94
+ }), [modelMap, saveModel]);
90
95
  const handleChangeDesignationFile = (0, react_1.useCallback)((attachmentId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
91
96
  const res = yield changeDesignation(attachmentId, typeId, name);
92
97
  if (res) {
@@ -122,6 +127,7 @@ const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManageme
122
127
  const itemsDataWithTitle = (0, util_1.generateAttachmentsTitles)(itemsData, fileSection);
123
128
  const filesItems = itemsDataWithTitle.map((element) => {
124
129
  const itemProps = {
130
+ fileSection,
125
131
  externalFile: element.externalFile,
126
132
  title: element.title,
127
133
  showAttachmentName: isSupplementOrOtherFilesTab,
@@ -129,6 +135,7 @@ const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileManageme
129
135
  showReplaceAction: !isOtherFilesTab,
130
136
  handleDownload,
131
137
  handleReplace: handleReplaceFile,
138
+ handleSupplementReplace,
132
139
  handleChangeDesignation: handleChangeDesignationFile,
133
140
  dispatch: dispatch,
134
141
  };
@@ -14,7 +14,7 @@ const util_1 = require("../util");
14
14
  const FileInfo_1 = require("./FileInfo");
15
15
  const FileTypeIcon_1 = require("./FileTypeIcon");
16
16
  const ItemActions_1 = require("./ItemActions");
17
- const FileSectionItem = ({ externalFile, title, showAttachmentName = false, showDesignationActions = false, showReplaceAction = true, handleDownload, handleReplace, handleChangeDesignation, dispatch, dragRef, className, style, onClose, isEditor, }) => {
17
+ const FileSectionItem = ({ fileSection, externalFile, title, showAttachmentName = false, showDesignationActions = false, showReplaceAction = true, handleDownload, handleReplace, handleChangeDesignation, handleSupplementReplace, dispatch, dragRef, className, style, onClose, isEditor, }) => {
18
18
  const { isOpen, toggleOpen, wrapperRef } = (0, use_dropdown_1.useDropdown)();
19
19
  const fileExtension = externalFile.name.substring(externalFile.name.lastIndexOf('.') + 1);
20
20
  const designation = util_1.namesWithDesignationMap.get(externalFile.type.label);
@@ -38,7 +38,7 @@ const FileSectionItem = ({ externalFile, title, showAttachmentName = false, show
38
38
  handleDownload && handleReplace && (react_1.default.createElement(Dropdown_1.DropdownContainer, { ref: wrapperRef },
39
39
  react_1.default.createElement(exports.ActionsIcon, { onClick: toggleOpen, type: "button", "aria-label": "Download or Replace", "aria-pressed": isOpen },
40
40
  react_1.default.createElement(dots_icon_1.default, null)),
41
- isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { replaceAttachmentHandler: handleReplace, showReplaceAction: showReplaceAction, downloadAttachmentHandler: handleDownload, attachmentId: externalFile.id, fileName: externalFile.name, designation: externalFile.type.label, publicUrl: externalFile.link, hideActionList: toggleOpen, dispatch: dispatch }))))));
41
+ isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { fileSection: fileSection, replaceAttachmentHandler: handleReplace, showReplaceAction: showReplaceAction, downloadAttachmentHandler: handleDownload, handleSupplementReplace: handleSupplementReplace, attachmentId: externalFile.id, fileName: externalFile.name, designation: externalFile.type.label, publicUrl: externalFile.link, hideActionList: toggleOpen, dispatch: dispatch }))))));
42
42
  };
43
43
  exports.FileSectionItem = FileSectionItem;
44
44
  const IconCloseButton = styled_components_1.default.button `
@@ -39,7 +39,7 @@ const FileManager_1 = require("../FileManager");
39
39
  const FileSectionState_1 = require("../FileSectionState");
40
40
  const ItemsAction_1 = require("../ItemsAction");
41
41
  const util_1 = require("../util");
42
- const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, detachAttachmnetHandler, handleUpdateInline, attachmentId, fileName, designation, publicUrl, hideActionList, dispatch, dropDownClassName, showReplaceAction, }) => {
42
+ const ItemActions = ({ fileSection, downloadAttachmentHandler, replaceAttachmentHandler, handleSupplementReplace, detachAttachmnetHandler, handleUpdateInline, attachmentId, fileName, designation, publicUrl, hideActionList, dispatch, dropDownClassName, showReplaceAction, }) => {
43
43
  const attachmentDesignation = designation == undefined ? 'undefined' : designation;
44
44
  const attachmentDesignationName = attachmentDesignation !== 'undefined'
45
45
  ? util_1.namesWithDesignationMap.get(attachmentDesignation)
@@ -65,6 +65,11 @@ const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, deta
65
65
  dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(attachmentDesignationName || util_1.Designation.Document));
66
66
  }
67
67
  const result = yield replaceAttachmentHandler(attachmentId, fileName, file, attachmentDesignation);
68
+ if (fileSection === util_1.FileSectionType.Supplements &&
69
+ typeof result === 'object' &&
70
+ handleSupplementReplace) {
71
+ handleSupplementReplace(result, attachmentId);
72
+ }
68
73
  if (typeof result === 'object' && handleUpdateInline) {
69
74
  handleUpdateInline(result);
70
75
  }
@@ -74,7 +74,7 @@ const FileReference = ({ attachment, handleReplace, handleDownload, handleUpdate
74
74
  handleDownload && handleReplace && (react_1.default.createElement(DropdownContainer, { ref: wrapperRef },
75
75
  react_1.default.createElement(FileSectionItem_1.ActionsIcon, { onClick: toggleOpen, type: "button", className: 'external_file_dropdown', "aria-label": "Download or Replace or Detach", "aria-pressed": isOpen },
76
76
  react_1.default.createElement(dots_icon_1.default, null)),
77
- isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { replaceAttachmentHandler: handleReplace, showReplaceAction: true, handleUpdateInline: (uploadAttachment) => handleUpdateInline &&
77
+ isOpen && (react_1.default.createElement(ItemActions_1.ItemActions, { fileSection: util_1.FileSectionType.Inline, replaceAttachmentHandler: handleReplace, showReplaceAction: true, handleUpdateInline: (uploadAttachment) => handleUpdateInline &&
78
78
  (attachment === null || attachment === void 0 ? void 0 : attachment.modelId) &&
79
79
  handleUpdateInline(attachment.modelId, uploadAttachment), detachAttachmnetHandler: () => handleDetachFile &&
80
80
  attachment.modelId &&
@@ -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.nextStep && (React.createElement(ProceedView, { isAnnotator: isAnnotator, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, loading: loading, showComplete: showComplete, noteValue: noteValue, currentStepTransition: currentStepTransition, error: error, nextStepType: submission.nextStep.type, currentStepType: submission.currentStep.type, confirmationDialog: confirmationDialog, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
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, nextStepType, currentStepType, isAnnotator, hasPendingSuggestions, error, noteValue, onNoteChange, onCancelClick, continueDialogAction, message: Message, }) => {
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 ${nextStepType.label}`,
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
- nextStepType,
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({}, currentStepType, { icon: React.createElement(React.Fragment, null,
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({}, nextStepType))))) ||
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))))));
@@ -7,7 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { buildSupplementaryMaterial } from '@manuscripts/transform';
10
+ import { ObjectTypes, } from '@manuscripts/json-schema';
11
+ import { buildSupplementaryMaterial, getModelsByType, } from '@manuscripts/transform';
11
12
  import React, { createContext, useCallback, useReducer } from 'react';
12
13
  import ReactTooltip from 'react-tooltip';
13
14
  import { FileSectionType, useFiles } from '../../index';
@@ -58,6 +59,10 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
58
59
  }
59
60
  return response;
60
61
  }), [upload, saveModel]);
62
+ const handleSupplementReplace = useCallback((attachment, oldAttachmentId) => __awaiter(void 0, void 0, void 0, function* () {
63
+ const model = getModelsByType(modelMap, ObjectTypes.Supplement).find(({ href }) => (href === null || href === void 0 ? void 0 : href.replace('attachment:', '')) === oldAttachmentId);
64
+ yield saveModel(Object.assign(Object.assign({}, model), { title: attachment.name, href: `attachment:${attachment.id}` }));
65
+ }), [modelMap, saveModel]);
61
66
  const handleChangeDesignationFile = useCallback((attachmentId, typeId, name) => __awaiter(void 0, void 0, void 0, function* () {
62
67
  const res = yield changeDesignation(attachmentId, typeId, name);
63
68
  if (res) {
@@ -93,6 +98,7 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
93
98
  const itemsDataWithTitle = generateAttachmentsTitles(itemsData, fileSection);
94
99
  const filesItems = itemsDataWithTitle.map((element) => {
95
100
  const itemProps = {
101
+ fileSection,
96
102
  externalFile: element.externalFile,
97
103
  title: element.title,
98
104
  showAttachmentName: isSupplementOrOtherFilesTab,
@@ -100,6 +106,7 @@ export const FileManager = ({ modelMap, saveModel, enableDragAndDrop, can, fileM
100
106
  showReplaceAction: !isOtherFilesTab,
101
107
  handleDownload,
102
108
  handleReplace: handleReplaceFile,
109
+ handleSupplementReplace,
103
110
  handleChangeDesignation: handleChangeDesignationFile,
104
111
  dispatch: dispatch,
105
112
  };
@@ -8,7 +8,7 @@ import { Designation, namesWithDesignationMap } from '../util';
8
8
  import { FileInfo } from './FileInfo';
9
9
  import { FileTypeIcon } from './FileTypeIcon';
10
10
  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, }) => {
11
+ export const FileSectionItem = ({ fileSection, externalFile, title, showAttachmentName = false, showDesignationActions = false, showReplaceAction = true, handleDownload, handleReplace, handleChangeDesignation, handleSupplementReplace, dispatch, dragRef, className, style, onClose, isEditor, }) => {
12
12
  const { isOpen, toggleOpen, wrapperRef } = useDropdown();
13
13
  const fileExtension = externalFile.name.substring(externalFile.name.lastIndexOf('.') + 1);
14
14
  const designation = namesWithDesignationMap.get(externalFile.type.label);
@@ -32,7 +32,7 @@ export const FileSectionItem = ({ externalFile, title, showAttachmentName = fals
32
32
  handleDownload && handleReplace && (React.createElement(DropdownContainer, { ref: wrapperRef },
33
33
  React.createElement(ActionsIcon, { onClick: toggleOpen, type: "button", "aria-label": "Download or Replace", "aria-pressed": isOpen },
34
34
  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 }))))));
35
+ isOpen && (React.createElement(ItemActions, { fileSection: fileSection, replaceAttachmentHandler: handleReplace, showReplaceAction: showReplaceAction, downloadAttachmentHandler: handleDownload, handleSupplementReplace: handleSupplementReplace, attachmentId: externalFile.id, fileName: externalFile.name, designation: externalFile.type.label, publicUrl: externalFile.link, hideActionList: toggleOpen, dispatch: dispatch }))))));
36
36
  };
37
37
  const IconCloseButton = styled.button `
38
38
  border: none;
@@ -12,8 +12,8 @@ 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, }) => {
15
+ import { Designation, FileSectionType, namesWithDesignationMap } from '../util';
16
+ export const ItemActions = ({ fileSection, downloadAttachmentHandler, replaceAttachmentHandler, handleSupplementReplace, detachAttachmnetHandler, handleUpdateInline, attachmentId, fileName, designation, publicUrl, hideActionList, dispatch, dropDownClassName, showReplaceAction, }) => {
17
17
  const attachmentDesignation = designation == undefined ? 'undefined' : designation;
18
18
  const attachmentDesignationName = attachmentDesignation !== 'undefined'
19
19
  ? namesWithDesignationMap.get(attachmentDesignation)
@@ -39,6 +39,11 @@ export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandle
39
39
  dispatch(actions.SELECT_DESIGNATION(attachmentDesignationName || Designation.Document));
40
40
  }
41
41
  const result = yield replaceAttachmentHandler(attachmentId, fileName, file, attachmentDesignation);
42
+ if (fileSection === FileSectionType.Supplements &&
43
+ typeof result === 'object' &&
44
+ handleSupplementReplace) {
45
+ handleSupplementReplace(result, attachmentId);
46
+ }
42
47
  if (typeof result === 'object' && handleUpdateInline) {
43
48
  handleUpdateInline(result);
44
49
  }
@@ -5,7 +5,7 @@ import DotsIcon from '../icons/dots-icon';
5
5
  import { FileInfoContainer, FileNameTitleContainer, FileTitle, } from './FileSectionItem/FileInfo';
6
6
  import { ActionsIcon, Item, } from './FileSectionItem/FileSectionItem';
7
7
  import { ItemActions } from './FileSectionItem/ItemActions';
8
- import { extensionsWithFileTypesMap, fileTypesWithIconMap, } from './util';
8
+ import { extensionsWithFileTypesMap, FileSectionType, fileTypesWithIconMap, } from './util';
9
9
  const trackedJoint = ':dataTracked:';
10
10
  export const InlineFilesSection = ({ handleReplace, handleDownload, handleUpdateInline, handleDetachFile, inlineFiles, isEditor, dispatch, }) => {
11
11
  const onElementClick = useCallback((e) => {
@@ -44,7 +44,7 @@ const FileReference = ({ attachment, handleReplace, handleDownload, handleUpdate
44
44
  handleDownload && handleReplace && (React.createElement(DropdownContainer, { ref: wrapperRef },
45
45
  React.createElement(ActionsIcon, { onClick: toggleOpen, type: "button", className: 'external_file_dropdown', "aria-label": "Download or Replace or Detach", "aria-pressed": isOpen },
46
46
  React.createElement(DotsIcon, null)),
47
- isOpen && (React.createElement(ItemActions, { replaceAttachmentHandler: handleReplace, showReplaceAction: true, handleUpdateInline: (uploadAttachment) => handleUpdateInline &&
47
+ isOpen && (React.createElement(ItemActions, { fileSection: FileSectionType.Inline, replaceAttachmentHandler: handleReplace, showReplaceAction: true, handleUpdateInline: (uploadAttachment) => handleUpdateInline &&
48
48
  (attachment === null || attachment === void 0 ? void 0 : attachment.modelId) &&
49
49
  handleUpdateInline(attachment.modelId, uploadAttachment), detachAttachmnetHandler: () => handleDetachFile &&
50
50
  attachment.modelId &&
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  export type PartialSubmission = {
4
4
  id: string;
5
5
  currentStep: SubmissionStep;
6
- nextStep?: SubmissionStep | null | undefined;
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,6 +3,7 @@ import { DragElementWrapper, DragSourceOptions } from 'react-dnd';
3
3
  import { Maybe } from '../../SubmissionInspector/types';
4
4
  import { ChangeDesignation, Replace } from '../FileManager';
5
5
  import { Action } from '../FileSectionState';
6
+ import { FileSectionType } from '../util';
6
7
  export type FileAttachment = {
7
8
  id: string;
8
9
  name: string;
@@ -15,6 +16,7 @@ export type FileAttachmentType = {
15
16
  };
16
17
  export interface FileSectionItemProps {
17
18
  externalFile: FileAttachment;
19
+ fileSection: FileSectionType;
18
20
  title: string;
19
21
  showAttachmentName?: boolean;
20
22
  showDesignationActions?: boolean;
@@ -22,6 +24,7 @@ export interface FileSectionItemProps {
22
24
  showReplaceAction?: boolean;
23
25
  handleDownload?: (url: string) => void;
24
26
  handleReplace?: Replace;
27
+ handleSupplementReplace?: (attachment: FileAttachment, oldAttachmentId: string) => void;
25
28
  handleChangeDesignation: ChangeDesignation;
26
29
  dispatch?: Dispatch<Action>;
27
30
  dragRef?: DragElementWrapper<DragSourceOptions>;
@@ -2,12 +2,15 @@ import React, { Dispatch } from 'react';
2
2
  import { Maybe } from '../../SubmissionInspector/types';
3
3
  import { Replace } from '../FileManager';
4
4
  import { Action } from '../FileSectionState';
5
+ import { FileSectionType } from '../util';
5
6
  import { FileAttachment } from './FileSectionItem';
6
7
  export declare const ItemActions: React.FC<{
8
+ fileSection: FileSectionType;
7
9
  downloadAttachmentHandler: (url: string) => void;
8
10
  replaceAttachmentHandler: Replace;
9
11
  detachAttachmnetHandler?: () => void;
10
12
  handleUpdateInline?: (attachment: FileAttachment) => void;
13
+ handleSupplementReplace?: (attachment: FileAttachment, oldAttachmentId: string) => void;
11
14
  attachmentId: string;
12
15
  fileName: string;
13
16
  designation?: Maybe<string> | undefined;
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.3",
4
+ "version": "1.1.4-LEAN-2192",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",