nmrium 0.27.0 → 0.28.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/ExclusionZonesAnnotations.js +1 -1
- package/lib/component/1d/IntegralsSeries.js +2 -6
- package/lib/component/1d/PeakAnnotation.js +2 -2
- package/lib/component/1d/PeakAnnotations.js +2 -4
- package/lib/component/1d/SpectraTracker.js +2 -2
- package/lib/component/1d/Viewer1D.js +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +28 -26
- package/lib/component/1d/ranges/Range.d.ts +1 -2
- package/lib/component/1d/ranges/Range.js +3 -4
- package/lib/component/1d/ranges/Ranges.js +3 -4
- package/lib/component/1d/tool/BaseLineZones.js +3 -6
- package/lib/component/1d/tool/VerticalIndicator.js +1 -1
- package/lib/component/2d/Contours.js +1 -5
- package/lib/component/2d/SignalDeltaLine.js +1 -1
- package/lib/component/2d/Viewer2D.js +1 -1
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/zones/IndicationLines.js +2 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +59 -41
- package/lib/component/NMRium.d.ts +14 -49
- package/lib/component/NMRium.js +14 -6
- package/lib/component/SplitPaneWrapper.js +2 -2
- package/lib/component/context/PreferencesContext.d.ts +3 -43
- package/lib/component/elements/Button.js +1 -1
- package/lib/component/elements/Logo.js +1 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
- package/lib/component/elements/Tab/Tabs.js +2 -1
- package/lib/component/elements/ToggleButton.js +2 -2
- package/lib/component/elements/accordion/Accordion.js +2 -6
- package/lib/component/elements/formik/Input.js +1 -1
- package/lib/component/elements/popup/Modal/Modal.js +1 -1
- package/lib/component/elements/popup/Modal/ModalContent.js +1 -1
- package/lib/component/elements/toggle/ToggleButtonGroup.js +2 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +7 -4
- package/lib/component/header/Header.js +2 -2
- package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +2 -1
- package/lib/component/hooks/useExport.js +2 -2
- package/lib/component/hooks/useFormatNumberByNucleus.js +3 -4
- package/lib/component/loader/DropZone.js +8 -2
- package/lib/component/loader/NoData.d.ts +3 -2
- package/lib/component/loader/NoData.js +31 -30
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -2
- package/lib/component/modal/editRange/EditRangeModal.d.ts +3 -3
- package/lib/component/modal/editRange/EditRangeModal.js +49 -54
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +2 -0
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +34 -0
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +1 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +11 -14
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +2 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +18 -29
- package/lib/component/modal/editZone/SignalsForm.js +1 -1
- package/lib/component/modal/setting/DatabasesTabContent.d.ts +2 -1
- package/lib/component/modal/setting/DatabasesTabContent.js +28 -30
- package/lib/component/modal/setting/settingsValidation.d.ts +150 -42
- package/lib/component/modal/setting/settingsValidation.js +6 -4
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +13 -15
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +2 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +12 -3
- package/lib/component/panels/RangesPanel/RangesPanel.js +19 -19
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +4 -4
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +48 -30
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -3
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -8
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
- package/lib/component/panels/SummaryPanel/utilities/{IsInView.d.ts → useInView.d.ts} +2 -2
- package/lib/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +13 -13
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +4 -0
- package/lib/component/panels/databasePanel/DatabasePanel.js +80 -26
- package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.d.ts +7 -0
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +8 -0
- package/lib/component/panels/databasePanel/DatabaseTable.js +14 -9
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +2 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +1 -3
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +8 -66
- package/lib/component/reducer/Reducer.js +13 -8
- package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
- package/lib/component/reducer/actions/DatabaseActions.js +21 -3
- package/lib/component/reducer/actions/DomainActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +2 -1
- package/lib/component/reducer/actions/FiltersActions.js +25 -4
- package/lib/component/reducer/actions/PreferencesActions.js +32 -20
- package/lib/component/reducer/actions/RangesActions.d.ts +2 -2
- package/lib/component/reducer/actions/RangesActions.js +45 -11
- package/lib/component/reducer/actions/SpectrumsActions.js +6 -9
- package/lib/component/reducer/actions/ToolsActions.js +66 -53
- package/lib/component/reducer/helper/getSpectrum.d.ts +5 -0
- package/lib/component/reducer/helper/getSpectrum.js +14 -0
- package/lib/component/reducer/preferences/actions/initPreferences.js +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -10
- package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/tool/BrushX.js +1 -1
- package/lib/component/tool/BrushXY.js +1 -1
- package/lib/component/tool/CrossLinePointer.js +1 -1
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +4 -3
- package/lib/component/toolbar/BasicToolBar.js +0 -1
- package/lib/component/toolbar/FunctionToolBar.js +9 -13
- package/lib/component/toolbar/ToolTypes.d.ts +1 -1
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/utility/Export.d.ts +7 -1
- package/lib/component/utility/Export.js +3 -3
- package/lib/component/utility/formatNumber.d.ts +1 -1
- package/lib/component/utility/formatNumber.js +4 -2
- package/lib/component/utility/isGoogleDocument.d.ts +1 -0
- package/lib/component/utility/isGoogleDocument.js +3 -0
- package/lib/component/utility/nmredataToNmrium.js +1 -2
- package/lib/component/utility/nmriumToNmredata.d.ts +2 -2
- package/lib/component/utility/nmriumToNmredata.js +2 -2
- package/lib/component/utility/util/nmredata/addSource.js +2 -2
- package/lib/component/workspaces/Workspace.d.ts +9 -4
- package/lib/component/workspaces/basic.js +15 -8
- package/lib/component/workspaces/exercise.js +2 -2
- package/lib/component/workspaces/process1D.js +1 -1
- package/lib/data/FiltersManager.js +1 -1
- package/lib/data/PredictionManager.js +7 -9
- package/lib/data/SpectraManager.d.ts +4 -12
- package/lib/data/SpectraManager.js +14 -23
- package/lib/data/data1d/Data1DManager.js +8 -1
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
- package/lib/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +36 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +38 -15
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
- package/lib/data/data1d/database.d.ts +5 -3
- package/lib/data/data1d/database.js +54 -4
- package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib/data/data2d/Processing2D.js +1 -1
- package/lib/data/molecules/Molecule.d.ts +4 -5
- package/lib/data/molecules/Molecule.js +3 -1
- package/lib/data/utilities/FindUtilities.js +1 -3
- package/lib/data/utilities/RangeUtilities.js +5 -6
- package/lib/data/utilities/ZoneUtilities.js +1 -1
- package/lib/data/utilities/getSum.js +1 -3
- package/lib/data/utilities/isMolFileEmpty.d.ts +1 -0
- package/lib/data/utilities/isMolFileEmpty.js +6 -0
- package/lib/types/NMRiumDataReturn.d.ts +15 -0
- package/lib/types/NMRiumDataReturn.js +1 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +10 -0
- package/lib/types/NMRiumGeneralPreferences.js +1 -0
- package/lib/types/NMRiumPanelPreferences.d.ts +16 -0
- package/lib/types/NMRiumPanelPreferences.js +1 -0
- package/lib/types/NMRiumToolBarPreferences.d.ts +20 -0
- package/lib/types/NMRiumToolBarPreferences.js +1 -0
- package/lib/types/Preferences.d.ts +5 -0
- package/lib/types/Preferences.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -1
- package/lib-cjs/component/1d/IntegralsSeries.js +2 -6
- package/lib-cjs/component/1d/PeakAnnotation.js +2 -2
- package/lib-cjs/component/1d/PeakAnnotations.js +2 -4
- package/lib-cjs/component/1d/SpectraTracker.js +2 -2
- package/lib-cjs/component/1d/Viewer1D.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +30 -25
- package/lib-cjs/component/1d/ranges/Range.js +3 -4
- package/lib-cjs/component/1d/ranges/Ranges.js +3 -4
- package/lib-cjs/component/1d/tool/BaseLineZones.js +3 -6
- package/lib-cjs/component/1d/tool/VerticalIndicator.js +1 -1
- package/lib-cjs/component/2d/Contours.js +1 -5
- package/lib-cjs/component/2d/SignalDeltaLine.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +1 -1
- package/lib-cjs/component/2d/YAxis.js +1 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +2 -3
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +59 -41
- package/lib-cjs/component/NMRium.js +13 -5
- package/lib-cjs/component/SplitPaneWrapper.js +2 -2
- package/lib-cjs/component/elements/Button.js +1 -1
- package/lib-cjs/component/elements/Logo.js +1 -1
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
- package/lib-cjs/component/elements/Tab/Tabs.js +2 -1
- package/lib-cjs/component/elements/ToggleButton.js +2 -2
- package/lib-cjs/component/elements/accordion/Accordion.js +2 -6
- package/lib-cjs/component/elements/formik/Input.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/Modal.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ModalContent.js +1 -1
- package/lib-cjs/component/elements/toggle/ToggleButtonGroup.js +2 -2
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -3
- package/lib-cjs/component/header/Header.js +2 -2
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -1
- package/lib-cjs/component/hooks/useExport.js +2 -2
- package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +2 -3
- package/lib-cjs/component/loader/DropZone.js +8 -2
- package/lib-cjs/component/loader/NoData.js +31 -30
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +47 -52
- package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +38 -0
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormTab.js +13 -16
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +18 -29
- package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +31 -33
- package/lib-cjs/component/modal/setting/settingsValidation.js +6 -4
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +12 -14
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
- package/lib-cjs/component/panels/Panels.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -1
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +18 -18
- package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +47 -29
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +6 -8
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
- package/lib-cjs/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -12
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +78 -24
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabaseStructureSearchModal.js +15 -0
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +14 -9
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +2 -4
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -3
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib-cjs/component/reducer/Reducer.js +13 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +22 -3
- package/lib-cjs/component/reducer/actions/DomainActions.js +1 -1
- package/lib-cjs/component/reducer/actions/FiltersActions.js +26 -4
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +30 -18
- package/lib-cjs/component/reducer/actions/RangesActions.js +46 -12
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +4 -7
- package/lib-cjs/component/reducer/actions/ToolsActions.js +63 -73
- package/lib-cjs/component/reducer/helper/getSpectrum.js +18 -0
- package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +1 -1
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib-cjs/component/reducer/types/Types.js +5 -3
- package/lib-cjs/component/tool/BrushX.js +1 -1
- package/lib-cjs/component/tool/BrushXY.js +1 -1
- package/lib-cjs/component/tool/CrossLinePointer.js +1 -1
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/toolbar/BasicToolBar.js +0 -1
- package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -13
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/utility/Export.js +4 -3
- package/lib-cjs/component/utility/formatNumber.js +3 -1
- package/lib-cjs/component/utility/isGoogleDocument.js +7 -0
- package/lib-cjs/component/utility/nmredataToNmrium.js +1 -2
- package/lib-cjs/component/utility/util/nmredata/addSource.js +2 -2
- package/lib-cjs/component/workspaces/basic.js +15 -8
- package/lib-cjs/component/workspaces/exercise.js +2 -2
- package/lib-cjs/component/workspaces/process1D.js +1 -1
- package/lib-cjs/data/FiltersManager.js +1 -1
- package/lib-cjs/data/PredictionManager.js +7 -9
- package/lib-cjs/data/SpectraManager.js +14 -23
- package/lib-cjs/data/data1d/Data1DManager.js +8 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
- package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +40 -16
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
- package/lib-cjs/data/data1d/database.js +55 -5
- package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib-cjs/data/data2d/Processing2D.js +1 -1
- package/lib-cjs/data/molecules/Molecule.js +3 -1
- package/lib-cjs/data/utilities/FindUtilities.js +1 -3
- package/lib-cjs/data/utilities/RangeUtilities.js +8 -6
- package/lib-cjs/data/utilities/ZoneUtilities.js +1 -1
- package/lib-cjs/data/utilities/getSum.js +1 -3
- package/lib-cjs/data/utilities/isMolFileEmpty.js +10 -0
- package/lib-cjs/types/NMRiumDataReturn.js +2 -0
- package/lib-cjs/types/NMRiumGeneralPreferences.js +2 -0
- package/lib-cjs/types/NMRiumPanelPreferences.js +2 -0
- package/lib-cjs/types/NMRiumToolBarPreferences.js +2 -0
- package/lib-cjs/types/Preferences.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +31 -31
- package/lib/component/1d/multiplicityTree/TempMultiplicityTree.d.ts +0 -2
- package/lib/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -14
- package/lib/component/panels/databasePanel/useDatabases.d.ts +0 -5
- package/lib/component/panels/databasePanel/useDatabases.js +0 -10
- package/lib-cjs/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -20
- package/lib-cjs/component/panels/databasePanel/useDatabases.js +0 -14
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import lodashGet from 'lodash/get';
|
|
3
4
|
import { useMemo, memo } from 'react';
|
|
4
5
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
5
6
|
import { FaPlus } from 'react-icons/fa';
|
|
@@ -8,12 +9,13 @@ import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
|
8
9
|
import addCustomColumn from '../../elements/ReactTable/utility/addCustomColumn';
|
|
9
10
|
import { HighlightedSource } from '../../highlight';
|
|
10
11
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
12
|
+
import { formatNumber } from '../../utility/formatNumber';
|
|
11
13
|
const overFlowStyle = {
|
|
12
14
|
overflow: 'hidden',
|
|
13
15
|
whiteSpace: 'nowrap',
|
|
14
16
|
textOverflow: 'ellipsis',
|
|
15
17
|
};
|
|
16
|
-
const
|
|
18
|
+
const databaseTableColumns = (databasePreferences) => [
|
|
17
19
|
{
|
|
18
20
|
showWhen: 'showNames',
|
|
19
21
|
index: 1,
|
|
@@ -28,17 +30,20 @@ const COLUMNS = [
|
|
|
28
30
|
},
|
|
29
31
|
},
|
|
30
32
|
{
|
|
31
|
-
showWhen: '
|
|
33
|
+
showWhen: 'range.show',
|
|
32
34
|
index: 2,
|
|
33
35
|
Header: 'From - To',
|
|
34
|
-
accessor: (row) =>
|
|
36
|
+
accessor: (row) => {
|
|
37
|
+
const rangeFormat = databasePreferences.range.format;
|
|
38
|
+
return `${formatNumber(row.from, rangeFormat)} - ${formatNumber(row.to, rangeFormat)}`;
|
|
39
|
+
},
|
|
35
40
|
enableRowSpan: true,
|
|
36
41
|
},
|
|
37
42
|
{
|
|
38
|
-
showWhen: '
|
|
43
|
+
showWhen: 'delta.show',
|
|
39
44
|
index: 3,
|
|
40
45
|
Header: 'δ (ppm)',
|
|
41
|
-
accessor:
|
|
46
|
+
accessor: (row) => `${formatNumber(row.delta, databasePreferences.delta.format)}`,
|
|
42
47
|
},
|
|
43
48
|
{
|
|
44
49
|
showWhen: 'showAssignment',
|
|
@@ -53,10 +58,10 @@ const COLUMNS = [
|
|
|
53
58
|
accessor: 'multiplicity',
|
|
54
59
|
},
|
|
55
60
|
{
|
|
56
|
-
showWhen: '
|
|
61
|
+
showWhen: 'coupling.show',
|
|
57
62
|
index: 6,
|
|
58
63
|
Header: 'J (Hz)',
|
|
59
|
-
accessor:
|
|
64
|
+
accessor: (row) => `${formatNumber(row.coupling, databasePreferences.coupling.format)}`,
|
|
60
65
|
style: {
|
|
61
66
|
width: '60px',
|
|
62
67
|
minWidth: '60px',
|
|
@@ -115,9 +120,9 @@ function DatabaseTable({ data, onAdd }) {
|
|
|
115
120
|
], [onAdd]);
|
|
116
121
|
const tableColumns = useMemo(() => {
|
|
117
122
|
let columns = [...initialColumns];
|
|
118
|
-
for (const col of
|
|
123
|
+
for (const col of databaseTableColumns(databasePreferences)) {
|
|
119
124
|
const { showWhen, ...colParams } = col;
|
|
120
|
-
if (databasePreferences
|
|
125
|
+
if (lodashGet(databasePreferences, showWhen, false)) {
|
|
121
126
|
addCustomColumn(columns, colParams);
|
|
122
127
|
}
|
|
123
128
|
}
|
|
@@ -6,11 +6,9 @@ export default class ColumnsHelper {
|
|
|
6
6
|
this.defaultPreference = defaultPreference;
|
|
7
7
|
}
|
|
8
8
|
checkPreferences(preferencesToCheck, key) {
|
|
9
|
-
const val = preferencesToCheck === undefined ||
|
|
9
|
+
const val = !!(preferencesToCheck === undefined ||
|
|
10
10
|
Object.keys(preferencesToCheck).length === 0 ||
|
|
11
|
-
(preferencesToCheck && preferencesToCheck[key] === true)
|
|
12
|
-
? true
|
|
13
|
-
: false;
|
|
11
|
+
(preferencesToCheck && preferencesToCheck[key] === true));
|
|
14
12
|
return val;
|
|
15
13
|
}
|
|
16
14
|
setCustomColumn(array, index, columnLabel, cellHandler) {
|
|
@@ -35,9 +35,7 @@ const styles = css `
|
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
function DefaultPanelHeader({ counter, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', filterIsActive = false, counterFiltered = 0, children, onSettingClick = () => null, showSettingButton = false, canDelete = true, style = {}, className = '', }) {
|
|
38
|
-
return (_jsxs("div", { css: styles, ...{ style, className }, children: [_jsxs("div", { className: "left-container", children: [canDelete && (_jsx(ToolTip, { title: deleteToolTip, popupPlacement: "right", children: _jsx("button", { type: "button", onClick: onDelete, disabled: counter === 0, children: _jsx(FaRegTrashAlt, {}) }) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, defaultValue: filterIsActive, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), counter !== undefined && (_jsxs("p", { className: "counter-label", children: ["[", ' ', filterIsActive &&
|
|
39
|
-
filterIsActive === true &&
|
|
40
|
-
counterFiltered !== undefined
|
|
38
|
+
return (_jsxs("div", { css: styles, ...{ style, className }, children: [_jsxs("div", { className: "left-container", children: [canDelete && (_jsx(ToolTip, { title: deleteToolTip, popupPlacement: "right", children: _jsx("button", { type: "button", onClick: onDelete, disabled: counter === 0, children: _jsx(FaRegTrashAlt, {}) }) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, defaultValue: filterIsActive, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), counter !== undefined && (_jsxs("p", { className: "counter-label", children: ["[", ' ', filterIsActive && counterFiltered !== undefined
|
|
41
39
|
? `${counterFiltered}/${counter}`
|
|
42
40
|
: counter, ' ', "]"] })), showSettingButton && (_jsx(ToolTip, { title: "preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onSettingClick, children: _jsx(FaCog, {}) }) }))] }));
|
|
43
41
|
}
|
|
@@ -23,7 +23,7 @@ export function SpectraAutomaticPickingButton() {
|
|
|
23
23
|
})();
|
|
24
24
|
}, [dispatch, alert]);
|
|
25
25
|
if ((Array.isArray(data) && data.length === 0) ||
|
|
26
|
-
!isToolVisible('
|
|
26
|
+
!isToolVisible('rangePickingTool')) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
return (_jsx(Button, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: _jsx(SvgNmrRangePicking, {}) }));
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { CorrelationData } from 'nmr-correlation';
|
|
3
3
|
import { SpectraAnalysis } from '../../data/data1d/MultipleAnalysis';
|
|
4
4
|
import { Molecule } from '../../data/molecules/Molecule';
|
|
5
|
-
import { Range } from '../../data/types/data1d';
|
|
6
5
|
import { Contours } from '../../data/types/data2d/Contours';
|
|
7
6
|
import { UsedColors } from '../../types/UsedColors';
|
|
8
7
|
import { Spectra } from '../NMRium';
|
|
@@ -201,7 +200,10 @@ export interface State {
|
|
|
201
200
|
/**
|
|
202
201
|
* list of zones for Baseline correction filter
|
|
203
202
|
*/
|
|
204
|
-
|
|
203
|
+
baselineCorrection: {
|
|
204
|
+
zones: any[];
|
|
205
|
+
options: any;
|
|
206
|
+
};
|
|
205
207
|
/**
|
|
206
208
|
* pivot point for manual phase correction
|
|
207
209
|
* @default {value:0,index:0}
|
|
@@ -220,10 +222,6 @@ export interface State {
|
|
|
220
222
|
* @default null
|
|
221
223
|
*/
|
|
222
224
|
activeFilterID: string | null;
|
|
223
|
-
/**
|
|
224
|
-
* copy of the range that the user start editing for multiplicity tree live updating
|
|
225
|
-
*/
|
|
226
|
-
tempRange: Range | null;
|
|
227
225
|
/**
|
|
228
226
|
* boolean indicator to hide/show multiplicity tree
|
|
229
227
|
* @default false
|
|
@@ -1016,72 +1014,16 @@ export declare const spectrumReducer: (base: {
|
|
|
1016
1014
|
readonly selectedTool: string;
|
|
1017
1015
|
readonly selectedOptionPanel: string | null;
|
|
1018
1016
|
readonly data: {
|
|
1019
|
-
readonly
|
|
1017
|
+
readonly baselineCorrection: {
|
|
1018
|
+
readonly zones: readonly any[];
|
|
1019
|
+
readonly options: any;
|
|
1020
|
+
};
|
|
1020
1021
|
readonly pivot: {
|
|
1021
1022
|
readonly value: number;
|
|
1022
1023
|
readonly index: number;
|
|
1023
1024
|
};
|
|
1024
1025
|
readonly zonesNoiseFactor: number;
|
|
1025
1026
|
readonly activeFilterID: string | null;
|
|
1026
|
-
readonly tempRange: {
|
|
1027
|
-
readonly id: string;
|
|
1028
|
-
readonly originFrom?: number | undefined;
|
|
1029
|
-
readonly originTo?: number | undefined;
|
|
1030
|
-
readonly absolute: number;
|
|
1031
|
-
readonly signals: readonly {
|
|
1032
|
-
readonly id: string;
|
|
1033
|
-
readonly originDelta?: number | undefined;
|
|
1034
|
-
readonly peaks?: readonly {
|
|
1035
|
-
readonly kind?: string | undefined;
|
|
1036
|
-
readonly shape?: {
|
|
1037
|
-
readonly kind: "gaussian";
|
|
1038
|
-
readonly fwhm?: number | undefined;
|
|
1039
|
-
readonly sd?: number | undefined;
|
|
1040
|
-
} | {
|
|
1041
|
-
readonly kind: "lorentzian";
|
|
1042
|
-
readonly fwhm?: number | undefined;
|
|
1043
|
-
} | {
|
|
1044
|
-
readonly kind: "pseudoVoigt";
|
|
1045
|
-
readonly fwhm?: number | undefined;
|
|
1046
|
-
readonly mu?: number | undefined;
|
|
1047
|
-
} | undefined;
|
|
1048
|
-
readonly x: number;
|
|
1049
|
-
readonly y: number;
|
|
1050
|
-
readonly width: number;
|
|
1051
|
-
}[] | undefined;
|
|
1052
|
-
readonly kind?: string | undefined;
|
|
1053
|
-
readonly delta: number;
|
|
1054
|
-
readonly js?: readonly {
|
|
1055
|
-
readonly coupling: number;
|
|
1056
|
-
readonly atoms?: readonly number[] | undefined;
|
|
1057
|
-
readonly assignment?: string | readonly string[] | undefined;
|
|
1058
|
-
readonly diaIDs?: readonly string[] | undefined;
|
|
1059
|
-
readonly multiplicity?: string | undefined;
|
|
1060
|
-
readonly pathLength?: number | undefined;
|
|
1061
|
-
}[] | undefined;
|
|
1062
|
-
readonly atoms?: readonly number[] | undefined;
|
|
1063
|
-
readonly assignment?: string | undefined;
|
|
1064
|
-
readonly multiplicity?: string | undefined;
|
|
1065
|
-
readonly diaIDs?: readonly string[] | undefined;
|
|
1066
|
-
readonly nbAtoms?: number | undefined;
|
|
1067
|
-
readonly integration?: number | undefined;
|
|
1068
|
-
readonly statistic?: {
|
|
1069
|
-
readonly mean: number;
|
|
1070
|
-
readonly sd: number;
|
|
1071
|
-
readonly min: number;
|
|
1072
|
-
readonly max: number;
|
|
1073
|
-
readonly nb: number;
|
|
1074
|
-
} | undefined;
|
|
1075
|
-
}[];
|
|
1076
|
-
readonly integration: number;
|
|
1077
|
-
readonly nbAtoms?: number | undefined;
|
|
1078
|
-
readonly from: number;
|
|
1079
|
-
readonly to: number;
|
|
1080
|
-
readonly kind?: string | undefined;
|
|
1081
|
-
readonly multiplicity?: string | undefined;
|
|
1082
|
-
readonly diaIDs?: readonly string[] | undefined;
|
|
1083
|
-
readonly pubIntegral?: number | undefined;
|
|
1084
|
-
} | null;
|
|
1085
1027
|
readonly showMultiplicityTrees: boolean;
|
|
1086
1028
|
readonly showRangesIntegrals: boolean;
|
|
1087
1029
|
readonly showJGraph: boolean;
|
|
@@ -83,11 +83,13 @@ export const getInitialState = () => ({
|
|
|
83
83
|
selectedTool: options.zoom.id,
|
|
84
84
|
selectedOptionPanel: null,
|
|
85
85
|
data: {
|
|
86
|
-
|
|
86
|
+
baselineCorrection: {
|
|
87
|
+
options: {},
|
|
88
|
+
zones: [],
|
|
89
|
+
},
|
|
87
90
|
pivot: { value: 0, index: 0 },
|
|
88
91
|
zonesNoiseFactor: 1,
|
|
89
92
|
activeFilterID: null,
|
|
90
|
-
tempRange: null,
|
|
91
93
|
showMultiplicityTrees: false,
|
|
92
94
|
showRangesIntegrals: true,
|
|
93
95
|
showJGraph: false,
|
|
@@ -252,6 +254,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
252
254
|
return FiltersActions.handleAddExclusionZone(draft, action);
|
|
253
255
|
case types.DELETE_EXCLUSION_ZONE:
|
|
254
256
|
return FiltersActions.handleDeleteExclusionZone(draft, action);
|
|
257
|
+
case types.APPLY_BASE_LINE_CORRECTION_FILTER:
|
|
258
|
+
return FiltersActions.handleBaseLineCorrectionFilter(draft, action);
|
|
259
|
+
case types.CALCULATE_BASE_LINE_CORRECTION_FILTER:
|
|
260
|
+
return FiltersActions.calculateBaseLineCorrection(draft, action);
|
|
255
261
|
case types.CHANGE_VISIBILITY:
|
|
256
262
|
return SpectrumsActions.handleSpectrumVisibility(draft, action);
|
|
257
263
|
case types.CHANGE_PEAKS_MARKERS_VISIBILITY:
|
|
@@ -340,8 +346,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
340
346
|
return RangesActions.handleUnlinkRange(draft, action);
|
|
341
347
|
case types.SET_DIAID_RANGE:
|
|
342
348
|
return RangesActions.handleSetDiaIDRange(draft, action);
|
|
343
|
-
case types.
|
|
344
|
-
return RangesActions.
|
|
349
|
+
case types.UPDATE_RANGE:
|
|
350
|
+
return RangesActions.handleUpdateRange(draft, action);
|
|
345
351
|
case types.SHOW_MULTIPLICTY_TREES:
|
|
346
352
|
return RangesActions.handleShowMultiplicityTrees(draft);
|
|
347
353
|
case types.SHOW_RANGES_INTEGRALS:
|
|
@@ -356,8 +362,6 @@ function innerSpectrumReducer(draft, action) {
|
|
|
356
362
|
return ToolsActions.handleAddBaseLineZone(draft, action.zone);
|
|
357
363
|
case types.DELETE_BASE_LINE_ZONE:
|
|
358
364
|
return ToolsActions.handleDeleteBaseLineZone(draft, action.id);
|
|
359
|
-
case types.APPLY_BASE_LINE_CORRECTION_FILTER:
|
|
360
|
-
return FiltersActions.handleBaseLineCorrectionFilter(draft, action);
|
|
361
365
|
case types.SET_KEY_PREFERENCES:
|
|
362
366
|
return setKeyPreferencesHandler(draft, action.keyCode);
|
|
363
367
|
case types.APPLY_KEY_PREFERENCES:
|
|
@@ -397,7 +401,9 @@ function innerSpectrumReducer(draft, action) {
|
|
|
397
401
|
case types.FILTER_SPECTRA_COLUMN:
|
|
398
402
|
return SpectraAnalysisActions.handleFilterColumn(draft, action);
|
|
399
403
|
case types.RESURRECTING_SPECTRUM_FROM_RANGES:
|
|
400
|
-
return DatabaseActions.
|
|
404
|
+
return DatabaseActions.handleResurrectSpectrumFromRanges(draft, action);
|
|
405
|
+
case types.RESURRECTING_SPECTRUM_FROM_JCAMP:
|
|
406
|
+
return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
|
|
401
407
|
case types.SET_AUTOMATIC_ASSIGNMENTS:
|
|
402
408
|
return AssignmentsActions.setAutomaticAssignmentsHandler(draft, action);
|
|
403
409
|
case UNDO:
|
|
@@ -409,7 +415,6 @@ function innerSpectrumReducer(draft, action) {
|
|
|
409
415
|
case types.SET_MOUSE_OVER_DISPLAYER:
|
|
410
416
|
return GlobalActions.setIsOverDisplayer(draft, action);
|
|
411
417
|
default:
|
|
412
|
-
return;
|
|
413
418
|
}
|
|
414
419
|
}
|
|
415
420
|
export const spectrumReducer = produce(innerSpectrumReducer);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
2
|
import { State } from '../Reducer';
|
|
3
|
-
declare function
|
|
4
|
-
|
|
3
|
+
declare function handleResurrectSpectrumFromJcamp(draft: Draft<State>, action: any): void;
|
|
4
|
+
declare function handleResurrectSpectrumFromRanges(draft: Draft<State>, action: any): void;
|
|
5
|
+
export { handleResurrectSpectrumFromRanges, handleResurrectSpectrumFromJcamp };
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
+
import { addJcamp } from '../../../data/SpectraManager';
|
|
2
|
+
import { mapRanges } from '../../../data/data1d/Spectrum1D';
|
|
1
3
|
import { generateSpectrumFromRanges } from '../../../data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges';
|
|
2
4
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
3
|
-
import { setDomain } from './DomainActions';
|
|
4
|
-
function
|
|
5
|
+
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
6
|
+
function handleResurrectSpectrumFromJcamp(draft, action) {
|
|
7
|
+
const { ranges, file, jcampURL } = action.payload;
|
|
8
|
+
let spectra = [];
|
|
9
|
+
addJcamp(spectra, file, {
|
|
10
|
+
source: {
|
|
11
|
+
jcampURL,
|
|
12
|
+
},
|
|
13
|
+
}, draft.usedColors);
|
|
14
|
+
const spectrum = spectra[0];
|
|
15
|
+
spectrum.ranges.values = mapRanges(ranges, spectrum);
|
|
16
|
+
draft.data.push(spectrum);
|
|
17
|
+
setDomain(draft);
|
|
18
|
+
setIntegralsYDomain(draft, [spectrum]);
|
|
19
|
+
setZoom(draft, { scale: 0.8, spectrumID: spectrum.id });
|
|
20
|
+
}
|
|
21
|
+
function handleResurrectSpectrumFromRanges(draft, action) {
|
|
5
22
|
const { ranges, info } = action.payload;
|
|
6
23
|
const datum = generateSpectrumFromRanges(ranges, info, draft.usedColors);
|
|
7
24
|
draft.data.push(datum);
|
|
8
25
|
setDomain(draft, { yDomain: { isShared: false } });
|
|
26
|
+
setIntegralsYDomain(draft, [datum]);
|
|
9
27
|
setZoom(draft, { scale: 0.8, spectrumID: datum.id });
|
|
10
28
|
}
|
|
11
|
-
export {
|
|
29
|
+
export { handleResurrectSpectrumFromRanges, handleResurrectSpectrumFromJcamp };
|
|
@@ -6,6 +6,7 @@ declare function applyFFTFilter(draft: Draft<State>): void;
|
|
|
6
6
|
declare function applyManualPhaseCorrectionFilter(draft: Draft<State>, filterOptions: any): void;
|
|
7
7
|
declare function applyAbsoluteFilter(draft: Draft<State>): void;
|
|
8
8
|
declare function applyAutoPhaseCorrectionFilter(draft: Draft<State>): void;
|
|
9
|
+
declare function calculateBaseLineCorrection(draft: Draft<State>, action?: any): void;
|
|
9
10
|
declare function calculateManualPhaseCorrection(draft: Draft<State>, filterOptions: any): void;
|
|
10
11
|
declare function enableFilter(draft: Draft<State>, filterID: any, checked: any): void;
|
|
11
12
|
declare function deleteFilter(draft: Draft<State>, actions: any): void;
|
|
@@ -31,4 +32,4 @@ declare function filterSnapshotHandler(draft: Draft<State>, action: any): void;
|
|
|
31
32
|
declare function handleMultipleSpectraFilter(draft: Draft<State>, action: any): void;
|
|
32
33
|
declare function handleAddExclusionZone(draft: Draft<State>, action: any): void;
|
|
33
34
|
declare function handleDeleteExclusionZone(draft: Draft<State>, action: any): void;
|
|
34
|
-
export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
35
|
+
export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
@@ -3,6 +3,7 @@ import * as Filters from '../../../data/Filters';
|
|
|
3
3
|
import * as FiltersManager from '../../../data/FiltersManager';
|
|
4
4
|
import { updateXShift } from '../../../data/data1d/Spectrum1D';
|
|
5
5
|
import { apply as autoPhaseCorrection } from '../../../data/data1d/filter1d/autoPhaseCorrection';
|
|
6
|
+
import { apply as baselineCorrection } from '../../../data/data1d/filter1d/baselineCorrection';
|
|
6
7
|
import { apply as phaseCorrection } from '../../../data/data1d/filter1d/phaseCorrection';
|
|
7
8
|
import { updateShift as update2dShift } from '../../../data/data2d/Spectrum2D';
|
|
8
9
|
import generateID from '../../../data/utilities/generateID';
|
|
@@ -89,12 +90,32 @@ function applyAutoPhaseCorrectionFilter(draft) {
|
|
|
89
90
|
setDomain(draft);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
93
|
+
function calculateBaseLineCorrection(draft, action) {
|
|
94
|
+
if (draft.activeSpectrum) {
|
|
95
|
+
const { index } = draft.activeSpectrum;
|
|
96
|
+
const { data: { x, re, im }, info, } = draft.data[index];
|
|
97
|
+
// save the baseline options temporary
|
|
98
|
+
draft.toolOptions.data.baselineCorrection = {
|
|
99
|
+
...draft.toolOptions.data.baselineCorrection,
|
|
100
|
+
...(action?.options ? { options: action.options } : {}),
|
|
101
|
+
};
|
|
102
|
+
const { zones, options } = draft.toolOptions.data.baselineCorrection;
|
|
103
|
+
let _data = { data: { x, re, im }, info };
|
|
104
|
+
baselineCorrection(_data, {
|
|
105
|
+
zones,
|
|
106
|
+
...options,
|
|
107
|
+
});
|
|
108
|
+
const { im: newIm, re: newRe } = _data.data;
|
|
109
|
+
draft.tempData[index].data.im = newIm;
|
|
110
|
+
draft.tempData[index].data.re = newRe;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
92
113
|
function calculateManualPhaseCorrection(draft, filterOptions) {
|
|
93
114
|
if (draft.activeSpectrum) {
|
|
94
115
|
const { index } = draft.activeSpectrum;
|
|
95
116
|
const { data: { x, re, im }, info, } = draft.data[index];
|
|
96
117
|
const { ph0, ph1 } = filterOptions;
|
|
97
|
-
let _data = { data: { x
|
|
118
|
+
let _data = { data: { x, re, im }, info };
|
|
98
119
|
phaseCorrection(_data, { ph0, ph1 });
|
|
99
120
|
const { im: newIm, re: newRe } = _data.data;
|
|
100
121
|
draft.tempData[index].data.im = newIm;
|
|
@@ -165,16 +186,16 @@ function deleteSpectraFilter(draft, actions) {
|
|
|
165
186
|
function handleBaseLineCorrectionFilter(draft, action) {
|
|
166
187
|
if (draft.activeSpectrum?.id) {
|
|
167
188
|
const { index } = draft.activeSpectrum;
|
|
189
|
+
const { zones } = draft.toolOptions.data.baselineCorrection;
|
|
168
190
|
FiltersManager.applyFilter(draft.data[index], [
|
|
169
191
|
{
|
|
170
192
|
name: Filters.baselineCorrection.id,
|
|
171
193
|
options: {
|
|
172
|
-
zones
|
|
194
|
+
zones,
|
|
173
195
|
...action.options,
|
|
174
196
|
},
|
|
175
197
|
},
|
|
176
198
|
]);
|
|
177
|
-
draft.toolOptions.data.baseLineZones = [];
|
|
178
199
|
const xDomainSnapshot = draft.xDomain.slice();
|
|
179
200
|
resetSelectedTool(draft);
|
|
180
201
|
setDomain(draft);
|
|
@@ -306,4 +327,4 @@ function handleDeleteExclusionZone(draft, action) {
|
|
|
306
327
|
}
|
|
307
328
|
}
|
|
308
329
|
}
|
|
309
|
-
export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
330
|
+
export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
-
import
|
|
2
|
+
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
3
3
|
import nucleusToString from '../../utility/nucleusToString';
|
|
4
4
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from '../core/Constants';
|
|
5
5
|
import { setDomain } from './DomainActions';
|
|
6
6
|
function changeSpectrumVerticalAlignment(draft, options) {
|
|
7
|
+
function stack(spectra = []) {
|
|
8
|
+
if (spectra.length > 1) {
|
|
9
|
+
draft.verticalAlign.align = 'stack';
|
|
10
|
+
const visibleSpectra = spectra.filter((datum) => datum.display.isVisible);
|
|
11
|
+
draft.verticalAlign.verticalShift = Math.abs(Math.floor((draft.height - draft.margin.bottom) / (visibleSpectra.length + 2)));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function center() {
|
|
15
|
+
const YAxisShift = draft.height / 2;
|
|
16
|
+
draft.verticalAlign.align = 'center';
|
|
17
|
+
draft.verticalAlign.verticalShift = YAxisShift;
|
|
18
|
+
}
|
|
19
|
+
function bottom() {
|
|
20
|
+
draft.verticalAlign.align = 'bottom';
|
|
21
|
+
draft.verticalAlign.verticalShift = DEFAULT_YAXIS_SHIFT_VALUE;
|
|
22
|
+
}
|
|
7
23
|
if (draft.data && draft.data.length > 0) {
|
|
8
24
|
let dataPerNucleus = [];
|
|
9
25
|
if (['auto-check', 'stack'].includes(options.align || '')) {
|
|
@@ -12,38 +28,34 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
12
28
|
: draft.activeTab && datum.info.dimension === 1);
|
|
13
29
|
}
|
|
14
30
|
switch (options.align) {
|
|
15
|
-
case 'auto-check':
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
(
|
|
20
|
-
dataPerNucleus[0]?.info.isFid &&
|
|
21
|
-
!dataPerNucleus.some((d) => d.info.isFid === false))) {
|
|
22
|
-
const YAxisShift = draft.height / 2;
|
|
23
|
-
draft.verticalAlign.align = 'center';
|
|
24
|
-
draft.verticalAlign.verticalShift = YAxisShift;
|
|
31
|
+
case 'auto-check': {
|
|
32
|
+
const isFid = dataPerNucleus[0]?.info.isFid &&
|
|
33
|
+
!dataPerNucleus.some((d) => !d.info.isFid);
|
|
34
|
+
if (isFid) {
|
|
35
|
+
center();
|
|
25
36
|
}
|
|
26
|
-
else {
|
|
27
|
-
|
|
28
|
-
draft.verticalAlign.verticalShift = DEFAULT_YAXIS_SHIFT_VALUE;
|
|
37
|
+
else if (dataPerNucleus.length > 1) {
|
|
38
|
+
stack(dataPerNucleus);
|
|
29
39
|
}
|
|
30
40
|
break;
|
|
31
41
|
}
|
|
42
|
+
case 'bottom': {
|
|
43
|
+
return bottom();
|
|
44
|
+
}
|
|
45
|
+
case 'center': {
|
|
46
|
+
return center();
|
|
47
|
+
}
|
|
32
48
|
case 'stack': {
|
|
33
|
-
|
|
34
|
-
const visibleSpectra = dataPerNucleus.filter((datum) => datum.display.isVisible === true);
|
|
35
|
-
draft.verticalAlign.verticalShift = Math.abs(Math.floor((draft.height - draft.margin.bottom) / (visibleSpectra.length + 2)));
|
|
36
|
-
break;
|
|
49
|
+
return stack(dataPerNucleus);
|
|
37
50
|
}
|
|
38
51
|
default:
|
|
39
|
-
return;
|
|
40
52
|
}
|
|
41
53
|
}
|
|
42
54
|
}
|
|
43
55
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
44
56
|
const { activeTab, data, activeSpectrum, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, tabActiveSpectrum, } = draft;
|
|
45
57
|
if (activeTab) {
|
|
46
|
-
const groupByNucleus =
|
|
58
|
+
const groupByNucleus = groupByInfoKey('nucleus');
|
|
47
59
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
48
60
|
const level = displayerMode === DISPLAYER_MODE.DM_2D
|
|
49
61
|
? spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
@@ -14,8 +14,8 @@ declare function handleAddRange(draft: Draft<State>, action: any): void;
|
|
|
14
14
|
declare function handleChangeRangeRelativeValue(draft: any, action: any): void;
|
|
15
15
|
declare function handleChangeRangeSignalValue(draft: any, action: any): void;
|
|
16
16
|
declare function handleChangeRangesSumFlag(draft: any, action: any): void;
|
|
17
|
-
declare function
|
|
17
|
+
declare function handleUpdateRange(draft: Draft<State>, action: any): void;
|
|
18
18
|
declare function handleShowMultiplicityTrees(draft: Draft<State>): void;
|
|
19
19
|
declare function handleShowRangesIntegrals(draft: Draft<State>): void;
|
|
20
20
|
declare function handleShowJGraph(draft: Draft<State>): void;
|
|
21
|
-
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag,
|
|
21
|
+
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
|
|
@@ -7,9 +7,11 @@ import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/Signal
|
|
|
7
7
|
import { addRange, changeRangeSignal, detectRanges, updateRangesRelativeValues, changeRange, changeRangeRelativeValue, updateXShift, } from '../../../data/data1d/Spectrum1D';
|
|
8
8
|
import { setSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
9
9
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
10
|
+
import generateID from '../../../data/utilities/generateID';
|
|
10
11
|
import getRange from '../helper/getRange';
|
|
11
12
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
12
13
|
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
14
|
+
import { resetSelectedTool } from './ToolsActions';
|
|
13
15
|
function handleAutoRangesDetection(draft, options) {
|
|
14
16
|
const { activeSpectrum, data, xDomain, molecules, activeTab: nucleus, } = draft;
|
|
15
17
|
if (activeSpectrum?.id) {
|
|
@@ -62,7 +64,8 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
|
|
|
62
64
|
function handleDeleteRange(draft, action) {
|
|
63
65
|
if (draft.activeSpectrum?.id) {
|
|
64
66
|
const { index } = draft.activeSpectrum;
|
|
65
|
-
const {
|
|
67
|
+
const { data, resetSelectTool = false } = action.payload;
|
|
68
|
+
const { id = null, assignmentData } = data;
|
|
66
69
|
const datum = draft.data[index];
|
|
67
70
|
if (id) {
|
|
68
71
|
const rangeIndex = getRangeIndex(draft, index, id);
|
|
@@ -75,6 +78,9 @@ function handleDeleteRange(draft, action) {
|
|
|
75
78
|
}
|
|
76
79
|
updateRangesRelativeValues(datum);
|
|
77
80
|
handleOnChangeRangesData(draft);
|
|
81
|
+
if (resetSelectTool) {
|
|
82
|
+
resetSelectedTool(draft);
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
86
|
function handleChangeRangeSignalKind(draft, action) {
|
|
@@ -99,8 +105,6 @@ function handleSaveEditedRange(draft, action) {
|
|
|
99
105
|
if (state.activeSpectrum?.id) {
|
|
100
106
|
const { index } = state.activeSpectrum;
|
|
101
107
|
const { editedRowData, assignmentData } = action.payload;
|
|
102
|
-
// reset temp range
|
|
103
|
-
draft.toolOptions.data.tempRange = null;
|
|
104
108
|
// remove assignments in global state
|
|
105
109
|
const _editedRowData = unlink(editedRowData);
|
|
106
110
|
delete _editedRowData.tableMetaInfo;
|
|
@@ -109,9 +113,13 @@ function handleSaveEditedRange(draft, action) {
|
|
|
109
113
|
// for now: clear all assignments for this range because signals or levels to store might have changed
|
|
110
114
|
unlinkInAssignmentData(assignmentData, [_editedRowData]);
|
|
111
115
|
const rangeIndex = getRangeIndex(state, index, _editedRowData.id);
|
|
112
|
-
|
|
116
|
+
if (_editedRowData.id === 'new') {
|
|
117
|
+
_editedRowData.id = generateID();
|
|
118
|
+
}
|
|
119
|
+
draft.data[index].ranges.values.splice(rangeIndex, 1, _editedRowData);
|
|
113
120
|
updateRangesRelativeValues(draft.data[index]);
|
|
114
121
|
handleOnChangeRangesData(draft);
|
|
122
|
+
resetSelectedTool(draft);
|
|
115
123
|
}
|
|
116
124
|
}
|
|
117
125
|
function handleDeleteSignal(draft, action) {
|
|
@@ -202,18 +210,36 @@ function handleChangeRangeSum(draft, options) {
|
|
|
202
210
|
updateRangesRelativeValues(datum, true);
|
|
203
211
|
}
|
|
204
212
|
}
|
|
205
|
-
function
|
|
206
|
-
const { startX, endX } =
|
|
207
|
-
const { activeSpectrum, activeTab: nucleus, molecules } = draft;
|
|
213
|
+
function addNewRange(draft, props) {
|
|
214
|
+
const { startX, endX, id } = props;
|
|
208
215
|
const range = getRange(draft, { startX, endX });
|
|
216
|
+
const { activeSpectrum, activeTab: nucleus, molecules } = draft;
|
|
209
217
|
if (activeSpectrum?.id) {
|
|
210
218
|
const { index } = activeSpectrum;
|
|
211
219
|
const [from, to] = range;
|
|
212
|
-
addRange(draft.data[index], {
|
|
220
|
+
addRange(draft.data[index], {
|
|
221
|
+
from,
|
|
222
|
+
to,
|
|
223
|
+
id,
|
|
224
|
+
nucleus,
|
|
225
|
+
molecules,
|
|
226
|
+
});
|
|
213
227
|
handleOnChangeRangesData(draft);
|
|
214
228
|
setIntegralsYDomain(draft, draft.data[index]);
|
|
215
229
|
}
|
|
216
230
|
}
|
|
231
|
+
function handleAddRange(draft, action) {
|
|
232
|
+
const { startX, endX, id } = action.payload;
|
|
233
|
+
if (id === 'new') {
|
|
234
|
+
const { width } = draft;
|
|
235
|
+
const startX = width / 3;
|
|
236
|
+
const endX = startX + 10;
|
|
237
|
+
addNewRange(draft, { startX, endX, id: 'new' });
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
addNewRange(draft, { startX, endX });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
217
243
|
function handleChangeRangeRelativeValue(draft, action) {
|
|
218
244
|
const data = action.payload.data;
|
|
219
245
|
if (draft.activeSpectrum?.id) {
|
|
@@ -248,8 +274,16 @@ function handleChangeRangesSumFlag(draft, action) {
|
|
|
248
274
|
draft.data[index].ranges.options.isSumConstant = !flag;
|
|
249
275
|
}
|
|
250
276
|
}
|
|
251
|
-
function
|
|
252
|
-
|
|
277
|
+
function handleUpdateRange(draft, action) {
|
|
278
|
+
const { range, resetSelectTool = false } = action.payload;
|
|
279
|
+
if (draft.activeSpectrum?.id && range.id) {
|
|
280
|
+
const datum = draft.data[draft.activeSpectrum?.index];
|
|
281
|
+
const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
|
|
282
|
+
datum.ranges.values[index] = range;
|
|
283
|
+
}
|
|
284
|
+
if (resetSelectTool) {
|
|
285
|
+
resetSelectedTool(draft);
|
|
286
|
+
}
|
|
253
287
|
}
|
|
254
288
|
function handleShowMultiplicityTrees(draft) {
|
|
255
289
|
draft.toolOptions.data.showMultiplicityTrees =
|
|
@@ -262,4 +296,4 @@ function handleShowRangesIntegrals(draft) {
|
|
|
262
296
|
function handleShowJGraph(draft) {
|
|
263
297
|
draft.toolOptions.data.showJGraph = !draft.toolOptions.data.showJGraph;
|
|
264
298
|
}
|
|
265
|
-
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag,
|
|
299
|
+
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
|