nmrium 0.42.0 → 0.43.1-pre.1692874523
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/ApodizationLine.js +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/Viewer2D.js +1 -3
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +48 -8
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +3 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/CounterLabel.d.ts +7 -0
- package/lib/component/elements/CounterLabel.js +12 -0
- package/lib/component/elements/EditableColumn.js +12 -6
- package/lib/component/elements/Input.d.ts +3 -12
- package/lib/component/elements/Input.js +24 -76
- package/lib/component/elements/Message.js +0 -1
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/PreferencesButton.d.ts +4 -0
- package/lib/component/elements/PreferencesButton.js +6 -0
- package/lib/component/elements/formik/FormikInput.d.ts +2 -2
- package/lib/component/elements/formik/FormikInput.js +3 -6
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +6 -6
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +88 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/AlignSpectraModal.js +78 -29
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
- package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
- package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +5 -1
- package/lib/component/panels/InformationPanel.js +9 -100
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +13 -9
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
- package/lib/component/panels/Panels.js +6 -7
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -6
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +11 -13
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -3
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +3 -8
- package/lib/component/reducer/Reducer.js +34 -8
- package/lib/component/reducer/actions/DomainActions.js +2 -3
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.js +4 -4
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/actions/ToolsActions.js +10 -10
- package/lib/component/reducer/core/Constants.d.ts +0 -4
- package/lib/component/reducer/core/Constants.js +0 -5
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +3 -2
- package/lib/component/toolbar/ToolTypes.js +57 -22
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/constants/References.d.ts +5 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +1 -3
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +47 -7
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/CounterLabel.js +16 -0
- package/lib-cjs/component/elements/EditableColumn.js +12 -6
- package/lib-cjs/component/elements/Input.js +23 -75
- package/lib-cjs/component/elements/Message.js +0 -1
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/PreferencesButton.js +13 -0
- package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +6 -6
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +95 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
- package/lib-cjs/component/panels/InformationPanel.js +7 -98
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
- package/lib-cjs/component/panels/Panels.js +6 -7
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +29 -6
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +12 -12
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -3
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -1
- package/lib-cjs/component/reducer/Reducer.js +33 -7
- package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +3 -3
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
- package/lib-cjs/component/reducer/core/Constants.js +1 -6
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +57 -22
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
- /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
const WrongP = styled.p `
|
|
4
|
+
background-color: white;
|
|
5
|
+
padding: 20px;
|
|
6
|
+
border-radius: 10px;
|
|
7
|
+
font-size: 30px;
|
|
8
|
+
text-align: center;
|
|
9
|
+
`;
|
|
10
|
+
const Details = styled.details `
|
|
11
|
+
margin-top: 10px;
|
|
12
|
+
white-space: pre-wrap;
|
|
13
|
+
background-color: white;
|
|
14
|
+
padding: 20px;
|
|
15
|
+
border-radius: 10px;
|
|
16
|
+
color: red;
|
|
17
|
+
`;
|
|
18
|
+
export default function ErrorOverlay(props) {
|
|
19
|
+
return (_jsxs("div", { style: { margin: 25 }, children: [_jsx(WrongP, { children: "Something went wrong." }), _jsxs(Details, { children: [_jsx("p", { style: { textDecoration: 'underline' }, children: props.error.message }), props.error.stack] })] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ForwardedRef } from 'react';
|
|
2
|
+
import type { NMRiumProps, NMRiumRef } from './NMRium';
|
|
3
|
+
type InnerNMRiumProps = Omit<NMRiumProps, 'onError'> & {
|
|
4
|
+
innerRef: ForwardedRef<NMRiumRef>;
|
|
5
|
+
};
|
|
6
|
+
export declare function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, preferences, getSpinner, onChange, emptyText, innerRef, }: InnerNMRiumProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useReducer, useRef, useImperativeHandle, } from 'react';
|
|
3
|
+
import { useOnOff } from 'react-science/ui';
|
|
4
|
+
import { useFullscreen } from 'react-use';
|
|
5
|
+
import { AssignmentProvider } from '../assignment';
|
|
6
|
+
import { GlobalProvider } from '../context/GlobalContext';
|
|
7
|
+
import { KeyModifiersProvider } from '../context/KeyModifierContext';
|
|
8
|
+
import { LoggerProvider } from '../context/LoggerContext';
|
|
9
|
+
import { PreferencesProvider } from '../context/PreferencesContext';
|
|
10
|
+
import { AlertProvider } from '../elements/popup/Alert';
|
|
11
|
+
import { ModalProvider } from '../elements/popup/Modal';
|
|
12
|
+
import { HighlightProvider } from '../highlight';
|
|
13
|
+
import { defaultGetSpinner, SpinnerProvider } from '../loader/SpinnerContext';
|
|
14
|
+
import preferencesReducer, { preferencesInitialState, initPreferencesState, } from '../reducer/preferences/preferencesReducer';
|
|
15
|
+
import { getBlob } from '../utility/export';
|
|
16
|
+
import { InnerNMRiumContents } from './InnerNMRiumContents';
|
|
17
|
+
import NMRiumStateProvider from './NMRiumStateProvider';
|
|
18
|
+
export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, preferences, getSpinner = defaultGetSpinner, onChange, emptyText, innerRef, }) {
|
|
19
|
+
const rootRef = useRef(null);
|
|
20
|
+
const elementsWrapperRef = useRef(null);
|
|
21
|
+
const viewerRef = useRef(null);
|
|
22
|
+
const [enableFullscreen, , disableFullscreen, toggleFullscreen] = useOnOff(false);
|
|
23
|
+
const mainDivRef = useRef(null);
|
|
24
|
+
const isFullscreenEnabled = useFullscreen(rootRef, enableFullscreen, {
|
|
25
|
+
onClose: disableFullscreen,
|
|
26
|
+
});
|
|
27
|
+
const [preferencesState, dispatchPreferences] = useReducer(preferencesReducer, preferencesInitialState, initPreferencesState);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
rootRef.current?.focus();
|
|
30
|
+
}, [isFullscreenEnabled]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
dispatchPreferences({
|
|
33
|
+
type: 'INIT_PREFERENCES',
|
|
34
|
+
payload: {
|
|
35
|
+
preferences,
|
|
36
|
+
workspace,
|
|
37
|
+
customWorkspaces,
|
|
38
|
+
dispatch: dispatchPreferences,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}, [customWorkspaces, preferences, workspace]);
|
|
42
|
+
useImperativeHandle(innerRef, () => ({
|
|
43
|
+
getSpectraViewerAsBlob: () => {
|
|
44
|
+
return rootRef?.current ? getBlob(rootRef.current, 'nmrSVG') : null;
|
|
45
|
+
},
|
|
46
|
+
}), []);
|
|
47
|
+
return (_jsx("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, children: _jsx(GlobalProvider, { value: {
|
|
48
|
+
rootRef: rootRef.current,
|
|
49
|
+
elementsWrapperRef: elementsWrapperRef.current,
|
|
50
|
+
viewerRef: viewerRef.current,
|
|
51
|
+
}, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { isFullscreenEnabled: isFullscreenEnabled, toggleFullscreen: toggleFullscreen, emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @jsxImportSource @emotion/react */
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
import { NMRiumProps } from '.';
|
|
4
|
+
interface InnerNMRiumContentsProps {
|
|
5
|
+
isFullscreenEnabled: boolean;
|
|
6
|
+
toggleFullscreen: () => void;
|
|
7
|
+
emptyText: NMRiumProps['emptyText'];
|
|
8
|
+
mainDivRef: RefObject<HTMLDivElement>;
|
|
9
|
+
elementsWrapperRef: RefObject<HTMLDivElement>;
|
|
10
|
+
rootRef: RefObject<HTMLDivElement>;
|
|
11
|
+
viewerRef: RefObject<HTMLDivElement>;
|
|
12
|
+
}
|
|
13
|
+
export declare function InnerNMRiumContents(props: InnerNMRiumContentsProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useCallback } from 'react';
|
|
5
|
+
import checkModifierKeyActivated from '../../data/utilities/checkModifierKeyActivated';
|
|
6
|
+
import Viewer1D from '../1d/Viewer1D';
|
|
7
|
+
import FloatMoleculeStructures from '../1d-2d/components/FloatMoleculeStructures';
|
|
8
|
+
import Viewer2D from '../2d/Viewer2D';
|
|
9
|
+
import KeysListenerTracker from '../EventsTrackers/KeysListenerTracker';
|
|
10
|
+
import { useChartData } from '../context/ChartContext';
|
|
11
|
+
import Header from '../header/Header';
|
|
12
|
+
import DropZone from '../loader/DropZone';
|
|
13
|
+
import Panels from '../panels/Panels';
|
|
14
|
+
import ToolBar from '../toolbar/ToolBar';
|
|
15
|
+
import { SplitPaneWrapper } from './SplitPaneWrapper';
|
|
16
|
+
import { StateError } from './StateError';
|
|
17
|
+
const viewerContainerStyle = css `
|
|
18
|
+
border: 0.55px #e6e6e6 solid;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex: 1;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
height: 100%;
|
|
23
|
+
margin-left: -1px;
|
|
24
|
+
`;
|
|
25
|
+
const containerStyles = css `
|
|
26
|
+
background-color: white;
|
|
27
|
+
width: 100%;
|
|
28
|
+
display: block;
|
|
29
|
+
height: 100%;
|
|
30
|
+
|
|
31
|
+
div:focus {
|
|
32
|
+
outline: none !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
button {
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
button,
|
|
40
|
+
button:active,
|
|
41
|
+
button:hover,
|
|
42
|
+
button:focus,
|
|
43
|
+
[type='button']:focus {
|
|
44
|
+
outline: none !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
button:disabled {
|
|
48
|
+
cursor: default;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
* {
|
|
52
|
+
-webkit-user-drag: none;
|
|
53
|
+
-moz-user-drag: none;
|
|
54
|
+
-o-user-drag: none;
|
|
55
|
+
user-select: none;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
export function InnerNMRiumContents(props) {
|
|
59
|
+
const { isFullscreenEnabled, toggleFullscreen, emptyText, mainDivRef, elementsWrapperRef, rootRef, viewerRef, } = props;
|
|
60
|
+
const { displayerMode } = useChartData();
|
|
61
|
+
const preventContextMenuHandler = useCallback((e) => {
|
|
62
|
+
if (!checkModifierKeyActivated(e)) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
}
|
|
65
|
+
}, []);
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsx(StateError, {}), _jsx("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: _jsx(DropZone, { children: _jsxs("div", { style: {
|
|
67
|
+
display: 'flex',
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
backgroundColor: 'white',
|
|
70
|
+
width: '100%',
|
|
71
|
+
}, children: [_jsx(Header, { isFullscreenEnabled: isFullscreenEnabled, onEnableFullscreen: toggleFullscreen }), _jsxs("div", { style: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
flexDirection: 'row',
|
|
74
|
+
height: '100%',
|
|
75
|
+
}, children: [_jsx(ToolBar, {}), _jsxs(SplitPaneWrapper, { children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, { mainDivRef: mainDivRef }), _jsxs("div", { id: "nmrium-viewer", "data-testid": "viewer", ref: viewerRef, style: {
|
|
76
|
+
width: '100%',
|
|
77
|
+
height: '100%',
|
|
78
|
+
position: 'relative',
|
|
79
|
+
}, children: [_jsx(FloatMoleculeStructures, {}), displayerMode === '1D' ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
pointerEvents: 'none',
|
|
82
|
+
zIndex: 2,
|
|
83
|
+
left: 0,
|
|
84
|
+
right: 0,
|
|
85
|
+
top: 0,
|
|
86
|
+
bottom: 0,
|
|
87
|
+
} }, String(isFullscreenEnabled))] })] }) }) })] }));
|
|
88
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CustomWorkspaces, WorkspacePreferences as NMRiumPreferences } from 'nmr-load-save';
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
|
|
4
|
+
import { BlobObject } from '../utility/export';
|
|
5
|
+
import { NMRiumChangeCb, NMRiumData, NMRiumWorkspace } from './types';
|
|
6
|
+
export interface NMRiumProps {
|
|
7
|
+
data?: NMRiumData;
|
|
8
|
+
onChange?: NMRiumChangeCb;
|
|
9
|
+
noErrorBoundary?: boolean;
|
|
10
|
+
onError?: ErrorBoundaryPropsWithComponent['onError'];
|
|
11
|
+
workspace?: NMRiumWorkspace;
|
|
12
|
+
customWorkspaces?: CustomWorkspaces;
|
|
13
|
+
preferences?: NMRiumPreferences;
|
|
14
|
+
emptyText?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a custom spinner that will be rendered while loading data.
|
|
17
|
+
*/
|
|
18
|
+
getSpinner?: () => ReactElement;
|
|
19
|
+
}
|
|
20
|
+
export interface NMRiumRef {
|
|
21
|
+
getSpectraViewerAsBlob: () => BlobObject | null;
|
|
22
|
+
}
|
|
23
|
+
export declare const NMRium: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<NMRiumProps & import("react").RefAttributes<NMRiumRef>>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, forwardRef } from 'react';
|
|
3
|
+
import { ErrorBoundary, } from 'react-error-boundary';
|
|
4
|
+
import { RootLayout } from 'react-science/ui';
|
|
5
|
+
import ErrorOverlay from './ErrorOverlay';
|
|
6
|
+
import { InnerNMRium } from './InnerNMRium';
|
|
7
|
+
const NMRiumBase = forwardRef(function NMRium(props, ref) {
|
|
8
|
+
const { noErrorBoundary = false, onError, ...otherProps } = props;
|
|
9
|
+
const innerNmrium = _jsx(InnerNMRium, { ...otherProps, innerRef: ref });
|
|
10
|
+
const children = noErrorBoundary ? (innerNmrium) : (_jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, onError: onError, children: innerNmrium }));
|
|
11
|
+
return _jsx(RootLayout, { style: { width: '100%' }, children: children });
|
|
12
|
+
});
|
|
13
|
+
export const NMRium = memo(NMRiumBase);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NMRiumChangeCb, NMRiumData } from './types';
|
|
3
|
+
interface NMRiumStateProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
onChange: NMRiumChangeCb | undefined;
|
|
6
|
+
nmriumData: NMRiumData | undefined;
|
|
7
|
+
}
|
|
8
|
+
export default function NMRiumStateProvider(props: NMRiumStateProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { readNMRiumObject } from 'nmr-load-save';
|
|
3
|
+
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
4
|
+
import { toJSON } from '../../data/SpectraManager';
|
|
5
|
+
import { ChartDataProvider } from '../context/ChartContext';
|
|
6
|
+
import { DispatchProvider } from '../context/DispatchContext';
|
|
7
|
+
import { useLogger } from '../context/LoggerContext';
|
|
8
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
9
|
+
import checkActionType from '../reducer/IgnoreActions';
|
|
10
|
+
import { spectrumReducer, initialState, initState } from '../reducer/Reducer';
|
|
11
|
+
const defaultData = {
|
|
12
|
+
spectra: [],
|
|
13
|
+
};
|
|
14
|
+
export default function NMRiumStateProvider(props) {
|
|
15
|
+
const { children, onChange, nmriumData = defaultData } = props;
|
|
16
|
+
const { logger } = useLogger();
|
|
17
|
+
const preferencesState = usePreferences();
|
|
18
|
+
const [state, dispatchRaw] = useReducer(spectrumReducer, initialState, initState);
|
|
19
|
+
const dispatch = useCallback((action) => {
|
|
20
|
+
logger.trace({ action }, `Dispatch main reducer action: ${action.type}`);
|
|
21
|
+
dispatchRaw(action);
|
|
22
|
+
}, [logger]);
|
|
23
|
+
const { source, data: spectraData, molecules, correlations, actionType, view, } = state;
|
|
24
|
+
const stateRef = useRef();
|
|
25
|
+
const handleChange = useRef(onChange);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
handleChange.current = onChange;
|
|
28
|
+
}, [onChange]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const { workspace, workspaces = {} } = preferencesState;
|
|
31
|
+
stateRef.current = toJSON({ data: spectraData, molecules, correlations, source, view, actionType }, { current: workspaces[workspace.current] }, { serialize: false, exportTarget: 'onChange' });
|
|
32
|
+
}, [
|
|
33
|
+
actionType,
|
|
34
|
+
correlations,
|
|
35
|
+
molecules,
|
|
36
|
+
preferencesState,
|
|
37
|
+
source,
|
|
38
|
+
spectraData,
|
|
39
|
+
view,
|
|
40
|
+
]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
// trigger onChange callback if data object changed
|
|
43
|
+
if (checkActionType(actionType)) {
|
|
44
|
+
handleChange.current?.(stateRef.current, 'data');
|
|
45
|
+
}
|
|
46
|
+
}, [actionType, correlations, molecules, source, spectraData]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
// trigger onChange callback if view object changed
|
|
49
|
+
handleChange.current?.(stateRef.current, 'view');
|
|
50
|
+
}, [view]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
// trigger onChange callback if settings changed
|
|
53
|
+
handleChange.current?.(stateRef.current, 'settings');
|
|
54
|
+
}, [preferencesState]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
dispatch({
|
|
57
|
+
type: 'SET_LOADING_FLAG',
|
|
58
|
+
payload: { isLoading: true },
|
|
59
|
+
});
|
|
60
|
+
if (nmriumData) {
|
|
61
|
+
void readNMRiumObject(nmriumData)
|
|
62
|
+
.then((nmriumState) => {
|
|
63
|
+
dispatch({ type: 'INITIATE', payload: { nmriumState } });
|
|
64
|
+
})
|
|
65
|
+
.catch((error) => {
|
|
66
|
+
dispatch({ type: 'SET_LOADING_FLAG', payload: { isLoading: false } });
|
|
67
|
+
// eslint-disable-next-line no-alert
|
|
68
|
+
alert(error.message);
|
|
69
|
+
reportError(error);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}, [nmriumData, dispatch]);
|
|
73
|
+
return (_jsx(DispatchProvider, { value: dispatch, children: _jsx(ChartDataProvider, { value: state, children: children }) }));
|
|
74
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SplitPane } from 'react-science/ui';
|
|
3
|
-
import { usePreferences } from '
|
|
3
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
4
4
|
export function SplitPaneWrapper({ children }) {
|
|
5
5
|
const { current, dispatch } = usePreferences();
|
|
6
6
|
const { general: { verticalSplitterPosition, verticalSplitterCloseThreshold }, display: { general = {} }, } = current;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useChartData } from '../context/ChartContext';
|
|
3
|
+
import { useLogger } from '../context/LoggerContext';
|
|
4
|
+
/**
|
|
5
|
+
* Alert user in UI when state have errorAction (error from reducer)
|
|
6
|
+
*/
|
|
7
|
+
export function StateError() {
|
|
8
|
+
const { errorAction } = useChartData();
|
|
9
|
+
const { logger } = useLogger();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!errorAction)
|
|
12
|
+
return;
|
|
13
|
+
logger.error(errorAction);
|
|
14
|
+
}, [errorAction, logger]);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebSource } from 'filelist-utils';
|
|
2
|
+
import { CorrelationData } from 'nmr-correlation';
|
|
3
|
+
import type { NmriumState as NMRiumState, WorkspacePreferences as NMRiumPreferences, Spectrum } from 'nmr-load-save';
|
|
4
|
+
type DeepPartial<T> = {
|
|
5
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
6
|
+
};
|
|
7
|
+
interface NMRiumData {
|
|
8
|
+
source?: WebSource;
|
|
9
|
+
molecules?: NMRiumMolecules;
|
|
10
|
+
spectra: Array<DeepPartial<Spectrum>>;
|
|
11
|
+
correlations?: CorrelationData;
|
|
12
|
+
}
|
|
13
|
+
type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded' | 'assignment' | 'simulation' | (string & {});
|
|
14
|
+
type NMRiumChangeCb = (state: NMRiumState, source: 'data' | 'view' | 'settings') => void;
|
|
15
|
+
type NMRiumMolecules = Array<{
|
|
16
|
+
molfile: string;
|
|
17
|
+
}>;
|
|
18
|
+
export type { NMRiumChangeCb, NMRiumData, NMRiumMolecules, NMRiumPreferences, NMRiumState, NMRiumWorkspace, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { Formik } from 'formik';
|
|
4
|
-
import {
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
5
|
import { REFERENCES } from '../../data/constants/References';
|
|
6
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
7
7
|
import Button from '../elements/Button';
|
|
@@ -11,6 +11,10 @@ import Select from '../elements/Select';
|
|
|
11
11
|
import FormikInput from '../elements/formik/FormikInput';
|
|
12
12
|
import Events from '../utility/Events';
|
|
13
13
|
import { ModalStyles } from './ModalStyle';
|
|
14
|
+
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
15
|
+
import useSpectraByActiveNucleus from '../hooks/useSpectraPerNucleus';
|
|
16
|
+
import * as Yup from 'yup';
|
|
17
|
+
import Message from '../elements/Message';
|
|
14
18
|
const labelStyle = {
|
|
15
19
|
label: { flex: 4, fontWeight: '500' },
|
|
16
20
|
wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
|
|
@@ -22,44 +26,89 @@ const inputStyle = {
|
|
|
22
26
|
},
|
|
23
27
|
};
|
|
24
28
|
const baseList = [{ key: 1, value: 'manual', label: 'Manual' }];
|
|
29
|
+
const DEFAULT_OPTIONS = {
|
|
30
|
+
from: -1,
|
|
31
|
+
to: 1,
|
|
32
|
+
nbPeaks: 1,
|
|
33
|
+
targetX: 0,
|
|
34
|
+
};
|
|
35
|
+
const schemaValidation = Yup.object({
|
|
36
|
+
from: Yup.number().required(),
|
|
37
|
+
to: Yup.number().required(),
|
|
38
|
+
nbPeaks: Yup.number().required(),
|
|
39
|
+
targetX: Yup.number().required(),
|
|
40
|
+
});
|
|
41
|
+
function checkSpectra(options, spectra) {
|
|
42
|
+
const { from, to } = options;
|
|
43
|
+
for (const spectrum of spectra) {
|
|
44
|
+
const { data: { x }, } = spectrum;
|
|
45
|
+
const min = x[0];
|
|
46
|
+
const max = x.at(-1);
|
|
47
|
+
if (from < min || to > max) {
|
|
48
|
+
throw new Error('Some spectra do not have data in the selected range');
|
|
49
|
+
}
|
|
50
|
+
if (Math.abs(xFindClosestIndex(x, from) - xFindClosestIndex(x, to)) < 10) {
|
|
51
|
+
throw new Error('The selected range is too small to provide accurate results');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function checkOptions(options) {
|
|
56
|
+
const returnedOptions = { ...options };
|
|
57
|
+
if (options.from > options.to) {
|
|
58
|
+
returnedOptions.to = options.from;
|
|
59
|
+
returnedOptions.from = options.to;
|
|
60
|
+
}
|
|
61
|
+
return returnedOptions;
|
|
62
|
+
}
|
|
63
|
+
function getList(nucleus) {
|
|
64
|
+
if (!REFERENCES?.[nucleus]) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const list = Object.entries(REFERENCES[nucleus]).map((item) => ({
|
|
68
|
+
value: item[0],
|
|
69
|
+
label: item[0],
|
|
70
|
+
}));
|
|
71
|
+
return baseList.concat(list);
|
|
72
|
+
}
|
|
25
73
|
function AlignSpectraModal({ onClose = () => null, nucleus, }) {
|
|
26
|
-
const
|
|
74
|
+
const spectra = useSpectraByActiveNucleus();
|
|
27
75
|
const dispatch = useDispatch();
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [dispatch, onClose]);
|
|
76
|
+
const [options, setOptions] = useState(DEFAULT_OPTIONS);
|
|
77
|
+
const [error, setError] = useState('');
|
|
78
|
+
function submitHandler(inputOptions) {
|
|
79
|
+
const options = checkOptions(inputOptions);
|
|
80
|
+
setOptions(options);
|
|
81
|
+
try {
|
|
82
|
+
checkSpectra(options, spectra);
|
|
83
|
+
dispatch({ type: 'ALIGN_SPECTRA', payload: options });
|
|
84
|
+
onClose();
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
const message = error.message;
|
|
88
|
+
setError(message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
44
91
|
useEffect(() => {
|
|
45
92
|
function handler(event) {
|
|
46
93
|
const [from, to] = event.range;
|
|
47
|
-
|
|
94
|
+
setOptions((prevOptions) => ({ ...prevOptions, from, to }));
|
|
48
95
|
}
|
|
49
96
|
Events.on('brushEnd', handler);
|
|
50
97
|
return () => {
|
|
51
98
|
Events.off('brushEnd', handler);
|
|
52
99
|
};
|
|
53
100
|
}, []);
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
101
|
+
function optionChangeHandler(key) {
|
|
102
|
+
const { delta: targetX = 0, ...otherOptions } = REFERENCES?.[nucleus]?.[key] || {};
|
|
103
|
+
const value = {
|
|
104
|
+
...DEFAULT_OPTIONS,
|
|
105
|
+
targetX,
|
|
106
|
+
...otherOptions,
|
|
107
|
+
};
|
|
108
|
+
setOptions(value);
|
|
109
|
+
setError('');
|
|
110
|
+
}
|
|
111
|
+
const List = getList(nucleus);
|
|
112
|
+
return (_jsx("div", { css: ModalStyles, children: _jsx(Formik, { initialValues: options, enableReinitialize: true, onSubmit: submitHandler, validationSchema: schemaValidation, validate: () => setError(''), children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content", style: { flex: 1, minHeight: '220px' }, children: [error && _jsx(Message, { type: "error", children: error }), _jsx(Label, { title: "Options", style: labelStyle, children: _jsx(Select, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of Peaks", style: labelStyle, children: _jsx(FormikInput, { name: "nbPeaks", type: "number", style: inputStyle }) }), _jsx(Label, { title: "Target PPM", style: labelStyle, children: _jsx(FormikInput, { name: "targetX", type: "number", style: inputStyle }) })] }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: submitForm, children: "Done" }) })] })) }) }));
|
|
64
113
|
}
|
|
65
114
|
export default AlignSpectraModal;
|
|
@@ -3,7 +3,11 @@ interface MoleculeStructureEditorModalProps {
|
|
|
3
3
|
onClose?: (element?: string) => void;
|
|
4
4
|
selectedMolecule?: StateMoleculeExtended;
|
|
5
5
|
floatMoleculeOnSave?: boolean;
|
|
6
|
+
isOpen?: boolean;
|
|
6
7
|
}
|
|
7
8
|
declare function MoleculeStructureEditorModal(props: MoleculeStructureEditorModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function useMoleculeEditor(floatMoleculeOnSave?: boolean):
|
|
9
|
+
export declare function useMoleculeEditor(floatMoleculeOnSave?: boolean): {
|
|
10
|
+
modal: import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
+
openMoleculeEditor: (molecule?: StateMoleculeExtended) => void;
|
|
12
|
+
};
|
|
9
13
|
export default MoleculeStructureEditorModal;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { StructureEditor } from 'react-ocl/full';
|
|
5
|
+
import { ConfirmModal, Modal, useOnOff } from 'react-science/ui';
|
|
5
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
|
-
import ActionButtons from '../elements/ActionButtons';
|
|
7
|
-
import { useModal } from '../elements/popup/Modal';
|
|
8
|
-
import { positions } from '../elements/popup/options';
|
|
9
|
-
import { ModalStyles } from './ModalStyle';
|
|
10
7
|
function MoleculeStructureEditorModal(props) {
|
|
11
|
-
const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, } = props;
|
|
8
|
+
const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, isOpen = false, } = props;
|
|
12
9
|
const [molfile, setMolfile] = useState(null);
|
|
13
10
|
const dispatch = useDispatch();
|
|
14
11
|
useEffect(() => {
|
|
@@ -56,16 +53,16 @@ function MoleculeStructureEditorModal(props) {
|
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
}, [molfile, selectedMolecule, dispatch, floatMoleculeOnSave, onClose]);
|
|
59
|
-
return (
|
|
56
|
+
return (_jsx(ConfirmModal, { headerColor: "transparent", isOpen: isOpen, onRequestClose: handleClose, onCancel: handleClose, onConfirm: handleSave, maxWidth: 700, children: _jsx(Modal.Body, { children: _jsx(StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }) }) }));
|
|
60
57
|
}
|
|
61
58
|
export function useMoleculeEditor(floatMoleculeOnSave = false) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
const [isOpen, openModal, closeModal] = useOnOff(false);
|
|
60
|
+
const [molecule, setMolecule] = useState();
|
|
61
|
+
const modal = (_jsx(MoleculeStructureEditorModal, { selectedMolecule: molecule, floatMoleculeOnSave: floatMoleculeOnSave, onClose: closeModal, isOpen: isOpen }));
|
|
62
|
+
const openMoleculeEditor = useCallback((molecule) => {
|
|
63
|
+
setMolecule(molecule);
|
|
64
|
+
openModal();
|
|
65
|
+
}, [openModal]);
|
|
66
|
+
return { modal, openMoleculeEditor };
|
|
70
67
|
}
|
|
71
68
|
export default MoleculeStructureEditorModal;
|
|
@@ -126,7 +126,7 @@ export default function MultipletAnalysisModal({ data, activeSpectrum, scaleX, s
|
|
|
126
126
|
try {
|
|
127
127
|
const result = analyseMultiplet(analysesProps, {
|
|
128
128
|
frequency: info.originFrequency,
|
|
129
|
-
minimalResolution: 0.
|
|
129
|
+
minimalResolution: 0.1,
|
|
130
130
|
maxTestedJ: 17,
|
|
131
131
|
takeBestPartMultiplet: true,
|
|
132
132
|
correctVerticalOffset: true,
|
|
@@ -74,7 +74,7 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
74
74
|
closeDialog();
|
|
75
75
|
const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
|
|
76
76
|
try {
|
|
77
|
-
const data = await predictSpectra(molfile);
|
|
77
|
+
const data = await predictSpectra(molfile, values.spectra);
|
|
78
78
|
dispatch({
|
|
79
79
|
type: 'PREDICT_SPECTRA',
|
|
80
80
|
payload: {
|
|
@@ -3,8 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { SvgLogoNmrium } from 'cheminfo-font';
|
|
5
5
|
import { Modal, Toolbar, useOnOff } from 'react-science/ui';
|
|
6
|
-
import versionInfo from '
|
|
7
|
-
import Logo from '
|
|
6
|
+
import versionInfo from '../../../versionInfo';
|
|
7
|
+
import Logo from '../../elements/Logo';
|
|
8
|
+
import AboutUsZakodium from './AboutUsZakodium';
|
|
8
9
|
const styles = css `
|
|
9
10
|
width: 40vw;
|
|
10
11
|
min-width: 500px;
|
|
@@ -92,7 +93,7 @@ function AboutUsModal() {
|
|
|
92
93
|
display: 'flex',
|
|
93
94
|
alignItems: 'center',
|
|
94
95
|
justifyContent: 'center',
|
|
95
|
-
}, children: _jsx(SvgLogoNmrium, {}) }) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children:
|
|
96
|
+
}, children: _jsx(SvgLogoNmrium, {}) }) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: _jsx(AboutUsZakodium, {}) }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
|
|
96
97
|
}
|
|
97
98
|
export default AboutUsModal;
|
|
98
99
|
function VersionInfo() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AboutUsZakodium(): import("react/jsx-runtime").JSX.Element;
|