nmrium 0.41.0 → 0.43.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/ApodizationLine.js +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +1 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/Input.js +1 -0
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/Scroller.d.ts +15 -0
- package/lib/component/elements/Scroller.js +31 -0
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +5 -5
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSaveSettings.js +9 -11
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +89 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +33 -26
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
- package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +0 -1
- package/lib/component/reducer/Reducer.d.ts +1 -6
- package/lib/component/reducer/Reducer.js +32 -6
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.d.ts +6 -2
- package/lib/component/reducer/actions/MoleculeActions.js +8 -2
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +1 -0
- package/lib/component/toolbar/ToolTypes.js +36 -0
- package/lib/component/utility/PathBuilder.js +11 -0
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +10 -5
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/data1d/database.d.ts +4 -2
- package/lib/data/data1d/database.js +10 -3
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/molecules/MoleculeManager.d.ts +1 -0
- package/lib/data/molecules/MoleculeManager.js +14 -0
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/Input.js +1 -0
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/Scroller.js +35 -0
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +5 -5
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +33 -26
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
- package/lib-cjs/component/reducer/Reducer.js +31 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +9 -2
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
- package/lib-cjs/component/utility/PathBuilder.js +11 -0
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +10 -5
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/data1d/database.js +10 -3
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +16 -1
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
|
@@ -45,6 +45,13 @@ const emptyKeywords = {
|
|
|
45
45
|
solvent: '-1',
|
|
46
46
|
searchKeywords: '',
|
|
47
47
|
};
|
|
48
|
+
function mapKeywordsToArray(searchKeywords, solvent) {
|
|
49
|
+
const values = searchKeywords ? searchKeywords.split(' ') : [];
|
|
50
|
+
if (solvent !== '-1') {
|
|
51
|
+
values.unshift(`solvent:${solvent}`);
|
|
52
|
+
}
|
|
53
|
+
return values;
|
|
54
|
+
}
|
|
48
55
|
function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase, }) {
|
|
49
56
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
50
57
|
const alert = (0, Alert_1.useAlert)();
|
|
@@ -82,28 +89,34 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
82
89
|
}));
|
|
83
90
|
}
|
|
84
91
|
}, []);
|
|
92
|
+
const search = (0, react_2.useCallback)((solvents) => {
|
|
93
|
+
const { solvent, searchKeywords } = keywords;
|
|
94
|
+
if (databaseInstance.current) {
|
|
95
|
+
const keywords = mapKeywordsToArray(searchKeywords, solvent);
|
|
96
|
+
const data = databaseInstance.current.search({ keywords, idCode });
|
|
97
|
+
setResult((prevResult) => ({
|
|
98
|
+
...prevResult,
|
|
99
|
+
data,
|
|
100
|
+
...(solvents && { solvents }),
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
}, [idCode, keywords]);
|
|
85
104
|
(0, react_2.useEffect)(() => {
|
|
86
105
|
const { solvent, searchKeywords } = keywords;
|
|
87
106
|
setTimeout(async () => {
|
|
88
107
|
if (databaseInstance.current) {
|
|
89
108
|
const hideLoading = await alert.showLoading(`Preparing of the Result`);
|
|
90
109
|
if (solvent === '-1' && !searchKeywords) {
|
|
91
|
-
const data = databaseInstance.current.data;
|
|
92
110
|
const solvents = mapSolventsToSelect(databaseInstance.current.getSolvents());
|
|
93
|
-
|
|
111
|
+
search(solvents);
|
|
94
112
|
}
|
|
95
113
|
else {
|
|
96
|
-
|
|
97
|
-
if (solvent !== '-1') {
|
|
98
|
-
values.unshift(`solvent:${solvent}`);
|
|
99
|
-
}
|
|
100
|
-
const data = databaseInstance.current.search(values.join(' '));
|
|
101
|
-
setResult((prevResult) => ({ ...prevResult, data }));
|
|
114
|
+
search();
|
|
102
115
|
}
|
|
103
116
|
hideLoading();
|
|
104
117
|
}
|
|
105
118
|
}, 0);
|
|
106
|
-
}, [alert, keywords]);
|
|
119
|
+
}, [alert, idCode, keywords, search]);
|
|
107
120
|
(0, react_2.useEffect)(() => {
|
|
108
121
|
function handle(event) {
|
|
109
122
|
if (selectedTool === ToolTypes_1.options.databaseRangesSelection.id) {
|
|
@@ -125,6 +138,16 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
125
138
|
Events_1.default.off('brushEnd', handle);
|
|
126
139
|
};
|
|
127
140
|
}, [format, selectedTool]);
|
|
141
|
+
(0, react_2.useEffect)(() => {
|
|
142
|
+
setTimeout(async () => {
|
|
143
|
+
if (databaseInstance.current) {
|
|
144
|
+
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
145
|
+
databaseInstance.current = (0, database_1.initiateDatabase)(databaseDataRef.current, nucleus);
|
|
146
|
+
hideLoading();
|
|
147
|
+
setKeywords({ ...emptyKeywords });
|
|
148
|
+
}
|
|
149
|
+
}, 0);
|
|
150
|
+
}, [alert, nucleus]);
|
|
128
151
|
const handleChangeDatabase = (0, react_2.useCallback)((databaseKey) => {
|
|
129
152
|
const database = databases.find((item) => item.key === databaseKey);
|
|
130
153
|
setTimeout(async () => {
|
|
@@ -156,16 +179,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
156
179
|
hideLoading();
|
|
157
180
|
}, 0);
|
|
158
181
|
}, [alert, databases, nucleus]);
|
|
159
|
-
(0, react_2.useEffect)(() => {
|
|
160
|
-
setTimeout(async () => {
|
|
161
|
-
if (databaseInstance.current) {
|
|
162
|
-
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
163
|
-
databaseInstance.current = (0, database_1.initiateDatabase)(databaseDataRef.current, nucleus);
|
|
164
|
-
hideLoading();
|
|
165
|
-
setKeywords({ ...emptyKeywords });
|
|
166
|
-
}
|
|
167
|
-
}, 0);
|
|
168
|
-
}, [alert, nucleus]);
|
|
169
182
|
(0, react_2.useEffect)(() => {
|
|
170
183
|
if (item?.isOpen && defaultDatabase && !databaseInstance.current) {
|
|
171
184
|
handleChangeDatabase(defaultDatabase);
|
|
@@ -236,13 +249,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
236
249
|
handleChangeOption(tool);
|
|
237
250
|
}, [handleChangeOption]);
|
|
238
251
|
const searchByStructureHandler = (idCodeValue) => {
|
|
239
|
-
|
|
240
|
-
const hideLoading = await alert.showLoading(`Searching in progress...`);
|
|
241
|
-
const data = databaseInstance.current?.searchByStructure(idCodeValue) || [];
|
|
242
|
-
setResult((prevResult) => ({ ...prevResult, data }));
|
|
243
|
-
setIdCode(idCodeValue);
|
|
244
|
-
hideLoading();
|
|
245
|
-
}, 0);
|
|
252
|
+
setIdCode(idCodeValue);
|
|
246
253
|
};
|
|
247
254
|
const openSearchByStructure = () => {
|
|
248
255
|
modal.show((0, jsx_runtime_1.jsx)(DatabaseStructureSearchModal_1.DatabaseStructureSearchModal, { onChange: searchByStructureHandler, idCode: idCode }), {
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createFilterLabel = void 0;
|
|
6
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
8
|
const fa_1 = require("react-icons/fa");
|
|
8
9
|
const Button_1 = __importDefault(require("../../elements/Button"));
|
|
@@ -19,13 +20,18 @@ const styles = {
|
|
|
19
20
|
margin: 0,
|
|
20
21
|
textAlign: 'right',
|
|
21
22
|
lineHeight: '22px',
|
|
22
|
-
padding: '0
|
|
23
|
+
padding: '0 5px',
|
|
23
24
|
whiteSpace: 'nowrap',
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
function createFilterLabel(total, counter) {
|
|
28
|
+
if (typeof counter === 'boolean') {
|
|
29
|
+
return `[ ${total || 0} ]`;
|
|
30
|
+
}
|
|
31
|
+
return `[ ${counter}/${total} ]`;
|
|
32
|
+
}
|
|
33
|
+
exports.createFilterLabel = createFilterLabel;
|
|
34
|
+
function DefaultPanelHeader({ counter, counterLabel, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(PanelHeader_1.default, { style, className, children: [(0, jsx_runtime_1.jsxs)("div", { style: styles.leftContainer, children: [canDelete && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}) })), filterToolTip ? ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, children: (0, jsx_runtime_1.jsx)(fa_1.FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counterLabel && (0, jsx_runtime_1.jsx)("p", { style: styles.counterLabel, children: counterLabel }), showSettingButton && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Preferences", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onSettingClick, children: (0, jsx_runtime_1.jsx)(fa_1.FaCog, {}) }) }))] }));
|
|
30
36
|
}
|
|
31
37
|
exports.default = DefaultPanelHeader;
|
|
@@ -77,7 +77,7 @@ function PredictionPanel() {
|
|
|
77
77
|
}
|
|
78
78
|
const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
|
|
79
79
|
try {
|
|
80
|
-
const data = await (0, PredictionManager_1.predictSpectra)(molfile);
|
|
80
|
+
const data = await (0, PredictionManager_1.predictSpectra)(molfile, predictionPreferences.spectra);
|
|
81
81
|
dispatch({
|
|
82
82
|
type: 'PREDICT_SPECTRA',
|
|
83
83
|
payload: {
|
|
@@ -65,7 +65,6 @@ function PredictionSimpleOptions() {
|
|
|
65
65
|
display: 'flex',
|
|
66
66
|
justifyContent: 'flex-end',
|
|
67
67
|
flex: '1',
|
|
68
|
-
padding: '0 10px',
|
|
69
68
|
height: '100%',
|
|
70
69
|
}, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: selectStyles, name: "frequency" }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: "1d.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), (0, jsx_runtime_1.jsx)("span", { style: { padding: '0 5px' }, children: "Hz" })] }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { enableValidation: true, onChange: optionsChangeHandler })] }) }));
|
|
71
70
|
}
|
|
@@ -69,7 +69,7 @@ function SpectrumSimulation() {
|
|
|
69
69
|
}
|
|
70
70
|
function saveSettingsHandler(values) {
|
|
71
71
|
simulateHandler(values);
|
|
72
|
-
formRef.current?.setValues(values);
|
|
72
|
+
void formRef.current?.setValues(values);
|
|
73
73
|
}
|
|
74
74
|
return ((0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: { ...spectrumSimulation_1.defaultSimulationOptions, data }, enableReinitialize: true,
|
|
75
75
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -25,7 +25,6 @@ function SpectrumSimulationSimpleOptions({ onSpinSystemChange, spinSystem, }) {
|
|
|
25
25
|
display: 'flex',
|
|
26
26
|
justifyContent: 'flex-end',
|
|
27
27
|
flex: '1',
|
|
28
|
-
|
|
29
|
-
}, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Spin system", style: labelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), (0, jsx_runtime_1.jsx)("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
|
|
28
|
+
}, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "", style: labelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), (0, jsx_runtime_1.jsx)("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
|
|
30
29
|
}
|
|
31
30
|
exports.default = SpectrumSimulationSimpleOptions;
|
|
@@ -21,7 +21,6 @@ const ignoreActions = new Set([
|
|
|
21
21
|
'CHANGE_SPECTRUM_VISIBILITY',
|
|
22
22
|
'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS',
|
|
23
23
|
'CHANGE_ACTIVE_SPECTRUM',
|
|
24
|
-
'SET_MOUSE_OVER_DISPLAYER',
|
|
25
24
|
'CHANGE_FLOAT_MOLECULE_POSITION',
|
|
26
25
|
'ALIGN_SPECTRA',
|
|
27
26
|
'TOGGLE_REAL_IMAGINARY_VISIBILITY',
|
|
@@ -34,7 +34,6 @@ const DatabaseActions = __importStar(require("./actions/DatabaseActions"));
|
|
|
34
34
|
const DimensionsActions = __importStar(require("./actions/DimensionsActions"));
|
|
35
35
|
const DomainActions = __importStar(require("./actions/DomainActions"));
|
|
36
36
|
const FiltersActions = __importStar(require("./actions/FiltersActions"));
|
|
37
|
-
const GlobalActions = __importStar(require("./actions/GlobalActions"));
|
|
38
37
|
const IntegralsActions = __importStar(require("./actions/IntegralsActions"));
|
|
39
38
|
const LoadActions = __importStar(require("./actions/LoadActions"));
|
|
40
39
|
const MoleculeActions = __importStar(require("./actions/MoleculeActions"));
|
|
@@ -119,7 +118,6 @@ const getInitialState = () => ({
|
|
|
119
118
|
zoom: {
|
|
120
119
|
history: {},
|
|
121
120
|
},
|
|
122
|
-
overDisplayer: false,
|
|
123
121
|
toolOptions: {
|
|
124
122
|
selectedTool: 'zoom',
|
|
125
123
|
selectedOptionPanel: null,
|
|
@@ -127,6 +125,7 @@ const getInitialState = () => ({
|
|
|
127
125
|
baselineCorrection: {
|
|
128
126
|
options: {},
|
|
129
127
|
zones: [],
|
|
128
|
+
livePreview: true,
|
|
130
129
|
},
|
|
131
130
|
apodizationOptions: {},
|
|
132
131
|
pivot: { value: 0, index: 0 },
|
|
@@ -178,6 +177,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
178
177
|
return PeaksActions.handleChangePeakShape(draft, action);
|
|
179
178
|
case 'TOGGLE_PEAKS_VIEW_PROPERTY':
|
|
180
179
|
return PeaksActions.handleTogglePeaksViewProperty(draft, action);
|
|
180
|
+
case 'TOGGLE_PEAKS_DISPLAYING_MODE':
|
|
181
|
+
return PeaksActions.handleChangePeaksDisplayingMode(draft);
|
|
181
182
|
case 'ADD_INTEGRAL':
|
|
182
183
|
return IntegralsActions.handleAddIntegral(draft, action);
|
|
183
184
|
case 'DELETE_INTEGRAL':
|
|
@@ -191,6 +192,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
191
192
|
return IntegralsActions.handleChangeIntegralsSumFlag(draft);
|
|
192
193
|
case 'CHANGE_INTEGRAL_RELATIVE':
|
|
193
194
|
return IntegralsActions.handleChangeIntegralsRelativeValue(draft, action);
|
|
195
|
+
case 'CUT_INTEGRAL':
|
|
196
|
+
return IntegralsActions.handleCutIntegral(draft, action);
|
|
194
197
|
case 'SET_X_DOMAIN':
|
|
195
198
|
return DomainActions.handleSetXDomain(draft, action);
|
|
196
199
|
case 'SET_Y_DOMAIN':
|
|
@@ -211,6 +214,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
211
214
|
return FiltersActions.handleCalculateZeroFillingFilter(draft, action);
|
|
212
215
|
case 'APPLY_FFT_FILTER':
|
|
213
216
|
return FiltersActions.handleApplyFFTFilter(draft);
|
|
217
|
+
case 'APPLY_FFT_DIMENSION_1_FILTER':
|
|
218
|
+
return FiltersActions.handleApplyFFtDimension1Filter(draft);
|
|
219
|
+
case 'APPLY_FFT_DIMENSION_2_FILTER':
|
|
220
|
+
return FiltersActions.handleApplyFFtDimension2Filter(draft);
|
|
214
221
|
case 'APPLY_MANUAL_PHASE_CORRECTION_FILTER':
|
|
215
222
|
return FiltersActions.handleApplyManualPhaseCorrectionFilter(draft, action);
|
|
216
223
|
case 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER':
|
|
@@ -295,6 +302,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
295
302
|
return ToolsActions.levelChangeHandler(draft, action);
|
|
296
303
|
case 'ADD_MOLECULE':
|
|
297
304
|
return MoleculeActions.handleAddMolecule(draft, action);
|
|
305
|
+
case 'ADD_MOLECULES':
|
|
306
|
+
return MoleculeActions.handleAddMolecules(draft, action);
|
|
298
307
|
case 'SET_MOLECULE':
|
|
299
308
|
return MoleculeActions.handleSetMolecule(draft, action);
|
|
300
309
|
case 'CHANGE_MOLECULE_LABEL':
|
|
@@ -355,6 +364,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
355
364
|
return RangesActions.handleAutoSpectraRangesDetection(draft);
|
|
356
365
|
case 'SHOW_J_GRAPH':
|
|
357
366
|
return RangesActions.handleShowJGraph(draft, action);
|
|
367
|
+
case 'CUT_RANGE':
|
|
368
|
+
return RangesActions.handleCutRange(draft, action);
|
|
358
369
|
case 'SET_KEY_PREFERENCES':
|
|
359
370
|
return PreferencesActions.handleSetKeyPreferences(draft, action);
|
|
360
371
|
case 'APPLY_KEY_PREFERENCES':
|
|
@@ -397,15 +408,30 @@ function innerSpectrumReducer(draft, action) {
|
|
|
397
408
|
return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
|
|
398
409
|
case 'SET_AUTOMATIC_ASSIGNMENTS':
|
|
399
410
|
return AssignmentsActions.handleSetAutomaticAssignments(draft, action);
|
|
400
|
-
case 'SET_MOUSE_OVER_DISPLAYER':
|
|
401
|
-
return GlobalActions.handleSetIsOverDisplayer(draft, action);
|
|
402
411
|
default:
|
|
403
412
|
}
|
|
404
413
|
}
|
|
405
414
|
catch (error) {
|
|
406
415
|
draft.errorAction = error;
|
|
407
|
-
error.data = { action };
|
|
416
|
+
error.data = { action, state: getDebugState(draft) };
|
|
408
417
|
reportError(error);
|
|
409
418
|
}
|
|
410
419
|
}
|
|
411
420
|
exports.spectrumReducer = (0, immer_1.produce)(innerSpectrumReducer);
|
|
421
|
+
function getDebugState(draft) {
|
|
422
|
+
const state = (0, immer_1.original)(draft);
|
|
423
|
+
const string = JSON.stringify(state, (key, value) => {
|
|
424
|
+
if (ArrayBuffer.isView(value)) {
|
|
425
|
+
return Array.from(value).slice(0, 20);
|
|
426
|
+
}
|
|
427
|
+
if (Array.isArray(value) && typeof value[0] === 'number') {
|
|
428
|
+
return value.slice(0, 20);
|
|
429
|
+
}
|
|
430
|
+
return value;
|
|
431
|
+
});
|
|
432
|
+
if (string.length > 800000) {
|
|
433
|
+
// fallback, better to have something as a string t han nothing
|
|
434
|
+
return string.slice(0, 800000);
|
|
435
|
+
}
|
|
436
|
+
return JSON.parse(string);
|
|
437
|
+
}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.rollbackSpectrumByFilter = exports.rollbackSpectrum = exports.handleSignalProcessingFilter = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.handleSetFilterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.handleDeleteSpectraFilter = exports.handleDeleteFilter = exports.handleEnableFilter = exports.handleCalculateZeroFillingFilter = exports.handleCalculateApodizationFilter = exports.handleCalculateBaseLineCorrection = exports.calculateBaseLineCorrection = exports.handleCalculateManualPhaseCorrection = exports.handleApplyAbsoluteFilter = exports.handleApplyAutoPhaseCorrectionFilter = exports.handleApplyManualPhaseCorrectionFilter = exports.handleApplyFFTFilter = exports.handleApplyApodizationFilter = exports.handleApplyZeroFillingFilter = exports.handleShiftSpectrumAlongXAxis = void 0;
|
|
6
|
+
exports.rollbackSpectrumByFilter = exports.rollbackSpectrum = exports.handleSignalProcessingFilter = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.handleSetFilterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.handleDeleteSpectraFilter = exports.handleDeleteFilter = exports.handleEnableFilter = exports.handleCalculateZeroFillingFilter = exports.handleCalculateApodizationFilter = exports.handleCalculateBaseLineCorrection = exports.calculateBaseLineCorrection = exports.handleCalculateManualPhaseCorrection = exports.handleApplyAbsoluteFilter = exports.handleApplyAutoPhaseCorrectionFilter = exports.handleApplyManualPhaseCorrectionFilter = exports.handleApplyFFtDimension2Filter = exports.handleApplyFFtDimension1Filter = exports.handleApplyFFTFilter = exports.handleApplyApodizationFilter = exports.handleApplyZeroFillingFilter = exports.handleShiftSpectrumAlongXAxis = void 0;
|
|
7
7
|
const uuid_1 = require("@lukeed/uuid");
|
|
8
8
|
const immer_1 = require("immer");
|
|
9
9
|
const nmr_processing_1 = require("nmr-processing");
|
|
@@ -19,7 +19,7 @@ const getStrongestPeak_1 = require("../helper/getStrongestPeak");
|
|
|
19
19
|
const DomainActions_1 = require("./DomainActions");
|
|
20
20
|
const PreferencesActions_1 = require("./PreferencesActions");
|
|
21
21
|
const ToolsActions_1 = require("./ToolsActions");
|
|
22
|
-
const { fft, apodization, baselineCorrection, phaseCorrection, zeroFilling, shiftX, shift2DX, shift2DY, exclusionZones, signalProcessing, } = nmr_processing_1.Filters;
|
|
22
|
+
const { fft, fftDimension1, fftDimension2, apodization, baselineCorrection, phaseCorrection, zeroFilling, shiftX, shift2DX, shift2DY, exclusionZones, signalProcessing, } = nmr_processing_1.Filters;
|
|
23
23
|
function getFilterUpdateDomainRules(filterName) {
|
|
24
24
|
return (nmr_processing_1.Filters[filterName]?.DOMAIN_UPDATE_RULES || {
|
|
25
25
|
updateXDomain: false,
|
|
@@ -166,6 +166,25 @@ function updateView(draft, filterUpdateDomainRules) {
|
|
|
166
166
|
(0, DomainActions_1.setMode)(draft);
|
|
167
167
|
(0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { verticalAlign: 'auto-check' });
|
|
168
168
|
}
|
|
169
|
+
function disableLivePreview(draft, id) {
|
|
170
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
171
|
+
if (activeSpectrum) {
|
|
172
|
+
const index = activeSpectrum.index;
|
|
173
|
+
const { data } = draft.tempData[index];
|
|
174
|
+
draft.data[index].data = data;
|
|
175
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
176
|
+
// reset default options
|
|
177
|
+
switch (id) {
|
|
178
|
+
case apodization.name: {
|
|
179
|
+
draft.toolOptions.data.apodizationOptions = DefaultApodizationOptions_1.defaultApodizationOptions;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
default: {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
169
188
|
//action
|
|
170
189
|
function handleShiftSpectrumAlongXAxis(draft, action) {
|
|
171
190
|
//apply filter into the spectrum
|
|
@@ -199,7 +218,7 @@ function handleApplyZeroFillingFilter(draft, action) {
|
|
|
199
218
|
const filters = [
|
|
200
219
|
{
|
|
201
220
|
name: zeroFilling.id,
|
|
202
|
-
value: action.payload,
|
|
221
|
+
value: action.payload.options,
|
|
203
222
|
},
|
|
204
223
|
];
|
|
205
224
|
nmr_processing_1.FiltersManager.applyFilter(draft.data[index], filters, {
|
|
@@ -222,16 +241,22 @@ exports.handleApplyZeroFillingFilter = handleApplyZeroFillingFilter;
|
|
|
222
241
|
function handleCalculateZeroFillingFilter(draft, action) {
|
|
223
242
|
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
224
243
|
if (activeSpectrum) {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
244
|
+
const { options, livePreview } = action.payload;
|
|
245
|
+
if (livePreview) {
|
|
246
|
+
const index = activeSpectrum.index;
|
|
247
|
+
const { data: { x, re, im }, filters, info, } = draft.tempData[index];
|
|
248
|
+
const _data = { data: { x, re, im }, filters, info };
|
|
249
|
+
zeroFilling.apply(_data, options);
|
|
250
|
+
const { im: newIm, re: newRe, x: newX } = _data.data;
|
|
251
|
+
const datum = draft.data[index];
|
|
252
|
+
datum.data.x = newX;
|
|
253
|
+
datum.data.im = newIm;
|
|
254
|
+
datum.data.re = newRe;
|
|
255
|
+
draft.xDomain = [newX[0], newX.at(-1)];
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
disableLivePreview(draft, zeroFilling.name);
|
|
259
|
+
}
|
|
235
260
|
}
|
|
236
261
|
}
|
|
237
262
|
exports.handleCalculateZeroFillingFilter = handleCalculateZeroFillingFilter;
|
|
@@ -240,15 +265,20 @@ function handleCalculateApodizationFilter(draft, action) {
|
|
|
240
265
|
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
241
266
|
if (activeSpectrum) {
|
|
242
267
|
const index = activeSpectrum.index;
|
|
243
|
-
const options = action.payload;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
268
|
+
const { livePreview, options } = action.payload;
|
|
269
|
+
if (livePreview) {
|
|
270
|
+
const { data: { x, re, im }, info, } = draft.tempData[index];
|
|
271
|
+
const _data = { data: { x, re, im }, info };
|
|
272
|
+
draft.toolOptions.data.apodizationOptions = options;
|
|
273
|
+
apodization.apply(_data, options);
|
|
274
|
+
const { im: newIm, re: newRe } = _data.data;
|
|
275
|
+
const datum = draft.data[index];
|
|
276
|
+
datum.data.im = newIm;
|
|
277
|
+
datum.data.re = newRe;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
disableLivePreview(draft, apodization.name);
|
|
281
|
+
}
|
|
252
282
|
}
|
|
253
283
|
}
|
|
254
284
|
exports.handleCalculateApodizationFilter = handleCalculateApodizationFilter;
|
|
@@ -261,7 +291,7 @@ function handleApplyApodizationFilter(draft, action) {
|
|
|
261
291
|
nmr_processing_1.FiltersManager.applyFilter(draft.data[index], [
|
|
262
292
|
{
|
|
263
293
|
name: apodization.id,
|
|
264
|
-
value: action.payload,
|
|
294
|
+
value: action.payload.options,
|
|
265
295
|
},
|
|
266
296
|
], { filterIndex: activeFilterIndex });
|
|
267
297
|
if (activeFilterIndex !== -1) {
|
|
@@ -297,6 +327,44 @@ function handleApplyFFTFilter(draft) {
|
|
|
297
327
|
}
|
|
298
328
|
}
|
|
299
329
|
exports.handleApplyFFTFilter = handleApplyFFTFilter;
|
|
330
|
+
function handleApplyFFtDimension1Filter(draft) {
|
|
331
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
332
|
+
if (activeSpectrum) {
|
|
333
|
+
const { index } = activeSpectrum;
|
|
334
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
335
|
+
//apply filter into the spectrum
|
|
336
|
+
nmr_processing_1.FiltersManager.applyFilter(draft.data[index], [{ name: fftDimension1.id, value: {} }], { filterIndex: activeFilterIndex });
|
|
337
|
+
if (activeFilterIndex !== -1) {
|
|
338
|
+
rollbackSpectrumByFilter(draft, {
|
|
339
|
+
searchBy: 'name',
|
|
340
|
+
key: fftDimension1.id,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
updateView(draft, fftDimension1.DOMAIN_UPDATE_RULES);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
exports.handleApplyFFtDimension1Filter = handleApplyFFtDimension1Filter;
|
|
349
|
+
function handleApplyFFtDimension2Filter(draft) {
|
|
350
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
351
|
+
if (activeSpectrum) {
|
|
352
|
+
const { index } = activeSpectrum;
|
|
353
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
354
|
+
//apply filter into the spectrum
|
|
355
|
+
nmr_processing_1.FiltersManager.applyFilter(draft.data[index], [{ name: fftDimension2.id, value: {} }], { filterIndex: activeFilterIndex });
|
|
356
|
+
if (activeFilterIndex !== -1) {
|
|
357
|
+
rollbackSpectrumByFilter(draft, {
|
|
358
|
+
searchBy: 'name',
|
|
359
|
+
key: fftDimension2.id,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
updateView(draft, fftDimension2.DOMAIN_UPDATE_RULES);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
exports.handleApplyFFtDimension2Filter = handleApplyFFtDimension2Filter;
|
|
300
368
|
//action
|
|
301
369
|
function handleApplyManualPhaseCorrectionFilter(draft, action) {
|
|
302
370
|
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
@@ -395,7 +463,7 @@ function handleBaseLineCorrectionFilter(draft, action) {
|
|
|
395
463
|
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
396
464
|
if (activeSpectrum) {
|
|
397
465
|
const { zones } = draft.toolOptions.data.baselineCorrection;
|
|
398
|
-
const {
|
|
466
|
+
const { options } = action.payload;
|
|
399
467
|
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
400
468
|
nmr_processing_1.FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
|
|
401
469
|
{
|
|
@@ -427,21 +495,23 @@ function calculateBaseLineCorrection(draft, baseLineOptions) {
|
|
|
427
495
|
// save the baseline options temporary
|
|
428
496
|
draft.toolOptions.data.baselineCorrection = {
|
|
429
497
|
...draft.toolOptions.data.baselineCorrection,
|
|
430
|
-
...(baseLineOptions
|
|
498
|
+
...(baseLineOptions && baseLineOptions),
|
|
431
499
|
};
|
|
432
|
-
const { zones, options } = draft.toolOptions.data.baselineCorrection;
|
|
433
|
-
const { livePreview, ...filterOptions } = options;
|
|
500
|
+
const { zones, options, livePreview } = draft.toolOptions.data.baselineCorrection;
|
|
434
501
|
if (livePreview) {
|
|
435
502
|
const _data = { data: { x, re, im }, info };
|
|
436
503
|
baselineCorrection.apply(_data, {
|
|
437
504
|
zones,
|
|
438
|
-
...
|
|
505
|
+
...options,
|
|
439
506
|
});
|
|
440
507
|
const { im: newIm, re: newRe } = _data.data;
|
|
441
508
|
const datum = draft.data[index];
|
|
442
509
|
datum.data.im = newIm;
|
|
443
510
|
datum.data.re = newRe;
|
|
444
511
|
}
|
|
512
|
+
else {
|
|
513
|
+
disableLivePreview(draft, baselineCorrection.id);
|
|
514
|
+
}
|
|
445
515
|
}
|
|
446
516
|
}
|
|
447
517
|
exports.calculateBaseLineCorrection = calculateBaseLineCorrection;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handleChangeIntegralsSumFlag = exports.handleChangeIntegralsRelativeValue = exports.handleChangeIntegral = exports.handleDeleteIntegral = exports.handleAddIntegral = exports.handleChangeIntegralSum = void 0;
|
|
6
|
+
exports.handleChangeIntegralsSumFlag = exports.handleChangeIntegralsRelativeValue = exports.handleChangeIntegral = exports.handleDeleteIntegral = exports.handleAddIntegral = exports.handleChangeIntegralSum = exports.handleCutIntegral = void 0;
|
|
7
7
|
const uuid_1 = require("@lukeed/uuid");
|
|
8
8
|
const immer_1 = require("immer");
|
|
9
9
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
@@ -11,6 +11,7 @@ const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
|
11
11
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
12
12
|
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
13
13
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
14
|
+
const getSpectrum_1 = require("../helper/getSpectrum");
|
|
14
15
|
const DomainActions_1 = require("./DomainActions");
|
|
15
16
|
function handleChangeIntegralSum(draft, action) {
|
|
16
17
|
const { options } = action.payload;
|
|
@@ -24,31 +25,39 @@ function handleChangeIntegralSum(draft, action) {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
exports.handleChangeIntegralSum = handleChangeIntegralSum;
|
|
28
|
+
function initiateIntergalSumOptions(datum, options) {
|
|
29
|
+
const { molecules, nucleus } = options;
|
|
30
|
+
datum.integrals.options = (0, SumManager_1.initSumOptions)(datum.integrals.options, {
|
|
31
|
+
molecules,
|
|
32
|
+
nucleus,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function addIntegral(datum, options) {
|
|
36
|
+
const { from, to } = options;
|
|
37
|
+
const { x, re } = datum.data;
|
|
38
|
+
const shiftX = (0, Spectrum1D_1.getShiftX)(datum);
|
|
39
|
+
const integration = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
|
|
40
|
+
const integral = {
|
|
41
|
+
id: (0, uuid_1.v4)(),
|
|
42
|
+
originFrom: from - shiftX,
|
|
43
|
+
originTo: to - shiftX,
|
|
44
|
+
from,
|
|
45
|
+
to,
|
|
46
|
+
integral: integration,
|
|
47
|
+
absolute: integration,
|
|
48
|
+
kind: 'signal',
|
|
49
|
+
};
|
|
50
|
+
datum.integrals.values.push(integral);
|
|
51
|
+
}
|
|
27
52
|
function handleAddIntegral(draft, action) {
|
|
28
53
|
const { startX, endX } = action.payload;
|
|
29
54
|
const { data, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
30
55
|
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
31
|
-
const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
|
|
32
56
|
if (activeSpectrum?.id) {
|
|
57
|
+
const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
|
|
33
58
|
const datum = data[activeSpectrum.index];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const integration = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
|
|
37
|
-
const integral = {
|
|
38
|
-
id: (0, uuid_1.v4)(),
|
|
39
|
-
originFrom: from - shiftX,
|
|
40
|
-
originTo: to - shiftX,
|
|
41
|
-
from,
|
|
42
|
-
to,
|
|
43
|
-
integral: integration,
|
|
44
|
-
absolute: integration,
|
|
45
|
-
kind: 'signal',
|
|
46
|
-
};
|
|
47
|
-
datum.integrals.values.push(integral);
|
|
48
|
-
datum.integrals.options = (0, SumManager_1.initSumOptions)(datum.integrals.options, {
|
|
49
|
-
molecules,
|
|
50
|
-
nucleus,
|
|
51
|
-
});
|
|
59
|
+
addIntegral(datum, { from, to });
|
|
60
|
+
initiateIntergalSumOptions(datum, { molecules, nucleus });
|
|
52
61
|
(0, Spectrum1D_1.updateIntegralsRelativeValues)(datum);
|
|
53
62
|
(0, DomainActions_1.setIntegralsYDomain)(draft, datum);
|
|
54
63
|
}
|
|
@@ -112,3 +121,19 @@ function handleChangeIntegralsSumFlag(draft) {
|
|
|
112
121
|
}
|
|
113
122
|
}
|
|
114
123
|
exports.handleChangeIntegralsSumFlag = handleChangeIntegralsSumFlag;
|
|
124
|
+
function handleCutIntegral(draft, action) {
|
|
125
|
+
const { cutValue } = action.payload;
|
|
126
|
+
const spectrum = (0, getSpectrum_1.getSpectrum)(draft);
|
|
127
|
+
const integrals = spectrum.integrals.values;
|
|
128
|
+
for (let i = 0; i < integrals.length; i++) {
|
|
129
|
+
const { to, from } = integrals[i];
|
|
130
|
+
if (cutValue > from && cutValue < to) {
|
|
131
|
+
integrals.splice(i, 1);
|
|
132
|
+
addIntegral(spectrum, { from, to: cutValue });
|
|
133
|
+
addIntegral(spectrum, { from: cutValue, to });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
(0, Spectrum1D_1.updateIntegralsRelativeValues)(spectrum);
|
|
137
|
+
(0, DomainActions_1.setIntegralsYDomain)(draft, spectrum);
|
|
138
|
+
}
|
|
139
|
+
exports.handleCutIntegral = handleCutIntegral;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.handleChangeMoleculeLabel = exports.handleChangeFloatMoleculePosition = exports.handleToggleMoleculeAtomsNumbers = exports.handleFloatMoleculeOverSpectrum = exports.handlePredictSpectraFromMolecule = exports.handleDeleteMolecule = exports.handleSetMolecule = exports.handleAddMolecule = void 0;
|
|
29
|
+
exports.handleChangeMoleculeLabel = exports.handleChangeFloatMoleculePosition = exports.handleToggleMoleculeAtomsNumbers = exports.handleFloatMoleculeOverSpectrum = exports.handlePredictSpectraFromMolecule = exports.handleDeleteMolecule = exports.handleSetMolecule = exports.handleAddMolecules = exports.handleAddMolecule = void 0;
|
|
30
30
|
const full_1 = __importDefault(require("openchemlib/full"));
|
|
31
31
|
const openchemlib_utils_1 = require("openchemlib-utils");
|
|
32
32
|
const PredictionManager_1 = require("../../../data/PredictionManager");
|
|
@@ -61,6 +61,13 @@ function handleAddMolecule(draft, action) {
|
|
|
61
61
|
addMolecule(draft, action.payload);
|
|
62
62
|
}
|
|
63
63
|
exports.handleAddMolecule = handleAddMolecule;
|
|
64
|
+
function handleAddMolecules(draft, action) {
|
|
65
|
+
const molecules = action.payload.molecules;
|
|
66
|
+
for (const { molfile } of molecules) {
|
|
67
|
+
addMolecule(draft, { molfile });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.handleAddMolecules = handleAddMolecules;
|
|
64
71
|
function setMolecule(draft, props) {
|
|
65
72
|
const { id, label, molfile } = props;
|
|
66
73
|
MoleculeManager.setMolfile(draft.molecules, {
|
|
@@ -140,7 +147,7 @@ function checkPredictions(predictedSpectra, inputOptions, molfile, logger) {
|
|
|
140
147
|
const { spectra } = inputOptions;
|
|
141
148
|
const missing2DPrediction = [];
|
|
142
149
|
const molecule = full_1.default.Molecule.fromMolfile(molfile);
|
|
143
|
-
|
|
150
|
+
//@ts-expect-error Will be fixed once OCL-utils is typed correctly
|
|
144
151
|
const { atoms } = (0, openchemlib_utils_1.getAtoms)(molecule);
|
|
145
152
|
for (const [experiment, required] of Object.entries(spectra)) {
|
|
146
153
|
if (!required || predictedSpectra[experiment])
|