nmrium 0.30.0 → 0.32.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 +20 -11
- 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 +4 -2
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -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/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -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 +3 -3
- 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 +15 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.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/MoleculeHeader.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/PeaksPanel/PeaksTable.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/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- 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 +110 -96
- 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 +12 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +227 -232
- package/lib/component/reducer/actions/IntegralsActions.js +14 -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 +19 -12
- package/lib/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
- package/lib/component/reducer/actions/RangesActions.js +89 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +44 -27
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +69 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- 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/preferences/preferencesReducer.d.ts +2 -2
- 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 +12 -13
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/Export.js +7 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +9 -3
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- 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/phaseCorrection.js +11 -5
- 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/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +19 -10
- 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 +4 -2
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -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/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -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 +3 -3
- 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 +14 -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/GeneralTabContent.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/MoleculeHeader.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/PeaksPanel/PeaksTable.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/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- 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 +12 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -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 +19 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
- package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- 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 +11 -12
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/Export.js +7 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +9 -3
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- 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/phaseCorrection.js +10 -4
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- 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/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- 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/data1d/filter1d/absolute.js +0 -32
- 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
|
@@ -23,9 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.handleLoadJsonFile = exports.loadDropFiles = exports.loadJcampFile = exports.initiate = exports.setIsLoading = void 0;
|
|
27
27
|
const nmr_correlation_1 = require("nmr-correlation");
|
|
28
28
|
const SpectraManager_1 = require("../../../data/SpectraManager");
|
|
29
|
+
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
30
|
+
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
29
31
|
const MoleculeManager = __importStar(require("../../../data/molecules/MoleculeManager"));
|
|
30
32
|
const Constants_1 = require("../../panels/SummaryPanel/CorrelationTable/Constants");
|
|
31
33
|
const Reducer_1 = require("../Reducer");
|
|
@@ -108,16 +110,6 @@ function initiate(draft, action) {
|
|
|
108
110
|
return state;
|
|
109
111
|
}
|
|
110
112
|
exports.initiate = initiate;
|
|
111
|
-
function loadJDFFile(draft, actions) {
|
|
112
|
-
const { files } = actions;
|
|
113
|
-
const spectra = (0, SpectraManager_1.addJDFs)(files, draft.usedColors);
|
|
114
|
-
for (const spectrum of spectra) {
|
|
115
|
-
draft.data.push(spectrum);
|
|
116
|
-
}
|
|
117
|
-
(0, ToolsActions_1.setActiveTab)(draft);
|
|
118
|
-
draft.isLoading = false;
|
|
119
|
-
}
|
|
120
|
-
exports.loadJDFFile = loadJDFFile;
|
|
121
113
|
function loadJcampFile(draft, actions) {
|
|
122
114
|
const { files } = actions;
|
|
123
115
|
const spectra = (0, SpectraManager_1.addJcamps)(files, draft.usedColors);
|
|
@@ -142,32 +134,22 @@ function handleLoadJsonFile(draft, action) {
|
|
|
142
134
|
return state;
|
|
143
135
|
}
|
|
144
136
|
exports.handleLoadJsonFile = handleLoadJsonFile;
|
|
145
|
-
function
|
|
146
|
-
const {
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
function loadDropFiles(draft, actions) {
|
|
138
|
+
const { data, usedColors } = actions;
|
|
139
|
+
const { spectra, molecules } = data;
|
|
140
|
+
for (let spectrum of spectra) {
|
|
141
|
+
const { info } = spectrum;
|
|
142
|
+
if (info.dimension === 1) {
|
|
143
|
+
draft.data.push((0, Spectrum1D_1.initiateDatum1D)(spectrum, usedColors));
|
|
144
|
+
}
|
|
145
|
+
else if (info.dimension === 2) {
|
|
146
|
+
draft.data.push((0, Spectrum2D_1.initiateDatum2D)(spectrum, usedColors));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
for (let molecule of molecules) {
|
|
150
|
+
MoleculeManager.addMolfile(draft.molecules, molecule.molfile);
|
|
149
151
|
}
|
|
150
|
-
draft.isLoading = false;
|
|
151
|
-
}
|
|
152
|
-
exports.handleLoadMOLFile = handleLoadMOLFile;
|
|
153
|
-
function handleLoadZIPFile(draft, action) {
|
|
154
|
-
const { data, usedColors } = action.payload;
|
|
155
|
-
draft.data = draft.data.concat(data);
|
|
156
|
-
setColors(draft, usedColors);
|
|
157
152
|
(0, ToolsActions_1.setActiveTab)(draft);
|
|
158
|
-
(0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { align: 'auto-check' });
|
|
159
153
|
draft.isLoading = false;
|
|
160
154
|
}
|
|
161
|
-
exports.
|
|
162
|
-
function handleLoadNmredata(draft, action) {
|
|
163
|
-
const state = (0, Reducer_1.getInitialState)();
|
|
164
|
-
setData(state, action.payload);
|
|
165
|
-
(0, ToolsActions_1.setActiveTab)(state);
|
|
166
|
-
(0, PreferencesActions_1.changeSpectrumVerticalAlignment)(state, { align: 'auto-check' });
|
|
167
|
-
state.isLoading = false;
|
|
168
|
-
state.width = draft.width;
|
|
169
|
-
state.height = draft.height;
|
|
170
|
-
state.actionType = Types_1.LOAD_NMREDATA_FILE;
|
|
171
|
-
return state;
|
|
172
|
-
}
|
|
173
|
-
exports.handleLoadNmredata = handleLoadNmredata;
|
|
155
|
+
exports.loadDropFiles = loadDropFiles;
|
|
@@ -26,11 +26,12 @@ 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.changeMoleculeLabel = exports.floatMoleculeOverSpectrum = exports.predictSpectraFromMoleculeHandler = exports.deleteMoleculeHandler = exports.setMoleculeHandler = exports.addMoleculeHandler = void 0;
|
|
29
|
+
exports.changeMoleculeLabel = exports.changeFloatMoleculePosition = exports.floatMoleculeOverSpectrum = exports.predictSpectraFromMoleculeHandler = exports.deleteMoleculeHandler = exports.setMoleculeHandler = exports.addMoleculeHandler = void 0;
|
|
30
30
|
const PredictionManager_1 = require("../../../data/PredictionManager");
|
|
31
31
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
32
32
|
const MoleculeManager = __importStar(require("../../../data/molecules/MoleculeManager"));
|
|
33
33
|
const getColor_1 = __importDefault(require("../../../data/utilities/getColor"));
|
|
34
|
+
const DraggableStructure_1 = require("../../tool/FloatMoleculeStructures/DraggableStructure");
|
|
34
35
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
35
36
|
const Constants_1 = require("../core/Constants");
|
|
36
37
|
const RangesActions_1 = require("./RangesActions");
|
|
@@ -97,10 +98,11 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
97
98
|
const color = (0, getColor_1.default)(false, draft.usedColors['1d']);
|
|
98
99
|
for (const spectrum of (0, PredictionManager_1.generateSpectra)(data, options, color)) {
|
|
99
100
|
draft.data.push(spectrum);
|
|
100
|
-
draft.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
draft.view.spectra.activeSpectra[(0, nucleusToString_1.default)(spectrum.info.nucleus)] =
|
|
102
|
+
{
|
|
103
|
+
id: spectrum.id,
|
|
104
|
+
index: draft.data.length - 1,
|
|
105
|
+
};
|
|
104
106
|
}
|
|
105
107
|
draft.usedColors['1d'].push(color);
|
|
106
108
|
}
|
|
@@ -117,10 +119,25 @@ function floatMoleculeOverSpectrum(draft, action) {
|
|
|
117
119
|
!draft.view.floatingMolecules[moleculeIndex].visible;
|
|
118
120
|
}
|
|
119
121
|
else {
|
|
120
|
-
draft.view.floatingMolecules.push({
|
|
122
|
+
draft.view.floatingMolecules.push({
|
|
123
|
+
id,
|
|
124
|
+
visible: true,
|
|
125
|
+
position: DraggableStructure_1.DRAGGABLE_STRUCTURE_INITIAL_POSITION,
|
|
126
|
+
});
|
|
121
127
|
}
|
|
122
128
|
}
|
|
123
129
|
exports.floatMoleculeOverSpectrum = floatMoleculeOverSpectrum;
|
|
130
|
+
function changeFloatMoleculePosition(draft, action) {
|
|
131
|
+
const { id, position } = action.payload;
|
|
132
|
+
const molecule = draft.view.floatingMolecules.find((m) => m.id === id);
|
|
133
|
+
if (molecule) {
|
|
134
|
+
molecule.position = position;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
throw new Error(`Molecule ${id} does not exist`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.changeFloatMoleculePosition = changeFloatMoleculePosition;
|
|
124
141
|
function changeMoleculeLabel(draft, action) {
|
|
125
142
|
const { id, label } = action.payload;
|
|
126
143
|
const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
|
|
@@ -9,11 +9,13 @@ const immer_1 = require("immer");
|
|
|
9
9
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
10
10
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
11
11
|
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
12
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
12
13
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
13
14
|
function addPeak(draft, mouseCoordinates) {
|
|
15
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
14
16
|
const state = (0, immer_1.original)(draft);
|
|
15
|
-
if (
|
|
16
|
-
const { index } =
|
|
17
|
+
if (activeSpectrum?.id && state) {
|
|
18
|
+
const { index } = activeSpectrum;
|
|
17
19
|
const xShift = 10;
|
|
18
20
|
const startX = mouseCoordinates.x - xShift;
|
|
19
21
|
const endX = mouseCoordinates.x + xShift;
|
|
@@ -38,8 +40,9 @@ function addPeak(draft, mouseCoordinates) {
|
|
|
38
40
|
exports.addPeak = addPeak;
|
|
39
41
|
function addPeaks(draft, action) {
|
|
40
42
|
const state = (0, immer_1.original)(draft);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
44
|
+
if (activeSpectrum) {
|
|
45
|
+
const { index } = activeSpectrum;
|
|
43
46
|
const datumOriginal = state.data[index];
|
|
44
47
|
const { startX, endX } = action;
|
|
45
48
|
const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
|
|
@@ -61,8 +64,9 @@ function addPeaks(draft, action) {
|
|
|
61
64
|
}
|
|
62
65
|
exports.addPeaks = addPeaks;
|
|
63
66
|
function deletePeak(draft, peakData) {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
68
|
+
if (activeSpectrum) {
|
|
69
|
+
const { index } = activeSpectrum;
|
|
66
70
|
const state = (0, immer_1.original)(draft);
|
|
67
71
|
if (peakData == null) {
|
|
68
72
|
draft.data[index].peaks.values = [];
|
|
@@ -76,8 +80,9 @@ function deletePeak(draft, peakData) {
|
|
|
76
80
|
exports.deletePeak = deletePeak;
|
|
77
81
|
function handleOptimizePeaks(draft, action) {
|
|
78
82
|
const { peaks } = action.payload;
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
84
|
+
if (activeSpectrum?.id) {
|
|
85
|
+
const { index } = activeSpectrum;
|
|
81
86
|
const datum = draft.data[index];
|
|
82
87
|
const [from, to] = draft.xDomain;
|
|
83
88
|
const newPeaks = (0, Spectrum1D_1.optimizePeaks)(draft.data[index], {
|
|
@@ -90,10 +95,11 @@ function handleOptimizePeaks(draft, action) {
|
|
|
90
95
|
}
|
|
91
96
|
exports.handleOptimizePeaks = handleOptimizePeaks;
|
|
92
97
|
function handleAutoPeakPicking(draft, autOptions) {
|
|
93
|
-
|
|
98
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
99
|
+
if (activeSpectrum?.id) {
|
|
94
100
|
draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
|
|
95
101
|
draft.toolOptions.selectedOptionPanel = null;
|
|
96
|
-
const { index } =
|
|
102
|
+
const { index } = activeSpectrum;
|
|
97
103
|
const datum = draft.data[index];
|
|
98
104
|
const [from, to] = draft.xDomain;
|
|
99
105
|
const windowFromIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, from);
|
|
@@ -109,8 +115,9 @@ function handleAutoPeakPicking(draft, autOptions) {
|
|
|
109
115
|
exports.handleAutoPeakPicking = handleAutoPeakPicking;
|
|
110
116
|
function changePeakShapeHandler(draft, action) {
|
|
111
117
|
const { shape, id } = action.payload;
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
119
|
+
if (activeSpectrum?.id) {
|
|
120
|
+
const { index } = activeSpectrum;
|
|
114
121
|
const datum = draft.data[index];
|
|
115
122
|
const peakIndex = datum.peaks.values.findIndex((peak) => peak.id === id);
|
|
116
123
|
if (peakIndex !== -1) {
|
|
@@ -8,6 +8,7 @@ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
|
8
8
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
9
9
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
10
10
|
const Constants_1 = require("../core/Constants");
|
|
11
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
11
12
|
const DomainActions_1 = require("./DomainActions");
|
|
12
13
|
function changeSpectrumVerticalAlignment(draft, options) {
|
|
13
14
|
function stack(spectra = []) {
|
|
@@ -31,7 +32,7 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
31
32
|
if (['auto-check', 'stack'].includes(options.align || '')) {
|
|
32
33
|
dataPerNucleus = draft.data.filter((datum) => datum.info.nucleus === options?.activeTab
|
|
33
34
|
? options.activeTab
|
|
34
|
-
: draft.activeTab && datum.info.dimension === 1);
|
|
35
|
+
: draft.view.spectra.activeTab && datum.info.dimension === 1);
|
|
35
36
|
}
|
|
36
37
|
switch (options.align) {
|
|
37
38
|
case 'auto-check': {
|
|
@@ -60,21 +61,21 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
60
61
|
}
|
|
61
62
|
exports.changeSpectrumVerticalAlignment = changeSpectrumVerticalAlignment;
|
|
62
63
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
63
|
-
const {
|
|
64
|
-
|
|
64
|
+
const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, } = draft;
|
|
65
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
66
|
+
if (view.spectra.activeTab) {
|
|
65
67
|
const groupByNucleus = (0, GroupByInfoKey_1.default)('nucleus');
|
|
66
68
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
67
69
|
const level = displayerMode === Constants_1.DISPLAYER_MODE.DM_2D
|
|
68
|
-
? spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
70
|
+
? spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
69
71
|
acc[datum.id] = datum.processingController.getLevel();
|
|
70
72
|
return acc;
|
|
71
73
|
}, {})
|
|
72
74
|
: null;
|
|
73
75
|
draft.keysPreferences[keyCode] = {
|
|
74
|
-
activeTab,
|
|
75
76
|
activeSpectrum,
|
|
76
77
|
displayerMode,
|
|
77
|
-
|
|
78
|
+
view,
|
|
78
79
|
zoom,
|
|
79
80
|
xDomain,
|
|
80
81
|
xDomains,
|
|
@@ -83,7 +84,7 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
83
84
|
originDomain,
|
|
84
85
|
level,
|
|
85
86
|
margin,
|
|
86
|
-
data: spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
87
|
+
data: spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
87
88
|
acc[datum.id] = {
|
|
88
89
|
display: {
|
|
89
90
|
color: datum.display.color,
|
|
@@ -100,15 +101,13 @@ exports.setKeyPreferencesHandler = setKeyPreferencesHandler;
|
|
|
100
101
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
101
102
|
const preferences = draft.keysPreferences[keyCode];
|
|
102
103
|
if (preferences) {
|
|
103
|
-
draft.activeTab = preferences.activeTab;
|
|
104
104
|
draft.data.forEach((datum, index) => {
|
|
105
105
|
if ((0, nucleusToString_1.default)(datum.info.nucleus) === preferences.activeTab) {
|
|
106
106
|
draft.data[index].display = Object.assign((0, cloneDeep_1.default)(datum.display), preferences.data[datum.id].display);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
draft.view = preferences.view;
|
|
109
110
|
draft.displayerMode = preferences.displayerMode;
|
|
110
|
-
draft.tabActiveSpectrum = preferences.tabActiveSpectrum;
|
|
111
|
-
draft.activeSpectrum = preferences.activeSpectrum;
|
|
112
111
|
draft.margin = preferences.margin;
|
|
113
112
|
(0, DomainActions_1.setDomain)(draft);
|
|
114
113
|
draft.xDomain = preferences.xDomain;
|
|
@@ -37,15 +37,26 @@ const SignalsKinds_1 = require("../../../data/constants/SignalsKinds");
|
|
|
37
37
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
38
38
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
39
39
|
const RangeUtilities_1 = require("../../../data/utilities/RangeUtilities");
|
|
40
|
+
const Reducer_1 = require("../Reducer");
|
|
41
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
40
42
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
41
43
|
const CorrelationsActions_1 = require("./CorrelationsActions");
|
|
42
44
|
const DomainActions_1 = require("./DomainActions");
|
|
43
45
|
const ToolsActions_1 = require("./ToolsActions");
|
|
44
46
|
function handleAutoRangesDetection(draft, options) {
|
|
45
|
-
const {
|
|
47
|
+
const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
48
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
46
49
|
if (activeSpectrum?.id) {
|
|
47
|
-
const { index } = activeSpectrum;
|
|
50
|
+
const { index, id } = activeSpectrum;
|
|
48
51
|
const datum = data[index];
|
|
52
|
+
// add range intial state
|
|
53
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
54
|
+
if (!range) {
|
|
55
|
+
draft.view.ranges.push({
|
|
56
|
+
spectrumID: id,
|
|
57
|
+
...Reducer_1.rangeStateInit,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
49
60
|
const [from, to] = xDomain;
|
|
50
61
|
const windowFromIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, from);
|
|
51
62
|
const windowToIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, to);
|
|
@@ -80,7 +91,7 @@ function handleAutoSpectraRangesDetection(draft) {
|
|
|
80
91
|
clean: true,
|
|
81
92
|
keepPeaks: true,
|
|
82
93
|
};
|
|
83
|
-
const { data, activeTab: nucleus, molecules } = draft;
|
|
94
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
84
95
|
for (const datum of data) {
|
|
85
96
|
if (datum.info.dimension === 1) {
|
|
86
97
|
(0, Spectrum1D_1.detectRanges)(datum, { peakPicking, molecules, nucleus });
|
|
@@ -93,8 +104,9 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
|
|
|
93
104
|
return draft.data[spectrumIndex].ranges.values.findIndex((range) => range.id === rangeID);
|
|
94
105
|
}
|
|
95
106
|
function handleDeleteRange(draft, action) {
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
108
|
+
if (activeSpectrum?.id) {
|
|
109
|
+
const { index } = activeSpectrum;
|
|
98
110
|
const { data, resetSelectTool = false } = action.payload;
|
|
99
111
|
const { id = null, assignmentData } = data;
|
|
100
112
|
const datum = draft.data[index];
|
|
@@ -117,8 +129,9 @@ function handleDeleteRange(draft, action) {
|
|
|
117
129
|
exports.handleDeleteRange = handleDeleteRange;
|
|
118
130
|
function handleChangeRangeSignalKind(draft, action) {
|
|
119
131
|
const state = (0, immer_1.original)(draft);
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
|
|
133
|
+
if (activeSpectrum?.id) {
|
|
134
|
+
const { index } = activeSpectrum;
|
|
122
135
|
const { rowData, value } = action.payload.data;
|
|
123
136
|
const rangeIndex = getRangeIndex(state, index, rowData.id);
|
|
124
137
|
const _range = draft.data[index].ranges.values[rangeIndex];
|
|
@@ -135,8 +148,9 @@ function handleChangeRangeSignalKind(draft, action) {
|
|
|
135
148
|
exports.handleChangeRangeSignalKind = handleChangeRangeSignalKind;
|
|
136
149
|
function handleSaveEditedRange(draft, action) {
|
|
137
150
|
const state = (0, immer_1.original)(draft);
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
|
|
152
|
+
if (activeSpectrum?.id) {
|
|
153
|
+
const { index } = activeSpectrum;
|
|
140
154
|
const { editedRowData, assignmentData } = action.payload;
|
|
141
155
|
// remove assignments in global state
|
|
142
156
|
const _editedRowData = (0, RangeUtilities_1.unlink)(editedRowData);
|
|
@@ -179,8 +193,9 @@ function handleDeleteSignal(draft, action) {
|
|
|
179
193
|
}
|
|
180
194
|
exports.handleDeleteSignal = handleDeleteSignal;
|
|
181
195
|
function handleUnlinkRange(draft, action) {
|
|
182
|
-
|
|
183
|
-
|
|
196
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
197
|
+
if (activeSpectrum?.id) {
|
|
198
|
+
const { index } = activeSpectrum;
|
|
184
199
|
const { assignmentData, rangeData = null, signalIndex = -1, } = action.payload;
|
|
185
200
|
// remove assignments in global state
|
|
186
201
|
if (rangeData) {
|
|
@@ -214,8 +229,9 @@ function handleUnlinkRange(draft, action) {
|
|
|
214
229
|
}
|
|
215
230
|
exports.handleUnlinkRange = handleUnlinkRange;
|
|
216
231
|
function handleSetDiaIDRange(draft, action) {
|
|
217
|
-
|
|
218
|
-
|
|
232
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
233
|
+
if (activeSpectrum?.id) {
|
|
234
|
+
const { index } = activeSpectrum;
|
|
219
235
|
const { rangeData, diaIDs, signalIndex, nbAtoms } = action.payload;
|
|
220
236
|
const getNbAtoms = (input, current = 0) => input + current;
|
|
221
237
|
const rangeIndex = getRangeIndex(draft, index, rangeData.id);
|
|
@@ -233,14 +249,16 @@ function handleSetDiaIDRange(draft, action) {
|
|
|
233
249
|
}
|
|
234
250
|
exports.handleSetDiaIDRange = handleSetDiaIDRange;
|
|
235
251
|
function handleResizeRange(draft, action) {
|
|
236
|
-
|
|
237
|
-
|
|
252
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
253
|
+
if (activeSpectrum?.id) {
|
|
254
|
+
const { index } = activeSpectrum;
|
|
238
255
|
(0, Spectrum1D_1.changeRange)(draft.data[index], action.data);
|
|
239
256
|
}
|
|
240
257
|
}
|
|
241
258
|
exports.handleResizeRange = handleResizeRange;
|
|
242
259
|
function handleChangeRangeSum(draft, options) {
|
|
243
|
-
const { data,
|
|
260
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
261
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
244
262
|
if (activeSpectrum?.id) {
|
|
245
263
|
const { index } = activeSpectrum;
|
|
246
264
|
const datum = data[index];
|
|
@@ -252,10 +270,19 @@ exports.handleChangeRangeSum = handleChangeRangeSum;
|
|
|
252
270
|
function addNewRange(draft, props) {
|
|
253
271
|
const { startX, endX, id } = props;
|
|
254
272
|
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
255
|
-
const {
|
|
273
|
+
const { view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
274
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
256
275
|
if (activeSpectrum?.id) {
|
|
257
276
|
const { index } = activeSpectrum;
|
|
258
277
|
const [from, to] = range;
|
|
278
|
+
// add range intial state
|
|
279
|
+
const rangeState = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum.id);
|
|
280
|
+
if (!rangeState) {
|
|
281
|
+
draft.view.ranges.push({
|
|
282
|
+
spectrumID: activeSpectrum.id,
|
|
283
|
+
...Reducer_1.rangeStateInit,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
259
286
|
(0, Spectrum1D_1.addRange)(draft.data[index], {
|
|
260
287
|
from,
|
|
261
288
|
to,
|
|
@@ -311,16 +338,18 @@ function handleOnChangeRangesData(draft) {
|
|
|
311
338
|
}
|
|
312
339
|
function handleChangeRangesSumFlag(draft, action) {
|
|
313
340
|
const flag = action.payload;
|
|
314
|
-
|
|
315
|
-
|
|
341
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
342
|
+
if (activeSpectrum?.id) {
|
|
343
|
+
const { index } = activeSpectrum;
|
|
316
344
|
draft.data[index].ranges.options.isSumConstant = !flag;
|
|
317
345
|
}
|
|
318
346
|
}
|
|
319
347
|
exports.handleChangeRangesSumFlag = handleChangeRangesSumFlag;
|
|
320
348
|
function handleUpdateRange(draft, action) {
|
|
321
349
|
const { range, resetSelectTool = false } = action.payload;
|
|
322
|
-
|
|
323
|
-
|
|
350
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
351
|
+
if (activeSpectrum?.id && range.id) {
|
|
352
|
+
const datum = draft.data[activeSpectrum?.index];
|
|
324
353
|
const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
|
|
325
354
|
datum.ranges.values[index] = range;
|
|
326
355
|
}
|
|
@@ -329,17 +358,48 @@ function handleUpdateRange(draft, action) {
|
|
|
329
358
|
}
|
|
330
359
|
}
|
|
331
360
|
exports.handleUpdateRange = handleUpdateRange;
|
|
332
|
-
function handleShowMultiplicityTrees(draft) {
|
|
333
|
-
|
|
334
|
-
|
|
361
|
+
function handleShowMultiplicityTrees(draft, action) {
|
|
362
|
+
const { id } = action.payload;
|
|
363
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
364
|
+
if (range) {
|
|
365
|
+
range.showMultiplicityTrees = !range.showMultiplicityTrees;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
draft.view.ranges.push({
|
|
369
|
+
spectrumID: id,
|
|
370
|
+
...Reducer_1.rangeStateInit,
|
|
371
|
+
showMultiplicityTrees: !Reducer_1.rangeStateInit.showMultiplicityTrees,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
335
374
|
}
|
|
336
375
|
exports.handleShowMultiplicityTrees = handleShowMultiplicityTrees;
|
|
337
|
-
function handleShowRangesIntegrals(draft) {
|
|
338
|
-
|
|
339
|
-
|
|
376
|
+
function handleShowRangesIntegrals(draft, action) {
|
|
377
|
+
const { id } = action.payload;
|
|
378
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
379
|
+
if (range) {
|
|
380
|
+
range.showRangesIntegrals = !range.showRangesIntegrals;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
draft.view.ranges.push({
|
|
384
|
+
spectrumID: id,
|
|
385
|
+
...Reducer_1.rangeStateInit,
|
|
386
|
+
showRangesIntegrals: !Reducer_1.rangeStateInit.showRangesIntegrals,
|
|
387
|
+
});
|
|
388
|
+
}
|
|
340
389
|
}
|
|
341
390
|
exports.handleShowRangesIntegrals = handleShowRangesIntegrals;
|
|
342
|
-
function handleShowJGraph(draft) {
|
|
343
|
-
|
|
391
|
+
function handleShowJGraph(draft, action) {
|
|
392
|
+
const { id } = action.payload;
|
|
393
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
394
|
+
if (range) {
|
|
395
|
+
range.showJGraph = !range.showJGraph;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
draft.view.ranges.push({
|
|
399
|
+
spectrumID: id,
|
|
400
|
+
...Reducer_1.rangeStateInit,
|
|
401
|
+
showJGraph: !Reducer_1.rangeStateInit.showJGraph,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
344
404
|
}
|
|
345
405
|
exports.handleShowJGraph = handleShowJGraph;
|
|
@@ -34,13 +34,13 @@ function analyzeSpectra(draft, action) {
|
|
|
34
34
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
35
35
|
from,
|
|
36
36
|
to,
|
|
37
|
-
nucleus: draft.activeTab,
|
|
37
|
+
nucleus: draft.view.spectra.activeTab,
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
exports.analyzeSpectra = analyzeSpectra;
|
|
41
41
|
function handleDeleteSpectraRanges(draft, action) {
|
|
42
42
|
const { colKey } = action;
|
|
43
|
-
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.activeTab);
|
|
43
|
+
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.view.spectra.activeTab);
|
|
44
44
|
}
|
|
45
45
|
exports.handleDeleteSpectraRanges = handleDeleteSpectraRanges;
|
|
46
46
|
function handleResizeSpectraRange(draft, action) {
|
|
@@ -48,18 +48,18 @@ function handleResizeSpectraRange(draft, action) {
|
|
|
48
48
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
49
49
|
from,
|
|
50
50
|
to,
|
|
51
|
-
nucleus: draft.activeTab,
|
|
51
|
+
nucleus: draft.view.spectra.activeTab,
|
|
52
52
|
columnKey,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
exports.handleResizeSpectraRange = handleResizeSpectraRange;
|
|
56
56
|
function handleSetColumns(draft, action) {
|
|
57
57
|
const data = action.payload;
|
|
58
|
-
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.activeTab, data);
|
|
58
|
+
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.view.spectra.activeTab, data);
|
|
59
59
|
}
|
|
60
60
|
exports.handleSetColumns = handleSetColumns;
|
|
61
61
|
function handleFilterColumn(draft, action) {
|
|
62
62
|
const { columnKey, valueKey } = action.payload;
|
|
63
|
-
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.activeTab, columnKey, valueKey);
|
|
63
|
+
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.view.spectra.activeTab, columnKey, valueKey);
|
|
64
64
|
}
|
|
65
65
|
exports.handleFilterColumn = handleFilterColumn;
|
|
@@ -35,6 +35,7 @@ const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
|
35
35
|
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
36
36
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
37
37
|
const Zoom1DManager_1 = require("../helper/Zoom1DManager");
|
|
38
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
38
39
|
const DomainActions_1 = require("./DomainActions");
|
|
39
40
|
const FiltersActions_1 = require("./FiltersActions");
|
|
40
41
|
const ToolsActions_1 = require("./ToolsActions");
|
|
@@ -96,10 +97,10 @@ function handleChangePeaksMarkersVisibility(draft, data) {
|
|
|
96
97
|
exports.handleChangePeaksMarkersVisibility = handleChangePeaksMarkersVisibility;
|
|
97
98
|
function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
98
99
|
let refreshDomain = false;
|
|
99
|
-
const currentActiveSpectrum = draft
|
|
100
|
+
const currentActiveSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
100
101
|
if (activeSpectrum) {
|
|
101
102
|
const newIndex = draft.data.findIndex((d) => d.id === activeSpectrum.id);
|
|
102
|
-
const oldIndex = draft.data.findIndex((d) => d.id ===
|
|
103
|
+
const oldIndex = draft.data.findIndex((d) => d.id === currentActiveSpectrum?.id);
|
|
103
104
|
if (newIndex !== -1) {
|
|
104
105
|
const newActiveSpectrum = draft.data[newIndex];
|
|
105
106
|
newActiveSpectrum.display.isVisible = true;
|
|
@@ -113,8 +114,8 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
activeSpectrum = { ...activeSpectrum, index: newIndex };
|
|
116
|
-
draft.
|
|
117
|
-
|
|
117
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] =
|
|
118
|
+
activeSpectrum;
|
|
118
119
|
}
|
|
119
120
|
else {
|
|
120
121
|
if (currentActiveSpectrum) {
|
|
@@ -124,8 +125,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
124
125
|
else {
|
|
125
126
|
refreshDomain = false;
|
|
126
127
|
}
|
|
127
|
-
draft.
|
|
128
|
-
draft.tabActiveSpectrum[draft.activeTab] = null;
|
|
128
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] = null;
|
|
129
129
|
}
|
|
130
130
|
if (ToolTypes_1.options[draft.toolOptions.selectedTool].isFilter) {
|
|
131
131
|
draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
|
|
@@ -171,14 +171,18 @@ function handleDeleteSpectra(draft, action) {
|
|
|
171
171
|
else {
|
|
172
172
|
draft.data = [];
|
|
173
173
|
}
|
|
174
|
-
(0, ToolsActions_1.setActiveTab)(draft, {
|
|
174
|
+
(0, ToolsActions_1.setActiveTab)(draft, {
|
|
175
|
+
tab: draft.view.spectra.activeTab,
|
|
176
|
+
refreshActiveTab: true,
|
|
177
|
+
});
|
|
175
178
|
}
|
|
176
179
|
exports.handleDeleteSpectra = handleDeleteSpectra;
|
|
177
180
|
function addMissingProjectionHandler(draft, action) {
|
|
178
181
|
const state = (0, immer_1.original)(draft);
|
|
179
182
|
const { nucleus } = action;
|
|
180
|
-
|
|
181
|
-
|
|
183
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
184
|
+
if (activeSpectrum?.id) {
|
|
185
|
+
const { index } = activeSpectrum;
|
|
182
186
|
for (let n of nucleus) {
|
|
183
187
|
const datum1D = (0, Spectrum2D_1.getMissingProjection)(state.data[index], n, draft.usedColors);
|
|
184
188
|
draft.data.push(datum1D);
|
|
@@ -195,7 +199,7 @@ function alignSpectraHandler(draft, action) {
|
|
|
195
199
|
if (draft.data && draft.data.length > 0) {
|
|
196
200
|
for (let datum of draft.data) {
|
|
197
201
|
if (datum.info?.dimension === 1 &&
|
|
198
|
-
datum.info.nucleus === draft.activeTab &&
|
|
202
|
+
datum.info.nucleus === draft.view.spectra.activeTab &&
|
|
199
203
|
!datum.info?.isFid) {
|
|
200
204
|
const shift = (0, Spectrum1D_1.getReferenceShift)(datum, { ...action.payload });
|
|
201
205
|
(0, FiltersManager_1.applyFilter)(datum, [
|