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,27 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { useOnOff } from 'react-science/ui';
|
|
2
4
|
import checkModifierKeyActivated from '../../data/utilities/checkModifierKeyActivated';
|
|
3
5
|
import { useAssignmentData } from '../assignment/AssignmentsContext';
|
|
4
6
|
import { useChartData } from '../context/ChartContext';
|
|
5
7
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
8
|
import { useLoader } from '../context/LoaderContext';
|
|
7
9
|
import { usePreferences } from '../context/PreferencesContext';
|
|
8
|
-
import {
|
|
10
|
+
import { useToaster } from '../context/ToasterContext';
|
|
9
11
|
import { useModal } from '../elements/popup/Modal';
|
|
10
12
|
import { HighlightEventSource, useHighlightData } from '../highlight/index';
|
|
11
13
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
12
14
|
import useExport from '../hooks/useExport';
|
|
13
15
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
16
|
+
import SaveAsModal from '../modal/SaveAsModal';
|
|
14
17
|
import { options } from '../toolbar/ToolTypes';
|
|
15
18
|
function KeysListenerTracker(props) {
|
|
16
19
|
const { mainDivRef } = props;
|
|
17
20
|
const { keysPreferences, displayerMode, data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
18
21
|
const dispatch = useDispatch();
|
|
19
22
|
const { dispatch: dispatchPreferences } = usePreferences();
|
|
20
|
-
const
|
|
23
|
+
const toaster = useToaster();
|
|
21
24
|
const modal = useModal();
|
|
22
25
|
const openLoader = useLoader();
|
|
23
|
-
const
|
|
24
|
-
const {
|
|
26
|
+
const [isSaveModalOpened, openSaveAsDialog, closeSaveAsDialog] = useOnOff(false);
|
|
27
|
+
const { handleChangeOption, handleFullZoomOut, alignSpectraVerticallyHandler, changeDisplayViewModeHandler, } = useToolsFunctions();
|
|
28
|
+
const { saveToClipboardHandler, saveAsJSONHandler } = useExport();
|
|
25
29
|
const isToolVisible = useCheckToolsVisibility();
|
|
26
30
|
const { highlight, remove } = useHighlightData();
|
|
27
31
|
const mouseIsOverDisplayer = useRef(false);
|
|
@@ -129,7 +133,9 @@ function KeysListenerTracker(props) {
|
|
|
129
133
|
text: 'Yes, for all spectra',
|
|
130
134
|
handler: async () => {
|
|
131
135
|
if (zone) {
|
|
132
|
-
const hideLoading =
|
|
136
|
+
const hideLoading = toaster.showLoading({
|
|
137
|
+
message: 'Delete all spectra exclusion zones in progress',
|
|
138
|
+
});
|
|
133
139
|
dispatch({
|
|
134
140
|
type: 'DELETE_EXCLUSION_ZONE',
|
|
135
141
|
payload: {
|
|
@@ -144,7 +150,9 @@ function KeysListenerTracker(props) {
|
|
|
144
150
|
text: 'Yes',
|
|
145
151
|
handler: async () => {
|
|
146
152
|
if (spectrumID) {
|
|
147
|
-
const hideLoading =
|
|
153
|
+
const hideLoading = toaster.showLoading({
|
|
154
|
+
message: 'Delete exclusion zones in progress',
|
|
155
|
+
});
|
|
148
156
|
dispatch({
|
|
149
157
|
type: 'DELETE_EXCLUSION_ZONE',
|
|
150
158
|
payload: {
|
|
@@ -171,7 +179,9 @@ function KeysListenerTracker(props) {
|
|
|
171
179
|
text: 'Yes',
|
|
172
180
|
handler: async () => {
|
|
173
181
|
if (zone) {
|
|
174
|
-
const hideLoading =
|
|
182
|
+
const hideLoading = toaster.showLoading({
|
|
183
|
+
message: 'Delete all spectra exclusion zones in progress',
|
|
184
|
+
});
|
|
175
185
|
dispatchPreferences({
|
|
176
186
|
type: 'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE',
|
|
177
187
|
payload: {
|
|
@@ -232,7 +242,7 @@ function KeysListenerTracker(props) {
|
|
|
232
242
|
remove,
|
|
233
243
|
assignmentData,
|
|
234
244
|
modal,
|
|
235
|
-
|
|
245
|
+
toaster,
|
|
236
246
|
dispatchPreferences,
|
|
237
247
|
activeTab,
|
|
238
248
|
]);
|
|
@@ -245,7 +255,9 @@ function KeysListenerTracker(props) {
|
|
|
245
255
|
keyCode: num,
|
|
246
256
|
},
|
|
247
257
|
});
|
|
248
|
-
|
|
258
|
+
toaster.show({
|
|
259
|
+
message: `Configuration Reset, press '${num}' again to reload it.`,
|
|
260
|
+
});
|
|
249
261
|
}
|
|
250
262
|
else if (!checkModifierKeyActivated(e)) {
|
|
251
263
|
if (keysPreferences?.[num]) {
|
|
@@ -263,11 +275,13 @@ function KeysListenerTracker(props) {
|
|
|
263
275
|
keyCode: num,
|
|
264
276
|
},
|
|
265
277
|
});
|
|
266
|
-
|
|
278
|
+
toaster.show({
|
|
279
|
+
message: `Configuration saved, press '${num}' again to reload it.`,
|
|
280
|
+
});
|
|
267
281
|
}
|
|
268
282
|
}
|
|
269
283
|
}
|
|
270
|
-
}, [
|
|
284
|
+
}, [data, dispatch, keysPreferences, toaster]);
|
|
271
285
|
const toolsListenerHandler = useCallback((e) => {
|
|
272
286
|
try {
|
|
273
287
|
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
@@ -340,7 +354,7 @@ function KeysListenerTracker(props) {
|
|
|
340
354
|
}
|
|
341
355
|
case 'c': {
|
|
342
356
|
if (allow1DTool && isToolVisible('spectraCenterAlignments')) {
|
|
343
|
-
|
|
357
|
+
alignSpectraVerticallyHandler();
|
|
344
358
|
}
|
|
345
359
|
break;
|
|
346
360
|
}
|
|
@@ -384,7 +398,7 @@ function KeysListenerTracker(props) {
|
|
|
384
398
|
switch (e.key) {
|
|
385
399
|
case 's':
|
|
386
400
|
case 'S':
|
|
387
|
-
|
|
401
|
+
openSaveAsDialog();
|
|
388
402
|
e.preventDefault();
|
|
389
403
|
break;
|
|
390
404
|
default:
|
|
@@ -393,11 +407,10 @@ function KeysListenerTracker(props) {
|
|
|
393
407
|
}
|
|
394
408
|
catch (error) {
|
|
395
409
|
reportError(error);
|
|
396
|
-
|
|
410
|
+
toaster.show({ message: error.message, intent: 'danger' });
|
|
397
411
|
}
|
|
398
412
|
}, [
|
|
399
|
-
|
|
400
|
-
alignSpectrumsVerticallyHandler,
|
|
413
|
+
alignSpectraVerticallyHandler,
|
|
401
414
|
allow1DTool,
|
|
402
415
|
changeDisplayViewModeHandler,
|
|
403
416
|
dispatch,
|
|
@@ -405,9 +418,10 @@ function KeysListenerTracker(props) {
|
|
|
405
418
|
handleFullZoomOut,
|
|
406
419
|
isToolVisible,
|
|
407
420
|
openLoader,
|
|
408
|
-
|
|
421
|
+
openSaveAsDialog,
|
|
409
422
|
saveAsJSONHandler,
|
|
410
423
|
saveToClipboardHandler,
|
|
424
|
+
toaster,
|
|
411
425
|
]);
|
|
412
426
|
const handleOnKeyDown = useCallback((e) => {
|
|
413
427
|
if (checkNotInputField(e) && mouseIsOverDisplayer.current) {
|
|
@@ -434,7 +448,7 @@ function KeysListenerTracker(props) {
|
|
|
434
448
|
document.addEventListener('keydown', handleOnKeyDown);
|
|
435
449
|
return () => document.removeEventListener('keydown', handleOnKeyDown);
|
|
436
450
|
}, [handleOnKeyDown]);
|
|
437
|
-
return
|
|
451
|
+
return (_jsx(SaveAsModal, { isOpen: isSaveModalOpened, onCloseDialog: closeSaveAsDialog }));
|
|
438
452
|
}
|
|
439
453
|
function checkNotInputField(e) {
|
|
440
454
|
const tags = ['input', 'textarea'];
|
|
@@ -11,8 +11,8 @@ import { MoleculeActions } from '../reducer/actions/MoleculeActions';
|
|
|
11
11
|
import { PeaksActions } from '../reducer/actions/PeaksActions';
|
|
12
12
|
import { PreferencesActions } from '../reducer/actions/PreferencesActions';
|
|
13
13
|
import { RangesActions } from '../reducer/actions/RangesActions';
|
|
14
|
+
import { SpectrumActions } from '../reducer/actions/SpectraActions';
|
|
14
15
|
import { SpectraAnalysisActions } from '../reducer/actions/SpectraAnalysisAction';
|
|
15
|
-
import { SpectrumActions } from '../reducer/actions/SpectrumsActions';
|
|
16
16
|
import { ToolsActions } from '../reducer/actions/ToolsActions';
|
|
17
17
|
import { ZonesActions } from '../reducer/actions/ZonesActions';
|
|
18
18
|
import { ActionType } from '../reducer/types/ActionType';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OverlayToaster, ToastProps } from '@blueprintjs/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface ToasterContextProps {
|
|
4
|
+
toaster: OverlayToaster | null;
|
|
5
|
+
showLoading: (options: ToastProps) => () => void;
|
|
6
|
+
show: (options: ToastProps) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useToaster(): ToasterContextProps;
|
|
9
|
+
interface ToasterProviderProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function ToasterProvider({ children }: ToasterProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Classes, OverlayToaster, Position, Spinner, } from '@blueprintjs/core';
|
|
3
|
+
import { createContext, useContext, useMemo, useRef } from 'react';
|
|
4
|
+
const ToasterContext = createContext(null);
|
|
5
|
+
export function useToaster() {
|
|
6
|
+
const context = useContext(ToasterContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error('Toaster context was not found');
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
export function ToasterProvider({ children }) {
|
|
13
|
+
const toasterRef = useRef(null);
|
|
14
|
+
const toaster = useMemo(() => {
|
|
15
|
+
function show(options) {
|
|
16
|
+
toasterRef.current?.show(options);
|
|
17
|
+
}
|
|
18
|
+
function showLoading(options) {
|
|
19
|
+
const { message, ...otherProps } = options;
|
|
20
|
+
const toastKey = toasterRef.current?.show({
|
|
21
|
+
message: (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(Spinner, { size: 25 }), _jsx("span", { style: { marginLeft: '0.5em' }, children: message })] })),
|
|
22
|
+
timeout: 0,
|
|
23
|
+
...otherProps,
|
|
24
|
+
});
|
|
25
|
+
return () => {
|
|
26
|
+
if (toastKey) {
|
|
27
|
+
toasterRef.current?.dismiss(toastKey);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return { toaster: toasterRef.current, showLoading, show };
|
|
32
|
+
}, []);
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx(OverlayToaster, { className: Classes.DARK, position: Position.BOTTOM, ref: toasterRef }), _jsx(ToasterContext.Provider, { value: toaster, children: children })] }));
|
|
34
|
+
}
|
|
@@ -4,7 +4,7 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import Button from './Button';
|
|
5
5
|
export default function Label(props) {
|
|
6
6
|
const { title, shortTitle, className = '', children, style, description, renderTitle, ...otherProps } = props;
|
|
7
|
-
return (_jsxs("
|
|
7
|
+
return (_jsxs("label", { style: { display: 'flex', alignItems: 'center', ...style?.container }, ...otherProps, children: [_jsxs("span", { className: className, style: {
|
|
8
8
|
fontSize: '12px',
|
|
9
9
|
color: '#232323',
|
|
10
10
|
paddingRight: '10px',
|
|
@@ -32,13 +32,13 @@ const styles = {
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
const Select = forwardRef(function Select(props, ref) {
|
|
35
|
-
const { items, style = { width: 100 }, onChange = () => null, defaultValue, value, name = '', className = '', placeholder = '', itemValueField = 'value', itemTextField = 'label', returnValue = true, textRender, } = props;
|
|
35
|
+
const { items, style = { width: 100 }, onChange = () => null, defaultValue, value, name = '', className = '', placeholder = '', itemValueField = 'value', itemTextField = 'label', returnValue = true, textRender, ...otherProps } = props;
|
|
36
36
|
const handleOnChanged = useCallback((e) => {
|
|
37
37
|
const [option] = e.target.selectedOptions;
|
|
38
38
|
const selectedData = JSON.parse(option.dataset.value);
|
|
39
39
|
onChange(returnValue ? selectedData[itemValueField] : selectedData);
|
|
40
40
|
}, [itemValueField, onChange, returnValue]);
|
|
41
|
-
return (_jsxs("select", { ref: ref, css: styles.select(style?.width), name: name, onChange: handleOnChanged, defaultValue: defaultValue, value: value, className: className, style: style, required: true, children: [placeholder && (_jsx("option", { value: "", disabled: true, children: placeholder })), items.map((option) => {
|
|
41
|
+
return (_jsxs("select", { ref: ref, css: styles.select(style?.width), name: name, onChange: handleOnChanged, defaultValue: defaultValue, value: value, className: className, style: style, required: true, ...otherProps, children: [placeholder && (_jsx("option", { value: "", disabled: true, children: placeholder })), items.map((option) => {
|
|
42
42
|
const value = option[itemValueField];
|
|
43
43
|
if (!['number', 'string'].includes(typeof option[itemTextField])) {
|
|
44
44
|
// eslint-disable-next-line no-console
|
|
@@ -5,6 +5,6 @@ export function ToolbarPopoverItem(props) {
|
|
|
5
5
|
const { options, onClick, ...itemProps } = props;
|
|
6
6
|
return (_jsx(Toolbar.PopoverItem, { content: _jsx(Menu, { children: options.map((option) => {
|
|
7
7
|
const { data, ...otherOptions } = option;
|
|
8
|
-
return (_jsx(MenuItem, { ...otherOptions, onClick: () => onClick(data) }, JSON.stringify(
|
|
8
|
+
return (_jsx(MenuItem, { ...otherOptions, onClick: () => onClick(data) }, JSON.stringify(option)));
|
|
9
9
|
}) }), itemProps: itemProps }));
|
|
10
10
|
}
|
|
@@ -62,7 +62,7 @@ function ApodizationOptionsInnerPanel(props) {
|
|
|
62
62
|
if (props.filter) {
|
|
63
63
|
formData = { ...initialValues, ...props.filter.value, livePreview: true };
|
|
64
64
|
}
|
|
65
|
-
return (_jsx(HeaderContainer, { children: _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: formData, validationSchema: validationSchema, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Line broadening
|
|
65
|
+
return (_jsx(HeaderContainer, { children: _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: formData, validationSchema: validationSchema, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Line broadening:", shortTitle: "LB:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "lineBroadening", min: 0, max: 1, step: 0.1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Gauss broadening:", shortTitle: "GB:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "gaussBroadening", min: 0, max: 1, step: 0.1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Line broadening center [0 - 1]:", shortTitle: "LB center:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "lineBroadeningCenter", min: 0, max: 1, step: 0.1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Live preview", style: { label: { padding: '0 5px' } }, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), _jsx(ActionButtons, { onDone: submitForm, onCancel: handleCancelFilter })] })) }) }));
|
|
66
66
|
}
|
|
67
67
|
const MemoizedApodizationPanel = memo(ApodizationOptionsInnerPanel);
|
|
68
68
|
export default function ApodizationOptionsPanel() {
|
|
@@ -3,11 +3,11 @@ import { Formik } from 'formik';
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import * as Yup from 'yup';
|
|
5
5
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
|
+
import { useToaster } from '../context/ToasterContext';
|
|
6
7
|
import Button from '../elements/Button';
|
|
7
8
|
import Label from '../elements/Label';
|
|
8
9
|
import FormikInput from '../elements/formik/FormikInput';
|
|
9
10
|
import FormikSelect from '../elements/formik/FormikSelect';
|
|
10
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
11
11
|
import { MIN_AREA_POINTS, useCheckPointsNumberInWindowArea, } from '../hooks/useCheckPointsNumberInWindowArea';
|
|
12
12
|
import { headerLabelStyle } from './Header';
|
|
13
13
|
import { HeaderContainer } from './HeaderContainer';
|
|
@@ -46,7 +46,7 @@ const INIT_VALUES = {
|
|
|
46
46
|
function AutoPeakPickingOptionPanel() {
|
|
47
47
|
const dispatch = useDispatch();
|
|
48
48
|
const pointsNumber = useCheckPointsNumberInWindowArea();
|
|
49
|
-
const
|
|
49
|
+
const toaster = useToaster();
|
|
50
50
|
function handlePeakPicking(values) {
|
|
51
51
|
if (pointsNumber > MIN_AREA_POINTS) {
|
|
52
52
|
dispatch({
|
|
@@ -55,9 +55,12 @@ function AutoPeakPickingOptionPanel() {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
|
|
58
|
+
toaster.show({
|
|
59
|
+
message: `Auto peak picking only available for area more than ${MIN_AREA_POINTS} points`,
|
|
60
|
+
intent: 'danger',
|
|
61
|
+
});
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
|
-
return (_jsx(HeaderContainer, { children: _jsx(Formik, { initialValues: INIT_VALUES, onSubmit: handlePeakPicking, validationSchema: validationSchema, children: ({ handleSubmit, isValid }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Direction
|
|
64
|
+
return (_jsx(HeaderContainer, { children: _jsx(Formik, { initialValues: INIT_VALUES, onSubmit: handlePeakPicking, validationSchema: validationSchema, children: ({ handleSubmit, isValid }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Direction:", shortTitle: "", style: headerLabelStyle, children: _jsx(FormikSelect, { name: "direction", items: LookFor, style: { width: '85px' } }) }), _jsx(Label, { title: "Max number of peaks:", shortTitle: "Max peaks:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "maxNumberOfPeaks", style: inputStyle, min: 0, step: 1 }) }), _jsx(Label, { title: "Noise factor:", shortTitle: "Noise:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "noiseFactor", style: inputStyle, min: 0 }) }), _jsx(Label, { title: "Min/max Ratio:", shortTitle: "Ratio:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "minMaxRatio", style: inputStyle, step: 0.01, min: 0 }) }), _jsx(Button.Done, { onClick: () => handleSubmit(), style: { margin: '0 10px' }, disabled: !isValid, children: "Apply" })] })) }) }));
|
|
62
65
|
}
|
|
63
66
|
export default memo(AutoPeakPickingOptionPanel);
|
|
@@ -107,8 +107,8 @@ function BaseLineCorrectionInnerPanel(props) {
|
|
|
107
107
|
setAlgorithm(selectedAlgorithm);
|
|
108
108
|
}
|
|
109
109
|
const form = formData(algorithm, props?.filter?.value || {});
|
|
110
|
-
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Algorithm: ", style: headerLabelStyle, children: _jsx(Select, { items: getAlgorithmsList(), value: algorithm, onChange: handleChangeAlgorithm }) }), _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: form.values, validationSchema: form.validation, enableReinitialize: true, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "
|
|
111
|
-
['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "
|
|
110
|
+
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Algorithm: ", style: headerLabelStyle, children: _jsx(Select, { items: getAlgorithmsList(), value: algorithm, onChange: handleChangeAlgorithm }) }), _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: form.values, validationSchema: form.validation, enableReinitialize: true, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "Max iterations:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "maxIterations", debounceTime: 250, style: inputStyle }) }), _jsx(Label, { title: "Tolerance:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "tolerance", debounceTime: 250, style: inputStyle }) })] })), algorithm &&
|
|
111
|
+
['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "Degree [1 - 6]:", shortTitle: "Degree:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: inputStyle, debounceTime: 250 }) })), _jsx(Label, { title: "Live preview", style: headerLabelStyle, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), _jsx(ActionButtons, { onDone: submitForm, onCancel: handleCancelFilter })] })) })] }));
|
|
112
112
|
}
|
|
113
113
|
const MemoizedBaseLineCorrectionPanel = memo(BaseLineCorrectionInnerPanel);
|
|
114
114
|
export default function BaseLineCorrectionPanel() {
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import { LabelStyle } from '../elements/Label';
|
|
2
2
|
export declare const headerLabelStyle: LabelStyle;
|
|
3
|
-
|
|
4
|
-
onEnableFullscreen: () => void;
|
|
5
|
-
isFullscreenEnabled: boolean;
|
|
6
|
-
selectedOptionPanel: string | null;
|
|
7
|
-
height: number;
|
|
8
|
-
}
|
|
9
|
-
export default function HeaderWrapper({ isFullscreenEnabled, onEnableFullscreen, }: {
|
|
10
|
-
isFullscreenEnabled: HeaderInnerProps['isFullscreenEnabled'];
|
|
11
|
-
onEnableFullscreen: HeaderInnerProps['onEnableFullscreen'];
|
|
12
|
-
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
3
|
+
export default function HeaderWrapper(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useMemo, useCallback, memo } from 'react';
|
|
5
5
|
import { FaRegWindowMaximize, FaQuestionCircle, FaRegSave, FaFilm, } from 'react-icons/fa';
|
|
6
|
-
import { Toolbar } from 'react-science/ui';
|
|
6
|
+
import { Toolbar, useFullscreen } from 'react-science/ui';
|
|
7
7
|
import { docsBaseUrl } from '../../constants';
|
|
8
8
|
import { useChartData } from '../context/ChartContext';
|
|
9
9
|
import { usePreferences, useWorkspacesList, } from '../context/PreferencesContext';
|
|
@@ -62,8 +62,9 @@ const styles = css `
|
|
|
62
62
|
}
|
|
63
63
|
`;
|
|
64
64
|
function HeaderInner(props) {
|
|
65
|
-
const {
|
|
65
|
+
const { selectedOptionPanel, height } = props;
|
|
66
66
|
const { current: { display: { general }, }, workspace, dispatch, } = usePreferences();
|
|
67
|
+
const fullscreen = useFullscreen();
|
|
67
68
|
const workspacesList = useWorkspacesList();
|
|
68
69
|
const hideGeneralSettings = !!(general?.hideGeneralSettings && workspace.base);
|
|
69
70
|
const hideWorkspaces = !!(general?.hideWorkspaces && workspace.base);
|
|
@@ -104,7 +105,7 @@ function HeaderInner(props) {
|
|
|
104
105
|
alignItems: 'center',
|
|
105
106
|
}, children: [_jsx("div", { children: _jsx(Toolbar, { children: _jsx(AboutUsModal, {}) }) }), _jsx("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), _jsxs(HeaderContainer, { style: {
|
|
106
107
|
alignItems: 'center',
|
|
107
|
-
}, children: [!hideWorkspaces && (_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem })), !hideGeneralSettings && _jsx(SaveButton, {}), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { children: [!general?.hideHelp && (_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), icon: _jsx(FaQuestionCircle, {}) })), _jsx(Toolbar.Item, { id: "user-manual", title: "NMRium channel", onClick: () => window.open('https://www.youtube.com/@nmrium', '_blank'), icon: _jsx(FaFilm, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !
|
|
108
|
+
}, children: [!hideWorkspaces && (_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem })), !hideGeneralSettings && _jsx(SaveButton, {}), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { children: [!general?.hideHelp && (_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), icon: _jsx(FaQuestionCircle, {}) })), _jsx(Toolbar.Item, { id: "user-manual", title: "NMRium channel", onClick: () => window.open('https://www.youtube.com/@nmrium', '_blank'), icon: _jsx(FaFilm, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !fullscreen.isFullScreen && !general?.hideMaximize && (_jsx(Toolbar.Item, { id: "full-screen", onClick: fullscreen.toggle, title: "Full screen", className: "windowButton", icon: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
|
|
108
109
|
}
|
|
109
110
|
function SaveButton() {
|
|
110
111
|
const { workspace, workspaces, originalWorkspaces } = usePreferences();
|
|
@@ -121,10 +122,8 @@ function SaveButton() {
|
|
|
121
122
|
}), toolTip: "Save workspace locally in the browser", children: _jsx(FaRegSave, {}) }), _jsx(SaveSettingsModal, {})] }));
|
|
122
123
|
}
|
|
123
124
|
const MemoizedHeader = memo(HeaderInner);
|
|
124
|
-
export default function HeaderWrapper(
|
|
125
|
+
export default function HeaderWrapper() {
|
|
125
126
|
const { toolOptions: { selectedOptionPanel }, height, } = useChartData();
|
|
126
127
|
return (_jsx(MemoizedHeader, { selectedOptionPanel,
|
|
127
|
-
isFullscreenEnabled,
|
|
128
|
-
onEnableFullscreen,
|
|
129
128
|
height }));
|
|
130
129
|
}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select } from '@blueprintjs/select';
|
|
2
3
|
import { Filters } from 'nmr-processing';
|
|
3
4
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { Button, useSelect } from 'react-science/ui';
|
|
4
6
|
import { useChartData } from '../context/ChartContext';
|
|
5
7
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
8
|
import ActionButtons from '../elements/ActionButtons';
|
|
7
9
|
import Input from '../elements/Input';
|
|
8
10
|
import InputRange from '../elements/InputRange';
|
|
9
11
|
import Label from '../elements/Label';
|
|
10
|
-
import Select from '../elements/Select';
|
|
11
12
|
import { useFilter } from '../hooks/useFilter';
|
|
12
13
|
import useSpectrum from '../hooks/useSpectrum';
|
|
13
14
|
import { headerLabelStyle } from './Header';
|
|
14
15
|
import { HeaderContainer } from './HeaderContainer';
|
|
15
|
-
const selectStyle = {
|
|
16
|
-
marginLeft: '5px',
|
|
17
|
-
marginRight: '10px',
|
|
18
|
-
border: 'none',
|
|
19
|
-
height: '20px',
|
|
20
|
-
};
|
|
21
16
|
const inputStyle = {
|
|
22
17
|
input: {
|
|
23
18
|
width: '70px',
|
|
@@ -27,23 +22,19 @@ const inputStyle = {
|
|
|
27
22
|
height: '100%',
|
|
28
23
|
},
|
|
29
24
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
absolute: 'absolute',
|
|
25
|
+
const defaultPhasingTypeItem = {
|
|
26
|
+
label: 'Manual',
|
|
27
|
+
value: 'manual',
|
|
34
28
|
};
|
|
35
29
|
const algorithms = [
|
|
36
|
-
|
|
37
|
-
label: 'Manual',
|
|
38
|
-
value: phaseCorrectionTypes.manual,
|
|
39
|
-
},
|
|
30
|
+
defaultPhasingTypeItem,
|
|
40
31
|
{
|
|
41
32
|
label: 'Automatic',
|
|
42
|
-
value:
|
|
33
|
+
value: 'automatic',
|
|
43
34
|
},
|
|
44
35
|
{
|
|
45
|
-
label: '
|
|
46
|
-
value:
|
|
36
|
+
label: 'Convert to absolute spectrum',
|
|
37
|
+
value: 'absolute',
|
|
47
38
|
},
|
|
48
39
|
];
|
|
49
40
|
const emptyData = { datum: {}, filter: null };
|
|
@@ -56,9 +47,12 @@ export default function PhaseCorrectionPanel() {
|
|
|
56
47
|
const valueRef = useRef({ ph0: 0, ph1: 0 });
|
|
57
48
|
const ph0Ref = useRef();
|
|
58
49
|
const ph1Ref = useRef();
|
|
59
|
-
const
|
|
50
|
+
const { value: phaseCorrectionTypeItem, ...defaultSelectProps } = useSelect({
|
|
51
|
+
defaultSelectedItem: defaultPhasingTypeItem,
|
|
52
|
+
itemTextKey: 'label',
|
|
53
|
+
});
|
|
60
54
|
useEffect(() => {
|
|
61
|
-
if (filter &&
|
|
55
|
+
if (filter && phaseCorrectionTypeItem?.value === 'manual') {
|
|
62
56
|
valueRef.current = filter.value;
|
|
63
57
|
setValue(filter.value);
|
|
64
58
|
}
|
|
@@ -72,23 +66,23 @@ export default function PhaseCorrectionPanel() {
|
|
|
72
66
|
ph1Ref.current.setValue(valueRef.current.ph1);
|
|
73
67
|
}
|
|
74
68
|
}
|
|
75
|
-
}, [filter,
|
|
76
|
-
|
|
77
|
-
switch (
|
|
78
|
-
case
|
|
69
|
+
}, [filter, phaseCorrectionTypeItem]);
|
|
70
|
+
function handleApplyFilter() {
|
|
71
|
+
switch (phaseCorrectionTypeItem?.value) {
|
|
72
|
+
case 'automatic': {
|
|
79
73
|
dispatch({
|
|
80
74
|
type: 'APPLY_AUTO_PHASE_CORRECTION_FILTER',
|
|
81
75
|
});
|
|
82
76
|
break;
|
|
83
77
|
}
|
|
84
|
-
case
|
|
78
|
+
case 'manual': {
|
|
85
79
|
dispatch({
|
|
86
80
|
type: 'APPLY_MANUAL_PHASE_CORRECTION_FILTER',
|
|
87
81
|
payload: value,
|
|
88
82
|
});
|
|
89
83
|
break;
|
|
90
84
|
}
|
|
91
|
-
case
|
|
85
|
+
case 'absolute': {
|
|
92
86
|
dispatch({
|
|
93
87
|
type: 'APPLY_ABSOLUTE_FILTER',
|
|
94
88
|
});
|
|
@@ -97,7 +91,7 @@ export default function PhaseCorrectionPanel() {
|
|
|
97
91
|
default:
|
|
98
92
|
break;
|
|
99
93
|
}
|
|
100
|
-
}
|
|
94
|
+
}
|
|
101
95
|
const calcPhaseCorrectionHandler = useCallback((newValues, filedName) => {
|
|
102
96
|
if (filedName === 'ph1' && data.re) {
|
|
103
97
|
const diff0 = newValues.ph0 - valueRef.current.ph0;
|
|
@@ -134,13 +128,10 @@ export default function PhaseCorrectionPanel() {
|
|
|
134
128
|
valueRef.current = newValue;
|
|
135
129
|
setValue(valueRef.current);
|
|
136
130
|
}, [calcPhaseCorrectionHandler, updateInputRangeInitialValue]);
|
|
137
|
-
|
|
131
|
+
function handleCancelFilter() {
|
|
138
132
|
dispatch({
|
|
139
133
|
type: 'RESET_SELECTED_TOOL',
|
|
140
134
|
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
setPhaseCorrectionType(val);
|
|
144
|
-
}, []);
|
|
145
|
-
return (_jsxs(HeaderContainer, { children: [_jsx(Select, { onChange: onChangeHandler, items: algorithms, defaultValue: phaseCorrectionTypes.manual, style: selectStyle }), phaseCorrectionType === phaseCorrectionTypes.manual && (_jsxs(_Fragment, { children: [_jsx(Label, { title: "PH0 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph0", style: inputStyle, onChange: handleInput, value: value.ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1 :", style: headerLabelStyle, children: _jsx(Input, { name: "ph1", style: inputStyle, onChange: handleInput, value: value.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 })] }));
|
|
135
|
+
}
|
|
136
|
+
return (_jsxs(HeaderContainer, { children: [_jsx("div", { style: { padding: '0 5px' }, children: _jsx(Select, { items: algorithms, filterable: false, itemsEqual: "value", ...defaultSelectProps, children: _jsx(Button, { text: phaseCorrectionTypeItem?.label, rightIcon: "double-caret-vertical" }) }) }), phaseCorrectionTypeItem?.value === 'manual' && (_jsxs(_Fragment, { children: [_jsx(Label, { title: "PH0:", style: headerLabelStyle, children: _jsx(Input, { name: "ph0", style: inputStyle, onChange: handleInput, value: value.ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1:", style: headerLabelStyle, children: _jsx(Input, { name: "ph1", style: inputStyle, onChange: handleInput, value: value.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 })] }));
|
|
146
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function PhaseCorrectionTwoDimensionsPanel(): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export default function PhaseCorrectionTwoDimensionsPanel(): import("@emotion/react/jsx-runtime").JSX.Element;
|