nmrium 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/FooterBanner.js +1 -1
- package/lib/component/1d/Viewer1D.js +26 -21
- package/lib/component/1d/integral/Integral.d.ts +2 -6
- package/lib/component/1d/integral/IntegralResizable.d.ts +2 -6
- package/lib/component/1d/integral/IntegralResizable.js +2 -3
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
- package/lib/component/1d/peaks/PeakAnnotation.js +1 -2
- package/lib/component/1d/ranges/Range.js +9 -8
- package/lib/component/1d/ranges/Ranges.js +5 -7
- package/lib/component/1d/tool/BaseLineZones.js +1 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
- package/lib/component/2d/1d-tracer/Left1DChart.js +1 -1
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
- package/lib/component/2d/Chart2D.js +1 -1
- package/lib/component/2d/Viewer2D.js +10 -9
- package/lib/component/2d/fid/FidCanvas.js +4 -6
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/2d/utilities/DimensionLayout.d.ts +9 -24
- package/lib/component/2d/utilities/scale.d.ts +2 -1
- package/lib/component/2d/utilities/scale.js +1 -1
- package/lib/component/2d/zones/Zones.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +28 -21
- package/lib/component/NMRium.js +15 -7
- package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
- package/lib/component/context/DispatchContext.d.ts +23 -3
- package/lib/component/context/DispatchContext.js +1 -1
- package/lib/component/context/LoggerContext.js +1 -1
- package/lib/component/elements/Button.js +7 -9
- package/lib/component/elements/IsotopesViewer.js +1 -1
- package/lib/component/elements/ReactTable/ReactTable.js +1 -2
- package/lib/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib/component/elements/formik/FormikColorInput.js +1 -1
- package/lib/component/elements/formik/FormikColorPicker.js +1 -1
- package/lib/component/elements/formik/FormikColumnFormatField.js +1 -1
- package/lib/component/elements/formik/FormikInput.js +1 -1
- package/lib/component/elements/formik/FormikSelect.js +2 -2
- package/lib/component/elements/formik/FormikSlider.js +1 -1
- package/lib/component/elements/formik/FormikTextarea.js +2 -2
- package/lib/component/header/ApodizationOptionsPanel.js +4 -5
- package/lib/component/header/AutoPeakPickingOptionPanel.js +1 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +4 -5
- package/lib/component/header/Header.js +4 -6
- package/lib/component/header/PhaseCorrectionPanel.js +7 -8
- package/lib/component/header/RangesPickingOptionPanel.js +1 -2
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -11
- package/lib/component/header/Zones2DOptionPanel.js +5 -6
- package/lib/component/hooks/useExport.js +1 -0
- package/lib/component/hooks/useToolsFunctions.js +8 -10
- package/lib/component/loader/DropZone.js +4 -5
- package/lib/component/loader/NoData.js +1 -1
- package/lib/component/modal/AlignSpectraModal.js +1 -2
- package/lib/component/modal/EditPeakShapeModal.js +1 -2
- package/lib/component/modal/ImportPublicationStringModal.js +1 -2
- package/lib/component/modal/LoadJCAMPModal.js +2 -3
- package/lib/component/modal/MoleculeStructureEditorModal.js +24 -19
- package/lib/component/modal/PredictSpectraModal.js +24 -21
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +3 -4
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -3
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
- package/lib/component/panels/InformationPanel.js +6 -6
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -10
- package/lib/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
- package/lib/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -5
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +4 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +4 -5
- package/lib/component/panels/PeaksPanel/PeaksTable.js +4 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +12 -15
- package/lib/component/panels/RangesPanel/RangesPanel.js +24 -29
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
- package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -34
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +2 -13
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +15 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -51
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +3 -3
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +16 -0
- package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +52 -0
- package/lib/component/panels/databasePanel/DatabasePanel.js +9 -7
- package/lib/component/panels/filtersPanel/FilterPanel.js +1 -2
- package/lib/component/panels/filtersPanel/FiltersTable.js +8 -9
- package/lib/component/panels/header/DefaultPanelHeader.js +1 -1
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
- package/lib/component/panels/predictionPanel/PredictionPanel.js +4 -5
- package/lib/component/reducer/IgnoreActions.d.ts +2 -1
- package/lib/component/reducer/IgnoreActions.js +35 -32
- package/lib/component/reducer/Reducer.d.ts +8 -5
- package/lib/component/reducer/Reducer.js +199 -221
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +7 -6
- package/lib/component/reducer/actions/AssignmentsActions.js +2 -2
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +21 -13
- package/lib/component/reducer/actions/CorrelationsActions.js +25 -20
- package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -2
- package/lib/component/reducer/actions/DatabaseActions.js +5 -2
- package/lib/component/reducer/actions/DimensionsActions.d.ts +8 -3
- package/lib/component/reducer/actions/DimensionsActions.js +3 -5
- package/lib/component/reducer/actions/DomainActions.d.ts +11 -5
- package/lib/component/reducer/actions/DomainActions.js +13 -19
- package/lib/component/reducer/actions/FiltersActions.d.ts +70 -23
- package/lib/component/reducer/actions/FiltersActions.js +250 -255
- package/lib/component/reducer/actions/GlobalActions.d.ts +7 -2
- package/lib/component/reducer/actions/GlobalActions.js +3 -3
- package/lib/component/reducer/actions/IntegralsActions.d.ts +28 -7
- package/lib/component/reducer/actions/IntegralsActions.js +16 -15
- package/lib/component/reducer/actions/LoadActions.d.ts +23 -5
- package/lib/component/reducer/actions/LoadActions.js +52 -52
- package/lib/component/reducer/actions/MoleculeActions.d.ts +38 -9
- package/lib/component/reducer/actions/MoleculeActions.js +27 -18
- package/lib/component/reducer/actions/PeaksActions.d.ts +39 -8
- package/lib/component/reducer/actions/PeaksActions.js +19 -11
- package/lib/component/reducer/actions/PreferencesActions.d.ts +8 -3
- package/lib/component/reducer/actions/PreferencesActions.js +5 -3
- package/lib/component/reducer/actions/RangesActions.d.ts +85 -18
- package/lib/component/reducer/actions/RangesActions.js +80 -65
- package/lib/component/reducer/actions/SpectraAnalysisAction.d.ts +7 -1
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +57 -24
- package/lib/component/reducer/actions/SpectrumsActions.js +69 -60
- package/lib/component/reducer/actions/ToolsActions.d.ts +59 -21
- package/lib/component/reducer/actions/ToolsActions.js +54 -32
- package/lib/component/reducer/actions/ZonesActions.d.ts +79 -15
- package/lib/component/reducer/actions/ZonesActions.js +68 -49
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +6 -5
- package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -2
- package/lib/component/reducer/helper/get2DRange.d.ts +7 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/types/ActionType.d.ts +6 -0
- package/lib/component/reducer/types/ActionType.js +1 -0
- package/lib/component/toolbar/BasicToolBar.js +6 -9
- package/lib/component/toolbar/FunctionToolBar.js +4 -9
- package/lib/component/toolbar/ToolBar.js +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts +2 -2
- package/lib/component/utility/Events.d.ts +4 -4
- package/lib/component/utility/Events.js +2 -2
- package/lib/component/utility/GroupByInfoKey.js +1 -1
- package/lib/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib/data/PredictionManager.d.ts +5 -8
- package/lib/data/PredictionManager.js +3 -3
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.d.ts +2 -3
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +5 -3
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -35
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +2 -35
- package/lib/data/data1d/filter1d/baselineCorrection.d.ts +7 -10
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.d.ts +5 -1
- package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/zones/mapZones.d.ts +2 -0
- package/lib/data/matrixGeneration.js +4 -2
- package/lib/data/molecules/Molecule.d.ts +3 -3
- package/lib/data/molecules/MoleculeManager.d.ts +5 -5
- package/lib/data/molecules/MoleculeManager.js +1 -1
- package/lib/data/utilities/generateColor.js +1 -1
- package/lib/data/utilities/isNumber.d.ts +1 -0
- package/lib/data/utilities/isNumber.js +3 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +25 -20
- package/lib-cjs/component/1d/integral/IntegralResizable.js +2 -3
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -2
- package/lib-cjs/component/1d/ranges/Range.js +9 -8
- package/lib-cjs/component/1d/ranges/Ranges.js +5 -7
- package/lib-cjs/component/1d/tool/BaseLineZones.js +1 -2
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
- package/lib-cjs/component/2d/1d-tracer/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
- package/lib-cjs/component/2d/Chart2D.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +10 -9
- package/lib-cjs/component/2d/fid/FidCanvas.js +4 -6
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/2d/utilities/scale.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +28 -21
- package/lib-cjs/component/NMRium.js +15 -7
- package/lib-cjs/component/context/DispatchContext.js +1 -1
- package/lib-cjs/component/context/LoggerContext.js +1 -1
- package/lib-cjs/component/elements/Button.js +7 -9
- package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +1 -2
- package/lib-cjs/component/elements/Tab/Tabs.js +1 -1
- package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColorInput.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +1 -1
- package/lib-cjs/component/elements/formik/FormikInput.js +1 -1
- package/lib-cjs/component/elements/formik/FormikSelect.js +2 -2
- package/lib-cjs/component/elements/formik/FormikSlider.js +1 -1
- package/lib-cjs/component/elements/formik/FormikTextarea.js +2 -2
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +3 -4
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +1 -2
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +4 -5
- package/lib-cjs/component/header/Header.js +4 -6
- package/lib-cjs/component/header/PhaseCorrectionPanel.js +7 -8
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +1 -2
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -11
- package/lib-cjs/component/header/Zones2DOptionPanel.js +5 -6
- package/lib-cjs/component/highlight/index.js +1 -1
- package/lib-cjs/component/hooks/useExport.js +1 -0
- package/lib-cjs/component/hooks/useTableSortBy.js +1 -1
- package/lib-cjs/component/hooks/useToolsFunctions.js +8 -10
- package/lib-cjs/component/hooks/useXYReduce.js +1 -1
- package/lib-cjs/component/loader/DropZone.js +4 -5
- package/lib-cjs/component/loader/NoData.js +1 -1
- package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
- package/lib-cjs/component/modal/EditPeakShapeModal.js +1 -2
- package/lib-cjs/component/modal/ImportPublicationStringModal.js +1 -2
- package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -3
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -19
- package/lib-cjs/component/modal/PredictSpectraModal.js +24 -21
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -4
- package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +2 -3
- package/lib-cjs/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
- package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
- package/lib-cjs/component/panels/InformationPanel.js +6 -6
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -10
- package/lib-cjs/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
- package/lib-cjs/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
- package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -5
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +2 -2
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
- package/lib-cjs/component/panels/Panels.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -5
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +4 -5
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +12 -15
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +24 -29
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +39 -34
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +15 -18
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +2 -51
- package/lib-cjs/component/panels/ZonesPanel/hooks/useMapZones.js +56 -0
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +8 -6
- package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -2
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +8 -9
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -1
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +4 -5
- package/lib-cjs/component/reducer/IgnoreActions.js +35 -55
- package/lib-cjs/component/reducer/Reducer.js +199 -221
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +3 -3
- package/lib-cjs/component/reducer/actions/CorrelationsActions.js +23 -18
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +4 -1
- package/lib-cjs/component/reducer/actions/DimensionsActions.js +3 -6
- package/lib-cjs/component/reducer/actions/DomainActions.js +15 -23
- package/lib-cjs/component/reducer/actions/FiltersActions.js +267 -272
- package/lib-cjs/component/reducer/actions/GlobalActions.js +4 -4
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +19 -18
- package/lib-cjs/component/reducer/actions/LoadActions.js +55 -55
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +31 -22
- package/lib-cjs/component/reducer/actions/PeaksActions.js +23 -15
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +7 -5
- package/lib-cjs/component/reducer/actions/RangesActions.js +81 -64
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +77 -67
- package/lib-cjs/component/reducer/actions/ToolsActions.js +54 -31
- package/lib-cjs/component/reducer/actions/ZonesActions.js +73 -52
- package/lib-cjs/component/reducer/core/Constants.js +1 -1
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -2
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -2
- package/lib-cjs/component/reducer/types/ActionType.js +2 -0
- package/lib-cjs/component/toolbar/BasicToolBar.js +6 -9
- package/lib-cjs/component/toolbar/FunctionToolBar.js +4 -9
- package/lib-cjs/component/toolbar/ToolBar.js +1 -1
- package/lib-cjs/component/utility/GroupByInfoKey.js +1 -1
- package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib-cjs/data/PredictionManager.js +3 -3
- package/lib-cjs/data/SpectraManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
- package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +2 -2
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
- package/lib-cjs/data/matrixGeneration.js +4 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
- package/lib-cjs/data/utilities/generateColor.js +1 -1
- package/lib-cjs/data/utilities/isNumber.js +7 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +24 -23
- package/lib/component/reducer/actions/HistoryActions.d.ts +0 -4
- package/lib/component/reducer/actions/HistoryActions.js +0 -40
- package/lib/component/reducer/types/HistoryTypes.d.ts +0 -4
- package/lib/component/reducer/types/HistoryTypes.js +0 -4
- package/lib/component/reducer/types/Types.d.ts +0 -132
- package/lib/component/reducer/types/Types.js +0 -126
- package/lib/component/toolbar/HistoryToolBar.d.ts +0 -8
- package/lib/component/toolbar/HistoryToolBar.js +0 -30
- package/lib/data/utilities/isMolFileEmpty.d.ts +0 -1
- package/lib/data/utilities/isMolFileEmpty.js +0 -6
- package/lib-cjs/component/reducer/actions/HistoryActions.js +0 -45
- package/lib-cjs/component/reducer/types/HistoryTypes.js +0 -7
- package/lib-cjs/component/reducer/types/Types.js +0 -131
- package/lib-cjs/component/toolbar/HistoryToolBar.js +0 -35
- package/lib-cjs/data/utilities/isMolFileEmpty.js +0 -10
|
@@ -3,7 +3,7 @@ import { current } from 'immer';
|
|
|
3
3
|
import * as Filters from '../../../data/Filters';
|
|
4
4
|
import * as FiltersManager from '../../../data/FiltersManager';
|
|
5
5
|
import { apply as apodization, defaultApodizationOptions, } from '../../../data/data1d/filter1d/apodization';
|
|
6
|
-
import { apply as baselineCorrection } from '../../../data/data1d/filter1d/baselineCorrection';
|
|
6
|
+
import { apply as baselineCorrection, } from '../../../data/data1d/filter1d/baselineCorrection';
|
|
7
7
|
import { apply as phaseCorrection } from '../../../data/data1d/filter1d/phaseCorrection';
|
|
8
8
|
import { apply as zeroFilling } from '../../../data/data1d/filter1d/zeroFilling';
|
|
9
9
|
import { options as Tools } from '../../toolbar/ToolTypes';
|
|
@@ -17,8 +17,156 @@ import { getStrongestPeak } from '../helper/getStrongestPeak';
|
|
|
17
17
|
import { setDomain, setMode } from './DomainActions';
|
|
18
18
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
19
19
|
import { activateTool, resetSelectedTool } from './ToolsActions';
|
|
20
|
-
function
|
|
20
|
+
function getFilterUpdateDomainRules(filterName) {
|
|
21
|
+
return (
|
|
22
|
+
// eslint-disable-next-line import/namespace
|
|
23
|
+
Filters[filterName]?.DOMAIN_UPDATE_RULES || {
|
|
24
|
+
updateXDomain: false,
|
|
25
|
+
updateYDomain: false,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function rollbackSpectrumByFilter(draft, options) {
|
|
29
|
+
const { applyFilter = true, searchBy = 'id', reset = false, key, activeSpectrum, triggerSource = 'none', } = options || {};
|
|
30
|
+
const currentActiveSpectrum = activeSpectrum || getActiveSpectrum(draft);
|
|
31
|
+
let updateDomainOptions = {
|
|
32
|
+
updateXDomain: false,
|
|
33
|
+
updateYDomain: false,
|
|
34
|
+
};
|
|
35
|
+
let previousIsFid = false;
|
|
36
|
+
let currentIsFid = false;
|
|
37
|
+
if (currentActiveSpectrum) {
|
|
38
|
+
const index = currentActiveSpectrum.index;
|
|
39
|
+
const datum = draft.data[index];
|
|
40
|
+
previousIsFid = datum.info.isFid;
|
|
41
|
+
const filterIndex = datum.filters.findIndex((f) => f[searchBy] === key);
|
|
42
|
+
const activeFilterId = draft.toolOptions.data.activeFilterID;
|
|
43
|
+
if (filterIndex !== -1 && !reset) {
|
|
44
|
+
const filters = datum.filters.slice(0, filterIndex || 1);
|
|
45
|
+
//set active filter
|
|
46
|
+
draft.toolOptions.data.activeFilterID = datum.filters[filterIndex]?.id;
|
|
47
|
+
if (filters.length > 0) {
|
|
48
|
+
for (let i = 0; i <= filterIndex; i++) {
|
|
49
|
+
const { updateXDomain, updateYDomain } = getFilterUpdateDomainRules(datum.filters[i].name);
|
|
50
|
+
updateDomainOptions.updateXDomain =
|
|
51
|
+
updateXDomain || updateDomainOptions.updateXDomain;
|
|
52
|
+
updateDomainOptions.updateYDomain =
|
|
53
|
+
updateYDomain || updateDomainOptions.updateYDomain;
|
|
54
|
+
}
|
|
55
|
+
FiltersManager.reapplyFilters(datum, filters);
|
|
56
|
+
}
|
|
57
|
+
draft.tempData = current(draft).data;
|
|
58
|
+
// apply the current Filters
|
|
59
|
+
if (applyFilter) {
|
|
60
|
+
FiltersManager.reapplyFilters(datum, datum.filters.slice(0, filterIndex + 1));
|
|
61
|
+
}
|
|
62
|
+
currentIsFid = datum.info.isFid;
|
|
63
|
+
//if we still point to the same filter then close the filter options panel and reset the selected tool to default one (zoom tool)
|
|
64
|
+
if (activeFilterId === datum.filters[filterIndex].id &&
|
|
65
|
+
triggerSource === 'Apply') {
|
|
66
|
+
draft.toolOptions.selectedOptionPanel = null;
|
|
67
|
+
draft.toolOptions.selectedTool = 'zoom';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
//if the filter is not exists, create a clone of the current data
|
|
72
|
+
draft.tempData = current(draft).data;
|
|
73
|
+
}
|
|
74
|
+
// re-implement all filters and rest all view property that related to filters
|
|
75
|
+
if (reset) {
|
|
76
|
+
draft.tempData = null;
|
|
77
|
+
FiltersManager.reapplyFilters(datum);
|
|
78
|
+
updateDomainOptions = { updateXDomain: true, updateYDomain: true };
|
|
79
|
+
const { toolOptions: { data }, } = getInitialState();
|
|
80
|
+
draft.toolOptions.data = data;
|
|
81
|
+
draft.toolOptions.selectedOptionPanel = null;
|
|
82
|
+
draft.toolOptions.selectedTool = 'zoom';
|
|
83
|
+
currentIsFid = datum.info.isFid;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
setDomain(draft, updateDomainOptions);
|
|
87
|
+
if (previousIsFid !== currentIsFid) {
|
|
88
|
+
setMode(draft);
|
|
89
|
+
changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function rollbackSpectrum(draft, options) {
|
|
93
|
+
const { filterKey, reset = false, updateFilterViewOptions = true } = options;
|
|
94
|
+
//return back the spectra data to point of time before applying a specific filter
|
|
95
|
+
const applyFilter = [
|
|
96
|
+
Filters.phaseCorrection.id,
|
|
97
|
+
Filters.fft.id,
|
|
98
|
+
Filters.shiftX.id,
|
|
99
|
+
Filters.shift2DX.id,
|
|
100
|
+
Filters.shift2DY.id,
|
|
101
|
+
Filters.signalProcessing.id,
|
|
102
|
+
].includes(filterKey);
|
|
103
|
+
rollbackSpectrumByFilter(draft, {
|
|
104
|
+
searchBy: 'name',
|
|
105
|
+
key: filterKey,
|
|
106
|
+
applyFilter,
|
|
107
|
+
reset,
|
|
108
|
+
});
|
|
109
|
+
if (updateFilterViewOptions) {
|
|
110
|
+
updateFilterOptionsInView(draft, filterKey);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function updateFilterOptionsInView(draft, filterKey) {
|
|
114
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
115
|
+
switch (filterKey) {
|
|
116
|
+
case Filters.phaseCorrection.id: {
|
|
117
|
+
// look for the strongest peak to set it as a pivot
|
|
118
|
+
const { xValue, index } = getStrongestPeak(draft) || {
|
|
119
|
+
xValue: 0,
|
|
120
|
+
index: 0,
|
|
121
|
+
};
|
|
122
|
+
draft.toolOptions.data.pivot = { value: xValue, index };
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case Filters.baselineCorrection.id: {
|
|
126
|
+
if (activeSpectrum) {
|
|
127
|
+
const baselineCorrectionFilter = current(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === Tools.baselineCorrection.id);
|
|
128
|
+
if (baselineCorrectionFilter) {
|
|
129
|
+
draft.toolOptions.data.baselineCorrection.zones =
|
|
130
|
+
baselineCorrectionFilter
|
|
131
|
+
? baselineCorrectionFilter.value.zones
|
|
132
|
+
: [];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case Filters.apodization.id: {
|
|
138
|
+
draft.toolOptions.data.apodizationOptions = defaultApodizationOptions;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
default:
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* getActiveFilterIndex return active filter index. Otherwise, its returns -1
|
|
147
|
+
*/
|
|
148
|
+
function getActiveFilterIndex(draft) {
|
|
149
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
150
|
+
const id = draft.toolOptions.data.activeFilterID;
|
|
151
|
+
if (id && activeSpectrum) {
|
|
152
|
+
const spectrum = draft.data[activeSpectrum.index];
|
|
153
|
+
const index = spectrum.filters.findIndex((filter) => filter.id === id);
|
|
154
|
+
return index;
|
|
155
|
+
}
|
|
156
|
+
return -1;
|
|
157
|
+
}
|
|
158
|
+
function updateView(draft, filterUpdateDomainRules) {
|
|
159
|
+
draft.tempData = null;
|
|
160
|
+
const { updateXDomain, updateYDomain } = filterUpdateDomainRules;
|
|
161
|
+
resetSelectedTool(draft);
|
|
162
|
+
setDomain(draft, { updateXDomain, updateYDomain });
|
|
163
|
+
setMode(draft);
|
|
164
|
+
changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
|
|
165
|
+
}
|
|
166
|
+
//action
|
|
167
|
+
function handleShiftSpectrumAlongXAxis(draft, action) {
|
|
21
168
|
//apply filter into the spectrum
|
|
169
|
+
const { shift } = action.payload;
|
|
22
170
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
23
171
|
if (activeSpectrum) {
|
|
24
172
|
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
@@ -38,7 +186,8 @@ function shiftSpectrumAlongXAxis(draft, shift) {
|
|
|
38
186
|
}
|
|
39
187
|
}
|
|
40
188
|
}
|
|
41
|
-
|
|
189
|
+
//action
|
|
190
|
+
function handleApplyZeroFillingFilter(draft, action) {
|
|
42
191
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
43
192
|
if (activeSpectrum) {
|
|
44
193
|
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
@@ -64,7 +213,24 @@ function applyZeroFillingFilter(draft, action) {
|
|
|
64
213
|
}
|
|
65
214
|
}
|
|
66
215
|
}
|
|
67
|
-
|
|
216
|
+
//action
|
|
217
|
+
function handleCalculateZeroFillingFilter(draft, action) {
|
|
218
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
219
|
+
if (activeSpectrum) {
|
|
220
|
+
const index = activeSpectrum.index;
|
|
221
|
+
const { data: { x, re, im }, filters, info, } = draft.tempData[index];
|
|
222
|
+
let _data = { data: { x, re, im }, filters, info };
|
|
223
|
+
zeroFilling(_data, action.payload);
|
|
224
|
+
const { im: newIm, re: newRe, x: newX } = _data.data;
|
|
225
|
+
const datum = draft.data[index];
|
|
226
|
+
datum.data.x = newX;
|
|
227
|
+
datum.data.im = newIm;
|
|
228
|
+
datum.data.re = newRe;
|
|
229
|
+
draft.xDomain = [newX[0], newX.at(-1)];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
//action
|
|
233
|
+
function handleCalculateApodizationFilter(draft, action) {
|
|
68
234
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
69
235
|
if (activeSpectrum) {
|
|
70
236
|
const index = activeSpectrum.index;
|
|
@@ -79,7 +245,8 @@ function calculateApodizationFilter(draft, action) {
|
|
|
79
245
|
datum.data.re = newRe;
|
|
80
246
|
}
|
|
81
247
|
}
|
|
82
|
-
|
|
248
|
+
//action
|
|
249
|
+
function handleApplyApodizationFilter(draft, action) {
|
|
83
250
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
84
251
|
if (activeSpectrum) {
|
|
85
252
|
const index = activeSpectrum.index;
|
|
@@ -102,22 +269,8 @@ function applyApodizationFilter(draft, action) {
|
|
|
102
269
|
}
|
|
103
270
|
}
|
|
104
271
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (activeSpectrum) {
|
|
108
|
-
const index = activeSpectrum.index;
|
|
109
|
-
const { data: { x, re, im }, filters, info, } = draft.tempData[index];
|
|
110
|
-
let _data = { data: { x, re, im }, filters, info };
|
|
111
|
-
zeroFilling(_data, action.payload);
|
|
112
|
-
const { im: newIm, re: newRe, x: newX } = _data.data;
|
|
113
|
-
const datum = draft.data[index];
|
|
114
|
-
datum.data.x = newX;
|
|
115
|
-
datum.data.im = newIm;
|
|
116
|
-
datum.data.re = newRe;
|
|
117
|
-
draft.xDomain = [newX[0], newX[newX.length - 1]];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function applyFFTFilter(draft) {
|
|
272
|
+
//action
|
|
273
|
+
function handleApplyFFTFilter(draft) {
|
|
121
274
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
122
275
|
if (activeSpectrum) {
|
|
123
276
|
const { index } = activeSpectrum;
|
|
@@ -135,11 +288,12 @@ function applyFFTFilter(draft) {
|
|
|
135
288
|
}
|
|
136
289
|
}
|
|
137
290
|
}
|
|
138
|
-
|
|
291
|
+
//action
|
|
292
|
+
function handleApplyManualPhaseCorrectionFilter(draft, action) {
|
|
139
293
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
140
294
|
if (activeSpectrum) {
|
|
141
295
|
const { index } = activeSpectrum;
|
|
142
|
-
const { ph0, ph1 } =
|
|
296
|
+
const { ph0, ph1 } = action.payload;
|
|
143
297
|
draft.data = draft.tempData;
|
|
144
298
|
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
145
299
|
FiltersManager.applyFilter(draft.data[index], [
|
|
@@ -160,7 +314,23 @@ function applyManualPhaseCorrectionFilter(draft, filterOptions) {
|
|
|
160
314
|
}
|
|
161
315
|
}
|
|
162
316
|
}
|
|
163
|
-
|
|
317
|
+
//action
|
|
318
|
+
function handleCalculateManualPhaseCorrection(draft, action) {
|
|
319
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
320
|
+
if (activeSpectrum) {
|
|
321
|
+
const { index } = activeSpectrum;
|
|
322
|
+
const { data: { x, re, im }, info, } = draft.tempData[index];
|
|
323
|
+
const { ph0, ph1 } = action.payload;
|
|
324
|
+
let _data = { data: { x, re, im }, info };
|
|
325
|
+
phaseCorrection(_data, { ph0, ph1 });
|
|
326
|
+
const { im: newIm, re: newRe } = _data.data;
|
|
327
|
+
const datum = draft.data[index];
|
|
328
|
+
datum.data.im = newIm;
|
|
329
|
+
datum.data.re = newRe;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
//action
|
|
333
|
+
function handleApplyAbsoluteFilter(draft) {
|
|
164
334
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
165
335
|
if (activeSpectrum) {
|
|
166
336
|
const { index } = activeSpectrum;
|
|
@@ -183,7 +353,8 @@ function applyAbsoluteFilter(draft) {
|
|
|
183
353
|
}
|
|
184
354
|
}
|
|
185
355
|
}
|
|
186
|
-
|
|
356
|
+
//action
|
|
357
|
+
function handleApplyAutoPhaseCorrectionFilter(draft) {
|
|
187
358
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
188
359
|
if (activeSpectrum) {
|
|
189
360
|
const { index } = activeSpectrum;
|
|
@@ -206,7 +377,35 @@ function applyAutoPhaseCorrectionFilter(draft) {
|
|
|
206
377
|
}
|
|
207
378
|
}
|
|
208
379
|
}
|
|
209
|
-
|
|
380
|
+
//action
|
|
381
|
+
function handleBaseLineCorrectionFilter(draft, action) {
|
|
382
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
383
|
+
if (activeSpectrum) {
|
|
384
|
+
const { zones } = draft.toolOptions.data.baselineCorrection;
|
|
385
|
+
const { livePreview, ...options } = action.payload;
|
|
386
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
387
|
+
FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
|
|
388
|
+
{
|
|
389
|
+
name: Filters.baselineCorrection.id,
|
|
390
|
+
value: {
|
|
391
|
+
...options,
|
|
392
|
+
zones,
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
], { filterIndex: activeFilterIndex });
|
|
396
|
+
if (activeFilterIndex !== -1) {
|
|
397
|
+
rollbackSpectrumByFilter(draft, {
|
|
398
|
+
searchBy: 'name',
|
|
399
|
+
key: Filters.baselineCorrection.id,
|
|
400
|
+
triggerSource: 'Apply',
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
updateView(draft, Filters.baselineCorrection.DOMAIN_UPDATE_RULES);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function calculateBaseLineCorrection(draft, baseLineOptions) {
|
|
210
409
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
211
410
|
if (activeSpectrum) {
|
|
212
411
|
const { index } = activeSpectrum;
|
|
@@ -214,7 +413,7 @@ function calculateBaseLineCorrection(draft, action) {
|
|
|
214
413
|
// save the baseline options temporary
|
|
215
414
|
draft.toolOptions.data.baselineCorrection = {
|
|
216
415
|
...draft.toolOptions.data.baselineCorrection,
|
|
217
|
-
...(
|
|
416
|
+
...(baseLineOptions ? { options: baseLineOptions } : {}),
|
|
218
417
|
};
|
|
219
418
|
const { zones, options } = draft.toolOptions.data.baselineCorrection;
|
|
220
419
|
const { livePreview, ...filterOptions } = options;
|
|
@@ -231,25 +430,17 @@ function calculateBaseLineCorrection(draft, action) {
|
|
|
231
430
|
}
|
|
232
431
|
}
|
|
233
432
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const { index } = activeSpectrum;
|
|
238
|
-
const { data: { x, re, im }, info, } = draft.tempData[index];
|
|
239
|
-
const { ph0, ph1 } = filterOptions;
|
|
240
|
-
let _data = { data: { x, re, im }, info };
|
|
241
|
-
phaseCorrection(_data, { ph0, ph1 });
|
|
242
|
-
const { im: newIm, re: newRe } = _data.data;
|
|
243
|
-
const datum = draft.data[index];
|
|
244
|
-
datum.data.im = newIm;
|
|
245
|
-
datum.data.re = newRe;
|
|
246
|
-
}
|
|
433
|
+
//action
|
|
434
|
+
function handleCalculateBaseLineCorrection(draft, action) {
|
|
435
|
+
calculateBaseLineCorrection(draft, action.payload);
|
|
247
436
|
}
|
|
248
|
-
|
|
437
|
+
//action
|
|
438
|
+
function handleEnableFilter(draft, action) {
|
|
439
|
+
const { id: filterID, enabled } = action.payload;
|
|
249
440
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
250
441
|
if (activeSpectrum) {
|
|
251
442
|
//apply filter into the spectrum
|
|
252
|
-
FiltersManager.enableFilter(draft.data[activeSpectrum.index], filterID,
|
|
443
|
+
FiltersManager.enableFilter(draft.data[activeSpectrum.index], filterID, enabled);
|
|
253
444
|
resetSelectedTool(draft);
|
|
254
445
|
setDomain(draft);
|
|
255
446
|
setMode(draft);
|
|
@@ -261,8 +452,9 @@ function enableFilter(draft, filterID, checked) {
|
|
|
261
452
|
}
|
|
262
453
|
}
|
|
263
454
|
}
|
|
264
|
-
|
|
265
|
-
|
|
455
|
+
//action
|
|
456
|
+
function handleDeleteFilter(draft, action) {
|
|
457
|
+
const filterID = action?.payload?.id;
|
|
266
458
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
267
459
|
if (activeSpectrum) {
|
|
268
460
|
//apply filter into the spectrum
|
|
@@ -273,12 +465,13 @@ function deleteFilter(draft, actions) {
|
|
|
273
465
|
setMode(draft);
|
|
274
466
|
}
|
|
275
467
|
}
|
|
276
|
-
|
|
277
|
-
|
|
468
|
+
//action
|
|
469
|
+
function handleDeleteSpectraFilter(draft, action) {
|
|
470
|
+
const filterName = action.payload.filterName;
|
|
278
471
|
if (draft.view.spectra.activeTab) {
|
|
279
472
|
for (const datum of draft.data) {
|
|
280
473
|
if (nucleusToString(datum?.info?.nucleus) === draft.view.spectra.activeTab) {
|
|
281
|
-
const filtersResult = datum.filters?.filter((filter) => filter.name ===
|
|
474
|
+
const filtersResult = datum.filters?.filter((filter) => filter.name === filterName) || [];
|
|
282
475
|
for (const filter of filtersResult) {
|
|
283
476
|
FiltersManager.deleteFilter(datum, filter.id);
|
|
284
477
|
}
|
|
@@ -289,115 +482,8 @@ function deleteSpectraFilter(draft, actions) {
|
|
|
289
482
|
setMode(draft);
|
|
290
483
|
}
|
|
291
484
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (activeSpectrum) {
|
|
295
|
-
const { zones } = draft.toolOptions.data.baselineCorrection;
|
|
296
|
-
const { livePreview, ...options } = action.options;
|
|
297
|
-
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
298
|
-
FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
|
|
299
|
-
{
|
|
300
|
-
name: Filters.baselineCorrection.id,
|
|
301
|
-
value: {
|
|
302
|
-
zones,
|
|
303
|
-
...options,
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
|
-
], { filterIndex: activeFilterIndex });
|
|
307
|
-
if (activeFilterIndex !== -1) {
|
|
308
|
-
rollbackSpectrumByFilter(draft, {
|
|
309
|
-
searchBy: 'name',
|
|
310
|
-
key: Filters.baselineCorrection.id,
|
|
311
|
-
triggerSource: 'Apply',
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
updateView(draft, Filters.baselineCorrection.DOMAIN_UPDATE_RULES);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* reset spectrum data for specific point of time (Filter)
|
|
321
|
-
* @param {object} draft
|
|
322
|
-
* @param {object} options
|
|
323
|
-
* @param {string} options.id Filter id
|
|
324
|
-
* @param {boolean=} options.resetTool
|
|
325
|
-
* @param {boolean=} options.updateDomain
|
|
326
|
-
* @param {boolean=} options.rollback
|
|
327
|
-
*/
|
|
328
|
-
function getFilterUpdateDomainRules(filterName) {
|
|
329
|
-
return (
|
|
330
|
-
// eslint-disable-next-line import/namespace
|
|
331
|
-
Filters[filterName]?.DOMAIN_UPDATE_RULES || {
|
|
332
|
-
updateXDomain: false,
|
|
333
|
-
updateYDomain: false,
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
function rollbackSpectrumByFilter(draft, options) {
|
|
337
|
-
const { applyFilter = true, searchBy = 'id', reset = false, key, activeSpectrum, triggerSource = 'none', } = options || {};
|
|
338
|
-
const currentActiveSpectrum = activeSpectrum || getActiveSpectrum(draft);
|
|
339
|
-
let updateDomainOptions = {
|
|
340
|
-
updateXDomain: false,
|
|
341
|
-
updateYDomain: false,
|
|
342
|
-
};
|
|
343
|
-
let previousIsFid = false;
|
|
344
|
-
let currentIsFid = false;
|
|
345
|
-
if (currentActiveSpectrum) {
|
|
346
|
-
const index = currentActiveSpectrum.index;
|
|
347
|
-
const datum = draft.data[index];
|
|
348
|
-
previousIsFid = datum.info.isFid;
|
|
349
|
-
const filterIndex = datum.filters.findIndex((f) => f[searchBy] === key);
|
|
350
|
-
const activeFilterId = draft.toolOptions.data.activeFilterID;
|
|
351
|
-
if (filterIndex !== -1 && !reset) {
|
|
352
|
-
const filters = datum.filters.slice(0, filterIndex || 1);
|
|
353
|
-
//set active filter
|
|
354
|
-
draft.toolOptions.data.activeFilterID = datum.filters[filterIndex]?.id;
|
|
355
|
-
if (filters.length > 0) {
|
|
356
|
-
for (let i = 0; i <= filterIndex; i++) {
|
|
357
|
-
const { updateXDomain, updateYDomain } = getFilterUpdateDomainRules(datum.filters[i].name);
|
|
358
|
-
updateDomainOptions.updateXDomain =
|
|
359
|
-
updateXDomain || updateDomainOptions.updateXDomain;
|
|
360
|
-
updateDomainOptions.updateYDomain =
|
|
361
|
-
updateYDomain || updateDomainOptions.updateYDomain;
|
|
362
|
-
}
|
|
363
|
-
FiltersManager.reapplyFilters(datum, filters);
|
|
364
|
-
}
|
|
365
|
-
draft.tempData = current(draft).data;
|
|
366
|
-
// apply the current Filters
|
|
367
|
-
if (applyFilter) {
|
|
368
|
-
FiltersManager.reapplyFilters(datum, datum.filters.slice(0, filterIndex + 1));
|
|
369
|
-
}
|
|
370
|
-
currentIsFid = datum.info.isFid;
|
|
371
|
-
//if we still point to the same filter then close the filter options panel and reset the selected tool to default one (zoom tool)
|
|
372
|
-
if (activeFilterId === datum.filters[filterIndex].id &&
|
|
373
|
-
triggerSource === 'Apply') {
|
|
374
|
-
draft.toolOptions.selectedOptionPanel = null;
|
|
375
|
-
draft.toolOptions.selectedTool = Tools.zoom.id;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
//if the filter is not exists, create a clone of the current data
|
|
380
|
-
draft.tempData = current(draft).data;
|
|
381
|
-
}
|
|
382
|
-
// re-implement all filters and rest all view property that related to filters
|
|
383
|
-
if (reset) {
|
|
384
|
-
draft.tempData = null;
|
|
385
|
-
FiltersManager.reapplyFilters(datum);
|
|
386
|
-
updateDomainOptions = { updateXDomain: true, updateYDomain: true };
|
|
387
|
-
const { toolOptions: { data }, } = getInitialState();
|
|
388
|
-
draft.toolOptions.data = data;
|
|
389
|
-
draft.toolOptions.selectedOptionPanel = null;
|
|
390
|
-
draft.toolOptions.selectedTool = Tools.zoom.id;
|
|
391
|
-
currentIsFid = datum.info.isFid;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
setDomain(draft, updateDomainOptions);
|
|
395
|
-
if (previousIsFid !== currentIsFid) {
|
|
396
|
-
setMode(draft);
|
|
397
|
-
changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function filterSnapshotHandler(draft, action) {
|
|
485
|
+
//action
|
|
486
|
+
function handleSetFilterSnapshotHandler(draft, action) {
|
|
401
487
|
const { name: filterKey, id } = action.payload;
|
|
402
488
|
const reset = draft.toolOptions.data.activeFilterID === id;
|
|
403
489
|
if (Tools?.[filterKey]?.isFilter) {
|
|
@@ -408,26 +494,7 @@ function filterSnapshotHandler(draft, action) {
|
|
|
408
494
|
rollbackSpectrum(draft, { filterKey, reset });
|
|
409
495
|
}
|
|
410
496
|
}
|
|
411
|
-
|
|
412
|
-
const spectra = getSpectraByNucleus(draft.view.spectra.activeTab, draft.data);
|
|
413
|
-
if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
|
|
414
|
-
const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
|
|
415
|
-
?.value || [];
|
|
416
|
-
for (const spectrum of spectra) {
|
|
417
|
-
const filters = action.payload.map((filter) => {
|
|
418
|
-
if (filter.name === Filters.equallySpaced.id) {
|
|
419
|
-
return {
|
|
420
|
-
...filter,
|
|
421
|
-
options: { ...filter.options, exclusions },
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
return filter;
|
|
425
|
-
});
|
|
426
|
-
FiltersManager.applyFilter(spectrum, filters);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
setDomain(draft);
|
|
430
|
-
}
|
|
497
|
+
//action
|
|
431
498
|
function handleSignalProcessingFilter(draft, action) {
|
|
432
499
|
const { data, view } = draft;
|
|
433
500
|
const nucleus = view.spectra.activeTab;
|
|
@@ -445,8 +512,9 @@ function handleSignalProcessingFilter(draft, action) {
|
|
|
445
512
|
const { updateXDomain, updateYDomain } = Filters.signalProcessing.DOMAIN_UPDATE_RULES;
|
|
446
513
|
setDomain(draft, { updateXDomain, updateYDomain });
|
|
447
514
|
}
|
|
515
|
+
//action
|
|
448
516
|
function handleAddExclusionZone(draft, action) {
|
|
449
|
-
const {
|
|
517
|
+
const { startX, endX } = action.payload;
|
|
450
518
|
const range = getRange(draft, { startX, endX });
|
|
451
519
|
let spectra;
|
|
452
520
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
@@ -474,11 +542,12 @@ function handleAddExclusionZone(draft, action) {
|
|
|
474
542
|
const { updateXDomain, updateYDomain } = Filters.exclusionZones.DOMAIN_UPDATE_RULES;
|
|
475
543
|
setDomain(draft, { updateXDomain, updateYDomain });
|
|
476
544
|
}
|
|
545
|
+
//action
|
|
477
546
|
function handleDeleteExclusionZone(draft, action) {
|
|
478
|
-
const { zone,
|
|
547
|
+
const { zone, spectrumId } = action.payload;
|
|
479
548
|
// if spectrum id exists, remove the selected exclusion zone in the spectrum
|
|
480
|
-
if (
|
|
481
|
-
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id ===
|
|
549
|
+
if (spectrumId) {
|
|
550
|
+
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumId);
|
|
482
551
|
const filter = draft.data[spectrumIndex].filters.find((_filter) => _filter.name === Filters.exclusionZones.id);
|
|
483
552
|
if (filter) {
|
|
484
553
|
if (filter.value.length === 1) {
|
|
@@ -503,78 +572,4 @@ function handleDeleteExclusionZone(draft, action) {
|
|
|
503
572
|
}
|
|
504
573
|
}
|
|
505
574
|
}
|
|
506
|
-
|
|
507
|
-
const { filterKey, reset = false, updateFilterViewOptions = true } = options;
|
|
508
|
-
//return back the spectra data to point of time before applying a specific filter
|
|
509
|
-
const applyFilter = [
|
|
510
|
-
Filters.phaseCorrection.id,
|
|
511
|
-
Filters.fft.id,
|
|
512
|
-
Filters.shiftX.id,
|
|
513
|
-
Filters.shift2DX.id,
|
|
514
|
-
Filters.shift2DY.id,
|
|
515
|
-
Filters.signalProcessing.id,
|
|
516
|
-
].includes(filterKey);
|
|
517
|
-
rollbackSpectrumByFilter(draft, {
|
|
518
|
-
searchBy: 'name',
|
|
519
|
-
key: filterKey,
|
|
520
|
-
applyFilter,
|
|
521
|
-
reset,
|
|
522
|
-
});
|
|
523
|
-
if (updateFilterViewOptions) {
|
|
524
|
-
updateFilterOptionsInView(draft, filterKey);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
function updateFilterOptionsInView(draft, filterKey) {
|
|
528
|
-
const activeSpectrum = getActiveSpectrum(draft);
|
|
529
|
-
switch (filterKey) {
|
|
530
|
-
case Filters.phaseCorrection.id: {
|
|
531
|
-
// look for the strongest peak to set it as a pivot
|
|
532
|
-
const { xValue, index } = getStrongestPeak(draft) || {
|
|
533
|
-
xValue: 0,
|
|
534
|
-
index: 0,
|
|
535
|
-
};
|
|
536
|
-
draft.toolOptions.data.pivot = { value: xValue, index };
|
|
537
|
-
break;
|
|
538
|
-
}
|
|
539
|
-
case Filters.baselineCorrection.id: {
|
|
540
|
-
if (activeSpectrum) {
|
|
541
|
-
const baselineCorrectionFilter = current(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === Tools.baselineCorrection.id);
|
|
542
|
-
if (baselineCorrectionFilter) {
|
|
543
|
-
draft.toolOptions.data.baselineCorrection.zones =
|
|
544
|
-
baselineCorrectionFilter
|
|
545
|
-
? baselineCorrectionFilter.value.zones
|
|
546
|
-
: [];
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
break;
|
|
550
|
-
}
|
|
551
|
-
case Filters.apodization.id: {
|
|
552
|
-
draft.toolOptions.data.apodizationOptions = defaultApodizationOptions;
|
|
553
|
-
break;
|
|
554
|
-
}
|
|
555
|
-
default:
|
|
556
|
-
break;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* getActiveFilterIndex return active filter index. Otherwise, its returns -1
|
|
561
|
-
*/
|
|
562
|
-
function getActiveFilterIndex(draft) {
|
|
563
|
-
const activeSpectrum = getActiveSpectrum(draft);
|
|
564
|
-
const id = draft.toolOptions.data.activeFilterID;
|
|
565
|
-
if (id && activeSpectrum) {
|
|
566
|
-
const spectrum = draft.data[activeSpectrum.index];
|
|
567
|
-
const index = spectrum.filters.findIndex((filter) => filter.id === id);
|
|
568
|
-
return index;
|
|
569
|
-
}
|
|
570
|
-
return -1;
|
|
571
|
-
}
|
|
572
|
-
function updateView(draft, filterUpdateDomainRules) {
|
|
573
|
-
draft.tempData = null;
|
|
574
|
-
const { updateXDomain, updateYDomain } = filterUpdateDomainRules;
|
|
575
|
-
resetSelectedTool(draft);
|
|
576
|
-
setDomain(draft, { updateXDomain, updateYDomain });
|
|
577
|
-
setMode(draft);
|
|
578
|
-
changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
|
|
579
|
-
}
|
|
580
|
-
export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyApodizationFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, calculateApodizationFilter, calculateZeroFillingFilter, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, rollbackSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, rollbackSpectrum, handleSignalProcessingFilter, };
|
|
575
|
+
export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
2
|
import { State } from '../Reducer';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { ActionType } from '../types/ActionType';
|
|
4
|
+
type SetIsOverDisplayerAction = ActionType<'SET_MOUSE_OVER_DISPLAYER', {
|
|
5
|
+
isMouseOverDisplayer: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export type GlobalActions = SetIsOverDisplayerAction;
|
|
8
|
+
declare function handleSetIsOverDisplayer(draft: Draft<State>, action: SetIsOverDisplayerAction): void;
|
|
9
|
+
export { handleSetIsOverDisplayer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
draft.overDisplayer =
|
|
1
|
+
function handleSetIsOverDisplayer(draft, action) {
|
|
2
|
+
draft.overDisplayer = action.payload.isMouseOverDisplayer;
|
|
3
3
|
}
|
|
4
|
-
export {
|
|
4
|
+
export { handleSetIsOverDisplayer };
|