@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
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.DragLayer = void 0;
|
|
7
|
-
const react_1 =
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
8
31
|
const react_dnd_1 = require("react-dnd");
|
|
9
32
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
-
const FileContainer_1 = require("./
|
|
11
|
-
const FileCreatedDate_1 = require("./
|
|
12
|
-
const FileName_1 = require("./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
z-index: 999;
|
|
17
|
-
left: 0;
|
|
18
|
-
top: 0;
|
|
19
|
-
max-width: 400px;
|
|
20
|
-
`;
|
|
21
|
-
const DraggableFileContainer = (0, styled_components_1.default)(FileContainer_1.FileContainer) `
|
|
22
|
-
padding: 16px 32px;
|
|
23
|
-
background: #f2fbfc;
|
|
24
|
-
border: 1px solid #bce7f6;
|
|
25
|
-
box-shadow: 0 4px 9px rgba(0, 0, 0, 0.3);
|
|
26
|
-
border-radius: 6px;
|
|
27
|
-
`;
|
|
28
|
-
const getItemStyles = (currentOffset) => {
|
|
29
|
-
if (!currentOffset) {
|
|
33
|
+
const FileContainer_1 = require("./FileContainer");
|
|
34
|
+
const FileCreatedDate_1 = require("./FileCreatedDate");
|
|
35
|
+
const FileName_1 = require("./FileName");
|
|
36
|
+
function getItemStyles(initialOffset, currentOffset) {
|
|
37
|
+
if (!initialOffset || !currentOffset) {
|
|
30
38
|
return {
|
|
31
39
|
display: 'none',
|
|
32
40
|
};
|
|
@@ -37,15 +45,16 @@ const getItemStyles = (currentOffset) => {
|
|
|
37
45
|
transform,
|
|
38
46
|
WebkitTransform: transform,
|
|
39
47
|
};
|
|
40
|
-
}
|
|
48
|
+
}
|
|
41
49
|
const DragLayer = () => {
|
|
42
|
-
const { itemType, isDragging, item, currentOffset } = (0, react_dnd_1.useDragLayer)((monitor) => ({
|
|
50
|
+
const { itemType, isDragging, item, initialOffset, currentOffset } = (0, react_dnd_1.useDragLayer)((monitor) => ({
|
|
43
51
|
item: monitor.getItem(),
|
|
44
52
|
itemType: monitor.getItemType(),
|
|
53
|
+
initialOffset: monitor.getInitialSourceClientOffset(),
|
|
45
54
|
currentOffset: monitor.getSourceClientOffset(),
|
|
46
55
|
isDragging: monitor.isDragging(),
|
|
47
56
|
}));
|
|
48
|
-
const renderItem = () => {
|
|
57
|
+
const renderItem = (0, react_1.useCallback)(() => {
|
|
49
58
|
switch (itemType) {
|
|
50
59
|
case 'file':
|
|
51
60
|
return (react_1.default.createElement(DraggableFileContainer, null,
|
|
@@ -54,10 +63,25 @@ const DragLayer = () => {
|
|
|
54
63
|
default:
|
|
55
64
|
return null;
|
|
56
65
|
}
|
|
57
|
-
};
|
|
66
|
+
}, [itemType, item]);
|
|
58
67
|
if (!isDragging) {
|
|
59
68
|
return null;
|
|
60
69
|
}
|
|
61
|
-
return (react_1.default.createElement(Container, { style: getItemStyles(currentOffset) }, renderItem()));
|
|
70
|
+
return (react_1.default.createElement(Container, { style: getItemStyles(initialOffset, currentOffset) }, renderItem()));
|
|
62
71
|
};
|
|
63
72
|
exports.DragLayer = DragLayer;
|
|
73
|
+
const Container = styled_components_1.default.div `
|
|
74
|
+
position: fixed;
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
z-index: 999;
|
|
77
|
+
left: 0;
|
|
78
|
+
top: 0;
|
|
79
|
+
max-width: 400px;
|
|
80
|
+
`;
|
|
81
|
+
const DraggableFileContainer = (0, styled_components_1.default)(FileContainer_1.FileContainer) `
|
|
82
|
+
padding: 16px 32px;
|
|
83
|
+
background: #f2fbfc;
|
|
84
|
+
border: 1px solid #bce7f6;
|
|
85
|
+
box-shadow: 0 4px 9px rgba(0, 0, 0, 0.3);
|
|
86
|
+
border-radius: 6px;
|
|
87
|
+
`;
|
|
@@ -26,10 +26,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.FileManager = exports.PermissionsContext = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const index_1 = require("../../index");
|
|
29
|
-
const DragLayer_1 = require("../DragLayer");
|
|
30
29
|
const Inspector_1 = require("../Inspector");
|
|
31
30
|
const InspectorSection_1 = require("../InspectorSection");
|
|
32
31
|
const Tooltip_1 = require("../Tooltip");
|
|
32
|
+
const DragLayer_1 = require("./DragLayer");
|
|
33
33
|
const FileManagerProvider_1 = require("./FileManagerProvider");
|
|
34
34
|
const InlineFilesSection_1 = require("./InlineFilesSection");
|
|
35
35
|
const OtherFilesSection_1 = require("./OtherFilesSection");
|
|
@@ -34,7 +34,6 @@ const react_1 = __importStar(require("react"));
|
|
|
34
34
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
35
35
|
const Button_1 = require("../Button");
|
|
36
36
|
const Dialog_1 = require("../Dialog");
|
|
37
|
-
const icons_1 = require("../icons");
|
|
38
37
|
const CitationViewer_1 = require("./CitationViewer");
|
|
39
38
|
const ReferenceLine_1 = require("./ReferenceLine");
|
|
40
39
|
const ReferenceSearch_1 = require("./ReferenceSearch");
|
|
@@ -136,9 +135,7 @@ const CitationEditor = ({ query, rids, items, citationCounts, sources, onCite, o
|
|
|
136
135
|
react_1.default.createElement(CloseIconDark_1.default, { className: 'remove-icon' }))))))),
|
|
137
136
|
react_1.default.createElement(ReferencesModal_1.ReferencesModal, { isOpen: editingForm.show, onCancel: () => setEditingForm({ show: false }), items: items, citationCounts: citationCounts, item: editingForm.item, onSave: onSave, onDelete: onDelete }),
|
|
138
137
|
react_1.default.createElement(Actions, null,
|
|
139
|
-
react_1.default.createElement(Button_1.IconTextButton,
|
|
140
|
-
react_1.default.createElement(icons_1.AddComment, null),
|
|
141
|
-
react_1.default.createElement(AddCommentButtonText, null, "Add Comment")),
|
|
138
|
+
react_1.default.createElement(Button_1.IconTextButton, null),
|
|
142
139
|
react_1.default.createElement(Button_1.ButtonGroup, null,
|
|
143
140
|
react_1.default.createElement(Button_1.SecondaryButton, { onClick: onCancel }, "Done"),
|
|
144
141
|
react_1.default.createElement(Button_1.PrimaryButton, { disabled: !canEdit, onClick: () => setSearching(true) }, "Add Citation")))));
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
21
|
+
exports.PlusIcon = exports.PullQuoteIcon = exports.BlockQuoteIcon = exports.LeftArrow = exports.AnnotatorIcon = exports.ReadingIcon = exports.EditIcon = exports.UnsupportedFormatFileIcon = exports.MissingImage = exports.UploadIcon = exports.AttachIcon = exports.TaskStepNextIcon = exports.TaskStepDoneIcon = exports.TaskStepCurrentIcon = exports.ZoomOutIcon = exports.ZoomInIcon = exports.UserIcon = exports.TickMarkIcon = exports.SearchIcon = exports.ProjectsListIcon = exports.ProjectIcon = exports.ProjectNotificationIcon = exports.OrcidIcon = exports.GoogleIcon = exports.AddComment = exports.CloseOIcon = exports.CloseIcon = exports.BookmarkIcon = exports.BackArrowIcon = exports.AddIconInverted = exports.AddIconActive = exports.AddAuthor = void 0;
|
|
22
22
|
var add_author_1 = require("./add-author");
|
|
23
23
|
Object.defineProperty(exports, "AddAuthor", { enumerable: true, get: function () { return __importDefault(add_author_1).default; } });
|
|
24
24
|
var add_icon_active_1 = require("./add-icon-active");
|
|
@@ -83,5 +83,3 @@ var pull_quote_icon_1 = require("./pull-quote-icon");
|
|
|
83
83
|
Object.defineProperty(exports, "PullQuoteIcon", { enumerable: true, get: function () { return __importDefault(pull_quote_icon_1).default; } });
|
|
84
84
|
var plus_icon_1 = require("./plus-icon");
|
|
85
85
|
Object.defineProperty(exports, "PlusIcon", { enumerable: true, get: function () { return __importDefault(plus_icon_1).default; } });
|
|
86
|
-
var delete_icon_1 = require("./delete-icon");
|
|
87
|
-
Object.defineProperty(exports, "DeleteIcon", { enumerable: true, get: function () { return delete_icon_1.DeleteIcon; } });
|
package/dist/cjs/index.js
CHANGED
|
@@ -33,8 +33,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.errorsDecoder = exports.useDeepCompareCallback = exports.useDeepCompareMemo = void 0;
|
|
36
|
+
__exportStar(require("./components/AffiliationsEditor"), exports);
|
|
37
|
+
__exportStar(require("./components/AuthorForm"), exports);
|
|
38
|
+
__exportStar(require("./components/AuthorName"), exports);
|
|
39
|
+
__exportStar(require("./components/AuthorsDND"), exports);
|
|
36
40
|
__exportStar(require("./components/AlertMessage"), exports);
|
|
37
41
|
__exportStar(require("./components/Button"), exports);
|
|
42
|
+
__exportStar(require("./components/ContextMenu"), exports);
|
|
38
43
|
__exportStar(require("./components/RadioButton"), exports);
|
|
39
44
|
__exportStar(require("./components/AutoSaveInput"), exports);
|
|
40
45
|
__exportStar(require("./components/Avatar"), exports);
|
|
@@ -47,8 +52,6 @@ __exportStar(require("./components/Resizer"), exports);
|
|
|
47
52
|
__exportStar(require("./components/SaveStatus"), exports);
|
|
48
53
|
__exportStar(require("./components/StyledModal"), exports);
|
|
49
54
|
__exportStar(require("./components/TableFootnotesSelector"), exports);
|
|
50
|
-
__exportStar(require("./components/Sidebar"), exports);
|
|
51
|
-
__exportStar(require("./components/DragLayer"), exports);
|
|
52
55
|
__exportStar(require("./components/TextField"), exports);
|
|
53
56
|
__exportStar(require("./components/TextFieldContainer"), exports);
|
|
54
57
|
__exportStar(require("./components/TextFieldError"), exports);
|
|
@@ -75,9 +78,11 @@ __exportStar(require("./hooks/use-menus"), exports);
|
|
|
75
78
|
var use_deep_compare_1 = require("./hooks/use-deep-compare");
|
|
76
79
|
Object.defineProperty(exports, "useDeepCompareMemo", { enumerable: true, get: function () { return use_deep_compare_1.useDeepCompareMemo; } });
|
|
77
80
|
Object.defineProperty(exports, "useDeepCompareCallback", { enumerable: true, get: function () { return use_deep_compare_1.useDeepCompareCallback; } });
|
|
81
|
+
__exportStar(require("./lib/authors"), exports);
|
|
78
82
|
__exportStar(require("./lib/capabilities"), exports);
|
|
79
83
|
__exportStar(require("./lib/files"), exports);
|
|
80
84
|
__exportStar(require("./lib/comments"), exports);
|
|
81
85
|
__exportStar(require("./lib/menus"), exports);
|
|
82
86
|
var errors_decoder_1 = require("./lib/errors-decoder");
|
|
83
87
|
Object.defineProperty(exports, "errorsDecoder", { enumerable: true, get: function () { return __importDefault(errors_decoder_1).default; } });
|
|
88
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.affiliationsOptions = exports.affiliationLabel = exports.isJointFirstAuthor = exports.buildAuthorsAndAffiliations = exports.buildAffiliationsMap = exports.buildAuthorAffiliations = exports.buildAffiliationIDs = exports.buildAuthorPriority = exports.buildSortedAuthors = void 0;
|
|
19
|
+
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
|
+
const getModelsByType = (modelMap, objectType) => {
|
|
21
|
+
const output = [];
|
|
22
|
+
for (const model of modelMap.values()) {
|
|
23
|
+
if (model.objectType === objectType) {
|
|
24
|
+
output.push(model);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return output;
|
|
28
|
+
};
|
|
29
|
+
const buildSortedAuthors = (modelMap) => {
|
|
30
|
+
return getModelsByType(modelMap, json_schema_1.ObjectTypes.Contributor)
|
|
31
|
+
.filter((item) => item.role === 'author')
|
|
32
|
+
.sort((a, b) => Number(a.priority) - Number(b.priority));
|
|
33
|
+
};
|
|
34
|
+
exports.buildSortedAuthors = buildSortedAuthors;
|
|
35
|
+
const buildAuthorPriority = (authors) => {
|
|
36
|
+
if (!authors.length) {
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
const priorities = authors.map((author) => Number(author.priority));
|
|
40
|
+
return Math.max(...priorities) + 1;
|
|
41
|
+
};
|
|
42
|
+
exports.buildAuthorPriority = buildAuthorPriority;
|
|
43
|
+
const buildAffiliationIDs = (authors) => {
|
|
44
|
+
const ids = [];
|
|
45
|
+
authors.forEach((author) => {
|
|
46
|
+
if (author.affiliations) {
|
|
47
|
+
author.affiliations.forEach((id) => {
|
|
48
|
+
ids.push(id);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return ids.filter((value, index) => ids.indexOf(value) === index);
|
|
53
|
+
};
|
|
54
|
+
exports.buildAffiliationIDs = buildAffiliationIDs;
|
|
55
|
+
const buildAuthorAffiliations = (authors, affiliations, uniqueAffiliationIDs) => {
|
|
56
|
+
const items = new Map();
|
|
57
|
+
authors.forEach((author) => {
|
|
58
|
+
items.set(author._id, (author.affiliations || []).map((id) => {
|
|
59
|
+
return {
|
|
60
|
+
ordinal: uniqueAffiliationIDs.indexOf(id) + 1,
|
|
61
|
+
data: affiliations.get(id),
|
|
62
|
+
};
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
return items;
|
|
66
|
+
};
|
|
67
|
+
exports.buildAuthorAffiliations = buildAuthorAffiliations;
|
|
68
|
+
const buildAffiliationsMap = (affiliationIDs, modelMap) => new Map(affiliationIDs.map((id) => [
|
|
69
|
+
id,
|
|
70
|
+
modelMap.get(id),
|
|
71
|
+
]));
|
|
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);
|
|
78
|
+
return {
|
|
79
|
+
affiliations,
|
|
80
|
+
authors,
|
|
81
|
+
authorAffiliations,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
exports.buildAuthorsAndAffiliations = buildAuthorsAndAffiliations;
|
|
85
|
+
const isJointFirstAuthor = (authors, index) => {
|
|
86
|
+
const author = index === 0 ? authors[index] : authors[index - 1];
|
|
87
|
+
return Boolean(author.isJointContributor);
|
|
88
|
+
};
|
|
89
|
+
exports.isJointFirstAuthor = isJointFirstAuthor;
|
|
90
|
+
const affiliationLabel = (affiliation) => {
|
|
91
|
+
const { department, institution = '' } = affiliation;
|
|
92
|
+
if (!institution) {
|
|
93
|
+
return '(unknown institution)';
|
|
94
|
+
}
|
|
95
|
+
return department ? `${institution} (${department})`.trim() : institution;
|
|
96
|
+
};
|
|
97
|
+
exports.affiliationLabel = affiliationLabel;
|
|
98
|
+
const affiliationsOptions = (affiliations, authorAffiliations) => {
|
|
99
|
+
if (!authorAffiliations) {
|
|
100
|
+
return (0, exports.affiliationsOptions)(affiliations, []);
|
|
101
|
+
}
|
|
102
|
+
const authorAffiliationsIds = new Set(authorAffiliations.map((authorAffiliation) => authorAffiliation.data._id));
|
|
103
|
+
return Array.from(affiliations.values())
|
|
104
|
+
.filter((affiliation) => !authorAffiliationsIds.has(affiliation._id))
|
|
105
|
+
.map((affiliation) => ({
|
|
106
|
+
value: affiliation._id,
|
|
107
|
+
label: (0, exports.affiliationLabel)(affiliation) || '',
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
exports.affiliationsOptions = affiliationsOptions;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.default = (affiliation) => {
|
|
19
|
+
const { department, institution, addressLine1, city, county, country, postCode, } = affiliation;
|
|
20
|
+
return [
|
|
21
|
+
department,
|
|
22
|
+
institution,
|
|
23
|
+
addressLine1,
|
|
24
|
+
city,
|
|
25
|
+
county,
|
|
26
|
+
country,
|
|
27
|
+
postCode,
|
|
28
|
+
]
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(', ');
|
|
31
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.initials = void 0;
|
|
19
|
+
const initials = (name) => name.given
|
|
20
|
+
? name.given
|
|
21
|
+
.trim()
|
|
22
|
+
.split(' ')
|
|
23
|
+
.map((part) => part.substr(0, 1).toUpperCase() + '.')
|
|
24
|
+
.join('')
|
|
25
|
+
: '';
|
|
26
|
+
exports.initials = initials;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2019 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -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, { useCallback, useState } from 'react';
|
|
17
|
+
import { affiliationsOptions } from '../../lib/authors';
|
|
18
|
+
import AffiliationsEditorView from './AffiliationsEditorView';
|
|
19
|
+
const AffiliationsEditor = ({ affiliations, authorAffiliations, addAuthorAffiliation, updateAffiliation, removeAuthorAffiliation, components, styleOverrides, }) => {
|
|
20
|
+
const [searchText, setSearchText] = useState('');
|
|
21
|
+
const handleChoose = useCallback((value) => {
|
|
22
|
+
if (value) {
|
|
23
|
+
const selectedAffiliation = value;
|
|
24
|
+
addAuthorAffiliation(selectedAffiliation.value);
|
|
25
|
+
}
|
|
26
|
+
setSearchText('');
|
|
27
|
+
}, [addAuthorAffiliation]);
|
|
28
|
+
const options = affiliationsOptions(affiliations, authorAffiliations);
|
|
29
|
+
const active = authorAffiliations
|
|
30
|
+
? authorAffiliations.map((item) => item.data)
|
|
31
|
+
: [];
|
|
32
|
+
return (React.createElement(AffiliationsEditorView, { options: options, selected: active, updateAffiliation: updateAffiliation, removeAuthorAffiliation: removeAuthorAffiliation, components: components, styleOverrides: styleOverrides, handleChoose: handleChoose, handleInputChange: setSearchText, inputValue: searchText }));
|
|
33
|
+
};
|
|
34
|
+
export default AffiliationsEditor;
|
|
@@ -0,0 +1,146 @@
|
|
|
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 Trashcan from '@manuscripts/assets/react/AnnotationRemove';
|
|
17
|
+
import ArrowDownBlue from '@manuscripts/assets/react/ArrowDownBlue';
|
|
18
|
+
import { Field, Form, Formik } from 'formik';
|
|
19
|
+
import React, { useCallback } from 'react';
|
|
20
|
+
import styled from 'styled-components';
|
|
21
|
+
import { affiliationLabel } from '../../lib/authors';
|
|
22
|
+
import { AutoSaveInput } from '../AutoSaveInput';
|
|
23
|
+
import { TextField } from '../TextField';
|
|
24
|
+
const Section = styled.section `
|
|
25
|
+
border: 1px solid ${(props) => props.theme.colors.border.field.default};
|
|
26
|
+
border-radius: ${(props) => props.theme.grid.radius.default};
|
|
27
|
+
background: ${(props) => props.theme.colors.background.primary};
|
|
28
|
+
margin-bottom: 2px;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
`;
|
|
31
|
+
const Title = styled.h4 `
|
|
32
|
+
margin: 0;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
font-size: 0.875rem;
|
|
36
|
+
padding-right: 0.5rem;
|
|
37
|
+
background: ${(props) => props.isInvalid ? props.theme.colors.background.warning : 'transparent'};
|
|
38
|
+
color: ${(props) => props.isInvalid ? props.theme.colors.text.warning : 'inherit'};
|
|
39
|
+
`;
|
|
40
|
+
const DropdownIndicator = styled(ArrowDownBlue) `
|
|
41
|
+
border: 0;
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
margin-right: 0.6em;
|
|
44
|
+
min-width: 20px;
|
|
45
|
+
`;
|
|
46
|
+
const ToggleButton = styled.button `
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
width: 100%;
|
|
51
|
+
background: transparent;
|
|
52
|
+
border: none;
|
|
53
|
+
text-align: left;
|
|
54
|
+
font-family: ${(props) => props.theme.font.family.sans};
|
|
55
|
+
font-size: 1rem;
|
|
56
|
+
padding: 0.6em 0.5em;
|
|
57
|
+
|
|
58
|
+
outline: none;
|
|
59
|
+
|
|
60
|
+
&:focus {
|
|
61
|
+
color: ${(props) => props.theme.colors.button.primary.border.hover};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
svg {
|
|
65
|
+
transform: ${(props) => (props.isOpen ? 'rotateX(180deg)' : 'initial')};
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
const RemoveButton = styled.button `
|
|
69
|
+
border: none;
|
|
70
|
+
background: transparent;
|
|
71
|
+
padding: 0;
|
|
72
|
+
|
|
73
|
+
outline: none;
|
|
74
|
+
|
|
75
|
+
&:focus path {
|
|
76
|
+
fill: ${(props) => props.theme.colors.button.primary.color.hover};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
svg {
|
|
80
|
+
width: 2rem;
|
|
81
|
+
height: 2rem;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
const AffiliationsForm = styled(Form) `
|
|
85
|
+
border: 1px solid ${(props) => props.theme.colors.border.field.default};
|
|
86
|
+
border-radius: ${(props) => props.theme.grid.radius.default};
|
|
87
|
+
margin: 0.4rem 0.71rem 0.71rem;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
`;
|
|
90
|
+
const AffiliationsTextField = styled(TextField) `
|
|
91
|
+
border-radius: 0;
|
|
92
|
+
border-bottom: none;
|
|
93
|
+
border-right: none;
|
|
94
|
+
border-left: none;
|
|
95
|
+
background: transparent;
|
|
96
|
+
&:first-child {
|
|
97
|
+
border-top: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&[aria-invalid] {
|
|
101
|
+
background: ${(props) => props.theme.colors.background.warning};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&[aria-invalid]:focus {
|
|
105
|
+
background: transparent;
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
const Columns = styled.div `
|
|
109
|
+
display: flex;
|
|
110
|
+
`;
|
|
111
|
+
const Column = styled.div `
|
|
112
|
+
flex: 1 1 auto;
|
|
113
|
+
max-width: 50%;
|
|
114
|
+
border-top: 1px solid ${(props) => props.theme.colors.border.field.default};
|
|
115
|
+
border-left: 1px solid ${(props) => props.theme.colors.border.field.default};
|
|
116
|
+
&:first-child {
|
|
117
|
+
border-left: none;
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
export const AffiliationsEditorItem = ({ affiliation, requestToggle, isOpen, updateAffiliation, removeAuthorAffiliation, }) => {
|
|
121
|
+
const remove = useCallback(() => {
|
|
122
|
+
removeAuthorAffiliation(affiliation);
|
|
123
|
+
}, [affiliation, removeAuthorAffiliation]);
|
|
124
|
+
const vivifiedAffiliation = Object.assign({ institution: '', department: '', addressLine1: '', addressLine2: '', addressLine3: '', city: '', county: '', country: '', postCode: '' }, affiliation);
|
|
125
|
+
const isInvalid = !vivifiedAffiliation.institution;
|
|
126
|
+
return (React.createElement(Section, null,
|
|
127
|
+
React.createElement(Title, { isInvalid: isInvalid },
|
|
128
|
+
React.createElement(ToggleButton, { type: "button", onClick: requestToggle, isOpen: isOpen },
|
|
129
|
+
React.createElement(DropdownIndicator, null,
|
|
130
|
+
React.createElement(ArrowDownBlue, null)),
|
|
131
|
+
affiliationLabel(affiliation)),
|
|
132
|
+
React.createElement(RemoveButton, { type: "button", "aria-label": "Delete this affiliation", onClick: remove },
|
|
133
|
+
React.createElement(Trashcan, null))),
|
|
134
|
+
isOpen && (React.createElement(Formik, { initialValues: vivifiedAffiliation, onSubmit: updateAffiliation }, () => (React.createElement(AffiliationsForm, null,
|
|
135
|
+
React.createElement(Field, { name: "institution" }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "Institution Name", isInvalid: isInvalid })))),
|
|
136
|
+
React.createElement(Field, { name: "department" }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "Department" })))),
|
|
137
|
+
React.createElement(Field, { name: "addressLine1" }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "Street Address" })))),
|
|
138
|
+
React.createElement(Columns, null,
|
|
139
|
+
React.createElement(Column, null,
|
|
140
|
+
React.createElement(Field, { name: "city" }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "City" })))),
|
|
141
|
+
React.createElement(Field, { name: "county" }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "State / Province" }))))),
|
|
142
|
+
React.createElement(Column, null,
|
|
143
|
+
React.createElement(Field, { name: "postCode" }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "Postal Code" })))),
|
|
144
|
+
React.createElement(Field, { name: "country" }, (props) => (React.createElement(AutoSaveInput, Object.assign({}, props, { component: AffiliationsTextField, saveOn: "blur", placeholder: "Country" }))))))))))));
|
|
145
|
+
};
|
|
146
|
+
export default AffiliationsEditorItem;
|
|
@@ -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 { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
|
+
import React, { useCallback, useState } from 'react';
|
|
18
|
+
import AffiliationsEditorView from './AffiliationsEditorView';
|
|
19
|
+
const AffiliationsEditorProfile = ({ affiliations, addAffiliation, updateAffiliation, removeAffiliation, components, styleOverrides, }) => {
|
|
20
|
+
const [searchText, setSearchText] = useState('');
|
|
21
|
+
const handleChoose = useCallback((value) => {
|
|
22
|
+
if (value) {
|
|
23
|
+
const selectedAffiliation = value;
|
|
24
|
+
addAffiliation(selectedAffiliation.value);
|
|
25
|
+
}
|
|
26
|
+
setSearchText('');
|
|
27
|
+
}, [addAffiliation]);
|
|
28
|
+
const affiliationsArr = Array.from(affiliations.values());
|
|
29
|
+
const updateUserProfileAffiliation = useCallback((data) => {
|
|
30
|
+
updateAffiliation(Object.assign(Object.assign({}, data), { objectType: ObjectTypes.UserProfileAffiliation }));
|
|
31
|
+
}, [updateAffiliation]);
|
|
32
|
+
return (React.createElement(AffiliationsEditorView, { options: [], selected: affiliationsArr, updateAffiliation: updateUserProfileAffiliation, removeAuthorAffiliation: removeAffiliation, components: components, styleOverrides: styleOverrides, handleChoose: handleChoose, handleInputChange: setSearchText, inputValue: searchText }));
|
|
33
|
+
};
|
|
34
|
+
export default AffiliationsEditorProfile;
|
|
@@ -0,0 +1,52 @@
|
|
|
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, { useContext, useState } from 'react';
|
|
17
|
+
import CreatableSelect from 'react-select/creatable';
|
|
18
|
+
import { ThemeContext } from 'styled-components';
|
|
19
|
+
import { defaultAuthorFormComponents, } from '../AuthorForm/AuthorFormComponents';
|
|
20
|
+
import { AffiliationsEditorItem } from './AffiliationsEditorItem';
|
|
21
|
+
import { AddAffiliationIndicator, Container, Field, List } from './styles';
|
|
22
|
+
const reactSelectComponents = {
|
|
23
|
+
IndicatorsContainer: AddAffiliationIndicator,
|
|
24
|
+
};
|
|
25
|
+
const AffiliationsEditorView = ({ options, selected, updateAffiliation, removeAuthorAffiliation, handleChoose, handleInputChange, inputValue, components, styleOverrides, }) => {
|
|
26
|
+
const { Legend } = Object.assign(Object.assign({}, defaultAuthorFormComponents), components);
|
|
27
|
+
const [currentSection, setCurrentSection] = useState('');
|
|
28
|
+
const requestOpen = (id) => {
|
|
29
|
+
setCurrentSection(id === currentSection ? '' : id);
|
|
30
|
+
};
|
|
31
|
+
const theme = useContext(ThemeContext);
|
|
32
|
+
return (React.createElement(Container, null,
|
|
33
|
+
React.createElement(Legend, null, "Affiliations"),
|
|
34
|
+
React.createElement(Field, null,
|
|
35
|
+
React.createElement(List, null, selected &&
|
|
36
|
+
selected.map((affiliation) => {
|
|
37
|
+
const { _id } = affiliation;
|
|
38
|
+
return (React.createElement(AffiliationsEditorItem, { key: _id, affiliation: affiliation, isOpen: currentSection === _id, requestToggle: () => requestOpen(_id), updateAffiliation: updateAffiliation, removeAuthorAffiliation: removeAuthorAffiliation }));
|
|
39
|
+
})),
|
|
40
|
+
React.createElement(CreatableSelect, { isMulti: false, isClearable: false, options: options, onInputChange: (t) => handleInputChange(t), inputValue: inputValue, onChange: handleChoose, value: null, placeholder: "Begin typing to add affiliation", isValidNewOption: (currentText) => !!currentText, components: reactSelectComponents, noOptionsMessage: () => 'Type the name of an institution', styles: {
|
|
41
|
+
control: (provided, state) => (Object.assign(Object.assign({}, provided), { backgroundColor: state.isFocused
|
|
42
|
+
? theme.colors.background.fifth
|
|
43
|
+
: theme.colors.background.primary, borderColor: state.isFocused
|
|
44
|
+
? theme.colors.border.field.active
|
|
45
|
+
: theme.colors.border.field.default, '&:hover': {
|
|
46
|
+
backgroundColor: theme.colors.background.fifth,
|
|
47
|
+
}, borderRadius: theme.grid.radius.default, boxShadow: 'none', fontFamily: theme.font.family.sans })),
|
|
48
|
+
menu: (provided) => (Object.assign(Object.assign({}, provided), { zIndex: (styleOverrides && styleOverrides.menuZIndex) ||
|
|
49
|
+
provided.zIndex })),
|
|
50
|
+
} }))));
|
|
51
|
+
};
|
|
52
|
+
export default AffiliationsEditorView;
|