nmrium 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- 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 +29 -15
- package/lib/component/context/ToasterContext.d.ts +13 -0
- package/lib/component/context/ToasterContext.js +34 -0
- package/lib/component/elements/CloseButton.d.ts +2 -2
- package/lib/component/elements/CloseButton.js +1 -1
- package/lib/component/elements/CounterLabel.d.ts +3 -3
- package/lib/component/elements/CounterLabel.js +3 -3
- package/lib/component/elements/PreferencesButton.d.ts +2 -2
- package/lib/component/elements/PreferencesButton.js +2 -4
- package/lib/component/elements/SaveButton.d.ts +2 -2
- package/lib/component/elements/SaveButton.js +1 -1
- package/lib/component/elements/Select.js +2 -2
- package/lib/component/elements/ToolBarButton.d.ts +1 -8
- package/lib/component/elements/ToolBarButton.js +2 -11
- package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
- package/lib/component/elements/ToolbarPopoverItem.js +10 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.js +6 -3
- 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 +6 -3
- 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.js +6 -4
- 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/CopyClipboardModal.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 +6 -4
- 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/aboutUs/AboutUsModal.js +1 -1
- 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/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 +7 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +48 -14
- package/lib/component/panels/RangesPanel/RangesHeader.js +73 -13
- package/lib/component/panels/RangesPanel/RangesPanel.js +4 -4
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +49 -8
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +11 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
- package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
- package/lib/component/panels/filtersPanel/FilterPanel.js +6 -4
- package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
- package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +6 -4
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +3 -3
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +36 -7
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +4 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
- package/lib/component/reducer/Reducer.d.ts +2 -2
- package/lib/component/reducer/Reducer.js +23 -16
- 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.d.ts +1 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -2
- package/lib/component/reducer/actions/MoleculeActions.js +0 -1
- package/lib/component/reducer/actions/RangesActions.js +16 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +3 -3
- package/lib/component/reducer/actions/ToolsActions.js +75 -14
- 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 +241 -8
- package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
- package/lib/component/toolbar/toolbarMenu.js +77 -0
- package/lib/component/utility/Events.d.ts +11 -0
- package/lib/component/utility/Events.js +22 -0
- package/lib/component/utility/booleanToString.d.ts +6 -0
- package/lib/component/utility/booleanToString.js +4 -0
- 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 +3 -3
- 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 +31 -30
- package/lib/component/elements/DeleteButton.d.ts +0 -6
- package/lib/component/elements/DeleteButton.js +0 -8
- package/lib/component/elements/DropdownMenu.d.ts +0 -9
- package/lib/component/elements/DropdownMenu.js +0 -7
- package/lib/component/elements/FilterButton.d.ts +0 -6
- package/lib/component/elements/FilterButton.js +0 -8
- 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/PeaksPanel/PeaksToggleActions.d.ts +0 -12
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
- package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
- package/lib/component/toolbar/BasicToolBar.js +0 -165
- package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
- package/lib/component/toolbar/FunctionToolBar.js +0 -148
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import debounce from 'lodash/debounce';
|
|
5
|
+
import { Filters } from 'nmr-processing';
|
|
6
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
+
import { FaRulerHorizontal, FaRulerVertical } from 'react-icons/fa';
|
|
8
|
+
import { MdLooksTwo } from 'react-icons/md';
|
|
9
|
+
import { Toolbar } from 'react-science/ui';
|
|
4
10
|
import { useActivePhaseTraces } from '../2d/1d-tracer/phase-correction-traces/useActivePhaseTraces';
|
|
5
11
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
12
|
import ActionButtons from '../elements/ActionButtons';
|
|
7
13
|
import Input from '../elements/Input';
|
|
8
14
|
import InputRange from '../elements/InputRange';
|
|
9
15
|
import Label from '../elements/Label';
|
|
10
|
-
import
|
|
16
|
+
import { useFilter } from '../hooks/useFilter';
|
|
11
17
|
import useSpectrum from '../hooks/useSpectrum';
|
|
12
18
|
import { headerLabelStyle } from './Header';
|
|
13
19
|
import { HeaderContainer } from './HeaderContainer';
|
|
14
|
-
const selectStyle = {
|
|
15
|
-
marginLeft: '5px',
|
|
16
|
-
marginRight: '10px',
|
|
17
|
-
border: 'none',
|
|
18
|
-
height: '20px',
|
|
19
|
-
};
|
|
20
20
|
const inputStyle = {
|
|
21
21
|
input: {
|
|
22
22
|
width: '70px',
|
|
@@ -26,62 +26,110 @@ const inputStyle = {
|
|
|
26
26
|
height: '100%',
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
|
-
const TRACE_DIRECTIONS = ['horizontal', 'vertical'].map((key) => ({
|
|
30
|
-
label: stringCapitalize(key),
|
|
31
|
-
value: key,
|
|
32
|
-
}));
|
|
33
29
|
const emptyData = { datum: {}, filter: null };
|
|
30
|
+
const defaultPhaseOptions = {
|
|
31
|
+
horizontal: { ph0: 0, ph1: 0 },
|
|
32
|
+
vertical: { ph0: 0, ph1: 0 },
|
|
33
|
+
};
|
|
34
34
|
export default function PhaseCorrectionTwoDimensionsPanel() {
|
|
35
|
-
const {
|
|
35
|
+
const { activeTraceDirection, pivot, addTracesToBothDirections } = useActivePhaseTraces();
|
|
36
36
|
const { data } = useSpectrum(emptyData);
|
|
37
|
-
const
|
|
37
|
+
const filter = useFilter(Filters.phaseCorrectionTwoDimensions.id);
|
|
38
|
+
const debounceCalculation = useRef(debounce((options) => {
|
|
39
|
+
dispatch({
|
|
40
|
+
type: 'CALCULATE_TOW_DIMENSIONS_MANUAL_PHASE_CORRECTION_FILTER',
|
|
41
|
+
payload: { ...options, applyOn2D: true },
|
|
42
|
+
});
|
|
43
|
+
}, 250));
|
|
38
44
|
const dispatch = useDispatch();
|
|
39
|
-
const [value, setValue] = useState(
|
|
40
|
-
const valueRef = useRef(
|
|
45
|
+
const [value, setValue] = useState(defaultPhaseOptions);
|
|
46
|
+
const valueRef = useRef(defaultPhaseOptions);
|
|
41
47
|
const ph0Ref = useRef();
|
|
42
48
|
const ph1Ref = useRef();
|
|
43
49
|
useEffect(() => {
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
if (filter) {
|
|
51
|
+
const { value } = filter;
|
|
52
|
+
const phaseOptions = defaultPhaseOptions;
|
|
53
|
+
for (const direction of Object.keys(value)) {
|
|
54
|
+
const { ph0, ph1 } = value[direction];
|
|
55
|
+
phaseOptions[direction] = { ph0, ph1 };
|
|
56
|
+
}
|
|
57
|
+
setValue(phaseOptions);
|
|
58
|
+
valueRef.current = phaseOptions;
|
|
59
|
+
}
|
|
60
|
+
}, [filter]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (ph0Ref.current && ph1Ref.current) {
|
|
63
|
+
const { ph0, ph1 } = valueRef.current[activeTraceDirection];
|
|
64
|
+
ph0Ref.current.setValue(ph0);
|
|
65
|
+
ph1Ref.current.setValue(ph1);
|
|
47
66
|
}
|
|
48
|
-
}, [
|
|
49
|
-
const calcPhaseCorrectionHandler = useCallback((
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
}, [activeTraceDirection]);
|
|
68
|
+
const calcPhaseCorrectionHandler = useCallback((inputValue, filedName, source) => {
|
|
69
|
+
const newValue = inputValue[activeTraceDirection];
|
|
70
|
+
if (filedName === 'ph1' && data && pivot) {
|
|
71
|
+
const datum = data.rr;
|
|
72
|
+
const nbPoints = activeTraceDirection === 'horizontal'
|
|
73
|
+
? datum.z[0].length
|
|
74
|
+
: datum.z.length;
|
|
75
|
+
const { ph0, ph1 } = valueRef.current[activeTraceDirection];
|
|
76
|
+
const diff0 = newValue.ph0 - ph0;
|
|
77
|
+
const diff1 = newValue.ph1 - ph1;
|
|
78
|
+
newValue.ph0 += diff0 - (diff1 * (nbPoints - pivot?.index)) / nbPoints;
|
|
55
79
|
}
|
|
56
80
|
dispatch({
|
|
57
81
|
type: 'CALCULATE_TOW_DIMENSIONS_MANUAL_PHASE_CORRECTION_FILTER',
|
|
58
|
-
payload:
|
|
82
|
+
payload: { ...newValue, applyOn2D: source === 'input' },
|
|
59
83
|
});
|
|
60
|
-
|
|
84
|
+
if (source === 'inputRange') {
|
|
85
|
+
debounceCalculation.current(newValue);
|
|
86
|
+
}
|
|
87
|
+
}, [activeTraceDirection, data, dispatch, pivot]);
|
|
61
88
|
const updateInputRangeInitialValue = useCallback((value) => {
|
|
62
89
|
// update InputRange initial value
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
90
|
+
const { ph0, ph1 } = value[activeTraceDirection];
|
|
91
|
+
ph0Ref.current.setValue(ph0);
|
|
92
|
+
ph1Ref.current.setValue(ph1);
|
|
93
|
+
}, [activeTraceDirection]);
|
|
66
94
|
const handleInput = useCallback((e) => {
|
|
67
95
|
const { name, value } = e.target;
|
|
68
96
|
if (e.target) {
|
|
69
|
-
const newValue = {
|
|
97
|
+
const newValue = {
|
|
98
|
+
...valueRef.current,
|
|
99
|
+
[activeTraceDirection]: {
|
|
100
|
+
...valueRef.current[activeTraceDirection],
|
|
101
|
+
[name]: Number(value),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
70
104
|
if (String(value).trim() !== '-') {
|
|
71
|
-
calcPhaseCorrectionHandler(newValue, name);
|
|
105
|
+
calcPhaseCorrectionHandler(newValue, name, 'input');
|
|
72
106
|
}
|
|
73
107
|
updateInputRangeInitialValue(newValue);
|
|
74
108
|
valueRef.current = newValue;
|
|
75
109
|
setValue(valueRef.current);
|
|
76
110
|
}
|
|
77
|
-
}, [
|
|
111
|
+
}, [
|
|
112
|
+
activeTraceDirection,
|
|
113
|
+
calcPhaseCorrectionHandler,
|
|
114
|
+
updateInputRangeInitialValue,
|
|
115
|
+
]);
|
|
78
116
|
const handleRangeChange = useCallback((e) => {
|
|
79
|
-
const newValue = {
|
|
80
|
-
|
|
117
|
+
const newValue = {
|
|
118
|
+
...valueRef.current,
|
|
119
|
+
[activeTraceDirection]: {
|
|
120
|
+
...valueRef.current[activeTraceDirection],
|
|
121
|
+
[e.name]: e.value,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
calcPhaseCorrectionHandler(newValue, e.name, 'inputRange');
|
|
81
125
|
updateInputRangeInitialValue(newValue);
|
|
82
126
|
valueRef.current = newValue;
|
|
83
127
|
setValue(valueRef.current);
|
|
84
|
-
}, [
|
|
128
|
+
}, [
|
|
129
|
+
activeTraceDirection,
|
|
130
|
+
calcPhaseCorrectionHandler,
|
|
131
|
+
updateInputRangeInitialValue,
|
|
132
|
+
]);
|
|
85
133
|
const handleCancelFilter = useCallback(() => {
|
|
86
134
|
dispatch({
|
|
87
135
|
type: 'RESET_SELECTED_TOOL',
|
|
@@ -93,9 +141,15 @@ export default function PhaseCorrectionTwoDimensionsPanel() {
|
|
|
93
141
|
payload: { direction },
|
|
94
142
|
});
|
|
95
143
|
}
|
|
96
|
-
/*eslint-disable unicorn/consistent-function-scoping */
|
|
97
144
|
function handleApplyFilter() {
|
|
98
|
-
|
|
145
|
+
dispatch({ type: 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER' });
|
|
146
|
+
}
|
|
147
|
+
function handleToggleAddTraceToBothDirections() {
|
|
148
|
+
dispatch({ type: 'TOGGLE_ADD_PHASE_CORRECTION_TRACE_TO_BOTH_DIRECTIONS' });
|
|
99
149
|
}
|
|
100
|
-
return (_jsxs(HeaderContainer, {
|
|
150
|
+
return (_jsxs(HeaderContainer, { style: { padding: '0 5px' }, children: [_jsx(Label, { title: "Direction :", style: headerLabelStyle, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { css: css `
|
|
151
|
+
border: 1px solid #f7f7f7;
|
|
152
|
+
`, title: "Horizontal", icon: _jsx(FaRulerHorizontal, {}), active: activeTraceDirection === 'horizontal', onClick: () => onChangeHandler('horizontal') }), _jsx(Toolbar.Item, { css: css `
|
|
153
|
+
border: 1px solid #f7f7f7;
|
|
154
|
+
`, title: "Vertical", icon: _jsx(FaRulerVertical, {}), active: activeTraceDirection === 'vertical', onClick: () => onChangeHandler('vertical') })] }) }), _jsx("div", { style: { paddingRight: '5px' }, children: _jsx(Toolbar, { children: _jsx(Toolbar.Item, { title: "Add the trace in both directions", icon: _jsx(MdLooksTwo, {}), active: addTracesToBothDirections, onClick: handleToggleAddTraceToBothDirections }) }) }), _jsx(Label, { title: "PH0 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph0", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph1", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph1, type: "number", debounceTime: 250 }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change PH0 (click and drag)", shortLabel: "Ph0", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change PH1 (click and drag)", shortLabel: "Ph1", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
|
|
101
155
|
}
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Formik } from 'formik';
|
|
3
3
|
import * as Yup from 'yup';
|
|
4
4
|
import { useDispatch } from '../context/DispatchContext';
|
|
5
|
+
import { useToaster } from '../context/ToasterContext';
|
|
5
6
|
import Button from '../elements/Button';
|
|
6
7
|
import Label from '../elements/Label';
|
|
7
8
|
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
8
9
|
import FormikInput from '../elements/formik/FormikInput';
|
|
9
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
10
10
|
import { MIN_AREA_POINTS, useCheckPointsNumberInWindowArea, } from '../hooks/useCheckPointsNumberInWindowArea';
|
|
11
11
|
import { headerLabelStyle } from './Header';
|
|
12
12
|
import { HeaderContainer } from './HeaderContainer';
|
|
@@ -20,7 +20,7 @@ const initialValues = {
|
|
|
20
20
|
function RangesPickingOptionPanel() {
|
|
21
21
|
const dispatch = useDispatch();
|
|
22
22
|
const pointsNumber = useCheckPointsNumberInWindowArea();
|
|
23
|
-
const
|
|
23
|
+
const toaster = useToaster();
|
|
24
24
|
function handleRangesPicking(values) {
|
|
25
25
|
if (pointsNumber > MIN_AREA_POINTS) {
|
|
26
26
|
dispatch({
|
|
@@ -29,7 +29,10 @@ function RangesPickingOptionPanel() {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
|
|
32
|
+
toaster.show({
|
|
33
|
+
message: `Auto range picking only available for area more than ${MIN_AREA_POINTS} points`,
|
|
34
|
+
intent: 'danger',
|
|
35
|
+
});
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
return (_jsx(HeaderContainer, { children: _jsx(Formik, { onSubmit: handleRangesPicking, initialValues: initialValues, validationSchema: validationSchema, children: ({ handleSubmit, isValid }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Detect negative:", htmlFor: "lookNegative", style: headerLabelStyle, children: _jsx(FormikCheckBox, { name: "lookNegative" }) }), _jsx(Label, { title: "Min Max Ratio:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "minMaxRatio", style: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
export function useDialogToggle(initState) {
|
|
3
|
+
const [dialog, setDialogState] = useState(initState);
|
|
4
|
+
function openDialog(id) {
|
|
5
|
+
const newState = { ...dialog, [id]: true };
|
|
6
|
+
setDialogState(newState);
|
|
7
|
+
}
|
|
8
|
+
function closeDialog() {
|
|
9
|
+
const newState = {};
|
|
10
|
+
for (const id in dialog) {
|
|
11
|
+
newState[id] = false;
|
|
12
|
+
}
|
|
13
|
+
setDialogState(newState);
|
|
14
|
+
}
|
|
15
|
+
return { dialog, closeDialog, openDialog };
|
|
16
|
+
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { ExportOptions } from '../../data/SpectraManager';
|
|
2
|
+
interface SaveOptions {
|
|
3
|
+
include: ExportOptions;
|
|
4
|
+
name: string;
|
|
5
|
+
compressed: boolean;
|
|
6
|
+
pretty: boolean;
|
|
7
|
+
}
|
|
1
8
|
export default function useExport(): {
|
|
2
9
|
saveToClipboardHandler: () => Promise<void>;
|
|
3
10
|
saveAsJSONHandler: (spaceIndent?: number, isCompressed?: boolean) => void;
|
|
4
11
|
saveAsSVGHandler: () => Promise<void>;
|
|
5
12
|
saveAsPNGHandler: () => Promise<void>;
|
|
6
|
-
|
|
13
|
+
saveHandler: (options: SaveOptions) => void;
|
|
7
14
|
};
|
|
15
|
+
export {};
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { useCallback } from 'react';
|
|
3
2
|
import { toJSON } from '../../data/SpectraManager';
|
|
4
3
|
import { useChartData } from '../context/ChartContext';
|
|
5
4
|
import { useGlobal } from '../context/GlobalContext';
|
|
6
5
|
import { usePreferences } from '../context/PreferencesContext';
|
|
7
|
-
import {
|
|
8
|
-
import { positions, useModal } from '../elements/popup/Modal';
|
|
9
|
-
import SaveAsModal from '../modal/SaveAsModal';
|
|
6
|
+
import { useToaster } from '../context/ToasterContext';
|
|
10
7
|
import { copyPNGToClipboard, exportAsJSON, exportAsPng, exportAsSVG, } from '../utility/export';
|
|
11
8
|
export default function useExport() {
|
|
12
9
|
const { rootRef } = useGlobal();
|
|
13
|
-
const
|
|
14
|
-
const alert = useAlert();
|
|
10
|
+
const toaster = useToaster();
|
|
15
11
|
const state = useChartData();
|
|
16
12
|
const preferencesState = usePreferences();
|
|
17
13
|
const saveToClipboardHandler = useCallback(async () => {
|
|
18
14
|
if (state.data.length > 0 && rootRef) {
|
|
19
|
-
const hideLoading =
|
|
15
|
+
const hideLoading = toaster.showLoading({
|
|
16
|
+
message: 'Exporting as NMRium process in progress',
|
|
17
|
+
});
|
|
20
18
|
setTimeout(async () => {
|
|
21
19
|
await copyPNGToClipboard(rootRef, 'nmrSVG');
|
|
22
20
|
hideLoading();
|
|
23
|
-
|
|
21
|
+
toaster.show({
|
|
22
|
+
message: 'Image copied to clipboard',
|
|
23
|
+
intent: 'success',
|
|
24
|
+
});
|
|
24
25
|
}, 0);
|
|
25
26
|
}
|
|
26
|
-
}, [
|
|
27
|
+
}, [state.data.length, rootRef, toaster]);
|
|
27
28
|
const saveAsJSONHandler = useCallback((spaceIndent = 0, isCompressed = true) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const hideLoading = toaster.showLoading({
|
|
30
|
+
message: 'Exporting as NMRium process in progress',
|
|
31
|
+
});
|
|
32
|
+
try {
|
|
33
|
+
void (async () => {
|
|
33
34
|
const fileName = state.data[0]?.info?.name;
|
|
34
35
|
const exportedData = toJSON(state, preferencesState, {
|
|
35
36
|
exportTarget: 'nmrium',
|
|
@@ -37,37 +38,42 @@ export default function useExport() {
|
|
|
37
38
|
});
|
|
38
39
|
await exportAsJSON(exportedData, fileName, spaceIndent, isCompressed);
|
|
39
40
|
hideLoading();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}, [alert, preferencesState, state]);
|
|
41
|
+
})();
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
reportError(error);
|
|
45
|
+
}
|
|
46
|
+
}, [preferencesState, state, toaster]);
|
|
47
47
|
const saveAsSVGHandler = useCallback(async () => {
|
|
48
48
|
if (state.data.length > 0 && rootRef) {
|
|
49
|
-
const hideLoading =
|
|
49
|
+
const hideLoading = toaster.showLoading({
|
|
50
|
+
message: 'Exporting as SVG process in progress',
|
|
51
|
+
});
|
|
50
52
|
setTimeout(() => {
|
|
51
53
|
const fileName = state.data[0]?.info?.name;
|
|
52
54
|
exportAsSVG(rootRef, 'nmrSVG', fileName);
|
|
53
55
|
hideLoading();
|
|
54
56
|
}, 0);
|
|
55
57
|
}
|
|
56
|
-
}, [
|
|
58
|
+
}, [state.data, rootRef, toaster]);
|
|
57
59
|
const saveAsPNGHandler = useCallback(async () => {
|
|
58
60
|
if (state.data.length > 0 && rootRef) {
|
|
59
|
-
const hideLoading =
|
|
61
|
+
const hideLoading = toaster.showLoading({
|
|
62
|
+
message: 'Exporting as PNG process in progress',
|
|
63
|
+
});
|
|
60
64
|
setTimeout(() => {
|
|
61
65
|
const fileName = state.data[0]?.info?.name;
|
|
62
66
|
exportAsPng(rootRef, 'nmrSVG', fileName);
|
|
63
67
|
hideLoading();
|
|
64
68
|
}, 0);
|
|
65
69
|
}
|
|
66
|
-
}, [
|
|
70
|
+
}, [state.data, rootRef, toaster]);
|
|
67
71
|
const saveHandler = useCallback((options) => {
|
|
68
72
|
async function handler() {
|
|
69
73
|
const { name, pretty, compressed, include } = options;
|
|
70
|
-
const hideLoading =
|
|
74
|
+
const hideLoading = toaster.showLoading({
|
|
75
|
+
message: `Exporting as ${name}.nmrium process in progress`,
|
|
76
|
+
});
|
|
71
77
|
setTimeout(() => {
|
|
72
78
|
void (async () => {
|
|
73
79
|
const exportedData = toJSON(state, preferencesState, {
|
|
@@ -81,20 +87,12 @@ export default function useExport() {
|
|
|
81
87
|
}, 0);
|
|
82
88
|
}
|
|
83
89
|
void handler();
|
|
84
|
-
}, [
|
|
85
|
-
const saveAsHandler = useCallback(async () => {
|
|
86
|
-
const fileName = state.data[0]?.info?.name;
|
|
87
|
-
modal.show(_jsx(SaveAsModal, { name: fileName, onSave: saveHandler }), {
|
|
88
|
-
isBackgroundBlur: false,
|
|
89
|
-
position: positions.TOP_CENTER,
|
|
90
|
-
width: 500,
|
|
91
|
-
});
|
|
92
|
-
}, [modal, saveHandler, state.data]);
|
|
90
|
+
}, [preferencesState, state, toaster]);
|
|
93
91
|
return {
|
|
94
92
|
saveToClipboardHandler,
|
|
95
93
|
saveAsJSONHandler,
|
|
96
94
|
saveAsSVGHandler,
|
|
97
95
|
saveAsPNGHandler,
|
|
98
|
-
|
|
96
|
+
saveHandler,
|
|
99
97
|
};
|
|
100
98
|
}
|
|
@@ -5,8 +5,8 @@ import { useRef, forwardRef } from 'react';
|
|
|
5
5
|
import { useOnOff } from 'react-science/ui';
|
|
6
6
|
import * as Yup from 'yup';
|
|
7
7
|
import { usePreferences } from '../context/PreferencesContext';
|
|
8
|
+
import { useToaster } from '../context/ToasterContext';
|
|
8
9
|
import FormikInput from '../elements/formik/FormikInput';
|
|
9
|
-
import { useAlert } from '../elements/popup/Alert/Context';
|
|
10
10
|
import ConfirmationDialog from '../elements/popup/Modal/ConfirmDialog';
|
|
11
11
|
const schema = Yup.object().shape({
|
|
12
12
|
workspaceName: Yup.string().required(),
|
|
@@ -22,7 +22,7 @@ const WorkspaceAddForm = forwardRef(({ className, message, onSave }, ref) => {
|
|
|
22
22
|
}, autoFocus: true }) })] }));
|
|
23
23
|
});
|
|
24
24
|
export function useSaveSettings() {
|
|
25
|
-
const
|
|
25
|
+
const toaster = useToaster();
|
|
26
26
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
27
27
|
const settingsRef = useRef();
|
|
28
28
|
const { dispatch, current } = usePreferences();
|
|
@@ -36,7 +36,10 @@ export function useSaveSettings() {
|
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
closeDialog();
|
|
39
|
-
|
|
39
|
+
toaster.show({
|
|
40
|
+
message: 'Preferences saved successfully',
|
|
41
|
+
intent: 'success',
|
|
42
|
+
});
|
|
40
43
|
}
|
|
41
44
|
return {
|
|
42
45
|
saveSettings: (values) => {
|
|
@@ -4,12 +4,12 @@ import { useCallback, useRef, useState } from 'react';
|
|
|
4
4
|
import { useToggleAccordion } from 'react-science/ui';
|
|
5
5
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
6
|
import { usePreferences } from '../context/PreferencesContext';
|
|
7
|
-
import {
|
|
7
|
+
import { useToaster } from '../context/ToasterContext';
|
|
8
8
|
import { TOOLS_PANELS_ACCORDION } from '../panels/Panels';
|
|
9
9
|
import { options } from '../toolbar/ToolTypes';
|
|
10
10
|
export default function useToolsFunctions() {
|
|
11
11
|
const dispatch = useDispatch();
|
|
12
|
-
const
|
|
12
|
+
const toaster = useToaster();
|
|
13
13
|
const { open: openPanel } = useToggleAccordion();
|
|
14
14
|
const [isRealSpectrumShown, setIsRealSpectrumShown] = useState(false);
|
|
15
15
|
const debounceClickEventsRef = useRef({ clicks: [] });
|
|
@@ -22,7 +22,9 @@ export default function useToolsFunctions() {
|
|
|
22
22
|
options.exclusionZones.id,
|
|
23
23
|
options.rangePicking.id,
|
|
24
24
|
].includes(selectedTool)) {
|
|
25
|
-
|
|
25
|
+
toaster.show({
|
|
26
|
+
message: `Press ${!invert ? 'Shift +' : ''} Left Mouse button to select zone`,
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
if (Object.keys(TOOLS_PANELS_ACCORDION).includes(selectedTool)) {
|
|
28
30
|
openPanel(TOOLS_PANELS_ACCORDION[selectedTool]);
|
|
@@ -31,7 +33,7 @@ export default function useToolsFunctions() {
|
|
|
31
33
|
type: 'SET_SELECTED_TOOL',
|
|
32
34
|
payload: { selectedTool: selectedTool || options.zoom.id },
|
|
33
35
|
});
|
|
34
|
-
}, [
|
|
36
|
+
}, [dispatch, invert, openPanel, toaster]);
|
|
35
37
|
const handleFullZoomOut = useCallback(() => {
|
|
36
38
|
if (debounceClickEventsRef.current.clicks.length === 0) {
|
|
37
39
|
dispatch({
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { fileCollectionFromFileList } from 'filelist-utils';
|
|
5
5
|
import { read as readDropFiles } from 'nmr-load-save';
|
|
6
|
-
import { useCallback } from 'react';
|
|
6
|
+
import { useCallback, useState } from 'react';
|
|
7
7
|
import { useDropzone } from 'react-dropzone';
|
|
8
8
|
import { FaUpload } from 'react-icons/fa';
|
|
9
9
|
import { isMetaFile, parseMetaFile } from '../../data/parseMeta';
|
|
@@ -12,10 +12,10 @@ import { useDispatch } from '../context/DispatchContext';
|
|
|
12
12
|
import { LoaderProvider } from '../context/LoaderContext';
|
|
13
13
|
import { useLogger } from '../context/LoggerContext';
|
|
14
14
|
import { usePreferences } from '../context/PreferencesContext';
|
|
15
|
-
import {
|
|
15
|
+
import { useToaster } from '../context/ToasterContext';
|
|
16
16
|
import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
|
|
17
17
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
18
|
-
import {
|
|
18
|
+
import { MetaImportationModal } from '../modal/metaImportation/MetaImportationModal';
|
|
19
19
|
const style = css `
|
|
20
20
|
height: 100%;
|
|
21
21
|
background-color: #b5b5b599;
|
|
@@ -24,7 +24,7 @@ const style = css `
|
|
|
24
24
|
justify-content: center;
|
|
25
25
|
align-items: center;
|
|
26
26
|
flex-flow: column;
|
|
27
|
-
z-index:
|
|
27
|
+
z-index: 8;
|
|
28
28
|
|
|
29
29
|
p {
|
|
30
30
|
color: white;
|
|
@@ -53,14 +53,14 @@ function DropZone(props) {
|
|
|
53
53
|
const { dispatch: dispatchPreferences, current: workspacePreferences } = usePreferences();
|
|
54
54
|
const preferences = usePreferences();
|
|
55
55
|
const isToolEnabled = useCheckToolsVisibility();
|
|
56
|
-
const
|
|
57
|
-
const alert = useAlert();
|
|
56
|
+
const toaster = useToaster();
|
|
58
57
|
const { logger } = useLogger();
|
|
59
58
|
const experimentalFeatures = useCheckExperimentalFeature();
|
|
59
|
+
const [metaInformationFile, openMetaInformationDialog] = useState();
|
|
60
60
|
async function loadFilesHandler(files) {
|
|
61
61
|
try {
|
|
62
62
|
if (files.length === 1 && isMetaFile(files[0])) {
|
|
63
|
-
|
|
63
|
+
openMetaInformationDialog(files[0]);
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
66
|
const fileCollection = await fileCollectionFromFileList(files);
|
|
@@ -98,7 +98,7 @@ function DropZone(props) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
catch (error) {
|
|
101
|
-
|
|
101
|
+
toaster.show({ message: error.message, intent: 'danger' });
|
|
102
102
|
logger.error(error);
|
|
103
103
|
}
|
|
104
104
|
finally {
|
|
@@ -121,11 +121,11 @@ function DropZone(props) {
|
|
|
121
121
|
openImportDialog();
|
|
122
122
|
}
|
|
123
123
|
}, [isImportEnabled, openImportDialog]);
|
|
124
|
-
return (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
return (_jsxs(LoaderProvider, { value: open, children: [metaInformationFile && (_jsx(MetaImportationModal, { isOpen: true, file: metaInformationFile, onCloseDialog: () => openMetaInformationDialog(null) })), _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", { ...getInputProps() }), isDragActive && (_jsxs("div", { css: style, style: {
|
|
125
|
+
width: `${width}px`,
|
|
126
|
+
height: `${height}px`,
|
|
127
|
+
marginTop: '30px',
|
|
128
|
+
marginLeft: '30px',
|
|
129
|
+
}, children: [_jsx(FaUpload, {}), _jsx("p", { children: "Drop your files here" })] })), props.children] })] }));
|
|
130
130
|
}
|
|
131
131
|
export default DropZone;
|
|
@@ -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
|
}
|