nmrium 0.30.0 → 0.31.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 +3 -1
- package/lib/component/1d/FooterBanner.js +3 -1
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +3 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +3 -1
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +3 -1
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Viewer2D.js +4 -4
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/loader/DropZone.js +7 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +108 -49
- package/lib/component/reducer/Reducer.js +45 -41
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +11 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +218 -232
- package/lib/component/reducer/actions/IntegralsActions.js +13 -8
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +22 -6
- package/lib/component/reducer/actions/PeaksActions.js +18 -12
- package/lib/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
- package/lib/component/reducer/actions/RangesActions.js +85 -27
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -10
- package/lib/component/reducer/actions/ToolsActions.js +38 -23
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +68 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib/component/reducer/types/Types.d.ts +5 -0
- package/lib/component/reducer/types/Types.js +5 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib/component/toolbar/BasicToolBar.js +4 -6
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/exercise.js +6 -0
- package/lib/data/SpectraManager.d.ts +0 -4
- package/lib/data/SpectraManager.js +2 -87
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +3 -1
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +3 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +3 -1
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +3 -1
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/loader/DropZone.js +6 -149
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +48 -43
- package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +219 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +13 -8
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
- package/lib-cjs/component/reducer/actions/PeaksActions.js +18 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +85 -27
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +13 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +38 -23
- package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib-cjs/component/reducer/types/Types.js +8 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib-cjs/component/toolbar/BasicToolBar.js +4 -6
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +6 -0
- package/lib-cjs/data/SpectraManager.js +3 -92
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +22 -22
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -19
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/migration/migrateToVersion3.d.ts +0 -1
- package/lib/data/migration/migrateToVersion3.js +0 -55
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/migration/MigrationManager.js +0 -26
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
|
@@ -12,6 +12,74 @@ export interface ActiveSpectrum {
|
|
|
12
12
|
id: string;
|
|
13
13
|
index: number;
|
|
14
14
|
}
|
|
15
|
+
interface ToolStateBase {
|
|
16
|
+
spectrumID: string;
|
|
17
|
+
}
|
|
18
|
+
interface RangeToolState extends ToolStateBase {
|
|
19
|
+
/**
|
|
20
|
+
* boolean indicator to hide/show multiplicity tree
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
showMultiplicityTrees: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* boolean indicator to hide/show J graph for spectrum signals
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
showJGraph: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* boolean indicator to hide/show integrals for the spectrum ranges
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
showRangesIntegrals: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ZoneToolState extends ToolStateBase {
|
|
36
|
+
/**
|
|
37
|
+
* boolean indicator to hide/show zones
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
showZones: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* boolean indicator to hide/show signals for spectrum zones
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
showSignals: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* boolean indicator to hide/show peaks for spectrum zones
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
showPeaks: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface ViewState {
|
|
53
|
+
/**
|
|
54
|
+
* Floatings molecules
|
|
55
|
+
* @default []
|
|
56
|
+
*/
|
|
57
|
+
floatingMolecules: Array<FloatingMolecules>;
|
|
58
|
+
ranges: Array<RangeToolState>;
|
|
59
|
+
zones: Array<ZoneToolState>;
|
|
60
|
+
spectra: {
|
|
61
|
+
/**
|
|
62
|
+
* active spectrum id per nucleus
|
|
63
|
+
* @default {}
|
|
64
|
+
*/
|
|
65
|
+
activeSpectra: Record<string, ActiveSpectrum | null>;
|
|
66
|
+
/**
|
|
67
|
+
* current select tab (nucleus)
|
|
68
|
+
* @default null
|
|
69
|
+
*/
|
|
70
|
+
activeTab: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export declare const rangeStateInit: {
|
|
74
|
+
showMultiplicityTrees: boolean;
|
|
75
|
+
showRangesIntegrals: boolean;
|
|
76
|
+
showJGraph: boolean;
|
|
77
|
+
};
|
|
78
|
+
export declare const zoneStateInit: {
|
|
79
|
+
showZones: boolean;
|
|
80
|
+
showSignals: boolean;
|
|
81
|
+
showPeaks: boolean;
|
|
82
|
+
};
|
|
15
83
|
export interface Margin {
|
|
16
84
|
top: number;
|
|
17
85
|
right: number;
|
|
@@ -85,11 +153,6 @@ export interface State {
|
|
|
85
153
|
* @default {}
|
|
86
154
|
*/
|
|
87
155
|
integralsYDomains: Record<string, Array<number>>;
|
|
88
|
-
/**
|
|
89
|
-
* current select tab (nucleus)
|
|
90
|
-
* @default null
|
|
91
|
-
*/
|
|
92
|
-
activeTab: string;
|
|
93
156
|
/**
|
|
94
157
|
* plot chart area width
|
|
95
158
|
* @default 0
|
|
@@ -105,11 +168,6 @@ export interface State {
|
|
|
105
168
|
* @default {top: 10,right: 20,bottom: 70,left: 0}
|
|
106
169
|
*/
|
|
107
170
|
margin: Margin;
|
|
108
|
-
/**
|
|
109
|
-
* current active spectrum
|
|
110
|
-
* @default null
|
|
111
|
-
*/
|
|
112
|
-
activeSpectrum: ActiveSpectrum | null;
|
|
113
171
|
/**
|
|
114
172
|
* Scale direction
|
|
115
173
|
* @default 'RTL'
|
|
@@ -122,11 +180,9 @@ export interface State {
|
|
|
122
180
|
molecules: Array<StateMoleculeExtended>;
|
|
123
181
|
/**
|
|
124
182
|
* View related information
|
|
125
|
-
* @default { floatingMolecules: [] };
|
|
183
|
+
* @default { floatingMolecules: [], ranges: [], zones: [] };
|
|
126
184
|
*/
|
|
127
|
-
view:
|
|
128
|
-
floatingMolecules: Array<FloatingMolecules>;
|
|
129
|
-
};
|
|
185
|
+
view: ViewState;
|
|
130
186
|
/**
|
|
131
187
|
* options to control spectra vertical alignment
|
|
132
188
|
* @default {align: 'bottom',value: DEFAULT_YAXIS_SHIFT_VALUE}
|
|
@@ -156,11 +212,6 @@ export interface State {
|
|
|
156
212
|
* @default '1D'
|
|
157
213
|
*/
|
|
158
214
|
displayerMode: DISPLAYER_MODE;
|
|
159
|
-
/**
|
|
160
|
-
* active spectrum per nucleus
|
|
161
|
-
* @default {}
|
|
162
|
-
*/
|
|
163
|
-
tabActiveSpectrum: Record<string, ActiveSpectrum | null>;
|
|
164
215
|
/**
|
|
165
216
|
* Multiple spectra analysis data
|
|
166
217
|
*/
|
|
@@ -231,21 +282,6 @@ export interface State {
|
|
|
231
282
|
* @default null
|
|
232
283
|
*/
|
|
233
284
|
activeFilterID: string | null;
|
|
234
|
-
/**
|
|
235
|
-
* boolean indicator to hide/show multiplicity tree
|
|
236
|
-
* @default false
|
|
237
|
-
*/
|
|
238
|
-
showMultiplicityTrees: boolean;
|
|
239
|
-
/**
|
|
240
|
-
* boolean indicator to hide/show integrals for the spectrum ranges
|
|
241
|
-
* @default false
|
|
242
|
-
*/
|
|
243
|
-
showRangesIntegrals: boolean;
|
|
244
|
-
/**
|
|
245
|
-
* boolean indicator to hide/show J graph for spectrum signals
|
|
246
|
-
* @default false
|
|
247
|
-
*/
|
|
248
|
-
showJGraph: boolean;
|
|
249
285
|
/**
|
|
250
286
|
* prediction Index
|
|
251
287
|
* @default 0
|
|
@@ -263,6 +299,7 @@ export interface State {
|
|
|
263
299
|
};
|
|
264
300
|
usedColors: UsedColors;
|
|
265
301
|
}
|
|
302
|
+
export declare function useActiveSpectrum(): ActiveSpectrum | null;
|
|
266
303
|
export declare function initState(state: State): State;
|
|
267
304
|
export declare function dispatchMiddleware(dispatch: any): (action: any) => void;
|
|
268
305
|
export declare const spectrumReducer: (base: {
|
|
@@ -700,6 +737,7 @@ export declare const spectrumReducer: (base: {
|
|
|
700
737
|
readonly id: string;
|
|
701
738
|
readonly originDelta?: number | undefined;
|
|
702
739
|
readonly peaks?: readonly {
|
|
740
|
+
readonly id?: string | undefined;
|
|
703
741
|
readonly kind?: string | undefined;
|
|
704
742
|
readonly shape?: {
|
|
705
743
|
readonly kind: "gaussian";
|
|
@@ -883,7 +921,16 @@ export declare const spectrumReducer: (base: {
|
|
|
883
921
|
readonly to: number;
|
|
884
922
|
} | undefined;
|
|
885
923
|
} | undefined;
|
|
886
|
-
readonly peaks?: readonly
|
|
924
|
+
readonly peaks?: readonly {
|
|
925
|
+
readonly id?: string | undefined;
|
|
926
|
+
readonly x: number;
|
|
927
|
+
readonly y: number;
|
|
928
|
+
readonly z: number;
|
|
929
|
+
readonly maxX: number;
|
|
930
|
+
readonly minX: number;
|
|
931
|
+
readonly maxY: number;
|
|
932
|
+
readonly minY: number;
|
|
933
|
+
}[] | undefined;
|
|
887
934
|
readonly kind?: string | undefined;
|
|
888
935
|
}[];
|
|
889
936
|
readonly kind: string;
|
|
@@ -931,7 +978,6 @@ export declare const spectrumReducer: (base: {
|
|
|
931
978
|
readonly integralsYDomains: {
|
|
932
979
|
readonly [x: string]: readonly number[];
|
|
933
980
|
};
|
|
934
|
-
readonly activeTab: string;
|
|
935
981
|
readonly width: number;
|
|
936
982
|
readonly height: number;
|
|
937
983
|
readonly margin: {
|
|
@@ -940,10 +986,6 @@ export declare const spectrumReducer: (base: {
|
|
|
940
986
|
readonly bottom: number;
|
|
941
987
|
readonly left: number;
|
|
942
988
|
};
|
|
943
|
-
readonly activeSpectrum: {
|
|
944
|
-
readonly id: string;
|
|
945
|
-
readonly index: number;
|
|
946
|
-
} | null;
|
|
947
989
|
readonly mode: 'RTL' | 'LTR';
|
|
948
990
|
readonly molecules: readonly {
|
|
949
991
|
readonly mf: string;
|
|
@@ -961,7 +1003,32 @@ export declare const spectrumReducer: (base: {
|
|
|
961
1003
|
readonly floatingMolecules: readonly {
|
|
962
1004
|
readonly id: string;
|
|
963
1005
|
readonly visible: boolean;
|
|
1006
|
+
readonly position: {
|
|
1007
|
+
readonly x: number;
|
|
1008
|
+
readonly y: number;
|
|
1009
|
+
};
|
|
964
1010
|
}[];
|
|
1011
|
+
readonly ranges: readonly {
|
|
1012
|
+
readonly showMultiplicityTrees: boolean;
|
|
1013
|
+
readonly showJGraph: boolean;
|
|
1014
|
+
readonly showRangesIntegrals: boolean;
|
|
1015
|
+
readonly spectrumID: string;
|
|
1016
|
+
}[];
|
|
1017
|
+
readonly zones: readonly {
|
|
1018
|
+
readonly showZones: boolean;
|
|
1019
|
+
readonly showSignals: boolean;
|
|
1020
|
+
readonly showPeaks: boolean;
|
|
1021
|
+
readonly spectrumID: string;
|
|
1022
|
+
}[];
|
|
1023
|
+
readonly spectra: {
|
|
1024
|
+
readonly activeSpectra: {
|
|
1025
|
+
readonly [x: string]: {
|
|
1026
|
+
readonly id: string;
|
|
1027
|
+
readonly index: number;
|
|
1028
|
+
} | null;
|
|
1029
|
+
};
|
|
1030
|
+
readonly activeTab: string;
|
|
1031
|
+
};
|
|
965
1032
|
};
|
|
966
1033
|
readonly verticalAlign: {
|
|
967
1034
|
readonly align: VerticalAlignment;
|
|
@@ -977,12 +1044,6 @@ export declare const spectrumReducer: (base: {
|
|
|
977
1044
|
readonly isLoading: boolean;
|
|
978
1045
|
readonly keysPreferences: any;
|
|
979
1046
|
readonly displayerMode: DISPLAYER_MODE;
|
|
980
|
-
readonly tabActiveSpectrum: {
|
|
981
|
-
readonly [x: string]: {
|
|
982
|
-
readonly id: string;
|
|
983
|
-
readonly index: number;
|
|
984
|
-
} | null;
|
|
985
|
-
};
|
|
986
1047
|
readonly spectraAnalysis: {
|
|
987
1048
|
readonly [x: string]: {
|
|
988
1049
|
readonly options: {
|
|
@@ -1051,9 +1112,6 @@ export declare const spectrumReducer: (base: {
|
|
|
1051
1112
|
};
|
|
1052
1113
|
readonly zonesNoiseFactor: number;
|
|
1053
1114
|
readonly activeFilterID: string | null;
|
|
1054
|
-
readonly showMultiplicityTrees: boolean;
|
|
1055
|
-
readonly showRangesIntegrals: boolean;
|
|
1056
|
-
readonly showJGraph: boolean;
|
|
1057
1115
|
readonly predictionIndex: number;
|
|
1058
1116
|
readonly peaksOptions: {
|
|
1059
1117
|
readonly showPeaksShapes: boolean;
|
|
@@ -1066,3 +1124,4 @@ export declare const spectrumReducer: (base: {
|
|
|
1066
1124
|
readonly '2d': readonly string[];
|
|
1067
1125
|
};
|
|
1068
1126
|
}, action: any) => import("immer/dist/internal").WritableDraft<State>;
|
|
1127
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
2
|
import { produce } from 'immer';
|
|
3
3
|
import { buildCorrelationData } from 'nmr-correlation';
|
|
4
|
+
import { read as readDropFiles, migrate } from 'nmr-load-save';
|
|
4
5
|
import { predictSpectra } from '../../data/PredictionManager';
|
|
5
6
|
import * as SpectraManager from '../../data/SpectraManager';
|
|
6
|
-
import {
|
|
7
|
+
import { useChartData } from '../context/ChartContext';
|
|
7
8
|
import { DefaultTolerance } from '../panels/SummaryPanel/CorrelationTable/Constants';
|
|
8
9
|
import { options } from '../toolbar/ToolTypes';
|
|
9
|
-
import { nmredataToNmrium } from '../utility/nmredataToNmrium';
|
|
10
10
|
import * as AssignmentsActions from './actions/AssignmentsActions';
|
|
11
11
|
import * as CorrelationsActions from './actions/CorrelationsActions';
|
|
12
12
|
import * as DatabaseActions from './actions/DatabaseActions';
|
|
@@ -28,6 +28,16 @@ import * as ZonesActions from './actions/ZonesActions';
|
|
|
28
28
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from './core/Constants';
|
|
29
29
|
import { UNDO, REDO, RESET } from './types/HistoryTypes';
|
|
30
30
|
import * as types from './types/Types';
|
|
31
|
+
export const rangeStateInit = {
|
|
32
|
+
showMultiplicityTrees: false,
|
|
33
|
+
showRangesIntegrals: true,
|
|
34
|
+
showJGraph: false,
|
|
35
|
+
};
|
|
36
|
+
export const zoneStateInit = {
|
|
37
|
+
showZones: true,
|
|
38
|
+
showSignals: true,
|
|
39
|
+
showPeaks: true,
|
|
40
|
+
};
|
|
31
41
|
export const getInitialState = () => ({
|
|
32
42
|
actionType: '',
|
|
33
43
|
data: [],
|
|
@@ -45,7 +55,6 @@ export const getInitialState = () => ({
|
|
|
45
55
|
shareYDomain: false,
|
|
46
56
|
},
|
|
47
57
|
integralsYDomains: {},
|
|
48
|
-
activeTab: '',
|
|
49
58
|
width: 0,
|
|
50
59
|
height: 0,
|
|
51
60
|
margin: {
|
|
@@ -54,10 +63,14 @@ export const getInitialState = () => ({
|
|
|
54
63
|
bottom: 70,
|
|
55
64
|
left: 0,
|
|
56
65
|
},
|
|
57
|
-
activeSpectrum: null,
|
|
58
66
|
mode: 'RTL',
|
|
59
67
|
molecules: [],
|
|
60
|
-
view: {
|
|
68
|
+
view: {
|
|
69
|
+
floatingMolecules: [],
|
|
70
|
+
ranges: [],
|
|
71
|
+
zones: [],
|
|
72
|
+
spectra: { activeSpectra: {}, activeTab: '' },
|
|
73
|
+
},
|
|
61
74
|
verticalAlign: {
|
|
62
75
|
align: 'bottom',
|
|
63
76
|
verticalShift: DEFAULT_YAXIS_SHIFT_VALUE,
|
|
@@ -72,7 +85,6 @@ export const getInitialState = () => ({
|
|
|
72
85
|
isLoading: false,
|
|
73
86
|
keysPreferences: {},
|
|
74
87
|
displayerMode: DISPLAYER_MODE.DM_1D,
|
|
75
|
-
tabActiveSpectrum: {},
|
|
76
88
|
spectraAnalysis: {},
|
|
77
89
|
correlations: {},
|
|
78
90
|
displayerKey: '',
|
|
@@ -92,9 +104,6 @@ export const getInitialState = () => ({
|
|
|
92
104
|
pivot: { value: 0, index: 0 },
|
|
93
105
|
zonesNoiseFactor: 1,
|
|
94
106
|
activeFilterID: null,
|
|
95
|
-
showMultiplicityTrees: false,
|
|
96
|
-
showRangesIntegrals: true,
|
|
97
|
-
showJGraph: false,
|
|
98
107
|
predictionIndex: 0,
|
|
99
108
|
peaksOptions: {
|
|
100
109
|
showPeaksShapes: false,
|
|
@@ -105,6 +114,10 @@ export const getInitialState = () => ({
|
|
|
105
114
|
usedColors: { '1d': [], '2d': [] },
|
|
106
115
|
});
|
|
107
116
|
export const initialState = getInitialState();
|
|
117
|
+
export function useActiveSpectrum() {
|
|
118
|
+
const { view: { spectra: { activeSpectra, activeTab }, }, } = useChartData();
|
|
119
|
+
return activeSpectra[activeTab] || null;
|
|
120
|
+
}
|
|
108
121
|
export function initState(state) {
|
|
109
122
|
const displayerKey = v4();
|
|
110
123
|
const correlations = buildCorrelationData([], {
|
|
@@ -131,28 +144,17 @@ export function dispatchMiddleware(dispatch) {
|
|
|
131
144
|
}
|
|
132
145
|
break;
|
|
133
146
|
}
|
|
134
|
-
case types.
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
case types.LOAD_ZIP_FILE: {
|
|
144
|
-
for (let zipFile of action.files) {
|
|
145
|
-
void SpectraManager.addBruker({ display: { name: zipFile.name } }, zipFile.binary, usedColors).then((data) => {
|
|
146
|
-
action.payload = { data, usedColors };
|
|
147
|
-
dispatch(action);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
case types.LOAD_NMREDATA_FILE: {
|
|
153
|
-
void nmredataToNmrium(action.file, usedColors).then((data) => {
|
|
154
|
-
action.payload = Object.assign(data, { usedColors });
|
|
147
|
+
case types.LOAD_DROP_FILES: {
|
|
148
|
+
const { files } = action;
|
|
149
|
+
action.usedColors = usedColors;
|
|
150
|
+
readDropFiles(files, usedColors)
|
|
151
|
+
.then((data) => {
|
|
152
|
+
action.data = data;
|
|
155
153
|
dispatch(action);
|
|
154
|
+
})
|
|
155
|
+
.catch((e) => {
|
|
156
|
+
dispatch({ type: types.SET_LOADING_FLAG, isLoading: false });
|
|
157
|
+
reportError(e);
|
|
156
158
|
});
|
|
157
159
|
break;
|
|
158
160
|
}
|
|
@@ -180,20 +182,14 @@ function innerSpectrumReducer(draft, action) {
|
|
|
180
182
|
switch (action.type) {
|
|
181
183
|
case types.INITIATE:
|
|
182
184
|
return LoadActions.initiate(draft, action);
|
|
185
|
+
case types.LOAD_DROP_FILES:
|
|
186
|
+
return LoadActions.loadDropFiles(draft, action);
|
|
183
187
|
case types.SET_LOADING_FLAG:
|
|
184
188
|
return LoadActions.setIsLoading(draft, action.isLoading);
|
|
185
189
|
case types.LOAD_JSON_FILE:
|
|
186
190
|
return LoadActions.handleLoadJsonFile(draft, action);
|
|
187
191
|
case types.LOAD_JCAMP_FILE:
|
|
188
192
|
return LoadActions.loadJcampFile(draft, action);
|
|
189
|
-
case types.LOAD_JDF_FILE:
|
|
190
|
-
return LoadActions.loadJDFFile(draft, action);
|
|
191
|
-
case types.LOAD_MOL_FILE:
|
|
192
|
-
return LoadActions.handleLoadMOLFile(draft, action);
|
|
193
|
-
case types.LOAD_ZIP_FILE:
|
|
194
|
-
return LoadActions.handleLoadZIPFile(draft, action);
|
|
195
|
-
case types.LOAD_NMREDATA_FILE:
|
|
196
|
-
return LoadActions.handleLoadNmredata(draft, action);
|
|
197
193
|
case types.ADD_PEAK:
|
|
198
194
|
return PeaksActions.addPeak(draft, action.mouseCoordinates);
|
|
199
195
|
case types.ADD_PEAKS:
|
|
@@ -320,6 +316,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
320
316
|
return MoleculeActions.predictSpectraFromMoleculeHandler(draft, action);
|
|
321
317
|
case types.FLOAT_MOLECULE_OVER_SPECTRUM:
|
|
322
318
|
return MoleculeActions.floatMoleculeOverSpectrum(draft, action);
|
|
319
|
+
case types.CHANGE_FLOAT_MOLECULE_POSITION:
|
|
320
|
+
return MoleculeActions.changeFloatMoleculePosition(draft, action);
|
|
323
321
|
case types.SET_CORRELATIONS_MF:
|
|
324
322
|
return CorrelationsActions.handleSetMF(draft, action.payload);
|
|
325
323
|
case types.SET_CORRELATIONS_TOLERANCE:
|
|
@@ -369,13 +367,13 @@ function innerSpectrumReducer(draft, action) {
|
|
|
369
367
|
case types.UPDATE_RANGE:
|
|
370
368
|
return RangesActions.handleUpdateRange(draft, action);
|
|
371
369
|
case types.SHOW_MULTIPLICTY_TREES:
|
|
372
|
-
return RangesActions.handleShowMultiplicityTrees(draft);
|
|
370
|
+
return RangesActions.handleShowMultiplicityTrees(draft, action);
|
|
373
371
|
case types.SHOW_RANGES_INTEGRALS:
|
|
374
|
-
return RangesActions.handleShowRangesIntegrals(draft);
|
|
372
|
+
return RangesActions.handleShowRangesIntegrals(draft, action);
|
|
375
373
|
case types.AUTO_RANGES_SPECTRA_PICKING:
|
|
376
374
|
return RangesActions.handleAutoSpectraRangesDetection(draft);
|
|
377
375
|
case types.SHOW_J_GRAPH:
|
|
378
|
-
return RangesActions.handleShowJGraph(draft);
|
|
376
|
+
return RangesActions.handleShowJGraph(draft, action);
|
|
379
377
|
case types.SET_ACTIVE_TAB:
|
|
380
378
|
return ToolsActions.handelSetActiveTab(draft, action.tab);
|
|
381
379
|
case types.ADD_BASE_LINE_ZONE:
|
|
@@ -408,6 +406,12 @@ function innerSpectrumReducer(draft, action) {
|
|
|
408
406
|
return ZonesActions.handleSetDiaIDZone(draft, action);
|
|
409
407
|
case types.AUTO_ZONES_SPECTRA_PICKING:
|
|
410
408
|
return ZonesActions.handleAutoSpectraZonesDetection(draft);
|
|
409
|
+
case types.SHOW_ZONES:
|
|
410
|
+
return ZonesActions.handleShowZones(draft, action);
|
|
411
|
+
case types.SHOW_ZONES_SIGNALS:
|
|
412
|
+
return ZonesActions.handleShowSignals(draft, action);
|
|
413
|
+
case types.SHOW_ZONES_PEAKS:
|
|
414
|
+
return ZonesActions.handleShowPeaks(draft, action);
|
|
411
415
|
case types.SAVE_EDITED_ZONE:
|
|
412
416
|
return ZonesActions.handleSaveEditedZone(draft, action);
|
|
413
417
|
case types.ANALYZE_SPECTRA:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
2
|
import { Datum1D } from '../../../data/types/data1d';
|
|
3
3
|
import { State } from '../Reducer';
|
|
4
|
-
declare function getDomain(
|
|
4
|
+
declare function getDomain(draft: Draft<State>): {
|
|
5
5
|
xDomain: [number, number] | [undefined, undefined];
|
|
6
6
|
yDomain: [number, number] | [undefined, undefined];
|
|
7
7
|
yDomains: {};
|
|
@@ -4,10 +4,12 @@ import { isSpectrum2D } from '../../../data/data2d/Spectrum2D';
|
|
|
4
4
|
import nucleusToString from '../../utility/nucleusToString';
|
|
5
5
|
import { DISPLAYER_MODE } from '../core/Constants';
|
|
6
6
|
function getActiveData(draft) {
|
|
7
|
-
let data = draft.data.filter((datum) => nucleusToString(datum.info.nucleus) === draft.activeTab &&
|
|
7
|
+
let data = draft.data.filter((datum) => nucleusToString(datum.info.nucleus) === draft.view.spectra.activeTab &&
|
|
8
8
|
datum.info.dimension === 1);
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// todo: refactor this
|
|
10
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
11
|
+
if (activeSpectrum) {
|
|
12
|
+
const activeSpectrumIndex = data.findIndex((datum) => datum.id === activeSpectrum?.id);
|
|
11
13
|
if (activeSpectrumIndex !== -1) {
|
|
12
14
|
const isFid = data[activeSpectrumIndex].info.isFid || false;
|
|
13
15
|
data = data.filter((datum) => datum.info.isFid === isFid);
|
|
@@ -18,12 +20,12 @@ function getActiveData(draft) {
|
|
|
18
20
|
}
|
|
19
21
|
return data;
|
|
20
22
|
}
|
|
21
|
-
function getDomain(
|
|
23
|
+
function getDomain(draft) {
|
|
22
24
|
let xArray = [];
|
|
23
25
|
let yArray = [];
|
|
24
26
|
let yDomains = {};
|
|
25
27
|
let xDomains = {};
|
|
26
|
-
const data = getActiveData(
|
|
28
|
+
const data = getActiveData(draft);
|
|
27
29
|
try {
|
|
28
30
|
xArray = data.reduce((acc, d) => {
|
|
29
31
|
const { display, data } = d;
|
|
@@ -61,7 +63,7 @@ function get2DDomain(state) {
|
|
|
61
63
|
let yArray = [];
|
|
62
64
|
let yDomains = {};
|
|
63
65
|
let xDomains = {};
|
|
64
|
-
const { activeTab,
|
|
66
|
+
const { view: { spectra: { activeSpectra, activeTab }, }, data, } = state;
|
|
65
67
|
const nucleus = activeTab.split(',');
|
|
66
68
|
try {
|
|
67
69
|
xArray = data.reduce((acc, datum) => {
|
|
@@ -85,7 +87,7 @@ function get2DDomain(state) {
|
|
|
85
87
|
// eslint-disable-next-line no-console
|
|
86
88
|
console.log(e);
|
|
87
89
|
}
|
|
88
|
-
const spectrumsIDs = nucleus.map((n) =>
|
|
90
|
+
const spectrumsIDs = nucleus.map((n) => activeSpectra[n]?.id);
|
|
89
91
|
const filteredData = data.reduce((acc, datum) => {
|
|
90
92
|
return spectrumsIDs.includes(datum.id) && datum.info.dimension === 1
|
|
91
93
|
? acc.concat(datum)
|
|
@@ -118,7 +120,7 @@ function get2DDomain(state) {
|
|
|
118
120
|
function setDomain(draft, options) {
|
|
119
121
|
const { yDomain = { isChanged: true, isShared: true } } = options || {};
|
|
120
122
|
let domain;
|
|
121
|
-
if (draft.activeTab) {
|
|
123
|
+
if (draft.view.spectra.activeTab) {
|
|
122
124
|
if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
|
|
123
125
|
domain = getDomain(draft);
|
|
124
126
|
}
|
|
@@ -186,7 +188,7 @@ function handelResetDomain(draft) {
|
|
|
186
188
|
}
|
|
187
189
|
function setMode(draft) {
|
|
188
190
|
const data = draft.data.filter((datum) => draft.xDomains[datum.id] &&
|
|
189
|
-
nucleusToString(datum.info.nucleus) === draft.activeTab);
|
|
191
|
+
nucleusToString(datum.info.nucleus) === draft.view.spectra.activeTab);
|
|
190
192
|
draft.mode = data[0]?.info.isFid ? 'LTR' : 'RTL';
|
|
191
193
|
}
|
|
192
194
|
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, setIntegralsYDomain, };
|
|
@@ -24,7 +24,7 @@ declare function handleBaseLineCorrectionFilter(draft: Draft<State>, action: any
|
|
|
24
24
|
* @param {boolean=} options.updateDomain
|
|
25
25
|
* @param {boolean=} options.rollback
|
|
26
26
|
*/
|
|
27
|
-
declare function resetSpectrumByFilter(draft:
|
|
27
|
+
declare function resetSpectrumByFilter(draft: Draft<State>, options?: {
|
|
28
28
|
rollback?: boolean;
|
|
29
29
|
resetTool?: boolean;
|
|
30
30
|
updateDomain?: boolean;
|