nmrium 0.29.0 → 0.31.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/README.md +12 -2
- package/lib/component/1d/ApodizationLine.d.ts +3 -0
- package/lib/component/1d/ApodizationLine.js +49 -0
- package/lib/component/1d/Chart1D.js +4 -2
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +1 -1
- package/lib/component/1d/ExclusionZoneAnnotation.js +14 -7
- package/lib/component/1d/FooterBanner.js +3 -1
- package/lib/component/1d/IntegralResizable.js +5 -4
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +7 -5
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +10 -13
- package/lib/component/1d/database/DatabaseElements.js +2 -2
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +3 -3
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +16 -14
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +6 -5
- package/lib/component/1d/{PeakAnnotation.d.ts → peaks/PeakAnnotation.d.ts} +1 -2
- package/lib/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
- package/lib/component/1d/{PeakAnnotations.d.ts → peaks/PeakAnnotations.d.ts} +0 -0
- package/lib/component/1d/peaks/PeakAnnotations.js +28 -0
- package/lib/component/1d/peaks/PeaksShapes.d.ts +3 -0
- package/lib/component/1d/peaks/PeaksShapes.js +37 -0
- package/lib/component/1d/peaks/usePeakShapesPath.d.ts +13 -0
- package/lib/component/1d/peaks/usePeakShapesPath.js +49 -0
- package/lib/component/1d/ranges/Range.js +4 -4
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +3 -1
- package/lib/component/2d/FooterBanner.js +5 -3
- package/lib/component/2d/Viewer2D.js +6 -6
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Signal.d.ts +3 -2
- package/lib/component/2d/zones/Signal.js +3 -3
- package/lib/component/2d/zones/Zone.d.ts +1 -1
- package/lib/component/2d/zones/Zone.js +4 -4
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/EventsTrackers/KeysListenerTracker.js +91 -52
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/assignment/AssignmentsContext.d.ts +1 -1
- package/lib/component/context/GlobalContext.d.ts +1 -1
- package/lib/component/context/GlobalContext.js +3 -3
- package/lib/component/elements/ActiveButton.d.ts +17 -0
- package/lib/component/elements/ActiveButton.js +28 -0
- package/lib/component/elements/Button.d.ts +6 -6
- package/lib/component/elements/Button.js +5 -5
- package/lib/component/elements/ButtonToolTip.js +1 -1
- package/lib/component/elements/CheckBox.d.ts +2 -6
- package/lib/component/elements/CheckBox.js +4 -6
- package/lib/component/elements/Input.d.ts +5 -4
- package/lib/component/elements/Input.js +1 -1
- package/lib/component/elements/Label.d.ts +8 -6
- package/lib/component/elements/Label.js +3 -3
- package/lib/component/elements/MoleculeSelection.d.ts +2 -2
- package/lib/component/elements/MoleculeSelection.js +1 -1
- package/lib/component/elements/NextPrev.js +1 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
- package/lib/component/elements/Select.d.ts +7 -11
- package/lib/component/elements/Select.js +6 -8
- package/lib/component/elements/Tab/Tab.js +1 -1
- package/lib/component/elements/Table/Table.d.ts +1 -2
- package/lib/component/elements/Table/Table.js +2 -2
- package/lib/component/elements/ToggleButton.d.ts +1 -2
- package/lib/component/elements/ToggleButton.js +3 -2
- package/lib/component/elements/accordion/AccordionItem.js +2 -2
- package/lib/component/elements/formik/FormikNumberInput.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.d.ts +3 -2
- package/lib/component/elements/formik/FormikOnChange.js +11 -5
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/elements/resizer/DivResizer.js +3 -3
- package/lib/component/elements/resizer/Resizer.d.ts +1 -0
- package/lib/component/elements/resizer/SVGResizer.js +3 -3
- package/lib/component/header/ApodizationOptionsPanel.d.ts +2 -0
- package/lib/component/header/ApodizationOptionsPanel.js +81 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +2 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.js +40 -36
- package/lib/component/header/BaseLineCorrectionPanel.d.ts +1 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +84 -52
- package/lib/component/header/Header.js +5 -2
- package/lib/component/header/HeaderContainer.d.ts +7 -0
- package/lib/component/header/HeaderContainer.js +10 -0
- package/lib/component/header/ManualPhaseCorrectionPanel.js +27 -29
- package/lib/component/header/RangesPickingOptionPanel.js +19 -21
- package/lib/component/header/ZeroFillingOptionsPanel.js +52 -47
- package/lib/component/header/Zones2DOptionPanel.js +11 -13
- package/lib/component/highlight/index.d.ts +27 -10
- package/lib/component/highlight/index.js +19 -17
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +10 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +31 -1
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useFilter.d.ts +1 -0
- package/lib/component/hooks/useFilter.js +7 -0
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/hooks/useToolsFunctions.js +1 -1
- package/lib/component/loader/DropZone.js +8 -148
- package/lib/component/modal/AlignSpectraModal.js +1 -2
- package/lib/component/modal/EditPeakShapeModal.d.ts +9 -0
- package/lib/component/modal/EditPeakShapeModal.js +85 -0
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -3
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -3
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +9 -11
- package/lib/component/modal/changeSum/SelectMolecule.js +2 -2
- package/lib/component/modal/editRange/EditRangeModal.js +3 -3
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +4 -9
- package/lib/component/modal/setting/DatabasesTabContent.js +2 -2
- package/lib/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib/component/modal/setting/FormattingTabContent.js +2 -2
- package/lib/component/modal/setting/GeneralSettings.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +17 -13
- package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -2
- package/lib/component/modal/setting/WorkspaceItem.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +5 -4
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +13 -10
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +4 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +5 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +12 -4
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/Panels.js +3 -3
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +47 -22
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +44 -13
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/RangesPanel/RangesTableRow.js +4 -4
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +3 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +3 -3
- package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +3 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +5 -13
- package/lib/component/panels/databasePanel/DatabaseTable.js +3 -3
- package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib/component/panels/header/DefaultPanelHeader.js +3 -12
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +2 -1
- package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +15 -3
- package/lib/component/reducer/IgnoreActions.js +5 -0
- package/lib/component/reducer/Reducer.d.ts +141 -51
- package/lib/component/reducer/Reducer.js +69 -45
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +11 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +13 -7
- package/lib/component/reducer/actions/FiltersActions.js +326 -204
- package/lib/component/reducer/actions/IntegralsActions.js +15 -10
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +48 -19
- package/lib/component/reducer/actions/PeaksActions.d.ts +4 -1
- package/lib/component/reducer/actions/PeaksActions.js +52 -13
- package/lib/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
- package/lib/component/reducer/actions/RangesActions.js +87 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -11
- package/lib/component/reducer/actions/ToolsActions.js +47 -95
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +68 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +7 -0
- package/lib/component/reducer/helper/getStrongestPeak.js +15 -0
- package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -15
- package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib/component/reducer/types/Types.d.ts +12 -0
- package/lib/component/reducer/types/Types.js +12 -0
- package/lib/component/tool/BrushX.js +1 -1
- package/lib/component/tool/BrushXY.js +4 -3
- package/lib/component/tool/CrossLinePointer.js +5 -4
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +8 -2
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +22 -7
- package/lib/component/tool/FloatMoleculeStructures/index.d.ts +3 -2
- package/lib/component/tool/FloatMoleculeStructures/index.js +19 -6
- package/lib/component/toolbar/BasicToolBar.js +7 -14
- package/lib/component/toolbar/FunctionToolBar.js +13 -23
- package/lib/component/toolbar/ToolTypes.d.ts +7 -1
- package/lib/component/toolbar/ToolTypes.js +119 -9
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +4 -1
- package/lib/component/workspaces/basic.js +12 -11
- package/lib/component/workspaces/embedded.js +14 -13
- package/lib/component/workspaces/exercise.js +10 -6
- package/lib/component/workspaces/prediction.js +14 -13
- package/lib/component/workspaces/process1D.js +20 -19
- package/lib/component/workspaces/workspaceDefaultProperties.js +14 -15
- package/lib/constants.js +1 -1
- package/lib/data/Filters.d.ts +2 -2
- package/lib/data/Filters.js +2 -2
- package/lib/data/FiltersManager.js +3 -3
- package/lib/data/PredictionManager.d.ts +0 -1
- package/lib/data/PredictionManager.js +15 -15
- package/lib/data/SpectraManager.d.ts +2 -5
- package/lib/data/SpectraManager.js +4 -95
- package/lib/data/constants/SignalsKinds.d.ts +0 -1
- package/lib/data/constants/SignalsKinds.js +0 -8
- package/lib/data/data1d/Data1DManager.js +5 -5
- package/lib/data/data1d/Spectrum1D/SumManager.d.ts +5 -5
- package/lib/data/data1d/Spectrum1D/SumManager.js +18 -12
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +2 -2
- package/lib/data/data1d/Spectrum1D/index.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/index.js +2 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -16
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts +8 -0
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +24 -0
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -3
- package/lib/data/data1d/database.js +4 -6
- package/lib/data/data1d/filter1d/apodization.d.ts +25 -0
- package/lib/data/data1d/filter1d/apodization.js +63 -0
- package/lib/data/data1d/filter1d/baselineCorrection.d.ts +24 -7
- package/lib/data/data1d/filter1d/baselineCorrection.js +10 -17
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data1d/filter1d/zeroFillingAndApodization.d.ts +9 -0
- package/lib/data/data1d/filter1d/zeroFillingAndApodization.js +24 -0
- package/lib/data/data2d/Processing2D.d.ts +3 -3
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/detectZones.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +20 -6
- package/lib/data/molecules/Molecule.js +5 -8
- package/lib/data/molecules/MoleculeManager.d.ts +4 -4
- package/lib/data/molecules/MoleculeManager.js +5 -5
- package/lib/data/types/data1d/SumOptions.d.ts +1 -1
- package/lib/data/utilities/generateNumbersPowerOfX.d.ts +0 -1
- package/lib/data/utilities/generateNumbersPowerOfX.js +0 -1
- package/lib/data/utilities/isInRange.d.ts +7 -0
- package/lib/data/utilities/isInRange.js +4 -0
- package/lib/types/NMRiumDataReturn.d.ts +2 -2
- package/lib/types/NMRiumGeneralPreferences.d.ts +0 -2
- package/lib/types/NMRiumToolBarPreferences.d.ts +14 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +77 -0
- package/lib-cjs/component/1d/Chart1D.js +4 -2
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +15 -8
- package/lib-cjs/component/1d/FooterBanner.js +3 -1
- package/lib-cjs/component/1d/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +6 -4
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +10 -13
- package/lib-cjs/component/1d/database/DatabaseElements.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -2
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +15 -13
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -3
- package/lib-cjs/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +33 -0
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +42 -0
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +53 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +3 -1
- package/lib-cjs/component/2d/FooterBanner.js +5 -3
- package/lib-cjs/component/2d/Viewer2D.js +6 -6
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Signal.js +3 -3
- package/lib-cjs/component/2d/zones/Zone.js +3 -3
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +89 -50
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/context/GlobalContext.js +4 -4
- package/lib-cjs/component/elements/ActiveButton.js +33 -0
- package/lib-cjs/component/elements/Button.js +5 -5
- package/lib-cjs/component/elements/ButtonToolTip.js +1 -1
- package/lib-cjs/component/elements/CheckBox.js +3 -5
- package/lib-cjs/component/elements/Input.js +1 -1
- package/lib-cjs/component/elements/Label.js +3 -3
- package/lib-cjs/component/elements/MoleculeSelection.js +1 -1
- package/lib-cjs/component/elements/NextPrev.js +1 -1
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib-cjs/component/elements/Select.js +6 -8
- package/lib-cjs/component/elements/Tab/Tab.js +1 -1
- package/lib-cjs/component/elements/Table/Table.js +2 -2
- package/lib-cjs/component/elements/ToggleButton.js +3 -2
- package/lib-cjs/component/elements/accordion/AccordionItem.js +2 -2
- package/lib-cjs/component/elements/formik/FormikOnChange.js +10 -4
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/elements/resizer/DivResizer.js +3 -3
- package/lib-cjs/component/elements/resizer/SVGResizer.js +2 -2
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +110 -0
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +39 -35
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +82 -49
- package/lib-cjs/component/header/Header.js +5 -2
- package/lib-cjs/component/header/HeaderContainer.js +14 -0
- package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +26 -28
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +19 -21
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +73 -45
- package/lib-cjs/component/header/Zones2DOptionPanel.js +11 -13
- package/lib-cjs/component/highlight/index.js +20 -18
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +31 -1
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useFilter.js +14 -0
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/hooks/useToolsFunctions.js +1 -1
- package/lib-cjs/component/loader/DropZone.js +7 -150
- package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
- package/lib-cjs/component/modal/EditPeakShapeModal.js +113 -0
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -3
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +9 -11
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +2 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -3
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +3 -8
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +17 -13
- package/lib-cjs/component/modal/setting/WorkspaceItem.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -9
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +11 -3
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/Panels.js +3 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +45 -20
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +42 -11
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +3 -6
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -13
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +2 -2
- package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -1
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -12
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +15 -3
- package/lib-cjs/component/reducer/IgnoreActions.js +5 -0
- package/lib-cjs/component/reducer/Reducer.js +72 -50
- package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +332 -205
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +15 -10
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +49 -19
- package/lib-cjs/component/reducer/actions/PeaksActions.js +54 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +87 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -11
- package/lib-cjs/component/reducer/actions/ToolsActions.js +46 -94
- package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +19 -0
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -5
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib-cjs/component/reducer/types/Types.js +15 -3
- package/lib-cjs/component/tool/BrushX.js +1 -1
- package/lib-cjs/component/tool/BrushXY.js +4 -3
- package/lib-cjs/component/tool/CrossLinePointer.js +5 -4
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +21 -6
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +19 -6
- package/lib-cjs/component/toolbar/BasicToolBar.js +7 -14
- package/lib-cjs/component/toolbar/FunctionToolBar.js +12 -22
- package/lib-cjs/component/toolbar/ToolTypes.js +119 -9
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/basic.js +12 -11
- package/lib-cjs/component/workspaces/embedded.js +14 -13
- package/lib-cjs/component/workspaces/exercise.js +10 -6
- package/lib-cjs/component/workspaces/prediction.js +14 -13
- package/lib-cjs/component/workspaces/process1D.js +20 -19
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +14 -15
- package/lib-cjs/constants.js +1 -1
- package/lib-cjs/data/Filters.js +3 -3
- package/lib-cjs/data/FiltersManager.js +3 -6
- package/lib-cjs/data/PredictionManager.js +15 -15
- package/lib-cjs/data/SpectraManager.js +5 -100
- package/lib-cjs/data/constants/SignalsKinds.js +0 -8
- package/lib-cjs/data/data1d/Data1DManager.js +5 -5
- package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +18 -12
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +2 -5
- package/lib-cjs/data/data1d/Spectrum1D/index.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -19
- package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +28 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +2 -5
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -6
- package/lib-cjs/data/data1d/database.js +4 -6
- package/lib-cjs/data/data1d/filter1d/apodization.js +70 -0
- package/lib-cjs/data/data1d/filter1d/baselineCorrection.js +11 -18
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data1d/filter1d/zeroFillingAndApodization.js +30 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -6
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +3 -6
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -6
- package/lib-cjs/data/molecules/Molecule.js +5 -8
- package/lib-cjs/data/molecules/MoleculeManager.js +5 -5
- package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +0 -1
- package/lib-cjs/data/utilities/isInRange.js +7 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +36 -35
- package/lib/component/1d/PeakAnnotations.js +0 -41
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/data1d/filter1d/lineBroadening.d.ts +0 -14
- package/lib/data/data1d/filter1d/lineBroadening.js +0 -57
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -17
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/utilities/generateID.d.ts +0 -1
- package/lib/data/utilities/generateID.js +0 -9
- package/lib-cjs/component/1d/PeakAnnotations.js +0 -46
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -48
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/data1d/filter1d/lineBroadening.js +0 -63
- package/lib-cjs/data/migration/MigrationManager.js +0 -24
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/utilities/generateID.js +0 -12
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 } from '@lukeed/uuid';
|
|
1
2
|
import { original } from 'immer';
|
|
2
3
|
import cloneDeep from 'lodash/cloneDeep';
|
|
3
4
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
@@ -7,16 +8,25 @@ import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/Signal
|
|
|
7
8
|
import { addRange, changeRangeSignal, detectRanges, updateRangesRelativeValues, changeRange, changeRangeRelativeValue, updateXShift, } from '../../../data/data1d/Spectrum1D';
|
|
8
9
|
import { setSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
9
10
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
10
|
-
import
|
|
11
|
+
import { rangeStateInit } from '../Reducer';
|
|
11
12
|
import getRange from '../helper/getRange';
|
|
12
13
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
13
14
|
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
14
15
|
import { resetSelectedTool } from './ToolsActions';
|
|
15
16
|
function handleAutoRangesDetection(draft, options) {
|
|
16
|
-
const {
|
|
17
|
+
const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
18
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
17
19
|
if (activeSpectrum?.id) {
|
|
18
|
-
const { index } = activeSpectrum;
|
|
20
|
+
const { index, id } = activeSpectrum;
|
|
19
21
|
const datum = data[index];
|
|
22
|
+
// add range intial state
|
|
23
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
24
|
+
if (!range) {
|
|
25
|
+
draft.view.ranges.push({
|
|
26
|
+
spectrumID: id,
|
|
27
|
+
...rangeStateInit,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
20
30
|
const [from, to] = xDomain;
|
|
21
31
|
const windowFromIndex = xFindClosestIndex(datum.data.x, from);
|
|
22
32
|
const windowToIndex = xFindClosestIndex(datum.data.x, to);
|
|
@@ -50,7 +60,7 @@ function handleAutoSpectraRangesDetection(draft) {
|
|
|
50
60
|
clean: true,
|
|
51
61
|
keepPeaks: true,
|
|
52
62
|
};
|
|
53
|
-
const { data, activeTab: nucleus, molecules } = draft;
|
|
63
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
54
64
|
for (const datum of data) {
|
|
55
65
|
if (datum.info.dimension === 1) {
|
|
56
66
|
detectRanges(datum, { peakPicking, molecules, nucleus });
|
|
@@ -62,8 +72,9 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
|
|
|
62
72
|
return draft.data[spectrumIndex].ranges.values.findIndex((range) => range.id === rangeID);
|
|
63
73
|
}
|
|
64
74
|
function handleDeleteRange(draft, action) {
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
76
|
+
if (activeSpectrum?.id) {
|
|
77
|
+
const { index } = activeSpectrum;
|
|
67
78
|
const { data, resetSelectTool = false } = action.payload;
|
|
68
79
|
const { id = null, assignmentData } = data;
|
|
69
80
|
const datum = draft.data[index];
|
|
@@ -85,8 +96,9 @@ function handleDeleteRange(draft, action) {
|
|
|
85
96
|
}
|
|
86
97
|
function handleChangeRangeSignalKind(draft, action) {
|
|
87
98
|
const state = original(draft);
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
100
|
+
if (activeSpectrum?.id) {
|
|
101
|
+
const { index } = activeSpectrum;
|
|
90
102
|
const { rowData, value } = action.payload.data;
|
|
91
103
|
const rangeIndex = getRangeIndex(state, index, rowData.id);
|
|
92
104
|
const _range = draft.data[index].ranges.values[rangeIndex];
|
|
@@ -102,8 +114,9 @@ function handleChangeRangeSignalKind(draft, action) {
|
|
|
102
114
|
}
|
|
103
115
|
function handleSaveEditedRange(draft, action) {
|
|
104
116
|
const state = original(draft);
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
|
|
118
|
+
if (activeSpectrum?.id) {
|
|
119
|
+
const { index } = activeSpectrum;
|
|
107
120
|
const { editedRowData, assignmentData } = action.payload;
|
|
108
121
|
// remove assignments in global state
|
|
109
122
|
const _editedRowData = unlink(editedRowData);
|
|
@@ -114,7 +127,7 @@ function handleSaveEditedRange(draft, action) {
|
|
|
114
127
|
unlinkInAssignmentData(assignmentData, [_editedRowData]);
|
|
115
128
|
const rangeIndex = getRangeIndex(state, index, _editedRowData.id);
|
|
116
129
|
if (_editedRowData.id === 'new') {
|
|
117
|
-
_editedRowData.id =
|
|
130
|
+
_editedRowData.id = v4();
|
|
118
131
|
}
|
|
119
132
|
draft.data[index].ranges.values.splice(rangeIndex, 1, _editedRowData);
|
|
120
133
|
updateRangesRelativeValues(draft.data[index]);
|
|
@@ -144,8 +157,9 @@ function handleDeleteSignal(draft, action) {
|
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
function handleUnlinkRange(draft, action) {
|
|
147
|
-
|
|
148
|
-
|
|
160
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
161
|
+
if (activeSpectrum?.id) {
|
|
162
|
+
const { index } = activeSpectrum;
|
|
149
163
|
const { assignmentData, rangeData = null, signalIndex = -1, } = action.payload;
|
|
150
164
|
// remove assignments in global state
|
|
151
165
|
if (rangeData) {
|
|
@@ -178,8 +192,9 @@ function handleUnlinkRange(draft, action) {
|
|
|
178
192
|
}
|
|
179
193
|
}
|
|
180
194
|
function handleSetDiaIDRange(draft, action) {
|
|
181
|
-
|
|
182
|
-
|
|
195
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
196
|
+
if (activeSpectrum?.id) {
|
|
197
|
+
const { index } = activeSpectrum;
|
|
183
198
|
const { rangeData, diaIDs, signalIndex, nbAtoms } = action.payload;
|
|
184
199
|
const getNbAtoms = (input, current = 0) => input + current;
|
|
185
200
|
const rangeIndex = getRangeIndex(draft, index, rangeData.id);
|
|
@@ -196,13 +211,15 @@ function handleSetDiaIDRange(draft, action) {
|
|
|
196
211
|
}
|
|
197
212
|
}
|
|
198
213
|
function handleResizeRange(draft, action) {
|
|
199
|
-
|
|
200
|
-
|
|
214
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
215
|
+
if (activeSpectrum?.id) {
|
|
216
|
+
const { index } = activeSpectrum;
|
|
201
217
|
changeRange(draft.data[index], action.data);
|
|
202
218
|
}
|
|
203
219
|
}
|
|
204
220
|
function handleChangeRangeSum(draft, options) {
|
|
205
|
-
const { data,
|
|
221
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
222
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
206
223
|
if (activeSpectrum?.id) {
|
|
207
224
|
const { index } = activeSpectrum;
|
|
208
225
|
const datum = data[index];
|
|
@@ -213,10 +230,19 @@ function handleChangeRangeSum(draft, options) {
|
|
|
213
230
|
function addNewRange(draft, props) {
|
|
214
231
|
const { startX, endX, id } = props;
|
|
215
232
|
const range = getRange(draft, { startX, endX });
|
|
216
|
-
const {
|
|
233
|
+
const { view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
234
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
217
235
|
if (activeSpectrum?.id) {
|
|
218
236
|
const { index } = activeSpectrum;
|
|
219
237
|
const [from, to] = range;
|
|
238
|
+
// add range intial state
|
|
239
|
+
const rangeState = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum.id);
|
|
240
|
+
if (!rangeState) {
|
|
241
|
+
draft.view.ranges.push({
|
|
242
|
+
spectrumID: activeSpectrum.id,
|
|
243
|
+
...rangeStateInit,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
220
246
|
addRange(draft.data[index], {
|
|
221
247
|
from,
|
|
222
248
|
to,
|
|
@@ -276,8 +302,9 @@ function handleChangeRangesSumFlag(draft, action) {
|
|
|
276
302
|
}
|
|
277
303
|
function handleUpdateRange(draft, action) {
|
|
278
304
|
const { range, resetSelectTool = false } = action.payload;
|
|
279
|
-
|
|
280
|
-
|
|
305
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
306
|
+
if (activeSpectrum?.id && range.id) {
|
|
307
|
+
const datum = draft.data[activeSpectrum?.index];
|
|
281
308
|
const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
|
|
282
309
|
datum.ranges.values[index] = range;
|
|
283
310
|
}
|
|
@@ -285,15 +312,46 @@ function handleUpdateRange(draft, action) {
|
|
|
285
312
|
resetSelectedTool(draft);
|
|
286
313
|
}
|
|
287
314
|
}
|
|
288
|
-
function handleShowMultiplicityTrees(draft) {
|
|
289
|
-
|
|
290
|
-
|
|
315
|
+
function handleShowMultiplicityTrees(draft, action) {
|
|
316
|
+
const { id } = action.payload;
|
|
317
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
318
|
+
if (range) {
|
|
319
|
+
range.showMultiplicityTrees = !range.showMultiplicityTrees;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
draft.view.ranges.push({
|
|
323
|
+
spectrumID: id,
|
|
324
|
+
...rangeStateInit,
|
|
325
|
+
showMultiplicityTrees: !rangeStateInit.showMultiplicityTrees,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
291
328
|
}
|
|
292
|
-
function handleShowRangesIntegrals(draft) {
|
|
293
|
-
|
|
294
|
-
|
|
329
|
+
function handleShowRangesIntegrals(draft, action) {
|
|
330
|
+
const { id } = action.payload;
|
|
331
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
332
|
+
if (range) {
|
|
333
|
+
range.showRangesIntegrals = !range.showRangesIntegrals;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
draft.view.ranges.push({
|
|
337
|
+
spectrumID: id,
|
|
338
|
+
...rangeStateInit,
|
|
339
|
+
showRangesIntegrals: !rangeStateInit.showRangesIntegrals,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
295
342
|
}
|
|
296
|
-
function handleShowJGraph(draft) {
|
|
297
|
-
|
|
343
|
+
function handleShowJGraph(draft, action) {
|
|
344
|
+
const { id } = action.payload;
|
|
345
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
346
|
+
if (range) {
|
|
347
|
+
range.showJGraph = !range.showJGraph;
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
draft.view.ranges.push({
|
|
351
|
+
spectrumID: id,
|
|
352
|
+
...rangeStateInit,
|
|
353
|
+
showJGraph: !rangeStateInit.showJGraph,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
298
356
|
}
|
|
299
357
|
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
|
|
@@ -5,28 +5,28 @@ function analyzeSpectra(draft, action) {
|
|
|
5
5
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
6
6
|
from,
|
|
7
7
|
to,
|
|
8
|
-
nucleus: draft.activeTab,
|
|
8
|
+
nucleus: draft.view.spectra.activeTab,
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
function handleDeleteSpectraRanges(draft, action) {
|
|
12
12
|
const { colKey } = action;
|
|
13
|
-
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.activeTab);
|
|
13
|
+
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.view.spectra.activeTab);
|
|
14
14
|
}
|
|
15
15
|
function handleResizeSpectraRange(draft, action) {
|
|
16
16
|
const { columnKey, from, to } = action.payload;
|
|
17
17
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
18
18
|
from,
|
|
19
19
|
to,
|
|
20
|
-
nucleus: draft.activeTab,
|
|
20
|
+
nucleus: draft.view.spectra.activeTab,
|
|
21
21
|
columnKey,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function handleSetColumns(draft, action) {
|
|
25
25
|
const data = action.payload;
|
|
26
|
-
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.activeTab, data);
|
|
26
|
+
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.view.spectra.activeTab, data);
|
|
27
27
|
}
|
|
28
28
|
function handleFilterColumn(draft, action) {
|
|
29
29
|
const { columnKey, valueKey } = action.payload;
|
|
30
|
-
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.activeTab, columnKey, valueKey);
|
|
30
|
+
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.view.spectra.activeTab, columnKey, valueKey);
|
|
31
31
|
}
|
|
32
32
|
export { analyzeSpectra, handleDeleteSpectraRanges, handleResizeSpectraRange, handleSetColumns, handleFilterColumn, };
|
|
@@ -65,10 +65,10 @@ function handleChangePeaksMarkersVisibility(draft, data) {
|
|
|
65
65
|
}
|
|
66
66
|
function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
67
67
|
let refreshDomain = false;
|
|
68
|
-
const currentActiveSpectrum = draft.
|
|
68
|
+
const currentActiveSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
69
69
|
if (activeSpectrum) {
|
|
70
70
|
const newIndex = draft.data.findIndex((d) => d.id === activeSpectrum.id);
|
|
71
|
-
const oldIndex = draft.data.findIndex((d) => d.id ===
|
|
71
|
+
const oldIndex = draft.data.findIndex((d) => d.id === currentActiveSpectrum?.id);
|
|
72
72
|
if (newIndex !== -1) {
|
|
73
73
|
const newActiveSpectrum = draft.data[newIndex];
|
|
74
74
|
newActiveSpectrum.display.isVisible = true;
|
|
@@ -82,8 +82,8 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
activeSpectrum = { ...activeSpectrum, index: newIndex };
|
|
85
|
-
draft.
|
|
86
|
-
|
|
85
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] =
|
|
86
|
+
activeSpectrum;
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
89
|
if (currentActiveSpectrum) {
|
|
@@ -93,8 +93,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
93
93
|
else {
|
|
94
94
|
refreshDomain = false;
|
|
95
95
|
}
|
|
96
|
-
draft.
|
|
97
|
-
draft.tabActiveSpectrum[draft.activeTab] = null;
|
|
96
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] = null;
|
|
98
97
|
}
|
|
99
98
|
if (options[draft.toolOptions.selectedTool].isFilter) {
|
|
100
99
|
draft.toolOptions.selectedTool = options.zoom.id;
|
|
@@ -107,7 +106,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
107
106
|
* if the new active spectrum different than the previous active spectrum fid then refresh the domain andf the mode.
|
|
108
107
|
*/
|
|
109
108
|
if (draft.toolOptions.data.activeFilterID) {
|
|
110
|
-
resetSpectrumByFilter(draft
|
|
109
|
+
resetSpectrumByFilter(draft);
|
|
111
110
|
}
|
|
112
111
|
else if (refreshDomain) {
|
|
113
112
|
setDomain(draft);
|
|
@@ -137,13 +136,17 @@ function handleDeleteSpectra(draft, action) {
|
|
|
137
136
|
else {
|
|
138
137
|
draft.data = [];
|
|
139
138
|
}
|
|
140
|
-
setActiveTab(draft, {
|
|
139
|
+
setActiveTab(draft, {
|
|
140
|
+
tab: draft.view.spectra.activeTab,
|
|
141
|
+
refreshActiveTab: true,
|
|
142
|
+
});
|
|
141
143
|
}
|
|
142
144
|
function addMissingProjectionHandler(draft, action) {
|
|
143
145
|
const state = original(draft);
|
|
144
146
|
const { nucleus } = action;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
148
|
+
if (activeSpectrum?.id) {
|
|
149
|
+
const { index } = activeSpectrum;
|
|
147
150
|
for (let n of nucleus) {
|
|
148
151
|
const datum1D = getMissingProjection(state.data[index], n, draft.usedColors);
|
|
149
152
|
draft.data.push(datum1D);
|
|
@@ -159,7 +162,7 @@ function alignSpectraHandler(draft, action) {
|
|
|
159
162
|
if (draft.data && draft.data.length > 0) {
|
|
160
163
|
for (let datum of draft.data) {
|
|
161
164
|
if (datum.info?.dimension === 1 &&
|
|
162
|
-
datum.info.nucleus === draft.activeTab &&
|
|
165
|
+
datum.info.nucleus === draft.view.spectra.activeTab &&
|
|
163
166
|
!datum.info?.isFid) {
|
|
164
167
|
const shift = getReferenceShift(datum, { ...action.payload });
|
|
165
168
|
applyFilter(datum, [
|
|
@@ -1,80 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { original
|
|
1
|
+
import { v4 } from '@lukeed/uuid';
|
|
2
|
+
import { original } from 'immer';
|
|
3
3
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
4
|
-
import generateID from '../../../data/utilities/generateID';
|
|
5
4
|
import { getYScale, getXScale } from '../../1d/utilities/scale';
|
|
6
5
|
import { LAYOUT } from '../../2d/utilities/DimensionLayout';
|
|
7
6
|
import { get2DYScale } from '../../2d/utilities/scale';
|
|
8
7
|
import { options } from '../../toolbar/ToolTypes';
|
|
9
8
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
9
|
+
import { rangeStateInit } from '../Reducer';
|
|
10
10
|
import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
|
|
11
11
|
import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
|
|
12
12
|
import zoomHistoryManager from '../helper/ZoomHistoryManager';
|
|
13
|
+
import { getActiveSpectrumOrFail } from '../helper/getActiveSpectrumOrFail';
|
|
13
14
|
import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
|
|
14
|
-
import { calculateBaseLineCorrection, resetSpectrumByFilter, } from './FiltersActions';
|
|
15
|
+
import { calculateBaseLineCorrection, resetSpectrumByFilter, setFilterChanges, } from './FiltersActions';
|
|
15
16
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
16
|
-
function getStrongestPeak(draft) {
|
|
17
|
-
const { activeSpectrum, data } = draft;
|
|
18
|
-
if (activeSpectrum) {
|
|
19
|
-
const activeData = data[activeSpectrum?.index].data;
|
|
20
|
-
const strongestPeakValue = max(activeData.re);
|
|
21
|
-
const index = activeData.re.findIndex((val) => val === strongestPeakValue);
|
|
22
|
-
return {
|
|
23
|
-
xValue: activeData.x[index],
|
|
24
|
-
yValue: strongestPeakValue,
|
|
25
|
-
index,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function checkFilterHasTempData(selectedToolId) {
|
|
30
|
-
return [options.phaseCorrection.id, options.baselineCorrection.id].includes(selectedToolId);
|
|
31
|
-
}
|
|
32
|
-
function setFilterChanges(draft, selectedFilterID) {
|
|
33
|
-
const activeSpectrumId = draft.activeSpectrum?.id;
|
|
34
|
-
// If the user selects the filter from the filters list or selects its tool and has a record in the filter list for preview and edit
|
|
35
|
-
if (checkFilterHasTempData(selectedFilterID)) {
|
|
36
|
-
//return back the spectra data to point of time before applying a specific filter
|
|
37
|
-
const dataSavePoint = resetSpectrumByFilter(draft, selectedFilterID, {
|
|
38
|
-
updateDomain: false,
|
|
39
|
-
rollback: true,
|
|
40
|
-
searchBy: 'name',
|
|
41
|
-
returnCurrentDatum: true,
|
|
42
|
-
});
|
|
43
|
-
// create a temporary clone of the data
|
|
44
|
-
draft.tempData = current(draft).data;
|
|
45
|
-
if (dataSavePoint) {
|
|
46
|
-
draft.tempData[dataSavePoint?.index] = dataSavePoint?.datum;
|
|
47
|
-
}
|
|
48
|
-
switch (selectedFilterID) {
|
|
49
|
-
case options.phaseCorrection.id: {
|
|
50
|
-
// look for the strongest peak to set it as a pivot
|
|
51
|
-
const { xValue, index } = getStrongestPeak(draft) || {
|
|
52
|
-
xValue: 0,
|
|
53
|
-
index: 0,
|
|
54
|
-
};
|
|
55
|
-
draft.toolOptions.data.pivot = { value: xValue, index };
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
case options.baselineCorrection.id: {
|
|
59
|
-
if (draft.activeSpectrum?.id) {
|
|
60
|
-
const baselineCorrectionFilter = current(draft).data[draft.activeSpectrum.index].filters.find((filter) => filter.name === options.baselineCorrection.id);
|
|
61
|
-
draft.toolOptions.data.baselineCorrection.zones =
|
|
62
|
-
baselineCorrectionFilter
|
|
63
|
-
? baselineCorrectionFilter.value.zones
|
|
64
|
-
: [];
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
default:
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else if (checkFilterHasTempData(draft.toolOptions.selectedTool)) {
|
|
73
|
-
draft.toolOptions.data.activeFilterID = null;
|
|
74
|
-
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === activeSpectrumId);
|
|
75
|
-
draft.data[spectrumIndex].data = draft.tempData[spectrumIndex].data;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
17
|
function resetTool(draft, setDefaultTool = true) {
|
|
79
18
|
// reset temp range
|
|
80
19
|
setSelectedOptionPanel(draft, null);
|
|
@@ -103,7 +42,18 @@ function setSelectedTool(draft, action) {
|
|
|
103
42
|
if (selectedTool) {
|
|
104
43
|
// start Range edit mode
|
|
105
44
|
if (selectedTool === options.editRange.id) {
|
|
106
|
-
|
|
45
|
+
const activeSpectrum = getActiveSpectrumOrFail(draft);
|
|
46
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum?.id);
|
|
47
|
+
if (range) {
|
|
48
|
+
range.showMultiplicityTrees = true;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
draft.view.ranges.push({
|
|
52
|
+
spectrumID: activeSpectrum.id,
|
|
53
|
+
...rangeStateInit,
|
|
54
|
+
showMultiplicityTrees: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
107
57
|
}
|
|
108
58
|
if (selectedTool !== draft.toolOptions.selectedTool) {
|
|
109
59
|
resetTool(draft, false);
|
|
@@ -126,9 +76,9 @@ function setSelectedOptionPanel(draft, selectedOptionPanel) {
|
|
|
126
76
|
draft.toolOptions.selectedOptionPanel = selectedOptionPanel;
|
|
127
77
|
}
|
|
128
78
|
function setSpectrumsVerticalAlign(draft) {
|
|
129
|
-
const align = ['stack', '
|
|
130
|
-
? '
|
|
131
|
-
: '
|
|
79
|
+
const align = ['stack', 'bottom'].includes(draft.verticalAlign.align)
|
|
80
|
+
? 'center'
|
|
81
|
+
: 'bottom';
|
|
132
82
|
changeSpectrumVerticalAlignment(draft, { align });
|
|
133
83
|
}
|
|
134
84
|
function handleChangeSpectrumDisplayMode(draft) {
|
|
@@ -148,7 +98,7 @@ function handleAddBaseLineZone(draft, { from, to }) {
|
|
|
148
98
|
}
|
|
149
99
|
const zones = draft.toolOptions.data.baselineCorrection.zones;
|
|
150
100
|
zones.push({
|
|
151
|
-
id:
|
|
101
|
+
id: v4(),
|
|
152
102
|
from: zone[0],
|
|
153
103
|
to: zone[1],
|
|
154
104
|
});
|
|
@@ -179,7 +129,7 @@ function handleBrushEnd(draft, action) {
|
|
|
179
129
|
const endY = yScale.invert(action.endY);
|
|
180
130
|
const domainX = startX > endX ? [endX, startX] : [startX, endX];
|
|
181
131
|
const domainY = startY > endY ? [endY, startY] : [startY, endY];
|
|
182
|
-
const brushHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
|
|
132
|
+
const brushHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
183
133
|
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
184
134
|
switch (action.trackID) {
|
|
185
135
|
case LAYOUT.CENTER_2D:
|
|
@@ -207,21 +157,25 @@ function handleBrushEnd(draft, action) {
|
|
|
207
157
|
}
|
|
208
158
|
}
|
|
209
159
|
function setVerticalIndicatorXPosition(draft, position) {
|
|
210
|
-
|
|
160
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
161
|
+
if (activeSpectrum?.id) {
|
|
211
162
|
const scaleX = getXScale(draft);
|
|
212
163
|
const value = scaleX.invert(position);
|
|
213
|
-
const datum = draft.data[
|
|
164
|
+
const datum = draft.data[activeSpectrum.index];
|
|
214
165
|
const index = xFindClosestIndex(datum.data.x, value);
|
|
215
166
|
draft.toolOptions.data.pivot = { value, index };
|
|
216
167
|
}
|
|
217
168
|
}
|
|
218
169
|
function getSpectrumID(draft, index) {
|
|
219
|
-
const spectrum = draft.
|
|
220
|
-
return spectrum?.id
|
|
170
|
+
const spectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab.split(',')[index]];
|
|
171
|
+
return spectrum?.id || null;
|
|
221
172
|
}
|
|
222
173
|
function handleZoom(draft, action) {
|
|
223
174
|
const { event, trackID, selectedTool } = action;
|
|
224
|
-
const {
|
|
175
|
+
const { view: { ranges: rangeState }, displayerMode, } = draft;
|
|
176
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
177
|
+
const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
|
|
178
|
+
rangeStateInit;
|
|
225
179
|
if (displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
226
180
|
const index = trackID === LAYOUT.TOP_1D ? 0 : trackID === LAYOUT.LEFT_1D ? 1 : null;
|
|
227
181
|
if (index !== null) {
|
|
@@ -253,7 +207,7 @@ function handleZoom(draft, action) {
|
|
|
253
207
|
function zoomOut(draft, action) {
|
|
254
208
|
if (draft?.data.length > 0) {
|
|
255
209
|
const { zoomType, trackID } = action;
|
|
256
|
-
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
|
|
210
|
+
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
257
211
|
if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
|
|
258
212
|
switch (zoomType) {
|
|
259
213
|
case ZoomType.HORIZONTAL: {
|
|
@@ -296,14 +250,14 @@ function zoomOut(draft, action) {
|
|
|
296
250
|
}
|
|
297
251
|
}
|
|
298
252
|
function hasAcceptedSpectrum(draft, index) {
|
|
299
|
-
const nucleuses = draft.activeTab.split(',');
|
|
300
|
-
const activeSpectrum = draft.
|
|
253
|
+
const nucleuses = draft.view.spectra.activeTab.split(',');
|
|
254
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[nucleuses[index]];
|
|
301
255
|
return (activeSpectrum?.id &&
|
|
302
256
|
!draft.data[activeSpectrum.index].info.isFid);
|
|
303
257
|
}
|
|
304
258
|
function setMargin(draft) {
|
|
305
259
|
if (draft.displayerMode === DISPLAYER_MODE.DM_2D &&
|
|
306
|
-
draft.toolOptions.selectedTool !== options.
|
|
260
|
+
draft.toolOptions.selectedTool !== options.slicing.id) {
|
|
307
261
|
const top = hasAcceptedSpectrum(draft, 0)
|
|
308
262
|
? MARGIN['2D'].top
|
|
309
263
|
: MARGIN['1D'].top;
|
|
@@ -312,7 +266,7 @@ function setMargin(draft) {
|
|
|
312
266
|
: MARGIN['1D'].left;
|
|
313
267
|
draft.margin = { ...MARGIN['2D'], top, left };
|
|
314
268
|
}
|
|
315
|
-
else if (draft.toolOptions.selectedTool === options.
|
|
269
|
+
else if (draft.toolOptions.selectedTool === options.slicing.id) {
|
|
316
270
|
draft.margin = MARGIN['2D'];
|
|
317
271
|
}
|
|
318
272
|
else if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
|
|
@@ -322,7 +276,7 @@ function setMargin(draft) {
|
|
|
322
276
|
function processing2DData(draft, data) {
|
|
323
277
|
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
324
278
|
let _data = {};
|
|
325
|
-
for (const datum of data[draft.activeTab]) {
|
|
279
|
+
for (const datum of data[draft.view.spectra.activeTab]) {
|
|
326
280
|
_data[datum.id] = datum.processingController.drawContours();
|
|
327
281
|
}
|
|
328
282
|
draft.contours = _data;
|
|
@@ -368,29 +322,26 @@ function setTabActiveSpectrum(draft, dataGroupByTab) {
|
|
|
368
322
|
}
|
|
369
323
|
}
|
|
370
324
|
}
|
|
371
|
-
draft.
|
|
325
|
+
draft.view.spectra.activeSpectra = tabActiveSpectrum;
|
|
372
326
|
return tabs2D;
|
|
373
327
|
}
|
|
374
328
|
function setTab(draft, dataGroupByTab, tab, refresh = false) {
|
|
375
329
|
const groupByTab = Object.keys(dataGroupByTab).sort((a, b) => a.split(',').length > b.split(',').length ? -1 : 1);
|
|
376
330
|
if (JSON.stringify(groupByTab) !==
|
|
377
|
-
JSON.stringify(Object.keys(draft.
|
|
331
|
+
JSON.stringify(Object.keys(draft.view.spectra.activeSpectra)) ||
|
|
378
332
|
refresh) {
|
|
379
333
|
const tabs2D = setTabActiveSpectrum(draft, dataGroupByTab);
|
|
380
334
|
if (tabs2D.length > 0 && tab == null) {
|
|
381
|
-
draft.
|
|
382
|
-
draft.activeTab = tabs2D[0];
|
|
335
|
+
draft.view.spectra.activeTab = tabs2D[0];
|
|
383
336
|
}
|
|
384
337
|
else {
|
|
385
|
-
draft.
|
|
386
|
-
draft.activeTab = tab;
|
|
338
|
+
draft.view.spectra.activeTab = tab;
|
|
387
339
|
}
|
|
388
340
|
}
|
|
389
341
|
else {
|
|
390
|
-
draft.activeTab = tab;
|
|
391
|
-
draft.activeSpectrum = draft.tabActiveSpectrum[tab];
|
|
342
|
+
draft.view.spectra.activeTab = tab;
|
|
392
343
|
}
|
|
393
|
-
setDisplayerMode(draft, dataGroupByTab[draft.activeTab]);
|
|
344
|
+
setDisplayerMode(draft, dataGroupByTab[draft.view.spectra.activeTab]);
|
|
394
345
|
setMargin(draft);
|
|
395
346
|
}
|
|
396
347
|
function setActiveTab(draft, options) {
|
|
@@ -404,7 +355,7 @@ function setActiveTab(draft, options) {
|
|
|
404
355
|
processing2DData(draft, dataGroupByNucleus);
|
|
405
356
|
setDomain(draft, domainOptions);
|
|
406
357
|
setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
|
|
407
|
-
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
|
|
358
|
+
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
408
359
|
const zoomValue = zoomHistory.getLast();
|
|
409
360
|
if (zoomValue) {
|
|
410
361
|
draft.xDomain = zoomValue.xDomain;
|
|
@@ -418,9 +369,10 @@ function handelSetActiveTab(draft, tab) {
|
|
|
418
369
|
}
|
|
419
370
|
}
|
|
420
371
|
function levelChangeHandler(draft, { deltaY, shiftKey }) {
|
|
372
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
421
373
|
try {
|
|
422
|
-
if (
|
|
423
|
-
const { index, id } =
|
|
374
|
+
if (activeSpectrum?.id) {
|
|
375
|
+
const { index, id } = activeSpectrum;
|
|
424
376
|
const processingController = draft.data[index]
|
|
425
377
|
.processingController;
|
|
426
378
|
if (shiftKey) {
|
|
@@ -12,4 +12,7 @@ declare function handleSetSignalPathLength(draft: Draft<State>, action: any): vo
|
|
|
12
12
|
declare function handleUnlinkZone(draft: Draft<State>, action: any): void;
|
|
13
13
|
declare function handleSetDiaIDZone(draft: Draft<State>, action: any): void;
|
|
14
14
|
declare function handleSaveEditedZone(draft: Draft<State>, action: any): void;
|
|
15
|
-
|
|
15
|
+
declare function handleShowZones(draft: Draft<State>, action: any): void;
|
|
16
|
+
declare function handleShowSignals(draft: Draft<State>, action: any): void;
|
|
17
|
+
declare function handleShowPeaks(draft: Draft<State>, action: any): void;
|
|
18
|
+
export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, handleShowZones, handleShowSignals, handleShowPeaks, };
|