@manuscripts/style-guide 1.3.4 → 1.3.5-LEAN-2705
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 +3 -11
- package/dist/cjs/components/EditorHeader/ProceedView.js +11 -4
- package/dist/cjs/lib/capabilities.js +1 -0
- package/dist/es/components/EditorHeader/EditorHeader.js +3 -11
- package/dist/es/components/EditorHeader/ProceedView.js +11 -4
- package/dist/es/lib/capabilities.js +1 -0
- package/dist/types/components/EditorHeader/ProceedView.d.ts +0 -1
- package/dist/types/lib/capabilities.d.ts +1 -0
- package/package.json +2 -2
|
@@ -59,7 +59,6 @@ const MapUserRole = {
|
|
|
59
59
|
};
|
|
60
60
|
const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, isProofer, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
|
|
61
61
|
var _a, _b, _c, _d, _e;
|
|
62
|
-
const [confirmationDialog, toggleConfirmationDialog] = (0, react_1.useState)(false);
|
|
63
62
|
const [noteValue, setNoteValue] = (0, react_1.useState)('');
|
|
64
63
|
const [selectedTransitionIndex, setSelectedTransitionIndex] = (0, react_1.useState)();
|
|
65
64
|
const { dialogData, submit } = submitProceed;
|
|
@@ -81,20 +80,13 @@ const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userR
|
|
|
81
80
|
]);
|
|
82
81
|
const onTransitionClick = (0, react_1.useCallback)((event) => {
|
|
83
82
|
updateState(DialogState.INIT);
|
|
84
|
-
toggleConfirmationDialog(true);
|
|
85
83
|
setSelectedTransitionIndex(event.target.value || event.target.parentNode.value);
|
|
86
|
-
}, [setSelectedTransitionIndex,
|
|
84
|
+
}, [setSelectedTransitionIndex, updateState]);
|
|
87
85
|
const onCancelClick = (0, react_1.useCallback)(() => {
|
|
88
|
-
toggleConfirmationDialog(false);
|
|
89
86
|
setSelectedTransitionIndex(undefined);
|
|
90
87
|
clearError();
|
|
91
88
|
updateState(DialogState.CLOSED);
|
|
92
|
-
}, [
|
|
93
|
-
toggleConfirmationDialog,
|
|
94
|
-
setSelectedTransitionIndex,
|
|
95
|
-
clearError,
|
|
96
|
-
updateState,
|
|
97
|
-
]);
|
|
89
|
+
}, [setSelectedTransitionIndex, clearError, updateState]);
|
|
98
90
|
const onNoteChange = (0, react_1.useCallback)((event) => setNoteValue(event.target.value), [setNoteValue]);
|
|
99
91
|
const currentStepTransition = submission === null || submission === void 0 ? void 0 : submission.currentStep.type.transitions;
|
|
100
92
|
const disable = !currentStepTransition || !canCompleteTask;
|
|
@@ -105,7 +97,7 @@ const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userR
|
|
|
105
97
|
react_1.default.createElement("span", null, "Dashboard"))),
|
|
106
98
|
handleSnapshot &&
|
|
107
99
|
typeof hasPendingSuggestions == 'boolean' &&
|
|
108
|
-
submission.nextStep && (react_1.default.createElement(ProceedView_1.ProceedView, { isAnnotator: isAnnotator, isProofer: isProofer, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type,
|
|
100
|
+
submission.nextStep && (react_1.default.createElement(ProceedView_1.ProceedView, { isAnnotator: isAnnotator, isProofer: isProofer, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
|
|
109
101
|
status && (react_1.default.createElement(ChildWrapper, null,
|
|
110
102
|
react_1.default.createElement(__1.SaveStatus, { status: status }))),
|
|
111
103
|
react_1.default.createElement(Spacer, null),
|
|
@@ -46,8 +46,11 @@ 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, dialogData,
|
|
50
|
-
const dialogMessages = (0, react_1.useMemo)(() => hasPendingSuggestions &&
|
|
49
|
+
const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialogData, previousStepType, currentStepType, isAnnotator, isProofer, hasPendingSuggestions, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
50
|
+
const dialogMessages = (0, react_1.useMemo)(() => hasPendingSuggestions &&
|
|
51
|
+
!isAnnotator &&
|
|
52
|
+
!isProofer &&
|
|
53
|
+
dialogData.state !== __1.DialogState.SUCCESS
|
|
51
54
|
? {
|
|
52
55
|
header: 'The task can not be transitioned to the next step',
|
|
53
56
|
message: `There are still pending suggestions in the document.
|
|
@@ -57,6 +60,7 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialog
|
|
|
57
60
|
action: onCancelClick,
|
|
58
61
|
title: 'Ok',
|
|
59
62
|
},
|
|
63
|
+
onClose: onCancelClick,
|
|
60
64
|
},
|
|
61
65
|
}
|
|
62
66
|
: dialogData.state === __1.DialogState.SUCCESS
|
|
@@ -68,6 +72,7 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialog
|
|
|
68
72
|
action: onCancelClick,
|
|
69
73
|
title: 'Close',
|
|
70
74
|
},
|
|
75
|
+
onClose: onCancelClick,
|
|
71
76
|
},
|
|
72
77
|
}
|
|
73
78
|
: {
|
|
@@ -82,6 +87,7 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialog
|
|
|
82
87
|
action: onCancelClick,
|
|
83
88
|
title: 'Cancel',
|
|
84
89
|
},
|
|
90
|
+
onClose: onCancelClick,
|
|
85
91
|
},
|
|
86
92
|
}, [
|
|
87
93
|
dialogData,
|
|
@@ -100,13 +106,14 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialog
|
|
|
100
106
|
transition.type.description))))))) || (react_1.default.createElement(EditorHeader_1.PrimaryButtonSmall, { value: 0, onClick: onTransitionClick, disabled: disable }, "Complete task")),
|
|
101
107
|
dialogData.state === __1.DialogState.LOADING && (react_1.default.createElement(__1.LoadingOverlay, null,
|
|
102
108
|
react_1.default.createElement(Message, { isCentered: true }, "Proceeding with your submission\u2026"))),
|
|
103
|
-
|
|
109
|
+
react_1.default.createElement(__1.Dialog, { isOpen: dialogData.state !== __1.DialogState.CLOSED &&
|
|
110
|
+
dialogData.state !== __1.DialogState.LOADING, category: __1.Category.confirmation, header: dialogMessages.header, message: dialogMessages.message, actions: dialogMessages.actions },
|
|
104
111
|
dialogData.state === __1.DialogState.SUCCESS && (react_1.default.createElement(Grid, null,
|
|
105
112
|
previousStepType && (react_1.default.createElement(StepDetails, Object.assign({}, previousStepType, { icon: react_1.default.createElement(react_1.default.Fragment, null,
|
|
106
113
|
react_1.default.createElement(__1.TaskStepDoneIcon, null),
|
|
107
114
|
react_1.default.createElement(Line, null)) }))),
|
|
108
115
|
react_1.default.createElement(StepDetails, Object.assign({}, currentStepType)))),
|
|
109
|
-
dialogData.state === __1.DialogState.ERROR && (react_1.default.createElement(AlertMessage_1.AlertMessage, { type: AlertMessage_1.AlertMessageType.error, hideCloseButton: true }, dialogData.error)))))
|
|
116
|
+
dialogData.state === __1.DialogState.ERROR && (react_1.default.createElement(AlertMessage_1.AlertMessage, { type: AlertMessage_1.AlertMessageType.error, hideCloseButton: true }, dialogData.error)))));
|
|
110
117
|
};
|
|
111
118
|
exports.ProceedView = ProceedView;
|
|
112
119
|
const TaskDropdown = styled_components_1.default.div `
|
|
@@ -59,6 +59,7 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
59
59
|
editMetadata: !(isViewer() || isAnnotator() || isProofer()),
|
|
60
60
|
editCitationsAndRefs: !(isViewer() || isAnnotator() || isProofer()),
|
|
61
61
|
shareProject: isOwner(),
|
|
62
|
+
applySaveChanges: !(isAnnotator() || isProofer()),
|
|
62
63
|
};
|
|
63
64
|
};
|
|
64
65
|
exports.getCapabilities = getCapabilities;
|
|
@@ -30,7 +30,6 @@ const MapUserRole = {
|
|
|
30
30
|
};
|
|
31
31
|
export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, isProofer, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
|
|
32
32
|
var _a, _b, _c, _d, _e;
|
|
33
|
-
const [confirmationDialog, toggleConfirmationDialog] = useState(false);
|
|
34
33
|
const [noteValue, setNoteValue] = useState('');
|
|
35
34
|
const [selectedTransitionIndex, setSelectedTransitionIndex] = useState();
|
|
36
35
|
const { dialogData, submit } = submitProceed;
|
|
@@ -52,20 +51,13 @@ export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions
|
|
|
52
51
|
]);
|
|
53
52
|
const onTransitionClick = useCallback((event) => {
|
|
54
53
|
updateState(DialogState.INIT);
|
|
55
|
-
toggleConfirmationDialog(true);
|
|
56
54
|
setSelectedTransitionIndex(event.target.value || event.target.parentNode.value);
|
|
57
|
-
}, [setSelectedTransitionIndex,
|
|
55
|
+
}, [setSelectedTransitionIndex, updateState]);
|
|
58
56
|
const onCancelClick = useCallback(() => {
|
|
59
|
-
toggleConfirmationDialog(false);
|
|
60
57
|
setSelectedTransitionIndex(undefined);
|
|
61
58
|
clearError();
|
|
62
59
|
updateState(DialogState.CLOSED);
|
|
63
|
-
}, [
|
|
64
|
-
toggleConfirmationDialog,
|
|
65
|
-
setSelectedTransitionIndex,
|
|
66
|
-
clearError,
|
|
67
|
-
updateState,
|
|
68
|
-
]);
|
|
60
|
+
}, [setSelectedTransitionIndex, clearError, updateState]);
|
|
69
61
|
const onNoteChange = useCallback((event) => setNoteValue(event.target.value), [setNoteValue]);
|
|
70
62
|
const currentStepTransition = submission === null || submission === void 0 ? void 0 : submission.currentStep.type.transitions;
|
|
71
63
|
const disable = !currentStepTransition || !canCompleteTask;
|
|
@@ -76,7 +68,7 @@ export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions
|
|
|
76
68
|
React.createElement("span", null, "Dashboard"))),
|
|
77
69
|
handleSnapshot &&
|
|
78
70
|
typeof hasPendingSuggestions == 'boolean' &&
|
|
79
|
-
submission.nextStep && (React.createElement(ProceedView, { isAnnotator: isAnnotator, isProofer: isProofer, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type,
|
|
71
|
+
submission.nextStep && (React.createElement(ProceedView, { isAnnotator: isAnnotator, isProofer: isProofer, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
|
|
80
72
|
status && (React.createElement(ChildWrapper, null,
|
|
81
73
|
React.createElement(SaveStatus, { status: status }))),
|
|
82
74
|
React.createElement(Spacer, null),
|
|
@@ -17,8 +17,11 @@ 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, dialogData,
|
|
21
|
-
const dialogMessages = useMemo(() => hasPendingSuggestions &&
|
|
20
|
+
export const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialogData, previousStepType, currentStepType, isAnnotator, isProofer, hasPendingSuggestions, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
21
|
+
const dialogMessages = useMemo(() => hasPendingSuggestions &&
|
|
22
|
+
!isAnnotator &&
|
|
23
|
+
!isProofer &&
|
|
24
|
+
dialogData.state !== DialogState.SUCCESS
|
|
22
25
|
? {
|
|
23
26
|
header: 'The task can not be transitioned to the next step',
|
|
24
27
|
message: `There are still pending suggestions in the document.
|
|
@@ -28,6 +31,7 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
28
31
|
action: onCancelClick,
|
|
29
32
|
title: 'Ok',
|
|
30
33
|
},
|
|
34
|
+
onClose: onCancelClick,
|
|
31
35
|
},
|
|
32
36
|
}
|
|
33
37
|
: dialogData.state === DialogState.SUCCESS
|
|
@@ -39,6 +43,7 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
39
43
|
action: onCancelClick,
|
|
40
44
|
title: 'Close',
|
|
41
45
|
},
|
|
46
|
+
onClose: onCancelClick,
|
|
42
47
|
},
|
|
43
48
|
}
|
|
44
49
|
: {
|
|
@@ -53,6 +58,7 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
53
58
|
action: onCancelClick,
|
|
54
59
|
title: 'Cancel',
|
|
55
60
|
},
|
|
61
|
+
onClose: onCancelClick,
|
|
56
62
|
},
|
|
57
63
|
}, [
|
|
58
64
|
dialogData,
|
|
@@ -71,13 +77,14 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
71
77
|
transition.type.description))))))) || (React.createElement(PrimaryButtonSmall, { value: 0, onClick: onTransitionClick, disabled: disable }, "Complete task")),
|
|
72
78
|
dialogData.state === DialogState.LOADING && (React.createElement(LoadingOverlay, null,
|
|
73
79
|
React.createElement(Message, { isCentered: true }, "Proceeding with your submission\u2026"))),
|
|
74
|
-
|
|
80
|
+
React.createElement(Dialog, { isOpen: dialogData.state !== DialogState.CLOSED &&
|
|
81
|
+
dialogData.state !== DialogState.LOADING, category: Category.confirmation, header: dialogMessages.header, message: dialogMessages.message, actions: dialogMessages.actions },
|
|
75
82
|
dialogData.state === DialogState.SUCCESS && (React.createElement(Grid, null,
|
|
76
83
|
previousStepType && (React.createElement(StepDetails, Object.assign({}, previousStepType, { icon: React.createElement(React.Fragment, null,
|
|
77
84
|
React.createElement(TaskStepDoneIcon, null),
|
|
78
85
|
React.createElement(Line, null)) }))),
|
|
79
86
|
React.createElement(StepDetails, Object.assign({}, currentStepType)))),
|
|
80
|
-
dialogData.state === DialogState.ERROR && (React.createElement(AlertMessage, { type: AlertMessageType.error, hideCloseButton: true }, dialogData.error)))))
|
|
87
|
+
dialogData.state === DialogState.ERROR && (React.createElement(AlertMessage, { type: AlertMessageType.error, hideCloseButton: true }, dialogData.error)))));
|
|
81
88
|
};
|
|
82
89
|
const TaskDropdown = styled.div `
|
|
83
90
|
display: flex;
|
|
@@ -53,6 +53,7 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
53
53
|
editMetadata: !(isViewer() || isAnnotator() || isProofer()),
|
|
54
54
|
editCitationsAndRefs: !(isViewer() || isAnnotator() || isProofer()),
|
|
55
55
|
shareProject: isOwner(),
|
|
56
|
+
applySaveChanges: !(isAnnotator() || isProofer()),
|
|
56
57
|
};
|
|
57
58
|
};
|
|
58
59
|
export const getAllPermitted = () => {
|
|
@@ -14,7 +14,6 @@ export declare const ProceedView: React.FC<{
|
|
|
14
14
|
previousStepType: SubmissionStepType | undefined;
|
|
15
15
|
currentStepType: SubmissionStepType;
|
|
16
16
|
nextStepType: SubmissionStepType;
|
|
17
|
-
confirmationDialog: boolean;
|
|
18
17
|
onCancelClick: () => void;
|
|
19
18
|
continueDialogAction: () => Promise<void>;
|
|
20
19
|
message: React.FC<{
|
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.3.
|
|
4
|
+
"version": "1.3.5-LEAN-2705",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@formatjs/intl-relativetimeformat": "^4.5.9",
|
|
37
37
|
"@formatjs/intl-utils": "^2.2.0",
|
|
38
38
|
"@manuscripts/assets": "^0.6.2",
|
|
39
|
-
"@manuscripts/transform": "^1.4.
|
|
39
|
+
"@manuscripts/transform": "^1.4.3",
|
|
40
40
|
"@manuscripts/json-schema": "^2.1.2",
|
|
41
41
|
"@manuscripts/title-editor": "^1.1.0",
|
|
42
42
|
"@manuscripts/comment-editor": "^1.0.3",
|