@manuscripts/style-guide 1.0.8-LEAN-2299 → 1.1.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/FileManager/FileSectionItem/FileInfo.js +3 -3
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/lib/capabilities.js +15 -13
- package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +3 -3
- package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/lib/capabilities.js +13 -11
- package/dist/types/components/FileManager/FileManager.d.ts +5 -5
- package/dist/types/components/FileManager/FileSectionItem/FileInfo.d.ts +1 -1
- package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +4 -4
- package/dist/types/components/FileManager/FileSectionItem/ItemActions.d.ts +2 -2
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +3 -3
- package/dist/types/components/FileManager/util.d.ts +3 -3
- package/dist/types/components/Form.d.ts +1 -1
- package/dist/types/hooks/use-files.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/capabilities.d.ts +4 -3
- package/dist/types/lib/inlineFiles.d.ts +3 -3
- package/package.json +3 -8
- /package/dist/cjs/lib/{errors-decoder.js → lw-errors-decoder.js} +0 -0
- /package/dist/es/lib/{errors-decoder.js → lw-errors-decoder.js} +0 -0
- /package/dist/types/lib/{errors-decoder.d.ts → lw-errors-decoder.d.ts} +0 -0
|
@@ -31,11 +31,11 @@ const react_1 = __importStar(require("react"));
|
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const FileManager_1 = require("../FileManager");
|
|
33
33
|
const DesignationActions_1 = require("./DesignationActions");
|
|
34
|
-
const FileInfo = ({ showAttachmentName, showDesignationActions, title,
|
|
35
|
-
const fileName =
|
|
34
|
+
const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissionAttachmentName, fileExtension, designation, attachmentId, handleChangeDesignation, dispatch, }) => {
|
|
35
|
+
const fileName = submissionAttachmentName.substring(0, submissionAttachmentName.lastIndexOf('.'));
|
|
36
36
|
const can = (0, react_1.useContext)(FileManager_1.PermissionsContext);
|
|
37
37
|
return (react_1.default.createElement(exports.FileInfoContainer, null,
|
|
38
|
-
showDesignationActions && designation !== undefined && (react_1.default.createElement(DesignationActions_1.DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName:
|
|
38
|
+
showDesignationActions && designation !== undefined && (react_1.default.createElement(DesignationActions_1.DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName: submissionAttachmentName, dispatch: dispatch, can: can })),
|
|
39
39
|
react_1.default.createElement(exports.FileNameTitleContainer, null,
|
|
40
40
|
react_1.default.createElement(exports.FileTitle, null,
|
|
41
41
|
!showAttachmentName ? fileName : title,
|
|
@@ -29,7 +29,7 @@ const FileSectionItem = ({ externalFile, title, showAttachmentName = false, show
|
|
|
29
29
|
}
|
|
30
30
|
} },
|
|
31
31
|
react_1.default.createElement(FileTypeIcon_1.FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
|
|
32
|
-
react_1.default.createElement(FileInfo_1.FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions,
|
|
32
|
+
react_1.default.createElement(FileInfo_1.FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions, submissionAttachmentName: externalFile.name, title: title, designation: designation, attachmentId: externalFile.id, handleChangeDesignation: handleChangeDesignation, dispatch: dispatch })),
|
|
33
33
|
onClose && (react_1.default.createElement(IconCloseButton, { onClick: (e) => {
|
|
34
34
|
e.preventDefault();
|
|
35
35
|
onClose();
|
package/dist/cjs/index.js
CHANGED
|
@@ -76,8 +76,8 @@ Object.defineProperty(exports, "useDeepCompareMemo", { enumerable: true, get: fu
|
|
|
76
76
|
Object.defineProperty(exports, "useDeepCompareCallback", { enumerable: true, get: function () { return use_deep_compare_1.useDeepCompareCallback; } });
|
|
77
77
|
__exportStar(require("./lib/authors"), exports);
|
|
78
78
|
__exportStar(require("./lib/capabilities"), exports);
|
|
79
|
-
var
|
|
80
|
-
Object.defineProperty(exports, "errorsDecoder", { enumerable: true, get: function () { return __importDefault(
|
|
79
|
+
var lw_errors_decoder_1 = require("./lib/lw-errors-decoder");
|
|
80
|
+
Object.defineProperty(exports, "errorsDecoder", { enumerable: true, get: function () { return __importDefault(lw_errors_decoder_1).default; } });
|
|
81
81
|
__exportStar(require("./types"), exports);
|
|
82
82
|
var SelectDialogDesignation_1 = require("./components/FileManager/SelectDialogDesignation");
|
|
83
83
|
Object.defineProperty(exports, "SelectDialogDesignation", { enumerable: true, get: function () { return SelectDialogDesignation_1.SelectDialogDesignation; } });
|
|
@@ -3,22 +3,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CapabilitiesProvider = exports.useCalcPermission = exports.usePermissions = exports.getAllPermitted = exports.
|
|
6
|
+
exports.CapabilitiesProvider = exports.useCalcPermission = exports.usePermissions = exports.getAllPermitted = exports.getLWCapabilities = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
var A;
|
|
9
9
|
(function (A) {
|
|
10
|
+
A["proceed"] = "proceed";
|
|
10
11
|
A["updateAttachment"] = "update-attachment";
|
|
11
12
|
A["updateDueDate"] = "update-due-date";
|
|
12
13
|
A["addNote"] = "add-note";
|
|
13
14
|
A["setMainManuscript"] = "set-main-manuscript";
|
|
14
15
|
})(A || (A = {}));
|
|
15
|
-
const
|
|
16
|
+
const getLWCapabilities = (project, profile, lwRole, actions) => {
|
|
16
17
|
const isEditor = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.editors) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
17
18
|
const isOwner = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.owners) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
18
19
|
const isWriter = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.writers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
19
20
|
const isAnnotator = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.annotators) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
20
21
|
const isViewer = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.viewers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
21
|
-
const
|
|
22
|
+
const isLWProdEditor = () => lwRole == 'pe';
|
|
22
23
|
const allowed = (action) => !!(actions === null || actions === void 0 ? void 0 : actions.includes(action));
|
|
23
24
|
return {
|
|
24
25
|
handleSuggestion: isOwner() || isEditor() || isWriter(),
|
|
@@ -43,11 +44,12 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
43
44
|
uploadFile: isOwner() || isEditor() || isWriter(),
|
|
44
45
|
handleQualityReport: isOwner() || isEditor() || isWriter(),
|
|
45
46
|
setMainManuscript: allowed(A.setMainManuscript),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
completeTask: !isViewer() && allowed(A.proceed),
|
|
48
|
+
rejectTask: isLWProdEditor(),
|
|
49
|
+
acceptTask: isLWProdEditor(),
|
|
50
|
+
resolveOnHoldTask: isLWProdEditor(),
|
|
51
|
+
putOnHoldTask: isLWProdEditor(),
|
|
52
|
+
changeDueDate: isLWProdEditor() && allowed(A.updateDueDate),
|
|
51
53
|
previewAccess: true,
|
|
52
54
|
editNotTracked: false,
|
|
53
55
|
accessEditor: true,
|
|
@@ -57,9 +59,9 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
57
59
|
shareProject: isOwner(),
|
|
58
60
|
};
|
|
59
61
|
};
|
|
60
|
-
exports.
|
|
62
|
+
exports.getLWCapabilities = getLWCapabilities;
|
|
61
63
|
const getAllPermitted = () => {
|
|
62
|
-
const capabilities = (0, exports.
|
|
64
|
+
const capabilities = (0, exports.getLWCapabilities)();
|
|
63
65
|
const allAllowed = Object.keys(capabilities).reduce((caps, item) => {
|
|
64
66
|
caps[item] = true;
|
|
65
67
|
return caps;
|
|
@@ -67,14 +69,14 @@ const getAllPermitted = () => {
|
|
|
67
69
|
return allAllowed;
|
|
68
70
|
};
|
|
69
71
|
exports.getAllPermitted = getAllPermitted;
|
|
70
|
-
const CapabilitiesContext = react_1.default.createContext((0, exports.
|
|
72
|
+
const CapabilitiesContext = react_1.default.createContext((0, exports.getLWCapabilities)());
|
|
71
73
|
CapabilitiesContext.displayName = 'CapabilitiesContext';
|
|
72
74
|
const usePermissions = () => {
|
|
73
75
|
return react_1.default.useContext(CapabilitiesContext);
|
|
74
76
|
};
|
|
75
77
|
exports.usePermissions = usePermissions;
|
|
76
|
-
const useCalcPermission = ({ project, profile,
|
|
77
|
-
return (0, exports.
|
|
78
|
+
const useCalcPermission = ({ project, profile, lwRole, permittedActions, }) => {
|
|
79
|
+
return (0, exports.getLWCapabilities)(project, profile, lwRole, permittedActions);
|
|
78
80
|
};
|
|
79
81
|
exports.useCalcPermission = useCalcPermission;
|
|
80
82
|
const CapabilitiesProvider = (props) => {
|
|
@@ -2,11 +2,11 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { PermissionsContext } from '../FileManager';
|
|
4
4
|
import { DesignationActions } from './DesignationActions';
|
|
5
|
-
export const FileInfo = ({ showAttachmentName, showDesignationActions, title,
|
|
6
|
-
const fileName =
|
|
5
|
+
export const FileInfo = ({ showAttachmentName, showDesignationActions, title, submissionAttachmentName, fileExtension, designation, attachmentId, handleChangeDesignation, dispatch, }) => {
|
|
6
|
+
const fileName = submissionAttachmentName.substring(0, submissionAttachmentName.lastIndexOf('.'));
|
|
7
7
|
const can = useContext(PermissionsContext);
|
|
8
8
|
return (React.createElement(FileInfoContainer, null,
|
|
9
|
-
showDesignationActions && designation !== undefined && (React.createElement(DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName:
|
|
9
|
+
showDesignationActions && designation !== undefined && (React.createElement(DesignationActions, { designation: designation, attachmentId: attachmentId, fileExtension: fileExtension, handleChangeDesignation: handleChangeDesignation, fileName: submissionAttachmentName, dispatch: dispatch, can: can })),
|
|
10
10
|
React.createElement(FileNameTitleContainer, null,
|
|
11
11
|
React.createElement(FileTitle, null,
|
|
12
12
|
!showAttachmentName ? fileName : title,
|
|
@@ -23,7 +23,7 @@ export const FileSectionItem = ({ externalFile, title, showAttachmentName = fals
|
|
|
23
23
|
}
|
|
24
24
|
} },
|
|
25
25
|
React.createElement(FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.name }),
|
|
26
|
-
React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions,
|
|
26
|
+
React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions, submissionAttachmentName: externalFile.name, title: title, designation: designation, attachmentId: externalFile.id, handleChangeDesignation: handleChangeDesignation, dispatch: dispatch })),
|
|
27
27
|
onClose && (React.createElement(IconCloseButton, { onClick: (e) => {
|
|
28
28
|
e.preventDefault();
|
|
29
29
|
onClose();
|
package/dist/es/index.js
CHANGED
|
@@ -53,7 +53,7 @@ export { useFiles } from './hooks/use-files';
|
|
|
53
53
|
export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
|
|
54
54
|
export * from './lib/authors';
|
|
55
55
|
export * from './lib/capabilities';
|
|
56
|
-
export { default as errorsDecoder } from './lib/errors-decoder';
|
|
56
|
+
export { default as errorsDecoder } from './lib/lw-errors-decoder';
|
|
57
57
|
export * from './types';
|
|
58
58
|
export { SelectDialogDesignation } from './components/FileManager/SelectDialogDesignation';
|
|
59
59
|
export * from './components/LoadingOverlay';
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
var A;
|
|
3
3
|
(function (A) {
|
|
4
|
+
A["proceed"] = "proceed";
|
|
4
5
|
A["updateAttachment"] = "update-attachment";
|
|
5
6
|
A["updateDueDate"] = "update-due-date";
|
|
6
7
|
A["addNote"] = "add-note";
|
|
7
8
|
A["setMainManuscript"] = "set-main-manuscript";
|
|
8
9
|
})(A || (A = {}));
|
|
9
|
-
export const
|
|
10
|
+
export const getLWCapabilities = (project, profile, lwRole, actions) => {
|
|
10
11
|
const isEditor = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.editors) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
11
12
|
const isOwner = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.owners) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
12
13
|
const isWriter = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.writers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
13
14
|
const isAnnotator = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.annotators) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
14
15
|
const isViewer = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.viewers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
15
|
-
const
|
|
16
|
+
const isLWProdEditor = () => lwRole == 'pe';
|
|
16
17
|
const allowed = (action) => !!(actions === null || actions === void 0 ? void 0 : actions.includes(action));
|
|
17
18
|
return {
|
|
18
19
|
handleSuggestion: isOwner() || isEditor() || isWriter(),
|
|
@@ -37,11 +38,12 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
37
38
|
uploadFile: isOwner() || isEditor() || isWriter(),
|
|
38
39
|
handleQualityReport: isOwner() || isEditor() || isWriter(),
|
|
39
40
|
setMainManuscript: allowed(A.setMainManuscript),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
completeTask: !isViewer() && allowed(A.proceed),
|
|
42
|
+
rejectTask: isLWProdEditor(),
|
|
43
|
+
acceptTask: isLWProdEditor(),
|
|
44
|
+
resolveOnHoldTask: isLWProdEditor(),
|
|
45
|
+
putOnHoldTask: isLWProdEditor(),
|
|
46
|
+
changeDueDate: isLWProdEditor() && allowed(A.updateDueDate),
|
|
45
47
|
previewAccess: true,
|
|
46
48
|
editNotTracked: false,
|
|
47
49
|
accessEditor: true,
|
|
@@ -52,20 +54,20 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
52
54
|
};
|
|
53
55
|
};
|
|
54
56
|
export const getAllPermitted = () => {
|
|
55
|
-
const capabilities =
|
|
57
|
+
const capabilities = getLWCapabilities();
|
|
56
58
|
const allAllowed = Object.keys(capabilities).reduce((caps, item) => {
|
|
57
59
|
caps[item] = true;
|
|
58
60
|
return caps;
|
|
59
61
|
}, {});
|
|
60
62
|
return allAllowed;
|
|
61
63
|
};
|
|
62
|
-
const CapabilitiesContext = React.createContext(
|
|
64
|
+
const CapabilitiesContext = React.createContext(getLWCapabilities());
|
|
63
65
|
CapabilitiesContext.displayName = 'CapabilitiesContext';
|
|
64
66
|
export const usePermissions = () => {
|
|
65
67
|
return React.useContext(CapabilitiesContext);
|
|
66
68
|
};
|
|
67
|
-
export const useCalcPermission = ({ project, profile,
|
|
68
|
-
return
|
|
69
|
+
export const useCalcPermission = ({ project, profile, lwRole, permittedActions, }) => {
|
|
70
|
+
return getLWCapabilities(project, profile, lwRole, permittedActions);
|
|
69
71
|
};
|
|
70
72
|
export const CapabilitiesProvider = (props) => {
|
|
71
73
|
const { can } = props;
|
|
@@ -2,12 +2,12 @@ import { Model } from '@manuscripts/json-schema';
|
|
|
2
2
|
import { Build } from '@manuscripts/transform';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Capabilities } from '../../lib/capabilities';
|
|
5
|
-
import {
|
|
6
|
-
export type Upload = (file: File, designation: string) => Promise<boolean |
|
|
7
|
-
export type Replace = (attachmentId: string, name: string, file: File, typeId: string) => Promise<boolean |
|
|
5
|
+
import { SubmissionAttachment } from './FileSectionItem/FileSectionItem';
|
|
6
|
+
export type Upload = (file: File, designation: string) => Promise<boolean | SubmissionAttachment | undefined>;
|
|
7
|
+
export type Replace = (attachmentId: string, name: string, file: File, typeId: string) => Promise<boolean | SubmissionAttachment | undefined>;
|
|
8
8
|
export type ChangeDesignation = (attachmentId: string, typeId: string, name: string) => Promise<boolean>;
|
|
9
9
|
export interface FileManagement {
|
|
10
|
-
getAttachments: () =>
|
|
10
|
+
getAttachments: () => SubmissionAttachment[];
|
|
11
11
|
upload: Upload;
|
|
12
12
|
replace: Replace;
|
|
13
13
|
changeDesignation: ChangeDesignation;
|
|
@@ -19,5 +19,5 @@ export declare const FileManager: React.FC<{
|
|
|
19
19
|
saveModel: <T extends Model>(model: T | Build<T> | Partial<T>) => Promise<T>;
|
|
20
20
|
enableDragAndDrop: boolean;
|
|
21
21
|
can: Capabilities;
|
|
22
|
-
addAttachmentToState?: (a:
|
|
22
|
+
addAttachmentToState?: (a: SubmissionAttachment) => void;
|
|
23
23
|
}>;
|
|
@@ -6,7 +6,7 @@ export declare const FileInfo: React.FC<{
|
|
|
6
6
|
showAttachmentName: boolean;
|
|
7
7
|
showDesignationActions: boolean;
|
|
8
8
|
title: string;
|
|
9
|
-
|
|
9
|
+
submissionAttachmentName: string;
|
|
10
10
|
fileExtension: string;
|
|
11
11
|
designation?: Designation;
|
|
12
12
|
attachmentId: string;
|
|
@@ -3,18 +3,18 @@ import { DragElementWrapper, DragSourceOptions } from 'react-dnd';
|
|
|
3
3
|
import { Maybe } from '../../SubmissionInspector/types';
|
|
4
4
|
import { ChangeDesignation, Replace } from '../FileManager';
|
|
5
5
|
import { Action } from '../FileSectionState';
|
|
6
|
-
export type
|
|
6
|
+
export type SubmissionAttachment = {
|
|
7
7
|
id: string;
|
|
8
8
|
name: string;
|
|
9
|
-
type:
|
|
9
|
+
type: SubmissionAttachmentType;
|
|
10
10
|
link: string;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type SubmissionAttachmentType = {
|
|
13
13
|
id: string;
|
|
14
14
|
label?: Maybe<string> | undefined;
|
|
15
15
|
};
|
|
16
16
|
export interface FileSectionItemProps {
|
|
17
|
-
externalFile:
|
|
17
|
+
externalFile: SubmissionAttachment;
|
|
18
18
|
title: string;
|
|
19
19
|
showAttachmentName?: boolean;
|
|
20
20
|
showDesignationActions?: boolean;
|
|
@@ -2,12 +2,12 @@ import React, { Dispatch } from 'react';
|
|
|
2
2
|
import { Maybe } from '../../SubmissionInspector/types';
|
|
3
3
|
import { Replace } from '../FileManager';
|
|
4
4
|
import { Action } from '../FileSectionState';
|
|
5
|
-
import {
|
|
5
|
+
import { SubmissionAttachment } from './FileSectionItem';
|
|
6
6
|
export declare const ItemActions: React.FC<{
|
|
7
7
|
downloadAttachmentHandler: (url: string) => void;
|
|
8
8
|
replaceAttachmentHandler: Replace;
|
|
9
9
|
detachAttachmnetHandler?: () => void;
|
|
10
|
-
handleUpdateInline?: (attachment:
|
|
10
|
+
handleUpdateInline?: (attachment: SubmissionAttachment) => void;
|
|
11
11
|
attachmentId: string;
|
|
12
12
|
fileName: string;
|
|
13
13
|
designation?: Maybe<string> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Dispatch } from 'react';
|
|
2
2
|
import { Replace } from './FileManager';
|
|
3
|
-
import {
|
|
3
|
+
import { SubmissionAttachment } from './FileSectionItem/FileSectionItem';
|
|
4
4
|
import { Action } from './FileSectionState';
|
|
5
5
|
import { FileType } from './util';
|
|
6
6
|
export declare const InlineFilesSection: React.FC<{
|
|
@@ -9,11 +9,11 @@ export declare const InlineFilesSection: React.FC<{
|
|
|
9
9
|
label: string;
|
|
10
10
|
type: FileType;
|
|
11
11
|
caption?: string;
|
|
12
|
-
attachments?:
|
|
12
|
+
attachments?: SubmissionAttachment[];
|
|
13
13
|
}[];
|
|
14
14
|
handleReplace: Replace;
|
|
15
15
|
handleDownload: (url: string) => void;
|
|
16
|
-
handleUpdateInline?: (modelId: string, attachment:
|
|
16
|
+
handleUpdateInline?: (modelId: string, attachment: SubmissionAttachment) => void;
|
|
17
17
|
handleDetachFile?: (attachmentLink: string, modelId: string) => void;
|
|
18
18
|
isEditor: boolean;
|
|
19
19
|
dispatch: Dispatch<Action>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Capabilities } from '../../lib/capabilities';
|
|
2
2
|
import { Maybe } from '../SubmissionInspector/types';
|
|
3
|
-
import {
|
|
3
|
+
import { SubmissionAttachment } from './FileSectionItem/FileSectionItem';
|
|
4
4
|
export declare enum FileSectionType {
|
|
5
5
|
Inline = 0,
|
|
6
6
|
Supplements = 1,
|
|
@@ -44,9 +44,9 @@ export declare const designationWithAllowedDesignationsToTransitionMap: Map<Desi
|
|
|
44
44
|
export declare const extensionsWithFileTypesMap: Map<string, FileType>;
|
|
45
45
|
export declare const fileTypesWithTitlesMap: Map<FileType | undefined, string>;
|
|
46
46
|
export declare const fileTypesWithIconMap: Map<FileType | undefined, JSX.Element>;
|
|
47
|
-
export declare const generateAttachmentsTitles: (externalFiles:
|
|
47
|
+
export declare const generateAttachmentsTitles: (externalFiles: SubmissionAttachment[], fileSectionType: FileSectionType) => Array<{
|
|
48
48
|
title: string;
|
|
49
|
-
externalFile:
|
|
49
|
+
externalFile: SubmissionAttachment;
|
|
50
50
|
}>;
|
|
51
51
|
export declare const getDesignationActionsList: (designation: Designation, fileExtension: string) => Array<Designation>;
|
|
52
52
|
export declare const getDesignationName: (designation: Designation) => string;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
/// <reference types="react" />
|
|
17
|
-
export declare const CenteredForm: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "
|
|
17
|
+
export declare const CenteredForm: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "name" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoComplete" | "method" | "target" | "acceptCharset" | "action" | "encType" | "noValidate"> & import("react").RefAttributes<HTMLFormElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
18
18
|
export declare const FormHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
19
|
export declare const FormActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
20
|
export declare const FormError: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Model } from '@manuscripts/json-schema';
|
|
2
|
-
import {
|
|
2
|
+
import { SubmissionAttachment } from '../components/FileManager/FileSectionItem/FileSectionItem';
|
|
3
3
|
import { InlineFile } from '../lib/inlineFiles';
|
|
4
4
|
type FilePredicate = (fileName: string) => boolean;
|
|
5
|
-
export declare const useFiles: (modelMap: Map<string, Model>, attachments:
|
|
6
|
-
otherFiles:
|
|
7
|
-
supplementFiles:
|
|
5
|
+
export declare const useFiles: (modelMap: Map<string, Model>, attachments: SubmissionAttachment[], filePredicate?: FilePredicate) => {
|
|
6
|
+
otherFiles: SubmissionAttachment[];
|
|
7
|
+
supplementFiles: SubmissionAttachment[];
|
|
8
8
|
inlineFiles: InlineFile[];
|
|
9
9
|
};
|
|
10
10
|
export default useFiles;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export { useFiles } from './hooks/use-files';
|
|
|
54
54
|
export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
|
|
55
55
|
export * from './lib/authors';
|
|
56
56
|
export * from './lib/capabilities';
|
|
57
|
-
export { default as errorsDecoder } from './lib/errors-decoder';
|
|
57
|
+
export { default as errorsDecoder } from './lib/lw-errors-decoder';
|
|
58
58
|
export * from './types';
|
|
59
59
|
export { SelectDialogDesignation } from './components/FileManager/SelectDialogDesignation';
|
|
60
60
|
export * from './components/LoadingOverlay';
|
|
@@ -24,6 +24,7 @@ export type Capabilities = {
|
|
|
24
24
|
uploadFile: boolean;
|
|
25
25
|
handleQualityReport: boolean;
|
|
26
26
|
setMainManuscript: boolean;
|
|
27
|
+
completeTask: boolean;
|
|
27
28
|
rejectTask: boolean;
|
|
28
29
|
acceptTask: boolean;
|
|
29
30
|
resolveOnHoldTask: boolean;
|
|
@@ -40,14 +41,14 @@ export type Capabilities = {
|
|
|
40
41
|
export interface ProviderProps {
|
|
41
42
|
project?: Project;
|
|
42
43
|
profile?: UserProfileWithAvatar;
|
|
43
|
-
|
|
44
|
+
lwRole?: string;
|
|
44
45
|
permittedActions?: string[];
|
|
45
46
|
children?: React.ReactNode;
|
|
46
47
|
}
|
|
47
|
-
export declare const
|
|
48
|
+
export declare const getLWCapabilities: (project?: Project, profile?: UserProfileWithAvatar, lwRole?: ProviderProps['lwRole'], actions?: string[]) => Capabilities;
|
|
48
49
|
export declare const getAllPermitted: () => Capabilities;
|
|
49
50
|
export declare const usePermissions: () => Capabilities;
|
|
50
|
-
export declare const useCalcPermission: ({ project, profile,
|
|
51
|
+
export declare const useCalcPermission: ({ project, profile, lwRole, permittedActions, }: ProviderProps) => Capabilities;
|
|
51
52
|
export declare const CapabilitiesProvider: React.FC<{
|
|
52
53
|
can: Capabilities;
|
|
53
54
|
}>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Model } from '@manuscripts/json-schema';
|
|
2
|
-
import {
|
|
2
|
+
import { SubmissionAttachment } from '../components/FileManager/FileSectionItem/FileSectionItem';
|
|
3
3
|
import { FileType } from '../components/FileManager/util';
|
|
4
4
|
export type InlineFile = {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string;
|
|
7
7
|
type: FileType;
|
|
8
|
-
attachments?:
|
|
8
|
+
attachments?: SubmissionAttachment[];
|
|
9
9
|
};
|
|
10
|
-
declare const _default: (modelMap: Map<string, Model>, attachments:
|
|
10
|
+
declare const _default: (modelMap: Map<string, Model>, attachments: SubmissionAttachment[]) => InlineFile[];
|
|
11
11
|
export default _default;
|
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.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@formatjs/intl-relativetimeformat": "^4.5.9",
|
|
37
37
|
"@formatjs/intl-utils": "^2.2.0",
|
|
38
38
|
"@manuscripts/assets": "^0.6.2",
|
|
39
|
-
"@manuscripts/transform": "^1.
|
|
40
|
-
"@manuscripts/json-schema": "^
|
|
39
|
+
"@manuscripts/transform": "^1.2.0",
|
|
40
|
+
"@manuscripts/json-schema": "^2.0.0",
|
|
41
41
|
"@manuscripts/title-editor": "^1.1.0",
|
|
42
42
|
"@manuscripts/comment-editor": "^1.0.1",
|
|
43
43
|
"@reach/tabs": "^0.11.2",
|
|
@@ -116,11 +116,6 @@
|
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"@apollo/client": "^3.7.3",
|
|
119
|
-
"@manuscripts/assets": "^0.6.2",
|
|
120
|
-
"@manuscripts/comment-editor": "^1.0.0",
|
|
121
|
-
"@manuscripts/json-schema": "^1.0.0",
|
|
122
|
-
"@manuscripts/title-editor": "^1.0.0",
|
|
123
|
-
"@manuscripts/transform": "^1.0.1",
|
|
124
119
|
"@reach/tabs": "^0.11.2",
|
|
125
120
|
"formik": "^2.2.9",
|
|
126
121
|
"prosemirror-commands": "^1.5.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|