@manuscripts/style-guide 1.7.10-LEAN-3301 → 1.7.10-LEAN-3415-2
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 +62 -0
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorItem.js +176 -0
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorProfile.js +62 -0
- package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorView.js +80 -0
- package/dist/cjs/components/AffiliationsEditor/index.js +25 -0
- package/dist/cjs/components/AffiliationsEditor/styles.js +56 -0
- package/dist/cjs/components/AuthorForm/AuthorForm.js +99 -0
- package/dist/cjs/components/AuthorForm/AuthorFormComponents.js +63 -0
- package/dist/cjs/components/AuthorForm/ContributorRolesSelect.js +100 -0
- package/dist/cjs/components/AuthorForm/RemoveAuthorButton.js +45 -0
- package/dist/cjs/components/AuthorForm/index.js +32 -0
- package/dist/cjs/components/AuthorName.js +52 -0
- package/dist/cjs/components/AuthorsDND/AuthorItemComponents.js +22 -0
- package/dist/cjs/components/AuthorsDND/AuthorsDND.js +68 -0
- package/dist/cjs/components/AuthorsDND/DraggableAuthorItem.js +197 -0
- package/dist/cjs/components/AuthorsDND/index.js +23 -0
- package/dist/cjs/components/Button.js +13 -3
- package/dist/cjs/components/ContextMenu.js +51 -0
- package/dist/cjs/components/{DragLayer.js → FileManager/DragLayer.js} +50 -26
- package/dist/cjs/components/FileManager/FileManager.js +1 -1
- package/dist/cjs/components/References/CitationEditor.js +1 -4
- package/dist/cjs/components/icons/index.js +1 -3
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/lib/authors.js +110 -0
- package/dist/cjs/lib/formatAddress.js +31 -0
- package/dist/cjs/lib/name.js +26 -0
- package/dist/cjs/types.js +17 -0
- package/dist/es/components/AffiliationsEditor/AffiliationsEditor.js +34 -0
- package/dist/es/components/AffiliationsEditor/AffiliationsEditorItem.js +146 -0
- package/dist/es/components/AffiliationsEditor/AffiliationsEditorProfile.js +34 -0
- package/dist/es/components/AffiliationsEditor/AffiliationsEditorView.js +52 -0
- package/dist/es/components/AffiliationsEditor/index.js +17 -0
- package/dist/es/components/AffiliationsEditor/styles.js +49 -0
- package/dist/es/components/AuthorForm/AuthorForm.js +92 -0
- package/dist/es/components/AuthorForm/AuthorFormComponents.js +57 -0
- package/dist/es/components/AuthorForm/ContributorRolesSelect.js +70 -0
- package/dist/es/components/AuthorForm/RemoveAuthorButton.js +40 -0
- package/dist/es/components/AuthorForm/index.js +16 -0
- package/dist/es/components/AuthorName.js +23 -0
- package/dist/es/components/AuthorsDND/AuthorItemComponents.js +19 -0
- package/dist/es/components/AuthorsDND/AuthorsDND.js +40 -0
- package/dist/es/components/AuthorsDND/DraggableAuthorItem.js +192 -0
- package/dist/es/components/AuthorsDND/index.js +16 -0
- package/dist/es/components/Button.js +12 -2
- package/dist/es/components/ContextMenu.js +44 -0
- package/dist/es/components/{DragLayer.js → FileManager/DragLayer.js} +27 -26
- package/dist/es/components/FileManager/FileManager.js +1 -1
- package/dist/es/components/References/CitationEditor.js +1 -4
- package/dist/es/components/icons/index.js +0 -1
- package/dist/es/index.js +7 -2
- package/dist/es/lib/authors.js +98 -0
- package/dist/es/lib/formatAddress.js +29 -0
- package/dist/es/lib/name.js +22 -0
- package/dist/es/types.js +16 -0
- package/dist/types/components/AffiliationsEditor/AffiliationsEditor.d.ts +31 -0
- package/dist/types/components/AffiliationsEditor/AffiliationsEditorItem.d.ts +26 -0
- package/dist/types/components/AffiliationsEditor/AffiliationsEditorProfile.d.ts +30 -0
- package/dist/types/components/AffiliationsEditor/AffiliationsEditorView.d.ts +34 -0
- package/dist/types/components/AffiliationsEditor/index.d.ts +17 -0
- package/dist/types/components/AffiliationsEditor/styles.d.ts +23 -0
- package/dist/types/components/AlertMessage.d.ts +1 -1
- package/dist/types/components/AuthorForm/AuthorForm.d.ts +29 -0
- package/dist/types/components/AuthorForm/AuthorFormComponents.d.ts +31 -0
- package/dist/types/components/AuthorForm/ContributorRolesSelect.d.ts +23 -0
- package/dist/types/components/AuthorForm/RemoveAuthorButton.d.ts +27 -0
- package/dist/types/components/AuthorForm/index.d.ts +16 -0
- package/dist/types/components/AuthorName.d.ts +22 -0
- package/dist/types/components/AuthorsDND/AuthorItemComponents.d.ts +24 -0
- package/dist/types/components/AuthorsDND/AuthorsDND.d.ts +28 -0
- package/dist/types/components/AuthorsDND/DraggableAuthorItem.d.ts +50 -0
- package/dist/types/components/AuthorsDND/index.d.ts +16 -0
- package/dist/types/components/Button.d.ts +10 -9
- package/dist/types/components/ContextMenu.d.ts +25 -0
- package/dist/types/components/EditorHeader/EditorHeader.d.ts +1 -1
- package/dist/types/components/InspectorSection.d.ts +1 -1
- package/dist/types/components/NavDropdown.d.ts +1 -1
- package/dist/types/components/StyledModal.d.ts +1 -1
- package/dist/types/components/icons/index.d.ts +0 -1
- package/dist/types/index.d.ts +7 -2
- package/dist/types/lib/authors.d.ts +30 -0
- package/dist/types/lib/formatAddress.d.ts +18 -0
- package/dist/types/lib/name.d.ts +17 -0
- package/dist/types/types.d.ts +80 -0
- package/package.json +1 -1
- /package/dist/types/components/{DragLayer.d.ts → FileManager/DragLayer.d.ts} +0 -0
|
@@ -19,7 +19,6 @@ const dangerBtnStyles = css `
|
|
|
19
19
|
|
|
20
20
|
&:not([disabled]):hover, &:not([disabled]):focus {
|
|
21
21
|
${(props) => btnColors(props.theme.colors.button.error.color.hover, props.theme.colors.button.error.background.hover, props.theme.colors.button.error.border.hover, true)}
|
|
22
|
-
}
|
|
23
22
|
|
|
24
23
|
&:not([disabled]):active {
|
|
25
24
|
${(props) => btnColors(props.theme.colors.button.error.color.active, props.theme.colors.button.error.background.active, props.theme.colors.button.error.border.active)}
|
|
@@ -204,7 +203,7 @@ const IconButtonTemplate = styled(ButtonTemplate) `
|
|
|
204
203
|
${(props) => !props.defaultColor && svgColors}
|
|
205
204
|
`;
|
|
206
205
|
export const IconButton = styled(IconButtonTemplate) `
|
|
207
|
-
${(props) => btnColors(
|
|
206
|
+
${(props) => btnColors('#6e6e6e', props.theme.colors.button.default.background.default, props.theme.colors.button.default.border.default, false)}
|
|
208
207
|
|
|
209
208
|
&:not([disabled]):hover, &:not([disabled]):focus {
|
|
210
209
|
${(props) => btnColors(props.theme.colors.brand.medium, 'transparent', 'transparent', false)}
|
|
@@ -262,3 +261,14 @@ export const ButtonGroup = styled.div `
|
|
|
262
261
|
margin-left: ${(props) => props.theme.grid.unit}px;
|
|
263
262
|
}
|
|
264
263
|
`;
|
|
264
|
+
export const IconButtonGroup = styled.div `
|
|
265
|
+
display: flex;
|
|
266
|
+
flex-direction: row;
|
|
267
|
+
justify-content: flex-start;
|
|
268
|
+
align-items: center;
|
|
269
|
+
|
|
270
|
+
button {
|
|
271
|
+
width: 28px;
|
|
272
|
+
height: 28px;
|
|
273
|
+
}
|
|
274
|
+
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2024 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import styled from 'styled-components';
|
|
18
|
+
import { IconButton, IconButtonGroup } from './Button';
|
|
19
|
+
import { AddComment, EditIcon } from './icons';
|
|
20
|
+
import { Tooltip } from './Tooltip';
|
|
21
|
+
const Icons = {
|
|
22
|
+
AddComment: AddComment,
|
|
23
|
+
EditIcon: EditIcon,
|
|
24
|
+
};
|
|
25
|
+
const ContextMenuIconButton = styled(IconButton) `
|
|
26
|
+
&:not([disabled]):hover,
|
|
27
|
+
&:not([disabled]):focus {
|
|
28
|
+
color: #363636;
|
|
29
|
+
background-color: #f2f2f2;
|
|
30
|
+
border-color: #f2f2f2;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export const ContextMenu = ({ actions }) => {
|
|
34
|
+
let Icon;
|
|
35
|
+
return (React.createElement(React.Fragment, null,
|
|
36
|
+
React.createElement(IconButtonGroup, null, actions.map((action) => {
|
|
37
|
+
{
|
|
38
|
+
Icon = Icons[action.icon];
|
|
39
|
+
}
|
|
40
|
+
return (React.createElement(ContextMenuIconButton, { key: action.icon, "data-tooltip-id": action.icon, onClick: action.action },
|
|
41
|
+
React.createElement(Icon, null),
|
|
42
|
+
React.createElement(Tooltip, { id: action.icon, place: "bottom" }, action.label)));
|
|
43
|
+
}))));
|
|
44
|
+
};
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { useDragLayer } from 'react-dnd';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { FileContainer } from './
|
|
5
|
-
import { FileCreatedDate } from './
|
|
6
|
-
import { FileName } from './
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
pointer-events: none;
|
|
10
|
-
z-index: 999;
|
|
11
|
-
left: 0;
|
|
12
|
-
top: 0;
|
|
13
|
-
max-width: 400px;
|
|
14
|
-
`;
|
|
15
|
-
const DraggableFileContainer = styled(FileContainer) `
|
|
16
|
-
padding: 16px 32px;
|
|
17
|
-
background: #f2fbfc;
|
|
18
|
-
border: 1px solid #bce7f6;
|
|
19
|
-
box-shadow: 0 4px 9px rgba(0, 0, 0, 0.3);
|
|
20
|
-
border-radius: 6px;
|
|
21
|
-
`;
|
|
22
|
-
const getItemStyles = (currentOffset) => {
|
|
23
|
-
if (!currentOffset) {
|
|
4
|
+
import { FileContainer } from './FileContainer';
|
|
5
|
+
import { FileCreatedDate } from './FileCreatedDate';
|
|
6
|
+
import { FileName } from './FileName';
|
|
7
|
+
function getItemStyles(initialOffset, currentOffset) {
|
|
8
|
+
if (!initialOffset || !currentOffset) {
|
|
24
9
|
return {
|
|
25
10
|
display: 'none',
|
|
26
11
|
};
|
|
@@ -31,15 +16,16 @@ const getItemStyles = (currentOffset) => {
|
|
|
31
16
|
transform,
|
|
32
17
|
WebkitTransform: transform,
|
|
33
18
|
};
|
|
34
|
-
}
|
|
19
|
+
}
|
|
35
20
|
export const DragLayer = () => {
|
|
36
|
-
const { itemType, isDragging, item, currentOffset } = useDragLayer((monitor) => ({
|
|
21
|
+
const { itemType, isDragging, item, initialOffset, currentOffset } = useDragLayer((monitor) => ({
|
|
37
22
|
item: monitor.getItem(),
|
|
38
23
|
itemType: monitor.getItemType(),
|
|
24
|
+
initialOffset: monitor.getInitialSourceClientOffset(),
|
|
39
25
|
currentOffset: monitor.getSourceClientOffset(),
|
|
40
26
|
isDragging: monitor.isDragging(),
|
|
41
27
|
}));
|
|
42
|
-
const renderItem = () => {
|
|
28
|
+
const renderItem = useCallback(() => {
|
|
43
29
|
switch (itemType) {
|
|
44
30
|
case 'file':
|
|
45
31
|
return (React.createElement(DraggableFileContainer, null,
|
|
@@ -48,9 +34,24 @@ export const DragLayer = () => {
|
|
|
48
34
|
default:
|
|
49
35
|
return null;
|
|
50
36
|
}
|
|
51
|
-
};
|
|
37
|
+
}, [itemType, item]);
|
|
52
38
|
if (!isDragging) {
|
|
53
39
|
return null;
|
|
54
40
|
}
|
|
55
|
-
return (React.createElement(Container, { style: getItemStyles(currentOffset) }, renderItem()));
|
|
41
|
+
return (React.createElement(Container, { style: getItemStyles(initialOffset, currentOffset) }, renderItem()));
|
|
56
42
|
};
|
|
43
|
+
const Container = styled.div `
|
|
44
|
+
position: fixed;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
z-index: 999;
|
|
47
|
+
left: 0;
|
|
48
|
+
top: 0;
|
|
49
|
+
max-width: 400px;
|
|
50
|
+
`;
|
|
51
|
+
const DraggableFileContainer = styled(FileContainer) `
|
|
52
|
+
padding: 16px 32px;
|
|
53
|
+
background: #f2fbfc;
|
|
54
|
+
border: 1px solid #bce7f6;
|
|
55
|
+
box-shadow: 0 4px 9px rgba(0, 0, 0, 0.3);
|
|
56
|
+
border-radius: 6px;
|
|
57
|
+
`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { createContext } from 'react';
|
|
2
2
|
import { useFiles } from '../../index';
|
|
3
|
-
import { DragLayer } from '../DragLayer';
|
|
4
3
|
import { InspectorTab, InspectorTabList, InspectorTabPanel, InspectorTabPanels, InspectorTabs, } from '../Inspector';
|
|
5
4
|
import { InspectorSection } from '../InspectorSection';
|
|
6
5
|
import { Tooltip } from '../Tooltip';
|
|
6
|
+
import { DragLayer } from './DragLayer';
|
|
7
7
|
import { FileManagerProvider } from './FileManagerProvider';
|
|
8
8
|
import { InlineFilesSection } from './InlineFilesSection';
|
|
9
9
|
import { OtherFilesSection } from './OtherFilesSection';
|
|
@@ -5,7 +5,6 @@ import React, { useMemo, useState } from 'react';
|
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { ButtonGroup, IconButton, IconTextButton, PrimaryButton, SecondaryButton, } from '../Button';
|
|
7
7
|
import { Category, Dialog } from '../Dialog';
|
|
8
|
-
import { AddComment } from '../icons';
|
|
9
8
|
import { CitedItem, CitedItems } from './CitationViewer';
|
|
10
9
|
import { ReferenceLine } from './ReferenceLine';
|
|
11
10
|
import { ReferenceSearch } from './ReferenceSearch';
|
|
@@ -107,9 +106,7 @@ export const CitationEditor = ({ query, rids, items, citationCounts, sources, on
|
|
|
107
106
|
React.createElement(CloseIconDark, { className: 'remove-icon' }))))))),
|
|
108
107
|
React.createElement(ReferencesModal, { isOpen: editingForm.show, onCancel: () => setEditingForm({ show: false }), items: items, citationCounts: citationCounts, item: editingForm.item, onSave: onSave, onDelete: onDelete }),
|
|
109
108
|
React.createElement(Actions, null,
|
|
110
|
-
React.createElement(IconTextButton,
|
|
111
|
-
React.createElement(AddComment, null),
|
|
112
|
-
React.createElement(AddCommentButtonText, null, "Add Comment")),
|
|
109
|
+
React.createElement(IconTextButton, null),
|
|
113
110
|
React.createElement(ButtonGroup, null,
|
|
114
111
|
React.createElement(SecondaryButton, { onClick: onCancel }, "Done"),
|
|
115
112
|
React.createElement(PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
@@ -45,4 +45,3 @@ export { default as LeftArrow } from './left-arrow';
|
|
|
45
45
|
export { default as BlockQuoteIcon } from './block-quote-icon';
|
|
46
46
|
export { default as PullQuoteIcon } from './pull-quote-icon';
|
|
47
47
|
export { default as PlusIcon } from './plus-icon';
|
|
48
|
-
export { DeleteIcon } from './delete-icon';
|
package/dist/es/index.js
CHANGED
|
@@ -13,8 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export * from './components/AffiliationsEditor';
|
|
17
|
+
export * from './components/AuthorForm';
|
|
18
|
+
export * from './components/AuthorName';
|
|
19
|
+
export * from './components/AuthorsDND';
|
|
16
20
|
export * from './components/AlertMessage';
|
|
17
21
|
export * from './components/Button';
|
|
22
|
+
export * from './components/ContextMenu';
|
|
18
23
|
export * from './components/RadioButton';
|
|
19
24
|
export * from './components/AutoSaveInput';
|
|
20
25
|
export * from './components/Avatar';
|
|
@@ -27,8 +32,6 @@ export * from './components/Resizer';
|
|
|
27
32
|
export * from './components/SaveStatus';
|
|
28
33
|
export * from './components/StyledModal';
|
|
29
34
|
export * from './components/TableFootnotesSelector';
|
|
30
|
-
export * from './components/Sidebar';
|
|
31
|
-
export * from './components/DragLayer';
|
|
32
35
|
export * from './components/TextField';
|
|
33
36
|
export * from './components/TextFieldContainer';
|
|
34
37
|
export * from './components/TextFieldError';
|
|
@@ -53,8 +56,10 @@ export * from './hooks/use-dropdown';
|
|
|
53
56
|
export * from './hooks/use-files';
|
|
54
57
|
export * from './hooks/use-menus';
|
|
55
58
|
export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
|
|
59
|
+
export * from './lib/authors';
|
|
56
60
|
export * from './lib/capabilities';
|
|
57
61
|
export * from './lib/files';
|
|
58
62
|
export * from './lib/comments';
|
|
59
63
|
export * from './lib/menus';
|
|
60
64
|
export { default as errorsDecoder } from './lib/errors-decoder';
|
|
65
|
+
export * from './types';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
|
+
const getModelsByType = (modelMap, objectType) => {
|
|
18
|
+
const output = [];
|
|
19
|
+
for (const model of modelMap.values()) {
|
|
20
|
+
if (model.objectType === objectType) {
|
|
21
|
+
output.push(model);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return output;
|
|
25
|
+
};
|
|
26
|
+
export const buildSortedAuthors = (modelMap) => {
|
|
27
|
+
return getModelsByType(modelMap, ObjectTypes.Contributor)
|
|
28
|
+
.filter((item) => item.role === 'author')
|
|
29
|
+
.sort((a, b) => Number(a.priority) - Number(b.priority));
|
|
30
|
+
};
|
|
31
|
+
export const buildAuthorPriority = (authors) => {
|
|
32
|
+
if (!authors.length) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
const priorities = authors.map((author) => Number(author.priority));
|
|
36
|
+
return Math.max(...priorities) + 1;
|
|
37
|
+
};
|
|
38
|
+
export const buildAffiliationIDs = (authors) => {
|
|
39
|
+
const ids = [];
|
|
40
|
+
authors.forEach((author) => {
|
|
41
|
+
if (author.affiliations) {
|
|
42
|
+
author.affiliations.forEach((id) => {
|
|
43
|
+
ids.push(id);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return ids.filter((value, index) => ids.indexOf(value) === index);
|
|
48
|
+
};
|
|
49
|
+
export const buildAuthorAffiliations = (authors, affiliations, uniqueAffiliationIDs) => {
|
|
50
|
+
const items = new Map();
|
|
51
|
+
authors.forEach((author) => {
|
|
52
|
+
items.set(author._id, (author.affiliations || []).map((id) => {
|
|
53
|
+
return {
|
|
54
|
+
ordinal: uniqueAffiliationIDs.indexOf(id) + 1,
|
|
55
|
+
data: affiliations.get(id),
|
|
56
|
+
};
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
return items;
|
|
60
|
+
};
|
|
61
|
+
export const buildAffiliationsMap = (affiliationIDs, modelMap) => new Map(affiliationIDs.map((id) => [
|
|
62
|
+
id,
|
|
63
|
+
modelMap.get(id),
|
|
64
|
+
]));
|
|
65
|
+
export const buildAuthorsAndAffiliations = (modelMap) => {
|
|
66
|
+
const authors = buildSortedAuthors(modelMap);
|
|
67
|
+
const affiliationIDs = buildAffiliationIDs(authors);
|
|
68
|
+
const affiliations = buildAffiliationsMap(affiliationIDs, modelMap);
|
|
69
|
+
const authorAffiliations = buildAuthorAffiliations(authors, affiliations, affiliationIDs);
|
|
70
|
+
return {
|
|
71
|
+
affiliations,
|
|
72
|
+
authors,
|
|
73
|
+
authorAffiliations,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export const isJointFirstAuthor = (authors, index) => {
|
|
77
|
+
const author = index === 0 ? authors[index] : authors[index - 1];
|
|
78
|
+
return Boolean(author.isJointContributor);
|
|
79
|
+
};
|
|
80
|
+
export const affiliationLabel = (affiliation) => {
|
|
81
|
+
const { department, institution = '' } = affiliation;
|
|
82
|
+
if (!institution) {
|
|
83
|
+
return '(unknown institution)';
|
|
84
|
+
}
|
|
85
|
+
return department ? `${institution} (${department})`.trim() : institution;
|
|
86
|
+
};
|
|
87
|
+
export const affiliationsOptions = (affiliations, authorAffiliations) => {
|
|
88
|
+
if (!authorAffiliations) {
|
|
89
|
+
return affiliationsOptions(affiliations, []);
|
|
90
|
+
}
|
|
91
|
+
const authorAffiliationsIds = new Set(authorAffiliations.map((authorAffiliation) => authorAffiliation.data._id));
|
|
92
|
+
return Array.from(affiliations.values())
|
|
93
|
+
.filter((affiliation) => !authorAffiliationsIds.has(affiliation._id))
|
|
94
|
+
.map((affiliation) => ({
|
|
95
|
+
value: affiliation._id,
|
|
96
|
+
label: affiliationLabel(affiliation) || '',
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export default (affiliation) => {
|
|
17
|
+
const { department, institution, addressLine1, city, county, country, postCode, } = affiliation;
|
|
18
|
+
return [
|
|
19
|
+
department,
|
|
20
|
+
institution,
|
|
21
|
+
addressLine1,
|
|
22
|
+
city,
|
|
23
|
+
county,
|
|
24
|
+
country,
|
|
25
|
+
postCode,
|
|
26
|
+
]
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.join(', ');
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const initials = (name) => name.given
|
|
17
|
+
? name.given
|
|
18
|
+
.trim()
|
|
19
|
+
.split(' ')
|
|
20
|
+
.map((part) => part.substr(0, 1).toUpperCase() + '.')
|
|
21
|
+
.join('')
|
|
22
|
+
: '';
|
package/dist/es/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { AffiliationGeneric, AuthorAffiliation } from '../../types';
|
|
18
|
+
import { AuthorFormComponentOverrides } from '../AuthorForm/AuthorFormComponents';
|
|
19
|
+
interface Props {
|
|
20
|
+
affiliations: Map<string, AffiliationGeneric>;
|
|
21
|
+
authorAffiliations?: AuthorAffiliation[];
|
|
22
|
+
addAuthorAffiliation: (affiliation: AffiliationGeneric | string) => void;
|
|
23
|
+
removeAuthorAffiliation: (affiliation: AffiliationGeneric) => void;
|
|
24
|
+
updateAffiliation: (affiliation: AffiliationGeneric) => void;
|
|
25
|
+
components?: AuthorFormComponentOverrides;
|
|
26
|
+
styleOverrides?: {
|
|
27
|
+
menuZIndex?: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare const AffiliationsEditor: React.FC<Props>;
|
|
31
|
+
export default AffiliationsEditor;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { AffiliationGeneric } from '../../types';
|
|
18
|
+
interface Props {
|
|
19
|
+
affiliation: AffiliationGeneric;
|
|
20
|
+
requestToggle: () => void;
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
updateAffiliation: (affiliation: AffiliationGeneric) => void;
|
|
23
|
+
removeAuthorAffiliation: (affiliation: AffiliationGeneric) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const AffiliationsEditorItem: React.FC<Props>;
|
|
26
|
+
export default AffiliationsEditorItem;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { UserProfileAffiliation } from '@manuscripts/json-schema';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { AuthorFormComponentOverrides } from '../AuthorForm/AuthorFormComponents';
|
|
19
|
+
interface Props {
|
|
20
|
+
affiliations: Map<string, UserProfileAffiliation>;
|
|
21
|
+
addAffiliation: (affiliation: string) => void;
|
|
22
|
+
removeAffiliation: (affiliation: UserProfileAffiliation) => void;
|
|
23
|
+
updateAffiliation: (affiliation: UserProfileAffiliation) => void;
|
|
24
|
+
components?: AuthorFormComponentOverrides;
|
|
25
|
+
styleOverrides?: {
|
|
26
|
+
menuZIndex?: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
declare const AffiliationsEditorProfile: React.FC<Props>;
|
|
30
|
+
export default AffiliationsEditorProfile;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { OnChangeValue } from 'react-select';
|
|
18
|
+
import { AffiliationGeneric, AffiliationOption } from '../../types';
|
|
19
|
+
import { AuthorFormComponentOverrides } from '../AuthorForm/AuthorFormComponents';
|
|
20
|
+
interface Props {
|
|
21
|
+
options: AffiliationOption[];
|
|
22
|
+
selected: AffiliationGeneric[];
|
|
23
|
+
inputValue: string;
|
|
24
|
+
handleInputChange: (text: string) => void;
|
|
25
|
+
handleChoose: (value: OnChangeValue<AffiliationOption, false>) => void;
|
|
26
|
+
updateAffiliation: (affiliation: AffiliationGeneric) => void;
|
|
27
|
+
removeAuthorAffiliation: (affiliation: AffiliationGeneric) => void;
|
|
28
|
+
components?: AuthorFormComponentOverrides;
|
|
29
|
+
styleOverrides?: {
|
|
30
|
+
menuZIndex?: number;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
declare const AffiliationsEditorView: React.FC<Props>;
|
|
34
|
+
export default AffiliationsEditorView;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { default as AffiliationsEditor } from './AffiliationsEditor';
|
|
17
|
+
export { default as AffiliationsEditorProfile } from './AffiliationsEditorProfile';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { IndicatorsContainerProps } from 'react-select';
|
|
18
|
+
import { AffiliationOption } from '../../types';
|
|
19
|
+
export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
|
+
export declare const Field: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
21
|
+
export declare const List: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
22
|
+
export declare const AddAffiliationContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
23
|
+
export declare const AddAffiliationIndicator: React.FC<IndicatorsContainerProps<AffiliationOption, false>>;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
17
|
export declare const TextButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
|
|
18
|
-
type: "button" | "
|
|
18
|
+
type: "button" | "reset" | "submit";
|
|
19
19
|
} & {
|
|
20
20
|
danger?: boolean | undefined;
|
|
21
21
|
disabled?: boolean | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Contributor, ContributorRole } from '@manuscripts/json-schema';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { AuthorValues } from '../../types';
|
|
19
|
+
import { AuthorFormComponentOverrides } from './AuthorFormComponents';
|
|
20
|
+
export declare const AuthorForm: React.FunctionComponent<{
|
|
21
|
+
author: Contributor;
|
|
22
|
+
isRemoveAuthorOpen: boolean;
|
|
23
|
+
removeAuthor: (data: Contributor) => void;
|
|
24
|
+
handleSave: (values: AuthorValues) => Promise<void>;
|
|
25
|
+
handleRemoveAuthor: () => void;
|
|
26
|
+
components?: AuthorFormComponentOverrides;
|
|
27
|
+
contributorRoles?: ContributorRole[];
|
|
28
|
+
createContributorRole?: (name: string) => Promise<ContributorRole>;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { DefaultTheme, StyledComponent } from 'styled-components';
|
|
17
|
+
export declare const Fields: StyledComponent<"div", DefaultTheme, {}, never>;
|
|
18
|
+
export declare const Label: StyledComponent<"label", DefaultTheme, {}, never>;
|
|
19
|
+
export declare const LabelText: StyledComponent<"div", DefaultTheme, {}, never>;
|
|
20
|
+
export declare const Fieldset: StyledComponent<"fieldset", DefaultTheme, {}, never>;
|
|
21
|
+
export declare const Legend: StyledComponent<"legend", DefaultTheme, {}, never>;
|
|
22
|
+
export declare const Container: StyledComponent<"div", DefaultTheme, {}, never>;
|
|
23
|
+
export interface AuthorFormComponents {
|
|
24
|
+
Legend: StyledComponent<'legend', DefaultTheme>;
|
|
25
|
+
CheckboxLabel: StyledComponent<'label', DefaultTheme>;
|
|
26
|
+
TextField: StyledComponent<'input', DefaultTheme>;
|
|
27
|
+
}
|
|
28
|
+
export type AuthorFormComponentOverrides = {
|
|
29
|
+
[K in keyof AuthorFormComponents]?: AuthorFormComponents[K];
|
|
30
|
+
};
|
|
31
|
+
export declare const defaultAuthorFormComponents: AuthorFormComponents;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ContributorRole } from '@manuscripts/json-schema';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
export declare const ContributorRolesSelect: React.FC<{
|
|
19
|
+
contributorRoles: ContributorRole[];
|
|
20
|
+
createContributorRole: (name: string) => Promise<ContributorRole>;
|
|
21
|
+
value: string[];
|
|
22
|
+
setFieldValue: (value: string[]) => void;
|
|
23
|
+
}>;
|