nmrium 1.6.1 → 1.8.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/FloatingRanges.js +4 -4
- package/lib/component/1d/FloatingRanges.js.map +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js.map +1 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js.map +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts.map +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -2
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotations.d.ts.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +2 -2
- package/lib/component/1d/peaks/PeakAnnotations.js.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +4 -4
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js.map +1 -1
- package/lib/component/1d/peaks/Peaks.d.ts +4 -1
- package/lib/component/1d/peaks/Peaks.d.ts.map +1 -1
- package/lib/component/1d/peaks/Peaks.js +5 -2
- package/lib/component/1d/peaks/Peaks.js.map +1 -1
- package/lib/component/1d/ranges/Atoms.d.ts.map +1 -1
- package/lib/component/1d/ranges/Atoms.js +24 -9
- package/lib/component/1d/ranges/Atoms.js.map +1 -1
- package/lib/component/1d/ranges/Range.d.ts.map +1 -1
- package/lib/component/1d/ranges/Range.js +3 -3
- package/lib/component/1d/ranges/Range.js.map +1 -1
- package/lib/component/1d/ranges/RangesIntegrals.d.ts.map +1 -1
- package/lib/component/1d/ranges/RangesIntegrals.js +5 -3
- package/lib/component/1d/ranges/RangesIntegrals.js.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +32 -41
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.d.ts.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.js.map +1 -1
- package/lib/component/2d/FooterBanner.js +2 -2
- package/lib/component/2d/FooterBanner.js.map +1 -1
- package/lib/component/2d/YAxis.d.ts +0 -1
- package/lib/component/2d/YAxis.d.ts.map +1 -1
- package/lib/component/2d/YAxis.js +11 -4
- package/lib/component/2d/YAxis.js.map +1 -1
- package/lib/component/2d/useTracesSpectra.d.ts.map +1 -1
- package/lib/component/2d/useTracesSpectra.js +2 -0
- package/lib/component/2d/useTracesSpectra.js.map +1 -1
- package/lib/component/2d/utilities/extractSpectrumSignals.d.ts +2 -9
- package/lib/component/2d/utilities/extractSpectrumSignals.d.ts.map +1 -1
- package/lib/component/2d/utilities/extractSpectrumSignals.js +4 -5
- package/lib/component/2d/utilities/extractSpectrumSignals.js.map +1 -1
- package/lib/component/2d/zones/SignalsGuideLines.d.ts.map +1 -1
- package/lib/component/2d/zones/SignalsGuideLines.js +7 -10
- package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
- package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts.map +1 -1
- package/lib/component/2d/zones/ZonesAssignmentsLabels.js.map +1 -1
- package/lib/component/context/DispatchContext.d.ts +2 -2
- package/lib/component/context/DispatchContext.d.ts.map +1 -1
- package/lib/component/context/LoggerContext.d.ts.map +1 -1
- package/lib/component/context/LoggerContext.js +8 -9
- package/lib/component/context/LoggerContext.js.map +1 -1
- package/lib/component/context/PreferencesContext.d.ts +7 -3
- package/lib/component/context/PreferencesContext.d.ts.map +1 -1
- package/lib/component/context/PreferencesContext.js +1 -2
- package/lib/component/context/PreferencesContext.js.map +1 -1
- package/lib/component/elements/D3Axis.d.ts.map +1 -1
- package/lib/component/elements/D3Axis.js +1 -1
- package/lib/component/elements/D3Axis.js.map +1 -1
- package/lib/component/elements/Sections.js +1 -1
- package/lib/component/elements/Sections.js.map +1 -1
- package/lib/component/hooks/useActiveSpectrumRangesViewState.d.ts.map +1 -1
- package/lib/component/hooks/useActiveSpectrumRangesViewState.js +2 -2
- package/lib/component/hooks/useActiveSpectrumRangesViewState.js.map +1 -1
- package/lib/component/hooks/useExport.d.ts.map +1 -1
- package/lib/component/hooks/useExport.js +24 -6
- package/lib/component/hooks/useExport.js.map +1 -1
- package/lib/component/loader/Spinner.js +1 -1
- package/lib/component/loader/Spinner.js.map +1 -1
- package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
- package/lib/component/loader/useLoadFiles.js +60 -25
- package/lib/component/loader/useLoadFiles.js.map +1 -1
- package/lib/component/main/InnerNMRium.d.ts.map +1 -1
- package/lib/component/main/InnerNMRium.js +4 -2
- package/lib/component/main/InnerNMRium.js.map +1 -1
- package/lib/component/main/NMRiumStateProvider.d.ts.map +1 -1
- package/lib/component/main/NMRiumStateProvider.js +17 -6
- package/lib/component/main/NMRiumStateProvider.js.map +1 -1
- package/lib/component/modal/LoadJCAMPModal.d.ts.map +1 -1
- package/lib/component/modal/LoadJCAMPModal.js +7 -3
- package/lib/component/modal/LoadJCAMPModal.js.map +1 -1
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts.map +1 -1
- package/lib/component/modal/MoleculeStructureEditorModal.js +7 -3
- package/lib/component/modal/MoleculeStructureEditorModal.js.map +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +0 -2
- package/lib/component/modal/MultipletAnalysisModal.js.map +1 -1
- package/lib/component/modal/SaveAsModal.d.ts.map +1 -1
- package/lib/component/modal/SaveAsModal.js +10 -3
- package/lib/component/modal/SaveAsModal.js.map +1 -1
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts.map +1 -1
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +0 -2
- package/lib/component/modal/changeSum/ChangeSumModalContents.js.map +1 -1
- package/lib/component/modal/changeSum/SelectMolecule.d.ts.map +1 -1
- package/lib/component/modal/changeSum/SelectMolecule.js +0 -2
- package/lib/component/modal/changeSum/SelectMolecule.js.map +1 -1
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts.map +1 -1
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +1 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js.map +1 -1
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.d.ts.map +1 -1
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +16 -0
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js.map +1 -1
- package/lib/component/modal/setting/settingsValidation.js +2 -2
- package/lib/component/modal/setting/settingsValidation.js.map +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts.map +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js.map +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts.map +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -3
- package/lib/component/panels/IntegralsPanel/IntegralTable.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts +6 -0
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js +87 -0
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +18 -28
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +32 -25
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts +13 -0
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.js +66 -0
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/{useAtomAssignment.d.ts → hooks/useAtomAssignment.d.ts} +1 -1
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/{useAtomAssignment.js → hooks/useAtomAssignment.js} +50 -19
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts +12 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js +58 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts +5 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.js +2 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts +16 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js +47 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts +18 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js +31 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts +3 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js +12 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts +4 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js +25 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts +6 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js +18 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js.map +1 -0
- package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +24 -26
- package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +3 -2
- package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts.map +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +3 -2
- package/lib/component/panels/RangesPanel/RangesHeader.js.map +1 -1
- package/lib/component/panels/RangesPanel/RangesTable.d.ts +1 -1
- package/lib/component/panels/RangesPanel/RangesTable.d.ts.map +1 -1
- package/lib/component/panels/RangesPanel/RangesTable.js +2 -1
- package/lib/component/panels/RangesPanel/RangesTable.js.map +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js.map +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js.map +1 -1
- package/lib/component/panels/SpectraPanel/SpectraTable.d.ts.map +1 -1
- package/lib/component/panels/SpectraPanel/SpectraTable.js +3 -2
- package/lib/component/panels/SpectraPanel/SpectraTable.js.map +1 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -2
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js.map +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js.map +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts.map +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +0 -4
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js.map +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +8 -8
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js.map +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.d.ts.map +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +6 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js.map +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +8 -9
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts.map +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js.map +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts.map +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +0 -2
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js.map +1 -1
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +7 -7
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts.map +1 -1
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +3 -3
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.js.map +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts.map +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +13 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js +0 -2
- package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js.map +1 -1
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts +9 -0
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts.map +1 -0
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.js +27 -0
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.js.map +1 -0
- package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts.map +1 -1
- package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +0 -2
- package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js.map +1 -1
- package/lib/component/reducer/IgnoreActions.d.ts.map +1 -1
- package/lib/component/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/IgnoreActions.js.map +1 -1
- package/lib/component/reducer/Reducer.d.ts +13 -1
- package/lib/component/reducer/Reducer.d.ts.map +1 -1
- package/lib/component/reducer/Reducer.js +10 -3
- package/lib/component/reducer/Reducer.js.map +1 -1
- package/lib/component/reducer/actions/DatabaseActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib/component/reducer/actions/DatabaseActions.js.map +1 -1
- package/lib/component/reducer/actions/IntegralsActions.js.map +1 -1
- package/lib/component/reducer/actions/{LoadActions.d.ts → LoadAction.d.ts} +16 -5
- package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -0
- package/lib/component/reducer/actions/{LoadActions.js → LoadAction.js} +60 -16
- package/lib/component/reducer/actions/LoadAction.js.map +1 -0
- package/lib/component/reducer/actions/MoleculeActions.d.ts +22 -6
- package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.js +43 -29
- package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +12 -6
- package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/RangesActions.js +37 -16
- package/lib/component/reducer/actions/RangesActions.js.map +1 -1
- package/lib/component/reducer/actions/ZonesActions.d.ts +3 -3
- package/lib/component/reducer/actions/ZonesActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/ZonesActions.js +9 -4
- package/lib/component/reducer/actions/ZonesActions.js.map +1 -1
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts +4 -0
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts.map +1 -0
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js +7 -0
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js.map +1 -0
- package/lib/component/reducer/preferences/actions/initPreferences.d.ts.map +1 -1
- package/lib/component/reducer/preferences/actions/initPreferences.js +1 -2
- package/lib/component/reducer/preferences/actions/initPreferences.js.map +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts.map +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +2 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +9 -8
- package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +3 -1
- package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
- package/lib/component/toolbar/ToolTypes.js +1 -0
- package/lib/component/toolbar/ToolTypes.js.map +1 -1
- package/lib/component/utility/export.d.ts +3 -3
- package/lib/component/utility/export.d.ts.map +1 -1
- package/lib/component/utility/export.js +13 -21
- package/lib/component/utility/export.js.map +1 -1
- package/lib/component/utility/getClosePeak.js +1 -1
- package/lib/component/utility/getClosePeak.js.map +1 -1
- package/lib/component/utility/save_as.d.ts +9 -0
- package/lib/component/utility/save_as.d.ts.map +1 -0
- package/lib/component/utility/save_as.js +7 -0
- package/lib/component/utility/save_as.js.map +1 -0
- package/lib/component/workspaces/assignment.d.ts.map +1 -1
- package/lib/component/workspaces/assignment.js +7 -0
- package/lib/component/workspaces/assignment.js.map +1 -1
- package/lib/component/workspaces/basic.d.ts.map +1 -1
- package/lib/component/workspaces/basic.js +5 -0
- package/lib/component/workspaces/basic.js.map +1 -1
- package/lib/component/workspaces/embedded.d.ts.map +1 -1
- package/lib/component/workspaces/embedded.js +5 -0
- package/lib/component/workspaces/embedded.js.map +1 -1
- package/lib/component/workspaces/exercise.d.ts.map +1 -1
- package/lib/component/workspaces/exercise.js +5 -0
- package/lib/component/workspaces/exercise.js.map +1 -1
- package/lib/component/workspaces/prediction.d.ts.map +1 -1
- package/lib/component/workspaces/prediction.js +5 -0
- package/lib/component/workspaces/prediction.js.map +1 -1
- package/lib/component/workspaces/process1D.d.ts.map +1 -1
- package/lib/component/workspaces/process1D.js +6 -0
- package/lib/component/workspaces/process1D.js.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +18 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
- package/lib/data/PredictionManager.d.ts.map +1 -1
- package/lib/data/PredictionManager.js +13 -9
- package/lib/data/PredictionManager.js.map +1 -1
- package/lib/data/SpectraManager.d.ts +45 -4
- package/lib/data/SpectraManager.d.ts.map +1 -1
- package/lib/data/SpectraManager.js +69 -12
- package/lib/data/SpectraManager.js.map +1 -1
- package/lib/data/constants/signalsKinds.d.ts +1 -6
- package/lib/data/constants/signalsKinds.d.ts.map +1 -1
- package/lib/data/constants/signalsKinds.js +2 -17
- package/lib/data/constants/signalsKinds.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +16 -14
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +1 -10
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/isRangeAssigned.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/isRangeAssigned.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js +5 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +1 -1
- package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +6 -4
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -2
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -2
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
- package/lib/data/molecules/Molecule.d.ts +2 -22
- package/lib/data/molecules/Molecule.d.ts.map +1 -1
- package/lib/data/molecules/Molecule.js +3 -1
- package/lib/data/molecules/Molecule.js.map +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +3 -2
- package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
- package/lib/data/molecules/MoleculeManager.js +4 -2
- package/lib/data/molecules/MoleculeManager.js.map +1 -1
- package/lib/data/utilities/RangeUtilities.d.ts +3 -2
- package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
- package/lib/data/utilities/RangeUtilities.js +9 -3
- package/lib/data/utilities/RangeUtilities.js.map +1 -1
- package/lib/data/utilities/ZoneUtilities.d.ts.map +1 -1
- package/lib/data/utilities/ZoneUtilities.js +1 -2
- package/lib/data/utilities/ZoneUtilities.js.map +1 -1
- package/lib/data/utilities/isProton.d.ts +2 -0
- package/lib/data/utilities/isProton.d.ts.map +1 -0
- package/lib/data/utilities/isProton.js +4 -0
- package/lib/data/utilities/isProton.js.map +1 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +32 -32
- package/src/component/1d/FloatingRanges.tsx +5 -5
- package/src/component/1d/database/DatabaseSpectrum.tsx +1 -1
- package/src/component/1d/multiAnalysis/MultiAnalysisRanges.tsx +1 -1
- package/src/component/1d/multiplicityTree/MultiplicityTree.tsx +4 -2
- package/src/component/1d/peaks/PeakAnnotations.tsx +2 -1
- package/src/component/1d/peaks/PeakAnnotationsSpreadMode.tsx +11 -1
- package/src/component/1d/peaks/Peaks.tsx +9 -3
- package/src/component/1d/ranges/Atoms.tsx +36 -13
- package/src/component/1d/ranges/Range.tsx +4 -3
- package/src/component/1d/ranges/RangesIntegrals.tsx +6 -2
- package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +38 -78
- package/src/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.tsx +5 -2
- package/src/component/2d/FooterBanner.tsx +2 -2
- package/src/component/2d/YAxis.tsx +31 -13
- package/src/component/2d/useTracesSpectra.ts +3 -0
- package/src/component/2d/utilities/extractSpectrumSignals.ts +6 -16
- package/src/component/2d/zones/SignalsGuideLines.tsx +11 -9
- package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +2 -3
- package/src/component/context/DispatchContext.tsx +2 -2
- package/src/component/context/LoggerContext.tsx +8 -11
- package/src/component/context/PreferencesContext.tsx +8 -5
- package/src/component/elements/D3Axis.tsx +1 -2
- package/src/component/elements/Sections.tsx +1 -1
- package/src/component/hooks/useActiveSpectrumRangesViewState.ts +2 -2
- package/src/component/hooks/useExport.tsx +38 -6
- package/src/component/loader/Spinner.tsx +1 -1
- package/src/component/loader/useLoadFiles.ts +79 -30
- package/src/component/main/InnerNMRium.tsx +6 -2
- package/src/component/main/NMRiumStateProvider.tsx +18 -7
- package/src/component/modal/LoadJCAMPModal.tsx +10 -5
- package/src/component/modal/MoleculeStructureEditorModal.tsx +11 -3
- package/src/component/modal/MultipletAnalysisModal.tsx +0 -2
- package/src/component/modal/SaveAsModal.tsx +35 -6
- package/src/component/modal/changeSum/ChangeSumModalContents.tsx +0 -2
- package/src/component/modal/changeSum/SelectMolecule.tsx +0 -2
- package/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx +1 -3
- package/src/component/modal/setting/settings-tabs/ToolsTabContent.tsx +16 -0
- package/src/component/modal/setting/settingsValidation.ts +2 -2
- package/src/component/panels/IntegralsPanel/IntegralPanel.tsx +2 -6
- package/src/component/panels/IntegralsPanel/IntegralTable.tsx +4 -3
- package/src/component/panels/MoleculesPanel/MoleculeOptionsPanel.tsx +160 -0
- package/src/component/panels/MoleculesPanel/MoleculePanel.tsx +77 -102
- package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +54 -35
- package/src/component/panels/MoleculesPanel/MoleculeStructure.tsx +117 -0
- package/src/component/panels/MoleculesPanel/{useAtomAssignment.tsx → hooks/useAtomAssignment.tsx} +71 -30
- package/src/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.ts +74 -0
- package/src/component/panels/MoleculesPanel/utilities/AtomData.ts +4 -0
- package/src/component/panels/MoleculesPanel/utilities/extractFromAtom.ts +63 -0
- package/src/component/panels/MoleculesPanel/utilities/getAssignIds.ts +59 -0
- package/src/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.ts +12 -0
- package/src/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.ts +36 -0
- package/src/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.ts +20 -0
- package/src/component/panels/PeaksPanel/PeaksPanel.tsx +25 -35
- package/src/component/panels/PeaksPanel/PeaksTable.tsx +3 -2
- package/src/component/panels/RangesPanel/RangesHeader.tsx +3 -2
- package/src/component/panels/RangesPanel/RangesTable.tsx +10 -8
- package/src/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.tsx +3 -3
- package/src/component/panels/RangesPanel/TableColumns/RelativeColumn.tsx +2 -2
- package/src/component/panels/SpectraPanel/SpectraTable.tsx +3 -2
- package/src/component/panels/SummaryPanel/utilities/Utilities.ts +2 -2
- package/src/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.tsx +1 -1
- package/src/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.tsx +0 -4
- package/src/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.tsx +9 -9
- package/src/component/panels/ZonesPanel/ZonesPanel.tsx +15 -5
- package/src/component/panels/ZonesPanel/ZonesTable.tsx +9 -10
- package/src/component/panels/ZonesPanel/ZonesTableRow.tsx +0 -2
- package/src/component/panels/ZonesPanel/hooks/useMapZones.ts +11 -11
- package/src/component/panels/databasePanel/DatabasePanel.tsx +18 -14
- package/src/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.tsx +0 -2
- package/src/component/panels/hooks/useMoleculeAnnotationCore.ts +36 -0
- package/src/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.tsx +0 -2
- package/src/component/reducer/IgnoreActions.ts +2 -1
- package/src/component/reducer/Reducer.ts +28 -4
- package/src/component/reducer/actions/DatabaseActions.ts +3 -0
- package/src/component/reducer/actions/IntegralsActions.ts +1 -1
- package/src/component/reducer/actions/{LoadActions.ts → LoadAction.ts} +87 -25
- package/src/component/reducer/actions/MoleculeActions.ts +91 -44
- package/src/component/reducer/actions/RangesActions.ts +66 -30
- package/src/component/reducer/actions/ZonesActions.ts +18 -10
- package/src/component/reducer/preferences/actions/changeDefaultMoleculeSettings.ts +16 -0
- package/src/component/reducer/preferences/actions/initPreferences.ts +0 -3
- package/src/component/reducer/preferences/panelsPreferencesDefaultValues.ts +2 -1
- package/src/component/reducer/preferences/preferencesReducer.ts +20 -11
- package/src/component/toolbar/ToolTypes.ts +1 -0
- package/src/component/utility/export.ts +15 -20
- package/src/component/utility/getClosePeak.ts +1 -1
- package/src/component/utility/save_as.ts +16 -0
- package/src/component/workspaces/assignment.ts +7 -0
- package/src/component/workspaces/basic.ts +5 -0
- package/src/component/workspaces/embedded.ts +5 -0
- package/src/component/workspaces/exercise.ts +5 -0
- package/src/component/workspaces/prediction.ts +5 -0
- package/src/component/workspaces/process1D.ts +6 -0
- package/src/component/workspaces/workspaceDefaultProperties.ts +18 -0
- package/src/data/PredictionManager.ts +21 -14
- package/src/data/SpectraManager.ts +90 -19
- package/src/data/constants/signalsKinds.ts +5 -20
- package/src/data/data1d/Spectrum1D/generateJGraphData.ts +1 -1
- package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +16 -16
- package/src/data/data1d/Spectrum1D/isRangeAssigned.ts +1 -0
- package/src/data/data1d/Spectrum1D/ranges/autoRangesDetection.ts +7 -4
- package/src/data/data1d/Spectrum1D/ranges/detectRanges.ts +8 -1
- package/src/data/data1d/Spectrum1D/ranges/detectSignals.ts +1 -1
- package/src/data/data2d/Spectrum2D/contours.ts +2 -3
- package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +6 -7
- package/src/data/molecules/Molecule.ts +9 -23
- package/src/data/molecules/MoleculeManager.ts +10 -8
- package/src/data/utilities/RangeUtilities.ts +12 -4
- package/src/data/utilities/ZoneUtilities.ts +1 -3
- package/src/data/utilities/isProton.ts +3 -0
- package/src/index.tsx +0 -3
- package/src/versionInfo.ts +1 -1
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +0 -43
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts.map +0 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +0 -126
- package/lib/component/panels/MoleculesPanel/Utilities.js.map +0 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +0 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +0 -1
- package/lib/component/reducer/actions/LoadActions.d.ts.map +0 -1
- package/lib/component/reducer/actions/LoadActions.js.map +0 -1
- package/lib/component/utility/isHomoNuclear.d.ts +0 -2
- package/lib/component/utility/isHomoNuclear.d.ts.map +0 -1
- package/lib/component/utility/isHomoNuclear.js +0 -11
- package/lib/component/utility/isHomoNuclear.js.map +0 -1
- package/lib/data/types/common/SignalKind.d.ts +0 -2
- package/lib/data/types/common/SignalKind.d.ts.map +0 -1
- package/lib/data/types/common/SignalKind.js +0 -2
- package/lib/data/types/common/SignalKind.js.map +0 -1
- package/lib/utils/stringCapitalize.d.ts +0 -2
- package/lib/utils/stringCapitalize.d.ts.map +0 -1
- package/lib/utils/stringCapitalize.js +0 -4
- package/lib/utils/stringCapitalize.js.map +0 -1
- package/src/component/panels/MoleculesPanel/Utilities.ts +0 -186
- package/src/component/utility/isHomoNuclear.ts +0 -11
- package/src/data/types/common/SignalKind.ts +0 -10
- package/src/utils/stringCapitalize.ts +0 -3
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
MoleculeView,
|
|
2
3
|
NmriumState,
|
|
3
4
|
SpectraColors,
|
|
4
5
|
Spectrum,
|
|
5
6
|
ViewState,
|
|
6
7
|
} from '@zakodium/nmrium-core';
|
|
8
|
+
import { FileCollection } from 'file-collection';
|
|
7
9
|
import type { Draft } from 'immer';
|
|
8
10
|
import { produce } from 'immer';
|
|
9
11
|
import lodashMerge from 'lodash/merge.js';
|
|
@@ -23,6 +25,7 @@ import type { State } from '../Reducer.js';
|
|
|
23
25
|
import { getDefaultViewState, getInitialState } from '../Reducer.js';
|
|
24
26
|
import type { ActionType } from '../types/ActionType.js';
|
|
25
27
|
|
|
28
|
+
import { initMoleculeViewProperties } from './MoleculeActions.ts';
|
|
26
29
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions.js';
|
|
27
30
|
import { setSpectraMetaInfo } from './SpectraActions.js';
|
|
28
31
|
import { setActiveTab } from './ToolsActions.js';
|
|
@@ -30,13 +33,18 @@ import { setActiveTab } from './ToolsActions.js';
|
|
|
30
33
|
//TODO use viewState type instead of any { view?: ViewState }
|
|
31
34
|
interface InitiateProps {
|
|
32
35
|
nmriumState: Partial<NmriumState>;
|
|
36
|
+
aggregator: FileCollection;
|
|
33
37
|
}
|
|
34
|
-
interface InputProps extends InitiateProps {
|
|
38
|
+
interface InputProps extends Omit<InitiateProps, 'aggregator'> {
|
|
35
39
|
containsNmrium?: boolean;
|
|
36
40
|
usedColors?: UsedColors;
|
|
37
41
|
parseMetaFileResult?: ParseResult<any> | null;
|
|
38
42
|
resetSourceObject?: boolean;
|
|
39
43
|
spectraColors?: SpectraColors;
|
|
44
|
+
fileCollection?: FileCollection;
|
|
45
|
+
selectorRoot?: string;
|
|
46
|
+
aggregator?: FileCollection;
|
|
47
|
+
defaultMoleculeSettings?: MoleculeView;
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
type SetIsLoadingAction = ActionType<
|
|
@@ -48,7 +56,7 @@ type SetIsLoadingAction = ActionType<
|
|
|
48
56
|
type LoadDropFilesAction = ActionType<'LOAD_DROP_FILES', InputProps>;
|
|
49
57
|
type InitiateAction = ActionType<'INITIATE', InitiateProps>;
|
|
50
58
|
|
|
51
|
-
export type
|
|
59
|
+
export type LoadAction =
|
|
52
60
|
| SetIsLoadingAction
|
|
53
61
|
| LoadDropFilesAction
|
|
54
62
|
| InitiateAction;
|
|
@@ -89,23 +97,31 @@ function setCorrelation(draft: Draft<State>, correlations: CorrelationData) {
|
|
|
89
97
|
}
|
|
90
98
|
}
|
|
91
99
|
|
|
92
|
-
function
|
|
100
|
+
function isDataSourceDropFiles(
|
|
101
|
+
input: InputProps | InitiateProps,
|
|
102
|
+
): input is InputProps {
|
|
103
|
+
return 'containsNmrium' in input;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function setData(draft: Draft<State>, input: InputProps | InitiateProps) {
|
|
107
|
+
const { data, view } = input.nmriumState || {
|
|
108
|
+
data: { spectra: [], molecules: [], correlations: {} },
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const parseMetaFileResult =
|
|
112
|
+
'parseMetaFileResult' in input ? input.parseMetaFileResult || null : null;
|
|
113
|
+
|
|
93
114
|
const {
|
|
94
|
-
nmriumState: { data, view },
|
|
95
|
-
parseMetaFileResult = null,
|
|
96
115
|
spectraColors = {
|
|
97
116
|
oneDimension: [],
|
|
98
117
|
twoDimensions: [],
|
|
99
118
|
highlightColor: '#ffd70080',
|
|
100
119
|
indicatorLineColor: '#2FFF0085',
|
|
101
120
|
},
|
|
102
|
-
} = input
|
|
103
|
-
nmriumState: { data: { spectra: [], molecules: [], correlations: {} } },
|
|
104
|
-
multipleAnalysis: {},
|
|
105
|
-
};
|
|
121
|
+
} = 'spectraColors' in input ? input : { spectraColors: undefined };
|
|
106
122
|
|
|
107
123
|
const {
|
|
108
|
-
|
|
124
|
+
sources,
|
|
109
125
|
spectra = [],
|
|
110
126
|
molecules = [],
|
|
111
127
|
correlations = {},
|
|
@@ -113,24 +129,62 @@ function setData(draft: Draft<State>, input: InputProps) {
|
|
|
113
129
|
|
|
114
130
|
if (view) {
|
|
115
131
|
const defaultViewState = getDefaultViewState();
|
|
132
|
+
|
|
116
133
|
draft.view = lodashMerge(defaultViewState, view);
|
|
117
134
|
}
|
|
118
135
|
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
draft.source
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
if (sources && sources.length > 0) {
|
|
137
|
+
for (const source of sources) {
|
|
138
|
+
if (draft.sources[source.id]) {
|
|
139
|
+
draft.sources[source.id] = lodashMergeWith(
|
|
140
|
+
draft.sources[source.id],
|
|
141
|
+
source,
|
|
142
|
+
(objValue: any, srcValue: any) => {
|
|
143
|
+
if (Array.isArray(objValue)) {
|
|
144
|
+
return objValue.concat(srcValue);
|
|
145
|
+
}
|
|
146
|
+
return undefined;
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
draft.sources[source.id] = source;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (input.aggregator) {
|
|
156
|
+
if ('forceInitialize' in input && input.forceInitialize) {
|
|
157
|
+
draft.aggregator = input.aggregator;
|
|
158
|
+
} else {
|
|
159
|
+
draft.aggregator = FileCollection.fromCollection(draft.aggregator);
|
|
160
|
+
draft.aggregator.appendFileCollection(input.aggregator, '');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (
|
|
165
|
+
'fileCollection' in input &&
|
|
166
|
+
input.fileCollection &&
|
|
167
|
+
'selectorRoot' in input &&
|
|
168
|
+
input.selectorRoot
|
|
169
|
+
) {
|
|
170
|
+
draft.aggregator = FileCollection.fromCollection(draft.aggregator);
|
|
171
|
+
draft.aggregator.appendFileCollection(
|
|
172
|
+
input.fileCollection,
|
|
173
|
+
input.selectorRoot,
|
|
129
174
|
);
|
|
130
175
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
176
|
+
|
|
177
|
+
const newMolecules = MoleculeManager.fromJSON(molecules, draft.molecules);
|
|
178
|
+
|
|
179
|
+
draft.molecules = draft.molecules.concat(newMolecules);
|
|
180
|
+
|
|
181
|
+
if (isDataSourceDropFiles(input) && !input?.containsNmrium) {
|
|
182
|
+
const { defaultMoleculeSettings } = input;
|
|
183
|
+
for (const { id } of newMolecules) {
|
|
184
|
+
initMoleculeViewProperties(draft, { id, defaultMoleculeSettings });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
134
188
|
draft.data = draft.data.concat(
|
|
135
189
|
initSpectra(spectra, {
|
|
136
190
|
usedColors: draft.usedColors,
|
|
@@ -228,6 +282,10 @@ function initData(
|
|
|
228
282
|
initialDraft.actionType = action.type;
|
|
229
283
|
});
|
|
230
284
|
} else {
|
|
285
|
+
if (action.payload.aggregator) {
|
|
286
|
+
draft.aggregator = FileCollection.fromCollection(draft.aggregator);
|
|
287
|
+
draft.aggregator.appendFileCollection(action.payload.aggregator, '');
|
|
288
|
+
}
|
|
231
289
|
if (view) {
|
|
232
290
|
const defaultViewState = getDefaultViewState();
|
|
233
291
|
draft.view = lodashMerge(defaultViewState, view);
|
|
@@ -271,7 +329,7 @@ function handleLoadDropFiles(draft: Draft<State>, action: LoadDropFilesAction) {
|
|
|
271
329
|
|
|
272
330
|
// set source undefined when dragging and dropping a spectra file to prevent export spectra with the data source.
|
|
273
331
|
if (resetSourceObject && spectra?.length > 0) {
|
|
274
|
-
draft.
|
|
332
|
+
draft.sources = {};
|
|
275
333
|
}
|
|
276
334
|
|
|
277
335
|
draft.actionType = type;
|
|
@@ -280,4 +338,8 @@ function handleLoadDropFiles(draft: Draft<State>, action: LoadDropFilesAction) {
|
|
|
280
338
|
}
|
|
281
339
|
}
|
|
282
340
|
|
|
283
|
-
export
|
|
341
|
+
export const LoadActions = {
|
|
342
|
+
handleInitiate,
|
|
343
|
+
handleLoadDropFiles,
|
|
344
|
+
handleSetIsLoading,
|
|
345
|
+
} as const;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MoleculeView, StateMolecule } from '@zakodium/nmrium-core';
|
|
1
2
|
import type { Logger } from 'cheminfo-types';
|
|
2
3
|
import type { FifoLogger } from 'fifo-logger';
|
|
3
4
|
import type { Draft } from 'immer';
|
|
@@ -12,10 +13,7 @@ import type {
|
|
|
12
13
|
} from '../../../data/PredictionManager.js';
|
|
13
14
|
import { generateSpectra } from '../../../data/PredictionManager.js';
|
|
14
15
|
import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager.js';
|
|
15
|
-
import type {
|
|
16
|
-
MoleculeBoundingRect,
|
|
17
|
-
StateMolecule,
|
|
18
|
-
} from '../../../data/molecules/Molecule.js';
|
|
16
|
+
import type { MoleculeBoundingRect } from '../../../data/molecules/Molecule.js';
|
|
19
17
|
import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT } from '../../../data/molecules/Molecule.js';
|
|
20
18
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager.js';
|
|
21
19
|
import { generateColor } from '../../../data/utilities/generateColor.js';
|
|
@@ -33,17 +31,22 @@ interface AddMoleculeProps {
|
|
|
33
31
|
molfile: string;
|
|
34
32
|
id?: string;
|
|
35
33
|
floatMoleculeOnSave?: boolean;
|
|
34
|
+
defaultMoleculeSettings?: MoleculeView;
|
|
36
35
|
}
|
|
37
36
|
type AddMoleculeAction = ActionType<'ADD_MOLECULE', AddMoleculeProps>;
|
|
38
37
|
type AddMoleculesAction = ActionType<
|
|
39
38
|
'ADD_MOLECULES',
|
|
40
|
-
{
|
|
39
|
+
{
|
|
40
|
+
molecules: StateMolecule[];
|
|
41
|
+
defaultMoleculeSettings?: MoleculeView;
|
|
42
|
+
}
|
|
41
43
|
>;
|
|
42
44
|
type SetMoleculeAction = ActionType<
|
|
43
45
|
'SET_MOLECULE',
|
|
44
|
-
Required<StateMolecule
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
Required<Pick<StateMolecule, 'id' | 'molfile' | 'label'>> &
|
|
47
|
+
Omit<StateMolecule, 'id' | 'molfile' | 'label'> & {
|
|
48
|
+
mappings?: ReturnType<TopicMolecule['getDiaIDsMapping']>;
|
|
49
|
+
}
|
|
47
50
|
>;
|
|
48
51
|
type DeleteMoleculeAction = ActionType<'DELETE_MOLECULE', { id: string }>;
|
|
49
52
|
type PredictSpectraFromMoleculeAction = ActionType<
|
|
@@ -57,9 +60,23 @@ type PredictSpectraFromMoleculeAction = ActionType<
|
|
|
57
60
|
}
|
|
58
61
|
>;
|
|
59
62
|
type ToggleMoleculeViewObjectAction = ActionType<
|
|
60
|
-
'FLOAT_MOLECULE_OVER_SPECTRUM'
|
|
63
|
+
'FLOAT_MOLECULE_OVER_SPECTRUM',
|
|
61
64
|
{ id: string }
|
|
62
65
|
>;
|
|
66
|
+
type ToggleMoleculeLabelAction = ActionType<
|
|
67
|
+
'TOGGLE_MOLECULE_LABEL',
|
|
68
|
+
{ id: string }
|
|
69
|
+
>;
|
|
70
|
+
|
|
71
|
+
interface ChangeMoleculeAnnotationOptions
|
|
72
|
+
extends Pick<MoleculeView, 'atomAnnotation'> {
|
|
73
|
+
id: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type ChangeMoleculeAnnotationAction = ActionType<
|
|
77
|
+
'CHANGE_MOLECULE_ANNOTATION',
|
|
78
|
+
ChangeMoleculeAnnotationOptions
|
|
79
|
+
>;
|
|
63
80
|
type ChangeFloatMoleculePositionAction = ActionType<
|
|
64
81
|
'CHANGE_FLOAT_MOLECULE_POSITION',
|
|
65
82
|
{ id: string; bounding: MoleculeBoundingRect }
|
|
@@ -77,10 +94,12 @@ export type MoleculeActions =
|
|
|
77
94
|
| PredictSpectraFromMoleculeAction
|
|
78
95
|
| ToggleMoleculeViewObjectAction
|
|
79
96
|
| ChangeFloatMoleculePositionAction
|
|
80
|
-
| ChangeMoleculeLabelAction
|
|
97
|
+
| ChangeMoleculeLabelAction
|
|
98
|
+
| ChangeMoleculeAnnotationAction
|
|
99
|
+
| ToggleMoleculeLabelAction;
|
|
81
100
|
|
|
82
101
|
function addMolecule(draft: Draft<State>, props: AddMoleculeProps) {
|
|
83
|
-
const { molfile, id, floatMoleculeOnSave } = props;
|
|
102
|
+
const { molfile, id, floatMoleculeOnSave, defaultMoleculeSettings } = props;
|
|
84
103
|
const isEmpty = draft.molecules.length === 0;
|
|
85
104
|
MoleculeManager.addMolfile(draft.molecules, molfile, id);
|
|
86
105
|
|
|
@@ -95,8 +114,12 @@ function addMolecule(draft: Draft<State>, props: AddMoleculeProps) {
|
|
|
95
114
|
}
|
|
96
115
|
|
|
97
116
|
const lastAddedMolecule = draft.molecules.at(-1);
|
|
98
|
-
if (
|
|
99
|
-
|
|
117
|
+
if (lastAddedMolecule) {
|
|
118
|
+
initMoleculeViewProperties(draft, {
|
|
119
|
+
id: lastAddedMolecule.id,
|
|
120
|
+
defaultMoleculeSettings,
|
|
121
|
+
isMoleculeFloating: floatMoleculeOnSave,
|
|
122
|
+
});
|
|
100
123
|
}
|
|
101
124
|
|
|
102
125
|
return lastAddedMolecule;
|
|
@@ -107,10 +130,10 @@ function handleAddMolecule(draft: Draft<State>, action: AddMoleculeAction) {
|
|
|
107
130
|
addMolecule(draft, action.payload);
|
|
108
131
|
}
|
|
109
132
|
function handleAddMolecules(draft: Draft<State>, action: AddMoleculesAction) {
|
|
110
|
-
const molecules = action.payload
|
|
133
|
+
const { molecules, defaultMoleculeSettings } = action.payload;
|
|
111
134
|
|
|
112
135
|
for (const { molfile } of molecules) {
|
|
113
|
-
addMolecule(draft, { molfile });
|
|
136
|
+
addMolecule(draft, { molfile, defaultMoleculeSettings });
|
|
114
137
|
}
|
|
115
138
|
}
|
|
116
139
|
|
|
@@ -209,7 +232,7 @@ function handlePredictSpectraFromMolecule(
|
|
|
209
232
|
});
|
|
210
233
|
id = moleculeObj?.id;
|
|
211
234
|
} else {
|
|
212
|
-
setMolecule(draft,
|
|
235
|
+
setMolecule(draft, { id: crypto.randomUUID(), label: '', ...molecule });
|
|
213
236
|
}
|
|
214
237
|
|
|
215
238
|
if (id) {
|
|
@@ -299,19 +322,36 @@ function setPredictedSpectraReference(
|
|
|
299
322
|
draft.view.predictions[moleculeId] = spectraIds;
|
|
300
323
|
}
|
|
301
324
|
|
|
302
|
-
function initMoleculeViewProperties(
|
|
325
|
+
function initMoleculeViewProperties(
|
|
326
|
+
draft: Draft<State>,
|
|
327
|
+
options: {
|
|
328
|
+
id: string;
|
|
329
|
+
defaultMoleculeSettings?: MoleculeView;
|
|
330
|
+
isMoleculeFloating?: boolean;
|
|
331
|
+
},
|
|
332
|
+
) {
|
|
333
|
+
const { id, isMoleculeFloating, defaultMoleculeSettings } = options;
|
|
334
|
+
const { floating, ...otherDefaultOptions } = defaultMoleculeSettings || {};
|
|
335
|
+
const {
|
|
336
|
+
bounding = DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT,
|
|
337
|
+
visible = false,
|
|
338
|
+
...other
|
|
339
|
+
} = floating || {};
|
|
303
340
|
// check if the molecule is exists in the view object otherwise add it with the default value
|
|
304
341
|
if (!draft.view.molecules[id]) {
|
|
305
342
|
const position = getFloatingMoleculeInitialPosition(id, draft);
|
|
306
343
|
draft.view.molecules[id] = {
|
|
344
|
+
atomAnnotation: 'none',
|
|
345
|
+
showLabel: false,
|
|
346
|
+
...otherDefaultOptions,
|
|
307
347
|
floating: {
|
|
308
|
-
visible:
|
|
348
|
+
visible: isMoleculeFloating ?? visible,
|
|
349
|
+
...other,
|
|
309
350
|
bounding: {
|
|
310
|
-
...
|
|
351
|
+
...bounding,
|
|
311
352
|
...position,
|
|
312
353
|
},
|
|
313
354
|
},
|
|
314
|
-
showAtomNumber: false,
|
|
315
355
|
};
|
|
316
356
|
}
|
|
317
357
|
}
|
|
@@ -349,18 +389,6 @@ function getFloatingMoleculeInitialPosition(id: string, draft: Draft<State>) {
|
|
|
349
389
|
};
|
|
350
390
|
}
|
|
351
391
|
|
|
352
|
-
function floatMoleculeOverSpectrum(
|
|
353
|
-
draft: Draft<State>,
|
|
354
|
-
moleculeId: string,
|
|
355
|
-
value?: boolean,
|
|
356
|
-
) {
|
|
357
|
-
initMoleculeViewProperties(moleculeId, draft);
|
|
358
|
-
const molecule = getMoleculeViewObject(moleculeId, draft);
|
|
359
|
-
if (molecule) {
|
|
360
|
-
molecule.floating.visible = value ?? !molecule.floating.visible;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
392
|
//action
|
|
365
393
|
function handleFloatMoleculeOverSpectrum(
|
|
366
394
|
draft: Draft<State>,
|
|
@@ -368,21 +396,25 @@ function handleFloatMoleculeOverSpectrum(
|
|
|
368
396
|
) {
|
|
369
397
|
const { id } = action.payload;
|
|
370
398
|
|
|
371
|
-
|
|
399
|
+
initMoleculeViewProperties(draft, {
|
|
400
|
+
id,
|
|
401
|
+
});
|
|
402
|
+
const view = getMoleculeViewObject(id, draft);
|
|
403
|
+
view.floating.visible = !view.floating.visible;
|
|
372
404
|
}
|
|
373
405
|
|
|
374
406
|
//action
|
|
375
|
-
function
|
|
407
|
+
function handleChangeMoleculeAnnotation(
|
|
376
408
|
draft: Draft<State>,
|
|
377
|
-
action:
|
|
409
|
+
action: ChangeMoleculeAnnotationAction,
|
|
378
410
|
) {
|
|
379
|
-
const { id } = action.payload;
|
|
411
|
+
const { id, atomAnnotation } = action.payload;
|
|
380
412
|
|
|
381
|
-
initMoleculeViewProperties(
|
|
413
|
+
initMoleculeViewProperties(draft, { id });
|
|
382
414
|
const molecule = getMoleculeViewObject(id, draft);
|
|
383
|
-
if (molecule)
|
|
384
|
-
|
|
385
|
-
|
|
415
|
+
if (!molecule) return;
|
|
416
|
+
|
|
417
|
+
molecule.atomAnnotation = atomAnnotation;
|
|
386
418
|
}
|
|
387
419
|
|
|
388
420
|
//action
|
|
@@ -392,11 +424,11 @@ function handleChangeFloatMoleculePosition(
|
|
|
392
424
|
) {
|
|
393
425
|
const { id, bounding } = action.payload;
|
|
394
426
|
const molecule = getMoleculeViewObject(id, draft);
|
|
395
|
-
if (molecule) {
|
|
396
|
-
molecule.floating.bounding = { ...molecule.floating.bounding, ...bounding };
|
|
397
|
-
} else {
|
|
427
|
+
if (!molecule) {
|
|
398
428
|
throw new Error(`Molecule ${id} does not exist`);
|
|
399
429
|
}
|
|
430
|
+
|
|
431
|
+
molecule.floating.bounding = { ...molecule.floating.bounding, ...bounding };
|
|
400
432
|
}
|
|
401
433
|
|
|
402
434
|
//action
|
|
@@ -410,16 +442,31 @@ function handleChangeMoleculeLabel(
|
|
|
410
442
|
);
|
|
411
443
|
draft.molecules[moleculeIndex].label = label;
|
|
412
444
|
}
|
|
445
|
+
//action
|
|
446
|
+
function handleToggleMoleculeLabel(
|
|
447
|
+
draft: Draft<State>,
|
|
448
|
+
action: ToggleMoleculeLabelAction,
|
|
449
|
+
) {
|
|
450
|
+
const { id } = action.payload;
|
|
451
|
+
const molecule = getMoleculeViewObject(id, draft);
|
|
452
|
+
if (!molecule) {
|
|
453
|
+
throw new Error(`Molecule ${id} does not exist`);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
molecule.showLabel = !molecule.showLabel;
|
|
457
|
+
}
|
|
413
458
|
|
|
414
459
|
export {
|
|
415
460
|
addMolecule,
|
|
416
461
|
handleAddMolecule,
|
|
417
462
|
handleAddMolecules,
|
|
418
463
|
handleChangeFloatMoleculePosition,
|
|
464
|
+
handleChangeMoleculeAnnotation,
|
|
419
465
|
handleChangeMoleculeLabel,
|
|
420
466
|
handleDeleteMolecule,
|
|
421
467
|
handleFloatMoleculeOverSpectrum,
|
|
422
468
|
handlePredictSpectraFromMolecule,
|
|
423
469
|
handleSetMolecule,
|
|
424
|
-
|
|
470
|
+
handleToggleMoleculeLabel,
|
|
471
|
+
initMoleculeViewProperties,
|
|
425
472
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Range, Signal1D } from '@zakodium/nmr-types';
|
|
1
|
+
import type { Range, Signal1D, SignalKind } from '@zakodium/nmr-types';
|
|
2
2
|
import type {
|
|
3
3
|
BoundingBox,
|
|
4
4
|
RangesViewState,
|
|
@@ -11,10 +11,6 @@ import cloneDeep from 'lodash/cloneDeep.js';
|
|
|
11
11
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
12
12
|
import { Filters1DManager } from 'nmr-processing';
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
DATUM_KIND,
|
|
16
|
-
SIGNAL_INCLUDED_KINDS,
|
|
17
|
-
} from '../../../data/constants/signalsKinds.js';
|
|
18
14
|
import type {
|
|
19
15
|
SetSumOptions,
|
|
20
16
|
SumParams,
|
|
@@ -32,7 +28,8 @@ import {
|
|
|
32
28
|
} from '../../../data/data1d/Spectrum1D/index.js';
|
|
33
29
|
import type { ChangeRangeRelativeValueProps } from '../../../data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js';
|
|
34
30
|
import { unlink } from '../../../data/utilities/RangeUtilities.js';
|
|
35
|
-
import
|
|
31
|
+
import { isProton } from '../../../data/utilities/isProton.ts';
|
|
32
|
+
import type { TargetAssignKeys } from '../../panels/MoleculesPanel/utilities/getAssignIds.ts';
|
|
36
33
|
import type { RangeData } from '../../panels/RangesPanel/hooks/useMapRanges.js';
|
|
37
34
|
import type { FilterType } from '../../utility/filterType.js';
|
|
38
35
|
import type { State } from '../Reducer.js';
|
|
@@ -67,7 +64,7 @@ type DeleteRangeAction = ActionType<
|
|
|
67
64
|
type ChangeRangeSignalKindAction = ActionType<
|
|
68
65
|
'CHANGE_RANGE_SIGNAL_KIND',
|
|
69
66
|
{
|
|
70
|
-
kind:
|
|
67
|
+
kind: SignalKind;
|
|
71
68
|
range: RangeData;
|
|
72
69
|
}
|
|
73
70
|
>;
|
|
@@ -97,7 +94,15 @@ type AssignRangeAction = ActionType<
|
|
|
97
94
|
{
|
|
98
95
|
keys: TargetAssignKeys;
|
|
99
96
|
spectrumId?: string;
|
|
100
|
-
} & Required<Pick<Range, 'diaIDs' | 'nbAtoms'>>
|
|
97
|
+
} & Required<Pick<Range, 'diaIDs' | 'nbAtoms' | 'assignment'>>
|
|
98
|
+
>;
|
|
99
|
+
type ChangeRangesAssignmentsLabelsByDiaIdsAction = ActionType<
|
|
100
|
+
'CHANGE_ASSIGNMENT_LABEL_BY_DIAIDS',
|
|
101
|
+
{
|
|
102
|
+
diaIDs: string[];
|
|
103
|
+
assignment?: string;
|
|
104
|
+
previousAssignment?: string;
|
|
105
|
+
}
|
|
101
106
|
>;
|
|
102
107
|
type ResizeRangeAction = ActionType<
|
|
103
108
|
'RESIZE_RANGE',
|
|
@@ -182,6 +187,7 @@ export type RangesActions =
|
|
|
182
187
|
| DeleteRangePeakAction
|
|
183
188
|
| ChangeRangeAssignmentLabelAction
|
|
184
189
|
| ChangeRangesViewFloatingBoxBoundingAction
|
|
190
|
+
| ChangeRangesAssignmentsLabelsByDiaIdsAction
|
|
185
191
|
| ActionType<
|
|
186
192
|
| 'AUTO_RANGES_SPECTRA_PICKING'
|
|
187
193
|
| 'CHANGE_RANGES_SUM_FLAG'
|
|
@@ -206,14 +212,7 @@ function handleAutoRangesDetection(
|
|
|
206
212
|
draft: Draft<State>,
|
|
207
213
|
action: AutoRangesDetectionAction,
|
|
208
214
|
) {
|
|
209
|
-
const {
|
|
210
|
-
data,
|
|
211
|
-
xDomain,
|
|
212
|
-
molecules,
|
|
213
|
-
view: {
|
|
214
|
-
spectra: { activeTab: nucleus },
|
|
215
|
-
},
|
|
216
|
-
} = draft;
|
|
215
|
+
const { data, xDomain, molecules } = draft;
|
|
217
216
|
|
|
218
217
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
219
218
|
|
|
@@ -228,14 +227,17 @@ function handleAutoRangesDetection(
|
|
|
228
227
|
// minMaxRatio default 0.05, lookNegative default false,
|
|
229
228
|
const { minMaxRatio, lookNegative } = action.payload;
|
|
230
229
|
|
|
230
|
+
const nucleus = datum.info.nucleus;
|
|
231
|
+
const isProtonic = isProton(nucleus);
|
|
232
|
+
|
|
231
233
|
const detectionOptions: any = {
|
|
232
234
|
rangePicking: {
|
|
233
235
|
integrationSum: 100,
|
|
234
|
-
compile:
|
|
235
|
-
frequencyCluster:
|
|
236
|
-
clean: 0.
|
|
236
|
+
compile: isProtonic,
|
|
237
|
+
frequencyCluster: isProtonic ? 16 : 0,
|
|
238
|
+
clean: 0.5,
|
|
237
239
|
keepPeaks: true,
|
|
238
|
-
joinOverlapRanges:
|
|
240
|
+
joinOverlapRanges: isProtonic,
|
|
239
241
|
},
|
|
240
242
|
peakPicking: {
|
|
241
243
|
smoothY: false,
|
|
@@ -269,13 +271,14 @@ function handleAutoSpectraRangesDetection(draft: Draft<State>) {
|
|
|
269
271
|
for (const datum of data) {
|
|
270
272
|
if (datum.info.dimension === 1) {
|
|
271
273
|
const nucleus = datum.info.nucleus as string;
|
|
274
|
+
const isProtonic = isProton(nucleus);
|
|
272
275
|
const rangePicking = {
|
|
273
276
|
integrationSum: 100,
|
|
274
|
-
compile:
|
|
275
|
-
frequencyCluster:
|
|
276
|
-
clean: 0.
|
|
277
|
+
compile: isProtonic,
|
|
278
|
+
frequencyCluster: isProtonic ? 16 : 0,
|
|
279
|
+
clean: 0.5,
|
|
277
280
|
keepPeaks: true,
|
|
278
|
-
joinOverlapRanges:
|
|
281
|
+
joinOverlapRanges: isProtonic,
|
|
279
282
|
};
|
|
280
283
|
detectRanges(datum as Spectrum1D, {
|
|
281
284
|
peakPicking,
|
|
@@ -327,9 +330,6 @@ function handleChangeRangeSignalKind(
|
|
|
327
330
|
const _range = (draft.data[index] as Spectrum1D).ranges.values[rangeIndex];
|
|
328
331
|
if (_range?.signals) {
|
|
329
332
|
_range.signals[range.tableMetaInfo.signalIndex].kind = kind;
|
|
330
|
-
_range.kind = SIGNAL_INCLUDED_KINDS.includes(kind)
|
|
331
|
-
? DATUM_KIND.signal
|
|
332
|
-
: DATUM_KIND.mixed;
|
|
333
333
|
updateRangesRelativeValues(draft.data[index] as Spectrum1D);
|
|
334
334
|
handleUpdateCorrelations(draft);
|
|
335
335
|
}
|
|
@@ -438,7 +438,7 @@ function handleUnlinkRange(draft: Draft<State>, action: UnlinkRangeAction) {
|
|
|
438
438
|
|
|
439
439
|
//action
|
|
440
440
|
function handleAssignRange(draft: Draft<State>, action: AssignRangeAction) {
|
|
441
|
-
const { keys, diaIDs, nbAtoms, spectrumId } = action.payload;
|
|
441
|
+
const { keys, diaIDs, nbAtoms, spectrumId, assignment } = action.payload;
|
|
442
442
|
|
|
443
443
|
const spectrum = getSpectrum(draft, spectrumId);
|
|
444
444
|
|
|
@@ -452,6 +452,10 @@ function handleAssignRange(draft: Draft<State>, action: AssignRangeAction) {
|
|
|
452
452
|
|
|
453
453
|
range.diaIDs = diaIDs;
|
|
454
454
|
range.nbAtoms = nbAtoms + (range.nbAtoms || 0);
|
|
455
|
+
|
|
456
|
+
if (assignment && !range.assignment) {
|
|
457
|
+
range.assignment = assignment;
|
|
458
|
+
}
|
|
455
459
|
} else {
|
|
456
460
|
const [{ index: rangeIndex }, { index: signalIndex }] = keys;
|
|
457
461
|
const range = spectrum.ranges.values[rangeIndex];
|
|
@@ -465,10 +469,41 @@ function handleAssignRange(draft: Draft<State>, action: AssignRangeAction) {
|
|
|
465
469
|
signal.diaIDs = diaIDs;
|
|
466
470
|
signal.nbAtoms = nbAtoms + (signal.nbAtoms || 0);
|
|
467
471
|
}
|
|
468
|
-
|
|
469
|
-
// _range.nbAtoms = getNbAtoms(_range);
|
|
470
472
|
}
|
|
473
|
+
//action
|
|
474
|
+
function handleChangeRangesAssignmentLabelsByDiaIds(
|
|
475
|
+
draft: Draft<State>,
|
|
476
|
+
action: ChangeRangesAssignmentsLabelsByDiaIdsAction,
|
|
477
|
+
) {
|
|
478
|
+
const { diaIDs, assignment, previousAssignment } = action.payload;
|
|
479
|
+
|
|
480
|
+
const uniqueDiaIds = new Set(diaIDs);
|
|
471
481
|
|
|
482
|
+
const spectrum = getSpectrum(draft);
|
|
483
|
+
|
|
484
|
+
if (!spectrum || !isSpectrum1D(spectrum)) return;
|
|
485
|
+
|
|
486
|
+
const {
|
|
487
|
+
ranges: { values },
|
|
488
|
+
} = spectrum;
|
|
489
|
+
|
|
490
|
+
for (const range of values) {
|
|
491
|
+
const { diaIDs: rangeDiaIDs = [], signals = [] } = range;
|
|
492
|
+
|
|
493
|
+
const matchesRange = rangeDiaIDs.some((id) => uniqueDiaIds.has(id));
|
|
494
|
+
const matchesSignals = signals.some((s) =>
|
|
495
|
+
s.diaIDs?.some((id) => uniqueDiaIds.has(id)),
|
|
496
|
+
);
|
|
497
|
+
|
|
498
|
+
if (
|
|
499
|
+
((!range.assignment || previousAssignment === range.assignment) &&
|
|
500
|
+
matchesRange) ||
|
|
501
|
+
matchesSignals
|
|
502
|
+
) {
|
|
503
|
+
range.assignment = assignment;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
472
507
|
//action
|
|
473
508
|
function handleResizeRange(draft: Draft<State>, action: ResizeRangeAction) {
|
|
474
509
|
const { range, spectrumKey } = action.payload;
|
|
@@ -723,6 +758,7 @@ export {
|
|
|
723
758
|
handleChangeRangeSignalKind,
|
|
724
759
|
handleChangeRangeSignalValue,
|
|
725
760
|
handleChangeRangeSum,
|
|
761
|
+
handleChangeRangesAssignmentLabelsByDiaIds,
|
|
726
762
|
handleChangeRangesSumFlag,
|
|
727
763
|
handleChangeRangesViewFloatingBoxBounding,
|
|
728
764
|
handleCutRange,
|