nmrium 0.50.1 → 0.52.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/Chart1D.js +1 -1
- package/lib/component/1d/LinesSeries.js +2 -2
- package/lib/component/1d/Viewer1D.js +6 -11
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
- package/lib/component/2d/Viewer2D.js +16 -15
- package/lib/component/2d/ft/Contours.js +6 -3
- package/lib/component/2d/utilities/scale.d.ts +2 -1
- package/lib/component/2d/utilities/scale.js +12 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +32 -18
- package/lib/component/context/DispatchContext.d.ts +1 -1
- package/lib/component/context/ToasterContext.d.ts +13 -0
- package/lib/component/context/ToasterContext.js +34 -0
- package/lib/component/elements/Label.js +1 -1
- package/lib/component/elements/Select.js +2 -2
- package/lib/component/elements/ToolbarPopoverItem.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +1 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.js +7 -4
- package/lib/component/header/BaseLineCorrectionPanel.js +2 -2
- package/lib/component/header/Header.d.ts +1 -11
- package/lib/component/header/Header.js +5 -6
- package/lib/component/header/PhaseCorrectionPanel.js +24 -33
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
- package/lib/component/header/RangesPickingOptionPanel.js +7 -4
- package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib/component/header/Zones2DOptionPanel.js +6 -2
- package/lib/component/hooks/useDialogToggle.d.ts +5 -0
- package/lib/component/hooks/useDialogToggle.js +16 -0
- package/lib/component/hooks/useExport.d.ts +9 -1
- package/lib/component/hooks/useExport.js +34 -36
- package/lib/component/hooks/useSaveSettings.js +6 -3
- package/lib/component/hooks/useToolsFunctions.d.ts +1 -1
- package/lib/component/hooks/useToolsFunctions.js +9 -7
- package/lib/component/loader/DropZone.js +14 -14
- package/lib/component/main/InnerNMRium.js +5 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
- package/lib/component/main/InnerNMRiumContents.js +5 -3
- package/lib/component/main/NMRium.js +2 -2
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +15 -15
- package/lib/component/modal/ImportPublicationStringModal.js +5 -3
- package/lib/component/modal/LoadJCAMPModal.js +7 -5
- package/lib/component/modal/LogsHistoryModal.js +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +11 -9
- package/lib/component/modal/SaveAsModal.d.ts +3 -4
- package/lib/component/modal/SaveAsModal.js +27 -27
- package/lib/component/modal/editRange/EditRangeModal.js +2 -2
- package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
- package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
- package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
- package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +2 -2
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
- package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
- package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +9 -6
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +1 -1
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -7
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
- package/lib/component/panels/Panels.js +5 -5
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +6 -3
- package/lib/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib/component/panels/RangesPanel/RangesPanel.js +5 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +1 -1
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.d.ts +5 -0
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPanelHeader.js +11 -11
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.js +12 -6
- package/lib/component/panels/SpectraPanel/SpectraTabs.d.ts +1 -0
- package/lib/component/panels/{SpectrumsPanel/SpectrumsTabs.js → SpectraPanel/SpectraTabs.js} +6 -6
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.js +2 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
- package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
- package/lib/component/panels/filtersPanel/FilterPanel.js +5 -3
- package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +7 -5
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +5 -5
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +6 -6
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +5 -3
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +3 -2
- package/lib/component/reducer/Reducer.js +40 -32
- package/lib/component/reducer/actions/DomainActions.js +3 -3
- package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
- package/lib/component/reducer/actions/FiltersActions.js +243 -91
- package/lib/component/reducer/actions/IntegralsActions.js +2 -2
- package/lib/component/reducer/actions/LoadActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.js +0 -1
- package/lib/component/reducer/actions/PreferencesActions.js +2 -2
- package/lib/component/reducer/actions/RangesActions.js +16 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +6 -6
- package/lib/component/reducer/actions/ToolsActions.js +83 -22
- package/lib/component/reducer/actions/ZonesActions.d.ts +2 -0
- package/lib/component/reducer/actions/ZonesActions.js +5 -1
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
- package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
- package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
- package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
- package/lib/component/toolbar/ToolBar.js +32 -27
- package/lib/component/toolbar/toolbarMenu.js +4 -4
- package/lib/component/utility/Events.d.ts +11 -0
- package/lib/component/utility/Events.js +22 -0
- package/lib/constants.js +5 -5
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
- package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +3 -3
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
- package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -0
- package/lib/data/getDefaultMatrixFilters.js +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
- package/lib/versionInfo.js +1 -1
- package/package.json +32 -30
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
- package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
- package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
- package/lib/component/elements/popup/Alert/Context.js +0 -10
- package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
- package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
- package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
- package/lib/component/elements/popup/Alert/Provider.js +0 -127
- package/lib/component/elements/popup/Alert/index.d.ts +0 -3
- package/lib/component/elements/popup/Alert/index.js +0 -3
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
- package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
- package/lib/component/modal/metaImportation/index.d.ts +0 -2
- package/lib/component/modal/metaImportation/index.js +0 -17
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.d.ts +0 -5
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.d.ts +0 -1
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.js +0 -0
- /package/lib/component/reducer/actions/{SpectrumsActions.d.ts → SpectraActions.d.ts} +0 -0
- /package/lib/component/reducer/actions/{SpectrumsActions.js → SpectraActions.js} +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useReducer, useRef, useImperativeHandle, } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { useFullscreen } from 'react-use';
|
|
3
|
+
import { useFullscreen } from 'react-science/ui';
|
|
5
4
|
import { AssignmentProvider } from '../assignment';
|
|
6
5
|
import { GlobalProvider } from '../context/GlobalContext';
|
|
7
6
|
import { KeyModifiersProvider } from '../context/KeyModifierContext';
|
|
8
7
|
import { LoggerProvider } from '../context/LoggerContext';
|
|
9
8
|
import { PreferencesProvider } from '../context/PreferencesContext';
|
|
9
|
+
import { ToasterProvider } from '../context/ToasterContext';
|
|
10
10
|
import { TopicMoleculeProvider } from '../context/TopicMoleculeContext';
|
|
11
|
-
import { AlertProvider } from '../elements/popup/Alert';
|
|
12
11
|
import { ModalProvider } from '../elements/popup/Modal';
|
|
13
12
|
import { HighlightProvider } from '../highlight';
|
|
14
13
|
import { defaultGetSpinner, SpinnerProvider } from '../loader/SpinnerContext';
|
|
@@ -20,15 +19,12 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
|
|
|
20
19
|
const rootRef = useRef(null);
|
|
21
20
|
const elementsWrapperRef = useRef(null);
|
|
22
21
|
const viewerRef = useRef(null);
|
|
23
|
-
const [enableFullscreen, , disableFullscreen, toggleFullscreen] = useOnOff(false);
|
|
24
22
|
const mainDivRef = useRef(null);
|
|
25
|
-
const
|
|
26
|
-
onClose: disableFullscreen,
|
|
27
|
-
});
|
|
23
|
+
const { isFullScreen } = useFullscreen();
|
|
28
24
|
const [preferencesState, dispatchPreferences] = useReducer(preferencesReducer, preferencesInitialState, initPreferencesState);
|
|
29
25
|
useEffect(() => {
|
|
30
26
|
rootRef.current?.focus();
|
|
31
|
-
}, [
|
|
27
|
+
}, [isFullScreen]);
|
|
32
28
|
useEffect(() => {
|
|
33
29
|
dispatchPreferences({
|
|
34
30
|
type: 'INIT_PREFERENCES',
|
|
@@ -49,5 +45,5 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
|
|
|
49
45
|
rootRef: rootRef.current,
|
|
50
46
|
elementsWrapperRef: elementsWrapperRef.current,
|
|
51
47
|
viewerRef: viewerRef.current,
|
|
52
|
-
}, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(
|
|
48
|
+
}, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(ToasterProvider, { children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(TopicMoleculeProvider, { children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
53
49
|
}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
import { RefObject } from 'react';
|
|
3
3
|
import { NMRiumProps } from '.';
|
|
4
4
|
interface InnerNMRiumContentsProps {
|
|
5
|
-
isFullscreenEnabled: boolean;
|
|
6
|
-
toggleFullscreen: () => void;
|
|
7
5
|
emptyText: NMRiumProps['emptyText'];
|
|
8
6
|
mainDivRef: RefObject<HTMLDivElement>;
|
|
9
7
|
elementsWrapperRef: RefObject<HTMLDivElement>;
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
+
import { useFullscreen } from 'react-science/ui';
|
|
5
6
|
import checkModifierKeyActivated from '../../data/utilities/checkModifierKeyActivated';
|
|
6
7
|
import Viewer1D from '../1d/Viewer1D';
|
|
7
8
|
import FloatMoleculeStructures from '../1d-2d/components/FloatMoleculeStructures';
|
|
@@ -56,8 +57,9 @@ const containerStyles = css `
|
|
|
56
57
|
}
|
|
57
58
|
`;
|
|
58
59
|
export function InnerNMRiumContents(props) {
|
|
59
|
-
const {
|
|
60
|
+
const { emptyText, mainDivRef, elementsWrapperRef, rootRef, viewerRef } = props;
|
|
60
61
|
const { displayerMode } = useChartData();
|
|
62
|
+
const { isFullScreen } = useFullscreen();
|
|
61
63
|
const preventContextMenuHandler = useCallback((e) => {
|
|
62
64
|
if (!checkModifierKeyActivated(e)) {
|
|
63
65
|
e.preventDefault();
|
|
@@ -68,7 +70,7 @@ export function InnerNMRiumContents(props) {
|
|
|
68
70
|
flexDirection: 'column',
|
|
69
71
|
backgroundColor: 'white',
|
|
70
72
|
width: '100%',
|
|
71
|
-
}, children: [_jsx(Header, {
|
|
73
|
+
}, children: [_jsx(Header, {}), _jsxs("div", { style: {
|
|
72
74
|
display: 'flex',
|
|
73
75
|
flexDirection: 'row',
|
|
74
76
|
height: '100%',
|
|
@@ -84,5 +86,5 @@ export function InnerNMRiumContents(props) {
|
|
|
84
86
|
right: 0,
|
|
85
87
|
top: 0,
|
|
86
88
|
bottom: 0,
|
|
87
|
-
} }, String(
|
|
89
|
+
} }, String(isFullScreen))] })] }) }) })] }));
|
|
88
90
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, forwardRef } from 'react';
|
|
3
3
|
import { ErrorBoundary, } from 'react-error-boundary';
|
|
4
|
-
import { RootLayout } from 'react-science/ui';
|
|
4
|
+
import { FullScreenProvider, RootLayout } from 'react-science/ui';
|
|
5
5
|
import ErrorOverlay from './ErrorOverlay';
|
|
6
6
|
import { InnerNMRium } from './InnerNMRium';
|
|
7
7
|
const NMRiumBase = forwardRef(function NMRium(props, ref) {
|
|
8
8
|
const { noErrorBoundary = false, onError, ...otherProps } = props;
|
|
9
9
|
const innerNmrium = _jsx(InnerNMRium, { ...otherProps, innerRef: ref });
|
|
10
10
|
const children = noErrorBoundary ? (innerNmrium) : (_jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, onError: onError, children: innerNmrium }));
|
|
11
|
-
return _jsx(RootLayout, { style: { width: '100%' }, children: children });
|
|
11
|
+
return (_jsx(FullScreenProvider, { children: _jsx(RootLayout, { style: { width: '100%' }, children: children }) }));
|
|
12
12
|
});
|
|
13
13
|
export const NMRium = memo(NMRiumBase);
|
|
@@ -40,6 +40,6 @@ const styles = css `
|
|
|
40
40
|
`;
|
|
41
41
|
function AboutPredictionModal() {
|
|
42
42
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
43
|
-
return (_jsxs(_Fragment, { children: [_jsx(Toolbar
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaInfo, {}), onClick: openDialog, title: "About prediction" }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About prediction", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }));
|
|
44
44
|
}
|
|
45
45
|
export default AboutPredictionModal;
|
|
@@ -40,6 +40,6 @@ const styles = css `
|
|
|
40
40
|
`;
|
|
41
41
|
function AboutSpectrumSimulationModal() {
|
|
42
42
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
43
|
-
return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { onClick: openDialog, title: "About
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { onClick: openDialog, title: "About prediction", icon: _jsx(FaInfo, {}) }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About spectrum simulation", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }));
|
|
44
44
|
}
|
|
45
45
|
export default AboutSpectrumSimulationModal;
|
|
@@ -79,6 +79,6 @@ function EditPeakShapeModal({ onClose = () => null, peak, peaksPreferences, }) {
|
|
|
79
79
|
}, [dispatch, onClose, peak.id]);
|
|
80
80
|
const values = getValues(peak, kind);
|
|
81
81
|
const valuePPM = formatNumber(peak.x, peaksPreferences.deltaPPM.format);
|
|
82
|
-
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "
|
|
82
|
+
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Kind:", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "FWHM:", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "Mu:", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
|
|
83
83
|
}
|
|
84
84
|
export default EditPeakShapeModal;
|
|
@@ -5,10 +5,10 @@ import { css } from '@emotion/react';
|
|
|
5
5
|
import { Formik } from 'formik';
|
|
6
6
|
import { useRef } from 'react';
|
|
7
7
|
import { DataExportStage, exportAsJcamp, } from '../../data/SpectraManager';
|
|
8
|
+
import { useToaster } from '../context/ToasterContext';
|
|
8
9
|
import ActionButtons from '../elements/ActionButtons';
|
|
9
10
|
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
10
11
|
import FormikSelect from '../elements/formik/FormikSelect';
|
|
11
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
12
12
|
const initValues = {
|
|
13
13
|
onlyReal: true,
|
|
14
14
|
dataExportStage: 'PROCESSED',
|
|
@@ -41,21 +41,21 @@ const DATA_STAGES = Object.keys(DataExportStage).map((key) => ({
|
|
|
41
41
|
function ExportAsJcampModal(props) {
|
|
42
42
|
const { closeDialog, spectrum } = props;
|
|
43
43
|
const refForm = useRef(null);
|
|
44
|
-
const
|
|
44
|
+
const toaster = useToaster();
|
|
45
45
|
function submitHandler(options) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
46
|
+
const hideLoading = toaster.showLoading({
|
|
47
|
+
message: 'export as JCAMP-DX in progress',
|
|
48
|
+
});
|
|
49
|
+
try {
|
|
50
|
+
exportAsJcamp(spectrum, options);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
toaster.show({ message: error.message, intent: 'danger' });
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
closeDialog?.();
|
|
57
|
+
hideLoading();
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
return (_jsxs(Dialog, { isOpen: true, onClose: closeDialog, title: "Export as JCAMP", children: [_jsx(DialogBody, { css: css `
|
|
61
61
|
background-color: white;
|
|
@@ -7,11 +7,11 @@ import { resurrect } from 'nmr-processing';
|
|
|
7
7
|
import { useMemo, useRef, useState } from 'react';
|
|
8
8
|
import * as yup from 'yup';
|
|
9
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
|
+
import { useToaster } from '../context/ToasterContext';
|
|
10
11
|
import Button from '../elements/Button';
|
|
11
12
|
import { GroupPane } from '../elements/GroupPane';
|
|
12
13
|
import ReactTable from '../elements/ReactTable/ReactTable';
|
|
13
14
|
import FormikTextarea from '../elements/formik/FormikTextarea';
|
|
14
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
15
15
|
const validationSchema = yup.object({
|
|
16
16
|
publicationText: yup.string().required(),
|
|
17
17
|
});
|
|
@@ -33,7 +33,7 @@ function ImportPublicationStringModal(props) {
|
|
|
33
33
|
const { onClose, isOpen } = props;
|
|
34
34
|
const formRef = useRef();
|
|
35
35
|
const dispatch = useDispatch();
|
|
36
|
-
const
|
|
36
|
+
const toaster = useToaster();
|
|
37
37
|
const [logs, setLogs] = useState([]);
|
|
38
38
|
const loggerRef = useRef(new FifoLogger({
|
|
39
39
|
onChange: (log, logs) => {
|
|
@@ -63,7 +63,9 @@ function ImportPublicationStringModal(props) {
|
|
|
63
63
|
return;
|
|
64
64
|
function publicationStringHandler({ publicationText }) {
|
|
65
65
|
void (async () => {
|
|
66
|
-
const hideLoading =
|
|
66
|
+
const hideLoading = toaster.showLoading({
|
|
67
|
+
message: 'Generate spectrum from publication string in progress',
|
|
68
|
+
});
|
|
67
69
|
const { ranges, info: { nucleus, solvent = '', frequency }, parts, } = resurrect(publicationText, { logger: loggerRef.current });
|
|
68
70
|
setTimeout(() => {
|
|
69
71
|
dispatch({
|
|
@@ -7,11 +7,11 @@ import { readFromWebSource } from 'nmr-load-save';
|
|
|
7
7
|
import { useRef } from 'react';
|
|
8
8
|
import * as Yup from 'yup';
|
|
9
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
|
+
import { useToaster } from '../context/ToasterContext';
|
|
10
11
|
import Button from '../elements/Button';
|
|
11
12
|
import Label from '../elements/Label';
|
|
12
13
|
import FormikError from '../elements/formik/FormikError';
|
|
13
14
|
import FormikInput from '../elements/formik/FormikInput';
|
|
14
|
-
import { useAlert } from '../elements/popup/Alert/Context';
|
|
15
15
|
const allowedExtensions = new Set(['dx', 'jdx', 'jcamp']);
|
|
16
16
|
const loadFormValidation = Yup.object({
|
|
17
17
|
url: Yup.string()
|
|
@@ -36,12 +36,14 @@ const labelStyle = {
|
|
|
36
36
|
};
|
|
37
37
|
export function LoadJCAMPModal({ onCloseDialog, isOpen }) {
|
|
38
38
|
const dispatch = useDispatch();
|
|
39
|
-
const
|
|
39
|
+
const toaster = useToaster();
|
|
40
40
|
const ref = useRef(null);
|
|
41
41
|
if (!isOpen)
|
|
42
42
|
return;
|
|
43
43
|
async function loadJCAMPHandler({ url }) {
|
|
44
|
-
const hidLoading =
|
|
44
|
+
const hidLoading = toaster.showLoading({
|
|
45
|
+
message: 'Load JCAMP from external URL in progress ...',
|
|
46
|
+
});
|
|
45
47
|
const { pathname, origin } = new URL(url);
|
|
46
48
|
try {
|
|
47
49
|
const nmriumState = await readFromWebSource({
|
|
@@ -53,14 +55,14 @@ export function LoadJCAMPModal({ onCloseDialog, isOpen }) {
|
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
catch {
|
|
56
|
-
|
|
58
|
+
toaster.show({ message: `Failed to load ${url}`, intent: 'danger' });
|
|
57
59
|
}
|
|
58
60
|
finally {
|
|
59
61
|
hidLoading();
|
|
60
62
|
onCloseDialog?.();
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
return (_jsxs(Dialog, { isOpen: true, onClose: onCloseDialog, title: "Load JCAMP
|
|
65
|
+
return (_jsxs(Dialog, { isOpen: true, onClose: onCloseDialog, title: "Load JCAMP", style: { minWidth: '400px' }, children: [_jsx(DialogBody, { css: css `
|
|
64
66
|
background-color: white;
|
|
65
67
|
`, children: _jsx(Formik, { initialValues: { url: '' }, validationSchema: loadFormValidation, onSubmit: loadJCAMPHandler, innerRef: ref, children: _jsx(Label, { title: "URL", style: labelStyle, children: _jsx(FormikError, { name: "url", style: { container: { flex: 1 } }, children: _jsx(FormikInput, { name: "url", type: "string", style: {
|
|
66
68
|
input: {
|
|
@@ -107,7 +107,7 @@ export function LogsHistoryModal(props) {
|
|
|
107
107
|
markAsRead();
|
|
108
108
|
closeDialog();
|
|
109
109
|
onClose?.();
|
|
110
|
-
}, title: "Logs
|
|
110
|
+
}, title: "Logs history", style: { width: '50vw', height: '50vh' }, children: [_jsx(DialogBody, { css: css `
|
|
111
111
|
background-color: white;
|
|
112
112
|
`, children: _jsx(ReactTable, { columns: COLUMNS, data: sortedLogs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle }) }), _jsx(DialogFooter, { children: _jsx(Button.Danger, { onClick: () => logger.clear(), fill: "outline", children: _jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(FaRegTrashAlt, {}), _jsx("span", { style: { paddingLeft: '5px' }, children: "Clear Logs" })] }) }) })] })] }));
|
|
113
113
|
}
|
|
@@ -74,7 +74,7 @@ const loaderStyles = css `
|
|
|
74
74
|
}
|
|
75
75
|
`;
|
|
76
76
|
export default function MultipletAnalysisModal({ data, activeSpectrum, scaleX, startX, endX, onClose, isOpen, }) {
|
|
77
|
-
return (_jsx(Dialog, { isOpen: isOpen, onClose: () => onClose(), title: "Analyse
|
|
77
|
+
return (_jsx(Dialog, { isOpen: isOpen, onClose: () => onClose(), title: "Analyse multiplet", style: { width: 900, height: 400 }, children: _jsx(DialogBody, { css: styles, children: _jsx(InnerMultipleAnalysis, { data,
|
|
78
78
|
activeSpectrum,
|
|
79
79
|
scaleX,
|
|
80
80
|
startX,
|
|
@@ -9,8 +9,8 @@ import { getDefaultPredictionOptions, predictSpectra, } from '../../data/Predict
|
|
|
9
9
|
import { useChartData } from '../context/ChartContext';
|
|
10
10
|
import { useDispatch } from '../context/DispatchContext';
|
|
11
11
|
import { useLogger } from '../context/LoggerContext';
|
|
12
|
+
import { useToaster } from '../context/ToasterContext';
|
|
12
13
|
import Button from '../elements/Button';
|
|
13
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
14
14
|
import PredictionPreferences from '../panels/predictionPanel/PredictionOptionsPanel';
|
|
15
15
|
import { useStateWithLocalStorage } from '../utility/LocalStorage';
|
|
16
16
|
const styles = css `
|
|
@@ -47,7 +47,7 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
47
47
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
48
48
|
const refForm = useRef();
|
|
49
49
|
const dispatch = useDispatch();
|
|
50
|
-
const
|
|
50
|
+
const toaster = useToaster();
|
|
51
51
|
const [predictionPreferences, setPredictionPreferences] = useStateWithLocalStorage('nmrium-prediction-preferences');
|
|
52
52
|
const { isApproved: isAgree = false, ...options } = predictionPreferences;
|
|
53
53
|
const [isApproved, setApproved] = useState(isAgree);
|
|
@@ -74,7 +74,9 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
74
74
|
}
|
|
75
75
|
onClose();
|
|
76
76
|
closeDialog();
|
|
77
|
-
const hideLoading =
|
|
77
|
+
const hideLoading = toaster.showLoading({
|
|
78
|
+
message: `Predict ${predictedSpectra.join(',')} in progress`,
|
|
79
|
+
});
|
|
78
80
|
try {
|
|
79
81
|
const data = await predictSpectra(molfile, values.spectra);
|
|
80
82
|
dispatch({
|
|
@@ -88,7 +90,7 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
92
|
catch (error) {
|
|
91
|
-
|
|
93
|
+
toaster.show({ message: error?.message, intent: 'danger' });
|
|
92
94
|
}
|
|
93
95
|
finally {
|
|
94
96
|
hideLoading();
|
|
@@ -96,14 +98,14 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
96
98
|
}
|
|
97
99
|
})();
|
|
98
100
|
}, [
|
|
99
|
-
alert,
|
|
100
|
-
dispatch,
|
|
101
|
-
isApproved,
|
|
102
101
|
molecule,
|
|
103
|
-
onClose,
|
|
104
|
-
logger,
|
|
105
102
|
setPredictionPreferences,
|
|
103
|
+
isApproved,
|
|
104
|
+
onClose,
|
|
106
105
|
closeDialog,
|
|
106
|
+
toaster,
|
|
107
|
+
dispatch,
|
|
108
|
+
logger,
|
|
107
109
|
]);
|
|
108
110
|
return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(SvgNmrFt, {}), title: "Predict spectra", onClick: openDialog }) }), _jsxs(Dialog, { isOpen: isOpenDialog, onClose: () => {
|
|
109
111
|
onClose();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { LabelStyle } from '../elements/Label';
|
|
2
2
|
export declare const labelStyle: LabelStyle;
|
|
3
3
|
interface SaveAsModalProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
name: string;
|
|
4
|
+
onCloseDialog: () => void;
|
|
5
|
+
isOpen: boolean;
|
|
7
6
|
}
|
|
8
|
-
declare function SaveAsModal(
|
|
7
|
+
declare function SaveAsModal(props: SaveAsModalProps): import("@emotion/react/jsx-runtime").JSX.Element | undefined;
|
|
9
8
|
export default SaveAsModal;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { Field, Formik } from 'formik';
|
|
5
|
-
import {
|
|
6
|
+
import { useRef } from 'react';
|
|
6
7
|
import { DataExportOptions } from '../../data/SpectraManager';
|
|
7
8
|
import { useChartData } from '../context/ChartContext';
|
|
8
9
|
import ActionButtons from '../elements/ActionButtons';
|
|
9
|
-
import { CloseButton } from '../elements/CloseButton';
|
|
10
10
|
import Label from '../elements/Label';
|
|
11
11
|
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
12
12
|
import FormikInput from '../elements/formik/FormikInput';
|
|
13
|
-
import
|
|
13
|
+
import useExport from '../hooks/useExport';
|
|
14
14
|
const styles = css `
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
label {
|
|
19
|
+
margin-right: 20px;
|
|
20
|
+
display: inline-block;
|
|
21
|
+
}
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
23
|
+
input[type='radio'] {
|
|
24
|
+
margin-right: 5px;
|
|
28
25
|
}
|
|
29
26
|
`;
|
|
30
27
|
const INITIAL_VALUE = {
|
|
@@ -41,7 +38,6 @@ export const labelStyle = {
|
|
|
41
38
|
label: {
|
|
42
39
|
flex: 4,
|
|
43
40
|
fontSize: '12px',
|
|
44
|
-
fontWeight: 'bold',
|
|
45
41
|
color: '#232323',
|
|
46
42
|
},
|
|
47
43
|
wrapper: {
|
|
@@ -51,21 +47,25 @@ export const labelStyle = {
|
|
|
51
47
|
},
|
|
52
48
|
container: { padding: '5px 0' },
|
|
53
49
|
};
|
|
54
|
-
function SaveAsModal(
|
|
50
|
+
function SaveAsModal(props) {
|
|
51
|
+
const { onCloseDialog, isOpen } = props;
|
|
55
52
|
const refForm = useRef();
|
|
56
|
-
const { source } = useChartData();
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
const { source, data } = useChartData();
|
|
54
|
+
const { saveHandler } = useExport();
|
|
55
|
+
const fileName = data[0]?.info?.name;
|
|
56
|
+
function submitHandler(values) {
|
|
57
|
+
saveHandler(values);
|
|
58
|
+
onCloseDialog?.();
|
|
59
|
+
}
|
|
60
|
+
if (!isOpen)
|
|
61
|
+
return;
|
|
62
|
+
return (_jsxs(Dialog, { isOpen: true, title: "Save as ... ", onClose: onCloseDialog, style: { width: 500 }, children: [_jsx(DialogBody, { css: css `
|
|
63
|
+
background-color: white;
|
|
64
|
+
`, children: _jsx(Formik, { innerRef: refForm, initialValues: { ...INITIAL_VALUE, name: fileName }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { style: labelStyle, title: "Name", children: _jsx(FormikInput, { name: "name", className: "name", style: {
|
|
65
65
|
inputWrapper: { width: '100%' },
|
|
66
66
|
input: { padding: '5px', textAlign: 'left' },
|
|
67
|
-
} }) }), _jsx(Label, { style: labelStyle, title: "Compressed", children: _jsx(FormikCheckBox, { name: "compressed" }) }), _jsx(Label, { style: labelStyle, title: "Pretty
|
|
67
|
+
} }) }), _jsx(Label, { style: labelStyle, title: "Compressed", children: _jsx(FormikCheckBox, { name: "compressed" }) }), _jsx(Label, { style: labelStyle, title: "Pretty format", children: _jsx(FormikCheckBox, { name: "pretty" }) }), _jsx(Label, { style: labelStyle, title: "Include view", children: _jsx(FormikCheckBox, { name: "include.view" }) }), _jsx(Label, { style: labelStyle, title: "Include settings", children: _jsx(FormikCheckBox, { name: "include.settings" }) }), _jsx(Label, { style: labelStyle, title: "Include data", children: _jsx("div", { css: styles, children: _jsxs("div", { children: [_jsxs("label", { children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.ROW_DATA }), "Raw data"] }), _jsxs("label", { style: {
|
|
68
68
|
color: source ? 'black' : 'lightgray',
|
|
69
|
-
}, children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.DATA_SOURCE, disabled: !source }), "Data
|
|
69
|
+
}, children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.DATA_SOURCE, disabled: !source }), "Data source"] }), _jsxs("label", { children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.NO_DATA }), "No data"] })] }) }) })] }) }) }), _jsx(DialogFooter, { children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onCloseDialog?.() }) })] }));
|
|
70
70
|
}
|
|
71
71
|
export default SaveAsModal;
|
|
@@ -16,7 +16,7 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
|
16
16
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
17
17
|
import { hasCouplingConstant } from '../../panels/extra/utilities/MultiplicityUtilities';
|
|
18
18
|
import { formatNumber } from '../../utility/formatNumber';
|
|
19
|
-
import
|
|
19
|
+
import SignalsContent from './forms/components/SignalsContent';
|
|
20
20
|
import editRangeFormValidation from './forms/validation/EditRangeValidation';
|
|
21
21
|
const styles = css `
|
|
22
22
|
min-height: 500px;
|
|
@@ -154,7 +154,7 @@ function EditRangeModal({ onSave, onClose, onZoom, onRest, rangeId, }) {
|
|
|
154
154
|
if (!rangesPreferences || !range) {
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(
|
|
157
|
+
return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(SignalsContent, { range: range }), _jsx(FormikOnChange, { onChange: changeHandler })] }) })] }));
|
|
158
158
|
}
|
|
159
159
|
function useRange(rangeId) {
|
|
160
160
|
const { ranges } = useSpectrum({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface DeltaInputProps {
|
|
2
2
|
signal: any;
|
|
3
3
|
index: number;
|
|
4
|
-
onFocus: (element: any) => void;
|
|
5
4
|
}
|
|
6
|
-
declare function DeltaInput({ signal, index
|
|
7
|
-
export
|
|
5
|
+
export declare function DeltaInput({ signal, index }: DeltaInputProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -11,9 +11,8 @@ const style = {
|
|
|
11
11
|
margin: '0 5px',
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
|
-
function DeltaInput({ signal, index
|
|
15
|
-
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx("span", { children: "\uD835\uDEC5: " }), _jsx(FormikInput, { name: `signals.${index}.delta`, type: "number", placeholder: 'J (Hz)',
|
|
14
|
+
export function DeltaInput({ signal, index }) {
|
|
15
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx("span", { children: "\uD835\uDEC5: " }), _jsx(FormikInput, { name: `signals.${index}.delta`, type: "number", placeholder: 'J (Hz)', style: style, checkErrorAfterInputTouched: false }), _jsx("span", { children: signal.js
|
|
16
16
|
.map((_coupling) => translateMultiplet(_coupling.multiplicity))
|
|
17
17
|
.join('') })] }));
|
|
18
18
|
}
|
|
19
|
-
export default DeltaInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function InfoBlock(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -24,11 +24,11 @@ const InfoText = (props) => {
|
|
|
24
24
|
const { value, type = 'info' } = props;
|
|
25
25
|
return (_jsx("p", { style: { ...styles.infoText, ...(type === 'error' && styles.errorText) }, children: value }));
|
|
26
26
|
};
|
|
27
|
-
export function
|
|
27
|
+
export function InfoBlock() {
|
|
28
28
|
const { values, errors, } = useFormikContext();
|
|
29
29
|
return (_jsx("div", { style: {
|
|
30
30
|
textAlign: 'center',
|
|
31
31
|
width: '100%',
|
|
32
32
|
}, children: errors.signals &&
|
|
33
|
-
(errors.signals.noSignals || errors.signals.noCouplings) ? (_jsxs("div", { children: [_jsx("p", { className: "error-text", children: errors.signals.noSignals || errors.signals.noCouplings[0].message }), errors.signals.noSignals && (_jsx(InfoText, { value: ADD_SIGNAL_INFO_TEXT }))] })) : values.
|
|
33
|
+
(errors.signals.noSignals || errors.signals.noCouplings) ? (_jsxs("div", { children: [_jsx("p", { className: "error-text", children: errors.signals.noSignals || errors.signals.noCouplings[0].message }), errors.signals.noSignals && (_jsx(InfoText, { value: ADD_SIGNAL_INFO_TEXT }))] })) : values.signalIndex === '-1' ? (_jsx(InfoText, { value: ADD_SIGNAL_INFO_TEXT })) : (_jsx(InfoText, { value: EDIT_SIGNAL_INFO_TEXT })) }));
|
|
34
34
|
}
|