nmrium 0.36.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 -7
- 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.d.ts +2 -0
- package/lib/component/NMRium.js +22 -15
- 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/RemoveAssignmentsButton.d.ts +4 -0
- package/lib/component/{panels/RangesPanel/TableColumns → elements}/RemoveAssignmentsButton.js +14 -1
- 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 +5 -7
- 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/AboutPredictionModal.d.ts +2 -0
- package/lib/component/modal/AboutPredictionModal.js +49 -0
- 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 +27 -23
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +8 -5
- 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.d.ts +1 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +7 -7
- 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/RangesTableRow.d.ts +0 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +0 -11
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -3
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +2 -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/SpectraPreferences.js +2 -2
- 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/SpectraColumnsManager.js +1 -1
- 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 -21
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +4 -5
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +12 -16
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +3 -7
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +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 +4 -5
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +27 -19
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +3 -7
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.js +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/ZonesTableRow.js +2 -22
- 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 +10 -6
- 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 +65 -57
- package/lib/component/reducer/actions/MoleculeActions.d.ts +38 -9
- package/lib/component/reducer/actions/MoleculeActions.js +53 -20
- 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 +22 -7
- 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/panelsPreferencesDefaultValues.js +1 -0
- 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/component/workspaces/Workspace.d.ts +2 -1
- package/lib/component/workspaces/exercise.js +31 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
- 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/Processing2D.d.ts +3 -3
- package/lib/data/data2d/Spectrum2D/contours.d.ts +1 -4
- package/lib/data/data2d/Spectrum2D/contours.js +0 -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/ZoneUtilities.js +0 -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/types/NMRiumGeneralPreferences.d.ts +1 -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 -7
- 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 +19 -12
- 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/{panels/RangesPanel/TableColumns → elements}/RemoveAssignmentsButton.js +15 -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 +5 -7
- 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/AboutPredictionModal.js +54 -0
- 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 +27 -23
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +7 -4
- 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 +7 -7
- 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/RangesTableRow.js +0 -12
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +2 -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/SpectraPreferences.js +2 -2
- 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/SpectraColumnsManager.js +1 -1
- 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 +12 -19
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +27 -22
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.js +2 -2
- 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/ZonesTableRow.js +1 -21
- 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 +10 -6
- 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 +68 -60
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +56 -23
- package/lib-cjs/component/reducer/actions/PeaksActions.js +23 -15
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +24 -9
- 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/preferences/panelsPreferencesDefaultValues.js +1 -0
- 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/component/workspaces/exercise.js +31 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
- 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/contours.js +0 -1
- 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/ZoneUtilities.js +0 -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 +35 -34
- package/lib/component/panels/RangesPanel/TableColumns/RemoveAssignmentsButton.d.ts +0 -3
- 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,32 +42,17 @@ function setCorrelation(draft, correlations) {
|
|
|
32
42
|
// draft.correlations = correlations // original command without overwriting
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
|
|
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
|
-
function setData(draft, input) {
|
|
51
|
-
const { data, usedColors, view, onLoadProcessing = {}, parseMetaFileResult = null, } = input || {
|
|
52
|
-
data: { spectra: [], molecules: [], correlations: {} },
|
|
45
|
+
function setData(draft, input, options = {}) {
|
|
46
|
+
const { nmriumState: { data, view }, onLoadProcessing = {}, parseMetaFileResult = null, } = input || {
|
|
47
|
+
nmriumState: { data: { spectra: [], molecules: [], correlations: {} } },
|
|
53
48
|
multipleAnalysis: {},
|
|
54
49
|
};
|
|
50
|
+
const { autoOnLoadProcessing = true } = options;
|
|
55
51
|
const { source, spectra = [], molecules = [], correlations = {}, } = data || {};
|
|
56
52
|
if (view) {
|
|
57
53
|
const defaultViewState = getDefaultViewState();
|
|
58
54
|
draft.view = lodashMerge(defaultViewState, view);
|
|
59
55
|
}
|
|
60
|
-
setColors(draft, usedColors);
|
|
61
56
|
if (source) {
|
|
62
57
|
draft.source = lodashMergeWith(draft.source, source, (objValue, srcValue) => {
|
|
63
58
|
if (Array.isArray(objValue)) {
|
|
@@ -66,7 +61,10 @@ function setData(draft, input) {
|
|
|
66
61
|
});
|
|
67
62
|
}
|
|
68
63
|
draft.molecules = draft.molecules.concat(MoleculeManager.fromJSON(molecules, draft.molecules));
|
|
69
|
-
draft.data = draft.data.concat(initSpectra(spectra, {
|
|
64
|
+
draft.data = draft.data.concat(initSpectra(spectra, {
|
|
65
|
+
usedColors: draft.usedColors,
|
|
66
|
+
onLoadProcessing: autoOnLoadProcessing ? onLoadProcessing : {},
|
|
67
|
+
}));
|
|
70
68
|
setCorrelation(draft, correlations);
|
|
71
69
|
if (parseMetaFileResult) {
|
|
72
70
|
const { matches } = linkMetaWithSpectra({
|
|
@@ -74,49 +72,50 @@ function setData(draft, input) {
|
|
|
74
72
|
spectra: draft.data,
|
|
75
73
|
parseMetaFileResult,
|
|
76
74
|
});
|
|
77
|
-
|
|
75
|
+
setSpectraMetaInfo(draft, matches);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
};
|
|
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;
|
|
96
92
|
}
|
|
97
93
|
function setPreferences(draft, data) {
|
|
98
94
|
const emptyPreferences = {
|
|
99
95
|
verticalAlign: null,
|
|
100
96
|
};
|
|
101
97
|
const { verticalAlign = null } = data || emptyPreferences;
|
|
102
|
-
|
|
98
|
+
const vAlign = verticalAlign?.[draft.view.spectra.activeTab];
|
|
99
|
+
if (vAlign) {
|
|
103
100
|
changeSpectrumVerticalAlignment(draft, {
|
|
104
|
-
verticalAlign,
|
|
101
|
+
verticalAlign: vAlign,
|
|
105
102
|
});
|
|
106
103
|
}
|
|
107
104
|
else {
|
|
108
105
|
changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
|
-
function initData(draft, action,
|
|
112
|
-
const {
|
|
108
|
+
function initData(draft, action, options = {}) {
|
|
109
|
+
const { forceInitialize = false, autoOnLoadProcessing = true } = options;
|
|
110
|
+
const { nmriumState: { data, view }, } = action.payload;
|
|
111
|
+
const viewState = view;
|
|
113
112
|
if (data?.spectra?.length || forceInitialize) {
|
|
114
113
|
const state = getInitialState();
|
|
115
|
-
setData(state, action.payload);
|
|
116
|
-
setActiveTab(state, { tab:
|
|
114
|
+
setData(state, action.payload, { autoOnLoadProcessing });
|
|
115
|
+
setActiveTab(state, { tab: viewState?.spectra?.activeTab || '' });
|
|
117
116
|
state.width = draft.width;
|
|
118
117
|
state.height = draft.height;
|
|
119
|
-
setPreferences(state,
|
|
118
|
+
setPreferences(state, viewState);
|
|
120
119
|
state.isLoading = false;
|
|
121
120
|
state.actionType = action.type;
|
|
122
121
|
return state;
|
|
@@ -130,14 +129,23 @@ function initData(draft, action, forceInitialize = false) {
|
|
|
130
129
|
draft.isLoading = false;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
//action
|
|
133
|
+
function handleSetIsLoading(draft, action) {
|
|
134
|
+
draft.isLoading = action.payload.isLoading;
|
|
135
|
+
}
|
|
136
|
+
//action
|
|
137
|
+
function handleInitiate(draft, action) {
|
|
138
|
+
return initData(draft, action, {
|
|
139
|
+
forceInitialize: true,
|
|
140
|
+
autoOnLoadProcessing: false,
|
|
141
|
+
});
|
|
135
142
|
}
|
|
136
|
-
|
|
143
|
+
//action
|
|
144
|
+
function handleLoadDropFiles(draft, action) {
|
|
137
145
|
const { payload, type } = action;
|
|
138
|
-
const { data: { spectra = [] }, containsNmrium = false, resetSourceObject = true, } = payload;
|
|
146
|
+
const { nmriumState: { data: { spectra = [] } = {} }, containsNmrium = false, resetSourceObject = true, } = payload;
|
|
139
147
|
if (containsNmrium) {
|
|
140
|
-
return initData(draft, action);
|
|
148
|
+
return initData(draft, action, { autoOnLoadProcessing: false });
|
|
141
149
|
}
|
|
142
150
|
else {
|
|
143
151
|
setData(draft, payload);
|
|
@@ -151,4 +159,4 @@ function loadDropFiles(draft, action) {
|
|
|
151
159
|
draft.isLoading = false;
|
|
152
160
|
}
|
|
153
161
|
}
|
|
154
|
-
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
|
-
import { DISPLAYER_MODE } from '../core/Constants';
|
|
8
|
-
import {
|
|
7
|
+
import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
|
|
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
|
[
|
|
@@ -82,10 +87,14 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
82
87
|
function initMoleculeViewProperties(id, draft) {
|
|
83
88
|
// check if the molecule is exists in the view object otherwise add it with the default value
|
|
84
89
|
if (!draft.view.molecules[id]) {
|
|
90
|
+
const position = getFloatingMoleculeInitialPosition(id, draft);
|
|
85
91
|
draft.view.molecules[id] = {
|
|
86
92
|
floating: {
|
|
87
93
|
visible: false,
|
|
88
|
-
bounding:
|
|
94
|
+
bounding: {
|
|
95
|
+
...DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT,
|
|
96
|
+
...position,
|
|
97
|
+
},
|
|
89
98
|
},
|
|
90
99
|
showAtomNumber: false,
|
|
91
100
|
};
|
|
@@ -94,7 +103,28 @@ function initMoleculeViewProperties(id, draft) {
|
|
|
94
103
|
function getMoleculeViewObject(id, draft) {
|
|
95
104
|
return draft.view.molecules[id] || null;
|
|
96
105
|
}
|
|
97
|
-
function
|
|
106
|
+
function getFloatingMoleculeInitialPosition(id, draft) {
|
|
107
|
+
const { view: { molecules }, width: displayerWidth, height: displayerHeight, } = draft;
|
|
108
|
+
const { top, left } = MARGIN['2D'];
|
|
109
|
+
const { width: baseWidth, height: baseHeight } = DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT;
|
|
110
|
+
const width = displayerWidth - left;
|
|
111
|
+
const height = displayerHeight - top;
|
|
112
|
+
const columns = Math.floor(width / baseWidth);
|
|
113
|
+
const rows = Math.floor(height / baseHeight);
|
|
114
|
+
const moleculeKeys = Object.keys(molecules);
|
|
115
|
+
let index = 0;
|
|
116
|
+
if (!molecules[id]) {
|
|
117
|
+
index = moleculeKeys.length - 1;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
index = moleculeKeys.indexOf(id);
|
|
121
|
+
}
|
|
122
|
+
const x = ((index + 1) % columns) * (width / columns) + left;
|
|
123
|
+
const y = Math.floor(moleculeKeys.length / columns) * (height / rows) + top;
|
|
124
|
+
return { x, y };
|
|
125
|
+
}
|
|
126
|
+
//action
|
|
127
|
+
function handleFloatMoleculeOverSpectrum(draft, action) {
|
|
98
128
|
const { id } = action.payload;
|
|
99
129
|
initMoleculeViewProperties(id, draft);
|
|
100
130
|
const molecule = getMoleculeViewObject(id, draft);
|
|
@@ -102,7 +132,8 @@ function floatMoleculeOverSpectrum(draft, action) {
|
|
|
102
132
|
molecule.floating.visible = !molecule.floating.visible;
|
|
103
133
|
}
|
|
104
134
|
}
|
|
105
|
-
|
|
135
|
+
//action
|
|
136
|
+
function handleToggleMoleculeAtomsNumbers(draft, action) {
|
|
106
137
|
const { id } = action.payload;
|
|
107
138
|
initMoleculeViewProperties(id, draft);
|
|
108
139
|
const molecule = getMoleculeViewObject(id, draft);
|
|
@@ -110,7 +141,8 @@ function toggleMoleculeAtomsNumbers(draft, action) {
|
|
|
110
141
|
molecule.showAtomNumber = !molecule.showAtomNumber;
|
|
111
142
|
}
|
|
112
143
|
}
|
|
113
|
-
|
|
144
|
+
//action
|
|
145
|
+
function handleChangeFloatMoleculePosition(draft, action) {
|
|
114
146
|
const { id, bounding } = action.payload;
|
|
115
147
|
const molecule = getMoleculeViewObject(id, draft);
|
|
116
148
|
if (molecule) {
|
|
@@ -120,9 +152,10 @@ function changeFloatMoleculePosition(draft, action) {
|
|
|
120
152
|
throw new Error(`Molecule ${id} does not exist`);
|
|
121
153
|
}
|
|
122
154
|
}
|
|
123
|
-
|
|
155
|
+
//action
|
|
156
|
+
function handleChangeMoleculeLabel(draft, action) {
|
|
124
157
|
const { id, label } = action.payload;
|
|
125
158
|
const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
|
|
126
159
|
draft.molecules[moleculeIndex].label = label;
|
|
127
160
|
}
|
|
128
|
-
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, };
|