nmrium 0.53.0 → 0.54.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/Viewer1D.js +48 -17
- package/lib/component/1d/ranges/Range.js +14 -6
- package/lib/component/1d/tool/XLabelPointer.js +4 -12
- package/lib/component/2d/tools/XYLabelPointer.js +3 -9
- package/lib/component/context/LoggerContext.js +11 -4
- package/lib/component/elements/CloseButton.d.ts +1 -1
- package/lib/component/elements/CustomToolTip.d.ts +8 -0
- package/lib/component/elements/CustomToolTip.js +107 -0
- package/lib/component/elements/EditableColumn.js +3 -2
- package/lib/component/elements/SaveButton.d.ts +1 -1
- package/lib/component/elements/formik/FormikError.js +2 -4
- package/lib/component/elements/formik/FormikInput.js +2 -2
- package/lib/component/header/Header.js +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
- package/lib/component/main/NMRiumStateProvider.js +11 -1
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/CopyClipboardModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ImportPublicationStringModal.js +11 -5
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +1 -1
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +1 -1
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +12 -19
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +11 -11
- package/lib/component/panels/RangesPanel/RangesPreferences.js +16 -16
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +4 -4
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
- package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
- package/lib/component/panels/header/PreferencesHeader.js +1 -1
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
- package/lib/component/reducer/actions/FiltersActions.js +27 -1
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +2 -3
- package/lib/component/reducer/actions/RangesActions.js +16 -20
- package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
- package/lib/component/reducer/actions/SpectraActions.js +5 -1
- package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
- package/lib/component/toolbar/ToolBar.js +111 -25
- package/lib/component/workspaces/workspaceDefaultProperties.js +7 -12
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
- package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
- package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/index.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
- package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
- package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
- package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
- package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
- package/lib/data/utilities/generateColor.d.ts +7 -3
- package/lib/data/utilities/generateColor.js +5 -17
- package/lib/versionInfo.js +1 -1
- package/package.json +20 -20
- package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
- package/lib/component/elements/MolecularFormulaInput.js +0 -63
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +0 -32
|
@@ -3,8 +3,10 @@ import { SvgNmrSameTop, SvgNmrResetScale } from 'cheminfo-font';
|
|
|
3
3
|
import { memo, useCallback } from 'react';
|
|
4
4
|
import { FaCreativeCommonsSamplingPlus, FaEye, FaEyeSlash, } from 'react-icons/fa';
|
|
5
5
|
import { IoColorPaletteOutline } from 'react-icons/io5';
|
|
6
|
+
import { MdFormatColorFill } from 'react-icons/md';
|
|
6
7
|
import { useChartData } from '../../context/ChartContext';
|
|
7
8
|
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
+
import { usePreferences } from '../../context/PreferencesContext';
|
|
8
10
|
import { useToaster } from '../../context/ToasterContext';
|
|
9
11
|
import { useModal } from '../../elements/popup/Modal';
|
|
10
12
|
import { useActiveSpectra } from '../../hooks/useActiveSpectra';
|
|
@@ -28,6 +30,7 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
28
30
|
const modal = useModal();
|
|
29
31
|
const toaster = useToaster();
|
|
30
32
|
const dispatch = useDispatch();
|
|
33
|
+
const { current: { spectraColors }, } = usePreferences();
|
|
31
34
|
const handleDelete = useCallback(() => {
|
|
32
35
|
modal.showConfirmDialog({
|
|
33
36
|
message: (_jsxs("span", { children: ["You are about to delete", _jsxs("span", { style: { color: 'black' }, children: [" ", activeSpectra?.length, " "] }), "spectra, Are you sure?"] })),
|
|
@@ -72,7 +75,13 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
72
75
|
function resetScaleHandler() {
|
|
73
76
|
dispatch({ type: 'RESET_SPECTRA_SCALE' });
|
|
74
77
|
}
|
|
75
|
-
function
|
|
78
|
+
function defaultReColorSpectraHandler() {
|
|
79
|
+
dispatch({
|
|
80
|
+
type: 'RECOLOR_SPECTRA_COLOR',
|
|
81
|
+
payload: { customColors: spectraColors },
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function distinctReColorSpectraHandler() {
|
|
76
85
|
dispatch({
|
|
77
86
|
type: 'RECOLOR_SPECTRA_COLOR',
|
|
78
87
|
payload: {},
|
|
@@ -84,31 +93,31 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
84
93
|
{
|
|
85
94
|
disabled: !hasActiveSpectra,
|
|
86
95
|
icon: _jsx(FaEyeSlash, {}),
|
|
87
|
-
|
|
96
|
+
tooltip: 'Hide selected spectra',
|
|
88
97
|
onClick: hideAllSpectraHandler,
|
|
89
98
|
},
|
|
90
99
|
{
|
|
91
100
|
disabled: !hasActiveSpectra,
|
|
92
101
|
icon: _jsx(FaEye, {}),
|
|
93
|
-
|
|
102
|
+
tooltip: 'Show selected spectra',
|
|
94
103
|
onClick: showAllSpectraHandler,
|
|
95
104
|
},
|
|
96
105
|
];
|
|
97
106
|
if (displayerMode === '2D' && activeSpectrum?.info.isFt) {
|
|
98
107
|
leftButtons.push({
|
|
99
108
|
icon: _jsx(FaCreativeCommonsSamplingPlus, {}),
|
|
100
|
-
|
|
109
|
+
tooltip: 'Add missing projection',
|
|
101
110
|
onClick: addMissingProjectionHandler,
|
|
102
111
|
});
|
|
103
112
|
}
|
|
104
113
|
if (displayerMode === '1D' && spectraLengthPerTab > 1) {
|
|
105
114
|
leftButtons.push({
|
|
106
115
|
icon: _jsx(SvgNmrResetScale, {}),
|
|
107
|
-
|
|
116
|
+
tooltip: 'Reset scale',
|
|
108
117
|
onClick: resetScaleHandler,
|
|
109
118
|
}, {
|
|
110
119
|
icon: _jsx(SvgNmrSameTop, {}),
|
|
111
|
-
|
|
120
|
+
tooltip: 'Same top',
|
|
112
121
|
onClick: setSameTopHandler,
|
|
113
122
|
});
|
|
114
123
|
}
|
|
@@ -118,8 +127,13 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
118
127
|
},
|
|
119
128
|
{
|
|
120
129
|
icon: _jsx(IoColorPaletteOutline, {}),
|
|
121
|
-
|
|
122
|
-
onClick:
|
|
130
|
+
tooltip: 'Default spectra recoloring',
|
|
131
|
+
onClick: defaultReColorSpectraHandler,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
icon: _jsx(MdFormatColorFill, {}),
|
|
135
|
+
tooltip: 'Distinct spectra recoloring',
|
|
136
|
+
onClick: distinctReColorSpectraHandler,
|
|
123
137
|
},
|
|
124
138
|
]);
|
|
125
139
|
return (_jsx(DefaultPanelHeader, { onDelete: handleDelete, total: data?.length, counter: spectraLengthPerTab, deleteToolTip: "Delete selected spectra", disableDelete: !hasActiveSpectra, onSettingClick: onSettingClick, leftButtons: leftButtons }));
|
|
@@ -103,5 +103,5 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
|
|
|
103
103
|
handleOnEdit,
|
|
104
104
|
link,
|
|
105
105
|
]);
|
|
106
|
-
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, {
|
|
106
|
+
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { tooltip: "Close", onClick: onClose }), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` })] }), tabsContainer] }));
|
|
107
107
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface InnerMolecularFormulaModalProps {
|
|
2
2
|
onClose: () => void;
|
|
3
|
-
onSave?: (element: any) => void;
|
|
4
|
-
molecules: any;
|
|
5
|
-
previousMF: any;
|
|
6
3
|
}
|
|
7
|
-
|
|
4
|
+
interface MolecularFormulaModalProps extends InnerMolecularFormulaModalProps {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function SetMolecularFormulaModal(props: MolecularFormulaModalProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
8
8
|
export {};
|
|
@@ -1,94 +1,84 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogBody, Tab, Tabs } from '@blueprintjs/core';
|
|
3
|
+
import { Formik } from 'formik';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import * as Yup from 'yup';
|
|
6
|
+
import getAtomsFromMF from '../../../data/utilities/getAtomsFromMF';
|
|
7
|
+
import { useChartData } from '../../context/ChartContext';
|
|
8
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
+
import Button from '../../elements/Button';
|
|
7
10
|
import MoleculeSelection from '../../elements/MoleculeSelection';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
button {
|
|
15
|
-
flex: 2;
|
|
16
|
-
padding: 5px;
|
|
17
|
-
border: 1px solid gray;
|
|
18
|
-
border-radius: 5px;
|
|
19
|
-
height: 30px;
|
|
20
|
-
margin: 0 auto;
|
|
21
|
-
margin-top: 15px;
|
|
22
|
-
display: block;
|
|
23
|
-
width: 20%;
|
|
24
|
-
color: white;
|
|
25
|
-
background-color: gray;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
button:focus {
|
|
29
|
-
outline: none;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.header {
|
|
33
|
-
height: 24px;
|
|
34
|
-
border-bottom: 1px solid #f0f0f0;
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
|
|
38
|
-
button {
|
|
39
|
-
height: 36px;
|
|
40
|
-
margin: 2px;
|
|
41
|
-
background-color: transparent;
|
|
42
|
-
border: none;
|
|
43
|
-
|
|
44
|
-
svg {
|
|
45
|
-
height: 16px;
|
|
46
|
-
}
|
|
11
|
+
import FormikError from '../../elements/formik/FormikError';
|
|
12
|
+
import FormikInput from '../../elements/formik/FormikInput';
|
|
13
|
+
function isValidMf(value) {
|
|
14
|
+
try {
|
|
15
|
+
getAtomsFromMF(value);
|
|
16
|
+
return true;
|
|
47
17
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const validationSchema = Yup.object({
|
|
23
|
+
mf: Yup.string()
|
|
24
|
+
.required()
|
|
25
|
+
.test('valid-mf', 'Enter a valid molecular formula', (value) => isValidMf(value)),
|
|
26
|
+
});
|
|
27
|
+
const styles = {
|
|
28
|
+
input: {
|
|
29
|
+
padding: '0.5rem',
|
|
30
|
+
},
|
|
31
|
+
container: {
|
|
32
|
+
padding: '0.5rem',
|
|
33
|
+
},
|
|
34
|
+
error: {
|
|
35
|
+
textAlign: 'center',
|
|
36
|
+
color: 'red',
|
|
37
|
+
fontSize: '0.9em',
|
|
38
|
+
},
|
|
39
|
+
title: {
|
|
40
|
+
textAlign: 'center',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export function SetMolecularFormulaModal(props) {
|
|
44
|
+
const { isOpen, ...otherProps } = props;
|
|
45
|
+
if (!isOpen) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
return _jsx(InnerSetMolecularFormulaModal, { ...otherProps });
|
|
49
|
+
}
|
|
50
|
+
function InnerSetMolecularFormulaModal({ onClose, }) {
|
|
51
|
+
const dispatch = useDispatch();
|
|
52
|
+
function saveHandler(mf) {
|
|
53
|
+
dispatch({
|
|
54
|
+
type: 'SET_CORRELATIONS_MF',
|
|
55
|
+
payload: {
|
|
56
|
+
mf,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
88
59
|
onClose?.();
|
|
89
|
-
}
|
|
90
|
-
|
|
60
|
+
}
|
|
61
|
+
return (_jsx(Dialog, { isOpen: true, title: "Molecular formula", style: { width: 400 }, onClose: onClose, children: _jsx(DialogBody, { children: _jsxs(Tabs, { fill: true, children: [_jsx(Tab, { id: "manual", title: "Manual", panel: _jsx(ManualFormula, { onSave: saveHandler }) }), _jsx(Tab, { id: "auto", title: "Auto", panel: _jsx(AutoFormula, { onSave: saveHandler }) })] }) }) }));
|
|
62
|
+
}
|
|
63
|
+
function ManualFormula(props) {
|
|
64
|
+
const { correlations } = useChartData();
|
|
65
|
+
function saveHandler(data) {
|
|
66
|
+
props?.onSave(data.mf);
|
|
67
|
+
}
|
|
68
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("p", { children: "Please type in a molecular formula!" }), _jsx(Formik, { onSubmit: saveHandler, initialValues: { mf: correlations?.options?.mf }, validationSchema: validationSchema, children: ({ isValid, handleSubmit }) => (_jsxs(_Fragment, { children: [_jsx(FormikError, { name: "mf", children: _jsx(FormikInput, { name: "mf", placeholder: "Enter a molecular formula", style: { input: styles.input }, checkErrorAfterInputTouched: false }) }), _jsx(Button.Done, { onClick: () => handleSubmit(), disabled: !isValid, style: { marginTop: '10px' }, children: "Set molecular formula" })] })) })] }));
|
|
69
|
+
}
|
|
70
|
+
function AutoFormula(props) {
|
|
71
|
+
const { molecules } = useChartData();
|
|
72
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
73
|
+
function onChangeHandlerMoleculeSelection(index) {
|
|
91
74
|
setCurrentIndex(index);
|
|
92
|
-
}
|
|
93
|
-
|
|
75
|
+
}
|
|
76
|
+
function saveHandler() {
|
|
77
|
+
const mf = molecules?.[currentIndex]?.mf;
|
|
78
|
+
props?.onSave(mf);
|
|
79
|
+
}
|
|
80
|
+
if (!molecules || molecules?.length === 0) {
|
|
81
|
+
return (_jsx("p", { style: styles.error, children: "You have to Select a spectrum and Add a molecule from the Structure panel to select as a reference!" }));
|
|
82
|
+
}
|
|
83
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("p", { style: styles.title, children: "Select a molecule as reference!" }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx(Button.Done, { onClick: saveHandler, disabled: !molecules?.[currentIndex], style: { marginTop: '10px' }, children: "Set molecular formula" })] }));
|
|
94
84
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
interface SetShiftToleranceModalProps {
|
|
1
|
+
interface SetShiftToleranceModalProps extends InnerSetShiftToleranceModalProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
}
|
|
4
|
+
interface InnerSetShiftToleranceModalProps {
|
|
2
5
|
onClose: () => void;
|
|
3
|
-
onSave?: (element: any) => void;
|
|
4
|
-
previousTolerance: any;
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
+
export declare function SetShiftToleranceModal(props: SetShiftToleranceModalProps): import("@emotion/react/jsx-runtime").JSX.Element | undefined;
|
|
7
8
|
export {};
|
|
@@ -1,104 +1,72 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
outline: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.header {
|
|
31
|
-
height: 24px;
|
|
32
|
-
border-bottom: 1px solid #f0f0f0;
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
|
|
36
|
-
span {
|
|
37
|
-
color: #464646;
|
|
38
|
-
font-size: 15px;
|
|
39
|
-
flex: 1;
|
|
40
|
-
user-select: none;
|
|
3
|
+
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
4
|
+
import { Formik } from 'formik';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import * as Yup from 'yup';
|
|
7
|
+
import { useChartData } from '../../context/ChartContext';
|
|
8
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
+
import Button from '../../elements/Button';
|
|
10
|
+
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
11
|
+
import FormikInput from '../../elements/formik/FormikInput';
|
|
12
|
+
const styles = {
|
|
13
|
+
input: {
|
|
14
|
+
padding: '0.25rem 0.5rem',
|
|
15
|
+
},
|
|
16
|
+
column: {
|
|
17
|
+
padding: '2px',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const toleranceValidationSchema = Yup.array()
|
|
21
|
+
.of(Yup.object({ value: Yup.number().required() }))
|
|
22
|
+
.min(1);
|
|
23
|
+
export function SetShiftToleranceModal(props) {
|
|
24
|
+
const { isOpen, ...otherPros } = props;
|
|
25
|
+
if (!isOpen) {
|
|
26
|
+
return;
|
|
41
27
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
table {
|
|
56
|
-
margin-top: 10px;
|
|
57
|
-
width: 100%;
|
|
58
|
-
|
|
59
|
-
input::-webkit-outer-spin-button,
|
|
60
|
-
input::-webkit-inner-spin-button {
|
|
61
|
-
appearance: none;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
input {
|
|
65
|
-
width: 100px;
|
|
66
|
-
text-align: center;
|
|
67
|
-
border-radius: 5px;
|
|
68
|
-
border: 0.55px solid #c7c7c7;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
export default function SetShiftToleranceModal({ onClose, onSave, previousTolerance, }) {
|
|
73
|
-
const [tolerance, setTolerance] = useState();
|
|
74
|
-
const [isValid, setIsValid] = useState({});
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (previousTolerance) {
|
|
77
|
-
setTolerance(previousTolerance);
|
|
78
|
-
setIsValid(Object.fromEntries(Object.keys(previousTolerance).map((atomType) => [atomType, true])));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
setTolerance(undefined);
|
|
28
|
+
return _jsx(InnerSetShiftToleranceModal, { ...otherPros });
|
|
29
|
+
}
|
|
30
|
+
function InnerSetShiftToleranceModal(props) {
|
|
31
|
+
const { onClose } = props;
|
|
32
|
+
const { correlations } = useChartData();
|
|
33
|
+
const dispatch = useDispatch();
|
|
34
|
+
function onSaveHandler(data) {
|
|
35
|
+
const tolerance = {};
|
|
36
|
+
for (const { atom, value } of data) {
|
|
37
|
+
tolerance[atom] = value;
|
|
82
38
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
39
|
+
dispatch({
|
|
40
|
+
type: 'SET_CORRELATIONS_TOLERANCE',
|
|
41
|
+
payload: {
|
|
42
|
+
tolerance,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
86
45
|
onClose?.();
|
|
87
46
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
47
|
+
const COLUMNS = useMemo(() => [
|
|
48
|
+
{
|
|
49
|
+
Header: '#',
|
|
50
|
+
style: { width: '25px', textAlign: 'center', ...styles.column },
|
|
51
|
+
accessor: (_, index) => index + 1,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
Header: 'Atom',
|
|
55
|
+
style: { width: '25px', textAlign: 'center', ...styles.column },
|
|
56
|
+
accessor: 'atom',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
Header: 'Value',
|
|
60
|
+
style: { padding: 0, ...styles.column },
|
|
61
|
+
Cell: ({ row }) => {
|
|
62
|
+
return (_jsx(FormikInput, { name: `${row.index}.value`, style: { input: styles.input }, type: "number", checkErrorAfterInputTouched: false }));
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
], []);
|
|
66
|
+
const tolerances = correlations?.options?.tolerance || {};
|
|
67
|
+
const tolerancesData = Object.keys(tolerances).map((atom) => ({
|
|
68
|
+
atom,
|
|
69
|
+
value: tolerances[atom],
|
|
70
|
+
}));
|
|
71
|
+
return (_jsx(Dialog, { isOpen: true, title: "Shift tolerances", onClose: onClose, style: { width: 400 }, children: _jsx(Formik, { initialValues: tolerancesData, onSubmit: onSaveHandler, validationSchema: toleranceValidationSchema, children: ({ isValid, handleSubmit }) => (_jsxs(_Fragment, { children: [_jsx(DialogBody, { children: _jsx(ReactTable, { data: tolerancesData, columns: COLUMNS, emptyDataRowText: "No atoms" }) }), _jsx(DialogFooter, { children: _jsx(Button.Done, { onClick: () => handleSubmit(), disabled: !isValid, children: "Set shift tolerances" }) })] })) }) }));
|
|
104
72
|
}
|
|
@@ -9,12 +9,12 @@ import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
|
9
9
|
import { useChartData } from '../../context/ChartContext';
|
|
10
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
11
|
import Select from '../../elements/Select';
|
|
12
|
-
import {
|
|
12
|
+
import { useDialogToggle } from '../../hooks/useDialogToggle';
|
|
13
13
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
14
14
|
import CorrelationTable from './CorrelationTable/CorrelationTable';
|
|
15
15
|
import Overview from './Overview';
|
|
16
|
-
import SetMolecularFormulaModal from './SetMolecularFormulaModal';
|
|
17
|
-
import SetShiftToleranceModal from './SetShiftTolerancesModal';
|
|
16
|
+
import { SetMolecularFormulaModal } from './SetMolecularFormulaModal';
|
|
17
|
+
import { SetShiftToleranceModal } from './SetShiftTolerancesModal';
|
|
18
18
|
import { findSignalMatch1D, findSignalMatch2D, getAtomType, } from './utilities/Utilities';
|
|
19
19
|
const panelStyle = css `
|
|
20
20
|
display: flex;
|
|
@@ -50,10 +50,13 @@ const panelStyle = css `
|
|
|
50
50
|
}
|
|
51
51
|
`;
|
|
52
52
|
function SummaryPanel() {
|
|
53
|
-
const {
|
|
53
|
+
const { correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
|
|
54
54
|
const dispatch = useDispatch();
|
|
55
|
-
const modal = useModal();
|
|
56
55
|
const assignmentData = useAssignmentData();
|
|
56
|
+
const { dialog, openDialog, closeDialog } = useDialogToggle({
|
|
57
|
+
shiftToleranceModal: false,
|
|
58
|
+
molecularFormula: false,
|
|
59
|
+
});
|
|
57
60
|
const [additionalColumnData, setAdditionalColumnData] = useState([]);
|
|
58
61
|
const [selectedAdditionalColumnsAtomType, setSelectedAdditionalColumnsAtomType,] = useState('H');
|
|
59
62
|
const [showProtonsAsRows, setShowProtonsAsRows] = useState(false);
|
|
@@ -135,28 +138,6 @@ function SummaryPanel() {
|
|
|
135
138
|
xDomain,
|
|
136
139
|
yDomain,
|
|
137
140
|
]);
|
|
138
|
-
const handleOnSetMolecularFormula = useCallback((mf) => {
|
|
139
|
-
dispatch({
|
|
140
|
-
type: 'SET_CORRELATIONS_MF',
|
|
141
|
-
payload: {
|
|
142
|
-
mf,
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
}, [dispatch]);
|
|
146
|
-
const handleOnSetShiftTolerance = useCallback((tolerance) => {
|
|
147
|
-
dispatch({
|
|
148
|
-
type: 'SET_CORRELATIONS_TOLERANCE',
|
|
149
|
-
payload: {
|
|
150
|
-
tolerance,
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
}, [dispatch]);
|
|
154
|
-
const showSetMolecularFormulaModal = useCallback(() => {
|
|
155
|
-
modal.show(_jsx(SetMolecularFormulaModal, { onClose: () => modal.close(), onSave: handleOnSetMolecularFormula, molecules: molecules, previousMF: correlationsData.options.mf }));
|
|
156
|
-
}, [correlationsData, handleOnSetMolecularFormula, modal, molecules]);
|
|
157
|
-
const showSetShiftToleranceModal = useCallback(() => {
|
|
158
|
-
modal.show(_jsx(SetShiftToleranceModal, { onClose: () => modal.close(), onSave: handleOnSetShiftTolerance, previousTolerance: correlationsData.options.tolerance }));
|
|
159
|
-
}, [correlationsData, handleOnSetShiftTolerance, modal]);
|
|
160
141
|
const additionalColumnTypes = useMemo(() => {
|
|
161
142
|
const columnTypes = ['H', 'H-H'].concat(correlationsData
|
|
162
143
|
? correlationsData.values
|
|
@@ -309,18 +290,18 @@ function SummaryPanel() {
|
|
|
309
290
|
setFilterIsActive(!filterIsActive);
|
|
310
291
|
}, [filterIsActive]);
|
|
311
292
|
const total = correlationsData ? correlationsData.values.length : 0;
|
|
312
|
-
return (_jsxs("div", { css: panelStyle, children: [_jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
293
|
+
return (_jsxs("div", { css: panelStyle, children: [_jsx(SetMolecularFormulaModal, { isOpen: dialog.molecularFormula, onClose: closeDialog }), _jsx(SetShiftToleranceModal, { isOpen: dialog.shiftToleranceModal, onClose: closeDialog }), _jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
313
294
|
? 'Show all correlations'
|
|
314
295
|
: 'Hide correlations out of view', leftButtons: [
|
|
315
296
|
{
|
|
316
297
|
icon: _jsx(FaFlask, {}),
|
|
317
|
-
|
|
318
|
-
onClick:
|
|
298
|
+
tooltip: `Set molecular formula (${correlationsData?.options?.mf || ''})`,
|
|
299
|
+
onClick: () => openDialog('molecularFormula'),
|
|
319
300
|
},
|
|
320
301
|
{
|
|
321
302
|
icon: _jsx(FaSlidersH, {}),
|
|
322
|
-
|
|
323
|
-
onClick:
|
|
303
|
+
tooltip: 'Set shift tolerance',
|
|
304
|
+
onClick: () => openDialog('shiftToleranceModal'),
|
|
324
305
|
},
|
|
325
306
|
], children: _jsxs("div", { className: "extra-header-content", children: [_jsx("div", { className: "overview-container", children: _jsx(Overview, { correlationsData: correlationsData }) }), _jsx("div", { className: "table-view-selection", children: _jsxs("span", { children: [_jsx("label", { children: "View:" }), _jsx(Select, { onChange: (selection) => {
|
|
326
307
|
setSelectedAdditionalColumnsAtomType(selection);
|
|
@@ -128,24 +128,24 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
128
128
|
{
|
|
129
129
|
disabled: !zones.values || zones.values.length === 0,
|
|
130
130
|
icon: _jsx(FaUnlink, {}),
|
|
131
|
-
|
|
131
|
+
tooltip: 'Remove all assignments',
|
|
132
132
|
onClick: handleOnRemoveAssignments,
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
icon: _jsx("span", { children: "z" }),
|
|
136
|
-
|
|
136
|
+
tooltip: 'Show/Hide zones',
|
|
137
137
|
active: showZones,
|
|
138
138
|
onClick: handleSetShowZones,
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
icon: _jsx("span", { children: "s" }),
|
|
142
|
-
|
|
142
|
+
tooltip: 'Show/Hide signals',
|
|
143
143
|
active: showSignals,
|
|
144
144
|
onClick: handleSetShowSignals,
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
icon: _jsx("span", { children: "p" }),
|
|
148
|
-
|
|
148
|
+
tooltip: 'Show/Hide peaks',
|
|
149
149
|
active: showPeaks,
|
|
150
150
|
onClick: handleSetShowPeaks,
|
|
151
151
|
},
|
|
@@ -43,10 +43,10 @@ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, re
|
|
|
43
43
|
display: 'flex',
|
|
44
44
|
justifyContent: 'space-between',
|
|
45
45
|
paddingBottom: '2px',
|
|
46
|
-
}, children: [_jsx(ToolBarButton, {
|
|
46
|
+
}, children: [_jsx(ToolBarButton, { tooltip: `${showSimilarityTree ? 'Hide' : 'Show'} similarity tree`, icon: _jsx(TbBinaryTree, {}), active: showSimilarityTree, onClick: handleShowSimilarityTree }), _jsx(Select, { style: { flex: 6, marginLeft: '5px' }, items: databases, itemTextField: "label", itemValueField: "key", onChange: onDatabaseChange, placeholder: "Select database", defaultValue: defaultDatabase }), _jsx(Select, { style: { flex: 4, margin: '0px 5px' }, items: result.solvents, placeholder: "Solvent", onChange: handleSearch, value: keywords.solvent }), _jsxs("div", { style: {
|
|
47
47
|
display: 'flex',
|
|
48
48
|
alignItems: 'center',
|
|
49
49
|
flex: 2,
|
|
50
50
|
justifyContent: 'flex-end',
|
|
51
|
-
}, children: [_jsx(CounterLabel, { value: formatCounterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, {
|
|
51
|
+
}, children: [_jsx(CounterLabel, { value: formatCounterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { tooltip: "Preferences", onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToolBarButton, { tooltip: "Filter by select ranges", icon: _jsx(FaICursor, {}), active: selectedTool === options.databaseRangesSelection.id, onClick: enableFilterHandler }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3, margin: '0 5px' } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(ToolBarButton, { tooltip: "Search by substructure", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick })] })] }));
|
|
52
52
|
}
|
|
@@ -35,11 +35,11 @@ function DefaultPanelHeader(props) {
|
|
|
35
35
|
setFilterStatus((previousValue) => !previousValue);
|
|
36
36
|
onFilter?.();
|
|
37
37
|
}
|
|
38
|
-
return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [_jsxs(Toolbar, { children: [onDelete && (_jsx(Toolbar.Item, { id: "delete-button", onClick: onDelete,
|
|
38
|
+
return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [_jsxs(Toolbar, { children: [onDelete && (_jsx(Toolbar.Item, { id: "delete-button", onClick: onDelete, tooltip: deleteToolTip, icon: _jsx(FaRegTrashAlt, {}), intent: "danger", disabled: !total || disableDelete })), onFilter && (_jsx(Toolbar.Item, { id: "filter-button", onClick: handleFilter, tooltip: filterToolTip, active: isFiltered, icon: _jsx(FaFilter, {}) })), mapToolbarButtons(leftButtons)] }), children] }), _jsx(Toolbar, { children: mapToolbarButtons(rightButtons) }), _jsx(CounterLabel, { value: formatCounterLabel(counter, total) }), onSettingClick && (_jsx(PreferencesButton, { tooltip: "Preferences", onClick: onSettingClick }))] }));
|
|
39
39
|
}
|
|
40
40
|
function mapToolbarButtons(buttons) {
|
|
41
41
|
return buttons.map((props, index) => isCustomToolbarItem(props) ? (
|
|
42
42
|
// eslint-disable-next-line react/no-array-index-key
|
|
43
|
-
_jsx(Fragment, { children: props.component }, `${index}`)) : (_jsx(Toolbar.Item, { ...props }, props
|
|
43
|
+
_jsx(Fragment, { children: props.component }, `${index}`)) : (_jsx(Toolbar.Item, { ...props }, props?.id || `${index}`)));
|
|
44
44
|
}
|
|
45
45
|
export default DefaultPanelHeader;
|
|
@@ -6,6 +6,6 @@ function PreferencesHeader({ onClose, onSave }) {
|
|
|
6
6
|
display: 'flex',
|
|
7
7
|
flexDirection: 'row-reverse',
|
|
8
8
|
borderBottom: '0.55px solid rgb(240 240 240)',
|
|
9
|
-
}, children: [_jsx(CloseButton, { onClick: onClose,
|
|
9
|
+
}, children: [_jsx(CloseButton, { onClick: onClose, tooltip: "Close preferences" }), _jsx(SaveButton, { onClick: onSave, tooltip: "Save preferences" })] }));
|
|
10
10
|
}
|
|
11
11
|
export default PreferencesHeader;
|
|
@@ -27,5 +27,5 @@ export function SpectraAutomaticPickingButton() {
|
|
|
27
27
|
!isToolVisible('autoRangeAndZonePicking')) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
return (_jsx(Toolbar.Item, { icon: _jsx(SvgNmrRangePicking, {}),
|
|
30
|
+
return (_jsx(Toolbar.Item, { icon: _jsx(SvgNmrRangePicking, {}), tooltip: "Automatic ranges/zones picking for all spectra", onClick: automaticPickingHandler }));
|
|
31
31
|
}
|