@manuscripts/style-guide 1.8.0 → 1.8.1-LEAN-3429-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/TableFootnotesSelector.js +5 -6
- package/dist/cjs/lib/capabilities.js +1 -1
- package/dist/es/components/TableFootnotesSelector.js +5 -6
- package/dist/es/lib/capabilities.js +1 -1
- package/dist/types/components/TableFootnotesSelector.d.ts +6 -2
- package/dist/types/lib/capabilities.d.ts +1 -1
- package/package.json +2 -2
|
@@ -96,8 +96,7 @@ const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
96
96
|
return selections.has(item.attrs.id);
|
|
97
97
|
};
|
|
98
98
|
const handleClick = () => {
|
|
99
|
-
|
|
100
|
-
return onInsert(items);
|
|
99
|
+
return onInsert(notes.filter(({ node }) => selections.has(node.attrs.id)));
|
|
101
100
|
};
|
|
102
101
|
return (react_1.default.createElement(Container, null,
|
|
103
102
|
react_1.default.createElement(NotesContainer, null,
|
|
@@ -113,11 +112,11 @@ const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) => {
|
|
|
113
112
|
};
|
|
114
113
|
exports.TableFootnotesSelector = TableFootnotesSelector;
|
|
115
114
|
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
116
|
-
return (react_1.default.createElement(NotesListContainer, null, notes.map((
|
|
115
|
+
return (react_1.default.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
117
116
|
var _a;
|
|
118
|
-
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(
|
|
119
|
-
react_1.default.createElement(StatusIcon, null, isSelected(
|
|
120
|
-
react_1.default.createElement(NoteText, null,
|
|
117
|
+
return (react_1.default.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
118
|
+
react_1.default.createElement(StatusIcon, null, isSelected(node) ? (react_1.default.createElement(AddedIcon_1.default, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (react_1.default.createElement(AddIcon_1.default, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
119
|
+
react_1.default.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
121
120
|
})));
|
|
122
121
|
};
|
|
123
122
|
const NotesListContainer = styled_components_1.default.div `
|
|
@@ -23,6 +23,7 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
23
23
|
const allowed = (action) => !!(actions === null || actions === void 0 ? void 0 : actions.includes(action));
|
|
24
24
|
return {
|
|
25
25
|
handleSuggestion: isOwner() || isEditor() || isWriter(),
|
|
26
|
+
editWithoutTracking: isWriter(),
|
|
26
27
|
rejectOwnSuggestion: !isViewer(),
|
|
27
28
|
createSuggestion: !isViewer(),
|
|
28
29
|
viewSuggestion: true,
|
|
@@ -52,7 +53,6 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
52
53
|
putOnHoldTask: isProdEditor(),
|
|
53
54
|
changeDueDate: isProdEditor() && allowed(Actions.updateDueDate),
|
|
54
55
|
previewAccess: true,
|
|
55
|
-
editNotTracked: false,
|
|
56
56
|
accessEditor: true,
|
|
57
57
|
formatArticle: !isViewer(),
|
|
58
58
|
editArticle: !isViewer(),
|
|
@@ -67,8 +67,7 @@ export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) =>
|
|
|
67
67
|
return selections.has(item.attrs.id);
|
|
68
68
|
};
|
|
69
69
|
const handleClick = () => {
|
|
70
|
-
|
|
71
|
-
return onInsert(items);
|
|
70
|
+
return onInsert(notes.filter(({ node }) => selections.has(node.attrs.id)));
|
|
72
71
|
};
|
|
73
72
|
return (React.createElement(Container, null,
|
|
74
73
|
React.createElement(NotesContainer, null,
|
|
@@ -83,11 +82,11 @@ export const TableFootnotesSelector = ({ notes, onAdd, onInsert, onCancel }) =>
|
|
|
83
82
|
React.createElement(PrimaryButton, { onClick: handleClick, disabled: selections.size === 0 }, "Insert")))));
|
|
84
83
|
};
|
|
85
84
|
const TableFootnotesList = ({ notes, isSelected, onSelect }) => {
|
|
86
|
-
return (React.createElement(NotesListContainer, null, notes.map((
|
|
85
|
+
return (React.createElement(NotesListContainer, null, notes.map(({ node, index }) => {
|
|
87
86
|
var _a;
|
|
88
|
-
return (React.createElement(FootnoteItem, { onClick: () => onSelect(
|
|
89
|
-
React.createElement(StatusIcon, null, isSelected(
|
|
90
|
-
React.createElement(NoteText, null,
|
|
87
|
+
return (React.createElement(FootnoteItem, { onClick: () => onSelect(node), key: node.attrs.id },
|
|
88
|
+
React.createElement(StatusIcon, null, isSelected(node) ? (React.createElement(AddedIcon, { "data-cy": 'plus-icon-ok', width: 24, height: 24 })) : (React.createElement(AddIcon, { "data-cy": 'plus-icon', width: 24, height: 24 }))),
|
|
89
|
+
React.createElement(NoteText, null, (index ? index + '. ' : '') + ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.textContent))));
|
|
91
90
|
})));
|
|
92
91
|
};
|
|
93
92
|
const NotesListContainer = styled.div `
|
|
@@ -17,6 +17,7 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
17
17
|
const allowed = (action) => !!(actions === null || actions === void 0 ? void 0 : actions.includes(action));
|
|
18
18
|
return {
|
|
19
19
|
handleSuggestion: isOwner() || isEditor() || isWriter(),
|
|
20
|
+
editWithoutTracking: isWriter(),
|
|
20
21
|
rejectOwnSuggestion: !isViewer(),
|
|
21
22
|
createSuggestion: !isViewer(),
|
|
22
23
|
viewSuggestion: true,
|
|
@@ -46,7 +47,6 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
46
47
|
putOnHoldTask: isProdEditor(),
|
|
47
48
|
changeDueDate: isProdEditor() && allowed(Actions.updateDueDate),
|
|
48
49
|
previewAccess: true,
|
|
49
|
-
editNotTracked: false,
|
|
50
50
|
accessEditor: true,
|
|
51
51
|
formatArticle: !isViewer(),
|
|
52
52
|
editArticle: !isViewer(),
|
|
@@ -15,9 +15,13 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { FootnoteNode } from '@manuscripts/transform';
|
|
17
17
|
import React from 'react';
|
|
18
|
+
export type FootnoteWithIndex = {
|
|
19
|
+
node: FootnoteNode;
|
|
20
|
+
index?: string;
|
|
21
|
+
};
|
|
18
22
|
export declare const TableFootnotesSelector: React.FC<{
|
|
19
|
-
notes:
|
|
23
|
+
notes: FootnoteWithIndex[];
|
|
20
24
|
onAdd: () => void;
|
|
21
|
-
onInsert: (notes:
|
|
25
|
+
onInsert: (notes: FootnoteWithIndex[]) => void;
|
|
22
26
|
onCancel: () => void;
|
|
23
27
|
}>;
|
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.8.0",
|
|
4
|
+
"version": "1.8.1-LEAN-3429-0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -103,4 +103,4 @@
|
|
|
103
103
|
"@types/react": "^17.0.2",
|
|
104
104
|
"jackspeak": "2.1.1"
|
|
105
105
|
}
|
|
106
|
-
}
|
|
106
|
+
}
|