@manuscripts/style-guide 1.7.2-LEAN-3083 → 1.7.3-LEAN-3181-0
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/AffiliationsList.js +43 -0
- package/dist/cjs/components/AuthorsContainer.js +71 -0
- package/dist/cjs/components/AuthorsList/Author.js +99 -0
- package/dist/cjs/components/AuthorsList/AuthorsList.js +52 -0
- package/dist/cjs/components/AuthorsList/index.js +32 -0
- package/dist/cjs/components/FileManager/FileManager.js +2 -2
- package/dist/cjs/components/References/ReferencesModal.js +8 -1
- package/dist/cjs/hooks/use-files.js +4 -18
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/lib/files.js +34 -47
- package/dist/es/components/AffiliationsList.js +36 -0
- package/dist/es/components/AuthorsContainer.js +41 -0
- package/dist/es/components/AuthorsList/Author.js +69 -0
- package/dist/es/components/AuthorsList/AuthorsList.js +45 -0
- package/dist/es/components/AuthorsList/index.js +16 -0
- package/dist/es/components/FileManager/FileManager.js +2 -2
- package/dist/es/components/References/ReferencesModal.js +8 -1
- package/dist/es/hooks/use-files.js +4 -18
- package/dist/es/index.js +3 -0
- package/dist/es/lib/files.js +34 -47
- package/dist/types/components/AffiliationsList.d.ts +22 -0
- package/dist/types/components/AuthorsContainer.d.ts +25 -0
- package/dist/types/components/AuthorsList/Author.d.ts +29 -0
- package/dist/types/components/AuthorsList/AuthorsList.d.ts +28 -0
- package/dist/types/components/AuthorsList/index.d.ts +16 -0
- package/dist/types/components/FileManager/FileManager.d.ts +2 -0
- package/dist/types/hooks/use-files.d.ts +2 -2
- package/dist/types/index.d.ts +3 -0
- package/dist/types/lib/files.d.ts +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.AffiliationsList = void 0;
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
24
|
+
const formatAddress_1 = __importDefault(require("../lib/formatAddress"));
|
|
25
|
+
const Container = styled_components_1.default.table `
|
|
26
|
+
border-collapse: collapse;
|
|
27
|
+
font: inherit;
|
|
28
|
+
color: ${(props) => props.theme.colors.text.secondary};
|
|
29
|
+
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
30
|
+
`;
|
|
31
|
+
const Header = styled_components_1.default.th `
|
|
32
|
+
font-weight: ${(props) => props.theme.font.weight.normal}
|
|
33
|
+
padding: 0 4px 0 0;
|
|
34
|
+
vertical-align: top;
|
|
35
|
+
`;
|
|
36
|
+
const Body = styled_components_1.default.td `
|
|
37
|
+
padding: 0;
|
|
38
|
+
`;
|
|
39
|
+
const AffiliationsList = ({ affiliations, }) => (react_1.default.createElement(Container, null,
|
|
40
|
+
react_1.default.createElement("tbody", null, Array.from(affiliations.values()).map((affiliation, index) => (react_1.default.createElement("tr", { key: affiliation._id },
|
|
41
|
+
react_1.default.createElement(Header, null, index + 1),
|
|
42
|
+
react_1.default.createElement(Body, null, (0, formatAddress_1.default)(affiliation))))))));
|
|
43
|
+
exports.AffiliationsList = AffiliationsList;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2021 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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.AuthorsContainer = void 0;
|
|
45
|
+
const react_1 = __importStar(require("react"));
|
|
46
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
47
|
+
const AffiliationsList_1 = require("./AffiliationsList");
|
|
48
|
+
const AuthorsList_1 = require("./AuthorsList");
|
|
49
|
+
const AuthorsContainer = ({ authorData, showEditButton, startEditing, selectAuthor, disableEditButton, }) => {
|
|
50
|
+
const authorAffiliations = (0, react_1.useMemo)(() => authorData.authors.filter((author) => author.role === 'author'), [authorData.authors]);
|
|
51
|
+
const isThereJointContributor = (0, react_1.useMemo)(() => authorData.authors.find((contributor) => contributor.isJointContributor), [authorData.authors]);
|
|
52
|
+
return (react_1.default.createElement(Container, { "data-cy": 'author-container' },
|
|
53
|
+
react_1.default.createElement(AuthorsList_1.AuthorsList, { authors: authorAffiliations, authorAffiliations: authorData.authorAffiliations, startEditing: startEditing, showEditButton: showEditButton, selectAuthor: selectAuthor, disableEditButton: disableEditButton }),
|
|
54
|
+
react_1.default.createElement(AffiliationsList_1.AffiliationsList, { affiliations: authorData.affiliations }),
|
|
55
|
+
isThereJointContributor && (react_1.default.createElement(LegendWrapper, null,
|
|
56
|
+
react_1.default.createElement(Legend, null, "\u2020"),
|
|
57
|
+
"These authors contributed equally to this work."))));
|
|
58
|
+
};
|
|
59
|
+
exports.AuthorsContainer = AuthorsContainer;
|
|
60
|
+
const Container = styled_components_1.default.div `
|
|
61
|
+
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
62
|
+
`;
|
|
63
|
+
const LegendWrapper = styled_components_1.default.p `
|
|
64
|
+
margin: ${(props) => props.theme.grid.unit * 4}px 0 0 0;
|
|
65
|
+
`;
|
|
66
|
+
const Legend = styled_components_1.default.span `
|
|
67
|
+
display: inline-block;
|
|
68
|
+
font-size: 0.75em;
|
|
69
|
+
line-height: 1;
|
|
70
|
+
vertical-align: top;
|
|
71
|
+
`;
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.Author = void 0;
|
|
45
|
+
const react_1 = __importDefault(require("react"));
|
|
46
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
47
|
+
const AuthorName_1 = require("../AuthorName");
|
|
48
|
+
const AuthorNotes = styled_components_1.default.span `
|
|
49
|
+
display: inline-block;
|
|
50
|
+
font-size: 0.75em;
|
|
51
|
+
line-height: 1;
|
|
52
|
+
vertical-align: top;
|
|
53
|
+
`;
|
|
54
|
+
const LinkSharedStyles = (0, styled_components_1.css) `
|
|
55
|
+
text-decoration: none;
|
|
56
|
+
color: inherit;
|
|
57
|
+
outline: none;
|
|
58
|
+
|
|
59
|
+
&:not(:disabled) {
|
|
60
|
+
&:hover,
|
|
61
|
+
&:focus {
|
|
62
|
+
&,
|
|
63
|
+
span {
|
|
64
|
+
color: ${(props) => props.theme.colors.text.tertiary};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
const AuthorAffiliation = styled_components_1.default.span `
|
|
70
|
+
${LinkSharedStyles}
|
|
71
|
+
`;
|
|
72
|
+
const AuthorsContainer = styled_components_1.default.button `
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
background: transparent;
|
|
75
|
+
border: 0;
|
|
76
|
+
font-size: 1rem;
|
|
77
|
+
${LinkSharedStyles}
|
|
78
|
+
|
|
79
|
+
&:not(:disabled) {
|
|
80
|
+
&:hover {
|
|
81
|
+
text-decoration: underline;
|
|
82
|
+
cursor: pointer !important;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
const Author = ({ author, affiliations, jointFirstAuthor, startEditing, selectAuthor, showEditButton, disableEditButton, }) => (react_1.default.createElement("span", { key: author._id },
|
|
87
|
+
showEditButton ? (react_1.default.createElement(AuthorsContainer, { disabled: disableEditButton, onClick: (e) => {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
startEditing && startEditing();
|
|
90
|
+
selectAuthor && selectAuthor(author);
|
|
91
|
+
} },
|
|
92
|
+
react_1.default.createElement(AuthorName_1.AuthorName, { name: author.bibliographicName, email: (author.isCorresponding && author.email) || undefined }))) : (react_1.default.createElement(AuthorName_1.AuthorName, { name: author.bibliographicName, email: (author.isCorresponding && author.email) || undefined })),
|
|
93
|
+
affiliations && (react_1.default.createElement(AuthorNotes, null, affiliations.map((affiliation, index) => (react_1.default.createElement(react_1.default.Fragment, { key: affiliation.data._id },
|
|
94
|
+
!!index && ',',
|
|
95
|
+
react_1.default.createElement(AuthorAffiliation, null, affiliation.ordinal)))))),
|
|
96
|
+
author.isCorresponding && (react_1.default.createElement(AuthorNotes, { title: 'Corresponding author' }, "*")),
|
|
97
|
+
jointFirstAuthor && (react_1.default.createElement(AuthorNotes, { title: 'Joint contributor' }, "\u2020"))));
|
|
98
|
+
exports.Author = Author;
|
|
99
|
+
exports.default = exports.Author;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.AuthorsList = void 0;
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
24
|
+
const authors_1 = require("../../lib/authors");
|
|
25
|
+
const Button_1 = require("../Button");
|
|
26
|
+
const Author_1 = require("./Author");
|
|
27
|
+
const AuthorsContainer = styled_components_1.default.div `
|
|
28
|
+
align-items: center;
|
|
29
|
+
display: flex;
|
|
30
|
+
|
|
31
|
+
@media (min-width: 768px) {
|
|
32
|
+
& ${Button_1.PrimaryButton} {
|
|
33
|
+
display: ${(props) => (props.isEmpty ? 'initial' : 'none')};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:hover ${Button_1.PrimaryButton} {
|
|
37
|
+
display: initial;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
const AuthorsActions = styled_components_1.default.div `
|
|
42
|
+
align-items: center;
|
|
43
|
+
display: flex;
|
|
44
|
+
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
45
|
+
`;
|
|
46
|
+
const AuthorsList = ({ authors, authorAffiliations, startEditing, showEditButton, disableEditButton, selectAuthor, }) => (react_1.default.createElement(AuthorsContainer, { isEmpty: !authors.length },
|
|
47
|
+
react_1.default.createElement("div", null, authors.map((author, index) => (react_1.default.createElement(react_1.default.Fragment, { key: author._id },
|
|
48
|
+
!!index && ', ',
|
|
49
|
+
react_1.default.createElement(Author_1.Author, { author: author, jointFirstAuthor: (0, authors_1.isJointFirstAuthor)(authors, index), affiliations: authorAffiliations.get(author._id), selectAuthor: selectAuthor, startEditing: startEditing, showEditButton: showEditButton, disableEditButton: disableEditButton }))))),
|
|
50
|
+
showEditButton && startEditing && (react_1.default.createElement(AuthorsActions, null,
|
|
51
|
+
react_1.default.createElement(Button_1.PrimaryButton, { mini: true, onClick: startEditing, className: 'edit_authors_button', disabled: disableEditButton }, "Edit Authors")))));
|
|
52
|
+
exports.AuthorsList = AuthorsList;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
29
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
__exportStar(require("./AuthorsList"), exports);
|
|
@@ -35,8 +35,8 @@ const InlineFilesSection_1 = require("./InlineFilesSection");
|
|
|
35
35
|
const OtherFilesSection_1 = require("./OtherFilesSection");
|
|
36
36
|
const SupplementsSection_1 = require("./SupplementsSection");
|
|
37
37
|
exports.PermissionsContext = (0, react_1.createContext)(null);
|
|
38
|
-
const FileManager = ({ files, fileManagement, modelMap, saveModel, deleteModel, enableDragAndDrop, can, }) => {
|
|
39
|
-
const { inlineFiles, supplements, otherFiles } = (0, index_1.useFiles)(
|
|
38
|
+
const FileManager = ({ files, fileManagement, doc, modelMap, saveModel, deleteModel, enableDragAndDrop, can, }) => {
|
|
39
|
+
const { inlineFiles, supplements, otherFiles } = (0, index_1.useFiles)(doc, files);
|
|
40
40
|
return (react_1.default.createElement(FileManagerProvider_1.FileManagerProvider, { saveModel: saveModel, deleteModel: deleteModel, modelMap: modelMap, fileManagement: fileManagement },
|
|
41
41
|
react_1.default.createElement(DragLayer_1.DragLayer, null),
|
|
42
42
|
react_1.default.createElement(exports.PermissionsContext.Provider, { value: can },
|
|
@@ -175,6 +175,13 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
175
175
|
setSelection(item);
|
|
176
176
|
setConfirm(false);
|
|
177
177
|
};
|
|
178
|
+
const handleDelete = () => {
|
|
179
|
+
if (!selection) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
onDelete(selection);
|
|
183
|
+
setSelection(undefined);
|
|
184
|
+
};
|
|
178
185
|
const handleItemClick = (item) => {
|
|
179
186
|
const values = valuesRef.current;
|
|
180
187
|
if (values && selection && !(0, lodash_1.isEqual)(values, (0, exports.normalize)(selection))) {
|
|
@@ -214,6 +221,6 @@ const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts, onSave
|
|
|
214
221
|
(citationCounts.get(item._id) || 0) > 0 ? (react_1.default.createElement(CitationCount, { "data-tooltip-id": "citation-count-tooltip" }, citationCounts.get(item._id))) : (react_1.default.createElement(CitationCount, { className: "unused" }, "0"))),
|
|
215
222
|
react_1.default.createElement(ReferenceLine_1.ReferenceLine, { item: item }))))),
|
|
216
223
|
react_1.default.createElement(Tooltip_1.Tooltip, { id: "citation-count-tooltip", place: "bottom" }, "Number of times used in the document"))),
|
|
217
|
-
react_1.default.createElement(StyledModal_1.ScrollableModalContent, null, selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values: (0, exports.normalize)(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete:
|
|
224
|
+
react_1.default.createElement(StyledModal_1.ScrollableModalContent, null, selection && (react_1.default.createElement(ReferenceForm_1.ReferenceForm, { values: (0, exports.normalize)(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: handleDelete, onSave: save, actionsRef: actionsRef })))))));
|
|
218
225
|
};
|
|
219
226
|
exports.ReferencesModal = ReferencesModal;
|
|
@@ -1,39 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useFiles = void 0;
|
|
4
|
-
const json_schema_1 = require("@manuscripts/json-schema");
|
|
5
4
|
const files_1 = require("../lib/files");
|
|
6
5
|
const use_deep_compare_1 = require("./use-deep-compare");
|
|
7
|
-
const types = [
|
|
8
|
-
json_schema_1.ObjectTypes.Section,
|
|
9
|
-
json_schema_1.ObjectTypes.FigureElement,
|
|
10
|
-
json_schema_1.ObjectTypes.Figure,
|
|
11
|
-
json_schema_1.ObjectTypes.Supplement,
|
|
12
|
-
json_schema_1.ObjectTypes.ElementsOrder,
|
|
13
|
-
];
|
|
14
6
|
const getOtherFiles = (inlineFiles, supplements, files) => {
|
|
15
7
|
const excluded = new Set();
|
|
16
8
|
inlineFiles.flatMap((f) => f.files).forEach((f) => excluded.add(f.id));
|
|
17
9
|
supplements.forEach((s) => excluded.add(s.id));
|
|
18
10
|
return files.filter((f) => !excluded.has(f.id));
|
|
19
11
|
};
|
|
20
|
-
const useFiles = (
|
|
21
|
-
const models = [];
|
|
22
|
-
for (const [_, model] of modelMap.entries()) {
|
|
23
|
-
if (types.includes(model.objectType)) {
|
|
24
|
-
models.push(model);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
12
|
+
const useFiles = (doc, files) => {
|
|
27
13
|
return (0, use_deep_compare_1.useDeepCompareMemo)(() => {
|
|
28
|
-
const inlineFiles = (0, files_1.getInlineFiles)(
|
|
29
|
-
const supplements = (0, files_1.getSupplements)(
|
|
14
|
+
const inlineFiles = (0, files_1.getInlineFiles)(doc, files);
|
|
15
|
+
const supplements = (0, files_1.getSupplements)(doc, files);
|
|
30
16
|
const otherFiles = getOtherFiles(inlineFiles, supplements, files);
|
|
31
17
|
return {
|
|
32
18
|
inlineFiles,
|
|
33
19
|
supplements,
|
|
34
20
|
otherFiles,
|
|
35
21
|
};
|
|
36
|
-
}, [
|
|
22
|
+
}, [doc, files]);
|
|
37
23
|
};
|
|
38
24
|
exports.useFiles = useFiles;
|
|
39
25
|
exports.default = exports.useFiles;
|
package/dist/cjs/index.js
CHANGED
|
@@ -34,9 +34,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.errorsDecoder = exports.useDeepCompareCallback = exports.useDeepCompareMemo = void 0;
|
|
36
36
|
__exportStar(require("./components/AffiliationsEditor"), exports);
|
|
37
|
+
__exportStar(require("./components/AffiliationsList"), exports);
|
|
37
38
|
__exportStar(require("./components/AuthorForm"), exports);
|
|
38
39
|
__exportStar(require("./components/AuthorName"), exports);
|
|
40
|
+
__exportStar(require("./components/AuthorsList"), exports);
|
|
39
41
|
__exportStar(require("./components/AuthorsDND"), exports);
|
|
42
|
+
__exportStar(require("./components/AuthorsContainer"), exports);
|
|
40
43
|
__exportStar(require("./components/AlertMessage"), exports);
|
|
41
44
|
__exportStar(require("./components/Button"), exports);
|
|
42
45
|
__exportStar(require("./components/RadioButton"), exports);
|
package/dist/cjs/lib/files.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSupplements = exports.getInlineFiles = exports.isModelFile = void 0;
|
|
4
|
-
const
|
|
4
|
+
const transform_1 = require("@manuscripts/transform");
|
|
5
5
|
const util_1 = require("../components/FileManager/util");
|
|
6
6
|
const isModelFile = (file) => {
|
|
7
7
|
return file.modelId;
|
|
@@ -17,68 +17,55 @@ const MISSING_FILE = {
|
|
|
17
17
|
const getFile = (files, id) => {
|
|
18
18
|
return files.filter((f) => f.id === id)[0] || MISSING_FILE;
|
|
19
19
|
};
|
|
20
|
-
const getFigureFiles = (
|
|
20
|
+
const getFigureFiles = (figureElement, files) => {
|
|
21
21
|
const figureFiles = [];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const figure = model;
|
|
26
|
-
if (figure.src) {
|
|
27
|
-
figureFiles.push(Object.assign(Object.assign({}, getFile(files, figure.src)), { modelId: figure._id }));
|
|
28
|
-
}
|
|
22
|
+
figureElement.forEach((node) => {
|
|
23
|
+
if (node.type === transform_1.schema.nodes.figure) {
|
|
24
|
+
figureFiles.push(Object.assign(Object.assign({}, getFile(files, node.attrs.src)), { modelId: figureElement.attrs.id }));
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
return figureFiles;
|
|
32
28
|
};
|
|
33
29
|
const getSupplementFiles = (supplement, files) => {
|
|
34
|
-
if (supplement.href) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Object.assign(Object.assign({}, getFile(files, href)), { modelId: supplement._id }),
|
|
39
|
-
];
|
|
40
|
-
}
|
|
30
|
+
if (supplement.attrs.href) {
|
|
31
|
+
return [
|
|
32
|
+
Object.assign(Object.assign({}, getFile(files, supplement.attrs.href)), { modelId: supplement.attrs.id }),
|
|
33
|
+
];
|
|
41
34
|
}
|
|
42
35
|
return [];
|
|
43
36
|
};
|
|
44
|
-
const getInlineFiles = (
|
|
45
|
-
var _a;
|
|
37
|
+
const getInlineFiles = (doc, files) => {
|
|
46
38
|
const elements = [];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const figure = modelMap.get(id);
|
|
52
|
-
if (figure) {
|
|
39
|
+
doc.descendants((node, _, parent) => {
|
|
40
|
+
const isGraphicalAbstractFigure = (parent === null || parent === void 0 ? void 0 : parent.type) === transform_1.schema.nodes.section &&
|
|
41
|
+
(parent === null || parent === void 0 ? void 0 : parent.attrs.category) === 'MPSectionCategory:abstract-graphical';
|
|
42
|
+
if (node.type === transform_1.schema.nodes.figure_element) {
|
|
53
43
|
elements.push({
|
|
54
|
-
modelId: id,
|
|
55
|
-
type: util_1.FileType.GraphicalAbstract
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
modelId: node.attrs.id,
|
|
45
|
+
type: (isGraphicalAbstractFigure && util_1.FileType.GraphicalAbstract) ||
|
|
46
|
+
util_1.FileType.Figure,
|
|
47
|
+
label: (isGraphicalAbstractFigure && `Graphical Abstract`) ||
|
|
48
|
+
node.attrs.label,
|
|
49
|
+
files: getFigureFiles(node, files),
|
|
58
50
|
});
|
|
51
|
+
return false;
|
|
59
52
|
}
|
|
60
53
|
});
|
|
61
|
-
const figures = (0, json_schema_1.getModelsByType)(modelMap, json_schema_1.ObjectTypes.FigureElement);
|
|
62
|
-
const figureOrder = orders.get(json_schema_1.ObjectTypes.FigureElement);
|
|
63
|
-
if (figureOrder) {
|
|
64
|
-
}
|
|
65
|
-
figures === null || figures === void 0 ? void 0 : figures.filter((f) => !(graphicalAbstractElementIds === null || graphicalAbstractElementIds === void 0 ? void 0 : graphicalAbstractElementIds.includes(f._id))).map((figure, index) => ({
|
|
66
|
-
modelId: figure._id,
|
|
67
|
-
type: util_1.FileType.Figure,
|
|
68
|
-
label: `Figure ${index + 1}`,
|
|
69
|
-
files: getFigureFiles(figure, modelMap, files),
|
|
70
|
-
})).forEach((e) => elements.push(e));
|
|
71
54
|
return elements;
|
|
72
55
|
};
|
|
73
56
|
exports.getInlineFiles = getInlineFiles;
|
|
74
|
-
const getSupplements = (
|
|
75
|
-
const supplements =
|
|
76
|
-
|
|
57
|
+
const getSupplements = (doc, files) => {
|
|
58
|
+
const supplements = [];
|
|
59
|
+
doc.descendants((node) => {
|
|
60
|
+
if (node.type === transform_1.schema.nodes.supplements) {
|
|
61
|
+
node.forEach((child) => {
|
|
62
|
+
if (child.type === transform_1.schema.nodes.supplement) {
|
|
63
|
+
supplements.push(...getSupplementFiles(child, files));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return supplements;
|
|
77
70
|
};
|
|
78
71
|
exports.getSupplements = getSupplements;
|
|
79
|
-
const getOrderByType = (modelMap) => {
|
|
80
|
-
const groups = new Map();
|
|
81
|
-
const orders = (0, json_schema_1.getModelsByType)(modelMap, json_schema_1.ObjectTypes.ElementsOrder);
|
|
82
|
-
orders.forEach((o) => groups.set(o.elementType, o));
|
|
83
|
-
return groups;
|
|
84
|
-
};
|
|
@@ -0,0 +1,36 @@
|
|
|
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 styled from 'styled-components';
|
|
18
|
+
import formatAddress from '../lib/formatAddress';
|
|
19
|
+
const Container = styled.table `
|
|
20
|
+
border-collapse: collapse;
|
|
21
|
+
font: inherit;
|
|
22
|
+
color: ${(props) => props.theme.colors.text.secondary};
|
|
23
|
+
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
24
|
+
`;
|
|
25
|
+
const Header = styled.th `
|
|
26
|
+
font-weight: ${(props) => props.theme.font.weight.normal}
|
|
27
|
+
padding: 0 4px 0 0;
|
|
28
|
+
vertical-align: top;
|
|
29
|
+
`;
|
|
30
|
+
const Body = styled.td `
|
|
31
|
+
padding: 0;
|
|
32
|
+
`;
|
|
33
|
+
export const AffiliationsList = ({ affiliations, }) => (React.createElement(Container, null,
|
|
34
|
+
React.createElement("tbody", null, Array.from(affiliations.values()).map((affiliation, index) => (React.createElement("tr", { key: affiliation._id },
|
|
35
|
+
React.createElement(Header, null, index + 1),
|
|
36
|
+
React.createElement(Body, null, formatAddress(affiliation))))))));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2021 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, { useMemo } from 'react';
|
|
17
|
+
import styled from 'styled-components';
|
|
18
|
+
import { AffiliationsList } from './AffiliationsList';
|
|
19
|
+
import { AuthorsList } from './AuthorsList';
|
|
20
|
+
export const AuthorsContainer = ({ authorData, showEditButton, startEditing, selectAuthor, disableEditButton, }) => {
|
|
21
|
+
const authorAffiliations = useMemo(() => authorData.authors.filter((author) => author.role === 'author'), [authorData.authors]);
|
|
22
|
+
const isThereJointContributor = useMemo(() => authorData.authors.find((contributor) => contributor.isJointContributor), [authorData.authors]);
|
|
23
|
+
return (React.createElement(Container, { "data-cy": 'author-container' },
|
|
24
|
+
React.createElement(AuthorsList, { authors: authorAffiliations, authorAffiliations: authorData.authorAffiliations, startEditing: startEditing, showEditButton: showEditButton, selectAuthor: selectAuthor, disableEditButton: disableEditButton }),
|
|
25
|
+
React.createElement(AffiliationsList, { affiliations: authorData.affiliations }),
|
|
26
|
+
isThereJointContributor && (React.createElement(LegendWrapper, null,
|
|
27
|
+
React.createElement(Legend, null, "\u2020"),
|
|
28
|
+
"These authors contributed equally to this work."))));
|
|
29
|
+
};
|
|
30
|
+
const Container = styled.div `
|
|
31
|
+
margin-top: ${(props) => props.theme.grid.unit * 4}px;
|
|
32
|
+
`;
|
|
33
|
+
const LegendWrapper = styled.p `
|
|
34
|
+
margin: ${(props) => props.theme.grid.unit * 4}px 0 0 0;
|
|
35
|
+
`;
|
|
36
|
+
const Legend = styled.span `
|
|
37
|
+
display: inline-block;
|
|
38
|
+
font-size: 0.75em;
|
|
39
|
+
line-height: 1;
|
|
40
|
+
vertical-align: top;
|
|
41
|
+
`;
|
|
@@ -0,0 +1,69 @@
|
|
|
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 styled, { css } from 'styled-components';
|
|
18
|
+
import { AuthorName } from '../AuthorName';
|
|
19
|
+
const AuthorNotes = styled.span `
|
|
20
|
+
display: inline-block;
|
|
21
|
+
font-size: 0.75em;
|
|
22
|
+
line-height: 1;
|
|
23
|
+
vertical-align: top;
|
|
24
|
+
`;
|
|
25
|
+
const LinkSharedStyles = css `
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
color: inherit;
|
|
28
|
+
outline: none;
|
|
29
|
+
|
|
30
|
+
&:not(:disabled) {
|
|
31
|
+
&:hover,
|
|
32
|
+
&:focus {
|
|
33
|
+
&,
|
|
34
|
+
span {
|
|
35
|
+
color: ${(props) => props.theme.colors.text.tertiary};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const AuthorAffiliation = styled.span `
|
|
41
|
+
${LinkSharedStyles}
|
|
42
|
+
`;
|
|
43
|
+
const AuthorsContainer = styled.button `
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
background: transparent;
|
|
46
|
+
border: 0;
|
|
47
|
+
font-size: 1rem;
|
|
48
|
+
${LinkSharedStyles}
|
|
49
|
+
|
|
50
|
+
&:not(:disabled) {
|
|
51
|
+
&:hover {
|
|
52
|
+
text-decoration: underline;
|
|
53
|
+
cursor: pointer !important;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
export const Author = ({ author, affiliations, jointFirstAuthor, startEditing, selectAuthor, showEditButton, disableEditButton, }) => (React.createElement("span", { key: author._id },
|
|
58
|
+
showEditButton ? (React.createElement(AuthorsContainer, { disabled: disableEditButton, onClick: (e) => {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
startEditing && startEditing();
|
|
61
|
+
selectAuthor && selectAuthor(author);
|
|
62
|
+
} },
|
|
63
|
+
React.createElement(AuthorName, { name: author.bibliographicName, email: (author.isCorresponding && author.email) || undefined }))) : (React.createElement(AuthorName, { name: author.bibliographicName, email: (author.isCorresponding && author.email) || undefined })),
|
|
64
|
+
affiliations && (React.createElement(AuthorNotes, null, affiliations.map((affiliation, index) => (React.createElement(React.Fragment, { key: affiliation.data._id },
|
|
65
|
+
!!index && ',',
|
|
66
|
+
React.createElement(AuthorAffiliation, null, affiliation.ordinal)))))),
|
|
67
|
+
author.isCorresponding && (React.createElement(AuthorNotes, { title: 'Corresponding author' }, "*")),
|
|
68
|
+
jointFirstAuthor && (React.createElement(AuthorNotes, { title: 'Joint contributor' }, "\u2020"))));
|
|
69
|
+
export default Author;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 styled from 'styled-components';
|
|
18
|
+
import { isJointFirstAuthor } from '../../lib/authors';
|
|
19
|
+
import { PrimaryButton } from '../Button';
|
|
20
|
+
import { Author } from './Author';
|
|
21
|
+
const AuthorsContainer = styled.div `
|
|
22
|
+
align-items: center;
|
|
23
|
+
display: flex;
|
|
24
|
+
|
|
25
|
+
@media (min-width: 768px) {
|
|
26
|
+
& ${PrimaryButton} {
|
|
27
|
+
display: ${(props) => (props.isEmpty ? 'initial' : 'none')};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:hover ${PrimaryButton} {
|
|
31
|
+
display: initial;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const AuthorsActions = styled.div `
|
|
36
|
+
align-items: center;
|
|
37
|
+
display: flex;
|
|
38
|
+
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
39
|
+
`;
|
|
40
|
+
export const AuthorsList = ({ authors, authorAffiliations, startEditing, showEditButton, disableEditButton, selectAuthor, }) => (React.createElement(AuthorsContainer, { isEmpty: !authors.length },
|
|
41
|
+
React.createElement("div", null, authors.map((author, index) => (React.createElement(React.Fragment, { key: author._id },
|
|
42
|
+
!!index && ', ',
|
|
43
|
+
React.createElement(Author, { author: author, jointFirstAuthor: isJointFirstAuthor(authors, index), affiliations: authorAffiliations.get(author._id), selectAuthor: selectAuthor, startEditing: startEditing, showEditButton: showEditButton, disableEditButton: disableEditButton }))))),
|
|
44
|
+
showEditButton && startEditing && (React.createElement(AuthorsActions, null,
|
|
45
|
+
React.createElement(PrimaryButton, { mini: true, onClick: startEditing, className: 'edit_authors_button', disabled: disableEditButton }, "Edit Authors")))));
|
|
@@ -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 * from './AuthorsList';
|
|
@@ -9,8 +9,8 @@ import { InlineFilesSection } from './InlineFilesSection';
|
|
|
9
9
|
import { OtherFilesSection } from './OtherFilesSection';
|
|
10
10
|
import { SupplementsSection } from './SupplementsSection';
|
|
11
11
|
export const PermissionsContext = createContext(null);
|
|
12
|
-
export const FileManager = ({ files, fileManagement, modelMap, saveModel, deleteModel, enableDragAndDrop, can, }) => {
|
|
13
|
-
const { inlineFiles, supplements, otherFiles } = useFiles(
|
|
12
|
+
export const FileManager = ({ files, fileManagement, doc, modelMap, saveModel, deleteModel, enableDragAndDrop, can, }) => {
|
|
13
|
+
const { inlineFiles, supplements, otherFiles } = useFiles(doc, files);
|
|
14
14
|
return (React.createElement(FileManagerProvider, { saveModel: saveModel, deleteModel: deleteModel, modelMap: modelMap, fileManagement: fileManagement },
|
|
15
15
|
React.createElement(DragLayer, null),
|
|
16
16
|
React.createElement(PermissionsContext.Provider, { value: can },
|
|
@@ -145,6 +145,13 @@ export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts,
|
|
|
145
145
|
setSelection(item);
|
|
146
146
|
setConfirm(false);
|
|
147
147
|
};
|
|
148
|
+
const handleDelete = () => {
|
|
149
|
+
if (!selection) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
onDelete(selection);
|
|
153
|
+
setSelection(undefined);
|
|
154
|
+
};
|
|
148
155
|
const handleItemClick = (item) => {
|
|
149
156
|
const values = valuesRef.current;
|
|
150
157
|
if (values && selection && !isEqual(values, normalize(selection))) {
|
|
@@ -184,5 +191,5 @@ export const ReferencesModal = ({ isOpen, onCancel, items, item, citationCounts,
|
|
|
184
191
|
(citationCounts.get(item._id) || 0) > 0 ? (React.createElement(CitationCount, { "data-tooltip-id": "citation-count-tooltip" }, citationCounts.get(item._id))) : (React.createElement(CitationCount, { className: "unused" }, "0"))),
|
|
185
192
|
React.createElement(ReferenceLine, { item: item }))))),
|
|
186
193
|
React.createElement(Tooltip, { id: "citation-count-tooltip", place: "bottom" }, "Number of times used in the document"))),
|
|
187
|
-
React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete:
|
|
194
|
+
React.createElement(ScrollableModalContent, null, selection && (React.createElement(ReferenceForm, { values: normalize(selection), showDelete: !citationCounts.get(selection._id), onChange: handleChange, onCancel: onCancel, onDelete: handleDelete, onSave: save, actionsRef: actionsRef })))))));
|
|
188
195
|
};
|
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
2
1
|
import { getInlineFiles, getSupplements, } from '../lib/files';
|
|
3
2
|
import { useDeepCompareMemo } from './use-deep-compare';
|
|
4
|
-
const types = [
|
|
5
|
-
ObjectTypes.Section,
|
|
6
|
-
ObjectTypes.FigureElement,
|
|
7
|
-
ObjectTypes.Figure,
|
|
8
|
-
ObjectTypes.Supplement,
|
|
9
|
-
ObjectTypes.ElementsOrder,
|
|
10
|
-
];
|
|
11
3
|
const getOtherFiles = (inlineFiles, supplements, files) => {
|
|
12
4
|
const excluded = new Set();
|
|
13
5
|
inlineFiles.flatMap((f) => f.files).forEach((f) => excluded.add(f.id));
|
|
14
6
|
supplements.forEach((s) => excluded.add(s.id));
|
|
15
7
|
return files.filter((f) => !excluded.has(f.id));
|
|
16
8
|
};
|
|
17
|
-
export const useFiles = (
|
|
18
|
-
const models = [];
|
|
19
|
-
for (const [_, model] of modelMap.entries()) {
|
|
20
|
-
if (types.includes(model.objectType)) {
|
|
21
|
-
models.push(model);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
9
|
+
export const useFiles = (doc, files) => {
|
|
24
10
|
return useDeepCompareMemo(() => {
|
|
25
|
-
const inlineFiles = getInlineFiles(
|
|
26
|
-
const supplements = getSupplements(
|
|
11
|
+
const inlineFiles = getInlineFiles(doc, files);
|
|
12
|
+
const supplements = getSupplements(doc, files);
|
|
27
13
|
const otherFiles = getOtherFiles(inlineFiles, supplements, files);
|
|
28
14
|
return {
|
|
29
15
|
inlineFiles,
|
|
30
16
|
supplements,
|
|
31
17
|
otherFiles,
|
|
32
18
|
};
|
|
33
|
-
}, [
|
|
19
|
+
}, [doc, files]);
|
|
34
20
|
};
|
|
35
21
|
export default useFiles;
|
package/dist/es/index.js
CHANGED
|
@@ -14,9 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export * from './components/AffiliationsEditor';
|
|
17
|
+
export * from './components/AffiliationsList';
|
|
17
18
|
export * from './components/AuthorForm';
|
|
18
19
|
export * from './components/AuthorName';
|
|
20
|
+
export * from './components/AuthorsList';
|
|
19
21
|
export * from './components/AuthorsDND';
|
|
22
|
+
export * from './components/AuthorsContainer';
|
|
20
23
|
export * from './components/AlertMessage';
|
|
21
24
|
export * from './components/Button';
|
|
22
25
|
export * from './components/RadioButton';
|
package/dist/es/lib/files.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { schema } from '@manuscripts/transform';
|
|
2
2
|
import { FileType } from '../components/FileManager/util';
|
|
3
3
|
export const isModelFile = (file) => {
|
|
4
4
|
return file.modelId;
|
|
@@ -13,66 +13,53 @@ const MISSING_FILE = {
|
|
|
13
13
|
const getFile = (files, id) => {
|
|
14
14
|
return files.filter((f) => f.id === id)[0] || MISSING_FILE;
|
|
15
15
|
};
|
|
16
|
-
const getFigureFiles = (
|
|
16
|
+
const getFigureFiles = (figureElement, files) => {
|
|
17
17
|
const figureFiles = [];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const figure = model;
|
|
22
|
-
if (figure.src) {
|
|
23
|
-
figureFiles.push(Object.assign(Object.assign({}, getFile(files, figure.src)), { modelId: figure._id }));
|
|
24
|
-
}
|
|
18
|
+
figureElement.forEach((node) => {
|
|
19
|
+
if (node.type === schema.nodes.figure) {
|
|
20
|
+
figureFiles.push(Object.assign(Object.assign({}, getFile(files, node.attrs.src)), { modelId: figureElement.attrs.id }));
|
|
25
21
|
}
|
|
26
22
|
});
|
|
27
23
|
return figureFiles;
|
|
28
24
|
};
|
|
29
25
|
const getSupplementFiles = (supplement, files) => {
|
|
30
|
-
if (supplement.href) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Object.assign(Object.assign({}, getFile(files, href)), { modelId: supplement._id }),
|
|
35
|
-
];
|
|
36
|
-
}
|
|
26
|
+
if (supplement.attrs.href) {
|
|
27
|
+
return [
|
|
28
|
+
Object.assign(Object.assign({}, getFile(files, supplement.attrs.href)), { modelId: supplement.attrs.id }),
|
|
29
|
+
];
|
|
37
30
|
}
|
|
38
31
|
return [];
|
|
39
32
|
};
|
|
40
|
-
export const getInlineFiles = (
|
|
41
|
-
var _a;
|
|
33
|
+
export const getInlineFiles = (doc, files) => {
|
|
42
34
|
const elements = [];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const figure = modelMap.get(id);
|
|
48
|
-
if (figure) {
|
|
35
|
+
doc.descendants((node, _, parent) => {
|
|
36
|
+
const isGraphicalAbstractFigure = (parent === null || parent === void 0 ? void 0 : parent.type) === schema.nodes.section &&
|
|
37
|
+
(parent === null || parent === void 0 ? void 0 : parent.attrs.category) === 'MPSectionCategory:abstract-graphical';
|
|
38
|
+
if (node.type === schema.nodes.figure_element) {
|
|
49
39
|
elements.push({
|
|
50
|
-
modelId: id,
|
|
51
|
-
type: FileType.GraphicalAbstract
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
modelId: node.attrs.id,
|
|
41
|
+
type: (isGraphicalAbstractFigure && FileType.GraphicalAbstract) ||
|
|
42
|
+
FileType.Figure,
|
|
43
|
+
label: (isGraphicalAbstractFigure && `Graphical Abstract`) ||
|
|
44
|
+
node.attrs.label,
|
|
45
|
+
files: getFigureFiles(node, files),
|
|
54
46
|
});
|
|
47
|
+
return false;
|
|
55
48
|
}
|
|
56
49
|
});
|
|
57
|
-
const figures = getModelsByType(modelMap, ObjectTypes.FigureElement);
|
|
58
|
-
const figureOrder = orders.get(ObjectTypes.FigureElement);
|
|
59
|
-
if (figureOrder) {
|
|
60
|
-
}
|
|
61
|
-
figures === null || figures === void 0 ? void 0 : figures.filter((f) => !(graphicalAbstractElementIds === null || graphicalAbstractElementIds === void 0 ? void 0 : graphicalAbstractElementIds.includes(f._id))).map((figure, index) => ({
|
|
62
|
-
modelId: figure._id,
|
|
63
|
-
type: FileType.Figure,
|
|
64
|
-
label: `Figure ${index + 1}`,
|
|
65
|
-
files: getFigureFiles(figure, modelMap, files),
|
|
66
|
-
})).forEach((e) => elements.push(e));
|
|
67
50
|
return elements;
|
|
68
51
|
};
|
|
69
|
-
export const getSupplements = (
|
|
70
|
-
const supplements =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
52
|
+
export const getSupplements = (doc, files) => {
|
|
53
|
+
const supplements = [];
|
|
54
|
+
doc.descendants((node) => {
|
|
55
|
+
if (node.type === schema.nodes.supplements) {
|
|
56
|
+
node.forEach((child) => {
|
|
57
|
+
if (child.type === schema.nodes.supplement) {
|
|
58
|
+
supplements.push(...getSupplementFiles(child, files));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return supplements;
|
|
78
65
|
};
|
|
@@ -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
|
+
import React from 'react';
|
|
17
|
+
import { AffiliationMap } from '../types';
|
|
18
|
+
interface Props {
|
|
19
|
+
affiliations: AffiliationMap;
|
|
20
|
+
}
|
|
21
|
+
export declare const AffiliationsList: React.FunctionComponent<Props>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2021 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 } from '@manuscripts/json-schema';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { AuthorData } from '../types';
|
|
19
|
+
export declare const AuthorsContainer: React.FC<{
|
|
20
|
+
authorData: AuthorData;
|
|
21
|
+
showEditButton: boolean;
|
|
22
|
+
disableEditButton?: boolean;
|
|
23
|
+
startEditing: () => void;
|
|
24
|
+
selectAuthor: (data: Contributor) => void;
|
|
25
|
+
}>;
|
|
@@ -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 } from '@manuscripts/json-schema';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { AuthorAffiliation as AuthorAffiliationT } from '../../types';
|
|
19
|
+
interface AuthorProps {
|
|
20
|
+
author: Contributor;
|
|
21
|
+
affiliations?: AuthorAffiliationT[];
|
|
22
|
+
jointFirstAuthor: boolean;
|
|
23
|
+
showEditButton?: boolean;
|
|
24
|
+
disableEditButton?: boolean;
|
|
25
|
+
selectAuthor?: (data: Contributor) => void;
|
|
26
|
+
startEditing?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const Author: React.FunctionComponent<AuthorProps>;
|
|
29
|
+
export default Author;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 } from '@manuscripts/json-schema';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { AuthorAffiliation } from '../../types';
|
|
19
|
+
interface Props {
|
|
20
|
+
authors: Contributor[];
|
|
21
|
+
authorAffiliations: Map<string, AuthorAffiliation[]>;
|
|
22
|
+
showEditButton?: boolean;
|
|
23
|
+
disableEditButton?: boolean;
|
|
24
|
+
startEditing?: () => void;
|
|
25
|
+
selectAuthor?: (data: Contributor) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare const AuthorsList: React.FunctionComponent<Props>;
|
|
28
|
+
export {};
|
|
@@ -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 * from './AuthorsList';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Build, Model } from '@manuscripts/json-schema';
|
|
2
|
+
import { ManuscriptNode } from '@manuscripts/transform';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { FileSectionType } from '../../index';
|
|
4
5
|
import { Capabilities } from '../../lib/capabilities';
|
|
@@ -22,6 +23,7 @@ export declare const PermissionsContext: React.Context<Capabilities | null>;
|
|
|
22
23
|
export declare const FileManager: React.FC<{
|
|
23
24
|
files: FileAttachment[];
|
|
24
25
|
fileManagement: FileManagement;
|
|
26
|
+
doc: ManuscriptNode;
|
|
25
27
|
modelMap: Map<string, Model>;
|
|
26
28
|
saveModel: SaveModel;
|
|
27
29
|
deleteModel: DeleteModel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ManuscriptNode } from '@manuscripts/transform';
|
|
2
2
|
import { ElementFiles, FileAttachment, ModelFile } from '../lib/files';
|
|
3
|
-
export declare const useFiles: (
|
|
3
|
+
export declare const useFiles: (doc: ManuscriptNode, files: FileAttachment[]) => {
|
|
4
4
|
inlineFiles: ElementFiles[];
|
|
5
5
|
supplements: ModelFile[];
|
|
6
6
|
otherFiles: FileAttachment[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export { Theme } from './theme';
|
|
17
17
|
export * from './components/AffiliationsEditor';
|
|
18
|
+
export * from './components/AffiliationsList';
|
|
18
19
|
export * from './components/AuthorForm';
|
|
19
20
|
export * from './components/AuthorName';
|
|
21
|
+
export * from './components/AuthorsList';
|
|
20
22
|
export * from './components/AuthorsDND';
|
|
23
|
+
export * from './components/AuthorsContainer';
|
|
21
24
|
export * from './components/AlertMessage';
|
|
22
25
|
export * from './components/Button';
|
|
23
26
|
export * from './components/RadioButton';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ManuscriptNode } from '@manuscripts/transform';
|
|
2
2
|
import { FileType } from '../components/FileManager/util';
|
|
3
3
|
export type FileDesignation = {
|
|
4
4
|
id: string;
|
|
@@ -20,5 +20,5 @@ export type ElementFiles = {
|
|
|
20
20
|
files: ModelFile[];
|
|
21
21
|
};
|
|
22
22
|
export declare const isModelFile: (file: FileAttachment) => file is ModelFile;
|
|
23
|
-
export declare const getInlineFiles: (
|
|
24
|
-
export declare const getSupplements: (
|
|
23
|
+
export declare const getInlineFiles: (doc: ManuscriptNode, files: FileAttachment[]) => ElementFiles[];
|
|
24
|
+
export declare const getSupplements: (doc: ManuscriptNode, files: FileAttachment[]) => ModelFile[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.3-LEAN-3181-0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@manuscripts/assets": "^0.6.4",
|
|
36
36
|
"@manuscripts/json-schema": "^2.2.2",
|
|
37
|
-
"@manuscripts/transform": "2.0
|
|
37
|
+
"@manuscripts/transform": "^2.1.0",
|
|
38
38
|
"@reach/tabs": "^0.18.0",
|
|
39
39
|
"date-fns": "^2.29.3",
|
|
40
40
|
"formik": "^2.2.9",
|