@manuscripts/style-guide 1.1.6 → 1.1.7-LEAN-2192-v8
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 +1 -1
- package/dist/cjs/components/EditorHeader/ProceedView.js +5 -5
- package/dist/cjs/lib/capabilities.js +12 -10
- package/dist/es/components/EditorHeader/EditorHeader.js +1 -1
- package/dist/es/components/EditorHeader/ProceedView.js +5 -5
- package/dist/es/lib/capabilities.js +12 -10
- package/dist/types/components/EditorHeader/EditorHeader.d.ts +1 -1
- package/dist/types/components/EditorHeader/ProceedView.d.ts +1 -1
- package/dist/types/lib/capabilities.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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.
|
|
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: submission.previousStep.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,
|
|
49
|
+
const ProceedView = ({ currentStepTransition, onTransitionClick, disable, loading, showComplete, confirmationDialog, previousStepType, currentStepType, 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 ${
|
|
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
|
-
|
|
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({},
|
|
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({},
|
|
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))))));
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CapabilitiesProvider = exports.useCalcPermission = exports.usePermissions = exports.getAllPermitted = exports.getCapabilities = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
var
|
|
9
|
-
(function (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})(
|
|
8
|
+
var Actions;
|
|
9
|
+
(function (Actions) {
|
|
10
|
+
Actions["updateAttachment"] = "update-attachment";
|
|
11
|
+
Actions["updateDueDate"] = "update-due-date";
|
|
12
|
+
Actions["addNote"] = "add-note";
|
|
13
|
+
Actions["setMainManuscript"] = "set-main-manuscript";
|
|
14
|
+
})(Actions || (Actions = {}));
|
|
15
15
|
const getCapabilities = (project, profile, role, actions) => {
|
|
16
16
|
const isEditor = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.editors) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
17
17
|
const isOwner = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.owners) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
@@ -33,20 +33,22 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
33
33
|
resolveOthersComment: !(isViewer() || isAnnotator()),
|
|
34
34
|
createComment: !isViewer(),
|
|
35
35
|
viewNotes: true,
|
|
36
|
-
createNotes: !isViewer() && allowed(
|
|
36
|
+
createNotes: !isViewer() && allowed(Actions.addNote),
|
|
37
37
|
handleNotes: isOwner() || isEditor() || isWriter(),
|
|
38
38
|
viewHistory: false,
|
|
39
39
|
restoreVersion: isOwner() || isEditor() || isWriter(),
|
|
40
40
|
downloadFiles: true,
|
|
41
|
+
changeDesignation: (isOwner() || isEditor() || isWriter()) &&
|
|
42
|
+
allowed(Actions.updateAttachment),
|
|
41
43
|
replaceFile: isOwner() || isEditor() || isWriter(),
|
|
42
44
|
uploadFile: isOwner() || isEditor() || isWriter(),
|
|
43
45
|
handleQualityReport: isOwner() || isEditor() || isWriter(),
|
|
44
|
-
setMainManuscript: allowed(
|
|
46
|
+
setMainManuscript: allowed(Actions.setMainManuscript),
|
|
45
47
|
rejectTask: isProdEditor(),
|
|
46
48
|
acceptTask: isProdEditor(),
|
|
47
49
|
resolveOnHoldTask: isProdEditor(),
|
|
48
50
|
putOnHoldTask: isProdEditor(),
|
|
49
|
-
changeDueDate: isProdEditor() && allowed(
|
|
51
|
+
changeDueDate: isProdEditor() && allowed(Actions.updateDueDate),
|
|
50
52
|
previewAccess: true,
|
|
51
53
|
editNotTracked: false,
|
|
52
54
|
accessEditor: true,
|
|
@@ -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: submission.previousStep.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, previousStepType, currentStepType, 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))))));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
var
|
|
3
|
-
(function (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})(
|
|
2
|
+
var Actions;
|
|
3
|
+
(function (Actions) {
|
|
4
|
+
Actions["updateAttachment"] = "update-attachment";
|
|
5
|
+
Actions["updateDueDate"] = "update-due-date";
|
|
6
|
+
Actions["addNote"] = "add-note";
|
|
7
|
+
Actions["setMainManuscript"] = "set-main-manuscript";
|
|
8
|
+
})(Actions || (Actions = {}));
|
|
9
9
|
export const getCapabilities = (project, profile, role, actions) => {
|
|
10
10
|
const isEditor = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.editors) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
11
11
|
const isOwner = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.owners) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
@@ -27,20 +27,22 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
27
27
|
resolveOthersComment: !(isViewer() || isAnnotator()),
|
|
28
28
|
createComment: !isViewer(),
|
|
29
29
|
viewNotes: true,
|
|
30
|
-
createNotes: !isViewer() && allowed(
|
|
30
|
+
createNotes: !isViewer() && allowed(Actions.addNote),
|
|
31
31
|
handleNotes: isOwner() || isEditor() || isWriter(),
|
|
32
32
|
viewHistory: false,
|
|
33
33
|
restoreVersion: isOwner() || isEditor() || isWriter(),
|
|
34
34
|
downloadFiles: true,
|
|
35
|
+
changeDesignation: (isOwner() || isEditor() || isWriter()) &&
|
|
36
|
+
allowed(Actions.updateAttachment),
|
|
35
37
|
replaceFile: isOwner() || isEditor() || isWriter(),
|
|
36
38
|
uploadFile: isOwner() || isEditor() || isWriter(),
|
|
37
39
|
handleQualityReport: isOwner() || isEditor() || isWriter(),
|
|
38
|
-
setMainManuscript: allowed(
|
|
40
|
+
setMainManuscript: allowed(Actions.setMainManuscript),
|
|
39
41
|
rejectTask: isProdEditor(),
|
|
40
42
|
acceptTask: isProdEditor(),
|
|
41
43
|
resolveOnHoldTask: isProdEditor(),
|
|
42
44
|
putOnHoldTask: isProdEditor(),
|
|
43
|
-
changeDueDate: isProdEditor() && allowed(
|
|
45
|
+
changeDueDate: isProdEditor() && allowed(Actions.updateDueDate),
|
|
44
46
|
previewAccess: true,
|
|
45
47
|
editNotTracked: false,
|
|
46
48
|
accessEditor: true,
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
export type PartialSubmission = {
|
|
4
4
|
id: string;
|
|
5
5
|
currentStep: SubmissionStep;
|
|
6
|
-
|
|
6
|
+
previousStep?: SubmissionStep | null | undefined;
|
|
7
7
|
};
|
|
8
8
|
export type SubmissionStep = {
|
|
9
9
|
type: SubmissionStepType;
|
|
@@ -11,7 +11,7 @@ export declare const ProceedView: React.FC<{
|
|
|
11
11
|
noteValue: string;
|
|
12
12
|
currentStepTransition: SubmissionStepTransition[];
|
|
13
13
|
error: string | undefined;
|
|
14
|
-
|
|
14
|
+
previousStepType: SubmissionStepType;
|
|
15
15
|
currentStepType: SubmissionStepType;
|
|
16
16
|
confirmationDialog: boolean;
|
|
17
17
|
onCancelClick: () => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.7-LEAN-2192-v8",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|