nmrium 0.37.0 → 0.38.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/FooterBanner.js +1 -1
- package/lib/component/1d/Viewer1D.js +26 -21
- package/lib/component/1d/integral/Integral.d.ts +2 -6
- package/lib/component/1d/integral/IntegralResizable.d.ts +2 -6
- package/lib/component/1d/integral/IntegralResizable.js +2 -3
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
- package/lib/component/1d/peaks/PeakAnnotation.js +1 -2
- package/lib/component/1d/ranges/Range.js +9 -8
- package/lib/component/1d/ranges/Ranges.js +5 -7
- package/lib/component/1d/tool/BaseLineZones.js +1 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
- package/lib/component/2d/1d-tracer/Left1DChart.js +1 -1
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
- package/lib/component/2d/Chart2D.js +1 -1
- package/lib/component/2d/Viewer2D.js +10 -9
- package/lib/component/2d/fid/FidCanvas.js +4 -6
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/2d/utilities/DimensionLayout.d.ts +9 -24
- package/lib/component/2d/utilities/scale.d.ts +2 -1
- package/lib/component/2d/utilities/scale.js +1 -1
- package/lib/component/2d/zones/Zones.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +28 -21
- package/lib/component/NMRium.js +15 -7
- package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
- package/lib/component/context/DispatchContext.d.ts +23 -3
- package/lib/component/context/DispatchContext.js +1 -1
- package/lib/component/context/LoggerContext.js +1 -1
- package/lib/component/elements/Button.js +7 -9
- package/lib/component/elements/IsotopesViewer.js +1 -1
- package/lib/component/elements/ReactTable/ReactTable.js +1 -2
- package/lib/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib/component/elements/formik/FormikColorInput.js +1 -1
- package/lib/component/elements/formik/FormikColorPicker.js +1 -1
- package/lib/component/elements/formik/FormikColumnFormatField.js +1 -1
- package/lib/component/elements/formik/FormikInput.js +1 -1
- package/lib/component/elements/formik/FormikSelect.js +2 -2
- package/lib/component/elements/formik/FormikSlider.js +1 -1
- package/lib/component/elements/formik/FormikTextarea.js +2 -2
- package/lib/component/header/ApodizationOptionsPanel.js +4 -5
- package/lib/component/header/AutoPeakPickingOptionPanel.js +1 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +4 -5
- package/lib/component/header/Header.js +4 -6
- package/lib/component/header/PhaseCorrectionPanel.js +7 -8
- package/lib/component/header/RangesPickingOptionPanel.js +1 -2
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -11
- package/lib/component/header/Zones2DOptionPanel.js +5 -6
- package/lib/component/hooks/useExport.js +1 -0
- package/lib/component/hooks/useToolsFunctions.js +8 -10
- package/lib/component/loader/DropZone.js +4 -5
- package/lib/component/loader/NoData.js +1 -1
- package/lib/component/modal/AlignSpectraModal.js +1 -2
- package/lib/component/modal/EditPeakShapeModal.js +1 -2
- package/lib/component/modal/ImportPublicationStringModal.js +1 -2
- package/lib/component/modal/LoadJCAMPModal.js +2 -3
- package/lib/component/modal/MoleculeStructureEditorModal.js +24 -19
- package/lib/component/modal/PredictSpectraModal.js +24 -21
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +3 -4
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -3
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
- package/lib/component/panels/InformationPanel.js +6 -6
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -10
- package/lib/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
- package/lib/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -5
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +4 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +4 -5
- package/lib/component/panels/PeaksPanel/PeaksTable.js +4 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +12 -15
- package/lib/component/panels/RangesPanel/RangesPanel.js +24 -29
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
- package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -34
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +2 -13
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +15 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -51
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +3 -3
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +16 -0
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +52 -0
- package/lib/component/panels/databasePanel/DatabasePanel.js +9 -7
- package/lib/component/panels/filtersPanel/FilterPanel.js +1 -2
- package/lib/component/panels/filtersPanel/FiltersTable.js +8 -9
- package/lib/component/panels/header/DefaultPanelHeader.js +1 -1
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
- package/lib/component/panels/predictionPanel/PredictionPanel.js +4 -5
- package/lib/component/reducer/IgnoreActions.d.ts +2 -1
- package/lib/component/reducer/IgnoreActions.js +35 -32
- package/lib/component/reducer/Reducer.d.ts +8 -5
- package/lib/component/reducer/Reducer.js +199 -221
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +7 -6
- package/lib/component/reducer/actions/AssignmentsActions.js +2 -2
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +21 -13
- package/lib/component/reducer/actions/CorrelationsActions.js +25 -20
- package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -2
- package/lib/component/reducer/actions/DatabaseActions.js +5 -2
- package/lib/component/reducer/actions/DimensionsActions.d.ts +8 -3
- package/lib/component/reducer/actions/DimensionsActions.js +3 -5
- package/lib/component/reducer/actions/DomainActions.d.ts +11 -5
- package/lib/component/reducer/actions/DomainActions.js +13 -19
- package/lib/component/reducer/actions/FiltersActions.d.ts +70 -23
- package/lib/component/reducer/actions/FiltersActions.js +250 -255
- package/lib/component/reducer/actions/GlobalActions.d.ts +7 -2
- package/lib/component/reducer/actions/GlobalActions.js +3 -3
- package/lib/component/reducer/actions/IntegralsActions.d.ts +28 -7
- package/lib/component/reducer/actions/IntegralsActions.js +16 -15
- package/lib/component/reducer/actions/LoadActions.d.ts +23 -5
- package/lib/component/reducer/actions/LoadActions.js +52 -52
- package/lib/component/reducer/actions/MoleculeActions.d.ts +38 -9
- package/lib/component/reducer/actions/MoleculeActions.js +27 -18
- package/lib/component/reducer/actions/PeaksActions.d.ts +39 -8
- package/lib/component/reducer/actions/PeaksActions.js +19 -11
- package/lib/component/reducer/actions/PreferencesActions.d.ts +8 -3
- package/lib/component/reducer/actions/PreferencesActions.js +5 -3
- package/lib/component/reducer/actions/RangesActions.d.ts +85 -18
- package/lib/component/reducer/actions/RangesActions.js +80 -65
- package/lib/component/reducer/actions/SpectraAnalysisAction.d.ts +7 -1
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +57 -24
- package/lib/component/reducer/actions/SpectrumsActions.js +69 -60
- package/lib/component/reducer/actions/ToolsActions.d.ts +59 -21
- package/lib/component/reducer/actions/ToolsActions.js +54 -32
- package/lib/component/reducer/actions/ZonesActions.d.ts +79 -15
- package/lib/component/reducer/actions/ZonesActions.js +68 -49
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +6 -5
- package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -2
- package/lib/component/reducer/helper/get2DRange.d.ts +7 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/types/ActionType.d.ts +6 -0
- package/lib/component/reducer/types/ActionType.js +1 -0
- package/lib/component/toolbar/BasicToolBar.js +6 -9
- package/lib/component/toolbar/FunctionToolBar.js +4 -9
- package/lib/component/toolbar/ToolBar.js +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts +2 -2
- package/lib/component/utility/Events.d.ts +4 -4
- package/lib/component/utility/Events.js +2 -2
- package/lib/component/utility/GroupByInfoKey.js +1 -1
- package/lib/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib/data/PredictionManager.d.ts +5 -8
- package/lib/data/PredictionManager.js +3 -3
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.d.ts +2 -3
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +5 -3
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -35
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +2 -35
- package/lib/data/data1d/filter1d/baselineCorrection.d.ts +7 -10
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.d.ts +5 -1
- package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/zones/mapZones.d.ts +2 -0
- package/lib/data/matrixGeneration.js +4 -2
- package/lib/data/molecules/Molecule.d.ts +3 -3
- package/lib/data/molecules/MoleculeManager.d.ts +5 -5
- package/lib/data/molecules/MoleculeManager.js +1 -1
- package/lib/data/utilities/generateColor.js +1 -1
- package/lib/data/utilities/isNumber.d.ts +1 -0
- package/lib/data/utilities/isNumber.js +3 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +25 -20
- package/lib-cjs/component/1d/integral/IntegralResizable.js +2 -3
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -2
- package/lib-cjs/component/1d/ranges/Range.js +9 -8
- package/lib-cjs/component/1d/ranges/Ranges.js +5 -7
- package/lib-cjs/component/1d/tool/BaseLineZones.js +1 -2
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
- package/lib-cjs/component/2d/1d-tracer/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
- package/lib-cjs/component/2d/Chart2D.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +10 -9
- package/lib-cjs/component/2d/fid/FidCanvas.js +4 -6
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/2d/utilities/scale.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +28 -21
- package/lib-cjs/component/NMRium.js +15 -7
- package/lib-cjs/component/context/DispatchContext.js +1 -1
- package/lib-cjs/component/context/LoggerContext.js +1 -1
- package/lib-cjs/component/elements/Button.js +7 -9
- package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +1 -2
- package/lib-cjs/component/elements/Tab/Tabs.js +1 -1
- package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColorInput.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +1 -1
- package/lib-cjs/component/elements/formik/FormikInput.js +1 -1
- package/lib-cjs/component/elements/formik/FormikSelect.js +2 -2
- package/lib-cjs/component/elements/formik/FormikSlider.js +1 -1
- package/lib-cjs/component/elements/formik/FormikTextarea.js +2 -2
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +3 -4
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +1 -2
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +4 -5
- package/lib-cjs/component/header/Header.js +4 -6
- package/lib-cjs/component/header/PhaseCorrectionPanel.js +7 -8
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +1 -2
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -11
- package/lib-cjs/component/header/Zones2DOptionPanel.js +5 -6
- package/lib-cjs/component/highlight/index.js +1 -1
- package/lib-cjs/component/hooks/useExport.js +1 -0
- package/lib-cjs/component/hooks/useTableSortBy.js +1 -1
- package/lib-cjs/component/hooks/useToolsFunctions.js +8 -10
- package/lib-cjs/component/hooks/useXYReduce.js +1 -1
- package/lib-cjs/component/loader/DropZone.js +4 -5
- package/lib-cjs/component/loader/NoData.js +1 -1
- package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
- package/lib-cjs/component/modal/EditPeakShapeModal.js +1 -2
- package/lib-cjs/component/modal/ImportPublicationStringModal.js +1 -2
- package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -3
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -19
- package/lib-cjs/component/modal/PredictSpectraModal.js +24 -21
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -4
- package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +2 -3
- package/lib-cjs/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
- package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
- package/lib-cjs/component/panels/InformationPanel.js +6 -6
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -10
- package/lib-cjs/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
- package/lib-cjs/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
- package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -5
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +2 -2
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
- package/lib-cjs/component/panels/Panels.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -5
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +4 -5
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +12 -15
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +24 -29
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +39 -34
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +15 -18
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +2 -51
- package/lib-cjs/component/panels/ZonesPanel/hooks/useMapZones.js +56 -0
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +8 -6
- package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -2
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +8 -9
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -1
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +4 -5
- package/lib-cjs/component/reducer/IgnoreActions.js +35 -55
- package/lib-cjs/component/reducer/Reducer.js +199 -221
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +3 -3
- package/lib-cjs/component/reducer/actions/CorrelationsActions.js +23 -18
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +4 -1
- package/lib-cjs/component/reducer/actions/DimensionsActions.js +3 -6
- package/lib-cjs/component/reducer/actions/DomainActions.js +15 -23
- package/lib-cjs/component/reducer/actions/FiltersActions.js +267 -272
- package/lib-cjs/component/reducer/actions/GlobalActions.js +4 -4
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +19 -18
- package/lib-cjs/component/reducer/actions/LoadActions.js +55 -55
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +31 -22
- package/lib-cjs/component/reducer/actions/PeaksActions.js +23 -15
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +7 -5
- package/lib-cjs/component/reducer/actions/RangesActions.js +81 -64
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +77 -67
- package/lib-cjs/component/reducer/actions/ToolsActions.js +54 -31
- package/lib-cjs/component/reducer/actions/ZonesActions.js +73 -52
- package/lib-cjs/component/reducer/core/Constants.js +1 -1
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -2
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -2
- package/lib-cjs/component/reducer/types/ActionType.js +2 -0
- package/lib-cjs/component/toolbar/BasicToolBar.js +6 -9
- package/lib-cjs/component/toolbar/FunctionToolBar.js +4 -9
- package/lib-cjs/component/toolbar/ToolBar.js +1 -1
- package/lib-cjs/component/utility/GroupByInfoKey.js +1 -1
- package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib-cjs/data/PredictionManager.js +3 -3
- package/lib-cjs/data/SpectraManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
- package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +2 -2
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
- package/lib-cjs/data/matrixGeneration.js +4 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
- package/lib-cjs/data/utilities/generateColor.js +1 -1
- package/lib-cjs/data/utilities/isNumber.js +7 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +24 -23
- package/lib/component/reducer/actions/HistoryActions.d.ts +0 -4
- package/lib/component/reducer/actions/HistoryActions.js +0 -40
- package/lib/component/reducer/types/HistoryTypes.d.ts +0 -4
- package/lib/component/reducer/types/HistoryTypes.js +0 -4
- package/lib/component/reducer/types/Types.d.ts +0 -132
- package/lib/component/reducer/types/Types.js +0 -126
- package/lib/component/toolbar/HistoryToolBar.d.ts +0 -8
- package/lib/component/toolbar/HistoryToolBar.js +0 -30
- package/lib/data/utilities/isMolFileEmpty.d.ts +0 -1
- package/lib/data/utilities/isMolFileEmpty.js +0 -6
- package/lib-cjs/component/reducer/actions/HistoryActions.js +0 -45
- package/lib-cjs/component/reducer/types/HistoryTypes.js +0 -7
- package/lib-cjs/component/reducer/types/Types.js +0 -131
- package/lib-cjs/component/toolbar/HistoryToolBar.js +0 -35
- package/lib-cjs/data/utilities/isMolFileEmpty.js +0 -10
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { Integral } from 'nmr-load-save';
|
|
3
|
+
import { SetSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
2
4
|
import { State } from '../Reducer';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { ActionType } from '../types/ActionType';
|
|
6
|
+
type ChangeIntegralSumAction = ActionType<'CHANGE_INTEGRAL_SUM', {
|
|
7
|
+
options: SetSumOptions;
|
|
8
|
+
}>;
|
|
9
|
+
type AddIntegralAction = ActionType<'ADD_INTEGRAL', {
|
|
10
|
+
startX: number;
|
|
11
|
+
endX: number;
|
|
12
|
+
}>;
|
|
13
|
+
type DeleteIntegralAction = ActionType<'DELETE_INTEGRAL', {
|
|
14
|
+
id?: string;
|
|
15
|
+
}>;
|
|
16
|
+
type ChangeIntegralAction = ActionType<'CHANGE_INTEGRAL' | 'RESIZE_INTEGRAL', {
|
|
17
|
+
integral: Integral;
|
|
18
|
+
}>;
|
|
19
|
+
type ChangeIntegralRelativeValueAction = ActionType<'CHANGE_INTEGRAL_RELATIVE', {
|
|
20
|
+
id: string;
|
|
21
|
+
value: number;
|
|
22
|
+
}>;
|
|
23
|
+
export type IntegralsActions = ChangeIntegralSumAction | AddIntegralAction | DeleteIntegralAction | ChangeIntegralAction | ChangeIntegralRelativeValueAction | ActionType<'CHANGE_INTEGRALS_SUM_FLAG'>;
|
|
24
|
+
declare function handleChangeIntegralSum(draft: Draft<State>, action: ChangeIntegralSumAction): void;
|
|
25
|
+
declare function handleAddIntegral(draft: Draft<State>, action: AddIntegralAction): void;
|
|
26
|
+
declare function handleDeleteIntegral(draft: Draft<State>, action: DeleteIntegralAction): void;
|
|
27
|
+
declare function handleChangeIntegral(draft: Draft<State>, action: ChangeIntegralAction): void;
|
|
28
|
+
declare function handleChangeIntegralsRelativeValue(draft: Draft<State>, action: ChangeIntegralRelativeValueAction): void;
|
|
29
|
+
declare function handleChangeIntegralsSumFlag(draft: any): void;
|
|
30
|
+
export { handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
|
|
@@ -6,7 +6,8 @@ import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/
|
|
|
6
6
|
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
7
7
|
import getRange from '../helper/getRange';
|
|
8
8
|
import { setIntegralsYDomain } from './DomainActions';
|
|
9
|
-
function handleChangeIntegralSum(draft,
|
|
9
|
+
function handleChangeIntegralSum(draft, action) {
|
|
10
|
+
const { options } = action.payload;
|
|
10
11
|
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
11
12
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
12
13
|
if (activeSpectrum?.id) {
|
|
@@ -16,8 +17,8 @@ function handleChangeIntegralSum(draft, options) {
|
|
|
16
17
|
updateIntegralsRelativeValues(datum, true);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
const { startX, endX } = action;
|
|
20
|
+
function handleAddIntegral(draft, action) {
|
|
21
|
+
const { startX, endX } = action.payload;
|
|
21
22
|
const { data, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
22
23
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
23
24
|
const [from, to] = getRange(draft, { startX, endX });
|
|
@@ -43,14 +44,14 @@ function addIntegral(draft, action) {
|
|
|
43
44
|
setIntegralsYDomain(draft, datum);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function handleDeleteIntegral(draft, action) {
|
|
47
48
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
48
49
|
if (activeSpectrum) {
|
|
49
50
|
const state = original(draft);
|
|
50
51
|
const { index } = activeSpectrum;
|
|
51
|
-
const { integralID } = action;
|
|
52
|
+
const { id: integralID } = action?.payload || {};
|
|
52
53
|
const datum = draft.data[index];
|
|
53
|
-
if (integralID
|
|
54
|
+
if (!integralID) {
|
|
54
55
|
datum.integrals.values = [];
|
|
55
56
|
}
|
|
56
57
|
else {
|
|
@@ -60,10 +61,10 @@ function deleteIntegral(draft, action) {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function handleChangeIntegral(draft, action) {
|
|
64
65
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
65
66
|
const state = original(draft);
|
|
66
|
-
const integral = action.payload
|
|
67
|
+
const { integral } = action.payload;
|
|
67
68
|
if (activeSpectrum?.id) {
|
|
68
69
|
const { index } = activeSpectrum;
|
|
69
70
|
const originalDatum = state.data[index];
|
|
@@ -72,9 +73,9 @@ function changeIntegral(draft, action) {
|
|
|
72
73
|
const integralIndex = originalDatum.integrals.values.findIndex((i) => i.id === integral.id);
|
|
73
74
|
if (integralIndex !== -1) {
|
|
74
75
|
datum.integrals.values[integralIndex] = {
|
|
76
|
+
...integral,
|
|
75
77
|
originFrom: integral.from,
|
|
76
78
|
originTo: integral.to,
|
|
77
|
-
...integral,
|
|
78
79
|
absolute: xyIntegration({ x, y: re }, { from: integral.from, to: integral.to, reverse: true }),
|
|
79
80
|
};
|
|
80
81
|
updateIntegralsRelativeValues(datum);
|
|
@@ -83,18 +84,18 @@ function changeIntegral(draft, action) {
|
|
|
83
84
|
}
|
|
84
85
|
function handleChangeIntegralsRelativeValue(draft, action) {
|
|
85
86
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
86
|
-
const
|
|
87
|
+
const { id, value } = action.payload;
|
|
87
88
|
if (activeSpectrum?.id) {
|
|
88
89
|
const { index } = activeSpectrum;
|
|
89
|
-
changeIntegralsRelative(draft.data[index],
|
|
90
|
+
changeIntegralsRelative(draft.data[index], { id, value });
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
function handleChangeIntegralsSumFlag(draft
|
|
93
|
-
const flag = action.payload;
|
|
93
|
+
function handleChangeIntegralsSumFlag(draft) {
|
|
94
94
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
95
95
|
if (activeSpectrum) {
|
|
96
96
|
const { index } = activeSpectrum;
|
|
97
|
-
draft.data[index].integrals.options
|
|
97
|
+
const integralOptions = draft.data[index].integrals.options;
|
|
98
|
+
integralOptions.isSumConstant = !integralOptions.isSumConstant;
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
export { handleChangeIntegralSum,
|
|
101
|
+
export { handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
-
import { Spectrum } from 'nmr-load-save';
|
|
2
|
+
import { NmriumState, Spectrum } from 'nmr-load-save';
|
|
3
|
+
import { ParseResult } from 'papaparse';
|
|
3
4
|
import { UsedColors } from '../../../types/UsedColors';
|
|
4
5
|
import { OnLoadProcessing } from '../../workspaces/Workspace';
|
|
5
6
|
import { State } from '../Reducer';
|
|
6
|
-
|
|
7
|
+
import { ActionType } from '../types/ActionType';
|
|
8
|
+
interface InitiateProps {
|
|
9
|
+
nmriumState: Partial<NmriumState>;
|
|
10
|
+
}
|
|
11
|
+
interface InputProps extends InitiateProps {
|
|
12
|
+
containsNmrium?: boolean;
|
|
13
|
+
usedColors?: UsedColors;
|
|
14
|
+
onLoadProcessing?: OnLoadProcessing;
|
|
15
|
+
parseMetaFileResult?: ParseResult<any> | null;
|
|
16
|
+
resetSourceObject?: boolean;
|
|
17
|
+
}
|
|
18
|
+
type SetIsLoadingAction = ActionType<'SET_LOADING_FLAG', {
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
type LoadDropFilesAction = ActionType<'LOAD_DROP_FILES', InputProps>;
|
|
22
|
+
type InitiateAction = ActionType<'INITIATE', InitiateProps>;
|
|
23
|
+
export type LoadActions = SetIsLoadingAction | LoadDropFilesAction | InitiateAction;
|
|
7
24
|
declare function initSpectra(inputSpectra: Spectrum[], options: {
|
|
8
25
|
usedColors: UsedColors;
|
|
9
26
|
onLoadProcessing: OnLoadProcessing;
|
|
10
27
|
}): any;
|
|
11
|
-
declare function
|
|
12
|
-
declare function
|
|
13
|
-
|
|
28
|
+
declare function handleSetIsLoading(draft: Draft<State>, action: SetIsLoadingAction): void;
|
|
29
|
+
declare function handleInitiate(draft: Draft<State>, action: InitiateAction): State | undefined;
|
|
30
|
+
declare function handleLoadDropFiles(draft: Draft<State>, action: LoadDropFilesAction): State | undefined;
|
|
31
|
+
export { handleSetIsLoading, initSpectra, handleInitiate, handleLoadDropFiles };
|
|
@@ -9,14 +9,24 @@ import { DefaultTolerance } from '../../panels/SummaryPanel/CorrelationTable/Con
|
|
|
9
9
|
import nucleusToString from '../../utility/nucleusToString';
|
|
10
10
|
import { getDefaultViewState, getInitialState, } from '../Reducer';
|
|
11
11
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
12
|
-
import {
|
|
12
|
+
import { setSpectraMetaInfo } from './SpectrumsActions';
|
|
13
13
|
import { setActiveTab } from './ToolsActions';
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
function convertHybridizationStringValuesInCorrelations(correlations) {
|
|
15
|
+
return {
|
|
16
|
+
...correlations,
|
|
17
|
+
values: correlations.values.map((correlation) => {
|
|
18
|
+
if (typeof correlation.hybridization === 'string') {
|
|
19
|
+
let values = [];
|
|
20
|
+
if (correlation.hybridization.length > 0) {
|
|
21
|
+
const hybridizationString = correlation.hybridization.replaceAll('SP', '');
|
|
22
|
+
const value = Number(hybridizationString);
|
|
23
|
+
values.push(value);
|
|
24
|
+
}
|
|
25
|
+
correlation.hybridization = values;
|
|
26
|
+
}
|
|
27
|
+
return correlation;
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
20
30
|
}
|
|
21
31
|
function setCorrelation(draft, correlations) {
|
|
22
32
|
if (!correlations || Object.keys(correlations).length === 0) {
|
|
@@ -32,24 +42,9 @@ function setCorrelation(draft, correlations) {
|
|
|
32
42
|
// draft.correlations = correlations // original command without overwriting
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
|
-
function initSpectra(inputSpectra, options) {
|
|
36
|
-
const spectra = [];
|
|
37
|
-
const { usedColors, onLoadProcessing } = options;
|
|
38
|
-
for (const spectrum of inputSpectra) {
|
|
39
|
-
const { info } = spectrum;
|
|
40
|
-
if (info.dimension === 1) {
|
|
41
|
-
const filters = onLoadProcessing?.[nucleusToString(info.nucleus)] || [];
|
|
42
|
-
spectra.push(initiateDatum1D(spectrum, { usedColors, filters }));
|
|
43
|
-
}
|
|
44
|
-
else if (info.dimension === 2) {
|
|
45
|
-
spectra.push(initiateDatum2D({ ...spectrum }, { usedColors }));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return spectra;
|
|
49
|
-
}
|
|
50
45
|
function setData(draft, input, options = {}) {
|
|
51
|
-
const { data,
|
|
52
|
-
data: { spectra: [], molecules: [], correlations: {} },
|
|
46
|
+
const { nmriumState: { data, view }, onLoadProcessing = {}, parseMetaFileResult = null, } = input || {
|
|
47
|
+
nmriumState: { data: { spectra: [], molecules: [], correlations: {} } },
|
|
53
48
|
multipleAnalysis: {},
|
|
54
49
|
};
|
|
55
50
|
const { autoOnLoadProcessing = true } = options;
|
|
@@ -58,7 +53,6 @@ function setData(draft, input, options = {}) {
|
|
|
58
53
|
const defaultViewState = getDefaultViewState();
|
|
59
54
|
draft.view = lodashMerge(defaultViewState, view);
|
|
60
55
|
}
|
|
61
|
-
setColors(draft, usedColors);
|
|
62
56
|
if (source) {
|
|
63
57
|
draft.source = lodashMergeWith(draft.source, source, (objValue, srcValue) => {
|
|
64
58
|
if (Array.isArray(objValue)) {
|
|
@@ -68,7 +62,7 @@ function setData(draft, input, options = {}) {
|
|
|
68
62
|
}
|
|
69
63
|
draft.molecules = draft.molecules.concat(MoleculeManager.fromJSON(molecules, draft.molecules));
|
|
70
64
|
draft.data = draft.data.concat(initSpectra(spectra, {
|
|
71
|
-
usedColors,
|
|
65
|
+
usedColors: draft.usedColors,
|
|
72
66
|
onLoadProcessing: autoOnLoadProcessing ? onLoadProcessing : {},
|
|
73
67
|
}));
|
|
74
68
|
setCorrelation(draft, correlations);
|
|
@@ -78,34 +72,33 @@ function setData(draft, input, options = {}) {
|
|
|
78
72
|
spectra: draft.data,
|
|
79
73
|
parseMetaFileResult,
|
|
80
74
|
});
|
|
81
|
-
|
|
75
|
+
setSpectraMetaInfo(draft, matches);
|
|
82
76
|
}
|
|
83
77
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}),
|
|
99
|
-
};
|
|
78
|
+
function initSpectra(inputSpectra, options) {
|
|
79
|
+
const spectra = [];
|
|
80
|
+
const { usedColors, onLoadProcessing } = options;
|
|
81
|
+
for (const spectrum of inputSpectra) {
|
|
82
|
+
const { info } = spectrum;
|
|
83
|
+
if (info.dimension === 1) {
|
|
84
|
+
const filters = onLoadProcessing?.[nucleusToString(info.nucleus)] || [];
|
|
85
|
+
spectra.push(initiateDatum1D(spectrum, { usedColors, filters }));
|
|
86
|
+
}
|
|
87
|
+
else if (info.dimension === 2) {
|
|
88
|
+
spectra.push(initiateDatum2D({ ...spectrum }, { usedColors }));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return spectra;
|
|
100
92
|
}
|
|
101
93
|
function setPreferences(draft, data) {
|
|
102
94
|
const emptyPreferences = {
|
|
103
95
|
verticalAlign: null,
|
|
104
96
|
};
|
|
105
97
|
const { verticalAlign = null } = data || emptyPreferences;
|
|
106
|
-
|
|
98
|
+
const vAlign = verticalAlign?.[draft.view.spectra.activeTab];
|
|
99
|
+
if (vAlign) {
|
|
107
100
|
changeSpectrumVerticalAlignment(draft, {
|
|
108
|
-
verticalAlign,
|
|
101
|
+
verticalAlign: vAlign,
|
|
109
102
|
});
|
|
110
103
|
}
|
|
111
104
|
else {
|
|
@@ -114,14 +107,15 @@ function setPreferences(draft, data) {
|
|
|
114
107
|
}
|
|
115
108
|
function initData(draft, action, options = {}) {
|
|
116
109
|
const { forceInitialize = false, autoOnLoadProcessing = true } = options;
|
|
117
|
-
const { data, view } = action.payload;
|
|
110
|
+
const { nmriumState: { data, view }, } = action.payload;
|
|
111
|
+
const viewState = view;
|
|
118
112
|
if (data?.spectra?.length || forceInitialize) {
|
|
119
113
|
const state = getInitialState();
|
|
120
114
|
setData(state, action.payload, { autoOnLoadProcessing });
|
|
121
|
-
setActiveTab(state, { tab:
|
|
115
|
+
setActiveTab(state, { tab: viewState?.spectra?.activeTab || '' });
|
|
122
116
|
state.width = draft.width;
|
|
123
117
|
state.height = draft.height;
|
|
124
|
-
setPreferences(state,
|
|
118
|
+
setPreferences(state, viewState);
|
|
125
119
|
state.isLoading = false;
|
|
126
120
|
state.actionType = action.type;
|
|
127
121
|
return state;
|
|
@@ -135,15 +129,21 @@ function initData(draft, action, options = {}) {
|
|
|
135
129
|
draft.isLoading = false;
|
|
136
130
|
}
|
|
137
131
|
}
|
|
138
|
-
|
|
132
|
+
//action
|
|
133
|
+
function handleSetIsLoading(draft, action) {
|
|
134
|
+
draft.isLoading = action.payload.isLoading;
|
|
135
|
+
}
|
|
136
|
+
//action
|
|
137
|
+
function handleInitiate(draft, action) {
|
|
139
138
|
return initData(draft, action, {
|
|
140
139
|
forceInitialize: true,
|
|
141
140
|
autoOnLoadProcessing: false,
|
|
142
141
|
});
|
|
143
142
|
}
|
|
144
|
-
|
|
143
|
+
//action
|
|
144
|
+
function handleLoadDropFiles(draft, action) {
|
|
145
145
|
const { payload, type } = action;
|
|
146
|
-
const { data: { spectra = [] }, containsNmrium = false, resetSourceObject = true, } = payload;
|
|
146
|
+
const { nmriumState: { data: { spectra = [] } = {} }, containsNmrium = false, resetSourceObject = true, } = payload;
|
|
147
147
|
if (containsNmrium) {
|
|
148
148
|
return initData(draft, action, { autoOnLoadProcessing: false });
|
|
149
149
|
}
|
|
@@ -159,4 +159,4 @@ function loadDropFiles(draft, action) {
|
|
|
159
159
|
draft.isLoading = false;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
export {
|
|
162
|
+
export { handleSetIsLoading, initSpectra, handleInitiate, handleLoadDropFiles };
|
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { PredictedSpectraResult, PredictionOptions } from '../../../data/PredictionManager';
|
|
3
|
+
import { MoleculeBoundingRect, StateMolecule } from '../../../data/molecules/Molecule';
|
|
4
|
+
import { AssignmentContext } from '../../assignment/AssignmentsContext';
|
|
2
5
|
import { State } from '../Reducer';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { ActionType } from '../types/ActionType';
|
|
7
|
+
type AddMoleculeAction = ActionType<'ADD_MOLECULE', {
|
|
8
|
+
molfile: string;
|
|
9
|
+
}>;
|
|
10
|
+
type SetMoleculeAction = ActionType<'SET_MOLECULE', Required<StateMolecule>>;
|
|
11
|
+
type DeleteMoleculeAction = ActionType<'DELETE_MOLECULE', {
|
|
12
|
+
id: string;
|
|
13
|
+
assignmentData: AssignmentContext;
|
|
14
|
+
}>;
|
|
15
|
+
type PredictSpectraFromMoleculeAction = ActionType<'PREDICT_SPECTRA', {
|
|
16
|
+
molfile: string;
|
|
17
|
+
options: PredictionOptions;
|
|
18
|
+
predictedSpectra?: PredictedSpectraResult;
|
|
19
|
+
}>;
|
|
20
|
+
type ToggleMoleculeViewObjectAction = ActionType<'FLOAT_MOLECULE_OVER_SPECTRUM' | 'TOGGLE_MOLECULE_ATOM_NUMBER', {
|
|
21
|
+
id: string;
|
|
22
|
+
}>;
|
|
23
|
+
type ChangeFloatMoleculePositionAction = ActionType<'CHANGE_FLOAT_MOLECULE_POSITION', {
|
|
24
|
+
id: string;
|
|
25
|
+
bounding: MoleculeBoundingRect;
|
|
26
|
+
}>;
|
|
27
|
+
type ChangeMoleculeLabelAction = ActionType<'CHANGE_MOLECULE_LABEL', {
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}>;
|
|
31
|
+
export type MoleculeActions = AddMoleculeAction | SetMoleculeAction | DeleteMoleculeAction | PredictSpectraFromMoleculeAction | ToggleMoleculeViewObjectAction | ChangeFloatMoleculePositionAction | ChangeMoleculeLabelAction;
|
|
32
|
+
declare function handleAddMolecule(draft: Draft<State>, action: AddMoleculeAction): void;
|
|
33
|
+
declare function handleSetMolecule(draft: Draft<State>, action: SetMoleculeAction): void;
|
|
34
|
+
declare function handleDeleteMolecule(draft: Draft<State>, action: DeleteMoleculeAction): void;
|
|
35
|
+
declare function handlePredictSpectraFromMolecule(draft: Draft<State>, action: PredictSpectraFromMoleculeAction): void;
|
|
36
|
+
declare function handleFloatMoleculeOverSpectrum(draft: Draft<State>, action: ToggleMoleculeViewObjectAction): void;
|
|
37
|
+
declare function handleToggleMoleculeAtomsNumbers(draft: Draft<State>, action: ToggleMoleculeViewObjectAction): void;
|
|
38
|
+
declare function handleChangeFloatMoleculePosition(draft: Draft<State>, action: ChangeFloatMoleculePositionAction): void;
|
|
39
|
+
declare function handleChangeMoleculeLabel(draft: Draft<State>, action: ChangeMoleculeLabelAction): void;
|
|
40
|
+
export { handleAddMolecule, handleSetMolecule, handleDeleteMolecule, handlePredictSpectraFromMolecule, handleFloatMoleculeOverSpectrum, handleToggleMoleculeAtomsNumbers, handleChangeFloatMoleculePosition, handleChangeMoleculeLabel, };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { generateSpectra } from '../../../data/PredictionManager';
|
|
1
|
+
import { generateSpectra, } from '../../../data/PredictionManager';
|
|
2
2
|
import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
3
|
-
import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT } from '../../../data/molecules/Molecule';
|
|
3
|
+
import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT, } from '../../../data/molecules/Molecule';
|
|
4
4
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
5
5
|
import { generateColor } from '../../../data/utilities/generateColor';
|
|
6
6
|
import nucleusToString from '../../utility/nucleusToString';
|
|
7
7
|
import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
|
|
8
|
-
import {
|
|
8
|
+
import { unlinkRange } from './RangesActions';
|
|
9
9
|
import { setActiveTab } from './ToolsActions';
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import { unlinkZone } from './ZonesActions';
|
|
11
|
+
//action
|
|
12
|
+
function handleAddMolecule(draft, action) {
|
|
13
|
+
const { molfile } = action.payload;
|
|
12
14
|
const isEmpty = draft.molecules.length === 0;
|
|
13
15
|
MoleculeManager.addMolfile(draft.molecules, molfile);
|
|
14
16
|
/**
|
|
@@ -20,7 +22,8 @@ function addMoleculeHandler(draft, molfile) {
|
|
|
20
22
|
changeSpectraRelativeSum(draft, molecule.id, molecule);
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
//action
|
|
26
|
+
function handleSetMolecule(draft, action) {
|
|
24
27
|
const { id, label, molfile } = action.payload;
|
|
25
28
|
MoleculeManager.setMolfile(draft.molecules, {
|
|
26
29
|
id,
|
|
@@ -35,13 +38,14 @@ function setMoleculeHandler(draft, action) {
|
|
|
35
38
|
}
|
|
36
39
|
function removeAssignments(draft, assignmentData) {
|
|
37
40
|
if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
|
|
38
|
-
|
|
41
|
+
unlinkRange(draft, { assignmentData });
|
|
39
42
|
}
|
|
40
43
|
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
41
|
-
|
|
44
|
+
unlinkZone(draft, { assignmentData });
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
|
-
|
|
47
|
+
//action
|
|
48
|
+
function handleDeleteMolecule(draft, action) {
|
|
45
49
|
const { id, assignmentData } = action.payload;
|
|
46
50
|
// remove Assignments links of the active spectrum
|
|
47
51
|
removeAssignments(draft, assignmentData);
|
|
@@ -56,14 +60,15 @@ function deleteMoleculeHandler(draft, action) {
|
|
|
56
60
|
*/
|
|
57
61
|
changeSpectraRelativeSum(draft, id, draft.molecules[0] || null);
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
//action
|
|
64
|
+
function handlePredictSpectraFromMolecule(draft, action) {
|
|
65
|
+
const { predictedSpectra, options } = action.payload;
|
|
66
|
+
if (!predictedSpectra) {
|
|
62
67
|
draft.isLoading = false;
|
|
63
68
|
}
|
|
64
69
|
else {
|
|
65
70
|
const color = generateColor(false, draft.usedColors['1d']);
|
|
66
|
-
for (const spectrum of generateSpectra(
|
|
71
|
+
for (const spectrum of generateSpectra(predictedSpectra, options, color)) {
|
|
67
72
|
draft.data.push(spectrum);
|
|
68
73
|
draft.view.spectra.activeSpectra[nucleusToString(spectrum.info.nucleus)] =
|
|
69
74
|
[
|
|
@@ -118,7 +123,8 @@ function getFloatingMoleculeInitialPosition(id, draft) {
|
|
|
118
123
|
const y = Math.floor(moleculeKeys.length / columns) * (height / rows) + top;
|
|
119
124
|
return { x, y };
|
|
120
125
|
}
|
|
121
|
-
|
|
126
|
+
//action
|
|
127
|
+
function handleFloatMoleculeOverSpectrum(draft, action) {
|
|
122
128
|
const { id } = action.payload;
|
|
123
129
|
initMoleculeViewProperties(id, draft);
|
|
124
130
|
const molecule = getMoleculeViewObject(id, draft);
|
|
@@ -126,7 +132,8 @@ function floatMoleculeOverSpectrum(draft, action) {
|
|
|
126
132
|
molecule.floating.visible = !molecule.floating.visible;
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
|
-
|
|
135
|
+
//action
|
|
136
|
+
function handleToggleMoleculeAtomsNumbers(draft, action) {
|
|
130
137
|
const { id } = action.payload;
|
|
131
138
|
initMoleculeViewProperties(id, draft);
|
|
132
139
|
const molecule = getMoleculeViewObject(id, draft);
|
|
@@ -134,7 +141,8 @@ function toggleMoleculeAtomsNumbers(draft, action) {
|
|
|
134
141
|
molecule.showAtomNumber = !molecule.showAtomNumber;
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
|
-
|
|
144
|
+
//action
|
|
145
|
+
function handleChangeFloatMoleculePosition(draft, action) {
|
|
138
146
|
const { id, bounding } = action.payload;
|
|
139
147
|
const molecule = getMoleculeViewObject(id, draft);
|
|
140
148
|
if (molecule) {
|
|
@@ -144,9 +152,10 @@ function changeFloatMoleculePosition(draft, action) {
|
|
|
144
152
|
throw new Error(`Molecule ${id} does not exist`);
|
|
145
153
|
}
|
|
146
154
|
}
|
|
147
|
-
|
|
155
|
+
//action
|
|
156
|
+
function handleChangeMoleculeLabel(draft, action) {
|
|
148
157
|
const { id, label } = action.payload;
|
|
149
158
|
const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
|
|
150
159
|
draft.molecules[moleculeIndex].label = label;
|
|
151
160
|
}
|
|
152
|
-
export {
|
|
161
|
+
export { handleAddMolecule, handleSetMolecule, handleDeleteMolecule, handlePredictSpectraFromMolecule, handleFloatMoleculeOverSpectrum, handleToggleMoleculeAtomsNumbers, handleChangeFloatMoleculePosition, handleChangeMoleculeLabel, };
|
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { Peak1D } from 'nmr-load-save';
|
|
3
|
+
import { OptionsXYAutoPeaksPicking } from 'nmr-processing';
|
|
4
|
+
import { defaultPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
|
|
2
5
|
import { State } from '../Reducer';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import { ActionType } from '../types/ActionType';
|
|
7
|
+
type AddPeakAction = ActionType<'ADD_PEAK', {
|
|
8
|
+
x: number;
|
|
9
|
+
}>;
|
|
10
|
+
type AddPeaksAction = ActionType<'ADD_PEAKS', {
|
|
11
|
+
startX: number;
|
|
12
|
+
endX: number;
|
|
13
|
+
}>;
|
|
14
|
+
type DeletePeakAction = ActionType<'DELETE_PEAK', {
|
|
15
|
+
id?: string;
|
|
16
|
+
}>;
|
|
17
|
+
type OptimizePeaksAction = ActionType<'OPTIMIZE_PEAKS', {
|
|
18
|
+
peaks: Peak1D[];
|
|
19
|
+
}>;
|
|
20
|
+
type AutoPeaksPickingAction = ActionType<'AUTO_PEAK_PICKING', {
|
|
21
|
+
maxNumberOfPeaks: number;
|
|
22
|
+
minMaxRatio: number;
|
|
23
|
+
noiseFactor: number;
|
|
24
|
+
direction: OptionsXYAutoPeaksPicking['direction'];
|
|
25
|
+
}>;
|
|
26
|
+
type ChangePeaksShapeAction = ActionType<'CHANGE_PEAK_SHAPE', {
|
|
27
|
+
id: string;
|
|
28
|
+
shape: Peak1D['shape'];
|
|
29
|
+
}>;
|
|
30
|
+
type TogglePeaksViewAction = ActionType<'TOGGLE_PEAKS_VIEW_PROPERTY', {
|
|
31
|
+
key: keyof typeof defaultPeaksViewState;
|
|
32
|
+
}>;
|
|
33
|
+
export type PeaksActions = AddPeakAction | AddPeaksAction | DeletePeakAction | OptimizePeaksAction | AutoPeaksPickingAction | ChangePeaksShapeAction | TogglePeaksViewAction;
|
|
34
|
+
declare function handleAddPeak(draft: Draft<State>, action: AddPeakAction): void;
|
|
35
|
+
declare function handleAddPeaks(draft: Draft<State>, action: AddPeaksAction): void;
|
|
36
|
+
declare function handleDeletePeak(draft: Draft<State>, action: DeletePeakAction): void;
|
|
37
|
+
declare function handleOptimizePeaks(draft: Draft<State>, action: OptimizePeaksAction): void;
|
|
38
|
+
declare function handleAutoPeakPicking(draft: Draft<State>, action: AutoPeaksPickingAction): void;
|
|
39
|
+
declare function handleChangePeakShape(draft: Draft<State>, action: ChangePeaksShapeAction): void;
|
|
40
|
+
declare function handleTogglePeaksViewProperty(draft: Draft<State>, action: TogglePeaksViewAction): void;
|
|
41
|
+
export { handleAddPeak, handleAddPeaks, handleDeletePeak, handleAutoPeakPicking, handleOptimizePeaks, handleChangePeakShape, handleTogglePeaksViewProperty, };
|
|
@@ -3,17 +3,18 @@ import { original } from 'immer';
|
|
|
3
3
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
4
4
|
import { getShiftX, lookupPeak, autoPeakPicking, optimizePeaks, } from '../../../data/data1d/Spectrum1D';
|
|
5
5
|
import { defaultPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
|
|
6
|
-
import { options } from '../../toolbar/ToolTypes';
|
|
7
6
|
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
8
7
|
import getRange from '../helper/getRange';
|
|
9
|
-
|
|
8
|
+
//action
|
|
9
|
+
function handleAddPeak(draft, action) {
|
|
10
|
+
const { x: mouseXPosition } = action.payload;
|
|
10
11
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
11
12
|
const state = original(draft);
|
|
12
13
|
if (activeSpectrum?.id && state) {
|
|
13
14
|
const { index } = activeSpectrum;
|
|
14
15
|
const xShift = 10;
|
|
15
|
-
const startX =
|
|
16
|
-
const endX =
|
|
16
|
+
const startX = mouseXPosition - xShift;
|
|
17
|
+
const endX = mouseXPosition + xShift;
|
|
17
18
|
const [from, to] = getRange(draft, { startX, endX });
|
|
18
19
|
const candidatePeak = lookupPeak(state.data[index].data, {
|
|
19
20
|
from,
|
|
@@ -32,13 +33,14 @@ function addPeak(draft, mouseCoordinates) {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
//action
|
|
37
|
+
function handleAddPeaks(draft, action) {
|
|
36
38
|
const state = original(draft);
|
|
37
39
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
38
40
|
if (activeSpectrum) {
|
|
39
41
|
const { index } = activeSpectrum;
|
|
40
42
|
const datumOriginal = state.data[index];
|
|
41
|
-
const { startX, endX } = action;
|
|
43
|
+
const { startX, endX } = action.payload;
|
|
42
44
|
const [from, to] = getRange(draft, { startX, endX });
|
|
43
45
|
if (from !== to) {
|
|
44
46
|
const peak = lookupPeak(datumOriginal.data, { from, to });
|
|
@@ -56,12 +58,14 @@ function addPeaks(draft, action) {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
//action
|
|
62
|
+
function handleDeletePeak(draft, action) {
|
|
60
63
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
64
|
+
const peakData = action?.payload || {};
|
|
61
65
|
if (activeSpectrum) {
|
|
62
66
|
const { index } = activeSpectrum;
|
|
63
67
|
const state = original(draft);
|
|
64
|
-
if (peakData
|
|
68
|
+
if (!peakData) {
|
|
65
69
|
draft.data[index].peaks.values = [];
|
|
66
70
|
}
|
|
67
71
|
else {
|
|
@@ -70,6 +74,7 @@ function deletePeak(draft, peakData) {
|
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
}
|
|
77
|
+
//action
|
|
73
78
|
function handleOptimizePeaks(draft, action) {
|
|
74
79
|
const { peaks } = action.payload;
|
|
75
80
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
@@ -85,11 +90,12 @@ function handleOptimizePeaks(draft, action) {
|
|
|
85
90
|
datum.peaks.values = newPeaks;
|
|
86
91
|
}
|
|
87
92
|
}
|
|
93
|
+
//action
|
|
88
94
|
function handleAutoPeakPicking(draft, action) {
|
|
89
95
|
const { maxNumberOfPeaks, minMaxRatio, noiseFactor, direction } = action.payload;
|
|
90
96
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
91
97
|
if (activeSpectrum?.id) {
|
|
92
|
-
draft.toolOptions.selectedTool =
|
|
98
|
+
draft.toolOptions.selectedTool = 'zoom';
|
|
93
99
|
draft.toolOptions.selectedOptionPanel = null;
|
|
94
100
|
const { index } = activeSpectrum;
|
|
95
101
|
const datum = draft.data[index];
|
|
@@ -107,7 +113,8 @@ function handleAutoPeakPicking(draft, action) {
|
|
|
107
113
|
datum.peaks.values = datum.peaks.values.concat(peaks);
|
|
108
114
|
}
|
|
109
115
|
}
|
|
110
|
-
|
|
116
|
+
//action
|
|
117
|
+
function handleChangePeakShape(draft, action) {
|
|
111
118
|
const { shape, id } = action.payload;
|
|
112
119
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
113
120
|
if (activeSpectrum?.id) {
|
|
@@ -119,6 +126,7 @@ function changePeakShapeHandler(draft, action) {
|
|
|
119
126
|
}
|
|
120
127
|
}
|
|
121
128
|
}
|
|
129
|
+
//action
|
|
122
130
|
function handleTogglePeaksViewProperty(draft, action) {
|
|
123
131
|
const { key } = action.payload;
|
|
124
132
|
togglePeaksViewProperty(draft, key);
|
|
@@ -137,4 +145,4 @@ function togglePeaksViewProperty(draft, key) {
|
|
|
137
145
|
}
|
|
138
146
|
}
|
|
139
147
|
}
|
|
140
|
-
export {
|
|
148
|
+
export { handleAddPeak, handleAddPeaks, handleDeletePeak, handleAutoPeakPicking, handleOptimizePeaks, handleChangePeakShape, handleTogglePeaksViewProperty, };
|