nmrium 0.20.2 → 0.23.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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/FooterBanner.js +1 -1
- package/lib/component/1d/Integral.js +1 -6
- package/lib/component/1d/Viewer1D.js +4 -4
- package/lib/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib/component/1d/utilities/scale.d.ts +1 -1
- package/lib/component/1d/utilities/scale.js +7 -6
- package/lib/component/2d/Viewer2D.js +5 -5
- package/lib/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib/component/NMRium.d.ts +10 -6
- package/lib/component/NMRium.js +3 -9
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/header/Header.js +13 -10
- package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
- package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
- package/lib/component/hooks/useIntegralPath.js +53 -0
- package/lib/component/hooks/useToolsFunctions.js +6 -6
- package/lib/component/hooks/useXScale.d.ts +2 -0
- package/lib/component/hooks/useXScale.js +7 -0
- package/lib/component/loader/DropZone.js +87 -87
- package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
- package/lib/component/modal/PredictSpectraModal.js +2 -32
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
- package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
- package/lib/component/modal/editZone/EditZoneModal.js +96 -0
- package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
- package/lib/component/modal/editZone/SignalFormTab.js +6 -0
- package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
- package/lib/component/modal/editZone/SignalsForm.js +62 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
- package/lib/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
- package/lib/component/modal/setting/GeneralSettings.js +13 -9
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +10 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +9 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib/component/panels/Panels.d.ts +1 -1
- package/lib/component/panels/Panels.js +17 -14
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
- package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
- package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
- package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +6 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +88 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +2 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.js +33 -0
- package/lib/component/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/Reducer.d.ts +9 -23
- package/lib/component/reducer/Reducer.js +7 -8
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
- package/lib/component/reducer/actions/DomainActions.js +20 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib/component/reducer/actions/LoadActions.js +29 -1
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib/component/reducer/actions/RangesActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +43 -56
- package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
- package/lib/component/reducer/actions/ZonesActions.js +33 -2
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
- package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/preferencesReducer.d.ts +3 -8
- package/lib/component/reducer/preferencesReducer.js +86 -37
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/toolbar/FunctionToolBar.js +7 -10
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +46 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +46 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +44 -0
- package/lib/data/PredictionManager.d.ts +35 -3
- package/lib/data/PredictionManager.js +45 -7
- package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
- package/lib/data/constants/DefaultPathLengths.js +8 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/FooterBanner.js +1 -1
- package/lib-cjs/component/1d/Integral.js +1 -6
- package/lib-cjs/component/1d/Viewer1D.js +4 -4
- package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib-cjs/component/1d/utilities/scale.js +7 -6
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib-cjs/component/NMRium.js +3 -10
- package/lib-cjs/component/header/Header.js +13 -10
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
- package/lib-cjs/component/hooks/useXScale.js +11 -0
- package/lib-cjs/component/loader/DropZone.js +87 -87
- package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
- package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
- package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
- package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
- package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
- package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
- package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib-cjs/component/panels/Panels.js +18 -15
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
- package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
- package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +112 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +39 -0
- package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
- package/lib-cjs/component/reducer/Reducer.js +7 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +29 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
- package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +87 -38
- package/lib-cjs/component/reducer/types/Types.js +6 -4
- package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +49 -0
- package/lib-cjs/component/workspaces/exercise1D.js +49 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +47 -0
- package/lib-cjs/data/PredictionManager.js +46 -8
- package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +1 -1
- package/lib/component/1d/utilities/useIntegralPath.js +0 -63
- package/lib/component/nmriumMode/basic.d.ts +0 -38
- package/lib/component/nmriumMode/basic.js +0 -37
- package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
- package/lib/component/nmriumMode/exercise1D.js +0 -37
- package/lib/component/nmriumMode/process1D.d.ts +0 -38
- package/lib/component/nmriumMode/process1D.js +0 -37
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
- package/lib/component/reducer/actions/Zoom.d.ts +0 -16
- package/lib/component/reducer/actions/Zoom.js +0 -92
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
- package/lib-cjs/component/nmriumMode/basic.js +0 -39
- package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
- package/lib-cjs/component/nmriumMode/process1D.js +0 -39
- package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
|
@@ -5,7 +5,7 @@ import FormikColumnFormatField from '../../elements/formik/FormikColumnFormatFie
|
|
|
5
5
|
import FormikForm from '../../elements/formik/FormikForm';
|
|
6
6
|
import { useAlert } from '../../elements/popup/Alert';
|
|
7
7
|
import { SET_PANELS_PREFERENCES } from '../../reducer/preferencesReducer';
|
|
8
|
-
import {
|
|
8
|
+
import { getValue as getValueByKeyPath } from '../../utility/LocalStorage';
|
|
9
9
|
import { databaseDefaultValues } from '../extra/preferences/defaultValues';
|
|
10
10
|
const styles = {
|
|
11
11
|
container: {
|
|
@@ -43,7 +43,6 @@ const styles = {
|
|
|
43
43
|
function DatabasePreferences(props, ref) {
|
|
44
44
|
const preferences = usePreferences();
|
|
45
45
|
const alert = useAlert();
|
|
46
|
-
const [, setSettingsData] = useStateWithLocalStorage('nmr-general-settings');
|
|
47
46
|
const formRef = useRef();
|
|
48
47
|
const updateValues = useCallback(() => {
|
|
49
48
|
const databasePreferences = getValueByKeyPath(preferences, `formatting.panels.database`);
|
|
@@ -52,30 +51,18 @@ function DatabasePreferences(props, ref) {
|
|
|
52
51
|
useEffect(() => {
|
|
53
52
|
updateValues();
|
|
54
53
|
}, [updateValues]);
|
|
55
|
-
const
|
|
56
|
-
setSettingsData(values, 'formatting.panels.database');
|
|
57
|
-
};
|
|
58
|
-
const saveHandler = useCallback((values, showMessage = false) => {
|
|
54
|
+
const saveHandler = useCallback((values) => {
|
|
59
55
|
preferences.dispatch({
|
|
60
56
|
type: SET_PANELS_PREFERENCES,
|
|
61
57
|
payload: { key: 'database', value: values },
|
|
62
58
|
});
|
|
63
|
-
|
|
64
|
-
alert.success('database preferences saved successfully');
|
|
65
|
-
}
|
|
59
|
+
alert.success('database preferences saved successfully');
|
|
66
60
|
}, [alert, preferences]);
|
|
67
61
|
useImperativeHandle(ref, () => ({
|
|
68
62
|
saveSetting: () => {
|
|
69
63
|
formRef.current.submitForm();
|
|
70
64
|
},
|
|
71
|
-
cancelSetting: () => {
|
|
72
|
-
updateValues();
|
|
73
|
-
},
|
|
74
65
|
}));
|
|
75
|
-
|
|
76
|
-
saveHandler(values, true);
|
|
77
|
-
saveToLocalStorage(values);
|
|
78
|
-
};
|
|
79
|
-
return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: handleSubmit, ref: formRef, children: _jsxs("div", { style: styles.groupContainer, children: [_jsx(FormikColumnFormatField, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
|
|
66
|
+
return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: saveHandler, ref: formRef, children: _jsxs("div", { style: styles.groupContainer, children: [_jsx(FormikColumnFormatField, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
|
|
80
67
|
}
|
|
81
68
|
export default forwardRef(DatabasePreferences);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PredictionOptions as PredictionOptionsInterface } from '../../../data/PredictionManager';
|
|
2
|
+
interface PredictionOptionsProps {
|
|
3
|
+
onPredict?: (options?: PredictionOptionsInterface) => void;
|
|
4
|
+
}
|
|
5
|
+
declare function PredictionOptions({ onPredict }: PredictionOptionsProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default PredictionOptions;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useCallback, useRef } from 'react';
|
|
5
|
+
import * as Yup from 'yup';
|
|
6
|
+
import { defaultPredictionOptions, FREQUENCIES, } from '../../../data/PredictionManager';
|
|
7
|
+
import IsotopesViewer from '../../elements/IsotopesViewer';
|
|
8
|
+
import Label from '../../elements/Label';
|
|
9
|
+
import FormikErrorsSummary from '../../elements/formik/FormikErrorsSummary';
|
|
10
|
+
import FormikForm from '../../elements/formik/FormikForm';
|
|
11
|
+
import FormikInput from '../../elements/formik/FormikInput';
|
|
12
|
+
import FormikSelect from '../../elements/formik/FormikSelect';
|
|
13
|
+
const styles = css `
|
|
14
|
+
padding: 10px;
|
|
15
|
+
border-top: solid #f2f2f2 1px;
|
|
16
|
+
|
|
17
|
+
.row {
|
|
18
|
+
flex: row;
|
|
19
|
+
display: flex;
|
|
20
|
+
padding-bottom: 10px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.inner-content {
|
|
24
|
+
flex: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.custom-label {
|
|
28
|
+
width: 160px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.footer-container {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: row-reverse;
|
|
34
|
+
align-items: flex-end;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.btn:not([disabled]):hover {
|
|
38
|
+
background-color: #ffffff;
|
|
39
|
+
}
|
|
40
|
+
.btn:hover {
|
|
41
|
+
background-color: #f2f2f2 !important;
|
|
42
|
+
}
|
|
43
|
+
.btn:disabled {
|
|
44
|
+
opacity: 0.5;
|
|
45
|
+
}
|
|
46
|
+
.btn {
|
|
47
|
+
border: none;
|
|
48
|
+
padding: 0 15px;
|
|
49
|
+
background-color: #ffffff;
|
|
50
|
+
border-radius: 5px;
|
|
51
|
+
height: 25px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.input {
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
border-radius: 5px;
|
|
57
|
+
border: 1px solid #cccccc;
|
|
58
|
+
padding: 5px;
|
|
59
|
+
width: 100px;
|
|
60
|
+
margin-right: 10px;
|
|
61
|
+
height: initial !important;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const predictionFormValidation = Yup.object().shape({
|
|
65
|
+
frequency: Yup.number().integer().required().label('Frequency'),
|
|
66
|
+
'1d': Yup.object({
|
|
67
|
+
'1H': Yup.object({
|
|
68
|
+
from: Yup.number().integer().required().label("1H ' From ' "),
|
|
69
|
+
to: Yup.number().integer().required().label("1H ' To ' "),
|
|
70
|
+
}),
|
|
71
|
+
'13C': Yup.object().shape({
|
|
72
|
+
from: Yup.number().integer().required().label("13C ' From ' "),
|
|
73
|
+
to: Yup.number().integer().required().label("13C ' To ' "),
|
|
74
|
+
}),
|
|
75
|
+
lineWidth: Yup.number().integer().min(1).required().label('Line Width'),
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
78
|
+
function PredictionOptions({ onPredict = () => null }) {
|
|
79
|
+
const refForm = useRef();
|
|
80
|
+
const handleSave = useCallback(() => {
|
|
81
|
+
refForm.current.submitForm();
|
|
82
|
+
}, []);
|
|
83
|
+
const submitHandler = useCallback(async (values) => {
|
|
84
|
+
onPredict(values);
|
|
85
|
+
}, [onPredict]);
|
|
86
|
+
return (_jsxs("div", { css: styles, children: [_jsx("div", { children: _jsxs(FormikForm, { ref: refForm, initialValues: defaultPredictionOptions, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [_jsx(FormikErrorsSummary, {}, void 0), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Frequency : " }, void 0), _jsx(FormikSelect, { data: FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" }, void 0)] }, void 0), _jsxs("div", { className: "row", children: [_jsx(IsotopesViewer, { value: "1H", className: "custom-label" }, void 0), _jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.1H.from", type: "number" }, void 0) }, void 0), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.1H.to", type: "number" }, void 0) }, void 0)] }, void 0), _jsxs("div", { className: "row", children: [_jsx(IsotopesViewer, { value: "13C", className: "custom-label" }, void 0), _jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.13C.from", type: "number" }, void 0) }, void 0), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.13C.to", type: "number" }, void 0) }, void 0)] }, void 0), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx("span", { className: "custom-label", children: "Line Width : " }, void 0), _jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }, void 0), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " }, void 0)] }, void 0)] }, void 0) }, void 0), _jsx("div", { children: _jsx("button", { type: "button", onClick: handleSave, className: "btn", children: "Predict spectrum" }, void 0) }, void 0)] }, void 0));
|
|
87
|
+
}
|
|
88
|
+
export default PredictionOptions;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
4
|
+
import { useAlert } from '../../elements/popup/Alert';
|
|
5
|
+
import { PREDICT_SPECTRA, SET_LOADING_FLAG } from '../../reducer/types/Types';
|
|
6
|
+
import MoleculePanel from '../MoleculesPanel/MoleculePanel';
|
|
7
|
+
import PredictionPreferences from './PredictionOptions';
|
|
8
|
+
export default function PredictionPane() {
|
|
9
|
+
const [molecule, setMolecule] = useState();
|
|
10
|
+
const changeHandler = useCallback((molecule) => {
|
|
11
|
+
setMolecule(molecule);
|
|
12
|
+
}, []);
|
|
13
|
+
const dispatch = useDispatch();
|
|
14
|
+
const alert = useAlert();
|
|
15
|
+
const predictHandler = useCallback(async (values) => {
|
|
16
|
+
if (molecule) {
|
|
17
|
+
dispatch({
|
|
18
|
+
type: SET_LOADING_FLAG,
|
|
19
|
+
isLoading: true,
|
|
20
|
+
});
|
|
21
|
+
const hideLoading = await alert.showLoading(`Predict 1H, 13C, COSY, HSQC, and HMBC in progress`);
|
|
22
|
+
dispatch({
|
|
23
|
+
type: PREDICT_SPECTRA,
|
|
24
|
+
payload: { mol: molecule, options: values },
|
|
25
|
+
});
|
|
26
|
+
hideLoading();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
alert.error('No Molecule selected');
|
|
30
|
+
}
|
|
31
|
+
}, [alert, dispatch, molecule]);
|
|
32
|
+
return (_jsx(MoleculePanel, { onMoleculeChange: changeHandler, actionsOptions: { hidePredict: true, hideDelete: true, hideExport: true }, children: _jsx(PredictionPreferences, { onPredict: predictHandler }, void 0) }, void 0));
|
|
33
|
+
}
|
|
@@ -16,7 +16,7 @@ const ignoreActions = [
|
|
|
16
16
|
types.SET_DIMENSIONS,
|
|
17
17
|
types.SET_X_DOMAIN,
|
|
18
18
|
types.SET_Y_DOMAIN,
|
|
19
|
-
types.
|
|
19
|
+
types.SET_ZOOM,
|
|
20
20
|
types.TOGGLE_REAL_IMAGINARY_VISIBILITY,
|
|
21
21
|
types.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER,
|
|
22
22
|
types.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE,
|
|
@@ -28,6 +28,7 @@ const ignoreActions = [
|
|
|
28
28
|
types.CHANGE_PEAKS_MARKERS_VISIBILITY,
|
|
29
29
|
types.CHANGE_ACTIVE_SPECTRUM,
|
|
30
30
|
types.CHANGE_SPECTRUM_COLOR,
|
|
31
|
+
types.SET_MOUSE_OVER_DISPLAYER,
|
|
31
32
|
];
|
|
32
33
|
function checkActionType(type) {
|
|
33
34
|
if (!ignoreActions.includes(type))
|
|
@@ -7,7 +7,6 @@ import { Contours } from '../../data/types/data2d/Contours';
|
|
|
7
7
|
import { UsedColors } from '../../types/UsedColors';
|
|
8
8
|
import { Spectra } from '../NMRium';
|
|
9
9
|
import { DISPLAYER_MODE } from './core/Constants';
|
|
10
|
-
import { Zoom1D } from './helper/Zoom1DManager';
|
|
11
10
|
import { ZoomHistory } from './helper/ZoomHistoryManager';
|
|
12
11
|
export interface ActiveSpectrum {
|
|
13
12
|
id: string;
|
|
@@ -79,6 +78,12 @@ export interface State {
|
|
|
79
78
|
yDomains: Record<string, Array<number>>;
|
|
80
79
|
shareYDomain: boolean;
|
|
81
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* y axis domain per spectrum for integrals
|
|
83
|
+
* value change when vertical scale change for the integrals
|
|
84
|
+
* @default {}
|
|
85
|
+
*/
|
|
86
|
+
integralsYDomains: Record<string, Array<number>>;
|
|
82
87
|
/**
|
|
83
88
|
* current select tab (nucleus)
|
|
84
89
|
* @default null
|
|
@@ -166,8 +171,6 @@ export interface State {
|
|
|
166
171
|
*/
|
|
167
172
|
zoom: {
|
|
168
173
|
history: ZoomHistory;
|
|
169
|
-
spectra: Zoom1D;
|
|
170
|
-
integral: Zoom1D;
|
|
171
174
|
};
|
|
172
175
|
/**
|
|
173
176
|
* boolean indicator to check if the mouse over the displayer or not
|
|
@@ -590,6 +593,9 @@ export declare const spectrumReducer: (base: {
|
|
|
590
593
|
};
|
|
591
594
|
readonly shareYDomain: boolean;
|
|
592
595
|
};
|
|
596
|
+
readonly integralsYDomains: {
|
|
597
|
+
readonly [x: string]: readonly number[];
|
|
598
|
+
};
|
|
593
599
|
readonly activeTab: string;
|
|
594
600
|
readonly width: number;
|
|
595
601
|
readonly height: number;
|
|
@@ -682,26 +688,6 @@ export declare const spectrumReducer: (base: {
|
|
|
682
688
|
readonly yDomain: readonly number[];
|
|
683
689
|
}[];
|
|
684
690
|
};
|
|
685
|
-
readonly spectra: {
|
|
686
|
-
readonly scales: {
|
|
687
|
-
readonly [x: string]: number;
|
|
688
|
-
};
|
|
689
|
-
readonly options: {
|
|
690
|
-
readonly slowZoomStep: number;
|
|
691
|
-
readonly fastZoomStep: number;
|
|
692
|
-
readonly speedThreshold: number;
|
|
693
|
-
};
|
|
694
|
-
};
|
|
695
|
-
readonly integral: {
|
|
696
|
-
readonly scales: {
|
|
697
|
-
readonly [x: string]: number;
|
|
698
|
-
};
|
|
699
|
-
readonly options: {
|
|
700
|
-
readonly slowZoomStep: number;
|
|
701
|
-
readonly fastZoomStep: number;
|
|
702
|
-
readonly speedThreshold: number;
|
|
703
|
-
};
|
|
704
|
-
};
|
|
705
691
|
};
|
|
706
692
|
readonly overDisplayer: boolean;
|
|
707
693
|
readonly toolOptions: {
|
|
@@ -25,7 +25,6 @@ import * as SpectrumsActions from './actions/SpectrumsActions';
|
|
|
25
25
|
import * as ToolsActions from './actions/ToolsActions';
|
|
26
26
|
import * as ZonesActions from './actions/ZonesActions';
|
|
27
27
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from './core/Constants';
|
|
28
|
-
import { initZoom1D } from './helper/Zoom1DManager';
|
|
29
28
|
import { UNDO, REDO, RESET } from './types/HistoryTypes';
|
|
30
29
|
import * as types from './types/Types';
|
|
31
30
|
export const initialState = {
|
|
@@ -44,6 +43,7 @@ export const initialState = {
|
|
|
44
43
|
yDomains: {},
|
|
45
44
|
shareYDomain: false,
|
|
46
45
|
},
|
|
46
|
+
integralsYDomains: {},
|
|
47
47
|
activeTab: '',
|
|
48
48
|
width: 0,
|
|
49
49
|
height: 0,
|
|
@@ -76,8 +76,6 @@ export const initialState = {
|
|
|
76
76
|
displayerKey: '',
|
|
77
77
|
zoom: {
|
|
78
78
|
history: {},
|
|
79
|
-
spectra: {},
|
|
80
|
-
integral: {},
|
|
81
79
|
},
|
|
82
80
|
overDisplayer: false,
|
|
83
81
|
toolOptions: {
|
|
@@ -101,14 +99,11 @@ export function initState(state) {
|
|
|
101
99
|
const correlations = buildCorrelationData([], {
|
|
102
100
|
tolerance: DefaultTolerance,
|
|
103
101
|
});
|
|
104
|
-
const spectra = initZoom1D();
|
|
105
|
-
const integral = initZoom1D();
|
|
106
|
-
const zoom = { spectra, integral, history: {} };
|
|
107
102
|
return {
|
|
108
103
|
...state,
|
|
109
104
|
correlations,
|
|
110
105
|
displayerKey,
|
|
111
|
-
|
|
106
|
+
history: {},
|
|
112
107
|
};
|
|
113
108
|
}
|
|
114
109
|
export function dispatchMiddleware(dispatch) {
|
|
@@ -272,7 +267,7 @@ function innerSpectrumReducer(draft, action) {
|
|
|
272
267
|
return SpectrumsActions.generateSpectrumFromPublicationStringHandler(draft, action);
|
|
273
268
|
case types.TOGGLE_REAL_IMAGINARY_VISIBILITY:
|
|
274
269
|
return ToolsActions.handleToggleRealImaginaryVisibility(draft);
|
|
275
|
-
case types.
|
|
270
|
+
case types.SET_ZOOM:
|
|
276
271
|
return ToolsActions.handleZoom(draft, action);
|
|
277
272
|
case types.SET_SPECTRA_SAME_TOP:
|
|
278
273
|
return ToolsActions.setSpectraSameTopHandler(draft);
|
|
@@ -366,6 +361,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
366
361
|
return ZonesActions.handleDeleteZone(draft, action);
|
|
367
362
|
case types.DELETE_2D_SIGNAL:
|
|
368
363
|
return ZonesActions.handleDeleteSignal(draft, action);
|
|
364
|
+
case types.SET_2D_SIGNAL_PATH_LENGTH:
|
|
365
|
+
return ZonesActions.handleSetSignalPathLength(draft, action);
|
|
369
366
|
case types.RESET_DOMAIN:
|
|
370
367
|
return DomainActions.handelResetDomain(draft);
|
|
371
368
|
case types.CHANGE_ZONE_SIGNAL_VALUE:
|
|
@@ -378,6 +375,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
378
375
|
return ZonesActions.handleSetDiaIDZone(draft, action);
|
|
379
376
|
case types.AUTO_ZONES_SPECTRA_PICKING:
|
|
380
377
|
return ZonesActions.handleAutoSpectraZonesDetection(draft);
|
|
378
|
+
case types.SAVE_EDITED_ZONE:
|
|
379
|
+
return ZonesActions.handleSaveEditedZone(draft, action);
|
|
381
380
|
case types.ANALYZE_SPECTRA:
|
|
382
381
|
return SpectraAnalysisActions.analyzeSpectra(draft, action);
|
|
383
382
|
case types.DELETE_ANALYZE_SPECTRA_RANGE:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generateSpectrumFromRanges } from '../../../data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges';
|
|
2
|
+
import { setZoom } from '../helper/Zoom1DManager';
|
|
2
3
|
import { setDomain } from './DomainActions';
|
|
3
|
-
import { setZoom } from './Zoom';
|
|
4
4
|
function handleRangeResurrecting(draft, action) {
|
|
5
5
|
const { ranges, info } = action.payload;
|
|
6
6
|
const datum = generateSpectrumFromRanges(ranges, info, draft.usedColors);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { Datum1D } from '../../../data/types/data1d';
|
|
2
3
|
import { State } from '../Reducer';
|
|
3
4
|
declare function getDomain(drfat: Draft<State>): {
|
|
4
5
|
xDomain: [number, number] | [undefined, undefined];
|
|
@@ -13,9 +14,10 @@ export interface SetDomainOptions {
|
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
declare function setDomain(draft: Draft<State>, options?: SetDomainOptions): void;
|
|
17
|
+
declare function setIntegralsYDomain(draft: Draft<State>, data: Datum1D[] | Datum1D): void;
|
|
16
18
|
declare function setOriginalDomain(draft: Draft<State>, originDomain: any): void;
|
|
17
19
|
declare function setXDomain(draft: Draft<State>, xDomain: any): void;
|
|
18
20
|
declare function setYDomain(draft: Draft<State>, yDomain: any): void;
|
|
19
21
|
declare function handelResetDomain(draft: Draft<State>): void;
|
|
20
22
|
declare function setMode(draft: Draft<State>): void;
|
|
21
|
-
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, };
|
|
23
|
+
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, setIntegralsYDomain, };
|
|
@@ -149,6 +149,25 @@ function setDomain(draft, options) {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
function getSpectrumIntegralsDomain(datum) {
|
|
153
|
+
const { integrals, ranges } = datum;
|
|
154
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
155
|
+
for (const integral of integrals.values) {
|
|
156
|
+
max = Math.max(max, integral.absolute);
|
|
157
|
+
}
|
|
158
|
+
for (const range of ranges.values) {
|
|
159
|
+
max = Math.max(max, range.absolute);
|
|
160
|
+
}
|
|
161
|
+
return [0, max];
|
|
162
|
+
}
|
|
163
|
+
function setIntegralsYDomain(draft, data) {
|
|
164
|
+
for (const spectrum of Array.isArray(data) ? data : [data]) {
|
|
165
|
+
if (spectrum?.info?.dimension === 1) {
|
|
166
|
+
draft.integralsYDomains[spectrum.id] =
|
|
167
|
+
getSpectrumIntegralsDomain(spectrum);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
152
171
|
function setOriginalDomain(draft, originDomain) {
|
|
153
172
|
draft.originDomain = originDomain;
|
|
154
173
|
}
|
|
@@ -170,4 +189,4 @@ function setMode(draft) {
|
|
|
170
189
|
nucleusToString(datum.info.nucleus) === draft.activeTab);
|
|
171
190
|
draft.mode = data[0]?.info.isFid ? 'LTR' : 'RTL';
|
|
172
191
|
}
|
|
173
|
-
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, };
|
|
192
|
+
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, setIntegralsYDomain, };
|
|
@@ -4,6 +4,7 @@ import { updateIntegralsRelativeValues, changeIntegralsRelative, getShiftX, } fr
|
|
|
4
4
|
import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
5
5
|
import generateID from '../../../data/utilities/generateID';
|
|
6
6
|
import getRange from '../helper/getRange';
|
|
7
|
+
import { setIntegralsYDomain } from './DomainActions';
|
|
7
8
|
function handleChangeIntegralSum(draft, options) {
|
|
8
9
|
const { data, activeSpectrum, activeTab: nucleus } = draft;
|
|
9
10
|
if (activeSpectrum?.id) {
|
|
@@ -36,6 +37,7 @@ function addIntegral(draft, action) {
|
|
|
36
37
|
nucleus,
|
|
37
38
|
});
|
|
38
39
|
updateIntegralsRelativeValues(datum);
|
|
40
|
+
setIntegralsYDomain(draft, datum);
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
function deleteIntegral(draft, action) {
|
|
@@ -4,6 +4,11 @@ import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
|
4
4
|
import { DefaultTolerance } from '../../panels/SummaryPanel/CorrelationTable/Constants';
|
|
5
5
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
6
6
|
import { setActiveTab } from './ToolsActions';
|
|
7
|
+
function resetState(draft) {
|
|
8
|
+
draft.activeSpectrum = null;
|
|
9
|
+
draft.activeTab = '';
|
|
10
|
+
draft.tabActiveSpectrum = {};
|
|
11
|
+
}
|
|
7
12
|
function setIsLoading(draft, isLoading) {
|
|
8
13
|
draft.isLoading = isLoading;
|
|
9
14
|
}
|
|
@@ -28,9 +33,30 @@ function setData(draft, data) {
|
|
|
28
33
|
});
|
|
29
34
|
}
|
|
30
35
|
else {
|
|
31
|
-
|
|
36
|
+
// in case of older NMRium data are imported, convert hybridization string to number array
|
|
37
|
+
// @TODO remove following command to overwrite correlations at some point in future
|
|
38
|
+
draft.correlations =
|
|
39
|
+
convertHybridizationStringValuesInCorrelations(correlations);
|
|
40
|
+
// draft.correlations = correlations // original command without overwriting
|
|
32
41
|
}
|
|
33
42
|
}
|
|
43
|
+
function convertHybridizationStringValuesInCorrelations(correlations) {
|
|
44
|
+
return {
|
|
45
|
+
...correlations,
|
|
46
|
+
values: correlations.values.map((correlation) => {
|
|
47
|
+
if (typeof correlation.hybridization === 'string') {
|
|
48
|
+
let values = [];
|
|
49
|
+
if (correlation.hybridization.length > 0) {
|
|
50
|
+
const hybridizationString = correlation.hybridization.replaceAll('SP', '');
|
|
51
|
+
const value = Number(hybridizationString);
|
|
52
|
+
values.push(value);
|
|
53
|
+
}
|
|
54
|
+
correlation.hybridization = values;
|
|
55
|
+
}
|
|
56
|
+
return correlation;
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
34
60
|
function setPreferences(draft, data) {
|
|
35
61
|
const emptyPreferences = {
|
|
36
62
|
verticalAlign: null,
|
|
@@ -72,6 +98,7 @@ function loadJcampFile(draft, actions) {
|
|
|
72
98
|
draft.isLoading = false;
|
|
73
99
|
}
|
|
74
100
|
function handleLoadJsonFile(draft, action) {
|
|
101
|
+
resetState(draft);
|
|
75
102
|
setData(draft, action.payload);
|
|
76
103
|
const preferences = action.payload?.preferences || {};
|
|
77
104
|
setActiveTab(draft, { tab: preferences?.activeTab || '' });
|
|
@@ -94,6 +121,7 @@ function handleLoadZIPFile(draft, action) {
|
|
|
94
121
|
draft.isLoading = false;
|
|
95
122
|
}
|
|
96
123
|
function handleLoadNmredata(draft, action) {
|
|
124
|
+
resetState(draft);
|
|
97
125
|
setData(draft, action.payload);
|
|
98
126
|
setActiveTab(draft);
|
|
99
127
|
changeSpectrumVerticalAlignment(draft, { align: 'auto-check' });
|
|
@@ -52,7 +52,7 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
52
52
|
draft.isLoading = false;
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
for (const spectrum of generateSpectra(data, options
|
|
55
|
+
for (const spectrum of generateSpectra(data, options)) {
|
|
56
56
|
draft.data.push(spectrum);
|
|
57
57
|
draft.tabActiveSpectrum[nucleusToString(spectrum.info.nucleus)] = {
|
|
58
58
|
id: spectrum.id,
|
|
@@ -3,7 +3,6 @@ import GroupByInfoKey from '../../utility/GroupByInfoKey';
|
|
|
3
3
|
import nucleusToString from '../../utility/nucleusToString';
|
|
4
4
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from '../core/Constants';
|
|
5
5
|
import { setDomain } from './DomainActions';
|
|
6
|
-
import { setZoom } from './Zoom';
|
|
7
6
|
function changeSpectrumVerticalAlignment(draft, options) {
|
|
8
7
|
if (draft.data && draft.data.length > 0) {
|
|
9
8
|
let dataPerNucleus = [];
|
|
@@ -109,7 +108,6 @@ function applyKeyPreferencesHandler(draft, keyCode) {
|
|
|
109
108
|
}
|
|
110
109
|
else {
|
|
111
110
|
draft.zoom = preferences.zoom;
|
|
112
|
-
setZoom(draft);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
113
|
}
|
|
@@ -9,7 +9,7 @@ import { setSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
|
9
9
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
10
10
|
import getRange from '../helper/getRange';
|
|
11
11
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
12
|
-
import { setDomain } from './DomainActions';
|
|
12
|
+
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
13
13
|
function handleAutoRangesDetection(draft, options) {
|
|
14
14
|
const { activeSpectrum, data, xDomain, molecules, activeTab: nucleus, } = draft;
|
|
15
15
|
if (activeSpectrum?.id) {
|
|
@@ -35,6 +35,7 @@ function handleAutoRangesDetection(draft, options) {
|
|
|
35
35
|
nucleus,
|
|
36
36
|
});
|
|
37
37
|
handleOnChangeRangesData(draft);
|
|
38
|
+
setIntegralsYDomain(draft, datum);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
function handleAutoSpectraRangesDetection(draft) {
|
|
@@ -210,6 +211,7 @@ function handleAddRange(draft, action) {
|
|
|
210
211
|
const [from, to] = range;
|
|
211
212
|
addRange(draft.data[index], { from, to, nucleus, molecules });
|
|
212
213
|
handleOnChangeRangesData(draft);
|
|
214
|
+
setIntegralsYDomain(draft, draft.data[index]);
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
function handleChangeRangeRelativeValue(draft, action) {
|
|
@@ -5,10 +5,10 @@ import { generateSpectrumFromPublicationString, getReferenceShift, } from '../..
|
|
|
5
5
|
import { getMissingProjection } from '../../../data/data2d/Spectrum2D';
|
|
6
6
|
import { options } from '../../toolbar/ToolTypes';
|
|
7
7
|
import GroupByInfoKey from '../../utility/GroupByInfoKey';
|
|
8
|
+
import { setZoom } from '../helper/Zoom1DManager';
|
|
8
9
|
import { setDomain, setMode } from './DomainActions';
|
|
9
10
|
import { resetSpectrumByFilter } from './FiltersActions';
|
|
10
11
|
import { setTab, setActiveTab } from './ToolsActions';
|
|
11
|
-
import { setZoom } from './Zoom';
|
|
12
12
|
function checkIsVisible2D(datum) {
|
|
13
13
|
if (datum.display.isPositiveVisible === false &&
|
|
14
14
|
datum.display.isNegativeVisible === false) {
|