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
|
@@ -5,10 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const ChartContext_1 = require("../context/ChartContext");
|
|
8
|
+
const Reducer_1 = require("../reducer/Reducer");
|
|
8
9
|
const nucleusToString_1 = __importDefault(require("../utility/nucleusToString"));
|
|
9
10
|
const emptyData = { info: {}, datum: {}, ftCounter: 0, fidCounter: 0 };
|
|
10
11
|
function useDatumWithSpectraStatistics() {
|
|
11
|
-
const { data,
|
|
12
|
+
const { data, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
13
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
12
14
|
return (0, react_1.useMemo)(() => {
|
|
13
15
|
if (data) {
|
|
14
16
|
let info = {};
|
|
@@ -12,7 +12,6 @@ const Alert_1 = require("../elements/popup/Alert");
|
|
|
12
12
|
const Modal_1 = require("../elements/popup/Modal");
|
|
13
13
|
const SaveAsModal_1 = __importDefault(require("../modal/SaveAsModal"));
|
|
14
14
|
const Export_1 = require("../utility/Export");
|
|
15
|
-
const nmriumToNmredata_1 = require("../utility/nmriumToNmredata");
|
|
16
15
|
function useExport() {
|
|
17
16
|
const { rootRef } = (0, GlobalContext_1.useGlobal)();
|
|
18
17
|
const modal = (0, Modal_1.useModal)();
|
|
@@ -43,20 +42,6 @@ function useExport() {
|
|
|
43
42
|
}, 0);
|
|
44
43
|
}
|
|
45
44
|
}, [alert, state]);
|
|
46
|
-
const saveAsNMREHandler = (0, react_1.useCallback)(async () => {
|
|
47
|
-
if (state.data.length > 0) {
|
|
48
|
-
const hideLoading = await alert.showLoading('Exporting as NMRE process in progress');
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
async function handle() {
|
|
51
|
-
const fileName = state.data[0]?.display?.name;
|
|
52
|
-
const exportedData = await (0, nmriumToNmredata_1.nmriumToNmredata)(state);
|
|
53
|
-
(0, Export_1.exportAsNMRE)(exportedData, fileName);
|
|
54
|
-
hideLoading();
|
|
55
|
-
}
|
|
56
|
-
void handle();
|
|
57
|
-
}, 0);
|
|
58
|
-
}
|
|
59
|
-
}, [alert, state]);
|
|
60
45
|
const saveAsSVGHandler = (0, react_1.useCallback)(async () => {
|
|
61
46
|
if (state.data.length > 0 && rootRef) {
|
|
62
47
|
const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
|
|
@@ -105,7 +90,6 @@ function useExport() {
|
|
|
105
90
|
return {
|
|
106
91
|
saveToClipboardHandler,
|
|
107
92
|
saveAsJSONHandler,
|
|
108
|
-
saveAsNMREHandler,
|
|
109
93
|
saveAsSVGHandler,
|
|
110
94
|
saveAsPNGHandler,
|
|
111
95
|
saveAsHandler,
|
|
@@ -4,10 +4,12 @@ const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const scale_1 = require("../1d/utilities/scale");
|
|
6
6
|
const ChartContext_1 = require("../context/ChartContext");
|
|
7
|
+
const Reducer_1 = require("../reducer/Reducer");
|
|
7
8
|
const PathBuilder_1 = require("../utility/PathBuilder");
|
|
8
9
|
const useXScale_1 = require("./useXScale");
|
|
9
10
|
function useIntegralYDomain() {
|
|
10
|
-
const { height, margin, verticalAlign,
|
|
11
|
+
const { height, margin, verticalAlign, integralsYDomains } = (0, ChartContext_1.useChartData)();
|
|
12
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
11
13
|
return (0, react_1.useMemo)(() => (0, scale_1.getIntegralYScale)({
|
|
12
14
|
height,
|
|
13
15
|
margin,
|
|
@@ -17,7 +19,8 @@ function useIntegralYDomain() {
|
|
|
17
19
|
}), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
|
|
18
20
|
}
|
|
19
21
|
function useIntegralPath(integralOptions) {
|
|
20
|
-
const { data
|
|
22
|
+
const { data } = (0, ChartContext_1.useChartData)();
|
|
23
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
21
24
|
const scaleX = (0, useXScale_1.useXScale)();
|
|
22
25
|
const scaleY = useIntegralYDomain();
|
|
23
26
|
const integral = (0, react_1.useMemo)(() => {
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const react_1 = require("react");
|
|
4
4
|
const ChartContext_1 = require("../context/ChartContext");
|
|
5
5
|
function useNucleus() {
|
|
6
|
-
const {
|
|
6
|
+
const { view: { spectra: { activeSpectra }, }, } = (0, ChartContext_1.useChartData)();
|
|
7
7
|
return (0, react_1.useMemo)(() => {
|
|
8
|
-
if (
|
|
9
|
-
return Object.keys(
|
|
8
|
+
if (activeSpectra && Object.keys(activeSpectra).length > 0) {
|
|
9
|
+
return Object.keys(activeSpectra);
|
|
10
10
|
}
|
|
11
11
|
return [];
|
|
12
|
-
}, [
|
|
12
|
+
}, [activeSpectra]);
|
|
13
13
|
}
|
|
14
14
|
exports.default = useNucleus;
|
|
@@ -7,7 +7,7 @@ const react_1 = require("react");
|
|
|
7
7
|
const ChartContext_1 = require("../context/ChartContext");
|
|
8
8
|
const nucleusToString_1 = __importDefault(require("../utility/nucleusToString"));
|
|
9
9
|
function useSpectraByActiveNucleus() {
|
|
10
|
-
const { data, activeTab } = (0, ChartContext_1.useChartData)();
|
|
10
|
+
const { data, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
11
11
|
return (0, react_1.useMemo)(() => {
|
|
12
12
|
if (data) {
|
|
13
13
|
return (data.filter((spectrum) => activeTab === (0, nucleusToString_1.default)(spectrum.info.nucleus)) || []);
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
4
|
const ChartContext_1 = require("../context/ChartContext");
|
|
5
|
+
const Reducer_1 = require("../reducer/Reducer");
|
|
5
6
|
function useSpectrum(defaultValue) {
|
|
6
|
-
const { data
|
|
7
|
+
const { data } = (0, ChartContext_1.useChartData)();
|
|
8
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
7
9
|
return (0, react_1.useMemo)(() => {
|
|
8
10
|
if (data && activeSpectrum && activeSpectrum.id) {
|
|
9
11
|
const datum = data.find((datum) => datum.id === activeSpectrum.id) || defaultValue;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
4
|
/** @jsxImportSource @emotion/react */
|
|
8
5
|
const react_1 = require("@emotion/react");
|
|
9
|
-
const
|
|
6
|
+
const filelist_utils_1 = require("filelist-utils");
|
|
10
7
|
const react_2 = require("react");
|
|
11
8
|
const react_dropzone_1 = require("react-dropzone");
|
|
12
9
|
const fa_1 = require("react-icons/fa");
|
|
13
10
|
const ChartContext_1 = require("../context/ChartContext");
|
|
14
11
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
15
12
|
const LoaderContext_1 = require("../context/LoaderContext");
|
|
16
|
-
const Alert_1 = require("../elements/popup/Alert");
|
|
17
13
|
const useCheckToolsVisibility_1 = require("../hooks/useCheckToolsVisibility");
|
|
18
14
|
const Types_1 = require("../reducer/types/Types");
|
|
19
|
-
const FileUtility_1 = require("../utility/FileUtility");
|
|
20
15
|
const style = (0, react_1.css) `
|
|
21
16
|
height: 100%;
|
|
22
17
|
background-color: #b5b5b599;
|
|
@@ -51,153 +46,23 @@ const containerStyle = (0, react_1.css) `
|
|
|
51
46
|
function DropZone(props) {
|
|
52
47
|
const { width, height } = (0, ChartContext_1.useChartData)();
|
|
53
48
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
54
|
-
const alert = (0, Alert_1.useAlert)();
|
|
55
49
|
const isToolEnabled = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
asBuffer: true,
|
|
69
|
-
});
|
|
70
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
71
|
-
const decoder = new TextDecoder('utf8');
|
|
72
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
73
|
-
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
throw new Error('You can add only one json file');
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
case FileUtility_1.FILES_TYPES.JDX:
|
|
81
|
-
case FileUtility_1.FILES_TYPES.DX: {
|
|
82
|
-
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
83
|
-
asBuffer: true,
|
|
84
|
-
});
|
|
85
|
-
dispatch({ type: Types_1.LOAD_JCAMP_FILE, files });
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case FileUtility_1.FILES_TYPES.JDF: {
|
|
89
|
-
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
90
|
-
asBuffer: true,
|
|
91
|
-
});
|
|
92
|
-
dispatch({ type: Types_1.LOAD_JDF_FILE, files });
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
default:
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
50
|
+
const loadFilesHandler = (0, react_2.useCallback)((files) => {
|
|
51
|
+
files.forEach((file) => {
|
|
52
|
+
Object.defineProperty(file, 'webkitRelativePath', { value: file.path });
|
|
53
|
+
});
|
|
54
|
+
(0, filelist_utils_1.fileCollectionFromFileList)(files)
|
|
55
|
+
.then((fileCollection) => {
|
|
56
|
+
dispatch({ type: Types_1.LOAD_DROP_FILES, fileCollection });
|
|
57
|
+
})
|
|
58
|
+
.catch((e) => {
|
|
59
|
+
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: false });
|
|
60
|
+
reportError(e);
|
|
61
|
+
});
|
|
99
62
|
}, [dispatch]);
|
|
100
|
-
const loadFilesHandler = (0, react_2.useCallback)(async (files) => {
|
|
101
|
-
const uniqueFileExtensions = [
|
|
102
|
-
...new Set(files.map((file) => (0, FileUtility_1.getFileExtension)(file.name))),
|
|
103
|
-
];
|
|
104
|
-
for (let extension of uniqueFileExtensions) {
|
|
105
|
-
const selectedFilesByExtensions = files.filter((file) => (0, FileUtility_1.getFileExtension)(file.name) === extension);
|
|
106
|
-
try {
|
|
107
|
-
switch (extension) {
|
|
108
|
-
case FileUtility_1.FILES_TYPES.MOL: {
|
|
109
|
-
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions);
|
|
110
|
-
dispatch({ type: Types_1.LOAD_MOL_FILE, files });
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
case FileUtility_1.FILES_TYPES.NMRIUM:
|
|
114
|
-
case FileUtility_1.FILES_TYPES.JSON:
|
|
115
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
116
|
-
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
117
|
-
asBuffer: true,
|
|
118
|
-
});
|
|
119
|
-
// InputFileFormat
|
|
120
|
-
const fileSignature = (0, FileUtility_1.getFileSignature)(files[0].binary);
|
|
121
|
-
if (fileSignature === FileUtility_1.FILES_SIGNATURES.ZIP) {
|
|
122
|
-
const unzipResult = await jszip_1.default.loadAsync(files[0].binary);
|
|
123
|
-
await loadSubFilesFromZip(Object.values(unzipResult.files), [
|
|
124
|
-
FileUtility_1.FILES_TYPES.NMRIUM,
|
|
125
|
-
]);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
const decoder = new TextDecoder('utf8');
|
|
129
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
130
|
-
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
throw new Error('You can add only one json file');
|
|
135
|
-
}
|
|
136
|
-
break;
|
|
137
|
-
case FileUtility_1.FILES_TYPES.JDX:
|
|
138
|
-
case FileUtility_1.FILES_TYPES.DX: {
|
|
139
|
-
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
140
|
-
asBuffer: true,
|
|
141
|
-
});
|
|
142
|
-
dispatch({ type: Types_1.LOAD_JCAMP_FILE, files });
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
case FileUtility_1.FILES_TYPES.JDF: {
|
|
146
|
-
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
147
|
-
asBuffer: true,
|
|
148
|
-
});
|
|
149
|
-
dispatch({ type: Types_1.LOAD_JDF_FILE, files });
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
case FileUtility_1.FILES_TYPES.ZIP: {
|
|
153
|
-
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
154
|
-
asBuffer: true,
|
|
155
|
-
});
|
|
156
|
-
for (const zipFile of files) {
|
|
157
|
-
const unzipResult = await jszip_1.default.loadAsync(zipFile.binary);
|
|
158
|
-
const uniqueFileExtensions = [
|
|
159
|
-
...new Set(Object.values(unzipResult.files).map((file) => (0, FileUtility_1.getFileExtension)(file.name))),
|
|
160
|
-
];
|
|
161
|
-
const isNotZip = uniqueFileExtensions.some((ex) => FileUtility_1.FILES_TYPES[ex.toUpperCase()] && ex !== FileUtility_1.FILES_TYPES.ZIP);
|
|
162
|
-
if (isNotZip) {
|
|
163
|
-
const hasBruker = Object.keys(unzipResult.files).some((path) => {
|
|
164
|
-
return ['2rr', 'fid', '1r'].some((brukerFile) => path.endsWith(brukerFile));
|
|
165
|
-
});
|
|
166
|
-
if (hasBruker)
|
|
167
|
-
dispatch({ type: Types_1.LOAD_ZIP_FILE, files });
|
|
168
|
-
await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
dispatch({ type: Types_1.LOAD_ZIP_FILE, files });
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
case FileUtility_1.FILES_TYPES.NMREDATA:
|
|
177
|
-
void (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
178
|
-
asBuffer: true,
|
|
179
|
-
}).then(async (files) => {
|
|
180
|
-
for (const zipFile of files) {
|
|
181
|
-
dispatch({
|
|
182
|
-
type: Types_1.LOAD_NMREDATA_FILE,
|
|
183
|
-
file: zipFile,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
break;
|
|
188
|
-
default:
|
|
189
|
-
throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
catch (e) {
|
|
193
|
-
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: false });
|
|
194
|
-
alert.error(e.message);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}, [alert, dispatch, loadSubFilesFromZip]);
|
|
198
63
|
const onDrop = (0, react_2.useCallback)((droppedFiles) => {
|
|
199
64
|
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
|
|
200
|
-
|
|
65
|
+
loadFilesHandler(droppedFiles);
|
|
201
66
|
}, [dispatch, loadFilesHandler]);
|
|
202
67
|
const isImportEnabled = isToolEnabled('import');
|
|
203
68
|
const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = (0, react_dropzone_1.useDropzone)({
|
|
@@ -46,7 +46,7 @@ const styles = (0, react_1.css) `
|
|
|
46
46
|
function SelectMolecule(props) {
|
|
47
47
|
const [currentIndex, setCurrentIndex] = (0, react_2.useState)();
|
|
48
48
|
const { setFieldValue, errors, values } = (0, formik_1.useFormikContext)();
|
|
49
|
-
const { molecules, activeTab } = (0, ChartContext_1.useChartData)();
|
|
49
|
+
const { molecules, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
50
50
|
const element = (0, getAtom_1.default)(activeTab);
|
|
51
51
|
const newSum = (0, react_2.useMemo)(() => {
|
|
52
52
|
return element &&
|
|
@@ -56,7 +56,7 @@ const styles = (0, react_1.css) `
|
|
|
56
56
|
`;
|
|
57
57
|
function EditRangeModal({ onSaveEditRangeModal = () => null, onCloseEditRangeModal = () => null, onZoomEditRangeModal = () => null, manualRange = false, range: originRange, }) {
|
|
58
58
|
const formRef = (0, react_2.useRef)(null);
|
|
59
|
-
const { activeTab } = (0, ChartContext_1.useChartData)();
|
|
59
|
+
const { view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
60
60
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
61
61
|
const rangesPreferences = (0, usePanelPreferences_1.usePanelPreferences)('ranges', activeTab);
|
|
62
62
|
const validation = (0, EditRangeValidation_1.default)();
|
|
@@ -7,6 +7,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const Label_1 = __importDefault(require("../../elements/Label"));
|
|
8
8
|
const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
|
|
9
9
|
function GeneralTabContent() {
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("p", { className: "section-header", children: "Spectra" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("p", { className: "section-header", children: "Spectra" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "general.dimmedSpectraOpacity", checkValue: (value) => value >= 0 && value <= 1, type: "number" }) })] }));
|
|
11
11
|
}
|
|
12
12
|
exports.default = GeneralTabContent;
|
|
@@ -115,7 +115,7 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
|
115
115
|
const MemoizedIntegralPanel = (0, react_2.memo)(IntegralPanelInner);
|
|
116
116
|
const emptyData = { integrals: {}, info: {} };
|
|
117
117
|
function IntegralPanel() {
|
|
118
|
-
const { xDomain, activeTab } = (0, ChartContext_1.useChartData)();
|
|
118
|
+
const { xDomain, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
119
119
|
const { integrals, info } = (0, useSpectrum_1.default)(emptyData);
|
|
120
120
|
return ((0, jsx_runtime_1.jsx)(MemoizedIntegralPanel, { ...{
|
|
121
121
|
integrals,
|
|
@@ -39,6 +39,6 @@ function MoleculeHeader(props) {
|
|
|
39
39
|
const label = event.target.value;
|
|
40
40
|
dispatch({ type: Types_1.CHANGE_MOLECULE_LABEL, payload: { label, id } });
|
|
41
41
|
}, [dispatch]);
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: styles.toolbar, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)("span", { children: "Label" }), (0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event) })] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: styles.toolbar, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)("span", { children: "Label" }), (0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event), textOverFlowEllipses: true })] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
|
|
43
43
|
}
|
|
44
44
|
exports.default = MoleculeHeader;
|
|
@@ -92,7 +92,7 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, floatingM
|
|
|
92
92
|
const MemoizedMoleculePanel = (0, react_2.memo)(MoleculePanelInner);
|
|
93
93
|
const emptyData = { ranges: {}, zones: {} };
|
|
94
94
|
function MoleculePanel({ onMoleculeChange, children, actionsOptions, emptyTextStyle, }) {
|
|
95
|
-
const { molecules, view: { floatingMolecules },
|
|
95
|
+
const { molecules, view: { floatingMolecules, spectra: { activeTab }, }, displayerMode, } = (0, ChartContext_1.useChartData)();
|
|
96
96
|
const data = (0, useSpectrum_1.default)(emptyData);
|
|
97
97
|
const ranges = data?.ranges || {};
|
|
98
98
|
const zones = data?.zones || {};
|
package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js
CHANGED
|
@@ -87,7 +87,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectraAnalysis, }) {
|
|
|
87
87
|
}
|
|
88
88
|
const MemoizedMultipleSpectraAnalysisPanel = (0, react_2.memo)(MultipleSpectraAnalysisPanelInner);
|
|
89
89
|
function MultipleSpectraAnalysisPanel() {
|
|
90
|
-
const { activeTab, spectraAnalysis, displayerKey } = (0, ChartContext_1.useChartData)();
|
|
90
|
+
const { view: { spectra: { activeTab }, }, spectraAnalysis, displayerKey, } = (0, ChartContext_1.useChartData)();
|
|
91
91
|
if (!activeTab) {
|
|
92
92
|
return (0, jsx_runtime_1.jsx)("div", {});
|
|
93
93
|
}
|
|
@@ -114,7 +114,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksOptions, }) {
|
|
|
114
114
|
const MemoizedPeaksPanel = (0, react_2.memo)(PeaksPanelInner);
|
|
115
115
|
const emptyData = { peaks: null, info: {} };
|
|
116
116
|
function PeaksPanel() {
|
|
117
|
-
const { xDomain, activeTab, toolOptions: { data: { peaksOptions }, }, } = (0, ChartContext_1.useChartData)();
|
|
117
|
+
const { xDomain, view: { spectra: { activeTab }, }, toolOptions: { data: { peaksOptions }, }, } = (0, ChartContext_1.useChartData)();
|
|
118
118
|
const { peaks, info } = (0, useSpectrum_1.default)(emptyData);
|
|
119
119
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
120
120
|
return ((0, jsx_runtime_1.jsx)(MemoizedPeaksPanel, { ...{ peaks, info, xDomain, activeTab, preferences, peaksOptions } }));
|
|
@@ -41,7 +41,7 @@ function PeaksTable({ activeTab, data }) {
|
|
|
41
41
|
});
|
|
42
42
|
}, [modal, peaksPreferences]);
|
|
43
43
|
const saveDeltaPPMRefsHandler = (0, react_1.useCallback)((event, row) => {
|
|
44
|
-
const shiftValue = parseFloat(event.target.value) - parseFloat(row.
|
|
44
|
+
const shiftValue = parseFloat(event.target.value) - parseFloat(row.x);
|
|
45
45
|
dispatch({ type: Types_1.SHIFT_SPECTRUM, shiftValue });
|
|
46
46
|
}, [dispatch]);
|
|
47
47
|
const COLUMNS = (0, react_1.useMemo)(() => [
|
|
@@ -14,6 +14,7 @@ const fa_1 = require("react-icons/fa");
|
|
|
14
14
|
const im_1 = require("react-icons/im");
|
|
15
15
|
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
16
16
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
17
|
+
const ActiveButton_1 = __importDefault(require("../../elements/ActiveButton"));
|
|
17
18
|
const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
|
|
18
19
|
const ToggleButton_1 = __importDefault(require("../../elements/ToggleButton"));
|
|
19
20
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
@@ -44,7 +45,7 @@ const style = (0, react_1.css) `
|
|
|
44
45
|
margin-right: 2px;
|
|
45
46
|
}
|
|
46
47
|
`;
|
|
47
|
-
function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, activeTab, }) {
|
|
48
|
+
function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, activeTab, }) {
|
|
48
49
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
49
50
|
const modal = (0, Modal_1.useModal)();
|
|
50
51
|
const alert = (0, Alert_1.useAlert)();
|
|
@@ -87,14 +88,14 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
87
88
|
});
|
|
88
89
|
}, [assignmentData, dispatch, modal]);
|
|
89
90
|
const handleSetShowMultiplicityTrees = (0, react_2.useCallback)(() => {
|
|
90
|
-
dispatch({ type: Types_1.SHOW_MULTIPLICTY_TREES });
|
|
91
|
-
}, [dispatch]);
|
|
91
|
+
dispatch({ type: Types_1.SHOW_MULTIPLICTY_TREES, payload: { id } });
|
|
92
|
+
}, [dispatch, id]);
|
|
92
93
|
const handleShowIntegrals = (0, react_2.useCallback)(() => {
|
|
93
|
-
dispatch({ type: Types_1.SHOW_RANGES_INTEGRALS });
|
|
94
|
-
}, [dispatch]);
|
|
94
|
+
dispatch({ type: Types_1.SHOW_RANGES_INTEGRALS, payload: { id } });
|
|
95
|
+
}, [dispatch, id]);
|
|
95
96
|
const handleShowJGraph = (0, react_2.useCallback)(() => {
|
|
96
|
-
dispatch({ type: Types_1.SHOW_J_GRAPH });
|
|
97
|
-
}, [dispatch]);
|
|
97
|
+
dispatch({ type: Types_1.SHOW_J_GRAPH, payload: { id } });
|
|
98
|
+
}, [dispatch, id]);
|
|
98
99
|
const saveToClipboardHandler = (0, react_2.useCallback)((value) => {
|
|
99
100
|
void (async () => {
|
|
100
101
|
const success = await (0, Export_1.copyHTMLToClipboard)(value);
|
|
@@ -141,8 +142,8 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
141
142
|
}, [dispatch, editRange]);
|
|
142
143
|
return ((0, jsx_runtime_1.jsx)("div", { css: style, children: (0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { counter: ranges?.values?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', filterIsActive: isFilterActive, counterFiltered: filterCounter, showSettingButton: true, onSettingClick: onSettingClick, children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Preview publication string", popupPlacement: "right", onClick: saveAsHTMLHandler, className: "btn preview-publication-icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: currentSum
|
|
143
144
|
? `Change Ranges Sum (${Number(currentSum).toFixed(2)})`
|
|
144
|
-
: 'Change Ranges Sum', popupPlacement: "right", onClick: showChangeRangesSumModal, className: "btn icon", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSum, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Remove all Assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !ranges || !ranges.values || ranges.values.length === 0, className: "btn icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}) }), (0, jsx_runtime_1.jsx)(
|
|
145
|
+
: 'Change Ranges Sum', popupPlacement: "right", onClick: showChangeRangesSumModal, className: "btn icon", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSum, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Remove all Assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !ranges || !ranges.values || ranges.values.length === 0, className: "btn icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: showMultiplicityTrees
|
|
145
146
|
? 'Hide Multiplicity Trees in Spectrum'
|
|
146
|
-
: 'Show Multiplicity Trees in Spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, disabled: !ranges || !ranges.values || ranges.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(
|
|
147
|
+
: 'Show Multiplicity Trees in Spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !ranges || !ranges.values || ranges.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !ranges || !ranges.values || ranges.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: showRangesIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showRangesIntegrals, disabled: !ranges || !ranges.values || ranges.values.length === 0, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { className: "icon", popupTitle: "fix integral values", popupPlacement: "right", onClick: changeSumConstantFlagHandler, children: (0, jsx_runtime_1.jsx)(im_1.ImLink, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Add range", popupPlacement: "right", onClick: addRangeHandler, className: "btn icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) })] }) }));
|
|
147
148
|
}
|
|
148
149
|
exports.default = RangesHeader;
|
|
@@ -14,6 +14,7 @@ const DispatchContext_1 = require("../../context/DispatchContext");
|
|
|
14
14
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
15
15
|
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
16
16
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
17
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
17
18
|
const Types_1 = require("../../reducer/types/Types");
|
|
18
19
|
const Export_1 = require("../../utility/Export");
|
|
19
20
|
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
@@ -22,7 +23,7 @@ const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader
|
|
|
22
23
|
const RangesHeader_1 = __importDefault(require("./RangesHeader"));
|
|
23
24
|
const RangesPreferences_1 = __importDefault(require("./RangesPreferences"));
|
|
24
25
|
const RangesTable_1 = __importDefault(require("./RangesTable"));
|
|
25
|
-
function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activeTab, molecules, showMultiplicityTrees, showJGraph, showRangesIntegrals, }) {
|
|
26
|
+
function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, activeTab, molecules, showMultiplicityTrees, showJGraph, showRangesIntegrals, }) {
|
|
26
27
|
const [isFilterActive, setFilterIsActive] = (0, react_2.useState)(false);
|
|
27
28
|
const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
|
|
28
29
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
@@ -112,6 +113,7 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
|
|
|
112
113
|
}
|
|
113
114
|
`,
|
|
114
115
|
], children: [!isFlipped && ((0, jsx_runtime_1.jsx)(RangesHeader_1.default, { ...{
|
|
116
|
+
id,
|
|
115
117
|
ranges,
|
|
116
118
|
info,
|
|
117
119
|
activeTab,
|
|
@@ -125,10 +127,12 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
|
|
|
125
127
|
const MemoizedRangesTablePanel = (0, react_2.memo)(RangesTablePanelInner);
|
|
126
128
|
const emptyData = { ranges: {}, data: {}, info: {} };
|
|
127
129
|
function RangesTablePanel() {
|
|
128
|
-
const {
|
|
129
|
-
const {
|
|
130
|
+
const { ranges, data, info, id } = (0, useSpectrum_1.default)(emptyData);
|
|
131
|
+
const { displayerKey, xDomain, view: { spectra: { activeTab }, }, molecules, toolOptions: { selectedTool }, view: { ranges: rangeState }, } = (0, ChartContext_1.useChartData)();
|
|
132
|
+
const { showMultiplicityTrees, showRangesIntegrals, showJGraph } = (0, react_2.useMemo)(() => rangeState.find((r) => r.spectrumID === id) || Reducer_1.rangeStateInit, [id, rangeState]);
|
|
130
133
|
const rangesPreferences = (0, usePanelPreferences_1.usePanelPreferences)('ranges', activeTab);
|
|
131
134
|
return ((0, jsx_runtime_1.jsx)(MemoizedRangesTablePanel, { ...{
|
|
135
|
+
id,
|
|
132
136
|
ranges,
|
|
133
137
|
data,
|
|
134
138
|
info,
|
|
@@ -12,6 +12,7 @@ const DispatchContext_1 = require("../../context/DispatchContext");
|
|
|
12
12
|
const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
|
|
13
13
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
14
14
|
const Modal_1 = require("../../elements/popup/Modal");
|
|
15
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
15
16
|
const Constants_1 = require("../../reducer/core/Constants");
|
|
16
17
|
const Types_1 = require("../../reducer/types/Types");
|
|
17
18
|
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
@@ -74,7 +75,8 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMod
|
|
|
74
75
|
}
|
|
75
76
|
const MemoizedSpectraPanelHeader = (0, react_1.memo)(SpectraPanelHeaderInner);
|
|
76
77
|
function SpectrumsTabs({ spectrums }) {
|
|
77
|
-
const { data,
|
|
78
|
+
const { data, view: { spectra: { activeTab }, }, displayerMode, } = (0, ChartContext_1.useChartData)();
|
|
79
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
78
80
|
return ((0, jsx_runtime_1.jsx)(MemoizedSpectraPanelHeader, { ...{
|
|
79
81
|
data,
|
|
80
82
|
activeSpectrum,
|
|
@@ -12,6 +12,7 @@ const ContextMenu_1 = __importDefault(require("../../elements/ContextMenu"));
|
|
|
12
12
|
const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
|
|
13
13
|
const Tabs_1 = __importDefault(require("../../elements/Tab/Tabs"));
|
|
14
14
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
15
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
15
16
|
const Types_1 = require("../../reducer/types/Types");
|
|
16
17
|
const Export_1 = require("../../utility/Export");
|
|
17
18
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
@@ -133,7 +134,8 @@ function SpectrumsTabsInner({ data, activeSpectrum, activeTab, onTabChange, }) {
|
|
|
133
134
|
}
|
|
134
135
|
const MemoizedSpectra = (0, react_1.memo)(SpectrumsTabsInner);
|
|
135
136
|
function SpectrumsTabs({ onTabChange }) {
|
|
136
|
-
const { data,
|
|
137
|
+
const { data, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
138
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
137
139
|
return ((0, jsx_runtime_1.jsx)(MemoizedSpectra, { ...{ data, activeSpectrum, activeTab, onTabChange } }));
|
|
138
140
|
}
|
|
139
141
|
exports.default = SpectrumsTabs;
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processSnapPlot = void 0;
|
|
4
4
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
const calculateSanPlot_1 = require("../../../../../data/utilities/calculateSanPlot");
|
|
5
6
|
function processSnapPlot(dimension, data, yLogBase) {
|
|
6
|
-
const
|
|
7
|
-
? prepare1DData(data)
|
|
8
|
-
: prepare2DData(data);
|
|
9
|
-
const sanResult = (0, ml_spectra_processing_1.xNoiseSanPlot)(input);
|
|
7
|
+
const sanResult = (0, calculateSanPlot_1.calculateSanPlot)(dimension, data);
|
|
10
8
|
const sanPlot = {};
|
|
11
9
|
const lines = {};
|
|
12
10
|
for (let plotKey in sanResult.sanplot) {
|
|
@@ -21,27 +19,6 @@ function processSnapPlot(dimension, data, yLogBase) {
|
|
|
21
19
|
return { sanPlot, lines };
|
|
22
20
|
}
|
|
23
21
|
exports.processSnapPlot = processSnapPlot;
|
|
24
|
-
function prepare1DData(data) {
|
|
25
|
-
const length = data.re.length;
|
|
26
|
-
const jump = Math.floor(length / 307200) || 1;
|
|
27
|
-
const array = new Float64Array((length / jump) >> 0);
|
|
28
|
-
let index = 0;
|
|
29
|
-
for (let i = 0; i < array.length; i += jump) {
|
|
30
|
-
array[index++] = data.re[i];
|
|
31
|
-
}
|
|
32
|
-
return array;
|
|
33
|
-
}
|
|
34
|
-
function prepare2DData(data) {
|
|
35
|
-
let cols = data.z[0].length;
|
|
36
|
-
let rows = data.z.length;
|
|
37
|
-
let jump = Math.floor((cols * rows) / 204800) || 1;
|
|
38
|
-
const array = new Float64Array(((cols * rows) / jump) >> 0);
|
|
39
|
-
let index = 0;
|
|
40
|
-
for (let i = 0; i < array.length; i += jump) {
|
|
41
|
-
array[index++] = data.z[(i / rows) >> 0][i % rows];
|
|
42
|
-
}
|
|
43
|
-
return array;
|
|
44
|
-
}
|
|
45
22
|
function getLine(value, data, options) {
|
|
46
23
|
const { log10, abs } = Math;
|
|
47
24
|
const { yLogBase } = options;
|
|
@@ -58,7 +58,7 @@ const panelStyle = (0, react_1.css) `
|
|
|
58
58
|
}
|
|
59
59
|
`;
|
|
60
60
|
function SummaryPanel() {
|
|
61
|
-
const { molecules, correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, activeTab, } = (0, ChartContext_1.useChartData)();
|
|
61
|
+
const { molecules, correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
62
62
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
63
63
|
const modal = (0, Modal_1.useModal)();
|
|
64
64
|
const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
4
|
const ChartContext_1 = require("../../../context/ChartContext");
|
|
5
|
+
const Reducer_1 = require("../../../reducer/Reducer");
|
|
5
6
|
const Utilities_1 = require("./Utilities");
|
|
6
7
|
function useInView({ correlation }) {
|
|
7
|
-
const { data: spectraData, xDomain, yDomain, displayerMode, activeTab,
|
|
8
|
+
const { data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
9
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
8
10
|
return (0, react_1.useMemo)(() => (0, Utilities_1.isInView)(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation), [
|
|
9
11
|
activeSpectrum,
|
|
10
12
|
activeTab,
|