@manuscripts/body-editor 3.12.17 → 3.12.20
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/commands.js +16 -24
- package/dist/cjs/components/affiliations/AffiliationForm.js +5 -6
- package/dist/cjs/components/affiliations/AffiliationsModal.js +21 -57
- package/dist/cjs/components/affiliations/AffiliationsPanel.js +22 -0
- package/dist/cjs/components/authors/AuthorDetailsForm.js +3 -4
- package/dist/cjs/components/authors/AuthorsModal.js +15 -48
- package/dist/cjs/components/authors/AuthorsPanel.js +18 -0
- package/dist/cjs/components/authors/useManageAffiliations.js +6 -4
- package/dist/cjs/components/authors-affiliations/AuthorsAndAffiliationsModals.js +134 -0
- package/dist/cjs/components/authors-affiliations/GenericPanel.js +136 -0
- package/dist/cjs/components/form/ModalFormActions.js +11 -5
- package/dist/cjs/keys/title.js +24 -10
- package/dist/cjs/lib/__tests__/plugins.test.js +2 -2
- package/dist/cjs/lib/context-menu.js +8 -9
- package/dist/cjs/plugins/objects.js +24 -19
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/affiliations.js +5 -11
- package/dist/cjs/views/caption.js +1 -1
- package/dist/cjs/views/contributors.js +4 -7
- package/dist/cjs/views/figure.js +0 -1
- package/dist/es/commands.js +16 -24
- package/dist/es/components/affiliations/AffiliationForm.js +5 -6
- package/dist/es/components/affiliations/AffiliationsModal.js +21 -53
- package/dist/es/components/affiliations/AffiliationsPanel.js +15 -0
- package/dist/es/components/authors/AuthorDetailsForm.js +3 -4
- package/dist/es/components/authors/AuthorsModal.js +15 -45
- package/dist/es/components/authors/AuthorsPanel.js +11 -0
- package/dist/es/components/authors/useManageAffiliations.js +7 -5
- package/dist/es/components/authors-affiliations/AuthorsAndAffiliationsModals.js +93 -0
- package/dist/es/components/authors-affiliations/GenericPanel.js +94 -0
- package/dist/es/components/form/ModalFormActions.js +11 -5
- package/dist/es/keys/title.js +24 -10
- package/dist/es/lib/__tests__/plugins.test.js +2 -2
- package/dist/es/lib/context-menu.js +8 -9
- package/dist/es/plugins/objects.js +25 -20
- package/dist/es/versions.js +1 -1
- package/dist/es/views/affiliations.js +5 -11
- package/dist/es/views/caption.js +1 -1
- package/dist/es/views/contributors.js +5 -8
- package/dist/es/views/figure.js +0 -1
- package/dist/types/components/affiliations/AffiliationForm.d.ts +1 -0
- package/dist/types/components/affiliations/AffiliationsModal.d.ts +2 -5
- package/dist/types/components/affiliations/AffiliationsPanel.d.ts +11 -0
- package/dist/types/components/authors/AuthorDetailsForm.d.ts +1 -0
- package/dist/types/components/authors/AuthorsModal.d.ts +2 -4
- package/dist/types/components/authors/AuthorsPanel.d.ts +13 -0
- package/dist/types/components/authors/useManageAffiliations.d.ts +0 -2
- package/dist/types/components/authors-affiliations/AuthorsAndAffiliationsModals.d.ts +29 -0
- package/dist/types/components/authors-affiliations/GenericPanel.d.ts +48 -0
- package/dist/types/components/form/ModalFormActions.d.ts +1 -0
- package/dist/types/versions.d.ts +1 -1
- package/package.json +3 -3
- package/styles/AdvancedEditor.css +18 -48
- package/styles/Editor.css +28 -63
- package/dist/cjs/components/authors/AffiliationDrawer.js +0 -24
- package/dist/es/components/authors/AffiliationDrawer.js +0 -17
- package/dist/types/components/authors/AffiliationDrawer.d.ts +0 -12
package/dist/cjs/commands.js
CHANGED
|
@@ -37,8 +37,7 @@ const editor_props_1 = require("./plugins/editor-props");
|
|
|
37
37
|
const search_replace_1 = require("./plugins/search-replace");
|
|
38
38
|
const autocompletion_1 = require("./plugins/section_title/autocompletion");
|
|
39
39
|
const persistent_cursor_1 = require("./plugins/persistent-cursor");
|
|
40
|
-
const
|
|
41
|
-
const AuthorsModal_1 = require("./components/authors/AuthorsModal");
|
|
40
|
+
const AuthorsAndAffiliationsModals_1 = require("./components/authors-affiliations/AuthorsAndAffiliationsModals");
|
|
42
41
|
const addToStart = (state, dispatch) => {
|
|
43
42
|
const { selection } = state;
|
|
44
43
|
const props = (0, editor_props_1.getEditorProps)(state);
|
|
@@ -186,7 +185,7 @@ const createBlock = (nodeType, position, state, dispatch, attrs) => {
|
|
|
186
185
|
case transform_1.schema.nodes.listing_element:
|
|
187
186
|
node = transform_1.schema.nodes.listing_element.create({}, [
|
|
188
187
|
transform_1.schema.nodes.listing.create(),
|
|
189
|
-
|
|
188
|
+
...createAndFillCaption(),
|
|
190
189
|
]);
|
|
191
190
|
break;
|
|
192
191
|
case transform_1.schema.nodes.equation_element:
|
|
@@ -257,10 +256,7 @@ const insertFigure = (file, state, dispatch) => {
|
|
|
257
256
|
});
|
|
258
257
|
const element = state.schema.nodes.figure_element.createAndFill({}, [
|
|
259
258
|
figure,
|
|
260
|
-
|
|
261
|
-
state.schema.nodes.caption_title.create(),
|
|
262
|
-
state.schema.nodes.caption.create(),
|
|
263
|
-
]),
|
|
259
|
+
transform_1.schema.nodes.caption.create(undefined, transform_1.schema.nodes.text_block.create()),
|
|
264
260
|
]);
|
|
265
261
|
const tr = state.tr.insert(position, element);
|
|
266
262
|
dispatch(tr);
|
|
@@ -276,7 +272,7 @@ const insertEmbed = (state, dispatch, attrs) => {
|
|
|
276
272
|
...attrs,
|
|
277
273
|
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.embed),
|
|
278
274
|
}, [
|
|
279
|
-
|
|
275
|
+
...createAndFillCaption(),
|
|
280
276
|
transform_1.schema.nodes.alt_text.create(),
|
|
281
277
|
transform_1.schema.nodes.long_desc.create(),
|
|
282
278
|
]);
|
|
@@ -302,12 +298,7 @@ const insertSupplement = (file, view) => {
|
|
|
302
298
|
const supplement = transform_1.schema.nodes.supplement.createAndFill({
|
|
303
299
|
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.supplement),
|
|
304
300
|
href: file.id,
|
|
305
|
-
},
|
|
306
|
-
transform_1.schema.nodes.figcaption.create({}, [
|
|
307
|
-
transform_1.schema.nodes.caption_title.create(),
|
|
308
|
-
transform_1.schema.nodes.caption.create(),
|
|
309
|
-
]),
|
|
310
|
-
]);
|
|
301
|
+
}, createAndFillCaption());
|
|
311
302
|
const tr = view.state.tr;
|
|
312
303
|
const { pos } = (0, doc_1.upsertSupplementsSection)(tr, supplement);
|
|
313
304
|
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, pos));
|
|
@@ -590,7 +581,7 @@ const insertBoxElement = (state, dispatch) => {
|
|
|
590
581
|
paragraph,
|
|
591
582
|
]);
|
|
592
583
|
const node = nodes.box_element.createAndFill({}, [
|
|
593
|
-
nodes.
|
|
584
|
+
nodes.caption_title.create(),
|
|
594
585
|
section,
|
|
595
586
|
]);
|
|
596
587
|
if (position && dispatch) {
|
|
@@ -748,7 +739,7 @@ const insertContributors = (state, dispatch, view) => {
|
|
|
748
739
|
if (dispatch) {
|
|
749
740
|
const selection = prosemirror_state_1.NodeSelection.create(tr.doc, contributors.pos);
|
|
750
741
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
751
|
-
(0,
|
|
742
|
+
(0, AuthorsAndAffiliationsModals_1.openAuthorsAndAffiliationsModals)(contributors.pos, view, 'authors');
|
|
752
743
|
}
|
|
753
744
|
return true;
|
|
754
745
|
};
|
|
@@ -770,7 +761,7 @@ const insertAffiliation = (state, dispatch, view) => {
|
|
|
770
761
|
if (dispatch) {
|
|
771
762
|
const selection = prosemirror_state_1.NodeSelection.create(tr.doc, affiliations.pos);
|
|
772
763
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
773
|
-
(0,
|
|
764
|
+
(0, AuthorsAndAffiliationsModals_1.openAuthorsAndAffiliationsModals)(affiliations.pos, view, 'affiliations');
|
|
774
765
|
}
|
|
775
766
|
return true;
|
|
776
767
|
};
|
|
@@ -1124,7 +1115,7 @@ const createAndFillTableElement = (attrs, config = DEFAULT_TABLE_CONFIG) => {
|
|
|
1124
1115
|
...attrs,
|
|
1125
1116
|
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.table_element),
|
|
1126
1117
|
}, [
|
|
1127
|
-
|
|
1118
|
+
transform_1.schema.nodes.caption_title.create(),
|
|
1128
1119
|
transform_1.schema.nodes.table.create({}, tableRows),
|
|
1129
1120
|
transform_1.schema.nodes.alt_text.create(),
|
|
1130
1121
|
transform_1.schema.nodes.long_desc.create(),
|
|
@@ -1136,21 +1127,22 @@ const createAndFillFigureElement = (attrs) => transform_1.schema.nodes.figure_el
|
|
|
1136
1127
|
...attrs,
|
|
1137
1128
|
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.figure_element),
|
|
1138
1129
|
}, [
|
|
1139
|
-
transform_1.schema.nodes.figure.create(
|
|
1140
|
-
|
|
1130
|
+
transform_1.schema.nodes.figure.create(),
|
|
1131
|
+
transform_1.schema.nodes.caption.create(undefined, transform_1.schema.nodes.text_block.create()),
|
|
1141
1132
|
transform_1.schema.nodes.alt_text.create(),
|
|
1142
1133
|
transform_1.schema.nodes.long_desc.create(),
|
|
1143
1134
|
transform_1.schema.nodes.listing.create(),
|
|
1144
1135
|
]);
|
|
1145
|
-
const
|
|
1136
|
+
const createAndFillCaption = () => [
|
|
1146
1137
|
transform_1.schema.nodes.caption_title.create(),
|
|
1147
|
-
transform_1.schema.nodes.caption.create(),
|
|
1148
|
-
]
|
|
1138
|
+
transform_1.schema.nodes.caption.create(undefined, transform_1.schema.nodes.text_block.create()),
|
|
1139
|
+
];
|
|
1149
1140
|
const createImageElement = (attrs) => transform_1.schema.nodes.image_element.create({
|
|
1150
1141
|
...attrs,
|
|
1151
1142
|
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.image_element),
|
|
1152
1143
|
}, [
|
|
1153
1144
|
transform_1.schema.nodes.figure.create(),
|
|
1145
|
+
transform_1.schema.nodes.caption.create(undefined, transform_1.schema.nodes.text_block.create()),
|
|
1154
1146
|
transform_1.schema.nodes.alt_text.create(),
|
|
1155
1147
|
transform_1.schema.nodes.long_desc.create(),
|
|
1156
1148
|
]);
|
|
@@ -1158,7 +1150,7 @@ const createEmbedElement = (attrs) => transform_1.schema.nodes.embed.create({
|
|
|
1158
1150
|
...attrs,
|
|
1159
1151
|
id: (0, transform_1.generateNodeID)(transform_1.schema.nodes.embed),
|
|
1160
1152
|
}, [
|
|
1161
|
-
|
|
1153
|
+
...createAndFillCaption(),
|
|
1162
1154
|
transform_1.schema.nodes.alt_text.create(),
|
|
1163
1155
|
transform_1.schema.nodes.long_desc.create(),
|
|
1164
1156
|
]);
|
|
@@ -39,14 +39,13 @@ const formik_1 = require("formik");
|
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const ChangeHandlingForm_1 = require("../ChangeHandlingForm");
|
|
41
41
|
const AffiliationForm = ({ values, onSave, onChange, actionsRef, }) => {
|
|
42
|
-
|
|
42
|
+
const formRef = (0, react_1.useRef)(null);
|
|
43
|
+
if (actionsRef) {
|
|
43
44
|
actionsRef.current = {
|
|
44
|
-
reset: () =>
|
|
45
|
-
|
|
46
|
-
},
|
|
45
|
+
reset: () => formRef.current?.resetForm(),
|
|
46
|
+
submitForm: () => formRef.current?.submitForm(),
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
const formRef = (0, react_1.useRef)(null);
|
|
50
49
|
const validateAffiliation = (values) => {
|
|
51
50
|
const errors = {};
|
|
52
51
|
if (!values.institution?.trim()) {
|
|
@@ -54,7 +53,7 @@ const AffiliationForm = ({ values, onSave, onChange, actionsRef, }) => {
|
|
|
54
53
|
}
|
|
55
54
|
return errors;
|
|
56
55
|
};
|
|
57
|
-
return (react_1.default.createElement(formik_1.Formik, { initialValues: values, onSubmit: onSave, innerRef: formRef, enableReinitialize: true, validate: validateAffiliation }, (formik) => (react_1.default.createElement(ChangeHandlingForm_1.ChangeHandlingForm, { onChange: onChange, id: "affiliation-form", noValidate: true },
|
|
56
|
+
return (react_1.default.createElement(formik_1.Formik, { initialValues: values, onSubmit: (attrs) => onSave(attrs), innerRef: formRef, enableReinitialize: true, validate: validateAffiliation }, (formik) => (react_1.default.createElement(ChangeHandlingForm_1.ChangeHandlingForm, { onChange: onChange, id: "affiliation-form", noValidate: true },
|
|
58
57
|
react_1.default.createElement(style_guide_1.FormRow, null,
|
|
59
58
|
react_1.default.createElement(formik_1.Field, { name: "institution" }, (props) => {
|
|
60
59
|
const hasError = formik.touched.institution && formik.errors.institution;
|
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.AffiliationsModal = void 0;
|
|
40
40
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
41
41
|
const transform_1 = require("@manuscripts/transform");
|
|
42
42
|
const lodash_1 = require("lodash");
|
|
@@ -50,37 +50,45 @@ const ConfirmationDialog_1 = require("../dialog/ConfirmationDialog");
|
|
|
50
50
|
const FormFooter_1 = __importDefault(require("../form/FormFooter"));
|
|
51
51
|
const FormPlaceholder_1 = require("../form/FormPlaceholder");
|
|
52
52
|
const ModalFormActions_1 = require("../form/ModalFormActions");
|
|
53
|
-
const
|
|
54
|
-
const GenericDrawerGroup_1 = require("../modal-drawer/GenericDrawerGroup");
|
|
53
|
+
const AuthorsPanel_1 = require("../authors/AuthorsPanel");
|
|
55
54
|
const AffiliationForm_1 = require("./AffiliationForm");
|
|
56
55
|
const AffiliationList_1 = require("./AffiliationList");
|
|
57
|
-
const editor_props_1 = require("../../plugins/editor-props");
|
|
58
|
-
const ReactSubView_1 = __importDefault(require("../../views/ReactSubView"));
|
|
59
|
-
const view_1 = require("../../lib/view");
|
|
60
56
|
function makeAuthorItems(authors) {
|
|
61
57
|
return authors.map((author) => ({
|
|
62
58
|
id: author.id,
|
|
63
59
|
label: `${author.given} ${author.family}`,
|
|
64
60
|
}));
|
|
65
61
|
}
|
|
66
|
-
const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, affiliation, onSaveAffiliation, onDeleteAffiliation, onUpdateAuthors, addNewAffiliation = false, }) => {
|
|
62
|
+
const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, affiliation, onSaveAffiliation, onDeleteAffiliation, onUpdateAuthors, addNewAffiliation = false, onClose, onOpenAuthorsModal, }) => {
|
|
67
63
|
const [isOpen, setIsOpen] = (0, react_1.useState)(true);
|
|
68
64
|
const [selection, setSelection] = (0, react_1.useState)(affiliation);
|
|
69
65
|
const [showingDeleteDialog, setShowDeleteDialog] = (0, react_1.useState)(false);
|
|
70
66
|
const valuesRef = (0, react_1.useRef)(undefined);
|
|
71
67
|
const actionsRef = (0, react_1.useRef)(undefined);
|
|
72
68
|
const [authors, dispatchAuthors] = (0, react_1.useReducer)(AuthorsModal_1.authorsReducer, $authors.sort(authors_1.authorComparator));
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
70
|
+
dispatchAuthors({
|
|
71
|
+
type: 'set',
|
|
72
|
+
state: [...$authors].sort(authors_1.authorComparator),
|
|
73
|
+
});
|
|
74
|
+
}, [$authors]);
|
|
73
75
|
const [affiliations, dispatchAffiliations] = (0, react_1.useReducer)(useManageAffiliations_1.affiliationsReducer, $affiliations);
|
|
74
76
|
const [isDisableSave, setIsDisableSave] = (0, react_1.useState)(true);
|
|
75
77
|
const [newAffiliation, setNewAffiliation] = (0, react_1.useState)(false);
|
|
76
78
|
const [showRequiredFieldConfirmationDialog, setShowRequiredFieldConfirmationDialog,] = (0, react_1.useState)(false);
|
|
77
79
|
const [showConfirmationDialog, setShowConfirmationDialog] = (0, react_1.useState)(false);
|
|
78
|
-
const [showAuthorDrawer, setShowAuthorDrawer] = (0, react_1.useState)(false);
|
|
79
80
|
const [selectedAuthorIds, setSelectedAuthorIds] = (0, react_1.useState)([]);
|
|
80
81
|
const [pendingSelection, setPendingSelection] = (0, react_1.useState)(null);
|
|
81
82
|
const [pendingAction, setPendingAction] = (0, react_1.useState)(null);
|
|
82
83
|
const [savedAffiliationId, setSavedAffiliationId] = (0, react_1.useState)(undefined);
|
|
83
84
|
const [affiliationAuthorMap, setAffiliationAuthorMap] = (0, react_1.useState)(new Map());
|
|
85
|
+
const prevIsOpenRef = (0, react_1.useRef)(isOpen);
|
|
86
|
+
(0, react_1.useEffect)(() => {
|
|
87
|
+
if (prevIsOpenRef.current && !isOpen) {
|
|
88
|
+
onClose?.();
|
|
89
|
+
}
|
|
90
|
+
prevIsOpenRef.current = isOpen;
|
|
91
|
+
}, [isOpen, onClose]);
|
|
84
92
|
(0, react_1.useEffect)(() => {
|
|
85
93
|
if (!selection) {
|
|
86
94
|
return;
|
|
@@ -145,7 +153,6 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
145
153
|
setNewAffiliation(false);
|
|
146
154
|
setSelection(affiliation);
|
|
147
155
|
setSelectedAuthorIds(affiliatedAuthorIds);
|
|
148
|
-
setShowAuthorDrawer(false);
|
|
149
156
|
setAffiliationAuthorMap((prevMap) => {
|
|
150
157
|
const newMap = new Map(prevMap);
|
|
151
158
|
newMap.set(affiliation.id, affiliatedAuthorIds);
|
|
@@ -185,7 +192,6 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
185
192
|
newMap.set(affiliation.id, selectedAuthorIds);
|
|
186
193
|
return newMap;
|
|
187
194
|
});
|
|
188
|
-
setShowAuthorDrawer(false);
|
|
189
195
|
setSavedAffiliationId(affiliation.id);
|
|
190
196
|
setTimeout(() => {
|
|
191
197
|
setSavedAffiliationId(undefined);
|
|
@@ -279,7 +285,6 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
279
285
|
setNewAffiliation(true);
|
|
280
286
|
setSelection(emptyAffiliation);
|
|
281
287
|
setSelectedAuthorIds([]);
|
|
282
|
-
setShowAuthorDrawer(false);
|
|
283
288
|
};
|
|
284
289
|
(0, react_1.useEffect)(() => {
|
|
285
290
|
if (addNewAffiliation) {
|
|
@@ -327,7 +332,6 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
327
332
|
const handleConfirmationCancel = () => {
|
|
328
333
|
setShowConfirmationDialog(false);
|
|
329
334
|
setShowRequiredFieldConfirmationDialog(false);
|
|
330
|
-
setShowAuthorDrawer(false);
|
|
331
335
|
if (pendingAction === 'select' && pendingSelection) {
|
|
332
336
|
setSelection(pendingSelection);
|
|
333
337
|
setNewAffiliation(false);
|
|
@@ -368,19 +372,17 @@ const AffiliationsModal = ({ authors: $authors, affiliations: $affiliations, aff
|
|
|
368
372
|
react_1.default.createElement(AffiliationList_1.AffiliationList, { affiliation: selection, affiliations: affiliations, onSelect: handleSelect, onDelete: handleShowDeleteDialog, lastSavedAffiliationId: savedAffiliationId }))),
|
|
369
373
|
react_1.default.createElement(style_guide_1.ScrollableModalContent, { "data-cy": "affiliations-modal-content" }, selection ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
370
374
|
react_1.default.createElement(AffiliationTabs, null,
|
|
371
|
-
react_1.default.createElement(ModalFormActions_1.ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog &&
|
|
375
|
+
react_1.default.createElement(ModalFormActions_1.ModalFormActions, { type: 'affiliation', form: 'affiliation-form', onSubmitForm: () => actionsRef.current?.submitForm?.(), onDelete: handleDeleteAffiliation, showingDeleteDialog: showingDeleteDialog &&
|
|
372
376
|
!(showConfirmationDialog ||
|
|
373
377
|
showRequiredFieldConfirmationDialog), showDeleteDialog: handleShowDeleteDialog, newEntity: newAffiliation, isDisableSave: isDisableSave }),
|
|
374
378
|
react_1.default.createElement(style_guide_1.InspectorTabList, null,
|
|
375
379
|
react_1.default.createElement(style_guide_1.InspectorTab, null, "Details"),
|
|
376
|
-
react_1.default.createElement(style_guide_1.InspectorTab, null, "Authors")),
|
|
380
|
+
onOpenAuthorsModal && react_1.default.createElement(style_guide_1.InspectorTab, null, "Authors")),
|
|
377
381
|
react_1.default.createElement(style_guide_1.InspectorTabPanels, null,
|
|
378
382
|
react_1.default.createElement(AffiliationTabPanel, null,
|
|
379
|
-
react_1.default.createElement(AffiliationForm_1.AffiliationForm, { values: (0, normalize_1.checkID)(selection, 'affiliation'), onSave: () => handleSaveAffiliation(
|
|
380
|
-
react_1.default.createElement(AffiliationTabPanel, null,
|
|
381
|
-
react_1.default.createElement(
|
|
382
|
-
setSelectedAuthorIds((prev) => prev.filter((authorId) => authorId !== id));
|
|
383
|
-
}, selectedItems: selectedAuthors, onSelect: selectAuthor, items: makeAuthorItems(authors), showDrawer: showAuthorDrawer, setShowDrawer: setShowAuthorDrawer, title: "Authors", cy: "affiliations", labelField: "label", buttonText: "Affiliate Authors", Icon: react_1.default.createElement(style_guide_1.AddUserIcon, { width: 16, height: 16 }) })))),
|
|
383
|
+
react_1.default.createElement(AffiliationForm_1.AffiliationForm, { values: (0, normalize_1.checkID)(selection, 'affiliation'), onSave: (attrs) => handleSaveAffiliation(attrs), onChange: handleAffiliationChange, actionsRef: actionsRef })),
|
|
384
|
+
onOpenAuthorsModal && (react_1.default.createElement(AffiliationTabPanel, null,
|
|
385
|
+
react_1.default.createElement(AuthorsPanel_1.AuthorsPanel, { items: makeAuthorItems(authors), selectedItems: selectedAuthors, onSelect: selectAuthor, onOpenAuthorsModal: onOpenAuthorsModal }))))),
|
|
384
386
|
react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, { isOpen: showRequiredFieldConfirmationDialog, onPrimary: () => setShowRequiredFieldConfirmationDialog(false), onSecondary: handleConfirmationCancel, type: ConfirmationDialog_1.DialogType.REQUIRED, entityType: "affiliation" }),
|
|
385
387
|
react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, { isOpen: showConfirmationDialog, onPrimary: handleConfirmationSave, onSecondary: handleConfirmationCancel, type: ConfirmationDialog_1.DialogType.SAVE, entityType: "affiliation" }))) : (react_1.default.createElement(FormPlaceholder_1.FormPlaceholder, { type: "affiliation", title: "Affiliation Details", message: "Select an affiliation from the list to display it's details here.", placeholderIcon: react_1.default.createElement(style_guide_1.AffiliationPlaceholderIcon, null) })))),
|
|
386
388
|
react_1.default.createElement(FormFooter_1.default, { onCancel: handleClose }))));
|
|
@@ -447,41 +449,3 @@ const StyledModalSidebarHeader = (0, styled_components_1.default)(style_guide_1.
|
|
|
447
449
|
margin-top: 8px;
|
|
448
450
|
margin-bottom: 16px;
|
|
449
451
|
`;
|
|
450
|
-
const openAffiliationsModal = (pos, view) => {
|
|
451
|
-
if (!view) {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
const { state } = view;
|
|
455
|
-
const props = (0, editor_props_1.getEditorProps)(state);
|
|
456
|
-
const contributors = (0, view_1.findChildrenAttrsByType)(view, transform_1.schema.nodes.contributor);
|
|
457
|
-
const componentProps = {
|
|
458
|
-
affiliations: [],
|
|
459
|
-
authors: contributors,
|
|
460
|
-
onSaveAffiliation: (affiliation) => (0, exports.handleSaveAffiliation)(view, affiliation, pos),
|
|
461
|
-
onDeleteAffiliation: (affiliation) => (0, exports.handleDeleteAffiliation)(view, affiliation),
|
|
462
|
-
onUpdateAuthors: (authors) => (0, exports.handleUpdateAuthors)(view, authors),
|
|
463
|
-
addNewAffiliation: true,
|
|
464
|
-
};
|
|
465
|
-
const dialog = (0, ReactSubView_1.default)(props, exports.AffiliationsModal, componentProps, state.doc, () => pos, view);
|
|
466
|
-
view.focus();
|
|
467
|
-
document.body.appendChild(dialog);
|
|
468
|
-
};
|
|
469
|
-
exports.openAffiliationsModal = openAffiliationsModal;
|
|
470
|
-
const handleSaveAffiliation = (view, affiliation, affiliationsPos) => {
|
|
471
|
-
const update = (0, view_1.updateNodeAttrs)(view, transform_1.schema.nodes.affiliation, affiliation);
|
|
472
|
-
if (!update) {
|
|
473
|
-
const node = transform_1.schema.nodes.affiliation.create(affiliation);
|
|
474
|
-
view.dispatch(view.state.tr.insert(affiliationsPos + 1, node));
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
exports.handleSaveAffiliation = handleSaveAffiliation;
|
|
478
|
-
const handleDeleteAffiliation = (view, affiliation) => {
|
|
479
|
-
(0, view_1.deleteNode)(view, affiliation.id);
|
|
480
|
-
};
|
|
481
|
-
exports.handleDeleteAffiliation = handleDeleteAffiliation;
|
|
482
|
-
const handleUpdateAuthors = (view, authors) => {
|
|
483
|
-
authors.forEach((author) => {
|
|
484
|
-
(0, view_1.updateNodeAttrs)(view, transform_1.schema.nodes.contributor, author);
|
|
485
|
-
});
|
|
486
|
-
};
|
|
487
|
-
exports.handleUpdateAuthors = handleUpdateAuthors;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AffiliationsPanel = void 0;
|
|
7
|
+
const style_guide_1 = require("@manuscripts/style-guide");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const GenericPanel_1 = require("../authors-affiliations/GenericPanel");
|
|
10
|
+
function affiliationSecondaryLine(item) {
|
|
11
|
+
const line = [item.city, item.county, item.country].filter(Boolean).join(', ');
|
|
12
|
+
return line || undefined;
|
|
13
|
+
}
|
|
14
|
+
const AffiliationsPanel = ({ items, selectedItems = [], onSelect, onOpenAffiliationsModal, }) => {
|
|
15
|
+
const selectedIds = (0, GenericPanel_1.useListSelectedIds)(selectedItems);
|
|
16
|
+
return (react_1.default.createElement(GenericPanel_1.GenericPanel, { title: "Institutional Affiliations", createLabel: "Create New Affiliation", onCreate: onOpenAffiliationsModal, createDataCy: "add-affiliations-link", emptyDataCy: "affiliations-panel-empty", isEmpty: items.length === 0, emptyIcon: react_1.default.createElement(style_guide_1.AffiliationPlaceholderIcon, null), emptyMessage: react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
+
"There are no affiliations attributed yet!",
|
|
18
|
+
react_1.default.createElement("br", null),
|
|
19
|
+
"Click \u2018Create New Affiliation\u2019") },
|
|
20
|
+
react_1.default.createElement(GenericPanel_1.ListItems, { "data-cy": "affiliations-panel" }, items.map((item) => (react_1.default.createElement(GenericPanel_1.ListItem, { key: item.id, selected: selectedIds.has(item.id), onClick: () => onSelect(item.id), primary: item.institution, secondary: affiliationSecondaryLine(item) }))))));
|
|
21
|
+
};
|
|
22
|
+
exports.AffiliationsPanel = AffiliationsPanel;
|
|
@@ -73,11 +73,10 @@ const AuthorDetailsForm = ({ values, onChange, onSave, actionsRef, isEmailRequir
|
|
|
73
73
|
formRef.current.setFieldValue('creditRoles', selectedCreditRoles);
|
|
74
74
|
}
|
|
75
75
|
}, [selectedCreditRoles]);
|
|
76
|
-
if (actionsRef
|
|
76
|
+
if (actionsRef) {
|
|
77
77
|
actionsRef.current = {
|
|
78
|
-
reset: () =>
|
|
79
|
-
|
|
80
|
-
},
|
|
78
|
+
reset: () => formRef.current?.resetForm(),
|
|
79
|
+
submitForm: () => formRef.current?.submitForm(),
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
82
|
const validateAuthor = (values) => {
|
|
@@ -51,7 +51,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
51
51
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.
|
|
54
|
+
exports.AuthorsModal = exports.authorsReducer = void 0;
|
|
55
55
|
const style_guide_1 = require("@manuscripts/style-guide");
|
|
56
56
|
const transform_1 = require("@manuscripts/transform");
|
|
57
57
|
const lodash_1 = require("lodash");
|
|
@@ -65,18 +65,22 @@ const FormFooter_1 = __importDefault(require("../form/FormFooter"));
|
|
|
65
65
|
const FormPlaceholder_1 = require("../form/FormPlaceholder");
|
|
66
66
|
const ModalFormActions_1 = require("../form/ModalFormActions");
|
|
67
67
|
const GenericDrawerGroup_1 = require("../modal-drawer/GenericDrawerGroup");
|
|
68
|
-
const
|
|
68
|
+
const AffiliationsPanel_1 = require("../affiliations/AffiliationsPanel");
|
|
69
69
|
const AuthorDetailsForm_1 = require("./AuthorDetailsForm");
|
|
70
70
|
const AuthorList_1 = require("./AuthorList");
|
|
71
71
|
const CreditDrawer_1 = require("./CreditDrawer");
|
|
72
72
|
const useManageAffiliations_1 = require("./useManageAffiliations");
|
|
73
73
|
const useManageCredit_1 = require("./useManageCredit");
|
|
74
|
-
const editor_props_1 = require("../../plugins/editor-props");
|
|
75
|
-
const ReactSubView_1 = __importDefault(require("../../views/ReactSubView"));
|
|
76
|
-
const view_1 = require("../../lib/view");
|
|
77
74
|
exports.authorsReducer = (0, array_reducer_1.arrayReducer)((a, b) => a.id === b.id);
|
|
78
|
-
const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author, onSaveAuthor, onDeleteAuthor, addNewAuthor = false, }) => {
|
|
75
|
+
const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author, onSaveAuthor, onDeleteAuthor, addNewAuthor = false, onOpenAffiliationsModal, onClose, }) => {
|
|
79
76
|
const [isOpen, setOpen] = (0, react_1.useState)(true);
|
|
77
|
+
const prevIsOpenRef = (0, react_1.useRef)(true);
|
|
78
|
+
(0, react_1.useEffect)(() => {
|
|
79
|
+
if (prevIsOpenRef.current && !isOpen) {
|
|
80
|
+
onClose?.();
|
|
81
|
+
}
|
|
82
|
+
prevIsOpenRef.current = isOpen;
|
|
83
|
+
}, [isOpen, onClose]);
|
|
80
84
|
const [isDisableSave, setDisableSave] = (0, react_1.useState)(true);
|
|
81
85
|
const [isEmailRequired, setEmailRequired] = (0, react_1.useState)(false);
|
|
82
86
|
const [showConfirmationDialog, setShowConfirmationDialog] = (0, react_1.useState)(false);
|
|
@@ -99,7 +103,7 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
99
103
|
}
|
|
100
104
|
}, [addNewAuthor]);
|
|
101
105
|
const [selection, setSelection] = (0, react_1.useState)(author);
|
|
102
|
-
const {
|
|
106
|
+
const { selectedAffiliations, setSelectedAffiliations, selectAffiliation, affiliations, } = (0, useManageAffiliations_1.useManageAffiliations)(selection, $affiliations);
|
|
103
107
|
(0, react_1.useEffect)(() => {
|
|
104
108
|
const currentAuthor = selection;
|
|
105
109
|
const relevantAffiliations = affiliations.filter((item) => currentAuthor?.affiliationIDs?.includes(item.id));
|
|
@@ -126,12 +130,10 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
126
130
|
else {
|
|
127
131
|
updateAffiliationSelection(author);
|
|
128
132
|
setSelection(author);
|
|
129
|
-
setShowAffiliationDrawer(false);
|
|
130
133
|
setNewAuthor(false);
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
else {
|
|
134
|
-
setShowAffiliationDrawer(false);
|
|
135
137
|
updateAffiliationSelection(author);
|
|
136
138
|
setSelection(author);
|
|
137
139
|
setNewAuthor(false);
|
|
@@ -172,7 +174,6 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
172
174
|
setSelection(nextAuthor);
|
|
173
175
|
setNextAuthor(null);
|
|
174
176
|
setNewAuthor(false);
|
|
175
|
-
setShowAffiliationDrawer(false);
|
|
176
177
|
updateAffiliationSelection(nextAuthor);
|
|
177
178
|
setIsCreatingNewAuthor(false);
|
|
178
179
|
}
|
|
@@ -205,7 +206,6 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
205
206
|
}
|
|
206
207
|
setShowConfirmationDialog(false);
|
|
207
208
|
setShowRequiredFieldConfirmationDialog(false);
|
|
208
|
-
setShowAffiliationDrawer(false);
|
|
209
209
|
};
|
|
210
210
|
const saveAuthor = (values) => {
|
|
211
211
|
if (!values || !selection) {
|
|
@@ -224,7 +224,6 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
224
224
|
setSelection(author);
|
|
225
225
|
setShowConfirmationDialog(false);
|
|
226
226
|
setNewAuthor(false);
|
|
227
|
-
setShowAffiliationDrawer(false);
|
|
228
227
|
setIsCreatingNewAuthor(false);
|
|
229
228
|
dispatchAuthors({
|
|
230
229
|
type: 'update',
|
|
@@ -281,7 +280,6 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
281
280
|
}
|
|
282
281
|
else {
|
|
283
282
|
createNewAuthor();
|
|
284
|
-
setShowAffiliationDrawer(false);
|
|
285
283
|
}
|
|
286
284
|
};
|
|
287
285
|
const deleteAuthor = () => {
|
|
@@ -350,19 +348,19 @@ const AuthorsModal = ({ authors: $authors, affiliations: $affiliations, author,
|
|
|
350
348
|
react_1.default.createElement(AuthorList_1.AuthorList, { author: selection, authors: authors, onSelect: selectAuthor, onDelete: () => setShowDeleteDialog((prev) => !prev), moveAuthor: moveAuthor, lastSavedAuthor: lastSavedAuthor }))),
|
|
351
349
|
react_1.default.createElement(style_guide_1.ScrollableModalContent, { "data-cy": "author-modal-content" }, selection ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
352
350
|
react_1.default.createElement(AuthorTabs, null,
|
|
353
|
-
react_1.default.createElement(ModalFormActions_1.ModalFormActions, { form: 'author-details-form', type: "author", onDelete: deleteAuthor, showingDeleteDialog: showingDeleteDialog, showDeleteDialog: () => setShowDeleteDialog((prev) => !prev), newEntity: newAuthor ||
|
|
351
|
+
react_1.default.createElement(ModalFormActions_1.ModalFormActions, { form: 'author-details-form', onSubmitForm: () => actionsRef.current?.submitForm?.(), type: "author", onDelete: deleteAuthor, showingDeleteDialog: showingDeleteDialog, showDeleteDialog: () => setShowDeleteDialog((prev) => !prev), newEntity: newAuthor ||
|
|
354
352
|
(isCreatingNewAuthor &&
|
|
355
353
|
!showConfirmationDialog &&
|
|
356
354
|
!showRequiredFieldConfirmationDialog), isDisableSave: isDisableSave }),
|
|
357
355
|
react_1.default.createElement(style_guide_1.InspectorTabList, null,
|
|
358
356
|
react_1.default.createElement(style_guide_1.InspectorTab, null, "Details"),
|
|
359
|
-
react_1.default.createElement(style_guide_1.InspectorTab, null, "Affiliations"),
|
|
357
|
+
onOpenAffiliationsModal && (react_1.default.createElement(style_guide_1.InspectorTab, null, "Affiliations")),
|
|
360
358
|
react_1.default.createElement(style_guide_1.InspectorTab, null, "Contributions (CRediT)")),
|
|
361
359
|
react_1.default.createElement(style_guide_1.InspectorTabPanels, null,
|
|
362
360
|
react_1.default.createElement(AuthorTabPanel, null,
|
|
363
361
|
react_1.default.createElement(AuthorDetailsForm_1.AuthorDetailsForm, { values: (0, normalize_1.normalizeAuthor)(selection), onChange: changeAuthor, onSave: saveAuthor, actionsRef: actionsRef, isEmailRequired: isEmailRequired, selectedAffiliations: selectedAffiliations.map((a) => a.id), authorFormRef: authorFormRef, selectedCreditRoles: selectedCreditRoles })),
|
|
364
|
-
react_1.default.createElement(AuthorTabPanel, null,
|
|
365
|
-
react_1.default.createElement(
|
|
362
|
+
onOpenAffiliationsModal && (react_1.default.createElement(AuthorTabPanel, null,
|
|
363
|
+
react_1.default.createElement(AffiliationsPanel_1.AffiliationsPanel, { items: affiliations, selectedItems: selectedAffiliations, onSelect: selectAffiliation, onOpenAffiliationsModal: onOpenAffiliationsModal }))),
|
|
366
364
|
react_1.default.createElement(AuthorTabPanel, null,
|
|
367
365
|
react_1.default.createElement(GenericDrawerGroup_1.DrawerGroup, { Drawer: CreditDrawer_1.CreditDrawer, removeItem: removeCreditRole, selectedItems: selectedCreditRoles.map((r) => ({
|
|
368
366
|
id: r.vocabTerm,
|
|
@@ -431,34 +429,3 @@ const StyledModalBody = (0, styled_components_1.default)(style_guide_1.ModalBody
|
|
|
431
429
|
const StyledModalSidebarHeader = (0, styled_components_1.default)(style_guide_1.ModalSidebarHeader) `
|
|
432
430
|
margin-bottom: 16px;
|
|
433
431
|
`;
|
|
434
|
-
const openAuthorsModal = (pos, view) => {
|
|
435
|
-
if (!view) {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
const { state } = view;
|
|
439
|
-
const props = (0, editor_props_1.getEditorProps)(state);
|
|
440
|
-
const affiliations = (0, view_1.findChildrenAttrsByType)(view, transform_1.schema.nodes.affiliation);
|
|
441
|
-
const componentProps = {
|
|
442
|
-
authors: [],
|
|
443
|
-
affiliations,
|
|
444
|
-
onSaveAuthor: (contributor) => (0, exports.handleSaveContributor)(view, contributor, pos),
|
|
445
|
-
onDeleteAuthor: (contributor) => (0, exports.handleDeleteContributor)(view, contributor),
|
|
446
|
-
addNewAuthor: true,
|
|
447
|
-
};
|
|
448
|
-
const dialog = (0, ReactSubView_1.default)(props, exports.AuthorsModal, componentProps, state.doc, () => pos, view);
|
|
449
|
-
view.focus();
|
|
450
|
-
document.body.appendChild(dialog);
|
|
451
|
-
};
|
|
452
|
-
exports.openAuthorsModal = openAuthorsModal;
|
|
453
|
-
const handleSaveContributor = (view, contributor, contributorsPos) => {
|
|
454
|
-
const update = (0, view_1.updateNodeAttrs)(view, transform_1.schema.nodes.contributor, contributor);
|
|
455
|
-
if (!update) {
|
|
456
|
-
const node = transform_1.schema.nodes.contributor.create(contributor);
|
|
457
|
-
view.dispatch(view.state.tr.insert(contributorsPos + 1, node));
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
exports.handleSaveContributor = handleSaveContributor;
|
|
461
|
-
const handleDeleteContributor = (view, contributor) => {
|
|
462
|
-
(0, view_1.deleteNode)(view, contributor.id);
|
|
463
|
-
};
|
|
464
|
-
exports.handleDeleteContributor = handleDeleteContributor;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AuthorsPanel = void 0;
|
|
7
|
+
const style_guide_1 = require("@manuscripts/style-guide");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const GenericPanel_1 = require("../authors-affiliations/GenericPanel");
|
|
10
|
+
const AuthorsPanel = ({ items, selectedItems = [], onSelect, onOpenAuthorsModal, }) => {
|
|
11
|
+
const selectedIds = (0, GenericPanel_1.useListSelectedIds)(selectedItems);
|
|
12
|
+
return (react_1.default.createElement(GenericPanel_1.GenericPanel, { title: "Authors", createLabel: "Add New Author", onCreate: onOpenAuthorsModal, createDataCy: "add-authors-link", emptyDataCy: "authors-panel-empty", isEmpty: items.length === 0, emptyIcon: react_1.default.createElement(style_guide_1.AuthorPlaceholderIcon, null), emptyMessage: react_1.default.createElement(react_1.default.Fragment, null,
|
|
13
|
+
"There are no authors attributed yet!",
|
|
14
|
+
react_1.default.createElement("br", null),
|
|
15
|
+
"Click \u2018Add New Author\u2019") },
|
|
16
|
+
react_1.default.createElement(GenericPanel_1.ListItems, { "data-cy": "authors-panel" }, items.map((item) => (react_1.default.createElement(GenericPanel_1.ListItem, { key: item.id, selected: selectedIds.has(item.id), onClick: () => onSelect(item.id), primary: item.label }))))));
|
|
17
|
+
};
|
|
18
|
+
exports.AuthorsPanel = AuthorsPanel;
|
|
@@ -5,8 +5,12 @@ const react_1 = require("react");
|
|
|
5
5
|
const array_reducer_1 = require("../../lib/array-reducer");
|
|
6
6
|
exports.affiliationsReducer = (0, array_reducer_1.arrayReducer)((a, b) => a.id === b.id);
|
|
7
7
|
const useManageAffiliations = (selection, $affiliations) => {
|
|
8
|
-
const [affiliations] = (0, react_1.useReducer)(exports.affiliationsReducer,
|
|
9
|
-
|
|
8
|
+
const [affiliations, dispatchAffiliations] = (0, react_1.useReducer)(exports.affiliationsReducer, [
|
|
9
|
+
...$affiliations,
|
|
10
|
+
]);
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
dispatchAffiliations({ type: 'set', state: [...$affiliations] });
|
|
13
|
+
}, [$affiliations]);
|
|
10
14
|
const [selectedAffiliations, setSelectedAffiliations] = (0, react_1.useState)([]);
|
|
11
15
|
const removeAffiliation = (affId) => {
|
|
12
16
|
if (!selection) {
|
|
@@ -29,8 +33,6 @@ const useManageAffiliations = (selection, $affiliations) => {
|
|
|
29
33
|
setSelectedAffiliations(affiliations.filter((item) => newAffiliations.includes(item.id)));
|
|
30
34
|
};
|
|
31
35
|
return {
|
|
32
|
-
showAffiliationDrawer,
|
|
33
|
-
setShowAffiliationDrawer,
|
|
34
36
|
selectedAffiliations,
|
|
35
37
|
setSelectedAffiliations,
|
|
36
38
|
removeAffiliation,
|