@manuscripts/style-guide 1.0.6 → 1.0.7-LEAN-2237
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/FileManager.js +7 -20
- package/dist/cjs/components/FileManager/FileSectionItem/DragLayer.js +1 -1
- package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +1 -3
- package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +4 -6
- package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +3 -17
- package/dist/cjs/components/FileManager/FileSectionState.js +4 -14
- package/dist/cjs/components/FileManager/FilesSection.js +6 -20
- package/dist/cjs/components/FileManager/InlineFilesSection.js +1 -1
- package/dist/cjs/components/FileManager/util.js +1 -323
- package/dist/cjs/index.js +1 -5
- package/dist/cjs/lib/capabilities.js +0 -1
- package/dist/es/components/FileManager/FileManager.js +8 -21
- package/dist/es/components/FileManager/FileSectionItem/DragLayer.js +1 -1
- package/dist/es/components/FileManager/FileSectionItem/FileInfo.js +1 -3
- package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +4 -6
- package/dist/es/components/FileManager/FileSectionItem/ItemActions.js +3 -17
- package/dist/es/components/FileManager/FileSectionState.js +4 -14
- package/dist/es/components/FileManager/FilesSection.js +8 -22
- package/dist/es/components/FileManager/InlineFilesSection.js +1 -1
- package/dist/es/components/FileManager/util.js +0 -318
- package/dist/es/index.js +0 -2
- package/dist/es/lib/capabilities.js +0 -1
- package/dist/types/components/FileManager/FileManager.d.ts +2 -4
- package/dist/types/components/FileManager/FileSectionItem/FileInfo.d.ts +0 -5
- package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +1 -3
- package/dist/types/components/FileManager/FileSectionItem/ItemActions.d.ts +0 -2
- package/dist/types/components/FileManager/FileSectionState.d.ts +1 -5
- package/dist/types/components/FileManager/util.d.ts +0 -31
- package/dist/types/components/icons/add-author.d.ts +0 -1
- package/dist/types/components/icons/add-comment-icon.d.ts +0 -1
- package/dist/types/components/icons/add-icon-active.d.ts +0 -1
- package/dist/types/components/icons/add-icon-inverted.d.ts +0 -1
- package/dist/types/components/icons/back-arrow.d.ts +0 -1
- package/dist/types/components/icons/bookmark.d.ts +0 -1
- package/dist/types/components/icons/google.d.ts +0 -1
- package/dist/types/components/icons/orcid.d.ts +0 -1
- package/dist/types/components/icons/plus-icon.d.ts +0 -1
- package/dist/types/components/icons/project-notification.d.ts +0 -1
- package/dist/types/components/icons/project.d.ts +0 -1
- package/dist/types/components/icons/projects-list.d.ts +0 -1
- package/dist/types/components/icons/search.d.ts +0 -1
- package/dist/types/components/icons/tick-mark.d.ts +0 -1
- package/dist/types/components/icons/user.d.ts +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/lib/capabilities.d.ts +0 -1
- package/package.json +35 -37
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +0 -131
- package/dist/cjs/components/FileManager/FileSectionItem/DesignationActionsList.js +0 -54
- package/dist/cjs/components/FileManager/SelectDesignationActions.js +0 -74
- package/dist/cjs/components/FileManager/SelectDialogDesignation.js +0 -33
- package/dist/cjs/components/PdfPreview.js +0 -111
- package/dist/es/components/FileManager/FileSectionItem/DesignationActions.js +0 -101
- package/dist/es/components/FileManager/FileSectionItem/DesignationActionsList.js +0 -47
- package/dist/es/components/FileManager/SelectDesignationActions.js +0 -44
- package/dist/es/components/FileManager/SelectDialogDesignation.js +0 -26
- package/dist/es/components/PdfPreview.js +0 -83
- package/dist/types/components/FileManager/FileSectionItem/DesignationActions.d.ts +0 -14
- package/dist/types/components/FileManager/FileSectionItem/DesignationActionsList.d.ts +0 -13
- package/dist/types/components/FileManager/SelectDesignationActions.d.ts +0 -12
- package/dist/types/components/FileManager/SelectDialogDesignation.d.ts +0 -11
- package/dist/types/components/PdfPreview.d.ts +0 -7
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.SelectDesignationActions = void 0;
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
|
-
const creatable_1 = __importDefault(require("react-select/creatable"));
|
|
32
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
33
|
-
const BottomArrowIcon_1 = __importDefault(require("../icons/BottomArrowIcon"));
|
|
34
|
-
const FileManager_1 = require("./FileManager");
|
|
35
|
-
const FileSectionState_1 = require("./FileSectionState");
|
|
36
|
-
const util_1 = require("./util");
|
|
37
|
-
const DropdownIndicator = () => (react_1.default.createElement(SelectDesignationContainer, null,
|
|
38
|
-
react_1.default.createElement(BottomArrowIcon_1.default, null)));
|
|
39
|
-
const reactSelectComponents = {
|
|
40
|
-
IndicatorsContainer: DropdownIndicator,
|
|
41
|
-
};
|
|
42
|
-
const SelectDesignationActions = ({ fileExtension, fileSection, dispatch }) => {
|
|
43
|
-
const can = (0, react_1.useContext)(FileManager_1.PermissionsContext);
|
|
44
|
-
const handleInputChange = (selectedDesignation) => {
|
|
45
|
-
if (selectedDesignation) {
|
|
46
|
-
if (selectedDesignation && 'value' in selectedDesignation) {
|
|
47
|
-
dispatch(FileSectionState_1.actions.SELECT_DESIGNATION(selectedDesignation.value));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
if (fileExtension) {
|
|
52
|
-
const designationActionsList = (0, util_1.getUploadFileDesignationList)(fileExtension, fileSection, can);
|
|
53
|
-
return (react_1.default.createElement(creatable_1.default, { closeMenuOnSelect: true, options: designationActionsList, onChange: handleInputChange, placeholder: "Select Designation", components: reactSelectComponents }));
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
exports.SelectDesignationActions = SelectDesignationActions;
|
|
60
|
-
const SelectDesignationContainer = styled_components_1.default.div `
|
|
61
|
-
padding-right: 12px;
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
justify-content: space-around;
|
|
65
|
-
|
|
66
|
-
circle,
|
|
67
|
-
use {
|
|
68
|
-
fill: ${(props) => props.theme.colors.brand.default};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
path {
|
|
72
|
-
mask: none;
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
@@ -1,33 +0,0 @@
|
|
|
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.SelectDialogDesignation = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const Dialog_1 = require("../Dialog");
|
|
10
|
-
const SelectDesignationActions_1 = require("./SelectDesignationActions");
|
|
11
|
-
const SelectDialogDesignation = ({ isOpen, fileExtension, fileSection, handleCancel, uploadFileHandler, dispatch, }) => {
|
|
12
|
-
return (react_1.default.createElement(DesignationDialog, { isOpen: isOpen, category: Dialog_1.Category.confirmation, header: "Choose designation", message: "Please choose the designation for the file", actions: {
|
|
13
|
-
primary: {
|
|
14
|
-
action: uploadFileHandler,
|
|
15
|
-
title: 'Choose',
|
|
16
|
-
},
|
|
17
|
-
secondary: {
|
|
18
|
-
action: handleCancel,
|
|
19
|
-
title: 'Cancel',
|
|
20
|
-
},
|
|
21
|
-
} },
|
|
22
|
-
react_1.default.createElement(SelectDesignationActions_1.SelectDesignationActions, { fileExtension: fileExtension, fileSection: fileSection, dispatch: dispatch })));
|
|
23
|
-
};
|
|
24
|
-
exports.SelectDialogDesignation = SelectDialogDesignation;
|
|
25
|
-
const DesignationDialog = (0, styled_components_1.default)(Dialog_1.Dialog) `
|
|
26
|
-
& ${Dialog_1.ModalBody} {
|
|
27
|
-
overflow: visible;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
& ${Dialog_1.MessageContainer} {
|
|
31
|
-
overflow: visible;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
require("pdfjs-dist/web/pdf_viewer.css");
|
|
30
|
-
const pdf_1 = require("pdfjs-dist/build/pdf");
|
|
31
|
-
const pdfjsWorker = __importStar(require("pdfjs-dist/build/pdf.worker.entry"));
|
|
32
|
-
const pdf_viewer_1 = require("pdfjs-dist/web/pdf_viewer");
|
|
33
|
-
const react_1 = __importStar(require("react"));
|
|
34
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
35
|
-
pdf_1.GlobalWorkerOptions.workerSrc = pdfjsWorker;
|
|
36
|
-
const PdfPreview = ({ url, scale = 1, }) => {
|
|
37
|
-
const [pdfViewer, setPdfViewer] = (0, react_1.useState)({
|
|
38
|
-
currentScaleValue: scale,
|
|
39
|
-
});
|
|
40
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
41
|
-
const [progress, setProgress] = (0, react_1.useState)(null);
|
|
42
|
-
const [eventBus, setEventBus] = (0, react_1.useState)(null);
|
|
43
|
-
const nodeRef = (0, react_1.useRef)(null);
|
|
44
|
-
(0, react_1.useEffect)(() => {
|
|
45
|
-
const container = nodeRef.current;
|
|
46
|
-
const eventBus = new pdf_viewer_1.EventBus();
|
|
47
|
-
const pdfViewer = new pdf_viewer_1.PDFViewer({
|
|
48
|
-
container,
|
|
49
|
-
eventBus,
|
|
50
|
-
});
|
|
51
|
-
setPdfViewer(pdfViewer);
|
|
52
|
-
setEventBus(eventBus);
|
|
53
|
-
const loadingTask = (0, pdf_1.getDocument)({
|
|
54
|
-
url,
|
|
55
|
-
withCredentials: true,
|
|
56
|
-
});
|
|
57
|
-
loadingTask.onProgress = (progressData) => setProgress(progressData);
|
|
58
|
-
loadingTask.promise
|
|
59
|
-
.then((pdfDocument) => {
|
|
60
|
-
pdfViewer.setDocument(pdfDocument);
|
|
61
|
-
return true;
|
|
62
|
-
}, (exception) => {
|
|
63
|
-
setError(exception);
|
|
64
|
-
})
|
|
65
|
-
.catch((err) => {
|
|
66
|
-
setError(err);
|
|
67
|
-
});
|
|
68
|
-
}, [url]);
|
|
69
|
-
(0, react_1.useEffect)(() => {
|
|
70
|
-
pdfViewer.currentScaleValue = scale;
|
|
71
|
-
if (eventBus) {
|
|
72
|
-
eventBus.on('pagesinit', () => (pdfViewer.currentScaleValue = scale));
|
|
73
|
-
}
|
|
74
|
-
}, [pdfViewer, eventBus, scale]);
|
|
75
|
-
if (error) {
|
|
76
|
-
return react_1.default.createElement(Error, null, "Unable to download PDF file");
|
|
77
|
-
}
|
|
78
|
-
return (react_1.default.createElement(ViewerContainer, { ref: nodeRef, id: 'viewerContainer' },
|
|
79
|
-
react_1.default.createElement("div", { id: "viewer", className: "pdfViewer" }),
|
|
80
|
-
progress != null ? (progress.total > progress.loaded && (react_1.default.createElement(Container, null,
|
|
81
|
-
react_1.default.createElement(ProgressContainer, null,
|
|
82
|
-
react_1.default.createElement(Progress, { progress: (progress.loaded / progress.total) * 100 },
|
|
83
|
-
((progress.loaded / progress.total) * 100).toFixed(),
|
|
84
|
-
"%"))))) : (react_1.default.createElement(Container, null, 'Loading\u2026'))));
|
|
85
|
-
};
|
|
86
|
-
exports.default = PdfPreview;
|
|
87
|
-
const ViewerContainer = styled_components_1.default.div `
|
|
88
|
-
position: absolute;
|
|
89
|
-
width: 100%;
|
|
90
|
-
`;
|
|
91
|
-
const Container = styled_components_1.default.div `
|
|
92
|
-
position: fixed;
|
|
93
|
-
top: 50%;
|
|
94
|
-
right: 50%;
|
|
95
|
-
`;
|
|
96
|
-
const ProgressContainer = styled_components_1.default.div `
|
|
97
|
-
width: ${(props) => props.theme.grid.unit * 50}px;
|
|
98
|
-
height: ${(props) => props.theme.grid.unit * 7}px;
|
|
99
|
-
overflow: hidden;
|
|
100
|
-
background: ${(props) => props.theme.colors.background.secondary};
|
|
101
|
-
`;
|
|
102
|
-
const Progress = styled_components_1.default.div `
|
|
103
|
-
height: 100%;
|
|
104
|
-
display: block;
|
|
105
|
-
width: ${(props) => props.progress}%;
|
|
106
|
-
background: ${(props) => props.theme.colors.background.success};
|
|
107
|
-
text-align: center;
|
|
108
|
-
`;
|
|
109
|
-
const Error = (0, styled_components_1.default)(Container) `
|
|
110
|
-
color: ${(props) => props.theme.colors.text.error};
|
|
111
|
-
`;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import ReactTooltip from 'react-tooltip';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import BottomArrowIcon from '../../icons/BottomArrowIcon';
|
|
5
|
-
import { ConfirmationPopUp } from '../ConfirmationPopUp';
|
|
6
|
-
import { TooltipDiv } from '../TooltipDiv';
|
|
7
|
-
import { designationWithReadableNamesMap, getDesignationActionsList, } from '../util';
|
|
8
|
-
import { DesignationActionsList } from './DesignationActionsList';
|
|
9
|
-
export const DesignationActions = ({ designation, attachmentId, fileExtension, handleChangeDesignation, fileName, can, dispatch, }) => {
|
|
10
|
-
const [isActionsShown, setIsActionsShown] = useState(false);
|
|
11
|
-
const [confirmationPopUpData, setConfirmationPopUpData] = useState({
|
|
12
|
-
isConfirmationPopUpOpen: false,
|
|
13
|
-
confirmationPopUpMessage: '',
|
|
14
|
-
confirmationPopUpHeader: '',
|
|
15
|
-
selectedDesignation: '',
|
|
16
|
-
});
|
|
17
|
-
const toggleActionsList = () => {
|
|
18
|
-
setIsActionsShown((prevState) => {
|
|
19
|
-
return !prevState;
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
const hideActionsList = () => {
|
|
23
|
-
setIsActionsShown(false);
|
|
24
|
-
};
|
|
25
|
-
if (designation !== undefined && fileExtension) {
|
|
26
|
-
const designationActionsList = getDesignationActionsList(designation, fileExtension);
|
|
27
|
-
if (!designationActionsList.length) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const handleOpenConfirmationPopup = (popupHeader, popupMessage, designation) => {
|
|
31
|
-
setConfirmationPopUpData({
|
|
32
|
-
confirmationPopUpMessage: popupMessage,
|
|
33
|
-
confirmationPopUpHeader: popupHeader,
|
|
34
|
-
isConfirmationPopUpOpen: true,
|
|
35
|
-
selectedDesignation: designation,
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
const handleMoveAction = () => {
|
|
39
|
-
handleChangeDesignation &&
|
|
40
|
-
handleChangeDesignation(attachmentId, confirmationPopUpData.selectedDesignation, fileName);
|
|
41
|
-
handleCloseAction();
|
|
42
|
-
};
|
|
43
|
-
const handleCloseAction = () => {
|
|
44
|
-
setConfirmationPopUpData({
|
|
45
|
-
confirmationPopUpMessage: '',
|
|
46
|
-
confirmationPopUpHeader: '',
|
|
47
|
-
selectedDesignation: '',
|
|
48
|
-
isConfirmationPopUpOpen: false,
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
return (React.createElement(React.Fragment, null,
|
|
52
|
-
React.createElement(SecondaryActionsContainer, { onClick: toggleActionsList, onBlur: hideActionsList },
|
|
53
|
-
!(can === null || can === void 0 ? void 0 : can.changeDesignation) && (React.createElement(TooltipContainer, null,
|
|
54
|
-
React.createElement(ReactTooltip, { id: "file-designation", place: "bottom", offset: { bottom: -8 }, effect: "solid", className: "tooltip" },
|
|
55
|
-
React.createElement("div", null, "You don\u2019t have permissions to adjust this selection")))),
|
|
56
|
-
React.createElement(SecondaryActionsText, { "data-for": "file-designation", "data-tip": true }, designationWithReadableNamesMap.get(designation)),
|
|
57
|
-
React.createElement(BottomArrowIcon, null),
|
|
58
|
-
isActionsShown && (can === null || can === void 0 ? void 0 : can.changeDesignation) && (React.createElement(ActionsListContainer, null,
|
|
59
|
-
React.createElement(DesignationActionsList, { handleChangeDesignation: handleChangeDesignation, designationActionsList: designationActionsList, fileName: fileName, designation: designation, attachmentId: attachmentId, dispatch: dispatch, handleOpenConfirmationPopup: handleOpenConfirmationPopup })))),
|
|
60
|
-
confirmationPopUpData.isConfirmationPopUpOpen && (React.createElement(ConfirmationPopUp, { popupHeader: confirmationPopUpData.confirmationPopUpHeader !== undefined
|
|
61
|
-
? confirmationPopUpData.confirmationPopUpHeader
|
|
62
|
-
: '', popUpMessage: confirmationPopUpData.confirmationPopUpMessage !== undefined
|
|
63
|
-
? confirmationPopUpData.confirmationPopUpMessage
|
|
64
|
-
: '', isOpen: confirmationPopUpData.isConfirmationPopUpOpen, handleClose: () => handleCloseAction(), handleMove: () => handleMoveAction() }))));
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const SecondaryActionsContainer = styled.button `
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
background: transparent;
|
|
74
|
-
border: none;
|
|
75
|
-
padding: 0;
|
|
76
|
-
font-family: ${(props) => props.theme.font.family.Lato};
|
|
77
|
-
font-weight: normal;
|
|
78
|
-
font-size: 14px;
|
|
79
|
-
line-height: 20px;
|
|
80
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
|
|
83
|
-
&:focus {
|
|
84
|
-
outline: none;
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
87
|
-
const SecondaryActionsText = styled.div `
|
|
88
|
-
margin-right: 8px;
|
|
89
|
-
`;
|
|
90
|
-
const ActionsListContainer = styled.div `
|
|
91
|
-
position: absolute;
|
|
92
|
-
top: 40px;
|
|
93
|
-
z-index: 999;
|
|
94
|
-
`;
|
|
95
|
-
const TooltipContainer = styled(TooltipDiv) `
|
|
96
|
-
.tooltip {
|
|
97
|
-
white-space: normal;
|
|
98
|
-
width: 144px;
|
|
99
|
-
height: 32px;
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { actions } from '../FileSectionState';
|
|
3
|
-
import { ActionsBox, ActionsItem, ActionsLabel, ActionsSeparator, } from '../ItemsAction';
|
|
4
|
-
import { Designation, designationWithFileSectionsMap, designationWithReadableNamesMap, FileSectionType, getDesignationName, } from '../util';
|
|
5
|
-
export const DesignationActionsList = ({ handleChangeDesignation, designationActionsList, fileName, designation, attachmentId, dispatch, handleOpenConfirmationPopup, }) => {
|
|
6
|
-
const handleChangeOtherFilesTabDesignation = (designation, isMoveInOtherFileSection, confirmationPopupHeader, confirmationPopupMessage, successMoveMessage) => {
|
|
7
|
-
if (isMoveInOtherFileSection) {
|
|
8
|
-
if (dispatch) {
|
|
9
|
-
dispatch(actions.MOVE_FILE(attachmentId, getDesignationName(designation), fileName, successMoveMessage));
|
|
10
|
-
handleOpenConfirmationPopup(confirmationPopupHeader, confirmationPopupMessage, getDesignationName(designation));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
handleChangeDesignation &&
|
|
15
|
-
handleChangeDesignation(attachmentId, getDesignationName(designation), fileName);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const isSupplementaryActionIncluded = designationActionsList.indexOf(Designation.Supplementary) !== -1;
|
|
19
|
-
const otherFilesActionsList = designationActionsList
|
|
20
|
-
.filter((value) => value !== Designation.Supplementary)
|
|
21
|
-
.map((value) => {
|
|
22
|
-
return (React.createElement(ActionsItem, { key: value, onClick: () => {
|
|
23
|
-
let isMoveToOtherFileSection = true;
|
|
24
|
-
if (designation !== undefined) {
|
|
25
|
-
isMoveToOtherFileSection =
|
|
26
|
-
designationWithFileSectionsMap.get(designation) !==
|
|
27
|
-
FileSectionType.OtherFile;
|
|
28
|
-
}
|
|
29
|
-
handleChangeOtherFilesTabDesignation(value, isMoveToOtherFileSection, 'Are you sure you want to move this file to "Other"?', 'The file will be removed from the "Supplementary" and added to "Other".', 'Supplementary file successfully moved to other files');
|
|
30
|
-
} }, designationWithReadableNamesMap.get(value)));
|
|
31
|
-
});
|
|
32
|
-
return (React.createElement(ActionsBox, null,
|
|
33
|
-
otherFilesActionsList.length > 0 && (React.createElement(React.Fragment, null,
|
|
34
|
-
React.createElement(ActionsLabel, null, "Other Files"),
|
|
35
|
-
otherFilesActionsList)),
|
|
36
|
-
isSupplementaryActionIncluded && (React.createElement(React.Fragment, null,
|
|
37
|
-
React.createElement(ActionsSeparator, null),
|
|
38
|
-
React.createElement(ActionsItem, { onClick: () => {
|
|
39
|
-
let isMoveToOtherFileSection = true;
|
|
40
|
-
if (designation !== undefined) {
|
|
41
|
-
isMoveToOtherFileSection =
|
|
42
|
-
designationWithFileSectionsMap.get(designation) !==
|
|
43
|
-
FileSectionType.Supplements;
|
|
44
|
-
}
|
|
45
|
-
handleChangeOtherFilesTabDesignation(Designation.Supplementary, isMoveToOtherFileSection, 'Are you sure you want to move this file to "Supplementary"?', 'The file will be removed from the "Other" and added to "Supplementary".', 'File successfully moved to Supplementary files');
|
|
46
|
-
} }, designationWithReadableNamesMap.get(Designation.Supplementary))))));
|
|
47
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import CreatableSelect from 'react-select/creatable';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import BottomArrowIcon from '../icons/BottomArrowIcon';
|
|
5
|
-
import { PermissionsContext } from './FileManager';
|
|
6
|
-
import { actions } from './FileSectionState';
|
|
7
|
-
import { getUploadFileDesignationList, } from './util';
|
|
8
|
-
const DropdownIndicator = () => (React.createElement(SelectDesignationContainer, null,
|
|
9
|
-
React.createElement(BottomArrowIcon, null)));
|
|
10
|
-
const reactSelectComponents = {
|
|
11
|
-
IndicatorsContainer: DropdownIndicator,
|
|
12
|
-
};
|
|
13
|
-
export const SelectDesignationActions = ({ fileExtension, fileSection, dispatch }) => {
|
|
14
|
-
const can = useContext(PermissionsContext);
|
|
15
|
-
const handleInputChange = (selectedDesignation) => {
|
|
16
|
-
if (selectedDesignation) {
|
|
17
|
-
if (selectedDesignation && 'value' in selectedDesignation) {
|
|
18
|
-
dispatch(actions.SELECT_DESIGNATION(selectedDesignation.value));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
if (fileExtension) {
|
|
23
|
-
const designationActionsList = getUploadFileDesignationList(fileExtension, fileSection, can);
|
|
24
|
-
return (React.createElement(CreatableSelect, { closeMenuOnSelect: true, options: designationActionsList, onChange: handleInputChange, placeholder: "Select Designation", components: reactSelectComponents }));
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const SelectDesignationContainer = styled.div `
|
|
31
|
-
padding-right: 12px;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
justify-content: space-around;
|
|
35
|
-
|
|
36
|
-
circle,
|
|
37
|
-
use {
|
|
38
|
-
fill: ${(props) => props.theme.colors.brand.default};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
path {
|
|
42
|
-
mask: none;
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { Category, Dialog, MessageContainer, ModalBody } from '../Dialog';
|
|
4
|
-
import { SelectDesignationActions } from './SelectDesignationActions';
|
|
5
|
-
export const SelectDialogDesignation = ({ isOpen, fileExtension, fileSection, handleCancel, uploadFileHandler, dispatch, }) => {
|
|
6
|
-
return (React.createElement(DesignationDialog, { isOpen: isOpen, category: Category.confirmation, header: "Choose designation", message: "Please choose the designation for the file", actions: {
|
|
7
|
-
primary: {
|
|
8
|
-
action: uploadFileHandler,
|
|
9
|
-
title: 'Choose',
|
|
10
|
-
},
|
|
11
|
-
secondary: {
|
|
12
|
-
action: handleCancel,
|
|
13
|
-
title: 'Cancel',
|
|
14
|
-
},
|
|
15
|
-
} },
|
|
16
|
-
React.createElement(SelectDesignationActions, { fileExtension: fileExtension, fileSection: fileSection, dispatch: dispatch })));
|
|
17
|
-
};
|
|
18
|
-
const DesignationDialog = styled(Dialog) `
|
|
19
|
-
& ${ModalBody} {
|
|
20
|
-
overflow: visible;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
& ${MessageContainer} {
|
|
24
|
-
overflow: visible;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import 'pdfjs-dist/web/pdf_viewer.css';
|
|
2
|
-
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist/build/pdf';
|
|
3
|
-
import * as pdfjsWorker from 'pdfjs-dist/build/pdf.worker.entry';
|
|
4
|
-
import { EventBus, PDFViewer } from 'pdfjs-dist/web/pdf_viewer';
|
|
5
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
GlobalWorkerOptions.workerSrc = pdfjsWorker;
|
|
8
|
-
const PdfPreview = ({ url, scale = 1, }) => {
|
|
9
|
-
const [pdfViewer, setPdfViewer] = useState({
|
|
10
|
-
currentScaleValue: scale,
|
|
11
|
-
});
|
|
12
|
-
const [error, setError] = useState(null);
|
|
13
|
-
const [progress, setProgress] = useState(null);
|
|
14
|
-
const [eventBus, setEventBus] = useState(null);
|
|
15
|
-
const nodeRef = useRef(null);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const container = nodeRef.current;
|
|
18
|
-
const eventBus = new EventBus();
|
|
19
|
-
const pdfViewer = new PDFViewer({
|
|
20
|
-
container,
|
|
21
|
-
eventBus,
|
|
22
|
-
});
|
|
23
|
-
setPdfViewer(pdfViewer);
|
|
24
|
-
setEventBus(eventBus);
|
|
25
|
-
const loadingTask = getDocument({
|
|
26
|
-
url,
|
|
27
|
-
withCredentials: true,
|
|
28
|
-
});
|
|
29
|
-
loadingTask.onProgress = (progressData) => setProgress(progressData);
|
|
30
|
-
loadingTask.promise
|
|
31
|
-
.then((pdfDocument) => {
|
|
32
|
-
pdfViewer.setDocument(pdfDocument);
|
|
33
|
-
return true;
|
|
34
|
-
}, (exception) => {
|
|
35
|
-
setError(exception);
|
|
36
|
-
})
|
|
37
|
-
.catch((err) => {
|
|
38
|
-
setError(err);
|
|
39
|
-
});
|
|
40
|
-
}, [url]);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
pdfViewer.currentScaleValue = scale;
|
|
43
|
-
if (eventBus) {
|
|
44
|
-
eventBus.on('pagesinit', () => (pdfViewer.currentScaleValue = scale));
|
|
45
|
-
}
|
|
46
|
-
}, [pdfViewer, eventBus, scale]);
|
|
47
|
-
if (error) {
|
|
48
|
-
return React.createElement(Error, null, "Unable to download PDF file");
|
|
49
|
-
}
|
|
50
|
-
return (React.createElement(ViewerContainer, { ref: nodeRef, id: 'viewerContainer' },
|
|
51
|
-
React.createElement("div", { id: "viewer", className: "pdfViewer" }),
|
|
52
|
-
progress != null ? (progress.total > progress.loaded && (React.createElement(Container, null,
|
|
53
|
-
React.createElement(ProgressContainer, null,
|
|
54
|
-
React.createElement(Progress, { progress: (progress.loaded / progress.total) * 100 },
|
|
55
|
-
((progress.loaded / progress.total) * 100).toFixed(),
|
|
56
|
-
"%"))))) : (React.createElement(Container, null, 'Loading\u2026'))));
|
|
57
|
-
};
|
|
58
|
-
export default PdfPreview;
|
|
59
|
-
const ViewerContainer = styled.div `
|
|
60
|
-
position: absolute;
|
|
61
|
-
width: 100%;
|
|
62
|
-
`;
|
|
63
|
-
const Container = styled.div `
|
|
64
|
-
position: fixed;
|
|
65
|
-
top: 50%;
|
|
66
|
-
right: 50%;
|
|
67
|
-
`;
|
|
68
|
-
const ProgressContainer = styled.div `
|
|
69
|
-
width: ${(props) => props.theme.grid.unit * 50}px;
|
|
70
|
-
height: ${(props) => props.theme.grid.unit * 7}px;
|
|
71
|
-
overflow: hidden;
|
|
72
|
-
background: ${(props) => props.theme.colors.background.secondary};
|
|
73
|
-
`;
|
|
74
|
-
const Progress = styled.div `
|
|
75
|
-
height: 100%;
|
|
76
|
-
display: block;
|
|
77
|
-
width: ${(props) => props.progress}%;
|
|
78
|
-
background: ${(props) => props.theme.colors.background.success};
|
|
79
|
-
text-align: center;
|
|
80
|
-
`;
|
|
81
|
-
const Error = styled(Container) `
|
|
82
|
-
color: ${(props) => props.theme.colors.text.error};
|
|
83
|
-
`;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { Dispatch } from 'react';
|
|
2
|
-
import { Capabilities } from '../../../lib/capabilities';
|
|
3
|
-
import { ChangeDesignation } from '../FileManager';
|
|
4
|
-
import { Action } from '../FileSectionState';
|
|
5
|
-
import { Designation } from '../util';
|
|
6
|
-
export declare const DesignationActions: React.FC<{
|
|
7
|
-
designation?: Designation;
|
|
8
|
-
attachmentId: string;
|
|
9
|
-
fileExtension?: string;
|
|
10
|
-
handleChangeDesignation?: ChangeDesignation;
|
|
11
|
-
fileName: string;
|
|
12
|
-
can: Capabilities | null;
|
|
13
|
-
dispatch?: Dispatch<Action>;
|
|
14
|
-
}>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Dispatch } from 'react';
|
|
2
|
-
import { ChangeDesignation } from '../FileManager';
|
|
3
|
-
import { Action } from '../FileSectionState';
|
|
4
|
-
import { Designation } from '../util';
|
|
5
|
-
export declare const DesignationActionsList: React.FC<{
|
|
6
|
-
handleChangeDesignation?: ChangeDesignation;
|
|
7
|
-
designationActionsList: Array<Designation>;
|
|
8
|
-
fileName: string;
|
|
9
|
-
designation?: Designation;
|
|
10
|
-
attachmentId: string;
|
|
11
|
-
dispatch?: Dispatch<Action>;
|
|
12
|
-
handleOpenConfirmationPopup: (popupHeader: string, popupMessage: string, designation: string) => void;
|
|
13
|
-
}>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { Dispatch } from 'react';
|
|
2
|
-
import { Action } from './FileSectionState';
|
|
3
|
-
import { Designation, FileSectionType } from './util';
|
|
4
|
-
export interface DesignationOption {
|
|
5
|
-
value: number;
|
|
6
|
-
label: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const SelectDesignationActions: React.FC<{
|
|
9
|
-
fileExtension: string;
|
|
10
|
-
fileSection: FileSectionType | Designation[];
|
|
11
|
-
dispatch: Dispatch<Action>;
|
|
12
|
-
}>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { Dispatch } from 'react';
|
|
2
|
-
import { Action } from './FileSectionState';
|
|
3
|
-
import { Designation, FileSectionType } from './util';
|
|
4
|
-
export declare const SelectDialogDesignation: React.FC<{
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
fileExtension: string;
|
|
7
|
-
fileSection: FileSectionType | Designation[];
|
|
8
|
-
handleCancel: () => void;
|
|
9
|
-
uploadFileHandler: () => void;
|
|
10
|
-
dispatch: Dispatch<Action>;
|
|
11
|
-
}>;
|