nmrium 0.57.1 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/integral/IntegralResizable.js +2 -2
- package/lib/component/1d/matrix/useMatrix.d.ts +1 -1
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +1 -1
- package/lib/component/1d/ranges/Atoms.js +6 -4
- package/lib/component/1d-2d/components/SpectrumInfoBlock.d.ts +1 -1
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +114 -7
- package/lib/component/2d/Viewer2D.js +6 -2
- package/lib/component/2d/zones/Zone.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +8 -8
- package/lib/component/context/ChartContext.js +12 -1
- package/lib/component/context/ShareDataContext.d.ts +1 -1
- package/lib/component/context/ShareDataContext.js +2 -4
- package/lib/component/context/ToasterContext.d.ts +1 -0
- package/lib/component/context/ToasterContext.js +12 -3
- package/lib/component/elements/ActionsButtonsPopover.d.ts +7 -1
- package/lib/component/elements/ActionsButtonsPopover.js +7 -6
- package/lib/component/elements/Alert.d.ts +20 -0
- package/lib/component/elements/Alert.js +80 -0
- package/lib/component/elements/ContextMenuBluePrint.d.ts +7 -2
- package/lib/component/elements/ContextMenuBluePrint.js +9 -3
- package/lib/component/elements/Input2.js +2 -2
- package/lib/component/elements/Input2Controller.d.ts +4 -2
- package/lib/component/elements/Input2Controller.js +22 -6
- package/lib/component/elements/MoleculeSelection.js +2 -2
- package/lib/component/elements/NextPrev.d.ts +4 -5
- package/lib/component/elements/NextPrev.js +76 -79
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +0 -3
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +1 -1
- package/lib/component/elements/Select2.d.ts +12 -7
- package/lib/component/elements/Select2.js +5 -4
- package/lib/component/elements/Select2Controller.d.ts +2 -2
- package/lib/component/elements/Select2Controller.js +5 -5
- package/lib/component/elements/ToolbarPopoverItem.d.ts +7 -6
- package/lib/component/elements/ToolbarPopoverItem.js +13 -5
- package/lib/component/elements/print/PrintContent.d.ts +17 -0
- package/lib/component/elements/print/PrintContent.js +281 -0
- package/lib/component/elements/print/PrintProvider.d.ts +12 -0
- package/lib/component/elements/print/PrintProvider.js +28 -0
- package/lib/component/elements/print/index.d.ts +2 -0
- package/lib/component/elements/print/index.js +2 -0
- package/lib/component/header/ApodizationOptionsPanel.js +14 -7
- package/lib/component/header/BaseLineCorrectionPanel.js +20 -10
- package/lib/component/header/ZeroFillingOptionsPanel.js +17 -10
- package/lib/component/hooks/useSaveSettings.js +43 -26
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +14 -9
- package/lib/component/hooks/useToggleSpectraVisibility.js +45 -16
- package/lib/component/hooks/useWorkspaceAction.js +12 -14
- package/lib/component/loader/DropZone.js +3 -67
- package/lib/component/loader/useLoadFiles.d.ts +1 -0
- package/lib/component/loader/useLoadFiles.js +78 -0
- package/lib/component/main/InnerNMRium.d.ts +4 -3
- package/lib/component/main/InnerNMRium.js +4 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +3 -2
- package/lib/component/main/InnerNMRiumContents.js +33 -29
- package/lib/component/main/NMRium.d.ts +2 -5
- package/lib/component/main/NMRium.js +1 -1
- package/lib/component/main/NMRiumRefAPI.d.ts +7 -0
- package/lib/component/main/NMRiumRefAPI.js +12 -0
- package/lib/component/main/NMRiumViewer.d.ts +10 -0
- package/lib/component/main/NMRiumViewer.js +35 -0
- package/lib/component/main/index.d.ts +1 -0
- package/lib/component/modal/CopyClipboardModal.d.ts +3 -2
- package/lib/component/modal/CopyClipboardModal.js +18 -32
- package/lib/component/modal/ExportAsJcampModal.d.ts +6 -3
- package/lib/component/modal/ExportAsJcampModal.js +69 -35
- package/lib/component/modal/ImportPublicationStringModal.js +1 -1
- package/lib/component/modal/LoadJCAMPModal.d.ts +3 -1
- package/lib/component/modal/LoadJCAMPModal.js +17 -18
- package/lib/component/modal/SaveAsModal.d.ts +3 -1
- package/lib/component/modal/SaveAsModal.js +20 -30
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +35 -47
- package/lib/component/modal/changeSum/SelectMolecule.d.ts +2 -5
- package/lib/component/modal/changeSum/SelectMolecule.js +9 -8
- package/lib/component/modal/setting/GeneralSettings.js +4 -2
- package/lib/component/modal/setting/settings-tabs/ExternalAPIsTabContent.d.ts +1 -0
- package/lib/component/modal/setting/settings-tabs/ExternalAPIsTabContent.js +89 -0
- package/lib/component/modal/setting/settingsValidation.js +15 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +8 -5
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +5 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +5 -3
- package/lib/component/panels/Panels.js +15 -15
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +8 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +52 -12
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +13 -6
- package/lib/component/panels/SpectraPanel/SpectraTable.js +63 -21
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +6 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +6 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -0
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +16 -8
- package/lib/component/panels/databasePanel/DatabasePanel.js +7 -8
- package/lib/component/panels/filtersPanel/FilterPanel.js +9 -6
- package/lib/component/panels/filtersPanel/FiltersTable.js +12 -10
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +1 -0
- package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +10 -12
- package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.js +2 -4
- package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -13
- package/lib/component/reducer/actions/DatabaseActions.js +52 -34
- package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
- package/lib/component/reducer/actions/FiltersActions.js +9 -4
- package/lib/component/reducer/actions/SpectraActions.d.ts +2 -1
- package/lib/component/reducer/actions/SpectraActions.js +53 -43
- package/lib/component/reducer/helper/removeSpectrumRelatedObjectsById.d.ts +3 -0
- package/lib/component/reducer/helper/removeSpectrumRelatedObjectsById.js +16 -0
- package/lib/component/reducer/preferences/actions/changeInformationBlockPosition.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/changeInformationBlockPosition.js +5 -0
- package/lib/component/reducer/preferences/actions/changePrintPageSettings.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/changePrintPageSettings.js +6 -0
- package/lib/component/reducer/preferences/actions/toggleInformationBlock.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/toggleInformationBlock.js +7 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +12 -2
- package/lib/component/reducer/preferences/preferencesReducer.js +9 -0
- package/lib/component/toolbar/ToolBar.js +33 -14
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/SpectraManager.d.ts +7 -10
- package/lib/data/SpectraManager.js +51 -30
- package/lib/data/data1d/Spectrum1D/SumManager.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/SumManager.js +2 -10
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/index.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/index.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js +65 -0
- package/lib/data/molecules/MoleculeManager.js +16 -38
- package/lib/data/utilities/getCustomColor.d.ts +1 -1
- package/lib/data/utilities/removeByPaths.d.ts +3 -0
- package/lib/data/utilities/removeByPaths.js +33 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +36 -36
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +0 -11
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +0 -29
|
@@ -10,10 +10,11 @@ type ChangeSpectrumVisibilityByIdAction = ActionType<'CHANGE_SPECTRUM_VISIBILITY
|
|
|
10
10
|
id: string;
|
|
11
11
|
key: 'isVisible' | 'isPositiveVisible' | 'isNegativeVisible';
|
|
12
12
|
}>;
|
|
13
|
+
export type SpectraSelectedMode = 'selected' | 'all' | 'selectedOnly';
|
|
13
14
|
type ChangeSpectraVisibilityByNucleusAction = ActionType<'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS', {
|
|
14
15
|
nucleus: Nucleus;
|
|
15
16
|
flag: boolean;
|
|
16
|
-
mode?:
|
|
17
|
+
mode?: SpectraSelectedMode;
|
|
17
18
|
}>;
|
|
18
19
|
type ChangeActiveSpectrumAction = ActionType<'CHANGE_ACTIVE_SPECTRUM', {
|
|
19
20
|
modifier?: 'shift[false]_ctrl[true]' | 'shift[true]_ctrl[false]' | 'shift[true]_ctrl[true]' | (string & {});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { original } from 'immer';
|
|
2
2
|
import lodashGet from 'lodash/get';
|
|
3
|
-
import omitBy from 'lodash/omitBy';
|
|
4
|
-
import lodashSet from 'lodash/set';
|
|
5
3
|
import { Filters, FiltersManager } from 'nmr-processing';
|
|
6
|
-
import { getReferenceShift, isSpectrum1D, get1DColor, initiateDatum1D,
|
|
4
|
+
import { getReferenceShift, isSpectrum1D, get1DColor, initiateDatum1D, resurrectSpectrumFromRanges, } from '../../../data/data1d/Spectrum1D';
|
|
7
5
|
import { simulateSpectrum, } from '../../../data/data1d/spectrumSimulation';
|
|
8
6
|
import { getMissingProjection, isSpectrum2D, get2DColor, } from '../../../data/data2d/Spectrum2D';
|
|
9
7
|
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
@@ -12,8 +10,9 @@ import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
|
12
10
|
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
13
11
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
14
12
|
import { getActiveSpectra } from '../helper/getActiveSpectra';
|
|
15
|
-
import { getActiveSpectraAsObject
|
|
13
|
+
import { getActiveSpectraAsObject } from '../helper/getActiveSpectraAsObject';
|
|
16
14
|
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
15
|
+
import { removeSpectrumRelatedObjectsById } from '../helper/removeSpectrumRelatedObjectsById';
|
|
17
16
|
import { setDomain, setMode } from './DomainActions';
|
|
18
17
|
import { rollbackSpectrumByFilter } from './FiltersActions';
|
|
19
18
|
import { setTab, setActiveTab, setMargin, resetSelectedTool, } from './ToolsActions';
|
|
@@ -52,23 +51,6 @@ function multipleSelect(spectraIds, options) {
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
function removeActiveSpectra(draft, relatedTargets) {
|
|
56
|
-
const activeSpectra = getActiveSpectraAsObject(draft);
|
|
57
|
-
// remove the active spectra
|
|
58
|
-
relatedTargets.unshift({ jpath: 'data', key: 'id' });
|
|
59
|
-
for (const target of relatedTargets) {
|
|
60
|
-
const { jpath } = target;
|
|
61
|
-
const targetObj = lodashGet(draft, jpath);
|
|
62
|
-
if (Array.isArray(targetObj)) {
|
|
63
|
-
const data = targetObj.filter((datum) => !isActiveSpectrum(activeSpectra, datum[target.key]));
|
|
64
|
-
lodashSet(draft, jpath, data);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const data = omitBy(draft.view.peaks, (_, id) => isActiveSpectrum(activeSpectra, id));
|
|
68
|
-
lodashSet(draft, jpath, data);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
54
|
function setSpectraMetaInfo(draft, spectraMetaInfo) {
|
|
73
55
|
const { data } = draft;
|
|
74
56
|
for (const spectrum of data) {
|
|
@@ -97,13 +79,22 @@ function handleChangeSpectraVisibilityByNucleus(draft, action) {
|
|
|
97
79
|
const { nucleus, flag, mode = 'all' } = action.payload;
|
|
98
80
|
const activeSpectra = getActiveSpectraAsObject(draft);
|
|
99
81
|
for (const datum of getSpectraByNucleus(nucleus, draft.data)) {
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
switch (mode) {
|
|
83
|
+
case 'selected':
|
|
84
|
+
if (activeSpectra && datum.id in activeSpectra) {
|
|
85
|
+
setVisible(datum, flag);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'selectedOnly':
|
|
89
|
+
if (activeSpectra && datum.id in activeSpectra) {
|
|
90
|
+
setVisible(datum, flag);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
setVisible(datum, !flag);
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
102
97
|
setVisible(datum, flag);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
setVisible(datum, flag);
|
|
107
98
|
}
|
|
108
99
|
}
|
|
109
100
|
}
|
|
@@ -240,23 +231,39 @@ function handleChangeSpectrumSetting(draft, action) {
|
|
|
240
231
|
}
|
|
241
232
|
//action
|
|
242
233
|
function handleDeleteSpectra(draft, action) {
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
draft.data.
|
|
248
|
-
|
|
249
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
250
|
-
delete draft.view.peaks[spectraId];
|
|
234
|
+
const { id: spectrumID, domainOptions } = action?.payload || {};
|
|
235
|
+
const activeSpectra = getActiveSpectra(draft);
|
|
236
|
+
let spectraIDs = [];
|
|
237
|
+
if (spectrumID) {
|
|
238
|
+
const index = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
|
|
239
|
+
spectraIDs = [{ id: spectrumID, index }];
|
|
251
240
|
}
|
|
252
241
|
else {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
242
|
+
spectraIDs = activeSpectra || [];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Sort the spectraIDs indices in descending order.
|
|
246
|
+
* This prevents shifting issues when removing elements, ensuring that each deletion doesn't changing the positions of remaining elements to be removed.
|
|
247
|
+
*/
|
|
248
|
+
spectraIDs.sort((a, b) => b.index - a.index);
|
|
249
|
+
for (const { index, id } of spectraIDs) {
|
|
250
|
+
draft.data.splice(index, 1);
|
|
251
|
+
removeSpectrumRelatedObjectsById(draft, id);
|
|
252
|
+
}
|
|
253
|
+
//TODO refactor the view state, https://github.com/cheminfo/nmrium/issues/3169
|
|
254
|
+
//update keys preferences
|
|
255
|
+
const spectraRemovedIDs = {};
|
|
256
|
+
for (const { id } of spectraIDs) {
|
|
257
|
+
spectraRemovedIDs[id] = true;
|
|
258
|
+
}
|
|
259
|
+
for (const key of Object.keys(draft.keysPreferences)) {
|
|
260
|
+
const preferencesState = draft.keysPreferences[key];
|
|
261
|
+
// remove related object from save preferences for deleted spectra
|
|
262
|
+
for (const { id } of preferencesState.data) {
|
|
263
|
+
if (spectraRemovedIDs[id]) {
|
|
264
|
+
removeSpectrumRelatedObjectsById(preferencesState, id);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
260
267
|
}
|
|
261
268
|
setActiveTab(draft, {
|
|
262
269
|
tab: draft.view.spectra.activeTab,
|
|
@@ -307,7 +314,10 @@ function handleAlignSpectraHandler(draft, action) {
|
|
|
307
314
|
//action
|
|
308
315
|
function handleGenerateSpectrumFromPublicationStringHandler(draft, action) {
|
|
309
316
|
const { ranges, info } = action.payload;
|
|
310
|
-
const spectrum =
|
|
317
|
+
const spectrum = resurrectSpectrumFromRanges(ranges, {
|
|
318
|
+
info,
|
|
319
|
+
usedColors: draft.usedColors,
|
|
320
|
+
});
|
|
311
321
|
if (spectrum) {
|
|
312
322
|
draft.data.push(spectrum);
|
|
313
323
|
setActiveTab(draft);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { removeByPaths } from '../../../data/utilities/removeByPaths';
|
|
2
|
+
export function removeSpectrumRelatedObjectsById(data, spectrumKey) {
|
|
3
|
+
const nucleus = data.view?.spectra.activeTab;
|
|
4
|
+
removeByPaths(data, [
|
|
5
|
+
['view.ranges', null],
|
|
6
|
+
['view.zones', null],
|
|
7
|
+
['view.peaks', null],
|
|
8
|
+
['view.integrals', null],
|
|
9
|
+
['view.zoom.levels', null],
|
|
10
|
+
[`view.spectra.activeSpectra.${nucleus}`, 'id'],
|
|
11
|
+
['xDomains', null],
|
|
12
|
+
['yDomains', null],
|
|
13
|
+
['originDomain.xDomains', null],
|
|
14
|
+
['originDomain.yDomains', null],
|
|
15
|
+
], spectrumKey);
|
|
16
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
|
|
2
|
+
export function changeInformationBlockPosition(draft, action) {
|
|
3
|
+
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
4
|
+
currentWorkspacePreferences.infoBlock.position = action.payload.coordination;
|
|
5
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
|
|
2
|
+
export function changePrintPageSettings(draft, action) {
|
|
3
|
+
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
4
|
+
const pageSettings = action.payload || {};
|
|
5
|
+
currentWorkspacePreferences.printPageOptions = pageSettings;
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
|
|
2
|
+
export function toggleInformationBlock(draft, action) {
|
|
3
|
+
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
4
|
+
const { visible } = action.payload || {};
|
|
5
|
+
currentWorkspacePreferences.infoBlock.visible =
|
|
6
|
+
visible ?? !currentWorkspacePreferences.infoBlock.visible;
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MultipleSpectraAnalysisPreferences, Workspace, WorkSpaceSource } from 'nmr-load-save';
|
|
1
|
+
import { MultipleSpectraAnalysisPreferences, PrintPageOptions, Workspace, WorkSpaceSource } from 'nmr-load-save';
|
|
2
2
|
import { Reducer } from 'react';
|
|
3
3
|
import { SplitPaneSize } from 'react-science/ui';
|
|
4
4
|
import type { NMRiumWorkspace, NMRiumPreferences } from '../../main';
|
|
@@ -63,7 +63,17 @@ export type SetSpectraAnalysisPanelPreferencesAction = ActionType<'SET_SPECTRA_A
|
|
|
63
63
|
export type SetVerticalSplitterPositionAction = ActionType<'SET_VERTICAL_SPLITTER_POSITION', {
|
|
64
64
|
value: SplitPaneSize;
|
|
65
65
|
}>;
|
|
66
|
-
type
|
|
66
|
+
export type ChangeInformationBlockPosition = ActionType<'CHANGE_INFORMATION_BLOCK_POSITION', {
|
|
67
|
+
coordination: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
export type ToggleInformationBlock = ActionType<'TOGGLE_INFORMATION_BLOCK', {
|
|
73
|
+
visible?: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
export type ChangePrintPageSettingsAction = ActionType<'CHANGE_PRINT_PAGE_SETTINGS', PrintPageOptions>;
|
|
76
|
+
type PreferencesActions = InitPreferencesAction | SetPreferencesAction | SetPanelsPreferencesAction | SetWorkspaceAction | WorkspaceAction | AddWorkspaceAction | ApplyGeneralPreferences | AnalyzeSpectraAction | ChangeAnalysisColumnValueKeyAction | DeleteAnalysisColumn | SetSpectraAnalysisPanelPreferencesAction | MatrixGenerationActions | SetVerticalSplitterPositionAction | ChangeInformationBlockPosition | ToggleInformationBlock | ChangePrintPageSettingsAction;
|
|
67
77
|
export declare const WORKSPACES: Array<{
|
|
68
78
|
key: NMRiumWorkspace;
|
|
69
79
|
label: string;
|
|
@@ -5,6 +5,8 @@ import Workspaces from '../../workspaces';
|
|
|
5
5
|
import { addWorkspace } from './actions/addWorkspace';
|
|
6
6
|
import { analyzeSpectra, changeAnalysisColumnValueKey, deleteAnalysisColumn, setSpectraAnalysisPanelsPreferences, } from './actions/analyzeSpectra';
|
|
7
7
|
import { applyGeneralPreferences } from './actions/applyGeneralPreferences';
|
|
8
|
+
import { changeInformationBlockPosition } from './actions/changeInformationBlockPosition';
|
|
9
|
+
import { changePrintPageSettings } from './actions/changePrintPageSettings';
|
|
8
10
|
import { initPreferences } from './actions/initPreferences';
|
|
9
11
|
import { setMatrixGenerationOptions, addExclusionZone, deleteExclusionZone, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, } from './actions/matrixGeneration';
|
|
10
12
|
import { removeWorkspace } from './actions/removeWorkspace';
|
|
@@ -13,6 +15,7 @@ import { setPanelsPreferences } from './actions/setPanelsPreferences';
|
|
|
13
15
|
import { setPreferences } from './actions/setPreferences';
|
|
14
16
|
import { setVerticalSplitterPosition } from './actions/setVerticalSplitterPosition';
|
|
15
17
|
import { setWorkspace } from './actions/setWorkspace';
|
|
18
|
+
import { toggleInformationBlock } from './actions/toggleInformationBlock';
|
|
16
19
|
import { mapWorkspaces } from './utilities/mapWorkspaces';
|
|
17
20
|
const LOCAL_STORAGE_SETTINGS_KEY = 'nmr-general-settings';
|
|
18
21
|
export const WORKSPACES_KEYS = {
|
|
@@ -133,6 +136,12 @@ function innerPreferencesReducer(draft, action) {
|
|
|
133
136
|
return changeMatrixGenerationScale(draft, action);
|
|
134
137
|
case 'CHANGE_MATRIX_GENERATION_STOCSY_CHEMICAL_SHIFT':
|
|
135
138
|
return changeMatrixGenerationStocsyChemicalShift(draft, action);
|
|
139
|
+
case 'CHANGE_INFORMATION_BLOCK_POSITION':
|
|
140
|
+
return changeInformationBlockPosition(draft, action);
|
|
141
|
+
case 'TOGGLE_INFORMATION_BLOCK':
|
|
142
|
+
return toggleInformationBlock(draft, action);
|
|
143
|
+
case 'CHANGE_PRINT_PAGE_SETTINGS':
|
|
144
|
+
return changePrintPageSettings(draft, action);
|
|
136
145
|
default:
|
|
137
146
|
return draft;
|
|
138
147
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SvgNmrAlignBottom, SvgNmrAlignCenter, SvgNmrApodization, SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrRealImag, SvgNmrZeroFilling, } from 'cheminfo-font';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, } from 'react-icons/fa';
|
|
4
|
+
import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, FaDownload, } from 'react-icons/fa';
|
|
5
5
|
import { PiKnifeBold } from 'react-icons/pi';
|
|
6
6
|
import { Toolbar, TooltipHelpContent, } from 'react-science/ui';
|
|
7
7
|
import { useChartData } from '../context/ChartContext';
|
|
@@ -9,6 +9,7 @@ import { useDispatch } from '../context/DispatchContext';
|
|
|
9
9
|
import { useLoader } from '../context/LoaderContext';
|
|
10
10
|
import { usePreferences } from '../context/PreferencesContext';
|
|
11
11
|
import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
|
|
12
|
+
import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
|
|
12
13
|
import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
|
|
13
14
|
import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
|
|
14
15
|
import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
|
|
@@ -16,6 +17,7 @@ import { useDialogToggle } from '../hooks/useDialogToggle';
|
|
|
16
17
|
import useExport from '../hooks/useExport';
|
|
17
18
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
18
19
|
import { useVerticalAlign } from '../hooks/useVerticalAlign';
|
|
20
|
+
import ExportAsJcampModal from '../modal/ExportAsJcampModal';
|
|
19
21
|
import { ImportPublicationStringModal } from '../modal/ImportPublicationStringModal';
|
|
20
22
|
import { LoadJCAMPModal } from '../modal/LoadJCAMPModal';
|
|
21
23
|
import SaveAsModal from '../modal/SaveAsModal';
|
|
@@ -25,6 +27,21 @@ import { EXPORT_MENU, IMPORT_MENU } from './toolbarMenu';
|
|
|
25
27
|
function isPopoverToolItem(item) {
|
|
26
28
|
return !!item?.menuItems;
|
|
27
29
|
}
|
|
30
|
+
function useExportList() {
|
|
31
|
+
const isExperimentalFeature = useCheckExperimentalFeature();
|
|
32
|
+
const spectrum = useActiveSpectrum();
|
|
33
|
+
const exportMenu = isExperimentalFeature
|
|
34
|
+
? EXPORT_MENU
|
|
35
|
+
: EXPORT_MENU.filter((item) => item.id !== 'nmre');
|
|
36
|
+
if (spectrum) {
|
|
37
|
+
exportMenu.push({
|
|
38
|
+
icon: _jsx(FaDownload, {}),
|
|
39
|
+
text: 'Export as JCAMP-DX',
|
|
40
|
+
data: { id: 'exportAsJcamp' },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return exportMenu;
|
|
44
|
+
}
|
|
28
45
|
export default function ToolBar() {
|
|
29
46
|
const { toolOptions: { selectedTool }, } = useChartData();
|
|
30
47
|
const isButtonVisible = useCheckToolsVisibility();
|
|
@@ -40,15 +57,14 @@ export default function ToolBar() {
|
|
|
40
57
|
importPublicationString: false,
|
|
41
58
|
metaImportation: false,
|
|
42
59
|
saveAs: false,
|
|
60
|
+
exportAsJcamp: false,
|
|
43
61
|
});
|
|
44
62
|
const verticalAlign = useVerticalAlign();
|
|
45
63
|
const { fidCounter, ftCounter } = useDatumWithSpectraStatistics();
|
|
46
64
|
const importMenu = isExperimentalFeature
|
|
47
65
|
? IMPORT_MENU
|
|
48
66
|
: IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
|
|
49
|
-
const exportMenu =
|
|
50
|
-
? EXPORT_MENU
|
|
51
|
-
: EXPORT_MENU.filter((item) => item.id !== 'nmre');
|
|
67
|
+
const exportMenu = useExportList();
|
|
52
68
|
const { current: { general: { invert }, }, } = usePreferences();
|
|
53
69
|
const handleOnFFTFilter = useCallback(() => {
|
|
54
70
|
dispatch({
|
|
@@ -100,6 +116,9 @@ export default function ToolBar() {
|
|
|
100
116
|
case 'copy':
|
|
101
117
|
void saveToClipboardHandler();
|
|
102
118
|
break;
|
|
119
|
+
case 'exportAsJcamp':
|
|
120
|
+
openDialog('exportAsJcamp');
|
|
121
|
+
break;
|
|
103
122
|
default:
|
|
104
123
|
break;
|
|
105
124
|
}
|
|
@@ -137,7 +156,7 @@ export default function ToolBar() {
|
|
|
137
156
|
title: options.peakPicking.label,
|
|
138
157
|
shortcuts: ['p'],
|
|
139
158
|
description: 'Detect peaks manually or automatically in the spectrum.',
|
|
140
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/peaks
|
|
159
|
+
link: 'https://docs.nmrium.org/20_1d-spectra/peaks',
|
|
141
160
|
},
|
|
142
161
|
icon: _jsx(SvgNmrPeakPicking, {}),
|
|
143
162
|
},
|
|
@@ -157,7 +176,7 @@ export default function ToolBar() {
|
|
|
157
176
|
title: options.zonePicking.label,
|
|
158
177
|
shortcuts: ['r'],
|
|
159
178
|
description: `Draw 2D zones by clicking, dragging, and releasing${!invert ? 'while holding SHIFT' : ''}. Alternatively, detect zones automatically.`,
|
|
160
|
-
link: 'https://docs.nmrium.org/30_2d-spectra/zones
|
|
179
|
+
link: 'https://docs.nmrium.org/30_2d-spectra/zones',
|
|
161
180
|
},
|
|
162
181
|
icon: _jsx(FaDiceFour, {}),
|
|
163
182
|
},
|
|
@@ -166,7 +185,7 @@ export default function ToolBar() {
|
|
|
166
185
|
tooltip: {
|
|
167
186
|
title: options.slicing.label,
|
|
168
187
|
description: 'Display the horizontal and vertical slices of the selected 2D spectrum at the level of the pointer.',
|
|
169
|
-
link: 'https://docs.nmrium.org/30_2d-spectra/slicing
|
|
188
|
+
link: 'https://docs.nmrium.org/30_2d-spectra/slicing',
|
|
170
189
|
},
|
|
171
190
|
icon: _jsx(PiKnifeBold, {}),
|
|
172
191
|
},
|
|
@@ -176,7 +195,7 @@ export default function ToolBar() {
|
|
|
176
195
|
title: options.rangePicking.label,
|
|
177
196
|
shortcuts: ['r'],
|
|
178
197
|
description: `Define ranges and analyse multiplet automatically or manually. Click, drag, and release ${!invert ? 'while holding SHIFT' : ''} to draw the range. Ranges can be resized by moving the edges.`,
|
|
179
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/ranges
|
|
198
|
+
link: 'https://docs.nmrium.org/20_1d-spectra/ranges',
|
|
180
199
|
},
|
|
181
200
|
icon: _jsx(SvgNmrRangePicking, {}),
|
|
182
201
|
},
|
|
@@ -202,7 +221,7 @@ export default function ToolBar() {
|
|
|
202
221
|
title: options.zeroFilling.label,
|
|
203
222
|
shortcuts: ['z'],
|
|
204
223
|
description: 'Improve spectrum quality by increasing the number of points. By default, the number of points is twice as many as in the original FID.',
|
|
205
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/preprocessing
|
|
224
|
+
link: 'https://docs.nmrium.org/20_1d-spectra/preprocessing#zero-filling',
|
|
206
225
|
},
|
|
207
226
|
icon: _jsx(SvgNmrZeroFilling, {}),
|
|
208
227
|
},
|
|
@@ -212,7 +231,7 @@ export default function ToolBar() {
|
|
|
212
231
|
title: options.phaseCorrection.label,
|
|
213
232
|
shortcuts: ['a'],
|
|
214
233
|
description: `Correct the spectrum phase manually or automatically. For manual phase correction, define the pivot${!invert ? ' using SHIFT +' : ''} click, then press the PH0 and PH1 button, and move the mouse horizontally.`,
|
|
215
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/phase
|
|
234
|
+
link: 'https://docs.nmrium.org/20_1d-spectra/phase',
|
|
216
235
|
},
|
|
217
236
|
icon: _jsx(SvgNmrPhaseCorrection, {}),
|
|
218
237
|
},
|
|
@@ -231,7 +250,7 @@ export default function ToolBar() {
|
|
|
231
250
|
title: options.baselineCorrection.label,
|
|
232
251
|
shortcuts: ['b'],
|
|
233
252
|
description: `Correct the baseline of the spectrum. You should draw zones corresponding to the noise using click, drag, release${!invert ? 'while holding SHIFT' : ''}.`,
|
|
234
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/baseline
|
|
253
|
+
link: 'https://docs.nmrium.org/20_1d-spectra/baseline',
|
|
235
254
|
},
|
|
236
255
|
icon: _jsx(SvgNmrBaselineCorrection, {}),
|
|
237
256
|
},
|
|
@@ -252,7 +271,7 @@ export default function ToolBar() {
|
|
|
252
271
|
title: options.fft.label,
|
|
253
272
|
shortcuts: ['t'],
|
|
254
273
|
description: 'Perform a Fourier transform on the FID.',
|
|
255
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/ft
|
|
274
|
+
link: 'https://docs.nmrium.org/20_1d-spectra/ft',
|
|
256
275
|
},
|
|
257
276
|
onClick: handleOnFFTFilter,
|
|
258
277
|
icon: _jsx(SvgNmrFourierTransform, {}),
|
|
@@ -299,7 +318,7 @@ export default function ToolBar() {
|
|
|
299
318
|
tooltip: {
|
|
300
319
|
title: `Display ${isRealSpectrumShown ? 'real' : 'imaginary'}`,
|
|
301
320
|
description: 'Toggle between the imaginary and real parts of the spectrum.',
|
|
302
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/views
|
|
321
|
+
link: 'https://docs.nmrium.org/20_1d-spectra/views',
|
|
303
322
|
},
|
|
304
323
|
icon: _jsx(SvgNmrRealImag, {}),
|
|
305
324
|
onClick: changeSpectrumViewHandler,
|
|
@@ -316,7 +335,7 @@ export default function ToolBar() {
|
|
|
316
335
|
onClick: alignSpectraVerticallyHandler,
|
|
317
336
|
},
|
|
318
337
|
];
|
|
319
|
-
return (_jsxs(_Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: dialog.loadJCAMP, onCloseDialog: closeDialog }), _jsx(ImportPublicationStringModal, { isOpen: dialog.importPublicationString, onClose: closeDialog }), _jsx(MetaImportationModal, { isOpen: dialog.metaImportation, onCloseDialog: closeDialog }), _jsx(SaveAsModal, { isOpen: dialog.saveAs, onCloseDialog: closeDialog }), _jsx(Toolbar, { vertical: true, children: toolItems.map((item) => {
|
|
338
|
+
return (_jsxs(_Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: dialog.loadJCAMP, onCloseDialog: closeDialog }), _jsx(ImportPublicationStringModal, { isOpen: dialog.importPublicationString, onClose: closeDialog }), _jsx(MetaImportationModal, { isOpen: dialog.metaImportation, onCloseDialog: closeDialog }), dialog.exportAsJcamp && (_jsx(ExportAsJcampModal, { exportActiveSpectrum: true, closeDialog: closeDialog })), _jsx(SaveAsModal, { isOpen: dialog.saveAs, onCloseDialog: closeDialog }), _jsx(Toolbar, { vertical: true, children: toolItems.map((item) => {
|
|
320
339
|
const { id, icon, tooltip, checkOptions, condition } = item;
|
|
321
340
|
const show = isButtonVisible(id, checkOptions) &&
|
|
322
341
|
(condition === undefined || condition);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Spectrum, Workspace } from 'nmr-load-save';
|
|
1
|
+
import { Spectrum, Workspace, StateMolecule } from 'nmr-load-save';
|
|
2
2
|
import { State } from '../component/reducer/Reducer';
|
|
3
3
|
export declare enum DataExportOptions {
|
|
4
4
|
ROW_DATA = "ROW_DATA",
|
|
@@ -22,14 +22,11 @@ export declare function addJcamp(output: any, jcamp: any, options: any, usedColo
|
|
|
22
22
|
export declare function toJSON(state: Partial<State>, preferencesState: Partial<{
|
|
23
23
|
current: Workspace;
|
|
24
24
|
}>, options?: ExportOptions): any;
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export interface ExportAsJcampOptions {
|
|
31
|
-
onlyReal?: boolean;
|
|
32
|
-
dataExportStage?: DataExportStageStrings;
|
|
25
|
+
export type DataExportStage = 'originalFid' | 'originalFtReal' | 'originalFtRealImaginary' | 'processedReal' | 'processedRealImaginary';
|
|
26
|
+
export declare function exportAsJcamp(spectrum: Spectrum, dataExportStage: DataExportStage): void;
|
|
27
|
+
interface ExportForCTOptions {
|
|
28
|
+
spectrum: Spectrum;
|
|
29
|
+
molecules: StateMolecule[];
|
|
33
30
|
}
|
|
34
|
-
export declare function
|
|
31
|
+
export declare function exportForCT(options: ExportForCTOptions): Promise<void>;
|
|
35
32
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { saveAs } from 'file-saver';
|
|
2
|
+
import JSZip from 'jszip';
|
|
2
3
|
import { processJcamp, serializeNmriumState, CURRENT_EXPORT_VERSION, spectrum1DToJcamp, } from 'nmr-load-save';
|
|
4
|
+
import OCL from 'openchemlib/full';
|
|
3
5
|
import { isSpectrum1D, initiateDatum1D } from './data1d/Spectrum1D';
|
|
4
6
|
import { initiateDatum2D } from './data2d/Spectrum2D';
|
|
5
7
|
import * as Molecule from './molecules/Molecule';
|
|
@@ -75,44 +77,63 @@ export function toJSON(state, preferencesState, options = {}) {
|
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
export
|
|
79
|
-
Original: 'ORIGINAL',
|
|
80
|
-
Processed: 'PROCESSED',
|
|
81
|
-
};
|
|
82
|
-
export function exportAsJcamp(spectrum, options = {}) {
|
|
80
|
+
export function exportAsJcamp(spectrum, dataExportStage) {
|
|
83
81
|
let jcamp = null;
|
|
84
|
-
if (isSpectrum1D(spectrum)) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
if (!isSpectrum1D(spectrum)) {
|
|
83
|
+
throw new Error('convert 2D spectrum to JCAMP is not supported');
|
|
84
|
+
}
|
|
85
|
+
const { originalData, originalInfo, ...otherSpectrum } = spectrum;
|
|
86
|
+
const exportedSpectrum = { ...otherSpectrum };
|
|
87
|
+
if (!['processedReal', 'processedRealImaginary'].includes(dataExportStage)) {
|
|
90
88
|
if (!originalData || !originalInfo) {
|
|
91
89
|
throw new Error('original data should exists');
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
data,
|
|
97
|
-
info,
|
|
98
|
-
filters,
|
|
99
|
-
}, { onlyReal });
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
jcamp = spectrum1DToJcamp({
|
|
103
|
-
...spectrum,
|
|
104
|
-
data: originalData,
|
|
105
|
-
info: originalInfo,
|
|
106
|
-
filters: [],
|
|
107
|
-
}, { onlyReal });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
throw new Error('convert 2D spectrum to JCAMP is not supported');
|
|
91
|
+
exportedSpectrum.filters = [];
|
|
92
|
+
exportedSpectrum.data = originalData;
|
|
93
|
+
exportedSpectrum.info = originalInfo;
|
|
112
94
|
}
|
|
95
|
+
const onlyReal = dataExportStage === 'processedReal' || dataExportStage === 'originalFtReal';
|
|
96
|
+
jcamp = spectrum1DToJcamp(exportedSpectrum, {
|
|
97
|
+
onlyReal,
|
|
98
|
+
});
|
|
113
99
|
if (!jcamp) {
|
|
114
100
|
throw new Error('convert spectrum to JCAMP failed');
|
|
115
101
|
}
|
|
116
102
|
const blob = new Blob([jcamp], { type: 'text/plain' });
|
|
117
103
|
saveAs(blob, `${spectrum.info.name}.jdx`);
|
|
118
104
|
}
|
|
105
|
+
export async function exportForCT(options) {
|
|
106
|
+
const { spectrum, molecules } = options;
|
|
107
|
+
if (!isSpectrum1D(spectrum)) {
|
|
108
|
+
throw new Error('2D spectrum is not supported');
|
|
109
|
+
}
|
|
110
|
+
if (!spectrum.info.isFt) {
|
|
111
|
+
throw new Error('The spectrum must be a Fourier Transform (FT) spectrum.');
|
|
112
|
+
}
|
|
113
|
+
if (!(Array.isArray(molecules) && molecules.length > 0)) {
|
|
114
|
+
throw new Error('Molecule file is required. Please add a molecule');
|
|
115
|
+
}
|
|
116
|
+
const jcamp = spectrum1DToJcamp(spectrum, {
|
|
117
|
+
onlyReal: true,
|
|
118
|
+
});
|
|
119
|
+
if (!jcamp) {
|
|
120
|
+
throw new Error('Failed to convert the 1D spectrum to JCAMP');
|
|
121
|
+
}
|
|
122
|
+
const name = spectrum.info.name;
|
|
123
|
+
const zip = new JSZip();
|
|
124
|
+
//add jcamp file
|
|
125
|
+
zip.file(`${name}.dx`, jcamp);
|
|
126
|
+
//add mol file
|
|
127
|
+
const { molfile } = molecules[0];
|
|
128
|
+
const molecule = OCL.Molecule.fromMolfile(molfile);
|
|
129
|
+
const molFileName = molecule.getMolecularFormula().formula;
|
|
130
|
+
zip.file(`${molFileName}.mol`, molecule.toMolfile());
|
|
131
|
+
const blob = await zip.generateAsync({
|
|
132
|
+
type: 'blob',
|
|
133
|
+
compression: 'DEFLATE',
|
|
134
|
+
compressionOptions: {
|
|
135
|
+
level: 9,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
saveAs(blob, name);
|
|
139
|
+
}
|
|
@@ -13,7 +13,6 @@ export declare function setSumOptions(data: Ranges | Integrals, params: {
|
|
|
13
13
|
options: SetSumOptions;
|
|
14
14
|
nucleus: string;
|
|
15
15
|
}): void;
|
|
16
|
-
export declare function getAtoms(mf: string): Record<string, number>;
|
|
17
16
|
/**
|
|
18
17
|
* change the sum for ranges and integrals in all spectra based on molecule
|
|
19
18
|
* it handle three cases
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MF } from 'mf-parser';
|
|
1
2
|
import getAtom from '../../utilities/getAtom';
|
|
2
3
|
import { isSpectrum1D, updateRangesRelativeValues, updateIntegralsRelativeValues, } from '.';
|
|
3
4
|
export function initSumOptions(options, params) {
|
|
@@ -26,7 +27,7 @@ export function getSum(mf, nucleus) {
|
|
|
26
27
|
if (!mf || !nucleus)
|
|
27
28
|
return defaultSum;
|
|
28
29
|
const atom = getAtom(nucleus);
|
|
29
|
-
const atoms =
|
|
30
|
+
const atoms = new MF(mf).getInfo().atoms;
|
|
30
31
|
return atoms[atom] || defaultSum;
|
|
31
32
|
}
|
|
32
33
|
export function setSumOptions(data, params) {
|
|
@@ -47,15 +48,6 @@ export function setSumOptions(data, params) {
|
|
|
47
48
|
data.options = { ...resOptions, sumAuto: false, sum: options.sum };
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
export function getAtoms(mf) {
|
|
51
|
-
const result = {};
|
|
52
|
-
// eslint-disable-next-line prefer-named-capture-group
|
|
53
|
-
const data = mf.split(/(\d+)/);
|
|
54
|
-
for (let i = 0; i < data.length - 1; i = i + 2) {
|
|
55
|
-
result[data[i]] = Number(data[i + 1]);
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
51
|
/**
|
|
60
52
|
* change the sum for ranges and integrals in all spectra based on molecule
|
|
61
53
|
* it handle three cases
|
|
@@ -11,7 +11,7 @@ interface RandomColorOptions extends BaseColorOptions {
|
|
|
11
11
|
regenerate: true;
|
|
12
12
|
random?: boolean;
|
|
13
13
|
}
|
|
14
|
-
export declare const COLORS:
|
|
14
|
+
export declare const COLORS: readonly string[];
|
|
15
15
|
export declare function get1DColor(spectrum: any, options: ColorOptions | RandomColorOptions): {
|
|
16
16
|
color: string;
|
|
17
17
|
};
|
|
@@ -12,6 +12,6 @@ export { changeRangeSignal } from './ranges/changeRangeSignal';
|
|
|
12
12
|
export { checkRangeKind } from './ranges/checkRangeKind';
|
|
13
13
|
export { detectRange } from './ranges/detectRange';
|
|
14
14
|
export { detectRanges } from './ranges/detectRanges';
|
|
15
|
-
export {
|
|
15
|
+
export { resurrectSpectrumFromRanges, resurrectSpectrumFromSignals, } from './ranges/resurrectSpectrum';
|
|
16
16
|
export { mapRanges, getShiftX, checkIntegralKind, updateRangesRelativeValues, updateIntegralsRelativeValues, } from 'nmr-processing';
|
|
17
17
|
export { get1DColor } from './get1DColor';
|
|
@@ -12,6 +12,6 @@ export { changeRangeSignal } from './ranges/changeRangeSignal';
|
|
|
12
12
|
export { checkRangeKind } from './ranges/checkRangeKind';
|
|
13
13
|
export { detectRange } from './ranges/detectRange';
|
|
14
14
|
export { detectRanges } from './ranges/detectRanges';
|
|
15
|
-
export {
|
|
15
|
+
export { resurrectSpectrumFromRanges, resurrectSpectrumFromSignals, } from './ranges/resurrectSpectrum';
|
|
16
16
|
export { mapRanges, getShiftX, checkIntegralKind, updateRangesRelativeValues, updateIntegralsRelativeValues, } from 'nmr-processing';
|
|
17
17
|
export { get1DColor } from './get1DColor';
|