@manuscripts/style-guide 0.30.18 → 0.30.22
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/AffiliationsEditor/AffiliationsEditor.js +3 -3
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorItem.js +7 -6
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorProfile.js +3 -3
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorView.js +10 -40
- package/dist/cjs/components/AffiliationsEditor/styles.js +2 -1
- package/dist/cjs/components/AffiliationsList.js +3 -2
- package/dist/cjs/components/AlertMessage.js +9 -9
- package/dist/cjs/components/AuthorForm/AuthorForm.js +2 -1
- package/dist/cjs/components/AuthorForm/ContributorRolesSelect.js +6 -6
- package/dist/cjs/components/AuthorForm/RemoveAuthorButton.js +1 -1
- package/dist/cjs/components/AuthorForm/index.js +0 -1
- package/dist/cjs/components/AuthorName.js +2 -2
- package/dist/cjs/components/AuthorsContainer.js +5 -4
- package/dist/cjs/components/AuthorsDND/AuthorsDND.js +39 -17
- package/dist/cjs/components/AuthorsDND/DraggableAuthorItem.js +6 -25
- package/dist/cjs/components/AuthorsDND/index.js +5 -10
- package/dist/cjs/components/AuthorsList/Author.js +3 -2
- package/dist/cjs/components/AuthorsList/AuthorsList.js +4 -3
- package/dist/cjs/components/Avatar.js +5 -4
- package/dist/cjs/components/Button.js +15 -15
- package/dist/cjs/components/ColorField/ColorField.js +2 -1
- package/dist/cjs/components/ColorField/ColorSelector.js +8 -7
- package/dist/cjs/components/Comments/CommentActions.js +9 -12
- package/dist/cjs/components/Comments/CommentBody.js +5 -5
- package/dist/cjs/components/Comments/CommentTarget.js +1 -1
- package/dist/cjs/components/Comments/CommentUser.js +3 -2
- package/dist/cjs/components/Comments/CommentWrapper.js +18 -16
- package/dist/cjs/components/Comments/ResolveButton.js +3 -2
- package/dist/cjs/components/Dialog.js +2 -2
- package/dist/cjs/components/FileManager/ConfirmationPopUp.js +2 -1
- package/dist/cjs/components/FileManager/DragItemArea.js +2 -1
- package/dist/cjs/components/FileManager/FileManager.js +9 -8
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +5 -4
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActionsList.js +5 -4
- package/dist/cjs/components/FileManager/FileSectionItem/DragLayer.js +5 -4
- package/dist/cjs/components/FileManager/FileSectionItem/DraggableFileSectionItem.js +8 -7
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +3 -2
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +3 -2
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionUploadItem.js +3 -2
- package/dist/cjs/components/FileManager/FileSectionItem/FileTypeIcon.js +2 -1
- package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +5 -4
- package/dist/cjs/components/FileManager/FileSectionItem/ProgressBarUploadItem.js +2 -1
- package/dist/cjs/components/FileManager/FileSectionState.js +4 -2
- package/dist/cjs/components/FileManager/FilesSection.js +4 -3
- package/dist/cjs/components/FileManager/SelectDesignationActions.js +11 -11
- package/dist/cjs/components/FileManager/SelectDialogDesignation.js +3 -2
- package/dist/cjs/components/FileManager/UploadFileArea.js +11 -10
- package/dist/cjs/components/FileManager/util.js +15 -8
- package/dist/cjs/components/Form.js +1 -1
- package/dist/cjs/components/Inspector.js +7 -7
- package/dist/cjs/components/InspectorSection.js +5 -4
- package/dist/cjs/components/ManuscriptNoteList.js +17 -17
- package/dist/cjs/components/PdfPreview.js +13 -13
- package/dist/cjs/components/RadioButton.js +2 -1
- package/dist/cjs/components/RelativeDate.js +3 -2
- package/dist/cjs/components/SaveStatus.js +2 -1
- package/dist/cjs/components/SimpleModal.js +3 -2
- package/dist/cjs/components/StyledModal.js +3 -2
- package/dist/cjs/components/SubmissionInspector/BaseInformation.js +51 -24
- package/dist/cjs/components/SubmissionInspector/Button.js +2 -2
- package/dist/cjs/components/SubmissionInspector/Progress.js +6 -5
- package/dist/cjs/components/SubmissionInspector/Text.js +2 -2
- package/dist/cjs/components/TextField.js +3 -2
- package/dist/cjs/components/TextFieldContainer.js +2 -1
- package/dist/cjs/components/TextFieldError.js +2 -1
- package/dist/cjs/components/TextFieldGroupContainer.js +2 -1
- package/dist/cjs/components/Tip.js +7 -6
- package/dist/cjs/components/icons/back-arrow.js +2 -1
- package/dist/cjs/hooks/use-dropdown.js +6 -5
- package/dist/cjs/lib/authors.js +24 -15
- package/dist/cjs/lib/capabilities.js +13 -8
- package/dist/cjs/lib/comments.js +9 -5
- package/dist/cjs/lib/lw-errors-decoder.js +55 -0
- package/dist/cjs/lib/name.js +2 -1
- package/dist/es/components/AffiliationsEditor/AffiliationsEditorView.js +6 -36
- package/dist/es/components/AuthorForm/ContributorRolesSelect.js +1 -2
- package/dist/es/components/AuthorForm/index.js +0 -1
- package/dist/es/components/AuthorsContainer.js +2 -2
- package/dist/es/components/AuthorsDND/AuthorsDND.js +20 -16
- package/dist/es/components/AuthorsDND/DraggableAuthorItem.js +2 -2
- package/dist/es/components/AuthorsDND/index.js +1 -1
- package/dist/es/components/AuthorsList/AuthorsList.js +2 -2
- package/dist/es/components/Comments/CommentActions.js +1 -5
- package/dist/es/components/Comments/CommentWrapper.js +10 -9
- package/dist/es/components/FileManager/FileSectionItem/DragLayer.js +1 -1
- package/dist/es/components/FileManager/SelectDesignationActions.js +7 -8
- package/dist/es/components/PdfPreview.js +4 -4
- package/dist/es/components/SubmissionInspector/BaseInformation.js +33 -7
- package/dist/es/components/TextFieldContainer.js +1 -1
- package/dist/es/components/TextFieldGroupContainer.js +1 -1
- package/dist/es/lib/lw-errors-decoder.js +55 -0
- package/dist/types/components/AffiliationsEditor/AffiliationsEditorView.d.ts +4 -7
- package/dist/types/components/AffiliationsEditor/styles.d.ts +2 -2
- package/dist/types/components/AlertMessage.d.ts +1 -1
- package/dist/types/components/AuthorForm/index.d.ts +0 -1
- package/dist/types/components/AuthorsContainer.d.ts +1 -0
- package/dist/types/components/AuthorsDND/AuthorsDND.d.ts +2 -2
- package/dist/types/components/AuthorsDND/DraggableAuthorItem.d.ts +15 -5
- package/dist/types/components/AuthorsDND/index.d.ts +1 -1
- package/dist/types/components/AuthorsList/AuthorsList.d.ts +1 -0
- package/dist/types/components/Button.d.ts +9 -9
- package/dist/types/components/FileManager/util.d.ts +0 -1
- package/dist/types/components/Form.d.ts +1 -1
- package/dist/types/components/InspectorSection.d.ts +1 -1
- package/dist/types/components/PdfPreview.d.ts +1 -1
- package/dist/types/components/SimpleModal.d.ts +1 -1
- package/dist/types/components/SubmissionInspector/Button.d.ts +1 -1
- package/dist/types/components/icons/add-author.d.ts +0 -1
- package/dist/types/components/icons/add-icon-active.d.ts +0 -1
- package/dist/types/components/icons/add-icon-inverted.d.ts +0 -1
- package/dist/types/components/icons/back-arrow.d.ts +0 -1
- package/dist/types/components/icons/bookmark.d.ts +0 -1
- package/dist/types/components/icons/google.d.ts +0 -1
- package/dist/types/components/icons/orcid.d.ts +0 -1
- package/dist/types/components/icons/project-notification.d.ts +0 -1
- package/dist/types/components/icons/project.d.ts +0 -1
- package/dist/types/components/icons/projects-list.d.ts +0 -1
- package/dist/types/components/icons/search.d.ts +0 -1
- package/dist/types/components/icons/tick-mark.d.ts +0 -1
- package/dist/types/components/icons/user.d.ts +0 -1
- package/dist/types/lib/comments.d.ts +2 -2
- package/package.json +5 -5
- package/dist/cjs/components/AuthorForm/AffiliationsSelect.js +0 -55
- package/dist/es/components/AuthorForm/AffiliationsSelect.js +0 -49
- package/dist/types/components/AuthorForm/AffiliationsSelect.d.ts +0 -29
|
@@ -78,9 +78,10 @@ const Input = styled_components_1.default.input `
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
`;
|
|
81
|
-
|
|
81
|
+
const RadioButton = (_a) => {
|
|
82
82
|
var { checked, id, label, name } = _a, rest = __rest(_a, ["checked", "id", "label", "name"]);
|
|
83
83
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
84
84
|
react_1.default.createElement(Input, Object.assign({ checked: checked, type: "radio", name: name, id: id }, rest)),
|
|
85
85
|
react_1.default.createElement("label", { htmlFor: id }, label)));
|
|
86
86
|
};
|
|
87
|
+
exports.RadioButton = RadioButton;
|
|
@@ -8,11 +8,12 @@ require("@formatjs/intl-relativetimeformat/polyfill-locales");
|
|
|
8
8
|
const intl_utils_1 = require("@formatjs/intl-utils");
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
10
|
const react_intl_1 = require("react-intl");
|
|
11
|
-
|
|
11
|
+
const RelativeDate = ({ createdAt }) => {
|
|
12
12
|
if (!createdAt) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
|
-
const { value, unit } = intl_utils_1.selectUnit(createdAt);
|
|
15
|
+
const { value, unit } = (0, intl_utils_1.selectUnit)(createdAt);
|
|
16
16
|
return (react_1.default.createElement(react_intl_1.IntlProvider, { locale: "en" },
|
|
17
17
|
react_1.default.createElement(react_intl_1.FormattedRelativeTime, { value: value, unit: unit })));
|
|
18
18
|
};
|
|
19
|
+
exports.RelativeDate = RelativeDate;
|
|
@@ -24,7 +24,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
24
24
|
const save_icon_offline_1 = __importDefault(require("./icons/save-icon-offline"));
|
|
25
25
|
const save_icon_saved_1 = __importDefault(require("./icons/save-icon-saved"));
|
|
26
26
|
const save_icon_saving_1 = __importDefault(require("./icons/save-icon-saving"));
|
|
27
|
-
|
|
27
|
+
const SaveStatus = ({ status }) => {
|
|
28
28
|
switch (status) {
|
|
29
29
|
case 'offline':
|
|
30
30
|
return (react_1.default.createElement(Container, null,
|
|
@@ -42,6 +42,7 @@ exports.SaveStatus = ({ status }) => {
|
|
|
42
42
|
react_1.default.createElement(Text, null, "Saved")));
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
+
exports.SaveStatus = SaveStatus;
|
|
45
46
|
const Container = styled_components_1.default.div `
|
|
46
47
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
47
48
|
display: inline-flex;
|
|
@@ -37,7 +37,7 @@ exports.ModalHeader = styled_components_1.default.div `
|
|
|
37
37
|
top: 0;
|
|
38
38
|
z-index: 1;
|
|
39
39
|
`;
|
|
40
|
-
exports.CloseButton = styled_components_1.default(Button_1.RoundIconButton) `
|
|
40
|
+
exports.CloseButton = (0, styled_components_1.default)(Button_1.RoundIconButton) `
|
|
41
41
|
box-shadow: none;
|
|
42
42
|
text-indent: -99999px;
|
|
43
43
|
|
|
@@ -61,7 +61,7 @@ exports.CloseButton = styled_components_1.default(Button_1.RoundIconButton) `
|
|
|
61
61
|
exports.ModalMain = styled_components_1.default.div `
|
|
62
62
|
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
63
63
|
`;
|
|
64
|
-
|
|
64
|
+
const SimpleModal = ({ children, closeWithOverlay, handleClose, width = 'auto', }) => (react_1.default.createElement(react_modal_1.default, { isOpen: true, onRequestClose: handleClose, shouldCloseOnOverlayClick: closeWithOverlay, appElement: document.getElementById('root'), style: {
|
|
65
65
|
overlay: {
|
|
66
66
|
alignItems: 'center',
|
|
67
67
|
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
@@ -92,3 +92,4 @@ exports.SimpleModal = ({ children, closeWithOverlay, handleClose, width = 'auto'
|
|
|
92
92
|
react_1.default.createElement(exports.ModalHeader, null,
|
|
93
93
|
react_1.default.createElement(exports.CloseButton, { onClick: handleClose })),
|
|
94
94
|
react_1.default.createElement(exports.ModalMain, null, children))));
|
|
95
|
+
exports.SimpleModal = SimpleModal;
|
|
@@ -36,11 +36,12 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
36
36
|
const totalTransitionTime = 800;
|
|
37
37
|
const transitionDelay = 300;
|
|
38
38
|
const delayedTransitionTime = totalTransitionTime - transitionDelay;
|
|
39
|
-
|
|
39
|
+
const ReactModalAdapter = (_a) => {
|
|
40
40
|
var { className, modalClassName } = _a, props = __rest(_a, ["className", "modalClassName"]);
|
|
41
41
|
return (react_1.default.createElement(react_modal_1.default, Object.assign({ className: modalClassName, portalClassName: className, closeTimeoutMS: totalTransitionTime, appElement: document.getElementById('root') }, props)));
|
|
42
42
|
};
|
|
43
|
-
exports.
|
|
43
|
+
exports.ReactModalAdapter = ReactModalAdapter;
|
|
44
|
+
exports.StyledModal = (0, styled_components_1.default)(exports.ReactModalAdapter).attrs({
|
|
44
45
|
closeTimeoutMS: totalTransitionTime,
|
|
45
46
|
overlayClassName: {
|
|
46
47
|
base: 'Overlay',
|
|
@@ -44,7 +44,8 @@ const AttentionRed_1 = __importDefault(require("@manuscripts/assets/react/Attent
|
|
|
44
44
|
const date_fns_1 = require("date-fns");
|
|
45
45
|
const react_1 = __importStar(require("react"));
|
|
46
46
|
const react_modern_calendar_datepicker_1 = __importDefault(require("react-modern-calendar-datepicker"));
|
|
47
|
-
const
|
|
47
|
+
const react_tooltip_1 = __importDefault(require("react-tooltip"));
|
|
48
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
48
49
|
const Button_1 = require("../Button");
|
|
49
50
|
const Dialog_1 = require("../Dialog");
|
|
50
51
|
const types_1 = require("./types");
|
|
@@ -55,17 +56,17 @@ const criticalityPill = {
|
|
|
55
56
|
[types_1.SubmissionCriticality.ON_SCHEDULE]: { label: 'At risk', color: '#FFE0B2' },
|
|
56
57
|
};
|
|
57
58
|
const CalenderDatePicker = ({ submission, handleDateChange, Button }) => {
|
|
58
|
-
const [dueDate, setDueDate] = react_1.useState(undefined);
|
|
59
|
-
const [toggleDialog, setToggleDialog] = react_1.useState(false);
|
|
60
|
-
const onConfirmClick = react_1.useCallback(() => {
|
|
59
|
+
const [dueDate, setDueDate] = (0, react_1.useState)(undefined);
|
|
60
|
+
const [toggleDialog, setToggleDialog] = (0, react_1.useState)(false);
|
|
61
|
+
const onConfirmClick = (0, react_1.useCallback)(() => {
|
|
61
62
|
handleDateChange(dueDate);
|
|
62
63
|
setToggleDialog(false);
|
|
63
64
|
}, [dueDate, setToggleDialog, handleDateChange]);
|
|
64
|
-
const formattedDueDate = react_1.useMemo(() => dueDate &&
|
|
65
|
-
date_fns_1.format(new Date(dueDate.year, dueDate.month, dueDate.day), dateFormat), [dueDate]);
|
|
66
|
-
const formattedPotentialDueDate = react_1.useMemo(() => dueDate &&
|
|
67
|
-
date_fns_1.format(potentialDueDate(submission.currentStep.dueDate, dueDate, submission.dueDate), dateFormat), [submission.dueDate, submission.currentStep.dueDate, dueDate]);
|
|
68
|
-
const onDatePickerChange = react_1.useCallback((date) => {
|
|
65
|
+
const formattedDueDate = (0, react_1.useMemo)(() => dueDate &&
|
|
66
|
+
(0, date_fns_1.format)(new Date(dueDate.year, dueDate.month, dueDate.day), dateFormat), [dueDate]);
|
|
67
|
+
const formattedPotentialDueDate = (0, react_1.useMemo)(() => dueDate &&
|
|
68
|
+
(0, date_fns_1.format)(potentialDueDate(submission.currentStep.dueDate, dueDate, submission.dueDate), dateFormat), [submission.dueDate, submission.currentStep.dueDate, dueDate]);
|
|
69
|
+
const onDatePickerChange = (0, react_1.useCallback)((date) => {
|
|
69
70
|
setDueDate(date);
|
|
70
71
|
setToggleDialog(true);
|
|
71
72
|
const button = document.querySelector('.DatePicker button');
|
|
@@ -78,7 +79,7 @@ const CalenderDatePicker = ({ submission, handleDateChange, Button }) => {
|
|
|
78
79
|
react_1.default.createElement(UpdatedDueDate, null, formattedDueDate),
|
|
79
80
|
react_1.default.createElement(DueDateMessage, null, "By rescheduling the task, the publication expected date of the article will be modified accordingly:"),
|
|
80
81
|
react_1.default.createElement(Value, null,
|
|
81
|
-
react_1.default.createElement(StrikeDueDate, { as: 'del' }, date_fns_1.format(submission.dueDate, 'd MMM, EEEE')),
|
|
82
|
+
react_1.default.createElement(StrikeDueDate, { as: 'del' }, (0, date_fns_1.format)(submission.dueDate, 'd MMM, EEEE')),
|
|
82
83
|
formattedPotentialDueDate)), actions: {
|
|
83
84
|
primary: {
|
|
84
85
|
action: onConfirmClick,
|
|
@@ -90,12 +91,16 @@ const CalenderDatePicker = ({ submission, handleDateChange, Button }) => {
|
|
|
90
91
|
},
|
|
91
92
|
} })));
|
|
92
93
|
};
|
|
93
|
-
|
|
94
|
-
const Button = ({ ref }) => (react_1.default.createElement(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
const BaseInformation = ({ submission, handleDateChange, userRole }) => {
|
|
95
|
+
const Button = ({ ref }) => (react_1.default.createElement(Container, null,
|
|
96
|
+
react_1.default.createElement("div", { "data-tip": true, "data-for": submission.id },
|
|
97
|
+
react_1.default.createElement(DateButton, { ref: ref, criticality: submission.currentStep.criticality, disabled: userRole !== 'pe' },
|
|
98
|
+
(0, date_fns_1.format)(submission.currentStep.dueDate, 'd MMM, EEEE'),
|
|
99
|
+
submission.currentStep.criticality ===
|
|
100
|
+
types_1.SubmissionCriticality.DUE_TODAY && react_1.default.createElement(AttentionOrange_1.default, null),
|
|
101
|
+
submission.currentStep.criticality ===
|
|
102
|
+
types_1.SubmissionCriticality.OVERDUE && react_1.default.createElement(AttentionRed_1.default, null))),
|
|
103
|
+
react_1.default.createElement(react_tooltip_1.default, { id: submission.id, place: "bottom", effect: "solid", offset: { top: 10 }, className: "tooltip", disable: userRole == 'pe' }, "No permissions to reschedule")));
|
|
99
104
|
return (react_1.default.createElement(Grid, null,
|
|
100
105
|
react_1.default.createElement(DateLabel, null, "Due date"),
|
|
101
106
|
react_1.default.createElement(Value, null,
|
|
@@ -117,21 +122,28 @@ exports.BaseInformation = ({ submission, handleDateChange, userRole }) => {
|
|
|
117
122
|
react_1.default.createElement(Value, null, submission.journal.productionEditor.displayName),
|
|
118
123
|
react_1.default.createElement(Label, null, "Publication Due:"),
|
|
119
124
|
react_1.default.createElement(Value, null,
|
|
120
|
-
date_fns_1.format(submission.dueDate, 'd MMM, EEEE'),
|
|
125
|
+
(0, date_fns_1.format)(submission.dueDate, 'd MMM, EEEE'),
|
|
121
126
|
submission.isAtRisk && (react_1.default.createElement(Pill, { background: criticalityPill[submission.criticality].color }, criticalityPill[submission.criticality].label)))));
|
|
122
127
|
};
|
|
128
|
+
exports.BaseInformation = BaseInformation;
|
|
123
129
|
const getDay = (date) => ({
|
|
124
130
|
year: date.getFullYear(),
|
|
125
131
|
month: date.getMonth() + 1,
|
|
126
132
|
day: date.getDate(),
|
|
127
133
|
});
|
|
128
134
|
const potentialDueDate = (stepDueDate, dueDate, submissionDueDate) => {
|
|
129
|
-
const duration = date_fns_1.intervalToDuration({
|
|
135
|
+
const duration = (0, date_fns_1.intervalToDuration)({
|
|
130
136
|
start: stepDueDate,
|
|
131
137
|
end: new Date(`${dueDate.year}-${dueDate.month < 10 ? `0${dueDate.month}` : dueDate.month}-${dueDate.day < 10 ? `0${dueDate.day}` : dueDate.day}`),
|
|
132
138
|
});
|
|
133
|
-
return date_fns_1.add(submissionDueDate, duration);
|
|
139
|
+
return (0, date_fns_1.add)(submissionDueDate, duration);
|
|
134
140
|
};
|
|
141
|
+
const Container = styled_components_1.default.div `
|
|
142
|
+
.tooltip {
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
padding: ${(props) => props.theme.grid.unit * 2}px;
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
135
147
|
const Grid = styled_components_1.default.div `
|
|
136
148
|
display: grid;
|
|
137
149
|
grid-template-columns: 30% auto;
|
|
@@ -151,10 +163,14 @@ const Label = styled_components_1.default.div `
|
|
|
151
163
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
152
164
|
line-height: 1;
|
|
153
165
|
`;
|
|
154
|
-
const DateLabel = styled_components_1.default(Label) `
|
|
166
|
+
const DateLabel = (0, styled_components_1.default)(Label) `
|
|
155
167
|
color: ${(props) => props.theme.colors.text.primary};
|
|
156
168
|
`;
|
|
157
|
-
const
|
|
169
|
+
const disabledStyle = (0, styled_components_1.css) `
|
|
170
|
+
background-color: ${(props) => props.theme.colors.background.secondary} !important;
|
|
171
|
+
color: ${(props) => props.theme.colors.text.secondary} !important;
|
|
172
|
+
`;
|
|
173
|
+
const DateButton = (0, styled_components_1.default)(Button_1.IconTextButton) `
|
|
158
174
|
border: 1px solid ${(props) => props.theme.colors.border.secondary}!important;
|
|
159
175
|
box-sizing: border-box;
|
|
160
176
|
border-radius: 6px;
|
|
@@ -166,9 +182,20 @@ const DateButton = styled_components_1.default(Button_1.IconTextButton) `
|
|
|
166
182
|
width: 100%;
|
|
167
183
|
height: ${(props) => props.theme.grid.unit * 7.5}px;
|
|
168
184
|
justify-content: space-between;
|
|
169
|
-
background: transparent !important;
|
|
170
185
|
padding: 0 ${(props) => props.theme.grid.unit * 2}px 0
|
|
171
186
|
${(props) => props.theme.grid.unit * 4}px;
|
|
187
|
+
|
|
188
|
+
${(props) => props.disabled && disabledStyle}
|
|
189
|
+
|
|
190
|
+
&:focus {
|
|
191
|
+
border-color: ${(props) => props.theme.colors.border.field.hover}!important;
|
|
192
|
+
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&:hover {
|
|
196
|
+
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
197
|
+
}
|
|
198
|
+
|
|
172
199
|
svg {
|
|
173
200
|
margin-right: 0;
|
|
174
201
|
}
|
|
@@ -227,11 +254,11 @@ const UpdatedDueDate = styled_components_1.default.div `
|
|
|
227
254
|
padding: ${(props) => props.theme.grid.unit}px
|
|
228
255
|
${(props) => props.theme.grid.unit * 2}px; ;
|
|
229
256
|
`;
|
|
230
|
-
const DueDateMessage = styled_components_1.default(Dialog_1.MessageContainer) `
|
|
257
|
+
const DueDateMessage = (0, styled_components_1.default)(Dialog_1.MessageContainer) `
|
|
231
258
|
min-height: min-content;
|
|
232
259
|
margin: ${(props) => props.theme.grid.unit * 6}px 0 0 0;
|
|
233
260
|
`;
|
|
234
|
-
const StrikeDueDate = styled_components_1.default(Dialog_1.MessageContainer) `
|
|
261
|
+
const StrikeDueDate = (0, styled_components_1.default)(Dialog_1.MessageContainer) `
|
|
235
262
|
margin: 0;
|
|
236
263
|
min-height: min-content;
|
|
237
264
|
padding-right: ${(props) => props.theme.grid.unit}px;
|
|
@@ -21,11 +21,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.ZoomButtonGroup = exports.ZoomButton = void 0;
|
|
22
22
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
23
23
|
const Button_1 = require("../Button");
|
|
24
|
-
exports.ZoomButton = styled_components_1.default(Button_1.IconButton) `
|
|
24
|
+
exports.ZoomButton = (0, styled_components_1.default)(Button_1.IconButton) `
|
|
25
25
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
|
|
26
26
|
border-radius: ${(props) => props.theme.grid.unit * 8}px;
|
|
27
27
|
`;
|
|
28
|
-
exports.ZoomButtonGroup = styled_components_1.default(Button_1.ButtonGroup) `
|
|
28
|
+
exports.ZoomButtonGroup = (0, styled_components_1.default)(Button_1.ButtonGroup) `
|
|
29
29
|
width: ${(props) => props.theme.grid.unit * 22}px;
|
|
30
30
|
justify-content: space-between;
|
|
31
31
|
`;
|
|
@@ -30,7 +30,7 @@ const CriticalityLabel = {
|
|
|
30
30
|
DUE_TODAY: { label: 'Due today', color: '#353535' },
|
|
31
31
|
OVERDUE: { label: 'Overdue', color: '#F35143' },
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
const Progress = ({ submission }) => {
|
|
34
34
|
const { currentStep, nextStep, previousStep } = submission;
|
|
35
35
|
return (react_1.default.createElement(Grid, null,
|
|
36
36
|
previousStep && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -42,7 +42,7 @@ exports.Progress = ({ submission }) => {
|
|
|
42
42
|
react_1.default.createElement(Text_1.SecondarySmallText, null,
|
|
43
43
|
"Actor: ",
|
|
44
44
|
previousStep.type.role.label),
|
|
45
|
-
react_1.default.createElement(Text_1.SecondarySmallText, null, date_fns_1.format(previousStep.dueDate, 'd MMMM, EEEE'))))),
|
|
45
|
+
react_1.default.createElement(Text_1.SecondarySmallText, null, (0, date_fns_1.format)(previousStep.dueDate, 'd MMMM, EEEE'))))),
|
|
46
46
|
react_1.default.createElement(TaskStatus, null,
|
|
47
47
|
react_1.default.createElement(icons_1.TaskStepCurrentIcon, { color: CriticalityLabel[currentStep.criticality].color })),
|
|
48
48
|
react_1.default.createElement(TaskContainer, null,
|
|
@@ -51,7 +51,7 @@ exports.Progress = ({ submission }) => {
|
|
|
51
51
|
react_1.default.createElement(Text_1.SecondarySmallText, null,
|
|
52
52
|
"Actor: ",
|
|
53
53
|
currentStep.type.role.label),
|
|
54
|
-
react_1.default.createElement(Text_1.PrimarySmallText, null, date_fns_1.format(currentStep.dueDate, 'd MMMM, EEEE')),
|
|
54
|
+
react_1.default.createElement(Text_1.PrimarySmallText, null, (0, date_fns_1.format)(currentStep.dueDate, 'd MMMM, EEEE')),
|
|
55
55
|
!(currentStep.criticality === types_1.SubmissionCriticality.ON_SCHEDULE) && (react_1.default.createElement(CriticalityText, { color: CriticalityLabel[currentStep.criticality].color }, CriticalityLabel[currentStep.criticality].label))),
|
|
56
56
|
nextStep && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
57
57
|
react_1.default.createElement(TaskStatus, null,
|
|
@@ -62,8 +62,9 @@ exports.Progress = ({ submission }) => {
|
|
|
62
62
|
react_1.default.createElement(Text_1.SecondarySmallText, null,
|
|
63
63
|
"Actor: ",
|
|
64
64
|
nextStep.type.role.label),
|
|
65
|
-
react_1.default.createElement(Text_1.PrimarySmallText, null, date_fns_1.format(nextStep.dueDate, 'd MMMM, EEEE')))))));
|
|
65
|
+
react_1.default.createElement(Text_1.PrimarySmallText, null, (0, date_fns_1.format)(nextStep.dueDate, 'd MMMM, EEEE')))))));
|
|
66
66
|
};
|
|
67
|
+
exports.Progress = Progress;
|
|
67
68
|
const Grid = styled_components_1.default.div `
|
|
68
69
|
display: grid;
|
|
69
70
|
grid-template-columns: max-content auto;
|
|
@@ -80,6 +81,6 @@ const TaskContainer = styled_components_1.default.div `
|
|
|
80
81
|
grid-column: 2;
|
|
81
82
|
margin-bottom: 8px;
|
|
82
83
|
`;
|
|
83
|
-
const CriticalityText = styled_components_1.default(Text_1.PrimarySmallText) `
|
|
84
|
+
const CriticalityText = (0, styled_components_1.default)(Text_1.PrimarySmallText) `
|
|
84
85
|
color: ${(props) => props.color};
|
|
85
86
|
`;
|
|
@@ -28,7 +28,7 @@ exports.PrimaryBoldHeading = styled_components_1.default.div `
|
|
|
28
28
|
letter-spacing: -0.369231px;
|
|
29
29
|
color: ${(props) => props.theme.colors.text.primary};
|
|
30
30
|
`;
|
|
31
|
-
exports.SecondaryBoldHeading = styled_components_1.default(exports.PrimaryBoldHeading) `
|
|
31
|
+
exports.SecondaryBoldHeading = (0, styled_components_1.default)(exports.PrimaryBoldHeading) `
|
|
32
32
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
33
33
|
`;
|
|
34
34
|
exports.PrimarySmallText = styled_components_1.default.div `
|
|
@@ -38,6 +38,6 @@ exports.PrimarySmallText = styled_components_1.default.div `
|
|
|
38
38
|
line-height: ${(props) => props.theme.font.lineHeight.normal};
|
|
39
39
|
color: ${(props) => props.theme.colors.text.primary};
|
|
40
40
|
`;
|
|
41
|
-
exports.SecondarySmallText = styled_components_1.default(exports.PrimarySmallText) `
|
|
41
|
+
exports.SecondarySmallText = (0, styled_components_1.default)(exports.PrimarySmallText) `
|
|
42
42
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
43
43
|
`;
|
|
@@ -40,7 +40,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
exports.TextFieldWrapper = exports.TextFieldLabel = exports.TextFieldGroup = exports.TextArea = exports.TextField = void 0;
|
|
41
41
|
const react_1 = __importDefault(require("react"));
|
|
42
42
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
43
|
-
const commonStyles = styled_components_1.css `
|
|
43
|
+
const commonStyles = (0, styled_components_1.css) `
|
|
44
44
|
border: 1px solid
|
|
45
45
|
${(props) => props.error
|
|
46
46
|
? props.theme.colors.border.error
|
|
@@ -131,8 +131,9 @@ const IconWrapper = styled_components_1.default.div `
|
|
|
131
131
|
flex-direction: column;
|
|
132
132
|
justify-content: space-around;
|
|
133
133
|
`;
|
|
134
|
-
|
|
134
|
+
const TextFieldWrapper = ({ leftIcon, children }) => {
|
|
135
135
|
return (react_1.default.createElement(TextFieldWrapperStyles, null,
|
|
136
136
|
children,
|
|
137
137
|
react_1.default.createElement(IconWrapper, null, leftIcon)));
|
|
138
138
|
};
|
|
139
|
+
exports.TextFieldWrapper = TextFieldWrapper;
|
|
@@ -22,7 +22,7 @@ exports.TextFieldContainer = void 0;
|
|
|
22
22
|
const react_1 = __importDefault(require("react"));
|
|
23
23
|
const TextField_1 = require("./TextField");
|
|
24
24
|
const TextFieldError_1 = require("./TextFieldError");
|
|
25
|
-
|
|
25
|
+
const TextFieldContainer = ({ label, error, children }) => {
|
|
26
26
|
const childrenWithErrorProp = react_1.default.Children.map(children, (child) => react_1.default.cloneElement(child, { error }));
|
|
27
27
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
28
28
|
label ? (react_1.default.createElement(TextField_1.TextFieldLabel, null,
|
|
@@ -32,3 +32,4 @@ exports.TextFieldContainer = ({ label, error, children, }) => {
|
|
|
32
32
|
error && (react_1.default.createElement(TextFieldError_1.TextFieldError, null,
|
|
33
33
|
react_1.default.createElement(TextFieldError_1.TextFieldErrorItem, null, error)))));
|
|
34
34
|
};
|
|
35
|
+
exports.TextFieldContainer = TextFieldContainer;
|
|
@@ -45,6 +45,7 @@ const Container = styled_components_1.default.div `
|
|
|
45
45
|
exports.TextFieldErrorItem = styled_components_1.default.div `
|
|
46
46
|
margin: 8px;
|
|
47
47
|
`;
|
|
48
|
-
|
|
48
|
+
const TextFieldError = ({ children }) => (react_1.default.createElement(Container, null,
|
|
49
49
|
react_1.default.createElement(Arrow, null),
|
|
50
50
|
children));
|
|
51
|
+
exports.TextFieldError = TextFieldError;
|
|
@@ -23,8 +23,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
23
23
|
const TextField_1 = require("./TextField");
|
|
24
24
|
const TextFieldError_1 = require("./TextFieldError");
|
|
25
25
|
const hasErrors = (errors) => Object.values(errors).some((error) => !!error);
|
|
26
|
-
|
|
26
|
+
const TextFieldGroupContainer = ({ children, errors }) => {
|
|
27
27
|
return (react_1.default.createElement(TextField_1.TextFieldGroup, null,
|
|
28
28
|
children,
|
|
29
29
|
errors && hasErrors(errors) && (react_1.default.createElement(TextFieldError_1.TextFieldError, null, Object.entries(errors).map(([key, error]) => error && (react_1.default.createElement(TextFieldError_1.TextFieldErrorItem, { id: `${key}-text-field-error`, key: key }, error)))))));
|
|
30
30
|
};
|
|
31
|
+
exports.TextFieldGroupContainer = TextFieldGroupContainer;
|
|
@@ -47,14 +47,14 @@ const TipContainer = styled_components_1.default.div `
|
|
|
47
47
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
48
48
|
justify-content: center;
|
|
49
49
|
`;
|
|
50
|
-
|
|
51
|
-
const [tooltip, setTooltip] = react_1.useState();
|
|
52
|
-
react_1.useEffect(() => () => {
|
|
50
|
+
const Tip = ({ children, placement, title, }) => {
|
|
51
|
+
const [tooltip, setTooltip] = (0, react_1.useState)();
|
|
52
|
+
(0, react_1.useEffect)(() => () => {
|
|
53
53
|
if (tooltip) {
|
|
54
54
|
tooltip.dispose();
|
|
55
55
|
}
|
|
56
56
|
}, [tooltip]);
|
|
57
|
-
const createTooltip = react_1.useCallback((node) => {
|
|
57
|
+
const createTooltip = (0, react_1.useCallback)((node) => {
|
|
58
58
|
if (node) {
|
|
59
59
|
setTooltip(new tooltip_js_1.default(node, {
|
|
60
60
|
placement,
|
|
@@ -64,15 +64,16 @@ exports.Tip = ({ children, placement, title, }) => {
|
|
|
64
64
|
}));
|
|
65
65
|
}
|
|
66
66
|
}, [setTooltip, placement, title]);
|
|
67
|
-
const show = react_1.useCallback(() => {
|
|
67
|
+
const show = (0, react_1.useCallback)(() => {
|
|
68
68
|
if (tooltip) {
|
|
69
69
|
tooltip.show();
|
|
70
70
|
}
|
|
71
71
|
}, [tooltip]);
|
|
72
|
-
const hide = react_1.useCallback(() => {
|
|
72
|
+
const hide = (0, react_1.useCallback)(() => {
|
|
73
73
|
if (tooltip) {
|
|
74
74
|
tooltip.hide();
|
|
75
75
|
}
|
|
76
76
|
}, [tooltip]);
|
|
77
77
|
return (react_1.default.createElement(TipContainer, { ref: createTooltip, onMouseEnter: show, onMouseLeave: hide }, children));
|
|
78
78
|
};
|
|
79
|
+
exports.Tip = Tip;
|
|
@@ -20,6 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.BackArrow = void 0;
|
|
22
22
|
const react_1 = __importDefault(require("react"));
|
|
23
|
-
|
|
23
|
+
const BackArrow = (props) => (react_1.default.createElement("svg", Object.assign({ viewBox: "0 0 408 408", width: props.size || 408, height: props.size || 408 }, props),
|
|
24
24
|
react_1.default.createElement("path", { d: "M408 178.5H96.9L239.7 35.7 204 0 0 204l204 204 35.7-35.7L96.9 229.5H408v-51z", fill: props.color || '#000', fillRule: "evenodd" })));
|
|
25
|
+
exports.BackArrow = BackArrow;
|
|
25
26
|
exports.default = exports.BackArrow;
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.useDropdown = void 0;
|
|
19
19
|
const react_1 = require("react");
|
|
20
|
-
|
|
21
|
-
const [isOpen, setOpen] = react_1.useState(false);
|
|
22
|
-
const toggleOpen = react_1.useCallback(() => {
|
|
20
|
+
const useDropdown = () => {
|
|
21
|
+
const [isOpen, setOpen] = (0, react_1.useState)(false);
|
|
22
|
+
const toggleOpen = (0, react_1.useCallback)(() => {
|
|
23
23
|
setOpen((open) => !open);
|
|
24
24
|
}, []);
|
|
25
|
-
const wrapperRef = react_1.useRef(null);
|
|
26
|
-
react_1.useEffect(() => {
|
|
25
|
+
const wrapperRef = (0, react_1.useRef)(null);
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
27
27
|
const handleClickOutside = (event) => {
|
|
28
28
|
if (wrapperRef.current &&
|
|
29
29
|
!wrapperRef.current.contains(event.target)) {
|
|
@@ -41,3 +41,4 @@ exports.useDropdown = () => {
|
|
|
41
41
|
wrapperRef,
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
+
exports.useDropdown = useDropdown;
|
package/dist/cjs/lib/authors.js
CHANGED
|
@@ -26,19 +26,21 @@ const getModelsByType = (modelMap, objectType) => {
|
|
|
26
26
|
}
|
|
27
27
|
return output;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
const buildSortedAuthors = (modelMap) => {
|
|
30
30
|
return getModelsByType(modelMap, manuscripts_json_schema_1.ObjectTypes.Contributor)
|
|
31
31
|
.filter((item) => item.role === 'author')
|
|
32
32
|
.sort((a, b) => Number(a.priority) - Number(b.priority));
|
|
33
33
|
};
|
|
34
|
-
exports.
|
|
34
|
+
exports.buildSortedAuthors = buildSortedAuthors;
|
|
35
|
+
const buildAuthorPriority = (authors) => {
|
|
35
36
|
if (!authors.length) {
|
|
36
37
|
return 0;
|
|
37
38
|
}
|
|
38
39
|
const priorities = authors.map((author) => Number(author.priority));
|
|
39
40
|
return Math.max(...priorities) + 1;
|
|
40
41
|
};
|
|
41
|
-
exports.
|
|
42
|
+
exports.buildAuthorPriority = buildAuthorPriority;
|
|
43
|
+
const buildAffiliationIDs = (authors) => {
|
|
42
44
|
const ids = [];
|
|
43
45
|
authors.forEach((author) => {
|
|
44
46
|
if (author.affiliations) {
|
|
@@ -49,7 +51,8 @@ exports.buildAffiliationIDs = (authors) => {
|
|
|
49
51
|
});
|
|
50
52
|
return ids.filter((value, index) => ids.indexOf(value) === index);
|
|
51
53
|
};
|
|
52
|
-
exports.
|
|
54
|
+
exports.buildAffiliationIDs = buildAffiliationIDs;
|
|
55
|
+
const buildAuthorAffiliations = (authors, affiliations, uniqueAffiliationIDs) => {
|
|
53
56
|
const items = new Map();
|
|
54
57
|
authors.forEach((author) => {
|
|
55
58
|
items.set(author._id, (author.affiliations || []).map((id) => {
|
|
@@ -61,41 +64,47 @@ exports.buildAuthorAffiliations = (authors, affiliations, uniqueAffiliationIDs)
|
|
|
61
64
|
});
|
|
62
65
|
return items;
|
|
63
66
|
};
|
|
64
|
-
exports.
|
|
67
|
+
exports.buildAuthorAffiliations = buildAuthorAffiliations;
|
|
68
|
+
const buildAffiliationsMap = (affiliationIDs, modelMap) => new Map(affiliationIDs.map((id) => [
|
|
65
69
|
id,
|
|
66
70
|
modelMap.get(id),
|
|
67
71
|
]));
|
|
68
|
-
exports.
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const
|
|
72
|
+
exports.buildAffiliationsMap = buildAffiliationsMap;
|
|
73
|
+
const buildAuthorsAndAffiliations = (modelMap) => {
|
|
74
|
+
const authors = (0, exports.buildSortedAuthors)(modelMap);
|
|
75
|
+
const affiliationIDs = (0, exports.buildAffiliationIDs)(authors);
|
|
76
|
+
const affiliations = (0, exports.buildAffiliationsMap)(affiliationIDs, modelMap);
|
|
77
|
+
const authorAffiliations = (0, exports.buildAuthorAffiliations)(authors, affiliations, affiliationIDs);
|
|
73
78
|
return {
|
|
74
79
|
affiliations,
|
|
75
80
|
authors,
|
|
76
81
|
authorAffiliations,
|
|
77
82
|
};
|
|
78
83
|
};
|
|
79
|
-
exports.
|
|
84
|
+
exports.buildAuthorsAndAffiliations = buildAuthorsAndAffiliations;
|
|
85
|
+
const isJointFirstAuthor = (authors, index) => {
|
|
80
86
|
const author = index === 0 ? authors[index] : authors[index - 1];
|
|
81
87
|
return Boolean(author.isJointContributor);
|
|
82
88
|
};
|
|
83
|
-
exports.
|
|
89
|
+
exports.isJointFirstAuthor = isJointFirstAuthor;
|
|
90
|
+
const affiliationLabel = (affiliation) => {
|
|
84
91
|
const { department, institution = '' } = affiliation;
|
|
85
92
|
if (!institution) {
|
|
86
93
|
return '(unknown institution)';
|
|
87
94
|
}
|
|
88
95
|
return department ? `${institution} (${department})`.trim() : institution;
|
|
89
96
|
};
|
|
90
|
-
exports.
|
|
97
|
+
exports.affiliationLabel = affiliationLabel;
|
|
98
|
+
const affiliationsOptions = (affiliations, authorAffiliations) => {
|
|
91
99
|
if (!authorAffiliations) {
|
|
92
|
-
return exports.affiliationsOptions(affiliations, []);
|
|
100
|
+
return (0, exports.affiliationsOptions)(affiliations, []);
|
|
93
101
|
}
|
|
94
102
|
const authorAffiliationsIds = new Set(authorAffiliations.map((authorAffiliation) => authorAffiliation.data._id));
|
|
95
103
|
return Array.from(affiliations.values())
|
|
96
104
|
.filter((affiliation) => !authorAffiliationsIds.has(affiliation._id))
|
|
97
105
|
.map((affiliation) => ({
|
|
98
106
|
value: affiliation._id,
|
|
99
|
-
label: exports.affiliationLabel(affiliation) || '',
|
|
107
|
+
label: (0, exports.affiliationLabel)(affiliation) || '',
|
|
100
108
|
}));
|
|
101
109
|
};
|
|
110
|
+
exports.affiliationsOptions = affiliationsOptions;
|
|
@@ -13,7 +13,7 @@ var A;
|
|
|
13
13
|
A["addNote"] = "add-note";
|
|
14
14
|
A["setMainManuscript"] = "set-main-manuscript";
|
|
15
15
|
})(A || (A = {}));
|
|
16
|
-
|
|
16
|
+
const getLWCapabilities = (project, profile, lwRole, actions) => {
|
|
17
17
|
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))); };
|
|
18
18
|
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))); };
|
|
19
19
|
const isWriter = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.writers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
@@ -54,23 +54,28 @@ exports.getLWCapabilities = (project, profile, lwRole, actions) => {
|
|
|
54
54
|
accessEditor: true,
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
exports.
|
|
58
|
-
|
|
57
|
+
exports.getLWCapabilities = getLWCapabilities;
|
|
58
|
+
const getAllPermitted = () => {
|
|
59
|
+
const capabilities = (0, exports.getLWCapabilities)();
|
|
59
60
|
const allAllowed = Object.keys(capabilities).reduce((caps, item) => {
|
|
60
61
|
caps[item] = true;
|
|
61
62
|
return caps;
|
|
62
63
|
}, {});
|
|
63
64
|
return allAllowed;
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
+
exports.getAllPermitted = getAllPermitted;
|
|
67
|
+
const CapabilitiesContext = react_1.default.createContext((0, exports.getLWCapabilities)());
|
|
66
68
|
CapabilitiesContext.displayName = 'CapabilitiesContext';
|
|
67
|
-
|
|
69
|
+
const usePermissions = () => {
|
|
68
70
|
return react_1.default.useContext(CapabilitiesContext);
|
|
69
71
|
};
|
|
70
|
-
exports.
|
|
71
|
-
|
|
72
|
+
exports.usePermissions = usePermissions;
|
|
73
|
+
const useCalcPermission = ({ project, profile, lwRole, permittedActions, }) => {
|
|
74
|
+
return (0, exports.getLWCapabilities)(project, profile, lwRole, permittedActions);
|
|
72
75
|
};
|
|
73
|
-
exports.
|
|
76
|
+
exports.useCalcPermission = useCalcPermission;
|
|
77
|
+
const CapabilitiesProvider = (props) => {
|
|
74
78
|
const { can } = props;
|
|
75
79
|
return (react_1.default.createElement(CapabilitiesContext.Provider, { value: can }, props === null || props === void 0 ? void 0 : props.children));
|
|
76
80
|
};
|
|
81
|
+
exports.CapabilitiesProvider = CapabilitiesProvider;
|
package/dist/cjs/lib/comments.js
CHANGED
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.buildName = exports.buildNoteTree = exports.buildCommentTree = exports.isSavedComment = void 0;
|
|
19
|
-
|
|
19
|
+
const isSavedComment = (comment) => {
|
|
20
20
|
return !!comment.createdAt;
|
|
21
21
|
};
|
|
22
|
+
exports.isSavedComment = isSavedComment;
|
|
22
23
|
const oldestFirst = (a, b) => Number(a.createdAt) - Number(b.createdAt);
|
|
23
24
|
const buildCommentsMap = (comments) => {
|
|
24
25
|
const map = new Map();
|
|
@@ -84,17 +85,20 @@ const buildNotesTreeMap = (targetsMap) => {
|
|
|
84
85
|
}
|
|
85
86
|
return map;
|
|
86
87
|
};
|
|
87
|
-
|
|
88
|
+
const buildCommentTree = (doc, comments, newComment) => {
|
|
88
89
|
if (newComment) {
|
|
89
|
-
return exports.buildCommentTree(doc, [...comments, newComment]);
|
|
90
|
+
return (0, exports.buildCommentTree)(doc, [...comments, newComment]);
|
|
90
91
|
}
|
|
91
92
|
const commentsMap = buildCommentsMap(comments);
|
|
92
93
|
const targetsMap = buildTargetsMap(commentsMap);
|
|
93
94
|
return buildCommentsTreeMap(doc, targetsMap);
|
|
94
95
|
};
|
|
95
|
-
exports.
|
|
96
|
+
exports.buildCommentTree = buildCommentTree;
|
|
97
|
+
const buildNoteTree = (comments) => {
|
|
96
98
|
const commentsMap = buildCommentsMap(comments);
|
|
97
99
|
const targetsMap = buildTargetsMap(commentsMap);
|
|
98
100
|
return buildNotesTreeMap(targetsMap);
|
|
99
101
|
};
|
|
100
|
-
exports.
|
|
102
|
+
exports.buildNoteTree = buildNoteTree;
|
|
103
|
+
const buildName = (name) => [name.given, name.family].filter((item) => item).join(' ');
|
|
104
|
+
exports.buildName = buildName;
|