nmrium 0.57.1 → 0.59.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/lib/component/1d/integral/IntegralResizable.js +2 -2
- package/lib/component/1d/matrix/useMatrix.d.ts +1 -1
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +1 -1
- package/lib/component/1d/ranges/Atoms.js +6 -4
- package/lib/component/1d-2d/components/SpectrumInfoBlock.d.ts +1 -1
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +114 -7
- package/lib/component/2d/Viewer2D.js +6 -2
- package/lib/component/2d/zones/Zone.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +8 -8
- package/lib/component/context/ChartContext.js +12 -1
- package/lib/component/context/ShareDataContext.d.ts +1 -1
- package/lib/component/context/ShareDataContext.js +2 -4
- package/lib/component/context/ToasterContext.d.ts +1 -0
- package/lib/component/context/ToasterContext.js +12 -3
- package/lib/component/elements/ActionsButtonsPopover.d.ts +7 -1
- package/lib/component/elements/ActionsButtonsPopover.js +7 -6
- package/lib/component/elements/Alert.d.ts +20 -0
- package/lib/component/elements/Alert.js +80 -0
- package/lib/component/elements/ContextMenuBluePrint.d.ts +7 -2
- package/lib/component/elements/ContextMenuBluePrint.js +9 -3
- package/lib/component/elements/Input2.js +2 -2
- package/lib/component/elements/Input2Controller.d.ts +4 -2
- package/lib/component/elements/Input2Controller.js +22 -6
- package/lib/component/elements/MoleculeSelection.js +2 -2
- package/lib/component/elements/NextPrev.d.ts +4 -5
- package/lib/component/elements/NextPrev.js +76 -79
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +0 -3
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +1 -1
- package/lib/component/elements/Select2.d.ts +12 -7
- package/lib/component/elements/Select2.js +5 -4
- package/lib/component/elements/Select2Controller.d.ts +2 -2
- package/lib/component/elements/Select2Controller.js +5 -5
- package/lib/component/elements/ToolbarPopoverItem.d.ts +7 -6
- package/lib/component/elements/ToolbarPopoverItem.js +13 -5
- package/lib/component/elements/print/PrintContent.d.ts +17 -0
- package/lib/component/elements/print/PrintContent.js +281 -0
- package/lib/component/elements/print/PrintProvider.d.ts +12 -0
- package/lib/component/elements/print/PrintProvider.js +28 -0
- package/lib/component/elements/print/index.d.ts +2 -0
- package/lib/component/elements/print/index.js +2 -0
- package/lib/component/header/ApodizationOptionsPanel.js +14 -7
- package/lib/component/header/BaseLineCorrectionPanel.js +20 -10
- package/lib/component/header/ZeroFillingOptionsPanel.js +17 -10
- package/lib/component/hooks/useSaveSettings.js +43 -26
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +14 -9
- package/lib/component/hooks/useToggleSpectraVisibility.js +45 -16
- package/lib/component/hooks/useWorkspaceAction.js +12 -14
- package/lib/component/loader/DropZone.js +3 -67
- package/lib/component/loader/useLoadFiles.d.ts +1 -0
- package/lib/component/loader/useLoadFiles.js +78 -0
- package/lib/component/main/InnerNMRium.d.ts +4 -3
- package/lib/component/main/InnerNMRium.js +4 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +3 -2
- package/lib/component/main/InnerNMRiumContents.js +33 -29
- package/lib/component/main/NMRium.d.ts +2 -5
- package/lib/component/main/NMRium.js +1 -1
- package/lib/component/main/NMRiumRefAPI.d.ts +7 -0
- package/lib/component/main/NMRiumRefAPI.js +12 -0
- package/lib/component/main/NMRiumViewer.d.ts +10 -0
- package/lib/component/main/NMRiumViewer.js +35 -0
- package/lib/component/main/index.d.ts +1 -0
- package/lib/component/modal/CopyClipboardModal.d.ts +3 -2
- package/lib/component/modal/CopyClipboardModal.js +18 -32
- package/lib/component/modal/ExportAsJcampModal.d.ts +6 -3
- package/lib/component/modal/ExportAsJcampModal.js +69 -35
- package/lib/component/modal/ImportPublicationStringModal.js +1 -1
- package/lib/component/modal/LoadJCAMPModal.d.ts +3 -1
- package/lib/component/modal/LoadJCAMPModal.js +17 -18
- package/lib/component/modal/SaveAsModal.d.ts +3 -1
- package/lib/component/modal/SaveAsModal.js +20 -30
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +35 -47
- package/lib/component/modal/changeSum/SelectMolecule.d.ts +2 -5
- package/lib/component/modal/changeSum/SelectMolecule.js +9 -8
- package/lib/component/modal/setting/GeneralSettings.js +4 -2
- package/lib/component/modal/setting/settings-tabs/ExternalAPIsTabContent.d.ts +1 -0
- package/lib/component/modal/setting/settings-tabs/ExternalAPIsTabContent.js +89 -0
- package/lib/component/modal/setting/settingsValidation.js +15 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +8 -5
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +5 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +5 -3
- package/lib/component/panels/Panels.js +15 -15
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +8 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +52 -12
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +13 -6
- package/lib/component/panels/SpectraPanel/SpectraTable.js +63 -21
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +6 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +6 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -0
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +16 -8
- package/lib/component/panels/databasePanel/DatabasePanel.js +7 -8
- package/lib/component/panels/filtersPanel/FilterPanel.js +9 -6
- package/lib/component/panels/filtersPanel/FiltersTable.js +12 -10
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +1 -0
- package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +10 -12
- package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.js +2 -4
- package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -13
- package/lib/component/reducer/actions/DatabaseActions.js +52 -34
- package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
- package/lib/component/reducer/actions/FiltersActions.js +9 -4
- package/lib/component/reducer/actions/SpectraActions.d.ts +2 -1
- package/lib/component/reducer/actions/SpectraActions.js +53 -43
- package/lib/component/reducer/helper/removeSpectrumRelatedObjectsById.d.ts +3 -0
- package/lib/component/reducer/helper/removeSpectrumRelatedObjectsById.js +16 -0
- package/lib/component/reducer/preferences/actions/changeInformationBlockPosition.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/changeInformationBlockPosition.js +5 -0
- package/lib/component/reducer/preferences/actions/changePrintPageSettings.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/changePrintPageSettings.js +6 -0
- package/lib/component/reducer/preferences/actions/toggleInformationBlock.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/toggleInformationBlock.js +7 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +12 -2
- package/lib/component/reducer/preferences/preferencesReducer.js +9 -0
- package/lib/component/toolbar/ToolBar.js +33 -14
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/SpectraManager.d.ts +7 -10
- package/lib/data/SpectraManager.js +51 -30
- package/lib/data/data1d/Spectrum1D/SumManager.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/SumManager.js +2 -10
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/index.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/index.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js +65 -0
- package/lib/data/molecules/MoleculeManager.js +16 -38
- package/lib/data/utilities/getCustomColor.d.ts +1 -1
- package/lib/data/utilities/removeByPaths.d.ts +3 -0
- package/lib/data/utilities/removeByPaths.js +33 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +36 -36
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +0 -11
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +0 -29
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Spectrum } from 'nmr-load-save';
|
|
2
|
-
interface
|
|
2
|
+
interface InnerExportAsJCAMPProps {
|
|
3
3
|
closeDialog: () => void;
|
|
4
|
-
spectrum
|
|
4
|
+
spectrum?: Spectrum;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface ExportAsJCAMPProps extends InnerExportAsJCAMPProps {
|
|
7
|
+
exportActiveSpectrum?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function ExportAsJcampModal(props: ExportAsJCAMPProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
7
10
|
export default ExportAsJcampModal;
|
|
@@ -2,52 +2,82 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import { Formik } from 'formik';
|
|
6
5
|
import { useRef } from 'react';
|
|
7
|
-
import {
|
|
6
|
+
import { exportAsJcamp } from '../../data/SpectraManager';
|
|
8
7
|
import { useToaster } from '../context/ToasterContext';
|
|
9
8
|
import ActionButtons from '../elements/ActionButtons';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
import Label from '../elements/Label';
|
|
10
|
+
import { Select2 } from '../elements/Select2';
|
|
11
|
+
import useSpectrum from '../hooks/useSpectrum';
|
|
12
|
+
const originalFidExportDataTypes = [
|
|
13
|
+
{
|
|
14
|
+
label: 'Original FID',
|
|
15
|
+
value: 'originalFid',
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
const originalFtDataTypes = [
|
|
19
|
+
{
|
|
20
|
+
label: 'Original FT real',
|
|
21
|
+
value: 'originalFtReal',
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
{
|
|
24
|
+
label: 'Original FT real and imaginary',
|
|
25
|
+
value: 'originalFtRealImaginary',
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
];
|
|
28
|
+
const processedDataTypes = [
|
|
29
|
+
{
|
|
30
|
+
label: 'Processed real',
|
|
31
|
+
value: 'processedReal',
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
{
|
|
34
|
+
label: 'Processed real and imaginary',
|
|
35
|
+
value: 'processedRealImaginary',
|
|
35
36
|
},
|
|
37
|
+
];
|
|
38
|
+
const labelStyle = {
|
|
39
|
+
wrapper: { display: 'flex', height: '100%', flex: 1 },
|
|
40
|
+
container: { alignItems: 'flex-start' },
|
|
41
|
+
label: { paddingTop: '5px', width: 80 },
|
|
36
42
|
};
|
|
37
|
-
const DATA_STAGES = Object.keys(DataExportStage).map((key) => ({
|
|
38
|
-
label: key,
|
|
39
|
-
value: DataExportStage[key],
|
|
40
|
-
}));
|
|
41
43
|
function ExportAsJcampModal(props) {
|
|
44
|
+
const { spectrum, exportActiveSpectrum = false } = props;
|
|
45
|
+
const activeSpectrum = useSpectrum();
|
|
46
|
+
if (!exportActiveSpectrum && !spectrum) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
if (exportActiveSpectrum && !activeSpectrum)
|
|
50
|
+
return null;
|
|
51
|
+
const currentSpectrum = exportActiveSpectrum ? activeSpectrum : spectrum;
|
|
52
|
+
if (!currentSpectrum)
|
|
53
|
+
return null;
|
|
54
|
+
return _jsx(InnerExportAsJcampModal, { spectrum: currentSpectrum, ...props });
|
|
55
|
+
}
|
|
56
|
+
function getExportDataTypes(spectrum) {
|
|
57
|
+
const { originalInfo, filters } = spectrum;
|
|
58
|
+
const menuItems = [];
|
|
59
|
+
if (originalInfo?.isFt) {
|
|
60
|
+
menuItems.push(...originalFtDataTypes);
|
|
61
|
+
}
|
|
62
|
+
if (originalInfo?.isFid) {
|
|
63
|
+
menuItems.push(...originalFidExportDataTypes);
|
|
64
|
+
}
|
|
65
|
+
if (filters?.length > 0) {
|
|
66
|
+
menuItems.push(...processedDataTypes);
|
|
67
|
+
}
|
|
68
|
+
return menuItems;
|
|
69
|
+
}
|
|
70
|
+
function InnerExportAsJcampModal(props) {
|
|
42
71
|
const { closeDialog, spectrum } = props;
|
|
43
|
-
const refForm = useRef(null);
|
|
44
72
|
const toaster = useToaster();
|
|
45
|
-
|
|
73
|
+
const exportDataTypes = getExportDataTypes(spectrum);
|
|
74
|
+
const exportDataAsRef = useRef(exportDataTypes[0].value);
|
|
75
|
+
function submitHandler() {
|
|
46
76
|
const hideLoading = toaster.showLoading({
|
|
47
77
|
message: 'export as JCAMP-DX in progress',
|
|
48
78
|
});
|
|
49
79
|
try {
|
|
50
|
-
exportAsJcamp(spectrum,
|
|
80
|
+
exportAsJcamp(spectrum, exportDataAsRef.current);
|
|
51
81
|
}
|
|
52
82
|
catch (error) {
|
|
53
83
|
toaster.show({ message: error.message, intent: 'danger' });
|
|
@@ -57,10 +87,14 @@ function ExportAsJcampModal(props) {
|
|
|
57
87
|
hideLoading();
|
|
58
88
|
}
|
|
59
89
|
}
|
|
60
|
-
|
|
90
|
+
function handleChangeExportDataType(data) {
|
|
91
|
+
exportDataAsRef.current = data.value;
|
|
92
|
+
}
|
|
93
|
+
return (_jsxs(Dialog, { isOpen: true, style: { width: 400 }, onClose: closeDialog, title: "Export as JCAMP", children: [_jsx(DialogBody, { css: css `
|
|
61
94
|
background-color: white;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
95
|
+
padding: 1.5em 3em;
|
|
96
|
+
`, children: _jsx(Label, { title: "Data", style: labelStyle, children: _jsx(Select2, { defaultSelectedItem: exportDataTypes[0], onItemSelect: handleChangeExportDataType, items: exportDataTypes }) }) }), _jsx(DialogFooter, { children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: submitHandler, doneLabel: "export", onCancel: () => {
|
|
97
|
+
closeDialog?.();
|
|
98
|
+
} }) })] }));
|
|
65
99
|
}
|
|
66
100
|
export default ExportAsJcampModal;
|
|
@@ -27,7 +27,7 @@ function handleRowStyle(data) {
|
|
|
27
27
|
return { base: { backgroundColor } };
|
|
28
28
|
}
|
|
29
29
|
const INITIAL_VALUES = {
|
|
30
|
-
publicationText: '1H NMR (CDCl3, 400MHz) δ
|
|
30
|
+
publicationText: '1H NMR (CDCl3, 400MHz) δ 1 (s, 1H), 2 (d, 1H, J=7), 3 (t, 1H, J=7), 4 (q, 1H, J=7), 5 (quint, 1H, J=7), 6 (hex, 1H, J=7), 7 (hept, 1H, J=7), 8 (dd, 1H, J=7, J=4)',
|
|
31
31
|
};
|
|
32
32
|
export function ImportPublicationStringModal(props) {
|
|
33
33
|
const { onClose, isOpen } = props;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface InnerLoadJCAMPModalProps {
|
|
2
2
|
onCloseDialog: () => void;
|
|
3
|
+
}
|
|
4
|
+
interface LoadJCAMPModalProps extends InnerLoadJCAMPModalProps {
|
|
3
5
|
isOpen: boolean;
|
|
4
6
|
}
|
|
5
7
|
export declare function LoadJCAMPModal({ onCloseDialog, isOpen }: LoadJCAMPModalProps): import("@emotion/react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
3
|
+
import { Button, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import {
|
|
5
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
6
6
|
import { readFromWebSource } from 'nmr-load-save';
|
|
7
|
-
import {
|
|
7
|
+
import { useForm } from 'react-hook-form';
|
|
8
8
|
import * as Yup from 'yup';
|
|
9
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
10
|
import { useToaster } from '../context/ToasterContext';
|
|
11
|
-
import
|
|
11
|
+
import { Input2Controller } from '../elements/Input2Controller';
|
|
12
12
|
import Label from '../elements/Label';
|
|
13
|
-
import FormikError from '../elements/formik/FormikError';
|
|
14
|
-
import FormikInput from '../elements/formik/FormikInput';
|
|
15
13
|
const allowedExtensions = new Set(['dx', 'jdx', 'jcamp']);
|
|
16
14
|
const loadFormValidation = Yup.object({
|
|
17
15
|
url: Yup.string()
|
|
@@ -33,13 +31,21 @@ const loadFormValidation = Yup.object({
|
|
|
33
31
|
});
|
|
34
32
|
const labelStyle = {
|
|
35
33
|
wrapper: { display: 'flex', height: '100%', flex: 1 },
|
|
34
|
+
container: { alignItems: 'flex-start' },
|
|
35
|
+
label: { paddingTop: '5px' },
|
|
36
36
|
};
|
|
37
37
|
export function LoadJCAMPModal({ onCloseDialog, isOpen }) {
|
|
38
|
-
const dispatch = useDispatch();
|
|
39
|
-
const toaster = useToaster();
|
|
40
|
-
const ref = useRef(null);
|
|
41
38
|
if (!isOpen)
|
|
42
39
|
return;
|
|
40
|
+
return _jsx(InnerLoadJCAMPModal, { onCloseDialog: onCloseDialog });
|
|
41
|
+
}
|
|
42
|
+
function InnerLoadJCAMPModal({ onCloseDialog }) {
|
|
43
|
+
const dispatch = useDispatch();
|
|
44
|
+
const toaster = useToaster();
|
|
45
|
+
const { handleSubmit, control } = useForm({
|
|
46
|
+
defaultValues: { url: '' },
|
|
47
|
+
resolver: yupResolver(loadFormValidation),
|
|
48
|
+
});
|
|
43
49
|
async function loadJCAMPHandler({ url }) {
|
|
44
50
|
const hidLoading = toaster.showLoading({
|
|
45
51
|
message: 'Load JCAMP from external URL in progress ...',
|
|
@@ -62,14 +68,7 @@ export function LoadJCAMPModal({ onCloseDialog, isOpen }) {
|
|
|
62
68
|
onCloseDialog?.();
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
|
-
return (_jsxs(Dialog, { isOpen: true, onClose: onCloseDialog, title: "Load JCAMP", style: { minWidth:
|
|
71
|
+
return (_jsxs(Dialog, { isOpen: true, onClose: onCloseDialog, title: "Load JCAMP", style: { minWidth: 400 }, children: [_jsx(DialogBody, { css: css `
|
|
66
72
|
background-color: white;
|
|
67
|
-
`, children: _jsx(
|
|
68
|
-
input: {
|
|
69
|
-
padding: '0.8em',
|
|
70
|
-
textAlign: 'left',
|
|
71
|
-
width: '100%',
|
|
72
|
-
},
|
|
73
|
-
inputWrapper: { width: '100%' },
|
|
74
|
-
}, placeholder: "Enter URL to JCAMP-DX file" }) }) }) }) }), _jsx(DialogFooter, { children: _jsx("div", { style: { display: 'flex', flexDirection: 'row-reverse' }, children: _jsx(Button.Done, { onClick: () => ref.current?.submitForm(), children: "Load" }) }) })] }));
|
|
73
|
+
`, children: _jsx(Label, { title: "URL", style: labelStyle, children: _jsx(Input2Controller, { name: "url", control: control, fill: true, placeholder: "Enter URL to JCAMP-DX file", enableErrorMessage: true }) }) }), _jsx(DialogFooter, { children: _jsx("div", { style: { display: 'flex', flexDirection: 'row-reverse' }, children: _jsx(Button, { intent: "success", onClick: () => void handleSubmit(loadJCAMPHandler)(), children: "Load" }) }) })] }));
|
|
75
74
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { LabelStyle } from '../elements/Label';
|
|
2
2
|
export declare const labelStyle: LabelStyle;
|
|
3
|
-
interface
|
|
3
|
+
interface InnerSaveAsModalProps {
|
|
4
4
|
onCloseDialog: () => void;
|
|
5
|
+
}
|
|
6
|
+
interface SaveAsModalProps extends InnerSaveAsModalProps {
|
|
5
7
|
isOpen: boolean;
|
|
6
8
|
}
|
|
7
9
|
declare function SaveAsModal(props: SaveAsModalProps): import("@emotion/react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
3
|
+
import { Checkbox, Dialog, DialogBody, DialogFooter, Radio, RadioGroup, } from '@blueprintjs/core';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import {
|
|
6
|
-
import { useRef } from 'react';
|
|
5
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
7
6
|
import { DataExportOptions } from '../../data/SpectraManager';
|
|
8
7
|
import { useChartData } from '../context/ChartContext';
|
|
9
8
|
import ActionButtons from '../elements/ActionButtons';
|
|
9
|
+
import { Input2Controller } from '../elements/Input2Controller';
|
|
10
10
|
import Label from '../elements/Label';
|
|
11
|
-
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
12
|
-
import FormikInput from '../elements/formik/FormikInput';
|
|
13
11
|
import useExport from '../hooks/useExport';
|
|
14
|
-
const styles = css `
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
|
|
18
|
-
label {
|
|
19
|
-
margin-right: 20px;
|
|
20
|
-
display: inline-block;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
input[type='radio'] {
|
|
24
|
-
margin-right: 5px;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
12
|
const INITIAL_VALUE = {
|
|
28
13
|
name: '',
|
|
29
14
|
compressed: false,
|
|
@@ -37,7 +22,6 @@ const INITIAL_VALUE = {
|
|
|
37
22
|
export const labelStyle = {
|
|
38
23
|
label: {
|
|
39
24
|
flex: 4,
|
|
40
|
-
fontSize: '12px',
|
|
41
25
|
color: '#232323',
|
|
42
26
|
},
|
|
43
27
|
wrapper: {
|
|
@@ -49,7 +33,12 @@ export const labelStyle = {
|
|
|
49
33
|
};
|
|
50
34
|
function SaveAsModal(props) {
|
|
51
35
|
const { onCloseDialog, isOpen } = props;
|
|
52
|
-
|
|
36
|
+
if (!isOpen)
|
|
37
|
+
return;
|
|
38
|
+
return _jsx(InnerSaveAsModal, { onCloseDialog: onCloseDialog });
|
|
39
|
+
}
|
|
40
|
+
function InnerSaveAsModal(props) {
|
|
41
|
+
const { onCloseDialog } = props;
|
|
53
42
|
const { source, data } = useChartData();
|
|
54
43
|
const { saveHandler } = useExport();
|
|
55
44
|
const fileName = data[0]?.info?.name;
|
|
@@ -57,15 +46,16 @@ function SaveAsModal(props) {
|
|
|
57
46
|
saveHandler(values);
|
|
58
47
|
onCloseDialog?.();
|
|
59
48
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
const { handleSubmit, control, register } = useForm({
|
|
50
|
+
defaultValues: { ...INITIAL_VALUE, name: fileName },
|
|
51
|
+
});
|
|
52
|
+
return (_jsxs(Dialog, { isOpen: true, title: "Save as ... ", onClose: onCloseDialog, style: { width: 600 }, children: [_jsxs(DialogBody, { css: css `
|
|
63
53
|
background-color: white;
|
|
64
|
-
`, children: _jsx(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
`, children: [_jsx(Label, { style: labelStyle, title: "Name", children: _jsx(Input2Controller, { name: "name", control: control, fill: true, controllerProps: { rules: { required: true } } }) }), _jsx(Label, { style: labelStyle, title: "Compressed", children: _jsx(Checkbox, { style: { margin: 0 }, ...register(`compressed`) }) }), _jsx(Label, { style: labelStyle, title: "Pretty format", children: _jsx(Checkbox, { style: { margin: 0 }, ...register(`pretty`) }) }), _jsx(Label, { style: labelStyle, title: "Include view", children: _jsx(Checkbox, { style: { margin: 0 }, ...register(`include.view`) }) }), _jsx(Label, { style: labelStyle, title: "Include settings", children: _jsx(Checkbox, { style: { margin: 0 }, ...register(`include.settings`) }) }), _jsx(Label, { style: labelStyle, title: "Include data", children: _jsx(Controller, { name: "include.dataType", control: control, render: ({ field }) => {
|
|
55
|
+
const { value, onChange, ...otherFieldProps } = field;
|
|
56
|
+
return (_jsxs(RadioGroup, { inline: true, onChange: onChange, selectedValue: value, ...otherFieldProps, children: [_jsx(Radio, { label: "Raw data", value: DataExportOptions.ROW_DATA }), _jsx(Radio, { label: "Data source", value: DataExportOptions.DATA_SOURCE, disabled: !source }), _jsx(Radio, { label: "No data", value: DataExportOptions.NO_DATA })] }));
|
|
57
|
+
} }) })] }), _jsx(DialogFooter, { children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => {
|
|
58
|
+
void handleSubmit(submitHandler)();
|
|
59
|
+
}, doneLabel: "Save", onCancel: () => onCloseDialog?.() }) })] }));
|
|
70
60
|
}
|
|
71
61
|
export default SaveAsModal;
|
|
@@ -8,7 +8,7 @@ export default function ChangeSumModal(props) {
|
|
|
8
8
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
9
9
|
return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { disabled: disabled, icon: _jsx(SvgNmrSum, {}), tooltip: currentSum
|
|
10
10
|
? `Change ${sumType} sum (${currentSum.toFixed(2)})`
|
|
11
|
-
: `Change ${sumType} sum`, onClick: openDialog }), isOpenDialog && (_jsx(Dialog, { isOpen: true, onClose: closeDialog, style: { width: 500
|
|
11
|
+
: `Change ${sumType} sum`, onClick: openDialog }), isOpenDialog && (_jsx(Dialog, { isOpen: true, onClose: closeDialog, style: { width: 500 }, title: currentSum
|
|
12
12
|
? `Set new ${sumType} sum (Current: ${currentSum.toFixed(2)})`
|
|
13
13
|
: `Set new ${sumType} Sum`, children: _jsx(ChangeSumModalContents, { ...otherProps, onClose: closeDialog }) }))] }));
|
|
14
14
|
}
|
|
@@ -1,76 +1,54 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
3
|
+
import { Button, DialogBody, DialogFooter, Tab, Tabs } from '@blueprintjs/core';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import styled from '@emotion/styled';
|
|
6
|
-
import {
|
|
7
|
-
import { useEffect,
|
|
6
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import { useForm } from 'react-hook-form';
|
|
8
9
|
import * as Yup from 'yup';
|
|
9
10
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
10
|
-
import
|
|
11
|
-
import Tab from '../../elements/Tab/Tab';
|
|
12
|
-
import Tabs from '../../elements/Tab/Tabs';
|
|
13
|
-
import FormikInput from '../../elements/formik/FormikInput';
|
|
11
|
+
import { NumberInput2Controller } from '../../elements/NumberInput2Controller';
|
|
14
12
|
import SelectMolecule from './SelectMolecule';
|
|
15
13
|
function getValidationSchema(option) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
case 'manual': {
|
|
23
|
-
return Yup.object({
|
|
24
|
-
sum: Yup.number().required(),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
default:
|
|
28
|
-
return null;
|
|
14
|
+
if (option === 'auto') {
|
|
15
|
+
return Yup.object({
|
|
16
|
+
molecule: Yup.object().required(),
|
|
17
|
+
});
|
|
29
18
|
}
|
|
19
|
+
return Yup.object({
|
|
20
|
+
sum: Yup.number().min(0).required(),
|
|
21
|
+
});
|
|
30
22
|
}
|
|
31
23
|
const ManualContainer = styled.div `
|
|
32
24
|
padding: 30px 5px;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
width: 80% !important;
|
|
36
|
-
height: 36px;
|
|
37
|
-
margin: 0 auto;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.input input {
|
|
41
|
-
padding: 5px;
|
|
42
|
-
text-align: center;
|
|
43
|
-
}
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: center;
|
|
44
27
|
`;
|
|
45
28
|
export function ChangeSumModalContents(props) {
|
|
46
29
|
const { sumOptions, onSave, onClose } = props;
|
|
47
30
|
const { current: { display: { panels }, }, } = usePreferences();
|
|
48
31
|
const [setOption, setActiveOption] = useState('auto');
|
|
49
|
-
const
|
|
32
|
+
const { control, handleSubmit, reset } = useForm({
|
|
33
|
+
resolver: yupResolver(getValidationSchema(setOption)),
|
|
34
|
+
});
|
|
50
35
|
useEffect(() => {
|
|
51
36
|
if (sumOptions?.sumAuto && panels?.structuresPanel?.display) {
|
|
52
37
|
setActiveOption('auto');
|
|
53
38
|
const { mf, moleculeId: id } = sumOptions;
|
|
54
|
-
|
|
55
|
-
sum: null,
|
|
39
|
+
reset({
|
|
56
40
|
molecule: id && mf ? { mf, id } : null,
|
|
57
41
|
});
|
|
58
42
|
}
|
|
59
43
|
else {
|
|
60
44
|
setActiveOption('manual');
|
|
61
|
-
|
|
62
|
-
sum: sumOptions?.sum
|
|
63
|
-
molecule: null,
|
|
45
|
+
reset({
|
|
46
|
+
sum: sumOptions?.sum,
|
|
64
47
|
});
|
|
65
48
|
}
|
|
66
|
-
}, [panels?.structuresPanel, sumOptions]);
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
formRef.current.submitForm();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function onTabChangeHandler(tab) {
|
|
73
|
-
setActiveOption(tab.tabid);
|
|
49
|
+
}, [panels?.structuresPanel, reset, sumOptions]);
|
|
50
|
+
function onTabChangeHandler(tabKey) {
|
|
51
|
+
setActiveOption(tabKey);
|
|
74
52
|
}
|
|
75
53
|
function saveHandler(values) {
|
|
76
54
|
switch (setOption) {
|
|
@@ -91,7 +69,17 @@ export function ChangeSumModalContents(props) {
|
|
|
91
69
|
}
|
|
92
70
|
const isStructurePanelVisible = panels?.structuresPanel?.display || false;
|
|
93
71
|
return (_jsxs(_Fragment, { children: [_jsx(DialogBody, { css: css `
|
|
94
|
-
padding:
|
|
72
|
+
padding: 5px;
|
|
95
73
|
background-color: white;
|
|
96
|
-
|
|
74
|
+
|
|
75
|
+
[role='tablist'] {
|
|
76
|
+
border-bottom: 1px solid #f0f0f0;
|
|
77
|
+
}
|
|
78
|
+
`, children: _jsxs(Tabs, { selectedTabId: setOption, onChange: onTabChangeHandler, renderActiveTabPanelOnly: true, children: [isStructurePanelVisible && (_jsx(Tab, { title: "Auto", id: "auto", panel: _jsx(SelectMolecule, { control: control, name: "molecule" }) })), _jsx(Tab, { title: "Manual", id: "manual", panel: _jsx(ManualContainer, { children: _jsx(NumberInput2Controller, { name: "sum", control: control, placeholder: "Enter the new value", onKeyDown: (event) => {
|
|
79
|
+
if (event.key !== 'Enter')
|
|
80
|
+
return;
|
|
81
|
+
void handleSubmit(saveHandler)();
|
|
82
|
+
}, style: { width: '250px' }, autoFocus: true, min: 0 }) }) })] }) }), _jsx(DialogFooter, { children: _jsx(Button, { intent: "success", onClick: () => {
|
|
83
|
+
void handleSubmit(saveHandler)();
|
|
84
|
+
}, style: { width: 80 }, children: "Set" }) })] }));
|
|
97
85
|
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export default function SelectMolecule(props: SelectMoleculeProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
-
export {};
|
|
1
|
+
import { ControllerProps, FieldValues } from 'react-hook-form';
|
|
2
|
+
export default function SelectMolecule<FieldType extends FieldValues = FieldValues>(props: Pick<ControllerProps<FieldType>, 'control' | 'name'>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { useFormikContext } from 'formik';
|
|
5
4
|
import { useCallback, useState, useEffect, useMemo } from 'react';
|
|
5
|
+
import { useController } from 'react-hook-form';
|
|
6
6
|
import getAtom from '../../../data/utilities/getAtom';
|
|
7
7
|
import { useChartData } from '../../context/ChartContext';
|
|
8
8
|
import MoleculeSelection from '../../elements/MoleculeSelection';
|
|
@@ -39,8 +39,9 @@ const styles = css `
|
|
|
39
39
|
}
|
|
40
40
|
`;
|
|
41
41
|
export default function SelectMolecule(props) {
|
|
42
|
+
const { name, control } = props;
|
|
42
43
|
const [currentIndex, setCurrentIndex] = useState();
|
|
43
|
-
const {
|
|
44
|
+
const { field: { onChange, value }, fieldState: { invalid }, } = useController({ name, control });
|
|
44
45
|
const { molecules, view: { spectra: { activeTab }, }, } = useChartData();
|
|
45
46
|
const element = getAtom(activeTab);
|
|
46
47
|
const newSum = useMemo(() => {
|
|
@@ -54,18 +55,18 @@ export default function SelectMolecule(props) {
|
|
|
54
55
|
}, [currentIndex, element, molecules]);
|
|
55
56
|
const setValue = useCallback((index) => {
|
|
56
57
|
setCurrentIndex(index);
|
|
57
|
-
|
|
58
|
-
}, [molecules,
|
|
58
|
+
onChange(molecules[index]);
|
|
59
|
+
}, [molecules, onChange]);
|
|
59
60
|
useEffect(() => {
|
|
60
61
|
if (molecules && molecules.length > 0) {
|
|
61
|
-
const index =
|
|
62
|
-
? molecules.findIndex((molecule) => molecule.id ===
|
|
62
|
+
const index = value
|
|
63
|
+
? molecules.findIndex((molecule) => molecule.id === value.id)
|
|
63
64
|
: -1;
|
|
64
65
|
setValue(index !== -1 ? index : 0);
|
|
65
66
|
}
|
|
66
|
-
}, [molecules,
|
|
67
|
+
}, [molecules, setValue, value]);
|
|
67
68
|
const onChangeMoleculeSelectionHandler = useCallback((index) => {
|
|
68
69
|
setValue(index);
|
|
69
70
|
}, [setValue]);
|
|
70
|
-
return (_jsx("div", { css: styles, children: element && molecules && molecules.length > 0 ? (_jsxs("div", { className: "molecule-container", children: [_jsx("p", { className: "title", children: "Select a molecule as reference!" }), _jsxs("div", { className: "molecule-selection-container", children: [_jsx(MoleculeSelection, { index: currentIndex, molecules: molecules, onChange: onChangeMoleculeSelectionHandler }), _jsxs("p", { className: "new-sum-text", children: ["New sum for ", element, " will be ", newSum, "!"] })] })] })) : (_jsx("p", { className: "empty", style: { color:
|
|
71
|
+
return (_jsx("div", { css: styles, children: element && molecules && molecules.length > 0 ? (_jsxs("div", { className: "molecule-container", children: [_jsx("p", { className: "title", children: "Select a molecule as reference!" }), _jsxs("div", { className: "molecule-selection-container", children: [_jsx(MoleculeSelection, { index: currentIndex, molecules: molecules, onChange: onChangeMoleculeSelectionHandler }), _jsxs("p", { className: "new-sum-text", children: ["New sum for ", element, " will be ", newSum, "!"] })] })] })) : (_jsx("p", { className: "empty", style: { color: invalid ? 'red' : 'black' }, children: "You have to Select a spectrum and Add a molecule from the Structure panel to select as a reference!" })) }));
|
|
71
72
|
}
|
|
@@ -22,6 +22,7 @@ import PredefinedWorkspaces from '../../workspaces';
|
|
|
22
22
|
import WorkspaceItem from './WorkspaceItem';
|
|
23
23
|
import DatabasesTabContent from './settings-tabs/DatabasesTabContent';
|
|
24
24
|
import DisplayTabContent from './settings-tabs/DisplayTabContent';
|
|
25
|
+
import { ExternalAPIsTabContent } from './settings-tabs/ExternalAPIsTabContent';
|
|
25
26
|
import GeneralTabContent from './settings-tabs/GeneralTabContent';
|
|
26
27
|
import ImportationFiltersTabContent from './settings-tabs/ImportationFiltersTabContent';
|
|
27
28
|
import InfoBlockTabContent from './settings-tabs/InfoBlockTabContent';
|
|
@@ -65,7 +66,7 @@ function InnerGeneralSettingsModal(props) {
|
|
|
65
66
|
defaultValues: currentWorkspace,
|
|
66
67
|
resolver: yupResolver(validation),
|
|
67
68
|
});
|
|
68
|
-
const { reset, getValues } = methods;
|
|
69
|
+
const { reset, getValues, watch } = methods;
|
|
69
70
|
const workspacesList = useMemo(() => {
|
|
70
71
|
return baseWorkspaces.concat([
|
|
71
72
|
{
|
|
@@ -103,6 +104,7 @@ function InnerGeneralSettingsModal(props) {
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
}, [dispatch, preferences.workspace, workspaces, reset]);
|
|
107
|
+
const isExperimentalFeatures = watch('display.general.experimentalFeatures.display') || false;
|
|
106
108
|
useEffect(() => {
|
|
107
109
|
if (pastRef.current) {
|
|
108
110
|
setWorkspaceSetting(pastRef.current);
|
|
@@ -130,7 +132,7 @@ function InnerGeneralSettingsModal(props) {
|
|
|
130
132
|
overflow: auto;
|
|
131
133
|
max-height: 100%;
|
|
132
134
|
}
|
|
133
|
-
`, children: [_jsx(Tab, { title: "General", id: "general", panel: _jsx(GeneralTabContent, {}) }), _jsx(Tab, { title: "Nuclei", id: "nuclei", panel: _jsx(NucleiTabContent, {}) }), _jsx(Tab, { title: "Panels", id: "display", panel: _jsx(DisplayTabContent, {}) }), _jsx(Tab, { title: "Tools", id: "tools", panel: _jsx(ToolsTabContent, {}) }), _jsx(Tab, { title: "Databases", id: "databases", panel: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }), _jsx(Tab, { title: "Import filters", id: "importation-filters", panel: _jsx(ImportationFiltersTabContent, {}) }), _jsx(Tab, { title: "Title block", id: "title-block", panel: _jsx(InfoBlockTabContent, {}) }), _jsx(Tab, { title: "Auto processing", id: "on-load-processing", panel: _jsx(OnLoadProcessingTabContent, {}) }), _jsx(Tab, { title: "Spectra colors", id: "spectra-colors", panel: _jsx(SpectraColorsTabContent, {}) })] }) }) }), _jsx(DialogFooter, { children: _jsx(DialogActionButtons, { onCloseDialog: onCloseDialog, onSave: onSave }) })] }) }));
|
|
135
|
+
`, children: [_jsx(Tab, { title: "General", id: "general", panel: _jsx(GeneralTabContent, {}) }), _jsx(Tab, { title: "Nuclei", id: "nuclei", panel: _jsx(NucleiTabContent, {}) }), _jsx(Tab, { title: "Panels", id: "display", panel: _jsx(DisplayTabContent, {}) }), _jsx(Tab, { title: "Tools", id: "tools", panel: _jsx(ToolsTabContent, {}) }), _jsx(Tab, { title: "Databases", id: "databases", panel: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }), _jsx(Tab, { title: "Import filters", id: "importation-filters", panel: _jsx(ImportationFiltersTabContent, {}) }), _jsx(Tab, { title: "Title block", id: "title-block", panel: _jsx(InfoBlockTabContent, {}) }), _jsx(Tab, { title: "Auto processing", id: "on-load-processing", panel: _jsx(OnLoadProcessingTabContent, {}) }), _jsx(Tab, { title: "Spectra colors", id: "spectra-colors", panel: _jsx(SpectraColorsTabContent, {}) }), isExperimentalFeatures && (_jsx(Tab, { title: "External APIs", id: "external-apis", panel: _jsx(ExternalAPIsTabContent, {}) }))] }) }) }), _jsx(DialogFooter, { children: _jsx(DialogActionButtons, { onCloseDialog: onCloseDialog, onSave: onSave }) })] }) }));
|
|
134
136
|
}
|
|
135
137
|
function WorkSpaceActionsButtons(props) {
|
|
136
138
|
const { readText, rawWriteWithType, shouldFallback, cleanShouldFallback, text, } = useClipboard();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ExternalAPIsTabContent(): import("react/jsx-runtime").JSX.Element;
|